@visulima/vis 3.0.1 → 3.0.3

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 (90) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE.md +33 -22
  3. package/dashboard/dist/index.html +12 -12
  4. package/dist/bin.js +1 -1
  5. package/dist/binx.js +1 -1
  6. package/dist/packem_chunks/CONFIG_FILES.js +1 -1
  7. package/dist/packem_chunks/bloom-status.js +1 -1
  8. package/dist/packem_chunks/bloom-sync.js +1 -1
  9. package/dist/packem_chunks/catalog.js +2 -2
  10. package/dist/packem_chunks/cli-exec.js +1 -1
  11. package/dist/packem_chunks/cli-main.js +168 -170
  12. package/dist/packem_chunks/doctor-probe.js +2 -2
  13. package/dist/packem_chunks/fix.js +5 -5
  14. package/dist/packem_chunks/handler13.js +1 -1
  15. package/dist/packem_chunks/handler14.js +1 -1
  16. package/dist/packem_chunks/handler15.js +1 -1
  17. package/dist/packem_chunks/handler19.js +1 -1
  18. package/dist/packem_chunks/handler2.js +1 -1
  19. package/dist/packem_chunks/handler20.js +1 -1
  20. package/dist/packem_chunks/handler21.js +1 -1
  21. package/dist/packem_chunks/handler23.js +1 -1
  22. package/dist/packem_chunks/handler24.js +1 -1
  23. package/dist/packem_chunks/handler26.js +1 -1
  24. package/dist/packem_chunks/handler28.js +1 -1
  25. package/dist/packem_chunks/handler3.js +1 -1
  26. package/dist/packem_chunks/handler50.js +4 -4
  27. package/dist/packem_chunks/handler53.js +1 -1
  28. package/dist/packem_chunks/handler54.js +1 -1
  29. package/dist/packem_chunks/handler55.js +1 -1
  30. package/dist/packem_chunks/handler58.js +1 -1
  31. package/dist/packem_chunks/handler59.js +1 -1
  32. package/dist/packem_chunks/handler6.js +5 -5
  33. package/dist/packem_chunks/handler60.js +1 -1
  34. package/dist/packem_chunks/handler61.js +7 -7
  35. package/dist/packem_chunks/handler62.js +1 -1
  36. package/dist/packem_chunks/handler63.js +1 -1
  37. package/dist/packem_chunks/handler64.js +2 -2
  38. package/dist/packem_chunks/handler65.js +2 -2
  39. package/dist/packem_chunks/handler66.js +1 -1
  40. package/dist/packem_chunks/handler67.js +25 -24
  41. package/dist/packem_chunks/handler68.js +153 -25
  42. package/dist/packem_chunks/handler69.js +10 -153
  43. package/dist/packem_chunks/handler70.js +22 -10
  44. package/dist/packem_chunks/handler71.js +4 -4
  45. package/dist/packem_chunks/handler72.js +3 -3
  46. package/dist/packem_chunks/handler73.js +6 -6
  47. package/dist/packem_chunks/handler74.js +1 -1
  48. package/dist/packem_chunks/handler75.js +1 -1
  49. package/dist/packem_chunks/handler76.js +1 -1
  50. package/dist/packem_chunks/handler77.js +40 -40
  51. package/dist/packem_chunks/handler78.js +20 -20
  52. package/dist/packem_chunks/heal.js +4 -4
  53. package/dist/packem_chunks/help-command.js +5 -5
  54. package/dist/packem_chunks/index4.js +6 -8
  55. package/dist/packem_chunks/index6.js +5 -5
  56. package/dist/packem_chunks/list.js +1 -1
  57. package/dist/packem_chunks/prompts.js +1 -1
  58. package/dist/packem_chunks/prune.js +1 -1
  59. package/dist/packem_chunks/run.js +1 -1
  60. package/dist/packem_chunks/shell-runner.js +1 -1
  61. package/dist/packem_chunks/status.js +1 -1
  62. package/dist/packem_chunks/sync.js +1 -1
  63. package/dist/packem_chunks/tar.js +3 -3
  64. package/dist/packem_shared/{advisories-CyDqzi5j.js → advisories-0ScpWAHV.js} +1 -1
  65. package/dist/packem_shared/{affected-selection-DPQR-Bd3.js → affected-selection-BMoQWuHl.js} +1 -1
  66. package/dist/packem_shared/{ai-fix-6nXZbecQ.js → ai-fix-CKN1JGRh.js} +1 -1
  67. package/dist/packem_shared/{bin-wafzkjaB.js → bin-CN4heKmb.js} +1 -1
  68. package/dist/packem_shared/{cyclonedx-C_ezHg8b.js → cyclonedx-B1vzerwP.js} +1 -1
  69. package/dist/packem_shared/{docker-Br_iFmI-.js → docker-Bex05Qcn.js} +16 -16
  70. package/dist/packem_shared/giget-D8Kwb0kD.js +2 -0
  71. package/dist/packem_shared/index.server-BAjDJSEu.js +2 -0
  72. package/dist/packem_shared/main-BP-w-K-6.js +1 -0
  73. package/dist/packem_shared/{osv-bloom-5wDAoZ1e.js → osv-bloom-JYIWcH3F.js} +1 -1
  74. package/dist/packem_shared/{package-version-BJkg7-6H.js → package-version-CJxZ_B7G.js} +3 -3
  75. package/dist/packem_shared/{project-name-filter-BeREbPMI.js → project-name-filter-DsrVo0MY.js} +1 -1
  76. package/dist/packem_shared/{resolve-explicit-COmP7eqr.js → resolve-explicit-DYaHAVDg.js} +1 -1
  77. package/dist/packem_shared/{s1ngularity-RZOHbGrE.js → s1ngularity-C8sva2SO.js} +1 -1
  78. package/dist/packem_shared/{scan-progress-C9nMDLis.js → scan-progress-5uTRdC1G.js} +2 -2
  79. package/dist/packem_shared/{spinner-CbJfWYwB.js → spinner-BM_0Bj6x.js} +1 -1
  80. package/dist/packem_shared/{tabs-BilwonkM.js → tabs-UDYQ3tqt.js} +1 -1
  81. package/dist/packem_shared/target-merge-B4No-LHM.js +4 -0
  82. package/dist/packem_shared/{typosquats-D8ppc5kr.js → typosquats-Cdsnf6aN.js} +1 -1
  83. package/dist/packem_shared/{vis-update-app-ngwL2mRv.js → vis-update-app-zqSa2clT.js} +1 -1
  84. package/dist/packem_shared/{vis-user-error-jhNwmkZp.js → vis-user-error-Dkc97rGY.js} +1 -1
  85. package/index.js +26 -26
  86. package/package.json +14 -14
  87. package/dist/packem_shared/giget-CVyyR7x8.js +0 -2
  88. package/dist/packem_shared/index.server-CwSgbeN7.js +0 -2
  89. package/dist/packem_shared/main-BjJN8kWj.js +0 -1
  90. package/dist/packem_shared/target-merge-D1xbylFw.js +0 -4
@@ -1 +1 @@
1
- import{createRequire as X}from"node:module";import{X as j,r as _}from"./index.server-CwSgbeN7.js";import{e as A}from"./index-DHD8wb6Z.js";import{g as L}from"./formatBytes-BHAzNIrn-DFIppnY0.js";import{D as m,m as y}from"./provenance-CvfQEJPQ.js";import{g as E}from"./packument-C55kVxcQ.js";import{c as w}from"../packem_chunks/cli-main.js";import{y as U}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{p as O}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";import{h as C}from"./writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{s as p}from"./index-B4AjSxHU.js";let Y;const Q=r=>(Y??=X(import.meta.url))(r),R=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=r=>{if(typeof R<"u"&&R.versions&&R.versions.node){const[e,t]=R.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return R.getBuiltinModule(r)}return Q(r)},{rmSync:D,writeFileSync:P}=$("node:fs"),{createHash:Z}=$("node:crypto"),{Resolver:ee}=$("node:dns/promises");class rr{entries=[];add(e){this.entries.push(e)}addMany(e){for(const t of e)this.entries.push(t)}all(){return this.entries}errors(){return this.entries.filter(e=>e.severity==="error")}warnings(){return this.entries.filter(e=>e.severity==="warning")}hasErrors(){return this.entries.some(e=>e.severity==="error")}hasWarnings(){return this.entries.some(e=>e.severity==="warning")}isEmpty(){return this.entries.length===0}size(){return this.entries.length}}const tr=r=>{if(r.length===0)return[];const e=[],t=r.filter(s=>s.severity==="error"),n=r.filter(s=>s.severity==="warning");if(t.length>0){e.push(j(`${String(t.length)} error${t.length===1?"":"s"}:`));for(const s of t)e.push(` ${j("✗")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${_("→")} ${s.suggestedAction}`)}if(n.length>0){t.length>0&&e.push(""),e.push(_(`${String(n.length)} warning${n.length===1?"":"s"}:`));for(const s of n)e.push(` ${_("⚠")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${_("→")} ${s.suggestedAction}`)}return e},nr=r=>({errors:r.filter(e=>e.severity==="error"),findings:[...r],summary:{errorCount:r.filter(e=>e.severity==="error").length,warningCount:r.filter(e=>e.severity==="warning").length},warnings:r.filter(e=>e.severity==="warning")}),re=1440*60*1e3,te=15e3,ne="https://api.github.com/repos",W=()=>A(L(),"archived-repo"),q=(r,e)=>A(W(),`${encodeURIComponent(r)}__${encodeURIComponent(e)}.json`),se=(r,e)=>{const t=q(r,e);if(U(t))try{const n=O(t);if(Date.now()-n.createdAt>n.ttlMs){D(t,{force:!0});return}return n}catch{D(t,{force:!0});return}},B=(r,e,t,n)=>{C(W());const s={createdAt:Date.now(),ttlMs:n,...t};P(q(r,e),JSON.stringify(s),"utf8")},oe=r=>{if(typeof r!="string"||r.trim()==="")return;const e=r.trim().replace(/^git\+/,""),t=/^git@github\.com:([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(e);if(t)return{owner:t[1],repo:t[2]};const n=/^ssh:\/\/git@github\.com\/([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(e);if(n)return{owner:n[1],repo:n[2]};const s=/^https?:\/\/(?:www\.)?github\.com\/([^/]+)\/([^/?#]+?)(?:\.git)?\/?$/i.exec(e);if(s)return{owner:s[1],repo:s[2]}},ie=async(r,e,t,n)=>{const s=`${ne}/${encodeURIComponent(r)}/${encodeURIComponent(e)}`,l=new AbortController,o=setTimeout(()=>{l.abort()},te),i=()=>{l.abort()};n?.addEventListener("abort",i,{once:!0});const a={Accept:"application/vnd.github+json","User-Agent":"visulima-vis-marshall"};t!==void 0&&t!==""&&(a.Authorization=`Bearer ${t}`);try{const c=await fetch(s,{headers:a,signal:l.signal});if(c.status===404)return{kind:"missing"};if(!c.ok)return{kind:"transient-error"};const d=await c.json(),u=d.archived===!0,f=typeof d.archived_at=="string"?d.archived_at:void 0;return{archived:u,archivedAt:f,kind:"ok"}}catch{return{kind:"transient-error"}}finally{clearTimeout(o),n?.removeEventListener("abort",i)}},ae=(r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),sr=async(r,e={})=>{if(w("archivedRepo"))return[];const t=new Set(e.allowlist),n=e.cacheTtlMs??re,s=e.githubToken??process.env.GITHUB_TOKEN,l=e.concurrency??m,o=new Map,i=async(c,d)=>{const u=`${c}/${d}`;let f=o.get(u);return f===void 0&&(f=(async()=>{const h=se(c,d);if(h!==void 0)return h.missing===!0?{archived:!1,kind:"missing"}:{archived:h.archived,archivedAt:h.archivedAt,kind:"ok"};const v=await ie(c,d,s,e.signal);return v.kind==="missing"?B(c,d,{archived:!1,missing:!0},n):v.kind==="ok"&&B(c,d,{archived:v.archived===!0,archivedAt:v.archivedAt},n),v})(),o.set(u,f)),f};return(await y(r,l,async({name:c,version:d})=>{if(t.has(c))return;const u=await E(c,{workspaceRoot:e.workspaceRoot});if(u===void 0)return;const f=u.versions[d]??u.versions[ae(Object.keys(u.versions),u["dist-tags"]?.latest)??""];if(f===void 0)return;const h=oe(f.repository?.url);if(h===void 0)return;const v=await i(h.owner,h.repo);if(v.kind!=="transient-error"){if(v.kind==="missing")return{kind:"missing-repo",owner:h.owner,packageName:c,repo:h.repo};if(v.archived===!0)return{...v.archivedAt===void 0?{}:{archivedAt:v.archivedAt},kind:"archived",owner:h.owner,packageName:c,repo:h.repo}}})).filter(c=>c!==void 0)},ce={dormantErrorDays:274,dormantWarnDays:183,newPublisherWindowDays:21,recentVersionErrorDays:7,recentVersionWarnDays:30},de=1440*60*1e3,F=(r,e)=>(r-e)/de,b=r=>{if(r!==void 0)return r.email??r.name},ue=(r,e,t,n,s)=>{const l=r.time?.[t];if(l===void 0)return;const o=new Date(l).getTime();if(!Number.isFinite(o))return;const i=F(n,o);if(i<s.recentVersionErrorDays)return{kind:"recent-version",message:`published ${i.toFixed(1)} days ago (error threshold: ${String(s.recentVersionErrorDays)})`,packageName:e,severity:"error",version:t};if(i<s.recentVersionWarnDays)return{kind:"recent-version",message:`published ${i.toFixed(1)} days ago (warn threshold: ${String(s.recentVersionWarnDays)})`,packageName:e,severity:"warning",version:t}},le=(r,e,t,n,s)=>{const l=r.versions[t],o=b(l?._npmUser);if(o===void 0)return;const a=Object.keys(r.versions).filter(h=>p.valid(h)!==null).filter(h=>p.lt(h,t));if(a.length===0||a.some(h=>b(r.versions[h]?._npmUser)===o))return;const d=r.time?.[a[0]??""];if(d===void 0)return;const u=new Date(d).getTime();if(!Number.isFinite(u))return;const f=F(n,u);if(!(f<=s.newPublisherWindowDays))return{kind:"new-publisher",message:`first publish by ${o} on a ${f.toFixed(0)}-day-old package`,packageName:e,severity:"error",version:t}},fe=(r,e,t,n,s)=>{const l=r.versions[t],o=b(l?._npmUser);if(o===void 0)return;const i=[];for(const[d,u]of Object.entries(r.versions)){if(d===t||b(u._npmUser)!==o)continue;const f=r.time?.[d];if(f===void 0)continue;const h=new Date(f).getTime();Number.isFinite(h)&&i.push(h)}if(i.length===0)return;const a=Math.max(...i),c=F(n,a);if(c>=s.dormantErrorDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${c.toFixed(0)} days ago (error threshold: ${String(s.dormantErrorDays)})`,packageName:e,severity:"error",version:t};if(c>=s.dormantWarnDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${c.toFixed(0)} days ago (warn threshold: ${String(s.dormantWarnDays)})`,packageName:e,severity:"warning",version:t}},or=async(r,e={})=>{if(w("author"))return[];const t=new Set(e.allowlist),n={...ce,...e.thresholds},s=e.now??(()=>Date.now()),l=e.concurrency??m;return(await y(r,l,async({name:i,version:a})=>{if(t.has(i))return[];const c=await E(i,{cacheTtlMs:e.cacheTtlMs,signal:e.signal,workspaceRoot:e.workspaceRoot});if(c===void 0)return[];const d=s(),u=[],f=ue(c,i,a,d,n);f!==void 0&&u.push(f);const h=le(c,i,a,d,n);h!==void 0&&u.push(h);const v=fe(c,i,a,d,n);return v!==void 0&&u.push(v),u})).flat()},he=1440*60*1e3,ve=15e3,ge=20,pe=1e4,me="https://api.npmjs.org/downloads/point/last-month",G=()=>A(L(),"downloads"),J=r=>A(G(),`${encodeURIComponent(r)}.json`),ye=r=>{const e=J(r);if(U(e))try{const t=O(e);if(Date.now()-t.createdAt>t.ttlMs){D(e,{force:!0});return}return t.downloads}catch{D(e,{force:!0});return}},we=(r,e,t)=>{C(G());const n={createdAt:Date.now(),downloads:e,observedAt:new Date().toISOString(),ttlMs:t};P(J(r),JSON.stringify(n),"utf8")},ke=async(r,e)=>{const t=`${me}/${encodeURIComponent(r)}`,n=new AbortController,s=setTimeout(()=>{n.abort()},ve),l=()=>{n.abort()};e?.addEventListener("abort",l,{once:!0});try{const o=await fetch(t,{signal:n.signal});if(o.status===404)return{kind:"no-data"};if(!o.ok)return{kind:"error"};const i=await o.json();return typeof i.downloads=="number"?{downloads:i.downloads,kind:"ok"}:{kind:"no-data"}}catch{return{kind:"error"}}finally{clearTimeout(s),e?.removeEventListener("abort",l)}},ir=async(r,e={})=>{if(w("downloads"))return[];const t=new Set(e.allowlist),n=e.errorThreshold??ge,s=e.warnThreshold??pe,l=e.cacheTtlMs??he,o=e.concurrency??m;return(await y(r,o,async a=>{if(t.has(a))return;let d=ye(a);if(d===void 0){const u=await ke(a,e.signal);if(u.kind==="no-data"||u.kind==="error")return{downloadsLastMonth:void 0,kind:"no-data",packageName:a,severity:"warning"};d=u.downloads??0,we(a,d,l)}if(d<n)return{downloadsLastMonth:d,kind:"below-error",packageName:a,severity:"error"};if(d<s)return{downloadsLastMonth:d,kind:"below-warning",packageName:a,severity:"warning"}})).filter(a=>a!==void 0)},De=1440*60*1e3,Ae=4e3,Ee=["1.1.1.1","8.8.8.8"],K=()=>A(L(),"expired-domains"),z=r=>{const e=Z("sha256").update(r).digest("hex").slice(0,12);return A(K(),`${e}.json`)},Re=r=>{const e=z(r);if(U(e))try{const t=O(e);if(Date.now()-t.createdAt>t.ttlMs){D(e,{force:!0});return}return t}catch{D(e,{force:!0});return}},Te=(r,e,t)=>{C(K());const n={createdAt:Date.now(),outcome:e,ttlMs:t};P(z(r),JSON.stringify(n),"utf8")},_e=r=>{if(typeof r!="string")return;const e=r.lastIndexOf("@");if(e===-1||e===r.length-1)return;const t=r.slice(e+1).trim().toLowerCase();return t===""?void 0:t},be=(r,e)=>{const t=[];e!==void 0&&t.push(e);for(const n of r??[])t.push(n);return t},Me=async(r,e)=>{let t;try{return await Promise.race([r,new Promise((n,s)=>{t=setTimeout(()=>{s(new Error("ETIMEDOUT"))},e)})])}finally{t!==void 0&&clearTimeout(t)}},Se=r=>{if(r===null||typeof r!="object")return!1;const{code:e}=r;return e==="ENOTFOUND"||e==="ENODATA"||e==="NXDOMAIN"},$e=async(r,e,t)=>{try{const n=await Me(r.resolveNs(e),t);return Array.isArray(n)&&n.length>0?{kind:"ok"}:{kind:"expired"}}catch(n){return Se(n)?{kind:"expired"}:{kind:"transient-error"}}},Pe=(r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),ar=async(r,e={})=>{if(w("expiredDomains"))return[];const t=new Set(e.allowlist),n=new Set((e.allowDomains??[]).map(f=>f.toLowerCase())),s=e.cacheTtlMs??De,l=e.perDomainTimeoutMs??Ae,o=e.dnsServers??Ee,i=e.concurrency??m,a=e.createResolver===void 0?new ee:e.createResolver();typeof a.setServers=="function"&&a.setServers(o);const c=new Map,d=async f=>{let h=c.get(f);return h===void 0&&(h=(async()=>{const v=Re(f);if(v!==void 0)return{kind:v.outcome==="ok"?"ok":"expired"};const g=await $e(a,f,l);return g.kind!=="transient-error"&&Te(f,g.kind,s),g})(),c.set(f,h)),h};return(await y(r,i,async({name:f,version:h})=>{if(t.has(f))return[];const v=await E(f,{workspaceRoot:e.workspaceRoot});if(v===void 0)return[];const g=v.versions[h]??v.versions[Pe(Object.keys(v.versions),v["dist-tags"]?.latest)??""];if(g===void 0)return[];const M=be(g.maintainers,g._npmUser),N=new Set,S=[];for(const T of M){const k=_e(T.email);if(k===void 0||n.has(k))continue;const I=`${k}:${T.email??""}`;if(N.has(I))continue;N.add(I);const x=await d(k);x.kind==="expired"?S.push({domain:k,kind:"expired",maintainer:T.email??"",packageName:f,severity:"error"}):x.kind==="transient-error"&&S.push({domain:k,kind:"unresolved",maintainer:T.email??"",packageName:f,severity:"warning"})}return S})).flat()},Le=["readme","license","repo"],Ue=["ERROR: No README data found!","# Security holding package"],Oe=r=>{const e=r.trim();return e===""?!0:Ue.some(t=>e.startsWith(t))},Ce=(r,e)=>{if(typeof e.readme=="string")return e.readme;if(typeof r.readme=="string")return r.readme},Fe=(r,e)=>{const t=Ce(r,e);if(t===void 0)return"missing-readme";if(Oe(t))return"placeholder-readme"},Ne=r=>{const{license:e}=r;return e===void 0?"missing-license":typeof e=="string"?e.trim()===""?"missing-license":void 0:typeof e.type=="string"&&e.type.trim()!==""?void 0:"missing-license"},Ie=r=>{const{repository:e}=r;if(e===void 0)return"missing-repo";const t=typeof e.url=="string"?e.url.trim():"";if(t==="")return"missing-repo";let n=t.replace(/^git\+/,"");const s=/^git@([^:]+):(.+?)(?:\.git)?$/.exec(n);return s&&(n=`https://${s[1]}/${s[2]}`),URL.canParse(n)?void 0:"invalid-repo-url"},xe=r=>{const e=r["dist-tags"]?.latest;return e!==void 0&&Object.hasOwn(r.versions,e)?e:Object.keys(r.versions).at(-1)},cr=async(r,e={})=>{if(w("metadata"))return[];const t=new Set(e.allowlist),n=new Set(e.checks??Le),s=e.concurrency??m;return(await y(r,s,async({name:o,version:i})=>{if(t.has(o))return;const a=await E(o,{workspaceRoot:e.workspaceRoot});if(a===void 0)return;const c=a.versions[i]??a.versions[xe(a)??""];if(c===void 0||c.private===!0)return;const d=[];if(n.has("readme")){const u=Fe(a,c);u!==void 0&&d.push(u)}if(n.has("license")){const u=Ne(c);u!==void 0&&d.push(u)}if(n.has("repo")){const u=Ie(c);u!==void 0&&d.push(u)}if(d.length!==0)return{issues:d,packageName:o,version:i}})).filter(o=>o!==void 0)},H=(r,e)=>r===void 0?{}:typeof r=="string"?{[e.startsWith("@")?e.split("/").at(1)??e:e]:r}:{...r},je=(r,e)=>p.valid(e)?Object.keys(r.versions).filter(n=>p.valid(n)!==null&&p.lt(n,e)).sort((n,s)=>p.lt(n,s)?1:-1)[0]:void 0,dr=async(r,e={})=>{if(w("newBin"))return[];const t=new Set(e.allowlist),n=new Set(e.allowBins),s=e.concurrency??m;return(await y(r,s,async({name:o,version:i})=>{if(t.has(o))return;const a=await E(o,{workspaceRoot:e.workspaceRoot});if(a===void 0)return;const c=a.versions[i];if(c===void 0)return;const d=je(a,i);if(d===void 0)return;const u=a.versions[d];if(u===void 0)return;const f=H(c.bin,o),h=H(u.bin,o),v=Object.entries(f).filter(([g])=>!(g in h)).filter(([g])=>!n.has(g)).map(([g,M])=>({command:M,name:g}));if(v.length!==0)return{fromVersion:d,newBins:v,packageName:o,toVersion:i}})).filter(o=>o!==void 0)},Be=["preinstall","install","postinstall"],V=(r,e)=>r.versions[e]?.dist?.attestations?.provenance!==void 0,He=(r,e)=>{if(p.valid(e)!==null)return Object.keys(r.versions).filter(t=>p.valid(t)!==null&&p.prerelease(t)===null&&p.lt(t,e)).sort((t,n)=>p.lt(t,n)?1:-1)[0]},Ve=(r,e)=>{const t=r??{},n=e??{},s=[];for(const l of Be){const o=t[l];if(o===void 0||o==="")continue;const i=n[l];i===void 0||i===""?s.push({command:o,hook:l,kind:"introduced"}):i!==o&&s.push({command:o,hook:l,kind:"changed"})}return s},ur=async(r,e={})=>{if(w("s1ngularity"))return[];const t=new Set(e.allowlist),n=e.concurrency??m;return(await y(r,n,async({name:l,version:o})=>{if(t.has(l))return;const i=await E(l,{workspaceRoot:e.workspaceRoot});if(i?.versions[o]===void 0)return;const a=He(i,o);if(a===void 0||!V(i,a)||V(i,o))return;const c=Ve(i.versions[o]?.scripts,i.versions[a]?.scripts);if(c.length!==0)return{hookChanges:c,packageName:l,priorVersion:a,trustSignal:"provenance-dropped",version:o}})).filter(l=>l!==void 0)};export{rr as M,ur as a,dr as b,cr as c,ir as d,ar as e,sr as f,nr as g,tr as h,or as r};
1
+ import{createRequire as X}from"node:module";import{X as j,b as T}from"./index.server-BAjDJSEu.js";import{e as A}from"./index-DHD8wb6Z.js";import{g as L}from"./formatBytes-BHAzNIrn-DFIppnY0.js";import{D as m,m as y}from"./provenance-CvfQEJPQ.js";import{g as E}from"./packument-C55kVxcQ.js";import{c as w}from"../packem_chunks/cli-main.js";import{y as U}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{p as O}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";import{h as C}from"./writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{s as p}from"./index-B4AjSxHU.js";let Y;const Q=r=>(Y??=X(import.meta.url))(r),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=r=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[e,t]=b.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return b.getBuiltinModule(r)}return Q(r)},{rmSync:D,writeFileSync:P}=$("node:fs"),{createHash:Z}=$("node:crypto"),{Resolver:ee}=$("node:dns/promises");class rr{entries=[];add(e){this.entries.push(e)}addMany(e){for(const t of e)this.entries.push(t)}all(){return this.entries}errors(){return this.entries.filter(e=>e.severity==="error")}warnings(){return this.entries.filter(e=>e.severity==="warning")}hasErrors(){return this.entries.some(e=>e.severity==="error")}hasWarnings(){return this.entries.some(e=>e.severity==="warning")}isEmpty(){return this.entries.length===0}size(){return this.entries.length}}const tr=r=>{if(r.length===0)return[];const e=[],t=r.filter(s=>s.severity==="error"),n=r.filter(s=>s.severity==="warning");if(t.length>0){e.push(j(`${String(t.length)} error${t.length===1?"":"s"}:`));for(const s of t)e.push(` ${j("✗")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${T("→")} ${s.suggestedAction}`)}if(n.length>0){t.length>0&&e.push(""),e.push(T(`${String(n.length)} warning${n.length===1?"":"s"}:`));for(const s of n)e.push(` ${T("⚠")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${T("→")} ${s.suggestedAction}`)}return e},nr=r=>({errors:r.filter(e=>e.severity==="error"),findings:[...r],summary:{errorCount:r.filter(e=>e.severity==="error").length,warningCount:r.filter(e=>e.severity==="warning").length},warnings:r.filter(e=>e.severity==="warning")}),re=1440*60*1e3,te=15e3,ne="https://api.github.com/repos",W=()=>A(L(),"archived-repo"),q=(r,e)=>A(W(),`${encodeURIComponent(r)}__${encodeURIComponent(e)}.json`),se=(r,e)=>{const t=q(r,e);if(U(t))try{const n=O(t);if(Date.now()-n.createdAt>n.ttlMs){D(t,{force:!0});return}return n}catch{D(t,{force:!0});return}},B=(r,e,t,n)=>{C(W());const s={createdAt:Date.now(),ttlMs:n,...t};P(q(r,e),JSON.stringify(s),"utf8")},oe=r=>{if(typeof r!="string"||r.trim()==="")return;const e=r.trim().replace(/^git\+/,""),t=/^git@github\.com:([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(e);if(t)return{owner:t[1],repo:t[2]};const n=/^ssh:\/\/git@github\.com\/([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(e);if(n)return{owner:n[1],repo:n[2]};const s=/^https?:\/\/(?:www\.)?github\.com\/([^/]+)\/([^/?#]+?)(?:\.git)?\/?$/i.exec(e);if(s)return{owner:s[1],repo:s[2]}},ie=async(r,e,t,n)=>{const s=`${ne}/${encodeURIComponent(r)}/${encodeURIComponent(e)}`,l=new AbortController,o=setTimeout(()=>{l.abort()},te),i=()=>{l.abort()};n?.addEventListener("abort",i,{once:!0});const a={Accept:"application/vnd.github+json","User-Agent":"visulima-vis-marshall"};t!==void 0&&t!==""&&(a.Authorization=`Bearer ${t}`);try{const c=await fetch(s,{headers:a,signal:l.signal});if(c.status===404)return{kind:"missing"};if(!c.ok)return{kind:"transient-error"};const d=await c.json(),u=d.archived===!0,f=typeof d.archived_at=="string"?d.archived_at:void 0;return{archived:u,archivedAt:f,kind:"ok"}}catch{return{kind:"transient-error"}}finally{clearTimeout(o),n?.removeEventListener("abort",i)}},ae=(r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),sr=async(r,e={})=>{if(w("archivedRepo"))return[];const t=new Set(e.allowlist),n=e.cacheTtlMs??re,s=e.githubToken??process.env.GITHUB_TOKEN,l=e.concurrency??m,o=new Map,i=async(c,d)=>{const u=`${c}/${d}`;let f=o.get(u);return f===void 0&&(f=(async()=>{const h=se(c,d);if(h!==void 0)return h.missing===!0?{archived:!1,kind:"missing"}:{archived:h.archived,archivedAt:h.archivedAt,kind:"ok"};const v=await ie(c,d,s,e.signal);return v.kind==="missing"?B(c,d,{archived:!1,missing:!0},n):v.kind==="ok"&&B(c,d,{archived:v.archived===!0,archivedAt:v.archivedAt},n),v})(),o.set(u,f)),f};return(await y(r,l,async({name:c,version:d})=>{if(t.has(c))return;const u=await E(c,{workspaceRoot:e.workspaceRoot});if(u===void 0)return;const f=u.versions[d]??u.versions[ae(Object.keys(u.versions),u["dist-tags"]?.latest)??""];if(f===void 0)return;const h=oe(f.repository?.url);if(h===void 0)return;const v=await i(h.owner,h.repo);if(v.kind!=="transient-error"){if(v.kind==="missing")return{kind:"missing-repo",owner:h.owner,packageName:c,repo:h.repo};if(v.archived===!0)return{...v.archivedAt===void 0?{}:{archivedAt:v.archivedAt},kind:"archived",owner:h.owner,packageName:c,repo:h.repo}}})).filter(c=>c!==void 0)},ce={dormantErrorDays:274,dormantWarnDays:183,newPublisherWindowDays:21,recentVersionErrorDays:7,recentVersionWarnDays:30},de=1440*60*1e3,F=(r,e)=>(r-e)/de,_=r=>{if(r!==void 0)return r.email??r.name},ue=(r,e,t,n,s)=>{const l=r.time?.[t];if(l===void 0)return;const o=new Date(l).getTime();if(!Number.isFinite(o))return;const i=F(n,o);if(i<s.recentVersionErrorDays)return{kind:"recent-version",message:`published ${i.toFixed(1)} days ago (error threshold: ${String(s.recentVersionErrorDays)})`,packageName:e,severity:"error",version:t};if(i<s.recentVersionWarnDays)return{kind:"recent-version",message:`published ${i.toFixed(1)} days ago (warn threshold: ${String(s.recentVersionWarnDays)})`,packageName:e,severity:"warning",version:t}},le=(r,e,t,n,s)=>{const l=r.versions[t],o=_(l?._npmUser);if(o===void 0)return;const a=Object.keys(r.versions).filter(h=>p.valid(h)!==null).filter(h=>p.lt(h,t));if(a.length===0||a.some(h=>_(r.versions[h]?._npmUser)===o))return;const d=r.time?.[a[0]??""];if(d===void 0)return;const u=new Date(d).getTime();if(!Number.isFinite(u))return;const f=F(n,u);if(!(f<=s.newPublisherWindowDays))return{kind:"new-publisher",message:`first publish by ${o} on a ${f.toFixed(0)}-day-old package`,packageName:e,severity:"error",version:t}},fe=(r,e,t,n,s)=>{const l=r.versions[t],o=_(l?._npmUser);if(o===void 0)return;const i=[];for(const[d,u]of Object.entries(r.versions)){if(d===t||_(u._npmUser)!==o)continue;const f=r.time?.[d];if(f===void 0)continue;const h=new Date(f).getTime();Number.isFinite(h)&&i.push(h)}if(i.length===0)return;const a=Math.max(...i),c=F(n,a);if(c>=s.dormantErrorDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${c.toFixed(0)} days ago (error threshold: ${String(s.dormantErrorDays)})`,packageName:e,severity:"error",version:t};if(c>=s.dormantWarnDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${c.toFixed(0)} days ago (warn threshold: ${String(s.dormantWarnDays)})`,packageName:e,severity:"warning",version:t}},or=async(r,e={})=>{if(w("author"))return[];const t=new Set(e.allowlist),n={...ce,...e.thresholds},s=e.now??(()=>Date.now()),l=e.concurrency??m;return(await y(r,l,async({name:i,version:a})=>{if(t.has(i))return[];const c=await E(i,{cacheTtlMs:e.cacheTtlMs,signal:e.signal,workspaceRoot:e.workspaceRoot});if(c===void 0)return[];const d=s(),u=[],f=ue(c,i,a,d,n);f!==void 0&&u.push(f);const h=le(c,i,a,d,n);h!==void 0&&u.push(h);const v=fe(c,i,a,d,n);return v!==void 0&&u.push(v),u})).flat()},he=1440*60*1e3,ve=15e3,ge=20,pe=1e4,me="https://api.npmjs.org/downloads/point/last-month",G=()=>A(L(),"downloads"),J=r=>A(G(),`${encodeURIComponent(r)}.json`),ye=r=>{const e=J(r);if(U(e))try{const t=O(e);if(Date.now()-t.createdAt>t.ttlMs){D(e,{force:!0});return}return t.downloads}catch{D(e,{force:!0});return}},we=(r,e,t)=>{C(G());const n={createdAt:Date.now(),downloads:e,observedAt:new Date().toISOString(),ttlMs:t};P(J(r),JSON.stringify(n),"utf8")},ke=async(r,e)=>{const t=`${me}/${encodeURIComponent(r)}`,n=new AbortController,s=setTimeout(()=>{n.abort()},ve),l=()=>{n.abort()};e?.addEventListener("abort",l,{once:!0});try{const o=await fetch(t,{signal:n.signal});if(o.status===404)return{kind:"no-data"};if(!o.ok)return{kind:"error"};const i=await o.json();return typeof i.downloads=="number"?{downloads:i.downloads,kind:"ok"}:{kind:"no-data"}}catch{return{kind:"error"}}finally{clearTimeout(s),e?.removeEventListener("abort",l)}},ir=async(r,e={})=>{if(w("downloads"))return[];const t=new Set(e.allowlist),n=e.errorThreshold??ge,s=e.warnThreshold??pe,l=e.cacheTtlMs??he,o=e.concurrency??m;return(await y(r,o,async a=>{if(t.has(a))return;let d=ye(a);if(d===void 0){const u=await ke(a,e.signal);if(u.kind==="no-data"||u.kind==="error")return{downloadsLastMonth:void 0,kind:"no-data",packageName:a,severity:"warning"};d=u.downloads??0,we(a,d,l)}if(d<n)return{downloadsLastMonth:d,kind:"below-error",packageName:a,severity:"error"};if(d<s)return{downloadsLastMonth:d,kind:"below-warning",packageName:a,severity:"warning"}})).filter(a=>a!==void 0)},De=1440*60*1e3,Ae=4e3,Ee=["1.1.1.1","8.8.8.8"],K=()=>A(L(),"expired-domains"),z=r=>{const e=Z("sha256").update(r).digest("hex").slice(0,12);return A(K(),`${e}.json`)},be=r=>{const e=z(r);if(U(e))try{const t=O(e);if(Date.now()-t.createdAt>t.ttlMs){D(e,{force:!0});return}return t}catch{D(e,{force:!0});return}},Re=(r,e,t)=>{C(K());const n={createdAt:Date.now(),outcome:e,ttlMs:t};P(z(r),JSON.stringify(n),"utf8")},Te=r=>{if(typeof r!="string")return;const e=r.lastIndexOf("@");if(e===-1||e===r.length-1)return;const t=r.slice(e+1).trim().toLowerCase();return t===""?void 0:t},_e=(r,e)=>{const t=[];e!==void 0&&t.push(e);for(const n of r??[])t.push(n);return t},Me=async(r,e)=>{let t;try{return await Promise.race([r,new Promise((n,s)=>{t=setTimeout(()=>{s(new Error("ETIMEDOUT"))},e)})])}finally{t!==void 0&&clearTimeout(t)}},Se=r=>{if(r===null||typeof r!="object")return!1;const{code:e}=r;return e==="ENOTFOUND"||e==="ENODATA"||e==="NXDOMAIN"},$e=async(r,e,t)=>{try{const n=await Me(r.resolveNs(e),t);return Array.isArray(n)&&n.length>0?{kind:"ok"}:{kind:"expired"}}catch(n){return Se(n)?{kind:"expired"}:{kind:"transient-error"}}},Pe=(r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),ar=async(r,e={})=>{if(w("expiredDomains"))return[];const t=new Set(e.allowlist),n=new Set((e.allowDomains??[]).map(f=>f.toLowerCase())),s=e.cacheTtlMs??De,l=e.perDomainTimeoutMs??Ae,o=e.dnsServers??Ee,i=e.concurrency??m,a=e.createResolver===void 0?new ee:e.createResolver();typeof a.setServers=="function"&&a.setServers(o);const c=new Map,d=async f=>{let h=c.get(f);return h===void 0&&(h=(async()=>{const v=be(f);if(v!==void 0)return{kind:v.outcome==="ok"?"ok":"expired"};const g=await $e(a,f,l);return g.kind!=="transient-error"&&Re(f,g.kind,s),g})(),c.set(f,h)),h};return(await y(r,i,async({name:f,version:h})=>{if(t.has(f))return[];const v=await E(f,{workspaceRoot:e.workspaceRoot});if(v===void 0)return[];const g=v.versions[h]??v.versions[Pe(Object.keys(v.versions),v["dist-tags"]?.latest)??""];if(g===void 0)return[];const M=_e(g.maintainers,g._npmUser),N=new Set,S=[];for(const R of M){const k=Te(R.email);if(k===void 0||n.has(k))continue;const I=`${k}:${R.email??""}`;if(N.has(I))continue;N.add(I);const x=await d(k);x.kind==="expired"?S.push({domain:k,kind:"expired",maintainer:R.email??"",packageName:f,severity:"error"}):x.kind==="transient-error"&&S.push({domain:k,kind:"unresolved",maintainer:R.email??"",packageName:f,severity:"warning"})}return S})).flat()},Le=["readme","license","repo"],Ue=["ERROR: No README data found!","# Security holding package"],Oe=r=>{const e=r.trim();return e===""?!0:Ue.some(t=>e.startsWith(t))},Ce=(r,e)=>{if(typeof e.readme=="string")return e.readme;if(typeof r.readme=="string")return r.readme},Fe=(r,e)=>{const t=Ce(r,e);if(t===void 0)return"missing-readme";if(Oe(t))return"placeholder-readme"},Ne=r=>{const{license:e}=r;return e===void 0?"missing-license":typeof e=="string"?e.trim()===""?"missing-license":void 0:typeof e.type=="string"&&e.type.trim()!==""?void 0:"missing-license"},Ie=r=>{const{repository:e}=r;if(e===void 0)return"missing-repo";const t=typeof e.url=="string"?e.url.trim():"";if(t==="")return"missing-repo";let n=t.replace(/^git\+/,"");const s=/^git@([^:]+):(.+?)(?:\.git)?$/.exec(n);return s&&(n=`https://${s[1]}/${s[2]}`),URL.canParse(n)?void 0:"invalid-repo-url"},xe=r=>{const e=r["dist-tags"]?.latest;return e!==void 0&&Object.hasOwn(r.versions,e)?e:Object.keys(r.versions).at(-1)},cr=async(r,e={})=>{if(w("metadata"))return[];const t=new Set(e.allowlist),n=new Set(e.checks??Le),s=e.concurrency??m;return(await y(r,s,async({name:o,version:i})=>{if(t.has(o))return;const a=await E(o,{workspaceRoot:e.workspaceRoot});if(a===void 0)return;const c=a.versions[i]??a.versions[xe(a)??""];if(c===void 0||c.private===!0)return;const d=[];if(n.has("readme")){const u=Fe(a,c);u!==void 0&&d.push(u)}if(n.has("license")){const u=Ne(c);u!==void 0&&d.push(u)}if(n.has("repo")){const u=Ie(c);u!==void 0&&d.push(u)}if(d.length!==0)return{issues:d,packageName:o,version:i}})).filter(o=>o!==void 0)},H=(r,e)=>r===void 0?{}:typeof r=="string"?{[e.startsWith("@")?e.split("/").at(1)??e:e]:r}:{...r},je=(r,e)=>p.valid(e)?Object.keys(r.versions).filter(n=>p.valid(n)!==null&&p.lt(n,e)).sort((n,s)=>p.lt(n,s)?1:-1)[0]:void 0,dr=async(r,e={})=>{if(w("newBin"))return[];const t=new Set(e.allowlist),n=new Set(e.allowBins),s=e.concurrency??m;return(await y(r,s,async({name:o,version:i})=>{if(t.has(o))return;const a=await E(o,{workspaceRoot:e.workspaceRoot});if(a===void 0)return;const c=a.versions[i];if(c===void 0)return;const d=je(a,i);if(d===void 0)return;const u=a.versions[d];if(u===void 0)return;const f=H(c.bin,o),h=H(u.bin,o),v=Object.entries(f).filter(([g])=>!(g in h)).filter(([g])=>!n.has(g)).map(([g,M])=>({command:M,name:g}));if(v.length!==0)return{fromVersion:d,newBins:v,packageName:o,toVersion:i}})).filter(o=>o!==void 0)},Be=["preinstall","install","postinstall"],V=(r,e)=>r.versions[e]?.dist?.attestations?.provenance!==void 0,He=(r,e)=>{if(p.valid(e)!==null)return Object.keys(r.versions).filter(t=>p.valid(t)!==null&&p.prerelease(t)===null&&p.lt(t,e)).sort((t,n)=>p.lt(t,n)?1:-1)[0]},Ve=(r,e)=>{const t=r??{},n=e??{},s=[];for(const l of Be){const o=t[l];if(o===void 0||o==="")continue;const i=n[l];i===void 0||i===""?s.push({command:o,hook:l,kind:"introduced"}):i!==o&&s.push({command:o,hook:l,kind:"changed"})}return s},ur=async(r,e={})=>{if(w("s1ngularity"))return[];const t=new Set(e.allowlist),n=e.concurrency??m;return(await y(r,n,async({name:l,version:o})=>{if(t.has(l))return;const i=await E(l,{workspaceRoot:e.workspaceRoot});if(i?.versions[o]===void 0)return;const a=He(i,o);if(a===void 0||!V(i,a)||V(i,o))return;const c=Ve(i.versions[o]?.scripts,i.versions[a]?.scripts);if(c.length!==0)return{hookChanges:c,packageName:l,priorVersion:a,trustSignal:"provenance-dropped",version:o}})).filter(l=>l!==void 0)};export{rr as M,ur as a,dr as b,cr as c,ir as d,ar as e,sr as f,nr as g,tr as h,or as r};
@@ -1,2 +1,2 @@
1
- import{F as h,r as S,J as T,X as R}from"./index.server-CwSgbeN7.js";import{C as k,S as l}from"../packem_chunks/cli-main.js";import{i as y}from"./index-BjdW45xX.js";import{y as s,X as d,m as a,R as g}from"../packem_chunks/catalog.js";import{l as $}from"./spinner-CbJfWYwB.js";import{D as j,W as v,T as A,C as D}from"./symbols-BXDZ_sKt.js";const b=({rows:i})=>s.jsx(d,{flexDirection:"column",children:i.map(r=>{let t;switch(r.status){case"error":{t=s.jsx(a,{color:"red",children:D});break}case"ok":{t=s.jsx(a,{color:"green",children:A});break}case"running":{t=s.jsx(a,{color:"white",children:s.jsx($,{type:"dots"})});break}case"warn":{t=s.jsx(a,{color:"yellow",children:v});break}default:{t=s.jsx(a,{dimColor:!0,children:j});break}}return s.jsxs(d,{children:[s.jsx(d,{width:3,children:t}),s.jsx(d,{flexGrow:1,children:s.jsx(a,{children:r.label})}),r.summary?s.jsx(d,{children:s.jsxs(a,{dimColor:!0,children:[j," ",r.summary]})}):null]},r.id)})}),I={error:R(l.failure),ok:T(l.success),pending:h(l.dash),skip:h(l.dash),warn:S(l.warning)},Y=(i,r,t)=>{const p=t?`${i} ${h(`— ${t}`)}`:i;return` ${I[r]} ${p}
2
- `},M=(i,r={})=>{const t=r.stream??process.stderr,w=typeof t.isTTY=="boolean"&&t.isTTY&&!y,C=r.live??w,n=new Map;for(const e of i)n.set(e.id,{id:e.id,label:e.label,status:"pending"});if(!C||i.length===0)return{finish:(e,o,m)=>{const c=n.get(e);c&&(n.set(e,{...c,status:o,summary:m}),t.write(Y(c.label,o,m)))},start:e=>{const o=n.get(e);o&&n.set(e,{...o,status:"running"})},stop:()=>{}};const x=()=>i.map(e=>n.get(e.id));let u=k(g.createElement(b,{rows:x()}),{interactive:!0,patchConsole:!1});const f=()=>{u?.rerender(g.createElement(b,{rows:x()}))};return{finish:(e,o,m)=>{const c=n.get(e);c&&(n.set(e,{...c,status:o,summary:m}),f())},start:e=>{const o=n.get(e);o&&(n.set(e,{...o,status:"running"}),f())},stop:()=>{u&&(f(),u.unmount(),u=void 0)}}};export{M as s};
1
+ import{F as h,b as T,J as C,X as R}from"./index.server-BAjDJSEu.js";import{d as k,S as l}from"../packem_chunks/cli-main.js";import{i as y}from"./index-BjdW45xX.js";import{y as s,X as d,m as a,R as g}from"../packem_chunks/catalog.js";import{l as $}from"./spinner-BM_0Bj6x.js";import{D as j,W as v,T as A,C as D}from"./symbols-BXDZ_sKt.js";const b=({rows:i})=>s.jsx(d,{flexDirection:"column",children:i.map(r=>{let t;switch(r.status){case"error":{t=s.jsx(a,{color:"red",children:D});break}case"ok":{t=s.jsx(a,{color:"green",children:A});break}case"running":{t=s.jsx(a,{color:"white",children:s.jsx($,{type:"dots"})});break}case"warn":{t=s.jsx(a,{color:"yellow",children:v});break}default:{t=s.jsx(a,{dimColor:!0,children:j});break}}return s.jsxs(d,{children:[s.jsx(d,{width:3,children:t}),s.jsx(d,{flexGrow:1,children:s.jsx(a,{children:r.label})}),r.summary?s.jsx(d,{children:s.jsxs(a,{dimColor:!0,children:[j," ",r.summary]})}):null]},r.id)})}),I={error:R(l.failure),ok:C(l.success),pending:h(l.dash),skip:h(l.dash),warn:T(l.warning)},Y=(i,r,t)=>{const p=t?`${i} ${h(`— ${t}`)}`:i;return` ${I[r]} ${p}
2
+ `},L=(i,r={})=>{const t=r.stream??process.stderr,w=typeof t.isTTY=="boolean"&&t.isTTY&&!y,S=r.live??w,n=new Map;for(const e of i)n.set(e.id,{id:e.id,label:e.label,status:"pending"});if(!S||i.length===0)return{finish:(e,o,m)=>{const c=n.get(e);c&&(n.set(e,{...c,status:o,summary:m}),t.write(Y(c.label,o,m)))},start:e=>{const o=n.get(e);o&&n.set(e,{...o,status:"running"})},stop:()=>{}};const x=()=>i.map(e=>n.get(e.id));let u=k(g.createElement(b,{rows:x()}),{interactive:!0,patchConsole:!1});const f=()=>{u?.rerender(g.createElement(b,{rows:x()}))};return{finish:(e,o,m)=>{const c=n.get(e);c&&(n.set(e,{...c,status:o,summary:m}),f())},start:e=>{const o=n.get(e);o&&(n.set(e,{...o,status:"running"}),f())},stop:()=>{u&&(f(),u.unmount(),u=void 0)}}};export{L as s};
@@ -1 +1 @@
1
- import{u as r,y as C,m as K}from"../packem_chunks/catalog.js";import{W as h}from"./getRandomSpinner-4ZEcbTYv-DCyIuj19.js";import{k as S}from"../packem_chunks/cli-main.js";const R=100,T=2147483647,l={delta:0,frame:0,time:0};function j(s){const{interval:i=R,isActive:e=!0}=s??{},t=L(i),{renderThrottleMs:c,subscribe:v}=r.useContext(S),[n,A]=r.useState(0),[M,p]=r.useState(l),o=r.useRef(0),f=r.useRef(0),y=r.useRef({isActive:e,resetKey:n,safeInterval:t}),m=y.current,E=e&&(t!==m.safeInterval||!m.isActive||n!==m.resetKey),b=r.useCallback(()=>{A(u=>u+1)},[]);return r.useLayoutEffect(()=>{if(!e)return;p(l);let u=0;const{startTime:d,unsubscribe:I}=v(a=>{if(c>0&&a<o.current)return;const x=a-u,k=a-f.current;f.current=a,o.current=a+c,p({delta:k,frame:Math.floor(x/t),time:x})},t);return u=d,f.current=d,o.current=u+c,I},[t,e,v,c,n]),r.useLayoutEffect(()=>{y.current={isActive:e,resetKey:n,safeInterval:t}},[e,t,n]),E?{...l,reset:b}:{...M,reset:b}}function L(s){return Number.isFinite(s)?Math.min(T,Math.max(1,s)):R}function D({type:s="dots"}){const i=h(s)??h("dots"),e=i?.frames??[" "],{frame:t}=j({interval:i?.interval??80});return C.jsx(K,{children:e[t%e.length]})}export{D as l};
1
+ import{u as r,y as K,m as S}from"../packem_chunks/catalog.js";import{W as h}from"./getRandomSpinner-4ZEcbTYv-DCyIuj19.js";import{m as T}from"../packem_chunks/cli-main.js";const R=100,j=2147483647,l={delta:0,frame:0,time:0};function k(s){const{interval:i=R,isActive:e=!0}=s??{},t=L(i),{renderThrottleMs:c,subscribe:v}=r.useContext(T),[n,A]=r.useState(0),[M,p]=r.useState(l),o=r.useRef(0),f=r.useRef(0),y=r.useRef({isActive:e,resetKey:n,safeInterval:t}),m=y.current,E=e&&(t!==m.safeInterval||!m.isActive||n!==m.resetKey),b=r.useCallback(()=>{A(u=>u+1)},[]);return r.useLayoutEffect(()=>{if(!e)return;p(l);let u=0;const{startTime:d,unsubscribe:I}=v(a=>{if(c>0&&a<o.current)return;const x=a-u,C=a-f.current;f.current=a,o.current=a+c,p({delta:C,frame:Math.floor(x/t),time:x})},t);return u=d,f.current=d,o.current=u+c,I},[t,e,v,c,n]),r.useLayoutEffect(()=>{y.current={isActive:e,resetKey:n,safeInterval:t}},[e,t,n]),E?{...l,reset:b}:{...M,reset:b}}function L(s){return Number.isFinite(s)?Math.min(j,Math.max(1,s)):R}function D({type:s="dots"}){const i=h(s)??h("dots"),e=i?.frames??[" "],{frame:t}=k({interval:i?.interval??80});return K.jsx(S,{children:e[t%e.length]})}export{D as l};
@@ -1 +1 @@
1
- import{y as u,u as o,X as y,m as A}from"../packem_chunks/catalog.js";import{u as H}from"../packem_chunks/cli-main.js";function _({children:n}){return u.jsx(u.Fragment,{children:n})}const L=/^\d$/u,U=n=>n!=null&&typeof n=="object"&&"props"in n&&"name"in n.props,V=n=>{const s=[];for(const t of o.Children.toArray(n))U(t)&&s.push(t);return s},S=(n,s)=>n.some(t=>s[t]),W=(n,s,t)=>n?s?{backgroundColor:t?.activeTab?.backgroundColor??"green",color:t?.activeTab?.color??"black"}:{backgroundColor:"gray",color:"black"}:{backgroundColor:void 0,color:void 0};function J({children:n,colors:s,defaultValue:t,flexDirection:b="row",isFocused:x,keyMap:a,onChange:M,showIndex:$=!0,value:k,width:g}){const l=V(n),c=l.length,d=o.useRef(l);d.current=l;const i=b==="column"||b==="column-reverse",C=k!==void 0,[q,z]=o.useState(()=>{const r=k??t;if(r==null||c===0)return 0;const e=l.findIndex(p=>p.props.name===r);return e===-1?0:e}),h=C?Math.max(0,l.findIndex(r=>r.props.name===k)):q,B=o.useCallback(()=>{},[]),f=C?B:z,m=o.useRef(M);m.current=M,o.useEffect(()=>{if(C)return;const r=d.current[h];r&&m.current(r.props.name,r)},[]);const R=o.useMemo(()=>a?.previous??[i?"upArrow":"leftArrow"],[a?.previous,i]),D=o.useMemo(()=>a?.next??[i?"downArrow":"rightArrow"],[a?.next,i]),I=a?.useNumbers??!0,T=a?.useTab??!0,w=o.useRef(h);w.current=h;const E=o.useCallback(r=>{f(r);const e=d.current[r];e&&m.current(e.props.name,e)},[f]),j=o.useCallback(()=>{const r=(w.current+1)%c;f(r);const e=d.current[r];e&&m.current(e.props.name,e)},[c,f]),v=o.useCallback(()=>{const r=(w.current-1+c)%c;f(r);const e=d.current[r];e&&m.current(e.props.name,e)},[c,f]);H(o.useCallback((r,e)=>{if(S(R,e)){v();return}if(S(D,e)){j();return}if(e.tab&&T&&x==null){e.shift?v():j();return}if(I&&e.meta&&L.test(r)){const p=r==="0"?9:Number.parseInt(r,10)-1;p<c&&E(p)}},[R,D,T,I,x,v,j,c,E]),{isActive:x!==!1});const X=typeof g=="number"?g:6,G=o.useMemo(()=>i?"─".repeat(X):" | ",[i,X]);return u.jsx(y,{flexDirection:b,width:g,children:l.map((r,e)=>{const{name:p}=r.props,F=W(h===e,x!==!1,s);let N=null;return $&&(N=u.jsxs(A,{color:"grey",children:[e+1,"."," "]})),u.jsxs(y,{flexDirection:b,children:[e!==0&&u.jsx(A,{color:"dim",children:G}),u.jsxs(y,{children:[N,u.jsx(A,{backgroundColor:F.backgroundColor,color:F.color,children:r})]})]},p)})})}export{_ as a,J as n};
1
+ import{y as u,u as o,X as y,m as A}from"../packem_chunks/catalog.js";import{v as H}from"../packem_chunks/cli-main.js";function _({children:n}){return u.jsx(u.Fragment,{children:n})}const L=/^\d$/u,U=n=>n!=null&&typeof n=="object"&&"props"in n&&"name"in n.props,V=n=>{const s=[];for(const t of o.Children.toArray(n))U(t)&&s.push(t);return s},S=(n,s)=>n.some(t=>s[t]),W=(n,s,t)=>n?s?{backgroundColor:t?.activeTab?.backgroundColor??"green",color:t?.activeTab?.color??"black"}:{backgroundColor:"gray",color:"black"}:{backgroundColor:void 0,color:void 0};function J({children:n,colors:s,defaultValue:t,flexDirection:b="row",isFocused:x,keyMap:a,onChange:M,showIndex:$=!0,value:k,width:g}){const l=V(n),c=l.length,d=o.useRef(l);d.current=l;const i=b==="column"||b==="column-reverse",C=k!==void 0,[q,z]=o.useState(()=>{const r=k??t;if(r==null||c===0)return 0;const e=l.findIndex(p=>p.props.name===r);return e===-1?0:e}),h=C?Math.max(0,l.findIndex(r=>r.props.name===k)):q,B=o.useCallback(()=>{},[]),f=C?B:z,m=o.useRef(M);m.current=M,o.useEffect(()=>{if(C)return;const r=d.current[h];r&&m.current(r.props.name,r)},[]);const R=o.useMemo(()=>a?.previous??[i?"upArrow":"leftArrow"],[a?.previous,i]),D=o.useMemo(()=>a?.next??[i?"downArrow":"rightArrow"],[a?.next,i]),I=a?.useNumbers??!0,T=a?.useTab??!0,v=o.useRef(h);v.current=h;const E=o.useCallback(r=>{f(r);const e=d.current[r];e&&m.current(e.props.name,e)},[f]),w=o.useCallback(()=>{const r=(v.current+1)%c;f(r);const e=d.current[r];e&&m.current(e.props.name,e)},[c,f]),j=o.useCallback(()=>{const r=(v.current-1+c)%c;f(r);const e=d.current[r];e&&m.current(e.props.name,e)},[c,f]);H(o.useCallback((r,e)=>{if(S(R,e)){j();return}if(S(D,e)){w();return}if(e.tab&&T&&x==null){e.shift?j():w();return}if(I&&e.meta&&L.test(r)){const p=r==="0"?9:Number.parseInt(r,10)-1;p<c&&E(p)}},[R,D,T,I,x,j,w,c,E]),{isActive:x!==!1});const X=typeof g=="number"?g:6,G=o.useMemo(()=>i?"─".repeat(X):" | ",[i,X]);return u.jsx(y,{flexDirection:b,width:g,children:l.map((r,e)=>{const{name:p}=r.props,F=W(h===e,x!==!1,s);let N=null;return $&&(N=u.jsxs(A,{color:"grey",children:[e+1,"."," "]})),u.jsxs(y,{flexDirection:b,children:[e!==0&&u.jsx(A,{color:"dim",children:G}),u.jsxs(y,{children:[N,u.jsx(A,{backgroundColor:F.backgroundColor,color:F.color,children:r})]})]},p)})})}export{_ as a,J as n};
@@ -0,0 +1,4 @@
1
+ import{createRequire as ue}from"node:module";import{_ as he}from"./index-DHD8wb6Z.js";import{y as be}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{U as ve}from"./writeFileSync-DJoHk3Ks-CgQ-VNNT.js";let me;const de=e=>(me??=ue(import.meta.url))(e),x=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ge=e=>{if(typeof x<"u"&&x.versions&&x.versions.node){const[t,s]=x.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return x.getBuiltinModule(e)}return de(e)},{createRequire:ne}=ge("node:module"),ye=/^(?:( )+|\t+)/,M="space";function Z(e,t,s){return e&&t===M&&s===1}function G(e,t){const s=new Map;let o=0,r,n;for(const c of e.split(/\n/g)){if(!c)continue;const i=c.match(ye);if(i===null)o=0,r="";else{const u=i[0].length,a=i[1]?M:"tab";if(Z(t,a,u))continue;a!==r&&(o=0),r=a;let l=1,p=0;const f=u-o;if(o=u,f===0)l=0,p=1;else{const g=Math.abs(f);if(Z(t,a,g))continue;n=xe(a,g)}const m=s.get(n);s.set(n,m===void 0?[1,0]:[m[0]+l,m[1]+p])}}return s}function xe(e,t){return(e===M?"s":"t")+String(t)}function we(e){const t=e[0]==="s"?M:"tab",s=Number(e.slice(1));return{type:t,amount:s}}function Te(e){let t,s=0,o=0;for(const[r,[n,c]]of e)(n>s||n===s&&c>o)&&(s=n,o=c,t=r);return t}function ke(e,t){return(e===M?" ":" ").repeat(t)}function ze(e){if(typeof e!="string")throw new TypeError("Expected a string");let t=G(e,!0);t.size===0&&(t=G(e,!1));const s=Te(t);let o,r=0,n="";return s!==void 0&&({type:o,amount:r}=we(s),n=ke(o,r)),{amount:r,type:o,indent:n}}let $e;const Ee=e=>($e??=ne(import.meta.url))(e),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ne=e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[t,s]=w.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return w.getBuiltinModule(e)}return Ee(e)},{readFileSync:Se}=Ne("node:fs"),os=(e,t,s={})=>{const{detectIndent:o,indent:r,replacer:n,stringify:c=JSON.stringify,...i}={indent:" ",...s};let u=r,a=`
2
+ `;if(be(e,he))try{const p=Se(e,"utf8");if(o){const{indent:f}=ze(p);u=f}a=p.endsWith(`
3
+ `)?`
4
+ `:""}catch(p){if(p.code!=="ENOENT")throw p}const l=c(t,n,u);ve(e,`${l}${a}`,i)};let _e;const je=e=>(_e??=ne(import.meta.url))(e),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,re=e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[t,s]=b.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return b.getBuiltinModule(e)}return je(e)},{homedir:Ce,tmpdir:B}=re("node:os"),{env:A,cwd:Ie,platform:V}=b,{createRequire:h}=re("node:module"),Ae=0,ie=2,Oe=Symbol("findUpStop"),Me=/^[A-Z]:\//i,y=(e="")=>e&&e.replaceAll("\\","/").replace(Me,t=>t.toUpperCase()),Re=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ce=/^[A-Z]:$/i,Le=/[^/](\.[^./]+)$/,De=/^[/\\]|^[a-z]:[/\\]/i,Be=/\/$/,Fe=()=>{if(typeof process.cwd=="function")try{const e=process.cwd();if(typeof e=="string")return y(e)}catch{}return"/"},Ue=(e,t)=>{let s="",o=0,r=-1,n=0,c;for(let i=0;i<=e.length;++i){if(i<e.length)c=e[i];else{if(c==="/")break;c="/"}if(c==="/"){if(!(r===i-1||n===1))if(n===2){if(s.length<2||o!==2||!s.endsWith(".")||s.at(-2)!=="."){if(s.length>2){const u=s.lastIndexOf("/");u===-1?(s="",o=0):(s=s.slice(0,u),o=s.length-1-s.lastIndexOf("/")),r=i,n=0;continue}else if(s.length>0){s="",o=0,r=i,n=0;continue}}t&&(s+=s.length>0?"/..":"..",o=2)}else s.length>0?s+=`/${e.slice(r+1,i)}`:s=e.slice(r+1,i),o=i-r-1;r=i,n=0}else c==="."&&n!==-1?++n:n=-1}return s},O=e=>Re.test(e),F=function(...e){e=e.map(o=>y(o));let t="",s=!1;for(let o=e.length-1;o>=-1&&!s;o--){const r=o>=0?e[o]:Fe();!r||r.length===0||(t=`${r}/${t}`,s=O(r))}return t=Ue(t,!s),ce.test(t)?`${t}/`:s&&!O(t)?`/${t}`:t.length>0?t:"."},Pe=function(e){return Le.exec(y(e))?.[1]??""},le=e=>{const t=y(e).replace(Be,""),s=t.lastIndexOf("/");if(s===-1)return O(e)?"/":".";const o=t.slice(0,s);return ce.test(o)?`${o}/`:o||(O(e)?"/":".")},qe=(e,t)=>{const s=y(e);return s.slice(s.lastIndexOf("/")+1)},We=function(e){const t=De.exec(e)?.[0]?.replaceAll("\\","/")??"",s=qe(e),o=Pe(s);return{base:s,dir:le(e),ext:o,name:s.slice(0,s.length-o.length),root:t}};let He;const Ze=e=>(He??=h(import.meta.url))(e),T=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ge=e=>{if(typeof T<"u"&&T.versions&&T.versions.node){const[t,s]=T.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return T.getBuiltinModule(e)}return Ze(e)},{fileURLToPath:Ve}=Ge("node:url");function Xe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var X,Y;function Ye(){return Y||(Y=1,X=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),X}var Je=Ye();const Ke=Xe(Je);new Set(Ke);const L=e=>y(e instanceof URL?Ve(e):e),pe=e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},J=e=>{if(e.isFile())return"file";if(e.isDirectory())return"dir";if(e.isSymbolicLink())return"symlink"};let Qe;const et=e=>(Qe??=h(import.meta.url))(e),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,tt=e=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[t,s]=k.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return k.getBuiltinModule(e)}return et(e)},{lstat:ns,mkdir:rs}=tt("node:fs/promises");let st;const ot=e=>(st??=h(import.meta.url))(e),z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,nt=e=>{if(typeof z<"u"&&z.versions&&z.versions.node){const[t,s]=z.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return z.getBuiltinModule(e)}return ot(e)},{lstatSync:K,mkdirSync:rt}=nt("node:fs"),$=e=>{pe(e);try{const t=K(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(J(t))}'`);return}catch(t){if(t.code!=="ENOENT")throw t}try{rt(e,{recursive:!0})}catch(t){if(t.code!=="EEXIST")throw t;const s=K(e);if(!s.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(J(s))}'`,{cause:t})}};let it;const ct=e=>(it??=h(import.meta.url))(e),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,lt=e=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[t,s]=E.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return E.getBuiltinModule(e)}return ct(e)},{stat:is,lstat:cs}=lt("node:fs/promises");let pt;const at=e=>(pt??=h(import.meta.url))(e),N=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ft=e=>{if(typeof N<"u"&&N.versions&&N.versions.node){const[t,s]=N.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return N.getBuiltinModule(e)}return at(e)},{statSync:ut,lstatSync:mt}=ft("node:fs"),dt=(e,t={})=>{const s=t.cwd?L(t.cwd):process.cwd();let o=F(s);const{root:r}=We(o),n=L(t.stopAt??r),c=F(o,n),i=t.type??"file",u=function(l){return[e]};t.allowSymlinks??=!0;const a=t.allowSymlinks?ut:mt;for(;o;){for(let l of u()){if(l===Oe)return;if(l===void 0)continue;Buffer.isBuffer(l)?l=l.toString():l instanceof URL&&(l=L(l));const p=O(l)?l:F(o,l);try{const f=a(p);if(i==="file"&&f.isFile()||i==="directory"&&f.isDirectory())return p}catch{}}if(o===c||o===r)break;o=le(o)}};let gt;const ht=e=>(gt??=h(import.meta.url))(e),S=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,bt=e=>{if(typeof S<"u"&&S.versions&&S.versions.node){const[t,s]=S.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return S.getBuiltinModule(e)}return ht(e)},{access:ls}=bt("node:fs/promises");let vt;const yt=e=>(vt??=h(import.meta.url))(e),_=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,xt=e=>{if(typeof _<"u"&&_.versions&&_.versions.node){const[t,s]=_.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return _.getBuiltinModule(e)}return yt(e)},{accessSync:wt}=xt("node:fs");function D(e,t=Ae){pe(e),e=L(e);try{return wt(e,t),!0}catch{return!1}}class Tt extends Error{constructor(t){super(`ENOENT: ${t}`)}get code(){return"ENOENT"}set code(t){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(t){throw new Error("Cannot overwrite name of NotFoundError")}}let kt;const zt=e=>(kt??=h(import.meta.url))(e),j=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,q=e=>{if(typeof j<"u"&&j.versions&&j.versions.node){const[t,s]=j.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return j.getBuiltinModule(e)}return zt(e)},$t=q("fs"),Et=q("os"),Nt=q("path");var U={},Q;function St(){if(Q)return U;Q=1;var e=Object.defineProperty,t=(l,p)=>e(l,"name",{value:p,configurable:!0}),s=$t,o=Et,r=Nt;const n=t(l=>{let p="";for(let f=0;f<l.length;f+=1){const m=l[f],g=m.toUpperCase();p+=m===g?m.toLowerCase():g}return p},"invertCase"),c=new Map,i=t((l,p)=>{const f=r.join(l,`.is-fs-case-sensitive-test-${process.pid}`);try{return p.writeFileSync(f,""),!p.existsSync(n(f))}finally{try{p.unlinkSync(f)}catch{}}},"checkDirectoryCaseWithWrite"),u=t((l,p,f)=>{try{return i(l,f)}catch(m){if(p===void 0)return i(o.tmpdir(),f);throw m}},"checkDirectoryCaseWithFallback"),a=t((l,p=s,f=!0)=>{const m=l??process.cwd();if(f&&c.has(m))return c.get(m);let g;const H=n(m);return H!==m&&p.existsSync(m)?g=!p.existsSync(H):g=u(m,l,p),f&&c.set(m,g),g},"isFsCaseSensitive");return U.isFsCaseSensitive=a,U}var _t=St();_t.isFsCaseSensitive;const jt=/^[A-Z]:\//i,R=(e="")=>e&&e.replaceAll("\\","/").replace(jt,t=>t.toUpperCase()),Ct=/^[/\\]{2}/,It=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,W=/^[A-Z]:$/i,At=/\/$/,Ot=()=>{if(typeof process.cwd=="function")try{const e=process.cwd();if(typeof e=="string")return R(e)}catch{}return"/"},P="/",ae=(e,t)=>{let s="",o=0,r=-1,n=0,c;for(let i=0;i<=e.length;++i){if(i<e.length)c=e[i];else{if(c==="/")break;c="/"}if(c==="/"){if(!(r===i-1||n===1))if(n===2){if(s.length<2||o!==2||!s.endsWith(".")||s.at(-2)!=="."){if(s.length>2){const u=s.lastIndexOf("/");u===-1?(s="",o=0):(s=s.slice(0,u),o=s.length-1-s.lastIndexOf("/")),r=i,n=0;continue}else if(s.length>0){s="",o=0,r=i,n=0;continue}}t&&(s+=s.length>0?"/..":"..",o=2)}else s.length>0?s+=`/${e.slice(r+1,i)}`:s=e.slice(r+1,i),o=i-r-1;r=i,n=0}else c==="."&&n!==-1?++n:n=-1}return s},v=e=>It.test(e),Mt=function(e){if(e.length===0)return".";e=R(e);const t=Ct.exec(e),s=v(e),o=e.at(-1)==="/";return e=ae(e,!s),e.length===0?s?"/":o?"./":".":(o&&(e+="/"),W.test(e)&&(e+="/"),t?s?`//${e}`:`//./${e}`:s&&!v(e)?`/${e}`:e)},d=(...e)=>{let t="";for(const s of e)if(s)if(t.length>0){const o=t.at(-1)==="/",r=s[0]==="/";o&&r?t+=s.slice(1):t+=o||r?s:`/${s}`}else t+=s;return Mt(t)},Rt=function(...e){e=e.map(o=>R(o));let t="",s=!1;for(let o=e.length-1;o>=-1&&!s;o--){const r=o>=0?e[o]:Ot();!r||r.length===0||(t=`${r}/${t}`,s=v(r))}return t=ae(t,!s),W.test(t)?`${t}/`:s&&!v(t)?`/${t}`:t.length>0?t:"."},Lt=e=>{const t=R(e).replace(At,""),s=t.lastIndexOf("/");if(s===-1)return v(e)?"/":".";const o=t.slice(0,s);return W.test(o)?`${o}/`:o||(v(e)?"/":".")};let Dt;const Bt=e=>(Dt??=h(import.meta.url))(e),C=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ft=e=>{if(typeof C<"u"&&C.versions&&C.versions.node){const[t,s]=C.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return C.getBuiltinModule(e)}return Bt(e)},{fileURLToPath:Ut}=Ft("node:url");function Pt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ee,te;function qt(){return te||(te=1,ee=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),ee}var Wt=qt();const Ht=Pt(Wt);new Set(Ht);const fe=e=>R(e instanceof URL?Ut(e):e),se=e=>{const t=Ce();if(V==="win32"){const n=A.LOCALAPPDATA,c=t?d(t,"AppData","Local"):B(),i=n&&n.length>0?n:c;return d(i,e,"Cache")}if(V==="darwin"){const n=t?d(t,"Library","Caches"):B();return d(n,e)}const s=A.XDG_CACHE_HOME,o=t?d(t,".cache"):B(),r=s&&s.length>0?s:o;return d(r,e)},Zt=e=>{if(e.length===0)return;const t=e.map(n=>Rt(fe(n)).split(P));let s=Number.POSITIVE_INFINITY;for(const n of t)n.length<s&&(s=n.length);const o=[];for(let n=0;n<s;n+=1){const c=t[0][n];if(t.every(i=>i[n]===c))o.push(c);else break}const r=o.join(P);return r===""?P:r},I=(e,t)=>{if(e!==void 0)return t?(...s)=>d(e,...s):e},Gt=e=>{if(e?.files&&e.files.length>0){const t=Zt(e.files);if(t!==void 0)return t}return e?.cwd??Ie()},Vt=e=>new Tt(`No package.json found searching upwards from '${fe(e)}'.`),Xt=e=>!D(e,ie)&&D(e),Yt=(e,t)=>{if(A.CACHE_DIR&&!["0","1","false","true"].includes(A.CACHE_DIR)){const a=d(A.CACHE_DIR,e);return t?.create&&$(a),I(a,t?.thunk)}const s=Gt(t),o=dt("package.json",{cwd:s,type:"file"});if(!o){if(t?.useGlobalCacheFallback){const a=se(e);return t.create&&$(a),I(a,t.thunk)}if(t?.throwError)throw Vt(s);return}const r=Lt(o),n=d(r,"node_modules"),c=d(n,".cache"),i=d(c,e);if(D(i,ie))return t?.create&&$(i),I(i,t?.thunk);const u=[i,c,n];if(D(n)||u.push(r),u.some(a=>Xt(a))){if(t?.useGlobalCacheFallback){const a=se(e);return t.create&&$(a),I(a,t.thunk)}return}return t?.create&&$(i),I(i,t?.thunk)},ps=Yt,oe="@inherit",Jt=["aliases","dependsOn","inputs","outputs"],Kt=(e,t)=>{if(t===void 0)return e===void 0?void 0:[...e];if(!t.includes(oe))return[...t];const s=[];for(const o of t){if(o===oe){e!==void 0&&s.push(...e);continue}s.push(o)}return s},as=(e,t)=>{const s={...e,...t};for(const o of Jt){const r=e?.[o],n=t?.[o],c=Kt(r,n);c===void 0?delete s[o]:s[o]=c}return s};export{ps as L,os as T,as as m};
@@ -1 +1 @@
1
- import{createRequire as $}from"node:module";import{X as j,r as k}from"./index.server-CwSgbeN7.js";import{e as D}from"./index-DHD8wb6Z.js";import{g as M}from"./_commonjsHelpers-DTfxOvZk.js";import{c as g,p as i}from"../packem_chunks/cli-main.js";import{y as A}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{p as R}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";let _;const z=e=>(_??=$(import.meta.url))(e),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[o,r]=l.versions.node.split(".").map(Number);if(o>22||o===22&&r>=3||o===20&&r>=16)return l.getBuiltinModule(e)}return z(e)},{createInterface:S}=T("node:readline");var B=["aj","aju","av","avj","ejv","jav","jv"],C=["angula","angular-node","angularjs"],E=["auto-prefixer"],L=["aaxios","aios","axio","axioos","axios-node","axioss","axis","axiso","axois","axos","axxios"],O=["abel","babbel","babe","babel-js","babel-node","babl","bable","bbael","bebel"],F=["bcrpyt","bcrypt-node","brcypt","crypt","dcrypt"],I=["bcryptjs-node","dcryptjs"],P=["bunan","bunya","bunyan-node","buynan"],U=["cai","cha","chaijs","chal","chi","chia","hai"],W=["cahlk","calk","cchalk","ch4lk","cha1k","chaalk","chaik","chak","chakl","chalk-node","chalkk","challk","chhalk","chlak","chlk","halk","hcalk"],V=["cheero","cherio"],X=["c0lor","ccolor","clor","colo","coloor","color-js","colorjs","colorr","colr","coolor","coolr"],J=["ccolors","colors-node","colorss","colorz","colrs","coolors"],Y=["c0mmander","ccommander","cmmander","cmomander","co-mmander","comamnder","comander","comm4nder","commaander","commader","commadner","commamder","command3r","commandder","commande","commandeer","commander-js","commanderr","commandr","commandre","commanedr","commaner","commannder","commender","commmander","commnader","commnder","coommander","ocmmander","ommander"],G=["cor","corss","cos","cosr","cros","crs","ors"],H=["days"],K=["d3bug","dbeug","dbug","ddebug","debbug","debg","debgu","debu","debu9","debug-js","debug-node","debugg","debugjs","debuug","deebug","deubg","deug","ebug","edbug"],Q=["dot-env","dotenv-node","dotenvjs","dotevn"],Z=["3lectron","eectron","eelctron","eelectron","el3ctron","elcetron","elctron","elecctron","elecron","elecrton","electon","electorn","electr0n","electrn","electrno","electro","electrom","electron-node","electronn","electroon","electrron","electtron","eleectron","eletcron","eletron","ellectron","lectron","leectron"],N=["asbuild","ebuild","esbuild-node","esbuildjs","ezbuild","sbuild"],ee=["aslint","elint","eslint-js","eslint-node","eslit","ezlint","slint"],oe=["eexpress","epress","epxress","experss","expess","exppress","expreess","expres","express-node","expressjs","expresss","exprress","exprses","exprss","exress","exrpess","exxpress","xepress","xpress"],se=["astify"],re=["firebasejs"],te=["form1dable"],ae=["glb","glo","glob-js","globjs","gob","golb","lob"],ce=["go","goot","gotjs","gott","gt","gto","ogt","ot","qot"],ne=["helmetjs","helnet"],ie=["homo","hon","hoo","hoon","ohno","ono"],de=["inquire","inquirer-js","nquirer"],le=["iredis"],me=["ejst","est","jast","jes","jestjs","jestt","jet","jets","jst"],pe=["imp","jim","jip","jmp"],ue=["ji","jio","jo","joii","jol","oi","oji"],he=["jdom","jsdm","jsdo","jsdom-js","jsdon","jsom","sdom"],ve=["jsonwebtoken-js","jsonwebtoken-node"],be=["ka","kao","ko","koaa","koajs","koe","oa","oka"],je=["1odash","iodash","l0dash","ldash","ldoash","llodash","lo-dash","loadsh","loash","lobash","lod4sh","lodaash","lodah","lodahs","lodas","lodash-node","lodashh","lodassh","loddash","lodesh","lodsah","lodsh","loodash","odash","oldash"],ke=["luca","luci","lucie"],fe=["luon","luxo","luxon-js"],ge=["imcromatch","mciromatch","micormatch","micrmoatch","micro-match","microamtch","micromacth","micromathc","micromtach","mircomatch"],ye=["minimath"],xe=["mcha","mmocha","moca","moch","mocha-js","moha","nocha","ocha"],we=["m0ment","mment","mmoent","mmoment","moemnt","moent","mom3nt","momeent","momemt","momen","momen7","momennt","moment-js","momentjs","momentt","momet","mometn","momment","momnet","momnt","monent","mooment","oment","omment"],qe=["mognoose","mogoose","mongoos","mongose","monqoose","moongoose"],$e=["moran","organ"],_e=["muler","multer-js","muter"],ze=["mysql"],Te=["ext","mext","n3xt","naxt","net","netx","nex","next-js","next-node","nextjs","nxt"],Se=["node-mailer","nodemailer-js"],De=["nodemo","nodemonjs","nodmeon"],Me=["oar","or","ora-node","ore","ra","roa"],Ae=["arcel","parce","parceljs"],Re=["passport-js"],Be=["phase","phaser-node"],Ce=["ino","pimo","pin","pino-node","pinojs","pio","pion"],Ee=["playright","playwright-js"],Le=["postcss-js","postcss-node","potscss"],Oe=["pettier","pprettier","pretier","prettierjs","prettierr","prtetier"],Fe=["prima","prism","prisma-js","prismajs","prizma"],Ie=["pupeteer"],Pe=["rada","rama","ramd","randa"],Ue=["eact","eract","r3act","raact","ract","raect","re4ct","reaact","reac","reac7","reacct","react-node","reactjs","reactt","reat","reatc","recat","rect","reeact","reect","rreact"],We=["erdis","radis","rdis","redi","redis-js","redis-node","rediss","rediz","reds","reis","rredis"],Ve=["resen","rsend"],Xe=["ollup","rollup-js","rollup-node"],Je=["ass","asss","sas","sass-node","sess","ssas","sss"],Ye=["emver","seemver","semver-node","semvre","senver","sever"],Ge=["sequelize-js","sequelize-node"],He=["harp","shap","shar","sharp-js","sharpjs"],Ke=["stipe","strip","stripe-node","tripe"],Qe=["supabase-js"],Ze=["suelte","svelt3","svelte-js","sveltejs","velte"],Ne=["tailwindcss-js"],eo=["auri","taui"],oo=["hree","htree","thee","there","three-js","three-node","tree"],so=["stx","sx","ts","tsxx","ttsx","tx","txs","tzx"],ro=["ttypescript","typecript","typescipt","typescript-node","typescriptjs","typescrit","typescritp"],to=["udnerscore","undercore","underscoer","underscore-node","underscroe","undersocre","undesrcore"],ao=["uid","uud","uudi","uui","uuid-js","uuid-node","uuidjs","vuid"],co=["ite","vie","vit","vita","vite-node","vitee","vlte","vte"],no=["itest","uitest","vitestjs","vitezt","vittest","vtest"],io=["ue","uue","uve","ve","veu","vu","vu3","vua","vue-node","vuee","vuejs","vuue","vve","vvue"],lo=["web-pack","weback","webpac","webpack-node","webpackjs","webpak","weebpack","wepack","wepback"],mo=["winson","winston-js","winstoon"],po=["up","uyp","yp","yu","yupjs","yupp"],uo=["od","zd","zdo","zo","zob","zod-js","zodjs"];const ho={ajv:B,angular:C,autoprefixer:E,"aws-sdk":["awssdk","ews-sdk"],axios:L,babel:O,bcrypt:F,bcryptjs:I,"body-parser":["body-paresr","body-parse","body-parser-js","body_parser"],bunyan:P,chai:U,chalk:W,cheerio:V,color:X,colors:J,commander:Y,"cookie-parser":["cookie-parse","cookieparser"],cors:G,"cross-env":["crossenv"],"date-fns":["data-fns","date-fn"],dayjs:H,debug:K,dotenv:Q,electron:Z,esbuild:N,eslint:ee,express:oe,fastify:se,firebase:re,formidable:te,glob:ae,got:ce,helmet:ne,hono:ie,inquirer:de,ioredis:le,jest:me,jimp:pe,joi:ue,jsdom:he,jsonwebtoken:ve,koa:be,lodash:je,lucia:ke,luxon:fe,micromatch:ge,minimatch:ye,mocha:xe,moment:we,mongoose:qe,morgan:$e,multer:_e,mysql2:ze,next:Te,"node-fetch":["node-fecth","node-fethc","node.fetch"],nodemailer:Se,nodemon:De,ora:Me,parcel:Ae,passport:Re,phaser:Be,pino:Ce,playwright:Ee,postcss:Le,prettier:Oe,prisma:Fe,puppeteer:Ie,ramda:Pe,react:Ue,"react-dom":["eact-dom","eract-dom","r3act-dom","ract-dom","raect-dom","re4ct-dom","reaact-dom","reac-dom","reac7-dom","reacct-dom","react-bom","react-d0m","react-ddom","react-dm","react-dmo","react-do","react-domm","react-don","react-doom","react-odm","react-om","react.dom","reactdom","reactt-dom","reat-dom","reatc-dom","recat-dom","rect-dom","reeact-dom","rreact-dom"],redis:We,resend:Ve,rollup:Xe,sass:Je,semver:Ye,sequelize:Ge,sharp:He,"socket.io":["ocket.io","oscket.io","scket.io","scoket.io","soccket.io","socekt.io","socet.io","sock3t.io","socke.io","socke7.io","sockeet.io","socket.1o","socket.i","socket.iio","socket.ioo","socket.lo","socket.o","socket.oi","sockett.io","sockket.io","sockt.io","sockte.io","sokcet.io","soket.io","soocket.io","ssocket.io"],stripe:Ke,supabase:Qe,svelte:Ze,tailwindcss:Ne,tauri:eo,three:oo,"ts-node":["tts-node"],tsx:so,typescript:ro,underscore:to,uuid:ao,vite:co,vitest:no,vue:io,webpack:lo,winston:mo,yup:po,zod:uo};var h,f;function vo(){return f||(f=1,h={"@tanstack/start":["start-tanstack-app","tanstack","tanstack-app","tanstack-start"]}),h}var bo=vo();const jo=M(bo),ko={a:["4","e"],b:["d"],d:["b"],e:["3","a"],g:["9","q"],i:["1","l"],l:["1","i"],m:["n"],n:["m"],o:["0"],s:["5","z"],t:["7"],u:["v"],v:["u"]},fo=["app","cli","core","kit","lib","pkg","sdk"],go=e=>{const o=new Set;if(e.length<3)return o;for(let s=0;s<e.length;s++){const a=e[s],c=a==="-"||a==="."||a==="_";if(c||o.add(e.slice(0,s)+e.slice(s+1)),c||o.add(e.slice(0,s)+a+e.slice(s)),s<e.length-1&&e[s]!==e[s+1]){const u=e[s+1]==="-"||e[s+1]==="."||e[s+1]==="_";if(!c&&!u){const d=[...e];[d[s],d[s+1]]=[d[s+1],d[s]],o.add(d.join(""))}}const n=e[s].toLowerCase(),b=ko[n];if(b)for(const u of b)o.add(e.slice(0,s)+u+e.slice(s+1))}const r=/[-._]/g;if(r.test(e))o.add(e.replaceAll(r,"")),o.add(e.replaceAll(r,"-")),o.add(e.replaceAll(r,".")),o.add(e.replaceAll(r,"_"));else if(e.length>5)for(let s=2;s<e.length-2;s++)o.add(`${e.slice(0,s)}-${e.slice(s)}`),o.add(`${e.slice(0,s)}.${e.slice(s)}`),o.add(`${e.slice(0,s)}_${e.slice(s)}`);if(e.startsWith("@")||(o.add(`${e}-js`),o.add(`${e}js`),o.add(`${e}-node`)),e.startsWith("@")){const s=e.indexOf("/");if(s>1&&s<e.length-1){const a=e.slice(1,s),c=e.slice(s+1);a.length>=3&&o.add(a);for(const n of["","-",".","_"])o.add(`${a}${n}${c}`),o.add(`${c}${n}${a}`);for(const n of fo)o.add(`${a}-${n}`),o.add(`${c}-${a}-${n}`),o.add(`${n}-${a}-${c}`)}}return o.delete(e),o};let v,p,m;const y=()=>{if(!v){const e={};for(const o of[ho,jo])for(const[r,t]of Object.entries(o)){const s=e[r]??(e[r]=[]);for(const a of t)s.includes(a)||s.push(a)}v=e}return v},yo=()=>{if(!p){p=new Map;for(const[e,o]of Object.entries(y()))for(const r of o)p.set(r,e)}return p},xo=()=>{if(!m){m=new Map;for(const e of Object.keys(y()))for(const o of go(e))m.has(o)||m.set(o,e)}return m},wo=e=>e.startsWith("@")?e.split("/")[1]??e:e,qo=e=>{const o=wo(e),r=yo().get(o);if(r)return{input:e,legitimate:r,method:"blocklist"};const t=xo().get(o);if(t)return{input:e,legitimate:t,method:"heuristic"}},x=(e,o)=>{const r=o?new Set(o):void 0,t=[];for(const s of e){if(r?.has(s))continue;const a=qo(s);a&&t.push(a)}return t},w=(e,o)=>{i.warn(""),i.warn(j(`Possible typosquat${e.length===1?"":"s"} ${o}:`));for(const r of e){const t=r.method==="blocklist"?"known typosquat":"similar name";i.warn(` ${k("⚠")} ${j(r.input)} — did you mean ${k(r.legitimate)}? (${t})`)}i.warn("")},q=async e=>{if(!process.stdin.isTTY){i.warn("Aborting: potential typosquat detected in non-interactive mode. Use --no-typosquat-check to skip.");return}const o=S({input:process.stdin,output:process.stdout}),r=await new Promise(t=>{o.question(e,s=>{t(s.trim().toLowerCase())})});return o.close(),r},Co=async(e,o)=>{if(g("typosquats"))return{ok:!0,packages:e};const r=x(e,o);if(r.length===0)return{ok:!0,packages:e};w(r,"detected");const t=await q(`Use suggested package${r.length===1?"":"s"} instead? [S]uggested / [y]es, keep original / [N]o, abort (default: N) `);if(t===void 0)return{ok:!1,packages:e};if(t==="s"||t==="suggested"){const s=new Map(r.map(c=>[c.input,c.legitimate]));return{ok:!0,packages:e.map(c=>s.get(c)??c)}}return t==="y"||t==="yes"?{ok:!0,packages:e}:{ok:!1,packages:e}},$o=/^(?:npm|pnpm|yarn):(.+?)(?:@.*)?$/,_o=e=>$o.exec(e)?.[1],zo=e=>{if(!A(e))return[];const o=R(e),r={...o.dependencies,...o.devDependencies,...o.optionalDependencies,...o.peerDependencies},t=new Set;for(const[s,a]of Object.entries(r)){t.add(s);const c=_o(a);c&&t.add(c)}return[...t]},Eo=async(e,o)=>{if(g("typosquats"))return!0;const r=D(e,"package.json"),t=zo(r);if(t.length===0)return!0;const s=x(t,o);if(s.length===0)return!0;w(s,"in package.json dependencies"),i.warn("Fix the package name in package.json before proceeding.");const a=await q("Continue anyway? [y/N] ");return a==="y"||a==="yes"};export{Co as r,Eo as s};
1
+ import{createRequire as $}from"node:module";import{X as j,b as k}from"./index.server-BAjDJSEu.js";import{e as D}from"./index-DHD8wb6Z.js";import{g as M}from"./_commonjsHelpers-DTfxOvZk.js";import{c as g,p as i}from"../packem_chunks/cli-main.js";import{y as A}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{p as R}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";let _;const z=e=>(_??=$(import.meta.url))(e),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[o,r]=l.versions.node.split(".").map(Number);if(o>22||o===22&&r>=3||o===20&&r>=16)return l.getBuiltinModule(e)}return z(e)},{createInterface:S}=T("node:readline");var B=["aj","aju","av","avj","ejv","jav","jv"],C=["angula","angular-node","angularjs"],E=["auto-prefixer"],L=["aaxios","aios","axio","axioos","axios-node","axioss","axis","axiso","axois","axos","axxios"],O=["abel","babbel","babe","babel-js","babel-node","babl","bable","bbael","bebel"],F=["bcrpyt","bcrypt-node","brcypt","crypt","dcrypt"],I=["bcryptjs-node","dcryptjs"],P=["bunan","bunya","bunyan-node","buynan"],U=["cai","cha","chaijs","chal","chi","chia","hai"],W=["cahlk","calk","cchalk","ch4lk","cha1k","chaalk","chaik","chak","chakl","chalk-node","chalkk","challk","chhalk","chlak","chlk","halk","hcalk"],V=["cheero","cherio"],X=["c0lor","ccolor","clor","colo","coloor","color-js","colorjs","colorr","colr","coolor","coolr"],J=["ccolors","colors-node","colorss","colorz","colrs","coolors"],Y=["c0mmander","ccommander","cmmander","cmomander","co-mmander","comamnder","comander","comm4nder","commaander","commader","commadner","commamder","command3r","commandder","commande","commandeer","commander-js","commanderr","commandr","commandre","commanedr","commaner","commannder","commender","commmander","commnader","commnder","coommander","ocmmander","ommander"],G=["cor","corss","cos","cosr","cros","crs","ors"],H=["days"],K=["d3bug","dbeug","dbug","ddebug","debbug","debg","debgu","debu","debu9","debug-js","debug-node","debugg","debugjs","debuug","deebug","deubg","deug","ebug","edbug"],Q=["dot-env","dotenv-node","dotenvjs","dotevn"],Z=["3lectron","eectron","eelctron","eelectron","el3ctron","elcetron","elctron","elecctron","elecron","elecrton","electon","electorn","electr0n","electrn","electrno","electro","electrom","electron-node","electronn","electroon","electrron","electtron","eleectron","eletcron","eletron","ellectron","lectron","leectron"],N=["asbuild","ebuild","esbuild-node","esbuildjs","ezbuild","sbuild"],ee=["aslint","elint","eslint-js","eslint-node","eslit","ezlint","slint"],oe=["eexpress","epress","epxress","experss","expess","exppress","expreess","expres","express-node","expressjs","expresss","exprress","exprses","exprss","exress","exrpess","exxpress","xepress","xpress"],se=["astify"],re=["firebasejs"],te=["form1dable"],ae=["glb","glo","glob-js","globjs","gob","golb","lob"],ce=["go","goot","gotjs","gott","gt","gto","ogt","ot","qot"],ne=["helmetjs","helnet"],ie=["homo","hon","hoo","hoon","ohno","ono"],de=["inquire","inquirer-js","nquirer"],le=["iredis"],me=["ejst","est","jast","jes","jestjs","jestt","jet","jets","jst"],pe=["imp","jim","jip","jmp"],ue=["ji","jio","jo","joii","jol","oi","oji"],he=["jdom","jsdm","jsdo","jsdom-js","jsdon","jsom","sdom"],ve=["jsonwebtoken-js","jsonwebtoken-node"],be=["ka","kao","ko","koaa","koajs","koe","oa","oka"],je=["1odash","iodash","l0dash","ldash","ldoash","llodash","lo-dash","loadsh","loash","lobash","lod4sh","lodaash","lodah","lodahs","lodas","lodash-node","lodashh","lodassh","loddash","lodesh","lodsah","lodsh","loodash","odash","oldash"],ke=["luca","luci","lucie"],fe=["luon","luxo","luxon-js"],ge=["imcromatch","mciromatch","micormatch","micrmoatch","micro-match","microamtch","micromacth","micromathc","micromtach","mircomatch"],ye=["minimath"],xe=["mcha","mmocha","moca","moch","mocha-js","moha","nocha","ocha"],we=["m0ment","mment","mmoent","mmoment","moemnt","moent","mom3nt","momeent","momemt","momen","momen7","momennt","moment-js","momentjs","momentt","momet","mometn","momment","momnet","momnt","monent","mooment","oment","omment"],qe=["mognoose","mogoose","mongoos","mongose","monqoose","moongoose"],$e=["moran","organ"],_e=["muler","multer-js","muter"],ze=["mysql"],Te=["ext","mext","n3xt","naxt","net","netx","nex","next-js","next-node","nextjs","nxt"],Se=["node-mailer","nodemailer-js"],De=["nodemo","nodemonjs","nodmeon"],Me=["oar","or","ora-node","ore","ra","roa"],Ae=["arcel","parce","parceljs"],Re=["passport-js"],Be=["phase","phaser-node"],Ce=["ino","pimo","pin","pino-node","pinojs","pio","pion"],Ee=["playright","playwright-js"],Le=["postcss-js","postcss-node","potscss"],Oe=["pettier","pprettier","pretier","prettierjs","prettierr","prtetier"],Fe=["prima","prism","prisma-js","prismajs","prizma"],Ie=["pupeteer"],Pe=["rada","rama","ramd","randa"],Ue=["eact","eract","r3act","raact","ract","raect","re4ct","reaact","reac","reac7","reacct","react-node","reactjs","reactt","reat","reatc","recat","rect","reeact","reect","rreact"],We=["erdis","radis","rdis","redi","redis-js","redis-node","rediss","rediz","reds","reis","rredis"],Ve=["resen","rsend"],Xe=["ollup","rollup-js","rollup-node"],Je=["ass","asss","sas","sass-node","sess","ssas","sss"],Ye=["emver","seemver","semver-node","semvre","senver","sever"],Ge=["sequelize-js","sequelize-node"],He=["harp","shap","shar","sharp-js","sharpjs"],Ke=["stipe","strip","stripe-node","tripe"],Qe=["supabase-js"],Ze=["suelte","svelt3","svelte-js","sveltejs","velte"],Ne=["tailwindcss-js"],eo=["auri","taui"],oo=["hree","htree","thee","there","three-js","three-node","tree"],so=["stx","sx","ts","tsxx","ttsx","tx","txs","tzx"],ro=["ttypescript","typecript","typescipt","typescript-node","typescriptjs","typescrit","typescritp"],to=["udnerscore","undercore","underscoer","underscore-node","underscroe","undersocre","undesrcore"],ao=["uid","uud","uudi","uui","uuid-js","uuid-node","uuidjs","vuid"],co=["ite","vie","vit","vita","vite-node","vitee","vlte","vte"],no=["itest","uitest","vitestjs","vitezt","vittest","vtest"],io=["ue","uue","uve","ve","veu","vu","vu3","vua","vue-node","vuee","vuejs","vuue","vve","vvue"],lo=["web-pack","weback","webpac","webpack-node","webpackjs","webpak","weebpack","wepack","wepback"],mo=["winson","winston-js","winstoon"],po=["up","uyp","yp","yu","yupjs","yupp"],uo=["od","zd","zdo","zo","zob","zod-js","zodjs"];const ho={ajv:B,angular:C,autoprefixer:E,"aws-sdk":["awssdk","ews-sdk"],axios:L,babel:O,bcrypt:F,bcryptjs:I,"body-parser":["body-paresr","body-parse","body-parser-js","body_parser"],bunyan:P,chai:U,chalk:W,cheerio:V,color:X,colors:J,commander:Y,"cookie-parser":["cookie-parse","cookieparser"],cors:G,"cross-env":["crossenv"],"date-fns":["data-fns","date-fn"],dayjs:H,debug:K,dotenv:Q,electron:Z,esbuild:N,eslint:ee,express:oe,fastify:se,firebase:re,formidable:te,glob:ae,got:ce,helmet:ne,hono:ie,inquirer:de,ioredis:le,jest:me,jimp:pe,joi:ue,jsdom:he,jsonwebtoken:ve,koa:be,lodash:je,lucia:ke,luxon:fe,micromatch:ge,minimatch:ye,mocha:xe,moment:we,mongoose:qe,morgan:$e,multer:_e,mysql2:ze,next:Te,"node-fetch":["node-fecth","node-fethc","node.fetch"],nodemailer:Se,nodemon:De,ora:Me,parcel:Ae,passport:Re,phaser:Be,pino:Ce,playwright:Ee,postcss:Le,prettier:Oe,prisma:Fe,puppeteer:Ie,ramda:Pe,react:Ue,"react-dom":["eact-dom","eract-dom","r3act-dom","ract-dom","raect-dom","re4ct-dom","reaact-dom","reac-dom","reac7-dom","reacct-dom","react-bom","react-d0m","react-ddom","react-dm","react-dmo","react-do","react-domm","react-don","react-doom","react-odm","react-om","react.dom","reactdom","reactt-dom","reat-dom","reatc-dom","recat-dom","rect-dom","reeact-dom","rreact-dom"],redis:We,resend:Ve,rollup:Xe,sass:Je,semver:Ye,sequelize:Ge,sharp:He,"socket.io":["ocket.io","oscket.io","scket.io","scoket.io","soccket.io","socekt.io","socet.io","sock3t.io","socke.io","socke7.io","sockeet.io","socket.1o","socket.i","socket.iio","socket.ioo","socket.lo","socket.o","socket.oi","sockett.io","sockket.io","sockt.io","sockte.io","sokcet.io","soket.io","soocket.io","ssocket.io"],stripe:Ke,supabase:Qe,svelte:Ze,tailwindcss:Ne,tauri:eo,three:oo,"ts-node":["tts-node"],tsx:so,typescript:ro,underscore:to,uuid:ao,vite:co,vitest:no,vue:io,webpack:lo,winston:mo,yup:po,zod:uo};var h,f;function vo(){return f||(f=1,h={"@tanstack/start":["start-tanstack-app","tanstack","tanstack-app","tanstack-start"]}),h}var bo=vo();const jo=M(bo),ko={a:["4","e"],b:["d"],d:["b"],e:["3","a"],g:["9","q"],i:["1","l"],l:["1","i"],m:["n"],n:["m"],o:["0"],s:["5","z"],t:["7"],u:["v"],v:["u"]},fo=["app","cli","core","kit","lib","pkg","sdk"],go=e=>{const o=new Set;if(e.length<3)return o;for(let s=0;s<e.length;s++){const a=e[s],c=a==="-"||a==="."||a==="_";if(c||o.add(e.slice(0,s)+e.slice(s+1)),c||o.add(e.slice(0,s)+a+e.slice(s)),s<e.length-1&&e[s]!==e[s+1]){const u=e[s+1]==="-"||e[s+1]==="."||e[s+1]==="_";if(!c&&!u){const d=[...e];[d[s],d[s+1]]=[d[s+1],d[s]],o.add(d.join(""))}}const n=e[s].toLowerCase(),b=ko[n];if(b)for(const u of b)o.add(e.slice(0,s)+u+e.slice(s+1))}const r=/[-._]/g;if(r.test(e))o.add(e.replaceAll(r,"")),o.add(e.replaceAll(r,"-")),o.add(e.replaceAll(r,".")),o.add(e.replaceAll(r,"_"));else if(e.length>5)for(let s=2;s<e.length-2;s++)o.add(`${e.slice(0,s)}-${e.slice(s)}`),o.add(`${e.slice(0,s)}.${e.slice(s)}`),o.add(`${e.slice(0,s)}_${e.slice(s)}`);if(e.startsWith("@")||(o.add(`${e}-js`),o.add(`${e}js`),o.add(`${e}-node`)),e.startsWith("@")){const s=e.indexOf("/");if(s>1&&s<e.length-1){const a=e.slice(1,s),c=e.slice(s+1);a.length>=3&&o.add(a);for(const n of["","-",".","_"])o.add(`${a}${n}${c}`),o.add(`${c}${n}${a}`);for(const n of fo)o.add(`${a}-${n}`),o.add(`${c}-${a}-${n}`),o.add(`${n}-${a}-${c}`)}}return o.delete(e),o};let v,p,m;const y=()=>{if(!v){const e={};for(const o of[ho,jo])for(const[r,t]of Object.entries(o)){const s=e[r]??(e[r]=[]);for(const a of t)s.includes(a)||s.push(a)}v=e}return v},yo=()=>{if(!p){p=new Map;for(const[e,o]of Object.entries(y()))for(const r of o)p.set(r,e)}return p},xo=()=>{if(!m){m=new Map;for(const e of Object.keys(y()))for(const o of go(e))m.has(o)||m.set(o,e)}return m},wo=e=>e.startsWith("@")?e.split("/")[1]??e:e,qo=e=>{const o=wo(e),r=yo().get(o);if(r)return{input:e,legitimate:r,method:"blocklist"};const t=xo().get(o);if(t)return{input:e,legitimate:t,method:"heuristic"}},x=(e,o)=>{const r=o?new Set(o):void 0,t=[];for(const s of e){if(r?.has(s))continue;const a=qo(s);a&&t.push(a)}return t},w=(e,o)=>{i.warn(""),i.warn(j(`Possible typosquat${e.length===1?"":"s"} ${o}:`));for(const r of e){const t=r.method==="blocklist"?"known typosquat":"similar name";i.warn(` ${k("⚠")} ${j(r.input)} — did you mean ${k(r.legitimate)}? (${t})`)}i.warn("")},q=async e=>{if(!process.stdin.isTTY){i.warn("Aborting: potential typosquat detected in non-interactive mode. Use --no-typosquat-check to skip.");return}const o=S({input:process.stdin,output:process.stdout}),r=await new Promise(t=>{o.question(e,s=>{t(s.trim().toLowerCase())})});return o.close(),r},Co=async(e,o)=>{if(g("typosquats"))return{ok:!0,packages:e};const r=x(e,o);if(r.length===0)return{ok:!0,packages:e};w(r,"detected");const t=await q(`Use suggested package${r.length===1?"":"s"} instead? [S]uggested / [y]es, keep original / [N]o, abort (default: N) `);if(t===void 0)return{ok:!1,packages:e};if(t==="s"||t==="suggested"){const s=new Map(r.map(c=>[c.input,c.legitimate]));return{ok:!0,packages:e.map(c=>s.get(c)??c)}}return t==="y"||t==="yes"?{ok:!0,packages:e}:{ok:!1,packages:e}},$o=/^(?:npm|pnpm|yarn):(.+?)(?:@.*)?$/,_o=e=>$o.exec(e)?.[1],zo=e=>{if(!A(e))return[];const o=R(e),r={...o.dependencies,...o.devDependencies,...o.optionalDependencies,...o.peerDependencies},t=new Set;for(const[s,a]of Object.entries(r)){t.add(s);const c=_o(a);c&&t.add(c)}return[...t]},Eo=async(e,o)=>{if(g("typosquats"))return!0;const r=D(e,"package.json"),t=zo(r);if(t.length===0)return!0;const s=x(t,o);if(s.length===0)return!0;w(s,"in package.json dependencies"),i.warn("Fix the package name in package.json before proceeding.");const a=await q("Continue anyway? [y/N] ");return a==="y"||a==="yes"};export{Co as r,Eo as s};
@@ -1 +1 @@
1
- import{y as e,X as t,m as r,u as p}from"../packem_chunks/catalog.js";import{T as ae,U as je,V as pe,W as fe,u as me,X as z,Y as ce}from"../packem_chunks/cli-main.js";import{l as we}from"./spinner-CbJfWYwB.js";import{s as xe}from"./formatBytes-BHAzNIrn-DFIppnY0.js";import{n as Ce,a as be}from"./tabs-BilwonkM.js";import{u as Te}from"./use-measured-height-BPQg2q_p.js";const _e=({current:a,total:l})=>{const{columns:i}=ae(),s=i||80,d=l>0?Math.min(1,a/l):0,h=`${String(Math.round(d*100)).padStart(3)}%`,f=`${String(a)}/${String(l)}`,w=Math.max(10,s-2-h.length-1),g=Math.round(w*d),j=w-g;return e.jsxs(t,{flexDirection:"column",paddingX:1,children:[e.jsxs(t,{children:[e.jsx(we,{type:"dots"}),e.jsx(r,{children:" Checking catalog dependencies "}),e.jsx(r,{dimColor:!0,children:f})]}),e.jsxs(t,{children:[e.jsx(r,{color:"cyan",children:"━".repeat(g)}),e.jsx(r,{dimColor:!0,children:"─".repeat(j)}),e.jsxs(r,{dimColor:!0,children:[" ",h]})]})]})},Z=["default","name","updateType","severity"],ne=a=>{const l=a.vulnerabilities?.map(i=>i.severity)??[];return l.includes("CRITICAL")?4:l.includes("HIGH")?3:l.includes("MODERATE")?2:l.includes("LOW")?1:0},de={digest:0,major:3,minor:2,patch:1,pin:0,unknown:0},he=(a,l)=>{if(l==="default")return a;const i=[...a];return l==="name"?i.sort((s,d)=>s.packageName.localeCompare(d.packageName)):l==="updateType"?i.sort((s,d)=>(de[d.updateType]??0)-(de[s.updateType]??0)||s.packageName.localeCompare(d.packageName)):i.sort((s,d)=>ne(d)-ne(s)||s.packageName.localeCompare(d.packageName)),i},J=a=>`${a.ecosystem}|${a.file}:${String(a.line)}|${a.name}`,I=a=>`${a.catalogName} ${a.packageName}`,W=a=>{const l=new Map;for(const i of a){const s=l.get(i.catalogName);s?s.push(i):l.set(i.catalogName,[i])}return l},$=(a,l,i)=>{let s=a;if(l!=="all"&&(s=l==="security"?s.filter(d=>d.vulnerabilities&&d.vulnerabilities.length>0||d.socketReport&&d.socketReport.alerts.length>0):s.filter(d=>d.updateType===l)),i){const d=i.toLowerCase();s=s.filter(h=>h.packageName.toLowerCase().includes(d))}return s};class Ke{#e;#t=new Set;#l;#s;#i=null;constructor(l,i=null,s=[]){this.#l=l,this.#s=s,i&&(this.#i=new Map(i.recommendations.map(d=>[d.package,d]))),this.#e={aiResult:i,allChecked:!0,applyProgress:null,checkedEcosystemKeys:new Set(s.map(d=>J(d))),checkedEntries:new Set(l.map(d=>I(d))),ecosystemEntries:s,entries:l,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",groupedByCatalog:W(l),phase:"browsing",selectedIndex:0,sortMode:"default"}}getSnapshot=()=>this.#e;subscribe=l=>(this.#t.add(l),()=>{this.#t.delete(l)});getFilteredEntries(){return he($(this.#l,this.#e.filterType,this.#e.filterText),this.#e.sortMode)}setSortMode(l){if(l===this.#e.sortMode)return;const s=this.getFilteredEntries()[this.#e.selectedIndex]?.packageName,d=he($(this.#l,this.#e.filterType,this.#e.filterText),l),h=s?Math.max(0,d.findIndex(f=>f.packageName===s)):0;this.#r({...this.#e,selectedIndex:h,sortMode:l})}cycleSortMode(){const l=Z.indexOf(this.#e.sortMode),i=Z[(l+1)%Z.length]??"default";this.setSortMode(i)}getRecommendation(l){return this.#i?.get(l)}getCheckedEntries(){return this.#l.filter(l=>this.#e.checkedEntries.has(I(l)))}getCheckedEcosystemEntries(){return this.#s.filter(l=>this.#e.checkedEcosystemKeys.has(J(l)))}toggleEcosystemCheck(l){const i=new Set(this.#e.checkedEcosystemKeys);i.has(l)?i.delete(l):i.add(l),this.#r({...this.#e,checkedEcosystemKeys:i})}checkAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set(this.#s.map(l=>J(l)))})}uncheckAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set})}setSelectedIndex(l){const i=this.getFilteredEntries(),s=Math.max(0,Math.min(l,i.length-1));s!==this.#e.selectedIndex&&this.#r({...this.#e,selectedIndex:s})}setFocusedPanel(l){l!==this.#e.focusedPanel&&this.#r({...this.#e,focusedPanel:l})}setFilterType(l){if(l!==this.#e.filterType){const i=$(this.#l,l,this.#e.filterText);this.#r({...this.#e,entries:i,filterType:l,groupedByCatalog:W(i),selectedIndex:0})}}setFilter(l){const i=$(this.#l,this.#e.filterType,l);this.#r({...this.#e,entries:i,filterText:l,groupedByCatalog:W(i),selectedIndex:0})}setFilterActive(l){if(l!==this.#e.filterActive)if(l)this.#r({...this.#e,filterActive:!0});else{const i=$(this.#l,this.#e.filterType,"");this.#r({...this.#e,entries:i,filterActive:!1,filterText:"",groupedByCatalog:W(i),selectedIndex:0})}}toggleCheck(l){const i=I(l),s=new Set(this.#e.checkedEntries);s.has(i)?s.delete(i):s.add(i),this.#r({...this.#e,allChecked:s.size===this.#l.length,checkedEntries:s})}checkAll(){this.#r({...this.#e,allChecked:!0,checkedEntries:new Set(this.#l.map(l=>I(l)))})}uncheckAll(){this.#r({...this.#e,allChecked:!1,checkedEntries:new Set})}toggleAll(){this.#e.allChecked?this.uncheckAll():this.checkAll()}startApply(){const l=this.getCheckedEntries();this.#r({...this.#e,applyProgress:{current:0,total:l.length},phase:"applying"})}updateApplyProgress(l){this.#e.applyProgress&&this.#r({...this.#e,applyProgress:{...this.#e.applyProgress,current:l}})}markDone(){this.#r({...this.#e,phase:"done"})}setError(l){this.#r({...this.#e,error:l,phase:"error"})}#r(l){this.#e=l;for(const i of this.#t)try{i()}catch{}}}const Se={major:"red",minor:"yellow",patch:"green"},ke={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},ye={critical:"red",high:"red",low:"gray",medium:"yellow"},Re={critical:"red",high:"red",low:"green",medium:"yellow"},Ee={defer:"gray",review:"yellow",skip:"red",update:"green"},Ae=({changelogUrl:a,entry:l,focused:i,recommendation:s,scrollRef:d})=>{const h=i?"white":"gray";if(!l)return e.jsx(t,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:e.jsx(r,{dimColor:!0,children:"No package selected"})});const f=Se[l.updateType]??"white",w=l.vulnerabilities&&l.vulnerabilities.length>0,g=l.socketReport?.score.overall??0,j=l.socketReport?xe(g):"gray";return e.jsxs(t,{borderColor:h,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsx(t,{flexShrink:0,paddingTop:1,paddingX:2,children:e.jsx(r,{bold:!0,color:"white",children:l.displayName??l.packageName})}),e.jsxs(je,{flexGrow:1,flexShrink:1,paddingX:2,ref:d,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[e.jsx(r,{}),e.jsxs(t,{children:[e.jsx(t,{width:12,children:e.jsx(r,{dimColor:!0,children:"Current:"})}),e.jsx(r,{children:l.currentRange})]}),e.jsxs(t,{children:[e.jsx(t,{width:12,children:e.jsx(r,{dimColor:!0,children:"Target:"})}),e.jsx(r,{children:l.newRange}),e.jsxs(r,{bold:!0,color:f,children:[" ","(",l.updateType,")"]})]}),e.jsxs(t,{children:[e.jsx(t,{width:12,children:e.jsx(r,{dimColor:!0,children:"Version:"})}),e.jsx(r,{children:l.targetVersion})]}),e.jsxs(t,{children:[e.jsx(t,{width:12,children:e.jsx(r,{dimColor:!0,children:l.kind==="ecosystem"?"Source:":"Catalog:"})}),e.jsx(r,{color:l.kind==="ecosystem"?"cyan":void 0,children:l.catalogName})]}),l.acceptedRisk&&e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{color:"gray",children:"── "}),e.jsx(r,{bold:!0,color:"gray",children:"ACKNOWLEDGED RISK"}),e.jsxs(t,{flexDirection:"column",paddingLeft:2,children:[e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Reason: "}),e.jsx(r,{children:l.acceptedRisk.reason})]}),e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Accepted: "}),e.jsx(r,{children:l.acceptedRisk.acceptedAt.slice(0,10)})]})]})]}),w&&e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"red",children:"SECURITY"}),e.jsx(r,{}),l.vulnerabilities.map(c=>e.jsxs(t,{flexDirection:"column",marginBottom:1,children:[e.jsxs(t,{gap:1,children:[e.jsxs(r,{bold:!0,color:ke[c.severity]??"gray",children:["⚠"," ",c.severity]}),e.jsx(r,{bold:!0,children:c.id})]}),e.jsx(t,{paddingLeft:2,children:e.jsx(r,{children:c.summary})}),e.jsxs(t,{gap:2,paddingLeft:2,children:[c.cvssScore!==void 0&&e.jsxs(r,{dimColor:!0,children:["CVSS:",String(c.cvssScore)]}),c.fixedVersions.length>0&&e.jsxs(r,{dimColor:!0,children:["Fixed in:",c.fixedVersions.join(", ")]})]})]},c.id))]}),l.socketReport&&e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"cyan",children:"SOCKET.DEV"}),e.jsx(r,{}),e.jsxs(t,{gap:2,children:[e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Overall: "}),e.jsxs(r,{bold:!0,color:j,children:[String(Math.round(g*100)),"%"]})]}),e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Supply Chain: "}),e.jsxs(r,{children:[String(Math.round(l.socketReport.score.supplyChain*100)),"%"]})]}),e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Quality: "}),e.jsxs(r,{children:[String(Math.round(l.socketReport.score.quality*100)),"%"]})]})]}),e.jsxs(t,{gap:2,children:[e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Maintenance: "}),e.jsxs(r,{children:[String(Math.round(l.socketReport.score.maintenance*100)),"%"]})]}),e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Vulnerability: "}),e.jsxs(r,{children:[String(Math.round(l.socketReport.score.vulnerability*100)),"%"]})]}),e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"License: "}),e.jsxs(r,{children:[l.socketReport.license||"unknown"," ","(",String(Math.round(l.socketReport.score.license*100)),"%)"]})]})]}),l.socketReport.alerts.length>0&&e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsxs(r,{bold:!0,color:"yellow",children:["⚠"," ",String(l.socketReport.alerts.length)," ","alert",l.socketReport.alerts.length===1?"":"s",":"]}),l.socketReport.alerts.map(c=>e.jsxs(t,{gap:1,paddingLeft:2,children:[e.jsxs(r,{bold:!0,color:ye[c.severity]??"gray",children:["[",c.severity.toUpperCase(),"]"]}),e.jsx(r,{children:c.type}),e.jsxs(r,{dimColor:!0,children:["(",c.category,")"]})]},c.key))]})]}),s&&e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"AI ANALYSIS"}),e.jsx(r,{}),e.jsxs(t,{gap:2,children:[e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Action: "}),e.jsx(r,{bold:!0,color:Ee[s.action]??"white",children:s.action})]}),e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Risk: "}),e.jsx(r,{bold:!0,color:Re[s.riskLevel]??"white",children:s.riskLevel})]}),e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Effort: "}),e.jsx(r,{bold:!0,children:s.effort})]})]}),s.reason&&e.jsx(t,{marginTop:1,paddingLeft:2,children:e.jsx(r,{children:s.reason})}),s.breakingChanges.length>0&&e.jsxs(t,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[e.jsx(r,{bold:!0,color:"yellow",children:"Breaking changes:"}),s.breakingChanges.map((c,v)=>e.jsxs(r,{children:[" ","•"," ",c]},String(v)))]})]}),a&&e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"CHANGELOG"}),e.jsx(t,{marginTop:1,paddingLeft:2,children:e.jsx(r,{color:"cyan",underline:!0,children:a})})]}),e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"LINKS"}),e.jsx(t,{flexDirection:"column",marginTop:1,paddingLeft:2,children:l.kind==="ecosystem"?e.jsx(r,{color:"cyan",underline:!0,children:l.detailUrl??l.displayName??l.packageName}):e.jsxs(r,{color:"cyan",underline:!0,children:["https://npmx.dev/",l.packageName]})})]}),!s&&l.kind!=="ecosystem"&&e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"GUIDANCE"}),e.jsxs(t,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[l.updateType==="major"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"red",children:["⚠"," ","Major update — likely contains breaking changes."]}),e.jsx(r,{dimColor:!0,children:" Review the changelog before updating."}),e.jsx(r,{dimColor:!0,children:" Use --changelog to fetch release URLs."})]}),l.updateType==="minor"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"yellow",children:["ℹ"," ","Minor update — new features, backward compatible."]}),e.jsx(r,{dimColor:!0,children:" Generally safe to update."})]}),l.updateType==="patch"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"green",children:["✓"," ","Patch update — bug fixes only."]}),e.jsx(r,{dimColor:!0,children:" Safe to update."})]}),!s&&e.jsx(r,{dimColor:!0,children:" Use --ai to get AI-powered analysis."})]})]})]})]})},Ie={major:"red",minor:"yellow",patch:"green"},ve=[{id:"all",label:"All"},{id:"major",label:"Major"},{id:"minor",label:"Minor"},{id:"patch",label:"Patch"},{id:"security",label:"Security"}],Me=({checked:a,entry:l,isSelected:i})=>{const s=Ie[l.updateType]??"white",d=l.vulnerabilities&&l.vulnerabilities.length>0,h=l.socketReport&&l.socketReport.alerts.length>0,f=!!l.acceptedRisk,w=a?"☑":"☐",g=l.socketReport?`${String(Math.round(l.socketReport.score.overall*100))}%`:"",j=l.socketReport?xe(l.socketReport.score.overall):"gray";return e.jsxs(t,{flexShrink:0,height:1,children:[e.jsx(r,{children:i?">":" "}),e.jsxs(r,{color:a?"white":"gray",children:[" ",w," "]}),d||h?e.jsx(r,{color:f?"gray":"red",children:f?"✓ ":"⚠ "}):e.jsx(r,{children:" "}),e.jsx(t,{flexGrow:1,children:e.jsxs(r,{bold:i,inverse:i,wrap:"truncate",children:[l.displayName??l.packageName,f?" [ack]":""]})}),g&&e.jsxs(r,{color:j,children:[" ",g]}),e.jsxs(r,{dimColor:!0,children:[" ",l.currentRange]}),e.jsxs(r,{dimColor:!0,children:[" ","→"," "]}),e.jsxs(r,{children:[l.newRange," "]}),e.jsx(r,{bold:!0,color:s,children:l.updateType})]})},Ne=({count:a,ecosystem:l=!1,name:i})=>e.jsxs(t,{flexShrink:0,height:1,marginTop:1,children:[e.jsxs(r,{color:l?"cyan":void 0,dimColor:!l,children:[l?"◈":"▼"," "]}),e.jsx(r,{bold:!0,color:l?"cyan":"white",children:i.toUpperCase()}),e.jsxs(r,{dimColor:!0,children:[" ","(",a,")"]}),l&&e.jsxs(r,{color:"cyan",dimColor:!0,children:[" ","ci/cd refs"]})]}),De=({checkedEntries:a,entries:l,filterActive:i,filteredOutCount:s,filterText:d,filterType:h,focused:f,groupedByCatalog:w,isDryRun:g,onViewportHeightChange:j,scrollOffset:c,selectedIndex:v,totalCatalogEntries:M,totalChecked:R,totalEntries:U,viewportHeight:P})=>{const B=f?"white":"gray",{measuredHeight:m,ref:E}=Te(P,j);let V=0,y=0,N=0,A=0;for(const u of l)u.updateType==="major"?V++:u.updateType==="minor"?y++:N++,(u.vulnerabilities&&u.vulnerabilities.length>0||u.socketReport&&u.socketReport.alerts.length>0)&&A++;const b=[];V>0&&b.push(`${V} major`),y>0&&b.push(`${y} minor`),N>0&&b.push(`${N} patch`),A>0&&b.push(`${A} vulnerable`);const D=b.length>0?` (${b.join(", ")})`:"",C=l.filter(u=>u.kind==="ecosystem").length,T=l.length-C;let F=0;for(const u of l)a.has(I(u))&&F++;const O=[];let H=0;for(const[u,S]of w){O.push(e.jsx(Ne,{count:S.length,ecosystem:S[0]?.kind==="ecosystem",name:u},`hdr-${u}`));for(const k of S){const X=H;O.push(e.jsx(Me,{checked:a.has(I(k)),entry:k,isSelected:X===v},I(k))),H++}}let L=0;for(const[,u]of w)L+=2+u.length;const _=L>m&&m>0;return e.jsxs(t,{borderColor:B,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsxs(t,{flexShrink:0,gap:1,paddingX:1,children:[e.jsx(r,{bold:!0,inverse:!0,children:" VIS "}),e.jsxs(r,{wrap:"truncate",children:[C>0?T:U,R>0?`/${R}`:""," ",C>0?"pkgs":"outdated",D,M>R?` · ${M-R} dupes`:""]}),C>0&&e.jsxs(r,{color:"cyan",children:[" ","◈",C," ","ci/cd"]}),!g&&F>0&&e.jsxs(r,{dimColor:!0,children:[" ","—",F," ","selected"]})]}),e.jsx(t,{flexShrink:0,paddingX:1,paddingY:1,children:e.jsx(Ce,{isFocused:f,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:()=>{},showIndex:!1,value:h,children:ve.map(({id:u,label:S})=>e.jsx(be,{name:u,children:S},u))})}),i&&e.jsxs(t,{flexShrink:0,paddingX:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/ "}),e.jsx(r,{children:d}),e.jsx(r,{inverse:!0,children:" "})]}),s>0&&e.jsx(t,{flexShrink:0,paddingX:1,children:e.jsxs(r,{color:"yellow",children:["⚠"," ",s," ","package",s===1?"":"s"," ","filtered out by target constraint — press"," ",e.jsx(r,{bold:!0,color:"white",children:"f"})," ","to view"]})}),e.jsxs(t,{flexDirection:"row",flexGrow:1,overflow:"hidden",ref:E,children:[e.jsx(t,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:e.jsx(t,{flexDirection:"column",marginTop:-c,children:O})}),_&&e.jsx(t,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(pe,{contentHeight:L,placement:"inset",scrollOffset:c,style:"block",viewportHeight:m})})]},`list-${h}-${d}`)]})},Le=100,Pe=40,Be=10,Ve=[],G=["all","major","minor","patch","security"],Ye=({autoExitSeconds:a=0,changelogUrls:l,checkedCount:i=0,filteredOutEntries:s=Ve,isDryRun:d,store:h,totalCatalogEntries:f=0})=>{const{exit:w}=fe(),{columns:g,rows:j}=ae(),c=p.useSyncExternalStore(h.subscribe,h.getSnapshot),[v,M]=p.useState(!1),[R,U]=p.useState(!1),P=p.useRef(null),B=p.useRef(null),m=p.useRef(null),E=p.useRef(null),[V,y]=p.useState(0),[N,A]=p.useState(!1),[b,D]=p.useState(!1),C=p.useMemo(()=>h.getFilteredEntries(),[c.entries,c.filterType,c.filterText,c.sortMode]),T=C[c.selectedIndex]??null,F=T?h.getRecommendation(T.packageName):void 0,O=T&&l?l.get(T.packageName):void 0,H=p.useCallback(o=>{let n=0,x=0;for(const[,Q]of c.groupedByCatalog){n+=2;for(let oe=0;oe<Q.length;oe++){if(x===o)return n;n+=1,x++}}return n},[c.groupedByCatalog]),L=Math.max(1,j-8-(c.filterActive?1:0)),[_,u]=p.useState(L),S=_>0?_:L,k=p.useCallback(o=>{const n=H(o);y(x=>n>x+S-2?Math.max(0,n-S+2):n<x+1?Math.max(0,n-1):x)},[H,S]);if(p.useEffect(()=>{m.current?.scrollToTop()},[T?.packageName]),me((o,n)=>{if(o==="c"&&n.ctrl){w();return}if(!b){if(R){n.escape||o==="f"||o==="q"?U(!1):n.downArrow||o==="j"?B.current?.scrollBy(1):(n.upArrow||o==="k")&&B.current?.scrollBy(-1);return}if(N){o==="u"||n.return?(A(!1),h.startApply(),w(h.getCheckedEntries())):n.escape||o==="q"?A(!1):n.downArrow||o==="j"?E.current?.scrollBy(1):n.upArrow||o==="k"?E.current?.scrollBy(-1):n.pageDown?E.current?.scrollBy(5):n.pageUp&&E.current?.scrollBy(-5);return}if(v){n.escape||o==="?"?M(!1):o==="q"?(M(!1),D(!0)):n.downArrow||o==="j"?P.current?.scrollBy(1):(n.upArrow||o==="k")&&P.current?.scrollBy(-1);return}if(o==="?"){M(!0);return}if(o==="q"){D(!0);return}if(n.tab){h.setFocusedPanel(c.focusedPanel==="list"?"detail":"list");return}if(c.focusedPanel==="list"&&(n.leftArrow||n.rightArrow)){const x=G.indexOf(c.filterType),Q=n.rightArrow?(x+1)%G.length:(x-1+G.length)%G.length;y(0),m.current?.scrollToTop(),h.setFilterType(G[Q]);return}if(o==="f"&&s.length>0){U(x=>!x);return}if(c.filterActive){if(n.escape){h.setFilterActive(!1);return}if(n.return){h.setFilterActive(!1);return}if(n.backspace){y(0),h.setFilter(c.filterText.slice(0,-1));return}if(o&&!n.ctrl&&!n.meta){y(0),h.setFilter(c.filterText+o);return}return}if(c.focusedPanel==="list"){if(n.downArrow||o==="j"){const x=Math.min(c.selectedIndex+1,C.length-1);h.setSelectedIndex(x),k(x);return}if(n.upArrow||o==="k"){const x=Math.max(c.selectedIndex-1,0);h.setSelectedIndex(x),k(x);return}if(n.pageDown){const x=Math.min(c.selectedIndex+10,C.length-1);h.setSelectedIndex(x),k(x);return}if(n.pageUp){const x=Math.max(c.selectedIndex-10,0);h.setSelectedIndex(x),k(x);return}if(n.home){h.setSelectedIndex(0),y(0);return}if(n.end){const x=C.length-1;h.setSelectedIndex(x),k(x);return}if(o===" "||n.return){T&&h.toggleCheck(T);return}if(o==="a"){h.toggleAll();return}if(o==="s"){h.cycleSortMode(),k(h.getSnapshot().selectedIndex);return}if(o==="/"){h.setFilterActive(!0);return}if(o==="u"&&!d&&c.checkedEntries.size>0){A(!0);return}if(n.rightArrow){h.setFocusedPanel("detail");return}return}if(c.focusedPanel==="detail"){if(n.escape||n.leftArrow){h.setFocusedPanel("list");return}if(n.downArrow||o==="j"){m.current?.scrollBy(1);return}if(n.upArrow||o==="k"){m.current?.scrollBy(-1);return}if(n.pageDown){m.current?.scrollBy(10);return}if(n.pageUp){m.current?.scrollBy(-10);return}if(n.home){m.current?.scrollToTop();return}n.end&&m.current?.scrollToBottom()}}},{isActive:!0}),g<Pe||j<Be)return e.jsx(t,{alignItems:"center",height:j,justifyContent:"center",width:g,children:e.jsxs(r,{color:"yellow",children:["Terminal too small (",g,"x",j,")"]})});const X=g>=Le,K=[e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"q"}),e.jsx(r,{dimColor:!0,children:"QUIT"})]},"q"),e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"?"}),e.jsx(r,{dimColor:!0,children:"HELP"})]},"?"),e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"}),e.jsx(r,{dimColor:!0,children:"NAV"})]},"nav"),e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Space"}),e.jsx(r,{dimColor:!0,children:"CHECK"})]},"sp"),e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"a"}),e.jsx(r,{dimColor:!0,children:"ALL"})]},"a")];!d&&c.checkedEntries.size>0&&K.push(e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"green",children:"u"}),e.jsx(r,{dimColor:!0,children:"APPLY"})]},"u")),s.length>0&&K.push(e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"yellow",children:"f"}),e.jsxs(r,{dimColor:!0,children:["FILTERED (",s.length,")"]})]},"fo")),K.push(e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"←→"}),e.jsx(r,{dimColor:!0,children:"FILTER"})]},"lr"),e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/"}),e.jsx(r,{dimColor:!0,children:"SEARCH"})]},"f"),e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Tab"}),e.jsx(r,{dimColor:!0,children:"PANEL"})]},"t"));const ee=e.jsx(t,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:e.jsx(t,{flexWrap:"wrap",gap:2,paddingX:1,children:K})}),re=e.jsxs(z,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"?"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:P,title:"KEYBOARD SHORTCUTS",visible:v,width:52,children:[e.jsxs(t,{flexDirection:"column",marginBottom:1,children:[e.jsxs(t,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),e.jsxs(t,{children:[e.jsx(t,{width:24,children:e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↑","/k"]}),e.jsx(r,{dimColor:!0,children:" Move up"})]})}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↓","/j"]}),e.jsx(r,{dimColor:!0,children:" Move down"})]})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Tab"]}),e.jsx(r,{dimColor:!0,children:" Switch panel"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","→","/","←"]}),e.jsx(r,{dimColor:!0,children:" Focus detail/list"})]})]}),e.jsxs(t,{flexDirection:"column",marginBottom:1,children:[e.jsxs(t,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"SELECTION"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Space"]}),e.jsx(r,{dimColor:!0,children:" Toggle check on package"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","a"]}),e.jsx(r,{dimColor:!0,children:" Toggle check all"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","s"]}),e.jsx(r,{dimColor:!0,children:" Cycle sort (default / name / type / severity)"})]})]}),e.jsxs(t,{flexDirection:"column",marginBottom:1,children:[e.jsxs(t,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"FILTERS"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","←→"]}),e.jsx(r,{dimColor:!0,children:" Switch filter tab"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","/"]}),e.jsx(r,{dimColor:!0,children:" Text filter"})]}),s.length>0&&e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","f"]}),e.jsx(r,{dimColor:!0,children:" View filtered-out packages"})]})]}),e.jsxs(t,{flexDirection:"column",children:[e.jsxs(t,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"ACTIONS"})]}),!d&&e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","u"]}),e.jsx(r,{dimColor:!0,children:" Apply selected updates"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","q"]}),e.jsx(r,{dimColor:!0,children:" Quit"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","?"]}),e.jsx(r,{dimColor:!0,children:" Toggle help"})]})]})]}),Y=h.getCheckedEntries(),q=Y.filter(o=>o.updateType==="major").length,ue=e.jsxs(t,{alignItems:"center",flexDirection:"column",children:[q>0&&e.jsx(t,{marginBottom:1,marginTop:1,children:e.jsxs(r,{color:"yellow",children:["⚠"," ",q," ","major update",q===1?"":"s"," ","— review breaking changes"]})}),e.jsxs(r,{dimColor:!0,children:["Press"," ",e.jsx(r,{bold:!0,color:"white",children:"u"})," ","or"," ",e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","to confirm,"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","to cancel"]})]}),le=e.jsx(z,{footer:ue,scrollRef:E,title:`Apply ${Y.length} update${Y.length===1?"":"s"}?`,visible:N,width:70,children:Y.map(o=>e.jsxs(t,{gap:1,children:[e.jsxs(r,{children:[" ",o.displayName??o.packageName]}),e.jsxs(r,{dimColor:!0,children:[o.currentRange," ","→"," ",o.newRange]}),e.jsx(r,{bold:!0,color:o.updateType==="major"?"red":o.updateType==="minor"?"yellow":"green",children:o.updateType})]},o.packageName))}),te=s.length>0?e.jsx(z,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"f"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:B,title:`${s.length} PACKAGE${s.length===1?"":"S"} FILTERED BY TARGET`,visible:R,width:70,children:e.jsxs(t,{flexDirection:"column",children:[e.jsx(t,{marginBottom:1,children:e.jsxs(r,{dimColor:!0,children:["These packages have newer versions available but are excluded by the current target constraint. Use"," ",e.jsx(r,{bold:!0,color:"white",children:"--target latest"})," ","to include them."]})}),s.map(o=>e.jsxs(t,{gap:1,children:[e.jsxs(r,{children:[" ",o.packageName]}),e.jsxs(r,{dimColor:!0,children:[o.currentRange," ","→"," ",o.newRange]}),e.jsx(r,{bold:!0,color:o.updateType==="major"?"red":o.updateType==="minor"?"yellow":"green",children:o.updateType})]},o.packageName))]})}):null,se=e.jsx(De,{checkedEntries:c.checkedEntries,entries:C,filterActive:c.filterActive,filteredOutCount:s.length,filterText:c.filterText,filterType:c.filterType,focused:c.focusedPanel==="list",groupedByCatalog:c.groupedByCatalog,isDryRun:d,onViewportHeightChange:u,scrollOffset:V,selectedIndex:c.selectedIndex,totalCatalogEntries:f,totalChecked:i,totalEntries:C.length,viewportHeight:S}),ie=e.jsx(Ae,{changelogUrl:O,entry:T,focused:c.focusedPanel==="detail",recommendation:F,scrollRef:m});if(X){const o=Math.floor(g*.35);return e.jsxs(t,{flexDirection:"column",height:j,width:g,children:[e.jsxs(t,{flexDirection:"row",flexGrow:1,children:[e.jsx(t,{flexGrow:1,children:se}),e.jsx(t,{width:o,children:ie})]}),ee,le,te,e.jsx(ce,{autoExitSeconds:a||3,onCancel:()=>{D(!1)},visible:b}),re]})}const ge=Math.floor(j*.55);return e.jsxs(t,{flexDirection:"column",height:j,width:g,children:[e.jsx(t,{height:ge,children:se}),e.jsx(t,{flexGrow:1,children:ie}),ee,le,te,e.jsx(ce,{autoExitSeconds:a||3,onCancel:()=>{D(!1)},visible:b}),re]})};export{_e as C,Ke as U,Ye as V,J as e};
1
+ import{y as e,X as t,m as r,u as p}from"../packem_chunks/catalog.js";import{T as ae,U as je,V as pe,W as fe,v as me,X as z,Y as ce}from"../packem_chunks/cli-main.js";import{l as we}from"./spinner-BM_0Bj6x.js";import{s as xe}from"./formatBytes-BHAzNIrn-DFIppnY0.js";import{n as Ce,a as be}from"./tabs-UDYQ3tqt.js";import{u as Te}from"./use-measured-height-BPQg2q_p.js";const _e=({current:a,total:l})=>{const{columns:i}=ae(),s=i||80,d=l>0?Math.min(1,a/l):0,h=`${String(Math.round(d*100)).padStart(3)}%`,f=`${String(a)}/${String(l)}`,w=Math.max(10,s-2-h.length-1),g=Math.round(w*d),j=w-g;return e.jsxs(t,{flexDirection:"column",paddingX:1,children:[e.jsxs(t,{children:[e.jsx(we,{type:"dots"}),e.jsx(r,{children:" Checking catalog dependencies "}),e.jsx(r,{dimColor:!0,children:f})]}),e.jsxs(t,{children:[e.jsx(r,{color:"cyan",children:"━".repeat(g)}),e.jsx(r,{dimColor:!0,children:"─".repeat(j)}),e.jsxs(r,{dimColor:!0,children:[" ",h]})]})]})},Z=["default","name","updateType","severity"],ne=a=>{const l=a.vulnerabilities?.map(i=>i.severity)??[];return l.includes("CRITICAL")?4:l.includes("HIGH")?3:l.includes("MODERATE")?2:l.includes("LOW")?1:0},de={digest:0,major:3,minor:2,patch:1,pin:0,unknown:0},he=(a,l)=>{if(l==="default")return a;const i=[...a];return l==="name"?i.sort((s,d)=>s.packageName.localeCompare(d.packageName)):l==="updateType"?i.sort((s,d)=>(de[d.updateType]??0)-(de[s.updateType]??0)||s.packageName.localeCompare(d.packageName)):i.sort((s,d)=>ne(d)-ne(s)||s.packageName.localeCompare(d.packageName)),i},J=a=>`${a.ecosystem}|${a.file}:${String(a.line)}|${a.name}`,I=a=>`${a.catalogName} ${a.packageName}`,W=a=>{const l=new Map;for(const i of a){const s=l.get(i.catalogName);s?s.push(i):l.set(i.catalogName,[i])}return l},$=(a,l,i)=>{let s=a;if(l!=="all"&&(s=l==="security"?s.filter(d=>d.vulnerabilities&&d.vulnerabilities.length>0||d.socketReport&&d.socketReport.alerts.length>0):s.filter(d=>d.updateType===l)),i){const d=i.toLowerCase();s=s.filter(h=>h.packageName.toLowerCase().includes(d))}return s};class Ke{#e;#t=new Set;#l;#s;#i=null;constructor(l,i=null,s=[]){this.#l=l,this.#s=s,i&&(this.#i=new Map(i.recommendations.map(d=>[d.package,d]))),this.#e={aiResult:i,allChecked:!0,applyProgress:null,checkedEcosystemKeys:new Set(s.map(d=>J(d))),checkedEntries:new Set(l.map(d=>I(d))),ecosystemEntries:s,entries:l,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",groupedByCatalog:W(l),phase:"browsing",selectedIndex:0,sortMode:"default"}}getSnapshot=()=>this.#e;subscribe=l=>(this.#t.add(l),()=>{this.#t.delete(l)});getFilteredEntries(){return he($(this.#l,this.#e.filterType,this.#e.filterText),this.#e.sortMode)}setSortMode(l){if(l===this.#e.sortMode)return;const s=this.getFilteredEntries()[this.#e.selectedIndex]?.packageName,d=he($(this.#l,this.#e.filterType,this.#e.filterText),l),h=s?Math.max(0,d.findIndex(f=>f.packageName===s)):0;this.#r({...this.#e,selectedIndex:h,sortMode:l})}cycleSortMode(){const l=Z.indexOf(this.#e.sortMode),i=Z[(l+1)%Z.length]??"default";this.setSortMode(i)}getRecommendation(l){return this.#i?.get(l)}getCheckedEntries(){return this.#l.filter(l=>this.#e.checkedEntries.has(I(l)))}getCheckedEcosystemEntries(){return this.#s.filter(l=>this.#e.checkedEcosystemKeys.has(J(l)))}toggleEcosystemCheck(l){const i=new Set(this.#e.checkedEcosystemKeys);i.has(l)?i.delete(l):i.add(l),this.#r({...this.#e,checkedEcosystemKeys:i})}checkAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set(this.#s.map(l=>J(l)))})}uncheckAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set})}setSelectedIndex(l){const i=this.getFilteredEntries(),s=Math.max(0,Math.min(l,i.length-1));s!==this.#e.selectedIndex&&this.#r({...this.#e,selectedIndex:s})}setFocusedPanel(l){l!==this.#e.focusedPanel&&this.#r({...this.#e,focusedPanel:l})}setFilterType(l){if(l!==this.#e.filterType){const i=$(this.#l,l,this.#e.filterText);this.#r({...this.#e,entries:i,filterType:l,groupedByCatalog:W(i),selectedIndex:0})}}setFilter(l){const i=$(this.#l,this.#e.filterType,l);this.#r({...this.#e,entries:i,filterText:l,groupedByCatalog:W(i),selectedIndex:0})}setFilterActive(l){if(l!==this.#e.filterActive)if(l)this.#r({...this.#e,filterActive:!0});else{const i=$(this.#l,this.#e.filterType,"");this.#r({...this.#e,entries:i,filterActive:!1,filterText:"",groupedByCatalog:W(i),selectedIndex:0})}}toggleCheck(l){const i=I(l),s=new Set(this.#e.checkedEntries);s.has(i)?s.delete(i):s.add(i),this.#r({...this.#e,allChecked:s.size===this.#l.length,checkedEntries:s})}checkAll(){this.#r({...this.#e,allChecked:!0,checkedEntries:new Set(this.#l.map(l=>I(l)))})}uncheckAll(){this.#r({...this.#e,allChecked:!1,checkedEntries:new Set})}toggleAll(){this.#e.allChecked?this.uncheckAll():this.checkAll()}startApply(){const l=this.getCheckedEntries();this.#r({...this.#e,applyProgress:{current:0,total:l.length},phase:"applying"})}updateApplyProgress(l){this.#e.applyProgress&&this.#r({...this.#e,applyProgress:{...this.#e.applyProgress,current:l}})}markDone(){this.#r({...this.#e,phase:"done"})}setError(l){this.#r({...this.#e,error:l,phase:"error"})}#r(l){this.#e=l;for(const i of this.#t)try{i()}catch{}}}const Se={major:"red",minor:"yellow",patch:"green"},ke={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},ye={critical:"red",high:"red",low:"gray",medium:"yellow"},Re={critical:"red",high:"red",low:"green",medium:"yellow"},Ee={defer:"gray",review:"yellow",skip:"red",update:"green"},Ae=({changelogUrl:a,entry:l,focused:i,recommendation:s,scrollRef:d})=>{const h=i?"white":"gray";if(!l)return e.jsx(t,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:e.jsx(r,{dimColor:!0,children:"No package selected"})});const f=Se[l.updateType]??"white",w=l.vulnerabilities&&l.vulnerabilities.length>0,g=l.socketReport?.score.overall??0,j=l.socketReport?xe(g):"gray";return e.jsxs(t,{borderColor:h,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsx(t,{flexShrink:0,paddingTop:1,paddingX:2,children:e.jsx(r,{bold:!0,color:"white",children:l.displayName??l.packageName})}),e.jsxs(je,{flexGrow:1,flexShrink:1,paddingX:2,ref:d,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[e.jsx(r,{}),e.jsxs(t,{children:[e.jsx(t,{width:12,children:e.jsx(r,{dimColor:!0,children:"Current:"})}),e.jsx(r,{children:l.currentRange})]}),e.jsxs(t,{children:[e.jsx(t,{width:12,children:e.jsx(r,{dimColor:!0,children:"Target:"})}),e.jsx(r,{children:l.newRange}),e.jsxs(r,{bold:!0,color:f,children:[" ","(",l.updateType,")"]})]}),e.jsxs(t,{children:[e.jsx(t,{width:12,children:e.jsx(r,{dimColor:!0,children:"Version:"})}),e.jsx(r,{children:l.targetVersion})]}),e.jsxs(t,{children:[e.jsx(t,{width:12,children:e.jsx(r,{dimColor:!0,children:l.kind==="ecosystem"?"Source:":"Catalog:"})}),e.jsx(r,{color:l.kind==="ecosystem"?"cyan":void 0,children:l.catalogName})]}),l.acceptedRisk&&e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{color:"gray",children:"── "}),e.jsx(r,{bold:!0,color:"gray",children:"ACKNOWLEDGED RISK"}),e.jsxs(t,{flexDirection:"column",paddingLeft:2,children:[e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Reason: "}),e.jsx(r,{children:l.acceptedRisk.reason})]}),e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Accepted: "}),e.jsx(r,{children:l.acceptedRisk.acceptedAt.slice(0,10)})]})]})]}),w&&e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"red",children:"SECURITY"}),e.jsx(r,{}),l.vulnerabilities.map(c=>e.jsxs(t,{flexDirection:"column",marginBottom:1,children:[e.jsxs(t,{gap:1,children:[e.jsxs(r,{bold:!0,color:ke[c.severity]??"gray",children:["⚠"," ",c.severity]}),e.jsx(r,{bold:!0,children:c.id})]}),e.jsx(t,{paddingLeft:2,children:e.jsx(r,{children:c.summary})}),e.jsxs(t,{gap:2,paddingLeft:2,children:[c.cvssScore!==void 0&&e.jsxs(r,{dimColor:!0,children:["CVSS:",String(c.cvssScore)]}),c.fixedVersions.length>0&&e.jsxs(r,{dimColor:!0,children:["Fixed in:",c.fixedVersions.join(", ")]})]})]},c.id))]}),l.socketReport&&e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"cyan",children:"SOCKET.DEV"}),e.jsx(r,{}),e.jsxs(t,{gap:2,children:[e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Overall: "}),e.jsxs(r,{bold:!0,color:j,children:[String(Math.round(g*100)),"%"]})]}),e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Supply Chain: "}),e.jsxs(r,{children:[String(Math.round(l.socketReport.score.supplyChain*100)),"%"]})]}),e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Quality: "}),e.jsxs(r,{children:[String(Math.round(l.socketReport.score.quality*100)),"%"]})]})]}),e.jsxs(t,{gap:2,children:[e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Maintenance: "}),e.jsxs(r,{children:[String(Math.round(l.socketReport.score.maintenance*100)),"%"]})]}),e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Vulnerability: "}),e.jsxs(r,{children:[String(Math.round(l.socketReport.score.vulnerability*100)),"%"]})]}),e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"License: "}),e.jsxs(r,{children:[l.socketReport.license||"unknown"," ","(",String(Math.round(l.socketReport.score.license*100)),"%)"]})]})]}),l.socketReport.alerts.length>0&&e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsxs(r,{bold:!0,color:"yellow",children:["⚠"," ",String(l.socketReport.alerts.length)," ","alert",l.socketReport.alerts.length===1?"":"s",":"]}),l.socketReport.alerts.map(c=>e.jsxs(t,{gap:1,paddingLeft:2,children:[e.jsxs(r,{bold:!0,color:ye[c.severity]??"gray",children:["[",c.severity.toUpperCase(),"]"]}),e.jsx(r,{children:c.type}),e.jsxs(r,{dimColor:!0,children:["(",c.category,")"]})]},c.key))]})]}),s&&e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"AI ANALYSIS"}),e.jsx(r,{}),e.jsxs(t,{gap:2,children:[e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Action: "}),e.jsx(r,{bold:!0,color:Ee[s.action]??"white",children:s.action})]}),e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Risk: "}),e.jsx(r,{bold:!0,color:Re[s.riskLevel]??"white",children:s.riskLevel})]}),e.jsxs(t,{children:[e.jsx(r,{dimColor:!0,children:"Effort: "}),e.jsx(r,{bold:!0,children:s.effort})]})]}),s.reason&&e.jsx(t,{marginTop:1,paddingLeft:2,children:e.jsx(r,{children:s.reason})}),s.breakingChanges.length>0&&e.jsxs(t,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[e.jsx(r,{bold:!0,color:"yellow",children:"Breaking changes:"}),s.breakingChanges.map((c,v)=>e.jsxs(r,{children:[" ","•"," ",c]},String(v)))]})]}),a&&e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"CHANGELOG"}),e.jsx(t,{marginTop:1,paddingLeft:2,children:e.jsx(r,{color:"cyan",underline:!0,children:a})})]}),e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"LINKS"}),e.jsx(t,{flexDirection:"column",marginTop:1,paddingLeft:2,children:l.kind==="ecosystem"?e.jsx(r,{color:"cyan",underline:!0,children:l.detailUrl??l.displayName??l.packageName}):e.jsxs(r,{color:"cyan",underline:!0,children:["https://npmx.dev/",l.packageName]})})]}),!s&&l.kind!=="ecosystem"&&e.jsxs(t,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"GUIDANCE"}),e.jsxs(t,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[l.updateType==="major"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"red",children:["⚠"," ","Major update — likely contains breaking changes."]}),e.jsx(r,{dimColor:!0,children:" Review the changelog before updating."}),e.jsx(r,{dimColor:!0,children:" Use --changelog to fetch release URLs."})]}),l.updateType==="minor"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"yellow",children:["ℹ"," ","Minor update — new features, backward compatible."]}),e.jsx(r,{dimColor:!0,children:" Generally safe to update."})]}),l.updateType==="patch"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"green",children:["✓"," ","Patch update — bug fixes only."]}),e.jsx(r,{dimColor:!0,children:" Safe to update."})]}),!s&&e.jsx(r,{dimColor:!0,children:" Use --ai to get AI-powered analysis."})]})]})]})]})},Ie={major:"red",minor:"yellow",patch:"green"},ve=[{id:"all",label:"All"},{id:"major",label:"Major"},{id:"minor",label:"Minor"},{id:"patch",label:"Patch"},{id:"security",label:"Security"}],Me=({checked:a,entry:l,isSelected:i})=>{const s=Ie[l.updateType]??"white",d=l.vulnerabilities&&l.vulnerabilities.length>0,h=l.socketReport&&l.socketReport.alerts.length>0,f=!!l.acceptedRisk,w=a?"☑":"☐",g=l.socketReport?`${String(Math.round(l.socketReport.score.overall*100))}%`:"",j=l.socketReport?xe(l.socketReport.score.overall):"gray";return e.jsxs(t,{flexShrink:0,height:1,children:[e.jsx(r,{children:i?">":" "}),e.jsxs(r,{color:a?"white":"gray",children:[" ",w," "]}),d||h?e.jsx(r,{color:f?"gray":"red",children:f?"✓ ":"⚠ "}):e.jsx(r,{children:" "}),e.jsx(t,{flexGrow:1,children:e.jsxs(r,{bold:i,inverse:i,wrap:"truncate",children:[l.displayName??l.packageName,f?" [ack]":""]})}),g&&e.jsxs(r,{color:j,children:[" ",g]}),e.jsxs(r,{dimColor:!0,children:[" ",l.currentRange]}),e.jsxs(r,{dimColor:!0,children:[" ","→"," "]}),e.jsxs(r,{children:[l.newRange," "]}),e.jsx(r,{bold:!0,color:s,children:l.updateType})]})},Ne=({count:a,ecosystem:l=!1,name:i})=>e.jsxs(t,{flexShrink:0,height:1,marginTop:1,children:[e.jsxs(r,{color:l?"cyan":void 0,dimColor:!l,children:[l?"◈":"▼"," "]}),e.jsx(r,{bold:!0,color:l?"cyan":"white",children:i.toUpperCase()}),e.jsxs(r,{dimColor:!0,children:[" ","(",a,")"]}),l&&e.jsxs(r,{color:"cyan",dimColor:!0,children:[" ","ci/cd refs"]})]}),De=({checkedEntries:a,entries:l,filterActive:i,filteredOutCount:s,filterText:d,filterType:h,focused:f,groupedByCatalog:w,isDryRun:g,onViewportHeightChange:j,scrollOffset:c,selectedIndex:v,totalCatalogEntries:M,totalChecked:R,totalEntries:U,viewportHeight:P})=>{const B=f?"white":"gray",{measuredHeight:m,ref:E}=Te(P,j);let V=0,y=0,N=0,A=0;for(const u of l)u.updateType==="major"?V++:u.updateType==="minor"?y++:N++,(u.vulnerabilities&&u.vulnerabilities.length>0||u.socketReport&&u.socketReport.alerts.length>0)&&A++;const b=[];V>0&&b.push(`${V} major`),y>0&&b.push(`${y} minor`),N>0&&b.push(`${N} patch`),A>0&&b.push(`${A} vulnerable`);const D=b.length>0?` (${b.join(", ")})`:"",C=l.filter(u=>u.kind==="ecosystem").length,T=l.length-C;let F=0;for(const u of l)a.has(I(u))&&F++;const O=[];let H=0;for(const[u,S]of w){O.push(e.jsx(Ne,{count:S.length,ecosystem:S[0]?.kind==="ecosystem",name:u},`hdr-${u}`));for(const k of S){const X=H;O.push(e.jsx(Me,{checked:a.has(I(k)),entry:k,isSelected:X===v},I(k))),H++}}let L=0;for(const[,u]of w)L+=2+u.length;const _=L>m&&m>0;return e.jsxs(t,{borderColor:B,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsxs(t,{flexShrink:0,gap:1,paddingX:1,children:[e.jsx(r,{bold:!0,inverse:!0,children:" VIS "}),e.jsxs(r,{wrap:"truncate",children:[C>0?T:U,R>0?`/${R}`:""," ",C>0?"pkgs":"outdated",D,M>R?` · ${M-R} dupes`:""]}),C>0&&e.jsxs(r,{color:"cyan",children:[" ","◈",C," ","ci/cd"]}),!g&&F>0&&e.jsxs(r,{dimColor:!0,children:[" ","—",F," ","selected"]})]}),e.jsx(t,{flexShrink:0,paddingX:1,paddingY:1,children:e.jsx(Ce,{isFocused:f,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:()=>{},showIndex:!1,value:h,children:ve.map(({id:u,label:S})=>e.jsx(be,{name:u,children:S},u))})}),i&&e.jsxs(t,{flexShrink:0,paddingX:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/ "}),e.jsx(r,{children:d}),e.jsx(r,{inverse:!0,children:" "})]}),s>0&&e.jsx(t,{flexShrink:0,paddingX:1,children:e.jsxs(r,{color:"yellow",children:["⚠"," ",s," ","package",s===1?"":"s"," ","filtered out by target constraint — press"," ",e.jsx(r,{bold:!0,color:"white",children:"f"})," ","to view"]})}),e.jsxs(t,{flexDirection:"row",flexGrow:1,overflow:"hidden",ref:E,children:[e.jsx(t,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:e.jsx(t,{flexDirection:"column",marginTop:-c,children:O})}),_&&e.jsx(t,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(pe,{contentHeight:L,placement:"inset",scrollOffset:c,style:"block",viewportHeight:m})})]},`list-${h}-${d}`)]})},Le=100,Pe=40,Be=10,Ve=[],G=["all","major","minor","patch","security"],Ye=({autoExitSeconds:a=0,changelogUrls:l,checkedCount:i=0,filteredOutEntries:s=Ve,isDryRun:d,store:h,totalCatalogEntries:f=0})=>{const{exit:w}=fe(),{columns:g,rows:j}=ae(),c=p.useSyncExternalStore(h.subscribe,h.getSnapshot),[v,M]=p.useState(!1),[R,U]=p.useState(!1),P=p.useRef(null),B=p.useRef(null),m=p.useRef(null),E=p.useRef(null),[V,y]=p.useState(0),[N,A]=p.useState(!1),[b,D]=p.useState(!1),C=p.useMemo(()=>h.getFilteredEntries(),[c.entries,c.filterType,c.filterText,c.sortMode]),T=C[c.selectedIndex]??null,F=T?h.getRecommendation(T.packageName):void 0,O=T&&l?l.get(T.packageName):void 0,H=p.useCallback(o=>{let n=0,x=0;for(const[,Q]of c.groupedByCatalog){n+=2;for(let oe=0;oe<Q.length;oe++){if(x===o)return n;n+=1,x++}}return n},[c.groupedByCatalog]),L=Math.max(1,j-8-(c.filterActive?1:0)),[_,u]=p.useState(L),S=_>0?_:L,k=p.useCallback(o=>{const n=H(o);y(x=>n>x+S-2?Math.max(0,n-S+2):n<x+1?Math.max(0,n-1):x)},[H,S]);if(p.useEffect(()=>{m.current?.scrollToTop()},[T?.packageName]),me((o,n)=>{if(o==="c"&&n.ctrl){w();return}if(!b){if(R){n.escape||o==="f"||o==="q"?U(!1):n.downArrow||o==="j"?B.current?.scrollBy(1):(n.upArrow||o==="k")&&B.current?.scrollBy(-1);return}if(N){o==="u"||n.return?(A(!1),h.startApply(),w(h.getCheckedEntries())):n.escape||o==="q"?A(!1):n.downArrow||o==="j"?E.current?.scrollBy(1):n.upArrow||o==="k"?E.current?.scrollBy(-1):n.pageDown?E.current?.scrollBy(5):n.pageUp&&E.current?.scrollBy(-5);return}if(v){n.escape||o==="?"?M(!1):o==="q"?(M(!1),D(!0)):n.downArrow||o==="j"?P.current?.scrollBy(1):(n.upArrow||o==="k")&&P.current?.scrollBy(-1);return}if(o==="?"){M(!0);return}if(o==="q"){D(!0);return}if(n.tab){h.setFocusedPanel(c.focusedPanel==="list"?"detail":"list");return}if(c.focusedPanel==="list"&&(n.leftArrow||n.rightArrow)){const x=G.indexOf(c.filterType),Q=n.rightArrow?(x+1)%G.length:(x-1+G.length)%G.length;y(0),m.current?.scrollToTop(),h.setFilterType(G[Q]);return}if(o==="f"&&s.length>0){U(x=>!x);return}if(c.filterActive){if(n.escape){h.setFilterActive(!1);return}if(n.return){h.setFilterActive(!1);return}if(n.backspace){y(0),h.setFilter(c.filterText.slice(0,-1));return}if(o&&!n.ctrl&&!n.meta){y(0),h.setFilter(c.filterText+o);return}return}if(c.focusedPanel==="list"){if(n.downArrow||o==="j"){const x=Math.min(c.selectedIndex+1,C.length-1);h.setSelectedIndex(x),k(x);return}if(n.upArrow||o==="k"){const x=Math.max(c.selectedIndex-1,0);h.setSelectedIndex(x),k(x);return}if(n.pageDown){const x=Math.min(c.selectedIndex+10,C.length-1);h.setSelectedIndex(x),k(x);return}if(n.pageUp){const x=Math.max(c.selectedIndex-10,0);h.setSelectedIndex(x),k(x);return}if(n.home){h.setSelectedIndex(0),y(0);return}if(n.end){const x=C.length-1;h.setSelectedIndex(x),k(x);return}if(o===" "||n.return){T&&h.toggleCheck(T);return}if(o==="a"){h.toggleAll();return}if(o==="s"){h.cycleSortMode(),k(h.getSnapshot().selectedIndex);return}if(o==="/"){h.setFilterActive(!0);return}if(o==="u"&&!d&&c.checkedEntries.size>0){A(!0);return}if(n.rightArrow){h.setFocusedPanel("detail");return}return}if(c.focusedPanel==="detail"){if(n.escape||n.leftArrow){h.setFocusedPanel("list");return}if(n.downArrow||o==="j"){m.current?.scrollBy(1);return}if(n.upArrow||o==="k"){m.current?.scrollBy(-1);return}if(n.pageDown){m.current?.scrollBy(10);return}if(n.pageUp){m.current?.scrollBy(-10);return}if(n.home){m.current?.scrollToTop();return}n.end&&m.current?.scrollToBottom()}}},{isActive:!0}),g<Pe||j<Be)return e.jsx(t,{alignItems:"center",height:j,justifyContent:"center",width:g,children:e.jsxs(r,{color:"yellow",children:["Terminal too small (",g,"x",j,")"]})});const X=g>=Le,K=[e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"q"}),e.jsx(r,{dimColor:!0,children:"QUIT"})]},"q"),e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"?"}),e.jsx(r,{dimColor:!0,children:"HELP"})]},"?"),e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"}),e.jsx(r,{dimColor:!0,children:"NAV"})]},"nav"),e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Space"}),e.jsx(r,{dimColor:!0,children:"CHECK"})]},"sp"),e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"a"}),e.jsx(r,{dimColor:!0,children:"ALL"})]},"a")];!d&&c.checkedEntries.size>0&&K.push(e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"green",children:"u"}),e.jsx(r,{dimColor:!0,children:"APPLY"})]},"u")),s.length>0&&K.push(e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"yellow",children:"f"}),e.jsxs(r,{dimColor:!0,children:["FILTERED (",s.length,")"]})]},"fo")),K.push(e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"←→"}),e.jsx(r,{dimColor:!0,children:"FILTER"})]},"lr"),e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/"}),e.jsx(r,{dimColor:!0,children:"SEARCH"})]},"f"),e.jsxs(t,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Tab"}),e.jsx(r,{dimColor:!0,children:"PANEL"})]},"t"));const ee=e.jsx(t,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:e.jsx(t,{flexWrap:"wrap",gap:2,paddingX:1,children:K})}),re=e.jsxs(z,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"?"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:P,title:"KEYBOARD SHORTCUTS",visible:v,width:52,children:[e.jsxs(t,{flexDirection:"column",marginBottom:1,children:[e.jsxs(t,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),e.jsxs(t,{children:[e.jsx(t,{width:24,children:e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↑","/k"]}),e.jsx(r,{dimColor:!0,children:" Move up"})]})}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↓","/j"]}),e.jsx(r,{dimColor:!0,children:" Move down"})]})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Tab"]}),e.jsx(r,{dimColor:!0,children:" Switch panel"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","→","/","←"]}),e.jsx(r,{dimColor:!0,children:" Focus detail/list"})]})]}),e.jsxs(t,{flexDirection:"column",marginBottom:1,children:[e.jsxs(t,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"SELECTION"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Space"]}),e.jsx(r,{dimColor:!0,children:" Toggle check on package"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","a"]}),e.jsx(r,{dimColor:!0,children:" Toggle check all"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","s"]}),e.jsx(r,{dimColor:!0,children:" Cycle sort (default / name / type / severity)"})]})]}),e.jsxs(t,{flexDirection:"column",marginBottom:1,children:[e.jsxs(t,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"FILTERS"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","←→"]}),e.jsx(r,{dimColor:!0,children:" Switch filter tab"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","/"]}),e.jsx(r,{dimColor:!0,children:" Text filter"})]}),s.length>0&&e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","f"]}),e.jsx(r,{dimColor:!0,children:" View filtered-out packages"})]})]}),e.jsxs(t,{flexDirection:"column",children:[e.jsxs(t,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"ACTIONS"})]}),!d&&e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","u"]}),e.jsx(r,{dimColor:!0,children:" Apply selected updates"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","q"]}),e.jsx(r,{dimColor:!0,children:" Quit"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","?"]}),e.jsx(r,{dimColor:!0,children:" Toggle help"})]})]})]}),Y=h.getCheckedEntries(),q=Y.filter(o=>o.updateType==="major").length,ue=e.jsxs(t,{alignItems:"center",flexDirection:"column",children:[q>0&&e.jsx(t,{marginBottom:1,marginTop:1,children:e.jsxs(r,{color:"yellow",children:["⚠"," ",q," ","major update",q===1?"":"s"," ","— review breaking changes"]})}),e.jsxs(r,{dimColor:!0,children:["Press"," ",e.jsx(r,{bold:!0,color:"white",children:"u"})," ","or"," ",e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","to confirm,"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","to cancel"]})]}),le=e.jsx(z,{footer:ue,scrollRef:E,title:`Apply ${Y.length} update${Y.length===1?"":"s"}?`,visible:N,width:70,children:Y.map(o=>e.jsxs(t,{gap:1,children:[e.jsxs(r,{children:[" ",o.displayName??o.packageName]}),e.jsxs(r,{dimColor:!0,children:[o.currentRange," ","→"," ",o.newRange]}),e.jsx(r,{bold:!0,color:o.updateType==="major"?"red":o.updateType==="minor"?"yellow":"green",children:o.updateType})]},o.packageName))}),te=s.length>0?e.jsx(z,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"f"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:B,title:`${s.length} PACKAGE${s.length===1?"":"S"} FILTERED BY TARGET`,visible:R,width:70,children:e.jsxs(t,{flexDirection:"column",children:[e.jsx(t,{marginBottom:1,children:e.jsxs(r,{dimColor:!0,children:["These packages have newer versions available but are excluded by the current target constraint. Use"," ",e.jsx(r,{bold:!0,color:"white",children:"--target latest"})," ","to include them."]})}),s.map(o=>e.jsxs(t,{gap:1,children:[e.jsxs(r,{children:[" ",o.packageName]}),e.jsxs(r,{dimColor:!0,children:[o.currentRange," ","→"," ",o.newRange]}),e.jsx(r,{bold:!0,color:o.updateType==="major"?"red":o.updateType==="minor"?"yellow":"green",children:o.updateType})]},o.packageName))]})}):null,se=e.jsx(De,{checkedEntries:c.checkedEntries,entries:C,filterActive:c.filterActive,filteredOutCount:s.length,filterText:c.filterText,filterType:c.filterType,focused:c.focusedPanel==="list",groupedByCatalog:c.groupedByCatalog,isDryRun:d,onViewportHeightChange:u,scrollOffset:V,selectedIndex:c.selectedIndex,totalCatalogEntries:f,totalChecked:i,totalEntries:C.length,viewportHeight:S}),ie=e.jsx(Ae,{changelogUrl:O,entry:T,focused:c.focusedPanel==="detail",recommendation:F,scrollRef:m});if(X){const o=Math.floor(g*.35);return e.jsxs(t,{flexDirection:"column",height:j,width:g,children:[e.jsxs(t,{flexDirection:"row",flexGrow:1,children:[e.jsx(t,{flexGrow:1,children:se}),e.jsx(t,{width:o,children:ie})]}),ee,le,te,e.jsx(ce,{autoExitSeconds:a||3,onCancel:()=>{D(!1)},visible:b}),re]})}const ge=Math.floor(j*.55);return e.jsxs(t,{flexDirection:"column",height:j,width:g,children:[e.jsx(t,{height:ge,children:se}),e.jsx(t,{flexGrow:1,children:ie}),ee,le,te,e.jsx(ce,{autoExitSeconds:a||3,onCancel:()=>{D(!1)},visible:b}),re]})};export{_e as C,Ke as U,Ye as V,J as e};