@visulima/vis 1.0.0-alpha.39 → 1.0.0-alpha.40

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 (36) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/binx.js +1 -1
  4. package/dist/packem_chunks/bin.js +3 -3
  5. package/dist/packem_chunks/bloom-sync.js +1 -1
  6. package/dist/packem_chunks/fix.js +1 -1
  7. package/dist/packem_chunks/handler28.js +1 -1
  8. package/dist/packem_chunks/handler3.js +1 -1
  9. package/dist/packem_chunks/handler4.js +3 -3
  10. package/dist/packem_chunks/handler49.js +3 -3
  11. package/dist/packem_chunks/handler5.js +6 -6
  12. package/dist/packem_chunks/handler63.js +1 -1
  13. package/dist/packem_chunks/handler64.js +1 -1
  14. package/dist/packem_chunks/handler65.js +4 -4
  15. package/dist/packem_chunks/handler66.js +1 -1
  16. package/dist/packem_chunks/handler68.js +1 -1
  17. package/dist/packem_chunks/handler7.js +1 -1
  18. package/dist/packem_chunks/handler70.js +1 -1
  19. package/dist/packem_chunks/handler71.js +44 -44
  20. package/dist/packem_chunks/handler73.js +1 -1
  21. package/dist/packem_chunks/handler74.js +1 -1
  22. package/dist/packem_chunks/heal.js +1 -1
  23. package/dist/packem_chunks/help-command.js +1 -1
  24. package/dist/packem_chunks/sync.js +1 -1
  25. package/dist/packem_chunks/verify-lockfile.js +1 -1
  26. package/dist/packem_shared/{ai-analysis-K-DKU3ZA.js → ai-analysis-BUeX2J2H.js} +1 -1
  27. package/dist/packem_shared/{ai-fix-BPrYoCk8.js → ai-fix-9Vzlp6XU.js} +1 -1
  28. package/dist/packem_shared/{dependency-scan-anTuZB1t.js → dependency-scan-DnTgYleU.js} +1 -1
  29. package/dist/packem_shared/{index-BJbpNthk.js → index-Du8RWawQ.js} +1 -1
  30. package/dist/packem_shared/{index-B4RYu87L.js → index-yBikBkHT.js} +1 -1
  31. package/dist/packem_shared/{missing-package-json-BfWUxTGv.js → missing-package-json-8vNHwbqw.js} +1 -1
  32. package/dist/packem_shared/scan-progress-CFhc0CMj.js +2 -0
  33. package/index.d.ts +201 -201
  34. package/index.js +52 -52
  35. package/package.json +9 -9
  36. package/dist/packem_shared/scan-progress-DG7_JmTV.js +0 -2
@@ -1,6 +1,6 @@
1
- import{createRequire as b}from"node:module";import{h as _,k as O,d as j}from"./bin.js";import{w as E}from"../packem_shared/pm-runner-OGResYrA.js";import{l as R}from"../packem_shared/dependency-scan-anTuZB1t.js";import{r as I}from"../packem_shared/provenance-_CJjMKwu.js";import{r as P}from"../packem_shared/signatures-C730vkyK.js";import{loadOptionalSigstore as C}from"./loader.js";const N=b(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=r=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[o,t]=u.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return u.getBuiltinModule(r)}return N(r)},{createHash:S}=$("node:crypto"),{isAbsolute:k,resolve:y,basename:v}=$("node:path"),T=r=>(r??"").split(",").map(o=>o.trim()).filter(o=>o.length>0),K=async({logger:r,options:o,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=o.format??"table",c=o.prodOnly??!1,p=o.failOn==="error"?"error":"warning",l=T(o.allowlist),a=E(t),d=R(t,a.name,{includeDev:!c}).map(({name:e,version:n})=>({name:e,version:n})),[m,g]=await Promise.all([I(d,{allowlist:l,workspaceRoot:t}),P(d,{allowlist:l,workspaceRoot:t})]),s=[...m.map(e=>({code:"provenance-regression",message:`Resolved ${e.packageName}@${e.version} has no published provenance attestation, but ${e.packageName}@${e.priorVersionWithProvenance} did — a provenance regression.`,packageName:e.packageName,severity:"warning",version:e.version})),...g.map(e=>({code:e.code,message:e.message,packageName:e.packageName,severity:e.severity,version:e.version}))],f=s.filter(e=>p==="error"?e.severity==="error":!0);if(i==="json")process.stdout.write(`${JSON.stringify({findings:s,ok:f.length===0},void 0,2)}
1
+ import{createRequire as b}from"node:module";import{h as _,d as O,e as j}from"./bin.js";import{w as R}from"../packem_shared/pm-runner-OGResYrA.js";import{l as E}from"../packem_shared/dependency-scan-DnTgYleU.js";import{r as I}from"../packem_shared/provenance-_CJjMKwu.js";import{r as P}from"../packem_shared/signatures-C730vkyK.js";import{loadOptionalSigstore as C}from"./loader.js";const N=b(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=r=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[o,t]=u.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return u.getBuiltinModule(r)}return N(r)},{createHash:S}=$("node:crypto"),{isAbsolute:y,resolve:k,basename:v}=$("node:path"),T=r=>(r??"").split(",").map(o=>o.trim()).filter(o=>o.length>0),K=async({logger:r,options:o,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=o.format??"table",c=o.prodOnly??!1,p=o.failOn==="error"?"error":"warning",l=T(o.allowlist),a=R(t),d=E(t,a.name,{includeDev:!c}).map(({name:e,version:n})=>({name:e,version:n})),[m,g]=await Promise.all([I(d,{allowlist:l,workspaceRoot:t}),P(d,{allowlist:l,workspaceRoot:t})]),s=[...m.map(e=>({code:"provenance-regression",message:`Resolved ${e.packageName}@${e.version} has no published provenance attestation, but ${e.packageName}@${e.priorVersionWithProvenance} did — a provenance regression.`,packageName:e.packageName,severity:"warning",version:e.version})),...g.map(e=>({code:e.code,message:e.message,packageName:e.packageName,severity:e.severity,version:e.version}))],f=s.filter(e=>p==="error"?e.severity==="error":!0);if(i==="json")process.stdout.write(`${JSON.stringify({findings:s,ok:f.length===0},void 0,2)}
2
2
  `);else if(i==="ndjson")for(const e of s)process.stdout.write(`${JSON.stringify(e)}
3
- `);else if(s.length===0)r.info(`No provenance regressions or signature problems across ${String(d.length)} locked packages.`);else{const e=process.stdout.columns||80;r.info(_(O.createElement(j,{data:s.map(n=>({code:n.code,package:`${n.packageName}@${n.version}`,severity:n.severity}))}),{columns:e}));for(const n of s)r.warn(`${n.packageName}@${n.version}: ${n.message}`)}f.length>0&&(process.exitCode=1)},D=()=>process.env.CI==="true"||typeof process.env.ACTIONS_ID_TOKEN_REQUEST_URL=="string"||typeof process.env.SIGSTORE_ID_TOKEN=="string",q=(r,o,t)=>({_type:"https://in-toto.io/Statement/v1",predicate:{buildDefinition:{buildType:"https://visulima.com/vis/attest/v1",externalParameters:{workspaceRoot:t},internalParameters:{},resolvedDependencies:[]},runDetails:{builder:{id:"https://visulima.com/vis"},metadata:{invocationId:process.env.GITHUB_RUN_ID??"",startedOn:new Date().toISOString()}}},predicateType:"https://slsa.dev/provenance/v1",subject:[{digest:{sha256:o},name:r}]}),G=async({argument:r,fs:o,logger:t,options:i,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const p=r[0];if(!p)throw new Error("Missing subject. Usage: vis attest <path-to-artifact>");const l=i.predicate??"slsaProvenance";if(l!=="slsaProvenance")throw new Error(`Unsupported predicate '${l}'. Only 'slsaProvenance' is supported.`);const a=k(p)?p:y(c,p),d=i.requireSigning??!1,m=i.format??"table";let g;try{g=await o.readFile(a)}catch{throw new Error(`Cannot read subject artifact at ${a}.`)}const s=S("sha256").update(g).digest("hex");if(!D()){const h="No ambient OIDC token (not running in CI). Keyless signing needs a Fulcio identity from CI OIDC.";if(d)throw new Error(`${h} Re-run in CI or drop --require-signing.`);if(m==="json"){process.stdout.write(`${JSON.stringify({ok:!1,reason:"no-ambient-oidc",sha256:s,skipped:!0,subject:v(a)},void 0,2)}
4
- `);return}t.warn(`${h} Skipping signing (subject sha256: ${s}). Pass --require-signing to make this fatal.`);return}const f=q(v(a),s,c),e=Buffer.from(JSON.stringify(f)),n=await(await C({workspaceRoot:c})).attest(e,"application/vnd.in-toto+json"),w=i.output?k(i.output)?i.output:y(c,i.output):`${a}.sigstore`;if(await o.writeFile(w,`${JSON.stringify(n,void 0,2)}
3
+ `);else if(s.length===0)r.info(`No provenance regressions or signature problems across ${String(d.length)} locked packages.`);else{const e=process.stdout.columns||80;r.info(_(O.createElement(j,{data:s.map(n=>({code:n.code,package:`${n.packageName}@${n.version}`,severity:n.severity}))}),{columns:e}));for(const n of s)r.warn(`${n.packageName}@${n.version}: ${n.message}`)}f.length>0&&(process.exitCode=1)},D=()=>process.env.CI==="true"||typeof process.env.ACTIONS_ID_TOKEN_REQUEST_URL=="string"||typeof process.env.SIGSTORE_ID_TOKEN=="string",q=(r,o,t)=>({_type:"https://in-toto.io/Statement/v1",predicate:{buildDefinition:{buildType:"https://visulima.com/vis/attest/v1",externalParameters:{workspaceRoot:t},internalParameters:{},resolvedDependencies:[]},runDetails:{builder:{id:"https://visulima.com/vis"},metadata:{invocationId:process.env.GITHUB_RUN_ID??"",startedOn:new Date().toISOString()}}},predicateType:"https://slsa.dev/provenance/v1",subject:[{digest:{sha256:o},name:r}]}),G=async({argument:r,fs:o,logger:t,options:i,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const p=r[0];if(!p)throw new Error("Missing subject. Usage: vis attest <path-to-artifact>");const l=i.predicate??"slsaProvenance";if(l!=="slsaProvenance")throw new Error(`Unsupported predicate '${l}'. Only 'slsaProvenance' is supported.`);const a=y(p)?p:k(c,p),d=i.requireSigning??!1,m=i.format??"table";let g;try{g=await o.readFile(a)}catch{throw new Error(`Cannot read subject artifact at ${a}.`)}const s=S("sha256").update(g).digest("hex");if(!D()){const h="No ambient OIDC token (not running in CI). Keyless signing needs a Fulcio identity from CI OIDC.";if(d)throw new Error(`${h} Re-run in CI or drop --require-signing.`);if(m==="json"){process.stdout.write(`${JSON.stringify({ok:!1,reason:"no-ambient-oidc",sha256:s,skipped:!0,subject:v(a)},void 0,2)}
4
+ `);return}t.warn(`${h} Skipping signing (subject sha256: ${s}). Pass --require-signing to make this fatal.`);return}const f=q(v(a),s,c),e=Buffer.from(JSON.stringify(f)),n=await(await C({workspaceRoot:c})).attest(e,"application/vnd.in-toto+json"),w=i.output?y(i.output)?i.output:k(c,i.output):`${a}.sigstore`;if(await o.writeFile(w,`${JSON.stringify(n,void 0,2)}
5
5
  `,"utf8"),m==="json"){process.stdout.write(`${JSON.stringify({bundle:w,ok:!0,sha256:s,subject:v(a)},void 0,2)}
6
6
  `);return}t.info(`Signed SLSA v1 provenance for ${v(a)} (sha256 ${s.slice(0,16)}…).`),t.info(`Bundle written to ${w}.`)};export{G as attestEmitExecute,K as attestVerifyExecute};
@@ -1,7 +1,7 @@
1
- import{createRequire as $}from"node:module";import{N as y,R as l,S as d,h as b}from"../packem_shared/ai-analysis-K-DKU3ZA.js";import{h as x,k as w,d as _}from"./bin.js";import{j as S,E as p,q as j,I as E,s as I}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";const C=$(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const u={command:"ai",description:"AI-assisted commands: provider detection, cache management, and failure-fix proposals."},N=e=>{if(typeof e!="function")return String(e);const{name:t}=e;return t==="Boolean"?"boolean":t==="Number"?"number":t==="String"?"string":t??"unknown"},R=e=>{const t=[...e.commandPath??[],e.name].join(" "),i=(e.examples??[]).map(([o,r])=>({command:o??"",description:r??""})),n=(e.options??[]).map(o=>({defaultValue:o.defaultValue,description:o.description,name:o.name,type:N(o.type)}));return{argument:e.argument?{description:e.argument.description,name:e.argument.name}:void 0,description:e.description??"",examples:i,name:e.name,options:n,path:t}},f=(e,t=u)=>({command:t.command,description:t.description,subcommands:e.map(i=>R(i))}),P=(e,t=u)=>`${JSON.stringify(f(e,t),void 0,2)}
1
+ import{createRequire as $}from"node:module";import{N as y,R as l,S as d,h as b}from"../packem_shared/ai-analysis-BUeX2J2H.js";import{h as x,d as w,e as _}from"./bin.js";import{j as S,E as p,q as j,I as E,s as I}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";const C=$(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const u={command:"ai",description:"AI-assisted commands: provider detection, cache management, and failure-fix proposals."},N=e=>{if(typeof e!="function")return String(e);const{name:t}=e;return t==="Boolean"?"boolean":t==="Number"?"number":t==="String"?"string":t??"unknown"},R=e=>{const t=[...e.commandPath??[],e.name].join(" "),i=(e.examples??[]).map(([o,r])=>({command:o??"",description:r??""})),n=(e.options??[]).map(o=>({defaultValue:o.defaultValue,description:o.description,name:o.name,type:N(o.type)}));return{argument:e.argument?{description:e.argument.description,name:e.argument.name}:void 0,description:e.description??"",examples:i,name:e.name,options:n,path:t}},f=(e,t=u)=>({command:t.command,description:t.description,subcommands:e.map(i=>R(i))}),P=(e,t=u)=>`${JSON.stringify(f(e,t),void 0,2)}
2
2
  `,T=(e,t=u)=>{const i=f(e,t),n=[S(`vis ${i.command} — ${i.description}`),"",p("Subcommands:")];for(const o of i.subcommands){const r=o.argument?` ${j(`<${o.argument.name}>`)}`:"";if(n.push(""),n.push(` ${E(`vis ${o.path}`)}${r}`),o.description&&n.push(` ${o.description}`),o.options.length>0){const s=o.options.map(c=>`--${c.name}${c.type==="boolean"?"":`=<${c.type}>`}`).join(", ");n.push(p(` options: ${s}`))}if(o.examples.length>0){n.push(p(" examples:"));for(const s of o.examples){const c=s.description?p(` — ${s.description}`):"";n.push(` ${I(s.command)}${c}`)}}}return n.push(""),n.push(p(`Run \`vis ${i.command} discover-help\` for the machine-readable JSON catalogue (designed for AI agents).`)),n.push(p(`Run \`vis ${i.command} <subcommand> --help\` for full usage of a specific subcommand.`)),`${n.join(`
3
3
  `)}
4
- `},h=async()=>{const{default:e}=await import("./bin.js").then(t=>t.bw);return e.filter(t=>t.name!=="ai")},O=async()=>{const e=await h();process.stderr.write(T(e))},B=async()=>{const e=await h();process.stdout.write(P(e))},k=async({logger:e,visConfig:t})=>{const i=t?.ai,n=l(i);if(!n){e.error("No AI provider available to test."),process.exitCode=1;return}e.info(`Testing ${n.name}...`);try{const o=await b(n,"Reply with exactly: OK",{timeoutMs:3e4});e.info(`Provider ${n.name} responded: ${o.stdout.trim().slice(0,200)}`)}catch(o){const r=o instanceof Error?o.message:String(o);e.error(`Provider ${n.name} failed: ${r}`),process.exitCode=1}},F=({logger:e,options:t,visConfig:i})=>{const n=t.format??"table",o=i?.ai,r=y(),s=l(o);if(n==="json"){const a=r.map(m=>({available:m.available,method:m.detectionMethod,name:m.name,path:m.path,priority:d[m.name]??0,selected:m.name===s?.name,version:m.version}));process.stdout.write(`${JSON.stringify(a,void 0,2)}
4
+ `},h=async()=>{const{default:e}=await import("./bin.js").then(t=>t.bw);return e.filter(t=>t.name!=="ai")},O=async()=>{const e=await h();process.stderr.write(T(e))},B=async()=>{const e=await h();process.stdout.write(P(e))},F=async({logger:e,visConfig:t})=>{const i=t?.ai,n=l(i);if(!n){e.error("No AI provider available to test."),process.exitCode=1;return}e.info(`Testing ${n.name}...`);try{const o=await b(n,"Reply with exactly: OK",{timeoutMs:3e4});e.info(`Provider ${n.name} responded: ${o.stdout.trim().slice(0,200)}`)}catch(o){const r=o instanceof Error?o.message:String(o);e.error(`Provider ${n.name} failed: ${r}`),process.exitCode=1}},V=({logger:e,options:t,visConfig:i})=>{const n=t.format??"table",o=i?.ai,r=y(),s=l(o);if(n==="json"){const a=r.map(m=>({available:m.available,method:m.detectionMethod,name:m.name,path:m.path,priority:d[m.name]??0,selected:m.name===s?.name,version:m.version}));process.stdout.write(`${JSON.stringify(a,void 0,2)}
5
5
  `);return}const c=r.map(a=>({method:a.detectionMethod??"-",path:a.path??"-",priority:String(d[a.name]??0),provider:a.name,selected:a.name===s?.name?">>>":"",status:a.available?"available":"not found",version:a.version??"-"})),g=process.stdout.columns||80,v=x(w.createElement(_,{data:c}),{columns:g});e.info(v),s?e.info(`
6
6
  Selected provider: ${s.name} (priority ${String(d[s.name]??0)})`):e.info(`
7
- No AI provider available. Install one of the supported AI CLI tools.`)},V=async e=>{const{aiFix:t}=await import("./fix.js");await t(e)};export{B as aiDiscoverHelpExecute,V as aiFixExecute,F as aiProvidersExecute,O as aiRootExecute,k as aiTestExecute};
7
+ No AI provider available. Install one of the supported AI CLI tools.`)},k=async e=>{const{aiFix:t}=await import("./fix.js");await t(e)};export{B as aiDiscoverHelpExecute,k as aiFixExecute,V as aiProvidersExecute,O as aiRootExecute,F as aiTestExecute};
@@ -1,8 +1,8 @@
1
- import{createRequire as A}from"node:module";import{w as G,i as H,p,P as J,j as V,R as W,l as S,c as K,V as Z,$ as T,k as a,h as Q,m as g,H as M,o as X,G as ee,r as te,B as oe,F as m}from"./bin.js";import"../packem_shared/index-BDmTbWX1.js";import"../packem_shared/public-api-WqUCiyIe.js";import{K as se,Z as re,W as ne}from"../packem_shared/ai-analysis-K-DKU3ZA.js";import{w as ie}from"../packem_shared/pm-runner-OGResYrA.js";import{U as ae,b as ce,u as N}from"../packem_shared/vis-update-app-k3fDxech.js";const ue=A(import.meta.url),de=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const $e=async({argument:E,logger:o,options:e,visConfig:i,workspaceRoot:C})=>{if(!C)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const u=C;if(e.securityConfig){const t=ie(u);if(G(i??{},t.name),e.sync&&t.name==="pnpm"){const s=H(i??{});if(s.length>0){p.info(`
2
- Settings that would sync to pnpm-workspace.yaml:`);for(const R of s)p.success(` ${R}`)}else p.info("No security settings to sync.")}else e.sync&&t.name!=="pnpm"&&(p.info(`--sync is only available for pnpm projects. Your project uses ${t.name}.`),p.info("vis enforces security settings at the vis layer for non-pnpm projects."));if(!e.security&&!E?.length)return}const{packageManager:U}=J(u),B=V(u),c=i?.update??{},y=W(u,U,{dev:e.dev,includeInternal:e["include-internal"],peer:e.peer,prod:e.prod});if(y.size===0){o.info("No catalogs found.");return}const h=e.target??c.target??"latest";if(!["latest","minor","patch"].includes(h))throw new Error(`Invalid target "${h}". Use: latest, minor, or patch.`);const D={exclude:[...m(e.exclude),...m(c.exclude)],ignore:m(c.ignore),include:[...m(e.include),...m(c.include),...E],includeLocked:!!e.includeLocked,includePrerelease:e.prerelease||c.prerelease||!1,security:e.security!==!1,target:h};let j=0;for(const t of y.values())j+=t.size;const $=!!process.stdout.isTTY&&!te;let l;const F=$?(t,s)=>{l?l.rerender(a.createElement(N,{current:t,total:s})):l=T(a.createElement(N,{current:t,total:s}),{interactive:!0,patchConsole:!1})}:(t,s)=>{o.info(`Checking ${String(t)}/${String(s)} dependencies...`)};$||o.info(`Checking ${String(j)} catalog dependencies against npm registry...
3
- `);const w=new Set;S("socket")&&w.add("socket"),S("depsDev")&&w.add("deps-dev");const v=i?.security?.policies?.score?.minimum,I=K(i?.security,{disabled:w,minimumScore:v}),{failed:k,outdated:n}=await Z(y,D,B,F,u,I,i?.security?.acceptedRisks);if(l&&(l.clear(),l.unmount()),k.length>0&&o.warn(`Failed to fetch: ${k.join(", ")}`),n.length===0){o.info("All catalog dependencies are up to date.");return}const b=e.format??c.format??"table",P=se(e.aiType??"impact"),d=e.ai?await re(n,o,i?.ai,P):void 0;if($&&b==="table"){const t=new ae(n,d??null),s=i?.tui?.autoExit??!1,R=s===!0?3:typeof s=="number"?s:0;await T(a.createElement(ce,{autoExitSeconds:R,isDryRun:!0,store:t}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit();const q=process.stdout.columns||80;process.stdout.write(`
1
+ import{createRequire as A}from"node:module";import{w as G,k as H,p,P as J,j as V,R as W,l as S,c as K,V as Z,$ as T,d as a,h as Q,m as g,H as M,o as X,G as ee,r as te,B as oe,F as m}from"./bin.js";import"../packem_shared/index-BDmTbWX1.js";import"../packem_shared/public-api-WqUCiyIe.js";import{K as se,Z as re,W as ne}from"../packem_shared/ai-analysis-BUeX2J2H.js";import{w as ie}from"../packem_shared/pm-runner-OGResYrA.js";import{U as ae,b as ce,u as N}from"../packem_shared/vis-update-app-k3fDxech.js";const de=A(import.meta.url),ue=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const $e=async({argument:E,logger:o,options:e,visConfig:i,workspaceRoot:C})=>{if(!C)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const d=C;if(e.securityConfig){const t=ie(d);if(G(i??{},t.name),e.sync&&t.name==="pnpm"){const s=H(i??{});if(s.length>0){p.info(`
2
+ Settings that would sync to pnpm-workspace.yaml:`);for(const b of s)p.success(` ${b}`)}else p.info("No security settings to sync.")}else e.sync&&t.name!=="pnpm"&&(p.info(`--sync is only available for pnpm projects. Your project uses ${t.name}.`),p.info("vis enforces security settings at the vis layer for non-pnpm projects."));if(!e.security&&!E?.length)return}const{packageManager:U}=J(d),B=V(d),c=i?.update??{},y=W(d,U,{dev:e.dev,includeInternal:e["include-internal"],peer:e.peer,prod:e.prod});if(y.size===0){o.info("No catalogs found.");return}const h=e.target??c.target??"latest";if(!["latest","minor","patch"].includes(h))throw new Error(`Invalid target "${h}". Use: latest, minor, or patch.`);const D={exclude:[...m(e.exclude),...m(c.exclude)],ignore:m(c.ignore),include:[...m(e.include),...m(c.include),...E],includeLocked:!!e.includeLocked,includePrerelease:e.prerelease||c.prerelease||!1,security:e.security!==!1,target:h};let j=0;for(const t of y.values())j+=t.size;const $=!!process.stdout.isTTY&&!te;let l;const F=$?(t,s)=>{l?l.rerender(a.createElement(N,{current:t,total:s})):l=T(a.createElement(N,{current:t,total:s}),{interactive:!0,patchConsole:!1})}:(t,s)=>{o.info(`Checking ${String(t)}/${String(s)} dependencies...`)};$||o.info(`Checking ${String(j)} catalog dependencies against npm registry...
3
+ `);const w=new Set;S("socket")&&w.add("socket"),S("depsDev")&&w.add("deps-dev");const v=i?.security?.policies?.score?.minimum,I=K(i?.security,{disabled:w,minimumScore:v}),{failed:k,outdated:n}=await Z(y,D,B,F,d,I,i?.security?.acceptedRisks);if(l&&(l.clear(),l.unmount()),k.length>0&&o.warn(`Failed to fetch: ${k.join(", ")}`),n.length===0){o.info("All catalog dependencies are up to date.");return}const R=e.format??c.format??"table",P=se(e.aiType??"impact"),u=e.ai?await re(n,o,i?.ai,P):void 0;if($&&R==="table"){const t=new ae(n,u??null),s=i?.tui?.autoExit??!1,b=s===!0?3:typeof s=="number"?s:0;await T(a.createElement(ce,{autoExitSeconds:b,isDryRun:!0,store:t}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit();const q=process.stdout.columns||80;process.stdout.write(`
4
4
  `);for(const r of n){const z=r.vulnerabilities?.length||r.socketReport&&r.socketReport.alerts.length>0,_=!!r.acceptedRisk,L=z?_?"✓":"⚠":"✓",O=_?"gray":r.updateType==="major"?"red":r.updateType==="minor"?"yellow":"green",f=r.socketReport?.score.overall,Y=f===void 0?"":` [${String(Math.round(f*100))}%]`,x=f===void 0?void 0:oe(f);process.stdout.write(`${Q(a.createElement(g,null," ",a.createElement(g,{color:O},L),` ${r.packageName} ${r.currentRange} → ${r.newRange}`,a.createElement(g,{dimColor:!0},` ${r.updateType}`),x?a.createElement(g,{color:x},Y):null),{columns:q})}
5
5
  `)}process.stdout.write(`
6
- `),o.info(M(n,v))}else if(b==="json"){const t={failed:k,outdated:n};d&&(t.aiAnalysis=d),process.stdout.write(`${JSON.stringify(t,void 0,2)}
7
- `)}else b==="minimal"?process.stdout.write(`${X(n)}
8
- `):(ee(n,o),o.info(M(n,v)),d&&(o.info(""),o.info(ne(d))));e.exitCode&&n.length>0&&(process.exitCode=1)};export{$e as default};
6
+ `),o.info(M(n,v))}else if(R==="json"){const t={failed:k,outdated:n};u&&(t.aiAnalysis=u),process.stdout.write(`${JSON.stringify(t,void 0,2)}
7
+ `)}else R==="minimal"?process.stdout.write(`${X(n)}
8
+ `):(ee(n,o),o.info(M(n,v)),u&&(o.info(""),o.info(ne(u))));e.exitCode&&n.length>0&&(process.exitCode=1)};export{$e as default};
@@ -1,4 +1,4 @@
1
- import{createRequire as z}from"node:module";import{y as L,v as _,m as P,f as M,J as V,B as Y}from"../packem_shared/index-BDmTbWX1.js";import{a4 as t,a5 as a,m as c,aE as K,aF as Q,aG as U,aD as Z,s as v,ae as ee,p as k,r as re,$ as te,k as se,t as ne,aN as oe,aO as ie,aP as le,e as ce,W as N}from"./bin.js";import ae from"./index.js";import{sortPackageJsonStringWithOptions as q}from"#native";import{c as O}from"../packem_shared/utils-Cxree603.js";const Ke=z(import.meta.url),Qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const D={error:0,rewritten:1,"would-rewrite":1,unchanged:2},de=e=>[...e].sort((r,s)=>D[r.status]-D[s.status]),ue=(e,r)=>r==="all"?e:r==="errors"?e.filter(s=>s.status==="error"):r==="rewritten"?e.filter(s=>s.status==="rewritten"||s.status==="would-rewrite"):e.filter(s=>s.status==="unchanged");class fe{#e;#r=new Set;constructor(r){this.#e={entries:de(r),filterType:"all",focusedPanel:"list",selectedIndex:0}}getSnapshot=()=>this.#e;subscribe=r=>(this.#r.add(r),()=>{this.#r.delete(r)});getFilteredEntries=()=>ue(this.#e.entries,this.#e.filterType);#t(){this.#e={...this.#e};for(const r of this.#r)r()}select(r){const s=this.getFilteredEntries();this.#e.selectedIndex=s.length===0?-1:Math.max(0,Math.min(r,s.length-1)),this.#t()}selectStep(r){this.select(this.#e.selectedIndex+r)}setFilter(r){this.#e.filterType=r,this.#e.selectedIndex=0,this.#t()}setFocusedPanel(r){this.#e.focusedPanel=r,this.#t()}}const he=({checkMode:e,entry:r,focused:s,scrollRef:l})=>{const i=s?"white":"gray";return r?t.jsxs(a,{borderColor:i,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsx(a,{flexShrink:0,paddingTop:1,paddingX:2,children:t.jsx(c,{bold:!0,color:"white",children:r.relativePath})}),t.jsxs(K,{flexGrow:1,flexShrink:1,paddingX:2,ref:l,scrollbar:!0,scrollbarColor:"gray",children:[t.jsx(c,{}),t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Status:"})}),r.status==="error"?t.jsx(c,{bold:!0,color:"red",children:"error"}):r.status==="unchanged"?t.jsx(c,{bold:!0,color:"green",children:"already sorted"}):r.status==="rewritten"?t.jsx(c,{bold:!0,color:"yellow",children:"rewritten"}):t.jsx(c,{bold:!0,color:"yellow",children:"would rewrite (--check)"})]}),t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Path:"})}),t.jsx(c,{children:r.filePath})]}),r.error?t.jsxs(t.Fragment,{children:[t.jsxs(a,{flexDirection:"column",marginTop:1,children:[t.jsx(c,{dimColor:!0,children:"── "}),t.jsx(c,{bold:!0,color:"red",children:"ERROR"}),t.jsxs(a,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Step:"})}),t.jsx(c,{color:"yellow",children:r.error.step})]}),r.error.context&&t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Position:"})}),t.jsx(c,{children:`line ${String(r.error.context.line)}, column ${String(r.error.context.column)}`})]}),t.jsx(a,{marginTop:1,children:t.jsx(c,{color:"red",children:r.error.message})})]})]}),r.error.context&&r.error.context.snippet.length>0&&t.jsxs(a,{flexDirection:"column",marginTop:1,children:[t.jsx(c,{dimColor:!0,children:"── "}),t.jsx(c,{bold:!0,color:"white",children:"SNIPPET"}),t.jsxs(a,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[r.error.context.snippet.map(n=>{const o=`${n.isErrorLine?"❯":" "} ${String(n.lineNumber).padStart(4)} `;return t.jsxs(a,{children:[t.jsx(c,{color:n.isErrorLine?"red":"gray",children:o}),t.jsx(c,{color:n.isErrorLine?"white":"gray",wrap:"truncate-end",children:n.content||" "})]},n.lineNumber)}),r.error.context.column>0&&t.jsx(a,{children:t.jsx(c,{color:"red",children:`${" ".repeat(7+r.error.context.column-1)}↑`})})]})]})]}):t.jsxs(a,{flexDirection:"column",marginTop:1,children:[t.jsx(c,{dimColor:!0,children:"── "}),t.jsx(c,{bold:!0,color:"white",children:"KEY DIFF"}),t.jsx(a,{flexDirection:"column",marginTop:1,paddingLeft:2,children:r.diff.length===0?t.jsx(c,{dimColor:!0,children:"No top-level keys moved (sub-key reorder only)."}):r.diff.map(n=>{const o=n.toIndex-n.fromIndex,d=o<0?`↑ ${String(Math.abs(o))}`:`↓ ${String(o)}`,g=o<0?"green":"yellow";return t.jsxs(a,{children:[t.jsx(a,{width:28,children:t.jsx(c,{wrap:"truncate",children:n.key})}),t.jsx(a,{width:10,children:t.jsxs(c,{dimColor:!0,children:[String(n.fromIndex)," → ",String(n.toIndex)]})}),t.jsx(c,{color:g,children:d})]},n.key)})}),e&&r.status==="would-rewrite"&&t.jsx(a,{marginTop:1,paddingLeft:2,children:t.jsx(c,{dimColor:!0,children:"--check mode: no write performed."})})]})]})]}):t.jsx(a,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:t.jsx(c,{dimColor:!0,children:"No entry selected"})})},ge={error:"red",rewritten:"yellow",unchanged:"green","would-rewrite":"yellow"},xe={error:"ERROR",rewritten:"REWROTE",unchanged:"SORTED","would-rewrite":"REWRITE"},H={error:"errors",rewritten:"rewrites",unchanged:"sorted","would-rewrite":"rewrites"},pe={errors:"Errors",rewrites:"Rewrites",sorted:"Sorted"},me=[{count:e=>e.errors+e.rewrites+e.sorted,key:"all",label:"All",shortcut:"1"},{count:e=>e.rewrites,key:"rewritten",label:"Rewrites",shortcut:"2"},{count:e=>e.errors,key:"errors",label:"Errors",shortcut:"3"},{count:e=>e.sorted,key:"unchanged",label:"Sorted",shortcut:"4"}],X=e=>{const r={errors:0,rewrites:0,sorted:0};for(const s of e)r[H[s.status]]++;return r},we=({entry:e,isSelected:r})=>{const s=ge[e.status],l=xe[e.status];return t.jsxs(a,{flexShrink:0,height:1,children:[t.jsx(c,{children:r?">":" "}),t.jsx(c,{children:" "}),t.jsx(c,{bold:!0,color:s,children:`[${l}]`.padEnd(10)}),t.jsx(c,{children:" "}),t.jsx(a,{flexGrow:1,children:t.jsx(c,{bold:r,inverse:r,wrap:"truncate",children:e.relativePath})}),e.status!=="error"&&e.diff.length>0&&t.jsx(c,{dimColor:!0,children:` ${String(e.diff.length)} key${e.diff.length===1?"":"s"}`})]})},je=({color:e,count:r,label:s})=>t.jsx(a,{flexShrink:0,height:1,children:t.jsx(c,{bold:!0,color:e,children:`${s} (${String(r)})`})}),ye=({counts:e,entries:r,filterType:s,focused:l,selectedIndex:i,totalEntries:n,viewportHeight:o})=>{const d=l?"white":"gray",g=X(r),m=(g.errors>0?1:0)+(g.rewrites>0?1:0)+(g.sorted>0?1:0),y=s==="all"&&m>1,h=[];let w;for(const[u,p]of r.entries()){const b=H[p.status];y&&b!==w&&(w!==void 0&&h.push({kind:"spacer"}),h.push({color:b==="errors"?"red":b==="rewrites"?"yellow":"green",count:g[b],kind:"header",label:pe[b]}),w=b),h.push({entry:p,entryIndex:u,kind:"entry"})}const x=h.findIndex(u=>u.kind==="entry"&&u.entryIndex===i),S=x!==-1,j=h.length,$=Math.max(0,j-o);let f=0;S&&o>0&&(f=Math.min($,Math.max(0,x-o+1)));const E=j>o&&o>0;return t.jsxs(a,{borderColor:d,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsxs(a,{flexShrink:0,gap:1,paddingX:1,children:[t.jsx(c,{bold:!0,inverse:!0,children:" VIS SORT "}),t.jsxs(c,{wrap:"truncate",children:[n," ","file",n===1?"":"s"]})]}),t.jsx(a,{flexShrink:0,gap:1,paddingX:1,paddingY:1,children:me.map(u=>{const p=s===u.key,b=u.count(e);return t.jsxs(a,{children:[t.jsx(c,{dimColor:!p,children:"["}),t.jsx(c,{bold:p,color:p?"cyan":"gray",children:u.shortcut}),t.jsx(c,{dimColor:!p,children:"]"}),t.jsxs(c,{color:p?"white":"gray",children:[" ",u.label]}),t.jsxs(c,{dimColor:!0,children:[" ","(",b,")"]})]},u.key)})}),t.jsxs(a,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[t.jsx(a,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:t.jsx(a,{flexDirection:"column",marginTop:-f,children:h.map((u,p)=>u.kind==="spacer"?t.jsx(a,{flexShrink:0,height:1},`s-${String(p)}`):u.kind==="header"?t.jsx(je,{color:u.color,count:u.count,label:u.label},`h-${u.label}`):t.jsx(we,{entry:u.entry,isSelected:u.entryIndex===i},u.entry.filePath))})}),E&&t.jsx(a,{flexShrink:0,marginLeft:1,marginRight:1,children:t.jsx(Q,{contentHeight:j,placement:"inset",scrollOffset:f,style:"block",viewportHeight:o})})]})]})},be=100,A=10,ke=6,Se=1,F={1:"all",2:"rewritten",3:"errors",4:"unchanged"},$e=({checkMode:e,store:r})=>{const{exit:s}=U(),{columns:l,rows:i}=Z(),n=v.useSyncExternalStore(r.subscribe,r.getSnapshot),o=v.useRef(null),d=r.getFilteredEntries(),g=d[n.selectedIndex]??null,m=X(n.entries),y=l>=be,h=Math.max(0,i-Se),w=y?h:Math.floor(h/2),x=Math.max(0,w-ke),S=v.useCallback(()=>{s()},[s]),j=v.useRef(0),$=v.useRef(void 0),f=v.useRef(!1),E=v.useCallback((u,p)=>{j.current+=p,$.current=u,!f.current&&(f.current=!0,queueMicrotask(()=>{f.current=!1;const b=j.current,T=$.current;j.current=0,$.current=void 0,!(b===0||T===void 0)&&(T==="list"?r.selectStep(Math.sign(b)):o.current?.scrollBy(Math.sign(b)))}))},[r]);return ee((u,p)=>{if(u==="q"||p.escape){S();return}if(F[u]){r.setFilter(F[u]);return}if(p.tab){r.setFocusedPanel(n.focusedPanel==="list"?"detail":"list");return}n.focusedPanel==="list"?p.upArrow||u==="k"?E("list",-1):(p.downArrow||u==="j")&&E("list",1):n.focusedPanel==="detail"&&(p.upArrow||u==="k"?E("detail",-1):(p.downArrow||u==="j")&&E("detail",1))}),i<A?t.jsx(a,{alignItems:"center",justifyContent:"center",children:t.jsxs(c,{color:"yellow",children:["Terminal too small. Resize to at least",A," ","rows."]})}):t.jsxs(a,{flexDirection:"column",height:i,width:l,children:[t.jsxs(a,{flexDirection:y?"row":"column",flexGrow:1,children:[t.jsx(a,{flexBasis:"50%",flexGrow:1,flexShrink:1,children:t.jsx(ye,{counts:m,entries:d,filterType:n.filterType,focused:n.focusedPanel==="list",selectedIndex:n.selectedIndex,totalEntries:n.entries.length,viewportHeight:x})}),t.jsx(a,{flexBasis:"50%",flexGrow:1,flexShrink:1,children:t.jsx(he,{checkMode:e,entry:g,focused:n.focusedPanel==="detail",scrollRef:o})})]}),t.jsx(a,{flexShrink:0,paddingX:1,children:t.jsx(c,{dimColor:!0,children:"↑/↓ or j/k:navigate | tab:switch panel | 1-4:filter | q:quit"})})]})},B=["types","node-addons","node","import","require","default"],ve=/^git\+https:\/\/github\.com\/([^/]+)\/([^/.]+(?:\.git)?)$/,Ee=/^git\+ssh:\/\/git@github\.com\/([^/]+)\/([^/.]+(?:\.git)?)$/,C=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),I=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(s=>I(s));const r={};for(const[s,l]of Object.entries(e))r[s]=I(l);return r},Pe=e=>{if(!C(e))return{changed:!1,value:e};const r=Object.keys(e);return r.length===1&&r[0]==="url"&&typeof e.url=="string"?{changed:!0,value:e.url}:{changed:!1,value:e}},Oe=e=>e.endsWith(".git")?e.slice(0,-4):e,Ce=e=>{if(!C(e))return{changed:!1,value:e};if(typeof e.directory=="string"&&e.directory.length>0)return{changed:!1,value:e};const{type:r}=e;if(r!==void 0&&r!=="git")return{changed:!1,value:e};const{url:s}=e;if(typeof s!="string")return{changed:!1,value:e};const l=ve.exec(s)??Ee.exec(s);if(!l)return{changed:!1,value:e};const i=l[1],n=Oe(l[2]??"");if(!i||!n)return{changed:!1,value:e};const o=new Set(["type","url"]);for(const d of Object.keys(e))if(!o.has(d))return{changed:!1,value:e};return{changed:!0,value:`${i}/${n}`}},Re=e=>{const r=Object.keys(e),s=[],l=[];for(const o of B)Object.hasOwn(e,o)&&s.push(o);for(const o of r)B.includes(o)||l.push(o);const i=[...s,...l];if(i.length===r.length&&i.every((o,d)=>o===r[d]))return{changed:!1,value:e};const n={};for(const o of i)n[o]=e[o];return{changed:!0,value:n}},W=e=>{if(!C(e))return{changed:!1,value:e};let r=!1;const s={};for(const[i,n]of Object.entries(e)){const o=W(n);s[i]=o.value,o.changed&&(r=!0)}const l=Re(s);return{changed:r||l.changed,value:l.value}},Ie=(e,r)=>{const s=I(e);let l=!1;if(r.formatBugs!==!1&&Object.hasOwn(s,"bugs")){const i=Pe(s.bugs);i.changed&&(s.bugs=i.value,l=!0)}if(r.formatRepository!==!1&&Object.hasOwn(s,"repository")){const i=Ce(s.repository);i.changed&&(s.repository=i.value,l=!0)}if(r.sortExports!==!1&&Object.hasOwn(s,"exports")&&C(s.exports)){const i=W(s.exports);i.changed&&(s.exports=i.value,l=!0)}return{changed:l,pkg:s}},Te=/at position (\d+)/,Me=/\(?line (\d+) column (\d+)\)?/,Ne=e=>{const r=new Set,s=[],l=n=>{const o=Y(n);!r.has(o)&&M(o)&&(r.add(o),s.push(o))};l(P(e,"package.json"));const i=ce(e);if(i){const n=N(e,i);for(const o of n)l(P(e,o,"package.json"))}else{const n=P(e,"package.json");if(M(n)){const o=JSON.parse(_(n)),d=Array.isArray(o.workspaces)?o.workspaces:o.workspaces?.packages;if(d){const g=N(e,d);for(const m of g)l(P(e,m,"package.json"))}}}return s},De=e=>/\n([ \t]+)/.exec(e)?.[1]??" ",Ae=e=>{if(!(e===void 0||e===""))return e==="tab"||e===String.raw`\t`?" ":/^\d+$/.test(e)?" ".repeat(Number.parseInt(e,10)):e},R=e=>e===void 0?[]:(Array.isArray(e)?e:[e]).flatMap(r=>r.split(",")).map(r=>r.trim()).filter(r=>r.length>0),Fe=e=>e.includes(`\r
1
+ import{createRequire as z}from"node:module";import{y as L,v as _,m as P,f as M,J as V,B as Y}from"../packem_shared/index-BDmTbWX1.js";import{a4 as t,a5 as a,m as c,aE as K,aF as Q,aG as U,aD as Z,s as v,ae as ee,p as k,r as re,$ as te,d as se,t as ne,aN as oe,aO as ie,aP as le,i as ce,W as N}from"./bin.js";import ae from"./index.js";import{sortPackageJsonStringWithOptions as q}from"#native";import{c as O}from"../packem_shared/utils-Cxree603.js";const Ke=z(import.meta.url),Qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const D={error:0,rewritten:1,"would-rewrite":1,unchanged:2},de=e=>[...e].sort((r,s)=>D[r.status]-D[s.status]),ue=(e,r)=>r==="all"?e:r==="errors"?e.filter(s=>s.status==="error"):r==="rewritten"?e.filter(s=>s.status==="rewritten"||s.status==="would-rewrite"):e.filter(s=>s.status==="unchanged");class fe{#e;#r=new Set;constructor(r){this.#e={entries:de(r),filterType:"all",focusedPanel:"list",selectedIndex:0}}getSnapshot=()=>this.#e;subscribe=r=>(this.#r.add(r),()=>{this.#r.delete(r)});getFilteredEntries=()=>ue(this.#e.entries,this.#e.filterType);#t(){this.#e={...this.#e};for(const r of this.#r)r()}select(r){const s=this.getFilteredEntries();this.#e.selectedIndex=s.length===0?-1:Math.max(0,Math.min(r,s.length-1)),this.#t()}selectStep(r){this.select(this.#e.selectedIndex+r)}setFilter(r){this.#e.filterType=r,this.#e.selectedIndex=0,this.#t()}setFocusedPanel(r){this.#e.focusedPanel=r,this.#t()}}const he=({checkMode:e,entry:r,focused:s,scrollRef:l})=>{const i=s?"white":"gray";return r?t.jsxs(a,{borderColor:i,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsx(a,{flexShrink:0,paddingTop:1,paddingX:2,children:t.jsx(c,{bold:!0,color:"white",children:r.relativePath})}),t.jsxs(K,{flexGrow:1,flexShrink:1,paddingX:2,ref:l,scrollbar:!0,scrollbarColor:"gray",children:[t.jsx(c,{}),t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Status:"})}),r.status==="error"?t.jsx(c,{bold:!0,color:"red",children:"error"}):r.status==="unchanged"?t.jsx(c,{bold:!0,color:"green",children:"already sorted"}):r.status==="rewritten"?t.jsx(c,{bold:!0,color:"yellow",children:"rewritten"}):t.jsx(c,{bold:!0,color:"yellow",children:"would rewrite (--check)"})]}),t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Path:"})}),t.jsx(c,{children:r.filePath})]}),r.error?t.jsxs(t.Fragment,{children:[t.jsxs(a,{flexDirection:"column",marginTop:1,children:[t.jsx(c,{dimColor:!0,children:"── "}),t.jsx(c,{bold:!0,color:"red",children:"ERROR"}),t.jsxs(a,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Step:"})}),t.jsx(c,{color:"yellow",children:r.error.step})]}),r.error.context&&t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Position:"})}),t.jsx(c,{children:`line ${String(r.error.context.line)}, column ${String(r.error.context.column)}`})]}),t.jsx(a,{marginTop:1,children:t.jsx(c,{color:"red",children:r.error.message})})]})]}),r.error.context&&r.error.context.snippet.length>0&&t.jsxs(a,{flexDirection:"column",marginTop:1,children:[t.jsx(c,{dimColor:!0,children:"── "}),t.jsx(c,{bold:!0,color:"white",children:"SNIPPET"}),t.jsxs(a,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[r.error.context.snippet.map(n=>{const o=`${n.isErrorLine?"❯":" "} ${String(n.lineNumber).padStart(4)} `;return t.jsxs(a,{children:[t.jsx(c,{color:n.isErrorLine?"red":"gray",children:o}),t.jsx(c,{color:n.isErrorLine?"white":"gray",wrap:"truncate-end",children:n.content||" "})]},n.lineNumber)}),r.error.context.column>0&&t.jsx(a,{children:t.jsx(c,{color:"red",children:`${" ".repeat(7+r.error.context.column-1)}↑`})})]})]})]}):t.jsxs(a,{flexDirection:"column",marginTop:1,children:[t.jsx(c,{dimColor:!0,children:"── "}),t.jsx(c,{bold:!0,color:"white",children:"KEY DIFF"}),t.jsx(a,{flexDirection:"column",marginTop:1,paddingLeft:2,children:r.diff.length===0?t.jsx(c,{dimColor:!0,children:"No top-level keys moved (sub-key reorder only)."}):r.diff.map(n=>{const o=n.toIndex-n.fromIndex,d=o<0?`↑ ${String(Math.abs(o))}`:`↓ ${String(o)}`,g=o<0?"green":"yellow";return t.jsxs(a,{children:[t.jsx(a,{width:28,children:t.jsx(c,{wrap:"truncate",children:n.key})}),t.jsx(a,{width:10,children:t.jsxs(c,{dimColor:!0,children:[String(n.fromIndex)," → ",String(n.toIndex)]})}),t.jsx(c,{color:g,children:d})]},n.key)})}),e&&r.status==="would-rewrite"&&t.jsx(a,{marginTop:1,paddingLeft:2,children:t.jsx(c,{dimColor:!0,children:"--check mode: no write performed."})})]})]})]}):t.jsx(a,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:t.jsx(c,{dimColor:!0,children:"No entry selected"})})},ge={error:"red",rewritten:"yellow",unchanged:"green","would-rewrite":"yellow"},xe={error:"ERROR",rewritten:"REWROTE",unchanged:"SORTED","would-rewrite":"REWRITE"},H={error:"errors",rewritten:"rewrites",unchanged:"sorted","would-rewrite":"rewrites"},pe={errors:"Errors",rewrites:"Rewrites",sorted:"Sorted"},me=[{count:e=>e.errors+e.rewrites+e.sorted,key:"all",label:"All",shortcut:"1"},{count:e=>e.rewrites,key:"rewritten",label:"Rewrites",shortcut:"2"},{count:e=>e.errors,key:"errors",label:"Errors",shortcut:"3"},{count:e=>e.sorted,key:"unchanged",label:"Sorted",shortcut:"4"}],X=e=>{const r={errors:0,rewrites:0,sorted:0};for(const s of e)r[H[s.status]]++;return r},we=({entry:e,isSelected:r})=>{const s=ge[e.status],l=xe[e.status];return t.jsxs(a,{flexShrink:0,height:1,children:[t.jsx(c,{children:r?">":" "}),t.jsx(c,{children:" "}),t.jsx(c,{bold:!0,color:s,children:`[${l}]`.padEnd(10)}),t.jsx(c,{children:" "}),t.jsx(a,{flexGrow:1,children:t.jsx(c,{bold:r,inverse:r,wrap:"truncate",children:e.relativePath})}),e.status!=="error"&&e.diff.length>0&&t.jsx(c,{dimColor:!0,children:` ${String(e.diff.length)} key${e.diff.length===1?"":"s"}`})]})},je=({color:e,count:r,label:s})=>t.jsx(a,{flexShrink:0,height:1,children:t.jsx(c,{bold:!0,color:e,children:`${s} (${String(r)})`})}),ye=({counts:e,entries:r,filterType:s,focused:l,selectedIndex:i,totalEntries:n,viewportHeight:o})=>{const d=l?"white":"gray",g=X(r),m=(g.errors>0?1:0)+(g.rewrites>0?1:0)+(g.sorted>0?1:0),y=s==="all"&&m>1,h=[];let w;for(const[u,p]of r.entries()){const b=H[p.status];y&&b!==w&&(w!==void 0&&h.push({kind:"spacer"}),h.push({color:b==="errors"?"red":b==="rewrites"?"yellow":"green",count:g[b],kind:"header",label:pe[b]}),w=b),h.push({entry:p,entryIndex:u,kind:"entry"})}const x=h.findIndex(u=>u.kind==="entry"&&u.entryIndex===i),S=x!==-1,j=h.length,$=Math.max(0,j-o);let f=0;S&&o>0&&(f=Math.min($,Math.max(0,x-o+1)));const E=j>o&&o>0;return t.jsxs(a,{borderColor:d,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsxs(a,{flexShrink:0,gap:1,paddingX:1,children:[t.jsx(c,{bold:!0,inverse:!0,children:" VIS SORT "}),t.jsxs(c,{wrap:"truncate",children:[n," ","file",n===1?"":"s"]})]}),t.jsx(a,{flexShrink:0,gap:1,paddingX:1,paddingY:1,children:me.map(u=>{const p=s===u.key,b=u.count(e);return t.jsxs(a,{children:[t.jsx(c,{dimColor:!p,children:"["}),t.jsx(c,{bold:p,color:p?"cyan":"gray",children:u.shortcut}),t.jsx(c,{dimColor:!p,children:"]"}),t.jsxs(c,{color:p?"white":"gray",children:[" ",u.label]}),t.jsxs(c,{dimColor:!0,children:[" ","(",b,")"]})]},u.key)})}),t.jsxs(a,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[t.jsx(a,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:t.jsx(a,{flexDirection:"column",marginTop:-f,children:h.map((u,p)=>u.kind==="spacer"?t.jsx(a,{flexShrink:0,height:1},`s-${String(p)}`):u.kind==="header"?t.jsx(je,{color:u.color,count:u.count,label:u.label},`h-${u.label}`):t.jsx(we,{entry:u.entry,isSelected:u.entryIndex===i},u.entry.filePath))})}),E&&t.jsx(a,{flexShrink:0,marginLeft:1,marginRight:1,children:t.jsx(Q,{contentHeight:j,placement:"inset",scrollOffset:f,style:"block",viewportHeight:o})})]})]})},be=100,A=10,ke=6,Se=1,F={1:"all",2:"rewritten",3:"errors",4:"unchanged"},$e=({checkMode:e,store:r})=>{const{exit:s}=U(),{columns:l,rows:i}=Z(),n=v.useSyncExternalStore(r.subscribe,r.getSnapshot),o=v.useRef(null),d=r.getFilteredEntries(),g=d[n.selectedIndex]??null,m=X(n.entries),y=l>=be,h=Math.max(0,i-Se),w=y?h:Math.floor(h/2),x=Math.max(0,w-ke),S=v.useCallback(()=>{s()},[s]),j=v.useRef(0),$=v.useRef(void 0),f=v.useRef(!1),E=v.useCallback((u,p)=>{j.current+=p,$.current=u,!f.current&&(f.current=!0,queueMicrotask(()=>{f.current=!1;const b=j.current,T=$.current;j.current=0,$.current=void 0,!(b===0||T===void 0)&&(T==="list"?r.selectStep(Math.sign(b)):o.current?.scrollBy(Math.sign(b)))}))},[r]);return ee((u,p)=>{if(u==="q"||p.escape){S();return}if(F[u]){r.setFilter(F[u]);return}if(p.tab){r.setFocusedPanel(n.focusedPanel==="list"?"detail":"list");return}n.focusedPanel==="list"?p.upArrow||u==="k"?E("list",-1):(p.downArrow||u==="j")&&E("list",1):n.focusedPanel==="detail"&&(p.upArrow||u==="k"?E("detail",-1):(p.downArrow||u==="j")&&E("detail",1))}),i<A?t.jsx(a,{alignItems:"center",justifyContent:"center",children:t.jsxs(c,{color:"yellow",children:["Terminal too small. Resize to at least",A," ","rows."]})}):t.jsxs(a,{flexDirection:"column",height:i,width:l,children:[t.jsxs(a,{flexDirection:y?"row":"column",flexGrow:1,children:[t.jsx(a,{flexBasis:"50%",flexGrow:1,flexShrink:1,children:t.jsx(ye,{counts:m,entries:d,filterType:n.filterType,focused:n.focusedPanel==="list",selectedIndex:n.selectedIndex,totalEntries:n.entries.length,viewportHeight:x})}),t.jsx(a,{flexBasis:"50%",flexGrow:1,flexShrink:1,children:t.jsx(he,{checkMode:e,entry:g,focused:n.focusedPanel==="detail",scrollRef:o})})]}),t.jsx(a,{flexShrink:0,paddingX:1,children:t.jsx(c,{dimColor:!0,children:"↑/↓ or j/k:navigate | tab:switch panel | 1-4:filter | q:quit"})})]})},B=["types","node-addons","node","import","require","default"],ve=/^git\+https:\/\/github\.com\/([^/]+)\/([^/.]+(?:\.git)?)$/,Ee=/^git\+ssh:\/\/git@github\.com\/([^/]+)\/([^/.]+(?:\.git)?)$/,C=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),I=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(s=>I(s));const r={};for(const[s,l]of Object.entries(e))r[s]=I(l);return r},Pe=e=>{if(!C(e))return{changed:!1,value:e};const r=Object.keys(e);return r.length===1&&r[0]==="url"&&typeof e.url=="string"?{changed:!0,value:e.url}:{changed:!1,value:e}},Oe=e=>e.endsWith(".git")?e.slice(0,-4):e,Ce=e=>{if(!C(e))return{changed:!1,value:e};if(typeof e.directory=="string"&&e.directory.length>0)return{changed:!1,value:e};const{type:r}=e;if(r!==void 0&&r!=="git")return{changed:!1,value:e};const{url:s}=e;if(typeof s!="string")return{changed:!1,value:e};const l=ve.exec(s)??Ee.exec(s);if(!l)return{changed:!1,value:e};const i=l[1],n=Oe(l[2]??"");if(!i||!n)return{changed:!1,value:e};const o=new Set(["type","url"]);for(const d of Object.keys(e))if(!o.has(d))return{changed:!1,value:e};return{changed:!0,value:`${i}/${n}`}},Re=e=>{const r=Object.keys(e),s=[],l=[];for(const o of B)Object.hasOwn(e,o)&&s.push(o);for(const o of r)B.includes(o)||l.push(o);const i=[...s,...l];if(i.length===r.length&&i.every((o,d)=>o===r[d]))return{changed:!1,value:e};const n={};for(const o of i)n[o]=e[o];return{changed:!0,value:n}},W=e=>{if(!C(e))return{changed:!1,value:e};let r=!1;const s={};for(const[i,n]of Object.entries(e)){const o=W(n);s[i]=o.value,o.changed&&(r=!0)}const l=Re(s);return{changed:r||l.changed,value:l.value}},Ie=(e,r)=>{const s=I(e);let l=!1;if(r.formatBugs!==!1&&Object.hasOwn(s,"bugs")){const i=Pe(s.bugs);i.changed&&(s.bugs=i.value,l=!0)}if(r.formatRepository!==!1&&Object.hasOwn(s,"repository")){const i=Ce(s.repository);i.changed&&(s.repository=i.value,l=!0)}if(r.sortExports!==!1&&Object.hasOwn(s,"exports")&&C(s.exports)){const i=W(s.exports);i.changed&&(s.exports=i.value,l=!0)}return{changed:l,pkg:s}},Te=/at position (\d+)/,Me=/\(?line (\d+) column (\d+)\)?/,Ne=e=>{const r=new Set,s=[],l=n=>{const o=Y(n);!r.has(o)&&M(o)&&(r.add(o),s.push(o))};l(P(e,"package.json"));const i=ce(e);if(i){const n=N(e,i);for(const o of n)l(P(e,o,"package.json"))}else{const n=P(e,"package.json");if(M(n)){const o=JSON.parse(_(n)),d=Array.isArray(o.workspaces)?o.workspaces:o.workspaces?.packages;if(d){const g=N(e,d);for(const m of g)l(P(e,m,"package.json"))}}}return s},De=e=>/\n([ \t]+)/.exec(e)?.[1]??" ",Ae=e=>{if(!(e===void 0||e===""))return e==="tab"||e===String.raw`\t`?" ":/^\d+$/.test(e)?" ".repeat(Number.parseInt(e,10)):e},R=e=>e===void 0?[]:(Array.isArray(e)?e:[e]).flatMap(r=>r.split(",")).map(r=>r.trim()).filter(r=>r.length>0),Fe=e=>e.includes(`\r
2
2
  `)?"crlf":"lf",Be=new Set(["auto","crlf","lf"]),Ge=e=>{if(e===void 0||e==="")return"auto";if(Be.has(e))return e;throw new Error(`--line-ending must be one of: auto, lf, crlf (got "${e}")`)},Je=(e,r,s)=>r.length===0?e:e.filter(l=>{const i=L(s,l),n=V(l);return!r.some(o=>{const d=o.includes("/")?i:n;return ae(o,d)})}),Le=(e,r)=>{if(r.length===0)return e;const s={},l=new Set;for(const i of r)Object.hasOwn(e,i)&&(s[i]=e[i],l.add(i));for(const i of Object.keys(e))l.has(i)||(s[i]=e[i]);return s},_e=(e,r,s)=>{if(s.length===0)return e;const l={...e};for(const i of s)Object.hasOwn(r,i)&&(l[i]=r[i]);return l},qe=(e,r)=>{let s=1,l=1;const i=Math.min(r,e.length);for(let n=0;n<i;n++)e.codePointAt(n)===10?(s++,l=1):l++;return{column:l,line:s}},G=(e,r,s=2)=>{const l=e.split(`
3
3
  `);if(r<1||r>l.length)return[];const i=Math.max(0,r-1-s),n=Math.min(l.length,r+s),o=[];for(let d=i;d<n;d++)o.push({content:l[d]??"",isErrorLine:d+1===r,lineNumber:d+1});return o},J=(e,r)=>{if(!(e instanceof Error))return;const s=Te.exec(e.message);if(s){const{column:i,line:n}=qe(r,Number.parseInt(s[1]??"0",10));return{column:i,line:n,snippet:G(r,n)}}const l=Me.exec(e.message);if(l){const i=Number.parseInt(l[1]??"1",10);return{column:Number.parseInt(l[2]??"1",10),line:i,snippet:G(r,i)}}},He=(e,r)=>{const s=Object.keys(JSON.parse(e)),l=Object.keys(JSON.parse(r)),i=new Map(s.map((o,d)=>[o,d])),n=[];for(const[o,d]of l.entries()){const g=i.get(d);g!==void 0&&g!==o&&n.push({fromIndex:g,key:d,toIndex:o})}return n},Xe=(e,r,s)=>{const l=r.indent??s.indent??De(e),i=r.lineEnding==="auto"?s.lineEnding??Fe(e):r.lineEnding,n=q(e,{pretty:!1,sortScripts:r.sortScripts});let o=JSON.parse(n);if(r.unsorted.length>0){const y=JSON.parse(e);o=_e(o,y,r.unsorted)}o=Le(o,r.sortOrder);const d={formatBugs:r.formatBugs,formatRepository:r.formatRepository,sortExports:r.sortExports},g=Ie(o,d);let m=JSON.stringify(g.pkg,null,l);return r.finalNewline&&(m+=`
4
4
  `),i==="crlf"&&(m=m.replaceAll(`
@@ -1,4 +1,4 @@
1
- import{createRequire as K}from"node:module";import{j as S,q as O,E as C}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{projectGraphToDot as ee}from"@visulima/task-runner";import{a4 as e,a5 as s,m as r,aE as te,aF as re,aG as ae,aD as ne,s as j,ae as ie,aH as oe,aI as P,b as se,O as le,$ as ce,k as de,r as pe}from"./bin.js";import ue from"graphology";import _ from"graphology-layout-forceatlas2";import{d as xe}from"../packem_shared/anolilab-text-CAM_E6uK.js";const Z=K(import.meta.url),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=n=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[t,a]=I.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return I.getBuiltinModule(n)}return Z(n)},{readFileSync:he}=R("node:fs"),{createRequire:fe}=R("node:module"),{join:ge,dirname:me}=R("node:path");var be=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
1
+ import{createRequire as K}from"node:module";import{j as S,q as O,E as C}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{projectGraphToDot as ee}from"@visulima/task-runner";import{a4 as e,a5 as s,m as r,aE as te,aF as re,aG as ae,aD as ne,s as j,ae as ie,aH as oe,aI as P,b as se,O as le,$ as ce,d as de,r as pe}from"./bin.js";import ue from"graphology";import _ from"graphology-layout-forceatlas2";import{d as xe}from"../packem_shared/anolilab-text-CAM_E6uK.js";const Z=K(import.meta.url),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=n=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[t,a]=I.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return I.getBuiltinModule(n)}return Z(n)},{readFileSync:he}=R("node:fs"),{createRequire:fe}=R("node:module"),{join:ge,dirname:me}=R("node:path");var be=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
2
2
  @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-content:""}}}@layer theme{:root,:host{--color-white:#fff;--spacing:.25rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-light:300;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-normal:0em;--leading-tight:1.25;--leading-snug:1.375;--radius-sm:.25rem;--ease-out:cubic-bezier(0, 0, .2, 1);--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--sans);--default-mono-font-family:var(--mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}:root{--bg:#f5f5f5;--panel:#fff;--panel2:#f0f0f0;--fg:#000;--muted:#555;--faint:#707070;--border:#e0e0e0;--border2:#bdbdbd;--row-hover:#f0f0f0;--accent:#d71921;--accent-soft:#d719210d;--link:#0050c0;--node-app:#000;--node-lib:#707070;--edge:#bdbdbd;--edge-faint:#e0e0e0;--mono:ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;--sans:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif}@media (prefers-color-scheme:dark){:root{--bg:#141414;--panel:#1c1c1c;--panel2:#242424;--fg:#fff;--muted:#b8b8b8;--faint:#8a8a8a;--border:#2e2e2e;--border2:#3e3e3e;--row-hover:#1f1f1f;--accent:#ff4d54;--accent-soft:#ff4d5414;--link:#7eb0f9;--node-app:#fff;--node-lib:#8a8a8a;--edge:#3e3e3e;--edge-faint:#2e2e2e}}html[data-theme=light]{--bg:#f5f5f5;--panel:#fff;--panel2:#f0f0f0;--fg:#000;--muted:#555;--faint:#707070;--border:#e0e0e0;--border2:#bdbdbd;--row-hover:#f0f0f0;--accent:#d71921;--accent-soft:#d719210d;--link:#0050c0;--node-app:#000;--node-lib:#707070;--edge:#bdbdbd;--edge-faint:#e0e0e0}html[data-theme=dark]{--bg:#141414;--panel:#1c1c1c;--panel2:#242424;--fg:#fff;--muted:#b8b8b8;--faint:#8a8a8a;--border:#2e2e2e;--border2:#3e3e3e;--row-hover:#1f1f1f;--accent:#ff4d54;--accent-soft:#ff4d5414;--link:#7eb0f9;--node-app:#fff;--node-lib:#8a8a8a;--edge:#3e3e3e;--edge-faint:#2e2e2e}body{background-image:radial-gradient(circle, var(--border) .5px, transparent .5px);font-feature-settings:"ss01";background-size:14px 14px}}@layer components{.tbtn-theme [data-icon=moon]{display:inline-flex}.tbtn-theme [data-icon=sun]{display:none}@media (prefers-color-scheme:dark){.tbtn-theme [data-icon=moon]{display:none}.tbtn-theme [data-icon=sun]{display:inline-flex}}html[data-theme=light] .tbtn-theme [data-icon=moon]{display:inline-flex}html[data-theme=light] .tbtn-theme [data-icon=sun],html[data-theme=dark] .tbtn-theme [data-icon=moon]{display:none}html[data-theme=dark] .tbtn-theme [data-icon=sun]{display:inline-flex}.anolilab-logo{width:auto;height:13px;fill:var(--fg)}.anolilab-accent{fill:#dfff1b}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.top-0{top:calc(var(--spacing) * 0)}.top-3{top:calc(var(--spacing) * 3)}.top-4{top:calc(var(--spacing) * 4)}.top-full{top:100%}.right-0{right:calc(var(--spacing) * 0)}.right-4{right:calc(var(--spacing) * 4)}.bottom-4{bottom:calc(var(--spacing) * 4)}.bottom-5{bottom:calc(var(--spacing) * 5)}.left-0{left:calc(var(--spacing) * 0)}.left-4{left:calc(var(--spacing) * 4)}.isolate{isolation:isolate}.z-20{z-index:20}.z-30{z-index:30}.z-\\[2\\]{z-index:2}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.m-8{margin:calc(var(--spacing) * 8)}.m-9{margin:calc(var(--spacing) * 9)}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mx-12{margin-inline:calc(var(--spacing) * 12)}.mx-\\[0\\.12em\\]{margin-inline:.12em}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-12{margin-top:calc(var(--spacing) * 12)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-10{margin-bottom:calc(var(--spacing) * 10)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-8{margin-left:calc(var(--spacing) * 8)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-\\[7px\\]{width:7px;height:7px}.h-2{height:calc(var(--spacing) * 2)}.h-5{height:calc(var(--spacing) * 5)}.h-7{height:calc(var(--spacing) * 7)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-\\[6px\\]{height:6px}.h-\\[7px\\]{height:7px}.h-\\[8px\\]{height:8px}.h-\\[10px\\]{height:10px}.h-\\[18px\\]{height:18px}.h-full{height:100%}.h-px{height:1px}.max-h-72{max-height:calc(var(--spacing) * 72)}.min-h-\\[400px\\]{min-height:400px}.min-h-\\[480px\\]{min-height:480px}.min-h-screen{min-height:100vh}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-7{width:calc(var(--spacing) * 7)}.w-9{width:calc(var(--spacing) * 9)}.w-\\[7px\\]{width:7px}.w-\\[8px\\]{width:8px}.w-full{width:100%}.w-px{width:1px}.max-w-\\[380px\\]{max-width:380px}.max-w-\\[1080px\\]{max-width:1080px}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-\\[200px\\]{min-width:200px}.min-w-\\[220px\\]{min-width:220px}.min-w-\\[260px\\]{min-width:260px}.flex-1{flex:1}.flex-\\[1_1_280px\\]{flex:280px}.flex-auto{flex:auto}.flex-none{flex:none}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-move{cursor:move}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\\[72px_1fr\\]{grid-template-columns:72px 1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-0{gap:calc(var(--spacing) * 0)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}.gap-12{gap:calc(var(--spacing) * 12)}.gap-16{gap:calc(var(--spacing) * 16)}.gap-\\[0\\.65rem\\]{gap:.65rem}.gap-\\[2px\\]{gap:2px}.gap-\\[7px\\]{gap:7px}.gap-px{gap:1px}:where(.space-y-0\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-y-1{row-gap:calc(var(--spacing) * 1)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.self-center{align-self:center}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\\[3px\\]{border-radius:3px}.rounded-\\[4px\\]{border-radius:4px}.rounded-full{border-radius:3.40282e38px}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-accent,.border-accent\\/60{border-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.border-accent\\/60{border-color:color-mix(in oklab, var(--accent) 60%, transparent)}}.border-border{border-color:var(--border)}.border-border2{border-color:var(--border2)}.border-fg{border-color:var(--fg)}.border-link{border-color:var(--link)}.bg-accent{background-color:var(--accent)}.bg-accent-soft{background-color:var(--accent-soft)}.bg-accent\\/40{background-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\\/40{background-color:color-mix(in oklab, var(--accent) 40%, transparent)}}.bg-bg,.bg-bg\\/40{background-color:var(--bg)}@supports (color:color-mix(in lab, red, red)){.bg-bg\\/40{background-color:color-mix(in oklab, var(--bg) 40%, transparent)}}.bg-border{background-color:var(--border)}.bg-border2{background-color:var(--border2)}.bg-edge{background-color:var(--edge)}.bg-edge-faint{background-color:var(--edge-faint)}.bg-fg{background-color:var(--fg)}.bg-node-app{background-color:var(--node-app)}.bg-node-lib{background-color:var(--node-lib)}.bg-panel,.bg-panel\\/95{background-color:var(--panel)}@supports (color:color-mix(in lab, red, red)){.bg-panel\\/95{background-color:color-mix(in oklab, var(--panel) 95%, transparent)}}.bg-panel2{background-color:var(--panel2)}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-0\\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.px-12{padding-inline:calc(var(--spacing) * 12)}.px-\\[5px\\]{padding-inline:5px}.px-\\[6px\\]{padding-inline:6px}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-16{padding-block:calc(var(--spacing) * 16)}.py-\\[3px\\]{padding-block:3px}.py-px{padding-block:1px}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pt-7{padding-top:calc(var(--spacing) * 7)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pt-12{padding-top:calc(var(--spacing) * 12)}.pr-0{padding-right:calc(var(--spacing) * 0)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-6{padding-right:calc(var(--spacing) * 6)}.pr-1234{padding-right:calc(var(--spacing) * 1234)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-1\\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pb-8{padding-bottom:calc(var(--spacing) * 8)}.pb-12{padding-bottom:calc(var(--spacing) * 12)}.pl-0{padding-left:calc(var(--spacing) * 0)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-\\[7px\\]{padding-left:7px}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:var(--mono)}.font-sans{font-family:var(--sans)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-\\[9px\\]{font-size:9px}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.text-\\[14px\\]{font-size:14px}.text-\\[15px\\]{font-size:15px}.text-\\[22px\\]{font-size:22px}.text-\\[28px\\]{font-size:28px}.text-\\[44px\\]{font-size:44px}.text-\\[72px\\]{font-size:72px}.text-\\[clamp\\(28px\\,5vw\\,52px\\)\\]{font-size:clamp(28px,5vw,52px)}.leading-\\[0\\.9\\]{--tw-leading:.9;line-height:.9}.leading-none{--tw-leading:1;line-height:1}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\\[-0\\.02em\\]{--tw-tracking:-.02em;letter-spacing:-.02em}.tracking-\\[0\\.1em\\]{--tw-tracking:.1em;letter-spacing:.1em}.tracking-\\[0\\.05em\\]{--tw-tracking:.05em;letter-spacing:.05em}.tracking-\\[0\\.08em\\]{--tw-tracking:.08em;letter-spacing:.08em}.tracking-\\[0\\.11em\\]{--tw-tracking:.11em;letter-spacing:.11em}.tracking-\\[0\\.12em\\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\\[0\\.15em\\]{--tw-tracking:.15em;letter-spacing:.15em}.tracking-\\[0\\.16em\\]{--tw-tracking:.16em;letter-spacing:.16em}.tracking-\\[0\\.22em\\]{--tw-tracking:.22em;letter-spacing:.22em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.text-accent{color:var(--accent)}.text-bg{color:var(--bg)}.text-faint{color:var(--faint)}.text-fg{color:var(--fg)}.text-link{color:var(--link)}.text-muted{color:var(--muted)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.no-underline{text-decoration-line:none}.opacity-40{opacity:.4}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\\[0_4px_12px_rgba\\(0\\,0\\,0\\,0\\.08\\)\\]{--tw-shadow:0 4px 12px var(--tw-shadow-color,#00000014);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\\[0_8px_24px_rgba\\(0\\,0\\,0\\,0\\.12\\)\\]{--tw-shadow:0 8px 24px var(--tw-shadow-color,#0000001f);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-0{outline-style:var(--tw-outline-style);outline-width:0}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.select-none{-webkit-user-select:none;user-select:none}.\\[notifications\\:\\<id\\>\\]{notifications:<id>}.\\[notifications\\:slack\\]{notifications:slack}.\\[notifications\\:teams\\]{notifications:teams}.\\[verdaccio\\:dry-run\\]{verdaccio:dry-run}.group-data-\\[state\\=off\\]\\:opacity-30:is(:where(.group)[data-state=off] *){opacity:.3}.placeholder\\:text-faint::placeholder{color:var(--faint)}.before\\:absolute:before{content:var(--tw-content);position:absolute}.before\\:left-0:before{content:var(--tw-content);left:calc(var(--spacing) * 0)}.before\\:text-faint:before{content:var(--tw-content);color:var(--faint)}.before\\:content-\\[\\'→\\'\\]:before{--tw-content:"→";content:var(--tw-content)}.after\\:ml-auto:after{content:var(--tw-content);margin-left:auto}.after\\:font-mono:after{content:var(--tw-content);font-family:var(--mono)}.after\\:text-\\[9px\\]:after{content:var(--tw-content);font-size:9px}.after\\:tracking-\\[0\\.1em\\]:after{content:var(--tw-content);--tw-tracking:.1em;letter-spacing:.1em}.after\\:text-accent:after{content:var(--tw-content);color:var(--accent)}.after\\:content-\\[\\'ON\\'\\]:after{--tw-content:"ON";content:var(--tw-content)}.last\\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.focus-within\\:border-fg:focus-within{border-color:var(--fg)}@media (hover:hover){.hover\\:border-fg:hover{border-color:var(--fg)}.hover\\:bg-accent:hover{background-color:var(--accent)}.hover\\:bg-row-hover:hover{background-color:var(--row-hover)}.hover\\:text-accent:hover{color:var(--accent)}.hover\\:text-fg:hover{color:var(--fg)}.hover\\:text-white:hover{color:var(--color-white)}.hover\\:opacity-90:hover{opacity:.9}}.focus-visible\\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\\:ring-fg:focus-visible{--tw-ring-color:var(--fg)}.focus-visible\\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:opacity-40:disabled{opacity:.4}.aria-selected\\:bg-row-hover[aria-selected=true]{background-color:var(--row-hover)}.data-\\[open\\=false\\]\\:hidden[data-open=false]{display:none}.data-\\[pinned\\=true\\]\\:pointer-events-auto[data-pinned=true]{pointer-events:auto}.data-\\[pinned\\=true\\]\\:border-accent[data-pinned=true]{border-color:var(--accent)}.data-\\[state\\=off\\]\\:text-faint[data-state=off]{color:var(--faint)}.data-\\[state\\=off\\]\\:line-through[data-state=off]{text-decoration-line:line-through}.data-\\[state\\=off\\]\\:after\\:text-faint[data-state=off]:after{content:var(--tw-content);color:var(--faint)}.data-\\[state\\=off\\]\\:after\\:content-\\[\\'OFF\\'\\][data-state=off]:after{--tw-content:"OFF";content:var(--tw-content)}.data-\\[state\\=selected\\]\\:bg-row-hover[data-state=selected]{background-color:var(--row-hover)}.data-\\[state\\=zero\\]\\:text-accent[data-state=zero]{color:var(--accent)}@media (min-width:40rem){.sm\\:min-w-\\[320px\\]{min-width:320px}}@media (min-width:48rem){.md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\\:grid-cols-\\[1\\.4fr_1fr\\]{grid-template-columns:1.4fr 1fr}}.\\[\\&_svg\\]\\:size-\\[14px\\] svg{width:14px;height:14px}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}.\\[\\&_tr\\]\\:border-b-0 tr{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.\\[\\&\\>\\*\\+\\*\\]\\:ml-6>*+*{margin-left:calc(var(--spacing) * 6)}.\\[\\&\\>\\*\\+\\*\\]\\:border-l>*+*{border-left-style:var(--tw-border-style);border-left-width:1px}.\\[\\&\\>\\*\\+\\*\\]\\:border-border>*+*{border-color:var(--border)}.\\[\\&\\>\\*\\+\\*\\]\\:pl-6>*+*{padding-left:calc(var(--spacing) * 6)}.\\[\\&\\>td\\]\\:border-b>td{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\\[\\&\\>td\\]\\:border-border>td{border-color:var(--border)}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}`;const we=be,ve=fe(import.meta.url),A=(n,t)=>{const a=ve.resolve(n);return he(ge(me(a),t),"utf8")},ye=A("sigma","sigma.min.js"),ke=A("graphology","graphology.umd.min.js"),je=A("@floating-ui/core","floating-ui.core.umd.min.js"),Ce=A("@floating-ui/dom","floating-ui.dom.umd.min.js"),Te='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>',Ee='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32 1.41 1.41M2 12h2m16 0h2M4.93 19.07l1.41-1.41m11.32-11.32 1.41-1.41"/></svg>',E=n=>n.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;"),Se=9,Ne=4,Ie=(n,t)=>{if(n.length===0)return[];const a=new ue({multi:!0,type:"directed"});for(const o of n){const f=a.order/n.length*Math.PI*2;a.addNode(o.name,{path:o.path,size:o.type==="application"?Se:Ne,type:o.type,x:Math.cos(f),y:Math.sin(f)})}for(const o of t)a.hasNode(o.source)&&a.hasNode(o.target)&&a.addEdge(o.source,o.target,{type:o.type});const i=_.inferSettings(a);_.assign(a,{iterations:600,settings:{...i,adjustSizes:!0,barnesHutOptimize:a.order>100,gravity:1.2,linLogMode:!0,scalingRatio:8,slowDown:4}});const l=[];return a.forEachNode((o,f)=>{l.push({name:o,path:f.path,size:f.size,type:f.type,x:f.x,y:f.y})}),l},Me=n=>{const t=n.now??new Date,a=n.nodes.filter(x=>x.type==="application").length,i=n.nodes.length-a,l=Ie(n.nodes,n.edges),o=new Set(l.map(x=>x.name)),f=n.edges.filter(x=>o.has(x.source)&&o.has(x.target)),d={edges:f,nodes:l},u=n.nodes.length===0,p={chip:"font-mono tracking-[0.08em] text-muted border border-border2 inline-flex h-7 items-center justify-center rounded-[4px] px-3 text-[11px] font-medium uppercase",dvNum:"font-mono text-[22px] font-medium text-fg leading-none",labelMono:"font-mono text-[10px] uppercase tracking-[0.15em] text-faint"};return`<!doctype html>
3
3
  <html lang="en">
4
4
  <head>
@@ -1,4 +1,4 @@
1
- import{createRequire as ce}from"node:module";import{m as O,v as A,f as z,T as _,B as ae}from"../packem_shared/index-BDmTbWX1.js";import{aR as le,u as de,a4 as t,a5 as h,m as a,aE as pe,aF as fe,aG as he,aD as ue,s as D,ae as me,aI as ge,p as y,$ as xe,k as ye,e as je,W as J,r as ke}from"./bin.js";import we from"module-replacements/manifests/micro-utilities.json"with{type:"json"};import ve from"module-replacements/manifests/native.json"with{type:"json"};import $e from"module-replacements/manifests/preferred.json"with{type:"json"};import{s as Z}from"../packem_shared/index-CgcF6_wo.js";import"../packem_shared/public-api-WqUCiyIe.js";import{w as be,R as Ce}from"../packem_shared/pm-runner-OGResYrA.js";import{a as Q}from"./config.js";import{s as Se}from"../packem_shared/glob-fqg4KepW-B7EjLRvw.js";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
1
+ import{createRequire as ce}from"node:module";import{m as O,v as A,f as z,T as _,B as ae}from"../packem_shared/index-BDmTbWX1.js";import{aR as le,u as de,a4 as t,a5 as h,m as a,aE as pe,aF as fe,aG as he,aD as ue,s as D,ae as me,aI as ge,p as y,$ as xe,d as ye,i as je,W as J,r as ke}from"./bin.js";import we from"module-replacements/manifests/micro-utilities.json"with{type:"json"};import ve from"module-replacements/manifests/native.json"with{type:"json"};import be from"module-replacements/manifests/preferred.json"with{type:"json"};import{s as Z}from"../packem_shared/index-CgcF6_wo.js";import"../packem_shared/public-api-WqUCiyIe.js";import{w as $e,R as Ce}from"../packem_shared/pm-runner-OGResYrA.js";import{a as Q}from"./config.js";import{s as Se}from"../packem_shared/glob-fqg4KepW-B7EjLRvw.js";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
2
2
  const require = __cjs_mod__.createRequire(import.meta.url);
3
3
  const nr=ce(import.meta.url),or=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const Oe=["dependencies","devDependencies","peerDependencies","peerDependenciesMeta","optionalDependencies","bundleDependencies"],Ne=["overrides","pnpm","resolutions"],Ee=["engines","files"],Te=r=>{const e=Z.coerce(r)?.major;return e!==void 0&&e>=10},Pe=r=>{const e=O(r,"pnpm-workspace.yaml");if(!z(e))return{overrides:{},source:"pnpm-workspace.yaml"};try{return{overrides:de(e)?.overrides??{},source:"pnpm-workspace.yaml"}}catch{return{overrides:{},source:"pnpm-workspace.yaml"}}},De=(r,e)=>{let n={};return e==="deno"?{overrides:{},source:"package.json"}:(e==="pnpm"?n=r.pnpm?.overrides??{}:e==="yarn"||e==="bun"?n=r.resolutions??{}:n=r.overrides??{},{overrides:n,source:"package.json"})},_e=(r,e,n)=>n.name==="pnpm"&&Te(n.version)?Pe(r):De(e,n.name),H=(r,e)=>{const n=e;for(const c of Ne){const i=r.indexOf(c);if(i!==-1&&c!==n)return n==="overrides"?i:i+1}let o=-1;for(const c of Oe){const i=r.indexOf(c);i>o&&(o=i)}if(o!==-1)return o+1;for(const c of Ee){const i=r.indexOf(c);if(i!==-1)return i}return r.length},Ae=(r,e)=>{const n=O(r,"pnpm-workspace.yaml");if(!z(n))throw new Error(`pnpm-workspace.yaml not found at ${n}. Cannot write overrides for pnpm v10+.`);let o=A(n);const c=`overrides:
4
4
  ${Object.entries(e).map(([i,l])=>` '${i}': '${l}'`).join(`
@@ -9,9 +9,9 @@ ${c}`,_(n,o)},Re=(r,e,n,o,c)=>{const i=A(r),l=le(r,i,{useEditorconfig:c});if(o==
9
9
  `);else{const k=Object.keys(e),s=H(k,"pnpm"),d=Object.entries(e);d.splice(s,0,["pnpm",u]),_(r,`${JSON.stringify(Object.fromEntries(d),null,l)}
10
10
  `)}}else{const u=o==="yarn"||o==="bun"?"resolutions":"overrides";if(e[u])e[u]=n,_(r,`${JSON.stringify(e,null,l)}
11
11
  `);else{const k=Object.keys(e),s=H(k,u),d=Object.entries(e);d.splice(s,0,[u,n]),_(r,`${JSON.stringify(Object.fromEntries(d),null,l)}
12
- `)}}},Ie=(r,e,n,o,c)=>{if(o.name==="deno")return{added:[],updated:[]};const i=A(e),l=JSON.parse(i),{overrides:u,source:k}=_e(r,l,o),s=[],d=[],m=new Set;if(o.name==="npm")for(const f of["dependencies","devDependencies"]){const x=l[f];if(x)for(const $ of Object.keys(x))m.add($)}for(const f of n){const x=u[f.original];if(typeof x=="object")continue;let $=f.spec;o.name==="npm"&&m.has(f.original)&&($=`$${f.original}`),x!==$&&(x?d.push(f.original):s.push(f.original),u[f.original]=$)}if(s.length===0&&d.length===0)return{added:s,updated:d};const j=Object.fromEntries(Object.entries(u).sort(([f],[x])=>f.localeCompare(x)));return k==="pnpm-workspace.yaml"?Ae(r,j):Re(e,l,j,o.name,c),{added:s,updated:d}},Fe=(r,e)=>{const n={bun:["bun.lock"],deno:["deno.lock"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]};for(const o of n[e]??[]){const c=O(r,o);try{return A(c)}catch{continue}}return""},Me=(r,e,n)=>{if(!r)return!1;const o=e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);switch(n){case"bun":return r.includes(`"${e}":`)||new RegExp(String.raw`(^|\s|[",])${o}@`,"m").test(r);case"deno":return r.includes(`"${e}"`)||r.includes(`"npm:${e}@`)||r.includes(`"jsr:${e}@`);case"npm":return r.includes(`"${e}":`)||r.includes(`"node_modules/${e}":`);case"pnpm":return new RegExp(String.raw`(^|\s|['"/])${o}(@|['"]?:)`,"m").test(r);case"yarn":return new RegExp(String.raw`(^|\s|[",])${o}@`,"m").test(r);default:return!1}};var q={exports:{}},B,X;function K(){if(X)return B;X=1;var r=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,c=(s,d)=>{for(var m in d)r(s,m,{get:d[m],enumerable:!0})},i=(s,d,m,j)=>{if(d&&typeof d=="object"||typeof d=="function")for(let f of n(d))!o.call(s,f)&&f!==m&&r(s,f,{get:()=>d[f],enumerable:!(j=e(d,f))||j.enumerable});return s},l=s=>i(r({},"__esModule",{value:!0}),s),u={};c(u,{PURL_Type:()=>k}),B=l(u);var k=(s=>(s.APK="apk",s.BITBUCKET="bitbucket",s.COCOAPODS="cocoapods",s.CARGO="cargo",s.CHROME="chrome",s.COMPOSER="composer",s.CONAN="conan",s.CONDA="conda",s.CRAN="cran",s.DEB="deb",s.DOCKER="docker",s.GEM="gem",s.GENERIC="generic",s.GITHUB="github",s.GOLANG="golang",s.HACKAGE="hackage",s.HEX="hex",s.HUGGINGFACE="huggingface",s.MAVEN="maven",s.MLFLOW="mlflow",s.NPM="npm",s.NUGET="nuget",s.OCI="oci",s.PUB="pub",s.PYPI="pypi",s.QPKG="qpkg",s.RPM="rpm",s.SWID="swid",s.SWIFT="swift",s.VCS="vcs",s))(k||{});return B}var V;function Ge(){return V||(V=1,(function(r){var e=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,i=(d,m)=>{for(var j in m)e(d,j,{get:m[j],enumerable:!0})},l=(d,m,j,f)=>{if(m&&typeof m=="object"||typeof m=="function")for(let x of o(m))!c.call(d,x)&&x!==j&&e(d,x,{get:()=>m[x],enumerable:!(f=n(m,x))||f.enumerable});return d},u=(d,m,j)=>(l(d,m,"default"),j&&l(j,m,"default")),k={};i(k,{getManifestData:()=>s}),u(k,K(),r.exports);function s(d,m){try{const j=require("../manifest.json");if(!d)return j;const f=j[d];if(!f)return;if(!m)return f;const x=f.find(([$,g])=>g.package===m);return x?x[1]:void 0}catch{return}}r.exports={getManifestData:s,...K()}})(q)),q.exports}var Le=Ge();const qe=(r,e,n)=>{let o=r;if(e!=="all"&&(o=o.filter(c=>c.category===e)),n){const c=n.toLowerCase();o=o.filter(i=>i.packageName.toLowerCase().includes(c))}return o};class Be{#e;#t=new Set;constructor(e){this.#e={applyProgress:null,checkedEntries:new Set,entries:e,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",phase:"browsing",selectedIndex:0}}getSnapshot=()=>this.#e;subscribe=e=>(this.#t.add(e),()=>{this.#t.delete(e)});getFilteredEntries=()=>qe(this.#e.entries,this.#e.filterType,this.#e.filterText);#r(){this.#e={...this.#e};for(const e of this.#t)e()}select(e){const n=this.getFilteredEntries();this.#e.selectedIndex=n.length===0?-1:Math.max(0,Math.min(e,n.length-1)),this.#r()}toggleCheck(e){const n=new Set(this.#e.checkedEntries);n.has(e)?n.delete(e):n.add(e),this.#e.checkedEntries=n,this.#r()}toggleAll(){const e=this.getFilteredEntries(),n=new Set(this.#e.checkedEntries);if(e.every(o=>n.has(o.packageName)))for(const o of e)n.delete(o.packageName);else for(const o of e)n.add(o.packageName);this.#e.checkedEntries=n,this.#r()}setFilter(e){this.#e.filterType=e,this.#e.selectedIndex=0,this.#r()}setFilterText(e){this.#e.filterText=e,this.#e.selectedIndex=0,this.#r()}setFilterActive(e){this.#e.filterActive=e,this.#r()}setFocusedPanel(e){this.#e.focusedPanel=e,this.#r()}setPhase(e){this.#e.phase=e,this.#r()}setProgress(e,n){this.#e.applyProgress={current:e,total:n},this.#r()}setError(e){this.#e.error=e,this.#e.phase="error",this.#r()}getCheckedEntries(){return this.#e.entries.filter(e=>this.#e.checkedEntries.has(e.packageName))}}const ee={"micro-utility":"gray",native:"green",preferred:"yellow",socket:"cyan"},Ue={"micro-utility":"MICRO",native:"NATIVE",preferred:"PREF",socket:"SOCKET"},ze={"micro-utility":"Trivial utility package that can be replaced with inline code.",native:"Polyfill for a native JS/Node.js API. Use the built-in instead.",preferred:"A lighter or faster alternative package exists.",socket:"Security-hardened replacement from Socket.dev's @socketregistry."},Je=({entry:r,focused:e,scrollRef:n})=>{const o=e?"white":"gray";if(!r)return t.jsx(h,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:t.jsx(a,{dimColor:!0,children:"No entry selected"})});const c=ee[r.category]??"gray";return t.jsxs(h,{borderColor:o,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsx(h,{flexShrink:0,paddingTop:1,paddingX:2,children:t.jsx(a,{bold:!0,color:"white",children:r.packageName})}),t.jsxs(pe,{flexGrow:1,flexShrink:1,paddingX:2,ref:n,scrollbar:!0,scrollbarColor:"gray",children:[t.jsx(a,{}),t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Category:"})}),t.jsx(a,{bold:!0,color:c,children:r.category})]}),t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Replace with:"})}),t.jsx(a,{children:r.replacement})]}),r.overrideSpec&&t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Override:"})}),t.jsx(a,{color:"cyan",children:r.overrideSpec})]}),t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Codemod:"})}),t.jsx(a,{color:r.hasCodemod?"green":"gray",children:r.hasCodemod?"available ⚙":"not available"})]}),t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"white",children:"DESCRIPTION"}),t.jsx(h,{marginTop:1,paddingLeft:2,children:t.jsx(a,{children:ze[r.category]??""})})]}),r.category==="native"&&t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"green",children:"ACTION"}),t.jsx(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:r.hasCodemod?t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"green",children:["✓"," ","Codemod will rewrite imports to use native API."]}),t.jsx(a,{dimColor:!0,children:" The package can then be removed from dependencies."})]}):t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"yellow",children:["ℹ"," ","No automated codemod available."]}),t.jsx(a,{dimColor:!0,children:" Manual migration required — replace usage with native equivalent."})]})})]}),r.category==="socket"&&t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"cyan",children:"ACTION"}),t.jsxs(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.jsxs(a,{color:"cyan",children:["✓"," ","Override will redirect resolution to the hardened package."]}),t.jsx(a,{dimColor:!0,children:" No source code changes needed — drop-in replacement."})]})]}),(r.category==="preferred"||r.category==="micro-utility")&&t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"yellow",children:"ACTION"}),t.jsx(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:r.hasCodemod?t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"green",children:["✓"," ","Codemod will rewrite imports to the recommended alternative."]}),t.jsx(a,{dimColor:!0,children:" The original package can then be removed from dependencies."})]}):t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"yellow",children:["ℹ"," ","Manual migration required."]}),r.docUrl?t.jsx(a,{dimColor:!0,children:" Open the migration guide below for the recommended alternative and steps."}):t.jsx(a,{dimColor:!0,children:" Consult the package's docs or the e18e module-replacements guide for an alternative."})]})})]}),t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"white",children:"LINKS"}),t.jsxs(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.jsxs(a,{color:"cyan",underline:!0,children:["https://npmx.dev/",r.packageName]}),r.docUrl&&t.jsx(a,{color:"cyan",underline:!0,children:r.docUrl})]})]})]})]})},He=[{key:"all",label:"All",shortcut:"1"},{key:"native",label:"Native",shortcut:"2"},{key:"preferred",label:"Preferred",shortcut:"3"},{key:"micro-utility",label:"Micro",shortcut:"4"},{key:"socket",label:"Socket",shortcut:"5"}],Xe=({checked:r,entry:e,isSelected:n})=>{const o=ee[e.category]??"white",c=Ue[e.category]??e.category,i=r?"☑":"☐",l=e.hasCodemod?"⚙":" ";return t.jsxs(h,{flexShrink:0,height:1,children:[t.jsx(a,{children:n?">":" "}),t.jsxs(a,{color:r?"white":"gray",children:[" ",i," "]}),t.jsx(a,{bold:!0,color:o,children:`[${c}]`.padEnd(9)}),t.jsxs(a,{children:[" ",l," "]}),t.jsx(h,{flexGrow:1,children:t.jsx(a,{bold:n,inverse:n,wrap:"truncate",children:e.packageName})}),t.jsx(a,{dimColor:!0,children:" → "}),t.jsx(a,{wrap:"truncate",children:e.replacement})]})},Ke=({checkedEntries:r,entries:e,filterActive:n,filterText:o,filterType:c,focused:i,isDryRun:l,scrollOffset:u,selectedIndex:k,totalEntries:s,viewportHeight:d})=>{const m=i?"white":"gray";let j=0,f=0,x=0,$=0;for(const C of e)switch(C.category){case"micro-utility":{x++;break}case"native":{j++;break}case"preferred":{f++;break}case"socket":{$++;break}}const g=[];j>0&&g.push(`${j} native`),f>0&&g.push(`${f} preferred`),x>0&&g.push(`${x} micro`),$>0&&g.push(`${$} socket`);const w=g.length>0?` (${g.join(", ")})`:"",b=r.size,T=[];for(const[C,p]of e.entries())T.push(t.jsx(Xe,{checked:r.has(p.packageName),entry:p,isSelected:C===k},p.packageName));const N=e.length,P=N>d&&d>0;return t.jsxs(h,{borderColor:m,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsxs(h,{flexShrink:0,gap:1,paddingX:1,children:[t.jsx(a,{bold:!0,inverse:!0,children:" VIS OPTIMIZE "}),t.jsxs(a,{wrap:"truncate",children:[s," ","optimizations",w]}),!l&&b>0&&t.jsxs(a,{dimColor:!0,children:[" ","—",b," ","selected"]})]}),t.jsx(h,{flexShrink:0,gap:1,paddingX:1,paddingY:1,children:He.map(C=>{const p=c===C.key;return t.jsxs(h,{children:[t.jsx(a,{dimColor:!p,children:"["}),t.jsx(a,{bold:p,color:p?"cyan":"gray",children:C.shortcut}),t.jsx(a,{dimColor:!p,children:"]"}),t.jsxs(a,{color:p?"white":"gray",children:[" ",C.label]})]},C.key)})}),n&&t.jsxs(h,{flexShrink:0,paddingX:1,children:[t.jsx(a,{bold:!0,color:"white",children:"/ "}),t.jsx(a,{children:o}),t.jsx(a,{inverse:!0,children:" "})]}),t.jsxs(h,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[t.jsx(h,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:t.jsx(h,{flexDirection:"column",marginTop:-u,children:T})}),P&&t.jsx(h,{flexShrink:0,marginLeft:1,marginRight:1,children:t.jsx(fe,{contentHeight:N,placement:"inset",scrollOffset:u,style:"block",viewportHeight:d})})]})]})},Ve=100,W=10,Y={1:"all",2:"native",3:"preferred",4:"micro-utility",5:"socket"},We=({isDryRun:r,store:e})=>{const{exit:n}=he(),{columns:o,rows:c}=ue(),i=D.useSyncExternalStore(e.subscribe,e.getSnapshot),l=D.useRef(null),[u,k]=D.useState(0),[s,d]=D.useState(!1),m=e.getFilteredEntries(),j=m[i.selectedIndex]??null,f=o>=Ve,x=Math.max(0,c-5),$=D.useCallback(g=>{n(g)},[n]);return me((g,w)=>{if(s){g==="y"||g==="Y"?$():d(!1);return}if(i.filterActive){w.escape?(e.setFilterActive(!1),e.setFilterText("")):w.return?e.setFilterActive(!1):w.backspace||w.delete?e.setFilterText(i.filterText.slice(0,-1)):g&&!w.ctrl&&!w.meta&&e.setFilterText(i.filterText+g);return}if(g==="q"){!r&&i.checkedEntries.size>0?d(!0):$();return}if(g==="/"){e.setFilterActive(!0);return}if(Y[g]){e.setFilter(Y[g]);return}if(w.tab){e.setFocusedPanel(i.focusedPanel==="list"?"detail":"list");return}if(i.focusedPanel==="list")if(w.upArrow||g==="k"){const b=Math.max(0,i.selectedIndex-1);e.select(b),b<u&&k(b)}else if(w.downArrow||g==="j"){const b=Math.min(m.length-1,i.selectedIndex+1);e.select(b),b>=u+x&&k(b-x+1)}else g===" "?j&&e.toggleCheck(j.packageName):g==="a"?e.toggleAll():w.return&&!r&&i.checkedEntries.size>0&&$(e.getCheckedEntries());else i.focusedPanel==="detail"&&(w.upArrow||g==="k"?l.current?.scrollBy(-1):(w.downArrow||g==="j")&&l.current?.scrollBy(1))},{isActive:i.phase==="browsing"}),c<W?t.jsx(h,{alignItems:"center",justifyContent:"center",children:t.jsxs(a,{color:"yellow",children:["Terminal too small. Resize to at least",W," ","rows."]})}):t.jsxs(h,{flexDirection:"column",height:c,width:o,children:[t.jsxs(h,{flexDirection:f?"row":"column",flexGrow:1,children:[t.jsx(h,{flexBasis:f?"50%":void 0,flexGrow:1,children:t.jsx(Ke,{checkedEntries:i.checkedEntries,entries:m,filterActive:i.filterActive,filterText:i.filterText,filterType:i.filterType,focused:i.focusedPanel==="list",isDryRun:r,scrollOffset:u,selectedIndex:i.selectedIndex,totalEntries:i.entries.length,viewportHeight:x})}),t.jsx(h,{flexBasis:f?"50%":void 0,flexGrow:1,children:t.jsx(Je,{entry:j,focused:i.focusedPanel==="detail",scrollRef:l})})]}),t.jsx(h,{flexShrink:0,paddingX:1,children:t.jsxs(a,{dimColor:!0,children:[r?"Preview mode":"space:toggle a:all enter:apply"," ","| tab:switch panel /: filter q:quit |","⚙","=codemod available"]})}),t.jsx(ge,{autoExitSeconds:3,onCancel:()=>{d(!1)},visible:s})]})},U=(r,e)=>{const n=new Set;try{const o=Q(r),c=e?[o.dependencies,o.optionalDependencies]:[o.dependencies,o.devDependencies,o.peerDependencies,o.optionalDependencies];for(const i of c)if(i)for(const l of Object.keys(i))n.add(l)}catch{}return n},re=r=>{const e=je(r);if(e)return J(r,e);const n=O(r,"package.json");if(!z(n))return[];try{const o=Q(n),c=Array.isArray(o.workspaces)?o.workspaces:o.workspaces?.packages;return c?J(r,c):[]}catch{return[]}},Ye="https://github.com/es-tooling/module-replacements/blob/main/docs/modules",Ze=r=>`${Ye}/${r}.md`,Qe=r=>{if(r.type==="simple"&&r.replacement)return r.replacement;if(r.type==="native"){const e=r.nodeVersion?` (Node ${r.nodeVersion}+)`:"";return r.replacement?`${r.replacement}${e}`:`Native API${e}`}return r.type==="documented"&&r.docPath?"see migration guide":""},te=r=>{const e=[],n=(o,c)=>{const i=o.moduleReplacements;if(Array.isArray(i))for(const l of i)r.has(l.moduleName)&&e.push({category:c,docUrl:l.type==="documented"&&l.docPath?Ze(l.docPath):void 0,hasCodemod:!1,overrideSpec:void 0,packageName:l.moduleName,replacement:Qe(l)})};return n(ve,"native"),n($e,"preferred"),n(we,"micro-utility"),e},ne=(r,e,n,o)=>{const c=Le.getManifestData("npm")??[],i=[];for(const[,l]of c){if(l.deprecated)continue;const u=r.has(l.package),k=e?Me(e,l.package,n.name):!1;if(!u&&!k)continue;const s=Z.coerce(l.version)?.major;if(s===void 0)continue;const d=o?`npm:${l.name}@${l.version}`:`npm:${l.name}@^${String(s)}`;i.push({category:"socket",hasCodemod:!1,overrideSpec:d,packageName:l.package,replacement:l.name})}return i};let G;const oe=async()=>{if(G)return G;try{return G=(await import("module-replacements-codemods")).codemods,G}catch{return{}}},se=async r=>{try{const e=await oe();for(const n of r)n.category!=="socket"&&e[n.packageName]&&(n.hasCodemod=!0)}catch{}},ie=async(r,e,n)=>{let o=0;try{const c=(await oe())[n];if(!c)return{filesChanged:0,packageName:n};const i=c({}),l=await er(e);for(const u of l){const k=A(u);if(k.includes(n))try{const s=await i.transform({file:{filename:u,source:k}});s!==k&&(await r.writeFile(u,s,"utf8"),o++)}catch(s){process.stderr.write(`warn: codemod transform failed for ${u}: ${s instanceof Error?s.message:String(s)}
13
- `)}}}catch{}return{filesChanged:o,packageName:n}},er=async r=>Se("**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}",{absolute:!0,cwd:r,ignore:["**/.*/**","**/.*","**/node_modules/**","**/dist/**","**/coverage/**","**/.git/**","**/.next/**","**/.nuxt/**"]}),rr=async({fs:r,logger:e,options:n,visConfig:o,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=be(c),l=!!n.dryRun,u=!!n.prod,k=!!n.pin;y.info(`Detected ${i.name} v${i.version}.`);const s=U(O(c,"package.json"),u),d=re(c),m=new Set(s);for(const p of d){const R=U(O(ae(c,p),"package.json"),u);for(const E of R)m.add(E)}d.length>0&&y.info(`Scanned ${String(d.length)} workspace package${d.length===1?"":"s"}.`),y.info(`Scanning dependencies...
14
- `);const j=Fe(c,i.name),f=te(m),x=ne(m,j,i,k),$=new Set(f.map(p=>p.packageName)),g=x.filter(p=>!$.has(p.packageName)),w=[...f,...g];if(await se(w),w.length===0){y.info("No optimizations found for your dependencies.");return}const b=!!process.stdout.isTTY&&!ke,T=n.format==="json"||!!n.json;if(b&&!l&&!T){const p=new Be(w),R=await xe(ye.createElement(We,{isDryRun:!1,store:p}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),E=Array.isArray(R)?R:[];if(E.length===0){y.info("No optimizations selected.");return}const I=E.filter(v=>v.category!=="socket"&&v.hasCodemod),F=E.filter(v=>v.category!=="socket"&&!v.hasCodemod),L=E.filter(v=>v.category==="socket");if(I.length>0){y.info(`
12
+ `)}}},Ie=(r,e,n,o,c)=>{if(o.name==="deno")return{added:[],updated:[]};const i=A(e),l=JSON.parse(i),{overrides:u,source:k}=_e(r,l,o),s=[],d=[],m=new Set;if(o.name==="npm")for(const f of["dependencies","devDependencies"]){const x=l[f];if(x)for(const b of Object.keys(x))m.add(b)}for(const f of n){const x=u[f.original];if(typeof x=="object")continue;let b=f.spec;o.name==="npm"&&m.has(f.original)&&(b=`$${f.original}`),x!==b&&(x?d.push(f.original):s.push(f.original),u[f.original]=b)}if(s.length===0&&d.length===0)return{added:s,updated:d};const j=Object.fromEntries(Object.entries(u).sort(([f],[x])=>f.localeCompare(x)));return k==="pnpm-workspace.yaml"?Ae(r,j):Re(e,l,j,o.name,c),{added:s,updated:d}},Fe=(r,e)=>{const n={bun:["bun.lock"],deno:["deno.lock"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]};for(const o of n[e]??[]){const c=O(r,o);try{return A(c)}catch{continue}}return""},Me=(r,e,n)=>{if(!r)return!1;const o=e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);switch(n){case"bun":return r.includes(`"${e}":`)||new RegExp(String.raw`(^|\s|[",])${o}@`,"m").test(r);case"deno":return r.includes(`"${e}"`)||r.includes(`"npm:${e}@`)||r.includes(`"jsr:${e}@`);case"npm":return r.includes(`"${e}":`)||r.includes(`"node_modules/${e}":`);case"pnpm":return new RegExp(String.raw`(^|\s|['"/])${o}(@|['"]?:)`,"m").test(r);case"yarn":return new RegExp(String.raw`(^|\s|[",])${o}@`,"m").test(r);default:return!1}};var q={exports:{}},B,X;function K(){if(X)return B;X=1;var r=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,c=(s,d)=>{for(var m in d)r(s,m,{get:d[m],enumerable:!0})},i=(s,d,m,j)=>{if(d&&typeof d=="object"||typeof d=="function")for(let f of n(d))!o.call(s,f)&&f!==m&&r(s,f,{get:()=>d[f],enumerable:!(j=e(d,f))||j.enumerable});return s},l=s=>i(r({},"__esModule",{value:!0}),s),u={};c(u,{PURL_Type:()=>k}),B=l(u);var k=(s=>(s.APK="apk",s.BITBUCKET="bitbucket",s.COCOAPODS="cocoapods",s.CARGO="cargo",s.CHROME="chrome",s.COMPOSER="composer",s.CONAN="conan",s.CONDA="conda",s.CRAN="cran",s.DEB="deb",s.DOCKER="docker",s.GEM="gem",s.GENERIC="generic",s.GITHUB="github",s.GOLANG="golang",s.HACKAGE="hackage",s.HEX="hex",s.HUGGINGFACE="huggingface",s.MAVEN="maven",s.MLFLOW="mlflow",s.NPM="npm",s.NUGET="nuget",s.OCI="oci",s.PUB="pub",s.PYPI="pypi",s.QPKG="qpkg",s.RPM="rpm",s.SWID="swid",s.SWIFT="swift",s.VCS="vcs",s))(k||{});return B}var V;function Ge(){return V||(V=1,(function(r){var e=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,i=(d,m)=>{for(var j in m)e(d,j,{get:m[j],enumerable:!0})},l=(d,m,j,f)=>{if(m&&typeof m=="object"||typeof m=="function")for(let x of o(m))!c.call(d,x)&&x!==j&&e(d,x,{get:()=>m[x],enumerable:!(f=n(m,x))||f.enumerable});return d},u=(d,m,j)=>(l(d,m,"default"),j&&l(j,m,"default")),k={};i(k,{getManifestData:()=>s}),u(k,K(),r.exports);function s(d,m){try{const j=require("../manifest.json");if(!d)return j;const f=j[d];if(!f)return;if(!m)return f;const x=f.find(([b,g])=>g.package===m);return x?x[1]:void 0}catch{return}}r.exports={getManifestData:s,...K()}})(q)),q.exports}var Le=Ge();const qe=(r,e,n)=>{let o=r;if(e!=="all"&&(o=o.filter(c=>c.category===e)),n){const c=n.toLowerCase();o=o.filter(i=>i.packageName.toLowerCase().includes(c))}return o};class Be{#e;#t=new Set;constructor(e){this.#e={applyProgress:null,checkedEntries:new Set,entries:e,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",phase:"browsing",selectedIndex:0}}getSnapshot=()=>this.#e;subscribe=e=>(this.#t.add(e),()=>{this.#t.delete(e)});getFilteredEntries=()=>qe(this.#e.entries,this.#e.filterType,this.#e.filterText);#r(){this.#e={...this.#e};for(const e of this.#t)e()}select(e){const n=this.getFilteredEntries();this.#e.selectedIndex=n.length===0?-1:Math.max(0,Math.min(e,n.length-1)),this.#r()}toggleCheck(e){const n=new Set(this.#e.checkedEntries);n.has(e)?n.delete(e):n.add(e),this.#e.checkedEntries=n,this.#r()}toggleAll(){const e=this.getFilteredEntries(),n=new Set(this.#e.checkedEntries);if(e.every(o=>n.has(o.packageName)))for(const o of e)n.delete(o.packageName);else for(const o of e)n.add(o.packageName);this.#e.checkedEntries=n,this.#r()}setFilter(e){this.#e.filterType=e,this.#e.selectedIndex=0,this.#r()}setFilterText(e){this.#e.filterText=e,this.#e.selectedIndex=0,this.#r()}setFilterActive(e){this.#e.filterActive=e,this.#r()}setFocusedPanel(e){this.#e.focusedPanel=e,this.#r()}setPhase(e){this.#e.phase=e,this.#r()}setProgress(e,n){this.#e.applyProgress={current:e,total:n},this.#r()}setError(e){this.#e.error=e,this.#e.phase="error",this.#r()}getCheckedEntries(){return this.#e.entries.filter(e=>this.#e.checkedEntries.has(e.packageName))}}const ee={"micro-utility":"gray",native:"green",preferred:"yellow",socket:"cyan"},Ue={"micro-utility":"MICRO",native:"NATIVE",preferred:"PREF",socket:"SOCKET"},ze={"micro-utility":"Trivial utility package that can be replaced with inline code.",native:"Polyfill for a native JS/Node.js API. Use the built-in instead.",preferred:"A lighter or faster alternative package exists.",socket:"Security-hardened replacement from Socket.dev's @socketregistry."},Je=({entry:r,focused:e,scrollRef:n})=>{const o=e?"white":"gray";if(!r)return t.jsx(h,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:t.jsx(a,{dimColor:!0,children:"No entry selected"})});const c=ee[r.category]??"gray";return t.jsxs(h,{borderColor:o,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsx(h,{flexShrink:0,paddingTop:1,paddingX:2,children:t.jsx(a,{bold:!0,color:"white",children:r.packageName})}),t.jsxs(pe,{flexGrow:1,flexShrink:1,paddingX:2,ref:n,scrollbar:!0,scrollbarColor:"gray",children:[t.jsx(a,{}),t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Category:"})}),t.jsx(a,{bold:!0,color:c,children:r.category})]}),t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Replace with:"})}),t.jsx(a,{children:r.replacement})]}),r.overrideSpec&&t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Override:"})}),t.jsx(a,{color:"cyan",children:r.overrideSpec})]}),t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Codemod:"})}),t.jsx(a,{color:r.hasCodemod?"green":"gray",children:r.hasCodemod?"available ⚙":"not available"})]}),t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"white",children:"DESCRIPTION"}),t.jsx(h,{marginTop:1,paddingLeft:2,children:t.jsx(a,{children:ze[r.category]??""})})]}),r.category==="native"&&t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"green",children:"ACTION"}),t.jsx(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:r.hasCodemod?t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"green",children:["✓"," ","Codemod will rewrite imports to use native API."]}),t.jsx(a,{dimColor:!0,children:" The package can then be removed from dependencies."})]}):t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"yellow",children:["ℹ"," ","No automated codemod available."]}),t.jsx(a,{dimColor:!0,children:" Manual migration required — replace usage with native equivalent."})]})})]}),r.category==="socket"&&t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"cyan",children:"ACTION"}),t.jsxs(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.jsxs(a,{color:"cyan",children:["✓"," ","Override will redirect resolution to the hardened package."]}),t.jsx(a,{dimColor:!0,children:" No source code changes needed — drop-in replacement."})]})]}),(r.category==="preferred"||r.category==="micro-utility")&&t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"yellow",children:"ACTION"}),t.jsx(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:r.hasCodemod?t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"green",children:["✓"," ","Codemod will rewrite imports to the recommended alternative."]}),t.jsx(a,{dimColor:!0,children:" The original package can then be removed from dependencies."})]}):t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"yellow",children:["ℹ"," ","Manual migration required."]}),r.docUrl?t.jsx(a,{dimColor:!0,children:" Open the migration guide below for the recommended alternative and steps."}):t.jsx(a,{dimColor:!0,children:" Consult the package's docs or the e18e module-replacements guide for an alternative."})]})})]}),t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"white",children:"LINKS"}),t.jsxs(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.jsxs(a,{color:"cyan",underline:!0,children:["https://npmx.dev/",r.packageName]}),r.docUrl&&t.jsx(a,{color:"cyan",underline:!0,children:r.docUrl})]})]})]})]})},He=[{key:"all",label:"All",shortcut:"1"},{key:"native",label:"Native",shortcut:"2"},{key:"preferred",label:"Preferred",shortcut:"3"},{key:"micro-utility",label:"Micro",shortcut:"4"},{key:"socket",label:"Socket",shortcut:"5"}],Xe=({checked:r,entry:e,isSelected:n})=>{const o=ee[e.category]??"white",c=Ue[e.category]??e.category,i=r?"☑":"☐",l=e.hasCodemod?"⚙":" ";return t.jsxs(h,{flexShrink:0,height:1,children:[t.jsx(a,{children:n?">":" "}),t.jsxs(a,{color:r?"white":"gray",children:[" ",i," "]}),t.jsx(a,{bold:!0,color:o,children:`[${c}]`.padEnd(9)}),t.jsxs(a,{children:[" ",l," "]}),t.jsx(h,{flexGrow:1,children:t.jsx(a,{bold:n,inverse:n,wrap:"truncate",children:e.packageName})}),t.jsx(a,{dimColor:!0,children:" → "}),t.jsx(a,{wrap:"truncate",children:e.replacement})]})},Ke=({checkedEntries:r,entries:e,filterActive:n,filterText:o,filterType:c,focused:i,isDryRun:l,scrollOffset:u,selectedIndex:k,totalEntries:s,viewportHeight:d})=>{const m=i?"white":"gray";let j=0,f=0,x=0,b=0;for(const C of e)switch(C.category){case"micro-utility":{x++;break}case"native":{j++;break}case"preferred":{f++;break}case"socket":{b++;break}}const g=[];j>0&&g.push(`${j} native`),f>0&&g.push(`${f} preferred`),x>0&&g.push(`${x} micro`),b>0&&g.push(`${b} socket`);const w=g.length>0?` (${g.join(", ")})`:"",$=r.size,T=[];for(const[C,p]of e.entries())T.push(t.jsx(Xe,{checked:r.has(p.packageName),entry:p,isSelected:C===k},p.packageName));const N=e.length,P=N>d&&d>0;return t.jsxs(h,{borderColor:m,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsxs(h,{flexShrink:0,gap:1,paddingX:1,children:[t.jsx(a,{bold:!0,inverse:!0,children:" VIS OPTIMIZE "}),t.jsxs(a,{wrap:"truncate",children:[s," ","optimizations",w]}),!l&&$>0&&t.jsxs(a,{dimColor:!0,children:[" ","—",$," ","selected"]})]}),t.jsx(h,{flexShrink:0,gap:1,paddingX:1,paddingY:1,children:He.map(C=>{const p=c===C.key;return t.jsxs(h,{children:[t.jsx(a,{dimColor:!p,children:"["}),t.jsx(a,{bold:p,color:p?"cyan":"gray",children:C.shortcut}),t.jsx(a,{dimColor:!p,children:"]"}),t.jsxs(a,{color:p?"white":"gray",children:[" ",C.label]})]},C.key)})}),n&&t.jsxs(h,{flexShrink:0,paddingX:1,children:[t.jsx(a,{bold:!0,color:"white",children:"/ "}),t.jsx(a,{children:o}),t.jsx(a,{inverse:!0,children:" "})]}),t.jsxs(h,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[t.jsx(h,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:t.jsx(h,{flexDirection:"column",marginTop:-u,children:T})}),P&&t.jsx(h,{flexShrink:0,marginLeft:1,marginRight:1,children:t.jsx(fe,{contentHeight:N,placement:"inset",scrollOffset:u,style:"block",viewportHeight:d})})]})]})},Ve=100,W=10,Y={1:"all",2:"native",3:"preferred",4:"micro-utility",5:"socket"},We=({isDryRun:r,store:e})=>{const{exit:n}=he(),{columns:o,rows:c}=ue(),i=D.useSyncExternalStore(e.subscribe,e.getSnapshot),l=D.useRef(null),[u,k]=D.useState(0),[s,d]=D.useState(!1),m=e.getFilteredEntries(),j=m[i.selectedIndex]??null,f=o>=Ve,x=Math.max(0,c-5),b=D.useCallback(g=>{n(g)},[n]);return me((g,w)=>{if(s){g==="y"||g==="Y"?b():d(!1);return}if(i.filterActive){w.escape?(e.setFilterActive(!1),e.setFilterText("")):w.return?e.setFilterActive(!1):w.backspace||w.delete?e.setFilterText(i.filterText.slice(0,-1)):g&&!w.ctrl&&!w.meta&&e.setFilterText(i.filterText+g);return}if(g==="q"){!r&&i.checkedEntries.size>0?d(!0):b();return}if(g==="/"){e.setFilterActive(!0);return}if(Y[g]){e.setFilter(Y[g]);return}if(w.tab){e.setFocusedPanel(i.focusedPanel==="list"?"detail":"list");return}if(i.focusedPanel==="list")if(w.upArrow||g==="k"){const $=Math.max(0,i.selectedIndex-1);e.select($),$<u&&k($)}else if(w.downArrow||g==="j"){const $=Math.min(m.length-1,i.selectedIndex+1);e.select($),$>=u+x&&k($-x+1)}else g===" "?j&&e.toggleCheck(j.packageName):g==="a"?e.toggleAll():w.return&&!r&&i.checkedEntries.size>0&&b(e.getCheckedEntries());else i.focusedPanel==="detail"&&(w.upArrow||g==="k"?l.current?.scrollBy(-1):(w.downArrow||g==="j")&&l.current?.scrollBy(1))},{isActive:i.phase==="browsing"}),c<W?t.jsx(h,{alignItems:"center",justifyContent:"center",children:t.jsxs(a,{color:"yellow",children:["Terminal too small. Resize to at least",W," ","rows."]})}):t.jsxs(h,{flexDirection:"column",height:c,width:o,children:[t.jsxs(h,{flexDirection:f?"row":"column",flexGrow:1,children:[t.jsx(h,{flexBasis:f?"50%":void 0,flexGrow:1,children:t.jsx(Ke,{checkedEntries:i.checkedEntries,entries:m,filterActive:i.filterActive,filterText:i.filterText,filterType:i.filterType,focused:i.focusedPanel==="list",isDryRun:r,scrollOffset:u,selectedIndex:i.selectedIndex,totalEntries:i.entries.length,viewportHeight:x})}),t.jsx(h,{flexBasis:f?"50%":void 0,flexGrow:1,children:t.jsx(Je,{entry:j,focused:i.focusedPanel==="detail",scrollRef:l})})]}),t.jsx(h,{flexShrink:0,paddingX:1,children:t.jsxs(a,{dimColor:!0,children:[r?"Preview mode":"space:toggle a:all enter:apply"," ","| tab:switch panel /: filter q:quit |","⚙","=codemod available"]})}),t.jsx(ge,{autoExitSeconds:3,onCancel:()=>{d(!1)},visible:s})]})},U=(r,e)=>{const n=new Set;try{const o=Q(r),c=e?[o.dependencies,o.optionalDependencies]:[o.dependencies,o.devDependencies,o.peerDependencies,o.optionalDependencies];for(const i of c)if(i)for(const l of Object.keys(i))n.add(l)}catch{}return n},re=r=>{const e=je(r);if(e)return J(r,e);const n=O(r,"package.json");if(!z(n))return[];try{const o=Q(n),c=Array.isArray(o.workspaces)?o.workspaces:o.workspaces?.packages;return c?J(r,c):[]}catch{return[]}},Ye="https://github.com/es-tooling/module-replacements/blob/main/docs/modules",Ze=r=>`${Ye}/${r}.md`,Qe=r=>{if(r.type==="simple"&&r.replacement)return r.replacement;if(r.type==="native"){const e=r.nodeVersion?` (Node ${r.nodeVersion}+)`:"";return r.replacement?`${r.replacement}${e}`:`Native API${e}`}return r.type==="documented"&&r.docPath?"see migration guide":""},te=r=>{const e=[],n=(o,c)=>{const i=o.moduleReplacements;if(Array.isArray(i))for(const l of i)r.has(l.moduleName)&&e.push({category:c,docUrl:l.type==="documented"&&l.docPath?Ze(l.docPath):void 0,hasCodemod:!1,overrideSpec:void 0,packageName:l.moduleName,replacement:Qe(l)})};return n(ve,"native"),n(be,"preferred"),n(we,"micro-utility"),e},ne=(r,e,n,o)=>{const c=Le.getManifestData("npm")??[],i=[];for(const[,l]of c){if(l.deprecated)continue;const u=r.has(l.package),k=e?Me(e,l.package,n.name):!1;if(!u&&!k)continue;const s=Z.coerce(l.version)?.major;if(s===void 0)continue;const d=o?`npm:${l.name}@${l.version}`:`npm:${l.name}@^${String(s)}`;i.push({category:"socket",hasCodemod:!1,overrideSpec:d,packageName:l.package,replacement:l.name})}return i};let G;const oe=async()=>{if(G)return G;try{return G=(await import("module-replacements-codemods")).codemods,G}catch{return{}}},se=async r=>{try{const e=await oe();for(const n of r)n.category!=="socket"&&e[n.packageName]&&(n.hasCodemod=!0)}catch{}},ie=async(r,e,n)=>{let o=0;try{const c=(await oe())[n];if(!c)return{filesChanged:0,packageName:n};const i=c({}),l=await er(e);for(const u of l){const k=A(u);if(k.includes(n))try{const s=await i.transform({file:{filename:u,source:k}});s!==k&&(await r.writeFile(u,s,"utf8"),o++)}catch(s){process.stderr.write(`warn: codemod transform failed for ${u}: ${s instanceof Error?s.message:String(s)}
13
+ `)}}}catch{}return{filesChanged:o,packageName:n}},er=async r=>Se("**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}",{absolute:!0,cwd:r,ignore:["**/.*/**","**/.*","**/node_modules/**","**/dist/**","**/coverage/**","**/.git/**","**/.next/**","**/.nuxt/**"]}),rr=async({fs:r,logger:e,options:n,visConfig:o,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=$e(c),l=!!n.dryRun,u=!!n.prod,k=!!n.pin;y.info(`Detected ${i.name} v${i.version}.`);const s=U(O(c,"package.json"),u),d=re(c),m=new Set(s);for(const p of d){const R=U(O(ae(c,p),"package.json"),u);for(const E of R)m.add(E)}d.length>0&&y.info(`Scanned ${String(d.length)} workspace package${d.length===1?"":"s"}.`),y.info(`Scanning dependencies...
14
+ `);const j=Fe(c,i.name),f=te(m),x=ne(m,j,i,k),b=new Set(f.map(p=>p.packageName)),g=x.filter(p=>!b.has(p.packageName)),w=[...f,...g];if(await se(w),w.length===0){y.info("No optimizations found for your dependencies.");return}const $=!!process.stdout.isTTY&&!ke,T=n.format==="json"||!!n.json;if($&&!l&&!T){const p=new Be(w),R=await xe(ye.createElement(We,{isDryRun:!1,store:p}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),E=Array.isArray(R)?R:[];if(E.length===0){y.info("No optimizations selected.");return}const I=E.filter(v=>v.category!=="socket"&&v.hasCodemod),F=E.filter(v=>v.category!=="socket"&&!v.hasCodemod),L=E.filter(v=>v.category==="socket");if(I.length>0){y.info(`
15
15
  Running ${String(I.length)} codemod${I.length===1?"":"s"}...
16
16
  `);for(const v of I){const S=await ie(r,c,v.packageName);S.filesChanged>0?y.success(` ${v.packageName}: ${String(S.filesChanged)} file${S.filesChanged===1?"":"s"} updated`):y.info(` ${v.packageName}: no files changed`)}}if(F.length>0){y.warn(`
17
17
  ${String(F.length)} selected replacement${F.length===1?"":"s"} require manual migration (no codemod available):`);for(const v of F)y.info(` ${v.packageName} → ${v.replacement}`);y.notice(" Replace usage in your source code, then remove from dependencies.")}if(L.length>0){const v=L.filter(M=>M.overrideSpec).map(M=>({original:M.packageName,spec:M.overrideSpec})),S=Ie(c,O(c,"package.json"),v,i,o?.editorconfig??!0);S.added.length>0&&y.success(`
@@ -1,4 +1,4 @@
1
- import{createRequire as Q}from"node:module";import{I as w,j as P,E as u,q as T,s as v,V as D}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{m as j,f as A,v as ee,T as te,O as R,y as $}from"../packem_shared/index-BDmTbWX1.js";import G from"./index.js";import{e as oe,W as L,Y as E,aM as se,aL as C,E as B,aS as q,af as ne,R as ae,aT as re,aU as ie,aV as pe,aW as ce}from"./bin.js";import{a as S}from"./config.js";import{l as fe}from"../packem_shared/missing-package-json-BfWUxTGv.js";const X=Q(import.meta.url),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Z=e=>{if(typeof V<"u"&&V.versions&&V.versions.node){const[a,o]=V.versions.node.split(".").map(Number);if(a>22||a===22&&o>=3||a===20&&o>=16)return V.getBuiltinModule(e)}return X(e)},{readFileSync:H,writeFileSync:z}=Z("node:fs"),le=e=>/[*?[\]{}!]/.test(e),ge=e=>typeof e=="string"?e:e.reason,de=e=>typeof e=="string"?void 0:e.replacement,U=(e,a)=>e.some(o=>G(o,a)),Y=(e,a)=>{if(typeof e=="string")return!0;const o=Array.isArray(e.packages)&&e.packages.length>0,t=Array.isArray(e.paths)&&e.paths.length>0;return!!(!o&&!t||o&&a.packageName!==void 0&&U(e.packages,a.packageName)||t&&U(e.paths,a.packageDir))},ue=(e,a)=>{const o=a[e.depName];if(o!==void 0&&Y(o,e))return{pattern:e.depName,rule:o};for(const[t,r]of Object.entries(a))if(le(t)&&G(t,e.depName)&&Y(r,e))return{pattern:t,rule:r}},me=(e,a)=>{if(Object.keys(a).length===0)return[];const o=[];for(const t of e){if(t.isInternal)continue;const r=ue(t,a);r&&o.push({depName:t.depName,depType:t.depType,matchedPattern:r.pattern,packageDir:t.packageDir,packageJsonPath:t.packageJsonPath,packageName:t.packageName,reason:ge(r.rule),replacement:de(r.rule),specifier:t.specifier})}return o},he=new Set(["dependencies","devDependencies","peerDependencies"]),ke=e=>e.startsWith("catalog:"),ye=e=>e.startsWith("workspace:"),$e=(e,a)=>{if(!e)return!1;for(const o of e.values())if(o.has(a))return!0;return!1},Pe=(e,a={})=>{const o=a.min??3,t=new Set(a.ignoreDeps),r=e.filter(i=>i.isInternal||!he.has(i.depType)||ye(i.specifier)||a.dep!==void 0&&i.depName!==a.dep?!1:!t.has(i.depName)),n=new Map;for(const i of r){const p=n.get(i.depName);p?p.push(i):n.set(i.depName,[i])}const s=[];for(const[i,p]of n){if($e(a.catalogs,i)||p.some(m=>ke(m.specifier)))continue;const c=new Map;for(const m of p){let d=c.get(m.specifier);d||(d=new Set,c.set(m.specifier,d)),d.add(m.packageJsonPath)}const f=[...c.entries()].sort((m,d)=>m[1].size!==d[1].size?d[1].size-m[1].size:m[0].localeCompare(d[0]))[0];!f||f[1].size<o||s.push({catalogName:"default",depName:i,instanceCount:f[1].size,specifier:f[0]})}return s.sort((i,p)=>i.depName.localeCompare(p.depName))},we=(e,a)=>{if(a.length===0)return;const o=j(e,"pnpm-workspace.yaml"),t=A(o)?H(o,"utf8"):"",r=t.includes(`\r
1
+ import{createRequire as Q}from"node:module";import{I as w,j as P,E as u,q as T,s as v,V as D}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{m as j,f as A,v as ee,T as te,O as R,y as $}from"../packem_shared/index-BDmTbWX1.js";import G from"./index.js";import{i as oe,W as L,Y as E,aM as se,aL as C,E as B,aS as q,af as ne,R as ae,aT as re,aU as ie,aV as pe,aW as ce}from"./bin.js";import{a as S}from"./config.js";import{l as fe}from"../packem_shared/missing-package-json-8vNHwbqw.js";const X=Q(import.meta.url),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Z=e=>{if(typeof V<"u"&&V.versions&&V.versions.node){const[a,o]=V.versions.node.split(".").map(Number);if(a>22||a===22&&o>=3||a===20&&o>=16)return V.getBuiltinModule(e)}return X(e)},{readFileSync:H,writeFileSync:z}=Z("node:fs"),le=e=>/[*?[\]{}!]/.test(e),ge=e=>typeof e=="string"?e:e.reason,de=e=>typeof e=="string"?void 0:e.replacement,U=(e,a)=>e.some(o=>G(o,a)),Y=(e,a)=>{if(typeof e=="string")return!0;const o=Array.isArray(e.packages)&&e.packages.length>0,t=Array.isArray(e.paths)&&e.paths.length>0;return!!(!o&&!t||o&&a.packageName!==void 0&&U(e.packages,a.packageName)||t&&U(e.paths,a.packageDir))},ue=(e,a)=>{const o=a[e.depName];if(o!==void 0&&Y(o,e))return{pattern:e.depName,rule:o};for(const[t,r]of Object.entries(a))if(le(t)&&G(t,e.depName)&&Y(r,e))return{pattern:t,rule:r}},me=(e,a)=>{if(Object.keys(a).length===0)return[];const o=[];for(const t of e){if(t.isInternal)continue;const r=ue(t,a);r&&o.push({depName:t.depName,depType:t.depType,matchedPattern:r.pattern,packageDir:t.packageDir,packageJsonPath:t.packageJsonPath,packageName:t.packageName,reason:ge(r.rule),replacement:de(r.rule),specifier:t.specifier})}return o},he=new Set(["dependencies","devDependencies","peerDependencies"]),ke=e=>e.startsWith("catalog:"),ye=e=>e.startsWith("workspace:"),$e=(e,a)=>{if(!e)return!1;for(const o of e.values())if(o.has(a))return!0;return!1},Pe=(e,a={})=>{const o=a.min??3,t=new Set(a.ignoreDeps),r=e.filter(i=>i.isInternal||!he.has(i.depType)||ye(i.specifier)||a.dep!==void 0&&i.depName!==a.dep?!1:!t.has(i.depName)),n=new Map;for(const i of r){const p=n.get(i.depName);p?p.push(i):n.set(i.depName,[i])}const s=[];for(const[i,p]of n){if($e(a.catalogs,i)||p.some(m=>ke(m.specifier)))continue;const c=new Map;for(const m of p){let d=c.get(m.specifier);d||(d=new Set,c.set(m.specifier,d)),d.add(m.packageJsonPath)}const f=[...c.entries()].sort((m,d)=>m[1].size!==d[1].size?d[1].size-m[1].size:m[0].localeCompare(d[0]))[0];!f||f[1].size<o||s.push({catalogName:"default",depName:i,instanceCount:f[1].size,specifier:f[0]})}return s.sort((i,p)=>i.depName.localeCompare(p.depName))},we=(e,a)=>{if(a.length===0)return;const o=j(e,"pnpm-workspace.yaml"),t=A(o)?H(o,"utf8"):"",r=t.includes(`\r
2
2
  `)?`\r
3
3
  `:`
4
4
  `,n=a.filter(d=>d.catalogName==="default").sort((d,g)=>d.depName.localeCompare(g.depName));if(n.length===0)return;const s=t.length>0?t.split(r):[],i=s.findIndex(d=>/^catalog\s*:\s*$/.test(d));if(i===-1){const d=["catalog:"];for(const y of n)d.push(` ${y.depName}: "${y.specifier}"`);let g=0;for(;g<s.length&&(s[g]??"").trim().length===0;)g+=1;const h=[...s.slice(0,g),...d,"",...s.slice(g)].join(r);return z(o,h.endsWith(r)?h:`${h}${r}`),o}let p=s.length;const c=new Set;for(let d=i+1;d<s.length;d+=1){const g=s[d]??"",h=g.trimStart();if(g.length===0)continue;if(g.length-h.length===0&&h.length>0&&!h.startsWith("#")){p=d;break}const y=/^([\w./@-]+)\s*:/.exec(h);y?.[1]&&c.add(y[1])}const f=[];for(const d of n)c.has(d.depName)||f.push(` ${d.depName}: "${d.specifier}"`);if(f.length===0)return;const m=[...s.slice(0,p),...f,...s.slice(p)].join(r);return z(o,m.endsWith(r)?m:`${m}${r}`),o},De=(e,a)=>{if(a.length===0)return"";const o=j(e,"pnpm-workspace.yaml"),t=A(o)?H(o,"utf8"):"",r=[...a].sort((i,p)=>i.depName.localeCompare(p.depName)),n=["--- pnpm-workspace.yaml","+++ pnpm-workspace.yaml"],s=t.includes(`\r
@@ -1,4 +1,4 @@
1
- import{createRequire as mt}from"node:module";import{E as v,j as le,q as ke,I as fe,V as ve,s as Re}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{aX as wt,g as yt,a4 as s,a5 as u,m as r,aE as kt,B as Pe,aF as vt,aG as bt,aD as jt,s as O,ae as $t,aH as St,aI as ze,u as Ct,p as d,R as We,P as Xe,c as Ke,$ as Rt,k as At,r as It,a6 as N,j as Tt,V as Nt,N as Mt,f as Et,a3 as Je}from"./bin.js";import{m as W,f as be,a as Dt,v as Ft,A as Pt,B as Qe}from"../packem_shared/index-BDmTbWX1.js";import{E as zt}from"../packem_shared/public-api-WqUCiyIe.js";import{a as et,b as Lt}from"./config.js";import{A as tt,x as Be,N as _t,F as Gt,T as Vt,a as Ht,I as Ut,U as Yt}from"./handler65.js";import{w as it,R as qt}from"../packem_shared/pm-runner-OGResYrA.js";import{c as Wt}from"../packem_shared/runtime-check-Stc9AI78.js";import{s as Xt}from"../packem_shared/scan-progress-DG7_JmTV.js";import{l as Kt,r as Jt,f as Qt}from"../packem_shared/dependency-scan-anTuZB1t.js";import{o as st}from"../packem_shared/spinner-CV3WVJLv.js";import{F as Zt,a as ei}from"../packem_shared/tabs-BuTy5gPV.js";import{u as ti}from"../packem_shared/use-measured-height-_eVGWtWt.js";import{s as ii}from"../packem_shared/verify-6WCmFmy8.js";const xt=mt(import.meta.url),we=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,qe=e=>{if(typeof we<"u"&&we.versions&&we.versions.node){const[t,i]=we.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return we.getBuiltinModule(e)}return xt(e)},{spawnSync:Ae}=qe("node:child_process"),{rmSync:Oe,writeFileSync:Ot,statSync:Bt,readFileSync:Ze}=qe("node:fs"),Te=()=>W(yt(),"doctor"),si=1800*1e3,Le=e=>{if(!e)return"";try{return String(Bt(e).mtimeMs)}catch{return""}},ri=2,ni=e=>{const t=JSON.stringify({configMtime:Le(e.configPath),lockfileMtime:Le(e.lockfilePath),schema:ri,sections:[...e.sections].toSorted(),socketEnabled:e.socketEnabled,workspaceRoot:e.workspaceRoot});return wt(Buffer.from(t))},oi=e=>{const t=W(Te(),`${e}.json`);if(be(t))try{const i=et(t);if(Date.now()-i.createdAt>i.ttlMs){Oe(t,{force:!0});return}return{...i.results,sections:new Set(i.results.sections)}}catch{Oe(t,{force:!0});return}},li=(e,t,i=si)=>{Dt(Te());const l={createdAt:Date.now(),results:{...t,sections:[...t.sections]},ttlMs:i};Ot(W(Te(),`${e}.json`),JSON.stringify(l,void 0,2),"utf8")},$e="orphans",ai=()=>{if(process.platform!=="linux")return{id:"inotify",message:"inotify capacity check skipped (not Linux).",status:"skip"};let e;try{const t=Ze("/proc/sys/fs/inotify/max_user_watches","utf8").trim(),i=Number.parseInt(t,10);Number.isFinite(i)&&i>0&&(e=i)}catch{return{id:"inotify",message:"Could not read /proc/sys/fs/inotify/max_user_watches.",status:"warn"}}return e===void 0?{id:"inotify",message:"inotify max_user_watches reported a non-numeric value.",status:"warn"}:e<65536?{detail:{maxWatches:e},id:"inotify",message:`inotify watcher limit is ${String(e)} — large monorepos can exhaust this. Bump now with \`sudo sysctl fs.inotify.max_user_watches=524288\` and persist via \`/etc/sysctl.d/99-vis.conf\` so it survives reboot.`,status:"warn"}:{detail:{maxWatches:e},id:"inotify",message:`inotify capacity OK (${String(e)} watches).`,status:"ok"}},ci=()=>{const e=!!process.stdin.isTTY,t=!!process.stdout.isTTY;return e&&t?{id:"tty",message:"Interactive TTY available — watch keybinds enabled.",status:"ok"}:!e&&!t?{id:"tty",message:"No TTY on stdin/stdout — running in CI / piped mode (keybinds disabled).",status:"skip"}:{detail:{stdin:String(e),stdout:String(t)},id:"tty",message:e?"stdin is a TTY but stdout is not — output is being captured; keybinds still work.":"stdout is a TTY but stdin is not — keybinds disabled (input is piped).",status:"skip"}},di=()=>{const e=process.pid;try{return process.platform==="win32"?ot(e):nt(e)}catch{return[]}},ui=()=>{const e=process.pid;let t;try{t=process.platform==="win32"?ot(e):nt(e)}catch{return{id:$e,message:"Could not enumerate processes (ps/tasklist failed).",status:"warn"}}if(t.length===0)return{id:$e,message:"No orphaned vis/task-runner processes detected.",status:"ok"};if(t.length<=2)return{detail:{count:t.length,pids:t.join(",")},id:$e,message:`${String(t.length)} possibly orphaned process(es) detected (PIDs: ${t.join(", ")}). Likely benign.`,status:"skip"};const i=process.platform==="win32"?t.map(l=>`taskkill /F /PID ${String(l)}`).join(" & "):`kill ${t.join(" ")}`;return{detail:{count:t.length,pids:t.join(",")},id:"orphans",message:`${String(t.length)} possibly orphaned vis/task-runner processes — run \`vis doctor --fix\` to clean them up, or kill them manually: ${i}`,status:"warn"}},hi=(e={})=>{const t=e.enumerate??di,i=e.force===!0?"SIGKILL":"SIGTERM",l=e.kill??xi,n=t(),o=[],c=[];for(const h of n)try{l(h,i),o.push(h)}catch(a){const p=a.code??a.message;if(p==="ESRCH"){o.push(h);continue}c.push({pid:h,reason:p})}return{failed:c,killed:o}},pi=e=>Ae("taskkill",e,{encoding:"utf8"}),gi=(e,t)=>{process.kill(e,t)},fi=(e,t,i=pi)=>{const l=t==="SIGKILL"?["/F","/PID",String(e)]:["/PID",String(e)],n=i(l);if(n.error)throw n.error;if(typeof n.status=="number"&&n.status!==0){const o=n.status===128?"ESRCH":`taskkill exited with code ${String(n.status)}`,c=new Error(o);throw c.code=o,c}},mi=(e,t,i=gi)=>{i(e,t)},xi=(e,t)=>{if(process.platform==="win32"){fi(e,t);return}mi(e,t)},rt=(e,t)=>{const i=Ae(e,t,{encoding:"utf8"});if(i.error)throw i.error;if(typeof i.status=="number"&&i.status!==0)throw new Error(`${e} exited with code ${String(i.status)}`);return typeof i.stdout=="string"?i.stdout:""},nt=e=>{const t=rt("ps",["-Ao","pid=,command="]),i=[];for(const l of t.split(`
1
+ import{createRequire as mt}from"node:module";import{E as v,j as le,q as ke,I as fe,V as ve,s as Re}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{aX as wt,g as yt,a4 as s,a5 as u,m as r,aE as kt,B as Pe,aF as vt,aG as bt,aD as jt,s as O,ae as $t,aH as St,aI as ze,u as Ct,p as d,R as We,P as Xe,c as Ke,$ as Rt,d as At,r as It,a6 as N,j as Tt,V as Nt,N as Mt,f as Et,a3 as Je}from"./bin.js";import{m as W,f as be,a as Dt,v as Ft,A as Pt,B as Qe}from"../packem_shared/index-BDmTbWX1.js";import{E as zt}from"../packem_shared/public-api-WqUCiyIe.js";import{a as et,b as Lt}from"./config.js";import{A as tt,x as Be,N as _t,F as Gt,T as Vt,a as Ht,I as Ut,U as Yt}from"./handler65.js";import{w as it,R as qt}from"../packem_shared/pm-runner-OGResYrA.js";import{c as Wt}from"../packem_shared/runtime-check-Stc9AI78.js";import{s as Xt}from"../packem_shared/scan-progress-CFhc0CMj.js";import{l as Kt,r as Jt,f as Qt}from"../packem_shared/dependency-scan-DnTgYleU.js";import{o as st}from"../packem_shared/spinner-CV3WVJLv.js";import{F as Zt,a as ei}from"../packem_shared/tabs-BuTy5gPV.js";import{u as ti}from"../packem_shared/use-measured-height-_eVGWtWt.js";import{s as ii}from"../packem_shared/verify-6WCmFmy8.js";const xt=mt(import.meta.url),we=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,qe=e=>{if(typeof we<"u"&&we.versions&&we.versions.node){const[t,i]=we.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return we.getBuiltinModule(e)}return xt(e)},{spawnSync:Ae}=qe("node:child_process"),{rmSync:Oe,writeFileSync:Ot,statSync:Bt,readFileSync:Ze}=qe("node:fs"),Te=()=>W(yt(),"doctor"),si=1800*1e3,Le=e=>{if(!e)return"";try{return String(Bt(e).mtimeMs)}catch{return""}},ri=2,ni=e=>{const t=JSON.stringify({configMtime:Le(e.configPath),lockfileMtime:Le(e.lockfilePath),schema:ri,sections:[...e.sections].toSorted(),socketEnabled:e.socketEnabled,workspaceRoot:e.workspaceRoot});return wt(Buffer.from(t))},oi=e=>{const t=W(Te(),`${e}.json`);if(be(t))try{const i=et(t);if(Date.now()-i.createdAt>i.ttlMs){Oe(t,{force:!0});return}return{...i.results,sections:new Set(i.results.sections)}}catch{Oe(t,{force:!0});return}},li=(e,t,i=si)=>{Dt(Te());const l={createdAt:Date.now(),results:{...t,sections:[...t.sections]},ttlMs:i};Ot(W(Te(),`${e}.json`),JSON.stringify(l,void 0,2),"utf8")},$e="orphans",ai=()=>{if(process.platform!=="linux")return{id:"inotify",message:"inotify capacity check skipped (not Linux).",status:"skip"};let e;try{const t=Ze("/proc/sys/fs/inotify/max_user_watches","utf8").trim(),i=Number.parseInt(t,10);Number.isFinite(i)&&i>0&&(e=i)}catch{return{id:"inotify",message:"Could not read /proc/sys/fs/inotify/max_user_watches.",status:"warn"}}return e===void 0?{id:"inotify",message:"inotify max_user_watches reported a non-numeric value.",status:"warn"}:e<65536?{detail:{maxWatches:e},id:"inotify",message:`inotify watcher limit is ${String(e)} — large monorepos can exhaust this. Bump now with \`sudo sysctl fs.inotify.max_user_watches=524288\` and persist via \`/etc/sysctl.d/99-vis.conf\` so it survives reboot.`,status:"warn"}:{detail:{maxWatches:e},id:"inotify",message:`inotify capacity OK (${String(e)} watches).`,status:"ok"}},ci=()=>{const e=!!process.stdin.isTTY,t=!!process.stdout.isTTY;return e&&t?{id:"tty",message:"Interactive TTY available — watch keybinds enabled.",status:"ok"}:!e&&!t?{id:"tty",message:"No TTY on stdin/stdout — running in CI / piped mode (keybinds disabled).",status:"skip"}:{detail:{stdin:String(e),stdout:String(t)},id:"tty",message:e?"stdin is a TTY but stdout is not — output is being captured; keybinds still work.":"stdout is a TTY but stdin is not — keybinds disabled (input is piped).",status:"skip"}},di=()=>{const e=process.pid;try{return process.platform==="win32"?ot(e):nt(e)}catch{return[]}},ui=()=>{const e=process.pid;let t;try{t=process.platform==="win32"?ot(e):nt(e)}catch{return{id:$e,message:"Could not enumerate processes (ps/tasklist failed).",status:"warn"}}if(t.length===0)return{id:$e,message:"No orphaned vis/task-runner processes detected.",status:"ok"};if(t.length<=2)return{detail:{count:t.length,pids:t.join(",")},id:$e,message:`${String(t.length)} possibly orphaned process(es) detected (PIDs: ${t.join(", ")}). Likely benign.`,status:"skip"};const i=process.platform==="win32"?t.map(l=>`taskkill /F /PID ${String(l)}`).join(" & "):`kill ${t.join(" ")}`;return{detail:{count:t.length,pids:t.join(",")},id:"orphans",message:`${String(t.length)} possibly orphaned vis/task-runner processes — run \`vis doctor --fix\` to clean them up, or kill them manually: ${i}`,status:"warn"}},hi=(e={})=>{const t=e.enumerate??di,i=e.force===!0?"SIGKILL":"SIGTERM",l=e.kill??xi,n=t(),o=[],c=[];for(const h of n)try{l(h,i),o.push(h)}catch(a){const p=a.code??a.message;if(p==="ESRCH"){o.push(h);continue}c.push({pid:h,reason:p})}return{failed:c,killed:o}},pi=e=>Ae("taskkill",e,{encoding:"utf8"}),gi=(e,t)=>{process.kill(e,t)},fi=(e,t,i=pi)=>{const l=t==="SIGKILL"?["/F","/PID",String(e)]:["/PID",String(e)],n=i(l);if(n.error)throw n.error;if(typeof n.status=="number"&&n.status!==0){const o=n.status===128?"ESRCH":`taskkill exited with code ${String(n.status)}`,c=new Error(o);throw c.code=o,c}},mi=(e,t,i=gi)=>{i(e,t)},xi=(e,t)=>{if(process.platform==="win32"){fi(e,t);return}mi(e,t)},rt=(e,t)=>{const i=Ae(e,t,{encoding:"utf8"});if(i.error)throw i.error;if(typeof i.status=="number"&&i.status!==0)throw new Error(`${e} exited with code ${String(i.status)}`);return typeof i.stdout=="string"?i.stdout:""},nt=e=>{const t=rt("ps",["-Ao","pid=,command="]),i=[];for(const l of t.split(`
2
2
  `)){if(l.length===0)continue;const n=/^\s*(\d+)\s+(.+)$/.exec(l);if(!n)continue;const o=Number.parseInt(n[1]??"",10),c=(n[2]??"").toLowerCase();!Number.isFinite(o)||o===e||(/(?:^|[ /])vis-native(?:\s|$|[-.])/.test(c)||/(?:^|[ /])vis\s+run\b/.test(c)||/(?:^|[ /])task-runner(?:\s|$|[-.])/.test(c))&&i.push(o)}return i},ot=e=>{const t=rt("tasklist",["/FO","CSV","/NH"]),i=[];for(const l of t.split(/\r?\n/)){if(l.length===0)continue;const n=l.split(/","/).map(h=>h.replaceAll(/^"|"$/g,"")),o=(n[0]??"").toLowerCase(),c=Number.parseInt(n[1]??"",10);!Number.isFinite(c)||c===e||(o==="vis.exe"||o.startsWith("vis-native")||o.includes("task-runner"))&&i.push(c)}return i},wi=()=>{let e;try{const t=Ae("watchman",["--version"],{encoding:"utf8",timeout:2e3});if(t.error||typeof t.status=="number"&&t.status!==0)throw t.error??new Error("watchman exited non-zero");e=typeof t.stdout=="string"?t.stdout.trim():void 0}catch{return{id:"watchman",message:"Watchman not found — `vis` uses native fs.watch (fine for small repos). Install Watchman + `fb-watchman` to scale watch mode on large monorepos.",status:"skip"}}return{detail:e?{version:e}:void 0,id:"watchman",message:e?`Watchman available (${e}) — scalable watch backend in use.`:"Watchman available — scalable watch backend in use.",status:"ok"}},yi=(e=process.cwd())=>{let t="";try{t=Ze(W(e,".gitattributes"),"utf8")}catch(i){if(i.code!=="ENOENT")return{id:"git-lfs",message:"Could not read .gitattributes.",status:"warn"}}if(!t.includes("filter=lfs"))return{id:"git-lfs",message:"No Git LFS tracking declared in .gitattributes.",status:"skip"};try{const i=Ae("git",["lfs","version"],{encoding:"utf8",timeout:2e3});if(i.error||typeof i.status=="number"&&i.status!==0)throw i.error??new Error("git-lfs not available")}catch{return{id:"git-lfs",message:"Repo tracks files via Git LFS but `git-lfs` is not installed — checked-out LFS files are pointer stubs, not real content. Install git-lfs and run `git lfs pull`.",status:"warn"}}return{id:"git-lfs",message:"Git LFS tracking declared and `git-lfs` is installed.",status:"ok"}},ki=e=>[ai(),ci(),wi(),yi(e),ui()],ge=[{id:"dependencies",label:"Deps"},{id:"security",label:"Security"},{id:"optimization",label:"Optimize"},{id:"runtime",label:"Runtime"}],Ce=["dependencies","security","optimization","runtime"],he=e=>{const t=new Map;for(const i of Ce)t.set(i,[]);for(const i of e)t.get(i.section).push(i);for(const[i,l]of t)l.length===0&&t.delete(i);return t},pe=(e,t,i,l)=>{let n=e.filter(o=>o.section===t);if(l&&(n=n.filter(o=>o.severity===l)),i){const o=i.toLowerCase();n=n.filter(c=>c.title.toLowerCase().includes(o))}return[...n]},vi=e=>{const t={dependencies:"idle",optimization:"idle",runtime:"idle",security:"idle"};for(const i of Ce)e.has(i)&&(t[i]="idle");return t};class _e{#e;#i=new Set;constructor(t=[]){const i=Array.isArray(t)?{findings:t}:t,l=i.findings??[],n=i.activeSections??new Set(Ce),o=Ce.find(a=>n.has(a))??"dependencies",c=pe(l,o,"",void 0),h=vi(n);if(l.length>0)for(const a of l)h[a.section]="done";this.#e={all:l,entries:c,filterActive:!1,filterText:"",filterType:o,focusedPanel:"list",grouped:he(c),pendingAction:void 0,sectionError:{},sectionMessage:{},sectionStatus:h,selectedIndex:0,severityFilter:void 0}}getSnapshot=()=>this.#e;subscribe=t=>(this.#i.add(t),()=>{this.#i.delete(t)});setSelectedIndex(t){const i=Math.max(0,Math.min(t,this.#e.entries.length-1));i!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:i})}setFocusedPanel(t){t!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:t})}setFilterType(t){if(t===this.#e.filterType)return;const i=pe(this.#e.all,t,this.#e.filterText,this.#e.severityFilter);this.#t({...this.#e,entries:i,filterType:t,grouped:he(i),selectedIndex:0})}setFilter(t){const i=pe(this.#e.all,this.#e.filterType,t,this.#e.severityFilter);this.#t({...this.#e,entries:i,filterText:t,grouped:he(i),selectedIndex:0})}setFilterActive(t){if(t===this.#e.filterActive)return;if(t){this.#t({...this.#e,filterActive:!0});return}const i=pe(this.#e.all,this.#e.filterType,"",this.#e.severityFilter);this.#t({...this.#e,entries:i,filterActive:!1,filterText:"",grouped:he(i),selectedIndex:0})}setPendingAction(t){this.#t({...this.#e,pendingAction:t})}setSeverityFilter(t){if(t===this.#e.severityFilter)return;const i=pe(this.#e.all,this.#e.filterType,this.#e.filterText,t);this.#t({...this.#e,entries:i,grouped:he(i),selectedIndex:0,severityFilter:t})}startSection(t,i){this.#t({...this.#e,sectionMessage:{...this.#e.sectionMessage,[t]:i},sectionStatus:{...this.#e.sectionStatus,[t]:"running"}})}completeSection(t,i){const l=[...this.#e.all,...i],n=pe(l,this.#e.filterType,this.#e.filterText,this.#e.severityFilter),o={...this.#e.sectionMessage};delete o[t],this.#t({...this.#e,all:l,entries:n,grouped:he(n),sectionMessage:o,sectionStatus:{...this.#e.sectionStatus,[t]:"done"}})}failSection(t,i){this.#t({...this.#e,sectionError:{...this.#e.sectionError,[t]:i},sectionStatus:{...this.#e.sectionStatus,[t]:"error"}})}#t(t){this.#e=t;for(const i of this.#i)try{i()}catch{}}}const Ge={error:0,warn:1},bi=e=>!!e.acceptedRisk,lt=e=>{const t=[];if(e.sections.has("dependencies")){for(const i of e.outdated)t.push({entry:i,id:`outdated:${i.packageName}`,kind:"outdated",section:"dependencies",severity:"warn",subtitle:`${i.currentRange} → ${i.newRange} (${i.updateType})`,title:i.packageName});for(const i of e.duplicates)t.push({id:`duplicate:${i.name}`,kind:"duplicate",pkg:i,section:"dependencies",severity:"warn",subtitle:`${String(i.versions.length)} versions installed`,title:i.name})}if(e.sections.has("security"))for(const i of e.outdated){if(i.vulnerabilities&&i.vulnerabilities.length>0){const l=i.vulnerabilities[0],n=bi(i)?"warn":"error",o=i.vulnerabilities.length;t.push({entry:i,id:`vuln:${i.packageName}`,kind:"vulnerability",packageName:i.packageName,section:"security",severity:n,subtitle:o===1?`${l.severity} · ${l.id}`:`${String(o)} advisories · top: ${l.severity} ${l.id}`,title:i.packageName})}if(i.socketReport&&i.socketReport.alerts.length>0){const l=Math.round(i.socketReport.score.overall*100);t.push({entry:i,id:`socket:${i.packageName}`,kind:"socket",packageName:i.packageName,section:"security",severity:"warn",subtitle:`${String(i.socketReport.alerts.length)} alert${i.socketReport.alerts.length===1?"":"s"} · score ${String(l)}%`,title:i.packageName})}}if(e.sections.has("optimization"))for(const i of e.optimizations)t.push({entry:i,id:`opt:${i.packageName}`,kind:"optimization",section:"optimization",severity:"warn",subtitle:`${i.category} → ${i.replacement}`,title:i.packageName});if(e.sections.has("runtime"))for(const i of e.runtime)i.status==="warn"&&t.push({diagnostic:i,id:`runtime:${i.id}`,kind:"runtime",section:"runtime",severity:"warn",title:i.message});return t.sort((i,l)=>{if(i.section!==l.section){const n=["dependencies","security","optimization","runtime"];return n.indexOf(i.section)-n.indexOf(l.section)}return Ge[i.severity]-Ge[l.severity]}),t},at={dependencies:"Dependencies",optimization:"Optimization",runtime:"Runtime",security:"Security"},ji={error:"red",warn:"yellow"},$i={error:"✖",warn:"⚠"},Si={error:" ERROR ",warn:" WARN "},Ci=({children:e,hint:t,message:i,severity:l,title:n})=>{const o=ji[l];return s.jsxs(u,{borderColor:o,borderStyle:"single",flexDirection:"column",flexShrink:0,paddingX:1,children:[s.jsxs(u,{gap:1,children:[s.jsx(r,{backgroundColor:o,bold:!0,color:"black",children:Si[l]}),s.jsx(r,{bold:!0,color:o,children:$i[l]}),s.jsx(r,{bold:!0,wrap:"truncate-end",children:n})]}),s.jsx(r,{wrap:"truncate-end",children:i}),t?s.jsx(r,{dimColor:!0,wrap:"truncate-end",children:t}):null,e]})},Ri={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},Ai={critical:"red",high:"red",low:"gray",medium:"yellow"},Ii={major:"red",minor:"yellow",patch:"green"},C=({children:e,label:t,width:i=14})=>s.jsxs(u,{children:[s.jsx(u,{width:i,children:s.jsxs(r,{dimColor:!0,children:[t,":"]})}),typeof e=="string"?s.jsx(r,{children:e}):e]}),re=({children:e})=>s.jsx(u,{marginTop:1,children:s.jsx(r,{bold:!0,color:"white",children:e})}),Ti=({finding:e})=>{const{entry:t}=e,i=Ii[t.updateType]??"white";return s.jsxs(u,{flexDirection:"column",children:[s.jsx(C,{label:"Current",children:t.currentRange}),s.jsxs(C,{label:"Target",children:[s.jsx(r,{children:t.newRange}),s.jsxs(r,{bold:!0,color:i,children:[" (",t.updateType,")"]})]}),s.jsx(C,{label:"Catalog",children:t.catalogName}),t.acceptedRisk?s.jsx(C,{label:"Risk ack",children:s.jsx(r,{dimColor:!0,children:t.acceptedRisk.reason??"(no reason recorded)"})}):null,s.jsx(re,{children:"Action"}),s.jsxs(r,{dimColor:!0,children:["Run"," ",s.jsx(r,{bold:!0,color:"white",children:"vis update"})," ","to apply this change."]})]})},Ni=({finding:e})=>s.jsxs(u,{flexDirection:"column",children:[s.jsx(C,{label:"Versions",children:s.jsx(r,{children:String(e.pkg.versions.length)})}),s.jsx(re,{children:"Installed versions"}),e.pkg.versions.map(t=>s.jsxs(r,{children:[" · ",t]},t)),s.jsx(re,{children:"Action"}),s.jsxs(r,{dimColor:!0,children:["Run"," ",s.jsx(r,{bold:!0,color:"white",children:"vis dedupe"})," ","to consolidate to a single resolution."]})]}),Mi=({finding:e})=>{const t=e.entry.vulnerabilities??[];return s.jsxs(u,{flexDirection:"column",children:[s.jsx(C,{label:"Package",children:e.packageName}),s.jsx(C,{label:"Current",children:e.entry.currentRange}),s.jsx(C,{label:"Advisories",children:String(t.length)}),e.entry.acceptedRisk?s.jsx(C,{label:"Risk ack",children:s.jsx(r,{dimColor:!0,children:e.entry.acceptedRisk.reason??"(no reason recorded)"})}):null,t.map(i=>{const l=Ri[i.severity]??"gray";return s.jsxs(u,{flexDirection:"column",marginTop:1,children:[s.jsxs(u,{children:[s.jsx(r,{bold:!0,color:l,children:i.severity}),s.jsx(r,{children:" "}),s.jsx(r,{children:i.id}),typeof i.cvssScore=="number"?s.jsxs(r,{dimColor:!0,children:[" · CVSS ",i.cvssScore.toFixed(1)]}):null]}),s.jsx(r,{wrap:"wrap",children:i.summary}),i.fixedVersions.length>0?s.jsxs(r,{dimColor:!0,children:["Fixed in: ",i.fixedVersions.join(", ")]}):null,i.aliases&&i.aliases.length>0?s.jsxs(r,{dimColor:!0,children:["Aliases: ",i.aliases.join(", ")]}):null]},i.id)})]})},Ei=({finding:e})=>{const t=e.entry.socketReport;if(!t)return s.jsx(r,{dimColor:!0,children:"No Socket report attached."});const i=Math.round(t.score.overall*100),l=Pe(t.score.overall);return s.jsxs(u,{flexDirection:"column",children:[s.jsx(C,{label:"Package",children:e.packageName}),s.jsx(C,{label:"Overall",children:s.jsxs(r,{color:l,children:[String(i),"%"]})}),s.jsx(C,{label:"Alerts",children:String(t.alerts.length)}),e.entry.acceptedRisk?s.jsx(C,{label:"Risk ack",children:s.jsx(r,{dimColor:!0,children:e.entry.acceptedRisk.reason??"(no reason recorded)"})}):null,s.jsx(re,{children:"Score breakdown"}),Object.entries(t.score).map(([n,o])=>{if(n==="overall")return null;const c=typeof o=="number"?o:0,h=Math.round(c*100),a=Pe(c);return s.jsxs(u,{children:[s.jsx(u,{width:14,children:s.jsxs(r,{dimColor:!0,children:[n,":"]})}),s.jsxs(r,{color:a,children:[String(h),"%"]})]},n)}),s.jsx(re,{children:"Alerts"}),t.alerts.map((n,o)=>{const c=Ai[n.severity]??"gray";return s.jsxs(u,{flexDirection:"column",marginBottom:1,children:[s.jsxs(u,{children:[s.jsx(r,{bold:!0,color:c,children:n.severity}),s.jsx(r,{children:" "}),s.jsx(r,{children:n.type})]}),n.props?s.jsx(r,{dimColor:!0,wrap:"wrap",children:JSON.stringify(n.props)}):null]},`${n.type}-${String(o)}`)})]})},Di=({finding:e})=>{const{entry:t}=e;return s.jsxs(u,{flexDirection:"column",children:[s.jsx(C,{label:"Package",children:t.packageName}),s.jsx(C,{label:"Category",children:t.category}),s.jsx(C,{label:"Replacement",children:t.replacement}),t.overrideSpec?s.jsx(C,{label:"Override",children:t.overrideSpec}):null,s.jsx(C,{label:"Codemod",children:s.jsx(r,{color:t.hasCodemod?"green":"gray",children:t.hasCodemod?"available":"not available"})}),t.docUrl?s.jsx(C,{label:"Guide",children:s.jsx(r,{color:"cyan",underline:!0,children:t.docUrl})}):null,s.jsx(re,{children:"Action"}),t.hasCodemod?s.jsxs(r,{dimColor:!0,children:["Run"," ",s.jsx(r,{bold:!0,color:"white",children:"vis optimize"})," ","to apply the codemod interactively."]}):t.overrideSpec?s.jsxs(r,{dimColor:!0,children:["Run"," ",s.jsx(r,{bold:!0,color:"white",children:"vis optimize"})," ","to install the package override."]}):t.docUrl?s.jsx(r,{dimColor:!0,children:"No automated codemod. Open the migration guide above for the recommended alternative and steps."}):s.jsx(r,{dimColor:!0,children:"No automated codemod. Consult the package's docs or the e18e module-replacements guide for an alternative."})]})},Fi=({finding:e})=>{const{diagnostic:t}=e,i=t.status==="warn"?"yellow":t.status==="ok"?"green":"gray";return s.jsxs(u,{flexDirection:"column",children:[s.jsx(C,{label:"Check",children:t.id}),s.jsx(C,{label:"Status",children:s.jsx(r,{color:i,children:t.status})}),s.jsx(re,{children:"Message"}),s.jsx(r,{wrap:"wrap",children:t.message}),t.detail&&Object.keys(t.detail).length>0?s.jsxs(s.Fragment,{children:[s.jsx(re,{children:"Details"}),Object.entries(t.detail).map(([l,n])=>s.jsxs(u,{children:[s.jsx(u,{width:20,children:s.jsxs(r,{dimColor:!0,children:[l,":"]})}),s.jsx(r,{children:String(n)})]},l))]}):null]})},Pi=({finding:e,focused:t,scrollRef:i})=>{const l=t?"white":"gray";if(!e)return s.jsx(u,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:s.jsx(r,{dimColor:!0,children:"No finding selected"})});let n;switch(e.kind){case"duplicate":{n=s.jsx(Ni,{finding:e});break}case"optimization":{n=s.jsx(Di,{finding:e});break}case"outdated":{n=s.jsx(Ti,{finding:e});break}case"runtime":{n=s.jsx(Fi,{finding:e});break}case"socket":{n=s.jsx(Ei,{finding:e});break}case"vulnerability":{n=s.jsx(Mi,{finding:e});break}default:{n=s.jsx(r,{dimColor:!0,children:"Unknown finding kind."});break}}return s.jsxs(u,{borderColor:l,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[s.jsxs(u,{flexShrink:0,paddingTop:1,paddingX:2,children:[s.jsx(r,{bold:!0,color:"white",children:e.title}),s.jsxs(r,{dimColor:!0,children:[" ",at[e.section]]})]}),s.jsxs(kt,{flexGrow:1,flexShrink:1,paddingX:2,ref:i,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[s.jsx(r,{}),n]})]})},ct={error:"red",warn:"yellow"},zi={error:"✖",warn:"⚠"},Oi=e=>e.kind==="outdated"||e.kind==="vulnerability"||e.kind==="socket"?!!e.entry.acceptedRisk:!1,Bi=({finding:e,isSelected:t})=>{const i=ct[e.severity],l=Oi(e);return s.jsxs(u,{flexShrink:0,height:1,children:[s.jsx(r,{children:t?">":" "}),s.jsxs(r,{color:i,children:[" ",zi[e.severity]," "]}),s.jsx(u,{flexGrow:1,children:s.jsx(r,{bold:t,inverse:t,wrap:"truncate",children:e.title})}),l?s.jsx(r,{color:"cyan",children:" ack"}):null,e.subtitle?s.jsxs(r,{dimColor:!0,wrap:"truncate",children:[" ",e.subtitle]}):null]})},Li=({count:e,section:t})=>s.jsxs(u,{flexShrink:0,height:1,marginTop:1,children:[s.jsx(r,{dimColor:!0,children:"▼ "}),s.jsx(r,{bold:!0,color:"white",children:at[t].toUpperCase()}),s.jsxs(r,{dimColor:!0,children:[" (",e,")"]})]}),_i=({count:e,label:t,status:i})=>s.jsxs(r,{children:[t,i==="running"?s.jsxs(r,{children:[" ",s.jsx(st,{type:"dots"})]}):null,i==="error"?s.jsx(r,{bold:!0,color:"red",children:" ✖"}):s.jsxs(r,{dimColor:!0,children:[" (",String(e),")"]})]}),Gi=({elapsedMs:e,entries:t,filterActive:i,filterText:l,filterType:n,focused:o,fromCache:c=!1,grouped:h,onViewportHeightChange:a,scrollOffset:p,sectionCounts:w,sectionMessage:j,sectionStatus:k,selectedIndex:D,severityFilter:$,totalAll:f,viewportHeight:A})=>{const M=o?"white":"gray",{measuredHeight:F,ref:E}=ti(A,a);let R=0,P=0;for(const b of t)b.severity==="error"?R+=1:b.severity==="warn"&&(P+=1);const Y=[];R>0&&Y.push(`${String(R)} error${R===1?"":"s"}`),P>0&&Y.push(`${String(P)} warn${P===1?"":"s"}`);const Z=Y.length>0?` (${Y.join(", ")})`:"",ee=(e/1e3).toFixed(1),q=[];for(const[b,S]of h){q.push(s.jsx(Li,{count:S.length,section:b},`hdr-${b}`));for(const _ of S){const G=t.indexOf(_);q.push(s.jsx(Bi,{finding:_,isSelected:G===D},_.id))}}let B=0;for(const[,b]of h)B+=2+b.length;const L=B>F&&F>0;return s.jsxs(u,{borderColor:M,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[s.jsxs(u,{flexShrink:0,gap:1,paddingX:1,children:[s.jsx(r,{bold:!0,inverse:!0,children:" DOCTOR "}),s.jsxs(r,{wrap:"truncate",children:[t.length,t.length===f?"":`/${String(f)}`," finding",t.length===1?"":"s",Z]}),$?s.jsx(r,{bold:!0,color:ct[$],inverse:!0,children:` ${$.toUpperCase()} ONLY `}):null,c?s.jsx(r,{bold:!0,color:"cyan",inverse:!0,children:" CACHED "}):null,s.jsxs(r,{dimColor:!0,children:[" · ",ee,"s"]})]}),s.jsx(u,{flexShrink:0,paddingX:1,paddingY:1,children:s.jsx(Zt,{isFocused:o,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:()=>{},showIndex:!1,value:n,children:ge.map(({id:b,label:S})=>s.jsx(ei,{name:b,children:s.jsx(_i,{count:w[b],label:S,status:k[b]})},b))})}),(()=>{const b=Object.keys(k).filter(S=>k[S]==="running"&&j[S]).map(S=>j[S]);return b.length===0?null:s.jsx(u,{flexShrink:0,paddingX:1,children:s.jsxs(r,{dimColor:!0,wrap:"truncate",children:[s.jsx(st,{type:"dots"})," ",b.join(" · ")]})})})(),i&&s.jsxs(u,{flexShrink:0,paddingX:1,children:[s.jsx(r,{bold:!0,color:"white",children:"/ "}),s.jsx(r,{children:l}),s.jsx(r,{inverse:!0,children:" "})]}),s.jsxs(u,{flexDirection:"row",flexGrow:1,overflow:"hidden",ref:E,children:[s.jsx(u,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:s.jsx(u,{flexDirection:"column",marginTop:-p,children:q.length>0?q:s.jsx(u,{marginTop:1,children:s.jsx(r,{dimColor:!0,children:"No findings match the current filter."})})})}),L&&s.jsx(u,{flexShrink:0,marginLeft:1,marginRight:1,children:s.jsx(vt,{contentHeight:B,placement:"inset",scrollOffset:p,style:"block",viewportHeight:F})})]},`list-${n}-${l}`)]})},Vi=e=>{if(e.kind==="outdated")return{command:`vis update ${e.entry.packageName}`,description:`Update ${e.entry.packageName} to ${e.entry.newRange}`};if(e.kind==="duplicate")return{command:`vis dedupe ${e.pkg.name}`,description:`Dedupe ${e.pkg.name} (${String(e.pkg.versions.length)} versions)`}},Hi=e=>{if(e.kind==="optimization")return{command:`vis optimize ${e.entry.packageName}`,description:`Replace ${e.entry.packageName} with ${e.entry.replacement}`}},Ui=e=>{if(e.kind!=="outdated"&&e.kind!=="vulnerability"&&e.kind!=="socket")return;const t=e.kind==="outdated"?e.entry.packageName:e.packageName,i=["// Add to vis.config.ts:","security: {"," acceptedRisks: {",` "${t}": {`,' reason: "explain why this risk is acceptable",',' expiresAt: "YYYY-MM-DD",'," },"," },","},"].join(`
3
3
  `);return{command:i,configSnippet:i,description:`Acknowledge risk for ${t}`}},Yi=100,qi=40,Wi=10,Xi=({autoExitSeconds:e=0,banner:t,fromCache:i=!1,startedAt:l,store:n})=>{const{exit:o}=bt(),{columns:c,rows:h}=jt(),a=O.useSyncExternalStore(n.subscribe,n.getSnapshot),[p,w]=O.useState(!1),[j,k]=O.useState(!1),[D,$]=O.useState(0),[f,A]=O.useState(()=>Date.now());O.useEffect(()=>{const x=setInterval(()=>{A(Date.now())},1e3);return()=>{clearInterval(x)}},[]);const M=f-l,F=O.useRef(null),E=O.useRef(null),R=a.entries[a.selectedIndex]??null,P=O.useMemo(()=>{const x={dependencies:0,optimization:0,runtime:0,security:0};for(const m of a.all)x[m.section]+=1;return x},[a.all]),Y=t?t.hint?5:4:0,Z=O.useMemo(()=>{for(const x of Object.keys(a.sectionStatus))if(a.sectionStatus[x]==="running"&&a.sectionMessage[x])return 1;return 0},[a.sectionStatus,a.sectionMessage]),ee=c>=Yi,q=ee?Math.max(1,h-Y-2):Math.floor(h*.55),B=Math.max(1,q-6-Z-(a.filterActive?1:0)),[L,b]=O.useState(B),S=L>0?L:B,_=O.useMemo(()=>{let x=0;for(const[,m]of a.grouped)x+=2+m.length;return x},[a.grouped]),G=Math.max(0,_-S),V=Math.min(D,G),ne=O.useCallback(x=>{let m=0,y=0;for(const[,xe]of a.grouped){m+=2;for(let oe=0;oe<xe.length;oe++){if(y===x)return m;m+=1,y+=1}}return m},[a.grouped]),Q=O.useCallback(x=>{const m=ne(x);$(y=>m>y+S-2?Math.min(G,Math.max(0,m-S+2)):m<y+1?Math.max(0,m-1):y)},[ne,S,G]);if(O.useEffect(()=>{E.current?.scrollToTop()},[R?.id]),$t((x,m)=>{if(x==="c"&&m.ctrl){o();return}if(!j){if(p){m.escape||x==="?"?w(!1):x==="q"?(w(!1),k(!0)):m.downArrow||x==="j"?F.current?.scrollBy(1):(m.upArrow||x==="k")&&F.current?.scrollBy(-1);return}if(x==="?"){w(!0);return}if(x==="q"){k(!0);return}if(m.tab){n.setFocusedPanel(a.focusedPanel==="list"?"detail":"list");return}if(a.filterActive){if(m.escape||m.return){n.setFilterActive(!1);return}if(m.backspace){$(0),n.setFilter(a.filterText.slice(0,-1));return}x&&!m.ctrl&&!m.meta&&($(0),n.setFilter(a.filterText+x));return}if(a.focusedPanel==="list"&&(m.leftArrow||m.rightArrow)){const y=ge.findIndex(oe=>oe.id===a.filterType),xe=m.rightArrow?(y+1)%ge.length:(y-1+ge.length)%ge.length;$(0),E.current?.scrollToTop(),n.setFilterType(ge[xe].id);return}if(a.focusedPanel==="list"){if(m.downArrow||x==="j"){const y=Math.min(a.selectedIndex+1,a.entries.length-1);n.setSelectedIndex(y),Q(y);return}if(m.upArrow||x==="k"){const y=Math.max(a.selectedIndex-1,0);n.setSelectedIndex(y),Q(y);return}if(m.pageDown){const y=Math.min(a.selectedIndex+10,a.entries.length-1);n.setSelectedIndex(y),Q(y);return}if(m.pageUp){const y=Math.max(a.selectedIndex-10,0);n.setSelectedIndex(y),Q(y);return}if(m.home){n.setSelectedIndex(0),$(0);return}if(m.end){const y=a.entries.length-1;n.setSelectedIndex(y),Q(y);return}if(x==="/"){n.setFilterActive(!0);return}if(x==="e"){n.setSeverityFilter(a.severityFilter==="error"?void 0:"error"),$(0);return}if(x==="w"){n.setSeverityFilter(a.severityFilter==="warn"?void 0:"warn"),$(0);return}if(x==="u"&&R){const y=Vi(R);y&&(n.setPendingAction(y),o());return}if(x==="o"&&R){const y=Hi(R);y&&(n.setPendingAction(y),o());return}if(x==="a"&&R){const y=Ui(R);y&&(n.setPendingAction(y),o());return}if(x==="d"){n.setFocusedPanel("detail");return}return}if(m.escape||m.leftArrow){n.setFocusedPanel("list");return}if(m.downArrow||x==="j"){E.current?.scrollBy(1);return}if(m.upArrow||x==="k"){E.current?.scrollBy(-1);return}if(m.pageDown){E.current?.scrollBy(10);return}if(m.pageUp){E.current?.scrollBy(-10);return}if(m.home){E.current?.scrollToTop();return}m.end&&E.current?.scrollToBottom()}},{isActive:!0}),c<qi||h<Wi)return s.jsx(u,{alignItems:"center",height:h,justifyContent:"center",width:c,children:s.jsxs(r,{color:"yellow",children:["Terminal too small (",c,"x",h,")"]})});const z=a.focusedPanel==="detail",H=[s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"q"}),s.jsx(r,{dimColor:!0,children:"QUIT"})]},"q"),s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"?"}),s.jsx(r,{dimColor:!0,children:"HELP"})]},"?"),s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"↑↓"}),s.jsx(r,{dimColor:!0,children:z?"SCROLL":"NAV"})]},"nav"),z?s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"←/Esc"}),s.jsx(r,{dimColor:!0,children:"LIST"})]},"lr"):s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"←→"}),s.jsx(r,{dimColor:!0,children:"SECTION"})]},"lr"),s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"/"}),s.jsx(r,{dimColor:!0,children:"SEARCH"})]},"search"),s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"e/w"}),s.jsx(r,{dimColor:!0,children:"SEVERITY"})]},"sev"),s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"u/o/a"}),s.jsx(r,{dimColor:!0,children:"ACTION"})]},"actions"),s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"Tab"}),s.jsx(r,{dimColor:!0,children:"PANEL"})]},"tab")],te=s.jsx(u,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:s.jsx(u,{gap:2,overflow:"hidden",paddingX:1,children:H})}),ce=s.jsxs(St,{footer:s.jsxs(r,{dimColor:!0,children:[s.jsx(r,{bold:!0,color:"white",children:"↑↓"})," scroll ",s.jsx(r,{bold:!0,color:"white",children:"?"}),"/",s.jsx(r,{bold:!0,color:"white",children:"Esc"})," close"]}),scrollRef:F,title:"DOCTOR — KEYBOARD SHORTCUTS",visible:p,width:56,children:[s.jsxs(u,{flexDirection:"column",marginBottom:1,children:[s.jsxs(u,{marginBottom:1,children:[s.jsx(r,{dimColor:!0,children:"── "}),s.jsx(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),s.jsxs(u,{children:[s.jsx(u,{width:26,children:s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" ↑/k "}),s.jsx(r,{dimColor:!0,children:"Move up"})]})}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" ↓/j "}),s.jsx(r,{dimColor:!0,children:"Move down"})]})]}),s.jsxs(u,{children:[s.jsx(u,{width:26,children:s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" PgUp"}),s.jsx(r,{dimColor:!0,children:" Jump up 10"})]})}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" PgDn"}),s.jsx(r,{dimColor:!0,children:" Jump down 10"})]})]}),s.jsxs(u,{children:[s.jsx(u,{width:26,children:s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" Home"}),s.jsx(r,{dimColor:!0,children:" Jump to top"})]})}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" End"}),s.jsx(r,{dimColor:!0,children:" Jump to bottom"})]})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" Tab"}),s.jsx(r,{dimColor:!0,children:" Switch panel"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" →/←"}),s.jsx(r,{dimColor:!0,children:" Section tabs (list) / Focus list (detail)"})]})]}),s.jsxs(u,{flexDirection:"column",marginBottom:1,children:[s.jsxs(u,{marginBottom:1,children:[s.jsx(r,{dimColor:!0,children:"── "}),s.jsx(r,{bold:!0,color:"white",children:"FILTER"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" /"}),s.jsx(r,{dimColor:!0,children:" Open text filter (Esc/Enter to close)"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" e"}),s.jsx(r,{dimColor:!0,children:" Toggle errors-only filter"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" w"}),s.jsx(r,{dimColor:!0,children:" Toggle warns-only filter"})]})]}),s.jsxs(u,{flexDirection:"column",marginBottom:1,children:[s.jsxs(u,{marginBottom:1,children:[s.jsx(r,{dimColor:!0,children:"── "}),s.jsx(r,{bold:!0,color:"white",children:"ACTIONS"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" u"}),s.jsx(r,{dimColor:!0,children:" Exit + suggest update / dedupe command"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" o"}),s.jsx(r,{dimColor:!0,children:" Exit + suggest optimize command"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" a"}),s.jsx(r,{dimColor:!0,children:" Exit + print risk-ack snippet"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" d"}),s.jsx(r,{dimColor:!0,children:" Focus detail panel"})]})]}),s.jsxs(u,{flexDirection:"column",children:[s.jsxs(u,{marginBottom:1,children:[s.jsx(r,{dimColor:!0,children:"── "}),s.jsx(r,{bold:!0,color:"white",children:"EXIT"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" q"}),s.jsx(r,{dimColor:!0,children:" Quit (with countdown)"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" Ctrl+C"}),s.jsx(r,{dimColor:!0,children:" Quit immediately"})]})]})]}),de=s.jsx(Gi,{elapsedMs:M,entries:a.entries,filterActive:a.filterActive,filterText:a.filterText,filterType:a.filterType,focused:a.focusedPanel==="list",fromCache:i,grouped:a.grouped,onViewportHeightChange:b,scrollOffset:V,sectionCounts:P,sectionMessage:a.sectionMessage,sectionStatus:a.sectionStatus,selectedIndex:a.selectedIndex,severityFilter:a.severityFilter,totalAll:a.all.length,viewportHeight:S}),ue=t?s.jsx(Ci,{hint:t.hint,message:t.message,severity:t.severity,title:t.title}):null,me=s.jsx(Pi,{finding:R,focused:a.focusedPanel==="detail",scrollRef:E});if(ee){const x=Math.floor(c*.4);return s.jsxs(u,{flexDirection:"column",height:h,width:c,children:[ue,s.jsxs(u,{flexDirection:"row",flexGrow:1,children:[s.jsx(u,{flexGrow:1,children:de}),s.jsx(u,{width:x,children:me})]}),te,s.jsx(ze,{autoExitSeconds:e||3,onCancel:()=>{k(!1)},visible:j}),ce]})}return s.jsxs(u,{flexDirection:"column",height:h,width:c,children:[ue,s.jsx(u,{height:q,children:de}),s.jsx(u,{flexGrow:1,children:me}),te,s.jsx(ze,{autoExitSeconds:e||3,onCancel:()=>{k(!1)},visible:j}),ce]})},Ki=e=>e.replaceAll(/[$()+.?[\\\]^{|}]/g,String.raw`\$&`),Ji=e=>{const t=e.split("*").map(i=>Ki(i));return new RegExp(`^${t.join(".*")}$`,"i")},Qi=e=>e?e.split(",").map(t=>t.trim()).filter(t=>t.length>0).map(t=>Ji(t)):[],Se=(e,t)=>{for(const i of t)if(i.test(e))return!0;return!1},Zi=(e,t,i)=>{if(t.length===0)return e;const l=e.outdated.filter(p=>Se(p.packageName,t)),n=e.duplicates.filter(p=>Se(p.name,t)),o=e.optimizations.filter(p=>Se(p.packageName,t));let c=0,h=0,a=0;for(const p of l)p.vulnerabilities&&(c+=p.vulnerabilities.length),p.socketReport&&(h+=p.socketReport.alerts.length,p.socketReport.score.overall<i&&(a+=1));return{...e,duplicates:n,optimizations:o,outdated:l,socketIssues:{alerts:h,lowScore:a},vulnCount:c}},dt=(e,t)=>t.length===0?[...e]:e.filter(i=>{if(i.kind==="runtime")return!0;const l=i.kind==="duplicate"?i.pkg.name:i.kind==="outdated"||i.kind==="optimization"?i.entry.packageName:i.packageName;return Se(l,t)}),ut=["dependencies","security","optimization","runtime"],Ve=e=>{const t=new Set;if(!e)return t;for(const i of e.split(",")){const l=i.trim().toLowerCase();ut.includes(l)&&t.add(l)}return t},es=(e,t)=>{if(e!==void 0&&e!=="")return Ve(e);const i=Ve(t);return new Set(ut.filter(l=>!i.has(l)))},ht=e=>{const t={micro:0,native:0,preferred:0,socket:0,total:e.length};for(const i of e)switch(i.category){case"micro-utility":{t.micro+=1;break}case"native":{t.native+=1;break}case"preferred":{t.preferred+=1;break}case"socket":{t.socket+=1;break}}return t},se=(e,t)=>{if(!e.sections.has(t))return"skip";switch(t){case"dependencies":return e.outdated.length>0||e.duplicates.length>0?"warn":"ok";case"optimization":return e.optimizations.length>0?"warn":"ok";case"runtime":return e.runtime.some(i=>i.status==="warn")?"warn":"ok";case"security":return e.vulnCount>0||e.socketIssues.alerts>0?"error":e.socketIssues.lowScore>0?"warn":"ok";default:return"ok"}},ts=(e,t)=>{const i=ht(e.optimizations),l={dependencies:se(e,"dependencies"),optimization:se(e,"optimization"),runtime:se(e,"runtime"),security:se(e,"security")},n=new Set([...Object.values(l),e.supplyChain.status]),o=n.has("error")?"error":n.has("warn")?"warn":"ok";return{dependencies:{duplicates:e.duplicates.length,installed:e.installedCount,outdated:e.outdated.length,status:l.dependencies},elapsedMs:e.elapsedMs,optimizations:{microUtilities:i.micro,native:i.native,preferred:i.preferred,socket:i.socket,status:l.optimization,total:i.total},packageManager:t,runtime:e.runtime.map(c=>({detail:c.detail,id:c.id,message:c.message,status:c.status})),runtimeStatus:l.runtime,security:{alerts:e.socketIssues.alerts,lowScorePackages:e.socketIssues.lowScore,status:l.security,vulnerabilities:e.vulnCount},status:o,supplyChain:{findings:e.supplyChain.findings.map(c=>({detail:c.detail,label:c.label,severity:c.severity})),status:e.supplyChain.status},workspaces:e.workspaceCount}},He=(e,t)=>{const i=e.runtime.some(n=>n.status==="warn"),l=e.vulnCount>0||e.socketIssues.alerts>0;return t?l||e.outdated.length>0||e.duplicates.length>0||i:l},is=["aube-workspace.yaml","pnpm-workspace.yaml"],ye=e=>typeof e=="boolean"?e:void 0,ss=e=>{if(e==="no-downgrade"||e==="off")return e},rs=e=>{const t={allowBuildsCount:0,blockExoticSubdeps:void 0,jailBuilds:void 0,minimumReleaseAge:void 0,minimumReleaseAgeStrict:void 0,paranoid:void 0,source:void 0,strictDepBuilds:void 0,trustPolicy:void 0};for(const i of is){const l=W(e,i);if(!be(l))continue;let n;try{n=zt(Ft(l))}catch{continue}if(typeof n!="object"||n===null)continue;const o=n;return t.source=i,t.paranoid=ye(o.paranoid),t.trustPolicy=ss(o.trustPolicy),t.blockExoticSubdeps=ye(o.blockExoticSubdeps),t.jailBuilds=ye(o.jailBuilds),t.strictDepBuilds=ye(o.strictDepBuilds),t.minimumReleaseAgeStrict=ye(o.minimumReleaseAgeStrict),typeof o.minimumReleaseAge=="number"&&Number.isFinite(o.minimumReleaseAge)&&(t.minimumReleaseAge=o.minimumReleaseAge),o.allowBuilds&&typeof o.allowBuilds=="object"&&!Array.isArray(o.allowBuilds)&&(t.allowBuildsCount=Object.keys(o.allowBuilds).length),t}return t},ns=e=>e.paranoid?{...e,jailBuilds:!0,minimumReleaseAgeStrict:!0,strictDepBuilds:!0,trustPolicy:"no-downgrade"}:e,os=/^(@[\w./-]+\/[\w./-]+|[\w.-]+)@(.+)$/,ls=e=>{const t=os.exec(e);if(t)return{name:t[1],version:t[2]}},as=(e,t)=>{let i;try{if(t==="pnpm"){const n=W(e,"pnpm-workspace.yaml");be(n)&&(i=Ct(n)?.patchedDependencies)}else if(t==="bun"){const n=W(e,"package.json");be(n)&&(i=et(n)?.patchedDependencies)}}catch{return[]}if(!i||typeof i!="object")return[];const l=[];for(const[n,o]of Object.entries(i)){if(typeof o!="string"||o.length===0)continue;const c=ls(n);c&&l.push({name:c.name,patchFile:o,resolvedPatchFile:Pt(o)?o:Qe(e,o),version:c.version})}return l},cs=e=>{const t=[];for(const i of e)be(i.resolvedPatchFile)||t.push({entry:i,kind:"missing-file"});return t},Ue=e=>e.some(t=>t.severity==="error")?"error":e.some(t=>t.severity==="warn")?"warn":"ok",ds=(e,t={})=>{const i=[],l=e?.security;if(!l)return i.push({detail:"Use defineConfig() from '@visulima/vis/config' to apply secure defaults.",label:"No security config — running with the PM's native defaults",severity:"warn"}),{findings:i,status:Ue(i)};const n=l.policies?.firstSeen?.minutes,o=l.policies?.publisherChange,c=l.policies?.installScripts;n===void 0?i.push({detail:"Set security.policies.firstSeen.minutes to block packages published in the last N minutes (mitigates supply-chain attacks).",label:"policies.firstSeen.minutes is not set",severity:"warn"}):n===0?i.push({detail:"New packages can be installed immediately after publishing. Consider setting a non-zero cooldown.",label:"policies.firstSeen.minutes is explicitly 0",severity:"warn"}):i.push({label:`policies.firstSeen.minutes: ${String(n)} minutes`,severity:"ok"}),o?.mode===void 0||o.mode==="off"?i.push({detail:"Packages whose trust level has decreased will not be blocked. Consider 'no-downgrade'.",label:`policies.publisherChange.mode: ${o?.mode??"not set"}`,severity:"warn"}):i.push({label:`policies.publisherChange.mode: ${o.mode}`,severity:"ok"}),l.blockExoticSubdeps===void 0||!l.blockExoticSubdeps?i.push({detail:"Transitive dependencies can pull code from git repos or tarball URLs. Set to true to block.",label:`blockExoticSubdeps: ${String(l.blockExoticSubdeps??!1)}`,severity:"warn"}):i.push({label:"blockExoticSubdeps: true",severity:"ok"});const h=c?.allow?Object.keys(c.allow).length:0;if(h===0?i.push({detail:"Lifecycle scripts are blocked by default. List trusted packages here to opt them back in (e.g. esbuild, @prisma/client).",label:"policies.installScripts.allow: not configured",severity:"warn"}):i.push({label:`policies.installScripts.allow: ${String(h)} ${h===1?"entry":"entries"}`,severity:"ok"}),c?.strict&&h===0&&i.push({detail:"All dependencies with build scripts will be blocked. Run 'vis approve-builds' to populate the allow list.",label:"policies.installScripts.strict is on but allow is empty",severity:"error"}),t.workspaceRoot){const a=ii(t.workspaceRoot);if(a.length>0){const p=[...new Set(a.map(w=>w.tool))].sort((w,j)=>w.localeCompare(j)).join(", ");i.push({detail:"Run `vis migrate verify` for the full list, then re-run `vis migrate <tool>` to clean up.",label:`${String(a.length)} leftover ${a.length===1?"reference":"references"} to ${p}`,severity:"warn"})}}if(t.workspaceRoot&&t.packageManager==="aube"){const a=rs(t.workspaceRoot),p=ns(a),w=p.source?` (from ${p.source})`:"";p.paranoid===!0&&i.push({detail:"Forces jailBuilds, trustPolicy=no-downgrade, minimumReleaseAgeStrict, strictStoreIntegrity, and strictDepBuilds on.",label:`aube paranoid: true${w}`,severity:"ok"}),p.trustPolicy==="off"&&i.push({detail:"Trust downgrades between releases will not be blocked. Set trustPolicy: no-downgrade in aube-workspace.yaml.",label:`aube trustPolicy: off${w}`,severity:"warn"}),p.blockExoticSubdeps===!1&&i.push({detail:"Transitive deps from git+, file:, and tarball URLs will not be blocked. Re-enable with blockExoticSubdeps: true.",label:`aube blockExoticSubdeps: false${w}`,severity:"warn"}),p.minimumReleaseAge===0&&i.push({detail:"Newly published versions are not held in a cooling window. Restore with minimumReleaseAge: 1440 (24h) or higher.",label:`aube minimumReleaseAge: 0${w}`,severity:"warn"}),p.jailBuilds===!0&&i.push({label:`aube jailBuilds: true${w}`,severity:"ok"}),p.strictDepBuilds===!0&&i.push({label:`aube strictDepBuilds: true${w}`,severity:"ok"}),p.allowBuildsCount>0&&i.push({label:`aube allowBuilds: ${String(p.allowBuildsCount)} ${p.allowBuildsCount===1?"entry":"entries"}${w}`,severity:"ok"})}if(t.workspaceRoot&&t.packageManager){const a=as(t.workspaceRoot,t.packageManager);if(a.length>0){const p=cs(a);if(p.length===0)i.push({label:`patchedDependencies: ${String(a.length)} ${a.length===1?"entry":"entries"} resolved`,severity:"ok"});else for(const w of p)i.push({detail:`Referenced from ${t.packageManager==="pnpm"?"pnpm-workspace.yaml":"package.json"} but the file is not present at ${w.entry.patchFile}.`,label:`patchedDependencies: missing patch file for ${w.entry.name}@${w.entry.version}`,severity:"error"})}}return{findings:i,status:Ue(i)}},U=e=>e>=1e3?`${(e/1e3).toFixed(1)}s`:`${String(Math.round(e))}ms`,je=async(e,t,i,l)=>{if(!e)return i();e.start(t);const n=Date.now();try{const o=await i(),c=Date.now()-n,{status:h,summary:a}=l(o,c);return e.finish(t,h,a),o}catch(o){const c=Date.now()-n,h=o instanceof Error?o.message:String(o);throw e.finish(t,"error",`${h} (${U(c)})`),o}},us=(e,t)=>{const i={duplicates:t.duplicates,optimizations:t.optimizations,outdated:t.outdated,runtime:t.runtime,sections:new Set([e])};return lt(i)},Ye=async e=>{const{filterPatterns:t,installed:i,progress:l,resolveCodemods:n,sections:o,store:c,visConfig:h,workspaceRoot:a}=e,p=o.has("dependencies"),w=o.has("security"),j=o.has("optimization"),k=o.has("runtime"),D=(g,I)=>dt(us(g,I),t),$=it(a),{packageManager:f}=Xe(a),A=Be(W(a,"package.json"),!1),M=tt(a),F=new Set(A);for(const g of M){const I=Be(W(Qe(a,g),"package.json"),!1);for(const T of I)F.add(T)}const E=Tt(a),R=We(a,f),P=Ke(h?.security,{minimumScore:h?.security?.policies?.score?.minimum}),Y=h?.security?.policies?.score?.minimum??Je,Z=h?.security?.acceptedRisks,ee=_t(a,$.name),q={exclude:[],ignore:[],include:[],includeLocked:!1,includePrerelease:!1,security:!0,target:"latest"},B=p?Qt(a,$.name):[],L=j?Gt(F):[],b=j?Vt(F,ee,$,!1):[],S=new Set(L.map(g=>g.packageName)),_=b.filter(g=>!S.has(g.packageName)),G=[...L,..._],V=k?ki(a):[];c&&(p&&c.startSection("dependencies",R.size>0?"checking outdated catalog dependencies":"scanning duplicates"),w&&c.startSection("security",i.length>0?`scanning ${String(i.length)} packages for advisories`:"no installed packages to scan"),j&&c.startSection("optimization","matching e18e + socket overrides"),k&&c.startSection("runtime","running runtime diagnostics")),c&&k&&c.completeSection("runtime",D("runtime",{duplicates:[],optimizations:[],outdated:[],runtime:V}));const ne=(p||w)&&R.size>0?je(l,"outdated",()=>Nt(R,q,E,void 0,a,P,Z),(g,I)=>{const T=g.outdated.length;return{status:T>0?"warn":"ok",summary:T>0?`${String(T)} outdated · ${U(I)}`:`up to date · ${U(I)}`}}):Promise.resolve({failed:[],ignored:[],outdated:[]}),Q=w&&i.length>0?je(l,"vulnerabilities",()=>Mt(i.map(g=>({name:g.name,version:g.version}))),(g,I)=>{let T=0;for(const ie of g.values())T+=ie.length;return{status:T>0?"error":"ok",summary:T>0?`${String(T)} found · ${U(I)}`:`none found · ${U(I)}`}}):Promise.resolve(new Map),z=w&&P.length>0&&i.length>0?je(l,"socket",()=>Et(P,i.map(g=>({name:g.name,version:g.version}))),(g,I)=>{let T=0,ie=0;for(const Fe of g.values())T+=Fe.alerts.length,Fe.score.overall<Y&&(ie+=1);const De=T+ie;return{status:De>0?"warn":"ok",summary:De>0?`${String(T)} alert${T===1?"":"s"}, ${String(ie)} low-score · ${U(I)}`:`clean · ${U(I)}`}}):Promise.resolve(new Map);let H,te,ce,de;const ue=ne.catch(g=>(H=g instanceof Error?g.message:String(g),c||d.warn(`Outdated scan failed: ${H}`),{failed:[],ignored:[],outdated:[]})),me=Q.catch(g=>(te=g instanceof Error?g.message:String(g),c||d.warn(`Vulnerability scan failed: ${te}`),new Map)),x=z.catch(g=>(ce=g instanceof Error?g.message:String(g),c||d.warn(`Socket scan failed: ${ce}`),new Map)),m=c&&p?ue.then(g=>{if(H){c.failSection("dependencies",H);return}c.completeSection("dependencies",D("dependencies",{duplicates:B,optimizations:[],outdated:g.outdated,runtime:[]}))}):void 0,y=c&&w?Promise.all([ue,me,x]).then(([g])=>{const I=H??te??ce;if(I){c.failSection("security",I);return}c.completeSection("security",D("security",{duplicates:[],optimizations:[],outdated:g.outdated,runtime:[]}))}):void 0,xe=(async()=>{if(n&&j&&G.length>0&&await je(l,"codemods",async()=>(await Yt(G),G),(g,I)=>{const T=g.filter(ie=>ie.hasCodemod||ie.category==="socket").length;return{status:"ok",summary:`${String(T)} auto-fixable · ${U(I)}`}}).catch(g=>{de=g instanceof Error?g.message:String(g)}),c&&j){if(de){c.failSection("optimization",de);return}c.completeSection("optimization",D("optimization",{duplicates:[],optimizations:G,outdated:[],runtime:[]}))}})(),[oe,gt,ft]=await Promise.all([ue,me,x]);await Promise.all([m,y,xe]);let Me=0,Ee=0;if(w&&P.length>0)for(const g of ft.values())Me+=g.alerts.length,g.score.overall<Y&&(Ee+=1);let Ie=0;if(w){for(const g of oe.outdated)g.vulnerabilities&&g.vulnerabilities.length>0&&(Ie+=g.vulnerabilities.length);for(const g of gt.values())Ie+=g.length}return{duplicates:B,installedCount:i.length,optimizations:j?G:[],outdated:p?oe.outdated:[],runtime:V,sections:o,socketIssues:{alerts:Me,lowScore:Ee},supplyChain:ds(h,{packageManager:f,workspaceRoot:a}),vulnCount:Ie,workspaceCount:M.length}},hs=e=>{switch(e){case"error":return ve(N.failure);case"skip":return v(N.dash);case"warn":return Re(N.warning);default:return fe(N.success)}},ae=(e,t)=>{const i=process.stderr.columns??80,l=Math.max(20,Math.min(i-2,60)),n=N.dash.repeat(2),o=`${hs(t)} ${le(e)}`,c=o.replaceAll(/\[[0-9;]*m/g,"").length,h=Math.max(0,l-c-n.length-2);return`${n} ${o} ${v(N.dash.repeat(h))}`},J=e=>` ${fe(N.success)} ${e}`,X=e=>` ${Re(N.warning)} ${e}`,Ne=e=>` ${ve(N.failure)} ${e}`,pt=e=>` ${v(N.dash)} ${v(e)}`,K=(e,t,i)=>{const l=`${le(String(e))} ${v(t)}`;return i?`${l} ${v(`(${i})`)}`:l},ps=e=>{if(e.sections.has("dependencies")){if(d.log(""),d.log(ae("Dependencies",se(e,"dependencies"))),d.log(J(K(e.installedCount,"packages installed"))),e.outdated.length>0){const t=e.outdated.filter(o=>o.updateType==="major").length,i=e.outdated.filter(o=>o.updateType==="minor").length,l=e.outdated.filter(o=>o.updateType==="patch").length,n=[];t>0&&n.push(`${String(t)} major`),i>0&&n.push(`${String(i)} minor`),l>0&&n.push(`${String(l)} patch`),d.log(X(K(e.outdated.length,"outdated",n.join(", "))))}else d.log(J("All dependencies up to date"));e.duplicates.length>0?d.log(X(K(e.duplicates.length,"packages with duplicate versions"))):d.log(J("No duplicate dependencies"))}},gs=e=>{e.sections.has("security")&&(d.log(""),d.log(ae("Security",se(e,"security"))),e.vulnCount>0?d.log(Ne(K(e.vulnCount,`vulnerabilit${e.vulnCount===1?"y":"ies"} found`))):d.log(J("No known vulnerabilities")),e.socketIssues.alerts>0&&d.log(X(K(e.socketIssues.alerts,`Socket.dev security alert${e.socketIssues.alerts===1?"":"s"}`))),e.socketIssues.lowScore>0&&d.log(X(K(e.socketIssues.lowScore,`package${e.socketIssues.lowScore===1?"":"s"} with low security score`))),e.socketIssues.alerts===0&&e.socketIssues.lowScore===0&&e.vulnCount===0&&d.log(J("No security issues detected")))},fs=e=>{if(!e.sections.has("optimization"))return;d.log(""),d.log(ae("Optimization",se(e,"optimization")));const t=ht(e.optimizations);if(t.total===0){d.log(J("No optimizations available"));return}t.native>0&&d.log(X(K(t.native,"replaceable with native APIs"))),t.preferred>0&&d.log(X(K(t.preferred,"with lighter alternatives"))),t.micro>0&&d.log(X(K(t.micro,"trivial micro-utilities"))),t.socket>0&&d.log(X(K(t.socket,"@socketregistry overrides available")))},ms=e=>{d.log(""),d.log(ae("Supply Chain",e.supplyChain.status));for(const t of e.supplyChain.findings){const i=t.severity==="ok"?J(t.label):t.severity==="error"?Ne(t.label):X(t.label);d.log(i),t.detail&&d.log(` ${v(N.arrow)} ${v(t.detail)}`)}e.supplyChain.status!=="ok"&&d.log(` ${v(N.arrow)} ${v("Configure with security.* in vis.config.ts. See `vis check --security-config` for details.")}`)},xs=e=>{if(e.sections.has("runtime")){d.log(""),d.log(ae("Runtime",se(e,"runtime")));for(const t of e.runtime)t.status==="ok"?d.log(J(t.message)):t.status==="skip"?d.log(pt(t.message)):d.log(X(t.message))}},ws=(e,t)=>{const i=e.vulnCount,l=e.runtime.filter(o=>o.status==="warn").length,n=e.outdated.length+e.duplicates.length+e.optimizations.length+l;if(t){if(i===0&&n===0)d.success(`Everything looks good! ${v(`(${U(e.elapsedMs)})`)}`);else{const o=[];i>0&&o.push(ve(`${String(i)} security`)),n>0&&o.push(Re(`${String(n)} improvement${n===1?"":"s"}`)),d.log(`${ve(N.failure)} ${o.join(", ")} ${v(`(${U(e.elapsedMs)})`)}`)}return}d.log(""),d.log(ae("Summary","ok")),i===0&&n===0?d.success(`Everything looks good! ${v(`(${U(e.elapsedMs)})`)}`):(i>0&&d.error(`${String(i)} security issue${i===1?"":"s"}`),n>0&&d.log(` ${ke(N.arrow)} ${le(String(n))} ${v(`improvement${n===1?"":"s"} available`)} ${v(`(${U(e.elapsedMs)})`)}`))},ys=e=>{const t=[];if(e.outdated.length>0&&t.push("vis update — update outdated dependencies"),(e.vulnCount>0||e.socketIssues.alerts>0)&&t.push("vis audit — detailed security analysis"),e.optimizations.length>0&&t.push("vis optimize — apply optimizations interactively"),e.duplicates.length>0&&t.push("vis dedupe — reduce duplicate versions"),t.length>0){d.log(""),d.log(le("Next steps:"));for(const i of t)d.log(` ${v(N.arrow)} ${i}`)}d.log("")},ks=(e,t)=>{t||(ps(e),gs(e),fs(e),xs(e),ms(e)),ws(e,t)},vs=(e,t,i,l,n)=>{const o=[],c=e.has("dependencies"),h=e.has("security"),a=e.has("optimization");return(c||h)&&t>0&&o.push({id:"outdated",label:"Outdated catalog dependencies"}),h&&l>0&&o.push({id:"vulnerabilities",label:"Known vulnerabilities (OSV)"}),h&&i&&l>0&&o.push({id:"socket",label:"Socket.dev supply-chain reports"}),a&&n&&o.push({id:"codemods",label:"Codemod availability"}),o},bs=e=>{if(d.log(""),d.log(`${le(ke("vis doctor"))} ${v("— project health check")}`),d.log(J(`Detected ${e.packageManagerName} v${e.packageManagerVersion}`)),e.runtimeFindings.length===0)d.log(J(`Node.js ${e.nodeVersion}`));else{for(const t of e.runtimeFindings){const i=t.severity==="error"?ve:Re;d.log(Ne(`Runtime: ${i(t.message)}`))}d.log(` ${v(N.arrow)} Run ${fe("vis toolchain install")} to install pinned versions, or ${fe("vis toolchain status")} for the per-tool breakdown.`)}d.log("")},Bs=async({fs:e,logger:t,options:i,visConfig:l,visConfigError:n,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root.");const c=i.format==="json"||i.json===!0,h=es(i.only,i.skip),a=!!i.quiet,p=i.progress===!1,w=Qi(i.filter);if(h.size===0){d.error("No sections selected. Check your --only / --skip values."),process.exitCode=2;return}const j=Date.now(),k=it(o),D=Wt(o),$=!!process.stdout.isTTY,f=!c&&$&&!It&&!a&&!p;!c&&!f&&bs({nodeVersion:process.versions.node,packageManagerName:k.name,packageManagerVersion:k.version,runtimeFindings:D});const A=We(o,Xe(o).packageManager),M=Kt(o,k.name),F=M.length,E=Ke(l?.security).length>0,R=l?.security?.policies?.score?.minimum??Je,P=tt(o);if(!c&&!a&&!f){const z=P.length>0?v(` · ${String(P.length)} workspace package${P.length===1?"":"s"}`):"";d.log(`${v("·")} ${v("Found")} ${le(String(F))} ${v(`installed package${F===1?"":"s"}`)}${z}`)}const Y=n?{hint:n.file?`Continuing with default settings — fix or regenerate ${n.file} (vis init --force).`:"Continuing with default settings.",message:n.message,severity:"error",title:n.file?`Failed to load ${n.file}`:"Failed to load vis.config"}:void 0,Z=Jt(o,k.name)?.file,ee=Z?W(o,Z):void 0,q=Lt(o),B=i.cache!==!1&&!i.fix?ni({configPath:q,lockfilePath:ee,sections:h,socketEnabled:E,workspaceRoot:o}):void 0,L=B?oi(B):void 0,b=L!==void 0;let S,_;if(f){const z=L?new _e({activeSections:h,findings:dt(lt(L),w)}):new _e({activeSections:h}),H=Rt(At.createElement(Xi,{banner:Y,fromCache:b,startedAt:j,store:z}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0});try{S=L??await Ye({filterPatterns:w,installed:M,resolveCodemods:!!i.fix,sections:h,store:z,visConfig:l,workspaceRoot:o})}catch(te){throw H.unmount(),te}await H.waitUntilExit(),_=z.getSnapshot().pendingAction}else if(L)S=L;else{const z=vs(h,A.size,E,F,!!i.fix),H=Xt(z,{live:!c&&!a&&!p});try{S=await Ye({filterPatterns:w,installed:M,progress:H,resolveCodemods:!!i.fix,sections:h,visConfig:l,workspaceRoot:o})}finally{H.stop()}}const G={...S,elapsedMs:Date.now()-j};if(B&&!b)try{li(B,G)}catch{}const V=Zi(G,w,R);if(c){process.stdout.write(`${JSON.stringify(ts(V,k.name),void 0,2)}
4
4
  `),i.exitCode&&He(V,!!i.strict)&&(process.exitCode=1);return}b&&!a&&d.log(`${v("·")} Cached results (use --no-cache to refresh)`),w.length>0&&!a&&d.log(`${v("·")} Filter active: ${ke(i.filter??"")}`),ks(V,a);const ne=V.runtime.some(z=>z.id===$e&&z.status==="warn"),Q=V.sections.has("optimization")&&V.optimizations.length>0;i.fix&&(Q||ne)?await js({force:!!i.fixForce,fs:e,logger:t,pm:k,recoverOrphans:ne,results:V,useEditorconfig:l?.editorconfig??!0,workspaceRoot:o}):a||ys(V),_&&(process.stdout.write(`