@visulima/vis 1.0.0-alpha.27 → 1.0.0-alpha.29

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 (132) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/LICENSE.md +3217 -99
  3. package/dist/bin.js +1 -1
  4. package/dist/binx.js +1 -1
  5. package/dist/packem_chunks/bin.js +468 -364
  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/config.js +15 -15
  9. package/dist/packem_chunks/devtools.js +82 -0
  10. package/dist/packem_chunks/doctor-probe.js +1 -1
  11. package/dist/packem_chunks/fix.js +1 -1
  12. package/dist/packem_chunks/handler.js +1 -1
  13. package/dist/packem_chunks/handler10.js +1 -2
  14. package/dist/packem_chunks/handler11.js +5 -1
  15. package/dist/packem_chunks/handler12.js +1 -5
  16. package/dist/packem_chunks/handler13.js +27 -1
  17. package/dist/packem_chunks/handler14.js +5 -27
  18. package/dist/packem_chunks/handler15.js +1 -5
  19. package/dist/packem_chunks/handler16.js +1 -1
  20. package/dist/packem_chunks/handler17.js +1 -1
  21. package/dist/packem_chunks/handler18.js +1 -1
  22. package/dist/packem_chunks/handler19.js +1 -1
  23. package/dist/packem_chunks/handler2.js +1 -1
  24. package/dist/packem_chunks/handler20.js +5 -1
  25. package/dist/packem_chunks/handler21.js +2 -5
  26. package/dist/packem_chunks/handler22.js +2 -2
  27. package/dist/packem_chunks/handler23.js +1 -2
  28. package/dist/packem_chunks/handler24.js +1 -1
  29. package/dist/packem_chunks/handler25.js +5 -1
  30. package/dist/packem_chunks/handler26.js +1 -5
  31. package/dist/packem_chunks/handler27.js +3 -1
  32. package/dist/packem_chunks/handler28.js +1 -3
  33. package/dist/packem_chunks/handler29.js +7 -1
  34. package/dist/packem_chunks/handler3.js +4 -4
  35. package/dist/packem_chunks/handler30.js +32 -6
  36. package/dist/packem_chunks/handler31.js +3 -33
  37. package/dist/packem_chunks/handler32.js +8 -3
  38. package/dist/packem_chunks/handler33.js +1 -1
  39. package/dist/packem_chunks/handler34.js +4 -4
  40. package/dist/packem_chunks/handler35.js +11 -3
  41. package/dist/packem_chunks/handler36.js +3 -22
  42. package/dist/packem_chunks/handler37.js +21 -60
  43. package/dist/packem_chunks/handler38.js +61 -3
  44. package/dist/packem_chunks/handler39.js +3 -6
  45. package/dist/packem_chunks/handler4.js +5 -5
  46. package/dist/packem_chunks/handler40.js +6 -24
  47. package/dist/packem_chunks/handler41.js +24 -153
  48. package/dist/packem_chunks/handler42.js +153 -10
  49. package/dist/packem_chunks/handler43.js +6 -6
  50. package/dist/packem_chunks/handler44.js +10 -708
  51. package/dist/packem_chunks/handler45.js +708 -24
  52. package/dist/packem_chunks/handler46.js +24 -322
  53. package/dist/packem_chunks/handler47.js +322 -48
  54. package/dist/packem_chunks/handler48.js +48 -3
  55. package/dist/packem_chunks/handler49.js +3 -27
  56. package/dist/packem_chunks/handler5.js +7 -7
  57. package/dist/packem_chunks/handler50.js +21 -190
  58. package/dist/packem_chunks/handler51.js +194 -33
  59. package/dist/packem_chunks/handler52.js +34 -0
  60. package/dist/packem_chunks/handler6.js +1 -1
  61. package/dist/packem_chunks/handler7.js +1 -1
  62. package/dist/packem_chunks/handler8.js +1 -1
  63. package/dist/packem_chunks/handler9.js +1 -1
  64. package/dist/packem_chunks/heal-accept.js +1 -1
  65. package/dist/packem_chunks/heal.js +1 -1
  66. package/dist/packem_chunks/help-command.js +7 -17
  67. package/dist/packem_chunks/index.js +3 -3
  68. package/dist/packem_chunks/keys-refresh.js +1 -1
  69. package/dist/packem_chunks/list.js +2 -2
  70. package/dist/packem_chunks/loader.js +1 -1
  71. package/dist/packem_chunks/loader2.js +1 -1
  72. package/dist/packem_chunks/prune.js +1 -1
  73. package/dist/packem_chunks/run.js +1 -1
  74. package/dist/packem_chunks/status.js +1 -1
  75. package/dist/packem_chunks/sync.js +1 -1
  76. package/dist/packem_chunks/sync2.js +1 -1
  77. package/dist/packem_chunks/tripwire.js +2 -2
  78. package/dist/packem_chunks/verify-lockfile.js +1 -1
  79. package/dist/packem_shared/Table-3pFgIUZ2-DABgc6rj.js +12 -0
  80. package/dist/packem_shared/_commonjsHelpers-CLblCigl.js +1 -0
  81. package/dist/packem_shared/{advisories-xIOdLbAI.js → advisories-DpgSuWDH.js} +1 -1
  82. package/dist/packem_shared/{affected-shas-Dm7eqcI8.js → affected-shas-BkXXecyi.js} +1 -1
  83. package/dist/packem_shared/ai-analysis-KP8b5lc0.js +68 -0
  84. package/dist/packem_shared/{ai-fix-BlYyz5bI.js → ai-fix-CfFWatGY.js} +5 -5
  85. package/dist/packem_shared/{applyDefaults-KxZkvlp3.js → applyDefaults-DLvOqXGX.js} +1 -1
  86. package/dist/packem_shared/{build-scripts-3E2pmscY.js → build-scripts-D-ysm_bS.js} +1 -1
  87. package/dist/packem_shared/{cyclonedx-B3ILsY74.js → cyclonedx-B04lIvwu.js} +3 -3
  88. package/dist/packem_shared/{dependency-scan-s2MD0vi-.js → dependency-scan-B9wTcLxf.js} +1 -1
  89. package/dist/packem_shared/{docker-BynKrOLe.js → docker-DxA80dRx.js} +1 -1
  90. package/dist/packem_shared/{failure-log-B0Uh-65U.js → failure-log-n3j_-w8s.js} +1 -1
  91. package/dist/packem_shared/index-BDF8gawl.js +29 -0
  92. package/dist/packem_shared/{index-B_KtN1MB.js → index-BfG9_znI.js} +1 -1
  93. package/dist/packem_shared/{lifecycle-CJRNbN3x.js → lifecycle-NHIKDiCh.js} +2 -2
  94. package/dist/packem_shared/lockfile-CoeFxWAv.js +1 -0
  95. package/dist/packem_shared/lockfile-DAuTDwow.js +1 -0
  96. package/dist/packem_shared/{manifests-Z3spBpxv.js → manifests-B7wUR3Rk.js} +1 -1
  97. package/dist/packem_shared/{min-release-age-aEn0x8Vy.js → min-release-age-YyNI7gqV.js} +1 -1
  98. package/dist/packem_shared/{native-config-sync-DdhTLlKL.js → native-config-sync-CgRIIRZV.js} +2 -2
  99. package/dist/packem_shared/{osv-bloom-BJhlc_I2.js → osv-bloom-BQSIHt5h.js} +2 -2
  100. package/dist/packem_shared/pm-runner-Ta_yz2uP.js +1 -0
  101. package/dist/packem_shared/{provenance-BuiEsWbI.js → provenance-DoEp2uOo.js} +1 -1
  102. package/dist/packem_shared/{readFileSync-CGmzMUF2-D6rUjGDn.js → readFileSync-4c_c6Qey-6SWMDNdw.js} +1 -1
  103. package/dist/packem_shared/{registry-keys-pemEkRM9.js → registry-keys-CD1xHavV.js} +1 -1
  104. package/dist/packem_shared/{resolve-explicit-RgRrUDZv.js → resolve-explicit-DpSc7RN2.js} +1 -1
  105. package/dist/packem_shared/{runtime-check-DgXsKCsv.js → runtime-check-Cbtb_Utb.js} +1 -1
  106. package/dist/packem_shared/s1ngularity-CIX7UcT5.js +1 -0
  107. package/dist/packem_shared/scan-progress-CTVVf9WW.js +2 -0
  108. package/dist/packem_shared/{selectors-BE2BCnTR.js → selectors-BU8aTRQm.js} +1 -1
  109. package/dist/packem_shared/{signatures-LYMy8OR5.js → signatures-BHM7cnqB.js} +1 -1
  110. package/dist/packem_shared/spinner-C8xs6QZv.js +1 -0
  111. package/dist/packem_shared/spinners-f91Rbo99-Bjf3NcO0.js +1 -0
  112. package/dist/packem_shared/tabs-xZkm6Y_J.js +1 -0
  113. package/dist/packem_shared/{toolchain-Jx2lkAYy.js → toolchain-juKl-WgV.js} +1 -1
  114. package/dist/packem_shared/typosquats-DRKU6d2S.js +1 -0
  115. package/dist/packem_shared/use-measured-height-Lea6TCVD.js +1 -0
  116. package/dist/packem_shared/{verify-C8EAHql6.js → verify-DA80ja1b.js} +1 -1
  117. package/dist/packem_shared/vis-update-app-BCKzlqj8.js +1 -0
  118. package/dist/packem_shared/{watch-BSVsZ_1I.js → watch-DdR-pFzX.js} +1 -1
  119. package/dist/packem_shared/{watch-loop-DLlMLg_J.js → watch-loop-C8csFvRU.js} +2 -2
  120. package/index.d.ts +201 -201
  121. package/index.js +567 -751
  122. package/package.json +13 -13
  123. package/dist/packem_shared/ai-analysis-Csn82p17.js +0 -68
  124. package/dist/packem_shared/index-efSniSRN.js +0 -29
  125. package/dist/packem_shared/index.server-B7ETiT4C.js +0 -2
  126. package/dist/packem_shared/lockfile-BG1HvBzH.js +0 -1
  127. package/dist/packem_shared/pm-runner-BwX5AL3W.js +0 -1
  128. package/dist/packem_shared/s1ngularity-Bs9fUf3q.js +0 -1
  129. package/dist/packem_shared/scan-progress-DjPT66jy.js +0 -2
  130. package/dist/packem_shared/typosquats-znskIR5j.js +0 -1
  131. package/dist/packem_shared/use-measured-height-DjYgUOKk.js +0 -1
  132. package/dist/packem_shared/vis-update-app-qhQPV97i.js +0 -1
@@ -1,24 +1,708 @@
1
- var Fe=Object.defineProperty;var $=(e,o)=>Fe(e,"name",{value:o,configurable:!0});import{createRequire as Ae}from"node:module";import{M as g,i as S,$ as M}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{aN as pe,aO as Y,aP as Ne,aQ as Me,aR as Z,aS as Be,aT as He,aH as De,aU as We,aF as Le,aV as he,aW as me,aX as ke}from"./bin.js";import{b as ye}from"./config.js";import{NATIVE_BINDING_VERSION as ie,allKnownTags as qe,tagsFromPath as Ge,tagsFromPaths as Je,parseShebang as Ke}from"#native";const Pe=Ae(import.meta.url),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,V=$(e=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[o,t]=I.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return I.getBuiltinModule(e)}return Pe(e)},"__cjs_getBuiltinModule"),{readdirSync:de,statSync:z,readFileSync:B,existsSync:H,writeFileSync:x,unlinkSync:_e,rmSync:Te,chmodSync:Ce}=V("node:fs"),{cwd:N}=I,{createInterface:Ie}=V("node:readline"),{spawnSync:R}=V("node:child_process"),{basename:Ve}=V("node:path");var Ue=Object.defineProperty,q=$((e,o)=>Ue(e,"name",{value:o,configurable:!0}),"c$5");const ze=/^# ([^:\s]\S*)(?::\s+(.+))?$/,Qe=q(e=>{const o=[],t=e.split(`
2
- `);let r;for(const s of t){if(s.startsWith("#!")||s.startsWith("# Generated by")||s.startsWith("# NOTE:")||s==="set -e"||s==="")continue;const n=ze.exec(s);if(n){r&&o.push(r),r={command:"",id:n[1]??"",...n[2]?{name:n[2]}:{}};continue}r?r.command=r.command.length>0?`${r.command}
3
- ${s}`:s:r={command:s,id:"(custom)"}}return r&&o.push(r),o},"parseStageScript"),Xe=q((e,o)=>{const t=g(e,o),r=[],s=new Set(pe);if(S(t))for(const n of de(t)){if(n.startsWith(".")||n==="_"||!s.has(n))continue;const i=g(t,n);if(!z(i).isFile())continue;const a=M(i),c=Qe(a);r.push({blocks:c,rawLineCount:a.split(`
4
- `).length,stage:n})}return r.sort((n,i)=>n.stage.localeCompare(i.stage)),{hooksDirectory:o,stages:r}},"listHooks"),Ye=q(e=>{const o=[];if(e.stages.length===0)return o.push(`No hooks installed in ${e.hooksDirectory}/.`),o;o.push(`Hooks in ${e.hooksDirectory}/:`);for(const t of e.stages)if(o.push("",`${t.stage} (${t.rawLineCount} lines)`),t.blocks.length===0)o.push(" (empty)");else for(const r of t.blocks){const s=r.name?`${r.id} — ${r.name}`:r.id;o.push(` - ${s}`);const n=r.command.split(`
5
- `).find(i=>i.trim()!=="");if(n){const i=n.length>120?`${n.slice(0,117)}...`:n;o.push(` ${i}`)}}return o},"formatListResult"),Ze=q((e,o)=>{const t=Xe(N(),e);for(const r of Ye(t))o.info(r)},"runList");var eo=Object.defineProperty,O=$((e,o)=>eo(e,"name",{value:o,configurable:!0}),"o$2");const ae=5;if(ie!==ae)throw new Error(`vis native binding ABI mismatch: expected ${ae}, got ${ie}. Rebuild via \`pnpm --filter @visulima/vis run build:native\` or reinstall the platform binding package.`);const $e={".releaserc":["release-config","vis-config"],".releaserc.json":["release-config","vis-config"],"aube-lock.yaml":["aube-lock","lockfile"],"aube-workspace.yaml":["aube-workspace","vis-config"],"nx.json":["nx-workspace","vis-config"],"packem.config.js":["packem-config","vis-config"],"packem.config.mjs":["packem-config","vis-config"],"packem.config.ts":["packem-config","vis-config"],"pnpm-workspace.yaml":["pnpm-workspace","vis-config"],"project.json":["nx-project","vis-config"],"turbo.json":["turbo-config","vis-config"],"vis.config.js":["vis-config"],"vis.config.ts":["vis-config"]},ve=[[".releaserc.json",["release-config","vis-config"]]],we=O(e=>{const o=new Set,t=Ve(e),r=$e[t];if(r)for(const n of r)o.add(n);const s=t.toLowerCase();for(const[n,i]of ve)if(s.endsWith(n))for(const a of i)o.add(a);return o},"classifyVis"),be=new Set([...Object.values($e).flat(),...ve.flatMap(([,e])=>e)]);let K;const xe=O(()=>(K||(K=new Set(qe())),K),"getPrekUniverse");O(e=>{const o=new Set(Ge(e)),t=we(e);return{all:new Set([...o,...t]),prek:o,vis:t}},"classify");const oo=O(e=>{const o=Je([...e]),t=new Map;for(const[r,s]of e.entries()){const n=new Set(o[r]),i=we(s),a=new Set([...n,...i]);t.set(s,{all:a,prek:n,vis:i})}return t},"classifyMany");O(e=>Ke(e),"parseShebang");const to=O(e=>xe().has(e)||be.has(e),"isKnownTag");O(e=>xe().has(e),"isPrekTag");O(e=>be.has(e),"isVisTag");const ro=O((e,o)=>{const{all:t}=e;if(o.types&&o.types.length>0){for(const r of o.types)if(!t.has(r))return!1}if(o.typesOr&&o.typesOr.length>0){let r=!1;for(const s of o.typesOr)if(t.has(s)){r=!0;break}if(!r)return!1}if(o.excludeTypes&&o.excludeTypes.length>0){for(const r of o.excludeTypes)if(t.has(r))return!1}return!0},"matchesFilter");var no=Object.defineProperty,P=$((e,o)=>no(e,"name",{value:o,configurable:!0}),"i$3");const so=P(e=>{let o=0;const{length:t}=e,r=P(()=>{for(;o<t&&/\s/.test(e[o]);)o+=1},"skipWs"),s=P(()=>{if(e[o]!=='"')throw new Error(`expected string at ${o}`);o+=1;const c=o;for(;o<t&&e[o]!=='"';)o+=e[o]==="\\"?2:1;const l=e.slice(c,o);return o+=1,JSON.parse(`"${l}"`)},"parseString"),n=P(()=>{switch(r(),e[o]){case'"':{s();break}case"[":{i();break}case"{":{a();break}default:for(;o<t&&!",}]".includes(e[o])&&!/\s/.test(e[o]);)o+=1}},"parseValue"),i=P(()=>{if(o+=1,r(),e[o]==="]"){o+=1;return}for(;o<t;)if(n(),r(),e[o]===",")o+=1,r();else if(e[o]==="]"){o+=1;return}},"parseArray"),a=P(()=>{o+=1,r();const c=new Set;if(e[o]==="}"){o+=1;return}for(;o<t;){r();const l=s();if(c.has(l))throw new Error(`Duplicate key: ${l}`);if(c.add(l),r(),e[o]!==":")throw new Error(`expected colon at ${o}`);if(o+=1,n(),r(),e[o]===",")o+=1,r();else if(e[o]==="}"){o+=1;return}}},"parseObject");r(),n()},"detectDuplicateJsonKeys"),io=P((e,o,t)=>{let r=0;for(const s of e){const n=B(g(t.root,s),"utf8");try{JSON.parse(n),so(n)}catch(i){const a=i instanceof Error?i.message:String(i);t.logger.info(`${s}: Failed to json decode (${a})`),r=1}}return r},"runCheckJson");var ao=Object.defineProperty,Ee=$((e,o)=>ao(e,"name",{value:o,configurable:!0}),"c$4");const co=Ee(e=>{const o=R("git",["rev-parse","--git-dir"],{cwd:e,encoding:"utf8"});if(o.status!==0)return!1;const t=o.stdout.trim(),r=t.startsWith("/")?t:g(e,t);return H(g(r,"MERGE_MSG"))?H(g(r,"MERGE_HEAD"))||H(g(r,"rebase-apply"))||H(g(r,"rebase-merge")):!1},"isInMerge"),fo=["<<<<<<< ","======= ",`=======\r
6
- `,`=======
7
- `,">>>>>>> "],lo=Ee((e,o,t)=>{if(!o.includes("--assume-in-merge")&&!co(t.root))return 0;let r=0;for(const s of e){const n=B(g(t.root,s),"utf8").split(`
8
- `);for(let i=0;i<n.length;i+=1){const a=n[i]+(i<n.length-1?`
9
- `:"");for(const c of fo)a.startsWith(c)&&(t.logger.info(`${s}:${i+1}: Merge conflict string ${JSON.stringify(c.trim())} found`),r=1)}}return r},"runCheckMergeConflict");var uo=Object.defineProperty,go=$((e,o)=>uo(e,"name",{value:o,configurable:!0}),"c$3");const po=go((e,o,t)=>{let r=0;for(const s of e){const n=g(t.root,s),i=B(n);if(i.length===0)continue;let a=i.length;const c=i[a-1];if(c!==10&&c!==13){x(n,Buffer.concat([i,Buffer.from([10])])),t.logger.info(`Fixing ${s}`),r=1;continue}for(;a>0&&(i[a-1]===10||i[a-1]===13);)a-=1;if(a===0){x(n,Buffer.alloc(0)),t.logger.info(`Fixing ${s}`),r=1;continue}const l=i.subarray(a);let d;l[0]===13&&l[1]===10?d=Buffer.from([13,10]):l[0]===13?d=Buffer.from([13]):d=Buffer.from([10]),!l.equals(d)&&(x(n,Buffer.concat([i.subarray(0,a),d])),t.logger.info(`Fixing ${s}`),r=1)}return r},"runEndOfFileFixer");var ho=Object.defineProperty,ce=$((e,o)=>ho(e,"name",{value:o,configurable:!0}),"h$2");const mo={cr:Buffer.from([13]),crlf:Buffer.from([13,10]),lf:Buffer.from([10])},ko=new Set(["auto","cr","crlf","lf","no"]),yo=ce((e,o,t)=>{let r="auto";for(let n=0;n<o.length;n+=1){const i=o[n];if(i==="-f"||i==="--fix"){n+=1;const a=o[n];if(a===void 0)return t.logger.error(`mixed-line-ending: ${i} requires a value (auto|no|lf|crlf|cr)`),2;r=a}else i.startsWith("--fix=")&&(r=i.slice(6))}if(!ko.has(r))return t.logger.error(`mixed-line-ending: invalid --fix value ${r}`),2;let s=0;for(const n of e){const i=g(t.root,n),a=B(i),c=[],l=ce(f=>{const p=c.find(b=>b.kind===f);p?p.count+=1:c.push({count:1,kind:f})},"bumpCount"),d=[];let u=0;for(let f=0;f<a.length;f+=1){const p=a[f];p===13&&a[f+1]===10?(d.push({content:a.subarray(u,f),ending:"crlf"}),l("crlf"),f+=1,u=f+1):p===13?(d.push({content:a.subarray(u,f),ending:"cr"}),l("cr"),u=f+1):p===10&&(d.push({content:a.subarray(u,f),ending:"lf"}),l("lf"),u=f+1)}u<a.length&&d.push({content:a.subarray(u),ending:null});const m=c.length>1;if(r==="no"){m&&(t.logger.info(`${n}: mixed line endings`),s=1);continue}let k;if(r==="auto"){if(!m)continue;let f;for(const p of c)(!f||p.count>f.count)&&(f=p);k=f?.kind}else if(k=r,!c.some(f=>f.kind!==k&&f.count>0))continue;const w=mo[k],h=[];for(const f of d)h.push(f.content),f.ending!==null&&h.push(w);x(i,Buffer.concat(h)),t.logger.info(`${n}: fixed mixed line endings`),s=1}return s},"runMixedLineEnding");var $o=Object.defineProperty,vo=$((e,o)=>$o(e,"name",{value:o,configurable:!0}),"g$3");const fe=new Set([9,11,12,13,32]),wo=/\.(?:md|markdown|mdown|mdx)$/i,bo=vo((e,o,t)=>{let r=0;for(const s of e){const n=wo.test(s),i=g(t.root,s),a=B(i),c=[];let l=0;for(;l<=a.length;){let u=l;for(;u<a.length&&a[u]!==10;)u+=1;const m=u<a.length&&a[u]===10;let k=u,w=!1;m&&u>l&&a[u-1]===13&&(w=!0,k=u-1);const h=a.subarray(l,k);let f=h.length;for(;f>0&&fe.has(h[f-1]);)f-=1;const p=h.some(b=>!fe.has(b));if(n&&h.length>=2&&h[h.length-1]===32&&h[h.length-2]===32&&p&&(f=Math.min(f+2,h.length)),c.push(h.subarray(0,f)),w&&c.push(Buffer.from([13])),m&&c.push(Buffer.from([10])),!m)break;l=u+1}const d=Buffer.concat(c);d.equals(a)||(x(i,d),t.logger.info(`Fixing ${s}`),r=1)}return r},"runTrailingWhitespace");var xo=Object.defineProperty,Se=$((e,o)=>xo(e,"name",{value:o,configurable:!0}),"t");const ee={"check-json":io,"check-merge-conflict":lo,"end-of-file-fixer":po,"mixed-line-ending":yo,"trailing-whitespace":bo},Eo=Object.keys(ee).sort();Se(e=>Object.hasOwn(ee,e),"isBuiltin");const So=Se(e=>ee[e],"getBuiltin");var Ro=Object.defineProperty,j=$((e,o)=>Ro(e,"name",{value:o,configurable:!0}),"r");const F="config.json",W=1,Oo=new Set(["alwaysRun","args","builtin","entry","exclude","excludeTypes","fail","files","id","name","passFilenames","types","typesOr","verbose"]),jo=new Set(["failFast","stages","version"]),Fo=["args","exclude","excludeTypes","files","passFilenames","types","typesOr"],Re=j((e,o)=>g(e,o,F),"configPath"),Q=j(e=>e!==null&&typeof e=="object"&&!Array.isArray(e),"isStringRecord"),D=j(e=>{if(!Array.isArray(e))return;const o=[];for(const t of e){if(typeof t!="string")return;o.push(t)}return o},"asStringArray"),L=j(e=>typeof e=="boolean"?e:void 0,"asBoolean"),C=j(e=>typeof e=="string"&&e.length>0?e:void 0,"asNonEmptyString"),Ao=j((e,o,t)=>{if(!Q(e))throw new TypeError("hook entry must be an object");if(typeof e.id!="string"||e.id.length===0)throw new TypeError("hook entry is missing `id`");const r={id:e.id},s=L(e.alwaysRun);s!==void 0&&(r.alwaysRun=s);const n=D(e.args);n&&(r.args=n);const i=C(e.builtin);i&&(r.builtin=i);const a=C(e.entry);a&&(r.entry=a);const c=C(e.exclude);c&&(r.exclude=c);const l=D(e.excludeTypes);l&&(r.excludeTypes=l);const d=C(e.fail);d&&(r.fail=d);const u=C(e.files);u&&(r.files=u);const m=C(e.name);m&&(r.name=m);const k=L(e.passFilenames);k!==void 0&&(r.passFilenames=k);const w=D(e.types);w&&(r.types=w);const h=D(e.typesOr);h&&(r.typesOr=h);const f=L(e.verbose);if(f!==void 0&&(r.verbose=f),[r.builtin,r.entry,r.fail].filter(p=>p!==void 0).length!==1)throw new TypeError(`hook "${r.id}" must set exactly one of \`builtin\`, \`entry\`, \`fail\``);if(r.fail!==void 0){const p=Fo.filter(b=>r[b]!==void 0);if(p.length>0)throw new TypeError(`hook "${r.id}" is a \`fail\` entry — remove ${p.join(", ")} (filters do not apply)`)}for(const p of Object.keys(e))Oo.has(p)||o.push({hookId:r.id,message:`unknown field "${p}" ignored`,stage:t});return r},"parseEntry"),Po=j((e,o)=>{if(!Q(e))throw new TypeError("hook config must be an object");if(e.version!==W)throw new TypeError(`unsupported hook config version: expected ${W}, got ${String(e.version)}`);if(!Q(e.stages))throw new TypeError("hook config is missing `stages` map");const t={};for(const[n,i]of Object.entries(e.stages)){if(!Array.isArray(i))throw new TypeError(`hook config: stage "${n}" must be an array`);t[n]=i.map(a=>Ao(a,o,n))}const r={stages:t,version:W},s=L(e.failFast);s!==void 0&&(r.failFast=s);for(const n of Object.keys(e))jo.has(n)||o.push({message:`unknown top-level field "${n}" ignored`});return r},"parseConfig"),Oe=j((e,o=Y,t)=>{const r=Re(e,o);if(!S(r))return;const s=M(r);let n;try{n=JSON.parse(s)}catch(i){const a=i instanceof Error?i.message:String(i);throw new TypeError(`failed to parse ${r}: ${a}`,{cause:i})}return Po(n,t??[])},"loadHookConfig"),_o=j((e,o,t)=>{const r=Re(e,o);x(r,`${JSON.stringify(t,void 0,4)}
10
- `,"utf8")},"writeHookConfig");var To=Object.defineProperty,v=$((e,o)=>To(e,"name",{value:o,configurable:!0}),"d");const Co=new Map([["pre-commit/pre-commit-hooks#check-json","check-json"],["pre-commit/pre-commit-hooks#check-merge-conflict","check-merge-conflict"],["pre-commit/pre-commit-hooks#end-of-file-fixer","end-of-file-fixer"],["pre-commit/pre-commit-hooks#mixed-line-ending","mixed-line-ending"],["pre-commit/pre-commit-hooks#trailing-whitespace","trailing-whitespace"]]),Io=/[<>=!~]=/,No=/github\.com[/:]([^/\s]+\/[^/\s.]+)/i,Mo="# Generated by `vis hook migrate` from prek",Bo=v(e=>`#!/usr/bin/env sh
11
- ${Mo}
12
- exec vis hook run ${e} "$@"
13
- `,"stageScriptBody"),oe=v(e=>{for(const o of Ne)if(S(g(e,o)))return o},"detectPrekConfig"),Ho=v(e=>Me[e]??e,"mapPrekStage"),Do=v(e=>No.exec(e)?.[1]??e,"normalizeRepoKey"),Wo=v(e=>{if(Io.test(e))return;if(e.startsWith("@")){const r=e.indexOf("@",1);if(r===-1)return{name:e,version:"latest"};const s=e.slice(r+1).trim();return{name:e.slice(0,r),version:s||"latest"}}const o=e.indexOf("@");if(o===-1)return{name:e,version:"latest"};const t=e.slice(o+1).trim();return{name:e.slice(0,o),version:t||"latest"}},"parseAdditionalDep"),Lo=v(e=>{const o=[];for(const t of[e.types,e.types_or,e.exclude_types])for(const r of t??[])to(r)||o.push(r);return o},"unknownTypes"),Vo=v((e,o)=>(e.stages&&e.stages.length>0?e.stages:o??["pre-commit"]).map(t=>Ho(t)),"resolveStages"),qo=v((e,o,t)=>{const r=e.id??"<unknown>",s=Z.has(o),n={id:r};return e.name&&(n.name=e.name),e.language==="fail"?(n.fail=e.entry??e.name??r,n):(t?n.builtin=t:e.entry&&(n.entry=e.entry),Array.isArray(e.args)&&e.args.length>0&&(n.args=[...e.args]),s||(e.files&&(n.files=e.files),e.exclude&&(n.exclude=e.exclude),e.types&&e.types.length>0&&(n.types=[...e.types]),e.types_or&&e.types_or.length>0&&(n.typesOr=[...e.types_or]),e.exclude_types&&e.exclude_types.length>0&&(n.excludeTypes=[...e.exclude_types])),(e.pass_filenames===!1||s)&&(n.passFilenames=!1),(e.always_run||s)&&(n.alwaysRun=!0),e.verbose&&(n.verbose=!0),n)},"buildHookEntry"),Go=v((e,o,t,r)=>{if(Array.isArray(e.additional_dependencies))for(const s of e.additional_dependencies){const n=Wo(s);if(!n){r.push(`"${o}": additional_dependency "${s}" uses a pip-style pin and cannot be added to package.json — install manually.`);continue}t.push({hookId:o,name:n.name,raw:s,version:n.version})}},"collectAdditionalDeps"),Jo=v(e=>{const o={},t=[],r=[],s=[],n=[];(e.files||e.exclude)&&r.push("top-level files/exclude filter dropped — apply it per hook if needed");for(const a of e.repos??[]){const c=a.repo??"<unknown>",l=c==="local",d=l?void 0:Do(c);for(const u of a.hooks??[]){const m=u.id??"<unknown>";let k;if(l){const f=u.language??"system";if(!Be.has(f)){t.push({hookId:m,reason:`language "${f}" needs an isolated toolchain — run via prek or reimplement as a system command`,repo:c});continue}if(f!=="fail"&&!u.entry){t.push({hookId:m,reason:"missing `entry`",repo:c});continue}}else if(d&&(k=Co.get(`${d}#${m}`)),!k){t.push({hookId:m,reason:`remote repo "${c}"@${a.rev??"?"} has no bundled equivalent — run via prek or replace with a system command`,repo:c});continue}Go(u,m,n,s);const w=Lo(u);w.length>0&&r.push(`hook "${m}": unsupported types ${w.join(", ")} — those entries are ignored by the dispatcher`);const h=Vo(u,e.default_stages);for(const f of h){if(f==="manual")continue;if(!He.has(f)){t.push({hookId:m,reason:`unsupported stage "${f}"`,repo:c});continue}const p=qo(u,f,k),b=o[f];b?b.push(p):o[f]=[p]}}}const i={stages:o,version:W};return e.fail_fast&&(i.failFast=!0),{additionalDeps:n,config:i,droppedFilters:r,manualSteps:s,skippedHooks:t}},"convertPrekConfig"),Ko=v(e=>{const o=De(e);if(o&&typeof o=="object")return o},"parsePrekConfig"),Uo=v(e=>{if(e.endsWith(".toml")){const t=We(e);return t&&typeof t=="object"?t:void 0}const o=M(e);return Ko(o)},"loadPrekConfig"),zo=v((e,o,t)=>{const r=g(e,"package.json"),s=[],n=[];if(!S(r)||o.length===0)return{added:s,skipped:n};const i=M(r),a=JSON.parse(i),c=a.devDependencies??{},l=a.dependencies??{};for(const u of o){if(u.name in c||u.name in l){n.push(u.name);continue}c[u.name]=u.version,s.push(u.name)}if(s.length===0)return{added:s,skipped:n};a.devDependencies=c;const d=Le(r,i,{defaultIndent:" ",useEditorconfig:t});return x(r,`${JSON.stringify(a,void 0,d)}
14
- `,"utf8"),{added:s,skipped:n}},"mergeAdditionalDependencies"),Qo=v((e,o)=>{const t=g(e,o);ye(t),x(g(t,"README.md"),["# Vis hook config","","`config.json` is the single source of truth for what each stage","script runs. Auto-generated by `vis hook migrate`. Edit by hand","or re-run the migrator after updating your prek config.","",`Bundled builtins: ${Eo.join(", ")}`,""].join(`
15
- `),"utf8")},"writeConfigReadme"),Xo=v((e,o)=>{R("prek",["--version"],{cwd:e,encoding:"utf8"}).status===0?R("prek",["uninstall"],{cwd:e,encoding:"utf8"}).status===0?o.info("Detached prek via `prek uninstall`."):o.info("`prek uninstall` did not exit cleanly — continuing. You may need to run it manually."):o.info("prek binary not found on PATH — skipping `prek uninstall`. Run it manually if prek is installed elsewhere.")},"detachPrek"),je=v((e,o,t,r={})=>{const s=oe(e),n=r.dryRun===!0;if(!s)return{isError:!0,message:"No prek configuration found (.pre-commit-config.yaml, .pre-commit-config.yml, or prek.toml)"};t.info(`Found prek config at ${s}`);const i=g(e,s),a=M(i),c=Uo(i);if(!c)return{isError:!0,message:`Could not parse ${s}`};const{additionalDeps:l,config:d,droppedFilters:u,manualSteps:m,skippedHooks:k}=Jo(c),w=Object.keys(d.stages);if(w.length===0&&k.length===0)return{isError:!0,message:`${s} has no hooks to migrate`};if(!n){const y=R("git",["config","--local","core.hooksPath"],{cwd:e,encoding:"utf8"});if(y.status===0){const J=y.stdout?.toString().trim();J&&(J.includes(".prek")||J.includes("prek-hooks"))&&R("git",["config","--local","--unset","core.hooksPath"],{cwd:e})}const T=he(o);if(T.isError)return T;T.message&&t.info(T.message)}const h=g(e,o);n||ye(h),n?t.info(` (would write) ${o}/${F}`):(_o(e,o,d),Qo(e,o),t.info(` Wrote ${o}/${F}`));let f=0;for(const y of w){const T=Bo(y);n?t.info(` (would write) ${o}/${y}`):(x(g(h,y),T,{mode:493}),t.info(` Wrote ${o}/${y}`)),f+=1}const{added:p,skipped:b}=n?{added:l.map(y=>y.name),skipped:[]}:zo(e,l,r.useEditorconfig);if(p.length>0){const y=n?"would add":"Added";t.info(`${y} ${p.length} package${p.length===1?"":"s"} to devDependencies: ${p.join(", ")}`),n||t.info("Run your package manager's install (e.g. `pnpm install`) to pick up the new devDependencies.")}b.length>0&&t.info(`Skipped ${b.length} already-declared package${b.length===1?"":"s"}: ${b.join(", ")}`),n||Xo(e,t);const se=`${i}.bak`;if(n?t.info(` (would remove) ${s} and back it up to ${s}.bak`):(S(se)||x(se,a,"utf8"),_e(i),t.info(`Removed ${s} (backup at ${s}.bak)`)),k.length>0){t.warn(`Skipped ${k.length} hook${k.length===1?"":"s"} that cannot run without prek:`);for(const y of k)t.warn(` - ${y.repo}::${y.hookId} — ${y.reason}`)}if(u.length>0){t.warn("Partial filter translations:");for(const y of u)t.warn(` - ${y}`)}if(m.length>0){t.warn("Manual follow-up required:");for(const y of m)t.warn(` - ${y}`)}return{isError:!1,message:`${n?"would migrate":"Migration complete:"} ${f} stage script${f===1?"":"s"} ${n?"into":"written to"} ${o}/`}},"migrateFromPrek");var Yo=Object.defineProperty,te=$((e,o)=>Yo(e,"name",{value:o,configurable:!0}),"i$2");const Zo=te(e=>{const o=[];let t=0;for(let r=0;r<e.length;r+=1)e[r]===0&&(r>t&&o.push(e.subarray(t,r).toString("utf8")),t=r+1);return t<e.length&&o.push(e.subarray(t).toString("utf8")),o},"splitNulBuffer"),U=te((e,o,t)=>{const r=R("git",[...e],{cwd:t,encoding:"buffer"});if(r.status!==0){const s=r.stderr?r.stderr.toString():"";throw new Error(`git ${o} failed${s?`: ${s.trim()}`:""}`)}return r.stdout.length===0?[]:Zo(r.stdout)},"gitListFiles"),et=te((e,o)=>{switch(e.kind){case"all":return U(["ls-files","-z"],"ls-files",o);case"range":return U(["diff","--name-only","--diff-filter=ACM","-z",e.fromRef,e.toRef],"diff --from-ref/--to-ref",o);case"staged":return U(["diff","--cached","--name-only","--diff-filter=ACM","-z"],"diff --cached",o);default:{const t=e;throw new Error(`unknown discover mode: ${JSON.stringify(t)}`)}}},"discoverFiles");var ot=Object.defineProperty,re=$((e,o)=>ot(e,"name",{value:o,configurable:!0}),"i$1");const le=re((e,o)=>{try{return new RegExp(e)}catch(t){const r=t instanceof Error?t.message:String(t);throw new Error(`invalid ${o} regex ${JSON.stringify(e)}: ${r}`,{cause:t})}},"compileRegex"),tt=re(e=>e.types&&e.types.length>0||e.typesOr&&e.typesOr.length>0||e.excludeTypes&&e.excludeTypes.length>0||!1,"hasTagFilters"),rt=re((e,o)=>{let t=e;if(o.files){const n=le(o.files,"files");t=t.filter(i=>n.test(i))}if(o.exclude){const n=le(o.exclude,"exclude");t=t.filter(i=>!n.test(i))}if(!tt(o))return[...t];const r=oo(t),s={excludeTypes:o.excludeTypes,types:o.types,typesOr:o.typesOr};return t.filter(n=>{const i=r.get(n);return i?ro(i,s):!1})},"applyHookFilter");var nt=Object.defineProperty,A=$((e,o)=>nt(e,"name",{value:o,configurable:!0}),"u$2");const st=32*1024,it=A((e,o)=>{const t=[],r=Math.max(1024,st-o);let s=[],n=0;for(const i of e){const a=Buffer.byteLength(i,"utf8")+8;n+a>r&&s.length>0&&(t.push(s),s=[],n=0),s.push(i),n+=a}return s.length>0&&t.push(s),t},"chunkFiles"),at=A(e=>({error:A(o=>{e.error(o)},"error"),info:A(o=>{e.info(o)},"info")}),"builtinLoggerFor"),ue=A((e,o,t)=>t?t.message:o?`terminated by signal ${o}`:`exited with status ${String(e)}`,"describeSpawnFailure"),ct=A((e,o,t,r,s)=>{const n=r?s.extraArgs:[];if(!t||o.length===0){const c=R("sh",["-c",e,"sh",...n],{cwd:s.root,stdio:"inherit"});return c.status===null?(s.logger.error(`hook command failed: ${ue(c.status,c.signal,c.error)}`),1):c.status}const i=Buffer.byteLength(e,"utf8")+Buffer.byteLength("sh","utf8")+Buffer.byteLength("-c","utf8")+n.reduce((c,l)=>c+Buffer.byteLength(l,"utf8")+8,0)+64;let a=0;for(const c of it(o,i)){const l=R("sh",["-c",`${e} "$@"`,"sh",...n,...c],{cwd:s.root,stdio:"inherit"});l.status===null?(s.logger.error(`hook command failed: ${ue(l.status,l.signal,l.error)}`),a|=1):a|=l.status}return a},"runShellCommand"),ft=A((e,o,t)=>{if(e.fail!==void 0)return t.logger.info(e.fail),1;const r=Z.has(t.stage);let s;try{s=rt(o,e)}catch(c){const l=c instanceof Error?c.message:String(c);return t.logger.error(`hook "${e.id}": ${l}`),2}if(s.length===0&&e.alwaysRun!==!0&&!r)return 0;const n=e.passFilenames!==!1;if(e.verbose){const c=e.name??e.id;t.logger.info(`+ ${c}`)}if(e.builtin){const c=So(e.builtin);if(!c)return t.logger.error(`unknown builtin "${e.builtin}" referenced by hook "${e.id}"`),2;const l={logger:at(t.logger),root:t.root};try{return c(s,e.args??[],l)}catch(d){const u=d instanceof Error?d.message:String(d);return t.logger.error(`builtin "${e.builtin}" crashed: ${u}`),1}}if(e.entry===void 0)return t.logger.error(`hook "${e.id}" has no \`entry\`, \`builtin\`, or \`fail\` to run`),2;const i=(e.args??[]).map(c=>`'${c.replaceAll("'",String.raw`'\''`)}'`).join(" "),a=i?`${e.entry} ${i}`:e.entry;return ct(a,s,n,r,t)},"runHookEntry"),lt=A((e,o,t,r)=>{const s=e.stages[o];if(!s||s.length===0)return 0;let n=0;for(const i of s){const a=ft(i,t,r);if(a!==0&&(n|=a,e.failFast))return n}return n},"runStage");var ut=Object.defineProperty,ne=$((e,o)=>ut(e,"name",{value:o,configurable:!0}),"s");const gt="pre-commit",dt=ne(e=>{if(e.lastCommit&&(e.fromRef||e.toRef))throw new Error("--last-commit cannot be combined with --from-ref or --to-ref");const o=e.lastCommit?"HEAD~1":e.fromRef,t=e.lastCommit?"HEAD":e.toRef;if(o&&!t||t&&!o)throw new Error("--from-ref and --to-ref must be specified together");return o&&t?{fromRef:o,kind:"range",toRef:t}:e.allFiles?{kind:"all"}:{kind:"staged"}},"resolveDiscoverMode"),pt=ne((e,o,t,r)=>{const s=t.stage??gt,n=Oe(e,o);if(!n)throw new Error(`No hook config found at ${o}/config.json. Install or migrate hooks first.`);const i=n.stages[s];if(!i||i.length===0)return r.info(`No hooks configured for stage "${s}".`),0;const a=Z.has(s)?void 0:dt(t),c=a?.kind==="all"?" (--all-files)":a?.kind==="range"?` (${a.fromRef}..${a.toRef})`:"";r.info(`Running ${s}${c}`);const l=a?et(a,e):[],d={extraArgs:t.extraArgs??[],logger:r,root:e,stage:s};return lt(n,s,l,d)},"runHookStage"),ht=ne((e,o,t)=>{const r=pt(N(),e,o,t);if(r!==0)throw new Error(`Hook stage exited with code ${r}`)},"runRun");var mt=Object.defineProperty,kt=$((e,o)=>mt(e,"name",{value:o,configurable:!0}),"e");const yt=kt((e=Y)=>{if(R("git",["config","--local","core.hooksPath"]).status!==0)return{isError:!1,message:"No custom hooks path configured"};const{status:o,stderr:t}=R("git",["config","--local","--unset","core.hooksPath"]);if(o===null)return{isError:!0,message:"git command not found"};if(o&&o!==5)return{isError:!0,message:String(t)};const r=g(e,"_");return S(r)&&Te(r,{force:!0,recursive:!0}),{isError:!1,message:""}},"uninstallHooks");var $t=Object.defineProperty,G=$((e,o)=>$t(e,"name",{value:o,configurable:!0}),"u");const vt=new Set(pe),wt=G(e=>{const o=R("sh",["-n",e],{encoding:"utf8"});if(o.status===null)return`failed to run "sh -n" (${o.error?.message??"unknown error"})`;if(o.status!==0)return o.stderr.trim()||`sh -n exited with ${o.status}`},"runSyntaxCheck"),bt=G((e,o)=>{const t=[],r=g(e,o),s=R("git",["config","--local","core.hooksPath"],{cwd:e,encoding:"utf8"});if(s.status===0){const i=s.stdout.trim(),a=`${o}/_`;i&&i!==a&&t.push({kind:"warning",message:`core.hooksPath is "${i}" — expected "${a}". Re-run \`vis hook install\` to fix.`})}else t.push({kind:"warning",message:"core.hooksPath is not set — run `vis hook install`."});if(S(g(r,"_"))||t.push({kind:"error",message:`Dispatcher directory ${o}/_ is missing. Run \`vis hook install\`.`}),!S(r))return t.push({kind:"error",message:`Hooks directory ${o}/ is missing.`}),{issues:t,ok:!1};let n=!1;for(const i of de(r)){if(i.startsWith(".")||i==="_"||i===F||i==="README.md")continue;if(!vt.has(i)){t.push({kind:"warning",message:`Unknown hook "${i}" — not a standard git hook.`,path:g(o,i)});continue}const a=g(r,i);if(!z(a).isFile())continue;n=!0;const c=z(a).mode&511;(c&64)===0&&t.push({kind:"warning",message:`Script is not owner-executable (mode ${c.toString(8)}).`,path:g(o,i)});const l=wt(a);l&&t.push({kind:"error",message:`Shell syntax error: ${l}`,path:g(o,i)})}if(n){const i=g(r,F);if(S(i))try{Oe(e,o)}catch(a){t.push({kind:"error",message:`${F} is malformed: ${a instanceof Error?a.message:String(a)}`,path:g(o,F)})}else t.push({kind:"error",message:`Stage scripts are present but ${o}/${F} is missing. Re-run \`vis hook migrate\`.`})}return{issues:t,ok:!t.some(i=>i.kind==="error")}},"validateHooks"),xt=G((e,o)=>{if(e.issues.length===0)return[`Hook directory ${o}/ looks good.`];const t=[];for(const r of e.issues){const s=r.kind==="error"?"ERROR":"WARN ",n=r.path?` (${r.path})`:"";t.push(`${s} ${r.message}${n}`)}return t.push("",e.ok?"No errors — warnings only.":`${e.issues.filter(r=>r.kind==="error").length} error(s).`),t},"formatValidationResult"),Et=G((e,o)=>{const t=bt(N(),e),r=xt(t,e);for(const s of r)s.startsWith("ERROR")||s.startsWith("WARN")?o.warn(s):o.info(s);if(!t.ok)throw new Error("Hook validation failed")},"runValidate");var St=Object.defineProperty,E=$((e,o)=>St(e,"name",{value:o,configurable:!0}),"i");const _=E(e=>e.hooksDir??Y,"resolveHooksDirectory"),ge=E(e=>new Promise(o=>{const t=Ie({input:process.stdin,output:process.stdout});t.question(`${e} (y/N) `,r=>{t.close();const s=r.trim().toLowerCase();o(s==="y"||s==="yes")})}),"confirmPrompt"),Rt=E(async(e,o,t)=>{const r=N(),s=me(r),n=oe(r);if(s&&n)throw new Error(`Found both husky (${s}/) and prek (${n}). Remove or migrate one before running \`vis hook install\`.`);if(s){if(o.info(`Existing husky installation found at ${s}/`),await ge("Would you like to migrate your husky hooks to vis?")){const a=ke(r,e,o,{useEditorconfig:t});if(a.isError)throw new Error(a.message);a.message&&o.info(a.message);return}o.info("Aborting install. Remove husky first or run 'vis hook migrate' to migrate.");return}if(n){if(o.info(`Existing prek configuration found at ${n}`),await ge("Would you like to migrate your prek hooks to vis?")){const a=je(r,e,o,{useEditorconfig:t});if(a.isError)throw new Error(a.message);a.message&&o.info(a.message);return}o.info("Aborting install. Remove the prek config first or run 'vis hook migrate' to migrate.");return}o.info(`Installing git hooks in ${e}/...`);const i=he(e);if(i.message){if(i.isError)throw new Error(i.message);o.info(i.message);return}S(g(r,e,"pre-commit"))||x(g(r,e,"pre-commit"),`#!/usr/bin/env sh
16
- `,{mode:493}),o.info("Git hooks installed successfully.")},"executeInstall"),Ot=E((e,o,t,r)=>{const s=N(),n=me(s),i=oe(s);if(n&&i)throw new Error(`Found both husky (${n}/) and prek (${i}). Migrate one at a time rename or remove one before retrying.`);if(!n&&!i)throw new Error("No husky (.husky/) or prek (.pre-commit-config.yaml / prek.toml) configuration found to migrate.");o&&t.info("(dry-run) no files will be written");const a=n?ke(s,e,t,{dryRun:o,useEditorconfig:r}):je(s,e,t,{dryRun:o,useEditorconfig:r});if(a.isError)throw new Error(a.message);a.message&&t.info(a.message)},"executeMigrate"),X="# vis:secrets-hook",jt=`#!/usr/bin/env sh
17
- ${X}
18
- # Scan staged files for secrets before each commit. Remove this block or the whole file to disable.
19
- pnpm exec vis secrets --staged --quiet || exit 1
20
- `,Ft=E((e,o,t)=>{if(e!=="secrets")throw new Error(`Unknown hook add target "${String(e)}". Currently supported: "secrets".`);const r=N(),s=g(r,o,"pre-commit");if(!S(g(r,o)))throw new Error(`Hooks directory ${o}/ does not exist. Run \`vis hook install\` first.`);if(S(s)){const n=M(s);if(n.includes(X)){t.info(`Secrets hook already present in ${s}.`);return}if(/\bvis secrets\b/.test(n)){t.warn(`Found a \`vis secrets\` invocation in ${s} without the managed marker — leaving it untouched.`);return}const i=`${n.trimEnd()}
21
-
22
- ${X}
23
- pnpm exec vis secrets --staged --quiet || exit 1
24
- `;x(s,i),Ce(s,493),t.info(`Appended secrets scan to ${s}.`);return}x(s,jt,{mode:493}),t.info(`Created ${s} with a secrets-scan pre-commit check.`)},"executeAdd"),At=E((e,o)=>{o.info("Removing git hooks...");const t=yt(e);if(t.message){if(t.isError)throw new Error(t.message);o.info(t.message);return}o.info("Git hooks removed successfully.")},"executeUninstall"),Pt=E(async({logger:e,options:o,visConfig:t})=>{await Rt(_(o),e,t?.editorconfig??!0)},"hookInstallImpl"),_t=E(({logger:e,options:o})=>{At(_(o),e)},"hookUninstallImpl"),Tt=E(({logger:e,options:o,visConfig:t})=>{Ot(_(o),!!o.dryRun,e,t?.editorconfig??!0)},"hookMigrateImpl"),Ct=E(({logger:e,options:o})=>{Ze(_(o),e)},"hookListImpl"),It=E(({logger:e,options:o})=>{Et(_(o),e)},"hookValidateImpl"),Nt=E(({argument:e,logger:o,options:t})=>{ht(_(t),{allFiles:!!t.allFiles,extraArgs:e.slice(1),fromRef:t.fromRef,lastCommit:!!t.lastCommit,stage:e[0],toRef:t.toRef},o)},"hookRunImpl"),Mt=E(({argument:e,logger:o,options:t})=>{Ft(e[0],_(t),o)},"hookAddImpl"),qt=Pt,Gt=_t,Jt=Tt,Kt=Ct,Ut=It,zt=Nt,Qt=Mt;export{Qt as hookAddExecute,qt as hookInstallExecute,Kt as hookListExecute,Jt as hookMigrateExecute,zt as hookRunExecute,Gt as hookUninstallExecute,Ut as hookValidateExecute};
1
+ var Fr=Object.defineProperty;var b=(n,e)=>Fr(n,"name",{value:e,configurable:!0});import{createRequire as Pr}from"node:module";import{E as ie,j as le,q as ft}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{projectGraphToDot as Hr}from"@visulima/task-runner";import{a5 as h,a6 as $,n as y,aG as Vr,aH as Kr,aI as Xr,aF as Yr,w as te,af as Qr,aJ as Jr,aK as mt,C as Zr,S as ei,k as ti,R as ri,s as ii}from"./bin.js";import{g as di}from"../packem_shared/_commonjsHelpers-CLblCigl.js";import{d as ci}from"../packem_shared/anolilab-text-CAM_E6uK.js";const Wr=Pr(import.meta.url),_e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,qe=b(n=>{if(typeof _e<"u"&&_e.versions&&_e.versions.node){const[e,t]=_e.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return _e.getBuiltinModule(n)}return Wr(n)},"__cjs_getBuiltinModule"),{readFileSync:qr,writeFileSync:Br}=qe("node:fs"),{createRequire:ni}=qe("node:module"),{join:oi,dirname:ai}=qe("node:path"),{EventEmitter:si}=qe("events");var li=Object.defineProperty,w=b((n,e)=>li(n,"name",{value:e,configurable:!0}),"h");function _t(){const n=arguments[0];for(let e=1,t=arguments.length;e<t;e++)if(arguments[e])for(const r in arguments[e])n[r]=arguments[e][r];return n}b(_t,"ft");w(_t,"assignPolyfill");let H=_t;typeof Object.assign=="function"&&(H=Object.assign);function Z(n,e,t,r){const i=n._nodes.get(e);let o=null;return i&&(r==="mixed"?o=i.out&&i.out[t]||i.undirected&&i.undirected[t]:r==="directed"?o=i.out&&i.out[t]:o=i.undirected&&i.undirected[t]),o}b(Z,"D$1");w(Z,"getMatchingEdge");function V(n){return typeof n=="object"&&n!==null}b(V,"G$1");w(V,"isPlainObject");function st(n){let e;for(e in n)return!1;return!0}b(st,"tt");w(st,"isEmpty");function J(n,e,t){Object.defineProperty(n,e,{enumerable:!1,configurable:!1,writable:!0,value:t})}b(J,"x");w(J,"privateProperty");function re(n,e,t){const r={enumerable:!0,configurable:!0};typeof t=="function"?r.get=t:(r.value=t,r.writable=!1),Object.defineProperty(n,e,r)}b(re,"A$1");w(re,"readOnlyProperty");function nt(n){return!(!V(n)||n.attributes&&!Array.isArray(n.attributes))}b(nt,"Q");w(nt,"validateHints");function Dt(){let n=Math.floor(Math.random()*256)&255;return()=>n++}b(Dt,"pt");w(Dt,"incrementalIdStartingFromRandomByte");function oe(){const n=arguments;let e=null,t=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(e===null){if(t++,t>=n.length)return{done:!0};e=n[t][Symbol.iterator]()}if(r=e.next(),r.done){e=null;continue}break}while(!0);return r}}}b(oe,"N$1");w(oe,"chain");function me(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}b(me,"L$2");w(me,"emptyIterator");let dt=class extends Error{static{b(this,"P")}static{w(this,"GraphError")}constructor(e){super(),this.name="GraphError",this.message=e}},E=class Mt extends dt{static{b(this,"g")}static{w(this,"InvalidArgumentsGraphError")}constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Mt.prototype.constructor)}},v=class It extends dt{static{b(this,"p")}static{w(this,"NotFoundGraphError")}constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,It.prototype.constructor)}},C=class Lt extends dt{static{b(this,"y")}static{w(this,"UsageGraphError")}constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Lt.prototype.constructor)}};function ct(n,e){this.key=n,this.attributes=e,this.clear()}b(ct,"et");w(ct,"MixedNodeData");ct.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 lt(n,e){this.key=n,this.attributes=e,this.clear()}b(lt,"it");w(lt,"DirectedNodeData");lt.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function ht(n,e){this.key=n,this.attributes=e,this.clear()}b(ht,"nt");w(ht,"UndirectedNodeData");ht.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function be(n,e,t,r,i){this.key=e,this.attributes=i,this.undirected=n,this.source=t,this.target=r}b(be,"M$1");w(be,"EdgeData");be.prototype.attach=function(){let n="out",e="in";this.undirected&&(n=e="undirected");const t=this.source.key,r=this.target.key;this.source[n][r]=this,!(this.undirected&&t===r)&&(this.target[e][t]=this)};be.prototype.attachMulti=function(){let n="out",e="in";const t=this.source.key,r=this.target.key;this.undirected&&(n=e="undirected");const i=this.source[n],o=i[r];if(typeof o>"u"){i[r]=this,this.undirected&&t===r||(this.target[e][t]=this);return}o.previous=this,this.next=o,i[r]=this,this.target[e][t]=this};be.prototype.detach=function(){const n=this.source.key,e=this.target.key;let t="out",r="in";this.undirected&&(t=r="undirected"),delete this.source[t][e],delete this.target[r][n]};be.prototype.detachMulti=function(){const n=this.source.key,e=this.target.key;let t="out",r="in";this.undirected&&(t=r="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][e],delete this.target[r][n]):(this.next.previous=void 0,this.source[t][e]=this.next,this.target[r][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const Tt=0,Ot=1,hi=2,zt=3;function ae(n,e,t,r,i,o,a){let s,d,c,u;if(r=""+r,t===Tt){if(s=n._nodes.get(r),!s)throw new v(`Graph.${e}: could not find the "${r}" node in the graph.`);c=i,u=o}else if(t===zt){if(i=""+i,d=n._edges.get(i),!d)throw new v(`Graph.${e}: could not find the "${i}" edge in the graph.`);const l=d.source.key,g=d.target.key;if(r===l)s=d.target;else if(r===g)s=d.source;else throw new v(`Graph.${e}: the "${r}" node is not attached to the "${i}" edge (${l}, ${g}).`);c=o,u=a}else{if(d=n._edges.get(r),!d)throw new v(`Graph.${e}: could not find the "${r}" edge in the graph.`);t===Ot?s=d.source:s=d.target,c=i,u=o}return[s,c,u]}b(ae,"S$2");w(ae,"findRelevantNodeData");function Rt(n,e,t){n.prototype[e]=function(r,i,o){const[a,s]=ae(this,e,t,r,i,o);return a.attributes[s]}}b(Rt,"gt");w(Rt,"attachNodeAttributeGetter");function Ut(n,e,t){n.prototype[e]=function(r,i){const[o]=ae(this,e,t,r,i);return o.attributes}}b(Ut,"yt");w(Ut,"attachNodeAttributesGetter");function Ft(n,e,t){n.prototype[e]=function(r,i,o){const[a,s]=ae(this,e,t,r,i,o);return a.attributes.hasOwnProperty(s)}}b(Ft,"wt");w(Ft,"attachNodeAttributeChecker");function Pt(n,e,t){n.prototype[e]=function(r,i,o,a){const[s,d,c]=ae(this,e,t,r,i,o,a);return s.attributes[d]=c,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:d}),this}}b(Pt,"mt");w(Pt,"attachNodeAttributeSetter");function Wt(n,e,t){n.prototype[e]=function(r,i,o,a){const[s,d,c]=ae(this,e,t,r,i,o,a);if(typeof c!="function")throw new E(`Graph.${e}: updater should be a function.`);const u=s.attributes,l=c(u[d]);return u[d]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:d}),this}}b(Wt,"bt");w(Wt,"attachNodeAttributeUpdater");function qt(n,e,t){n.prototype[e]=function(r,i,o){const[a,s]=ae(this,e,t,r,i,o);return delete a.attributes[s],this.emit("nodeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:s}),this}}b(qt,"$t");w(qt,"attachNodeAttributeRemover");function Bt(n,e,t){n.prototype[e]=function(r,i,o){const[a,s]=ae(this,e,t,r,i,o);if(!V(s))throw new E(`Graph.${e}: provided attributes are not a plain object.`);return a.attributes=s,this.emit("nodeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}b(Bt,"Gt");w(Bt,"attachNodeAttributesReplacer");function Ht(n,e,t){n.prototype[e]=function(r,i,o){const[a,s]=ae(this,e,t,r,i,o);if(!V(s))throw new E(`Graph.${e}: provided attributes are not a plain object.`);return H(a.attributes,s),this.emit("nodeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:s}),this}}b(Ht,"Et");w(Ht,"attachNodeAttributesMerger");function Vt(n,e,t){n.prototype[e]=function(r,i,o){const[a,s]=ae(this,e,t,r,i,o);if(typeof s!="function")throw new E(`Graph.${e}: provided updater is not a function.`);return a.attributes=s(a.attributes),this.emit("nodeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}b(Vt,"kt");w(Vt,"attachNodeAttributesUpdater");const pi=[{name:w(n=>`get${n}Attribute`,"name"),attacher:Rt},{name:w(n=>`get${n}Attributes`,"name"),attacher:Ut},{name:w(n=>`has${n}Attribute`,"name"),attacher:Ft},{name:w(n=>`set${n}Attribute`,"name"),attacher:Pt},{name:w(n=>`update${n}Attribute`,"name"),attacher:Wt},{name:w(n=>`remove${n}Attribute`,"name"),attacher:qt},{name:w(n=>`replace${n}Attributes`,"name"),attacher:Bt},{name:w(n=>`merge${n}Attributes`,"name"),attacher:Ht},{name:w(n=>`update${n}Attributes`,"name"),attacher:Vt}];function Kt(n){pi.forEach(function({name:e,attacher:t}){t(n,e("Node"),Tt),t(n,e("Source"),Ot),t(n,e("Target"),hi),t(n,e("Opposite"),zt)})}b(Kt,"xt");w(Kt,"attachNodeAttributesMethods");function Xt(n,e,t){n.prototype[e]=function(r,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new C(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new C(`Graph.${e}: 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.`);const a=""+r,s=""+i;if(i=arguments[2],o=Z(this,a,s,t),!o)throw new v(`Graph.${e}: could not find an edge for the given path ("${a}" - "${s}").`)}else{if(t!=="mixed")throw new C(`Graph.${e}: 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(r=""+r,o=this._edges.get(r),!o)throw new v(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return o.attributes[i]}}b(Xt,"Dt");w(Xt,"attachEdgeAttributeGetter");function Yt(n,e,t){n.prototype[e]=function(r){let i;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new C(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new C(`Graph.${e}: 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.`);const o=""+r,a=""+arguments[1];if(i=Z(this,o,a,t),!i)throw new v(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new C(`Graph.${e}: 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(r=""+r,i=this._edges.get(r),!i)throw new v(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return i.attributes}}b(Yt,"At");w(Yt,"attachEdgeAttributesGetter");function Qt(n,e,t){n.prototype[e]=function(r,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new C(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new C(`Graph.${e}: 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.`);const a=""+r,s=""+i;if(i=arguments[2],o=Z(this,a,s,t),!o)throw new v(`Graph.${e}: could not find an edge for the given path ("${a}" - "${s}").`)}else{if(t!=="mixed")throw new C(`Graph.${e}: 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(r=""+r,o=this._edges.get(r),!o)throw new v(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return o.attributes.hasOwnProperty(i)}}b(Qt,"vt");w(Qt,"attachEdgeAttributeChecker");function Jt(n,e,t){n.prototype[e]=function(r,i,o){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new C(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new C(`Graph.${e}: 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.`);const s=""+r,d=""+i;if(i=arguments[2],o=arguments[3],a=Z(this,s,d,t),!a)throw new v(`Graph.${e}: could not find an edge for the given path ("${s}" - "${d}").`)}else{if(t!=="mixed")throw new C(`Graph.${e}: 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(r=""+r,a=this._edges.get(r),!a)throw new v(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return a.attributes[i]=o,this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:i}),this}}b(Jt,"Nt");w(Jt,"attachEdgeAttributeSetter");function Zt(n,e,t){n.prototype[e]=function(r,i,o){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new C(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new C(`Graph.${e}: 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.`);const s=""+r,d=""+i;if(i=arguments[2],o=arguments[3],a=Z(this,s,d,t),!a)throw new v(`Graph.${e}: could not find an edge for the given path ("${s}" - "${d}").`)}else{if(t!=="mixed")throw new C(`Graph.${e}: 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(r=""+r,a=this._edges.get(r),!a)throw new v(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(typeof o!="function")throw new E(`Graph.${e}: updater should be a function.`);return a.attributes[i]=o(a.attributes[i]),this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:i}),this}}b(Zt,"St");w(Zt,"attachEdgeAttributeUpdater");function er(n,e,t){n.prototype[e]=function(r,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new C(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new C(`Graph.${e}: 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.`);const a=""+r,s=""+i;if(i=arguments[2],o=Z(this,a,s,t),!o)throw new v(`Graph.${e}: could not find an edge for the given path ("${a}" - "${s}").`)}else{if(t!=="mixed")throw new C(`Graph.${e}: 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(r=""+r,o=this._edges.get(r),!o)throw new v(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return delete o.attributes[i],this.emit("edgeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:i}),this}}b(er,"Ut");w(er,"attachEdgeAttributeRemover");function tr(n,e,t){n.prototype[e]=function(r,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new C(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new C(`Graph.${e}: 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.`);const a=""+r,s=""+i;if(i=arguments[2],o=Z(this,a,s,t),!o)throw new v(`Graph.${e}: could not find an edge for the given path ("${a}" - "${s}").`)}else{if(t!=="mixed")throw new C(`Graph.${e}: 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(r=""+r,o=this._edges.get(r),!o)throw new v(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(!V(i))throw new E(`Graph.${e}: provided attributes are not a plain object.`);return o.attributes=i,this.emit("edgeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}b(tr,"Lt");w(tr,"attachEdgeAttributesReplacer");function rr(n,e,t){n.prototype[e]=function(r,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new C(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new C(`Graph.${e}: 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.`);const a=""+r,s=""+i;if(i=arguments[2],o=Z(this,a,s,t),!o)throw new v(`Graph.${e}: could not find an edge for the given path ("${a}" - "${s}").`)}else{if(t!=="mixed")throw new C(`Graph.${e}: 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(r=""+r,o=this._edges.get(r),!o)throw new v(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(!V(i))throw new E(`Graph.${e}: provided attributes are not a plain object.`);return H(o.attributes,i),this.emit("edgeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:i}),this}}b(rr,"Mt");w(rr,"attachEdgeAttributesMerger");function ir(n,e,t){n.prototype[e]=function(r,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new C(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new C(`Graph.${e}: 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.`);const a=""+r,s=""+i;if(i=arguments[2],o=Z(this,a,s,t),!o)throw new v(`Graph.${e}: could not find an edge for the given path ("${a}" - "${s}").`)}else{if(t!=="mixed")throw new C(`Graph.${e}: 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(r=""+r,o=this._edges.get(r),!o)throw new v(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(typeof i!="function")throw new E(`Graph.${e}: provided updater is not a function.`);return o.attributes=i(o.attributes),this.emit("edgeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}b(ir,"Ct");w(ir,"attachEdgeAttributesUpdater");const ui=[{name:w(n=>`get${n}Attribute`,"name"),attacher:Xt},{name:w(n=>`get${n}Attributes`,"name"),attacher:Yt},{name:w(n=>`has${n}Attribute`,"name"),attacher:Qt},{name:w(n=>`set${n}Attribute`,"name"),attacher:Jt},{name:w(n=>`update${n}Attribute`,"name"),attacher:Zt},{name:w(n=>`remove${n}Attribute`,"name"),attacher:er},{name:w(n=>`replace${n}Attributes`,"name"),attacher:tr},{name:w(n=>`merge${n}Attributes`,"name"),attacher:rr},{name:w(n=>`update${n}Attributes`,"name"),attacher:ir}];function nr(n){ui.forEach(function({name:e,attacher:t}){t(n,e("Edge"),"mixed"),t(n,e("DirectedEdge"),"directed"),t(n,e("UndirectedEdge"),"undirected")})}b(nr,"It");w(nr,"attachEdgeAttributesMethods");const gi=[{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 or(n,e,t,r){let i=!1;for(const o in e){if(o===r)continue;const a=e[o];if(i=t(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),n&&i)return a.key}}b(or,"Ot");w(or,"forEachSimple");function ar(n,e,t,r){let i,o,a,s=!1;for(const d in e)if(d!==r){i=e[d];do{if(o=i.source,a=i.target,s=t(i.key,i.attributes,o.key,a.key,o.attributes,a.attributes,i.undirected),n&&s)return i.key;i=i.next}while(i!==void 0)}}b(ar,"Wt");w(ar,"forEachMulti");function Pe(n,e){const t=Object.keys(n),r=t.length;let i,o=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(o>=r)return{done:!0};const a=t[o++];if(a===e){i=void 0;continue}i=n[a]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}b(Pe,"K");w(Pe,"createIterator");function sr(n,e,t,r){const i=e[t];if(!i)return;const o=i.source,a=i.target;if(r(i.key,i.attributes,o.key,a.key,o.attributes,a.attributes,i.undirected)&&n)return i.key}b(sr,"Kt");w(sr,"forEachForKeySimple");function dr(n,e,t,r){let i=e[t];if(!i)return;let o=!1;do{if(o=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),n&&o)return i.key;i=i.next}while(i!==void 0)}b(dr,"Tt");w(dr,"forEachForKeyMulti");function We(n,e){let t=n[e];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const i={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};return t=t.next,{done:!1,value:i}}};let r=!1;return{[Symbol.iterator](){return this},next(){return r===!0?{done:!0}:(r=!0,{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}})}}}b(We,"T$3");w(We,"createIteratorForKey");function cr(n,e){if(n.size===0)return[];if(e==="mixed"||e===n.type)return Array.from(n._edges.keys());const t=e==="undirected"?n.undirectedSize:n.directedSize,r=new Array(t),i=e==="undirected",o=n._edges.values();let a=0,s,d;for(;s=o.next(),s.done!==!0;)d=s.value,d.undirected===i&&(r[a++]=d.key);return r}b(cr,"Pt");w(cr,"createEdgeArray");function pt(n,e,t,r){if(e.size===0)return;const i=t!=="mixed"&&t!==e.type,o=t==="undirected";let a,s,d=!1;const c=e._edges.values();for(;a=c.next(),a.done!==!0;){if(s=a.value,i&&s.undirected!==o)continue;const{key:u,attributes:l,source:g,target:x}=s;if(d=r(u,l,g.key,x.key,g.attributes,x.attributes,s.undirected),n&&d)return u}}b(pt,"at");w(pt,"forEachEdge");function lr(n,e){if(n.size===0)return me();const t=e!=="mixed"&&e!==n.type,r=e==="undirected",i=n._edges.values();return{[Symbol.iterator](){return this},next(){let o,a;for(;;){if(o=i.next(),o.done)return o;if(a=o.value,!(t&&a.undirected!==r))break}return{value:{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},done:!1}}}}b(lr,"Ft");w(lr,"createEdgeIterator");function Be(n,e,t,r,i,o){const a=e?ar:or;let s;if(t!=="undirected"&&(r!=="out"&&(s=a(n,i.in,o),n&&s)||r!=="in"&&(s=a(n,i.out,o,r?void 0:i.key),n&&s))||t!=="directed"&&(s=a(n,i.undirected,o),n&&s))return s}b(Be,"F$1");w(Be,"forEachEdgeForNode");function hr(n,e,t,r){const i=[];return Be(!1,n,e,t,r,function(o){i.push(o)}),i}b(hr,"Bt");w(hr,"createEdgeArrayForNode");function pr(n,e,t){let r=me();return n!=="undirected"&&(e!=="out"&&typeof t.in<"u"&&(r=oe(r,Pe(t.in))),e!=="in"&&typeof t.out<"u"&&(r=oe(r,Pe(t.out,e?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(r=oe(r,Pe(t.undirected))),r}b(pr,"Rt");w(pr,"createEdgeIteratorForNode");function He(n,e,t,r,i,o,a){const s=t?dr:sr;let d;if(e!=="undirected"&&(typeof i.in<"u"&&r!=="out"&&(d=s(n,i.in,o,a),n&&d)||typeof i.out<"u"&&r!=="in"&&(r||i.key!==o)&&(d=s(n,i.out,o,a),n&&d))||e!=="directed"&&typeof i.undirected<"u"&&(d=s(n,i.undirected,o,a),n&&d))return d}b(He,"B");w(He,"forEachEdgeForPath");function ur(n,e,t,r,i){const o=[];return He(!1,n,e,t,r,i,function(a){o.push(a)}),o}b(ur,"Yt");w(ur,"createEdgeArrayForPath");function gr(n,e,t,r){let i=me();return n!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&r in t.in&&(i=oe(i,We(t.in,r))),typeof t.out<"u"&&e!=="in"&&r in t.out&&(e||t.key!==r)&&(i=oe(i,We(t.out,r)))),n!=="directed"&&typeof t.undirected<"u"&&r in t.undirected&&(i=oe(i,We(t.undirected,r))),i}b(gr,"Ht");w(gr,"createEdgeIteratorForPath");function fr(n,e){const{name:t,type:r,direction:i}=e;n.prototype[t]=function(o,a){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];if(!arguments.length)return cr(this,r);if(arguments.length===1){o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new v(`Graph.${t}: could not find the "${o}" node in the graph.`);return hr(this.multi,r==="mixed"?this.type:r,i,s)}if(arguments.length===2){o=""+o,a=""+a;const s=this._nodes.get(o);if(!s)throw new v(`Graph.${t}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(a))throw new v(`Graph.${t}: could not find the "${a}" target node in the graph.`);return ur(r,this.multi,i,s,a)}throw new E(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}b(fr,"Jt");w(fr,"attachEdgeArrayCreator");function mr(n,e){const{name:t,type:r,direction:i}=e,o="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(c,u,l){if(!(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)){if(arguments.length===1)return l=c,pt(!1,this,r,l);if(arguments.length===2){c=""+c,l=u;const g=this._nodes.get(c);if(typeof g>"u")throw new v(`Graph.${o}: could not find the "${c}" node in the graph.`);return Be(!1,this.multi,r==="mixed"?this.type:r,i,g,l)}if(arguments.length===3){c=""+c,u=""+u;const g=this._nodes.get(c);if(!g)throw new v(`Graph.${o}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(u))throw new v(`Graph.${o}: could not find the "${u}" target node in the graph.`);return He(!1,r,this.multi,i,g,u,l)}throw new E(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const a="map"+t[0].toUpperCase()+t.slice(1);n.prototype[a]=function(){const c=Array.prototype.slice.call(arguments),u=c.pop();let l;if(c.length===0){let g=0;r!=="directed"&&(g+=this.undirectedSize),r!=="undirected"&&(g+=this.directedSize),l=new Array(g);let x=0;c.push((j,A,G,D,R,U,T)=>{l[x++]=u(j,A,G,D,R,U,T)})}else l=[],c.push((g,x,j,A,G,D,R)=>{l.push(u(g,x,j,A,G,D,R))});return this[o].apply(this,c),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(){const c=Array.prototype.slice.call(arguments),u=c.pop(),l=[];return c.push((g,x,j,A,G,D,R)=>{u(g,x,j,A,G,D,R)&&l.push(g)}),this[o].apply(this,c),l};const d="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[d]=function(){let c=Array.prototype.slice.call(arguments);if(c.length<2||c.length>4)throw new E(`Graph.${d}: invalid number of arguments (expecting 2, 3 or 4 and got ${c.length}).`);if(typeof c[c.length-1]=="function"&&typeof c[c.length-2]!="function")throw new E(`Graph.${d}: 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.`);let u,l;c.length===2?(u=c[0],l=c[1],c=[]):c.length===3?(u=c[1],l=c[2],c=[c[0]]):c.length===4&&(u=c[2],l=c[3],c=[c[0],c[1]]);let g=l;return c.push((x,j,A,G,D,R,U)=>{g=u(g,x,j,A,G,D,R,U)}),this[o].apply(this,c),g}}b(mr,"Vt");w(mr,"attachForEachEdge");function br(n,e){const{name:t,type:r,direction:i}=e,o="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(d,c,u){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return!1;if(arguments.length===1)return u=d,pt(!0,this,r,u);if(arguments.length===2){d=""+d,u=c;const l=this._nodes.get(d);if(typeof l>"u")throw new v(`Graph.${o}: could not find the "${d}" node in the graph.`);return Be(!0,this.multi,r==="mixed"?this.type:r,i,l,u)}if(arguments.length===3){d=""+d,c=""+c;const l=this._nodes.get(d);if(!l)throw new v(`Graph.${o}: could not find the "${d}" source node in the graph.`);if(!this._nodes.has(c))throw new v(`Graph.${o}: could not find the "${c}" target node in the graph.`);return He(!0,r,this.multi,i,l,c,u)}throw new E(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const a="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(){const d=Array.prototype.slice.call(arguments),c=d.pop();return d.push((u,l,g,x,j,A,G)=>c(u,l,g,x,j,A,G)),!!this[o].apply(this,d)};const s="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(){const d=Array.prototype.slice.call(arguments),c=d.pop();return d.push((u,l,g,x,j,A,G)=>!c(u,l,g,x,j,A,G)),!this[o].apply(this,d)}}b(br,"qt");w(br,"attachFindEdge");function wr(n,e){const{name:t,type:r,direction:i}=e,o=t.slice(0,-1)+"Entries";n.prototype[o]=function(a,s){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return me();if(!arguments.length)return lr(this,r);if(arguments.length===1){a=""+a;const d=this._nodes.get(a);if(!d)throw new v(`Graph.${o}: could not find the "${a}" node in the graph.`);return pr(r,i,d)}if(arguments.length===2){a=""+a,s=""+s;const d=this._nodes.get(a);if(!d)throw new v(`Graph.${o}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(s))throw new v(`Graph.${o}: could not find the "${s}" target node in the graph.`);return gr(r,i,d,s)}throw new E(`Graph.${o}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}b(wr,"Qt");w(wr,"attachEdgeIteratorCreator");function yr(n){gi.forEach(e=>{fr(n,e),mr(n,e),br(n,e),wr(n,e)})}b(yr,"Xt");w(yr,"attachEdgeIterationMethods");const fi=[{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 Ie(){this.A=null,this.B=null}b(Ie,"W");w(Ie,"CompositeSetWrapper");Ie.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};Ie.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function $e(n,e,t,r,i){for(const o in r){const a=r[o],s=a.source,d=a.target,c=s===t?d:s;if(e&&e.has(c.key))continue;const u=i(c.key,c.attributes);if(n&&u)return c.key}}b($e,"I$1");w($e,"forEachInObjectOnce");function Ve(n,e,t,r,i){if(e!=="mixed"){if(e==="undirected")return $e(n,null,r,r.undirected,i);if(typeof t=="string")return $e(n,null,r,r[t],i)}const o=new Ie;let a;if(e!=="undirected"){if(t!=="out"){if(a=$e(n,null,r,r.in,i),n&&a)return a;o.wrap(r.in)}if(t!=="in"){if(a=$e(n,o,r,r.out,i),n&&a)return a;o.wrap(r.out)}}if(e!=="directed"&&(a=$e(n,o,r,r.undirected,i),n&&a))return a}b(Ve,"R$1");w(Ve,"forEachNeighbor");function xr(n,e,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof e=="string")return Object.keys(t[e])}const r=[];return Ve(!1,n,e,t,function(i){r.push(i)}),r}b(xr,"te$1");w(xr,"createNeighborArrayForNode");function Ge(n,e,t){const r=Object.keys(t),i=r.length;let o=0;return{[Symbol.iterator](){return this},next(){let a=null;do{if(o>=i)return n&&n.wrap(t),{done:!0};const s=t[r[o++]],d=s.source,c=s.target;if(a=d===e?c:d,n&&n.has(a.key)){a=null;continue}}while(a===null);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}}}}b(Ge,"j");w(Ge,"createDedupedObjectIterator");function vr(n,e,t){if(n!=="mixed"){if(n==="undirected")return Ge(null,t,t.undirected);if(typeof e=="string")return Ge(null,t,t[e])}let r=me();const i=new Ie;return n!=="undirected"&&(e!=="out"&&(r=oe(r,Ge(i,t,t.in))),e!=="in"&&(r=oe(r,Ge(i,t,t.out)))),n!=="directed"&&(r=oe(r,Ge(i,t,t.undirected))),r}b(vr,"ee$1");w(vr,"createNeighborIterator");function kr(n,e){const{name:t,type:r,direction:i}=e;n.prototype[t]=function(o){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];o=""+o;const a=this._nodes.get(o);if(typeof a>"u")throw new v(`Graph.${t}: could not find the "${o}" node in the graph.`);return xr(r==="mixed"?this.type:r,i,a)}}b(kr,"ie");w(kr,"attachNeighborArrayCreator");function Er(n,e){const{name:t,type:r,direction:i}=e,o="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(c,u){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;c=""+c;const l=this._nodes.get(c);if(typeof l>"u")throw new v(`Graph.${o}: could not find the "${c}" node in the graph.`);Ve(!1,r==="mixed"?this.type:r,i,l,u)};const a="map"+t[0].toUpperCase()+t.slice(1);n.prototype[a]=function(c,u){const l=[];return this[o](c,(g,x)=>{l.push(u(g,x))}),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(c,u){const l=[];return this[o](c,(g,x)=>{u(g,x)&&l.push(g)}),l};const d="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[d]=function(c,u,l){if(arguments.length<3)throw new E(`Graph.${d}: 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.`);let g=l;return this[o](c,(x,j)=>{g=u(g,x,j)}),g}}b(Er,"ne");w(Er,"attachForEachNeighbor");function $r(n,e){const{name:t,type:r,direction:i}=e,o=t[0].toUpperCase()+t.slice(1,-1),a="find"+o;n.prototype[a]=function(c,u){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;c=""+c;const l=this._nodes.get(c);if(typeof l>"u")throw new v(`Graph.${a}: could not find the "${c}" node in the graph.`);return Ve(!0,r==="mixed"?this.type:r,i,l,u)};const s="some"+o;n.prototype[s]=function(c,u){return!!this[a](c,u)};const d="every"+o;n.prototype[d]=function(c,u){return!this[a](c,(l,g)=>!u(l,g))}}b($r,"re");w($r,"attachFindNeighbor");function Gr(n,e){const{name:t,type:r,direction:i}=e,o=t.slice(0,-1)+"Entries";n.prototype[o]=function(a){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return me();a=""+a;const s=this._nodes.get(a);if(typeof s>"u")throw new v(`Graph.${o}: could not find the "${a}" node in the graph.`);return vr(r==="mixed"?this.type:r,i,s)}}b(Gr,"oe");w(Gr,"attachNeighborIteratorCreator");function jr(n){fi.forEach(e=>{kr(n,e),Er(n,e),$r(n,e),Gr(n,e)})}b(jr,"se");w(jr,"attachNeighborIterationMethods");function Me(n,e,t,r,i){const o=r._nodes.values(),a=r.type;let s,d,c,u,l,g,x;for(;s=o.next(),s.done!==!0;){let j=!1;if(d=s.value,a!=="undirected"){u=d.out;for(c in u){l=u[c];do{if(g=l.target,j=!0,x=i(d.key,g.key,d.attributes,g.attributes,l.key,l.attributes,l.undirected),n&&x)return l;l=l.next}while(l)}}if(a!=="directed"){u=d.undirected;for(c in u)if(!(e&&d.key>c)){l=u[c];do{if(g=l.target,g.key!==c&&(g=l.source),j=!0,x=i(d.key,g.key,d.attributes,g.attributes,l.key,l.attributes,l.undirected),n&&x)return l;l=l.next}while(l)}}if(t&&!j&&(x=i(d.key,null,d.attributes,null,null,null,null),n&&x))return null}}b(Me,"O");w(Me,"forEachAdjacency");function Ar(n,e){const t={key:n};return st(e.attributes)||(t.attributes=H({},e.attributes)),t}b(Ar,"ae");w(Ar,"serializeNode");function Sr(n,e,t){const r={key:e,source:t.source.key,target:t.target.key};return st(t.attributes)||(r.attributes=H({},t.attributes)),n==="mixed"&&t.undirected&&(r.undirected=!0),r}b(Sr,"ue");w(Sr,"serializeEdge");function Nr(n){if(!V(n))throw new E('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new E("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!V(n.attributes)||n.attributes===null))throw new E("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}b(Nr,"de");w(Nr,"validateSerializedNode");function Cr(n){if(!V(n))throw new E('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new E("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new E("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!V(n.attributes)||n.attributes===null))throw new E("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new E("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}b(Cr,"he");w(Cr,"validateSerializedEdge");const mi=Dt(),bi=new Set(["directed","undirected","mixed"]),bt=new Set(["domain","_events","_eventsCount","_maxListeners"]),wi=[{name:w(n=>`${n}Edge`,"name"),generateKey:!0},{name:w(n=>`${n}DirectedEdge`,"name"),generateKey:!0,type:"directed"},{name:w(n=>`${n}UndirectedEdge`,"name"),generateKey:!0,type:"undirected"},{name:w(n=>`${n}EdgeWithKey`,"name")},{name:w(n=>`${n}DirectedEdgeWithKey`,"name"),type:"directed"},{name:w(n=>`${n}UndirectedEdgeWithKey`,"name"),type:"undirected"}],yi={allowSelfLoops:!0,multi:!1,type:"mixed"};function _r(n,e,t){if(t&&!V(t))throw new E(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(e=""+e,t=t||{},n._nodes.has(e))throw new C(`Graph.addNode: the "${e}" node already exist in the graph.`);const r=new n.NodeDataClass(e,t);return n._nodes.set(e,r),n.emit("nodeAdded",{key:e,attributes:t}),r}b(_r,"ge");w(_r,"addNode");function ot(n,e,t){const r=new n.NodeDataClass(e,t);return n._nodes.set(e,r),n.emit("nodeAdded",{key:e,attributes:t}),r}b(ot,"Z");w(ot,"unsafeAddNode");function ut(n,e,t,r,i,o,a,s){if(!r&&n.type==="undirected")throw new C(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&n.type==="directed")throw new C(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!V(s))throw new E(`Graph.${e}: invalid attributes. Expecting an object but got "${s}"`);if(o=""+o,a=""+a,s=s||{},!n.allowSelfLoops&&o===a)throw new C(`Graph.${e}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const d=n._nodes.get(o),c=n._nodes.get(a);if(!d)throw new v(`Graph.${e}: source node "${o}" not found.`);if(!c)throw new v(`Graph.${e}: target node "${a}" not found.`);const u={key:null,undirected:r,source:o,target:a,attributes:s};if(t)i=n._edgeKeyGenerator();else if(i=""+i,n._edges.has(i))throw new C(`Graph.${e}: the "${i}" edge already exists in the graph.`);if(!n.multi&&(r?typeof d.undirected[a]<"u":typeof d.out[a]<"u"))throw new C(`Graph.${e}: an edge linking "${o}" to "${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.`);const l=new be(r,i,d,c,s);n._edges.set(i,l);const g=o===a;return r?(d.undirectedDegree++,c.undirectedDegree++,g&&(d.undirectedLoops++,n._undirectedSelfLoopCount++)):(d.outDegree++,c.inDegree++,g&&(d.directedLoops++,n._directedSelfLoopCount++)),n.multi?l.attachMulti():l.attach(),r?n._undirectedSize++:n._directedSize++,u.key=i,n.emit("edgeAdded",u),i}b(ut,"ut");w(ut,"addEdge");function Dr(n,e,t,r,i,o,a,s,d){if(!r&&n.type==="undirected")throw new C(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&n.type==="directed")throw new C(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(d){if(typeof s!="function")throw new E(`Graph.${e}: invalid updater function. Expecting a function but got "${s}"`)}else if(!V(s))throw new E(`Graph.${e}: invalid attributes. Expecting an object but got "${s}"`)}o=""+o,a=""+a;let c;if(d&&(c=s,s=void 0),!n.allowSelfLoops&&o===a)throw new C(`Graph.${e}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u=n._nodes.get(o),l=n._nodes.get(a),g,x;if(!t&&(g=n._edges.get(i),g)){if((g.source.key!==o||g.target.key!==a)&&(!r||g.source.key!==a||g.target.key!==o))throw new C(`Graph.${e}: inconsistency detected when attempting to merge the "${i}" edge with "${o}" source & "${a}" target vs. ("${g.source.key}", "${g.target.key}").`);x=g}if(!x&&!n.multi&&u&&(x=r?u.undirected[a]:u.out[a]),x){const R=[x.key,!1,!1,!1];if(d?!c:!s)return R;if(d){const U=x.attributes;x.attributes=c(U),n.emit("edgeAttributesUpdated",{type:"replace",key:x.key,attributes:x.attributes})}else H(x.attributes,s),n.emit("edgeAttributesUpdated",{type:"merge",key:x.key,attributes:x.attributes,data:s});return R}s=s||{},d&&c&&(s=c(s));const j={key:null,undirected:r,source:o,target:a,attributes:s};if(t)i=n._edgeKeyGenerator();else if(i=""+i,n._edges.has(i))throw new C(`Graph.${e}: the "${i}" edge already exists in the graph.`);let A=!1,G=!1;u||(u=ot(n,o,{}),A=!0,o===a&&(l=u,G=!0)),l||(l=ot(n,a,{}),G=!0),g=new be(r,i,u,l,s),n._edges.set(i,g);const D=o===a;return r?(u.undirectedDegree++,l.undirectedDegree++,D&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,l.inDegree++,D&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?g.attachMulti():g.attach(),r?n._undirectedSize++:n._directedSize++,j.key=i,n.emit("edgeAdded",j),[i,!0,A,G]}b(Dr,"ye");w(Dr,"mergeEdge");function fe(n,e){n._edges.delete(e.key);const{source:t,target:r,attributes:i}=e,o=e.undirected,a=t===r;o?(t.undirectedDegree--,r.undirectedDegree--,a&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,r.inDegree--,a&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?e.detachMulti():e.detach(),o?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:e.key,attributes:i,source:t.key,target:r.key,undirected:o})}b(fe,"U$1");w(fe,"dropEdgeFromData");let P=class at extends si{static{b(this,"m")}static{w(this,"Graph")}constructor(e){if(super(),e=H({},yi,e),typeof e.multi!="boolean")throw new E(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!bi.has(e.type))throw new E(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new E(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const t=e.type==="mixed"?ct:e.type==="directed"?lt:ht;J(this,"NodeDataClass",t);const r="geid_"+mi()+"_";let i=0;const o=w(()=>{let a;do a=r+i++;while(this._edges.has(a));return a},"edgeKeyGenerator");J(this,"_attributes",{}),J(this,"_nodes",new Map),J(this,"_edges",new Map),J(this,"_directedSize",0),J(this,"_undirectedSize",0),J(this,"_directedSelfLoopCount",0),J(this,"_undirectedSelfLoopCount",0),J(this,"_edgeKeyGenerator",o),J(this,"_options",e),bt.forEach(a=>J(this,a,this[a])),re(this,"order",()=>this._nodes.size),re(this,"size",()=>this._edges.size),re(this,"directedSize",()=>this._directedSize),re(this,"undirectedSize",()=>this._undirectedSize),re(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),re(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),re(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),re(this,"multi",this._options.multi),re(this,"type",this._options.type),re(this,"allowSelfLoops",this._options.allowSelfLoops),re(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){const r=""+e,i=this._edges.get(r);return!!i&&!i.undirected}else if(arguments.length===2){e=""+e,t=""+t;const r=this._nodes.get(e);return r?r.out.hasOwnProperty(t):!1}throw new E(`Graph.hasDirectedEdge: invalid arity (${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.`)}hasUndirectedEdge(e,t){if(this.type==="directed")return!1;if(arguments.length===1){const r=""+e,i=this._edges.get(r);return!!i&&i.undirected}else if(arguments.length===2){e=""+e,t=""+t;const r=this._nodes.get(e);return r?r.undirected.hasOwnProperty(t):!1}throw new E(`Graph.hasDirectedEdge: invalid arity (${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.`)}hasEdge(e,t){if(arguments.length===1){const r=""+e;return this._edges.has(r)}else if(arguments.length===2){e=""+e,t=""+t;const r=this._nodes.get(e);return r?typeof r.out<"u"&&r.out.hasOwnProperty(t)||typeof r.undirected<"u"&&r.undirected.hasOwnProperty(t):!1}throw new E(`Graph.hasEdge: invalid arity (${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.`)}directedEdge(e,t){if(this.type==="undirected")return;if(e=""+e,t=""+t,this.multi)throw new C("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const r=this._nodes.get(e);if(!r)throw new v(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new v(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const i=r.out&&r.out[t]||void 0;if(i)return i.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new C("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const r=this._nodes.get(e);if(!r)throw new v(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new v(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const i=r.undirected&&r.undirected[t]||void 0;if(i)return i.key}edge(e,t){if(this.multi)throw new C("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new v(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new v(`Graph.edge: could not find the "${t}" target node in the graph.`);const i=r.out&&r.out[t]||r.undirected&&r.undirected[t]||void 0;if(i)return i.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new v(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in r.in||t in r.out}areOutNeighbors(e,t){e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new v(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in r.out}areInNeighbors(e,t){e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new v(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in r.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new v(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:t in r.undirected}areNeighbors(e,t){e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new v(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(t in r.in||t in r.out)||this.type!=="directed"&&t in r.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new v(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in r.in||this.type!=="directed"&&t in r.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new v(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in r.out||this.type!=="directed"&&t in r.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=t.undirectedDegree),this.type!=="undirected"&&(r+=t.inDegree),r}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=t.undirectedDegree),this.type!=="undirected"&&(r+=t.outDegree),r}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.degree: could not find the "${e}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=t.undirectedDegree),this.type!=="undirected"&&(r+=t.inDegree+t.outDegree),r}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let r=0,i=0;return this.type!=="directed"&&(r+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(r+=t.inDegree,i+=t.directedLoops),r-i}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let r=0,i=0;return this.type!=="directed"&&(r+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(r+=t.outDegree,i+=t.directedLoops),r-i}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let r=0,i=0;return this.type!=="directed"&&(r+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(r+=t.inDegree+t.outDegree,i+=t.directedLoops*2),r-i}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new v(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;const t=this._edges.get(e);if(!t)throw new v(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;const t=this._edges.get(e);if(!t)throw new v(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;const r=this._edges.get(t);if(!r)throw new v(`Graph.opposite: could not find the "${t}" edge in the graph.`);const i=r.source.key,o=r.target.key;if(e===i)return o;if(e===o)return i;throw new v(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${i}, ${o}).`)}hasExtremity(e,t){e=""+e,t=""+t;const r=this._edges.get(e);if(!r)throw new v(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return r.source.key===t||r.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new v(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new v(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;const t=this._edges.get(e);if(!t)throw new v(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return _r(this,e,t).key}mergeNode(e,t){if(t&&!V(t))throw new E(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let r=this._nodes.get(e);return r?(t&&(H(r.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:r.attributes,data:t})),[e,!1]):(r=new this.NodeDataClass(e,t),this._nodes.set(e,r),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!="function")throw new E(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let r=this._nodes.get(e);if(r){if(t){const o=r.attributes;r.attributes=t(o),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:r.attributes})}return[e,!1]}const i=t?t({}):{};return r=new this.NodeDataClass(e,i),this._nodes.set(e,r),this.emit("nodeAdded",{key:e,attributes:i}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new v(`Graph.dropNode: could not find the "${e}" node in the graph.`);let r;if(this.type!=="undirected"){for(const i in t.out){r=t.out[i];do fe(this,r),r=r.next;while(r)}for(const i in t.in){r=t.in[i];do fe(this,r),r=r.next;while(r)}}if(this.type!=="directed")for(const i in t.undirected){r=t.undirected[i];do fe(this,r),r=r.next;while(r)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const r=""+arguments[0],i=""+arguments[1];if(t=Z(this,r,i,this.type),!t)throw new v(`Graph.dropEdge: could not find the "${r}" -> "${i}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new v(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return fe(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new C("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 C("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;const r=Z(this,e,t,"directed");if(!r)throw new v(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return fe(this,r),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new C("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 C("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.");const r=Z(this,e,t,"undirected");if(!r)throw new v(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return fe(this,r),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!="function")throw new E("Graph.updateAttribute: updater should be a function.");const r=this._attributes[e];return this._attributes[e]=t(r),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!V(e))throw new E("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!V(e))throw new E("Graph.mergeAttributes: provided attributes are not a plain object.");return H(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new E("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!="function")throw new E("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!nt(t))throw new E("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const r=this._nodes.values();let i,o;for(;i=r.next(),i.done!==!0;)o=i.value,o.attributes=e(o.key,o.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!="function")throw new E("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!nt(t))throw new E("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const r=this._edges.values();let i,o,a,s;for(;i=r.next(),i.done!==!0;)o=i.value,a=o.source,s=o.target,o.attributes=e(o.key,o.attributes,a.key,s.key,a.attributes,s.attributes,o.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new E("Graph.forEachAdjacencyEntry: expecting a callback.");Me(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new E("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Me(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new E("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Me(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new E("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Me(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!="function")throw new E("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let r,i;for(;r=t.next(),r.done!==!0;)i=r.value,e(i.key,i.attributes)}findNode(e){if(typeof e!="function")throw new E("Graph.findNode: expecting a callback.");const t=this._nodes.values();let r,i;for(;r=t.next(),r.done!==!0;)if(i=r.value,e(i.key,i.attributes))return i.key}mapNodes(e){if(typeof e!="function")throw new E("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let r,i;const o=new Array(this.order);let a=0;for(;r=t.next(),r.done!==!0;)i=r.value,o[a++]=e(i.key,i.attributes);return o}someNode(e){if(typeof e!="function")throw new E("Graph.someNode: expecting a callback.");const t=this._nodes.values();let r,i;for(;r=t.next(),r.done!==!0;)if(i=r.value,e(i.key,i.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new E("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let r,i;for(;r=t.next(),r.done!==!0;)if(i=r.value,!e(i.key,i.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new E("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let r,i;const o=[];for(;r=t.next(),r.done!==!0;)i=r.value,e(i.key,i.attributes)&&o.push(i.key);return o}reduceNodes(e,t){if(typeof e!="function")throw new E("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new E("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.");let r=t;const i=this._nodes.values();let o,a;for(;o=i.next(),o.done!==!0;)a=o.value,r=e(r,a.key,a.attributes);return r}nodeEntries(){const e=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=e.next();if(t.done)return t;const r=t.value;return{value:{node:r.key,attributes:r.attributes},done:!1}}}}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((i,o)=>{e[t++]=Ar(o,i)});const r=new Array(this._edges.size);return t=0,this._edges.forEach((i,o)=>{r[t++]=Sr(this.type,o,i)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:r}}import(e,t=!1){if(e instanceof at)return e.forEachNode((d,c)=>{t?this.mergeNode(d,c):this.addNode(d,c)}),e.forEachEdge((d,c,u,l,g,x,j)=>{t?j?this.mergeUndirectedEdgeWithKey(d,u,l,c):this.mergeDirectedEdgeWithKey(d,u,l,c):j?this.addUndirectedEdgeWithKey(d,u,l,c):this.addDirectedEdgeWithKey(d,u,l,c)}),this;if(!V(e))throw new E("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!V(e.attributes))throw new E("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let r,i,o,a,s;if(e.nodes){if(o=e.nodes,!Array.isArray(o))throw new E("Graph.import: invalid nodes. Expecting an array.");for(r=0,i=o.length;r<i;r++){a=o[r],Nr(a);const{key:d,attributes:c}=a;t?this.mergeNode(d,c):this.addNode(d,c)}}if(e.edges){let d=!1;if(this.type==="undirected"&&(d=!0),o=e.edges,!Array.isArray(o))throw new E("Graph.import: invalid edges. Expecting an array.");for(r=0,i=o.length;r<i;r++){s=o[r],Cr(s);const{source:c,target:u,attributes:l,undirected:g=d}=s;let x;"key"in s?(x=t?g?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:g?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,x.call(this,s.key,c,u,l)):(x=t?g?this.mergeUndirectedEdge:this.mergeDirectedEdge:g?this.addUndirectedEdge:this.addDirectedEdge,x.call(this,c,u,l))}}return this}nullCopy(e){const t=new at(H({},this._options,e));return t.replaceAttributes(H({},this.getAttributes())),t}emptyCopy(e){const t=this.nullCopy(e);return this._nodes.forEach((r,i)=>{const o=H({},r.attributes);r=new t.NodeDataClass(i,o),t._nodes.set(i,r)}),t}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new C(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${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 C("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 C("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.");const t=this.emptyCopy(e),r=this._edges.values();let i,o;for(;i=r.next(),i.done!==!0;)o=i.value,ut(t,"copy",!1,o.undirected,o.key,o.source.key,o.target.key,H({},o.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((o,a)=>{e[a]=o.attributes});const t={},r={};this._edges.forEach((o,a)=>{const s=o.undirected?"--":"->";let d="",c=o.source.key,u=o.target.key,l;o.undirected&&c>u&&(l=c,c=u,u=l);const g=`(${c})${s}(${u})`;a.startsWith("geid_")?this.multi&&(typeof r[g]>"u"?r[g]=0:r[g]++,d+=`${r[g]}. `):d+=`[${a}]: `,d+=g,t[d]=o.attributes});const i={};for(const o in this)this.hasOwnProperty(o)&&!bt.has(o)&&typeof this[o]!="function"&&typeof o!="symbol"&&(i[o]=this[o]);return i.attributes=this._attributes,i.nodes=e,i.edges=t,J(i,"constructor",this.constructor),i}};typeof Symbol<"u"&&(P.prototype[Symbol.for("nodejs.util.inspect.custom")]=P.prototype.inspect);wi.forEach(n=>{["add","merge","update"].forEach(e=>{const t=n.name(e),r=e==="add"?ut:Dr;n.generateKey?P.prototype[t]=function(i,o,a){return r(this,t,!0,(n.type||this.type)==="undirected",null,i,o,a,e==="update")}:P.prototype[t]=function(i,o,a,s){return r(this,t,!1,(n.type||this.type)==="undirected",i,o,a,s,e==="update")}})});Kt(P);nr(P);yr(P);jr(P);class Mr extends P{static{b(this,"Y")}static{w(this,"DirectedGraph")}constructor(e){const t=H({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new E("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new E('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}let Ir=class extends P{static{b(this,"H")}static{w(this,"UndirectedGraph")}constructor(e){const t=H({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new E("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new E('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}},Lr=class extends P{static{b(this,"J")}static{w(this,"MultiGraph")}constructor(e){const t=H({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new E("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}};class Tr extends P{static{b(this,"V")}static{w(this,"MultiDirectedGraph")}constructor(e){const t=H({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new E("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new E('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Or extends P{static{b(this,"q")}static{w(this,"MultiUndirectedGraph")}constructor(e){const t=H({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new E("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new E('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function we(n){n.from=function(e,t){const r=H({},e.options,t),i=new n(r);return i.import(e),i}}b(we,"C$1");w(we,"attachStaticFromMethod");we(P);we(Mr);we(Ir);we(Lr);we(Tr);we(Or);P.Graph=P;P.DirectedGraph=Mr;P.UndirectedGraph=Ir;P.MultiGraph=Lr;P.MultiDirectedGraph=Tr;P.MultiUndirectedGraph=Or;P.InvalidArgumentsGraphError=E;P.NotFoundGraphError=v;P.UsageGraphError=C;var et,wt;function xi(){if(wt)return et;wt=1;var n=Object.defineProperty,e=b((t,r)=>n(t,"name",{value:r,configurable:!0}),"e");return et=e(function(t){return t!==null&&typeof t=="object"&&typeof t.addUndirectedEdgeWithKey=="function"&&typeof t.dropNode=="function"&&typeof t.multi=="boolean"},"isGraph"),et}b(xi,"requireIsGraph");var De={},yt;function vi(){if(yt)return De;yt=1;var n=Object.defineProperty,e=b((o,a)=>n(o,"name",{value:a,configurable:!0}),"o");function t(o){return typeof o!="number"||isNaN(o)?1:o}b(t,"coerceWeight"),e(t,"coerceWeight");function r(o,a){var s={},d=e(function(l){return typeof l>"u"?a:l},"coerceToDefault");typeof a=="function"&&(d=a);var c=e(function(l){return d(l[o])},"get"),u=e(function(){return d(void 0)},"returnDefault");return typeof o=="string"?(s.fromAttributes=c,s.fromGraph=function(l,g){return c(l.getNodeAttributes(g))},s.fromEntry=function(l,g){return c(g)}):typeof o=="function"?(s.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},s.fromGraph=function(l,g){return d(o(g,l.getNodeAttributes(g)))},s.fromEntry=function(l,g){return d(o(l,g))}):(s.fromAttributes=u,s.fromGraph=u,s.fromEntry=u),s}b(r,"createNodeValueGetter"),e(r,"createNodeValueGetter");function i(o,a){var s={},d=e(function(l){return typeof l>"u"?a:l},"coerceToDefault");typeof a=="function"&&(d=a);var c=e(function(l){return d(l[o])},"get"),u=e(function(){return d(void 0)},"returnDefault");return typeof o=="string"?(s.fromAttributes=c,s.fromGraph=function(l,g){return c(l.getEdgeAttributes(g))},s.fromEntry=function(l,g){return c(g)},s.fromPartialEntry=s.fromEntry,s.fromMinimalEntry=s.fromEntry):typeof o=="function"?(s.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},s.fromGraph=function(l,g){var x=l.extremities(g);return d(o(g,l.getEdgeAttributes(g),x[0],x[1],l.getNodeAttributes(x[0]),l.getNodeAttributes(x[1]),l.isUndirected(g)))},s.fromEntry=function(l,g,x,j,A,G,D){return d(o(l,g,x,j,A,G,D))},s.fromPartialEntry=function(l,g,x,j){return d(o(l,g,x,j))},s.fromMinimalEntry=function(l,g){return d(o(l,g))}):(s.fromAttributes=u,s.fromGraph=u,s.fromEntry=u,s.fromMinimalEntry=u),s}return b(i,"createEdgeValueGetter"),e(i,"createEdgeValueGetter"),De.createNodeValueGetter=r,De.createEdgeValueGetter=i,De.createEdgeWeightGetter=function(o){return i(o,t)},De}b(vi,"requireGetters");var tt,xt;function ki(){if(xt)return tt;xt=1;var n=Object.defineProperty,e=b((N,p)=>n(N,"name",{value:p,configurable:!0}),"$"),t=0,r=1,i=2,o=3,a=4,s=5,d=6,c=7,u=8,l=9,g=0,x=1,j=2,A=0,G=1,D=2,R=3,U=4,T=5,B=6,Y=7,Q=8,Se=3,X=10,Ye=3,I=9,L=10;return tt=e(function(N,p,ye){var Qe,k,f,F,q,he,xe,K,M,Je,ne=p.length,Rr=ye.length,Ne=N.adjustSizes,Ur=N.barnesHutTheta*N.barnesHutTheta,Le,W,O,z,se,_,S,m=[];for(f=0;f<ne;f+=X)p[f+a]=p[f+i],p[f+s]=p[f+o],p[f+i]=0,p[f+o]=0;if(N.outboundAttractionDistribution){for(Le=0,f=0;f<ne;f+=X)Le+=p[f+d];Le/=ne/X}if(N.barnesHutOptimize){var pe=1/0,ve=-1/0,ue=1/0,ke=-1/0,ee,Ee,Ze;for(f=0;f<ne;f+=X)pe=Math.min(pe,p[f+t]),ve=Math.max(ve,p[f+t]),ue=Math.min(ue,p[f+r]),ke=Math.max(ke,p[f+r]);var Te=ve-pe,Oe=ke-ue;for(Te>Oe?(ue-=(Te-Oe)/2,ke=ue+Te):(pe-=(Oe-Te)/2,ve=pe+Oe),m[0+A]=-1,m[0+G]=(pe+ve)/2,m[0+D]=(ue+ke)/2,m[0+R]=Math.max(ve-pe,ke-ue),m[0+U]=-1,m[0+T]=-1,m[0+B]=0,m[0+Y]=0,m[0+Q]=0,Qe=1,f=0;f<ne;f+=X)for(k=0,Ze=Se;;)if(m[k+T]>=0){p[f+t]<m[k+G]?p[f+r]<m[k+D]?ee=m[k+T]:ee=m[k+T]+I:p[f+r]<m[k+D]?ee=m[k+T]+I*2:ee=m[k+T]+I*3,m[k+Y]=(m[k+Y]*m[k+B]+p[f+t]*p[f+d])/(m[k+B]+p[f+d]),m[k+Q]=(m[k+Q]*m[k+B]+p[f+r]*p[f+d])/(m[k+B]+p[f+d]),m[k+B]+=p[f+d],k=ee;continue}else if(m[k+A]<0){m[k+A]=f;break}else{if(m[k+T]=Qe*I,K=m[k+R]/2,M=m[k+T],m[M+A]=-1,m[M+G]=m[k+G]-K,m[M+D]=m[k+D]-K,m[M+R]=K,m[M+U]=M+I,m[M+T]=-1,m[M+B]=0,m[M+Y]=0,m[M+Q]=0,M+=I,m[M+A]=-1,m[M+G]=m[k+G]-K,m[M+D]=m[k+D]+K,m[M+R]=K,m[M+U]=M+I,m[M+T]=-1,m[M+B]=0,m[M+Y]=0,m[M+Q]=0,M+=I,m[M+A]=-1,m[M+G]=m[k+G]+K,m[M+D]=m[k+D]-K,m[M+R]=K,m[M+U]=M+I,m[M+T]=-1,m[M+B]=0,m[M+Y]=0,m[M+Q]=0,M+=I,m[M+A]=-1,m[M+G]=m[k+G]+K,m[M+D]=m[k+D]+K,m[M+R]=K,m[M+U]=m[k+U],m[M+T]=-1,m[M+B]=0,m[M+Y]=0,m[M+Q]=0,Qe+=4,p[m[k+A]+t]<m[k+G]?p[m[k+A]+r]<m[k+D]?ee=m[k+T]:ee=m[k+T]+I:p[m[k+A]+r]<m[k+D]?ee=m[k+T]+I*2:ee=m[k+T]+I*3,m[k+B]=p[m[k+A]+d],m[k+Y]=p[m[k+A]+t],m[k+Q]=p[m[k+A]+r],m[ee+A]=m[k+A],m[k+A]=-1,p[f+t]<m[k+G]?p[f+r]<m[k+D]?Ee=m[k+T]:Ee=m[k+T]+I:p[f+r]<m[k+D]?Ee=m[k+T]+I*2:Ee=m[k+T]+I*3,ee===Ee)if(Ze--){k=ee;continue}else{Ze=Se;break}m[Ee+A]=f;break}}if(N.barnesHutOptimize)for(W=N.scalingRatio,f=0;f<ne;f+=X)for(k=0;;)if(m[k+T]>=0)if(_=Math.pow(p[f+t]-m[k+Y],2)+Math.pow(p[f+r]-m[k+Q],2),Je=m[k+R],4*Je*Je/_<Ur){if(O=p[f+t]-m[k+Y],z=p[f+r]-m[k+Q],Ne===!0?_>0?(S=W*p[f+d]*m[k+B]/_,p[f+i]+=O*S,p[f+o]+=z*S):_<0&&(S=-W*p[f+d]*m[k+B]/Math.sqrt(_),p[f+i]+=O*S,p[f+o]+=z*S):_>0&&(S=W*p[f+d]*m[k+B]/_,p[f+i]+=O*S,p[f+o]+=z*S),k=m[k+U],k<0)break;continue}else{k=m[k+T];continue}else{if(he=m[k+A],he>=0&&he!==f&&(O=p[f+t]-p[he+t],z=p[f+r]-p[he+r],_=O*O+z*z,Ne===!0?_>0?(S=W*p[f+d]*p[he+d]/_,p[f+i]+=O*S,p[f+o]+=z*S):_<0&&(S=-W*p[f+d]*p[he+d]/Math.sqrt(_),p[f+i]+=O*S,p[f+o]+=z*S):_>0&&(S=W*p[f+d]*p[he+d]/_,p[f+i]+=O*S,p[f+o]+=z*S)),k=m[k+U],k<0)break;continue}else for(W=N.scalingRatio,F=0;F<ne;F+=X)for(q=0;q<F;q+=X)O=p[F+t]-p[q+t],z=p[F+r]-p[q+r],Ne===!0?(_=Math.sqrt(O*O+z*z)-p[F+u]-p[q+u],_>0?(S=W*p[F+d]*p[q+d]/_/_,p[F+i]+=O*S,p[F+o]+=z*S,p[q+i]-=O*S,p[q+o]-=z*S):_<0&&(S=100*W*p[F+d]*p[q+d],p[F+i]+=O*S,p[F+o]+=z*S,p[q+i]-=O*S,p[q+o]-=z*S)):(_=Math.sqrt(O*O+z*z),_>0&&(S=W*p[F+d]*p[q+d]/_/_,p[F+i]+=O*S,p[F+o]+=z*S,p[q+i]-=O*S,p[q+o]-=z*S));for(M=N.gravity/N.scalingRatio,W=N.scalingRatio,f=0;f<ne;f+=X)S=0,O=p[f+t],z=p[f+r],_=Math.sqrt(Math.pow(O,2)+Math.pow(z,2)),N.strongGravityMode?_>0&&(S=W*p[f+d]*M):_>0&&(S=W*p[f+d]*M/_),p[f+i]-=O*S,p[f+o]-=z*S;for(W=1*(N.outboundAttractionDistribution?Le:1),xe=0;xe<Rr;xe+=Ye)F=ye[xe+g],q=ye[xe+x],K=ye[xe+j],se=Math.pow(K,N.edgeWeightInfluence),O=p[F+t]-p[q+t],z=p[F+r]-p[q+r],Ne===!0?(_=Math.sqrt(O*O+z*z)-p[F+u]-p[q+u],N.linLogMode?N.outboundAttractionDistribution?_>0&&(S=-W*se*Math.log(1+_)/_/p[F+d]):_>0&&(S=-W*se*Math.log(1+_)/_):N.outboundAttractionDistribution?_>0&&(S=-W*se/p[F+d]):_>0&&(S=-W*se)):(_=Math.sqrt(Math.pow(O,2)+Math.pow(z,2)),N.linLogMode?N.outboundAttractionDistribution?_>0&&(S=-W*se*Math.log(1+_)/_/p[F+d]):_>0&&(S=-W*se*Math.log(1+_)/_):N.outboundAttractionDistribution?(_=1,S=-W*se/p[F+d]):(_=1,S=-W*se)),_>0&&(p[F+i]+=O*S,p[F+o]+=z*S,p[q+i]-=O*S,p[q+o]-=z*S);var ze,Ce,Re,ge,Ue,Fe;if(Ne===!0)for(f=0;f<ne;f+=X)p[f+l]!==1&&(ze=Math.sqrt(Math.pow(p[f+i],2)+Math.pow(p[f+o],2)),ze>L&&(p[f+i]=p[f+i]*L/ze,p[f+o]=p[f+o]*L/ze),Ce=p[f+d]*Math.sqrt((p[f+a]-p[f+i])*(p[f+a]-p[f+i])+(p[f+s]-p[f+o])*(p[f+s]-p[f+o])),Re=Math.sqrt((p[f+a]+p[f+i])*(p[f+a]+p[f+i])+(p[f+s]+p[f+o])*(p[f+s]+p[f+o]))/2,ge=.1*Math.log(1+Re)/(1+Math.sqrt(Ce)),Ue=p[f+t]+p[f+i]*(ge/N.slowDown),p[f+t]=Ue,Fe=p[f+r]+p[f+o]*(ge/N.slowDown),p[f+r]=Fe);else for(f=0;f<ne;f+=X)p[f+l]!==1&&(Ce=p[f+d]*Math.sqrt((p[f+a]-p[f+i])*(p[f+a]-p[f+i])+(p[f+s]-p[f+o])*(p[f+s]-p[f+o])),Re=Math.sqrt((p[f+a]+p[f+i])*(p[f+a]+p[f+i])+(p[f+s]+p[f+o])*(p[f+s]+p[f+o]))/2,ge=p[f+c]*Math.log(1+Re)/(1+Math.sqrt(Ce)),p[f+c]=Math.min(1,Math.sqrt(ge*(Math.pow(p[f+i],2)+Math.pow(p[f+o],2))/(1+Math.sqrt(Ce)))),Ue=p[f+t]+p[f+i]*(ge/N.slowDown),p[f+t]=Ue,Fe=p[f+r]+p[f+o]*(ge/N.slowDown),p[f+r]=Fe);return{}},"iterate"),tt}b(ki,"requireIterate");var de={},vt;function Ei(){if(vt)return de;vt=1;var n=Object.defineProperty,e=b((i,o)=>n(i,"name",{value:o,configurable:!0}),"y"),t=10,r=3;return de.assign=function(i){i=i||{};var o=Array.prototype.slice.call(arguments).slice(1),a,s,d;for(a=0,d=o.length;a<d;a++)if(o[a])for(s in o[a])i[s]=o[a][s];return i},de.validateSettings=function(i){return"linLogMode"in i&&typeof i.linLogMode!="boolean"?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in i&&typeof i.outboundAttractionDistribution!="boolean"?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in i&&typeof i.adjustSizes!="boolean"?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in i&&typeof i.edgeWeightInfluence!="number"?{message:"the `edgeWeightInfluence` setting should be a number."}:"scalingRatio"in i&&!(typeof i.scalingRatio=="number"&&i.scalingRatio>=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in i&&typeof i.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in i&&!(typeof i.gravity=="number"&&i.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in i&&!(typeof i.slowDown=="number"||i.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in i&&typeof i.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in i&&!(typeof i.barnesHutTheta=="number"&&i.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},de.graphToByteArrays=function(i,o){var a=i.order,s=i.size,d={},c,u=new Float32Array(a*t),l=new Float32Array(s*r);return c=0,i.forEachNode(function(g,x){d[g]=c,u[c]=x.x,u[c+1]=x.y,u[c+2]=0,u[c+3]=0,u[c+4]=0,u[c+5]=0,u[c+6]=1,u[c+7]=1,u[c+8]=x.size||1,u[c+9]=x.fixed?1:0,c+=t}),c=0,i.forEachEdge(function(g,x,j,A,G,D,R){var U=d[j],T=d[A],B=o(g,x,j,A,G,D,R);u[U+6]+=B,u[T+6]+=B,l[c]=U,l[c+1]=T,l[c+2]=B,c+=r}),{nodes:u,edges:l}},de.assignLayoutChanges=function(i,o,a){var s=0;i.updateEachNodeAttributes(function(d,c){return c.x=o[s],c.y=o[s+1],s+=t,a?a(d,c):c})},de.readGraphPositions=function(i,o){var a=0;i.forEachNode(function(s,d){o[a]=d.x,o[a+1]=d.y,a+=t})},de.collectLayoutChanges=function(i,o,a){for(var s=i.nodes(),d={},c=0,u=0,l=o.length;c<l;c+=t){if(a){var g=Object.assign({},i.getNodeAttributes(s[u]));g.x=o[c],g.y=o[c+1],g=a(s[u],g),d[s[u]]={x:g.x,y:g.y}}else d[s[u]]={x:o[c],y:o[c+1]};u++}return d},de.createWorker=e(function(i){var o=window.URL||window.webkitURL,a=i.toString(),s=o.createObjectURL(new Blob(["("+a+").call(this);"],{type:"text/javascript"})),d=new Worker(s);return o.revokeObjectURL(s),d},"createWorker"),de}b(Ei,"requireHelpers");var rt,kt;function $i(){return kt||(kt=1,rt={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}),rt}b($i,"requireDefaults");var it,Et;function Gi(){if(Et)return it;Et=1;var n=Object.defineProperty,e=b((u,l)=>n(u,"name",{value:l,configurable:!0}),"a"),t=xi(),r=vi().createEdgeWeightGetter,i=ki(),o=Ei(),a=$i();function s(u,l,g){if(!t(l))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");typeof g=="number"&&(g={iterations:g});var x=g.iterations;if(typeof x!="number")throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(x<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var j=r("getEdgeWeight"in g?g.getEdgeWeight:"weight").fromEntry,A=typeof g.outputReducer=="function"?g.outputReducer:null,G=o.assign({},a,g.settings),D=o.validateSettings(G);if(D)throw new Error("graphology-layout-forceatlas2: "+D.message);var R=o.graphToByteArrays(l,j),U;for(U=0;U<x;U++)i(G,R.nodes,R.edges);if(u){o.assignLayoutChanges(l,R.nodes,A);return}return o.collectLayoutChanges(l,R.nodes)}b(s,"abstractSynchronousLayout"),e(s,"abstractSynchronousLayout");function d(u){var l=typeof u=="number"?u:u.order;return{barnesHutOptimize:l>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(l)}}b(d,"inferSettings"),e(d,"inferSettings");var c=s.bind(null,!1);return c.assign=s.bind(null,!0),c.inferSettings=d,it=c,it}b(Gi,"requireGraphologyLayoutForceatlas2");var ji=Gi();const $t=di(ji);var Ai=`/*! 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}}.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-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-6{padding-right:calc(var(--spacing) * 6)}.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}.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:""}`,Si=Object.defineProperty,Ke=b((n,e)=>Si(n,"name",{value:e,configurable:!0}),"d$1");const Ni=Ai,Ci=ni(import.meta.url),Xe=Ke((n,e)=>{const t=Ci.resolve(n);return qr(oi(ai(t),e),"utf8")},"readUmd"),_i=Xe("sigma","sigma.min.js"),Di=Xe("graphology","graphology.umd.min.js"),Mi=Xe("@floating-ui/core","floating-ui.core.umd.min.js"),Ii=Xe("@floating-ui/dom","floating-ui.dom.umd.min.js"),Li='<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>',Ti='<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>',ce=Ke(n=>n.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;"),"escapeHtml"),Oi=9,zi=4,Ri=Ke((n,e)=>{if(n.length===0)return[];const t=new P({multi:!0,type:"directed"});for(const o of n){const a=t.order/n.length*Math.PI*2;t.addNode(o.name,{path:o.path,size:o.type==="application"?Oi:zi,type:o.type,x:Math.cos(a),y:Math.sin(a)})}for(const o of e)t.hasNode(o.source)&&t.hasNode(o.target)&&t.addEdge(o.source,o.target,{type:o.type});const r=$t.inferSettings(t);$t.assign(t,{iterations:600,settings:{...r,adjustSizes:!0,barnesHutOptimize:t.order>100,gravity:1.2,linLogMode:!0,scalingRatio:8,slowDown:4}});const i=[];return t.forEachNode((o,a)=>{i.push({name:o,path:a.path,size:a.size,type:a.type,x:a.x,y:a.y})}),i},"computeLayout"),Ui=Ke(n=>{const e=n.now??new Date,t=n.nodes.filter(u=>u.type==="application").length,r=n.nodes.length-t,i=Ri(n.nodes,n.edges),o=new Set(i.map(u=>u.name)),a=n.edges.filter(u=>o.has(u.source)&&o.has(u.target)),s={edges:a,nodes:i},d=n.nodes.length===0,c={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>${ce(n.tool.name)} graph · ${ce(e.toISOString().slice(0,10))}</title>
8
+ <style>${Ni}</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[u,...l]=n.tool.name.split("-");return l.length>0?`${ce(u??n.tool.name)}<span class="text-accent mx-[0.12em] font-light">/</span>${ce(l.join("-"))}`:ce(n.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="${c.chip}">v${ce(n.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">${Li}</span><span data-icon="sun" class="items-center justify-center">${Ti}</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="${c.labelMono}">apps</span><span class="${c.dvNum}">${String(t)}</span></div>
21
+ <div class="flex items-baseline gap-[0.65rem]"><span class="${c.labelMono}">libraries</span><span class="${c.dvNum}">${String(r)}</span></div>
22
+ <div class="flex items-baseline gap-[0.65rem]"><span class="${c.labelMono}">dependencies</span><span class="${c.dvNum}">${String(a.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="${c.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="${c.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">${ce(n.tool.name)}</b> ${ce(n.tool.version)} · generated ${ce(e.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">${ci}</a></span>
52
+ </footer>
53
+ </div>
54
+ <script>${Di}<\/script>
55
+ <script>${_i}<\/script>
56
+ <script>${Mi}<\/script>
57
+ <script>${Ii}<\/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(s).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>`},"emitGraphHtml");var Fi=Object.defineProperty,je=b((n,e)=>Fi(n,"name",{value:e,configurable:!0}),"l");const Pi={application:0,library:3,service:1,tool:2},Gt=je(n=>Pi[n]??Number.MAX_SAFE_INTEGER,"typeRank"),Wi=je(n=>{const e=new Map;for(const[t,r]of Object.entries(n.dependencies))for(const i of r){const o=e.get(i.target)??[];o.push(t),e.set(i.target,o)}return Object.values(n.nodes).map(t=>({deps:n.dependencies[t.name]??[],name:t.name,reverseDeps:e.get(t.name)??[],type:t.type})).sort((t,r)=>t.type!==r.type?Gt(t.type)-Gt(r.type):t.name.localeCompare(r.name))},"buildNodes"),qi=je((n,e,t)=>{let r=n;if(e==="app"?r=r.filter(i=>i.type==="application"):e==="lib"&&(r=r.filter(i=>i.type!=="application")),t){const i=t.toLowerCase();r=r.filter(o=>o.name.toLowerCase().includes(i))}return r},"filterNodes");class Bi{static{b(this,"GraphStore")}static{je(this,"GraphStore")}#e;#r=new Set;#i;constructor(e){this.#i=e;const t=Wi(e);this.#e={allNodes:t,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",selectedIndex:0}}getSnapshot=je(()=>this.#e,"getSnapshot");subscribe=je(e=>(this.#r.add(e),()=>{this.#r.delete(e)}),"subscribe");getFilteredNodes(){return qi(this.#e.allNodes,this.#e.filterType,this.#e.filterText)}getStats(){const e=this.#e.allNodes.filter(i=>i.type==="application").length,t=this.#e.allNodes.length,r=Object.values(this.#i.dependencies).reduce((i,o)=>i+o.length,0);return{apps:e,deps:r,libs:t-e,total:t}}setSelectedIndex(e){const t=this.getFilteredNodes(),r=t.length===0?-1:Math.max(0,Math.min(e,t.length-1));r!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:r})}setFocusedPanel(e){e!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:e})}setFilterType(e){e!==this.#e.filterType&&this.#t({...this.#e,filterType:e,selectedIndex:0})}setFilter(e){this.#t({...this.#e,filterText:e,selectedIndex:0})}setFilterActive(e){e!==this.#e.filterActive&&this.#t({...this.#e,filterActive:e,filterText:e?this.#e.filterText:"",selectedIndex:e?this.#e.selectedIndex:0})}#t(e){this.#e=e;for(const t of this.#r)try{t()}catch{}}}var Hi=Object.defineProperty,Vi=b((n,e)=>Hi(n,"name",{value:e,configurable:!0}),"p");const Ki=Vi(({focused:n,node:e,scrollRef:t})=>{const r=n?"white":"gray";if(!e)return h.jsx($,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:h.jsx(y,{dimColor:!0,children:"No project selected"})});const i=e.type==="application",o=i?"yellow":"cyan",a=i?"Application":"Library";return h.jsx($,{borderColor:r,borderStyle:"single",borderTopRightTitle:` ${a} `,borderTopTitle:` ${e.name} `,flexDirection:"column",flexGrow:1,children:h.jsxs(Vr,{flexGrow:1,flexShrink:1,paddingX:2,ref:t,scrollbar:!0,scrollbarColor:"gray",children:[h.jsxs($,{flexDirection:"column",marginTop:1,children:[h.jsxs($,{children:[h.jsx(y,{dimColor:!0,children:"── "}),h.jsx(y,{bold:!0,color:"white",children:"DEPENDS ON"}),h.jsxs(y,{dimColor:!0,children:[" ","(",e.deps.length,")"]})]}),e.deps.length===0?h.jsx($,{marginTop:1,paddingLeft:2,children:h.jsx(y,{dimColor:!0,children:"No dependencies"})}):h.jsx($,{flexDirection:"column",marginTop:1,children:e.deps.map(s=>h.jsxs($,{gap:1,paddingLeft:2,children:[h.jsx(y,{color:"cyan",children:"→"}),h.jsx(y,{children:s.target}),s.type!=="static"&&h.jsxs(y,{dimColor:!0,children:["(",s.type,")"]})]},s.target))})]}),h.jsxs($,{flexDirection:"column",marginTop:1,children:[h.jsxs($,{children:[h.jsx(y,{dimColor:!0,children:"── "}),h.jsx(y,{bold:!0,color:"white",children:"REQUIRED BY"}),h.jsxs(y,{dimColor:!0,children:[" ","(",e.reverseDeps.length,")"]})]}),e.reverseDeps.length===0?h.jsx($,{marginTop:1,paddingLeft:2,children:h.jsx(y,{dimColor:!0,children:"No reverse dependencies"})}):h.jsx($,{flexDirection:"column",marginTop:1,children:e.reverseDeps.map(s=>h.jsxs($,{gap:1,paddingLeft:2,children:[h.jsx(y,{color:"magenta",children:"←"}),h.jsx(y,{children:s})]},s))})]}),h.jsxs($,{flexDirection:"column",marginTop:1,children:[h.jsxs($,{children:[h.jsx(y,{dimColor:!0,children:"── "}),h.jsx(y,{bold:!0,color:"white",children:"INFO"})]}),h.jsxs($,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[h.jsxs($,{children:[h.jsx($,{width:16,children:h.jsx(y,{dimColor:!0,children:"Type:"})}),h.jsx(y,{color:o,children:a})]}),h.jsxs($,{children:[h.jsx($,{width:16,children:h.jsx(y,{dimColor:!0,children:"Dependencies:"})}),h.jsx(y,{children:String(e.deps.length)})]}),h.jsxs($,{children:[h.jsx($,{width:16,children:h.jsx(y,{dimColor:!0,children:"Required by:"})}),h.jsx(y,{children:String(e.reverseDeps.length)})]}),h.jsxs($,{children:[h.jsx($,{width:16,children:h.jsx(y,{dimColor:!0,children:"Connectivity:"})}),h.jsx(y,{children:String(e.deps.length+e.reverseDeps.length)})]})]})]})]})})},"ProjectDetailPanel");var Xi=Object.defineProperty,gt=b((n,e)=>Xi(n,"name",{value:e,configurable:!0}),"m");const Yi=[{key:"all",label:"All",shortcut:"1"},{key:"app",label:"Apps",shortcut:"2"},{key:"lib",label:"Libs",shortcut:"3"}],jt=gt(({isSelected:n,node:e})=>{const t=e.type==="application",r=t?"yellow":"cyan",i=t?"app":"lib";return h.jsxs($,{flexShrink:0,height:1,children:[h.jsxs(y,{children:[n?"▶":" "," "]}),h.jsx($,{flexGrow:1,children:h.jsx(y,{bold:n,inverse:n,wrap:"truncate",children:e.name})}),h.jsxs(y,{color:r,children:[" ",i]}),h.jsxs(y,{dimColor:!0,children:[" ","→",e.deps.length," ","←",e.reverseDeps.length]})]})},"ProjectRow"),At=gt(({count:n,label:e})=>h.jsxs($,{flexShrink:0,height:1,marginTop:1,children:[h.jsxs(y,{dimColor:!0,children:["▼"," "]}),h.jsx(y,{bold:!0,color:"white",children:e.toUpperCase()}),h.jsxs(y,{dimColor:!0,children:[" ","(",n,")"]})]}),"TypeHeader"),Qi=gt(({filterActive:n,filterText:e,filterType:t,focused:r,nodes:i,scrollOffset:o,selectedIndex:a,stats:s,viewportHeight:d})=>{const c=r?"white":"gray",u=i.filter(G=>G.type==="application"),l=i.filter(G=>G.type!=="application"),g=[];let x=0;if(u.length>0){g.push(h.jsx(At,{count:u.length,label:"Applications"},"hdr-apps"));for(const G of u){const D=x;g.push(h.jsx(jt,{isSelected:D===a,node:G},G.name)),x++}}if(l.length>0){g.push(h.jsx(At,{count:l.length,label:"Libraries"},"hdr-libs"));for(const G of l){const D=x;g.push(h.jsx(jt,{isSelected:D===a,node:G},G.name)),x++}}let j=0;u.length>0&&(j+=2+u.length),l.length>0&&(j+=2+l.length);const A=j>d&&d>0;return h.jsxs($,{borderColor:c,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[h.jsxs($,{flexShrink:0,gap:1,paddingX:1,children:[h.jsx(y,{bold:!0,inverse:!0,children:" VIS "}),h.jsxs(y,{wrap:"truncate",children:[s.total," ","packages"]}),h.jsxs(y,{dimColor:!0,children:["(",s.apps," ","apps,"," ",s.libs," ","libs,"," ",s.deps," ","deps)"]})]}),h.jsx($,{flexShrink:0,gap:1,paddingX:1,paddingY:1,children:Yi.map(G=>{const D=t===G.key;return h.jsxs($,{children:[h.jsx(y,{dimColor:!D,children:"["}),h.jsx(y,{bold:D,color:D?"cyan":"gray",children:G.shortcut}),h.jsx(y,{dimColor:!D,children:"]"}),h.jsxs(y,{color:D?"white":"gray",children:[" ",G.label]})]},G.key)})}),n&&h.jsxs($,{flexShrink:0,paddingX:1,children:[h.jsx(y,{bold:!0,color:"white",children:"/ "}),h.jsx(y,{children:e}),h.jsx(y,{inverse:!0,children:" "})]}),h.jsxs($,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[h.jsx($,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:h.jsx($,{flexDirection:"column",marginTop:-o,children:g})}),A&&h.jsx($,{flexShrink:0,marginLeft:1,marginRight:1,children:h.jsx(Kr,{contentHeight:j,placement:"inset",scrollOffset:o,style:"block",viewportHeight:d})})]})]})},"ProjectListPanel");var Ji=Object.defineProperty,Zi=b((n,e)=>Ji(n,"name",{value:e,configurable:!0}),"E");const en=100,tn=40,rn=10,St={1:"all",2:"app",3:"lib"},nn=Zi(({autoExitSeconds:n=0,store:e})=>{const{exit:t}=Xr(),{columns:r,rows:i}=Yr(),o=te.useSyncExternalStore(e.subscribe,e.getSnapshot),[a,s]=te.useState(!1),d=te.useRef(null),c=te.useRef(null),[u,l]=te.useState(0),[g,x]=te.useState(!1),j=te.useMemo(()=>e.getFilteredNodes(),[o.allNodes,o.filterType,o.filterText]),A=te.useMemo(()=>e.getStats(),[o.allNodes]),G=j[o.selectedIndex]??null,D=te.useMemo(()=>{let I=0,L=0;for(const N of j)N.type==="application"?I+=1:L+=1;return{appsCount:I,libsCount:L}},[j]),R=te.useCallback(I=>{const{appsCount:L,libsCount:N}=D;if(I<L)return(L>0?2:0)+I;const p=L>0?2+L:0,ye=N>0?2:0;return p+ye+(I-L)},[D]),U=Math.max(1,i-8-(o.filterActive?1:0)),T=te.useCallback(I=>{const L=R(I);l(N=>L>N+U-2?Math.max(0,L-U+2):L<N+1?Math.max(0,L-1):N)},[R,U]);if(te.useEffect(()=>{c.current?.scrollToTop()},[G?.name]),Qr((I,L)=>{if(I==="c"&&L.ctrl){t();return}if(!g){if(a){L.escape||I==="?"?s(!1):I==="q"?(s(!1),x(!0)):L.downArrow||I==="j"?d.current?.scrollBy(1):(L.upArrow||I==="k")&&d.current?.scrollBy(-1);return}if(I==="?"){s(!0);return}if(I==="q"){x(!0);return}if(L.tab){e.setFocusedPanel(o.focusedPanel==="list"?"detail":"list");return}if(St[I]){e.setFilterType(St[I]);return}if(o.filterActive){if(L.escape){e.setFilterActive(!1);return}if(L.return){e.setFilterActive(!1);return}if(L.backspace){e.setFilter(o.filterText.slice(0,-1));return}if(I&&!L.ctrl&&!L.meta){e.setFilter(o.filterText+I);return}return}if(o.focusedPanel==="list"){if(j.length===0){I==="/"&&e.setFilterActive(!0);return}if(L.downArrow||I==="j"){const N=Math.min(o.selectedIndex+1,j.length-1);e.setSelectedIndex(N),T(N);return}if(L.upArrow||I==="k"){const N=Math.max(o.selectedIndex-1,0);e.setSelectedIndex(N),T(N);return}if(L.pageDown){const N=Math.min(o.selectedIndex+10,j.length-1);e.setSelectedIndex(N),T(N);return}if(L.pageUp){const N=Math.max(o.selectedIndex-10,0);e.setSelectedIndex(N),T(N);return}if(L.home){e.setSelectedIndex(0),l(0);return}if(L.end){const N=j.length-1;e.setSelectedIndex(N),T(N);return}if(I==="/"){e.setFilterActive(!0);return}if(L.rightArrow){e.setFocusedPanel("detail");return}return}if(o.focusedPanel==="detail"){if(L.escape||L.leftArrow){e.setFocusedPanel("list");return}if(L.downArrow||I==="j"){c.current?.scrollBy(1);return}if(L.upArrow||I==="k"){c.current?.scrollBy(-1);return}if(L.pageDown){c.current?.scrollBy(10);return}if(L.pageUp){c.current?.scrollBy(-10);return}if(L.home){c.current?.scrollToTop();return}L.end&&c.current?.scrollToBottom()}}},{isActive:!0}),r<tn||i<rn)return h.jsx($,{alignItems:"center",height:i,justifyContent:"center",width:r,children:h.jsxs(y,{color:"yellow",children:["Terminal too small (",r,"x",i,")"]})});const B=r>=en,Y=h.jsx($,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:h.jsxs($,{flexWrap:"wrap",gap:2,paddingX:1,children:[h.jsxs($,{gap:1,children:[h.jsx(y,{bold:!0,color:"white",children:"q"}),h.jsx(y,{dimColor:!0,children:"QUIT"})]},"q"),h.jsxs($,{gap:1,children:[h.jsx(y,{bold:!0,color:"white",children:"?"}),h.jsx(y,{dimColor:!0,children:"HELP"})]},"?"),h.jsxs($,{gap:1,children:[h.jsx(y,{bold:!0,color:"white",children:"↑↓"}),h.jsx(y,{dimColor:!0,children:"NAV"})]},"nav"),h.jsxs($,{gap:1,children:[h.jsx(y,{bold:!0,color:"white",children:"1-3 /"}),h.jsx(y,{dimColor:!0,children:"FILTER"})]},"f"),h.jsxs($,{gap:1,children:[h.jsx(y,{bold:!0,color:"white",children:"Tab"}),h.jsx(y,{dimColor:!0,children:"PANEL"})]},"t")]})}),Q=h.jsxs(Jr,{footer:h.jsxs(y,{dimColor:!0,children:[h.jsx(y,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",h.jsx(y,{bold:!0,color:"white",children:"?"}),"/",h.jsx(y,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:d,title:"KEYBOARD SHORTCUTS",visible:a,width:52,children:[h.jsxs($,{flexDirection:"column",marginBottom:1,children:[h.jsxs($,{marginBottom:1,children:[h.jsx(y,{dimColor:!0,children:"── "}),h.jsx(y,{bold:!0,color:"white",children:"NAVIGATION"})]}),h.jsxs($,{children:[h.jsx($,{width:24,children:h.jsxs(y,{children:[h.jsxs(y,{bold:!0,color:"white",children:[" ","↑","/k"]}),h.jsx(y,{dimColor:!0,children:" Move up"})]})}),h.jsxs(y,{children:[h.jsxs(y,{bold:!0,color:"white",children:[" ","↓","/j"]}),h.jsx(y,{dimColor:!0,children:" Move down"})]})]}),h.jsxs(y,{children:[h.jsxs(y,{bold:!0,color:"white",children:[" ","Tab"]}),h.jsx(y,{dimColor:!0,children:" Switch panel"})]}),h.jsxs(y,{children:[h.jsxs(y,{bold:!0,color:"white",children:[" ","→","/","←"]}),h.jsx(y,{dimColor:!0,children:" Focus detail/list"})]}),h.jsxs(y,{children:[h.jsxs(y,{bold:!0,color:"white",children:[" ","PgUp/PgDn"]}),h.jsx(y,{dimColor:!0,children:" Jump 10 items"})]}),h.jsxs(y,{children:[h.jsxs(y,{bold:!0,color:"white",children:[" ","Home/End"]}),h.jsx(y,{dimColor:!0,children:" Jump to start/end"})]})]}),h.jsxs($,{flexDirection:"column",marginBottom:1,children:[h.jsxs($,{marginBottom:1,children:[h.jsx(y,{dimColor:!0,children:"── "}),h.jsx(y,{bold:!0,color:"white",children:"FILTERS"})]}),h.jsxs($,{children:[h.jsx($,{width:24,children:h.jsxs(y,{children:[h.jsxs(y,{bold:!0,color:"white",children:[" ","1"]}),h.jsx(y,{dimColor:!0,children:" All"})]})}),h.jsxs(y,{children:[h.jsxs(y,{bold:!0,color:"white",children:[" ","2"]}),h.jsx(y,{dimColor:!0,children:" Apps only"})]})]}),h.jsxs(y,{children:[h.jsxs(y,{bold:!0,color:"white",children:[" ","3"]}),h.jsx(y,{dimColor:!0,children:" Libraries only"})]}),h.jsxs(y,{children:[h.jsxs(y,{bold:!0,color:"white",children:[" ","/"]}),h.jsx(y,{dimColor:!0,children:" Text filter"})]})]}),h.jsxs($,{flexDirection:"column",children:[h.jsxs($,{marginBottom:1,children:[h.jsx(y,{dimColor:!0,children:"── "}),h.jsx(y,{bold:!0,color:"white",children:"ACTIONS"})]}),h.jsxs(y,{children:[h.jsxs(y,{bold:!0,color:"white",children:[" ","q"]}),h.jsx(y,{dimColor:!0,children:" Quit"})]}),h.jsxs(y,{children:[h.jsxs(y,{bold:!0,color:"white",children:[" ","?"]}),h.jsx(y,{dimColor:!0,children:" Toggle help"})]})]})]}),Se=h.jsx(Qi,{filterActive:o.filterActive,filterText:o.filterText,filterType:o.filterType,focused:o.focusedPanel==="list",nodes:j,scrollOffset:u,selectedIndex:o.selectedIndex,stats:A,viewportHeight:U}),X=h.jsx(Ki,{focused:o.focusedPanel==="detail",node:G,scrollRef:c});if(B){const I=Math.floor(r*.35);return h.jsxs($,{flexDirection:"column",height:i,width:r,children:[h.jsxs($,{flexDirection:"row",flexGrow:1,children:[h.jsx($,{flexGrow:1,children:Se}),h.jsx($,{width:I,children:X})]}),Y,h.jsx(mt,{autoExitSeconds:n??3,onCancel:b(()=>{x(!1)},"onCancel"),visible:g}),Q]})}const Ye=Math.floor(i*.55);return h.jsxs($,{flexDirection:"column",height:i,width:r,children:[h.jsx($,{height:Ye,children:Se}),h.jsx($,{flexGrow:1,children:X}),Y,h.jsx(mt,{autoExitSeconds:n??3,onCancel:b(()=>{x(!1)},"onCancel"),visible:g}),Q]})},"VisGraphApp");var on=Object.defineProperty,Ae=b((n,e)=>on(n,"name",{value:e,configurable:!0}),"y");const zr=Ae((n,e,t,r,i,o,a,s)=>{const d=t?ie("└── "):ie("├── "),c=i.has(n),u=c?ie(" (*)"):"",l=r.get(n),g=l?.type==="application"?le(n):n;if(o.push(`${e}${d}${g}${u}`),c)return;i.add(n);const x=l?.deps??[],j=t?`${e} `:`${e}${ie("│")} `;if(s>=a&&x.length>0){o.push(`${j}${ie(`... ${x.length} more`)}`);return}for(let A=0;A<x.length;A++){const G=x[A];G&&zr(G.target,j,A===x.length-1,r,i,o,a,s+1)}},"printDepsTree"),Nt=Ae((n,e,t,r,i,o)=>{const a=e.get(n),s=a?.type==="application"?le(n):n;r.push(`${o}${s}`),t.add(n);const d=a?.deps??[];if(d.length===0){r.push(`${o} ${ie("(no dependencies)")}`);return}if(i<=0){r.push(`${o} ${ie(`... ${d.length} dependencies`)}`);return}for(let c=0;c<d.length;c++){const u=d[c];u&&zr(u.target,o,c===d.length-1,e,t,r,i,1)}},"printRootProject"),Ct=Ae((n,e)=>{const t=new Map;for(const[l,g]of Object.entries(n.nodes))t.set(l,{deps:(n.dependencies[l]??[]).map(x=>({target:x.target,type:x.type})),name:l,type:g.type});const r=[],i=[];for(const[l,g]of t)g.type==="application"?r.push(l):i.push(l);r.sort(),i.sort();const o=r.length+i.length,a=Object.values(n.dependencies).reduce((l,g)=>l+g.length,0),s=[le("Project Dependency Graph"),""];if(r.length>0){s.push(` ${le(ft(`Applications (${r.length})`))}`,"");for(const l of r)Nt(l,t,new Set,s,e," "),s.push("")}if(i.length>0){s.push(` ${le(ft(`Libraries (${i.length})`))}`,"");for(const l of i)Nt(l,t,new Set,s,e," "),s.push("")}const d=process.stdout.columns||80;s.push(ie("─".repeat(Math.min(d,60)))),s.push(`${le(String(o))} packages ${ie("·")} ${le(String(a))} dependencies ${ie("·")} ${le(String(r.length))} apps${ie(",")} ${le(String(i.length))} libraries`);const c=new Set;let u=!1;for(const l of[...r,...i]){const g=t.get(l)?.deps??[];for(const x of g)c.has(x.target)&&(u=!0),c.add(x.target);c.add(l)}return u&&s.push(ie("(*) = already shown above")),s.join(`
708
+ `)},"projectGraphToAscii"),an=Ae(n=>{const e=Object.values(n.nodes).map(t=>({name:t.name,type:t.type}));return{edges:Object.values(n.dependencies).flat(),nodes:e}},"projectGraphToJson"),sn=Ae(n=>{const e=Object.values(n.nodes).map(r=>({name:r.name,path:r.data?.root,type:r.type})),t=[];for(const r of Object.values(n.dependencies))for(const i of r)t.push({source:i.source,target:i.target,type:i.type});return Ui({edges:t,nodes:e,tool:{name:"vis-graph",version:"alpha"},workspaceRoot:process.cwd()})},"projectGraphToHtml"),wn=Ae(async({logger:n,options:e,visConfig:t,workspaceRoot:r})=>{if(!r)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=r,{packageJsons:o,workspace:a}=Zr(i,t),s=ei(i,a,o),d=!!process.stdout.isTTY&&!ii,c=e.format??(d?"tui":"ascii"),u=e.output,l=e.depth??1/0;let g;switch(c){case"dot":{g=Hr(s);break}case"html":{g=sn(s);break}case"json":{g=JSON.stringify(an(s),void 0,2);break}case"tui":{if(!d){g=Ct(s,l);break}const x=t?.tui?.autoExit===!0?3:typeof t?.tui?.autoExit=="number"?t.tui.autoExit:0;process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&(process.stdin.setRawMode(!0),process.stdin.ref(),process.stdin.resume());const j=setInterval(()=>{},1e3),A=new Bi(s);await ti(ri.createElement(nn,{autoExitSeconds:x,store:A}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),clearInterval(j);return}default:g=Ct(s,l)}u?(Br(u,g,"utf8"),n.info(`Graph written to ${u}`)):n.info(g)},"execute");export{wn as default};