@visulima/vis 1.0.0-alpha.35 → 1.0.0-alpha.36

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 (193) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/LICENSE.md +3244 -1611
  3. package/README.md +44 -0
  4. package/dashboard/dist/index.html +11 -11
  5. package/dist/bin.js +1 -1
  6. package/dist/binx.js +1 -1
  7. package/dist/config/index.d.ts +74 -2
  8. package/dist/config/index.js +1 -1
  9. package/dist/generate/index.js +1 -1
  10. package/dist/packem_chunks/bin.js +584 -588
  11. package/dist/packem_chunks/bloom-status.js +2 -2
  12. package/dist/packem_chunks/bloom-sync.js +2 -2
  13. package/dist/packem_chunks/cache-attestation.js +1 -1
  14. package/dist/packem_chunks/config.js +18 -16
  15. package/dist/packem_chunks/devtools.js +56 -57
  16. package/dist/packem_chunks/doctor-probe.js +2 -2
  17. package/dist/packem_chunks/fix.js +11 -11
  18. package/dist/packem_chunks/handler.js +1 -1
  19. package/dist/packem_chunks/handler10.js +1 -1
  20. package/dist/packem_chunks/handler11.js +5 -5
  21. package/dist/packem_chunks/handler12.js +1 -1
  22. package/dist/packem_chunks/handler13.js +7 -7
  23. package/dist/packem_chunks/handler14.js +4 -4
  24. package/dist/packem_chunks/handler15.js +1 -1
  25. package/dist/packem_chunks/handler16.js +1 -1
  26. package/dist/packem_chunks/handler17.js +1 -1
  27. package/dist/packem_chunks/handler18.js +1 -1
  28. package/dist/packem_chunks/handler19.js +1 -1
  29. package/dist/packem_chunks/handler2.js +3 -3
  30. package/dist/packem_chunks/handler20.js +5 -5
  31. package/dist/packem_chunks/handler21.js +2 -2
  32. package/dist/packem_chunks/handler22.js +2 -2
  33. package/dist/packem_chunks/handler23.js +1 -1
  34. package/dist/packem_chunks/handler24.js +1 -1
  35. package/dist/packem_chunks/handler25.js +1 -5
  36. package/dist/packem_chunks/handler26.js +5 -1
  37. package/dist/packem_chunks/handler27.js +1 -3
  38. package/dist/packem_chunks/handler28.js +3 -1
  39. package/dist/packem_chunks/handler29.js +1 -7
  40. package/dist/packem_chunks/handler3.js +4 -4
  41. package/dist/packem_chunks/handler30.js +6 -32
  42. package/dist/packem_chunks/handler31.js +33 -3
  43. package/dist/packem_chunks/handler32.js +3 -8
  44. package/dist/packem_chunks/handler33.js +8 -1
  45. package/dist/packem_chunks/handler34.js +4 -5
  46. package/dist/packem_chunks/handler35.js +1 -11
  47. package/dist/packem_chunks/handler36.js +5 -3
  48. package/dist/packem_chunks/handler37.js +11 -22
  49. package/dist/packem_chunks/handler38.js +3 -61
  50. package/dist/packem_chunks/handler39.js +22 -3
  51. package/dist/packem_chunks/handler4.js +6 -6
  52. package/dist/packem_chunks/handler40.js +61 -6
  53. package/dist/packem_chunks/handler41.js +3 -24
  54. package/dist/packem_chunks/handler42.js +6 -25
  55. package/dist/packem_chunks/handler43.js +24 -153
  56. package/dist/packem_chunks/handler44.js +25 -10
  57. package/dist/packem_chunks/handler45.js +152 -707
  58. package/dist/packem_chunks/handler46.js +10 -24
  59. package/dist/packem_chunks/handler47.js +24 -322
  60. package/dist/packem_chunks/handler48.js +322 -48
  61. package/dist/packem_chunks/handler49.js +708 -3
  62. package/dist/packem_chunks/handler5.js +7 -7
  63. package/dist/packem_chunks/handler50.js +48 -27
  64. package/dist/packem_chunks/handler51.js +21 -189
  65. package/dist/packem_chunks/handler52.js +3 -34
  66. package/dist/packem_chunks/handler53.js +200 -0
  67. package/dist/packem_chunks/handler54.js +38 -0
  68. package/dist/packem_chunks/handler6.js +1 -1
  69. package/dist/packem_chunks/handler7.js +1 -1
  70. package/dist/packem_chunks/handler8.js +1 -1
  71. package/dist/packem_chunks/handler9.js +1 -1
  72. package/dist/packem_chunks/heal-accept.js +7 -7
  73. package/dist/packem_chunks/heal.js +11 -11
  74. package/dist/packem_chunks/help-command.js +30 -7
  75. package/dist/packem_chunks/index.js +6 -6
  76. package/dist/packem_chunks/keys-refresh.js +4 -4
  77. package/dist/packem_chunks/list.js +2 -2
  78. package/dist/packem_chunks/loader.js +4 -4
  79. package/dist/packem_chunks/loader2.js +1 -1
  80. package/dist/packem_chunks/prune.js +3 -3
  81. package/dist/packem_chunks/run.js +1 -1
  82. package/dist/packem_chunks/status.js +2 -2
  83. package/dist/packem_chunks/sync.js +2 -2
  84. package/dist/packem_chunks/sync2.js +2 -2
  85. package/dist/packem_chunks/tar.js +3 -3
  86. package/dist/packem_chunks/tripwire.js +2 -2
  87. package/dist/packem_chunks/verify-lockfile.js +2 -2
  88. package/dist/packem_shared/CONFIG_FILES-BfaR0jKT.js +1 -0
  89. package/dist/packem_shared/MultiSpinner-B9U0-aE3-B-gIXhFk.js +3 -0
  90. package/dist/packem_shared/Table-CcVkyULl-B_ef6zfS.js +35 -0
  91. package/dist/packem_shared/_commonjsHelpers-B5Y90VFO.js +1 -0
  92. package/dist/packem_shared/advisories-DLeO5KMN.js +1 -0
  93. package/dist/packem_shared/affected-shas-cVnX8-zs.js +1 -0
  94. package/dist/packem_shared/ai-analysis-DT3bU-_M.js +68 -0
  95. package/dist/packem_shared/ai-fix-BkNqd5nP.js +43 -0
  96. package/dist/packem_shared/build-scripts-CCCi8U66.js +1 -0
  97. package/dist/packem_shared/cyclonedx-86-DbHtf.js +4 -0
  98. package/dist/packem_shared/definePlugin-DoUcoYSy.js +1 -0
  99. package/dist/packem_shared/dependency-scan-BDTH898x.js +1 -0
  100. package/dist/packem_shared/docker-tNrDU3oK.js +59 -0
  101. package/dist/packem_shared/failure-log-Dwqt6_Ga.js +2 -0
  102. package/dist/packem_shared/giget-DHY1sQZC.js +2 -0
  103. package/dist/packem_shared/glob-fqg4KepW-B7EjLRvw.js +1 -0
  104. package/dist/packem_shared/index-BDmTbWX1.js +19 -0
  105. package/dist/packem_shared/index-C0Vj3XF8.js +30 -0
  106. package/dist/packem_shared/index-CB4p298r.js +1 -0
  107. package/dist/packem_shared/index-DMefdF51.js +1 -0
  108. package/dist/packem_shared/license-t5KnNX6v.js +1 -0
  109. package/dist/packem_shared/lifecycle-4z9hHE5b.js +2 -0
  110. package/dist/packem_shared/lockfile-C8Q1_4KK.js +1 -0
  111. package/dist/packem_shared/manifests-Dj3pRKBT.js +1 -0
  112. package/dist/packem_shared/min-release-age-D1alDE3K.js +34 -0
  113. package/dist/packem_shared/missing-package-json-41VUWFBY.js +1 -0
  114. package/dist/packem_shared/native-config-sync-BKAZ0NIs.js +21 -0
  115. package/dist/packem_shared/osv-bloom-B03tUWf3.js +2 -0
  116. package/dist/packem_shared/otelPlugin-DmKDBaPo.js +1 -0
  117. package/dist/packem_shared/peer-warnings-BXAzXqY3.js +1 -0
  118. package/dist/packem_shared/pm-runner-pVihAfxV.js +1 -0
  119. package/dist/packem_shared/provenance-DMuEftgc.js +1 -0
  120. package/dist/packem_shared/registry-keys-Bf2zzlcZ.js +1 -0
  121. package/dist/packem_shared/resolve-explicit-jH0RKyMJ.js +5 -0
  122. package/dist/packem_shared/runtime-check-Stc9AI78.js +1 -0
  123. package/dist/packem_shared/s1ngularity-BkfgC6NO.js +1 -0
  124. package/dist/packem_shared/scan-progress-JBbd9QeT.js +2 -0
  125. package/dist/packem_shared/selectors-GCJIe342.js +3 -0
  126. package/dist/packem_shared/signatures-D1H6h6GH.js +2 -0
  127. package/dist/packem_shared/spinner-BXSl864p.js +1 -0
  128. package/dist/packem_shared/subtree-C7bZuiSQ.js +2 -0
  129. package/dist/packem_shared/symbols-DPTlrJ3B.js +1 -0
  130. package/dist/packem_shared/tabs-BqUepRaD.js +1 -0
  131. package/dist/packem_shared/toolchain-pR7AJ-tB.js +5 -0
  132. package/dist/packem_shared/typosquats-C8qg1neE.js +1 -0
  133. package/dist/packem_shared/use-measured-height-BBJ9intr.js +1 -0
  134. package/dist/packem_shared/utils-Cxree603.js +1 -0
  135. package/dist/packem_shared/verify-Du7xZ2BJ.js +1 -0
  136. package/dist/packem_shared/vis-update-app-CTwRkNgj.js +1 -0
  137. package/dist/packem_shared/watch-BvIwLG4N.js +1 -0
  138. package/dist/packem_shared/watch-loop-DWkvv2tK.js +11 -0
  139. package/index.d.ts +201 -201
  140. package/index.js +751 -567
  141. package/package.json +16 -16
  142. package/schemas/vis-config.schema.json +4 -0
  143. package/dist/packem_shared/Table-3pFgIUZ2-DABgc6rj.js +0 -12
  144. package/dist/packem_shared/_commonjsHelpers-CLblCigl.js +0 -1
  145. package/dist/packem_shared/advisories-CGKZo9Rx.js +0 -1
  146. package/dist/packem_shared/affected-shas-BdnlfiV1.js +0 -1
  147. package/dist/packem_shared/ai-analysis-3QD_RS6F.js +0 -68
  148. package/dist/packem_shared/ai-fix-TsjDQz_0.js +0 -43
  149. package/dist/packem_shared/applyDefaults-BogleaFi.js +0 -1
  150. package/dist/packem_shared/build-scripts-DE6U8jVq.js +0 -1
  151. package/dist/packem_shared/cyclonedx-zf9R2jCs.js +0 -4
  152. package/dist/packem_shared/definePlugin-CWm4Dv_t.js +0 -1
  153. package/dist/packem_shared/dependency-scan-B70azq4x.js +0 -1
  154. package/dist/packem_shared/docker-EJiTY0Sz.js +0 -60
  155. package/dist/packem_shared/failure-log-Dxafk3t4.js +0 -2
  156. package/dist/packem_shared/giget-CcEy_Elm.js +0 -2
  157. package/dist/packem_shared/glob-D_7bct6p-D8itOHsr.js +0 -1
  158. package/dist/packem_shared/index-BpbjpCNL.js +0 -1
  159. package/dist/packem_shared/index-DH-5hsrC.js +0 -1
  160. package/dist/packem_shared/index-Dc3ht2bL.js +0 -30
  161. package/dist/packem_shared/license-zZU7aavK.js +0 -1
  162. package/dist/packem_shared/lifecycle-DvVTL8nx.js +0 -2
  163. package/dist/packem_shared/lockfile-CedmXr44.js +0 -1
  164. package/dist/packem_shared/lockfile-Cu2BH6bl.js +0 -1
  165. package/dist/packem_shared/manifests-BzWpKW8F.js +0 -1
  166. package/dist/packem_shared/min-release-age-DKMW2N_v.js +0 -34
  167. package/dist/packem_shared/missing-package-json-DKAwoiWK.js +0 -1
  168. package/dist/packem_shared/native-config-sync-DBkJ-hsF.js +0 -21
  169. package/dist/packem_shared/osv-bloom-0Vu8YRhg.js +0 -2
  170. package/dist/packem_shared/otelPlugin-CJR2T_lk.js +0 -1
  171. package/dist/packem_shared/peer-warnings-EvSJ18gE.js +0 -1
  172. package/dist/packem_shared/pm-runner-DmKT2FqF.js +0 -1
  173. package/dist/packem_shared/provenance-Cu6VR1Hy.js +0 -1
  174. package/dist/packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js +0 -1
  175. package/dist/packem_shared/registry-keys-CuBAVdsk.js +0 -1
  176. package/dist/packem_shared/resolve-explicit-Xue0oq8V.js +0 -5
  177. package/dist/packem_shared/runtime-check-CilFOqUU.js +0 -1
  178. package/dist/packem_shared/s1ngularity-adnHbyTd.js +0 -1
  179. package/dist/packem_shared/scan-progress-lZdk5KJ-.js +0 -2
  180. package/dist/packem_shared/selectors-DkgYFzdq.js +0 -3
  181. package/dist/packem_shared/signatures-FGbYV5QE.js +0 -2
  182. package/dist/packem_shared/spinner-0acw5pd_.js +0 -1
  183. package/dist/packem_shared/spinners-f91Rbo99-Bjf3NcO0.js +0 -1
  184. package/dist/packem_shared/symbols-CQmER5MT.js +0 -1
  185. package/dist/packem_shared/tabs-zUSdR1HI.js +0 -1
  186. package/dist/packem_shared/toolchain-DoG6b_G_.js +0 -5
  187. package/dist/packem_shared/typosquats-acxQ7blw.js +0 -1
  188. package/dist/packem_shared/use-measured-height-DyCBfLtu.js +0 -1
  189. package/dist/packem_shared/utils-DrNg0XTR.js +0 -1
  190. package/dist/packem_shared/verify-BYzxSKWD.js +0 -1
  191. package/dist/packem_shared/vis-update-app-D0QyGneK.js +0 -1
  192. package/dist/packem_shared/watch-DEL0yol9.js +0 -1
  193. package/dist/packem_shared/watch-loop-jmQQl2Qe.js +0 -11
@@ -0,0 +1 @@
1
+ const a=e=>e?Array.isArray(e)?e:[e]:[],o=e=>e instanceof Error?e.message:typeof e=="string"?e:String(e),p=e=>e.replace(/^\.\//,"").replace(/\/+$/,""),l=/[\u0000-\u001F\u007F ~^:?*[\\]/g,n=e=>{const r=e.replaceAll("@{","-").replaceAll("..","-").replaceAll(l,"-").replace(/\.lock$/i,"").replace(/^[./-]+/,"").replace(/[./-]+$/,"");return r.length>0?r:"split"},t=/^(.+?)(?:@(.+))?$/,v=e=>{if(e.startsWith("@")){const c=e.indexOf("/");if(c===-1)return{name:e,versionSpec:void 0};const s=e.slice(c+1),i=s.indexOf("@");return i===-1?{name:e,versionSpec:void 0}:{name:e.slice(0,c+1+i),versionSpec:s.slice(i+1)}}const r=t.exec(e);return r?{name:r[1]??e,versionSpec:r[2]}:{name:e,versionSpec:void 0}};export{o as c,v as f,a as i,n as l,p as o};
@@ -0,0 +1 @@
1
+ import{createRequire as g}from"node:module";import{m as i,f as a,v as d}from"./index-BDmTbWX1.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)],W=(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,W as v};
@@ -0,0 +1 @@
1
+ import{aD as de,a4 as e,a5 as l,g as r,aE as pe,B as he,aF as ge,aG as je,t as j,ae as me,aH as z,aI as ie}from"../packem_chunks/bin.js";import{o as fe}from"./spinner-BXSl864p.js";import{F as ye,a as we}from"./tabs-BqUepRaD.js";import{u as Ce}from"./use-measured-height-BBJ9intr.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),g=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(g)}),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,g=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:g,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))}%`:"",g=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:g,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:g,scrollOffset:o,selectedIndex:v,totalCatalogEntries:A,totalChecked:T,totalEntries:U,viewportHeight:B})=>{const L=f?"white":"gray",{measuredHeight:m,ref:S}=Ce(B,g);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(ge,{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}=je(),{columns:p,rows:g}=de(),o=j.useSyncExternalStore(h.subscribe,h.getSnapshot),[v,A]=j.useState(!1),[T,U]=j.useState(!1),B=j.useRef(null),L=j.useRef(null),m=j.useRef(null),S=j.useRef(null),[F,b]=j.useState(0),[I,E]=j.useState(!1),[C,D]=j.useState(!1),k=j.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=j.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,g-8-(o.filterActive?1:0)),[R,$]=j.useState(x),M=R>0?R:x,N=j.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(j.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||g<Le)return e.jsx(l,{alignItems:"center",height:g,justifyContent:"center",width:p,children:e.jsxs(r,{color:"yellow",children:["Terminal too small (",p,"x",g,")"]})});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:g,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(g*.55);return e.jsxs(l,{flexDirection:"column",height:g,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};
@@ -0,0 +1 @@
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};
@@ -0,0 +1,11 @@
1
+ import{createRequire as K}from"node:module";import{m as g,f as C,v as G,A as S,B as U,a as Q,H as X}from"./index-BDmTbWX1.js";import{aJ as w}from"../packem_chunks/bin.js";import{a as ee}from"../packem_chunks/config.js";import{s as le}from"./watch-BvIwLG4N.js";const H=K(import.meta.url),x=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=e=>{if(typeof x<"u"&&x.versions&&x.versions.node){const[t,s]=x.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return x.getBuiltinModule(e)}return H(e)},{createHash:m}=v("node:crypto"),{fileURLToPath:Y,pathToFileURL:Z}=v("node:url"),{spawnSync:te,spawn:se}=v("node:child_process"),{openSync:ne,writeSync:re,closeSync:oe,statSync:ie,readFileSync:N,mkdirSync:ae,writeFileSync:ce}=v("node:fs"),{availableParallelism:b}=v("node:os"),W=(e,t)=>{for(const s of["dependencies","devDependencies","optionalDependencies","peerDependencies"]){const n=e[s];if(n&&typeof n[t]=="string")return n[t]}},k=(e,t)=>{for(const s of t){const n=g(e,s);if(C(n))return n}},ue=e=>{const t=g(e,"package.json");if(!C(t))return{};try{return ee(t)}catch{return{}}},tt=(e,t)=>{const s=ue(e),n=new Map;for(const o of t){const r=o.detect(e,s);r&&n.set(o.id,r)}return n},de={error:"error",info:"info",information:"info",warning:"warning"},st={argsCheck:(e,t)=>j(e,t,!1),argsFix:(e,t)=>j(e,t,!0),bin:()=>["pnpm","exec","biome"],cacheKey:(e,t)=>{const s=["biome",e.declaredVersion??"unknown",e.configFile??"no-config",t.maxWarnings===void 0?"":`mw=${t.maxWarnings}`,t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:(e,t)=>{const s=W(t,w.biome.packageNames[0]),n=k(e,w.biome.configFiles);if(!(!s&&!n))return{adapter:"biome",configFile:n,declared:!!s,declaredVersion:s,root:e}},extensions:["astro","cjs","css","cts","js","json","jsonc","jsx","mjs","mts","svelte","ts","tsx","vue"],id:"biome",kind:"both",parse:(e,t)=>{if(!e.stdout.trim())return[];let s;try{s=JSON.parse(e.stdout)}catch{return[{adapter:"biome",file:t.root,fixable:!1,message:`biome output was not valid JSON (exit ${e.exitCode})`,severity:"error"}]}const n=[];for(const o of s.diagnostics??[]){const r=o.location?.start,i=o.location?.end,a=fe(t.root,o.location?.path),c=o.category??"",l=c==="format"||c.startsWith("format/");n.push({adapter:"biome",column:r?.column&&r.column>0?r.column:void 0,endColumn:i?.column&&i.column>0?i.column:void 0,endLine:i?.line&&i.line>0?i.line:void 0,file:a,fixable:!0,line:r?.line&&r.line>0?r.line:void 0,message:l?"Code style issues would be auto-fixed":o.message??"",ruleId:c||void 0,severity:de[o.severity??""]??"warning"})}return n}},j=(e,t,s)=>{const n=["check","--reporter=json"];return s&&n.push("--write"),typeof t.maxWarnings=="number"&&n.push(`--max-diagnostics=${String(t.maxWarnings)}`),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},fe=(e,t)=>{const s=typeof t=="string"?t:t?.file;return s?s.startsWith("/")||/^[a-z]:[\\/]/i.test(s)?s:g(e,s):e},B=e=>t=>{const s=k(t,w.deno.configFiles);if(s)return{adapter:e,configFile:s,declared:!1,root:t}},D=e=>e.startsWith("/")||/^[a-z]:[\\/]/i.test(e),nt={argsCheck:(e,t)=>F(e,t,!1),argsFix:(e,t)=>F(e,t,!0),bin:()=>["deno","lint"],cacheKey:(e,t)=>{const s=["deno-lint",e.configFile??"no-config",t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:B("deno-lint"),extensions:["js","jsx","mjs","mts","ts","tsx"],id:"deno-lint",kind:"lint",parse:(e,t)=>{if(!e.stdout.trim())return[];let s;try{s=JSON.parse(e.stdout)}catch{return[{adapter:"deno-lint",file:t.root,fixable:!1,message:`deno lint output was not valid JSON (exit ${e.exitCode})`,severity:"error"}]}const n=[];for(const o of s.diagnostics??[]){const r=o.range?.start,i=o.range?.end;n.push({adapter:"deno-lint",column:r?.col===void 0?void 0:r.col+1,endColumn:i?.col===void 0?void 0:i.col+1,endLine:i?.line===void 0?void 0:i.line+1,file:pe(o.filename??t.root,t.root),fixable:!1,line:r?.line===void 0?void 0:r.line+1,message:o.message??"",ruleId:o.code,severity:"warning"})}return n}},rt={argsCheck:(e,t)=>I(e,t,!1),argsFix:(e,t)=>I(e,t,!0),bin:()=>["deno","fmt"],cacheKey:(e,t)=>{const s=["deno-fmt",e.configFile??"no-config",t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:B("deno-fmt"),extensions:["astro","cjs","css","cts","html","ipynb","js","json","jsonc","jsx","less","md","mjs","mts","sass","scss","sql","svelte","ts","tsx","vue","yaml","yml"],id:"deno-fmt",kind:"fmt",parse:(e,t)=>{if(e.exitCode===0)return[];const s=[],n=new Set;for(const o of e.stdout.split(/\r?\n/)){const r=/^from (.+):$/.exec(o);if(!r)continue;const i=r[1];n.has(i)||(n.add(i),s.push({adapter:"deno-fmt",file:D(i)?i:`${t.root}/${i}`,fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"}))}return s}},F=(e,t,s)=>{const n=["--json"];return s&&n.push("--fix"),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},I=(e,t,s)=>{const n=[];return s||n.push("--check"),t.quiet&&n.push("--quiet"),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},pe=(e,t)=>e.startsWith("file://")?Y(e):D(e)?e:`${t}/${e}`,J="pyproject.toml",ge=/^\[tool\.ruff(?:\.[\w-]+)*\]\s*$/m,he=/^Would reformat:?\s+(.+)$/,me=e=>{const t=g(e,J);if(!C(t))return!1;try{const s=G(t);return ge.test(s)}catch{return!1}},E=e=>(t,s)=>{const n=w.ruff.packageNames.map(a=>W(s,a)).find(a=>a!==void 0),o=k(t,w.ruff.configFiles),r=o?void 0:me(t)?g(t,J):void 0,i=o??r;if(!(!n&&!i))return{adapter:e,configFile:i,declared:!!n,declaredVersion:n,root:t}},ye=e=>e.startsWith("/")||/^[a-z]:[\\/]/i.test(e),P=(e,t)=>e?ye(e)?e:g(t,e):t,xe=e=>he.exec(e)?.[1]?.trim(),ot={argsCheck:(e,t)=>L(e,t,!1),argsFix:(e,t)=>L(e,t,!0),bin:()=>["ruff","check"],cacheKey:(e,t)=>{const s=["ruff-check",e.declaredVersion??"unknown",e.configFile??"no-config",t.maxWarnings===void 0?"":`mw=${t.maxWarnings}`,t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:E("ruff-check"),extensions:["py","pyi"],id:"ruff-check",kind:"lint",parse:(e,t)=>{if(!e.stdout.trim())return[];let s;try{s=JSON.parse(e.stdout)}catch{return[{adapter:"ruff-check",file:t.root,fixable:!1,message:`ruff check output was not valid JSON (exit ${e.exitCode})`,severity:"error"}]}const n=[];for(const o of s){const r=o.location,i=o.end_location;n.push({adapter:"ruff-check",column:r?.column,endColumn:i?.column,endLine:i?.row,file:P(o.filename,t.root),fixable:!!o.fix,line:r?.row,message:o.message??"",ruleId:o.code,severity:"warning"})}return n}},it={argsCheck:(e,t)=>R(e,t,!1),argsFix:(e,t)=>R(e,t,!0),bin:()=>["ruff","format"],cacheKey:(e,t)=>{const s=["ruff-fmt",e.declaredVersion??"unknown",e.configFile??"no-config",t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:E("ruff-fmt"),extensions:["py","pyi"],id:"ruff-fmt",kind:"fmt",parse:(e,t)=>{if(e.exitCode===0)return[];const s=[],n=new Set;for(const o of e.stdout.split(/\r?\n/)){const r=xe(o);!r||n.has(r)||(n.add(r),s.push({adapter:"ruff-fmt",file:P(r,t.root),fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"}))}return s}},L=(e,t,s)=>{const n=["--output-format=json"];return s&&n.push("--fix"),t.quiet&&n.push("--quiet"),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},R=(e,t,s)=>{const n=[];return s||n.push("--check"),t.quiet&&n.push("--quiet"),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},at=(e,t)=>{const s=$(e,["diff","--name-only","--diff-filter=ACMR","-z",`${t}...HEAD`]);if(s===void 0)return;const n=$(e,["diff","--name-only","--diff-filter=ACMR","-z"]),o=$(e,["diff","--name-only","--diff-filter=ACMR","--cached","-z"]),r=$(e,["ls-files","--others","--exclude-standard","-z"]),i=new Set;for(const a of[s,n??"",o??"",r??""])for(const c of a.split("\0"))c.length!==0&&i.add(S(c)?c:g(e,c));return[...i].sort()},ct=e=>{const t=$(e,["diff","--name-only","--diff-filter=ACMR","--cached","-z"]);if(t===void 0)return;const s=new Set;for(const n of t.split("\0"))n.length!==0&&s.add(S(n)?n:g(e,n));return[...s].sort()},$=(e,t)=>{const s=te("git",[...t],{cwd:e,encoding:"utf8",timeout:1e4});if(s.status===0)return s.stdout},lt=(e,t)=>{const s=new Set(t.map(r=>r.toLowerCase())),n=[],o=new Set;for(const r of e){const i=r.lastIndexOf(".");if(i===-1||i===r.length-1)continue;const a=r.slice(i+1).toLowerCase();s.has(a)&&(o.has(r)||(o.add(r),n.push(r)))}return n},$e=new Set(["-","stdout"]),M=e=>({close:()=>{},write:t=>{e.write(t)}}),we=e=>{Q(X(e));const t=ne(e,"w");let s=[];return{close:()=>{s.length>0&&(re(t,s.join("")),s=[]),oe(t)},write:n=>{s.push(n)}}},ut=e=>{const{cwd:t,target:s}=e;if(s===void 0||$e.has(s))return M(process.stdout);if(s==="stderr")return M(process.stderr);const n=S(s)?s:U(t,s);return we(n)},q=["oxlint","oxfmt","biome","eslint","dprint","prettier","stylelint","ruff-check","ruff-fmt","markdownlint","shellcheck","deno-lint","deno-fmt"],dt=(e,t)=>{const s=new Map(e.map(i=>[i.id,i])),n=[],o=new Set,r=t&&t.length>0?t:q;for(const i of r){const a=s.get(i);a&&!o.has(i)&&(n.push(a),o.add(i))}if(t&&t.length>0)for(const i of q){const a=s.get(i);a&&!o.has(i)&&(n.push(a),o.add(i))}for(const i of e)o.has(i.id)||(n.push(i),o.add(i.id));return n},ft=(e,t,s)=>{const n=[];for(const o of t){const r=e.get(o.id);r&&ve(o.kind,s)&&n.push({adapter:o,presence:r})}return n},ve=(e,t)=>e===t||e==="both",pt=(e,t,s={})=>{const n=new Map;for(const o of e){const r=Se(o),i=Ae(r,t,s);if(!i)continue;const a=n.get(i);a?a.push(o):n.set(i,[o])}return n},Se=e=>{const t=e.lastIndexOf(".");return t===-1||t===e.length-1?"":e.slice(t+1).toLowerCase()},Ae=(e,t,s)=>{const n=s[e];if(n&&t.some(o=>o.adapter.id===n))return n;for(const{adapter:o}of t)if(o.extensions.includes(e))return o.id},Ce=e=>e==="error"?"error":e==="warning"?"warning":"notice",V=e=>e.replaceAll("%","%25").replaceAll("\r","%0D").replaceAll(`
2
+ `,"%0A"),T=e=>V(e).replaceAll(",","%2C").replaceAll(":","%3A").replaceAll("=","%3D"),ke=(e,t)=>t&&e.startsWith(`${t}/`)?e.slice(t.length+1):e,be=(e,t)=>e.file!==t.file?e.file<t.file?-1:1:(e.line??0)-(t.line??0)||(e.column??0)-(t.column??0),je=(e,t)=>{const s=Ce(e.severity),n=ke(e.file,t),o=e.ruleId?`${e.adapter}(${e.ruleId})`:e.adapter,r=[`file=${T(n)}`];return e.line!==void 0&&r.push(`line=${String(e.line)}`),e.endLine!==void 0&&r.push(`endLine=${String(e.endLine)}`),e.column!==void 0&&r.push(`col=${String(e.column)}`),e.endColumn!==void 0&&r.push(`endColumn=${String(e.endColumn)}`),r.push(`title=${T(o)}`),`::${s} ${r.join(",")}::${V(e.message)}
3
+ `},gt=e=>e.runs.flatMap(t=>[...t.findings]).sort(be).map(t=>je(t,e.workspaceRoot)).join(""),y=e=>e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;"),Fe=e=>`<![CDATA[${e.replaceAll("]]>","]]]]><![CDATA[>")}]]>`,Ie=(e,t)=>e.file!==t.file?e.file<t.file?-1:1:(e.line??0)-(t.line??0)||(e.column??0)-(t.column??0),Le=e=>e==="error"?"error":e==="warning"?"warning":"info",Re=(e,t)=>{let{file:s}=e;return t&&e.file.startsWith(`${t}/`)&&(s=e.file.slice(t.length+1)),e.line===void 0?s:e.column===void 0?`${s}:${String(e.line)}`:`${s}:${String(e.line)}:${String(e.column)}`},Me=(e,t,s)=>{const n=Re(e,s),o=Le(e.severity),r=e.ruleId?`[${e.ruleId}] ${e.message}`:e.message;return[` <testcase classname="${y(t)}" name="${y(n)}">`,` <failure type="${y(o)}" message="${y(r)}">${Fe(e.message)}</failure>`," </testcase>",""].join(`
4
+ `)},qe=(e,t,s)=>{const n=[...e.findings].sort(Ie),o=n.filter(l=>l.severity==="error").length,r=n.filter(l=>l.severity==="warning").length,i=n.length,a=(e.durationMs/1e3).toFixed(3),c=n.map(l=>Me(l,e.adapter,s)).join("");return` <testsuite ${[`name="${y(e.adapter)}"`,`tests="${String(i)}"`,`failures="${String(o)}"`,'errors="0"',`skipped="${String(r)}"`,`time="${a}"`,`timestamp="${t}"`].join(" ")}>
5
+ ${c} </testsuite>
6
+ `},ht=e=>{const t=(e.now??new Date).toISOString(),s=e.suiteName??"vis-lint-fmt",n=e.runs.map(c=>qe(c,t,e.workspaceRoot)).join(""),o=e.runs.reduce((c,l)=>c+l.findings.length,0),r=e.runs.reduce((c,l)=>c+l.findings.filter(p=>p.severity==="error").length,0),i=e.runs.reduce((c,l)=>c+l.findings.filter(p=>p.severity==="warning").length,0),a=(e.runs.reduce((c,l)=>c+l.durationMs,0)/1e3).toFixed(3);return`<?xml version="1.0" encoding="UTF-8"?>
7
+ <testsuites ${[`name="${y(s)}"`,`tests="${String(o)}"`,`failures="${String(r)}"`,'errors="0"',`skipped="${String(i)}"`,`time="${a}"`].join(" ")}>
8
+ ${n}</testsuites>
9
+ `},Te="2.1.0",Oe="https://json.schemastore.org/sarif-2.1.0.json",_e=e=>e==="error"?"error":e==="warning"?"warning":"note",Ne=(e,t)=>t&&e.startsWith(`${t}/`)?{uri:e.slice(t.length+1),uriBaseId:"SRCROOT"}:{uri:e},We=e=>{const{href:t}=Z(e);return t.endsWith("/")?t:`${t}/`},Be=(e,t)=>e.file!==t.file?e.file<t.file?-1:1:(e.line??0)-(t.line??0)||(e.column??0)-(t.column??0),De=e=>{const t=new Map;for(const s of e)s.ruleId&&(t.has(s.ruleId)||t.set(s.ruleId,{id:s.ruleId,name:s.ruleId}));return[...t.values()]},Je=(e,t)=>{const{uri:s,uriBaseId:n}=Ne(e.file,t),o={artifactLocation:n?{uri:s,uriBaseId:n}:{uri:s}};if(e.line!==void 0){const i={startLine:e.line};e.column!==void 0&&(i.startColumn=e.column),e.endLine!==void 0&&(i.endLine=e.endLine),e.endColumn!==void 0&&(i.endColumn=e.endColumn),o.region=i}const r={level:_e(e.severity),locations:[{physicalLocation:o}],message:{text:e.message}};return e.ruleId&&(r.ruleId=e.ruleId),r},Ee=(e,t)=>{const s=[...e.findings].sort(Be),n=De(s),o={name:e.adapter,rules:n};e.presence?.declaredVersion&&(o.version=e.presence.declaredVersion);const r={results:s.map(i=>Je(i,t)),tool:{driver:o}};return t&&(r.originalUriBaseIds={SRCROOT:{uri:We(t)}}),r},mt=e=>{const t={$schema:Oe,runs:e.runs.map(s=>Ee(s,e.workspaceRoot)),version:Te};return`${JSON.stringify(t,void 0,2)}
10
+ `},O={error:3,info:1,warning:2},yt=e=>{const t=[],s=[];let n,o=!1;for(const r of e){s.push({adapter:r.adapter,durationMs:r.durationMs,exitCode:r.exitCode,findingCount:r.findings.length}),r.exitCode!==0&&r.exitCode!==null&&r.findings.length===0&&(o=!0);for(const i of r.findings)t.push(i),(!n||O[i.severity]>O[n])&&(n=i.severity)}return{findings:t,hadProcessFailure:o,maxSeverity:n,runs:s}},xt=e=>{const t=new Map;for(const s of e){const n=t.get(s.file);n?n.push(s):t.set(s.file,[s])}return t},$t=e=>e.hadProcessFailure||e.maxSeverity==="error"?1:0,Pe=(e,t)=>{if(t==="fix"||process.env.VIS_NO_CACHE==="1"||e.length===0)return!1;for(const s of e)if(s==="."||s==="./"||s==="..")return!1;return!0},Ve=e=>{try{const t=N(e);return m("sha256").update(t).digest("hex")}catch{return}},ze=(e,t,s,n,o)=>{const r=e.cacheKey(t,n),i=[];for(const c of[...s].sort()){const l=S(c)?c:g(t.root,c);try{ie(l)}catch{return}const p=Ve(l);if(!p)return;i.push({hash:p,path:l})}const a=m("sha256");a.update(e.id),a.update("\0"),a.update(r),a.update("\0"),a.update(o);for(const c of i)a.update("\0"),a.update(c.path),a.update("\0"),a.update(c.hash);return{fileHashes:i,key:a.digest("hex")}},z=(e,t)=>g(e,"lint-fmt",t),Ke=(e,t,s)=>{const n=g(z(e,t.id),`${s}.json`);try{const o=N(n,"utf8"),r=JSON.parse(o);return r.schema!==1?void 0:r}catch{return}},He=(e,t,s,n,o)=>{const r=z(e,t.id),i={fileHashes:o,result:n,savedAt:Date.now(),schema:1};try{ae(r,{recursive:!0}),ce(g(r,`${s}.json`),JSON.stringify(i))}catch{}},_=async(e,t,s,n,o)=>{const r=e.bin(t),i=[...r.slice(1),...o==="fix"?e.argsFix(s,n):e.argsCheck(s,n)];return new Promise(a=>{const c=Date.now(),l=se(r[0],i,{cwd:t.root}),p=[],u=[];let h=!1;const f=setTimeout(()=>{h=!0,l.kill("SIGKILL")},6e4);l.stdout.on("data",d=>p.push(d)),l.stderr.on("data",d=>u.push(d)),l.on("error",d=>{clearTimeout(f),a({durationMs:Date.now()-c,exitCode:null,stderr:d.message,stdout:""})}),l.on("close",d=>{clearTimeout(f),a({durationMs:Date.now()-c,exitCode:h?null:d,stderr:Buffer.concat(u).toString("utf8"),stdout:Buffer.concat(p).toString("utf8")})})})},wt=async(e,t,s,n=b())=>{if(e.length===0)return[];const{cacheRoot:o,concurrency:r}=typeof n=="number"?{concurrency:n}:{cacheRoot:n.cacheRoot,concurrency:n.concurrency??b()},i=async u=>{const h=u.options??t;if(o&&Pe(u.files,s)){const f=ze(u.adapter,u.presence,u.files,h,s);if(f){const d=Ke(o,u.adapter,f.key);if(d)return d.result;const A=await _(u.adapter,u.presence,u.files,h,s);return A.exitCode!==null&&He(o,u.adapter,f.key,A,f.fileHashes),A}}return _(u.adapter,u.presence,u.files,h,s)};if(process.env.VIS_LINT_FMT_SERIAL==="1"){const u=[];for(const h of e)u.push(await i(h));return u}const a=Math.max(1,Math.min(r,e.length)),c=Array.from({length:e.length});let l=0;const p=async()=>{for(;;){const u=l;if(l+=1,u>=e.length)return;c[u]=await i(e[u])}};return await Promise.all(Array.from({length:a},()=>p())),c},Ge=e=>{const t=new Set;for(const s of e)t.add(s.toLowerCase());return t},Ue=(e,t)=>{const s=e.lastIndexOf(".");return s===-1||s===e.length-1?!1:t.has(e.slice(s+1).toLowerCase())},vt=async e=>{const{extensions:t,initialFiles:s,label:n,log:o,runCycle:r,workspaceRoot:i}=e,a=o??(f=>{process.stdout.write(`${f}
11
+ `)}),c=Ge(t);await r(s),a(`▸ ${n}: watching workspace — press Ctrl-C to exit`);let l=new Set,p=!1;const u=async()=>{for(;l.size>0;){const f=[...l];l=new Set;try{await r(f)}catch(d){a(`✗ ${n}: watch cycle failed — ${d.message}`)}}},h=le({debounceMs:200,filter:f=>Ue(f,c),onChange:async f=>{for(const d of f)l.add(S(d)?d:g(i,d));if(!p){p=!0;try{await u()}finally{p=!1}}},paths:[i]});await new Promise(f=>{const d=()=>{h.close(),process.off("SIGINT",d),process.off("SIGTERM",d),f()};process.once("SIGINT",d),process.once("SIGTERM",d)})};export{tt as a,ft as b,at as c,W as d,vt as e,k as f,pt as g,wt as h,yt as i,ut as j,mt as k,ht as l,gt as m,st as n,it as o,rt as p,xt as q,dt as r,ct as s,$t as t,lt as u,ot as v,nt as w};