@preventive/triage 1.0.0-alpha.36 → 1.0.0-alpha.38
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/README.md +16 -0
- package/common/bundle-compare-diff.d.ts +3 -0
- package/common/bundle-compare-diff.js +522 -0
- package/common/bundle-compare-inputs.d.ts +2 -0
- package/common/bundle-compare-inputs.js +65 -0
- package/common/bundle-metadata.d.ts +6 -2
- package/common/bundle-metadata.js +63 -20
- package/common/bundle-pkg-of.d.ts +1 -0
- package/common/bundle-pkg-of.js +90 -0
- package/common/bundle-source-links.js +7 -0
- package/common/bundle-sourcemap.d.ts +10 -0
- package/common/bundle-sourcemap.js +100 -0
- package/common/bundle-sources.d.ts +3 -1
- package/common/bundle-sources.js +47 -19
- package/common/code-language.js +16 -2
- package/common/default-scan-models.ts +2 -1
- package/common/dependency-reviews.d.ts +23 -0
- package/common/dependency-reviews.js +81 -0
- package/common/finding-duplicates.js +58 -0
- package/common/finding-filters.js +274 -0
- package/common/github-pr.ts +1 -1
- package/common/gzip.js +59 -0
- package/common/line-diff.d.ts +8 -0
- package/common/line-diff.js +56 -0
- package/common/linked-workspace-groups.js +63 -0
- package/common/managed/npm-packages.d.ts +5 -0
- package/common/managed/npm-packages.js +34 -0
- package/common/managed/permissions.ts +1 -5
- package/common/managed/routes.js +123 -12
- package/common/managed/team-app.d.ts +2 -0
- package/common/managed/team-app.js +31 -0
- package/common/managed/triage.ts +1 -1
- package/common/managed/upload-seal.ts +126 -0
- package/common/pretty-print.d.ts +5 -0
- package/common/pretty-print.js +24 -0
- package/common/revalidation-conflicts.js +48 -0
- package/common/revalidation-input-groups.js +56 -0
- package/common/workspace-app.js +23 -0
- package/common/workspace-groups.js +176 -0
- package/out/brotli-fallback.js +3 -3
- package/out/chunk-2KBF5TZ7.js +2 -0
- package/out/chunk-2XUEZHIP.js +28 -0
- package/out/chunk-35VE6CDH.js +2 -0
- package/out/chunk-3BZ7JERB.js +1 -0
- package/out/chunk-4XCDFGDP.js +10 -0
- package/out/chunk-5FKRIJGF.js +1 -0
- package/out/chunk-6Z5XLSPJ.js +1 -0
- package/out/chunk-ABW5FVSN.js +1 -0
- package/out/chunk-BJKRVROW.js +1 -0
- package/out/chunk-BYUEDJOM.js +7 -0
- package/out/chunk-C4Z6ZBXV.js +10 -0
- package/out/chunk-CMQA4DM6.js +1 -0
- package/out/chunk-CVVJAXVY.js +2 -0
- package/out/chunk-DCQX2J3C.js +223 -0
- package/out/chunk-DIJJNTRH.js +10 -0
- package/out/chunk-F4OMDNEY.js +1 -0
- package/out/chunk-FU4MTW7F.js +1 -0
- package/out/chunk-GJ4IUCNS.js +1 -0
- package/out/chunk-GMFXFEUA.js +2 -0
- package/out/chunk-GNXOKIGP.js +80 -0
- package/out/chunk-GZ4MS3TE.js +13 -0
- package/out/chunk-HIV7SVI7.js +1 -0
- package/out/chunk-IU3CCINR.js +3 -0
- package/out/chunk-JAKWIZWL.js +2 -0
- package/out/chunk-K3X5EJBQ.js +2 -0
- package/out/chunk-KEX2ATEW.js +2 -0
- package/out/chunk-KYCNJVB7.js +1 -0
- package/out/chunk-NRPC74AM.js +1 -0
- package/out/chunk-OJ5DGP5E.js +33 -0
- package/out/chunk-OOJM4CTU.js +1 -0
- package/out/chunk-PNHBZGDD.js +1 -0
- package/out/chunk-R5O6FAW4.js +2 -0
- package/out/chunk-RFZQQXSG.js +17 -0
- package/out/chunk-SD2WJAXN.js +48 -0
- package/out/chunk-TUII34K2.js +1 -0
- package/out/chunk-TZ5KB2Y5.js +10 -0
- package/out/chunk-UNTRGE26.js +2 -0
- package/out/chunk-UYAXVRVL.js +1 -0
- package/out/chunk-V3ME6FI5.js +2 -0
- package/out/chunk-V5O7M2YT.js +1 -0
- package/out/chunk-VIHGO77Y.js +1 -0
- package/out/chunk-W4J3MGLB.js +1 -0
- package/out/chunk-WGG7KQUH.js +1 -0
- package/out/chunk-XYFXXB2G.js +10 -0
- package/out/chunk-YVZH5SHP.js +1 -0
- package/out/chunk-ZPD5R5RP.js +3 -0
- package/out/client-managed-import.js +3 -87
- package/out/client-managed.js +26 -338
- package/out/client-sync.js +8 -14
- package/out/graph.js +17 -30
- package/out/index.html +34 -0
- package/out/prism.js +6 -2
- package/out/terminal.js +241 -257
- package/out/view.css +1 -1
- package/out/view.js +76 -520
- package/package.json +88 -7
- package/risk/files/characters.js +196 -0
- package/risk/files/hosts.js +205 -0
- package/risk/files/readability.js +164 -0
- package/risk/files/runs-code.js +329 -0
- package/risk/files/script.js +112 -0
- package/risk/files/stamps.js +46 -0
- package/risk/index.d.ts +142 -0
- package/risk/index.js +7 -0
- package/risk/npm/assess.js +219 -0
- package/risk/npm/combined.js +65 -0
- package/risk/npm/compare.js +222 -0
- package/risk/npm/dependencies.js +153 -0
- package/risk/npm/diff.js +43 -0
- package/risk/npm/downloads.js +84 -0
- package/risk/npm/files.js +34 -0
- package/risk/npm/held.js +60 -0
- package/risk/npm/install-scripts.js +33 -0
- package/risk/npm/malware.js +36 -0
- package/risk/npm/manifest.js +65 -0
- package/risk/npm/new-dependency.js +30 -0
- package/risk/npm/old-version.js +108 -0
- package/risk/npm/registry.js +282 -0
- package/risk/npm/release.js +85 -0
- package/risk/npm/specs.js +124 -0
- package/risk/npm/tarball.js +113 -0
- package/server-e2e/http.ts +7 -7
- package/server-e2e/npm-proxy.ts +1 -1
- package/server-e2e/objstore/fetch-mint-guard.ts +2 -2
- package/server-e2e/objstore/handlers.ts +1 -1
- package/server-e2e/objstore/tokens.ts +1 -1
- package/server-e2e/sign.ts +1 -1
- package/server-managed/bundle-advisories.ts +68 -11
- package/server-managed/bundle-build-worker.js +1 -1
- package/server-managed/bundle-build.ts +6 -2
- package/server-managed/bundle-cache.ts +37 -4
- package/server-managed/bundle-commits.ts +140 -0
- package/server-managed/bundle-summary-cache.ts +24 -10
- package/server-managed/config.ts +4 -0
- package/server-managed/db-methods.ts +98 -11
- package/server-managed/db-neon.ts +39 -4
- package/server-managed/db-schema.ts +14 -2
- package/server-managed/db-table-names.ts +1 -1
- package/server-managed/db.ts +7 -3
- package/server-managed/dependency-reviews.ts +248 -0
- package/server-managed/github-issue-oauth.ts +5 -6
- package/server-managed/github-metadata.ts +115 -0
- package/server-managed/github-oauth.ts +38 -2
- package/server-managed/http-response.ts +26 -0
- package/server-managed/http.ts +943 -52
- package/server-managed/index.ts +11 -5
- package/server-managed/kept.ts +28 -0
- package/server-managed/locked-packages.ts +85 -0
- package/server-managed/lru.ts +30 -0
- package/server-managed/npm-insights.ts +440 -0
- package/server-managed/npm-kept.ts +65 -0
- package/server-managed/npm-loads.ts +167 -0
- package/server-managed/npm-manifest.ts +115 -0
- package/server-managed/npm-packages.ts +378 -0
- package/server-managed/npm-provenance.ts +123 -0
- package/server-managed/npm-risk.ts +177 -0
- package/server-managed/pretty-print.ts +352 -0
- package/server-managed/public-workspace.ts +78 -7
- package/server-managed/rename-diff-worker.js +26 -0
- package/server-managed/rename-diff.ts +270 -0
- package/server-managed/report-sources.ts +13 -2
- package/server-managed/repository-browser.ts +19 -5
- package/server-managed/repository-risk.ts +413 -0
- package/server-managed/session.ts +16 -2
- package/server-managed/sql.ts +5 -2
- package/server-managed/storage-encryption.ts +5 -3
- package/server-managed/storage-payload.ts +4 -0
- package/server-managed/storage-stores.ts +2 -0
- package/server-managed/storage.ts +6 -3
- package/server-managed/team-app.ts +94 -0
- package/server-managed/team-feed.ts +1 -1
- package/server-managed/team-npm-scopes.ts +77 -0
- package/server-managed/type-only-worker.js +19 -0
- package/server-managed/type-only.ts +103 -0
- package/server-managed/uploads.ts +25 -4
- package/server-managed/upstream-cache.ts +147 -5
- package/server-managed/view-as.ts +58 -0
package/out/graph.js
CHANGED
|
@@ -1,30 +1,17 @@
|
|
|
1
|
-
var Uo=globalThis[Symbol.for("@rray/frontend")];if(!Uo)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");var{LitElement:pt,html:F,nothing:wi,unsafeCSS:je,render:it,StateElement:Ar,classMap:ft,repeat:Qt,styleMap:et}=Uo;var Vo=`*,*: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) 320px}.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}.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-filter{display:inline-flex;align-items:center;gap:6px;color:var(--muted);font-size:11px;& select{min-width:0;max-width:12rem;height:30px;padding:3px 6px;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:var(--surface);color:var(--text);font:inherit}}.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:grab;&:active{cursor:grabbing}& 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-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;background:transparent;border: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}.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
|
-
`;var
|
|
3
|
-
`;var
|
|
4
|
-
`;var Xo=`.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;& label{color:var(--muted);margin-right:.15rem}& 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}.checkbox-label{display:inline-flex;align-items:center;gap:.25rem;color:var(--muted);& input{margin:0}}}.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}}.trash-btn{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 .55rem;font-size:.8rem;font-family:inherit;&:hover{border-color:var(--accent)}&.active{border-color:var(--critical);color:var(--critical)}}.toolbar .trash-btn{margin-left:auto}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}}
|
|
5
|
-
`;var to=globalThis,qo=e=>e,At=to.trustedTypes,Wo=At?At.createPolicy("lit-html",{createHTML:e=>e}):void 0,oo="$lit$",Ye=`lit$${Math.random().toFixed(9).slice(2)}$`,no="?"+Ye,_i=`<${no}>`,at=document,Rt=()=>at.createComment(""),vt=e=>e===null||typeof e!="object"&&typeof e!="function",io=Array.isArray,en=e=>io(e)||typeof e?.[Symbol.iterator]=="function",eo=`[
|
|
6
|
-
|
|
7
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Zo=/'/g,Jo=/"/g,tn=/^(?:script|style|textarea|title)$/i,ro=e=>(t,...o)=>({_$litType$:e,strings:t,values:o}),Er=ro(1),Pr=ro(2),zr=ro(3),Ne=Symbol.for("lit-noChange"),xe=Symbol.for("lit-nothing"),Qo=new WeakMap,st=at.createTreeWalker(at,129);function on(e,t){if(!io(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Wo!==void 0?Wo.createHTML(t):t}var nn=(e,t)=>{let o=e.length-1,n=[],i,s=t===2?"<svg>":t===3?"<math>":"",l=xt;for(let g=0;g<o;g++){let p=e[g],d,u,r=-1,S=0;for(;S<p.length&&(l.lastIndex=S,u=l.exec(p),u!==null);)S=l.lastIndex,l===xt?u[1]==="!--"?l=Yo:u[1]!==void 0?l=Ko:u[2]!==void 0?(tn.test(u[2])&&(i=RegExp("</"+u[2],"g")),l=rt):u[3]!==void 0&&(l=rt):l===rt?u[0]===">"?(l=i??xt,r=-1):u[1]===void 0?r=-2:(r=l.lastIndex-u[2].length,d=u[1],l=u[3]===void 0?rt:u[3]==='"'?Jo:Zo):l===Jo||l===Zo?l=rt:l===Yo||l===Ko?l=xt:(l=rt,i=void 0);let y=l===rt&&e[g+1].startsWith("/>")?" ":"";s+=l===xt?p+_i:r>=0?(n.push(d),p.slice(0,r)+oo+p.slice(r)+Ye+y):p+Ye+(r===-2?g:y)}return[on(e,s+(e[o]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},yt=class e{constructor({strings:t,_$litType$:o},n){let i;this.parts=[];let s=0,l=0,g=t.length-1,p=this.parts,[d,u]=nn(t,o);if(this.el=e.createElement(d,n),st.currentNode=this.el.content,o===2||o===3){let r=this.el.content.firstChild;r.replaceWith(...r.childNodes)}for(;(i=st.nextNode())!==null&&p.length<g;){if(i.nodeType===1){if(i.hasAttributes())for(let r of i.getAttributeNames())if(r.endsWith(oo)){let S=u[l++],y=i.getAttribute(r).split(Ye),m=/([.?@])?(.*)/.exec(S);p.push({type:1,index:s,name:m[2],strings:y,ctor:m[1]==="."?Ct:m[1]==="?"?Tt:m[1]==="@"?Lt:ct}),i.removeAttribute(r)}else r.startsWith(Ye)&&(p.push({type:6,index:s}),i.removeAttribute(r));if(tn.test(i.tagName)){let r=i.textContent.split(Ye),S=r.length-1;if(S>0){i.textContent=At?At.emptyScript:"";for(let y=0;y<S;y++)i.append(r[y],Rt()),st.nextNode(),p.push({type:2,index:++s});i.append(r[S],Rt())}}}else if(i.nodeType===8)if(i.data===no)p.push({type:2,index:s});else{let r=-1;for(;(r=i.data.indexOf(Ye,r+1))!==-1;)p.push({type:7,index:s}),r+=Ye.length-1}s++}}static createElement(t,o){let n=at.createElement("template");return n.innerHTML=t,n}};function lt(e,t,o=e,n){if(t===Ne)return t;let i=n!==void 0?o._$Co?.[n]:o._$Cl,s=vt(t)?void 0:t._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(e),i._$AT(e,o,n)),n!==void 0?(o._$Co??=[])[n]=i:o._$Cl=i),i!==void 0&&(t=lt(e,i._$AS(e,t.values),i,n)),t}var It=class{constructor(t,o){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=o}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:o},parts:n}=this._$AD,i=(t?.creationScope??at).importNode(o,!0);st.currentNode=i;let s=st.nextNode(),l=0,g=0,p=n[0];for(;p!==void 0;){if(l===p.index){let d;p.type===2?d=new wt(s,s.nextSibling,this,t):p.type===1?d=new p.ctor(s,p.name,p.strings,this,t):p.type===6&&(d=new Et(s,this,t)),this._$AV.push(d),p=n[++g]}l!==p?.index&&(s=st.nextNode(),l++)}return st.currentNode=at,i}p(t){let o=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,o),o+=n.strings.length-2):n._$AI(t[o])),o++}},wt=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,o,n,i){this.type=2,this._$AH=xe,this._$AN=void 0,this._$AA=t,this._$AB=o,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,o=this._$AM;return o!==void 0&&t?.nodeType===11&&(t=o.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,o=this){t=lt(this,t,o),vt(t)?t===xe||t==null||t===""?(this._$AH!==xe&&this._$AR(),this._$AH=xe):t!==this._$AH&&t!==Ne&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):en(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==xe&&vt(this._$AH)?this._$AA.nextSibling.data=t:this.T(at.createTextNode(t)),this._$AH=t}$(t){let{values:o,_$litType$:n}=t,i=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=yt.createElement(on(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(o);else{let s=new It(i,this),l=s.u(this.options);s.p(o),this.T(l),this._$AH=s}}_$AC(t){let o=Qo.get(t.strings);return o===void 0&&Qo.set(t.strings,o=new yt(t)),o}k(t){io(this._$AH)||(this._$AH=[],this._$AR());let o=this._$AH,n,i=0;for(let s of t)i===o.length?o.push(n=new e(this.O(Rt()),this.O(Rt()),this,this.options)):n=o[i],n._$AI(s),i++;i<o.length&&(this._$AR(n&&n._$AB.nextSibling,i),o.length=i)}_$AR(t=this._$AA.nextSibling,o){for(this._$AP?.(!1,!0,o);t!==this._$AB;){let n=qo(t).nextSibling;qo(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},ct=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,o,n,i,s){this.type=1,this._$AH=xe,this._$AN=void 0,this.element=t,this.name=o,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=xe}_$AI(t,o=this,n,i){let s=this.strings,l=!1;if(s===void 0)t=lt(this,t,o,0),l=!vt(t)||t!==this._$AH&&t!==Ne,l&&(this._$AH=t);else{let g=t,p,d;for(t=s[0],p=0;p<s.length-1;p++)d=lt(this,g[n+p],o,p),d===Ne&&(d=this._$AH[p]),l||=!vt(d)||d!==this._$AH[p],d===xe?t=xe:t!==xe&&(t+=(d??"")+s[p+1]),this._$AH[p]=d}l&&!i&&this.j(t)}j(t){t===xe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Ct=class extends ct{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===xe?void 0:t}},Tt=class extends ct{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==xe)}},Lt=class extends ct{constructor(t,o,n,i,s){super(t,o,n,i,s),this.type=5}_$AI(t,o=this){if((t=lt(this,t,o,0)??xe)===Ne)return;let n=this._$AH,i=t===xe&&n!==xe||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==xe&&(n===xe||i);i&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Et=class{constructor(t,o,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=o,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){lt(this,t)}},rn={M:oo,P:Ye,A:no,C:1,L:nn,R:It,D:en,V:lt,I:wt,H:ct,N:Tt,U:Lt,B:Ct,F:Et},Ai=to.litHtmlPolyfillSupport;Ai?.(yt,wt),(to.litHtmlVersions??=[]).push("3.3.3");var Ke={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Pt=e=>(...t)=>({_$litDirective$:e,values:t}),gt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,o,n){this._$Ct=t,this._$AM=o,this._$Ci=n}_$AS(t,o){return this.update(t,o)}update(t,o){return this.render(...o)}};var{I:Br}=rn;var sn=e=>e.strings===void 0;var Ri={},an=(e,t=Ri)=>e._$AH=t;var ln=Pt(class extends gt{constructor(e){if(super(e),e.type!==Ke.PROPERTY&&e.type!==Ke.ATTRIBUTE&&e.type!==Ke.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!sn(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===Ne||t===xe)return t;let o=e.element,n=e.name;if(e.type===Ke.PROPERTY){if(t===o[n])return Ne}else if(e.type===Ke.BOOLEAN_ATTRIBUTE){if(!!t===o.hasAttribute(n))return Ne}else if(e.type===Ke.ATTRIBUTE&&o.getAttribute(n)===t+"")return Ne;return an(e),t}});var kt=class extends gt{constructor(t){if(super(t),this.it=xe,t.type!==Ke.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===xe||t==null)return this._t=void 0,this.it=t;if(t===Ne)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let o=[t];return o.raw=o,this._t={_$litType$:this.constructor.resultType,strings:o,values:[]}}};kt.directiveName="unsafeHTML",kt.resultType=1;var $t=Pt(kt);var cn='<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2 2 5v6l6 3 6-3V5L8 2Z"/><path d="M2 5l6 3 6-3"/><path d="M8 8v6"/></svg>';var dn='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" aria-hidden="true"><path d="m4.5 4.5 7 2-5 5z"/><circle cx="4.5" cy="4.5" r="2" fill="currentColor"/><circle cx="11.5" cy="6.5" r="2" fill="currentColor"/><circle cx="6.5" cy="11.5" r="2" fill="currentColor"/></svg>',un='<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1" y="1.5" width="14" height="3" rx=".5"/><rect x="1" y="6.5" width="8" height="3" rx=".5"/><rect x="11" y="6.5" width="4" height="3" rx=".5"/><rect x="1" y="11.5" width="4" height="3" rx=".5"/><rect x="7" y="11.5" width="8" height="3" rx=".5"/></svg>',pn='<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M1 1h4v4H1zm5 5h4v4H6zm5 5h4v4h-4z"/><path d="M6 1h4v4H6zm5 0h4v4h-4zM1 6h4v4H1zm10 0h4v4h-4zM1 11h4v4H1zm5 0h4v4H6z" opacity=".35"/></svg>',fn='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="2.5" r="1.5" fill="currentColor"/><circle cx="3" cy="13" r="1.5" fill="currentColor"/><circle cx="8" cy="13" r="1.5" fill="currentColor"/><circle cx="13" cy="13" r="1.5" fill="currentColor"/><path d="M8 4v3M8 7H3m5 0h5M3 7v4M8 7v4M13 7v4"/></svg>';var gn='<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/></svg>',hn='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" aria-hidden="true"><path d="M1 8h3.5m7 0H15"/><circle cx="8" cy="8" r="3.5"/></svg>';var Ee=["critical","high","medium","low","high_bug","bug","informational"];var so=["revalidation","refuted","unreachable","confirmed","partial","unknown"],ts=new Set(so);var as=new TextEncoder,ls=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});var hs=Object.freeze({manage:"/manage","manage-bundles":"/manage/bundle","manage-scans":"/manage/scans","manage-reports":"/manage/report","manage-repos":"/manage/repositories","admin-users":"/manage/users","manage-teams":"/manage/team","manage-import":"/manage/import","manage-links":"/manage/links","manage-deduplication":"/manage/deduplication","manage-history":"/manage/history"});function ao(e){return new RegExp(`(^|/)${e}/`,"u")}function Xi(e){return new RegExp(`^(?:.*/)?${e}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,"u")}var Os=ao("node_modules"),Fs=ao("vendor"),lo="node_modules",Ns=ao(lo),Bs=Xi(lo);function zt(){return lo}function Ze(e){return typeof e!="number"||!Number.isFinite(e)?null:`${e.toLocaleString()} B`}function qi(){return{showAll:!1,packagesView:!1,dependencyPackagesView:!1,bundleLayout:"graph",bundleReason:null,bundleReasonFor:null,selected:null,focusedPkg:null,topPkgsTab:"issues",edgeOpacity:.22,nodeSize:1,showLabels:!1,selectedSeverities:new Set,selectedColors:new Set,pathFilter:"",hidden:new Set,solo:null,graphState:null,layoutCache:null}}var tt=qi(),$=new Proxy(tt,{get(e,t){return tt[t]},set(e,t,o){return tt[t]=o,!0},has(e,t){return t in tt},deleteProperty(e,t){return delete tt[t]},ownKeys(){return Reflect.ownKeys(tt)},getOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(tt,t)}});function xn(){$.graphState?._cleanup&&$.graphState._cleanup(),$.graphState=null}function Wi(e){e&&(tt=e)}function Ot(e){if(!e)return null;let t=zt(),o=new RegExp(`^(?:.*/)?${t}/(@[^/]+/[^/]+|[^/]+)`,"u"),n=e.match(o);return n?n[1]:"__own__"}var Yi=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],Ki=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];function Zi(){if(typeof document>"u")return!1;let e=document.body?.classList;return!!e&&(e.contains("theme-light")||e.contains("theme-pink")||e.contains("theme-paper"))}var co=new Map;function be(e){let t=Zi(),o=t?Ki:Yi,n=e??"__own__",i=`${t?"l":"d"}:${n}`;if(co.has(i))return co.get(i);let s=0;for(let d of n)s=s*37+d.codePointAt(0)|0;let g=((s%o.length+o.length)%o.length*7+3)%o.length,p=o[g];return co.set(i,p),p}function vn(e,{packageDir:t=null}={}){if(t){if(t!=="."){let o=t.match(/(?:^|\/)node_modules\/(@[^/]+\/[^/]+|[^/]+)$/u);return o&&o[1]!==".pnpm"?o[1]:t}}else{let o=/(?:^|\/)(?:node_modules|dependencies)\/(@[^/]+\/[^/]+|[^/]+)/gu,n;for(;(n=o.exec(e))!==null;)if(n[1]!==".pnpm")return n[1]}return"__own__"}function Ft(e){return e==="__own__"?"Own source":typeof e!="string"?e:e.match(/^(?:.*\/)?vendor\/(.+)$/u)?.[1]??e}function yn(e){if(!e)return 0;let t=0;for(let o of Ee)t+=e[o]??0;return t}function wn(e){let t=new Map;for(let o=0;o<e.length;o++){let n=e[o];t.has(n.a)||t.set(n.a,[]),t.has(n.b)||t.set(n.b,[]),t.get(n.a).push(o),t.get(n.b).push(o)}return t}function kn(e){if(!e)return null;for(let t of Ee)if((e[t]??0)>0)return t;return null}function $n(e,t,o,n,i,s,l,g={}){let p=g.pkgOf??Ot,d=new Set(t),u=new Map,r=new Map;for(let x of t){let _=(e[x].imports??[]).filter(j=>d.has(j));u.set(x,_);for(let j of _)r.has(j)||r.set(j,[]),r.get(j).push(x)}let S=t.map(x=>{let _=o.get(x),j=n?.get(x)??null,U=yn(_),I=p(x)??"__own__",c=kn(_);return{id:x,file:x,pkg:I,x:0,y:0,deg:0,issue:c,totalIssues:U,own:_,subtree:j,size:typeof e[x]?.size=="number"?e[x].size:null,severitySet:i?.get(x)??null,colorSet:s?.get(x)??null,findings:l?.get(x)??null,isHub:!1,label:x.split("/").pop()??x}}),y=new Map(S.map(x=>[x.file,x])),m=new Map;for(let x of t)for(let _ of u.get(x)??[]){let[j,U]=x<_?[x,_]:[_,x],I=`${j}\0${U}`,c=m.get(I);if(!c){let R=y.get(j),E=y.get(U);if(!R||!E)continue;c={a:j,b:U,cross:R.pkg!==E.pkg,fromLo:!1,fromHi:!1},m.set(I,c),R.deg++,E.deg++}x===j?c.fromLo=!0:c.fromHi=!0}let T=[...m.values()],a=wn(T),v=new Map;for(let x of S)v.set(x.pkg,(v.get(x.pkg)??0)+1);let k=[...v.entries()].toSorted((x,_)=>_[1]-x[1]).map(([x])=>x),f=new Map;for(let x of S)f.has(x.pkg)||f.set(x.pkg,[]),f.get(x.pkg).push(x);let w={files:t,nodes:S,nodeByFile:y,edges:T,adj:a,importsOf:u,importedBy:r,packages:k,pkgCount:v,byPkg:f};return Ji(w),w}function Ji(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 o=e.importedBy.get(t.file);(!o||o.length===0)&&(t.isHub=!0)}}function Nt(e){let t=e.packages.map(g=>{let p=e.byPkg.get(g)??[],d={};for(let a of Ee)d[a]=0;let u=new Set,r=new Set,S=[],y=0,m=0,T=!1;for(let a of p){if(y+=a.totalIssues,a.own)for(let v of Ee)d[v]+=a.own[v]??0;if(a.severitySet)for(let v of a.severitySet)u.add(v);if(a.colorSet)for(let v of a.colorSet)r.add(v);typeof a.size=="number"&&(m+=a.size,T=!0),S.push(a.file)}return{file:g,pkg:g,label:Be(g),fileCount:p.length,size:T?m:null,own:d,totalIssues:y,issue:kn(d),severitySet:u.size>0?u:null,colorSet:r.size>0?r:null,pathText:S.join(`
|
|
8
|
-
`).toLowerCase(),isHub:!0,x:0,y:0,deg:0}}),o=new Map(t.map(g=>[g.pkg,g])),n=new Map;for(let g of e.edges){if(!g.cross)continue;let p=e.nodeByFile.get(g.a)?.pkg,d=e.nodeByFile.get(g.b)?.pkg;if(!p||!d||p===d)continue;let[u,r]=p<d?[p,d]:[d,p],S=`${u}\0${r}`,y=n.get(S);y||(y={a:u,b:r,cross:!0,count:0,fromLo:!1,fromHi:!1},n.set(S,y),o.get(u).deg++,o.get(r).deg++),y.count++;let m=p===u;g.fromLo&&(m?y.fromLo=!0:y.fromHi=!0),g.fromHi&&(m?y.fromHi=!0:y.fromLo=!0)}let i=[...n.values()],s=wn(i),l=new Map(t.map(g=>[g.pkg,[]]));for(let g of i)g.fromLo&&l.get(g.a).push(g.b),g.fromHi&&l.get(g.b).push(g.a);return{nodes:t,byPkg:o,nodeByFile:o,edges:i,adj:s,importsOf:l}}function Be(e){return Ft(e)}function Bt(e,t){if(!t||t==="/"||t==="__own__")return e;for(let o of["node_modules","dependencies",zt()]){let n=o+"/"+t+"/",i=e.indexOf(n);if(i>=0)return e.slice(i+n.length)}return e.startsWith(t+"/")?e.slice(t.length+1):e}var Mn={package:"@babel/core",path:/^lib\/config\//u},uo={package:"@babel/core",path:/^lib\/config\/files\/(?:module-types|plugins)\.js$/u},An=Object.freeze([{id:"react-native-codegen-discovery",reason:"Codegen discovers package metadata and React Native configuration.",from:{package:"react-native",path:/^scripts\/codegen\/generate-artifacts-executor\.js$/u},to:{path:/(?:^|\/)(?:package\.json|react-native\.config\.js)$/u}},{id:"react-native-release-version",reason:"The CLI release checker reads the installed React Native version.",from:{package:"@react-native-community/cli-tools",path:/^build\/releaseChecker\/index\.js$/u},to:{package:"react-native",path:/^package\.json$/u}},{id:"react-native-platform-config",reason:"React Native configuration loads platform CLIs supplied by the host project.",from:{package:"react-native",path:/^react-native\.config\.js$/u},to:{package:/^@react-native-community\/cli-platform-(?:android|ios)$/u,path:/^build\/index\.js$/u}},{id:"babel-project-config",reason:"Babel discovers project configuration.",from:Mn,to:{path:/(?:^|\/)babel\.config\.js$/u}},{id:"babel-typescript-preset",reason:"Babel configuration loads the TypeScript preset.",from:Mn,to:{package:"@babel/preset-typescript",path:/./u}},{id:"babel-react-native-preset",reason:"Babel config loaders load the configured React Native preset.",from:uo,to:{package:"@react-native/babel-preset",path:/^(?:src\/)?index\.js$/u}},{id:"babel-reanimated-plugin",reason:"Babel config loaders load the configured Reanimated plugin, including scoped copies.",from:uo,to:{package:/^(?:@[^/]+\/)?react-native-reanimated$/u,path:/^plugin\/index\.js$/u}},{id:"babel-transform-plugin",reason:"Babel config loaders load configured transform plugins.",from:uo,to:{package:/^@babel\/plugin-transform-[^/]+$/u,path:/^lib\/index\.js$/u}},{id:"cosmiconfig-config",reason:"Cosmiconfig loads discovered configuration, including dependency configuration.",from:{package:"cosmiconfig",path:/^dist\/loaders\.js$/u},to:{path:/\.config\.js$/u}},{id:"import-fresh-own-config",reason:"import-fresh loads host-project configuration.",from:{package:"import-fresh",path:/./u},to:{path:/\.config\.js$/u},ownSourceOnly:!0}].map(e=>Object.freeze({...e,from:Object.freeze(e.from),to:Object.freeze(e.to)})));function Sn(e){return typeof e=="string"&&!e.includes("\\")&&!e.includes(":")&&e.split("/").every(t=>t!==""&&t!=="."&&t!==".."&&t!=="node_modules")}function _n(e,t){let o=e.package;return o!==void 0&&t.ownSource===!0?!1:(o===void 0||(typeof o=="string"?o===t.package:o.test(t.package??"")))&&e.path.test(t.path)}function po(e,t){if(!(e?.ownSource===!0||!Sn(e?.path)||!Sn(t?.path)))return An.find(o=>(!o.ownSourceOnly||t.ownSource===!0)&&_n(o.from,e)&&_n(o.to,t))}function Rn(e,t){let n=e.split(/(?:^|\/)node_modules\//u).slice(1).at(-1)?.match(/^(@[^/]+\/[^/]+|[^/]+)\/(.+)$/u);return{package:n?.[1],path:n?.[2]??e.replace(/^\/+/u,""),ownSource:t??vn(e)==="__own__"}}function Mt(e,t,o,n){return!po(Rn(e,n),Rn(t,o))}function fo(e,t=o=>o.file){let o=new Map(e.nodes.map(i=>[i.file,i])),n=new Map(e.nodes.map(i=>[t(i),new Set]));for(let[i,s]of e.importsOf){let l=o.get(i);if(l)for(let g of s){let p=o.get(g);p&&Mt(l.origFile??i,p.origFile??g,e.ownSourceFiles?.has(g),e.ownSourceFiles?.has(i))&&n.get(t(l)).add(t(p))}}return n}var go=new WeakMap,ho=new WeakMap;function ht(e,t){return e.nodes.length<=100&&!t}function Ht(e,t){if(!ht(e,t))return Dt(e);if(ho.has(e))return ho.get(e);let o=new Map(e.nodes.map(s=>[s.file,[...new Set(e.importsOf.get(s.file)??[])]])),n=[];for(let[s,l]of o)for(let g of l)n.push({from:s,to:g});let i={...e,importsOf:o,cycleImportsOf:fo(e),directedEdges:n,fileLevel:!0};return ho.set(e,i),i}function Dt(e){if(go.has(e))return go.get(e);let t=Nt(e);if(t.cycleImportsOf=fo(e,o=>o.pkg),e.layerRoots?.appImports?.length>0){if(!t.byPkg.has("__own__")){let o={file:"__own__",pkg:"__own__",label:"own source",fileCount:0,size:null,totalIssues:0,deg:0,x:0,y:0};t.nodes.push(o),t.byPkg.set(o.pkg,o)}t.importsOf.set("__own__",[...new Set([...t.importsOf.get("__own__")??[],...e.layerRoots.appImports])].filter(o=>o!=="__own__"&&t.byPkg.has(o))),t.cycleImportsOf.set("__own__",new Set([...t.cycleImportsOf.get("__own__")??[],...e.layerRoots.appImports].filter(o=>o!=="__own__"&&t.byPkg.has(o))))}t.importedBy=new Map(t.nodes.map(o=>[o.pkg,[]])),t.directedEdges=[];for(let[o,n]of t.importsOf)for(let i of n)t.importedBy.get(i).push(o),t.directedEdges.push({from:o,to:i});for(let o of t.nodes)o.deg=(t.importsOf.get(o.pkg)?.length??0)+t.importedBy.get(o.pkg).length;return go.set(e,t),t}function xo(e,t,o=null){let n=t.showBundleLayouts&&$.bundleLayout==="layers",i=t.showBundleLayouts&&$.bundleLayout==="matrix",s=t.showBundleLayouts&&$.bundleLayout==="dependencies",l=t.showBundleLayouts?F`<div class="g2-layout-tabs" role="group" aria-label="Bundle layout"><button type="button" data-g2-layout="graph" aria-label="Graph" aria-pressed="${String(!n&&!i&&!s)}">${$t(dn)}</button> <button type="button" data-g2-layout="layers" aria-label="Layers" aria-pressed="${String(!!n)}">${$t(un)}</button> <button type="button" data-g2-layout="matrix" aria-label="Matrix" aria-pressed="${String(!!i)}">${$t(pn)}</button> <button type="button" data-g2-layout="dependencies" aria-label="Dependencies" aria-pressed="${String(!!s)}">${$t(fn)}</button></div>`:null,g=t.extraTopRow,p=t.hideAllFiles??!1,d=t.triageCounts??{inprogress:0,fixed:0,invalid:0,deleted:0,ignored:0},u=t.triageStates??["inprogress","fixed","invalid","deleted","ignored"],r={};for(let x of Ee)r[x]=0;for(let x of e.nodes)if(x.severitySet)for(let _ of x.severitySet)r[_]!==void 0&&r[_]++;let S=Ee.some(x=>r[x]>0||$.selectedSeverities.has(x)),y=["none","red","blue","green","gray"],m={none:0,red:0,blue:0,green:0,gray:0};for(let x of e.nodes)if(x.colorSet)for(let _ of x.colorSet)m[_]!==void 0&&m[_]++;let T=y.some(x=>m[x]>0||$.selectedColors.has(x)),a=F`<triage-selector variant="graph" .counts="${d}" .states="${u}"></triage-selector>`,v=p?null:F`<mode-switch label="All files" .checked="${$.showAll}" data-g2-show-all></mode-switch>`,f=(s?e.nodes.length<=100:!n&&!i&&(t.showPackagesView??!1))?F`<mode-switch label="Packages" .checked="${s?$.dependencyPackagesView:$.packagesView}" data-g2-packages-view></mode-switch>`:null,w=e.reasons?.length>0?F`<label class="g2-reason-filter"><select aria-label="Filter files" .value="${ln($.bundleReason??"")}" @change="${x=>x.currentTarget.dispatchEvent(new CustomEvent("bundle-graph-reason-change",{detail:{reason:x.currentTarget.value||null},bubbles:!0,composed:!0}))}"><option value="" ?selected="${$.bundleReason===null}">All</option>${e.reasons.map(x=>F`<option value="${x}" ?selected="${x===$.bundleReason}">${x}</option>`)}</select></label>`:null;return F`<div class="graph2-topbar">${g?F`<div class="graph2-topbar-row graph2-topbar-row-extra toolbar-row">${g} ${v} ${f}<div class="g2-spacer"></div>${a}</div>`:null}<div class="graph2-topbar-row graph2-topbar-row-main toolbar-row sev-row">${l} ${w} ${S?F`<severity-chips .counts="${r}" .selected="${[...$.selectedSeverities]}" kind="graph"></severity-chips>`:null} ${T?F`<triage-filter .counts="${m}" .selected="${[...$.selectedColors]}" kind="graph"></triage-filter>`:null}<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="${$.pathFilter}"> <button type="button" class="g2-path-filter-clear" id="g2-path-filter-clear" aria-label="Clear filter">✕</button></div>${g?null:v} ${g?null:f} ${o}<div class="g2-spacer"></div>${g?null:a} <button type="button" class="g2-icon-btn" id="g2-fullscreen" aria-label="Toggle fullscreen">⛶</button></div></div>`}function Qi(e,t){let o=e.split("/").filter(Boolean),n=t.split("/").filter(Boolean),i=0;for(;i<o.length&&i<n.length&&o[i]===n[i];)i++;let s=o.length-i,l=n.slice(i).join("/");return s===0?"./"+l:"../".repeat(s)+l}function er(e,t){if(!t&&t!=="")return e;let o=Qi(t,e);return o.length<e.length?o:e}function mo(e,t,o,n){let i=o.length;if(i===0)return F`<div class="g2-sel-section"><div class="g2-sel-section-label">${t} (${i})</div><div class="g2-sel-section-empty">none</div></div>`;let s=o.map(l=>({file:l,display:er(l,n)}));return s.sort((l,g)=>l.display.localeCompare(g.display)),F`<div class="g2-sel-section"><div class="g2-sel-section-label">${t} (${i})</div><ul class="g2-sel-file-list">${s.map(({file:l,display:g})=>{let p=e.nodeByFile.get(l),d=p?be(p.pkg):"#666";return F`<li><button type="button" class="g2-sel-file-link" data-g2-select="${l}"><span class="g2-sel-file-dot" style="${et({background:d})}"></span> <span class="g2-sel-file-path" data-tooltip-truncated data-tooltip="${l}">${g}</span></button></li>`})}</ul></div>`}function dt(e){if(!e)return F`<div class="g2-sel-section-empty">none</div>`;let o=["critical","high","medium","low","high_bug","bug","informational"].filter(n=>(e[n]??0)>0);return o.length===0?F`<div class="g2-sel-section-empty">none</div>`:F`<div class="tree-count-chips">${o.map(n=>F`<span class="${`tree-count-chip ${n}`}">${e[n]} ${n.replaceAll("_"," ")}</span>`)}</div>`}function In(e){let t=0;for(let d of e.edges)d.cross&&t++;let o=e.edges.length-t,n=0;for(let d of e.nodes)n+=d.totalIssues;let i=e.supportsLayers&&$.bundleLayout==="dependencies"&&!$.focusedPkg?Ht(e,$.dependencyPackagesView):null,s=i?.nodes.length??e.nodes.length,l=i?.directedEdges.length??e.edges.length,g=s===0?"0.0":(l*2/s).toFixed(1),p=Be($.focusedPkg);return F`<main class="graph2-stage"><canvas id="g2-canvas"></canvas>${$.focusedPkg?F`<div class="g2-stage-overlay"><button type="button" class="g2-back-btn" id="g2-back-to-full">← ${p}</button></div>`:null}<div id="g2-focus-overlay-slot" class="g2-stage-overlay-tr"></div><div class="g2-stage-stats">${!i||i.fileLevel?F`<span><b>${e.nodes.length}</b> files</span>`:null} <span><b>${i&&!i.fileLevel?i.nodes.length:e.packages.length}</b> packages</span> <span><b>${l}</b> ${i?"dependencies":F`edges (${o} intra · ${t} cross)`}</span> <span><b>${n}</b> issues</span> <span>avg degree <b>${g}</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 Cn(e){if(e.supportsLayers&&$.bundleLayout==="dependencies")return null;let t=null;if($.selected){let n=e.nodeByFile.get($.selected);n&&(t=n.pkg)}else $.solo&&(t=$.solo);if(!t||(e.pkgCount.get(t)??0)<=1||$.focusedPkg===t)return null;let o=Be(t);return F`<button type="button" class="g2-focus-pkg-btn" data-g2-focus-pkg="${t}" 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 Tn(){return F`<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 Ln(e){if(e.supportsLayers&&$.bundleLayout==="dependencies"&&!$.focusedPkg&&!ht(e,$.dependencyPackagesView)){let i=Dt(e),s=i.nodes.toSorted((l,g)=>i.importedBy.get(g.pkg).length-i.importedBy.get(l.pkg).length||l.pkg.localeCompare(g.pkg)).map(l=>l.pkg);return F`<div class="g2-panel-title">Packages · importers</div>${bo(i,s,!0)}`}let t=$.showAll&&e.nodes.length>0&&e.nodes.every(i=>typeof i.size=="number"),o=e.nodes.some(i=>i.totalIssues>0),n=$.topPkgsTab;return n==="size"&&!t&&(n="files"),n==="issues"&&!o&&(n="files"),F`<div class="g2-panel-title g2-panel-title-row"><span>Packages</span><div class="g2-mini-tabs">${o?F`<button type="button" class="${ft({"g2-mini-tab":!0,on:n==="issues"})}" data-g2-top-pkgs="issues">Issues</button>`:null} <button type="button" class="${ft({"g2-mini-tab":!0,on:n==="files"})}" data-g2-top-pkgs="files">Files</button> ${t?F`<button type="button" class="${ft({"g2-mini-tab":!0,on:n==="size"})}" data-g2-top-pkgs="size">Size</button>`:null}</div></div>${nr(e,n)}`}function En(e,t={}){if(e.supportsLayers&&$.bundleLayout==="dependencies"&&!$.focusedPkg&&!ht(e,$.dependencyPackagesView))return ir(Dt(e),$.solo);let o=$.selected;if(o){let n=e.nodeByFile.get(o);return n?tr(e,n,o,t):F`<div class="g2-empty-state"><strong>File not in current view</strong>Adjust filters or pick another file.</div>`}return $.solo?$.solo==="__own__"&&!e.pkgCount.has("__own__")&&e.layerRoots?.appImports.length>0?F`<div class="g2-empty-state"><strong>App</strong>App source is not included in this view. Connections come from its recorded imports.</div>`:or(e,$.solo):F`<div class="g2-empty-state">Click a node or a package row to inspect.</div>`}function tr(e,t,o,n){let i=be(t.pkg),s=Be(t.pkg),l=Bt(o,t.pkg),g=e.importedBy.get(o)??[],p=e.importsOf.get(o)??[],d=o.lastIndexOf("/"),u=d>=0?o.slice(0,d):"";return F`<div class="g2-selection-card"><div class="g2-sel-file-head"><div class="g2-sel-path">${l}</div><div class="g2-sel-pkg-row"><span class="g2-sel-dot" style="${et({"--dot":i,background:i})}"></span> <span class="g2-sel-pkg">${s}</span></div></div><div class="g2-sel-fullpath" data-tooltip-truncated data-tooltip="${o}">${o}</div>${Ze(t.size)?F`<div class="g2-sel-size">${Ze(t.size)}</div>`:null}<div class="g2-sel-section"><div class="g2-sel-section-label">Own findings</div>${dt(t.own)}</div><div class="g2-sel-section"><div class="g2-sel-section-label">Subtree findings</div>${dt(t.subtree)}</div><div class="g2-sel-jumps">${t.totalIssues>0?F`<button type="button" class="g2-sel-jump" data-g2-jump-findings="${o}">Findings →</button>`:null} ${n.isBundleContext?t.origFile?F`<button type="button" class="g2-sel-jump" data-bundle-view-source="${t.origFile}">View source →</button>`:null:F`<button type="button" class="g2-sel-jump" data-g2-jump-file="${o}">Files →</button>`}</div>${mo(e,"Imported by",g,u)} ${mo(e,"Imports",p,u)}</div>`}function or(e,t){let o=e.nodes.filter(r=>r.pkg===t),n=o.length;if(n===0)return F`<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 i=be(t),s=Be(t),l={};for(let r of Ee)l[r]=0;for(let r of o)if(r.own)for(let S of Ee)l[S]+=r.own[S]??0;let g=0,p=0;for(let r of e.edges){let S=e.nodeByFile.get(r.a),y=e.nodeByFile.get(r.b);!S||!y||(S.pkg===t&&y.pkg===t?p++:(S.pkg===t||y.pkg===t)&&g++)}let d=0;for(let r of o)r.isHub&&d++;let u=new Set;for(let r of o)for(let S of e.importedBy.get(r.file)??[]){let y=e.nodeByFile.get(S);y&&y.pkg!==t&&u.add(S)}return F`<div class="g2-selection-card"><div class="g2-sel-head"><span class="g2-sel-dot" style="${et({"--dot":i,background:i})}"></span> <span class="g2-sel-id">${s}</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">${n}</span></div><div class="g2-sel-row"><span class="k">Hubs</span><span class="v">${d}</span></div><div class="g2-sel-row"><span class="k">Intra edges</span><span class="v">${p}</span></div><div class="g2-sel-row"><span class="k">Cross edges</span><span class="v">${g}</span></div></div><div class="g2-sel-section"><div class="g2-sel-section-label">Findings</div>${dt(l)}</div>${mo(e,"Imported by",[...u])}</div>`}function nr(e,t){let o=e.nodes.length||1,n=t??$.topPkgsTab,i=$.selectedSeverities,s=$.selectedColors,l=i.size>0,g=s.size>0,p=l||g,d=new Map,u=new Map,r=0,S=0;for(let a of e.nodes){let v;if(p){if(v=0,a.findings)for(let k of a.findings)l&&!i.has(k.severity)||g&&!s.has(k.color)||v++}else v=a.totalIssues;d.set(a.pkg,(d.get(a.pkg)??0)+v),r+=v,typeof a.size=="number"&&(u.set(a.pkg,(u.get(a.pkg)??0)+a.size),S+=a.size)}let y;n==="issues"?y=e.packages.filter(a=>(d.get(a)??0)>0).toSorted((a,v)=>{let k=d.get(a)??0,f=d.get(v)??0;return f!==k?f-k:(e.pkgCount.get(v)??0)-(e.pkgCount.get(a)??0)}):n==="size"?y=e.packages.filter(a=>(u.get(a)??0)>0).toSorted((a,v)=>{let k=u.get(a)??0,f=u.get(v)??0;return f!==k?f-k:(e.pkgCount.get(v)??0)-(e.pkgCount.get(a)??0)}):y=[...e.packages].toSorted((a,v)=>{let k=e.pkgCount.get(a)??0,f=e.pkgCount.get(v)??0;return f!==k?f-k:(d.get(v)??0)-(d.get(a)??0)});let m=a=>n==="issues"?r>0?((d.get(a)??0)/r*100).toFixed(2):"0":n==="size"?S>0?((u.get(a)??0)/S*100).toFixed(2):"0":(e.pkgCount.get(a)/o*100).toFixed(2),T=n==="issues"?"No packages with issues":n==="size"?"No packages with size":"No packages";return F`<div class="g2-dist-bar">${e.packages.map(a=>{let v=be(a);return F`<span style="${et({background:v,width:`${m(a)}%`})}"></span>`})}</div><div class="g2-dist-list">${y.length===0?F`<div class="g2-dist-empty">${T}</div>`:null} ${Qt(y,a=>a,a=>{let v=be(a),k=e.pkgCount.get(a)??0,f=d.get(a)??0,w=u.get(a)??0,x=n==="issues"?f:n==="size"?Ze(w):k,_=n==="issues"?r>0?(f/r*100).toFixed(1):"0.0":n==="size"?S>0?(w/S*100).toFixed(1):"0.0":(k/o*100).toFixed(1),j=Be(a),U=$.solo===a;return F`<button type="button" class="${ft({"g2-dist-item":!0,on:U})}" data-g2-pkg="${a}"><span class="g2-dist-dot" style="${et({background:v})}"></span><span class="g2-dist-name" data-tooltip-truncated data-tooltip="${j}">${j}</span><span class="g2-dist-count">${x}</span><span class="g2-dist-pct">${_}%</span></button>`})}</div>`}function bo(e,t,o=!1){return F`<div class="g2-dist-list">${Qt(t,n=>n,n=>F`<button type="button" class="${ft({"g2-dist-item":!0,on:$.solo===n})}" data-g2-pkg="${n}"><span class="g2-dist-dot" style="${et({background:be(n)})}"></span> <span class="g2-dist-name">${Be(n)}</span> ${o?F`<span class="g2-dist-count">${e.importedBy.get(n).length}</span>`:null}</button>`)}</div>`}function ir(e,t){let o=e.byPkg.get(t);if(!o)return F`<div class="g2-empty-state">Select a package to trace its importers and dependencies.</div>`;let n=e.importedBy.get(t)??[],i=e.importsOf.get(t)??[];return F`<div class="g2-selection-card"><div class="g2-sel-head"><span class="g2-sel-dot" style="${et({background:be(t)})}"></span> <span class="g2-sel-id">${o.label}</span></div>${o.totalIssues?F`<div class="g2-sel-section">${dt(o.own)}</div>`:null}<div class="g2-sel-section"><div class="g2-sel-section-label">Imported by (${n.length})</div>${bo(e,n.toSorted())}</div><div class="g2-sel-section"><div class="g2-sel-section-label">Dependencies (${i.length})</div>${bo(e,i.toSorted())}</div></div>`}function Pn(e){return typeof e=="string"&&/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u.test(e)?e:null}var He;function rr(){return He||(He=document.createElement("div"),He.id="styled-tooltip",He.setAttribute("popover","manual"),document.body.append(He),He)}function sr(e){typeof e.showPopover=="function"&&(e.matches(":popover-open")&&e.hidePopover(),e.showPopover())}var Ut=null,zn="",Vt=null,Bn=0,Hn=0;document.addEventListener("mousemove",e=>{Bn=e.clientX,Hn=e.clientY},{passive:!0});var ar=100,lr=14,cr=8,jt=8;function dr(e,{placement:t="cursor"}={}){t=e.dataset.tooltipPlacement??t;let o=rr(),n=e.dataset.tooltip??"",i=e.dataset.tooltipRepo??"",s=Pn(e.dataset.tooltipCommit),l=["stasis","sourcemap"].includes(e.dataset.tooltipBundle)?e.dataset.tooltipBundle:"",g=e.dataset.tooltipStats??"",p=e.dataset.tooltipBuilt==="true",d=e.dataset.tooltipPackage??"",u=e.dataset.tooltipEcosystem??"",r=e.dataset.tooltipVersion??"",S=e.dataset.tooltipFiles??"",y=JSON.stringify([n,i,s,l,g,p,d,u,r,S]);if(!n||Ut===e&&zn===y)return;if(o.textContent=n,d){let _=document.createElement("div");_.className="tooltip-package";let j=(e.querySelector("[data-tooltip-package-icon] svg")??e.querySelector("svg"))?.cloneNode(!0);j&&_.append(j);let U=document.createElement("span");U.className="tooltip-package-details";for(let I of[d,r,/^\d+$/u.test(S)?`${S} ${S==="1"?"file":"files"}`:""].filter(Boolean)){let c=document.createElement("span");c.textContent=I,U.append(c)}_.append(U),o.append(_)}if(i||s){let _=document.createElement("div");if(_.className="tooltip-repo",i){_.innerHTML=gn;let j=document.createElement("span");j.textContent=i,_.append(j)}if(s){let j=document.createElement("span");j.className="tooltip-commit",j.innerHTML=hn;let U=document.createElement("span");U.textContent=s.slice(0,7),j.append(U),_.append(j)}o.append(_)}if(l||g||p){let _=document.createElement("div");if(_.className="tooltip-bundle",l==="stasis"){let I=document.createElement("img");I.src="./stasis.svg",I.alt="",_.append(I)}else _.innerHTML=cn;let j=document.createElement("span"),U=l==="stasis"?"Stasis":l==="sourcemap"?"Sourcemap":"";j.textContent=[U,p?"Built on server":"",g].filter(Boolean).join(" \xB7 "),_.append(j),o.append(_)}sr(o),o.style.left="0px",o.style.top="0px",o.style.transform="none",o.classList.add("visible");let m=Bn,T=Hn+lr;if(t==="right"||t==="right-start"){let _=e.getBoundingClientRect();m=_.right+cr,T=_.top+(t==="right"?_.height/2:0)}let a=window.innerWidth-o.offsetWidth-jt,v=Math.max(jt,Math.min(m,a));o.style.left=`${Math.round(v)}px`;let k=o.offsetHeight,f=t==="right"?T-k/2:T,w=window.innerHeight-k-jt,x=Math.max(jt,Math.min(f,w));o.style.top=`${Math.round(x)}px`,Ut=e,zn=y}function On(){clearTimeout(Vt),Vt=null,He&&(He.classList.remove("visible"),typeof He.hidePopover=="function"&&He.matches(":popover-open")&&He.hidePopover()),Ut=null}function ur(e,{gate:t,placement:o}={}){Object.hasOwn(e.dataset,"tooltipTruncated")&&e.scrollWidth<=e.clientWidth&&e.scrollHeight<=e.clientHeight||t&&!t(e)||(clearTimeout(Vt),Vt=setTimeout(()=>{dr(e,{placement:o})},ar))}var Fn=new WeakSet;function Nn(e,t){for(let o of e.composedPath()){if(o===t)break;if(o.nodeType===1&&Object.hasOwn(o.dataset,"tooltip"))return o}return null}function Dn(e,t){!e||Fn.has(e)||(Fn.add(e),e.addEventListener("mouseover",o=>{let n=Nn(o,e);if(!n){On();return}n!==Ut&&ur(n,t)}),e.addEventListener("mouseout",o=>{let n=Nn(o,e),i=o.relatedTarget?.closest?.("[data-tooltip]")??null;n&&n===i||On()}))}var vo=class{constructor(t){this.nodes=[...t];for(let[o,n]of this.nodes.entries())n.position=o;for(let o=(this.nodes.length>>1)-1;o>=0;o--)this.down(o)}before(t,o){return Math.abs(t.balance)>Math.abs(o.balance)||Math.abs(t.balance)===Math.abs(o.balance)&&(t.balance>o.balance||t.balance===o.balance&&t.tie<o.tie)}swap(t,o){let n=this.nodes,i=n[t];n[t]=n[o],n[o]=i,n[t].position=t,n[o].position=o}down(t){let o=this.nodes;for(;2*t+1<o.length;){let n=2*t+1;if(n+1<o.length&&this.before(o[n+1],o[n])&&n++,!this.before(o[n],o[t]))break;this.swap(t,n),t=n}}update(t){if(t.position<0)return;let o=t.position;for(;o>0;){let n=o-1>>1;if(!this.before(t,this.nodes[n]))break;this.swap(o,n),o=n}this.down(o)}take(){let t=this.nodes[0],o=this.nodes.pop();return t.position=-1,this.nodes.length>0&&(this.nodes[0]=o,o.position=0,this.down(0)),t}};function pr(e,t){for(let o=0;o<8;o++){let n=!1;for(let i=0;i<e.length-1;i++){let s=o%2?e.length-2-i:i,l=e[s],g=e[s+1];(t.get(g)?.get(l)?.cycleCount??0)<=(t.get(l)?.get(g)?.cycleCount??0)||(e[s]=g,e[s+1]=l,n=!0)}if(!n)break}return e}function fr(e){let t=[],o=new Set;for(let n of e.values())n.outgoing.sort((i,s)=>s[1]-i[1]||i[0].tie-s[0].tie);for(let n of e.values()){if(o.has(n))continue;let i=[{node:n,next:0}];for(o.add(n);i.length>0;){let s=i.at(-1);if(s.next===s.node.outgoing.length){t.push(s.node.id),i.pop();continue}let l=s.node.outgoing[s.next++][0];o.has(l)||(o.add(l),i.push({node:l,next:0}))}}return t.toReversed()}function yo(e,t){let o=new Map(e.map((i,s)=>[i,s])),n=0;for(let i of t.values())for(let[s,l]of i.outgoing)o.get(i.id)<o.get(s.id)&&(n+=l);return n}function gr(e,t){let o=yo(e,t),n=o,i=0;for(let s=0;s<e.length-1;s++)o-=t.get(e[s]).originalBalance,o>n&&(n=o,i=s+1);return[...e.slice(i),...e.slice(0,i)]}function jn(e,t){if(e.length<2)return e;let o=new Map(e.map((p,d)=>[p,{id:p,tie:d,balance:0,incoming:[],outgoing:[]}]));for(let p of o.values())for(let d of t.get(p.id)?.values()??[]){let u=o.get(d.to);!u||u===p||!d.cycleCount||(p.outgoing.push([u,d.cycleCount]),u.incoming.push([p,d.cycleCount]),p.balance+=d.cycleCount,u.balance-=d.cycleCount)}for(let p of o.values())p.originalBalance=p.balance;let n=[],i=new vo(o.values()),s=[];for(;i.nodes.length>0;){let p=i.take();p.balance>=0?n.push(p.id):s.push(p.id);for(let[d,u]of p.outgoing)d.position<0||(d.balance+=u,i.update(d));for(let[d,u]of p.incoming)d.position<0||(d.balance-=u,i.update(d))}let l=e,g=yo(e,o);for(let p of[[...n,...s.toReversed()],fr(o),e,e.toReversed()]){let d=pr(gr(p,o),t),u=yo(d,o);u>g&&(l=d,g=u)}return l}function wo(e,t){let o=new Set(e),n=new Map(e.map(p=>[p,[]]));for(let[p,d]of t)for(let u of d)o.has(p)&&o.has(u)&&n.get(u).push(p);let i=[],s=new Set;for(let p of e){if(s.has(p))continue;s.add(p);let d=[[p,(t.get(p)??[])[Symbol.iterator]()]];for(;d.length>0;){let[u,r]=d.at(-1),S=r.next();if(S.done){i.push(u),d.pop();continue}o.has(S.value)&&!s.has(S.value)&&(s.add(S.value),d.push([S.value,(t.get(S.value)??[])[Symbol.iterator]()]))}}let l=new Map,g=[];for(let p of i.toReversed()){if(l.has(p))continue;let d=[],u=g.length,r=[p];for(l.set(p,u);r.length>0;){let S=r.pop();d.push(S);for(let y of n.get(S))l.has(y)||(l.set(y,u),r.push(y))}g.push(d.toSorted())}return{groups:g,componentOf:l}}function ko(e,{expanded:t=new Set,order:o="structure",query:n="",neighborhood:i=null,cyclesOnly:s=!1}={}){let l=new Map,g=new Map,p=new Map;for(let h of e.nodes){let P=t.has(h.pkg),L=`${P?"f":"p"}:${P?h.file:h.pkg}`;l.has(L)||l.set(L,{id:L,pkg:h.pkg,file:P?h.file:null,label:P?h.file:Ft(h.pkg),files:[],size:0,issues:0,incoming:0,outgoing:0});let K=l.get(L);K.files.push(h.file),K.size+=h.size??0,K.issues+=h.totalIssues??0,g.set(h.file,L),p.set(h.file,h.origFile??h.file)}let d=new Map,u=new Set,r=new Set,S=new Map([...l.keys()].map(h=>[h,new Set])),y=0;for(let[h,P]of e.importsOf){let L=g.get(h);if(L)for(let K of new Set(P)){let ae=g.get(K);if(!ae)continue;d.has(L)||d.set(L,new Map),d.get(L).has(ae)||d.get(L).set(ae,{from:L,to:ae,count:0,cycleCount:0,examples:[]});let ye=d.get(L).get(ae);ye.count++;let he=Mt(p.get(h),p.get(K),e.ownSourceFiles?.has(K),e.ownSourceFiles?.has(h));ye.examples.length<80&&(!s||he)&&ye.examples.push([h,K]),y++,l.get(L).outgoing++,l.get(ae).incoming++,L!==ae&&(r.add(L),u.add(ae)),he&&(ye.cycleCount++,(L!==ae||l.get(L).file)&&S.get(L).add(ae))}}let m=[...l.keys()].toSorted(),{groups:T,componentOf:a}=wo(m,S),v=new Set(T.flatMap(h=>h.length>1||S.get(h[0]).has(h[0])?h:[]));for(let h of l.values())h.cyclic=v.has(h.id),h.component=a.get(h.id);let k=e.ownSourcePackages??new Set(e.layerRoots?.roots??[]),f=h=>h.pkg==="__own__"?0:k.has(h.pkg)?1:2,w=h=>u.has(h.id)&&r.has(h.id)?0:1,x=new Map(T.map((h,P)=>[P,h.reduce((L,K)=>Math.min(L,f(l.get(K))),2)])),_=(h,P)=>h.pkg.localeCompare(P.pkg)||h.label.localeCompare(P.label),j=new Map;if(o==="structure"){for(let h of T)if(!(h.length<2))for(let P of Map.groupBy(h,L=>f(l.get(L))).values()){let L=P.toSorted((K,ae)=>_(l.get(K),l.get(ae)));jn(L,d).forEach((K,ae)=>j.set(K,ae))}}if(s){y=0,u.clear(),r.clear();for(let h of l.values())h.incoming=0,h.outgoing=0}for(let[h,P]of d){for(let L of P.values())if(L.cyclic=L.cycleCount>0&&v.has(h)&&a.get(h)===a.get(L.to)&&(h!==L.to||l.get(h).file!==null),!!s){if(!L.cyclic){P.delete(L.to);continue}L.count=L.cycleCount,y+=L.count,l.get(h).outgoing+=L.count,l.get(L.to).incoming+=L.count,h!==L.to&&(r.add(h),u.add(L.to))}P.size===0&&d.delete(h)}let U=n.trim().toLowerCase(),I=new Set(m.filter(h=>!U||l.get(h).files.some(P=>P.toLowerCase().includes(U))||l.get(h).label.toLowerCase().includes(U))),c=new Set(i?[i]:I);if(U||i)for(let[h,P]of d)for(let L of P.keys())(i?h===i:I.has(h))&&c.add(L),(i?L===i:I.has(L))&&c.add(h);let R=(h,P)=>{if(o==="structure"){let ae=x.get(h.component)-x.get(P.component);if(ae)return ae;let ye=w(h)-w(P);if(ye)return ye;let he=h.component-P.component;if(he)return he}let L=f(h)-f(P);if(L)return L;let K=w(h)-w(P);if(K)return K;if(o==="structure"&&h.component===P.component){let ae=(j.get(h.id)??0)-(j.get(P.id)??0);if(ae)return ae}return o==="importers"&&h.incoming!==P.incoming?P.incoming-h.incoming:o==="imports"&&h.outgoing!==P.outgoing?P.outgoing-h.outgoing:_(h,P)},E=[...l.values()].filter(h=>c.has(h.id)&&(!s||h.cyclic)).toSorted(R),N=new Map(E.map((h,P)=>[h.id,P])),M=[];for(let[h,P]of d)if(N.has(h))for(let L of P.values())N.has(L.to)&&M.push({...L,row:N.get(h),col:N.get(L.to)});return{rows:E,byId:l,cells:d,visibleCells:M,index:N,matches:I,importCount:y,totalRows:l.size,cycleCount:T.filter(h=>v.has(h[0])).length}}function $o(e,t,o){return Math.min(24,Math.max(1,t-196-12)/Math.max(1,e),Math.max(1,o-118-12)/Math.max(1,e))}function Mo(e,t,o,n){return Math.max(Math.min(18,$o(t,o,n)),Math.min(27,e))}function Vn(e,t,o,n){let i=Math.floor((e-196+n.x)/n.cell),s=Math.floor((t-118+n.y)/n.cell);return e<196&&t>=118&&s>=0&&s<o.rows.length?{row:s,col:null}:t<118&&e>=196&&i>=0&&i<o.rows.length?{row:i,col:null}:e>=196&&t>=118&&s>=0&&i>=0&&s<o.rows.length&&i<o.rows.length?{row:s,col:i}:null}function Un(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 Gn(e,t,o,{width:n,height:i,theme:s,colorOf:l,hover:g,selected:p,dimmed:d}){let{cell:u,x:r,y:S}=o,{rows:y}=t,m=c=>196+c*u-r,T=c=>118+c*u-S,a=Math.max(0,Math.floor(S/u)),v=Math.min(y.length,Math.ceil((i-118+S)/u)),k=Math.max(0,Math.floor(r/u)),f=Math.min(y.length,Math.ceil((n-196+r)/u)),w=g??p;e.clearRect(0,0,n,i),e.fillStyle=s.bg,e.fillRect(0,0,n,i),e.save(),e.beginPath(),e.rect(196,118,n-196,i-118),e.clip();let x=[];for(let c=0;c<y.length;c++){let R=x.at(-1),E=y[c];R&&R.component===E.component?R.end=c+1:x.push({component:E.component,start:c,end:c+1,cyclic:E.cyclic})}for(let c of x)c.cyclic&&(e.strokeStyle=s.cycle+"85",e.lineWidth=1,e.strokeRect(m(c.start),T(c.start),(c.end-c.start)*u,(c.end-c.start)*u));if(w&&(e.fillStyle=s.highlight,e.fillRect(196,T(w.row),n-196,u),e.fillRect(m(w.col??w.row),118,u,i-118)),e.strokeStyle=s.grid,e.lineWidth=1,u>=9){e.beginPath();for(let c=a;c<=v;c++)e.moveTo(196,T(c)+.5),e.lineTo(n,T(c)+.5);for(let c=k;c<=f;c++)e.moveTo(m(c)+.5,118),e.lineTo(m(c)+.5,i);e.stroke()}let _=t.visibleCells.reduce((c,R)=>Math.max(c,R.count),1),j=u>=8?2:.25;for(let c of t.visibleCells)c.row<a||c.row>=v||c.col<k||c.col>=f||(e.globalAlpha=d(y[c.row])&&d(y[c.col])?.12:.35+.65*Math.log1p(c.count)/Math.log1p(_),e.fillStyle=c.cyclic&&u<10?s.cycle:l(y[c.row].pkg),e.fillRect(m(c.col)+j,T(c.row)+j,Math.max(1,u-2*j),Math.max(1,u-2*j)),c.cyclic&&c.from!==c.to&&u>=10&&(e.fillStyle=s.cycle,e.fillRect(m(c.col)+u-5,T(c.row)+2,3,3)));e.globalAlpha=1,p&&(e.strokeStyle=s.text,e.lineWidth=2,p.col===null?e.strokeRect(197,T(p.row)+1,n-196-2,u-2):e.strokeRect(m(p.col)+1,T(p.row)+1,u-2,u-2)),e.restore(),e.fillStyle=s.surface,e.fillRect(0,0,n,118),e.fillRect(0,0,196,i),e.font="11px ui-monospace, monospace",e.textBaseline="middle";let U=Math.max(1,Math.ceil(14/u));for(let c=a;c<v;c++){if(c%U&&c!==w?.row)continue;e.save(),e.beginPath(),e.rect(5,111,186,i-118+7),e.clip();let R=T(c)+u/2;c===w?.row&&(e.fillStyle=s.highlight,e.fillRect(0,T(c),196,Math.max(u,14))),e.fillStyle=l(y[c].pkg),e.fillRect(8,R-3,5,6),e.fillStyle=c===w?.row||t.matches.size<t.totalRows&&t.matches.has(y[c].id)?s.text:s.muted,e.fillText(`${y[c].file?" ":""}${Un(y[c])}`,20,R),e.restore()}let I=Math.max(1,Math.ceil(17/u));for(let c=k;c<f;c++)c%I&&c!==(w?.col??w?.row)||(e.save(),e.beginPath(),e.rect(189,22,n-196+7,96),e.clip(),e.translate(m(c)+u/2,108),e.rotate(-Math.PI/4),e.fillStyle=c===(w?.col??w?.row)?s.text:s.muted,e.fillText(Un(y[c]),0,0,115),e.restore(),e.fillStyle=l(y[c].pkg),e.fillRect(m(c)+1,114,Math.max(1,u-2),3));e.fillStyle=s.muted,e.font="10px ui-monospace, monospace",e.fillText("IMPORTERS \u2193",14,104),e.fillText("DEPENDENCIES \u2192",204,12),e.strokeStyle=s.border,e.beginPath(),e.moveTo(196-.5,118),e.lineTo(196-.5,i),e.moveTo(196,118-.5),e.lineTo(n,118-.5),e.stroke(),y.length===0&&(e.fillStyle=s.muted,e.fillText("No matching dependencies",216,148))}var Ve=e=>e.toLocaleString("en-US");function Gt(e,t,o){return F`<button class="g2-dist-item matrix-row-link" @click="${()=>o(e.id)}"><span class="g2-dist-dot" style="${`background:${be(e.pkg)}`}"></span><span class="g2-dist-name" data-tooltip-truncated data-tooltip="${e.label}">${e.label}</span><span class="g2-dist-count">${Ve(t)}</span></button>`}function Xn(e,t,o,{select:n,expand:i,expanded:s,neighborhood:l,focus:g,clear:p}){let d=e.byId.get(o?.from),u=e.byId.get(o?.to);if(!d){let k=[...e.rows].toSorted((f,w)=>w.incoming-f.incoming).slice(0,15);return F`<div class="matrix-metrics"><span><b>${Ve(t.nodes.length)}</b>files</span><span><b>${Ve(t.packages.length)}</b>packages</span><span><b>${Ve(e.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>${k.map(f=>Gt(f,f.incoming,n))} ${e.cycleCount?F`<h4>Cyclic groups <b>${e.cycleCount}</b></h4>${e.rows.filter(f=>f.cyclic).slice(0,12).map(f=>Gt(f,f.outgoing,n))}`:null}`}let r=u?e.cells.get(d.id)?.get(u.id):null,S=k=>t.nodeByFile.get(k)?.origFile??k,y=r?.cycleCount<r?.count?`${Ve(r.cycleCount)} of ${Ve(r.count)} file imports participate in a cycle`:"Import participates in a cycle",m=Map.groupBy(r?.examples??[],([,k])=>k),T=d.cyclic?[...e.byId.values()].filter(k=>k.component===d.component).length:0,a=[...e.cells.get(d.id)?.values()??[]].filter(k=>k.to!==d.id).toSorted((k,f)=>f.count-k.count),v=[...e.cells.values()].map(k=>k.get(d.id)).filter(k=>k&&k.from!==d.id).toSorted((k,f)=>f.count-k.count);return F`<div class="matrix-panel-head"><button class="matrix-selected-name" @click="${()=>n(d.id)}">${d.label}</button><button type="button" class="detail-action" @click="${p}" aria-label="Clear matrix selection">×</button></div>${u?F`<div class="matrix-direction">imports →</div><button class="matrix-selected-name" @click="${()=>n(u.id)}">${u.label}</button>`:null} ${(u?r?.cyclic:d.cyclic)?F`<span class="matrix-cycle-label">${u?y:`Cyclic group \xB7 ${T} members`}</span>`:null}<div class="matrix-metrics"><span><b>${Ve(u?r?.count??0:d.files.length)}</b>${u?"file imports":"files"}</span><span><b>${Ze(d.size)}</b>source size</span></div><div class="matrix-actions">${d.file?F`<button @click="${()=>i(d.pkg)}">Collapse package</button><button data-bundle-view-source="${t.nodeByFile.get(d.file)?.origFile??d.file}">View source</button>`:F`<button @click="${()=>i(d.pkg)}">${s.has(d.pkg)?"Collapse files":"Expand files"}</button>`} <button aria-pressed="${String(l===d.id)}" @click="${()=>g(d.id)}">Neighborhood</button></div>${u?F`<h4>File imports</h4>${m.size>0?[...m].map(([k,f])=>F`<div class="matrix-import-group"><button class="matrix-import-target" data-bundle-view-source="${t.nodeByFile.get(k)?.origFile??k}" data-tooltip-truncated data-tooltip="${k}">${k}</button><ul class="matrix-import-sources" aria-label="Imported by">${f.map(([w])=>F`<li><button data-bundle-view-source="${t.nodeByFile.get(w)?.origFile??w}"><span aria-hidden="true">←</span><span data-tooltip-truncated data-tooltip="${w}">${w}</span></button> ${Mt(S(w),S(k),t.ownSourceFiles?.has(k),t.ownSourceFiles?.has(w))?null:F`<span class="matrix-import-excluded">Excluded from cycles</span>`}</li>`)}</ul></div>`):F`<p class="matrix-empty">No direct imports in this direction.</p>`} ${r&&r.count>r.examples.length?F`<p class="matrix-empty">Showing ${r.examples.length} of ${Ve(r.count)} imports.</p>`:null} ${u.id!==d.id&&e.cells.get(u.id)?.has(d.id)?F`<h4>Reverse direction</h4><button class="g2-dist-item matrix-reverse-link" @click="${()=>n(u.id,d.id)}">← ${Ve(e.cells.get(u.id).get(d.id).count)} file imports</button>`:null}`:F`<h4>Imports <b>${a.length}</b></h4>${a.slice(0,60).map(k=>Gt(e.byId.get(k.to),k.count,f=>n(d.id,f)))} ${a.length>60?F`<p class="matrix-empty">Showing the 60 strongest of ${a.length} dependencies.</p>`:null}<h4>Imported by <b>${v.length}</b></h4>${v.slice(0,60).map(k=>Gt(e.byId.get(k.from),k.count,f=>n(f,d.id)))} ${v.length>60?F`<p class="matrix-empty">Showing the 60 strongest of ${v.length} importers.</p>`:null}`}`}var qn=`: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-zoom{position:absolute;bottom:10px;right:10px;display:flex;align-items:center;gap:3px;padding:3px;border:1px solid var(--border);border-radius:var(--ui-radius, 5px);background:var(--surface)}.matrix-zoom span{min-width:35px;text-align:center;font-size:11px;color:var(--muted)}.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}
|
|
9
|
-
|
|
10
|
-
`;var So=class extends pt{static properties={graph:{attribute:!1}};static styles=[je(_t),je(qn),je(Wn)];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(t){if(this.graph&&(t.has("graph")||this.query!==$.pathFilter||this.dirty)){let o=this.model?.rows;this.query=$.pathFilter,this.model=ko(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=ko(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((n,i)=>n.id!==o[i].id)}}firstUpdated(){let t=this.renderRoot.querySelector("canvas");this.canvas=t,this.resizeObserver=new ResizeObserver(()=>{let o=t.parentElement.getBoundingClientRect();this.width=o.width,this.height=o.height;let n=window.devicePixelRatio||1;t.width=Math.round(this.width*n),t.height=Math.round(this.height*n),this.clamp(),this.paint()}),this.resizeObserver.observe(t.parentElement),this.themeObserver=new MutationObserver(()=>this.requestUpdate()),this.themeObserver.observe(document.body,{attributes:!0,attributeFilter:["class"]}),this.events=new AbortController,t.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(){$.graphState=this.bridge;let t=JSON.stringify([this.cyclesOnly,this.model.cycleCount,this.expanded.size,!!this.neighborhood]);t!==this.controlsKey&&(this.controlsKey=t,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),$.graphState===this.bridge&&($.graphState=null)}clamp(){this.view.cell=Mo(this.view.cell,this.model.rows.length,this.width,this.height);let t=this.model.rows.length*this.view.cell;this.view.x=Math.max(0,Math.min(this.view.x,Math.max(0,t-this.width+196+12))),this.view.y=Math.max(0,Math.min(this.view.y,Math.max(0,t-this.height+118+12)))}fit(){this.view={cell:$o(this.model.rows.length,this.width,this.height),x:0,y:0},this.needsFit=!1,this.requestUpdate()}zoom(t,o=(this.width+196)/2,n=(this.height+118)/2){let i=this.view.cell,s=Mo(i*t,this.model.rows.length,this.width,this.height);this.view.x=(this.view.x+o-196)*s/i-o+196,this.view.y=(this.view.y+n-118)*s/i-n+118,this.view.cell=s,this.clamp(),this.hover=null,this.requestUpdate()}select(t,o=null,n=!0){this.selection={from:t,to:o},n&&this.model.index.has(t)&&(this.view.cell=Math.max(16,this.view.cell),this.view.y=this.model.index.get(t)*this.view.cell-(this.height-118)/2,this.view.x=(this.model.index.get(o??t)??0)*this.view.cell-(this.width-196)/2,this.clamp()),this.requestUpdate()}expand(t){this.expanded.has(t)?this.expanded.delete(t):this.expanded.add(t),this.revealPkg=t,this.selection=null,this.neighborhood=null,this.dirty=!0,this.requestUpdate()}pointer(t){let o=this.canvas.getBoundingClientRect();return Vn(t.clientX-o.left,t.clientY-o.top,this.model,this.view)}move(t){if(this.drag){let n=t.clientX-this.drag.x,i=t.clientY-this.drag.y;if(Math.abs(n)+Math.abs(i)>3&&(this.drag.moved=!0),this.drag.moved){this.view.x=this.drag.ox-n,this.view.y=this.drag.oy-i,this.clamp(),this.hover=null,this.paint();return}}let o=this.pointer(t);(o?.row!==this.hover?.row||o?.col!==this.hover?.col)&&(this.hover=o,this.requestUpdate())}key(t){if(t.key==="Escape"){this.selection=null,this.hover=null,this.requestUpdate();return}if(!["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Enter"].includes(t.key)||this.model.rows.length===0)return;t.preventDefault();let o=this.model.index.get(this.selection?.from)??0,n=this.model.index.get(this.selection?.to)??o;if(t.key==="Enter"){this.expand(this.model.rows[o].pkg);return}t.key==="ArrowDown"&&o++,t.key==="ArrowUp"&&o--,t.key==="ArrowRight"&&n++,t.key==="ArrowLeft"&&n--;let i=s=>Math.max(0,Math.min(this.model.rows.length-1,s));this.select(this.model.rows[i(o)].id,this.model.rows[i(n)].id)}paint(){if(!this.canvas||!this.model||this.width<=196||this.height<=118)return;if(this.needsFit&&this.fit(),this.revealPkg){let u=this.model.rows.find(r=>r.pkg===this.revealPkg);this.revealPkg=null,u&&this.select(u.id)}let t=this.canvas.getContext("2d"),o=window.devicePixelRatio||1;t.setTransform(o,0,0,o,0,0);let n=getComputedStyle(this),i=u=>n.getPropertyValue(u).trim(),s=document.body.classList.contains("theme-paper"),l=s||document.body.classList.contains("theme-light")||document.body.classList.contains("theme-pink"),g={bg:i("--graph-canvas-bg")||"#0c0c0c",surface:i("--surface"),text:i("--text"),muted:i("--muted"),border:i("--border"),grid:l?"#0000000b":"#ffffff0b",highlight:s?"#fff":l?"#0969da18":"#ffffff12",cycle:s?"#000":l?"#a21caf":"#e879c7"};this.style.setProperty("--matrix-cycle",g.cycle);let p=this.model.index.get(this.selection?.to),d=this.model.index.get(this.selection?.from);Gn(t,this.model,this.view,{width:this.width,height:this.height,theme:g,colorOf:be,hover:this.hover,selected:d===void 0?null:{row:d,col:p??null},dimmed:u=>!u.files.some(r=>{let S=this.graph.nodeByFile.get(r);return($.selectedSeverities.size===0||[...$.selectedSeverities].some(y=>S.severitySet?.has(y)))&&($.selectedColors.size===0||[...$.selectedColors].some(y=>S.colorSet?.has(y)))})})}renderControls(){return F`<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?F`<button @click="${()=>{this.expanded.clear(),this.selection=null,this.dirty=!0,this.requestUpdate()}}">Collapse all</button>`:null} ${this.neighborhood?F`<button @click="${()=>{this.neighborhood=null,this.dirty=!0,this.requestUpdate()}}">All dependencies</button>`:null}</div>`}render(){if(!this.model)return null;let t=this.model.rows[this.hover?.col],o=this.model.rows[this.hover?.row],n=t&&o?this.model.cells.get(o.id)?.get(t.id)?.count??0:0;return F`<div class="matrix-layout"><div class="matrix-stage" style="${`--matrix-label-width: ${196}px`}"><select class="matrix-order" aria-label="Matrix order" @change="${i=>{this.order=i.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="${i=>this.key(i)}" @pointermove="${i=>this.move(i)}" @pointerleave="${()=>{this.drag||(this.hover=null,this.requestUpdate())}}" @pointerdown="${i=>{i.button===0&&(this.canvas.setPointerCapture(i.pointerId),this.drag={x:i.clientX,y:i.clientY,ox:this.view.x,oy:this.view.y,moved:!1})}}" @pointercancel="${()=>{this.drag=null}}" @pointerup="${i=>{if(this.drag){if(!this.drag.moved){let s=this.pointer(i);s&&this.select(this.model.rows[s.row].id,s.col===null?null:this.model.rows[s.col].id,!1)}this.drag=null}}}" @dblclick="${i=>{let s=this.pointer(i);s&&this.expand(this.model.rows[s.row].pkg)}}"></canvas>${o&&(!t||n>0)?F`<div class="matrix-hover">${o.label}${t?` \u2192 ${t.label} \xB7 ${n} imports`:` \xB7 ${o.files.length} files`}</div>`:null}<div class="matrix-zoom"><button aria-label="Zoom out" @click="${()=>this.zoom(1/1.5)}">−</button><span>${Math.round(this.view.cell/18*100)}%</span><button aria-label="Zoom in" @click="${()=>this.zoom(1.5)}">+</button><button @click="${()=>this.fit()}">Fit</button></div></div><aside class="matrix-panel" aria-label="Matrix details" aria-live="polite">${Xn(this.model,this.graph,this.selection,{select:(i,s)=>this.select(i,s),expand:i=>this.expand(i),expanded:this.expanded,neighborhood:this.neighborhood,focus:i=>{this.neighborhood=this.neighborhood===i?null:i,this.dirty=!0,this.requestUpdate()},clear:()=>{this.selection=null,this.requestUpdate()}})}</aside></div>`}};customElements.define("dependency-matrix",So);var Yn=`:host{display:inline-flex;flex-shrink:0;vertical-align:middle;--switch-track-width: 26px;--switch-track-height: 14px}button,.checkbox-mode{align-items:center;gap:8px;box-sizing:border-box;height:30px;margin:0;padding:0 .6rem;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:transparent;color:var(--muted);font:inherit;font-size:.78rem;font-weight:500;line-height:1;white-space:nowrap;cursor:default}button{display:var(--switch-button-display, inline-flex);&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .04)}&[aria-pressed=true]{color:var(--text)}&:disabled{opacity:.4}&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}.checkbox-mode{display:var(--switch-checkbox-display, none);border:0;color:var(--text);&:has(:disabled){opacity:.4}& input{width:.85rem;height:.85rem;margin:0;accent-color:var(--accent)}}.track{position:relative;flex-shrink:0;width:var(--switch-track-width);height:var(--switch-track-height);background:var(--border);border-radius:var(--ui-radius, 8px);transition:background .15s;&:after{content:"";position:absolute;top:2px;left:2px;width:calc(var(--switch-track-height) - 4px);height:calc(var(--switch-track-height) - 4px);border-radius:50%;background:var(--muted);transition:transform .15s,background .15s}}button[aria-pressed=true] .track{background:color-mix(in oklch,var(--accent) 22%,transparent);&:after{transform:translate(calc(var(--switch-track-width) - var(--switch-track-height)));background:var(--accent)}}:host([borderless]) :is(button,.checkbox-mode){height:100%;border:0;border-radius:0}:host([compact]){--switch-track-width: 22px;--switch-track-height: 12px}:host([compact]) :is(button,.checkbox-mode){height:auto;gap:7px;padding:2px 8px;border-radius:var(--ui-radius, 6px);font-size:.68rem;line-height:1.2}
|
|
11
|
-
`;var _o=class extends pt{static properties={checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},label:{type:String},accessibleLabel:{type:String,attribute:"accessible-label"}};static styles=je(Yn);constructor(){super(),this.checked=!1,this.disabled=!1,this.label="",this.accessibleLabel=""}_checkboxClick(t){(this.disabled||t.target.tagName!=="INPUT")&&t.stopPropagation()}render(){return F`<button type="button" part="button" aria-pressed="${String(this.checked)}" aria-label="${this.accessibleLabel||this.label}" ?disabled="${this.disabled}"><span>${this.label}</span><span class="track" part="track" aria-hidden="true"></span></button> <label class="checkbox-mode" @click="${this._checkboxClick}"><input type="checkbox" part="checkbox" .checked="${this.checked}" ?disabled="${this.disabled}" aria-label="${this.accessibleLabel||this.label}"> <span>${this.label}</span></label>`}};customElements.get("mode-switch")||customElements.define("mode-switch",_o);var Ao=class extends pt{static properties={graph:{attribute:!1},options:{attribute:!1},matrixControls:{state:!0}};static styles=[je(Xo),je(Go),je(Vo),je(_t)];constructor(){super(),this.graph=null,this.options={},this.matrixControls=null}connectedCallback(){super.connectedCallback(),Dn(this.renderRoot)}willUpdate(){(!this.options.showBundleLayouts||$.bundleLayout!=="matrix")&&(this.matrixControls=null)}updated(){this.toggleAttribute("matrix",!!this.options.showBundleLayouts&&$.bundleLayout==="matrix")}render(){return this.graph?this.options.showBundleLayouts&&$.bundleLayout==="matrix"?F`<div class="graph2-layout g2-matrix-layout">${xo(this.graph,this.options,this.matrixControls)}<dependency-matrix .graph="${this.graph}" @matrix-controls-change="${t=>{this.matrixControls=t.detail}}"></dependency-matrix></div>`:F`<div class="graph2-layout">${xo(this.graph,this.options)} ${In(this.graph)} ${Tn()}</div>`:F``}};customElements.define("graph-layout",Ao);function xr(e){let t=new Map;for(let[o,n]of e.importsOf){let i=e.nodeByFile.get(o);if(i)for(let s of n){let l=e.nodeByFile.get(s);l&&i.pkg!==l.pkg&&(t.set(i.pkg,(t.get(i.pkg)??0)+1),t.set(l.pkg,(t.get(l.pkg)??0)+1))}}return t}function vr(e){if(e.packages.length===0)return null;let t=new Set;for(let[o,n]of e.importedBy){let i=e.nodeByFile.get(o);if(i)for(let s of n){let l=e.nodeByFile.get(s);if(l&&l.pkg!==i.pkg){t.add(i.pkg);break}}}for(let o of e.packages)if(!t.has(o))return o;return null}var yr=5;function Kn(e,t){let o=new Map;for(let s of e.nodes)t.has(s.pkg)&&(o.has(s.pkg)||o.set(s.pkg,[]),o.get(s.pkg).push(s));for(let s of o.values())s.sort((l,g)=>l.isHub!==g.isHub?l.isHub?-1:1:g.deg-l.deg);let n=new Map,i=new Map;for(let[s,l]of t){let g=o.get(s);if(!g||g.length===0)continue;let p=g.length,d=0;for(let v of g)if(v.isHub)d++;else break;let u=d>0&&d<=yr,r=u?d:0,S=p-r,y=l.groupR,m=Array.from({length:p}),T=Array.from({length:p});for(let v=0;v<p;v++){let k=v*137.508*Math.PI/180,f;if(v<r)f=r<=1?0:Math.sqrt(v/(r-1))*.3*y;else{let w=v-r;f=S<=1?.4*y:(.4+Math.sqrt(w/(S-1))*.6)*y}m[v]=l.x+Math.cos(k)*f,T[v]=l.y+Math.sin(k)*f}let a=Array.from({length:p},()=>!1);for(let v=0;v<p;v++){let k=g[v],f,w;u&&k.isHub?(w=0,f=r):u?(w=r,f=p):(w=0,f=p);let x=0,_=0,j=0,U=e.importsOf.get(k.file);if(U)for(let E of U){let N=n.get(E);N!==void 0&&(x+=N,_+=i.get(E),j++)}let I=e.importedBy.get(k.file);if(I)for(let E of I){let N=n.get(E);N!==void 0&&(x+=N,_+=i.get(E),j++)}let c=!1;if(j>0){x/=j,_/=j;let E=x-l.x,N=_-l.y;E*E+N*N>1&&(c=!0)}let R=-1;if(c){let E=1/0;for(let N=w;N<f;N++){if(a[N])continue;let M=m[N]-x,h=T[N]-_,P=M*M+h*h;P<E&&(E=P,R=N)}}else for(let E=w;E<f;E++)if(!a[E]){R=E;break}a[R]=!0,k.x=m[R],k.y=T[R],n.set(k.file,k.x),i.set(k.file,k.y)}}}function Zn(e,t,o){let n=t/2,i=o/2,s=Math.min(t,o)/2;if(e.packages.length===0)return;let g=vr(e),p=xr(e),d=(g?e.packages.filter(M=>M!==g):[...e.packages]).toSorted((M,h)=>{let P=(p.get(h)??0)-(p.get(M)??0);return P!==0?P:(e.pkgCount.get(h)??0)-(e.pkgCount.get(M)??0)}),u=d.length,r;u<=0?r=0:u<=6?r=.65:u<=20?r=.82:r=.95;let S=Math.max(1,Math.sqrt(50/Math.max(1,u))),y=.22,m=.12,T=.04,a=new Map,v;if(g){let M=e.pkgCount.get(g)??0,h=Math.min(y,(.012+Math.sqrt(M)*.004)*S);v=Math.max(u<=6?.4:u<=20?.36:.34,h+m+T),a.set(g,{x:n,y:i,size:M,groupR:h*s})}else u<=1?v=0:u<=6?v=.4:u<=20?v=.32:v=.3;if(u===0){Kn(e,a);return}let k=new Map;for(let M of e.edges){if(!M.cross)continue;let h=e.nodeByFile.get(M.a)?.pkg,P=e.nodeByFile.get(M.b)?.pkg;if(!h||!P||h===P)continue;k.has(h)||k.set(h,new Map),k.has(P)||k.set(P,new Map);let L=k.get(h),K=k.get(P);L.set(P,(L.get(P)??0)+1),K.set(h,(K.get(h)??0)+1)}let f=Math.max(1,Math.min(10,Math.round(Math.sqrt(u)/1.2))),w=Array.from({length:f+1});for(let M=0;M<=f;M++)w[M]=Math.floor(M*M/(f*f)*u);w[f]=u;let x=.2,_=Array.from({length:f}),j=Array.from({length:f});for(let M=0;M<f;M++){let h=w[M],P=w[M+1];_[M]=P-h;let L=0;for(let K=h;K<P;K++)L+=e.pkgCount.get(d[K])??0;j[M]=L}let U=Array.from({length:f});for(let M=0;M<f;M++){let h=(w[M]+w[M+1]-1)/2/Math.max(1,u-1);U[M]=Math.sqrt(Math.max(0,h))}let I=Array.from({length:f});I[0]=U[0];for(let M=1;M<f;M++){let h=_[M-1],P=j[M-1],L=h>0?P/h:1,K=1+x*Math.sqrt(Math.max(0,L-1));I[M]=I[M-1]+(U[M]-U[M-1])*K}let c=Array.from({length:f});for(let M=0;M<f;M++)c[M]=I[M]-U[M];let R=Array.from({length:u}),E=Array.from({length:u}),N=0;for(let M=0;M<u;M++){for(;N<f-1&&M>=w[N+1];)N++;let h=M*137.508%360*Math.PI/180,L=(u<=1?0:Math.sqrt(M/(u-1)))+c[N],K=u===1?g?v:0:v+L*(r-v);R[M]=n+Math.cos(h)*K*s,E[M]=i+Math.sin(h)*K*s}for(let M=0;M<f;M++){let h=w[M],P=w[M+1],L=P-h;if(L===0)continue;let K=Array.from({length:L},()=>!1);for(let ae=h;ae<P;ae++){let ye=d[ae],he=k.get(ye),Me=0,O=0,Q=0;if(he)for(let[me,pe]of he){let ge=a.get(me);ge&&(Me+=ge.x*pe,O+=ge.y*pe,Q+=pe)}let ee=!1;if(Q>0){Me/=Q,O/=Q;let me=Me-n,pe=O-i;me*me+pe*pe>1&&(ee=!0)}let G=-1;if(ee){let me=1/0;for(let pe=0;pe<L;pe++){if(K[pe])continue;let ge=h+pe,Se=R[ge]-Me,De=E[ge]-O,Ae=Se*Se+De*De;Ae<me&&(me=Ae,G=pe)}}else for(let me=0;me<L;me++)if(!K[me]){G=me;break}K[G]=!0;let Y=h+G,te=e.pkgCount.get(ye)??0,Te=Math.min(m,(.012+Math.sqrt(te)*.004)*S);a.set(ye,{x:R[Y],y:E[Y],size:te,groupR:Te*s})}}Kn(e,a)}function Ro(e,t,o){let n=t/2,i=o/2,s=Math.min(t,o)/2,l=e.nodes.length;if(l===0)return;let g=[...e.nodes].toSorted((p,d)=>d.deg-p.deg);for(let p=0;p<l;p++){let d=g[p],u=p*137.508%360*Math.PI/180,r=l<=1?0:Math.sqrt(p/(l-1));d.x=n+Math.cos(u)*r*.85*s,d.y=i+Math.sin(u)*r*.85*s}}function Io(e,t,o,n,{groupOf:i=Ot}={}){let s=e.length,l=n||760,g=o||1100,p=Math.sqrt(g*l/Math.max(s,1))*1.1,d=x=>{let _=0;for(let j of x)_=_*31+j.codePointAt(0)|0;return _},u=Math.ceil(Math.sqrt(s*g/l)),r=Math.ceil(s/u),S=l/(r+1),y=g/(u+1),m=e.map((x,_)=>{let j=_%u,U=Math.floor(_/u),I=d(x);return{file:x,x:(j+1)*y+(I%100-50)*y*.4,y:(U+1)*S+((I>>7)%100-50)*S*.4,dx:0,dy:0}}),T=new Map(m.map((x,_)=>[x.file,_])),a=[];for(let x of e)for(let _ of t.get(x)??[])T.has(_)&&a.push([T.get(x),T.get(_)]);let v=new Map;for(let x=0;x<s;x++){let _=i(m[x].file)??"__own__";v.has(_)||v.set(_,[]),v.get(_).push(x)}let k=Math.min(500,Math.max(180,100+s*3)),f=Math.min(g,l)/6,w=.3;for(let x=0;x<k;x++){let _=f*Math.pow(w/f,x/k);for(let I of m)I.dx=0,I.dy=0;for(let I=0;I<s;I++)for(let c=I+1;c<s;c++){let R=m[I],E=m[c],N=R.x-E.x,M=R.y-E.y,h=Math.sqrt(N*N+M*M);if(h<.01){let L=d(R.file+E.file);N=(L%100-50)*.01||.5,M=((L>>7)%100-50)*.01||.5,h=Math.sqrt(N*N+M*M)}let P=p*p/h;R.dx+=N/h*P,R.dy+=M/h*P,E.dx-=N/h*P,E.dy-=M/h*P}for(let[I,c]of a){let R=m[I],E=m[c],N=R.x-E.x,M=R.y-E.y,h=Math.sqrt(N*N+M*M)||.01,P=h*h/p;R.dx-=N/h*P,R.dy-=M/h*P,E.dx+=N/h*P,E.dy+=M/h*P}let j=.055*Math.min(1,_/(f*.3));for(let[,I]of v){if(I.length<2)continue;let c=0,R=0;for(let E of I)c+=m[E].x,R+=m[E].y;c/=I.length,R/=I.length;for(let E of I)m[E].dx+=(c-m[E].x)*j,m[E].dy+=(R-m[E].y)*j}let U=50;for(let I of m){let c=Math.sqrt(I.dx*I.dx+I.dy*I.dy)||.01;I.x+=I.dx/c*Math.min(c,_),I.y+=I.dy/c*Math.min(c,_),I.x=Math.max(U,Math.min(g-U,I.x)),I.y=Math.max(U,Math.min(l-U,I.y))}}return m}function Co(e,t,o,{statsHeight:n=0,left:i=0,right:s=i,top:l=0,bottom:g=l}={}){let p=Math.max(20,t*.04),d=Math.max(20,o*.04),u=Math.max(1,t-p*2-i-s),r=Math.max(1,o-d*2-n-l-g),S=-1/0,y=-1/0,m=1/0,T=1/0;for(let v of e)m=Math.min(m,v.x),S=Math.max(S,v.x),T=Math.min(T,v.y),y=Math.max(y,v.y);if(e.length===0)return{k:1,tx:t/2,ty:(o-n)/2};let a=Math.min(4,u/Math.max(20,S-m),r/Math.max(20,y-T));return{k:a,tx:p+i+u/2-(m+S)/2*a,ty:d+l+r/2-(T+y)/2*a}}function Xt(e,t,o=!1){let n=o?t:1;return{min:t,max:n*9.99,percent:Math.round(e/n*100)}}function Jn(e,t,o,{width:n=900,rowHeight:i=52,gap:s=42}={}){let l=new Map(e.map(f=>[f.id,f])),g=new Map,p=[];for(let f of o)l.has(f)&&!g.has(f)&&(g.set(f,0),p.push(f));for(let f=0;f<p.length;f++){let w=p[f];for(let x of t.get(w)??[])!l.has(x)||g.has(x)||(g.set(x,g.get(w)+1),p.push(x))}let d=new Map;for(let f of e){let w=g.get(f.id)??null;d.has(w)||d.set(w,[]),d.get(w).push(f)}let u=new Map(e.map(f=>[f.id,[]]));for(let[f,w]of t)if(l.has(f))for(let x of new Set(w))u.get(x)?.push(f);let r=[],S=new Map,y=[...d.keys()].toSorted((f,w)=>(f??1/0)-(w??1/0)),m=f=>Number.isFinite(f.size)&&f.size>0?f.size:0;for(let f of y){let w=d.get(f).slice(),x=new Map(w.map(c=>{let R=u.get(c.id).map(E=>S.get(E)).filter(E=>E&&f!==null&&E.level===f-1);return[c.id,R.length>0?R.reduce((E,N)=>E+N.x+N.width/2,0)/R.length:n/2]}));w.sort((c,R)=>x.get(c.id)-x.get(R.id)||String(c.id).localeCompare(String(R.id)));let _=0;for(let c=1;c<w.length;c++)m(w[c])>m(w[_])&&(_=c);_>0&&w.unshift(w.splice(_,1)[0]);let j=w.reduce((c,R)=>c+m(R),0),U=r.length*(i+s),I=0;for(let c of w){let R=n*(j>0?m(c)/j:1/w.length);S.set(c.id,{id:c.id,level:f,x:I,y:U,width:R,height:i}),I+=R}r.push({level:f,y:U,size:j,proportional:j>0,ids:w.map(c=>c.id)})}let T=[];for(let[f,w]of t)if(S.has(f))for(let x of new Set(w))f!==x&&S.has(x)&&T.push({from:f,to:x});T.sort((f,w)=>String(f.from).localeCompare(String(w.from))||String(f.to).localeCompare(String(w.to)));let a=new Map,v=new Map;for(let f of T)v.has(f.from)||v.set(f.from,[]),a.has(f.to)||a.set(f.to,[]),v.get(f.from).push(f),a.get(f.to).push(f);for(let f of v.values())f.sort((w,x)=>S.get(w.to).x-S.get(x.to).x);for(let f of a.values())f.sort((w,x)=>S.get(w.from).x-S.get(x.from).x);for(let f of v.values())f.forEach((w,x)=>{w.sourcePort=(x+1)/(f.length+1)});for(let f of a.values())f.forEach((w,x)=>{w.targetPort=(x+1)/(f.length+1)});let k=r.reduce((f,w)=>f+w.size,0);for(let f of r)f.share=k>0?f.size/k:null;return{levels:r,rects:S,edges:T,depth:g,totalSize:k,width:n,height:r.length>0?r.length*(i+s)-s:0,gap:s}}function wr(e){let t=[1,3,5].map(n=>{let i=parseInt(e.slice(n,n+2),16)/255;return i<=.04045?i/12.92:((i+.055)/1.055)**2.4});return t[0]*.2126+t[1]*.7152+t[2]*.0722>.18?"#000":"#fff"}function Qn(e,t,{theme:o,scale:n,colorOf:i,labelOf:s,sizeLabel:l,dimmed:g,selected:p,hovered:d}){let u=d??p,r=new Set([u]);for(let m of t.edges)m.from===u&&r.add(m.to),m.to===u&&r.add(m.from);let S=m=>m===u||m===p?1:g(m)?.13:u&&!r.has(m)?.22:1;e.save(),e.lineJoin="round";for(let m of t.edges){let T=t.rects.get(m.from),a=t.rects.get(m.to),v=m.from===u||m.to===u;e.globalAlpha=Math.min(S(m.from),S(m.to))*(v?.9:.5),e.strokeStyle=i(m.from),e.fillStyle=i(m.from),e.lineWidth=(v?1.6:1)/n;let k=T.x+T.width*m.sourcePort,f=T.y+T.height,w=a.x+a.width*m.targetPort,x=a.y,_=0,j=1;if(e.beginPath(),e.moveTo(k,f),a.y>T.y){let I=(f+x)/2;e.bezierCurveTo(k,I,w,I,w,x)}else if(a.y===T.y){x=a.y+a.height;let I=f+t.gap*.65;e.bezierCurveTo(k,I,w,I,w,x),j=-1}else{w=a.x+a.width,x=a.y+a.height*m.targetPort;let I=t.width+16+m.sourcePort*20;e.bezierCurveTo(k,f+t.gap/2,I,f+t.gap/2,I,f),e.lineTo(I,x+8),e.quadraticCurveTo(I,x,w,x),_=-1,j=0}e.stroke();let U=3/n;e.beginPath(),e.moveTo(w,x),e.lineTo(w-_*U-j*U,x-j*U+_*U),e.lineTo(w-_*U+j*U,x-j*U-_*U),e.closePath(),e.fill()}e.globalAlpha=1,e.textBaseline="middle",e.textAlign="right",e.fillStyle=o.labelDefault,e.font="11px system-ui, sans-serif";let y=o.edgeIntra(.16);for(let m of t.levels){let a=m.y+26,v=18;e.strokeStyle=y,e.lineWidth=3,e.beginPath(),e.arc(-112,a,v,0,Math.PI*2),e.stroke(),m.share!==null&&m.share>0&&(e.strokeStyle=o.labelDefault,e.beginPath(),e.arc(-112,a,v,-Math.PI/2,-Math.PI/2+m.share*Math.PI*2),e.stroke()),e.textAlign="center",e.font="9px system-ui, sans-serif";let k=m.share===null?"\u2014":m.share>0&&m.share<.001?"<0.1%":`${Number((m.share*100).toFixed(1))}%`;e.fillText(k,-112,a),e.textAlign="right",e.font="11px system-ui, sans-serif",e.fillText(m.level===null?"Unreached":m.level===0?"App":`Level ${m.level}`,-12,m.y+19),e.font="10px system-ui, sans-serif",e.fillText(m.proportional?l(m.size):"No size data",-12,m.y+35),e.font="11px system-ui, sans-serif"}e.textAlign="left";for(let m of t.rects.values()){let{id:T,x:a,y:v,width:k,height:f}=m;if(k<=0)continue;let w=i(T),x=wr(w);if(e.globalAlpha=S(T),e.fillStyle=w,e.fillRect(a,v,k,f),e.strokeStyle=o.bg,e.lineWidth=1/n,e.strokeRect(a,v,k,f),T===p||T===d){e.strokeStyle=o.selectRing,e.lineWidth=1.5/n;let _=Math.min(k/2,.75/n);e.strokeRect(a+_,v+_,Math.max(0,k-_*2),f-_*2)}k*n<28||(e.save(),e.beginPath(),e.rect(a+7,v+4,Math.max(0,k-14),f-8),e.clip(),e.fillStyle=x,e.font="500 12px system-ui, sans-serif",e.fillText(s(T),a+9,v+21),e.fillStyle=x,e.font="10px system-ui, sans-serif",e.fillText(l(T),a+9,v+38),e.restore())}e.restore()}function ei(e,t,o=[],{width:n=1200,height:i=800,cycleImportsOf:s=t}={}){e=[...new Set(e)].toSorted();let l=new Set(e),g=new Map(e.map(O=>[O,[...new Set(t.get(O)??[])].filter(Q=>Q!==O&&l.has(Q)).toSorted()])),p=new Map(e.map(O=>[O,new Set(s.get(O)??[])])),d=new Map(e.map(O=>[O,[]]));for(let[O,Q]of g)for(let ee of Q)d.get(ee).push(O);let{groups:u,componentOf:r}=wo(e,p),S=u.filter(O=>O.length>1),y=new Set(S.flat()),m=u.map(()=>new Set),T=u.map(()=>0);for(let[O,Q]of g)for(let ee of Q){if(!p.get(O).has(ee))continue;let G=r.get(O),Y=r.get(ee);G!==Y&&!m[G].has(Y)&&(m[G].add(Y),T[Y]++)}let a=new Set(o.map(O=>r.get(O)).filter(O=>O!==void 0)),v=u.map(()=>0),k=[],f=new Set,w=O=>{f.has(O)||(f.add(O),k.push(O))};a.forEach(w),T.forEach((O,Q)=>{O||w(Q)});for(let O=0;O<k.length;O++){let Q=k[O];for(let ee of m[Q])a.has(ee)||(v[ee]=Math.max(v[ee],v[Q]+1)),--T[ee]===0&&w(ee)}let x=new Map(e.map(O=>[O,v[r.get(O)]])),_=new Map;for(let O of e){let Q=x.get(O);_.has(Q)||_.set(Q,[]),_.get(Q).push(O)}let j=[..._.keys()].toSorted((O,Q)=>O-Q),U=new Map,I=O=>O.forEach((Q,ee)=>U.set(Q,(ee+.5)/O.length));for(let O of _.values())I(O);for(let O=0;O<12;O++)for(let Q of O%2?j.toReversed():j){let ee=_.get(Q),G=new Map(ee.map(Y=>{let te=(O%2?g:d).get(Y);return[Y,te.length>0?te.reduce((Te,me)=>Te+U.get(me),0)/te.length:U.get(Y)]}));ee.sort((Y,te)=>G.get(Y)-G.get(te)||U.get(Y)-U.get(te)||Y.localeCompare(te)),I(ee)}let c=Math.max(.6,Math.min(2.4,n/Math.max(1,i))),R=Math.max(160,Math.sqrt(e.length*1100*c)),E=Math.max(120,R/c),N=j.at(-1)??0,M=new Map;for(let[O,Q]of _)Q.forEach((ee,G)=>{let Y=U.get(ee)*R,te=(O+.5)/(N+1)*E;M.set(ee,{id:ee,x:Y,y:te+(G%5-2)*9,anchorY:te,vx:0,vy:0,level:O,cycle:y.has(ee),degree:g.get(ee).length+d.get(ee).length})});let h=[];for(let[O,Q]of g)for(let ee of Q)h.push({from:O,to:ee,cycle:p.get(O).has(ee)&&y.has(O)&&r.get(O)===r.get(ee)});let P=h.map(O=>{let Q=M.get(O.from),ee=M.get(O.to),G=26+Math.sqrt(Math.max(Q.degree,ee.degree))*5;return{a:Q,b:ee,length:G,strength:.065/Math.sqrt(Math.min(Q.degree,ee.degree)||1),cycle:O.cycle}}),L=[...M.values()],K=80;for(let O=0;O<240;O++){let Q=new Map,ee=7*(1-O/240)+.15;for(let G=0;G<L.length;G++){let Y=L[G];Y.fx=(R/2-Y.x)*.002,Y.fy=(Y.anchorY-Y.y)*.018,Y.gx=Math.floor(Y.x/K),Y.gy=Math.floor(Y.y/K);let te=`${Y.gx},${Y.gy}`;Q.has(te)||Q.set(te,[]),Q.get(te).push(G)}for(let G=0;G<L.length;G++){let Y=L[G];for(let te=Y.gx-1;te<=Y.gx+1;te++)for(let Te=Y.gy-1;Te<=Y.gy+1;Te++)for(let me of Q.get(`${te},${Te}`)??[]){if(me<=G)continue;let pe=L[me],ge=Y.x-pe.x,Se=Y.y-pe.y,De=ge*ge+Se*Se;if(De>K*K)continue;De<.01&&(ge=G%2?.1:-.1,Se=.1);let Ae=Math.hypot(ge,Se),Xe=Math.min(18,100/Ae-100/K+Math.max(0,22-Ae)*.6),qe=ge/Ae*Xe,_e=Se/Ae*Xe;Y.fx+=qe,Y.fy+=_e,pe.fx-=qe,pe.fy-=_e}}for(let{a:G,b:Y,length:te,strength:Te,cycle:me}of P){let pe=Y.x-G.x,ge=Y.y-G.y,Se=Math.hypot(pe,ge)||1,De=(Se-te)*Te,Ae=pe/Se*De,Xe=ge/Se*De;if(G.fx+=Ae,G.fy+=Xe,Y.fx-=Ae,Y.fy-=Xe,!me&&ge<22){let qe=(22-ge)*.018;G.fy-=qe,Y.fy+=qe}}for(let G of L){G.vx=(G.vx+G.fx)*.55,G.vy=(G.vy+G.fy)*.55;let Y=Math.hypot(G.vx,G.vy)||1,te=Math.min(1,ee/Y);G.x+=G.vx*te,G.y+=G.vy*te}}let ae=-1/0,ye=-1/0,he=1/0,Me=1/0;for(let O of L)he=Math.min(he,O.x),Me=Math.min(Me,O.y),ae=Math.max(ae,O.x),ye=Math.max(ye,O.y);for(let O of L)O.x+=16-he,O.y+=16-Me;return{nodes:M,edges:h,depth:x,incoming:d,links:g,cycles:S,roots:new Set(o.filter(O=>l.has(O))),width:L.length>0?ae-he+32:32,height:L.length>0?ye-Me+32:32}}function kr(e){return Math.max(2.5,Math.min(6,4.5*Math.sqrt(e)))}function ti(e,t,o,{theme:n,viewport:i,width:s,height:l,colorOf:g,dimmed:p,selected:d,hovered:u,query:r}){let{k:S,tx:y,ty:m}=i,T=kr(S),a=u??d,v=new Set([a,...t.links.get(a)??[],...t.incoming.get(a)??[]]),k=new Map;for(let[c,R]of t.nodes){let E=o.nodeByFile.get(c);k.set(c,{x:R.x*S+y,y:R.y*S+m,color:g(E.pkg),n:E,p:R,dim:c===a||c===d?1:p(E)?.12:a&&!v.has(c)?.16:1})}e.save();let f=(c,R)=>{let E=k.get(c.from),N=k.get(c.to);if(Math.max(E.x,N.x)<-40||Math.min(E.x,N.x)>s+40||Math.max(E.y,N.y)<-80||Math.min(E.y,N.y)>l+80)return;e.globalAlpha=R?.85:Math.min(E.dim,N.dim)*(a?.12:.22),e.strokeStyle=R?E.color:n.labelDefault,e.lineWidth=R?1.4:.7,e.setLineDash(c.cycle?[3,3]:[]);let M=N.x-E.x,h=N.y-E.y,P=Math.hypot(M,h)||1,L=M/P,K=h/P,ae=E.x+L*(T+1),ye=E.y+K*(T+1),he=N.x-L*(T+3),Me=N.y-K*(T+3),O=c.cycle?Math.min(18,P*.15):0,Q=(ae+he)/2-K*O,ee=(ye+Me)/2+L*O;if(e.beginPath(),e.moveTo(ae,ye),e.quadraticCurveTo(Q,ee,he,Me),e.stroke(),R||S>=.85||o.nodes.length<=50){let G=Math.atan2(Me-ee,he-Q),Y=R?5:3.5;e.setLineDash([]),e.fillStyle=e.strokeStyle,e.beginPath(),e.moveTo(he,Me),e.lineTo(he-Math.cos(G-.5)*Y,Me-Math.sin(G-.5)*Y),e.lineTo(he-Math.cos(G+.5)*Y,Me-Math.sin(G+.5)*Y),e.closePath(),e.fill()}};for(let c of t.edges)c.from!==a&&c.to!==a&&f(c,!1);for(let c of t.edges)(c.from===a||c.to===a)&&f(c,!0);e.setLineDash([]);let w=new Map,x=c=>{let R=[];for(let E=Math.floor(c.x/64);E<=Math.floor((c.x+c.w)/64);E++)for(let N=Math.floor(c.y/24);N<=Math.floor((c.y+c.h)/24);N++)R.push(`${E},${N}`);return R},_=c=>{for(let R of x(c))w.has(R)||w.set(R,[]),w.get(R).push(c)},j=(c,R)=>c.x<R.x+R.w&&R.x<c.x+c.w&&c.y<R.y+R.h&&R.y<c.y+c.h,U=[...k.values()].filter(c=>c.x>=-10&&c.x<=s+10&&c.y>=-10&&c.y<=l+10);for(let c of U)e.globalAlpha=c.dim,e.fillStyle=c.color,e.beginPath(),e.arc(c.x,c.y,T,0,Math.PI*2),e.fill(),(c.p.cycle||c.n.totalIssues>0)&&(e.strokeStyle=c.p.cycle?"#c47ad7":c.color,e.lineWidth=1,e.beginPath(),e.arc(c.x,c.y,T+2.5,0,Math.PI*2),e.stroke()),(c.n.file===d||c.n.file===u)&&(e.strokeStyle=n.selectRing,e.lineWidth=1.5,e.beginPath(),e.arc(c.x,c.y,T+4,0,Math.PI*2),e.stroke()),_({x:c.x-T-2,y:c.y-T-2,w:T*2+4,h:T*2+4});e.font='11px SFMono-Regular, Consolas, "Liberation Mono", monospace',e.textBaseline="top",e.textAlign="center",U.sort((c,R)=>{let E=N=>N.n.file===a?1e9:N.n.file===d?1e8:r&&N.dim===1?1e7:a&&v.has(N.n.file)?1e6:t.roots.has(N.n.file)?1e5:N.n.deg;return E(R)-E(c)});let I=0;for(let c of U){let R=c.n.file===a||c.n.file===d;if(!R&&c.dim<.5||!R&&!r&&!a&&S<1&&I>=24)continue;let E=c.n.label.length>38?`${c.n.label.slice(0,36)}\u2026`:c.n.label,N=e.measureText(E).width+8,M={x:c.x-N/2,y:c.y+T+5,w:N,h:16};M.x<4||M.x+M.w>s-4||M.y+M.h>l-24||!R&&x(M).some(h=>w.get(h)?.some(P=>j(M,P)))||(_(M),I++,e.globalAlpha=.94,e.fillStyle=n.bg,e.fillRect(M.x,M.y-1,M.w,M.h),e.globalAlpha=1,e.fillStyle=R?n.labelSelected:n.labelDefault,e.fillText(E,c.x,M.y))}e.restore()}function oi(e){let t=e.nodes.map(i=>({node:i})),o=new Map(t.map(i=>[i.node.file,i])),n=e.edges.flatMap(i=>{let s=o.get(i.a),l=o.get(i.b);return s&&l?[{edge:i,a:s,b:l}]:[]});return{nodes:t,edges:n,graph:e,selected:void 0,neighbors:new Set}}function ni(e,{viewport:t,selected:o,visible:n,dimmed:i,radius:s,color:l,paintKey:g}){if(g===void 0||e.paintKey!==g){let p=new Map;for(let d of e.nodes){let u=d.node;d.visible=n(u),d.visible&&(d.x=u.x*t.k+t.tx,d.y=u.y*t.k+t.ty,d.radius=s(u),d.dimmed=i(u),p.has(u.pkg)||p.set(u.pkg,l(u.pkg)),d.color=p.get(u.pkg))}e.paintKey=g}if(e.selected!==o){e.selected=o,e.neighbors.clear();for(let p of e.graph.adj.get(o)??[]){let d=e.graph.edges[p];e.neighbors.add(d.a),e.neighbors.add(d.b)}}}function ii(e,t,o,n){if(e.paints&&e.edgeOpacity===t&&e.neutral===o&&e.edgeSelected===n)return e.paints;let i=g=>({opacity:Math.max(0,Math.min(255,Math.round(g*255)))/255,neutral:o(g*.7)}),s=n?t*.25:t,l=n?.85:Math.min(.9,t+.5);return e.paints={base:i(s),emphasis:i(l),baseDim:i(Math.min(s,.04)),emphasisDim:i(Math.min(l,.04))},e.edgeOpacity=t,e.neutral=o,e.edgeSelected=n,e.paints}function ri(e,t){let{a:o,b:n}=e;return(!e.gradient||e.ax!==o.node.x||e.ay!==o.node.y||e.bx!==n.node.x||e.by!==n.node.y||e.colorA!==o.color||e.colorB!==n.color)&&(e.gradient=t.createLinearGradient(o.node.x,o.node.y,n.node.x,n.node.y),e.gradient.addColorStop(0,o.color),e.gradient.addColorStop(1,n.color),e.ax=o.node.x,e.ay=o.node.y,e.bx=n.node.x,e.by=n.node.y,e.colorA=o.color,e.colorB=n.color),e.gradient}function si(e,t,o){return(!e.halo||e.haloX!==e.x||e.haloY!==e.y||e.haloRadius!==t||e.haloColor!==e.color)&&(e.halo=o.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 ai(e,t,o,n){return e.x<-2&&t.x<-2||e.x>o+2&&t.x>o+2||e.y<-2&&t.y<-2||e.y>n+2&&t.y>n+2}function To(e,t,o,n,i){return e+o<-2||e-o>n+2||t+o<-2||t-o>i+2}function li(e){let o=new Map;for(let[n,i]of e.entries()){let s=Math.floor(i.x/32),l=Math.floor(i.y/32);o.has(s)||o.set(s,new Map);let g=o.get(s);g.has(l)||g.set(l,[]),g.get(l).push({node:i,index:n})}return(n,i,s,l,g,p)=>{let{k:d,tx:u,ty:r}=s,S=(l+6)/d+1e-7,y=(n-u)/d,m=(i-r)/d,T=Math.floor((y-S)/32),a=Math.floor((y+S)/32),v=Math.floor((m-S)/32),k=Math.floor((m+S)/32),f=null,w=1/0,x=1/0;for(let _=T;_<=a;_++){let j=o.get(_);if(j)for(let U=v;U<=k;U++)for(let{node:I,index:c}of j.get(U)??[]){if(!p(I))continue;let R=I.x*d+u-n,E=I.y*d+r-i,N=R*R+E*E,M=g(I)+6;N<M*M&&(N<w||N===w&&c<x)&&(f=I,w=N,x=c)}}return f}}function ci(e,t,o,n,i){if(!e||e.key!==t.key)return null;let s=(t.tx-e.tx)*i,l=(t.ty-e.ty)*i;if(!Number.isInteger(s)||!Number.isInteger(l)||!Number.isInteger(s/i)||!Number.isInteger(l/i)||!s&&!l||Math.abs(s)>=o*i||Math.abs(l)>=n*i)return null;let g=s/i,p=l/i,d=[],u=2;return g>0&&d.push({x:0,y:0,w:Math.min(o,g+u),h:n}),g<0&&d.push({x:Math.max(0,o+g-u),y:0,w:Math.min(o,-g+u),h:n}),p>0&&d.push({x:0,y:0,w:o,h:Math.min(n,p+u)}),p<0&&d.push({x:0,y:Math.max(0,n+p-u),w:o,h:Math.min(n,-p+u)}),{dx:s,dy:l,rects:d}}function qt(e,t,o,n,i){return e&&e.rects.every(s=>n<s.x||t>s.x+s.w||i<s.y||o>s.y+s.h)}var $r={critical:"#ff5470",high:"#ff9d4a",medium:"#f4d35e",low:"#67c2ff",high_bug:"#a06c3f",bug:"#7a6d62",informational:"#218bff"},Wt={dark:{bg:"#0c0c0c",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:"#f6f8fa",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:"#fff0f7",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"}},Mr={...Wt.light,bg:"#fff",selectRing:"#000",edgeIntra:e=>`rgba(0, 0, 0, ${e})`,labelFill:"#000",labelShadow:"#fff",labelOutline:"#fff",labelDefault:"#000",labelHover:"#000"};function di(){let e=document.body.classList;return e.contains("theme-paper")?Mr:e.contains("theme-pink")?Wt.pink:e.contains("theme-light")?Wt.light:Wt.dark}var ui=(e,t)=>e.x0<t.x1&&t.x0<e.x1&&e.y0<t.y1&&t.y0<e.y1;function Lo(e){e.sort((o,n)=>n.prio-o.prio);let t=[];for(let o of e){let n=!1;for(let i of t)if(ui(o,i)){n=!0;break}n||t.push(o)}return t}var Sr=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ge(e){let t=Math.max(0,Math.min(255,Math.round(e*255)));return Sr[t]}function _r(e,t,o,n){let s=e.querySelector("graph-layout")?.shadowRoot;if(!s)return;let l=s.querySelector("#g2-canvas"),g=s.querySelector("#g2-tooltip"),p=s.querySelector(".graph2-stage"),d=s.querySelector(".g2-stage-stats"),u=s.querySelector("#g2-zoom-pct");if(!l)return;xn();let r=l.getContext("2d"),S=window.devicePixelRatio||1,y=0,m=0,T=0,a={tx:0,ty:0,k:1},v=null,k=0,f=0,w=!0,x=!0,_=new WeakMap,j=null,U=null,I=null,c=()=>t.supportsLayers&&$.bundleLayout==="layers"&&!$.focusedPkg,R=()=>t.supportsLayers&&$.bundleLayout==="dependencies"&&!$.focusedPkg,E=()=>R()&&!ht(t,$.dependencyPackagesView),N=()=>c()||$.bundleLayout==="graph"&&$.packagesView&&(t.canPackagesView??!1)&&!$.focusedPkg,M=null,h=null,P=null;function L(){if(!P&&(P=Nt(t),c()&&t.layerRoots?.appImports.length>0)){if(!P.byPkg.has("__own__")){let b={file:"__own__",pkg:"__own__",label:"App (source not bundled)",size:null,fileCount:0,totalIssues:0};P.nodes.push(b),P.byPkg.set("__own__",b)}P.importsOf.set("__own__",[...new Set([...P.importsOf.get("__own__")??[],...t.layerRoots.appImports])])}return P}function K(){return Ht(t,$.dependencyPackagesView)}let ae=b=>b==="__own__"?"App":M?.depth.get(b)===0?`App \xB7 ${Be(b)}`:Be(b);function ye(b,A,H){if(b.nodes.length>50){Ro(b,A,H);return}let B=Io(b.nodes.map(C=>C.pkg),b.importsOf,A,H,{groupOf:C=>C});he(b.nodes,new Map(B.map(C=>[C.file,C])))}function he(b,A){for(let H of b){let B=A.get(H.file);B&&(H.x=B.x,H.y=B.y)}}function Me(){if(!w)return;if(U=null,I=null,j=null,c()){let C=L();M=Jn(C.nodes.map(X=>({id:X.pkg,size:X.size})),C.importsOf,t.layerRoots?.roots??["__own__"],{width:Math.max(360,f-190)}),w=!1;return}if(R()){let C=K();h=ei(C.nodes.map(X=>X.file),C.importsOf,C.fileLevel?[]:t.layerRoots?.roots??[],{width:f,height:k,cycleImportsOf:C.cycleImportsOf}),w=!1;return}let b=$.layoutCache,A=$.focusedPkg,H=N(),B=H?L().nodes:t.nodes;if(b&&b.files===t.files&&b.w===f&&b.h===k&&b.focused===A&&(b.pkgView??!1)===H)he(B,b.pos);else{if(H)ye(L(),f,k);else if(A)if(t.nodes.length>50)Ro(t,f,k);else{let X=Io(t.files,t.importsOf,f,k);he(t.nodes,new Map(X.map(J=>[J.file,J])))}else Zn(t,f,k);let C=new Map;for(let X of B)C.set(X.file,{x:X.x,y:X.y});$.layoutCache={files:t.files,w:f,h:k,pos:C,focused:A,pkgView:H}}w=!1}function O(){if(R()&&h){if(K().nodes.length<=100){let ie=12;r.save(),r.font='11px SFMono-Regular, Consolas, "Liberation Mono", monospace';for(let re of K().nodes){let W=re.label.length>38?`${re.label.slice(0,36)}\u2026`:re.label;ie=Math.max(ie,r.measureText(W).width/2+4)}return r.restore(),Co([...h.nodes.values()],m,y,{statsHeight:T,left:ie,top:12,bottom:27})}let V=Math.max(20,Math.min(m,y)*.04),q=Math.min((m-V*2)/h.width,(y-V*2-T)/h.height,2.5),Z=Math.max(.05,q);return{k:Z,tx:(m-h.width*Z)/2,ty:(y-T-h.height*Z)/2}}if(c()&&M){let V=Math.min((m-24)/(M.width+185),(y-70)/(M.height+M.gap),1.5),q=Math.max(.05,V);return{k:q,tx:(m-(M.width+185)*q)/2+145*q,ty:24+Math.max(0,(y-70-(M.height+M.gap)*q)/2)}}let b=N()?L().nodes:t.nodes;if(b.length<=50){let V=0,q=0,Z=0;r.save(),r.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace";for(let ie of b){let re=N()?ot(ie):(ie.isHub?6:4)*$.nodeSize,W=re*1.85+5;q=Math.max(q,W,r.measureText(ie.label).width/2+6),Z=Math.max(Z,W),V=Math.max(V,W,re+4+13+4)}return r.restore(),Co(b,m,y,{statsHeight:T,left:q,top:Z,bottom:V})}if(b.length===0)return{k:1,tx:m/2,ty:(y-T)/2};let A=-1/0,H=-1/0,B=1/0,C=1/0;for(let V of b)V.x<B&&(B=V.x),V.y<C&&(C=V.y),V.x>A&&(A=V.x),V.y>H&&(H=V.y);let X=Math.max(20,H-C),J=Math.max(20,A-B),fe=(B+A)/2,le=(C+H)/2,de=Math.max(20,Math.min(m,y)*($.focusedPkg?.04:.03)),D=Math.min((m-de*2)/J,(y-de*2-T)/X,4),z=Math.max(.05,D);return{k:z,tx:m/2-fe*z,ty:(y-T)/2-le*z}}function Q(){let b=O();a.k=b.k,a.tx=b.tx,a.ty=b.ty}function ee(){if(!R()){u&&(u.textContent=`${Math.round(a.k*100)}%`);return}let b=Xt(a.k,O().k,!0);u&&(u.textContent=`${b.percent}%`),Jt&&(Jt.disabled=a.k<=b.min*1.0001),Zt&&(Zt.disabled=a.k>=b.max*.9999)}function G(b,A){return[b*a.k+a.tx,A*a.k+a.ty]}function Y(b,A){return[(b-a.tx)/a.k,(A-a.ty)/a.k]}function te(b){return!$.hidden.has(b.pkg)}function Te(b,A,H,B,C){let X=H+(B==="critical"?4.2:B==="high"?3.4:2.8),J=B==="critical"?1.8:B==="high"?1.5:B==="medium"?1.3:1.1;r.strokeStyle=$r[B],r.globalAlpha=C,r.lineWidth=J,r.beginPath(),r.arc(b,A,X,0,Math.PI*2),r.stroke(),r.globalAlpha=1}function me(b,A,H,B,C,X,J){let de=J?.1:.9,D=2*(1-de)*(H-b)+2*de*(C-H),z=2*(1-de)*(B-A)+2*de*(X-B),V=Math.sqrt(D*D+z*z)||1,q=D/V,Z=z/V;r.beginPath(),J?(r.moveTo(b,A),r.lineTo(b+q*7-Z*2.94,A+Z*7+q*2.94),r.lineTo(b+q*7+Z*2.94,A+Z*7-q*2.94)):(r.moveTo(C,X),r.lineTo(C-q*7+Z*2.94,X-Z*7-q*2.94),r.lineTo(C-q*7-Z*2.94,X-Z*7+q*2.94)),r.closePath()}function pe(b){if($.selectedSeverities.size>0){let H=b.severitySet;if(!H)return!0;let B=!1;for(let C of $.selectedSeverities)if(H.has(C)){B=!0;break}if(!B)return!0}if($.selectedColors.size>0){let H=b.colorSet;if(!H)return!0;let B=!1;for(let C of $.selectedColors)if(H.has(C)){B=!0;break}if(!B)return!0}if($.solo&&b.pkg!==$.solo&&!N()&&!E())return!0;let A=$.pathFilter;if(A){let H=A.toLowerCase(),B=b.pathText?b.pathText.includes(H):b.file.toLowerCase().includes(H),C=b.pkg&&b.pkg.toLowerCase().includes(H),X=b.label&&b.label.toLowerCase().includes(H);if(!B&&!C&&!X)return!0}return!1}function ge(b){let A=(b.isHub?4.9:3.5)*$.nodeSize,H=Math.max(.6,Math.min(1.6,a.k));return A*H}function Se(){let b=p.getBoundingClientRect(),A=y,H=m;m=Math.max(80,b.width),y=Math.max(80,b.height),T=d?(parseFloat(getComputedStyle(d).lineHeight)||0)+8:0,S=window.devicePixelRatio||1,l.width=m*S,l.height=y*S,U=null,_.delete(t),P&&_.delete(P),l.style.width=m+"px",l.style.height=y+"px",r.setTransform(S,0,0,S,0,0),(f===0||k===0)&&(f=m,k=y,w=!0),Me();let B=H>0&&(Math.abs(m-H)/H>.15||Math.abs(y-A)/A>.15);(x||B)&&(Q(),x=!1),_e()}let De=null,Ae=!0,Xe=!1,qe=!1;function _e(){Ae=!0,!(Xe||qe)&&(Xe=!0,De=requestAnimationFrame(()=>{Xe=!1,Ae&&!qe&&(Ae=!1,fi())}))}function fi(){let b=N()?L():t;if(I?.graph!==b){I={graph:b,x0:1/0,y0:1/0,x1:-1/0,y1:-1/0};for(let J of b.nodes)I.x0=Math.min(I.x0,J.x),I.x1=Math.max(I.x1,J.x),I.y0=Math.min(I.y0,J.y),I.y1=Math.max(I.y1,J.y)}let A=ge({isHub:!0})*6+8,B=I.x0*a.k+a.tx>A&&I.y0*a.k+a.ty>A&&I.x1*a.k+a.tx<m-A&&I.y1*a.k+a.ty<y-A&&a.k<=1.4&&b.nodes.length>50&&!c()&&!R(),C={tx:a.tx,ty:a.ty,key:JSON.stringify([a.k,di().bg,$.nodeSize,$.edgeOpacity,v,$.selected,$.solo,$.focusedPkg,N(),$.showAll,$.pathFilter,[...$.selectedSeverities],[...$.selectedColors],[...$.hidden]])},X=B?ci(U,C,m,y,S):null;r.save();try{if(X){r.save(),r.setTransform(1,0,0,1,0,0),r.globalCompositeOperation="copy",r.drawImage(l,X.dx,X.dy),r.restore(),r.beginPath();for(let J of X.rects)r.rect(J.x,J.y,J.w,J.h);r.clip()}gi(X),U=B?C:null}finally{r.restore()}}function gi(b){let A=di();r.fillStyle=A.bg,r.fillRect(0,0,m,y),hi(A);let H=R(),B=N(),C=H?K():B?L():t,X=E()||B?$.solo:$.selected,J=X?C.nodeByFile.get(X):null,fe=J?X:null;if(H){ti(r,h,C,{theme:A,viewport:a,width:m,height:y,colorOf:be,selected:fe,hovered:v,query:$.pathFilter,dimmed:W=>pe(W)}),ee();return}if(c()){r.save(),r.translate(a.tx,a.ty),r.scale(a.k,a.k),Qn(r,M,{theme:A,scale:a.k,selected:fe,hovered:v,colorOf:be,labelOf:ae,sizeLabel:W=>Ze(typeof W=="number"?W:C.byPkg.get(W).size)||"Size unknown",dimmed:W=>pe(C.byPkg.get(W))}),r.restore(),ee();return}if(B&&C.nodes.length<=50){bi(A);return}if($.focusedPkg&&C.nodes.length<=50){mi(A,fe,J);return}_.has(C)||_.set(C,oi(C));let le=_.get(C),de=JSON.stringify([a.k,a.tx,a.ty,$.nodeSize,A.bg,$.solo,$.pathFilter,[...$.selectedSeverities],[...$.selectedColors],[...$.hidden]]);ni(le,{viewport:a,selected:fe,paintKey:de,visible:te,dimmed:pe,radius:ge,color:be});let D=ii(le,$.edgeOpacity,A.edgeIntra,!!fe),z=fe||v,V=.85/a.k,q=.55/a.k,Z=null,ie=null,re=null;r.save(),r.translate(a.tx,a.ty),r.scale(a.k,a.k);for(let W of le.edges){let{edge:ne,a:oe,b:ce}=W;if(!oe.visible||!ce.visible||ai(oe,ce,m,y)||qt(b,Math.min(oe.x,ce.x)-2,Math.min(oe.y,ce.y)-2,Math.max(oe.x,ce.x)+2,Math.max(oe.y,ce.y)+2))continue;let ve=z&&(ne.a===z||ne.b===z),ue=oe.dimmed&&ce.dimmed?ve?D.emphasisDim:D.baseDim:ve?D.emphasis:D.base,we=ne.cross?ri(W,r):ue.neutral,ke=ne.cross?ue.opacity:1,Pe=ne.cross?V:q;we!==ie&&(r.strokeStyle=we,ie=we),ke!==Z&&(r.globalAlpha=ke,Z=ke),Pe!==re&&(r.lineWidth=Pe,re=Pe),r.beginPath(),r.moveTo(oe.node.x,oe.node.y),r.lineTo(ce.node.x,ce.node.y),r.stroke()}r.restore();for(let W of le.nodes){if(!W.visible)continue;let ne=W.node,oe=ne.file===v,ce=ne.file===fe;if(!ne.isHub&&!oe&&!ce||W.dimmed&&!oe&&!ce)continue;let ve=W.radius,ue=W.x,we=W.y,ke=ve*(ce?6:oe?4.5:3);To(ue,we,ke,m,y)||qt(b,ue-ke-2,we-ke-2,ue+ke+2,we+ke+2)||(r.fillStyle=si(W,ke,r),r.beginPath(),r.arc(ue,we,ke,0,Math.PI*2),r.fill())}for(let W of le.nodes){if(!W.visible)continue;let ne=W.node,oe=W.radius,ce=W.x,ve=W.y;if(To(ce,ve,oe+6,m,y)||qt(b,ce-oe-8,ve-oe-8,ce+oe+8,ve+oe+8))continue;let ue=1,we=fe&&ne.file===fe;fe&&!we&&(ue=le.neighbors.has(ne.file)?1:.25),!we&&W.dimmed&&(ue=Math.min(ue,.1)),r.fillStyle=W.color+Ge(ue),r.beginPath(),r.arc(ce,ve,oe,0,Math.PI*2),r.fill(),ne.isHub&&(r.strokeStyle=A.hubRing(.55*ue),r.lineWidth=.8,r.stroke()),ne.issue&&Te(ce,ve,oe,ne.issue,ue)}if(a.k>1.4){let ne=0;if(a.k<9&&!$.showLabels)for(let ce of C.nodes){if(!te(ce))continue;let[ve,ue]=G(ce.x,ce.y);if(!(ve<0||ve>m||ue<0||ue>y)&&(ne++,ne>=50))break}let oe=a.k>=9||ne<50;if($.showLabels||oe){r.font="10px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",r.fillStyle=A.labelFill,r.textAlign="left",r.textBaseline="middle";let ce=11,ve=2,ue=250,we=(se,$e)=>se>-ue&&se<m+ue&&$e>-ue&&$e<y+ue,ke=[];for(let se of C.nodes){if(!te(se))continue;let[$e,Re]=G(se.x,se.y);if(!we($e,Re))continue;let Ie=ge(se);ke.push({file:se.file,x0:$e-Ie,x1:$e+Ie,y0:Re-Ie,y1:Re+Ie})}let Pe=[];for(let se of C.nodes){if(!te(se)||!se.isHub&&a.k<2.4)continue;let[$e,Re]=G(se.x,se.y);if(!we($e,Re))continue;let Ie=ge(se),Le=$e+Ie+4,Ce=Re+1,ze=r.measureText(se.label).width+ve,Oe=se.file===fe,We=se.file===v,Qe=Oe?3:We?2:se.isHub?1:0;Pe.push({file:se.file,n:se,tx:Le,ty:Ce,prio:Qe,x0:Le-ve,x1:Le+ze,y0:Ce-ce/2,y1:Ce+ce/2})}let Je=Lo(Pe.filter(se=>!ke.some($e=>$e.file!==se.file&&ui(se,$e))));for(let se of Je)r.fillText(se.n.label,se.tx,se.ty)}}if(J&&te(J)){let[W,ne]=G(J.x,J.y),oe=ge(J);r.strokeStyle=A.selectRing,r.lineWidth=1.5,r.beginPath(),r.arc(W,ne,oe+5,0,Math.PI*2),r.stroke()}ee()}function hi(b){if(a.k<.4)return;let A=80,H=(a.tx%A+A)%A,B=(a.ty%A+A)%A;r.strokeStyle=b.grid,r.lineWidth=1,r.beginPath();for(let C=H;C<m;C+=A)r.moveTo(C,0),r.lineTo(C,y);for(let C=B;C<y;C+=A)r.moveTo(0,C),r.lineTo(m,C);r.stroke()}function mi(b,A,H){let B=be($.focusedPkg),C=b.hubRing(.55),X=new Set;if(v){X.add(v);for(let z of t.adj.get(v)??[]){let V=t.edges[z];X.add(V.a),X.add(V.b)}}let J=z=>(z.isHub?6:4)*$.nodeSize;for(let z of t.edges){let V=t.nodeByFile.get(z.a),q=t.nodeByFile.get(z.b);if(!V||!q||!te(V)||!te(q))continue;let Z=z.fromLo&&z.fromHi,ie=!Z&&z.fromHi,re=ie?q:V,W=ie?V:q,ne=v&&(z.a===v||z.b===v),oe=A&&(z.a===A||z.b===A),ce=(A||v)&&!ne&&!oe,ve=J(re),ue=J(W),[we,ke]=G(re.x,re.y),[Pe,Je]=G(W.x,W.y),se=Pe-we,$e=Je-ke,Re=Math.sqrt(se*se+$e*$e)||1,Ie=se/Re,Le=$e/Re,Ce=we+Ie*(ve+1.5),ze=ke+Le*(ve+1.5),Oe=Pe-Ie*(ue+3.5),We=Je-Le*(ue+3.5),Qe=Math.min(Re*.15,30),nt=(Ce+Oe)/2-Le*Qe,Fe=(ze+We)/2+Ie*Qe;r.beginPath(),r.moveTo(Ce,ze),r.quadraticCurveTo(nt,Fe,Oe,We);let Ue;oe?Ue=.9:ne?Ue=.85:ce?Ue=.05:Ue=Math.min(.85,$.edgeOpacity*3),r.strokeStyle=B+Ge(Ue),r.lineWidth=oe||ne?1.5:.85,r.stroke(),!ce&&(me(Ce,ze,nt,Fe,Oe,We,!1),r.fillStyle=B+Ge(Math.min(1,Ue+.15)),r.fill(),Z&&(me(Ce,ze,nt,Fe,Oe,We,!0),r.fill()))}for(let z of t.nodes){if(!te(z))continue;let[V,q]=G(z.x,z.y),Z=J(z),ie=z.file===v,re=z.file===A,W=(A||v)&&!X.has(z.file)&&!re?.15:1;if(r.globalAlpha=W,re||ie||z.isHub){let ne=Z*(re?4:ie?3:2.4),oe=r.createRadialGradient(V,q,Z*.6,V,q,ne);oe.addColorStop(0,B+Ge(re?.4:.25)),oe.addColorStop(1,B+"00"),r.fillStyle=oe,r.beginPath(),r.arc(V,q,ne,0,Math.PI*2),r.fill()}r.fillStyle=B,r.beginPath(),r.arc(V,q,Z,0,Math.PI*2),r.fill(),z.isHub&&(r.strokeStyle=C,r.lineWidth=.9,r.stroke()),z.issue&&Te(V,q,Z,z.issue,W),r.globalAlpha=1}r.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",r.textAlign="center",r.textBaseline="top",r.lineJoin="round";let fe=13,le=2,de=[];for(let z of t.nodes){if(!te(z))continue;let[V,q]=G(z.x,z.y),Z=J(z),ie=q+Z+4,re=r.measureText(z.label).width/2+le,W=z.file===A,ne=z.file===v,oe=W?3:ne?2:z.isHub?1:0;de.push({n:z,sx:V,ty:ie,halfW:re,isSel:W,isHov:ne,prio:oe,x0:V-re,x1:V+re,y0:ie,y1:ie+fe})}let D=Lo(de);for(let z of D){let{n:V,sx:q,ty:Z,isSel:ie,isHov:re}=z,W=(A||v)&&!X.has(V.file)&&!ie?.2:1;r.globalAlpha=W,r.shadowColor=b.labelShadow,r.shadowBlur=4,r.strokeStyle=b.labelOutline,r.lineWidth=3,r.strokeText(V.label,q,Z),r.shadowBlur=0,r.fillStyle=ie?b.labelSelected:re?b.labelHover:b.labelDefault,r.fillText(V.label,q,Z),r.globalAlpha=1}if(H&&te(H)){let[z,V]=G(H.x,H.y),q=J(H);r.strokeStyle=b.selectRing,r.lineWidth=1.8,r.beginPath(),r.arc(z,V,q+4,0,Math.PI*2),r.stroke()}ee()}function ot(b){return Math.min(26,5+Math.sqrt(b.fileCount)*1.7)*$.nodeSize}function bi(b){let A=L(),H=$.solo&&A.byPkg.has($.solo)?$.solo:null,B=v??H,C=new Set;if(B){C.add(B);for(let D of A.edges)D.a===B?C.add(D.b):D.b===B&&C.add(D.a)}let X=D=>{if(D.pkg===H||D.pkg===v)return 1;let z=1;return B&&!C.has(D.pkg)&&(z=.2),pe(D)&&(z=Math.min(z,.1)),z};for(let D of A.edges){let z=A.byPkg.get(D.a),V=A.byPkg.get(D.b);if(!z||!V||!te(z)||!te(V))continue;let q=D.fromLo&&D.fromHi,Z=!q&&D.fromHi,ie=Z?V:z,re=Z?z:V,W=B!==null&&(D.a===B||D.b===B),ne=pe(z)&&pe(V),oe=B!==null&&!W||ne,ce=ot(ie),ve=ot(re),[ue,we]=G(ie.x,ie.y),[ke,Pe]=G(re.x,re.y),Je=ke-ue,se=Pe-we,$e=Math.sqrt(Je*Je+se*se)||1,Re=Je/$e,Ie=se/$e,Le=ue+Re*(ce+1.5),Ce=we+Ie*(ce+1.5),ze=ke-Re*(ve+3.5),Oe=Pe-Ie*(ve+3.5),We=Math.min($e*.15,30),Qe=(Le+ze)/2-Ie*We,nt=(Ce+Oe)/2+Re*We,Fe;ne?Fe=.05:W?Fe=.9:oe?Fe=.06:Fe=.5;let Ue=r.createLinearGradient(Le,Ce,ze,Oe);Ue.addColorStop(0,be(ie.pkg)+Ge(Fe)),Ue.addColorStop(1,be(re.pkg)+Ge(Fe)),r.beginPath(),r.moveTo(Le,Ce),r.quadraticCurveTo(Qe,nt,ze,Oe),r.strokeStyle=Ue,r.lineWidth=Math.min(3.5,.8+Math.sqrt(D.count)*.3)*(W?1.3:1),r.stroke(),!oe&&(me(Le,Ce,Qe,nt,ze,Oe,!1),r.fillStyle=be(re.pkg)+Ge(Math.min(1,Fe+.15)),r.fill(),q&&(me(Le,Ce,Qe,nt,ze,Oe,!0),r.fillStyle=be(ie.pkg)+Ge(Math.min(1,Fe+.15)),r.fill()))}for(let D of A.nodes){if(!te(D))continue;let[z,V]=G(D.x,D.y),q=ot(D),Z=D.pkg===v,ie=D.pkg===H,re=be(D.pkg),W=X(D);if(ie||Z){let ne=q*(ie?2.6:2.2),oe=r.createRadialGradient(z,V,q*.6,z,V,ne);oe.addColorStop(0,re+Ge(ie?.4:.25)),oe.addColorStop(1,re+"00"),r.fillStyle=oe,r.beginPath(),r.arc(z,V,ne,0,Math.PI*2),r.fill()}r.fillStyle=re+Ge(W),r.beginPath(),r.arc(z,V,q,0,Math.PI*2),r.fill(),D.issue&&Te(z,V,q,D.issue,W)}r.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",r.textAlign="center",r.textBaseline="top",r.lineJoin="round";let J=13,fe=2,le=[];for(let D of A.nodes){if(!te(D))continue;let[z,V]=G(D.x,D.y),q=ot(D),Z=V+q+4,ie=r.measureText(D.label).width/2+fe,re=D.pkg===H,W=D.pkg===v,ne=re?1/0:W?1e9:D.fileCount;le.push({p:D,sx:z,ty:Z,isSel:re,isHov:W,prio:ne,x0:z-ie,x1:z+ie,y0:Z,y1:Z+J})}let de=Lo(le);for(let D of de){let{p:z,sx:V,ty:q,isSel:Z,isHov:ie}=D;r.globalAlpha=Math.max(.25,X(z)),r.shadowColor=b.labelShadow,r.shadowBlur=4,r.strokeStyle=b.labelOutline,r.lineWidth=3,r.strokeText(z.label,V,q),r.shadowBlur=0,r.fillStyle=Z?b.labelSelected:ie?b.labelHover:b.labelDefault,r.fillText(z.label,V,q),r.globalAlpha=1}if(H){let D=A.byPkg.get(H),[z,V]=G(D.x,D.y);r.strokeStyle=b.selectRing,r.lineWidth=1.8,r.beginPath(),r.arc(z,V,ot(D)+4,0,Math.PI*2),r.stroke()}ee()}function Eo(b,A){if(R()){let[le,de]=Y(b,A),D=null,z=1/0;for(let[V,q]of h.nodes){let Z=(q.x-le)**2+(q.y-de)**2;Z<z&&Z<(14/Math.max(a.k,.1))**2&&(z=Z,D=K().nodeByFile.get(V))}return D}if(c()){let[le,de]=Y(b,A);for(let D of M.rects.values())if(D.width>0&&le>=D.x&&le<D.x+D.width&&de>=D.y&&de<=D.y+D.height)return L().byPkg.get(D.id);return null}let H=N(),B=H?L():t,C=H&&B.nodes.length<=50;if(B.nodes.length>50){j??=li(B.nodes);let le=4.9*$.nodeSize*Math.max(.6,Math.min(1.6,a.k));return j(b,A,a,le,ge,te)}let X=null,J=1/0,fe=6;for(let le of B.nodes){if(!te(le))continue;let[de,D]=G(le.x,le.y),z=de-b,V=D-A,q=z*z+V*V,Z=(C?ot(le):ge(le))+fe;q<Z*Z&&q<J&&(J=q,X=le)}return X}function xi(b,A,H){if(!g)return;let B=be(b.pkg),C=Be(b.pkg),X=Bt(b.file,b.pkg);it(F`<div class="g2-tt-path">${X}</div><div class="g2-tt-head"><span class="g2-tt-dot" style="${`background:${B}`}"></span> <span class="g2-tt-pkg">${C}</span></div>${b.totalIssues>0?dt(b.own):null}`,g),Po(A,H)}function vi(b,A,H){if(!g)return;let B=be(b.pkg),C=Ze(b.size);it(F`<div class="g2-tt-path">${c()?ae(b.pkg):b.label}</div>${R()?F`<div class="g2-tt-pkg">${K().importedBy.get(b.pkg).length} importers · ${K().importsOf.get(b.pkg)?.length??0} dependencies</div>`:null} ${c()?F`<div class="g2-tt-pkg">${M.depth.has(b.pkg)?`Level ${M.depth.get(b.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:${B}`}"></span> <span class="g2-tt-pkg">${b.fileCount} ${b.fileCount===1?"file":"files"}${C?` \xB7 ${C}`:""}</span></div>${b.totalIssues>0?dt(b.own):null}`,g),Po(A,H)}function Po(b,A){let H=p.getBoundingClientRect();g.classList.add("show");let B=g.offsetWidth,C=g.offsetHeight,X=b-H.left,J=A-H.top,fe=H.width,le=H.height,de=12,D=X+de;D+B>fe-4&&(D=X-B-de),D<4&&(D=4);let z=J+de;z+C>le-4&&(z=J-C-de),z<4&&(z=4),g.style.left=`${D}px`,g.style.top=`${z}px`}function Yt(){g&&g.classList.remove("show")}let St=!1,bt=null,Kt=!1,zo=b=>{b.button===0&&(b.target.closest(".g2-stage-overlay, .g2-stage-overlay-tr, .g2-zoom-ctrl")||(St=!0,Kt=!1,bt={x:b.clientX,y:b.clientY,tx:a.tx,ty:a.ty}))},Oo=b=>{let A=p.getBoundingClientRect(),H=b.clientX-A.left,B=b.clientY-A.top;if(St){let J=b.clientX-bt.x,fe=b.clientY-bt.y;Math.abs(J)+Math.abs(fe)>3&&(Kt=!0),a.tx=bt.tx+J,a.ty=bt.ty+fe,Yt(),_e();return}let C=Eo(H,B),X=v;v=C?.file??null,l.style.cursor=C?"default":"grab",C?N()||E()?vi(C,b.clientX,b.clientY):xi(C,b.clientX,b.clientY):X&&Yt(),v!==X&&_e()},Fo=b=>{if(St&&!Kt){let A=p.getBoundingClientRect(),H=b.clientX-A.left,B=b.clientY-A.top,C=Eo(H,B);N()||E()?($.solo=C&&$.solo!==C.pkg?C.pkg:null,$.selected=null,o(),n?.()):($.selected=C?.file??null,o()),_e()}St=!1},No=()=>{let b=v!==null;v=null,Yt(),b&&_e()},Bo=b=>{b.preventDefault();let A=p.getBoundingClientRect(),H=b.clientX-A.left,B=b.clientY-A.top,C=Math.exp(-b.deltaY*.0015),X=O();if(C<1&&a.k<=X.k*1.0001){a.k=X.k;let D=Math.min(.4,(1-C)*3);a.tx+=(X.tx-a.tx)*D,a.ty+=(X.ty-a.ty)*D,_e();return}let[J,fe]=Y(H,B),le=Xt(a.k,X.k,R()),de=Math.max(le.min,Math.min(le.max,a.k*C));a.k=de,a.tx=H-J*a.k,a.ty=B-fe*a.k,_e()};p.addEventListener("mousedown",zo),window.addEventListener("mousemove",Oo),window.addEventListener("mouseup",Fo),p.addEventListener("mouseleave",No),p.addEventListener("wheel",Bo,{passive:!1});function Ho(b){let A=Xt(a.k,O().k,R());b=Math.max(A.min,Math.min(A.max,b));let H=m/2,B=y/2,[C,X]=Y(H,B);a.k=b,a.tx=H-C*a.k,a.ty=B-X*a.k,_e()}let Zt=s.querySelector("#g2-zoom-in"),Jt=s.querySelector("#g2-zoom-out"),yi=s.querySelector("#g2-zoom-fit");Zt?.addEventListener("click",()=>Ho(a.k*1.4)),Jt?.addEventListener("click",()=>Ho(a.k/1.4)),yi?.addEventListener("click",()=>{Q(),_e()}),Se();let Do=new ResizeObserver(()=>Se());Do.observe(p);let jo=new MutationObserver(b=>{for(let A of b){let H=(A.oldValue||"").includes("report-fullscreen"),B=document.body.classList.contains("report-fullscreen");if(H!==B){f=0,k=0,w=!0,x=!0,$.layoutCache=null,setTimeout(()=>Se(),80);return}_e()}});jo.observe(document.body,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0}),_e(),$.graphState={requestDraw:_e,_cleanup:()=>{qe=!0,cancelAnimationFrame(De),Do.disconnect(),jo.disconnect(),p.removeEventListener("mousedown",zo),window.removeEventListener("mousemove",Oo),window.removeEventListener("mouseup",Fo),p.removeEventListener("mouseleave",No),p.removeEventListener("wheel",Bo)}}}function Bl(e,t){let o=document.querySelector("graph-layout")?.shadowRoot;if(!o)return;let n=pi(e),i=o.querySelector("#g2-selection-area");i&&it(En(n,t),i);let s=o.querySelector("#g2-focus-overlay-slot");s&&it(Cn(n),s)}function Hl(e){let t=document.querySelector("graph-layout")?.shadowRoot;if(!t)return;let o=t.querySelector("#g2-top-pkgs-block");o&&it(Ln(pi(e)),o)}function pi(e){let t=$n(e.treeData,e.files,e.ownCounts,e.transitiveCounts,e.severitySets,e.colorSets,e.fileFindings,e.options);if(e.strippedToOrig)for(let o of t.nodes)o.origFile=e.strippedToOrig.get(o.file);return t.canPackagesView=e.canPackagesView??!1,t.supportsLayers=e.supportsLayers??!1,t.layerRoots=e.layerRoots,t.ownSourcePackages=e.ownSourcePackages,t.ownSourceFiles=e.ownSourceFiles,t.reasons=e.reasons??[],t}export{Wi as _swapGraph2Impl,_r as attachGraph2Interaction,pi as buildGraphFromPrep,Bl as refreshSidebar,Hl as refreshTopPkgs};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
lit-html/directives/unsafe-html.js:
|
|
17
|
-
(**
|
|
18
|
-
* @license
|
|
19
|
-
* Copyright 2017 Google LLC
|
|
20
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
|
-
*)
|
|
22
|
-
|
|
23
|
-
lit-html/directive-helpers.js:
|
|
24
|
-
lit-html/directives/live.js:
|
|
25
|
-
(**
|
|
26
|
-
* @license
|
|
27
|
-
* Copyright 2020 Google LLC
|
|
28
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
29
|
-
*)
|
|
30
|
-
*/
|
|
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-OJ5DGP5E.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-ZPD5R5RP.js";import"./chunk-V3ME6FI5.js";import{h as $e}from"./chunk-YVZH5SHP.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-HIV7SVI7.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
|
+
`;var he=`.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}}
|
|
3
|
+
`;var fe=`.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
|
+
`;var Ho=`.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
|
+
`;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 Je(t){let e=new Map;for(let o=0;o<t.length;o++){let i=t[o];e.has(i.a)||e.set(i.a,[]),e.has(i.b)||e.set(i.b,[]),e.get(i.a).push(o),e.get(i.b).push(o)}return e}function Xo(t){if(!t)return null;for(let e of Yt)if((t[e]??0)>0)return e;return null}function Vo(t,e,o,i,s,n,a,h={}){let f=h.pkgOf??Pe,u=new Set(e),c=new Map,b=new Map;for(let x of e){let k=(t[x].imports??[]).filter(_=>u.has(_));c.set(x,k);for(let _ of k)b.has(_)||b.set(_,[]),b.get(_).push(x)}let w=e.map(x=>{let k=o.get(x),_=i?.get(x)??null,O=Bo(k),C=f(x)??"__own__",m=Xo(k);return{id:x,file:x,pkg:C,packageInfo:h.packageInfoOf?.(x),x:0,y:0,deg:0,issue:m,totalIssues:O,own:k,subtree:_,size:typeof t[x]?.size=="number"?t[x].size:null,severitySet:s?.get(x)??null,colorSet:n?.get(x)??null,findings:a?.get(x)??null,isHub:!1,label:x.split("/").pop()??x}}),r=new Map(w.map(x=>[x.file,x])),y=new Map;for(let x of e)for(let k of c.get(x)??[]){let[_,O]=x<k?[x,k]:[k,x],C=`${_}\0${O}`,m=y.get(C);if(!m){let $=r.get(_),P=r.get(O);if(!$||!P)continue;m={a:_,b:O,cross:$.pkg!==P.pkg,fromLo:!1,fromHi:!1},y.set(C,m),$.deg++,P.deg++}x===_?m.fromLo=!0:m.fromHi=!0}let M=[...y.values()],p=Je(M),g=new Map;for(let x of w)g.set(x.pkg,(g.get(x.pkg)??0)+1);let l=[...g.entries()].toSorted((x,k)=>k[1]-x[1]).map(([x])=>x),d=new Map;for(let x of w)d.has(x.pkg)||d.set(x.pkg,[]),d.get(x.pkg).push(x);let v={files:e,nodes:w,nodeByFile:r,edges:M,adj:p,importsOf:c,importedBy:b,packages:l,pkgCount:g,byPkg:d};return Ji(v),v}function Ji(t){for(let e of t.nodes)e.isHub=!1;for(let e of t.edges)e.cross&&(e.fromLo&&(t.nodeByFile.get(e.b).isHub=!0),e.fromHi&&(t.nodeByFile.get(e.a).isHub=!0));for(let e of t.nodes){let o=t.importedBy.get(e.file);(!o||o.length===0)&&(e.isHub=!0)}}function xe(t){let e=t.packages.map(h=>{let f=t.byPkg.get(h)??[],u={};for(let p of Yt)u[p]=0;let c=new Set,b=new Set,w=[],r=0,y=0,M=!1;for(let p of f){if(r+=p.totalIssues,p.own)for(let g of Yt)u[g]+=p.own[g]??0;if(p.severitySet)for(let g of p.severitySet)c.add(g);if(p.colorSet)for(let g of p.colorSet)b.add(g);typeof p.size=="number"&&(y+=p.size,M=!0),w.push(p.file)}return{file:h,pkg:h,label:Dt(h),fileCount:f.length,size:M?y:null,own:u,totalIssues:r,issue:Xo(u),severitySet:c.size>0?c:null,colorSet:b.size>0?b:null,pathText:w.join(`
|
|
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: ${t.version}`:"";if(t.instances.length===1)return`
|
|
10
|
+
Version: ${t.instances[0].version||"Unknown"}`;let e=new Map;for(let o of t.instances){let i=o.version||"Unknown version";e.has(i)||e.set(i,{version:i,size:0,count:0,missing:0});let s=e.get(i);s.size+=o.size,s.count++,s.missing+=o.missing}return`
|
|
11
|
+
Versions \xB7 own source size
|
|
12
|
+
`+[...e.values()].toSorted((o,i)=>i.size-o.size||o.version.localeCompare(i.version)).map(o=>`${o.version} \xB7 ${Ct(o.size)}${o.missing?"+":""} \xB7 ${o.count} ${o.count===1?"copy":"copies"}`).join(`
|
|
13
|
+
`)}function pi(t,e){return`${t.label}
|
|
14
|
+
${Ct(t.removable)} unique \xB7 ${Ct(t.size)} reachable \xB7 ${Ct(t.own)} own${t.removableMissing?` \xB7 ${t.removableMissing} removed file sizes unknown`:""}${us(t)}${Be(t,e)?`
|
|
15
|
+
Kept by Large to preserve an entry-point path`:""}`}function gs(t,e){return`${e.byId.get(t.from).label} \u2192 ${e.byId.get(t.to).label}
|
|
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};
|