@visulima/vis 1.0.0-alpha.28 → 1.0.0-alpha.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/LICENSE.md +24 -24
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/packem_chunks/bin.js +297 -297
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/config.js +12 -12
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -2
- package/dist/packem_chunks/handler11.js +5 -1
- package/dist/packem_chunks/handler12.js +1 -5
- package/dist/packem_chunks/handler13.js +27 -1
- package/dist/packem_chunks/handler14.js +5 -27
- package/dist/packem_chunks/handler15.js +1 -5
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +5 -1
- package/dist/packem_chunks/handler21.js +2 -5
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +1 -2
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +5 -1
- package/dist/packem_chunks/handler26.js +1 -5
- package/dist/packem_chunks/handler27.js +3 -1
- package/dist/packem_chunks/handler28.js +1 -3
- package/dist/packem_chunks/handler29.js +7 -1
- package/dist/packem_chunks/handler3.js +4 -4
- package/dist/packem_chunks/handler30.js +32 -6
- package/dist/packem_chunks/handler31.js +3 -33
- package/dist/packem_chunks/handler32.js +8 -3
- package/dist/packem_chunks/handler33.js +1 -1
- package/dist/packem_chunks/handler34.js +2 -2
- package/dist/packem_chunks/handler35.js +11 -3
- package/dist/packem_chunks/handler36.js +3 -22
- package/dist/packem_chunks/handler37.js +21 -60
- package/dist/packem_chunks/handler38.js +61 -3
- package/dist/packem_chunks/handler39.js +3 -6
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler40.js +6 -24
- package/dist/packem_chunks/handler41.js +24 -153
- package/dist/packem_chunks/handler42.js +153 -25
- package/dist/packem_chunks/handler43.js +25 -10
- package/dist/packem_chunks/handler44.js +10 -708
- package/dist/packem_chunks/handler45.js +708 -24
- package/dist/packem_chunks/handler46.js +24 -322
- package/dist/packem_chunks/handler47.js +322 -48
- package/dist/packem_chunks/handler48.js +48 -3
- package/dist/packem_chunks/handler49.js +3 -27
- package/dist/packem_chunks/handler5.js +7 -7
- package/dist/packem_chunks/handler50.js +21 -189
- package/dist/packem_chunks/handler51.js +194 -33
- package/dist/packem_chunks/handler52.js +34 -0
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +4 -4
- package/dist/packem_chunks/index.js +2 -2
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/loader2.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +2 -2
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/Table-3pFgIUZ2-DABgc6rj.js +12 -0
- package/dist/packem_shared/{advisories-BxXiKFbL.js → advisories-DpgSuWDH.js} +1 -1
- package/dist/packem_shared/{affected-shas-Dm7eqcI8.js → affected-shas-BkXXecyi.js} +1 -1
- package/dist/packem_shared/ai-analysis-KP8b5lc0.js +68 -0
- package/dist/packem_shared/{ai-fix-BGbnrWCz.js → ai-fix-CfFWatGY.js} +7 -7
- package/dist/packem_shared/{applyDefaults-KxZkvlp3.js → applyDefaults-DLvOqXGX.js} +1 -1
- package/dist/packem_shared/{build-scripts-3E2pmscY.js → build-scripts-D-ysm_bS.js} +1 -1
- package/dist/packem_shared/{cyclonedx-C2k2HmvI.js → cyclonedx-B04lIvwu.js} +3 -3
- package/dist/packem_shared/{dependency-scan-Bki15Yi-.js → dependency-scan-B9wTcLxf.js} +1 -1
- package/dist/packem_shared/{docker-k-Sl8b-w.js → docker-DxA80dRx.js} +1 -1
- package/dist/packem_shared/{failure-log-C3bG1bCA.js → failure-log-n3j_-w8s.js} +1 -1
- package/dist/packem_shared/index-BDF8gawl.js +29 -0
- package/dist/packem_shared/{index-DBq4TVu5.js → index-BfG9_znI.js} +1 -1
- package/dist/packem_shared/{lifecycle-B91p_ra8.js → lifecycle-NHIKDiCh.js} +1 -1
- package/dist/packem_shared/lockfile-CoeFxWAv.js +1 -0
- package/dist/packem_shared/lockfile-DAuTDwow.js +1 -0
- package/dist/packem_shared/{manifests-Z3spBpxv.js → manifests-B7wUR3Rk.js} +1 -1
- package/dist/packem_shared/{min-release-age-B1Jm1_JY.js → min-release-age-YyNI7gqV.js} +1 -1
- package/dist/packem_shared/{native-config-sync-Cnpj2xcn.js → native-config-sync-CgRIIRZV.js} +7 -7
- package/dist/packem_shared/{osv-bloom-ep8GlDGT.js → osv-bloom-BQSIHt5h.js} +2 -2
- package/dist/packem_shared/{pm-runner-COoPLGKi.js → pm-runner-Ta_yz2uP.js} +1 -1
- package/dist/packem_shared/{provenance-DbkJRDqt.js → provenance-DoEp2uOo.js} +1 -1
- package/dist/packem_shared/{readFileSync-CGmzMUF2-D6rUjGDn.js → readFileSync-4c_c6Qey-6SWMDNdw.js} +1 -1
- package/dist/packem_shared/{registry-keys-SylX07bs.js → registry-keys-CD1xHavV.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-CJ_5wYSu.js → resolve-explicit-DpSc7RN2.js} +1 -1
- package/dist/packem_shared/{runtime-check-DgXsKCsv.js → runtime-check-Cbtb_Utb.js} +1 -1
- package/dist/packem_shared/{s1ngularity-DlS-4a6K.js → s1ngularity-CIX7UcT5.js} +1 -1
- package/dist/packem_shared/scan-progress-CTVVf9WW.js +2 -0
- package/dist/packem_shared/{selectors-BE2BCnTR.js → selectors-BU8aTRQm.js} +1 -1
- package/dist/packem_shared/{signatures-B-1u4t-c.js → signatures-BHM7cnqB.js} +1 -1
- package/dist/packem_shared/{spinner-B9ZPv1iT.js → spinner-C8xs6QZv.js} +1 -1
- package/dist/packem_shared/{tabs-C-qFIoUv.js → tabs-xZkm6Y_J.js} +1 -1
- package/dist/packem_shared/{toolchain-Jx2lkAYy.js → toolchain-juKl-WgV.js} +1 -1
- package/dist/packem_shared/typosquats-DRKU6d2S.js +1 -0
- package/dist/packem_shared/{use-measured-height-kIDCuc76.js → use-measured-height-Lea6TCVD.js} +1 -1
- package/dist/packem_shared/{verify-C8EAHql6.js → verify-DA80ja1b.js} +1 -1
- package/dist/packem_shared/{vis-update-app-COYmjGKv.js → vis-update-app-BCKzlqj8.js} +1 -1
- package/dist/packem_shared/{watch-BSVsZ_1I.js → watch-DdR-pFzX.js} +1 -1
- package/dist/packem_shared/{watch-loop-CP318TfG.js → watch-loop-C8csFvRU.js} +1 -1
- package/index.d.ts +201 -201
- package/index.js +567 -751
- package/package.json +13 -13
- package/dist/packem_shared/Table-CwC2kW07-EjFLNV0q.js +0 -12
- package/dist/packem_shared/ai-analysis-BnmDFqc8.js +0 -68
- package/dist/packem_shared/index-2r730kXY.js +0 -29
- package/dist/packem_shared/lockfile-DmDfgKaT.js +0 -1
- package/dist/packem_shared/scan-progress-CU4ttEHQ.js +0 -2
- package/dist/packem_shared/typosquats-BxCOUvTJ.js +0 -1
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var Rn=Object.defineProperty;var N=(t,e)=>Rn(t,"name",{value:e,configurable:!0});import{createRequire as zn}from"node:module";import"./_commonjsHelpers-CLblCigl.js";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
|
-
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
-
const Fn=zn(import.meta.url),pe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Wn=N(t=>{if(typeof pe<"u"&&pe.versions&&pe.versions.node){const[e,n]=pe.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return pe.getBuiltinModule(t)}return Fn(t)},"__cjs_getBuiltinModule"),{createRequire:Ke}=Wn("node:module"),qn=16,et=32,Gn=64,re=128,Oe="positionals";var Hn=Object.defineProperty,_t=N((t,e)=>Hn(t,"name",{value:e,configurable:!0}),"i$6"),Kn=Object.defineProperty,Lt=_t((t,e)=>Kn(t,"name",{value:e,configurable:!0}),"s"),Jn=Object.defineProperty,St=Lt((t,e)=>Jn(t,"name",{value:e,configurable:!0}),"s"),Zn=Object.defineProperty,Tt=St((t,e)=>Zn(t,"name",{value:e,configurable:!0}),"i"),Yn=Object.defineProperty,It=Tt((t,e)=>Yn(t,"name",{value:e,configurable:!0}),"t");It(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");let Qn=class extends Error{static{N(this,"V")}static{_t(this,"g")}static{Lt(this,"p")}static{St(this,"V")}static{Tt(this,"VisulimaError")}static{It(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:i,message:r,name:o,stack:l,title:s}){super(r,{cause:e}),this.title=s,this.name=o,this.stack=l??this.stack,this.loc=i,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}};var Xn=Object.defineProperty,Mt=N((t,e)=>Xn(t,"name",{value:e,configurable:!0}),"t$3"),ei=Object.defineProperty,Vt=Mt((t,e)=>ei(t,"name",{value:e,configurable:!0}),"t"),ti=Object.defineProperty,ni=Vt((t,e)=>ti(t,"name",{value:e,configurable:!0}),"e");let E=class extends Qn{static{N(this,"m")}static{Mt(this,"u")}static{Vt(this,"c")}static{ni(this,"CerebroError")}code;context;constructor(e,n,i){super({message:e,name:"CerebroError"}),this.code=n,this.context=i}};var ii=Object.defineProperty,oi=N((t,e)=>ii(t,"name",{value:e,configurable:!0}),"a$2"),ri=Object.defineProperty,ai=oi((t,e)=>ri(t,"name",{value:e,configurable:!0}),"l"),si=Object.defineProperty,T=ai((t,e)=>si(t,"name",{value:e,configurable:!0}),"r");const B=T(t=>"Deno"in t,"hasDeno"),D=T(t=>"Bun"in t,"hasBun"),xe=T(()=>{if(B(globalThis)){const t=globalThis.Deno,e=t.execPath();let n=e;try{const{importMeta:i}=globalThis;i?.url&&(n=i.url)}catch{}return[e,n,...t.args]}return D(globalThis)?globalThis.Bun.process.argv:process.argv},"getArgv"),li=T(()=>B(globalThis)?globalThis.Deno.cwd():D(globalThis)?globalThis.Bun.process.cwd():process.cwd(),"getCwd"),H=T(()=>{if(B(globalThis)){const t=globalThis.Deno;return new Proxy(t.env.toObject(),{get:T((e,n)=>typeof n=="string"?t.env.get(n):e[n],"get"),has:T((e,n)=>typeof n=="string"?t.env.has(n):n in e,"has"),set:T((e,n,i)=>typeof n=="string"?(i===void 0||t.env.set(n,i),!0):!1,"set")})}return D(globalThis)?globalThis.Bun.process.env:process.env},"getEnv"),Ut=T(()=>B(globalThis)?[]:D(globalThis)?globalThis.Bun.process.execArgv:process.execArgv,"getExecArgv"),Bt=T(()=>B(globalThis)?globalThis.Deno.execPath():D(globalThis)?globalThis.Bun.process.execPath:process.execPath,"getExecPath"),ci=T(()=>{if(B(globalThis)){const t=globalThis.Deno.build?.os??"unknown";return t==="windows"?"win32":t}return D(globalThis)?globalThis.Bun.platform??"unknown":process.platform},"getPlatform"),ui=T(()=>{if(B(globalThis)){const t=globalThis.Deno.build?.arch??"unknown";return t==="x86_64"?"x64":t==="aarch64"?"arm64":t}return D(globalThis)?globalThis.Bun.process.arch:process.arch},"getArch");T(()=>{if(B(globalThis)){const t=globalThis.Deno,e={};return t.version?.deno&&(e.deno=t.version.deno),t.version?.v8&&(e.v8=t.version.v8),t.version?.typescript&&(e.typescript=t.version.typescript),e}if(D(globalThis)){const t=globalThis.Bun,e={...t.process.versions};return t.version&&(e.bun=t.version),e}return process.versions},"getVersions");const W=T((t=0)=>{if(B(globalThis))throw globalThis.Deno.exit(t),new Error("Deno exit failed");if(D(globalThis))throw globalThis.Bun.process.exit(t),new Error("Bun exit failed");process.exit(t)},"exitProcess"),tt=T((t,e)=>{if(B(globalThis))return()=>{};if(D(globalThis)){try{const i=globalThis.Bun;if(i.process?.on)return i.process.on(t,e),()=>{i.process?.removeListener&&i.process.removeListener(t,e)}}catch{}return()=>{}}const n=process;return n.on(t,e),()=>{n.removeListener(t,e)}},"onProcessEvent");var pi=Object.defineProperty,Ee=N((t,e)=>pi(t,"name",{value:e,configurable:!0}),"k$2");const F=new Uint32Array(65536),fi=Ee((t,e)=>{const n=t.length,i=e.length,r=1<<n-1;let o=-1,l=0,s=n,p=n;for(;p--;)F[t.charCodeAt(p)]|=1<<p;for(p=0;p<i;p++){let a=F[e.charCodeAt(p)];const c=a|l;a|=(a&o)+o^o,l|=~(a|o),o&=a,l&r&&s++,o&r&&s--,l=l<<1|1,o=o<<1|~(c|l),l&=c}for(p=n;p--;)F[t.charCodeAt(p)]=0;return s},"myers_32"),di=Ee((t,e)=>{const n=e.length,i=t.length,r=[],o=[],l=Math.ceil(n/32),s=Math.ceil(i/32);for(let u=0;u<l;u++)o[u]=-1,r[u]=0;let p=0;for(;p<s-1;p++){let u=0,v=-1;const w=p*32,y=Math.min(32,i)+w;for(let O=w;O<y;O++)F[t.charCodeAt(O)]|=1<<O;for(let O=0;O<n;O++){const A=F[e.charCodeAt(O)],h=o[O/32|0]>>>O&1,m=r[O/32|0]>>>O&1,b=A|u,$=((A|m)&v)+v^v|A|m;let P=u|~($|v),j=v&$;P>>>31^h&&(o[O/32|0]^=1<<O),j>>>31^m&&(r[O/32|0]^=1<<O),P=P<<1|h,j=j<<1|m,v=j|~(b|P),u=P&b}for(let O=w;O<y;O++)F[t.charCodeAt(O)]=0}let a=0,c=-1;const d=p*32,f=Math.min(32,i-d)+d;for(let u=d;u<f;u++)F[t.charCodeAt(u)]|=1<<u;let g=i;for(let u=0;u<n;u++){const v=F[e.charCodeAt(u)],w=o[u/32|0]>>>u&1,y=r[u/32|0]>>>u&1,O=v|a,A=((v|y)&c)+c^c|v|y;let h=a|~(A|c),m=c&A;g+=h>>>i-1&1,g-=m>>>i-1&1,h>>>31^w&&(o[u/32|0]^=1<<u),m>>>31^y&&(r[u/32|0]^=1<<u),h=h<<1|w,m=m<<1|y,c=m|~(O|h),a=h&O}for(let u=d;u<f;u++)F[t.charCodeAt(u)]=0;return g},"myers_x"),Dt=Ee((t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return e.length===0?t.length:t.length<=32?fi(t,e):di(t,e)},"distance");Ee((t,e)=>{let n=1/0,i=0;for(let r=0;r<e.length;r++){const o=Dt(t,e[r]);o<n&&(n=o,i=r)}return e[i]},"closest");var hi=Object.defineProperty,mi=N((t,e)=>hi(t,"name",{value:e,configurable:!0}),"a$1"),gi=Object.defineProperty,vi=mi((t,e)=>gi(t,"name",{value:e,configurable:!0}),"a"),bi=Object.defineProperty,yi=vi((t,e)=>bi(t,"name",{value:e,configurable:!0}),"p"),wi=Object.defineProperty,Rt=yi((t,e)=>wi(t,"name",{value:e,configurable:!0}),"e"),$i=Object.defineProperty,Oi=Rt((t,e)=>$i(t,"name",{value:e,configurable:!0}),"E");const zt=String.raw,nt=zt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,xi=Oi(()=>new RegExp(zt`\p{RI}{2}|(?)${nt}(?:\u200D${nt})*`,"gu"),"default");var Pi=Object.defineProperty,Ai=Rt((t,e)=>Pi(t,"name",{value:e,configurable:!0}),"p");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const Mc=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,Vc=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,se=xi(),Ei=/[-_./\s]+/g,ge=/(\u001B\[[0-9;]*[a-z])/i,it=new RegExp("\\p{Script=Arabic}","u"),Ci=new RegExp("\\p{Script=Bengali}","u"),ie=new RegExp("\\p{Script=Cyrillic}","u"),Ni=new RegExp("\\p{Script=Devanagari}","u"),ki=new RegExp("\\p{Script=Ethiopic}","u"),Ue=new RegExp("\\p{Script=Greek}","u"),ot=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),ji=new RegExp("\\p{Script=Gujarati}","u"),_i=new RegExp("\\p{Script=Gurmukhi}","u"),rt=new RegExp("\\p{Script=Hangul}","u"),at=new RegExp("\\p{Script=Hebrew}","u"),Li=new RegExp("\\p{Script=Hiragana}","u"),st=new RegExp("\\p{Script=Han}","u"),Si=new RegExp("\\p{Script=Kannada}","u"),Ti=new RegExp("\\p{Script=Katakana}","u"),Ii=new RegExp("\\p{Script=Khmer}","u"),Mi=new RegExp("\\p{Script=Lao}","u"),I=new RegExp("\\p{Script=Latin}","u"),Vi=new RegExp("\\p{Script=Malayalam}","u"),Ui=new RegExp("\\p{Script=Myanmar}","u"),Bi=new RegExp("\\p{Script=Oriya}","u"),Di=new RegExp("\\p{Script=Sinhala}","u"),Ri=new RegExp("\\p{Script=Tamil}","u"),zi=new RegExp("\\p{Script=Telugu}","u"),Fi=new RegExp("\\p{Script=Thai}","u"),Wi=new RegExp("\\p{Script=Tibetan}","u"),lt=/[\u02BB\u02BC\u0027]/u,qi=Ai(t=>t.replace(se,""),"stripEmoji");var Gi=Object.defineProperty,S=N((t,e)=>Gi(t,"name",{value:e,configurable:!0}),"x$2"),Hi=Object.defineProperty,x=S((t,e)=>Hi(t,"name",{value:e,configurable:!0}),"O");const Ki=Ke(import.meta.url),fe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ft=x(t=>{if(typeof fe<"u"&&fe.versions&&fe.versions.node){const[e,n]=fe.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return fe.getBuiltinModule(t)}return Ki(t)},"__cjs_getBuiltinModule"),{writeFile:Ji,stat:Zi,rm:Yi,readFile:ct,readdir:Qi,mkdir:Xi,access:eo}=Ft("node:fs/promises"),{createRequire:to}=Ft("node:module"),ye=[{description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];var no=Object.defineProperty,io=x((t,e)=>no(t,"name",{value:e,configurable:!0}),"t$9");let K=class extends E{static{N(this,"D")}static{S(this,"S")}static{x(this,"a")}static{io(this,"CommandNotFoundError")}commandName;constructor(e,n=[]){const i=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(i,"COMMAND_NOT_FOUND",{commandName:e,suggestions:n}),this.name="CommandNotFoundError",this.commandName=e,n.length>0&&(this.hint=`Try one of these commands: ${n.join(", ")}`)}};var oo=Object.defineProperty,ro=x((t,e)=>oo(t,"name",{value:e,configurable:!0}),"e$7");let Wt=class extends E{static{N(this,"at")}static{S(this,"at")}static{x(this,"o")}static{ro(this,"ConflictingOptionsError")}option1;option2;constructor(t,e){super(`Options "${t}" and "${e}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:t,option2:e}),this.name="ConflictingOptionsError",this.option1=t,this.option2=e,this.hint=`Remove either --${t} or --${e}`}};var ao=Object.defineProperty,so=x((t,e)=>ao(t,"name",{value:e,configurable:!0}),"e$6");let lo=class extends E{static{N(this,"jn")}static{S(this,"jn")}static{x(this,"o")}static{so(this,"PluginError")}pluginName;constructor(t,e,n){super(`Plugin "${t}" error: ${e}`,"PLUGIN_ERROR",{originalError:n,pluginName:t}),this.name="PluginError",this.pluginName=t,n&&(this.cause=n)}};var co=Object.defineProperty,ut=x((t,e)=>co(t,"name",{value:e,configurable:!0}),"d$7");let uo=class{static{N(this,"Mn")}static{S(this,"Un")}static{x(this,"p")}static{ut(this,"PluginManager")}logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(t){this.logger=t}hasPlugins(){return this.plugins.size>0}register(t){if(this.initialized)throw new Error(`Cannot register plugin "${t.name}" after initialization`);if(this.plugins.has(t.name))throw new Error(`Plugin "${t.name}" is already registered`);H().CEREBRO_OUTPUT_LEVEL===String(re)&&this.logger.debug(`registering plugin: ${t.name}`),this.plugins.set(t.name,t),this.cachedDependencyOrder=void 0}async init(t){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 e=this.getDependencyOrder();this.logger.debug(`initializing ${String(e.length)} plugin(s)...`);for(const n of e)if(typeof n.init=="function"){this.logger.debug(`initializing plugin: ${n.name}`);try{await n.init(t)}catch(i){const r=new lo(n.name,`Failed to initialize: ${i instanceof Error?i.message:String(i)}`,i instanceof Error?i:void 0);throw this.logger.error(r.message),r}}this.initialized=!0}async executeLifecycle(t,e,n){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const i=this.getDependencyOrder();for(const r of i){const o=r[t];if(typeof o=="function"){this.logger.debug(`executing ${t} hook for plugin: ${r.name}`);try{await(t==="afterCommand"?o(e,n):o(e))}catch(l){throw this.logger.error(`Error in ${t} hook for plugin "${r.name}":`,l),l}}}}async executeErrorHandlers(t,e){if(!this.initialized||this.plugins.size===0)return;const n=this.getDependencyOrder();for(const i of n)if(typeof i.onError=="function"){this.logger.debug(`executing error handler for plugin: ${i.name}`);try{await i.onError(t,e)}catch(r){this.logger.error(`Error in error handler for plugin "${i.name}":`,r)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const t=[],e=new Set,n=new Set,i=ut(r=>{if(e.has(r))return;if(n.has(r))throw new Error(`Circular dependency detected involving plugin "${r}"`);const o=this.plugins.get(r);if(!o)throw new Error(`Plugin "${r}" not found`);if(n.add(r),o.dependencies)for(const l of o.dependencies)i(l);n.delete(r),e.add(r),t.push(o)},"visit");for(const r of this.plugins.keys())i(r);return this.cachedDependencyOrder=t,t}validateDependencies(){for(const t of this.plugins.values())if(t.dependencies){for(const e of t.dependencies)if(!this.plugins.has(e))throw new Error(`Plugin "${t.name}" depends on "${e}" which is not registered`)}}};var po=Object.defineProperty,fo=x((t,e)=>po(t,"name",{value:e,configurable:!0}),"n$a");const ve=fo(t=>t.type?.name==="Boolean","optionIsBoolean");var ho=Object.defineProperty,qt=x((t,e)=>ho(t,"name",{value:e,configurable:!0}),"p$9");const mo=qt(t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},"getTypeLabel"),pt=qt(t=>(ve(t)||(t.typeLabel=t.typeLabel??mo(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),"mapOptionTypeLabel");var go=Object.defineProperty,Gt=x((t,e)=>go(t,"name",{value:e,configurable:!0}),"e$4");const vo=new RegExp(/^-([^\d-])$/),bo=new RegExp(/^--(\S+)/),yo=new RegExp(/^-([^\d-]{2,})$/),wo=Gt(t=>vo.test(t)||bo.test(t)||yo.test(t),"isOption"),$o=Gt((t,e)=>{const n=e[0]&&wo(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const i=new Error(`Command not recognised: ${String(n)}`);throw i.command=n,i.name="INVALID_COMMAND",i}return{argv:e,command:n}},"commandLineCommands");var Oo=Object.defineProperty,Ht=x((t,e)=>Oo(t,"name",{value:e,configurable:!0}),"i$b"),xo=Object.defineProperty,Kt=Ht((t,e)=>xo(t,"name",{value:e,configurable:!0}),"i"),Po=Object.defineProperty,Jt=Kt((t,e)=>Po(t,"name",{value:e,configurable:!0}),"s"),Ao=Object.defineProperty,Zt=Jt((t,e)=>Ao(t,"name",{value:e,configurable:!0}),"i"),Eo=Object.defineProperty,Yt=Zt((t,e)=>Eo(t,"name",{value:e,configurable:!0}),"t");Yt(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");let Ce=class extends Error{static{N(this,"ue")}static{S(this,"ce")}static{x(this,"v")}static{Ht(this,"g")}static{Kt(this,"p")}static{Jt(this,"V")}static{Zt(this,"VisulimaError")}static{Yt(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:i,message:r,name:o,stack:l,title:s}){super(r,{cause:e}),this.title=s,this.name=o,this.stack=l??this.stack,this.loc=i,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}};var Co=Object.defineProperty,Qt=x((t,e)=>Co(t,"name",{value:e,configurable:!0}),"o$b"),No=Object.defineProperty,Xt=Qt((t,e)=>No(t,"name",{value:e,configurable:!0}),"o"),ko=Object.defineProperty,jo=Xt((t,e)=>ko(t,"name",{value:e,configurable:!0}),"i");let _o=class en extends Ce{static{N(this,"mt")}static{S(this,"ht")}static{x(this,"a")}static{Qt(this,"a")}static{Xt(this,"t")}static{jo(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,en.prototype)}};var Lo=Object.defineProperty,tn=x((t,e)=>Lo(t,"name",{value:e,configurable:!0}),"t$7"),So=Object.defineProperty,nn=tn((t,e)=>So(t,"name",{value:e,configurable:!0}),"e"),To=Object.defineProperty,Io=nn((t,e)=>To(t,"name",{value:e,configurable:!0}),"e");let ft=class on extends Ce{static{N(this,"yt")}static{S(this,"vt")}static{x(this,"n")}static{tn(this,"n")}static{nn(this,"o")}static{Io(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,on.prototype)}};var Mo=Object.defineProperty,rn=x((t,e)=>Mo(t,"name",{value:e,configurable:!0}),"a$9"),Vo=Object.defineProperty,an=rn((t,e)=>Vo(t,"name",{value:e,configurable:!0}),"a"),Uo=Object.defineProperty,Bo=an((t,e)=>Uo(t,"name",{value:e,configurable:!0}),"o");let Do=class sn extends Ce{static{N(this,"Ot")}static{S(this,"bt")}static{x(this,"n")}static{rn(this,"o")}static{an(this,"e")}static{Bo(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,sn.prototype)}};var Ro=Object.defineProperty,ln=x((t,e)=>Ro(t,"name",{value:e,configurable:!0}),"i$8"),zo=Object.defineProperty,cn=ln((t,e)=>zo(t,"name",{value:e,configurable:!0}),"i"),Fo=Object.defineProperty,Wo=cn((t,e)=>Fo(t,"name",{value:e,configurable:!0}),"i");let M=class un extends Ce{static{N(this,"Nt")}static{S(this,"Pt")}static{x(this,"a")}static{ln(this,"o")}static{cn(this,"e")}static{Wo(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,un.prototype)}};var qo=Object.defineProperty,Go=x((t,e)=>qo(t,"name",{value:e,configurable:!0}),"z"),Ho=Object.defineProperty,le=Go((t,e)=>Ho(t,"name",{value:e,configurable:!0}),"S"),Ko=Object.defineProperty,Ne=le((t,e)=>Ko(t,"name",{value:e,configurable:!0}),"o");const dt=Ne(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),ht=Ne(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),mt=Ne(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),Jo=Ne((t,e)=>Array.isArray(t)?dt(e)?t.map(Boolean):ht(e)?t.map(Number):mt(e)?t.map(String):t.map(n=>e(String(n))):t===null?null:dt(e)?!!t:ht(e)?Number(t):mt(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t)),"convertValue");var Zo=Object.defineProperty,Yo=le((t,e)=>Zo(t,"name",{value:e,configurable:!0}),"e");const L=Yo((t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},"debug");var Qo=Object.defineProperty,te=le((t,e)=>Qo(t,"name",{value:e,configurable:!0}),"h$1");const Xo=/-([a-z])/g,er=/^\d+$/,Be=te(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),tr=te(t=>t.codePointAt(0)===95,"isSpecialKey"),gt=te((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),vt=te(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),bt=te((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"),nr=te((t,e,n,i,r)=>{let o=e.get(t)??n.get(t);if(!o&&i){const l=t.toLowerCase();o=i.get(l)??r?.get(l)}return o},"getDefinition"),ir=te((t,e,n,i)=>{const r=n.debug??!1;L(r,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),L(r,"Starting argument resolution","resolver"),L(r,"Tokens:","resolver",t),L(r,"Definitions:","resolver",e),L(r,"Processing tokens...","resolver");const o=new Map,l=new Map,s=n.caseInsensitive?new Map:void 0,p=n.caseInsensitive?new Map:void 0,a=n.camelCase?new Map:void 0,c=n.camelCase?new Map:void 0;for(const h of e)if(o.set(h.name,h),h.alias&&l.set(h.alias,h),n.caseInsensitive&&s&&(s.set(h.name.toLowerCase(),h),h.alias&&p&&p.set(h.alias.toLowerCase(),h)),n.camelCase&&a&&c){const m=h.name.replaceAll(Xo,(b,$)=>$.toUpperCase());a.set(h.name,m),c.set(m,h.name)}const d={},f={},g=[],u=new Set;let v=!1;const w=e.find(h=>h.defaultOption),y=e.some(h=>h.group),O=e.some(h=>h.type===Number);for(let h=0;h<t.length;h++){const m=t[h];if(m.kind==="option-terminator"){d._unknown=i.slice(m.index),v=!0;break}if(m.kind==="option"&&m.name){let b=nr(m.name,o,l,s,p);if(!b&&m.value===void 0&&O&&er.test(m.name)){const C=e.find(R=>R.type===Number);C&&(b=C,m.value=m.name,m.name=C.name)}const $=b?b.name:m.name,P=b?.multiple,j=b?.lazyMultiple;if(f[$]!==void 0&&!P&&!j&&!n.partial)throw new _o($);if(!b&&n.partial){const C=m.rawName??`--${m.name}${m.value!==void 0&&m.inlineValue?`=${m.value}`:""}`;g.push({index:m.index,value:C});continue}if(!b&&n.stopAtFirstUnknown){d._unknown=i.slice(m.index);break}if(!b&&!n.partial)throw new ft(m.name);if(m.value===void 0){const C=t[h+1],R=C?.kind==="option"&&!("name"in C)&&C.value!==void 0,V=C&&b&&!(b.type&&Be(b.type))&&(C.kind==="positional"||R),Dn=b&&b.defaultOption&&!b.multiple&&!b.lazyMultiple;if(V&&(!b?.defaultOption||Dn))if(P){let z=h+1;const Ve=[];for(;z<t.length&&(t[z].kind==="positional"||t[z].kind==="option"&&!("name"in t[z])&&t[z].value!==void 0);)Ve.push(t[z].value),u.add(t[z].index),z++;f[$]=f[$]===void 0?Ve:gt(f[$],Ve),h=z-1}else j?(bt(f,$,C.value,!0),u.add(C.index),h++):(f[$]=C.value,u.add(C.index),h++);else b?.type&&Be(b.type)?bt(f,$,!0,P):f[$]=P?[]:null}else{let{value:C}=m;if(b?.type&&Be(b.type))switch(C){case"":{if(n.partial)f._unknown??=[],f._unknown.push(`${m.rawName??`--${m.name}`}${m.value?`=${m.value}`:""}`),C=!0;else throw new ft(m.name);break}case"false":{C=!1;break}case"true":{C=!0;break}default:C=!0}const R=[C];if(P){let V=h+1;for(;V<t.length&&t[V].kind==="positional";)R.push(t[V].value),u.add(t[V].index),V++;h=V-1}f[$]===void 0?f[$]=P||j?R:C:P||j?f[$]=gt(f[$],R):f[$]=C}}else if(m.kind==="positional"&&n.stopAtFirstUnknown&&!u.has(m.index)&&!w){L(r,`Found unconsumed positional token at index ${String(m.index)}, stopping processing`,"resolver"),d._unknown=i.slice(m.index);break}}for(const[h,m]of Object.entries(f)){const b=o.get(h);b&&(b.multiple||b.lazyMultiple)&&!Array.isArray(m)&&(f[h]=[m])}let A=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!v){for(const h of t)if(h.kind==="option"&&!o.has(h.name??"")&&!l.has(h.name??"")&&(!n.caseInsensitive||!s?.has(h.name?.toLowerCase()??"")&&!p?.has(h.name?.toLowerCase()??""))){A=h.index;break}}if(w){const h=[],m=[];for(const b of t)b.kind==="positional"&&!u.has(b.index)&&b.index<A&&(h.push(b.value),m.push(b));if(h.length>0){const b=f[w.name],$=w.multiple??w.lazyMultiple;b===void 0?$?(m.forEach(P=>u.add(P.index)),f[w.name]=h):(u.add(m[0].index),f[w.name]=h[0]):$&&(m.forEach(P=>u.add(P.index)),f[w.name]=Array.isArray(b)?[...h,...b]:[...h,b])}}if(!n.partial){for(const h of t)if(h.kind==="positional"&&!u.has(h.index))throw new Do(i[h.index])}if(n.partial&&!n.stopAtFirstUnknown){const h=[...g];if(f._unknown){const m=new Map;for(const[b,$]of i.entries())m.set($,b);for(const b of f._unknown){const $=m.get(b);$!==void 0&&h.push({index:$,value:b})}}for(const m of t)m.kind==="positional"&&!u.has(m.index)&&h.push({index:m.index,value:i[m.index]});h.length>0&&(h.sort((m,b)=>m.index-b.index),d._unknown=h.map(m=>m.value))}if(n.stopAtFirstUnknown&&!v){const h=t.findIndex($=>$.kind==="option"&&!o.has($.name??"")&&!l.has($.name??"")&&(!n.caseInsensitive||!s?.has($.name?.toLowerCase()??"")&&!p?.has($.name?.toLowerCase()??""))),m=t.findIndex($=>$.kind==="positional"&&!u.has($.index));let b=-1;if(h!==-1&&m!==-1?b=Math.min(h,m):h!==-1?b=h:m!==-1&&(b=m),b>=0){const $=t[b].index;d._unknown=i.slice($)}}else g.length>0&&!n.partial&&(d._unknown=g.map(h=>h.value));for(const[h,m]of Object.entries(f)){const b=n.camelCase?a?.get(h)??h:h,$=o.get(h);d[b]=$?.type?Jo(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 d)&&h.defaultValue!==void 0&&(h.multiple??h.lazyMultiple?d[m]=Array.isArray(h.defaultValue)?[...h.defaultValue]:[h.defaultValue]:d[m]=h.defaultValue)}if(y){const h={},m={},b={};for(const P of e)if(P.group){const j=Array.isArray(P.group)?P.group:[P.group];for(const C of j)vt(C)||(h[C]??={})}for(const P of Object.keys(d))if(!tr(P)){m[P]=d[P];let j=P;n.camelCase&&(j=c?.get(P)??P);const C=o.get(j);if(C?.group){const R=Array.isArray(C.group)?C.group:[C.group];for(const V of R)vt(V)||h[V]&&(h[V][P]=d[P])}else b[P]=d[P]}const $={_all:m};for(const[P,j]of Object.entries(h))$[P]=j;Object.keys(b).length>0&&($._none=b),d._unknown&&($._unknown=d._unknown),Object.keys(d).forEach(P=>delete d[P]),Object.assign(d,$)}return L(r,"Final parsed result:","resolver",d),d},"resolveArgs");var or=Object.defineProperty,ne=le((t,e)=>or(t,"name",{value:e,configurable:!0}),"l");const Q="-".codePointAt(0),Y="=",rr=Y.codePointAt(0),ar="--",sr="-",lr="--",pn=ne(t=>t.length>2&&t.startsWith(lr),"hasLongOptionPrefix"),cr=ne(t=>pn(t)&&!t.includes(Y,3),"isLongOption"),ur=ne(t=>pn(t)&&t.includes(Y,3),"isLongOptionAndValue"),pr=ne(t=>t!==void 0&&t.length>0&&t.codePointAt(0)!==Q,"hasOptionValue"),fr=ne(t=>{if(t.length!==2||t.codePointAt(0)!==Q||t.codePointAt(1)===Q)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),dr=ne(t=>!(t.length<=2||t.codePointAt(0)!==Q||t.codePointAt(1)===Q),"isShortOptionGroup"),hr=ne(t=>{const e=[],n=[...t];let i=-1,r=0;for(;n.length>0;){const o=n.shift();if(o===void 0)break;const l=n[0];if(r>0?r--:i++,o===ar){e.push({index:i,kind:"option-terminator"});const s=n.map((p,a)=>({index:i+a+1,kind:"positional",value:p}));e.push(...s),i+=n.length;break}if(fr(o)){const s=o.charAt(1);let p;r?(e.push({index:i,kind:"option",name:s,rawName:o,value:p}),r===1&&pr(l)&&(p=n.shift(),e.push({index:i,kind:"option",value:p}))):e.push({index:i,kind:"option",name:s,rawName:o,value:p}),p!==void 0&&++i;continue}if(dr(o)&&!o.includes(Y)){const s=[];let p="",a=!1;for(let c=1;c<o.length;c++){const d=o.charAt(c);a?p+=d:d.codePointAt(0)===rr?a=!0:s.push(`${sr}${d}`)}if(a)if(s.length>0){const c=s.pop();s.push(`${c}=${p}`)}else s.push(p);n.unshift(...s),r=s.length;continue}if(cr(o)){const s=o.slice(2);e.push({index:i,kind:"option",name:s,rawName:o});continue}if(ur(o)){const s=o.indexOf(Y),p=o.slice(2,s),a=o.slice(s+1);e.push({index:i,inlineValue:!0,kind:"option",name:p,rawName:o,value:a});continue}if(o.length>2&&o.codePointAt(0)===Q&&o.codePointAt(1)!==Q&&o.includes(Y)){const s=o.indexOf(Y),p=o.charAt(1),a=o.slice(s+1);e.push({index:i,inlineValue:!0,kind:"option",name:p,rawName:o,value:a});continue}e.push({index:i,kind:"positional",value:o})}return e},"parseArgsTokens");var mr=Object.defineProperty,Je=le((t,e)=>mr(t,"name",{value:e,configurable:!0}),"d");const gr=/\d/,vr=Je(t=>t!=null&&(t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean")),"isBooleanType"),br=Je(t=>typeof t=="function","isValidCustomTypeFunction"),yr=Je((t,e,n)=>{const i=n?.debug??!1;L(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const r=new Set,o=new Set,l=new Set,s=new Set;let p=0;for(const a of t){if(L(i,"Checking definition:","validation",a),!a.name)throw L(i,"Validation failed: name is required","validation"),new M("Invalid option definition: name is required");if(typeof a.name!="string")throw new M("Invalid option definition: name must be a string");if(a.name.trim()==="")throw new M("Invalid option definition: name cannot be empty");const c=e?a.name.toLowerCase():"";if(r.has(a.name)||e&&l.has(c))throw new M(`Invalid option definition: duplicate name '${a.name}'`);if(o.has(a.name)||e&&s.has(c))throw new M(`Invalid option definition: name '${a.name}' conflicts with an existing alias`);if(r.add(a.name),e&&l.add(c),a.alias!==void 0){if(typeof a.alias!="string")throw new M("Invalid option definition: alias must be a string");if(a.alias.length!==1)throw new M("Invalid option definition: alias must be a single character");if(gr.test(a.alias))throw new M("Invalid option definition: alias cannot be numeric");if(a.alias==="-")throw new M('Invalid option definition: alias cannot be "-"');const d=e?a.alias.toLowerCase():"";if(o.has(a.alias)||e&&s.has(d))throw new M(`Invalid option definition: duplicate alias '${a.alias}'`);if(r.has(a.alias)||e&&l.has(d))throw new M(`Invalid option definition: alias '${a.alias}' conflicts with an existing option name`);o.add(a.alias),e&&s.add(d)}if(a.defaultOption&&(p++,a.type!==void 0&&vr(a.type)))throw new M("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"&&br(a.type)))throw new M("Invalid option definition: invalid type")}if(p>1)throw L(i,"Validation failed: multiple defaultOptions not allowed","validation"),new M("Invalid option definition: multiple defaultOptions not allowed");L(i,"Validation completed successfully","validation")},"validateDefinitions");var wr=Object.defineProperty,$r=le((t,e)=>wr(t,"name",{value:e,configurable:!0}),"O");const Or=$r((t,e={})=>{const n=e.debug??!1;L(n,"Starting command-line-args parsing","index"),L(n,"Options:","index",e);const i={...e};i.stopAtFirstUnknown&&(i.partial=!0);const r=Array.isArray(t)?t:[t];L(n,"Normalized definitions:","index",r),yr(r,i.caseInsensitive,n?i:void 0);let{argv:o}=i;if(!o&&(o=process.argv.slice(2),process.execArgv.length>0)){const a=new Set(process.execArgv);o=o.filter(c=>!a.has(c))}L(n,"Using argv:","index",o);let l=o;i.caseInsensitive&&(l=o.map(a=>{if(a.startsWith("--")){const c=a.indexOf("="),d=(c===-1?a.slice(2):a.slice(2,c)).toLowerCase();return c===-1?`--${d}`:`--${d}${a.slice(c)}`}if(a.startsWith("-")&&!a.startsWith("--")&&a.length>1){const c=a.slice(1).split("=",2),d=c[0],f=c[1];if(!d)return a;const g=d.toLowerCase();return f===void 0?`-${g}`:`-${g}=${f}`}return a}));const s=hr(l.map(String));L(n,"Tokenized arguments:","index",s);const p=ir(s,r,i,o);return L(n,"Command-line-args parsing completed","index"),p},"commandLineArgs");var xr=Object.defineProperty,Pr=x((t,e)=>xr(t,"name",{value:e,configurable:!0}),"b$2");let Ar=class{static{N(this,"Yi")}static{S(this,"Ki")}static{x(this,"m")}static{Pr(this,"EmptyToolbox")}result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(t,e){this.commandName=t,this.command=e}};var Er=Object.defineProperty,Cr=x((t,e)=>Er(t,"name",{value:e,configurable:!0}),"n$6");let De=class extends E{static{N(this,"Oe")}static{S(this,"be")}static{x(this,"i")}static{Cr(this,"CommandLoaderError")}commandName;constructor(e,n,i){super(`Failed to load command "${e}": ${n}`,"COMMAND_LOADER_ERROR",{commandName:e,reason:n}),this.name="CommandLoaderError",this.commandName=e,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",i!==void 0&&(this.cause=i)}};var Nr=Object.defineProperty,kr=x((t,e)=>Nr(t,"name",{value:e,configurable:!0}),"f$5");const jr=/^-{1,2}(\w+)(=(.+))?$/,fn=kr((t,e,n,i)=>{const r=jr.exec(t);if(r===null)return{};const o=r[1];if(!o)return{};const l=n&&i?n.get(o)??i.get(o):e.find(s=>s.name===o||s.alias===o);return l!==void 0?{argName:l.name,argValue:r[3],option:l}:{}},"getParameterOption");var _r=Object.defineProperty,He=x((t,e)=>_r(t,"name",{value:e,configurable:!0}),"e$3");const yt=He((t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},"convertType"),Lr=new Set(["0","1","false","true"]),Sr=He((t,e,n,i)=>{if(e.length===0||t.length===0)return{};const r=He((o,l)=>{const{argName:s,argValue:p,option:a}=fn(l,e,n,i),{lastOption:c}=o;return a&&ve(a)&&p&&s?o.partial[s]=yt(p,a):o.lastName&&c&&ve(c)&&Lr.has(l)&&(o.partial[o.lastName]=yt(l,c)),{lastName:s,lastOption:a,partial:o.partial}},"getBooleanValue");return t.reduce(r,{partial:{}}).partial},"getBooleanValues");var Tr=Object.defineProperty,wt=x((t,e)=>Tr(t,"name",{value:e,configurable:!0}),"s$8");const Ir=new Set(["0","1","false","true"]),Mr=wt((t,e,n,i)=>{if(e.length===0||t.length===0)return t;const r=wt((o,l)=>{const{argValue:s,option:p}=fn(l,e,n,i),{lastOption:a}=o;if(a&&ve(a)&&Ir.has(l)){const{args:c}=o;return{args:c.slice(0,-1)}}return p&&ve(p)&&s?{args:o.args}:{args:[...o.args,l],lastOption:p}},"removeBooleanArguments");return t.reduce(r,{args:[]}).args},"removeBooleanValues");var Vr=Object.defineProperty,Ur=x((t,e)=>Vr(t,"name",{value:e,configurable:!0}),"o$8");const Br=Ur(t=>{const e=new Map;for(const n of t){const i=e.get(n.name);i?e.set(n.name,{...i,...n}):e.set(n.name,n)}return[...e.values()]},"mergeArguments");var Dr=Object.defineProperty,ke=x((t,e)=>Dr(t,"name",{value:e,configurable:!0}),"o$7");const Rr=ke(t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},"transformBooleanEnv"),zr=ke((t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return Rr(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},"transformEnvValue"),Fr=/_./g,Wr=/^[A-Z]/,qr=ke(t=>t.toLowerCase().replaceAll(Fr,e=>e[1]?.toUpperCase()??e).replace(Wr,e=>e.toLowerCase()),"toCamelCase"),Gr=ke(t=>{if(!t||t.length===0)return{};const e={},n=H();for(const i of t){const r=n[i.name],o=zr(i,r),l=o===void 0?i.defaultValue:o,s=qr(i.name);e[s]=l}return e},"processEnvVariables");var Hr=Object.defineProperty,be=x((t,e)=>Hr(t,"name",{value:e,configurable:!0}),"a$5");const Kr=be(t=>{const e=new Map,n=new Map;for(const i of t)if(e.set(i.name,i),i.alias){const r=Array.isArray(i.alias)?i.alias:[i.alias];for(const o of r)n.set(o,i)}return{optionMapByAlias:n,optionMapByName:e}},"buildOptionMaps"),dn=be(async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new De(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new De(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new De(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},"loadLazyHandler"),Jr=be((t,e,n,i)=>{const r=new Ar(t.name,t),{_all:o,_unknown:l,positionals:s}=e,p=Object.keys(n).length>0?{...o,...n}:o;Oe in p&&delete p[Oe],r.argument=s?.[Oe]??[],r.rawUnknown=[...l??[]];const a=Object.keys(i).length>0;return r.options=a?{...p,...i}:p,r.env=Gr(t.env),r},"prepareToolbox"),Zr=be((t,e,n)=>{const i=t.options??[],r=i.length>0;let o=Br(r?[...i,...n]:n);if(o.length>0){for(const a of o)if(a.multiple&&a.lazyMultiple)throw new Error(`Argument "${a.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(o=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:Oe,type:t.argument.type,typeLabel:t.argument.typeLabel},...o]);let l,s;if(r){const{optionMapByAlias:a,optionMapByName:c}=Kr(i);l=Mr(e,i,c,a),s=Sr(e,i,c,a)}else l=e,s={};const p=Or(o,{argv:l,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:o,booleanValues:s,parsedArgs:p}},"processCommandArgs"),oe=be(async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await dn(t))(e),"executeCommand");var Yr=Object.defineProperty,Qr=x((t,e)=>Yr(t,"name",{value:e,configurable:!0}),"n$5");let Xr=class extends E{static{N(this,"No")}static{S(this,"$a")}static{x(this,"s")}static{Qr(this,"CommandValidationError")}commandName;missingOptions;constructor(t,e){super(`Command "${t}" is missing required options: ${e.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:t,missingOptions:e}),this.name="CommandValidationError",this.commandName=t,this.missingOptions=e,this.hint=`Provide the following required options: ${e.join(", ")}`}};var ea=Object.defineProperty,ta=x((t,e)=>ea(t,"name",{value:e,configurable:!0}),"t$5");const $t=ta((t,e,n=!1)=>{const i=[];for(const r of t)if(!(!n&&!r.required)&&e[r.name]===void 0){if(r.type?.name==="Boolean"){e[r.name]=!1;continue}i.push(r)}return i},"listMissingArguments");var na=Object.defineProperty,hn=x((t,e)=>na(t,"name",{value:e,configurable:!0}),"n$4");const ia=hn((t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Dt(t,e)<=t.length/3,"isSimilar"),Z=hn((t,e)=>{const n=t.toLowerCase();return e.filter(i=>ia(i.toLowerCase(),n))},"findAlternatives");var oa=Object.defineProperty,je=x((t,e)=>oa(t,"name",{value:e,configurable:!0}),"a$4");const ra=je((t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const r=i.startsWith("--");let o=`Found unknown ${r?"option":"argument"} "${i}"`;if(r){const l=Z(i.replace("--",""),(e.options??[]).map(s=>s.name));if(l.length>0){const[s,...p]=l.map(a=>`--${a}`);o+=p.length>0?`, did you mean ${s??""} or ${p.join(", ")}?`:`, did you mean ${s??""}?`}}n.push(o)}),n.length>0)throw new Error(n.join(`
|
|
4
|
-
`))},"validateUnknownOptions"),aa=je((t,e,n)=>{const i=n.__requiredOptions__,r=i?$t(i,e,!0):$t(t,e,!1);if(r.length>0)throw new Xr(n.name,r.map(o=>o.name));e._unknown&&e._unknown.length>0&&!n.argument&&ra(e,n)},"validateRequiredOptions"),sa=je((t,e,n)=>{const i=n.__conflictingOptions__??t.filter(r=>r.conflicts!==void 0);if(i.length>0){const r=i.find(o=>Array.isArray(o.conflicts)?o.conflicts.some(l=>e[l]!==void 0)&&e[o.name]!==void 0:e[o.conflicts]!==void 0&&e[o.name]!==void 0);if(r)throw new Wt(r.name,typeof r.conflicts=="string"?r.conflicts:r.conflicts?.[0]??"unknown")}},"validateConflictingOptions"),la=je(t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const r of t.options){if(r.name){const o=e.get(r.name)??[];o.push(r),e.set(r.name,o)}if(typeof r.alias=="string"&&r.alias.length>0){const o=n.get(r.alias)??[];o.push(r),n.set(r.alias,o)}else if(Array.isArray(r.alias)){for(const o of r.alias)if(o.length>0){const l=n.get(o)??[];l.push(r),n.set(o,l)}}}const i=[];for(const[r,o]of e)o.length>1&&i.push(`Duplicate option name "${r}" in command "${t.name}": ${JSON.stringify(o)}`);for(const[r,o]of n)o.length>1&&i.push(`Duplicate option alias "-${r}" used by options ${o.map(l=>`"${l.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
|
|
5
|
-
`))},"validateDuplicateOptions");var ca=Object.defineProperty,Ze=x((t,e)=>ca(t,"name",{value:e,configurable:!0}),"s$4");const ua=Ze((t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let i;for(let r=1;r<=e.length;r+=1){const o=e[r-1];if(o===void 0||o.startsWith("-"))break;n.push(o);const l=n.join(" ");t.has(l)&&(i={commandPath:[...n],depth:r})}return i?{argv:e.slice(i.depth),commandPath:i.commandPath}:{argv:e,commandPath:void 0}},"parseNestedCommand"),J=Ze(t=>t.join(" "),"getCommandPathKey"),Ot=Ze((t,e)=>e&&e.length>0?[...e,t]:[t],"getFullCommandPath");var pa=Object.defineProperty,mn=x((t,e)=>pa(t,"name",{value:e,configurable:!0}),"i$5"),fa=Object.defineProperty,gn=mn((t,e)=>fa(t,"name",{value:e,configurable:!0}),"r"),da=Object.defineProperty,ha=gn((t,e)=>da(t,"name",{value:e,configurable:!0}),"c");let vn=class{static{N(this,"xt")}static{S(this,"xt")}static{x(this,"l")}static{mn(this,"y")}static{gn(this,"s")}static{ha(this,"LRUCache")}capacity;cache;keyOrder;constructor(t){this.capacity=t,this.cache=new Map,this.keyOrder=[]}get(t){if(this.cache.has(t))return this.keyOrder=this.keyOrder.filter(e=>e!==t),this.keyOrder.push(t),this.cache.get(t)}has(t){return this.cache.has(t)}set(t,e){if(this.cache.has(t))this.keyOrder=this.keyOrder.filter(n=>n!==t);else if(this.cache.size>=this.capacity){const n=this.keyOrder.shift();n!==void 0&&this.cache.delete(n)}this.cache.set(t,e),this.keyOrder.push(t)}delete(t){this.cache.delete(t),this.keyOrder=this.keyOrder.filter(e=>e!==t)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var ma=Object.defineProperty,ga=x((t,e)=>ma(t,"name",{value:e,configurable:!0}),"r$5"),va=Object.defineProperty,ba=ga((t,e)=>va(t,"name",{value:e,configurable:!0}),"a"),ya=Object.defineProperty,wa=ba((t,e)=>ya(t,"name",{value:e,configurable:!0}),"s");const $a=wa((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleLowerCase(e.locale):t[0].toLowerCase())+t.slice(1),"lowerFirst");var Oa=Object.defineProperty,xa=x((t,e)=>Oa(t,"name",{value:e,configurable:!0}),"I"),Pa=Object.defineProperty,_e=xa((t,e)=>Pa(t,"name",{value:e,configurable:!0}),"W");const Aa=to(import.meta.url),de=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ea=_e(t=>{if(typeof de<"u"&&de.versions&&de.versions.node){const[e,n]=de.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return de.getBuiltinModule(t)}return Aa(t)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Ca}=Ea("node:util");var Na=Object.defineProperty,ka=_e((t,e)=>Na(t,"name",{value:e,configurable:!0}),"g");const Re=new vn(1e3),ja=/[.*+?^${}()|[\]\\]/g,_a=ka(t=>{const e=t.join("");if(Re.has(e))return Re.get(e);const n=t.map(r=>r.replaceAll(ja,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return Re.set(e,i),i},"getSeparatorsRegex");var La=Object.defineProperty,Sa=_e((t,e)=>La(t,"name",{value:e,configurable:!0}),"t");const Ta=Sa(t=>{const e=[];let n=0,i;for(se.lastIndex=0;(i=se.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=se.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},"splitByEmoji");var Ia=Object.defineProperty,k=_e((t,e)=>Ia(t,"name",{value:e,configurable:!0}),"u");const Ma=/[ČŠŽĐ]/i,bn=new Uint8Array(128),yn=new Uint8Array(128),wn=new Uint8Array(128);for(let t=0;t<128;t++)bn[t]=t>=65&&t<=90?1:0,yn[t]=t>=97&&t<=122?1:0,wn[t]=t>=48&&t<=57?1:0;const ze=k(t=>bn[t],"isUpper"),xt=k(t=>yn[t],"isLower"),Fe=k(t=>wn[t],"isDigit"),G=k((t,e,n,i,r)=>{if(t.length===0)return[];let o=!1;const l=Object.values(e);for(const g of l)if(g(t[0])){o=!0;break}if(!o&&!n)return[t];const s=[...t],p=[];let a=s[0],c="other";const d=Object.entries(e);for(const g of d){const[u,v]=g;if(v(s[0])){c=u;break}}let f=n&&i?s[0]===s[0].toLocaleUpperCase(i):!1;for(let g=1;g<s.length;g++){const u=s[g];let v="other";for(const O of d){const[A,h]=O;if(h(u)){v=A;break}}const w=n&&i?u===u.toLocaleUpperCase(i):!1;let y=!1;r?y=r(c,v,f,w,u,g,s):(c!==v&&c!=="other"&&v!=="other"&&(y=!0),n&&v!=="other"&&!f&&w&&(y=!0)),y?(p.push(a),a=u):a+=u,c=v,n&&(f=w)}return a&&a.length>0&&p.push(a),p.length>0?p:[t]},"handleScriptTransitions"),Va=k((t,e,n,i)=>{if(n.size===0)return e;for(const r of n)if(t.startsWith(r,e))return i.push(r),e+r.length;return e},"detectAndProcessAcronym"),$n=k((t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const i=[],r=t.length;for(let o=1;o<r;o++){const l=Va(t,n,e,i);if(l!==n){n=l,o=n-1;continue}const s=t.codePointAt(o-1),p=t.codePointAt(o),a=s&&s<128&&ze(s),c=p&&p<128&&ze(p),d=s&&s<128&&xt(s),f=s&&s<128&&Fe(s),g=p&&p<128&&Fe(p);if(d&&c){i.push(t.slice(n,o)),n=o;continue}if(f&&!g||!f&&g){i.push(t.slice(n,o)),n=o;continue}if(g&&!f){let u=!1,v=!1;if(o+1<r){const w=t.codePointAt(o+1);u=w&&w<128&&ze(w),v=w&&w<128&&Fe(w)}if(!v&&u){i.push(t.slice(n,o),t.slice(o,o+1)),n=o+1;continue}}if(o+1<r){const u=t.codePointAt(o+1),v=u&&u<128&&xt(u);if(a&&c&&v){const w=t.slice(n,o+1);e.has(w)||(i.push(t.slice(n,o)),n=o)}}}return n<r&&i.push(t.slice(n)),i.filter(o=>o!=="")},"splitCamelCaseFast"),On=k((t,e,n)=>{if(t.length===0)return[];const i=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!i&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const a=[...t],c=a.length,d=[];let f=a[0],g=a[0]===a[0].toLocaleUpperCase(e),u=g,v=g?0:-1;for(let w=1;w<c;w++){const y=a[w],O=y===y.toLocaleUpperCase(e);if(O===g)f+=y;else if(O)f&&f.length>0&&(d.push(f),f=y),u=!0,v=w;else{if(u&&w-v>1){const A=a[w-1],h=f.slice(0,-1);h&&h.length>0&&d.push(h),f=A+y}else f+=y;u=!1,v=-1}g=O}return f&&f.length>0&&d.push(f),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!ie.test(t)&&!I.test(t))return[t];const a=[...t],c=a.length,d=[];let f=a[0];const g=a[0];let u;ie.test(g)?u=1:I.test(g)?u=2:u=0;let v=g===g.toLocaleUpperCase(e);for(let y=1;y<c;y++){const O=a[y];let A;ie.test(O)?A=1:I.test(O)?A=2:A=0;const h=O===O.toLocaleUpperCase(e);u!==A&&(u===1||u===2)&&(A===1||A===2)||A===u&&!v&&h?(d.push(f),f=O):f+=O,u=A,v=h}f&&f.length>0&&d.push(f);const w=[];for(let y=0;y<d.length;y++)y<d.length-1&&d[y].length===1&&I.test(d[y])&&ie.test(d[y+1][0])?(w.push(d[y]+d[y+1]),y+=1):w.push(d[y]);return w}if(e.startsWith("el")){if(!Ue.test(t)&&!I.test(t))return[t];const a=[];ot.lastIndex=0;let c;for(;(c=ot.exec(t))!==null;)a.push(c[0]);a.length===0&&a.push(t);const d=[];if(a.length===1){const f=a[0];if(!f||!Ue.test(f[0])||f.length===1)return[f??t]}for(const f of a){if(!f)continue;if(!Ue.test(f[0])||f.length===1){d.push(f);continue}const g=f.length;let u=f[0],v=f[0]===f[0].toLocaleUpperCase(e);for(let w=1;w<g;w++){const y=f[w],O=y===y.toLocaleUpperCase(e);!v&&O?(d.push(u),u=y):u+=y,v=O}u&&d.push(u)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const a=e.startsWith("ja"),c=a?{hiragana:k(f=>Li.test(f),"hiragana"),kanji:k(f=>st.test(f),"kanji"),katakana:k(f=>Ti.test(f),"katakana"),latin:k(f=>I.test(f),"latin")}:{hangul:k(f=>rt.test(f),"hangul"),latin:k(f=>I.test(f),"latin")},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(a){const f=G(t,c,!1,e,(u,v)=>u==="hiragana"&&v==="katakana"||u==="katakana"&&v==="hiragana"||u==="hiragana"&&v==="latin"||u==="katakana"&&v==="latin"||u==="kanji"&&v==="latin"||u==="latin"&&(v==="hiragana"||v==="katakana"||v==="kanji")),g=[];for(const u of f){const v=u;v.length===1&&d.has(v)&&g.length>0?g[g.length-1]=g.at(-1)+v:g.push(v)}return g.length>0?g:[t]}return G(t,c,!1,e,(f,g)=>f==="hangul"&&g==="latin"||f==="latin"&&g==="hangul")}if(e.startsWith("sl")){const a=[...t],c=a.length,d=[];let f=a[0],g=a[0]===a[0].toLocaleUpperCase(e);for(let u=1;u<c;u++){const v=a[u],w=v===v.toLocaleUpperCase(e),y=Ma.test(v),O=u<c-1&&a[u+1]===a[u+1].toLocaleUpperCase(e);!g&&w||y&&O?(d.push(f),f=v,y&&O&&(d.push(f),f="")):f+=v,g=w}return f&&f.length>0&&d.push(f),d}if(e.startsWith("zh"))return G(t,{han:k(a=>st.test(a),"han"),latin:k(a=>I.test(a),"latin")},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const a=k(c=>at.test(c)||it.test(c),"isRtlChar");return G(t,{latin:k(c=>I.test(c),"latin"),rtl:k(c=>a(c),"rtl")},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const a=k(c=>Ni.test(c)||Ci.test(c)||ji.test(c)||_i.test(c)||Si.test(c)||Ri.test(c)||zi.test(c)||Vi.test(c)||Di.test(c)||Fi.test(c)||Mi.test(c)||Wi.test(c)||Ui.test(c)||ki.test(c)||Ii.test(c)||Bi.test(c),"isIndicChar");return G(t,{indic:k(c=>a(c),"indic"),latin:k(c=>I.test(c),"latin")},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return G(t,{cyrillic:k(a=>ie.test(a),"cyrillic"),latin:k(a=>I.test(a),"latin")},!0,e);if(["ar","fa","he"].includes(e))return G(t,{latin:k(a=>I.test(a),"latin"),rtl:k(a=>at.test(a)||it.test(a),"rtl")},!1,e);if(e.startsWith("ko"))return G(t,{hangul:k(a=>rt.test(a),"hangul"),latin:k(a=>I.test(a),"latin")},!1,e);if(e.startsWith("uz")){if(!ie.test(t)&&!I.test(t))return[t];const a=[...t],c=a.length,d=[];let f=a[0],g=a[0]===a[0].toLocaleUpperCase(e);for(let u=1;u<c;u++){const v=a[u],w=v===v.toLocaleUpperCase(e);if(lt.test(v)||lt.test(a[u-1])){f+=v;continue}!g&&w?(d.push(f),f=v):f+=v,g=w}return f&&f.length>0&&d.push(f),d}const r=[...t],o=r.length,l=[];let s=r[0],p=r[0]===r[0].toLocaleUpperCase(e);for(const a of n)if(t.startsWith(a)){l.push(a),s=r[a.length],p=s===s.toLocaleUpperCase(e);break}for(let a=1;a<o;a++){const c=r[a],d=c===c.toLocaleUpperCase(e);let f=0;for(const g of n)if(t.startsWith(g,a)){l.push(s,g),f=g.length,s="";const u=g.at(-1);u&&(p=u===u.toLocaleUpperCase(e));break}if(f>0){a+=f-1;continue}!p&&d?(l.push(s),s=c):s+=c,p=d}return s&&l.push(s),l},"splitCamelCaseLocale"),Ua=k((t,e,n)=>{const i=[],r=ge.test(t)?t.split(ge).filter(Boolean):[t];for(const o of r){const l=o;if(ge.test(l))i.push(l);else{const s=se.test(l)?Ta(l).filter(Boolean):[l];for(const p of s)if(se.test(p))i.push(p);else if(e){const a=e.toLowerCase().split("-")[0];i.push(...On(p,a,n))}else i.push(...$n(p,n))}}return i},"processTextWithAnsiEmoji"),Ba=k((t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:r=[],locale:o,normalize:l=!1,separators:s,stripAnsi:p=!1,stripEmoji:a=!1}=e,c=new Set([...r].toSorted((y,O)=>O.length-y.length));let d=t;p&&(d=Ca(d)),a&&(d=qi(d));let f;Array.isArray(s)?f=_a(s):s instanceof RegExp?f=s:f=Ei;const g=[];let u=d;const v=f.flags.includes("g")?f:new RegExp(f.source,`${f.flags}g`);for(;u.length>0;){const y=v.exec(u);if(!y){u===".."?g.push(".."):u==="."?g.push("."):u.length>0&&g.push(u);break}const O=y.index,A=y[0],h=A.length,m=u.slice(0,O),b=u.slice(O+h);if(A.startsWith("../"))g.push(".."),u=u.slice(O+3);else if(A.startsWith("./"))g.push("."),u=u.slice(O+2);else if(O===0&&A==="..")g.push(".."),u=u.slice(2);else if(O===0&&A===".")g.push("."),u=u.slice(1);else{m.length>0&&g.push(m);let $=0;for(;($=A.indexOf("../",$))!==-1;)g.push(".."),$+=3;for($=0;($=A.indexOf("./",$))!==-1;)($===0||A[$-1]!==".")&&g.push("."),$+=2;let P=b;for(;P.startsWith("../");)g.push(".."),P=P.slice(3);for(;P.startsWith("./");)g.push("."),P=P.slice(2);if(P===".."){g.push("..");break}else if(P==="."){g.push(".");break}else u=P}v.lastIndex=0}if(g.length===0){const y=d.split(f).filter(Boolean);g.push(...y)}let w=[];for(const y of g)n||i?w.push(...Ua(y,o,c)):o?w.push(...On(y,o,c)):w.push(...$n(y,c));return l&&(w=w.map(y=>c.has(y)?y:o&&y===y.toLocaleUpperCase(o)?y[0]+y.slice(1).toLocaleLowerCase(o):y.toUpperCase()===y&&!c.has(y)?y.slice(0,1)+y.slice(1).toLowerCase():y)),w},"splitByCase");var Da=Object.defineProperty,Ra=x((t,e)=>Da(t,"name",{value:e,configurable:!0}),"r$4"),za=Object.defineProperty,Fa=Ra((t,e)=>za(t,"name",{value:e,configurable:!0}),"o"),Wa=Object.defineProperty,qa=Fa((t,e)=>Wa(t,"name",{value:e,configurable:!0}),"s");const Ga=qa((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),"upperFirst");var Ha=Object.defineProperty,Ka=x((t,e)=>Ha(t,"name",{value:e,configurable:!0}),"r$3"),Ja=Object.defineProperty,Za=Ka((t,e)=>Ja(t,"name",{value:e,configurable:!0}),"r"),Ya=Object.defineProperty,Qa=Za((t,e)=>Ya(t,"name",{value:e,configurable:!0}),"n");const Xa=Qa((t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}`,"generateCacheKey");var es=Object.defineProperty,ts=x((t,e)=>es(t,"name",{value:e,configurable:!0}),"i$3"),ns=Object.defineProperty,is=ts((t,e)=>ns(t,"name",{value:e,configurable:!0}),"f"),os=Object.defineProperty,rs=is((t,e)=>os(t,"name",{value:e,configurable:!0}),"l");const as=rs((t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let r="",o="";for(let l=0;l<n;l++){const s=t[l];if(ge.test(s)){r?(i.push(r+o+s),r="",o=""):(i.length>0&&i.push(e),r=s);continue}r?(o&&(o+=e),o+=s):(i.length>0&&i.push(e),i.push(s))}return i.join("")},"joinSegments");var ss=Object.defineProperty,ls=x((t,e)=>ss(t,"name",{value:e,configurable:!0}),"r$2"),cs=Object.defineProperty,us=ls((t,e)=>cs(t,"name",{value:e,configurable:!0}),"a"),ps=Object.defineProperty,fs=us((t,e)=>ps(t,"name",{value:e,configurable:!0}),"e");const ds=/(?<![a-zß])SS(?![a-z])/g,hs=fs(t=>t.replaceAll(ds,"ß"),"normalizeGermanEszett");var ms=Object.defineProperty,gs=x((t,e)=>ms(t,"name",{value:e,configurable:!0}),"c$2"),vs=Object.defineProperty,bs=gs((t,e)=>vs(t,"name",{value:e,configurable:!0}),"c"),ys=Object.defineProperty,ws=bs((t,e)=>ys(t,"name",{value:e,configurable:!0}),"o");const $s=new vn(1e3),xn=ws((t,e)=>{if(typeof t!="string"||!t)return"";const n=e?.cache??!1,i=e?.cacheStore??$s;let r;if(n&&(r=Xa(t,e)),n&&r&&i.has(r))return i.get(r);let o=!0;const l=as(Ba(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(s=>{if(e?.handleAnsi&&ge.test(s))return s;const p=e?.locale?.startsWith("de")?hs(s):s,a=e?.locale?p.toLocaleLowerCase(e.locale):p.toLowerCase();return o?(o=!1,$a(a,e)):Ga(a,e)}),"");return n&&r&&i.set(r,l),l},"camelCase");var Os=Object.defineProperty,Le=x((t,e)=>Os(t,"name",{value:e,configurable:!0}),"a$2");const xs=Le(t=>{t.options?.forEach(e=>{e.__camelCaseName__=xn(e.name)})},"processOptionNames"),Ps=Le(t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const i of t.options)e.add(i.name);const n=[];for(const i of t.options)if(i.name.startsWith("no-")){const r=i.name.replace("no-","");if(!e.has(r)){if(i.type!==Boolean)throw new Error(`Cannot add negated option "${i.name}" to command "${t.name}" because it is not a boolean.`);const o={...i,defaultValue:i.defaultValue===void 0?!0:!i.defaultValue,name:r};n.push(o),e.add(r)}}n.length>0&&t.options.push(...n)},"addNegatableOptions"),As=Le((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 l=xn(o.name);i.set(l,o)}const r=Object.keys(n).filter(o=>i.has(o));if(r.length!==0)for(const o of r){const l=o.charAt(2);if(!l)continue;const s=l.toLowerCase()+o.slice(3),p=i.get(o);p&&(p.__negated__=!0),n[s]=!n[o],Reflect.deleteProperty(n,o)}},"mapNegatableOptions"),Es=Le((t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const r of e.options)r.__camelCaseName__&&r.__negated__===void 0&&r.implies!==void 0&&n.set(r.__camelCaseName__,r);if(n.size===0)return;const{options:i}=t;for(const r of Object.keys(i)){const o=n.get(r);if(o?.implies){const{implies:l}=o;for(const[s,p]of Object.entries(l))i[s]===void 0&&(i[s]=p)}}},"mapImpliedOptions");var Cs=Object.defineProperty,Se=x((t,e)=>Cs(t,"name",{value:e,configurable:!0}),"e$2");const Ns=Se(()=>!!process.versions.electron,"isElectronApp"),ks=Se(()=>Ns()&&!process.defaultApp,"isBundledElectronApp"),js=Se(()=>ks()?0:1,"getProcessArgvBinIndex"),_s=Se(t=>t.slice(js()+1),"hideBin");var Ls=Object.defineProperty,Pn=x((t,e)=>Ls(t,"name",{value:e,configurable:!0}),"e$1");const Ss=" ",Ts=Pn((t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),"equals"),Is=Pn(t=>{if(typeof t=="string")return t.split(Ss);const e=xe();return Ts(t,e)?_s(t):t},"parseRawCommand");var Ms=Object.defineProperty,We=x((t,e)=>Ms(t,"name",{value:e,configurable:!0}),"r");const Vs=We(t=>{const e=We(o=>{t.error(`Uncaught exception: ${o.message||o}`),o.stack&&t.error(o.stack),W(1)},"uncaughtExceptionHandler"),n=We((o,l)=>{if(o instanceof Error)t.error(`Promise rejection: ${o.message||o}`),o.stack&&t.error(o.stack);else{let s;if(typeof o=="string")s=o;else try{s=JSON.stringify(o)}catch{s=String(o)}t.error(`Promise rejection: ${s}`)}W(1)},"unhandledRejectionHandler"),i=tt("uncaughtException",e),r=tt("unhandledRejection",n);return()=>{i(),r()}},"registerExceptionHandler");var Us=Object.defineProperty,ce=x((t,e)=>Us(t,"name",{value:e,configurable:!0}),"e");const Pe=100,An=/^[a-z][\w-]*$/i,Ae=ce((t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new E(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},"validateNonEmptyString"),Pt=ce((t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new E(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateStringArray");ce((t,e)=>{if(typeof t!="function")throw new E(`${e} must be a function`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateFunction");const qe=ce((t,e)=>{if(typeof t!="object"||t===null)throw new E(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateObject"),we=ce(t=>{const e=Ae(t,"Command name");if(e.length>Pe)throw new E(`Command name is too long (maximum ${String(Pe)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new E(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!An.test(e))throw new E(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},"validateCommandName");ce(t=>{const e=Ae(t,"Plugin name");if(e.length>Pe)throw new E(`Plugin name is too long (maximum ${String(Pe)} characters)`,"INVALID_PLUGIN_NAME",{length:e.length,pluginName:e});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new E(`Plugin name "${e}" contains invalid characters`,"INVALID_PLUGIN_NAME",{pluginName:e});if(!An.test(e))throw new E(`Plugin name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_PLUGIN_NAME",{pluginName:e});return e},"validatePluginName");var Bs=Object.defineProperty,Te=x((t,e)=>Bs(t,"name",{value:e,configurable:!0}),"s");const Ds=new Set([`
|
|
6
|
-
`,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),Rs=/^[A-Z]:/i,zs=Te(t=>{if(typeof t!="string")throw new TypeError("Argument must be a string");if(t.length>1e4)throw new Error(`Argument is too long (maximum ${String(1e4)} characters)`);for(const e of t)if(Ds.has(e))throw new Error(`Argument contains dangerous character: ${e}`);return t.trim()},"sanitizeArgument"),At=Te(t=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");if(t.length>100)throw new Error(`Too many arguments (maximum ${String(100)})`);return t.map(e=>zs(e))},"sanitizeArguments");Te(t=>{if(typeof t!="string")throw new TypeError("Path must be a string");const e=t.trim();if(e.includes("..")||e.includes("../")||e.includes("..\\"))throw new Error("Path contains directory traversal sequences");if(e.startsWith("/")||Rs.test(e))throw new Error("Absolute paths are not allowed");if(e.length>1e3)throw new Error("Path is too long");return e},"validateSafePath");class Rc{static{N(this,"$s")}static{S(this,"Ir")}static{x(this,"RateLimiter")}static{Te(this,"RateLimiter")}attempts=new Map;maxAttempts;windowMs;constructor(e=5,n=6e4){if(e<=0||n<=0)throw new Error("maxAttempts and windowMs must be positive numbers");this.maxAttempts=e,this.windowMs=n}checkLimit(e){const n=Date.now(),i=this.attempts.get(e);return!i||n>i.resetTime?(this.attempts.set(e,{count:1,resetTime:n+this.windowMs}),this.cleanup(n),!0):i.count>=this.maxAttempts?!1:(i.count+=1,!0)}reset(e){this.attempts.delete(e)}cleanup(e){for(const[n,i]of this.attempts.entries())e>i.resetTime&&this.attempts.delete(n)}}var Fs=Object.defineProperty,U=x((t,e)=>Fs(t,"name",{value:e,configurable:!0}),"b");const Ws=/^-([^\d-])$/,qs=/^--(\S+)/,Gs=/^-([^\d-]{2,})$/,Ge=U(t=>Ws.test(t)||qs.test(t)||Gs.test(t),"isOption"),Hs={access:U((t,e)=>eo(t,e),"access"),mkdir:U((t,e)=>Xi(t,e),"mkdir"),readdir:U(t=>Qi(t),"readdir"),readFile:U((async(t,e)=>e===void 0?ct(t):ct(t,e)),"readFile"),rm:U((t,e)=>Yi(t,e),"rm"),stat:U(t=>Zi(t),"stat"),writeFile:U((t,e,n)=>Ji(t,e,n),"writeFile")};let Ks=class En{static{N(this,"Ie")}static{S(this,"Dt")}static{x(this,"Cli")}static{U(this,"Cli")}#t;#e;#c;#u;#f;#d;#y;#w;#$;#O;#x;#p;#n;#i;#o;#r;#a;#h=!1;#P;#A=!1;#m;#g;#v;#l=[];#j(){return this.#m===void 0&&(this.#m=[...this.#i.keys()]),this.#m}#E(){return this.#g===void 0&&(this.#g=[...this.#n.keys()]),this.#g}#s(){return this.#v===void 0&&(this.#v=[...this.#j(),...this.#E()]),this.#v}#C(){return this.#l.length===0?ye:[...ye,...this.#l]}#N(){this.#m=void 0,this.#g=void 0,this.#v=void 0}#b(){if(this.#c===void 0){const e=Is(this.#e.argv);this.#c=At(e),this.#_()}return this.#c}#_(){if(!this.#c)return;const e=H();let n=!1;for(const i of this.#c){if(i==="--quiet"||i==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(qn),n=!0;break}if(i==="--verbose"||i==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(Gn),n=!0;break}if(i==="--debug"||i==="-vvv"){e.CEREBRO_OUTPUT_LEVEL=String(re),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(re):String(et))}#L(){this.#A||(this.#P=Vs(this.#t),this.#A=!0)}#S(){return{arch:ui(),argv:this.#b(),cwd:this.#u,env:this.#O??H(),exit:this.#$??(e=>W(e??0)),platform:ci(),stdin:this.#x}}#k(e,n,i,r){this.#t.debug(`command '${r}' found, parsing command args: ${n.join(", ")}`);const{arguments_:o,booleanValues:l,parsedArgs:s}=Zr(e,n,this.#C()),p=Object.keys(l).length>0;let a=s;p&&(a={...s,_all:{...s._all,...l}}),aa(o,a,e);const c=Jr(e,s,l,i);c.runtime=this,c.argv=this.#b(),c.fs=this.#w??Hs,c.process=this.#S(),c.console=this.#t;const d=e.options&&e.options.length>0;if(d&&e.options){const f=e.options.filter(g=>g.name.startsWith("no-"));for(const g of f){const u=g.name.replace("no-",""),v=`--${g.name}`,w=`--${u}`,y=n.includes(v),O=n.includes(w);if(y&&O)throw new Wt(u,g.name)}}return d&&(As(c,e),Es(c,e)),sa(o,c.options,e),H().CEREBRO_OUTPUT_LEVEL===String(re)&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(c.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(c.argument,null,2))),{arguments_:o,booleanValues:l,commandArgs:a,parsedArgs:s,toolbox:c}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new E("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#f=e.trim();const i=n.argv??xe(),r=n.cwd??li();if(this.#e={...n,argv:i,cwd:r},this.#e.argv&&!Array.isArray(this.#e.argv))throw new E("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 E("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new E("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new E("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const o=H();if(o.CEREBRO_OUTPUT_LEVEL=String(et),typeof this.#e.logger=="object"){const c=["debug","error","info","log","warn"],d=[],f=this.#e.logger;for(const g of c)typeof f[g]!="function"&&d.push(g);if(d.length>0)throw new E(`Logger object is missing required methods: ${d.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:d});this.#t=this.#e.logger}else this.#t={...console,debug:U((...c)=>{o.CEREBRO_OUTPUT_LEVEL===String(re)&&console.debug(...c)},"debug")};this.#d=this.#e.packageVersion,this.#y=this.#e.packageName,this.#u=this.#e.cwd,this.#r="help",this.#a={};const l=n.fs;if(l!==void 0&&(typeof l!="object"||l===null))throw new E("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const s=n.exit;if(s!==void 0&&typeof s!="function")throw new E("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const p=n.env;if(p!==void 0&&(typeof p!="object"||p===null))throw new E("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 E("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#w=n.fs,this.#$=n.exit,this.#O=n.env,this.#x=n.stdin??"",this.#n=new Map,this.#i=new Map,this.#o=new Map}setCommandSection(e){return this.#a=e,this}getCommandSection(){return this.#a.header||(this.#a.header=`${this.#f}${this.#d?` v${this.#d}`:""}`),this.#a}setDefaultCommand(e){return this.#r=e,this}get defaultCommand(){return this.#r}addCommand(e){qe(e,"Command"),we(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new E(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new E(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?we(e.alias):Pt(e.alias,"Command alias").forEach(a=>we(a))),e.argument&&qe(e.argument,"Command argument"),e.options&&qe(e.options,"Command options"),e.commandPath&&(Pt(e.commandPath,"Command commandPath"),e.commandPath.forEach(a=>{we(a)}));const r=Ot(e.name,e.commandPath),o=J(r);if(this.#i.has(o))throw new E(`Command with path "${o}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const l=Array.isArray(e.commandPath)&&e.commandPath.length>0,s=this.#n.get(e.name),p=s!==void 0&&(s.commandPath===void 0||s.commandPath.length===0);if(!l&&p)throw new E(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const a of e.options)pt(a);if(la(e),Ps(e),xs(e),e.options&&(e.__conflictingOptions__=e.options.filter(a=>a.conflicts!==void 0),e.__requiredOptions__=e.options.filter(a=>a.required===!0)),l&&s!==void 0)this.#n.set(o,e);else{if(!l&&s!==void 0&&!p){const a=Ot(s.name,s.commandPath);this.#n.set(J(a),s)}this.#n.set(e.name,e)}if(this.#i.set(o,r),this.#o.set(o,e),this.#N(),e.alias!==void 0){const a=typeof e.alias=="string"?[e.alias]:e.alias;for(const c of a){if(H().CEREBRO_OUTPUT_LEVEL===String(re)&&this.#t.debug("adding alias",c),this.#n.has(c))throw new E(`Command alias "${c}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:c,commandName:e.name});this.#n.set(c,e)}}return this}addGlobalOption(e){const n=e,i=new Set(ye.map(o=>o.name)),r=new Set(ye.map(o=>o.alias).filter(Boolean));if(i.has(n.name))throw new E(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&r.has(n.alias))throw new E(`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 E(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",pt(n),this.#l.push(n),this}getGlobalOptions(){return this.#C()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#p?this.#p:(this.#p=new uo(this.#t),this.#p.register({description:"Attaches the logger to the toolbox",execute:U(e=>{e.logger=this.#t,e.console=e.logger},"execute"),name:"logger"}),this.#p)}getCliName(){return this.#f}getPackageVersion(){return this.#d}getPackageName(){return this.#y}getCommands(){return this.#n}getCwd(){return this.#u}dispose(){this.#P?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...r}=e;if(!this.#n.has("help")){const{default:m}=await import("../packem_chunks/help-command.js");this.addCommand(new m(this.#n))}const o=this.#E(),l=this.#i;this.#L();const s=this.#b();let p,a=[...s];const c=Bt(),d=Ut(),f=xe();this.#t.debug(`process.execPath: ${c}`),this.#t.debug(`process.execArgv: ${d.join(" ")}`),this.#t.debug(`process.argv: ${f.join(" ")}`);const g=ua(l,[...s]);if(g.commandPath)p=g.commandPath,a=g.argv;else{if(s.length>1&&s[0]&&s[1]&&!Ge(s[0])&&!Ge(s[1])){const b=[];let $=0;for(;$<s.length;){const j=s[$];if(!j||Ge(j))break;b.push(j),$+=1}const P=J(b);if(b[0]&&!o.includes(b[0])){const j=this.#s(),C=Z(P,j);throw new K(P,C)}}let m;try{m=$o([null,...o],[...s])}catch(b){if(b instanceof Error&&b.name==="INVALID_COMMAND"&&"command"in b){const $=b.command,P=this.#s(),j=Z($,P);throw new K($,j)}throw b}m.command&&(p=[m.command],a=m.argv)}if(!p)if(this.#r)p=[this.#r];else{const m=this.#s();throw new K("",m)}const u=J(p),v=this.#i.get(u);let w;if(v){if(w=this.#o.get(u),!w||J(v)!==u){const m=this.#s(),b=Z(u,m);throw new K(u,b)}}else{const m=p.at(-1);if(w=m?this.#n.get(m):void 0,!w){const b=this.#s(),$=Z(u,b);throw new K(u,$)}}if(typeof w.execute!="function"&&typeof w.loader!="function")return this.#t.error(`Command "${w.name}" has no function to execute.`),i?W(1):void 0;const y=a;let O,A;try{({commandArgs:O,toolbox:A}=this.#k(w,y,r,u))}catch(m){if(this.#t.error(m),i)return W(1);throw m}const h=this.getPluginManager();try{!this.#h&&h.hasPlugins()&&(await h.init({cli:this,cwd:this.#u,logger:this.#t}),this.#h=!0),await h.executeLifecycle("execute",A),await h.executeLifecycle("beforeCommand",A);let m;const b=O.global;if(b?.help){const $=this.#n.get("help");if(!$)throw new E("Help command not found","COMMAND_NOT_FOUND");m=await oe($,A,O)}else if(b?.version??b?.V){const $=this.#n.get("version");if(!$)throw new E("Version command not found","COMMAND_NOT_FOUND");m=await oe($,A,O)}else m=await oe(w,A,O);return await h.executeLifecycle("afterCommand",A,m),i?W(0):void 0}catch(m){throw await h.executeErrorHandlers(m,A),m}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...r}=n;Ae(e,"Command name");const o=e.split(" ").filter(Boolean),l=J(o),s=this.#i.get(l)?this.#o.get(l):this.#n.get(e);if(!s){const f=this.#s(),g=Z(l||e,f);throw new K(e,g)}if(typeof s.execute!="function"&&typeof s.loader!="function")throw new E(`Command "${s.name}" has no function to execute`,"INVALID_COMMAND",{commandName:s.name});const p=[...At(i)];this.#t.debug(`running command '${e}' programmatically with args: ${p.join(", ")}`);const{commandArgs:a,toolbox:c}=this.#k(s,p,r,l||e),d=this.getPluginManager();try{!this.#h&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#u,logger:this.#t}),this.#h=!0),await d.executeLifecycle("execute",c),await d.executeLifecycle("beforeCommand",c);let f;const g=a.global;if(g?.help){const u=this.#n.get("help");if(!u)throw new E("Help command not found","COMMAND_NOT_FOUND");f=await oe(u,c,a)}else if(g?.version??g?.V){const u=this.#n.get("version");if(!u)throw new E("Version command not found","COMMAND_NOT_FOUND");f=await oe(u,c,a)}else f=await oe(s,c,a);return await d.executeLifecycle("afterCommand",c,f),f}catch(f){throw await d.executeErrorHandlers(f,c),f}}clone(e){const n={...this.#e,...e},i=new En(this.#f,n);for(const[r,o]of this.#n)i.#n.set(r,o);for(const[r,o]of this.#i)i.#i.set(r,[...o]);for(const[r,o]of this.#o)i.#o.set(r,o);for(const r of this.#l)i.#l.push(r);return i.#r=this.#r,i.#a={...this.#a},i.#N(),i}async getAction(e){Ae(e,"Command name");const n=e.split(" ").filter(Boolean),i=J(n),r=this.#i.get(i)?this.#o.get(i):this.#n.get(e);if(!r){const o=this.#s(),l=Z(i||e,o);throw new K(e,l)}if(typeof r.execute=="function")return r.execute;if(typeof r.loader=="function")return dn(r);throw new E(`Command "${r.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:r.name})}};var Js=Object.defineProperty,Zs=N((t,e)=>Js(t,"name",{value:e,configurable:!0}),"e$1"),Ys=Object.defineProperty,Qs=Zs((t,e)=>Ys(t,"name",{value:e,configurable:!0}),"o"),Xs=Object.defineProperty,el=Qs((t,e)=>Xs(t,"name",{value:e,configurable:!0}),"t");const zc=el((t,e)=>new Ks(t,e),"createCerebro");var tl=Object.defineProperty,nl=N((t,e)=>tl(t,"name",{value:e,configurable:!0}),"r$1"),il=Object.defineProperty,ol=nl((t,e)=>il(t,"name",{value:e,configurable:!0}),"r"),rl=Object.defineProperty,al=ol((t,e)=>rl(t,"name",{value:e,configurable:!0}),"o");const Fc=al(()=>{try{const t=require("node:module");if(typeof t.enableCompileCache=="function"){t.enableCompileCache();return}}catch{}try{require("v8-compile-cache")}catch{}},"enableCompileCache");var sl=Object.defineProperty,ll=N((t,e)=>sl(t,"name",{value:e,configurable:!0}),"u$2"),cl=Object.defineProperty,Cn=ll((t,e)=>cl(t,"name",{value:e,configurable:!0}),"p");const ul=Ke(import.meta.url),he=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Nn=Cn(t=>{if(typeof he<"u"&&he.versions&&he.versions.node){const[e,n]=he.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return he.getBuiltinModule(t)}return ul(t)},"__cjs_getBuiltinModule"),{execFileSync:pl}=Nn("node:child_process"),{totalmem:fl}=Nn("node:os");var dl=Object.defineProperty,Ie=Cn((t,e)=>dl(t,"name",{value:e,configurable:!0}),"r");const hl=/--max-old-space-size=(\d+)/,ml=/--max-semi-space-size=(\d+)/,gl=Ie(t=>Math.floor(fl()/1024/1024*t),"getDefaultMaxOldSpaceSize"),vl=Ie(t=>t<=512?4:t<=1024?8:t<=2048?16:t<=4096?32:t<=8192?64:Math.floor(Math.log2(t))*8,"getSemiSpaceSize"),Et=Ie((t,e)=>{for(const n of e){const i=t.exec(n);if(i)return Number.parseInt(i[1],10)}},"extractFlag"),Wc=Ie(t=>{const e=t?.maxOldSpacePercent??.75,n=[...Ut()],i=[...xe()],r=Et(hl,n),o=Et(ml,n);if(r!==void 0&&o!==void 0)return;const l=r??gl(e),s=o??vl(l),p=[];if(r===void 0&&p.push(`--max-old-space-size=${String(l)}`),o===void 0&&p.push(`--max-semi-space-size=${String(s)}`),p.length!==0)try{pl(Bt(),[...p,...n,...i.slice(1)],{env:H(),stdio:"inherit"}),W(0)}catch(a){const c=a.status;W(typeof c=="number"?c:1)}},"applyHeapTuning");var bl=Object.defineProperty,yl=N((t,e)=>bl(t,"name",{value:e,configurable:!0}),"T"),wl=Object.defineProperty,Me=yl((t,e)=>wl(t,"name",{value:e,configurable:!0}),"N");const $l=Ke(import.meta.url),me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ol=Me(t=>{if(typeof me<"u"&&me.versions&&me.versions.node){const[e,n]=me.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return me.getBuiltinModule(t)}return $l(t)},"__cjs_getBuiltinModule"),{createRequire:xl}=Ol("node:module");var Pl=Object.defineProperty,Al=Me((t,e)=>Pl(t,"name",{value:e,configurable:!0}),"A$2"),El=Object.defineProperty,Ye=Al((t,e)=>El(t,"name",{value:e,configurable:!0}),"$"),Cl=Object.defineProperty,Nl=Ye((t,e)=>Cl(t,"name",{value:e,configurable:!0}),"r$1");const kl=Nl(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
7
|
-
`),"normalizeLF"),jl=globalThis.process??Object.create(null),Ct={versions:{}},Nt=new Proxy(jl,{get(t,e){if(e in t)return t[e];if(e in Ct)return Ct[e]}});var _l=Object.defineProperty,Ll=Ye((t,e)=>_l(t,"name",{value:e,configurable:!0}),"b");const Sl=Ll((t,e,n,i)=>{const r={column:0,line:-1,...t.start},o={...r,...t.end},l=r.line,s=r.column,p=o.line,a=o.column;let c=Math.max(l-(n+1),0),d=Math.min(e.length,p+i);l===-1&&(c=0),p===-1&&(d=e.length);const f=p-l,g={};if(f)for(let u=0;u<=f;u++){const v=u+l;if(!s)g[v]=!0;else if(u===0){const w=e[v-1]?.length;g[v]=[s,(w??0)-s+1]}else if(u===f)g[v]=[0,a];else{const w=e[v-u]?.length;g[v]=[0,w]}}else s===a?g[l]=s?[s,0]:!0:g[l]=[s,(a??0)-(s??0)];return{end:d,markerLines:g,start:c}},"getMarkerLines");var Tl=Object.defineProperty,$e=Ye((t,e)=>Tl(t,"name",{value:e,configurable:!0}),"t");const Il=Nt.platform==="win32"&&!Nt.env?.WT_SESSION?">":"❯",Ml=$e((t,e,n)=>{const i={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:$e(u=>u,"gutter"),marker:$e(u=>u,"marker"),message:$e(u=>u,"message"),...n?.color}},r=typeof e.start.column=="number";let o=kl(t).split(`
|
|
8
|
-
`);typeof i.tabWidth=="number"&&(o=o.map(u=>u.replaceAll(" "," ".repeat(i.tabWidth))));const{end:l,markerLines:s,start:p}=Sl(e,o,i.linesAbove,i.linesBelow),a=String(l).length,{gutter:c,marker:d,message:f}=i.color;let g=o.slice(p,l).map((u,v)=>{const w=p+1+v,y=s[w],O=` ${String(w)}`.slice(-a),A=!s[w+1],h=` ${O}${i.showGutter?" |":""}`;if(y){let m="";if(Array.isArray(y)){const b=u.replaceAll(/[^\t]/g," ").slice(0,Math.max(y[0]-1,0)),$=y[1]||1;m=[`
|
|
9
|
-
`,i.prefix+c(h.replaceAll(/\d/g," "))," ",b,d("^").repeat($)].join(""),A&&i.message&&(m+=` ${f(i.message)}`)}return[i.prefix+d(Il),c(h),u.length>0?` ${u}`:"",m].join("")}return`${i.prefix} ${c(h)}${u.length>0?` ${u}`:""}`}).join(`
|
|
10
|
-
`);return i.message&&!r&&(g=`${i.prefix+" ".repeat(a+1)+i.message}
|
|
11
|
-
${g}`),g},"codeFrame");var Vl=Object.defineProperty,Ul=Me((t,e)=>Vl(t,"name",{value:e,configurable:!0}),"x$1"),Bl=Object.defineProperty,Dl=Ul((t,e)=>Bl(t,"name",{value:e,configurable:!0}),"x"),Rl=Object.defineProperty,q=Dl((t,e)=>Rl(t,"name",{value:e,configurable:!0}),"u");const X=q((t,...e)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${t}`,...e)},"debugLog"),ee="<unknown>",zl=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Fl=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,Wl=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,ql=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,Gl=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Hl=/in\s(.*)\s\(at\s(.+)\)\sat/,Kl=/^(?:.*@)?(.*):(\d+):(\d+)$/,Jl=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Zl=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Yl=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,kt=/\(error: (.*)\)/,Ql=/at\s/,Xl=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,ec=/\S*(?:Error: |AggregateError:)/,kn=/^Anonymous function$/,tc=/^\s*in\s.*/,nc=/^.*?\s*at\s.*/,ic=/^.*?\s*@.*|\[native code\]/,jn=q((t,e)=>{const n=t.includes("safari-extension"),i=t.includes("safari-web-extension");return n||i?[t.includes("@")?t.split("@")[0]:ee,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},"extractSafariExtensionDetails"),_n=q((t,e)=>{const n=Wl.exec(e);n&&(t.file=n[1],t.line=+n[2],t.column=+n[3])},"parseMapped"),oc=q(t=>{const e=Hl.exec(t);if(e){X(`parse nested node error stack line: "${t}"`,`found: ${JSON.stringify(e)}`);const i=e[2].split(":");return{column:i[2]?+i[2]:void 0,file:i[0],line:i[1]?+i[1]:void 0,methodName:e[1]??ee,raw:t,type:void 0}}const n=Gl.exec(t);if(n){X(`parse node error stack line: "${t}"`,`found: ${JSON.stringify(n)}`);const i={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(Ql,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??ee,raw:t,type:t.startsWith("internal")?"internal":void 0};return _n(i,`${n[2]}:${n[3]}:${n[4]}`),i}},"parseNode"),rc=q(t=>{const e=zl.exec(t);if(e){X(`parse chrome error stack line: "${t}"`,`found: ${JSON.stringify(e)}`);const n=e[2]?.startsWith("native"),i=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let r,o;if(i){const a=Fl.exec(t);if(a){const c=Xl.exec(a[1]);c?(e[2]=c[4]??c[1],e[3]=c[5]??c[2],e[4]=c[3]):a[2]&&(e[2]=a[1]),a[2]&&(r={column:a[4]?+a[4]:void 0,file:a[2],line:a[3]?+a[3]:void 0,methodName:"eval",raw:t,type:"eval"})}else{const c=ql.exec(t);c&&(o={column:c[4]?+c[4]:void 0,file:c[2],line:c[3]?+c[3]:void 0},r={column:c[6]?+c[6]:void 0,file:c[1],line:c[5]?+c[5]:void 0,methodName:"eval",raw:c[0],type:"eval"})}}const[l,s]=jn(e[1]?e[1].replace(kn,"<anonymous>"):ee,e[2]),p={column:e[4]?+e[4]:void 0,evalOrigin:r,file:s,line:e[3]?+e[3]:void 0,methodName:l,raw:t,type:i?"eval":n?"native":void 0};return o?(p.column=o.column,p.file=o.file,p.line=o.line):_n(p,`${s}:${e[3]}:${e[4]}`),p}},"parseChromium"),ac=q((t,e)=>{const n=Jl.exec(t);if(n){X(`parse gecko error stack line: "${t}"`,`found: ${JSON.stringify(n)}`);const i=n[3]?.includes(" > eval"),r=i&&n[3]&&Zl.exec(n[3]);let o;i&&r&&(n[3]=r[1],o={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:t,type:"eval"},n[4]=r[2]);const[l,s]=jn(n[1]?n[1].replace(kn,"<anonymous>"):ee,n[3]);let p;(e?.type==="safari"||!i&&e?.type==="firefox")&&e.column?p=e.column:!i&&n[5]&&(p=+n[5]);let a;return(e?.type==="safari"||!i&&e?.type==="firefox")&&e.line?a=e.line:n[4]&&(a=+n[4]),{column:p,evalOrigin:o,file:s,line:a,methodName:l,raw:t,type:i?"eval":s.includes("[native code]")?"native":void 0}}},"parseGecko"),sc=q((t,e)=>{const n=Yl.exec(t);if(!(n&&n[2].includes(" > eval"))&&n)return X(`parse firefox error stack line: "${t}"`,`found: ${JSON.stringify(n)}`),{column:n[4]?+n[4]:e?.column??void 0,file:n[2],line:n[3]?+n[3]:e?.line??void 0,methodName:n[1]||ee,raw:t,type:void 0}},"parseFirefox"),lc=q(t=>{const e=Kl.exec(t);if(e)return X(`parse react android native error stack line: "${t}"`,`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:ee,raw:t,type:void 0}},"parseReactAndroidNative"),Ln=q((t,{filter:e,frameLimit:n=50}={})=>{const i=t;let r=(typeof i.stacktrace=="string"?i.stacktrace:t.stack??"").split(`
|
|
12
|
-
`).map(o=>(kt.test(o)?o.replace(kt,"$1"):o).trim()).filter(o=>!ec.test(o)&&o!=="eval code");return e&&(r=r.filter(o=>e(o))),r=r.slice(0,n),r.reduce((o,l,s)=>{if(!l||l.length>1024)return o;let p;if(tc.test(l))p=oc(l);else if(nc.test(l))p=rc(l);else if(ic.test(l)){let a;if(s===0){const c=t,d=c.columnNumber,f=c.lineNumber,g=c.line,u=c.column;d||f?a={column:d,line:f,type:"firefox"}:(g||u)&&(a={column:u,line:g,type:"safari"})}p=sc(l,a)??ac(l,a)}else p=lc(l);return p?o.push(p):X(`parse error stack line: "${l}"`,"not parser found"),o},[])},"parseStacktrace");var cc=Object.defineProperty,uc=Me((t,e)=>cc(t,"name",{value:e,configurable:!0}),"p"),pc=Object.defineProperty,Sn=uc((t,e)=>pc(t,"name",{value:e,configurable:!0}),"m");const fc=xl(import.meta.url),ae=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Qe=Sn(t=>{if(typeof ae<"u"&&ae.versions&&ae.versions.node){const[e,n]=ae.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ae.getBuiltinModule(t)}return fc(t)},"__cjs_getBuiltinModule"),{existsSync:dc,readFileSync:hc}=Qe("node:fs"),{relative:mc}=Qe("node:path"),{cwd:gc}=ae,{fileURLToPath:vc}=Qe("node:url");var bc=Object.defineProperty,_=Sn((t,e)=>bc(t,"name",{value:e,configurable:!0}),"o");const ue=_((t,e,n)=>n===0?t:e===" "?t+" ".repeat(n):t+" ".repeat(e*n),"getPrefix"),yc=_((t,e)=>{const n=t.replace("async file:","file:");return mc(e,n.startsWith("file:")?vc(n):n)},"getRelativePath"),wc=_((t,e,n)=>{if(e)return n.title(t.message);const i=t.message?`: ${t.message}`:"";return n.title(t.name+i)},"getTitleText"),Tn=_((t,{color:e,hideErrorTitle:n,indentation:i,prefix:r},o)=>`${ue(r,i,o)}${wc(t,n,e)}
|
|
13
|
-
`,"getMessage"),In=_((t,{color:e,indentation:n,prefix:i},r)=>{if(t.hint===void 0)return;const o=ue(i,n,r);let l="";if(Array.isArray(t.hint))for(const s of t.hint)l+=`${o+s}
|
|
14
|
-
`;else l+=o+t.hint;return e.hint(l)},"getHint"),Xe=_((t,{color:e,cwd:n,displayShortPath:i,indentation:r,prefix:o},l=0)=>{const s=i?yc(t.file,n):t.file,{fileLine:p,method:a}=e;return`${ue(o,r,l)}at ${t.methodName?`${a(t.methodName)} `:""}${p(s)}:${p(t.line?.toString()??"")}`},"getMainFrame"),Mn=_((t,{color:e,indentation:n,linesAbove:i,linesBelow:r,prefix:o,showGutter:l,showLineNumbers:s,tabWidth:p},a)=>{if(t.file===void 0)return;const c=t.file.replace("file://","");if(!dc(c))return;const d=hc(c,"utf8");return Ml(d,{start:{column:t.column,line:t.line}},{color:e,linesAbove:i,linesBelow:r,prefix:ue(o,n,a),showGutter:l,showLineNumbers:s,tabWidth:p})},"getCode"),Vn=_((t,e,n)=>{if(t.errors.length===0)return;let i=`${ue(e.prefix,e.indentation,n)}Errors:
|
|
15
|
-
|
|
16
|
-
`,r=!0;for(const o of t.errors)r?r=!1:i+=`
|
|
17
|
-
|
|
18
|
-
`,i+=Bn(o,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},n+1);return`
|
|
19
|
-
${i}`},"getErrors"),Un=_((t,e,n)=>{let i=`${ue(e.prefix,e.indentation,n)}Caused by:
|
|
20
|
-
|
|
21
|
-
`;const r=t.cause;i+=Tn(r,e,n);const o=Ln(r).shift(),l=In(r,e,n);if(l&&(i+=`${l}
|
|
22
|
-
`),o&&(i+=Xe(o,e,n),!e.hideErrorCauseCodeView)){const s=Mn(o,e,n);s!==void 0&&(i+=`
|
|
23
|
-
${s}`)}if(r.cause)i+=`
|
|
24
|
-
${Un(r,e,n+1)}`;else if(r instanceof AggregateError){const s=Vn(r,e,n);s!==void 0&&(i+=`
|
|
25
|
-
${s}`)}return`
|
|
26
|
-
${i}`},"getCause"),$c=_((t,e)=>(t.length>0?`
|
|
27
|
-
`:"")+t.map(n=>Xe(n,e)).join(`
|
|
28
|
-
`),"getStacktrace"),Bn=_((t,e,n)=>{const i={cwd:gc(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...e,color:{fileLine:_(l=>l,"fileLine"),gutter:_(l=>l,"gutter"),hint:_(l=>l,"hint"),marker:_(l=>l,"marker"),message:_(l=>l,"message"),method:_(l=>l,"method"),title:_(l=>l,"title"),...e.color}},r=Ln(t,{filter:e.filterStacktrace,frameLimit:i.framesMaxLimit}),o=r.shift();return[e.hideMessage?void 0:Tn(t,i,n),In(t,i,n),o?Xe(o,i,n):void 0,o&&!i.hideErrorCodeView?Mn(o,i,n):void 0,t instanceof AggregateError?Vn(t,i,n):void 0,t.cause===void 0?void 0:Un(t,i,n),r.length>0?$c(r,i):void 0].filter(Boolean).join(`
|
|
29
|
-
`).replaceAll("\\","/")},"internalRenderError"),Oc=_((t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return Bn(t,e,0)},"renderError");var xc=Object.defineProperty,Pc=N((t,e)=>xc(t,"name",{value:e,configurable:!0}),"i$1"),Ac=Object.defineProperty,Ec=Pc((t,e)=>Ac(t,"name",{value:e,configurable:!0}),"n"),Cc=Object.defineProperty,jt=Ec((t,e)=>Cc(t,"name",{value:e,configurable:!0}),"n");const qc=jt((t={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:jt((e,n)=>{const{logger:i,runtime:r}=n,{detailed:o=!1,exitOnError:l=!0,formatter:s,logErrors:p=!0,renderOptions:a={}}=t;if(p)if(s)i.error(s(e));else if(o){const c=r.getCwd(),d=Oc(e,{cwd:c,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...a});i.error(d)}else i.error(e);l&&W(1)},"handleError"),version:"1.0.0"}),"errorHandlerPlugin");var Nc="1.0.0-alpha.27";const Gc={version:Nc};var kc=Object.defineProperty,jc=N((t,e)=>kc(t,"name",{value:e,configurable:!0}),"e");const Hc={argument:{description:"Package to execute (optionally with @version)",name:"package",type:String},description:"Execute a remote package without permanent installation",examples:[["vis dlx create-vite my-app","Scaffold a new project"],["vis dlx typescript@5.5.4 tsc --version","Run specific version"],["vis dlx -p cowsay -p lolcatjs -c 'echo hi | cowsay | lolcatjs'","Multiple packages with shell"],["vis install && vis dlx --offline typescript tsc --version","Hardened: pre-install + offline (no registry fetch on dlx)"]],group:"Run & Execute",loader:jc(()=>import("../packem_chunks/handler9.js"),"loader"),name:"dlx",options:[{alias:"p",description:"Additional packages to install (repeatable)",multiple:!0,name:"package",type:String},{alias:"c",defaultValue:!1,description:"Execute within shell environment",name:"shell-mode",type:Boolean},{alias:"s",defaultValue:!1,description:"Suppress output except command results",name:"silent",type:Boolean},{defaultValue:!1,description:"Resolve from local store only — fail rather than fetch from the registry. Pair with `vis install` for hardened npx-style workflows.",name:"offline",type:Boolean}]};export{Wc as N,zc as T,Hc as a,H as b,Mc as c,E as d,Vc as f,Fc as i,Gc as m,se as n,qc as w};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var T=Object.defineProperty;var j=(n,e)=>T(n,"name",{value:e,configurable:!0});import{createRequire as A}from"node:module";import{m as R,q as C}from"../packem_chunks/bin.js";const q=A(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=j(n=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[e,t]=h.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return h.getBuiltinModule(n)}return q(n)},"__cjs_getBuiltinModule"),{createRequire:N}=B("node:module");var U=Object.defineProperty,z=j((n,e)=>U(n,"name",{value:e,configurable:!0}),"L"),I=Object.defineProperty,F=z((n,e)=>I(n,"name",{value:e,configurable:!0}),"F");const J=N(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,S=F(n=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[e,t]=y.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return y.getBuiltinModule(n)}return J(n)},"__cjs_getBuiltinModule"),{readFileSync:Y}=S("node:fs"),{readFile:Z}=S("node:fs/promises");var K=Object.defineProperty,l=F((n,e)=>K(n,"name",{value:e,configurable:!0}),"g");const G={sha256:"sha256",sha384:"sha384",sha512:"sha512"},H=1024,Q=/^[A-Z0-9+/]+={0,2}$/i,V=/.*node_modules\/((?:@[^/]+\/)?[^/]+)$/,k=/^['"]/,v=/['"]$/,X=/^[a-z][a-zA-Z0-9]*:\s*$/m,ee=/resolution:\s*\{[^}]*integrity:\s*([^,}\s]+)/,ne=/^["']?((?:@[^/@"']+\/)?[^@"'\n]+)@[^"'\n]+["']?:?[\t\v\f\r \u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\n((?:[\t ][^\n]*\n?)+)/gm,te=/^\s+version:?\s+"?([^"\n]+)"?/m,se=/^\s+integrity[\s:]+"?([^"\s]+)"?/m,x=l(n=>{if(n.length>H)return;const e=n.indexOf("-");if(e<=0)return;const t=G[n.slice(0,e).toLowerCase()];if(!t)return;const s=n.slice(e+1);if(Q.test(s))try{const i=Buffer.from(s,"base64");return i.length===0?void 0:{algorithm:t,hex:i.toString("hex")}}catch{return}},"decodeSriIntegrity"),w=l((n,e,t)=>{const s=`${t.name}@${t.version}`;e.has(s)||(e.add(s),n.push(t))},"pushUniqueEntry"),m=l((n,e,t)=>{t&&Object.keys(t).length>0&&(n[e]={...t})},"copyDepMap"),g=l(n=>{if(!n)return;const e={};for(const[t,s]of Object.entries(n))e[t]=[s];return Object.keys(e).length>0?e:void 0},"liftDepMap"),re=l(n=>{const e=[],t=new Set;let s;try{s=JSON.parse(n)}catch{return e}if(!s.packages)return e;for(const[i,r]of Object.entries(s.packages)){if(!i||!r.version)continue;const p=V.exec(i);if(!p?.[1])continue;const c=r.name??p[1];if(c.startsWith("."))continue;const o={name:c,version:r.version};if(r.integrity){const a=x(r.integrity);a&&(o.integrity=a)}m(o,"dependencies",g(r.dependencies)),m(o,"peerDependencies",g(r.peerDependencies)),m(o,"optionalDependencies",g(r.optionalDependencies)),w(e,t,o)}return e},"parseNpmLockFile"),_=l(n=>{let e=n.trim();e.startsWith("/")&&(e=e.slice(1)),e=e.replace(k,"").replace(v,"");const t=e.indexOf("(");t>0&&(e=e.slice(0,t));const s=e.lastIndexOf("@");if(s<=0)return;const i=e.slice(0,s),r=e.slice(s+1);if(!(!i||!r||r.startsWith("link:")||r.startsWith("workspace:")||r.startsWith("file:")))return{name:i,version:r}},"splitPnpmPackageKey"),W=l((n,e)=>{const t=new RegExp(String.raw`^${e}:\s*$`,"m").exec(n);if(!t)return;const s=t.index+t[0].length,i=X.exec(n.slice(s));return n.slice(s,i?s+i.index:n.length)},"sliceTopLevelSection"),oe=l(n=>{const e=new Map,t=W(n,"snapshots");if(!t)return e;const s=/^ {2}(['"]?[^\s:][^:\n]*?['"]?):\s*\n((?: {4}[^\n]*\n?)+)/gm;let i;for(;(i=s.exec(t)??void 0)!==void 0;){const r=_(i[1]);if(!r)continue;const p=`${r.name}@${r.version}`,c=i[2],o=e.get(p)??{};for(const a of["dependencies","peerDependencies","optionalDependencies"]){const u=b(c,a);if(!u)continue;const d=o[a]??{};for(const[f,P]of Object.entries(u)){const D=d[f]??[];for(const $ of P)D.includes($)||D.push($);d[f]=D}o[a]=d}e.set(p,o)}return e},"parsePnpmSnapshotEdges"),ie=l(n=>{const e=[],t=new Set,s=W(n,"packages");if(!s)return e;const i=oe(n),r=/^ {2}(['"]?[^\s:][^:\n]*?['"]?):\s*\n((?: {4}[^\n]*\n?)+)/gm;let p;for(;(p=r.exec(s)??void 0)!==void 0;){const c=_(p[1]);if(!c)continue;const o=p[2],a=ee.exec(o),u={name:c.name,version:c.version};if(a?.[1]){const f=x(a[1]);f&&(u.integrity=f)}const d=i.get(`${c.name}@${c.version}`);m(u,"dependencies",d?.dependencies??b(o,"dependencies")),m(u,"peerDependencies",d?.peerDependencies??b(o,"peerDependencies")),m(u,"optionalDependencies",d?.optionalDependencies??b(o,"optionalDependencies")),w(e,t,u)}return e},"parsePnpmLockFile"),b=l((n,e)=>{const t=new RegExp(String.raw`^ {4}${e}:\s*\n((?: {6,}[^\n]*\n?)+)`,"m").exec(n);if(!t?.[1])return;const s={},i=/^ {6}([^\s:]+):\s*([^\n]+)/gm;let r;for(;(r=i.exec(t[1])??void 0)!==void 0;){const p=r[1].replace(k,"").replace(v,"");let c=r[2].trim();c=c.replace(k,"").replace(v,"");const o=c.indexOf("(");if(o>0&&(c=c.slice(0,o).trim()),!p||!c)continue;const a=s[p]??[];a.includes(c)||a.push(c),s[p]=a}return Object.keys(s).length>0?s:void 0},"extractPnpmDependencyMap"),ce=l(n=>{const e=[],t=new Set,s=ne;s.lastIndex=0;let i;for(;(i=s.exec(n)??void 0)!==void 0;){const r=i[1].replace(k,"").replace(v,"");if(!r)continue;const p=i[2],c=te.exec(p);if(!c?.[1])continue;const o={name:r,version:c[1].trim()},a=se.exec(p);if(a?.[1]){const u=x(a[1]);u&&(o.integrity=u)}m(o,"dependencies",O(p,"dependencies")),m(o,"peerDependencies",O(p,"peerDependencies")),m(o,"optionalDependencies",O(p,"optionalDependencies")),w(e,t,o)}return e},"parseYarnLockFile"),O=l((n,e)=>{const t=new RegExp(String.raw`^ {2}${e}:\s*\n((?: {4,}[^\n]*\n?)+)`,"m").exec(n);if(!t?.[1])return;const s={},i=/^ {4}(['"]?[^\s:'"]+['"]?)\s*(?::\s*)?['"]([^'"\n]+)['"]/gm;let r;for(;(r=i.exec(t[1])??void 0)!==void 0;){const p=r[1].replace(k,"").replace(v,""),c=r[2];if(p&&c){const o=s[p]??[];o.includes(c)||o.push(c),s[p]=o}}return Object.keys(s).length>0?s:void 0},"extractYarnDependencyMap"),pe=/,(?=\s*[}\]])/g,ae=l(n=>{const e=[],t=new Set;let s;try{s=JSON.parse(n.replaceAll(pe,""))}catch{return e}if(!s.packages)return e;for(const i of Object.values(s.packages)){const r=i[0];if(typeof r!="string")continue;const p=r.indexOf("@",1);if(p<=0)continue;const c=r.slice(0,p),o=r.slice(p+1);if(!c||!o||o.startsWith("workspace:")||o.startsWith("link:")||o.startsWith("file:"))continue;const a={name:c,version:o},u=i[3];if(typeof u=="string"&&u.length>0){const f=x(u);f&&(a.integrity=f)}const d=i[2];if(d&&typeof d=="object"&&!Array.isArray(d)){const f=d;m(a,"dependencies",g(f.dependencies)),m(a,"peerDependencies",g(f.peerDependencies)),m(a,"optionalDependencies",g(f.optionalDependencies))}w(e,t,a)}return e},"parseBunLockFile"),E=l(n=>{if(n.endsWith("pnpm-lock.yaml"))return"pnpm";if(n.endsWith("package-lock.json"))return"npm";if(n.endsWith("yarn.lock"))return"yarn";if(n.endsWith("bun.lock"))return"bun"},"inferLockFileType"),L=l((n,e)=>{switch(e){case"bun":return ae(n);case"npm":return re(n);case"pnpm":return ie(n);case"yarn":return ce(n);default:return[]}},"parseLockFileContent"),M=["pnpm-lock.yaml","package-lock.json","yarn.lock","bun.lock"];l(async n=>{const e=await R(M,{type:"file",...n&&{cwd:n}});if(!e)throw new Error("Could not find a supported lock file (pnpm-lock.yaml, package-lock.json, yarn.lock, bun.lock)");const t=E(e);if(!t)throw new Error(`Unsupported lock file: ${e}`);const s=await Z(e,"utf8");return{entries:L(s,t),path:e,type:t}},"parseLockFile");l(n=>{const e=C(M,{type:"file",...n&&{cwd:n}});if(!e)throw new Error("Could not find a supported lock file (pnpm-lock.yaml, package-lock.json, yarn.lock, bun.lock)");const t=E(e);if(!t)throw new Error(`Unsupported lock file: ${e}`);return{entries:L(Y(e,"utf8"),t),path:e,type:t}},"parseLockFileSync");export{L as F};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var S=Object.defineProperty;var g=(r,s)=>S(r,"name",{value:s,configurable:!0});import{e as T,E as x,I as k,T as $}from"./Table-CwC2kW07-EjFLNV0q.js";import{a5 as a,a6 as d,n as l,a7 as u,v as C,d as j,s as E}from"../packem_chunks/bin.js";import{n as R}from"./spinner-B9ZPv1iT.js";import{D as w,W as P,T as O,C as A}from"./symbols-CQmER5MT.js";var D=Object.defineProperty,I=g((r,s)=>D(r,"name",{value:s,configurable:!0}),"l");const v=I(({rows:r})=>a.jsx(d,{flexDirection:"column",children:r.map(s=>{let t;switch(s.status){case"error":{t=a.jsx(l,{color:"red",children:A});break}case"ok":{t=a.jsx(l,{color:"green",children:O});break}case"running":{t=a.jsx(l,{color:"white",children:a.jsx(R,{type:"dots"})});break}case"warn":{t=a.jsx(l,{color:"yellow",children:P});break}default:{t=a.jsx(l,{dimColor:!0,children:w});break}}return a.jsxs(d,{children:[a.jsx(d,{width:3,children:t}),a.jsx(d,{flexGrow:1,children:a.jsx(l,{children:s.label})}),s.summary?a.jsx(d,{children:a.jsxs(l,{dimColor:!0,children:[w," ",s.summary]})}):null]},s.id)})}),"ScanProgressApp");var Y=Object.defineProperty,i=g((r,s)=>Y(r,"name",{value:s,configurable:!0}),"e");const G={error:$(u.failure),ok:k(u.success),pending:x(u.dash),skip:x(u.dash),warn:T(u.warning)},M=i((r,s,t)=>{const h=t?`${r} ${x(`— ${t}`)}`:r;return` ${G[s]} ${h}
|
|
2
|
-
`},"formatStaticRow"),L=i((r,s={})=>{const t=s.stream??process.stderr,h=typeof t.isTTY=="boolean"&&t.isTTY&&!E,y=s.live??h,n=new Map;for(const e of r)n.set(e.id,{id:e.id,label:e.label,status:"pending"});if(!y||r.length===0)return{finish:i((e,o,f)=>{const c=n.get(e);c&&(n.set(e,{...c,status:o,summary:f}),t.write(M(c.label,o,f)))},"finish"),start:i(e=>{const o=n.get(e);o&&n.set(e,{...o,status:"running"})},"start"),stop:i(()=>{},"stop")};const b=i(()=>r.map(e=>n.get(e.id)),"buildRows");let m=C(j.createElement(v,{rows:b()}),{interactive:!0,patchConsole:!1});const p=i(()=>{m?.rerender(j.createElement(v,{rows:b()}))},"rerender");return{finish:i((e,o,f)=>{const c=n.get(e);c&&(n.set(e,{...c,status:o,summary:f}),p())},"finish"),start:i(e=>{const o=n.get(e);o&&(n.set(e,{...o,status:"running"}),p())},"start"),stop:i(()=>{m&&(p(),m.unmount(),m=void 0)},"stop")}},"startScanProgress");export{L as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var $=Object.defineProperty;var l=(e,s)=>$(e,"name",{value:s,configurable:!0});import{createRequire as z}from"node:module";import{T as b,e as k}from"./Table-CwC2kW07-EjFLNV0q.js";import{M as C,i as D}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{n as A}from"../packem_chunks/config.js";import{g as O}from"./_commonjsHelpers-CLblCigl.js";import{i as f,p as i}from"../packem_chunks/bin.js";const _=z(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=l(e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[s,r]=m.versions.node.split(".").map(Number);if(s>22||s===22&&r>=3||s===20&&r>=16)return m.getBuiltinModule(e)}return _(e)},"__cjs_getBuiltinModule"),{createInterface:M}=T("node:readline");var F=["aj","aju","av","avj","ejv","jav","jv"],N=["angula","angular-node","angularjs"],P=["auto-prefixer"],B=["aaxios","aios","axio","axioos","axios-node","axioss","axis","axiso","axois","axos","axxios"],R=["abel","babbel","babe","babel-js","babel-node","babl","bable","bbael","bebel"],S=["bcrpyt","bcrypt-node","brcypt","crypt","dcrypt"],W=["bcryptjs-node","dcryptjs"],L=["bunan","bunya","bunyan-node","buynan"],E=["cai","cha","chaijs","chal","chi","chia","hai"],U=["cahlk","calk","cchalk","ch4lk","cha1k","chaalk","chaik","chak","chakl","chalk-node","chalkk","challk","chhalk","chlak","chlk","halk","hcalk"],V=["cheero","cherio"],I=["c0lor","ccolor","clor","colo","coloor","color-js","colorjs","colorr","colr","coolor","coolr"],J=["ccolors","colors-node","colorss","colorz","colrs","coolors"],Y=["c0mmander","ccommander","cmmander","cmomander","co-mmander","comamnder","comander","comm4nder","commaander","commader","commadner","commamder","command3r","commandder","commande","commandeer","commander-js","commanderr","commandr","commandre","commanedr","commaner","commannder","commender","commmander","commnader","commnder","coommander","ocmmander","ommander"],G=["cor","corss","cos","cosr","cros","crs","ors"],H=["days"],K=["d3bug","dbeug","dbug","ddebug","debbug","debg","debgu","debu","debu9","debug-js","debug-node","debugg","debugjs","debuug","deebug","deubg","deug","ebug","edbug"],Q=["dot-env","dotenv-node","dotenvjs","dotevn"],X=["3lectron","eectron","eelctron","eelectron","el3ctron","elcetron","elctron","elecctron","elecron","elecrton","electon","electorn","electr0n","electrn","electrno","electro","electrom","electron-node","electronn","electroon","electrron","electtron","eleectron","eletcron","eletron","ellectron","lectron","leectron"],Z=["asbuild","ebuild","esbuild-node","esbuildjs","ezbuild","sbuild"],ee=["aslint","elint","eslint-js","eslint-node","eslit","ezlint","slint"],oe=["eexpress","epress","epxress","experss","expess","exppress","expreess","expres","express-node","expressjs","expresss","exprress","exprses","exprss","exress","exrpess","exxpress","xepress","xpress"],se=["astify"],re=["firebasejs"],ae=["form1dable"],te=["glb","glo","glob-js","globjs","gob","golb","lob"],ne=["go","goot","gotjs","gott","gt","gto","ogt","ot","qot"],ce=["helmetjs","helnet"],ie=["homo","hon","hoo","hoon","ohno","ono"],de=["inquire","inquirer-js","nquirer"],me=["iredis"],le=["ejst","est","jast","jes","jestjs","jestt","jet","jets","jst"],pe=["imp","jim","jip","jmp"],ue=["ji","jio","jo","joii","jol","oi","oji"],ve=["jdom","jsdm","jsdo","jsdom-js","jsdon","jsom","sdom"],he=["jsonwebtoken-js","jsonwebtoken-node"],je=["ka","kao","ko","koaa","koajs","koe","oa","oka"],be=["1odash","iodash","l0dash","ldash","ldoash","llodash","lo-dash","loadsh","loash","lobash","lod4sh","lodaash","lodah","lodahs","lodas","lodash-node","lodashh","lodassh","loddash","lodesh","lodsah","lodsh","loodash","odash","oldash"],ke=["luca","luci","lucie"],ge=["luon","luxo","luxon-js"],fe=["imcromatch","mciromatch","micormatch","micrmoatch","micro-match","microamtch","micromacth","micromathc","micromtach","mircomatch"],ye=["minimath"],xe=["mcha","mmocha","moca","moch","mocha-js","moha","nocha","ocha"],we=["m0ment","mment","mmoent","mmoment","moemnt","moent","mom3nt","momeent","momemt","momen","momen7","momennt","moment-js","momentjs","momentt","momet","mometn","momment","momnet","momnt","monent","mooment","oment","omment"],qe=["mognoose","mogoose","mongoos","mongose","monqoose","moongoose"],$e=["moran","organ"],ze=["muler","multer-js","muter"],_e=["mysql"],Te=["ext","mext","n3xt","naxt","net","netx","nex","next-js","next-node","nextjs","nxt"],Me=["node-mailer","nodemailer-js"],Ce=["nodemo","nodemonjs","nodmeon"],De=["oar","or","ora-node","ore","ra","roa"],Ae=["arcel","parce","parceljs"],Oe=["passport-js"],Fe=["phase","phaser-node"],Ne=["ino","pimo","pin","pino-node","pinojs","pio","pion"],Pe=["playright","playwright-js"],Be=["postcss-js","postcss-node","potscss"],Re=["pettier","pprettier","pretier","prettierjs","prettierr","prtetier"],Se=["prima","prism","prisma-js","prismajs","prizma"],We=["pupeteer"],Le=["rada","rama","ramd","randa"],Ee=["eact","eract","r3act","raact","ract","raect","re4ct","reaact","reac","reac7","reacct","react-node","reactjs","reactt","reat","reatc","recat","rect","reeact","reect","rreact"],Ue=["erdis","radis","rdis","redi","redis-js","redis-node","rediss","rediz","reds","reis","rredis"],Ve=["resen","rsend"],Ie=["ollup","rollup-js","rollup-node"],Je=["ass","asss","sas","sass-node","sess","ssas","sss"],Ye=["emver","seemver","semver-node","semvre","senver","sever"],Ge=["sequelize-js","sequelize-node"],He=["harp","shap","shar","sharp-js","sharpjs"],Ke=["stipe","strip","stripe-node","tripe"],Qe=["supabase-js"],Xe=["suelte","svelt3","svelte-js","sveltejs","velte"],Ze=["tailwindcss-js"],eo=["auri","taui"],oo=["hree","htree","thee","there","three-js","three-node","tree"],so=["stx","sx","ts","tsxx","ttsx","tx","txs","tzx"],ro=["ttypescript","typecript","typescipt","typescript-node","typescriptjs","typescrit","typescritp"],ao=["udnerscore","undercore","underscoer","underscore-node","underscroe","undersocre","undesrcore"],to=["uid","uud","uudi","uui","uuid-js","uuid-node","uuidjs","vuid"],no=["ite","vie","vit","vita","vite-node","vitee","vlte","vte"],co=["itest","uitest","vitestjs","vitezt","vittest","vtest"],io=["ue","uue","uve","ve","veu","vu","vu3","vua","vue-node","vuee","vuejs","vuue","vve","vvue"],mo=["web-pack","weback","webpac","webpack-node","webpackjs","webpak","weebpack","wepack","wepback"],lo=["winson","winston-js","winstoon"],po=["up","uyp","yp","yu","yupjs","yupp"],uo=["od","zd","zdo","zo","zob","zod-js","zodjs"];const vo={ajv:F,angular:N,autoprefixer:P,"aws-sdk":["awssdk","ews-sdk"],axios:B,babel:R,bcrypt:S,bcryptjs:W,"body-parser":["body-paresr","body-parse","body-parser-js","body_parser"],bunyan:L,chai:E,chalk:U,cheerio:V,color:I,colors:J,commander:Y,"cookie-parser":["cookie-parse","cookieparser"],cors:G,"cross-env":["crossenv"],"date-fns":["data-fns","date-fn"],dayjs:H,debug:K,dotenv:Q,electron:X,esbuild:Z,eslint:ee,express:oe,fastify:se,firebase:re,formidable:ae,glob:te,got:ne,helmet:ce,hono:ie,inquirer:de,ioredis:me,jest:le,jimp:pe,joi:ue,jsdom:ve,jsonwebtoken:he,koa:je,lodash:be,lucia:ke,luxon:ge,micromatch:fe,minimatch:ye,mocha:xe,moment:we,mongoose:qe,morgan:$e,multer:ze,mysql2:_e,next:Te,"node-fetch":["node-fecth","node-fethc","node.fetch"],nodemailer:Me,nodemon:Ce,ora:De,parcel:Ae,passport:Oe,phaser:Fe,pino:Ne,playwright:Pe,postcss:Be,prettier:Re,prisma:Se,puppeteer:We,ramda:Le,react:Ee,"react-dom":["eact-dom","eract-dom","r3act-dom","ract-dom","raect-dom","re4ct-dom","reaact-dom","reac-dom","reac7-dom","reacct-dom","react-bom","react-d0m","react-ddom","react-dm","react-dmo","react-do","react-domm","react-don","react-doom","react-odm","react-om","react.dom","reactdom","reactt-dom","reat-dom","reatc-dom","recat-dom","rect-dom","reeact-dom","rreact-dom"],redis:Ue,resend:Ve,rollup:Ie,sass:Je,semver:Ye,sequelize:Ge,sharp:He,"socket.io":["ocket.io","oscket.io","scket.io","scoket.io","soccket.io","socekt.io","socet.io","sock3t.io","socke.io","socke7.io","sockeet.io","socket.1o","socket.i","socket.iio","socket.ioo","socket.lo","socket.o","socket.oi","sockett.io","sockket.io","sockt.io","sockte.io","sokcet.io","soket.io","soocket.io","ssocket.io"],stripe:Ke,supabase:Qe,svelte:Xe,tailwindcss:Ze,tauri:eo,three:oo,"ts-node":["tts-node"],tsx:so,typescript:ro,underscore:ao,uuid:to,vite:no,vitest:co,vue:io,webpack:mo,winston:lo,yup:po,zod:uo};var v,g;function ho(){return g||(g=1,v={"@tanstack/start":["start-tanstack-app","tanstack","tanstack-app","tanstack-start"]}),v}l(ho,"requireTyposquatsManual");var jo=ho();const bo=O(jo);var ko=Object.defineProperty,n=l((e,s)=>ko(e,"name",{value:s,configurable:!0}),"c");const go={a:["4","e"],b:["d"],d:["b"],e:["3","a"],g:["9","q"],i:["1","l"],l:["1","i"],m:["n"],n:["m"],o:["0"],s:["5","z"],t:["7"],u:["v"],v:["u"]},fo=["app","cli","core","kit","lib","pkg","sdk"],yo=n(e=>{const s=new Set;if(e.length<3)return s;for(let o=0;o<e.length;o++){const a=e[o],t=a==="-"||a==="."||a==="_";if(t||s.add(e.slice(0,o)+e.slice(o+1)),t||s.add(e.slice(0,o)+a+e.slice(o)),o<e.length-1&&e[o]!==e[o+1]){const u=e[o+1]==="-"||e[o+1]==="."||e[o+1]==="_";if(!t&&!u){const d=[...e];[d[o],d[o+1]]=[d[o+1],d[o]],s.add(d.join(""))}}const c=e[o].toLowerCase(),j=go[c];if(j)for(const u of j)s.add(e.slice(0,o)+u+e.slice(o+1))}const r=/[-._]/g;if(r.test(e))s.add(e.replaceAll(r,"")),s.add(e.replaceAll(r,"-")),s.add(e.replaceAll(r,".")),s.add(e.replaceAll(r,"_"));else if(e.length>5)for(let o=2;o<e.length-2;o++)s.add(`${e.slice(0,o)}-${e.slice(o)}`),s.add(`${e.slice(0,o)}.${e.slice(o)}`),s.add(`${e.slice(0,o)}_${e.slice(o)}`);if(e.startsWith("@")||(s.add(`${e}-js`),s.add(`${e}js`),s.add(`${e}-node`)),e.startsWith("@")){const o=e.indexOf("/");if(o>1&&o<e.length-1){const a=e.slice(1,o),t=e.slice(o+1);a.length>=3&&s.add(a);for(const c of["","-",".","_"])s.add(`${a}${c}${t}`),s.add(`${t}${c}${a}`);for(const c of fo)s.add(`${a}-${c}`),s.add(`${t}-${a}-${c}`),s.add(`${c}-${a}-${t}`)}}return s.delete(e),s},"generateVariants");let h,p;const y=n(()=>{if(!h){const e={};for(const s of[vo,bo])for(const[r,o]of Object.entries(s)){const a=e[r]??(e[r]=[]);for(const t of o)a.includes(t)||a.push(t)}h=e}return h},"loadBlocklist"),xo=n(()=>{if(!p){p=new Map;for(const[e,s]of Object.entries(y()))for(const r of s)p.set(r,e)}return p},"getReverseLookup"),wo=n(e=>e.startsWith("@")?e.split("/")[1]??e:e,"bareName"),qo=n(e=>{const s=wo(e),r=xo().get(s);if(r)return{input:e,legitimate:r,method:"blocklist"};for(const o of Object.keys(y()))if(yo(o).has(s))return{input:e,legitimate:o,method:"heuristic"}},"checkTyposquat"),x=n((e,s)=>{const r=s?new Set(s):void 0,o=[];for(const a of e){if(r?.has(a))continue;const t=qo(a);t&&o.push(t)}return o},"checkTyposquats"),w=n((e,s)=>{i.warn(""),i.warn(b(`Possible typosquat${e.length===1?"":"s"} ${s}:`));for(const r of e){const o=r.method==="blocklist"?"known typosquat":"similar name";i.warn(` ${k("⚠")} ${b(r.input)} — did you mean ${k(r.legitimate)}? (${o})`)}i.warn("")},"printTyposquatWarnings"),q=n(async e=>{if(!process.stdin.isTTY){i.warn("Aborting: potential typosquat detected in non-interactive mode. Use --no-typosquat-check to skip.");return}const s=M({input:process.stdin,output:process.stdout}),r=await new Promise(o=>{s.question(e,a=>{o(a.trim().toLowerCase())})});return s.close(),r},"askConfirmation"),No=n(async(e,s)=>{if(f("typosquats"))return{ok:!0,packages:e};const r=x(e,s);if(r.length===0)return{ok:!0,packages:e};w(r,"detected");const o=await q(`Use suggested package${r.length===1?"":"s"} instead? [S]uggested / [y]es, keep original / [N]o, abort (default: N) `);if(o===void 0)return{ok:!1,packages:e};if(o==="s"||o==="suggested"){const a=new Map(r.map(t=>[t.input,t.legitimate]));return{ok:!0,packages:e.map(t=>a.get(t)??t)}}return o==="y"||o==="yes"?{ok:!0,packages:e}:{ok:!1,packages:e}},"runTyposquatCheck"),$o=/^(?:npm|pnpm|yarn):(.+?)(?:@.*)?$/,zo=n(e=>$o.exec(e)?.[1],"parseAliasTarget"),_o=n(e=>{if(!D(e))return[];const s=A(e),r={...s.dependencies,...s.devDependencies,...s.optionalDependencies,...s.peerDependencies},o=new Set;for(const[a,t]of Object.entries(r)){o.add(a);const c=zo(t);c&&o.add(c)}return[...o]},"readDepsFromPackageJson"),Po=n(async(e,s)=>{if(f("typosquats"))return!0;const r=C(e,"package.json"),o=_o(r);if(o.length===0)return!0;const a=x(o,s);if(a.length===0)return!0;w(a,"in package.json dependencies"),i.warn("Fix the package name in package.json before proceeding.");const t=await q("Continue anyway? [y/N] ");return t==="y"||t==="yes"},"scanDepsForTyposquats");export{No as r,Po as s};
|