@visulima/vis 2.0.0 → 2.0.2
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 +41 -0
- package/LICENSE.md +862 -170
- package/README.md +1 -1
- package/dist/bin.js +1 -1
- package/dist/binx.js +2 -2
- package/dist/config/index.d.ts +1817 -1811
- package/dist/generate/index.d.ts +39 -39
- package/dist/packem_chunks/CONFIG_FILES.js +5 -5
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/cache-attestation.js +1 -1
- package/dist/packem_chunks/catalog.js +69 -67
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +150 -145
- package/dist/packem_chunks/detect.js +3 -3
- package/dist/packem_chunks/detect2.js +4 -4
- package/dist/packem_chunks/dispatch.js +3 -3
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/extra-files.js +3 -3
- package/dist/packem_chunks/fix.js +9 -9
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +5 -5
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +6 -6
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -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 +1 -1
- package/dist/packem_chunks/handler20.js +2 -2
- package/dist/packem_chunks/handler21.js +2 -2
- package/dist/packem_chunks/handler22.js +10 -10
- package/dist/packem_chunks/handler23.js +1 -1
- 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 +3 -3
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +2 -3
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler31.js +2 -2
- package/dist/packem_chunks/handler35.js +3 -3
- package/dist/packem_chunks/handler4.js +4 -4
- package/dist/packem_chunks/handler40.js +10 -10
- package/dist/packem_chunks/handler42.js +3 -3
- package/dist/packem_chunks/handler43.js +3 -3
- package/dist/packem_chunks/handler5.js +5 -5
- package/dist/packem_chunks/handler50.js +5 -5
- package/dist/packem_chunks/handler51.js +13 -13
- package/dist/packem_chunks/handler52.js +3 -3
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +2 -2
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler57.js +5 -5
- package/dist/packem_chunks/handler58.js +4 -4
- package/dist/packem_chunks/handler59.js +8 -8
- package/dist/packem_chunks/handler6.js +7 -7
- package/dist/packem_chunks/handler60.js +2 -2
- package/dist/packem_chunks/handler61.js +13 -13
- package/dist/packem_chunks/handler62.js +4 -4
- package/dist/packem_chunks/handler63.js +3 -3
- package/dist/packem_chunks/handler64.js +4 -4
- package/dist/packem_chunks/handler65.js +6 -6
- package/dist/packem_chunks/handler66.js +2 -2
- package/dist/packem_chunks/handler67.js +9 -9
- package/dist/packem_chunks/handler68.js +7 -7
- package/dist/packem_chunks/handler69.js +24 -24
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +6 -6
- package/dist/packem_chunks/handler71.js +14 -14
- package/dist/packem_chunks/handler72.js +47 -47
- package/dist/packem_chunks/handler73.js +9 -9
- package/dist/packem_chunks/handler74.js +27 -27
- package/dist/packem_chunks/handler75.js +3 -3
- package/dist/packem_chunks/handler76.js +8 -8
- package/dist/packem_chunks/handler77.js +63 -64
- package/dist/packem_chunks/handler78.js +25 -25
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +5 -5
- package/dist/packem_chunks/heal.js +8 -8
- package/dist/packem_chunks/help-command.js +46 -46
- package/dist/packem_chunks/index2.js +5 -5
- package/dist/packem_chunks/index3.js +3 -3
- package/dist/packem_chunks/index4.js +11 -11
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +2 -2
- package/dist/packem_chunks/list.js +2 -2
- package/dist/packem_chunks/loader.js +4 -4
- package/dist/packem_chunks/orchestrator.js +14 -14
- package/dist/packem_chunks/pre-mode.js +2 -2
- package/dist/packem_chunks/prompts.js +3 -3
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/publish-guards.js +1 -1
- package/dist/packem_chunks/registry.js +17 -17
- package/dist/packem_chunks/resolveFormatter.js +5 -5
- package/dist/packem_chunks/shell-runner.js +1 -1
- package/dist/packem_chunks/snapshot.js +2 -2
- package/dist/packem_chunks/stage-publisher.js +1 -1
- package/dist/packem_chunks/staged-registry.js +2 -2
- package/dist/packem_chunks/state.js +3 -3
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tar.js +3 -3
- package/dist/packem_chunks/tripwire.js +2 -2
- package/dist/packem_chunks/ts-loader.js +9 -9
- package/dist/packem_chunks/verify-lockfile.js +2 -2
- package/dist/packem_chunks/workspace.js +2 -2
- package/dist/packem_shared/advisories-CCBGdU8U.js +1 -0
- package/dist/packem_shared/affected-selection-Dj-ymxhw.js +1 -0
- package/dist/packem_shared/affected-shas-PwkVbPch.js +1 -0
- package/dist/packem_shared/ai-analysis-bGCAc1jR.js +68 -0
- package/dist/packem_shared/{ai-fix-CLfWbyqY.js → ai-fix-DV5-dHBY.js} +9 -9
- package/dist/packem_shared/{augment-BVuj3ee7.js → augment-24KX2nkI.js} +4 -4
- package/dist/packem_shared/bin-CtzhnYMp.js +1 -0
- package/dist/packem_shared/build-scripts-w4SNeR7D.js +1 -0
- package/dist/packem_shared/{command-runtime-DTbo12cP.js → command-runtime-BLFPUYAT.js} +1 -1
- package/dist/packem_shared/cyclonedx-C4KaVTn1.js +4 -0
- package/dist/packem_shared/{dependency-scan-DZcSlSFp.js → dependency-scan-D_ona0Qm.js} +1 -1
- package/dist/packem_shared/{docker-69ybb6g7.js → docker-DaVs-9wK.js} +40 -40
- package/dist/packem_shared/{en-C26W78--.js → en-D3CfXlO7.js} +13 -13
- package/dist/packem_shared/failure-log-CTneNcio.js +2 -0
- package/dist/packem_shared/giget-CAxjpwew.js +2 -0
- package/dist/packem_shared/glob-BUjyjdE8-C4M8e02u.js +1 -0
- package/dist/packem_shared/index-BWl4DbMp.js +1 -0
- package/dist/packem_shared/index-CTMU29dI.js +1 -0
- package/dist/packem_shared/index-uBVnF4ji.js +35 -0
- package/dist/packem_shared/index.server-CusjRLCh.js +2 -0
- package/dist/packem_shared/{interface.d-B7VK2rcH.d.ts → interface.d-CRqRz4jt.d.ts} +39 -39
- package/dist/packem_shared/{interface.d-Cezzifoh.d.ts → interface.d-CrHOtJc1.d.ts} +37 -37
- package/dist/packem_shared/lifecycle-B8A2T3gx.js +2 -0
- package/dist/packem_shared/lockfile-Bccery3L.js +1 -0
- package/dist/packem_shared/main-D_cam4hv.js +1 -0
- package/dist/packem_shared/manifests-BDkwiVbh.js +1 -0
- package/dist/packem_shared/{min-release-age-hK604veF.js → min-release-age-OaYpLwux.js} +2 -2
- package/dist/packem_shared/missing-package-json-BqS-OnKd.js +1 -0
- package/dist/packem_shared/{native-config-sync-DDKjAy0i.js → native-config-sync-Ds1FtcrM.js} +7 -7
- package/dist/packem_shared/osv-bloom-pKp7urSB.js +2 -0
- package/dist/packem_shared/package-version-C47v64aB.js +4 -0
- package/dist/packem_shared/packument-HBVbyf7x.js +1 -0
- package/dist/packem_shared/pm-runner-C6eTANt1.js +1 -0
- package/dist/packem_shared/project-name-filter-CJ3XX2TI.js +7 -0
- package/dist/packem_shared/prompt-BSAy8SMH.js +1 -0
- package/dist/packem_shared/{provenance-CRBV9cko.js → provenance-D4Cza8cp.js} +1 -1
- package/dist/packem_shared/{readJsonSync-DuMMeB3s-B9cGBVbJ.js → readJsonSync-DweZd5ZA-0eZh9sGm.js} +1 -1
- package/dist/packem_shared/registry-keys-C0ez2VND.js +1 -0
- package/dist/packem_shared/{resolve-explicit-BX6aMYl-.js → resolve-explicit-BbT764KS.js} +1 -1
- package/dist/packem_shared/{resolve-runtime-COyiEML3.js → resolve-runtime-D_vZovbB.js} +1 -1
- package/dist/packem_shared/run-file-DyPFFN9U.js +1 -0
- package/dist/packem_shared/{runtime-check-fzDkedMW.js → runtime-check-D4um-yQq.js} +1 -1
- package/dist/packem_shared/s1ngularity-St6dhKiq.js +1 -0
- package/dist/packem_shared/scan-progress-q-N2JtIp.js +2 -0
- package/dist/packem_shared/selectors-Ce_6UAoY.js +3 -0
- package/dist/packem_shared/signatures-Dyeyg1q9.js +2 -0
- package/dist/packem_shared/subtree-DSm0QEoE.js +2 -0
- package/dist/packem_shared/target-merge-Cfy7c__2.js +11 -0
- package/dist/packem_shared/target-options-7XcbqGDe.js +1 -0
- package/dist/packem_shared/toolchain-C_pNMBM6.js +5 -0
- package/dist/packem_shared/typosquats-xzcAGPiM.js +1 -0
- package/dist/packem_shared/{use-measured-height-DfNxp6nf.js → use-measured-height-CBjN0fle.js} +1 -1
- package/dist/packem_shared/verify-Dve9PQj3.js +1 -0
- package/dist/packem_shared/{vis-update-app-De8JjZm0.js → vis-update-app-DMAC2pPf.js} +1 -1
- package/dist/packem_shared/vis-user-error-xmha3L4n.js +30 -0
- package/dist/packem_shared/watch-BXOOX7lx.js +1 -0
- package/dist/packem_shared/watch-loop-Q7UpkVbr.js +11 -0
- package/dist/release/core/package-managers/index.d.ts +2 -2
- package/dist/release/core/version-actions/index.d.ts +10 -10
- package/dist/release/index.d.ts +60 -60
- package/dist/release/plugin-sdk.d.ts +80 -80
- package/dist/release/presets.d.ts +148 -148
- package/dist/release/types.d.ts +840 -840
- package/dist/runtime/preload.js +1 -1
- package/index.d.ts +204 -204
- package/index.js +52 -52
- package/package.json +16 -16
- package/schemas/project.schema.json +4 -1
- package/schemas/vis-config.schema.json +9 -3
- package/dist/packem_shared/advisories-B76fBVL-.js +0 -1
- package/dist/packem_shared/affected-shas-BOeR4vEc.js +0 -1
- package/dist/packem_shared/ai-analysis-D7HOdUwd.js +0 -68
- package/dist/packem_shared/bin-CkfFJCAM.js +0 -1
- package/dist/packem_shared/build-scripts-CfAqHBlq.js +0 -1
- package/dist/packem_shared/cyclonedx--L7NbMBH.js +0 -4
- package/dist/packem_shared/failure-log-BZQqxffZ.js +0 -2
- package/dist/packem_shared/giget-DVTFJlbR.js +0 -2
- package/dist/packem_shared/glob-DMbPwGSj-D2Hk3lFG.js +0 -1
- package/dist/packem_shared/index-2LCHaVNX.js +0 -35
- package/dist/packem_shared/index-B0EsgdzO.js +0 -1
- package/dist/packem_shared/index-Bhzio2RB.js +0 -1
- package/dist/packem_shared/index-Bq6YEpiq.js +0 -28
- package/dist/packem_shared/index.server-qvZ-cy29.js +0 -2
- package/dist/packem_shared/lifecycle-BcCMt9wn.js +0 -2
- package/dist/packem_shared/lockfile-Cwt0Nwr0.js +0 -1
- package/dist/packem_shared/main-B3juSU5z.js +0 -1
- package/dist/packem_shared/manifests-BshBdSb-.js +0 -1
- package/dist/packem_shared/missing-package-json-Cu0iWMT2.js +0 -1
- package/dist/packem_shared/osv-bloom-DMhXP184.js +0 -2
- package/dist/packem_shared/package-version-TsxLc6w2.js +0 -4
- package/dist/packem_shared/packument-CtVAoNo7.js +0 -1
- package/dist/packem_shared/pm-runner-CfyxALPK.js +0 -1
- package/dist/packem_shared/prompt-DjXHVgYU.js +0 -1
- package/dist/packem_shared/registry-keys-Ci2keQNi.js +0 -1
- package/dist/packem_shared/run-file-CTJfIZ0I.js +0 -1
- package/dist/packem_shared/s1ngularity-Cq1cCSpU.js +0 -1
- package/dist/packem_shared/scan-progress-DQ9qIGzr.js +0 -2
- package/dist/packem_shared/selectors-B9dOMIMq.js +0 -3
- package/dist/packem_shared/signatures-DvD1E8Xa.js +0 -2
- package/dist/packem_shared/subtree-C7bZuiSQ.js +0 -2
- package/dist/packem_shared/target-merge-Dg25Izl5.js +0 -11
- package/dist/packem_shared/target-options-aPqByoww.js +0 -1
- package/dist/packem_shared/toolchain-CiaW3bx4.js +0 -5
- package/dist/packem_shared/typosquats-CRnvlYPw.js +0 -1
- package/dist/packem_shared/verify-23b6IfSg.js +0 -1
- package/dist/packem_shared/watch-B3P2dwoG.js +0 -1
- package/dist/packem_shared/watch-loop-B3_O8hF-.js +0 -11
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import{createRequire as Dt}from"node:module";import{t as fe,g as Tt,p as G,b as jt,i as Ae,a as Rt,h as Bt,c as Wt,u as Se}from"./package-version-TsxLc6w2.js";const Ut=Dt(import.meta.url),ne=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Vt=t=>{if(typeof ne<"u"&&ne.versions&&ne.versions.node){const[e,n]=ne.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ne.getBuiltinModule(t)}return Ut(t)},{createRequire:Ce}=Vt("node:module"),zt=16,ge=32,Ft=64,j=128,he="positionals",qt=Ce(import.meta.url),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Gt=t=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[e,n]=ie.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ie.getBuiltinModule(t)}return qt(t)},{createRequire:at}=Gt("node:module"),Ht=globalThis.process??Object.create(null),Me={versions:{}},ke=new Proxy(Ht,{get(t,e){if(e in t)return t[e];if(e in Me)return Me[e]}}),Jt=t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
-
`),Kt=(t,e,n,i)=>{const s={column:0,line:-1,...t.start},o={...s,...t.end},c=s.line,a=s.column,u=o.line,r=o.column;let l=Math.max(c-(n+1),0),d=Math.min(e.length,u+i);c===-1&&(l=0),u===-1&&(d=e.length);const p=u-c,f={};if(p)for(let h=0;h<=p;h++){const g=h+c;if(!a)f[g]=!0;else if(h===0){const $=e[g-1]?.length;f[g]=[a,($??0)-a+1]}else if(h===p)f[g]=[0,r];else{const $=e[g-h]?.length;f[g]=[0,$]}}else a===r?f[c]=a?[a,0]:!0:f[c]=[a,(r??0)-(a??0)];return{end:d,markerLines:f,start:l}},Yt=ke.platform==="win32"&&!ke.env?.WT_SESSION?">":"❯",Xt=(t,e,n)=>{const i={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:h=>h,marker:h=>h,message:h=>h,...n?.color}},s=typeof e.start.column=="number";let o=(t.includes("\r")?Jt(t):t).split(`
|
|
3
|
-
`);typeof i.tabWidth=="number"&&t.includes(" ")&&(o=o.map(h=>h.replaceAll(" "," ".repeat(i.tabWidth))));const{end:c,markerLines:a,start:u}=Kt(e,o,i.linesAbove,i.linesBelow),r=String(c).length,{gutter:l,marker:d,message:p}=i.color;let f=o.slice(u,c).map((h,g)=>{const $=u+1+g,w=a[$],y=String($).padStart(r),x=!a[$+1],N=` ${y}${i.showGutter?" |":""}`;if(w){let E="";if(Array.isArray(w)){const I=h.replaceAll(/[^\t]/g," ").slice(0,Math.max(w[0]-1,0)),O=w[1]||1;E=[`
|
|
4
|
-
`,i.prefix+l(N.replaceAll(/\d/g," "))," ",I,d("^").repeat(O)].join(""),x&&i.message&&(E+=` ${p(i.message)}`)}return[i.prefix+d(Yt),l(N),h.length>0?` ${h}`:"",E].join("")}return`${i.prefix} ${l(N)}${h.length>0?` ${h}`:""}`}).join(`
|
|
5
|
-
`);return i.message&&!s&&(f=`${i.prefix+" ".repeat(r+1)+i.message}
|
|
6
|
-
${f}`),f},Qt=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&Qt.set("AggregateError",AggregateError);const Zt=at(import.meta.url),oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,en=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 Zt(t)};en("node:util");const tn=()=>ke.env?.DEBUG==="true",J=(t,...e)=>{if(tn()){const n=e.map(i=>typeof i=="function"?i():i);console.debug(`error:parse-stacktrace: ${t}`,...n)}},K="<unknown>",nn=/^(?:node:internal\/|node:|internal\/)/,on=t=>t!==void 0&&nn.test(t),sn=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,rn=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,an=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,ln=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,cn=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,un=/in\s(.*)\s\(at\s(.+)\)\sat/,pn=/^(?:.*@)?(.*):(\d+):(\d+)$/,hn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,dn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,fn=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,Pe=/\(error: ([^)]*)\)/,mn=/at\s/,gn=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,wn=/Error: |AggregateError:/,lt=/^Anonymous function$/,yn=/^\s*in\s.*/,vn=/^.*?\s*at\s.*/,$n=/^.*?\s*@.*|\[native code\]/,ct=(t,e)=>{const n=t.includes("safari-extension"),i=t.includes("safari-web-extension");return n||i?[t.includes("@")?t.split("@")[0]:K,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},ut=(t,e)=>{const n=an.exec(e);n&&(t.file=n[1],t.line=+n[2],t.column=+n[3])},xn=t=>{const e=un.exec(t);if(e){J(`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]??K,raw:t,type:void 0}}const n=cn.exec(t);if(n){J(`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(mn,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??K,raw:t,type:t.startsWith("internal")?"internal":void 0};return ut(i,`${n[2]}:${n[3]}:${n[4]}`),i}},bn=t=>{const e=sn.exec(t);if(e){J(`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 s,o;if(i){const r=rn.exec(t);if(r){const l=gn.exec(r[1]);l?(e[2]=l[4]??l[1],e[3]=l[5]??l[2],e[4]=l[3]):r[2]&&(e[2]=r[1]),r[2]&&(s={column:r[4]?+r[4]:void 0,file:r[2],line:r[3]?+r[3]:void 0,methodName:"eval",raw:t,type:"eval"})}else{const l=ln.exec(t);l&&(o={column:l[4]?+l[4]:void 0,file:l[2],line:l[3]?+l[3]:void 0},s={column:l[6]?+l[6]:void 0,file:l[1],line:l[5]?+l[5]:void 0,methodName:"eval",raw:l[0],type:"eval"})}}const[c,a]=ct(e[1]?e[1].replace(lt,"<anonymous>"):K,e[2]),u={column:e[4]?+e[4]:void 0,evalOrigin:s,file:a,line:e[3]?+e[3]:void 0,methodName:c,raw:t,type:i?"eval":n?"native":on(a)?"internal":void 0};return o?(u.column=o.column,u.file=o.file,u.line=o.line):ut(u,`${a}:${e[3]}:${e[4]}`),u}},Nn=(t,e)=>{const n=hn.exec(t);if(n){J(`parse gecko error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`);const i=n[3]?.includes(" > eval"),s=i&&n[3]&&dn.exec(n[3]);let o;i&&s&&(n[3]=s[1],o={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:t,type:"eval"},n[4]=s[2]);const[c,a]=ct(n[1]?n[1].replace(lt,"<anonymous>"):K,n[3]);let u;(e?.type==="safari"||!i&&e?.type==="firefox")&&e.column?u=e.column:!i&&n[5]&&(u=+n[5]);let r;return(e?.type==="safari"||!i&&e?.type==="firefox")&&e.line?r=e.line:n[4]&&(r=+n[4]),{column:u,evalOrigin:o,file:a,line:r,methodName:c,raw:t,type:i?"eval":a.includes("[native code]")?"native":void 0}}},An=(t,e)=>{const n=fn.exec(t);if(!(n&&n[2].includes(" > eval"))&&n)return J(`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]||K,raw:t,type:void 0}},kn=t=>{const e=pn.exec(t);if(e)return J(`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:K,raw:t,type:void 0}},pt=(t,{filter:e,frameLimit:n=50}={})=>{const i=t;let s=(typeof i.stacktrace=="string"?i.stacktrace:t.stack??"").split(`
|
|
7
|
-
`).map(o=>(Pe.test(o)?o.replace(Pe,"$1"):o).trim()).filter(o=>!wn.test(o)&&o!=="eval code");return e&&(s=s.filter(o=>e(o))),s=s.slice(0,n),s.reduce((o,c,a)=>{if(!c||c.length>1024)return o;let u;if(yn.test(c))u=xn(c);else if(vn.test(c))u=bn(c);else if($n.test(c)){let r;if(a===0){const l=t,d=l.columnNumber,p=l.lineNumber,f=l.line,h=l.column;d||p?r={column:d,line:p,type:"firefox"}:(f||h)&&(r={column:h,line:f,type:"safari"})}u=An(c,r)??Nn(c,r)}else u=kn(c);return u?o.push(u):J(`parse error stack line: "${c}"`,"not parser found"),o},[])},En=at(import.meta.url),Z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Oe=t=>{if(typeof Z<"u"&&Z.versions&&Z.versions.node){const[e,n]=Z.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return Z.getBuiltinModule(t)}return En(t)},{existsSync:Cn,readFileSync:On}=Oe("node:fs"),{relative:_n,resolve:De,sep:In}=Oe("node:path"),{cwd:Ln}=Z,{fileURLToPath:Sn}=Oe("node:url"),Y=(t,e,n)=>n===0?t:e===" "?t+" ".repeat(n):t+" ".repeat(e*n),ht=t=>t.replaceAll("\\","/"),Mn=(t,e)=>{const n=t.replace("async file:","file:");return ht(_n(e,n.startsWith("file:")?Sn(n):n))},Pn=(t,e,n)=>{if(e)return n.title(t.message);const i=t.message?`: ${t.message}`:"";return n.title(t.name+i)},dt=(t,{color:e,hideErrorTitle:n,indentation:i,prefix:s},o)=>`${Y(s,i,o)}${Pn(t,n,e)}
|
|
8
|
-
`,ft=(t,{color:e,indentation:n,prefix:i},s)=>{if(t.hint===void 0)return;const o=Y(i,n,s);let c="";if(Array.isArray(t.hint))for(const a of t.hint)c+=`${o+a}
|
|
9
|
-
`;else c+=o+t.hint;return e.hint(c)},mt=(t,e)=>{if(!e||t.file===void 0||t.line===void 0)return{trace:t};try{const n=e({column:t.column,file:t.file,line:t.line});return n?{source:n.source,trace:{...t,column:n.column??t.column,file:n.file??t.file,line:n.line??t.line}}:{trace:t}}catch{return{trace:t}}},_e=(t,e,n=0)=>{const{color:i,cwd:s,displayShortPath:o,indentation:c,prefix:a}=e,{trace:u}=mt(t,e.sourceMap),r=o?Mn(u.file,s):ht(u.file),{fileLine:l,method:d}=i;return`${Y(a,c,n)}at ${u.methodName?`${d(u.methodName)} `:""}${l(r)}:${l(u.line?.toString()??"")}`},Dn=(t,e)=>{if(e.allowAllFilePaths)return!0;const n=De(e.cwd),i=De(n,t);return i===n||i.startsWith(n+In)},gt=(t,e,n)=>{const{color:i,indentation:s,linesAbove:o,linesBelow:c,prefix:a,showGutter:u,showLineNumbers:r,tabWidth:l}=e,{source:d,trace:p}=mt(t,e.sourceMap);if(p.file===void 0)return;let f;if(d===void 0){const h=p.file.replace("file://","");if(!Dn(h,e)||!Cn(h))return;f=On(h,"utf8")}else f=d;return Xt(f,{start:{column:p.column,line:p.line}},{color:i,linesAbove:o,linesBelow:c,prefix:Y(a,s,n),showGutter:u,showLineNumbers:r,tabWidth:l})},wt=(t,e,n)=>{if(t.errors.length===0)return;let i=`${Y(e.prefix,e.indentation,n)}Errors:
|
|
10
|
-
|
|
11
|
-
`,s=!0;for(const o of t.errors)s?s=!1:i+=`
|
|
12
|
-
|
|
13
|
-
`,i+=vt(o,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},n+1);return`
|
|
14
|
-
${i}`},yt=(t,e,n,i=new Set)=>{i.add(t);let s=`${Y(e.prefix,e.indentation,n)}Caused by:
|
|
15
|
-
|
|
16
|
-
`;const o=t.cause;s+=dt(o,e,n);const c=pt(o).shift(),a=ft(o,e,n);if(a&&(s+=`${a}
|
|
17
|
-
`),c&&(s+=_e(c,e,n),!e.hideErrorCauseCodeView)){const u=gt(c,e,n);u!==void 0&&(s+=`
|
|
18
|
-
${u}`)}if(o instanceof AggregateError){const u=wt(o,e,n);u!==void 0&&(s+=`
|
|
19
|
-
${u}`)}return o.cause&&(s+=i.has(o)?`
|
|
20
|
-
${Y(e.prefix,e.indentation,n+1)}Caused by: [Circular]`:`
|
|
21
|
-
${yt(o,e,n+1,i)}`),`
|
|
22
|
-
${s}`},Un=(t,e)=>(t.length>0?`
|
|
23
|
-
`:"")+t.map(n=>_e(n,e)).join(`
|
|
24
|
-
`),vt=(t,e,n)=>{const i={allowAllFilePaths:!1,cwd:Ln(),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:c=>c,gutter:c=>c,hint:c=>c,marker:c=>c,message:c=>c,method:c=>c,title:c=>c,...e.color}},s=pt(t,{filter:e.filterStacktrace,frameLimit:i.framesMaxLimit}),o=s.shift();return[e.hideMessage?void 0:dt(t,i,n),ft(t,i,n),o?_e(o,i,n):void 0,o&&!i.hideErrorCodeView?gt(o,i,n):void 0,t instanceof AggregateError?wt(t,i,n):void 0,t.cause===void 0?void 0:yt(t,i,n),s.length>0?Un(s,i):void 0].filter(Boolean).join(`
|
|
25
|
-
`)},Vn=(t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return vt(t,e,0)};class te extends Error{loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:i,message:s,name:o,stack:c,title:a}){super(s,{cause:e}),this.title=a,this.name=o,this.stack=c??this.stack,this.loc=i,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}}class k extends te{code;context;constructor(e,n,i){super({message:e,name:"CerebroError"}),this.code=n,this.context=i}}const R=new Uint32Array(65536),Tn=(t,e)=>{const n=t.length,i=e.length,s=1<<n-1;let o=-1,c=0,a=n,u=n;for(;u--;)R[t.charCodeAt(u)]|=1<<u;for(u=0;u<i;u++){let r=R[e.charCodeAt(u)];const l=r|c;r|=(r&o)+o^o,c|=~(r|o),o&=r,c&s&&a++,o&s&&a--,c=c<<1|1,o=o<<1|~(l|c),c&=l}for(u=n;u--;)R[t.charCodeAt(u)]=0;return a},jn=(t,e)=>{const n=e.length,i=t.length,s=[],o=[],c=Math.ceil(n/32),a=Math.ceil(i/32);for(let h=0;h<c;h++)o[h]=-1,s[h]=0;let u=0;for(;u<a-1;u++){let h=0,g=-1;const $=u*32,w=Math.min(32,i)+$;for(let y=$;y<w;y++)R[t.charCodeAt(y)]|=1<<y;for(let y=0;y<n;y++){const x=R[e.charCodeAt(y)],N=o[y/32|0]>>>y&1,E=s[y/32|0]>>>y&1,I=x|h,O=((x|E)&g)+g^g|x|E;let m=h|~(O|g),v=g&O;m>>>31^N&&(o[y/32|0]^=1<<y),v>>>31^E&&(s[y/32|0]^=1<<y),m=m<<1|N,v=v<<1|E,g=v|~(I|m),h=m&I}for(let y=$;y<w;y++)R[t.charCodeAt(y)]=0}let r=0,l=-1;const d=u*32,p=Math.min(32,i-d)+d;for(let h=d;h<p;h++)R[t.charCodeAt(h)]|=1<<h;let f=i;for(let h=0;h<n;h++){const g=R[e.charCodeAt(h)],$=o[h/32|0]>>>h&1,w=s[h/32|0]>>>h&1,y=g|r,x=((g|w)&l)+l^l|g|w;let N=r|~(x|l),E=l&x;f+=N>>>i-1&1,f-=E>>>i-1&1,N>>>31^$&&(o[h/32|0]^=1<<h),E>>>31^w&&(s[h/32|0]^=1<<h),N=N<<1|$,E=E<<1|w,l=E|~(y|N),r=N&y}for(let h=d;h<p;h++)R[t.charCodeAt(h)]=0;return f},Rn=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return e.length===0?t.length:t.length<=32?Tn(t,e):jn(t,e)},Bn=Ce(import.meta.url),se=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Wn=t=>{if(typeof se<"u"&&se.versions&&se.versions.node){const[e,n]=se.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return se.getBuiltinModule(t)}return Bn(t)},{createRequire:zn}=Wn("node:module"),$t=String.raw,Ue=$t`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Fn=()=>new RegExp($t`\p{RI}{2}|(?)${Ue}(?:\u200D${Ue})*`,"gu");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const os=/^[ \t]*(?:\r\n|\r|\n)/,ss=/(?:\r\n|\r|\n)[ \t]*$/,rs=/^(?:[\r\n]|$)/,as=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,ls=/^[ \t]*[\r\n][ \t\r\n]*$/,cs=/\r\n|\n|\r/g,us=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,ps=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,z=Fn(),qn=/[-_./\s]+/g,de=/(\u001B\[[0-9;]*[a-z])/i,Ve=new RegExp("\\p{Script=Arabic}","u"),Gn=new RegExp("\\p{Script=Bengali}","u"),X=new RegExp("\\p{Script=Cyrillic}","u"),Hn=new RegExp("\\p{Script=Devanagari}","u"),Jn=new RegExp("\\p{Script=Ethiopic}","u"),we=new RegExp("\\p{Script=Greek}","u"),Te=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),Kn=new RegExp("\\p{Script=Gujarati}","u"),Yn=new RegExp("\\p{Script=Gurmukhi}","u"),je=new RegExp("\\p{Script=Hangul}","u"),Re=new RegExp("\\p{Script=Hebrew}","u"),Xn=new RegExp("\\p{Script=Hiragana}","u"),Be=new RegExp("\\p{Script=Han}","u"),Qn=new RegExp("\\p{Script=Kannada}","u"),Zn=new RegExp("\\p{Script=Katakana}","u"),ei=new RegExp("\\p{Script=Khmer}","u"),ti=new RegExp("\\p{Script=Lao}","u"),P=new RegExp("\\p{Script=Latin}","u"),ni=new RegExp("\\p{Script=Malayalam}","u"),ii=new RegExp("\\p{Script=Myanmar}","u"),oi=new RegExp("\\p{Script=Oriya}","u"),si=new RegExp("\\p{Script=Sinhala}","u"),ri=new RegExp("\\p{Script=Tamil}","u"),ai=new RegExp("\\p{Script=Telugu}","u"),li=new RegExp("\\p{Script=Thai}","u"),ci=new RegExp("\\p{Script=Tibetan}","u"),We=/[\u02BB\u02BC\u0027]/u,ui=t=>t.replace(z,"");let pi=class{capacity;cache;constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.capacity){const i=this.cache.keys().next().value;i!==void 0&&this.cache.delete(i)}this.cache.set(e,n)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}};const hi=zn(import.meta.url),re=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,di=t=>{if(typeof re<"u"&&re.versions&&re.versions.node){const[e,n]=re.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return re.getBuiltinModule(t)}return hi(t)},{stripVTControlCharacters:fi}=di("node:util"),ye=new pi(1e3),mi=/[.*+?^${}()|[\]\\]/g,gi=t=>{const e=t.join("");if(ye.has(e)){const s=ye.get(e);return s.lastIndex=0,s}const n=t.map(s=>s.replaceAll(mi,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return ye.set(e,i),i},wi=t=>{const e=[];let n=0,i;for(z.lastIndex=0;(i=z.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=z.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},yi=/[ČŠŽĐ]/i,xt=new Uint8Array(128),bt=new Uint8Array(128),Nt=new Uint8Array(128);for(let t=0;t<128;t++)xt[t]=t>=65&&t<=90?1:0,bt[t]=t>=97&&t<=122?1:0,Nt[t]=t>=48&&t<=57?1:0;const ve=t=>xt[t],ze=t=>bt[t],$e=t=>Nt[t],B=(t,e,n,i,s)=>{if(t.length===0)return[];let o=!1;const c=Object.values(e);for(const f of c)if(f(t[0])){o=!0;break}if(!o&&!n)return[t];const a=[...t],u=[];let r=a[0],l="other";const d=Object.entries(e);for(const f of d){const[h,g]=f;if(g(a[0])){l=h;break}}let p=n&&i?a[0]===a[0].toLocaleUpperCase(i):!1;for(let f=1;f<a.length;f++){const h=a[f];let g="other";for(const y of d){const[x,N]=y;if(N(h)){g=x;break}}const $=n&&i?h===h.toLocaleUpperCase(i):!1;let w=!1;s?w=s(l,g,p,$,h,f,a):(l!==g&&l!=="other"&&g!=="other"&&(w=!0),n&&g!=="other"&&!p&&$&&(w=!0)),w?(u.push(r),r=h):r+=h,l=g,n&&(p=$)}return r&&r.length>0&&u.push(r),u.length>0?u:[t]},vi=(t,e,n,i)=>{if(n.size===0)return e;for(const s of n)if(t.startsWith(s,e))return i.push(s),e+s.length;return e},At=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const i=[],s=t.length;for(let o=1;o<s;o++){const c=vi(t,n,e,i);if(c!==n){n=c,o=n-1;continue}const a=t.codePointAt(o-1),u=t.codePointAt(o),r=a&&a<128&&ve(a),l=u&&u<128&&ve(u),d=a&&a<128&&ze(a),p=a&&a<128&&$e(a),f=u&&u<128&&$e(u);if(d&&l){i.push(t.slice(n,o)),n=o;continue}if(p&&!f||!p&&f){i.push(t.slice(n,o)),n=o;continue}if(f&&!p){let h=!1,g=!1;if(o+1<s){const $=t.codePointAt(o+1);h=$&&$<128&&ve($),g=$&&$<128&&$e($)}if(!g&&h){i.push(t.slice(n,o),t.slice(o,o+1)),n=o+1;continue}}if(o+1<s){const h=t.codePointAt(o+1),g=h&&h<128&&ze(h);if(r&&l&&g){const $=t.slice(n,o+1);e.has($)||(i.push(t.slice(n,o)),n=o)}}}return n<s&&i.push(t.slice(n)),i.filter(o=>o!=="")},kt=(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 r=[...t],l=r.length,d=[];let p=r[0],f=r[0]===r[0].toLocaleUpperCase(e),h=f,g=f?0:-1;for(let $=1;$<l;$++){const w=r[$],y=w===w.toLocaleUpperCase(e);if(y===f)p+=w;else if(y)p&&p.length>0&&(d.push(p),p=w),h=!0,g=$;else{if(h&&$-g>1){const x=r[$-1],N=p.slice(0,-1);N&&N.length>0&&d.push(N),p=x+w}else p+=w;h=!1,g=-1}f=y}return p&&p.length>0&&d.push(p),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!X.test(t)&&!P.test(t))return[t];const r=[...t],l=r.length,d=[];let p=r[0];const f=r[0];let h;X.test(f)?h=1:P.test(f)?h=2:h=0;let g=f===f.toLocaleUpperCase(e);for(let w=1;w<l;w++){const y=r[w];let x;X.test(y)?x=1:P.test(y)?x=2:x=0;const N=y===y.toLocaleUpperCase(e);h!==x&&(h===1||h===2)&&(x===1||x===2)||x===h&&!g&&N?(d.push(p),p=y):p+=y,h=x,g=N}p&&p.length>0&&d.push(p);const $=[];for(let w=0;w<d.length;w++)w<d.length-1&&d[w].length===1&&P.test(d[w])&&X.test(d[w+1][0])?($.push(d[w]+d[w+1]),w+=1):$.push(d[w]);return $}if(e.startsWith("el")){if(!we.test(t)&&!P.test(t))return[t];const r=[];Te.lastIndex=0;let l;for(;(l=Te.exec(t))!==null;)r.push(l[0]);r.length===0&&r.push(t);const d=[];if(r.length===1){const p=r[0];if(!p||!we.test(p[0])||p.length===1)return[p??t]}for(const p of r){if(!p)continue;if(!we.test(p[0])||p.length===1){d.push(p);continue}const f=p.length;let h=p[0],g=p[0]===p[0].toLocaleUpperCase(e);for(let $=1;$<f;$++){const w=p[$],y=w===w.toLocaleUpperCase(e);!g&&y?(d.push(h),h=w):h+=w,g=y}h&&d.push(h)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const r=e.startsWith("ja"),l=r?{hiragana:p=>Xn.test(p),kanji:p=>Be.test(p),katakana:p=>Zn.test(p),latin:p=>P.test(p)}:{hangul:p=>je.test(p),latin:p=>P.test(p)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(r){const p=B(t,l,!1,e,(h,g)=>h==="hiragana"&&g==="katakana"||h==="katakana"&&g==="hiragana"||h==="hiragana"&&g==="latin"||h==="katakana"&&g==="latin"||h==="kanji"&&g==="latin"||h==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),f=[];for(const h of p){const g=h;g.length===1&&d.has(g)&&f.length>0?f[f.length-1]=f.at(-1)+g:f.push(g)}return f.length>0?f:[t]}return B(t,l,!1,e,(p,f)=>p==="hangul"&&f==="latin"||p==="latin"&&f==="hangul")}if(e.startsWith("sl")){const r=[...t],l=r.length,d=[];let p=r[0],f=r[0]===r[0].toLocaleUpperCase(e);for(let h=1;h<l;h++){const g=r[h],$=g===g.toLocaleUpperCase(e),w=yi.test(g),y=h<l-1&&r[h+1]===r[h+1].toLocaleUpperCase(e);!f&&$||w&&y?(d.push(p),p=g,w&&y&&(d.push(p),p="")):p+=g,f=$}return p&&p.length>0&&d.push(p),d}if(e.startsWith("zh"))return B(t,{han:r=>Be.test(r),latin:r=>P.test(r)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const r=l=>Re.test(l)||Ve.test(l);return B(t,{latin:l=>P.test(l),rtl:l=>r(l)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const r=l=>Hn.test(l)||Gn.test(l)||Kn.test(l)||Yn.test(l)||Qn.test(l)||ri.test(l)||ai.test(l)||ni.test(l)||si.test(l)||li.test(l)||ti.test(l)||ci.test(l)||ii.test(l)||Jn.test(l)||ei.test(l)||oi.test(l);return B(t,{indic:l=>r(l),latin:l=>P.test(l)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return B(t,{cyrillic:r=>X.test(r),latin:r=>P.test(r)},!0,e);if(["ar","fa","he"].includes(e))return B(t,{latin:r=>P.test(r),rtl:r=>Re.test(r)||Ve.test(r)},!1,e);if(e.startsWith("ko"))return B(t,{hangul:r=>je.test(r),latin:r=>P.test(r)},!1,e);if(e.startsWith("uz")){if(!X.test(t)&&!P.test(t))return[t];const r=[...t],l=r.length,d=[];let p=r[0],f=r[0]===r[0].toLocaleUpperCase(e);for(let h=1;h<l;h++){const g=r[h],$=g===g.toLocaleUpperCase(e);if(We.test(g)||We.test(r[h-1])){p+=g;continue}!f&&$?(d.push(p),p=g):p+=g,f=$}return p&&p.length>0&&d.push(p),d}const s=[...t],o=s.length,c=[];let a=s[0],u=s[0]===s[0].toLocaleUpperCase(e);for(const r of n)if(t.startsWith(r)){c.push(r),a=s[r.length],u=a===a.toLocaleUpperCase(e);break}for(let r=1;r<o;r++){const l=s[r],d=l===l.toLocaleUpperCase(e);let p=0;for(const f of n)if(t.startsWith(f,r)){c.push(a,f),p=f.length,a="";const h=f.at(-1);h&&(u=h===h.toLocaleUpperCase(e));break}if(p>0){r+=p-1;continue}!u&&d?(c.push(a),a=l):a+=l,u=d}return a&&c.push(a),c},$i=(t,e,n)=>{const i=[],s=de.test(t)?t.split(de).filter(Boolean):[t];for(const o of s){const c=o;if(de.test(c))i.push(c);else{z.lastIndex=0;const a=z.test(c)?wi(c).filter(Boolean):[c];for(const u of a)if(z.lastIndex=0,z.test(u))i.push(u);else if(e){const r=e.toLowerCase().split("-")[0];i.push(...kt(u,r,n))}else i.push(...At(u,n))}}return i},xi=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:s=[],locale:o,normalize:c=!1,separators:a,stripAnsi:u=!1,stripEmoji:r=!1}=e,l=new Set([...s].toSorted((w,y)=>y.length-w.length));let d=t;u&&(d=fi(d)),r&&(d=ui(d));let p;Array.isArray(a)?p=gi(a):a instanceof RegExp?p=a:p=qn;const f=[];let h=d;const g=p.flags.includes("g")?p:new RegExp(p.source,`${p.flags}g`);for(;h.length>0;){const w=g.exec(h);if(!w){h===".."?f.push(".."):h==="."?f.push("."):h.length>0&&f.push(h);break}const y=w.index,x=w[0],N=x.length,E=h.slice(0,y),I=h.slice(y+N);if(x.startsWith("../"))f.push(".."),h=h.slice(y+3);else if(x.startsWith("./"))f.push("."),h=h.slice(y+2);else if(y===0&&x==="..")f.push(".."),h=h.slice(2);else if(y===0&&x===".")f.push("."),h=h.slice(1);else{E.length>0&&f.push(E);let O=0;for(;(O=x.indexOf("../",O))!==-1;)f.push(".."),O+=3;for(O=0;(O=x.indexOf("./",O))!==-1;)(O===0||x[O-1]!==".")&&f.push("."),O+=2;let m=I;for(;m.startsWith("../");)f.push(".."),m=m.slice(3);for(;m.startsWith("./");)f.push("."),m=m.slice(2);if(m===".."){f.push("..");break}else if(m==="."){f.push(".");break}else h=m}g.lastIndex=0}if(f.length===0){const w=d.split(p).filter(Boolean);f.push(...w)}let $=[];for(const w of f)n||i?$.push(...$i(w,o,l)):o?$.push(...kt(w,o,l)):$.push(...At(w,l));return c&&($=$.map(w=>l.has(w)?w:o&&w===w.toLocaleUpperCase(o)?w[0]+w.slice(1).toLocaleLowerCase(o):w.toUpperCase()===w&&!l.has(w)?w.slice(0,1)+w.slice(1).toLowerCase():w)),$},bi=Ce(import.meta.url),ae=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ni=t=>{if(typeof ae<"u"&&ae.versions&&ae.versions.node){const[e,n]=ae.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ae.getBuiltinModule(t)}return bi(t)},{writeFile:Ai,stat:ki,rm:Ei,readFile:Fe,readdir:Ci,mkdir:Oi,access:_i}=Ni("node:fs/promises"),ce=[{alias:"v",description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];let F=class extends k{commandName;constructor(t,e=[]){const n=`Command "${t}" not found${e.length>0?`. Did you mean: ${e.join(", ")}?`:""}`;super(n,"COMMAND_NOT_FOUND",{commandName:t,suggestions:e}),this.name="CommandNotFoundError",this.commandName=t,e.length>0&&(this.hint=`Try one of these commands: ${e.join(", ")}`)}},Et=class extends k{option1;option2;constructor(t,e){super(`Options "${t}" and "${e}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:t,option2:e}),this.name="ConflictingOptionsError",this.option1=t,this.option2=e,this.hint=`Remove either --${t} or --${e}`}},Ii=class extends k{unknownOptions;constructor(t,e){const n=t.join(", "),i=`Found unknown ${t.length===1?"option":"options"}: ${n}`;super(i,"UNKNOWN_OPTION",{suggestions:e,unknownOptions:t}),this.name="UnknownOptionError",this.unknownOptions=t,e&&e.length>0&&(this.hint=`Did you mean: ${e.join(", ")}?`)}},Li=class extends k{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)}},Si=class{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`);fe().CEREBRO_OUTPUT_LEVEL===String(j)&&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 s=new Li(n.name,`Failed to initialize: ${i instanceof Error?i.message:String(i)}`,i instanceof Error?i:void 0);throw this.logger.error(s.message),s}}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 s of i){const o=s[t];if(typeof o=="function"){this.logger.debug(`executing ${t} hook for plugin: ${s.name}`);try{await(t==="afterCommand"?o(e,n):o(e))}catch(c){throw this.logger.error(`Error in ${t} hook for plugin "${s.name}":`,c),c}}}}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(s){this.logger.error(`Error in error handler for plugin "${i.name}":`,s)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const t=[],e=new Set,n=new Set,i=s=>{if(e.has(s))return;if(n.has(s))throw new Error(`Circular dependency detected involving plugin "${s}"`);const o=this.plugins.get(s);if(!o)throw new Error(`Plugin "${s}" not found`);if(n.add(s),o.dependencies)for(const c of o.dependencies)i(c);n.delete(s),e.add(s),t.push(o)};for(const s of this.plugins.keys())i(s);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`)}}};const le=t=>t.type?.name==="Boolean",Mi=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},qe=t=>(le(t)||(t.typeLabel=t.typeLabel??Mi(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),Pi=new RegExp(/^-([^\d-])$/),Di=new RegExp(/^--(\S+)/),Ui=new RegExp(/^-([^\d-]{2,})$/),Vi=t=>Pi.test(t)||Di.test(t)||Ui.test(t),Ti=(t,e)=>{const n=e[0]&&Vi(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}};class Ie extends te{optionName;value;constructor(e,n,i){super({hint:`Pass a valid ${i} value for '${e}'.`,message:`Invalid ${i} value '${n}' for option '${e}'`,name:"INVALID_VALUE",title:"Invalid Value"}),this.optionName=e,this.value=n,Object.setPrototypeOf(this,Ie.prototype)}}let ji=class Ct extends te{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,Ct.prototype)}},Ge=class Ot extends te{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,Ot.prototype)}},Ri=class _t extends te{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,_t.prototype)}};class S extends te{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,S.prototype)}}const He=(t,e,n)=>{const i=Number(t);if(e&&Number.isNaN(i)&&String(t).trim().toLowerCase()!=="nan")throw new Ie(n??"",String(t),"Number");return i},Je=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",Ke=t=>t===Number||typeof t=="function"&&t.name==="Number",Ye=t=>t===String||typeof t=="function"&&t.name==="String",Bi=(t,e,n={})=>{const{optionName:i,strictTypes:s}=n;return Array.isArray(t)?Je(e)?t.map(Boolean):Ke(e)?t.map(o=>He(o,s,i)):Ye(e)?t.map(String):t.map(o=>e(String(o))):t===null?null:Je(e)?!!t:Ke(e)?He(t,s,i):Ye(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t))},_=(t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},Wi=/-([a-z])/g,zi=/^\d+$/,ue=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",Fi=t=>t.codePointAt(0)===95,Xe=(t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],Qe=t=>t==="__proto__"||t==="constructor"||t==="prototype",Ze=(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]},et=(t,e,n,i,s)=>{let o=e.get(t)??n.get(t);if(!o&&i){const c=t.toLowerCase();o=i.get(c)??s?.get(c)}return o},qi=(t,e,n,i)=>{const s=n.debug??!1;_(s,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),_(s,"Starting argument resolution","resolver"),_(s,"Tokens:","resolver",t),_(s,"Definitions:","resolver",e),_(s,"Processing tokens...","resolver");const o=new Map,c=new Map,a=n.caseInsensitive?new Map:void 0,u=n.caseInsensitive?new Map:void 0,r=n.camelCase?new Map:void 0,l=n.camelCase?new Map:void 0;for(const m of e)if(o.set(m.name,m),m.alias&&c.set(m.alias,m),n.caseInsensitive&&a&&(a.set(m.name.toLowerCase(),m),m.alias&&u&&u.set(m.alias.toLowerCase(),m)),n.camelCase&&r&&l){const v=m.name.replaceAll(Wi,(b,L)=>L.toUpperCase());r.set(m.name,v),l.set(v,m.name)}const d=Object.create(null),p=Object.create(null),f=[],h=[],g=new Set;let $=!1;const w=e.find(m=>m.defaultOption),y=e.some(m=>m.group),x=e.find(m=>m.type===Number);for(let m=0;m<t.length;m++){const v=t[m];if(v.kind==="option-terminator"){d._unknown=i.slice(v.index),$=!0;break}if(v.kind==="option"&&v.name){let b=et(v.name,o,c,a,u);!b&&v.value===void 0&&x&&zi.test(v.name)&&(b=x,v.value=v.name,v.name=x.name);let L=!1;if(!b&&n.negation&&v.value===void 0&&v.name.startsWith("no-")){const C=v.name.slice(3),D=et(C,o,c,a,u);D?.type&&ue(D.type)&&(b=D,L=!0)}const A=b?b.name:v.name,M=b?.multiple,U=b?.lazyMultiple;if(Object.hasOwn(p,A)&&p[A]!==void 0&&!M&&!U&&!n.partial)throw new ji(A);if(!b&&n.partial){const C=v.rawName??`--${v.name}${v.value!==void 0&&v.inlineValue?`=${v.value}`:""}`;f.push({index:v.index,value:C});continue}if(!b&&n.stopAtFirstUnknown){d._unknown=i.slice(v.index);break}if(!b&&!n.partial)throw new Ge(v.name);if(v.value===void 0){const C=t[m+1],D=C?.kind==="option"&&!("name"in C)&&C.value!==void 0,V=C&&b&&!(b.type&&ue(b.type))&&(C.kind==="positional"||D),Pt=b&&b.defaultOption&&!b.multiple&&!b.lazyMultiple;if(V&&(!b?.defaultOption||Pt))if(M){let T=m+1;const me=[];for(;T<t.length&&(t[T].kind==="positional"||t[T].kind==="option"&&!("name"in t[T])&&t[T].value!==void 0);)me.push(t[T].value),g.add(t[T].index),T++;p[A]=p[A]===void 0?me:Xe(p[A],me),m=T-1}else U?(Ze(p,A,C.value,!0),g.add(C.index),m++):(p[A]=C.value,g.add(C.index),m++);else b?.type&&ue(b.type)?Ze(p,A,!L,M):p[A]=M?[]:null}else{let{value:C}=v;if(b?.type&&ue(b.type))switch(C){case"":{if(n.partial){p._unknown??=[];const V=`${v.rawName??`--${v.name}`}${v.value?`=${v.value}`:""}`;p._unknown.push(V),h.push({index:v.index,value:V}),C=!0}else throw new Ge(v.name);break}case"false":{C=!1;break}case"true":{C=!0;break}default:C=!0}const D=[C];if(M){let V=m+1;for(;V<t.length&&t[V].kind==="positional";)D.push(t[V].value),g.add(t[V].index),V++;m=V-1}p[A]===void 0?p[A]=M||U?D:C:M||U?p[A]=Xe(p[A],D):p[A]=C}}else if(v.kind==="positional"&&n.stopAtFirstUnknown&&!g.has(v.index)&&!w){_(s,`Found unconsumed positional token at index ${String(v.index)}, stopping processing`,"resolver"),d._unknown=i.slice(v.index);break}}for(const[m,v]of Object.entries(p)){const b=o.get(m);b&&(b.multiple||b.lazyMultiple)&&!Array.isArray(v)&&(p[m]=[v])}const N=m=>m.kind==="option"&&!o.has(m.name??"")&&!c.has(m.name??"")&&(!n.caseInsensitive||!a?.has(m.name?.toLowerCase()??"")&&!u?.has(m.name?.toLowerCase()??""));let E=-1,I=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!$&&(E=t.findIndex(m=>N(m)),E!==-1&&(I=t[E].index)),w){const m=[],v=[];for(const b of t)b.kind==="positional"&&!g.has(b.index)&&b.index<I&&(m.push(b.value),v.push(b));if(m.length>0){const b=p[w.name],L=w.multiple??w.lazyMultiple;b===void 0?L?(v.forEach(A=>g.add(A.index)),p[w.name]=m):(g.add(v[0].index),p[w.name]=m[0]):L&&(v.forEach(A=>g.add(A.index)),p[w.name]=Array.isArray(b)?[...m,...b]:[...m,b])}}if(!n.partial){for(const m of t)if(m.kind==="positional"&&!g.has(m.index))throw new Ri(i[m.index])}if(n.partial&&!n.stopAtFirstUnknown){const m=[...f];if(p._unknown)for(const v of h)m.push({index:v.index,value:v.value});for(const v of t)v.kind==="positional"&&!g.has(v.index)&&m.push({index:v.index,value:i[v.index]});m.length>0&&(m.sort((v,b)=>v.index-b.index),d._unknown=m.map(v=>v.value))}if(n.stopAtFirstUnknown&&!$){const m=t.findIndex(b=>b.kind==="positional"&&!g.has(b.index));let v=-1;if(E!==-1&&m!==-1?v=Math.min(E,m):E!==-1?v=E:m!==-1&&(v=m),v>=0){const b=t[v].index;d._unknown=i.slice(b)}}else f.length>0&&!n.partial&&(d._unknown=f.map(m=>m.value));for(const[m,v]of Object.entries(p)){const b=n.camelCase?r?.get(m)??m:m,L=o.get(m);L?.type?d[b]=Bi(v,L.type,{optionName:L.name,strictTypes:n.strictTypes}):d[b]=v===void 0?null:v}for(const m of e){const v=n.camelCase?r?.get(m.name)??m.name:m.name;!(v in d)&&m.defaultValue!==void 0&&(m.multiple??m.lazyMultiple?d[v]=Array.isArray(m.defaultValue)?[...m.defaultValue]:[m.defaultValue]:d[v]=m.defaultValue)}if(y){const m={},v={},b={};for(const A of e)if(A.group){const M=Array.isArray(A.group)?A.group:[A.group];for(const U of M)Qe(U)||(m[U]??={})}for(const A of Object.keys(d))if(!Fi(A)){v[A]=d[A];let M=A;n.camelCase&&(M=l?.get(A)??A);const U=o.get(M);if(U?.group){const C=Array.isArray(U.group)?U.group:[U.group];for(const D of C)Qe(D)||m[D]&&(m[D][A]=d[A])}else b[A]=d[A]}const L={_all:v};for(const[A,M]of Object.entries(m))L[A]=M;Object.keys(b).length>0&&(L._none=b),d._unknown&&(L._unknown=d._unknown),Object.keys(d).forEach(A=>delete d[A]),Object.assign(d,L)}const O=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));return _(s,"Final parsed result:","resolver",O),O},ee="-".codePointAt(0),H="=",Gi=H.codePointAt(0),Hi="--",Ji="-",Ki="--",It=t=>t.length>2&&t.startsWith(Ki),Yi=t=>It(t)&&!t.includes(H,3),Xi=t=>It(t)&&t.includes(H,3),Qi=t=>{if(t.length!==2||t.codePointAt(0)!==ee||t.codePointAt(1)===ee)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},Zi=t=>!(t.length<=2||t.codePointAt(0)!==ee||t.codePointAt(1)===ee),eo=t=>{const e=[];let n=0,i=[],s=0,o=-1,c=0;for(;s<i.length||n<t.length;){let a;if(s<i.length?(a=i[s],s++):(a=t[n],n++),c>0?c--:o++,a===Hi){e.push({index:o,kind:"option-terminator"});const u=[...i.slice(s),...t.slice(n)],r=u.map((l,d)=>({index:o+d+1,kind:"positional",value:l}));e.push(...r),o+=u.length;break}if(Qi(a)){const u=a.charAt(1);e.push({index:o,kind:"option",name:u,rawName:a});continue}if(Zi(a)&&!a.includes(H)){const u=[];let r="",l=!1;for(let d=1;d<a.length;d++){const p=a.charAt(d);l?r+=p:p.codePointAt(0)===Gi?l=!0:u.push(`${Ji}${p}`)}if(l)if(u.length>0){const d=u.pop();u.push(`${d}=${r}`)}else u.push(r);i=s<i.length?[...u,...i.slice(s)]:u,s=0,c=u.length;continue}if(Yi(a)){const u=a.slice(2);e.push({index:o,kind:"option",name:u,rawName:a});continue}if(Xi(a)){const u=a.indexOf(H),r=a.slice(2,u),l=a.slice(u+1);e.push({index:o,inlineValue:!0,kind:"option",name:r,rawName:a,value:l});continue}if(a.length>2&&a.codePointAt(0)===ee&&a.codePointAt(1)!==ee&&a.includes(H)){const u=a.indexOf(H),r=a.charAt(1),l=a.slice(u+1);e.push({index:o,inlineValue:!0,kind:"option",name:r,rawName:a,value:l});continue}e.push({index:o,kind:"positional",value:a})}return e},to=/\d/,no=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",io=t=>typeof t=="function",oo=(t,e,n)=>{const i=n?.debug??!1;_(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const s=new Set,o=new Set,c=new Set,a=new Set;let u=0;for(const r of t){if(_(i,"Checking definition:","validation",r),!r.name)throw _(i,"Validation failed: name is required","validation"),new S("Invalid option definition: name is required");if(typeof r.name!="string")throw new S("Invalid option definition: name must be a string");if(r.name.trim()==="")throw new S("Invalid option definition: name cannot be empty");const l=e?r.name.toLowerCase():"";if(s.has(r.name)||e&&c.has(l))throw new S(`Invalid option definition: duplicate name '${r.name}'`);if(o.has(r.name)||e&&a.has(l))throw new S(`Invalid option definition: name '${r.name}' conflicts with an existing alias`);if(s.add(r.name),e&&c.add(l),r.alias!==void 0){if(typeof r.alias!="string")throw new S("Invalid option definition: alias must be a string");if(r.alias.length!==1)throw new S("Invalid option definition: alias must be a single character");if(to.test(r.alias))throw new S("Invalid option definition: alias cannot be numeric");if(r.alias==="-")throw new S('Invalid option definition: alias cannot be "-"');const d=e?r.alias.toLowerCase():"";if(o.has(r.alias)||e&&a.has(d))throw new S(`Invalid option definition: duplicate alias '${r.alias}'`);if(s.has(r.alias)||e&&c.has(d))throw new S(`Invalid option definition: alias '${r.alias}' conflicts with an existing option name`);o.add(r.alias),e&&a.add(d)}if(r.defaultOption&&(u++,r.type!==void 0&&no(r.type)))throw new S("Invalid option definition: defaultOption cannot be Boolean type");if(r.type!==void 0&&!(r.type===Boolean||r.type===Number||r.type===String||typeof r.type=="function"&&io(r.type)))throw new S("Invalid option definition: invalid type")}if(u>1)throw _(i,"Validation failed: multiple defaultOptions not allowed","validation"),new S("Invalid option definition: multiple defaultOptions not allowed");_(i,"Validation completed successfully","validation")};function so(t,e={}){const n=e.debug??!1;_(n,"Starting command-line-args parsing","index"),_(n,"Options:","index",e);const i={...e};i.stopAtFirstUnknown&&(i.partial=!0);const s=Array.isArray(t)?t:[t];_(n,"Normalized definitions:","index",s),oo(s,i.caseInsensitive,n?i:void 0);let{argv:o}=i;if(!o&&(o=process.argv.slice(2),process.execArgv.length>0)){const r=new Set(process.execArgv);o=o.filter(l=>!r.has(l))}_(n,"Using argv:","index",o);let c=o;i.caseInsensitive&&(c=o.map(r=>{if(r.startsWith("--")){const l=r.indexOf("="),d=(l===-1?r.slice(2):r.slice(2,l)).toLowerCase();return l===-1?`--${d}`:`--${d}${r.slice(l)}`}if(r.startsWith("-")&&!r.startsWith("--")&&r.length>1){const l=r.slice(1).split("=",2),d=l[0],p=l[1];if(!d)return r;const f=d.toLowerCase();return p===void 0?`-${f}`:`-${f}=${p}`}return r}));const a=eo(c.map(String));_(n,"Tokenized arguments:","index",a);const u=qi(a,s,i,o);return _(n,"Command-line-args parsing completed","index"),u}class ro{result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}}let xe=class extends k{commandName;constructor(t,e,n){super(`Failed to load command "${t}": ${e}`,"COMMAND_LOADER_ERROR",{commandName:t,reason:e}),this.name="CommandLoaderError",this.commandName=t,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",n!==void 0&&(this.cause=n)}};const ao=/^-{1,2}(\w+)(=(.+))?$/,Lt=(t,e,n,i)=>{const s=ao.exec(t);if(s===null)return{};const o=s[1];if(!o)return{};const c=n&&i?n.get(o)??i.get(o):e.find(a=>a.name===o||a.alias===o);return c!==void 0?{argName:c.name,argValue:s[3],option:c}:{}},tt=(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)},lo=new Set(["0","1","false","true"]),co=(t,e,n,i)=>{if(e.length===0||t.length===0)return{};const s=(o,c)=>{const{argName:a,argValue:u,option:r}=Lt(c,e,n,i),{lastOption:l}=o;return r&&le(r)&&u&&a?o.partial[a]=tt(u,r):o.lastName&&l&&le(l)&&lo.has(c)&&(o.partial[o.lastName]=tt(c,l)),{lastName:a,lastOption:r,partial:o.partial}};return t.reduce(s,{partial:{}}).partial},uo=new Set(["0","1","false","true"]),po=(t,e,n,i)=>{if(e.length===0||t.length===0)return t;const s=(o,c)=>{const{argValue:a,option:u}=Lt(c,e,n,i),{lastOption:r}=o;if(r&&le(r)&&uo.has(c)){const{args:l}=o;return{args:l.slice(0,-1)}}return u&&le(u)&&a?{args:o.args}:{args:[...o.args,c],lastOption:u}};return t.reduce(s,{args:[]}).args},ho=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()]},fo=t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},mo=(t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return fo(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)}},go=/_./g,wo=/^[A-Z]/,yo=t=>t.toLowerCase().replaceAll(go,e=>e[1]?.toUpperCase()??e).replace(wo,e=>e.toLowerCase()),vo=t=>{if(!t||t.length===0)return{};const e={},n=fe();for(const i of t){const s=n[i.name],o=mo(i,s),c=o===void 0?i.defaultValue:o,a=yo(i.name);e[a]=c}return e},$o=t=>{const e=new Map,n=new Map;for(const i of t)if(e.set(i.name,i),i.alias){const s=Array.isArray(i.alias)?i.alias:[i.alias];for(const o of s)n.set(o,i)}return{optionMapByAlias:n,optionMapByName:e}},St=async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new xe(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new xe(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new xe(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},xo=(t,e,n,i)=>{const s=new ro(t.name,t),{_all:o,_unknown:c,positionals:a}=e,u=Object.keys(n).length>0?{...o,...n}:o;he in u&&delete u[he],s.argument=a?.[he]??[],s.rawUnknown=[...c??[]];const r=Object.keys(i).length>0;return s.options=r?{...u,...i}:u,s.env=vo(t.env),s},bo=(t,e,n)=>{const i=t.options??[],s=i.length>0;let o=ho(s?[...i,...n]:n);if(o.length>0){for(const r of o)if(r.multiple&&r.lazyMultiple)throw new Error(`Argument "${r.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(o=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:he,type:t.argument.type,typeLabel:t.argument.typeLabel},...o]);let c,a;if(s){const{optionMapByAlias:r,optionMapByName:l}=$o(i);c=po(e,i,l,r),a=co(e,i,l,r)}else c=e,a={};const u=so(o,{argv:c,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:o,booleanValues:a,parsedArgs:u}},Q=async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await St(t))(e);let No=class extends k{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(", ")}`}},Ao=class extends k{choices;option;value;constructor(t,e,n){super(`Invalid value "${e}" for option "${t}". Allowed values: ${n.join(", ")}`,"INVALID_CHOICE",{choices:n,option:t,value:e}),this.name="InvalidChoiceError",this.option=t,this.value=e,this.choices=n,this.hint=`Use one of: ${n.map(i=>`--${t} ${i}`).join(", ")}`}};const nt=(t,e,n=!1)=>{const i=[];for(const s of t)if(!(!n&&!s.required)&&e[s.name]===void 0){if(s.type?.name==="Boolean"){e[s.name]=!1;continue}i.push(s)}return i},ko=(t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Rn(t,e)<=t.length/3,W=(t,e)=>{const n=t.toLowerCase();return e.filter(i=>ko(i.toLowerCase(),n))},Eo=(t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const s=i.startsWith("--");let o=`Found unknown ${s?"option":"argument"} "${i}"`;if(s){const c=W(i.replace("--",""),(e.options??[]).map(a=>a.name));if(c.length>0){const[a,...u]=c.map(r=>`--${r}`);o+=u.length>0?`, did you mean ${a??""} or ${u.join(", ")}?`:`, did you mean ${a??""}?`}}n.push(o)}),n.length>0)throw new Error(n.join(`
|
|
26
|
-
`))},Co=(t,e,n)=>{const i=n.__requiredOptions__,s=i?nt(i,e,!0):nt(t,e,!1);if(s.length>0)throw new No(n.name,s.map(o=>o.name));e._unknown&&e._unknown.length>0&&!n.argument&&Eo(e,n)},Oo=(t,e,n)=>{const i=n.__conflictingOptions__??t.filter(s=>s.conflicts!==void 0);if(i.length>0){const s=i.find(o=>Array.isArray(o.conflicts)?o.conflicts.some(c=>e[c]!==void 0)&&e[o.name]!==void 0:e[o.conflicts]!==void 0&&e[o.name]!==void 0);if(s)throw new Et(s.name,typeof s.conflicts=="string"?s.conflicts:s.conflicts?.[0]??"unknown")}},_o=(t,e)=>{const n=e.options;if(n)for(const i of n){if(!i.choices||i.choices.length===0)continue;const s=t[i.name];if(s==null)continue;const o=Array.isArray(s)?s:[s];for(const c of o){const a=String(c);if(!i.choices.includes(a))throw new Ao(i.name,a,i.choices)}}},Io=t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const s of t.options){if(s.name){const o=e.get(s.name)??[];o.push(s),e.set(s.name,o)}if(typeof s.alias=="string"&&s.alias.length>0){const o=n.get(s.alias)??[];o.push(s),n.set(s.alias,o)}else if(Array.isArray(s.alias)){for(const o of s.alias)if(o.length>0){const c=n.get(o)??[];c.push(s),n.set(o,c)}}}const i=[];for(const[s,o]of e)o.length>1&&i.push(`Duplicate option name "${s}" in command "${t.name}": ${JSON.stringify(o)}`);for(const[s,o]of n)o.length>1&&i.push(`Duplicate option alias "-${s}" used by options ${o.map(c=>`"${c.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
|
|
27
|
-
`))},Lo=(t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let i;for(let s=1;s<=e.length;s+=1){const o=e[s-1];if(o===void 0||o.startsWith("-"))break;n.push(o);const c=n.join(" ");t.has(c)&&(i={commandPath:[...n],depth:s})}return i?{argv:e.slice(i.depth),commandPath:i.commandPath}:{argv:e,commandPath:void 0}},q=t=>t.join(" "),it=(t,e)=>e&&e.length>0?[...e,t]:[t],So=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Mo=(t,e)=>typeof t!="string"||t===""?"":t[0].toUpperCase()+t.slice(1),Po=(t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let s="",o="";for(let c=0;c<n;c++){const a=t[c];if(de.test(a)){s?(i.push(s+o+a),s="",o=""):(i.length>0&&i.push(e),s=a);continue}s?(o&&(o+=e),o+=a):(i.length>0&&i.push(e),i.push(a))}return i.join("")},Mt=(t,e)=>{if(typeof t!="string"||!t)return"";let n=!0;return Po(xi(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(i=>{const s=i,o=s.toLowerCase();return n?(n=!1,So(o)):Mo(o)}),"")},Do=/^no-/,Uo=t=>{t.options?.forEach(e=>{e.__camelCaseName__=Mt(e.name)})},Vo=t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const i of t.options)e.add(i.name);const n=[];for(const i of t.options)if(i.name.startsWith("no-")){const s=i.name.replace(Do,"");if(!e.has(s)){if(i.type!==Boolean)throw new Error(`Cannot add negated option "${i.name}" to command "${t.name}" because it is not a boolean.`);const o={...i,defaultValue:i.defaultValue===void 0?!0:!i.defaultValue,name:s};n.push(o),e.add(s)}}n.length>0&&t.options.push(...n)},To=(t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,i=new Map;for(const o of e.options)if(o.name.startsWith("no-")){const c=Mt(o.name);i.set(c,o)}const s=Object.keys(n).filter(o=>i.has(o));if(s.length!==0)for(const o of s){const c=o.charAt(2);if(!c)continue;const a=c.toLowerCase()+o.slice(3),u=i.get(o);u&&(u.__negated__=!0),n[a]=!n[o],Reflect.deleteProperty(n,o)}},jo=(t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const s of e.options)s.__camelCaseName__&&s.__negated__===void 0&&s.implies!==void 0&&n.set(s.__camelCaseName__,s);if(n.size===0)return;const{options:i}=t;for(const s of Object.keys(i)){const o=n.get(s);if(o?.implies){const{implies:c}=o;for(const[a,u]of Object.entries(c))i[a]===void 0&&(i[a]=u)}}},Ro=()=>!!process.versions.electron,Bo=()=>Ro()&&!process.defaultApp,Wo=()=>Bo()?0:1,zo=t=>t.slice(Wo()+1),Fo=" ",qo=(t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),Go=t=>{if(typeof t=="string")return t.split(Fo);const e=Ae();return qo(t,e)?zo(t):t},Ho=t=>{const e=o=>{t.error(`Uncaught exception: ${o.message||o}`),o.stack&&t.error(o.stack),G(1)},n=(o,c)=>{if(o instanceof Error)t.error(`Promise rejection: ${o.message||o}`),o.stack&&t.error(o.stack);else{let a;if(typeof o=="string")a=o;else try{a=JSON.stringify(o)}catch{a=String(o)}t.error(`Promise rejection: ${a}`)}G(1)},i=Se("uncaughtException",e),s=Se("unhandledRejection",n);return()=>{i(),s()}},ot=100,Jo=/^[a-z][\w-]*$/i,Ee=(t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new k(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},st=(t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new k(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},be=(t,e)=>{if(typeof t!="object"||t===null)throw new k(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},pe=t=>{const e=Ee(t,"Command name");if(e.length>ot)throw new k(`Command name is too long (maximum ${String(ot)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new k(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!Jo.test(e))throw new k(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},Ko=new Set([`
|
|
28
|
-
`,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),Yo=(t,e={})=>{if(typeof t!="string")throw new TypeError("Argument must be a string");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,i=n.maxArgumentLength??1e6;if(Number.isFinite(i)&&i>0&&t.length>i)throw new Error(`Argument is too long (maximum ${String(i)} characters)`);if(n.checkDangerousChars){for(const s of t)if(Ko.has(s))throw new Error(`Argument contains dangerous character: ${s}`)}return n.trim?t.trim():t},rt=(t,e={})=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,i=n.maxArguments??1e5;if(Number.isFinite(i)&&i>0&&t.length>i)throw new Error(`Too many arguments (maximum ${String(i)})`);return t.map(s=>Yo(s,n))},Xo=/^-([^\d-])$/,Qo=/^--(\S+)/,Zo=/^-([^\d-]{2,})$/,Ne=t=>Xo.test(t)||Qo.test(t)||Zo.test(t),es={access:(t,e)=>_i(t,e),mkdir:(t,e)=>Oi(t,e),readdir:t=>Ci(t),readFile:(async(t,e)=>e===void 0?Fe(t):Fe(t,e)),rm:(t,e)=>Ei(t,e),stat:t=>ki(t),writeFile:(t,e,n)=>Ai(t,e,n)},ts=(t,e,n)=>{const i=e.indexOf("--"),s=i===-1?new Set:new Set(e.slice(i+1)),o=n.filter(u=>u.startsWith("--")&&u!=="--"&&!s.has(u));if(o.length===0)return;const c=(t.options??[]).map(u=>u.name),a=o.flatMap(u=>W(u.slice(2),c).map(r=>`--${r}`));throw new Ii(o,a)};class Le{#t;#e;#u;#p;#f;#m;#A;#k;#E;#$;#C;#x;#O;#_=ge;#h;#n;#i;#o;#s;#r;#g=!1;#I;#L=!1;#w;#y;#v;#l=[];#U(){return this.#w===void 0&&(this.#w=[...this.#i.keys()]),this.#w}#S(){return this.#y===void 0&&(this.#y=[...this.#n.keys()]),this.#y}#a(){return this.#v===void 0&&(this.#v=[...this.#U(),...this.#S()]),this.#v}#M(){return this.#l.length===0?ce:[...ce,...this.#l]}#P(){this.#w=void 0,this.#y=void 0,this.#v=void 0}#b(){if(this.#u===void 0){const e=Go(this.#e.argv);this.#u=rt(e,{maxArguments:this.#x}),this.#V()}return this.#u}#N(){return this.#$??fe()}#d(e){this.#_=e,this.#N().CEREBRO_OUTPUT_LEVEL=String(e)}#c(){const e=this.#N().CEREBRO_OUTPUT_LEVEL,n=e===void 0?Number.NaN:Number(e);return Number.isNaN(n)?this.#_:n}#V(){if(!this.#u)return;let e=!1;for(const n of this.#u){if(n==="--quiet"||n==="-q"){this.#d(zt),e=!0;break}if(n==="--verbose"||n==="-v"){this.#d(Ft),e=!0;break}if(n==="--debug"){this.#d(j),e=!0;break}}e||this.#d(Object.hasOwn(this.#N(),"DEBUG")?j:ge)}#T(){this.#L||(this.#I=Ho(this.#t),this.#L=!0)}#j(){return{arch:jt(),argv:this.#b(),cwd:this.#p,env:this.#$??fe(),exit:this.#E??(e=>G(e??0)),platform:Tt(),stdin:this.#C}}#D(e,n,i,s){this.#c()===j&&this.#t.debug(`command '${s}' found, parsing command args: ${n.join(", ")}`);const{arguments_:o,booleanValues:c,parsedArgs:a}=bo(e,n,this.#M()),u=Object.keys(c).length>0;let r=a;u&&(r={...a,_all:{...a._all,...c}}),Co(o,r,e);const l=xo(e,a,c,i);l.runtime=this,l.argv=this.#b(),l.fs=this.#k??es,l.process=this.#j(),l.console=this.#t;const d=e.options&&e.options.length>0;if(d&&e.options){const p=e.options.filter(f=>f.name.startsWith("no-"));for(const f of p){const h=f.name.slice(3),g=`--${f.name}`,$=`--${h}`,w=n.includes(g),y=n.includes($);if(w&&y)throw new Et(h,f.name)}}return d&&(To(l,e),jo(l,e)),Oo(o,l.options,e),_o(l.options,e),this.#O&&ts(e,n,l.rawUnknown),this.#c()===j&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(l.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(l.argument,null,2))),{arguments_:o,booleanValues:c,commandArgs:r,parsedArgs:a,toolbox:l}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new k("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#f=e.trim();const i=n.argv??Ae(),s=n.cwd??Rt();if(this.#e={...n,argv:i,cwd:s},this.#e.argv&&!Array.isArray(this.#e.argv))throw new k("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 k("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new k("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new k("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});if(typeof this.#e.logger=="object"){const r=["debug","error","info","log","warn"],l=[],d=this.#e.logger;for(const p of r)typeof d[p]!="function"&&l.push(p);if(l.length>0)throw new k(`Logger object is missing required methods: ${l.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:l});this.#t=this.#e.logger}else this.#t={...console,debug:(...r)=>{this.#c()===j&&console.debug(...r)}};this.#m=this.#e.packageVersion,this.#A=this.#e.packageName,this.#p=this.#e.cwd,this.#s="help",this.#r={};const o=n.fs;if(o!==void 0&&(typeof o!="object"||o===null))throw new k("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const c=n.exit;if(c!==void 0&&typeof c!="function")throw new k("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const a=n.env;if(a!==void 0&&(typeof a!="object"||a===null))throw new k("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const u=n.stdin;if(u!==void 0&&typeof u!="string")throw new k("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#k=n.fs,this.#E=n.exit,this.#$=n.env,this.#C=n.stdin??"",this.#x=n.maxArguments,this.#O=n.strictOptions??!1,this.#d(ge),this.#n=new Map,this.#i=new Map,this.#o=new Map}setCommandSection(e){return this.#r=e,this}getCommandSection(){return this.#r.header||(this.#r.header=`${this.#f}${this.#m?` v${this.#m}`:""}`),this.#r}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){be(e,"Command"),pe(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new k(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new k(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?pe(e.alias):st(e.alias,"Command alias").forEach(r=>pe(r))),e.argument&&be(e.argument,"Command argument"),e.options&&be(e.options,"Command options"),e.commandPath&&(st(e.commandPath,"Command commandPath"),e.commandPath.forEach(r=>{pe(r)}));const s=it(e.name,e.commandPath),o=q(s);if(this.#i.has(o))throw new k(`Command with path "${o}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const c=Array.isArray(e.commandPath)&&e.commandPath.length>0,a=this.#n.get(e.name),u=a!==void 0&&(a.commandPath===void 0||a.commandPath.length===0);if(!c&&u)throw new k(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const r of e.options)qe(r);if(Io(e),Vo(e),Uo(e),e.options&&(e.__conflictingOptions__=e.options.filter(r=>r.conflicts!==void 0),e.__requiredOptions__=e.options.filter(r=>r.required===!0)),c&&a!==void 0)this.#n.set(o,e);else{if(!c&&a!==void 0&&!u){const r=it(a.name,a.commandPath);this.#n.set(q(r),a)}this.#n.set(e.name,e)}if(this.#i.set(o,s),this.#o.set(o,e),this.#P(),e.alias!==void 0){const r=typeof e.alias=="string"?[e.alias]:e.alias;for(const l of r){if(this.#c()===j&&this.#t.debug("adding alias",l),this.#n.has(l))throw new k(`Command alias "${l}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:l,commandName:e.name});this.#n.set(l,e)}}return this}addGlobalOption(e){const n=e,i=new Set(ce.map(o=>o.name)),s=new Set(ce.map(o=>o.alias).filter(Boolean));if(i.has(n.name))throw new k(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&s.has(n.alias))throw new k(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#l.map(o=>o.name)).has(n.name))throw new k(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",qe(n),this.#l.push(n),this}getGlobalOptions(){return this.#M()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#h?this.#h:(this.#h=new Si(this.#t),this.#h.register({description:"Attaches the logger to the toolbox",execute:e=>{e.logger=this.#t,e.console=e.logger},name:"logger"}),this.#h)}getCliName(){return this.#f}getPackageVersion(){return this.#m}getPackageName(){return this.#A}getCommands(){return this.#n}getCwd(){return this.#p}dispose(){this.#I?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...s}=e;if(!this.#n.has("help")){const{default:y}=await import("../packem_chunks/help-command.js");this.addCommand(new y(this.#n))}const o=this.#S(),c=this.#i;this.#T();const a=this.#b();let u,r=[...a];this.#c()===j&&(this.#t.debug(`process.execPath: ${Bt()}`),this.#t.debug(`process.execArgv: ${Wt().join(" ")}`),this.#t.debug(`process.argv: ${Ae().join(" ")}`));const l=Lo(c,[...a]);if(l.commandPath)u=l.commandPath,r=l.argv;else{if(a.length>1&&a[0]&&a[1]&&!Ne(a[0])&&!Ne(a[1])){const x=[];let N=0;for(;N<a.length;){const I=a[N];if(!I||Ne(I))break;x.push(I),N+=1}const E=q(x);if(x[0]&&!o.includes(x[0])){const I=this.#a(),O=W(E,I);throw new F(E,O)}}let y;try{y=Ti([null,...o],[...a])}catch(x){if(x instanceof Error&&x.name==="INVALID_COMMAND"&&"command"in x){const N=x.command,E=this.#a(),I=W(N,E);throw new F(N,I)}throw x}y.command&&(u=[y.command],r=y.argv)}if(!u)if(this.#s)u=[this.#s];else{const y=this.#a();throw new F("",y)}const d=q(u),p=this.#i.get(d);let f;if(p){if(f=this.#o.get(d),!f||q(p)!==d){const y=this.#a(),x=W(d,y);throw new F(d,x)}}else{const y=u.at(-1);if(f=y?this.#n.get(y):void 0,!f){const x=this.#a(),N=W(d,x);throw new F(d,N)}}if(typeof f.execute!="function"&&typeof f.loader!="function")return this.#t.error(`Command "${f.name}" has no function to execute.`),i?G(1):void 0;const h=r;let g,$;try{({commandArgs:g,toolbox:$}=this.#D(f,h,s,d))}catch(y){if(this.#t.error(y),i)return G(1);throw y}const w=this.getPluginManager();try{!this.#g&&w.hasPlugins()&&(await w.init({cli:this,cwd:this.#p,logger:this.#t}),this.#g=!0),await w.executeLifecycle("execute",$),await w.executeLifecycle("beforeCommand",$);let y;const x=g.global;if(x?.help){const N=this.#n.get("help");if(!N)throw new k("Help command not found","COMMAND_NOT_FOUND");y=await Q(N,$)}else if(x?.version??x?.V){const N=this.#n.get("version");if(!N)throw new k("Version command not found","COMMAND_NOT_FOUND");y=await Q(N,$)}else y=await Q(f,$);return await w.executeLifecycle("afterCommand",$,y),i?G(0):void 0}catch(y){throw await w.executeErrorHandlers(y,$),y}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...s}=n;Ee(e,"Command name");const o=e.split(" ").filter(Boolean),c=q(o),a=this.#i.get(c)?this.#o.get(c):this.#n.get(e);if(!a){const p=this.#a(),f=W(c||e,p);throw new F(e,f)}if(typeof a.execute!="function"&&typeof a.loader!="function")throw new k(`Command "${a.name}" has no function to execute`,"INVALID_COMMAND",{commandName:a.name});const u=[...rt(i,{maxArguments:this.#x})];this.#c()===j&&this.#t.debug(`running command '${e}' programmatically with args: ${u.join(", ")}`);const{commandArgs:r,toolbox:l}=this.#D(a,u,s,c||e),d=this.getPluginManager();try{!this.#g&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#p,logger:this.#t}),this.#g=!0),await d.executeLifecycle("execute",l),await d.executeLifecycle("beforeCommand",l);let p;const f=r.global;if(f?.help){const h=this.#n.get("help");if(!h)throw new k("Help command not found","COMMAND_NOT_FOUND");p=await Q(h,l)}else if(f?.version??f?.V){const h=this.#n.get("version");if(!h)throw new k("Version command not found","COMMAND_NOT_FOUND");p=await Q(h,l)}else p=await Q(a,l);return await d.executeLifecycle("afterCommand",l,p),p}catch(p){throw await d.executeErrorHandlers(p,l),p}}clone(e){const n={...this.#e,...e},i=new Le(this.#f,n);for(const[s,o]of this.#n)i.#n.set(s,o);for(const[s,o]of this.#i)i.#i.set(s,[...o]);for(const[s,o]of this.#o)i.#o.set(s,o);for(const s of this.#l)i.#l.push(s);return i.#s=this.#s,i.#r={...this.#r},i.#P(),i}async getAction(e){Ee(e,"Command name");const n=e.split(" ").filter(Boolean),i=q(n),s=this.#i.get(i)?this.#o.get(i):this.#n.get(e);if(!s){const o=this.#a(),c=W(i||e,o);throw new F(e,c)}if(typeof s.execute=="function")return s.execute;if(typeof s.loader=="function")return St(s);throw new k(`Command "${s.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:s.name})}}const ds=(t,e)=>new Le(t,e),fs=(t={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:(e,n)=>{const{logger:i,runtime:s}=n,{detailed:o=!1,exitOnError:c=!0,formatter:a,logErrors:u=!0,renderOptions:r={}}=t;if(u)if(a)i.error(a(e));else if(o){const l=s.getCwd(),d=Vn(e,{cwd:l,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...r});i.error(d)}else i.error(e);c&&G(1)},version:"1.0.0"}),ms=async t=>{try{await t.run({shouldExitProcess:!1})}catch{process.exitCode=process.exitCode||1}finally{process.exit(process.exitCode??0)}},gs={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)"],["vis dlx --info create-vite","Always show the first-run panel (size, score, permissions, changelog)"],["vis dlx --yes create-vite my-app","Skip the first-run panel and confirmation"]],group:"Run & Execute",loader:()=>import("../packem_chunks/handler66.js"),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},{alias:"y",defaultValue:!1,description:"Skip the first-run info panel and confirmation prompt (also via VIS_DLX_YES — note this auto-approves every package)",name:"yes",type:Boolean},{defaultValue:!1,description:"Always show the first-run info panel (size, security score, permissions, changelog), even for an approved package",name:"info",type:Boolean},{defaultValue:!1,description:"Disable the first-run info panel entirely (also via VIS_DLX_NO_INFO)",name:"no-info",type:Boolean}]};export{z as L,ds as V,cs as a,as as b,k as c,gs as e,fs as h,ls as i,rs as n,us as o,ps as p,ms as r,ss as s,os as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const G=/^-{1,2}(no-color|no-colors|color=false|color=never)$/,P=/^-{1,2}(color=256)$/,L=/^-{1,2}(color=16m|color=full|color=truecolor)$/,D=/^-{1,2}(color|colors|color=true|color=always)$/,j=/-mono|dumb/i,F=/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/,V=/-256(color)?$/i,Y=/^screen|^tmux|^xterm|^vt[1-5]\d\d|^ansi|color|mintty|rxvt|cygwin|linux/i,U=()=>{const t=globalThis.process?.getBuiltinModule;return typeof t!="function"?"":t("node:os").release()},_=(t,e={})=>{const{isTTY:i,sniffFlags:o=!0}=e,l=globalThis,u=l.Deno!=null,c=l.process??l.Deno??{},m=c.argv??c.args??[],O=o?m.indexOf("--"):-1,a=d=>{if(!o)return!1;const R=m.findIndex(w=>d.test(w));return R!==-1&&(O===-1||R<O)};let r={};try{r=u?c.env.toObject():c.env??{}}catch{}const n="FORCE_COLOR",g=n in r,s=r[n]??void 0,p=typeof s=="string",S=typeof s=="number";let h;if(s==="true")h=1;else if(s==="false")h=0;else if(p&&s.length===0)h=1;else if(p&&s.length>0){const d=Number.parseInt(s,10);h=Number.isNaN(d)?void 0:Math.min(d,3)}else S&&(h=Number.isNaN(s)?void 0:Math.min(s,3));if(s!=="true"&&s!=="false"&&h!==void 0&&h<4)return h;const k=g&&h!==void 0&&h>0;if(g&&h===0||a(G)||!k&&"NO_COLOR"in r)return 0;if(a(P))return 2;if(a(L))return 3;if(a(D))return 1;const N=h??0;if("TF_BUILD"in r&&"AGENT_NAME"in r)return 1;if(r.TERM&&j.test(r.TERM))return N;if((u?l.Deno.build.os:c.platform)==="win32"){if("WT_SESSION"in r)return 3;if("ANSICON"in r)return 1;try{let d;u?d=l.Deno.osRelease():typeof c.os?.release=="function"?d=c.os.release():d=U();const R=d.split(".");return Number(R[0])>=10&&Number(R[2])>=10586?Number(R[2])>=14931?3:2:1}catch{}}if("CI"in r)return["GITEA_ACTIONS","CIRCLECI","GITHUB_WORKFLOW","GITHUB_ACTIONS"].some(d=>d in r)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(d=>d in r)||r.CI_NAME==="codeship"?1:N;if(r.TERMINAL_EMULATOR?.includes("JediTerm"))return 3;if("TEAMCITY_VERSION"in r)return F.test(r.TEAMCITY_VERSION)?1:0;if(r.COLORTERM==="truecolor"||r.TERM==="xterm-kitty"||r.TERM==="xterm-ghostty"||r.TERM==="wezterm")return 3;if("TERM_PROGRAM"in r){const d=Number.parseInt((r.TERM_PROGRAM_VERSION??"").split(".")[0],10);if(r.TERM_PROGRAM==="iTerm.app")return d>=3?3:2;if(r.TERM_PROGRAM==="Apple_Terminal")return 2}if(V.test(r.TERM))return 2;let T;return i!==void 0?T=i:u?T=t==="out"?l.Deno.stdout.isTerminal():l.Deno.stderr.isTerminal():"PM2_HOME"in r&&"pm_id"in r?T=!0:T=!!c[`std${t}`]?.isTTY,T&&Y.test(r.TERM)||"COLORTERM"in r?1:N},W=()=>_("out"),H=()=>_("err");function q({onlyFirst:t=!1}={}){const e="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,t?void 0:"g")}const M=(t,e,i)=>e>t?e:Math.min(t,i),z=/^#?([a-f\d]{3}|[a-f\d]{6})$/i,K=t=>{let[,e]=z.exec(t)??[];const i=e?e.length:0;if(i===3){const l=e.charAt(0),u=e.charAt(1),c=e.charAt(2);e=l+l+u+u+c+c}else if(i!==6)return globalThis.process?.env?.NODE_ENV!=="production"&&console.warn(`[@visulima/colorize] Invalid hex color "${t}"; expected a 3- or 6-digit hex string (e.g. "#96C" or "#E0115F"). Falling back to black.`),[0,0,0];const o=Number.parseInt(e,16);return[o>>16&255,o>>8&255,o&255]},I=(t,e,i)=>t===e&&e===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/51)+6*Math.round(e/51)+Math.round(i/51),E=t=>{let e,i,o;if(t<8)return 30+t;if(t<16)return 90+(t-8);if(t>=232)e=i=o=((t-232)*10+8)/255;else{t-=16;const c=t%36;e=Math.floor(t/36)/5,i=Math.floor(c/6)/5,o=c%6/5}const l=Math.max(e,i,o)*2;if(l===0)return 30;const u=30+(Math.round(o)<<2|Math.round(i)<<1|Math.round(e));return l===2?u+60:u},y=(t,e,i)=>E(I(t,e,i)),f=39,b=49,B=10,C={close:"",open:""},v=t=>{const e=t>0?(n,g)=>({close:`\x1B[${String(g)}m`,open:`\x1B[${String(n)}m`}):()=>C,i=n=>(g,s,p)=>n(I(Number(g),Number(s),Number(p))),o=n=>g=>{const[s,p,S]=K(g);return n(s,p,S)};let l=n=>e(`38;5;${String(n)}`,f),u=n=>e(`48;5;${String(n)}`,b),c=(n,g,s)=>e(`38;2;${String(n)};${String(g)};${String(s)}`,f),m=(n,g,s)=>e(`48;2;${String(n)};${String(g)};${String(s)}`,b);t===1?(l=n=>e(E(Number(n)),f),u=n=>e(E(Number(n))+B,b),c=(n,g,s)=>e(y(Number(n),Number(g),Number(s)),f),m=(n,g,s)=>e(y(Number(n),Number(g),Number(s))+B,b)):t===2&&(c=i(l),m=i(u));const O={bold:e(1,22),dim:e(2,22),hidden:e(8,28),inverse:e(7,27),italic:e(3,23),overline:e(53,55),reset:e(0,0),strike:e(9,29),strikethrough:e(9,29),underline:e(4,24),visible:C},a={bgBlack:e(40,b),bgBlackBright:e(100,b),bgBlue:e(44,b),bgBlueBright:e(104,b),bgCyan:e(46,b),bgCyanBright:e(106,b),bgGray:e(100,b),bgGreen:e(42,b),bgGreenBright:e(102,b),bgGrey:e(100,b),bgMagenta:e(45,b),bgMagentaBright:e(105,b),bgRed:e(41,b),bgRedBright:e(101,b),bgWhite:e(47,b),bgWhiteBright:e(107,b),bgYellow:e(43,b),bgYellowBright:e(103,b),black:e(30,f),blackBright:e(90,f),blue:e(34,f),blueBright:e(94,f),cyan:e(36,f),cyanBright:e(96,f),gray:e(90,f),green:e(32,f),greenBright:e(92,f),grey:e(90,f),magenta:e(35,f),magentaBright:e(95,f),red:e(31,f),redBright:e(91,f),white:e(37,f),whiteBright:e(97,f),yellow:e(33,f),yellowBright:e(93,f)},r={bg:n=>u(M(n,0,255)),bgHex:o(m),bgRgb:(n,g,s)=>m(M(n,0,255),M(g,0,255),M(s,0,255)),fg:n=>l(M(n,0,255)),hex:o(c),rgb:(n,g,s)=>c(M(n,0,255),M(g,0,255),M(s,0,255))};return{baseColors:a,baseStyles:O,styleMethods:r}},A=W(),J=H();v(A);const Q=(t,e,i)=>{if(e==="")return t;let o=t.indexOf(e);if(o<0)return t;const l=e.length;let u=0,c="";for(;~o;)c+=t.slice(u,o)+i,u=o+l,o=t.indexOf(e,u);return c+t.slice(u)},Z=(t,e,i)=>{if(!t)return"";let o;if(t.raw===void 0?o=String(t):o=String.raw(t,...e),o.includes("\x1B"))for(let l=i;l;l=l.props)o=Q(o,l.close,l.open);return o.includes(`
|
|
2
|
-
`)&&(o=o.replace(/(\r*\n)/g,`${i.closeStack}$1${i.openStack}`)),i.openStack+o+i.closeStack},x=function(t){const e=t?.level??A,{baseColors:i,baseStyles:o,styleMethods:l}=v(e),u={};let c=null;const m=({props:a},{close:r,open:n})=>{const g=(a?.openStack??"")+n,s=r+(a?.closeStack??""),p=(S,...h)=>Z(S,h,p.props);return Object.setPrototypeOf(p,c),p.props={close:r,closeStack:s,open:n,openStack:g,props:a},p.open=g,p.close=s,p},O=a=>String(a);O.strip=a=>a.replaceAll(q(),"");for(const a in i)u[a]={get(){const r=m(this,i[a]);return Object.defineProperty(this,a,{value:r}),r}};for(const a in o)u[a]={get(){const r=m(this,o[a]);return Object.defineProperty(this,a,{value:r}),r}};for(const a in l)u[a]={get(){return(...r)=>m(this,l[a](...r))}};return u.ansi256=u.fg,u.bgAnsi256=u.bg,c=Object.defineProperties({},u),Object.setPrototypeOf(O,c),O},$=new x;new x({level:J});const X=$.bold,ee=$.cyan,te=$.dim,re=$.green,ne=$.inverse,oe=$.magenta,ie=$.red,se=$.underline,le=$.yellow;export{H as $,te as E,re as I,ne as O,oe as Q,W as U,ie as V,$ as a,se as e,X as j,ee as q,le as s};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as A}from"node:module";import{c as L,L as N,m as c,d as W,b as C}from"./index-2LCHaVNX.js";import{e as U}from"./en-C26W78--.js";import{N as X}from"./readJsonSync-DuMMeB3s-B9cGBVbJ.js";import{withEnhancedPath as ot}from"@visulima/task-runner";const F=A(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=t=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[o,e]=d.versions.node.split(".").map(Number);if(o>22||o===22&&e>=3||o===20&&e>=16)return d.getBuiltinModule(t)}return F(t)},{Socket:G}=l("node:net"),{randomBytes:V}=l("node:crypto"),{readdir:q,rm:k,unlink:v,open:B,readFile:Y,stat:z,writeFile:J,rename:K}=l("node:fs/promises"),{spawn:Q}=l("node:child_process"),{openSync:Z,closeSync:tt}=l("node:fs");async function $(t,o,e){const s=await L(t,{buffer:!0,encoding:void 0});let i=new TextDecoder().decode(s);const{beforeParse:r,color:n}={};return typeof r=="function"&&(i=r(i)),X(i,o,N(t),{color:n})}const et=3e4,E=100;class st extends Error{constructor(o,e){super(o),this.elapsedMs=e,this.name="ServiceReadinessError"}elapsedMs}const it=async t=>{const o=t.host??"127.0.0.1",{port:e}=t,s=t.timeoutMs??et,i=Date.now();for(;Date.now()-i<s;){if(await rt(o,e))return;await nt(E)}throw new st(`Timed out waiting for ${o}:${String(e)} to accept TCP connections (${String(s)}ms)`,Date.now()-i)},rt=(t,o)=>new Promise(e=>{const s=new G,i=r=>{s.removeAllListeners(),s.destroy(),e(r)};s.once("connect",()=>{i(!0)}),s.once("error",()=>{i(!1)}),s.setTimeout(E,()=>{i(!1)});try{s.connect(o,t)}catch{i(!1)}}),nt=t=>new Promise(o=>{setTimeout(o,t)}),at=async(t,o)=>{const e=t.readiness??(t.port===void 0?void 0:{tcp:{port:t.port}});e&&await it({host:e.tcp.host,port:e.tcp.port,timeoutMs:o?.timeoutMs??e.tcp.timeoutMs})},y=384,b=5e3,ct=50,ht=3e4,h=async t=>{const o=c(U(t),"services");try{await W(o)}catch(e){throw e.code==="ENOTDIR"?new Error(`Service registry path ${o} exists but is not a directory. Remove it or move the conflicting file before running \`vis service\`.`,{cause:e}):e}return o},_=t=>t.replaceAll("/","_").replaceAll(":","__"),g=(t,o)=>c(t,`${_(o)}.json`),dt=(t,o)=>c(t,`${_(o)}.lock`),u=async(t,o)=>{const e=await h(t),s=g(e,o);if(await C(s))try{return await $(s)}catch{return}},ft=async t=>{const o=await h(t);let e;try{e=await q(o)}catch{return[]}const s=[];for(const i of e)if(i.endsWith(".json"))try{const r=await $(c(o,i));s.push(r)}catch{}return s},lt=async(t,o)=>{const e=await h(t),s=g(e,o.id),i=c(e,`.${V(8).toString("hex")}.tmp`);await J(i,`${JSON.stringify(o,void 0,2)}
|
|
2
|
-
`,{mode:y});try{await kt(i,s)}catch(r){throw await k(i,{force:!0}).catch(()=>{}),r}},ut=new Set(["EACCES","EBUSY","EPERM"]),pt=8,wt=20,kt=async(t,o)=>{let e=0;for(;;)try{await K(t,o);return}catch(s){const{code:i}=s;if(!(i!==void 0&&ut.has(i))||e>=pt)throw s;const r=wt*2**e;await new Promise(n=>{setTimeout(n,r)}),e+=1}},f=async(t,o,e)=>{const s=await h(t),i=e??await u(t,o);await k(g(s,o),{force:!0}),i&&await k(i.logFile,{force:!0}).catch(()=>{})},a=t=>{try{return process.kill(t,0),!0}catch{return!1}},Dt=async t=>{const o=await ft(t),e=[],s=[];for(const i of o){if(a(i.pid)){s.push(i);continue}const r=await u(t,i.id);if(r&&r.pid!==i.pid){s.push(r);continue}await f(t,i.id,i).catch(()=>{}),e.push(i.id)}return{pruned:e,surviving:s}},mt=t=>new Promise(o=>{setTimeout(o,t)}),yt=async t=>{try{const o=await B(t,"wx",y);try{await o.writeFile(String(process.pid))}finally{await o.close().catch(()=>{})}return!0}catch(o){if(o.code==="EEXIST")return!1;throw o}},_t=async t=>{let o;try{const e=await Y(t,"utf8"),s=Number.parseInt(e.trim(),10);o=Number.isFinite(s)?s:void 0}catch{return!0}if(o!==void 0&&!a(o))return!0;try{const e=await z(t);return Date.now()-e.mtimeMs>ht}catch{return!0}},M=async(t,o,e)=>{const s=await h(t),i=dt(s,o),r=Date.now();for(;!await yt(i);){if(await _t(i)){await v(i).catch(()=>{});continue}if(Date.now()-r>=b)throw new Error(`Could not acquire service lock for ${o} within ${String(b)}ms — another \`vis service\` invocation appears to be holding it.`);await mt(ct)}try{return await e()}finally{await v(i).catch(()=>{})}};function m(t,o={},e){for(const s in t){const i=t[s],r=e?`${e}:${s}`:s;typeof i=="object"&&i!==null?m(i,o,r):typeof i=="function"&&(o[r]=i)}return o}const R=(()=>{if(console.createTask)return console.createTask;const t={run:o=>o()};return()=>t})();function T(t,o,e,s){for(let i=e;i<t.length;i+=1)try{const r=s?s.run(()=>t[i](...o)):t[i](...o);if(r&&typeof r.then=="function")return Promise.resolve(r).then(()=>T(t,o,i+1,s))}catch(r){return Promise.reject(r)}}function gt(t,o,e){if(t.length>0)return T(t,o,0,R(e))}function vt(t,o,e){if(t.length>0){const s=R(e);return Promise.all(t.map(i=>s.run(()=>i(...o))))}}function w(t,o){for(const e of[...t])e(o)}var bt=class{_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,o,e={}){if(!t||typeof o!="function")return()=>{};const s=t;let i;for(;this._deprecatedHooks[t];)i=this._deprecatedHooks[t],t=i.to;if(i&&!e.allowDeprecated){let r=i.message;r||(r=`${s} hook has been deprecated`+(i.to?`, please use ${i.to}`:"")),this._deprecatedMessages||(this._deprecatedMessages=new Set),this._deprecatedMessages.has(r)||(console.warn(r),this._deprecatedMessages.add(r))}if(!o.name)try{Object.defineProperty(o,"name",{get:()=>"_"+t.replace(/\W+/g,"_")+"_hook_cb",configurable:!0})}catch{}return this._hooks[t]=this._hooks[t]||[],this._hooks[t].push(o),()=>{o&&(this.removeHook(t,o),o=void 0)}}hookOnce(t,o){let e,s=(...i)=>(typeof e=="function"&&e(),e=void 0,s=void 0,o(...i));return e=this.hook(t,s),e}removeHook(t,o){const e=this._hooks[t];if(e){const s=e.indexOf(o);s!==-1&&e.splice(s,1),e.length===0&&(this._hooks[t]=void 0)}}clearHook(t){this._hooks[t]=void 0}deprecateHook(t,o){this._deprecatedHooks[t]=typeof o=="string"?{to:o}:o;const e=this._hooks[t]||[];this._hooks[t]=void 0;for(const s of e)this.hook(t,s)}deprecateHooks(t){for(const o in t)this.deprecateHook(o,t[o])}addHooks(t){const o=m(t),e=Object.keys(o).map(s=>this.hook(s,o[s]));return()=>{for(const s of e)s();e.length=0}}removeHooks(t){const o=m(t);for(const e in o)this.removeHook(e,o[e])}removeAllHooks(){this._hooks={}}callHook(t,...o){return this.callHookWith(gt,t,o)}callHookParallel(t,...o){return this.callHookWith(vt,t,o)}callHookWith(t,o,e){const s=this._before||this._after?{name:o,args:e,context:{}}:void 0;this._before&&w(this._before,s);const i=t(this._hooks[o]?[...this._hooks[o]]:[],e,o);return i instanceof Promise?i.finally(()=>{this._after&&s&&w(this._after,s)}):(this._after&&s&&w(this._after,s),i)}beforeEach(t){return this._before=this._before||[],this._before.push(t),()=>{if(this._before!==void 0){const o=this._before.indexOf(t);o!==-1&&this._before.splice(o,1)}}}afterEach(t){return this._after=this._after||[],this._after.push(t),()=>{if(this._after!==void 0){const o=this._after.indexOf(t);o!==-1&&this._after.splice(o,1)}}}};function St(){return new bt}const xt=()=>St(),Ot=async(t,o)=>{if(!(!o||o.length===0))for(const e of o){if(e.hooks)for(const[s,i]of Object.entries(e.hooks)){const r=Array.isArray(i)?i:[i];for(const n of r)t.hook(s,n)}e.setup&&await e.setup(t)}};class jt{#e;#o;#s=new Map;constructor(o,e){this.#e=o,this.#o=e}startTasks(o){for(const e of o)this.#s.set(e.id,e),this.#t("task:before",e)}endTasks(o){for(const e of o)this.#s.delete(e.task.id),this.#t("task:after",e.task,e),e.status==="failure"?this.#t("task:failure",e.task,e):Ht(e.status)&&this.#t("task:cacheHit",e.task,e)}printCacheMiss(o,e){this.#t("task:cacheMiss",o,e)}onTaskStdout(o,e){this.#t("task:stdout",o,e)}onTaskStderr(o,e){this.#t("task:stderr",o,e)}#t(o,...e){Promise.resolve(this.#e.callHook(o,...e)).catch(s=>{if(this.#o)try{this.#o(o,s)}catch{}})}}const Ht=t=>t==="local-cache"||t==="local-cache-kept-existing"||t==="remote-cache",S=process.platform==="win32",$t=async t=>{const{command:o,cwd:e,env:s,logFile:i}=t,r=Z(i,"a",y);let n;const p=S?"cmd":"/bin/sh",x=S?["/d","/s","/c",o]:["-c",o];try{n=Q(p,x,{cwd:e,detached:!0,env:ot({...process.env,...s},e),stdio:["ignore",r,r],windowsHide:!0})}finally{tt(r)}if(n.pid===void 0&&await new Promise((O,j)=>{n.once("spawn",()=>{O()}),n.once("error",I=>{j(I)})}),n.pid===void 0)throw new Error(`Failed to spawn detached process for command: ${o}`);return n.unref(),{pid:n.pid}},P=5e3,It=async t=>M(t.workspaceRoot,t.id,async()=>{const o=await u(t.workspaceRoot,t.id);if(o&&a(o.pid))throw new Error(`Service ${t.id} is already running (pid ${String(o.pid)})`);o&&await f(t.workspaceRoot,t.id,o);const e=await h(t.workspaceRoot),s=_(t.id),i=c(e,`${s}.log`),{pid:r}=await $t({command:t.command,cwd:t.cwd,env:t.env,logFile:i}),n={command:t.command,config:t.config,cwd:t.cwd,env:t.config.env??{},id:t.id,logFile:i,pid:r,slug:s,startedAt:new Date().toISOString(),visVersion:process.env.VIS_VERSION??"0.0.0"};if(await lt(t.workspaceRoot,n),t.skipReadiness!==!0)try{await at(t.config,{timeoutMs:t.readinessTimeoutMs})}catch(p){throw await D(r,t.config.killGracePeriodMs??P).catch(()=>{}),await f(t.workspaceRoot,t.id,n).catch(()=>{}),p}return{entry:n}}),At=async t=>M(t.workspaceRoot,t.id,async()=>{const o=await u(t.workspaceRoot,t.id);if(!o)return{stopped:!1};if(!a(o.pid))return await f(t.workspaceRoot,t.id,o),{stopped:!1};const e=t.graceMs??o.config.killGracePeriodMs??P;return await D(o.pid,e),await f(t.workspaceRoot,t.id,o),{stopped:!0}}),D=async(t,o)=>{H(t,"SIGTERM");const e=Date.now();for(;Date.now()-e<o;){if(!a(t))return;await new Promise(s=>{setTimeout(s,100)})}a(t)&&H(t,"SIGKILL")},H=(t,o)=>{try{process.platform==="win32"?process.kill(t,o):process.kill(-t,o)}catch(e){if(e.code==="ESRCH")return;throw e}};export{jt as H,st as S,It as a,at as b,ft as c,xt as d,Ot as e,f,a as i,Dt as p,u as r,At as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as f}from"node:module";import{m as c}from"./index-2LCHaVNX.js";const p=f(import.meta.url),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=n=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[t,e]=a.versions.node.split(".").map(Number);if(t>22||t===22&&e>=3||t===20&&e>=16)return a.getBuiltinModule(n)}return p(n)},{statSync:m,existsSync:d}=k("node:fs"),g={aube:["aube-lock.yaml"],bun:["bun.lock","bun.lockb"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},b={aube:["node_modules/.aube-state","node_modules/.modules.yaml"],bun:["node_modules/.bun-tag"],npm:["node_modules/.package-lock.json"],pnpm:["node_modules/.modules.yaml","node_modules/.pnpm/lock.yaml"],yarn:["node_modules/.yarn-integrity","node_modules/.yarn-state.yml",".yarn/install-state.gz"]},y={ci:{aube:"aube ci",bun:"bun install --frozen-lockfile",npm:"npm ci",pnpm:"pnpm install --frozen-lockfile",yarn:"yarn install --immutable"},tty:{aube:"aube install",bun:"bun install",npm:"npm install",pnpm:"pnpm install",yarn:"yarn install"}},h=1e3,_=n=>{for(const[t,e]of Object.entries(g))for(const s of e)if(d(c(n,s)))return{lockfileFile:s,manager:t}},M=(n,t)=>{let e;for(const s of b[t]){const o=c(n,s);if(!d(o))continue;const{mtimeMs:i}=m(o);(!e||i>e.mtimeMs)&&(e={mtimeMs:i,path:s})}return e},j=(n,t={})=>{const e=_(n);if(!e)return{checked:!1};const{lockfileFile:s,manager:o}=e,i=m(c(n,s)).mtimeMs,l=M(n,o),u=y[t.inCi?"ci":"tty"][o],r={installMarkerMtimeMs:l?.mtimeMs,lockfileMtimeMs:i,lockfilePath:s,marker:l?.path,packageManager:o};return l?i>l.mtimeMs+h?{checked:!0,detail:r,failure:"stale-install",message:`${s} is newer than node_modules (${l.path}) — run \`${u}\` to sync.`}:{checked:!0,detail:r}:{checked:!0,detail:r,failure:"missing-install",message:`lockfile detected but node_modules looks uninitialised — run \`${u}\` before \`vis run\`.`}},v=(n,t,e,s={})=>{if(s.skip)return{checked:!1,shouldContinue:!0};const o=j(n,{inCi:t});if(!o.failure)return{...o,shouldContinue:!0};const i=`preflight: ${o.message??"lockfile drift detected"}`;return t&&!s.ciAsWarning?{...o,formattedMessage:i,shouldContinue:!1}:(e.warn(i),{...o,formattedMessage:i,shouldContinue:!0})};export{_ as d,v as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as O}from"node:module";const $=O(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,s]=u.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return u.getBuiltinModule(t)}return $(t)},{spawn:P}=h("node:child_process"),{cwd:y}=u,{basename:S,normalize:A,delimiter:p,resolve:E,dirname:f}=h("node:path"),{pipeline:T}=h("node:stream/promises"),{PassThrough:k}=h("node:stream"),j=h("node:readline"),{openSync:B,readSync:q,closeSync:H,statSync:M}=h("node:fs"),F=/^path$/i,w={key:"PATH",value:""};function b(t){for(const e in t){if(!Object.prototype.hasOwnProperty.call(t,e)||!F.test(e))continue;const s=t[e];return s?{key:e,value:s}:w}return w}function L(t,e){const s=e.value.split(p),r=[];let n=t,i;do r.push(E(n,"node_modules",".bin")),i=n,n=f(n);while(n!==i);r.push(f(process.execPath));const o=r.concat(s).join(p);return{key:e.key,value:o}}function R(t,e,s=!0){const r={...process.env,...e};if(!s)return r;const n=L(t,b(r));return r[n.key]=n.value,r}const W=t=>{let e=t.length;const s=new k,r=()=>{--e===0&&s.end()};for(const n of t)T(n,s,{end:!1}).then(r).catch(r);return s},_=/([()\][%!^"`<>&|;, *?])/g,X=/^#!\s*(.+)/,z=/\.(?:com|exe)$/i,D=/node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i,I=process.platform==="win32",N=[".EXE",".CMD",".BAT",".COM"];function V(t,e=[],s={}){if(s.shell===!0||!I)return{command:t,args:e,options:s};let r=g(t,s),n=null;if(r!==null){const i=Buffer.alloc(150);let o=null;try{o=B(r,"r"),q(o,i,0,150,0)}catch{}finally{o!==null&&H(o)}const c=i.toString().match(X);if(c!==null){const l=c[1].trim(),a=l.indexOf(" "),d=a!==-1?l.slice(0,a):l,x=a!==-1?l.slice(a+1):"",m=S(d);n=m==="env"?x||null:m}}if(n!==null&&r!==null&&(e=[r,...e],t=n,r=g(t,s)),r===null||!z.test(r)){const i=r!==null&&D.test(r);t=A(t),t=t.replace(_,"^$1"),e=e.map(o=>(o=o.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),o=o.replace(/(?=(\\+?)?)\1$/,"$1$1"),o=`"${o}"`,o=o.replace(_,"^$1"),i&&(o=o.replace(_,"^$1")),o)),e=["/d","/s","/c",`"${[t,...e].join(" ")}"`],t=s.env?.comspec??"cmd.exe",s={...s,windowsVerbatimArguments:!0}}return{command:t,args:e,options:s}}function g(t,e){const s=(e.cwd??y()).toString(),r=e.env??process.env,n=b(r).value,i=t.includes("/")||t.includes("\\")?[""]:[s,...n.split(p)],o=r.PATHEXT?r.PATHEXT.split(p):N;t.includes(".")&&o[0]!==""&&o.unshift("");for(const c of i){const l=E(s,c.startsWith('"')&&c.endsWith('"')&&c.length>1?c.slice(1,-1):c,t);for(const a of o){const d=l+a;try{if(M(d).isFile())return d}catch{}}}return null}var v=class extends Error{result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(t,e){super(`Process exited with non-zero status (${t.exitCode})`),this.result=t,this.output=e}};const G={timeout:void 0,persist:!1},J={windowsHide:!0};function Q(t){const e=new AbortController;for(const s of t){if(s.aborted)return e.abort(),s;const r=()=>{e.abort(s.reason)};s.addEventListener("abort",r,{signal:e.signal})}return e.signal}async function C(t){let e="";try{for await(const s of t)e+=s.toString()}catch{}return e}var Y=class{_process;_aborted=!1;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}constructor(t,e,s){this._options={...G,...s},this._command=t,this._args=e??[],this._processClosed=new Promise(r=>{this._resolveClose=r})}kill(t){return this._process?.kill(t)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(t,e,s){return K(t,e,{...s,stdin:this})}async*[Symbol.asyncIterator](){const t=this._process;if(!t)return;const e=[];this._streamErr&&e.push(this._streamErr),this._streamOut&&e.push(this._streamOut);const s=W(e),r=j.createInterface({input:s});for await(const n of r)yield n.toString();if(await this._processClosed,t.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new v(this)}async _waitForOutput(){const t=this._process;if(!t)throw new Error("No process was started");const[e,s]=await Promise.all([this._streamOut?C(this._streamOut):"",this._streamErr?C(this._streamErr):""]);await this._processClosed;const{stdin:r}=this._options;if(r&&typeof r!="string"&&await r,t.removeAllListeners(),this._thrownError)throw this._thrownError;const n={stderr:s,stdout:e,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new v(this,n);return n}then(t,e){return this._waitForOutput().then(t,e)}_streamOut;_streamErr;spawn(){const t=y(),e=this._options,s={...J,...e.nodeOptions},r=[];this._resetState(),e.timeout!==void 0&&r.push(AbortSignal.timeout(e.timeout)),e.signal!==void 0&&r.push(e.signal),e.persist===!0&&(s.detached=!0),r.length>0&&(s.signal=Q(r)),s.env=R(t,s.env,e.nodePath);const n=V(this._command,this._args,s),i=P(n.command,n.args,n.options);if(i.stderr&&(this._streamErr=i.stderr),i.stdout&&(this._streamOut=i.stdout),this._process=i,i.once("error",this._onError),i.once("close",this._onClose),i.stdin){const{stdin:o}=e;typeof o=="string"?i.stdin.end(o):o?.process?.stdout?.pipe(i.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(t=>{this._resolveClose=t}),this._thrownError=void 0}_onError=t=>{if(t.name==="AbortError"&&(!(t.cause instanceof Error)||t.cause.name!=="TimeoutError")){this._aborted=!0;return}this._thrownError=t};_onClose=()=>{this._resolveClose&&this._resolveClose()}};const Z=(t,e,s)=>{const r=new Y(t,e,s);return r.spawn(),r},K=Z;export{Z as k};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as j}from"node:module";import{m as d,f as y}from"./index-2LCHaVNX.js";import{a as A}from"./readJsonSync-DuMMeB3s-B9cGBVbJ.js";const M=j(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=i=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[e,t]=l.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return l.getBuiltinModule(i)}return M(i)},{readdirSync:_,lstatSync:S}=b("node:fs"),$=/^([^<(]+?)?(?:<([^>]+)>)?\s*(?:\(([^)]+)\))?\s*$/u,q=i=>{const e=i.match($);if(!e)return;const t=e[1]?.trim(),n=e[2]?.trim(),o=e[3]?.trim();if(!(!t&&!n&&!o))return{email:n||void 0,name:t||void 0,url:o||void 0}},w=i=>{if(!Array.isArray(i)||i.length===0)return;const e=[];for(const t of i)if(typeof t=="string"){const n=q(t);n&&e.push(n)}else if(t&&typeof t=="object"){const n=t,o=typeof n.name=="string"?n.name:void 0,r=typeof n.email=="string"?n.email:void 0,f=typeof n.url=="string"?n.url:void 0;(o||r||f)&&e.push({email:r,name:o,url:f})}return e.length>0?e:void 0},D=i=>{const e=d(i,"node_modules");if(!y(e))return new Map;const t=new Map,n=new Set,o=(r,f="")=>{if(n.has(r))return;n.add(r);let v;try{v=_(r)}catch{return}for(const a of v){const c=d(r,a);let m;try{m=S(c)}catch{continue}if(m.isSymbolicLink())continue;if(a.startsWith("@")){m.isDirectory()&&o(c,`${a}/`);continue}if(a===".pnpm"&&f===""){let s;try{s=_(c)}catch{continue}for(const p of s){const u=d(c,p,"node_modules");y(u)&&o(u)}continue}if(a.startsWith(".")||!m.isDirectory())continue;const g=f+a,h=d(c,"package.json");try{if(!y(h))continue;const s=A(h);if(typeof s.version!="string")continue;const p=`${g}@${s.version}`;t.has(p)||t.set(p,{directory:c,license:s.license,licenses:Array.isArray(s.licenses)?s.licenses:void 0,maintainers:w(s.maintainers),name:g,scripts:s.scripts&&typeof s.scripts=="object"?s.scripts:void 0,version:s.version});const u=d(c,"node_modules");y(u)&&o(u)}catch{}}};return o(e),t};export{w as n,D as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as a,m as h,B as l,I as f}from"./index-2LCHaVNX.js";import{E as d,j as $}from"../packem_chunks/catalog.js";const g=/\/+$/,p=/node_modules/,u=/\.git/,k=/[$()+.?[\\\]^{|}]/g,S=/\/\*\*$|\/\*\/\*$/,W=(i,c)=>{const e=c.replace(g,"");if(e.startsWith("!"))return[];const n=[];if(e.endsWith("/*")){const s=e.slice(0,-2),t=l(i,s);if(!a(t))return[];for(const r of f(t,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[p,u]}))r.path===t||r.name.startsWith(".")||n.push(h(s,r.name));return n}if(e.endsWith("/**")||e.endsWith("/*/*")){const s=e.replace(S,""),t=l(i,s);if(!a(t))return[];for(const r of f(t,{includeFiles:!1,includeSymlinks:!1,skip:[p,u]})){if(r.path===t)continue;const m=r.path.slice(t.length+1);n.push(`${s}/${m}`)}return n}if(!e.includes("/")&&e.includes("*")){const s=e.replaceAll(k,String.raw`\$&`).replaceAll("*",".*"),t=new RegExp(`^${s}$`);for(const r of f(i,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[p,u]}))r.path!==i&&t.test(r.name)&&n.push(r.name);return n}const o=l(i,e);return a(o)&&n.push(e),n},w=i=>{const c=d(i)??$(i)??[],e=new Set,n=[];for(const o of c)for(const s of W(i,o))s==="."||e.has(s)||(e.add(s),a(h(i,s,"package.json"))||n.push({packageDir:s}));return n};export{w as l};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as C}from"node:module";import{w as W}from"./target-merge-Dg25Izl5.js";import{osvBloomDecode as q,osvBloomProbeBatch as J,NATIVE_BINDING_VERSION as D}from"#native";const U=C(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[o,t]=h.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return h.getBuiltinModule(e)}return U(e)},{createHash:j,randomUUID:V}=p("node:crypto"),{existsSync:g}=p("node:fs"),{readFile:O,mkdir:M,stat:B,writeFile:F,rename:H,unlink:G}=p("node:fs/promises"),{join:d,dirname:P}=p("node:path"),I=6;if(D!==I)throw new Error(`vis native binding ABI mismatch in osv-bloom: expected ${I}, got ${D}. Rebuild via \`pnpm --filter @visulima/vis run build:native\` or reinstall the platform binding package.`);const st="https://endevco.github.io/osv-bloom",z=new Set(["endevco.github.io"]);class w extends Error{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 _ extends Error{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 K extends Error{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 m extends Error{cause="OSV_BLOOM_MANIFEST";constructor(o){super(`osv-bloom manifest invalid: ${o}`),this.name="OsvBloomManifestError"}}class Y extends Error{cause="OSV_BLOOM_CACHE_MISS";constructor(o){super(`No osv-bloom cache at ${o}. Run 'vis advisories bloom sync' first.`),this.name="OsvBloomCacheMissError"}}const y=e=>{const o=W("vis",{create:!0,cwd:e})??d(e,"node_modules",".cache","vis");return d(o,"osv-bloom")},l=e=>d(e,"filter.bin"),x=e=>d(e,"manifest.json"),R=e=>d(e,"state.json"),Q=(e,o)=>{let t;try{t=new URL(e)}catch{throw new w(e)}if(!t.host)throw new w(e);if(t.protocol!=="https:")throw new w(`${t.protocol}//${t.host}`);if(!new Set([...z,...o??[]]).has(t.host))throw new w(t.host);return t},rt=async e=>{const o=Date.now(),t=e.cacheDir??y(e.workspaceRoot);await M(t,{recursive:!0});const s=Q(e.source,e.allowedHosts),i=new URL("manifest.json",N(s.toString())),r=new URL("filter.bin",N(s.toString())),n=await A(i,{method:"GET"});if(!n.ok)throw new _(i.toString(),n.status);const v=await n.text(),a=L(v),u=await T(t);if(!e.force&&u?.setDigestSha256===a.setDigestSha256&&g(l(t)))return{bytesOnDisk:(await B(l(t))).size,cacheDir:t,durationMs:Date.now()-o,manifest:a,upToDate:!0};const S={};!e.force&&u?.filterEtag&&(S.headers={"if-none-match":u.filterEtag});const f=await A(r,{...S,method:"GET"});if(f.status===304&&u&&g(l(t)))return await $(t,v,{fetchedAtIso:new Date().toISOString(),filterEtag:u.filterEtag,setDigestSha256:a.setDigestSha256}),{bytesOnDisk:(await B(l(t))).size,cacheDir:t,durationMs:Date.now()-o,manifest:a,upToDate:!0};if(!f.ok||!f.body)throw new _(r.toString(),f.status);const c=Buffer.from(await f.arrayBuffer());e.onProgress&&e.onProgress(c.length,c.length);const E=X(c);if(E!==a.filterSha256)throw new K(a.filterSha256,E);if(c.length!==a.bloomByteLen)throw new m(`filter.bin length ${c.length} does not match manifest.bloom_byte_len ${a.bloomByteLen}`);const k=f.headers.get("etag")??void 0;return await b(l(t),c),await $(t,v,{fetchedAtIso:new Date().toISOString(),filterEtag:k,setDigestSha256:a.setDigestSha256}),{bytesOnDisk:c.length,cacheDir:t,durationMs:Date.now()-o,manifest:a,upToDate:!1}},it=async(e,o)=>{const t=o?.cacheDir??y(e),s=l(t);if(!g(s)){if(o?.softFail)return null;throw new Y(t)}const i=await O(s);return q(i)},nt=(e,o)=>J(e,o),at=async(e,o)=>{const t=o??y(e);if(!g(l(t)))return{cacheDir:t,present:!1};let s,i;try{s=L(await O(x(t),"utf8"))}catch{}try{i=await T(t)}catch{}return{cacheDir:t,fetchedAtIso:i?.fetchedAtIso,manifest:s,present:!0}},L=e=>{let o;try{o=JSON.parse(e)}catch(r){throw new m(r instanceof Error?r.message:String(r))}const t=r=>{const n=o[r];if(typeof n!="number"||Number.isNaN(n))throw new m(`field '${r}' missing or non-numeric`);return n},s=r=>{const n=o[r];if(typeof n!="string"||n.length===0)throw new m(`field '${r}' missing or empty`);return n},i=t("format_version");if(i!==1)throw new m(`unsupported format_version ${i} (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:s("built_at_rfc3339"),builtAtUnix:t("built_at_unix"),entryCount:t("entry_count"),filterSha256:s("filter_sha256"),formatVersion:i,setDigestSha256:s("set_digest_sha256"),sourceUrl:s("source_url"),targetFpr:t("target_fpr")}},T=async e=>{try{const o=await O(R(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}},$=async(e,o,t)=>{await b(x(e),Buffer.from(o,"utf8")),await b(R(e),Buffer.from(`${JSON.stringify(t,void 0,2)}
|
|
2
|
-
`,"utf8"))},b=async(e,o)=>{await M(P(e),{recursive:!0});const t=`${e}.${process.pid}.${V()}.tmp`;try{await F(t,o),await H(t,e)}catch(s){throw await G(t).catch(()=>{}),s}},X=e=>j("sha256").update(e).digest("hex"),N=e=>e.endsWith("/")?e:`${e}/`,Z=3e4,A=async(e,o)=>{try{return await fetch(e,{...o,signal:AbortSignal.timeout(Z)})}catch(t){throw new _(e.toString(),t instanceof Error?t.message:String(t))}};export{st as D,Y as O,at as g,it as l,nt as p,rt as s};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{createRequire as Bt}from"node:module";import{F as X,m as B,e as K,H as $,u as He,y as Ut,v as Mt,i as jt}from"./index-2LCHaVNX.js";import{N as Wt,a as ze}from"./readJsonSync-DuMMeB3s-B9cGBVbJ.js";import"./public-api-WqUCiyIe.js";import{a as ve,g as _t}from"./_commonjsHelpers-B5Y90VFO.js";import{r as Ht,a as zt}from"./clean-DWjQl14S.js";const Rt=Bt(import.meta.url),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,J=c=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[e,t]=I.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return I.getBuiltinModule(c)}return Rt(c)},{dirname:It}=J("node:path"),We=J("node:url"),{fileURLToPath:kt}=We,_e=J("node:module"),{createRequire:Y}=_e,Yt=J("util"),O=c=>"Deno"in c,N=c=>"Bun"in c,vr=()=>{if(O(globalThis)){const c=globalThis.Deno,e=c.execPath();let t=e;try{const{importMeta:i}=globalThis;i?.url&&(t=i.url)}catch{}return[e,t,...c.args]}return N(globalThis)?globalThis.Bun.process.argv:process.argv},yr=()=>O(globalThis)?globalThis.Deno.cwd():N(globalThis)?globalThis.Bun.process.cwd():process.cwd(),br=()=>{if(O(globalThis)){const c=globalThis.Deno;return new Proxy(c.env.toObject(),{get:(e,t)=>typeof t=="string"?c.env.get(t):e[t],has:(e,t)=>typeof t=="string"?c.env.has(t):t in e,set:(e,t,i)=>typeof t=="string"?(i===void 0||c.env.set(t,i),!0):!1})}return N(globalThis)?globalThis.Bun.process.env:process.env},Cr=()=>O(globalThis)?[]:N(globalThis)?globalThis.Bun.process.execArgv:process.execArgv,Pr=()=>O(globalThis)?globalThis.Deno.execPath():N(globalThis)?globalThis.Bun.process.execPath:process.execPath,Dr=()=>{if(O(globalThis)){const c=globalThis.Deno.build?.os??"unknown";return c==="windows"?"win32":c}return N(globalThis)?globalThis.Bun.platform??"unknown":process.platform},wr=()=>{if(O(globalThis)){const c=globalThis.Deno.build?.arch??"unknown";return c==="x86_64"?"x64":c==="aarch64"?"arm64":c}return N(globalThis)?globalThis.Bun.process.arch:process.arch},xr=(c=0)=>{if(O(globalThis))throw globalThis.Deno.exit(c),new Error("Deno exit failed");if(N(globalThis))throw globalThis.Bun.process.exit(c),new Error("Bun exit failed");process.exit(c)},Ar=(c,e)=>{if(O(globalThis))return()=>{};if(N(globalThis)){try{const i=globalThis.Bun;if(i.process?.on)return i.process.on(c,e),()=>{i.process?.removeListener&&i.process.removeListener(c,e)}}catch{}return()=>{}}const t=process;return t.on(c,e),()=>{t.removeListener(c,e)}},qt=Y(import.meta.url),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ye=c=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[e,t]=k.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return k.getBuiltinModule(c)}return qt(c)},{execFileSync:Vt}=Ye("node:child_process"),{existsSync:be,readFileSync:Kt}=Ye("node:fs"),Jt=["yarn.lock","package-lock.json","pnpm-lock.yaml","npm-shrinkwrap.json","bun.lock","bun.lockb"],Ce=new Set(["bun","npm","pnpm","yarn"]),qe=c=>{const e=Wt(Kt(c,"utf8"));return typeof e?.packageManager=="string"?e.packageManager:void 0},Xt=c=>{let e;if(Jt.forEach(i=>{!e&&be(B(c,i))&&(e=B(c,i))}),e)return e;const t=B(c,"package.json");if(be(t)&&qe(t)!==void 0)return t},Zt=c=>{if(!c)throw new K("Could not find a package manager");if(c.endsWith("package.json")){const e=qe(c);if(e){const t=["npm","yarn","pnpm","bun"].find(i=>e.startsWith(i));if(t)return{packageManager:t,path:$(c)}}}if(c.endsWith("yarn.lock"))return{packageManager:"yarn",path:$(c)};if(c.endsWith("package-lock.json")||c.endsWith("npm-shrinkwrap.json"))return{packageManager:"npm",path:$(c)};if(c.endsWith("pnpm-lock.yaml"))return{packageManager:"pnpm",path:$(c)};if(c.endsWith("bun.lock")||c.endsWith("bun.lockb"))return{packageManager:"bun",path:$(c)};throw new K("Could not find a package manager")},Qt=c=>{const e=X(Xt,{...c&&{cwd:c}});return Zt(e)},Er=c=>{if(!Ce.has(c))throw new Error(`Unsupported package manager "${c}". Expected one of: ${[...Ce].join(", ")}.`);return Vt(c,["--version"]).toString("utf8").trim()},ei=Y(import.meta.url),U=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ve=c=>{if(typeof U<"u"&&U.versions&&U.versions.node){const[e,t]=U.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return U.getBuiltinModule(c)}return ei(c)};Ve("node:fs");Ve("node:fs/promises");const ti={sha256:"sha256",sha384:"sha384",sha512:"sha512"},ii=1024,ri=/^[A-Z0-9+/]+={0,2}$/i,Pe="node_modules/",H=/^['"]/,z=/['"]$/,si=/^[a-z][a-zA-Z0-9]*:\s*$/m,ni=/resolution:\s*\{[^}]*integrity:\s*([^,}\s]+)/,oi=/^["']?((?:@[^/@"']+\/)?[^@"'\n]+)@[^\n]+\n((?:[\t ][^\n]*(?:\n|$))+)/gm,ai=/^\s+version:?\s+"?([^"\n]+)"?/m,li=/^\s+integrity[\s:]+"?([^"\s]+)"?/m,Z=c=>{if(c.length>ii)return;const e=c.indexOf("-");if(e<=0)return;const t=ti[c.slice(0,e).toLowerCase()];if(!t)return;const i=c.slice(e+1);if(ri.test(i))try{const s=Buffer.from(i,"base64");return s.length===0?void 0:{algorithm:t,hex:s.toString("hex")}}catch{return}},Q=(c,e,t)=>{const i=`${t.name}@${t.version}`;e.has(i)||(e.add(i),c.push(t))},x=(c,e,t)=>{t&&Object.keys(t).length>0&&(c[e]={...t})},R=c=>{if(!c)return;const e={};for(const[t,i]of Object.entries(c))e[t]=[i];return Object.keys(e).length>0?e:void 0},ci=c=>{const e=[],t=new Set;let i;try{i=JSON.parse(c)}catch{return e}if(!i.packages)return e;for(const[s,r]of Object.entries(i.packages)){if(!s||!r.version)continue;const o=s.lastIndexOf(Pe);if(o===-1)continue;const n=s.slice(o+Pe.length);if(n.length===0)continue;const a=n.split("/"),u=n.startsWith("@")?2:1;if(a.length!==u||a.some(v=>v.length===0))continue;const f=r.name??n;if(f.startsWith("."))continue;const g={name:f,version:r.version};if(r.integrity){const v=Z(r.integrity);v&&(g.integrity=v)}x(g,"dependencies",R(r.dependencies)),x(g,"peerDependencies",R(r.peerDependencies)),x(g,"optionalDependencies",R(r.optionalDependencies)),Q(e,t,g)}return e},Ke=c=>{let e=c.trim();e.startsWith("/")&&(e=e.slice(1)),e=e.replace(H,"").replace(z,"");const t=e.indexOf("(");t>0&&(e=e.slice(0,t));const i=e.lastIndexOf("@");if(i<=0)return;const s=e.slice(0,i),r=e.slice(i+1);if(!(!s||!r||r.startsWith("link:")||r.startsWith("workspace:")||r.startsWith("file:")))return{name:s,version:r}},Je=(c,e)=>{const t=new RegExp(String.raw`^${e}:\s*$`,"m").exec(c);if(!t)return;const i=t.index+t[0].length,s=si.exec(c.slice(i));return c.slice(i,s?i+s.index:c.length)},hi=c=>{const e=new Map,t=Je(c,"snapshots");if(!t)return e;const i=/^ {2}(['"]?[^\s:][^:\n]*?['"]?):\s*\n((?: {4}[^\n]*\n?)+)/gm;let s;for(;(s=i.exec(t)??void 0)!==void 0;){const r=Ke(s[1]);if(!r)continue;const o=`${r.name}@${r.version}`,n=s[2],a=e.get(o)??{};for(const u of["dependencies","peerDependencies","optionalDependencies"]){const f=q(n,u);if(!f)continue;const g=a[u]??{};for(const[v,y]of Object.entries(f)){const b=g[v]??[];for(const m of y)b.includes(m)||b.push(m);g[v]=b}a[u]=g}e.set(o,a)}return e},ui=c=>{const e=[],t=new Set,i=Je(c,"packages");if(!i)return e;const s=hi(c),r=/^ {2}(['"]?[^\s:][^:\n]*?['"]?):\s*\n((?: {4}[^\n]*\n?)+)/gm;let o;for(;(o=r.exec(i)??void 0)!==void 0;){const n=Ke(o[1]);if(!n)continue;const a=o[2],u=ni.exec(a),f={name:n.name,version:n.version};if(u?.[1]){const v=Z(u[1]);v&&(f.integrity=v)}const g=s.get(`${n.name}@${n.version}`);x(f,"dependencies",g?.dependencies??q(a,"dependencies")),x(f,"peerDependencies",g?.peerDependencies??q(a,"peerDependencies")),x(f,"optionalDependencies",g?.optionalDependencies??q(a,"optionalDependencies")),Q(e,t,f)}return e},q=(c,e)=>{const t=new RegExp(String.raw`^ {4}${e}:\s*\n((?: {6,}[^\n]*\n?)+)`,"m").exec(c);if(!t?.[1])return;const i={},s=/^ {6}([^\s:]+):\s*([^\n]+)/gm;let r;for(;(r=s.exec(t[1])??void 0)!==void 0;){const o=r[1].replace(H,"").replace(z,"");let n=r[2].trim();n=n.replace(H,"").replace(z,"");const a=n.indexOf("(");if(a>0&&(n=n.slice(0,a).trim()),!o||!n)continue;const u=i[o]??[];u.includes(n)||u.push(n),i[o]=u}return Object.keys(i).length>0?i:void 0},pi=c=>{const e=[],t=new Set,i=oi;i.lastIndex=0;let s;for(;(s=i.exec(c)??void 0)!==void 0;){const r=s[1].replace(H,"").replace(z,"");if(!r)continue;const o=s[2],n=ai.exec(o);if(!n?.[1])continue;const a={name:r,version:n[1].trim()},u=li.exec(o);if(u?.[1]){const f=Z(u[1]);f&&(a.integrity=f)}x(a,"dependencies",te(o,"dependencies")),x(a,"peerDependencies",te(o,"peerDependencies")),x(a,"optionalDependencies",te(o,"optionalDependencies")),Q(e,t,a)}return e},te=(c,e)=>{const t=new RegExp(String.raw`^ {2}${e}:\s*\n((?: {4,}[^\n]*\n?)+)`,"m").exec(c);if(!t?.[1])return;const i={},s=/^ {4}(['"]?[^\s:'"]+['"]?)\s*(?::\s*)?['"]([^'"\n]+)['"]/gm;let r;for(;(r=s.exec(t[1])??void 0)!==void 0;){const o=r[1].replace(H,"").replace(z,""),n=r[2];if(o&&n){const a=i[o]??[];a.includes(n)||a.push(n),i[o]=a}}return Object.keys(i).length>0?i:void 0},fi=/,(?=\s*[}\]])/g,di=c=>{const e=[],t=new Set;let i;try{i=JSON.parse(c.replaceAll(fi,""))}catch{return e}if(!i.packages)return e;for(const s of Object.values(i.packages)){const r=s[0];if(typeof r!="string")continue;const o=r.indexOf("@",1);if(o<=0)continue;const n=r.slice(0,o),a=r.slice(o+1);if(!n||!a||a.startsWith("workspace:")||a.startsWith("link:")||a.startsWith("file:"))continue;const u={name:n,version:a},f=s[3];if(typeof f=="string"&&f.length>0){const v=Z(f);v&&(u.integrity=v)}const g=s[2];if(g&&typeof g=="object"&&!Array.isArray(g)){const v=g;x(u,"dependencies",R(v.dependencies)),x(u,"peerDependencies",R(v.peerDependencies)),x(u,"optionalDependencies",R(v.optionalDependencies))}Q(e,t,u)}return e},$r=(c,e)=>{switch(e){case"bun":return di(c);case"npm":return ci(c);case"pnpm":return ui(c);case"yarn":return pi(c);default:return[]}},mi=Y(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,gi=c=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[e,t]=M.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return M.getBuiltinModule(c)}return mi(c)},{existsSync:De,readFileSync:Li}=gi("node:fs"),Or=c=>{const e=X(["lerna.json","turbo.json"],{type:"file",...c&&{cwd:c}});if(e?.endsWith("lerna.json")){const i=ze(e);if(i.useWorkspaces||i.packages)return{path:$(e),strategy:"lerna"}}const t=e?.endsWith("turbo.json");try{const{packageManager:i,path:s}=Qt(c);if(["npm","yarn"].includes(i)){const r=B(s,"package.json");if(De(r)&&Li(B(s,"package.json"),"utf8").includes("workspaces"))return{path:s,strategy:t?"turbo":i}}else if(i==="pnpm"){const r=B(s,"pnpm-workspace.yaml");if(De(r))return{path:s,strategy:t?"turbo":"pnpm"}}}catch(i){if(!(i instanceof K))throw i}throw new Error(`No monorepo root could be found upwards from the directory ${String(c??process.cwd())} using lerna, yarn, pnpm, or npm as indicators.`)},Si=Y(import.meta.url),j=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,vi=c=>{if(typeof j<"u"&&j.versions&&j.versions.node){const[e,t]=j.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return j.getBuiltinModule(c)}return Si(c)};vi("node:fs");var ie,we;function Xe(){return we||(we=1,ie=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","ALGLIB-Documentation","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Advanced-Cryptics-Dictionary","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BOLA-1.1","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-Tso","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Mark-Modifications","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","Buddy","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CAPEC-tou","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","ESA-PL-permissive-2.4","ESA-PL-strong-copyleft-2.4","ESA-PL-weak-copyleft-2.4","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-SMC","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HPND-sell-variant-critical-systems","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ISO-permission","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-STK","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MMPL-1.0.1","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-TNT","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSC-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OSSP","OpenMDW-1.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","ParaType-Free-Font-1.3","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGMLUG-PM","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TekHVC","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","UnRAR","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","Vixie-Cron","W3C","W3C-19980720","W3C-20150513","WTFNMFPL","WTFPL","Watcom-1.0","Widget-Workshop","WordNet","Wsuipa","X11","X11-distribute-modifications-variant","X11-no-permit-persons","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","hyphen-bulgarian","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"]),ie}var re,xe;function yi(){return xe||(xe=1,re=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"]),re}var se,Ae;function bi(){return Ae||(Ae=1,se=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"]),se}var ne,Ee;function Ci(){if(Ee)return ne;Ee=1;var c=[].concat(Xe()).concat(yi()),e=bi();return ne=function(t){var i=0;function s(){return i<t.length}function r(L){if(L instanceof RegExp){var h=t.slice(i),S=h.match(L);if(S)return i+=S[0].length,S[0]}else if(t.indexOf(L,i)===i)return i+=L.length,L}function o(){r(/[ ]*/)}function n(){for(var L,h=["WITH","AND","OR","(",")",":","+"],S=0;S<h.length&&(L=r(h[S]),!L);S++);if(L==="+"&&i>1&&t[i-2]===" ")throw new Error("Space before `+`");return L&&{type:"OPERATOR",string:L}}function a(){return r(/[A-Za-z0-9-.]+/)}function u(){var L=a();if(!L)throw new Error("Expected idstring at offset "+i);return L}function f(){if(r("DocumentRef-")){var L=u();return{type:"DOCUMENTREF",string:L}}}function g(){if(r("LicenseRef-")){var L=u();return{type:"LICENSEREF",string:L}}}function v(){var L=i,h=a();if(c.indexOf(h)!==-1)return{type:"LICENSE",string:h};if(e.indexOf(h)!==-1)return{type:"EXCEPTION",string:h};i=L}function y(){return n()||f()||g()||v()}for(var b=[];s()&&(o(),!!s());){var m=y();if(!m)throw new Error("Unexpected `"+t[i]+"` at offset "+i);b.push(m)}return b},ne}var oe,$e;function Pi(){return $e||($e=1,oe=function(c){var e=0;function t(){return e<c.length}function i(){return t()?c[e]:null}function s(){if(!t())throw new Error;e++}function r(m){var L=i();if(L&&L.type==="OPERATOR"&&m===L.string)return s(),L.string}function o(){if(r("WITH")){var m=i();if(m&&m.type==="EXCEPTION")return s(),m.string;throw new Error("Expected exception after `WITH`")}}function n(){var m=e,L="",h=i();if(h.type==="DOCUMENTREF"&&(s(),L+="DocumentRef-"+h.string+":",!r(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(h=i(),h.type==="LICENSEREF")return s(),L+="LicenseRef-"+h.string,{license:L};e=m}function a(){var m=i();if(m&&m.type==="LICENSE"){s();var L={license:m.string};r("+")&&(L.plus=!0);var h=o();return h&&(L.exception=h),L}}function u(){var m=r("(");if(m){var L=y();if(!r(")"))throw new Error("Expected `)`");return L}}function f(){return u()||n()||a()}function g(m,L){return function h(){var S=L();if(S){if(!r(m))return S;var C=h();if(!C)throw new Error("Expected expression");return{left:S,conjunction:m.toLowerCase(),right:C}}}}var v=g("AND",f),y=g("OR",v),b=y();if(!b||t())throw new Error("Syntax error");return b}),oe}var ae,Oe;function Ze(){if(Oe)return ae;Oe=1;var c=Ci(),e=Pi();return ae=function(t){return e(c(t))},ae}var le,Ne;function Di(){if(Ne)return le;Ne=1;var c=Ze(),e=Xe();function t(h){try{return c(h),!0}catch{return!1}}function i(h,S){var C=S[0].length-h[0].length;return C!==0?C:h[0].toUpperCase().localeCompare(S[0].toUpperCase())}var s=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(i),r=0,o=1,n=[function(h){return h.toUpperCase()},function(h){return h.trim()},function(h){return h.replace(/\./g,"")},function(h){return h.replace(/\s+/g,"")},function(h){return h.replace(/\s+/g,"-")},function(h){return h.replace("v","-")},function(h){return h.replace(/,?\s*(\d)/,"-$1")},function(h){return h.replace(/,?\s*(\d)/,"-$1.0")},function(h){return h.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(h){return h.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(h){return h[0].toUpperCase()+h.slice(1)},function(h){return h.replace("/","-")},function(h){return h.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(h){return h.indexOf("3.0")!==-1?h+"-or-later":h+"-only"},function(h){return h+"only"},function(h){return h.replace(/(\d)$/,"-$1.0")},function(h){return h.replace(/(-| )?(\d)$/,"-$2-Clause")},function(h){return h.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(h){return h.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(h){return h.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(h){return h.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(h){return h.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(h){return h.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(h){return"CC-"+h},function(h){return"CC-"+h+"-4.0"},function(h){return h.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(h){return"CC-"+h.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],a=e.map(function(h){var S=/^(.*)-\d+\.\d+$/.exec(h);return S?[S[0],S[1]]:[h,null]}).reduce(function(h,S){var C=S[1];return h[C]=h[C]||[],h[C].push(S[0]),h},{}),u=Object.keys(a).map(function(h){return[h,a[h]]}).filter(function(h){return h[1].length===1&&h[0]!==null&&h[0]!=="APL"}).map(function(h){return[h[0],h[1][0]]});a=void 0;var f=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(u).sort(i),g=0,v=1,y=function(h){for(var S=0;S<n.length;S++){var C=n[S](h).trim();if(C!==h&&t(C))return C}return null},b=function(h){for(var S=h.toUpperCase(),C=0;C<f.length;C++){var l=f[C];if(S.indexOf(l[g])>-1)return l[v]}return null},m=function(h,S){for(var C=0;C<s.length;C++){var l=s[C],p=l[r];if(h.indexOf(p)>-1){var d=h.replace(p,l[o]),P=S(d);if(P!==null)return P}}return null};le=function(h,S){S=S||{};var C=S.upgrade===void 0?!0:!!S.upgrade;function l(D){return C?L(D):D}var p=typeof h=="string"&&h.trim().length!==0;if(!p)throw Error("Invalid argument. Expected non-empty string.");if(h=h.trim(),t(h))return l(h);var d=h.replace(/\+$/,"").trim();if(t(d))return l(d);var P=y(h);return P!==null||(P=m(h,function(D){return t(D)?D:y(D)}),P!==null)||(P=b(h),P!==null)||(P=m(h,b),P!==null)?l(P):null};function L(h){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(h)!==-1?h+"-only":["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(h)!==-1?h.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(h)!==-1?h+"-or-later":h}return le}var ce,Fe;function wi(){if(Fe)return ce;Fe=1;var c=Ze(),e=Di(),t='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',i=/^SEE LICEN[CS]E IN (.+)$/;function s(o,n){return n.slice(0,o.length)===o}function r(o){if(o.hasOwnProperty("license")){var n=o.license;return s("LicenseRef",n)||s("DocumentRef",n)}else return r(o.left)||r(o.right)}return ce=function(o){var n;try{n=c(o)}catch{var a;if(o==="UNLICENSED"||o==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(a=i.exec(o))return{validForOldPackages:!0,validForNewPackages:!0,inFile:a[1]};var u={validForOldPackages:!1,validForNewPackages:!1,warnings:[t]};if(o.trim().length!==0){var f=e(o);f&&u.warnings.push('license is similar to the valid expression "'+f+'"')}return u}return r(n)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[t]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}},ce}var Qe={hasSubscribers:!1},w=Qe,G=Qe;import("node:diagnostics_channel").then(c=>{w=c.channel("lru-cache:metrics"),G=c.tracingChannel("lru-cache")}).catch(()=>{});var xi=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,he=()=>w.hasSubscribers||G.hasSubscribers,et=new Set,Te=process||{},Ai=(c,e,t,i)=>{typeof Te.emitWarning=="function"?Te.emitWarning(c,e,t,i):console.error(`[${t}] ${e}: ${c}`)},Ei=c=>!et.has(c),T=c=>!!c&&c===Math.floor(c)&&c>0&&isFinite(c),tt=c=>T(c)?c<=Math.pow(2,8)?Uint8Array:c<=Math.pow(2,16)?Uint16Array:c<=Math.pow(2,32)?Uint32Array:c<=Number.MAX_SAFE_INTEGER?V:null:null,V=class extends Array{constructor(c){super(c),this.fill(0)}},$i=class _{heap;length;static#s=!1;static create(e){let t=tt(e);if(!t)return[];_.#s=!0;let i=new _(e,t);return _.#s=!1,i}constructor(e,t){if(!_.#s)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Oi=class it{#s;#c;#t;#$;#L;#B;#R;#S;get perf(){return this.#S}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#o;#v;#n;#r;#e;#u;#f;#h;#a;#y;#l;#b;#C;#d;#m;#P;#I;#p;#O;static unsafeExposeInternals(e){return{starts:e.#C,ttls:e.#d,autopurgeTimers:e.#m,sizes:e.#b,keyMap:e.#n,keyList:e.#r,valList:e.#e,next:e.#u,prev:e.#f,get head(){return e.#h},get tail(){return e.#a},free:e.#y,isBackgroundFetch:t=>e.#i(t),backgroundFetch:(t,i,s,r)=>e.#M(t,i,s,r),moveToTail:t=>e.#G(t),indexes:t=>e.#D(t),rindexes:t=>e.#w(t),isStale:t=>e.#g(t)}}get max(){return this.#s}get maxSize(){return this.#c}get calculatedSize(){return this.#v}get size(){return this.#o}get fetchMethod(){return this.#B}get memoMethod(){return this.#R}get dispose(){return this.#t}get onInsert(){return this.#$}get disposeAfter(){return this.#L}constructor(e){let{max:t=0,ttl:i,ttlResolution:s=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:n,allowStale:a,dispose:u,onInsert:f,disposeAfter:g,noDisposeOnSet:v,noUpdateTTL:y,maxSize:b=0,maxEntrySize:m=0,sizeCalculation:L,fetchMethod:h,memoMethod:S,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:l,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:d,ignoreFetchAbort:P,backgroundFetchSize:D=1,perf:A}=e;if(this.backgroundFetchSize=D,A!==void 0&&typeof A?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#S=A??xi,t!==0&&!T(t))throw new TypeError("max option must be a nonnegative integer");let E=t?tt(t):Array;if(!E)throw new Error("invalid max value: "+t);if(this.#s=t,this.#c=b,this.maxEntrySize=m||this.#c,this.sizeCalculation=L,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(S!==void 0&&typeof S!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#R=S,h!==void 0&&typeof h!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#B=h,this.#I=!!h,this.#n=new Map,this.#r=Array.from({length:t}).fill(void 0),this.#e=Array.from({length:t}).fill(void 0),this.#u=new E(t),this.#f=new E(t),this.#h=0,this.#a=0,this.#y=$i.create(t),this.#o=0,this.#v=0,typeof u=="function"&&(this.#t=u),typeof f=="function"&&(this.#$=f),typeof g=="function"?(this.#L=g,this.#l=[]):(this.#L=void 0,this.#l=void 0),this.#P=!!this.#t,this.#O=!!this.#$,this.#p=!!this.#L,this.noDisposeOnSet=!!v,this.noUpdateTTL=!!y,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!p,this.allowStaleOnFetchAbort=!!d,this.ignoreFetchAbort=!!P,this.maxEntrySize!==0){if(this.#c!==0&&!T(this.#c))throw new TypeError("maxSize must be a positive integer if specified");if(!T(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!l,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!n,this.ttlResolution=T(s)||s===0?s:1,this.ttlAutopurge=!!r,this.ttl=i||0,this.ttl){if(!T(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#j()}if(this.#s===0&&this.ttl===0&&this.#c===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#s&&!this.#c){let ee="LRU_CACHE_UNBOUNDED";Ei(ee)&&(et.add(ee),Ai("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ee,it))}}getRemainingTTL(e){return this.#n.has(e)?1/0:0}#j(){let e=new V(this.#s),t=new V(this.#s);this.#d=e,this.#C=t;let i=this.ttlAutopurge?Array.from({length:this.#s}):void 0;this.#m=i,this.#W=(n,a,u=this.#S.now())=>{t[n]=a!==0?u:0,e[n]=a,s(n,a)},this.#N=n=>{t[n]=e[n]!==0?this.#S.now():0,s(n,e[n])};let s=this.ttlAutopurge?(n,a)=>{if(i?.[n]&&(clearTimeout(i[n]),i[n]=void 0),a&&a!==0&&i){let u=setTimeout(()=>{this.#g(n)&&this.#x(this.#r[n],"expire")},a+1);u.unref&&u.unref(),i[n]=u}}:()=>{};this.#A=(n,a)=>{if(e[a]){let u=e[a],f=t[a];if(!u||!f)return;n.ttl=u,n.start=f,n.now=r||o();let g=n.now-f;n.remainingTTL=u-g}};let r=0,o=()=>{let n=this.#S.now();if(this.ttlResolution>0){r=n;let a=setTimeout(()=>r=0,this.ttlResolution);a.unref&&a.unref()}return n};this.getRemainingTTL=n=>{let a=this.#n.get(n);if(a===void 0)return 0;let u=e[a],f=t[a];if(!u||!f)return 1/0;let g=(r||o())-f;return u-g},this.#g=n=>{let a=t[n],u=e[n];return!!u&&!!a&&(r||o())-a>u}}#N=()=>{};#A=()=>{};#W=()=>{};#g=()=>!1;#V(){let e=new V(this.#s);this.#v=0,this.#b=e,this.#F=t=>{this.#v-=e[t],e[t]=0},this.#_=(t,i,s,r)=>{if(!T(s)){if(this.#i(i))return this.backgroundFetchSize;if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(s=r(i,t),!T(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return s},this.#k=(t,i,s)=>{if(e[t]=i,this.#c){let r=this.#c-e[t];for(;this.#v>r;)this.#U(!0)}this.#v+=e[t],s&&(s.entrySize=i,s.totalCalculatedSize=this.#v)}}#F=e=>{};#k=(e,t,i)=>{};#_=(e,t,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#D({allowStale:e=this.allowStale}={}){if(this.#o)for(let t=this.#a;this.#H(t)&&((e||!this.#g(t))&&(yield t),t!==this.#h);)t=this.#f[t]}*#w({allowStale:e=this.allowStale}={}){if(this.#o)for(let t=this.#h;this.#H(t)&&((e||!this.#g(t))&&(yield t),t!==this.#a);)t=this.#u[t]}#H(e){return e!==void 0&&this.#n.get(this.#r[e])===e}*entries(){for(let e of this.#D())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#i(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*rentries(){for(let e of this.#w())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#i(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*keys(){for(let e of this.#D()){let t=this.#r[e];t!==void 0&&!this.#i(this.#e[e])&&(yield t)}}*rkeys(){for(let e of this.#w()){let t=this.#r[e];t!==void 0&&!this.#i(this.#e[e])&&(yield t)}}*values(){for(let e of this.#D())this.#e[e]!==void 0&&!this.#i(this.#e[e])&&(yield this.#e[e])}*rvalues(){for(let e of this.#w())this.#e[e]!==void 0&&!this.#i(this.#e[e])&&(yield this.#e[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let i of this.#D()){let s=this.#e[i],r=this.#i(s)?s.__staleWhileFetching:s;if(r!==void 0&&e(r,this.#r[i],this))return this.#T(this.#r[i],t)}}forEach(e,t=this){for(let i of this.#D()){let s=this.#e[i],r=this.#i(s)?s.__staleWhileFetching:s;r!==void 0&&e.call(t,r,this.#r[i],this)}}rforEach(e,t=this){for(let i of this.#w()){let s=this.#e[i],r=this.#i(s)?s.__staleWhileFetching:s;r!==void 0&&e.call(t,r,this.#r[i],this)}}purgeStale(){let e=!1;for(let t of this.#w({allowStale:!0}))this.#g(t)&&(this.#x(this.#r[t],"expire"),e=!0);return e}info(e){let t=this.#n.get(e);if(t===void 0)return;let i=this.#e[t],s=this.#i(i)?i.__staleWhileFetching:i;if(s===void 0)return;let r={value:s};if(this.#d&&this.#C){let o=this.#d[t],n=this.#C[t];if(o&&n){let a=o-(this.#S.now()-n);r.ttl=a,r.start=Date.now()}}return this.#b&&(r.size=this.#b[t]),r}dump(){let e=[];for(let t of this.#D({allowStale:!0})){let i=this.#r[t],s=this.#e[t],r=this.#i(s)?s.__staleWhileFetching:s;if(r===void 0||i===void 0)continue;let o={value:r};if(this.#d&&this.#C){o.ttl=this.#d[t];let n=this.#S.now()-this.#C[t];o.start=Math.floor(Date.now()-n)}this.#b&&(o.size=this.#b[t]),e.unshift([i,o])}return e}load(e){this.clear();for(let[t,i]of e){if(i.start){let s=Date.now()-i.start;i.start=this.#S.now()-s}this.#E(t,i.value,i)}}set(e,t,i={}){let{status:s=w.hasSubscribers?{}:void 0}=i;i.status=s,s&&(s.op="set",s.key=e,t!==void 0&&(s.value=t),s.cache=this);let r=this.#E(e,t,i);return s&&w.hasSubscribers&&w.publish(s),r}#E(e,t,i,s){let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:u}=i,f=this.#i(t);if(t===void 0)return u&&(u.set="deleted"),this.delete(e),this;let{noUpdateTTL:g=this.noUpdateTTL}=i;u&&!f&&(u.value=t);let v=this.#_(e,t,i.size||0,a,u);if(this.maxEntrySize&&v>this.maxEntrySize)return this.#x(e,"set"),u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this;let y=this.#o===0?void 0:this.#n.get(e);if(y===void 0)y=this.#o===0?this.#a:this.#y.length!==0?this.#y.pop():this.#o===this.#s?this.#U(!1):this.#o,this.#r[y]=e,this.#e[y]=t,this.#n.set(e,y),this.#u[this.#a]=y,this.#f[y]=this.#a,this.#a=y,this.#o++,this.#k(y,v,u),u&&(u.set="add"),g=!1,this.#O&&!f&&this.#$?.(t,e,"add");else{this.#G(y);let b=this.#e[y];if(t!==b){if(!n)if(this.#i(b)){b!==s&&b.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=b;m!==void 0&&m!==t&&(this.#P&&this.#t?.(m,e,"set"),this.#p&&this.#l?.push([m,e,"set"]))}else this.#P&&this.#t?.(b,e,"set"),this.#p&&this.#l?.push([b,e,"set"]);if(this.#F(y),this.#k(y,v,u),this.#e[y]=t,!f){let m=b&&this.#i(b)?b.__staleWhileFetching:b,L=m===void 0?"add":t!==m?"replace":"update";u&&(u.set=L,m!==void 0&&(u.oldValue=m)),this.#O&&this.onInsert?.(t,e,L)}}else f||(u&&(u.set="update"),this.#O&&this.onInsert?.(t,e,"update"))}if(r!==0&&!this.#d&&this.#j(),this.#d&&(g||this.#W(y,r,o),u&&this.#A(u,y)),!n&&this.#p&&this.#l){let b=this.#l,m;for(;m=b?.shift();)this.#L?.(...m)}return this}pop(){try{for(;this.#o;){let e=this.#e[this.#h];if(this.#U(!0),this.#i(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#p&&this.#l){let e=this.#l,t;for(;t=e?.shift();)this.#L?.(...t)}}}#U(e){let t=this.#h,i=this.#r[t],s=this.#e[t],r=this.#i(s);r&&s.__abortController.abort(new Error("evicted"));let o=r?s.__staleWhileFetching:s;return(this.#P||this.#p)&&o!==void 0&&(this.#P&&this.#t?.(o,i,"evict"),this.#p&&this.#l?.push([o,i,"evict"])),this.#F(t),this.#m?.[t]&&(clearTimeout(this.#m[t]),this.#m[t]=void 0),e&&(this.#r[t]=void 0,this.#e[t]=void 0,this.#y.push(t)),this.#o===1?(this.#h=this.#a=0,this.#y.length=0):this.#h=this.#u[t],this.#n.delete(i),this.#o--,t}has(e,t={}){let{status:i=w.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="has",i.key=e,i.cache=this);let s=this.#K(e,t);return w.hasSubscribers&&w.publish(i),s}#K(e,t={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=t,r=this.#n.get(e);if(r!==void 0){let o=this.#e[r];if(this.#i(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#g(r))s&&(s.has="stale",this.#A(s,r));else return i&&this.#N(r),s&&(s.has="hit",this.#A(s,r)),!0}else s&&(s.has="miss");return!1}peek(e,t={}){let{status:i=he()?{}:void 0}=t;i&&(i.op="peek",i.key=e,i.cache=this),t.status=i;let s=this.#J(e,t);return w.hasSubscribers&&w.publish(i),s}#J(e,t){let{status:i,allowStale:s=this.allowStale}=t,r=this.#n.get(e);if(r===void 0||!s&&this.#g(r)){i&&(i.peek=r===void 0?"miss":"stale");return}let o=this.#e[r],n=this.#i(o)?o.__staleWhileFetching:o;return i&&(n!==void 0?(i.peek="hit",i.value=n):i.peek="miss"),n}#M(e,t,i,s){let r=t===void 0?void 0:this.#e[t];if(this.#i(r))return r;let o=new AbortController,{signal:n}=i;n?.addEventListener("abort",()=>o.abort(n.reason),{signal:o.signal});let a={signal:o.signal,options:i,context:s},u=(m,L=!1)=>{let{aborted:h}=o.signal,S=i.ignoreFetchAbort&&m!==void 0,C=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&m!==void 0);if(i.status&&(h&&!L?(i.status.fetchAborted=!0,i.status.fetchError=o.signal.reason,S&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),h&&!S&&!L)return g(o.signal.reason,C);let l=y,p=this.#e[t];return(p===y||p===void 0&&S&&L)&&(m===void 0?l.__staleWhileFetching!==void 0?this.#e[t]=l.__staleWhileFetching:this.#x(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.#E(e,m,a.options,l))),m},f=m=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=m),g(m,!1)),g=(m,L)=>{let{aborted:h}=o.signal,S=h&&i.allowStaleOnFetchAbort,C=S||i.allowStaleOnFetchRejection,l=C||i.noDeleteOnFetchRejection,p=y;if(this.#e[t]===y&&(!l||!L&&p.__staleWhileFetching===void 0?this.#x(e,"fetch"):S||(this.#e[t]=p.__staleWhileFetching)),C)return i.status&&p.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),p.__staleWhileFetching;if(p.__returned===p)throw m},v=(m,L)=>{let h=this.#B?.(e,r,a);o.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(m(void 0),i.allowStaleOnFetchAbort&&(m=S=>u(S,!0)))}),h&&h instanceof Promise?h.then(S=>m(S===void 0?void 0:S),L):h!==void 0&&m(h)};i.status&&(i.status.fetchDispatched=!0);let y=new Promise(v).then(u,f),b=Object.assign(y,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return t===void 0?(this.#E(e,b,{...a.options,status:void 0}),t=this.#n.get(e)):this.#e[t]=b,b}#i(e){if(!this.#I)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController}fetch(e,t={}){let i=G.hasSubscribers,{status:s=he()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let r=this.#z(e,t);return s&&i&&(s.trace=!0,G.tracePromise(()=>r,s).catch(()=>{})),r}async#z(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:n=this.noDisposeOnSet,size:a=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:g=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:v=this.allowStaleOnFetchRejection,ignoreFetchAbort:y=this.ignoreFetchAbort,allowStaleOnFetchAbort:b=this.allowStaleOnFetchAbort,context:m,forceRefresh:L=!1,status:h,signal:S}=t;if(h&&(h.op="fetch",h.key=e,L&&(h.forceRefresh=!0),h.cache=this),!this.#I)return h&&(h.fetch="get"),this.#T(e,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:r,status:h});let C={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:n,size:a,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:b,ignoreFetchAbort:y,status:h,signal:S},l=this.#n.get(e);if(l===void 0){h&&(h.fetch="miss");let p=this.#M(e,l,C,m);return p.__returned=p}else{let p=this.#e[l];if(this.#i(p)){let A=i&&p.__staleWhileFetching!==void 0;return h&&(h.fetch="inflight",A&&(h.returnedStale=!0)),A?p.__staleWhileFetching:p.__returned=p}let d=this.#g(l);if(!L&&!d)return h&&(h.fetch="hit"),this.#G(l),s&&this.#N(l),h&&this.#A(h,l),p;let P=this.#M(e,l,C,m),D=P.__staleWhileFetching!==void 0&&i;return h&&(h.fetch=d?"stale":"refresh",D&&d&&(h.returnedStale=!0)),D?P.__staleWhileFetching:P.__returned=P}}forceFetch(e,t={}){let i=G.hasSubscribers,{status:s=he()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let r=this.#X(e,t);return s&&i&&(s.trace=!0,G.tracePromise(()=>r,s).catch(()=>{})),r}async#X(e,t={}){let i=await this.#z(e,t);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,t={}){let{status:i=w.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="memo",i.key=e,t.context&&(i.context=t.context),i.cache=this);let s=this.#Z(e,t);return i&&(i.value=s),w.hasSubscribers&&w.publish(i),s}#Z(e,t={}){let i=this.#R;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,status:r,forceRefresh:o,...n}=t;r&&o&&(r.forceRefresh=!0);let a=this.#T(e,n),u=o||a===void 0;if(r&&(r.memo=u?"miss":"hit",u||(r.value=a)),!u)return a;let f=i(e,a,{options:n,context:s});return r&&(r.value=f),this.#E(e,f,n),f}get(e,t={}){let{status:i=w.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="get",i.key=e,i.cache=this);let s=this.#T(e,t);return i&&(s!==void 0&&(i.value=s),w.hasSubscribers&&w.publish(i)),s}#T(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=t,n=this.#n.get(e);if(n===void 0){o&&(o.get="miss");return}let a=this.#e[n],u=this.#i(a);return o&&this.#A(o,n),this.#g(n)?u?(o&&(o.get="stale-fetching"),i&&a.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),a.__staleWhileFetching):void 0):(r||this.#x(e,"expire"),o&&(o.get="stale"),i?(o&&(o.returnedStale=!0),a):void 0):(o&&(o.get=u?"fetching":"hit"),this.#G(n),s&&this.#N(n),u?a.__staleWhileFetching:a)}#Y(e,t){this.#f[t]=e,this.#u[e]=t}#G(e){e!==this.#a&&(e===this.#h?this.#h=this.#u[e]:this.#Y(this.#f[e],this.#u[e]),this.#Y(this.#a,e),this.#a=e)}delete(e){return this.#x(e,"delete")}#x(e,t){w.hasSubscribers&&w.publish({op:"delete",delete:t,key:e,cache:this});let i=!1;if(this.#o!==0){let s=this.#n.get(e);if(s!==void 0)if(this.#m?.[s]&&(clearTimeout(this.#m?.[s]),this.#m[s]=void 0),i=!0,this.#o===1)this.#q(t);else{this.#F(s);let r=this.#e[s];if(this.#i(r)?r.__abortController.abort(new Error("deleted")):(this.#P||this.#p)&&(this.#P&&this.#t?.(r,e,t),this.#p&&this.#l?.push([r,e,t])),this.#n.delete(e),this.#r[s]=void 0,this.#e[s]=void 0,s===this.#a)this.#a=this.#f[s];else if(s===this.#h)this.#h=this.#u[s];else{let o=this.#f[s];this.#u[o]=this.#u[s];let n=this.#u[s];this.#f[n]=this.#f[s]}this.#o--,this.#y.push(s)}}if(this.#p&&this.#l?.length){let s=this.#l,r;for(;r=s?.shift();)this.#L?.(...r)}return i}clear(){return this.#q("delete")}#q(e){for(let t of this.#w({allowStale:!0})){let i=this.#e[t];if(this.#i(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#r[t];this.#P&&this.#t?.(i,s,e),this.#p&&this.#l?.push([i,s,e])}}if(this.#n.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#d&&this.#C){this.#d.fill(0),this.#C.fill(0);for(let t of this.#m??[])t!==void 0&&clearTimeout(t);this.#m?.fill(void 0)}if(this.#b&&this.#b.fill(0),this.#h=0,this.#a=0,this.#y.length=0,this.#v=0,this.#o=0,this.#p&&this.#l){let t=this.#l,i;for(;i=t?.shift();)this.#L?.(...i)}}};const Ni=Object.defineProperty({__proto__:null,LRUCache:Oi},Symbol.toStringTag,{value:"Module"}),Fi=ve(Ni);var ue,Ge;function Ti(){if(Ge)return ue;Ge=1;const c=(...r)=>r.every(o=>o)?r.join(""):"",e=r=>r?encodeURIComponent(r):"",t=r=>r.toLowerCase().replace(/^\W+/g,"").replace(/(?<!\W)\W+$/,"").replace(/\//g,"").replace(/\W+/g,"-"),i={sshtemplate:({domain:r,user:o,project:n,committish:a})=>`git@${r}:${o}/${n}.git${c("#",a)}`,sshurltemplate:({domain:r,user:o,project:n,committish:a})=>`git+ssh://git@${r}/${o}/${n}.git${c("#",a)}`,edittemplate:({domain:r,user:o,project:n,committish:a,editpath:u,path:f})=>`https://${r}/${o}/${n}${c("/",u,"/",e(a||"HEAD"),"/",f)}`,browsetemplate:({domain:r,user:o,project:n,committish:a,treepath:u})=>`https://${r}/${o}/${n}${c("/",u,"/",e(a))}`,browsetreetemplate:({domain:r,user:o,project:n,committish:a,treepath:u,path:f,fragment:g,hashformat:v})=>`https://${r}/${o}/${n}/${u}/${e(a||"HEAD")}/${f}${c("#",v(g||""))}`,browseblobtemplate:({domain:r,user:o,project:n,committish:a,blobpath:u,path:f,fragment:g,hashformat:v})=>`https://${r}/${o}/${n}/${u}/${e(a||"HEAD")}/${f}${c("#",v(g||""))}`,docstemplate:({domain:r,user:o,project:n,treepath:a,committish:u})=>`https://${r}/${o}/${n}${c("/",a,"/",e(u))}#readme`,httpstemplate:({auth:r,domain:o,user:n,project:a,committish:u})=>`git+https://${c(r,"@")}${o}/${n}/${a}.git${c("#",u)}`,filetemplate:({domain:r,user:o,project:n,committish:a,path:u})=>`https://${r}/${o}/${n}/raw/${e(a||"HEAD")}/${u}`,shortcuttemplate:({type:r,user:o,project:n,committish:a})=>`${r}:${o}/${n}${c("#",a)}`,pathtemplate:({user:r,project:o,committish:n})=>`${r}/${o}${c("#",n)}`,bugstemplate:({domain:r,user:o,project:n})=>`https://${r}/${o}/${n}/issues`,hashformat:t},s={};s.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:r,user:o,project:n,committish:a,path:u})=>`https://${c(r,"@")}raw.githubusercontent.com/${o}/${n}/${e(a||"HEAD")}/${u}`,gittemplate:({auth:r,domain:o,user:n,project:a,committish:u})=>`git://${c(r,"@")}${o}/${n}/${a}.git${c("#",u)}`,tarballtemplate:({domain:r,user:o,project:n,committish:a})=>`https://codeload.${r}/${o}/${n}/tar.gz/${e(a||"HEAD")}`,extract:r=>{let[,o,n,a,u]=r.pathname.split("/",5);if(!(a&&a!=="tree")&&(a||(u=r.hash.slice(1)),n&&n.endsWith(".git")&&(n=n.slice(0,-4)),!(!o||!n)))return{user:o,project:n,committish:u}}},s.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:r,user:o,project:n,committish:a,treepath:u,path:f,editpath:g})=>`https://${r}/${o}/${n}${c("/",u,"/",e(a||"HEAD"),"/",f,g)}`,tarballtemplate:({domain:r,user:o,project:n,committish:a})=>`https://${r}/${o}/${n}/get/${e(a||"HEAD")}.tar.gz`,extract:r=>{let[,o,n,a]=r.pathname.split("/",4);if(!["get"].includes(a)&&(n&&n.endsWith(".git")&&(n=n.slice(0,-4)),!(!o||!n)))return{user:o,project:n,committish:r.hash.slice(1)}}},s.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",tarballtemplate:({domain:r,user:o,project:n,committish:a})=>`https://${r}/api/v4/projects/${e(o+"/"+n)}/repository/archive.tar.gz?sha=${e(a||"HEAD")}`,extract:r=>{const o=r.pathname.slice(1);if(o.includes("/-/")||o.includes("/archive.tar.gz"))return;const n=o.split("/");let a=n.pop();a.endsWith(".git")&&(a=a.slice(0,-4));const u=n.join("/");if(!(!u||!a))return{user:u,project:a,committish:r.hash.slice(1)}}},s.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:r,project:o,committish:n})=>`git@${r}:${o}.git${c("#",n)}`,sshurltemplate:({domain:r,project:o,committish:n})=>`git+ssh://git@${r}/${o}.git${c("#",n)}`,edittemplate:({domain:r,user:o,project:n,committish:a,editpath:u})=>`https://${r}/${o}/${n}${c("/",e(a))}/${u}`,browsetemplate:({domain:r,project:o,committish:n})=>`https://${r}/${o}${c("/",e(n))}`,browsetreetemplate:({domain:r,project:o,committish:n,path:a,hashformat:u})=>`https://${r}/${o}${c("/",e(n))}${c("#",u(a))}`,browseblobtemplate:({domain:r,project:o,committish:n,path:a,hashformat:u})=>`https://${r}/${o}${c("/",e(n))}${c("#",u(a))}`,docstemplate:({domain:r,project:o,committish:n})=>`https://${r}/${o}${c("/",e(n))}`,httpstemplate:({domain:r,project:o,committish:n})=>`git+https://${r}/${o}.git${c("#",n)}`,filetemplate:({user:r,project:o,committish:n,path:a})=>`https://gist.githubusercontent.com/${r}/${o}/raw${c("/",e(n))}/${a}`,shortcuttemplate:({type:r,project:o,committish:n})=>`${r}:${o}${c("#",n)}`,pathtemplate:({project:r,committish:o})=>`${r}${c("#",o)}`,bugstemplate:({domain:r,project:o})=>`https://${r}/${o}`,gittemplate:({domain:r,project:o,committish:n})=>`git://${r}/${o}.git${c("#",n)}`,tarballtemplate:({project:r,committish:o})=>`https://codeload.github.com/gist/${r}/tar.gz/${e(o||"HEAD")}`,extract:r=>{let[,o,n,a]=r.pathname.split("/",4);if(a!=="raw"){if(!n){if(!o)return;n=o,o=null}return n.endsWith(".git")&&(n=n.slice(0,-4)),{user:o,project:n,committish:r.hash.slice(1)}}},hashformat:function(r){return r&&"file-"+t(r)}},s.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:r,user:o,project:n,committish:a,path:u})=>`https://${r}/${o}/${n}/blob/${e(a)||"HEAD"}/${u}`,httpstemplate:({domain:r,user:o,project:n,committish:a})=>`https://${r}/${o}/${n}${c("#",a)}`,tarballtemplate:({domain:r,user:o,project:n,committish:a})=>`https://${r}/${o}/${n}/archive/${e(a)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:r=>{let[,o,n,a]=r.pathname.split("/",4);if(!["archive"].includes(a)&&(n&&n.endsWith(".git")&&(n=n.slice(0,-4)),!(!o||!n)))return{user:o,project:n,committish:r.hash.slice(1)}}};for(const[r,o]of Object.entries(s))s[r]=Object.assign({},i,o);return ue=s,ue}var pe,Be;function rt(){if(Be)return pe;Be=1;const c=(s,r,o)=>{const n=s.indexOf(o);return s.lastIndexOf(r,n>-1?n:1/0)},e=s=>{try{return new URL(s)}catch{}},t=(s,r)=>{const o=s.indexOf(":"),n=s.slice(0,o+1);if(Object.prototype.hasOwnProperty.call(r,n)||s.substr(o,3)==="://")return s;const a=s.indexOf("@");return a>-1?a>o?`git+ssh://${s}`:s:`${s.slice(0,o+1)}//${s.slice(o+1)}`},i=s=>{const r=c(s,"@","#"),o=c(s,":","#");return o>r&&(s=s.slice(0,o)+"/"+s.slice(o+1)),c(s,":","#")===-1&&s.indexOf("//")===-1&&(s=`git+ssh://${s}`),s};return pe=(s,r)=>{const o=r?t(s,r):s;return e(o)||e(i(o))},pe}var fe,Re;function Gi(){if(Re)return fe;Re=1;const c=rt(),e=t=>{const i=t.indexOf("#"),s=t.indexOf("/"),r=t.indexOf("/",s+1),o=t.indexOf(":"),n=/\s/.exec(t),a=t.indexOf("@"),u=!n||i>-1&&n.index>i,f=a===-1||i>-1&&a>i,g=o===-1||i>-1&&o>i,v=r===-1||i>-1&&r>i,y=s>0,b=i>-1?t[i-1]!=="/":!t.endsWith("/"),m=!t.startsWith(".");return u&&y&&b&&m&&f&&g&&v};return fe=(t,i,{gitHosts:s,protocols:r})=>{if(!t)return;const o=e(t)?`github:${t}`:t,n=c(o,r);if(!n)return;const a=s.byShortcut[n.protocol],u=s.byDomain[n.hostname.startsWith("www.")?n.hostname.slice(4):n.hostname],f=a||u;if(!f)return;const g=s[a||u];let v=null;r[n.protocol]?.auth&&(n.username||n.password)&&(v=`${n.username}${n.password?":"+n.password:""}`);let y=null,b=null,m=null,L=null;try{if(a){let h=n.pathname.startsWith("/")?n.pathname.slice(1):n.pathname;const S=h.indexOf("@");S>-1&&(h=h.slice(S+1));const C=h.lastIndexOf("/");C>-1?(b=decodeURIComponent(h.slice(0,C)),b||(b=null),m=decodeURIComponent(h.slice(C+1))):m=decodeURIComponent(h),m.endsWith(".git")&&(m=m.slice(0,-4)),n.hash&&(y=decodeURIComponent(n.hash.slice(1))),L="shortcut"}else{if(!g.protocols.includes(n.protocol))return;const h=g.extract(n);if(!h)return;b=h.user&&decodeURIComponent(h.user),m=decodeURIComponent(h.project),y=decodeURIComponent(h.committish),L=r[n.protocol]?.name||n.protocol.slice(0,-1)}}catch(h){if(h instanceof URIError)return;throw h}return[f,b,v,m,y,L,i]},fe}var de,Ie;function Bi(){if(Ie)return de;Ie=1;const{LRUCache:c}=Fi,e=Ti(),t=Gi(),i=rt(),s=new c({max:1e3});function r(n){try{const{protocol:a,hostname:u,pathname:f}=new URL(n);if(!u)return null;const g=/(?:git\+)http:$/.test(a)?"http:":"https:",v=f.replace(/\.git$/,"");return`${g}//${u}${v}`}catch{return null}}class o{constructor(a,u,f,g,v,y,b={}){Object.assign(this,o.#s[a],{type:a,user:u,auth:f,project:g,committish:v,default:y,opts:b})}static#s={byShortcut:{},byDomain:{}};static#c={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(a,u){o.#s[a]=u,o.#s.byDomain[u.domain]=a,o.#s.byShortcut[`${a}:`]=a,o.#c[`${a}:`]={name:a}}static fromUrl(a,u){if(typeof a!="string")return;const f=a+JSON.stringify(u||{});if(!s.has(f)){const g=t(a,u,{gitHosts:o.#s,protocols:o.#c});s.set(f,g?new o(...g):void 0)}return s.get(f)}static fromManifest(a,u={}){if(!a||typeof a!="object")return;const f=a.repository,g=f&&(typeof f=="string"?f:typeof f=="object"&&typeof f.url=="string"?f.url:null);if(!g)throw new Error("no repository");const v=g&&o.fromUrl(g.replace(/^git\+/,""),u)||null;if(v)return v;const y=r(g);return o.fromUrl(y,u)||y}static parseUrl(a){return i(a)}#t(a,u){if(typeof a!="function")return null;const f={...this,...this.opts,...u};f.path||(f.path=""),f.path.startsWith("/")&&(f.path=f.path.slice(1)),f.noCommittish&&(f.committish=null);const g=a(f);return f.noGitPlus&&g.startsWith("git+")?g.slice(4):g}hash(){return this.committish?`#${this.committish}`:""}ssh(a){return this.#t(this.sshtemplate,a)}sshurl(a){return this.#t(this.sshurltemplate,a)}browse(a,...u){return typeof a!="string"?this.#t(this.browsetemplate,a):typeof u[0]!="string"?this.#t(this.browsetreetemplate,{...u[0],path:a}):this.#t(this.browsetreetemplate,{...u[1],fragment:u[0],path:a})}browseFile(a,...u){return typeof u[0]!="string"?this.#t(this.browseblobtemplate,{...u[0],path:a}):this.#t(this.browseblobtemplate,{...u[1],fragment:u[0],path:a})}docs(a){return this.#t(this.docstemplate,a)}bugs(a){return this.#t(this.bugstemplate,a)}https(a){return this.#t(this.httpstemplate,a)}git(a){return this.#t(this.gittemplate,a)}shortcut(a){return this.#t(this.shortcuttemplate,a)}path(a){return this.#t(this.pathtemplate,a)}tarball(a){return this.#t(this.tarballtemplate,{...a,noCommittish:!1})}file(a,u){return this.#t(this.filetemplate,{...u,path:a})}edit(a,u){return this.#t(this.edittemplate,{...u,path:a})}getDefaultRepresentation(){return this.default}toString(a){return this.default&&typeof this[this.default]=="function"?this[this.default](a):this.sshurl(a)}}for(const[n,a]of Object.entries(e))o.addHost(n,a);return de=o,de}var me,ke;function Ri(){if(ke)return me;ke=1,me=c;function c(e){if(!e||e==="ERROR: No README data found!")return;e=e.trim().split(`
|
|
2
|
-
`);let t=0;for(;e[t]&&e[t].trim().match(/^(#|$)/);)t++;const i=e.length;let s=t+1;for(;s<i&&e[s].trim();)s++;return e.slice(t,s).join(" ").trim()}return me}var st={dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},nt={web:"url",name:"url"},ot={server:"start",tests:"test"};const Ii={topLevel:st,bugs:nt,script:ot},ki=Object.defineProperty({__proto__:null,bugs:nt,default:Ii,script:ot,topLevel:st},Symbol.toStringTag,{value:"Module"}),Ui=ve(ki);var ge,Ue;function Mi(){if(Ue)return ge;Ue=1;var{URL:c}=We,e=Ht(),t=zt(),i=wi(),s=Bi(),{isBuiltin:r}=_e,o=["dependencies","devDependencies","optionalDependencies"],n=Ri(),a=Ui,u=l=>l.includes("@")&&l.indexOf("@")<l.lastIndexOf(".");ge={warn:function(){},fixRepositoryField:function(l){if(l.repositories&&(this.warn("repositories"),l.repository=l.repositories[0]),!l.repository)return this.warn("missingRepository");typeof l.repository=="string"&&(l.repository={type:"git",url:l.repository});var p=l.repository.url||"";if(p){var d=s.fromUrl(p);d&&(p=l.repository.url=d.getDefaultRepresentation()==="shortcut"?d.https():d.toString())}p.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",p)},fixTypos:function(l){Object.keys(a.topLevel).forEach(function(p){Object.prototype.hasOwnProperty.call(l,p)&&this.warn("typo",p,a.topLevel[p])},this)},fixScriptsField:function(l){if(l.scripts){if(typeof l.scripts!="object"){this.warn("nonObjectScripts"),delete l.scripts;return}Object.keys(l.scripts).forEach(function(p){typeof l.scripts[p]!="string"?(this.warn("nonStringScript"),delete l.scripts[p]):a.script[p]&&!l.scripts[a.script[p]]&&this.warn("typo",p,a.script[p],"scripts")},this)}},fixFilesField:function(l){var p=l.files;p&&!Array.isArray(p)?(this.warn("nonArrayFiles"),delete l.files):l.files&&(l.files=l.files.filter(function(d){return!d||typeof d!="string"?(this.warn("invalidFilename",d),!1):!0},this))},fixBinField:function(l){if(l.bin&&typeof l.bin=="string"){var p={},d;(d=l.name.match(/^@[^/]+[/](.*)$/))?p[d[1]]=l.bin:p[l.name]=l.bin,l.bin=p}},fixManField:function(l){l.man&&typeof l.man=="string"&&(l.man=[l.man])},fixBundleDependenciesField:function(l){var p="bundledDependencies",d="bundleDependencies";l[p]&&!l[d]&&(l[d]=l[p],delete l[p]),l[d]&&!Array.isArray(l[d])?(this.warn("nonArrayBundleDependencies"),delete l[d]):l[d]&&(l[d]=l[d].filter(function(P){return!P||typeof P!="string"?(this.warn("nonStringBundleDependency",P),!1):(l.dependencies||(l.dependencies={}),Object.prototype.hasOwnProperty.call(l.dependencies,P)||(this.warn("nonDependencyBundleDependency",P),l.dependencies[P]="*"),!0)},this))},fixDependencies:function(l){S(l,this.warn),L(l),this.fixBundleDependenciesField(l),["dependencies","devDependencies"].forEach(function(p){if(p in l){if(!l[p]||typeof l[p]!="object"){this.warn("nonObjectDependencies",p),delete l[p];return}Object.keys(l[p]).forEach(function(d){var P=l[p][d];typeof P!="string"&&(this.warn("nonStringDependency",d,JSON.stringify(P)),delete l[p][d]);var D=s.fromUrl(l[p][d]);D&&(l[p][d]=D.toString())},this)}},this)},fixModulesField:function(l){l.modules&&(this.warn("deprecatedModules"),delete l.modules)},fixKeywordsField:function(l){typeof l.keywords=="string"&&(l.keywords=l.keywords.split(/,\s+/)),l.keywords&&!Array.isArray(l.keywords)?(delete l.keywords,this.warn("nonArrayKeywords")):l.keywords&&(l.keywords=l.keywords.filter(function(p){return typeof p!="string"||!p?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(l,p){var d=!p;if(!l.version)return l.version="",!0;if(!e(l.version,d))throw new Error('Invalid version: "'+l.version+'"');return l.version=t(l.version,d),!0},fixPeople:function(l){y(l,b),y(l,m)},fixNameField:function(l,p){typeof p=="boolean"?p={strict:p}:typeof p>"u"&&(p={});var d=p.strict;if(!l.name&&!d){l.name="";return}if(typeof l.name!="string")throw new Error("name field must be a string.");d||(l.name=l.name.trim()),v(l.name,d,p.allowLegacyCase),r(l.name)&&this.warn("conflictingName",l.name)},fixDescriptionField:function(l){l.description&&typeof l.description!="string"&&(this.warn("nonStringDescription"),delete l.description),l.readme&&!l.description&&(l.description=n(l.readme)),l.description===void 0&&delete l.description,l.description||this.warn("missingDescription")},fixReadmeField:function(l){l.readme||(this.warn("missingReadme"),l.readme="ERROR: No README data found!")},fixBugsField:function(l){if(!l.bugs&&l.repository&&l.repository.url){var p=s.fromUrl(l.repository.url);p&&p.bugs()&&(l.bugs={url:p.bugs()})}else if(l.bugs){if(typeof l.bugs=="string")u(l.bugs)?l.bugs={email:l.bugs}:c.canParse(l.bugs)?l.bugs={url:l.bugs}:this.warn("nonEmailUrlBugsString");else{C(l.bugs,this.warn);var d=l.bugs;l.bugs={},d.url&&(c.canParse(d.url)?l.bugs.url=d.url:this.warn("nonUrlBugsUrlField")),d.email&&(typeof d.email=="string"&&u(d.email)?l.bugs.email=d.email:this.warn("nonEmailBugsEmailField"))}!l.bugs.email&&!l.bugs.url&&(delete l.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(l){if(!l.homepage&&l.repository&&l.repository.url){var p=s.fromUrl(l.repository.url);p&&p.docs()&&(l.homepage=p.docs())}if(l.homepage){if(typeof l.homepage!="string")return this.warn("nonUrlHomepage"),delete l.homepage;c.canParse(l.homepage)||(l.homepage="http://"+l.homepage)}},fixLicenseField:function(l){const p=l.license||l.licence;if(!p)return this.warn("missingLicense");if(typeof p!="string"||p.length<1||p.trim()==="")return this.warn("invalidLicense");if(!i(p).validForNewPackages)return this.warn("invalidLicense")}};function f(l){if(l.charAt(0)!=="@")return!1;var p=l.slice(1).split("/");return p.length!==2?!1:p[0]&&p[1]&&p[0]===encodeURIComponent(p[0])&&p[1]===encodeURIComponent(p[1])}function g(l){return!l.match(/[/@\s+%:]/)&&l===encodeURIComponent(l)}function v(l,p,d){if(l.charAt(0)==="."||!(f(l)||g(l))||p&&!d&&l!==l.toLowerCase()||l.toLowerCase()==="node_modules"||l.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(l))}function y(l,p){return l.author&&(l.author=p(l.author)),["maintainers","contributors"].forEach(function(d){Array.isArray(l[d])&&(l[d]=l[d].map(p))}),l}function b(l){if(typeof l=="string")return l;var p=l.name||"",d=l.url||l.web,P=d?" ("+d+")":"",D=l.email||l.mail,A=D?" <"+D+">":"";return p+A+P}function m(l){if(typeof l!="string")return l;var p=l.match(/^([^(<]+)/),d=l.match(/\(([^()]+)\)/),P=l.match(/<([^<>]+)>/),D={};return p&&p[0].trim()&&(D.name=p[0].trim()),P&&(D.email=P[1]),d&&(D.url=d[1]),D}function L(l){var p=l.optionalDependencies;if(p){var d=l.dependencies||{};Object.keys(p).forEach(function(P){d[P]=p[P]}),l.dependencies=d}}function h(l,p,d){if(!l)return{};if(typeof l=="string"&&(l=l.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(l))return l;d("deprecatedArrayDependencies",p);var P={};return l.filter(function(D){return typeof D=="string"}).forEach(function(D){D=D.trim().split(/(:?[@\s><=])/);var A=D.shift(),E=D.join("");E=E.trim(),E=E.replace(/^@/,""),P[A]=E}),P}function S(l,p){o.forEach(function(d){l[d]&&(l[d]=h(l[d],d,p))})}function C(l,p){l&&Object.keys(l).forEach(function(d){a.bugs[d]&&(p("typo",d,a.bugs[d],"bugs"),l[a.bugs[d]]=l[d],delete l[d])})}return ge}var at="'repositories' (plural) Not supported. Please pick one as the 'repository' field",lt="No repository field.",ct="Probably broken git url: %s",ht="scripts must be an object",ut="script values must be string commands",pt="Invalid 'files' member",ft="Invalid filename in 'files' list: %s",dt="Invalid 'bundleDependencies' list. Must be array of package names",mt="Invalid bundleDependencies member: %s",gt="Non-dependency in bundleDependencies: %s",Lt="%s field must be an object",St="Invalid dependency: %s %s",vt="specifying %s as array is deprecated",yt="modules field is deprecated",bt="keywords should be an array of strings",Ct="keywords should be an array of strings",Pt="%s is also the name of a node core module.",Dt="'description' field should be a string",wt="No description",xt="No README data",At="No license field.",Et="Bug string field must be url, email, or {email,url}",$t="bugs.url field must be a string url. Deleted.",Ot="bugs.email field must be a string email. Deleted.",Nt="Normalized value of bugs field is an empty object. Deleted.",Ft="homepage field must be a string url. Deleted.",Tt="license should be a valid SPDX license expression",Gt="%s should probably be %s.";const ji={repositories:at,missingRepository:lt,brokenGitUrl:ct,nonObjectScripts:ht,nonStringScript:ut,nonArrayFiles:pt,invalidFilename:ft,nonArrayBundleDependencies:dt,nonStringBundleDependency:mt,nonDependencyBundleDependency:gt,nonObjectDependencies:Lt,nonStringDependency:St,deprecatedArrayDependencies:vt,deprecatedModules:yt,nonArrayKeywords:bt,nonStringKeyword:Ct,conflictingName:Pt,nonStringDescription:Dt,missingDescription:wt,missingReadme:xt,missingLicense:At,nonEmailUrlBugsString:Et,nonUrlBugsUrlField:$t,nonEmailBugsEmailField:Ot,emptyNormalizedBugs:Nt,nonUrlHomepage:Ft,invalidLicense:Tt,typo:Gt},Wi=Object.defineProperty({__proto__:null,brokenGitUrl:ct,conflictingName:Pt,default:ji,deprecatedArrayDependencies:vt,deprecatedModules:yt,emptyNormalizedBugs:Nt,invalidFilename:ft,invalidLicense:Tt,missingDescription:wt,missingLicense:At,missingReadme:xt,missingRepository:lt,nonArrayBundleDependencies:dt,nonArrayFiles:pt,nonArrayKeywords:bt,nonDependencyBundleDependency:gt,nonEmailBugsEmailField:Ot,nonEmailUrlBugsString:Et,nonObjectDependencies:Lt,nonObjectScripts:ht,nonStringBundleDependency:mt,nonStringDependency:St,nonStringDescription:Dt,nonStringKeyword:Ct,nonStringScript:ut,nonUrlBugsUrlField:$t,nonUrlHomepage:Ft,repositories:at,typo:Gt},Symbol.toStringTag,{value:"Module"}),_i=ve(Wi);var Le,Me;function Hi(){if(Me)return Le;Me=1;var c=Yt,e=_i;Le=function(){var i=Array.prototype.slice.call(arguments,0),s=i.shift();if(s==="typo")return t.apply(null,i);var r=e[s]?e[s]:s+": '%s'";return i.unshift(r),c.format.apply(null,i)};function t(i,s,r){return r&&(i=r+"['"+i+"']",s=r+"['"+s+"']"),c.format(e.typo,i,s)}return Le}var Se,je;function zi(){if(je)return Se;je=1,Se=r;var c=Mi();r.fixer=c;var e=Hi(),t=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],i=["dependencies","people","typos"],s=t.map(function(n){return o(n)+"Field"});s=s.concat(i);function r(n,a,u){a===!0&&(a=null,u=!0),u||(u=!1),(!a||n.private)&&(a=function(){}),n.scripts&&n.scripts.install==="node-gyp rebuild"&&!n.scripts.preinstall&&(n.gypfile=!0),c.warn=function(){a(e.apply(null,arguments))},s.forEach(function(f){c["fix"+o(f)](n,u)}),n._id=n.name+"@"+n.version}function o(n){return n.charAt(0).toUpperCase()+n.slice(1)}return Se}var Yi=zi();const qi=_t(Yi),Vi=(c,e,t)=>{const i=$(c),s=$(e),r=s===i?".":Ut(i,s);return t.some(o=>{const n=o.startsWith("./")?o.slice(2):o,a=r.startsWith("./")?r.slice(2):r;if(n==="."&&a===".")return!0;if(n.endsWith("/**")){const u=n.slice(0,-3);return a===u||a.startsWith(`${u}/`)}if(n.endsWith("/*")){const u=n.slice(0,-2);return u===""?a!=="."&&!a.includes("/"):a.startsWith(`${u}/`)||a===u}return a===n||a.startsWith(`${n}/`)})},Ki=c=>{const e=X("pnpm-workspace.yaml",{cwd:$(c),type:"file"});if(!e)return;const t=He(e),i=Array.isArray(t.packages)?t.packages:[];if(!Vi(e,c,i))return;const s={};return t.catalog&&typeof t.catalog=="object"&&(s.catalog=t.catalog),t.catalogs&&typeof t.catalogs=="object"&&(s.catalogs=t.catalogs),Object.keys(s).length>0?s:void 0},Ji=(c,e,t)=>{if(e==="catalog:")return t.catalog?.[c];if(e.startsWith("catalog:")){const i=e.slice(8);return t.catalogs?.[i]?.[c]}},Xi=(c,e)=>{for(const[t,i]of Object.entries(c)){if(typeof i!="string")continue;const s=Ji(t,i,e);s&&(c[t]=s)}},Zi=(c,e)=>{const t=["dependencies","devDependencies","peerDependencies","optionalDependencies"];for(const i of t){if(!c[i]||typeof c[i]!="object")continue;const s=c[i];Xi(s,e)}},Qi=Y(import.meta.url),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ye=c=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[e,t]=W.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return W.getBuiltinModule(c)}return Qi(c)};ye("node:fs");ye("node:readline");ye("node:util");const er=/, ([^,]*)$/,tr=new Map,ir=(c,e={})=>`${c}|s${String(e.strict?1:0)}|c${String(e.resolveCatalogs?1:0)}|j${String(e.json5===!1?0:1)}|y${String(e.yaml===!1?0:1)}|w${String(e.ignoreWarnings?1:0)}`;class rr extends Error{constructor(e){super(`The following warnings were encountered while normalizing package data:
|
|
3
|
-
- ${e.join(`
|
|
4
|
-
- `)}`),this.name="PackageJsonValidationError"}}const sr=(c,e,t=[])=>{const i=[];if(qi(c,s=>{i.push(s)},e),e&&i.length>0){const s=i.filter(r=>!t.some(o=>o instanceof RegExp?o.test(r):o===r));if(s.length>0)throw new rr(s)}return c},nr=c=>He(c),or=c=>{const e=Mt(c);return jt.parse(e)},ar=(c,e)=>e?.yaml!==!1&&(c.endsWith(".yaml")||c.endsWith(".yml"))?nr(c):e?.json5!==!1&&c.endsWith(".json5")?or(c):ze(c),lr=(c,e={})=>{const t={type:"file"};c&&(t.cwd=c);const i=["package.json"];e.yaml!==!1&&i.push("package.yaml","package.yml"),e.json5!==!1&&i.push("package.json5");const s=X(i,t);if(!s)throw new K(`No such file or directory, for ${i.join(", ").replace(er," or $1")} found.`);const r=e.cache&&typeof e.cache!="boolean"?e.cache:tr,o=ir(s,e);if(e.cache&&r.has(o))return r.get(o);const n=ar(s,e);if(e.resolveCatalogs){const u=Ki(s);u&&Zi(n,u)}sr(n,e.strict??!1,e.ignoreWarnings);const a={packageJson:n,path:s};return e.cache&&r.set(o,a),a};var cr="1.0.8";const hr={version:cr},ur=hr.version,pr="@visulima/vis";let F;const Nr=()=>{if(F!==void 0)return F;const c=process.env.VIS_VERSION;if(c)return F=c,F;try{const{packageJson:e}=lr(It(kt(import.meta.url)),{json5:!1,yaml:!1});if(e.name===pr&&typeof e.version=="string")return F=e.version,F}catch{}return F=ur,F};export{$r as D,Qt as P,Or as S,Er as T,yr as a,wr as b,Cr as c,Dr as g,Pr as h,vr as i,Nr as m,xr as p,br as t,Ar as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as b}from"node:module";import{f as w,a as T,m}from"./index-2LCHaVNX.js";import{s as j}from"./index-BAe6e0XE.js";import{g as S}from"./en-C26W78--.js";import{a as C}from"./readJsonSync-DuMMeB3s-B9cGBVbJ.js";const h=b(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,s]=u.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return u.getBuiltinModule(t)}return h(t)},{rmSync:p,writeFileSync:_}=k("node:fs"),f=3,R=1800*1e3,U=15e3,g=()=>m(S(),"packuments"),y=t=>m(g(),`${encodeURIComponent(t)}.json`),$=t=>{const e=y(t);if(w(e))try{const s=C(e);if(s.cacheVersion!==f){p(e,{force:!0});return}if(Date.now()-s.createdAt>s.ttlMs){p(e,{force:!0});return}return s.packument}catch{p(e,{force:!0});return}},z=(t,e,s)=>{T(g());const n={cacheVersion:f,createdAt:Date.now(),packument:e,ttlMs:s};_(y(t),JSON.stringify(n),"utf8")},F=t=>{const e={},s=t.versions??{};for(const[c,r]of Object.entries(s)){const i=r.dist,o={version:c};if(r._npmUser!==void 0&&(o._npmUser=r._npmUser),r.maintainers!==void 0&&(o.maintainers=r.maintainers),r.bin!==void 0&&(o.bin=r.bin),i!==void 0){const a={};i.signatures!==void 0&&(a.signatures=i.signatures),i.attestations!==void 0&&(a.attestations=i.attestations),typeof i.integrity=="string"&&(a.integrity=i.integrity),typeof i.tarball=="string"&&(a.tarball=i.tarball),typeof i.unpackedSize=="number"&&Number.isFinite(i.unpackedSize)&&i.unpackedSize>=0&&(a.unpackedSize=i.unpackedSize),typeof i.fileCount=="number"&&Number.isInteger(i.fileCount)&&i.fileCount>=0&&(a.fileCount=i.fileCount),o.dist=a}r.repository!==void 0&&(o.repository=r.repository),r.license!==void 0&&(o.license=r.license),typeof r.readme=="string"&&(o.readme=r.readme),typeof r.readmeFilename=="string"&&(o.readmeFilename=r.readmeFilename),typeof r.private=="boolean"&&(o.private=r.private),typeof r.deprecated=="string"&&(o.deprecated=r.deprecated),r.scripts!==void 0&&typeof r.scripts=="object"&&(o.scripts=r.scripts),e[c]=o}const n={name:typeof t.name=="string"?t.name:"",versions:e};return t["dist-tags"]!==void 0&&(n["dist-tags"]=t["dist-tags"]),t.time!==void 0&&(n.time=t.time),typeof t.readme=="string"&&(n.readme=t.readme),n},M=t=>{const e={Accept:"application/json"};return t!==void 0&&t!==""&&(e.Authorization=`Bearer ${t}`),e},A=async(t,e)=>{if(e.registryUrl!==void 0)return{authToken:e.authToken,url:e.registryUrl};if(e.workspaceRoot!==void 0){const{getRegistryForPackage:s,loadNpmrc:n}=await import("../packem_chunks/catalog.js").then(o=>o.a0),c=n(e.workspaceRoot),{token:r,url:i}=s(t,c);return{authToken:e.authToken??r,url:i}}return{authToken:e.authToken,url:"https://registry.npmjs.org"}},P=async(t,e={})=>{const s=e.cacheTtlMs??R,n=$(t);if(n!==void 0)return n;if(e.offline)return;const c=await A(t,e),r=`${c.url.endsWith("/")?c.url.slice(0,-1):c.url}/${t.replace("/","%2f")}`,i=new AbortController,o=setTimeout(()=>{i.abort()},U),a=()=>{i.abort()};e.signal?.addEventListener("abort",a,{once:!0});try{const d=await fetch(r,{headers:M(c.authToken),signal:i.signal});if(d.status===404)return;if(!d.ok)throw new Error(`Registry returned ${String(d.status)} for ${t}`);const v=await d.json(),l=F(v);return z(t,l,s),l}finally{clearTimeout(o),e.signal?.removeEventListener("abort",a)}},q=(t,e)=>{const s=Object.keys(t.versions);if(s.length===0)return;if(e===void 0||e===""||e==="latest")return t["dist-tags"]?.latest??s.at(-1);const n=t["dist-tags"]?.[e];return n!==void 0?n:Object.hasOwn(t.versions,e)?e:j.maxSatisfying(s,e)??void 0};export{P as g,q as r};
|