@preventive/triage 1.0.0-alpha.44 → 1.0.0-alpha.45
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.
- package/common/bundle-sources.js +20 -1
- package/common/default-scan-models.ts +1 -1
- package/common/dependency-reviews.d.ts +0 -5
- package/common/dependency-reviews.js +0 -17
- package/common/managed/agent-tasks.ts +292 -0
- package/common/managed/github-agents.ts +92 -0
- package/common/managed/github-logins.ts +49 -0
- package/common/managed/roles.ts +7 -0
- package/common/managed/routes.js +88 -7
- package/common/managed/team-app.d.ts +5 -2
- package/common/managed/team-app.js +2 -2
- package/common/server-info.ts +3 -0
- package/common/workspace-app.js +6 -3
- package/out/brotli-fallback.js +3 -3
- package/out/chunk-2XUEZHIP.js +18 -18
- package/out/chunk-2ZDZWLFY.js +1 -0
- package/out/chunk-3PS4KWD2.js +10 -0
- package/out/chunk-5DHL5NG3.js +2 -0
- package/out/chunk-6HNXNIQY.js +52 -0
- package/out/chunk-7C7DWL7I.js +1 -0
- package/out/chunk-AFLZH7WG.js +1 -0
- package/out/chunk-BC2UCLFJ.js +1 -0
- package/out/chunk-C4Z6ZBXV.js +6 -6
- package/out/chunk-GDPCLSOS.js +2 -0
- package/out/chunk-GO7FT4OD.js +1 -0
- package/out/chunk-HMAJDVXN.js +1 -0
- package/out/chunk-I2MDGSQX.js +3 -0
- package/out/chunk-IYPY47MC.js +1 -0
- package/out/chunk-IZ7POWI3.js +18 -0
- package/out/chunk-JCIIBLKR.js +1 -1
- package/out/chunk-NPW52BM2.js +17 -0
- package/out/chunk-NRPC74AM.js +1 -1
- package/out/chunk-NV7ES4EW.js +1 -0
- package/out/chunk-OKRLLE5I.js +17 -0
- package/out/chunk-OOJM4CTU.js +1 -1
- package/out/chunk-PNHBZGDD.js +1 -1
- package/out/chunk-PTGDYLNS.js +36 -0
- package/out/chunk-PXK7EU4V.js +1 -0
- package/out/chunk-Q6MVYGYV.js +3 -0
- package/out/chunk-QB4CBOX2.js +1 -0
- package/out/chunk-QRD6GIG5.js +229 -0
- package/out/chunk-R3NZFXVR.js +1 -0
- package/out/chunk-R5O6FAW4.js +1 -1
- package/out/chunk-SXV2T5C4.js +80 -0
- package/out/chunk-TUII34K2.js +1 -1
- package/out/chunk-VFWMQ3LG.js +2 -0
- package/out/chunk-VH4XMZIW.js +2 -0
- package/out/chunk-WFYLMF6Z.js +10 -0
- package/out/chunk-WI7Z5A2T.js +6 -0
- package/out/chunk-WQ74ZBZF.js +7 -0
- package/out/chunk-XVBEOGOS.js +3 -0
- package/out/client-managed-import.js +3 -3
- package/out/client-managed.js +31 -35
- package/out/client-sync.js +11 -11
- package/out/compare.js +35 -0
- package/out/dialogs.js +51 -0
- package/out/github-issue-authorized.html +1 -1
- package/out/github-issue-authorized.js +1 -1
- package/out/graph.js +17 -17
- package/out/index.html +30 -34
- package/out/prism.js +14 -14
- package/out/scan.js +2 -0
- package/out/terminal.js +294 -293
- package/out/view.css +1 -1
- package/out/view.js +16 -107
- package/package.json +51 -6
- package/risk/actions/findings.js +156 -0
- package/risk/actions/resolve.js +219 -0
- package/risk/actions/scripts/commands.js +182 -0
- package/risk/actions/scripts/grade.js +113 -0
- package/risk/actions/scripts/packages.js +123 -0
- package/risk/actions/scripts/shell.js +165 -0
- package/risk/actions/uses.js +76 -0
- package/risk/actions/workflow.js +110 -0
- package/risk/files/hosts.js +6 -6
- package/risk/files/readability.js +23 -17
- package/risk/files/runs-code.js +18 -6
- package/risk/files/script.js +7 -3
- package/risk/files/stamps.js +8 -7
- package/risk/index.d.ts +68 -1
- package/risk/index.js +6 -2
- package/risk/npm/assess.js +1 -1
- package/risk/npm/compare.js +34 -10
- package/risk/npm/files.js +413 -2
- package/risk/npm/tarball.js +56 -73
- package/server-managed/agent-merges.ts +198 -0
- package/server-managed/app-agents.ts +30 -0
- package/server-managed/avatar-store.ts +1 -0
- package/server-managed/commit-coauthors.ts +83 -0
- package/server-managed/commit-lockfiles.ts +62 -0
- package/server-managed/db-methods.ts +29 -10
- package/server-managed/db-neon.ts +30 -2
- package/server-managed/db-schema.ts +9 -2
- package/server-managed/db.ts +7 -0
- package/server-managed/dependabot-access.ts +60 -0
- package/server-managed/dependabot-alerts.ts +185 -0
- package/server-managed/dependency-review-comments.ts +97 -0
- package/server-managed/dependency-reviews.ts +65 -15
- package/server-managed/github-accounts.ts +33 -0
- package/server-managed/github-actions.ts +71 -0
- package/server-managed/github-app.ts +23 -9
- package/server-managed/github-errors.ts +2 -0
- package/server-managed/github-link-oauth.ts +69 -0
- package/server-managed/github-links.ts +204 -0
- package/server-managed/github-oauth.ts +5 -2
- package/server-managed/github-users.ts +30 -0
- package/server-managed/http.ts +1122 -52
- package/server-managed/index.ts +6 -2
- package/server-managed/locked-packages.ts +37 -16
- package/server-managed/lockfile-scope.ts +49 -0
- package/server-managed/npm-delta-worker.js +23 -0
- package/server-managed/npm-delta.ts +173 -0
- package/server-managed/npm-insights.ts +20 -11
- package/server-managed/npm-kept.ts +51 -4
- package/server-managed/npm-loads.ts +20 -13
- package/server-managed/npm-packages.ts +24 -64
- package/server-managed/pull-comment-reviews.ts +161 -0
- package/server-managed/pull-dependencies.ts +280 -0
- package/server-managed/pull-dependency-reviews.ts +318 -0
- package/server-managed/pull-reviews.ts +205 -0
- package/server-managed/release-commits.ts +84 -0
- package/server-managed/repository-actions.ts +209 -0
- package/server-managed/repository-agents.ts +220 -0
- package/server-managed/repository-browser.ts +54 -13
- package/server-managed/repository-changes.ts +284 -0
- package/server-managed/repository-code.ts +52 -0
- package/server-managed/repository-dependency-reviews.ts +135 -0
- package/server-managed/repository-history.ts +445 -0
- package/server-managed/repository-issues.ts +181 -0
- package/server-managed/repository-pulse.ts +432 -0
- package/server-managed/repository-risk-read.ts +165 -0
- package/server-managed/repository-risk.ts +113 -105
- package/server-managed/reviewed-dependencies.ts +149 -0
- package/server-managed/session.ts +9 -5
- package/server-managed/sql.ts +1 -1
- package/server-managed/storage-stores.ts +5 -0
- package/server-managed/team-app.ts +19 -3
- package/server-managed/workspace-shares.ts +4 -1
- package/server.ts +11 -0
- package/out/chunk-2ABLKCOY.js +0 -46
- package/out/chunk-2KBF5TZ7.js +0 -2
- package/out/chunk-35VE6CDH.js +0 -2
- package/out/chunk-3BZ7JERB.js +0 -1
- package/out/chunk-4XCDFGDP.js +0 -10
- package/out/chunk-5LSXOLUS.js +0 -1
- package/out/chunk-5RCM2J63.js +0 -1
- package/out/chunk-7B6HB4D7.js +0 -1
- package/out/chunk-AJ4GTATZ.js +0 -3
- package/out/chunk-CH4UN6WK.js +0 -225
- package/out/chunk-CMQA4DM6.js +0 -1
- package/out/chunk-CVVJAXVY.js +0 -2
- package/out/chunk-DIJJNTRH.js +0 -10
- package/out/chunk-EDKLBQQN.js +0 -17
- package/out/chunk-F47DXCEV.js +0 -33
- package/out/chunk-FK3DZEKL.js +0 -1
- package/out/chunk-G6AJWENO.js +0 -1
- package/out/chunk-GJ4IUCNS.js +0 -1
- package/out/chunk-GNXOKIGP.js +0 -80
- package/out/chunk-GZ4MS3TE.js +0 -13
- package/out/chunk-GZWM7UQM.js +0 -2
- package/out/chunk-IU3CCINR.js +0 -3
- package/out/chunk-K3X5EJBQ.js +0 -2
- package/out/chunk-KEX2ATEW.js +0 -2
- package/out/chunk-KYCNJVB7.js +0 -1
- package/out/chunk-LPCTJYNA.js +0 -7
- package/out/chunk-O4RJY5TP.js +0 -2
- package/out/chunk-OD4LPN3H.js +0 -1
- package/out/chunk-QWDWTBM7.js +0 -1
- package/out/chunk-QYWKC557.js +0 -1
- package/out/chunk-R75XOKUP.js +0 -1
- package/out/chunk-SWTLADW5.js +0 -1
- package/out/chunk-T7OKH4VW.js +0 -1
- package/out/chunk-TZ5KB2Y5.js +0 -10
- package/out/chunk-UNTRGE26.js +0 -2
- package/out/chunk-UTR2LVME.js +0 -2
- package/out/chunk-UYAXVRVL.js +0 -1
- package/out/chunk-V3ME6FI5.js +0 -2
- package/out/chunk-V5O7M2YT.js +0 -1
- package/out/chunk-VIHGO77Y.js +0 -1
- package/out/chunk-W4J3MGLB.js +0 -1
- package/out/chunk-WGG7KQUH.js +0 -1
- package/out/chunk-XYFXXB2G.js +0 -10
- package/out/chunk-ZESLQCTF.js +0 -6
package/out/graph.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import{$ as z,C as Ct,a as de,aa as Eo,b as Qt,ba as Pe,fa as ht,la as Bo,ma as Ce,na as Ke,pa as se,qa as Ze,z as Oo}from"./chunk-F47DXCEV.js";import{a as Ie}from"./chunk-R5O6FAW4.js";import{b as ie,c as Ao,d as ze}from"./chunk-CMQA4DM6.js";import"./chunk-AJ4GTATZ.js";import"./chunk-V3ME6FI5.js";import"./chunk-R75XOKUP.js";import{d as $e}from"./chunk-OD4LPN3H.js";import{a as Lo}from"./chunk-4XCDFGDP.js";import"./chunk-3BZ7JERB.js";import{a as Ye}from"./chunk-TZ5KB2Y5.js";import"./chunk-XYFXXB2G.js";import{a as ve}from"./chunk-DIJJNTRH.js";import"./chunk-QYWKC557.js";import{j as Yt}from"./chunk-GNXOKIGP.js";import"./chunk-C4Z6ZBXV.js";import{a as Pt,c as I,i as oe,j as ce}from"./chunk-2XUEZHIP.js";import"./chunk-TUII34K2.js";import{f as Ro,g as _o,h as To,i as Fo}from"./chunk-V5O7M2YT.js";import"./chunk-OOJM4CTU.js";var qo=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{display:grid;grid-template-columns:1fr 300px;grid-template-rows:auto 1fr;grid-template-areas:"topbar right" "stage right";min-height:0;border:1px solid var(--border);border-radius:var(--ui-radius, 8px);overflow:hidden;background:var(--graph-canvas-bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,sans-serif;font-size:12px}.graph2-layout{display:contents}:host([matrix]){grid-template-columns:minmax(0,1fr) 300px}.graph2-topbar{grid-area:topbar;display:flex;flex-direction:column;gap:.5rem;padding:var(--graph-topbar-padding, .6rem .75rem .6rem var(--graph-topbar-left-padding, .75rem));font-size:.825rem;background:var(--surface);backdrop-filter:var(--glass-blur);border-bottom:1px solid var(--graph-divider)}.graph2-topbar-row{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem;padding:0}.graph2-topbar .g2-spacer{flex:1}.graph2-topbar-row-pinned{flex-wrap:nowrap;align-items:flex-start}.graph2-topbar-row-pinned>#g2-fullscreen{margin-top:2px}.g2-topbar-controls{display:flex;flex:1;flex-wrap:wrap;align-items:center;gap:.75rem;min-width:0}.g2-topbar-controls>.g2-reason-scope,.g2-topbar-controls>.g2-issues-switch{margin-left:auto}.g2-topbar-controls>.g2-reason-scope+.g2-issues-switch{margin-left:0}.g2-topbar-controls .g2-path-filter-wrap{flex:1 1 8rem;min-width:0;max-width:12rem}.g2-matrix-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px;font-size:11px;& button{height:30px;padding:4px 7px;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:var(--surface);color:var(--text);font:inherit}& button:hover,button[aria-pressed=true]{background:var(--graph-hover-bg);border-color:var(--muted)}}.graph2-topbar triage-selector{margin-left:auto}.g2-icon-btn{width:28px;height:28px;border-radius:var(--ui-radius, 5px);background:var(--graph-hover-bg);border:1px solid var(--border);color:var(--muted);display:grid;place-items:center;font-family:inherit;&:hover{color:var(--accent);border-color:var(--accent)}}.g2-path-filter-wrap{position:relative;flex:0 0 12rem;padding-right:22px}.g2-path-filter-wrap .g2-path-filter-clear{position:absolute;right:4px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:18px;height:18px;background:transparent;border:0;border-radius:var(--ui-radius, 50%);color:var(--muted);font:400 10px/1 inherit;font-family:inherit;&:hover{color:var(--text);background:var(--surface-active)}}.g2-path-filter:placeholder-shown~.g2-path-filter-clear{display:none}.g2-layout-tabs{display:inline-flex;flex-shrink:0;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);padding:2px;gap:2px;& button{position:relative;display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:var(--ui-radius, 4px);background:transparent;color:var(--muted);font:inherit;font-size:11px;padding:5px 7px}& button[aria-pressed=true]{background:var(--graph-hover-bg);color:var(--text);box-shadow:var(--graph-layout-active-shadow, inset 0 0 0 1px var(--border))}}.g2-reason-scope{--scope-height: 30px}.graph2-right{grid-area:right;border-left:1px solid var(--graph-divider);background:var(--surface);backdrop-filter:var(--glass-blur);display:flex;flex-direction:column;overflow:hidden;padding:14px}.g2-panel-title{font-family:inherit;font-weight:600;font-size:11px;line-height:1;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);opacity:.85;margin:14px 0 8px;display:flex;align-items:baseline;gap:6px;&:first-child{margin-top:0}}.g2-panel-title-row{justify-content:space-between;gap:8px}#g2-top-pkgs-block{margin-top:14px;flex:1 1 0;min-height:0;display:flex;flex-direction:column}.g2-mini-tabs{display:flex;gap:1px;background:var(--graph-mini-tabs-bg, var(--graph-divider));border-radius:var(--ui-radius, 4px);overflow:hidden}.g2-mini-tab{background:transparent;border:0;color:var(--muted);font-family:inherit;font-weight:500;font-size:11px;line-height:1.4;text-transform:none;letter-spacing:0;padding:2px 7px;&:hover{color:var(--text);background:var(--graph-hover-bg)}&.on{background:var(--surface-active);color:var(--accent);text-decoration:var(--graph-mini-tab-active-decoration, none);text-underline-offset:.2em}}.graph2-stage{grid-area:stage;position:relative;background:var(--graph-canvas-bg);overflow:hidden;cursor:default;&:active{cursor:default}& canvas{position:absolute;inset:0;width:100%;height:100%;display:block}}.g2-stage-overlay{position:absolute;top:12px;left:12px;z-index:3;display:flex;flex-direction:column;gap:4px;pointer-events:none;max-width:calc(100% - 60px)}.g2-stage-overlay>*{pointer-events:auto}.g2-stage-stats{position:absolute;bottom:10px;left:12px;z-index:2;display:flex;flex-wrap:wrap;gap:2px 14px;font:500 10px/1.4 ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;color:var(--muted);opacity:.7;text-transform:uppercase;letter-spacing:.06em;pointer-events:none;max-width:calc(100% - 80px);& b{font-weight:600;color:var(--text);opacity:1}}.g2-stage-overlay-tr{position:absolute;top:12px;right:12px;z-index:3;pointer-events:auto}.g2-focus-pkg-btn{width:28px;height:28px;display:grid;place-items:center;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);color:var(--accent);box-shadow:var(--shadow-glass);&:hover{border-color:var(--accent);background:var(--surface-active)}& svg{display:block}}.g2-back-btn{display:inline-flex;align-items:center;gap:4px;padding:6px 11px;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);color:var(--accent);font:500 11px/1 inherit;font-family:inherit;box-shadow:var(--shadow-glass);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;align-self:flex-start;&:hover{border-color:var(--accent);background:var(--surface-active)}}.g2-tooltip{position:absolute;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 7px);padding:9px 11px;pointer-events:none;min-width:170px;max-width:260px;opacity:0;transition:opacity .12s;z-index:10;box-shadow:var(--shadow-glass);&.show{opacity:1}}.g2-tt-path{font:500 11px/1.3 ui-monospace,monospace;color:var(--text);word-break:break-all;margin-bottom:4px}.g2-tt-head{display:flex;align-items:center;gap:6px;margin-bottom:6px;flex-wrap:wrap}.g2-tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.g2-tt-pkg{font-size:10px;color:var(--muted);word-break:break-all}.g2-tooltip .tree-count-chips{margin-top:6px}:host-context(body.theme-light) .graph2-right .tree-count-chip.medium,:host-context(body.theme-light) .g2-tooltip .tree-count-chip.medium{color:#fff}.g2-selection-card{background:var(--graph-hover-bg);border:1px solid var(--border);border-radius:var(--ui-radius, 8px);overflow:hidden}.g2-sel-head{padding:11px 13px;border-bottom:1px solid var(--graph-divider);display:flex;align-items:center;gap:8px}.g2-sel-file-head{padding:11px 13px;border-bottom:1px solid var(--graph-divider);display:flex;flex-direction:column;gap:6px}.g2-sel-path{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-weight:600;font-size:12px;line-height:1.3;color:var(--text);word-break:break-all}.g2-sel-pkg-row{display:flex;align-items:center;gap:6px;min-width:0}.g2-sel-pkg{font-size:11px;color:var(--muted);word-break:break-all;min-width:0}.g2-sel-fullpath{padding:7px 13px;border-bottom:1px solid var(--graph-divider);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-size:10px;line-height:1.3;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.g2-sel-size{padding:5px 13px 7px;border-bottom:1px solid var(--graph-divider);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-size:10px;line-height:1.3;color:var(--muted);font-variant-numeric:tabular-nums}.g2-sel-dot{width:11px;height:11px;border-radius:50%;box-shadow:0 0 0 3px color-mix(in srgb,var(--dot) 22%,transparent);flex-shrink:0}.g2-sel-id{font:600 12px/1 ui-monospace,monospace;color:var(--text);word-break:break-all;flex:1;min-width:0}.g2-sel-grp{font:500 9px/1 ui-monospace,monospace;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;flex-shrink:0}.g2-sel-body{padding:11px 13px}.g2-sel-row{display:flex;justify-content:space-between;gap:12px;font-size:11px;padding:5px 0;border-bottom:1px solid var(--graph-divider);&:last-child{border-bottom:0}.k{color:var(--muted);flex-shrink:0}.v{color:var(--text);font-family:ui-monospace,monospace;word-break:break-all;text-align:right;min-width:0}}.g2-sel-section{padding:9px 13px;border-top:1px solid var(--graph-divider)}.g2-sel-section-label{font-family:inherit;font-weight:600;font-size:11px;line-height:1;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);opacity:.85;margin-bottom:5px}.g2-sel-section-empty{color:var(--muted);opacity:.55;font-size:11px;font-style:italic}.g2-sel-jumps{padding:11px 13px;display:flex;gap:5px;flex-wrap:wrap;border-top:1px solid var(--graph-divider)}.g2-sel-jump{background:var(--surface-active);border:1px solid var(--border);color:var(--accent);border-radius:var(--ui-radius, 4px);padding:2px 8px;font-family:inherit;font-weight:500;font-size:11px;line-height:1.3;&:hover{border-color:var(--accent)}}.g2-sel-file-list{list-style:none;margin:0;padding:0;max-height:110px;overflow:hidden auto;-webkit-app-region:no-drag;app-region:no-drag;&::-webkit-scrollbar{width:4px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}& li{padding:0}}.g2-sel-file-link{display:flex;align-items:center;gap:6px;width:100%;background:transparent;border:0;border-radius:var(--ui-radius, 3px);padding:2px 6px;min-height:20.5px;font:400 11px/1.4 ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;color:var(--accent);text-align:left;&:hover{background:var(--graph-hover-bg)}.g2-sel-file-dot{width:7px;height:7px;border-radius:50%;flex-shrink:0}.g2-sel-file-path{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}.g2-empty-state,.g2-sel-section-empty,.g2-dist-empty{cursor:default;user-select:none;-webkit-user-select:none}.g2-empty-state{background:var(--graph-hover-bg);border:1px dashed var(--border);border-radius:var(--ui-radius, 8px);padding:18px 14px;text-align:center;color:var(--muted);font-size:11px;line-height:1.5;& strong{color:var(--text);display:block;margin-bottom:4px;font-weight:500}}.g2-dist-bar{width:100%;height:5px;border-radius:3px;overflow:hidden;display:flex;background:var(--surface-active);margin-bottom:8px;>span{display:block;height:100%}}.g2-dist-list{display:flex;flex-direction:column;gap:0;flex:1 1 0;min-height:0;overflow-y:auto;overscroll-behavior:none;-webkit-app-region:no-drag;app-region:no-drag;scrollbar-gutter:stable;scrollbar-width:thin;scrollbar-color:var(--border) transparent;&::-webkit-scrollbar{width:5px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}}.g2-dist-empty{color:var(--muted);opacity:.55;font-size:10px;font-style:italic;padding:6px 0;text-align:center}@media print{:host{display:none!important}}
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`;var Do=`.toolbar{display:flex;flex-direction:column;gap:.5rem;margin-bottom:1rem;padding:.6rem .75rem;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 10px);box-shadow:var(--shadow-glass);font-size:.825rem;& select{height:30px;box-sizing:border-box;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:var(--ui-radius, 4px);padding:.25rem .4rem;font-size:.8rem;&:focus{border-color:var(--accent);outline:none}}& select.sort-select{padding:.3rem 1.7rem .3rem .55rem;min-width:8.5rem;font-weight:500;appearance:none;-webkit-appearance:none;background:transparent}:is(revalidate-filter,findings-sort){position:relative;display:inline-block;&:after{content:"";position:absolute;right:.7rem;top:50%;width:.35rem;height:.35rem;border-right:1.5px solid var(--muted);border-bottom:1.5px solid var(--muted);transform:translateY(-70%) rotate(45deg);pointer-events:none}}& repo-filter{display:inline-block;min-width:0;max-width:100%}& analyzer-select{position:relative;display:inline-block}.analyzer-btn{display:inline-flex;align-items:center;gap:.45rem;height:30px;box-sizing:border-box;padding:.3rem .55rem;min-width:8.5rem;background:transparent;color:var(--text);border:1px solid var(--border);border-radius:var(--ui-radius, 4px);font-family:inherit;font-size:.8rem;font-weight:500;&:hover{border-color:var(--accent)}&:focus-visible{border-color:var(--accent);outline:none}&.active{color:var(--accent)}.analyzer-btn-label{flex:1;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:18rem}& svg{color:var(--muted);flex-shrink:0}}& range-slider{color:var(--accent);margin:0 .25rem}.conf-vals{color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;font-variant-numeric:tabular-nums;.dash{color:var(--muted);margin:0 .15rem}}& conf-filter{position:relative;display:inline-flex;align-items:center;height:30px;box-sizing:border-box;padding:0 .55rem;gap:.5rem;background:transparent;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);.conf-range-label{color:var(--muted);font-size:.7rem;font-weight:500;letter-spacing:.04em}& range-slider{margin:0}.conf-range{display:inline-flex;align-items:center;gap:.5rem}:is(.conf-range,.conf-range-label).replaced{visibility:hidden}:is(.conf-range,.conf-range-label).disabled{opacity:.35}& revalidate-filter{position:relative;display:inline-flex;align-items:center;flex:none;width:1.4rem;.sort-select{width:100%;border:0;height:auto;min-width:0;padding:0 .95rem 0 .2rem;font-size:.72rem;color:var(--muted);cursor:default;&:hover{color:var(--text)}}&:after{right:.25rem}&.replaces{position:static;.sort-select{position:absolute;inset:0 .55rem;width:auto;padding-left:0;color:var(--text)}&:after{right:.8rem}}.partial-cycle{position:absolute;right:1.75rem;top:50%;transform:translateY(-50%);z-index:1;padding:.1rem .3rem;border-radius:var(--ui-radius, 3px);font:inherit;font-size:.66rem;line-height:1.4;white-space:nowrap;cursor:default;--chip: var(--muted);color:var(--chip);border:1px solid rgb(from var(--chip) r g b / .45);background:rgb(from var(--chip) r g b / .1);&.included{--chip: var(--green)}&.excluded{--chip: var(--critical)}&.only{--chip: var(--yellow)}&:hover{background:rgb(from var(--chip) r g b / .22)}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px}}}}& input[type=text]{background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:var(--ui-radius, 4px);padding:.25rem .4rem;font-size:.8rem;flex:1;min-width:8rem;&:focus{border-color:var(--accent);outline:none}}.result-count{color:var(--muted);margin-left:auto}}.analyzer-menu[popover]{position:fixed;inset:auto;margin:0;align-items:stretch;gap:.35rem;padding:.3rem;background:var(--bg);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);box-shadow:0 4px 12px #00000040;font-size:.825rem;-webkit-app-region:no-drag;app-region:no-drag}.analyzer-menu[popover]:not(:popover-open){display:none}.analyzer-menu[popover]:popover-open{display:flex}.analyzer-menu-sep{border-left:1px solid var(--border)}.analyzer-menu-col{display:flex;flex-direction:column;gap:1px;min-width:9rem;max-height:60vh;overflow-y:auto}.analyzer-menu-head{padding:.25rem .5rem .2rem;color:var(--muted);font-size:.68rem;font-weight:600;letter-spacing:.05em;text-transform:uppercase}.analyzer-menu-item{display:flex;align-items:center;gap:.45rem;background:transparent;border:0;border-radius:var(--ui-radius, 3px);padding:.3rem .5rem;color:var(--text);text-align:left;font-family:inherit;font-size:.78rem;&:before{content:"";width:.8rem;flex-shrink:0}&.active:before{content:"\\2713";color:var(--accent)}&:hover{background:var(--surface)}&.zero{opacity:.45}.analyzer-menu-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:16rem}.analyzer-menu-count{color:var(--muted);font-size:.7rem;font-weight:600;font-variant-numeric:tabular-nums}}download-button{display:contents}.toolbar-export-btn{height:30px;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;padding:0 .55rem;background:transparent;color:var(--muted);border:1px solid var(--border);border-radius:var(--ui-radius, 4px);font-family:inherit;transition:background .12s,color .12s;&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}& svg{display:block}}triage-selector,slide-triage-tabs{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden}.toolbar triage-selector{margin-left:auto}.toolbar-end{display:flex;align-items:center;gap:.75rem;margin-left:auto;&:not(:has(.toolbar-export-btn,annotation-filter,revalidation-switch)){display:none}}revalidation-switch{display:inline-flex;align-items:center;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden}.revalidation-toggle{height:100%;&:has(+.revalidation-detail){border-right:1px solid var(--border)}}.revalidation-conflicts{padding:0 .6rem;background:transparent;border:none;color:var(--text);font:inherit;font-size:.78rem;cursor:default;&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}.revalidation-detail{display:inline-flex;align-items:center;justify-content:center;width:30px;height:100%;box-sizing:border-box;padding:0;background:transparent;border:none;color:var(--muted);cursor:default;transition:background .12s,color .12s,opacity .12s;&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .06)}&.on{color:var(--accent);background:var(--surface-active)}&:disabled{opacity:.4;cursor:default}&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}.revalidation-upstream{display:inline-flex;align-items:center;justify-content:center;width:30px;height:100%;box-sizing:border-box;padding:0;background:transparent;border:none;color:var(--muted);cursor:default;transition:background .12s,color .12s;&:not(:first-child){border-left:1px solid var(--border)}&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .06)}&.on{color:var(--accent);background:var(--surface-active)}&:disabled{opacity:.4;cursor:default}&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}triage-selector.is-empty{display:none}.triage-state-btn{background:transparent;border:none;color:var(--muted);padding:0 .55rem;display:inline-flex;align-items:center;gap:.35rem;transition:background .12s,color .12s;font-family:inherit;font-size:.8rem;cursor:default;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{background:var(--surface-active)}}.triage-state-btn.active.triage-state-deleted{color:var(--critical)}.triage-state-btn.active.triage-state-fixed{color:var(--green, #4ade80)}.triage-state-btn.active.triage-state-inprogress{color:var(--warning, #d97706)}.triage-state-btn.active.triage-state-invalid{color:var(--muted)}.triage-state-btn.active.triage-state-ignored{color:var(--accent, #2563eb)}entity-search{display:contents}view-mode-buttons{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden;.view-mode-btn{background:transparent;border:none;color:var(--muted);padding:.28rem .5rem;display:inline-flex;align-items:center;justify-content:center;transition:background .12s,color .12s;font-family:inherit;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{color:var(--accent);background:var(--surface-active)}& svg{display:block}}}:is(.revalidation-detail,.revalidation-upstream,.view-mode-btn){position:relative}:is(.revalidation-detail.on,.revalidation-upstream.on,.view-mode-btn.active,.g2-layout-tabs button[aria-pressed=true]):before{content:var(--selected-icon-ring-content, none);position:absolute;left:50%;top:50%;width:22px;height:22px;box-sizing:border-box;border:1px solid currentcolor;border-radius:50%;transform:translate(-50%,-50%);pointer-events:none}source-filter{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden;.source-chip{background:transparent;border:none;color:var(--muted);padding:0 .55rem;display:inline-flex;align-items:center;transition:background .12s,color .12s;font-family:inherit;font-size:.75rem;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{color:var(--accent);background:var(--surface-active)}}}severity-mode-switch{display:inline-flex;align-items:center;gap:.4rem;height:30px;box-sizing:border-box;.severity-mode-label{color:var(--muted);font-size:.7rem;font-weight:500;letter-spacing:.04em}.severity-mode-chips{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden}.severity-mode-chip{background:transparent;border:none;color:var(--muted);padding:0 .55rem;display:inline-flex;align-items:center;transition:background .12s,color .12s;font-family:inherit;font-size:.75rem;cursor:default;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{color:var(--accent);background:var(--surface-active)}}}annotation-filter{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden;.annotation-chip{position:relative;background:transparent;border:none;color:var(--muted);padding:0 .45rem;display:inline-flex;align-items:center;transition:background .12s,color .12s;cursor:default;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.sel-with,&.sel-without{color:var(--accent);background:var(--surface-active)}&.sel-with .flag-cloth{fill:var(--accent)}&.sel-without:after{content:"";position:absolute;left:18%;right:18%;top:50%;height:1.5px;background:currentcolor;border-radius:1px;transform:rotate(-20deg);transform-origin:center;pointer-events:none}& svg{display:block}}}.toolbar-row{display:flex;gap:.75rem;flex-wrap:wrap;align-items:center}.search-row{display:inline-flex;align-items:center;gap:.65rem;flex:1 1 14rem;min-width:12rem}toolbar-search,.toolbar-search{display:inline-flex;align-items:center;gap:.5rem;flex:1;min-width:0;height:30px;box-sizing:border-box;padding:0 .65rem;background:var(--bg);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);&:has(input:focus){border-color:var(--accent)}>svg{color:var(--muted);flex-shrink:0}&[kind] input[type=text],&.toolbar-search input[type=text]{flex:1;min-width:0;background:transparent;border:0;outline:none;color:var(--text);font:inherit;font-size:.8rem;padding:0;&:focus{border:0}&::placeholder{color:var(--muted)}&:focus::placeholder{color:transparent}&::-webkit-search-cancel-button{display:none}}}.search-negate-btn{flex-shrink:0;width:20px;height:20px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:var(--ui-radius, 3px);padding:0;transition:background .12s,color .12s;& svg{width:13px;height:13px}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .08)}&.active{color:var(--accent);background:rgb(from var(--text) r g b / .1)}}@media(width<=1200px){.toolbar-row.sev-row .search-row{flex-basis:100%}}severity-chips{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden}severity-chips>.sev-chip{display:inline-flex;align-items:center;gap:.35rem;background:transparent;border:0;padding:0 .4rem;color:var(--muted);font-family:inherit;font-size:.8rem;transition:background .12s,color .12s;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}.sd{width:8px;height:8px;border-radius:2px;flex-shrink:0;background:currentcolor}}:is(.sev-chip,.triage-state-btn){.n{align-self:flex-start;margin:1px -5px 0;color:var(--muted);font-variant-numeric:tabular-nums;font-size:8.5px;font-weight:600;background:var(--bg);border-radius:999px;padding:0 3px;min-width:11px;text-align:center;line-height:11px}&.active .n{color:var(--text)}}severity-chips>button.sev-chip{&.active{color:var(--text)}&.critical .sd{background:var(--critical)}&.high .sd{background:var(--high)}&.medium .sd{background:var(--medium)}&.low .sd{background:var(--low)}&.high_bug .sd{background:var(--high-bug)}&.bug .sd{background:var(--bug)}&.informational .sd{background:var(--info)}&.critical.active{background:rgb(from var(--critical) r g b / .25)}&.high.active{background:rgb(from var(--high) r g b / .25)}&.medium.active{background:rgb(from var(--medium) r g b / .25)}&.low.active{background:rgb(from var(--low) r g b / .25)}&.high_bug.active{background:rgb(from var(--high-bug) r g b / .25)}&.bug.active{background:rgb(from var(--bug) r g b / .25)}&.informational.active{background:rgb(from var(--info) r g b / .25)}}triage-filter{display:inline-flex;align-items:center;background:var(--surface);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);padding:3px;height:30px;gap:1px;& button{width:22px;height:22px;background:transparent;border:0;border-radius:var(--ui-radius, 4px);padding:0;display:grid;place-items:center;position:relative;transition:background .12s;&:hover{background:rgb(from var(--text) r g b / .06)}&.active{background:rgb(from var(--text) r g b / .08);box-shadow:0 0 0 1px var(--border)}}.td{width:12px;height:12px;border-radius:50%;border:1.5px solid currentcolor;background:transparent;transition:background .12s}& button.active .td{background:currentcolor}.td.none{border-style:dashed;color:var(--muted)}.td.r{color:#fc5855}.td.b{color:#30aff8}.td.g{color:#68c36d}.td.x{color:#6e7278}.count{position:absolute;top:-2px;right:-2px;background:var(--bg);color:var(--muted);font-size:8.5px;font-weight:600;border-radius:999px;padding:0 3px;min-width:11px;text-align:center;line-height:11px;font-variant-numeric:tabular-nums}}
|
|
6
|
-
`;function
|
|
7
|
-
`).toLowerCase(),isHub:!0,x:0,y:0,deg:0}}),o=new Map(e.map(h=>[h.pkg,h])),i=new Map;for(let h of t.edges){if(!h.cross)continue;let f=t.nodeByFile.get(h.a)?.pkg,u=t.nodeByFile.get(h.b)?.pkg;if(!f||!u||f===u)continue;let[c,b]=f<u?[f,u]:[u,f],w=`${c}\0${b}`,r=i.get(w);r||(r={a:c,b,cross:!0,count:0,fromLo:!1,fromHi:!1},i.set(w,r),o.get(c).deg++,o.get(b).deg++),r.count++;let y=f===c;h.fromLo&&(y?r.fromLo=!0:r.fromHi=!0),h.fromHi&&(y?r.fromHi=!0:r.fromLo=!0)}let s=[...i.values()],n=Je(s),a=new Map(e.map(h=>[h.pkg,[]]));for(let h of s)h.fromLo&&a.get(h.a).push(h.b),h.fromHi&&a.get(h.b).push(h.a);return{nodes:e,byPkg:o,nodeByFile:o,edges:s,adj:n,importsOf:a,ownSourcePackages:t.ownSourcePackages,entryPackages:t.entryPackages}}function Qe(t,e){if(e.size===0)return t;let o=t.nodes.filter(f=>!e.has(f.pkg)),i=new Map(o.map(f=>[f.file,f])),s=f=>i.has(f),n=t.edges.filter(f=>s(f.a)&&s(f.b)),a=f=>new Map([...f].filter(([u])=>s(u)).map(([u,c])=>[u,c.filter(s)])),h=t.packages.filter(f=>!e.has(f));return{...t,files:t.files.filter(s),nodes:o,nodeByFile:i,edges:n,adj:Je(n),importsOf:a(t.importsOf),importedBy:a(t.importedBy),packages:h,pkgCount:new Map(h.map(f=>[f,t.pkgCount.get(f)])),byPkg:new Map(h.map(f=>[f,t.byPkg.get(f)]))}}function Dt(t){return $e(t)}function Re(t,e){if(!e||e==="/"||e==="__own__")return t;for(let o of["node_modules","dependencies",Oo()]){let i=o+"/"+e+"/",s=t.indexOf(i);if(s>=0)return t.slice(s+i.length)}return t.startsWith(e+"/")?t.slice(e.length+1):t}var Wo=new Set(["@babel/runtime","minimalistic-assert","react","reselect"]),pe=300,ue=100;function No(t,e){return new Set([...t].filter(([,o])=>o>e).map(([o])=>o))}function _e(t,e){let o=new Map;for(let[i,s]of t)i!==s&&Wo.has(s)&&o.set(s,(o.get(s)??0)+1);return No(o,e)}function to(t,e){let o=new Map,i=(s,n)=>{let a=t.nodeByFile.get(n)?.pkg;t.nodeByFile.get(s)?.pkg!==a&&Wo.has(a)&&o.set(a,(o.get(a)??0)+1)};for(let s of t.edges)s.fromLo&&i(s.a,s.b),s.fromHi&&i(s.b,s.a);return No(o,e)}var eo=new WeakMap,oo=new WeakMap;function ge(t,e){return t.nodes.length<=100&&!e}function Go(t,e,o){let i=_e([...t.importsOf].flatMap(([a,h])=>h.map(f=>[o(a),o(f)])),e);if(i.size===0)return t;let s=a=>!i.has(o(a)),n=t.nodes.filter(a=>s(a.file));return{...t,nodes:n,nodeByFile:new Map(n.map(a=>[a.file,a])),importsOf:new Map([...t.importsOf].filter(([a])=>s(a)).map(([a,h])=>[a,h.filter(s)])),cycleImportsOf:new Map([...t.cycleImportsOf].filter(([a])=>s(a)).map(([a,h])=>[a,new Set([...h].filter(s))]))}}function Te(t,e){if(!ge(t,e))return Fe(t);if(oo.has(t))return oo.get(t);let o=new Map(t.nodes.map(s=>[s.file,[...new Set(t.importsOf.get(s.file)??[])]])),i=Go({...t,importsOf:o,cycleImportsOf:Ke(t),fileLevel:!0},pe,s=>t.nodeByFile.get(s)?.pkg);i.directedEdges=[];for(let[s,n]of i.importsOf)for(let a of n)i.directedEdges.push({from:s,to:a});return oo.set(t,i),i}function Fe(t){if(eo.has(t))return eo.get(t);let e=xe(t);if(e.cycleImportsOf=Ke(t,o=>o.pkg),t.layerRoots?.appImports?.length>0){if(!e.byPkg.has("__own__")){let o={file:"__own__",pkg:"__own__",label:"own source",fileCount:0,size:null,totalIssues:0,deg:0,x:0,y:0};e.nodes.push(o),e.byPkg.set(o.pkg,o)}e.importsOf.set("__own__",[...new Set([...e.importsOf.get("__own__")??[],...t.layerRoots.appImports])].filter(o=>o!=="__own__"&&e.byPkg.has(o))),e.cycleImportsOf.set("__own__",new Set([...e.cycleImportsOf.get("__own__")??[],...t.layerRoots.appImports].filter(o=>o!=="__own__"&&e.byPkg.has(o))))}e=Go(e,ue,o=>o),e.byPkg=e.nodeByFile,e.importedBy=new Map(e.nodes.map(o=>[o.pkg,[]])),e.directedEdges=[];for(let[o,i]of e.importsOf)for(let s of i)e.importedBy.get(s).push(o),e.directedEdges.push({from:o,to:s});for(let o of e.nodes)o.deg=(e.importsOf.get(o.pkg)?.length??0)+e.importedBy.get(o.pkg).length;return eo.set(t,e),e}function Le(t,e,o=null,i={}){let s=e.showBundleLayouts&&z.bundleLayout==="layers",n=e.showBundleLayouts&&z.bundleLayout==="matrix",a=e.showBundleLayouts&&z.bundleLayout==="dependencies",h=e.showBundleLayouts&&z.bundleLayout==="flow",f=e.showBundleLayouts?I`<div class="g2-layout-tabs" role="group" aria-label="Bundle layout"><button type="button" data-g2-layout="graph" aria-label="Graph" aria-pressed="${String(!s&&!n&&!a&&!h)}">${ve(Ro)}</button> <button type="button" data-g2-layout="layers" aria-label="Layers" aria-pressed="${String(!!s)}">${ve(_o)}</button> <button type="button" data-g2-layout="matrix" aria-label="Matrix" aria-pressed="${String(!!n)}">${ve(To)}</button> <button type="button" data-g2-layout="dependencies" aria-label="Dependencies" aria-pressed="${String(!!a)}">${ve(Fo)}</button> <button type="button" data-g2-layout="flow" aria-label="Size flow" aria-pressed="${String(!!h)}"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 3h18M3 10h7m4 0h7M3 20h6m3 0h9M5 3v7m13-7v7M6 10c0 5 10 5 10 10m2-10c0 5-12 5-12 10"/></svg></button></div>`:null,u=e.extraTopRow,c=e.hideAllFiles??!1,b=e.triageCounts??{inprogress:0,fixed:0,invalid:0,deleted:0,ignored:0},w=e.triageStates??["inprogress","fixed","invalid","deleted","ignored"],r={};for(let $ of Yt)r[$]=0;for(let $ of t.nodes)if($.severitySet)for(let P of $.severitySet)r[P]!==void 0&&r[P]++;let y=Yt.some($=>r[$]>0||z.selectedSeverities.has($)),M=["none","red","blue","green","gray"],p={none:0,red:0,blue:0,green:0,gray:0};for(let $ of t.nodes)if($.colorSet)for(let P of $.colorSet)p[P]!==void 0&&p[P]++;let g=M.some($=>p[$]>0||z.selectedColors.has($)),l=I`<triage-selector variant="graph" .counts="${b}" .states="${w}"></triage-selector>`,d=c?null:I`<mode-switch label="All files" .checked="${z.showAll}" data-g2-show-all></mode-switch>`,x=h||(a?t.nodes.length<=100:!s&&!n&&(e.showPackagesView??!1))?I`<mode-switch label="Packages" .checked="${h?z.flowPackagesView:a?z.dependencyPackagesView:z.packagesView}" data-g2-packages-view></mode-switch>`:null,k=t.reasons?.length>0?I`<bundle-scope-selector class="g2-reason-scope" .reasons="${t.reasons.map($=>({id:`reason:${$}`,label:$}))}" .value="${z.bundleReason?`reason:${z.bundleReason}`:""}" label="Filter files" @scope-change="${$=>$.currentTarget.dispatchEvent(new CustomEvent("bundle-graph-reason-change",{detail:{reason:$.detail.value.replace(/^reason:/u,"")||null},bubbles:!0,composed:!0}))}"></bundle-scope-selector>`:null,_=y?I`<severity-chips .counts="${r}" .selected="${[...z.selectedSeverities]}" kind="graph"></severity-chips>`:null,O=g?I`<triage-filter .counts="${p}" .selected="${[...z.selectedColors]}" kind="graph"></triage-filter>`:null,C=I`<div class="toolbar-search g2-path-filter-wrap"><svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg> <input type="text" class="g2-path-filter" id="g2-path-filter" placeholder="filter path/package…" .value="${z.pathFilter}"> <button type="button" class="g2-path-filter-clear" id="g2-path-filter-clear" aria-label="Clear filter">✕</button></div>`,m=I`<button type="button" class="g2-icon-btn" id="g2-fullscreen" aria-label="Toggle fullscreen">⛶</button>`;if(e.showBundleLayouts){let $=(e.hasIssues??!1)&&z.bundleIssues,P=e.hasIssues?I`<mode-switch class="g2-issues-switch" label="Issues" .checked="${z.bundleIssues}" data-g2-bundle-issues></mode-switch>`:null,A=P&&i.issuesWrapped;return I`<div class="graph2-topbar"><div class="graph2-topbar-row graph2-topbar-row-main graph2-topbar-row-pinned toolbar-row"><div class="g2-topbar-controls">${f} ${C} ${x} ${o} ${k} ${A?null:P}</div>${m}</div>${$||A?I`<div class="graph2-topbar-row graph2-topbar-row-issues toolbar-row sev-row">${A?P:null} ${$?I`${_}${O}${l}`:null}</div>`:null}</div>`}return I`<div class="graph2-topbar">${u?I`<div class="graph2-topbar-row graph2-topbar-row-extra toolbar-row">${u} ${d} ${x}<div class="g2-spacer"></div>${l}</div>`:null}<div class="graph2-topbar-row graph2-topbar-row-main toolbar-row sev-row">${f} ${k} ${_} ${O} ${C} ${u?null:d} ${u?null:x} ${o}<div class="g2-spacer"></div>${u?null:l} ${m}</div></div>`}function Qi(t,e){let o=t.split("/").filter(Boolean),i=e.split("/").filter(Boolean),s=0;for(;s<o.length&&s<i.length&&o[s]===i[s];)s++;let n=o.length-s,a=i.slice(s).join("/");return n===0?"./"+a:"../".repeat(n)+a}function ts(t,e){if(!e&&e!=="")return t;let o=Qi(e,t);return o.length<t.length?o:t}function io(t,e,o,i){let s=o.length;if(s===0)return I`<div class="g2-sel-section"><div class="g2-sel-section-label">${e} (${s})</div><div class="g2-sel-section-empty">none</div></div>`;let n=o.map(a=>({file:a,display:ts(a,i)}));return n.sort((a,h)=>a.display.localeCompare(h.display)),I`<div class="g2-sel-section"><div class="g2-sel-section-label">${e} (${s})</div><ul class="g2-sel-file-list">${n.map(({file:a,display:h})=>{let f=t.nodeByFile.get(a),u=f?ht(f.pkg):"#666";return I`<li><button type="button" class="g2-sel-file-link" data-g2-select="${a}"><span class="g2-sel-file-dot" style="${Qt({background:u})}"></span> <span class="g2-sel-file-path" data-tooltip-truncated data-tooltip="${a}">${h}</span></button></li>`})}</ul></div>`}function ne(t){if(!t)return I`<div class="g2-sel-section-empty">none</div>`;let o=["critical","high","medium","low","high_bug","bug","informational"].filter(i=>(t[i]??0)>0);return o.length===0?I`<div class="g2-sel-section-empty">none</div>`:I`<div class="tree-count-chips">${o.map(i=>I`<span class="${`tree-count-chip ${i}`}">${t[i]} ${i.replaceAll("_"," ")}</span>`)}</div>`}function jo(t){let e=0;for(let u of t.edges)u.cross&&e++;let o=t.edges.length-e,i=0;for(let u of t.nodes)i+=u.totalIssues;let s=t.supportsLayers&&z.bundleLayout==="dependencies"&&!z.focusedPkg?Te(t,z.dependencyPackagesView):null,n=s?.nodes.length??t.nodes.length,a=s?.directedEdges.length??t.edges.length,h=n===0?"0.0":(a*2/n).toFixed(1),f=Dt(z.focusedPkg);return I`<main class="graph2-stage"><canvas id="g2-canvas"></canvas>${z.focusedPkg?I`<div class="g2-stage-overlay"><button type="button" class="g2-back-btn" id="g2-back-to-full">← ${f}</button></div>`:null}<div id="g2-focus-overlay-slot" class="g2-stage-overlay-tr"></div><div class="g2-stage-stats">${!s||s.fileLevel?I`<span><b>${t.nodes.length}</b> files</span>`:null} <span><b>${s&&!s.fileLevel?s.nodes.length:t.packages.length}</b> packages</span> <span><b>${a}</b> ${s?"dependencies":I`edges (${o} intra · ${e} cross)`}</span> ${t.issuesHidden?null:I`<span><b>${i}</b> issues</span>`} <span>avg degree <b>${h}</b></span></div><div class="g2-zoom-ctrl"><button id="g2-zoom-in" aria-label="Zoom in">+</button><div class="g2-zoom-pct" id="g2-zoom-pct">100%</div><button id="g2-zoom-out" aria-label="Zoom out">−</button> <button id="g2-zoom-fit" class="g2-zoom-fit-btn" aria-label="Fit to view">fit</button></div><div class="g2-tooltip" id="g2-tooltip"></div></main>`}function Uo(t){if(t.supportsLayers&&z.bundleLayout==="dependencies")return null;let e=null;if(z.selected){let i=t.nodeByFile.get(z.selected);i&&(e=i.pkg)}else z.solo&&(e=z.solo);if(!e||(t.pkgCount.get(e)??0)<=1||z.focusedPkg===e)return null;let o=Dt(e);return I`<button type="button" class="g2-focus-pkg-btn" data-g2-focus-pkg="${e}" aria-label="${`Focus on ${o}'s graph`}" data-tooltip="${`Focus on ${o}'s graph`}"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M8 4.6 L4 11 M8 4.6 L12 11 M5 11.4 L11 11.4" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/><circle cx="8" cy="3.6" r="2" fill="currentColor"/><circle cx="3.6" cy="11.4" r="2" fill="currentColor"/><circle cx="12.4" cy="11.4" r="2" fill="currentColor"/></svg></button>`}function Yo(){return I`<aside class="graph2-right"><div class="g2-panel-title">Selection</div><div id="g2-selection-area"></div><div id="g2-top-pkgs-block"></div></aside>`}function Ko(t){if(t.supportsLayers&&z.bundleLayout==="dependencies"&&!z.focusedPkg&&!ge(t,z.dependencyPackagesView)){let s=Fe(t),n=s.nodes.toSorted((a,h)=>s.importedBy.get(h.pkg).length-s.importedBy.get(a.pkg).length||a.pkg.localeCompare(h.pkg)).map(a=>a.pkg);return I`<div class="g2-panel-title">Packages · importers</div>${so(s,n,!0)}`}let e=z.showAll&&t.nodes.length>0&&t.nodes.every(s=>typeof s.size=="number"),o=t.nodes.some(s=>s.totalIssues>0),i=z.topPkgsTab;return i==="size"&&!e&&(i="files"),i==="issues"&&!o&&(i="files"),I`<div class="g2-panel-title g2-panel-title-row"><span>Packages</span><div class="g2-mini-tabs">${o?I`<button type="button" class="${de({"g2-mini-tab":!0,on:i==="issues"})}" data-g2-top-pkgs="issues">Issues</button>`:null} <button type="button" class="${de({"g2-mini-tab":!0,on:i==="files"})}" data-g2-top-pkgs="files">Files</button> ${e?I`<button type="button" class="${de({"g2-mini-tab":!0,on:i==="size"})}" data-g2-top-pkgs="size">Size</button>`:null}</div></div>${is(t,i)}`}function Zo(t,e={}){if(t.supportsLayers&&z.bundleLayout==="dependencies"&&!z.focusedPkg&&!ge(t,z.dependencyPackagesView))return ss(Fe(t),z.solo);let o=z.selected;if(o){let i=t.nodeByFile.get(o);return i?es(t,i,o,e):I`<div class="g2-empty-state"><strong>File not in current view</strong>Adjust filters or pick another file.</div>`}return z.solo?z.solo==="__own__"&&!t.pkgCount.has("__own__")&&t.layerRoots?.appImports.length>0?I`<div class="g2-empty-state"><strong>App</strong>App source is not included in this view. Connections come from its recorded imports.</div>`:os(t,z.solo):I`<div class="g2-empty-state">Click a node or a package row to inspect.</div>`}function es(t,e,o,i){let s=ht(e.pkg),n=Dt(e.pkg),a=Re(o,e.pkg),h=t.importedBy.get(o)??[],f=t.importsOf.get(o)??[],u=o.lastIndexOf("/"),c=u>=0?o.slice(0,u):"";return I`<div class="g2-selection-card"><div class="g2-sel-file-head"><div class="g2-sel-path">${a}</div><div class="g2-sel-pkg-row"><span class="g2-sel-dot" style="${Qt({"--dot":s,background:s})}"></span> <span class="g2-sel-pkg">${n}</span></div></div><div class="g2-sel-fullpath" data-tooltip-truncated data-tooltip="${o}">${o}</div>${Ct(e.size)?I`<div class="g2-sel-size">${Ct(e.size)}</div>`:null}<div class="g2-sel-section"><div class="g2-sel-section-label">Own findings</div>${ne(e.own)}</div><div class="g2-sel-section"><div class="g2-sel-section-label">Subtree findings</div>${ne(e.subtree)}</div><div class="g2-sel-jumps">${e.totalIssues>0&&i.findingsJump!==!1?I`<button type="button" class="g2-sel-jump" data-g2-jump-findings="${o}">Findings →</button>`:null} ${i.isBundleContext?e.origFile?I`<button type="button" class="g2-sel-jump" data-bundle-view-source="${e.origFile}">View source →</button>`:null:I`<button type="button" class="g2-sel-jump" data-g2-jump-file="${o}">Files →</button>`}</div>${io(t,"Imported by",h,c)} ${io(t,"Imports",f,c)}</div>`}function os(t,e){let o=t.nodes.filter(b=>b.pkg===e),i=o.length;if(i===0)return I`<div class="g2-empty-state"><strong>Package has no files in view</strong> Toggle "All files" to widen the file set, or pick another package.</div>`;let s=ht(e),n=Dt(e),a={};for(let b of Yt)a[b]=0;for(let b of o)if(b.own)for(let w of Yt)a[w]+=b.own[w]??0;let h=0,f=0;for(let b of t.edges){let w=t.nodeByFile.get(b.a),r=t.nodeByFile.get(b.b);!w||!r||(w.pkg===e&&r.pkg===e?f++:(w.pkg===e||r.pkg===e)&&h++)}let u=0;for(let b of o)b.isHub&&u++;let c=new Set;for(let b of o)for(let w of t.importedBy.get(b.file)??[]){let r=t.nodeByFile.get(w);r&&r.pkg!==e&&c.add(w)}return I`<div class="g2-selection-card"><div class="g2-sel-head"><span class="g2-sel-dot" style="${Qt({"--dot":s,background:s})}"></span> <span class="g2-sel-id">${n}</span> <span class="g2-sel-grp">package</span></div><div class="g2-sel-body"><div class="g2-sel-row"><span class="k">Files</span><span class="v">${i}</span></div><div class="g2-sel-row"><span class="k">Hubs</span><span class="v">${u}</span></div><div class="g2-sel-row"><span class="k">Intra edges</span><span class="v">${f}</span></div><div class="g2-sel-row"><span class="k">Cross edges</span><span class="v">${h}</span></div></div><div class="g2-sel-section"><div class="g2-sel-section-label">Findings</div>${ne(a)}</div>${io(t,"Imported by",[...c])}</div>`}function is(t,e){let o=t.nodes.length||1,i=e??z.topPkgsTab,s=z.selectedSeverities,n=z.selectedColors,a=!t.issuesHidden&&s.size>0,h=!t.issuesHidden&&n.size>0,f=a||h,u=new Map,c=new Map,b=0,w=0;for(let p of t.nodes){let g;if(f){if(g=0,p.findings)for(let l of p.findings)a&&!s.has(l.severity)||h&&!n.has(l.color)||g++}else g=p.totalIssues;u.set(p.pkg,(u.get(p.pkg)??0)+g),b+=g,typeof p.size=="number"&&(c.set(p.pkg,(c.get(p.pkg)??0)+p.size),w+=p.size)}let r;i==="issues"?r=t.packages.filter(p=>(u.get(p)??0)>0).toSorted((p,g)=>{let l=u.get(p)??0,d=u.get(g)??0;return d!==l?d-l:(t.pkgCount.get(g)??0)-(t.pkgCount.get(p)??0)}):i==="size"?r=t.packages.filter(p=>(c.get(p)??0)>0).toSorted((p,g)=>{let l=c.get(p)??0,d=c.get(g)??0;return d!==l?d-l:(t.pkgCount.get(g)??0)-(t.pkgCount.get(p)??0)}):r=[...t.packages].toSorted((p,g)=>{let l=t.pkgCount.get(p)??0,d=t.pkgCount.get(g)??0;return d!==l?d-l:(u.get(g)??0)-(u.get(p)??0)});let y=p=>i==="issues"?b>0?((u.get(p)??0)/b*100).toFixed(2):"0":i==="size"?w>0?((c.get(p)??0)/w*100).toFixed(2):"0":(t.pkgCount.get(p)/o*100).toFixed(2),M=i==="issues"?"No packages with issues":i==="size"?"No packages with size":"No packages";return I`<div class="g2-dist-bar">${t.packages.map(p=>{let g=ht(p);return I`<span style="${Qt({background:g,width:`${y(p)}%`})}"></span>`})}</div><div class="g2-dist-list">${r.length===0?I`<div class="g2-dist-empty">${M}</div>`:null} ${Ye(r,p=>p,p=>{let g=ht(p),l=t.pkgCount.get(p)??0,d=u.get(p)??0,v=c.get(p)??0,x=i==="issues"?d:i==="size"?Ct(v):l,k=i==="issues"?b>0?(d/b*100).toFixed(1):"0.0":i==="size"?w>0?(v/w*100).toFixed(1):"0.0":(l/o*100).toFixed(1),_=Dt(p),O=z.solo===p;return I`<button type="button" class="${de({"g2-dist-item":!0,on:O})}" data-g2-pkg="${p}"><span class="g2-dist-dot" style="${Qt({background:g})}"></span><span class="g2-dist-name" data-tooltip-truncated data-tooltip="${_}">${_}</span><span class="g2-dist-count">${x}</span><span class="g2-dist-pct">${k}%</span></button>`})}</div>`}function so(t,e,o=!1){return I`<div class="g2-dist-list">${Ye(e,i=>i,i=>I`<button type="button" class="${de({"g2-dist-item":!0,on:z.solo===i})}" data-g2-pkg="${i}"><span class="g2-dist-dot" style="${Qt({background:ht(i)})}"></span> <span class="g2-dist-name">${Dt(i)}</span> ${o?I`<span class="g2-dist-count">${t.importedBy.get(i).length}</span>`:null}</button>`)}</div>`}function ss(t,e){let o=t.byPkg.get(e);if(!o)return I`<div class="g2-empty-state">Select a package to trace its imports.</div>`;let i=t.importedBy.get(e)??[],s=t.importsOf.get(e)??[];return I`<div class="g2-selection-card"><div class="g2-sel-head"><span class="g2-sel-dot" style="${Qt({background:ht(e)})}"></span> <span class="g2-sel-id">${o.label}</span></div>${o.totalIssues?I`<div class="g2-sel-section">${ne(o.own)}</div>`:null}<div class="g2-sel-section"><div class="g2-sel-section-label">Imported by (${i.length})</div>${so(t,i.toSorted())}</div><div class="g2-sel-section"><div class="g2-sel-section-label">Dependencies (${s.length})</div>${so(t,s.toSorted())}</div></div>`}function no(t,e,o){return Math.min(24,Math.max(1,e-196-12)/Math.max(1,t),Math.max(1,o-118-12)/Math.max(1,t))}function ro(t,e,o,i){return Math.max(Math.min(18,no(e,o,i)),Math.min(27,t))}function Qo(t,e,o,i){let s=Math.floor((t-196+i.x)/i.cell),n=Math.floor((e-118+i.y)/i.cell);return t<196&&e>=118&&n>=0&&n<o.rows.length?{row:n,col:null}:e<118&&t>=196&&s>=0&&s<o.rows.length?{row:s,col:null}:t>=196&&e>=118&&n>=0&&s>=0&&n<o.rows.length&&s<o.rows.length?{row:n,col:s}:null}function Jo(t){if(!t.file)return t.label;let e=`node_modules/${t.pkg}/`;return t.file.includes(e)?t.file.slice(t.file.indexOf(e)+e.length):t.file}function ti(t,e,o,{width:i,height:s,theme:n,colorOf:a,hover:h,selected:f,dimmed:u}){let{cell:c,x:b,y:w}=o,{rows:r}=e,y=m=>196+m*c-b,M=m=>118+m*c-w,p=Math.max(0,Math.floor(w/c)),g=Math.min(r.length,Math.ceil((s-118+w)/c)),l=Math.max(0,Math.floor(b/c)),d=Math.min(r.length,Math.ceil((i-196+b)/c)),v=h??f;t.clearRect(0,0,i,s),t.fillStyle=n.bg,t.fillRect(0,0,i,s),t.save(),t.beginPath(),t.rect(196,118,i-196,s-118),t.clip();let x=[];for(let m=0;m<r.length;m++){let $=x.at(-1),P=r[m];$&&$.component===P.component?$.end=m+1:x.push({component:P.component,start:m,end:m+1,cyclic:P.cyclic})}for(let m of x)m.cyclic&&(t.strokeStyle=n.cycle+"85",t.lineWidth=1,t.strokeRect(y(m.start),M(m.start),(m.end-m.start)*c,(m.end-m.start)*c));if(v&&(t.fillStyle=n.highlight,t.fillRect(196,M(v.row),i-196,c),t.fillRect(y(v.col??v.row),118,c,s-118)),t.strokeStyle=n.grid,t.lineWidth=1,c>=9){t.beginPath();for(let m=p;m<=g;m++)t.moveTo(196,M(m)+.5),t.lineTo(i,M(m)+.5);for(let m=l;m<=d;m++)t.moveTo(y(m)+.5,118),t.lineTo(y(m)+.5,s);t.stroke()}let k=e.visibleCells.reduce((m,$)=>Math.max(m,$.count),1),_=c>=8?2:.25;for(let m of e.visibleCells)m.row<p||m.row>=g||m.col<l||m.col>=d||(t.globalAlpha=u(r[m.row])&&u(r[m.col])?.12:.35+.65*Math.log1p(m.count)/Math.log1p(k),t.fillStyle=m.cyclic&&c<10?n.cycle:a(r[m.row].pkg),t.fillRect(y(m.col)+_,M(m.row)+_,Math.max(1,c-2*_),Math.max(1,c-2*_)),m.cyclic&&m.from!==m.to&&c>=10&&(t.fillStyle=n.cycle,t.fillRect(y(m.col)+c-5,M(m.row)+2,3,3)));t.globalAlpha=1,f&&(t.strokeStyle=n.text,t.lineWidth=2,f.col===null?t.strokeRect(197,M(f.row)+1,i-196-2,c-2):t.strokeRect(y(f.col)+1,M(f.row)+1,c-2,c-2)),t.restore(),t.fillStyle=n.surface,t.fillRect(0,0,i,118),t.fillRect(0,0,196,s),t.font="11px ui-monospace, monospace",t.textBaseline="middle";let O=Math.max(1,Math.ceil(14/c));for(let m=p;m<g;m++){if(m%O&&m!==v?.row)continue;t.save(),t.beginPath(),t.rect(5,111,186,s-118+7),t.clip();let $=M(m)+c/2;m===v?.row&&(t.fillStyle=n.highlight,t.fillRect(0,M(m),196,Math.max(c,14))),t.fillStyle=a(r[m].pkg),t.fillRect(8,$-3,5,6),t.fillStyle=m===v?.row||e.matches.size<e.totalRows&&e.matches.has(r[m].id)?n.text:n.muted,t.fillText(`${r[m].file?" ":""}${Jo(r[m])}`,20,$),t.restore()}let C=Math.max(1,Math.ceil(17/c));for(let m=l;m<d;m++)m%C&&m!==(v?.col??v?.row)||(t.save(),t.beginPath(),t.rect(189,22,i-196+7,96),t.clip(),t.translate(y(m)+c/2,108),t.rotate(-Math.PI/4),t.fillStyle=m===(v?.col??v?.row)?n.text:n.muted,t.fillText(Jo(r[m]),0,0,115),t.restore(),t.fillStyle=a(r[m].pkg),t.fillRect(y(m)+1,114,Math.max(1,c-2),3));t.fillStyle=n.muted,t.font="10px ui-monospace, monospace",t.fillText("IMPORTERS \u2193",14,104),t.fillText("DEPENDENCIES \u2192",204,12),t.strokeStyle=n.border,t.beginPath(),t.moveTo(196-.5,118),t.lineTo(196-.5,s),t.moveTo(196,118-.5),t.lineTo(i,118-.5),t.stroke(),r.length===0&&(t.fillStyle=n.muted,t.fillText("No matching dependencies",216,148))}var Wt=t=>t.toLocaleString("en-US");function Ae(t,e,o){return I`<button class="g2-dist-item matrix-row-link" @click="${()=>o(t.id)}"><span class="g2-dist-dot" style="${`background:${ht(t.pkg)}`}"></span><span class="g2-dist-name" data-tooltip-truncated data-tooltip="${t.label}">${t.label}</span><span class="g2-dist-count">${Wt(e)}</span></button>`}function ei(t,e,o,{select:i,expand:s,expanded:n,neighborhood:a,focus:h,clear:f}){let u=t.byId.get(o?.from),c=t.byId.get(o?.to);if(!u){let l=[...t.rows].toSorted((d,v)=>v.importers-d.importers).slice(0,15);return I`<div class="matrix-metrics"><span><b>${Wt(e.nodes.length)}</b>files</span><span><b>${Wt(e.packages.length)}</b>packages</span><span><b>${Wt(t.importCount)}</b>imports</span></div><p class="matrix-empty">Select a row to inspect a package.<br>Select a cell to see the files behind a dependency.</p><h4>Most imported</h4>${l.map(d=>Ae(d,d.importers,i))} ${t.cycleCount?I`<h4>Cyclic groups <b>${t.cycleCount}</b></h4>${t.rows.filter(d=>d.cyclic).slice(0,12).map(d=>Ae(d,d.outgoing,i))}`:null}`}let b=c?t.cells.get(u.id)?.get(c.id):null,w=l=>e.nodeByFile.get(l)?.origFile??l,r=b?.cycleCount<b?.count?`${Wt(b.cycleCount)} of ${Wt(b.count)} file imports participate in a cycle`:"Import participates in a cycle",y=Map.groupBy(b?.examples??[],([,l])=>l),M=u.cyclic?[...t.byId.values()].filter(l=>l.component===u.component).length:0,p=[...t.cells.get(u.id)?.values()??[]].filter(l=>l.to!==u.id).toSorted((l,d)=>d.count-l.count),g=[...t.cells.values()].map(l=>l.get(u.id)).filter(l=>l&&l.from!==u.id).toSorted((l,d)=>d.count-l.count);return I`<div class="matrix-panel-head"><button class="matrix-selected-name" @click="${()=>i(u.id)}">${u.label}</button><button type="button" class="detail-action" @click="${f}" aria-label="Clear matrix selection">×</button></div>${c?I`<div class="matrix-direction">imports →</div><button class="matrix-selected-name" @click="${()=>i(c.id)}">${c.label}</button>`:null} ${(c?b?.cyclic:u.cyclic)?I`<span class="matrix-cycle-label">${c?r:`Cyclic group \xB7 ${M} members`}</span>`:null}<div class="matrix-metrics"><span><b>${Wt(c?b?.count??0:u.files.length)}</b>${c?"file imports":"files"}</span><span><b>${Ct(u.size)}</b>source size</span></div><div class="matrix-actions">${u.file?I`<button @click="${()=>s(u.pkg)}">Collapse package</button><button data-bundle-view-source="${e.nodeByFile.get(u.file)?.origFile??u.file}">View source</button>`:I`<button @click="${()=>s(u.pkg)}">${n.has(u.pkg)?"Collapse files":"Expand files"}</button>`} <button aria-pressed="${String(a===u.id)}" @click="${()=>h(u.id)}">Neighborhood</button></div>${c?I`<h4>File imports</h4>${y.size>0?[...y].map(([l,d])=>I`<div class="matrix-import-group"><button class="matrix-import-target" data-bundle-view-source="${e.nodeByFile.get(l)?.origFile??l}" data-tooltip-truncated data-tooltip="${l}">${l}</button><ul class="matrix-import-sources" aria-label="Imported by">${d.map(([v])=>I`<li><button data-bundle-view-source="${e.nodeByFile.get(v)?.origFile??v}"><span aria-hidden="true">←</span><span data-tooltip-truncated data-tooltip="${v}">${v}</span></button> ${Ce(w(v),w(l),e.ownSourceFiles?.has(l),e.ownSourceFiles?.has(v))?null:I`<span class="matrix-import-excluded">Excluded from cycles</span>`}</li>`)}</ul></div>`):I`<p class="matrix-empty">No direct imports in this direction.</p>`} ${b&&b.count>b.examples.length?I`<p class="matrix-empty">Showing ${b.examples.length} of ${Wt(b.count)} imports.</p>`:null} ${c.id!==u.id&&t.cells.get(c.id)?.has(u.id)?I`<h4>Reverse direction</h4><button class="g2-dist-item matrix-reverse-link" @click="${()=>i(c.id,u.id)}">← ${Wt(t.cells.get(c.id).get(u.id).count)} file imports</button>`:null}`:I`<h4>Imports <b>${p.length}</b></h4>${p.slice(0,60).map(l=>Ae(t.byId.get(l.to),l.count,d=>i(u.id,d)))} ${p.length>60?I`<p class="matrix-empty">Showing the 60 strongest of ${p.length} dependencies.</p>`:null}<h4>Imported by <b>${g.length}</b></h4>${g.slice(0,60).map(l=>Ae(t.byId.get(l.from),l.count,d=>i(d,u.id)))} ${g.length>60?I`<p class="matrix-empty">Showing the 60 strongest of ${g.length} importers.</p>`:null}`}`}var oi=`:host{display:contents}*{box-sizing:border-box}button,select{font:inherit;color:var(--text);border:1px solid var(--border);background:var(--surface);border-radius:var(--ui-radius, 4px);padding:4px 7px;cursor:default}button:hover,button[aria-pressed=true]{background:var(--graph-hover-bg);border-color:var(--muted)}button:focus-visible,select:focus-visible,canvas:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.matrix-layout{display:contents;color:var(--text);font-size:12px}.matrix-stage{grid-area:stage;position:relative;overflow:hidden;min-width:0;min-height:0;background:var(--graph-canvas-bg)}.matrix-order{position:absolute;top:12px;left:14px;max-width:calc(var(--matrix-label-width) - 28px);height:30px;padding:3px 6px;border-radius:var(--ui-radius, 6px);font-size:11px}canvas{display:block;width:100%;height:100%;touch-action:none}.matrix-hover{position:absolute;bottom:10px;left:calc(var(--matrix-label-width) + 10px);max-width:max(0px,calc(100% - var(--matrix-label-width) - 160px));padding:5px 8px;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:var(--surface);pointer-events:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}.matrix-panel{grid-area:right;min-height:0;overflow:auto;padding:12px;border-left:1px solid var(--border);background:var(--surface)}.matrix-panel-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding-right:var(--graph-fullscreen-inset, 0)}h4{margin:20px 0 7px;font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;display:flex;justify-content:space-between}.matrix-metrics{display:flex;gap:14px;margin:15px 0;color:var(--muted);font-size:10px}.matrix-metrics:first-child{margin-top:0;padding-right:var(--graph-fullscreen-inset, 0)}.matrix-metrics b{display:block;font-size:16px;font-weight:500;color:var(--text);font-variant-numeric:tabular-nums;margin-bottom:3px}.matrix-empty{color:var(--muted);font-size:11px;line-height:1.6;cursor:default;user-select:none;-webkit-user-select:none}.matrix-row-link{grid-template-columns:6px minmax(0,1fr) auto}.matrix-row-link .g2-dist-dot{width:6px;height:6px;border-radius:2px}.matrix-row-link .g2-dist-name{color:var(--text)}.matrix-row-link .g2-dist-count{color:var(--muted)}.matrix-reverse-link{grid-template-columns:1fr}.matrix-selected-name{display:block;background:transparent;border:0;text-align:left;padding:0;margin:14px 0 6px;font:12px/1.6 ui-monospace,monospace;overflow-wrap:anywhere}.matrix-panel-head .matrix-selected-name{min-width:0;margin:0}.matrix-panel-head button:last-child{flex-shrink:0}.matrix-direction{color:var(--muted);font-size:10px}.matrix-cycle-label{display:block;color:var(--matrix-cycle, #e879c7);font-size:10px;margin-top:10px}.matrix-actions{display:flex;gap:5px;margin:12px 0;font-size:11px}.matrix-actions button{white-space:nowrap}.matrix-import-group{padding:6px 0;border-bottom:1px solid var(--border)}.matrix-import-group button{display:flex;align-items:baseline;gap:6px;width:100%;min-height:20.5px;background:transparent;border:0;padding:2px 0;font:10px/1.6 ui-monospace,monospace;text-align:left;overflow-wrap:anywhere;color:var(--text)}.matrix-import-group .matrix-import-target{font-weight:600}.matrix-import-sources{margin:0 0 0 10px;padding:0;list-style:none}.matrix-import-sources button{color:var(--muted)}.matrix-import-sources span:last-child{min-width:0}.matrix-import-excluded{display:block;margin-left:12px;color:var(--muted);font-size:10px}
|
|
8
|
-
`;var ao=class extends ce{static properties={graph:{attribute:!1}};static styles=[Pt(he),Pt(oi),Pt(Ie),Pt(fe)];constructor(){super(),this.expanded=new Set,this.order="structure",this.cyclesOnly=!1,this.neighborhood=null,this.selection=null,this.hover=null,this.view={cell:18,x:0,y:0},this.width=0,this.height=0,this.dirty=!0,this.needsFit=!0,this.bridge={requestDraw:()=>this.requestUpdate(),_cleanup:()=>{}}}willUpdate(e){if(this.graph&&(e.has("graph")||this.query!==z.pathFilter||this.dirty)){let o=this.model?.rows;this.query=z.pathFilter,this.model=Ze(this.graph,{expanded:this.expanded,order:this.order,query:this.query,neighborhood:this.neighborhood,cyclesOnly:this.cyclesOnly}),this.neighborhood&&!this.model.byId.has(this.neighborhood)&&(this.neighborhood=null,this.model=Ze(this.graph,{expanded:this.expanded,order:this.order,query:this.query,cyclesOnly:this.cyclesOnly})),this.selection&&(!this.model.index.has(this.selection.from)||this.selection.to&&(!this.model.index.has(this.selection.to)||this.cyclesOnly&&!this.model.cells.get(this.selection.from)?.has(this.selection.to)))&&(this.selection=null),this.hover=null,this.dirty=!1,this.needsFit||=!o||o.length!==this.model.rows.length||this.model.rows.some((i,s)=>i.id!==o[s].id)}}firstUpdated(){let e=this.renderRoot.querySelector("canvas");this.canvas=e,this.resizeObserver=new ResizeObserver(()=>{let o=e.parentElement.getBoundingClientRect();this.width=o.width,this.height=o.height;let i=window.devicePixelRatio||1;e.width=Math.round(this.width*i),e.height=Math.round(this.height*i),this.clamp(),this.paint()}),this.resizeObserver.observe(e.parentElement),this.themeObserver=new MutationObserver(()=>this.requestUpdate()),this.themeObserver.observe(document.body,{attributes:!0,attributeFilter:["class"]}),this.events=new AbortController,e.addEventListener("wheel",o=>{o.preventDefault(),o.ctrlKey||o.metaKey?this.zoom(Math.exp(-o.deltaY*.005),o.offsetX,o.offsetY):(this.view.x+=o.shiftKey?o.deltaY:o.deltaX,this.view.y+=o.shiftKey?0:o.deltaY,this.clamp(),this.hover=null,this.paint())},{passive:!1,signal:this.events.signal})}updated(){z.graphState=this.bridge;let e=JSON.stringify([this.cyclesOnly,this.model.cycleCount,this.expanded.size,!!this.neighborhood]);e!==this.controlsKey&&(this.controlsKey=e,this.dispatchEvent(new CustomEvent("matrix-controls-change",{detail:this.renderControls(),bubbles:!0,composed:!0}))),cancelAnimationFrame(this.frame),this.frame=requestAnimationFrame(()=>this.paint())}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect(),this.themeObserver?.disconnect(),this.events?.abort(),cancelAnimationFrame(this.frame),z.graphState===this.bridge&&(z.graphState=null)}clamp(){this.view.cell=ro(this.view.cell,this.model.rows.length,this.width,this.height);let e=this.model.rows.length*this.view.cell;this.view.x=Math.max(0,Math.min(this.view.x,Math.max(0,e-this.width+196+12))),this.view.y=Math.max(0,Math.min(this.view.y,Math.max(0,e-this.height+118+12)))}fit(){this.view={cell:no(this.model.rows.length,this.width,this.height),x:0,y:0},this.needsFit=!1,this.requestUpdate()}zoom(e,o=(this.width+196)/2,i=(this.height+118)/2){let s=this.view.cell,n=ro(s*e,this.model.rows.length,this.width,this.height);this.view.x=(this.view.x+o-196)*n/s-o+196,this.view.y=(this.view.y+i-118)*n/s-i+118,this.view.cell=n,this.clamp(),this.hover=null,this.requestUpdate()}select(e,o=null,i=!0){this.selection={from:e,to:o},i&&this.model.index.has(e)&&(this.view.cell=Math.max(16,this.view.cell),this.view.y=this.model.index.get(e)*this.view.cell-(this.height-118)/2,this.view.x=(this.model.index.get(o??e)??0)*this.view.cell-(this.width-196)/2,this.clamp()),this.requestUpdate()}expand(e){this.expanded.has(e)?this.expanded.delete(e):this.expanded.add(e),this.revealPkg=e,this.selection=null,this.neighborhood=null,this.dirty=!0,this.requestUpdate()}pointer(e){let o=this.canvas.getBoundingClientRect();return Qo(e.clientX-o.left,e.clientY-o.top,this.model,this.view)}move(e){if(this.drag){let i=e.clientX-this.drag.x,s=e.clientY-this.drag.y;if(Math.abs(i)+Math.abs(s)>3&&(this.drag.moved=!0),this.drag.moved){this.view.x=this.drag.ox-i,this.view.y=this.drag.oy-s,this.clamp(),this.hover=null,this.paint();return}}let o=this.pointer(e);(o?.row!==this.hover?.row||o?.col!==this.hover?.col)&&(this.hover=o,this.requestUpdate())}key(e){if(e.key==="Escape"){this.selection=null,this.hover=null,this.requestUpdate();return}if(!["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Enter"].includes(e.key)||this.model.rows.length===0)return;e.preventDefault();let o=this.model.index.get(this.selection?.from)??0,i=this.model.index.get(this.selection?.to)??o;if(e.key==="Enter"){this.expand(this.model.rows[o].pkg);return}e.key==="ArrowDown"&&o++,e.key==="ArrowUp"&&o--,e.key==="ArrowRight"&&i++,e.key==="ArrowLeft"&&i--;let s=n=>Math.max(0,Math.min(this.model.rows.length-1,n));this.select(this.model.rows[s(o)].id,this.model.rows[s(i)].id)}paint(){if(!this.canvas||!this.model||this.width<=196||this.height<=118)return;if(this.needsFit&&this.fit(),this.revealPkg){let c=this.model.rows.find(b=>b.pkg===this.revealPkg);this.revealPkg=null,c&&this.select(c.id)}let e=this.canvas.getContext("2d"),o=window.devicePixelRatio||1;e.setTransform(o,0,0,o,0,0);let i=getComputedStyle(this),s=c=>i.getPropertyValue(c).trim(),n=document.body.classList.contains("theme-paper"),a=n||document.body.classList.contains("theme-light")||document.body.classList.contains("theme-pink"),h={bg:s("--graph-canvas-bg")||"#0c0c0c",surface:s("--surface"),text:s("--text"),muted:s("--muted"),border:s("--border"),grid:a?"#0000000b":"#ffffff0b",highlight:n?"#fff":a?"#0969da18":"#ffffff12",cycle:n?"#000":a?"#a21caf":"#e879c7"};this.style.setProperty("--matrix-cycle",h.cycle);let f=this.model.index.get(this.selection?.to),u=this.model.index.get(this.selection?.from);ti(e,this.model,this.view,{width:this.width,height:this.height,theme:h,colorOf:ht,hover:this.hover,selected:u===void 0?null:{row:u,col:f??null},dimmed:c=>!this.graph.issuesHidden&&!c.files.some(b=>{let w=this.graph.nodeByFile.get(b);return(z.selectedSeverities.size===0||[...z.selectedSeverities].some(r=>w.severitySet?.has(r)))&&(z.selectedColors.size===0||[...z.selectedColors].some(r=>w.colorSet?.has(r)))})})}renderControls(){return I`<div class="g2-matrix-controls"><mode-switch label="${`${this.model.cycleCount} ${this.model.cycleCount===1?"cycle":"cycles"}`}" .checked="${this.cyclesOnly}" @click="${()=>{this.cyclesOnly=!this.cyclesOnly,this.dirty=!0,this.requestUpdate()}}"></mode-switch>${this.expanded.size>0?I`<button @click="${()=>{this.expanded.clear(),this.selection=null,this.dirty=!0,this.requestUpdate()}}">Collapse all</button>`:null} ${this.neighborhood?I`<button @click="${()=>{this.neighborhood=null,this.dirty=!0,this.requestUpdate()}}">All dependencies</button>`:null}</div>`}render(){if(!this.model)return null;let e=this.model.rows[this.hover?.col],o=this.model.rows[this.hover?.row],i=e&&o?this.model.cells.get(o.id)?.get(e.id)?.count??0:0;return I`<div class="matrix-layout"><div class="matrix-stage" style="${`--matrix-label-width: ${196}px`}"><select class="matrix-order" aria-label="Matrix order" @change="${s=>{this.order=s.target.value,this.dirty=!0,this.requestUpdate()}}"><option value="structure" ?selected="${this.order==="structure"}">Structure ↓</option><option value="name" ?selected="${this.order==="name"}">Name ↓</option><option value="importers" ?selected="${this.order==="importers"}">Most imported ↓</option><option value="imports" ?selected="${this.order==="imports"}">Most imports ↓</option></select><canvas tabindex="0" role="img" aria-label="Dependency matrix. Rows import columns. Arrow keys select cells; Enter expands a package." @keydown="${s=>this.key(s)}" @pointermove="${s=>this.move(s)}" @pointerleave="${()=>{this.drag||(this.hover=null,this.requestUpdate())}}" @pointerdown="${s=>{s.button===0&&(this.canvas.setPointerCapture(s.pointerId),this.drag={x:s.clientX,y:s.clientY,ox:this.view.x,oy:this.view.y,moved:!1})}}" @pointercancel="${()=>{this.drag=null}}" @pointerup="${s=>{if(this.drag){if(!this.drag.moved){let n=this.pointer(s);n&&this.select(this.model.rows[n.row].id,n.col===null?null:this.model.rows[n.col].id,!1)}this.drag=null}}}" @dblclick="${s=>{let n=this.pointer(s);n&&this.expand(this.model.rows[n.row].pkg)}}"></canvas>${o&&(!e||i>0)?I`<div class="matrix-hover">${o.label}${e?` \u2192 ${e.label} \xB7 ${i} imports`:` \xB7 ${o.files.length} files`}</div>`:null}<div class="g2-zoom-ctrl" role="group" aria-label="Matrix zoom"><button aria-label="Zoom in" @click="${()=>this.zoom(1.5)}">+</button><div class="g2-zoom-pct">${Math.round(this.view.cell/18*100)}%</div><button aria-label="Zoom out" @click="${()=>this.zoom(1/1.5)}">−</button> <button class="g2-zoom-fit-btn" aria-label="Fit to view" @click="${()=>this.fit()}">fit</button></div></div><aside class="matrix-panel" aria-label="Matrix details" aria-live="polite">${ei(this.model,this.graph,this.selection,{select:(s,n)=>this.select(s,n),expand:s=>this.expand(s),expanded:this.expanded,neighborhood:this.neighborhood,focus:s=>{this.neighborhood=this.neighborhood===s?null:s,this.dirty=!0,this.requestUpdate()},clear:()=>{this.selection=null,this.requestUpdate()}})}</aside></div>`}};customElements.define("dependency-matrix",ao);var Kt={dark:"#0c0c0c",light:"#f6f8fa",pink:"#fff0f7",paper:"#fff"};function Oe(){let t=typeof document>"u"?null:document.body?.classList;return t?.contains("theme-paper")?Kt.paper:t?.contains("theme-pink")?Kt.pink:t?.contains("theme-light")?Kt.light:Kt.dark}function Ee(t){let e=[1,3,5].map(i=>{let s=parseInt(t.slice(i,i+2),16)/255;return s<=.04045?s/12.92:((s+.055)/1.055)**2.4});return e[0]*.2126+e[1]*.7152+e[2]*.0722>.18?"#000":"#fff"}function ii(t,e,o,i){let s=[...i.keys()],n=new Map;s.forEach((g,l)=>{for(let d of i.get(g).files)n.set(d,l)});let a=[...n.keys()],h=new Map(a.map((g,l)=>[g,l])),f=a.map(g=>n.get(g)),u=a.map(g=>[...e.get(g)].map(l=>h.get(l))),c=o.map(g=>h.get(g)),b=a.map(g=>{let l=t.get(g);return{size:Number.isFinite(l.size)&&l.size>=0?l.size:0,missing:+(!l.virtual&&l.size==null)}}),w=s.map(()=>({removable:0,removableMissing:0})),r=new Int32Array(a.length),y=new Int32Array(a.length),M=new Int32Array(a.length),p=new Uint8Array(a.length);for(let g=0;g<s.length;g+=32){let l=Math.min(32,s.length-g),d=l===32?-1:(1<<l)-1;y.fill(0),p.fill(0);for(let C=0;C<a.length;C++){let m=f[C]-g;r[C]=m>=0&&m<l?d&~(1<<m):d}let v=0,x=0,k=0,_=C=>{p[C]||(p[C]=1,M[k]=C,k=(k+1)%M.length,x++)};for(let C of c)y[C]=r[C],y[C]&&_(C);for(;x>0;){let C=M[v];v=(v+1)%M.length,x--,p[C]=0;for(let m of u[C]){let $=y[C]&r[m]&~y[m];$&&(y[m]|=$,_(m))}}let O=new Map;for(let C=0;C<a.length;C++){let m=d&~y[C];if(!m)continue;let $=O.get(m);$||($={size:0,missing:0},O.set(m,$)),$.size+=b[C].size,$.missing+=b[C].missing}for(let[C,m]of O)for(let $=C;$;$&=$-1){let P=g+31-Math.clz32($&-$);w[P].removable+=m.size,w[P].removableMissing+=m.missing}}s.forEach((g,l)=>Object.assign(i.get(g),w[l]))}function si(t,e,o){let i=new Map([...t.keys()].map(c=>[c,new Set]));for(let[c,b]of e){let w=o(c),r=o(b);w!==r&&i.get(w).add(r)}let{groups:s,componentOf:n}=se([...t.keys()],i),a=s.map(c=>c.reduce((b,w)=>{let r=t.get(w);return Math.max(b,r.own,r.removable)},0)),h=s.map(()=>0),f=s.map(()=>new Set);for(let[c,b]of i)for(let w of b){let r=n.get(c),y=n.get(w);r!==y&&!f[r].has(y)&&(f[r].add(y),h[y]++)}let u=[];h.forEach((c,b)=>{c||u.push(b)});for(let c of u)for(let b of f[c])a[b]=Math.max(a[b],a[c]),--h[b]===0&&u.push(b);for(let[c,b]of t)b.filterSize=a[n.get(c)]}function ni(t,e,o,i,s){let n=new Int32Array(t.length),a=s.map(()=>({size:0,missing:0}));for(let h=0;h<t.length;h+=32){let f=Math.min(32,t.length-h);for(let c=e.length-1;c>=0;c--){let b=e[c],w=b-h,r=w>=0&&w<f?1<<w:0;for(let y of t[b])r|=n[y];n[b]=r}let u=new Map;for(let c=0;c<s.length;c++){let b=n[s[c]];if(!b)continue;let w=u.get(b);if(!w){w={size:0,missing:0};for(let r=b;r;r&=r-1){let y=h+31-Math.clz32(r&-r);w.size+=o[y],w.missing+=i[y]}u.set(b,w)}a[c].size+=w.size,a[c].missing+=w.missing}}return s.map((h,f)=>[h,a[f]])}var lo=t=>Number.isFinite(t)&&t>=0?t:0,we=t=>t.filterSize,Be=(t,e)=>Math.max(t.removable,t.own)<e&&t.filterSize>=e;function ri(t){if(t.byId.size<=100)return 0;let e=[0,1,4,10,20,50,100,200].map(s=>s*1024),o=e.map(()=>0);for(let s of t.byId.values())for(let n=0;n<e.length&&!(we(s)<e[n]);n++)o[n]++;let i=0;for(;i<e.length-1&&o[i]>100&&o[i+1]>=50;)i++;return e[i]}function rs(t,e){let{groups:o,componentOf:i}=se([...t.keys()],e),s=o.map(g=>g.reduce((l,d)=>l+lo(t.get(d).size),0)),n=o.map(g=>g.filter(l=>!t.get(l).virtual&&t.get(l).size==null).length),a=o.map(()=>0),h=o.map(()=>new Set);for(let[g,l]of e)for(let d of l){let v=i.get(g),x=i.get(d);v!==x&&!h[v].has(x)&&(h[v].add(x),a[x]++)}let f=[...a],u=[];f.forEach((g,l)=>{g||u.push(l)});for(let g of u)for(let l of h[g])--f[l]===0&&u.push(l);let c=new Uint32Array(o.length),b=new Map,w=8*(o.length+h.reduce((g,l)=>g+l.size,0)),r=0,y=0,M=(g,l=!1)=>{++r===4294967295&&(c.fill(0),r=1);let d=0,v=0,x=[...g];for(;x.length>0;){let k=x.pop();if(c[k]!==r){if(l&&(y+=1+h[k].size)>w)return null;c[k]=r,v+=s[k],d+=n[k];for(let _ of h[k])c[_]!==r&&x.push(_)}}return{size:v,missing:d}},p=u.toReversed();for(let g=0;g<p.length;g++){let l=p[g],d=h[l].size===1?b.get([...h[l]][0]):null,v=d?{size:s[l]+d.size,missing:n[l]+d.missing}:M([l],!0);if(v)b.set(l,v);else{for(let[x,k]of ni(h,u,s,n,p.slice(g)))b.set(x,k);break}}return{inferred:o.filter((g,l)=>a[l]===0).map(g=>g[0]),sum(g){let l=new Set(g.map(d=>i.get(d)));return l.size===1?b.get([...l][0]):M(l)}}}function as(t){let e=new Map(t.nodes.map(n=>[n.file,n])),o=t.flowEntries??[];for(let n of o)n.virtual&&!e.has(n.file)&&e.set(n.file,{...n,size:0});let i=new Map([...e.keys()].map(n=>[n,new Set])),s=0;for(let[n,a]of e)for(let h of a.virtual?a.imports:t.importsOf.get(n)??[]){let f=e.get(h);if(!f||i.get(n).has(h))continue;let u=c=>c.virtual?c.pkg==="__own__":t.ownSourceFiles?.has(c.file);if(!Ce(a.origFile??n,f.origFile??h,u(f),u(a))){s++;continue}i.get(n).add(h)}return{files:e,links:i,entries:o.filter(n=>n.entry!==!1).map(n=>n.file).filter(n=>e.has(n)),weakEdges:s}}function ls(t,e){let o=new Map;for(let i of t){let s=e.get(i),n=s.packageInfo;if(!n)continue;o.has(n.directory)||o.set(n.directory,{...n,size:0,missing:0});let a=o.get(n.directory);a.size+=lo(s.size),!s.virtual&&s.size==null&&a.missing++}return[...o.values()].toSorted((i,s)=>s.size-i.size||i.directory.localeCompare(s.directory))}function ai(t,{packages:e=!1}={}){let{files:o,links:i,entries:s,weakEdges:n}=as(t),a=rs(o,i),h=s.length>0?[...new Set(s)]:a.inferred,f=new Set(h),u=new Map,c=[...h];for(let p of c)for(let g of i.get(p))f.has(g)||(f.add(g),c.push(g),u.set(g,p));let b=new Map,w=p=>`${e?"p":"f"}:${e?o.get(p).pkg:p}`;for(let p of f){let g=w(p),l=o.get(p);b.has(g)||b.set(g,{id:g,pkg:l.pkg,label:e?$e(l.pkg):p,version:e?void 0:l.packageInfo?.version,files:[],own:0,virtual:!0,incoming:[],outgoing:[]});let d=b.get(g);d.files.push(p),d.own+=lo(l.size),d.virtual&&=!!l.virtual}for(let p of b.values())Object.assign(p,a.sum(p.files)),e&&(p.instances=ls(p.files,o));ii(o,i,h,b),si(b,u,w);let r=new Map;for(let p of f)for(let g of i.get(p)){let l=w(p),d=w(g);if(e&&l===d)continue;let v=JSON.stringify([l,d]);r.has(v)||r.set(v,{id:v,from:l,to:d,targets:new Set,count:0});let x=r.get(v);x.targets.add(g),x.count++}let y=[...r.values()];for(let p of y)Object.assign(p,a.sum([...p.targets])),b.get(p.from).outgoing.push(p),b.get(p.to).incoming.push(p);let M=[...new Set(h.map(w))];return{byId:b,edges:y,edgeById:r,roots:M,files:o,packages:e,weakEdges:n,inferred:s.length===0,total:a.sum(h),omittedFiles:o.size-f.size}}function cs(t,e,o){let i=new Set(e),s=[...e],n=new Set(e);for(let r of s)for(let y of t.byId.get(r).outgoing)!i.has(y.to)&&o(y.to)&&(i.add(y.to),s.push(y.to));let a=new Map(s.map(r=>[r,new Set(t.byId.get(r).outgoing.map(y=>y.to).filter(y=>i.has(y)&&!n.has(y)))])),{componentOf:h,groups:f}=se(s,a),u=f.map(()=>0),c=f.map(()=>new Set),b=f.map(()=>0);for(let[r,y]of a)for(let M of y){let p=h.get(r),g=h.get(M);p!==g&&!c[p].has(g)&&(c[p].add(g),u[g]++)}let w=[];u.forEach((r,y)=>{r||w.push(y)});for(let r of w)for(let y of c[r])b[y]=Math.max(b[y],b[r]+1),--u[y]===0&&w.push(y);return new Map(s.map(r=>[r,b[h.get(r)]]))}function ds(t,e,o){let i=new Map(t.map(s=>[s.id,{from:[],to:[]}]));for(let s of e)i.get(s.from).from.push(s),i.get(s.to).to.push(s);for(let s of t)for(let n of["from","to"]){let a=n==="to",h=a?"x2":"x1",f=a?"width2":"width1",u=d=>{let v=o.get(a?d.from:d.to);return v.x+v.width/2},c=i.get(s.id)[n].toSorted((d,v)=>u(d)-u(v)||d.id.localeCompare(v.id));if(c.length===0)continue;let b=c.reduce((d,v)=>d+v[f],0),w=0;if(b<=s.width){for(let d of c)d[h]=s.x+w,w+=d[f];continue}let r=c[0][f]/2,y=c.at(-1)[f]/2,M=b-r-y,p=new Float64Array(c.length),g=s.width,l=0;for(let d=c.length-1;d>=0;d--)g=Math.min(g,s.width-c[d][f]/2),p[d]=g;for(let d=0;d<c.length;d++){let v=c[d],x=v[f]/2,k=r+(w+x-r)/M*(s.width-r-y),_=Math.min(p[d],Math.max(l,x,k));v[h]=s.x+_-x,l=_,w+=v[f]}}}function hs(t,e){let o=0,i=0;for(let s=0,n=0;s<t.length;s++){for(;n<e.length&&e[n]<t[s];)n++;o+=n}for(let s=0,n=0;n<e.length;n++){for(;s<t.length&&t[s]<e[n];)s++;i+=s}return[o,i]}function fs(t,e,o){let i=new Map;for(let n of e){let a=o.get(n.from),h=o.get(n.to);if(a.level===h.level)continue;let[f,u]=a.level<h.level?[a,h]:[h,a];i.has(u)||i.set(u,[]),i.get(u).push(f)}let s=1e6;for(let n of t.values()){let a=new Map(n.map(f=>[f,(i.get(f)??[]).map(u=>u.x+u.width/2).toSorted((u,c)=>u-c)]));for(let f=0;f<n.length&&s>0;f++){let u=!1;for(let c=0;c+1<n.length;c++){let b=a.get(n[c]),w=a.get(n[c+1]);s-=1+b.length+w.length;let[r,y]=hs(b,w);y<r&&([n[c],n[c+1]]=[n[c+1],n[c]],u=!0)}if(!u)break}let h=0;for(let f of n)f.x=h,h+=f.width}}function ps(t){let e=o=>t.byId.get(o).pkg;return _e(t.edges.map(o=>[e(o.from),e(o.to)]),t.packages?ue:pe)}function li(t,{focus:e=null,minSize:o=0,width:i=1100}={}){let s=ps(t),n=k=>we(t.byId.get(k))>=o&&!s.has(t.byId.get(k).pkg),a=(e&&t.byId.has(e)?[e]:t.roots).filter(n),h=cs(t,a,n),f=[...h.keys()].filter(n).toSorted((k,_)=>h.get(k)-h.get(_)||t.byId.get(_).removable-t.byId.get(k).removable||k.localeCompare(_)),u=new Set(f),c=t.edges.filter(k=>u.has(k.from)&&u.has(k.to)).toSorted((k,_)=>_.size-k.size||k.id.localeCompare(_.id)).map(k=>({...k})),b=[...u].map(k=>({...t.byId.get(k),level:h.get(k)})),w=Map.groupBy(b,k=>k.level),r=new Map(b.map(k=>[k.id,k])),y=b.reduce((k,_)=>Math.max(k,_.removable),1),M=k=>Math.max(k,y/4e3),p=[...w.values()].reduce((k,_)=>Math.max(k,_.reduce((O,C)=>O+C.removable,0)),1),g=88,l=Math.max(1,i)/p,d=0,v=0;for(let k of b)k.y=12+k.level*g,k.width=Math.max(.1,k.removable*l),v=Math.max(v,k.y+26);fs(w,c,r);for(let k of w.values())d=Math.max(d,k.reduce((_,O)=>_+O.width,0)),k.forEach((_,O)=>{_.rowStart=O===0,_.rowEnd=O===k.length-1});let x=[...w.values()].flat();for(let k of c){let _=r.get(k.from),O=r.get(k.to),C=M(k.size)*l;k.width1=Math.min(C,_.width),k.width2=Math.min(C,O.width),k.x1=_.x+(_.width-k.width1)/2,k.x2=O.x+(O.width-k.width2)/2,k.y1=_.y+26,k.y2=O.y,k.returning=O.level<=_.level,k.returning&&(v=Math.max(v,Math.max(k.y1,k.y2)+35))}return ds(x,c,r),{nodes:x,byId:r,edges:c,roots:a,hiddenPackages:s,width:Math.max(1,d),height:v+12}}function qe(t,e,o){if(!(e>0&&o>0))return t;let i=Math.min(e/1100,o/t.height,9.99),s=e/i;if(Math.abs(s-t.width)<1e-7)return t;let n=s/t.width,a=t.nodes.map(f=>({...f,x:f.x*n,width:f.width*n})),h=t.edges.map(f=>({...f,x1:f.x1*n,x2:f.x2*n,width1:f.width1*n,width2:f.width2*n}));return{...t,nodes:a,edges:h,byId:new Map(a.map(f=>[f.id,f])),width:s}}function ci(t){let{x1:e,x2:o,y1:i,y2:s,width1:n,width2:a}=t,h=t.returning?Math.max(i,s)+35:(i+s)/2;return`M${e},${i} C${e},${h} ${o},${h} ${o},${s} L${o+a},${s} C${o+a},${h} ${e+n},${h} ${e+n},${i} Z`}function di(t){let e=t.returning?Math.max(t.y1,t.y2)+35:(t.y1+t.y2)/2;return{left:Math.min(t.x1,t.x2),right:Math.max(t.x1+t.width1,t.x2+t.width2),top:Math.min(t.y1,t.y2,e),bottom:Math.max(t.y1,t.y2,e)}}function Xt(t,e){return t.right<e.left||t.left>e.right||t.bottom<e.top||t.top>e.bottom}function He(t){if(t.length===0)return null;let e={left:1/0,right:-1/0,top:1/0,bottom:-1/0};for(let a of t)e.left=Math.min(e.left,a.left),e.right=Math.max(e.right,a.right),e.top=Math.min(e.top,a.top),e.bottom=Math.max(e.bottom,a.bottom);if(t.length<=12)return{...e,entries:t};let o=e.right-e.left>e.bottom-e.top,i=a=>o?a.left+a.right:a.top+a.bottom,s=t.toSorted((a,h)=>i(a)-i(h)),n=s.length>>>1;return{...e,children:[He(s.slice(0,n)),He(s.slice(n))]}}function hi(t,e,o){let i=[],s={left:e,right:e,top:o,bottom:o},n=t?[t]:[];for(;n.length>0;){let a=n.pop();if(!Xt(a,s))if(a.entries)for(let h of a.entries)Xt(h,s)||i.push(h);else n.push(...a.children)}return i.toSorted((a,h)=>h.order-a.order)}function fi(t,e,o){let i=[],s=t?[t]:[];for(;s.length>0;){let n=s.pop();if(!Xt(n,e))if(n.entries){for(let a of n.entries)if(!(!a.edge||Xt(a,e))&&(i.push(a),i.length>o))return null}else s.push(...n.children)}return i.toSorted((n,a)=>n.order-a.order)}var Nt=Ct;function us(t){if(!t.instances?.length)return t.version?`
|
|
9
|
-
Version: ${
|
|
10
|
-
Version: ${
|
|
11
|
-
Versions
|
|
12
|
-
`+[...
|
|
13
|
-
`)}function
|
|
14
|
-
${
|
|
15
|
-
Kept by Large to preserve an entry-point path
|
|
16
|
-
${Ct(t.size)} reachable${t.returning?" \xB7 return / cycle edge":""}`}var ui=t=>Math.min(.5/t,13);function co(t,e){let o=t.width/2;if(t.rowStart===t.rowEnd){let n=Math.min(e,o/2);return{left:n,right:n}}let i=Math.min(e,o),s=Math.min(e,o-i);return t.rowStart?{left:i,right:s}:{left:s,right:i}}var gi="Import paths. Use arrow keys to explore bars, Enter to select, or the sidebar search to find a file or package.",ms=1500,De=class{constructor(e){this.host=e}render(){return I`<canvas class="flow-canvas flow-base" aria-hidden="true"></canvas><canvas class="flow-canvas flow-bars" aria-hidden="true"></canvas><canvas class="flow-canvas flow-overlay" tabindex="0" role="group" aria-label="${gi}" @pointermove="${e=>this.pointer(e)}" @pointerleave="${()=>this.clearHover()}" @click="${e=>this.click(e)}" @dblclick="${e=>this.click(e,!0)}" @keydown="${e=>this.key(e)}"></canvas>`}prepare(){this.layout=this.host.layout,this.model=this.host.model,this.paths=this.layout.edges.map((o,i)=>({edge:o,order:i,path:new Path2D(ci(o)),...di(o)})),this.pathById=new Map(this.paths.map(o=>[o.edge.id,o])),this.rows=[...Map.groupBy(this.layout.nodes,o=>o.y).values()];let e=this.layout.nodes.map((o,i)=>({node:o,order:this.paths.length+i,left:o.x,right:o.x+o.width,top:o.y,bottom:o.y+26}));this.index=He([...this.paths,...e]),this.clearHover(),this.focused=null,this.invalidateRaster()}matchingNodes(){let e=this.host.model,o=JSON.stringify([this.host.minSize,this.host.graph.issuesHidden,z.pathFilter,[...z.selectedSeverities].toSorted(),[...z.selectedColors].toSorted()]);return(this.matchModel!==e||this.filterKey!==o)&&(this.matches=new Set([...e.byId.values()].filter(i=>this.host.matchesNode(i)).map(i=>i.id)),this.matchModel=e,this.filterKey=o,this.searchResult=null),this.matches}searchMatches(){let e=this.matchingNodes();return this.searchResult??=[...e].map(o=>this.host.model.byId.get(o)).toSorted((o,i)=>i.removable-o.removable)}update(e){if(this.base=e.querySelector(".flow-base"),this.bars=e.querySelector(".flow-bars"),this.overlay=e.querySelector(".flow-overlay"),!this.base||!this.bars||!this.overlay)return;this.layout!==this.host.layout&&this.prepare();let o=Oe(),i=this.matchingNodes(),s=ht("__own__");(i!==this.paintedMatches||s!==this.palette||o!==this.background)&&(this.paintedMatches=i,this.palette=s,this.background=o,this.colors=new Map([...this.model.byId.values()].map(n=>[n.pkg,ht(n.pkg)])),this.foreground=getComputedStyle(this.host).getPropertyValue("--text").trim()||"#fff",this.invalidateRaster()),this.requestDraw()}requestDraw(){this.frame!=null||!this.overlay||(this.frame=requestAnimationFrame(()=>{this.frame=null,this.draw()}))}dispose(){this.clearHover(),this.frame!=null&&cancelAnimationFrame(this.frame),this.frame=null,this.base=null,this.bars=null,this.overlay=null,this.invalidateRaster()}stopPreview(){clearTimeout(this.previewTimer),this.settleFrame!=null&&cancelAnimationFrame(this.settleFrame),this.settleFrame=null,this.previewTimer=null,this.preview=!1}invalidateRaster(){this.stopPreview(),this.baseKey=null,this.barsKey=null,this.overview=null,this.paintedViewport=null}viewportChanged(){let{width:e,height:o,zoom:i,pan:s}=this.host,n=`${e}:${o}:${i}:${s.x}:${s.y}`;if(n===this.viewportKey){this.preview&&this.host.fitted&&(this.stopPreview(),this.requestDraw());return}this.viewportKey=n,this.stopPreview();let a=this.paintedViewport;this.host.fitted===!1&&this.overview&&a?.width===e&&a.height===o&&a.dpr===(globalThis.devicePixelRatio||1)&&(this.preview=!0,this.previewTimer=setTimeout(()=>{this.previewTimer=null,this.settleFrame=requestAnimationFrame(()=>{this.settleFrame=requestAnimationFrame(()=>{this.stopPreview(),this.requestDraw()})})},100)),this.clearHover(),this.requestDraw()}context(e,o,i=!0){let s=Math.ceil(this.host.height*o),n=Math.ceil(this.host.width*o);(e.width!==n||e.height!==s)&&(e.width=n,e.height=s);let a=e.getContext("2d");a.setTransform(1,0,0,1,0,0),i&&a.clearRect(0,0,n,s);let{pan:h,zoom:f}=this.host;return a.setTransform(o*f,0,0,o*f,o*h.x,o*h.y),a}draw(){if(!this.overlay||!this.host.width||!this.host.height)return;let{pan:e,zoom:o,width:i,height:s}=this.host,n=globalThis.devicePixelRatio||1,a=`${this.viewportKey}:${n}`;this.view={left:-e.x/o,right:(i-e.x)/o,top:-e.y/o,bottom:(s-e.y)/o};let h=this.preview?fi(this.index,this.view,ms):null;if(h&&this.stopPreview(),this.preview){this.drawPreview(n),this.drawBars(n,a,!0);let u=this.context(this.overlay,n),c=this.layout.byId.get(this.host.selection?.node);c&&(u.globalAlpha=1,u.strokeStyle=this.foreground,u.lineWidth=Math.min(1.5/o,c.width/2),u.strokeRect(c.x,c.y,c.width,26)),this.previewVisible=!0;return}let f=this.baseKey!==a;if(f){let u=this.context(this.base,n);u.globalAlpha=1,u.fillStyle=this.background,u.fillRect(this.view.left,this.view.top,i/o,s/o),this.visiblePaths=h??this.paths.filter(c=>!Xt(c,this.view));for(let c of this.visiblePaths)this.paintPath(u,c,this.edgeAlpha(c.edge));if(this.baseKey=a,this.paintedViewport={width:i,height:s,zoom:o,pan:{...e},dpr:n},this.view.left<=0&&this.view.top<=0&&this.view.right>=this.layout.width-1e-6&&this.view.bottom>=this.layout.height-1e-6){let c=this.overview?.canvas??document.createElement("canvas");c.width=this.base.width,c.height=this.base.height,c.getContext("2d").drawImage(this.base,0,0),this.overview={...this.paintedViewport,canvas:c}}}this.drawBars(n,a),this.drawHighlight(n,f||this.previewVisible),this.previewVisible=!1}drawPreview(e){let{width:o,height:i,pan:s,zoom:n}=this.host,a=this.context(this.bars,e,!1);a.setTransform(e,0,0,e,0,0),a.globalAlpha=1,a.imageSmoothingEnabled=!1;let h={...this.paintedViewport,canvas:this.base},f=n/h.zoom,u=s.x-h.pan.x*f,c=s.y-h.pan.y*f,b=u<=0&&c<=0&&u+h.width*f>=o&&c+h.height*f>=i;b||(a.fillStyle=this.background,a.fillRect(0,0,o,i));for(let w of b?[h]:[this.overview,h]){let r=n/w.zoom,y=s.x-w.pan.x*r,M=s.y-w.pan.y*r,p=Math.max(0,y),g=Math.max(0,M),l=Math.min(i,M+w.height*r),d=Math.min(o,y+w.width*r);if(d<=p||l<=g)continue;let v=w.dpr/r;a.drawImage(w.canvas,(p-y)*v,(g-M)*v,(d-p)*v,(l-g)*v,p,g,d-p,l-g)}}drawBars(e,o,i=!1){if(!i&&this.barsKey===o&&!this.previewVisible)return;this.barsKey!==o&&(this.visibleNodes=this.layout.nodes.filter(n=>!Xt({left:n.x,right:n.x+n.width,top:n.y,bottom:n.y+26},this.view)));let s=this.context(this.bars,e,!i);for(let n of this.visibleNodes)this.paintNode(s,n);this.paintRowBorders(s),this.barsKey=o}paintRowBorders(e){let o=ui(this.host.zoom);e.globalAlpha=1,e.fillStyle=this.background;for(let i of this.rows){let s=i[0],n=i.at(-1),a=n.x+n.width;if(Xt({left:s.x,right:a,top:s.y,bottom:s.y+26},this.view))continue;e.fillRect(s.x,s.y,a-s.x,o),e.fillRect(s.x,s.y+26-o,a-s.x,o),e.fillRect(s.x,s.y,co(s,o).left,26);let h=co(n,o).right;e.fillRect(a-h,s.y,h,26)}}edgeAlpha(e){return!this.matches.has(e.from)&&!this.matches.has(e.to)?.04:.22}paintPath(e,o,i){e.globalAlpha=i,e.fillStyle=this.colors.get(this.model.byId.get(o.edge.to).pkg),e.fill(o.path),o.edge.returning&&(e.strokeStyle=this.foreground,e.lineWidth=.7/this.host.zoom,e.setLineDash([3,3]),e.stroke(o.path),e.setLineDash([]))}paintNode(e,o){if(Xt({left:o.x,right:o.x+o.width,top:o.y,bottom:o.y+26},this.view))return;let{zoom:i}=this.host,s=this.colors.get(o.pkg);e.globalAlpha=this.matches.has(o.id)?1:.15,e.fillStyle=s,e.fillRect(o.x,o.y,o.width,26);let{left:n,right:a}=co(o,ui(i));e.fillStyle=this.background,!o.rowStart&&n>0&&e.fillRect(o.x,o.y,n,26),!o.rowEnd&&a>0&&e.fillRect(o.x+o.width-a,o.y,a,26),o.width>=40&&o.width*i>=24&&14*i>=6&&(e.save(),e.beginPath(),e.rect(o.x+5,o.y,Math.max(0,o.width-10),26),e.clip(),e.font="14px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",e.fillStyle=Ee(s),e.fillText(`${o.label.replace(/^node_modules\//u,"")} \xB7 ${Nt(o.removable)}`,o.x+5,o.y+18),e.restore())}drawHighlight(e,o){let i=this.host.selection,s=new Set([i?.edge,this.host.hover]);for(let g of[i?.node,this.focused]){let l=this.model.byId.get(g);if(l)for(let d of[...l.incoming,...l.outgoing])s.add(d.id)}let n=[];for(let g of s){let l=this.pathById.get(g);if(!l||Xt(l,this.view)||this.edgeAlpha(l.edge)===.04)continue;let d=g===i?.edge||g===this.host.hover?.8:.6;n.push({entry:l,alpha:(d-.22)/(1-.22)})}let a=[...new Set([i?.node,this.focused])].map(g=>this.layout.byId.get(g)).filter(Boolean),h=n.map(({entry:g})=>g).concat(a.map(g=>({left:g.x,right:g.x+g.width,top:g.y,bottom:g.y+26}))),f=g=>g.reduce((l,d)=>({left:Math.min(l.left,d.left),right:Math.max(l.right,d.right),top:Math.min(l.top,d.top),bottom:Math.max(l.bottom,d.bottom)}),{left:1/0,right:-1/0,top:1/0,bottom:-1/0}),u=f(h),c=o?this.view:f([u,this.highlightBounds??u]);this.highlightBounds=u;let b=this.context(this.overlay,e,o),w=2/this.host.zoom,r=Math.max(this.view.left,c.left-w),y=Math.max(this.view.top,c.top-w),M=Math.min(this.view.bottom,c.bottom+w)-y,p=Math.min(this.view.right,c.right+w)-r;if(p>0&&M>0){o||b.clearRect(r,y,p,M),b.save(),b.beginPath(),b.rect(r,y,p,M),b.clip();for(let{entry:g,alpha:l}of n)this.paintPath(b,g,l);if(n.length>0){b.save(),b.beginPath();let g={left:r,right:r+p,top:y,bottom:y+M};for(let l of this.visibleNodes)Xt({left:l.x,right:l.x+l.width,top:l.y,bottom:l.y+26},g)||b.rect(l.x,l.y,l.width,26);b.clip(),b.clearRect(r,y,p,M),b.restore()}b.globalAlpha=1,b.strokeStyle=this.foreground;for(let g of a)b.lineWidth=Math.min(1.5/this.host.zoom,g.width/2),b.strokeRect(g.x,g.y,g.width,26);b.restore()}}hit(e){if(!this.overlay||!this.index)return null;let o=this.overlay.getBoundingClientRect(),{pan:i,zoom:s}=this.host,n=(e.clientX-o.left-i.x)/s,a=(e.clientY-o.top-i.y)/s,h=this.overlay.getContext("2d");h.save(),h.setTransform(1,0,0,1,0,0);let f=hi(this.index,n,a).find(u=>u.node||h.isPointInPath(u.path,n,a));return h.restore(),f??null}pointer(e){if(this.host.drag)return;let o=this.hit(e),i=o?.node?.id??o?.edge.id??null;i!==this.hoverId&&(this.clearHover(),this.hoverId=i,this.focused=o?.node?.id??null,this.host.hover=o?.edge?.id??null,o&&(this.overlay.dataset.tooltip=o.node?pi(o.node,this.host.minSize):gs(o.edge,this.model),this.overlay.setAttribute("aria-label",this.overlay.dataset.tooltip),this.overlay.style.cursor="default"),this.requestDraw()),o&&Ao(this.overlay,{gate:()=>!this.host.drag&&this.hoverId===i})}clearHover(){ie(this.host.renderRoot),this.hoverId=null,this.focused=null,this.host.hover=null,this.overlay&&(delete this.overlay.dataset.tooltip,this.overlay.style.cursor="default",this.overlay.setAttribute("aria-label",gi)),this.requestDraw()}setHover(e){e==null?this.clearHover():(this.host.hover=e,this.requestDraw())}click(e,o=!1){if(e.defaultPrevented)return;let i=this.hit(e);if(o){i?.node&&this.host.follow(i.node.id);return}this.host.select(i?.node?.id??i?.edge.to??null,i?.edge?.id??null)}key(e){let o=this.layout.nodes;if(o.length===0)return;let i=o.findIndex(u=>u.id===(this.focused??this.host.selection?.node));if(["ArrowRight","ArrowDown"].includes(e.key))i=Math.min(o.length-1,i+1);else if(["ArrowLeft","ArrowUp"].includes(e.key))i=Math.max(0,i-1);else if(e.key==="Home")i=0;else if(e.key==="End")i=o.length-1;else if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.host.select(o[Math.max(0,i)].id);return}else if(e.key==="Escape"){this.clearHover(),this.host.select(null);return}else return;e.preventDefault();let s=o[i],{pan:n,zoom:a,width:h,height:f}=this.host;(s.x*a+n.x<0||(s.x+s.width)*a+n.x>h||s.y*a+n.y<0||(s.y+26)*a+n.y>f)&&(this.host.pan={x:h/2-(s.x+s.width/2)*a,y:f/2-(s.y+13)*a},this.host.fitted=!1,this.host.drawViewport()),this.focused=s.id,this.overlay.setAttribute("aria-label",pi(s,this.host.minSize)),this.requestDraw()}};function be(t,e,o=!1){let i=o?e:1;return{min:e,max:i*9.99,percent:Math.round(t/i*100)}}var mi=`:host{display:contents}*{box-sizing:border-box}button{font:inherit;color:var(--text);border:1px solid var(--border);background:var(--surface);border-radius:var(--ui-radius, 4px);padding:4px 7px;cursor:default}button:hover{background:var(--graph-hover-bg)}button:disabled{opacity:.4;cursor:default}button:focus-visible{outline:2px solid var(--accent)}.flow-stage{grid-area:stage;position:relative;min-width:0;min-height:0;display:flex;flex-direction:column;background:var(--flow-background)}.flow-viewport{flex:1;position:relative;overflow:hidden;min-height:0;touch-action:none;cursor:default;user-select:none;-webkit-user-select:none}.flow-count{position:absolute;bottom:12px;right:50px;padding:6px 8px;color:var(--muted);font-size:11px;z-index:3;pointer-events:none}.flow-canvas{display:block;position:absolute;inset:0;width:100%;height:100%}.flow-base,.flow-bars{pointer-events:none}.flow-overlay:focus-visible{outline:1px solid var(--accent);outline-offset:-1px}.flow-panel{grid-area:right;overflow:auto;min-height:0;padding:14px;border-left:1px solid var(--border);background:var(--surface)}.flow-panel h3{font-size:13px;margin:0;overflow-wrap:anywhere}.flow-panel h4{margin:20px 0 8px;color:var(--muted);font-size:11px}.flow-panel p{color:var(--muted);font-size:12px;line-height:1.6}.flow-panel-heading{display:flex;align-items:start;gap:10px;justify-content:space-between}.flow-metrics{display:grid;gap:5px;margin:18px 0}.flow-metrics b{font-size:20px;font-weight:500}.flow-metrics span{color:var(--muted);font-size:11px;margin-bottom:8px}.flow-versions{list-style:none;padding:0;margin:0 0 18px;font-size:12px}.flow-versions-details{margin:18px 0}.flow-versions-details summary{color:var(--muted);font-size:11px;cursor:default}.flow-versions li+li{margin-top:10px}.flow-versions li>div{display:flex;justify-content:space-between;gap:8px}.flow-versions small{display:block;color:var(--muted);overflow-wrap:anywhere;margin-top:3px}.flow-direction{overflow-wrap:anywhere}.flow-actions{display:flex;gap:6px;flex-wrap:wrap}.flow-link{grid-template-columns:8px minmax(0,1fr) auto}
|
|
17
|
-
`;var fo=10,Xe=t=>Math.max(1,t-2*fo);function ho(t,e,o){return I`<button class="g2-dist-item flow-link" data-tooltip="${t.label}" @click="${o}"><span class="g2-dist-dot" style="${`background:${ht(t.pkg)}`}"></span> <span class="g2-dist-name">${t.label}</span><span class="g2-dist-count">${Nt(e)}</span></button>`}var po=class extends ce{static properties={graph:{attribute:!1},packages:{type:Boolean}};static styles=[Pt(he),Pt(mi),Pt(fe),Pt(Ie)];constructor(){super(),this.packages=!1,this.zoom=1,this.pan={x:0,y:0},this.width=0,this.height=0,this.needsFit=!0,this.fitted=!0,this.largeOnly=!0,this.largeSuppressed=!1,this.largeThreshold=0,this.models=new Map,this.chart=new De(this),this.focus=null,this.selection=null,this.hover=null,this.bridge={requestDraw:()=>this.requestUpdate(),_cleanup:()=>{}}}willUpdate(e){if(!this.graph)return;let o=!1;e.has("graph")&&this.models.clear(),e.has("packages")&&(this.needsFit=!0),(!this.model||e.has("graph")||e.has("packages"))&&(this.models.has(this.packages)||this.models.set(this.packages,ai(this.graph,{packages:this.packages})),this.model=this.models.get(this.packages),this.largeThreshold=ri(this.model),o=!0,this.model.byId.has(this.focus)||(this.focus=null),this.selection&&!this.model.byId.has(this.selection.node)&&(this.selection=null),this.hover=null),(o||this.layoutFocus!==this.focus)&&(this.largeSuppressed=this.isSmallFocus()),this.focus&&we(this.model.byId.get(this.focus))<this.minSize&&(this.focus=null),(o||this.layoutFocus!==this.focus||this.layoutMinSize!==this.minSize)&&(this.renderRoot&&ie(this.renderRoot),this.layout=qe(li(this.model,{focus:this.focus,minSize:this.minSize}),Xe(this.width),this.height),this.layoutFocus=this.focus,this.layoutMinSize=this.minSize,this.selection&&!this.layout.byId.has(this.selection.node)&&(this.selection=null))}get minSize(){return this.largeOnly&&!this.largeSuppressed?this.largeThreshold:0}toggleLarge(){this.largeOnly=!this.largeOnly,this.needsFit=!0,this.requestUpdate()}renderControls(){return this.largeThreshold&&!this.largeSuppressed?I`<mode-switch label="${`Large \xB7 ${this.largeThreshold/1024}+ KiB`}" .checked="${this.largeOnly}" @click="${()=>this.toggleLarge()}"></mode-switch>`:null}updated(){z.graphState=this.bridge;let e=`${this.largeThreshold}:${this.largeOnly}:${this.largeSuppressed}`;e!==this.controlsKey&&(this.controlsKey=e,this.dispatchEvent(new CustomEvent("flow-controls-change",{detail:this.renderControls(),bubbles:!0,composed:!0}))),this.connectViewport(),this.syncViewport(),this.chart.update(this.renderRoot)}connectViewport(){let e=this.renderRoot.querySelector(".flow-viewport");if(!e||this.events)return;ze(this.renderRoot,{gate:()=>!this.drag}),this.events=new AbortController;let{signal:o}=this.events;e.addEventListener("wheel",i=>this.wheel(i),{passive:!1,signal:o}),e.addEventListener("pointerdown",i=>this.startPan(i),{signal:o}),window.addEventListener("pointermove",i=>this.movePan(i),{signal:o}),window.addEventListener("pointerup",i=>this.endPan(i),{signal:o}),window.addEventListener("pointercancel",i=>this.endPan(i),{signal:o}),window.addEventListener("deepview-theme-changed",()=>this.requestUpdate(),{signal:o}),e.addEventListener("click",i=>{let s=this.suppressClick&&i.detail>0;if(this.suppressClick=!1,s){i.preventDefault(),i.stopPropagation();return}i.target.closest?.(".flow-canvas")||this.select(null)},{capture:!0,signal:o}),this.resizeObserver=new ResizeObserver(()=>this.syncViewport()),this.resizeObserver.observe(e)}disconnectedCallback(){super.disconnectedCallback(),ie(this.renderRoot),this.resizeObserver?.disconnect(),this.resizeObserver=null,this.events?.abort(),this.events=null,this.chart.dispose(),this.viewportElements=null,this.drag=null,z.graphState===this.bridge&&(z.graphState=null)}select(e,o=null){if(!e&&this.focus){this.follow(null);return}this.selection=e?{node:e,edge:o}:null,this.requestUpdate()}follow(e){this.focus=e,this.selection=e?{node:e,edge:null}:null,this.needsFit=!0,this.requestUpdate()}isSmallFocus(){if(!this.focus)return!1;let e=[this.focus],o=new Set(e);for(let i of e){if(o.size>=200)break;for(let{to:s}of this.model.byId.get(i).outgoing)if(o.has(s)||(o.add(s),e.push(s)),o.size>=200)break}return o.size<200}fitScale(){return this.layout&&this.width>0&&this.height>0?Math.min(Xe(this.width)/this.layout.width,this.height/this.layout.height,9.99):1}zoomMetrics(){return be(this.zoom,Math.min(this.fitScale(),1))}align(){this.pan={x:fo,y:(this.height-this.layout.height*this.zoom)/2}}syncViewport(){let e=this.renderRoot.querySelector(".flow-viewport")?.getBoundingClientRect();if(!this.layout||!e||e.width<=0||e.height<=0)return;let o=qe(this.layout,Xe(e.width),e.height);if(this.width>0&&this.height>0&&(this.pan.x=e.width/2-(this.width/2-this.pan.x)*o.width/this.layout.width,this.pan.y+=(e.height-this.height)/2),o!==this.layout&&(ie(this.renderRoot),this.layout=o,this.requestUpdate()),this.width=e.width,this.height=e.height,this.needsFit||this.fitted){this.fit();return}let{min:i,max:s}=this.zoomMetrics(),n=Math.max(i,Math.min(s,this.zoom));n!==this.zoom&&(this.zoom=n,this.align()),this.drawViewport()}fit(){let e=this.renderRoot.querySelector(".flow-viewport")?.getBoundingClientRect();if(!this.layout||!e||e.width<=0||e.height<=0)return;let o=qe(this.layout,Xe(e.width),e.height);o!==this.layout&&(ie(this.renderRoot),this.layout=o,this.requestUpdate()),this.width=e.width,this.height=e.height,this.zoom=this.fitScale(),this.needsFit=!1,this.fitted=!0,this.align(),this.drawViewport()}zoomBy(e,o=this.width/2,i=this.height/2){let{min:s,max:n}=this.zoomMetrics(),a=Math.max(s,Math.min(n,this.zoom*e)),h=a/this.zoom;a!==this.zoom&&(this.fitted=!1),this.pan.x=o-(o-this.pan.x)*h,this.pan.y=i-(i-this.pan.y)*h,this.zoom=a,this.drawViewport()}wheel(e){e.preventDefault();let o=this.renderRoot.querySelector(".flow-viewport").getBoundingClientRect(),i=Math.exp(-e.deltaY*.0015),{min:s}=this.zoomMetrics();if(i<1&&this.zoom<=s*1.0001){this.zoom=s;let n=Math.min(.4,(1-i)*3);this.pan.x+=(fo-this.pan.x)*n,this.pan.y+=((this.height-this.layout.height*s)/2-this.pan.y)*n,this.drawViewport()}else this.zoomBy(i,e.clientX-o.left,e.clientY-o.top)}startPan(e){e.button===0&&(this.suppressClick=!1,this.drag={id:e.pointerId,x:e.clientX,y:e.clientY,pan:{...this.pan},moved:!1})}movePan(e){if(!this.drag||e.pointerId!==this.drag.id)return;let o=e.clientX-this.drag.x,i=e.clientY-this.drag.y;Math.abs(o)+Math.abs(i)>3&&(this.drag.moved=!0),this.drag.moved&&(this.fitted=!1,this.suppressClick=!0,this.chart.setHover(null),this.pan={x:this.drag.pan.x+o,y:this.drag.pan.y+i},this.drawViewport())}endPan(e){e.pointerId===this.drag?.id&&(this.drag=null)}drawViewport(){this.chart.viewportChanged(),this.viewportElements??={label:this.renderRoot.querySelector(".g2-zoom-pct"),zoomIn:this.renderRoot.querySelector('[aria-label="Zoom in"]'),zoomOut:this.renderRoot.querySelector('[aria-label="Zoom out"]')};let{label:e,zoomIn:o,zoomOut:i}=this.viewportElements,{min:s,max:n,percent:a}=this.zoomMetrics();e&&(e.textContent=`${a}%`),o&&(o.disabled=this.zoom>=n*.9999),i&&(i.disabled=this.zoom<=s*1.0001)}matchesNode(e){if(we(e)<this.minSize||this.layout?.hiddenPackages?.has(e.pkg))return!1;let o=z.pathFilter.trim().toLowerCase();if(o&&!`${e.label} ${e.pkg}`.toLowerCase().includes(o))return!1;if(this.graph.issuesHidden)return!0;let i=s=>e.files.some(n=>[...this.model.files.get(n)[s]??[]].some(a=>(s==="severitySet"?z.selectedSeverities:z.selectedColors).has(a)));return(z.selectedSeverities.size===0||i("severitySet"))&&(z.selectedColors.size===0||i("colorSet"))}renderLinks(e,o=!1){return e.toSorted((i,s)=>s.size-i.size).slice(0,100).map(i=>{let s=this.model.byId.get(o?i.from:i.to);return ho(s,i.size,()=>this.select(s.id,i.id))})}renderSearch(){if(!z.pathFilter.trim())return null;let e=this.chart.searchMatches();return I`<h4>Matches · ${e.length}</h4>${e.slice(0,100).map(o=>ho(o,o.removable,()=>this.follow(o.id)))} ${e.length>100?I`<p>Showing the 100 largest matches. Refine the search to find any file or package, including those beyond the visible graph.</p>`:null}`}renderPanel(){let e=this.model.byId.get(this.selection?.node),o=this.model.edgeById.get(this.selection?.edge);return e?I`<div class="flow-panel-heading"><h3>${e.label}</h3><button type="button" class="detail-action" aria-label="Clear flow selection" @click="${()=>this.select(null)}">×</button></div>${o?I`<p class="flow-direction">${this.model.byId.get(o.from).label}<br>↓ imports<br>${this.model.byId.get(o.to).label}</p><div class="flow-metrics"><b>${Nt(o.size)}</b><span>reachable through this edge · ${o.count} ${o.count===1?"file import":"file imports"}</span></div>`:null}<div class="flow-metrics"><b>${Nt(e.removable)}</b><span>unique size · removed if deleted · bar width</span><b>${Nt(e.size)}</b><span>reachable size</span><b>${Nt(e.own)}</b><span>own source size · ${e.files.length} ${e.files.length===1?"file":"files"}</span></div>${this.renderVersions(e)} ${Be(e,this.minSize)?I`<p>Kept by Large so retained dependencies remain connected to an entry point.</p>`:null} ${e.removableMissing?I`<p>${e.removableMissing} removed files have unknown sizes; removal totals include known bytes only.</p>`:null} ${e.missing?I`<p>${e.missing} reachable file sizes are unknown.</p>`:null} ${e.virtual?I`<p>Entry source is absent from this bundle; only its recorded imports are counted.</p>`:null}<div class="flow-actions"><button aria-pressed="${!!this.focus}" @click="${()=>this.follow(this.focus?null:e.id)}">Follow imports</button> ${!this.packages&&!e.virtual?I`<button data-bundle-view-source="${this.model.files.get(e.files[0]).origFile??e.files[0]}">View source</button>`:null}</div><h4>Imports · ${e.outgoing.length}</h4>${this.renderLinks(e.outgoing)}<h4>Imported by · ${e.incoming.length}</h4>${this.renderLinks(e.incoming,!0)} ${Math.max(e.incoming.length,e.outgoing.length)>100?I`<p>Showing the 100 largest flows in each direction.</p>`:null}`:I`<h3>Size flow</h3><div class="flow-metrics"><b>${Nt(this.model.total.size)}</b><span>unique reachable source</span></div><p>Bar width shows how much source leaves the bundle when a file or package is removed.</p><p>Select a bar or ribbon for details.<br>Double-click a bar to follow its imports.</p>${this.model.total.missing?I`<p>${this.model.total.missing} files have unknown sizes; totals include known bytes only.</p>`:null} ${this.model.weakEdges?I`<p>${this.model.weakEdges} weak config/metadata loads excluded.</p>`:null} ${this.model.omittedFiles?I`<p>${this.model.omittedFiles} files are not reachable from these entry points.</p>`:null}<h4>${this.model.inferred?"Inferred roots (no entry points in this view)":"Entry points"}</h4>${this.model.roots.slice(0,100).map(i=>{let s=this.model.byId.get(i);return ho(s,s.removable,()=>this.select(i))})} ${this.model.roots.length>100?I`<p>Showing the first 100 entry points. Search to find another.</p>`:null}`}renderVersions(e){if(!e.instances?.length)return null;if(e.instances.length===1){let i=e.instances[0];return I`<div class="flow-versions"><div>${i.version||"Unknown version"}</div><small>${i.directory}</small></div>`}let o=I`<ul class="flow-versions">${e.instances.map(i=>I`<li><div><span>${i.version||"Unknown version"}</span><span>${Nt(i.size)}${i.missing?"+":""}</span></div><small>${i.directory}</small> ${i.missing?I`<small>${i.missing} files have unknown sizes</small>`:null}</li>`)}</ul>`;return Lo(e.id,I`<details class="flow-versions-details"><summary>Versions: ${e.instances.length}</summary><h4>Own source size</h4>${o}</details>`)}render(){if(!this.layout)return null;let{nodes:e}=this.layout;return I`<section class="flow-stage" aria-label="Dependency size flow" style="${`--flow-background:${Oe()}`}"><div class="flow-viewport">${this.chart.render()}${e.length>0?null:I`<p>${this.minSize?`No nodes reach ${Nt(this.minSize)}. Turn off Large to show all nodes.`:"No recorded dependency paths in this view."}</p>`}</div><div class="flow-count">${e.length} ${this.packages?e.length===1?"package":"packages":e.length===1?"file":"files"}</div><div class="g2-zoom-ctrl" role="group" aria-label="Flow zoom"><button aria-label="Zoom in" ?disabled="${this.zoom>=this.zoomMetrics().max*.9999}" @click="${()=>this.zoomBy(1.4)}">+</button><div class="g2-zoom-pct"></div><button aria-label="Zoom out" ?disabled="${this.zoom<=this.zoomMetrics().min*1.0001}" @click="${()=>this.zoomBy(1/1.4)}">−</button> <button class="g2-zoom-fit-btn" aria-label="Fit to view" @click="${()=>this.fit()}">fit</button></div></section><aside class="flow-panel" aria-label="Size flow details" aria-live="polite">${this.renderSearch()}${this.renderPanel()}</aside>`}};customElements.define("size-flow",po);var uo=class extends ce{static properties={graph:{attribute:!1},options:{attribute:!1},matrixControls:{state:!0},flowControls:{state:!0},issuesWrapped:{state:!0}};static styles=[Pt(Do),Pt(Ho),Pt(qo),Pt(he),Pt(fe)];constructor(){super(),this.graph=null,this.options={},this.matrixControls=null,this.flowControls=null,this.issuesWrapped=!1,this._topbarObserver=null,this._observedControls=null,this._issuesWrapWidth=0}disconnectedCallback(){super.disconnectedCallback(),this._topbarObserver?.disconnect(),this._observedControls=null}connectedCallback(){super.connectedCallback(),ze(this.renderRoot)}willUpdate(e){(!this.options.showBundleLayouts||z.bundleLayout!=="matrix")&&(this.matrixControls=null),(!this.options.showBundleLayouts||z.bundleLayout!=="flow")&&(this.flowControls=null),(e.has("graph")||e.has("options")||e.has("matrixControls")||e.has("flowControls"))&&(this._issuesWrapWidth=0)}updated(){this.toggleAttribute("matrix",!!this.options.showBundleLayouts&&z.bundleLayout==="matrix");let e=this.renderRoot.querySelector(".g2-topbar-controls");e!==this._observedControls&&typeof ResizeObserver=="function"&&(this._topbarObserver??=new ResizeObserver(()=>this._placeIssues()),this._topbarObserver.disconnect(),e&&this._topbarObserver.observe(e),this._observedControls=e),this._placeIssues()}_placeIssues(){let e=this.renderRoot.querySelector(".g2-topbar-controls"),o=this.renderRoot.querySelector(".g2-issues-switch");if(!e||!o)return;let i=e.clientWidth;this.issuesWrapped?i>this._issuesWrapWidth&&vs(e,o)&&(this.issuesWrapped=!1):ys(e,o)&&(this._issuesWrapWidth=i,this.issuesWrapped=!0)}render(){return this.graph?this.options.showBundleLayouts&&z.bundleLayout==="flow"?I`<div class="graph2-layout">${Le(this.graph,this.options,this.flowControls,{issuesWrapped:this.issuesWrapped})}<size-flow .graph="${this.graph}" .packages="${z.flowPackagesView}" @flow-controls-change="${e=>{this.flowControls=e.detail}}"></size-flow></div>`:this.options.showBundleLayouts&&z.bundleLayout==="matrix"?I`<div class="graph2-layout g2-matrix-layout">${Le(this.graph,this.options,this.matrixControls,{issuesWrapped:this.issuesWrapped})}<dependency-matrix .graph="${this.graph}" @matrix-controls-change="${e=>{this.matrixControls=e.detail}}"></dependency-matrix></div>`:I`<div class="graph2-layout">${Le(this.graph,this.options,null,{issuesWrapped:this.issuesWrapped})} ${jo(this.graph)} ${Yo()}</div>`:I``}};function ys(t,e){let o=t.firstElementChild;if(!o||o===e)return!1;let i=e.getBoundingClientRect(),s=o.getBoundingClientRect();return i.height>0&&s.height>0&&i.top>=s.bottom-1}function vs(t,e){let o=[...t.children];if(o.length===0)return!0;let i=o[0].getBoundingClientRect().bottom,s=parseFloat(getComputedStyle(t).columnGap)||0,n=0;for(let a of o){let h=a.getBoundingClientRect();if(h.top>=i-1)return!1;let f=getComputedStyle(a),u=parseFloat(f.flexBasis),c=parseFloat(f.flexGrow)>0&&Number.isFinite(u)?Math.max(parseFloat(f.minWidth)||0,Math.min(h.width,u)):h.width;n+=c+s}return n+e.getBoundingClientRect().width<=t.clientWidth}customElements.define("graph-layout",uo);function bi(t,e,o,i){let s=0;for(let c of o)s=Math.max(s,c);if(s===0)return()=>!0;let n=2*s,a=new Map,h=Int32Array.from(t,c=>Math.floor(c/n)),f=Int32Array.from(e,c=>Math.floor(c/n));for(let c=0;c<t.length;c++){let b=`${h[c]}:${f[c]}`;a.has(b)||a.set(b,[]),a.get(b).push(c)}let u=0;return(c,b,w,r)=>{if(o[c]===o[b])return!0;let y=o[c]>o[b]?c:b,M=y===c?r:w;for(let p=h[M]-1;p<=h[M]+1;p++)for(let g=f[M]-1;g<=f[M]+1;g++)for(let l of a.get(`${p}:${g}`)??[]){if(++u>8e6)return!1;let d=i[l];if(d===c||d===b)continue;let v=o[y]+o[d],x=t[M]-t[l],k=e[M]-e[l];if(x*x+k*k<v*v-1e-7)return!1}return!0}}var ke=12,xs=8,yi=12,ws=8e6,ks=8e6;function Me(t,e,{radiusOf:o}={}){let i=t.nodes;if(i.length<2||t.edges.length===0)return;let s=new Map(i.map((d,v)=>[d.file,v])),n=Float64Array.from(i,d=>d.x),a=Float64Array.from(i,d=>d.y),h=Int32Array.from(i,(d,v)=>v),f=h.slice(),u=o?bi(n,a,Float64Array.from(i,o),h):null,c=Array.from(i,()=>[]);for(let d of t.edges){let v=s.get(d.a),x=s.get(d.b);v===void 0||x===void 0||v===x||(c[v].push(x),c[x].push(v))}let b=e.map(d=>d.map(v=>s.get(v.file))).filter(d=>d.length>1),w=new Int32Array(ke+yi),r=new Float64Array(ke),y=0,M=1831565813,p=0,g=()=>(M^=M<<13,M^=M>>>17,M^=M<<5,M>>>0),l=(d,v)=>{let x=n[d]-n[v],k=a[d]-a[v];return Math.sqrt(x*x+k*k)};t:for(let d=0;d<xs;d++){let v=!1;for(let x of b)for(let k=0;k<x.length;k++){let _=x[d%2?x.length-k-1:k];if(c[_].length===0)continue;if(p+x.length>ks)break t;p+=x.length;let O=f[_],C=0,m=0;for(let N of c[_])C+=n[f[N]],m+=a[f[N]];C/=c[_].length,m/=c[_].length;let $=0;if(x.length<=w.length)for(let N of x)w[$++]=N;else{for(let N of x){let T=n[N]-C,D=a[N]-m,j=T*T+D*D;if($===ke&&j>=r[$-1])continue;let J=Math.min($,ke-1);for(;J>0&&j<r[J-1];)w[J]=w[J-1],r[J]=r[J-1],J--;w[J]=N,r[J]=j,$<ke&&$++}for(let N=0;N<yi;N++)w[$++]=x[g()%x.length]}let P=-1,A=-1e-7,K=!1;for(let N=0;N<$;N++){let T=w[N],D=h[T];if(_===D)continue;let j=c[_].length+c[D].length;if(y+j>ws){K=!0;break}y+=j;let J=0;for(let it of c[_])it!==D&&(J+=l(T,f[it])-l(O,f[it]));for(let it of c[D])it!==_&&(J+=l(O,f[it])-l(T,f[it]));J<A&&(!u||u(_,D,O,T))&&(P=D,A=J)}if(P!==-1){let N=f[P];f[_]=N,f[P]=O,h[O]=P,h[N]=_,v=!0}if(K)break t}if(!v)break}for(let d=0;d<i.length;d++)i[d].x=n[f[d]],i[d].y=a[f[d]]}function vi(t,e,o){let i=[...t].map(([h,f])=>({file:h,...f})),s=new Map(i.map(h=>[h.file,h])),n=[];for(let[h,f]of e)for(let u of f.keys())h<u&&n.push({a:h,b:u});let a=o.map(h=>h.map(f=>s.get(f)));Me({nodes:i,edges:n},a,{radiusOf:h=>h.groupR});for(let h of i){let f=t.get(h.file);f.x=h.x,f.y=h.y}}function Ms(t){let e=new Map;for(let[o,i]of t.importsOf){let s=t.nodeByFile.get(o);if(s)for(let n of i){let a=t.nodeByFile.get(n);a&&s.pkg!==a.pkg&&(e.set(s.pkg,(e.get(s.pkg)??0)+1),e.set(a.pkg,(e.get(a.pkg)??0)+1))}}return e}function Ss(t){if(t.packages.length===0)return null;let e=s=>s==="__own__"||t.ownSourcePackages?.has(s),o=t.packages.find(s=>e(s)&&t.entryPackages?.has(s))??t.packages.find(e);if(o)return o;let i=new Set;for(let[s,n]of t.importedBy){let a=t.nodeByFile.get(s);if(a)for(let h of n){let f=t.nodeByFile.get(h);if(f&&f.pkg!==a.pkg){i.add(a.pkg);break}}}for(let s of t.packages)if(!i.has(s))return s;return null}var $s=5;function zs(t){let e=new Map,o=(i,s)=>[Math.floor(i/t),Math.floor(s/t)];return{add(i,s,n){let a=o(i,s).join(":");e.has(a)||e.set(a,[]),e.get(a).push({x:i,y:s,r:n})},fits(i,s,n){let[a,h]=o(i,s);for(let f=a-1;f<=a+1;f++)for(let u=h-1;u<=h+1;u++)for(let c of e.get(`${f}:${u}`)??[])if((c.x-i)**2+(c.y-s)**2<(c.r+n)**2-1e-7)return!1;return!0}}}function wi(t){return[t.filter(e=>e.isHub),t.filter(e=>!e.isHub)]}function xi(t,e){let o=new Map;for(let n of t.nodes)e.has(n.pkg)&&(o.has(n.pkg)||o.set(n.pkg,[]),o.get(n.pkg).push(n));for(let n of o.values())n.sort((a,h)=>a.isHub!==h.isHub?a.isHub?-1:1:h.deg-a.deg);let i=new Map,s=new Map;for(let[n,a]of e){let h=o.get(n);if(!h||h.length===0)continue;let f=h.length,u=0;for(let g of h)if(g.isHub)u++;else break;let b=u>0&&u<=$s?u:0,w=f-b,r=a.groupR,y=Array.from({length:f}),M=Array.from({length:f});for(let g=0;g<f;g++){let l=g*137.508*Math.PI/180,d;if(g<b)d=b<=1?0:Math.sqrt(g/(b-1))*.3*r;else{let v=g-b;d=w<=1?.4*r:(.4+Math.sqrt(v/(w-1))*.6)*r}y[g]=a.x+Math.cos(l)*d,M[g]=a.y+Math.sin(l)*d}let p=Array.from({length:f},()=>!1);for(let g=0;g<f;g++){let l=h[g],d=l.isHub?0:u,v=l.isHub?u:f,x=0,k=0,_=0,O=t.importsOf.get(l.file);if(O)for(let P of O){let A=i.get(P);A!==void 0&&(x+=A,k+=s.get(P),_++)}let C=t.importedBy.get(l.file);if(C)for(let P of C){let A=i.get(P);A!==void 0&&(x+=A,k+=s.get(P),_++)}let m=!1;if(_>0){x/=_,k/=_;let P=x-a.x,A=k-a.y;P*P+A*A>1&&(m=!0)}let $=-1;if(m){let P=1/0;for(let A=d;A<v;A++){if(p[A])continue;let K=y[A]-x,N=M[A]-k,T=K*K+N*N;T<P&&(P=T,$=A)}}else for(let P=d;P<v;P++)if(!p[P]){$=P;break}p[$]=!0,l.x=y[$],l.y=M[$],i.set(l.file,l.x),s.set(l.file,l.y)}}Me(t,[...o.values()].flatMap(wi))}function ki(t,e,o){let i=e/2,s=o/2,n=Math.min(e,o)/2;if(t.packages.length===0)return;let h=Ss(t),f=Ms(t),u=(h?t.packages.filter(T=>T!==h):[...t.packages]).toSorted((T,D)=>{let j=(f.get(D)??0)-(f.get(T)??0);return j!==0?j:(t.pkgCount.get(D)??0)-(t.pkgCount.get(T)??0)}),c=u.length,b;c<=0?b=0:c<=6?b=.65:c<=20?b=.82:b=.95;let w=Math.max(1,Math.sqrt(50/Math.max(1,c))),r=.22,y=.12,M=.04,p=new Map,g;if(h){let T=t.pkgCount.get(h)??0,D=Math.min(r,(.012+Math.sqrt(T)*.004)*w);g=Math.max(c<=6?.4:c<=20?.36:.34,D+y+M),p.set(h,{x:i,y:s,size:T,groupR:D*n})}else c<=1?g=0:c<=6?g=.4:c<=20?g=.32:g=.3;if(c===0){xi(t,p);return}let l=new Map;for(let T of t.edges){if(!T.cross)continue;let D=t.nodeByFile.get(T.a)?.pkg,j=t.nodeByFile.get(T.b)?.pkg;if(!D||!j||D===j)continue;l.has(D)||l.set(D,new Map),l.has(j)||l.set(j,new Map);let J=l.get(D),it=l.get(j);J.set(j,(J.get(j)??0)+1),it.set(D,(it.get(D)??0)+1)}let d=Math.max(1,Math.min(10,Math.round(Math.sqrt(c)/1.2))),v=Array.from({length:d+1});for(let T=0;T<=d;T++)v[T]=Math.floor(T*T/(d*d)*c);v[d]=c;let x=.2,k=Array.from({length:d}),_=Array.from({length:d});for(let T=0;T<d;T++){let D=v[T],j=v[T+1];k[T]=j-D;let J=0;for(let it=D;it<j;it++)J+=t.pkgCount.get(u[it])??0;_[T]=J}let O=Array.from({length:d});for(let T=0;T<d;T++){let D=(v[T]+v[T+1]-1)/2/Math.max(1,c-1);O[T]=Math.sqrt(Math.max(0,D))}let C=Array.from({length:d});C[0]=O[0];for(let T=1;T<d;T++){let D=k[T-1],j=_[T-1],J=D>0?j/D:1,it=1+x*Math.sqrt(Math.max(0,J-1));C[T]=C[T-1]+(O[T]-O[T-1])*it}let m=Array.from({length:d});for(let T=0;T<d;T++)m[T]=C[T]-O[T];let $=Array.from({length:c}),P=Array.from({length:c}),A=0;for(let T=0;T<c;T++){for(;A<d-1&&T>=v[A+1];)A++;let D=T*137.508%360*Math.PI/180,J=(c<=1?0:Math.sqrt(T/(c-1)))+m[A],it=c===1?h?g:0:g+J*(b-g);$[T]=i+Math.cos(D)*it*n,P[T]=s+Math.sin(D)*it*n}let K=zs(2*y*n);for(let T=0;T<d;T++){let D=v[T],j=v[T+1],J=j-D;if(J===0)continue;let it=Array.from({length:J},()=>!1);for(let vt=D;vt<j;vt++){let It=u[vt],B=t.pkgCount.get(It)??0,tt=Math.min(y,(.012+Math.sqrt(B)*.004)*w)*n,ot=bt=>K.fits($[D+bt],P[D+bt],tt),Y=l.get(It),U=0,lt=0,ft=0;if(Y)for(let[bt,yt]of Y){let xt=p.get(bt);xt&&(U+=xt.x*yt,lt+=xt.y*yt,ft+=yt)}let Tt=!1;if(ft>0){U/=ft,lt/=ft;let bt=U-i,yt=lt-s;bt*bt+yt*yt>1&&(Tt=!0)}let gt=bt=>{let yt=-1;if(Tt){let xt=1/0;for(let Rt=0;Rt<J;Rt++){if(it[Rt]||!bt(Rt))continue;let jt=D+Rt,ae=$[jt]-U,le=P[jt]-lt,_t=ae*ae+le*le;_t<xt&&(xt=_t,yt=Rt)}}else for(let xt=0;xt<J;xt++)if(!it[xt]&&bt(xt)){yt=xt;break}return yt},$t=gt(()=>!0);if(!ot($t)){let bt=gt(ot);bt>=0&&($t=bt)}it[$t]=!0;let zt=D+$t;p.set(It,{x:$[zt],y:P[zt],size:B,groupR:tt}),K.add($[zt],P[zt],tt)}}let N=Array.from({length:d},(T,D)=>u.slice(v[D],v[D+1]));vi(p,l,N),Is(p,h),xi(t,p)}function Is(t,e){let o=[...t].map(([i,s])=>({info:s,pinned:i===e}));for(let i=0;i<100;i++){o.sort((n,a)=>n.info.x-n.info.groupR-(a.info.x-a.info.groupR));let s=!1;for(let n=0;n<o.length;n++){let a=o[n].info;for(let h=n+1;h<o.length;h++){let f=o[h].info;if(f.x-f.groupR>a.x+a.groupR)break;let u=f.x-a.x,c=f.y-a.y,b=Math.hypot(u,c),w=a.groupR+f.groupR;if(b>=w-.5)continue;let r=o[n].pinned?0:f.groupR**2,y=o[h].pinned?0:a.groupR**2;if(r+y===0)continue;let M=(w-b)/(r+y),p=b>1e-9?u/b:1,g=b>1e-9?c/b:0;a.x-=p*M*r,a.y-=g*M*r,f.x+=p*M*y,f.y+=g*M*y,s=!0}}if(!s)return}}function go(t,e,o){let i=e/2,s=o/2,n=Math.min(e,o)/2,a=t.nodes.length;if(a===0)return;let h=[],f=[],u=[];for(let r of t.nodes)r.pkg==="__own__"||t.ownSourcePackages?.has(r.pkg)?t.entryPackages?.has(r.pkg)?f.push(r):u.push(r):h.push(r);let c=(r,y)=>y.deg-r.deg,b=[f,u,h].flatMap(wi),w=b.flatMap(r=>r.toSorted(c));for(let r=0;r<a;r++){let y=w[r],M=r*137.508%360*Math.PI/180,p=a<=1?0:Math.sqrt(r/(a-1));y.x=i+Math.cos(M)*p*.85*n,y.y=s+Math.sin(M)*p*.85*n}Me(t,b)}function mo(t,e,o,i,{groupOf:s=Pe}={}){let n=t.length,a=i||760,h=o||1100,f=Math.sqrt(h*a/Math.max(n,1))*1.1,u=x=>{let k=0;for(let _ of x)k=k*31+_.codePointAt(0)|0;return k},c=Math.ceil(Math.sqrt(n*h/a)),b=Math.ceil(n/c),w=a/(b+1),r=h/(c+1),y=t.map((x,k)=>{let _=k%c,O=Math.floor(k/c),C=u(x);return{file:x,x:(_+1)*r+(C%100-50)*r*.4,y:(O+1)*w+((C>>7)%100-50)*w*.4,dx:0,dy:0}}),M=new Map(y.map((x,k)=>[x.file,k])),p=[];for(let x of t)for(let k of e.get(x)??[])M.has(k)&&p.push([M.get(x),M.get(k)]);let g=new Map;for(let x=0;x<n;x++){let k=s(y[x].file)??"__own__";g.has(k)||g.set(k,[]),g.get(k).push(x)}let l=Math.min(500,Math.max(180,100+n*3)),d=Math.min(h,a)/6,v=.3;for(let x=0;x<l;x++){let k=d*Math.pow(v/d,x/l);for(let C of y)C.dx=0,C.dy=0;for(let C=0;C<n;C++)for(let m=C+1;m<n;m++){let $=y[C],P=y[m],A=$.x-P.x,K=$.y-P.y,N=Math.sqrt(A*A+K*K);if(N<.01){let D=u($.file+P.file);A=(D%100-50)*.01||.5,K=((D>>7)%100-50)*.01||.5,N=Math.sqrt(A*A+K*K)}let T=f*f/N;$.dx+=A/N*T,$.dy+=K/N*T,P.dx-=A/N*T,P.dy-=K/N*T}for(let[C,m]of p){let $=y[C],P=y[m],A=$.x-P.x,K=$.y-P.y,N=Math.sqrt(A*A+K*K)||.01,T=N*N/f;$.dx-=A/N*T,$.dy-=K/N*T,P.dx+=A/N*T,P.dy+=K/N*T}let _=.055*Math.min(1,k/(d*.3));for(let[,C]of g){if(C.length<2)continue;let m=0,$=0;for(let P of C)m+=y[P].x,$+=y[P].y;m/=C.length,$/=C.length;for(let P of C)y[P].dx+=(m-y[P].x)*_,y[P].dy+=($-y[P].y)*_}let O=50;for(let C of y){let m=Math.sqrt(C.dx*C.dx+C.dy*C.dy)||.01;C.x+=C.dx/m*Math.min(m,k),C.y+=C.dy/m*Math.min(m,k),C.x=Math.max(O,Math.min(h-O,C.x)),C.y=Math.max(O,Math.min(a-O,C.y))}}return y}function bo(t,e,o,{statsHeight:i=0,left:s=0,right:n=s,top:a=0,bottom:h=a}={}){let f=Math.max(20,e*.04),u=Math.max(20,o*.04),c=Math.max(1,e-f*2-s-n),b=Math.max(1,o-u*2-i-a-h),w=-1/0,r=-1/0,y=1/0,M=1/0;for(let g of t)y=Math.min(y,g.x),w=Math.max(w,g.x),M=Math.min(M,g.y),r=Math.max(r,g.y);if(t.length===0)return{k:1,tx:e/2,ty:(o-i)/2};let p=Math.min(4,c/Math.max(20,w-y),b/Math.max(20,r-M));return{k:p,tx:f+s+c/2-(y+w)/2*p,ty:u+a+b/2-(M+r)/2*p}}function Mi(t,e,o,{width:i=900,rowHeight:s=52,gap:n=42}={}){let a=new Map(t.map(d=>[d.id,d])),h=new Map,f=[];for(let d of o)a.has(d)&&!h.has(d)&&(h.set(d,0),f.push(d));for(let d=0;d<f.length;d++){let v=f[d];for(let x of e.get(v)??[])!a.has(x)||h.has(x)||(h.set(x,h.get(v)+1),f.push(x))}let u=new Map;for(let d of t){let v=h.get(d.id)??null;u.has(v)||u.set(v,[]),u.get(v).push(d)}let c=new Map(t.map(d=>[d.id,[]]));for(let[d,v]of e)if(a.has(d))for(let x of new Set(v))c.get(x)?.push(d);let b=[],w=new Map,r=[...u.keys()].toSorted((d,v)=>(d??1/0)-(v??1/0)),y=d=>Number.isFinite(d.size)&&d.size>0?d.size:0;for(let d of r){let v=u.get(d).slice(),x=new Map(v.map(m=>{let $=c.get(m.id).map(P=>w.get(P)).filter(P=>P&&d!==null&&P.level===d-1);return[m.id,$.length>0?$.reduce((P,A)=>P+A.x+A.width/2,0)/$.length:i/2]}));v.sort((m,$)=>x.get(m.id)-x.get($.id)||String(m.id).localeCompare(String($.id)));let k=0;for(let m=1;m<v.length;m++)y(v[m])>y(v[k])&&(k=m);k>0&&v.unshift(v.splice(k,1)[0]);let _=v.reduce((m,$)=>m+y($),0),O=b.length*(s+n),C=0;for(let m of v){let $=i*(_>0?y(m)/_:1/v.length);w.set(m.id,{id:m.id,level:d,x:C,y:O,width:$,height:s}),C+=$}b.push({level:d,y:O,size:_,proportional:_>0,ids:v.map(m=>m.id)})}let M=[];for(let[d,v]of e)if(w.has(d))for(let x of new Set(v))d!==x&&w.has(x)&&M.push({from:d,to:x});M.sort((d,v)=>String(d.from).localeCompare(String(v.from))||String(d.to).localeCompare(String(v.to)));let p=new Map,g=new Map;for(let d of M)g.has(d.from)||g.set(d.from,[]),p.has(d.to)||p.set(d.to,[]),g.get(d.from).push(d),p.get(d.to).push(d);for(let d of g.values())d.sort((v,x)=>w.get(v.to).x-w.get(x.to).x);for(let d of p.values())d.sort((v,x)=>w.get(v.from).x-w.get(x.from).x);for(let d of g.values())d.forEach((v,x)=>{v.sourcePort=(x+1)/(d.length+1)});for(let d of p.values())d.forEach((v,x)=>{v.targetPort=(x+1)/(d.length+1)});let l=b.reduce((d,v)=>d+v.size,0);for(let d of b)d.share=l>0?d.size/l:null;return{levels:b,rects:w,edges:M,depth:h,totalSize:l,width:i,height:b.length>0?b.length*(s+n)-n:0,gap:n}}function Si(t,e,{theme:o,scale:i,colorOf:s,labelOf:n,sizeLabel:a,dimmed:h,selected:f,hovered:u}){let c=u??f,b=new Set([c]);for(let y of e.edges)y.from===c&&b.add(y.to),y.to===c&&b.add(y.from);let w=y=>y===c||y===f?1:h(y)?.13:c&&!b.has(y)?.22:1;t.save(),t.lineJoin="round";for(let y of e.edges){let M=e.rects.get(y.from),p=e.rects.get(y.to),g=y.from===c||y.to===c;t.globalAlpha=Math.min(w(y.from),w(y.to))*(g?.9:.5),t.strokeStyle=s(y.from),t.fillStyle=s(y.from),t.lineWidth=(g?1.6:1)/i;let l=M.x+M.width*y.sourcePort,d=M.y+M.height,v=p.x+p.width*y.targetPort,x=p.y,k=0,_=1;if(t.beginPath(),t.moveTo(l,d),p.y>M.y){let C=(d+x)/2;t.bezierCurveTo(l,C,v,C,v,x)}else if(p.y===M.y){x=p.y+p.height;let C=d+e.gap*.65;t.bezierCurveTo(l,C,v,C,v,x),_=-1}else{v=p.x+p.width,x=p.y+p.height*y.targetPort;let C=e.width+16+y.sourcePort*20;t.bezierCurveTo(l,d+e.gap/2,C,d+e.gap/2,C,d),t.lineTo(C,x+8),t.quadraticCurveTo(C,x,v,x),k=-1,_=0}t.stroke();let O=3/i;t.beginPath(),t.moveTo(v,x),t.lineTo(v-k*O-_*O,x-_*O+k*O),t.lineTo(v-k*O+_*O,x-_*O-k*O),t.closePath(),t.fill()}t.globalAlpha=1,t.textBaseline="middle",t.textAlign="right",t.fillStyle=o.labelDefault,t.font="11px system-ui, sans-serif";let r=o.edgeIntra(.16);for(let y of e.levels){let p=y.y+26,g=18;t.strokeStyle=r,t.lineWidth=3,t.beginPath(),t.arc(-112,p,g,0,Math.PI*2),t.stroke(),y.share!==null&&y.share>0&&(t.strokeStyle=o.labelDefault,t.beginPath(),t.arc(-112,p,g,-Math.PI/2,-Math.PI/2+y.share*Math.PI*2),t.stroke()),t.textAlign="center",t.font="9px system-ui, sans-serif";let l=y.share===null?"\u2014":y.share>0&&y.share<.001?"<0.1%":`${Number((y.share*100).toFixed(1))}%`;t.fillText(l,-112,p),t.textAlign="right",t.font="11px system-ui, sans-serif",t.fillText(y.level===null?"Unreached":y.level===0?"App":`Level ${y.level}`,-12,y.y+19),t.font="10px system-ui, sans-serif",t.fillText(y.proportional?a(y.size):"No size data",-12,y.y+35),t.font="11px system-ui, sans-serif"}t.textAlign="left";for(let y of e.rects.values()){let{id:M,x:p,y:g,width:l,height:d}=y;if(l<=0)continue;let v=s(M),x=Ee(v);if(t.globalAlpha=w(M),t.fillStyle=v,t.fillRect(p,g,l,d),t.save(),t.beginPath(),t.rect(p,g,l,d),t.clip(),t.strokeStyle=o.bg,t.lineWidth=1/i,l*i>=2?t.strokeRect(p,g,l,d):(t.beginPath(),t.moveTo(p,g),t.lineTo(p+l,g),t.moveTo(p,g+d),t.lineTo(p+l,g+d),t.stroke()),M===f||M===u){t.strokeStyle=o.selectRing,t.lineWidth=Math.min(1.5/i,l/4);let k=t.lineWidth/2;t.strokeRect(p+k,g+k,Math.max(0,l-k*2),d-k*2)}if(l*i<28){t.restore();continue}t.beginPath(),t.rect(p+7,g+4,Math.max(0,l-14),d-8),t.clip(),t.fillStyle=x,t.font="500 12px system-ui, sans-serif",t.fillText(n(M),p+9,g+21),t.fillStyle=x,t.font="10px system-ui, sans-serif",t.fillText(a(M),p+9,g+38),t.restore()}t.restore()}function $i(t,e,o=[],{width:i=1200,height:s=800,cycleImportsOf:n=e}={}){t=[...new Set(t)].toSorted();let a=new Set(t),h=new Map(t.map(B=>[B,[...new Set(e.get(B)??[])].filter(tt=>tt!==B&&a.has(tt)).toSorted()])),f=new Map(t.map(B=>[B,new Set(n.get(B)??[])])),u=new Map(t.map(B=>[B,[]]));for(let[B,tt]of h)for(let ot of tt)u.get(ot).push(B);let{groups:c,componentOf:b}=se(t,f),w=c.filter(B=>B.length>1),r=new Set(w.flat()),y=c.map(()=>new Set),M=c.map(()=>0);for(let[B,tt]of h)for(let ot of tt){if(!f.get(B).has(ot))continue;let Y=b.get(B),U=b.get(ot);Y!==U&&!y[Y].has(U)&&(y[Y].add(U),M[U]++)}let p=new Set(o.map(B=>b.get(B)).filter(B=>B!==void 0)),g=c.map(()=>0),l=[],d=new Set,v=B=>{d.has(B)||(d.add(B),l.push(B))};p.forEach(v),M.forEach((B,tt)=>{B||v(tt)});for(let B=0;B<l.length;B++){let tt=l[B];for(let ot of y[tt])p.has(ot)||(g[ot]=Math.max(g[ot],g[tt]+1)),--M[ot]===0&&v(ot)}let x=new Map(t.map(B=>[B,g[b.get(B)]])),k=new Map;for(let B of t){let tt=x.get(B);k.has(tt)||k.set(tt,[]),k.get(tt).push(B)}let _=[...k.keys()].toSorted((B,tt)=>B-tt),O=new Map,C=B=>B.forEach((tt,ot)=>O.set(tt,(ot+.5)/B.length));for(let B of k.values())C(B);for(let B=0;B<12;B++)for(let tt of B%2?_.toReversed():_){let ot=k.get(tt),Y=new Map(ot.map(U=>{let lt=(B%2?h:u).get(U);return[U,lt.length>0?lt.reduce((ft,Tt)=>ft+O.get(Tt),0)/lt.length:O.get(U)]}));ot.sort((U,lt)=>Y.get(U)-Y.get(lt)||O.get(U)-O.get(lt)||U.localeCompare(lt)),C(ot)}let m=Math.max(.6,Math.min(2.4,i/Math.max(1,s))),$=Math.max(160,Math.sqrt(t.length*1100*m)),P=Math.max(120,$/m),A=_.at(-1)??0,K=new Map;for(let[B,tt]of k)tt.forEach((ot,Y)=>{let U=O.get(ot)*$,lt=(B+.5)/(A+1)*P;K.set(ot,{id:ot,x:U,y:lt+(Y%5-2)*9,anchorY:lt,vx:0,vy:0,level:B,cycle:r.has(ot),degree:h.get(ot).length+u.get(ot).length})});let N=[];for(let[B,tt]of h)for(let ot of tt)N.push({from:B,to:ot,cycle:f.get(B).has(ot)&&r.has(B)&&b.get(B)===b.get(ot)});let T=N.map(B=>{let tt=K.get(B.from),ot=K.get(B.to),Y=26+Math.sqrt(Math.max(tt.degree,ot.degree))*5;return{a:tt,b:ot,length:Y,strength:.065/Math.sqrt(Math.min(tt.degree,ot.degree)||1),cycle:B.cycle}}),D=[...K.values()],j=80;for(let B=0;B<240;B++){let tt=new Map,ot=7*(1-B/240)+.15;for(let Y=0;Y<D.length;Y++){let U=D[Y];U.fx=($/2-U.x)*.002,U.fy=(U.anchorY-U.y)*.018,U.gx=Math.floor(U.x/j),U.gy=Math.floor(U.y/j);let lt=`${U.gx},${U.gy}`;tt.has(lt)||tt.set(lt,[]),tt.get(lt).push(Y)}for(let Y=0;Y<D.length;Y++){let U=D[Y];for(let lt=U.gx-1;lt<=U.gx+1;lt++)for(let ft=U.gy-1;ft<=U.gy+1;ft++)for(let Tt of tt.get(`${lt},${ft}`)??[]){if(Tt<=Y)continue;let gt=D[Tt],$t=U.x-gt.x,zt=U.y-gt.y,bt=$t*$t+zt*zt;if(bt>j*j)continue;bt<.01&&($t=Y%2?.1:-.1,zt=.1);let yt=Math.hypot($t,zt),xt=Math.min(18,100/yt-100/j+Math.max(0,22-yt)*.6),Rt=$t/yt*xt,jt=zt/yt*xt;U.fx+=Rt,U.fy+=jt,gt.fx-=Rt,gt.fy-=jt}}for(let{a:Y,b:U,length:lt,strength:ft,cycle:Tt}of T){let gt=U.x-Y.x,$t=U.y-Y.y,zt=Math.hypot(gt,$t)||1,bt=(zt-lt)*ft,yt=gt/zt*bt,xt=$t/zt*bt;if(Y.fx+=yt,Y.fy+=xt,U.fx-=yt,U.fy-=xt,!Tt&&$t<22){let Rt=(22-$t)*.018;Y.fy-=Rt,U.fy+=Rt}}for(let Y of D){Y.vx=(Y.vx+Y.fx)*.55,Y.vy=(Y.vy+Y.fy)*.55;let U=Math.hypot(Y.vx,Y.vy)||1,lt=Math.min(1,ot/U);Y.x+=Y.vx*lt,Y.y+=Y.vy*lt}}let J=-1/0,it=-1/0,vt=1/0,It=1/0;for(let B of D)vt=Math.min(vt,B.x),It=Math.min(It,B.y),J=Math.max(J,B.x),it=Math.max(it,B.y);for(let B of D)B.x+=16-vt,B.y+=16-It;return{nodes:K,edges:N,depth:x,incoming:u,links:h,cycles:w,roots:new Set(o.filter(B=>a.has(B))),width:D.length>0?J-vt+32:32,height:D.length>0?it-It+32:32}}function Ps(t){return Math.max(2.5,Math.min(6,4.5*Math.sqrt(t)))}function zi(t,e,o,{theme:i,viewport:s,width:n,height:a,colorOf:h,dimmed:f,selected:u,hovered:c,query:b}){let{k:w,tx:r,ty:y}=s,M=Ps(w),p=c??u,g=new Set([p,...e.links.get(p)??[],...e.incoming.get(p)??[]]),l=new Map;for(let[m,$]of e.nodes){let P=o.nodeByFile.get(m);l.set(m,{x:$.x*w+r,y:$.y*w+y,color:h(P.pkg),n:P,p:$,dim:m===p||m===u?1:f(P)?.12:p&&!g.has(m)?.16:1})}t.save();let d=(m,$)=>{let P=l.get(m.from),A=l.get(m.to);if(Math.max(P.x,A.x)<-40||Math.min(P.x,A.x)>n+40||Math.max(P.y,A.y)<-80||Math.min(P.y,A.y)>a+80)return;t.globalAlpha=$?.85:Math.min(P.dim,A.dim)*(p?.12:.22),t.strokeStyle=$?P.color:i.labelDefault,t.lineWidth=$?1.4:.7,t.setLineDash(m.cycle?[3,3]:[]);let K=A.x-P.x,N=A.y-P.y,T=Math.hypot(K,N)||1,D=K/T,j=N/T,J=P.x+D*(M+1),it=P.y+j*(M+1),vt=A.x-D*(M+3),It=A.y-j*(M+3),B=m.cycle?Math.min(18,T*.15):0,tt=(J+vt)/2-j*B,ot=(it+It)/2+D*B;if(t.beginPath(),t.moveTo(J,it),t.quadraticCurveTo(tt,ot,vt,It),t.stroke(),$||w>=.85||o.nodes.length<=50){let Y=Math.atan2(It-ot,vt-tt),U=$?5:3.5;t.setLineDash([]),t.fillStyle=t.strokeStyle,t.beginPath(),t.moveTo(vt,It),t.lineTo(vt-Math.cos(Y-.5)*U,It-Math.sin(Y-.5)*U),t.lineTo(vt-Math.cos(Y+.5)*U,It-Math.sin(Y+.5)*U),t.closePath(),t.fill()}};for(let m of e.edges)m.from!==p&&m.to!==p&&d(m,!1);for(let m of e.edges)(m.from===p||m.to===p)&&d(m,!0);t.setLineDash([]);let v=new Map,x=m=>{let $=[];for(let P=Math.floor(m.x/64);P<=Math.floor((m.x+m.w)/64);P++)for(let A=Math.floor(m.y/24);A<=Math.floor((m.y+m.h)/24);A++)$.push(`${P},${A}`);return $},k=m=>{for(let $ of x(m))v.has($)||v.set($,[]),v.get($).push(m)},_=(m,$)=>m.x<$.x+$.w&&$.x<m.x+m.w&&m.y<$.y+$.h&&$.y<m.y+m.h,O=[...l.values()].filter(m=>m.x>=-10&&m.x<=n+10&&m.y>=-10&&m.y<=a+10);for(let m of O)t.globalAlpha=m.dim,t.fillStyle=m.color,t.beginPath(),t.arc(m.x,m.y,M,0,Math.PI*2),t.fill(),(m.p.cycle||m.n.totalIssues>0)&&(t.strokeStyle=m.p.cycle?"#c47ad7":m.color,t.lineWidth=1,t.beginPath(),t.arc(m.x,m.y,M+2.5,0,Math.PI*2),t.stroke()),(m.n.file===u||m.n.file===c)&&(t.strokeStyle=i.selectRing,t.lineWidth=1.5,t.beginPath(),t.arc(m.x,m.y,M+4,0,Math.PI*2),t.stroke()),k({x:m.x-M-2,y:m.y-M-2,w:M*2+4,h:M*2+4});t.font='11px SFMono-Regular, Consolas, "Liberation Mono", monospace',t.textBaseline="top",t.textAlign="center",O.sort((m,$)=>{let P=A=>A.n.file===p?1e9:A.n.file===u?1e8:b&&A.dim===1?1e7:p&&g.has(A.n.file)?1e6:e.roots.has(A.n.file)?1e5:A.n.deg;return P($)-P(m)});let C=0;for(let m of O){let $=m.n.file===p||m.n.file===u;if(!$&&m.dim<.5||!$&&!b&&!p&&w<1&&C>=24)continue;let P=m.n.label.length>38?`${m.n.label.slice(0,36)}\u2026`:m.n.label,A=t.measureText(P).width+8,K={x:m.x-A/2,y:m.y+M+5,w:A,h:16};K.x<4||K.x+K.w>n-4||K.y+K.h>a-24||!$&&x(K).some(N=>v.get(N)?.some(T=>_(K,T)))||(k(K),C++,t.globalAlpha=.94,t.fillStyle=i.bg,t.fillRect(K.x,K.y-1,K.w,K.h),t.globalAlpha=1,t.fillStyle=$?i.labelSelected:i.labelDefault,t.fillText(P,m.x,K.y))}t.restore()}function Ii(t){let e=t.nodes.map(s=>({node:s})),o=new Map(e.map(s=>[s.node.file,s])),i=t.edges.flatMap(s=>{let n=o.get(s.a),a=o.get(s.b);return n&&a?[{edge:s,a:n,b:a}]:[]});return{nodes:e,edges:i,graph:t,selected:void 0,neighbors:new Set}}function Pi(t,{viewport:e,selected:o,visible:i,dimmed:s,radius:n,color:a,paintKey:h}){if(h===void 0||t.paintKey!==h){let f=new Map;for(let u of t.nodes){let c=u.node;u.visible=i(c),u.visible&&(u.x=c.x*e.k+e.tx,u.y=c.y*e.k+e.ty,u.radius=n(c),u.dimmed=s(c),f.has(c.pkg)||f.set(c.pkg,a(c.pkg)),u.color=f.get(c.pkg))}t.paintKey=h}if(t.selected!==o){t.selected=o,t.neighbors.clear();for(let f of t.graph.adj.get(o)??[]){let u=t.graph.edges[f];t.neighbors.add(u.a),t.neighbors.add(u.b)}}}function Ci(t,e,o,i){if(t.paints&&t.edgeOpacity===e&&t.neutral===o&&t.edgeSelected===i)return t.paints;let s=h=>({opacity:Math.max(0,Math.min(255,Math.round(h*255)))/255,neutral:o(h*.7)}),n=i?e*.25:e,a=i?.85:Math.min(.9,e+.5);return t.paints={base:s(n),emphasis:s(a),baseDim:s(Math.min(n,.04)),emphasisDim:s(Math.min(a,.04))},t.edgeOpacity=e,t.neutral=o,t.edgeSelected=i,t.paints}function Ri(t,e){let{a:o,b:i}=t;return(!t.gradient||t.ax!==o.node.x||t.ay!==o.node.y||t.bx!==i.node.x||t.by!==i.node.y||t.colorA!==o.color||t.colorB!==i.color)&&(t.gradient=e.createLinearGradient(o.node.x,o.node.y,i.node.x,i.node.y),t.gradient.addColorStop(0,o.color),t.gradient.addColorStop(1,i.color),t.ax=o.node.x,t.ay=o.node.y,t.bx=i.node.x,t.by=i.node.y,t.colorA=o.color,t.colorB=i.color),t.gradient}function _i(t,e,o){return(!t.halo||t.haloX!==t.x||t.haloY!==t.y||t.haloRadius!==e||t.haloColor!==t.color)&&(t.halo=o.createRadialGradient(t.x,t.y,0,t.x,t.y,e),t.halo.addColorStop(0,t.color+"55"),t.halo.addColorStop(1,t.color+"00"),t.haloX=t.x,t.haloY=t.y,t.haloRadius=e,t.haloColor=t.color),t.halo}function Ti(t,e,o,i){return t.x<-2&&e.x<-2||t.x>o+2&&e.x>o+2||t.y<-2&&e.y<-2||t.y>i+2&&e.y>i+2}function yo(t,e,o,i,s){return t+o<-2||t-o>i+2||e+o<-2||e-o>s+2}function Fi(t){let e=2166136261;for(let o of t.files){for(let i=0;i<o.length;i++)e=Math.imul(e^o.codePointAt(i),16777619);e=Math.imul(e^10,16777619)}return[t.viewId??"",e>>>0,t.files.length,t.edges.length,z.bundleLayout,z.packagesView,z.dependencyPackagesView,z.focusedPkg,z.showAll].join("|")}function Li(t){let o=new Map;for(let[i,s]of t.entries()){let n=Math.floor(s.x/32),a=Math.floor(s.y/32);o.has(n)||o.set(n,new Map);let h=o.get(n);h.has(a)||h.set(a,[]),h.get(a).push({node:s,index:i})}return(i,s,n,a,h,f)=>{let{k:u,tx:c,ty:b}=n,w=(a+6)/u+1e-7,r=(i-c)/u,y=(s-b)/u,M=Math.floor((r-w)/32),p=Math.floor((r+w)/32),g=Math.floor((y-w)/32),l=Math.floor((y+w)/32),d=null,v=1/0,x=1/0;for(let k=M;k<=p;k++){let _=o.get(k);if(_)for(let O=g;O<=l;O++)for(let{node:C,index:m}of _.get(O)??[]){if(!f(C))continue;let $=C.x*u+c-i,P=C.y*u+b-s,A=$*$+P*P,K=h(C)+6;A<K*K&&(A<v||A===v&&m<x)&&(d=C,v=A,x=m)}}return d}}function Ai(t,e,o,i,s){if(!t||t.key!==e.key)return null;let n=(e.tx-t.tx)*s,a=(e.ty-t.ty)*s;if(!Number.isInteger(n)||!Number.isInteger(a)||!Number.isInteger(n/s)||!Number.isInteger(a/s)||!n&&!a||Math.abs(n)>=o*s||Math.abs(a)>=i*s)return null;let h=n/s,f=a/s,u=[],c=2;return h>0&&u.push({x:0,y:0,w:Math.min(o,h+c),h:i}),h<0&&u.push({x:Math.max(0,o+h-c),y:0,w:Math.min(o,-h+c),h:i}),f>0&&u.push({x:0,y:0,w:o,h:Math.min(i,f+c)}),f<0&&u.push({x:0,y:Math.max(0,i+f-c),w:o,h:Math.min(i,-f+c)}),{dx:n,dy:a,rects:u}}function Ve(t,e,o,i,s){return t&&t.rects.every(n=>i<n.x||e>n.x+n.w||s<n.y||o>n.y+n.h)}var Cs={critical:"#ff5470",high:"#ff9d4a",medium:"#f4d35e",low:"#67c2ff",high_bug:"#a06c3f",bug:"#7a6d62",informational:"#218bff"},We={dark:{bg:Kt.dark,grid:"rgba(255, 255, 255, 0.022)",selectRing:"#ffffff",edgeIntra:t=>`rgba(180, 195, 215, ${t})`,hubRing:t=>`rgba(255, 255, 255, ${t})`,labelFill:"rgba(230, 233, 238, 0.78)",labelShadow:"rgba(12, 12, 12, 0.98)",labelOutline:"rgba(12, 12, 12, 0.9)",labelDefault:"rgba(200, 210, 225, 0.78)",labelHover:"rgba(230, 237, 243, 0.95)",labelSelected:"#fff"},light:{bg:Kt.light,grid:"rgba(0, 0, 0, 0.04)",selectRing:"#0969da",edgeIntra:t=>`rgba(50, 70, 100, ${t})`,hubRing:t=>`rgba(0, 0, 0, ${t})`,labelFill:"rgba(40, 50, 70, 0.85)",labelShadow:"rgba(255, 255, 255, 0.95)",labelOutline:"rgba(255, 255, 255, 0.9)",labelDefault:"rgba(50, 60, 80, 0.85)",labelHover:"rgba(20, 25, 35, 0.95)",labelSelected:"#000"},pink:{bg:Kt.pink,grid:"rgba(0, 0, 0, 0.04)",selectRing:"#0969da",edgeIntra:t=>`rgba(50, 70, 100, ${t})`,hubRing:t=>`rgba(0, 0, 0, ${t})`,labelFill:"rgba(40, 50, 70, 0.85)",labelShadow:"rgba(255, 255, 255, 0.95)",labelOutline:"rgba(255, 255, 255, 0.9)",labelDefault:"rgba(50, 60, 80, 0.85)",labelHover:"rgba(20, 25, 35, 0.95)",labelSelected:"#000"}},Rs={...We.light,bg:Kt.paper,selectRing:"#000",edgeIntra:t=>`rgba(0, 0, 0, ${t})`,labelFill:"#000",labelShadow:"#fff",labelOutline:"#fff",labelDefault:"#000",labelHover:"#000"};function Oi(){let t=document.body.classList;return t.contains("theme-paper")?Rs:t.contains("theme-pink")?We.pink:t.contains("theme-light")?We.light:We.dark}var Ei=(t,e)=>t.x0<e.x1&&e.x0<t.x1&&t.y0<e.y1&&e.y0<t.y1;function vo(t){t.sort((o,i)=>i.prio-o.prio);let e=[];for(let o of t){let i=!1;for(let s of e)if(Ei(o,s)){i=!0;break}i||e.push(o)}return e}var _s=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Gt(t){let e=Math.max(0,Math.min(255,Math.round(t*255)));return _s[e]}function Ts(t,e,o,i){let n=t.querySelector("graph-layout")?.shadowRoot;if(!n)return;let a=n.querySelector("#g2-canvas"),h=n.querySelector("#g2-tooltip"),f=n.querySelector(".graph2-stage"),u=n.querySelector(".g2-stage-stats"),c=n.querySelector("#g2-zoom-pct");if(!a)return;Eo({keepViewport:!0});let b=Fi(e),w=z.keptViewport?.key===b?z.keptViewport:null;z.keptViewport=null;let r=a.getContext("2d"),y=window.devicePixelRatio||1,M=0,p=0,g=0,l={tx:0,ty:0,k:1},d=null,v=w?.layoutH??0,x=w?.layoutW??0,k=!0,_=!w,O=new WeakMap,C=null,m=null,$=null,P=()=>e.supportsLayers&&z.bundleLayout==="layers"&&!z.focusedPkg,A=()=>e.supportsLayers&&z.bundleLayout==="dependencies"&&!z.focusedPkg,K=()=>A()&&!ge(e,z.dependencyPackagesView),N=()=>P()||z.bundleLayout==="graph"&&z.packagesView&&(e.canPackagesView??!1)&&!z.focusedPkg,T=null,D=null,j=Qe(e,to(e,pe)),J=null;function it(){if(!J){let S=to(xe(e),ue);if(J=xe(Qe(e,S)),P()&&e.layerRoots?.appImports.length>0){if(!J.byPkg.has("__own__")){let R={file:"__own__",pkg:"__own__",label:"App (source not bundled)",size:null,fileCount:0,totalIssues:0};J.nodes.push(R),J.byPkg.set("__own__",R)}J.importsOf.set("__own__",[...new Set([...J.importsOf.get("__own__")??[],...e.layerRoots.appImports.filter(R=>!S.has(R))])])}}return J}function vt(){return Te(e,z.dependencyPackagesView)}let It=S=>S==="__own__"?"App":T?.depth.get(S)===0?`App \xB7 ${Dt(S)}`:Dt(S);function B(S,R,q){if(S.nodes.length>50){go(S,R,q);return}let E=mo(S.nodes.map(F=>F.pkg),S.importsOf,R,q,{groupOf:F=>F});tt(S.nodes,new Map(E.map(F=>[F.file,F])))}function tt(S,R){for(let q of S){let E=R.get(q.file);E&&(q.x=E.x,q.y=E.y)}}function ot(){if(!k)return;if(m=null,$=null,C=null,P()){let F=it();T=Mi(F.nodes.map(V=>({id:V.pkg,size:V.size})),F.importsOf,e.layerRoots?.roots??["__own__"],{width:Math.max(360,x-190)}),k=!1;return}if(A()){let F=vt();D=$i(F.nodes.map(V=>V.file),F.importsOf,F.fileLevel?[]:e.layerRoots?.roots??[],{width:x,height:v,cycleImportsOf:F.cycleImportsOf}),k=!1;return}let S=z.layoutCache,R=z.focusedPkg,q=N(),E=q?it().nodes:j.nodes;if(S&&S.files===e.files&&S.w===x&&S.h===v&&S.focused===R&&(S.pkgView??!1)===q)tt(E,S.pos);else{if(q)B(it(),x,v);else if(R)if(j.nodes.length>50)go(j,x,v);else{let V=mo(j.files,j.importsOf,x,v);tt(j.nodes,new Map(V.map(Q=>[Q.file,Q])))}else ki(j,x,v);let F=new Map;for(let V of E)F.set(V.file,{x:V.x,y:V.y});z.layoutCache={files:e.files,w:x,h:v,pos:F,focused:R,pkgView:q}}k=!1}function Y(){if(A()&&D){if(vt().nodes.length<=100){let nt=12;r.save(),r.font='11px SFMono-Regular, Consolas, "Liberation Mono", monospace';for(let rt of vt().nodes){let G=rt.label.length>38?`${rt.label.slice(0,36)}\u2026`:rt.label;nt=Math.max(nt,r.measureText(G).width/2+4)}return r.restore(),bo([...D.nodes.values()],p,M,{statsHeight:g,left:nt,top:12,bottom:27})}let X=Math.max(20,Math.min(p,M)*.04),W=Math.min((p-X*2)/D.width,(M-X*2-g)/D.height,2.5),Z=Math.max(.05,W);return{k:Z,tx:(p-D.width*Z)/2,ty:(M-g-D.height*Z)/2}}if(P()&&T){let X=Math.min((p-24)/(T.width+185),(M-70)/(T.height+T.gap),1.5),W=Math.max(.05,X);return{k:W,tx:(p-(T.width+185)*W)/2+145*W,ty:24+Math.max(0,(M-70-(T.height+T.gap)*W)/2)}}let S=N()?it().nodes:j.nodes;if(S.length<=50){let X=0,W=0,Z=0;r.save(),r.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace";for(let nt of S){let rt=N()?te(nt):(nt.isHub?6:4)*z.nodeSize,G=rt*1.85+5;W=Math.max(W,G,r.measureText(nt.label).width/2+6),Z=Math.max(Z,G),X=Math.max(X,G,rt+4+13+4)}return r.restore(),bo(S,p,M,{statsHeight:g,left:W,top:Z,bottom:X})}if(S.length===0)return{k:1,tx:p/2,ty:(M-g)/2};let R=-1/0,q=-1/0,E=1/0,F=1/0;for(let X of S)X.x<E&&(E=X.x),X.y<F&&(F=X.y),X.x>R&&(R=X.x),X.y>q&&(q=X.y);let V=Math.max(20,q-F),Q=Math.max(20,R-E),mt=(E+R)/2,ct=(F+q)/2,pt=Math.max(20,Math.min(p,M)*(z.focusedPkg?.04:.03)),H=Math.min((p-pt*2)/Q,(M-pt*2-g)/V,4),L=Math.max(.05,H);return{k:L,tx:p/2-mt*L,ty:(M-g)/2-ct*L}}function U(){let S=Y();l.k=S.k,l.tx=S.tx,l.ty=S.ty}function lt(){if(!A()){c&&(c.textContent=`${Math.round(l.k*100)}%`);return}let S=be(l.k,Y().k,!0);c&&(c.textContent=`${S.percent}%`),Ue&&(Ue.disabled=l.k<=S.min*1.0001),je&&(je.disabled=l.k>=S.max*.9999)}function ft(S,R){return[S*l.k+l.tx,R*l.k+l.ty]}function Tt(S,R){return[(S-l.tx)/l.k,(R-l.ty)/l.k]}function gt(S){return!z.hidden.has(S.pkg)}function $t(S,R,q,E,F){let V=q+(E==="critical"?4.2:E==="high"?3.4:2.8),Q=E==="critical"?1.8:E==="high"?1.5:E==="medium"?1.3:1.1;r.strokeStyle=Cs[E],r.globalAlpha=F,r.lineWidth=Q,r.beginPath(),r.arc(S,R,V,0,Math.PI*2),r.stroke(),r.globalAlpha=1}function zt(S,R,q,E,F,V,Q){let pt=Q?.1:.9,H=2*(1-pt)*(q-S)+2*pt*(F-q),L=2*(1-pt)*(E-R)+2*pt*(V-E),X=Math.sqrt(H*H+L*L)||1,W=H/X,Z=L/X;r.beginPath(),Q?(r.moveTo(S,R),r.lineTo(S+W*7-Z*2.94,R+Z*7+W*2.94),r.lineTo(S+W*7+Z*2.94,R+Z*7-W*2.94)):(r.moveTo(F,V),r.lineTo(F-W*7+Z*2.94,V-Z*7-W*2.94),r.lineTo(F-W*7-Z*2.94,V-Z*7+W*2.94)),r.closePath()}function bt(S){if(!e.issuesHidden&&z.selectedSeverities.size>0){let q=S.severitySet;if(!q)return!0;let E=!1;for(let F of z.selectedSeverities)if(q.has(F)){E=!0;break}if(!E)return!0}if(!e.issuesHidden&&z.selectedColors.size>0){let q=S.colorSet;if(!q)return!0;let E=!1;for(let F of z.selectedColors)if(q.has(F)){E=!0;break}if(!E)return!0}if(z.solo&&S.pkg!==z.solo&&!N()&&!K())return!0;let R=z.pathFilter;if(R){let q=R.toLowerCase(),E=S.pathText?S.pathText.includes(q):S.file.toLowerCase().includes(q),F=S.pkg&&S.pkg.toLowerCase().includes(q),V=S.label&&S.label.toLowerCase().includes(q);if(!E&&!F&&!V)return!0}return!1}function yt(S){let R=(S.isHub?4.9:3.5)*z.nodeSize,q=Math.max(.6,Math.min(1.6,l.k));return R*q}function xt(){let S=f.getBoundingClientRect(),R=M,q=p;p=Math.max(80,S.width),M=Math.max(80,S.height),g=u?(parseFloat(getComputedStyle(u).lineHeight)||0)+8:0,y=window.devicePixelRatio||1,a.width=p*y,a.height=M*y,m=null,O.delete(j),J&&O.delete(J),a.style.width=p+"px",a.style.height=M+"px",r.setTransform(y,0,0,y,0,0),(x===0||v===0)&&(x=p,v=M,k=!0),ot();let E=q>0&&(Math.abs(p-q)/q>.15||Math.abs(M-R)/R>.15);w?(l.k=w.k,l.tx=w.tx+(p-w.W)/2,l.ty=w.ty+(M-w.H)/2,w=null):(_||E)&&(U(),_=!1),_t()}let Rt=null,jt=!0,ae=!1,le=!1;function _t(){jt=!0,!(ae||le)&&(ae=!0,Rt=requestAnimationFrame(()=>{ae=!1,jt&&!le&&(jt=!1,qi())}))}function qi(){let S=N()?it():j;if($?.graph!==S){$={graph:S,x0:1/0,y0:1/0,x1:-1/0,y1:-1/0};for(let Q of S.nodes)$.x0=Math.min($.x0,Q.x),$.x1=Math.max($.x1,Q.x),$.y0=Math.min($.y0,Q.y),$.y1=Math.max($.y1,Q.y)}let R=yt({isHub:!0})*6+8,E=$.x0*l.k+l.tx>R&&$.y0*l.k+l.ty>R&&$.x1*l.k+l.tx<p-R&&$.y1*l.k+l.ty<M-R&&l.k<=1.4&&S.nodes.length>50&&!P()&&!A(),F={tx:l.tx,ty:l.ty,key:JSON.stringify([l.k,Oi().bg,z.nodeSize,z.edgeOpacity,d,z.selected,z.solo,z.focusedPkg,N(),z.showAll,z.pathFilter,[...z.selectedSeverities],[...z.selectedColors],[...z.hidden]])},V=E?Ai(m,F,p,M,y):null;r.save();try{if(V){r.save(),r.setTransform(1,0,0,1,0,0),r.globalCompositeOperation="copy",r.drawImage(a,V.dx,V.dy),r.restore(),r.beginPath();for(let Q of V.rects)r.rect(Q.x,Q.y,Q.w,Q.h);r.clip()}Hi(V),m=E?F:null}finally{r.restore()}}function Hi(S){let R=Oi();r.fillStyle=R.bg,r.fillRect(0,0,p,M),Di(R);let q=A(),E=N(),F=q?vt():E?it():j,V=K()||E?z.solo:z.selected,Q=V?F.nodeByFile.get(V):null,mt=Q?V:null;if(q){zi(r,D,F,{theme:R,viewport:l,width:p,height:M,colorOf:ht,selected:mt,hovered:d,query:z.pathFilter,dimmed:G=>bt(G)}),lt();return}if(P()){r.save(),r.translate(l.tx,l.ty),r.scale(l.k,l.k),Si(r,T,{theme:R,scale:l.k,selected:mt,hovered:d,colorOf:ht,labelOf:It,sizeLabel:G=>Ct(typeof G=="number"?G:F.byPkg.get(G).size)||"Size unknown",dimmed:G=>bt(F.byPkg.get(G))}),r.restore(),lt();return}if(E&&F.nodes.length<=50){Vi(R);return}if(z.focusedPkg&&F.nodes.length<=50){Xi(R,mt,Q);return}O.has(F)||O.set(F,Ii(F));let ct=O.get(F),pt=JSON.stringify([l.k,l.tx,l.ty,z.nodeSize,R.bg,z.solo,z.pathFilter,[...z.selectedSeverities],[...z.selectedColors],[...z.hidden]]);Pi(ct,{viewport:l,selected:mt,paintKey:pt,visible:gt,dimmed:bt,radius:yt,color:ht});let H=Ci(ct,z.edgeOpacity,R.edgeIntra,!!mt),L=mt||d,X=.85/l.k,W=.55/l.k,Z=null,nt=null,rt=null;r.save(),r.translate(l.tx,l.ty),r.scale(l.k,l.k);for(let G of ct.edges){let{edge:st,a:et,b:dt}=G;if(!et.visible||!dt.visible||Ti(et,dt,p,M)||Ve(S,Math.min(et.x,dt.x)-2,Math.min(et.y,dt.y)-2,Math.max(et.x,dt.x)+2,Math.max(et.y,dt.y)+2))continue;let wt=L&&(st.a===L||st.b===L),ut=et.dimmed&&dt.dimmed?wt?H.emphasisDim:H.baseDim:wt?H.emphasis:H.base,kt=st.cross?Ri(G,r):ut.neutral,Mt=st.cross?ut.opacity:1,Et=st.cross?X:W;kt!==nt&&(r.strokeStyle=kt,nt=kt),Mt!==Z&&(r.globalAlpha=Mt,Z=Mt),Et!==rt&&(r.lineWidth=Et,rt=Et),r.beginPath(),r.moveTo(et.node.x,et.node.y),r.lineTo(dt.node.x,dt.node.y),r.stroke()}r.restore();for(let G of ct.nodes){if(!G.visible)continue;let st=G.node,et=st.file===d,dt=st.file===mt;if(!st.isHub&&!et&&!dt||G.dimmed&&!et&&!dt)continue;let wt=G.radius,ut=G.x,kt=G.y,Mt=wt*(dt?6:et?4.5:3);yo(ut,kt,Mt,p,M)||Ve(S,ut-Mt-2,kt-Mt-2,ut+Mt+2,kt+Mt+2)||(r.fillStyle=_i(G,Mt,r),r.beginPath(),r.arc(ut,kt,Mt,0,Math.PI*2),r.fill())}for(let G of ct.nodes){if(!G.visible)continue;let st=G.node,et=G.radius,dt=G.x,wt=G.y;if(yo(dt,wt,et+6,p,M)||Ve(S,dt-et-8,wt-et-8,dt+et+8,wt+et+8))continue;let ut=1,kt=mt&&st.file===mt;mt&&!kt&&(ut=ct.neighbors.has(st.file)?1:.25),!kt&&G.dimmed&&(ut=Math.min(ut,.1)),r.fillStyle=G.color+Gt(ut),r.beginPath(),r.arc(dt,wt,et,0,Math.PI*2),r.fill(),st.isHub&&(r.strokeStyle=R.hubRing(.55*ut),r.lineWidth=.8,r.stroke()),st.issue&&$t(dt,wt,et,st.issue,ut)}if(l.k>1.4){let st=0;if(l.k<9&&!z.showLabels)for(let dt of F.nodes){if(!gt(dt))continue;let[wt,ut]=ft(dt.x,dt.y);if(!(wt<0||wt>p||ut<0||ut>M)&&(st++,st>=50))break}let et=l.k>=9||st<50;if(z.showLabels||et){r.font="10px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",r.fillStyle=R.labelFill,r.textAlign="left",r.textBaseline="middle";let dt=11,wt=2,ut=250,kt=(at,St)=>at>-ut&&at<p+ut&&St>-ut&&St<M+ut,Mt=[];for(let at of F.nodes){if(!gt(at))continue;let[St,Ft]=ft(at.x,at.y);if(!kt(St,Ft))continue;let Lt=yt(at);Mt.push({file:at.file,x0:St-Lt,x1:St+Lt,y0:Ft-Lt,y1:Ft+Lt})}let Et=[];for(let at of F.nodes){if(!gt(at)||!at.isHub&&l.k<2.4)continue;let[St,Ft]=ft(at.x,at.y);if(!kt(St,Ft))continue;let Lt=yt(at),Ot=St+Lt+4,At=Ft+1,Bt=r.measureText(at.label).width+wt,qt=at.file===mt,Ut=at.file===d,Jt=qt?3:Ut?2:at.isHub?1:0;Et.push({file:at.file,n:at,tx:Ot,ty:At,prio:Jt,x0:Ot-wt,x1:Ot+Bt,y0:At-dt/2,y1:At+dt/2})}let Zt=vo(Et.filter(at=>!Mt.some(St=>St.file!==at.file&&Ei(at,St))));for(let at of Zt)r.fillText(at.n.label,at.tx,at.ty)}}if(Q&>(Q)){let[G,st]=ft(Q.x,Q.y),et=yt(Q);r.strokeStyle=R.selectRing,r.lineWidth=1.5,r.beginPath(),r.arc(G,st,et+5,0,Math.PI*2),r.stroke()}lt()}function Di(S){if(l.k<.4)return;let R=80,q=(l.tx%R+R)%R,E=(l.ty%R+R)%R;r.strokeStyle=S.grid,r.lineWidth=1,r.beginPath();for(let F=q;F<p;F+=R)r.moveTo(F,0),r.lineTo(F,M);for(let F=E;F<M;F+=R)r.moveTo(0,F),r.lineTo(p,F);r.stroke()}function Xi(S,R,q){let E=ht(z.focusedPkg),F=S.hubRing(.55),V=new Set;if(d){V.add(d);for(let L of j.adj.get(d)??[]){let X=j.edges[L];V.add(X.a),V.add(X.b)}}let Q=L=>(L.isHub?6:4)*z.nodeSize;for(let L of j.edges){let X=j.nodeByFile.get(L.a),W=j.nodeByFile.get(L.b);if(!X||!W||!gt(X)||!gt(W))continue;let Z=L.fromLo&&L.fromHi,nt=!Z&&L.fromHi,rt=nt?W:X,G=nt?X:W,st=d&&(L.a===d||L.b===d),et=R&&(L.a===R||L.b===R),dt=(R||d)&&!st&&!et,wt=Q(rt),ut=Q(G),[kt,Mt]=ft(rt.x,rt.y),[Et,Zt]=ft(G.x,G.y),at=Et-kt,St=Zt-Mt,Ft=Math.sqrt(at*at+St*St)||1,Lt=at/Ft,Ot=St/Ft,At=kt+Lt*(wt+1.5),Bt=Mt+Ot*(wt+1.5),qt=Et-Lt*(ut+3.5),Ut=Zt-Ot*(ut+3.5),Jt=Math.min(Ft*.15,30),ee=(At+qt)/2-Ot*Jt,Ht=(Bt+Ut)/2+Lt*Jt;r.beginPath(),r.moveTo(At,Bt),r.quadraticCurveTo(ee,Ht,qt,Ut);let Vt;et?Vt=.9:st?Vt=.85:dt?Vt=.05:Vt=Math.min(.85,z.edgeOpacity*3),r.strokeStyle=E+Gt(Vt),r.lineWidth=et||st?1.5:.85,r.stroke(),!dt&&(zt(At,Bt,ee,Ht,qt,Ut,!1),r.fillStyle=E+Gt(Math.min(1,Vt+.15)),r.fill(),Z&&(zt(At,Bt,ee,Ht,qt,Ut,!0),r.fill()))}for(let L of j.nodes){if(!gt(L))continue;let[X,W]=ft(L.x,L.y),Z=Q(L),nt=L.file===d,rt=L.file===R,G=(R||d)&&!V.has(L.file)&&!rt?.15:1;if(r.globalAlpha=G,rt||nt||L.isHub){let st=Z*(rt?4:nt?3:2.4),et=r.createRadialGradient(X,W,Z*.6,X,W,st);et.addColorStop(0,E+Gt(rt?.4:.25)),et.addColorStop(1,E+"00"),r.fillStyle=et,r.beginPath(),r.arc(X,W,st,0,Math.PI*2),r.fill()}r.fillStyle=E,r.beginPath(),r.arc(X,W,Z,0,Math.PI*2),r.fill(),L.isHub&&(r.strokeStyle=F,r.lineWidth=.9,r.stroke()),L.issue&&$t(X,W,Z,L.issue,G),r.globalAlpha=1}r.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",r.textAlign="center",r.textBaseline="top",r.lineJoin="round";let mt=13,ct=2,pt=[];for(let L of j.nodes){if(!gt(L))continue;let[X,W]=ft(L.x,L.y),Z=Q(L),nt=W+Z+4,rt=r.measureText(L.label).width/2+ct,G=L.file===R,st=L.file===d,et=G?3:st?2:L.isHub?1:0;pt.push({n:L,sx:X,ty:nt,halfW:rt,isSel:G,isHov:st,prio:et,x0:X-rt,x1:X+rt,y0:nt,y1:nt+mt})}let H=vo(pt);for(let L of H){let{n:X,sx:W,ty:Z,isSel:nt,isHov:rt}=L,G=(R||d)&&!V.has(X.file)&&!nt?.2:1;r.globalAlpha=G,r.shadowColor=S.labelShadow,r.shadowBlur=4,r.strokeStyle=S.labelOutline,r.lineWidth=3,r.strokeText(X.label,W,Z),r.shadowBlur=0,r.fillStyle=nt?S.labelSelected:rt?S.labelHover:S.labelDefault,r.fillText(X.label,W,Z),r.globalAlpha=1}if(q&>(q)){let[L,X]=ft(q.x,q.y),W=Q(q);r.strokeStyle=S.selectRing,r.lineWidth=1.8,r.beginPath(),r.arc(L,X,W+4,0,Math.PI*2),r.stroke()}lt()}function te(S){return Math.min(26,5+Math.sqrt(S.fileCount)*1.7)*z.nodeSize}function Vi(S){let R=it(),q=z.solo&&R.byPkg.has(z.solo)?z.solo:null,E=d??q,F=new Set;if(E){F.add(E);for(let H of R.edges)H.a===E?F.add(H.b):H.b===E&&F.add(H.a)}let V=H=>{if(H.pkg===q||H.pkg===d)return 1;let L=1;return E&&!F.has(H.pkg)&&(L=.2),bt(H)&&(L=Math.min(L,.1)),L};for(let H of R.edges){let L=R.byPkg.get(H.a),X=R.byPkg.get(H.b);if(!L||!X||!gt(L)||!gt(X))continue;let W=H.fromLo&&H.fromHi,Z=!W&&H.fromHi,nt=Z?X:L,rt=Z?L:X,G=E!==null&&(H.a===E||H.b===E),st=bt(L)&&bt(X),et=E!==null&&!G||st,dt=te(nt),wt=te(rt),[ut,kt]=ft(nt.x,nt.y),[Mt,Et]=ft(rt.x,rt.y),Zt=Mt-ut,at=Et-kt,St=Math.sqrt(Zt*Zt+at*at)||1,Ft=Zt/St,Lt=at/St,Ot=ut+Ft*(dt+1.5),At=kt+Lt*(dt+1.5),Bt=Mt-Ft*(wt+3.5),qt=Et-Lt*(wt+3.5),Ut=Math.min(St*.15,30),Jt=(Ot+Bt)/2-Lt*Ut,ee=(At+qt)/2+Ft*Ut,Ht;st?Ht=.05:G?Ht=.9:et?Ht=.06:Ht=.5;let Vt=r.createLinearGradient(Ot,At,Bt,qt);Vt.addColorStop(0,ht(nt.pkg)+Gt(Ht)),Vt.addColorStop(1,ht(rt.pkg)+Gt(Ht)),r.beginPath(),r.moveTo(Ot,At),r.quadraticCurveTo(Jt,ee,Bt,qt),r.strokeStyle=Vt,r.lineWidth=Math.min(3.5,.8+Math.sqrt(H.count)*.3)*(G?1.3:1),r.stroke(),!et&&(zt(Ot,At,Jt,ee,Bt,qt,!1),r.fillStyle=ht(rt.pkg)+Gt(Math.min(1,Ht+.15)),r.fill(),W&&(zt(Ot,At,Jt,ee,Bt,qt,!0),r.fillStyle=ht(nt.pkg)+Gt(Math.min(1,Ht+.15)),r.fill()))}for(let H of R.nodes){if(!gt(H))continue;let[L,X]=ft(H.x,H.y),W=te(H),Z=H.pkg===d,nt=H.pkg===q,rt=ht(H.pkg),G=V(H);if(nt||Z){let st=W*(nt?2.6:2.2),et=r.createRadialGradient(L,X,W*.6,L,X,st);et.addColorStop(0,rt+Gt(nt?.4:.25)),et.addColorStop(1,rt+"00"),r.fillStyle=et,r.beginPath(),r.arc(L,X,st,0,Math.PI*2),r.fill()}r.fillStyle=rt+Gt(G),r.beginPath(),r.arc(L,X,W,0,Math.PI*2),r.fill(),H.issue&&$t(L,X,W,H.issue,G)}r.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",r.textAlign="center",r.textBaseline="top",r.lineJoin="round";let Q=13,mt=2,ct=[];for(let H of R.nodes){if(!gt(H))continue;let[L,X]=ft(H.x,H.y),W=te(H),Z=X+W+4,nt=r.measureText(H.label).width/2+mt,rt=H.pkg===q,G=H.pkg===d,st=rt?1/0:G?1e9:H.fileCount;ct.push({p:H,sx:L,ty:Z,isSel:rt,isHov:G,prio:st,x0:L-nt,x1:L+nt,y0:Z,y1:Z+Q})}let pt=vo(ct);for(let H of pt){let{p:L,sx:X,ty:W,isSel:Z,isHov:nt}=H;r.globalAlpha=Math.max(.25,V(L)),r.shadowColor=S.labelShadow,r.shadowBlur=4,r.strokeStyle=S.labelOutline,r.lineWidth=3,r.strokeText(L.label,X,W),r.shadowBlur=0,r.fillStyle=Z?S.labelSelected:nt?S.labelHover:S.labelDefault,r.fillText(L.label,X,W),r.globalAlpha=1}if(q){let H=R.byPkg.get(q),[L,X]=ft(H.x,H.y);r.strokeStyle=S.selectRing,r.lineWidth=1.8,r.beginPath(),r.arc(L,X,te(H)+4,0,Math.PI*2),r.stroke()}lt()}function xo(S,R){if(A()){let[ct,pt]=Tt(S,R),H=null,L=1/0;for(let[X,W]of D.nodes){let Z=(W.x-ct)**2+(W.y-pt)**2;Z<L&&Z<(14/Math.max(l.k,.1))**2&&(L=Z,H=vt().nodeByFile.get(X))}return H}if(P()){let[ct,pt]=Tt(S,R);for(let H of T.rects.values())if(H.width>0&&ct>=H.x&&ct<H.x+H.width&&pt>=H.y&&pt<=H.y+H.height)return it().byPkg.get(H.id);return null}let q=N(),E=q?it():j,F=q&&E.nodes.length<=50;if(E.nodes.length>50){C??=Li(E.nodes);let ct=4.9*z.nodeSize*Math.max(.6,Math.min(1.6,l.k));return C(S,R,l,ct,yt,gt)}let V=null,Q=1/0,mt=6;for(let ct of E.nodes){if(!gt(ct))continue;let[pt,H]=ft(ct.x,ct.y),L=pt-S,X=H-R,W=L*L+X*X,Z=(F?te(ct):yt(ct))+mt;W<Z*Z&&W<Q&&(Q=W,V=ct)}return V}function Wi(S,R,q){if(!h)return;let E=ht(S.pkg),F=Dt(S.pkg),V=Re(S.file,S.pkg);oe(I`<div class="g2-tt-path">${V}</div><div class="g2-tt-head"><span class="g2-tt-dot" style="${`background:${E}`}"></span> <span class="g2-tt-pkg">${F}</span></div>${S.totalIssues>0?ne(S.own):null}`,h),wo(R,q)}function Ni(S,R,q){if(!h)return;let E=ht(S.pkg),F=Ct(S.size);oe(I`<div class="g2-tt-path">${P()?It(S.pkg):S.label}</div>${A()?I`<div class="g2-tt-pkg">${vt().importedBy.get(S.pkg).length} importers · ${vt().importsOf.get(S.pkg)?.length??0} dependencies</div>`:null} ${P()?I`<div class="g2-tt-pkg">${T.depth.has(S.pkg)?`Level ${T.depth.get(S.pkg)} \xB7 shortest import distance from App`:"No known import path from App"}</div>`:null}<div class="g2-tt-head"><span class="g2-tt-dot" style="${`background:${E}`}"></span> <span class="g2-tt-pkg">${S.fileCount} ${S.fileCount===1?"file":"files"}${F?` \xB7 ${F}`:""}</span></div>${S.totalIssues>0?ne(S.own):null}`,h),wo(R,q)}function wo(S,R){let q=f.getBoundingClientRect();h.classList.add("show");let E=h.offsetWidth,F=h.offsetHeight,V=S-q.left,Q=R-q.top,mt=q.width,ct=q.height,pt=12,H=V+pt;H+E>mt-4&&(H=V-E-pt),H<4&&(H=4);let L=Q+pt;L+F>ct-4&&(L=Q-F-pt),L<4&&(L=4),h.style.left=`${H}px`,h.style.top=`${L}px`}function Ne(){h&&h.classList.remove("show")}let Se=!1,ye=null,Ge=!1,ko=S=>{S.button===0&&(S.target.closest(".g2-stage-overlay, .g2-stage-overlay-tr, .g2-zoom-ctrl")||(Se=!0,Ge=!1,ye={x:S.clientX,y:S.clientY,tx:l.tx,ty:l.ty}))},Mo=S=>{let R=f.getBoundingClientRect(),q=S.clientX-R.left,E=S.clientY-R.top;if(Se){let Q=S.clientX-ye.x,mt=S.clientY-ye.y;Math.abs(Q)+Math.abs(mt)>3&&(Ge=!0),l.tx=ye.tx+Q,l.ty=ye.ty+mt,Ne(),_t();return}let F=xo(q,E),V=d;d=F?.file??null,a.style.cursor="default",F?N()||K()?Ni(F,S.clientX,S.clientY):Wi(F,S.clientX,S.clientY):V&&Ne(),d!==V&&_t()},So=S=>{if(Se&&!Ge){let R=f.getBoundingClientRect(),q=S.clientX-R.left,E=S.clientY-R.top,F=xo(q,E);N()||K()?(z.solo=F&&z.solo!==F.pkg?F.pkg:null,z.selected=null,o(),i?.()):(z.selected=F?.file??null,o()),_t()}Se=!1},$o=()=>{let S=d!==null;d=null,Ne(),S&&_t()},zo=S=>{S.preventDefault();let R=f.getBoundingClientRect(),q=S.clientX-R.left,E=S.clientY-R.top,F=Math.exp(-S.deltaY*.0015),V=Y();if(F<1&&l.k<=V.k*1.0001){l.k=V.k;let H=Math.min(.4,(1-F)*3);l.tx+=(V.tx-l.tx)*H,l.ty+=(V.ty-l.ty)*H,_t();return}let[Q,mt]=Tt(q,E),ct=be(l.k,V.k,A()),pt=Math.max(ct.min,Math.min(ct.max,l.k*F));l.k=pt,l.tx=q-Q*l.k,l.ty=E-mt*l.k,_t()};f.addEventListener("mousedown",ko),window.addEventListener("mousemove",Mo),window.addEventListener("mouseup",So),f.addEventListener("mouseleave",$o),f.addEventListener("wheel",zo,{passive:!1});function Io(S){let R=be(l.k,Y().k,A());S=Math.max(R.min,Math.min(R.max,S));let q=p/2,E=M/2,[F,V]=Tt(q,E);l.k=S,l.tx=q-F*l.k,l.ty=E-V*l.k,_t()}let je=n.querySelector("#g2-zoom-in"),Ue=n.querySelector("#g2-zoom-out"),Gi=n.querySelector("#g2-zoom-fit");je?.addEventListener("click",()=>Io(l.k*1.4)),Ue?.addEventListener("click",()=>Io(l.k/1.4)),Gi?.addEventListener("click",()=>{U(),_t()}),xt();let Po=new ResizeObserver(()=>xt());Po.observe(f);let Co=new MutationObserver(S=>{for(let R of S){let q=(R.oldValue||"").includes("report-fullscreen"),E=document.body.classList.contains("report-fullscreen");if(q!==E){x=0,v=0,k=!0,_=!0,z.layoutCache=null,setTimeout(()=>xt(),80);return}_t()}});Co.observe(document.body,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0}),_t(),z.graphState={requestDraw:_t,_cleanup:({keepViewport:S=!1}={})=>{let R=f.getBoundingClientRect();z.keptViewport=S&&R.width>0&&R.height>0?{key:b,k:l.k,tx:l.tx,ty:l.ty,W:p,H:M,layoutW:x,layoutH:v}:null,le=!0,cancelAnimationFrame(Rt),Po.disconnect(),Co.disconnect(),f.removeEventListener("mousedown",ko),window.removeEventListener("mousemove",Mo),window.removeEventListener("mouseup",So),f.removeEventListener("mouseleave",$o),f.removeEventListener("wheel",zo)}}}function ua(t,e){let o=document.querySelector("graph-layout")?.shadowRoot;if(!o)return;let i=Bi(t),s=o.querySelector("#g2-selection-area");s&&oe(Zo(i,e),s);let n=o.querySelector("#g2-focus-overlay-slot");n&&oe(Uo(i),n)}function ga(t){let e=document.querySelector("graph-layout")?.shadowRoot;if(!e)return;let o=e.querySelector("#g2-top-pkgs-block");o&&oe(Ko(Bi(t)),o)}function Bi(t){let e=Vo(t.treeData,t.files,t.ownCounts,t.transitiveCounts,t.severitySets,t.colorSets,t.fileFindings,t.options);if(t.strippedToOrig)for(let o of e.nodes)o.origFile=t.strippedToOrig.get(o.file);return e.canPackagesView=t.canPackagesView??!1,e.supportsLayers=t.supportsLayers??!1,e.layerRoots=t.layerRoots,e.flowEntries=t.flowEntries,e.ownSourcePackages=t.ownSourcePackages,e.entryPackages=t.entryPackages,e.ownSourceFiles=t.ownSourceFiles,e.reasons=t.reasons??[],e.issuesHidden=t.issuesShown===!1,e.viewId=t.viewId??null,e}export{Ts as attachGraph2Interaction,Bi as buildGraphFromPrep,ua as refreshSidebar,ga as refreshTopPkgs};
|
|
1
|
+
import"./chunk-VFWMQ3LG.js";import{a as e}from"./chunk-R5O6FAW4.js";import{A as t,_ as n,ca as r,fa as i,ga as a,ha as o,ja as s,ka as c,la as l,sa as u,ua as d,va as f,wa as p,x as m,xa as h}from"./chunk-PTGDYLNS.js";import"./chunk-I2MDGSQX.js";import{e as g}from"./chunk-3PS4KWD2.js";import{e as _}from"./chunk-IYPY47MC.js";import{c as v,d as y}from"./chunk-OKRLLE5I.js";import"./chunk-BC2UCLFJ.js";import{j as b}from"./chunk-SXV2T5C4.js";import{d as x,l as S,m as C,n as w,o as T}from"./chunk-WFYLMF6Z.js";import"./chunk-C4Z6ZBXV.js";import"./chunk-TUII34K2.js";import{a as E,c as D,i as O,j as k}from"./chunk-2XUEZHIP.js";import"./chunk-OOJM4CTU.js";var A=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{display:grid;grid-template-columns:1fr 300px;grid-template-rows:auto 1fr;grid-template-areas:"topbar right" "stage right";min-height:0;border:1px solid var(--border);border-radius:var(--ui-radius, 8px);overflow:hidden;background:var(--graph-canvas-bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,sans-serif;font-size:12px}.graph2-layout{display:contents}:host([matrix]){grid-template-columns:minmax(0,1fr) 300px}.graph2-topbar{grid-area:topbar;display:flex;flex-direction:column;gap:.5rem;padding:var(--graph-topbar-padding, .6rem .75rem .6rem var(--graph-topbar-left-padding, .75rem));font-size:.825rem;background:var(--surface);backdrop-filter:var(--glass-blur);border-bottom:1px solid var(--graph-divider)}.graph2-topbar-row{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem;padding:0}.graph2-topbar .g2-spacer{flex:1}.graph2-topbar-row-pinned{flex-wrap:nowrap;align-items:flex-start}.graph2-topbar-row-pinned>#g2-fullscreen{margin-top:2px}.g2-topbar-controls{display:flex;flex:1;flex-wrap:wrap;align-items:center;gap:.75rem;min-width:0}.g2-topbar-controls>.g2-reason-scope,.g2-topbar-controls>.g2-issues-switch{margin-left:auto}.g2-topbar-controls>.g2-reason-scope+.g2-issues-switch{margin-left:0}.g2-topbar-controls .g2-path-filter-wrap{flex:1 1 8rem;min-width:0;max-width:12rem}.g2-matrix-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px;font-size:11px;& button{height:30px;padding:4px 7px;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:var(--surface);color:var(--text);font:inherit}& button:hover,button[aria-pressed=true]{background:var(--graph-hover-bg);border-color:var(--muted)}}.graph2-topbar triage-selector{margin-left:auto}.g2-icon-btn{width:28px;height:28px;border-radius:var(--ui-radius, 5px);background:var(--graph-hover-bg);border:1px solid var(--border);color:var(--muted);display:grid;place-items:center;font-family:inherit;&:hover{color:var(--accent);border-color:var(--accent)}}.g2-path-filter-wrap{position:relative;flex:0 0 12rem;padding-right:22px}.g2-path-filter-wrap .g2-path-filter-clear{position:absolute;right:4px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:18px;height:18px;background:transparent;border:0;border-radius:var(--ui-radius, 50%);color:var(--muted);font:400 10px/1 inherit;font-family:inherit;&:hover{color:var(--text);background:var(--surface-active)}}.g2-path-filter:placeholder-shown~.g2-path-filter-clear{display:none}.g2-layout-tabs{display:inline-flex;flex-shrink:0;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);padding:2px;gap:2px;& button{position:relative;display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:var(--ui-radius, 4px);background:transparent;color:var(--muted);font:inherit;font-size:11px;padding:5px 7px}& button[aria-pressed=true]{background:var(--graph-hover-bg);color:var(--text);box-shadow:var(--graph-layout-active-shadow, inset 0 0 0 1px var(--border))}}.g2-reason-scope{--scope-height: 30px}.graph2-right{grid-area:right;border-left:1px solid var(--graph-divider);background:var(--surface);backdrop-filter:var(--glass-blur);display:flex;flex-direction:column;overflow:hidden;padding:14px}.g2-panel-title{font-family:inherit;font-weight:600;font-size:11px;line-height:1;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);opacity:.85;margin:14px 0 8px;display:flex;align-items:baseline;gap:6px;&:first-child{margin-top:0}}.g2-panel-title-row{justify-content:space-between;gap:8px}#g2-top-pkgs-block{margin-top:14px;flex:1 1 0;min-height:0;display:flex;flex-direction:column}.g2-mini-tabs{display:flex;gap:1px;background:var(--graph-mini-tabs-bg, var(--graph-divider));border-radius:var(--ui-radius, 4px);overflow:hidden}.g2-mini-tab{background:transparent;border:0;color:var(--muted);font-family:inherit;font-weight:500;font-size:11px;line-height:1.4;text-transform:none;letter-spacing:0;padding:2px 7px;&:hover{color:var(--text);background:var(--graph-hover-bg)}&.on{background:var(--surface-active);color:var(--accent);text-decoration:var(--graph-mini-tab-active-decoration, none);text-underline-offset:.2em}}.graph2-stage{grid-area:stage;position:relative;background:var(--graph-canvas-bg);overflow:hidden;cursor:default;&:active{cursor:default}& canvas{position:absolute;inset:0;width:100%;height:100%;display:block}}.g2-stage-overlay{position:absolute;top:12px;left:12px;z-index:3;display:flex;flex-direction:column;gap:4px;pointer-events:none;max-width:calc(100% - 60px)}.g2-stage-overlay>*{pointer-events:auto}.g2-stage-stats{position:absolute;bottom:10px;left:12px;z-index:2;display:flex;flex-wrap:wrap;gap:2px 14px;font:500 10px/1.4 ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;color:var(--muted);opacity:.7;text-transform:uppercase;letter-spacing:.06em;pointer-events:none;max-width:calc(100% - 80px);& b{font-weight:600;color:var(--text);opacity:1}}.g2-stage-overlay-tr{position:absolute;top:12px;right:12px;z-index:3;pointer-events:auto}.g2-focus-pkg-btn{width:28px;height:28px;display:grid;place-items:center;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);color:var(--accent);box-shadow:var(--shadow-glass);&:hover{border-color:var(--accent);background:var(--surface-active)}& svg{display:block}}.g2-back-btn{display:inline-flex;align-items:center;gap:4px;padding:6px 11px;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);color:var(--accent);font:500 11px/1 inherit;font-family:inherit;box-shadow:var(--shadow-glass);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;align-self:flex-start;&:hover{border-color:var(--accent);background:var(--surface-active)}}.g2-tooltip{position:absolute;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 7px);padding:9px 11px;pointer-events:none;min-width:170px;max-width:260px;opacity:0;transition:opacity .12s;z-index:10;box-shadow:var(--shadow-glass);&.show{opacity:1}}.g2-tt-path{font:500 11px/1.3 ui-monospace,monospace;color:var(--text);word-break:break-all;margin-bottom:4px}.g2-tt-head{display:flex;align-items:center;gap:6px;margin-bottom:6px;flex-wrap:wrap}.g2-tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.g2-tt-pkg{font-size:10px;color:var(--muted);word-break:break-all}.g2-tooltip .tree-count-chips{margin-top:6px}:host-context(body.theme-light) .graph2-right .tree-count-chip.medium,:host-context(body.theme-light) .g2-tooltip .tree-count-chip.medium{color:#fff}.g2-selection-card{background:var(--graph-hover-bg);border:1px solid var(--border);border-radius:var(--ui-radius, 8px);overflow:hidden}.g2-sel-head{padding:11px 13px;border-bottom:1px solid var(--graph-divider);display:flex;align-items:center;gap:8px}.g2-sel-file-head{padding:11px 13px;border-bottom:1px solid var(--graph-divider);display:flex;flex-direction:column;gap:6px}.g2-sel-path{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-weight:600;font-size:12px;line-height:1.3;color:var(--text);word-break:break-all}.g2-sel-pkg-row{display:flex;align-items:center;gap:6px;min-width:0}.g2-sel-pkg{font-size:11px;color:var(--muted);word-break:break-all;min-width:0}.g2-sel-fullpath{padding:7px 13px;border-bottom:1px solid var(--graph-divider);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-size:10px;line-height:1.3;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.g2-sel-size{padding:5px 13px 7px;border-bottom:1px solid var(--graph-divider);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-size:10px;line-height:1.3;color:var(--muted);font-variant-numeric:tabular-nums}.g2-sel-dot{width:11px;height:11px;border-radius:50%;box-shadow:0 0 0 3px color-mix(in srgb,var(--dot) 22%,transparent);flex-shrink:0}.g2-sel-id{font:600 12px/1 ui-monospace,monospace;color:var(--text);word-break:break-all;flex:1;min-width:0}.g2-sel-grp{font:500 9px/1 ui-monospace,monospace;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;flex-shrink:0}.g2-sel-body{padding:11px 13px}.g2-sel-row{display:flex;justify-content:space-between;gap:12px;font-size:11px;padding:5px 0;border-bottom:1px solid var(--graph-divider);&:last-child{border-bottom:0}.k{color:var(--muted);flex-shrink:0}.v{color:var(--text);font-family:ui-monospace,monospace;word-break:break-all;text-align:right;min-width:0}}.g2-sel-section{padding:9px 13px;border-top:1px solid var(--graph-divider)}.g2-sel-section-label{font-family:inherit;font-weight:600;font-size:11px;line-height:1;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);opacity:.85;margin-bottom:5px}.g2-sel-section-empty{color:var(--muted);opacity:.55;font-size:11px;font-style:italic}.g2-sel-versions{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-size:11px;line-height:1.4;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}.g2-sel-jumps{padding:11px 13px;display:flex;gap:5px;flex-wrap:wrap;border-top:1px solid var(--graph-divider)}.g2-sel-jump{background:var(--surface-active);border:1px solid var(--border);color:var(--accent);border-radius:var(--ui-radius, 4px);padding:2px 8px;font-family:inherit;font-weight:500;font-size:11px;line-height:1.3;&:hover{border-color:var(--accent)}}.g2-sel-file-list{list-style:none;margin:0;padding:0;max-height:110px;overflow:hidden auto;-webkit-app-region:no-drag;app-region:no-drag;&::-webkit-scrollbar{width:4px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}& li{padding:0}}.g2-sel-file-link{display:flex;align-items:center;gap:6px;width:100%;background:transparent;border:0;border-radius:var(--ui-radius, 3px);padding:2px 6px;min-height:20.5px;font:400 11px/1.4 ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;color:var(--accent);text-align:left;&:hover{background:var(--graph-hover-bg)}.g2-sel-file-dot{width:7px;height:7px;border-radius:50%;flex-shrink:0}.g2-sel-file-path{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}.g2-empty-state,.g2-sel-section-empty,.g2-dist-empty{cursor:default;user-select:none;-webkit-user-select:none}.g2-empty-state{background:var(--graph-hover-bg);border:1px dashed var(--border);border-radius:var(--ui-radius, 8px);padding:18px 14px;text-align:center;color:var(--muted);font-size:11px;line-height:1.5;& strong{color:var(--text);display:block;margin-bottom:4px;font-weight:500}}.g2-dist-bar{width:100%;height:5px;border-radius:3px;overflow:hidden;display:flex;background:var(--surface-active);margin-bottom:8px;>span{display:block;height:100%}}.g2-dist-list{display:flex;flex-direction:column;gap:0;flex:1 1 0;min-height:0;overflow-y:auto;overscroll-behavior:none;-webkit-app-region:no-drag;app-region:no-drag;scrollbar-gutter:stable;scrollbar-width:thin;scrollbar-color:var(--border) transparent;&::-webkit-scrollbar{width:5px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}}.g2-dist-empty{color:var(--muted);opacity:.55;font-size:10px;font-style:italic;padding:6px 0;text-align:center}@media print{:host{display:none!important}}
|
|
2
|
+
`,j=`.g2-dist-item{display:grid;grid-template-columns:8px 1fr auto auto;gap:8px;align-items:center;font-size:10px;padding:2px 6px;min-height:20.5px;margin:0 -6px;background:transparent;border:0;border-radius:var(--ui-radius, 4px);font-family:inherit;text-align:left;width:calc(100% + 12px);&:hover{background:var(--graph-hover-bg)}&.on{background:var(--surface-active);.g2-dist-name{color:var(--accent)}}.g2-dist-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.g2-dist-name{color:var(--muted);font-family:ui-monospace,monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.g2-dist-count{font-family:ui-monospace,monospace;color:var(--text)}.g2-dist-pct{font-family:ui-monospace,monospace;color:var(--muted);width:36px;text-align:right;opacity:.85}}:host-context(body.theme-w95) *{overscroll-behavior:none}
|
|
3
|
+
`,M=`.g2-zoom-ctrl{position:absolute;right:12px;bottom:12px;display:flex;flex-direction:column;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);overflow:hidden;z-index:3;box-shadow:var(--shadow-glass);& button{width:28px;height:28px;margin:0;padding:0;background:transparent;border:0;border-radius:0;color:var(--muted);border-bottom:1px solid var(--graph-divider);display:grid;place-items:center;font-family:inherit;font-size:13px;&:last-child{border-bottom:0}&:hover:not(:disabled){color:var(--accent);background:var(--surface-active)}&:disabled{opacity:.35}}}.g2-zoom-pct{font:500 9px/1 ui-monospace,monospace;color:var(--muted);padding:5px 0;text-align:center;border-bottom:1px solid var(--graph-divider)}.g2-zoom-ctrl .g2-zoom-fit-btn{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-weight:600;font-size:9px;line-height:1;letter-spacing:-.02em;text-transform:lowercase}
|
|
4
|
+
`,N=`.tree-count-chips{display:inline-flex;gap:.25rem;flex-wrap:wrap}.tree-count-chip{display:inline-block;font-size:.65rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;padding:.1rem .4rem;border-radius:3px;line-height:1.3;&.critical{background:var(--critical);color:#fff}&.high{background:var(--high);color:#fff}&.medium{background:var(--medium);color:#000}&.low{background:var(--low);color:var(--badge-low-text)}&.high_bug{background:var(--high-bug);color:#fff}&.bug{background:var(--bug);color:#fff}&.informational{background:var(--info);color:#fff}}
|
|
5
|
+
`,P=`.toolbar{display:flex;flex-direction:column;gap:.5rem;margin-bottom:1rem;padding:.6rem .75rem;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 10px);box-shadow:var(--shadow-glass);font-size:.825rem;& select{height:30px;box-sizing:border-box;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:var(--ui-radius, 4px);padding:.25rem .4rem;font-size:.8rem;&:focus{border-color:var(--accent);outline:none}}& select.sort-select{padding:.3rem 1.7rem .3rem .55rem;min-width:8.5rem;font-weight:500;appearance:none;-webkit-appearance:none;background:transparent}:is(revalidate-filter,findings-sort){position:relative;display:inline-block;&:after{content:"";position:absolute;right:.7rem;top:50%;width:.35rem;height:.35rem;border-right:1.5px solid var(--muted);border-bottom:1.5px solid var(--muted);transform:translateY(-70%) rotate(45deg);pointer-events:none}}& repo-filter{display:inline-block;min-width:0;max-width:100%}& analyzer-select{position:relative;display:inline-block}.analyzer-btn{display:inline-flex;align-items:center;gap:.45rem;height:30px;box-sizing:border-box;padding:.3rem .55rem;min-width:8.5rem;background:transparent;color:var(--text);border:1px solid var(--border);border-radius:var(--ui-radius, 4px);font-family:inherit;font-size:.8rem;font-weight:500;&:hover{border-color:var(--accent)}&:focus-visible{border-color:var(--accent);outline:none}&.active{color:var(--accent)}.analyzer-btn-label{flex:1;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:18rem}& svg{color:var(--muted);flex-shrink:0}}& range-slider{color:var(--accent);margin:0 .25rem}.conf-vals{color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;font-variant-numeric:tabular-nums;.dash{color:var(--muted);margin:0 .15rem}}& conf-filter{position:relative;display:inline-flex;align-items:center;height:30px;box-sizing:border-box;padding:0 .55rem;gap:.5rem;background:transparent;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);.conf-range-label{color:var(--muted);font-size:.7rem;font-weight:500;letter-spacing:.04em}& range-slider{margin:0}.conf-range{display:inline-flex;align-items:center;gap:.5rem}:is(.conf-range,.conf-range-label).replaced{visibility:hidden}:is(.conf-range,.conf-range-label).disabled{opacity:.35}& revalidate-filter{position:relative;display:inline-flex;align-items:center;flex:none;width:1.4rem;.sort-select{width:100%;border:0;height:auto;min-width:0;padding:0 .95rem 0 .2rem;font-size:.72rem;color:var(--muted);cursor:default;&:hover{color:var(--text)}}&:after{right:.25rem}&.replaces{position:static;.sort-select{position:absolute;inset:0 .55rem;width:auto;padding-left:0;color:var(--text)}&:after{right:.8rem}}.partial-cycle{position:absolute;right:1.75rem;top:50%;transform:translateY(-50%);z-index:1;padding:.1rem .3rem;border-radius:var(--ui-radius, 3px);font:inherit;font-size:.66rem;line-height:1.4;white-space:nowrap;cursor:default;--chip: var(--muted);color:var(--chip);border:1px solid rgb(from var(--chip) r g b / .45);background:rgb(from var(--chip) r g b / .1);&.included{--chip: var(--green)}&.excluded{--chip: var(--critical)}&.only{--chip: var(--yellow)}&:hover{background:rgb(from var(--chip) r g b / .22)}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px}}}}& input[type=text]{background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:var(--ui-radius, 4px);padding:.25rem .4rem;font-size:.8rem;flex:1;min-width:8rem;&:focus{border-color:var(--accent);outline:none}}.result-count{color:var(--muted);margin-left:auto}}.analyzer-menu[popover]{position:fixed;inset:auto;margin:0;align-items:stretch;gap:.35rem;padding:.3rem;background:var(--bg);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);box-shadow:0 4px 12px #00000040;font-size:.825rem;-webkit-app-region:no-drag;app-region:no-drag}.analyzer-menu[popover]:not(:popover-open){display:none}.analyzer-menu[popover]:popover-open{display:flex}.analyzer-menu-sep{border-left:1px solid var(--border)}.analyzer-menu-col{display:flex;flex-direction:column;gap:1px;min-width:9rem;max-height:60vh;overflow-y:auto}.analyzer-menu-head{padding:.25rem .5rem .2rem;color:var(--muted);font-size:.68rem;font-weight:600;letter-spacing:.05em;text-transform:uppercase}.analyzer-menu-item{display:flex;align-items:center;gap:.45rem;background:transparent;border:0;border-radius:var(--ui-radius, 3px);padding:.3rem .5rem;color:var(--text);text-align:left;font-family:inherit;font-size:.78rem;&:before{content:"";width:.8rem;flex-shrink:0}&.active:before{content:"\\2713";color:var(--accent)}&:hover{background:var(--surface)}&.zero{opacity:.45}.analyzer-menu-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:16rem}.analyzer-menu-count{color:var(--muted);font-size:.7rem;font-weight:600;font-variant-numeric:tabular-nums}}download-button{display:contents}.toolbar-export-btn{height:30px;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;padding:0 .55rem;background:transparent;color:var(--muted);border:1px solid var(--border);border-radius:var(--ui-radius, 4px);font-family:inherit;transition:background .12s,color .12s;&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}& svg{display:block}}triage-selector,slide-triage-tabs{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden}.toolbar triage-selector{margin-left:auto}.toolbar-end{display:flex;align-items:center;gap:.75rem;margin-left:auto;&:not(:has(.toolbar-export-btn,annotation-filter,revalidation-switch)){display:none}}revalidation-switch{display:inline-flex;align-items:center;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden}.revalidation-toggle{height:100%;&:has(+.revalidation-detail){border-right:1px solid var(--border)}}.revalidation-conflicts{padding:0 .6rem;background:transparent;border:none;color:var(--text);font:inherit;font-size:.78rem;cursor:default;&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}.revalidation-detail{display:inline-flex;align-items:center;justify-content:center;width:30px;height:100%;box-sizing:border-box;padding:0;background:transparent;border:none;color:var(--muted);cursor:default;transition:background .12s,color .12s,opacity .12s;&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .06)}&.on{color:var(--accent);background:var(--surface-active)}&:disabled{opacity:.4;cursor:default}&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}.revalidation-upstream{display:inline-flex;align-items:center;justify-content:center;width:30px;height:100%;box-sizing:border-box;padding:0;background:transparent;border:none;color:var(--muted);cursor:default;transition:background .12s,color .12s;&:not(:first-child){border-left:1px solid var(--border)}&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .06)}&.on{color:var(--accent);background:var(--surface-active)}&:disabled{opacity:.4;cursor:default}&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}triage-selector.is-empty{display:none}.triage-state-btn{background:transparent;border:none;color:var(--muted);padding:0 .55rem;display:inline-flex;align-items:center;gap:.35rem;transition:background .12s,color .12s;font-family:inherit;font-size:.8rem;cursor:default;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{background:var(--surface-active)}}.triage-state-btn.active.triage-state-deleted{color:var(--critical)}.triage-state-btn.active.triage-state-fixed{color:var(--green, #4ade80)}.triage-state-btn.active.triage-state-inprogress{color:var(--warning, #d97706)}.triage-state-btn.active.triage-state-invalid{color:var(--muted)}.triage-state-btn.active.triage-state-ignored{color:var(--accent, #2563eb)}entity-search{display:contents}view-mode-buttons{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden;.view-mode-btn{background:transparent;border:none;color:var(--muted);padding:.28rem .5rem;display:inline-flex;align-items:center;justify-content:center;transition:background .12s,color .12s;font-family:inherit;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{color:var(--accent);background:var(--surface-active)}& svg{display:block}}}:is(.revalidation-detail,.revalidation-upstream,.view-mode-btn){position:relative}:is(.revalidation-detail.on,.revalidation-upstream.on,.view-mode-btn.active,.g2-layout-tabs button[aria-pressed=true],.activity-views button[aria-pressed=true]):before{content:var(--selected-icon-ring-content, none);position:absolute;left:50%;top:50%;width:22px;height:22px;box-sizing:border-box;border:1px solid currentcolor;border-radius:50%;transform:translate(-50%,-50%);pointer-events:none}source-filter{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden;.source-chip{background:transparent;border:none;color:var(--muted);padding:0 .55rem;display:inline-flex;align-items:center;transition:background .12s,color .12s;font-family:inherit;font-size:.75rem;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{color:var(--accent);background:var(--surface-active)}}}severity-mode-switch{display:inline-flex;align-items:center;gap:.4rem;height:30px;box-sizing:border-box;.severity-mode-label{color:var(--muted);font-size:.7rem;font-weight:500;letter-spacing:.04em}.severity-mode-chips{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden}.severity-mode-chip{background:transparent;border:none;color:var(--muted);padding:0 .55rem;display:inline-flex;align-items:center;transition:background .12s,color .12s;font-family:inherit;font-size:.75rem;cursor:default;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{color:var(--accent);background:var(--surface-active)}}}annotation-filter{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden;.annotation-chip{position:relative;background:transparent;border:none;color:var(--muted);padding:0 .45rem;display:inline-flex;align-items:center;transition:background .12s,color .12s;cursor:default;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.sel-with,&.sel-without{color:var(--accent);background:var(--surface-active)}&.sel-with .flag-cloth{fill:var(--accent)}&.sel-without:after{content:"";position:absolute;left:18%;right:18%;top:50%;height:1.5px;background:currentcolor;border-radius:1px;transform:rotate(-20deg);transform-origin:center;pointer-events:none}& svg{display:block}}}.toolbar-row{display:flex;gap:.75rem;flex-wrap:wrap;align-items:center}.search-row{display:inline-flex;align-items:center;gap:.65rem;flex:1 1 14rem;min-width:12rem}toolbar-search,.toolbar-search{display:inline-flex;align-items:center;gap:.5rem;flex:1;min-width:0;height:30px;box-sizing:border-box;padding:0 .65rem;background:var(--bg);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);&:has(input:focus){border-color:var(--accent)}>svg{color:var(--muted);flex-shrink:0}&[kind] input[type=text],&.toolbar-search input[type=text]{flex:1;min-width:0;background:transparent;border:0;outline:none;color:var(--text);font:inherit;font-size:.8rem;padding:0;&:focus{border:0}&::placeholder{color:var(--muted)}&:focus::placeholder{color:transparent}&::-webkit-search-cancel-button{display:none}}}.search-negate-btn{flex-shrink:0;width:20px;height:20px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:var(--ui-radius, 3px);padding:0;transition:background .12s,color .12s;& svg{width:13px;height:13px}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .08)}&.active{color:var(--accent);background:rgb(from var(--text) r g b / .1)}}@media(width<=1200px){.toolbar-row.sev-row .search-row{flex-basis:100%}}severity-chips{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden}severity-chips>.sev-chip{display:inline-flex;align-items:center;gap:.35rem;background:transparent;border:0;padding:0 .4rem;color:var(--muted);font-family:inherit;font-size:.8rem;transition:background .12s,color .12s;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}.sd{width:8px;height:8px;border-radius:2px;flex-shrink:0;background:currentcolor}}:is(.sev-chip,.triage-state-btn,.team-slide-tab){.n{align-self:flex-start;margin:1px -5px 0;color:var(--muted);font-variant-numeric:tabular-nums;font-size:8.5px;font-weight:600;background:var(--bg);border-radius:999px;padding:0 3px;min-width:11px;text-align:center;line-height:11px}&.active .n{color:var(--text)}}.team-slide-tab .n{margin-top:calc(1px - .35rem)}severity-chips>button.sev-chip{&.active{color:var(--text)}&.critical .sd{background:var(--critical)}&.high .sd{background:var(--high)}&.medium .sd{background:var(--medium)}&.low .sd{background:var(--low)}&.high_bug .sd{background:var(--high-bug)}&.bug .sd{background:var(--bug)}&.informational .sd{background:var(--info)}&.critical.active{background:rgb(from var(--critical) r g b / .25)}&.high.active{background:rgb(from var(--high) r g b / .25)}&.medium.active{background:rgb(from var(--medium) r g b / .25)}&.low.active{background:rgb(from var(--low) r g b / .25)}&.high_bug.active{background:rgb(from var(--high-bug) r g b / .25)}&.bug.active{background:rgb(from var(--bug) r g b / .25)}&.informational.active{background:rgb(from var(--info) r g b / .25)}}triage-filter{display:inline-flex;align-items:center;background:var(--surface);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);padding:3px;height:30px;gap:1px;& button{width:22px;height:22px;background:transparent;border:0;border-radius:var(--ui-radius, 4px);padding:0;display:grid;place-items:center;position:relative;transition:background .12s;&:hover{background:rgb(from var(--text) r g b / .06)}&.active{background:rgb(from var(--text) r g b / .08);box-shadow:0 0 0 1px var(--border)}}.td{width:12px;height:12px;border-radius:50%;border:1.5px solid currentcolor;background:transparent;transition:background .12s}& button.active .td{background:currentcolor}.td.none{border-style:dashed;color:var(--muted)}.td.r{color:#fc5855}.td.b{color:#30aff8}.td.g{color:#68c36d}.td.x{color:#6e7278}.count{position:absolute;top:-2px;right:-2px;background:var(--bg);color:var(--muted);font-size:8.5px;font-weight:600;border-radius:999px;padding:0 3px;min-width:11px;text-align:center;line-height:11px;font-variant-numeric:tabular-nums}}
|
|
6
|
+
`;function F(e){let t=new Map;for(let n=0;n<e.length;n++){let r=e[n];t.has(r.a)||t.set(r.a,[]),t.has(r.b)||t.set(r.b,[]),t.get(r.a).push(n),t.get(r.b).push(n)}return t}function I(e){if(!e)return null;for(let t of b)if((e[t]??0)>0)return t;return null}function L(e,t,r,i,a,o,s,c={}){let l=c.pkgOf??n,d=new Set(t),f=new Map,p=new Map;for(let n of t){let t=(e[n].imports??[]).filter(e=>d.has(e));f.set(n,t);for(let e of t)p.has(e)||p.set(e,[]),p.get(e).push(n)}let m=t.map(t=>{let n=r.get(t),d=i?.get(t)??null,f=u(n),p=l(t)??`__own__`,m=I(n);return{id:t,file:t,pkg:p,packageInfo:c.packageInfoOf?.(t),x:0,y:0,deg:0,issue:m,totalIssues:f,own:n,subtree:d,size:typeof e[t]?.size==`number`?e[t].size:null,severitySet:a?.get(t)??null,colorSet:o?.get(t)??null,findings:s?.get(t)??null,isHub:!1,label:t.split(`/`).pop()??t}}),h=new Map(m.map(e=>[e.file,e])),g=new Map;for(let e of t)for(let t of f.get(e)??[]){let[n,r]=e<t?[e,t]:[t,e],i=`${n}\0${r}`,a=g.get(i);if(!a){let e=h.get(n),t=h.get(r);if(!e||!t)continue;a={a:n,b:r,cross:e.pkg!==t.pkg,fromLo:!1,fromHi:!1},g.set(i,a),e.deg++,t.deg++}e===n?a.fromLo=!0:a.fromHi=!0}let _=[...g.values()],v=F(_),y=new Map;for(let e of m)y.set(e.pkg,(y.get(e.pkg)??0)+1);let b=[...y.entries()].toSorted((e,t)=>t[1]-e[1]).map(([e])=>e),x=new Map;for(let e of m)x.has(e.pkg)||x.set(e.pkg,[]),x.get(e.pkg).push(e);let S={files:t,nodes:m,nodeByFile:h,edges:_,adj:v,importsOf:f,importedBy:p,packages:b,pkgCount:y,byPkg:x};return R(S),S}function R(e){for(let t of e.nodes)t.isHub=!1;for(let t of e.edges)t.cross&&(t.fromLo&&(e.nodeByFile.get(t.b).isHub=!0),t.fromHi&&(e.nodeByFile.get(t.a).isHub=!0));for(let t of e.nodes){let n=e.importedBy.get(t.file);(!n||n.length===0)&&(t.isHub=!0)}}function ee(e){let t=e.packages.map(t=>{let n=e.byPkg.get(t)??[],r={};for(let e of b)r[e]=0;let i=new Set,a=new Set,o=[],s=0,c=0,l=!1;for(let e of n){if(s+=e.totalIssues,e.own)for(let t of b)r[t]+=e.own[t]??0;if(e.severitySet)for(let t of e.severitySet)i.add(t);if(e.colorSet)for(let t of e.colorSet)a.add(t);typeof e.size==`number`&&(c+=e.size,l=!0),o.push(e.file)}return{file:t,pkg:t,label:z(t),fileCount:n.length,size:l?c:null,own:r,totalIssues:s,issue:I(r),severitySet:i.size>0?i:null,colorSet:a.size>0?a:null,pathText:o.join(`
|
|
7
|
+
`).toLowerCase(),isHub:!0,x:0,y:0,deg:0}}),n=new Map(t.map(e=>[e.pkg,e])),r=new Map;for(let t of e.edges){if(!t.cross)continue;let i=e.nodeByFile.get(t.a)?.pkg,a=e.nodeByFile.get(t.b)?.pkg;if(!i||!a||i===a)continue;let[o,s]=i<a?[i,a]:[a,i],c=`${o}\0${s}`,l=r.get(c);l||(l={a:o,b:s,cross:!0,count:0,fromLo:!1,fromHi:!1},r.set(c,l),n.get(o).deg++,n.get(s).deg++),l.count++;let u=i===o;t.fromLo&&(u?l.fromLo=!0:l.fromHi=!0),t.fromHi&&(u?l.fromHi=!0:l.fromLo=!0)}let i=[...r.values()],a=F(i),o=new Map(t.map(e=>[e.pkg,[]]));for(let e of i)e.fromLo&&o.get(e.a).push(e.b),e.fromHi&&o.get(e.b).push(e.a);return{nodes:t,byPkg:n,nodeByFile:n,edges:i,adj:a,importsOf:o,ownSourcePackages:e.ownSourcePackages,entryPackages:e.entryPackages}}function te(e,t){if(t.size===0)return e;let n=e.nodes.filter(e=>!t.has(e.pkg)),r=new Map(n.map(e=>[e.file,e])),i=e=>r.has(e),a=e.edges.filter(e=>i(e.a)&&i(e.b)),o=e=>new Map([...e].filter(([e])=>i(e)).map(([e,t])=>[e,t.filter(i)])),s=e.packages.filter(e=>!t.has(e));return{...e,files:e.files.filter(i),nodes:n,nodeByFile:r,edges:a,adj:F(a),importsOf:o(e.importsOf),importedBy:o(e.importedBy),packages:s,pkgCount:new Map(s.map(t=>[t,e.pkgCount.get(t)])),byPkg:new Map(s.map(t=>[t,e.byPkg.get(t)]))}}function z(e){return _(e)}var B={links:`imports`,cellLinks:`file imports`,link:`Import`,linked:`imports`,members:`files`,mostImported:`Most imported`,outgoing:`Imports`,incoming:`Imported by`,importers:`importers`,cellHeading:`File imports`},V={links:`dependencies`,cellLinks:`dependencies`,link:`Dependency`,linked:`depends on`,members:`versions`,mostImported:`Most depended on`,outgoing:`Dependencies`,incoming:`Dependents`,importers:`dependents`,cellHeading:`Copies`},ne=e=>e.packagesOnly?V:B;function re(e,t){let n=new Set;for(let r of e.byPkg.get(t)??[])r.packageInfo?.version!==void 0&&n.add(r.packageInfo.version);return[...n].toSorted((e,t)=>e.localeCompare(t,`en`,{numeric:!0}))}function ie(e,t){if(!t||t===`/`||t===`__own__`)return e;for(let n of[`node_modules`,`dependencies`,m()]){let r=n+`/`+t+`/`,i=e.indexOf(r);if(i>=0)return e.slice(i+r.length)}return e.startsWith(t+`/`)?e.slice(t.length+1):e}var H=new Set([`@babel/runtime`,`minimalistic-assert`,`react`,`reselect`]),ae=300,oe=100;function U(e,t){return new Set([...e].filter(([,e])=>e>t).map(([e])=>e))}function W(e,t){let n=new Map;for(let[t,r]of e)t!==r&&H.has(r)&&n.set(r,(n.get(r)??0)+1);return U(n,t)}function se(e,t){let n=new Map,r=(t,r)=>{let i=e.nodeByFile.get(r)?.pkg;e.nodeByFile.get(t)?.pkg!==i&&H.has(i)&&n.set(i,(n.get(i)??0)+1)};for(let t of e.edges)t.fromLo&&r(t.a,t.b),t.fromHi&&r(t.b,t.a);return U(n,t)}var ce=new WeakMap,le=new WeakMap;function ue(e,t){return!e.packagesOnly&&e.nodes.length<=100&&!t}function de(e,t,n){let r=W([...e.importsOf].flatMap(([e,t])=>t.map(t=>[n(e),n(t)])),t);if(r.size===0)return e;let i=e=>!r.has(n(e)),a=e.nodes.filter(e=>i(e.file));return{...e,nodes:a,nodeByFile:new Map(a.map(e=>[e.file,e])),importsOf:new Map([...e.importsOf].filter(([e])=>i(e)).map(([e,t])=>[e,t.filter(i)])),cycleImportsOf:new Map([...e.cycleImportsOf].filter(([e])=>i(e)).map(([e,t])=>[e,new Set([...t].filter(i))]))}}function fe(e,t){if(!ue(e,t))return pe(e);if(le.has(e))return le.get(e);let n=new Map(e.nodes.map(t=>[t.file,[...new Set(e.importsOf.get(t.file)??[])]])),r=de({...e,importsOf:n,cycleImportsOf:f(e),fileLevel:!0},ae,t=>e.nodeByFile.get(t)?.pkg);r.directedEdges=[];for(let[e,t]of r.importsOf)for(let n of t)r.directedEdges.push({from:e,to:n});return le.set(e,r),r}function pe(e){if(ce.has(e))return ce.get(e);let t=ee(e);if(t.cycleImportsOf=f(e,e=>e.pkg),e.layerRoots?.appImports?.length>0){if(!t.byPkg.has(`__own__`)){let e={file:`__own__`,pkg:`__own__`,label:`own source`,fileCount:0,size:null,totalIssues:0,deg:0,x:0,y:0};t.nodes.push(e),t.byPkg.set(e.pkg,e)}t.importsOf.set(`__own__`,[...new Set([...t.importsOf.get(`__own__`)??[],...e.layerRoots.appImports])].filter(e=>e!==`__own__`&&t.byPkg.has(e))),t.cycleImportsOf.set(`__own__`,new Set([...t.cycleImportsOf.get(`__own__`)??[],...e.layerRoots.appImports].filter(e=>e!==`__own__`&&t.byPkg.has(e))))}t=de(t,oe,e=>e),t.byPkg=t.nodeByFile,t.importedBy=new Map(t.nodes.map(e=>[e.pkg,[]])),t.directedEdges=[];for(let[e,n]of t.importsOf)for(let r of n)t.importedBy.get(r).push(e),t.directedEdges.push({from:e,to:r});for(let e of t.nodes)e.deg=(t.importsOf.get(e.pkg)?.length??0)+t.importedBy.get(e.pkg).length;return ce.set(e,t),t}var me=[[`graph`,`Graph`,x(S)],[`layers`,`Layers`,x(C)],[`matrix`,`Matrix`,x(w)],[`dependencies`,`Dependencies`,x(T)],[`flow`,`Size flow`,D`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 3h18M3 10h7m4 0h7M3 20h6m3 0h9M5 3v7m13-7v7M6 10c0 5 10 5 10 10m2-10c0 5-12 5-12 10"/></svg>`]];function he(e,t,n=null,r={}){let a=t.showBundleLayouts&&i.bundleLayout===`layers`,o=t.showBundleLayouts&&i.bundleLayout===`matrix`,s=t.showBundleLayouts&&i.bundleLayout===`dependencies`,c=t.showBundleLayouts&&i.bundleLayout===`flow`,l=a?`layers`:o?`matrix`:s?`dependencies`:c?`flow`:`graph`,u=t.showBundleLayouts?D`<div class="g2-layout-tabs" role="group" aria-label="Bundle layout">${me.filter(([e])=>t.layouts?.includes(e)??!0).map(([e,t,n])=>D`<button type="button" data-g2-layout="${e}" aria-label="${t}" aria-pressed="${String(e===l)}">${n}</button>`)}</div>`:null,d=t.extraTopRow,f=t.hideAllFiles??!1,p=t.triageCounts??{inprogress:0,fixed:0,invalid:0,deleted:0,ignored:0},m=t.triageStates??[`inprogress`,`fixed`,`invalid`,`deleted`,`ignored`],h={};for(let e of b)h[e]=0;for(let t of e.nodes)if(t.severitySet)for(let e of t.severitySet)h[e]!==void 0&&h[e]++;let g=b.some(e=>h[e]>0||i.selectedSeverities.has(e)),_=[`none`,`red`,`blue`,`green`,`gray`],v={none:0,red:0,blue:0,green:0,gray:0};for(let t of e.nodes)if(t.colorSet)for(let e of t.colorSet)v[e]!==void 0&&v[e]++;let y=_.some(e=>v[e]>0||i.selectedColors.has(e)),x=D`<triage-selector variant="graph" .counts="${p}" .states="${m}"></triage-selector>`,S=f?null:D`<mode-switch label="All files" .checked="${i.showAll}" data-g2-show-all></mode-switch>`,C=!e.packagesOnly&&(c||(s?e.nodes.length<=100:!a&&!o&&(t.showPackagesView??!1)))?D`<mode-switch label="Packages" .checked="${c?i.flowPackagesView:s?i.dependencyPackagesView:i.packagesView}" data-g2-packages-view></mode-switch>`:null,w=e.reasons?.length>0?D`<bundle-scope-selector class="g2-reason-scope" .reasons="${e.reasons.map(e=>({id:`reason:${e}`,label:e}))}" .value="${i.bundleReason?`reason:${i.bundleReason}`:``}" label="Filter files" @scope-change="${e=>e.currentTarget.dispatchEvent(new CustomEvent(`bundle-graph-reason-change`,{detail:{reason:e.detail.value.replace(/^reason:/u,``)||null},bubbles:!0,composed:!0}))}"></bundle-scope-selector>`:null,T=g?D`<severity-chips .counts="${h}" .selected="${[...i.selectedSeverities]}" kind="graph"></severity-chips>`:null,E=y?D`<triage-filter .counts="${v}" .selected="${[...i.selectedColors]}" kind="graph"></triage-filter>`:null,O=D`<div class="toolbar-search g2-path-filter-wrap"><svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg> <input type="text" class="g2-path-filter" id="g2-path-filter" placeholder="filter path/package…" .value="${i.pathFilter}"> <button type="button" class="g2-path-filter-clear" id="g2-path-filter-clear" aria-label="Clear filter">✕</button></div>`,k=D`<button type="button" class="g2-icon-btn" id="g2-fullscreen" aria-label="Toggle fullscreen">⛶</button>`;if(t.showBundleLayouts){let e=(t.hasIssues??!1)&&i.bundleIssues,a=t.hasIssues?D`<mode-switch class="g2-issues-switch" label="Issues" .checked="${i.bundleIssues}" data-g2-bundle-issues></mode-switch>`:null,o=a&&r.issuesWrapped;return D`<div class="graph2-topbar"><div class="graph2-topbar-row graph2-topbar-row-main graph2-topbar-row-pinned toolbar-row"><div class="g2-topbar-controls">${u} ${O} ${C} ${n} ${w} ${o?null:a}</div>${k}</div>${e||o?D`<div class="graph2-topbar-row graph2-topbar-row-issues toolbar-row sev-row">${o?a:null} ${e?D`${T}${E}${x}`:null}</div>`:null}</div>`}return D`<div class="graph2-topbar">${d?D`<div class="graph2-topbar-row graph2-topbar-row-extra toolbar-row">${d} ${S} ${C}<div class="g2-spacer"></div>${x}</div>`:null}<div class="graph2-topbar-row graph2-topbar-row-main toolbar-row sev-row">${u} ${w} ${T} ${E} ${O} ${d?null:S} ${d?null:C} ${n}<div class="g2-spacer"></div>${d?null:x} ${k}</div></div>`}function ge(e,t){let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;let a=n.length-i,o=r.slice(i).join(`/`);return a===0?`./`+o:`../`.repeat(a)+o}function G(e,t){if(!t&&t!==``)return e;let n=ge(t,e);return n.length<e.length?n:e}function _e(e,t,n,i){let a=n.length;if(a===0)return D`<div class="g2-sel-section"><div class="g2-sel-section-label">${t} (${a})</div><div class="g2-sel-section-empty">none</div></div>`;let o=n.map(e=>({file:e,display:G(e,i)}));return o.sort((e,t)=>e.display.localeCompare(t.display)),D`<div class="g2-sel-section"><div class="g2-sel-section-label">${t} (${a})</div><ul class="g2-sel-file-list">${o.map(({file:t,display:n})=>{let i=e.nodeByFile.get(t),a=i?r(i.pkg):`#666`;return D`<li><button type="button" class="g2-sel-file-link" data-g2-select="${t}"><span class="g2-sel-file-dot" style="${v({background:a})}"></span> <span class="g2-sel-file-path" data-tooltip-truncated data-tooltip="${t}">${n}</span></button></li>`})}</ul></div>`}function ve(e){if(!e)return D`<div class="g2-sel-section-empty">none</div>`;let t=[`critical`,`high`,`medium`,`low`,`high_bug`,`bug`,`informational`].filter(t=>(e[t]??0)>0);return t.length===0?D`<div class="g2-sel-section-empty">none</div>`:D`<div class="tree-count-chips">${t.map(t=>D`<span class="${`tree-count-chip ${t}`}">${e[t]} ${t.replaceAll(`_`,` `)}</span>`)}</div>`}function K(e){let t=0;for(let n of e.edges)n.cross&&t++;let n=e.edges.length-t,r=0;for(let t of e.nodes)r+=t.totalIssues;let a=e.supportsLayers&&(e.packagesOnly||i.bundleLayout===`dependencies`)&&!i.focusedPkg?fe(e,i.dependencyPackagesView):null,o=a?.nodes.length??e.nodes.length,s=a?.directedEdges.length??e.edges.length,c=o===0?`0.0`:(s*2/o).toFixed(1),l=z(i.focusedPkg);return D`<main class="graph2-stage"><canvas id="g2-canvas"></canvas>${i.focusedPkg?D`<div class="g2-stage-overlay"><button type="button" class="g2-back-btn" id="g2-back-to-full">← ${l}</button></div>`:null}<div id="g2-focus-overlay-slot" class="g2-stage-overlay-tr"></div><div class="g2-stage-stats">${!a||a.fileLevel?D`<span><b>${e.nodes.length}</b> files</span>`:null} <span><b>${a&&!a.fileLevel?a.nodes.length:e.packages.length}</b> packages</span> <span><b>${s}</b> ${a?`dependencies`:D`edges (${n} intra · ${t} cross)`}</span> ${e.issuesHidden?null:D`<span><b>${r}</b> issues</span>`} <span>avg degree <b>${c}</b></span></div><div class="g2-zoom-ctrl"><button id="g2-zoom-in" aria-label="Zoom in">+</button><div class="g2-zoom-pct" id="g2-zoom-pct">100%</div><button id="g2-zoom-out" aria-label="Zoom out">−</button> <button id="g2-zoom-fit" class="g2-zoom-fit-btn" aria-label="Fit to view">fit</button></div><div class="g2-tooltip" id="g2-tooltip"></div></main>`}function ye(e){if(e.packagesOnly||e.supportsLayers&&i.bundleLayout===`dependencies`)return null;let t=null;if(i.selected){let n=e.nodeByFile.get(i.selected);n&&(t=n.pkg)}else i.solo&&(t=i.solo);if(!t||(e.pkgCount.get(t)??0)<=1||i.focusedPkg===t)return null;let n=z(t);return D`<button type="button" class="g2-focus-pkg-btn" data-g2-focus-pkg="${t}" aria-label="${`Focus on ${n}'s graph`}" data-tooltip="${`Focus on ${n}'s graph`}"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M8 4.6 L4 11 M8 4.6 L12 11 M5 11.4 L11 11.4" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/><circle cx="8" cy="3.6" r="2" fill="currentColor"/><circle cx="3.6" cy="11.4" r="2" fill="currentColor"/><circle cx="12.4" cy="11.4" r="2" fill="currentColor"/></svg></button>`}function be(){return D`<aside class="graph2-right"><div class="g2-panel-title">Selection</div><div id="g2-selection-area"></div><div id="g2-top-pkgs-block"></div></aside>`}function xe(e){if(Te(e)){let t=pe(e),n=t.nodes.toSorted((e,n)=>t.importedBy.get(n.pkg).length-t.importedBy.get(e.pkg).length||e.pkg.localeCompare(n.pkg)).map(e=>e.pkg);return D`<div class="g2-panel-title">Packages · ${ne(e).importers}</div>${Ee(t,n,!0)}`}let t=i.showAll&&e.nodes.length>0&&e.nodes.every(e=>typeof e.size==`number`),n=e.nodes.some(e=>e.totalIssues>0),r=i.topPkgsTab;return r===`size`&&!t&&(r=`files`),r===`issues`&&!n&&(r=`files`),D`<div class="g2-panel-title g2-panel-title-row"><span>Packages</span><div class="g2-mini-tabs">${n?D`<button type="button" class="${o({"g2-mini-tab":!0,on:r===`issues`})}" data-g2-top-pkgs="issues">Issues</button>`:null} <button type="button" class="${o({"g2-mini-tab":!0,on:r===`files`})}" data-g2-top-pkgs="files">Files</button> ${t?D`<button type="button" class="${o({"g2-mini-tab":!0,on:r===`size`})}" data-g2-top-pkgs="size">Size</button>`:null}</div></div>${we(e,r)}`}function q(e,t={}){if(Te(e))return J(e,pe(e),i.solo);let n=i.selected;if(n){let r=e.nodeByFile.get(n);return r?Se(e,r,n,t):D`<div class="g2-empty-state"><strong>File not in current view</strong>Adjust filters or pick another file.</div>`}return i.solo?i.solo===`__own__`&&!e.pkgCount.has(`__own__`)&&e.layerRoots?.appImports.length>0?D`<div class="g2-empty-state"><strong>App</strong>App source is not included in this view. Connections come from its recorded imports.</div>`:Ce(e,i.solo):D`<div class="g2-empty-state">Click a node or a package row to inspect.</div>`}function Se(e,n,i,a){let o=r(n.pkg),s=z(n.pkg),c=ie(i,n.pkg),l=e.importedBy.get(i)??[],u=e.importsOf.get(i)??[],d=i.lastIndexOf(`/`),f=d>=0?i.slice(0,d):``;return D`<div class="g2-selection-card"><div class="g2-sel-file-head"><div class="g2-sel-path">${c}</div><div class="g2-sel-pkg-row"><span class="g2-sel-dot" style="${v({"--dot":o,background:o})}"></span> <span class="g2-sel-pkg">${s}</span></div></div><div class="g2-sel-fullpath" data-tooltip-truncated data-tooltip="${i}">${i}</div>${t(n.size)?D`<div class="g2-sel-size">${t(n.size)}</div>`:null}<div class="g2-sel-section"><div class="g2-sel-section-label">Own findings</div>${ve(n.own)}</div><div class="g2-sel-section"><div class="g2-sel-section-label">Subtree findings</div>${ve(n.subtree)}</div><div class="g2-sel-jumps">${n.totalIssues>0&&a.findingsJump!==!1?D`<button type="button" class="g2-sel-jump" data-g2-jump-findings="${i}">Findings →</button>`:null} ${a.isBundleContext?n.origFile?D`<button type="button" class="g2-sel-jump" data-bundle-view-source="${n.origFile}">View source →</button>`:null:D`<button type="button" class="g2-sel-jump" data-g2-jump-file="${i}">Files →</button>`}</div>${_e(e,`Imported by`,l,f)} ${_e(e,`Imports`,u,f)}</div>`}function Ce(e,t){let n=e.nodes.filter(e=>e.pkg===t),i=n.length;if(i===0)return D`<div class="g2-empty-state"><strong>Package has no files in view</strong> Toggle "All files" to widen the file set, or pick another package.</div>`;let a=r(t),o=z(t),s={};for(let e of b)s[e]=0;for(let e of n)if(e.own)for(let t of b)s[t]+=e.own[t]??0;let c=0,l=0;for(let n of e.edges){let r=e.nodeByFile.get(n.a),i=e.nodeByFile.get(n.b);!r||!i||(r.pkg===t&&i.pkg===t?l++:(r.pkg===t||i.pkg===t)&&c++)}let u=0;for(let e of n)e.isHub&&u++;let d=new Set;for(let r of n)for(let n of e.importedBy.get(r.file)??[]){let r=e.nodeByFile.get(n);r&&r.pkg!==t&&d.add(n)}return D`<div class="g2-selection-card"><div class="g2-sel-head"><span class="g2-sel-dot" style="${v({"--dot":a,background:a})}"></span> <span class="g2-sel-id">${o}</span> <span class="g2-sel-grp">package</span></div><div class="g2-sel-body"><div class="g2-sel-row"><span class="k">Files</span><span class="v">${i}</span></div><div class="g2-sel-row"><span class="k">Hubs</span><span class="v">${u}</span></div><div class="g2-sel-row"><span class="k">Intra edges</span><span class="v">${l}</span></div><div class="g2-sel-row"><span class="k">Cross edges</span><span class="v">${c}</span></div></div><div class="g2-sel-section"><div class="g2-sel-section-label">Findings</div>${ve(s)}</div>${_e(e,`Imported by`,[...d])}</div>`}function we(e,n){let a=e.nodes.length||1,s=n??i.topPkgsTab,c=i.selectedSeverities,l=i.selectedColors,u=!e.issuesHidden&&c.size>0,d=!e.issuesHidden&&l.size>0,f=u||d,p=new Map,m=new Map,h=0,g=0;for(let t of e.nodes){let e;if(f){if(e=0,t.findings)for(let n of t.findings)u&&!c.has(n.severity)||d&&!l.has(n.color)||e++}else e=t.totalIssues;p.set(t.pkg,(p.get(t.pkg)??0)+e),h+=e,typeof t.size==`number`&&(m.set(t.pkg,(m.get(t.pkg)??0)+t.size),g+=t.size)}let _;_=s===`issues`?e.packages.filter(e=>(p.get(e)??0)>0).toSorted((t,n)=>{let r=p.get(t)??0,i=p.get(n)??0;return i===r?(e.pkgCount.get(n)??0)-(e.pkgCount.get(t)??0):i-r}):s===`size`?e.packages.filter(e=>(m.get(e)??0)>0).toSorted((t,n)=>{let r=m.get(t)??0,i=m.get(n)??0;return i===r?(e.pkgCount.get(n)??0)-(e.pkgCount.get(t)??0):i-r}):[...e.packages].toSorted((t,n)=>{let r=e.pkgCount.get(t)??0,i=e.pkgCount.get(n)??0;return i===r?(p.get(n)??0)-(p.get(t)??0):i-r});let b=t=>s===`issues`?h>0?((p.get(t)??0)/h*100).toFixed(2):`0`:s===`size`?g>0?((m.get(t)??0)/g*100).toFixed(2):`0`:(e.pkgCount.get(t)/a*100).toFixed(2),x=s===`issues`?`No packages with issues`:s===`size`?`No packages with size`:`No packages`;return D`<div class="g2-dist-bar">${e.packages.map(e=>{let t=r(e);return D`<span style="${v({background:t,width:`${b(e)}%`})}"></span>`})}</div><div class="g2-dist-list">${_.length===0?D`<div class="g2-dist-empty">${x}</div>`:null} ${y(_,e=>e,n=>{let c=r(n),l=e.pkgCount.get(n)??0,u=p.get(n)??0,d=m.get(n)??0,f=s===`issues`?u:s===`size`?t(d):l,_=s===`issues`?h>0?(u/h*100).toFixed(1):`0.0`:s===`size`?g>0?(d/g*100).toFixed(1):`0.0`:(l/a*100).toFixed(1),y=z(n),b=i.solo===n;return D`<button type="button" class="${o({"g2-dist-item":!0,on:b})}" data-g2-pkg="${n}"><span class="g2-dist-dot" style="${v({background:c})}"></span><span class="g2-dist-name" data-tooltip-truncated data-tooltip="${y}">${y}</span><span class="g2-dist-count">${f}</span><span class="g2-dist-pct">${_}%</span></button>`})}</div>`}function Te(e){return(e.packagesOnly||e.supportsLayers&&i.bundleLayout===`dependencies`&&!i.focusedPkg)&&!ue(e,i.dependencyPackagesView)}function Ee(e,t,n=!1){return D`<div class="g2-dist-list">${y(t,e=>e,t=>D`<button type="button" class="${o({"g2-dist-item":!0,on:i.solo===t})}" data-g2-pkg="${t}"><span class="g2-dist-dot" style="${v({background:r(t)})}"></span> <span class="g2-dist-name">${z(t)}</span> ${n?D`<span class="g2-dist-count">${e.importedBy.get(t).length}</span>`:null}</button>`)}</div>`}function J(e,t,n){let i=t.byPkg.get(n),a=ne(e);if(!i)return D`<div class="g2-empty-state">Select a package to trace its ${a.links}.</div>`;let o=t.importedBy.get(n)??[],s=t.importsOf.get(n)??[],c=e.packagesOnly?re(e,n):[];return D`<div class="g2-selection-card"><div class="g2-sel-head"><span class="g2-sel-dot" style="${v({background:r(n)})}"></span> <span class="g2-sel-id">${i.label}</span></div>${i.totalIssues?D`<div class="g2-sel-section">${ve(i.own)}</div>`:null} ${c.length>0?D`<div class="g2-sel-section"><div class="g2-sel-section-label">${c.length===1?`Version`:`Versions (${c.length})`}</div><div class="g2-sel-versions">${c.join(`, `)}</div></div>`:null}<div class="g2-sel-section"><div class="g2-sel-section-label">${a.incoming} (${o.length})</div>${Ee(t,o.toSorted())}</div><div class="g2-sel-section"><div class="g2-sel-section-label">Dependencies (${s.length})</div>${Ee(t,s.toSorted())}</div></div>`}function De(e,t,n){return Math.min(24,Math.max(1,t-196-12)/Math.max(1,e),Math.max(1,n-118-12)/Math.max(1,e))}function Oe(e,t,n,r){return Math.max(Math.min(18,De(t,n,r)),Math.min(27,e))}function ke(e,t,n,r){let i=Math.floor((e-196+r.x)/r.cell),a=Math.floor((t-118+r.y)/r.cell);return e<196&&t>=118&&a>=0&&a<n.rows.length?{row:a,col:null}:t<118&&e>=196&&i>=0&&i<n.rows.length?{row:i,col:null}:e>=196&&t>=118&&a>=0&&i>=0&&a<n.rows.length&&i<n.rows.length?{row:a,col:i}:null}function Ae(e){if(!e.file)return e.label;let t=`node_modules/${e.pkg}/`;return e.file.includes(t)?e.file.slice(e.file.indexOf(t)+t.length):e.file}function je(e,t,n,{width:r,height:i,theme:a,colorOf:o,hover:s,selected:c,dimmed:l,rows:u=`importers`}){let{cell:d,x:f,y:p}=n,{rows:m}=t,h=e=>196+e*d-f,g=e=>118+e*d-p,_=Math.max(0,Math.floor(p/d)),v=Math.min(m.length,Math.ceil((i-118+p)/d)),y=Math.max(0,Math.floor(f/d)),b=Math.min(m.length,Math.ceil((r-196+f)/d)),x=s??c;e.clearRect(0,0,r,i),e.fillStyle=a.bg,e.fillRect(0,0,r,i),e.save(),e.beginPath(),e.rect(196,118,r-196,i-118),e.clip();let S=[];for(let e=0;e<m.length;e++){let t=S.at(-1),n=m[e];t&&t.component===n.component?t.end=e+1:S.push({component:n.component,start:e,end:e+1,cyclic:n.cyclic})}for(let t of S)t.cyclic&&(e.strokeStyle=a.cycle+`85`,e.lineWidth=1,e.strokeRect(h(t.start),g(t.start),(t.end-t.start)*d,(t.end-t.start)*d));if(x&&(e.fillStyle=a.highlight,e.fillRect(196,g(x.row),r-196,d),e.fillRect(h(x.col??x.row),118,d,i-118)),e.strokeStyle=a.grid,e.lineWidth=1,d>=9){e.beginPath();for(let t=_;t<=v;t++)e.moveTo(196,g(t)+.5),e.lineTo(r,g(t)+.5);for(let t=y;t<=b;t++)e.moveTo(h(t)+.5,118),e.lineTo(h(t)+.5,i);e.stroke()}let C=t.visibleCells.reduce((e,t)=>Math.max(e,t.count),1),w=d>=8?2:.25;for(let n of t.visibleCells)n.row<_||n.row>=v||n.col<y||n.col>=b||(e.globalAlpha=l(m[n.row])&&l(m[n.col])?.12:.35+.65*Math.log1p(n.count)/Math.log1p(C),e.fillStyle=n.cyclic&&d<10?a.cycle:o(m[n.row].pkg),e.fillRect(h(n.col)+w,g(n.row)+w,Math.max(1,d-2*w),Math.max(1,d-2*w)),n.cyclic&&n.from!==n.to&&d>=10&&(e.fillStyle=a.cycle,e.fillRect(h(n.col)+d-5,g(n.row)+2,3,3)));e.globalAlpha=1,c&&(e.strokeStyle=a.text,e.lineWidth=2,c.col===null?e.strokeRect(197,g(c.row)+1,r-196-2,d-2):e.strokeRect(h(c.col)+1,g(c.row)+1,d-2,d-2)),e.restore(),e.fillStyle=a.surface,e.fillRect(0,0,r,118),e.fillRect(0,0,196,i),e.font=`11px ui-monospace, monospace`,e.textBaseline=`middle`;let T=Math.max(1,Math.ceil(14/d));for(let n=_;n<v;n++){if(n%T&&n!==x?.row)continue;e.save(),e.beginPath(),e.rect(5,111,186,i-118+7),e.clip();let r=g(n)+d/2;n===x?.row&&(e.fillStyle=a.highlight,e.fillRect(0,g(n),196,Math.max(d,14))),e.fillStyle=o(m[n].pkg),e.fillRect(8,r-3,5,6),e.fillStyle=n===x?.row||t.matches.size<t.totalRows&&t.matches.has(m[n].id)?a.text:a.muted,e.fillText(`${m[n].file?` `:``}${Ae(m[n])}`,20,r),e.restore()}let E=Math.max(1,Math.ceil(17/d));for(let t=y;t<b;t++)t%E&&t!==(x?.col??x?.row)||(e.save(),e.beginPath(),e.rect(189,22,r-196+7,96),e.clip(),e.translate(h(t)+d/2,108),e.rotate(-Math.PI/4),e.fillStyle=t===(x?.col??x?.row)?a.text:a.muted,e.fillText(Ae(m[t]),0,0,115),e.restore(),e.fillStyle=o(m[t].pkg),e.fillRect(h(t)+1,114,Math.max(1,d-2),3));e.fillStyle=a.muted,e.font=`10px ui-monospace, monospace`,e.fillText(`${u.toUpperCase()} \u2193`,14,104),e.fillText(`DEPENDENCIES →`,204,12),e.strokeStyle=a.border,e.beginPath(),e.moveTo(195.5,118),e.lineTo(195.5,i),e.moveTo(196,117.5),e.lineTo(r,117.5),e.stroke(),m.length===0&&(e.fillStyle=a.muted,e.fillText(`No matching dependencies`,216,148))}var Y=e=>e.toLocaleString(`en-US`);function Me(e,t,n){return D`<button class="g2-dist-item matrix-row-link" @click="${()=>n(e.id)}"><span class="g2-dist-dot" style="${v({background:r(e.pkg)})}"></span><span class="g2-dist-name" data-tooltip-truncated data-tooltip="${e.label}">${e.label}</span><span class="g2-dist-count">${Y(t)}</span></button>`}function Ne(e,t){return e.packagesOnly?re(e,t.pkg).length:t.files.length}function Pe(e,n,r,{select:i,expand:a,expanded:o,neighborhood:s,focus:c,clear:l}){let u=e.byId.get(r?.from),f=e.byId.get(r?.to),p=n.packagesOnly,m=ne(n),h=e=>n.nodeByFile.get(e)?.origFile??e;if(!u){let t=[...e.rows].toSorted((e,t)=>t.importers-e.importers).slice(0,15),r=p?[...e.byId.values()].reduce((e,t)=>e+t.dependencies,0):e.importCount;return D`<div class="matrix-metrics">${p?null:D`<span><b>${Y(n.nodes.length)}</b>files</span>`}<span><b>${Y(n.packages.length)}</b>packages</span><span><b>${Y(r)}</b>${m.links}</span></div><p class="matrix-empty">Select a row to inspect a package.<br>Select a cell to see the ${m.members} behind a dependency.</p><h4>${m.mostImported}</h4>${t.map(e=>Me(e,e.importers,i))} ${e.cycleCount?D`<h4>Cyclic groups <b>${e.cycleCount}</b></h4>${e.rows.filter(e=>e.cyclic).slice(0,12).map(e=>Me(e,e.outgoing,i))}`:null}`}let g=f?e.cells.get(u.id)?.get(f.id):null,_=g?.cycleCount<g?.count?`${Y(g.cycleCount)} of ${Y(g.count)} ${m.cellLinks} participate in a cycle`:`${m.link} participates in a cycle`,v=Map.groupBy(g?.examples??[],([,e])=>e),y=u.cyclic?[...e.byId.values()].filter(e=>e.component===u.component).length:0,b=[...e.cells.get(u.id)?.values()??[]].filter(e=>e.to!==u.id).toSorted((e,t)=>t.count-e.count),x=[...e.cells.values()].map(e=>e.get(u.id)).filter(e=>e&&e.from!==u.id).toSorted((e,t)=>t.count-e.count),S=(e,t)=>p?D`<span class="matrix-import-copy">${t}</span>`:D`<button data-bundle-view-source="${h(e)}">${t}</button>`,C=p?null:u.file?D`<button @click="${()=>a(u.pkg)}">Collapse package</button><button data-bundle-view-source="${h(u.file)}">View source</button>`:D`<button @click="${()=>a(u.pkg)}">${o.has(u.pkg)?`Collapse files`:`Expand files`}</button>`;return D`<div class="matrix-panel-head"><button class="matrix-selected-name" @click="${()=>i(u.id)}">${u.label}</button><button type="button" class="detail-action" @click="${l}" aria-label="Clear matrix selection">×</button></div>${f?D`<div class="matrix-direction">${m.linked} →</div><button class="matrix-selected-name" @click="${()=>i(f.id)}">${f.label}</button>`:null} ${(f?g?.cyclic:u.cyclic)?D`<span class="matrix-cycle-label">${f?_:`Cyclic group \xB7 ${y} members`}</span>`:null}<div class="matrix-metrics"><span><b>${Y(f?g?.count??0:Ne(n,u))}</b>${f?m.cellLinks:m.members}</span>${p?null:D`<span><b>${t(u.size)}</b>source size</span>`}</div><div class="matrix-actions">${C} <button aria-pressed="${String(s===u.id)}" @click="${()=>c(u.id)}">Neighborhood</button></div>${f?D`<h4>${m.cellHeading}</h4>${v.size>0?[...v].map(([e,t])=>D`<div class="matrix-import-group">${p?D`<span class="matrix-import-copy matrix-import-target" data-tooltip-truncated data-tooltip="${e}">${e}</span>`:D`<button class="matrix-import-target" data-bundle-view-source="${h(e)}" data-tooltip-truncated data-tooltip="${e}">${e}</button>`}<ul class="matrix-import-sources" aria-label="${m.incoming}">${t.map(([t])=>D`<li>${S(t,D`<span aria-hidden="true">←</span><span data-tooltip-truncated data-tooltip="${t}">${t}</span>`)} ${d(h(t),h(e),n.ownSourceFiles?.has(e),n.ownSourceFiles?.has(t))?null:D`<span class="matrix-import-excluded">Excluded from cycles</span>`}</li>`)}</ul></div>`):D`<p class="matrix-empty">No direct ${m.links} in this direction.</p>`} ${g&&g.count>g.examples.length?D`<p class="matrix-empty">Showing ${g.examples.length} of ${Y(g.count)} ${m.links}.</p>`:null} ${f.id!==u.id&&e.cells.get(f.id)?.has(u.id)?D`<h4>Reverse direction</h4><button class="g2-dist-item matrix-reverse-link" @click="${()=>i(f.id,u.id)}">← ${Y(e.cells.get(f.id).get(u.id).count)} ${m.cellLinks}</button>`:null}`:D`<h4>${m.outgoing} <b>${b.length}</b></h4>${b.slice(0,60).map(t=>Me(e.byId.get(t.to),t.count,e=>i(u.id,e)))} ${b.length>60?D`<p class="matrix-empty">Showing the 60 strongest of ${b.length} dependencies.</p>`:null}<h4>${m.incoming} <b>${x.length}</b></h4>${x.slice(0,60).map(t=>Me(e.byId.get(t.from),t.count,e=>i(e,u.id)))} ${x.length>60?D`<p class="matrix-empty">Showing the 60 strongest of ${x.length} ${m.importers}.</p>`:null}`}`}var Fe=`:host{display:contents}*{box-sizing:border-box}button,select{font:inherit;color:var(--text);border:1px solid var(--border);background:var(--surface);border-radius:var(--ui-radius, 4px);padding:4px 7px;cursor:default}button:hover,button[aria-pressed=true]{background:var(--graph-hover-bg);border-color:var(--muted)}button:focus-visible,select:focus-visible,canvas:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.matrix-layout{display:contents;color:var(--text);font-size:12px}.matrix-stage{grid-area:stage;position:relative;overflow:hidden;min-width:0;min-height:0;background:var(--graph-canvas-bg)}.matrix-order{position:absolute;top:12px;left:14px;max-width:calc(var(--matrix-label-width) - 28px);height:30px;padding:3px 6px;border-radius:var(--ui-radius, 6px);font-size:11px}canvas{display:block;width:100%;height:100%;touch-action:none}.matrix-hover{position:absolute;bottom:10px;left:calc(var(--matrix-label-width) + 10px);max-width:max(0px,calc(100% - var(--matrix-label-width) - 160px));padding:5px 8px;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:var(--surface);pointer-events:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}.matrix-panel{grid-area:right;min-height:0;overflow:auto;padding:12px;border-left:1px solid var(--border);background:var(--surface)}.matrix-panel-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding-right:var(--graph-fullscreen-inset, 0)}h4{margin:20px 0 7px;font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;display:flex;justify-content:space-between}.matrix-metrics{display:flex;gap:14px;margin:15px 0;color:var(--muted);font-size:10px}.matrix-metrics:first-child{margin-top:0;padding-right:var(--graph-fullscreen-inset, 0)}.matrix-metrics b{display:block;font-size:16px;font-weight:500;color:var(--text);font-variant-numeric:tabular-nums;margin-bottom:3px}.matrix-empty{color:var(--muted);font-size:11px;line-height:1.6;cursor:default;user-select:none;-webkit-user-select:none}.matrix-row-link{grid-template-columns:6px minmax(0,1fr) auto}.matrix-row-link .g2-dist-dot{width:6px;height:6px;border-radius:2px}.matrix-row-link .g2-dist-name{color:var(--text)}.matrix-row-link .g2-dist-count{color:var(--muted)}.matrix-reverse-link{grid-template-columns:1fr}.matrix-selected-name{display:block;background:transparent;border:0;text-align:left;padding:0;margin:14px 0 6px;font:12px/1.6 ui-monospace,monospace;overflow-wrap:anywhere}.matrix-panel-head .matrix-selected-name{min-width:0;margin:0}.matrix-panel-head button:last-child{flex-shrink:0}.matrix-direction{color:var(--muted);font-size:10px}.matrix-cycle-label{display:block;color:var(--matrix-cycle, #e879c7);font-size:10px;margin-top:10px}.matrix-actions{display:flex;gap:5px;margin:12px 0;font-size:11px}.matrix-actions button{white-space:nowrap}.matrix-import-group{padding:6px 0;border-bottom:1px solid var(--border)}.matrix-import-group :is(button,.matrix-import-copy){display:flex;align-items:baseline;gap:6px;width:100%;min-height:20.5px;background:transparent;border:0;padding:2px 0;font:10px/1.6 ui-monospace,monospace;text-align:left;overflow-wrap:anywhere;color:var(--text)}.matrix-import-group .matrix-import-target{font-weight:600}.matrix-import-sources{margin:0 0 0 10px;padding:0;list-style:none}.matrix-import-sources :is(button,.matrix-import-copy){color:var(--muted)}.matrix-import-sources span:last-child{min-width:0}.matrix-import-excluded{display:block;margin-left:12px;color:var(--muted);font-size:10px}
|
|
8
|
+
`,Ie=class extends k{static properties={graph:{attribute:!1}};static styles=[E(j),E(Fe),E(e),E(M)];constructor(){super(),this.expanded=new Set,this.order=`structure`,this.cyclesOnly=!1,this.neighborhood=null,this.selection=null,this.hover=null,this.view={cell:18,x:0,y:0},this.width=0,this.height=0,this.dirty=!0,this.needsFit=!0,this.bridge={requestDraw:()=>this.requestUpdate(),_cleanup:()=>{}}}willUpdate(e){if(this.graph&&(e.has(`graph`)||this.query!==i.pathFilter||this.dirty)){let e=this.model?.rows;this.query=i.pathFilter,this.model=h(this.graph,{expanded:this.expanded,order:this.order,query:this.query,neighborhood:this.neighborhood,cyclesOnly:this.cyclesOnly}),this.neighborhood&&!this.model.byId.has(this.neighborhood)&&(this.neighborhood=null,this.model=h(this.graph,{expanded:this.expanded,order:this.order,query:this.query,cyclesOnly:this.cyclesOnly})),this.selection&&(!this.model.index.has(this.selection.from)||this.selection.to&&(!this.model.index.has(this.selection.to)||this.cyclesOnly&&!this.model.cells.get(this.selection.from)?.has(this.selection.to)))&&(this.selection=null),this.hover=null,this.dirty=!1,this.needsFit||=!e||e.length!==this.model.rows.length||this.model.rows.some((t,n)=>t.id!==e[n].id)}}firstUpdated(){let e=this.renderRoot.querySelector(`canvas`);this.canvas=e,this.resizeObserver=new ResizeObserver(()=>{let t=e.parentElement.getBoundingClientRect();this.width=t.width,this.height=t.height;let n=window.devicePixelRatio||1;e.width=Math.round(this.width*n),e.height=Math.round(this.height*n),this.clamp(),this.paint()}),this.resizeObserver.observe(e.parentElement),this.themeObserver=new MutationObserver(()=>this.requestUpdate()),this.themeObserver.observe(document.body,{attributes:!0,attributeFilter:[`class`]}),this.events=new AbortController,e.addEventListener(`wheel`,e=>{e.preventDefault(),e.ctrlKey||e.metaKey?this.zoom(Math.exp(-e.deltaY*.005),e.offsetX,e.offsetY):(this.view.x+=e.shiftKey?e.deltaY:e.deltaX,this.view.y+=e.shiftKey?0:e.deltaY,this.clamp(),this.hover=null,this.paint())},{passive:!1,signal:this.events.signal})}updated(){i.graphState=this.bridge;let e=JSON.stringify([this.cyclesOnly,this.model.cycleCount,this.expanded.size,!!this.neighborhood]);e!==this.controlsKey&&(this.controlsKey=e,this.dispatchEvent(new CustomEvent(`matrix-controls-change`,{detail:this.renderControls(),bubbles:!0,composed:!0}))),cancelAnimationFrame(this.frame),this.frame=requestAnimationFrame(()=>this.paint())}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect(),this.themeObserver?.disconnect(),this.events?.abort(),cancelAnimationFrame(this.frame),i.graphState===this.bridge&&(i.graphState=null)}clamp(){this.view.cell=Oe(this.view.cell,this.model.rows.length,this.width,this.height);let e=this.model.rows.length*this.view.cell;this.view.x=Math.max(0,Math.min(this.view.x,Math.max(0,e-this.width+196+12))),this.view.y=Math.max(0,Math.min(this.view.y,Math.max(0,e-this.height+118+12)))}fit(){this.view={cell:De(this.model.rows.length,this.width,this.height),x:0,y:0},this.needsFit=!1,this.requestUpdate()}zoom(e,t=(this.width+196)/2,n=(this.height+118)/2){let r=this.view.cell,i=Oe(r*e,this.model.rows.length,this.width,this.height);this.view.x=(this.view.x+t-196)*i/r-t+196,this.view.y=(this.view.y+n-118)*i/r-n+118,this.view.cell=i,this.clamp(),this.hover=null,this.requestUpdate()}select(e,t=null,n=!0){this.selection={from:e,to:t},n&&this.model.index.has(e)&&(this.view.cell=Math.max(16,this.view.cell),this.view.y=this.model.index.get(e)*this.view.cell-(this.height-118)/2,this.view.x=(this.model.index.get(t??e)??0)*this.view.cell-(this.width-196)/2,this.clamp()),this.requestUpdate()}expand(e){this.graph.packagesOnly||(this.expanded.has(e)?this.expanded.delete(e):this.expanded.add(e),this.revealPkg=e,this.selection=null,this.neighborhood=null,this.dirty=!0,this.requestUpdate())}pointer(e){let t=this.canvas.getBoundingClientRect();return ke(e.clientX-t.left,e.clientY-t.top,this.model,this.view)}move(e){if(this.drag){let t=e.clientX-this.drag.x,n=e.clientY-this.drag.y;if(Math.abs(t)+Math.abs(n)>3&&(this.drag.moved=!0),this.drag.moved){this.view.x=this.drag.ox-t,this.view.y=this.drag.oy-n,this.clamp(),this.hover=null,this.paint();return}}let t=this.pointer(e);(t?.row!==this.hover?.row||t?.col!==this.hover?.col)&&(this.hover=t,this.requestUpdate())}key(e){if(e.key===`Escape`){this.selection=null,this.hover=null,this.requestUpdate();return}if(![`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`,`Enter`].includes(e.key)||this.model.rows.length===0)return;e.preventDefault();let t=this.model.index.get(this.selection?.from)??0,n=this.model.index.get(this.selection?.to)??t;if(e.key===`Enter`){this.expand(this.model.rows[t].pkg);return}e.key===`ArrowDown`&&t++,e.key===`ArrowUp`&&t--,e.key===`ArrowRight`&&n++,e.key===`ArrowLeft`&&n--;let r=e=>Math.max(0,Math.min(this.model.rows.length-1,e));this.select(this.model.rows[r(t)].id,this.model.rows[r(n)].id)}paint(){if(!this.canvas||!this.model||this.width<=196||this.height<=118)return;if(this.needsFit&&this.fit(),this.revealPkg){let e=this.model.rows.find(e=>e.pkg===this.revealPkg);this.revealPkg=null,e&&this.select(e.id)}let e=this.canvas.getContext(`2d`),t=window.devicePixelRatio||1;e.setTransform(t,0,0,t,0,0);let n=getComputedStyle(this),a=e=>n.getPropertyValue(e).trim(),o=document.body.classList.contains(`theme-paper`),s=o||[`theme-light`,`theme-pink`,`theme-w95`].some(e=>document.body.classList.contains(e)),c={bg:a(`--graph-canvas-bg`)||`#0c0c0c`,surface:a(`--surface`),text:a(`--text`),muted:a(`--muted`),border:a(`--border`),grid:s?`#0000000b`:`#ffffff0b`,highlight:o?`#fff`:s?`#0969da18`:`#ffffff12`,cycle:o?`#000`:s?`#a21caf`:`#e879c7`};this.style.setProperty(`--matrix-cycle`,c.cycle);let l=this.model.index.get(this.selection?.to),u=this.model.index.get(this.selection?.from);je(e,this.model,this.view,{width:this.width,height:this.height,theme:c,colorOf:r,rows:ne(this.graph).importers,hover:this.hover,selected:u===void 0?null:{row:u,col:l??null},dimmed:e=>!this.graph.issuesHidden&&!e.files.some(e=>{let t=this.graph.nodeByFile.get(e);return(i.selectedSeverities.size===0||[...i.selectedSeverities].some(e=>t.severitySet?.has(e)))&&(i.selectedColors.size===0||[...i.selectedColors].some(e=>t.colorSet?.has(e)))})})}renderControls(){let e=this.model.cycleCount>0||this.cyclesOnly;return!e&&this.expanded.size===0&&!this.neighborhood?null:D`<div class="g2-matrix-controls">${e?D`<mode-switch label="${`${this.model.cycleCount} ${this.model.cycleCount===1?`cycle`:`cycles`}`}" .checked="${this.cyclesOnly}" @click="${()=>{this.cyclesOnly=!this.cyclesOnly,this.dirty=!0,this.requestUpdate()}}"></mode-switch>`:null} ${this.expanded.size>0?D`<button @click="${()=>{this.expanded.clear(),this.selection=null,this.dirty=!0,this.requestUpdate()}}">Collapse all</button>`:null} ${this.neighborhood?D`<button @click="${()=>{this.neighborhood=null,this.dirty=!0,this.requestUpdate()}}">All dependencies</button>`:null}</div>`}render(){if(!this.model)return null;let e=this.model.rows[this.hover?.col],t=this.model.rows[this.hover?.row],n=e&&t?this.model.cells.get(t.id)?.get(e.id)?.count??0:0,r=this.graph.packagesOnly,i=ne(this.graph);return D`<div class="matrix-layout"><div class="matrix-stage" style="${v({"--matrix-label-width":`196px`})}"><select class="matrix-order" aria-label="Matrix order" @change="${e=>{this.order=e.target.value,this.dirty=!0,this.requestUpdate()}}"><option value="structure" ?selected="${this.order===`structure`}">Structure ↓</option><option value="name" ?selected="${this.order===`name`}">Name ↓</option><option value="importers" ?selected="${this.order===`importers`}">${i.mostImported} ↓</option><option value="imports" ?selected="${this.order===`imports`}">Most ${i.links} ↓</option></select><canvas tabindex="0" role="img" aria-label="${r?`Dependency matrix. Rows depend on columns. Arrow keys select cells.`:`Dependency matrix. Rows import columns. Arrow keys select cells; Enter expands a package.`}" @keydown="${e=>this.key(e)}" @pointermove="${e=>this.move(e)}" @pointerleave="${()=>{this.drag||(this.hover=null,this.requestUpdate())}}" @pointerdown="${e=>{e.button===0&&(this.canvas.setPointerCapture(e.pointerId),this.drag={x:e.clientX,y:e.clientY,ox:this.view.x,oy:this.view.y,moved:!1})}}" @pointercancel="${()=>{this.drag=null}}" @pointerup="${e=>{if(this.drag){if(!this.drag.moved){let t=this.pointer(e);t&&this.select(this.model.rows[t.row].id,t.col===null?null:this.model.rows[t.col].id,!1)}this.drag=null}}}" @dblclick="${e=>{let t=this.pointer(e);t&&this.expand(this.model.rows[t.row].pkg)}}"></canvas>${t&&(!e||n>0)?D`<div class="matrix-hover">${t.label}${e?` \u2192 ${e.label} \xB7 ${n} ${i.links}`:` \xB7 ${Ne(this.graph,t)} ${i.members}`}</div>`:null}<div class="g2-zoom-ctrl" role="group" aria-label="Matrix zoom"><button aria-label="Zoom in" @click="${()=>this.zoom(1.5)}">+</button><div class="g2-zoom-pct">${Math.round(this.view.cell/18*100)}%</div><button aria-label="Zoom out" @click="${()=>this.zoom(1/1.5)}">−</button> <button class="g2-zoom-fit-btn" aria-label="Fit to view" @click="${()=>this.fit()}">fit</button></div></div><aside class="matrix-panel" aria-label="Matrix details" aria-live="polite">${Pe(this.model,this.graph,this.selection,{select:(e,t)=>this.select(e,t),expand:e=>this.expand(e),expanded:this.expanded,neighborhood:this.neighborhood,focus:e=>{this.neighborhood=this.neighborhood===e?null:e,this.dirty=!0,this.requestUpdate()},clear:()=>{this.selection=null,this.requestUpdate()}})}</aside></div>`}};customElements.define(`dependency-matrix`,Ie);var X={dark:`#0c0c0c`,light:`#f6f8fa`,pink:`#fff0f7`,w95:`#fff`,paper:`#fff`};function Le(){let e=typeof document>`u`?null:document.body?.classList;return e?.contains(`theme-paper`)?X.paper:e?.contains(`theme-pink`)?X.pink:e?.contains(`theme-w95`)?X.w95:e?.contains(`theme-light`)?X.light:X.dark}function Re(e){let t=[1,3,5].map(t=>{let n=parseInt(e.slice(t,t+2),16)/255;return n<=.04045?n/12.92:((n+.055)/1.055)**2.4});return t[0]*.2126+t[1]*.7152+t[2]*.0722>.18?`#000`:`#fff`}function ze(e,t,n,r){let i=[...r.keys()],a=new Map;i.forEach((e,t)=>{for(let n of r.get(e).files)a.set(n,t)});let o=[...a.keys()],s=new Map(o.map((e,t)=>[e,t])),c=o.map(e=>a.get(e)),l=o.map(e=>[...t.get(e)].map(e=>s.get(e))),u=n.map(e=>s.get(e)),d=o.map(t=>{let n=e.get(t);return{size:Number.isFinite(n.size)&&n.size>=0?n.size:0,missing:+(!n.virtual&&n.size==null)}}),f=i.map(()=>({removable:0,removableMissing:0})),p=new Int32Array(o.length),m=new Int32Array(o.length),h=new Int32Array(o.length),g=new Uint8Array(o.length);for(let e=0;e<i.length;e+=32){let t=Math.min(32,i.length-e),n=t===32?-1:(1<<t)-1;m.fill(0),g.fill(0);for(let r=0;r<o.length;r++){let i=c[r]-e;p[r]=i>=0&&i<t?n&~(1<<i):n}let r=0,a=0,s=0,_=e=>{g[e]||(g[e]=1,h[s]=e,s=(s+1)%h.length,a++)};for(let e of u)m[e]=p[e],m[e]&&_(e);for(;a>0;){let e=h[r];r=(r+1)%h.length,a--,g[e]=0;for(let t of l[e]){let n=m[e]&p[t]&~m[t];n&&(m[t]|=n,_(t))}}let v=new Map;for(let e=0;e<o.length;e++){let t=n&~m[e];if(!t)continue;let r=v.get(t);r||(r={size:0,missing:0},v.set(t,r)),r.size+=d[e].size,r.missing+=d[e].missing}for(let[t,n]of v)for(let r=t;r;r&=r-1){let t=e+31-Math.clz32(r&-r);f[t].removable+=n.size,f[t].removableMissing+=n.missing}}i.forEach((e,t)=>Object.assign(r.get(e),f[t]))}function Be(e,t,n){let r=new Map([...e.keys()].map(e=>[e,new Set]));for(let[e,i]of t){let t=n(e),a=n(i);t!==a&&r.get(t).add(a)}let{groups:i,componentOf:a}=p([...e.keys()],r),o=i.map(t=>t.reduce((t,n)=>{let r=e.get(n);return Math.max(t,r.own,r.removable)},0)),s=i.map(()=>0),c=i.map(()=>new Set);for(let[e,t]of r)for(let n of t){let t=a.get(e),r=a.get(n);t!==r&&!c[t].has(r)&&(c[t].add(r),s[r]++)}let l=[];s.forEach((e,t)=>{e||l.push(t)});for(let e of l)for(let t of c[e])o[t]=Math.max(o[t],o[e]),--s[t]===0&&l.push(t);for(let[t,n]of e)n.filterSize=o[a.get(t)]}function Ve(e,t,n,r,i){let a=new Int32Array(e.length),o=i.map(()=>({size:0,missing:0}));for(let s=0;s<e.length;s+=32){let c=Math.min(32,e.length-s);for(let n=t.length-1;n>=0;n--){let r=t[n],i=r-s,o=i>=0&&i<c?1<<i:0;for(let t of e[r])o|=a[t];a[r]=o}let l=new Map;for(let e=0;e<i.length;e++){let t=a[i[e]];if(!t)continue;let c=l.get(t);if(!c){c={size:0,missing:0};for(let e=t;e;e&=e-1){let t=s+31-Math.clz32(e&-e);c.size+=n[t],c.missing+=r[t]}l.set(t,c)}o[e].size+=c.size,o[e].missing+=c.missing}}return i.map((e,t)=>[e,o[t]])}var He=e=>Number.isFinite(e)&&e>=0?e:0,Ue=e=>e.filterSize,We=(e,t)=>Math.max(e.removable,e.own)<t&&e.filterSize>=t;function Ge(e){if(e.byId.size<=100)return 0;let t=[0,1,4,10,20,50,100,200].map(e=>e*1024),n=t.map(()=>0);for(let r of e.byId.values())for(let e=0;e<t.length&&!(Ue(r)<t[e]);e++)n[e]++;let r=0;for(;r<t.length-1&&n[r]>100&&n[r+1]>=50;)r++;return t[r]}function Ke(e,t){let{groups:n,componentOf:r}=p([...e.keys()],t),i=n.map(t=>t.reduce((t,n)=>t+He(e.get(n).size),0)),a=n.map(t=>t.filter(t=>!e.get(t).virtual&&e.get(t).size==null).length),o=n.map(()=>0),s=n.map(()=>new Set);for(let[e,n]of t)for(let t of n){let n=r.get(e),i=r.get(t);n!==i&&!s[n].has(i)&&(s[n].add(i),o[i]++)}let c=[...o],l=[];c.forEach((e,t)=>{e||l.push(t)});for(let e of l)for(let t of s[e])--c[t]===0&&l.push(t);let u=new Uint32Array(n.length),d=new Map,f=8*(n.length+s.reduce((e,t)=>e+t.size,0)),m=0,h=0,g=(e,t=!1)=>{++m===4294967295&&(u.fill(0),m=1);let n=0,r=0,o=[...e];for(;o.length>0;){let e=o.pop();if(u[e]!==m){if(t&&(h+=1+s[e].size)>f)return null;u[e]=m,r+=i[e],n+=a[e];for(let t of s[e])u[t]!==m&&o.push(t)}}return{size:r,missing:n}},_=l.toReversed();for(let e=0;e<_.length;e++){let t=_[e],n=s[t].size===1?d.get([...s[t]][0]):null,r=n?{size:i[t]+n.size,missing:a[t]+n.missing}:g([t],!0);if(r)d.set(t,r);else{for(let[t,n]of Ve(s,l,i,a,_.slice(e)))d.set(t,n);break}}return{inferred:n.filter((e,t)=>o[t]===0).map(e=>e[0]),sum(e){let t=new Set(e.map(e=>r.get(e)));return t.size===1?d.get([...t][0]):g(t)}}}function qe(e){let t=new Map(e.nodes.map(e=>[e.file,e])),n=e.flowEntries??[];for(let e of n)e.virtual&&!t.has(e.file)&&t.set(e.file,{...e,size:0});let r=new Map([...t.keys()].map(e=>[e,new Set])),i=0;for(let[n,a]of t)for(let o of a.virtual?a.imports:e.importsOf.get(n)??[]){let s=t.get(o);if(!s||r.get(n).has(o))continue;let c=t=>t.virtual?t.pkg===`__own__`:e.ownSourceFiles?.has(t.file);if(!d(a.origFile??n,s.origFile??o,c(s),c(a))){i++;continue}r.get(n).add(o)}return{files:t,links:r,entries:n.filter(e=>e.entry!==!1).map(e=>e.file).filter(e=>t.has(e)),weakEdges:i}}function Je(e,t){let n=new Map;for(let r of e){let e=t.get(r),i=e.packageInfo;if(!i)continue;n.has(i.directory)||n.set(i.directory,{...i,size:0,missing:0});let a=n.get(i.directory);a.size+=He(e.size),!e.virtual&&e.size==null&&a.missing++}return[...n.values()].toSorted((e,t)=>t.size-e.size||e.directory.localeCompare(t.directory))}function Ye(e,{packages:t=!1}={}){let{files:n,links:r,entries:i,weakEdges:a}=qe(e),o=Ke(n,r),s=i.length>0?[...new Set(i)]:o.inferred,c=new Set(s),l=new Map,u=[...s];for(let e of u)for(let t of r.get(e))c.has(t)||(c.add(t),u.push(t),l.set(t,e));let d=new Map,f=e=>`${t?`p`:`f`}:${t?n.get(e).pkg:e}`;for(let e of c){let r=f(e),i=n.get(e);d.has(r)||d.set(r,{id:r,pkg:i.pkg,label:t?_(i.pkg):e,version:t?void 0:i.packageInfo?.version,files:[],own:0,virtual:!0,incoming:[],outgoing:[]});let a=d.get(r);a.files.push(e),a.own+=He(i.size),a.virtual&&=!!i.virtual}for(let e of d.values())Object.assign(e,o.sum(e.files)),t&&(e.instances=Je(e.files,n));ze(n,r,s,d),Be(d,l,f);let p=new Map;for(let e of c)for(let n of r.get(e)){let r=f(e),i=f(n);if(t&&r===i)continue;let a=JSON.stringify([r,i]);p.has(a)||p.set(a,{id:a,from:r,to:i,targets:new Set,count:0});let o=p.get(a);o.targets.add(n),o.count++}let m=[...p.values()];for(let e of m)Object.assign(e,o.sum([...e.targets])),d.get(e.from).outgoing.push(e),d.get(e.to).incoming.push(e);return{byId:d,edges:m,edgeById:p,roots:[...new Set(s.map(f))],files:n,packages:t,weakEdges:a,inferred:i.length===0,total:o.sum(s),omittedFiles:n.size-c.size}}function Xe(e,t,n){let r=new Set(t),i=[...t],a=new Set(t);for(let t of i)for(let a of e.byId.get(t).outgoing)!r.has(a.to)&&n(a.to)&&(r.add(a.to),i.push(a.to));let o=new Map(i.map(t=>[t,new Set(e.byId.get(t).outgoing.map(e=>e.to).filter(e=>r.has(e)&&!a.has(e)))])),{componentOf:s,groups:c}=p(i,o),l=c.map(()=>0),u=c.map(()=>new Set),d=c.map(()=>0);for(let[e,t]of o)for(let n of t){let t=s.get(e),r=s.get(n);t!==r&&!u[t].has(r)&&(u[t].add(r),l[r]++)}let f=[];l.forEach((e,t)=>{e||f.push(t)});for(let e of f)for(let t of u[e])d[t]=Math.max(d[t],d[e]+1),--l[t]===0&&f.push(t);return new Map(i.map(e=>[e,d[s.get(e)]]))}function Ze(e,t,n){let r=new Map(e.map(e=>[e.id,{from:[],to:[]}]));for(let e of t)r.get(e.from).from.push(e),r.get(e.to).to.push(e);for(let t of e)for(let e of[`from`,`to`]){let i=e===`to`,a=i?`x2`:`x1`,o=i?`width2`:`width1`,s=e=>{let t=n.get(i?e.from:e.to);return t.x+t.width/2},c=r.get(t.id)[e].toSorted((e,t)=>s(e)-s(t)||e.id.localeCompare(t.id));if(c.length===0)continue;let l=c.reduce((e,t)=>e+t[o],0),u=0;if(l<=t.width){for(let e of c)e[a]=t.x+u,u+=e[o];continue}let d=c[0][o]/2,f=c.at(-1)[o]/2,p=l-d-f,m=new Float64Array(c.length),h=t.width,g=0;for(let e=c.length-1;e>=0;e--)h=Math.min(h,t.width-c[e][o]/2),m[e]=h;for(let e=0;e<c.length;e++){let n=c[e],r=n[o]/2,i=d+(u+r-d)/p*(t.width-d-f),s=Math.min(m[e],Math.max(g,r,i));n[a]=t.x+s-r,g=s,u+=n[o]}}}function Qe(e,t){let n=0,r=0;for(let r=0,i=0;r<e.length;r++){for(;i<t.length&&t[i]<e[r];)i++;n+=i}for(let n=0,i=0;i<t.length;i++){for(;n<e.length&&e[n]<t[i];)n++;r+=n}return[n,r]}function $e(e,t,n){let r=new Map;for(let e of t){let t=n.get(e.from),i=n.get(e.to);if(t.level===i.level)continue;let[a,o]=t.level<i.level?[t,i]:[i,t];r.has(o)||r.set(o,[]),r.get(o).push(a)}let i=1e6;for(let t of e.values()){let e=new Map(t.map(e=>[e,(r.get(e)??[]).map(e=>e.x+e.width/2).toSorted((e,t)=>e-t)]));for(let n=0;n<t.length&&i>0;n++){let n=!1;for(let r=0;r+1<t.length;r++){let a=e.get(t[r]),o=e.get(t[r+1]);i-=1+a.length+o.length;let[s,c]=Qe(a,o);c<s&&([t[r],t[r+1]]=[t[r+1],t[r]],n=!0)}if(!n)break}let n=0;for(let e of t)e.x=n,n+=e.width}}function et(e){let t=t=>e.byId.get(t).pkg;return W(e.edges.map(e=>[t(e.from),t(e.to)]),e.packages?oe:ae)}function tt(e,{focus:t=null,minSize:n=0,width:r=1100}={}){let i=et(e),a=t=>Ue(e.byId.get(t))>=n&&!i.has(e.byId.get(t).pkg),o=(t&&e.byId.has(t)?[t]:e.roots).filter(a),s=Xe(e,o,a),c=[...s.keys()].filter(a).toSorted((t,n)=>s.get(t)-s.get(n)||e.byId.get(n).removable-e.byId.get(t).removable||t.localeCompare(n)),l=new Set(c),u=e.edges.filter(e=>l.has(e.from)&&l.has(e.to)).toSorted((e,t)=>t.size-e.size||e.id.localeCompare(t.id)).map(e=>({...e})),d=[...l].map(t=>({...e.byId.get(t),level:s.get(t)})),f=Map.groupBy(d,e=>e.level),p=new Map(d.map(e=>[e.id,e])),m=d.reduce((e,t)=>Math.max(e,t.removable),1),h=e=>Math.max(e,m/4e3),g=[...f.values()].reduce((e,t)=>Math.max(e,t.reduce((e,t)=>e+t.removable,0)),1),_=Math.max(1,r)/g,v=0,y=0;for(let e of d)e.y=12+e.level*88,e.width=Math.max(.1,e.removable*_),y=Math.max(y,e.y+26);$e(f,u,p);for(let e of f.values())v=Math.max(v,e.reduce((e,t)=>e+t.width,0)),e.forEach((t,n)=>{t.rowStart=n===0,t.rowEnd=n===e.length-1});let b=[...f.values()].flat();for(let e of u){let t=p.get(e.from),n=p.get(e.to),r=h(e.size)*_;e.width1=Math.min(r,t.width),e.width2=Math.min(r,n.width),e.x1=t.x+(t.width-e.width1)/2,e.x2=n.x+(n.width-e.width2)/2,e.y1=t.y+26,e.y2=n.y,e.returning=n.level<=t.level,e.returning&&(y=Math.max(y,Math.max(e.y1,e.y2)+35))}return Ze(b,u,p),{nodes:b,byId:p,edges:u,roots:o,hiddenPackages:i,width:Math.max(1,v),height:y+12}}function nt(e,t,n){if(!(t>0&&n>0))return e;let r=t/Math.min(t/1100,n/e.height,9.99);if(Math.abs(r-e.width)<1e-7)return e;let i=r/e.width,a=e.nodes.map(e=>({...e,x:e.x*i,width:e.width*i})),o=e.edges.map(e=>({...e,x1:e.x1*i,x2:e.x2*i,width1:e.width1*i,width2:e.width2*i}));return{...e,nodes:a,edges:o,byId:new Map(a.map(e=>[e.id,e])),width:r}}function rt(e){let{x1:t,x2:n,y1:r,y2:i,width1:a,width2:o}=e,s=e.returning?Math.max(r,i)+35:(r+i)/2;return`M${t},${r} C${t},${s} ${n},${s} ${n},${i} L${n+o},${i} C${n+o},${s} ${t+a},${s} ${t+a},${r} Z`}function it(e){let t=e.returning?Math.max(e.y1,e.y2)+35:(e.y1+e.y2)/2;return{left:Math.min(e.x1,e.x2),right:Math.max(e.x1+e.width1,e.x2+e.width2),top:Math.min(e.y1,e.y2,t),bottom:Math.max(e.y1,e.y2,t)}}function Z(e,t){return e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom}function at(e){if(e.length===0)return null;let t={left:1/0,right:-1/0,top:1/0,bottom:-1/0};for(let n of e)t.left=Math.min(t.left,n.left),t.right=Math.max(t.right,n.right),t.top=Math.min(t.top,n.top),t.bottom=Math.max(t.bottom,n.bottom);if(e.length<=12)return{...t,entries:e};let n=t.right-t.left>t.bottom-t.top,r=e=>n?e.left+e.right:e.top+e.bottom,i=e.toSorted((e,t)=>r(e)-r(t)),a=i.length>>>1;return{...t,children:[at(i.slice(0,a)),at(i.slice(a))]}}function ot(e,t,n){let r=[],i={left:t,right:t,top:n,bottom:n},a=e?[e]:[];for(;a.length>0;){let e=a.pop();if(!Z(e,i)){if(e.entries)for(let t of e.entries)Z(t,i)||r.push(t);else a.push(...e.children)}}return r.toSorted((e,t)=>t.order-e.order)}function st(e,t,n){let r=[],i=e?[e]:[];for(;i.length>0;){let e=i.pop();if(!Z(e,t)){if(e.entries){for(let i of e.entries)if(i.edge&&!Z(i,t)&&(r.push(i),r.length>n))return null}else i.push(...e.children)}}return r.toSorted((e,t)=>e.order-t.order)}var Q=t;function ct(e){if(!e.instances?.length)return e.version?`
|
|
9
|
+
Version: ${e.version}`:``;if(e.instances.length===1)return`
|
|
10
|
+
Version: ${e.instances[0].version||`Unknown`}`;let n=new Map;for(let t of e.instances){let e=t.version||`Unknown version`;n.has(e)||n.set(e,{version:e,size:0,count:0,missing:0});let r=n.get(e);r.size+=t.size,r.count++,r.missing+=t.missing}return`
|
|
11
|
+
Versions · own source size
|
|
12
|
+
`+[...n.values()].toSorted((e,t)=>t.size-e.size||e.version.localeCompare(t.version)).map(e=>`${e.version} \xB7 ${t(e.size)}${e.missing?`+`:``} \xB7 ${e.count} ${e.count===1?`copy`:`copies`}`).join(`
|
|
13
|
+
`)}function lt(e,n){return`${e.label}
|
|
14
|
+
${t(e.removable)} unique \xB7 ${t(e.size)} reachable \xB7 ${t(e.own)} own${e.removableMissing?` \xB7 ${e.removableMissing} removed file sizes unknown`:``}${ct(e)}${We(e,n)?`
|
|
15
|
+
Kept by Large to preserve an entry-point path`:``}`}function ut(e,n){return`${n.byId.get(e.from).label} \u2192 ${n.byId.get(e.to).label}
|
|
16
|
+
${t(e.size)} reachable${e.returning?` · return / cycle edge`:``}`}var dt=e=>Math.min(.5/e,13);function ft(e,t){let n=e.width/2;if(e.rowStart===e.rowEnd){let e=Math.min(t,n/2);return{left:e,right:e}}let r=Math.min(t,n),i=Math.min(t,n-r);return e.rowStart?{left:r,right:i}:{left:i,right:r}}var pt=`Import paths. Use arrow keys to explore bars, Enter to select, or the sidebar search to find a file or package.`,mt=1500,ht=class{constructor(e){this.host=e}render(){return D`<canvas class="flow-canvas flow-base" aria-hidden="true"></canvas><canvas class="flow-canvas flow-bars" aria-hidden="true"></canvas><canvas class="flow-canvas flow-overlay" tabindex="0" role="group" aria-label="${pt}" @pointermove="${e=>this.pointer(e)}" @pointerleave="${()=>this.clearHover()}" @click="${e=>this.click(e)}" @dblclick="${e=>this.click(e,!0)}" @keydown="${e=>this.key(e)}"></canvas>`}prepare(){this.layout=this.host.layout,this.model=this.host.model,this.paths=this.layout.edges.map((e,t)=>({edge:e,order:t,path:new Path2D(rt(e)),...it(e)})),this.pathById=new Map(this.paths.map(e=>[e.edge.id,e])),this.rows=[...Map.groupBy(this.layout.nodes,e=>e.y).values()];let e=this.layout.nodes.map((e,t)=>({node:e,order:this.paths.length+t,left:e.x,right:e.x+e.width,top:e.y,bottom:e.y+26}));this.index=at([...this.paths,...e]),this.clearHover(),this.focused=null,this.invalidateRaster()}matchingNodes(){let e=this.host.model,t=JSON.stringify([this.host.minSize,this.host.graph.issuesHidden,i.pathFilter,[...i.selectedSeverities].toSorted(),[...i.selectedColors].toSorted()]);return(this.matchModel!==e||this.filterKey!==t)&&(this.matches=new Set([...e.byId.values()].filter(e=>this.host.matchesNode(e)).map(e=>e.id)),this.matchModel=e,this.filterKey=t,this.searchResult=null),this.matches}searchMatches(){let e=this.matchingNodes();return this.searchResult??=[...e].map(e=>this.host.model.byId.get(e)).toSorted((e,t)=>t.removable-e.removable)}update(e){if(this.base=e.querySelector(`.flow-base`),this.bars=e.querySelector(`.flow-bars`),this.overlay=e.querySelector(`.flow-overlay`),!this.base||!this.bars||!this.overlay)return;this.layout!==this.host.layout&&this.prepare();let t=Le(),n=this.matchingNodes(),i=r(`__own__`);(n!==this.paintedMatches||i!==this.palette||t!==this.background)&&(this.paintedMatches=n,this.palette=i,this.background=t,this.colors=new Map([...this.model.byId.values()].map(e=>[e.pkg,r(e.pkg)])),this.foreground=getComputedStyle(this.host).getPropertyValue(`--text`).trim()||`#fff`,this.invalidateRaster()),this.requestDraw()}requestDraw(){this.frame!=null||!this.overlay||(this.frame=requestAnimationFrame(()=>{this.frame=null,this.draw()}))}dispose(){this.clearHover(),this.frame!=null&&cancelAnimationFrame(this.frame),this.frame=null,this.base=null,this.bars=null,this.overlay=null,this.invalidateRaster()}stopPreview(){clearTimeout(this.previewTimer),this.settleFrame!=null&&cancelAnimationFrame(this.settleFrame),this.settleFrame=null,this.previewTimer=null,this.preview=!1}invalidateRaster(){this.stopPreview(),this.baseKey=null,this.barsKey=null,this.overview=null,this.paintedViewport=null}viewportChanged(){let{width:e,height:t,zoom:n,pan:r}=this.host,i=`${e}:${t}:${n}:${r.x}:${r.y}`;if(i===this.viewportKey){this.preview&&this.host.fitted&&(this.stopPreview(),this.requestDraw());return}this.viewportKey=i,this.stopPreview();let a=this.paintedViewport;this.host.fitted===!1&&this.overview&&a?.width===e&&a.height===t&&a.dpr===(globalThis.devicePixelRatio||1)&&(this.preview=!0,this.previewTimer=setTimeout(()=>{this.previewTimer=null,this.settleFrame=requestAnimationFrame(()=>{this.settleFrame=requestAnimationFrame(()=>{this.stopPreview(),this.requestDraw()})})},100)),this.clearHover(),this.requestDraw()}context(e,t,n=!0){let r=Math.ceil(this.host.height*t),i=Math.ceil(this.host.width*t);(e.width!==i||e.height!==r)&&(e.width=i,e.height=r);let a=e.getContext(`2d`);a.setTransform(1,0,0,1,0,0),n&&a.clearRect(0,0,i,r);let{pan:o,zoom:s}=this.host;return a.setTransform(t*s,0,0,t*s,t*o.x,t*o.y),a}draw(){if(!this.overlay||!this.host.width||!this.host.height)return;let{pan:e,zoom:t,width:n,height:r}=this.host,i=globalThis.devicePixelRatio||1,a=`${this.viewportKey}:${i}`;this.view={left:-e.x/t,right:(n-e.x)/t,top:-e.y/t,bottom:(r-e.y)/t};let o=this.preview?st(this.index,this.view,mt):null;if(o&&this.stopPreview(),this.preview){this.drawPreview(i),this.drawBars(i,a,!0);let e=this.context(this.overlay,i),n=this.layout.byId.get(this.host.selection?.node);n&&(e.globalAlpha=1,e.strokeStyle=this.foreground,e.lineWidth=Math.min(1.5/t,n.width/2),e.strokeRect(n.x,n.y,n.width,26)),this.previewVisible=!0;return}let s=this.baseKey!==a;if(s){let s=this.context(this.base,i);s.globalAlpha=1,s.fillStyle=this.background,s.fillRect(this.view.left,this.view.top,n/t,r/t),this.visiblePaths=o??this.paths.filter(e=>!Z(e,this.view));for(let e of this.visiblePaths)this.paintPath(s,e,this.edgeAlpha(e.edge));if(this.baseKey=a,this.paintedViewport={width:n,height:r,zoom:t,pan:{...e},dpr:i},this.view.left<=0&&this.view.top<=0&&this.view.right>=this.layout.width-1e-6&&this.view.bottom>=this.layout.height-1e-6){let e=this.overview?.canvas??document.createElement(`canvas`);e.width=this.base.width,e.height=this.base.height,e.getContext(`2d`).drawImage(this.base,0,0),this.overview={...this.paintedViewport,canvas:e}}}this.drawBars(i,a),this.drawHighlight(i,s||this.previewVisible),this.previewVisible=!1}drawPreview(e){let{width:t,height:n,pan:r,zoom:i}=this.host,a=this.context(this.bars,e,!1);a.setTransform(e,0,0,e,0,0),a.globalAlpha=1,a.imageSmoothingEnabled=!1;let o={...this.paintedViewport,canvas:this.base},s=i/o.zoom,c=r.x-o.pan.x*s,l=r.y-o.pan.y*s,u=c<=0&&l<=0&&c+o.width*s>=t&&l+o.height*s>=n;u||(a.fillStyle=this.background,a.fillRect(0,0,t,n));for(let e of u?[o]:[this.overview,o]){let o=i/e.zoom,s=r.x-e.pan.x*o,c=r.y-e.pan.y*o,l=Math.max(0,s),u=Math.max(0,c),d=Math.min(n,c+e.height*o),f=Math.min(t,s+e.width*o);if(f<=l||d<=u)continue;let p=e.dpr/o;a.drawImage(e.canvas,(l-s)*p,(u-c)*p,(f-l)*p,(d-u)*p,l,u,f-l,d-u)}}drawBars(e,t,n=!1){if(!n&&this.barsKey===t&&!this.previewVisible)return;this.barsKey!==t&&(this.visibleNodes=this.layout.nodes.filter(e=>!Z({left:e.x,right:e.x+e.width,top:e.y,bottom:e.y+26},this.view)));let r=this.context(this.bars,e,!n);for(let e of this.visibleNodes)this.paintNode(r,e);this.paintRowBorders(r),this.barsKey=t}paintRowBorders(e){let t=dt(this.host.zoom);e.globalAlpha=1,e.fillStyle=this.background;for(let n of this.rows){let r=n[0],i=n.at(-1),a=i.x+i.width;if(Z({left:r.x,right:a,top:r.y,bottom:r.y+26},this.view))continue;e.fillRect(r.x,r.y,a-r.x,t),e.fillRect(r.x,r.y+26-t,a-r.x,t),e.fillRect(r.x,r.y,ft(r,t).left,26);let o=ft(i,t).right;e.fillRect(a-o,r.y,o,26)}}edgeAlpha(e){return!this.matches.has(e.from)&&!this.matches.has(e.to)?.04:.22}paintPath(e,t,n){e.globalAlpha=n,e.fillStyle=this.colors.get(this.model.byId.get(t.edge.to).pkg),e.fill(t.path),t.edge.returning&&(e.strokeStyle=this.foreground,e.lineWidth=.7/this.host.zoom,e.setLineDash([3,3]),e.stroke(t.path),e.setLineDash([]))}paintNode(e,t){if(Z({left:t.x,right:t.x+t.width,top:t.y,bottom:t.y+26},this.view))return;let{zoom:n}=this.host,r=this.colors.get(t.pkg);e.globalAlpha=this.matches.has(t.id)?1:.15,e.fillStyle=r,e.fillRect(t.x,t.y,t.width,26);let{left:i,right:a}=ft(t,dt(n));e.fillStyle=this.background,!t.rowStart&&i>0&&e.fillRect(t.x,t.y,i,26),!t.rowEnd&&a>0&&e.fillRect(t.x+t.width-a,t.y,a,26),t.width>=40&&t.width*n>=24&&14*n>=6&&(e.save(),e.beginPath(),e.rect(t.x+5,t.y,Math.max(0,t.width-10),26),e.clip(),e.font=`14px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif`,e.fillStyle=Re(r),e.fillText(`${t.label.replace(/^node_modules\//u,``)} \xB7 ${Q(t.removable)}`,t.x+5,t.y+18),e.restore())}drawHighlight(e,t){let n=this.host.selection,r=new Set([n?.edge,this.host.hover]);for(let e of[n?.node,this.focused]){let t=this.model.byId.get(e);if(t)for(let e of[...t.incoming,...t.outgoing])r.add(e.id)}let i=[];for(let e of r){let t=this.pathById.get(e);if(!t||Z(t,this.view)||this.edgeAlpha(t.edge)===.04)continue;let r=e===n?.edge||e===this.host.hover?.8:.6;i.push({entry:t,alpha:(r-.22)/.78})}let a=[...new Set([n?.node,this.focused])].map(e=>this.layout.byId.get(e)).filter(Boolean),o=i.map(({entry:e})=>e).concat(a.map(e=>({left:e.x,right:e.x+e.width,top:e.y,bottom:e.y+26}))),s=e=>e.reduce((e,t)=>({left:Math.min(e.left,t.left),right:Math.max(e.right,t.right),top:Math.min(e.top,t.top),bottom:Math.max(e.bottom,t.bottom)}),{left:1/0,right:-1/0,top:1/0,bottom:-1/0}),c=s(o),l=t?this.view:s([c,this.highlightBounds??c]);this.highlightBounds=c;let u=this.context(this.overlay,e,t),d=2/this.host.zoom,f=Math.max(this.view.left,l.left-d),p=Math.max(this.view.top,l.top-d),m=Math.min(this.view.bottom,l.bottom+d)-p,h=Math.min(this.view.right,l.right+d)-f;if(h>0&&m>0){t||u.clearRect(f,p,h,m),u.save(),u.beginPath(),u.rect(f,p,h,m),u.clip();for(let{entry:e,alpha:t}of i)this.paintPath(u,e,t);if(i.length>0){u.save(),u.beginPath();let e={left:f,right:f+h,top:p,bottom:p+m};for(let t of this.visibleNodes)Z({left:t.x,right:t.x+t.width,top:t.y,bottom:t.y+26},e)||u.rect(t.x,t.y,t.width,26);u.clip(),u.clearRect(f,p,h,m),u.restore()}u.globalAlpha=1,u.strokeStyle=this.foreground;for(let e of a)u.lineWidth=Math.min(1.5/this.host.zoom,e.width/2),u.strokeRect(e.x,e.y,e.width,26);u.restore()}}hit(e){if(!this.overlay||!this.index)return null;let t=this.overlay.getBoundingClientRect(),{pan:n,zoom:r}=this.host,i=(e.clientX-t.left-n.x)/r,a=(e.clientY-t.top-n.y)/r,o=this.overlay.getContext(`2d`);o.save(),o.setTransform(1,0,0,1,0,0);let s=ot(this.index,i,a).find(e=>e.node||o.isPointInPath(e.path,i,a));return o.restore(),s??null}pointer(e){if(this.host.drag)return;let t=this.hit(e),n=t?.node?.id??t?.edge.id??null;n!==this.hoverId&&(this.clearHover(),this.hoverId=n,this.focused=t?.node?.id??null,this.host.hover=t?.edge?.id??null,t&&(this.overlay.dataset.tooltip=t.node?lt(t.node,this.host.minSize):ut(t.edge,this.model),this.overlay.setAttribute(`aria-label`,this.overlay.dataset.tooltip),this.overlay.style.cursor=`default`),this.requestDraw()),t&&c(this.overlay,{gate:()=>!this.host.drag&&this.hoverId===n})}clearHover(){s(this.host.renderRoot),this.hoverId=null,this.focused=null,this.host.hover=null,this.overlay&&(delete this.overlay.dataset.tooltip,this.overlay.style.cursor=`default`,this.overlay.setAttribute(`aria-label`,pt)),this.requestDraw()}setHover(e){e==null?this.clearHover():(this.host.hover=e,this.requestDraw())}click(e,t=!1){if(e.defaultPrevented)return;let n=this.hit(e);if(t){n?.node&&this.host.follow(n.node.id);return}this.host.select(n?.node?.id??n?.edge.to??null,n?.edge?.id??null)}key(e){let t=this.layout.nodes;if(t.length===0)return;let n=t.findIndex(e=>e.id===(this.focused??this.host.selection?.node));if([`ArrowRight`,`ArrowDown`].includes(e.key))n=Math.min(t.length-1,n+1);else if([`ArrowLeft`,`ArrowUp`].includes(e.key))n=Math.max(0,n-1);else if(e.key===`Home`)n=0;else if(e.key===`End`)n=t.length-1;else if(e.key===`Enter`||e.key===` `){e.preventDefault(),this.host.select(t[Math.max(0,n)].id);return}else if(e.key===`Escape`){this.clearHover(),this.host.select(null);return}else return;e.preventDefault();let r=t[n],{pan:i,zoom:a,width:o,height:s}=this.host;(r.x*a+i.x<0||(r.x+r.width)*a+i.x>o||r.y*a+i.y<0||(r.y+26)*a+i.y>s)&&(this.host.pan={x:o/2-(r.x+r.width/2)*a,y:s/2-(r.y+13)*a},this.host.fitted=!1,this.host.drawViewport()),this.focused=r.id,this.overlay.setAttribute(`aria-label`,lt(r,this.host.minSize)),this.requestDraw()}};function gt(e,t,n=!1){let r=n?t:1;return{min:t,max:r*9.99,percent:Math.round(e/r*100)}}var _t=`:host{display:contents}*{box-sizing:border-box}button{font:inherit;color:var(--text);border:1px solid var(--border);background:var(--surface);border-radius:var(--ui-radius, 4px);padding:4px 7px;cursor:default}button:hover{background:var(--graph-hover-bg)}button:disabled{opacity:.4;cursor:default}button:focus-visible{outline:2px solid var(--accent)}.flow-stage{grid-area:stage;position:relative;min-width:0;min-height:0;display:flex;flex-direction:column;background:var(--flow-background)}.flow-viewport{flex:1;position:relative;overflow:hidden;min-height:0;touch-action:none;cursor:default;user-select:none;-webkit-user-select:none}.flow-count{position:absolute;bottom:12px;right:50px;padding:6px 8px;color:var(--muted);font-size:11px;z-index:3;pointer-events:none}.flow-canvas{display:block;position:absolute;inset:0;width:100%;height:100%}.flow-base,.flow-bars{pointer-events:none}.flow-overlay:focus-visible{outline:1px solid var(--accent);outline-offset:-1px}.flow-panel{grid-area:right;overflow:auto;min-height:0;padding:14px;border-left:1px solid var(--border);background:var(--surface)}.flow-panel h3{font-size:13px;margin:0;overflow-wrap:anywhere}.flow-panel h4{margin:20px 0 8px;color:var(--muted);font-size:11px}.flow-panel p{color:var(--muted);font-size:12px;line-height:1.6}.flow-panel-heading{display:flex;align-items:start;gap:10px;justify-content:space-between}.flow-metrics{display:grid;gap:5px;margin:18px 0}.flow-metrics b{font-size:20px;font-weight:500}.flow-metrics span{color:var(--muted);font-size:11px;margin-bottom:8px}.flow-versions{list-style:none;padding:0;margin:0 0 18px;font-size:12px}.flow-versions-details{margin:18px 0}.flow-versions-details summary{color:var(--muted);font-size:11px;cursor:default}.flow-versions li+li{margin-top:10px}.flow-versions li>div{display:flex;justify-content:space-between;gap:8px}.flow-versions small{display:block;color:var(--muted);overflow-wrap:anywhere;margin-top:3px}.flow-direction{overflow-wrap:anywhere}.flow-actions{display:flex;gap:6px;flex-wrap:wrap}.flow-link{grid-template-columns:8px minmax(0,1fr) auto}
|
|
17
|
+
`,vt=10,yt=e=>Math.max(1,e-2*vt);function bt(e,t,n){return D`<button class="g2-dist-item flow-link" data-tooltip="${e.label}" @click="${n}"><span class="g2-dist-dot" style="${v({background:r(e.pkg)})}"></span> <span class="g2-dist-name">${e.label}</span><span class="g2-dist-count">${Q(t)}</span></button>`}var xt=class extends k{static properties={graph:{attribute:!1},packages:{type:Boolean}};static styles=[E(j),E(_t),E(M),E(e)];constructor(){super(),this.packages=!1,this.zoom=1,this.pan={x:0,y:0},this.width=0,this.height=0,this.needsFit=!0,this.fitted=!0,this.largeOnly=!0,this.largeSuppressed=!1,this.largeThreshold=0,this.models=new Map,this.chart=new ht(this),this.focus=null,this.selection=null,this.hover=null,this.bridge={requestDraw:()=>this.requestUpdate(),_cleanup:()=>{}}}willUpdate(e){if(!this.graph)return;let t=!1;e.has(`graph`)&&this.models.clear(),e.has(`packages`)&&(this.needsFit=!0),(!this.model||e.has(`graph`)||e.has(`packages`))&&(this.models.has(this.packages)||this.models.set(this.packages,Ye(this.graph,{packages:this.packages})),this.model=this.models.get(this.packages),this.largeThreshold=Ge(this.model),t=!0,this.model.byId.has(this.focus)||(this.focus=null),this.selection&&!this.model.byId.has(this.selection.node)&&(this.selection=null),this.hover=null),(t||this.layoutFocus!==this.focus)&&(this.largeSuppressed=this.isSmallFocus()),this.focus&&Ue(this.model.byId.get(this.focus))<this.minSize&&(this.focus=null),(t||this.layoutFocus!==this.focus||this.layoutMinSize!==this.minSize)&&(this.renderRoot&&s(this.renderRoot),this.layout=nt(tt(this.model,{focus:this.focus,minSize:this.minSize}),yt(this.width),this.height),this.layoutFocus=this.focus,this.layoutMinSize=this.minSize,this.selection&&!this.layout.byId.has(this.selection.node)&&(this.selection=null))}get minSize(){return this.largeOnly&&!this.largeSuppressed?this.largeThreshold:0}toggleLarge(){this.largeOnly=!this.largeOnly,this.needsFit=!0,this.requestUpdate()}renderControls(){return this.largeThreshold&&!this.largeSuppressed?D`<mode-switch label="${`Large \xB7 ${this.largeThreshold/1024}+ KiB`}" .checked="${this.largeOnly}" @click="${()=>this.toggleLarge()}"></mode-switch>`:null}updated(){i.graphState=this.bridge;let e=`${this.largeThreshold}:${this.largeOnly}:${this.largeSuppressed}`;e!==this.controlsKey&&(this.controlsKey=e,this.dispatchEvent(new CustomEvent(`flow-controls-change`,{detail:this.renderControls(),bubbles:!0,composed:!0}))),this.connectViewport(),this.syncViewport(),this.chart.update(this.renderRoot)}connectViewport(){let e=this.renderRoot.querySelector(`.flow-viewport`);if(!e||this.events)return;l(this.renderRoot,{gate:()=>!this.drag}),this.events=new AbortController;let{signal:t}=this.events;e.addEventListener(`wheel`,e=>this.wheel(e),{passive:!1,signal:t}),e.addEventListener(`pointerdown`,e=>this.startPan(e),{signal:t}),window.addEventListener(`pointermove`,e=>this.movePan(e),{signal:t}),window.addEventListener(`pointerup`,e=>this.endPan(e),{signal:t}),window.addEventListener(`pointercancel`,e=>this.endPan(e),{signal:t}),window.addEventListener(`deepview-theme-changed`,()=>this.requestUpdate(),{signal:t}),e.addEventListener(`click`,e=>{let t=this.suppressClick&&e.detail>0;if(this.suppressClick=!1,t){e.preventDefault(),e.stopPropagation();return}e.target.closest?.(`.flow-canvas`)||this.select(null)},{capture:!0,signal:t}),this.resizeObserver=new ResizeObserver(()=>this.syncViewport()),this.resizeObserver.observe(e)}disconnectedCallback(){super.disconnectedCallback(),s(this.renderRoot),this.resizeObserver?.disconnect(),this.resizeObserver=null,this.events?.abort(),this.events=null,this.chart.dispose(),this.viewportElements=null,this.drag=null,i.graphState===this.bridge&&(i.graphState=null)}select(e,t=null){if(!e&&this.focus){this.follow(null);return}this.selection=e?{node:e,edge:t}:null,this.requestUpdate()}follow(e){this.focus=e,this.selection=e?{node:e,edge:null}:null,this.needsFit=!0,this.requestUpdate()}isSmallFocus(){if(!this.focus)return!1;let e=[this.focus],t=new Set(e);for(let n of e){if(t.size>=200)break;for(let{to:r}of this.model.byId.get(n).outgoing)if(t.has(r)||(t.add(r),e.push(r)),t.size>=200)break}return t.size<200}fitScale(){return this.layout&&this.width>0&&this.height>0?Math.min(yt(this.width)/this.layout.width,this.height/this.layout.height,9.99):1}zoomMetrics(){return gt(this.zoom,Math.min(this.fitScale(),1))}align(){this.pan={x:vt,y:(this.height-this.layout.height*this.zoom)/2}}syncViewport(){let e=this.renderRoot.querySelector(`.flow-viewport`)?.getBoundingClientRect();if(!this.layout||!e||e.width<=0||e.height<=0)return;let t=nt(this.layout,yt(e.width),e.height);if(this.width>0&&this.height>0&&(this.pan.x=e.width/2-(this.width/2-this.pan.x)*t.width/this.layout.width,this.pan.y+=(e.height-this.height)/2),t!==this.layout&&(s(this.renderRoot),this.layout=t,this.requestUpdate()),this.width=e.width,this.height=e.height,this.needsFit||this.fitted){this.fit();return}let{min:n,max:r}=this.zoomMetrics(),i=Math.max(n,Math.min(r,this.zoom));i!==this.zoom&&(this.zoom=i,this.align()),this.drawViewport()}fit(){let e=this.renderRoot.querySelector(`.flow-viewport`)?.getBoundingClientRect();if(!this.layout||!e||e.width<=0||e.height<=0)return;let t=nt(this.layout,yt(e.width),e.height);t!==this.layout&&(s(this.renderRoot),this.layout=t,this.requestUpdate()),this.width=e.width,this.height=e.height,this.zoom=this.fitScale(),this.needsFit=!1,this.fitted=!0,this.align(),this.drawViewport()}zoomBy(e,t=this.width/2,n=this.height/2){let{min:r,max:i}=this.zoomMetrics(),a=Math.max(r,Math.min(i,this.zoom*e)),o=a/this.zoom;a!==this.zoom&&(this.fitted=!1),this.pan.x=t-(t-this.pan.x)*o,this.pan.y=n-(n-this.pan.y)*o,this.zoom=a,this.drawViewport()}wheel(e){e.preventDefault();let t=this.renderRoot.querySelector(`.flow-viewport`).getBoundingClientRect(),n=Math.exp(-e.deltaY*.0015),{min:r}=this.zoomMetrics();if(n<1&&this.zoom<=r*1.0001){this.zoom=r;let e=Math.min(.4,(1-n)*3);this.pan.x+=(vt-this.pan.x)*e,this.pan.y+=((this.height-this.layout.height*r)/2-this.pan.y)*e,this.drawViewport()}else this.zoomBy(n,e.clientX-t.left,e.clientY-t.top)}startPan(e){e.button===0&&(this.suppressClick=!1,this.drag={id:e.pointerId,x:e.clientX,y:e.clientY,pan:{...this.pan},moved:!1})}movePan(e){if(!this.drag||e.pointerId!==this.drag.id)return;let t=e.clientX-this.drag.x,n=e.clientY-this.drag.y;Math.abs(t)+Math.abs(n)>3&&(this.drag.moved=!0),this.drag.moved&&(this.fitted=!1,this.suppressClick=!0,this.chart.setHover(null),this.pan={x:this.drag.pan.x+t,y:this.drag.pan.y+n},this.drawViewport())}endPan(e){e.pointerId===this.drag?.id&&(this.drag=null)}drawViewport(){this.chart.viewportChanged(),this.viewportElements??={label:this.renderRoot.querySelector(`.g2-zoom-pct`),zoomIn:this.renderRoot.querySelector(`[aria-label="Zoom in"]`),zoomOut:this.renderRoot.querySelector(`[aria-label="Zoom out"]`)};let{label:e,zoomIn:t,zoomOut:n}=this.viewportElements,{min:r,max:i,percent:a}=this.zoomMetrics();e&&(e.textContent=`${a}%`),t&&(t.disabled=this.zoom>=i*.9999),n&&(n.disabled=this.zoom<=r*1.0001)}matchesNode(e){if(Ue(e)<this.minSize||this.layout?.hiddenPackages?.has(e.pkg))return!1;let t=i.pathFilter.trim().toLowerCase();if(t&&!`${e.label} ${e.pkg}`.toLowerCase().includes(t))return!1;if(this.graph.issuesHidden)return!0;let n=t=>e.files.some(e=>[...this.model.files.get(e)[t]??[]].some(e=>(t===`severitySet`?i.selectedSeverities:i.selectedColors).has(e)));return(i.selectedSeverities.size===0||n(`severitySet`))&&(i.selectedColors.size===0||n(`colorSet`))}renderLinks(e,t=!1){return e.toSorted((e,t)=>t.size-e.size).slice(0,100).map(e=>{let n=this.model.byId.get(t?e.from:e.to);return bt(n,e.size,()=>this.select(n.id,e.id))})}renderSearch(){if(!i.pathFilter.trim())return null;let e=this.chart.searchMatches();return D`<h4>Matches · ${e.length}</h4>${e.slice(0,100).map(e=>bt(e,e.removable,()=>this.follow(e.id)))} ${e.length>100?D`<p>Showing the 100 largest matches. Refine the search to find any file or package, including those beyond the visible graph.</p>`:null}`}renderPanel(){let e=this.model.byId.get(this.selection?.node),t=this.model.edgeById.get(this.selection?.edge);return e?D`<div class="flow-panel-heading"><h3>${e.label}</h3><button type="button" class="detail-action" aria-label="Clear flow selection" @click="${()=>this.select(null)}">×</button></div>${t?D`<p class="flow-direction">${this.model.byId.get(t.from).label}<br>↓ imports<br>${this.model.byId.get(t.to).label}</p><div class="flow-metrics"><b>${Q(t.size)}</b><span>reachable through this edge · ${t.count} ${t.count===1?`file import`:`file imports`}</span></div>`:null}<div class="flow-metrics"><b>${Q(e.removable)}</b><span>unique size · removed if deleted · bar width</span><b>${Q(e.size)}</b><span>reachable size</span><b>${Q(e.own)}</b><span>own source size · ${e.files.length} ${e.files.length===1?`file`:`files`}</span></div>${this.renderVersions(e)} ${We(e,this.minSize)?D`<p>Kept by Large so retained dependencies remain connected to an entry point.</p>`:null} ${e.removableMissing?D`<p>${e.removableMissing} removed files have unknown sizes; removal totals include known bytes only.</p>`:null} ${e.missing?D`<p>${e.missing} reachable file sizes are unknown.</p>`:null} ${e.virtual?D`<p>Entry source is absent from this bundle; only its recorded imports are counted.</p>`:null}<div class="flow-actions"><button aria-pressed="${!!this.focus}" @click="${()=>this.follow(this.focus?null:e.id)}">Follow imports</button> ${!this.packages&&!e.virtual?D`<button data-bundle-view-source="${this.model.files.get(e.files[0]).origFile??e.files[0]}">View source</button>`:null}</div><h4>Imports · ${e.outgoing.length}</h4>${this.renderLinks(e.outgoing)}<h4>Imported by · ${e.incoming.length}</h4>${this.renderLinks(e.incoming,!0)} ${Math.max(e.incoming.length,e.outgoing.length)>100?D`<p>Showing the 100 largest flows in each direction.</p>`:null}`:D`<h3>Size flow</h3><div class="flow-metrics"><b>${Q(this.model.total.size)}</b><span>unique reachable source</span></div><p>Bar width shows how much source leaves the bundle when a file or package is removed.</p><p>Select a bar or ribbon for details.<br>Double-click a bar to follow its imports.</p>${this.model.total.missing?D`<p>${this.model.total.missing} files have unknown sizes; totals include known bytes only.</p>`:null} ${this.model.weakEdges?D`<p>${this.model.weakEdges} weak config/metadata loads excluded.</p>`:null} ${this.model.omittedFiles?D`<p>${this.model.omittedFiles} files are not reachable from these entry points.</p>`:null}<h4>${this.model.inferred?`Inferred roots (no entry points in this view)`:`Entry points`}</h4>${this.model.roots.slice(0,100).map(e=>{let t=this.model.byId.get(e);return bt(t,t.removable,()=>this.select(e))})} ${this.model.roots.length>100?D`<p>Showing the first 100 entry points. Search to find another.</p>`:null}`}renderVersions(e){if(!e.instances?.length)return null;if(e.instances.length===1){let t=e.instances[0];return D`<div class="flow-versions"><div>${t.version||`Unknown version`}</div><small>${t.directory}</small></div>`}let t=D`<ul class="flow-versions">${e.instances.map(e=>D`<li><div><span>${e.version||`Unknown version`}</span><span>${Q(e.size)}${e.missing?`+`:``}</span></div><small>${e.directory}</small> ${e.missing?D`<small>${e.missing} files have unknown sizes</small>`:null}</li>`)}</ul>`;return g(e.id,D`<details class="flow-versions-details"><summary>Versions: ${e.instances.length}</summary><h4>Own source size</h4>${t}</details>`)}render(){if(!this.layout)return null;let{nodes:e}=this.layout;return D`<section class="flow-stage" aria-label="Dependency size flow" style="${v({"--flow-background":Le()})}"><div class="flow-viewport">${this.chart.render()}${e.length>0?null:D`<p>${this.minSize?`No nodes reach ${Q(this.minSize)}. Turn off Large to show all nodes.`:`No recorded dependency paths in this view.`}</p>`}</div><div class="flow-count">${e.length} ${this.packages?e.length===1?`package`:`packages`:e.length===1?`file`:`files`}</div><div class="g2-zoom-ctrl" role="group" aria-label="Flow zoom"><button aria-label="Zoom in" ?disabled="${this.zoom>=this.zoomMetrics().max*.9999}" @click="${()=>this.zoomBy(1.4)}">+</button><div class="g2-zoom-pct"></div><button aria-label="Zoom out" ?disabled="${this.zoom<=this.zoomMetrics().min*1.0001}" @click="${()=>this.zoomBy(1/1.4)}">−</button> <button class="g2-zoom-fit-btn" aria-label="Fit to view" @click="${()=>this.fit()}">fit</button></div></section><aside class="flow-panel" aria-label="Size flow details" aria-live="polite">${this.renderSearch()}${this.renderPanel()}</aside>`}};customElements.define(`size-flow`,xt);var St=class extends k{static properties={graph:{attribute:!1},options:{attribute:!1},matrixControls:{state:!0},flowControls:{state:!0},issuesWrapped:{state:!0}};static styles=[E(P),E(N),E(A),E(j),E(M)];constructor(){super(),this.graph=null,this.options={},this.matrixControls=null,this.flowControls=null,this.issuesWrapped=!1,this._topbarObserver=null,this._observedControls=null,this._issuesWrapWidth=0}disconnectedCallback(){super.disconnectedCallback(),this._topbarObserver?.disconnect(),this._observedControls=null}connectedCallback(){super.connectedCallback(),l(this.renderRoot)}willUpdate(e){(!this.options.showBundleLayouts||i.bundleLayout!==`matrix`)&&(this.matrixControls=null),(!this.options.showBundleLayouts||i.bundleLayout!==`flow`)&&(this.flowControls=null),(e.has(`graph`)||e.has(`options`)||e.has(`matrixControls`)||e.has(`flowControls`))&&(this._issuesWrapWidth=0)}updated(){this.toggleAttribute(`matrix`,!!this.options.showBundleLayouts&&i.bundleLayout===`matrix`);let e=this.renderRoot.querySelector(`.g2-topbar-controls`);e!==this._observedControls&&typeof ResizeObserver==`function`&&(this._topbarObserver??=new ResizeObserver(()=>this._placeIssues()),this._topbarObserver.disconnect(),e&&this._topbarObserver.observe(e),this._observedControls=e),this._placeIssues()}_placeIssues(){let e=this.renderRoot.querySelector(`.g2-topbar-controls`),t=this.renderRoot.querySelector(`.g2-issues-switch`);if(!e||!t)return;let n=e.clientWidth;this.issuesWrapped?n>this._issuesWrapWidth&&wt(e,t)&&(this.issuesWrapped=!1):Ct(e,t)&&(this._issuesWrapWidth=n,this.issuesWrapped=!0)}render(){return this.graph?this.options.showBundleLayouts&&i.bundleLayout===`flow`?D`<div class="graph2-layout">${he(this.graph,this.options,this.flowControls,{issuesWrapped:this.issuesWrapped})}<size-flow .graph="${this.graph}" .packages="${i.flowPackagesView}" @flow-controls-change="${e=>{this.flowControls=e.detail}}"></size-flow></div>`:this.options.showBundleLayouts&&i.bundleLayout===`matrix`?D`<div class="graph2-layout g2-matrix-layout">${he(this.graph,this.options,this.matrixControls,{issuesWrapped:this.issuesWrapped})}<dependency-matrix .graph="${this.graph}" @matrix-controls-change="${e=>{this.matrixControls=e.detail}}"></dependency-matrix></div>`:D`<div class="graph2-layout">${he(this.graph,this.options,null,{issuesWrapped:this.issuesWrapped})} ${K(this.graph)} ${be()}</div>`:D``}};function Ct(e,t){let n=e.firstElementChild;if(!n||n===t)return!1;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect();return r.height>0&&i.height>0&&r.top>=i.bottom-1}function wt(e,t){let n=[...e.children];if(n.length===0)return!0;let r=n[0].getBoundingClientRect().bottom,i=parseFloat(getComputedStyle(e).columnGap)||0,a=0;for(let e of n){let t=e.getBoundingClientRect();if(t.top>=r-1)return!1;let n=getComputedStyle(e),o=parseFloat(n.flexBasis),s=parseFloat(n.flexGrow)>0&&Number.isFinite(o)?Math.max(parseFloat(n.minWidth)||0,Math.min(t.width,o)):t.width;a+=s+i}return a+t.getBoundingClientRect().width<=e.clientWidth}customElements.define(`graph-layout`,St);function Tt(e,t,n,r){let i=0;for(let e of n)i=Math.max(i,e);if(i===0)return()=>!0;let a=2*i,o=new Map,s=Int32Array.from(e,e=>Math.floor(e/a)),c=Int32Array.from(t,e=>Math.floor(e/a));for(let t=0;t<e.length;t++){let e=`${s[t]}:${c[t]}`;o.has(e)||o.set(e,[]),o.get(e).push(t)}let l=0;return(i,a,u,d)=>{if(n[i]===n[a])return!0;let f=n[i]>n[a]?i:a,p=f===i?d:u;for(let u=s[p]-1;u<=s[p]+1;u++)for(let s=c[p]-1;s<=c[p]+1;s++)for(let c of o.get(`${u}:${s}`)??[]){if(++l>8e6)return!1;let o=r[c];if(o===i||o===a)continue;let s=n[f]+n[o],u=e[p]-e[c],d=t[p]-t[c];if(u*u+d*d<s*s-1e-7)return!1}return!0}}var Et=12,Dt=8,Ot=12,kt=8e6,At=8e6;function jt(e,t,{radiusOf:n}={}){let r=e.nodes;if(r.length<2||e.edges.length===0)return;let i=new Map(r.map((e,t)=>[e.file,t])),a=Float64Array.from(r,e=>e.x),o=Float64Array.from(r,e=>e.y),s=Int32Array.from(r,(e,t)=>t),c=s.slice(),l=n?Tt(a,o,Float64Array.from(r,n),s):null,u=Array.from(r,()=>[]);for(let t of e.edges){let e=i.get(t.a),n=i.get(t.b);e===void 0||n===void 0||e===n||(u[e].push(n),u[n].push(e))}let d=t.map(e=>e.map(e=>i.get(e.file))).filter(e=>e.length>1),f=new Int32Array(Et+Ot),p=new Float64Array(Et),m=0,h=1831565813,g=0,_=()=>(h^=h<<13,h^=h>>>17,h^=h<<5,h>>>0),v=(e,t)=>{let n=a[e]-a[t],r=o[e]-o[t];return Math.sqrt(n*n+r*r)};t:for(let e=0;e<Dt;e++){let t=!1;for(let n of d)for(let r=0;r<n.length;r++){let i=n[e%2?n.length-r-1:r];if(u[i].length===0)continue;if(g+n.length>At)break t;g+=n.length;let d=c[i],h=0,y=0;for(let e of u[i])h+=a[c[e]],y+=o[c[e]];h/=u[i].length,y/=u[i].length;let b=0;if(n.length<=f.length)for(let e of n)f[b++]=e;else{for(let e of n){let t=a[e]-h,n=o[e]-y,r=t*t+n*n;if(b===Et&&r>=p[b-1])continue;let i=Math.min(b,Et-1);for(;i>0&&r<p[i-1];)f[i]=f[i-1],p[i]=p[i-1],i--;f[i]=e,p[i]=r,b<Et&&b++}for(let e=0;e<Ot;e++)f[b++]=n[_()%n.length]}let x=-1,S=-1e-7,C=!1;for(let e=0;e<b;e++){let t=f[e],n=s[t];if(i===n)continue;let r=u[i].length+u[n].length;if(m+r>kt){C=!0;break}m+=r;let a=0;for(let e of u[i])e!==n&&(a+=v(t,c[e])-v(d,c[e]));for(let e of u[n])e!==i&&(a+=v(d,c[e])-v(t,c[e]));a<S&&(!l||l(i,n,d,t))&&(x=n,S=a)}if(x!==-1){let e=c[x];c[i]=e,c[x]=d,s[d]=x,s[e]=i,t=!0}if(C)break t}if(!t)break}for(let e=0;e<r.length;e++)r[e].x=a[c[e]],r[e].y=o[c[e]]}function Mt(e,t,n){let r=[...e].map(([e,t])=>({file:e,...t})),i=new Map(r.map(e=>[e.file,e])),a=[];for(let[e,n]of t)for(let t of n.keys())e<t&&a.push({a:e,b:t});let o=n.map(e=>e.map(e=>i.get(e)));jt({nodes:r,edges:a},o,{radiusOf:e=>e.groupR});for(let t of r){let n=e.get(t.file);n.x=t.x,n.y=t.y}}function Nt(e){let t=new Map;for(let[n,r]of e.importsOf){let i=e.nodeByFile.get(n);if(i)for(let n of r){let r=e.nodeByFile.get(n);r&&i.pkg!==r.pkg&&(t.set(i.pkg,(t.get(i.pkg)??0)+1),t.set(r.pkg,(t.get(r.pkg)??0)+1))}}return t}function Pt(e){if(e.packages.length===0)return null;let t=t=>t===`__own__`||e.ownSourcePackages?.has(t),n=e.packages.find(n=>t(n)&&e.entryPackages?.has(n))??e.packages.find(t);if(n)return n;let r=new Set;for(let[t,n]of e.importedBy){let i=e.nodeByFile.get(t);if(i)for(let t of n){let n=e.nodeByFile.get(t);if(n&&n.pkg!==i.pkg){r.add(i.pkg);break}}}for(let t of e.packages)if(!r.has(t))return t;return null}var Ft=5;function It(e){let t=new Map,n=(t,n)=>[Math.floor(t/e),Math.floor(n/e)];return{add(e,r,i){let a=n(e,r).join(`:`);t.has(a)||t.set(a,[]),t.get(a).push({x:e,y:r,r:i})},fits(e,r,i){let[a,o]=n(e,r);for(let n=a-1;n<=a+1;n++)for(let a=o-1;a<=o+1;a++)for(let o of t.get(`${n}:${a}`)??[])if((o.x-e)**2+(o.y-r)**2<(o.r+i)**2-1e-7)return!1;return!0}}}function Lt(e){return[e.filter(e=>e.isHub),e.filter(e=>!e.isHub)]}function Rt(e,t){let n=new Map;for(let r of e.nodes)t.has(r.pkg)&&(n.has(r.pkg)||n.set(r.pkg,[]),n.get(r.pkg).push(r));for(let e of n.values())e.sort((e,t)=>e.isHub===t.isHub?t.deg-e.deg:e.isHub?-1:1);let r=new Map,i=new Map;for(let[a,o]of t){let t=n.get(a);if(!t||t.length===0)continue;let s=t.length,c=0;for(let e of t)if(e.isHub)c++;else break;let l=c>0&&c<=Ft?c:0,u=s-l,d=o.groupR,f=Array.from({length:s}),p=Array.from({length:s});for(let e=0;e<s;e++){let t=e*137.508*Math.PI/180,n;if(e<l)n=l<=1?0:Math.sqrt(e/(l-1))*.3*d;else{let t=e-l;n=u<=1?.4*d:(.4+Math.sqrt(t/(u-1))*.6)*d}f[e]=o.x+Math.cos(t)*n,p[e]=o.y+Math.sin(t)*n}let m=Array.from({length:s},()=>!1);for(let n=0;n<s;n++){let a=t[n],l=a.isHub?0:c,u=a.isHub?c:s,d=0,h=0,g=0,_=e.importsOf.get(a.file);if(_)for(let e of _){let t=r.get(e);t!==void 0&&(d+=t,h+=i.get(e),g++)}let v=e.importedBy.get(a.file);if(v)for(let e of v){let t=r.get(e);t!==void 0&&(d+=t,h+=i.get(e),g++)}let y=!1;if(g>0){d/=g,h/=g;let e=d-o.x,t=h-o.y;e*e+t*t>1&&(y=!0)}let b=-1;if(y){let e=1/0;for(let t=l;t<u;t++){if(m[t])continue;let n=f[t]-d,r=p[t]-h,i=n*n+r*r;i<e&&(e=i,b=t)}}else for(let e=l;e<u;e++)if(!m[e]){b=e;break}m[b]=!0,a.x=f[b],a.y=p[b],r.set(a.file,a.x),i.set(a.file,a.y)}}jt(e,[...n.values()].flatMap(Lt))}function zt(e,t,n){let r=t/2,i=n/2,a=Math.min(t,n)/2;if(e.packages.length===0)return;let o=Pt(e),s=Nt(e),c=(o?e.packages.filter(e=>e!==o):[...e.packages]).toSorted((t,n)=>{let r=(s.get(n)??0)-(s.get(t)??0);return r===0?(e.pkgCount.get(n)??0)-(e.pkgCount.get(t)??0):r}),l=c.length,u;u=l<=0?0:l<=6?.65:l<=20?.82:.95;let d=Math.max(1,Math.sqrt(50/Math.max(1,l))),f=.12,p=new Map,m;if(o){let t=e.pkgCount.get(o)??0,n=Math.min(.22,(.012+Math.sqrt(t)*.004)*d);m=Math.max(l<=6?.4:l<=20?.36:.34,n+f+.04),p.set(o,{x:r,y:i,size:t,groupR:n*a})}else m=l<=1?0:l<=6?.4:l<=20?.32:.3;if(l===0){Rt(e,p);return}let h=new Map;for(let t of e.edges){if(!t.cross)continue;let n=e.nodeByFile.get(t.a)?.pkg,r=e.nodeByFile.get(t.b)?.pkg;if(!n||!r||n===r)continue;h.has(n)||h.set(n,new Map),h.has(r)||h.set(r,new Map);let i=h.get(n),a=h.get(r);i.set(r,(i.get(r)??0)+1),a.set(n,(a.get(n)??0)+1)}let g=Math.max(1,Math.min(10,Math.round(Math.sqrt(l)/1.2))),_=Array.from({length:g+1});for(let e=0;e<=g;e++)_[e]=Math.floor(e*e/(g*g)*l);_[g]=l;let v=Array.from({length:g}),y=Array.from({length:g});for(let t=0;t<g;t++){let n=_[t],r=_[t+1];v[t]=r-n;let i=0;for(let t=n;t<r;t++)i+=e.pkgCount.get(c[t])??0;y[t]=i}let b=Array.from({length:g});for(let e=0;e<g;e++){let t=(_[e]+_[e+1]-1)/2/Math.max(1,l-1);b[e]=Math.sqrt(Math.max(0,t))}let x=Array.from({length:g});x[0]=b[0];for(let e=1;e<g;e++){let t=v[e-1],n=y[e-1],r=t>0?n/t:1,i=1+.2*Math.sqrt(Math.max(0,r-1));x[e]=x[e-1]+(b[e]-b[e-1])*i}let S=Array.from({length:g});for(let e=0;e<g;e++)S[e]=x[e]-b[e];let C=Array.from({length:l}),w=Array.from({length:l}),T=0;for(let e=0;e<l;e++){for(;T<g-1&&e>=_[T+1];)T++;let t=e*137.508%360*Math.PI/180,n=(l<=1?0:Math.sqrt(e/(l-1)))+S[T],s=l===1?o?m:0:m+n*(u-m);C[e]=r+Math.cos(t)*s*a,w[e]=i+Math.sin(t)*s*a}let E=It(2*f*a);for(let t=0;t<g;t++){let n=_[t],o=_[t+1],s=o-n;if(s===0)continue;let l=Array.from({length:s},()=>!1);for(let t=n;t<o;t++){let o=c[t],u=e.pkgCount.get(o)??0,m=Math.min(f,(.012+Math.sqrt(u)*.004)*d)*a,g=e=>E.fits(C[n+e],w[n+e],m),_=h.get(o),v=0,y=0,b=0;if(_)for(let[e,t]of _){let n=p.get(e);n&&(v+=n.x*t,y+=n.y*t,b+=t)}let x=!1;if(b>0){v/=b,y/=b;let e=v-r,t=y-i;e*e+t*t>1&&(x=!0)}let S=e=>{let t=-1;if(x){let r=1/0;for(let i=0;i<s;i++){if(l[i]||!e(i))continue;let a=n+i,o=C[a]-v,s=w[a]-y,c=o*o+s*s;c<r&&(r=c,t=i)}}else for(let n=0;n<s;n++)if(!l[n]&&e(n)){t=n;break}return t},T=S(()=>!0);if(!g(T)){let e=S(g);e>=0&&(T=e)}l[T]=!0;let D=n+T;p.set(o,{x:C[D],y:w[D],size:u,groupR:m}),E.add(C[D],w[D],m)}}Mt(p,h,Array.from({length:g},(e,t)=>c.slice(_[t],_[t+1]))),Bt(p,o),Rt(e,p)}function Bt(e,t){let n=[...e].map(([e,n])=>({info:n,pinned:e===t}));for(let e=0;e<100;e++){n.sort((e,t)=>e.info.x-e.info.groupR-(t.info.x-t.info.groupR));let e=!1;for(let t=0;t<n.length;t++){let r=n[t].info;for(let i=t+1;i<n.length;i++){let a=n[i].info;if(a.x-a.groupR>r.x+r.groupR)break;let o=a.x-r.x,s=a.y-r.y,c=Math.hypot(o,s),l=r.groupR+a.groupR;if(c>=l-.5)continue;let u=n[t].pinned?0:a.groupR**2,d=n[i].pinned?0:r.groupR**2;if(u+d===0)continue;let f=(l-c)/(u+d),p=c>1e-9?o/c:1,m=c>1e-9?s/c:0;r.x-=p*f*u,r.y-=m*f*u,a.x+=p*f*d,a.y+=m*f*d,e=!0}}if(!e)return}}function Vt(e,t,n){let r=t/2,i=n/2,a=Math.min(t,n)/2,o=e.nodes.length;if(o===0)return;let s=[],c=[],l=[];for(let t of e.nodes)t.pkg===`__own__`||e.ownSourcePackages?.has(t.pkg)?e.entryPackages?.has(t.pkg)?c.push(t):l.push(t):s.push(t);let u=(e,t)=>t.deg-e.deg,d=[c,l,s].flatMap(Lt),f=d.flatMap(e=>e.toSorted(u));for(let e=0;e<o;e++){let t=f[e],n=e*137.508%360*Math.PI/180,s=o<=1?0:Math.sqrt(e/(o-1));t.x=r+Math.cos(n)*s*.85*a,t.y=i+Math.sin(n)*s*.85*a}jt(e,d)}function Ht(e,t,r,i,{groupOf:a=n}={}){let o=e.length,s=i||760,c=r||1100,l=Math.sqrt(c*s/Math.max(o,1))*1.1,u=e=>{let t=0;for(let n of e)t=t*31+n.codePointAt(0)|0;return t},d=Math.ceil(Math.sqrt(o*c/s)),f=s/(Math.ceil(o/d)+1),p=c/(d+1),m=e.map((e,t)=>{let n=t%d,r=Math.floor(t/d),i=u(e);return{file:e,x:(n+1)*p+(i%100-50)*p*.4,y:(r+1)*f+((i>>7)%100-50)*f*.4,dx:0,dy:0}}),h=new Map(m.map((e,t)=>[e.file,t])),g=[];for(let n of e)for(let e of t.get(n)??[])h.has(e)&&g.push([h.get(n),h.get(e)]);let _=new Map;for(let e=0;e<o;e++){let t=a(m[e].file)??`__own__`;_.has(t)||_.set(t,[]),_.get(t).push(e)}let v=Math.min(500,Math.max(180,100+o*3)),y=Math.min(c,s)/6;for(let e=0;e<v;e++){let t=y*(.3/y)**(e/v);for(let e of m)e.dx=0,e.dy=0;for(let e=0;e<o;e++)for(let t=e+1;t<o;t++){let n=m[e],r=m[t],i=n.x-r.x,a=n.y-r.y,o=Math.sqrt(i*i+a*a);if(o<.01){let e=u(n.file+r.file);i=(e%100-50)*.01||.5,a=((e>>7)%100-50)*.01||.5,o=Math.sqrt(i*i+a*a)}let s=l*l/o;n.dx+=i/o*s,n.dy+=a/o*s,r.dx-=i/o*s,r.dy-=a/o*s}for(let[e,t]of g){let n=m[e],r=m[t],i=n.x-r.x,a=n.y-r.y,o=Math.sqrt(i*i+a*a)||.01,s=o*o/l;n.dx-=i/o*s,n.dy-=a/o*s,r.dx+=i/o*s,r.dy+=a/o*s}let n=.055*Math.min(1,t/(y*.3));for(let[,e]of _){if(e.length<2)continue;let t=0,r=0;for(let n of e)t+=m[n].x,r+=m[n].y;t/=e.length,r/=e.length;for(let i of e)m[i].dx+=(t-m[i].x)*n,m[i].dy+=(r-m[i].y)*n}for(let e of m){let n=Math.sqrt(e.dx*e.dx+e.dy*e.dy)||.01;e.x+=e.dx/n*Math.min(n,t),e.y+=e.dy/n*Math.min(n,t),e.x=Math.max(50,Math.min(c-50,e.x)),e.y=Math.max(50,Math.min(s-50,e.y))}}return m}function Ut(e,t,n,{statsHeight:r=0,left:i=0,right:a=i,top:o=0,bottom:s=o}={}){let c=Math.max(20,t*.04),l=Math.max(20,n*.04),u=Math.max(1,t-c*2-i-a),d=Math.max(1,n-l*2-r-o-s),f=-1/0,p=-1/0,m=1/0,h=1/0;for(let t of e)m=Math.min(m,t.x),f=Math.max(f,t.x),h=Math.min(h,t.y),p=Math.max(p,t.y);if(e.length===0)return{k:1,tx:t/2,ty:(n-r)/2};let g=Math.min(4,u/Math.max(20,f-m),d/Math.max(20,p-h));return{k:g,tx:c+i+u/2-(m+f)/2*g,ty:l+o+d/2-(h+p)/2*g}}function Wt(e,t,n,{width:r=900,rowHeight:i=52,gap:a=42}={}){let o=new Map(e.map(e=>[e.id,e])),s=new Map,c=[];for(let e of n)o.has(e)&&!s.has(e)&&(s.set(e,0),c.push(e));for(let e=0;e<c.length;e++){let n=c[e];for(let e of t.get(n)??[])!o.has(e)||s.has(e)||(s.set(e,s.get(n)+1),c.push(e))}let l=new Map;for(let t of e){let e=s.get(t.id)??null;l.has(e)||l.set(e,[]),l.get(e).push(t)}let u=new Map(e.map(e=>[e.id,[]]));for(let[e,n]of t)if(o.has(e))for(let t of new Set(n))u.get(t)?.push(e);let d=[],f=new Map,p=[...l.keys()].toSorted((e,t)=>(e??1/0)-(t??1/0)),m=e=>Number.isFinite(e.size)&&e.size>0?e.size:0;for(let e of p){let t=l.get(e).slice(),n=new Map(t.map(t=>{let n=u.get(t.id).map(e=>f.get(e)).filter(t=>t&&e!==null&&t.level===e-1);return[t.id,n.length>0?n.reduce((e,t)=>e+t.x+t.width/2,0)/n.length:r/2]}));t.sort((e,t)=>n.get(e.id)-n.get(t.id)||String(e.id).localeCompare(String(t.id)));let o=0;for(let e=1;e<t.length;e++)m(t[e])>m(t[o])&&(o=e);o>0&&t.unshift(t.splice(o,1)[0]);let s=t.reduce((e,t)=>e+m(t),0),c=d.length*(i+a),p=0;for(let n of t){let a=r*(s>0?m(n)/s:1/t.length);f.set(n.id,{id:n.id,level:e,x:p,y:c,width:a,height:i}),p+=a}d.push({level:e,y:c,size:s,proportional:s>0,ids:t.map(e=>e.id)})}let h=[];for(let[e,n]of t)if(f.has(e))for(let t of new Set(n))e!==t&&f.has(t)&&h.push({from:e,to:t});h.sort((e,t)=>String(e.from).localeCompare(String(t.from))||String(e.to).localeCompare(String(t.to)));let g=new Map,_=new Map;for(let e of h)_.has(e.from)||_.set(e.from,[]),g.has(e.to)||g.set(e.to,[]),_.get(e.from).push(e),g.get(e.to).push(e);for(let e of _.values())e.sort((e,t)=>f.get(e.to).x-f.get(t.to).x);for(let e of g.values())e.sort((e,t)=>f.get(e.from).x-f.get(t.from).x);for(let e of _.values())e.forEach((t,n)=>{t.sourcePort=(n+1)/(e.length+1)});for(let e of g.values())e.forEach((t,n)=>{t.targetPort=(n+1)/(e.length+1)});let v=d.reduce((e,t)=>e+t.size,0);for(let e of d)e.share=v>0?e.size/v:null;return{levels:d,rects:f,edges:h,depth:s,totalSize:v,width:r,height:d.length>0?d.length*(i+a)-a:0,gap:a}}function Gt(e,t,{theme:n,scale:r,colorOf:i,labelOf:a,sizeLabel:o,dimmed:s,selected:c,hovered:l}){let u=l??c,d=new Set([u]);for(let e of t.edges)e.from===u&&d.add(e.to),e.to===u&&d.add(e.from);let f=e=>e===u||e===c?1:s(e)?.13:u&&!d.has(e)?.22:1;e.save(),e.lineJoin=`round`;for(let n of t.edges){let a=t.rects.get(n.from),o=t.rects.get(n.to),s=n.from===u||n.to===u;e.globalAlpha=Math.min(f(n.from),f(n.to))*(s?.9:.5),e.strokeStyle=i(n.from),e.fillStyle=i(n.from),e.lineWidth=(s?1.6:1)/r;let c=a.x+a.width*n.sourcePort,l=a.y+a.height,d=o.x+o.width*n.targetPort,p=o.y,m=0,h=1;if(e.beginPath(),e.moveTo(c,l),o.y>a.y){let t=(l+p)/2;e.bezierCurveTo(c,t,d,t,d,p)}else if(o.y===a.y){p=o.y+o.height;let n=l+t.gap*.65;e.bezierCurveTo(c,n,d,n,d,p),h=-1}else{d=o.x+o.width,p=o.y+o.height*n.targetPort;let r=t.width+16+n.sourcePort*20;e.bezierCurveTo(c,l+t.gap/2,r,l+t.gap/2,r,l),e.lineTo(r,p+8),e.quadraticCurveTo(r,p,d,p),m=-1,h=0}e.stroke();let g=3/r;e.beginPath(),e.moveTo(d,p),e.lineTo(d-m*g-h*g,p-h*g+m*g),e.lineTo(d-m*g+h*g,p-h*g-m*g),e.closePath(),e.fill()}e.globalAlpha=1,e.textBaseline=`middle`,e.textAlign=`right`,e.fillStyle=n.labelDefault,e.font=`11px system-ui, sans-serif`;let p=n.edgeIntra(.16);for(let r of t.levels){let t=r.y+26;e.strokeStyle=p,e.lineWidth=3,e.beginPath(),e.arc(-112,t,18,0,Math.PI*2),e.stroke(),r.share!==null&&r.share>0&&(e.strokeStyle=n.labelDefault,e.beginPath(),e.arc(-112,t,18,-Math.PI/2,-Math.PI/2+r.share*Math.PI*2),e.stroke()),e.textAlign=`center`,e.font=`9px system-ui, sans-serif`;let i=r.share===null?`—`:r.share>0&&r.share<.001?`<0.1%`:`${Number((r.share*100).toFixed(1))}%`;e.fillText(i,-112,t),e.textAlign=`right`,e.font=`11px system-ui, sans-serif`,e.fillText(r.level===null?`Unreached`:r.level===0?`App`:`Level ${r.level}`,-12,r.y+19),e.font=`10px system-ui, sans-serif`,e.fillText(r.proportional?o(r.size):`No size data`,-12,r.y+35),e.font=`11px system-ui, sans-serif`}e.textAlign=`left`;for(let s of t.rects.values()){let{id:t,x:u,y:d,width:p,height:m}=s;if(p<=0)continue;let h=i(t),g=Re(h);if(e.globalAlpha=f(t),e.fillStyle=h,e.fillRect(u,d,p,m),e.save(),e.beginPath(),e.rect(u,d,p,m),e.clip(),e.strokeStyle=n.bg,e.lineWidth=1/r,p*r>=2?e.strokeRect(u,d,p,m):(e.beginPath(),e.moveTo(u,d),e.lineTo(u+p,d),e.moveTo(u,d+m),e.lineTo(u+p,d+m),e.stroke()),t===c||t===l){e.strokeStyle=n.selectRing,e.lineWidth=Math.min(1.5/r,p/4);let t=e.lineWidth/2;e.strokeRect(u+t,d+t,Math.max(0,p-t*2),m-t*2)}if(p*r<28){e.restore();continue}e.beginPath(),e.rect(u+7,d+4,Math.max(0,p-14),m-8),e.clip(),e.fillStyle=g,e.font=`500 12px system-ui, sans-serif`,e.fillText(a(t),u+9,d+21),e.fillStyle=g,e.font=`10px system-ui, sans-serif`,e.fillText(o(t),u+9,d+38),e.restore()}e.restore()}function Kt(e,t,n=[],{width:r=1200,height:i=800,cycleImportsOf:a=t}={}){e=[...new Set(e)].toSorted();let o=new Set(e),s=new Map(e.map(e=>[e,[...new Set(t.get(e)??[])].filter(t=>t!==e&&o.has(t)).toSorted()])),c=new Map(e.map(e=>[e,new Set(a.get(e)??[])])),l=new Map(e.map(e=>[e,[]]));for(let[e,t]of s)for(let n of t)l.get(n).push(e);let{groups:u,componentOf:d}=p(e,c),f=u.filter(e=>e.length>1),m=new Set(f.flat()),h=u.map(()=>new Set),g=u.map(()=>0);for(let[e,t]of s)for(let n of t){if(!c.get(e).has(n))continue;let t=d.get(e),r=d.get(n);t!==r&&!h[t].has(r)&&(h[t].add(r),g[r]++)}let _=new Set(n.map(e=>d.get(e)).filter(e=>e!==void 0)),v=u.map(()=>0),y=[],b=new Set,x=e=>{b.has(e)||(b.add(e),y.push(e))};_.forEach(x),g.forEach((e,t)=>{e||x(t)});for(let e=0;e<y.length;e++){let t=y[e];for(let e of h[t])_.has(e)||(v[e]=Math.max(v[e],v[t]+1)),--g[e]===0&&x(e)}let S=new Map(e.map(e=>[e,v[d.get(e)]])),C=new Map;for(let t of e){let e=S.get(t);C.has(e)||C.set(e,[]),C.get(e).push(t)}let w=[...C.keys()].toSorted((e,t)=>e-t),T=new Map,E=e=>e.forEach((t,n)=>T.set(t,(n+.5)/e.length));for(let e of C.values())E(e);for(let e=0;e<12;e++)for(let t of e%2?w.toReversed():w){let n=C.get(t),r=new Map(n.map(t=>{let n=(e%2?s:l).get(t);return[t,n.length>0?n.reduce((e,t)=>e+T.get(t),0)/n.length:T.get(t)]}));n.sort((e,t)=>r.get(e)-r.get(t)||T.get(e)-T.get(t)||e.localeCompare(t)),E(n)}let D=Math.max(.6,Math.min(2.4,r/Math.max(1,i))),O=Math.max(160,Math.sqrt(e.length*1100*D)),k=Math.max(120,O/D),A=w.at(-1)??0,j=new Map;for(let[e,t]of C)t.forEach((t,n)=>{let r=T.get(t)*O,i=(e+.5)/(A+1)*k;j.set(t,{id:t,x:r,y:i+(n%5-2)*9,anchorY:i,vx:0,vy:0,level:e,cycle:m.has(t),degree:s.get(t).length+l.get(t).length})});let M=[];for(let[e,t]of s)for(let n of t)M.push({from:e,to:n,cycle:c.get(e).has(n)&&m.has(e)&&d.get(e)===d.get(n)});let N=M.map(e=>{let t=j.get(e.from),n=j.get(e.to);return{a:t,b:n,length:26+Math.sqrt(Math.max(t.degree,n.degree))*5,strength:.065/Math.sqrt(Math.min(t.degree,n.degree)||1),cycle:e.cycle}}),P=[...j.values()];for(let e=0;e<240;e++){let t=new Map,n=7*(1-e/240)+.15;for(let e=0;e<P.length;e++){let n=P[e];n.fx=(O/2-n.x)*.002,n.fy=(n.anchorY-n.y)*.018,n.gx=Math.floor(n.x/80),n.gy=Math.floor(n.y/80);let r=`${n.gx},${n.gy}`;t.has(r)||t.set(r,[]),t.get(r).push(e)}for(let e=0;e<P.length;e++){let n=P[e];for(let r=n.gx-1;r<=n.gx+1;r++)for(let i=n.gy-1;i<=n.gy+1;i++)for(let a of t.get(`${r},${i}`)??[]){if(a<=e)continue;let t=P[a],r=n.x-t.x,i=n.y-t.y,o=r*r+i*i;if(o>6400)continue;o<.01&&(r=e%2?.1:-.1,i=.1);let s=Math.hypot(r,i),c=Math.min(18,100/s-100/80+Math.max(0,22-s)*.6),l=r/s*c,u=i/s*c;n.fx+=l,n.fy+=u,t.fx-=l,t.fy-=u}}for(let{a:e,b:t,length:n,strength:r,cycle:i}of N){let a=t.x-e.x,o=t.y-e.y,s=Math.hypot(a,o)||1,c=(s-n)*r,l=a/s*c,u=o/s*c;if(e.fx+=l,e.fy+=u,t.fx-=l,t.fy-=u,!i&&o<22){let n=(22-o)*.018;e.fy-=n,t.fy+=n}}for(let e of P){e.vx=(e.vx+e.fx)*.55,e.vy=(e.vy+e.fy)*.55;let t=Math.hypot(e.vx,e.vy)||1,r=Math.min(1,n/t);e.x+=e.vx*r,e.y+=e.vy*r}}let F=-1/0,I=-1/0,L=1/0,R=1/0;for(let e of P)L=Math.min(L,e.x),R=Math.min(R,e.y),F=Math.max(F,e.x),I=Math.max(I,e.y);for(let e of P)e.x+=16-L,e.y+=16-R;return{nodes:j,edges:M,depth:S,incoming:l,links:s,cycles:f,roots:new Set(n.filter(e=>o.has(e))),width:P.length>0?F-L+32:32,height:P.length>0?I-R+32:32}}function qt(e){return Math.max(2.5,Math.min(6,4.5*Math.sqrt(e)))}function Jt(e,t,n,{theme:r,viewport:i,width:a,height:o,colorOf:s,dimmed:c,selected:l,hovered:u,query:d}){let{k:f,tx:p,ty:m}=i,h=qt(f),g=u??l,_=new Set([g,...t.links.get(g)??[],...t.incoming.get(g)??[]]),v=new Map;for(let[e,r]of t.nodes){let t=n.nodeByFile.get(e);v.set(e,{x:r.x*f+p,y:r.y*f+m,color:s(t.pkg),n:t,p:r,dim:e===g||e===l?1:c(t)?.12:g&&!_.has(e)?.16:1})}e.save();let y=(t,i)=>{let s=v.get(t.from),c=v.get(t.to);if(Math.max(s.x,c.x)<-40||Math.min(s.x,c.x)>a+40||Math.max(s.y,c.y)<-80||Math.min(s.y,c.y)>o+80)return;e.globalAlpha=i?.85:Math.min(s.dim,c.dim)*(g?.12:.22),e.strokeStyle=i?s.color:r.labelDefault,e.lineWidth=i?1.4:.7,e.setLineDash(t.cycle?[3,3]:[]);let l=c.x-s.x,u=c.y-s.y,d=Math.hypot(l,u)||1,p=l/d,m=u/d,_=s.x+p*(h+1),y=s.y+m*(h+1),b=c.x-p*(h+3),x=c.y-m*(h+3),S=t.cycle?Math.min(18,d*.15):0,C=(_+b)/2-m*S,w=(y+x)/2+p*S;if(e.beginPath(),e.moveTo(_,y),e.quadraticCurveTo(C,w,b,x),e.stroke(),i||f>=.85||n.nodes.length<=50){let t=Math.atan2(x-w,b-C),n=i?5:3.5;e.setLineDash([]),e.fillStyle=e.strokeStyle,e.beginPath(),e.moveTo(b,x),e.lineTo(b-Math.cos(t-.5)*n,x-Math.sin(t-.5)*n),e.lineTo(b-Math.cos(t+.5)*n,x-Math.sin(t+.5)*n),e.closePath(),e.fill()}};for(let e of t.edges)e.from!==g&&e.to!==g&&y(e,!1);for(let e of t.edges)(e.from===g||e.to===g)&&y(e,!0);e.setLineDash([]);let b=new Map,x=e=>{let t=[];for(let n=Math.floor(e.x/64);n<=Math.floor((e.x+e.w)/64);n++)for(let r=Math.floor(e.y/24);r<=Math.floor((e.y+e.h)/24);r++)t.push(`${n},${r}`);return t},S=e=>{for(let t of x(e))b.has(t)||b.set(t,[]),b.get(t).push(e)},C=(e,t)=>e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h,w=[...v.values()].filter(e=>e.x>=-10&&e.x<=a+10&&e.y>=-10&&e.y<=o+10);for(let t of w)e.globalAlpha=t.dim,e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,h,0,Math.PI*2),e.fill(),(t.p.cycle||t.n.totalIssues>0)&&(e.strokeStyle=t.p.cycle?`#c47ad7`:t.color,e.lineWidth=1,e.beginPath(),e.arc(t.x,t.y,h+2.5,0,Math.PI*2),e.stroke()),(t.n.file===l||t.n.file===u)&&(e.strokeStyle=r.selectRing,e.lineWidth=1.5,e.beginPath(),e.arc(t.x,t.y,h+4,0,Math.PI*2),e.stroke()),S({x:t.x-h-2,y:t.y-h-2,w:h*2+4,h:h*2+4});e.font=`11px SFMono-Regular, Consolas, "Liberation Mono", monospace`,e.textBaseline=`top`,e.textAlign=`center`,w.sort((e,n)=>{let r=e=>e.n.file===g?1e9:e.n.file===l?1e8:d&&e.dim===1?1e7:g&&_.has(e.n.file)?1e6:t.roots.has(e.n.file)?1e5:e.n.deg;return r(n)-r(e)});let T=0;for(let t of w){let n=t.n.file===g||t.n.file===l;if(!n&&t.dim<.5||!n&&!d&&!g&&f<1&&T>=24)continue;let i=t.n.label.length>38?`${t.n.label.slice(0,36)}\u2026`:t.n.label,s=e.measureText(i).width+8,c={x:t.x-s/2,y:t.y+h+5,w:s,h:16};c.x<4||c.x+c.w>a-4||c.y+c.h>o-24||!n&&x(c).some(e=>b.get(e)?.some(e=>C(c,e)))||(S(c),T++,e.globalAlpha=.94,e.fillStyle=r.bg,e.fillRect(c.x,c.y-1,c.w,c.h),e.globalAlpha=1,e.fillStyle=n?r.labelSelected:r.labelDefault,e.fillText(i,t.x,c.y))}e.restore()}function Yt(e){let t=e.nodes.map(e=>({node:e})),n=new Map(t.map(e=>[e.node.file,e]));return{nodes:t,edges:e.edges.flatMap(e=>{let t=n.get(e.a),r=n.get(e.b);return t&&r?[{edge:e,a:t,b:r}]:[]}),graph:e,selected:void 0,neighbors:new Set}}function Xt(e,{viewport:t,selected:n,visible:r,dimmed:i,radius:a,color:o,paintKey:s}){if(s===void 0||e.paintKey!==s){let n=new Map;for(let s of e.nodes){let e=s.node;s.visible=r(e),s.visible&&(s.x=e.x*t.k+t.tx,s.y=e.y*t.k+t.ty,s.radius=a(e),s.dimmed=i(e),n.has(e.pkg)||n.set(e.pkg,o(e.pkg)),s.color=n.get(e.pkg))}e.paintKey=s}if(e.selected!==n){e.selected=n,e.neighbors.clear();for(let t of e.graph.adj.get(n)??[]){let n=e.graph.edges[t];e.neighbors.add(n.a),e.neighbors.add(n.b)}}}function Zt(e,t,n,r){if(e.paints&&e.edgeOpacity===t&&e.neutral===n&&e.edgeSelected===r)return e.paints;let i=e=>({opacity:Math.max(0,Math.min(255,Math.round(e*255)))/255,neutral:n(e*.7)}),a=r?t*.25:t,o=r?.85:Math.min(.9,t+.5);return e.paints={base:i(a),emphasis:i(o),baseDim:i(Math.min(a,.04)),emphasisDim:i(Math.min(o,.04))},e.edgeOpacity=t,e.neutral=n,e.edgeSelected=r,e.paints}function Qt(e,t){let{a:n,b:r}=e;return(!e.gradient||e.ax!==n.node.x||e.ay!==n.node.y||e.bx!==r.node.x||e.by!==r.node.y||e.colorA!==n.color||e.colorB!==r.color)&&(e.gradient=t.createLinearGradient(n.node.x,n.node.y,r.node.x,r.node.y),e.gradient.addColorStop(0,n.color),e.gradient.addColorStop(1,r.color),e.ax=n.node.x,e.ay=n.node.y,e.bx=r.node.x,e.by=r.node.y,e.colorA=n.color,e.colorB=r.color),e.gradient}function $t(e,t,n){return(!e.halo||e.haloX!==e.x||e.haloY!==e.y||e.haloRadius!==t||e.haloColor!==e.color)&&(e.halo=n.createRadialGradient(e.x,e.y,0,e.x,e.y,t),e.halo.addColorStop(0,e.color+`55`),e.halo.addColorStop(1,e.color+`00`),e.haloX=e.x,e.haloY=e.y,e.haloRadius=t,e.haloColor=e.color),e.halo}function en(e,t,n,r){return e.x<-2&&t.x<-2||e.x>n+2&&t.x>n+2||e.y<-2&&t.y<-2||e.y>r+2&&t.y>r+2}function tn(e,t,n,r,i){return e+n<-2||e-n>r+2||t+n<-2||t-n>i+2}function nn(e){let t=2166136261;for(let n of e.files){for(let e=0;e<n.length;e++)t=Math.imul(t^n.codePointAt(e),16777619);t=Math.imul(t^10,16777619)}return[e.viewId??``,t>>>0,e.files.length,e.edges.length,i.bundleLayout,i.packagesView,i.dependencyPackagesView,i.focusedPkg,i.showAll].join(`|`)}function rn(e){let t=new Map;for(let[n,r]of e.entries()){let e=Math.floor(r.x/32),i=Math.floor(r.y/32);t.has(e)||t.set(e,new Map);let a=t.get(e);a.has(i)||a.set(i,[]),a.get(i).push({node:r,index:n})}return(e,n,r,i,a,o)=>{let{k:s,tx:c,ty:l}=r,u=(i+6)/s+1e-7,d=(e-c)/s,f=(n-l)/s,p=Math.floor((d-u)/32),m=Math.floor((d+u)/32),h=Math.floor((f-u)/32),g=Math.floor((f+u)/32),_=null,v=1/0,y=1/0;for(let r=p;r<=m;r++){let i=t.get(r);if(i)for(let t=h;t<=g;t++)for(let{node:r,index:u}of i.get(t)??[]){if(!o(r))continue;let t=r.x*s+c-e,i=r.y*s+l-n,d=t*t+i*i,f=a(r)+6;d<f*f&&(d<v||d===v&&u<y)&&(_=r,v=d,y=u)}}return _}}function an(e,t,n,r,i){if(!e||e.key!==t.key)return null;let a=(t.tx-e.tx)*i,o=(t.ty-e.ty)*i;if(!Number.isInteger(a)||!Number.isInteger(o)||!Number.isInteger(a/i)||!Number.isInteger(o/i)||!a&&!o||Math.abs(a)>=n*i||Math.abs(o)>=r*i)return null;let s=a/i,c=o/i,l=[];return s>0&&l.push({x:0,y:0,w:Math.min(n,s+2),h:r}),s<0&&l.push({x:Math.max(0,n+s-2),y:0,w:Math.min(n,-s+2),h:r}),c>0&&l.push({x:0,y:0,w:n,h:Math.min(r,c+2)}),c<0&&l.push({x:0,y:Math.max(0,r+c-2),w:n,h:Math.min(r,-c+2)}),{dx:a,dy:o,rects:l}}function on(e,t,n,r,i){return e&&e.rects.every(e=>r<e.x||t>e.x+e.w||i<e.y||n>e.y+e.h)}var sn={critical:`#ff5470`,high:`#ff9d4a`,medium:`#f4d35e`,low:`#67c2ff`,high_bug:`#a06c3f`,bug:`#7a6d62`,informational:`#218bff`},cn={dark:{bg:X.dark,grid:`rgba(255, 255, 255, 0.022)`,selectRing:`#ffffff`,edgeIntra:e=>`rgba(180, 195, 215, ${e})`,hubRing:e=>`rgba(255, 255, 255, ${e})`,labelFill:`rgba(230, 233, 238, 0.78)`,labelShadow:`rgba(12, 12, 12, 0.98)`,labelOutline:`rgba(12, 12, 12, 0.9)`,labelDefault:`rgba(200, 210, 225, 0.78)`,labelHover:`rgba(230, 237, 243, 0.95)`,labelSelected:`#fff`},light:{bg:X.light,grid:`rgba(0, 0, 0, 0.04)`,selectRing:`#0969da`,edgeIntra:e=>`rgba(50, 70, 100, ${e})`,hubRing:e=>`rgba(0, 0, 0, ${e})`,labelFill:`rgba(40, 50, 70, 0.85)`,labelShadow:`rgba(255, 255, 255, 0.95)`,labelOutline:`rgba(255, 255, 255, 0.9)`,labelDefault:`rgba(50, 60, 80, 0.85)`,labelHover:`rgba(20, 25, 35, 0.95)`,labelSelected:`#000`},pink:{bg:X.pink,grid:`rgba(0, 0, 0, 0.04)`,selectRing:`#0969da`,edgeIntra:e=>`rgba(50, 70, 100, ${e})`,hubRing:e=>`rgba(0, 0, 0, ${e})`,labelFill:`rgba(40, 50, 70, 0.85)`,labelShadow:`rgba(255, 255, 255, 0.95)`,labelOutline:`rgba(255, 255, 255, 0.9)`,labelDefault:`rgba(50, 60, 80, 0.85)`,labelHover:`rgba(20, 25, 35, 0.95)`,labelSelected:`#000`}},ln={...cn.light,bg:X.paper,selectRing:`#000`,edgeIntra:e=>`rgba(0, 0, 0, ${e})`,labelFill:`#000`,labelShadow:`#fff`,labelOutline:`#fff`,labelDefault:`#000`,labelHover:`#000`},un={...cn.light,bg:X.w95,selectRing:`#000080`};function dn(){let e=document.body.classList;return e.contains(`theme-paper`)?ln:e.contains(`theme-pink`)?cn.pink:e.contains(`theme-w95`)?un:e.contains(`theme-light`)?cn.light:cn.dark}var fn=(e,t)=>e.x0<t.x1&&t.x0<e.x1&&e.y0<t.y1&&t.y0<e.y1;function pn(e){e.sort((e,t)=>t.prio-e.prio);let t=[];for(let n of e){let e=!1;for(let r of t)if(fn(n,r)){e=!0;break}e||t.push(n)}return t}var mn=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function $(e){return mn[Math.max(0,Math.min(255,Math.round(e*255)))]}function hn(e,n,o,s){let c=e.querySelector(`graph-layout`)?.shadowRoot;if(!c)return;let l=c.querySelector(`#g2-canvas`),u=c.querySelector(`#g2-tooltip`),d=c.querySelector(`.graph2-stage`),f=c.querySelector(`.g2-stage-stats`),p=c.querySelector(`#g2-zoom-pct`);if(!l)return;a({keepViewport:!0});let m=nn(n),h=i.keptViewport?.key===m?i.keptViewport:null;i.keptViewport=null;let g=l.getContext(`2d`),_=window.devicePixelRatio||1,y=0,b=0,x=0,S={tx:0,ty:0,k:1},C=null,w=h?.layoutH??0,T=h?.layoutW??0,E=!0,k=!h,A=new WeakMap,j=null,M=null,N=null,P=()=>n.supportsLayers&&i.bundleLayout===`layers`&&!i.focusedPkg,F=()=>n.supportsLayers&&i.bundleLayout===`dependencies`&&!i.focusedPkg,I=()=>F()&&!ue(n,i.dependencyPackagesView),L=()=>P()||i.bundleLayout===`graph`&&(n.packagesOnly||i.packagesView&&(n.canPackagesView??!1))&&!i.focusedPkg,R=null,B=null,V=te(n,se(n,ae)),H=null;function U(){if(!H){let e=se(ee(n),oe);if(H=ee(te(n,e)),P()&&n.layerRoots?.appImports.length>0){if(!H.byPkg.has(`__own__`)){let e={file:`__own__`,pkg:`__own__`,label:`App (source not bundled)`,size:null,fileCount:0,totalIssues:0};H.nodes.push(e),H.byPkg.set(`__own__`,e)}H.importsOf.set(`__own__`,[...new Set([...H.importsOf.get(`__own__`)??[],...n.layerRoots.appImports.filter(t=>!e.has(t))])])}}return H}function W(){return fe(n,i.dependencyPackagesView)}let ce=e=>e===`__own__`?`App`:R?.depth.get(e)===0?`App \xB7 ${z(e)}`:z(e);function le(e,t,n){if(e.nodes.length>50){Vt(e,t,n);return}let r=Ht(e.nodes.map(e=>e.pkg),e.importsOf,t,n,{groupOf:e=>e});de(e.nodes,new Map(r.map(e=>[e.file,e])))}function de(e,t){for(let n of e){let e=t.get(n.file);e&&(n.x=e.x,n.y=e.y)}}function pe(){if(!E)return;if(M=null,N=null,j=null,P()){let e=U();R=Wt(e.nodes.map(e=>({id:e.pkg,size:e.size})),e.importsOf,n.layerRoots?.roots??[`__own__`],{width:Math.max(360,T-190)}),E=!1;return}if(F()){let e=W();B=Kt(e.nodes.map(e=>e.file),e.importsOf,e.fileLevel?[]:n.layerRoots?.roots??[],{width:T,height:w,cycleImportsOf:e.cycleImportsOf}),E=!1;return}let e=i.layoutCache,t=i.focusedPkg,r=L(),a=r?U().nodes:V.nodes;if(e&&e.files===n.files&&e.w===T&&e.h===w&&e.focused===t&&(e.pkgView??!1)===r)de(a,e.pos);else{if(r)le(U(),T,w);else if(t){if(V.nodes.length>50)Vt(V,T,w);else{let e=Ht(V.files,V.importsOf,T,w);de(V.nodes,new Map(e.map(e=>[e.file,e])))}}else zt(V,T,w);let e=new Map;for(let t of a)e.set(t.file,{x:t.x,y:t.y});i.layoutCache={files:n.files,w:T,h:w,pos:e,focused:t,pkgView:r}}E=!1}function me(){if(F()&&B){if(W().nodes.length<=100){let e=12;g.save(),g.font=`11px SFMono-Regular, Consolas, "Liberation Mono", monospace`;for(let t of W().nodes){let n=t.label.length>38?`${t.label.slice(0,36)}\u2026`:t.label;e=Math.max(e,g.measureText(n).width/2+4)}return g.restore(),Ut([...B.nodes.values()],b,y,{statsHeight:x,left:e,top:12,bottom:27})}let e=Math.max(20,Math.min(b,y)*.04),t=Math.min((b-e*2)/B.width,(y-e*2-x)/B.height,2.5),n=Math.max(.05,t);return{k:n,tx:(b-B.width*n)/2,ty:(y-x-B.height*n)/2}}if(P()&&R){let e=Math.min((b-24)/(R.width+185),(y-70)/(R.height+R.gap),1.5),t=Math.max(.05,e);return{k:t,tx:(b-(R.width+185)*t)/2+145*t,ty:24+Math.max(0,(y-70-(R.height+R.gap)*t)/2)}}let e=L()?U().nodes:V.nodes;if(e.length<=50){let t=0,n=0,r=0;g.save(),g.font=`600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace`;for(let a of e){let e=L()?je(a):(a.isHub?6:4)*i.nodeSize,o=e*1.85+5;n=Math.max(n,o,g.measureText(a.label).width/2+6),r=Math.max(r,o),t=Math.max(t,o,e+4+13+4)}return g.restore(),Ut(e,b,y,{statsHeight:x,left:n,top:r,bottom:t})}if(e.length===0)return{k:1,tx:b/2,ty:(y-x)/2};let t=-1/0,n=-1/0,r=1/0,a=1/0;for(let i of e)i.x<r&&(r=i.x),i.y<a&&(a=i.y),i.x>t&&(t=i.x),i.y>n&&(n=i.y);let o=Math.max(20,n-a),s=Math.max(20,t-r),c=(r+t)/2,l=(a+n)/2,u=Math.max(20,Math.min(b,y)*(i.focusedPkg?.04:.03)),d=Math.min((b-u*2)/s,(y-u*2-x)/o,4),f=Math.max(.05,d);return{k:f,tx:b/2-c*f,ty:(y-x)/2-l*f}}function he(){let e=me();S.k=e.k,S.tx=e.tx,S.ty=e.ty}function ge(){if(!F()){p&&(p.textContent=`${Math.round(S.k*100)}%`);return}let e=gt(S.k,me().k,!0);p&&(p.textContent=`${e.percent}%`),Ke&&(Ke.disabled=S.k<=e.min*1.0001),Ge&&(Ge.disabled=S.k>=e.max*.9999)}function G(e,t){return[e*S.k+S.tx,t*S.k+S.ty]}function _e(e,t){return[(e-S.tx)/S.k,(t-S.ty)/S.k]}function K(e){return!i.hidden.has(e.pkg)}function ye(e,t,n,r,i){let a=n+(r===`critical`?4.2:r===`high`?3.4:2.8),o=r===`critical`?1.8:r===`high`?1.5:r===`medium`?1.3:1.1;g.strokeStyle=sn[r],g.globalAlpha=i,g.lineWidth=o,g.beginPath(),g.arc(e,t,a,0,Math.PI*2),g.stroke(),g.globalAlpha=1}function be(e,t,n,r,i,a,o){let s=o?.1:.9,c=2*(1-s)*(n-e)+2*s*(i-n),l=2*(1-s)*(r-t)+2*s*(a-r),u=Math.sqrt(c*c+l*l)||1,d=c/u,f=l/u;g.beginPath(),o?(g.moveTo(e,t),g.lineTo(e+d*7-f*2.94,t+f*7+d*2.94),g.lineTo(e+d*7+f*2.94,t+f*7-d*2.94)):(g.moveTo(i,a),g.lineTo(i-d*7+f*2.94,a-f*7-d*2.94),g.lineTo(i-d*7-f*2.94,a-f*7+d*2.94)),g.closePath()}function xe(e){if(!n.issuesHidden&&i.selectedSeverities.size>0){let t=e.severitySet;if(!t)return!0;let n=!1;for(let e of i.selectedSeverities)if(t.has(e)){n=!0;break}if(!n)return!0}if(!n.issuesHidden&&i.selectedColors.size>0){let t=e.colorSet;if(!t)return!0;let n=!1;for(let e of i.selectedColors)if(t.has(e)){n=!0;break}if(!n)return!0}if(i.solo&&e.pkg!==i.solo&&!L()&&!I())return!0;let t=i.pathFilter;if(t){let n=t.toLowerCase(),r=e.pathText?e.pathText.includes(n):e.file.toLowerCase().includes(n),i=e.pkg&&e.pkg.toLowerCase().includes(n),a=e.label&&e.label.toLowerCase().includes(n);if(!r&&!i&&!a)return!0}return!1}function q(e){return(e.isHub?4.9:3.5)*i.nodeSize*Math.max(.6,Math.min(1.6,S.k))}function Se(){let e=d.getBoundingClientRect(),t=y,n=b;b=Math.max(80,e.width),y=Math.max(80,e.height),x=f?(parseFloat(getComputedStyle(f).lineHeight)||0)+8:0,_=window.devicePixelRatio||1,l.width=b*_,l.height=y*_,M=null,A.delete(V),H&&A.delete(H),l.style.width=b+`px`,l.style.height=y+`px`,g.setTransform(_,0,0,_,0,0),(T===0||w===0)&&(T=b,w=y,E=!0),pe();let r=n>0&&(Math.abs(b-n)/n>.15||Math.abs(y-t)/t>.15);h?(S.k=h.k,S.tx=h.tx+(b-h.W)/2,S.ty=h.ty+(y-h.H)/2,h=null):(k||r)&&(he(),k=!1),J()}let Ce=null,we=!0,Te=!1,Ee=!1;function J(){we=!0,!(Te||Ee)&&(Te=!0,Ce=requestAnimationFrame(()=>{Te=!1,we&&!Ee&&(we=!1,De())}))}function De(){let e=L()?U():V;if(N?.graph!==e){N={graph:e,x0:1/0,y0:1/0,x1:-1/0,y1:-1/0};for(let t of e.nodes)N.x0=Math.min(N.x0,t.x),N.x1=Math.max(N.x1,t.x),N.y0=Math.min(N.y0,t.y),N.y1=Math.max(N.y1,t.y)}let t=q({isHub:!0})*6+8,n=N.x0*S.k+S.tx>t&&N.y0*S.k+S.ty>t&&N.x1*S.k+S.tx<b-t&&N.y1*S.k+S.ty<y-t&&S.k<=1.4&&e.nodes.length>50&&!P()&&!F(),r={tx:S.tx,ty:S.ty,key:JSON.stringify([S.k,dn().bg,i.nodeSize,i.edgeOpacity,C,i.selected,i.solo,i.focusedPkg,L(),i.showAll,i.pathFilter,[...i.selectedSeverities],[...i.selectedColors],[...i.hidden]])},a=n?an(M,r,b,y,_):null;g.save();try{if(a){g.save(),g.setTransform(1,0,0,1,0,0),g.globalCompositeOperation=`copy`,g.drawImage(l,a.dx,a.dy),g.restore(),g.beginPath();for(let e of a.rects)g.rect(e.x,e.y,e.w,e.h);g.clip()}Oe(a),M=n?r:null}finally{g.restore()}}function Oe(e){let n=dn();g.fillStyle=n.bg,g.fillRect(0,0,b,y),ke(n);let a=F(),o=L(),s=a?W():o?U():V,c=I()||o?i.solo:i.selected,l=c?s.nodeByFile.get(c):null,u=l?c:null;if(a){Jt(g,B,s,{theme:n,viewport:S,width:b,height:y,colorOf:r,selected:u,hovered:C,query:i.pathFilter,dimmed:e=>xe(e)}),ge();return}if(P()){g.save(),g.translate(S.tx,S.ty),g.scale(S.k,S.k),Gt(g,R,{theme:n,scale:S.k,selected:u,hovered:C,colorOf:r,labelOf:ce,sizeLabel:e=>t(typeof e==`number`?e:s.byPkg.get(e).size)||`Size unknown`,dimmed:e=>xe(s.byPkg.get(e))}),g.restore(),ge();return}if(o&&s.nodes.length<=50){Y(n);return}if(i.focusedPkg&&s.nodes.length<=50){Ae(n,u,l);return}A.has(s)||A.set(s,Yt(s));let d=A.get(s),f=JSON.stringify([S.k,S.tx,S.ty,i.nodeSize,n.bg,i.solo,i.pathFilter,[...i.selectedSeverities],[...i.selectedColors],[...i.hidden]]);Xt(d,{viewport:S,selected:u,paintKey:f,visible:K,dimmed:xe,radius:q,color:r});let p=Zt(d,i.edgeOpacity,n.edgeIntra,!!u),m=u||C,h=.85/S.k,_=.55/S.k,v=null,x=null,w=null;g.save(),g.translate(S.tx,S.ty),g.scale(S.k,S.k);for(let t of d.edges){let{edge:n,a:r,b:i}=t;if(!r.visible||!i.visible||en(r,i,b,y)||on(e,Math.min(r.x,i.x)-2,Math.min(r.y,i.y)-2,Math.max(r.x,i.x)+2,Math.max(r.y,i.y)+2))continue;let a=m&&(n.a===m||n.b===m),o=r.dimmed&&i.dimmed?a?p.emphasisDim:p.baseDim:a?p.emphasis:p.base,s=n.cross?Qt(t,g):o.neutral,c=n.cross?o.opacity:1,l=n.cross?h:_;s!==x&&(g.strokeStyle=s,x=s),c!==v&&(g.globalAlpha=c,v=c),l!==w&&(g.lineWidth=l,w=l),g.beginPath(),g.moveTo(r.node.x,r.node.y),g.lineTo(i.node.x,i.node.y),g.stroke()}g.restore();for(let t of d.nodes){if(!t.visible)continue;let n=t.node,r=n.file===C,i=n.file===u;if(!n.isHub&&!r&&!i||t.dimmed&&!r&&!i)continue;let a=t.radius,o=t.x,s=t.y,c=a*(i?6:r?4.5:3);tn(o,s,c,b,y)||on(e,o-c-2,s-c-2,o+c+2,s+c+2)||(g.fillStyle=$t(t,c,g),g.beginPath(),g.arc(o,s,c,0,Math.PI*2),g.fill())}for(let t of d.nodes){if(!t.visible)continue;let r=t.node,i=t.radius,a=t.x,o=t.y;if(tn(a,o,i+6,b,y)||on(e,a-i-8,o-i-8,a+i+8,o+i+8))continue;let s=1,c=u&&r.file===u;u&&!c&&(s=d.neighbors.has(r.file)?1:.25),!c&&t.dimmed&&(s=Math.min(s,.1)),g.fillStyle=t.color+$(s),g.beginPath(),g.arc(a,o,i,0,Math.PI*2),g.fill(),r.isHub&&(g.strokeStyle=n.hubRing(.55*s),g.lineWidth=.8,g.stroke()),r.issue&&ye(a,o,i,r.issue,s)}if(S.k>1.4){let e=0;if(S.k<9&&!i.showLabels)for(let t of s.nodes){if(!K(t))continue;let[n,r]=G(t.x,t.y);if(!(n<0||n>b||r<0||r>y)&&(e++,e>=50))break}let t=S.k>=9||e<50;if(i.showLabels||t){g.font=`10px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace`,g.fillStyle=n.labelFill,g.textAlign=`left`,g.textBaseline=`middle`;let e=(e,t)=>e>-250&&e<b+250&&t>-250&&t<y+250,t=[];for(let n of s.nodes){if(!K(n))continue;let[r,i]=G(n.x,n.y);if(!e(r,i))continue;let a=q(n);t.push({file:n.file,x0:r-a,x1:r+a,y0:i-a,y1:i+a})}let r=[];for(let t of s.nodes){if(!K(t)||!t.isHub&&S.k<2.4)continue;let[n,i]=G(t.x,t.y);if(!e(n,i))continue;let a=n+q(t)+4,o=i+1,s=g.measureText(t.label).width+2,c=t.file===u,l=t.file===C,d=c?3:l?2:+!!t.isHub;r.push({file:t.file,n:t,tx:a,ty:o,prio:d,x0:a-2,x1:a+s,y0:o-11/2,y1:o+11/2})}let i=pn(r.filter(e=>!t.some(t=>t.file!==e.file&&fn(e,t))));for(let e of i)g.fillText(e.n.label,e.tx,e.ty)}}if(l&&K(l)){let[e,t]=G(l.x,l.y),r=q(l);g.strokeStyle=n.selectRing,g.lineWidth=1.5,g.beginPath(),g.arc(e,t,r+5,0,Math.PI*2),g.stroke()}ge()}function ke(e){if(S.k<.4)return;let t=(S.tx%80+80)%80,n=(S.ty%80+80)%80;g.strokeStyle=e.grid,g.lineWidth=1,g.beginPath();for(let e=t;e<b;e+=80)g.moveTo(e,0),g.lineTo(e,y);for(let e=n;e<y;e+=80)g.moveTo(0,e),g.lineTo(b,e);g.stroke()}function Ae(e,t,n){let a=r(i.focusedPkg),o=e.hubRing(.55),s=new Set;if(C){s.add(C);for(let e of V.adj.get(C)??[]){let t=V.edges[e];s.add(t.a),s.add(t.b)}}let c=e=>(e.isHub?6:4)*i.nodeSize;for(let e of V.edges){let n=V.nodeByFile.get(e.a),r=V.nodeByFile.get(e.b);if(!n||!r||!K(n)||!K(r))continue;let o=e.fromLo&&e.fromHi,s=!o&&e.fromHi,l=s?r:n,u=s?n:r,d=C&&(e.a===C||e.b===C),f=t&&(e.a===t||e.b===t),p=(t||C)&&!d&&!f,m=c(l),h=c(u),[_,v]=G(l.x,l.y),[y,b]=G(u.x,u.y),x=y-_,S=b-v,w=Math.sqrt(x*x+S*S)||1,T=x/w,E=S/w,D=_+T*(m+1.5),O=v+E*(m+1.5),k=y-T*(h+3.5),A=b-E*(h+3.5),j=Math.min(w*.15,30),M=(D+k)/2-E*j,N=(O+A)/2+T*j;g.beginPath(),g.moveTo(D,O),g.quadraticCurveTo(M,N,k,A);let P;P=f?.9:d?.85:p?.05:Math.min(.85,i.edgeOpacity*3),g.strokeStyle=a+$(P),g.lineWidth=f||d?1.5:.85,g.stroke(),!p&&(be(D,O,M,N,k,A,!1),g.fillStyle=a+$(Math.min(1,P+.15)),g.fill(),o&&(be(D,O,M,N,k,A,!0),g.fill()))}for(let e of V.nodes){if(!K(e))continue;let[n,r]=G(e.x,e.y),i=c(e),l=e.file===C,u=e.file===t,d=(t||C)&&!s.has(e.file)&&!u?.15:1;if(g.globalAlpha=d,u||l||e.isHub){let e=i*(u?4:l?3:2.4),t=g.createRadialGradient(n,r,i*.6,n,r,e);t.addColorStop(0,a+$(u?.4:.25)),t.addColorStop(1,a+`00`),g.fillStyle=t,g.beginPath(),g.arc(n,r,e,0,Math.PI*2),g.fill()}g.fillStyle=a,g.beginPath(),g.arc(n,r,i,0,Math.PI*2),g.fill(),e.isHub&&(g.strokeStyle=o,g.lineWidth=.9,g.stroke()),e.issue&&ye(n,r,i,e.issue,d),g.globalAlpha=1}g.font=`600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace`,g.textAlign=`center`,g.textBaseline=`top`,g.lineJoin=`round`;let l=[];for(let e of V.nodes){if(!K(e))continue;let[n,r]=G(e.x,e.y),i=r+c(e)+4,a=g.measureText(e.label).width/2+2,o=e.file===t,s=e.file===C,u=o?3:s?2:+!!e.isHub;l.push({n:e,sx:n,ty:i,halfW:a,isSel:o,isHov:s,prio:u,x0:n-a,x1:n+a,y0:i,y1:i+13})}let u=pn(l);for(let n of u){let{n:r,sx:i,ty:a,isSel:o,isHov:c}=n,l=(t||C)&&!s.has(r.file)&&!o?.2:1;g.globalAlpha=l,g.shadowColor=e.labelShadow,g.shadowBlur=4,g.strokeStyle=e.labelOutline,g.lineWidth=3,g.strokeText(r.label,i,a),g.shadowBlur=0,g.fillStyle=o?e.labelSelected:c?e.labelHover:e.labelDefault,g.fillText(r.label,i,a),g.globalAlpha=1}if(n&&K(n)){let[t,r]=G(n.x,n.y),i=c(n);g.strokeStyle=e.selectRing,g.lineWidth=1.8,g.beginPath(),g.arc(t,r,i+4,0,Math.PI*2),g.stroke()}ge()}function je(e){return Math.min(26,5+Math.sqrt(e.fileCount)*1.7)*i.nodeSize}function Y(e){let t=U(),n=i.solo&&t.byPkg.has(i.solo)?i.solo:null,a=C??n,o=new Set;if(a){o.add(a);for(let e of t.edges)e.a===a?o.add(e.b):e.b===a&&o.add(e.a)}let s=e=>{if(e.pkg===n||e.pkg===C)return 1;let t=1;return a&&!o.has(e.pkg)&&(t=.2),xe(e)&&(t=Math.min(t,.1)),t};for(let e of t.edges){let n=t.byPkg.get(e.a),i=t.byPkg.get(e.b);if(!n||!i||!K(n)||!K(i))continue;let o=e.fromLo&&e.fromHi,s=!o&&e.fromHi,c=s?i:n,l=s?n:i,u=a!==null&&(e.a===a||e.b===a),d=xe(n)&&xe(i),f=a!==null&&!u||d,p=je(c),m=je(l),[h,_]=G(c.x,c.y),[v,y]=G(l.x,l.y),b=v-h,x=y-_,S=Math.sqrt(b*b+x*x)||1,C=b/S,w=x/S,T=h+C*(p+1.5),E=_+w*(p+1.5),D=v-C*(m+3.5),O=y-w*(m+3.5),k=Math.min(S*.15,30),A=(T+D)/2-w*k,j=(E+O)/2+C*k,M;M=d?.05:u?.9:f?.06:.5;let N=g.createLinearGradient(T,E,D,O);N.addColorStop(0,r(c.pkg)+$(M)),N.addColorStop(1,r(l.pkg)+$(M)),g.beginPath(),g.moveTo(T,E),g.quadraticCurveTo(A,j,D,O),g.strokeStyle=N,g.lineWidth=Math.min(3.5,.8+Math.sqrt(e.count)*.3)*(u?1.3:1),g.stroke(),!f&&(be(T,E,A,j,D,O,!1),g.fillStyle=r(l.pkg)+$(Math.min(1,M+.15)),g.fill(),o&&(be(T,E,A,j,D,O,!0),g.fillStyle=r(c.pkg)+$(Math.min(1,M+.15)),g.fill()))}for(let e of t.nodes){if(!K(e))continue;let[t,i]=G(e.x,e.y),a=je(e),o=e.pkg===C,c=e.pkg===n,l=r(e.pkg),u=s(e);if(c||o){let e=a*(c?2.6:2.2),n=g.createRadialGradient(t,i,a*.6,t,i,e);n.addColorStop(0,l+$(c?.4:.25)),n.addColorStop(1,l+`00`),g.fillStyle=n,g.beginPath(),g.arc(t,i,e,0,Math.PI*2),g.fill()}g.fillStyle=l+$(u),g.beginPath(),g.arc(t,i,a,0,Math.PI*2),g.fill(),e.issue&&ye(t,i,a,e.issue,u)}g.font=`600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace`,g.textAlign=`center`,g.textBaseline=`top`,g.lineJoin=`round`;let c=[];for(let e of t.nodes){if(!K(e))continue;let[t,r]=G(e.x,e.y),i=r+je(e)+4,a=g.measureText(e.label).width/2+2,o=e.pkg===n,s=e.pkg===C,l=o?1/0:s?1e9:e.fileCount;c.push({p:e,sx:t,ty:i,isSel:o,isHov:s,prio:l,x0:t-a,x1:t+a,y0:i,y1:i+13})}let l=pn(c);for(let t of l){let{p:n,sx:r,ty:i,isSel:a,isHov:o}=t;g.globalAlpha=Math.max(.25,s(n)),g.shadowColor=e.labelShadow,g.shadowBlur=4,g.strokeStyle=e.labelOutline,g.lineWidth=3,g.strokeText(n.label,r,i),g.shadowBlur=0,g.fillStyle=a?e.labelSelected:o?e.labelHover:e.labelDefault,g.fillText(n.label,r,i),g.globalAlpha=1}if(n){let r=t.byPkg.get(n),[i,a]=G(r.x,r.y);g.strokeStyle=e.selectRing,g.lineWidth=1.8,g.beginPath(),g.arc(i,a,je(r)+4,0,Math.PI*2),g.stroke()}ge()}function Me(e,t){if(F()){let[n,r]=_e(e,t),i=null,a=1/0;for(let[e,t]of B.nodes){let o=(t.x-n)**2+(t.y-r)**2;o<a&&o<(14/Math.max(S.k,.1))**2&&(a=o,i=W().nodeByFile.get(e))}return i}if(P()){let[n,r]=_e(e,t);for(let e of R.rects.values())if(e.width>0&&n>=e.x&&n<e.x+e.width&&r>=e.y&&r<=e.y+e.height)return U().byPkg.get(e.id);return null}let n=L(),r=n?U():V,a=n&&r.nodes.length<=50;if(r.nodes.length>50){j??=rn(r.nodes);let n=4.9*i.nodeSize*Math.max(.6,Math.min(1.6,S.k));return j(e,t,S,n,q,K)}let o=null,s=1/0;for(let n of r.nodes){if(!K(n))continue;let[r,i]=G(n.x,n.y),c=r-e,l=i-t,u=c*c+l*l,d=(a?je(n):q(n))+6;u<d*d&&u<s&&(s=u,o=n)}return o}function Ne(e,t,n){if(!u)return;let i=r(e.pkg),a=z(e.pkg),o=ie(e.file,e.pkg);O(D`<div class="g2-tt-path">${o}</div><div class="g2-tt-head"><span class="g2-tt-dot" style="${v({background:i})}"></span> <span class="g2-tt-pkg">${a}</span></div>${e.totalIssues>0?ve(e.own):null}`,u),Fe(t,n)}function Pe(e,i,a){if(!u)return;let o=r(e.pkg),s=t(e.size),c=n.packagesOnly?re(n,e.pkg):[],l=n.packagesOnly?c.length>1?`${c.length} versions`:c[0]??``:`${e.fileCount} ${e.fileCount===1?`file`:`files`}${s?` \xB7 ${s}`:``}`;O(D`<div class="g2-tt-path">${P()?ce(e.pkg):e.label}</div>${F()||n.packagesOnly?D`<div class="g2-tt-pkg">${W().importedBy.get(e.pkg)?.length??0} ${ne(n).importers} · ${W().importsOf.get(e.pkg)?.length??0} dependencies</div>`:null} ${P()?D`<div class="g2-tt-pkg">${R.depth.has(e.pkg)?`Level ${R.depth.get(e.pkg)} \xB7 shortest import distance from App`:`No known import path from App`}</div>`:null}<div class="g2-tt-head"><span class="g2-tt-dot" style="${v({background:o})}"></span> <span class="g2-tt-pkg">${l}</span></div>${e.totalIssues>0?ve(e.own):null}`,u),Fe(i,a)}function Fe(e,t){let n=d.getBoundingClientRect();u.classList.add(`show`);let r=u.offsetWidth,i=u.offsetHeight,a=e-n.left,o=t-n.top,s=n.width,c=n.height,l=a+12;l+r>s-4&&(l=a-r-12),l<4&&(l=4);let f=o+12;f+i>c-4&&(f=o-i-12),f<4&&(f=4),u.style.left=`${l}px`,u.style.top=`${f}px`}function Ie(){u&&u.classList.remove(`show`)}let X=!1,Le=null,Re=!1,ze=e=>{e.button===0&&(e.target.closest(`.g2-stage-overlay, .g2-stage-overlay-tr, .g2-zoom-ctrl`)||(X=!0,Re=!1,Le={x:e.clientX,y:e.clientY,tx:S.tx,ty:S.ty}))},Be=e=>{let t=d.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;if(X){let t=e.clientX-Le.x,n=e.clientY-Le.y;Math.abs(t)+Math.abs(n)>3&&(Re=!0),S.tx=Le.tx+t,S.ty=Le.ty+n,Ie(),J();return}let i=Me(n,r),a=C;C=i?.file??null,l.style.cursor=`default`,i?L()||I()?Pe(i,e.clientX,e.clientY):Ne(i,e.clientX,e.clientY):a&&Ie(),C!==a&&J()},Ve=e=>{if(X&&!Re){let t=d.getBoundingClientRect(),n=Me(e.clientX-t.left,e.clientY-t.top);L()||I()?(i.solo=n&&i.solo!==n.pkg?n.pkg:null,i.selected=null,o(),s?.()):(i.selected=n?.file??null,o()),J()}X=!1},He=()=>{let e=C!==null;C=null,Ie(),e&&J()},Ue=e=>{e.preventDefault();let t=d.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=Math.exp(-e.deltaY*.0015),a=me();if(i<1&&S.k<=a.k*1.0001){S.k=a.k;let e=Math.min(.4,(1-i)*3);S.tx+=(a.tx-S.tx)*e,S.ty+=(a.ty-S.ty)*e,J();return}let[o,s]=_e(n,r),c=gt(S.k,a.k,F()),l=Math.max(c.min,Math.min(c.max,S.k*i));S.k=l,S.tx=n-o*S.k,S.ty=r-s*S.k,J()};d.addEventListener(`mousedown`,ze),window.addEventListener(`mousemove`,Be),window.addEventListener(`mouseup`,Ve),d.addEventListener(`mouseleave`,He),d.addEventListener(`wheel`,Ue,{passive:!1});function We(e){let t=gt(S.k,me().k,F());e=Math.max(t.min,Math.min(t.max,e));let n=b/2,r=y/2,[i,a]=_e(n,r);S.k=e,S.tx=n-i*S.k,S.ty=r-a*S.k,J()}let Ge=c.querySelector(`#g2-zoom-in`),Ke=c.querySelector(`#g2-zoom-out`),qe=c.querySelector(`#g2-zoom-fit`);Ge?.addEventListener(`click`,()=>We(S.k*1.4)),Ke?.addEventListener(`click`,()=>We(S.k/1.4)),qe?.addEventListener(`click`,()=>{he(),J()}),Se();let Je=new ResizeObserver(()=>Se());Je.observe(d);let Ye=new MutationObserver(e=>{for(let t of e){if((t.oldValue||``).includes(`report-fullscreen`)!==document.body.classList.contains(`report-fullscreen`)){T=0,w=0,E=!0,k=!0,i.layoutCache=null,setTimeout(()=>Se(),80);return}J()}});Ye.observe(document.body,{attributes:!0,attributeFilter:[`class`],attributeOldValue:!0}),J(),i.graphState={requestDraw:J,_cleanup:({keepViewport:e=!1}={})=>{let t=d.getBoundingClientRect();i.keptViewport=e&&t.width>0&&t.height>0?{key:m,k:S.k,tx:S.tx,ty:S.ty,W:b,H:y,layoutW:T,layoutH:w}:null,Ee=!0,cancelAnimationFrame(Ce),Je.disconnect(),Ye.disconnect(),d.removeEventListener(`mousedown`,ze),window.removeEventListener(`mousemove`,Be),window.removeEventListener(`mouseup`,Ve),d.removeEventListener(`mouseleave`,He),d.removeEventListener(`wheel`,Ue)}}}function gn(e,t,n=document.querySelector(`graph-layout`)){let r=n?.shadowRoot;if(!r)return;let i=vn(e),a=r.querySelector(`#g2-selection-area`);a&&O(q(i,t),a);let o=r.querySelector(`#g2-focus-overlay-slot`);o&&O(ye(i),o)}function _n(e,t=document.querySelector(`graph-layout`)){let n=t?.shadowRoot;if(!n)return;let r=n.querySelector(`#g2-top-pkgs-block`);r&&O(xe(vn(e)),r)}function vn(e){let t=L(e.treeData,e.files,e.ownCounts,e.transitiveCounts,e.severitySets,e.colorSets,e.fileFindings,e.options);if(e.strippedToOrig)for(let n of t.nodes)n.origFile=e.strippedToOrig.get(n.file);return t.canPackagesView=e.canPackagesView??!1,t.packagesOnly=e.packagesOnly??!1,t.supportsLayers=e.supportsLayers??!1,t.layerRoots=e.layerRoots,t.flowEntries=e.flowEntries,t.ownSourcePackages=e.ownSourcePackages,t.entryPackages=e.entryPackages,t.ownSourceFiles=e.ownSourceFiles,t.reasons=e.reasons??[],t.issuesHidden=e.issuesShown===!1,t.viewId=e.viewId??null,t}export{hn as attachGraph2Interaction,vn as buildGraphFromPrep,gn as refreshSidebar,_n as refreshTopPkgs};
|