@visulima/vis 1.0.0-alpha.21 → 1.0.0-alpha.23
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 +103 -0
- package/LICENSE.md +204 -9
- package/README.md +21 -4
- package/dashboard/dist/index.html +152 -0
- package/dist/bin.js +1 -1
- package/dist/binx.js +3 -0
- package/dist/config/index.d.ts +208 -28
- package/dist/config/index.js +1 -1
- package/dist/packem_chunks/bin.js +360 -354
- package/dist/packem_chunks/bloom-status.js +2 -0
- package/dist/packem_chunks/bloom-sync.js +2 -0
- package/dist/packem_chunks/cache-attestation.js +1 -0
- package/dist/packem_chunks/config.js +15 -15
- package/dist/packem_chunks/doctor-probe.js +2 -2
- package/dist/packem_chunks/fix.js +3 -3
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +2 -1
- package/dist/packem_chunks/handler11.js +1 -5
- package/dist/packem_chunks/handler12.js +5 -1
- package/dist/packem_chunks/handler13.js +1 -27
- package/dist/packem_chunks/handler14.js +28 -5
- package/dist/packem_chunks/handler15.js +5 -1
- 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 +4 -2
- package/dist/packem_chunks/handler20.js +1 -5
- package/dist/packem_chunks/handler21.js +5 -2
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +2 -18
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +5 -5
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +4 -4
- package/dist/packem_chunks/handler30.js +3 -3
- package/dist/packem_chunks/handler31.js +4 -4
- package/dist/packem_chunks/handler32.js +3 -3
- package/dist/packem_chunks/handler33.js +1 -1
- package/dist/packem_chunks/handler34.js +24 -24
- package/dist/packem_chunks/handler35.js +5 -3
- package/dist/packem_chunks/handler36.js +21 -6
- package/dist/packem_chunks/handler37.js +60 -21
- package/dist/packem_chunks/handler38.js +6 -428
- package/dist/packem_chunks/handler39.js +708 -6
- package/dist/packem_chunks/handler4.js +6 -8
- package/dist/packem_chunks/handler40.js +11 -11
- package/dist/packem_chunks/handler41.js +286 -10
- package/dist/packem_chunks/handler42.js +11 -11
- package/dist/packem_chunks/handler43.js +10 -25
- package/dist/packem_chunks/handler44.js +25 -24
- package/dist/packem_chunks/handler45.js +23 -212
- package/dist/packem_chunks/handler46.js +2 -2
- package/dist/packem_chunks/handler47.js +1 -1
- package/dist/packem_chunks/handler48.js +53 -46
- package/dist/packem_chunks/handler49.js +6 -6
- package/dist/packem_chunks/handler5.js +8 -1
- 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 -2
- package/dist/packem_chunks/heal-accept.js +4 -4
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +16 -16
- package/dist/packem_chunks/index.js +2 -2
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +2 -2
- package/dist/packem_chunks/loader.js +4 -1
- package/dist/packem_chunks/loader2.js +1 -0
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/status.js +2 -2
- package/dist/packem_chunks/sync.js +2 -2
- package/dist/packem_chunks/sync2.js +2 -2
- package/dist/packem_chunks/tripwire.js +2 -2
- package/dist/packem_chunks/verify-lockfile.js +2 -0
- package/dist/packem_shared/{advisories-DsynpacV.js → advisories-U1QKY_tg.js} +1 -1
- package/dist/packem_shared/{ai-analysis-uYuTIIXi.js → ai-analysis-B8pDCOuT.js} +2 -2
- package/dist/packem_shared/ai-fix-DiGSrGKv.js +43 -0
- package/dist/packem_shared/anolilab-text-CAM_E6uK.js +13 -0
- package/dist/packem_shared/applyDefaults-KxZkvlp3.js +1 -0
- package/dist/packem_shared/build-scripts-3E2pmscY.js +1 -0
- package/dist/packem_shared/cyclonedx-B293T7R0.js +4 -0
- package/dist/packem_shared/dependency-scan-BbtivycX.js +1 -0
- package/dist/packem_shared/docker-BhBBfWfc.js +60 -0
- package/dist/packem_shared/failure-log-B0Uh-65U.js +2 -0
- package/dist/packem_shared/index-C1w1GXdS.js +1 -0
- package/dist/packem_shared/index-CZX_II5N.js +29 -0
- package/dist/packem_shared/index.server-B7ETiT4C.js +2 -0
- package/dist/packem_shared/license-zZU7aavK.js +1 -0
- package/dist/packem_shared/{lifecycle-Dv3nAtoD.js → lifecycle-wRE7ymVc.js} +2 -2
- package/dist/packem_shared/{lockfile-C5DYMHVq.js → lockfile-CQLFNyVa.js} +1 -1
- package/dist/packem_shared/manifests-Z3spBpxv.js +1 -0
- package/dist/packem_shared/{min-release-age-BFozFonQ.js → min-release-age-Cz6HbF-I.js} +2 -2
- package/dist/packem_shared/{native-config-sync-Dvi1g2nQ.js → native-config-sync-BOeuyrBj.js} +5 -5
- package/dist/packem_shared/osv-bloom-CyCDpXBl.js +2 -0
- package/dist/packem_shared/pm-runner-CVliR6Ie.js +1 -0
- package/dist/packem_shared/provenance-BcldGs02.js +1 -0
- package/dist/packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js +1 -0
- package/dist/packem_shared/registry-keys-pemEkRM9.js +1 -0
- package/dist/packem_shared/resolve-explicit-2G-2HWtR.js +5 -0
- package/dist/packem_shared/runtime-check-DgXsKCsv.js +1 -0
- package/dist/packem_shared/s1ngularity-Boxkax0D.js +1 -0
- package/dist/packem_shared/scan-progress-EbvmIh4i.js +2 -0
- package/dist/packem_shared/{selectors-B2ISH581.js → selectors-BE2BCnTR.js} +1 -1
- package/dist/packem_shared/signatures-SO-fyExV.js +2 -0
- package/dist/packem_shared/toolchain-Jx2lkAYy.js +5 -0
- package/dist/packem_shared/typosquats-CioMnpnb.js +1 -0
- package/dist/packem_shared/verify-C8EAHql6.js +1 -0
- package/dist/packem_shared/{vis-update-app-CFrlJ3mW.js → vis-update-app-BWA1kA1q.js} +1 -1
- package/index.d.ts +78 -0
- package/index.js +57 -53
- package/package.json +34 -13
- package/schemas/project.schema.json +37 -7
- package/schemas/vis-config.schema.json +2395 -1996
- package/dist/packem_shared/ai-cache-DuwHYx2O.js +0 -1
- package/dist/packem_shared/ai-fix-DzrA-dVz.js +0 -43
- package/dist/packem_shared/applyDefaults-BOVDw1jD.js +0 -1
- package/dist/packem_shared/build-scripts-DsWMSWDs.js +0 -1
- package/dist/packem_shared/cache-directory-DQak1Vjc.js +0 -1
- package/dist/packem_shared/cyclonedx-CiHXuG8M.js +0 -4
- package/dist/packem_shared/dependency-scan-DC3nAFHS.js +0 -1
- package/dist/packem_shared/docker-B-CIN_nj.js +0 -60
- package/dist/packem_shared/failure-log-C3LEMmkq.js +0 -2
- package/dist/packem_shared/flakiness-Dq6K4ymq.js +0 -1
- package/dist/packem_shared/manifests-B0fMp872.js +0 -1
- package/dist/packem_shared/registry-keys-CewRFW0e.js +0 -1
- package/dist/packem_shared/resolve-explicit-CC4Kifk5.js +0 -5
- package/dist/packem_shared/run-summary-utils-BaBGP3bo.js +0 -1
- package/dist/packem_shared/runtime-check-BusAwPb2.js +0 -1
- package/dist/packem_shared/scan-progress-CMynp3eA.js +0 -2
- package/dist/packem_shared/signatures-5ZdjJ2Pu.js +0 -2
- package/dist/packem_shared/toolchain-Cc3cwyLP.js +0 -5
- package/dist/packem_shared/typosquats-BCeR-sLf.js +0 -1
- package/dist/packem_shared/verify-07kUNTuP.js +0 -1
- package/dist/packem_shared/xxh3-DrAUNq4n.js +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var Vn=Object.defineProperty;var E=(t,e)=>Vn(t,"name",{value:e,configurable:!0});import{createRequire as Un}from"node:module";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
+
const Dn=Un(import.meta.url),pe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Bn=E(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 Dn(t)},"__cjs_getBuiltinModule"),{createRequire:He}=Bn("node:module"),Rn=16,et=32,zn=64,ie=128,$e="positionals";var Wn=Object.defineProperty,kt=E((t,e)=>Wn(t,"name",{value:e,configurable:!0}),"i$9"),Fn=Object.defineProperty,_t=kt((t,e)=>Fn(t,"name",{value:e,configurable:!0}),"s"),qn=Object.defineProperty,Lt=_t((t,e)=>qn(t,"name",{value:e,configurable:!0}),"s"),Gn=Object.defineProperty,St=Lt((t,e)=>Gn(t,"name",{value:e,configurable:!0}),"i"),Hn=Object.defineProperty,Tt=St((t,e)=>Hn(t,"name",{value:e,configurable:!0}),"t");Tt(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");let Jn=class extends Error{static{E(this,"V")}static{kt(this,"g")}static{_t(this,"p")}static{Lt(this,"V")}static{St(this,"VisulimaError")}static{Tt(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:i,message:o,name:r,stack:l,title:s}){super(o,{cause:e}),this.title=s,this.name=r,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 Kn=Object.defineProperty,It=E((t,e)=>Kn(t,"name",{value:e,configurable:!0}),"t$7"),Yn=Object.defineProperty,Mt=It((t,e)=>Yn(t,"name",{value:e,configurable:!0}),"t"),Zn=Object.defineProperty,Xn=Mt((t,e)=>Zn(t,"name",{value:e,configurable:!0}),"e");let j=class extends Jn{static{E(this,"m")}static{It(this,"u")}static{Mt(this,"c")}static{Xn(this,"CerebroError")}code;context;constructor(e,n,i){super({message:e,name:"CerebroError"}),this.code=n,this.context=i}};var Qn=Object.defineProperty,ei=E((t,e)=>Qn(t,"name",{value:e,configurable:!0}),"a$2"),ti=Object.defineProperty,ni=ei((t,e)=>ti(t,"name",{value:e,configurable:!0}),"l"),ii=Object.defineProperty,S=ni((t,e)=>ii(t,"name",{value:e,configurable:!0}),"r");const U=S(t=>"Deno"in t,"hasDeno"),D=S(t=>"Bun"in t,"hasBun"),Pe=S(()=>{if(U(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"),ri=S(()=>U(globalThis)?globalThis.Deno.cwd():D(globalThis)?globalThis.Bun.process.cwd():process.cwd(),"getCwd"),G=S(()=>{if(U(globalThis)){const t=globalThis.Deno;return new Proxy(t.env.toObject(),{get:S((e,n)=>typeof n=="string"?t.env.get(n):e[n],"get"),has:S((e,n)=>typeof n=="string"?t.env.has(n):n in e,"has"),set:S((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"),Vt=S(()=>U(globalThis)?[]:D(globalThis)?globalThis.Bun.process.execArgv:process.execArgv,"getExecArgv"),Ut=S(()=>U(globalThis)?globalThis.Deno.execPath():D(globalThis)?globalThis.Bun.process.execPath:process.execPath,"getExecPath");S(()=>{if(U(globalThis)){const t=globalThis.Deno.build?.os??"unknown";return t==="windows"?"win32":t}return D(globalThis)?globalThis.Bun.platform??"unknown":process.platform},"getPlatform");S(()=>{if(U(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");S(()=>{if(U(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 q=S((t=0)=>{if(U(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=S((t,e)=>{if(U(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 oi=Object.defineProperty,Ee=E((t,e)=>oi(t,"name",{value:e,configurable:!0}),"k$1");const z=new Uint32Array(65536),ai=Ee((t,e)=>{const n=t.length,i=e.length,o=1<<n-1;let r=-1,l=0,s=n,p=n;for(;p--;)z[t.charCodeAt(p)]|=1<<p;for(p=0;p<i;p++){let a=z[e.charCodeAt(p)];const c=a|l;a|=(a&r)+r^r,l|=~(a|r),r&=a,l&o&&s++,r&o&&s--,l=l<<1|1,r=r<<1|~(c|l),l&=c}for(p=n;p--;)z[t.charCodeAt(p)]=0;return s},"myers_32"),si=Ee((t,e)=>{const n=e.length,i=t.length,o=[],r=[],l=Math.ceil(n/32),s=Math.ceil(i/32);for(let u=0;u<l;u++)r[u]=-1,o[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++)z[t.charCodeAt(O)]|=1<<O;for(let O=0;O<n;O++){const A=z[e.charCodeAt(O)],d=r[O/32|0]>>>O&1,m=o[O/32|0]>>>O&1,b=A|u,$=((A|m)&v)+v^v|A|m;let P=u|~($|v),k=v&$;P>>>31^d&&(r[O/32|0]^=1<<O),k>>>31^m&&(o[O/32|0]^=1<<O),P=P<<1|d,k=k<<1|m,v=k|~(b|P),u=P&b}for(let O=w;O<y;O++)z[t.charCodeAt(O)]=0}let a=0,c=-1;const h=p*32,f=Math.min(32,i-h)+h;for(let u=h;u<f;u++)z[t.charCodeAt(u)]|=1<<u;let g=i;for(let u=0;u<n;u++){const v=z[e.charCodeAt(u)],w=r[u/32|0]>>>u&1,y=o[u/32|0]>>>u&1,O=v|a,A=((v|y)&c)+c^c|v|y;let d=a|~(A|c),m=c&A;g+=d>>>i-1&1,g-=m>>>i-1&1,d>>>31^w&&(r[u/32|0]^=1<<u),m>>>31^y&&(o[u/32|0]^=1<<u),d=d<<1|w,m=m<<1|y,c=m|~(O|d),a=d&O}for(let u=h;u<f;u++)z[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?ai(t,e):si(t,e)},"distance");Ee((t,e)=>{let n=1/0,i=0;for(let o=0;o<e.length;o++){const r=Dt(t,e[o]);r<n&&(n=r,i=o)}return e[i]},"closest");var li=Object.defineProperty,ci=E((t,e)=>li(t,"name",{value:e,configurable:!0}),"p$4"),ui=Object.defineProperty,Bt=ci((t,e)=>ui(t,"name",{value:e,configurable:!0}),"e"),pi=Object.defineProperty,fi=Bt((t,e)=>pi(t,"name",{value:e,configurable:!0}),"E");const Rt=String.raw,nt=Rt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,di=fi(()=>new RegExp(Rt`\p{RI}{2}|(?)${nt}(?:\u200D${nt})*`,"gu"),"default");var hi=Object.defineProperty,mi=Bt((t,e)=>hi(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 Pc=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,xc=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,ae=di(),gi=/[-_./\s]+/g,me=/(\u001B\[[0-9;]*[a-z])/i,it=new RegExp("\\p{Script=Arabic}","u"),vi=new RegExp("\\p{Script=Bengali}","u"),Q=new RegExp("\\p{Script=Cyrillic}","u"),bi=new RegExp("\\p{Script=Devanagari}","u"),yi=new RegExp("\\p{Script=Ethiopic}","u"),Ve=new RegExp("\\p{Script=Greek}","u"),rt=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),wi=new RegExp("\\p{Script=Gujarati}","u"),$i=new RegExp("\\p{Script=Gurmukhi}","u"),ot=new RegExp("\\p{Script=Hangul}","u"),at=new RegExp("\\p{Script=Hebrew}","u"),Oi=new RegExp("\\p{Script=Hiragana}","u"),st=new RegExp("\\p{Script=Han}","u"),Pi=new RegExp("\\p{Script=Kannada}","u"),xi=new RegExp("\\p{Script=Katakana}","u"),Ei=new RegExp("\\p{Script=Khmer}","u"),Ai=new RegExp("\\p{Script=Lao}","u"),I=new RegExp("\\p{Script=Latin}","u"),Ni=new RegExp("\\p{Script=Malayalam}","u"),ji=new RegExp("\\p{Script=Myanmar}","u"),Ci=new RegExp("\\p{Script=Oriya}","u"),ki=new RegExp("\\p{Script=Sinhala}","u"),_i=new RegExp("\\p{Script=Tamil}","u"),Li=new RegExp("\\p{Script=Telugu}","u"),Si=new RegExp("\\p{Script=Thai}","u"),Ti=new RegExp("\\p{Script=Tibetan}","u"),lt=/[\u02BB\u02BC\u0027]/u,Ii=mi(t=>t.replace(ae,""),"stripEmoji");var Mi=Object.defineProperty,zt=E((t,e)=>Mi(t,"name",{value:e,configurable:!0}),"i$6"),Vi=Object.defineProperty,Wt=zt((t,e)=>Vi(t,"name",{value:e,configurable:!0}),"r"),Ui=Object.defineProperty,Di=Wt((t,e)=>Ui(t,"name",{value:e,configurable:!0}),"c");let Ft=class{static{E(this,"l")}static{zt(this,"y")}static{Wt(this,"s")}static{Di(this,"LRUCache")}capacity;cache;keyOrder;constructor(e){this.capacity=e,this.cache=new Map,this.keyOrder=[]}get(e){if(this.cache.has(e))return this.keyOrder=this.keyOrder.filter(n=>n!==e),this.keyOrder.push(e),this.cache.get(e)}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.keyOrder=this.keyOrder.filter(i=>i!==e);else if(this.cache.size>=this.capacity){const i=this.keyOrder.shift();i!==void 0&&this.cache.delete(i)}this.cache.set(e,n),this.keyOrder.push(e)}delete(e){this.cache.delete(e),this.keyOrder=this.keyOrder.filter(n=>n!==e)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var Bi=Object.defineProperty,Ri=E((t,e)=>Bi(t,"name",{value:e,configurable:!0}),"r$5"),zi=Object.defineProperty,Wi=Ri((t,e)=>zi(t,"name",{value:e,configurable:!0}),"a"),Fi=Object.defineProperty,qi=Wi((t,e)=>Fi(t,"name",{value:e,configurable:!0}),"s");const Gi=qi((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleLowerCase(e.locale):t[0].toLowerCase())+t.slice(1),"lowerFirst");var Hi=Object.defineProperty,Ji=E((t,e)=>Hi(t,"name",{value:e,configurable:!0}),"I$2"),Ki=Object.defineProperty,Ae=Ji((t,e)=>Ki(t,"name",{value:e,configurable:!0}),"W");const Yi=He(import.meta.url),fe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Zi=Ae(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 Yi(t)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Xi}=Zi("node:util");var Qi=Object.defineProperty,er=Ae((t,e)=>Qi(t,"name",{value:e,configurable:!0}),"g");const Ue=new Ft(1e3),tr=/[.*+?^${}()|[\]\\]/g,nr=er(t=>{const e=t.join("");if(Ue.has(e))return Ue.get(e);const n=t.map(o=>o.replaceAll(tr,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return Ue.set(e,i),i},"getSeparatorsRegex");var ir=Object.defineProperty,rr=Ae((t,e)=>ir(t,"name",{value:e,configurable:!0}),"t");const or=rr(t=>{const e=[];let n=0,i;for(ae.lastIndex=0;(i=ae.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=ae.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},"splitByEmoji");var ar=Object.defineProperty,C=Ae((t,e)=>ar(t,"name",{value:e,configurable:!0}),"u");const sr=/[ČŠŽĐ]/i,qt=new Uint8Array(128),Gt=new Uint8Array(128),Ht=new Uint8Array(128);for(let t=0;t<128;t++)qt[t]=t>=65&&t<=90?1:0,Gt[t]=t>=97&&t<=122?1:0,Ht[t]=t>=48&&t<=57?1:0;const De=C(t=>qt[t],"isUpper"),ct=C(t=>Gt[t],"isLower"),Be=C(t=>Ht[t],"isDigit"),F=C((t,e,n,i,o)=>{if(t.length===0)return[];let r=!1;const l=Object.values(e);for(const g of l)if(g(t[0])){r=!0;break}if(!r&&!n)return[t];const s=[...t],p=[];let a=s[0],c="other";const h=Object.entries(e);for(const g of h){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 h){const[A,d]=O;if(d(u)){v=A;break}}const w=n&&i?u===u.toLocaleUpperCase(i):!1;let y=!1;o?y=o(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"),lr=C((t,e,n,i)=>{if(n.size===0)return e;for(const o of n)if(t.startsWith(o,e))return i.push(o),e+o.length;return e},"detectAndProcessAcronym"),Jt=C((t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const i=[],o=t.length;for(let r=1;r<o;r++){const l=lr(t,n,e,i);if(l!==n){n=l,r=n-1;continue}const s=t.codePointAt(r-1),p=t.codePointAt(r),a=s&&s<128&&De(s),c=p&&p<128&&De(p),h=s&&s<128&&ct(s),f=s&&s<128&&Be(s),g=p&&p<128&&Be(p);if(h&&c){i.push(t.slice(n,r)),n=r;continue}if(f&&!g||!f&&g){i.push(t.slice(n,r)),n=r;continue}if(g&&!f){let u=!1,v=!1;if(r+1<o){const w=t.codePointAt(r+1);u=w&&w<128&&De(w),v=w&&w<128&&Be(w)}if(!v&&u){i.push(t.slice(n,r),t.slice(r,r+1)),n=r+1;continue}}if(r+1<o){const u=t.codePointAt(r+1),v=u&&u<128&&ct(u);if(a&&c&&v){const w=t.slice(n,r+1);e.has(w)||(i.push(t.slice(n,r)),n=r)}}}return n<o&&i.push(t.slice(n)),i.filter(r=>r!=="")},"splitCamelCaseFast"),Kt=C((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,h=[];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&&(h.push(f),f=y),u=!0,v=w;else{if(u&&w-v>1){const A=a[w-1],d=f.slice(0,-1);d&&d.length>0&&h.push(d),f=A+y}else f+=y;u=!1,v=-1}g=O}return f&&f.length>0&&h.push(f),h}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!Q.test(t)&&!I.test(t))return[t];const a=[...t],c=a.length,h=[];let f=a[0];const g=a[0];let u;Q.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;Q.test(O)?A=1:I.test(O)?A=2:A=0;const d=O===O.toLocaleUpperCase(e);u!==A&&(u===1||u===2)&&(A===1||A===2)||A===u&&!v&&d?(h.push(f),f=O):f+=O,u=A,v=d}f&&f.length>0&&h.push(f);const w=[];for(let y=0;y<h.length;y++)y<h.length-1&&h[y].length===1&&I.test(h[y])&&Q.test(h[y+1][0])?(w.push(h[y]+h[y+1]),y+=1):w.push(h[y]);return w}if(e.startsWith("el")){if(!Ve.test(t)&&!I.test(t))return[t];const a=[];rt.lastIndex=0;let c;for(;(c=rt.exec(t))!==null;)a.push(c[0]);a.length===0&&a.push(t);const h=[];if(a.length===1){const f=a[0];if(!f||!Ve.test(f[0])||f.length===1)return[f??t]}for(const f of a){if(!f)continue;if(!Ve.test(f[0])||f.length===1){h.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?(h.push(u),u=y):u+=y,v=O}u&&h.push(u)}return h}if(e.startsWith("ja")||e.startsWith("ko")){const a=e.startsWith("ja"),c=a?{hiragana:C(f=>Oi.test(f),"hiragana"),kanji:C(f=>st.test(f),"kanji"),katakana:C(f=>xi.test(f),"katakana"),latin:C(f=>I.test(f),"latin")}:{hangul:C(f=>ot.test(f),"hangul"),latin:C(f=>I.test(f),"latin")},h=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(a){const f=F(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&&h.has(v)&&g.length>0?g[g.length-1]=g.at(-1)+v:g.push(v)}return g.length>0?g:[t]}return F(t,c,!1,e,(f,g)=>f==="hangul"&&g==="latin"||f==="latin"&&g==="hangul")}if(e.startsWith("sl")){const a=[...t],c=a.length,h=[];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=sr.test(v),O=u<c-1&&a[u+1]===a[u+1].toLocaleUpperCase(e);!g&&w||y&&O?(h.push(f),f=v,y&&O&&(h.push(f),f="")):f+=v,g=w}return f&&f.length>0&&h.push(f),h}if(e.startsWith("zh"))return F(t,{han:C(a=>st.test(a),"han"),latin:C(a=>I.test(a),"latin")},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const a=C(c=>at.test(c)||it.test(c),"isRtlChar");return F(t,{latin:C(c=>I.test(c),"latin"),rtl:C(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=C(c=>bi.test(c)||vi.test(c)||wi.test(c)||$i.test(c)||Pi.test(c)||_i.test(c)||Li.test(c)||Ni.test(c)||ki.test(c)||Si.test(c)||Ai.test(c)||Ti.test(c)||ji.test(c)||yi.test(c)||Ei.test(c)||Ci.test(c),"isIndicChar");return F(t,{indic:C(c=>a(c),"indic"),latin:C(c=>I.test(c),"latin")},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return F(t,{cyrillic:C(a=>Q.test(a),"cyrillic"),latin:C(a=>I.test(a),"latin")},!0,e);if(["ar","fa","he"].includes(e))return F(t,{latin:C(a=>I.test(a),"latin"),rtl:C(a=>at.test(a)||it.test(a),"rtl")},!1,e);if(e.startsWith("ko"))return F(t,{hangul:C(a=>ot.test(a),"hangul"),latin:C(a=>I.test(a),"latin")},!1,e);if(e.startsWith("uz")){if(!Q.test(t)&&!I.test(t))return[t];const a=[...t],c=a.length,h=[];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?(h.push(f),f=v):f+=v,g=w}return f&&f.length>0&&h.push(f),h}const o=[...t],r=o.length,l=[];let s=o[0],p=o[0]===o[0].toLocaleUpperCase(e);for(const a of n)if(t.startsWith(a)){l.push(a),s=o[a.length],p=s===s.toLocaleUpperCase(e);break}for(let a=1;a<r;a++){const c=o[a],h=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&&h?(l.push(s),s=c):s+=c,p=h}return s&&l.push(s),l},"splitCamelCaseLocale"),cr=C((t,e,n)=>{const i=[],o=me.test(t)?t.split(me).filter(Boolean):[t];for(const r of o){const l=r;if(me.test(l))i.push(l);else{const s=ae.test(l)?or(l).filter(Boolean):[l];for(const p of s)if(ae.test(p))i.push(p);else if(e){const a=e.toLowerCase().split("-")[0];i.push(...Kt(p,a,n))}else i.push(...Jt(p,n))}}return i},"processTextWithAnsiEmoji"),ur=C((t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:o=[],locale:r,normalize:l=!1,separators:s,stripAnsi:p=!1,stripEmoji:a=!1}=e,c=new Set([...o].toSorted((y,O)=>O.length-y.length));let h=t;p&&(h=Xi(h)),a&&(h=Ii(h));let f;Array.isArray(s)?f=nr(s):s instanceof RegExp?f=s:f=gi;const g=[];let u=h;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],d=A.length,m=u.slice(0,O),b=u.slice(O+d);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=h.split(f).filter(Boolean);g.push(...y)}let w=[];for(const y of g)n||i?w.push(...cr(y,r,c)):r?w.push(...Kt(y,r,c)):w.push(...Jt(y,c));return l&&(w=w.map(y=>c.has(y)?y:r&&y===y.toLocaleUpperCase(r)?y[0]+y.slice(1).toLocaleLowerCase(r):y.toUpperCase()===y&&!c.has(y)?y.slice(0,1)+y.slice(1).toLowerCase():y)),w},"splitByCase");var pr=Object.defineProperty,fr=E((t,e)=>pr(t,"name",{value:e,configurable:!0}),"r$4"),dr=Object.defineProperty,hr=fr((t,e)=>dr(t,"name",{value:e,configurable:!0}),"o"),mr=Object.defineProperty,gr=hr((t,e)=>mr(t,"name",{value:e,configurable:!0}),"s");const vr=gr((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),"upperFirst");var br=Object.defineProperty,yr=E((t,e)=>br(t,"name",{value:e,configurable:!0}),"r$3"),wr=Object.defineProperty,$r=yr((t,e)=>wr(t,"name",{value:e,configurable:!0}),"r"),Or=Object.defineProperty,Pr=$r((t,e)=>Or(t,"name",{value:e,configurable:!0}),"n");const xr=Pr((t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}`,"generateCacheKey");var Er=Object.defineProperty,Ar=E((t,e)=>Er(t,"name",{value:e,configurable:!0}),"i$4"),Nr=Object.defineProperty,jr=Ar((t,e)=>Nr(t,"name",{value:e,configurable:!0}),"f"),Cr=Object.defineProperty,kr=jr((t,e)=>Cr(t,"name",{value:e,configurable:!0}),"l");const _r=kr((t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let o="",r="";for(let l=0;l<n;l++){const s=t[l];if(me.test(s)){o?(i.push(o+r+s),o="",r=""):(i.length>0&&i.push(e),o=s);continue}o?(r&&(r+=e),r+=s):(i.length>0&&i.push(e),i.push(s))}return i.join("")},"joinSegments");var Lr=Object.defineProperty,Sr=E((t,e)=>Lr(t,"name",{value:e,configurable:!0}),"r$2"),Tr=Object.defineProperty,Ir=Sr((t,e)=>Tr(t,"name",{value:e,configurable:!0}),"a"),Mr=Object.defineProperty,Vr=Ir((t,e)=>Mr(t,"name",{value:e,configurable:!0}),"e");const Ur=/(?<![a-zß])SS(?![a-z])/g,Dr=Vr(t=>t.replaceAll(Ur,"ß"),"normalizeGermanEszett");var Br=Object.defineProperty,Rr=E((t,e)=>Br(t,"name",{value:e,configurable:!0}),"c$1"),zr=Object.defineProperty,Wr=Rr((t,e)=>zr(t,"name",{value:e,configurable:!0}),"c"),Fr=Object.defineProperty,qr=Wr((t,e)=>Fr(t,"name",{value:e,configurable:!0}),"o");const Gr=new Ft(1e3),Yt=qr((t,e)=>{if(typeof t!="string"||!t)return"";const n=e?.cache??!1,i=e?.cacheStore??Gr;let o;if(n&&(o=xr(t,e)),n&&o&&i.has(o))return i.get(o);let r=!0;const l=_r(ur(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&&me.test(s))return s;const p=e?.locale?.startsWith("de")?Dr(s):s,a=e?.locale?p.toLocaleLowerCase(e.locale):p.toLowerCase();return r?(r=!1,Gi(a,e)):vr(a,e)}),"");return n&&o&&i.set(o,l),l},"camelCase");var Hr=Object.defineProperty,T=E((t,e)=>Hr(t,"name",{value:e,configurable:!0}),"_$2"),Jr=Object.defineProperty,x=T((t,e)=>Jr(t,"name",{value:e,configurable:!0}),"h");const be=[{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 Kr=Object.defineProperty,Yr=x((t,e)=>Kr(t,"name",{value:e,configurable:!0}),"t$5");let ee=class extends j{static{E(this,"S")}static{T(this,"T")}static{x(this,"a")}static{Yr(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 Zr=Object.defineProperty,Xr=x((t,e)=>Zr(t,"name",{value:e,configurable:!0}),"e$7");let Zt=class extends j{static{E(this,"De")}static{T(this,"Te")}static{x(this,"o")}static{Xr(this,"ConflictingOptionsError")}option1;option2;constructor(e,n){super(`Options "${e}" and "${n}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:e,option2:n}),this.name="ConflictingOptionsError",this.option1=e,this.option2=n,this.hint=`Remove either --${e} or --${n}`}};var Qr=Object.defineProperty,eo=x((t,e)=>Qr(t,"name",{value:e,configurable:!0}),"e$6");let to=class extends j{static{E(this,"At")}static{T(this,"Ot")}static{x(this,"o")}static{eo(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 no=Object.defineProperty,ut=x((t,e)=>no(t,"name",{value:e,configurable:!0}),"d$4");let io=class{static{E(this,"$t")}static{T(this,"At")}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`);G().CEREBRO_OUTPUT_LEVEL===String(ie)&&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 o=new to(n.name,`Failed to initialize: ${i instanceof Error?i.message:String(i)}`,i instanceof Error?i:void 0);throw this.logger.error(o.message),o}}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 o of i){const r=o[t];if(typeof r=="function"){this.logger.debug(`executing ${t} hook for plugin: ${o.name}`);try{await(t==="afterCommand"?r(e,n):r(e))}catch(l){throw this.logger.error(`Error in ${t} hook for plugin "${o.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(o){this.logger.error(`Error in error handler for plugin "${i.name}":`,o)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const t=[],e=new Set,n=new Set,i=ut(o=>{if(e.has(o))return;if(n.has(o))throw new Error(`Circular dependency detected involving plugin "${o}"`);const r=this.plugins.get(o);if(!r)throw new Error(`Plugin "${o}" not found`);if(n.add(o),r.dependencies)for(const l of r.dependencies)i(l);n.delete(o),e.add(o),t.push(r)},"visit");for(const o of this.plugins.keys())i(o);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 ro=Object.defineProperty,oo=x((t,e)=>ro(t,"name",{value:e,configurable:!0}),"n$8");const ge=oo(t=>t.type?.name==="Boolean","optionIsBoolean");var ao=Object.defineProperty,Xt=x((t,e)=>ao(t,"name",{value:e,configurable:!0}),"p$6");const so=Xt(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=Xt(t=>(ge(t)||(t.typeLabel=t.typeLabel??so(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),"mapOptionTypeLabel");var lo=Object.defineProperty,Qt=x((t,e)=>lo(t,"name",{value:e,configurable:!0}),"e$4");const co=new RegExp(/^-([^\d-])$/),uo=new RegExp(/^--(\S+)/),po=new RegExp(/^-([^\d-]{2,})$/),fo=Qt(t=>co.test(t)||uo.test(t)||po.test(t),"isOption"),ho=Qt((t,e)=>{const n=e[0]&&fo(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 mo=Object.defineProperty,en=x((t,e)=>mo(t,"name",{value:e,configurable:!0}),"i$7"),go=Object.defineProperty,tn=en((t,e)=>go(t,"name",{value:e,configurable:!0}),"i"),vo=Object.defineProperty,nn=tn((t,e)=>vo(t,"name",{value:e,configurable:!0}),"s"),bo=Object.defineProperty,rn=nn((t,e)=>bo(t,"name",{value:e,configurable:!0}),"i"),yo=Object.defineProperty,on=rn((t,e)=>yo(t,"name",{value:e,configurable:!0}),"t");on(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");class Ne extends Error{static{E(this,"te")}static{T(this,"ee")}static{x(this,"v")}static{en(this,"g")}static{tn(this,"p")}static{nn(this,"V")}static{rn(this,"VisulimaError")}static{on(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:i,message:o,name:r,stack:l,title:s}){super(o,{cause:e}),this.title=s,this.name=r,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 wo=Object.defineProperty,an=x((t,e)=>wo(t,"name",{value:e,configurable:!0}),"o$7"),$o=Object.defineProperty,sn=an((t,e)=>$o(t,"name",{value:e,configurable:!0}),"o"),Oo=Object.defineProperty,Po=sn((t,e)=>Oo(t,"name",{value:e,configurable:!0}),"i");let xo=class ln extends Ne{static{E(this,"He")}static{T(this,"He")}static{x(this,"a")}static{an(this,"a")}static{sn(this,"t")}static{Po(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,ln.prototype)}};var Eo=Object.defineProperty,cn=x((t,e)=>Eo(t,"name",{value:e,configurable:!0}),"t$3"),Ao=Object.defineProperty,un=cn((t,e)=>Ao(t,"name",{value:e,configurable:!0}),"e"),No=Object.defineProperty,jo=un((t,e)=>No(t,"name",{value:e,configurable:!0}),"e");let ft=class pn extends Ne{static{E(this,"Je")}static{T(this,"Je")}static{x(this,"n")}static{cn(this,"n")}static{un(this,"o")}static{jo(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,pn.prototype)}};var Co=Object.defineProperty,fn=x((t,e)=>Co(t,"name",{value:e,configurable:!0}),"a$9"),ko=Object.defineProperty,dn=fn((t,e)=>ko(t,"name",{value:e,configurable:!0}),"a"),_o=Object.defineProperty,Lo=dn((t,e)=>_o(t,"name",{value:e,configurable:!0}),"o");let So=class hn extends Ne{static{E(this,"Xe")}static{T(this,"Xe")}static{x(this,"n")}static{fn(this,"o")}static{dn(this,"e")}static{Lo(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,hn.prototype)}};var To=Object.defineProperty,mn=x((t,e)=>To(t,"name",{value:e,configurable:!0}),"i$4"),Io=Object.defineProperty,gn=mn((t,e)=>Io(t,"name",{value:e,configurable:!0}),"i"),Mo=Object.defineProperty,Vo=gn((t,e)=>Mo(t,"name",{value:e,configurable:!0}),"i");let M=class vn extends Ne{static{E(this,"nt")}static{T(this,"nt")}static{x(this,"a")}static{mn(this,"o")}static{gn(this,"e")}static{Vo(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,vn.prototype)}};var Uo=Object.defineProperty,Do=x((t,e)=>Uo(t,"name",{value:e,configurable:!0}),"z"),Bo=Object.defineProperty,le=Do((t,e)=>Bo(t,"name",{value:e,configurable:!0}),"S"),Ro=Object.defineProperty,je=le((t,e)=>Ro(t,"name",{value:e,configurable:!0}),"o");const dt=je(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),ht=je(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),mt=je(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),zo=je((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 Wo=Object.defineProperty,Fo=le((t,e)=>Wo(t,"name",{value:e,configurable:!0}),"e");const L=Fo((t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},"debug");var qo=Object.defineProperty,Z=le((t,e)=>qo(t,"name",{value:e,configurable:!0}),"h$1");const Go=/-([a-z])/g,Ho=/^\d+$/,Re=Z(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),Jo=Z(t=>t.codePointAt(0)===95,"isSpecialKey"),gt=Z((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),vt=Z(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),bt=Z((t,e,n,i=!1)=>{t[e]===void 0?t[e]=i?[n]:n:i&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},"createOrAppendArray"),Ko=Z((t,e,n,i,o)=>{let r=e.get(t)??n.get(t);if(!r&&i){const l=t.toLowerCase();r=i.get(l)??o?.get(l)}return r},"getDefinition"),Yo=Z((t,e,n,i)=>{const o=n.debug??!1;L(o,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),L(o,"Starting argument resolution","resolver"),L(o,"Tokens:","resolver",t),L(o,"Definitions:","resolver",e),L(o,"Processing tokens...","resolver");const r=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 d of e)if(r.set(d.name,d),d.alias&&l.set(d.alias,d),n.caseInsensitive&&s&&(s.set(d.name.toLowerCase(),d),d.alias&&p&&p.set(d.alias.toLowerCase(),d)),n.camelCase&&a&&c){const m=d.name.replaceAll(Go,(b,$)=>$.toUpperCase());a.set(d.name,m),c.set(m,d.name)}const h={},f={},g=[],u=new Set;let v=!1;const w=e.find(d=>d.defaultOption),y=e.some(d=>d.group),O=e.some(d=>d.type===Number);for(let d=0;d<t.length;d++){const m=t[d];if(m.kind==="option-terminator"){h._unknown=i.slice(m.index),v=!0;break}if(m.kind==="option"&&m.name){let b=Ko(m.name,r,l,s,p);if(!b&&m.value===void 0&&O&&Ho.test(m.name)){const N=e.find(B=>B.type===Number);N&&(b=N,m.value=m.name,m.name=N.name)}const $=b?b.name:m.name,P=b?.multiple,k=b?.lazyMultiple;if(f[$]!==void 0&&!P&&!k&&!n.partial)throw new xo($);if(!b&&n.partial){const N=m.rawName??`--${m.name}${m.value!==void 0&&m.inlineValue?`=${m.value}`:""}`;g.push({index:m.index,value:N});continue}if(!b&&n.stopAtFirstUnknown){h._unknown=i.slice(m.index);break}if(!b&&!n.partial)throw new ft(m.name);if(m.value===void 0){const N=t[d+1],B=N?.kind==="option"&&!("name"in N)&&N.value!==void 0,V=N&&b&&!(b.type&&Re(b.type))&&(N.kind==="positional"||B),Mn=b&&b.defaultOption&&!b.multiple&&!b.lazyMultiple;if(V&&(!b?.defaultOption||Mn))if(P){let R=d+1;const Me=[];for(;R<t.length&&(t[R].kind==="positional"||t[R].kind==="option"&&!("name"in t[R])&&t[R].value!==void 0);)Me.push(t[R].value),u.add(t[R].index),R++;f[$]=f[$]===void 0?Me:gt(f[$],Me),d=R-1}else k?(bt(f,$,N.value,!0),u.add(N.index),d++):(f[$]=N.value,u.add(N.index),d++);else b?.type&&Re(b.type)?bt(f,$,!0,P):f[$]=P?[]:null}else{let{value:N}=m;if(b?.type&&Re(b.type))switch(N){case"":{if(n.partial)f._unknown??=[],f._unknown.push(`${m.rawName??`--${m.name}`}${m.value?`=${m.value}`:""}`),N=!0;else throw new ft(m.name);break}case"false":{N=!1;break}case"true":{N=!0;break}default:N=!0}const B=[N];if(P){let V=d+1;for(;V<t.length&&t[V].kind==="positional";)B.push(t[V].value),u.add(t[V].index),V++;d=V-1}f[$]===void 0?f[$]=P||k?B:N:P||k?f[$]=gt(f[$],B):f[$]=N}}else if(m.kind==="positional"&&n.stopAtFirstUnknown&&!u.has(m.index)&&!w){L(o,`Found unconsumed positional token at index ${String(m.index)}, stopping processing`,"resolver"),h._unknown=i.slice(m.index);break}}for(const[d,m]of Object.entries(f)){const b=r.get(d);b&&(b.multiple||b.lazyMultiple)&&!Array.isArray(m)&&(f[d]=[m])}let A=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!v){for(const d of t)if(d.kind==="option"&&!r.has(d.name??"")&&!l.has(d.name??"")&&(!n.caseInsensitive||!s?.has(d.name?.toLowerCase()??"")&&!p?.has(d.name?.toLowerCase()??""))){A=d.index;break}}if(w){const d=[],m=[];for(const b of t)b.kind==="positional"&&!u.has(b.index)&&b.index<A&&(d.push(b.value),m.push(b));if(d.length>0){const b=f[w.name],$=w.multiple??w.lazyMultiple;b===void 0?$?(m.forEach(P=>u.add(P.index)),f[w.name]=d):(u.add(m[0].index),f[w.name]=d[0]):$&&(m.forEach(P=>u.add(P.index)),f[w.name]=Array.isArray(b)?[...d,...b]:[...d,b])}}if(!n.partial){for(const d of t)if(d.kind==="positional"&&!u.has(d.index))throw new So(i[d.index])}if(n.partial&&!n.stopAtFirstUnknown){const d=[...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&&d.push({index:$,value:b})}}for(const m of t)m.kind==="positional"&&!u.has(m.index)&&d.push({index:m.index,value:i[m.index]});d.length>0&&(d.sort((m,b)=>m.index-b.index),h._unknown=d.map(m=>m.value))}if(n.stopAtFirstUnknown&&!v){const d=t.findIndex($=>$.kind==="option"&&!r.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(d!==-1&&m!==-1?b=Math.min(d,m):d!==-1?b=d:m!==-1&&(b=m),b>=0){const $=t[b].index;h._unknown=i.slice($)}}else g.length>0&&!n.partial&&(h._unknown=g.map(d=>d.value));for(const[d,m]of Object.entries(f)){const b=n.camelCase?a?.get(d)??d:d,$=r.get(d);h[b]=$?.type?zo(m,$.type):m===void 0?null:m}for(const d of e){const m=n.camelCase?a?.get(d.name)??d.name:d.name;!(m in h)&&d.defaultValue!==void 0&&(d.multiple??d.lazyMultiple?h[m]=Array.isArray(d.defaultValue)?[...d.defaultValue]:[d.defaultValue]:h[m]=d.defaultValue)}if(y){const d={},m={},b={};for(const P of e)if(P.group){const k=Array.isArray(P.group)?P.group:[P.group];for(const N of k)vt(N)||(d[N]??={})}for(const P of Object.keys(h))if(!Jo(P)){m[P]=h[P];let k=P;n.camelCase&&(k=c?.get(P)??P);const N=r.get(k);if(N?.group){const B=Array.isArray(N.group)?N.group:[N.group];for(const V of B)vt(V)||d[V]&&(d[V][P]=h[P])}else b[P]=h[P]}const $={_all:m};for(const[P,k]of Object.entries(d))$[P]=k;Object.keys(b).length>0&&($._none=b),h._unknown&&($._unknown=h._unknown),Object.keys(h).forEach(P=>delete h[P]),Object.assign(h,$)}return L(o,"Final parsed result:","resolver",h),h},"resolveArgs");var Zo=Object.defineProperty,X=le((t,e)=>Zo(t,"name",{value:e,configurable:!0}),"l");const J="-".codePointAt(0),H="=",Xo=H.codePointAt(0),Qo="--",ea="-",ta="--",bn=X(t=>t.length>2&&t.startsWith(ta),"hasLongOptionPrefix"),na=X(t=>bn(t)&&!t.includes(H,3),"isLongOption"),ia=X(t=>bn(t)&&t.includes(H,3),"isLongOptionAndValue"),ra=X(t=>t!==void 0&&t.length>0&&t.codePointAt(0)!==J,"hasOptionValue"),oa=X(t=>{if(t.length!==2||t.codePointAt(0)!==J||t.codePointAt(1)===J)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),aa=X(t=>!(t.length<=2||t.codePointAt(0)!==J||t.codePointAt(1)===J),"isShortOptionGroup"),sa=X(t=>{const e=[],n=[...t];let i=-1,o=0;for(;n.length>0;){const r=n.shift();if(r===void 0)break;const l=n[0];if(o>0?o--:i++,r===Qo){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(oa(r)){const s=r.charAt(1);let p;o?(e.push({index:i,kind:"option",name:s,rawName:r,value:p}),o===1&&ra(l)&&(p=n.shift(),e.push({index:i,kind:"option",value:p}))):e.push({index:i,kind:"option",name:s,rawName:r,value:p}),p!==void 0&&++i;continue}if(aa(r)&&!r.includes(H)){const s=[];let p="",a=!1;for(let c=1;c<r.length;c++){const h=r.charAt(c);a?p+=h:h.codePointAt(0)===Xo?a=!0:s.push(`${ea}${h}`)}if(a)if(s.length>0){const c=s.pop();s.push(`${c}=${p}`)}else s.push(p);n.unshift(...s),o=s.length;continue}if(na(r)){const s=r.slice(2);e.push({index:i,kind:"option",name:s,rawName:r});continue}if(ia(r)){const s=r.indexOf(H),p=r.slice(2,s),a=r.slice(s+1);e.push({index:i,inlineValue:!0,kind:"option",name:p,rawName:r,value:a});continue}if(r.length>2&&r.codePointAt(0)===J&&r.codePointAt(1)!==J&&r.includes(H)){const s=r.indexOf(H),p=r.charAt(1),a=r.slice(s+1);e.push({index:i,inlineValue:!0,kind:"option",name:p,rawName:r,value:a});continue}e.push({index:i,kind:"positional",value:r})}return e},"parseArgsTokens");var la=Object.defineProperty,Je=le((t,e)=>la(t,"name",{value:e,configurable:!0}),"d");const ca=/\d/,ua=Je(t=>t!=null&&(t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean")),"isBooleanType"),pa=Je(t=>typeof t=="function","isValidCustomTypeFunction"),fa=Je((t,e,n)=>{const i=n?.debug??!1;L(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const o=new Set,r=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(o.has(a.name)||e&&l.has(c))throw new M(`Invalid option definition: duplicate name '${a.name}'`);if(r.has(a.name)||e&&s.has(c))throw new M(`Invalid option definition: name '${a.name}' conflicts with an existing alias`);if(o.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(ca.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 h=e?a.alias.toLowerCase():"";if(r.has(a.alias)||e&&s.has(h))throw new M(`Invalid option definition: duplicate alias '${a.alias}'`);if(o.has(a.alias)||e&&l.has(h))throw new M(`Invalid option definition: alias '${a.alias}' conflicts with an existing option name`);r.add(a.alias),e&&s.add(h)}if(a.defaultOption&&(p++,a.type!==void 0&&ua(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"&&pa(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 da=Object.defineProperty,ha=le((t,e)=>da(t,"name",{value:e,configurable:!0}),"O");const ma=ha((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 o=Array.isArray(t)?t:[t];L(n,"Normalized definitions:","index",o),fa(o,i.caseInsensitive,n?i:void 0);let{argv:r}=i;if(!r&&(r=process.argv.slice(2),process.execArgv.length>0)){const a=new Set(process.execArgv);r=r.filter(c=>!a.has(c))}L(n,"Using argv:","index",r);let l=r;i.caseInsensitive&&(l=r.map(a=>{if(a.startsWith("--")){const c=a.indexOf("="),h=(c===-1?a.slice(2):a.slice(2,c)).toLowerCase();return c===-1?`--${h}`:`--${h}${a.slice(c)}`}if(a.startsWith("-")&&!a.startsWith("--")&&a.length>1){const c=a.slice(1).split("=",2),h=c[0],f=c[1];if(!h)return a;const g=h.toLowerCase();return f===void 0?`-${g}`:`-${g}=${f}`}return a}));const s=sa(l.map(String));L(n,"Tokenized arguments:","index",s);const p=Yo(s,o,i,r);return L(n,"Command-line-args parsing completed","index"),p},"commandLineArgs");var ga=Object.defineProperty,va=x((t,e)=>ga(t,"name",{value:e,configurable:!0}),"n$4");let ba=class{static{E(this,"Bn")}static{T(this,"Un")}static{x(this,"a")}static{va(this,"EmptyToolbox")}result;argv;options;argument;command;commandName;env;logger;runtime;rawUnknown;constructor(t,e){this.commandName=t,this.command=e}};var ya=Object.defineProperty,wa=x((t,e)=>ya(t,"name",{value:e,configurable:!0}),"n$3");let ze=class extends j{static{E(this,"ue")}static{T(this,"ce")}static{x(this,"i")}static{wa(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 $a=Object.defineProperty,Oa=x((t,e)=>$a(t,"name",{value:e,configurable:!0}),"f$3");const Pa=/^-{1,2}(\w+)(=(.+))?$/,yn=Oa((t,e,n,i)=>{const o=Pa.exec(t);if(o===null)return{};const r=o[1];if(!r)return{};const l=n&&i?n.get(r)??i.get(r):e.find(s=>s.name===r||s.alias===r);return l!==void 0?{argName:l.name,argValue:o[3],option:l}:{}},"getParameterOption");var xa=Object.defineProperty,Ge=x((t,e)=>xa(t,"name",{value:e,configurable:!0}),"e$3");const yt=Ge((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"),Ea=new Set(["0","1","false","true"]),Aa=Ge((t,e,n,i)=>{if(e.length===0||t.length===0)return{};const o=Ge((r,l)=>{const{argName:s,argValue:p,option:a}=yn(l,e,n,i),{lastOption:c}=r;return a&&ge(a)&&p&&s?r.partial[s]=yt(p,a):r.lastName&&c&&ge(c)&&Ea.has(l)&&(r.partial[r.lastName]=yt(l,c)),{lastName:s,lastOption:a,partial:r.partial}},"getBooleanValue");return t.reduce(o,{partial:{}}).partial},"getBooleanValues");var Na=Object.defineProperty,wt=x((t,e)=>Na(t,"name",{value:e,configurable:!0}),"s$6");const ja=new Set(["0","1","false","true"]),Ca=wt((t,e,n,i)=>{if(e.length===0||t.length===0)return t;const o=wt((r,l)=>{const{argValue:s,option:p}=yn(l,e,n,i),{lastOption:a}=r;if(a&&ge(a)&&ja.has(l)){const{args:c}=r;return{args:c.slice(0,-1)}}return p&&ge(p)&&s?{args:r.args}:{args:[...r.args,l],lastOption:p}},"removeBooleanArguments");return t.reduce(o,{args:[]}).args},"removeBooleanValues");var ka=Object.defineProperty,_a=x((t,e)=>ka(t,"name",{value:e,configurable:!0}),"o$4");const La=_a(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 Sa=Object.defineProperty,Ce=x((t,e)=>Sa(t,"name",{value:e,configurable:!0}),"o$3");const Ta=Ce(t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},"transformBooleanEnv"),Ia=Ce((t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return Ta(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"),Ma=/_./g,Va=/^[A-Z]/,Ua=Ce(t=>t.toLowerCase().replaceAll(Ma,e=>e[1]?.toUpperCase()??e).replace(Va,e=>e.toLowerCase()),"toCamelCase"),Da=Ce(t=>{if(!t||t.length===0)return{};const e={},n=G();for(const i of t){const o=n[i.name],r=Ia(i,o),l=r===void 0?i.defaultValue:r,s=Ua(i.name);e[s]=l}return e},"processEnvVariables");var Ba=Object.defineProperty,ve=x((t,e)=>Ba(t,"name",{value:e,configurable:!0}),"a$4");const Ra=ve(t=>{const e=new Map,n=new Map;for(const i of t)if(e.set(i.name,i),i.alias){const o=Array.isArray(i.alias)?i.alias:[i.alias];for(const r of o)n.set(r,i)}return{optionMapByAlias:n,optionMapByName:e}},"buildOptionMaps"),za=ve(async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new ze(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new ze(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new ze(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},"loadLazyHandler"),Wa=ve((t,e,n,i)=>{const o=new ba(t.name,t),{_all:r,_unknown:l,positionals:s}=e,p=Object.keys(n).length>0?{...r,...n}:r;$e in p&&delete p[$e],o.argument=s?.[$e]??[],o.rawUnknown=[...l??[]];const a=Object.keys(i).length>0;return o.options=a?{...p,...i}:p,o.env=Da(t.env),o},"prepareToolbox"),Fa=ve((t,e,n)=>{const i=t.options??[],o=i.length>0;let r=La(o?[...i,...n]:n);if(r.length>0){for(const a of r)if(a.multiple&&a.lazyMultiple)throw new Error(`Argument "${a.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(r=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:$e,type:t.argument.type,typeLabel:t.argument.typeLabel},...r]);let l,s;if(o){const{optionMapByAlias:a,optionMapByName:c}=Ra(i);l=Ca(e,i,c,a),s=Aa(e,i,c,a)}else l=e,s={};const p=ma(r,{argv:l,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:r,booleanValues:s,parsedArgs:p}},"processCommandArgs"),te=ve(async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await za(t))(e),"executeCommand");var qa=Object.defineProperty,Ga=x((t,e)=>qa(t,"name",{value:e,configurable:!0}),"n$2");let Ha=class extends j{static{E(this,"fi")}static{T(this,"pi")}static{x(this,"s")}static{Ga(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 Ja=Object.defineProperty,Ka=x((t,e)=>Ja(t,"name",{value:e,configurable:!0}),"t$1");const $t=Ka((t,e,n=!1)=>{const i=[];for(const o of t)if(!(!n&&!o.required)&&e[o.name]===void 0){if(o.type?.name==="Boolean"){e[o.name]=!1;continue}i.push(o)}return i},"listMissingArguments");var Ya=Object.defineProperty,wn=x((t,e)=>Ya(t,"name",{value:e,configurable:!0}),"n$1");const Za=wn((t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Dt(t,e)<=t.length/3,"isSimilar"),re=wn((t,e)=>{const n=t.toLowerCase();return e.filter(i=>Za(i.toLowerCase(),n))},"findAlternatives");var Xa=Object.defineProperty,ke=x((t,e)=>Xa(t,"name",{value:e,configurable:!0}),"a$3");const Qa=ke((t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const o=i.startsWith("--");let r=`Found unknown ${o?"option":"argument"} "${i}"`;if(o){const l=re(i.replace("--",""),(e.options??[]).map(s=>s.name));if(l.length>0){const[s,...p]=l.map(a=>`--${a}`);r+=p.length>0?`, did you mean ${s??""} or ${p.join(", ")}?`:`, did you mean ${s??""}?`}}n.push(r)}),n.length>0)throw new Error(n.join(`
|
|
4
|
+
`))},"validateUnknownOptions"),es=ke((t,e,n)=>{const i=n.__requiredOptions__,o=i?$t(i,e,!0):$t(t,e,!1);if(o.length>0)throw new Ha(n.name,o.map(r=>r.name));e._unknown&&e._unknown.length>0&&!n.argument&&Qa(e,n)},"validateRequiredOptions"),ts=ke((t,e,n)=>{const i=n.__conflictingOptions__??t.filter(o=>o.conflicts!==void 0);if(i.length>0){const o=i.find(r=>Array.isArray(r.conflicts)?r.conflicts.some(l=>e[l]!==void 0)&&e[r.name]!==void 0:e[r.conflicts]!==void 0&&e[r.name]!==void 0);if(o)throw new Zt(o.name,typeof o.conflicts=="string"?o.conflicts:o.conflicts?.[0]??"unknown")}},"validateConflictingOptions"),ns=ke(t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const o of t.options){if(o.name){const r=e.get(o.name)??[];r.push(o),e.set(o.name,r)}if(typeof o.alias=="string"&&o.alias.length>0){const r=n.get(o.alias)??[];r.push(o),n.set(o.alias,r)}else if(Array.isArray(o.alias)){for(const r of o.alias)if(r.length>0){const l=n.get(r)??[];l.push(o),n.set(r,l)}}}const i=[];for(const[o,r]of e)r.length>1&&i.push(`Duplicate option name "${o}" in command "${t.name}": ${JSON.stringify(r)}`);for(const[o,r]of n)r.length>1&&i.push(`Duplicate option alias "-${o}" used by options ${r.map(l=>`"${l.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
|
|
5
|
+
`))},"validateDuplicateOptions");var is=Object.defineProperty,Ke=x((t,e)=>is(t,"name",{value:e,configurable:!0}),"s$2");const rs=Ke((t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let i;for(let o=1;o<=e.length;o+=1){const r=e[o-1];if(r===void 0||r.startsWith("-"))break;n.push(r);const l=n.join(" ");t.has(l)&&(i={commandPath:[...n],depth:o})}return i?{argv:e.slice(i.depth),commandPath:i.commandPath}:{argv:e,commandPath:void 0}},"parseNestedCommand"),ne=Ke(t=>t.join(" "),"getCommandPathKey"),Ot=Ke((t,e)=>e&&e.length>0?[...e,t]:[t],"getFullCommandPath");var os=Object.defineProperty,_e=x((t,e)=>os(t,"name",{value:e,configurable:!0}),"a$2");const as=_e(t=>{t.options?.forEach(e=>{e.__camelCaseName__=Yt(e.name)})},"processOptionNames"),ss=_e(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 o=i.name.replace("no-","");if(!e.has(o)){if(i.type!==Boolean)throw new Error(`Cannot add negated option "${i.name}" to command "${t.name}" because it is not a boolean.`);const r={...i,defaultValue:i.defaultValue===void 0?!0:!i.defaultValue,name:o};n.push(r),e.add(o)}}n.length>0&&t.options.push(...n)},"addNegatableOptions"),ls=_e((t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,i=new Map;for(const r of e.options)if(r.name.startsWith("no-")){const l=Yt(r.name);i.set(l,r)}const o=Object.keys(n).filter(r=>i.has(r));if(o.length!==0)for(const r of o){const l=r.charAt(2);if(!l)continue;const s=l.toLowerCase()+r.slice(3),p=i.get(r);p&&(p.__negated__=!0),n[s]=!n[r],Reflect.deleteProperty(n,r)}},"mapNegatableOptions"),cs=_e((t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const o of e.options)o.__camelCaseName__&&o.__negated__===void 0&&o.implies!==void 0&&n.set(o.__camelCaseName__,o);if(n.size===0)return;const{options:i}=t;for(const o of Object.keys(i)){const r=n.get(o);if(r?.implies){const{implies:l}=r;for(const[s,p]of Object.entries(l))i[s]===void 0&&(i[s]=p)}}},"mapImpliedOptions");var us=Object.defineProperty,Le=x((t,e)=>us(t,"name",{value:e,configurable:!0}),"e$2");const ps=Le(()=>!!process.versions.electron,"isElectronApp"),fs=Le(()=>ps()&&!process.defaultApp,"isBundledElectronApp"),ds=Le(()=>fs()?0:1,"getProcessArgvBinIndex"),hs=Le(t=>t.slice(ds()+1),"hideBin");var ms=Object.defineProperty,$n=x((t,e)=>ms(t,"name",{value:e,configurable:!0}),"e$1");const gs=" ",vs=$n((t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),"equals"),bs=$n(t=>{if(typeof t=="string")return t.split(gs);const e=Pe();return vs(t,e)?hs(t):t},"parseRawCommand");var ys=Object.defineProperty,We=x((t,e)=>ys(t,"name",{value:e,configurable:!0}),"r");const ws=We(t=>{const e=We(r=>{t.error(`Uncaught exception: ${r.message||r}`),r.stack&&t.error(r.stack),q(1)},"uncaughtExceptionHandler"),n=We((r,l)=>{if(r instanceof Error)t.error(`Promise rejection: ${r.message||r}`),r.stack&&t.error(r.stack);else{let s;if(typeof r=="string")s=r;else try{s=JSON.stringify(r)}catch{s=String(r)}t.error(`Promise rejection: ${s}`)}q(1)},"unhandledRejectionHandler"),i=tt("uncaughtException",e),o=tt("unhandledRejection",n);return()=>{i(),o()}},"registerExceptionHandler");var $s=Object.defineProperty,ce=x((t,e)=>$s(t,"name",{value:e,configurable:!0}),"e");const xe=100,On=/^[a-z][\w-]*$/i,Ye=ce((t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new j(`${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 j(`${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 j(`${e} must be a function`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateFunction");const Fe=ce((t,e)=>{if(typeof t!="object"||t===null)throw new j(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateObject"),ye=ce(t=>{const e=Ye(t,"Command name");if(e.length>xe)throw new j(`Command name is too long (maximum ${String(xe)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new j(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!On.test(e))throw new j(`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=Ye(t,"Plugin name");if(e.length>xe)throw new j(`Plugin name is too long (maximum ${String(xe)} characters)`,"INVALID_PLUGIN_NAME",{length:e.length,pluginName:e});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new j(`Plugin name "${e}" contains invalid characters`,"INVALID_PLUGIN_NAME",{pluginName:e});if(!On.test(e))throw new j(`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 Os=Object.defineProperty,Se=x((t,e)=>Os(t,"name",{value:e,configurable:!0}),"s");const Ps=new Set([`
|
|
6
|
+
`,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),xs=/^[A-Z]:/i,Es=Se(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(Ps.has(e))throw new Error(`Argument contains dangerous character: ${e}`);return t.trim()},"sanitizeArgument"),xt=Se(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=>Es(e))},"sanitizeArguments");Se(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("/")||xs.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 Cc{static{E(this,"ao")}static{T(this,"co")}static{x(this,"RateLimiter")}static{Se(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 As=Object.defineProperty,Oe=x((t,e)=>As(t,"name",{value:e,configurable:!0}),"A");const Ns=/^-([^\d-])$/,js=/^--(\S+)/,Cs=/^-([^\d-]{2,})$/,qe=Oe(t=>Ns.test(t)||js.test(t)||Cs.test(t),"isOption");class ks{static{E(this,"Qi")}static{T(this,"uo")}static{x(this,"Cli")}static{Oe(this,"Cli")}#t;#e;#o;#c;#v;#u;#b;#a;#n;#i;#p;#s;#l;#f=!1;#y;#w=!1;#d;#h;#m;#g=[];#E(){return this.#d===void 0&&(this.#d=[...this.#i.keys()]),this.#d}#$(){return this.#h===void 0&&(this.#h=[...this.#n.keys()]),this.#h}#r(){return this.#m===void 0&&(this.#m=[...this.#E(),...this.#$()]),this.#m}#O(){return this.#g.length===0?be:[...be,...this.#g]}#A(){this.#d=void 0,this.#h=void 0,this.#m=void 0}#P(){if(this.#o===void 0){const e=bs(this.#e.argv);this.#o=xt(e),this.#N()}return this.#o}#N(){if(!this.#o)return;const e=G();let n=!1;for(const i of this.#o){if(i==="--quiet"||i==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(Rn),n=!0;break}if(i==="--verbose"||i==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(zn),n=!0;break}if(i==="--debug"||i==="-vvv"){e.CEREBRO_OUTPUT_LEVEL=String(ie),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(ie):String(et))}#j(){this.#w||(this.#y=ws(this.#t),this.#w=!0)}#x(e,n,i,o){this.#t.debug(`command '${o}' found, parsing command args: ${n.join(", ")}`);const{arguments_:r,booleanValues:l,parsedArgs:s}=Fa(e,n,this.#O()),p=Object.keys(l).length>0;let a=s;p&&(a={...s,_all:{...s._all,...l}}),es(r,a,e);const c=Wa(e,s,l,i);c.runtime=this,c.argv=this.#P();const h=e.options&&e.options.length>0;if(h&&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 Zt(u,g.name)}}return h&&(ls(c,e),cs(c,e)),ts(r,c.options,e),G().CEREBRO_OUTPUT_LEVEL===String(ie)&&(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_:r,booleanValues:l,commandArgs:a,parsedArgs:s,toolbox:c}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new j("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#v=e.trim();const i=n.argv??Pe(),o=n.cwd??ri();if(this.#e={...n,argv:i,cwd:o},this.#e.argv&&!Array.isArray(this.#e.argv))throw new j("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 j("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new j("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new j("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const r=G();if(r.CEREBRO_OUTPUT_LEVEL=String(et),typeof this.#e.logger=="object"){const l=["debug","error","info","log","warn"],s=[],p=this.#e.logger;for(const a of l)typeof p[a]!="function"&&s.push(a);if(s.length>0)throw new j(`Logger object is missing required methods: ${s.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:s});this.#t=this.#e.logger}else this.#t={...console,debug:Oe((...l)=>{r.CEREBRO_OUTPUT_LEVEL===String(ie)&&console.debug(...l)},"debug")};this.#u=this.#e.packageVersion,this.#b=this.#e.packageName,this.#c=this.#e.cwd,this.#s="help",this.#l={},this.#n=new Map,this.#i=new Map,this.#p=new Map}setCommandSection(e){return this.#l=e,this}getCommandSection(){return this.#l.header||(this.#l.header=`${this.#v}${this.#u?` v${this.#u}`:""}`),this.#l}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){Fe(e,"Command"),ye(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new j(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new j(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?ye(e.alias):Pt(e.alias,"Command alias").forEach(a=>ye(a))),e.argument&&Fe(e.argument,"Command argument"),e.options&&Fe(e.options,"Command options"),e.commandPath&&(Pt(e.commandPath,"Command commandPath"),e.commandPath.forEach(a=>{ye(a)}));const o=Ot(e.name,e.commandPath),r=ne(o);if(this.#i.has(r))throw new j(`Command with path "${r}" 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 j(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const a of e.options)pt(a);if(ns(e),ss(e),as(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(r,e);else{if(!l&&s!==void 0&&!p){const a=Ot(s.name,s.commandPath);this.#n.set(ne(a),s)}this.#n.set(e.name,e)}if(this.#i.set(r,o),this.#p.set(r,e),this.#A(),e.alias!==void 0){const a=typeof e.alias=="string"?[e.alias]:e.alias;for(const c of a){if(G().CEREBRO_OUTPUT_LEVEL===String(ie)&&this.#t.debug("adding alias",c),this.#n.has(c))throw new j(`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(be.map(r=>r.name)),o=new Set(be.map(r=>r.alias).filter(Boolean));if(i.has(n.name))throw new j(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&o.has(n.alias))throw new j(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#g.map(r=>r.name)).has(n.name))throw new j(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",pt(n),this.#g.push(n),this}getGlobalOptions(){return this.#O()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#a?this.#a:(this.#a=new io(this.#t),this.#a.register({description:"Attaches the logger to the toolbox",execute:Oe(e=>{e.logger=this.#t},"execute"),name:"logger"}),this.#a)}getCliName(){return this.#v}getPackageVersion(){return this.#u}getPackageName(){return this.#b}getCommands(){return this.#n}getCwd(){return this.#c}dispose(){this.#y?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...o}=e;if(!this.#n.has("help")){const{default:m}=await import("../packem_chunks/help-command.js");this.addCommand(new m(this.#n))}const r=this.#$(),l=this.#i;this.#j();const s=this.#P();let p,a=[...s];const c=Ut(),h=Vt(),f=Pe();this.#t.debug(`process.execPath: ${c}`),this.#t.debug(`process.execArgv: ${h.join(" ")}`),this.#t.debug(`process.argv: ${f.join(" ")}`);const g=rs(l,[...s]);if(g.commandPath)p=g.commandPath,a=g.argv;else{if(s.length>1&&s[0]&&s[1]&&!qe(s[0])&&!qe(s[1])){const b=[];let $=0;for(;$<s.length;){const k=s[$];if(!k||qe(k))break;b.push(k),$+=1}const P=ne(b);if(b[0]&&!r.includes(b[0])){const k=this.#r(),N=re(P,k);throw new ee(P,N)}}let m;try{m=ho([null,...r],[...s])}catch(b){if(b instanceof Error&&b.name==="INVALID_COMMAND"&&"command"in b){const $=b.command,P=this.#r(),k=re($,P);throw new ee($,k)}throw b}m.command&&(p=[m.command],a=m.argv)}if(!p)if(this.#s)p=[this.#s];else{const m=this.#r();throw new ee("",m)}const u=ne(p),v=this.#i.get(u);let w;if(v){if(w=this.#p.get(u),!w||ne(v)!==u){const m=this.#r(),b=re(u,m);throw new ee(u,b)}}else{const m=p.at(-1);if(w=m?this.#n.get(m):void 0,!w){const b=this.#r(),$=re(u,b);throw new ee(u,$)}}if(typeof w.execute!="function"&&typeof w.loader!="function")return this.#t.error(`Command "${w.name}" has no function to execute.`),i?q(1):void 0;const y=a;let O,A;try{({commandArgs:O,toolbox:A}=this.#x(w,y,o,u))}catch(m){if(this.#t.error(m),i)return q(1);throw m}const d=this.getPluginManager();try{!this.#f&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#c,logger:this.#t}),this.#f=!0),await d.executeLifecycle("execute",A),await d.executeLifecycle("beforeCommand",A);let m;const b=O.global;if(b?.help){const $=this.#n.get("help");if(!$)throw new j("Help command not found","COMMAND_NOT_FOUND");m=await te($,A,O)}else if(b?.version??b?.V){const $=this.#n.get("version");if(!$)throw new j("Version command not found","COMMAND_NOT_FOUND");m=await te($,A,O)}else m=await te(w,A,O);return await d.executeLifecycle("afterCommand",A,m),i?q(0):void 0}catch(m){throw await d.executeErrorHandlers(m,A),m}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...o}=n;Ye(e,"Command name");const r=e.split(" ").filter(Boolean),l=ne(r),s=this.#i.get(l)?this.#p.get(l):this.#n.get(e);if(!s){const f=this.#r(),g=re(l||e,f);throw new ee(e,g)}if(typeof s.execute!="function"&&typeof s.loader!="function")throw new j(`Command "${s.name}" has no function to execute`,"INVALID_COMMAND",{commandName:s.name});const p=[...xt(i)];this.#t.debug(`running command '${e}' programmatically with args: ${p.join(", ")}`);const{commandArgs:a,toolbox:c}=this.#x(s,p,o,l||e),h=this.getPluginManager();try{!this.#f&&h.hasPlugins()&&(await h.init({cli:this,cwd:this.#c,logger:this.#t}),this.#f=!0),await h.executeLifecycle("execute",c),await h.executeLifecycle("beforeCommand",c);let f;const g=a.global;if(g?.help){const u=this.#n.get("help");if(!u)throw new j("Help command not found","COMMAND_NOT_FOUND");f=await te(u,c,a)}else if(g?.version??g?.V){const u=this.#n.get("version");if(!u)throw new j("Version command not found","COMMAND_NOT_FOUND");f=await te(u,c,a)}else f=await te(s,c,a);return await h.executeLifecycle("afterCommand",c,f),f}catch(f){throw await h.executeErrorHandlers(f,c),f}}}var _s=Object.defineProperty,Ls=E((t,e)=>_s(t,"name",{value:e,configurable:!0}),"e$1"),Ss=Object.defineProperty,Ts=Ls((t,e)=>Ss(t,"name",{value:e,configurable:!0}),"o"),Is=Object.defineProperty,Ms=Ts((t,e)=>Is(t,"name",{value:e,configurable:!0}),"t");const kc=Ms((t,e)=>new ks(t,e),"createCerebro");var Vs=Object.defineProperty,se=E((t,e)=>Vs(t,"name",{value:e,configurable:!0}),"t$1");function Us(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}E(Us,"getDefaultExportFromCjs");se(Us,"getDefaultExportFromCjs");function Ds(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}E(Ds,"getDefaultExportFromNamespaceIfPresent");se(Ds,"getDefaultExportFromNamespaceIfPresent");function Bs(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")&&Object.keys(t).length===1?t.default:t}E(Bs,"getDefaultExportFromNamespaceIfNotNamed");se(Bs,"getDefaultExportFromNamespaceIfNotNamed");function Rs(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=se(E(function i(){var o=!1;try{o=this instanceof i}catch{}return o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)},"a"),"a");n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var o=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:se(function(){return t[i]},"get")})}),n}E(Rs,"getAugmentedNamespace");se(Rs,"getAugmentedNamespace");var zs=Object.defineProperty,Ws=E((t,e)=>zs(t,"name",{value:e,configurable:!0}),"r$1"),Fs=Object.defineProperty,qs=Ws((t,e)=>Fs(t,"name",{value:e,configurable:!0}),"r"),Gs=Object.defineProperty,Hs=qs((t,e)=>Gs(t,"name",{value:e,configurable:!0}),"o");const _c=Hs(()=>{try{const t=require("node:module");if(typeof t.enableCompileCache=="function"){t.enableCompileCache();return}}catch{}try{require("v8-compile-cache")}catch{}},"enableCompileCache");var Js=Object.defineProperty,Ks=E((t,e)=>Js(t,"name",{value:e,configurable:!0}),"u$2"),Ys=Object.defineProperty,Pn=Ks((t,e)=>Ys(t,"name",{value:e,configurable:!0}),"p");const Zs=He(import.meta.url),de=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,xn=Pn(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 Zs(t)},"__cjs_getBuiltinModule"),{execFileSync:Xs}=xn("node:child_process"),{totalmem:Qs}=xn("node:os");var el=Object.defineProperty,Te=Pn((t,e)=>el(t,"name",{value:e,configurable:!0}),"r");const tl=/--max-old-space-size=(\d+)/,nl=/--max-semi-space-size=(\d+)/,il=Te(t=>Math.floor(Qs()/1024/1024*t),"getDefaultMaxOldSpaceSize"),rl=Te(t=>t<=512?4:t<=1024?8:t<=2048?16:t<=4096?32:t<=8192?64:Math.floor(Math.log2(t))*8,"getSemiSpaceSize"),Et=Te((t,e)=>{for(const n of e){const i=t.exec(n);if(i)return Number.parseInt(i[1],10)}},"extractFlag"),Lc=Te(t=>{const e=t?.maxOldSpacePercent??.75,n=[...Vt()],i=[...Pe()],o=Et(tl,n),r=Et(nl,n);if(o!==void 0&&r!==void 0)return;const l=o??il(e),s=r??rl(l),p=[];if(o===void 0&&p.push(`--max-old-space-size=${String(l)}`),r===void 0&&p.push(`--max-semi-space-size=${String(s)}`),p.length!==0)try{Xs(Ut(),[...p,...n,...i.slice(1)],{env:G(),stdio:"inherit"}),q(0)}catch(a){const c=a.status;q(typeof c=="number"?c:1)}},"applyHeapTuning");var ol=Object.defineProperty,al=E((t,e)=>ol(t,"name",{value:e,configurable:!0}),"T"),sl=Object.defineProperty,Ie=al((t,e)=>sl(t,"name",{value:e,configurable:!0}),"N");const ll=He(import.meta.url),he=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,cl=Ie(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 ll(t)},"__cjs_getBuiltinModule"),{createRequire:ul}=cl("node:module");var pl=Object.defineProperty,fl=Ie((t,e)=>pl(t,"name",{value:e,configurable:!0}),"A$2"),dl=Object.defineProperty,Ze=fl((t,e)=>dl(t,"name",{value:e,configurable:!0}),"$"),hl=Object.defineProperty,ml=Ze((t,e)=>hl(t,"name",{value:e,configurable:!0}),"r$1");const gl=ml(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
7
|
+
`),"normalizeLF"),vl=globalThis.process??Object.create(null),At={versions:{}},Nt=new Proxy(vl,{get(t,e){if(e in t)return t[e];if(e in At)return At[e]}});var bl=Object.defineProperty,yl=Ze((t,e)=>bl(t,"name",{value:e,configurable:!0}),"b");const wl=yl((t,e,n,i)=>{const o={column:0,line:-1,...t.start},r={...o,...t.end},l=o.line,s=o.column,p=r.line,a=r.column;let c=Math.max(l-(n+1),0),h=Math.min(e.length,p+i);l===-1&&(c=0),p===-1&&(h=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:h,markerLines:g,start:c}},"getMarkerLines");var $l=Object.defineProperty,we=Ze((t,e)=>$l(t,"name",{value:e,configurable:!0}),"t");const Ol=Nt.platform==="win32"&&!Nt.env?.WT_SESSION?">":"❯",Pl=we((t,e,n)=>{const i={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:we(u=>u,"gutter"),marker:we(u=>u,"marker"),message:we(u=>u,"message"),...n?.color}},o=typeof e.start.column=="number";let r=gl(t).split(`
|
|
8
|
+
`);typeof i.tabWidth=="number"&&(r=r.map(u=>u.replaceAll(" "," ".repeat(i.tabWidth))));const{end:l,markerLines:s,start:p}=wl(e,r,i.linesAbove,i.linesBelow),a=String(l).length,{gutter:c,marker:h,message:f}=i.color;let g=r.slice(p,l).map((u,v)=>{const w=p+1+v,y=s[w],O=` ${String(w)}`.slice(-a),A=!s[w+1],d=` ${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(d.replaceAll(/\d/g," "))," ",b,h("^").repeat($)].join(""),A&&i.message&&(m+=` ${f(i.message)}`)}return[i.prefix+h(Ol),c(d),u.length>0?` ${u}`:"",m].join("")}return`${i.prefix} ${c(d)}${u.length>0?` ${u}`:""}`}).join(`
|
|
10
|
+
`);return i.message&&!o&&(g=`${i.prefix+" ".repeat(a+1)+i.message}
|
|
11
|
+
${g}`),g},"codeFrame");var xl=Object.defineProperty,El=Ie((t,e)=>xl(t,"name",{value:e,configurable:!0}),"x$1"),Al=Object.defineProperty,Nl=El((t,e)=>Al(t,"name",{value:e,configurable:!0}),"x"),jl=Object.defineProperty,W=Nl((t,e)=>jl(t,"name",{value:e,configurable:!0}),"u");const K=W((t,...e)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${t}`,...e)},"debugLog"),Y="<unknown>",Cl=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,kl=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,_l=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,Ll=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,Sl=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Tl=/in\s(.*)\s\(at\s(.+)\)\sat/,Il=/^(?:.*@)?(.*):(\d+):(\d+)$/,Ml=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Vl=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ul=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,jt=/\(error: (.*)\)/,Dl=/at\s/,Bl=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,Rl=/^\s+|\s+$/g,zl=/\S*(?:Error: |AggregateError:)/,En=/^Anonymous function$/,Wl=/^\s*in\s.*/,Fl=/^.*?\s*at\s.*/,ql=/^.*?\s*@.*|\[native code\]/,An=W((t,e)=>{const n=t.includes("safari-extension"),i=t.includes("safari-web-extension");return n||i?[t.includes("@")?t.split("@")[0]:Y,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},"extractSafariExtensionDetails"),Nn=W((t,e)=>{const n=_l.exec(e);n&&(t.file=n[1],t.line=+n[2],t.column=+n[3])},"parseMapped"),Gl=W(t=>{const e=Tl.exec(t);if(e){K(`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]??Y,raw:t,type:void 0}}const n=Sl.exec(t);if(n){K(`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(Dl,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??Y,raw:t,type:t.startsWith("internal")?"internal":void 0};return Nn(i,`${n[2]}:${n[3]}:${n[4]}`),i}},"parseNode"),Hl=W(t=>{const e=Cl.exec(t);if(e){K(`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 o,r;if(i){const a=kl.exec(t);if(a){const c=Bl.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]&&(o={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=Ll.exec(t);c&&(r={column:c[4]?+c[4]:void 0,file:c[2],line:c[3]?+c[3]:void 0},o={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]=An(e[1]?e[1].replace(En,"<anonymous>"):Y,e[2]),p={column:e[4]?+e[4]:void 0,evalOrigin:o,file:s,line:e[3]?+e[3]:void 0,methodName:l,raw:t,type:i?"eval":n?"native":void 0};return r?(p.column=r.column,p.file=r.file,p.line=r.line):Nn(p,`${s}:${e[3]}:${e[4]}`),p}},"parseChromium"),Jl=W((t,e)=>{const n=Ml.exec(t);if(n){K(`parse gecko error stack line: "${t}"`,`found: ${JSON.stringify(n)}`);const i=n[3]?.includes(" > eval"),o=i&&n[3]&&Vl.exec(n[3]);let r;i&&o&&(n[3]=o[1],r={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]=o[2]);const[l,s]=An(n[1]?n[1].replace(En,"<anonymous>"):Y,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:r,file:s,line:a,methodName:l,raw:t,type:i?"eval":s.includes("[native code]")?"native":void 0}}},"parseGecko"),Kl=W((t,e)=>{const n=Ul.exec(t);if(!(n&&n[2].includes(" > eval"))&&n)return K(`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]||Y,raw:t,type:void 0}},"parseFirefox"),Yl=W(t=>{const e=Il.exec(t);if(e)return K(`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:Y,raw:t,type:void 0}},"parseReactAndroidNative"),jn=W((t,{filter:e,frameLimit:n=50}={})=>{const i=t;let o=(typeof i.stacktrace=="string"?i.stacktrace:t.stack??"").split(`
|
|
12
|
+
`).map(r=>(jt.test(r)?r.replace(jt,"$1"):r).replaceAll(Rl,"")).filter(r=>!zl.test(r)&&r!=="eval code");return e&&(o=o.filter(r=>e(r))),o=o.slice(0,n),o.reduce((r,l,s)=>{if(!l||l.length>1024)return r;let p;if(Wl.test(l))p=Gl(l);else if(Fl.test(l))p=Hl(l);else if(ql.test(l)){let a;if(s===0){const c=t,h=c.columnNumber,f=c.lineNumber,g=c.line,u=c.column;h||f?a={column:h,line:f,type:"firefox"}:(g||u)&&(a={column:u,line:g,type:"safari"})}p=Kl(l,a)??Jl(l,a)}else p=Yl(l);return p?r.push(p):K(`parse error stack line: "${l}"`,"not parser found"),r},[])},"parseStacktrace");var Zl=Object.defineProperty,Xl=Ie((t,e)=>Zl(t,"name",{value:e,configurable:!0}),"p"),Ql=Object.defineProperty,Cn=Xl((t,e)=>Ql(t,"name",{value:e,configurable:!0}),"m");const ec=ul(import.meta.url),oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Xe=Cn(t=>{if(typeof oe<"u"&&oe.versions&&oe.versions.node){const[e,n]=oe.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return oe.getBuiltinModule(t)}return ec(t)},"__cjs_getBuiltinModule"),{existsSync:tc,readFileSync:nc}=Xe("node:fs"),{relative:ic}=Xe("node:path"),{cwd:rc}=oe,{fileURLToPath:oc}=Xe("node:url");var ac=Object.defineProperty,_=Cn((t,e)=>ac(t,"name",{value:e,configurable:!0}),"o");const ue=_((t,e,n)=>n===0?t:e===" "?t+" ".repeat(n):t+" ".repeat(e*n),"getPrefix"),sc=_((t,e)=>{const n=t.replace("async file:","file:");return ic(e,n.startsWith("file:")?oc(n):n)},"getRelativePath"),lc=_((t,e,n)=>{if(e)return n.title(t.message);const i=t.message?`: ${t.message}`:"";return n.title(t.name+i)},"getTitleText"),kn=_((t,{color:e,hideErrorTitle:n,indentation:i,prefix:o},r)=>`${ue(o,i,r)}${lc(t,n,e)}
|
|
13
|
+
`,"getMessage"),_n=_((t,{color:e,indentation:n,prefix:i},o)=>{if(t.hint===void 0)return;const r=ue(i,n,o);let l="";if(Array.isArray(t.hint))for(const s of t.hint)l+=`${r+s}
|
|
14
|
+
`;else l+=r+t.hint;return e.hint(l)},"getHint"),Qe=_((t,{color:e,cwd:n,displayShortPath:i,indentation:o,prefix:r},l=0)=>{const s=i?sc(t.file,n):t.file,{fileLine:p,method:a}=e;return`${ue(r,o,l)}at ${t.methodName?`${a(t.methodName)} `:""}${p(s)}:${p(t.line?.toString()??"")}`},"getMainFrame"),Ln=_((t,{color:e,indentation:n,linesAbove:i,linesBelow:o,prefix:r,showGutter:l,showLineNumbers:s,tabWidth:p},a)=>{if(t.file===void 0)return;const c=t.file.replace("file://","");if(!tc(c))return;const h=nc(c,"utf8");return Pl(h,{start:{column:t.column,line:t.line}},{color:e,linesAbove:i,linesBelow:o,prefix:ue(r,n,a),showGutter:l,showLineNumbers:s,tabWidth:p})},"getCode"),Sn=_((t,e,n)=>{if(t.errors.length===0)return;let i=`${ue(e.prefix,e.indentation,n)}Errors:
|
|
15
|
+
|
|
16
|
+
`,o=!0;for(const r of t.errors)o?o=!1:i+=`
|
|
17
|
+
|
|
18
|
+
`,i+=In(r,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},n+1);return`
|
|
19
|
+
${i}`},"getErrors"),Tn=_((t,e,n)=>{let i=`${ue(e.prefix,e.indentation,n)}Caused by:
|
|
20
|
+
|
|
21
|
+
`;const o=t.cause;i+=kn(o,e,n);const r=jn(o).shift(),l=_n(o,e,n);if(l&&(i+=`${l}
|
|
22
|
+
`),r&&(i+=Qe(r,e,n),!e.hideErrorCauseCodeView)){const s=Ln(r,e,n);s!==void 0&&(i+=`
|
|
23
|
+
${s}`)}if(o.cause)i+=`
|
|
24
|
+
${Tn(o,e,n+1)}`;else if(o instanceof AggregateError){const s=Sn(o,e,n);s!==void 0&&(i+=`
|
|
25
|
+
${s}`)}return`
|
|
26
|
+
${i}`},"getCause"),cc=_((t,e)=>(t.length>0?`
|
|
27
|
+
`:"")+t.map(n=>Qe(n,e)).join(`
|
|
28
|
+
`),"getStacktrace"),In=_((t,e,n)=>{const i={cwd:rc(),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}},o=jn(t,{filter:e.filterStacktrace,frameLimit:i.framesMaxLimit}),r=o.shift();return[e.hideMessage?void 0:kn(t,i,n),_n(t,i,n),r?Qe(r,i,n):void 0,r&&!i.hideErrorCodeView?Ln(r,i,n):void 0,t instanceof AggregateError?Sn(t,i,n):void 0,t.cause===void 0?void 0:Tn(t,i,n),o.length>0?cc(o,i):void 0].filter(Boolean).join(`
|
|
29
|
+
`).replaceAll("\\","/")},"internalRenderError"),uc=_((t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return In(t,e,0)},"renderError");var pc=Object.defineProperty,fc=E((t,e)=>pc(t,"name",{value:e,configurable:!0}),"i$1"),dc=Object.defineProperty,hc=fc((t,e)=>dc(t,"name",{value:e,configurable:!0}),"n"),mc=Object.defineProperty,Ct=hc((t,e)=>mc(t,"name",{value:e,configurable:!0}),"n");const Sc=Ct((t={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:Ct((e,n)=>{const{logger:i,runtime:o}=n,{detailed:r=!1,exitOnError:l=!0,formatter:s,logErrors:p=!0,renderOptions:a={}}=t;if(p)if(s)i.error(s(e));else if(r){const c=o.getCwd(),h=uc(e,{cwd:c,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...a});i.error(h)}else i.error(e);l&&q(1)},"handleError"),version:"1.0.0"}),"errorHandlerPlugin");var gc="1.0.0-alpha.22";const Tc={version:gc};var vc=Object.defineProperty,bc=E((t,e)=>vc(t,"name",{value:e,configurable:!0}),"e");const Ic={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:bc(()=>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{ae as E,xc as H,Yt as L,me as M,Lc as N,ur as O,kc as T,Ic as a,xr as b,_r as c,G as d,j as e,Rs as f,Us as g,Pc as h,_c as i,Ft as l,Tc as m,vr as s,Dr as v,Sc as w};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var Z=Object.defineProperty;var T=(e,r)=>Z(e,"name",{value:r,configurable:!0});var Q=Object.defineProperty,X=T((e,r)=>Q(e,"name",{value:r,configurable:!0}),"p$1"),ee=Object.defineProperty,re=X((e,r)=>ee(e,"name",{value:r,configurable:!0}),"C"),te=Object.defineProperty,v=re((e,r)=>te(e,"name",{value:r,configurable:!0}),"u");const ne=/^-{1,2}(no-color|no-colors|color=false|color=never)$/,oe=/^-{1,2}(color=256)$/,ie=/^-{1,2}(color=16m|color=full|color=truecolor)$/,ce=/^-{1,2}(color|colors|color=true|color=always)$/,ae=/-mono|dumb/i,ue=/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/,le=/-256(color)?$/i,se=/^screen|^tmux|^xterm|^vt[1-5]\d\d|^ansi|color|mintty|rxvt|cygwin|linux/i,Y=v(e=>{const r=globalThis,n=r.Deno!=null,o=r.process??r.Deno??{},l=o.argv??o.args??[],c=v(g=>{const j=l.indexOf("--"),w=l.findIndex(J=>g.test(J));return w!==-1&&(j===-1||w<j)},"oneOfFlags");let i={};try{i=n?o.env.toObject():o.env??{}}catch{}const O="FORCE_COLOR",z=O in i,b=i[O]??void 0,x=Object.prototype.toString.call(b).slice(8,-1)==="String",K=typeof b=="number";let f;if(b==="true"?f=1:b==="false"?f=0:x&&b.length===0?f=1:x&&b.length>0?f=Math.min(Number.parseInt(b,10),3):K&&(f=Math.min(b,3)),b!=="true"&&b!=="false"&&f!==void 0&&f<4)return f;if("NO_COLOR"in i||z&&f===0||c(ne))return 0;if(c(oe))return 2;if(c(ie))return 3;if(c(ce))return 1;const B=f??0;if("TF_BUILD"in i&&"AGENT_NAME"in i)return 1;if(i.TERM&&ae.test(i.TERM))return B;if((n?r.Deno.build.os:o.platform)==="win32")try{const g=(n?r.Deno.osRelease():o.os.release()).split(".");return Number(g[0])>=10&&Number(g[2])>=10586?Number(g[2])>=14931?3:2:1}catch{}if("CI"in i)return["GITEA_ACTIONS","CIRCLECI","GITHUB_WORKFLOW","GITHUB_ACTIONS"].some(g=>g in i)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(g=>g in i)||i.CI_NAME==="codeship"?1:B;if(i.TERMINAL_EMULATOR?.includes("JediTerm"))return 3;if("TEAMCITY_VERSION"in i)return ue.test(i.TEAMCITY_VERSION)?1:0;if(i.COLORTERM==="truecolor"||i.TERM==="xterm-kitty"||i.TERM==="xterm-ghostty"||i.TERM==="wezterm")return 3;if("TERM_PROGRAM"in i){const g=Number.parseInt((i.TERM_PROGRAM_VERSION??"").split(".")[0],10);if(i.TERM_PROGRAM==="iTerm.app")return g>=3?3:2;if(i.TERM_PROGRAM==="Apple_Terminal")return 2}if(le.test(i.TERM))return 2;let R;return n?R=e==="out"?r.Deno.stdout.isTerminal():r.Deno.stderr.isTerminal():"PM2_HOME"in i&&"pm_id"in i?R=!0:R=o[`std${e}`]&&"isTTY"in o[`std${e}`],R&&se.test(i.TERM)||"COLORTERM"in i?1:B},"isColorSupportedFactory"),ge=v(()=>Y("out"),"isStdoutColorSupported");v(()=>Y("err"),"isStderrColorSupported");var be=Object.defineProperty,V=T((e,r)=>be(e,"name",{value:r,configurable:!0}),"B"),fe=Object.defineProperty,p=V((e,r)=>fe(e,"name",{value:r,configurable:!0}),"u"),$e=Object.defineProperty,de=p((e,r)=>$e(e,"name",{value:r,configurable:!0}),"e$1");function M({onlyFirst:e=!1}={}){const r="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(r,e?void 0:"g")}T(M,"x");V(M,"N");p(M,"t$1");de(M,"ansiRegex");var pe=Object.defineProperty,me=p((e,r)=>pe(e,"name",{value:r,configurable:!0}),"n$1");const $=me((e,r,n)=>r>e?r:Math.min(e,n),"clamp");var he=Object.defineProperty,Oe=p((e,r)=>he(e,"name",{value:r,configurable:!0}),"a$1");const Re=/([a-f\d]{3,6})/i,Te=Oe(e=>{let[,r]=Re.exec(e)??[];const n=r?r.length:0;if(n===3){const l=r.charAt(0),c=r.charAt(1),i=r.charAt(2);r=l+l+c+c+i+i}else if(n!==6)return[0,0,0];const o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},"convertHexToRgb");var ve=Object.defineProperty,P=p((e,r)=>ve(e,"name",{value:r,configurable:!0}),"e");const W=P((e,r,n)=>e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/51)+6*Math.round(r/51)+Math.round(n/51),"rgbToAnsi256"),C=P(e=>{let r,n,o;if(e<8)return 30+e;if(e<16)return 90+(e-8);if(e>=232)r=n=o=((e-232)*10+8)/255;else{e-=16;const i=e%36;r=Math.floor(e/36)/5,n=Math.floor(i/6)/5,o=i%6/5}const l=Math.max(r,n,o)*2;if(l===0)return 30;const c=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return l===2?c+60:c},"ansi256To16"),k=P((e,r,n)=>C(W(e,r,n)),"rgbToAnsi16");var ye=Object.defineProperty,s=p((e,r)=>ye(e,"name",{value:r,configurable:!0}),"b");const a=39,u=49,G=10,E=ge(),q={close:"",open:""},t=E>0?(e,r)=>({close:`\x1B[${String(r)}m`,open:`\x1B[${String(e)}m`}):()=>q,L=s(e=>(r,n,o)=>e(W(Number(r),Number(n),Number(o))),"createRgbFunction"),D=s(e=>r=>{const[n,o,l]=Te(r);return e(n,o,l)},"createHexFunction");let A=s(e=>t(`38;5;${String(e)}`,a),"createAnsi256"),N=s(e=>t(`48;5;${String(e)}`,u),"createBgAnsi256"),y=s((e,r,n)=>t(`38;2;${String(e)};${String(r)};${String(n)}`,a),"createRgb"),S=s((e,r,n)=>t(`48;2;${String(e)};${String(r)};${String(n)}`,u),"createBgRgb");E===1?(A=s(e=>t(C(Number(e)),a),"createAnsi256"),N=s(e=>t(C(Number(e))+G,u),"createBgAnsi256"),y=s((e,r,n)=>t(k(Number(e),Number(r),Number(n)),a),"createRgb"),S=s((e,r,n)=>t(k(Number(e),Number(r),Number(n))+G,u),"createBgRgb")):E===2&&(y=L(A),S=L(N));const F={bold:t(1,22),dim:t(2,22),hidden:t(8,28),inverse:t(7,27),italic:t(3,23),overline:t(53,55),reset:t(0,0),strike:t(9,29),strikethrough:t(9,29),underline:t(4,24),visible:q},H={bgBlack:t(40,u),bgBlackBright:t(100,u),bgBlue:t(44,u),bgBlueBright:t(104,u),bgCyan:t(46,u),bgCyanBright:t(106,u),bgGray:t(100,u),bgGreen:t(42,u),bgGreenBright:t(102,u),bgGrey:t(100,u),bgMagenta:t(45,u),bgMagentaBright:t(105,u),bgRed:t(41,u),bgRedBright:t(101,u),bgWhite:t(47,u),bgWhiteBright:t(107,u),bgYellow:t(43,u),bgYellowBright:t(103,u),black:t(30,a),blackBright:t(90,a),blue:t(34,a),blueBright:t(94,a),cyan:t(36,a),cyanBright:t(96,a),gray:t(90,a),green:t(32,a),greenBright:t(92,a),grey:t(90,a),magenta:t(35,a),magentaBright:t(95,a),red:t(31,a),redBright:t(91,a),white:t(37,a),whiteBright:t(97,a),yellow:t(33,a),yellowBright:t(93,a)},U={bg:s(e=>N($(e,0,255)),"bg"),bgHex:D(S),bgRgb:s((e,r,n)=>S($(e,0,255),$(r,0,255),$(n,0,255)),"bgRgb"),fg:s(e=>A($(e,0,255)),"fg"),hex:D(y),rgb:s((e,r,n)=>y($(e,0,255),$(r,0,255),$(n,0,255)),"rgb")};var Se=Object.defineProperty,Me=p((e,r)=>Se(e,"name",{value:r,configurable:!0}),"s");const Be=Me((e,r,n)=>{if(r==="")return e;let o=e.indexOf(r);if(o<0)return e;const l=r.length;let c=0,i="";for(;~o;)i+=e.slice(c,o)+n,c=o+l,o=e.indexOf(r,c);return i+e.slice(c)},"stringReplaceAll");var Ce=Object.defineProperty,h=p((e,r)=>Ce(e,"name",{value:r,configurable:!0}),"a");const d={};let _=null;const Ee=h((e,r,n)=>{if(!e)return"";let o;if(e.raw===void 0?o=String(e):o=String.raw(e,...r),o.includes("\x1B"))for(let l=n;l;l=l.props)o=Be(o,l.close,l.open);return o.includes(`
|
|
2
|
+
`)&&(o=o.replace(/(\r*\n)/g,`${n.closeStack}$1${n.openStack}`)),n.openStack+o+n.closeStack},"wrapText"),I=h(({props:e},{close:r,open:n})=>{const o=(e?.openStack??"")+n,l=r+(e?.closeStack??""),c=h((i,...O)=>Ee(i,O,c.props),"style");return Object.setPrototypeOf(c,_),c.props={close:r,closeStack:l,open:n,openStack:o,props:e},c.open=o,c.close=l,c},"createStyle"),Ae=h(function(){const e=h(r=>String(r),"self");e.strip=r=>r.replaceAll(M(),"");for(const r in H)d[r]={get(){const n=I(this,H[r]);return Object.defineProperty(this,r,{value:n}),n}};for(const r in F)d[r]={get(){const n=I(this,F[r]);return Object.defineProperty(this,r,{value:n}),n}};return _=Object.defineProperties({},d),Object.setPrototypeOf(e,_),e},"Colorize");for(const e in U)d[e]={get(){return(...r)=>I(this,U[e](...r))}};d.ansi256=d.fg;d.bgAnsi256=d.bg;const m=new Ae,_e=m.bold,Ie=m.cyan,Pe=m.dim,xe=m.green,je=m.inverse,we=m.magenta,ke=m.red,Ge=m.yellow;export{ge as B,Pe as E,xe as I,je as N,we as P,ke as T,Ge as e,m as g,_e as j,Ie as q};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=Object.defineProperty;var r=(e,n)=>o(e,"name",{value:n,configurable:!0});var a=Object.defineProperty,c=r((e,n)=>a(e,"name",{value:n,configurable:!0}),"i");const l=new Set(["0BSD","AGPL-3.0","AGPL-3.0-only","AGPL-3.0-or-later","Apache-1.1","Apache-2.0","Artistic-2.0","BlueOak-1.0.0","BSD-2-Clause","BSD-3-Clause","BSL-1.0","CC0-1.0","CC-BY-3.0","CC-BY-4.0","CDDL-1.0","CDDL-1.1","EPL-1.0","EPL-2.0","GPL-2.0","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0","GPL-3.0-only","GPL-3.0-or-later","ISC","LGPL-2.0","LGPL-2.1","LGPL-3.0","MIT","MIT-0","MPL-1.1","MPL-2.0","Python-2.0","Unlicense","WTFPL","Zlib"]),L={apache2:"Apache-2.0","apache 2.0":"Apache-2.0",bsd:"BSD-3-Clause","bsd-2":"BSD-2-Clause","bsd-3":"BSD-3-Clause",mit:"MIT",public:"Unlicense","public domain":"Unlicense"},p=(()=>{const e=new Map;for(const n of l)e.set(n.toLowerCase(),n);for(const[n,t]of Object.entries(L))e.set(n,t);return e})(),P=c(e=>{const n=e.trim();if(n.length!==0)return l.has(n)?n:p.get(n.toLowerCase())},"normalizeSpdxId"),f=c(e=>{let n;if(typeof e.license=="string")n=e.license;else if(e.license&&typeof e.license=="object"&&typeof e.license.type=="string")n=e.license.type;else if(Array.isArray(e.licenses)&&e.licenses.length>0){const s=e.licenses[0];s&&typeof s.type=="string"&&(n=s.type)}if(!n)return;const t=n.trim();if(t.length===0)return;if(/[()]|\b(?:and|or|with)\b/i.test(t))return[{expression:t}];const i=P(t);return i?[{license:{id:i}}]:[{license:{name:t}}]},"extractLicenseChoice");export{f as e,P as n};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`,{mode:M});try{await it(r,s)}catch(i){throw await T(r,{force:!0}).catch(()=>{}),i}},"writeEntry"),g=d(async(t,e,o)=>{const s=await w(t),r=o??await b(t,e);await T(D(s,e),{force:!0}),r&&await T(r.logFile,{force:!0}).catch(()=>{})},"deleteEntry"),f=d(t=>{try{return process.kill(t,0),!0}catch{return!1}},"isAlive"),
|
|
1
|
+
var Q=Object.defineProperty;var a=(t,e)=>Q(t,"name",{value:e,configurable:!0});import{createRequire as U}from"node:module";import{f as tt,M as p}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{d as j}from"../packem_chunks/config.js";import{aL as lt,B as dt,aM as W}from"../packem_chunks/bin.js";const Z=U(import.meta.url),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=a(t=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[e,o]=k.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return k.getBuiltinModule(t)}return Z(t)},"__cjs_getBuiltinModule"),{Socket:et}=y("node:net"),{randomBytes:ot}=y("node:crypto"),{readdir:st,writeFile:rt,rename:it,rm:T,open:A,readFile:at,stat:nt,unlink:O}=y("node:fs/promises"),{createRequire:ct}=y("node:module"),{spawn:ht}=y("node:child_process");var ut=Object.defineProperty,ft=a((t,e)=>ut(t,"name",{value:e,configurable:!0}),"i$1"),pt=Object.defineProperty,N=ft((t,e)=>pt(t,"name",{value:e,configurable:!0}),"s");const wt=ct(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kt=N(t=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[e,o]=m.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return m.getBuiltinModule(t)}return wt(t)},"__cjs_getBuiltinModule"),{lstat:x,mkdir:mt}=kt("node:fs/promises");var gt=Object.defineProperty,vt=N((t,e)=>gt(t,"name",{value:e,configurable:!0}),"o");const yt=vt(async t=>{tt(t);try{const e=await x(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(j(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await mt(t,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const o=await x(t);if(!o.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(j(o))}'`,{cause:e})}},"ensureDir");var _t=Object.defineProperty,u=a((t,e)=>_t(t,"name",{value:e,configurable:!0}),"s");const bt=3e4,B=100;class $t extends Error{static{a(this,"ServiceReadinessError")}constructor(e,o){super(e),this.elapsedMs=o,this.name="ServiceReadinessError"}elapsedMs;static{u(this,"ServiceReadinessError")}}const Ht=u(async t=>{const e=t.host??"127.0.0.1",{port:o}=t,s=t.timeoutMs??bt,r=Date.now();for(;Date.now()-r<s;){if(await Et(e,o))return;await St(B)}throw new $t(`Timed out waiting for ${e}:${String(o)} to accept TCP connections (${String(s)}ms)`,Date.now()-r)},"waitForTcp"),Et=u((t,e)=>new Promise(o=>{const s=new et,r=u(i=>{s.removeAllListeners(),s.destroy(),o(i)},"onDone");s.once("connect",()=>{r(!0)}),s.once("error",()=>{r(!1)}),s.setTimeout(B,()=>{r(!1)});try{s.connect(e,t)}catch{r(!1)}}),"tryConnect"),St=u(t=>new Promise(e=>{setTimeout(e,t)}),"delay"),Pt=u(async(t,e)=>{const o=t.readiness??(t.port===void 0?void 0:{tcp:{port:t.port}});o&&await Ht({host:o.tcp.host,port:o.tcp.port,timeoutMs:e?.timeoutMs??o.tcp.timeoutMs})},"runReadiness");var Tt=Object.defineProperty,d=a((t,e)=>Tt(t,"name",{value:e,configurable:!0}),"o");const M=384,C=5e3,Mt=50,Rt=3e4,w=d(async t=>{const e=p(lt(t),"services");try{await yt(e)}catch(o){throw o.code==="ENOTDIR"?new Error(`Service registry path ${e} exists but is not a directory. Remove it or move the conflicting file before running \`vis service\`.`,{cause:o}):o}return e},"getRegistryDir"),R=d(t=>t.replaceAll("/","_").replaceAll(":","__"),"slugify"),D=d((t,e)=>p(t,`${R(e)}.json`),"entryPath"),Dt=d((t,e)=>p(t,`${R(e)}.lock`),"lockPath"),b=d(async(t,e)=>{const o=await w(t),s=D(o,e);if(await dt(s))try{return await W(s)}catch{return}},"readEntry"),Ot=d(async t=>{const e=await w(t);let o;try{o=await st(e)}catch{return[]}const s=[];for(const r of o)if(r.endsWith(".json"))try{const i=await W(p(e,r));s.push(i)}catch{}return s},"readAllEntries"),jt=d(async(t,e)=>{const o=await w(t),s=D(o,e.id),r=p(o,`.${ot(8).toString("hex")}.tmp`);await rt(r,`${JSON.stringify(e,void 0,2)}
|
|
2
|
+
`,{mode:M});try{await it(r,s)}catch(i){throw await T(r,{force:!0}).catch(()=>{}),i}},"writeEntry"),g=d(async(t,e,o)=>{const s=await w(t),r=o??await b(t,e);await T(D(s,e),{force:!0}),r&&await T(r.logFile,{force:!0}).catch(()=>{})},"deleteEntry"),f=d(t=>{try{return process.kill(t,0),!0}catch{return!1}},"isAlive"),te=d(async t=>{const e=await Ot(t),o=[],s=[];for(const r of e){if(f(r.pid)){s.push(r);continue}const i=await b(t,r.id);if(i&&i.pid!==r.pid){s.push(i);continue}await g(t,r.id,r).catch(()=>{}),o.push(r.id)}return{pruned:o,surviving:s}},"pruneDead"),xt=d(t=>new Promise(e=>{setTimeout(e,t)}),"sleep"),Ct=d(async t=>{try{const e=await A(t,"wx",M);try{await e.writeFile(String(process.pid))}finally{await e.close().catch(()=>{})}return!0}catch(e){if(e.code==="EEXIST")return!1;throw e}},"tryClaimLock"),Lt=d(async t=>{let e;try{const o=await at(t,"utf8"),s=Number.parseInt(o.trim(),10);e=Number.isFinite(s)?s:void 0}catch{return!0}if(e!==void 0&&!f(e))return!0;try{const o=await nt(t);return Date.now()-o.mtimeMs>Rt}catch{return!0}},"isLockStale"),G=d(async(t,e,o)=>{const s=await w(t),r=Dt(s,e),i=Date.now();for(;!await Ct(r);){if(await Lt(r)){await O(r).catch(()=>{});continue}if(Date.now()-i>=C)throw new Error(`Could not acquire service lock for ${e} within ${String(C)}ms — another \`vis service\` invocation appears to be holding it.`);await xt(Mt)}try{return await o()}finally{await O(r).catch(()=>{})}},"withServiceLock");var Ft=Object.defineProperty,n=a((t,e)=>Ft(t,"name",{value:e,configurable:!0}),"r");function v(t,e={},o){for(const s in t){const r=t[s],i=o?`${o}:${s}`:s;typeof r=="object"&&r!==null?v(r,e,i):typeof r=="function"&&(e[i]=r)}return e}a(v,"c");n(v,"flatHooks");function It(...t){const e={};for(const o of t){const s=v(o);for(const r in s)e[r]?e[r].push(s[r]):e[r]=[s[r]]}for(const o in e)if(e[o].length>1){const s=e[o];e[o]=(...r)=>V(s,i=>i(...r))}else e[o]=e[o][0];return e}a(It,"v");n(It,"mergeHooks");function V(t,e){return t.reduce((o,s)=>o.then(()=>e(s)),Promise.resolve())}a(V,"d$2");n(V,"serial");const q=(()=>{if(console.createTask)return console.createTask;const t={run:n(e=>e(),"run")};return()=>t})();function $(t,e,o,s){for(let r=o;r<t.length;r+=1)try{const i=s?s.run(()=>t[r](...e)):t[r](...e);if(i&&typeof i.then=="function")return Promise.resolve(i).then(()=>$(t,e,r+1,s))}catch(i){return Promise.reject(i)}}a($,"k");n($,"callHooks");function X(t,e,o){if(t.length>0)return $(t,e,0,q(o))}a(X,"y");n(X,"serialTaskCaller");function J(t,e,o){if(t.length>0){const s=q(o);return Promise.all(t.map(r=>s.run(()=>r(...e))))}}a(J,"m");n(J,"parallelTaskCaller");function At(t,e){return t.reduce((o,s)=>o.then(()=>s(...e||[])),Promise.resolve())}a(At,"x");n(At,"serialCaller");function Wt(t,e){return Promise.all(t.map(o=>o(...e||[])))}a(Wt,"P");n(Wt,"parallelCaller");function _(t,e){for(const o of[...t])o(e)}a(_,"a");n(_,"callEachWith");var Nt=class{static{a(this,"p")}static{n(this,"Hookable")}_hooks;_before;_after;_deprecatedHooks;_deprecatedMessages;constructor(){this._hooks={},this._before=void 0,this._after=void 0,this._deprecatedMessages=void 0,this._deprecatedHooks={},this.hook=this.hook.bind(this),this.callHook=this.callHook.bind(this),this.callHookWith=this.callHookWith.bind(this)}hook(t,e,o={}){if(!t||typeof e!="function")return()=>{};const s=t;let r;for(;this._deprecatedHooks[t];)r=this._deprecatedHooks[t],t=r.to;if(r&&!o.allowDeprecated){let i=r.message;i||(i=`${s} hook has been deprecated`+(r.to?`, please use ${r.to}`:"")),this._deprecatedMessages||(this._deprecatedMessages=new Set),this._deprecatedMessages.has(i)||(console.warn(i),this._deprecatedMessages.add(i))}if(!e.name)try{Object.defineProperty(e,"name",{get:n(()=>"_"+t.replace(/\W+/g,"_")+"_hook_cb","get"),configurable:!0})}catch{}return this._hooks[t]=this._hooks[t]||[],this._hooks[t].push(e),()=>{e&&(this.removeHook(t,e),e=void 0)}}hookOnce(t,e){let o,s=n((...r)=>(typeof o=="function"&&o(),o=void 0,s=void 0,e(...r)),"_function");return o=this.hook(t,s),o}removeHook(t,e){const o=this._hooks[t];if(o){const s=o.indexOf(e);s!==-1&&o.splice(s,1),o.length===0&&(this._hooks[t]=void 0)}}clearHook(t){this._hooks[t]=void 0}deprecateHook(t,e){this._deprecatedHooks[t]=typeof e=="string"?{to:e}:e;const o=this._hooks[t]||[];this._hooks[t]=void 0;for(const s of o)this.hook(t,s)}deprecateHooks(t){for(const e in t)this.deprecateHook(e,t[e])}addHooks(t){const e=v(t),o=Object.keys(e).map(s=>this.hook(s,e[s]));return()=>{for(const s of o)s();o.length=0}}removeHooks(t){const e=v(t);for(const o in e)this.removeHook(o,e[o])}removeAllHooks(){this._hooks={}}callHook(t,...e){return this.callHookWith(X,t,e)}callHookParallel(t,...e){return this.callHookWith(J,t,e)}callHookWith(t,e,o){const s=this._before||this._after?{name:e,args:o,context:{}}:void 0;this._before&&_(this._before,s);const r=t(this._hooks[e]?[...this._hooks[e]]:[],o,e);return r instanceof Promise?r.finally(()=>{this._after&&s&&_(this._after,s)}):(this._after&&s&&_(this._after,s),r)}beforeEach(t){return this._before=this._before||[],this._before.push(t),()=>{if(this._before!==void 0){const e=this._before.indexOf(t);e!==-1&&this._before.splice(e,1)}}}afterEach(t){return this._after=this._after||[],this._after.push(t),()=>{if(this._after!==void 0){const e=this._after.indexOf(t);e!==-1&&this._after.splice(e,1)}}}};function K(){return new Nt}a(K,"w$2");n(K,"createHooks");(class{static{n(this,"HookableCore")}_hooks;constructor(){this._hooks={}}hook(t,e){return!t||typeof e!="function"?()=>{}:(this._hooks[t]=this._hooks[t]||[],this._hooks[t].push(e),()=>{e&&(this.removeHook(t,e),e=void 0)})}removeHook(t,e){const o=this._hooks[t];if(o){const s=o.indexOf(e);s!==-1&&o.splice(s,1),o.length===0&&(this._hooks[t]=void 0)}}callHook(t,...e){const o=this._hooks[t];if(!(!o||o.length===0))return $(o,e,0)}});const L=typeof window<"u";function Bt(t,e={}){const o={inspect:L,group:L,filter:n(()=>!0,"filter"),...e},s=o.filter,r=typeof s=="string"?c=>c.startsWith(s):s,i=o.tag?`[${o.tag}] `:"",l=n(c=>i+c.name+"".padEnd(c._id,"\0"),"logPrefix"),h={},S=t.beforeEach(c=>{r!==void 0&&!r(c.name)||(h[c.name]=h[c.name]||0,c._id=h[c.name]++,console.time(l(c)))}),P=t.afterEach(c=>{r!==void 0&&!r(c.name)||(o.group&&console.groupCollapsed(c.name),o.inspect?console.timeLog(l(c),c.args):console.timeEnd(l(c)),o.group&&console.groupEnd(),h[c.name]--)});return{close:n(()=>{S(),P()},"close")}}a(Bt,"W");n(Bt,"createDebugger");var Gt=Object.defineProperty,H=a((t,e)=>Gt(t,"name",{value:e,configurable:!0}),"t$1");const ee=H(()=>K(),"createVisHooks"),oe=H(async(t,e)=>{if(!(!e||e.length===0))for(const o of e){if(o.hooks)for(const[s,r]of Object.entries(o.hooks)){const i=Array.isArray(r)?r:[r];for(const l of i)t.hook(s,l)}o.setup&&await o.setup(t)}},"registerPlugins");class se{static{a(this,"HookableLifeCycle")}static{H(this,"HookableLifeCycle")}#o;#e;#s=new Map;constructor(e,o){this.#o=e,this.#e=o}startTasks(e){for(const o of e)this.#s.set(o.id,o),this.#t("task:before",o)}endTasks(e){for(const o of e)this.#s.delete(o.task.id),this.#t("task:after",o.task,o),o.status==="failure"?this.#t("task:failure",o.task,o):Vt(o.status)&&this.#t("task:cacheHit",o.task,o)}printCacheMiss(e,o){this.#t("task:cacheMiss",e,o)}onTaskStdout(e,o){this.#t("task:stdout",e,o)}onTaskStderr(e,o){this.#t("task:stderr",e,o)}#t(e,...o){Promise.resolve(this.#o.callHook(e,...o)).catch(s=>{if(this.#e)try{this.#e(e,s)}catch{}})}}const Vt=H(t=>t==="local-cache"||t==="local-cache-kept-existing"||t==="remote-cache","isCacheStatus");var qt=Object.defineProperty,Xt=a((t,e)=>qt(t,"name",{value:e,configurable:!0}),"i");const F=process.platform==="win32",Jt=Xt(async t=>{const{command:e,cwd:o,env:s,logFile:r}=t,i=await A(r,"a",M);let l;try{l=ht(F?"cmd":"/bin/sh",F?["/d","/s","/c",e]:["-c",e],{cwd:o,detached:!0,env:{...process.env,...s},stdio:["ignore",i.fd,i.fd],windowsHide:!0})}finally{await i.close().catch(()=>{})}if(l.pid===void 0&&await new Promise((h,S)=>{l.once("spawn",()=>{h()}),l.once("error",P=>{S(P)})}),l.pid===void 0)throw new Error(`Failed to spawn detached process for command: ${e}`);return l.unref(),{pid:l.pid}},"spawnDetached");var Kt=Object.defineProperty,E=a((t,e)=>Kt(t,"name",{value:e,configurable:!0}),"t");const Y=5e3,re=E(async t=>G(t.workspaceRoot,t.id,async()=>{const e=await b(t.workspaceRoot,t.id);if(e&&f(e.pid))throw new Error(`Service ${t.id} is already running (pid ${String(e.pid)})`);e&&await g(t.workspaceRoot,t.id,e);const o=await w(t.workspaceRoot),s=R(t.id),r=p(o,`${s}.log`),{pid:i}=await Jt({command:t.command,cwd:t.cwd,env:t.env,logFile:r}),l={command:t.command,config:t.config,cwd:t.cwd,env:t.config.env??{},id:t.id,logFile:r,pid:i,slug:s,startedAt:new Date().toISOString(),visVersion:process.env.VIS_VERSION??"0.0.0"};if(await jt(t.workspaceRoot,l),t.skipReadiness!==!0)try{await Pt(t.config,{timeoutMs:t.readinessTimeoutMs})}catch(h){throw await z(i,t.config.killGracePeriodMs??Y).catch(()=>{}),await g(t.workspaceRoot,t.id,l).catch(()=>{}),h}return{entry:l}}),"startService"),ie=E(async t=>G(t.workspaceRoot,t.id,async()=>{const e=await b(t.workspaceRoot,t.id);if(!e)return{stopped:!1};if(!f(e.pid))return await g(t.workspaceRoot,t.id,e),{stopped:!1};const o=t.graceMs??e.config.killGracePeriodMs??Y;return await z(e.pid,o),await g(t.workspaceRoot,t.id,e),{stopped:!0}}),"stopService"),z=E(async(t,e)=>{I(t,"SIGTERM");const o=Date.now();for(;Date.now()-o<e;){if(!f(t))return;await new Promise(s=>{setTimeout(s,100)})}f(t)&&I(t,"SIGKILL")},"stopServiceByPid"),I=E((t,e)=>{try{process.platform==="win32"?process.kill(t,e):process.kill(-t,e)}catch(o){if(o.code==="ESRCH")return;throw o}},"sendSignalToServiceGroup");export{se as H,$t as S,b as a,ie as b,ee as c,Ot as d,Pt as e,g as f,f as i,te as p,oe as r,re as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var T=Object.defineProperty;var j=(n,e)=>T(n,"name",{value:e,configurable:!0});import{createRequire as A}from"node:module";import{
|
|
1
|
+
var T=Object.defineProperty;var j=(n,e)=>T(n,"name",{value:e,configurable:!0});import{createRequire as A}from"node:module";import{k as R,h as C}from"../packem_chunks/bin.js";const B=A(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,q=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 B(n)},"__cjs_getBuiltinModule"),{createRequire:N}=q("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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var j=Object.defineProperty;var g=(s,e)=>j(s,"name",{value:e,configurable:!0});import{createRequire as S}from"node:module";import{M as d,i as y}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{n as q}from"../packem_chunks/config.js";const $=S(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=g(s=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[e,n]=l.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return l.getBuiltinModule(s)}return $(s)},"__cjs_getBuiltinModule"),{readdirSync:b,lstatSync:P}=A("node:fs");var w=Object.defineProperty,v=g((s,e)=>w(s,"name",{value:e,configurable:!0}),"u");const D=/^([^<(]+?)?(?:<([^>]+)>)?\s*(?:\(([^)]+)\))?\s*$/u,N=v(s=>{const e=s.match(D);if(!e)return;const n=e[1]?.trim(),t=e[2]?.trim(),r=e[3]?.trim();if(!(!n&&!t&&!r))return{email:t||void 0,name:n||void 0,url:r||void 0}},"parsePersonString"),R=v(s=>{if(!Array.isArray(s)||s.length===0)return;const e=[];for(const n of s)if(typeof n=="string"){const t=N(n);t&&e.push(t)}else if(n&&typeof n=="object"){const t=n,r=typeof t.name=="string"?t.name:void 0,o=typeof t.email=="string"?t.email:void 0,u=typeof t.url=="string"?t.url:void 0;(r||o||u)&&e.push({email:o,name:r,url:u})}return e.length>0?e:void 0},"normalizeMaintainers"),W=v(s=>{const e=d(s,"node_modules");if(!y(e))return new Map;const n=new Map,t=new Set,r=v((o,u="")=>{if(t.has(o))return;t.add(o);let h;try{h=b(o)}catch{return}for(const a of h){const c=d(o,a);let m;try{m=P(c)}catch{continue}if(m.isSymbolicLink())continue;if(a.startsWith("@")){m.isDirectory()&&r(c,`${a}/`);continue}if(a===".pnpm"&&u===""){let i;try{i=b(c)}catch{continue}for(const p of i){const f=d(c,p,"node_modules");y(f)&&r(f)}continue}if(a.startsWith(".")||!m.isDirectory())continue;const _=u+a,M=d(c,"package.json");try{if(!y(M))continue;const i=q(M);if(typeof i.version!="string")continue;const p=`${_}@${i.version}`;n.has(p)||n.set(p,{directory:c,license:i.license,licenses:Array.isArray(i.licenses)?i.licenses:void 0,maintainers:R(i.maintainers),name:_,scripts:i.scripts&&typeof i.scripts=="object"?i.scripts:void 0,version:i.version});const f=d(c,"node_modules");y(f)&&r(f)}catch{}}},"scanDir");return r(e),n},"readNodeModulesManifests");export{R as n,W as r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var E=Object.defineProperty;var R=(u,p)=>E(u,"name",{value:p,configurable:!0});import{M as d,i as o
|
|
1
|
+
var E=Object.defineProperty;var R=(u,p)=>E(u,"name",{value:p,configurable:!0});import{M as d,i as o,$}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{B as h}from"../packem_chunks/config.js";import{l as x}from"../packem_chunks/bin.js";var S=Object.defineProperty,b=R((u,p)=>S(u,"name",{value:p,configurable:!0}),"k");const U=b((u,p,A,m=[])=>{const i=[];if(A===void 0)return i.push("minimumReleaseAge not set in vis.config; skipping native sync."),i;const r=Number.isFinite(A)?Math.max(0,Math.round(A)):0;switch(u){case"bun":{const n=d(p,"bunfig.toml");let e=o(n)?$(n):"";const a=r*60,t=`minimumReleaseAge = ${String(a)}`,s=m.length>0?`minimumReleaseAgeExcludes = [${m.map(c=>`"${c.replaceAll(String.raw`"`,String.raw`\"`)}"`).join(", ")}]`:void 0,g=/^\[install\][ \t]*\n/m.exec(e);if(g?.index===void 0){const c=s?`${t}
|
|
2
2
|
${s}`:t;e=`${e.trimEnd()?`${e.trimEnd()}
|
|
3
3
|
|
|
4
4
|
`:""}[install]
|
|
@@ -31,4 +31,4 @@ ${m.map(g=>` - ${x(g)}`).join(`
|
|
|
31
31
|
`)}
|
|
32
32
|
`,s=/^npmPreapprovedPackages:[ \t]*\n(?:[ \t]{2}[^\n]*\n)*/m;e=s.test(e)?e.replace(s,t):`${e.trimEnd()}
|
|
33
33
|
|
|
34
|
-
${t}`}h(n,e),i.push(`Updated .yarnrc.yml npmMinimalAgeGate: ${String(r)} (minutes; bare integer dodges yarn duration-string bug)`),m.length>0&&i.push(`Updated .yarnrc.yml npmPreapprovedPackages (${String(m.length)} entries)`);break}}return i},"syncMinimumReleaseAgeToNativeConfig");export{
|
|
34
|
+
${t}`}h(n,e),i.push(`Updated .yarnrc.yml npmMinimalAgeGate: ${String(r)} (minutes; bare integer dodges yarn duration-string bug)`),m.length>0&&i.push(`Updated .yarnrc.yml npmPreapprovedPackages (${String(m.length)} entries)`);break}}return i},"syncMinimumReleaseAgeToNativeConfig");export{U as E};
|
package/dist/packem_shared/{native-config-sync-Dvi1g2nQ.js → native-config-sync-BOeuyrBj.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var v=Object.defineProperty;var E=(o,l)=>v(o,"name",{value:l,configurable:!0});import{M as c,$ as S,
|
|
1
|
+
var v=Object.defineProperty;var E=(o,l)=>v(o,"name",{value:l,configurable:!0});import{M as c,$ as S,i as g}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{B as i,n as O}from"../packem_chunks/config.js";import{e as N,o as U}from"../packem_chunks/bin.js";var x=Object.defineProperty,D=E((o,l)=>x(o,"name",{value:l,configurable:!0}),"f");const W=D((o,l,d)=>{const s=[],b=Object.entries(d).filter(([,n])=>n).map(([n])=>n);switch(o){case"bun":{const n=c(l,"package.json");if(g(n))try{const e=O(n);e.trustedDependencies=b,i(n,`${JSON.stringify(e,null,2)}
|
|
2
2
|
`),s.push(`Updated package.json trustedDependencies with ${b.length} packages`)}catch(e){s.push(`Failed to update package.json: ${e instanceof Error?e.message:String(e)}`)}break}case"npm":{const n=c(l,".npmrc");let e=g(n)?S(n):"";/^\s*ignore-scripts\s*=\s*true\s*$/m.test(e)?s.push(".npmrc already has ignore-scripts=true"):(e=`${e.trimEnd()}
|
|
3
3
|
ignore-scripts=true
|
|
4
|
-
`,i(n,e),s.push("Added ignore-scripts=true to .npmrc"));break}case"pnpm":{const n=c(l,"pnpm-workspace.yaml");if(!g(n)){s.push("pnpm-workspace.yaml not found. Cannot sync allowBuilds.");break}let e={},
|
|
4
|
+
`,i(n,e),s.push("Added ignore-scripts=true to .npmrc"));break}case"pnpm":{const n=c(l,"pnpm-workspace.yaml");if(!g(n)){s.push("pnpm-workspace.yaml not found. Cannot sync allowBuilds.");break}let e={},m=[];try{const t=U(n);e=t?.allowBuilds??{},m=Array.isArray(t?.onlyBuiltDependencies)?t.onlyBuiltDependencies:[]}catch{}const h={...e,...d},A=Object.keys(d).filter(t=>e[t]!==d[t]).length,u=b.toSorted((t,p)=>t.localeCompare(p)),k=[...new Set([...m,...u])].toSorted((t,p)=>t.localeCompare(p)),w=u.filter(t=>!m.includes(t)).length;if(A===0&&w===0)s.push(`All ${String(Object.keys(d).length)} allowBuilds entries already present in pnpm-workspace.yaml.`);else{const t=Object.keys(h).sort(),p=D(a=>a.startsWith("@")||a.includes("/")||/[:#\s]/.test(a),"needsQuote"),$=D(a=>p(a)?`'${a.replaceAll("'","''")}'`:a,"renderKey"),y=`allowBuilds:
|
|
5
5
|
${t.map(a=>` ${$(a)}: ${String(h[a])}`).join(`
|
|
6
6
|
`)}
|
|
7
7
|
`;let r=S(n);r.endsWith(`
|
|
@@ -13,9 +13,9 @@ ${k.map(j=>` - ${p(j)?`'${j.replaceAll("'","''")}'`:j}`).join(`
|
|
|
13
13
|
`)}
|
|
14
14
|
`,C=/^onlyBuiltDependencies:[ \t]*\n(?:[ \t]{2}[^\n]*\n)*/m;r=C.test(r)?r.replace(C,a):`${r.trimEnd()}
|
|
15
15
|
|
|
16
|
-
${a}`}i(n,r),s.push(`Updated pnpm-workspace.yaml allowBuilds (${String(A)} new, ${String(t.length)} total)`),w>0&&s.push(`Updated pnpm-workspace.yaml onlyBuiltDependencies (${String(w)} new, ${String(k.length)} total)`)}const B=c(l,"package.json");if(g(B)&&
|
|
17
|
-
`),s.push(`Updated package.json pnpm.onlyBuiltDependencies (${String(y)} new, ${String($.length)} total)`))}catch(t){s.push(`Failed to update package.json pnpm.onlyBuiltDependencies: ${t instanceof Error?t.message:String(t)}`)}break}case"yarn":{if(N(l)){const n=c(l,".yarnrc.yml");let e=S(n);const
|
|
16
|
+
${a}`}i(n,r),s.push(`Updated pnpm-workspace.yaml allowBuilds (${String(A)} new, ${String(t.length)} total)`),w>0&&s.push(`Updated pnpm-workspace.yaml onlyBuiltDependencies (${String(w)} new, ${String(k.length)} total)`)}const B=c(l,"package.json");if(g(B)&&u.length>0)try{const t=O(B),p=Array.isArray(t.pnpm?.onlyBuiltDependencies)?t.pnpm.onlyBuiltDependencies:[],$=[...new Set([...p,...u])].toSorted((r,f)=>r.localeCompare(f)),y=u.filter(r=>!p.includes(r)).length;y>0&&(t.pnpm={...t.pnpm,onlyBuiltDependencies:$},i(B,`${JSON.stringify(t,null,2)}
|
|
17
|
+
`),s.push(`Updated package.json pnpm.onlyBuiltDependencies (${String(y)} new, ${String($.length)} total)`))}catch(t){s.push(`Failed to update package.json pnpm.onlyBuiltDependencies: ${t instanceof Error?t.message:String(t)}`)}break}case"yarn":{if(N(l)){const n=c(l,".yarnrc.yml");let e=S(n);const m=/^\s*enableScripts\s*:/m.test(e),h=/^\s*enableScripts\s*:\s*false\s*$/m.test(e);m?h?s.push(".yarnrc.yml already has enableScripts: false"):(e=e.replace(/^\s*enableScripts\s*:.+$/m,"enableScripts: false"),i(n,e),s.push("Changed enableScripts to false in .yarnrc.yml")):(e=`${e.trimEnd()}
|
|
18
18
|
enableScripts: false
|
|
19
19
|
`,i(n,e),s.push("Added enableScripts: false to .yarnrc.yml"))}else{const n=c(l,".npmrc");let e=g(n)?S(n):"";/^\s*ignore-scripts\s*=\s*true\s*$/m.test(e)?s.push(".npmrc already has ignore-scripts=true"):(e=`${e.trimEnd()}
|
|
20
20
|
ignore-scripts=true
|
|
21
|
-
`,i(n,e),s.push("Added ignore-scripts=true to .npmrc (yarn classic lacks enableScripts)"))}break}}return s},"syncAllowBuildsToNativeConfig");export{
|
|
21
|
+
`,i(n,e),s.push("Added ignore-scripts=true to .npmrc (yarn classic lacks enableScripts)"))}break}}return s},"syncAllowBuildsToNativeConfig");export{W as N};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var U=Object.defineProperty;var l=(e,o)=>U(e,"name",{value:o,configurable:!0});import{createRequire as P}from"node:module";import{K as z}from"../packem_chunks/config.js";import{NATIVE_BINDING_VERSION as M,osvBloomDecode as Y,osvBloomProbe as Q,osvBloomProbeBatch as X}from"#native";const V=P(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=l(e=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[o,t]=d.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return d.getBuiltinModule(e)}return V(e)},"__cjs_getBuiltinModule"),{randomUUID:H,createHash:F}=O("node:crypto"),{existsSync:p}=O("node:fs"),{readFile:y,mkdir:L,stat:I,rm:q,writeFile:G,rename:J,unlink:K}=O("node:fs/promises"),{join:w,dirname:W}=O("node:path");var Z=Object.defineProperty,s=l((e,o)=>Z(e,"name",{value:o,configurable:!0}),"r");const N=5;if(M!==N)throw new Error(`vis native binding ABI mismatch in osv-bloom: expected ${N}, got ${M}. Rebuild via \`pnpm --filter @visulima/vis run build:native\` or reinstall the platform binding package.`);const ut="https://endevco.github.io/osv-bloom",tt=new Set(["endevco.github.io"]);class g extends Error{static{l(this,"OsvBloomSourceNotAllowedError")}static{s(this,"OsvBloomSourceNotAllowedError")}cause="OSV_BLOOM_SOURCE_NOT_ALLOWED";constructor(o){super(`osv-bloom source host '${o}' is not in the built-in allowlist. Add it to \`security.audit.advisories.bloom.allowedHosts\` if intentional.`),this.name="OsvBloomSourceNotAllowedError"}}class B extends Error{static{l(this,"OsvBloomNetworkError")}static{s(this,"OsvBloomNetworkError")}cause="OSV_BLOOM_NETWORK";constructor(o,t){super(`osv-bloom fetch failed for ${o}: ${t}. Check connectivity, proxy env vars, or --source.`),this.name="OsvBloomNetworkError"}}class et extends Error{static{l(this,"OsvBloomIntegrityError")}static{s(this,"OsvBloomIntegrityError")}cause="OSV_BLOOM_INTEGRITY";constructor(o,t){super(`osv-bloom filter.bin sha256 mismatch (expected ${o}, got ${t}). Refusing to install a corrupted filter.`),this.name="OsvBloomIntegrityError"}}class v extends Error{static{l(this,"OsvBloomManifestError")}static{s(this,"OsvBloomManifestError")}cause="OSV_BLOOM_MANIFEST";constructor(o){super(`osv-bloom manifest invalid: ${o}`),this.name="OsvBloomManifestError"}}class ot extends Error{static{l(this,"OsvBloomCacheMissError")}static{s(this,"OsvBloomCacheMissError")}cause="OSV_BLOOM_CACHE_MISS";constructor(o){super(`No osv-bloom cache at ${o}. Run 'vis advisories bloom sync' first.`),this.name="OsvBloomCacheMissError"}}const b=s(e=>{const o=z("vis",{create:!0,cwd:e})??w(e,"node_modules",".cache","vis");return w(o,"osv-bloom")},"resolveOsvBloomCacheDir"),h=s(e=>w(e,"filter.bin"),"filterPath"),R=s(e=>w(e,"manifest.json"),"manifestPath"),T=s(e=>w(e,"state.json"),"statePath"),st=s((e,o)=>{let t;try{t=new URL(e)}catch{throw new g(e)}if(!t.host)throw new g(e);if(t.protocol!=="https:")throw new g(`${t.protocol}//${t.host}`);if(!new Set([...tt,...o??[]]).has(t.host))throw new g(t.host);return t},"validateOsvBloomSource"),ht=s(async e=>{const o=Date.now(),t=e.cacheDir??b(e.workspaceRoot);await L(t,{recursive:!0});const r=st(e.source,e.allowedHosts),a=new URL("manifest.json",$(r.toString())),i=new URL("filter.bin",$(r.toString())),n=await x(a,{method:"GET"});if(!n.ok)throw new B(a.toString(),n.status);const S=await n.text(),c=k(S),m=await C(t);if(!e.force&&m?.setDigestSha256===c.setDigestSha256&&p(h(t)))return{bytesOnDisk:(await I(h(t))).size,cacheDir:t,durationMs:Date.now()-o,manifest:c,upToDate:!0};const E={};!e.force&&m?.filterEtag&&(E.headers={"if-none-match":m.filterEtag});const f=await x(i,{...E,method:"GET"});if(f.status===304&&m&&p(h(t)))return await A(t,S,{fetchedAtIso:new Date().toISOString(),filterEtag:m.filterEtag,setDigestSha256:c.setDigestSha256}),{bytesOnDisk:(await I(h(t))).size,cacheDir:t,durationMs:Date.now()-o,manifest:c,upToDate:!0};if(!f.ok||!f.body)throw new B(i.toString(),f.status);const u=Buffer.from(await f.arrayBuffer());e.onProgress&&e.onProgress(u.length,u.length);const D=rt(u);if(D!==c.filterSha256)throw new et(c.filterSha256,D);if(u.length!==c.bloomByteLen)throw new v(`filter.bin length ${u.length} does not match manifest.bloom_byte_len ${c.bloomByteLen}`);const j=f.headers.get("etag")??void 0;return await _(h(t),u),await A(t,S,{fetchedAtIso:new Date().toISOString(),filterEtag:j,setDigestSha256:c.setDigestSha256}),{bytesOnDisk:u.length,cacheDir:t,durationMs:Date.now()-o,manifest:c,upToDate:!1}},"syncOsvBloom"),ft=s(async(e,o)=>{const t=o?.cacheDir??b(e),r=h(t);if(!p(r)){if(o?.softFail)return null;throw new ot(t)}const a=await y(r);return Y(a)},"loadOsvBloomHandle");s((e,o,t)=>Q(e,o,t),"probeOsvBloom");const mt=s((e,o)=>X(e,o),"probeOsvBloomBatch"),dt=s(async(e,o)=>{const t=o??b(e);if(!p(h(t)))return{cacheDir:t,present:!1};let r,a;try{r=k(await y(R(t),"utf8"))}catch{}try{a=await C(t)}catch{}return{cacheDir:t,fetchedAtIso:a?.fetchedAtIso,manifest:r,present:!0}},"getOsvBloomStatus");s(async(e,o)=>{const t=o??b(e);await q(t,{force:!0,recursive:!0})},"clearOsvBloomCache");const k=s(e=>{let o;try{o=JSON.parse(e)}catch(i){throw new v(i instanceof Error?i.message:String(i))}const t=s(i=>{const n=o[i];if(typeof n!="number"||Number.isNaN(n))throw new v(`field '${i}' missing or non-numeric`);return n},"requireNumber"),r=s(i=>{const n=o[i];if(typeof n!="string"||n.length===0)throw new v(`field '${i}' missing or empty`);return n},"requireString"),a=t("format_version");if(a!==1)throw new v(`unsupported format_version ${a} (this build expects v1)`);return{advisoryCount:t("advisory_count"),bloomByteLen:t("bloom_byte_len"),bloomKHashes:t("bloom_k_hashes"),bloomMBits:t("bloom_m_bits"),builtAtRfc3339:r("built_at_rfc3339"),builtAtUnix:t("built_at_unix"),entryCount:t("entry_count"),filterSha256:r("filter_sha256"),formatVersion:a,setDigestSha256:r("set_digest_sha256"),sourceUrl:r("source_url"),targetFpr:t("target_fpr")}},"parseManifest"),C=s(async e=>{try{const o=await y(T(e),"utf8"),t=JSON.parse(o);return typeof t.setDigestSha256!="string"||typeof t.fetchedAtIso!="string"?void 0:{fetchedAtIso:t.fetchedAtIso,filterEtag:typeof t.filterEtag=="string"?t.filterEtag:void 0,setDigestSha256:t.setDigestSha256}}catch{return}},"readState"),A=s(async(e,o,t)=>{await _(R(e),Buffer.from(o,"utf8")),await _(T(e),Buffer.from(`${JSON.stringify(t,void 0,2)}
|
|
2
|
+
`,"utf8"))},"persistManifestAndState"),_=s(async(e,o)=>{await L(W(e),{recursive:!0});const t=`${e}.${process.pid}.${H()}.tmp`;try{await G(t,o),await J(t,e)}catch(r){throw await K(t).catch(()=>{}),r}},"atomicWrite"),rt=s(e=>F("sha256").update(e).digest("hex"),"sha256Hex"),$=s(e=>e.endsWith("/")?e:`${e}/`,"ensureTrailingSlash"),it=3e4,x=s(async(e,o)=>{try{return await fetch(e,{...o,signal:AbortSignal.timeout(it)})}catch(t){throw new B(e.toString(),t instanceof Error?t.message:String(t))}},"safeFetch");export{ut as D,ot as O,dt as g,ft as l,mt as p,ht as s};
|