@visulima/vis 1.0.0-alpha.45 → 1.0.0-alpha.46

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 (113) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/binx.js +1 -1
  4. package/dist/packem_chunks/CONFIG_FILES.js +3 -3
  5. package/dist/packem_chunks/agent-instructions.js +11 -0
  6. package/dist/packem_chunks/bloom-status.js +1 -1
  7. package/dist/packem_chunks/bloom-sync.js +1 -1
  8. package/dist/packem_chunks/catalog.js +1 -1
  9. package/dist/packem_chunks/cli-exec.js +1 -1
  10. package/dist/packem_chunks/cli-main.js +23 -23
  11. package/dist/packem_chunks/defineReleasePlugin.js +3 -0
  12. package/dist/packem_chunks/fix.js +1 -1
  13. package/dist/packem_chunks/group-tags.js +1 -0
  14. package/dist/packem_chunks/handler10.js +1 -1
  15. package/dist/packem_chunks/handler12.js +1 -1
  16. package/dist/packem_chunks/handler13.js +1 -1
  17. package/dist/packem_chunks/handler14.js +1 -1
  18. package/dist/packem_chunks/handler15.js +1 -1
  19. package/dist/packem_chunks/handler19.js +1 -1
  20. package/dist/packem_chunks/handler20.js +1 -1
  21. package/dist/packem_chunks/handler21.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/handler32.js +1 -1
  26. package/dist/packem_chunks/handler4.js +1 -1
  27. package/dist/packem_chunks/handler40.js +19 -19
  28. package/dist/packem_chunks/handler5.js +1 -1
  29. package/dist/packem_chunks/handler50.js +1 -1
  30. package/dist/packem_chunks/handler51.js +1 -1
  31. package/dist/packem_chunks/handler54.js +1 -1
  32. package/dist/packem_chunks/handler57.js +11 -5
  33. package/dist/packem_chunks/handler58.js +5 -11
  34. package/dist/packem_chunks/handler59.js +11 -3
  35. package/dist/packem_chunks/handler6.js +1 -1
  36. package/dist/packem_chunks/handler60.js +3 -22
  37. package/dist/packem_chunks/handler61.js +21 -60
  38. package/dist/packem_chunks/handler62.js +61 -3
  39. package/dist/packem_chunks/handler63.js +3 -6
  40. package/dist/packem_chunks/handler64.js +6 -9
  41. package/dist/packem_chunks/handler65.js +9 -2
  42. package/dist/packem_chunks/handler66.js +2 -24
  43. package/dist/packem_chunks/handler67.js +24 -25
  44. package/dist/packem_chunks/handler68.js +25 -153
  45. package/dist/packem_chunks/handler69.js +153 -10
  46. package/dist/packem_chunks/handler7.js +1 -1
  47. package/dist/packem_chunks/handler70.js +10 -23
  48. package/dist/packem_chunks/handler71.js +23 -322
  49. package/dist/packem_chunks/handler72.js +273 -659
  50. package/dist/packem_chunks/handler73.js +708 -48
  51. package/dist/packem_chunks/handler74.js +48 -27
  52. package/dist/packem_chunks/handler75.js +27 -3
  53. package/dist/packem_chunks/handler76.js +3 -190
  54. package/dist/packem_chunks/handler77.js +189 -37
  55. package/dist/packem_chunks/handler78.js +38 -0
  56. package/dist/packem_chunks/heal.js +1 -1
  57. package/dist/packem_chunks/help-command.js +1 -1
  58. package/dist/packem_chunks/index3.js +1 -1
  59. package/dist/packem_chunks/keys-refresh.js +1 -1
  60. package/dist/packem_chunks/list.js +1 -1
  61. package/dist/packem_chunks/orchestrator.js +26 -23
  62. package/dist/packem_chunks/prune.js +1 -1
  63. package/dist/packem_chunks/state.js +3 -3
  64. package/dist/packem_chunks/status.js +1 -1
  65. package/dist/packem_chunks/sync.js +1 -1
  66. package/dist/packem_chunks/sync2.js +1 -1
  67. package/dist/packem_chunks/tripwire.js +1 -1
  68. package/dist/packem_chunks/verify-lockfile.js +1 -1
  69. package/dist/packem_shared/ReleaseClient-BY4OZNCK.js +1 -0
  70. package/dist/packem_shared/{Table-BGIHvenQ-D2oJtNQj.js → Table-CcVkyULl-DLWu6XHL.js} +1 -1
  71. package/dist/packem_shared/{advisories-CefYKEPe.js → advisories-B76fBVL-.js} +1 -1
  72. package/dist/packem_shared/{ai-analysis-rC48NLfB.js → ai-analysis-DF_AfeS3.js} +1 -1
  73. package/dist/packem_shared/{ai-fix-D_ijV3Rn.js → ai-fix-D1bFLkfk.js} +1 -1
  74. package/dist/packem_shared/{bin-CPMo34SM.js → bin-BlGVEhl8.js} +1 -1
  75. package/dist/packem_shared/{build-scripts-MTSK6TNr.js → build-scripts-q__dKE2y.js} +1 -1
  76. package/dist/packem_shared/{cyclonedx-BeUmPgfO.js → cyclonedx-CmrYQ0vx.js} +1 -1
  77. package/dist/packem_shared/{docker-CViFYtmM.js → docker-BYqiD711.js} +1 -1
  78. package/dist/packem_shared/{env-Ct3hMEYB.js → env-DJlbJiFh.js} +1 -1
  79. package/dist/packem_shared/{failure-log-Dy2G-rKi.js → failure-log-Bt7sW4p7.js} +1 -1
  80. package/dist/packem_shared/{index-XAb0QGqA.js → index-C6tpgeIV.js} +2 -2
  81. package/dist/packem_shared/{index-Cntyu-w8.js → index-D6fJJDli.js} +1 -1
  82. package/dist/packem_shared/{lifecycle-CHcFuWf_.js → lifecycle-XeMei1ED.js} +1 -1
  83. package/dist/packem_shared/{manifests-WBnsV_Eb.js → manifests-DSBr3-dw.js} +1 -1
  84. package/dist/packem_shared/{native-config-sync-BFDVK9LH.js → native-config-sync-D-z2Uwqu.js} +1 -1
  85. package/dist/packem_shared/{osv-bloom-DVMlkcAO.js → osv-bloom-DMhXP184.js} +1 -1
  86. package/dist/packem_shared/{packument-C-A3Uhhx.js → packument-CY2QDFml.js} +1 -1
  87. package/dist/packem_shared/plugins.d-ND23R9I3.d.ts +4 -0
  88. package/dist/packem_shared/{provenance-R2csDSNg.js → provenance-DVHiWZrW.js} +1 -1
  89. package/dist/packem_shared/{registry-keys-CMnS_Qt_.js → registry-keys-BKEq72qX.js} +1 -1
  90. package/dist/packem_shared/{resolve-explicit-C4oQMyoB.js → resolve-explicit-UtkNrGKq.js} +1 -1
  91. package/dist/packem_shared/{runtime-check-BXehSP06.js → runtime-check-qnrPTlma.js} +1 -1
  92. package/dist/packem_shared/{s1ngularity-BCDt28u0.js → s1ngularity-DUZtU95L.js} +1 -1
  93. package/dist/packem_shared/{scan-progress-YRpDs90j.js → scan-progress-BgtHexnt.js} +1 -1
  94. package/dist/packem_shared/{signatures-B3srzCEv.js → signatures-QoCuUv9E.js} +1 -1
  95. package/dist/packem_shared/target-merge-Dg25Izl5.js +11 -0
  96. package/dist/packem_shared/{toolchain-C44mPKPu.js → toolchain-Zb3VzZb4.js} +1 -1
  97. package/dist/packem_shared/{typosquats-CQz-1Y6K.js → typosquats-C12CP_2G.js} +1 -1
  98. package/dist/packem_shared/{use-measured-height-DHi0xOPO.js → use-measured-height-BpKmrlkw.js} +1 -1
  99. package/dist/packem_shared/{vis-update-app-B3I14Vfy.js → vis-update-app-BoCQ4ute.js} +1 -1
  100. package/dist/packem_shared/{watch-loop-JfGKIgKB.js → watch-loop-BZudYfcl.js} +1 -1
  101. package/dist/release/index.d.ts +39 -2
  102. package/dist/release/index.js +1 -1
  103. package/dist/release/plugin-sdk.d.ts +2 -1
  104. package/dist/release/plugin-sdk.js +1 -1
  105. package/dist/release/types.d.ts +117 -1
  106. package/dist/release/types.js +1 -1
  107. package/index.js +52 -52
  108. package/package.json +9 -9
  109. package/schemas/vis-config.schema.json +33 -0
  110. package/schemas/vis-release-config.schema.json +33 -0
  111. package/dist/packem_shared/ReleaseClient-YHzBIxYS.js +0 -1
  112. package/dist/packem_shared/target-merge-DOm6h6tW.js +0 -11
  113. /package/dist/packem_shared/{readJsonSync-CvkZyKmL-ihoybKvs.js → readJsonSync-DuMMeB3s-ihoybKvs.js} +0 -0
@@ -1,48 +1,708 @@
1
- import{createRequire as ht}from"node:module";import{I as ze,s as I,E as q,q as Ge,V as G,j as yt}from"../packem_shared/index.server-J83sowC4.js";import{m as _,f as O,v as K,I as Y,A as kt,T as wt}from"../packem_shared/index-CE6MsgcV.js";import{u as Ee,m as vt}from"./ts-loader.js";import{E as bt}from"../packem_shared/public-api-WqUCiyIe.js";import{P as Rt,ak as xt,i as ge}from"./cli-main.js";import{_ as At,w as St,x as Et,g as Ct,R as Tt,c as jt,V as It,y as Nt,z as Ke,$ as Ce,d as P,h as me,i as L,H as Je,A as Dt,F as W,Z as Ut,L as Vt,j as Ot,G as Bt}from"./catalog.js";import{B as _t}from"../packem_shared/env-Ct3hMEYB.js";import{I as le}from"../packem_shared/index-B0EsgdzO.js";import{K as qt,Z as Wt,W as Te}from"../packem_shared/ai-analysis-rC48NLfB.js";import{v as Ht,h as Lt,s as Ye}from"../packem_shared/pm-runner-CQcraCcu.js";import{a as Ft,r as zt}from"../packem_shared/command-runtime-3FTGuUsK.js";import{r as Gt,a as Kt,p as Jt}from"../packem_shared/resolve-explicit-C4oQMyoB.js";import{S as Yt}from"../packem_shared/min-release-age-C71MO72F.js";import{r as Zt,s as Xt}from"../packem_shared/typosquats-CQz-1Y6K.js";import{U as Qt,b as en,u as je,e as tn}from"../packem_shared/vis-update-app-B3I14Vfy.js";import{h as Ze,P as Xe}from"../packem_shared/peer-warnings-BXAzXqY3.js";import{f as Qe}from"../packem_shared/utils-CRueU43T.js";import{s as te}from"../packem_shared/index-Cg0IHaFI.js";import{r as nn,q as sn}from"../packem_shared/advisories-CefYKEPe.js";const $t=ht(import.meta.url),Q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Le=e=>{if(typeof Q<"u"&&Q.versions&&Q.versions.node){const[n,t]=Q.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return Q.getBuiltinModule(e)}return $t(e)},{createInterface:Fe}=Le("node:readline"),{existsSync:Mt,realpathSync:Pt}=Le("node:fs"),on=e=>{const n=[];for(const t of e.filters)n.push("--filter",t);return e.workspaceRoot&&n.push("--filter","."),n.push("update"),e.latest&&n.push("--latest"),e.recursive&&n.push("--recursive"),e.interactive&&n.push("--interactive"),e.dev&&n.push("--dev"),e.prod&&n.push("--prod"),e.noOptional&&n.push("--no-optional"),e.noSave&&n.push("--no-save"),n.push(...e.packages),{args:n,bin:"pnpm"}},rn=e=>{const n=[];return e.filters.length>0&&n.push("workspace",e.filters[0]),n.push("upgrade"),e.latest&&n.push("--latest"),n.push(...e.packages),{args:n,bin:"yarn"}},an=e=>{const n=[];if(e.filters.length>0||e.recursive){n.push("workspaces","foreach","--all");for(const t of e.filters)n.push("--include",t)}return n.push("up"),e.interactive&&n.push("--interactive"),n.push(...e.packages),{args:n,bin:"yarn"}},cn=(e,n)=>{const t=["update"];e.latest&&n.push("npm does not support --latest flag. Packages will be updated within their semver range."),e.interactive&&n.push("npm does not support --interactive mode.");for(const s of e.filters)t.push("--workspace",s);return e.recursive&&t.push("--workspaces"),e.workspaceRoot&&t.push("--include-workspace-root"),e.dev&&t.push("--dev"),e.prod&&t.push("--production"),e.noOptional&&t.push("--no-optional"),e.noSave&&t.push("--no-save"),t.push(...e.packages),{args:t,bin:"npm"}},ln=e=>{const n=["update"];e.latest&&n.push("--latest");for(const t of e.filters)n.push("--filter",t);return n.push(...e.packages),{args:n,bin:"bun"}},un=(e,n)=>{const t=["outdated","--update"];return e.latest&&t.push("--latest"),e.interactive&&t.push("--interactive"),e.filters.length>0&&n.push("deno outdated has no --filter flag; ignoring."),(e.dev||e.prod)&&n.push("deno outdated has no --dev / --prod flags; dev/prod is governed by deno.json."),e.noOptional&&n.push("deno outdated has no --no-optional flag; ignoring."),e.noSave&&n.push("deno outdated has no --no-save flag; ignoring."),t.push(...e.packages),{args:t,bin:"deno"}},dn=(e,n,t)=>{const s=[];if(t.global&&e!=="aube"&&e!=="deno")return{command:{args:["update","--global",...t.packages],bin:"npm"},warnings:s};let r;switch(e){case"aube":{const o=Ht(t);r={args:o.args,bin:o.bin},s.push(...o.warnings);break}case"bun":{r=ln(t);break}case"deno":{r=un(t,s);break}case"npm":{r=cn(t,s);break}case"pnpm":{r=on(t);break}case"yarn":{r=n.startsWith("1.")?rn(t):an(t);break}default:{const o=e;throw new Error(`Unsupported package manager: ${String(o)}`)}}return{command:r,warnings:s}},et=e=>{const n=e.indexOf("@");return n<=0?e:e.slice(0,n)},pn=e=>{switch(e){case"docker":case"docker-compose":return"docker";case"github-actions":return"actions";case"gitlab-ci":return"gitlab";default:return}},fn=(e,n)=>{const t=[".github/dependabot.yml",".github/dependabot.yaml"];for(const s of t){const r=_(e,s);if(!O(r))continue;let o;try{o=bt(K(r))}catch{continue}if(o?.updates){for(const i of o.updates){const a=pn(i["package-ecosystem"]);if(!(!a||!Array.isArray(i.ignore)))for(const d of i.ignore){const c=d["dependency-name"];typeof c=="string"&&c.length>0&&n[a].add(et(c))}}return}}},gn=Object.freeze({"docker-compose":"docker",dockerfile:"docker","github-actions":"actions",gitlabci:"gitlab","gitlabci-include":"gitlab"}),mn=Object.freeze({docker:"docker","github-tags":"actions"}),he=(e,n)=>{if(n)for(const t of n)typeof t=="string"&&t.length>0&&e.add(et(t))},hn=e=>{let n="",t=0;const{length:s}=e;let r=!1,o="";for(;t<s;){const i=e[t]??"";if(r){if(n+=i,i==="\\"&&t+1<s){n+=e[t+1]??"",t+=2;continue}i===o&&(r=!1),t+=1;continue}if(i==='"'||i==="'"){r=!0,o=i,n+=i,t+=1;continue}if(i==="/"&&e[t+1]==="/"){for(;t<s&&e[t]!==`
2
- `;)t+=1;continue}if(i==="/"&&e[t+1]==="*"){for(t+=2;t<s&&!(e[t]==="*"&&e[t+1]==="/");)t+=1;t+=2;continue}if(i===","){let a=t+1;for(;a<s&&/\s/.test(e[a]??"");)a+=1;const d=e[a];if(d==="}"||d==="]"){t+=1;continue}}n+=i,t+=1}return n},$n=(e,n)=>{const t=["renovate.json","renovate.json5",".renovaterc",".renovaterc.json"];for(const s of t){const r=_(e,s);if(!O(r))continue;let o;try{const a=K(r);o=JSON.parse(hn(a))}catch{continue}if(!o)continue;if(Array.isArray(o.ignoreDeps))for(const a of["actions","docker","gitlab"])he(n[a],o.ignoreDeps);const i=[["github-actions","actions"],["dockerfile","docker"],["docker-compose","docker"],["gitlabci","gitlab"],["gitlabci-include","gitlab"]];for(const[a,d]of i){const c=o[a];he(n[d],c?.ignoreDeps)}if(!Array.isArray(o.packageRules))return;for(const a of o.packageRules){if(a.enabled!==!1)continue;const d=new Set;for(const u of a.matchManagers??[]){const f=gn[u];f&&d.add(f)}for(const u of a.matchDatasources??[]){const f=mn[u];f&&d.add(f)}d.size===0&&(d.add("actions"),d.add("docker"),d.add("gitlab"));const c=[...a.matchPackageNames??[],...a.matchDepNames??[],...a.matchPackagePatterns??[]];for(const u of d)he(n[u],c)}return}},yn=e=>{const n={actions:new Set,docker:new Set,gitlab:new Set};return fn(e,n),$n(e,n),n},ke=(e,n,t)=>{const s=t[n];if(s.size===0)return!1;if(s.has(e))return!0;for(const r of s)if(/[*?[\]/.+]/.test(r))try{const o=r.replaceAll(/[.+^${}()|]/g,String.raw`\$&`).replaceAll("*",".*").replaceAll("?",".");if(new RegExp(`^${o}$`).test(e))return!0}catch{}return!1},F=e=>{const n=e.trim();if(n==="")return;const t=n.startsWith("v")||n.startsWith("V")?n.slice(1):n,s=(te.valid(t)?te.parse(t):void 0)??te.coerce(t,{includePrerelease:!0});if(s)return{major:s.major,minor:s.minor,normalized:`${String(s.major)}.${String(s.minor)}.${String(s.patch)}${s.prerelease.length>0?`-${s.prerelease.join(".")}`:""}`,patch:s.patch,prerelease:s.prerelease.length>0,raw:n}},kn=(e,n)=>te.rcompare(e.normalized,n.normalized),we=(e,n,t,s)=>{if(!n&&t!=="latest")return;const r=e.filter(o=>o.prerelease?!1:n?t==="patch"&&(o.major!==n.major||o.minor!==n.minor)||t==="minor"&&o.major!==n.major?!1:te.gt(o.normalized,n.normalized):!0);if(r.length!==0)return r.toSorted(kn)[0]},ve=(e,n)=>!e||!n?"unknown":n.major!==e.major?"major":n.minor!==e.minor?"minor":n.patch!==e.patch?"patch":"unknown",wn="GitHub Actions",Ie=(e,n)=>`${e}@${n}`,vn=e=>({fixedVersions:e.fixedVersions,id:e.id,severity:e.severity,summary:e.summary}),bn=(e,n)=>{if(n.length===0)return n;const t=nn(e);if(!Mt(t))return n;const s=new Map;for(const o of n){const i=o.currentVersion??o.currentRef;i&&s.set(Ie(o.name,i),{name:o.name,version:i})}if(s.size===0)return n;const r=new Map;try{for(const[o,i]of s){const a=sn([i],{ecosystem:wn,workspaceRoot:e}).get(i.name);a&&a.length>0&&r.set(o,a)}}catch{return n}return r.size===0?n:n.map(o=>{const i=o.currentVersion??o.currentRef;if(!i)return o;const a=r.get(Ie(o.name,i));return a?{...o,advisories:a.map(d=>vn(d))}:o})},tt=e=>{if(!e)return{};const n={};for(const t of e.split(",")){const s=/^\s*<([^>]+)>\s*;\s*(.+)$/.exec(t);if(!s)continue;const r=s[1]??"",o=s[2]??"";switch(/rel\s*=\s*"?([^";\s]+)"?/i.exec(o)?.[1]?.toLowerCase()){case"first":{n.first=r;break}case"last":{n.last=r;break}case"next":{n.next=r;break}case"prev":case"previous":{n.previous=r;break}}}return n};class Rn{token;apiBase;fetchImpl;tagsCache=new Map;commitCache=new Map;constructor(n){this.token=n.token??process.env.GITHUB_TOKEN??process.env.GH_TOKEN,this.apiBase=n.apiBase??"https://api.github.com",this.fetchImpl=n.fetch??fetch}async listTags(n,t){const s=`${n}/${t}`,r=this.tagsCache.get(s);if(r)return r;const o=this.fetchTags(n,t);return this.tagsCache.set(s,o),o}async resolveRef(n,t,s){const r=`${n}/${t}@${s}`,o=this.commitCache.get(r);if(o)return o;const i=this.fetchCommit(n,t,s);return this.commitCache.set(r,i),i}buildHeaders(){const n={Accept:"application/vnd.github+json","User-Agent":"vis-update-actions","X-GitHub-Api-Version":"2022-11-28"};return this.token&&(n.Authorization=`Bearer ${this.token}`),n}async fetchTags(n,t){const s=`${this.apiBase}/repos/${encodeURIComponent(n)}/${encodeURIComponent(t)}/tags?per_page=100`,r={parsed:[],tags:[]},o=[];let i=s,a=0;for(;i&&a<5;){const c=i;let u;try{u=await this.fetchImpl(c,{headers:this.buildHeaders()})}catch{return r}if(!u.ok)return r;let f;try{f=await u.json()}catch{return r}if(!Array.isArray(f))return r;for(const g of f){const m=typeof g.name=="string"?g.name:"",h=typeof g.commit?.sha=="string"?g.commit.sha:"";m!==""&&h!==""&&o.push({name:m,sha:h})}i=tt(u.headers.get("link")).next,a+=1}const d=[];for(const c of o){const u=F(c.name);u&&d.push({...u,sha:c.sha})}return{parsed:d,tags:o}}async fetchCommit(n,t,s){const r=`${this.apiBase}/repos/${encodeURIComponent(n)}/${encodeURIComponent(t)}/commits/${encodeURIComponent(s)}`;try{const o=await this.fetchImpl(r,{headers:this.buildHeaders()});if(!o.ok)return;const i=await o.json();return typeof i.sha!="string"?void 0:{committedAt:i.commit?.committer?.date,sha:i.sha}}catch{return}}}const xn=".github/workflows",An=".github/actions",Sn=/^\s*-?\s*uses:\s*(['"]?)([^'"\s#]+)\1(?:\s*#\s*(.+))?\s*$/,En=/^[a-f0-9]{40}$/i,Cn=/actions-up-ignore-next-line(?::\s*(.+))?/i,Tn=/actions-up-ignore-start/i,jn=/actions-up-ignore-end/i,In=e=>{const n=e.split("/");if(n.length<2)return;const[t,s,...r]=n;if(!(!t||!s))return{owner:t,repo:s,subpath:r.length>0?r.join("/"):void 0}},Nn=(e,n)=>{const t=n.split(/\r?\n/),s=[];let r,o=!1;for(const[i,a]of t.entries()){const d=a??"";if(Tn.test(d)&&(o=!0),jn.test(d)){o=!1;continue}const c=d.trim(),u=c===""||c.startsWith("#")?Cn.exec(d):void 0;if(u){r=u[1]??"actions-up-ignore-next-line";continue}const f=Sn.exec(d);if(!f){r=void 0;continue}const g=f[1]??"",m=g==="'"||g==='"'?g:"",h=f[2]??"",R=f[3]?.trim();if(h.startsWith("./")||h.startsWith("../")||h.startsWith("docker://")){r=void 0;continue}const A=h.lastIndexOf("@");if(A<=0){r=void 0;continue}const $=h.slice(0,A),S=h.slice(A+1),y=In($);if(!y){r=void 0;continue}let p=r??(o?"actions-up-ignore-block":void 0);if(R){const k=/^actions-up-ignore(?:-next-line)?(?::\s*(.+))?(?:\s|$)/i.exec(R);k&&(p=p??k[1]??"actions-up-ignore")}r=void 0,s.push({file:e,ignoreReason:p,isSha:En.test(S),line:i+1,original:`${m}${h}${m}`,owner:y.owner,quote:m,ref:S,repo:y.repo,slug:$,subpath:y.subpath,trailingComment:R&&!p?R:void 0})}return s},Ne=e=>e.endsWith(".yml")||e.endsWith(".yaml"),Dn=(e,n=[])=>{const t=[],s=new Set,r=a=>{if(s.has(a))return;s.add(a);let d;try{d=K(a)}catch{return}const c=Nn(a,d);t.push(...c)},o=_(e,xn);if(O(o))for(const a of Y(o,{includeDirs:!1,includeSymlinks:!1,maxDepth:1}))Ne(a.name)&&r(a.path);const i=_(e,An);if(O(i))for(const a of Y(i,{includeDirs:!1,includeSymlinks:!1,maxDepth:3}))(a.name==="action.yml"||a.name==="action.yaml")&&r(a.path);for(const a of["action.yml","action.yaml"]){const d=_(e,a);O(d)&&r(d)}for(const a of n){const d=kt(a)?a:_(e,a);if(O(d))for(const c of Y(d,{includeDirs:!1,includeSymlinks:!1}))Ne(c.name)&&r(c.path)}return t},Un=40,Vn=1440*60*1e3,On=new Set(["develop","edge","main","master","stable","trunk"]),Bn=e=>e.length===Un&&/^[a-f0-9]{40}$/i.test(e)?!1:On.has(e.toLowerCase())?!0:F(e)===void 0,De=(e,n)=>{for(const t of n)try{if(new RegExp(t).test(e))return!0}catch{if(e.includes(t))return!0}return!1},_n=(e,n,t,s)=>{const r=s==="sha"||e.isSha,{quote:o}=e;return r?`${o}${e.slug}@${n}${o} # ${t}`:`${o}${e.slug}@${t}${o}`},Mn=async(e,n)=>{const{ignoreRules:t,options:s,references:r,resolverOptions:o}=n,i=[],a=[],d=[];if(r.length===0)return{failed:d,ignored:a,updates:i};const c=new Rn({apiBase:o?.apiBase,fetch:o?.fetch,token:s.githubToken??o?.token}),u=new Map;for(const $ of r){const S=`${$.owner}/${$.repo}`,y=u.get(S)??[];y.push($),u.set(S,y)}const f=Math.max(1,s.maxConcurrentRequests),g=[...u.keys()];let m=0;const h=async $=>{const S=u.get($)??[],[y,p]=$.split("/");if(!y||!p)return;let k;try{k=await c.listTags(y,p)}catch{for(const l of S)d.push({file:l.file,reason:`failed to list tags for ${$}`});return}for(const l of S){const E=l.slug;let w;if(l.ignoreReason?w=l.ignoreReason:De(E,s.exclude)?w="matched --exclude":s.include.length>0&&!De(E,s.include)?w="not matched by --include":s.respectDependabotConfig&&t&&ke(E,"actions",t)&&(w="ignored by dependabot/renovate config"),w){a.push({currentRef:l.ref,currentVersion:l.isSha?l.trailingComment?.replace(/^#\s*/,""):l.ref,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:E,newRef:l.ref,newVersion:void 0,original:l.original,reason:w,replacement:l.original,updateType:"unknown"});continue}if(!s.includeBranches&&!l.isSha&&Bn(l.ref)){a.push({currentRef:l.ref,currentVersion:l.ref,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:E,newRef:l.ref,newVersion:void 0,original:l.original,reason:"branch reference (use --include-branches)",replacement:l.original,updateType:"unknown"});continue}const C=l.isSha?l.trailingComment?.replace(/^#\s*/,"").split(/\s+/)[0]??"":l.ref,T=F(C);if(l.isSha&&!T&&s.mode!=="latest"){a.push({currentRef:l.ref,currentVersion:void 0,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:E,newRef:l.ref,newVersion:void 0,original:l.original,reason:`SHA pin has no version-hint comment; cannot apply --target=${s.mode}`,replacement:l.original,updateType:"unknown"});continue}const x=we(k.parsed,T,s.mode);if(!x)continue;if(s.minAgeDays!==void 0){const M=await c.resolveRef(y,p,x.sha),D=M?.committedAt?new Date(M.committedAt).getTime():void 0;if(D&&(Date.now()-D)/Vn<s.minAgeDays){a.push({currentRef:l.ref,currentVersion:T?.raw,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:E,newRef:l.ref,newVersion:x.raw,original:l.original,reason:`release younger than ${String(s.minAgeDays)} days`,replacement:l.original,updateType:"unknown"});continue}}const j=s.style==="sha"||l.isSha?x.sha:x.raw,N=_n(l,x.sha,x.raw,s.style);i.push({currentRef:l.ref,currentVersion:T?.raw??l.trailingComment?.replace(/^#\s*/,""),ecosystem:"actions",file:l.file,line:l.line,name:E,newRef:j,newVersion:x.raw,original:l.original,replacement:N,updateType:ve(T,x),url:`https://github.com/${y}/${p}/releases/tag/${x.raw}`})}},R=[];for(let $=0;$<Math.min(f,g.length);$++)R.push((async()=>{for(;m<g.length;){const S=g[m];m+=1,S!==void 0&&await h(S)}})());await Promise.all(R);const A=bn(e,i);return{failed:d,ignored:a,updates:A}},Pn=e=>e.toSorted((n,t)=>n.file!==t.file?n.file<t.file?-1:1:n.line-t.line),nt=e=>{const n=[],t=[];if(e.length===0)return{applied:n,skipped:t};const s=Pn(e),r=new Map;for(const o of s){const i=r.get(o.file)??[];i.push(o),r.set(o.file,i)}for(const[o,i]of r){let a;try{a=K(o)}catch(g){for(const m of i)t.push({reason:`read failed: ${g.message}`,update:m});continue}const d=a.includes(`\r
3
- `)?`\r
4
- `:`
5
- `,c=a.split(/\r?\n/),u=[];for(const g of i){const m=g.line-1,h=c[m];if(h===void 0){t.push({reason:`line ${String(g.line)} out of range`,update:g});continue}const R=h.indexOf(g.original);if(R===-1){t.push({reason:"original token not found on expected line",update:g});continue}const A=h.slice(0,R),$=h.slice(R+g.original.length),S=/#\s*v?\d/.test(g.replacement)&&/^\s*#\s*v?\d[\w.+-]*\s*$/i.test($)?"":$;c[m]=`${A}${g.replacement}${S}`,u.push(g)}if(u.length===0)continue;const f=c.join(d);try{wt(o,f),n.push(...u)}catch(g){for(const m of u)t.push({reason:`write failed: ${g.message}`,update:m})}}return{applied:n,skipped:t}};class qn{tokens;fetchImpl;tagCache=new Map;constructor(n={}){this.tokens=n.tokens??{},this.fetchImpl=n.fetch??fetch}async listTags(n,t,s){const r=`${n}/${t}/${s}`,o=this.tagCache.get(r);if(o)return o;const i=n==="docker.io"?this.listDockerHubTags(t,s):this.listV2Tags(n,t,s);return this.tagCache.set(r,i),i}async listDockerHubTags(n,t){const s={parsed:[],raw:[]},r=[],o=new Map;let i=`https://hub.docker.com/v2/repositories/${encodeURIComponent(n)}/${encodeURIComponent(t)}/tags?page_size=100`,a=0;for(;i&&a<5;){try{const d=await this.fetchImpl(i,{headers:{Accept:"application/json"}});if(!d.ok)break;const c=await d.json();if(Array.isArray(c.results)){for(const u of c.results)if(typeof u.name=="string"&&(r.push(u.name),typeof u.last_updated=="string")){const f=Date.parse(u.last_updated);Number.isNaN(f)||o.set(u.name,f)}}i=typeof c.next=="string"?c.next:void 0}catch{break}a+=1}return r.length===0?s:{parsed:r.map(d=>{const c=F(d);if(c)return{...c,lastUpdated:o.get(d)}}).filter(d=>d!==void 0),raw:r}}async listV2Tags(n,t,s){const r={parsed:[],raw:[]},o=t==="library"?s:`${t}/${s}`,i={Accept:"application/json"},a=this.tokens[n]??process.env[`DOCKER_REGISTRY_TOKEN_${n.toUpperCase().replaceAll(/[^A-Z0-9]/g,"_")}`];a&&(i.Authorization=`Bearer ${a}`);const d=`https://${n}`,c=[];let u=`${d}/v2/${o}/tags/list?n=100`,f=i,g=0;const m=()=>{const h=[];for(const R of c){const A=F(R);A&&h.push({...A,lastUpdated:void 0})}return{parsed:h,raw:c}};for(;u&&g<5;){try{let h=await this.fetchImpl(u,{headers:f});if(h.status===401&&f===i){const $=Hn(h.headers.get("www-authenticate"));if($){const S=await this.fetchBearerToken($);S&&(f={...i,Authorization:`Bearer ${S}`},h=await this.fetchImpl(u,{headers:f}))}}if(!h.ok)return g===0?r:m();const R=await h.json();if(!Array.isArray(R.tags))return g===0?r:m();for(const $ of R.tags)typeof $=="string"&&c.push($);const A=tt(h.headers.get("link"));u=A.next?new URL(A.next,d).toString():void 0}catch{return g===0?r:m()}g+=1}return c.length===0?r:m()}async fetchBearerToken(n){const t=new URLSearchParams({scope:n.scope,service:n.service}),s=`${n.realm}?${t.toString()}`;try{const r=await this.fetchImpl(s,{headers:{Accept:"application/json"}});if(!r.ok)return;const o=await r.json();return o.token??o.access_token}catch{return}}}const Wn=e=>{const n=[];let t=0;const{length:s}=e;for(;t<s;){for(;t<s&&/\s/.test(e[t]??"");)t+=1;const r=t;for(;t<s&&e[t]!=="="&&e[t]!==",";)t+=1;const o=e.slice(r,t).trim();if(e[t]!=="="){for(;t<s&&e[t]!==",";)t+=1;t+=1;continue}t+=1;let i="";if(e[t]==='"'){for(t+=1;t<s&&e[t]!=='"';){if(e[t]==="\\"&&t+1<s){i+=e[t+1]??"",t+=2;continue}i+=e[t]??"",t+=1}t+=1}else{for(;t<s&&e[t]!==",";)i+=e[t]??"",t+=1;i=i.trim()}for(o.length>0&&n.push({key:o,value:i});t<s&&(/\s/.test(e[t]??"")||e[t]===",");)t+=1}return n},Hn=e=>{if(!e)return;const n=/^Bearer\s+(.*)$/i.exec(e);if(!n)return;const t=new Map;for(const{key:o,value:i}of Wn(n[1]??""))t.set(o.toLowerCase(),i);const s=t.get("realm"),r=t.get("service");if(s)return{realm:s,scope:t.get("scope")??"",service:r??""}},Ln="docker.io",Fn="sha256:",ae=e=>{const n=e.trim();if(n===""||n.startsWith("$")||n.includes("${")||n.includes("$("))return;let t=n,s;const r=t.indexOf(`@${Fn}`);r!==-1&&(s=t.slice(r+1),t=t.slice(0,r));let o=Ln,i=t;const a=t.indexOf("/");if(a>0){const h=t.slice(0,a);(h==="localhost"||h.includes(".")||h.includes(":"))&&(o=h,i=t.slice(a+1))}let d="latest",c=i;const u=i.lastIndexOf(":");u!==-1&&!i.slice(u).includes("/")&&(d=i.slice(u+1),c=i.slice(0,u));let f="library",g=c;const m=c.indexOf("/");if(m!==-1&&(f=c.slice(0,m),g=c.slice(m+1)),g!=="")return{digest:s,name:g,namespace:f,original:n,registry:o,tag:d}},ce=/vis-update-ignore-next-line/i,st=/vis-update-ignore(?:\s|$|:)/i,ot=e=>{const n=e.trim();return n===""||n.startsWith("#")},zn=/^\s*FROM\s+(?:--\S+\s+)*([^\s#]+)(?:\s[^#]*)?(#.*)?$/i,Gn=(e,n)=>{const t=n.split(/\r?\n/),s=[];let r=!1;for(const[o,i]of t.entries()){if(ce.test(i)&&ot(i)){r=!0;continue}const a=zn.exec(i);if(!a){i.trim()!==""&&!i.trim().startsWith("#")&&(r=!1);continue}const d=a[1]??"";if(d==="scratch"){r=!1;continue}const c=a[2]?.trim();let u=r?"vis-update-ignore-next-line":void 0;c&&ce.test(c)?u=u??"vis-update-ignore-next-line":c&&st.test(c)&&(u=u??"vis-update-ignore");const f=ae(d);r=!1,f&&s.push({...f,file:e,ignoreReason:u,kind:"dockerfile",line:o+1})}return s},Kn=/^\s*image:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,Jn=(e,n)=>{const t=n.split(/\r?\n/),s=[];let r=!1;for(const[o,i]of t.entries()){if(ce.test(i)&&ot(i)){r=!0;continue}const a=Kn.exec(i);if(!a){i.trim()!==""&&!i.trim().startsWith("#")&&(r=!1);continue}const d=a[2]??"",c=a[3]?.trim();let u=r?"vis-update-ignore-next-line":void 0;c&&ce.test(c)?u=u??"vis-update-ignore-next-line":c&&st.test(c)&&(u=u??"vis-update-ignore");const f=ae(d);r=!1,f&&s.push({...f,file:e,ignoreReason:u,kind:"compose",line:o+1})}return s},Ue=e=>{const n=e.toLowerCase();return n==="dockerfile"||n.startsWith("dockerfile.")?!0:n.endsWith(".dockerfile")},Yn=e=>{const n=e.toLowerCase();return/^(?:docker-)?compose(?:\..+)?\.ya?ml$/.test(n)},Zn=new Set([".cache",".git",".nx",".pnpm-store",".turbo","build","dist","node_modules"]),Xn=/(?:^|\/)(?:\.git|node_modules|\.pnpm-store|\.turbo|\.nx|dist|build|\.cache)(?:\/|$)/,Qn=e=>{const n=[];if(!O(e))return n;const t=new Set,s=(r,o)=>{let i;try{i=Pt.native(r)}catch{i=r}if(t.has(i))return;t.add(i);let a;try{a=K(r)}catch{return}n.push(...o==="dockerfile"?Gn(r,a):Jn(r,a))};for(const r of Y(e,{includeDirs:!1,includeSymlinks:!1,skip:[Xn]})){const{name:o}=r;Zn.has(o)||(Ue(o)?s(r.path,"dockerfile"):Yn(o)&&s(r.path,"compose"))}for(const r of["Dockerfile","dockerfile","compose.yml","compose.yaml","docker-compose.yml","docker-compose.yaml"]){const o=_(e,r);O(o)&&s(o,Ue(r)?"dockerfile":"compose")}return n},es=864e5,Ve=(e,n)=>{for(const t of n)try{if(new RegExp(t).test(e))return!0}catch{if(e.includes(t))return!0}return!1},Oe=e=>{const n=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return e.registry==="docker.io"?n:`${e.registry}/${n}`},ts=e=>e.digest!==void 0&&e.digest.length>0,ns=e=>{if(e.registry==="docker.io")return`https://hub.docker.com/${e.namespace==="library"?`_/${e.name}`:`r/${e.namespace}/${e.name}`}/tags`;const n=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return`https://${e.registry}/${n}`},ss=(e,n)=>{const t=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return`${e.registry==="docker.io"?t:`${e.registry}/${t}`}:${n}`},rt=async(e,n)=>{const{ignoreRules:t,options:s,references:r,registryOptions:o}=n,i=[],a=[],d=[];if(r.length===0)return{failed:d,ignored:a,updates:i};const c=new qn({fetch:o?.fetch,tokens:o?.tokens}),u=new Map;for(const A of r){const $=`${A.registry}|${A.namespace}|${A.name}`,S=u.get($)??[];S.push(A),u.set($,S)}const f=Math.max(1,s.maxConcurrentRequests),g=[...u.keys()];let m=0;const h=async A=>{const $=u.get(A)??[],S=$[0];if(!S)return;let y;try{y=await c.listTags(S.registry,S.namespace,S.name)}catch{for(const p of $)d.push({file:p.file,reason:`failed to list tags for ${Oe(p)}`});return}for(const p of $){const k=Oe(p);let l;if(p.ignoreReason?l=p.ignoreReason:Ve(k,s.exclude)?l="matched --exclude":s.include.length>0&&!Ve(k,s.include)?l="not matched by --include":s.respectDependabotConfig&&t&&ke(k,"docker",t)&&(l="ignored by dependabot/renovate config"),l){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:k,newRef:p.tag,newVersion:void 0,original:p.original,reason:l,replacement:p.original,updateType:"unknown"});continue}if(ts(p)){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:k,newRef:p.tag,newVersion:void 0,original:p.original,reason:"digest-pinned image (refresh the pin manually to update)",replacement:p.original,updateType:"digest"});continue}const E=F(p.tag);if(!E&&!s.includeBranches){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:k,newRef:p.tag,newVersion:void 0,original:p.original,reason:"non-semver tag (use --include-branches)",replacement:p.original,updateType:"unknown"});continue}if(!E&&s.mode!=="latest"){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:k,newRef:p.tag,newVersion:void 0,original:p.original,reason:`branch ref has no version baseline for --target=${s.mode}`,replacement:p.original,updateType:"unknown"});continue}const w=we(y.parsed,E,s.mode);if(!w)continue;if(s.minAgeDays!==void 0&&w.lastUpdated!==void 0&&(Date.now()-w.lastUpdated)/es<s.minAgeDays){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:k,newRef:w.raw,newVersion:w.raw,original:p.original,reason:`release younger than ${String(s.minAgeDays)} days`,replacement:p.original,updateType:"unknown"});continue}const C=w.raw,T=ss(p,C);i.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,line:p.line,name:k,newRef:C,newVersion:C,original:p.original,replacement:T,updateType:ve(E,w),url:ns(p)})}},R=[];for(let A=0;A<Math.min(f,g.length);A++)R.push((async()=>{for(;m<g.length;){const $=g[m];m+=1,$!==void 0&&await h($)}})());return await Promise.all(R),{failed:d,ignored:a,updates:i}};class os{token;tokenHeader;defaultApiBase;fetchImpl;tagCache=new Map;constructor(n){const t=n.token??process.env.GITLAB_TOKEN;t?(this.token=t,this.tokenHeader="PRIVATE-TOKEN"):process.env.CI_JOB_TOKEN?(this.token=process.env.CI_JOB_TOKEN,this.tokenHeader="JOB-TOKEN"):(this.token=void 0,this.tokenHeader="PRIVATE-TOKEN"),this.defaultApiBase=n.apiBase??"https://gitlab.com",this.fetchImpl=n.fetch??fetch}async listTags(n){const t=this.tagCache.get(n);if(t)return t;const s=this.fetchTags(n);return this.tagCache.set(n,s),s}resolveHostAndPath(n){const t=n.indexOf("/");if(t>0){const s=n.slice(0,t);if(s.includes("."))return{host:`https://${s}`,path:n.slice(t+1)}}return{host:this.defaultApiBase,path:n}}async fetchTags(n){const{host:t,path:s}=this.resolveHostAndPath(n),r=encodeURIComponent(s),o=`${t}/api/v4/projects/${r}/repository/tags?per_page=100`,i={Accept:"application/json","User-Agent":"vis-update-gitlab"};this.token&&(i[this.tokenHeader]=this.token);try{const a=await this.fetchImpl(o,{headers:i});if(!a.ok)return{error:`HTTP ${String(a.status)} from ${t}`,parsed:[],tags:[]};const d=await a.json();if(!Array.isArray(d))return{error:`unexpected response shape from ${t}`,parsed:[],tags:[]};const c=d.map(f=>({name:typeof f.name=="string"?f.name:"",sha:typeof f.commit?.id=="string"?f.commit.id:""})).filter(f=>f.name!==""),u=[];for(const f of c){const g=F(f.name);g&&u.push({...g,sha:f.sha})}return{parsed:u,tags:c}}catch(a){return{error:a instanceof Error?a.message:"fetch failed",parsed:[],tags:[]}}}}const rs=/vis-update-ignore-next-line/i,ee=/vis-update-ignore(?:\s|$|:)/i,is=new Set([".gitlab-ci.yaml",".gitlab-ci.yml"]),as=e=>is.has(e)||e.endsWith(".gitlab-ci.yml")||e.endsWith(".gitlab-ci.yaml"),cs=/^\s*-?\s*project:\s*(['"]?)([^'"\s#]+)\1(?:\s*#.*)?$/,ls=/^\s*ref:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,us=/^\s*-?\s*component:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,ds=/^\s*image:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,ps=/^\s*(?:-\s*)?(?:include:\s*)?\{([^}]*)\}\s*(?:#.*)?$/,fs=/project:\s*(['"]?)([^'"\s,}]+)\1/,gs=/ref:\s*(['"]?)([^'"\s,}]+)\1/,ms=/component:\s*(['"]?)([^'"\s,}]+)\1/,hs=/^(\s*-\s*name:\s*)(['"]?)([^'"\s#]+)\2(\s*#.*)?$/,$s=/^(\s*-\s*)(['"]?)([^'"\s#:]+:[^'"\s#]+)\2(\s*#.*)?$/,ys=/^\s*-?\s*[a-z_][\w-]*:\s*(?:#.*)?$/i,ks=(e,n)=>{const t=n.split(/\r?\n/),s=[],r=[];let o,i=!1,a=!1,d=-1;for(const[c,u]of t.entries()){const f=u??"",g=f.trim(),m=g===""||g.startsWith("#");if(rs.test(f)&&m){i=!0;continue}const h=/^(\s*)services:\s*(?:#.*)?$/.exec(f);if(h){a=!0,d=h[1]?.length??0;continue}a&&g!==""&&!g.startsWith("-")&&!g.startsWith("#")&&f.search(/\S/)<=d&&(a=!1,d=-1);const R=ds.exec(f);if(R){const p=R[2]??"",k=ae(p);if(k){const l=R[3]?.trim();let E=i?"vis-update-ignore-next-line":void 0;l&&ee.test(l)&&(E=E??"vis-update-ignore"),r.push({...k,file:e,ignoreReason:E,kind:"compose",line:c+1})}i=!1;continue}if(a){const p=hs.exec(f),k=p?void 0:$s.exec(f),l=p??k;if(l){const E=l[3]??"",w=ae(E);if(w){const C=l[4]?.trim();let T=i?"vis-update-ignore-next-line":void 0;C&&ee.test(C)&&(T=T??"vis-update-ignore"),r.push({...w,file:e,ignoreReason:T,kind:"compose",line:c+1})}}}const A=cs.exec(f);if(A){o={line:c+1,project:A[2]??""};continue}const $=ls.exec(f);if($&&o){const p=$[3]?.trim();let k=i?"vis-update-ignore-next-line":void 0;p&&ee.test(p)&&(k=k??"vis-update-ignore"),s.push({file:e,ignoreReason:k,kind:"project",line:c+1,original:$[2]??"",project:o.project,ref:$[2]??""}),o=void 0,i=!1;continue}const S=us.exec(f);if(S){const p=S[2]??"",k=p.lastIndexOf("@");if(k>0){const l=p.slice(0,k),E=p.slice(k+1),w=l.lastIndexOf("/"),C=w>0?l.slice(0,w):l,T=w>0?l.slice(w+1):void 0,x=S[3]?.trim();let j=i?"vis-update-ignore-next-line":void 0;x&&ee.test(x)&&(j=j??"vis-update-ignore"),s.push({componentName:T,file:e,ignoreReason:j,kind:"component",line:c+1,original:p,project:C,ref:E})}i=!1;continue}const y=ps.exec(f);if(y){const p=y[1]??"",k=/#(.*)$/.exec(f)?.[1]?.trim();let l=i?"vis-update-ignore-next-line":void 0;k&&ee.test(k)&&(l=l??"vis-update-ignore");const E=ms.exec(p);if(E){const w=E[2]??"",C=w.lastIndexOf("@");if(C>0){const T=w.slice(0,C),x=w.slice(C+1),j=T.lastIndexOf("/"),N=j>0?T.slice(0,j):T,M=j>0?T.slice(j+1):void 0;s.push({componentName:M,file:e,ignoreReason:l,kind:"component",line:c+1,original:w,project:N,ref:x})}}else{const w=fs.exec(p),C=gs.exec(p);w&&C&&s.push({file:e,ignoreReason:l,kind:"project",line:c+1,original:C[2]??"",project:w[2]??"",ref:C[2]??""})}i=!1;continue}g!==""&&!g.startsWith("#")&&!ys.test(f)&&(i=!1)}return{images:r,includes:s}},Be=/^(?:\.git|node_modules|\.pnpm-store|\.turbo|\.nx|dist|build|\.cache)$/,ws=e=>{const n=[],t=[];if(!O(e))return{images:t,includes:n};const s=o=>{let i;try{i=K(o)}catch{return}const{images:a,includes:d}=ks(o,i);n.push(...d),t.push(...a)};for(const o of[".gitlab-ci.yml",".gitlab-ci.yaml"]){const i=_(e,o);O(i)&&s(i)}const r=_(e,".gitlab");if(O(r))for(const o of Y(r,{includeDirs:!1,includeSymlinks:!1,skip:[Be]}))(o.name.endsWith(".yml")||o.name.endsWith(".yaml"))&&s(o.path);for(const o of Y(e,{includeDirs:!1,includeSymlinks:!1,maxDepth:2,skip:[Be]}))as(o.name)&&!t.some(i=>i.file===o.path)&&!n.some(i=>i.file===o.path)&&s(o.path);return{images:t,includes:n}},_e=(e,n)=>{for(const t of n)try{if(new RegExp(t).test(e))return!0}catch{if(e.includes(t))return!0}return!1},vs=(e,n,t)=>{const s=e.indexOf("/");return s>0&&e.slice(0,s).includes(".")?`https://${e.slice(0,s)}/${e.slice(s+1)}/-/releases/${n}`:`${t}/${e}/-/releases/${n}`},bs=async(e,n)=>{const{ignoreRules:t,imageReferences:s,includes:r,options:o,registryOptions:i,resolverOptions:a}=n,d=[],c=[],u=[];if(s.length>0){const y=await rt(e,{ignoreRules:t,options:o,references:s,registryOptions:i});for(const p of y.updates)d.push({...p,ecosystem:"gitlab"});for(const p of y.ignored)c.push({...p,ecosystem:"gitlab"});u.push(...y.failed)}if(r.length===0)return{failed:u,ignored:c,updates:d};const f=new os({apiBase:a?.apiBase,fetch:a?.fetch,token:o.gitlabToken??a?.token}),g=a?.apiBase??"https://gitlab.com",m=new Map;for(const y of r){const p=m.get(y.project)??[];p.push(y),m.set(y.project,p)}const h=Math.max(1,o.maxConcurrentRequests),R=[...m.keys()];let A=0;const $=async y=>{const p=m.get(y)??[];let k;try{k=await f.listTags(y)}catch{for(const l of p)u.push({file:l.file,reason:`failed to list tags for ${y}`});return}if(k.error){for(const l of p)u.push({file:l.file,reason:`failed to list tags for ${y}: ${k.error}`});return}for(const l of p){const E=l.kind==="component"&&l.componentName?`${l.project}/${l.componentName}`:l.project;let w;l.ignoreReason?w=l.ignoreReason:_e(E,o.exclude)?w="matched --exclude":o.include.length>0&&!_e(E,o.include)?w="not matched by --include":o.respectDependabotConfig&&t&&ke(E,"gitlab",t)&&(w="ignored by dependabot/renovate config");const C=N=>({currentRef:l.ref,currentVersion:l.ref,ecosystem:"gitlab",file:l.file,ignored:!0,line:l.line,name:E,newRef:l.ref,newVersion:void 0,original:l.original,reason:N,replacement:l.original,updateType:"unknown"});if(w){c.push(C(w));continue}const T=F(l.ref);if(!T&&!o.includeBranches){c.push(C("branch reference (use --include-branches)"));continue}if(!T&&o.mode!=="latest"){c.push(C(`branch ref has no version baseline for --target=${o.mode}`));continue}const x=we(k.parsed,T,o.mode);if(!x)continue;let j;l.kind==="component"?j=`${l.componentName?`${l.project}/${l.componentName}`:l.project}@${x.raw}`:j=x.raw,d.push({currentRef:l.ref,currentVersion:T?.raw??l.ref,ecosystem:"gitlab",file:l.file,line:l.line,name:E,newRef:x.raw,newVersion:x.raw,original:l.original,replacement:j,updateType:ve(T,x),url:vs(l.project,x.raw,g)})}},S=[];for(let y=0;y<Math.min(h,R.length);y++)S.push((async()=>{for(;A<R.length;){const p=R[A];A+=1,p!==void 0&&await $(p)}})());return await Promise.all(S),{failed:u,ignored:c,updates:d}},Rs={disabled:new Set,exclude:[],githubToken:void 0,gitlabToken:void 0,include:[],includeBranches:!1,maxConcurrentRequests:8,minAgeDays:void 0,mode:"latest",respectDependabotConfig:!0,style:"sha"},it=async e=>{const n={...Rs,...e.options,disabled:e.options?.disabled??new Set},t=n.respectDependabotConfig?yn(e.workspaceRoot):void 0,s={actions:{failed:[],ignored:[],updates:[]},docker:{failed:[],ignored:[],updates:[]},gitlab:{failed:[],ignored:[],updates:[]}},r=[];let o=0;if(!n.disabled.has("actions")){const d=Dn(e.workspaceRoot);d.length>0&&(o+=1,r.push(Mn(e.workspaceRoot,{ignoreRules:t,options:n,references:d}).then(c=>{s.actions=c})))}if(!n.disabled.has("docker")){const d=Qn(e.workspaceRoot);d.length>0&&(o+=1,r.push(rt(e.workspaceRoot,{ignoreRules:t,options:n,references:d}).then(c=>{s.docker=c})))}if(!n.disabled.has("gitlab")){const{images:d,includes:c}=ws(e.workspaceRoot);d.length+c.length>0&&(o+=1,r.push(bs(e.workspaceRoot,{ignoreRules:t,imageReferences:d,includes:c,options:n}).then(u=>{s.gitlab=u})))}await Promise.all(r);const i=[...s.actions.updates,...s.docker.updates,...s.gitlab.updates],a=[...s.actions.ignored,...s.docker.ignored,...s.gitlab.ignored];return{failed:[...s.actions.failed,...s.docker.failed,...s.gitlab.failed],ignored:a,perEcosystem:s,scanned:o,updates:i}},xs={actions:"GitHub Actions",docker:"Docker",gitlab:"GitLab CI"},$e=e=>e.updateType==="major",As=e=>{switch(e){case"major":return G;case"minor":return I;case"patch":return ze;default:return Ge}},Me=e=>{const n=As(e.updateType),t=e.currentVersion??e.currentRef,s=e.newVersion??e.newRef,r=e.url?` ${q(e.url)}`:"",o=e.advisories&&e.advisories.length>0?` ${G(`⚠ ${String(e.advisories.length)} advisor${e.advisories.length===1?"y":"ies"}`)}`:"";return` ${n(e.updateType.padEnd(7))} ${e.name} ${q(t)} → ${s}${o}${r}`},Pe=e=>!e.advisories||e.advisories.length===0?[]:e.advisories.map(n=>` ${n.severity==="CRITICAL"||n.severity==="HIGH"?G(n.severity):I(n.severity)} ${n.id} ${q(n.summary)}`),Ss=(e,n)=>{const t=[],s=e.updates.length;if(s===0&&e.scanned===0)return"";if(s===0){if(e.failed.length===0&&e.ignored.length===0)return t.push(`${ze("✓")} All ecosystem references up to date.`),t.join(`
6
- `);if(t.push(`${I("")} No actionable updates found.`),e.failed.length>0){t.push(`
7
- ${I("Failed lookups:")}`);for(const o of e.failed)t.push(` ${o.file}: ${o.reason}`)}if(n.showIgnored&&e.ignored.length>0){t.push(`
8
- ${q("Ignored:")}`);for(const o of e.ignored)t.push(` ${q(o.name)} ${q(o.reason??"")}`)}return t.join(`
9
- `)}t.push(`
10
- ${Ge("Ecosystem updates")} — ${String(s)} reference${s===1?"":"s"} can be bumped:`);const r=e.updates.filter(o=>$e(o));if(r.length>0){t.push(`
11
- ${G(yt(`⚠ Breaking changes (${String(r.length)})`))}`),t.push(` ${q("Review release notes before applying — these cross a major-version boundary.")}`);for(const o of r)t.push(Me(o)),t.push(...Pe(o))}for(const o of Object.keys(e.perEcosystem)){const i=e.perEcosystem[o];if(i.updates.length!==0){t.push(`
12
- ${xs[o]} (${String(i.updates.length)})`);for(const a of i.updates)t.push(Me(a)),t.push(...Pe(a))}}if(n.showIgnored&&e.ignored.length>0){t.push(`
13
- ${q("Ignored:")}`);for(const o of e.ignored)t.push(` ${q(o.name)} ${q(o.reason??"")}`)}if(e.failed.length>0){t.push(`
14
- ${I("Failed lookups:")}`);for(const o of e.failed)t.push(` ${o.file}: ${o.reason}`)}return n.previewOnly&&t.push(`
15
- ${I("ℹ")} ${q("Not applied automatically — re-run with `--interactive` to choose which to apply, or `--yes` to apply all.")}`),t.join(`
16
- `)},Es=e=>JSON.stringify({ecosystems:{failed:e.failed,ignored:e.ignored,perEcosystem:e.perEcosystem,scanned:e.scanned,updates:e.updates}},void 0,2),Cs=()=>{const e=Fe({input:process.stdin,output:process.stdout});return{ask:n=>new Promise(t=>{e.question(n,s=>{t(s.trim())})}),close:()=>{e.close()},write:n=>{process.stdout.write(`${n}
17
- `)}}},Ts=(e,n)=>e.split(",").map(t=>Number.parseInt(t.trim(),10)-1).filter(t=>Number.isInteger(t)&&t>=0&&t<n),js=async(e,n=Cs())=>{if(e.length===0)return n.close(),[];n.write(""),n.write("Outdated ecosystem references:");for(const[s,r]of e.entries()){const o=r.currentVersion??r.currentRef,i=r.newVersion??r.newRef,a=$e(r)?" [BREAKING]":"";n.write(` ${String(s+1)}. [${r.ecosystem}] ${r.name}: ${o} → ${i} (${r.updateType})${a}`)}n.write("");const t=(await n.ask("Apply updates? [a]ll / [s]afe / [n]one / numbers: ")).toLowerCase();if(t==="a"||t==="all")return n.close(),e;if(t==="s"||t==="safe")return n.close(),e.filter(s=>!$e(s));if(t==="n"||t==="none"||t==="")return n.close(),[];if(/^[\d ,]+$/.test(t)){const s=Ts(t,e.length);return n.close(),s.map(r=>e[r]).filter(r=>r!==void 0)}return n.close(),[]},at=e=>{const n=e.trim();if(n==="")return;const t=/^(\d+(?:\.\d+)?)\s*([mhdw])?$/i.exec(n);if(!t)return;const s=Number.parseFloat(t[1]);if(!(!Number.isFinite(s)||s<0))switch((t[2]??"m").toLowerCase()){case"d":return s*60*24;case"h":return s*60;case"m":return s;case"w":return s*60*24*7;default:return}},Is=e=>{const n=e.trim();return/^\d+(?:\.\d+)?$/.test(n)?Number.parseFloat(n)*1440:at(n)},lo=e=>!Number.isFinite(e)||e<=0?"0m":e%1440===0?`${String(e/1440)}d`:e%60===0?`${String(e/60)}h`:`${String(e)}m`,be=(e,n)=>{try{switch(n){case"bun":{const t=_(e,"bunfig.toml");if(O(t)){const s=vt(t),r=s?.install?.minimumReleaseAge;return{excludes:Array.isArray(s?.install?.minimumReleaseAgeExcludes)?s.install.minimumReleaseAgeExcludes:void 0,minutes:typeof r=="number"?Math.round(r/60):void 0}}break}case"npm":{const t=_(e,".npmrc");if(O(t)){const s=K(t),r=/^\s*min-release-age\s*=\s*([^\s#;]+)/m.exec(s);return{minutes:r?Is(r[1]):void 0}}break}case"pnpm":{const t=_(e,"pnpm-workspace.yaml");if(O(t)){const s=Ee(t);return{excludes:Array.isArray(s?.minimumReleaseAgeExclude)?s.minimumReleaseAgeExclude:void 0,minutes:typeof s?.minimumReleaseAge=="number"?s.minimumReleaseAge:void 0}}break}case"yarn":{const t=_(e,".yarnrc.yml");if(O(t)){const s=Ee(t),r=s?.npmMinimalAgeGate,o=Array.isArray(s?.npmPreapprovedPackages)?s.npmPreapprovedPackages:void 0;if(typeof r=="string")return{excludes:o,minutes:at(r)};if(typeof r=="number")return{excludes:o,minutes:r}}break}}}catch{}return{}},Ns={bun:"minimumReleaseAgeExcludes",pnpm:"minimumReleaseAgeExclude",yarn:"npmPreapprovedPackages"},ct={bun:"bunfig.toml minimumReleaseAgeExcludes",npm:".npmrc",pnpm:"pnpm-workspace.yaml minimumReleaseAgeExclude",yarn:".yarnrc.yml npmPreapprovedPackages"},lt=(e,n,t)=>{const s=be(n,e);if(typeof s.minutes!="number"||s.minutes<=0)return{added:[],unsupported:!1};if(!(e in Ns))return{added:[],unsupported:!0};const r=s.excludes??[],o=[...new Set(t)].filter(i=>!r.includes(i));return o.length===0?{added:[],unsupported:!1}:(Yt(e,n,s.minutes,[...r,...o]),{added:o,unsupported:!1})},ut=(e,n,t)=>{t.added.length>0?e.info(`Added ${String(t.added.length)} package${t.added.length===1?"":"s"} to ${ct[n]??"the package manager config"} so --ignore-release-age versions install: ${t.added.join(", ")}`):t.unsupported&&e.warn(`${I("⚠")} npm has no per-package release-age exclude list, so vis can't exempt just the selected packages. Lower min-release-age in .npmrc or pass --min-release-age=0 to the install.`)},Ds=(e,n,t)=>{const s=e.latest?"latest":e.target??n.target??"latest";if(!["latest","minor","patch"].includes(s))throw new Error(`Invalid target "${s}". Use: latest, minor, or patch.`);const r=e.maxConcurrentRequests,o=typeof r=="number"&&r>0?r:n.maxConcurrentRequests,i=typeof e.releaseChannel=="string"?e.releaseChannel.toLowerCase():void 0;if(i!==void 0&&!["any","same","stable"].includes(i))throw new Error(`Invalid --release-channel "${String(e.releaseChannel)}". Use: any, same, or stable.`);const a=i??n.releaseChannel;return{exclude:[...W(e.exclude),...W(n.exclude)],ignore:W(n.ignore),include:[...W(e.include),...W(n.include),...t],includeLocked:e.includeLocked||n.includeLocked||!1,includePrerelease:e.prerelease||n.prerelease||!1,maxConcurrentRequests:o,minimumReleaseAge:n.minimumReleaseAge,minimumReleaseAgeExclude:n.minimumReleaseAgeExclude,packageMode:n.packageMode,releaseChannel:a,security:e.security===!1?!1:e.ai||(n.security??!0),target:s}},qe=(e,n)=>{if(e.length!==0){n.info(`
18
- ${I("⚠")} ${String(e.length)} package${e.length===1?"":"s"} skipped by target constraint (use --target latest to include):`);for(const t of e)n.info(` ${t.packageName} ${t.currentRange} → ${t.newRange} (${t.updateType})`)}},We=(e,n,t,s,r)=>{t==="json"?process.stdout.write(`${Vt({checkedCount:0,failed:n,filteredByTarget:[],ignored:[],outdated:e})}
19
- `):t==="minimal"?process.stdout.write(`${Ot(e)}
20
- `):(Bt(e,s),s.info(Je(e,r)))},He=async(e,n,t,s,r,o,i)=>{const a=Ut(e,t,n,!0,{useEditorconfig:i}),d=n==="pnpm"?"pnpm-workspace.yaml":"package.json";if(r.info(`
21
- Updated ${d}`),a&&r.info(`Backup saved to ${a}`),s.changelog){r.info(`
22
- Fetching changelogs...`);const c=await Ke(t,void 0,o);for(const u of c){const f=u.releaseUrl??u.repoUrl??u.npmUrl;r.info(` ${u.packageName}: ${f}`)}}if(s["ignore-release-age"]===!0&&t.length>0&&ut(r,n,lt(n,e,t.map(c=>c.packageName))),s.install??!0){const c=n,u=["install"];r.info(`Running ${c} ${u.join(" ")}...
23
- `);try{const{code:f,output:g}=await Ye(c,u,{cwd:e,env:process.env});f!==0?r.warn(`${c} ${u.join(" ")} failed. You may need to run it manually.`):s.peer!==!0&&Ze(g)&&r.info(Xe)}catch{r.warn(`${c} ${u.join(" ")} failed. You may need to run it manually.`)}}},ye={applied:!1,canceled:!1,jsonEmitted:!1},Us={actions:"GitHub Actions",docker:"Docker",gitlab:"GitLab CI"},Vs={digest:"patch",major:"major",minor:"minor",patch:"patch",pin:"patch",unknown:"patch"},Os=e=>({catalogName:Us[e.ecosystem],currentRange:e.currentVersion??e.currentRef,detailUrl:e.url,displayName:e.name,kind:"ecosystem",newRange:e.newVersion??e.newRef,packageName:tn(e),targetVersion:e.newVersion??e.newRef,updateType:Vs[e.updateType]??"patch"}),Bs=async(e,n,t,s,r,o)=>{const i=t.update??{},a=[["global","--global is not supported in catalog mode"],["recursive","--recursive is not needed in catalog mode (catalogs are workspace-level)"],["filter","--filter is not supported in catalog mode (use --include/--exclude instead)"],["no-save","--no-save is not supported in catalog mode"],["workspace-root","--workspace-root is not needed in catalog mode"],["no-optional","--no-optional is not supported in catalog mode"]];for(const[b,U]of a)s[b]&&o.warn(`${I("⚠")} ${U}, ignoring.`);const d=s["ignore-release-age"]===!0,c=ge("minReleaseAge")||d,{excludes:u,minutes:f}=c?{excludes:void 0,minutes:void 0}:be(e,n),g=c?void 0:i.minimumReleaseAge??f,m=c?void 0:i.minimumReleaseAgeExclude??u;if(d?o.info(`${I("⚠")} --ignore-release-age: selecting the latest versions regardless of minimumReleaseAge.`):c&&(i.minimumReleaseAge!==void 0||f!==void 0)&&o.info("minimumReleaseAge gate disabled via MARSHALL_DISABLE_MIN_RELEASE_AGE."),!c&&i.minimumReleaseAge!==void 0&&f!==void 0&&i.minimumReleaseAge!==f){const b=n==="pnpm"?"pnpm-workspace.yaml":"bunfig.toml";o.warn(`${I("⚠")} minimumReleaseAge mismatch: vis config = ${String(i.minimumReleaseAge)} min, ${b} = ${String(f)} min. Consider keeping them in sync.`)}const h=Ct(e),R=s["include-internal"],A=s.peer,$=Tt(e,n,{depFields:i.depFields,dev:s.dev,includeInternal:R,peer:A,prod:s.prod});if($.size===0)return o.info("No catalogs found."),ye;const S={...i,minimumReleaseAge:g,minimumReleaseAgeExclude:m},y=Ds(s,S,r);let p=0;for(const b of $.values())p+=b.size;const k=!!process.stdout.isTTY&&!le;let l;const E=k?(b,U)=>{l?l.rerender(P.createElement(je,{current:b,total:U})):(process.stdout.write(`
24
- `),l=Ce(P.createElement(je,{current:b,total:U}),{interactive:!0,patchConsole:!1}))}:(b,U)=>{o.info(`Checking ${String(b)}/${String(U)} dependencies...`)};k||o.info(`Checking ${String(p)} catalog dependencies...
25
- `);const w=new Set;ge("socket")&&w.add("socket"),ge("depsDev")&&w.add("deps-dev");const C=t.security?.policies?.score?.minimum,T=jt(t.security,{disabled:w,minimumScore:C}),{checkedCount:x,failed:j,filteredByTarget:N,ignored:M,outdated:D}=await It($,y,h,E,e,T,t.security?.acceptedRisks);l&&(l.clear(),l.unmount());const ne=R?{ignored:[],outdated:[]}:Nt(e,{depFields:i.depFields,dev:s.dev,exclude:y.exclude,ignore:y.ignore,include:y.include,packageMode:y.packageMode,peer:A,prod:s.prod,target:y.target});if(ne.outdated.length>0){const b=new Set(D.map(U=>`${U.catalogName}|${U.packageName}`));for(const U of ne.outdated)b.has(`${U.catalogName}|${U.packageName}`)||D.push(U)}if(ne.ignored.length>0)for(const b of ne.ignored)M.includes(b)||M.push(b);const Re=x-D.length-j.length;if(j.length>0&&o.warn(`Failed to fetch: ${j.join(", ")}`),M.length>0&&o.info(`Skipped ${String(M.length)} ignored package${M.length===1?"":"s"}: ${M.join(", ")}`),!k&&x>D.length){const b=[...$.values()].reduce((X,ue)=>X+ue.size,0),U=b>x?` (${String(b)} catalog entries, ${String(b-x)} duplicates)`:"";o.info(`Checked ${String(x)} unique packages${U}: ${String(D.length)} outdated, ${String(Re)} up-to-date${j.length>0?`, ${String(j.length)} failed`:""}${N.length>0?`, ${String(N.length)} skipped by target`:""}`)}if(D.length===0)return N.length>0?o.info(`All catalog dependencies are up to date within the current target.
26
- ${String(N.length)} package${N.length===1?" has":"s have"} newer versions available with --target latest:
27
- ${N.map(b=>` ${b.packageName} ${b.currentRange} → ${b.newRange} (${b.updateType})`).join(`
28
- `)}`):o.info("All catalog dependencies are up to date."),ye;const z=s.format??i.format??"table";let H;if(s.ai){const b=qt(s.aiType??"impact");H=await Wt(D,o,t.ai,b)}const se=!!s.dryRun;if(!se&&r.length>0&&s.marshallCheck!==!1){const b=await Gt(r);if(b.length>0){const U=await Kt(b,{config:t?.security?.marshalls,workspaceRoot:e});if(!await Jt(U))return process.exitCode=1,{applied:!1,canceled:!0,jsonEmitted:!1}}}if(k&&z==="table"){const b=new Map,U=[];let X=!1;if(r.length===0){const v=dt(s,t);if(v.disabled.size<3)try{const V=await it({options:v,workspaceRoot:e});X=V.scanned>0;for(const B of V.updates){const J=Os(B);b.set(J.packageName,B),U.push(J)}}catch(V){o.warn(`${I("")} Ecosystem update scan failed: ${V.message}`)}}const ue=new Qt([...D,...U],H??null);let de;if(s.changelog){o.info("Fetching changelogs...");const v=await Ke(D,void 0,h);de=new Map;for(const V of v){const B=V.releaseUrl??V.repoUrl??V.npmUrl;B&&de.set(V.packageName,B)}}const pe=t.tui?.autoExit??!1,ft=pe===!0?3:typeof pe=="number"?pe:0,xe=await Ce(P.createElement(en,{autoExitSeconds:ft,changelogUrls:de,checkedCount:x,filteredOutEntries:N,isDryRun:se,store:ue,totalCatalogEntries:p}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),fe=process.stdout.columns||80;process.stdout.write(`
29
- `);for(const v of D){const V=v.vulnerabilities?.length||v.socketReport&&v.socketReport.alerts.length>0,B=!!v.acceptedRisk,J=V?B?"":"⚠":"✓",gt=B?"gray":v.updateType==="major"?"red":v.updateType==="minor"?"yellow":"green",ie=v.socketReport?.score.overall,mt=ie===void 0?"":` [${String(Math.round(ie*100))}%]`,Se=ie===void 0?void 0:_t(ie);process.stdout.write(`${me(P.createElement(L,null," ",P.createElement(L,{color:gt},J),` ${v.packageName} ${v.currentRange} → ${v.newRange}`,P.createElement(L,{dimColor:!0},` ${v.updateType}`),Se?P.createElement(L,{color:Se},mt):null),{columns:fe})}
30
- `)}if(process.stdout.write(`
31
- `),o.info(Je(D,C)),x>D.length){const v=[...$.values()].reduce((B,J)=>B+J.size,0),V=v>x?` (${String(v)} catalog entries, ${String(v-x)} duplicates)`:"";o.log(),o.info(`Checked ${String(x)} unique packages${V}: ${String(Re)} up-to-date${j.length>0?`, ${String(j.length)} failed`:""}`)}if(N.length>0){process.stdout.write(`
32
- `);const v=`${String(N.length)} package${N.length===1?"":"s"} skipped by target constraint (use --target latest to include):`;process.stdout.write(`${me(P.createElement(L,{color:"yellow"},` ${v}`),{columns:fe})}
33
- `);for(const V of N)process.stdout.write(`${me(P.createElement(L,null," ",P.createElement(L,{dimColor:!0},V.packageName),` ${V.currentRange} → ${V.newRange}`,P.createElement(L,{dimColor:!0},` ${V.updateType}`)),{columns:fe})}
34
- `)}const oe=Array.isArray(xe)?xe:[],re=oe.filter(v=>v.kind!=="ecosystem"),Ae=oe.filter(v=>v.kind==="ecosystem").map(v=>b.get(v.packageName)).filter(v=>v!==void 0);if(!se&&oe.length>0){if(re.length>0){o.info(`
35
- Applying ${String(re.length)} catalog update${re.length===1?"":"s"}...
36
- `);const v={...s,install:s.install??i.install};await He(e,n,re,v,o,h,t.editorconfig??!0)}if(Ae.length>0){const{applied:v,skipped:V}=nt(Ae);v.length>0&&o.info(`${String(v.length)} ecosystem reference${v.length===1?"":"s"} updated.`);for(const B of V)o.warn(`${I("⚠")} Skipped ${B.update.name} (${B.update.file}): ${B.reason}`)}return{applied:!0,canceled:!1,ecosystemHandled:X,jsonEmitted:!1}}return{applied:!1,canceled:oe.length===0,ecosystemHandled:X,jsonEmitted:!1}}if(se){if(z==="json"){const b={failed:j,filteredByTarget:N,ignored:M,outdated:D};H&&(b.aiAnalysis=H),process.stdout.write(`${JSON.stringify(b,void 0,2)}
37
- `)}else o.info(`Would update ${String(D.length)} dependencies:
38
- `),We(D,j,z,o,C),H&&(o.info(""),o.info(Te(H))),qe(N,o);return{applied:!1,canceled:!1,jsonEmitted:z==="json"}}H&&z!=="json"&&(o.info(Te(H)),o.info(""));let Z=D;if(s.interactive&&(Z=await Dt(D),Z.length===0))return o.info("No updates selected."),{applied:!1,canceled:!0,jsonEmitted:!1};o.info(`Updating ${String(Z.length)} catalog dependencies...
39
- `),We(Z,[],z,o,C),qe(N,o);const pt={...s,install:s.install??i.install};return await He(e,n,Z,pt,o,h),{applied:!0,canceled:!1,jsonEmitted:z==="json"}},_s=async(e,n,t,s,r,o)=>{if(s["ignore-release-age"]===!0){const u=be(e,n),f=typeof u.minutes=="number"&&u.minutes>0;if(f&&r.length>0){const g=r.map(m=>Qe(m).name);ut(o,n,lt(n,e,g))}else f&&o.warn(`${I("⚠")} --ignore-release-age without package names can't pre-exempt packages in pm-wrapper mode (vis doesn't know which will change). Pass explicit package names, use catalog mode, or lower the gate in ${ct[n]??"your package manager config"}.`)}const i={dev:s.dev,filters:W(s.filter),global:s.global,interactive:s.interactive,latest:s.latest||s.target==="latest",noOptional:s.optional===!1,noSave:s.save===!1,packages:r,prod:s.prod,recursive:s.recursive,workspaceRoot:s.workspaceRoot},{command:a,warnings:d}=dn(n,t,i);for(const u of d)o.warn(u);const c=`${a.bin} ${a.args.join(" ")}`.trim();if(s.dryRun)return o.info(`Would run: ${c}`),ye;o.info(`Running: ${c}`);try{const{code:u,output:f}=await Ye(a.bin,a.args,{cwd:e,env:process.env});if(u!==0)return o.error(`
40
- ${G("")} Update failed (exit code ${String(u)})`),o.error(` Command: ${c}`),o.error(` Directory: ${e}
41
- `),process.exitCode=u,{applied:!1,canceled:!1,jsonEmitted:!1};s.peer!==!0&&Ze(f)&&o.info(Xe)}catch(u){const f=u.status??1;return o.error(`
42
- ${G("")} Update failed (exit code ${String(f)})`),o.error(` Command: ${c}`),o.error(` Directory: ${e}
43
- `),process.exitCode=f,{applied:!1,canceled:!1,jsonEmitted:!1}}return{applied:!0,canceled:!1,jsonEmitted:!1}},Ms=async(e,n,t)=>{const s=e.latest===!0||e.target==="latest";if(n||!s||e.dryRun===!0||e.yes===!0||e.interactive===!0)return!0;if(!(process.stdout.isTTY&&!le))return t.error(`${G("✖")} Refusing to run blanket --latest update in a non-interactive context.`),t.error(" Re-run with --yes to confirm, --dry-run to preview, or pass explicit package names."),process.exitCode=1,!1;const r=Fe({input:process.stdin,output:process.stdout});try{const o=(await new Promise(i=>{r.question(`${I("⚠")} About to upgrade ALL dependencies to their latest versions. This may include breaking changes.
44
- Continue? [y/N] `,i)})).trim().toLowerCase();return o==="y"||o==="yes"?!0:(t.info("Aborted."),!1)}finally{r.close()}},dt=(e,n)=>{const t=new Set;e.actions===!1&&t.add("actions"),e.docker===!1&&t.add("docker"),e.gitlab===!1&&t.add("gitlab");const s=e.style??"sha";if(s!=="sha"&&s!=="preserve")throw new Error(`Invalid --style "${s}". Use: sha or preserve.`);const r=e.latest===!0?"latest":e.target??"latest";if(r!=="latest"&&r!=="minor"&&r!=="patch")throw new Error(`Invalid target "${r}". Use: latest, minor, or patch.`);const o=r,i=n.update??{};return{disabled:t,exclude:[...W(e.exclude),...W(i.exclude)],githubToken:e.actionsToken??void 0,gitlabToken:e.gitlabToken??void 0,include:W(e.include),includeBranches:e.includeBranches===!0,maxConcurrentRequests:typeof e.maxConcurrentRequests=="number"&&e.maxConcurrentRequests>0?e.maxConcurrentRequests:8,minAgeDays:typeof i.minimumReleaseAge=="number"&&i.minimumReleaseAge>0?i.minimumReleaseAge/1440:void 0,mode:o,respectDependabotConfig:!0,style:s}},Ps=(e,n)=>e.dryRun===!0||process.exitCode!==void 0&&process.exitCode!==0||n.canceled?!1:e.yes===!0?!0:e.interactive===!0&&!!process.stdout.isTTY&&!le,qs=async(e,n,t,s,r)=>{const o=dt(n,t);if(o.disabled.size===3)return;let i;try{i=await it({options:o,workspaceRoot:e})}catch(m){s.warn(`${I("⚠")} Ecosystem update scan failed: ${m.message}`);return}if(i.scanned===0)return i;const a=n.format??"table",d=!!n.dryRun,c=Ps(n,r);if(a==="json")r.jsonEmitted?s.warn(`${I("⚠")} ${String(i.updates.length)} ecosystem update${i.updates.length===1?"":"s"} available but not emitted in --format=json (catalog already wrote one JSON document). Rerun with --format=table or --no-catalog to see them.`):process.stdout.write(`${Es(i)}
45
- `);else if(a!=="minimal"){const m=Ss(i,{previewOnly:!c&&!d,showIgnored:n.interactive===!0});m&&s.info(m)}if(i.updates.length===0)return i;if(d)return a==="minimal"&&s.info(`
46
- ${I("ℹ")} ${String(i.updates.length)} ecosystem reference${i.updates.length===1?"":"s"} can be bumped not applied (--dry-run). Re-run without --dry-run and with \`--interactive\` or \`--yes\` to apply.`),i;if(!c)return a==="minimal"&&s.info(`
47
- ${I("ℹ")} ${String(i.updates.length)} ecosystem reference${i.updates.length===1?"":"s"} can be bumped not applied automatically. Re-run with \`--interactive\` to choose, or \`--yes\` to apply all (or \`--no-actions\` / \`--no-docker\` / \`--no-gitlab\` to silence by ecosystem).`),i;let u=i.updates;if(n.interactive===!0&&process.stdout.isTTY&&!le&&(u=await js(i.updates),u.length===0))return s.info(`${I("ℹ")} No ecosystem updates selected.`),i;const{applied:f,skipped:g}=nt(u);if(f.length>0&&s.info(`
48
- ${String(f.length)} ecosystem reference${f.length===1?"":"s"} updated.`),g.length>0){s.warn(`${I("⚠")} ${String(g.length)} ecosystem update${g.length===1?"":"s"} skipped:`);for(const m of g)s.warn(` ${m.update.name} (${m.update.file}:${String(m.update.line)}): ${m.reason}`)}return i},Ws=e=>{const n=e.style;if(n!==void 0&&n!=="sha"&&n!=="preserve")throw new Error(`Invalid --style "${n}". Use: sha or preserve.`);const t=e.target;if(t!==void 0&&t!=="latest"&&t!=="minor"&&t!=="patch")throw new Error(`Invalid --target "${t}". Use: latest, minor, or patch.`)},uo=async({argument:e,logger:n,options:t,visConfig:s,workspaceRoot:r})=>{if(!r)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");Ws(t);let o=e;const i=r,{packageManager:a}=Rt(i);if(t.typosquatCheck!==!1){if(o.length>0){const u=o.map(m=>Qe(m)),f=s?.security?.typosquatAllowlist,g=await Zt(u.map(m=>m.name),f);if(!g.ok){process.exitCode=1;return}o=u.map((m,h)=>{const R=g.packages[h];return R!==m.name?m.versionSpec?`${R}@${m.versionSpec}`:R??"":o[h]??""})}else if(!await Xt(i,s?.security?.typosquatAllowlist)){process.exitCode=1;return}}if(t.rollback){if(!At(i,a)){n.info("No backup found. Run 'vis update' first to create a backup.");return}if(St(i,a))n.info("Restored from backup.");else throw new Error("Failed to restore from backup.");return}if(!await Ms(t,o.length>0,n))return;const d=t.catalog!==!1&&Et(i,a);let c;if(d)c=await Bs(i,a,s??{},t,o,n);else{const u=Lt(i,{backend:Ft(zt({logger:n,options:t,visConfig:s},i)),configBackend:s?.install?.backend,configCorepack:s?.install?.corepack}),f=u.name==="aube"?"":xt(u.name);c=await _s(i,u.name,f,t,o,n)}o.length===0&&c.ecosystemHandled!==!0&&await qs(i,t,s??{},n,c)};export{lt as addReleaseAgeExcludesForInstall,uo as default,lo as formatMinutesAsTimeString,Is as parseNpmReleaseAgeValue,at as parseTimeStringToMinutes,be as readPmNativeMinimumReleaseAge,Ms as requireBlanketUpdateConfirmation,qs as runEcosystemUpdate,Ps as shouldApplyEcosystem};
1
+ import{createRequire as fr}from"node:module";import{j as Ge,q as kt,E as fe}from"../packem_shared/index.server-J83sowC4.js";import{projectGraphToDot as mr}from"@visulima/task-runner";import{m as d,n as T,i as x,r as he,b as br,O as yr,$ as wr,d as vr}from"./catalog.js";import"../packem_shared/env-DJlbJiFh.js";import{I as kr}from"../packem_shared/index-B0EsgdzO.js";import{g as Ot}from"../packem_shared/_commonjsHelpers-B5Y90VFO.js";import{d as Sr}from"../packem_shared/anolilab-text-CAM_E6uK.js";import{T as Ar,_ as Nr,U as Cr,Q as Dr,y as Mr,V as Ir,W as Et}from"./cli-main.js";const gr=fr(import.meta.url),Ve=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,et=y=>{if(typeof Ve<"u"&&Ve.versions&&Ve.versions.node){const[l,h]=Ve.versions.node.split(".").map(Number);if(l>22||l===22&&h>=3||l===20&&h>=16)return Ve.getBuiltinModule(y)}return gr(y)},{readFileSync:xr}=et("node:fs"),{createRequire:Er}=et("node:module"),{join:Gr,dirname:_r}=et("node:path"),jr=et("events");var st,Gt;function Tr(){if(Gt)return st;Gt=1;var y=jr;function l(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function h(r,o,n){if(N())return Reflect.construct.apply(null,arguments);var e=[null];e.push.apply(e,o);var t=new(r.bind.apply(r,e));return n&&D(t,n.prototype),t}function u(r,o,n){return(o=C(o))in r?Object.defineProperty(r,o,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[o]=n,r}function v(r){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},v(r)}function m(r,o){r.prototype=Object.create(o.prototype),r.prototype.constructor=r,D(r,o)}function k(r){try{return Function.toString.call(r).indexOf("[native code]")!==-1}catch{return typeof r=="function"}}function N(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(N=function(){return!!r})()}function D(r,o){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,e){return n.__proto__=e,n},D(r,o)}function j(r,o){if(typeof r!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var e=n.call(r,o);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(r)}function C(r){var o=j(r,"string");return typeof o=="symbol"?o:o+""}function I(r){"@babel/helpers - typeof";return I=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},I(r)}function q(r){var o=typeof Map=="function"?new Map:void 0;return q=function(n){if(n===null||!k(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(o!==void 0){if(o.has(n))return o.get(n);o.set(n,e)}function e(){return h(n,arguments,v(this).constructor)}return e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),D(e,n)},q(r)}function z(){for(var r=arguments[0],o=1,n=arguments.length;o<n;o++)if(arguments[o])for(var e in arguments[o])r[e]=arguments[o][e];return r}var L=z;typeof Object.assign=="function"&&(L=Object.assign);function $(r,o,n,e){var t=r._nodes.get(o),i=null;return t&&(e==="mixed"?i=t.out&&t.out[n]||t.undirected&&t.undirected[n]:e==="directed"?i=t.out&&t.out[n]:i=t.undirected&&t.undirected[n]),i}function R(r){return I(r)==="object"&&r!==null}function K(r){var o;for(o in r)return!1;return!0}function W(r,o,n){Object.defineProperty(r,o,{enumerable:!1,configurable:!1,writable:!0,value:n})}function B(r,o,n){var e={enumerable:!0,configurable:!0};typeof n=="function"?e.get=n:(e.value=n,e.writable=!1),Object.defineProperty(r,o,e)}function ie(r){return!(!R(r)||r.attributes&&!Array.isArray(r.attributes))}function de(){var r=Math.floor(Math.random()*256)&255;return function(){return r++}}function ce(){var r=arguments,o=null,n=-1;return u(u({},Symbol.iterator,function(){return this}),"next",function(){var e=null;do{if(o===null){if(n++,n>=r.length)return{done:!0};o=r[n][Symbol.iterator]()}if(e=o.next(),e.done){o=null;continue}break}while(!0);return e})}function re(){return u(u({},Symbol.iterator,function(){return this}),"next",function(){return{done:!0}})}var _e=(function(r){m(o,r);function o(n){var e;return e=r.call(this)||this,e.name="GraphError",e.message=n,e}return o})(q(Error)),G=(function(r){m(o,r);function o(n){var e;return e=r.call(this,n)||this,e.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(l(e),o.prototype.constructor),e}return o})(_e),_=(function(r){m(o,r);function o(n){var e;return e=r.call(this,n)||this,e.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(l(e),o.prototype.constructor),e}return o})(_e),w=(function(r){m(o,r);function o(n){var e;return e=r.call(this,n)||this,e.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(l(e),o.prototype.constructor),e}return o})(_e);function c(r,o){this.key=r,this.attributes=o,this.clear()}c.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function X(r,o){this.key=r,this.attributes=o,this.clear()}X.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function je(r,o){this.key=r,this.attributes=o,this.clear()}je.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function S(r,o,n,e,t){this.key=o,this.attributes=t,this.undirected=r,this.source=n,this.target=e}S.prototype.attach=function(){var r="out",o="in";this.undirected&&(r=o="undirected");var n=this.source.key,e=this.target.key;this.source[r][e]=this,!(this.undirected&&n===e)&&(this.target[o][n]=this)},S.prototype.attachMulti=function(){var r="out",o="in",n=this.source.key,e=this.target.key;this.undirected&&(r=o="undirected");var t=this.source[r],i=t[e];if(typeof i>"u"){t[e]=this,this.undirected&&n===e||(this.target[o][n]=this);return}i.previous=this,this.next=i,t[e]=this,this.target[o][n]=this},S.prototype.detach=function(){var r=this.source.key,o=this.target.key,n="out",e="in";this.undirected&&(n=e="undirected"),delete this.source[n][o],delete this.target[e][r]},S.prototype.detachMulti=function(){var r=this.source.key,o=this.target.key,n="out",e="in";this.undirected&&(n=e="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[n][o],delete this.target[e][r]):(this.next.previous=void 0,this.source[n][o]=this.next,this.target[e][r]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};var f=0,Q=1,ee=2,ge=3;function se(r,o,n,e,t,i,a){var s,p,g,E;if(e=""+e,n===f){if(s=r._nodes.get(e),!s)throw new _("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));g=t,E=i}else if(n===ge){if(t=""+t,p=r._edges.get(t),!p)throw new _("Graph.".concat(o,': could not find the "').concat(t,'" edge in the graph.'));var A=p.source.key,M=p.target.key;if(e===A)s=p.target;else if(e===M)s=p.source;else throw new _("Graph.".concat(o,': the "').concat(e,'" node is not attached to the "').concat(t,'" edge (').concat(A,", ").concat(M,")."));g=i,E=a}else{if(p=r._edges.get(e),!p)throw new _("Graph.".concat(o,': could not find the "').concat(e,'" edge in the graph.'));n===Q?s=p.source:s=p.target,g=t,E=i}return[s,g,E]}function oe(r,o,n){r.prototype[o]=function(e,t,i){var a=se(this,o,n,e,t,i),s=a[0],p=a[1];return s.attributes[p]}}function F(r,o,n){r.prototype[o]=function(e,t){var i=se(this,o,n,e,t),a=i[0];return a.attributes}}function We(r,o,n){r.prototype[o]=function(e,t,i){var a=se(this,o,n,e,t,i),s=a[0],p=a[1];return s.attributes.hasOwnProperty(p)}}function pe(r,o,n){r.prototype[o]=function(e,t,i,a){var s=se(this,o,n,e,t,i,a),p=s[0],g=s[1],E=s[2];return p.attributes[g]=E,this.emit("nodeAttributesUpdated",{key:p.key,type:"set",attributes:p.attributes,name:g}),this}}function rt(r,o,n){r.prototype[o]=function(e,t,i,a){var s=se(this,o,n,e,t,i,a),p=s[0],g=s[1],E=s[2];if(typeof E!="function")throw new G("Graph.".concat(o,": updater should be a function."));var A=p.attributes,M=E(A[g]);return A[g]=M,this.emit("nodeAttributesUpdated",{key:p.key,type:"set",attributes:p.attributes,name:g}),this}}function Me(r,o,n){r.prototype[o]=function(e,t,i){var a=se(this,o,n,e,t,i),s=a[0],p=a[1];return delete s.attributes[p],this.emit("nodeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:p}),this}}function nt(r,o,n){r.prototype[o]=function(e,t,i){var a=se(this,o,n,e,t,i),s=a[0],p=a[1];if(!R(p))throw new G("Graph.".concat(o,": provided attributes are not a plain object."));return s.attributes=p,this.emit("nodeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function Le(r,o,n){r.prototype[o]=function(e,t,i){var a=se(this,o,n,e,t,i),s=a[0],p=a[1];if(!R(p))throw new G("Graph.".concat(o,": provided attributes are not a plain object."));return L(s.attributes,p),this.emit("nodeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:p}),this}}function J(r,o,n){r.prototype[o]=function(e,t,i){var a=se(this,o,n,e,t,i),s=a[0],p=a[1];if(typeof p!="function")throw new G("Graph.".concat(o,": provided updater is not a function."));return s.attributes=p(s.attributes),this.emit("nodeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}var H=[{name:function(r){return"get".concat(r,"Attribute")},attacher:oe},{name:function(r){return"get".concat(r,"Attributes")},attacher:F},{name:function(r){return"has".concat(r,"Attribute")},attacher:We},{name:function(r){return"set".concat(r,"Attribute")},attacher:pe},{name:function(r){return"update".concat(r,"Attribute")},attacher:rt},{name:function(r){return"remove".concat(r,"Attribute")},attacher:Me},{name:function(r){return"replace".concat(r,"Attributes")},attacher:nt},{name:function(r){return"merge".concat(r,"Attributes")},attacher:Le},{name:function(r){return"update".concat(r,"Attributes")},attacher:J}];function V(r){H.forEach(function(o){var n=o.name,e=o.attacher;e(r,n("Node"),f),e(r,n("Source"),Q),e(r,n("Target"),ee),e(r,n("Opposite"),ge)})}function me(r,o,n){r.prototype[o]=function(e,t){var i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w("Graph.".concat(o,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new w("Graph.".concat(o,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+e,s=""+t;if(t=arguments[2],i=$(this,a,s,n),!i)throw new _("Graph.".concat(o,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if(n!=="mixed")throw new w("Graph.".concat(o,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,i=this._edges.get(e),!i)throw new _("Graph.".concat(o,': could not find the "').concat(e,'" edge in the graph.'))}return i.attributes[t]}}function U(r,o,n){r.prototype[o]=function(e){var t;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w("Graph.".concat(o,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new w("Graph.".concat(o,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var i=""+e,a=""+arguments[1];if(t=$(this,i,a,n),!t)throw new _("Graph.".concat(o,': could not find an edge for the given path ("').concat(i,'" - "').concat(a,'").'))}else{if(n!=="mixed")throw new w("Graph.".concat(o,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,t=this._edges.get(e),!t)throw new _("Graph.".concat(o,': could not find the "').concat(e,'" edge in the graph.'))}return t.attributes}}function O(r,o,n){r.prototype[o]=function(e,t){var i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w("Graph.".concat(o,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new w("Graph.".concat(o,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+e,s=""+t;if(t=arguments[2],i=$(this,a,s,n),!i)throw new _("Graph.".concat(o,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if(n!=="mixed")throw new w("Graph.".concat(o,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,i=this._edges.get(e),!i)throw new _("Graph.".concat(o,': could not find the "').concat(e,'" edge in the graph.'))}return i.attributes.hasOwnProperty(t)}}function b(r,o,n){r.prototype[o]=function(e,t,i){var a;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w("Graph.".concat(o,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new w("Graph.".concat(o,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,p=""+t;if(t=arguments[2],i=arguments[3],a=$(this,s,p,n),!a)throw new _("Graph.".concat(o,': could not find an edge for the given path ("').concat(s,'" - "').concat(p,'").'))}else{if(n!=="mixed")throw new w("Graph.".concat(o,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,a=this._edges.get(e),!a)throw new _("Graph.".concat(o,': could not find the "').concat(e,'" edge in the graph.'))}return a.attributes[t]=i,this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:t}),this}}function ye(r,o,n){r.prototype[o]=function(e,t,i){var a;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w("Graph.".concat(o,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new w("Graph.".concat(o,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,p=""+t;if(t=arguments[2],i=arguments[3],a=$(this,s,p,n),!a)throw new _("Graph.".concat(o,': could not find an edge for the given path ("').concat(s,'" - "').concat(p,'").'))}else{if(n!=="mixed")throw new w("Graph.".concat(o,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,a=this._edges.get(e),!a)throw new _("Graph.".concat(o,': could not find the "').concat(e,'" edge in the graph.'))}if(typeof i!="function")throw new G("Graph.".concat(o,": updater should be a function."));return a.attributes[t]=i(a.attributes[t]),this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:t}),this}}function Se(r,o,n){r.prototype[o]=function(e,t){var i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w("Graph.".concat(o,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new w("Graph.".concat(o,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+e,s=""+t;if(t=arguments[2],i=$(this,a,s,n),!i)throw new _("Graph.".concat(o,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if(n!=="mixed")throw new w("Graph.".concat(o,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,i=this._edges.get(e),!i)throw new _("Graph.".concat(o,': could not find the "').concat(e,'" edge in the graph.'))}return delete i.attributes[t],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:t}),this}}function we(r,o,n){r.prototype[o]=function(e,t){var i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w("Graph.".concat(o,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new w("Graph.".concat(o,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+e,s=""+t;if(t=arguments[2],i=$(this,a,s,n),!i)throw new _("Graph.".concat(o,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if(n!=="mixed")throw new w("Graph.".concat(o,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,i=this._edges.get(e),!i)throw new _("Graph.".concat(o,': could not find the "').concat(e,'" edge in the graph.'))}if(!R(t))throw new G("Graph.".concat(o,": provided attributes are not a plain object."));return i.attributes=t,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}function Ae(r,o,n){r.prototype[o]=function(e,t){var i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w("Graph.".concat(o,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new w("Graph.".concat(o,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+e,s=""+t;if(t=arguments[2],i=$(this,a,s,n),!i)throw new _("Graph.".concat(o,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if(n!=="mixed")throw new w("Graph.".concat(o,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,i=this._edges.get(e),!i)throw new _("Graph.".concat(o,': could not find the "').concat(e,'" edge in the graph.'))}if(!R(t))throw new G("Graph.".concat(o,": provided attributes are not a plain object."));return L(i.attributes,t),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:t}),this}}function le(r,o,n){r.prototype[o]=function(e,t){var i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new w("Graph.".concat(o,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new w("Graph.".concat(o,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+e,s=""+t;if(t=arguments[2],i=$(this,a,s,n),!i)throw new _("Graph.".concat(o,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if(n!=="mixed")throw new w("Graph.".concat(o,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,i=this._edges.get(e),!i)throw new _("Graph.".concat(o,': could not find the "').concat(e,'" edge in the graph.'))}if(typeof t!="function")throw new G("Graph.".concat(o,": provided updater is not a function."));return i.attributes=t(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}var Ne=[{name:function(r){return"get".concat(r,"Attribute")},attacher:me},{name:function(r){return"get".concat(r,"Attributes")},attacher:U},{name:function(r){return"has".concat(r,"Attribute")},attacher:O},{name:function(r){return"set".concat(r,"Attribute")},attacher:b},{name:function(r){return"update".concat(r,"Attribute")},attacher:ye},{name:function(r){return"remove".concat(r,"Attribute")},attacher:Se},{name:function(r){return"replace".concat(r,"Attributes")},attacher:we},{name:function(r){return"merge".concat(r,"Attributes")},attacher:Ae},{name:function(r){return"update".concat(r,"Attributes")},attacher:le}];function qe(r){Ne.forEach(function(o){var n=o.name,e=o.attacher;e(r,n("Edge"),"mixed"),e(r,n("DirectedEdge"),"directed"),e(r,n("UndirectedEdge"),"undirected")})}var ze=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function Re(r,o,n,e){var t=!1;for(var i in o)if(i!==e){var a=o[i];if(t=n(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),r&&t)return a.key}}function Oe(r,o,n,e){var t,i,a,s=!1;for(var p in o)if(p!==e){t=o[p];do{if(i=t.source,a=t.target,s=n(t.key,t.attributes,i.key,a.key,i.attributes,a.attributes,t.undirected),r&&s)return t.key;t=t.next}while(t!==void 0)}}function ve(r,o){var n=Object.keys(r),e=n.length,t,i=0;return u(u({},Symbol.iterator,function(){return this}),"next",function(){do if(t)t=t.next;else{if(i>=e)return{done:!0};var a=n[i++];if(a===o){t=void 0;continue}t=r[a]}while(!t);return{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}}})}function Ue(r,o,n,e){var t=o[n];if(t){var i=t.source,a=t.target;if(e(t.key,t.attributes,i.key,a.key,i.attributes,a.attributes,t.undirected)&&r)return t.key}}function xe(r,o,n,e){var t=o[n];if(t){var i=!1;do{if(i=e(t.key,t.attributes,t.source.key,t.target.key,t.source.attributes,t.target.attributes,t.undirected),r&&i)return t.key;t=t.next}while(t!==void 0)}}function Ce(r,o){var n=r[o];if(n.next!==void 0)return u(u({},Symbol.iterator,function(){return this}),"next",function(){if(!n)return{done:!0};var t={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:t}});var e=!1;return u(u({},Symbol.iterator,function(){return this}),"next",function(){return e===!0?{done:!0}:(e=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})})}function Fe(r,o){if(r.size===0)return[];if(o==="mixed"||o===r.type)return Array.from(r._edges.keys());for(var n=o==="undirected"?r.undirectedSize:r.directedSize,e=new Array(n),t=o==="undirected",i=r._edges.values(),a=0,s,p;s=i.next(),s.done!==!0;)p=s.value,p.undirected===t&&(e[a++]=p.key);return e}function pt(r,o,n,e){if(o.size!==0){for(var t=n!=="mixed"&&n!==o.type,i=n==="undirected",a,s,p=!1,g=o._edges.values();a=g.next(),a.done!==!0;)if(s=a.value,!(t&&s.undirected!==i)){var E=s,A=E.key,M=E.attributes,P=E.source,Y=E.target;if(p=e(A,M,P.key,Y.key,P.attributes,Y.attributes,s.undirected),r&&p)return A}}}function Ft(r,o){if(r.size===0)return re();var n=o!=="mixed"&&o!==r.type,e=o==="undirected",t=r._edges.values();return u(u({},Symbol.iterator,function(){return this}),"next",function(){for(var i,a;;){if(i=t.next(),i.done)return i;if(a=i.value,!(n&&a.undirected!==e))break}var s={edge:a.key,attributes:a.attributes,source:a.source.key,target:a.target.key,sourceAttributes:a.source.attributes,targetAttributes:a.target.attributes,undirected:a.undirected};return{value:s,done:!1}})}function it(r,o,n,e,t,i){var a=o?Oe:Re,s;if(n!=="undirected"&&(e!=="out"&&(s=a(r,t.in,i),r&&s)||e!=="in"&&(s=a(r,t.out,i,e?void 0:t.key),r&&s))||n!=="directed"&&(s=a(r,t.undirected,i),r&&s))return s}function Pt(r,o,n,e){var t=[];return it(!1,r,o,n,e,function(i){t.push(i)}),t}function $t(r,o,n){var e=re();return r!=="undirected"&&(o!=="out"&&typeof n.in<"u"&&(e=ce(e,ve(n.in))),o!=="in"&&typeof n.out<"u"&&(e=ce(e,ve(n.out,o?void 0:n.key)))),r!=="directed"&&typeof n.undirected<"u"&&(e=ce(e,ve(n.undirected))),e}function ot(r,o,n,e,t,i,a){var s=n?xe:Ue,p;if(o!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&(p=s(r,t.in,i,a),r&&p)||typeof t.out<"u"&&e!=="in"&&(e||t.key!==i)&&(p=s(r,t.out,i,a),r&&p))||o!=="directed"&&typeof t.undirected<"u"&&(p=s(r,t.undirected,i,a),r&&p))return p}function Wt(r,o,n,e,t){var i=[];return ot(!1,r,o,n,e,t,function(a){i.push(a)}),i}function qt(r,o,n,e){var t=re();return r!=="undirected"&&(typeof n.in<"u"&&o!=="out"&&e in n.in&&(t=ce(t,Ce(n.in,e))),typeof n.out<"u"&&o!=="in"&&e in n.out&&(o||n.key!==e)&&(t=ce(t,Ce(n.out,e)))),r!=="directed"&&typeof n.undirected<"u"&&e in n.undirected&&(t=ce(t,Ce(n.undirected,e))),t}function Bt(r,o){var n=o.name,e=o.type,t=o.direction;r.prototype[n]=function(i,a){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];if(!arguments.length)return Fe(this,e);if(arguments.length===1){i=""+i;var s=this._nodes.get(i);if(typeof s>"u")throw new _("Graph.".concat(n,': could not find the "').concat(i,'" node in the graph.'));return Pt(this.multi,e==="mixed"?this.type:e,t,s)}if(arguments.length===2){i=""+i,a=""+a;var p=this._nodes.get(i);if(!p)throw new _("Graph.".concat(n,': could not find the "').concat(i,'" source node in the graph.'));if(!this._nodes.has(a))throw new _("Graph.".concat(n,': could not find the "').concat(a,'" target node in the graph.'));return Wt(e,this.multi,t,p,a)}throw new G("Graph.".concat(n,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}function Ht(r,o){var n=o.name,e=o.type,t=o.direction,i="forEach"+n[0].toUpperCase()+n.slice(1,-1);r.prototype[i]=function(g,E,A){if(!(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)){if(arguments.length===1)return A=g,pt(!1,this,e,A);if(arguments.length===2){g=""+g,A=E;var M=this._nodes.get(g);if(typeof M>"u")throw new _("Graph.".concat(i,': could not find the "').concat(g,'" node in the graph.'));return it(!1,this.multi,e==="mixed"?this.type:e,t,M,A)}if(arguments.length===3){g=""+g,E=""+E;var P=this._nodes.get(g);if(!P)throw new _("Graph.".concat(i,': could not find the "').concat(g,'" source node in the graph.'));if(!this._nodes.has(E))throw new _("Graph.".concat(i,': could not find the "').concat(E,'" target node in the graph.'));return ot(!1,e,this.multi,t,P,E,A)}throw new G("Graph.".concat(i,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))}};var a="map"+n[0].toUpperCase()+n.slice(1);r.prototype[a]=function(){var g=Array.prototype.slice.call(arguments),E=g.pop(),A;if(g.length===0){var M=0;e!=="directed"&&(M+=this.undirectedSize),e!=="undirected"&&(M+=this.directedSize),A=new Array(M);var P=0;g.push(function(Y,ne,te,ae,ue,be,De){A[P++]=E(Y,ne,te,ae,ue,be,De)})}else A=[],g.push(function(Y,ne,te,ae,ue,be,De){A.push(E(Y,ne,te,ae,ue,be,De))});return this[i].apply(this,g),A};var s="filter"+n[0].toUpperCase()+n.slice(1);r.prototype[s]=function(){var g=Array.prototype.slice.call(arguments),E=g.pop(),A=[];return g.push(function(M,P,Y,ne,te,ae,ue){E(M,P,Y,ne,te,ae,ue)&&A.push(M)}),this[i].apply(this,g),A};var p="reduce"+n[0].toUpperCase()+n.slice(1);r.prototype[p]=function(){var g=Array.prototype.slice.call(arguments);if(g.length<2||g.length>4)throw new G("Graph.".concat(p,": invalid number of arguments (expecting 2, 3 or 4 and got ").concat(g.length,")."));if(typeof g[g.length-1]=="function"&&typeof g[g.length-2]!="function")throw new G("Graph.".concat(p,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));var E,A;g.length===2?(E=g[0],A=g[1],g=[]):g.length===3?(E=g[1],A=g[2],g=[g[0]]):g.length===4&&(E=g[2],A=g[3],g=[g[0],g[1]]);var M=A;return g.push(function(P,Y,ne,te,ae,ue,be){M=E(M,P,Y,ne,te,ae,ue,be)}),this[i].apply(this,g),M}}function Vt(r,o){var n=o.name,e=o.type,t=o.direction,i="find"+n[0].toUpperCase()+n.slice(1,-1);r.prototype[i]=function(p,g,E){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return!1;if(arguments.length===1)return E=p,pt(!0,this,e,E);if(arguments.length===2){p=""+p,E=g;var A=this._nodes.get(p);if(typeof A>"u")throw new _("Graph.".concat(i,': could not find the "').concat(p,'" node in the graph.'));return it(!0,this.multi,e==="mixed"?this.type:e,t,A,E)}if(arguments.length===3){p=""+p,g=""+g;var M=this._nodes.get(p);if(!M)throw new _("Graph.".concat(i,': could not find the "').concat(p,'" source node in the graph.'));if(!this._nodes.has(g))throw new _("Graph.".concat(i,': could not find the "').concat(g,'" target node in the graph.'));return ot(!0,e,this.multi,t,M,g,E)}throw new G("Graph.".concat(i,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))};var a="some"+n[0].toUpperCase()+n.slice(1,-1);r.prototype[a]=function(){var p=Array.prototype.slice.call(arguments),g=p.pop();p.push(function(A,M,P,Y,ne,te,ae){return g(A,M,P,Y,ne,te,ae)});var E=this[i].apply(this,p);return!!E};var s="every"+n[0].toUpperCase()+n.slice(1,-1);r.prototype[s]=function(){var p=Array.prototype.slice.call(arguments),g=p.pop();p.push(function(A,M,P,Y,ne,te,ae){return!g(A,M,P,Y,ne,te,ae)});var E=this[i].apply(this,p);return!E}}function Kt(r,o){var n=o.name,e=o.type,t=o.direction,i=n.slice(0,-1)+"Entries";r.prototype[i]=function(a,s){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return re();if(!arguments.length)return Ft(this,e);if(arguments.length===1){a=""+a;var p=this._nodes.get(a);if(!p)throw new _("Graph.".concat(i,': could not find the "').concat(a,'" node in the graph.'));return $t(e,t,p)}if(arguments.length===2){a=""+a,s=""+s;var g=this._nodes.get(a);if(!g)throw new _("Graph.".concat(i,': could not find the "').concat(a,'" source node in the graph.'));if(!this._nodes.has(s))throw new _("Graph.".concat(i,': could not find the "').concat(s,'" target node in the graph.'));return qt(e,t,g,s)}throw new G("Graph.".concat(i,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}function Yt(r){ze.forEach(function(o){Bt(r,o),Ht(r,o),Vt(r,o),Kt(r,o)})}var Xt=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function Ye(){this.A=null,this.B=null}Ye.prototype.wrap=function(r){this.A===null?this.A=r:this.B===null&&(this.B=r)},Ye.prototype.has=function(r){return this.A!==null&&r in this.A||this.B!==null&&r in this.B};function Be(r,o,n,e,t){for(var i in e){var a=e[i],s=a.source,p=a.target,g=s===n?p:s;if(!(o&&o.has(g.key))){var E=t(g.key,g.attributes);if(r&&E)return g.key}}}function at(r,o,n,e,t){if(o!=="mixed"){if(o==="undirected")return Be(r,null,e,e.undirected,t);if(typeof n=="string")return Be(r,null,e,e[n],t)}var i=new Ye,a;if(o!=="undirected"){if(n!=="out"){if(a=Be(r,null,e,e.in,t),r&&a)return a;i.wrap(e.in)}if(n!=="in"){if(a=Be(r,i,e,e.out,t),r&&a)return a;i.wrap(e.out)}}if(o!=="directed"&&(a=Be(r,i,e,e.undirected,t),r&&a))return a}function Qt(r,o,n){if(r!=="mixed"){if(r==="undirected")return Object.keys(n.undirected);if(typeof o=="string")return Object.keys(n[o])}var e=[];return at(!1,r,o,n,function(t){e.push(t)}),e}function He(r,o,n){var e=Object.keys(n),t=e.length,i=0;return u(u({},Symbol.iterator,function(){return this}),"next",function(){var a=null;do{if(i>=t)return r&&r.wrap(n),{done:!0};var s=n[e[i++]],p=s.source,g=s.target;if(a=p===o?g:p,r&&r.has(a.key)){a=null;continue}}while(a===null);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}})}function Jt(r,o,n){if(r!=="mixed"){if(r==="undirected")return He(null,n,n.undirected);if(typeof o=="string")return He(null,n,n[o])}var e=re(),t=new Ye;return r!=="undirected"&&(o!=="out"&&(e=ce(e,He(t,n,n.in))),o!=="in"&&(e=ce(e,He(t,n,n.out)))),r!=="directed"&&(e=ce(e,He(t,n,n.undirected))),e}function Zt(r,o){var n=o.name,e=o.type,t=o.direction;r.prototype[n]=function(i){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];i=""+i;var a=this._nodes.get(i);if(typeof a>"u")throw new _("Graph.".concat(n,': could not find the "').concat(i,'" node in the graph.'));return Qt(e==="mixed"?this.type:e,t,a)}}function er(r,o){var n=o.name,e=o.type,t=o.direction,i="forEach"+n[0].toUpperCase()+n.slice(1,-1);r.prototype[i]=function(g,E){if(!(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)){g=""+g;var A=this._nodes.get(g);if(typeof A>"u")throw new _("Graph.".concat(i,': could not find the "').concat(g,'" node in the graph.'));at(!1,e==="mixed"?this.type:e,t,A,E)}};var a="map"+n[0].toUpperCase()+n.slice(1);r.prototype[a]=function(g,E){var A=[];return this[i](g,function(M,P){A.push(E(M,P))}),A};var s="filter"+n[0].toUpperCase()+n.slice(1);r.prototype[s]=function(g,E){var A=[];return this[i](g,function(M,P){E(M,P)&&A.push(M)}),A};var p="reduce"+n[0].toUpperCase()+n.slice(1);r.prototype[p]=function(g,E,A){if(arguments.length<3)throw new G("Graph.".concat(p,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));var M=A;return this[i](g,function(P,Y){M=E(M,P,Y)}),M}}function tr(r,o){var n=o.name,e=o.type,t=o.direction,i=n[0].toUpperCase()+n.slice(1,-1),a="find"+i;r.prototype[a]=function(g,E){if(!(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)){g=""+g;var A=this._nodes.get(g);if(typeof A>"u")throw new _("Graph.".concat(a,': could not find the "').concat(g,'" node in the graph.'));return at(!0,e==="mixed"?this.type:e,t,A,E)}};var s="some"+i;r.prototype[s]=function(g,E){var A=this[a](g,E);return!!A};var p="every"+i;r.prototype[p]=function(g,E){var A=this[a](g,function(M,P){return!E(M,P)});return!A}}function rr(r,o){var n=o.name,e=o.type,t=o.direction,i=n.slice(0,-1)+"Entries";r.prototype[i]=function(a){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return re();a=""+a;var s=this._nodes.get(a);if(typeof s>"u")throw new _("Graph.".concat(i,': could not find the "').concat(a,'" node in the graph.'));return Jt(e==="mixed"?this.type:e,t,s)}}function nr(r){Xt.forEach(function(o){Zt(r,o),er(r,o),tr(r,o),rr(r,o)})}function Xe(r,o,n,e,t){for(var i=e._nodes.values(),a=e.type,s,p,g,E,A,M,P;s=i.next(),s.done!==!0;){var Y=!1;if(p=s.value,a!=="undirected"){E=p.out;for(g in E){A=E[g];do M=A.target,Y=!0,P=t(p.key,M.key,p.attributes,M.attributes,A.key,A.attributes,A.undirected),A=A.next;while(A)}}if(a!=="directed"){E=p.undirected;for(g in E)if(!(o&&p.key>g)){A=E[g];do M=A.target,M.key!==g&&(M=A.source),Y=!0,P=t(p.key,M.key,p.attributes,M.attributes,A.key,A.attributes,A.undirected),A=A.next;while(A)}}n&&!Y&&(P=t(p.key,null,p.attributes,null,null,null,null))}}function ir(r,o){var n={key:r};return K(o.attributes)||(n.attributes=L({},o.attributes)),n}function or(r,o,n){var e={key:o,source:n.source.key,target:n.target.key};return K(n.attributes)||(e.attributes=L({},n.attributes)),r==="mixed"&&n.undirected&&(e.undirected=!0),e}function ar(r){if(!R(r))throw new G('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in r))throw new G("Graph.import: serialized node is missing its key.");if("attributes"in r&&(!R(r.attributes)||r.attributes===null))throw new G("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function sr(r){if(!R(r))throw new G('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in r))throw new G("Graph.import: serialized edge is missing its source.");if(!("target"in r))throw new G("Graph.import: serialized edge is missing its target.");if("attributes"in r&&(!R(r.attributes)||r.attributes===null))throw new G("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in r&&typeof r.undirected!="boolean")throw new G("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}var cr=de(),dr=new Set(["directed","undirected","mixed"]),ht=new Set(["domain","_events","_eventsCount","_maxListeners"]),lr=[{name:function(r){return"".concat(r,"Edge")},generateKey:!0},{name:function(r){return"".concat(r,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(r){return"".concat(r,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(r){return"".concat(r,"EdgeWithKey")}},{name:function(r){return"".concat(r,"DirectedEdgeWithKey")},type:"directed"},{name:function(r){return"".concat(r,"UndirectedEdgeWithKey")},type:"undirected"}],ur={allowSelfLoops:!0,multi:!1,type:"mixed"};function pr(r,o,n){if(n&&!R(n))throw new G('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(o=""+o,n=n||{},r._nodes.has(o))throw new w('Graph.addNode: the "'.concat(o,'" node already exist in the graph.'));var e=new r.NodeDataClass(o,n);return r._nodes.set(o,e),r.emit("nodeAdded",{key:o,attributes:n}),e}function ft(r,o,n){var e=new r.NodeDataClass(o,n);return r._nodes.set(o,e),r.emit("nodeAdded",{key:o,attributes:n}),e}function gt(r,o,n,e,t,i,a,s){if(!e&&r.type==="undirected")throw new w("Graph.".concat(o,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(e&&r.type==="directed")throw new w("Graph.".concat(o,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(s&&!R(s))throw new G("Graph.".concat(o,': invalid attributes. Expecting an object but got "').concat(s,'"'));if(i=""+i,a=""+a,s=s||{},!r.allowSelfLoops&&i===a)throw new w("Graph.".concat(o,': source & target are the same ("').concat(i,`"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`));var p=r._nodes.get(i),g=r._nodes.get(a);if(!p)throw new _("Graph.".concat(o,': source node "').concat(i,'" not found.'));if(!g)throw new _("Graph.".concat(o,': target node "').concat(a,'" not found.'));var E={key:null,undirected:e,source:i,target:a,attributes:s};if(n)t=r._edgeKeyGenerator();else if(t=""+t,r._edges.has(t))throw new w("Graph.".concat(o,': the "').concat(t,'" edge already exists in the graph.'));if(!r.multi&&(e?typeof p.undirected[a]<"u":typeof p.out[a]<"u"))throw new w("Graph.".concat(o,': an edge linking "').concat(i,'" to "').concat(a,`" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`));var A=new S(e,t,p,g,s);r._edges.set(t,A);var M=i===a;return e?(p.undirectedDegree++,g.undirectedDegree++,M&&(p.undirectedLoops++,r._undirectedSelfLoopCount++)):(p.outDegree++,g.inDegree++,M&&(p.directedLoops++,r._directedSelfLoopCount++)),r.multi?A.attachMulti():A.attach(),e?r._undirectedSize++:r._directedSize++,E.key=t,r.emit("edgeAdded",E),t}function hr(r,o,n,e,t,i,a,s,p){if(!e&&r.type==="undirected")throw new w("Graph.".concat(o,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(e&&r.type==="directed")throw new w("Graph.".concat(o,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(s){if(p){if(typeof s!="function")throw new G("Graph.".concat(o,': invalid updater function. Expecting a function but got "').concat(s,'"'))}else if(!R(s))throw new G("Graph.".concat(o,': invalid attributes. Expecting an object but got "').concat(s,'"'))}i=""+i,a=""+a;var g;if(p&&(g=s,s=void 0),!r.allowSelfLoops&&i===a)throw new w("Graph.".concat(o,': source & target are the same ("').concat(i,`"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`));var E=r._nodes.get(i),A=r._nodes.get(a),M,P;if(!n&&(M=r._edges.get(t),M)){if((M.source.key!==i||M.target.key!==a)&&(!e||M.source.key!==a||M.target.key!==i))throw new w("Graph.".concat(o,': inconsistency detected when attempting to merge the "').concat(t,'" edge with "').concat(i,'" source & "').concat(a,'" target vs. ("').concat(M.source.key,'", "').concat(M.target.key,'").'));P=M}if(!P&&!r.multi&&E&&(P=e?E.undirected[a]:E.out[a]),P){var Y=[P.key,!1,!1,!1];if(p?!g:!s)return Y;if(p){var ne=P.attributes;P.attributes=g(ne),r.emit("edgeAttributesUpdated",{type:"replace",key:P.key,attributes:P.attributes})}else L(P.attributes,s),r.emit("edgeAttributesUpdated",{type:"merge",key:P.key,attributes:P.attributes,data:s});return Y}s=s||{},p&&g&&(s=g(s));var te={key:null,undirected:e,source:i,target:a,attributes:s};if(n)t=r._edgeKeyGenerator();else if(t=""+t,r._edges.has(t))throw new w("Graph.".concat(o,': the "').concat(t,'" edge already exists in the graph.'));var ae=!1,ue=!1;E||(E=ft(r,i,{}),ae=!0,i===a&&(A=E,ue=!0)),A||(A=ft(r,a,{}),ue=!0),M=new S(e,t,E,A,s),r._edges.set(t,M);var be=i===a;return e?(E.undirectedDegree++,A.undirectedDegree++,be&&(E.undirectedLoops++,r._undirectedSelfLoopCount++)):(E.outDegree++,A.inDegree++,be&&(E.directedLoops++,r._directedSelfLoopCount++)),r.multi?M.attachMulti():M.attach(),e?r._undirectedSize++:r._directedSize++,te.key=t,r.emit("edgeAdded",te),[t,!0,ae,ue]}function Pe(r,o){r._edges.delete(o.key);var n=o.source,e=o.target,t=o.attributes,i=o.undirected,a=n===e;i?(n.undirectedDegree--,e.undirectedDegree--,a&&(n.undirectedLoops--,r._undirectedSelfLoopCount--)):(n.outDegree--,e.inDegree--,a&&(n.directedLoops--,r._directedSelfLoopCount--)),r.multi?o.detachMulti():o.detach(),i?r._undirectedSize--:r._directedSize--,r.emit("edgeDropped",{key:o.key,attributes:t,source:n.key,target:e.key,undirected:i})}var Z=(function(r){m(o,r);function o(e){var t;if(t=r.call(this)||this,e=L({},ur,e),typeof e.multi!="boolean")throw new G(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "`.concat(e.multi,'".'));if(!dr.has(e.type))throw new G(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "`.concat(e.type,'".'));if(typeof e.allowSelfLoops!="boolean")throw new G(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "`.concat(e.allowSelfLoops,'".'));var i=e.type==="mixed"?c:e.type==="directed"?X:je;W(l(t),"NodeDataClass",i);var a="geid_"+cr()+"_",s=0,p=function(){var g;do g=a+s++;while(t._edges.has(g));return g};return W(l(t),"_attributes",{}),W(l(t),"_nodes",new Map),W(l(t),"_edges",new Map),W(l(t),"_directedSize",0),W(l(t),"_undirectedSize",0),W(l(t),"_directedSelfLoopCount",0),W(l(t),"_undirectedSelfLoopCount",0),W(l(t),"_edgeKeyGenerator",p),W(l(t),"_options",e),ht.forEach(function(g){return W(l(t),g,t[g])}),B(l(t),"order",function(){return t._nodes.size}),B(l(t),"size",function(){return t._edges.size}),B(l(t),"directedSize",function(){return t._directedSize}),B(l(t),"undirectedSize",function(){return t._undirectedSize}),B(l(t),"selfLoopCount",function(){return t._directedSelfLoopCount+t._undirectedSelfLoopCount}),B(l(t),"directedSelfLoopCount",function(){return t._directedSelfLoopCount}),B(l(t),"undirectedSelfLoopCount",function(){return t._undirectedSelfLoopCount}),B(l(t),"multi",t._options.multi),B(l(t),"type",t._options.type),B(l(t),"allowSelfLoops",t._options.allowSelfLoops),B(l(t),"implementation",function(){return"graphology"}),t}var n=o.prototype;return n._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},n.hasNode=function(e){return this._nodes.has(""+e)},n.hasDirectedEdge=function(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){var i=""+e,a=this._edges.get(i);return!!a&&!a.undirected}else if(arguments.length===2){e=""+e,t=""+t;var s=this._nodes.get(e);return s?s.out.hasOwnProperty(t):!1}throw new G("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},n.hasUndirectedEdge=function(e,t){if(this.type==="directed")return!1;if(arguments.length===1){var i=""+e,a=this._edges.get(i);return!!a&&a.undirected}else if(arguments.length===2){e=""+e,t=""+t;var s=this._nodes.get(e);return s?s.undirected.hasOwnProperty(t):!1}throw new G("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},n.hasEdge=function(e,t){if(arguments.length===1){var i=""+e;return this._edges.has(i)}else if(arguments.length===2){e=""+e,t=""+t;var a=this._nodes.get(e);return a?typeof a.out<"u"&&a.out.hasOwnProperty(t)||typeof a.undirected<"u"&&a.undirected.hasOwnProperty(t):!1}throw new G("Graph.hasEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},n.directedEdge=function(e,t){if(this.type!=="undirected"){if(e=""+e,t=""+t,this.multi)throw new w("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");var i=this._nodes.get(e);if(!i)throw new _('Graph.directedEdge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new _('Graph.directedEdge: could not find the "'.concat(t,'" target node in the graph.'));var a=i.out&&i.out[t]||void 0;if(a)return a.key}},n.undirectedEdge=function(e,t){if(this.type!=="directed"){if(e=""+e,t=""+t,this.multi)throw new w("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");var i=this._nodes.get(e);if(!i)throw new _('Graph.undirectedEdge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new _('Graph.undirectedEdge: could not find the "'.concat(t,'" target node in the graph.'));var a=i.undirected&&i.undirected[t]||void 0;if(a)return a.key}},n.edge=function(e,t){if(this.multi)throw new w("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;var i=this._nodes.get(e);if(!i)throw new _('Graph.edge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new _('Graph.edge: could not find the "'.concat(t,'" target node in the graph.'));var a=i.out&&i.out[t]||i.undirected&&i.undirected[t]||void 0;if(a)return a.key},n.areDirectedNeighbors=function(e,t){e=""+e,t=""+t;var i=this._nodes.get(e);if(!i)throw new _('Graph.areDirectedNeighbors: could not find the "'.concat(e,'" node in the graph.'));return this.type==="undirected"?!1:t in i.in||t in i.out},n.areOutNeighbors=function(e,t){e=""+e,t=""+t;var i=this._nodes.get(e);if(!i)throw new _('Graph.areOutNeighbors: could not find the "'.concat(e,'" node in the graph.'));return this.type==="undirected"?!1:t in i.out},n.areInNeighbors=function(e,t){e=""+e,t=""+t;var i=this._nodes.get(e);if(!i)throw new _('Graph.areInNeighbors: could not find the "'.concat(e,'" node in the graph.'));return this.type==="undirected"?!1:t in i.in},n.areUndirectedNeighbors=function(e,t){e=""+e,t=""+t;var i=this._nodes.get(e);if(!i)throw new _('Graph.areUndirectedNeighbors: could not find the "'.concat(e,'" node in the graph.'));return this.type==="directed"?!1:t in i.undirected},n.areNeighbors=function(e,t){e=""+e,t=""+t;var i=this._nodes.get(e);if(!i)throw new _('Graph.areNeighbors: could not find the "'.concat(e,'" node in the graph.'));return this.type!=="undirected"&&(t in i.in||t in i.out)||this.type!=="directed"&&t in i.undirected},n.areInboundNeighbors=function(e,t){e=""+e,t=""+t;var i=this._nodes.get(e);if(!i)throw new _('Graph.areInboundNeighbors: could not find the "'.concat(e,'" node in the graph.'));return this.type!=="undirected"&&t in i.in||this.type!=="directed"&&t in i.undirected},n.areOutboundNeighbors=function(e,t){e=""+e,t=""+t;var i=this._nodes.get(e);if(!i)throw new _('Graph.areOutboundNeighbors: could not find the "'.concat(e,'" node in the graph.'));return this.type!=="undirected"&&t in i.out||this.type!=="directed"&&t in i.undirected},n.inDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.inDegree: could not find the "'.concat(e,'" node in the graph.'));return this.type==="undirected"?0:t.inDegree},n.outDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.outDegree: could not find the "'.concat(e,'" node in the graph.'));return this.type==="undirected"?0:t.outDegree},n.directedDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.directedDegree: could not find the "'.concat(e,'" node in the graph.'));return this.type==="undirected"?0:t.inDegree+t.outDegree},n.undirectedDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.undirectedDegree: could not find the "'.concat(e,'" node in the graph.'));return this.type==="directed"?0:t.undirectedDegree},n.inboundDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.inboundDegree: could not find the "'.concat(e,'" node in the graph.'));var i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.inDegree),i},n.outboundDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.outboundDegree: could not find the "'.concat(e,'" node in the graph.'));var i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.outDegree),i},n.degree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.degree: could not find the "'.concat(e,'" node in the graph.'));var i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.inDegree+t.outDegree),i},n.inDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return this.type==="undirected"?0:t.inDegree-t.directedLoops},n.outDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return this.type==="undirected"?0:t.outDegree-t.directedLoops},n.directedDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2},n.undirectedDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2},n.inboundDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var i=0,a=0;return this.type!=="directed"&&(i+=t.undirectedDegree,a+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.inDegree,a+=t.directedLoops),i-a},n.outboundDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var i=0,a=0;return this.type!=="directed"&&(i+=t.undirectedDegree,a+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.outDegree,a+=t.directedLoops),i-a},n.degreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.degreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var i=0,a=0;return this.type!=="directed"&&(i+=t.undirectedDegree,a+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.inDegree+t.outDegree,a+=t.directedLoops*2),i-a},n.source=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new _('Graph.source: could not find the "'.concat(e,'" edge in the graph.'));return t.source.key},n.target=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new _('Graph.target: could not find the "'.concat(e,'" edge in the graph.'));return t.target.key},n.extremities=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new _('Graph.extremities: could not find the "'.concat(e,'" edge in the graph.'));return[t.source.key,t.target.key]},n.opposite=function(e,t){e=""+e,t=""+t;var i=this._edges.get(t);if(!i)throw new _('Graph.opposite: could not find the "'.concat(t,'" edge in the graph.'));var a=i.source.key,s=i.target.key;if(e===a)return s;if(e===s)return a;throw new _('Graph.opposite: the "'.concat(e,'" node is not attached to the "').concat(t,'" edge (').concat(a,", ").concat(s,")."))},n.hasExtremity=function(e,t){e=""+e,t=""+t;var i=this._edges.get(e);if(!i)throw new _('Graph.hasExtremity: could not find the "'.concat(e,'" edge in the graph.'));return i.source.key===t||i.target.key===t},n.isUndirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new _('Graph.isUndirected: could not find the "'.concat(e,'" edge in the graph.'));return t.undirected},n.isDirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new _('Graph.isDirected: could not find the "'.concat(e,'" edge in the graph.'));return!t.undirected},n.isSelfLoop=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new _('Graph.isSelfLoop: could not find the "'.concat(e,'" edge in the graph.'));return t.source===t.target},n.addNode=function(e,t){var i=pr(this,e,t);return i.key},n.mergeNode=function(e,t){if(t&&!R(t))throw new G('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(t,'"'));e=""+e,t=t||{};var i=this._nodes.get(e);return i?(t&&(L(i.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:i.attributes,data:t})),[e,!1]):(i=new this.NodeDataClass(e,t),this._nodes.set(e,i),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])},n.updateNode=function(e,t){if(t&&typeof t!="function")throw new G('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(t,'"'));e=""+e;var i=this._nodes.get(e);if(i){if(t){var a=i.attributes;i.attributes=t(a),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:i.attributes})}return[e,!1]}var s=t?t({}):{};return i=new this.NodeDataClass(e,s),this._nodes.set(e,i),this.emit("nodeAdded",{key:e,attributes:s}),[e,!0]},n.dropNode=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new _('Graph.dropNode: could not find the "'.concat(e,'" node in the graph.'));var i;if(this.type!=="undirected"){for(var a in t.out){i=t.out[a];do Pe(this,i),i=i.next;while(i)}for(var s in t.in){i=t.in[s];do Pe(this,i),i=i.next;while(i)}}if(this.type!=="directed")for(var p in t.undirected){i=t.undirected[p];do Pe(this,i),i=i.next;while(i)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})},n.dropEdge=function(e){var t;if(arguments.length>1){var i=""+arguments[0],a=""+arguments[1];if(t=$(this,i,a,this.type),!t)throw new _('Graph.dropEdge: could not find the "'.concat(i,'" -> "').concat(a,'" edge in the graph.'))}else if(e=""+e,t=this._edges.get(e),!t)throw new _('Graph.dropEdge: could not find the "'.concat(e,'" edge in the graph.'));return Pe(this,t),this},n.dropDirectedEdge=function(e,t){if(arguments.length<2)throw new w("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new w("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,t=""+t;var i=$(this,e,t,"directed");if(!i)throw new _('Graph.dropDirectedEdge: could not find a "'.concat(e,'" -> "').concat(t,'" edge in the graph.'));return Pe(this,i),this},n.dropUndirectedEdge=function(e,t){if(arguments.length<2)throw new w("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new w("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var i=$(this,e,t,"undirected");if(!i)throw new _('Graph.dropUndirectedEdge: could not find a "'.concat(e,'" -> "').concat(t,'" edge in the graph.'));return Pe(this,i),this},n.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},n.clearEdges=function(){for(var e=this._nodes.values(),t;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},n.getAttribute=function(e){return this._attributes[e]},n.getAttributes=function(){return this._attributes},n.hasAttribute=function(e){return this._attributes.hasOwnProperty(e)},n.setAttribute=function(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},n.updateAttribute=function(e,t){if(typeof t!="function")throw new G("Graph.updateAttribute: updater should be a function.");var i=this._attributes[e];return this._attributes[e]=t(i),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},n.removeAttribute=function(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this},n.replaceAttributes=function(e){if(!R(e))throw new G("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},n.mergeAttributes=function(e){if(!R(e))throw new G("Graph.mergeAttributes: provided attributes are not a plain object.");return L(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this},n.updateAttributes=function(e){if(typeof e!="function")throw new G("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},n.updateEachNodeAttributes=function(e,t){if(typeof e!="function")throw new G("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!ie(t))throw new G("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var i=this._nodes.values(),a,s;a=i.next(),a.done!==!0;)s=a.value,s.attributes=e(s.key,s.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})},n.updateEachEdgeAttributes=function(e,t){if(typeof e!="function")throw new G("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!ie(t))throw new G("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var i=this._edges.values(),a,s,p,g;a=i.next(),a.done!==!0;)s=a.value,p=s.source,g=s.target,s.attributes=e(s.key,s.attributes,p.key,g.key,p.attributes,g.attributes,s.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})},n.forEachAdjacencyEntry=function(e){if(typeof e!="function")throw new G("Graph.forEachAdjacencyEntry: expecting a callback.");Xe(!1,!1,!1,this,e)},n.forEachAdjacencyEntryWithOrphans=function(e){if(typeof e!="function")throw new G("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Xe(!1,!1,!0,this,e)},n.forEachAssymetricAdjacencyEntry=function(e){if(typeof e!="function")throw new G("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Xe(!1,!0,!1,this,e)},n.forEachAssymetricAdjacencyEntryWithOrphans=function(e){if(typeof e!="function")throw new G("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Xe(!1,!0,!0,this,e)},n.nodes=function(){return Array.from(this._nodes.keys())},n.forEachNode=function(e){if(typeof e!="function")throw new G("Graph.forEachNode: expecting a callback.");for(var t=this._nodes.values(),i,a;i=t.next(),i.done!==!0;)a=i.value,e(a.key,a.attributes)},n.findNode=function(e){if(typeof e!="function")throw new G("Graph.findNode: expecting a callback.");for(var t=this._nodes.values(),i,a;i=t.next(),i.done!==!0;)if(a=i.value,e(a.key,a.attributes))return a.key},n.mapNodes=function(e){if(typeof e!="function")throw new G("Graph.mapNode: expecting a callback.");for(var t=this._nodes.values(),i,a,s=new Array(this.order),p=0;i=t.next(),i.done!==!0;)a=i.value,s[p++]=e(a.key,a.attributes);return s},n.someNode=function(e){if(typeof e!="function")throw new G("Graph.someNode: expecting a callback.");for(var t=this._nodes.values(),i,a;i=t.next(),i.done!==!0;)if(a=i.value,e(a.key,a.attributes))return!0;return!1},n.everyNode=function(e){if(typeof e!="function")throw new G("Graph.everyNode: expecting a callback.");for(var t=this._nodes.values(),i,a;i=t.next(),i.done!==!0;)if(a=i.value,!e(a.key,a.attributes))return!1;return!0},n.filterNodes=function(e){if(typeof e!="function")throw new G("Graph.filterNodes: expecting a callback.");for(var t=this._nodes.values(),i,a,s=[];i=t.next(),i.done!==!0;)a=i.value,e(a.key,a.attributes)&&s.push(a.key);return s},n.reduceNodes=function(e,t){if(typeof e!="function")throw new G("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new G("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");for(var i=t,a=this._nodes.values(),s,p;s=a.next(),s.done!==!0;)p=s.value,i=e(i,p.key,p.attributes);return i},n.nodeEntries=function(){var e=this._nodes.values();return u(u({},Symbol.iterator,function(){return this}),"next",function(){var t=e.next();if(t.done)return t;var i=t.value;return{value:{node:i.key,attributes:i.attributes},done:!1}})},n.export=function(){var e=this,t=new Array(this._nodes.size),i=0;this._nodes.forEach(function(s,p){t[i++]=ir(p,s)});var a=new Array(this._edges.size);return i=0,this._edges.forEach(function(s,p){a[i++]=or(e.type,p,s)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:a}},n.import=function(e){var t=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e instanceof o)return e.forEachNode(function(Ie,Te){i?t.mergeNode(Ie,Te):t.addNode(Ie,Te)}),e.forEachEdge(function(Ie,Te,Je,Ze,bn,yn,xt){i?xt?t.mergeUndirectedEdgeWithKey(Ie,Je,Ze,Te):t.mergeDirectedEdgeWithKey(Ie,Je,Ze,Te):xt?t.addUndirectedEdgeWithKey(Ie,Je,Ze,Te):t.addDirectedEdgeWithKey(Ie,Je,Ze,Te)}),this;if(!R(e))throw new G("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!R(e.attributes))throw new G("Graph.import: invalid attributes. Expecting a plain object.");i?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}var a,s,p,g,E;if(e.nodes){if(p=e.nodes,!Array.isArray(p))throw new G("Graph.import: invalid nodes. Expecting an array.");for(a=0,s=p.length;a<s;a++){g=p[a],ar(g);var A=g,M=A.key,P=A.attributes;i?this.mergeNode(M,P):this.addNode(M,P)}}if(e.edges){var Y=!1;if(this.type==="undirected"&&(Y=!0),p=e.edges,!Array.isArray(p))throw new G("Graph.import: invalid edges. Expecting an array.");for(a=0,s=p.length;a<s;a++){E=p[a],sr(E);var ne=E,te=ne.source,ae=ne.target,ue=ne.attributes,be=ne.undirected,De=be===void 0?Y:be,Qe=void 0;"key"in E?(Qe=i?De?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:De?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,Qe.call(this,E.key,te,ae,ue)):(Qe=i?De?this.mergeUndirectedEdge:this.mergeDirectedEdge:De?this.addUndirectedEdge:this.addDirectedEdge,Qe.call(this,te,ae,ue))}}return this},n.nullCopy=function(e){var t=new o(L({},this._options,e));return t.replaceAttributes(L({},this.getAttributes())),t},n.emptyCopy=function(e){var t=this.nullCopy(e);return this._nodes.forEach(function(i,a){var s=L({},i.attributes);i=new t.NodeDataClass(a,s),t._nodes.set(a,i)}),t},n.copy=function(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new w('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(e.type,'" because this would mean losing information about the current graph.'));if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new w("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops=="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new w("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");for(var t=this.emptyCopy(e),i=this._edges.values(),a,s;a=i.next(),a.done!==!0;)s=a.value,gt(t,"copy",!1,s.undirected,s.key,s.source.key,s.target.key,L({},s.attributes));return t},n.toJSON=function(){return this.export()},n.toString=function(){return"[object Graph]"},n.inspect=function(){var e=this,t={};this._nodes.forEach(function(g,E){t[E]=g.attributes});var i={},a={};this._edges.forEach(function(g,E){var A=g.undirected?"--":"->",M="",P=g.source.key,Y=g.target.key,ne;g.undirected&&P>Y&&(ne=P,P=Y,Y=ne);var te="(".concat(P,")").concat(A,"(").concat(Y,")");E.startsWith("geid_")?e.multi&&(typeof a[te]>"u"?a[te]=0:a[te]++,M+="".concat(a[te],". ")):M+="[".concat(E,"]: "),M+=te,i[M]=g.attributes});var s={};for(var p in this)this.hasOwnProperty(p)&&!ht.has(p)&&typeof this[p]!="function"&&I(p)!=="symbol"&&(s[p]=this[p]);return s.attributes=this._attributes,s.nodes=t,s.edges=i,W(s,"constructor",this.constructor),s},o})(y.EventEmitter);typeof Symbol<"u"&&(Z.prototype[Symbol.for("nodejs.util.inspect.custom")]=Z.prototype.inspect),lr.forEach(function(r){["add","merge","update"].forEach(function(o){var n=r.name(o),e=o==="add"?gt:hr;r.generateKey?Z.prototype[n]=function(t,i,a){return e(this,n,!0,(r.type||this.type)==="undirected",null,t,i,a,o==="update")}:Z.prototype[n]=function(t,i,a,s){return e(this,n,!1,(r.type||this.type)==="undirected",t,i,a,s,o==="update")}})}),V(Z),qe(Z),Yt(Z),nr(Z);var mt=(function(r){m(o,r);function o(n){var e=L({type:"directed"},n);if("multi"in e&&e.multi!==!1)throw new G("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(e.type!=="directed")throw new G('DirectedGraph.from: inconsistent "'+e.type+'" type in given options!');return r.call(this,e)||this}return o})(Z),bt=(function(r){m(o,r);function o(n){var e=L({type:"undirected"},n);if("multi"in e&&e.multi!==!1)throw new G("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(e.type!=="undirected")throw new G('UndirectedGraph.from: inconsistent "'+e.type+'" type in given options!');return r.call(this,e)||this}return o})(Z),yt=(function(r){m(o,r);function o(n){var e=L({multi:!0},n);if("multi"in e&&e.multi!==!0)throw new G("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return r.call(this,e)||this}return o})(Z),wt=(function(r){m(o,r);function o(n){var e=L({type:"directed",multi:!0},n);if("multi"in e&&e.multi!==!0)throw new G("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(e.type!=="directed")throw new G('MultiDirectedGraph.from: inconsistent "'+e.type+'" type in given options!');return r.call(this,e)||this}return o})(Z),vt=(function(r){m(o,r);function o(n){var e=L({type:"undirected",multi:!0},n);if("multi"in e&&e.multi!==!0)throw new G("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(e.type!=="undirected")throw new G('MultiUndirectedGraph.from: inconsistent "'+e.type+'" type in given options!');return r.call(this,e)||this}return o})(Z);function $e(r){r.from=function(o,n){var e=L({},o.options,n),t=new r(e);return t.import(o),t}}return $e(Z),$e(mt),$e(bt),$e(yt),$e(wt),$e(vt),Z.Graph=Z,Z.DirectedGraph=mt,Z.UndirectedGraph=bt,Z.MultiGraph=yt,Z.MultiDirectedGraph=wt,Z.MultiUndirectedGraph=vt,Z.InvalidArgumentsGraphError=G,Z.NotFoundGraphError=_,Z.UsageGraphError=w,st=Z,st}var Lr=Tr();const zr=Ot(Lr);var ct,_t;function Rr(){return _t||(_t=1,ct=function(y){return y!==null&&typeof y=="object"&&typeof y.addUndirectedEdgeWithKey=="function"&&typeof y.dropNode=="function"&&typeof y.multi=="boolean"}),ct}var Ke={},jt;function Or(){if(jt)return Ke;jt=1;function y(u){return typeof u!="number"||isNaN(u)?1:u}function l(u,v){var m={},k=function(j){return typeof j>"u"?v:j};typeof v=="function"&&(k=v);var N=function(j){return k(j[u])},D=function(){return k(void 0)};return typeof u=="string"?(m.fromAttributes=N,m.fromGraph=function(j,C){return N(j.getNodeAttributes(C))},m.fromEntry=function(j,C){return N(C)}):typeof u=="function"?(m.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},m.fromGraph=function(j,C){return k(u(C,j.getNodeAttributes(C)))},m.fromEntry=function(j,C){return k(u(j,C))}):(m.fromAttributes=D,m.fromGraph=D,m.fromEntry=D),m}function h(u,v){var m={},k=function(j){return typeof j>"u"?v:j};typeof v=="function"&&(k=v);var N=function(j){return k(j[u])},D=function(){return k(void 0)};return typeof u=="string"?(m.fromAttributes=N,m.fromGraph=function(j,C){return N(j.getEdgeAttributes(C))},m.fromEntry=function(j,C){return N(C)},m.fromPartialEntry=m.fromEntry,m.fromMinimalEntry=m.fromEntry):typeof u=="function"?(m.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},m.fromGraph=function(j,C){var I=j.extremities(C);return k(u(C,j.getEdgeAttributes(C),I[0],I[1],j.getNodeAttributes(I[0]),j.getNodeAttributes(I[1]),j.isUndirected(C)))},m.fromEntry=function(j,C,I,q,z,L,$){return k(u(j,C,I,q,z,L,$))},m.fromPartialEntry=function(j,C,I,q){return k(u(j,C,I,q))},m.fromMinimalEntry=function(j,C){return k(u(j,C))}):(m.fromAttributes=D,m.fromGraph=D,m.fromEntry=D,m.fromMinimalEntry=D),m}return Ke.createNodeValueGetter=l,Ke.createEdgeValueGetter=h,Ke.createEdgeWeightGetter=function(u){return h(u,y)},Ke}var dt,St;function Ur(){if(St)return dt;St=1;var y=0,l=1,h=2,u=3,v=4,m=5,k=6,N=7,D=8,j=9,C=0,I=1,q=2,z=0,L=1,$=2,R=3,K=4,W=5,B=6,ie=7,de=8,ce=3,re=10,_e=3,G=9,_=10;return dt=function(w,c,X){var je,S,f,Q,ee,ge,se,oe,F,We,pe=c.length,rt=X.length,Me=w.adjustSizes,nt=w.barnesHutTheta*w.barnesHutTheta,Le,J,H,V,me,U,O,b=[];for(f=0;f<pe;f+=re)c[f+v]=c[f+h],c[f+m]=c[f+u],c[f+h]=0,c[f+u]=0;if(w.outboundAttractionDistribution){for(Le=0,f=0;f<pe;f+=re)Le+=c[f+k];Le/=pe/re}if(w.barnesHutOptimize){var ye=1/0,Se=-1/0,we=1/0,Ae=-1/0,le,Ne,qe;for(f=0;f<pe;f+=re)ye=Math.min(ye,c[f+y]),Se=Math.max(Se,c[f+y]),we=Math.min(we,c[f+l]),Ae=Math.max(Ae,c[f+l]);var ze=Se-ye,Re=Ae-we;for(ze>Re?(we-=(ze-Re)/2,Ae=we+ze):(ye-=(Re-ze)/2,Se=ye+Re),b[0+z]=-1,b[0+L]=(ye+Se)/2,b[0+$]=(we+Ae)/2,b[0+R]=Math.max(Se-ye,Ae-we),b[0+K]=-1,b[0+W]=-1,b[0+B]=0,b[0+ie]=0,b[0+de]=0,je=1,f=0;f<pe;f+=re)for(S=0,qe=ce;;)if(b[S+W]>=0){c[f+y]<b[S+L]?c[f+l]<b[S+$]?le=b[S+W]:le=b[S+W]+G:c[f+l]<b[S+$]?le=b[S+W]+G*2:le=b[S+W]+G*3,b[S+ie]=(b[S+ie]*b[S+B]+c[f+y]*c[f+k])/(b[S+B]+c[f+k]),b[S+de]=(b[S+de]*b[S+B]+c[f+l]*c[f+k])/(b[S+B]+c[f+k]),b[S+B]+=c[f+k],S=le;continue}else if(b[S+z]<0){b[S+z]=f;break}else{if(b[S+W]=je*G,oe=b[S+R]/2,F=b[S+W],b[F+z]=-1,b[F+L]=b[S+L]-oe,b[F+$]=b[S+$]-oe,b[F+R]=oe,b[F+K]=F+G,b[F+W]=-1,b[F+B]=0,b[F+ie]=0,b[F+de]=0,F+=G,b[F+z]=-1,b[F+L]=b[S+L]-oe,b[F+$]=b[S+$]+oe,b[F+R]=oe,b[F+K]=F+G,b[F+W]=-1,b[F+B]=0,b[F+ie]=0,b[F+de]=0,F+=G,b[F+z]=-1,b[F+L]=b[S+L]+oe,b[F+$]=b[S+$]-oe,b[F+R]=oe,b[F+K]=F+G,b[F+W]=-1,b[F+B]=0,b[F+ie]=0,b[F+de]=0,F+=G,b[F+z]=-1,b[F+L]=b[S+L]+oe,b[F+$]=b[S+$]+oe,b[F+R]=oe,b[F+K]=b[S+K],b[F+W]=-1,b[F+B]=0,b[F+ie]=0,b[F+de]=0,je+=4,c[b[S+z]+y]<b[S+L]?c[b[S+z]+l]<b[S+$]?le=b[S+W]:le=b[S+W]+G:c[b[S+z]+l]<b[S+$]?le=b[S+W]+G*2:le=b[S+W]+G*3,b[S+B]=c[b[S+z]+k],b[S+ie]=c[b[S+z]+y],b[S+de]=c[b[S+z]+l],b[le+z]=b[S+z],b[S+z]=-1,c[f+y]<b[S+L]?c[f+l]<b[S+$]?Ne=b[S+W]:Ne=b[S+W]+G:c[f+l]<b[S+$]?Ne=b[S+W]+G*2:Ne=b[S+W]+G*3,le===Ne)if(qe--){S=le;continue}else{qe=ce;break}b[Ne+z]=f;break}}if(w.barnesHutOptimize)for(J=w.scalingRatio,f=0;f<pe;f+=re)for(S=0;;)if(b[S+W]>=0)if(U=Math.pow(c[f+y]-b[S+ie],2)+Math.pow(c[f+l]-b[S+de],2),We=b[S+R],4*We*We/U<nt){if(H=c[f+y]-b[S+ie],V=c[f+l]-b[S+de],Me===!0?U>0?(O=J*c[f+k]*b[S+B]/U,c[f+h]+=H*O,c[f+u]+=V*O):U<0&&(O=-J*c[f+k]*b[S+B]/Math.sqrt(U),c[f+h]+=H*O,c[f+u]+=V*O):U>0&&(O=J*c[f+k]*b[S+B]/U,c[f+h]+=H*O,c[f+u]+=V*O),S=b[S+K],S<0)break;continue}else{S=b[S+W];continue}else{if(ge=b[S+z],ge>=0&&ge!==f&&(H=c[f+y]-c[ge+y],V=c[f+l]-c[ge+l],U=H*H+V*V,Me===!0?U>0?(O=J*c[f+k]*c[ge+k]/U,c[f+h]+=H*O,c[f+u]+=V*O):U<0&&(O=-J*c[f+k]*c[ge+k]/Math.sqrt(U),c[f+h]+=H*O,c[f+u]+=V*O):U>0&&(O=J*c[f+k]*c[ge+k]/U,c[f+h]+=H*O,c[f+u]+=V*O)),S=b[S+K],S<0)break;continue}else for(J=w.scalingRatio,Q=0;Q<pe;Q+=re)for(ee=0;ee<Q;ee+=re)H=c[Q+y]-c[ee+y],V=c[Q+l]-c[ee+l],Me===!0?(U=Math.sqrt(H*H+V*V)-c[Q+D]-c[ee+D],U>0?(O=J*c[Q+k]*c[ee+k]/U/U,c[Q+h]+=H*O,c[Q+u]+=V*O,c[ee+h]-=H*O,c[ee+u]-=V*O):U<0&&(O=100*J*c[Q+k]*c[ee+k],c[Q+h]+=H*O,c[Q+u]+=V*O,c[ee+h]-=H*O,c[ee+u]-=V*O)):(U=Math.sqrt(H*H+V*V),U>0&&(O=J*c[Q+k]*c[ee+k]/U/U,c[Q+h]+=H*O,c[Q+u]+=V*O,c[ee+h]-=H*O,c[ee+u]-=V*O));for(F=w.gravity/w.scalingRatio,J=w.scalingRatio,f=0;f<pe;f+=re)O=0,H=c[f+y],V=c[f+l],U=Math.sqrt(Math.pow(H,2)+Math.pow(V,2)),w.strongGravityMode?U>0&&(O=J*c[f+k]*F):U>0&&(O=J*c[f+k]*F/U),c[f+h]-=H*O,c[f+u]-=V*O;for(J=1*(w.outboundAttractionDistribution?Le:1),se=0;se<rt;se+=_e)Q=X[se+C],ee=X[se+I],oe=X[se+q],me=Math.pow(oe,w.edgeWeightInfluence),H=c[Q+y]-c[ee+y],V=c[Q+l]-c[ee+l],Me===!0?(U=Math.sqrt(H*H+V*V)-c[Q+D]-c[ee+D],w.linLogMode?w.outboundAttractionDistribution?U>0&&(O=-J*me*Math.log(1+U)/U/c[Q+k]):U>0&&(O=-J*me*Math.log(1+U)/U):w.outboundAttractionDistribution?U>0&&(O=-J*me/c[Q+k]):U>0&&(O=-J*me)):(U=Math.sqrt(Math.pow(H,2)+Math.pow(V,2)),w.linLogMode?w.outboundAttractionDistribution?U>0&&(O=-J*me*Math.log(1+U)/U/c[Q+k]):U>0&&(O=-J*me*Math.log(1+U)/U):w.outboundAttractionDistribution?(U=1,O=-J*me/c[Q+k]):(U=1,O=-J*me)),U>0&&(c[Q+h]+=H*O,c[Q+u]+=V*O,c[ee+h]-=H*O,c[ee+u]-=V*O);var Oe,ve,Ue,xe,Ce,Fe;if(Me===!0)for(f=0;f<pe;f+=re)c[f+j]!==1&&(Oe=Math.sqrt(Math.pow(c[f+h],2)+Math.pow(c[f+u],2)),Oe>_&&(c[f+h]=c[f+h]*_/Oe,c[f+u]=c[f+u]*_/Oe),ve=c[f+k]*Math.sqrt((c[f+v]-c[f+h])*(c[f+v]-c[f+h])+(c[f+m]-c[f+u])*(c[f+m]-c[f+u])),Ue=Math.sqrt((c[f+v]+c[f+h])*(c[f+v]+c[f+h])+(c[f+m]+c[f+u])*(c[f+m]+c[f+u]))/2,xe=.1*Math.log(1+Ue)/(1+Math.sqrt(ve)),Ce=c[f+y]+c[f+h]*(xe/w.slowDown),c[f+y]=Ce,Fe=c[f+l]+c[f+u]*(xe/w.slowDown),c[f+l]=Fe);else for(f=0;f<pe;f+=re)c[f+j]!==1&&(ve=c[f+k]*Math.sqrt((c[f+v]-c[f+h])*(c[f+v]-c[f+h])+(c[f+m]-c[f+u])*(c[f+m]-c[f+u])),Ue=Math.sqrt((c[f+v]+c[f+h])*(c[f+v]+c[f+h])+(c[f+m]+c[f+u])*(c[f+m]+c[f+u]))/2,xe=c[f+N]*Math.log(1+Ue)/(1+Math.sqrt(ve)),c[f+N]=Math.min(1,Math.sqrt(xe*(Math.pow(c[f+h],2)+Math.pow(c[f+u],2))/(1+Math.sqrt(ve)))),Ce=c[f+y]+c[f+h]*(xe/w.slowDown),c[f+y]=Ce,Fe=c[f+l]+c[f+u]*(xe/w.slowDown),c[f+l]=Fe);return{}},dt}var ke={},At;function Fr(){if(At)return ke;At=1;var y=10,l=3;return ke.assign=function(h){h=h||{};var u=Array.prototype.slice.call(arguments).slice(1),v,m,k;for(v=0,k=u.length;v<k;v++)if(u[v])for(m in u[v])h[m]=u[v][m];return h},ke.validateSettings=function(h){return"linLogMode"in h&&typeof h.linLogMode!="boolean"?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in h&&typeof h.outboundAttractionDistribution!="boolean"?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in h&&typeof h.adjustSizes!="boolean"?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in h&&typeof h.edgeWeightInfluence!="number"?{message:"the `edgeWeightInfluence` setting should be a number."}:"scalingRatio"in h&&!(typeof h.scalingRatio=="number"&&h.scalingRatio>=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in h&&typeof h.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in h&&!(typeof h.gravity=="number"&&h.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in h&&!(typeof h.slowDown=="number"||h.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in h&&typeof h.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in h&&!(typeof h.barnesHutTheta=="number"&&h.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},ke.graphToByteArrays=function(h,u){var v=h.order,m=h.size,k={},N,D=new Float32Array(v*y),j=new Float32Array(m*l);return N=0,h.forEachNode(function(C,I){k[C]=N,D[N]=I.x,D[N+1]=I.y,D[N+2]=0,D[N+3]=0,D[N+4]=0,D[N+5]=0,D[N+6]=1,D[N+7]=1,D[N+8]=I.size||1,D[N+9]=I.fixed?1:0,N+=y}),N=0,h.forEachEdge(function(C,I,q,z,L,$,R){var K=k[q],W=k[z],B=u(C,I,q,z,L,$,R);D[K+6]+=B,D[W+6]+=B,j[N]=K,j[N+1]=W,j[N+2]=B,N+=l}),{nodes:D,edges:j}},ke.assignLayoutChanges=function(h,u,v){var m=0;h.updateEachNodeAttributes(function(k,N){return N.x=u[m],N.y=u[m+1],m+=y,v?v(k,N):N})},ke.readGraphPositions=function(h,u){var v=0;h.forEachNode(function(m,k){u[v]=k.x,u[v+1]=k.y,v+=y})},ke.collectLayoutChanges=function(h,u,v){for(var m=h.nodes(),k={},N=0,D=0,j=u.length;N<j;N+=y){if(v){var C=Object.assign({},h.getNodeAttributes(m[D]));C.x=u[N],C.y=u[N+1],C=v(m[D],C),k[m[D]]={x:C.x,y:C.y}}else k[m[D]]={x:u[N],y:u[N+1]};D++}return k},ke.createWorker=function(h){var u=window.URL||window.webkitURL,v=h.toString(),m=u.createObjectURL(new Blob(["("+v+").call(this);"],{type:"text/javascript"})),k=new Worker(m);return u.revokeObjectURL(m),k},ke}var lt,Nt;function Pr(){return Nt||(Nt=1,lt={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}),lt}var ut,Ct;function $r(){if(Ct)return ut;Ct=1;var y=Rr(),l=Or().createEdgeWeightGetter,h=Ur(),u=Fr(),v=Pr();function m(D,j,C){if(!y(j))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");typeof C=="number"&&(C={iterations:C});var I=C.iterations;if(typeof I!="number")throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(I<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var q=l("getEdgeWeight"in C?C.getEdgeWeight:"weight").fromEntry,z=typeof C.outputReducer=="function"?C.outputReducer:null,L=u.assign({},v,C.settings),$=u.validateSettings(L);if($)throw new Error("graphology-layout-forceatlas2: "+$.message);var R=u.graphToByteArrays(j,q),K;for(K=0;K<I;K++)h(L,R.nodes,R.edges);if(D){u.assignLayoutChanges(j,R.nodes,z);return}return u.collectLayoutChanges(j,R.nodes)}function k(D){var j=typeof D=="number"?D:D.order;return{barnesHutOptimize:j>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(j)}}var N=m.bind(null,!1);return N.assign=m.bind(null,!0),N.inferSettings=k,ut=N,ut}var Wr=$r();const Dt=Ot(Wr);var qr=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-content:""}}}@layer theme{:root,:host{--color-white:#fff;--spacing:.25rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-light:300;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-normal:0em;--leading-tight:1.25;--leading-snug:1.375;--radius-sm:.25rem;--ease-out:cubic-bezier(0, 0, .2, 1);--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--sans);--default-mono-font-family:var(--mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}:root{--bg:#f5f5f5;--panel:#fff;--panel2:#f0f0f0;--fg:#000;--muted:#555;--faint:#707070;--border:#e0e0e0;--border2:#bdbdbd;--row-hover:#f0f0f0;--accent:#d71921;--accent-soft:#d719210d;--link:#0050c0;--node-app:#000;--node-lib:#707070;--edge:#bdbdbd;--edge-faint:#e0e0e0;--mono:ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;--sans:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif}@media (prefers-color-scheme:dark){:root{--bg:#141414;--panel:#1c1c1c;--panel2:#242424;--fg:#fff;--muted:#b8b8b8;--faint:#8a8a8a;--border:#2e2e2e;--border2:#3e3e3e;--row-hover:#1f1f1f;--accent:#ff4d54;--accent-soft:#ff4d5414;--link:#7eb0f9;--node-app:#fff;--node-lib:#8a8a8a;--edge:#3e3e3e;--edge-faint:#2e2e2e}}html[data-theme=light]{--bg:#f5f5f5;--panel:#fff;--panel2:#f0f0f0;--fg:#000;--muted:#555;--faint:#707070;--border:#e0e0e0;--border2:#bdbdbd;--row-hover:#f0f0f0;--accent:#d71921;--accent-soft:#d719210d;--link:#0050c0;--node-app:#000;--node-lib:#707070;--edge:#bdbdbd;--edge-faint:#e0e0e0}html[data-theme=dark]{--bg:#141414;--panel:#1c1c1c;--panel2:#242424;--fg:#fff;--muted:#b8b8b8;--faint:#8a8a8a;--border:#2e2e2e;--border2:#3e3e3e;--row-hover:#1f1f1f;--accent:#ff4d54;--accent-soft:#ff4d5414;--link:#7eb0f9;--node-app:#fff;--node-lib:#8a8a8a;--edge:#3e3e3e;--edge-faint:#2e2e2e}body{background-image:radial-gradient(circle, var(--border) .5px, transparent .5px);font-feature-settings:"ss01";background-size:14px 14px}}@layer components{.tbtn-theme [data-icon=moon]{display:inline-flex}.tbtn-theme [data-icon=sun]{display:none}@media (prefers-color-scheme:dark){.tbtn-theme [data-icon=moon]{display:none}.tbtn-theme [data-icon=sun]{display:inline-flex}}html[data-theme=light] .tbtn-theme [data-icon=moon]{display:inline-flex}html[data-theme=light] .tbtn-theme [data-icon=sun],html[data-theme=dark] .tbtn-theme [data-icon=moon]{display:none}html[data-theme=dark] .tbtn-theme [data-icon=sun]{display:inline-flex}.anolilab-logo{width:auto;height:13px;fill:var(--fg)}.anolilab-accent{fill:#dfff1b}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.top-0{top:calc(var(--spacing) * 0)}.top-3{top:calc(var(--spacing) * 3)}.top-4{top:calc(var(--spacing) * 4)}.top-full{top:100%}.right-0{right:calc(var(--spacing) * 0)}.right-4{right:calc(var(--spacing) * 4)}.bottom-4{bottom:calc(var(--spacing) * 4)}.bottom-5{bottom:calc(var(--spacing) * 5)}.left-0{left:calc(var(--spacing) * 0)}.left-4{left:calc(var(--spacing) * 4)}.isolate{isolation:isolate}.z-20{z-index:20}.z-30{z-index:30}.z-\\[2\\]{z-index:2}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.m-8{margin:calc(var(--spacing) * 8)}.m-9{margin:calc(var(--spacing) * 9)}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mx-12{margin-inline:calc(var(--spacing) * 12)}.mx-\\[0\\.12em\\]{margin-inline:.12em}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-12{margin-top:calc(var(--spacing) * 12)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-10{margin-bottom:calc(var(--spacing) * 10)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-8{margin-left:calc(var(--spacing) * 8)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-\\[7px\\]{width:7px;height:7px}.h-2{height:calc(var(--spacing) * 2)}.h-5{height:calc(var(--spacing) * 5)}.h-7{height:calc(var(--spacing) * 7)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-\\[6px\\]{height:6px}.h-\\[7px\\]{height:7px}.h-\\[8px\\]{height:8px}.h-\\[10px\\]{height:10px}.h-\\[18px\\]{height:18px}.h-full{height:100%}.h-px{height:1px}.max-h-72{max-height:calc(var(--spacing) * 72)}.min-h-\\[400px\\]{min-height:400px}.min-h-\\[480px\\]{min-height:480px}.min-h-screen{min-height:100vh}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-7{width:calc(var(--spacing) * 7)}.w-9{width:calc(var(--spacing) * 9)}.w-\\[7px\\]{width:7px}.w-\\[8px\\]{width:8px}.w-full{width:100%}.w-px{width:1px}.max-w-\\[380px\\]{max-width:380px}.max-w-\\[1080px\\]{max-width:1080px}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-\\[200px\\]{min-width:200px}.min-w-\\[220px\\]{min-width:220px}.min-w-\\[260px\\]{min-width:260px}.flex-1{flex:1}.flex-\\[1_1_280px\\]{flex:280px}.flex-auto{flex:auto}.flex-none{flex:none}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-move{cursor:move}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\\[72px_1fr\\]{grid-template-columns:72px 1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-0{gap:calc(var(--spacing) * 0)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}.gap-12{gap:calc(var(--spacing) * 12)}.gap-16{gap:calc(var(--spacing) * 16)}.gap-\\[0\\.65rem\\]{gap:.65rem}.gap-\\[2px\\]{gap:2px}.gap-\\[7px\\]{gap:7px}.gap-px{gap:1px}:where(.space-y-0\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-y-1{row-gap:calc(var(--spacing) * 1)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.self-center{align-self:center}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\\[3px\\]{border-radius:3px}.rounded-\\[4px\\]{border-radius:4px}.rounded-full{border-radius:3.40282e38px}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-accent,.border-accent\\/60{border-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.border-accent\\/60{border-color:color-mix(in oklab, var(--accent) 60%, transparent)}}.border-border{border-color:var(--border)}.border-border2{border-color:var(--border2)}.border-fg{border-color:var(--fg)}.border-link{border-color:var(--link)}.bg-accent{background-color:var(--accent)}.bg-accent-soft{background-color:var(--accent-soft)}.bg-accent\\/40{background-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\\/40{background-color:color-mix(in oklab, var(--accent) 40%, transparent)}}.bg-bg,.bg-bg\\/40{background-color:var(--bg)}@supports (color:color-mix(in lab, red, red)){.bg-bg\\/40{background-color:color-mix(in oklab, var(--bg) 40%, transparent)}}.bg-border{background-color:var(--border)}.bg-border2{background-color:var(--border2)}.bg-edge{background-color:var(--edge)}.bg-edge-faint{background-color:var(--edge-faint)}.bg-fg{background-color:var(--fg)}.bg-node-app{background-color:var(--node-app)}.bg-node-lib{background-color:var(--node-lib)}.bg-panel,.bg-panel\\/95{background-color:var(--panel)}@supports (color:color-mix(in lab, red, red)){.bg-panel\\/95{background-color:color-mix(in oklab, var(--panel) 95%, transparent)}}.bg-panel2{background-color:var(--panel2)}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-0\\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.px-12{padding-inline:calc(var(--spacing) * 12)}.px-\\[5px\\]{padding-inline:5px}.px-\\[6px\\]{padding-inline:6px}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-16{padding-block:calc(var(--spacing) * 16)}.py-\\[3px\\]{padding-block:3px}.py-px{padding-block:1px}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pt-7{padding-top:calc(var(--spacing) * 7)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pt-12{padding-top:calc(var(--spacing) * 12)}.pr-0{padding-right:calc(var(--spacing) * 0)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-6{padding-right:calc(var(--spacing) * 6)}.pr-1234{padding-right:calc(var(--spacing) * 1234)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-1\\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pb-8{padding-bottom:calc(var(--spacing) * 8)}.pb-12{padding-bottom:calc(var(--spacing) * 12)}.pl-0{padding-left:calc(var(--spacing) * 0)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-\\[7px\\]{padding-left:7px}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:var(--mono)}.font-sans{font-family:var(--sans)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-\\[9px\\]{font-size:9px}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.text-\\[14px\\]{font-size:14px}.text-\\[15px\\]{font-size:15px}.text-\\[22px\\]{font-size:22px}.text-\\[28px\\]{font-size:28px}.text-\\[44px\\]{font-size:44px}.text-\\[72px\\]{font-size:72px}.text-\\[clamp\\(28px\\,5vw\\,52px\\)\\]{font-size:clamp(28px,5vw,52px)}.leading-\\[0\\.9\\]{--tw-leading:.9;line-height:.9}.leading-none{--tw-leading:1;line-height:1}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\\[-0\\.02em\\]{--tw-tracking:-.02em;letter-spacing:-.02em}.tracking-\\[0\\.1em\\]{--tw-tracking:.1em;letter-spacing:.1em}.tracking-\\[0\\.05em\\]{--tw-tracking:.05em;letter-spacing:.05em}.tracking-\\[0\\.08em\\]{--tw-tracking:.08em;letter-spacing:.08em}.tracking-\\[0\\.11em\\]{--tw-tracking:.11em;letter-spacing:.11em}.tracking-\\[0\\.12em\\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\\[0\\.15em\\]{--tw-tracking:.15em;letter-spacing:.15em}.tracking-\\[0\\.16em\\]{--tw-tracking:.16em;letter-spacing:.16em}.tracking-\\[0\\.22em\\]{--tw-tracking:.22em;letter-spacing:.22em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.text-accent{color:var(--accent)}.text-bg{color:var(--bg)}.text-faint{color:var(--faint)}.text-fg{color:var(--fg)}.text-link{color:var(--link)}.text-muted{color:var(--muted)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.no-underline{text-decoration-line:none}.opacity-40{opacity:.4}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\\[0_4px_12px_rgba\\(0\\,0\\,0\\,0\\.08\\)\\]{--tw-shadow:0 4px 12px var(--tw-shadow-color,#00000014);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\\[0_8px_24px_rgba\\(0\\,0\\,0\\,0\\.12\\)\\]{--tw-shadow:0 8px 24px var(--tw-shadow-color,#0000001f);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-0{outline-style:var(--tw-outline-style);outline-width:0}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.select-none{-webkit-user-select:none;user-select:none}.\\[notifications\\:\\<id\\>\\]{notifications:<id>}.\\[notifications\\:slack\\]{notifications:slack}.\\[notifications\\:teams\\]{notifications:teams}.\\[verdaccio\\:dry-run\\]{verdaccio:dry-run}.group-data-\\[state\\=off\\]\\:opacity-30:is(:where(.group)[data-state=off] *){opacity:.3}.placeholder\\:text-faint::placeholder{color:var(--faint)}.before\\:absolute:before{content:var(--tw-content);position:absolute}.before\\:left-0:before{content:var(--tw-content);left:calc(var(--spacing) * 0)}.before\\:text-faint:before{content:var(--tw-content);color:var(--faint)}.before\\:content-\\[\\'→\\'\\]:before{--tw-content:"→";content:var(--tw-content)}.after\\:ml-auto:after{content:var(--tw-content);margin-left:auto}.after\\:font-mono:after{content:var(--tw-content);font-family:var(--mono)}.after\\:text-\\[9px\\]:after{content:var(--tw-content);font-size:9px}.after\\:tracking-\\[0\\.1em\\]:after{content:var(--tw-content);--tw-tracking:.1em;letter-spacing:.1em}.after\\:text-accent:after{content:var(--tw-content);color:var(--accent)}.after\\:content-\\[\\'ON\\'\\]:after{--tw-content:"ON";content:var(--tw-content)}.last\\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.focus-within\\:border-fg:focus-within{border-color:var(--fg)}@media (hover:hover){.hover\\:border-fg:hover{border-color:var(--fg)}.hover\\:bg-accent:hover{background-color:var(--accent)}.hover\\:bg-row-hover:hover{background-color:var(--row-hover)}.hover\\:text-accent:hover{color:var(--accent)}.hover\\:text-fg:hover{color:var(--fg)}.hover\\:text-white:hover{color:var(--color-white)}.hover\\:opacity-90:hover{opacity:.9}}.focus-visible\\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\\:ring-fg:focus-visible{--tw-ring-color:var(--fg)}.focus-visible\\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:opacity-40:disabled{opacity:.4}.aria-selected\\:bg-row-hover[aria-selected=true]{background-color:var(--row-hover)}.data-\\[open\\=false\\]\\:hidden[data-open=false]{display:none}.data-\\[pinned\\=true\\]\\:pointer-events-auto[data-pinned=true]{pointer-events:auto}.data-\\[pinned\\=true\\]\\:border-accent[data-pinned=true]{border-color:var(--accent)}.data-\\[state\\=off\\]\\:text-faint[data-state=off]{color:var(--faint)}.data-\\[state\\=off\\]\\:line-through[data-state=off]{text-decoration-line:line-through}.data-\\[state\\=off\\]\\:after\\:text-faint[data-state=off]:after{content:var(--tw-content);color:var(--faint)}.data-\\[state\\=off\\]\\:after\\:content-\\[\\'OFF\\'\\][data-state=off]:after{--tw-content:"OFF";content:var(--tw-content)}.data-\\[state\\=selected\\]\\:bg-row-hover[data-state=selected]{background-color:var(--row-hover)}.data-\\[state\\=zero\\]\\:text-accent[data-state=zero]{color:var(--accent)}@media (min-width:40rem){.sm\\:min-w-\\[320px\\]{min-width:320px}}@media (min-width:48rem){.md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\\:grid-cols-\\[1\\.4fr_1fr\\]{grid-template-columns:1.4fr 1fr}}.\\[\\&_svg\\]\\:size-\\[14px\\] svg{width:14px;height:14px}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}.\\[\\&_tr\\]\\:border-b-0 tr{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.\\[\\&\\>\\*\\+\\*\\]\\:ml-6>*+*{margin-left:calc(var(--spacing) * 6)}.\\[\\&\\>\\*\\+\\*\\]\\:border-l>*+*{border-left-style:var(--tw-border-style);border-left-width:1px}.\\[\\&\\>\\*\\+\\*\\]\\:border-border>*+*{border-color:var(--border)}.\\[\\&\\>\\*\\+\\*\\]\\:pl-6>*+*{padding-left:calc(var(--spacing) * 6)}.\\[\\&\\>td\\]\\:border-b>td{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\\[\\&\\>td\\]\\:border-border>td{border-color:var(--border)}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}`;const Br=qr,Hr=Er(import.meta.url),tt=(y,l)=>{const h=Hr.resolve(y);return xr(Gr(_r(h),l),"utf8")},Vr=tt("sigma","sigma.min.js"),Kr=tt("graphology","graphology.umd.min.js"),Yr=tt("@floating-ui/core","floating-ui.core.umd.min.js"),Xr=tt("@floating-ui/dom","floating-ui.dom.umd.min.js"),Qr='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>',Jr='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32 1.41 1.41M2 12h2m16 0h2M4.93 19.07l1.41-1.41m11.32-11.32 1.41-1.41"/></svg>',Ee=y=>y.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;"),Zr=9,en=4,tn=(y,l)=>{if(y.length===0)return[];const h=new zr({multi:!0,type:"directed"});for(const m of y){const k=h.order/y.length*Math.PI*2;h.addNode(m.name,{path:m.path,size:m.type==="application"?Zr:en,type:m.type,x:Math.cos(k),y:Math.sin(k)})}for(const m of l)h.hasNode(m.source)&&h.hasNode(m.target)&&h.addEdge(m.source,m.target,{type:m.type});const u=Dt.inferSettings(h);Dt.assign(h,{iterations:600,settings:{...u,adjustSizes:!0,barnesHutOptimize:h.order>100,gravity:1.2,linLogMode:!0,scalingRatio:8,slowDown:4}});const v=[];return h.forEachNode((m,k)=>{v.push({name:m,path:k.path,size:k.size,type:k.type,x:k.x,y:k.y})}),v},rn=y=>{const l=y.now??new Date,h=y.nodes.filter(C=>C.type==="application").length,u=y.nodes.length-h,v=tn(y.nodes,y.edges),m=new Set(v.map(C=>C.name)),k=y.edges.filter(C=>m.has(C.source)&&m.has(C.target)),N={edges:k,nodes:v},D=y.nodes.length===0,j={chip:"font-mono tracking-[0.08em] text-muted border border-border2 inline-flex h-7 items-center justify-center rounded-[4px] px-3 text-[11px] font-medium uppercase",dvNum:"font-mono text-[22px] font-medium text-fg leading-none",labelMono:"font-mono text-[10px] uppercase tracking-[0.15em] text-faint"};return`<!doctype html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
7
+ <title>${Ee(y.tool.name)} graph · ${Ee(l.toISOString().slice(0,10))}</title>
8
+ <style>${Br}</style>
9
+ </head>
10
+ <body class="bg-bg text-fg">
11
+ <div class="min-h-screen flex flex-col">
12
+ <header class="flex flex-wrap items-end gap-4 px-8 pt-8 pb-5">
13
+ <div class="font-sans text-[clamp(28px,5vw,52px)] font-semibold text-fg leading-none tracking-tight">${(()=>{const[C,...I]=y.tool.name.split("-");return I.length>0?`${Ee(C??y.tool.name)}<span class="text-accent mx-[0.12em] font-light">/</span>${Ee(I.join("-"))}`:Ee(y.tool.name)})()}<span class="font-mono tracking-[0.22em] text-faint mt-3 block text-[10px] font-medium uppercase">dependency graph</span></div>
14
+ <span class="flex-auto"></span>
15
+ <span class="${j.chip}">v${Ee(y.tool.version)}</span>
16
+ <button id="theme" class="tbtn-theme font-mono text-muted border border-border2 inline-flex h-7 w-9 cursor-pointer items-center justify-center rounded-[4px] bg-transparent transition-colors duration-150 hover:text-fg hover:border-fg" type="button" aria-label="Toggle color theme" title="Toggle color theme"><span data-icon="moon" class="items-center justify-center">${Qr}</span><span data-icon="sun" class="items-center justify-center">${Jr}</span></button>
17
+ </header>
18
+ <div class="flex flex-wrap items-end gap-6 px-8 pt-5 pb-5 border-b border-border">
19
+ <div class="flex flex-wrap items-stretch gap-0 [&>*+*]:pl-6 [&>*+*]:ml-6 [&>*+*]:border-l [&>*+*]:border-border">
20
+ <div class="flex items-baseline gap-[0.65rem]"><span class="${j.labelMono}">apps</span><span class="${j.dvNum}">${String(h)}</span></div>
21
+ <div class="flex items-baseline gap-[0.65rem]"><span class="${j.labelMono}">libraries</span><span class="${j.dvNum}">${String(u)}</span></div>
22
+ <div class="flex items-baseline gap-[0.65rem]"><span class="${j.labelMono}">dependencies</span><span class="${j.dvNum}">${String(k.length)}</span></div>
23
+ </div>
24
+ <span class="flex-auto"></span>
25
+ <div class="relative min-w-[260px] sm:min-w-[320px] ml-auto">
26
+ <label class="flex items-center gap-3 border-b border-border2 transition-colors duration-150 hover:border-fg focus-within:border-fg pb-1.5">
27
+ <span class="${j.labelMono} select-none">find:</span>
28
+ <input id="filter" type="search" class="w-full min-w-0 border-0 bg-transparent py-0.5 text-fg text-[12px] font-mono outline-0 placeholder:text-faint" placeholder="package name…" aria-label="Filter packages" autocomplete="off" spellcheck="false" />
29
+ <span id="filter-count" data-state="" class="font-mono text-faint text-[10px] tracking-[0.05em] shrink-0 select-none data-[state=zero]:text-accent" aria-live="polite"></span>
30
+ </label>
31
+ <div id="filter-results" data-open="false" class="data-[open=false]:hidden absolute z-20 top-full left-0 right-0 mt-2 bg-panel border border-border max-h-72 overflow-y-auto shadow-[0_4px_12px_rgba(0,0,0,0.08)]" role="listbox" aria-label="Matching packages"></div>
32
+ </div>
33
+ </div>
34
+ <main class="relative flex-1 min-h-[480px]">${D?'<div class="flex flex-col items-center justify-center min-h-[400px] gap-4 text-center"><div class="font-sans text-[72px] font-semibold text-fg leading-none tracking-tight">NONE</div><div class="font-mono text-faint text-[12px] uppercase tracking-[0.15em]">No projects discovered in this workspace.</div></div>':`<div id="graph" class="absolute inset-0"></div>
35
+ <div id="tooltip" data-pinned="false" class="fixed z-30 top-0 left-0 hidden bg-panel border border-border2 px-4 py-3 max-w-[380px] pointer-events-none font-sans shadow-[0_8px_24px_rgba(0,0,0,0.12)] data-[pinned=true]:pointer-events-auto data-[pinned=true]:border-accent"></div>
36
+ <div id="legend" class="absolute top-4 right-4 bg-panel/95 backdrop-blur-sm border border-border px-4 py-3 min-w-[200px]">
37
+ <div class="${j.labelMono} mb-2">Filter</div>
38
+ <div data-toggle="app" data-state="on" class="group flex items-center gap-3 py-1 cursor-pointer text-[12px] text-fg select-none transition-colors hover:text-accent data-[state=off]:line-through data-[state=off]:text-faint after:content-['ON'] after:font-mono after:text-[9px] after:tracking-[0.1em] after:ml-auto after:text-accent data-[state=off]:after:content-['OFF'] data-[state=off]:after:text-faint" role="switch" aria-checked="true" tabindex="0"><span class="inline-block w-2 h-2 rounded-full bg-node-app shrink-0 group-data-[state=off]:opacity-30"></span>Application</div>
39
+ <div data-toggle="lib" data-state="on" class="group flex items-center gap-3 py-1 cursor-pointer text-[12px] text-fg select-none transition-colors hover:text-accent data-[state=off]:line-through data-[state=off]:text-faint after:content-['ON'] after:font-mono after:text-[9px] after:tracking-[0.1em] after:ml-auto after:text-accent data-[state=off]:after:content-['OFF'] data-[state=off]:after:text-faint" role="switch" aria-checked="true" tabindex="0"><span class="inline-block w-2 h-2 rounded-full bg-node-lib shrink-0 group-data-[state=off]:opacity-30"></span>Library</div>
40
+ <div data-toggle="prod" data-state="on" class="group flex items-center gap-3 py-1 cursor-pointer text-[12px] text-fg select-none transition-colors hover:text-accent data-[state=off]:line-through data-[state=off]:text-faint after:content-['ON'] after:font-mono after:text-[9px] after:tracking-[0.1em] after:ml-auto after:text-accent data-[state=off]:after:content-['OFF'] data-[state=off]:after:text-faint" role="switch" aria-checked="true" tabindex="0"><span class="inline-block w-4 h-px bg-edge shrink-0 group-data-[state=off]:opacity-30"></span>Static dep</div>
41
+ <div data-toggle="dev" data-state="on" class="group flex items-center gap-3 py-1 cursor-pointer text-[12px] text-fg select-none transition-colors hover:text-accent data-[state=off]:line-through data-[state=off]:text-faint after:content-['ON'] after:font-mono after:text-[9px] after:tracking-[0.1em] after:ml-auto after:text-accent data-[state=off]:after:content-['OFF'] data-[state=off]:after:text-faint" role="switch" aria-checked="true" tabindex="0"><span class="inline-block w-4 h-px bg-edge-faint shrink-0 group-data-[state=off]:opacity-30"></span>Dev / implicit</div>
42
+ <div data-toggle="peer" data-state="on" class="group flex items-center gap-3 py-1 cursor-pointer text-[12px] text-fg select-none transition-colors hover:text-accent data-[state=off]:line-through data-[state=off]:text-faint after:content-['ON'] after:font-mono after:text-[9px] after:tracking-[0.1em] after:ml-auto after:text-accent data-[state=off]:after:content-['OFF'] data-[state=off]:after:text-faint" role="switch" aria-checked="true" tabindex="0"><span class="inline-block w-4 h-px bg-accent shrink-0 group-data-[state=off]:opacity-30"></span>Peer</div>
43
+ </div>
44
+ <div class="absolute bottom-4 left-4 flex flex-wrap items-center gap-x-6 gap-y-2 bg-panel/95 backdrop-blur-sm border border-border px-4 py-2 font-mono text-[10px] uppercase tracking-[0.15em] text-faint">
45
+ <div class="flex items-center gap-2"><span class="inline-flex h-5 min-w-5 items-center justify-center px-1.5 border border-border2 rounded text-fg bg-panel2 normal-case tracking-normal text-[10px]">/</span><span>Search</span></div>
46
+ <div class="flex items-center gap-2"><span class="inline-flex h-5 min-w-5 items-center justify-center px-1.5 border border-border2 rounded text-fg bg-panel2 normal-case tracking-normal text-[10px]">R</span><span>Fit view</span></div>
47
+ <div class="flex items-center gap-2"><span class="inline-flex h-5 min-w-5 items-center justify-center px-1.5 border border-border2 rounded text-fg bg-panel2 normal-case tracking-normal text-[10px]">Click</span><span>Pin · click empty to unpin</span></div>
48
+ </div>`}</main>
49
+ <footer class="flex flex-wrap items-center justify-between gap-x-6 gap-y-3 px-8 py-4 text-[10px] uppercase border-t border-border font-mono text-faint tracking-[0.1em]">
50
+ <span><b class="text-fg font-semibold">${Ee(y.tool.name)}</b> ${Ee(y.tool.version)} · generated ${Ee(l.toISOString())}</span>
51
+ <span class="inline-flex items-center gap-2"><span>built by</span><a class="sig-by-link inline-flex items-center" href="https://anolilab.com" rel="noreferrer noopener" target="_blank" aria-label="Anolilab">${Sr}</a></span>
52
+ </footer>
53
+ </div>
54
+ <script>${Kr}<\/script>
55
+ <script>${Vr}<\/script>
56
+ <script>${Yr}<\/script>
57
+ <script>${Xr}<\/script>
58
+ <script>
59
+ (() => {
60
+ const root = document.documentElement;
61
+ const themeBtn = document.getElementById('theme');
62
+ const mql = window.matchMedia('(prefers-color-scheme: dark)');
63
+
64
+ try {
65
+ const stored = localStorage.getItem('vis-graph-theme');
66
+ if (stored === 'light' || stored === 'dark') {
67
+ root.dataset.theme = stored;
68
+ }
69
+ } catch {}
70
+
71
+ const data = ${JSON.stringify(N).replaceAll("</",String.raw`<\/`)};
72
+ if (!data.nodes.length || !window.graphology || !window.Sigma) {
73
+ return;
74
+ }
75
+
76
+ // Reusable Tailwind utility-class strings for dynamically-created elements.
77
+ // Inline-everywhere is the system of record; these strings only exist
78
+ // because the JS DOM API can't read Tailwind from the markup.
79
+ const CLS = {
80
+ ttlName: 'font-sans text-fg text-[13px] font-semibold leading-tight mb-1 break-words',
81
+ ttlType: 'font-mono text-faint text-[10px] uppercase tracking-[0.15em]',
82
+ ttlPath: 'font-mono text-muted text-[10px] mt-2 break-all',
83
+ ttlSection: 'font-mono text-faint text-[10px] uppercase tracking-[0.15em] mt-3 mb-1',
84
+ ttlEmpty: 'font-mono text-faint text-[10px] italic mt-2',
85
+ ttlMore: 'font-mono text-faint text-[10px] italic pl-3 mt-1',
86
+ ttlUl: 'mt-1 space-y-0.5',
87
+ ttlLi: "font-mono text-fg text-[11px] leading-snug pl-3 relative before:content-['→'] before:text-faint before:absolute before:left-0",
88
+ matchItem: 'flex items-center justify-between gap-3 px-3 py-2 cursor-pointer text-[12px] hover:bg-row-hover aria-selected:bg-row-hover',
89
+ miName: 'font-sans text-fg truncate',
90
+ miMark: 'bg-accent-soft text-accent rounded-sm px-0.5',
91
+ miKind: 'font-mono text-faint text-[10px] uppercase tracking-[0.15em] shrink-0',
92
+ matchEmpty: 'font-mono text-faint text-[10px] uppercase tracking-[0.15em] px-3 py-3',
93
+ };
94
+
95
+ // Read live colors from the rendered CSS so theme switches stay in one
96
+ // place: change vars → call sigma.refresh() and node/edge colors update.
97
+ const css = () => {
98
+ const s = getComputedStyle(root);
99
+ return {
100
+ app: s.getPropertyValue('--node-app').trim(),
101
+ lib: s.getPropertyValue('--node-lib').trim(),
102
+ edge: s.getPropertyValue('--edge').trim(),
103
+ edgeFaint: s.getPropertyValue('--edge-faint').trim(),
104
+ accent: s.getPropertyValue('--accent').trim(),
105
+ fg: s.getPropertyValue('--fg').trim(),
106
+ muted: s.getPropertyValue('--muted').trim(),
107
+ };
108
+ };
109
+
110
+ let theme = css();
111
+
112
+ const Graph = window.graphology.Graph || window.graphology;
113
+ const graph = new Graph({ multi: true, type: 'directed' });
114
+
115
+ const colorForNode = (type) => type === 'application' ? theme.app : theme.lib;
116
+ const colorForEdge = (type) => {
117
+ if (type === 'peerDependency') return theme.accent;
118
+ if (type === 'devDependency' || type === 'implicit') return theme.edgeFaint;
119
+ return theme.edge;
120
+ };
121
+
122
+ // Attribute is named "kind", not "type": sigma reads node.type as its
123
+ // program-class name and bails when it sees "application" / "library".
124
+ for (const n of data.nodes) {
125
+ graph.addNode(n.name, {
126
+ x: n.x,
127
+ y: n.y,
128
+ size: n.size,
129
+ label: n.name,
130
+ kind: n.type,
131
+ path: n.path,
132
+ color: colorForNode(n.type),
133
+ });
134
+ }
135
+
136
+ for (const e of data.edges) {
137
+ graph.addEdge(e.source, e.target, {
138
+ color: colorForEdge(e.type),
139
+ depType: e.type,
140
+ size: 1,
141
+ });
142
+ }
143
+
144
+ // Adjacency for tooltip & hover-emphasis.
145
+ const depMap = {}, rdepMap = {};
146
+ for (const n of data.nodes) { depMap[n.name] = []; rdepMap[n.name] = []; }
147
+ for (const e of data.edges) {
148
+ depMap[e.source].push(e.target);
149
+ rdepMap[e.target].push(e.source);
150
+ }
151
+
152
+ const container = document.getElementById('graph');
153
+ const tooltip = document.getElementById('tooltip');
154
+ const filterInput = document.getElementById('filter');
155
+ const filterCount = document.getElementById('filter-count');
156
+ const filterResults = document.getElementById('filter-results');
157
+
158
+ const renderer = new window.Sigma(graph, container, {
159
+ renderEdgeLabels: false,
160
+ labelColor: { color: theme.fg },
161
+ labelFont: 'system-ui, -apple-system, sans-serif',
162
+ labelSize: 11,
163
+ labelWeight: '500',
164
+ labelDensity: 0.7,
165
+ labelGridCellSize: 80,
166
+ defaultEdgeColor: theme.edge,
167
+ defaultNodeColor: theme.lib,
168
+ defaultEdgeType: 'arrow',
169
+ minCameraRatio: 0.05,
170
+ maxCameraRatio: 8,
171
+ // Suppress sigma's built-in hover label panel. We render our own tooltip,
172
+ // so its empty label box (the small rectangle near the cursor) is noise.
173
+ defaultDrawNodeHover: () => undefined,
174
+ });
175
+
176
+ // State: hover follows the mouse, focus is sticky (set by clicking a node
177
+ // or selecting a search result), pin keeps the tooltip locked in place.
178
+ let hoveredNode = null;
179
+ let focusedNode = null;
180
+ let pinned = false;
181
+ let filterTerm = '';
182
+ let matches = [];
183
+ let activeMatchIndex = -1;
184
+
185
+ // Legend filter state: each key toggles the visibility of a category.
186
+ // previewCategory is set transiently while hovering a legend row so the
187
+ // user can sneak-peek which lines/nodes belong to that category without
188
+ // committing to a toggle.
189
+ const visible = { app: true, lib: true, prod: true, dev: true, peer: true };
190
+ let previewCategory = null;
191
+ const isNodeCat = (k) => k === 'app' || k === 'lib';
192
+ const isEdgeCat = (k) => k === 'prod' || k === 'dev' || k === 'peer';
193
+ const edgeCategory = (depType) => {
194
+ if (depType === 'peerDependency') return 'peer';
195
+ if (depType === 'devDependency' || depType === 'implicit') return 'dev';
196
+ return 'prod';
197
+ };
198
+ const nodeVisible = (kind) => visible[kind === 'application' ? 'app' : 'lib'];
199
+
200
+ const activeNode = () => focusedNode || hoveredNode;
201
+
202
+ renderer.setSetting('nodeReducer', (node, attrs) => {
203
+ if (!nodeVisible(attrs.kind)) {
204
+ return { ...attrs, hidden: true, label: '' };
205
+ }
206
+ // Legend-row preview takes precedence over normal focus/hover emphasis:
207
+ // hovering a category gives an unambiguous "show me what's in this set".
208
+ if (previewCategory) {
209
+ const nodeCat = attrs.kind === 'application' ? 'app' : 'lib';
210
+ const inPreview = isNodeCat(previewCategory) ? nodeCat === previewCategory : false;
211
+ return {
212
+ ...attrs,
213
+ color: inPreview ? attrs.color : theme.edgeFaint,
214
+ label: inPreview ? attrs.label : '',
215
+ zIndex: inPreview ? 1 : 0,
216
+ };
217
+ }
218
+ const active = activeNode();
219
+ const matchedFilter = !filterTerm || node.toLowerCase().includes(filterTerm);
220
+ const isActive = active === node;
221
+ const isRelated = active && (depMap[active]?.includes(node) || rdepMap[active]?.includes(node));
222
+ const dim = (filterTerm && !matchedFilter) || (active && !isActive && !isRelated);
223
+ return {
224
+ ...attrs,
225
+ color: isActive ? theme.accent : attrs.color,
226
+ label: dim ? '' : attrs.label,
227
+ zIndex: isActive ? 2 : isRelated ? 1 : 0,
228
+ };
229
+ });
230
+
231
+ renderer.setSetting('edgeReducer', (edge, attrs) => {
232
+ if (!visible[edgeCategory(attrs.depType)]) {
233
+ return { ...attrs, hidden: true };
234
+ }
235
+ const ext = graph.extremities(edge);
236
+ if (!nodeVisible(graph.getNodeAttribute(ext[0], 'kind')) || !nodeVisible(graph.getNodeAttribute(ext[1], 'kind'))) {
237
+ return { ...attrs, hidden: true };
238
+ }
239
+ if (previewCategory) {
240
+ if (isEdgeCat(previewCategory)) {
241
+ const inPreview = edgeCategory(attrs.depType) === previewCategory;
242
+ return { ...attrs, color: inPreview ? theme.accent : theme.edgeFaint, size: inPreview ? 1.5 : 0.3, zIndex: inPreview ? 1 : 0 };
243
+ }
244
+ // Previewing a node category dims every edge — the focus is on the dots.
245
+ return { ...attrs, color: theme.edgeFaint, size: 0.3 };
246
+ }
247
+ const active = activeNode();
248
+ const touchesActive = active && (ext[0] === active || ext[1] === active);
249
+ if (active && !touchesActive) {
250
+ return { ...attrs, color: theme.edgeFaint, hidden: false, size: 0.5 };
251
+ }
252
+ if (touchesActive) {
253
+ return { ...attrs, color: theme.accent, size: 1.5, zIndex: 1 };
254
+ }
255
+ return attrs;
256
+ });
257
+
258
+ // Tooltip body assembled with safe DOM methods (createElement +
259
+ // textContent) — no innerHTML, no template strings of user data.
260
+ const MAX_TOOLTIP_ITEMS = 8;
261
+ const setTooltipContent = (name) => {
262
+ const node = graph.getNodeAttributes(name);
263
+ const deps = depMap[name] || [];
264
+ const rdeps = rdepMap[name] || [];
265
+ tooltip.textContent = '';
266
+
267
+ const nameEl = document.createElement('div');
268
+ nameEl.className = CLS.ttlName;
269
+ nameEl.textContent = name;
270
+ tooltip.appendChild(nameEl);
271
+
272
+ const typeEl = document.createElement('div');
273
+ typeEl.className = CLS.ttlType;
274
+ typeEl.textContent = node.kind + (pinned ? ' · pinned' : '');
275
+ tooltip.appendChild(typeEl);
276
+
277
+ if (node.path) {
278
+ const pathEl = document.createElement('div');
279
+ pathEl.className = CLS.ttlPath;
280
+ pathEl.textContent = node.path;
281
+ tooltip.appendChild(pathEl);
282
+ }
283
+
284
+ const addSection = (label, items) => {
285
+ const heading = document.createElement('div');
286
+ heading.className = CLS.ttlSection;
287
+ heading.textContent = label + ' (' + items.length + ')';
288
+ tooltip.appendChild(heading);
289
+ const ul = document.createElement('ul');
290
+ ul.className = CLS.ttlUl;
291
+ const shown = items.slice(0, MAX_TOOLTIP_ITEMS);
292
+ for (const item of shown) {
293
+ const li = document.createElement('li');
294
+ li.className = CLS.ttlLi;
295
+ li.textContent = item;
296
+ ul.appendChild(li);
297
+ }
298
+ if (items.length > MAX_TOOLTIP_ITEMS) {
299
+ const more = document.createElement('li');
300
+ more.className = CLS.ttlMore;
301
+ more.textContent = (items.length - MAX_TOOLTIP_ITEMS) + ' more';
302
+ ul.appendChild(more);
303
+ }
304
+ tooltip.appendChild(ul);
305
+ };
306
+
307
+ if (deps.length) addSection('Depends on', deps);
308
+ if (rdeps.length) addSection('Required by', rdeps);
309
+ if (!deps.length && !rdeps.length) {
310
+ const empty = document.createElement('div');
311
+ empty.className = CLS.ttlEmpty;
312
+ empty.textContent = 'No dependencies';
313
+ tooltip.appendChild(empty);
314
+ }
315
+ };
316
+
317
+ // Tooltip placement delegated to Floating UI. We build a virtual reference
318
+ // element that either follows the cursor (hover) or anchors to a node's
319
+ // viewport position (pinned), then run computePosition with flip + shift +
320
+ // size middleware so the tooltip always fits the viewport.
321
+ const FUI = window.FloatingUIDOM;
322
+ let lastMouse = null;
323
+ let anchorMode = 'cursor'; // 'cursor' (follows mouse) or 'node' (sticky to node)
324
+ let anchorNode = null;
325
+ let cleanupAutoUpdate = null;
326
+
327
+ const cursorRef = {
328
+ getBoundingClientRect() {
329
+ const x = lastMouse ? lastMouse.clientX : 0;
330
+ const y = lastMouse ? lastMouse.clientY : 0;
331
+ return { width: 0, height: 0, x, y, top: y, left: x, right: x, bottom: y };
332
+ },
333
+ };
334
+
335
+ const nodeRef = {
336
+ getBoundingClientRect() {
337
+ if (!anchorNode || !graph.hasNode(anchorNode)) {
338
+ return { width: 0, height: 0, x: 0, y: 0, top: 0, left: 0, right: 0, bottom: 0 };
339
+ }
340
+ const pos = renderer.getNodeDisplayData(anchorNode);
341
+ const vp = renderer.graphToViewport({ x: pos.x, y: pos.y });
342
+ const rect = container.getBoundingClientRect();
343
+ const r = (pos.size || 4) + 4;
344
+ const cx = rect.left + vp.x;
345
+ const cy = rect.top + vp.y;
346
+ return { width: r * 2, height: r * 2, x: cx - r, y: cy - r, top: cy - r, left: cx - r, right: cx + r, bottom: cy + r };
347
+ },
348
+ };
349
+
350
+ const updatePosition = async () => {
351
+ if (tooltip.style.display !== 'block') return;
352
+ const ref = anchorMode === 'node' ? nodeRef : cursorRef;
353
+ const { x, y } = await FUI.computePosition(ref, tooltip, {
354
+ placement: 'right-start',
355
+ strategy: 'fixed',
356
+ middleware: [
357
+ FUI.offset(12),
358
+ FUI.flip({ fallbackPlacements: ['left-start', 'right-end', 'left-end', 'top', 'bottom'] }),
359
+ FUI.shift({ padding: 12 }),
360
+ FUI.size({
361
+ padding: 12,
362
+ apply({ availableWidth, availableHeight, elements }) {
363
+ const maxW = Math.min(380, Math.max(220, availableWidth));
364
+ const maxH = Math.max(160, availableHeight);
365
+ Object.assign(elements.floating.style, {
366
+ maxWidth: maxW + 'px',
367
+ maxHeight: maxH + 'px',
368
+ overflowY: 'auto',
369
+ });
370
+ },
371
+ }),
372
+ ],
373
+ });
374
+ Object.assign(tooltip.style, { left: x + 'px', top: y + 'px' });
375
+ };
376
+
377
+ const stopAutoUpdate = () => {
378
+ if (cleanupAutoUpdate) { cleanupAutoUpdate(); cleanupAutoUpdate = null; }
379
+ };
380
+
381
+ // Auto-update is only used for the node-anchored (pinned) mode, where the
382
+ // reference is stable across events but its viewport position changes when
383
+ // the user pans, zooms, or resizes. In cursor mode we drive recomputation
384
+ // ourselves from the mousemove handler.
385
+ const startAutoUpdate = () => {
386
+ stopAutoUpdate();
387
+ if (anchorMode === 'node') {
388
+ cleanupAutoUpdate = FUI.autoUpdate(nodeRef, tooltip, updatePosition);
389
+ }
390
+ };
391
+
392
+ const showTooltipFor = (name, mode = 'cursor') => {
393
+ anchorMode = mode;
394
+ anchorNode = mode === 'node' ? name : null;
395
+ setTooltipContent(name);
396
+ tooltip.style.display = 'block';
397
+ startAutoUpdate();
398
+ updatePosition();
399
+ };
400
+
401
+ const hideTooltip = () => {
402
+ stopAutoUpdate();
403
+ tooltip.style.display = 'none';
404
+ tooltip.dataset.pinned = 'false';
405
+ anchorNode = null;
406
+ };
407
+
408
+ renderer.on('enterNode', (e) => {
409
+ hoveredNode = e.node;
410
+ if (!pinned) showTooltipFor(e.node, 'cursor');
411
+ renderer.refresh({ skipIndexation: true });
412
+ });
413
+
414
+ renderer.on('leaveNode', () => {
415
+ hoveredNode = null;
416
+ if (!pinned) hideTooltip();
417
+ renderer.refresh({ skipIndexation: true });
418
+ });
419
+
420
+ // Click a node to pin it; the anchor switches from the cursor to the node
421
+ // so the tooltip stays attached even when the mouse moves away.
422
+ renderer.on('clickNode', (e) => {
423
+ focusedNode = e.node;
424
+ pinned = true;
425
+ tooltip.dataset.pinned = 'true';
426
+ showTooltipFor(e.node, 'node');
427
+ renderer.refresh({ skipIndexation: true });
428
+ });
429
+
430
+ renderer.on('clickStage', () => {
431
+ if (pinned || focusedNode) {
432
+ focusedNode = null;
433
+ pinned = false;
434
+ tooltip.dataset.pinned = 'false';
435
+ if (hoveredNode) {
436
+ showTooltipFor(hoveredNode, 'cursor');
437
+ } else {
438
+ hideTooltip();
439
+ }
440
+ renderer.refresh({ skipIndexation: true });
441
+ }
442
+ });
443
+
444
+ let posRafQueued = false;
445
+ container.addEventListener('mousemove', (e) => {
446
+ lastMouse = { clientX: e.clientX, clientY: e.clientY };
447
+ if (anchorMode === 'cursor' && tooltip.style.display === 'block' && !posRafQueued) {
448
+ posRafQueued = true;
449
+ requestAnimationFrame(() => {
450
+ posRafQueued = false;
451
+ updatePosition();
452
+ });
453
+ }
454
+ });
455
+
456
+ const focusOnNode = (name, { pin = true } = {}) => {
457
+ if (!graph.hasNode(name)) return;
458
+ const pos = renderer.getNodeDisplayData(name);
459
+ if (pos) renderer.getCamera().animate({ x: pos.x, y: pos.y, ratio: 0.3 }, { duration: 600 });
460
+ focusedNode = name;
461
+ pinned = pin;
462
+ if (pin) tooltip.dataset.pinned = 'true';
463
+ showTooltipFor(name, pin ? 'node' : 'cursor');
464
+ renderer.refresh({ skipIndexation: true });
465
+ };
466
+
467
+ // ── Search results ───────────────────────────────────────────────────
468
+ const totalNodes = data.nodes.length;
469
+ const renderResults = () => {
470
+ filterResults.textContent = '';
471
+ if (!filterTerm) {
472
+ filterResults.dataset.open = 'false';
473
+ filterCount.textContent = '';
474
+ filterCount.dataset.state = '';
475
+ activeMatchIndex = -1;
476
+ return;
477
+ }
478
+ filterCount.textContent = matches.length + ' / ' + totalNodes;
479
+ filterCount.dataset.state = matches.length === 0 ? 'zero' : '';
480
+ if (matches.length === 0) {
481
+ const empty = document.createElement('div');
482
+ empty.className = CLS.matchEmpty;
483
+ const b = document.createElement('b'); b.textContent = 'No matches'; b.className = 'text-fg';
484
+ empty.appendChild(b);
485
+ empty.appendChild(document.createTextNode(' for "' + filterTerm + '"'));
486
+ filterResults.appendChild(empty);
487
+ filterResults.dataset.open = 'true';
488
+ activeMatchIndex = -1;
489
+ return;
490
+ }
491
+ const limit = Math.min(matches.length, 24);
492
+ for (let i = 0; i < limit; i++) {
493
+ const m = matches[i];
494
+ const row = document.createElement('div');
495
+ row.className = CLS.matchItem;
496
+ row.setAttribute('role', 'option');
497
+ row.dataset.index = String(i);
498
+ if (i === activeMatchIndex) row.setAttribute('aria-selected', 'true');
499
+
500
+ const nameEl = document.createElement('span');
501
+ nameEl.className = CLS.miName;
502
+ const idx = m.name.toLowerCase().indexOf(filterTerm);
503
+ if (idx >= 0) {
504
+ nameEl.appendChild(document.createTextNode(m.name.slice(0, idx)));
505
+ const mark = document.createElement('mark');
506
+ mark.className = CLS.miMark;
507
+ mark.textContent = m.name.slice(idx, idx + filterTerm.length);
508
+ nameEl.appendChild(mark);
509
+ nameEl.appendChild(document.createTextNode(m.name.slice(idx + filterTerm.length)));
510
+ } else {
511
+ nameEl.textContent = m.name;
512
+ }
513
+ row.appendChild(nameEl);
514
+
515
+ const kindEl = document.createElement('span');
516
+ kindEl.className = CLS.miKind;
517
+ kindEl.textContent = m.type === 'application' ? 'app' : 'lib';
518
+ row.appendChild(kindEl);
519
+
520
+ row.addEventListener('mousedown', (ev) => {
521
+ ev.preventDefault();
522
+ focusOnNode(m.name);
523
+ filterResults.dataset.open = 'false';
524
+ });
525
+ filterResults.appendChild(row);
526
+ }
527
+ if (matches.length > limit) {
528
+ const more = document.createElement('div');
529
+ more.className = CLS.matchEmpty;
530
+ more.textContent = '+ ' + (matches.length - limit) + ' more — refine to see';
531
+ filterResults.appendChild(more);
532
+ }
533
+ filterResults.dataset.open = 'true';
534
+ };
535
+
536
+ const recomputeMatches = () => {
537
+ if (!filterTerm) { matches = []; return; }
538
+ matches = [];
539
+ for (const n of data.nodes) {
540
+ if (n.name.toLowerCase().includes(filterTerm)) matches.push(n);
541
+ }
542
+ matches.sort((a, b) => {
543
+ // Apps first, then by closeness of match position, then by name.
544
+ if (a.type !== b.type) return a.type === 'application' ? -1 : 1;
545
+ const ai = a.name.toLowerCase().indexOf(filterTerm);
546
+ const bi = b.name.toLowerCase().indexOf(filterTerm);
547
+ if (ai !== bi) return ai - bi;
548
+ return a.name.localeCompare(b.name);
549
+ });
550
+ };
551
+
552
+ let rafQueued = false;
553
+ filterInput.addEventListener('input', () => {
554
+ filterTerm = filterInput.value.toLowerCase().trim();
555
+ recomputeMatches();
556
+ activeMatchIndex = matches.length ? 0 : -1;
557
+ renderResults();
558
+ if (!rafQueued) {
559
+ rafQueued = true;
560
+ requestAnimationFrame(() => {
561
+ rafQueued = false;
562
+ renderer.refresh({ skipIndexation: true });
563
+ });
564
+ }
565
+ });
566
+
567
+ filterInput.addEventListener('focus', () => {
568
+ if (filterTerm) filterResults.dataset.open = 'true';
569
+ });
570
+
571
+ document.addEventListener('mousedown', (e) => {
572
+ if (!filterResults.contains(e.target) && e.target !== filterInput) {
573
+ filterResults.dataset.open = 'false';
574
+ }
575
+ });
576
+
577
+ filterInput.addEventListener('keydown', (e) => {
578
+ if (e.key === 'ArrowDown') {
579
+ if (matches.length) {
580
+ e.preventDefault();
581
+ activeMatchIndex = (activeMatchIndex + 1) % matches.length;
582
+ renderResults();
583
+ }
584
+ } else if (e.key === 'ArrowUp') {
585
+ if (matches.length) {
586
+ e.preventDefault();
587
+ activeMatchIndex = (activeMatchIndex - 1 + matches.length) % matches.length;
588
+ renderResults();
589
+ }
590
+ } else if (e.key === 'Enter') {
591
+ if (matches.length && activeMatchIndex >= 0) {
592
+ e.preventDefault();
593
+ focusOnNode(matches[activeMatchIndex].name);
594
+ filterResults.dataset.open = 'false';
595
+ }
596
+ }
597
+ });
598
+
599
+ // ── Legend / category filter ─────────────────────────────────────────
600
+ const legend = document.getElementById('legend');
601
+ const toggleCategory = (key) => {
602
+ if (!(key in visible)) return;
603
+ visible[key] = !visible[key];
604
+ const row = legend?.querySelector('[data-toggle="' + key + '"]');
605
+ if (row) {
606
+ row.dataset.state = visible[key] ? 'on' : 'off';
607
+ row.setAttribute('aria-checked', String(visible[key]));
608
+ }
609
+ renderer.refresh({ skipIndexation: true });
610
+ };
611
+ let previewRafQueued = false;
612
+ const queuePreviewRefresh = () => {
613
+ if (previewRafQueued) return;
614
+ previewRafQueued = true;
615
+ requestAnimationFrame(() => {
616
+ previewRafQueued = false;
617
+ renderer.refresh({ skipIndexation: true });
618
+ });
619
+ };
620
+ legend?.querySelectorAll('[data-toggle]').forEach((row) => {
621
+ row.addEventListener('click', () => toggleCategory(row.dataset.toggle));
622
+ row.addEventListener('mouseenter', () => {
623
+ previewCategory = row.dataset.toggle;
624
+ queuePreviewRefresh();
625
+ });
626
+ row.addEventListener('mouseleave', () => {
627
+ previewCategory = null;
628
+ queuePreviewRefresh();
629
+ });
630
+ row.addEventListener('focus', () => {
631
+ previewCategory = row.dataset.toggle;
632
+ queuePreviewRefresh();
633
+ });
634
+ row.addEventListener('blur', () => {
635
+ previewCategory = null;
636
+ queuePreviewRefresh();
637
+ });
638
+ row.addEventListener('keydown', (e) => {
639
+ if (e.key === ' ' || e.key === 'Enter') {
640
+ e.preventDefault();
641
+ toggleCategory(row.dataset.toggle);
642
+ }
643
+ });
644
+ });
645
+
646
+ // ── Camera controls ──────────────────────────────────────────────────
647
+ const resetView = () => {
648
+ renderer.getCamera().animatedReset({ duration: 600 });
649
+ };
650
+
651
+ const applyTheme = () => {
652
+ theme = css();
653
+ graph.forEachNode((node, attrs) => {
654
+ graph.setNodeAttribute(node, 'color', colorForNode(attrs.kind));
655
+ });
656
+ graph.forEachEdge((edge, attrs) => {
657
+ graph.setEdgeAttribute(edge, 'color', colorForEdge(attrs.depType));
658
+ });
659
+ renderer.setSetting('labelColor', { color: theme.fg });
660
+ renderer.setSetting('defaultEdgeColor', theme.edge);
661
+ renderer.setSetting('defaultNodeColor', theme.lib);
662
+ renderer.refresh();
663
+ };
664
+
665
+ themeBtn?.addEventListener('click', () => {
666
+ const isDark = root.dataset.theme ? root.dataset.theme === 'dark' : mql.matches;
667
+ const next = isDark ? 'light' : 'dark';
668
+ root.dataset.theme = next;
669
+ try { localStorage.setItem('vis-graph-theme', next); } catch {}
670
+ applyTheme();
671
+ });
672
+
673
+ mql.addEventListener('change', () => {
674
+ if (!root.dataset.theme) applyTheme();
675
+ });
676
+
677
+ // Keyboard shortcuts: '/' focuses search, 'R' fits view, Esc clears + unpins.
678
+ window.addEventListener('keydown', (e) => {
679
+ const inField = document.activeElement === filterInput;
680
+ if (e.key === '/' && !inField) {
681
+ e.preventDefault();
682
+ filterInput.focus();
683
+ filterInput.select();
684
+ } else if ((e.key === 'r' || e.key === 'R') && !inField) {
685
+ e.preventDefault();
686
+ resetView();
687
+ } else if (e.key === 'Escape') {
688
+ if (inField) {
689
+ filterInput.value = '';
690
+ filterTerm = '';
691
+ matches = [];
692
+ renderResults();
693
+ renderer.refresh({ skipIndexation: true });
694
+ filterInput.blur();
695
+ } else if (pinned || focusedNode) {
696
+ focusedNode = null;
697
+ pinned = false;
698
+ tooltip.dataset.pinned = 'false';
699
+ if (!hoveredNode) hideTooltip();
700
+ renderer.refresh({ skipIndexation: true });
701
+ }
702
+ }
703
+ });
704
+ })();
705
+ <\/script>
706
+ </body>
707
+ </html>`},nn={application:0,library:3,service:1,tool:2},Mt=y=>nn[y]??Number.MAX_SAFE_INTEGER,on=y=>{const l=new Map;for(const[h,u]of Object.entries(y.dependencies))for(const v of u){const m=l.get(v.target)??[];m.push(h),l.set(v.target,m)}return Object.values(y.nodes).map(h=>({deps:y.dependencies[h.name]??[],name:h.name,reverseDeps:l.get(h.name)??[],type:h.type})).sort((h,u)=>h.type!==u.type?Mt(h.type)-Mt(u.type):h.name.localeCompare(u.name))},an=(y,l,h)=>{let u=y;if(l==="app"?u=u.filter(v=>v.type==="application"):l==="lib"&&(u=u.filter(v=>v.type!=="application")),h){const v=h.toLowerCase();u=u.filter(m=>m.name.toLowerCase().includes(v))}return u};class sn{#e;#r=new Set;#n;constructor(l){this.#n=l;const h=on(l);this.#e={allNodes:h,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",selectedIndex:0}}getSnapshot=()=>this.#e;subscribe=l=>(this.#r.add(l),()=>{this.#r.delete(l)});getFilteredNodes(){return an(this.#e.allNodes,this.#e.filterType,this.#e.filterText)}getStats(){const l=this.#e.allNodes.filter(v=>v.type==="application").length,h=this.#e.allNodes.length,u=Object.values(this.#n.dependencies).reduce((v,m)=>v+m.length,0);return{apps:l,deps:u,libs:h-l,total:h}}setSelectedIndex(l){const h=this.getFilteredNodes(),u=h.length===0?-1:Math.max(0,Math.min(l,h.length-1));u!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:u})}setFocusedPanel(l){l!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:l})}setFilterType(l){l!==this.#e.filterType&&this.#t({...this.#e,filterType:l,selectedIndex:0})}setFilter(l){this.#t({...this.#e,filterText:l,selectedIndex:0})}setFilterActive(l){l!==this.#e.filterActive&&this.#t({...this.#e,filterActive:l,filterText:l?this.#e.filterText:"",selectedIndex:l?this.#e.selectedIndex:0})}#t(l){this.#e=l;for(const h of this.#r)try{h()}catch{}}}const cn=({focused:y,node:l,scrollRef:h})=>{const u=y?"white":"gray";if(!l)return d.jsx(T,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:d.jsx(x,{dimColor:!0,children:"No project selected"})});const v=l.type==="application",m=v?"yellow":"cyan",k=v?"Application":"Library";return d.jsx(T,{borderColor:u,borderStyle:"single",borderTopRightTitle:` ${k} `,borderTopTitle:` ${l.name} `,flexDirection:"column",flexGrow:1,children:d.jsxs(Ar,{flexGrow:1,flexShrink:1,paddingX:2,ref:h,scrollbar:!0,scrollbarColor:"gray",children:[d.jsxs(T,{flexDirection:"column",marginTop:1,children:[d.jsxs(T,{children:[d.jsx(x,{dimColor:!0,children:"── "}),d.jsx(x,{bold:!0,color:"white",children:"DEPENDS ON"}),d.jsxs(x,{dimColor:!0,children:[" ","(",l.deps.length,")"]})]}),l.deps.length===0?d.jsx(T,{marginTop:1,paddingLeft:2,children:d.jsx(x,{dimColor:!0,children:"No dependencies"})}):d.jsx(T,{flexDirection:"column",marginTop:1,children:l.deps.map(N=>d.jsxs(T,{gap:1,paddingLeft:2,children:[d.jsx(x,{color:"cyan",children:"→"}),d.jsx(x,{children:N.target}),N.type!=="static"&&d.jsxs(x,{dimColor:!0,children:["(",N.type,")"]})]},N.target))})]}),d.jsxs(T,{flexDirection:"column",marginTop:1,children:[d.jsxs(T,{children:[d.jsx(x,{dimColor:!0,children:"── "}),d.jsx(x,{bold:!0,color:"white",children:"REQUIRED BY"}),d.jsxs(x,{dimColor:!0,children:[" ","(",l.reverseDeps.length,")"]})]}),l.reverseDeps.length===0?d.jsx(T,{marginTop:1,paddingLeft:2,children:d.jsx(x,{dimColor:!0,children:"No reverse dependencies"})}):d.jsx(T,{flexDirection:"column",marginTop:1,children:l.reverseDeps.map(N=>d.jsxs(T,{gap:1,paddingLeft:2,children:[d.jsx(x,{color:"magenta",children:"←"}),d.jsx(x,{children:N})]},N))})]}),d.jsxs(T,{flexDirection:"column",marginTop:1,children:[d.jsxs(T,{children:[d.jsx(x,{dimColor:!0,children:"── "}),d.jsx(x,{bold:!0,color:"white",children:"INFO"})]}),d.jsxs(T,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[d.jsxs(T,{children:[d.jsx(T,{width:16,children:d.jsx(x,{dimColor:!0,children:"Type:"})}),d.jsx(x,{color:m,children:k})]}),d.jsxs(T,{children:[d.jsx(T,{width:16,children:d.jsx(x,{dimColor:!0,children:"Dependencies:"})}),d.jsx(x,{children:String(l.deps.length)})]}),d.jsxs(T,{children:[d.jsx(T,{width:16,children:d.jsx(x,{dimColor:!0,children:"Required by:"})}),d.jsx(x,{children:String(l.reverseDeps.length)})]}),d.jsxs(T,{children:[d.jsx(T,{width:16,children:d.jsx(x,{dimColor:!0,children:"Connectivity:"})}),d.jsx(x,{children:String(l.deps.length+l.reverseDeps.length)})]})]})]})]})})},dn=[{key:"all",label:"All",shortcut:"1"},{key:"app",label:"Apps",shortcut:"2"},{key:"lib",label:"Libs",shortcut:"3"}],It=({isSelected:y,node:l})=>{const h=l.type==="application",u=h?"yellow":"cyan",v=h?"app":"lib";return d.jsxs(T,{flexShrink:0,height:1,children:[d.jsxs(x,{children:[y?"▶":" "," "]}),d.jsx(T,{flexGrow:1,children:d.jsx(x,{bold:y,inverse:y,wrap:"truncate",children:l.name})}),d.jsxs(x,{color:u,children:[" ",v]}),d.jsxs(x,{dimColor:!0,children:[" ","→",l.deps.length," ","←",l.reverseDeps.length]})]})},Tt=({count:y,label:l})=>d.jsxs(T,{flexShrink:0,height:1,marginTop:1,children:[d.jsxs(x,{dimColor:!0,children:["▼"," "]}),d.jsx(x,{bold:!0,color:"white",children:l.toUpperCase()}),d.jsxs(x,{dimColor:!0,children:[" ","(",y,")"]})]}),ln=({filterActive:y,filterText:l,filterType:h,focused:u,nodes:v,scrollOffset:m,selectedIndex:k,stats:N,viewportHeight:D})=>{const j=u?"white":"gray",C=v.filter(R=>R.type==="application"),I=v.filter(R=>R.type!=="application"),q=[];let z=0;if(C.length>0){q.push(d.jsx(Tt,{count:C.length,label:"Applications"},"hdr-apps"));for(const R of C){const K=z;q.push(d.jsx(It,{isSelected:K===k,node:R},R.name)),z++}}if(I.length>0){q.push(d.jsx(Tt,{count:I.length,label:"Libraries"},"hdr-libs"));for(const R of I){const K=z;q.push(d.jsx(It,{isSelected:K===k,node:R},R.name)),z++}}let L=0;C.length>0&&(L+=2+C.length),I.length>0&&(L+=2+I.length);const $=L>D&&D>0;return d.jsxs(T,{borderColor:j,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[d.jsxs(T,{flexShrink:0,gap:1,paddingX:1,children:[d.jsx(x,{bold:!0,inverse:!0,children:" VIS "}),d.jsxs(x,{wrap:"truncate",children:[N.total," ","packages"]}),d.jsxs(x,{dimColor:!0,children:["(",N.apps," ","apps,"," ",N.libs," ","libs,"," ",N.deps," ","deps)"]})]}),d.jsx(T,{flexShrink:0,gap:1,paddingX:1,paddingY:1,children:dn.map(R=>{const K=h===R.key;return d.jsxs(T,{children:[d.jsx(x,{dimColor:!K,children:"["}),d.jsx(x,{bold:K,color:K?"cyan":"gray",children:R.shortcut}),d.jsx(x,{dimColor:!K,children:"]"}),d.jsxs(x,{color:K?"white":"gray",children:[" ",R.label]})]},R.key)})}),y&&d.jsxs(T,{flexShrink:0,paddingX:1,children:[d.jsx(x,{bold:!0,color:"white",children:"/ "}),d.jsx(x,{children:l}),d.jsx(x,{inverse:!0,children:" "})]}),d.jsxs(T,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[d.jsx(T,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:d.jsx(T,{flexDirection:"column",marginTop:-m,children:q})}),$&&d.jsx(T,{flexShrink:0,marginLeft:1,marginRight:1,children:d.jsx(Nr,{contentHeight:L,placement:"inset",scrollOffset:m,style:"block",viewportHeight:D})})]})]})},un=100,pn=40,hn=10,Lt={1:"all",2:"app",3:"lib"},fn=({autoExitSeconds:y=0,store:l})=>{const{exit:h}=Cr(),{columns:u,rows:v}=Dr(),m=he.useSyncExternalStore(l.subscribe,l.getSnapshot),[k,N]=he.useState(!1),D=he.useRef(null),j=he.useRef(null),[C,I]=he.useState(0),[q,z]=he.useState(!1),L=he.useMemo(()=>l.getFilteredNodes(),[m.allNodes,m.filterType,m.filterText]),$=he.useMemo(()=>l.getStats(),[m.allNodes]),R=L[m.selectedIndex]??null,K=he.useMemo(()=>{let w=0,c=0;for(const X of L)X.type==="application"?w+=1:c+=1;return{appsCount:w,libsCount:c}},[L]),W=he.useCallback(w=>{const{appsCount:c,libsCount:X}=K;if(w<c)return(c>0?2:0)+w;const je=c>0?2+c:0,S=X>0?2:0;return je+S+(w-c)},[K]),B=Math.max(1,v-8-(m.filterActive?1:0)),ie=he.useCallback(w=>{const c=W(w);I(X=>c>X+B-2?Math.max(0,c-B+2):c<X+1?Math.max(0,c-1):X)},[W,B]);if(he.useEffect(()=>{j.current?.scrollToTop()},[R?.name]),Mr((w,c)=>{if(w==="c"&&c.ctrl){h();return}if(!q){if(k){c.escape||w==="?"?N(!1):w==="q"?(N(!1),z(!0)):c.downArrow||w==="j"?D.current?.scrollBy(1):(c.upArrow||w==="k")&&D.current?.scrollBy(-1);return}if(w==="?"){N(!0);return}if(w==="q"){z(!0);return}if(c.tab){l.setFocusedPanel(m.focusedPanel==="list"?"detail":"list");return}if(Lt[w]){l.setFilterType(Lt[w]);return}if(m.filterActive){if(c.escape){l.setFilterActive(!1);return}if(c.return){l.setFilterActive(!1);return}if(c.backspace){l.setFilter(m.filterText.slice(0,-1));return}if(w&&!c.ctrl&&!c.meta){l.setFilter(m.filterText+w);return}return}if(m.focusedPanel==="list"){if(L.length===0){w==="/"&&l.setFilterActive(!0);return}if(c.downArrow||w==="j"){const X=Math.min(m.selectedIndex+1,L.length-1);l.setSelectedIndex(X),ie(X);return}if(c.upArrow||w==="k"){const X=Math.max(m.selectedIndex-1,0);l.setSelectedIndex(X),ie(X);return}if(c.pageDown){const X=Math.min(m.selectedIndex+10,L.length-1);l.setSelectedIndex(X),ie(X);return}if(c.pageUp){const X=Math.max(m.selectedIndex-10,0);l.setSelectedIndex(X),ie(X);return}if(c.home){l.setSelectedIndex(0),I(0);return}if(c.end){const X=L.length-1;l.setSelectedIndex(X),ie(X);return}if(w==="/"){l.setFilterActive(!0);return}if(c.rightArrow){l.setFocusedPanel("detail");return}return}if(m.focusedPanel==="detail"){if(c.escape||c.leftArrow){l.setFocusedPanel("list");return}if(c.downArrow||w==="j"){j.current?.scrollBy(1);return}if(c.upArrow||w==="k"){j.current?.scrollBy(-1);return}if(c.pageDown){j.current?.scrollBy(10);return}if(c.pageUp){j.current?.scrollBy(-10);return}if(c.home){j.current?.scrollToTop();return}c.end&&j.current?.scrollToBottom()}}},{isActive:!0}),u<pn||v<hn)return d.jsx(T,{alignItems:"center",height:v,justifyContent:"center",width:u,children:d.jsxs(x,{color:"yellow",children:["Terminal too small (",u,"x",v,")"]})});const de=u>=un,ce=d.jsx(T,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:d.jsxs(T,{flexWrap:"wrap",gap:2,paddingX:1,children:[d.jsxs(T,{gap:1,children:[d.jsx(x,{bold:!0,color:"white",children:"q"}),d.jsx(x,{dimColor:!0,children:"QUIT"})]},"q"),d.jsxs(T,{gap:1,children:[d.jsx(x,{bold:!0,color:"white",children:"?"}),d.jsx(x,{dimColor:!0,children:"HELP"})]},"?"),d.jsxs(T,{gap:1,children:[d.jsx(x,{bold:!0,color:"white",children:"↑↓"}),d.jsx(x,{dimColor:!0,children:"NAV"})]},"nav"),d.jsxs(T,{gap:1,children:[d.jsx(x,{bold:!0,color:"white",children:"1-3 /"}),d.jsx(x,{dimColor:!0,children:"FILTER"})]},"f"),d.jsxs(T,{gap:1,children:[d.jsx(x,{bold:!0,color:"white",children:"Tab"}),d.jsx(x,{dimColor:!0,children:"PANEL"})]},"t")]})}),re=d.jsxs(Ir,{footer:d.jsxs(x,{dimColor:!0,children:[d.jsx(x,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",d.jsx(x,{bold:!0,color:"white",children:"?"}),"/",d.jsx(x,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:D,title:"KEYBOARD SHORTCUTS",visible:k,width:52,children:[d.jsxs(T,{flexDirection:"column",marginBottom:1,children:[d.jsxs(T,{marginBottom:1,children:[d.jsx(x,{dimColor:!0,children:"── "}),d.jsx(x,{bold:!0,color:"white",children:"NAVIGATION"})]}),d.jsxs(T,{children:[d.jsx(T,{width:24,children:d.jsxs(x,{children:[d.jsxs(x,{bold:!0,color:"white",children:[" ","↑","/k"]}),d.jsx(x,{dimColor:!0,children:" Move up"})]})}),d.jsxs(x,{children:[d.jsxs(x,{bold:!0,color:"white",children:[" ","↓","/j"]}),d.jsx(x,{dimColor:!0,children:" Move down"})]})]}),d.jsxs(x,{children:[d.jsxs(x,{bold:!0,color:"white",children:[" ","Tab"]}),d.jsx(x,{dimColor:!0,children:" Switch panel"})]}),d.jsxs(x,{children:[d.jsxs(x,{bold:!0,color:"white",children:[" ","→","/","←"]}),d.jsx(x,{dimColor:!0,children:" Focus detail/list"})]}),d.jsxs(x,{children:[d.jsxs(x,{bold:!0,color:"white",children:[" ","PgUp/PgDn"]}),d.jsx(x,{dimColor:!0,children:" Jump 10 items"})]}),d.jsxs(x,{children:[d.jsxs(x,{bold:!0,color:"white",children:[" ","Home/End"]}),d.jsx(x,{dimColor:!0,children:" Jump to start/end"})]})]}),d.jsxs(T,{flexDirection:"column",marginBottom:1,children:[d.jsxs(T,{marginBottom:1,children:[d.jsx(x,{dimColor:!0,children:"── "}),d.jsx(x,{bold:!0,color:"white",children:"FILTERS"})]}),d.jsxs(T,{children:[d.jsx(T,{width:24,children:d.jsxs(x,{children:[d.jsxs(x,{bold:!0,color:"white",children:[" ","1"]}),d.jsx(x,{dimColor:!0,children:" All"})]})}),d.jsxs(x,{children:[d.jsxs(x,{bold:!0,color:"white",children:[" ","2"]}),d.jsx(x,{dimColor:!0,children:" Apps only"})]})]}),d.jsxs(x,{children:[d.jsxs(x,{bold:!0,color:"white",children:[" ","3"]}),d.jsx(x,{dimColor:!0,children:" Libraries only"})]}),d.jsxs(x,{children:[d.jsxs(x,{bold:!0,color:"white",children:[" ","/"]}),d.jsx(x,{dimColor:!0,children:" Text filter"})]})]}),d.jsxs(T,{flexDirection:"column",children:[d.jsxs(T,{marginBottom:1,children:[d.jsx(x,{dimColor:!0,children:"── "}),d.jsx(x,{bold:!0,color:"white",children:"ACTIONS"})]}),d.jsxs(x,{children:[d.jsxs(x,{bold:!0,color:"white",children:[" ","q"]}),d.jsx(x,{dimColor:!0,children:" Quit"})]}),d.jsxs(x,{children:[d.jsxs(x,{bold:!0,color:"white",children:[" ","?"]}),d.jsx(x,{dimColor:!0,children:" Toggle help"})]})]})]}),_e=d.jsx(ln,{filterActive:m.filterActive,filterText:m.filterText,filterType:m.filterType,focused:m.focusedPanel==="list",nodes:L,scrollOffset:C,selectedIndex:m.selectedIndex,stats:$,viewportHeight:B}),G=d.jsx(cn,{focused:m.focusedPanel==="detail",node:R,scrollRef:j});if(de){const w=Math.floor(u*.35);return d.jsxs(T,{flexDirection:"column",height:v,width:u,children:[d.jsxs(T,{flexDirection:"row",flexGrow:1,children:[d.jsx(T,{flexGrow:1,children:_e}),d.jsx(T,{width:w,children:G})]}),ce,d.jsx(Et,{autoExitSeconds:y??3,onCancel:()=>{z(!1)},visible:q}),re]})}const _=Math.floor(v*.55);return d.jsxs(T,{flexDirection:"column",height:v,width:u,children:[d.jsx(T,{height:_,children:_e}),d.jsx(T,{flexGrow:1,children:G}),ce,d.jsx(Et,{autoExitSeconds:y??3,onCancel:()=>{z(!1)},visible:q}),re]})},Ut=(y,l,h,u,v,m,k,N)=>{const D=h?fe("└── "):fe("├── "),j=v.has(y),C=j?fe(" (*)"):"",I=u.get(y),q=I?.type==="application"?Ge(y):y;if(m.push(`${l}${D}${q}${C}`),j)return;v.add(y);const z=I?.deps??[],L=h?`${l} `:`${l}${fe("│")} `;if(N>=k&&z.length>0){m.push(`${L}${fe(`... ${z.length} more`)}`);return}for(let $=0;$<z.length;$++){const R=z[$];R&&Ut(R.target,L,$===z.length-1,u,v,m,k,N+1)}},zt=(y,l,h,u,v,m)=>{const k=l.get(y),N=k?.type==="application"?Ge(y):y;u.push(`${m}${N}`),h.add(y);const D=k?.deps??[];if(D.length===0){u.push(`${m} ${fe("(no dependencies)")}`);return}if(v<=0){u.push(`${m} ${fe(`... ${D.length} dependencies`)}`);return}for(let j=0;j<D.length;j++){const C=D[j];C&&Ut(C.target,m,j===D.length-1,l,h,u,v,1)}},Rt=(y,l)=>{const h=new Map;for(const[I,q]of Object.entries(y.nodes))h.set(I,{deps:(y.dependencies[I]??[]).map(z=>({target:z.target,type:z.type})),name:I,type:q.type});const u=[],v=[];for(const[I,q]of h)q.type==="application"?u.push(I):v.push(I);u.sort(),v.sort();const m=u.length+v.length,k=Object.values(y.dependencies).reduce((I,q)=>I+q.length,0),N=[Ge("Project Dependency Graph"),""];if(u.length>0){N.push(` ${Ge(kt(`Applications (${u.length})`))}`,"");for(const I of u)zt(I,h,new Set,N,l," "),N.push("")}if(v.length>0){N.push(` ${Ge(kt(`Libraries (${v.length})`))}`,"");for(const I of v)zt(I,h,new Set,N,l," "),N.push("")}const D=process.stdout.columns||80;N.push(fe("─".repeat(Math.min(D,60)))),N.push(`${Ge(String(m))} packages ${fe("·")} ${Ge(String(k))} dependencies ${fe("·")} ${Ge(String(u.length))} apps${fe(",")} ${Ge(String(v.length))} libraries`);const j=new Set;let C=!1;for(const I of[...u,...v]){const q=h.get(I)?.deps??[];for(const z of q)j.has(z.target)&&(C=!0),j.add(z.target);j.add(I)}return C&&N.push(fe("(*) = already shown above")),N.join(`
708
+ `)},gn=y=>{const l=Object.values(y.nodes).map(h=>({name:h.name,type:h.type}));return{edges:Object.values(y.dependencies).flat(),nodes:l}},mn=y=>{const l=Object.values(y.nodes).map(u=>({name:u.name,path:u.data?.root,type:u.type})),h=[];for(const u of Object.values(y.dependencies))for(const v of u)h.push({source:v.source,target:v.target,type:v.type});return rn({edges:h,nodes:l,tool:{name:"vis-graph",version:"alpha"},workspaceRoot:process.cwd()})},An=async({fs:y,logger:l,options:h,visConfig:u,workspaceRoot:v})=>{if(!v)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const m=v,{packageJsons:k,workspace:N}=br(m,u),D=yr(m,N,k),j=!!process.stdout.isTTY&&!kr,C=h.format??(j?"tui":"ascii"),I=h.output,q=h.depth??1/0;let z;switch(C){case"dot":{z=mr(D);break}case"html":{z=mn(D);break}case"json":{z=JSON.stringify(gn(D),void 0,2);break}case"tui":{if(!j){z=Rt(D,q);break}const L=u?.tui?.autoExit===!0?3:typeof u?.tui?.autoExit=="number"?u.tui.autoExit:0;process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&(process.stdin.setRawMode(!0),process.stdin.ref(),process.stdin.resume());const $=setInterval(()=>{},1e3),R=new sn(D);await wr(vr.createElement(fn,{autoExitSeconds:L,store:R}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),clearInterval($);return}default:z=Rt(D,q)}I?(await y.writeFile(I,z,"utf8"),l.info(`Graph written to ${I}`)):l.info(z)};export{An as default};