@visulima/vis 1.0.0-alpha.41 → 1.0.0-alpha.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE.md +265 -35
  3. package/dist/bin.js +1 -1
  4. package/dist/binx.js +2 -2
  5. package/dist/config/index.d.ts +1 -1
  6. package/dist/config/index.js +1 -1
  7. package/dist/packem_chunks/bloom-status.js +1 -1
  8. package/dist/packem_chunks/bloom-sync.js +1 -1
  9. package/dist/packem_chunks/cli-exec.js +1 -0
  10. package/dist/packem_chunks/{bin.js → cli-main.js} +282 -274
  11. package/dist/packem_chunks/config.js +8 -11
  12. package/dist/packem_chunks/devtools.js +1 -78
  13. package/dist/packem_chunks/dispatch.js +4 -0
  14. package/dist/packem_chunks/doctor-probe.js +1 -1
  15. package/dist/packem_chunks/fix.js +1 -1
  16. package/dist/packem_chunks/handler.js +1 -1
  17. package/dist/packem_chunks/handler10.js +1 -1
  18. package/dist/packem_chunks/handler11.js +1 -1
  19. package/dist/packem_chunks/handler12.js +1 -1
  20. package/dist/packem_chunks/handler13.js +3 -3
  21. package/dist/packem_chunks/handler14.js +1 -1
  22. package/dist/packem_chunks/handler15.js +1 -1
  23. package/dist/packem_chunks/handler16.js +1 -1
  24. package/dist/packem_chunks/handler17.js +1 -1
  25. package/dist/packem_chunks/handler18.js +1 -1
  26. package/dist/packem_chunks/handler19.js +1 -1
  27. package/dist/packem_chunks/handler2.js +1 -4
  28. package/dist/packem_chunks/handler20.js +1 -1
  29. package/dist/packem_chunks/handler21.js +1 -1
  30. package/dist/packem_chunks/handler22.js +2 -2
  31. package/dist/packem_chunks/handler23.js +5 -1
  32. package/dist/packem_chunks/handler24.js +1 -1
  33. package/dist/packem_chunks/handler25.js +1 -1
  34. package/dist/packem_chunks/handler26.js +1 -5
  35. package/dist/packem_chunks/handler27.js +5 -1
  36. package/dist/packem_chunks/handler28.js +1 -3
  37. package/dist/packem_chunks/handler29.js +3 -1
  38. package/dist/packem_chunks/handler3.js +1 -4
  39. package/dist/packem_chunks/handler30.js +1 -1
  40. package/dist/packem_chunks/handler31.js +1 -2
  41. package/dist/packem_chunks/handler32.js +2 -2
  42. package/dist/packem_chunks/handler33.js +2 -2
  43. package/dist/packem_chunks/handler34.js +2 -3
  44. package/dist/packem_chunks/handler35.js +3 -6
  45. package/dist/packem_chunks/handler36.js +6 -1
  46. package/dist/packem_chunks/handler37.js +1 -42
  47. package/dist/packem_chunks/handler38.js +42 -8
  48. package/dist/packem_chunks/handler39.js +8 -9
  49. package/dist/packem_chunks/handler4.js +4 -6
  50. package/dist/packem_chunks/handler40.js +9 -75
  51. package/dist/packem_chunks/handler41.js +75 -5
  52. package/dist/packem_chunks/handler42.js +5 -4
  53. package/dist/packem_chunks/handler43.js +4 -3
  54. package/dist/packem_chunks/handler44.js +3 -2
  55. package/dist/packem_chunks/handler45.js +2 -1
  56. package/dist/packem_chunks/handler46.js +1 -1
  57. package/dist/packem_chunks/handler47.js +1 -1
  58. package/dist/packem_chunks/handler48.js +1 -3
  59. package/dist/packem_chunks/handler49.js +3 -1
  60. package/dist/packem_chunks/handler5.js +4 -8
  61. package/dist/packem_chunks/handler50.js +1 -7
  62. package/dist/packem_chunks/handler51.js +6 -32
  63. package/dist/packem_chunks/handler52.js +33 -3
  64. package/dist/packem_chunks/handler53.js +3 -8
  65. package/dist/packem_chunks/handler54.js +6 -2
  66. package/dist/packem_chunks/handler55.js +4 -1
  67. package/dist/packem_chunks/handler56.js +1 -12
  68. package/dist/packem_chunks/handler57.js +11 -6
  69. package/dist/packem_chunks/handler58.js +3 -3
  70. package/dist/packem_chunks/handler59.js +5 -5
  71. package/dist/packem_chunks/handler6.js +6 -1
  72. package/dist/packem_chunks/handler60.js +2 -2
  73. package/dist/packem_chunks/handler61.js +1 -1
  74. package/dist/packem_chunks/handler62.js +4 -4
  75. package/dist/packem_chunks/handler63.js +3 -3
  76. package/dist/packem_chunks/handler64.js +4 -4
  77. package/dist/packem_chunks/handler65.js +9 -708
  78. package/dist/packem_chunks/handler66.js +6 -6
  79. package/dist/packem_chunks/handler67.js +4 -4
  80. package/dist/packem_chunks/handler68.js +1 -1
  81. package/dist/packem_chunks/handler69.js +5 -5
  82. package/dist/packem_chunks/handler7.js +8 -1
  83. package/dist/packem_chunks/handler70.js +6 -6
  84. package/dist/packem_chunks/handler71.js +9 -9
  85. package/dist/packem_chunks/handler72.js +708 -48
  86. package/dist/packem_chunks/handler73.js +48 -27
  87. package/dist/packem_chunks/handler74.js +27 -3
  88. package/dist/packem_chunks/handler75.js +3 -190
  89. package/dist/packem_chunks/handler76.js +189 -37
  90. package/dist/packem_chunks/handler77.js +38 -0
  91. package/dist/packem_chunks/handler8.js +1 -1
  92. package/dist/packem_chunks/handler9.js +1 -1
  93. package/dist/packem_chunks/heal-accept.js +1 -1
  94. package/dist/packem_chunks/heal.js +1 -1
  95. package/dist/packem_chunks/help-command.js +4 -4
  96. package/dist/packem_chunks/index2.js +1 -1
  97. package/dist/packem_chunks/index3.js +135 -0
  98. package/dist/packem_chunks/index4.js +74 -0
  99. package/dist/packem_chunks/keys-refresh.js +1 -1
  100. package/dist/packem_chunks/lean.js +4 -0
  101. package/dist/packem_chunks/list.js +1 -1
  102. package/dist/packem_chunks/loader.js +1 -1
  103. package/dist/packem_chunks/loader2.js +1 -1
  104. package/dist/packem_chunks/orchestrator.js +3 -3
  105. package/dist/packem_chunks/prompts.js +1 -1
  106. package/dist/packem_chunks/prune.js +1 -1
  107. package/dist/packem_chunks/registry.js +2 -2
  108. package/dist/packem_chunks/run.js +1 -1
  109. package/dist/packem_chunks/shell-runner.js +1 -1
  110. package/dist/packem_chunks/status.js +1 -1
  111. package/dist/packem_chunks/sync.js +1 -1
  112. package/dist/packem_chunks/sync2.js +1 -1
  113. package/dist/packem_chunks/tar.js +1 -1
  114. package/dist/packem_chunks/tripwire.js +1 -1
  115. package/dist/packem_chunks/ts-loader.js +2 -0
  116. package/dist/packem_chunks/verify-lockfile.js +1 -1
  117. package/dist/packem_chunks/version-resolver.js +2 -2
  118. package/dist/packem_shared/CONFIG_FILES-MsOntfYT.js +1 -0
  119. package/dist/packem_shared/{Table-CcVkyULl-B_ef6zfS.js → Table-CcVkyULl-DLWu6XHL.js} +25 -26
  120. package/dist/packem_shared/{advisories-DLeO5KMN.js → advisories-aiDtubZQ.js} +1 -1
  121. package/dist/packem_shared/{affected-shas-cVnX8-zs.js → affected-shas-C1XuRlvo.js} +1 -1
  122. package/dist/packem_shared/{ai-analysis-BUeX2J2H.js → ai-analysis-CubpCxZJ.js} +4 -4
  123. package/dist/packem_shared/{ai-fix-9Vzlp6XU.js → ai-fix-Btd5AnSr.js} +2 -2
  124. package/dist/packem_shared/augment-8fIWWGSc.js +3 -0
  125. package/dist/packem_shared/bin-CnDBuLh3.js +2 -0
  126. package/dist/packem_shared/build-scripts-Doxce2VM.js +1 -0
  127. package/dist/packem_shared/command-runtime-RiCMa2C8.js +1 -0
  128. package/dist/packem_shared/compile-cache-B_Vf_WxT.js +3 -0
  129. package/dist/packem_shared/{cyclonedx-Cadls41z.js → cyclonedx-NUJ9R2GQ.js} +1 -1
  130. package/dist/packem_shared/dependency-scan-B0HV_qeB.js +1 -0
  131. package/dist/packem_shared/{docker-BMLrNtWm.js → docker-DKlF-gk3.js} +1 -1
  132. package/dist/packem_shared/failure-log-C7r6UZLP.js +2 -0
  133. package/dist/packem_shared/{giget-DHY1sQZC.js → giget-DVTFJlbR.js} +2 -2
  134. package/dist/packem_shared/glob-fqg4KepW-7Bs2kZuM.js +1 -0
  135. package/dist/packem_shared/index-BKFEWXU_.js +1 -0
  136. package/dist/packem_shared/index-CPhv-r4c.js +28 -0
  137. package/dist/packem_shared/{index-DGSsjmpV.js → index-Cb4x6lWY.js} +1 -1
  138. package/dist/packem_shared/index-DjTWo3sH.js +1 -0
  139. package/dist/packem_shared/{index-BDmTbWX1.js → index-OQZQyN5R.js} +1 -1
  140. package/dist/packem_shared/index.server-J83sowC4.js +2 -0
  141. package/dist/packem_shared/{lifecycle-4z9hHE5b.js → lifecycle-D5roTh0a.js} +2 -2
  142. package/dist/packem_shared/{lockfile-C8Q1_4KK.js → lockfile-DIGyLfmF.js} +1 -1
  143. package/dist/packem_shared/main-B3juSU5z.js +1 -0
  144. package/dist/packem_shared/manifests-pLwnVmCN.js +1 -0
  145. package/dist/packem_shared/{min-release-age-D1alDE3K.js → min-release-age-pUAqTiv3.js} +3 -3
  146. package/dist/packem_shared/missing-package-json-DhYzuKhD.js +1 -0
  147. package/dist/packem_shared/{native-config-sync-BEkJW7g3.js → native-config-sync-4K9wWTj5.js} +1 -1
  148. package/dist/packem_shared/{osv-bloom-B03tUWf3.js → osv-bloom-OuTfu_LE.js} +1 -1
  149. package/dist/packem_shared/{pm-runner-BKZQo7Ts.js → pm-runner-Dws_Bw1y.js} +1 -1
  150. package/dist/packem_shared/provenance-C0P-UYOM.js +1 -0
  151. package/dist/packem_shared/readJsonSync-CvkZyKmL-CY7PZob_.js +4 -0
  152. package/dist/packem_shared/registry-keys-D4chF-Wj.js +1 -0
  153. package/dist/packem_shared/{resolve-explicit-C6WM-I2u.js → resolve-explicit-Cgheka3B.js} +3 -3
  154. package/dist/packem_shared/resolve-runtime-CJSWV-K8.js +1 -0
  155. package/dist/packem_shared/run-file-B4TqKa0X.js +1 -0
  156. package/dist/packem_shared/runtime-check-0lUJvgKt.js +1 -0
  157. package/dist/packem_shared/runtime-process-Dmz0vCJy-DUwTvH1J.js +1 -0
  158. package/dist/packem_shared/s1ngularity-Du1NnSFP.js +1 -0
  159. package/dist/packem_shared/scan-progress-CN9ONR0y.js +2 -0
  160. package/dist/packem_shared/{selectors-GCJIe342.js → selectors-UmnAuc26.js} +1 -1
  161. package/dist/packem_shared/{signatures-Xpd6HjG_.js → signatures-BOUhghTv.js} +1 -1
  162. package/dist/packem_shared/{spinner-CV3WVJLv.js → spinner-lhXugSx3.js} +1 -1
  163. package/dist/packem_shared/tabs-DTiU3usb.js +1 -0
  164. package/dist/packem_shared/target-options-ChWcK60i.js +1 -0
  165. package/dist/packem_shared/toolchain-DyCKnGch.js +5 -0
  166. package/dist/packem_shared/typosquats-DBOvXwph.js +1 -0
  167. package/dist/packem_shared/use-measured-height-CK2Co3XI.js +1 -0
  168. package/dist/packem_shared/verify-CVPYlUrF.js +1 -0
  169. package/dist/packem_shared/vis-update-app-DtHkwBca.js +1 -0
  170. package/dist/packem_shared/watch-Bkp_AAbc.js +1 -0
  171. package/dist/packem_shared/watch-loop-D9zbXzRd.js +11 -0
  172. package/dist/runtime/preload.d.ts +1 -0
  173. package/dist/runtime/preload.js +1 -0
  174. package/index.d.ts +215 -201
  175. package/index.js +28 -27
  176. package/package.json +17 -26
  177. package/dist/packem_shared/CONFIG_FILES-BfaR0jKT.js +0 -1
  178. package/dist/packem_shared/build-scripts-CCCi8U66.js +0 -1
  179. package/dist/packem_shared/command-runtime-CR70qSUM.js +0 -1
  180. package/dist/packem_shared/dependency-scan-DnTgYleU.js +0 -1
  181. package/dist/packem_shared/failure-log-CEWP3bP0.js +0 -2
  182. package/dist/packem_shared/glob-fqg4KepW-B7EjLRvw.js +0 -1
  183. package/dist/packem_shared/index-3jMNqQom.js +0 -1
  184. package/dist/packem_shared/index-Bt521H5J.js +0 -30
  185. package/dist/packem_shared/manifests-Dj3pRKBT.js +0 -1
  186. package/dist/packem_shared/missing-package-json-8vNHwbqw.js +0 -1
  187. package/dist/packem_shared/provenance-BFEwKgI3.js +0 -1
  188. package/dist/packem_shared/registry-keys-BfFto6vI.js +0 -1
  189. package/dist/packem_shared/runtime-check-Stc9AI78.js +0 -1
  190. package/dist/packem_shared/s1ngularity-DCPmPE5M.js +0 -1
  191. package/dist/packem_shared/scan-progress-CFhc0CMj.js +0 -2
  192. package/dist/packem_shared/tabs-BuTy5gPV.js +0 -1
  193. package/dist/packem_shared/toolchain-pR7AJ-tB.js +0 -5
  194. package/dist/packem_shared/typosquats-DN78xx1x.js +0 -1
  195. package/dist/packem_shared/use-measured-height-_eVGWtWt.js +0 -1
  196. package/dist/packem_shared/verify-6WCmFmy8.js +0 -1
  197. package/dist/packem_shared/vis-update-app-k3fDxech.js +0 -1
  198. package/dist/packem_shared/watch-BvIwLG4N.js +0 -1
  199. package/dist/packem_shared/watch-loop-DWkvv2tK.js +0 -11
@@ -1,30 +0,0 @@
1
- import{createRequire as Ut}from"node:module";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
2
- const require = __cjs_mod__.createRequire(import.meta.url);
3
- const jt=Ut(import.meta.url),oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Vt=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 jt(t)},{createRequire:_e}=Vt("node:module"),Bt=16,ye=32,Rt=64,V=128,fe="positionals",Wt=_e(import.meta.url),se=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,zt=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 Wt(t)},{createRequire:ct}=zt("node:module"),Ft=globalThis.process??Object.create(null),Me={versions:{}},Ee=new Proxy(Ft,{get(t,e){if(e in t)return t[e];if(e in Me)return Me[e]}}),qt=t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
4
- `),Gt=(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 h=u-c,f={};if(h)for(let p=0;p<=h;p++){const g=p+c;if(!a)f[g]=!0;else if(p===0){const $=e[g-1]?.length;f[g]=[a,($??0)-a+1]}else if(p===h)f[g]=[0,r];else{const $=e[g-p]?.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}},Ht=Ee.platform==="win32"&&!Ee.env?.WT_SESSION?">":"❯",Jt=(t,e,n)=>{const i={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:p=>p,marker:p=>p,message:p=>p,...n?.color}},s=typeof e.start.column=="number";let o=(t.includes("\r")?qt(t):t).split(`
5
- `);typeof i.tabWidth=="number"&&t.includes(" ")&&(o=o.map(p=>p.replaceAll(" "," ".repeat(i.tabWidth))));const{end:c,markerLines:a,start:u}=Gt(e,o,i.linesAbove,i.linesBelow),r=String(c).length,{gutter:l,marker:d,message:h}=i.color;let f=o.slice(u,c).map((p,g)=>{const $=u+1+g,w=a[$],y=String($).padStart(r),b=!a[$+1],N=` ${y}${i.showGutter?" |":""}`;if(w){let E="";if(Array.isArray(w)){const I=p.replaceAll(/[^\t]/g," ").slice(0,Math.max(w[0]-1,0)),O=w[1]||1;E=[`
6
- `,i.prefix+l(N.replaceAll(/\d/g," "))," ",I,d("^").repeat(O)].join(""),b&&i.message&&(E+=` ${h(i.message)}`)}return[i.prefix+d(Ht),l(N),p.length>0?` ${p}`:"",E].join("")}return`${i.prefix} ${l(N)}${p.length>0?` ${p}`:""}`}).join(`
7
- `);return i.message&&!s&&(f=`${i.prefix+" ".repeat(r+1)+i.message}
8
- ${f}`),f},Kt=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&Kt.set("AggregateError",AggregateError);const Yt=ct(import.meta.url),re=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Qt=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 Yt(t)};Qt("node:util");const Zt=()=>Ee.env?.DEBUG==="true",Y=(t,...e)=>{if(Zt()){const n=e.map(i=>typeof i=="function"?i():i);console.debug(`error:parse-stacktrace: ${t}`,...n)}},Q="<unknown>",Xt=/^(?:node:internal\/|node:|internal\/)/,en=t=>t!==void 0&&Xt.test(t),tn=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,nn=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,on=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,sn=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,rn=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,an=/in\s(.*)\s\(at\s(.+)\)\sat/,ln=/^(?:.*@)?(.*):(\d+):(\d+)$/,cn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,un=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,hn=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,Pe=/\(error: (.*)\)/,pn=/at\s/,dn=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,fn=/\S*(?:Error: |AggregateError:)/,ut=/^Anonymous function$/,mn=/^\s*in\s.*/,gn=/^.*?\s*at\s.*/,wn=/^.*?\s*@.*|\[native code\]/,ht=(t,e)=>{const n=t.includes("safari-extension"),i=t.includes("safari-web-extension");return n||i?[t.includes("@")?t.split("@")[0]:Q,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},pt=(t,e)=>{const n=on.exec(e);n&&(t.file=n[1],t.line=+n[2],t.column=+n[3])},yn=t=>{const e=an.exec(t);if(e){Y(`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]??Q,raw:t,type:void 0}}const n=rn.exec(t);if(n){Y(`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(pn,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??Q,raw:t,type:t.startsWith("internal")?"internal":void 0};return pt(i,`${n[2]}:${n[3]}:${n[4]}`),i}},vn=t=>{const e=tn.exec(t);if(e){Y(`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=nn.exec(t);if(r){const l=dn.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=sn.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]=ht(e[1]?e[1].replace(ut,"<anonymous>"):Q,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":en(a)?"internal":void 0};return o?(u.column=o.column,u.file=o.file,u.line=o.line):pt(u,`${a}:${e[3]}:${e[4]}`),u}},$n=(t,e)=>{const n=cn.exec(t);if(n){Y(`parse gecko error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`);const i=n[3]?.includes(" > eval"),s=i&&n[3]&&un.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]=ht(n[1]?n[1].replace(ut,"<anonymous>"):Q,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}}},bn=(t,e)=>{const n=hn.exec(t);if(!(n&&n[2].includes(" > eval"))&&n)return Y(`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]||Q,raw:t,type:void 0}},xn=t=>{const e=ln.exec(t);if(e)return Y(`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:Q,raw:t,type:void 0}},dt=(t,{filter:e,frameLimit:n=50}={})=>{const i=t;let s=(typeof i.stacktrace=="string"?i.stacktrace:t.stack??"").split(`
9
- `).map(o=>(Pe.test(o)?o.replace(Pe,"$1"):o).trim()).filter(o=>!fn.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(mn.test(c))u=yn(c);else if(gn.test(c))u=vn(c);else if(wn.test(c)){let r;if(a===0){const l=t,d=l.columnNumber,h=l.lineNumber,f=l.line,p=l.column;d||h?r={column:d,line:h,type:"firefox"}:(f||p)&&(r={column:p,line:f,type:"safari"})}u=bn(c,r)??$n(c,r)}else u=xn(c);return u?o.push(u):Y(`parse error stack line: "${c}"`,"not parser found"),o},[])},Nn=ct(import.meta.url),te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ie=t=>{if(typeof te<"u"&&te.versions&&te.versions.node){const[e,n]=te.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return te.getBuiltinModule(t)}return Nn(t)},{existsSync:An,readFileSync:kn}=Ie("node:fs"),{relative:En,resolve:De,sep:Cn}=Ie("node:path"),{cwd:On}=te,{fileURLToPath:_n}=Ie("node:url"),Z=(t,e,n)=>n===0?t:e===" "?t+" ".repeat(n):t+" ".repeat(e*n),ft=t=>t.replaceAll("\\","/"),In=(t,e)=>{const n=t.replace("async file:","file:");return ft(En(e,n.startsWith("file:")?_n(n):n))},Ln=(t,e,n)=>{if(e)return n.title(t.message);const i=t.message?`: ${t.message}`:"";return n.title(t.name+i)},mt=(t,{color:e,hideErrorTitle:n,indentation:i,prefix:s},o)=>`${Z(s,i,o)}${Ln(t,n,e)}
10
- `,gt=(t,{color:e,indentation:n,prefix:i},s)=>{if(t.hint===void 0)return;const o=Z(i,n,s);let c="";if(Array.isArray(t.hint))for(const a of t.hint)c+=`${o+a}
11
- `;else c+=o+t.hint;return e.hint(c)},wt=(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}}},Le=(t,e,n=0)=>{const{color:i,cwd:s,displayShortPath:o,indentation:c,prefix:a}=e,{trace:u}=wt(t,e.sourceMap),r=o?In(u.file,s):ft(u.file),{fileLine:l,method:d}=i;return`${Z(a,c,n)}at ${u.methodName?`${d(u.methodName)} `:""}${l(r)}:${l(u.line?.toString()??"")}`},Sn=(t,e)=>{if(e.allowAllFilePaths)return!0;const n=De(e.cwd),i=De(n,t);return i===n||i.startsWith(n+Cn)},yt=(t,e,n)=>{const{color:i,indentation:s,linesAbove:o,linesBelow:c,prefix:a,showGutter:u,showLineNumbers:r,tabWidth:l}=e,{source:d,trace:h}=wt(t,e.sourceMap);if(h.file===void 0)return;let f;if(d===void 0){const p=h.file.replace("file://","");if(!Sn(p,e)||!An(p))return;f=kn(p,"utf8")}else f=d;return Jt(f,{start:{column:h.column,line:h.line}},{color:i,linesAbove:o,linesBelow:c,prefix:Z(a,s,n),showGutter:u,showLineNumbers:r,tabWidth:l})},vt=(t,e,n)=>{if(t.errors.length===0)return;let i=`${Z(e.prefix,e.indentation,n)}Errors:
12
-
13
- `,s=!0;for(const o of t.errors)s?s=!1:i+=`
14
-
15
- `,i+=bt(o,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},n+1);return`
16
- ${i}`},$t=(t,e,n,i=new Set)=>{i.add(t);let s=`${Z(e.prefix,e.indentation,n)}Caused by:
17
-
18
- `;const o=t.cause;s+=mt(o,e,n);const c=dt(o).shift(),a=gt(o,e,n);if(a&&(s+=`${a}
19
- `),c&&(s+=Le(c,e,n),!e.hideErrorCauseCodeView)){const u=yt(c,e,n);u!==void 0&&(s+=`
20
- ${u}`)}if(o instanceof AggregateError){const u=vt(o,e,n);u!==void 0&&(s+=`
21
- ${u}`)}return o.cause&&(s+=i.has(o)?`
22
- ${Z(e.prefix,e.indentation,n+1)}Caused by: [Circular]`:`
23
- ${$t(o,e,n+1,i)}`),`
24
- ${s}`},Tn=(t,e)=>(t.length>0?`
25
- `:"")+t.map(n=>Le(n,e)).join(`
26
- `),bt=(t,e,n)=>{const i={allowAllFilePaths:!1,cwd:On(),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=dt(t,{filter:e.filterStacktrace,frameLimit:i.framesMaxLimit}),o=s.shift();return[e.hideMessage?void 0:mt(t,i,n),gt(t,i,n),o?Le(o,i,n):void 0,o&&!i.hideErrorCodeView?yt(o,i,n):void 0,t instanceof AggregateError?vt(t,i,n):void 0,t.cause===void 0?void 0:$t(t,i,n),s.length>0?Tn(s,i):void 0].filter(Boolean).join(`
27
- `)},Mn=(t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return bt(t,e,0)};class ie 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 ie{code;context;constructor(e,n,i){super({message:e,name:"CerebroError"}),this.code=n,this.context=i}}const R=t=>"Deno"in t,W=t=>"Bun"in t,Ce=()=>{if(R(globalThis)){const t=globalThis.Deno,e=t.execPath();let n=e;try{const{importMeta:i}=globalThis;i?.url&&(n=i.url)}catch{}return[e,n,...t.args]}return W(globalThis)?globalThis.Bun.process.argv:process.argv},Pn=()=>R(globalThis)?globalThis.Deno.cwd():W(globalThis)?globalThis.Bun.process.cwd():process.cwd(),ge=()=>{if(R(globalThis)){const t=globalThis.Deno;return new Proxy(t.env.toObject(),{get:(e,n)=>typeof n=="string"?t.env.get(n):e[n],has:(e,n)=>typeof n=="string"?t.env.has(n):n in e,set:(e,n,i)=>typeof n=="string"?(i===void 0||t.env.set(n,i),!0):!1})}return W(globalThis)?globalThis.Bun.process.env:process.env},Dn=()=>R(globalThis)?[]:W(globalThis)?globalThis.Bun.process.execArgv:process.execArgv,Un=()=>R(globalThis)?globalThis.Deno.execPath():W(globalThis)?globalThis.Bun.process.execPath:process.execPath,jn=()=>{if(R(globalThis)){const t=globalThis.Deno.build?.os??"unknown";return t==="windows"?"win32":t}return W(globalThis)?globalThis.Bun.platform??"unknown":process.platform},Vn=()=>{if(R(globalThis)){const t=globalThis.Deno.build?.arch??"unknown";return t==="x86_64"?"x64":t==="aarch64"?"arm64":t}return W(globalThis)?globalThis.Bun.process.arch:process.arch},J=(t=0)=>{if(R(globalThis))throw globalThis.Deno.exit(t),new Error("Deno exit failed");if(W(globalThis))throw globalThis.Bun.process.exit(t),new Error("Bun exit failed");process.exit(t)},Ue=(t,e)=>{if(R(globalThis))return()=>{};if(W(globalThis)){try{const i=globalThis.Bun;if(i.process?.on)return i.process.on(t,e),()=>{i.process?.removeListener&&i.process.removeListener(t,e)}}catch{}return()=>{}}const n=process;return n.on(t,e),()=>{n.removeListener(t,e)}},B=new Uint32Array(65536),Bn=(t,e)=>{const n=t.length,i=e.length,s=1<<n-1;let o=-1,c=0,a=n,u=n;for(;u--;)B[t.charCodeAt(u)]|=1<<u;for(u=0;u<i;u++){let r=B[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--;)B[t.charCodeAt(u)]=0;return a},Rn=(t,e)=>{const n=e.length,i=t.length,s=[],o=[],c=Math.ceil(n/32),a=Math.ceil(i/32);for(let p=0;p<c;p++)o[p]=-1,s[p]=0;let u=0;for(;u<a-1;u++){let p=0,g=-1;const $=u*32,w=Math.min(32,i)+$;for(let y=$;y<w;y++)B[t.charCodeAt(y)]|=1<<y;for(let y=0;y<n;y++){const b=B[e.charCodeAt(y)],N=o[y/32|0]>>>y&1,E=s[y/32|0]>>>y&1,I=b|p,O=((b|E)&g)+g^g|b|E;let m=p|~(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),p=m&I}for(let y=$;y<w;y++)B[t.charCodeAt(y)]=0}let r=0,l=-1;const d=u*32,h=Math.min(32,i-d)+d;for(let p=d;p<h;p++)B[t.charCodeAt(p)]|=1<<p;let f=i;for(let p=0;p<n;p++){const g=B[e.charCodeAt(p)],$=o[p/32|0]>>>p&1,w=s[p/32|0]>>>p&1,y=g|r,b=((g|w)&l)+l^l|g|w;let N=r|~(b|l),E=l&b;f+=N>>>i-1&1,f-=E>>>i-1&1,N>>>31^$&&(o[p/32|0]^=1<<p),E>>>31^w&&(s[p/32|0]^=1<<p),N=N<<1|$,E=E<<1|w,l=E|~(y|N),r=N&y}for(let p=d;p<h;p++)B[t.charCodeAt(p)]=0;return f},Wn=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return e.length===0?t.length:t.length<=32?Bn(t,e):Rn(t,e)},zn=_e(import.meta.url),ae=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Fn=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 zn(t)},{createRequire:qn}=Fn("node:module"),xt=String.raw,je=xt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Gn=()=>new RegExp(xt`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${je}(?:\u200D${je})*`,"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 rs=/^[ \t]*(?:\r\n|\r|\n)/,as=/(?:\r\n|\r|\n)[ \t]*$/,ls=/^(?:[\r\n]|$)/,cs=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,us=/^[ \t]*[\r\n][ \t\r\n]*$/,hs=/\r\n|\n|\r/g,ps=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,ds=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,q=Gn(),Hn=/[-_./\s]+/g,me=/(\u001B\[[0-9;]*[a-z])/i,Ve=new RegExp("\\p{Script=Arabic}","u"),Jn=new RegExp("\\p{Script=Bengali}","u"),X=new RegExp("\\p{Script=Cyrillic}","u"),Kn=new RegExp("\\p{Script=Devanagari}","u"),Yn=new RegExp("\\p{Script=Ethiopic}","u"),ve=new RegExp("\\p{Script=Greek}","u"),Be=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),Qn=new RegExp("\\p{Script=Gujarati}","u"),Zn=new RegExp("\\p{Script=Gurmukhi}","u"),Re=new RegExp("\\p{Script=Hangul}","u"),We=new RegExp("\\p{Script=Hebrew}","u"),Xn=new RegExp("\\p{Script=Hiragana}","u"),ze=new RegExp("\\p{Script=Han}","u"),ei=new RegExp("\\p{Script=Kannada}","u"),ti=new RegExp("\\p{Script=Katakana}","u"),ni=new RegExp("\\p{Script=Khmer}","u"),ii=new RegExp("\\p{Script=Lao}","u"),M=new RegExp("\\p{Script=Latin}","u"),oi=new RegExp("\\p{Script=Malayalam}","u"),si=new RegExp("\\p{Script=Myanmar}","u"),ri=new RegExp("\\p{Script=Oriya}","u"),ai=new RegExp("\\p{Script=Sinhala}","u"),li=new RegExp("\\p{Script=Tamil}","u"),ci=new RegExp("\\p{Script=Telugu}","u"),ui=new RegExp("\\p{Script=Thai}","u"),hi=new RegExp("\\p{Script=Tibetan}","u"),Fe=/[\u02BB\u02BC\u0027]/u,pi=t=>t.replace(q,"");let di=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 fi=qn(import.meta.url),le=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,mi=t=>{if(typeof le<"u"&&le.versions&&le.versions.node){const[e,n]=le.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return le.getBuiltinModule(t)}return fi(t)},{stripVTControlCharacters:gi}=mi("node:util"),$e=new di(1e3),wi=/[.*+?^${}()|[\]\\]/g,yi=t=>{const e=t.join("");if($e.has(e)){const s=$e.get(e);return s.lastIndex=0,s}const n=t.map(s=>s.replaceAll(wi,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return $e.set(e,i),i},vi=t=>{const e=[];let n=0,i;for(q.lastIndex=0;(i=q.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=q.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},$i=/[ČŠŽĐ]/i,Nt=new Uint8Array(128),At=new Uint8Array(128),kt=new Uint8Array(128);for(let t=0;t<128;t++)Nt[t]=t>=65&&t<=90?1:0,At[t]=t>=97&&t<=122?1:0,kt[t]=t>=48&&t<=57?1:0;const be=t=>Nt[t],qe=t=>At[t],xe=t=>kt[t],z=(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[p,g]=f;if(g(a[0])){l=p;break}}let h=n&&i?a[0]===a[0].toLocaleUpperCase(i):!1;for(let f=1;f<a.length;f++){const p=a[f];let g="other";for(const y of d){const[b,N]=y;if(N(p)){g=b;break}}const $=n&&i?p===p.toLocaleUpperCase(i):!1;let w=!1;s?w=s(l,g,h,$,p,f,a):(l!==g&&l!=="other"&&g!=="other"&&(w=!0),n&&g!=="other"&&!h&&$&&(w=!0)),w?(u.push(r),r=p):r+=p,l=g,n&&(h=$)}return r&&r.length>0&&u.push(r),u.length>0?u:[t]},bi=(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},Et=(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=bi(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&&be(a),l=u&&u<128&&be(u),d=a&&a<128&&qe(a),h=a&&a<128&&xe(a),f=u&&u<128&&xe(u);if(d&&l){i.push(t.slice(n,o)),n=o;continue}if(h&&!f||!h&&f){i.push(t.slice(n,o)),n=o;continue}if(f&&!h){let p=!1,g=!1;if(o+1<s){const $=t.codePointAt(o+1);p=$&&$<128&&be($),g=$&&$<128&&xe($)}if(!g&&p){i.push(t.slice(n,o),t.slice(o,o+1)),n=o+1;continue}}if(o+1<s){const p=t.codePointAt(o+1),g=p&&p<128&&qe(p);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!=="")},Ct=(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 h=r[0],f=r[0]===r[0].toLocaleUpperCase(e),p=f,g=f?0:-1;for(let $=1;$<l;$++){const w=r[$],y=w===w.toLocaleUpperCase(e);if(y===f)h+=w;else if(y)h&&h.length>0&&(d.push(h),h=w),p=!0,g=$;else{if(p&&$-g>1){const b=r[$-1],N=h.slice(0,-1);N&&N.length>0&&d.push(N),h=b+w}else h+=w;p=!1,g=-1}f=y}return h&&h.length>0&&d.push(h),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!X.test(t)&&!M.test(t))return[t];const r=[...t],l=r.length,d=[];let h=r[0];const f=r[0];let p;X.test(f)?p=1:M.test(f)?p=2:p=0;let g=f===f.toLocaleUpperCase(e);for(let w=1;w<l;w++){const y=r[w];let b;X.test(y)?b=1:M.test(y)?b=2:b=0;const N=y===y.toLocaleUpperCase(e);p!==b&&(p===1||p===2)&&(b===1||b===2)||b===p&&!g&&N?(d.push(h),h=y):h+=y,p=b,g=N}h&&h.length>0&&d.push(h);const $=[];for(let w=0;w<d.length;w++)w<d.length-1&&d[w].length===1&&M.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(!ve.test(t)&&!M.test(t))return[t];const r=[];Be.lastIndex=0;let l;for(;(l=Be.exec(t))!==null;)r.push(l[0]);r.length===0&&r.push(t);const d=[];if(r.length===1){const h=r[0];if(!h||!ve.test(h[0])||h.length===1)return[h??t]}for(const h of r){if(!h)continue;if(!ve.test(h[0])||h.length===1){d.push(h);continue}const f=h.length;let p=h[0],g=h[0]===h[0].toLocaleUpperCase(e);for(let $=1;$<f;$++){const w=h[$],y=w===w.toLocaleUpperCase(e);!g&&y?(d.push(p),p=w):p+=w,g=y}p&&d.push(p)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const r=e.startsWith("ja"),l=r?{hiragana:h=>Xn.test(h),kanji:h=>ze.test(h),katakana:h=>ti.test(h),latin:h=>M.test(h)}:{hangul:h=>Re.test(h),latin:h=>M.test(h)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(r){const h=z(t,l,!1,e,(p,g)=>p==="hiragana"&&g==="katakana"||p==="katakana"&&g==="hiragana"||p==="hiragana"&&g==="latin"||p==="katakana"&&g==="latin"||p==="kanji"&&g==="latin"||p==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),f=[];for(const p of h){const g=p;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 z(t,l,!1,e,(h,f)=>h==="hangul"&&f==="latin"||h==="latin"&&f==="hangul")}if(e.startsWith("sl")){const r=[...t],l=r.length,d=[];let h=r[0],f=r[0]===r[0].toLocaleUpperCase(e);for(let p=1;p<l;p++){const g=r[p],$=g===g.toLocaleUpperCase(e),w=$i.test(g),y=p<l-1&&r[p+1]===r[p+1].toLocaleUpperCase(e);!f&&$||w&&y?(d.push(h),h=g,w&&y&&(d.push(h),h="")):h+=g,f=$}return h&&h.length>0&&d.push(h),d}if(e.startsWith("zh"))return z(t,{han:r=>ze.test(r),latin:r=>M.test(r)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const r=l=>We.test(l)||Ve.test(l);return z(t,{latin:l=>M.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=>Kn.test(l)||Jn.test(l)||Qn.test(l)||Zn.test(l)||ei.test(l)||li.test(l)||ci.test(l)||oi.test(l)||ai.test(l)||ui.test(l)||ii.test(l)||hi.test(l)||si.test(l)||Yn.test(l)||ni.test(l)||ri.test(l);return z(t,{indic:l=>r(l),latin:l=>M.test(l)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return z(t,{cyrillic:r=>X.test(r),latin:r=>M.test(r)},!0,e);if(["ar","fa","he"].includes(e))return z(t,{latin:r=>M.test(r),rtl:r=>We.test(r)||Ve.test(r)},!1,e);if(e.startsWith("ko"))return z(t,{hangul:r=>Re.test(r),latin:r=>M.test(r)},!1,e);if(e.startsWith("uz")){if(!X.test(t)&&!M.test(t))return[t];const r=[...t],l=r.length,d=[];let h=r[0],f=r[0]===r[0].toLocaleUpperCase(e);for(let p=1;p<l;p++){const g=r[p],$=g===g.toLocaleUpperCase(e);if(Fe.test(g)||Fe.test(r[p-1])){h+=g;continue}!f&&$?(d.push(h),h=g):h+=g,f=$}return h&&h.length>0&&d.push(h),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 h=0;for(const f of n)if(t.startsWith(f,r)){c.push(a,f),h=f.length,a="";const p=f.at(-1);p&&(u=p===p.toLocaleUpperCase(e));break}if(h>0){r+=h-1;continue}!u&&d?(c.push(a),a=l):a+=l,u=d}return a&&c.push(a),c},xi=(t,e,n)=>{const i=[],s=me.test(t)?t.split(me).filter(Boolean):[t];for(const o of s){const c=o;if(me.test(c))i.push(c);else{q.lastIndex=0;const a=q.test(c)?vi(c).filter(Boolean):[c];for(const u of a)if(q.lastIndex=0,q.test(u))i.push(u);else if(e){const r=e.toLowerCase().split("-")[0];i.push(...Ct(u,r,n))}else i.push(...Et(u,n))}}return i},Ni=(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=gi(d)),r&&(d=pi(d));let h;Array.isArray(a)?h=yi(a):a instanceof RegExp?h=a:h=Hn;const f=[];let p=d;const g=h.flags.includes("g")?h:new RegExp(h.source,`${h.flags}g`);for(;p.length>0;){const w=g.exec(p);if(!w){p===".."?f.push(".."):p==="."?f.push("."):p.length>0&&f.push(p);break}const y=w.index,b=w[0],N=b.length,E=p.slice(0,y),I=p.slice(y+N);if(b.startsWith("../"))f.push(".."),p=p.slice(y+3);else if(b.startsWith("./"))f.push("."),p=p.slice(y+2);else if(y===0&&b==="..")f.push(".."),p=p.slice(2);else if(y===0&&b===".")f.push("."),p=p.slice(1);else{E.length>0&&f.push(E);let O=0;for(;(O=b.indexOf("../",O))!==-1;)f.push(".."),O+=3;for(O=0;(O=b.indexOf("./",O))!==-1;)(O===0||b[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 p=m}g.lastIndex=0}if(f.length===0){const w=d.split(h).filter(Boolean);f.push(...w)}let $=[];for(const w of f)n||i?$.push(...xi(w,o,l)):o?$.push(...Ct(w,o,l)):$.push(...Et(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)),$},Ai=_e(import.meta.url),ce=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ki=t=>{if(typeof ce<"u"&&ce.versions&&ce.versions.node){const[e,n]=ce.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ce.getBuiltinModule(t)}return Ai(t)},{writeFile:Ei,stat:Ci,rm:Oi,readFile:Ge,readdir:_i,mkdir:Ii,access:Li}=ki("node:fs/promises"),he=[{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 G=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(", ")}`)}},Ot=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}`}},Si=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(", ")}?`)}},Ti=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)}},Mi=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`);ge().CEREBRO_OUTPUT_LEVEL===String(V)&&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 Ti(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 ue=t=>t.type?.name==="Boolean",Pi=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},He=t=>(ue(t)||(t.typeLabel=t.typeLabel??Pi(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),Di=new RegExp(/^-([^\d-])$/),Ui=new RegExp(/^--(\S+)/),ji=new RegExp(/^-([^\d-]{2,})$/),Vi=t=>Di.test(t)||Ui.test(t)||ji.test(t),Bi=(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 Se extends ie{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,Se.prototype)}}let Ri=class _t extends ie{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,_t.prototype)}},Je=class It extends ie{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,It.prototype)}},Wi=class Lt extends ie{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,Lt.prototype)}};class S extends ie{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 Ke=(t,e,n)=>{const i=Number(t);if(e&&Number.isNaN(i)&&String(t).trim().toLowerCase()!=="nan")throw new Se(n??"",String(t),"Number");return i},Ye=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",Qe=t=>t===Number||typeof t=="function"&&t.name==="Number",Ze=t=>t===String||typeof t=="function"&&t.name==="String",zi=(t,e,n={})=>{const{optionName:i,strictTypes:s}=n;return Array.isArray(t)?Ye(e)?t.map(Boolean):Qe(e)?t.map(o=>Ke(o,s,i)):Ze(e)?t.map(String):t.map(o=>e(String(o))):t===null?null:Ye(e)?!!t:Qe(e)?Ke(t,s,i):Ze(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)},Fi=/-([a-z])/g,qi=/^\d+$/,pe=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",Gi=t=>t.codePointAt(0)===95,Xe=(t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],et=t=>t==="__proto__"||t==="constructor"||t==="prototype",tt=(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]},nt=(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},Hi=(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(Fi,(x,L)=>L.toUpperCase());r.set(m.name,v),l.set(v,m.name)}const d=Object.create(null),h=Object.create(null),f=[],p=[],g=new Set;let $=!1;const w=e.find(m=>m.defaultOption),y=e.some(m=>m.group),b=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 x=nt(v.name,o,c,a,u);!x&&v.value===void 0&&b&&qi.test(v.name)&&(x=b,v.value=v.name,v.name=b.name);let L=!1;if(!x&&n.negation&&v.value===void 0&&v.name.startsWith("no-")){const C=v.name.slice(3),P=nt(C,o,c,a,u);P?.type&&pe(P.type)&&(x=P,L=!0)}const A=x?x.name:v.name,T=x?.multiple,D=x?.lazyMultiple;if(Object.hasOwn(h,A)&&h[A]!==void 0&&!T&&!D&&!n.partial)throw new Ri(A);if(!x&&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(!x&&n.stopAtFirstUnknown){d._unknown=i.slice(v.index);break}if(!x&&!n.partial)throw new Je(v.name);if(v.value===void 0){const C=t[m+1],P=C?.kind==="option"&&!("name"in C)&&C.value!==void 0,U=C&&x&&!(x.type&&pe(x.type))&&(C.kind==="positional"||P),Dt=x&&x.defaultOption&&!x.multiple&&!x.lazyMultiple;if(U&&(!x?.defaultOption||Dt))if(T){let j=m+1;const we=[];for(;j<t.length&&(t[j].kind==="positional"||t[j].kind==="option"&&!("name"in t[j])&&t[j].value!==void 0);)we.push(t[j].value),g.add(t[j].index),j++;h[A]=h[A]===void 0?we:Xe(h[A],we),m=j-1}else D?(tt(h,A,C.value,!0),g.add(C.index),m++):(h[A]=C.value,g.add(C.index),m++);else x?.type&&pe(x.type)?tt(h,A,!L,T):h[A]=T?[]:null}else{let{value:C}=v;if(x?.type&&pe(x.type))switch(C){case"":{if(n.partial){h._unknown??=[];const U=`${v.rawName??`--${v.name}`}${v.value?`=${v.value}`:""}`;h._unknown.push(U),p.push({index:v.index,value:U}),C=!0}else throw new Je(v.name);break}case"false":{C=!1;break}case"true":{C=!0;break}default:C=!0}const P=[C];if(T){let U=m+1;for(;U<t.length&&t[U].kind==="positional";)P.push(t[U].value),g.add(t[U].index),U++;m=U-1}h[A]===void 0?h[A]=T||D?P:C:T||D?h[A]=Xe(h[A],P):h[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(h)){const x=o.get(m);x&&(x.multiple||x.lazyMultiple)&&!Array.isArray(v)&&(h[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 x of t)x.kind==="positional"&&!g.has(x.index)&&x.index<I&&(m.push(x.value),v.push(x));if(m.length>0){const x=h[w.name],L=w.multiple??w.lazyMultiple;x===void 0?L?(v.forEach(A=>g.add(A.index)),h[w.name]=m):(g.add(v[0].index),h[w.name]=m[0]):L&&(v.forEach(A=>g.add(A.index)),h[w.name]=Array.isArray(x)?[...m,...x]:[...m,x])}}if(!n.partial){for(const m of t)if(m.kind==="positional"&&!g.has(m.index))throw new Wi(i[m.index])}if(n.partial&&!n.stopAtFirstUnknown){const m=[...f];if(h._unknown)for(const v of p)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,x)=>v.index-x.index),d._unknown=m.map(v=>v.value))}if(n.stopAtFirstUnknown&&!$){const m=t.findIndex(x=>x.kind==="positional"&&!g.has(x.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 x=t[v].index;d._unknown=i.slice(x)}}else f.length>0&&!n.partial&&(d._unknown=f.map(m=>m.value));for(const[m,v]of Object.entries(h)){const x=n.camelCase?r?.get(m)??m:m,L=o.get(m);L?.type?d[x]=zi(v,L.type,{optionName:L.name,strictTypes:n.strictTypes}):d[x]=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={},x={};for(const A of e)if(A.group){const T=Array.isArray(A.group)?A.group:[A.group];for(const D of T)et(D)||(m[D]??={})}for(const A of Object.keys(d))if(!Gi(A)){v[A]=d[A];let T=A;n.camelCase&&(T=l?.get(A)??A);const D=o.get(T);if(D?.group){const C=Array.isArray(D.group)?D.group:[D.group];for(const P of C)et(P)||m[P]&&(m[P][A]=d[A])}else x[A]=d[A]}const L={_all:v};for(const[A,T]of Object.entries(m))L[A]=T;Object.keys(x).length>0&&(L._none=x),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},ne="-".codePointAt(0),K="=",Ji=K.codePointAt(0),Ki="--",Yi="-",Qi="--",St=t=>t.length>2&&t.startsWith(Qi),Zi=t=>St(t)&&!t.includes(K,3),Xi=t=>St(t)&&t.includes(K,3),eo=t=>{if(t.length!==2||t.codePointAt(0)!==ne||t.codePointAt(1)===ne)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},to=t=>!(t.length<=2||t.codePointAt(0)!==ne||t.codePointAt(1)===ne),no=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===Ki){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(eo(a)){const u=a.charAt(1);e.push({index:o,kind:"option",name:u,rawName:a});continue}if(to(a)&&!a.includes(K)){const u=[];let r="",l=!1;for(let d=1;d<a.length;d++){const h=a.charAt(d);l?r+=h:h.codePointAt(0)===Ji?l=!0:u.push(`${Yi}${h}`)}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(Zi(a)){const u=a.slice(2);e.push({index:o,kind:"option",name:u,rawName:a});continue}if(Xi(a)){const u=a.indexOf(K),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)===ne&&a.codePointAt(1)!==ne&&a.includes(K)){const u=a.indexOf(K),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},io=/\d/,oo=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",so=t=>typeof t=="function",ro=(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(io.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&&oo(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"&&so(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 ao(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),ro(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],h=l[1];if(!d)return r;const f=d.toLowerCase();return h===void 0?`-${f}`:`-${f}=${h}`}return r}));const a=no(c.map(String));_(n,"Tokenized arguments:","index",a);const u=Hi(a,s,i,o);return _(n,"Command-line-args parsing completed","index"),u}class lo{result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}}let Ne=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 co=/^-{1,2}(\w+)(=(.+))?$/,Tt=(t,e,n,i)=>{const s=co.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}:{}},it=(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)},uo=new Set(["0","1","false","true"]),ho=(t,e,n,i)=>{if(e.length===0||t.length===0)return{};const s=(o,c)=>{const{argName:a,argValue:u,option:r}=Tt(c,e,n,i),{lastOption:l}=o;return r&&ue(r)&&u&&a?o.partial[a]=it(u,r):o.lastName&&l&&ue(l)&&uo.has(c)&&(o.partial[o.lastName]=it(c,l)),{lastName:a,lastOption:r,partial:o.partial}};return t.reduce(s,{partial:{}}).partial},po=new Set(["0","1","false","true"]),fo=(t,e,n,i)=>{if(e.length===0||t.length===0)return t;const s=(o,c)=>{const{argValue:a,option:u}=Tt(c,e,n,i),{lastOption:r}=o;if(r&&ue(r)&&po.has(c)){const{args:l}=o;return{args:l.slice(0,-1)}}return u&&ue(u)&&a?{args:o.args}:{args:[...o.args,c],lastOption:u}};return t.reduce(s,{args:[]}).args},mo=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()]},go=t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},wo=(t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return go(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)}},yo=/_./g,vo=/^[A-Z]/,$o=t=>t.toLowerCase().replaceAll(yo,e=>e[1]?.toUpperCase()??e).replace(vo,e=>e.toLowerCase()),bo=t=>{if(!t||t.length===0)return{};const e={},n=ge();for(const i of t){const s=n[i.name],o=wo(i,s),c=o===void 0?i.defaultValue:o,a=$o(i.name);e[a]=c}return e},xo=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}},Mt=async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new Ne(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new Ne(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new Ne(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},No=(t,e,n,i)=>{const s=new lo(t.name,t),{_all:o,_unknown:c,positionals:a}=e,u=Object.keys(n).length>0?{...o,...n}:o;fe in u&&delete u[fe],s.argument=a?.[fe]??[],s.rawUnknown=[...c??[]];const r=Object.keys(i).length>0;return s.options=r?{...u,...i}:u,s.env=bo(t.env),s},Ao=(t,e,n)=>{const i=t.options??[],s=i.length>0;let o=mo(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:fe,type:t.argument.type,typeLabel:t.argument.typeLabel},...o]);let c,a;if(s){const{optionMapByAlias:r,optionMapByName:l}=xo(i);c=fo(e,i,l,r),a=ho(e,i,l,r)}else c=e,a={};const u=ao(o,{argv:c,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:o,booleanValues:a,parsedArgs:u}},ee=async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await Mt(t))(e);let ko=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(", ")}`}},Eo=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 ot=(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},Co=(t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Wn(t,e)<=t.length/3,F=(t,e)=>{const n=t.toLowerCase();return e.filter(i=>Co(i.toLowerCase(),n))},Oo=(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=F(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(`
28
- `))},_o=(t,e,n)=>{const i=n.__requiredOptions__,s=i?ot(i,e,!0):ot(t,e,!1);if(s.length>0)throw new ko(n.name,s.map(o=>o.name));e._unknown&&e._unknown.length>0&&!n.argument&&Oo(e,n)},Io=(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 Ot(s.name,typeof s.conflicts=="string"?s.conflicts:s.conflicts?.[0]??"unknown")}},Lo=(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 Eo(i.name,a,i.choices)}}},So=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(`
29
- `))},To=(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}},H=t=>t.join(" "),st=(t,e)=>e&&e.length>0?[...e,t]:[t],Mo=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Po=(t,e)=>typeof t!="string"||t===""?"":t[0].toUpperCase()+t.slice(1),Do=(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(me.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("")},Pt=(t,e)=>{if(typeof t!="string"||!t)return"";let n=!0;return Do(Ni(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,Mo(o)):Po(o)}),"")},Uo=/^no-/,jo=t=>{t.options?.forEach(e=>{e.__camelCaseName__=Pt(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(Uo,"");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)},Bo=(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=Pt(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)}},Ro=(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)}}},Wo=()=>!!process.versions.electron,zo=()=>Wo()&&!process.defaultApp,Fo=()=>zo()?0:1,qo=t=>t.slice(Fo()+1),Go=" ",Ho=(t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),Jo=t=>{if(typeof t=="string")return t.split(Go);const e=Ce();return Ho(t,e)?qo(t):t},Ko=t=>{const e=o=>{t.error(`Uncaught exception: ${o.message||o}`),o.stack&&t.error(o.stack),J(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}`)}J(1)},i=Ue("uncaughtException",e),s=Ue("unhandledRejection",n);return()=>{i(),s()}},rt=100,Yo=/^[a-z][\w-]*$/i,Oe=(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()},at=(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},Ae=(t,e)=>{if(typeof t!="object"||t===null)throw new k(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},de=t=>{const e=Oe(t,"Command name");if(e.length>rt)throw new k(`Command name is too long (maximum ${String(rt)} 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(!Yo.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},Qo=new Set([`
30
- `,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),Zo=(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(Qo.has(s))throw new Error(`Argument contains dangerous character: ${s}`)}return n.trim?t.trim():t},lt=(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=>Zo(s,n))},Xo=/^-([^\d-])$/,es=/^--(\S+)/,ts=/^-([^\d-]{2,})$/,ke=t=>Xo.test(t)||es.test(t)||ts.test(t),ns={access:(t,e)=>Li(t,e),mkdir:(t,e)=>Ii(t,e),readdir:t=>_i(t),readFile:(async(t,e)=>e===void 0?Ge(t):Ge(t,e)),rm:(t,e)=>Oi(t,e),stat:t=>Ci(t),writeFile:(t,e,n)=>Ei(t,e,n)},is=(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=>F(u.slice(2),c).map(r=>`--${r}`));throw new Si(o,a)};class Te{#t;#e;#u;#h;#f;#m;#A;#k;#E;#$;#C;#b;#O;#_=ye;#p;#n;#i;#o;#s;#r;#g=!1;#I;#L=!1;#w;#y;#v;#l=[];#D(){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.#D(),...this.#S()]),this.#v}#T(){return this.#l.length===0?he:[...he,...this.#l]}#M(){this.#w=void 0,this.#y=void 0,this.#v=void 0}#x(){if(this.#u===void 0){const e=Jo(this.#e.argv);this.#u=lt(e,{maxArguments:this.#b}),this.#U()}return this.#u}#N(){return this.#$??ge()}#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}#U(){if(!this.#u)return;let e=!1;for(const n of this.#u){if(n==="--quiet"||n==="-q"){this.#d(Bt),e=!0;break}if(n==="--verbose"||n==="-v"){this.#d(Rt),e=!0;break}if(n==="--debug"){this.#d(V),e=!0;break}}e||this.#d(Object.hasOwn(this.#N(),"DEBUG")?V:ye)}#j(){this.#L||(this.#I=Ko(this.#t),this.#L=!0)}#V(){return{arch:Vn(),argv:this.#x(),cwd:this.#h,env:this.#$??ge(),exit:this.#E??(e=>J(e??0)),platform:jn(),stdin:this.#C}}#P(e,n,i,s){this.#c()===V&&this.#t.debug(`command '${s}' found, parsing command args: ${n.join(", ")}`);const{arguments_:o,booleanValues:c,parsedArgs:a}=Ao(e,n,this.#T()),u=Object.keys(c).length>0;let r=a;u&&(r={...a,_all:{...a._all,...c}}),_o(o,r,e);const l=No(e,a,c,i);l.runtime=this,l.argv=this.#x(),l.fs=this.#k??ns,l.process=this.#V(),l.console=this.#t;const d=e.options&&e.options.length>0;if(d&&e.options){const h=e.options.filter(f=>f.name.startsWith("no-"));for(const f of h){const p=f.name.slice(3),g=`--${f.name}`,$=`--${p}`,w=n.includes(g),y=n.includes($);if(w&&y)throw new Ot(p,f.name)}}return d&&(Bo(l,e),Ro(l,e)),Io(o,l.options,e),Lo(l.options,e),this.#O&&is(e,n,l.rawUnknown),this.#c()===V&&(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??Ce(),s=n.cwd??Pn();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 h of r)typeof d[h]!="function"&&l.push(h);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()===V&&console.debug(...r)}};this.#m=this.#e.packageVersion,this.#A=this.#e.packageName,this.#h=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.#b=n.maxArguments,this.#O=n.strictOptions??!1,this.#d(ye),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){Ae(e,"Command"),de(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"?de(e.alias):at(e.alias,"Command alias").forEach(r=>de(r))),e.argument&&Ae(e.argument,"Command argument"),e.options&&Ae(e.options,"Command options"),e.commandPath&&(at(e.commandPath,"Command commandPath"),e.commandPath.forEach(r=>{de(r)}));const s=st(e.name,e.commandPath),o=H(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)He(r);if(So(e),Vo(e),jo(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=st(a.name,a.commandPath);this.#n.set(H(r),a)}this.#n.set(e.name,e)}if(this.#i.set(o,s),this.#o.set(o,e),this.#M(),e.alias!==void 0){const r=typeof e.alias=="string"?[e.alias]:e.alias;for(const l of r){if(this.#c()===V&&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(he.map(o=>o.name)),s=new Set(he.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",He(n),this.#l.push(n),this}getGlobalOptions(){return this.#T()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#p?this.#p:(this.#p=new Mi(this.#t),this.#p.register({description:"Attaches the logger to the toolbox",execute:e=>{e.logger=this.#t,e.console=e.logger},name:"logger"}),this.#p)}getCliName(){return this.#f}getPackageVersion(){return this.#m}getPackageName(){return this.#A}getCommands(){return this.#n}getCwd(){return this.#h}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.#j();const a=this.#x();let u,r=[...a];this.#c()===V&&(this.#t.debug(`process.execPath: ${Un()}`),this.#t.debug(`process.execArgv: ${Dn().join(" ")}`),this.#t.debug(`process.argv: ${Ce().join(" ")}`));const l=To(c,[...a]);if(l.commandPath)u=l.commandPath,r=l.argv;else{if(a.length>1&&a[0]&&a[1]&&!ke(a[0])&&!ke(a[1])){const b=[];let N=0;for(;N<a.length;){const I=a[N];if(!I||ke(I))break;b.push(I),N+=1}const E=H(b);if(b[0]&&!o.includes(b[0])){const I=this.#a(),O=F(E,I);throw new G(E,O)}}let y;try{y=Bi([null,...o],[...a])}catch(b){if(b instanceof Error&&b.name==="INVALID_COMMAND"&&"command"in b){const N=b.command,E=this.#a(),I=F(N,E);throw new G(N,I)}throw b}y.command&&(u=[y.command],r=y.argv)}if(!u)if(this.#s)u=[this.#s];else{const y=this.#a();throw new G("",y)}const d=H(u),h=this.#i.get(d);let f;if(h){if(f=this.#o.get(d),!f||H(h)!==d){const y=this.#a(),b=F(d,y);throw new G(d,b)}}else{const y=u.at(-1);if(f=y?this.#n.get(y):void 0,!f){const b=this.#a(),N=F(d,b);throw new G(d,N)}}if(typeof f.execute!="function"&&typeof f.loader!="function")return this.#t.error(`Command "${f.name}" has no function to execute.`),i?J(1):void 0;const p=r;let g,$;try{({commandArgs:g,toolbox:$}=this.#P(f,p,s,d))}catch(y){if(this.#t.error(y),i)return J(1);throw y}const w=this.getPluginManager();try{!this.#g&&w.hasPlugins()&&(await w.init({cli:this,cwd:this.#h,logger:this.#t}),this.#g=!0),await w.executeLifecycle("execute",$),await w.executeLifecycle("beforeCommand",$);let y;const b=g.global;if(b?.help){const N=this.#n.get("help");if(!N)throw new k("Help command not found","COMMAND_NOT_FOUND");y=await ee(N,$)}else if(b?.version??b?.V){const N=this.#n.get("version");if(!N)throw new k("Version command not found","COMMAND_NOT_FOUND");y=await ee(N,$)}else y=await ee(f,$);return await w.executeLifecycle("afterCommand",$,y),i?J(0):void 0}catch(y){throw await w.executeErrorHandlers(y,$),y}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...s}=n;Oe(e,"Command name");const o=e.split(" ").filter(Boolean),c=H(o),a=this.#i.get(c)?this.#o.get(c):this.#n.get(e);if(!a){const h=this.#a(),f=F(c||e,h);throw new G(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=[...lt(i,{maxArguments:this.#b})];this.#c()===V&&this.#t.debug(`running command '${e}' programmatically with args: ${u.join(", ")}`);const{commandArgs:r,toolbox:l}=this.#P(a,u,s,c||e),d=this.getPluginManager();try{!this.#g&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#h,logger:this.#t}),this.#g=!0),await d.executeLifecycle("execute",l),await d.executeLifecycle("beforeCommand",l);let h;const f=r.global;if(f?.help){const p=this.#n.get("help");if(!p)throw new k("Help command not found","COMMAND_NOT_FOUND");h=await ee(p,l)}else if(f?.version??f?.V){const p=this.#n.get("version");if(!p)throw new k("Version command not found","COMMAND_NOT_FOUND");h=await ee(p,l)}else h=await ee(a,l);return await d.executeLifecycle("afterCommand",l,h),h}catch(h){throw await d.executeErrorHandlers(h,l),h}}clone(e){const n={...this.#e,...e},i=new Te(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.#M(),i}async getAction(e){Oe(e,"Command name");const n=e.split(" ").filter(Boolean),i=H(n),s=this.#i.get(i)?this.#o.get(i):this.#n.get(e);if(!s){const o=this.#a(),c=F(i||e,o);throw new G(e,c)}if(typeof s.execute=="function")return s.execute;if(typeof s.loader=="function")return Mt(s);throw new k(`Command "${s.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:s.name})}}const ms=(t,e)=>new Te(t,e),gs=()=>{try{const t=require("node:module");if(typeof t.enableCompileCache=="function"){t.enableCompileCache();return}}catch{}try{require("v8-compile-cache")}catch{}},ws=(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=Mn(e,{cwd:l,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...r});i.error(d)}else i.error(e);c&&J(1)},version:"1.0.0"});var os="1.0.0-alpha.40";const ys={version:os},vs={argument:{description:"Package to execute (optionally with @version)",name:"package",type:String},description:"Execute a remote package without permanent installation",examples:[["vis dlx create-vite my-app","Scaffold a new project"],["vis dlx typescript@5.5.4 tsc --version","Run specific version"],["vis dlx -p cowsay -p lolcatjs -c 'echo hi | cowsay | lolcatjs'","Multiple packages with shell"],["vis install && vis dlx --offline typescript tsc --version","Hardened: pre-install + offline (no registry fetch on dlx)"]],group:"Run & Execute",loader:()=>import("../packem_chunks/handler9.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}]};export{q as L,ms as V,gs as a,rs as b,ys as c,hs as d,vs as e,k as f,Ce as g,ws as h,us as i,Un as j,J as k,Dn as l,ls as n,ps as o,ds as p,cs as r,as as s,ge as t};
@@ -1 +0,0 @@
1
- import{createRequire as j}from"node:module";import{m as d,f as y}from"./index-BDmTbWX1.js";import{a as A}from"../packem_chunks/config.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-BDmTbWX1.js";import{i as d,t as $}from"../packem_chunks/bin.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},y=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{y as l};
@@ -1 +0,0 @@
1
- import{createRequire as w}from"node:module";import{s as l}from"./index-DGSsjmpV.js";import{f as T,a as R,m as p}from"./index-BDmTbWX1.js";import{g as A,l as M}from"../packem_chunks/bin.js";import{a as P}from"../packem_chunks/config.js";const k=w(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=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 k(t)},{rmSync:f,writeFileSync:j}=_("node:fs"),U=8,$=async(t,e,s)=>{if(t.length===0)return[];const o=Math.max(1,Math.min(e,t.length)),a=Array.from({length:t.length});let r=0;const i=async()=>{for(;r<t.length;){const n=r;r+=1;const c=t[n];a[n]=await s(c,n)}};return await Promise.all(Array.from({length:o},()=>i())),a},g=2,C=1800*1e3,S=15e3,v=()=>p(A(),"packuments"),y=t=>p(v(),`${encodeURIComponent(t)}.json`),D=t=>{const e=y(t);if(T(e))try{const s=P(e);if(s.cacheVersion!==g){f(e,{force:!0});return}if(Date.now()-s.createdAt>s.ttlMs){f(e,{force:!0});return}return s.packument}catch{f(e,{force:!0});return}},N=(t,e,s)=>{R(v());const o={cacheVersion:g,createdAt:Date.now(),packument:e,ttlMs:s};j(y(t),JSON.stringify(o),"utf8")},O=t=>{const e={},s=t.versions??{};for(const[a,r]of Object.entries(s)){const i=r.dist,n={version:a};if(r._npmUser!==void 0&&(n._npmUser=r._npmUser),r.maintainers!==void 0&&(n.maintainers=r.maintainers),r.bin!==void 0&&(n.bin=r.bin),i!==void 0){const c={};i.signatures!==void 0&&(c.signatures=i.signatures),i.attestations!==void 0&&(c.attestations=i.attestations),typeof i.integrity=="string"&&(c.integrity=i.integrity),typeof i.tarball=="string"&&(c.tarball=i.tarball),n.dist=c}r.repository!==void 0&&(n.repository=r.repository),r.license!==void 0&&(n.license=r.license),typeof r.readme=="string"&&(n.readme=r.readme),typeof r.readmeFilename=="string"&&(n.readmeFilename=r.readmeFilename),typeof r.private=="boolean"&&(n.private=r.private),typeof r.deprecated=="string"&&(n.deprecated=r.deprecated),r.scripts!==void 0&&typeof r.scripts=="object"&&(n.scripts=r.scripts),e[a]=n}const o={name:typeof t.name=="string"?t.name:"",versions:e};return t["dist-tags"]!==void 0&&(o["dist-tags"]=t["dist-tags"]),t.time!==void 0&&(o.time=t.time),typeof t.readme=="string"&&(o.readme=t.readme),o},E=t=>{const e={Accept:"application/json"};return t!==void 0&&t!==""&&(e.Authorization=`Bearer ${t}`),e},F=async(t,e)=>{if(e.registryUrl!==void 0)return{authToken:e.authToken,url:e.registryUrl};if(e.workspaceRoot!==void 0){const{getRegistryForPackage:s,loadNpmrc:o}=await import("../packem_chunks/bin.js").then(n=>n.bx),a=o(e.workspaceRoot),{token:r,url:i}=s(t,a);return{authToken:e.authToken??r,url:i}}return{authToken:e.authToken,url:"https://registry.npmjs.org"}},V=async(t,e={})=>{const s=e.cacheTtlMs??C,o=D(t);if(o!==void 0)return o;const a=await F(t,e),r=`${a.url.endsWith("/")?a.url.slice(0,-1):a.url}/${t.replace("/","%2f")}`,i=new AbortController,n=setTimeout(()=>{i.abort()},S),c=()=>{i.abort()};e.signal?.addEventListener("abort",c,{once:!0});try{const d=await fetch(r,{headers:E(a.authToken),signal:i.signal});if(d.status===404)return;if(!d.ok)throw new Error(`Registry returned ${String(d.status)} for ${t}`);const b=await d.json(),m=O(b);return N(t,m,s),m}finally{clearTimeout(n),e.signal?.removeEventListener("abort",c)}},H=(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 o=t["dist-tags"]?.[e];return o!==void 0?o:Object.hasOwn(t.versions,e)?e:l.maxSatisfying(s,e)??void 0},h=(t,e)=>t.versions[e]?.dist?.attestations?.provenance!==void 0,x=(t,e)=>l.valid(e)?Object.keys(t.versions).filter(s=>l.valid(s)!==null&&l.lt(s,e)).filter(s=>l.satisfies(s,"*",{includePrerelease:!1})).filter(s=>h(t,s)).sort((s,o)=>l.lt(s,o)?1:-1)[0]:void 0,I=async(t,e={})=>{if(M("provenance"))return[];const s=new Set(e.allowlist),o=e.concurrency??U;return(await $(t,o,async({name:a,version:r})=>{if(s.has(a))return;const i=await V(a,{workspaceRoot:e.workspaceRoot});if(i===void 0||h(i,r))return;const n=x(i,r);if(n!==void 0)return{packageName:a,priorVersionWithProvenance:n,version:r}})).filter(a=>a!==void 0)};export{U as D,H as a,x as f,V as g,$ as m,I as r};
@@ -1 +0,0 @@
1
- import{createRequire as g}from"node:module";import{f as l,m,a as v}from"./index-BDmTbWX1.js";import{g as b}from"../packem_chunks/bin.js";import{a as j}from"../packem_chunks/config.js";const h=g(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return h(e)},{rmSync:u,writeFileSync:k}=_("node:fs"),C=1440*60*1e3,R=15e3,w="https://registry.npmjs.org/-/npm/v1/keys",p=()=>m(b(),"registry-keys"),i=()=>m(p(),"npmjs.json"),A=()=>{const e=i();if(l(e))try{const t=j(e),r=Date.now()-t.createdAt>t.ttlMs;return{entry:t,expired:r}}catch{u(e,{force:!0});return}},M=(e,t)=>{v(p());const r={createdAt:Date.now(),keys:e,ttlMs:t};k(i(),JSON.stringify(r),"utf8")},q=async(e={})=>{const t=e.ttlMs??C,r=e.keysUrl??process.env.VIS_NPM_KEYS_URL??w,s=A();if(s!==void 0&&!s.expired&&e.forceRefresh!==!0)return{fromCache:!0,keys:s.entry.keys};const n=new AbortController,d=setTimeout(()=>{n.abort()},R),a=()=>{n.abort()};e.signal?.addEventListener("abort",a,{once:!0});try{const c=await fetch(r,{headers:{Accept:"application/json"},signal:n.signal});if(!c.ok)return s!==void 0?{fromCache:!0,keys:s.entry.keys,stale:!0}:void 0;const y=await c.json(),f=Array.isArray(y.keys)?y.keys:[];return M(f,t),{fromCache:!1,keys:f}}catch{return s!==void 0?{fromCache:!0,keys:s.entry.keys,stale:!0}:void 0}finally{clearTimeout(d),e.signal?.removeEventListener("abort",a)}},x=()=>{const e=i();return l(e)?(u(e,{force:!0}),!0):!1};export{x as c,q as f};
@@ -1 +0,0 @@
1
- import{m as g,f as m,v as h}from"./index-BDmTbWX1.js";import{whichBin as d}from"#native";import{a as k}from"../packem_chunks/config.js";const v=r=>{for(const s of[".nvmrc",".node-version"]){const i=g(r,s);if(m(i))try{return h(i).trim().replace(/^v/,"")}catch{}}},l=(r,s)=>{const i=r.split(/[.\-+]/).map(n=>Number.parseInt(n,10)||0),c=s.split(/[.\-+]/).map(n=>Number.parseInt(n,10)||0),e=Math.max(i.length,c.length);for(let n=0;n<e;n++){const t=i[n]??0,a=c[n]??0;if(t!==a)return t-a}return 0},$=(r,s)=>{const i=s.trim();if(i===""||i==="*")return!0;const c=i.split(/\s+/).filter(Boolean);for(const e of c)if(e.startsWith(">=")){if(l(r,e.slice(2).trim())<0)return!1}else if(e.startsWith("<=")){if(l(r,e.slice(2).trim())>0)return!1}else if(e.startsWith(">")){if(l(r,e.slice(1).trim())<=0)return!1}else if(e.startsWith("<")){if(l(r,e.slice(1).trim())>=0)return!1}else if(/^\d/.test(e)){const n=r.split("."),t=e.split(".");for(const[a,o]of t.entries())if(o!==n[a])return!1}return!0},x=r=>{const s=[],i=g(r,"package.json");let c;try{c=k(i)}catch{return s}const e=process.versions.node;if(c.engines?.node){const t=c.engines.node;$(e,t)||s.push({actual:e,expected:t,kind:"node",message:`package.json engines.node requires ${t}, but the current Node.js is ${e}.`,severity:"error"})}const n=v(r);if(n){const[t,a]=n.split("."),[o,p]=e.split(".");(t!==o||a!==void 0&&a!==p)&&s.push({actual:e,expected:n,kind:"node",message:`.nvmrc pins Node ${n} but the current Node.js is ${e}. Run \`nvm use\` or switch runtimes.`,severity:"warning"})}if(c.packageManager){const[t,a]=c.packageManager.split("@"),o=(process.env.npm_config_user_agent??"").split(" ")[0]??"",[p,u]=o.split("/"),f=t==="aube"&&d("aube")!==null;p&&t&&p!==t?s.push({actual:p,expected:t,kind:"packageManager",message:`package.json packageManager pins ${c.packageManager} but the current invocation is ${o}. Install the correct package manager.`,severity:f?"warning":"error"}):u&&a&&u!==a&&s.push({actual:u,expected:a,kind:"packageManager",message:`package.json packageManager pins ${t}@${a} but the current invocation uses ${t}@${u}.`,severity:"warning"})}return s};export{x as c};
@@ -1 +0,0 @@
1
- import{createRequire as K}from"node:module";import{V,s as A}from"./Table-CcVkyULl-B_ef6zfS.js";import{f as _,a as j,m as $}from"./index-BDmTbWX1.js";import{l as p,g as x}from"../packem_chunks/bin.js";import{m as g,g as b,D as w}from"./provenance-BFEwKgI3.js";import{a as O}from"../packem_chunks/config.js";import{s as v}from"./index-DGSsjmpV.js";const X=K(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=r=>{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(r)}return X(r)},{rmSync:k,writeFileSync:E}=T("node:fs"),{createHash:Y}=T("node:crypto"),{Resolver:Q}=T("node:dns/promises");class Ke{entries=[];add(e){this.entries.push(e)}addMany(e){for(const t of e)this.entries.push(t)}all(){return this.entries}errors(){return this.entries.filter(e=>e.severity==="error")}warnings(){return this.entries.filter(e=>e.severity==="warning")}hasErrors(){return this.entries.some(e=>e.severity==="error")}hasWarnings(){return this.entries.some(e=>e.severity==="warning")}isEmpty(){return this.entries.length===0}size(){return this.entries.length}}const Xe=r=>{if(r.length===0)return[];const e=[],t=r.filter(s=>s.severity==="error"),n=r.filter(s=>s.severity==="warning");if(t.length>0){e.push(V(`${String(t.length)} error${t.length===1?"":"s"}:`));for(const s of t)e.push(` ${V("✗")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${A("→")} ${s.suggestedAction}`)}if(n.length>0){t.length>0&&e.push(""),e.push(A(`${String(n.length)} warning${n.length===1?"":"s"}:`));for(const s of n)e.push(` ${A("⚠")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${A("→")} ${s.suggestedAction}`)}return e},Ye=r=>({errors:r.filter(e=>e.severity==="error"),findings:[...r],summary:{errorCount:r.filter(e=>e.severity==="error").length,warningCount:r.filter(e=>e.severity==="warning").length},warnings:r.filter(e=>e.severity==="warning")}),Z=1440*60*1e3,ee=15e3,re="https://api.github.com/repos",B=()=>$(x(),"archived-repo"),H=(r,e)=>$(B(),`${encodeURIComponent(r)}__${encodeURIComponent(e)}.json`),te=(r,e)=>{const t=H(r,e);if(_(t))try{const n=O(t);if(Date.now()-n.createdAt>n.ttlMs){k(t,{force:!0});return}return n}catch{k(t,{force:!0});return}},W=(r,e,t,n)=>{j(B());const s={createdAt:Date.now(),ttlMs:n,...t};E(H(r,e),JSON.stringify(s),"utf8")},ne=r=>{if(typeof r!="string"||r.trim()==="")return;const e=r.trim().replace(/^git\+/,""),t=/^git@github\.com:([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(e);if(t)return{owner:t[1],repo:t[2]};const n=/^ssh:\/\/git@github\.com\/([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(e);if(n)return{owner:n[1],repo:n[2]};const s=/^https?:\/\/(?:www\.)?github\.com\/([^/]+)\/([^/?#]+?)(?:\.git)?\/?$/i.exec(e);if(s)return{owner:s[1],repo:s[2]}},se=async(r,e,t,n)=>{const s=`${re}/${encodeURIComponent(r)}/${encodeURIComponent(e)}`,c=new AbortController,o=setTimeout(()=>{c.abort()},ee),i=()=>{c.abort()};n?.addEventListener("abort",i,{once:!0});const a={Accept:"application/vnd.github+json","User-Agent":"visulima-vis-marshall"};t!==void 0&&t!==""&&(a.Authorization=`Bearer ${t}`);try{const d=await fetch(s,{headers:a,signal:c.signal});if(d.status===404)return{kind:"missing"};if(!d.ok)return{kind:"transient-error"};const l=await d.json(),u=l.archived===!0,f=typeof l.archived_at=="string"?l.archived_at:void 0;return{archived:u,archivedAt:f,kind:"ok"}}catch{return{kind:"transient-error"}}finally{clearTimeout(o),n?.removeEventListener("abort",i)}},ie=(r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),Qe=async(r,e={})=>{if(p("archivedRepo"))return[];const t=new Set(e.allowlist),n=e.cacheTtlMs??Z,s=e.githubToken??process.env.GITHUB_TOKEN,c=e.concurrency??w,o=new Map,i=async(a,d)=>{const l=`${a}/${d}`;let u=o.get(l);return u===void 0&&(u=(async()=>{const f=te(a,d);if(f!==void 0)return f.missing===!0?{archived:!1,kind:"missing"}:{archived:f.archived,archivedAt:f.archivedAt,kind:"ok"};const m=await se(a,d,s,e.signal);return m.kind==="missing"?W(a,d,{archived:!1,missing:!0},n):m.kind==="ok"&&W(a,d,{archived:m.archived===!0,archivedAt:m.archivedAt},n),m})(),o.set(l,u)),u};return(await g(r,c,async({name:a,version:d})=>{if(t.has(a))return;const l=await b(a,{workspaceRoot:e.workspaceRoot});if(l===void 0)return;const u=l.versions[d]??l.versions[ie(Object.keys(l.versions),l["dist-tags"]?.latest)??""];if(u===void 0)return;const f=ne(u.repository?.url);if(f===void 0)return;const m=await i(f.owner,f.repo);if(m.kind!=="transient-error"){if(m.kind==="missing")return{kind:"missing-repo",owner:f.owner,packageName:a,repo:f.repo};if(m.archived===!0)return{...m.archivedAt===void 0?{}:{archivedAt:m.archivedAt},kind:"archived",owner:f.owner,packageName:a,repo:f.repo}}})).filter(a=>a!==void 0)},oe={dormantErrorDays:274,dormantWarnDays:183,newPublisherWindowDays:21,recentVersionErrorDays:7,recentVersionWarnDays:30},ae=1440*60*1e3,U=(r,e)=>(r-e)/ae,R=r=>{if(r!==void 0)return r.email??r.name},ce=(r,e,t,n,s)=>{const c=r.time?.[t];if(c===void 0)return;const o=new Date(c).getTime();if(!Number.isFinite(o))return;const i=U(n,o);if(i<s.recentVersionErrorDays)return{kind:"recent-version",message:`published ${i.toFixed(1)} days ago (error threshold: ${String(s.recentVersionErrorDays)})`,packageName:e,severity:"error",version:t};if(i<s.recentVersionWarnDays)return{kind:"recent-version",message:`published ${i.toFixed(1)} days ago (warn threshold: ${String(s.recentVersionWarnDays)})`,packageName:e,severity:"warning",version:t}},de=(r,e,t,n,s)=>{const c=r.versions[t],o=R(c?._npmUser);if(o===void 0)return;const i=Object.keys(r.versions).filter(u=>v.valid(u)!==null).filter(u=>v.lt(u,t));if(i.length===0||i.some(u=>R(r.versions[u]?._npmUser)===o))return;const a=r.time?.[i[0]??""];if(a===void 0)return;const d=new Date(a).getTime();if(!Number.isFinite(d))return;const l=U(n,d);if(!(l<=s.newPublisherWindowDays))return{kind:"new-publisher",message:`first publish by ${o} on a ${l.toFixed(0)}-day-old package`,packageName:e,severity:"error",version:t}},le=(r,e,t,n,s)=>{const c=r.versions[t],o=R(c?._npmUser);if(o===void 0)return;const i=[];for(const[l,u]of Object.entries(r.versions)){if(l===t||R(u._npmUser)!==o)continue;const f=r.time?.[l];if(f===void 0)continue;const m=new Date(f).getTime();Number.isFinite(m)&&i.push(m)}if(i.length===0)return;const a=Math.max(...i),d=U(n,a);if(d>=s.dormantErrorDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${d.toFixed(0)} days ago (error threshold: ${String(s.dormantErrorDays)})`,packageName:e,severity:"error",version:t};if(d>=s.dormantWarnDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${d.toFixed(0)} days ago (warn threshold: ${String(s.dormantWarnDays)})`,packageName:e,severity:"warning",version:t}},Ze=async(r,e={})=>{if(p("author"))return[];const t=new Set(e.allowlist),n={...oe,...e.thresholds},s=e.now??(()=>Date.now()),c=e.concurrency??w;return(await g(r,c,async({name:o,version:i})=>{if(t.has(o))return[];const a=await b(o,{cacheTtlMs:e.cacheTtlMs,signal:e.signal,workspaceRoot:e.workspaceRoot});if(a===void 0)return[];const d=s(),l=[],u=ce(a,o,i,d,n);u!==void 0&&l.push(u);const f=de(a,o,i,d,n);f!==void 0&&l.push(f);const m=le(a,o,i,d,n);return m!==void 0&&l.push(m),l})).flat()},ue=1440*60*1e3,fe=15e3,me=20,he=1e4,ve="https://api.npmjs.org/downloads/point/last-month",J=()=>$(x(),"downloads"),q=r=>$(J(),`${encodeURIComponent(r)}.json`),pe=r=>{const e=q(r);if(_(e))try{const t=O(e);if(Date.now()-t.createdAt>t.ttlMs){k(e,{force:!0});return}return t.downloads}catch{k(e,{force:!0});return}},ge=(r,e,t)=>{j(J());const n={createdAt:Date.now(),downloads:e,observedAt:new Date().toISOString(),ttlMs:t};E(q(r),JSON.stringify(n),"utf8")},we=async(r,e)=>{const t=`${ve}/${encodeURIComponent(r)}`,n=new AbortController,s=setTimeout(()=>{n.abort()},fe),c=()=>{n.abort()};e?.addEventListener("abort",c,{once:!0});try{const o=await fetch(t,{signal:n.signal});if(o.status===404)return{kind:"no-data"};if(!o.ok)return{kind:"error"};const i=await o.json();return typeof i.downloads=="number"?{downloads:i.downloads,kind:"ok"}:{kind:"no-data"}}catch{return{kind:"error"}}finally{clearTimeout(s),e?.removeEventListener("abort",c)}},er=async(r,e={})=>{if(p("downloads"))return[];const t=new Set(e.allowlist),n=e.errorThreshold??me,s=e.warnThreshold??he,c=e.cacheTtlMs??ue,o=e.concurrency??w;return(await g(r,o,async i=>{if(t.has(i))return;let a=pe(i);if(a===void 0){const d=await we(i,e.signal);if(d.kind==="no-data"||d.kind==="error")return{downloadsLastMonth:void 0,kind:"no-data",packageName:i,severity:"warning"};a=d.downloads??0,ge(i,a,c)}if(a<n)return{downloadsLastMonth:a,kind:"below-error",packageName:i,severity:"error"};if(a<s)return{downloadsLastMonth:a,kind:"below-warning",packageName:i,severity:"warning"}})).filter(i=>i!==void 0)},ye=1440*60*1e3,ke=4e3,$e=["1.1.1.1","8.8.8.8"],z=()=>$(x(),"expired-domains"),G=r=>{const e=Y("sha256").update(r).digest("hex").slice(0,12);return $(z(),`${e}.json`)},be=r=>{const e=G(r);if(_(e))try{const t=O(e);if(Date.now()-t.createdAt>t.ttlMs){k(e,{force:!0});return}return t}catch{k(e,{force:!0});return}},Me=(r,e,t)=>{j(z());const n={createdAt:Date.now(),outcome:e,ttlMs:t};E(G(r),JSON.stringify(n),"utf8")},De=r=>{if(typeof r!="string")return;const e=r.lastIndexOf("@");if(e===-1||e===r.length-1)return;const t=r.slice(e+1).trim().toLowerCase();return t===""?void 0:t},Ae=(r,e)=>{const t=[];e!==void 0&&t.push(e);for(const n of r??[])t.push(n);return t},Re=async(r,e)=>{let t;try{return await Promise.race([r,new Promise((n,s)=>{t=setTimeout(()=>{s(new Error("ETIMEDOUT"))},e)})])}finally{t!==void 0&&clearTimeout(t)}},Ne=r=>{if(r===null||typeof r!="object")return!1;const{code:e}=r;return e==="ENOTFOUND"||e==="ENODATA"||e==="NXDOMAIN"},Se=async(r,e,t)=>{try{const n=await Re(r.resolveNs(e),t);return Array.isArray(n)&&n.length>0?{kind:"ok"}:{kind:"expired"}}catch(n){return Ne(n)?{kind:"expired"}:{kind:"transient-error"}}},Te=(r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),rr=async(r,e={})=>{if(p("expiredDomains"))return[];const t=new Set(e.allowlist),n=new Set((e.allowDomains??[]).map(u=>u.toLowerCase())),s=e.cacheTtlMs??ye,c=e.perDomainTimeoutMs??ke,o=e.dnsServers??$e,i=e.concurrency??w,a=e.createResolver===void 0?new Q:e.createResolver();typeof a.setServers=="function"&&a.setServers(o);const d=new Map,l=async u=>{let f=d.get(u);return f===void 0&&(f=(async()=>{const m=be(u);if(m!==void 0)return{kind:m.outcome==="ok"?"ok":"expired"};const h=await Se(a,u,c);return h.kind!=="transient-error"&&Me(u,h.kind,s),h})(),d.set(u,f)),f};return(await g(r,i,async({name:u,version:f})=>{if(t.has(u))return[];const m=await b(u,{workspaceRoot:e.workspaceRoot});if(m===void 0)return[];const h=m.versions[f]??m.versions[Te(Object.keys(m.versions),m["dist-tags"]?.latest)??""];if(h===void 0)return[];const N=Ae(h.maintainers,h._npmUser),C=new Set,S=[];for(const D of N){const y=De(D.email);if(y===void 0||n.has(y))continue;const F=`${y}:${D.email??""}`;if(C.has(F))continue;C.add(F);const L=await l(y);L.kind==="expired"?S.push({domain:y,kind:"expired",maintainer:D.email??"",packageName:u,severity:"error"}):L.kind==="transient-error"&&S.push({domain:y,kind:"unresolved",maintainer:D.email??"",packageName:u,severity:"warning"})}return S})).flat()},Ee=["readme","license","repo"],_e=["ERROR: No README data found!","# Security holding package"],je=r=>{const e=r.trim();return e===""?!0:_e.some(t=>e.startsWith(t))},xe=(r,e)=>{if(typeof e.readme=="string")return e.readme;if(typeof r.readme=="string")return r.readme},Oe=(r,e)=>{const t=xe(r,e);if(t===void 0)return"missing-readme";if(je(t))return"placeholder-readme"},Ue=r=>{const{license:e}=r;return e===void 0?"missing-license":typeof e=="string"?e.trim()===""?"missing-license":void 0:typeof e.type=="string"&&e.type.trim()!==""?void 0:"missing-license"},Ce=r=>{const{repository:e}=r;if(e===void 0)return"missing-repo";const t=typeof e.url=="string"?e.url.trim():"";if(t==="")return"missing-repo";let n=t.replace(/^git\+/,"");const s=/^git@([^:]+):(.+?)(?:\.git)?$/.exec(n);return s&&(n=`https://${s[1]}/${s[2]}`),URL.canParse(n)?void 0:"invalid-repo-url"},Fe=r=>{const e=r["dist-tags"]?.latest;return e!==void 0&&Object.hasOwn(r.versions,e)?e:Object.keys(r.versions).at(-1)},tr=async(r,e={})=>{if(p("metadata"))return[];const t=new Set(e.allowlist),n=new Set(e.checks??Ee),s=e.concurrency??w;return(await g(r,s,async({name:c,version:o})=>{if(t.has(c))return;const i=await b(c,{workspaceRoot:e.workspaceRoot});if(i===void 0)return;const a=i.versions[o]??i.versions[Fe(i)??""];if(a===void 0||a.private===!0)return;const d=[];if(n.has("readme")){const l=Oe(i,a);l!==void 0&&d.push(l)}if(n.has("license")){const l=Ue(a);l!==void 0&&d.push(l)}if(n.has("repo")){const l=Ce(a);l!==void 0&&d.push(l)}if(d.length!==0)return{issues:d,packageName:c,version:o}})).filter(c=>c!==void 0)},I=(r,e)=>r===void 0?{}:typeof r=="string"?{[e.startsWith("@")?e.split("/").at(1)??e:e]:r}:{...r},Le=(r,e)=>v.valid(e)?Object.keys(r.versions).filter(t=>v.valid(t)!==null&&v.lt(t,e)).sort((t,n)=>v.lt(t,n)?1:-1)[0]:void 0,nr=async(r,e={})=>{if(p("newBin"))return[];const t=new Set(e.allowlist),n=new Set(e.allowBins),s=e.concurrency??w;return(await g(r,s,async({name:c,version:o})=>{if(t.has(c))return;const i=await b(c,{workspaceRoot:e.workspaceRoot});if(i===void 0)return;const a=i.versions[o];if(a===void 0)return;const d=Le(i,o);if(d===void 0)return;const l=i.versions[d];if(l===void 0)return;const u=I(a.bin,c),f=I(l.bin,c),m=Object.entries(u).filter(([h])=>!(h in f)).filter(([h])=>!n.has(h)).map(([h,N])=>({command:N,name:h}));if(m.length!==0)return{fromVersion:d,newBins:m,packageName:c,toVersion:o}})).filter(c=>c!==void 0)},Ve=["preinstall","install","postinstall"],P=(r,e)=>r.versions[e]?.dist?.attestations?.provenance!==void 0,We=(r,e)=>{if(v.valid(e)!==null)return Object.keys(r.versions).filter(t=>v.valid(t)!==null&&v.prerelease(t)===null&&v.lt(t,e)).sort((t,n)=>v.lt(t,n)?1:-1)[0]},Ie=(r,e)=>{const t=r??{},n=e??{},s=[];for(const c of Ve){const o=t[c];if(o===void 0||o==="")continue;const i=n[c];i===void 0||i===""?s.push({command:o,hook:c,kind:"introduced"}):i!==o&&s.push({command:o,hook:c,kind:"changed"})}return s},sr=async(r,e={})=>{if(p("s1ngularity"))return[];const t=new Set(e.allowlist),n=e.concurrency??w;return(await g(r,n,async({name:s,version:c})=>{if(t.has(s))return;const o=await b(s,{workspaceRoot:e.workspaceRoot});if(o?.versions[c]===void 0)return;const i=We(o,c);if(i===void 0||!P(o,i)||P(o,c))return;const a=Ie(o.versions[c]?.scripts,o.versions[i]?.scripts);if(a.length!==0)return{hookChanges:a,packageName:s,priorVersion:i,trustSignal:"provenance-dropped",version:c}})).filter(s=>s!==void 0)};export{Ke as M,sr as a,nr as b,tr as c,er as d,rr as e,Qe as f,Ye as g,Xe as h,Ze as r};
@@ -1,2 +0,0 @@
1
- import{createRequire as _}from"node:module";import{E as f,s as y,I as $,V as T}from"./Table-CcVkyULl-B_ef6zfS.js";import{a4 as r,a5 as l,m as a,$ as k,d as j,r as v,a6 as u}from"../packem_chunks/bin.js";import{o as C}from"./spinner-CV3WVJLv.js";import{D as x,W as R,T as S,C as I}from"./symbols-DPTlrJ3B.js";const B=_(import.meta.url),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const b=({rows:i})=>r.jsx(l,{flexDirection:"column",children:i.map(t=>{let e;switch(t.status){case"error":{e=r.jsx(a,{color:"red",children:I});break}case"ok":{e=r.jsx(a,{color:"green",children:S});break}case"running":{e=r.jsx(a,{color:"white",children:r.jsx(C,{type:"dots"})});break}case"warn":{e=r.jsx(a,{color:"yellow",children:R});break}default:{e=r.jsx(a,{dimColor:!0,children:x});break}}return r.jsxs(l,{children:[r.jsx(l,{width:3,children:e}),r.jsx(l,{flexGrow:1,children:r.jsx(a,{children:t.label})}),t.summary?r.jsx(l,{children:r.jsxs(a,{dimColor:!0,children:[x," ",t.summary]})}):null]},t.id)})}),E={error:T(u.failure),ok:$(u.success),pending:f(u.dash),skip:f(u.dash),warn:y(u.warning)},M=(i,t,e)=>{const p=e?`${i} ${f(`— ${e}`)}`:i;return` ${E[t]} ${p}
2
- `},G=(i,t={})=>{const e=t.stream??process.stderr,p=typeof e.isTTY=="boolean"&&e.isTTY&&!v,w=t.live??p,o=new Map;for(const s of i)o.set(s.id,{id:s.id,label:s.label,status:"pending"});if(!w||i.length===0)return{finish:(s,n,m)=>{const c=o.get(s);c&&(o.set(s,{...c,status:n,summary:m}),e.write(M(c.label,n,m)))},start:s=>{const n=o.get(s);n&&o.set(s,{...n,status:"running"})},stop:()=>{}};const g=()=>i.map(s=>o.get(s.id));let d=k(j.createElement(b,{rows:g()}),{interactive:!0,patchConsole:!1});const h=()=>{d?.rerender(j.createElement(b,{rows:g()}))};return{finish:(s,n,m)=>{const c=o.get(s);c&&(o.set(s,{...c,status:n,summary:m}),h())},start:s=>{const n=o.get(s);n&&(o.set(s,{...n,status:"running"}),h())},stop:()=>{d&&(h(),d.unmount(),d=void 0)}}};export{G as s};
@@ -1 +0,0 @@
1
- import{a4 as u,s as n,ae as K,a5 as y,m as A}from"../packem_chunks/bin.js";function G({children:o}){return u.jsx(u.Fragment,{children:o})}const L=/^\d$/u,O=o=>o!=null&&typeof o=="object"&&"props"in o&&"name"in o.props,Y=o=>{const c=[];for(const t of n.Children.toArray(o))O(t)&&c.push(t);return c},V=(o,c)=>o.some(t=>c[t]),Z=(o,c,t)=>o?c?{backgroundColor:t?.activeTab?.backgroundColor??"green",color:t?.activeTab?.color??"black"}:{backgroundColor:"gray",color:"black"}:{backgroundColor:void 0,color:void 0};function P({children:o,colors:c,defaultValue:t,flexDirection:b="row",isFocused:x,keyMap:a,onChange:M,showIndex:q=!0,value:k,width:C}){const l=Y(o),s=l.length,m=n.useRef(l);m.current=l;const i=b==="column"||b==="column-reverse",g=k!==void 0,[z,B]=n.useState(()=>{const r=k??t;if(r==null||s===0)return 0;const e=l.findIndex(d=>d.props.name===r);return e===-1?0:e}),h=g?Math.max(0,l.findIndex(r=>r.props.name===k)):z,H=n.useCallback(()=>{},[]),p=g?H:B,f=n.useRef(M);f.current=M,n.useEffect(()=>{if(g)return;const r=m.current[h];r&&f.current(r.props.name,r)},[]);const R=n.useMemo(()=>a?.previous??[i?"upArrow":"leftArrow"],[a?.previous,i]),E=n.useMemo(()=>a?.next??[i?"downArrow":"rightArrow"],[a?.next,i]),I=a?.useNumbers??!0,D=a?.useTab??!0,v=n.useRef(h);v.current=h;const F=n.useCallback(r=>{p(r);const e=m.current[r];e&&f.current(e.props.name,e)},[p]),w=n.useCallback(()=>{const r=(v.current+1)%s;p(r);const e=m.current[r];e&&f.current(e.props.name,e)},[s,p]),j=n.useCallback(()=>{const r=(v.current-1+s)%s;p(r);const e=m.current[r];e&&f.current(e.props.name,e)},[s,p]);K(n.useCallback((r,e)=>{if(V(R,e)){j();return}if(V(E,e)){w();return}if(e.tab&&D&&x==null){e.shift?j():w();return}if(I&&e.meta&&L.test(r)){const d=r==="0"?9:Number.parseInt(r,10)-1;d<s&&F(d)}},[R,E,D,I,x,j,w,s,F]),{isActive:x!==!1});const N=typeof C=="number"?C:6,J=n.useMemo(()=>i?"─".repeat(N):" | ",[i,N]);return u.jsx(y,{flexDirection:b,width:C,children:l.map((r,e)=>{const{name:d}=r.props,S=Z(h===e,x!==!1,c);let T=null;return q&&(T=u.jsxs(A,{color:"grey",children:[e+1,"."," "]})),u.jsxs(y,{flexDirection:b,children:[e!==0&&u.jsx(A,{color:"dim",children:J}),u.jsxs(y,{children:[T,u.jsx(A,{backgroundColor:S.backgroundColor,color:S.color,children:r})]})]},d)})})}export{P as F,G as a};
@@ -1,5 +0,0 @@
1
- import{createRequire as N}from"node:module";import{m,f as u,o as I,v as y}from"./index-BDmTbWX1.js";import{a as W}from"../packem_chunks/config.js";const C=N(import.meta.url),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=o=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[e,n]=k.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return k.getBuiltinModule(o)}return C(o)},{execFileSync:M}=w("node:child_process"),{randomBytes:F}=w("node:crypto"),{writeFileSync:D,renameSync:B,unlinkSync:U}=w("node:fs"),{delimiter:q}=w("node:path"),J=["proto","mise","fnm","volta","asdf","nvm","corepack"],R={asdf:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],corepack:["npm","pnpm","yarn"],fnm:["node"],mise:["aube","bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],nvm:["node"],proto:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],volta:["node","npm","pnpm","yarn"]},H=["proto","mise","fnm","volta","asdf","nvm","corepack"],_={asdf:[".tool-versions"],corepack:[],fnm:[".nvmrc",".node-version"],mise:[".mise.toml",".config/mise.toml","mise.toml"],nvm:[".nvmrc"],proto:[".prototools"],volta:[]},$=new Map,h=o=>{const e=$.get(o);if(e!==void 0||$.has(o))return e;const n=process.env.PATH;if(!n){$.set(o,void 0);return}const t=process.platform==="win32"?["",...(process.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";")]:[""];for(const r of n.split(q)){const i=r.replaceAll(/^["']|["']$/g,"").trim();if(i!=="")for(const l of t){const s=`${i}${I}${o}${l}`;if(u(s))return $.set(o,s),s}}$.set(o,void 0)},S=(o,e=["--version"])=>{try{const n=M(o,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}),t=/\d+\.\d+(?:\.\d+)?/.exec(n);return t?t[0]:n.trim()||void 0}catch{return}},P=(o,e)=>{const n=m(o,"package.json");if(!u(n))return[];try{const t=W(n)[e];if(e==="volta"&&typeof t=="object"&&t!==null&&Object.keys(t).length>0)return["package.json"];if(e==="packageManager"&&typeof t=="string"&&t.length>0)return["package.json"]}catch{}return[]},z=(o,e)=>o==="volta"?P(e,"volta"):o==="corepack"?P(e,"packageManager"):_[o].filter(n=>u(m(e,n))),j=new Map,Z=()=>{j.clear(),$.clear()},A=(o,e)=>{{const i=j.get(o);if(i)return i}const n=[],t=!!h("pnpm")||!!h("yarn");for(const i of H){const l=i==="nvm"?void 0:h(i),s=i==="nvm"&&!!process.env.NVM_DIR,c=z(i,o),a=!!l||s;i==="corepack"&&!a&&(!(c.length>0)||t)||!a&&c.length===0||n.push({binPath:l,configFiles:c,installed:a,name:i,version:l?S(l):void 0})}const r=Object.freeze(n);return j.set(o,r),r},ve=(o,e,n)=>{const t=A(o);return e?.preferredManager&&e.preferredManager!=="none"?t.find(r=>r.name===e.preferredManager)??{configFiles:[],installed:!1,name:e.preferredManager}:t.find(r=>r.installed&&r.configFiles.length>0)??t.find(r=>r.installed)??t.find(r=>r.configFiles.length>0)??{configFiles:[],installed:!1,name:"none"}},X=(o,e)=>{for(const n of e){const t=m(o,n);if(u(t))try{const r=y(t).trim();if(r!=="")return{name:n,value:r.replace(/^v/,"")}}catch{}}},G=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,L=o=>{const e=m(o,".prototools");if(!u(e))return[];const n=y(e),t=[];let r=!1;for(const i of n.split(/\r?\n/)){const l=i.trim();if(l===""||l.startsWith("#"))continue;if(l.startsWith("[")){r=!0;continue}if(r)continue;const s=G.exec(l);if(!s)continue;const[,c,a]=s,p=g(c);p&&t.push({source:".prototools",tool:p,version:a.trim()})}return t},V=/^\[tools\]\s*$/i,K=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,Y=o=>{for(const e of _.mise){const n=m(o,e);if(!u(n))continue;const t=[],r=y(n);let i=!1;for(const l of r.split(/\r?\n/)){const s=l.trim();if(s===""||s.startsWith("#"))continue;if(s.startsWith("[")){i=V.test(s);continue}if(!i)continue;const c=K.exec(s);if(!c)continue;const[,a,p]=c,v=g(a);v&&t.push({source:".mise.toml",tool:v,version:p.trim()})}if(t.length>0)return t}return[]},Q=o=>{const e=m(o,".tool-versions");if(!u(e))return[];const n=y(e),t=[];for(const r of n.split(/\r?\n/)){const i=r.trim();if(i===""||i.startsWith("#"))continue;const l=i.split(/\s+/);if(l.length<2)continue;const[s,...c]=l,a=g(s);a&&c[0]&&t.push({source:".tool-versions",tool:a,version:c[0]})}return t},g=o=>{switch(o.toLowerCase()){case"aube":return"aube";case"bun":return"bun";case"deno":return"deno";case"go":case"golang":return"go";case"node":case"nodejs":return"node";case"npm":return"npm";case"pnpm":return"pnpm";case"python":case"python3":return"python";case"ruby":return"ruby";case"rust":case"rustc":return"rust";case"yarn":return"yarn";default:return}},ee=o=>{const[e]=o.split("+",1),n=/^(pnpm|yarn|npm|bun)@(.+)$/.exec(e??"");if(!n)return;const t=g(n[1]);if(t)return{source:"packageManager",tool:t,version:n[2]}},oe=(o,e)=>{const n=new Map,t=s=>{n.set(s.tool,s)},r=m(o,"package.json");let i={};try{u(r)&&(i=W(r))}catch{}if(i.engines)for(const[s,c]of Object.entries(i.engines)){const a=g(s);a&&typeof c=="string"&&t({source:"engines",tool:a,version:c})}if(i.packageManager){const s=ee(i.packageManager);s&&t(s)}if(i.volta)for(const[s,c]of Object.entries(i.volta)){const a=g(s);a&&typeof c=="string"&&t({source:"volta",tool:a,version:c})}const l=X(o,[".nvmrc",".node-version"]);l&&t({source:l.name===".nvmrc"?".nvmrc":".node-version",tool:"node",version:l.value});for(const s of Q(o))t(s);for(const s of Y(o))t(s);for(const s of L(o))t(s);if(e?.tools)for(const[s,c]of Object.entries(e.tools)){const a=g(s);a&&typeof c=="string"&&t({source:"vis.config.ts",tool:a,version:c})}return[...n.values()]},T={aube:{args:["--version"],binaries:["aube"]},bun:{args:["--version"],binaries:["bun"]},deno:{args:["--version"],binaries:["deno"]},go:{args:["version"],binaries:["go"]},node:{args:["--version"],binaries:["node"]},npm:{args:["--version"],binaries:["npm"]},pnpm:{args:["--version"],binaries:["pnpm"]},python:{args:["--version"],binaries:["python","python3"]},ruby:{args:["--version"],binaries:["ruby"]},rust:{args:["--version"],binaries:["rustc"]},yarn:{args:["--version"],binaries:["yarn"]}},ne=o=>{const e=T[o];for(const n of e.binaries){const t=h(n);if(t)return S(t,e.args)}if(o==="node")return process.versions.node},te=(o,e)=>{const n=e.trim();if(n===""||n==="*"||n==="latest")return!0;if(/^\d[\d.]*$/.test(n))return o===n||o.startsWith(`${n}.`);const t=s=>s.split(/[.\-+]/).map(c=>Number.parseInt(c,10)||0),r=(s,c)=>{const a=t(s),p=t(c),v=Math.max(a.length,p.length);for(let f=0;f<v;f++){const b=a[f]??0,d=p[f]??0;if(b!==d)return b-d}return 0},i=s=>{for(const c of s)if(c.startsWith(">=")){if(r(o,c.slice(2).trim())<0)return!1}else if(c.startsWith("<=")){if(r(o,c.slice(2).trim())>0)return!1}else if(c.startsWith(">")){if(r(o,c.slice(1).trim())<=0)return!1}else if(c.startsWith("<")){if(r(o,c.slice(1).trim())>=0)return!1}else if(c.startsWith("^")||c.startsWith("~")){const a=c.slice(1).trim(),[p,v]=t(a),[f,b]=t(o);if(f!==p||c.startsWith("~")&&b!==v||r(o,a)<0)return!1}return!0},l=n.split("||").map(s=>s.trim().split(/\s+/).filter(Boolean)).filter(s=>s.length>0);return l.length===0?!0:l.some(s=>i(s))},re=(o,e)=>{switch(o){case".mise.toml":return["mise"];case".node-version":case".nvmrc":return["fnm","nvm","volta","proto","mise","asdf"];case".prototools":return["proto"];case".tool-versions":return["asdf","mise"];case"packageManager":return e==="pnpm"||e==="yarn"?["self-activate","volta","proto","mise","corepack"]:e==="npm"?["volta","proto","mise","asdf","corepack"]:e==="aube"?["mise"]:e==="bun"?["proto","mise","asdf"]:["volta","proto","mise"];case"volta":return["volta"];default:return["proto","mise","fnm","volta","asdf","nvm","corepack"]}},se=(o,e,n)=>{if(n?.preferredManager&&n.preferredManager!=="none"&&x(n.preferredManager,o.tool)){const r=e.find(i=>i.name===n.preferredManager);return r?{installed:r.installed,name:r.name}:{installed:!1,name:n.preferredManager,note:`${n.preferredManager} is the preferred manager but isn't on PATH`}}const t=re(o.source,o.tool);for(const r of t){if(r==="self-activate"){if((o.tool==="pnpm"||o.tool==="yarn")&&h(o.tool))return{installed:!0,name:"self-activate",note:`${o.tool} will activate ${o.version} from the packageManager field on next invocation`};continue}if(x(r,o.tool)&&e.find(i=>i.name===r)?.installed)return{installed:!0,name:r}}for(const r of t)if(!(r==="self-activate"||!x(r,o.tool)))return{installed:!1,name:r,note:`${r} can install ${o.tool} — run \`vis toolchain install\` after adding it to PATH`};return{installed:!1,name:"none",note:"No manager knows how to install this tool"}},x=(o,e)=>o==="none"?!1:o==="self-activate"?e==="pnpm"||e==="yarn":R[o].includes(e),ie=(o,e)=>{const n=A(o),t=oe(o,e).map(r=>{const i=ne(r.tool),l=i!==void 0&&te(i,r.version),s=se(r,n,e);return{actual:i,expected:r,manager:s,matches:l}});return{detected:n,tools:t}},ae=(o,e)=>{switch(o){case"asdf":return e?{args:["install",e.tool,e.version],bin:"asdf"}:void 0;case"corepack":return e?{args:["prepare",`${e.tool}@${e.version}`,"--activate"],bin:"corepack"}:{args:["prepare","--activate"],bin:"corepack",hint:"reads the packageManager field in package.json"};case"fnm":return e?.tool!=="node"?void 0:{args:["install",e.version],bin:"fnm"};case"mise":return e?{args:["install",`${e.tool}@${e.version}`],bin:"mise"}:void 0;case"none":return;case"nvm":return{args:[],bin:"nvm",hint:"nvm is a shell function — run `nvm install` / `nvm use` from your shell"};case"proto":return e?{args:["install",e.tool,e.version],bin:"proto"}:void 0;case"self-activate":return{args:[],bin:e?.tool??"pnpm",hint:`${e?.tool??"pnpm"} will self-activate on next invocation — no install needed`};case"volta":return e?{args:["install",`${e.tool}@${e.version}`],bin:"volta"}:{args:["install","node@lts"],bin:"volta",hint:"volta pins per-tool; specify <tool>@<version>"};default:{const n=o;throw new Error(`Unknown manager: ${n}`)}}},de=(o,e)=>{switch(o){case"asdf":return{args:["local",e.tool,e.version],bin:"asdf",configChange:{file:".tool-versions",hint:`Pins ${e.tool} ${e.version}`}};case"corepack":return e.tool!=="npm"&&e.tool!=="pnpm"&&e.tool!=="yarn"?void 0:{args:["use",`${e.tool}@${e.version}`],bin:"corepack",configChange:{file:"package.json",hint:`Writes packageManager: "${e.tool}@${e.version}"`}};case"fnm":return e.tool==="node"?{args:["use",e.version],bin:"fnm"}:void 0;case"mise":return{args:["use","--",`${e.tool}@${e.version}`],bin:"mise",configChange:{file:".mise.toml",hint:`Pins ${e.tool} ${e.version}`}};case"none":return;case"nvm":return e.tool==="node"?{args:[],bin:"nvm",configChange:{file:".nvmrc",hint:"Write version to .nvmrc manually (nvm doesn't persist)."}}:void 0;case"proto":return{args:["pin",e.tool,e.version],bin:"proto",configChange:{file:".prototools",hint:`Pins ${e.tool} ${e.version}`}};case"self-activate":return{args:[],bin:e.tool,configChange:{file:"package.json",hint:`Set packageManager: "${e.tool}@${e.version}" — ${e.tool} will self-activate on next invocation`}};case"volta":return{args:["pin",`${e.tool}@${e.version}`],bin:"volta",configChange:{file:"package.json",hint:`Writes volta.${e.tool}`}};default:{const n=o;throw new Error(`Unknown manager: ${n}`)}}},ge=o=>{for(const e of T[o].binaries){const n=h(e);if(n)return n}},he=(o,e)=>{const n=T[e].binaries;if(o.installed&&o.binPath&&(o.name==="proto"||o.name==="mise"||o.name==="asdf"||o.name==="volta"||o.name==="fnm"))for(const t of n)try{const r=M(o.binPath,["which",t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}).trim();if(r)return r}catch{}for(const t of n){const r=h(t);if(r)return r}},O=(o,e)=>{const n=`${o}.${process.pid}.${F(6).toString("hex")}.tmp`;D(n,e);try{B(n,o)}catch(t){try{U(n)}catch{}throw t}},ce=(o,e)=>{if("packageManager"in o)return o.packageManager=e,o;const n={};let t=!1;for(const[r,i]of Object.entries(o))!t&&(r==="dependencies"||r==="devDependencies"||r==="peerDependencies"||r==="optionalDependencies")&&(n.packageManager=e,t=!0),n[r]=i;return t||(n.packageManager=e),n},be=(o,e)=>{if(e.tool!=="pnpm"&&e.tool!=="yarn"&&e.tool!=="npm"&&e.tool!=="bun")return;const n=m(o,"package.json");if(!u(n))throw new Error(`Cannot pin ${e.tool}: ${n} does not exist.`);const t=y(n),r=/\n([ \t]+)/.exec(t)?.[1]??" ";let i;try{i=JSON.parse(t)}catch(a){throw new Error(`${n} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${a.message}`,{cause:a})}const l=`${e.tool}@${e.version}`,s=ce(i,l),c=t.endsWith(`
2
- `)?`
3
- `:"";return O(n,`${JSON.stringify(s,void 0,r)}${c}`),l},$e=(o,e)=>{const n=m(o,"package.json");if(!u(n))return;const t=y(n);let r;try{r=JSON.parse(t)}catch(s){throw new Error(`${n} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${s.message}`,{cause:s})}if(r.engines?.[e.tool]===void 0||r.engines[e.tool]===e.version)return;r.engines[e.tool]=e.version;const i=/\n([ \t]+)/.exec(t)?.[1]??" ",l=t.endsWith(`
4
- `)?`
5
- `:"";return O(n,`${JSON.stringify(r,void 0,i)}${l}`),e.version},ye=o=>{const e=/^([a-z][\w-]*)@(.+)$/i.exec(o.trim());if(!e)return;const n=g(e[1]);if(n)return{source:"vis.config.ts",tool:n,version:e[2]}},le=async(o,e,n)=>{const t=ie(o,e),r=t.tools.filter(a=>!a.matches);if(r.length===0)return{attempted:[],failed:[],upToDate:!0};const i=t.detected.some(a=>a.installed);if(!(e?.autoInstall??i))return{attempted:[],failed:[],upToDate:!1};const l=[],s=[],c=new Map;for(const a of r){const p=c.get(a.manager.name);p?p.push(a):c.set(a.manager.name,[a])}for(const[a,p]of c){if(a==="self-activate"){for(const{expected:f}of p)n.info(`toolchain: ${f.tool} ${f.version} will self-activate on next ${f.tool} invocation`),l.push(f);continue}if(a==="none"){for(const{expected:f}of p)s.push({error:`no manager can install ${f.tool} — install one of ${J.join(", ")}`,spec:f});continue}if(!t.detected.find(f=>f.name===a)?.installed){for(const{expected:f}of p)s.push({error:`${a} is not on PATH`,spec:f});continue}const v=p.map(f=>({invocation:ae(a,f.expected),tool:f})).filter(f=>f.invocation!==void 0);for(const{invocation:f,tool:b}of v){const{expected:d}=b;if(f.bin==="nvm"&&f.args.length===0){n.warn(`toolchain: nvm requires a shell-side activation for ${d.tool} ${d.version}. Run \`nvm install\` / \`nvm use\` manually.`),s.push({error:"nvm requires shell-side activation",spec:d});continue}n.info(`toolchain: $ ${f.bin} ${f.args.join(" ")}`);try{M(f.bin,f.args,{cwd:o,stdio:"inherit"}),l.push(d),a==="fnm"&&fe(f.bin,n)}catch(E){s.push({error:E.message,spec:d});break}}}return Z(),{attempted:l,failed:s,upToDate:!1}},ke=async(o,e,n,t=!1)=>{if(t)return;const r=await le(o,e,n);for(const i of r.failed)n.warn(`toolchain: ${i.spec.tool} ${i.spec.version} — ${i.error}`)},fe=(o,e)=>{const n=process.platform==="win32"?"powershell":"bash";try{const t=M(o,["env","--shell",n],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3});for(const r of t.split(/\r?\n/)){const i=r.trim();if(i==="")continue;const l=/^\$env:([A-Z_]\w*)\s*=\s*(.+)$/i.exec(i);if(l){const[,a,p]=l;process.env[a]=p.replaceAll(/^["']|["']$/g,"");continue}const s=/^set\s+"?([A-Z_]\w*)=(.*?)"?$/i.exec(i);if(s){const[,a,p]=s;process.env[a]=p;continue}const c=/^(?:export\s+)?([A-Z_]\w*)=(.+)$/i.exec(i);if(c){const[,a,p]=c;process.env[a]=p.replaceAll(/^["']|["']$/g,"")}}}catch(t){e.warn(`toolchain: could not activate fnm env (${t.message}). Subsequent tasks may use the previous Node version.`)}};export{J as S,ye as a,ae as b,se as c,de as d,he as e,A as f,ie as g,ge as h,ve as p,ke as r,$e as u,be as w};
@@ -1 +0,0 @@
1
- import{createRequire as q}from"node:module";import{V as j,s as b}from"./Table-CcVkyULl-B_ef6zfS.js";import{m as M,f as T}from"./index-BDmTbWX1.js";import{g as A}from"./_commonjsHelpers-B5Y90VFO.js";import{l as g,p as c}from"../packem_chunks/bin.js";import{a as C}from"../packem_chunks/config.js";const $=q(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,z=e=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[s,r]=d.versions.node.split(".").map(Number);if(s>22||s===22&&r>=3||s===20&&r>=16)return d.getBuiltinModule(e)}return $(e)},{createInterface:_}=z("node:readline");var D=["aj","aju","av","avj","ejv","jav","jv"],O=["angula","angular-node","angularjs"],N=["auto-prefixer"],R=["aaxios","aios","axio","axioos","axios-node","axioss","axis","axiso","axois","axos","axxios"],S=["abel","babbel","babe","babel-js","babel-node","babl","bable","bbael","bebel"],B=["bcrpyt","bcrypt-node","brcypt","crypt","dcrypt"],F=["bcryptjs-node","dcryptjs"],P=["bunan","bunya","bunyan-node","buynan"],W=["cai","cha","chaijs","chal","chi","chia","hai"],E=["cahlk","calk","cchalk","ch4lk","cha1k","chaalk","chaik","chak","chakl","chalk-node","chalkk","challk","chhalk","chlak","chlk","halk","hcalk"],L=["cheero","cherio"],U=["c0lor","ccolor","clor","colo","coloor","color-js","colorjs","colorr","colr","coolor","coolr"],V=["ccolors","colors-node","colorss","colorz","colrs","coolors"],I=["c0mmander","ccommander","cmmander","cmomander","co-mmander","comamnder","comander","comm4nder","commaander","commader","commadner","commamder","command3r","commandder","commande","commandeer","commander-js","commanderr","commandr","commandre","commanedr","commaner","commannder","commender","commmander","commnader","commnder","coommander","ocmmander","ommander"],Y=["cor","corss","cos","cosr","cros","crs","ors"],G=["days"],H=["d3bug","dbeug","dbug","ddebug","debbug","debg","debgu","debu","debu9","debug-js","debug-node","debugg","debugjs","debuug","deebug","deubg","deug","ebug","edbug"],J=["dot-env","dotenv-node","dotenvjs","dotevn"],K=["3lectron","eectron","eelctron","eelectron","el3ctron","elcetron","elctron","elecctron","elecron","elecrton","electon","electorn","electr0n","electrn","electrno","electro","electrom","electron-node","electronn","electroon","electrron","electtron","eleectron","eletcron","eletron","ellectron","lectron","leectron"],Q=["asbuild","ebuild","esbuild-node","esbuildjs","ezbuild","sbuild"],X=["aslint","elint","eslint-js","eslint-node","eslit","ezlint","slint"],Z=["eexpress","epress","epxress","experss","expess","exppress","expreess","expres","express-node","expressjs","expresss","exprress","exprses","exprss","exress","exrpess","exxpress","xepress","xpress"],ee=["astify"],oe=["firebasejs"],se=["form1dable"],re=["glb","glo","glob-js","globjs","gob","golb","lob"],ae=["go","goot","gotjs","gott","gt","gto","ogt","ot","qot"],te=["helmetjs","helnet"],ne=["homo","hon","hoo","hoon","ohno","ono"],ce=["inquire","inquirer-js","nquirer"],ie=["iredis"],de=["ejst","est","jast","jes","jestjs","jestt","jet","jets","jst"],me=["imp","jim","jip","jmp"],le=["ji","jio","jo","joii","jol","oi","oji"],pe=["jdom","jsdm","jsdo","jsdom-js","jsdon","jsom","sdom"],ue=["jsonwebtoken-js","jsonwebtoken-node"],ve=["ka","kao","ko","koaa","koajs","koe","oa","oka"],he=["1odash","iodash","l0dash","ldash","ldoash","llodash","lo-dash","loadsh","loash","lobash","lod4sh","lodaash","lodah","lodahs","lodas","lodash-node","lodashh","lodassh","loddash","lodesh","lodsah","lodsh","loodash","odash","oldash"],je=["luca","luci","lucie"],be=["luon","luxo","luxon-js"],ke=["imcromatch","mciromatch","micormatch","micrmoatch","micro-match","microamtch","micromacth","micromathc","micromtach","mircomatch"],ge=["minimath"],fe=["mcha","mmocha","moca","moch","mocha-js","moha","nocha","ocha"],ye=["m0ment","mment","mmoent","mmoment","moemnt","moent","mom3nt","momeent","momemt","momen","momen7","momennt","moment-js","momentjs","momentt","momet","mometn","momment","momnet","momnt","monent","mooment","oment","omment"],xe=["mognoose","mogoose","mongoos","mongose","monqoose","moongoose"],we=["moran","organ"],qe=["muler","multer-js","muter"],$e=["mysql"],ze=["ext","mext","n3xt","naxt","net","netx","nex","next-js","next-node","nextjs","nxt"],_e=["node-mailer","nodemailer-js"],Me=["nodemo","nodemonjs","nodmeon"],Te=["oar","or","ora-node","ore","ra","roa"],Ae=["arcel","parce","parceljs"],Ce=["passport-js"],De=["phase","phaser-node"],Oe=["ino","pimo","pin","pino-node","pinojs","pio","pion"],Ne=["playright","playwright-js"],Re=["postcss-js","postcss-node","potscss"],Se=["pettier","pprettier","pretier","prettierjs","prettierr","prtetier"],Be=["prima","prism","prisma-js","prismajs","prizma"],Fe=["pupeteer"],Pe=["rada","rama","ramd","randa"],We=["eact","eract","r3act","raact","ract","raect","re4ct","reaact","reac","reac7","reacct","react-node","reactjs","reactt","reat","reatc","recat","rect","reeact","reect","rreact"],Ee=["erdis","radis","rdis","redi","redis-js","redis-node","rediss","rediz","reds","reis","rredis"],Le=["resen","rsend"],Ue=["ollup","rollup-js","rollup-node"],Ve=["ass","asss","sas","sass-node","sess","ssas","sss"],Ie=["emver","seemver","semver-node","semvre","senver","sever"],Ye=["sequelize-js","sequelize-node"],Ge=["harp","shap","shar","sharp-js","sharpjs"],He=["stipe","strip","stripe-node","tripe"],Je=["supabase-js"],Ke=["suelte","svelt3","svelte-js","sveltejs","velte"],Qe=["tailwindcss-js"],Xe=["auri","taui"],Ze=["hree","htree","thee","there","three-js","three-node","tree"],eo=["stx","sx","ts","tsxx","ttsx","tx","txs","tzx"],oo=["ttypescript","typecript","typescipt","typescript-node","typescriptjs","typescrit","typescritp"],so=["udnerscore","undercore","underscoer","underscore-node","underscroe","undersocre","undesrcore"],ro=["uid","uud","uudi","uui","uuid-js","uuid-node","uuidjs","vuid"],ao=["ite","vie","vit","vita","vite-node","vitee","vlte","vte"],to=["itest","uitest","vitestjs","vitezt","vittest","vtest"],no=["ue","uue","uve","ve","veu","vu","vu3","vua","vue-node","vuee","vuejs","vuue","vve","vvue"],co=["web-pack","weback","webpac","webpack-node","webpackjs","webpak","weebpack","wepack","wepback"],io=["winson","winston-js","winstoon"],mo=["up","uyp","yp","yu","yupjs","yupp"],lo=["od","zd","zdo","zo","zob","zod-js","zodjs"];const po={ajv:D,angular:O,autoprefixer:N,"aws-sdk":["awssdk","ews-sdk"],axios:R,babel:S,bcrypt:B,bcryptjs:F,"body-parser":["body-paresr","body-parse","body-parser-js","body_parser"],bunyan:P,chai:W,chalk:E,cheerio:L,color:U,colors:V,commander:I,"cookie-parser":["cookie-parse","cookieparser"],cors:Y,"cross-env":["crossenv"],"date-fns":["data-fns","date-fn"],dayjs:G,debug:H,dotenv:J,electron:K,esbuild:Q,eslint:X,express:Z,fastify:ee,firebase:oe,formidable:se,glob:re,got:ae,helmet:te,hono:ne,inquirer:ce,ioredis:ie,jest:de,jimp:me,joi:le,jsdom:pe,jsonwebtoken:ue,koa:ve,lodash:he,lucia:je,luxon:be,micromatch:ke,minimatch:ge,mocha:fe,moment:ye,mongoose:xe,morgan:we,multer:qe,mysql2:$e,next:ze,"node-fetch":["node-fecth","node-fethc","node.fetch"],nodemailer:_e,nodemon:Me,ora:Te,parcel:Ae,passport:Ce,phaser:De,pino:Oe,playwright:Ne,postcss:Re,prettier:Se,prisma:Be,puppeteer:Fe,ramda:Pe,react:We,"react-dom":["eact-dom","eract-dom","r3act-dom","ract-dom","raect-dom","re4ct-dom","reaact-dom","reac-dom","reac7-dom","reacct-dom","react-bom","react-d0m","react-ddom","react-dm","react-dmo","react-do","react-domm","react-don","react-doom","react-odm","react-om","react.dom","reactdom","reactt-dom","reat-dom","reatc-dom","recat-dom","rect-dom","reeact-dom","rreact-dom"],redis:Ee,resend:Le,rollup:Ue,sass:Ve,semver:Ie,sequelize:Ye,sharp:Ge,"socket.io":["ocket.io","oscket.io","scket.io","scoket.io","soccket.io","socekt.io","socet.io","sock3t.io","socke.io","socke7.io","sockeet.io","socket.1o","socket.i","socket.iio","socket.ioo","socket.lo","socket.o","socket.oi","sockett.io","sockket.io","sockt.io","sockte.io","sokcet.io","soket.io","soocket.io","ssocket.io"],stripe:He,supabase:Je,svelte:Ke,tailwindcss:Qe,tauri:Xe,three:Ze,"ts-node":["tts-node"],tsx:eo,typescript:oo,underscore:so,uuid:ro,vite:ao,vitest:to,vue:no,webpack:co,winston:io,yup:mo,zod:lo};var u,k;function uo(){return k||(k=1,u={"@tanstack/start":["start-tanstack-app","tanstack","tanstack-app","tanstack-start"]}),u}var vo=uo();const ho=A(vo),jo={a:["4","e"],b:["d"],d:["b"],e:["3","a"],g:["9","q"],i:["1","l"],l:["1","i"],m:["n"],n:["m"],o:["0"],s:["5","z"],t:["7"],u:["v"],v:["u"]},bo=["app","cli","core","kit","lib","pkg","sdk"],ko=e=>{const s=new Set;if(e.length<3)return s;for(let o=0;o<e.length;o++){const a=e[o],t=a==="-"||a==="."||a==="_";if(t||s.add(e.slice(0,o)+e.slice(o+1)),t||s.add(e.slice(0,o)+a+e.slice(o)),o<e.length-1&&e[o]!==e[o+1]){const p=e[o+1]==="-"||e[o+1]==="."||e[o+1]==="_";if(!t&&!p){const i=[...e];[i[o],i[o+1]]=[i[o+1],i[o]],s.add(i.join(""))}}const n=e[o].toLowerCase(),h=jo[n];if(h)for(const p of h)s.add(e.slice(0,o)+p+e.slice(o+1))}const r=/[-._]/g;if(r.test(e))s.add(e.replaceAll(r,"")),s.add(e.replaceAll(r,"-")),s.add(e.replaceAll(r,".")),s.add(e.replaceAll(r,"_"));else if(e.length>5)for(let o=2;o<e.length-2;o++)s.add(`${e.slice(0,o)}-${e.slice(o)}`),s.add(`${e.slice(0,o)}.${e.slice(o)}`),s.add(`${e.slice(0,o)}_${e.slice(o)}`);if(e.startsWith("@")||(s.add(`${e}-js`),s.add(`${e}js`),s.add(`${e}-node`)),e.startsWith("@")){const o=e.indexOf("/");if(o>1&&o<e.length-1){const a=e.slice(1,o),t=e.slice(o+1);a.length>=3&&s.add(a);for(const n of["","-",".","_"])s.add(`${a}${n}${t}`),s.add(`${t}${n}${a}`);for(const n of bo)s.add(`${a}-${n}`),s.add(`${t}-${a}-${n}`),s.add(`${n}-${a}-${t}`)}}return s.delete(e),s};let v,l,m;const f=()=>{if(!v){const e={};for(const s of[po,ho])for(const[r,o]of Object.entries(s)){const a=e[r]??(e[r]=[]);for(const t of o)a.includes(t)||a.push(t)}v=e}return v},go=()=>{if(!l){l=new Map;for(const[e,s]of Object.entries(f()))for(const r of s)l.set(r,e)}return l},fo=()=>{if(!m){m=new Map;for(const e of Object.keys(f()))for(const s of ko(e))m.has(s)||m.set(s,e)}return m},yo=e=>e.startsWith("@")?e.split("/")[1]??e:e,xo=e=>{const s=yo(e),r=go().get(s);if(r)return{input:e,legitimate:r,method:"blocklist"};const o=fo().get(s);if(o)return{input:e,legitimate:o,method:"heuristic"}},y=(e,s)=>{const r=s?new Set(s):void 0,o=[];for(const a of e){if(r?.has(a))continue;const t=xo(a);t&&o.push(t)}return o},x=(e,s)=>{c.warn(""),c.warn(j(`Possible typosquat${e.length===1?"":"s"} ${s}:`));for(const r of e){const o=r.method==="blocklist"?"known typosquat":"similar name";c.warn(` ${b("⚠")} ${j(r.input)} — did you mean ${b(r.legitimate)}? (${o})`)}c.warn("")},w=async e=>{if(!process.stdin.isTTY){c.warn("Aborting: potential typosquat detected in non-interactive mode. Use --no-typosquat-check to skip.");return}const s=_({input:process.stdin,output:process.stdout}),r=await new Promise(o=>{s.question(e,a=>{o(a.trim().toLowerCase())})});return s.close(),r},Do=async(e,s)=>{if(g("typosquats"))return{ok:!0,packages:e};const r=y(e,s);if(r.length===0)return{ok:!0,packages:e};x(r,"detected");const o=await w(`Use suggested package${r.length===1?"":"s"} instead? [S]uggested / [y]es, keep original / [N]o, abort (default: N) `);if(o===void 0)return{ok:!1,packages:e};if(o==="s"||o==="suggested"){const a=new Map(r.map(t=>[t.input,t.legitimate]));return{ok:!0,packages:e.map(t=>a.get(t)??t)}}return o==="y"||o==="yes"?{ok:!0,packages:e}:{ok:!1,packages:e}},wo=/^(?:npm|pnpm|yarn):(.+?)(?:@.*)?$/,qo=e=>wo.exec(e)?.[1],$o=e=>{if(!T(e))return[];const s=C(e),r={...s.dependencies,...s.devDependencies,...s.optionalDependencies,...s.peerDependencies},o=new Set;for(const[a,t]of Object.entries(r)){o.add(a);const n=qo(t);n&&o.add(n)}return[...o]},Oo=async(e,s)=>{if(g("typosquats"))return!0;const r=M(e,"package.json"),o=$o(r);if(o.length===0)return!0;const a=y(o,s);if(a.length===0)return!0;x(a,"in package.json dependencies"),c.warn("Fix the package name in package.json before proceeding.");const t=await w("Continue anyway? [y/N] ");return t==="y"||t==="yes"};export{Do as r,Oo as s};
@@ -1 +0,0 @@
1
- import{createRequire as u}from"node:module";import{s,U as c}from"../packem_chunks/bin.js";const f=u(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const _=(o,i)=>{const r=s.useRef(null),[t,n]=s.useState(o);return s.useLayoutEffect(()=>{if(!r.current)return;const{height:e}=c(r.current);e>0&&e!==t&&(n(e),i?.(e))}),{measuredHeight:t,ref:r}};export{_ as u};
@@ -1 +0,0 @@
1
- import{createRequire as g}from"node:module";import{m as i,f as a,v as d}from"./index-BDmTbWX1.js";import"./public-api-WqUCiyIe.js";import{u as j}from"../packem_chunks/bin.js";const h=g(import.meta.url),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=c=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[s,o]=p.versions.node.split(".").map(Number);if(s>22||s===22&&o>=3||s===20&&o>=16)return p.getBuiltinModule(c)}return h(c)},{readdirSync:m}=u("node:fs"),b=[".husky/pre-commit",".vis/hooks/pre-commit",".git/hooks/pre-commit"],v=[".secretlintrc",".secretlintrc.json",".secretlintrc.js",".secretlintrc.mjs",".secretlintrc.cjs",".secretlintrc.yml",".secretlintrc.yaml"],$=[".syncpackrc",".syncpackrc.json",".syncpackrc.yaml",".syncpackrc.yml",".syncpackrc.cjs",".syncpackrc.js",".syncpackrc.mjs",".syncpackrc.ts","syncpack.config.cjs","syncpack.config.js","syncpack.config.mjs","syncpack.config.ts"],w=c=>{const s=i(c,"package.json");if(!a(s))return[];let o;try{o=JSON.parse(d(s))}catch{return[]}const e=[];if(o.scripts)for(const[t,n]of Object.entries(o.scripts))typeof n=="string"&&(/\bgitleaks\b/.test(n)&&e.push({detail:`Script "${t}" still invokes gitleaks: ${n}`,kind:"script",location:"package.json",tool:"gitleaks"}),/\bsecretlint\b/.test(n)&&e.push({detail:`Script "${t}" still invokes secretlint: ${n}`,kind:"script",location:"package.json",tool:"secretlint"}),/\bsyncpack\b/.test(n)&&e.push({detail:`Script "${t}" still invokes syncpack: ${n}`,kind:"script",location:"package.json",tool:"syncpack"}),/\bsherif\b/.test(n)&&e.push({detail:`Script "${t}" still invokes sherif: ${n}`,kind:"script",location:"package.json",tool:"sherif"}));if(o.devDependencies)for(const t of Object.keys(o.devDependencies))(t==="gitleaks"||t==="@gitleaks/cli")&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"gitleaks"}),(t==="secretlint"||t.startsWith("@secretlint/"))&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"secretlint"}),t==="syncpack"&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"syncpack"}),t==="sherif"&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"sherif"});return o.sherif&&e.push({detail:"`sherif` config block still present in package.json",kind:"config",location:"package.json",tool:"sherif"}),e},_=c=>{const s=[];for(const o of b){const e=i(c,o);if(!a(e))continue;const t=d(e);/\bgitleaks\b/.test(t)&&s.push({detail:"gitleaks invocation still present in hook",kind:"hook",location:o,tool:"gitleaks"}),/\bsecretlint\b/.test(t)&&s.push({detail:"secretlint invocation still present in hook",kind:"hook",location:o,tool:"secretlint"}),/\bsyncpack\b/.test(t)&&s.push({detail:"syncpack invocation still present in hook",kind:"hook",location:o,tool:"syncpack"}),/\bsherif\b/.test(t)&&s.push({detail:"sherif invocation still present in hook",kind:"hook",location:o,tool:"sherif"})}return s},D=c=>{const s=[];for(const o of v)a(i(c,o))&&s.push({detail:"secretlint config should be removed after migration",kind:"config",location:o,tool:"secretlint"});for(const o of $)a(i(c,o))&&s.push({detail:"syncpack config should be removed after migration",kind:"config",location:o,tool:"syncpack"});return s},S=[".github/workflows",".gitlab-ci.yml",".circleci/config.yml",".woodpecker.yml",".drone.yml"],O=c=>{const s=[],o=e=>{const t=i(c,e);if(!a(t))return;const n=d(t);/\bsyncpack\b/.test(n)&&s.push({detail:"syncpack invocation still present in CI",kind:"ci",location:e,tool:"syncpack"}),/\bsherif\b/.test(n)&&s.push({detail:"sherif invocation still present in CI",kind:"ci",location:e,tool:"sherif"})};for(const e of S){const t=i(c,e);if(a(t)){if(e===".github/workflows"){try{for(const n of m(t))(n.endsWith(".yml")||n.endsWith(".yaml"))&&o(`.github/workflows/${n}`)}catch{}continue}o(e)}}return s},M=c=>{const s=[],o=i(c,"pnpm-workspace.yaml");if(a(o)){let t;try{t=j(o)}catch{t=void 0}if(t&&typeof t=="object"){const n=t.catalog;n&&typeof n.syncpack=="string"&&s.push({detail:"`syncpack` still listed in pnpm-workspace.yaml#catalog",kind:"catalog",location:"pnpm-workspace.yaml",tool:"syncpack"});const l=t.catalogs;if(l&&typeof l=="object")for(const[k,r]of Object.entries(l))r&&typeof r.syncpack=="string"&&s.push({detail:`\`syncpack\` still listed in pnpm-workspace.yaml#catalogs.${k}`,kind:"catalog",location:"pnpm-workspace.yaml",tool:"syncpack"})}}const e=i(c,"package.json");if(a(e)){let t;try{t=JSON.parse(d(e))}catch{return s}const n=t.workspaces;if(n&&typeof n=="object"&&!Array.isArray(n)){const k=n.catalog;k&&typeof k.syncpack=="string"&&s.push({detail:"`syncpack` still listed in package.json#workspaces.catalog",kind:"catalog",location:"package.json",tool:"syncpack"});const r=n.catalogs;if(r&&typeof r=="object")for(const[y,f]of Object.entries(r))f&&typeof f.syncpack=="string"&&s.push({detail:`\`syncpack\` still listed in package.json#workspaces.catalogs.${y}`,kind:"catalog",location:"package.json",tool:"syncpack"})}const l=t.catalog;l&&typeof l.syncpack=="string"&&s.push({detail:"`syncpack` still listed in package.json#catalog",kind:"catalog",location:"package.json",tool:"syncpack"})}return s},N=c=>[...w(c),..._(c),...D(c),...O(c),...M(c)],A=(c,s)=>{const o=N(c);if(o.length===0)return s.info("✓ No unmigrated gitleaks/secretlint/sherif/syncpack references found."),[];s.warn(`Found ${String(o.length)} unmigrated reference(s):`);for(const e of o)s.warn(` [${e.kind}] ${e.location} — ${e.detail}`);return o};export{N as s,A as v};
@@ -1 +0,0 @@
1
- import{aD as de,a4 as e,a5 as l,m as r,aE as pe,B as he,aF as je,aG as ge,s as g,ae as me,aH as z,aI as ie}from"../packem_chunks/bin.js";import{o as fe}from"./spinner-CV3WVJLv.js";import{F as ye,a as we}from"./tabs-BuTy5gPV.js";import{u as Ce}from"./use-measured-height-_eVGWtWt.js";const Ue=({current:a,total:t})=>{const{columns:s}=de(),i=s||80,d=t>0?Math.min(1,a/t):0,h=`${String(Math.round(d*100)).padStart(3)}%`,f=`${String(a)}/${String(t)}`,y=Math.max(10,i-2-h.length-1),p=Math.round(y*d),j=y-p;return e.jsxs(l,{flexDirection:"column",paddingX:1,children:[e.jsxs(l,{children:[e.jsx(fe,{type:"dots"}),e.jsx(r,{children:" Checking catalog dependencies "}),e.jsx(r,{dimColor:!0,children:f})]}),e.jsxs(l,{children:[e.jsx(r,{color:"cyan",children:"━".repeat(p)}),e.jsx(r,{dimColor:!0,children:"─".repeat(j)}),e.jsxs(r,{dimColor:!0,children:[" ",h]})]})]})},Q=["default","name","updateType","severity"],oe=a=>{const t=a.vulnerabilities?.map(s=>s.severity)??[];return t.includes("CRITICAL")?4:t.includes("HIGH")?3:t.includes("MODERATE")?2:t.includes("LOW")?1:0},ne={digest:0,major:3,minor:2,patch:1,pin:0,unknown:0},ce=(a,t)=>{if(t==="default")return a;const s=[...a];return t==="name"?s.sort((i,d)=>i.packageName.localeCompare(d.packageName)):t==="updateType"?s.sort((i,d)=>(ne[d.updateType]??0)-(ne[i.updateType]??0)||i.packageName.localeCompare(d.packageName)):s.sort((i,d)=>oe(d)-oe(i)||i.packageName.localeCompare(d.packageName)),s},_=a=>`${a.ecosystem}|${a.file}:${String(a.line)}|${a.name}`,X=a=>{const t=new Map;for(const s of a){const i=t.get(s.catalogName);i?i.push(s):t.set(s.catalogName,[s])}return t},O=(a,t,s)=>{let i=a;if(t!=="all"&&(i=t==="security"?i.filter(d=>d.vulnerabilities&&d.vulnerabilities.length>0||d.socketReport&&d.socketReport.alerts.length>0):i.filter(d=>d.updateType===t)),s){const d=s.toLowerCase();i=i.filter(h=>h.packageName.toLowerCase().includes(d))}return i};class He{#e;#l=new Set;#t;#s;#i=null;constructor(t,s=null,i=[]){this.#t=t,this.#s=i,s&&(this.#i=new Map(s.recommendations.map(d=>[d.package,d]))),this.#e={aiResult:s,allChecked:!0,applyProgress:null,checkedEcosystemKeys:new Set(i.map(d=>_(d))),checkedEntries:new Set(t.map(d=>d.packageName)),ecosystemEntries:i,entries:t,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",groupedByCatalog:X(t),phase:"browsing",selectedIndex:0,sortMode:"default"}}getSnapshot=()=>this.#e;subscribe=t=>(this.#l.add(t),()=>{this.#l.delete(t)});getFilteredEntries(){return ce(O(this.#t,this.#e.filterType,this.#e.filterText),this.#e.sortMode)}setSortMode(t){if(t===this.#e.sortMode)return;const s=this.getFilteredEntries()[this.#e.selectedIndex]?.packageName,i=ce(O(this.#t,this.#e.filterType,this.#e.filterText),t),d=s?Math.max(0,i.findIndex(h=>h.packageName===s)):0;this.#r({...this.#e,selectedIndex:d,sortMode:t})}cycleSortMode(){const t=Q.indexOf(this.#e.sortMode),s=Q[(t+1)%Q.length]??"default";this.setSortMode(s)}getRecommendation(t){return this.#i?.get(t)}getCheckedEntries(){return this.#t.filter(t=>this.#e.checkedEntries.has(t.packageName))}getCheckedEcosystemEntries(){return this.#s.filter(t=>this.#e.checkedEcosystemKeys.has(_(t)))}toggleEcosystemCheck(t){const s=new Set(this.#e.checkedEcosystemKeys);s.has(t)?s.delete(t):s.add(t),this.#r({...this.#e,checkedEcosystemKeys:s})}checkAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set(this.#s.map(t=>_(t)))})}uncheckAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set})}setSelectedIndex(t){const s=this.getFilteredEntries(),i=Math.max(0,Math.min(t,s.length-1));i!==this.#e.selectedIndex&&this.#r({...this.#e,selectedIndex:i})}setFocusedPanel(t){t!==this.#e.focusedPanel&&this.#r({...this.#e,focusedPanel:t})}setFilterType(t){if(t!==this.#e.filterType){const s=O(this.#t,t,this.#e.filterText);this.#r({...this.#e,entries:s,filterType:t,groupedByCatalog:X(s),selectedIndex:0})}}setFilter(t){const s=O(this.#t,this.#e.filterType,t);this.#r({...this.#e,entries:s,filterText:t,groupedByCatalog:X(s),selectedIndex:0})}setFilterActive(t){if(t!==this.#e.filterActive)if(t)this.#r({...this.#e,filterActive:!0});else{const s=O(this.#t,this.#e.filterType,"");this.#r({...this.#e,entries:s,filterActive:!1,filterText:"",groupedByCatalog:X(s),selectedIndex:0})}}toggleCheck(t){const s=new Set(this.#e.checkedEntries);s.has(t)?s.delete(t):s.add(t),this.#r({...this.#e,allChecked:s.size===this.#t.length,checkedEntries:s})}checkAll(){this.#r({...this.#e,allChecked:!0,checkedEntries:new Set(this.#t.map(t=>t.packageName))})}uncheckAll(){this.#r({...this.#e,allChecked:!1,checkedEntries:new Set})}toggleAll(){this.#e.allChecked?this.uncheckAll():this.checkAll()}startApply(){const t=this.getCheckedEntries();this.#r({...this.#e,applyProgress:{current:0,total:t.length},phase:"applying"})}updateApplyProgress(t){this.#e.applyProgress&&this.#r({...this.#e,applyProgress:{...this.#e.applyProgress,current:t}})}markDone(){this.#r({...this.#e,phase:"done"})}setError(t){this.#r({...this.#e,error:t,phase:"error"})}#r(t){this.#e=t;for(const s of this.#l)try{s()}catch{}}}const ke={major:"red",minor:"yellow",patch:"green"},be={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},Te={critical:"red",high:"red",low:"gray",medium:"yellow"},Se={critical:"red",high:"red",low:"green",medium:"yellow"},Ee={defer:"gray",review:"yellow",skip:"red",update:"green"},Re=({changelogUrl:a,entry:t,focused:s,recommendation:i,scrollRef:d})=>{const h=s?"white":"gray";if(!t)return e.jsx(l,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:e.jsx(r,{dimColor:!0,children:"No package selected"})});const f=ke[t.updateType]??"white",y=t.vulnerabilities&&t.vulnerabilities.length>0,p=t.socketReport?.score.overall??0,j=t.socketReport?he(p):"gray";return e.jsxs(l,{borderColor:h,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsx(l,{flexShrink:0,paddingTop:1,paddingX:2,children:e.jsx(r,{bold:!0,color:"white",children:t.packageName})}),e.jsxs(pe,{flexGrow:1,flexShrink:1,paddingX:2,ref:d,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[e.jsx(r,{}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Current:"})}),e.jsx(r,{children:t.currentRange})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Target:"})}),e.jsx(r,{children:t.newRange}),e.jsxs(r,{bold:!0,color:f,children:[" ","(",t.updateType,")"]})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Version:"})}),e.jsx(r,{children:t.targetVersion})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Catalog:"})}),e.jsx(r,{children:t.catalogName})]}),t.acceptedRisk&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{color:"gray",children:"── "}),e.jsx(r,{bold:!0,color:"gray",children:"ACKNOWLEDGED RISK"}),e.jsxs(l,{flexDirection:"column",paddingLeft:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Reason: "}),e.jsx(r,{children:t.acceptedRisk.reason})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Accepted: "}),e.jsx(r,{children:t.acceptedRisk.acceptedAt.slice(0,10)})]})]})]}),y&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"red",children:"SECURITY"}),e.jsx(r,{}),t.vulnerabilities.map(o=>e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{gap:1,children:[e.jsxs(r,{bold:!0,color:be[o.severity]??"gray",children:["⚠"," ",o.severity]}),e.jsx(r,{bold:!0,children:o.id})]}),e.jsx(l,{paddingLeft:2,children:e.jsx(r,{children:o.summary})}),e.jsxs(l,{gap:2,paddingLeft:2,children:[o.cvssScore!==void 0&&e.jsxs(r,{dimColor:!0,children:["CVSS:",String(o.cvssScore)]}),o.fixedVersions.length>0&&e.jsxs(r,{dimColor:!0,children:["Fixed in:",o.fixedVersions.join(", ")]})]})]},o.id))]}),t.socketReport&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"cyan",children:"SOCKET.DEV"}),e.jsx(r,{}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Overall: "}),e.jsxs(r,{bold:!0,color:j,children:[String(Math.round(p*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Supply Chain: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.supplyChain*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Quality: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.quality*100)),"%"]})]})]}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Maintenance: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.maintenance*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Vulnerability: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.vulnerability*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"License: "}),e.jsxs(r,{children:[t.socketReport.license||"unknown"," ","(",String(Math.round(t.socketReport.score.license*100)),"%)"]})]})]}),t.socketReport.alerts.length>0&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsxs(r,{bold:!0,color:"yellow",children:["⚠"," ",String(t.socketReport.alerts.length)," ","alert",t.socketReport.alerts.length===1?"":"s",":"]}),t.socketReport.alerts.map(o=>e.jsxs(l,{gap:1,paddingLeft:2,children:[e.jsxs(r,{bold:!0,color:Te[o.severity]??"gray",children:["[",o.severity.toUpperCase(),"]"]}),e.jsx(r,{children:o.type}),e.jsxs(r,{dimColor:!0,children:["(",o.category,")"]})]},o.key))]})]}),i&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"AI ANALYSIS"}),e.jsx(r,{}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Action: "}),e.jsx(r,{bold:!0,color:Ee[i.action]??"white",children:i.action})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Risk: "}),e.jsx(r,{bold:!0,color:Se[i.riskLevel]??"white",children:i.riskLevel})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Effort: "}),e.jsx(r,{bold:!0,children:i.effort})]})]}),i.reason&&e.jsx(l,{marginTop:1,paddingLeft:2,children:e.jsx(r,{children:i.reason})}),i.breakingChanges.length>0&&e.jsxs(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[e.jsx(r,{bold:!0,color:"yellow",children:"Breaking changes:"}),i.breakingChanges.map((o,v)=>e.jsxs(r,{children:[" ","•"," ",o]},String(v)))]})]}),a&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"CHANGELOG"}),e.jsx(l,{marginTop:1,paddingLeft:2,children:e.jsx(r,{color:"cyan",underline:!0,children:a})})]}),e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"LINKS"}),e.jsx(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:e.jsxs(r,{color:"cyan",underline:!0,children:["https://npmx.dev/",t.packageName]})})]}),!i&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"GUIDANCE"}),e.jsxs(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.updateType==="major"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"red",children:["⚠"," ","Major update — likely contains breaking changes."]}),e.jsx(r,{dimColor:!0,children:" Review the changelog before updating."}),e.jsx(r,{dimColor:!0,children:" Use --changelog to fetch release URLs."})]}),t.updateType==="minor"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"yellow",children:["ℹ"," ","Minor update — new features, backward compatible."]}),e.jsx(r,{dimColor:!0,children:" Generally safe to update."})]}),t.updateType==="patch"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"green",children:["✓"," ","Patch update — bug fixes only."]}),e.jsx(r,{dimColor:!0,children:" Safe to update."})]}),!i&&e.jsx(r,{dimColor:!0,children:" Use --ai to get AI-powered analysis."})]})]})]})]})},ve={major:"red",minor:"yellow",patch:"green"},Ae=[{id:"all",label:"All"},{id:"major",label:"Major"},{id:"minor",label:"Minor"},{id:"patch",label:"Patch"},{id:"security",label:"Security"}],Ie=({checked:a,entry:t,isSelected:s})=>{const i=ve[t.updateType]??"white",d=t.vulnerabilities&&t.vulnerabilities.length>0,h=t.socketReport&&t.socketReport.alerts.length>0,f=!!t.acceptedRisk,y=a?"☑":"☐",p=t.socketReport?`${String(Math.round(t.socketReport.score.overall*100))}%`:"",j=t.socketReport?he(t.socketReport.score.overall):"gray";return e.jsxs(l,{flexShrink:0,height:1,children:[e.jsx(r,{children:s?">":" "}),e.jsxs(r,{color:a?"white":"gray",children:[" ",y," "]}),d||h?e.jsx(r,{color:f?"gray":"red",children:f?"✓ ":"⚠ "}):e.jsx(r,{children:" "}),e.jsx(l,{flexGrow:1,children:e.jsxs(r,{bold:s,inverse:s,wrap:"truncate",children:[t.packageName,f?" [ack]":""]})}),p&&e.jsxs(r,{color:j,children:[" ",p]}),e.jsxs(r,{dimColor:!0,children:[" ",t.currentRange]}),e.jsxs(r,{dimColor:!0,children:[" ","→"," "]}),e.jsxs(r,{children:[t.newRange," "]}),e.jsx(r,{bold:!0,color:i,children:t.updateType})]})},De=({count:a,name:t})=>e.jsxs(l,{flexShrink:0,height:1,marginTop:1,children:[e.jsxs(r,{dimColor:!0,children:["▼"," "]}),e.jsx(r,{bold:!0,color:"white",children:t.toUpperCase()}),e.jsxs(r,{dimColor:!0,children:[" ","(",a,")"]})]}),Me=({checkedEntries:a,entries:t,filterActive:s,filteredOutCount:i,filterText:d,filterType:h,focused:f,groupedByCatalog:y,isDryRun:p,onViewportHeightChange:j,scrollOffset:o,selectedIndex:v,totalCatalogEntries:A,totalChecked:T,totalEntries:U,viewportHeight:B})=>{const L=f?"white":"gray",{measuredHeight:m,ref:S}=Ce(B,j);let F=0,b=0,I=0,E=0;for(const x of t)x.updateType==="major"?F++:x.updateType==="minor"?b++:I++,(x.vulnerabilities&&x.vulnerabilities.length>0||x.socketReport&&x.socketReport.alerts.length>0)&&E++;const C=[];F>0&&C.push(`${F} major`),b>0&&C.push(`${b} minor`),I>0&&C.push(`${I} patch`),E>0&&C.push(`${E} vulnerable`);const D=C.length>0?` (${C.join(", ")})`:"";let k=0;for(const x of t)a.has(x.packageName)&&k++;const w=[];let H=0;for(const[x,R]of y){w.push(e.jsx(De,{count:R.length,name:x},`hdr-${x}`));for(const $ of R){const M=H;w.push(e.jsx(Ie,{checked:a.has($.packageName),entry:$,isSelected:M===v},$.packageName)),H++}}let P=0;for(const[,x]of y)P+=2+x.length;const K=P>m&&m>0;return e.jsxs(l,{borderColor:L,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsxs(l,{flexShrink:0,gap:1,paddingX:1,children:[e.jsx(r,{bold:!0,inverse:!0,children:" VIS "}),e.jsxs(r,{wrap:"truncate",children:[U,T>0?`/${T}`:""," ","outdated",D,A>T?` · ${A-T} dupes`:""]}),!p&&k>0&&e.jsxs(r,{dimColor:!0,children:[" ","—",k," ","selected"]})]}),e.jsx(l,{flexShrink:0,paddingX:1,paddingY:1,children:e.jsx(ye,{isFocused:f,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:()=>{},showIndex:!1,value:h,children:Ae.map(({id:x,label:R})=>e.jsx(we,{name:x,children:R},x))})}),s&&e.jsxs(l,{flexShrink:0,paddingX:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/ "}),e.jsx(r,{children:d}),e.jsx(r,{inverse:!0,children:" "})]}),i>0&&e.jsx(l,{flexShrink:0,paddingX:1,children:e.jsxs(r,{color:"yellow",children:["⚠"," ",i," ","package",i===1?"":"s"," ","filtered out by target constraint — press"," ",e.jsx(r,{bold:!0,color:"white",children:"f"})," ","to view"]})}),e.jsxs(l,{flexDirection:"row",flexGrow:1,overflow:"hidden",ref:S,children:[e.jsx(l,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:e.jsx(l,{flexDirection:"column",marginTop:-o,children:w})}),K&&e.jsx(l,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(je,{contentHeight:P,placement:"inset",scrollOffset:o,style:"block",viewportHeight:m})})]},`list-${h}-${d}`)]})},Ne=100,Be=40,Le=10,Fe=[],G=["all","major","minor","patch","security"],Ke=({autoExitSeconds:a=0,changelogUrls:t,checkedCount:s=0,filteredOutEntries:i=Fe,isDryRun:d,store:h,totalCatalogEntries:f=0})=>{const{exit:y}=ge(),{columns:p,rows:j}=de(),o=g.useSyncExternalStore(h.subscribe,h.getSnapshot),[v,A]=g.useState(!1),[T,U]=g.useState(!1),B=g.useRef(null),L=g.useRef(null),m=g.useRef(null),S=g.useRef(null),[F,b]=g.useState(0),[I,E]=g.useState(!1),[C,D]=g.useState(!1),k=g.useMemo(()=>h.getFilteredEntries(),[o.entries,o.filterType,o.filterText,o.sortMode]),w=k[o.selectedIndex]??null,H=w?h.getRecommendation(w.packageName):void 0,P=w&&t?t.get(w.packageName):void 0,K=g.useCallback(n=>{let c=0,u=0;for(const[,W]of o.groupedByCatalog){c+=2;for(let se=0;se<W.length;se++){if(u===n)return c;c+=1,u++}}return c},[o.groupedByCatalog]),x=Math.max(1,j-8-(o.filterActive?1:0)),[R,$]=g.useState(x),M=R>0?R:x,N=g.useCallback(n=>{const c=K(n);b(u=>c>u+M-2?Math.max(0,c-M+2):c<u+1?Math.max(0,c-1):u)},[K,M]);if(g.useEffect(()=>{m.current?.scrollToTop()},[w?.packageName]),me((n,c)=>{if(n==="c"&&c.ctrl){y();return}if(!C){if(T){c.escape||n==="f"||n==="q"?U(!1):c.downArrow||n==="j"?L.current?.scrollBy(1):(c.upArrow||n==="k")&&L.current?.scrollBy(-1);return}if(I){n==="u"||c.return?(E(!1),h.startApply(),y(h.getCheckedEntries())):c.escape||n==="q"?E(!1):c.downArrow||n==="j"?S.current?.scrollBy(1):c.upArrow||n==="k"?S.current?.scrollBy(-1):c.pageDown?S.current?.scrollBy(5):c.pageUp&&S.current?.scrollBy(-5);return}if(v){c.escape||n==="?"?A(!1):n==="q"?(A(!1),D(!0)):c.downArrow||n==="j"?B.current?.scrollBy(1):(c.upArrow||n==="k")&&B.current?.scrollBy(-1);return}if(n==="?"){A(!0);return}if(n==="q"){D(!0);return}if(c.tab){h.setFocusedPanel(o.focusedPanel==="list"?"detail":"list");return}if(o.focusedPanel==="list"&&(c.leftArrow||c.rightArrow)){const u=G.indexOf(o.filterType),W=c.rightArrow?(u+1)%G.length:(u-1+G.length)%G.length;b(0),m.current?.scrollToTop(),h.setFilterType(G[W]);return}if(n==="f"&&i.length>0){U(u=>!u);return}if(o.filterActive){if(c.escape){h.setFilterActive(!1);return}if(c.return){h.setFilterActive(!1);return}if(c.backspace){b(0),h.setFilter(o.filterText.slice(0,-1));return}if(n&&!c.ctrl&&!c.meta){b(0),h.setFilter(o.filterText+n);return}return}if(o.focusedPanel==="list"){if(c.downArrow||n==="j"){const u=Math.min(o.selectedIndex+1,k.length-1);h.setSelectedIndex(u),N(u);return}if(c.upArrow||n==="k"){const u=Math.max(o.selectedIndex-1,0);h.setSelectedIndex(u),N(u);return}if(c.pageDown){const u=Math.min(o.selectedIndex+10,k.length-1);h.setSelectedIndex(u),N(u);return}if(c.pageUp){const u=Math.max(o.selectedIndex-10,0);h.setSelectedIndex(u),N(u);return}if(c.home){h.setSelectedIndex(0),b(0);return}if(c.end){const u=k.length-1;h.setSelectedIndex(u),N(u);return}if(n===" "||c.return){w&&h.toggleCheck(w.packageName);return}if(n==="a"){h.toggleAll();return}if(n==="s"){h.cycleSortMode(),N(h.getSnapshot().selectedIndex);return}if(n==="/"){h.setFilterActive(!0);return}if(n==="u"&&!d&&o.checkedEntries.size>0){E(!0);return}if(c.rightArrow){h.setFocusedPanel("detail");return}return}if(o.focusedPanel==="detail"){if(c.escape||c.leftArrow){h.setFocusedPanel("list");return}if(c.downArrow||n==="j"){m.current?.scrollBy(1);return}if(c.upArrow||n==="k"){m.current?.scrollBy(-1);return}if(c.pageDown){m.current?.scrollBy(10);return}if(c.pageUp){m.current?.scrollBy(-10);return}if(c.home){m.current?.scrollToTop();return}c.end&&m.current?.scrollToBottom()}}},{isActive:!0}),p<Be||j<Le)return e.jsx(l,{alignItems:"center",height:j,justifyContent:"center",width:p,children:e.jsxs(r,{color:"yellow",children:["Terminal too small (",p,"x",j,")"]})});const ae=p>=Ne,V=[e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"q"}),e.jsx(r,{dimColor:!0,children:"QUIT"})]},"q"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"?"}),e.jsx(r,{dimColor:!0,children:"HELP"})]},"?"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"}),e.jsx(r,{dimColor:!0,children:"NAV"})]},"nav"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Space"}),e.jsx(r,{dimColor:!0,children:"CHECK"})]},"sp"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"a"}),e.jsx(r,{dimColor:!0,children:"ALL"})]},"a")];!d&&o.checkedEntries.size>0&&V.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"green",children:"u"}),e.jsx(r,{dimColor:!0,children:"APPLY"})]},"u")),i.length>0&&V.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"yellow",children:"f"}),e.jsxs(r,{dimColor:!0,children:["FILTERED (",i.length,")"]})]},"fo")),V.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"←→"}),e.jsx(r,{dimColor:!0,children:"FILTER"})]},"lr"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/"}),e.jsx(r,{dimColor:!0,children:"SEARCH"})]},"f"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Tab"}),e.jsx(r,{dimColor:!0,children:"PANEL"})]},"t"));const J=e.jsx(l,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:e.jsx(l,{flexWrap:"wrap",gap:2,paddingX:1,children:V})}),Z=e.jsxs(z,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"?"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:B,title:"KEYBOARD SHORTCUTS",visible:v,width:52,children:[e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),e.jsxs(l,{children:[e.jsx(l,{width:24,children:e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↑","/k"]}),e.jsx(r,{dimColor:!0,children:" Move up"})]})}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↓","/j"]}),e.jsx(r,{dimColor:!0,children:" Move down"})]})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Tab"]}),e.jsx(r,{dimColor:!0,children:" Switch panel"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","→","/","←"]}),e.jsx(r,{dimColor:!0,children:" Focus detail/list"})]})]}),e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"SELECTION"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Space"]}),e.jsx(r,{dimColor:!0,children:" Toggle check on package"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","a"]}),e.jsx(r,{dimColor:!0,children:" Toggle check all"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","s"]}),e.jsx(r,{dimColor:!0,children:" Cycle sort (default / name / type / severity)"})]})]}),e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"FILTERS"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","←→"]}),e.jsx(r,{dimColor:!0,children:" Switch filter tab"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","/"]}),e.jsx(r,{dimColor:!0,children:" Text filter"})]}),i.length>0&&e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","f"]}),e.jsx(r,{dimColor:!0,children:" View filtered-out packages"})]})]}),e.jsxs(l,{flexDirection:"column",children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"ACTIONS"})]}),!d&&e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","u"]}),e.jsx(r,{dimColor:!0,children:" Apply selected updates"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","q"]}),e.jsx(r,{dimColor:!0,children:" Quit"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","?"]}),e.jsx(r,{dimColor:!0,children:" Toggle help"})]})]})]}),q=h.getCheckedEntries(),Y=q.filter(n=>n.updateType==="major").length,ue=e.jsxs(l,{alignItems:"center",flexDirection:"column",children:[Y>0&&e.jsx(l,{marginBottom:1,marginTop:1,children:e.jsxs(r,{color:"yellow",children:["⚠"," ",Y," ","major update",Y===1?"":"s"," ","— review breaking changes"]})}),e.jsxs(r,{dimColor:!0,children:["Press"," ",e.jsx(r,{bold:!0,color:"white",children:"u"})," ","or"," ",e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","to confirm,"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","to cancel"]})]}),ee=e.jsx(z,{footer:ue,scrollRef:S,title:`Apply ${q.length} update${q.length===1?"":"s"}?`,visible:I,width:70,children:q.map(n=>e.jsxs(l,{gap:1,children:[e.jsxs(r,{children:[" ",n.packageName]}),e.jsxs(r,{dimColor:!0,children:[n.currentRange," ","→"," ",n.newRange]}),e.jsx(r,{bold:!0,color:n.updateType==="major"?"red":n.updateType==="minor"?"yellow":"green",children:n.updateType})]},n.packageName))}),re=i.length>0?e.jsx(z,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"f"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:L,title:`${i.length} PACKAGE${i.length===1?"":"S"} FILTERED BY TARGET`,visible:T,width:70,children:e.jsxs(l,{flexDirection:"column",children:[e.jsx(l,{marginBottom:1,children:e.jsxs(r,{dimColor:!0,children:["These packages have newer versions available but are excluded by the current target constraint. Use"," ",e.jsx(r,{bold:!0,color:"white",children:"--target latest"})," ","to include them."]})}),i.map(n=>e.jsxs(l,{gap:1,children:[e.jsxs(r,{children:[" ",n.packageName]}),e.jsxs(r,{dimColor:!0,children:[n.currentRange," ","→"," ",n.newRange]}),e.jsx(r,{bold:!0,color:n.updateType==="major"?"red":n.updateType==="minor"?"yellow":"green",children:n.updateType})]},n.packageName))]})}):null,te=e.jsx(Me,{checkedEntries:o.checkedEntries,entries:k,filterActive:o.filterActive,filteredOutCount:i.length,filterText:o.filterText,filterType:o.filterType,focused:o.focusedPanel==="list",groupedByCatalog:o.groupedByCatalog,isDryRun:d,onViewportHeightChange:$,scrollOffset:F,selectedIndex:o.selectedIndex,totalCatalogEntries:f,totalChecked:s,totalEntries:k.length,viewportHeight:M}),le=e.jsx(Re,{changelogUrl:P,entry:w,focused:o.focusedPanel==="detail",recommendation:H,scrollRef:m});if(ae){const n=Math.floor(p*.35);return e.jsxs(l,{flexDirection:"column",height:j,width:p,children:[e.jsxs(l,{flexDirection:"row",flexGrow:1,children:[e.jsx(l,{flexGrow:1,children:te}),e.jsx(l,{width:n,children:le})]}),J,ee,re,e.jsx(ie,{autoExitSeconds:a||3,onCancel:()=>{D(!1)},visible:C}),Z]})}const xe=Math.floor(j*.55);return e.jsxs(l,{flexDirection:"column",height:j,width:p,children:[e.jsx(l,{height:xe,children:te}),e.jsx(l,{flexGrow:1,children:le}),J,ee,re,e.jsx(ie,{autoExitSeconds:a||3,onCancel:()=>{D(!1)},visible:C}),Z]})};export{He as U,Ke as b,Ue as u};
@@ -1 +0,0 @@
1
- import{createRequire as b}from"node:module";import{B as v,H as T,y as W}from"./index-BDmTbWX1.js";import{p as h}from"../packem_chunks/bin.js";const $=b(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=a=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[n,o]=m.versions.node.split(".").map(Number);if(n>22||n===22&&o>=3||n===20&&o>=16)return m.getBuiltinModule(a)}return $(a)},{watch:y}=p("node:fs"),{execFileSync:j}=p("node:child_process"),{createRequire:S}=p("node:module"),_=S(import.meta.url);let w;const k=()=>{if(w!==void 0)return w;try{_.resolve("fb-watchman")}catch{return w=!1,!1}try{j("watchman",["--version"],{stdio:"ignore",timeout:2e3})}catch{return w=!1,!1}return w=!0,!0},q=(a,n)=>{if(!k())return;let o;try{o=_("fb-watchman")}catch(s){h.warn(`[vis watch] fb-watchman failed to load, using native watcher: ${s.message}`);return}const c=new o.Client;c.on("error",s=>{h.warn(`[vis watch] watchman error: ${s.message}`)}),c.on("subscription",s=>{const t=s;if(!t.is_fresh_instance)for(const e of t.files??[])n(e)});for(const[s,t]of a.entries()){const e=v(t),i=`vis-watch-${s}-${process.pid}`;c.command(["watch-project",e],(l,f)=>{if(l){h.warn(`[vis watch] watchman could not watch ${t}: ${l.message}`);return}const u={expression:["allof",["type","f"]],fields:["name"]};f.relative_path&&(u.relative_root=f.relative_path),c.command(["subscribe",f.watch,i,u],r=>{r&&h.warn(`[vis watch] watchman subscribe failed for ${t}: ${r.message}`)})})}return{close:()=>{try{c.end()}catch{}}}},x=[/node_modules(?:\/|$)/,/\.git(?:\/|$)/,/\.vis(?:\/|$)/],R=(a,n)=>{const o=new Set,c=new Set;for(const[,e]of a){const i=e.task.hashDetails?.nodes;if(i)for(const l of Object.keys(i))o.add(l),c.add(T(v(n,l)))}const s=[...c].sort(),t=[];for(const e of s)t.some(i=>e===i||e.startsWith(`${i}/`))||t.push(e);return{directories:t,files:o}},P=(a,n,o)=>{const c=new Set;for(const s of a){const t=v(n,s);for(const e of o)if(t===e||t.startsWith(`${e}/`)){const i=W(e,t);i.length>0&&c.add(i)}}return s=>{const t=s.replaceAll("\\","/");return c.has(t)}},A=a=>{const n=a.replaceAll("\\","/");return x.some(o=>o.test(n))},D=a=>{const{debounceMs:n=150,filter:o,onChange:c,paths:s}=a;let t=new Set,e;const i=()=>{e=void 0;const r=[...t];t=new Set,r.length!==0&&Promise.resolve(c(r)).catch(d=>{h.error("[vis watch] onChange handler failed:",d)})},l=r=>{A(r)||o&&!o(r)||(t.add(r),e&&clearTimeout(e),e=setTimeout(i,n))},f=q(s,l);if(f)return{close:()=>{e&&clearTimeout(e),f.close()}};const u=[];for(const r of s)try{const d=y(r,{recursive:!0},(B,g)=>{g&&l(g)});u.push(d)}catch(d){h.warn(`[vis watch] unable to watch ${r}: ${d.message}`)}return{close:()=>{e&&clearTimeout(e);for(const r of u)try{r.close()}catch{}}}};export{P as a,R as c,D as s};