@preventive/triage 1.0.0-alpha.23 → 1.0.0-alpha.25

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/out/graph.js CHANGED
@@ -1,14 +1,14 @@
1
- var No=globalThis[Symbol.for("@rray/frontend")];if(!No)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");var{LitElement:ut,html:O,nothing:pr,unsafeCSS:Ue,render:ot,StateElement:bi,classMap:pt,repeat:Zt,styleMap:Ze}=No;var Ho=`*,*: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: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:.6rem .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: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: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: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:6px;padding:2px;gap:2px;& button{display:inline-flex;align-items:center;justify-content:center;border:0;border-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: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: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-divider);border-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)}}.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: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: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: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: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: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: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: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{background:var(--graph-hover-bg);border:1px dashed var(--border);border-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}}
1
+ var No=globalThis[Symbol.for("@rray/frontend")];if(!No)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");var{LitElement:ut,html:O,nothing:pi,unsafeCSS:Ue,render:ot,StateElement:br,classMap:pt,repeat:Zt,styleMap:Ze}=No;var Ho=`*,*: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: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:.6rem .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: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: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: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:6px;padding:2px;gap:2px;& button{display:inline-flex;align-items:center;justify-content:center;border:0;border-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: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: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-divider);border-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)}}.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: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: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: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: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: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: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: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{background:var(--graph-hover-bg);border:1px dashed var(--border);border-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
2
  `;var Mt=`.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: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
3
  `;var Do=`.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:#000}&.high_bug{background:var(--high-bug);color:#fff}&.bug{background:var(--bug);color:#fff}&.informational{background:var(--info);color:#fff}}
4
4
  `;var Uo=`.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: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: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: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: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: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: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: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: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: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: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: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: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: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}}}source-filter{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-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: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: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: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: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: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:6px;padding:3px;height:30px;gap:1px;& button{width:22px;height:22px;background:transparent;border:0;border-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 Qt=globalThis,Vo=e=>e,St=Qt.trustedTypes,Go=St?St.createPolicy("lit-html",{createHTML:e=>e}):void 0,eo="$lit$",Xe=`lit$${Math.random().toFixed(9).slice(2)}$`,to="?"+Xe,br=`<${to}>`,it=document,_t=()=>it.createComment(""),xt=e=>e===null||typeof e!="object"&&typeof e!="function",oo=Array.isArray,Ko=e=>oo(e)||typeof e?.[Symbol.iterator]=="function",Jt=`[
5
+ `;var Qt=globalThis,Vo=e=>e,St=Qt.trustedTypes,Go=St?St.createPolicy("lit-html",{createHTML:e=>e}):void 0,eo="$lit$",Xe=`lit$${Math.random().toFixed(9).slice(2)}$`,to="?"+Xe,bi=`<${to}>`,rt=document,_t=()=>rt.createComment(""),xt=e=>e===null||typeof e!="object"&&typeof e!="function",oo=Array.isArray,Ko=e=>oo(e)||typeof e?.[Symbol.iterator]=="function",Jt=`[
6
6
  \f\r]`,bt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,jo=/-->/g,Xo=/>/g,nt=RegExp(`>|${Jt}(?:([^\\s"'>=/]+)(${Jt}*=${Jt}*(?:[^
7
- \f\r"'\`<>=]|("|')|))|$)`,"g"),qo=/'/g,Wo=/"/g,Zo=/^(?:script|style|textarea|title)$/i,no=e=>(t,...o)=>({_$litType$:e,strings:t,values:o}),$i=no(1),Mi=no(2),Si=no(3),Be=Symbol.for("lit-noChange"),me=Symbol.for("lit-nothing"),Yo=new WeakMap,rt=it.createTreeWalker(it,129);function Jo(e,t){if(!oo(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Go!==void 0?Go.createHTML(t):t}var Qo=(e,t)=>{let o=e.length-1,n=[],r,a=t===2?"<svg>":t===3?"<math>":"",l=bt;for(let g=0;g<o;g++){let p=e[g],d,u,i=-1,$=0;for(;$<p.length&&(l.lastIndex=$,u=l.exec(p),u!==null);)$=l.lastIndex,l===bt?u[1]==="!--"?l=jo:u[1]!==void 0?l=Xo:u[2]!==void 0?(Zo.test(u[2])&&(r=RegExp("</"+u[2],"g")),l=nt):u[3]!==void 0&&(l=nt):l===nt?u[0]===">"?(l=r??bt,i=-1):u[1]===void 0?i=-2:(i=l.lastIndex-u[2].length,d=u[1],l=u[3]===void 0?nt:u[3]==='"'?Wo:qo):l===Wo||l===qo?l=nt:l===jo||l===Xo?l=bt:(l=nt,r=void 0);let w=l===nt&&e[g+1].startsWith("/>")?" ":"";a+=l===bt?p+br:i>=0?(n.push(d),p.slice(0,i)+eo+p.slice(i)+Xe+w):p+Xe+(i===-2?g:w)}return[Jo(e,a+(e[o]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},vt=class e{constructor({strings:t,_$litType$:o},n){let r;this.parts=[];let a=0,l=0,g=t.length-1,p=this.parts,[d,u]=Qo(t,o);if(this.el=e.createElement(d,n),rt.currentNode=this.el.content,o===2||o===3){let i=this.el.content.firstChild;i.replaceWith(...i.childNodes)}for(;(r=rt.nextNode())!==null&&p.length<g;){if(r.nodeType===1){if(r.hasAttributes())for(let i of r.getAttributeNames())if(i.endsWith(eo)){let $=u[l++],w=r.getAttribute(i).split(Xe),m=/([.?@])?(.*)/.exec($);p.push({type:1,index:a,name:m[2],strings:w,ctor:m[1]==="."?Rt:m[1]==="?"?Tt:m[1]==="@"?It:at}),r.removeAttribute(i)}else i.startsWith(Xe)&&(p.push({type:6,index:a}),r.removeAttribute(i));if(Zo.test(r.tagName)){let i=r.textContent.split(Xe),$=i.length-1;if($>0){r.textContent=St?St.emptyScript:"";for(let w=0;w<$;w++)r.append(i[w],_t()),rt.nextNode(),p.push({type:2,index:++a});r.append(i[$],_t())}}}else if(r.nodeType===8)if(r.data===to)p.push({type:2,index:a});else{let i=-1;for(;(i=r.data.indexOf(Xe,i+1))!==-1;)p.push({type:7,index:a}),i+=Xe.length-1}a++}}static createElement(t,o){let n=it.createElement("template");return n.innerHTML=t,n}};function st(e,t,o=e,n){if(t===Be)return t;let r=n!==void 0?o._$Co?.[n]:o._$Cl,a=xt(t)?void 0:t._$litDirective$;return r?.constructor!==a&&(r?._$AO?.(!1),a===void 0?r=void 0:(r=new a(e),r._$AT(e,o,n)),n!==void 0?(o._$Co??=[])[n]=r:o._$Cl=r),r!==void 0&&(t=st(e,r._$AS(e,t.values),r,n)),t}var At=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,r=(t?.creationScope??it).importNode(o,!0);rt.currentNode=r;let a=rt.nextNode(),l=0,g=0,p=n[0];for(;p!==void 0;){if(l===p.index){let d;p.type===2?d=new yt(a,a.nextSibling,this,t):p.type===1?d=new p.ctor(a,p.name,p.strings,this,t):p.type===6&&(d=new Ct(a,this,t)),this._$AV.push(d),p=n[++g]}l!==p?.index&&(a=rt.nextNode(),l++)}return rt.currentNode=it,r}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++}},yt=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,o,n,r){this.type=2,this._$AH=me,this._$AN=void 0,this._$AA=t,this._$AB=o,this._$AM=n,this.options=r,this._$Cv=r?.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=st(this,t,o),xt(t)?t===me||t==null||t===""?(this._$AH!==me&&this._$AR(),this._$AH=me):t!==this._$AH&&t!==Be&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ko(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!==me&&xt(this._$AH)?this._$AA.nextSibling.data=t:this.T(it.createTextNode(t)),this._$AH=t}$(t){let{values:o,_$litType$:n}=t,r=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=vt.createElement(Jo(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(o);else{let a=new At(r,this),l=a.u(this.options);a.p(o),this.T(l),this._$AH=a}}_$AC(t){let o=Yo.get(t.strings);return o===void 0&&Yo.set(t.strings,o=new vt(t)),o}k(t){oo(this._$AH)||(this._$AH=[],this._$AR());let o=this._$AH,n,r=0;for(let a of t)r===o.length?o.push(n=new e(this.O(_t()),this.O(_t()),this,this.options)):n=o[r],n._$AI(a),r++;r<o.length&&(this._$AR(n&&n._$AB.nextSibling,r),o.length=r)}_$AR(t=this._$AA.nextSibling,o){for(this._$AP?.(!1,!0,o);t!==this._$AB;){let n=Vo(t).nextSibling;Vo(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},at=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,o,n,r,a){this.type=1,this._$AH=me,this._$AN=void 0,this.element=t,this.name=o,this._$AM=r,this.options=a,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=me}_$AI(t,o=this,n,r){let a=this.strings,l=!1;if(a===void 0)t=st(this,t,o,0),l=!xt(t)||t!==this._$AH&&t!==Be,l&&(this._$AH=t);else{let g=t,p,d;for(t=a[0],p=0;p<a.length-1;p++)d=st(this,g[n+p],o,p),d===Be&&(d=this._$AH[p]),l||=!xt(d)||d!==this._$AH[p],d===me?t=me:t!==me&&(t+=(d??"")+a[p+1]),this._$AH[p]=d}l&&!r&&this.j(t)}j(t){t===me?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Rt=class extends at{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===me?void 0:t}},Tt=class extends at{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==me)}},It=class extends at{constructor(t,o,n,r,a){super(t,o,n,r,a),this.type=5}_$AI(t,o=this){if((t=st(this,t,o,0)??me)===Be)return;let n=this._$AH,r=t===me&&n!==me||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,a=t!==me&&(n===me||r);r&&this.element.removeEventListener(this.name,this,n),a&&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)}},Ct=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){st(this,t)}},en={M:eo,P:Xe,A:to,C:1,L:Qo,R:At,D:Ko,V:st,I:yt,H:at,N:Tt,U:It,B:Rt,F:Ct},xr=Qt.litHtmlPolyfillSupport;xr?.(vt,yt),(Qt.litHtmlVersions??=[]).push("3.3.3");var qe={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Lt=e=>(...t)=>({_$litDirective$:e,values:t}),ft=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:Ti}=en;var tn=e=>e.strings===void 0;var vr={},on=(e,t=vr)=>e._$AH=t;var nn=Lt(class extends ft{constructor(e){if(super(e),e.type!==qe.PROPERTY&&e.type!==qe.ATTRIBUTE&&e.type!==qe.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!tn(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===Be||t===me)return t;let o=e.element,n=e.name;if(e.type===qe.PROPERTY){if(t===o[n])return Be}else if(e.type===qe.BOOLEAN_ATTRIBUTE){if(!!t===o.hasAttribute(n))return Be}else if(e.type===qe.ATTRIBUTE&&o.getAttribute(n)===t+"")return Be;return on(e),t}});var wt=class extends ft{constructor(t){if(super(t),this.it=me,t.type!==qe.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===me||t==null)return this._t=void 0,this.it=t;if(t===Be)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:[]}}};wt.directiveName="unsafeHTML",wt.resultType=1;var kt=Lt(wt);var rn='<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 sn='<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>',an='<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>',ln='<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>',cn='<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 dn='<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>';var Ce=["critical","high","medium","low","high_bug","bug","informational"];var ro=["revalidation","refuted","unreachable","confirmed","partial","unknown"],Gi=new Set(ro);var Ki=new TextEncoder,Zi=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});var rs=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-history":"/manage/history"});function io(e){return new RegExp(`(^|/)${e}/`,"u")}function Fr(e){return new RegExp(`^(?:.*/)?${e}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,"u")}var $s=io("node_modules"),Ms=io("vendor"),so="node_modules",Ss=io(so),_s=Fr(so);function Et(){return so}function We(e){return typeof e!="number"||!Number.isFinite(e)?null:`${e.toLocaleString()} B`}function Br(){return{showAll:!1,splitOwnDirs:!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 Je=Br(),y=new Proxy(Je,{get(e,t){return Je[t]},set(e,t,o){return Je[t]=o,!0},has(e,t){return t in Je},deleteProperty(e,t){return delete Je[t]},ownKeys(){return Reflect.ownKeys(Je)},getOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(Je,t)}});function fn(){y.graphState?._cleanup&&y.graphState._cleanup(),y.graphState=null}function Nr(e){e&&(Je=e)}function Pt(e){if(!e)return null;let t=Et(),o=new RegExp(`^(?:.*/)?${t}/(@[^/]+/[^/]+|[^/]+)`,"u"),n=e.match(o);if(n)return n[1];let r=e.indexOf("/");return r>0?e.slice(0,r):"/"}var Hr=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],Dr=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];function Ur(){if(typeof document>"u")return!1;let e=document.body?.classList;return!!e&&(e.contains("theme-light")||e.contains("theme-pink"))}var ao=new Map;function he(e){let t=Ur(),o=t?Dr:Hr,n=e??"__own__",r=`${t?"l":"d"}:${n}`;if(ao.has(r))return ao.get(r);let a=0;for(let d of n)a=a*37+d.codePointAt(0)|0;let g=((a%o.length+o.length)%o.length*7+3)%o.length,p=o[g];return ao.set(r,p),p}function zt(e){return e==="__own__"?"own source":typeof e!="string"?e:e.match(/^(?:.*\/)?vendor\/(.+)$/u)?.[1]??e}function gn(e){if(!e)return 0;let t=0;for(let o of Ce)t+=e[o]??0;return t}function hn(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 mn(e){if(!e)return null;for(let t of Ce)if((e[t]??0)>0)return t;return null}function bn(e,t,o,n,r,a,l,g={}){let p=g.pkgOf??Pt,d=new Set(t),u=new Map,i=new Map;for(let v of t){let P=(e[v].imports??[]).filter(z=>d.has(z));u.set(v,P);for(let z of P)i.has(z)||i.set(z,[]),i.get(z).push(v)}let $=t.map(v=>{let P=o.get(v),z=n?.get(v)??null,V=gn(P),L=p(v)??"__own__",c=mn(P);return{id:v,file:v,pkg:L,x:0,y:0,deg:0,issue:c,totalIssues:V,own:P,subtree:z,size:typeof e[v]?.size=="number"?e[v].size:null,severitySet:r?.get(v)??null,colorSet:a?.get(v)??null,findings:l?.get(v)??null,isHub:!1,label:v.split("/").pop()??v}}),w=new Map($.map(v=>[v.file,v])),m=new Map;for(let v of t)for(let P of u.get(v)??[]){let[z,V]=v<P?[v,P]:[P,v],L=`${z}\0${V}`,c=m.get(L);if(!c){let R=w.get(z),T=w.get(V);if(!R||!T)continue;c={a:z,b:V,cross:R.pkg!==T.pkg,fromLo:!1,fromHi:!1},m.set(L,c),R.deg++,T.deg++}v===z?c.fromLo=!0:c.fromHi=!0}let S=[...m.values()],s=hn(S),x=new Map;for(let v of $)x.set(v.pkg,(x.get(v.pkg)??0)+1);let _=[...x.entries()].toSorted((v,P)=>P[1]-v[1]).map(([v])=>v),h=new Map;for(let v of $)h.has(v.pkg)||h.set(v.pkg,[]),h.get(v.pkg).push(v);let k={files:t,nodes:$,nodeByFile:w,edges:S,adj:s,importsOf:u,importedBy:i,packages:_,pkgCount:x,byPkg:h};return Vr(k),k}function Vr(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 Ot(e){let t=e.packages.map(g=>{let p=e.byPkg.get(g)??[],d={};for(let s of Ce)d[s]=0;let u=new Set,i=new Set,$=[],w=0,m=0,S=!1;for(let s of p){if(w+=s.totalIssues,s.own)for(let x of Ce)d[x]+=s.own[x]??0;if(s.severitySet)for(let x of s.severitySet)u.add(x);if(s.colorSet)for(let x of s.colorSet)i.add(x);typeof s.size=="number"&&(m+=s.size,S=!0),$.push(s.file)}return{file:g,pkg:g,label:Ne(g),fileCount:p.length,size:S?m:null,own:d,totalIssues:w,issue:mn(d),severitySet:u.size>0?u:null,colorSet:i.size>0?i:null,pathText:$.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,i]=p<d?[p,d]:[d,p],$=`${u}\0${i}`,w=n.get($);w||(w={a:u,b:i,cross:!0,count:0,fromLo:!1,fromHi:!1},n.set($,w),o.get(u).deg++,o.get(i).deg++),w.count++;let m=p===u;g.fromLo&&(m?w.fromLo=!0:w.fromHi=!0),g.fromHi&&(m?w.fromHi=!0:w.fromLo=!0)}let r=[...n.values()],a=hn(r),l=new Map(t.map(g=>[g.pkg,[]]));for(let g of r)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:r,adj:a,importsOf:l}}function Ne(e){return zt(e)}function Ft(e,t){if(!t||t==="/"||t==="__own__")return e;for(let o of["node_modules","dependencies",Et()]){let n=o+"/"+t+"/",r=e.indexOf(n);if(r>=0)return e.slice(r+n.length)}return e.startsWith(t+"/")?e.slice(t.length+1):e}var lo=new WeakMap,co=new WeakMap;function gt(e,t){return e.nodes.length<=100&&!t}function Bt(e,t){if(!gt(e,t))return Nt(e);if(co.has(e))return co.get(e);let o=new Map(e.nodes.map(a=>[a.file,[...new Set(e.importsOf.get(a.file)??[])]])),n=[];for(let[a,l]of o)for(let g of l)n.push({from:a,to:g});let r={...e,importsOf:o,directedEdges:n,fileLevel:!0};return co.set(e,r),r}function Nt(e){if(lo.has(e))return lo.get(e);let t=Ot(e);if(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.importedBy=new Map(t.nodes.map(o=>[o.pkg,[]])),t.directedEdges=[];for(let[o,n]of t.importsOf)for(let r of n)t.importedBy.get(r).push(o),t.directedEdges.push({from:o,to:r});for(let o of t.nodes)o.deg=(t.importsOf.get(o.pkg)?.length??0)+t.importedBy.get(o.pkg).length;return lo.set(e,t),t}function fo(e,t,o=null){let n=t.showBundleLayouts&&y.bundleLayout==="layers",r=t.showBundleLayouts&&y.bundleLayout==="matrix",a=t.showBundleLayouts&&y.bundleLayout==="dependencies",l=t.showBundleLayouts?O`<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&&!r&&!a)}">${kt(sn)}</button> <button type="button" data-g2-layout="layers" aria-label="Layers" aria-pressed="${String(!!n)}">${kt(an)}</button> <button type="button" data-g2-layout="matrix" aria-label="Matrix" aria-pressed="${String(!!r)}">${kt(ln)}</button> <button type="button" data-g2-layout="dependencies" aria-label="Dependencies" aria-pressed="${String(!!a)}">${kt(cn)}</button></div>`:null,g=t.extraTopRow,p=t.hideAllFiles??!1,d=t.triageCounts??{inprogress:0,fixed:0,invalid:0,deleted:0},u=t.triageStates??["inprogress","fixed","invalid","deleted"],i={};for(let z of Ce)i[z]=0;for(let z of e.nodes)if(z.severitySet)for(let V of z.severitySet)i[V]!==void 0&&i[V]++;let $=Ce.some(z=>i[z]>0||y.selectedSeverities.has(z)),w=["none","red","blue","green","gray"],m={none:0,red:0,blue:0,green:0,gray:0};for(let z of e.nodes)if(z.colorSet)for(let V of z.colorSet)m[V]!==void 0&&m[V]++;let S=w.some(z=>m[z]>0||y.selectedColors.has(z)),s=O`<triage-selector variant="graph" .counts="${d}" .states="${u}"></triage-selector>`,x=p?null:O`<mode-switch label="All files" .checked="${y.showAll}" data-g2-show-all></mode-switch>`,h=t.showSplitOwnDirs??!1?O`<mode-switch label="Split dirs" .checked="${y.splitOwnDirs}" data-g2-split-own></mode-switch>`:null,v=(a?e.nodes.length<=100:!n&&!r&&(t.showPackagesView??!1))?O`<mode-switch label="Packages" .checked="${a?y.dependencyPackagesView:y.packagesView}" data-g2-packages-view></mode-switch>`:null,P=e.reasons?.length>0?O`<label class="g2-reason-filter"><select aria-label="Filter files" .value="${nn(y.bundleReason??"")}" @change="${z=>z.currentTarget.dispatchEvent(new CustomEvent("bundle-graph-reason-change",{detail:{reason:z.currentTarget.value||null},bubbles:!0,composed:!0}))}"><option value="" ?selected="${y.bundleReason===null}">All</option>${e.reasons.map(z=>O`<option value="${z}" ?selected="${z===y.bundleReason}">${z}</option>`)}</select></label>`:null;return O`<div class="graph2-topbar">${g?O`<div class="graph2-topbar-row graph2-topbar-row-extra toolbar-row">${g} ${x} ${h} ${v}<div class="g2-spacer"></div>${s}</div>`:null}<div class="graph2-topbar-row graph2-topbar-row-main toolbar-row sev-row">${l} ${P} ${g?null:h} ${$?O`<severity-chips .counts="${i}" .selected="${[...y.selectedSeverities]}" kind="graph"></severity-chips>`:null} ${S?O`<triage-filter .counts="${m}" .selected="${[...y.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="${y.pathFilter}"> <button type="button" class="g2-path-filter-clear" id="g2-path-filter-clear" aria-label="Clear filter">✕</button></div>${g?null:x} ${g?null:v} ${o}<div class="g2-spacer"></div>${g?null:s} <button type="button" class="g2-icon-btn" id="g2-fullscreen" aria-label="Toggle fullscreen">⛶</button></div></div>`}function Gr(e,t){let o=e.split("/").filter(Boolean),n=t.split("/").filter(Boolean),r=0;for(;r<o.length&&r<n.length&&o[r]===n[r];)r++;let a=o.length-r,l=n.slice(r).join("/");return a===0?"./"+l:"../".repeat(a)+l}function jr(e,t){if(!t&&t!=="")return e;let o=Gr(t,e);return o.length<e.length?o:e}function uo(e,t,o,n){let r=o.length;if(r===0)return O`<div class="g2-sel-section"><div class="g2-sel-section-label">${t} (${r})</div><div class="g2-sel-section-empty">none</div></div>`;let a=o.map(l=>({file:l,display:jr(l,n)}));return a.sort((l,g)=>l.display.localeCompare(g.display)),O`<div class="g2-sel-section"><div class="g2-sel-section-label">${t} (${r})</div><ul class="g2-sel-file-list">${a.map(({file:l,display:g})=>{let p=e.nodeByFile.get(l),d=p?he(p.pkg):"#666";return O`<li><button type="button" class="g2-sel-file-link" data-g2-select="${l}" data-tooltip="${l}"><span class="g2-sel-file-dot" style="${Ze({background:d})}"></span> <span class="g2-sel-file-path">${g}</span></button></li>`})}</ul></div>`}function lt(e){if(!e)return O`<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?O`<div class="g2-sel-section-empty">none</div>`:O`<div class="tree-count-chips">${o.map(n=>O`<span class="${`tree-count-chip ${n}`}">${e[n]} ${n.replaceAll("_"," ")}</span>`)}</div>`}function xn(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 r=e.supportsLayers&&y.bundleLayout==="dependencies"&&!y.focusedPkg?Bt(e,y.dependencyPackagesView):null,a=r?.nodes.length??e.nodes.length,l=r?.directedEdges.length??e.edges.length,g=a===0?"0.0":(l*2/a).toFixed(1),p=Ne(y.focusedPkg);return O`<main class="graph2-stage"><canvas id="g2-canvas"></canvas>${y.focusedPkg?O`<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">${!r||r.fileLevel?O`<span><b>${e.nodes.length}</b> files</span>`:null} <span><b>${r&&!r.fileLevel?r.nodes.length:e.packages.length}</b> packages</span> <span><b>${l}</b> ${r?"dependencies":O`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 vn(e){if(e.supportsLayers&&y.bundleLayout==="dependencies")return null;let t=null;if(y.selected){let n=e.nodeByFile.get(y.selected);n&&(t=n.pkg)}else y.solo&&(t=y.solo);if(!t||(e.pkgCount.get(t)??0)<=1||y.focusedPkg===t)return null;let o=Ne(t);return O`<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 yn(){return O`<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 wn(e){if(e.supportsLayers&&y.bundleLayout==="dependencies"&&!y.focusedPkg&&!gt(e,y.dependencyPackagesView)){let r=Nt(e),a=r.nodes.toSorted((l,g)=>r.importedBy.get(g.pkg).length-r.importedBy.get(l.pkg).length||l.pkg.localeCompare(g.pkg)).map(l=>l.pkg);return O`<div class="g2-panel-title">Packages · importers</div>${po(r,a,!0)}`}let t=y.showAll&&e.nodes.length>0&&e.nodes.every(r=>typeof r.size=="number"),o=e.nodes.some(r=>r.totalIssues>0),n=y.topPkgsTab;return n==="size"&&!t&&(n="files"),n==="issues"&&!o&&(n="files"),O`<div class="g2-panel-title g2-panel-title-row"><span>Packages</span><div class="g2-mini-tabs">${o?O`<button type="button" class="${pt({"g2-mini-tab":!0,on:n==="issues"})}" data-g2-top-pkgs="issues">Issues</button>`:null} <button type="button" class="${pt({"g2-mini-tab":!0,on:n==="files"})}" data-g2-top-pkgs="files">Files</button> ${t?O`<button type="button" class="${pt({"g2-mini-tab":!0,on:n==="size"})}" data-g2-top-pkgs="size">Size</button>`:null}</div></div>${Wr(e,n)}`}function kn(e,t={}){if(e.supportsLayers&&y.bundleLayout==="dependencies"&&!y.focusedPkg&&!gt(e,y.dependencyPackagesView))return Yr(Nt(e),y.solo);let o=y.selected;if(o){let n=e.nodeByFile.get(o);return n?Xr(e,n,o,t):O`<div class="g2-empty-state"><strong>File not in current view</strong>Adjust filters or pick another file.</div>`}return y.solo?y.solo==="__own__"&&!e.pkgCount.has("__own__")&&e.layerRoots?.appImports.length>0?O`<div class="g2-empty-state"><strong>App</strong>App source is not included in this view. Connections come from its recorded imports.</div>`:qr(e,y.solo):O`<div class="g2-empty-state">Click a node or a package row to inspect.</div>`}function Xr(e,t,o,n){let r=he(t.pkg),a=Ne(t.pkg),l=Ft(o,t.pkg),g=e.importedBy.get(o)??[],p=e.importsOf.get(o)??[],d=o.lastIndexOf("/"),u=d>=0?o.slice(0,d):"";return O`<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="${Ze({"--dot":r,background:r})}"></span> <span class="g2-sel-pkg">${a}</span></div></div><div class="g2-sel-fullpath" data-tooltip="${o}">${o}</div>${We(t.size)?O`<div class="g2-sel-size">${We(t.size)}</div>`:null}<div class="g2-sel-section"><div class="g2-sel-section-label">Own findings</div>${lt(t.own)}</div><div class="g2-sel-section"><div class="g2-sel-section-label">Subtree findings</div>${lt(t.subtree)}</div><div class="g2-sel-jumps">${t.totalIssues>0?O`<button type="button" class="g2-sel-jump" data-g2-jump-findings="${o}">Findings →</button>`:null} ${n.isBundleContext?t.origFile?O`<button type="button" class="g2-sel-jump" data-bundle-view-source="${t.origFile}">View source →</button>`:null:O`<button type="button" class="g2-sel-jump" data-g2-jump-file="${o}">Files →</button>`}</div>${uo(e,"Imported by",g,u)} ${uo(e,"Imports",p,u)}</div>`}function qr(e,t){let o=e.nodes.filter(i=>i.pkg===t),n=o.length;if(n===0)return O`<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 r=he(t),a=Ne(t),l={};for(let i of Ce)l[i]=0;for(let i of o)if(i.own)for(let $ of Ce)l[$]+=i.own[$]??0;let g=0,p=0;for(let i of e.edges){let $=e.nodeByFile.get(i.a),w=e.nodeByFile.get(i.b);!$||!w||($.pkg===t&&w.pkg===t?p++:($.pkg===t||w.pkg===t)&&g++)}let d=0;for(let i of o)i.isHub&&d++;let u=new Set;for(let i of o)for(let $ of e.importedBy.get(i.file)??[]){let w=e.nodeByFile.get($);w&&w.pkg!==t&&u.add($)}return O`<div class="g2-selection-card"><div class="g2-sel-head"><span class="g2-sel-dot" style="${Ze({"--dot":r,background:r})}"></span> <span class="g2-sel-id">${a}</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>${lt(l)}</div>${uo(e,"Imported by",[...u])}</div>`}function Wr(e,t){let o=e.nodes.length||1,n=t??y.topPkgsTab,r=y.selectedSeverities,a=y.selectedColors,l=r.size>0,g=a.size>0,p=l||g,d=new Map,u=new Map,i=0,$=0;for(let s of e.nodes){let x;if(p){if(x=0,s.findings)for(let _ of s.findings)l&&!r.has(_.severity)||g&&!a.has(_.color)||x++}else x=s.totalIssues;d.set(s.pkg,(d.get(s.pkg)??0)+x),i+=x,typeof s.size=="number"&&(u.set(s.pkg,(u.get(s.pkg)??0)+s.size),$+=s.size)}let w;n==="issues"?w=e.packages.filter(s=>(d.get(s)??0)>0).toSorted((s,x)=>{let _=d.get(s)??0,h=d.get(x)??0;return h!==_?h-_:(e.pkgCount.get(x)??0)-(e.pkgCount.get(s)??0)}):n==="size"?w=e.packages.filter(s=>(u.get(s)??0)>0).toSorted((s,x)=>{let _=u.get(s)??0,h=u.get(x)??0;return h!==_?h-_:(e.pkgCount.get(x)??0)-(e.pkgCount.get(s)??0)}):w=[...e.packages].toSorted((s,x)=>{let _=e.pkgCount.get(s)??0,h=e.pkgCount.get(x)??0;return h!==_?h-_:(d.get(x)??0)-(d.get(s)??0)});let m=s=>n==="issues"?i>0?((d.get(s)??0)/i*100).toFixed(2):"0":n==="size"?$>0?((u.get(s)??0)/$*100).toFixed(2):"0":(e.pkgCount.get(s)/o*100).toFixed(2),S=n==="issues"?"No packages with issues":n==="size"?"No packages with size":"No packages";return O`<div class="g2-dist-bar">${e.packages.map(s=>{let x=he(s);return O`<span style="${Ze({background:x,width:`${m(s)}%`})}"></span>`})}</div><div class="g2-dist-list">${w.length===0?O`<div class="g2-dist-empty">${S}</div>`:null} ${Zt(w,s=>s,s=>{let x=he(s),_=e.pkgCount.get(s)??0,h=d.get(s)??0,k=u.get(s)??0,v=n==="issues"?h:n==="size"?We(k):_,P=n==="issues"?i>0?(h/i*100).toFixed(1):"0.0":n==="size"?$>0?(k/$*100).toFixed(1):"0.0":(_/o*100).toFixed(1),z=Ne(s),V=y.solo===s;return O`<button type="button" class="${pt({"g2-dist-item":!0,on:V})}" data-g2-pkg="${s}" data-tooltip="${z}"><span class="g2-dist-dot" style="${Ze({background:x})}"></span><span class="g2-dist-name">${z}</span><span class="g2-dist-count">${v}</span><span class="g2-dist-pct">${P}%</span></button>`})}</div>`}function po(e,t,o=!1){return O`<div class="g2-dist-list">${Zt(t,n=>n,n=>O`<button type="button" class="${pt({"g2-dist-item":!0,on:y.solo===n})}" data-g2-pkg="${n}"><span class="g2-dist-dot" style="${Ze({background:he(n)})}"></span> <span class="g2-dist-name">${Ne(n)}</span> ${o?O`<span class="g2-dist-count">${e.importedBy.get(n).length}</span>`:null}</button>`)}</div>`}function Yr(e,t){let o=e.byPkg.get(t);if(!o)return O`<div class="g2-empty-state">Select a package to trace its importers and dependencies.</div>`;let n=e.importedBy.get(t)??[],r=e.importsOf.get(t)??[];return O`<div class="g2-selection-card"><div class="g2-sel-head"><span class="g2-sel-dot" style="${Ze({background:he(t)})}"></span> <span class="g2-sel-id">${o.label}</span></div>${o.totalIssues?O`<div class="g2-sel-section">${lt(o.own)}</div>`:null}<div class="g2-sel-section"><div class="g2-sel-section-label">Imported by (${n.length})</div>${po(e,n.toSorted())}</div><div class="g2-sel-section"><div class="g2-sel-section-label">Dependencies (${r.length})</div>${po(e,r.toSorted())}</div></div>`}var He;function Kr(){return He||(He=document.createElement("div"),He.id="styled-tooltip",He.setAttribute("popover","manual"),document.body.append(He),He)}function Zr(e){typeof e.showPopover=="function"&&(e.matches(":popover-open")&&e.hidePopover(),e.showPopover())}var Dt=null,$n="",Mn="",Sn="",_n="",Ut=null,In=0,Cn=0;document.addEventListener("mousemove",e=>{In=e.clientX,Cn=e.clientY},{passive:!0});var Jr=100,Qr=14,ei=8,Ht=8;function ti(e,{placement:t="cursor"}={}){t=e.dataset.tooltipPlacement??t;let o=Kr(),n=e.dataset.tooltip??"",r=e.dataset.tooltipRepo??"",a=["stasis","sourcemap"].includes(e.dataset.tooltipBundle)?e.dataset.tooltipBundle:"",l=e.dataset.tooltipStats??"";if(!n||Dt===e&&$n===n&&Mn===r&&Sn===a&&_n===l)return;if(o.textContent=n,r){let S=document.createElement("div");S.className="tooltip-repo",S.innerHTML=dn;let s=document.createElement("span");s.textContent=r,S.append(s),o.append(S)}if(a||l){let S=document.createElement("div");if(S.className="tooltip-bundle",a==="stasis"){let _=document.createElement("img");_.src="./stasis.svg",_.alt="",S.append(_)}else S.innerHTML=rn;let s=document.createElement("span"),x=a==="stasis"?"Stasis":a==="sourcemap"?"Sourcemap":"";s.textContent=[x,l].filter(Boolean).join(" \xB7 "),S.append(s),o.append(S)}Zr(o),o.style.left="0px",o.style.top="0px",o.style.transform="none",o.classList.add("visible");let g=In,p=Cn+Qr;if(t==="right"||t==="right-start"){let S=e.getBoundingClientRect();g=S.right+ei,p=S.top+(t==="right"?S.height/2:0)}let d=window.innerWidth-o.offsetWidth-Ht,u=Math.max(Ht,Math.min(g,d));o.style.left=`${Math.round(u)}px`;let i=o.offsetHeight,$=t==="right"?p-i/2:p,w=window.innerHeight-i-Ht,m=Math.max(Ht,Math.min($,w));o.style.top=`${Math.round(m)}px`,Dt=e,$n=n,Mn=r,Sn=a,_n=l}function An(){clearTimeout(Ut),Ut=null,He&&(He.classList.remove("visible"),typeof He.hidePopover=="function"&&He.matches(":popover-open")&&He.hidePopover()),Dt=null}function oi(e,{gate:t,placement:o}={}){t&&!t(e)||(clearTimeout(Ut),Ut=setTimeout(()=>{ti(e,{placement:o})},Jr))}var Rn=new WeakSet;function Tn(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 Ln(e,t){!e||Rn.has(e)||(Rn.add(e),e.addEventListener("mouseover",o=>{let n=Tn(o,e);if(!n){An();return}n!==Dt&&oi(n,t)}),e.addEventListener("mouseout",o=>{let n=Tn(o,e),r=o.relatedTarget?.closest?.("[data-tooltip]")??null;n&&n===r||An()}))}var go=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,r=n[t];n[t]=n[o],n[o]=r,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 ni(e,t){for(let o=0;o<8;o++){let n=!1;for(let r=0;r<e.length-1;r++){let a=o%2?e.length-2-r:r,l=e[a],g=e[a+1];(t.get(g)?.get(l)?.count??0)<=(t.get(l)?.get(g)?.count??0)||(e[a]=g,e[a+1]=l,n=!0)}if(!n)break}return e}function ri(e){let t=[],o=new Set;for(let n of e.values())n.outgoing.sort((r,a)=>a[1]-r[1]||r[0].tie-a[0].tie);for(let n of e.values()){if(o.has(n))continue;let r=[{node:n,next:0}];for(o.add(n);r.length>0;){let a=r.at(-1);if(a.next===a.node.outgoing.length){t.push(a.node.id),r.pop();continue}let l=a.node.outgoing[a.next++][0];o.has(l)||(o.add(l),r.push({node:l,next:0}))}}return t.toReversed()}function ho(e,t){let o=new Map(e.map((r,a)=>[r,a])),n=0;for(let r of t.values())for(let[a,l]of r.outgoing)o.get(r.id)<o.get(a.id)&&(n+=l);return n}function ii(e,t){let o=ho(e,t),n=o,r=0;for(let a=0;a<e.length-1;a++)o-=t.get(e[a]).originalBalance,o>n&&(n=o,r=a+1);return[...e.slice(r),...e.slice(0,r)]}function En(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||(p.outgoing.push([u,d.count]),u.incoming.push([p,d.count]),p.balance+=d.count,u.balance-=d.count)}for(let p of o.values())p.originalBalance=p.balance;let n=[],r=new go(o.values()),a=[];for(;r.nodes.length>0;){let p=r.take();p.balance>=0?n.push(p.id):a.push(p.id);for(let[d,u]of p.outgoing)d.position<0||(d.balance+=u,r.update(d));for(let[d,u]of p.incoming)d.position<0||(d.balance-=u,r.update(d))}let l=e,g=ho(e,o);for(let p of[[...n,...a.toReversed()],ri(o),e,e.toReversed()]){let d=ni(ii(p,o),t),u=ho(d,o);u>g&&(l=d,g=u)}return l}function mo(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 r=[],a=new Set;for(let p of e){if(a.has(p))continue;a.add(p);let d=[[p,(t.get(p)??[])[Symbol.iterator]()]];for(;d.length>0;){let[u,i]=d.at(-1),$=i.next();if($.done){r.push(u),d.pop();continue}o.has($.value)&&!a.has($.value)&&(a.add($.value),d.push([$.value,(t.get($.value)??[])[Symbol.iterator]()]))}}let l=new Map,g=[];for(let p of r.toReversed()){if(l.has(p))continue;let d=[],u=g.length,i=[p];for(l.set(p,u);i.length>0;){let $=i.pop();d.push($);for(let w of n.get($))l.has(w)||(l.set(w,u),i.push(w))}g.push(d.toSorted())}return{groups:g,componentOf:l}}function bo(e,{expanded:t=new Set,order:o="structure",query:n="",neighborhood:r=null,cyclesOnly:a=!1}={}){let l=new Map,g=new Map;for(let f of e.nodes){let M=t.has(f.pkg),I=`${M?"f":"p"}:${M?f.file:f.pkg}`;l.has(I)||l.set(I,{id:I,pkg:f.pkg,file:M?f.file:null,label:M?f.file:zt(f.pkg),files:[],size:0,issues:0,incoming:0,outgoing:0});let Y=l.get(I);Y.files.push(f.file),Y.size+=f.size??0,Y.issues+=f.totalIssues??0,g.set(f.file,I)}let p=new Map,d=new Set,u=new Map([...l.keys()].map(f=>[f,new Set])),i=new Set,$=0;for(let[f,M]of e.importsOf){let I=g.get(f);if(I)for(let Y of new Set(M)){let W=g.get(Y);if(!W)continue;p.has(I)||p.set(I,new Map),p.get(I).has(W)||p.get(I).set(W,{from:I,to:W,count:0,examples:[]});let xe=p.get(I).get(W);xe.count++,xe.examples.length<80&&xe.examples.push([f,Y]),$++,l.get(I).outgoing++,l.get(W).incoming++,I!==W&&(i.add(I),d.add(W)),(I!==W||l.get(I).file)&&u.get(I).add(W)}}let w=[...l.keys()].toSorted(),{groups:m,componentOf:S}=mo(w,u),s=new Set(m.flatMap(f=>f.length>1||u.get(f[0]).has(f[0])?f:[]));for(let f of l.values())f.cyclic=s.has(f.id),f.component=S.get(f.id);let x=e.ownSourcePackages??new Set(e.layerRoots?.roots??[]),_=f=>f.pkg==="__own__"?0:x.has(f.pkg)?1:2,h=f=>d.has(f.id)&&i.has(f.id)?0:1,k=new Map(m.map((f,M)=>[M,f.reduce((I,Y)=>Math.min(I,_(l.get(Y))),2)])),v=(f,M)=>f.pkg.localeCompare(M.pkg)||f.label.localeCompare(M.label),P=new Map;if(o==="structure"){for(let f of m)if(!(f.length<2))for(let M of Map.groupBy(f,I=>_(l.get(I))).values()){let I=M.toSorted((Y,W)=>v(l.get(Y),l.get(W)));En(I,p).forEach((Y,W)=>P.set(Y,W))}}for(let[f,M]of p)for(let I of M.values())I.cyclic=s.has(f)&&S.get(f)===S.get(I.to)&&(f!==I.to||l.get(f).file!==null);let z=n.trim().toLowerCase(),V=new Set(w.filter(f=>!z||l.get(f).files.some(M=>M.toLowerCase().includes(z))||l.get(f).label.toLowerCase().includes(z))),L=new Set(r?[r]:V);if(z||r)for(let[f,M]of u)for(let I of M)(r?f===r:V.has(f))&&L.add(I),(r?I===r:V.has(I))&&L.add(f);let c=(f,M)=>{if(o==="structure"){let W=k.get(f.component)-k.get(M.component);if(W)return W;let xe=h(f)-h(M);if(xe)return xe;let Me=f.component-M.component;if(Me)return Me}let I=_(f)-_(M);if(I)return I;let Y=h(f)-h(M);if(Y)return Y;if(o==="structure"&&f.component===M.component){let W=(P.get(f.id)??0)-(P.get(M.id)??0);if(W)return W}return o==="importers"&&f.incoming!==M.incoming?M.incoming-f.incoming:o==="imports"&&f.outgoing!==M.outgoing?M.outgoing-f.outgoing:v(f,M)},R=[...l.values()].filter(f=>L.has(f.id)&&(!a||f.cyclic)).toSorted(c),T=new Map(R.map((f,M)=>[f.id,M])),F=[];for(let[f,M]of p)if(T.has(f))for(let I of M.values())T.has(I.to)&&F.push({...I,row:T.get(f),col:T.get(I.to)});return{rows:R,byId:l,cells:p,visibleCells:F,index:T,matches:V,importCount:$,totalRows:l.size,cycleCount:m.filter(f=>s.has(f[0])).length}}function xo(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 vo(e,t,o,n){return Math.max(Math.min(18,xo(t,o,n)),Math.min(27,e))}function zn(e,t,o,n){let r=Math.floor((e-196+n.x)/n.cell),a=Math.floor((t-118+n.y)/n.cell);return e<196&&t>=118&&a>=0&&a<o.rows.length?{row:a,col:null}:t<118&&e>=196&&r>=0&&r<o.rows.length?{row:r,col:null}:e>=196&&t>=118&&a>=0&&r>=0&&a<o.rows.length&&r<o.rows.length?{row:a,col:r}:null}function Pn(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 On(e,t,o,{width:n,height:r,theme:a,colorOf:l,hover:g,selected:p,dimmed:d}){let{cell:u,x:i,y:$}=o,{rows:w}=t,m=c=>196+c*u-i,S=c=>118+c*u-$,s=Math.max(0,Math.floor($/u)),x=Math.min(w.length,Math.ceil((r-118+$)/u)),_=Math.max(0,Math.floor(i/u)),h=Math.min(w.length,Math.ceil((n-196+i)/u)),k=g??p;e.clearRect(0,0,n,r),e.fillStyle=a.bg,e.fillRect(0,0,n,r),e.save(),e.beginPath(),e.rect(196,118,n-196,r-118),e.clip();let v=[];for(let c=0;c<w.length;c++){let R=v.at(-1),T=w[c];R&&R.component===T.component?R.end=c+1:v.push({component:T.component,start:c,end:c+1,cyclic:T.cyclic})}for(let c of v)c.cyclic&&(e.strokeStyle=a.cycle+"85",e.lineWidth=1,e.strokeRect(m(c.start),S(c.start),(c.end-c.start)*u,(c.end-c.start)*u));if(k&&(e.fillStyle=a.highlight,e.fillRect(196,S(k.row),n-196,u),e.fillRect(m(k.col??k.row),118,u,r-118)),e.strokeStyle=a.grid,e.lineWidth=1,u>=9){e.beginPath();for(let c=s;c<=x;c++)e.moveTo(196,S(c)+.5),e.lineTo(n,S(c)+.5);for(let c=_;c<=h;c++)e.moveTo(m(c)+.5,118),e.lineTo(m(c)+.5,r);e.stroke()}let P=t.visibleCells.reduce((c,R)=>Math.max(c,R.count),1),z=u>=8?2:.25;for(let c of t.visibleCells)c.row<s||c.row>=x||c.col<_||c.col>=h||(e.globalAlpha=d(w[c.row])&&d(w[c.col])?.12:.35+.65*Math.log1p(c.count)/Math.log1p(P),e.fillStyle=c.cyclic&&u<10?a.cycle:l(w[c.row].pkg),e.fillRect(m(c.col)+z,S(c.row)+z,Math.max(1,u-2*z),Math.max(1,u-2*z)),c.cyclic&&c.from!==c.to&&u>=10&&(e.fillStyle=a.cycle,e.fillRect(m(c.col)+u-5,S(c.row)+2,3,3)));e.globalAlpha=1,p&&(e.strokeStyle=a.text,e.lineWidth=2,p.col===null?e.strokeRect(197,S(p.row)+1,n-196-2,u-2):e.strokeRect(m(p.col)+1,S(p.row)+1,u-2,u-2)),e.restore(),e.fillStyle=a.surface,e.fillRect(0,0,n,118),e.fillRect(0,0,196,r),e.font="11px ui-monospace, monospace",e.textBaseline="middle";let V=Math.max(1,Math.ceil(14/u));for(let c=s;c<x;c++){if(c%V&&c!==k?.row)continue;e.save(),e.beginPath(),e.rect(5,111,186,r-118+7),e.clip();let R=S(c)+u/2;c===k?.row&&(e.fillStyle=a.highlight,e.fillRect(0,S(c),196,Math.max(u,14))),e.fillStyle=l(w[c].pkg),e.fillRect(8,R-3,5,6),e.fillStyle=c===k?.row||t.matches.size<t.totalRows&&t.matches.has(w[c].id)?a.text:a.muted,e.fillText(`${w[c].file?" ":""}${Pn(w[c])}`,20,R),e.restore()}let L=Math.max(1,Math.ceil(17/u));for(let c=_;c<h;c++)c%L&&c!==(k?.col??k?.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===(k?.col??k?.row)?a.text:a.muted,e.fillText(Pn(w[c]),0,0,115),e.restore(),e.fillStyle=l(w[c].pkg),e.fillRect(m(c)+1,114,Math.max(1,u-2),3));e.fillStyle=a.muted,e.font="10px ui-monospace, monospace",e.fillText("IMPORTERS \u2193",14,104),e.fillText("DEPENDENCIES \u2192",204,12),e.strokeStyle=a.border,e.beginPath(),e.moveTo(196-.5,118),e.lineTo(196-.5,r),e.moveTo(196,118-.5),e.lineTo(n,118-.5),e.stroke(),w.length===0&&(e.fillStyle=a.muted,e.fillText("No matching dependencies",216,148))}var Qe=e=>e.toLocaleString("en-US");function Vt(e,t,o){return O`<button class="g2-dist-item matrix-row-link" @click="${()=>o(e.id)}" data-tooltip="${e.label}"><span class="g2-dist-dot" style="${`background:${he(e.pkg)}`}"></span><span class="g2-dist-name">${e.label}</span><span class="g2-dist-count">${Qe(t)}</span></button>`}function Fn(e,t,o,{select:n,expand:r,expanded:a,neighborhood:l,focus:g,clear:p}){let d=e.byId.get(o?.from),u=e.byId.get(o?.to);if(!d){let s=[...e.rows].toSorted((x,_)=>_.incoming-x.incoming).slice(0,15);return O`<div class="matrix-metrics"><span><b>${Qe(t.nodes.length)}</b>files</span><span><b>${Qe(t.packages.length)}</b>packages</span><span><b>${Qe(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>${s.map(x=>Vt(x,x.incoming,n))} ${e.cycleCount?O`<h4>Cyclic groups <b>${e.cycleCount}</b></h4>${e.rows.filter(x=>x.cyclic).slice(0,12).map(x=>Vt(x,x.outgoing,n))}`:null}`}let i=u?e.cells.get(d.id)?.get(u.id):null,$=Map.groupBy(i?.examples??[],([,s])=>s),w=d.cyclic?[...e.byId.values()].filter(s=>s.component===d.component).length:0,m=[...e.cells.get(d.id)?.values()??[]].filter(s=>s.to!==d.id).toSorted((s,x)=>x.count-s.count),S=[...e.cells.values()].map(s=>s.get(d.id)).filter(s=>s&&s.from!==d.id).toSorted((s,x)=>x.count-s.count);return O`<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?O`<div class="matrix-direction">imports →</div><button class="matrix-selected-name" @click="${()=>n(u.id)}">${u.label}</button>`:null} ${(u?i?.cyclic:d.cyclic)?O`<span class="matrix-cycle-label">${u?"Import participates in a cycle":`Cyclic group \xB7 ${w} members`}</span>`:null}<div class="matrix-metrics"><span><b>${Qe(u?i?.count??0:d.files.length)}</b>${u?"file imports":"files"}</span><span><b>${We(d.size)}</b>source size</span></div><div class="matrix-actions">${d.file?O`<button @click="${()=>r(d.pkg)}">Collapse package</button><button data-bundle-view-source="${t.nodeByFile.get(d.file)?.origFile??d.file}">View source</button>`:O`<button @click="${()=>r(d.pkg)}">${a.has(d.pkg)?"Collapse files":"Expand files"}</button>`} <button aria-pressed="${String(l===d.id)}" @click="${()=>g(d.id)}">Neighborhood</button></div>${u?O`<h4>File imports</h4>${$.size>0?[...$].map(([s,x])=>O`<div class="matrix-import-group"><button class="matrix-import-target" data-bundle-view-source="${t.nodeByFile.get(s)?.origFile??s}" data-tooltip="${s}">${s}</button><ul class="matrix-import-sources" aria-label="Imported by">${x.map(([_])=>O`<li><button data-bundle-view-source="${t.nodeByFile.get(_)?.origFile??_}" data-tooltip="${_}"><span aria-hidden="true">←</span><span>${_}</span></button></li>`)}</ul></div>`):O`<p class="matrix-empty">No direct imports in this direction.</p>`} ${i&&i.count>i.examples.length?O`<p class="matrix-empty">Showing ${i.examples.length} of ${Qe(i.count)} imports.</p>`:null} ${u.id!==d.id&&e.cells.get(u.id)?.has(d.id)?O`<h4>Reverse direction</h4><button class="g2-dist-item matrix-reverse-link" @click="${()=>n(u.id,d.id)}">← ${Qe(e.cells.get(u.id).get(d.id).count)} file imports</button>`:null}`:O`<h4>Imports <b>${m.length}</b></h4>${m.slice(0,60).map(s=>Vt(e.byId.get(s.to),s.count,x=>n(d.id,x)))} ${m.length>60?O`<p class="matrix-empty">Showing the 60 strongest of ${m.length} dependencies.</p>`:null}<h4>Imported by <b>${S.length}</b></h4>${S.slice(0,60).map(s=>Vt(e.byId.get(s.from),s.count,x=>n(x,d.id)))} ${S.length>60?O`<p class="matrix-empty">Showing the 60 strongest of ${S.length} importers.</p>`:null}`}`}var Bn=`:host{display:contents}*{box-sizing:border-box}button,select{font:inherit;color:var(--text);border:1px solid var(--border);background:var(--surface);border-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: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: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: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}.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}
7
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),qo=/'/g,Wo=/"/g,Zo=/^(?:script|style|textarea|title)$/i,no=e=>(t,...o)=>({_$litType$:e,strings:t,values:o}),$r=no(1),Mr=no(2),Sr=no(3),Be=Symbol.for("lit-noChange"),me=Symbol.for("lit-nothing"),Yo=new WeakMap,it=rt.createTreeWalker(rt,129);function Jo(e,t){if(!oo(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Go!==void 0?Go.createHTML(t):t}var Qo=(e,t)=>{let o=e.length-1,n=[],i,a=t===2?"<svg>":t===3?"<math>":"",l=bt;for(let g=0;g<o;g++){let p=e[g],d,u,r=-1,$=0;for(;$<p.length&&(l.lastIndex=$,u=l.exec(p),u!==null);)$=l.lastIndex,l===bt?u[1]==="!--"?l=jo:u[1]!==void 0?l=Xo:u[2]!==void 0?(Zo.test(u[2])&&(i=RegExp("</"+u[2],"g")),l=nt):u[3]!==void 0&&(l=nt):l===nt?u[0]===">"?(l=i??bt,r=-1):u[1]===void 0?r=-2:(r=l.lastIndex-u[2].length,d=u[1],l=u[3]===void 0?nt:u[3]==='"'?Wo:qo):l===Wo||l===qo?l=nt:l===jo||l===Xo?l=bt:(l=nt,i=void 0);let w=l===nt&&e[g+1].startsWith("/>")?" ":"";a+=l===bt?p+bi:r>=0?(n.push(d),p.slice(0,r)+eo+p.slice(r)+Xe+w):p+Xe+(r===-2?g:w)}return[Jo(e,a+(e[o]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},vt=class e{constructor({strings:t,_$litType$:o},n){let i;this.parts=[];let a=0,l=0,g=t.length-1,p=this.parts,[d,u]=Qo(t,o);if(this.el=e.createElement(d,n),it.currentNode=this.el.content,o===2||o===3){let r=this.el.content.firstChild;r.replaceWith(...r.childNodes)}for(;(i=it.nextNode())!==null&&p.length<g;){if(i.nodeType===1){if(i.hasAttributes())for(let r of i.getAttributeNames())if(r.endsWith(eo)){let $=u[l++],w=i.getAttribute(r).split(Xe),m=/([.?@])?(.*)/.exec($);p.push({type:1,index:a,name:m[2],strings:w,ctor:m[1]==="."?Rt:m[1]==="?"?Tt:m[1]==="@"?It:at}),i.removeAttribute(r)}else r.startsWith(Xe)&&(p.push({type:6,index:a}),i.removeAttribute(r));if(Zo.test(i.tagName)){let r=i.textContent.split(Xe),$=r.length-1;if($>0){i.textContent=St?St.emptyScript:"";for(let w=0;w<$;w++)i.append(r[w],_t()),it.nextNode(),p.push({type:2,index:++a});i.append(r[$],_t())}}}else if(i.nodeType===8)if(i.data===to)p.push({type:2,index:a});else{let r=-1;for(;(r=i.data.indexOf(Xe,r+1))!==-1;)p.push({type:7,index:a}),r+=Xe.length-1}a++}}static createElement(t,o){let n=rt.createElement("template");return n.innerHTML=t,n}};function st(e,t,o=e,n){if(t===Be)return t;let i=n!==void 0?o._$Co?.[n]:o._$Cl,a=xt(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,o,n)),n!==void 0?(o._$Co??=[])[n]=i:o._$Cl=i),i!==void 0&&(t=st(e,i._$AS(e,t.values),i,n)),t}var At=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??rt).importNode(o,!0);it.currentNode=i;let a=it.nextNode(),l=0,g=0,p=n[0];for(;p!==void 0;){if(l===p.index){let d;p.type===2?d=new yt(a,a.nextSibling,this,t):p.type===1?d=new p.ctor(a,p.name,p.strings,this,t):p.type===6&&(d=new Ct(a,this,t)),this._$AV.push(d),p=n[++g]}l!==p?.index&&(a=it.nextNode(),l++)}return it.currentNode=rt,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++}},yt=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,o,n,i){this.type=2,this._$AH=me,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=st(this,t,o),xt(t)?t===me||t==null||t===""?(this._$AH!==me&&this._$AR(),this._$AH=me):t!==this._$AH&&t!==Be&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ko(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!==me&&xt(this._$AH)?this._$AA.nextSibling.data=t:this.T(rt.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=vt.createElement(Jo(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(o);else{let a=new At(i,this),l=a.u(this.options);a.p(o),this.T(l),this._$AH=a}}_$AC(t){let o=Yo.get(t.strings);return o===void 0&&Yo.set(t.strings,o=new vt(t)),o}k(t){oo(this._$AH)||(this._$AH=[],this._$AR());let o=this._$AH,n,i=0;for(let a of t)i===o.length?o.push(n=new e(this.O(_t()),this.O(_t()),this,this.options)):n=o[i],n._$AI(a),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=Vo(t).nextSibling;Vo(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},at=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,o,n,i,a){this.type=1,this._$AH=me,this._$AN=void 0,this.element=t,this.name=o,this._$AM=i,this.options=a,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=me}_$AI(t,o=this,n,i){let a=this.strings,l=!1;if(a===void 0)t=st(this,t,o,0),l=!xt(t)||t!==this._$AH&&t!==Be,l&&(this._$AH=t);else{let g=t,p,d;for(t=a[0],p=0;p<a.length-1;p++)d=st(this,g[n+p],o,p),d===Be&&(d=this._$AH[p]),l||=!xt(d)||d!==this._$AH[p],d===me?t=me:t!==me&&(t+=(d??"")+a[p+1]),this._$AH[p]=d}l&&!i&&this.j(t)}j(t){t===me?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Rt=class extends at{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===me?void 0:t}},Tt=class extends at{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==me)}},It=class extends at{constructor(t,o,n,i,a){super(t,o,n,i,a),this.type=5}_$AI(t,o=this){if((t=st(this,t,o,0)??me)===Be)return;let n=this._$AH,i=t===me&&n!==me||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,a=t!==me&&(n===me||i);i&&this.element.removeEventListener(this.name,this,n),a&&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)}},Ct=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){st(this,t)}},en={M:eo,P:Xe,A:to,C:1,L:Qo,R:At,D:Ko,V:st,I:yt,H:at,N:Tt,U:It,B:Rt,F:Ct},xi=Qt.litHtmlPolyfillSupport;xi?.(vt,yt),(Qt.litHtmlVersions??=[]).push("3.3.3");var qe={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Lt=e=>(...t)=>({_$litDirective$:e,values:t}),ft=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:Tr}=en;var tn=e=>e.strings===void 0;var vi={},on=(e,t=vi)=>e._$AH=t;var nn=Lt(class extends ft{constructor(e){if(super(e),e.type!==qe.PROPERTY&&e.type!==qe.ATTRIBUTE&&e.type!==qe.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!tn(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===Be||t===me)return t;let o=e.element,n=e.name;if(e.type===qe.PROPERTY){if(t===o[n])return Be}else if(e.type===qe.BOOLEAN_ATTRIBUTE){if(!!t===o.hasAttribute(n))return Be}else if(e.type===qe.ATTRIBUTE&&o.getAttribute(n)===t+"")return Be;return on(e),t}});var wt=class extends ft{constructor(t){if(super(t),this.it=me,t.type!==qe.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===me||t==null)return this._t=void 0,this.it=t;if(t===Be)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:[]}}};wt.directiveName="unsafeHTML",wt.resultType=1;var kt=Lt(wt);var rn='<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 sn='<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>',an='<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>',ln='<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>',cn='<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 dn='<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>';var Ce=["critical","high","medium","low","high_bug","bug","informational"];var io=["revalidation","refuted","unreachable","confirmed","partial","unknown"],Gr=new Set(io);var Kr=new TextEncoder,Zr=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});var is=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-history":"/manage/history"});function ro(e){return new RegExp(`(^|/)${e}/`,"u")}function Fi(e){return new RegExp(`^(?:.*/)?${e}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,"u")}var $s=ro("node_modules"),Ms=ro("vendor"),so="node_modules",Ss=ro(so),_s=Fi(so);function Et(){return so}function We(e){return typeof e!="number"||!Number.isFinite(e)?null:`${e.toLocaleString()} B`}function Bi(){return{showAll:!1,splitOwnDirs:!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 Je=Bi(),y=new Proxy(Je,{get(e,t){return Je[t]},set(e,t,o){return Je[t]=o,!0},has(e,t){return t in Je},deleteProperty(e,t){return delete Je[t]},ownKeys(){return Reflect.ownKeys(Je)},getOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(Je,t)}});function fn(){y.graphState?._cleanup&&y.graphState._cleanup(),y.graphState=null}function Ni(e){e&&(Je=e)}function Pt(e){if(!e)return null;let t=Et(),o=new RegExp(`^(?:.*/)?${t}/(@[^/]+/[^/]+|[^/]+)`,"u"),n=e.match(o);if(n)return n[1];let i=e.indexOf("/");return i>0?e.slice(0,i):"/"}var Hi=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],Di=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];function Ui(){if(typeof document>"u")return!1;let e=document.body?.classList;return!!e&&(e.contains("theme-light")||e.contains("theme-pink"))}var ao=new Map;function he(e){let t=Ui(),o=t?Di:Hi,n=e??"__own__",i=`${t?"l":"d"}:${n}`;if(ao.has(i))return ao.get(i);let a=0;for(let d of n)a=a*37+d.codePointAt(0)|0;let g=((a%o.length+o.length)%o.length*7+3)%o.length,p=o[g];return ao.set(i,p),p}function zt(e){return e==="__own__"?"own source":typeof e!="string"?e:e.match(/^(?:.*\/)?vendor\/(.+)$/u)?.[1]??e}function gn(e){if(!e)return 0;let t=0;for(let o of Ce)t+=e[o]??0;return t}function hn(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 mn(e){if(!e)return null;for(let t of Ce)if((e[t]??0)>0)return t;return null}function bn(e,t,o,n,i,a,l,g={}){let p=g.pkgOf??Pt,d=new Set(t),u=new Map,r=new Map;for(let v of t){let P=(e[v].imports??[]).filter(z=>d.has(z));u.set(v,P);for(let z of P)r.has(z)||r.set(z,[]),r.get(z).push(v)}let $=t.map(v=>{let P=o.get(v),z=n?.get(v)??null,V=gn(P),L=p(v)??"__own__",c=mn(P);return{id:v,file:v,pkg:L,x:0,y:0,deg:0,issue:c,totalIssues:V,own:P,subtree:z,size:typeof e[v]?.size=="number"?e[v].size:null,severitySet:i?.get(v)??null,colorSet:a?.get(v)??null,findings:l?.get(v)??null,isHub:!1,label:v.split("/").pop()??v}}),w=new Map($.map(v=>[v.file,v])),m=new Map;for(let v of t)for(let P of u.get(v)??[]){let[z,V]=v<P?[v,P]:[P,v],L=`${z}\0${V}`,c=m.get(L);if(!c){let R=w.get(z),T=w.get(V);if(!R||!T)continue;c={a:z,b:V,cross:R.pkg!==T.pkg,fromLo:!1,fromHi:!1},m.set(L,c),R.deg++,T.deg++}v===z?c.fromLo=!0:c.fromHi=!0}let S=[...m.values()],s=hn(S),x=new Map;for(let v of $)x.set(v.pkg,(x.get(v.pkg)??0)+1);let _=[...x.entries()].toSorted((v,P)=>P[1]-v[1]).map(([v])=>v),h=new Map;for(let v of $)h.has(v.pkg)||h.set(v.pkg,[]),h.get(v.pkg).push(v);let k={files:t,nodes:$,nodeByFile:w,edges:S,adj:s,importsOf:u,importedBy:r,packages:_,pkgCount:x,byPkg:h};return Vi(k),k}function Vi(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 Ot(e){let t=e.packages.map(g=>{let p=e.byPkg.get(g)??[],d={};for(let s of Ce)d[s]=0;let u=new Set,r=new Set,$=[],w=0,m=0,S=!1;for(let s of p){if(w+=s.totalIssues,s.own)for(let x of Ce)d[x]+=s.own[x]??0;if(s.severitySet)for(let x of s.severitySet)u.add(x);if(s.colorSet)for(let x of s.colorSet)r.add(x);typeof s.size=="number"&&(m+=s.size,S=!0),$.push(s.file)}return{file:g,pkg:g,label:Ne(g),fileCount:p.length,size:S?m:null,own:d,totalIssues:w,issue:mn(d),severitySet:u.size>0?u:null,colorSet:r.size>0?r:null,pathText:$.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],$=`${u}\0${r}`,w=n.get($);w||(w={a:u,b:r,cross:!0,count:0,fromLo:!1,fromHi:!1},n.set($,w),o.get(u).deg++,o.get(r).deg++),w.count++;let m=p===u;g.fromLo&&(m?w.fromLo=!0:w.fromHi=!0),g.fromHi&&(m?w.fromHi=!0:w.fromLo=!0)}let i=[...n.values()],a=hn(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:a,importsOf:l}}function Ne(e){return zt(e)}function Ft(e,t){if(!t||t==="/"||t==="__own__")return e;for(let o of["node_modules","dependencies",Et()]){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 lo=new WeakMap,co=new WeakMap;function gt(e,t){return e.nodes.length<=100&&!t}function Bt(e,t){if(!gt(e,t))return Nt(e);if(co.has(e))return co.get(e);let o=new Map(e.nodes.map(a=>[a.file,[...new Set(e.importsOf.get(a.file)??[])]])),n=[];for(let[a,l]of o)for(let g of l)n.push({from:a,to:g});let i={...e,importsOf:o,directedEdges:n,fileLevel:!0};return co.set(e,i),i}function Nt(e){if(lo.has(e))return lo.get(e);let t=Ot(e);if(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.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 lo.set(e,t),t}function fo(e,t,o=null){let n=t.showBundleLayouts&&y.bundleLayout==="layers",i=t.showBundleLayouts&&y.bundleLayout==="matrix",a=t.showBundleLayouts&&y.bundleLayout==="dependencies",l=t.showBundleLayouts?O`<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&&!a)}">${kt(sn)}</button> <button type="button" data-g2-layout="layers" aria-label="Layers" aria-pressed="${String(!!n)}">${kt(an)}</button> <button type="button" data-g2-layout="matrix" aria-label="Matrix" aria-pressed="${String(!!i)}">${kt(ln)}</button> <button type="button" data-g2-layout="dependencies" aria-label="Dependencies" aria-pressed="${String(!!a)}">${kt(cn)}</button></div>`:null,g=t.extraTopRow,p=t.hideAllFiles??!1,d=t.triageCounts??{inprogress:0,fixed:0,invalid:0,deleted:0},u=t.triageStates??["inprogress","fixed","invalid","deleted"],r={};for(let z of Ce)r[z]=0;for(let z of e.nodes)if(z.severitySet)for(let V of z.severitySet)r[V]!==void 0&&r[V]++;let $=Ce.some(z=>r[z]>0||y.selectedSeverities.has(z)),w=["none","red","blue","green","gray"],m={none:0,red:0,blue:0,green:0,gray:0};for(let z of e.nodes)if(z.colorSet)for(let V of z.colorSet)m[V]!==void 0&&m[V]++;let S=w.some(z=>m[z]>0||y.selectedColors.has(z)),s=O`<triage-selector variant="graph" .counts="${d}" .states="${u}"></triage-selector>`,x=p?null:O`<mode-switch label="All files" .checked="${y.showAll}" data-g2-show-all></mode-switch>`,h=t.showSplitOwnDirs??!1?O`<mode-switch label="Split dirs" .checked="${y.splitOwnDirs}" data-g2-split-own></mode-switch>`:null,v=(a?e.nodes.length<=100:!n&&!i&&(t.showPackagesView??!1))?O`<mode-switch label="Packages" .checked="${a?y.dependencyPackagesView:y.packagesView}" data-g2-packages-view></mode-switch>`:null,P=e.reasons?.length>0?O`<label class="g2-reason-filter"><select aria-label="Filter files" .value="${nn(y.bundleReason??"")}" @change="${z=>z.currentTarget.dispatchEvent(new CustomEvent("bundle-graph-reason-change",{detail:{reason:z.currentTarget.value||null},bubbles:!0,composed:!0}))}"><option value="" ?selected="${y.bundleReason===null}">All</option>${e.reasons.map(z=>O`<option value="${z}" ?selected="${z===y.bundleReason}">${z}</option>`)}</select></label>`:null;return O`<div class="graph2-topbar">${g?O`<div class="graph2-topbar-row graph2-topbar-row-extra toolbar-row">${g} ${x} ${h} ${v}<div class="g2-spacer"></div>${s}</div>`:null}<div class="graph2-topbar-row graph2-topbar-row-main toolbar-row sev-row">${l} ${P} ${g?null:h} ${$?O`<severity-chips .counts="${r}" .selected="${[...y.selectedSeverities]}" kind="graph"></severity-chips>`:null} ${S?O`<triage-filter .counts="${m}" .selected="${[...y.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="${y.pathFilter}"> <button type="button" class="g2-path-filter-clear" id="g2-path-filter-clear" aria-label="Clear filter">✕</button></div>${g?null:x} ${g?null:v} ${o}<div class="g2-spacer"></div>${g?null:s} <button type="button" class="g2-icon-btn" id="g2-fullscreen" aria-label="Toggle fullscreen">⛶</button></div></div>`}function Gi(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 a=o.length-i,l=n.slice(i).join("/");return a===0?"./"+l:"../".repeat(a)+l}function ji(e,t){if(!t&&t!=="")return e;let o=Gi(t,e);return o.length<e.length?o:e}function uo(e,t,o,n){let i=o.length;if(i===0)return O`<div class="g2-sel-section"><div class="g2-sel-section-label">${t} (${i})</div><div class="g2-sel-section-empty">none</div></div>`;let a=o.map(l=>({file:l,display:ji(l,n)}));return a.sort((l,g)=>l.display.localeCompare(g.display)),O`<div class="g2-sel-section"><div class="g2-sel-section-label">${t} (${i})</div><ul class="g2-sel-file-list">${a.map(({file:l,display:g})=>{let p=e.nodeByFile.get(l),d=p?he(p.pkg):"#666";return O`<li><button type="button" class="g2-sel-file-link" data-g2-select="${l}" data-tooltip="${l}"><span class="g2-sel-file-dot" style="${Ze({background:d})}"></span> <span class="g2-sel-file-path">${g}</span></button></li>`})}</ul></div>`}function lt(e){if(!e)return O`<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?O`<div class="g2-sel-section-empty">none</div>`:O`<div class="tree-count-chips">${o.map(n=>O`<span class="${`tree-count-chip ${n}`}">${e[n]} ${n.replaceAll("_"," ")}</span>`)}</div>`}function xn(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&&y.bundleLayout==="dependencies"&&!y.focusedPkg?Bt(e,y.dependencyPackagesView):null,a=i?.nodes.length??e.nodes.length,l=i?.directedEdges.length??e.edges.length,g=a===0?"0.0":(l*2/a).toFixed(1),p=Ne(y.focusedPkg);return O`<main class="graph2-stage"><canvas id="g2-canvas"></canvas>${y.focusedPkg?O`<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?O`<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":O`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 vn(e){if(e.supportsLayers&&y.bundleLayout==="dependencies")return null;let t=null;if(y.selected){let n=e.nodeByFile.get(y.selected);n&&(t=n.pkg)}else y.solo&&(t=y.solo);if(!t||(e.pkgCount.get(t)??0)<=1||y.focusedPkg===t)return null;let o=Ne(t);return O`<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 yn(){return O`<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 wn(e){if(e.supportsLayers&&y.bundleLayout==="dependencies"&&!y.focusedPkg&&!gt(e,y.dependencyPackagesView)){let i=Nt(e),a=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 O`<div class="g2-panel-title">Packages · importers</div>${po(i,a,!0)}`}let t=y.showAll&&e.nodes.length>0&&e.nodes.every(i=>typeof i.size=="number"),o=e.nodes.some(i=>i.totalIssues>0),n=y.topPkgsTab;return n==="size"&&!t&&(n="files"),n==="issues"&&!o&&(n="files"),O`<div class="g2-panel-title g2-panel-title-row"><span>Packages</span><div class="g2-mini-tabs">${o?O`<button type="button" class="${pt({"g2-mini-tab":!0,on:n==="issues"})}" data-g2-top-pkgs="issues">Issues</button>`:null} <button type="button" class="${pt({"g2-mini-tab":!0,on:n==="files"})}" data-g2-top-pkgs="files">Files</button> ${t?O`<button type="button" class="${pt({"g2-mini-tab":!0,on:n==="size"})}" data-g2-top-pkgs="size">Size</button>`:null}</div></div>${Wi(e,n)}`}function kn(e,t={}){if(e.supportsLayers&&y.bundleLayout==="dependencies"&&!y.focusedPkg&&!gt(e,y.dependencyPackagesView))return Yi(Nt(e),y.solo);let o=y.selected;if(o){let n=e.nodeByFile.get(o);return n?Xi(e,n,o,t):O`<div class="g2-empty-state"><strong>File not in current view</strong>Adjust filters or pick another file.</div>`}return y.solo?y.solo==="__own__"&&!e.pkgCount.has("__own__")&&e.layerRoots?.appImports.length>0?O`<div class="g2-empty-state"><strong>App</strong>App source is not included in this view. Connections come from its recorded imports.</div>`:qi(e,y.solo):O`<div class="g2-empty-state">Click a node or a package row to inspect.</div>`}function Xi(e,t,o,n){let i=he(t.pkg),a=Ne(t.pkg),l=Ft(o,t.pkg),g=e.importedBy.get(o)??[],p=e.importsOf.get(o)??[],d=o.lastIndexOf("/"),u=d>=0?o.slice(0,d):"";return O`<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="${Ze({"--dot":i,background:i})}"></span> <span class="g2-sel-pkg">${a}</span></div></div><div class="g2-sel-fullpath" data-tooltip="${o}">${o}</div>${We(t.size)?O`<div class="g2-sel-size">${We(t.size)}</div>`:null}<div class="g2-sel-section"><div class="g2-sel-section-label">Own findings</div>${lt(t.own)}</div><div class="g2-sel-section"><div class="g2-sel-section-label">Subtree findings</div>${lt(t.subtree)}</div><div class="g2-sel-jumps">${t.totalIssues>0?O`<button type="button" class="g2-sel-jump" data-g2-jump-findings="${o}">Findings →</button>`:null} ${n.isBundleContext?t.origFile?O`<button type="button" class="g2-sel-jump" data-bundle-view-source="${t.origFile}">View source →</button>`:null:O`<button type="button" class="g2-sel-jump" data-g2-jump-file="${o}">Files →</button>`}</div>${uo(e,"Imported by",g,u)} ${uo(e,"Imports",p,u)}</div>`}function qi(e,t){let o=e.nodes.filter(r=>r.pkg===t),n=o.length;if(n===0)return O`<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=he(t),a=Ne(t),l={};for(let r of Ce)l[r]=0;for(let r of o)if(r.own)for(let $ of Ce)l[$]+=r.own[$]??0;let g=0,p=0;for(let r of e.edges){let $=e.nodeByFile.get(r.a),w=e.nodeByFile.get(r.b);!$||!w||($.pkg===t&&w.pkg===t?p++:($.pkg===t||w.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 $ of e.importedBy.get(r.file)??[]){let w=e.nodeByFile.get($);w&&w.pkg!==t&&u.add($)}return O`<div class="g2-selection-card"><div class="g2-sel-head"><span class="g2-sel-dot" style="${Ze({"--dot":i,background:i})}"></span> <span class="g2-sel-id">${a}</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>${lt(l)}</div>${uo(e,"Imported by",[...u])}</div>`}function Wi(e,t){let o=e.nodes.length||1,n=t??y.topPkgsTab,i=y.selectedSeverities,a=y.selectedColors,l=i.size>0,g=a.size>0,p=l||g,d=new Map,u=new Map,r=0,$=0;for(let s of e.nodes){let x;if(p){if(x=0,s.findings)for(let _ of s.findings)l&&!i.has(_.severity)||g&&!a.has(_.color)||x++}else x=s.totalIssues;d.set(s.pkg,(d.get(s.pkg)??0)+x),r+=x,typeof s.size=="number"&&(u.set(s.pkg,(u.get(s.pkg)??0)+s.size),$+=s.size)}let w;n==="issues"?w=e.packages.filter(s=>(d.get(s)??0)>0).toSorted((s,x)=>{let _=d.get(s)??0,h=d.get(x)??0;return h!==_?h-_:(e.pkgCount.get(x)??0)-(e.pkgCount.get(s)??0)}):n==="size"?w=e.packages.filter(s=>(u.get(s)??0)>0).toSorted((s,x)=>{let _=u.get(s)??0,h=u.get(x)??0;return h!==_?h-_:(e.pkgCount.get(x)??0)-(e.pkgCount.get(s)??0)}):w=[...e.packages].toSorted((s,x)=>{let _=e.pkgCount.get(s)??0,h=e.pkgCount.get(x)??0;return h!==_?h-_:(d.get(x)??0)-(d.get(s)??0)});let m=s=>n==="issues"?r>0?((d.get(s)??0)/r*100).toFixed(2):"0":n==="size"?$>0?((u.get(s)??0)/$*100).toFixed(2):"0":(e.pkgCount.get(s)/o*100).toFixed(2),S=n==="issues"?"No packages with issues":n==="size"?"No packages with size":"No packages";return O`<div class="g2-dist-bar">${e.packages.map(s=>{let x=he(s);return O`<span style="${Ze({background:x,width:`${m(s)}%`})}"></span>`})}</div><div class="g2-dist-list">${w.length===0?O`<div class="g2-dist-empty">${S}</div>`:null} ${Zt(w,s=>s,s=>{let x=he(s),_=e.pkgCount.get(s)??0,h=d.get(s)??0,k=u.get(s)??0,v=n==="issues"?h:n==="size"?We(k):_,P=n==="issues"?r>0?(h/r*100).toFixed(1):"0.0":n==="size"?$>0?(k/$*100).toFixed(1):"0.0":(_/o*100).toFixed(1),z=Ne(s),V=y.solo===s;return O`<button type="button" class="${pt({"g2-dist-item":!0,on:V})}" data-g2-pkg="${s}" data-tooltip="${z}"><span class="g2-dist-dot" style="${Ze({background:x})}"></span><span class="g2-dist-name">${z}</span><span class="g2-dist-count">${v}</span><span class="g2-dist-pct">${P}%</span></button>`})}</div>`}function po(e,t,o=!1){return O`<div class="g2-dist-list">${Zt(t,n=>n,n=>O`<button type="button" class="${pt({"g2-dist-item":!0,on:y.solo===n})}" data-g2-pkg="${n}"><span class="g2-dist-dot" style="${Ze({background:he(n)})}"></span> <span class="g2-dist-name">${Ne(n)}</span> ${o?O`<span class="g2-dist-count">${e.importedBy.get(n).length}</span>`:null}</button>`)}</div>`}function Yi(e,t){let o=e.byPkg.get(t);if(!o)return O`<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 O`<div class="g2-selection-card"><div class="g2-sel-head"><span class="g2-sel-dot" style="${Ze({background:he(t)})}"></span> <span class="g2-sel-id">${o.label}</span></div>${o.totalIssues?O`<div class="g2-sel-section">${lt(o.own)}</div>`:null}<div class="g2-sel-section"><div class="g2-sel-section-label">Imported by (${n.length})</div>${po(e,n.toSorted())}</div><div class="g2-sel-section"><div class="g2-sel-section-label">Dependencies (${i.length})</div>${po(e,i.toSorted())}</div></div>`}var He;function Ki(){return He||(He=document.createElement("div"),He.id="styled-tooltip",He.setAttribute("popover","manual"),document.body.append(He),He)}function Zi(e){typeof e.showPopover=="function"&&(e.matches(":popover-open")&&e.hidePopover(),e.showPopover())}var Dt=null,$n="",Mn="",Sn="",_n="",Ut=null,In=0,Cn=0;document.addEventListener("mousemove",e=>{In=e.clientX,Cn=e.clientY},{passive:!0});var Ji=100,Qi=14,er=8,Ht=8;function tr(e,{placement:t="cursor"}={}){t=e.dataset.tooltipPlacement??t;let o=Ki(),n=e.dataset.tooltip??"",i=e.dataset.tooltipRepo??"",a=["stasis","sourcemap"].includes(e.dataset.tooltipBundle)?e.dataset.tooltipBundle:"",l=e.dataset.tooltipStats??"";if(!n||Dt===e&&$n===n&&Mn===i&&Sn===a&&_n===l)return;if(o.textContent=n,i){let S=document.createElement("div");S.className="tooltip-repo",S.innerHTML=dn;let s=document.createElement("span");s.textContent=i,S.append(s),o.append(S)}if(a||l){let S=document.createElement("div");if(S.className="tooltip-bundle",a==="stasis"){let _=document.createElement("img");_.src="./stasis.svg",_.alt="",S.append(_)}else S.innerHTML=rn;let s=document.createElement("span"),x=a==="stasis"?"Stasis":a==="sourcemap"?"Sourcemap":"";s.textContent=[x,l].filter(Boolean).join(" \xB7 "),S.append(s),o.append(S)}Zi(o),o.style.left="0px",o.style.top="0px",o.style.transform="none",o.classList.add("visible");let g=In,p=Cn+Qi;if(t==="right"||t==="right-start"){let S=e.getBoundingClientRect();g=S.right+er,p=S.top+(t==="right"?S.height/2:0)}let d=window.innerWidth-o.offsetWidth-Ht,u=Math.max(Ht,Math.min(g,d));o.style.left=`${Math.round(u)}px`;let r=o.offsetHeight,$=t==="right"?p-r/2:p,w=window.innerHeight-r-Ht,m=Math.max(Ht,Math.min($,w));o.style.top=`${Math.round(m)}px`,Dt=e,$n=n,Mn=i,Sn=a,_n=l}function An(){clearTimeout(Ut),Ut=null,He&&(He.classList.remove("visible"),typeof He.hidePopover=="function"&&He.matches(":popover-open")&&He.hidePopover()),Dt=null}function or(e,{gate:t,placement:o}={}){t&&!t(e)||(clearTimeout(Ut),Ut=setTimeout(()=>{tr(e,{placement:o})},Ji))}var Rn=new WeakSet;function Tn(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 Ln(e,t){!e||Rn.has(e)||(Rn.add(e),e.addEventListener("mouseover",o=>{let n=Tn(o,e);if(!n){An();return}n!==Dt&&or(n,t)}),e.addEventListener("mouseout",o=>{let n=Tn(o,e),i=o.relatedTarget?.closest?.("[data-tooltip]")??null;n&&n===i||An()}))}var go=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 nr(e,t){for(let o=0;o<8;o++){let n=!1;for(let i=0;i<e.length-1;i++){let a=o%2?e.length-2-i:i,l=e[a],g=e[a+1];(t.get(g)?.get(l)?.count??0)<=(t.get(l)?.get(g)?.count??0)||(e[a]=g,e[a+1]=l,n=!0)}if(!n)break}return e}function ir(e){let t=[],o=new Set;for(let n of e.values())n.outgoing.sort((i,a)=>a[1]-i[1]||i[0].tie-a[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 a=i.at(-1);if(a.next===a.node.outgoing.length){t.push(a.node.id),i.pop();continue}let l=a.node.outgoing[a.next++][0];o.has(l)||(o.add(l),i.push({node:l,next:0}))}}return t.toReversed()}function ho(e,t){let o=new Map(e.map((i,a)=>[i,a])),n=0;for(let i of t.values())for(let[a,l]of i.outgoing)o.get(i.id)<o.get(a.id)&&(n+=l);return n}function rr(e,t){let o=ho(e,t),n=o,i=0;for(let a=0;a<e.length-1;a++)o-=t.get(e[a]).originalBalance,o>n&&(n=o,i=a+1);return[...e.slice(i),...e.slice(0,i)]}function En(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||(p.outgoing.push([u,d.count]),u.incoming.push([p,d.count]),p.balance+=d.count,u.balance-=d.count)}for(let p of o.values())p.originalBalance=p.balance;let n=[],i=new go(o.values()),a=[];for(;i.nodes.length>0;){let p=i.take();p.balance>=0?n.push(p.id):a.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=ho(e,o);for(let p of[[...n,...a.toReversed()],ir(o),e,e.toReversed()]){let d=nr(rr(p,o),t),u=ho(d,o);u>g&&(l=d,g=u)}return l}function mo(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=[],a=new Set;for(let p of e){if(a.has(p))continue;a.add(p);let d=[[p,(t.get(p)??[])[Symbol.iterator]()]];for(;d.length>0;){let[u,r]=d.at(-1),$=r.next();if($.done){i.push(u),d.pop();continue}o.has($.value)&&!a.has($.value)&&(a.add($.value),d.push([$.value,(t.get($.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 $=r.pop();d.push($);for(let w of n.get($))l.has(w)||(l.set(w,u),r.push(w))}g.push(d.toSorted())}return{groups:g,componentOf:l}}function bo(e,{expanded:t=new Set,order:o="structure",query:n="",neighborhood:i=null,cyclesOnly:a=!1}={}){let l=new Map,g=new Map;for(let f of e.nodes){let M=t.has(f.pkg),I=`${M?"f":"p"}:${M?f.file:f.pkg}`;l.has(I)||l.set(I,{id:I,pkg:f.pkg,file:M?f.file:null,label:M?f.file:zt(f.pkg),files:[],size:0,issues:0,incoming:0,outgoing:0});let Y=l.get(I);Y.files.push(f.file),Y.size+=f.size??0,Y.issues+=f.totalIssues??0,g.set(f.file,I)}let p=new Map,d=new Set,u=new Map([...l.keys()].map(f=>[f,new Set])),r=new Set,$=0;for(let[f,M]of e.importsOf){let I=g.get(f);if(I)for(let Y of new Set(M)){let W=g.get(Y);if(!W)continue;p.has(I)||p.set(I,new Map),p.get(I).has(W)||p.get(I).set(W,{from:I,to:W,count:0,examples:[]});let xe=p.get(I).get(W);xe.count++,xe.examples.length<80&&xe.examples.push([f,Y]),$++,l.get(I).outgoing++,l.get(W).incoming++,I!==W&&(r.add(I),d.add(W)),(I!==W||l.get(I).file)&&u.get(I).add(W)}}let w=[...l.keys()].toSorted(),{groups:m,componentOf:S}=mo(w,u),s=new Set(m.flatMap(f=>f.length>1||u.get(f[0]).has(f[0])?f:[]));for(let f of l.values())f.cyclic=s.has(f.id),f.component=S.get(f.id);let x=e.ownSourcePackages??new Set(e.layerRoots?.roots??[]),_=f=>f.pkg==="__own__"?0:x.has(f.pkg)?1:2,h=f=>d.has(f.id)&&r.has(f.id)?0:1,k=new Map(m.map((f,M)=>[M,f.reduce((I,Y)=>Math.min(I,_(l.get(Y))),2)])),v=(f,M)=>f.pkg.localeCompare(M.pkg)||f.label.localeCompare(M.label),P=new Map;if(o==="structure"){for(let f of m)if(!(f.length<2))for(let M of Map.groupBy(f,I=>_(l.get(I))).values()){let I=M.toSorted((Y,W)=>v(l.get(Y),l.get(W)));En(I,p).forEach((Y,W)=>P.set(Y,W))}}for(let[f,M]of p)for(let I of M.values())I.cyclic=s.has(f)&&S.get(f)===S.get(I.to)&&(f!==I.to||l.get(f).file!==null);let z=n.trim().toLowerCase(),V=new Set(w.filter(f=>!z||l.get(f).files.some(M=>M.toLowerCase().includes(z))||l.get(f).label.toLowerCase().includes(z))),L=new Set(i?[i]:V);if(z||i)for(let[f,M]of u)for(let I of M)(i?f===i:V.has(f))&&L.add(I),(i?I===i:V.has(I))&&L.add(f);let c=(f,M)=>{if(o==="structure"){let W=k.get(f.component)-k.get(M.component);if(W)return W;let xe=h(f)-h(M);if(xe)return xe;let Me=f.component-M.component;if(Me)return Me}let I=_(f)-_(M);if(I)return I;let Y=h(f)-h(M);if(Y)return Y;if(o==="structure"&&f.component===M.component){let W=(P.get(f.id)??0)-(P.get(M.id)??0);if(W)return W}return o==="importers"&&f.incoming!==M.incoming?M.incoming-f.incoming:o==="imports"&&f.outgoing!==M.outgoing?M.outgoing-f.outgoing:v(f,M)},R=[...l.values()].filter(f=>L.has(f.id)&&(!a||f.cyclic)).toSorted(c),T=new Map(R.map((f,M)=>[f.id,M])),F=[];for(let[f,M]of p)if(T.has(f))for(let I of M.values())T.has(I.to)&&F.push({...I,row:T.get(f),col:T.get(I.to)});return{rows:R,byId:l,cells:p,visibleCells:F,index:T,matches:V,importCount:$,totalRows:l.size,cycleCount:m.filter(f=>s.has(f[0])).length}}function xo(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 vo(e,t,o,n){return Math.max(Math.min(18,xo(t,o,n)),Math.min(27,e))}function zn(e,t,o,n){let i=Math.floor((e-196+n.x)/n.cell),a=Math.floor((t-118+n.y)/n.cell);return e<196&&t>=118&&a>=0&&a<o.rows.length?{row:a,col:null}:t<118&&e>=196&&i>=0&&i<o.rows.length?{row:i,col:null}:e>=196&&t>=118&&a>=0&&i>=0&&a<o.rows.length&&i<o.rows.length?{row:a,col:i}:null}function Pn(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 On(e,t,o,{width:n,height:i,theme:a,colorOf:l,hover:g,selected:p,dimmed:d}){let{cell:u,x:r,y:$}=o,{rows:w}=t,m=c=>196+c*u-r,S=c=>118+c*u-$,s=Math.max(0,Math.floor($/u)),x=Math.min(w.length,Math.ceil((i-118+$)/u)),_=Math.max(0,Math.floor(r/u)),h=Math.min(w.length,Math.ceil((n-196+r)/u)),k=g??p;e.clearRect(0,0,n,i),e.fillStyle=a.bg,e.fillRect(0,0,n,i),e.save(),e.beginPath(),e.rect(196,118,n-196,i-118),e.clip();let v=[];for(let c=0;c<w.length;c++){let R=v.at(-1),T=w[c];R&&R.component===T.component?R.end=c+1:v.push({component:T.component,start:c,end:c+1,cyclic:T.cyclic})}for(let c of v)c.cyclic&&(e.strokeStyle=a.cycle+"85",e.lineWidth=1,e.strokeRect(m(c.start),S(c.start),(c.end-c.start)*u,(c.end-c.start)*u));if(k&&(e.fillStyle=a.highlight,e.fillRect(196,S(k.row),n-196,u),e.fillRect(m(k.col??k.row),118,u,i-118)),e.strokeStyle=a.grid,e.lineWidth=1,u>=9){e.beginPath();for(let c=s;c<=x;c++)e.moveTo(196,S(c)+.5),e.lineTo(n,S(c)+.5);for(let c=_;c<=h;c++)e.moveTo(m(c)+.5,118),e.lineTo(m(c)+.5,i);e.stroke()}let P=t.visibleCells.reduce((c,R)=>Math.max(c,R.count),1),z=u>=8?2:.25;for(let c of t.visibleCells)c.row<s||c.row>=x||c.col<_||c.col>=h||(e.globalAlpha=d(w[c.row])&&d(w[c.col])?.12:.35+.65*Math.log1p(c.count)/Math.log1p(P),e.fillStyle=c.cyclic&&u<10?a.cycle:l(w[c.row].pkg),e.fillRect(m(c.col)+z,S(c.row)+z,Math.max(1,u-2*z),Math.max(1,u-2*z)),c.cyclic&&c.from!==c.to&&u>=10&&(e.fillStyle=a.cycle,e.fillRect(m(c.col)+u-5,S(c.row)+2,3,3)));e.globalAlpha=1,p&&(e.strokeStyle=a.text,e.lineWidth=2,p.col===null?e.strokeRect(197,S(p.row)+1,n-196-2,u-2):e.strokeRect(m(p.col)+1,S(p.row)+1,u-2,u-2)),e.restore(),e.fillStyle=a.surface,e.fillRect(0,0,n,118),e.fillRect(0,0,196,i),e.font="11px ui-monospace, monospace",e.textBaseline="middle";let V=Math.max(1,Math.ceil(14/u));for(let c=s;c<x;c++){if(c%V&&c!==k?.row)continue;e.save(),e.beginPath(),e.rect(5,111,186,i-118+7),e.clip();let R=S(c)+u/2;c===k?.row&&(e.fillStyle=a.highlight,e.fillRect(0,S(c),196,Math.max(u,14))),e.fillStyle=l(w[c].pkg),e.fillRect(8,R-3,5,6),e.fillStyle=c===k?.row||t.matches.size<t.totalRows&&t.matches.has(w[c].id)?a.text:a.muted,e.fillText(`${w[c].file?" ":""}${Pn(w[c])}`,20,R),e.restore()}let L=Math.max(1,Math.ceil(17/u));for(let c=_;c<h;c++)c%L&&c!==(k?.col??k?.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===(k?.col??k?.row)?a.text:a.muted,e.fillText(Pn(w[c]),0,0,115),e.restore(),e.fillStyle=l(w[c].pkg),e.fillRect(m(c)+1,114,Math.max(1,u-2),3));e.fillStyle=a.muted,e.font="10px ui-monospace, monospace",e.fillText("IMPORTERS \u2193",14,104),e.fillText("DEPENDENCIES \u2192",204,12),e.strokeStyle=a.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(),w.length===0&&(e.fillStyle=a.muted,e.fillText("No matching dependencies",216,148))}var Qe=e=>e.toLocaleString("en-US");function Vt(e,t,o){return O`<button class="g2-dist-item matrix-row-link" @click="${()=>o(e.id)}" data-tooltip="${e.label}"><span class="g2-dist-dot" style="${`background:${he(e.pkg)}`}"></span><span class="g2-dist-name">${e.label}</span><span class="g2-dist-count">${Qe(t)}</span></button>`}function Fn(e,t,o,{select:n,expand:i,expanded:a,neighborhood:l,focus:g,clear:p}){let d=e.byId.get(o?.from),u=e.byId.get(o?.to);if(!d){let s=[...e.rows].toSorted((x,_)=>_.incoming-x.incoming).slice(0,15);return O`<div class="matrix-metrics"><span><b>${Qe(t.nodes.length)}</b>files</span><span><b>${Qe(t.packages.length)}</b>packages</span><span><b>${Qe(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>${s.map(x=>Vt(x,x.incoming,n))} ${e.cycleCount?O`<h4>Cyclic groups <b>${e.cycleCount}</b></h4>${e.rows.filter(x=>x.cyclic).slice(0,12).map(x=>Vt(x,x.outgoing,n))}`:null}`}let r=u?e.cells.get(d.id)?.get(u.id):null,$=Map.groupBy(r?.examples??[],([,s])=>s),w=d.cyclic?[...e.byId.values()].filter(s=>s.component===d.component).length:0,m=[...e.cells.get(d.id)?.values()??[]].filter(s=>s.to!==d.id).toSorted((s,x)=>x.count-s.count),S=[...e.cells.values()].map(s=>s.get(d.id)).filter(s=>s&&s.from!==d.id).toSorted((s,x)=>x.count-s.count);return O`<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?O`<div class="matrix-direction">imports →</div><button class="matrix-selected-name" @click="${()=>n(u.id)}">${u.label}</button>`:null} ${(u?r?.cyclic:d.cyclic)?O`<span class="matrix-cycle-label">${u?"Import participates in a cycle":`Cyclic group \xB7 ${w} members`}</span>`:null}<div class="matrix-metrics"><span><b>${Qe(u?r?.count??0:d.files.length)}</b>${u?"file imports":"files"}</span><span><b>${We(d.size)}</b>source size</span></div><div class="matrix-actions">${d.file?O`<button @click="${()=>i(d.pkg)}">Collapse package</button><button data-bundle-view-source="${t.nodeByFile.get(d.file)?.origFile??d.file}">View source</button>`:O`<button @click="${()=>i(d.pkg)}">${a.has(d.pkg)?"Collapse files":"Expand files"}</button>`} <button aria-pressed="${String(l===d.id)}" @click="${()=>g(d.id)}">Neighborhood</button></div>${u?O`<h4>File imports</h4>${$.size>0?[...$].map(([s,x])=>O`<div class="matrix-import-group"><button class="matrix-import-target" data-bundle-view-source="${t.nodeByFile.get(s)?.origFile??s}" data-tooltip="${s}">${s}</button><ul class="matrix-import-sources" aria-label="Imported by">${x.map(([_])=>O`<li><button data-bundle-view-source="${t.nodeByFile.get(_)?.origFile??_}" data-tooltip="${_}"><span aria-hidden="true">←</span><span>${_}</span></button></li>`)}</ul></div>`):O`<p class="matrix-empty">No direct imports in this direction.</p>`} ${r&&r.count>r.examples.length?O`<p class="matrix-empty">Showing ${r.examples.length} of ${Qe(r.count)} imports.</p>`:null} ${u.id!==d.id&&e.cells.get(u.id)?.has(d.id)?O`<h4>Reverse direction</h4><button class="g2-dist-item matrix-reverse-link" @click="${()=>n(u.id,d.id)}">← ${Qe(e.cells.get(u.id).get(d.id).count)} file imports</button>`:null}`:O`<h4>Imports <b>${m.length}</b></h4>${m.slice(0,60).map(s=>Vt(e.byId.get(s.to),s.count,x=>n(d.id,x)))} ${m.length>60?O`<p class="matrix-empty">Showing the 60 strongest of ${m.length} dependencies.</p>`:null}<h4>Imported by <b>${S.length}</b></h4>${S.slice(0,60).map(s=>Vt(e.byId.get(s.from),s.count,x=>n(x,d.id)))} ${S.length>60?O`<p class="matrix-empty">Showing the 60 strongest of ${S.length} importers.</p>`:null}`}`}var Bn=`:host{display:contents}*{box-sizing:border-box}button,select{font:inherit;color:var(--text);border:1px solid var(--border);background:var(--surface);border-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: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: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: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}.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}
9
9
  `;var Nn=`.detail-action{width:22px;height:22px;display:grid;place-items:center;padding:0;background:transparent;border:0;border-radius:4px;color:var(--muted);font:500 16px/1 ui-monospace,monospace;cursor:default;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}
10
- `;var yo=class extends ut{static properties={graph:{attribute:!1}};static styles=[Ue(Mt),Ue(Bn),Ue(Nn)];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){this.graph&&(t.has("graph")||this.query!==y.pathFilter||this.dirty)&&(this.query=y.pathFilter,this.model=bo(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=bo(this.graph,{expanded:this.expanded,order:this.order,query:this.query,cyclesOnly:this.cyclesOnly})),this.selection&&!this.model.byId.has(this.selection.from)&&(this.selection=null),this.hover=null,this.dirty=!1,this.needsFit=!0)}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(){y.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),y.graphState===this.bridge&&(y.graphState=null)}clamp(){this.view.cell=vo(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:xo(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 r=this.view.cell,a=vo(r*t,this.model.rows.length,this.width,this.height);this.view.x=(this.view.x+o-196)*a/r-o+196,this.view.y=(this.view.y+n-118)*a/r-n+118,this.view.cell=a,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 zn(t.clientX-o.left,t.clientY-o.top,this.model,this.view)}move(t){if(this.drag){let n=t.clientX-this.drag.x,r=t.clientY-this.drag.y;if(Math.abs(n)+Math.abs(r)>3&&(this.drag.moved=!0),this.drag.moved){this.view.x=this.drag.ox-n,this.view.y=this.drag.oy-r,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 r=a=>Math.max(0,Math.min(this.model.rows.length-1,a));this.select(this.model.rows[r(o)].id,this.model.rows[r(n)].id)}paint(){if(!this.canvas||!this.model||this.width<=196||this.height<=118)return;if(this.needsFit&&this.fit(),this.revealPkg){let d=this.model.rows.find(u=>u.pkg===this.revealPkg);this.revealPkg=null,d&&this.select(d.id)}let t=this.canvas.getContext("2d"),o=window.devicePixelRatio||1;t.setTransform(o,0,0,o,0,0);let n=getComputedStyle(this),r=d=>n.getPropertyValue(d).trim(),a=document.body.classList.contains("theme-light")||document.body.classList.contains("theme-pink"),l={bg:r("--graph-canvas-bg")||"#0c0c0c",surface:r("--surface"),text:r("--text"),muted:r("--muted"),border:r("--border"),grid:a?"#0000000b":"#ffffff0b",highlight:a?"#0969da18":"#ffffff12",cycle:a?"#a21caf":"#e879c7"};this.style.setProperty("--matrix-cycle",l.cycle);let g=this.model.index.get(this.selection?.to),p=this.model.index.get(this.selection?.from);On(t,this.model,this.view,{width:this.width,height:this.height,theme:l,colorOf:he,hover:this.hover,selected:p===void 0?null:{row:p,col:g??null},dimmed:d=>!d.files.some(u=>{let i=this.graph.nodeByFile.get(u);return(y.selectedSeverities.size===0||[...y.selectedSeverities].some($=>i.severitySet?.has($)))&&(y.selectedColors.size===0||[...y.selectedColors].some($=>i.colorSet?.has($)))})})}renderControls(){return O`<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?O`<button @click="${()=>{this.expanded.clear(),this.selection=null,this.dirty=!0,this.requestUpdate()}}">Collapse all</button>`:null} ${this.neighborhood?O`<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 O`<div class="matrix-layout"><div class="matrix-stage" style="${`--matrix-label-width: ${196}px`}"><select class="matrix-order" aria-label="Matrix order" @change="${r=>{this.order=r.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="${r=>this.key(r)}" @pointermove="${r=>this.move(r)}" @pointerleave="${()=>{this.drag||(this.hover=null,this.requestUpdate())}}" @pointerdown="${r=>{r.button===0&&(this.canvas.setPointerCapture(r.pointerId),this.drag={x:r.clientX,y:r.clientY,ox:this.view.x,oy:this.view.y,moved:!1})}}" @pointercancel="${()=>{this.drag=null}}" @pointerup="${r=>{if(this.drag){if(!this.drag.moved){let a=this.pointer(r);a&&this.select(this.model.rows[a.row].id,a.col===null?null:this.model.rows[a.col].id,!1)}this.drag=null}}}" @dblclick="${r=>{let a=this.pointer(r);a&&this.expand(this.model.rows[a.row].pkg)}}"></canvas>${o&&(!t||n>0)?O`<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">${Fn(this.model,this.graph,this.selection,{select:(r,a)=>this.select(r,a),expand:r=>this.expand(r),expanded:this.expanded,neighborhood:this.neighborhood,focus:r=>{this.neighborhood=this.neighborhood===r?null:r,this.dirty=!0,this.requestUpdate()},clear:()=>{this.selection=null,this.requestUpdate()}})}</aside></div>`}};customElements.define("dependency-matrix",yo);var Hn=`:host{display:inline-flex;flex-shrink:0;vertical-align:middle;--switch-track-width: 26px;--switch-track-height: 14px}button{display:inline-flex;align-items:center;gap:8px;box-sizing:border-box;height:30px;margin:0;padding:0 .6rem;border:1px solid var(--border);border-radius:4px;background:transparent;color:var(--muted);font:inherit;font-size:.78rem;font-weight:500;line-height:1;white-space:nowrap;cursor:default;&: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}}.track{position:relative;flex-shrink:0;width:var(--switch-track-width);height:var(--switch-track-height);background:var(--border);border-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]) button{height:100%;border:0;border-radius:0}:host([compact]){--switch-track-width: 22px;--switch-track-height: 12px}:host([compact]) button{height:auto;gap:7px;padding:2px 8px;border-radius:6px;font-size:.68rem;line-height:1.2}
11
- `;var wo=class extends ut{static properties={checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},label:{type:String},accessibleLabel:{type:String,attribute:"accessible-label"}};static styles=Ue(Hn);constructor(){super(),this.checked=!1,this.disabled=!1,this.label="",this.accessibleLabel=""}render(){return O`<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>`}};customElements.get("mode-switch")||customElements.define("mode-switch",wo);var ko=class extends ut{static properties={graph:{attribute:!1},options:{attribute:!1},matrixControls:{state:!0}};static styles=[Ue(Uo),Ue(Do),Ue(Ho),Ue(Mt)];constructor(){super(),this.graph=null,this.options={},this.matrixControls=null}connectedCallback(){super.connectedCallback(),Ln(this.renderRoot)}willUpdate(){(!this.options.showBundleLayouts||y.bundleLayout!=="matrix")&&(this.matrixControls=null)}updated(){this.toggleAttribute("matrix",!!this.options.showBundleLayouts&&y.bundleLayout==="matrix")}render(){return this.graph?this.options.showBundleLayouts&&y.bundleLayout==="matrix"?O`<div class="graph2-layout g2-matrix-layout">${fo(this.graph,this.options,this.matrixControls)}<dependency-matrix .graph="${this.graph}" @matrix-controls-change="${t=>{this.matrixControls=t.detail}}"></dependency-matrix></div>`:O`<div class="graph2-layout">${fo(this.graph,this.options)} ${xn(this.graph)} ${yn()}</div>`:O``}};customElements.define("graph-layout",ko);function ci(e){let t=new Map;for(let[o,n]of e.importsOf){let r=e.nodeByFile.get(o);if(r)for(let a of n){let l=e.nodeByFile.get(a);l&&r.pkg!==l.pkg&&(t.set(r.pkg,(t.get(r.pkg)??0)+1),t.set(l.pkg,(t.get(l.pkg)??0)+1))}}return t}function di(e){if(e.packages.length===0)return null;let t=new Set;for(let[o,n]of e.importedBy){let r=e.nodeByFile.get(o);if(r)for(let a of n){let l=e.nodeByFile.get(a);if(l&&l.pkg!==r.pkg){t.add(r.pkg);break}}}for(let o of e.packages)if(!t.has(o))return o;return null}var ui=5;function Dn(e,t){let o=new Map;for(let a of e.nodes)t.has(a.pkg)&&(o.has(a.pkg)||o.set(a.pkg,[]),o.get(a.pkg).push(a));for(let a of o.values())a.sort((l,g)=>l.isHub!==g.isHub?l.isHub?-1:1:g.deg-l.deg);let n=new Map,r=new Map;for(let[a,l]of t){let g=o.get(a);if(!g||g.length===0)continue;let p=g.length,d=0;for(let x of g)if(x.isHub)d++;else break;let u=d>0&&d<=ui,i=u?d:0,$=p-i,w=l.groupR,m=Array.from({length:p}),S=Array.from({length:p});for(let x=0;x<p;x++){let _=x*137.508*Math.PI/180,h;if(x<i)h=i<=1?0:Math.sqrt(x/(i-1))*.3*w;else{let k=x-i;h=$<=1?.4*w:(.4+Math.sqrt(k/($-1))*.6)*w}m[x]=l.x+Math.cos(_)*h,S[x]=l.y+Math.sin(_)*h}let s=Array.from({length:p},()=>!1);for(let x=0;x<p;x++){let _=g[x],h,k;u&&_.isHub?(k=0,h=i):u?(k=i,h=p):(k=0,h=p);let v=0,P=0,z=0,V=e.importsOf.get(_.file);if(V)for(let T of V){let F=n.get(T);F!==void 0&&(v+=F,P+=r.get(T),z++)}let L=e.importedBy.get(_.file);if(L)for(let T of L){let F=n.get(T);F!==void 0&&(v+=F,P+=r.get(T),z++)}let c=!1;if(z>0){v/=z,P/=z;let T=v-l.x,F=P-l.y;T*T+F*F>1&&(c=!0)}let R=-1;if(c){let T=1/0;for(let F=k;F<h;F++){if(s[F])continue;let f=m[F]-v,M=S[F]-P,I=f*f+M*M;I<T&&(T=I,R=F)}}else for(let T=k;T<h;T++)if(!s[T]){R=T;break}s[R]=!0,_.x=m[R],_.y=S[R],n.set(_.file,_.x),r.set(_.file,_.y)}}}function Un(e,t,o){let n=t/2,r=o/2,a=Math.min(t,o)/2;if(e.packages.length===0)return;let g=di(e),p=ci(e),d=(g?e.packages.filter(f=>f!==g):[...e.packages]).toSorted((f,M)=>{let I=(p.get(M)??0)-(p.get(f)??0);return I!==0?I:(e.pkgCount.get(M)??0)-(e.pkgCount.get(f)??0)}),u=d.length,i;u<=0?i=0:u<=6?i=.65:u<=20?i=.82:i=.95;let $=Math.max(1,Math.sqrt(50/Math.max(1,u))),w=.22,m=.12,S=.04,s=new Map,x;if(g){let f=e.pkgCount.get(g)??0,M=Math.min(w,(.012+Math.sqrt(f)*.004)*$);x=Math.max(u<=6?.4:u<=20?.36:.34,M+m+S),s.set(g,{x:n,y:r,size:f,groupR:M*a})}else u<=1?x=0:u<=6?x=.4:u<=20?x=.32:x=.3;if(u===0){Dn(e,s);return}let _=new Map;for(let f of e.edges){if(!f.cross)continue;let M=e.nodeByFile.get(f.a)?.pkg,I=e.nodeByFile.get(f.b)?.pkg;if(!M||!I||M===I)continue;_.has(M)||_.set(M,new Map),_.has(I)||_.set(I,new Map);let Y=_.get(M),W=_.get(I);Y.set(I,(Y.get(I)??0)+1),W.set(M,(W.get(M)??0)+1)}let h=Math.max(1,Math.min(10,Math.round(Math.sqrt(u)/1.2))),k=Array.from({length:h+1});for(let f=0;f<=h;f++)k[f]=Math.floor(f*f/(h*h)*u);k[h]=u;let v=.2,P=Array.from({length:h}),z=Array.from({length:h});for(let f=0;f<h;f++){let M=k[f],I=k[f+1];P[f]=I-M;let Y=0;for(let W=M;W<I;W++)Y+=e.pkgCount.get(d[W])??0;z[f]=Y}let V=Array.from({length:h});for(let f=0;f<h;f++){let M=(k[f]+k[f+1]-1)/2/Math.max(1,u-1);V[f]=Math.sqrt(Math.max(0,M))}let L=Array.from({length:h});L[0]=V[0];for(let f=1;f<h;f++){let M=P[f-1],I=z[f-1],Y=M>0?I/M:1,W=1+v*Math.sqrt(Math.max(0,Y-1));L[f]=L[f-1]+(V[f]-V[f-1])*W}let c=Array.from({length:h});for(let f=0;f<h;f++)c[f]=L[f]-V[f];let R=Array.from({length:u}),T=Array.from({length:u}),F=0;for(let f=0;f<u;f++){for(;F<h-1&&f>=k[F+1];)F++;let M=f*137.508%360*Math.PI/180,Y=(u<=1?0:Math.sqrt(f/(u-1)))+c[F],W=u===1?g?x:0:x+Y*(i-x);R[f]=n+Math.cos(M)*W*a,T[f]=r+Math.sin(M)*W*a}for(let f=0;f<h;f++){let M=k[f],I=k[f+1],Y=I-M;if(Y===0)continue;let W=Array.from({length:Y},()=>!1);for(let xe=M;xe<I;xe++){let Me=d[xe],B=_.get(Me),Q=0,te=0,K=0;if(B)for(let[de,ce]of B){let ye=s.get(de);ye&&(Q+=ye.x*ce,te+=ye.y*ce,K+=ce)}let q=!1;if(K>0){Q/=K,te/=K;let de=Q-n,ce=te-r;de*de+ce*ce>1&&(q=!0)}let J=-1;if(q){let de=1/0;for(let ce=0;ce<Y;ce++){if(W[ce])continue;let ye=M+ce,Se=R[ye]-Q,De=T[ye]-te,Le=Se*Se+De*De;Le<de&&(de=Le,J=ce)}}else for(let de=0;de<Y;de++)if(!W[de]){J=de;break}W[J]=!0;let ve=M+J,ge=e.pkgCount.get(Me)??0,Te=Math.min(m,(.012+Math.sqrt(ge)*.004)*$);s.set(Me,{x:R[ve],y:T[ve],size:ge,groupR:Te*a})}}Dn(e,s)}function $o(e,t,o){let n=t/2,r=o/2,a=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,i=l<=1?0:Math.sqrt(p/(l-1));d.x=n+Math.cos(u)*i*.85*a,d.y=r+Math.sin(u)*i*.85*a}}function Mo(e,t,o,n,{groupOf:r=Pt}={}){let a=e.length,l=n||760,g=o||1100,p=Math.sqrt(g*l/Math.max(a,1))*1.1,d=v=>{let P=0;for(let z of v)P=P*31+z.codePointAt(0)|0;return P},u=Math.ceil(Math.sqrt(a*g/l)),i=Math.ceil(a/u),$=l/(i+1),w=g/(u+1),m=e.map((v,P)=>{let z=P%u,V=Math.floor(P/u),L=d(v);return{file:v,x:(z+1)*w+(L%100-50)*w*.4,y:(V+1)*$+((L>>7)%100-50)*$*.4,dx:0,dy:0}}),S=new Map(m.map((v,P)=>[v.file,P])),s=[];for(let v of e)for(let P of t.get(v)??[])S.has(P)&&s.push([S.get(v),S.get(P)]);let x=new Map;for(let v=0;v<a;v++){let P=r(m[v].file)??"__own__";x.has(P)||x.set(P,[]),x.get(P).push(v)}let _=Math.min(500,Math.max(180,100+a*3)),h=Math.min(g,l)/6,k=.3;for(let v=0;v<_;v++){let P=h*Math.pow(k/h,v/_);for(let L of m)L.dx=0,L.dy=0;for(let L=0;L<a;L++)for(let c=L+1;c<a;c++){let R=m[L],T=m[c],F=R.x-T.x,f=R.y-T.y,M=Math.sqrt(F*F+f*f);if(M<.01){let Y=d(R.file+T.file);F=(Y%100-50)*.01||.5,f=((Y>>7)%100-50)*.01||.5,M=Math.sqrt(F*F+f*f)}let I=p*p/M;R.dx+=F/M*I,R.dy+=f/M*I,T.dx-=F/M*I,T.dy-=f/M*I}for(let[L,c]of s){let R=m[L],T=m[c],F=R.x-T.x,f=R.y-T.y,M=Math.sqrt(F*F+f*f)||.01,I=M*M/p;R.dx-=F/M*I,R.dy-=f/M*I,T.dx+=F/M*I,T.dy+=f/M*I}let z=.055*Math.min(1,P/(h*.3));for(let[,L]of x){if(L.length<2)continue;let c=0,R=0;for(let T of L)c+=m[T].x,R+=m[T].y;c/=L.length,R/=L.length;for(let T of L)m[T].dx+=(c-m[T].x)*z,m[T].dy+=(R-m[T].y)*z}let V=50;for(let L of m){let c=Math.sqrt(L.dx*L.dx+L.dy*L.dy)||.01;L.x+=L.dx/c*Math.min(c,P),L.y+=L.dy/c*Math.min(c,P),L.x=Math.max(V,Math.min(g-V,L.x)),L.y=Math.max(V,Math.min(l-V,L.y))}}return m}function So(e,t,o,{statsHeight:n=0,left:r=0,right:a=r,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-r-a),i=Math.max(1,o-d*2-n-l-g),$=-1/0,w=-1/0,m=1/0,S=1/0;for(let x of e)m=Math.min(m,x.x),$=Math.max($,x.x),S=Math.min(S,x.y),w=Math.max(w,x.y);if(e.length===0)return{k:1,tx:t/2,ty:(o-n)/2};let s=Math.min(4,u/Math.max(20,$-m),i/Math.max(20,w-S));return{k:s,tx:p+r+u/2-(m+$)/2*s,ty:d+l+i/2-(S+w)/2*s}}function Gt(e,t,o=!1){let n=o?t:1;return{min:t,max:n*9.99,percent:Math.round(e/n*100)}}function Vn(e,t,o,{width:n=900,rowHeight:r=52,gap:a=42}={}){let l=new Map(e.map(h=>[h.id,h])),g=new Map,p=[];for(let h of o)l.has(h)&&!g.has(h)&&(g.set(h,0),p.push(h));for(let h=0;h<p.length;h++){let k=p[h];for(let v of t.get(k)??[])!l.has(v)||g.has(v)||(g.set(v,g.get(k)+1),p.push(v))}let d=new Map;for(let h of e){let k=g.get(h.id)??null;d.has(k)||d.set(k,[]),d.get(k).push(h)}let u=new Map(e.map(h=>[h.id,[]]));for(let[h,k]of t)if(l.has(h))for(let v of new Set(k))u.get(v)?.push(h);let i=[],$=new Map,w=[...d.keys()].toSorted((h,k)=>(h??1/0)-(k??1/0)),m=h=>Number.isFinite(h.size)&&h.size>0?h.size:0;for(let h of w){let k=d.get(h).slice(),v=new Map(k.map(c=>{let R=u.get(c.id).map(T=>$.get(T)).filter(T=>T&&h!==null&&T.level===h-1);return[c.id,R.length>0?R.reduce((T,F)=>T+F.x+F.width/2,0)/R.length:n/2]}));k.sort((c,R)=>v.get(c.id)-v.get(R.id)||String(c.id).localeCompare(String(R.id)));let P=0;for(let c=1;c<k.length;c++)m(k[c])>m(k[P])&&(P=c);P>0&&k.unshift(k.splice(P,1)[0]);let z=k.reduce((c,R)=>c+m(R),0),V=i.length*(r+a),L=0;for(let c of k){let R=n*(z>0?m(c)/z:1/k.length);$.set(c.id,{id:c.id,level:h,x:L,y:V,width:R,height:r}),L+=R}i.push({level:h,y:V,size:z,proportional:z>0,ids:k.map(c=>c.id)})}let S=[];for(let[h,k]of t)if($.has(h))for(let v of new Set(k))h!==v&&$.has(v)&&S.push({from:h,to:v});S.sort((h,k)=>String(h.from).localeCompare(String(k.from))||String(h.to).localeCompare(String(k.to)));let s=new Map,x=new Map;for(let h of S)x.has(h.from)||x.set(h.from,[]),s.has(h.to)||s.set(h.to,[]),x.get(h.from).push(h),s.get(h.to).push(h);for(let h of x.values())h.sort((k,v)=>$.get(k.to).x-$.get(v.to).x);for(let h of s.values())h.sort((k,v)=>$.get(k.from).x-$.get(v.from).x);for(let h of x.values())h.forEach((k,v)=>{k.sourcePort=(v+1)/(h.length+1)});for(let h of s.values())h.forEach((k,v)=>{k.targetPort=(v+1)/(h.length+1)});let _=i.reduce((h,k)=>h+k.size,0);for(let h of i)h.share=_>0?h.size/_:null;return{levels:i,rects:$,edges:S,depth:g,totalSize:_,width:n,height:i.length>0?i.length*(r+a)-a:0,gap:a}}function pi(e){let t=[1,3,5].map(n=>{let r=parseInt(e.slice(n,n+2),16)/255;return r<=.04045?r/12.92:((r+.055)/1.055)**2.4});return t[0]*.2126+t[1]*.7152+t[2]*.0722>.18?"#000":"#fff"}function Gn(e,t,{theme:o,scale:n,colorOf:r,labelOf:a,sizeLabel:l,dimmed:g,selected:p,hovered:d}){let u=d??p,i=new Set([u]);for(let m of t.edges)m.from===u&&i.add(m.to),m.to===u&&i.add(m.from);let $=m=>m===u||m===p?1:g(m)?.13:u&&!i.has(m)?.22:1;e.save(),e.lineJoin="round";for(let m of t.edges){let S=t.rects.get(m.from),s=t.rects.get(m.to),x=m.from===u||m.to===u;e.globalAlpha=Math.min($(m.from),$(m.to))*(x?.9:.5),e.strokeStyle=r(m.from),e.fillStyle=r(m.from),e.lineWidth=(x?1.6:1)/n;let _=S.x+S.width*m.sourcePort,h=S.y+S.height,k=s.x+s.width*m.targetPort,v=s.y,P=0,z=1;if(e.beginPath(),e.moveTo(_,h),s.y>S.y){let L=(h+v)/2;e.bezierCurveTo(_,L,k,L,k,v)}else if(s.y===S.y){v=s.y+s.height;let L=h+t.gap*.65;e.bezierCurveTo(_,L,k,L,k,v),z=-1}else{k=s.x+s.width,v=s.y+s.height*m.targetPort;let L=t.width+16+m.sourcePort*20;e.bezierCurveTo(_,h+t.gap/2,L,h+t.gap/2,L,h),e.lineTo(L,v+8),e.quadraticCurveTo(L,v,k,v),P=-1,z=0}e.stroke();let V=3/n;e.beginPath(),e.moveTo(k,v),e.lineTo(k-P*V-z*V,v-z*V+P*V),e.lineTo(k-P*V+z*V,v-z*V-P*V),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 w=o.edgeIntra(.16);for(let m of t.levels){let s=m.y+26,x=18;e.strokeStyle=w,e.lineWidth=3,e.beginPath(),e.arc(-112,s,x,0,Math.PI*2),e.stroke(),m.share!==null&&m.share>0&&(e.strokeStyle=o.labelDefault,e.beginPath(),e.arc(-112,s,x,-Math.PI/2,-Math.PI/2+m.share*Math.PI*2),e.stroke()),e.textAlign="center",e.font="9px system-ui, sans-serif";let _=m.share===null?"\u2014":m.share>0&&m.share<.001?"<0.1%":`${Number((m.share*100).toFixed(1))}%`;e.fillText(_,-112,s),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:S,x:s,y:x,width:_,height:h}=m;if(_<=0)continue;let k=r(S),v=pi(k);if(e.globalAlpha=$(S),e.fillStyle=k,e.fillRect(s,x,_,h),e.strokeStyle=o.bg,e.lineWidth=1/n,e.strokeRect(s,x,_,h),S===p||S===d){e.strokeStyle=o.selectRing,e.lineWidth=1.5/n;let P=Math.min(_/2,.75/n);e.strokeRect(s+P,x+P,Math.max(0,_-P*2),h-P*2)}_*n<28||(e.save(),e.beginPath(),e.rect(s+7,x+4,Math.max(0,_-14),h-8),e.clip(),e.fillStyle=v,e.font="500 12px system-ui, sans-serif",e.fillText(a(S),s+9,x+21),e.fillStyle=v,e.font="10px system-ui, sans-serif",e.fillText(l(S),s+9,x+38),e.restore())}e.restore()}function jn(e,t,o=[],{width:n=1200,height:r=800}={}){e=[...new Set(e)].toSorted();let a=new Set(e),l=new Map(e.map(B=>[B,[...new Set(t.get(B)??[])].filter(Q=>Q!==B&&a.has(Q)).toSorted()])),g=new Map(e.map(B=>[B,[]]));for(let[B,Q]of l)for(let te of Q)g.get(te).push(B);let{groups:p,componentOf:d}=mo(e,l),u=p.filter(B=>B.length>1),i=new Set(u.flat()),$=p.map(()=>new Set),w=p.map(()=>0);for(let[B,Q]of l)for(let te of Q){let K=d.get(B),q=d.get(te);K!==q&&!$[K].has(q)&&($[K].add(q),w[q]++)}let m=new Set(o.map(B=>d.get(B)).filter(B=>B!==void 0)),S=p.map(()=>0),s=[],x=new Set,_=B=>{x.has(B)||(x.add(B),s.push(B))};m.forEach(_),w.forEach((B,Q)=>{B||_(Q)});for(let B=0;B<s.length;B++){let Q=s[B];for(let te of $[Q])m.has(te)||(S[te]=Math.max(S[te],S[Q]+1)),--w[te]===0&&_(te)}let h=new Map(e.map(B=>[B,S[d.get(B)]])),k=new Map;for(let B of e){let Q=h.get(B);k.has(Q)||k.set(Q,[]),k.get(Q).push(B)}let v=[...k.keys()].toSorted((B,Q)=>B-Q),P=new Map,z=B=>B.forEach((Q,te)=>P.set(Q,(te+.5)/B.length));for(let B of k.values())z(B);for(let B=0;B<12;B++)for(let Q of B%2?v.toReversed():v){let te=k.get(Q),K=new Map(te.map(q=>{let J=(B%2?l:g).get(q);return[q,J.length>0?J.reduce((ve,ge)=>ve+P.get(ge),0)/J.length:P.get(q)]}));te.sort((q,J)=>K.get(q)-K.get(J)||P.get(q)-P.get(J)||q.localeCompare(J)),z(te)}let V=Math.max(.6,Math.min(2.4,n/Math.max(1,r))),L=Math.max(160,Math.sqrt(e.length*1100*V)),c=Math.max(120,L/V),R=v.at(-1)??0,T=new Map;for(let[B,Q]of k)Q.forEach((te,K)=>{let q=P.get(te)*L,J=(B+.5)/(R+1)*c;T.set(te,{id:te,x:q,y:J+(K%5-2)*9,anchorY:J,vx:0,vy:0,level:B,cycle:i.has(te),degree:l.get(te).length+g.get(te).length})});let F=[];for(let[B,Q]of l)for(let te of Q)F.push({from:B,to:te,cycle:i.has(B)&&d.get(B)===d.get(te)});let f=F.map(B=>{let Q=T.get(B.from),te=T.get(B.to),K=26+Math.sqrt(Math.max(Q.degree,te.degree))*5;return{a:Q,b:te,length:K,strength:.065/Math.sqrt(Math.min(Q.degree,te.degree)||1),cycle:B.cycle}}),M=[...T.values()],I=80;for(let B=0;B<240;B++){let Q=new Map,te=7*(1-B/240)+.15;for(let K=0;K<M.length;K++){let q=M[K];q.fx=(L/2-q.x)*.002,q.fy=(q.anchorY-q.y)*.018,q.gx=Math.floor(q.x/I),q.gy=Math.floor(q.y/I);let J=`${q.gx},${q.gy}`;Q.has(J)||Q.set(J,[]),Q.get(J).push(K)}for(let K=0;K<M.length;K++){let q=M[K];for(let J=q.gx-1;J<=q.gx+1;J++)for(let ve=q.gy-1;ve<=q.gy+1;ve++)for(let ge of Q.get(`${J},${ve}`)??[]){if(ge<=K)continue;let Te=M[ge],de=q.x-Te.x,ce=q.y-Te.y,ye=de*de+ce*ce;if(ye>I*I)continue;ye<.01&&(de=K%2?.1:-.1,ce=.1);let Se=Math.hypot(de,ce),De=Math.min(18,100/Se-100/I+Math.max(0,22-Se)*.6),Le=de/Se*De,dt=ce/Se*De;q.fx+=Le,q.fy+=dt,Te.fx-=Le,Te.fy-=dt}}for(let{a:K,b:q,length:J,strength:ve,cycle:ge}of f){let Te=q.x-K.x,de=q.y-K.y,ce=Math.hypot(Te,de)||1,ye=(ce-J)*ve,Se=Te/ce*ye,De=de/ce*ye;if(K.fx+=Se,K.fy+=De,q.fx-=Se,q.fy-=De,!ge&&de<22){let Le=(22-de)*.018;K.fy-=Le,q.fy+=Le}}for(let K of M){K.vx=(K.vx+K.fx)*.55,K.vy=(K.vy+K.fy)*.55;let q=Math.hypot(K.vx,K.vy)||1,J=Math.min(1,te/q);K.x+=K.vx*J,K.y+=K.vy*J}}let Y=-1/0,W=-1/0,xe=1/0,Me=1/0;for(let B of M)xe=Math.min(xe,B.x),Me=Math.min(Me,B.y),Y=Math.max(Y,B.x),W=Math.max(W,B.y);for(let B of M)B.x+=16-xe,B.y+=16-Me;return{nodes:T,edges:F,depth:h,incoming:g,links:l,cycles:u,roots:new Set(o.filter(B=>a.has(B))),width:M.length>0?Y-xe+32:32,height:M.length>0?W-Me+32:32}}function fi(e){return Math.max(2.5,Math.min(6,4.5*Math.sqrt(e)))}function Xn(e,t,o,{theme:n,viewport:r,width:a,height:l,colorOf:g,dimmed:p,selected:d,hovered:u,query:i}){let{k:$,tx:w,ty:m}=r,S=fi($),s=u??d,x=new Set([s,...t.links.get(s)??[],...t.incoming.get(s)??[]]),_=new Map;for(let[c,R]of t.nodes){let T=o.nodeByFile.get(c);_.set(c,{x:R.x*$+w,y:R.y*$+m,color:g(T.pkg),n:T,p:R,dim:c===s||c===d?1:p(T)?.12:s&&!x.has(c)?.16:1})}e.save();let h=(c,R)=>{let T=_.get(c.from),F=_.get(c.to);if(Math.max(T.x,F.x)<-40||Math.min(T.x,F.x)>a+40||Math.max(T.y,F.y)<-80||Math.min(T.y,F.y)>l+80)return;e.globalAlpha=R?.85:Math.min(T.dim,F.dim)*(s?.12:.22),e.strokeStyle=R?T.color:n.labelDefault,e.lineWidth=R?1.4:.7,e.setLineDash(c.cycle?[3,3]:[]);let f=F.x-T.x,M=F.y-T.y,I=Math.hypot(f,M)||1,Y=f/I,W=M/I,xe=T.x+Y*(S+1),Me=T.y+W*(S+1),B=F.x-Y*(S+3),Q=F.y-W*(S+3),te=c.cycle?Math.min(18,I*.15):0,K=(xe+B)/2-W*te,q=(Me+Q)/2+Y*te;if(e.beginPath(),e.moveTo(xe,Me),e.quadraticCurveTo(K,q,B,Q),e.stroke(),R||$>=.85||o.nodes.length<=50){let J=Math.atan2(Q-q,B-K),ve=R?5:3.5;e.setLineDash([]),e.fillStyle=e.strokeStyle,e.beginPath(),e.moveTo(B,Q),e.lineTo(B-Math.cos(J-.5)*ve,Q-Math.sin(J-.5)*ve),e.lineTo(B-Math.cos(J+.5)*ve,Q-Math.sin(J+.5)*ve),e.closePath(),e.fill()}};for(let c of t.edges)c.from!==s&&c.to!==s&&h(c,!1);for(let c of t.edges)(c.from===s||c.to===s)&&h(c,!0);e.setLineDash([]);let k=new Map,v=c=>{let R=[];for(let T=Math.floor(c.x/64);T<=Math.floor((c.x+c.w)/64);T++)for(let F=Math.floor(c.y/24);F<=Math.floor((c.y+c.h)/24);F++)R.push(`${T},${F}`);return R},P=c=>{for(let R of v(c))k.has(R)||k.set(R,[]),k.get(R).push(c)},z=(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,V=[..._.values()].filter(c=>c.x>=-10&&c.x<=a+10&&c.y>=-10&&c.y<=l+10);for(let c of V)e.globalAlpha=c.dim,e.fillStyle=c.color,e.beginPath(),e.arc(c.x,c.y,S,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,S+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,S+4,0,Math.PI*2),e.stroke()),P({x:c.x-S-2,y:c.y-S-2,w:S*2+4,h:S*2+4});e.font='11px SFMono-Regular, Consolas, "Liberation Mono", monospace',e.textBaseline="top",e.textAlign="center",V.sort((c,R)=>{let T=F=>F.n.file===s?1e9:F.n.file===d?1e8:i&&F.dim===1?1e7:s&&x.has(F.n.file)?1e6:t.roots.has(F.n.file)?1e5:F.n.deg;return T(R)-T(c)});let L=0;for(let c of V){let R=c.n.file===s||c.n.file===d;if(!R&&c.dim<.5||!R&&!i&&!s&&$<1&&L>=24)continue;let T=c.n.label.length>38?`${c.n.label.slice(0,36)}\u2026`:c.n.label,F=e.measureText(T).width+8,f={x:c.x-F/2,y:c.y+S+5,w:F,h:16};f.x<4||f.x+f.w>a-4||f.y+f.h>l-24||!R&&v(f).some(M=>k.get(M)?.some(I=>z(f,I)))||(P(f),L++,e.globalAlpha=.94,e.fillStyle=n.bg,e.fillRect(f.x,f.y-1,f.w,f.h),e.globalAlpha=1,e.fillStyle=R?n.labelSelected:n.labelDefault,e.fillText(T,c.x,f.y))}e.restore()}function qn(e){let t=e.nodes.map(r=>({node:r})),o=new Map(t.map(r=>[r.node.file,r])),n=e.edges.flatMap(r=>{let a=o.get(r.a),l=o.get(r.b);return a&&l?[{edge:r,a,b:l}]:[]});return{nodes:t,edges:n,graph:e,selected:void 0,neighbors:new Set}}function Wn(e,{viewport:t,selected:o,visible:n,dimmed:r,radius:a,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=a(u),d.dimmed=r(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 Yn(e,t,o,n){if(e.paints&&e.edgeOpacity===t&&e.neutral===o&&e.edgeSelected===n)return e.paints;let r=g=>({opacity:Math.max(0,Math.min(255,Math.round(g*255)))/255,neutral:o(g*.7)}),a=n?t*.25:t,l=n?.85:Math.min(.9,t+.5);return e.paints={base:r(a),emphasis:r(l),baseDim:r(Math.min(a,.04)),emphasisDim:r(Math.min(l,.04))},e.edgeOpacity=t,e.neutral=o,e.edgeSelected=n,e.paints}function Kn(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 Zn(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 Jn(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 _o(e,t,o,n,r){return e+o<-2||e-o>n+2||t+o<-2||t-o>r+2}function Qn(e){let o=new Map;for(let[n,r]of e.entries()){let a=Math.floor(r.x/32),l=Math.floor(r.y/32);o.has(a)||o.set(a,new Map);let g=o.get(a);g.has(l)||g.set(l,[]),g.get(l).push({node:r,index:n})}return(n,r,a,l,g,p)=>{let{k:d,tx:u,ty:i}=a,$=(l+6)/d+1e-7,w=(n-u)/d,m=(r-i)/d,S=Math.floor((w-$)/32),s=Math.floor((w+$)/32),x=Math.floor((m-$)/32),_=Math.floor((m+$)/32),h=null,k=1/0,v=1/0;for(let P=S;P<=s;P++){let z=o.get(P);if(z)for(let V=x;V<=_;V++)for(let{node:L,index:c}of z.get(V)??[]){if(!p(L))continue;let R=L.x*d+u-n,T=L.y*d+i-r,F=R*R+T*T,f=g(L)+6;F<f*f&&(F<k||F===k&&c<v)&&(h=L,k=F,v=c)}}return h}}function er(e,t,o,n,r){if(!e||e.key!==t.key)return null;let a=(t.tx-e.tx)*r,l=(t.ty-e.ty)*r;if(!Number.isInteger(a)||!Number.isInteger(l)||!Number.isInteger(a/r)||!Number.isInteger(l/r)||!a&&!l||Math.abs(a)>=o*r||Math.abs(l)>=n*r)return null;let g=a/r,p=l/r,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:a,dy:l,rects:d}}function jt(e,t,o,n,r){return e&&e.rects.every(a=>n<a.x||t>a.x+a.w||r<a.y||o>a.y+a.h)}var gi={critical:"#ff5470",high:"#ff9d4a",medium:"#f4d35e",low:"#67c2ff",high_bug:"#a06c3f",bug:"#7a6d62",informational:"#218bff"},Ao={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"}};function tr(){let e=document.body.classList;return e.contains("theme-pink")?Ao.pink:e.contains("theme-light")?Ao.light:Ao.dark}var or=(e,t)=>e.x0<t.x1&&t.x0<e.x1&&e.y0<t.y1&&t.y0<e.y1;function Ro(e){e.sort((o,n)=>n.prio-o.prio);let t=[];for(let o of e){let n=!1;for(let r of t)if(or(o,r)){n=!0;break}n||t.push(o)}return t}var hi=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 hi[t]}function mi(e,t,o,n){let a=e.querySelector("graph-layout")?.shadowRoot;if(!a)return;let l=a.querySelector("#g2-canvas"),g=a.querySelector("#g2-tooltip"),p=a.querySelector(".graph2-stage"),d=a.querySelector(".g2-stage-stats"),u=a.querySelector("#g2-zoom-pct");if(!l)return;fn();let i=l.getContext("2d"),$=window.devicePixelRatio||1,w=0,m=0,S=0,s={tx:0,ty:0,k:1},x=null,_=0,h=0,k=!0,v=!0,P=new WeakMap,z=null,V=null,L=null,c=()=>t.supportsLayers&&y.bundleLayout==="layers"&&!y.focusedPkg,R=()=>t.supportsLayers&&y.bundleLayout==="dependencies"&&!y.focusedPkg,T=()=>R()&&!gt(t,y.dependencyPackagesView),F=()=>c()||y.bundleLayout==="graph"&&y.packagesView&&(t.canPackagesView??!1)&&!y.focusedPkg,f=null,M=null,I=null;function Y(){if(!I&&(I=Ot(t),c()&&t.layerRoots?.appImports.length>0)){if(!I.byPkg.has("__own__")){let b={file:"__own__",pkg:"__own__",label:"App (source not bundled)",size:null,fileCount:0,totalIssues:0};I.nodes.push(b),I.byPkg.set("__own__",b)}I.importsOf.set("__own__",[...new Set([...I.importsOf.get("__own__")??[],...t.layerRoots.appImports])])}return I}function W(){return Bt(t,y.dependencyPackagesView)}let xe=b=>b==="__own__"?"App":f?.depth.get(b)===0?`App \xB7 ${Ne(b)}`:Ne(b);function Me(b,A,H){if(b.nodes.length>50){$o(b,A,H);return}let N=Mo(b.nodes.map(C=>C.pkg),b.importsOf,A,H,{groupOf:C=>C});B(b.nodes,new Map(N.map(C=>[C.file,C])))}function B(b,A){for(let H of b){let N=A.get(H.file);N&&(H.x=N.x,H.y=N.y)}}function Q(){if(!k)return;if(V=null,L=null,z=null,c()){let C=Y();f=Vn(C.nodes.map(G=>({id:G.pkg,size:G.size})),C.importsOf,t.layerRoots?.roots??["__own__"],{width:Math.max(360,h-190)}),k=!1;return}if(R()){let C=W();M=jn(C.nodes.map(G=>G.file),C.importsOf,C.fileLevel?[]:t.layerRoots?.roots??[],{width:h,height:_}),k=!1;return}let b=y.layoutCache,A=y.focusedPkg,H=F(),N=H?Y().nodes:t.nodes;if(b&&b.files===t.files&&b.w===h&&b.h===_&&b.focused===A&&(b.pkgView??!1)===H)B(N,b.pos);else{if(H)Me(Y(),h,_);else if(A)if(t.nodes.length>50)$o(t,h,_);else{let G=Mo(t.files,t.importsOf,h,_);B(t.nodes,new Map(G.map(ee=>[ee.file,ee])))}else Un(t,h,_);let C=new Map;for(let G of N)C.set(G.file,{x:G.x,y:G.y});y.layoutCache={files:t.files,w:h,h:_,pos:C,focused:A,pkgView:H}}k=!1}function te(){if(R()&&M){if(W().nodes.length<=100){let re=12;i.save(),i.font='11px SFMono-Regular, Consolas, "Liberation Mono", monospace';for(let ie of W().nodes){let X=ie.label.length>38?`${ie.label.slice(0,36)}\u2026`:ie.label;re=Math.max(re,i.measureText(X).width/2+4)}return i.restore(),So([...M.nodes.values()],m,w,{statsHeight:S,left:re,top:12,bottom:27})}let U=Math.max(20,Math.min(m,w)*.04),j=Math.min((m-U*2)/M.width,(w-U*2-S)/M.height,2.5),Z=Math.max(.05,j);return{k:Z,tx:(m-M.width*Z)/2,ty:(w-S-M.height*Z)/2}}if(c()&&f){let U=Math.min((m-24)/(f.width+185),(w-70)/(f.height+f.gap),1.5),j=Math.max(.05,U);return{k:j,tx:(m-(f.width+185)*j)/2+145*j,ty:24+Math.max(0,(w-70-(f.height+f.gap)*j)/2)}}let b=F()?Y().nodes:t.nodes;if(b.length<=50){let U=0,j=0,Z=0;i.save(),i.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace";for(let re of b){let ie=F()?et(re):(re.isHub?6:4)*y.nodeSize,X=ie*1.85+5;j=Math.max(j,X,i.measureText(re.label).width/2+6),Z=Math.max(Z,X),U=Math.max(U,X,ie+4+13+4)}return i.restore(),So(b,m,w,{statsHeight:S,left:j,top:Z,bottom:U})}if(b.length===0)return{k:1,tx:m/2,ty:(w-S)/2};let A=-1/0,H=-1/0,N=1/0,C=1/0;for(let U of b)U.x<N&&(N=U.x),U.y<C&&(C=U.y),U.x>A&&(A=U.x),U.y>H&&(H=U.y);let G=Math.max(20,H-C),ee=Math.max(20,A-N),fe=(N+A)/2,ae=(C+H)/2,ue=Math.max(20,Math.min(m,w)*(y.focusedPkg?.04:.03)),D=Math.min((m-ue*2)/ee,(w-ue*2-S)/G,4),E=Math.max(.05,D);return{k:E,tx:m/2-fe*E,ty:(w-S)/2-ae*E}}function K(){let b=te();s.k=b.k,s.tx=b.tx,s.ty=b.ty}function q(){if(!R()){u&&(u.textContent=`${Math.round(s.k*100)}%`);return}let b=Gt(s.k,te().k,!0);u&&(u.textContent=`${b.percent}%`),Kt&&(Kt.disabled=s.k<=b.min*1.0001),Yt&&(Yt.disabled=s.k>=b.max*.9999)}function J(b,A){return[b*s.k+s.tx,A*s.k+s.ty]}function ve(b,A){return[(b-s.tx)/s.k,(A-s.ty)/s.k]}function ge(b){return!y.hidden.has(b.pkg)}function Te(b,A,H,N,C){let G=H+(N==="critical"?4.2:N==="high"?3.4:2.8),ee=N==="critical"?1.8:N==="high"?1.5:N==="medium"?1.3:1.1;i.strokeStyle=gi[N],i.globalAlpha=C,i.lineWidth=ee,i.beginPath(),i.arc(b,A,G,0,Math.PI*2),i.stroke(),i.globalAlpha=1}function de(b,A,H,N,C,G,ee){let ue=ee?.1:.9,D=2*(1-ue)*(H-b)+2*ue*(C-H),E=2*(1-ue)*(N-A)+2*ue*(G-N),U=Math.sqrt(D*D+E*E)||1,j=D/U,Z=E/U;i.beginPath(),ee?(i.moveTo(b,A),i.lineTo(b+j*7-Z*2.94,A+Z*7+j*2.94),i.lineTo(b+j*7+Z*2.94,A+Z*7-j*2.94)):(i.moveTo(C,G),i.lineTo(C-j*7+Z*2.94,G-Z*7-j*2.94),i.lineTo(C-j*7-Z*2.94,G-Z*7+j*2.94)),i.closePath()}function ce(b){if(y.selectedSeverities.size>0){let H=b.severitySet;if(!H)return!0;let N=!1;for(let C of y.selectedSeverities)if(H.has(C)){N=!0;break}if(!N)return!0}if(y.selectedColors.size>0){let H=b.colorSet;if(!H)return!0;let N=!1;for(let C of y.selectedColors)if(H.has(C)){N=!0;break}if(!N)return!0}if(y.solo&&b.pkg!==y.solo&&!F()&&!T())return!0;let A=y.pathFilter;if(A){let H=A.toLowerCase(),N=b.pathText?b.pathText.includes(H):b.file.toLowerCase().includes(H),C=b.pkg&&b.pkg.toLowerCase().includes(H),G=b.label&&b.label.toLowerCase().includes(H);if(!N&&!C&&!G)return!0}return!1}function ye(b){let A=(b.isHub?4.9:3.5)*y.nodeSize,H=Math.max(.6,Math.min(1.6,s.k));return A*H}function Se(){let b=p.getBoundingClientRect(),A=w,H=m;m=Math.max(80,b.width),w=Math.max(80,b.height),S=d?(parseFloat(getComputedStyle(d).lineHeight)||0)+8:0,$=window.devicePixelRatio||1,l.width=m*$,l.height=w*$,V=null,P.delete(t),I&&P.delete(I),l.style.width=m+"px",l.style.height=w+"px",i.setTransform($,0,0,$,0,0),(h===0||_===0)&&(h=m,_=w,k=!0),Q();let N=H>0&&(Math.abs(m-H)/H>.15||Math.abs(w-A)/A>.15);(v||N)&&(K(),v=!1),Ee()}let De=null,Le=!0,dt=!1,Xt=!1;function Ee(){Le=!0,!(dt||Xt)&&(dt=!0,De=requestAnimationFrame(()=>{dt=!1,Le&&!Xt&&(Le=!1,rr())}))}function rr(){let b=F()?Y():t;if(L?.graph!==b){L={graph:b,x0:1/0,y0:1/0,x1:-1/0,y1:-1/0};for(let ee of b.nodes)L.x0=Math.min(L.x0,ee.x),L.x1=Math.max(L.x1,ee.x),L.y0=Math.min(L.y0,ee.y),L.y1=Math.max(L.y1,ee.y)}let A=ye({isHub:!0})*6+8,N=L.x0*s.k+s.tx>A&&L.y0*s.k+s.ty>A&&L.x1*s.k+s.tx<m-A&&L.y1*s.k+s.ty<w-A&&s.k<=1.4&&b.nodes.length>50&&!c()&&!R(),C={tx:s.tx,ty:s.ty,key:JSON.stringify([s.k,tr().bg,y.nodeSize,y.edgeOpacity,x,y.selected,y.solo,y.focusedPkg,F(),y.showAll,y.pathFilter,[...y.selectedSeverities],[...y.selectedColors],[...y.hidden]])},G=N?er(V,C,m,w,$):null;i.save();try{if(G){i.save(),i.setTransform(1,0,0,1,0,0),i.globalCompositeOperation="copy",i.drawImage(l,G.dx,G.dy),i.restore(),i.beginPath();for(let ee of G.rects)i.rect(ee.x,ee.y,ee.w,ee.h);i.clip()}ir(G),V=N?C:null}finally{i.restore()}}function ir(b){let A=tr();i.fillStyle=A.bg,i.fillRect(0,0,m,w),sr(A);let H=R(),N=F(),C=H?W():N?Y():t,G=T()||N?y.solo:y.selected,ee=G?C.nodeByFile.get(G):null,fe=ee?G:null;if(H){Xn(i,M,C,{theme:A,viewport:s,width:m,height:w,colorOf:he,selected:fe,hovered:x,query:y.pathFilter,dimmed:X=>ce(X)}),q();return}if(c()){i.save(),i.translate(s.tx,s.ty),i.scale(s.k,s.k),Gn(i,f,{theme:A,scale:s.k,selected:fe,hovered:x,colorOf:he,labelOf:xe,sizeLabel:X=>We(typeof X=="number"?X:C.byPkg.get(X).size)||"Size unknown",dimmed:X=>ce(C.byPkg.get(X))}),i.restore(),q();return}if(N&&C.nodes.length<=50){lr(A);return}if(y.focusedPkg&&C.nodes.length<=50){ar(A,fe,ee);return}P.has(C)||P.set(C,qn(C));let ae=P.get(C),ue=JSON.stringify([s.k,s.tx,s.ty,y.nodeSize,A.bg,y.solo,y.pathFilter,[...y.selectedSeverities],[...y.selectedColors],[...y.hidden]]);Wn(ae,{viewport:s,selected:fe,paintKey:ue,visible:ge,dimmed:ce,radius:ye,color:he});let D=Yn(ae,y.edgeOpacity,A.edgeIntra,!!fe),E=fe||x,U=.85/s.k,j=.55/s.k,Z=null,re=null,ie=null;i.save(),i.translate(s.tx,s.ty),i.scale(s.k,s.k);for(let X of ae.edges){let{edge:ne,a:oe,b:le}=X;if(!oe.visible||!le.visible||Jn(oe,le,m,w)||jt(b,Math.min(oe.x,le.x)-2,Math.min(oe.y,le.y)-2,Math.max(oe.x,le.x)+2,Math.max(oe.y,le.y)+2))continue;let be=E&&(ne.a===E||ne.b===E),pe=oe.dimmed&&le.dimmed?be?D.emphasisDim:D.baseDim:be?D.emphasis:D.base,we=ne.cross?Kn(X,i):pe.neutral,ke=ne.cross?pe.opacity:1,Pe=ne.cross?U:j;we!==re&&(i.strokeStyle=we,re=we),ke!==Z&&(i.globalAlpha=ke,Z=ke),Pe!==ie&&(i.lineWidth=Pe,ie=Pe),i.beginPath(),i.moveTo(oe.node.x,oe.node.y),i.lineTo(le.node.x,le.node.y),i.stroke()}i.restore();for(let X of ae.nodes){if(!X.visible)continue;let ne=X.node,oe=ne.file===x,le=ne.file===fe;if(!ne.isHub&&!oe&&!le||X.dimmed&&!oe&&!le)continue;let be=X.radius,pe=X.x,we=X.y,ke=be*(le?6:oe?4.5:3);_o(pe,we,ke,m,w)||jt(b,pe-ke-2,we-ke-2,pe+ke+2,we+ke+2)||(i.fillStyle=Zn(X,ke,i),i.beginPath(),i.arc(pe,we,ke,0,Math.PI*2),i.fill())}for(let X of ae.nodes){if(!X.visible)continue;let ne=X.node,oe=X.radius,le=X.x,be=X.y;if(_o(le,be,oe+6,m,w)||jt(b,le-oe-8,be-oe-8,le+oe+8,be+oe+8))continue;let pe=1,we=fe&&ne.file===fe;fe&&!we&&(pe=ae.neighbors.has(ne.file)?1:.25),!we&&X.dimmed&&(pe=Math.min(pe,.1)),i.fillStyle=X.color+Ge(pe),i.beginPath(),i.arc(le,be,oe,0,Math.PI*2),i.fill(),ne.isHub&&(i.strokeStyle=A.hubRing(.55*pe),i.lineWidth=.8,i.stroke()),ne.issue&&Te(le,be,oe,ne.issue,pe)}if(s.k>1.4){let ne=0;if(s.k<9&&!y.showLabels)for(let le of C.nodes){if(!ge(le))continue;let[be,pe]=J(le.x,le.y);if(!(be<0||be>m||pe<0||pe>w)&&(ne++,ne>=50))break}let oe=s.k>=9||ne<50;if(y.showLabels||oe){i.font="10px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",i.fillStyle=A.labelFill,i.textAlign="left",i.textBaseline="middle";let le=11,be=2,pe=250,we=(se,$e)=>se>-pe&&se<m+pe&&$e>-pe&&$e<w+pe,ke=[];for(let se of C.nodes){if(!ge(se))continue;let[$e,_e]=J(se.x,se.y);if(!we($e,_e))continue;let Ae=ye(se);ke.push({file:se.file,x0:$e-Ae,x1:$e+Ae,y0:_e-Ae,y1:_e+Ae})}let Pe=[];for(let se of C.nodes){if(!ge(se)||!se.isHub&&s.k<2.4)continue;let[$e,_e]=J(se.x,se.y);if(!we($e,_e))continue;let Ae=ye(se),Ie=$e+Ae+4,Re=_e+1,ze=i.measureText(se.label).width+be,Oe=se.file===fe,je=se.file===x,Ke=Oe?3:je?2:se.isHub?1:0;Pe.push({file:se.file,n:se,tx:Ie,ty:Re,prio:Ke,x0:Ie-be,x1:Ie+ze,y0:Re-le/2,y1:Re+le/2})}let Ye=Ro(Pe.filter(se=>!ke.some($e=>$e.file!==se.file&&or(se,$e))));for(let se of Ye)i.fillText(se.n.label,se.tx,se.ty)}}if(ee&&ge(ee)){let[X,ne]=J(ee.x,ee.y),oe=ye(ee);i.strokeStyle=A.selectRing,i.lineWidth=1.5,i.beginPath(),i.arc(X,ne,oe+5,0,Math.PI*2),i.stroke()}q()}function sr(b){if(s.k<.4)return;let A=80,H=(s.tx%A+A)%A,N=(s.ty%A+A)%A;i.strokeStyle=b.grid,i.lineWidth=1,i.beginPath();for(let C=H;C<m;C+=A)i.moveTo(C,0),i.lineTo(C,w);for(let C=N;C<w;C+=A)i.moveTo(0,C),i.lineTo(m,C);i.stroke()}function ar(b,A,H){let N=he(y.focusedPkg),C=b.hubRing(.55),G=new Set;if(x){G.add(x);for(let E of t.adj.get(x)??[]){let U=t.edges[E];G.add(U.a),G.add(U.b)}}let ee=E=>(E.isHub?6:4)*y.nodeSize;for(let E of t.edges){let U=t.nodeByFile.get(E.a),j=t.nodeByFile.get(E.b);if(!U||!j||!ge(U)||!ge(j))continue;let Z=E.fromLo&&E.fromHi,re=!Z&&E.fromHi,ie=re?j:U,X=re?U:j,ne=x&&(E.a===x||E.b===x),oe=A&&(E.a===A||E.b===A),le=(A||x)&&!ne&&!oe,be=ee(ie),pe=ee(X),[we,ke]=J(ie.x,ie.y),[Pe,Ye]=J(X.x,X.y),se=Pe-we,$e=Ye-ke,_e=Math.sqrt(se*se+$e*$e)||1,Ae=se/_e,Ie=$e/_e,Re=we+Ae*(be+1.5),ze=ke+Ie*(be+1.5),Oe=Pe-Ae*(pe+3.5),je=Ye-Ie*(pe+3.5),Ke=Math.min(_e*.15,30),tt=(Re+Oe)/2-Ie*Ke,Fe=(ze+je)/2+Ae*Ke;i.beginPath(),i.moveTo(Re,ze),i.quadraticCurveTo(tt,Fe,Oe,je);let Ve;oe?Ve=.9:ne?Ve=.85:le?Ve=.05:Ve=Math.min(.85,y.edgeOpacity*3),i.strokeStyle=N+Ge(Ve),i.lineWidth=oe||ne?1.5:.85,i.stroke(),!le&&(de(Re,ze,tt,Fe,Oe,je,!1),i.fillStyle=N+Ge(Math.min(1,Ve+.15)),i.fill(),Z&&(de(Re,ze,tt,Fe,Oe,je,!0),i.fill()))}for(let E of t.nodes){if(!ge(E))continue;let[U,j]=J(E.x,E.y),Z=ee(E),re=E.file===x,ie=E.file===A,X=(A||x)&&!G.has(E.file)&&!ie?.15:1;if(i.globalAlpha=X,ie||re||E.isHub){let ne=Z*(ie?4:re?3:2.4),oe=i.createRadialGradient(U,j,Z*.6,U,j,ne);oe.addColorStop(0,N+Ge(ie?.4:.25)),oe.addColorStop(1,N+"00"),i.fillStyle=oe,i.beginPath(),i.arc(U,j,ne,0,Math.PI*2),i.fill()}i.fillStyle=N,i.beginPath(),i.arc(U,j,Z,0,Math.PI*2),i.fill(),E.isHub&&(i.strokeStyle=C,i.lineWidth=.9,i.stroke()),E.issue&&Te(U,j,Z,E.issue,X),i.globalAlpha=1}i.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",i.textAlign="center",i.textBaseline="top",i.lineJoin="round";let fe=13,ae=2,ue=[];for(let E of t.nodes){if(!ge(E))continue;let[U,j]=J(E.x,E.y),Z=ee(E),re=j+Z+4,ie=i.measureText(E.label).width/2+ae,X=E.file===A,ne=E.file===x,oe=X?3:ne?2:E.isHub?1:0;ue.push({n:E,sx:U,ty:re,halfW:ie,isSel:X,isHov:ne,prio:oe,x0:U-ie,x1:U+ie,y0:re,y1:re+fe})}let D=Ro(ue);for(let E of D){let{n:U,sx:j,ty:Z,isSel:re,isHov:ie}=E,X=(A||x)&&!G.has(U.file)&&!re?.2:1;i.globalAlpha=X,i.shadowColor=b.labelShadow,i.shadowBlur=4,i.strokeStyle=b.labelOutline,i.lineWidth=3,i.strokeText(U.label,j,Z),i.shadowBlur=0,i.fillStyle=re?b.labelSelected:ie?b.labelHover:b.labelDefault,i.fillText(U.label,j,Z),i.globalAlpha=1}if(H&&ge(H)){let[E,U]=J(H.x,H.y),j=ee(H);i.strokeStyle=b.selectRing,i.lineWidth=1.8,i.beginPath(),i.arc(E,U,j+4,0,Math.PI*2),i.stroke()}q()}function et(b){return Math.min(26,5+Math.sqrt(b.fileCount)*1.7)*y.nodeSize}function lr(b){let A=Y(),H=y.solo&&A.byPkg.has(y.solo)?y.solo:null,N=x??H,C=new Set;if(N){C.add(N);for(let D of A.edges)D.a===N?C.add(D.b):D.b===N&&C.add(D.a)}let G=D=>{if(D.pkg===H||D.pkg===x)return 1;let E=1;return N&&!C.has(D.pkg)&&(E=.2),ce(D)&&(E=Math.min(E,.1)),E};for(let D of A.edges){let E=A.byPkg.get(D.a),U=A.byPkg.get(D.b);if(!E||!U||!ge(E)||!ge(U))continue;let j=D.fromLo&&D.fromHi,Z=!j&&D.fromHi,re=Z?U:E,ie=Z?E:U,X=N!==null&&(D.a===N||D.b===N),ne=ce(E)&&ce(U),oe=N!==null&&!X||ne,le=et(re),be=et(ie),[pe,we]=J(re.x,re.y),[ke,Pe]=J(ie.x,ie.y),Ye=ke-pe,se=Pe-we,$e=Math.sqrt(Ye*Ye+se*se)||1,_e=Ye/$e,Ae=se/$e,Ie=pe+_e*(le+1.5),Re=we+Ae*(le+1.5),ze=ke-_e*(be+3.5),Oe=Pe-Ae*(be+3.5),je=Math.min($e*.15,30),Ke=(Ie+ze)/2-Ae*je,tt=(Re+Oe)/2+_e*je,Fe;ne?Fe=.05:X?Fe=.9:oe?Fe=.06:Fe=.5;let Ve=i.createLinearGradient(Ie,Re,ze,Oe);Ve.addColorStop(0,he(re.pkg)+Ge(Fe)),Ve.addColorStop(1,he(ie.pkg)+Ge(Fe)),i.beginPath(),i.moveTo(Ie,Re),i.quadraticCurveTo(Ke,tt,ze,Oe),i.strokeStyle=Ve,i.lineWidth=Math.min(3.5,.8+Math.sqrt(D.count)*.3)*(X?1.3:1),i.stroke(),!oe&&(de(Ie,Re,Ke,tt,ze,Oe,!1),i.fillStyle=he(ie.pkg)+Ge(Math.min(1,Fe+.15)),i.fill(),j&&(de(Ie,Re,Ke,tt,ze,Oe,!0),i.fillStyle=he(re.pkg)+Ge(Math.min(1,Fe+.15)),i.fill()))}for(let D of A.nodes){if(!ge(D))continue;let[E,U]=J(D.x,D.y),j=et(D),Z=D.pkg===x,re=D.pkg===H,ie=he(D.pkg),X=G(D);if(re||Z){let ne=j*(re?2.6:2.2),oe=i.createRadialGradient(E,U,j*.6,E,U,ne);oe.addColorStop(0,ie+Ge(re?.4:.25)),oe.addColorStop(1,ie+"00"),i.fillStyle=oe,i.beginPath(),i.arc(E,U,ne,0,Math.PI*2),i.fill()}i.fillStyle=ie+Ge(X),i.beginPath(),i.arc(E,U,j,0,Math.PI*2),i.fill(),D.issue&&Te(E,U,j,D.issue,X)}i.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",i.textAlign="center",i.textBaseline="top",i.lineJoin="round";let ee=13,fe=2,ae=[];for(let D of A.nodes){if(!ge(D))continue;let[E,U]=J(D.x,D.y),j=et(D),Z=U+j+4,re=i.measureText(D.label).width/2+fe,ie=D.pkg===H,X=D.pkg===x,ne=ie?1/0:X?1e9:D.fileCount;ae.push({p:D,sx:E,ty:Z,isSel:ie,isHov:X,prio:ne,x0:E-re,x1:E+re,y0:Z,y1:Z+ee})}let ue=Ro(ae);for(let D of ue){let{p:E,sx:U,ty:j,isSel:Z,isHov:re}=D;i.globalAlpha=Math.max(.25,G(E)),i.shadowColor=b.labelShadow,i.shadowBlur=4,i.strokeStyle=b.labelOutline,i.lineWidth=3,i.strokeText(E.label,U,j),i.shadowBlur=0,i.fillStyle=Z?b.labelSelected:re?b.labelHover:b.labelDefault,i.fillText(E.label,U,j),i.globalAlpha=1}if(H){let D=A.byPkg.get(H),[E,U]=J(D.x,D.y);i.strokeStyle=b.selectRing,i.lineWidth=1.8,i.beginPath(),i.arc(E,U,et(D)+4,0,Math.PI*2),i.stroke()}q()}function To(b,A){if(R()){let[ae,ue]=ve(b,A),D=null,E=1/0;for(let[U,j]of M.nodes){let Z=(j.x-ae)**2+(j.y-ue)**2;Z<E&&Z<(14/Math.max(s.k,.1))**2&&(E=Z,D=W().nodeByFile.get(U))}return D}if(c()){let[ae,ue]=ve(b,A);for(let D of f.rects.values())if(D.width>0&&ae>=D.x&&ae<D.x+D.width&&ue>=D.y&&ue<=D.y+D.height)return Y().byPkg.get(D.id);return null}let H=F(),N=H?Y():t,C=H&&N.nodes.length<=50;if(N.nodes.length>50){z??=Qn(N.nodes);let ae=4.9*y.nodeSize*Math.max(.6,Math.min(1.6,s.k));return z(b,A,s,ae,ye,ge)}let G=null,ee=1/0,fe=6;for(let ae of N.nodes){if(!ge(ae))continue;let[ue,D]=J(ae.x,ae.y),E=ue-b,U=D-A,j=E*E+U*U,Z=(C?et(ae):ye(ae))+fe;j<Z*Z&&j<ee&&(ee=j,G=ae)}return G}function cr(b,A,H){if(!g)return;let N=he(b.pkg),C=Ne(b.pkg),G=Ft(b.file,b.pkg);ot(O`<div class="g2-tt-path">${G}</div><div class="g2-tt-head"><span class="g2-tt-dot" style="${`background:${N}`}"></span> <span class="g2-tt-pkg">${C}</span></div>${b.totalIssues>0?lt(b.own):null}`,g),Io(A,H)}function dr(b,A,H){if(!g)return;let N=he(b.pkg),C=We(b.size);ot(O`<div class="g2-tt-path">${c()?xe(b.pkg):b.label}</div>${R()?O`<div class="g2-tt-pkg">${W().importedBy.get(b.pkg).length} importers · ${W().importsOf.get(b.pkg)?.length??0} dependencies</div>`:null} ${c()?O`<div class="g2-tt-pkg">${f.depth.has(b.pkg)?`Level ${f.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:${N}`}"></span> <span class="g2-tt-pkg">${b.fileCount} ${b.fileCount===1?"file":"files"}${C?` \xB7 ${C}`:""}</span></div>${b.totalIssues>0?lt(b.own):null}`,g),Io(A,H)}function Io(b,A){let H=p.getBoundingClientRect();g.classList.add("show");let N=g.offsetWidth,C=g.offsetHeight,G=b-H.left,ee=A-H.top,fe=H.width,ae=H.height,ue=12,D=G+ue;D+N>fe-4&&(D=G-N-ue),D<4&&(D=4);let E=ee+ue;E+C>ae-4&&(E=ee-C-ue),E<4&&(E=4),g.style.left=`${D}px`,g.style.top=`${E}px`}function qt(){g&&g.classList.remove("show")}let $t=!1,mt=null,Wt=!1,Co=b=>{b.button===0&&(b.target.closest(".g2-stage-overlay, .g2-stage-overlay-tr, .g2-zoom-ctrl")||($t=!0,Wt=!1,mt={x:b.clientX,y:b.clientY,tx:s.tx,ty:s.ty}))},Lo=b=>{let A=p.getBoundingClientRect(),H=b.clientX-A.left,N=b.clientY-A.top;if($t){let ee=b.clientX-mt.x,fe=b.clientY-mt.y;Math.abs(ee)+Math.abs(fe)>3&&(Wt=!0),s.tx=mt.tx+ee,s.ty=mt.ty+fe,qt(),Ee();return}let C=To(H,N),G=x;x=C?.file??null,l.style.cursor=C?"default":"grab",C?F()||T()?dr(C,b.clientX,b.clientY):cr(C,b.clientX,b.clientY):G&&qt(),x!==G&&Ee()},Eo=b=>{if($t&&!Wt){let A=p.getBoundingClientRect(),H=b.clientX-A.left,N=b.clientY-A.top,C=To(H,N);F()||T()?(y.solo=C&&y.solo!==C.pkg?C.pkg:null,y.selected=null,o(),n?.()):(y.selected=C?.file??null,o()),Ee()}$t=!1},Po=()=>{let b=x!==null;x=null,qt(),b&&Ee()},zo=b=>{b.preventDefault();let A=p.getBoundingClientRect(),H=b.clientX-A.left,N=b.clientY-A.top,C=Math.exp(-b.deltaY*.0015),G=te();if(C<1&&s.k<=G.k*1.0001){s.k=G.k;let D=Math.min(.4,(1-C)*3);s.tx+=(G.tx-s.tx)*D,s.ty+=(G.ty-s.ty)*D,Ee();return}let[ee,fe]=ve(H,N),ae=Gt(s.k,G.k,R()),ue=Math.max(ae.min,Math.min(ae.max,s.k*C));s.k=ue,s.tx=H-ee*s.k,s.ty=N-fe*s.k,Ee()};p.addEventListener("mousedown",Co),window.addEventListener("mousemove",Lo),window.addEventListener("mouseup",Eo),p.addEventListener("mouseleave",Po),p.addEventListener("wheel",zo,{passive:!1});function Oo(b){let A=Gt(s.k,te().k,R());b=Math.max(A.min,Math.min(A.max,b));let H=m/2,N=w/2,[C,G]=ve(H,N);s.k=b,s.tx=H-C*s.k,s.ty=N-G*s.k,Ee()}let Yt=a.querySelector("#g2-zoom-in"),Kt=a.querySelector("#g2-zoom-out"),ur=a.querySelector("#g2-zoom-fit");Yt?.addEventListener("click",()=>Oo(s.k*1.4)),Kt?.addEventListener("click",()=>Oo(s.k/1.4)),ur?.addEventListener("click",()=>{K(),Ee()}),Se();let Fo=new ResizeObserver(()=>Se());Fo.observe(p);let Bo=new MutationObserver(b=>{for(let A of b){let H=(A.oldValue||"").includes("report-fullscreen"),N=document.body.classList.contains("report-fullscreen");if(H!==N){h=0,_=0,k=!0,v=!0,y.layoutCache=null,setTimeout(()=>Se(),80);return}Ee()}});Bo.observe(document.body,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0}),Ee(),y.graphState={requestDraw:Ee,_cleanup:()=>{Xt=!0,cancelAnimationFrame(De),Fo.disconnect(),Bo.disconnect(),p.removeEventListener("mousedown",Co),window.removeEventListener("mousemove",Lo),window.removeEventListener("mouseup",Eo),p.removeEventListener("mouseleave",Po),p.removeEventListener("wheel",zo)}}}function gl(e,t){let o=document.querySelector("graph-layout")?.shadowRoot;if(!o)return;let n=nr(e),r=o.querySelector("#g2-selection-area");r&&ot(kn(n,t),r);let a=o.querySelector("#g2-focus-overlay-slot");a&&ot(vn(n),a)}function hl(e){let t=document.querySelector("graph-layout")?.shadowRoot;if(!t)return;let o=t.querySelector("#g2-top-pkgs-block");o&&ot(wn(nr(e)),o)}function nr(e){let t=bn(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.reasons=e.reasons??[],t}export{Nr as _swapGraph2Impl,mi as attachGraph2Interaction,nr as buildGraphFromPrep,gl as refreshSidebar,hl as refreshTopPkgs};
10
+ `;var yo=class extends ut{static properties={graph:{attribute:!1}};static styles=[Ue(Mt),Ue(Bn),Ue(Nn)];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){this.graph&&(t.has("graph")||this.query!==y.pathFilter||this.dirty)&&(this.query=y.pathFilter,this.model=bo(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=bo(this.graph,{expanded:this.expanded,order:this.order,query:this.query,cyclesOnly:this.cyclesOnly})),this.selection&&!this.model.byId.has(this.selection.from)&&(this.selection=null),this.hover=null,this.dirty=!1,this.needsFit=!0)}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(){y.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),y.graphState===this.bridge&&(y.graphState=null)}clamp(){this.view.cell=vo(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:xo(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,a=vo(i*t,this.model.rows.length,this.width,this.height);this.view.x=(this.view.x+o-196)*a/i-o+196,this.view.y=(this.view.y+n-118)*a/i-n+118,this.view.cell=a,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 zn(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=a=>Math.max(0,Math.min(this.model.rows.length-1,a));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 d=this.model.rows.find(u=>u.pkg===this.revealPkg);this.revealPkg=null,d&&this.select(d.id)}let t=this.canvas.getContext("2d"),o=window.devicePixelRatio||1;t.setTransform(o,0,0,o,0,0);let n=getComputedStyle(this),i=d=>n.getPropertyValue(d).trim(),a=document.body.classList.contains("theme-light")||document.body.classList.contains("theme-pink"),l={bg:i("--graph-canvas-bg")||"#0c0c0c",surface:i("--surface"),text:i("--text"),muted:i("--muted"),border:i("--border"),grid:a?"#0000000b":"#ffffff0b",highlight:a?"#0969da18":"#ffffff12",cycle:a?"#a21caf":"#e879c7"};this.style.setProperty("--matrix-cycle",l.cycle);let g=this.model.index.get(this.selection?.to),p=this.model.index.get(this.selection?.from);On(t,this.model,this.view,{width:this.width,height:this.height,theme:l,colorOf:he,hover:this.hover,selected:p===void 0?null:{row:p,col:g??null},dimmed:d=>!d.files.some(u=>{let r=this.graph.nodeByFile.get(u);return(y.selectedSeverities.size===0||[...y.selectedSeverities].some($=>r.severitySet?.has($)))&&(y.selectedColors.size===0||[...y.selectedColors].some($=>r.colorSet?.has($)))})})}renderControls(){return O`<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?O`<button @click="${()=>{this.expanded.clear(),this.selection=null,this.dirty=!0,this.requestUpdate()}}">Collapse all</button>`:null} ${this.neighborhood?O`<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 O`<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 a=this.pointer(i);a&&this.select(this.model.rows[a.row].id,a.col===null?null:this.model.rows[a.col].id,!1)}this.drag=null}}}" @dblclick="${i=>{let a=this.pointer(i);a&&this.expand(this.model.rows[a.row].pkg)}}"></canvas>${o&&(!t||n>0)?O`<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">${Fn(this.model,this.graph,this.selection,{select:(i,a)=>this.select(i,a),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",yo);var Hn=`:host{display:inline-flex;flex-shrink:0;vertical-align:middle;--switch-track-width: 26px;--switch-track-height: 14px}button{display:inline-flex;align-items:center;gap:8px;box-sizing:border-box;height:30px;margin:0;padding:0 .6rem;border:1px solid var(--border);border-radius:4px;background:transparent;color:var(--muted);font:inherit;font-size:.78rem;font-weight:500;line-height:1;white-space:nowrap;cursor:default;&: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}}.track{position:relative;flex-shrink:0;width:var(--switch-track-width);height:var(--switch-track-height);background:var(--border);border-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]) button{height:100%;border:0;border-radius:0}:host([compact]){--switch-track-width: 22px;--switch-track-height: 12px}:host([compact]) button{height:auto;gap:7px;padding:2px 8px;border-radius:6px;font-size:.68rem;line-height:1.2}
11
+ `;var wo=class extends ut{static properties={checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},label:{type:String},accessibleLabel:{type:String,attribute:"accessible-label"}};static styles=Ue(Hn);constructor(){super(),this.checked=!1,this.disabled=!1,this.label="",this.accessibleLabel=""}render(){return O`<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>`}};customElements.get("mode-switch")||customElements.define("mode-switch",wo);var ko=class extends ut{static properties={graph:{attribute:!1},options:{attribute:!1},matrixControls:{state:!0}};static styles=[Ue(Uo),Ue(Do),Ue(Ho),Ue(Mt)];constructor(){super(),this.graph=null,this.options={},this.matrixControls=null}connectedCallback(){super.connectedCallback(),Ln(this.renderRoot)}willUpdate(){(!this.options.showBundleLayouts||y.bundleLayout!=="matrix")&&(this.matrixControls=null)}updated(){this.toggleAttribute("matrix",!!this.options.showBundleLayouts&&y.bundleLayout==="matrix")}render(){return this.graph?this.options.showBundleLayouts&&y.bundleLayout==="matrix"?O`<div class="graph2-layout g2-matrix-layout">${fo(this.graph,this.options,this.matrixControls)}<dependency-matrix .graph="${this.graph}" @matrix-controls-change="${t=>{this.matrixControls=t.detail}}"></dependency-matrix></div>`:O`<div class="graph2-layout">${fo(this.graph,this.options)} ${xn(this.graph)} ${yn()}</div>`:O``}};customElements.define("graph-layout",ko);function cr(e){let t=new Map;for(let[o,n]of e.importsOf){let i=e.nodeByFile.get(o);if(i)for(let a of n){let l=e.nodeByFile.get(a);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 dr(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 a of n){let l=e.nodeByFile.get(a);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 ur=5;function Dn(e,t){let o=new Map;for(let a of e.nodes)t.has(a.pkg)&&(o.has(a.pkg)||o.set(a.pkg,[]),o.get(a.pkg).push(a));for(let a of o.values())a.sort((l,g)=>l.isHub!==g.isHub?l.isHub?-1:1:g.deg-l.deg);let n=new Map,i=new Map;for(let[a,l]of t){let g=o.get(a);if(!g||g.length===0)continue;let p=g.length,d=0;for(let x of g)if(x.isHub)d++;else break;let u=d>0&&d<=ur,r=u?d:0,$=p-r,w=l.groupR,m=Array.from({length:p}),S=Array.from({length:p});for(let x=0;x<p;x++){let _=x*137.508*Math.PI/180,h;if(x<r)h=r<=1?0:Math.sqrt(x/(r-1))*.3*w;else{let k=x-r;h=$<=1?.4*w:(.4+Math.sqrt(k/($-1))*.6)*w}m[x]=l.x+Math.cos(_)*h,S[x]=l.y+Math.sin(_)*h}let s=Array.from({length:p},()=>!1);for(let x=0;x<p;x++){let _=g[x],h,k;u&&_.isHub?(k=0,h=r):u?(k=r,h=p):(k=0,h=p);let v=0,P=0,z=0,V=e.importsOf.get(_.file);if(V)for(let T of V){let F=n.get(T);F!==void 0&&(v+=F,P+=i.get(T),z++)}let L=e.importedBy.get(_.file);if(L)for(let T of L){let F=n.get(T);F!==void 0&&(v+=F,P+=i.get(T),z++)}let c=!1;if(z>0){v/=z,P/=z;let T=v-l.x,F=P-l.y;T*T+F*F>1&&(c=!0)}let R=-1;if(c){let T=1/0;for(let F=k;F<h;F++){if(s[F])continue;let f=m[F]-v,M=S[F]-P,I=f*f+M*M;I<T&&(T=I,R=F)}}else for(let T=k;T<h;T++)if(!s[T]){R=T;break}s[R]=!0,_.x=m[R],_.y=S[R],n.set(_.file,_.x),i.set(_.file,_.y)}}}function Un(e,t,o){let n=t/2,i=o/2,a=Math.min(t,o)/2;if(e.packages.length===0)return;let g=dr(e),p=cr(e),d=(g?e.packages.filter(f=>f!==g):[...e.packages]).toSorted((f,M)=>{let I=(p.get(M)??0)-(p.get(f)??0);return I!==0?I:(e.pkgCount.get(M)??0)-(e.pkgCount.get(f)??0)}),u=d.length,r;u<=0?r=0:u<=6?r=.65:u<=20?r=.82:r=.95;let $=Math.max(1,Math.sqrt(50/Math.max(1,u))),w=.22,m=.12,S=.04,s=new Map,x;if(g){let f=e.pkgCount.get(g)??0,M=Math.min(w,(.012+Math.sqrt(f)*.004)*$);x=Math.max(u<=6?.4:u<=20?.36:.34,M+m+S),s.set(g,{x:n,y:i,size:f,groupR:M*a})}else u<=1?x=0:u<=6?x=.4:u<=20?x=.32:x=.3;if(u===0){Dn(e,s);return}let _=new Map;for(let f of e.edges){if(!f.cross)continue;let M=e.nodeByFile.get(f.a)?.pkg,I=e.nodeByFile.get(f.b)?.pkg;if(!M||!I||M===I)continue;_.has(M)||_.set(M,new Map),_.has(I)||_.set(I,new Map);let Y=_.get(M),W=_.get(I);Y.set(I,(Y.get(I)??0)+1),W.set(M,(W.get(M)??0)+1)}let h=Math.max(1,Math.min(10,Math.round(Math.sqrt(u)/1.2))),k=Array.from({length:h+1});for(let f=0;f<=h;f++)k[f]=Math.floor(f*f/(h*h)*u);k[h]=u;let v=.2,P=Array.from({length:h}),z=Array.from({length:h});for(let f=0;f<h;f++){let M=k[f],I=k[f+1];P[f]=I-M;let Y=0;for(let W=M;W<I;W++)Y+=e.pkgCount.get(d[W])??0;z[f]=Y}let V=Array.from({length:h});for(let f=0;f<h;f++){let M=(k[f]+k[f+1]-1)/2/Math.max(1,u-1);V[f]=Math.sqrt(Math.max(0,M))}let L=Array.from({length:h});L[0]=V[0];for(let f=1;f<h;f++){let M=P[f-1],I=z[f-1],Y=M>0?I/M:1,W=1+v*Math.sqrt(Math.max(0,Y-1));L[f]=L[f-1]+(V[f]-V[f-1])*W}let c=Array.from({length:h});for(let f=0;f<h;f++)c[f]=L[f]-V[f];let R=Array.from({length:u}),T=Array.from({length:u}),F=0;for(let f=0;f<u;f++){for(;F<h-1&&f>=k[F+1];)F++;let M=f*137.508%360*Math.PI/180,Y=(u<=1?0:Math.sqrt(f/(u-1)))+c[F],W=u===1?g?x:0:x+Y*(r-x);R[f]=n+Math.cos(M)*W*a,T[f]=i+Math.sin(M)*W*a}for(let f=0;f<h;f++){let M=k[f],I=k[f+1],Y=I-M;if(Y===0)continue;let W=Array.from({length:Y},()=>!1);for(let xe=M;xe<I;xe++){let Me=d[xe],B=_.get(Me),Q=0,te=0,K=0;if(B)for(let[de,ce]of B){let ye=s.get(de);ye&&(Q+=ye.x*ce,te+=ye.y*ce,K+=ce)}let q=!1;if(K>0){Q/=K,te/=K;let de=Q-n,ce=te-i;de*de+ce*ce>1&&(q=!0)}let J=-1;if(q){let de=1/0;for(let ce=0;ce<Y;ce++){if(W[ce])continue;let ye=M+ce,Se=R[ye]-Q,De=T[ye]-te,Le=Se*Se+De*De;Le<de&&(de=Le,J=ce)}}else for(let de=0;de<Y;de++)if(!W[de]){J=de;break}W[J]=!0;let ve=M+J,ge=e.pkgCount.get(Me)??0,Te=Math.min(m,(.012+Math.sqrt(ge)*.004)*$);s.set(Me,{x:R[ve],y:T[ve],size:ge,groupR:Te*a})}}Dn(e,s)}function $o(e,t,o){let n=t/2,i=o/2,a=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*a,d.y=i+Math.sin(u)*r*.85*a}}function Mo(e,t,o,n,{groupOf:i=Pt}={}){let a=e.length,l=n||760,g=o||1100,p=Math.sqrt(g*l/Math.max(a,1))*1.1,d=v=>{let P=0;for(let z of v)P=P*31+z.codePointAt(0)|0;return P},u=Math.ceil(Math.sqrt(a*g/l)),r=Math.ceil(a/u),$=l/(r+1),w=g/(u+1),m=e.map((v,P)=>{let z=P%u,V=Math.floor(P/u),L=d(v);return{file:v,x:(z+1)*w+(L%100-50)*w*.4,y:(V+1)*$+((L>>7)%100-50)*$*.4,dx:0,dy:0}}),S=new Map(m.map((v,P)=>[v.file,P])),s=[];for(let v of e)for(let P of t.get(v)??[])S.has(P)&&s.push([S.get(v),S.get(P)]);let x=new Map;for(let v=0;v<a;v++){let P=i(m[v].file)??"__own__";x.has(P)||x.set(P,[]),x.get(P).push(v)}let _=Math.min(500,Math.max(180,100+a*3)),h=Math.min(g,l)/6,k=.3;for(let v=0;v<_;v++){let P=h*Math.pow(k/h,v/_);for(let L of m)L.dx=0,L.dy=0;for(let L=0;L<a;L++)for(let c=L+1;c<a;c++){let R=m[L],T=m[c],F=R.x-T.x,f=R.y-T.y,M=Math.sqrt(F*F+f*f);if(M<.01){let Y=d(R.file+T.file);F=(Y%100-50)*.01||.5,f=((Y>>7)%100-50)*.01||.5,M=Math.sqrt(F*F+f*f)}let I=p*p/M;R.dx+=F/M*I,R.dy+=f/M*I,T.dx-=F/M*I,T.dy-=f/M*I}for(let[L,c]of s){let R=m[L],T=m[c],F=R.x-T.x,f=R.y-T.y,M=Math.sqrt(F*F+f*f)||.01,I=M*M/p;R.dx-=F/M*I,R.dy-=f/M*I,T.dx+=F/M*I,T.dy+=f/M*I}let z=.055*Math.min(1,P/(h*.3));for(let[,L]of x){if(L.length<2)continue;let c=0,R=0;for(let T of L)c+=m[T].x,R+=m[T].y;c/=L.length,R/=L.length;for(let T of L)m[T].dx+=(c-m[T].x)*z,m[T].dy+=(R-m[T].y)*z}let V=50;for(let L of m){let c=Math.sqrt(L.dx*L.dx+L.dy*L.dy)||.01;L.x+=L.dx/c*Math.min(c,P),L.y+=L.dy/c*Math.min(c,P),L.x=Math.max(V,Math.min(g-V,L.x)),L.y=Math.max(V,Math.min(l-V,L.y))}}return m}function So(e,t,o,{statsHeight:n=0,left:i=0,right:a=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-a),r=Math.max(1,o-d*2-n-l-g),$=-1/0,w=-1/0,m=1/0,S=1/0;for(let x of e)m=Math.min(m,x.x),$=Math.max($,x.x),S=Math.min(S,x.y),w=Math.max(w,x.y);if(e.length===0)return{k:1,tx:t/2,ty:(o-n)/2};let s=Math.min(4,u/Math.max(20,$-m),r/Math.max(20,w-S));return{k:s,tx:p+i+u/2-(m+$)/2*s,ty:d+l+r/2-(S+w)/2*s}}function Gt(e,t,o=!1){let n=o?t:1;return{min:t,max:n*9.99,percent:Math.round(e/n*100)}}function Vn(e,t,o,{width:n=900,rowHeight:i=52,gap:a=42}={}){let l=new Map(e.map(h=>[h.id,h])),g=new Map,p=[];for(let h of o)l.has(h)&&!g.has(h)&&(g.set(h,0),p.push(h));for(let h=0;h<p.length;h++){let k=p[h];for(let v of t.get(k)??[])!l.has(v)||g.has(v)||(g.set(v,g.get(k)+1),p.push(v))}let d=new Map;for(let h of e){let k=g.get(h.id)??null;d.has(k)||d.set(k,[]),d.get(k).push(h)}let u=new Map(e.map(h=>[h.id,[]]));for(let[h,k]of t)if(l.has(h))for(let v of new Set(k))u.get(v)?.push(h);let r=[],$=new Map,w=[...d.keys()].toSorted((h,k)=>(h??1/0)-(k??1/0)),m=h=>Number.isFinite(h.size)&&h.size>0?h.size:0;for(let h of w){let k=d.get(h).slice(),v=new Map(k.map(c=>{let R=u.get(c.id).map(T=>$.get(T)).filter(T=>T&&h!==null&&T.level===h-1);return[c.id,R.length>0?R.reduce((T,F)=>T+F.x+F.width/2,0)/R.length:n/2]}));k.sort((c,R)=>v.get(c.id)-v.get(R.id)||String(c.id).localeCompare(String(R.id)));let P=0;for(let c=1;c<k.length;c++)m(k[c])>m(k[P])&&(P=c);P>0&&k.unshift(k.splice(P,1)[0]);let z=k.reduce((c,R)=>c+m(R),0),V=r.length*(i+a),L=0;for(let c of k){let R=n*(z>0?m(c)/z:1/k.length);$.set(c.id,{id:c.id,level:h,x:L,y:V,width:R,height:i}),L+=R}r.push({level:h,y:V,size:z,proportional:z>0,ids:k.map(c=>c.id)})}let S=[];for(let[h,k]of t)if($.has(h))for(let v of new Set(k))h!==v&&$.has(v)&&S.push({from:h,to:v});S.sort((h,k)=>String(h.from).localeCompare(String(k.from))||String(h.to).localeCompare(String(k.to)));let s=new Map,x=new Map;for(let h of S)x.has(h.from)||x.set(h.from,[]),s.has(h.to)||s.set(h.to,[]),x.get(h.from).push(h),s.get(h.to).push(h);for(let h of x.values())h.sort((k,v)=>$.get(k.to).x-$.get(v.to).x);for(let h of s.values())h.sort((k,v)=>$.get(k.from).x-$.get(v.from).x);for(let h of x.values())h.forEach((k,v)=>{k.sourcePort=(v+1)/(h.length+1)});for(let h of s.values())h.forEach((k,v)=>{k.targetPort=(v+1)/(h.length+1)});let _=r.reduce((h,k)=>h+k.size,0);for(let h of r)h.share=_>0?h.size/_:null;return{levels:r,rects:$,edges:S,depth:g,totalSize:_,width:n,height:r.length>0?r.length*(i+a)-a:0,gap:a}}function pr(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 Gn(e,t,{theme:o,scale:n,colorOf:i,labelOf:a,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 $=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 S=t.rects.get(m.from),s=t.rects.get(m.to),x=m.from===u||m.to===u;e.globalAlpha=Math.min($(m.from),$(m.to))*(x?.9:.5),e.strokeStyle=i(m.from),e.fillStyle=i(m.from),e.lineWidth=(x?1.6:1)/n;let _=S.x+S.width*m.sourcePort,h=S.y+S.height,k=s.x+s.width*m.targetPort,v=s.y,P=0,z=1;if(e.beginPath(),e.moveTo(_,h),s.y>S.y){let L=(h+v)/2;e.bezierCurveTo(_,L,k,L,k,v)}else if(s.y===S.y){v=s.y+s.height;let L=h+t.gap*.65;e.bezierCurveTo(_,L,k,L,k,v),z=-1}else{k=s.x+s.width,v=s.y+s.height*m.targetPort;let L=t.width+16+m.sourcePort*20;e.bezierCurveTo(_,h+t.gap/2,L,h+t.gap/2,L,h),e.lineTo(L,v+8),e.quadraticCurveTo(L,v,k,v),P=-1,z=0}e.stroke();let V=3/n;e.beginPath(),e.moveTo(k,v),e.lineTo(k-P*V-z*V,v-z*V+P*V),e.lineTo(k-P*V+z*V,v-z*V-P*V),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 w=o.edgeIntra(.16);for(let m of t.levels){let s=m.y+26,x=18;e.strokeStyle=w,e.lineWidth=3,e.beginPath(),e.arc(-112,s,x,0,Math.PI*2),e.stroke(),m.share!==null&&m.share>0&&(e.strokeStyle=o.labelDefault,e.beginPath(),e.arc(-112,s,x,-Math.PI/2,-Math.PI/2+m.share*Math.PI*2),e.stroke()),e.textAlign="center",e.font="9px system-ui, sans-serif";let _=m.share===null?"\u2014":m.share>0&&m.share<.001?"<0.1%":`${Number((m.share*100).toFixed(1))}%`;e.fillText(_,-112,s),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:S,x:s,y:x,width:_,height:h}=m;if(_<=0)continue;let k=i(S),v=pr(k);if(e.globalAlpha=$(S),e.fillStyle=k,e.fillRect(s,x,_,h),e.strokeStyle=o.bg,e.lineWidth=1/n,e.strokeRect(s,x,_,h),S===p||S===d){e.strokeStyle=o.selectRing,e.lineWidth=1.5/n;let P=Math.min(_/2,.75/n);e.strokeRect(s+P,x+P,Math.max(0,_-P*2),h-P*2)}_*n<28||(e.save(),e.beginPath(),e.rect(s+7,x+4,Math.max(0,_-14),h-8),e.clip(),e.fillStyle=v,e.font="500 12px system-ui, sans-serif",e.fillText(a(S),s+9,x+21),e.fillStyle=v,e.font="10px system-ui, sans-serif",e.fillText(l(S),s+9,x+38),e.restore())}e.restore()}function jn(e,t,o=[],{width:n=1200,height:i=800}={}){e=[...new Set(e)].toSorted();let a=new Set(e),l=new Map(e.map(B=>[B,[...new Set(t.get(B)??[])].filter(Q=>Q!==B&&a.has(Q)).toSorted()])),g=new Map(e.map(B=>[B,[]]));for(let[B,Q]of l)for(let te of Q)g.get(te).push(B);let{groups:p,componentOf:d}=mo(e,l),u=p.filter(B=>B.length>1),r=new Set(u.flat()),$=p.map(()=>new Set),w=p.map(()=>0);for(let[B,Q]of l)for(let te of Q){let K=d.get(B),q=d.get(te);K!==q&&!$[K].has(q)&&($[K].add(q),w[q]++)}let m=new Set(o.map(B=>d.get(B)).filter(B=>B!==void 0)),S=p.map(()=>0),s=[],x=new Set,_=B=>{x.has(B)||(x.add(B),s.push(B))};m.forEach(_),w.forEach((B,Q)=>{B||_(Q)});for(let B=0;B<s.length;B++){let Q=s[B];for(let te of $[Q])m.has(te)||(S[te]=Math.max(S[te],S[Q]+1)),--w[te]===0&&_(te)}let h=new Map(e.map(B=>[B,S[d.get(B)]])),k=new Map;for(let B of e){let Q=h.get(B);k.has(Q)||k.set(Q,[]),k.get(Q).push(B)}let v=[...k.keys()].toSorted((B,Q)=>B-Q),P=new Map,z=B=>B.forEach((Q,te)=>P.set(Q,(te+.5)/B.length));for(let B of k.values())z(B);for(let B=0;B<12;B++)for(let Q of B%2?v.toReversed():v){let te=k.get(Q),K=new Map(te.map(q=>{let J=(B%2?l:g).get(q);return[q,J.length>0?J.reduce((ve,ge)=>ve+P.get(ge),0)/J.length:P.get(q)]}));te.sort((q,J)=>K.get(q)-K.get(J)||P.get(q)-P.get(J)||q.localeCompare(J)),z(te)}let V=Math.max(.6,Math.min(2.4,n/Math.max(1,i))),L=Math.max(160,Math.sqrt(e.length*1100*V)),c=Math.max(120,L/V),R=v.at(-1)??0,T=new Map;for(let[B,Q]of k)Q.forEach((te,K)=>{let q=P.get(te)*L,J=(B+.5)/(R+1)*c;T.set(te,{id:te,x:q,y:J+(K%5-2)*9,anchorY:J,vx:0,vy:0,level:B,cycle:r.has(te),degree:l.get(te).length+g.get(te).length})});let F=[];for(let[B,Q]of l)for(let te of Q)F.push({from:B,to:te,cycle:r.has(B)&&d.get(B)===d.get(te)});let f=F.map(B=>{let Q=T.get(B.from),te=T.get(B.to),K=26+Math.sqrt(Math.max(Q.degree,te.degree))*5;return{a:Q,b:te,length:K,strength:.065/Math.sqrt(Math.min(Q.degree,te.degree)||1),cycle:B.cycle}}),M=[...T.values()],I=80;for(let B=0;B<240;B++){let Q=new Map,te=7*(1-B/240)+.15;for(let K=0;K<M.length;K++){let q=M[K];q.fx=(L/2-q.x)*.002,q.fy=(q.anchorY-q.y)*.018,q.gx=Math.floor(q.x/I),q.gy=Math.floor(q.y/I);let J=`${q.gx},${q.gy}`;Q.has(J)||Q.set(J,[]),Q.get(J).push(K)}for(let K=0;K<M.length;K++){let q=M[K];for(let J=q.gx-1;J<=q.gx+1;J++)for(let ve=q.gy-1;ve<=q.gy+1;ve++)for(let ge of Q.get(`${J},${ve}`)??[]){if(ge<=K)continue;let Te=M[ge],de=q.x-Te.x,ce=q.y-Te.y,ye=de*de+ce*ce;if(ye>I*I)continue;ye<.01&&(de=K%2?.1:-.1,ce=.1);let Se=Math.hypot(de,ce),De=Math.min(18,100/Se-100/I+Math.max(0,22-Se)*.6),Le=de/Se*De,dt=ce/Se*De;q.fx+=Le,q.fy+=dt,Te.fx-=Le,Te.fy-=dt}}for(let{a:K,b:q,length:J,strength:ve,cycle:ge}of f){let Te=q.x-K.x,de=q.y-K.y,ce=Math.hypot(Te,de)||1,ye=(ce-J)*ve,Se=Te/ce*ye,De=de/ce*ye;if(K.fx+=Se,K.fy+=De,q.fx-=Se,q.fy-=De,!ge&&de<22){let Le=(22-de)*.018;K.fy-=Le,q.fy+=Le}}for(let K of M){K.vx=(K.vx+K.fx)*.55,K.vy=(K.vy+K.fy)*.55;let q=Math.hypot(K.vx,K.vy)||1,J=Math.min(1,te/q);K.x+=K.vx*J,K.y+=K.vy*J}}let Y=-1/0,W=-1/0,xe=1/0,Me=1/0;for(let B of M)xe=Math.min(xe,B.x),Me=Math.min(Me,B.y),Y=Math.max(Y,B.x),W=Math.max(W,B.y);for(let B of M)B.x+=16-xe,B.y+=16-Me;return{nodes:T,edges:F,depth:h,incoming:g,links:l,cycles:u,roots:new Set(o.filter(B=>a.has(B))),width:M.length>0?Y-xe+32:32,height:M.length>0?W-Me+32:32}}function fr(e){return Math.max(2.5,Math.min(6,4.5*Math.sqrt(e)))}function Xn(e,t,o,{theme:n,viewport:i,width:a,height:l,colorOf:g,dimmed:p,selected:d,hovered:u,query:r}){let{k:$,tx:w,ty:m}=i,S=fr($),s=u??d,x=new Set([s,...t.links.get(s)??[],...t.incoming.get(s)??[]]),_=new Map;for(let[c,R]of t.nodes){let T=o.nodeByFile.get(c);_.set(c,{x:R.x*$+w,y:R.y*$+m,color:g(T.pkg),n:T,p:R,dim:c===s||c===d?1:p(T)?.12:s&&!x.has(c)?.16:1})}e.save();let h=(c,R)=>{let T=_.get(c.from),F=_.get(c.to);if(Math.max(T.x,F.x)<-40||Math.min(T.x,F.x)>a+40||Math.max(T.y,F.y)<-80||Math.min(T.y,F.y)>l+80)return;e.globalAlpha=R?.85:Math.min(T.dim,F.dim)*(s?.12:.22),e.strokeStyle=R?T.color:n.labelDefault,e.lineWidth=R?1.4:.7,e.setLineDash(c.cycle?[3,3]:[]);let f=F.x-T.x,M=F.y-T.y,I=Math.hypot(f,M)||1,Y=f/I,W=M/I,xe=T.x+Y*(S+1),Me=T.y+W*(S+1),B=F.x-Y*(S+3),Q=F.y-W*(S+3),te=c.cycle?Math.min(18,I*.15):0,K=(xe+B)/2-W*te,q=(Me+Q)/2+Y*te;if(e.beginPath(),e.moveTo(xe,Me),e.quadraticCurveTo(K,q,B,Q),e.stroke(),R||$>=.85||o.nodes.length<=50){let J=Math.atan2(Q-q,B-K),ve=R?5:3.5;e.setLineDash([]),e.fillStyle=e.strokeStyle,e.beginPath(),e.moveTo(B,Q),e.lineTo(B-Math.cos(J-.5)*ve,Q-Math.sin(J-.5)*ve),e.lineTo(B-Math.cos(J+.5)*ve,Q-Math.sin(J+.5)*ve),e.closePath(),e.fill()}};for(let c of t.edges)c.from!==s&&c.to!==s&&h(c,!1);for(let c of t.edges)(c.from===s||c.to===s)&&h(c,!0);e.setLineDash([]);let k=new Map,v=c=>{let R=[];for(let T=Math.floor(c.x/64);T<=Math.floor((c.x+c.w)/64);T++)for(let F=Math.floor(c.y/24);F<=Math.floor((c.y+c.h)/24);F++)R.push(`${T},${F}`);return R},P=c=>{for(let R of v(c))k.has(R)||k.set(R,[]),k.get(R).push(c)},z=(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,V=[..._.values()].filter(c=>c.x>=-10&&c.x<=a+10&&c.y>=-10&&c.y<=l+10);for(let c of V)e.globalAlpha=c.dim,e.fillStyle=c.color,e.beginPath(),e.arc(c.x,c.y,S,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,S+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,S+4,0,Math.PI*2),e.stroke()),P({x:c.x-S-2,y:c.y-S-2,w:S*2+4,h:S*2+4});e.font='11px SFMono-Regular, Consolas, "Liberation Mono", monospace',e.textBaseline="top",e.textAlign="center",V.sort((c,R)=>{let T=F=>F.n.file===s?1e9:F.n.file===d?1e8:r&&F.dim===1?1e7:s&&x.has(F.n.file)?1e6:t.roots.has(F.n.file)?1e5:F.n.deg;return T(R)-T(c)});let L=0;for(let c of V){let R=c.n.file===s||c.n.file===d;if(!R&&c.dim<.5||!R&&!r&&!s&&$<1&&L>=24)continue;let T=c.n.label.length>38?`${c.n.label.slice(0,36)}\u2026`:c.n.label,F=e.measureText(T).width+8,f={x:c.x-F/2,y:c.y+S+5,w:F,h:16};f.x<4||f.x+f.w>a-4||f.y+f.h>l-24||!R&&v(f).some(M=>k.get(M)?.some(I=>z(f,I)))||(P(f),L++,e.globalAlpha=.94,e.fillStyle=n.bg,e.fillRect(f.x,f.y-1,f.w,f.h),e.globalAlpha=1,e.fillStyle=R?n.labelSelected:n.labelDefault,e.fillText(T,c.x,f.y))}e.restore()}function qn(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 a=o.get(i.a),l=o.get(i.b);return a&&l?[{edge:i,a,b:l}]:[]});return{nodes:t,edges:n,graph:e,selected:void 0,neighbors:new Set}}function Wn(e,{viewport:t,selected:o,visible:n,dimmed:i,radius:a,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=a(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 Yn(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)}),a=n?t*.25:t,l=n?.85:Math.min(.9,t+.5);return e.paints={base:i(a),emphasis:i(l),baseDim:i(Math.min(a,.04)),emphasisDim:i(Math.min(l,.04))},e.edgeOpacity=t,e.neutral=o,e.edgeSelected=n,e.paints}function Kn(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 Zn(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 Jn(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 _o(e,t,o,n,i){return e+o<-2||e-o>n+2||t+o<-2||t-o>i+2}function Qn(e){let o=new Map;for(let[n,i]of e.entries()){let a=Math.floor(i.x/32),l=Math.floor(i.y/32);o.has(a)||o.set(a,new Map);let g=o.get(a);g.has(l)||g.set(l,[]),g.get(l).push({node:i,index:n})}return(n,i,a,l,g,p)=>{let{k:d,tx:u,ty:r}=a,$=(l+6)/d+1e-7,w=(n-u)/d,m=(i-r)/d,S=Math.floor((w-$)/32),s=Math.floor((w+$)/32),x=Math.floor((m-$)/32),_=Math.floor((m+$)/32),h=null,k=1/0,v=1/0;for(let P=S;P<=s;P++){let z=o.get(P);if(z)for(let V=x;V<=_;V++)for(let{node:L,index:c}of z.get(V)??[]){if(!p(L))continue;let R=L.x*d+u-n,T=L.y*d+r-i,F=R*R+T*T,f=g(L)+6;F<f*f&&(F<k||F===k&&c<v)&&(h=L,k=F,v=c)}}return h}}function ei(e,t,o,n,i){if(!e||e.key!==t.key)return null;let a=(t.tx-e.tx)*i,l=(t.ty-e.ty)*i;if(!Number.isInteger(a)||!Number.isInteger(l)||!Number.isInteger(a/i)||!Number.isInteger(l/i)||!a&&!l||Math.abs(a)>=o*i||Math.abs(l)>=n*i)return null;let g=a/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:a,dy:l,rects:d}}function jt(e,t,o,n,i){return e&&e.rects.every(a=>n<a.x||t>a.x+a.w||i<a.y||o>a.y+a.h)}var gr={critical:"#ff5470",high:"#ff9d4a",medium:"#f4d35e",low:"#67c2ff",high_bug:"#a06c3f",bug:"#7a6d62",informational:"#218bff"},Ao={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"}};function ti(){let e=document.body.classList;return e.contains("theme-pink")?Ao.pink:e.contains("theme-light")?Ao.light:Ao.dark}var oi=(e,t)=>e.x0<t.x1&&t.x0<e.x1&&e.y0<t.y1&&t.y0<e.y1;function Ro(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(oi(o,i)){n=!0;break}n||t.push(o)}return t}var hr=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 hr[t]}function mr(e,t,o,n){let a=e.querySelector("graph-layout")?.shadowRoot;if(!a)return;let l=a.querySelector("#g2-canvas"),g=a.querySelector("#g2-tooltip"),p=a.querySelector(".graph2-stage"),d=a.querySelector(".g2-stage-stats"),u=a.querySelector("#g2-zoom-pct");if(!l)return;fn();let r=l.getContext("2d"),$=window.devicePixelRatio||1,w=0,m=0,S=0,s={tx:0,ty:0,k:1},x=null,_=0,h=0,k=!0,v=!0,P=new WeakMap,z=null,V=null,L=null,c=()=>t.supportsLayers&&y.bundleLayout==="layers"&&!y.focusedPkg,R=()=>t.supportsLayers&&y.bundleLayout==="dependencies"&&!y.focusedPkg,T=()=>R()&&!gt(t,y.dependencyPackagesView),F=()=>c()||y.bundleLayout==="graph"&&y.packagesView&&(t.canPackagesView??!1)&&!y.focusedPkg,f=null,M=null,I=null;function Y(){if(!I&&(I=Ot(t),c()&&t.layerRoots?.appImports.length>0)){if(!I.byPkg.has("__own__")){let b={file:"__own__",pkg:"__own__",label:"App (source not bundled)",size:null,fileCount:0,totalIssues:0};I.nodes.push(b),I.byPkg.set("__own__",b)}I.importsOf.set("__own__",[...new Set([...I.importsOf.get("__own__")??[],...t.layerRoots.appImports])])}return I}function W(){return Bt(t,y.dependencyPackagesView)}let xe=b=>b==="__own__"?"App":f?.depth.get(b)===0?`App \xB7 ${Ne(b)}`:Ne(b);function Me(b,A,H){if(b.nodes.length>50){$o(b,A,H);return}let N=Mo(b.nodes.map(C=>C.pkg),b.importsOf,A,H,{groupOf:C=>C});B(b.nodes,new Map(N.map(C=>[C.file,C])))}function B(b,A){for(let H of b){let N=A.get(H.file);N&&(H.x=N.x,H.y=N.y)}}function Q(){if(!k)return;if(V=null,L=null,z=null,c()){let C=Y();f=Vn(C.nodes.map(G=>({id:G.pkg,size:G.size})),C.importsOf,t.layerRoots?.roots??["__own__"],{width:Math.max(360,h-190)}),k=!1;return}if(R()){let C=W();M=jn(C.nodes.map(G=>G.file),C.importsOf,C.fileLevel?[]:t.layerRoots?.roots??[],{width:h,height:_}),k=!1;return}let b=y.layoutCache,A=y.focusedPkg,H=F(),N=H?Y().nodes:t.nodes;if(b&&b.files===t.files&&b.w===h&&b.h===_&&b.focused===A&&(b.pkgView??!1)===H)B(N,b.pos);else{if(H)Me(Y(),h,_);else if(A)if(t.nodes.length>50)$o(t,h,_);else{let G=Mo(t.files,t.importsOf,h,_);B(t.nodes,new Map(G.map(ee=>[ee.file,ee])))}else Un(t,h,_);let C=new Map;for(let G of N)C.set(G.file,{x:G.x,y:G.y});y.layoutCache={files:t.files,w:h,h:_,pos:C,focused:A,pkgView:H}}k=!1}function te(){if(R()&&M){if(W().nodes.length<=100){let ie=12;r.save(),r.font='11px SFMono-Regular, Consolas, "Liberation Mono", monospace';for(let re of W().nodes){let X=re.label.length>38?`${re.label.slice(0,36)}\u2026`:re.label;ie=Math.max(ie,r.measureText(X).width/2+4)}return r.restore(),So([...M.nodes.values()],m,w,{statsHeight:S,left:ie,top:12,bottom:27})}let U=Math.max(20,Math.min(m,w)*.04),j=Math.min((m-U*2)/M.width,(w-U*2-S)/M.height,2.5),Z=Math.max(.05,j);return{k:Z,tx:(m-M.width*Z)/2,ty:(w-S-M.height*Z)/2}}if(c()&&f){let U=Math.min((m-24)/(f.width+185),(w-70)/(f.height+f.gap),1.5),j=Math.max(.05,U);return{k:j,tx:(m-(f.width+185)*j)/2+145*j,ty:24+Math.max(0,(w-70-(f.height+f.gap)*j)/2)}}let b=F()?Y().nodes:t.nodes;if(b.length<=50){let U=0,j=0,Z=0;r.save(),r.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace";for(let ie of b){let re=F()?et(ie):(ie.isHub?6:4)*y.nodeSize,X=re*1.85+5;j=Math.max(j,X,r.measureText(ie.label).width/2+6),Z=Math.max(Z,X),U=Math.max(U,X,re+4+13+4)}return r.restore(),So(b,m,w,{statsHeight:S,left:j,top:Z,bottom:U})}if(b.length===0)return{k:1,tx:m/2,ty:(w-S)/2};let A=-1/0,H=-1/0,N=1/0,C=1/0;for(let U of b)U.x<N&&(N=U.x),U.y<C&&(C=U.y),U.x>A&&(A=U.x),U.y>H&&(H=U.y);let G=Math.max(20,H-C),ee=Math.max(20,A-N),fe=(N+A)/2,ae=(C+H)/2,ue=Math.max(20,Math.min(m,w)*(y.focusedPkg?.04:.03)),D=Math.min((m-ue*2)/ee,(w-ue*2-S)/G,4),E=Math.max(.05,D);return{k:E,tx:m/2-fe*E,ty:(w-S)/2-ae*E}}function K(){let b=te();s.k=b.k,s.tx=b.tx,s.ty=b.ty}function q(){if(!R()){u&&(u.textContent=`${Math.round(s.k*100)}%`);return}let b=Gt(s.k,te().k,!0);u&&(u.textContent=`${b.percent}%`),Kt&&(Kt.disabled=s.k<=b.min*1.0001),Yt&&(Yt.disabled=s.k>=b.max*.9999)}function J(b,A){return[b*s.k+s.tx,A*s.k+s.ty]}function ve(b,A){return[(b-s.tx)/s.k,(A-s.ty)/s.k]}function ge(b){return!y.hidden.has(b.pkg)}function Te(b,A,H,N,C){let G=H+(N==="critical"?4.2:N==="high"?3.4:2.8),ee=N==="critical"?1.8:N==="high"?1.5:N==="medium"?1.3:1.1;r.strokeStyle=gr[N],r.globalAlpha=C,r.lineWidth=ee,r.beginPath(),r.arc(b,A,G,0,Math.PI*2),r.stroke(),r.globalAlpha=1}function de(b,A,H,N,C,G,ee){let ue=ee?.1:.9,D=2*(1-ue)*(H-b)+2*ue*(C-H),E=2*(1-ue)*(N-A)+2*ue*(G-N),U=Math.sqrt(D*D+E*E)||1,j=D/U,Z=E/U;r.beginPath(),ee?(r.moveTo(b,A),r.lineTo(b+j*7-Z*2.94,A+Z*7+j*2.94),r.lineTo(b+j*7+Z*2.94,A+Z*7-j*2.94)):(r.moveTo(C,G),r.lineTo(C-j*7+Z*2.94,G-Z*7-j*2.94),r.lineTo(C-j*7-Z*2.94,G-Z*7+j*2.94)),r.closePath()}function ce(b){if(y.selectedSeverities.size>0){let H=b.severitySet;if(!H)return!0;let N=!1;for(let C of y.selectedSeverities)if(H.has(C)){N=!0;break}if(!N)return!0}if(y.selectedColors.size>0){let H=b.colorSet;if(!H)return!0;let N=!1;for(let C of y.selectedColors)if(H.has(C)){N=!0;break}if(!N)return!0}if(y.solo&&b.pkg!==y.solo&&!F()&&!T())return!0;let A=y.pathFilter;if(A){let H=A.toLowerCase(),N=b.pathText?b.pathText.includes(H):b.file.toLowerCase().includes(H),C=b.pkg&&b.pkg.toLowerCase().includes(H),G=b.label&&b.label.toLowerCase().includes(H);if(!N&&!C&&!G)return!0}return!1}function ye(b){let A=(b.isHub?4.9:3.5)*y.nodeSize,H=Math.max(.6,Math.min(1.6,s.k));return A*H}function Se(){let b=p.getBoundingClientRect(),A=w,H=m;m=Math.max(80,b.width),w=Math.max(80,b.height),S=d?(parseFloat(getComputedStyle(d).lineHeight)||0)+8:0,$=window.devicePixelRatio||1,l.width=m*$,l.height=w*$,V=null,P.delete(t),I&&P.delete(I),l.style.width=m+"px",l.style.height=w+"px",r.setTransform($,0,0,$,0,0),(h===0||_===0)&&(h=m,_=w,k=!0),Q();let N=H>0&&(Math.abs(m-H)/H>.15||Math.abs(w-A)/A>.15);(v||N)&&(K(),v=!1),Ee()}let De=null,Le=!0,dt=!1,Xt=!1;function Ee(){Le=!0,!(dt||Xt)&&(dt=!0,De=requestAnimationFrame(()=>{dt=!1,Le&&!Xt&&(Le=!1,ii())}))}function ii(){let b=F()?Y():t;if(L?.graph!==b){L={graph:b,x0:1/0,y0:1/0,x1:-1/0,y1:-1/0};for(let ee of b.nodes)L.x0=Math.min(L.x0,ee.x),L.x1=Math.max(L.x1,ee.x),L.y0=Math.min(L.y0,ee.y),L.y1=Math.max(L.y1,ee.y)}let A=ye({isHub:!0})*6+8,N=L.x0*s.k+s.tx>A&&L.y0*s.k+s.ty>A&&L.x1*s.k+s.tx<m-A&&L.y1*s.k+s.ty<w-A&&s.k<=1.4&&b.nodes.length>50&&!c()&&!R(),C={tx:s.tx,ty:s.ty,key:JSON.stringify([s.k,ti().bg,y.nodeSize,y.edgeOpacity,x,y.selected,y.solo,y.focusedPkg,F(),y.showAll,y.pathFilter,[...y.selectedSeverities],[...y.selectedColors],[...y.hidden]])},G=N?ei(V,C,m,w,$):null;r.save();try{if(G){r.save(),r.setTransform(1,0,0,1,0,0),r.globalCompositeOperation="copy",r.drawImage(l,G.dx,G.dy),r.restore(),r.beginPath();for(let ee of G.rects)r.rect(ee.x,ee.y,ee.w,ee.h);r.clip()}ri(G),V=N?C:null}finally{r.restore()}}function ri(b){let A=ti();r.fillStyle=A.bg,r.fillRect(0,0,m,w),si(A);let H=R(),N=F(),C=H?W():N?Y():t,G=T()||N?y.solo:y.selected,ee=G?C.nodeByFile.get(G):null,fe=ee?G:null;if(H){Xn(r,M,C,{theme:A,viewport:s,width:m,height:w,colorOf:he,selected:fe,hovered:x,query:y.pathFilter,dimmed:X=>ce(X)}),q();return}if(c()){r.save(),r.translate(s.tx,s.ty),r.scale(s.k,s.k),Gn(r,f,{theme:A,scale:s.k,selected:fe,hovered:x,colorOf:he,labelOf:xe,sizeLabel:X=>We(typeof X=="number"?X:C.byPkg.get(X).size)||"Size unknown",dimmed:X=>ce(C.byPkg.get(X))}),r.restore(),q();return}if(N&&C.nodes.length<=50){li(A);return}if(y.focusedPkg&&C.nodes.length<=50){ai(A,fe,ee);return}P.has(C)||P.set(C,qn(C));let ae=P.get(C),ue=JSON.stringify([s.k,s.tx,s.ty,y.nodeSize,A.bg,y.solo,y.pathFilter,[...y.selectedSeverities],[...y.selectedColors],[...y.hidden]]);Wn(ae,{viewport:s,selected:fe,paintKey:ue,visible:ge,dimmed:ce,radius:ye,color:he});let D=Yn(ae,y.edgeOpacity,A.edgeIntra,!!fe),E=fe||x,U=.85/s.k,j=.55/s.k,Z=null,ie=null,re=null;r.save(),r.translate(s.tx,s.ty),r.scale(s.k,s.k);for(let X of ae.edges){let{edge:ne,a:oe,b:le}=X;if(!oe.visible||!le.visible||Jn(oe,le,m,w)||jt(b,Math.min(oe.x,le.x)-2,Math.min(oe.y,le.y)-2,Math.max(oe.x,le.x)+2,Math.max(oe.y,le.y)+2))continue;let be=E&&(ne.a===E||ne.b===E),pe=oe.dimmed&&le.dimmed?be?D.emphasisDim:D.baseDim:be?D.emphasis:D.base,we=ne.cross?Kn(X,r):pe.neutral,ke=ne.cross?pe.opacity:1,Pe=ne.cross?U:j;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(le.node.x,le.node.y),r.stroke()}r.restore();for(let X of ae.nodes){if(!X.visible)continue;let ne=X.node,oe=ne.file===x,le=ne.file===fe;if(!ne.isHub&&!oe&&!le||X.dimmed&&!oe&&!le)continue;let be=X.radius,pe=X.x,we=X.y,ke=be*(le?6:oe?4.5:3);_o(pe,we,ke,m,w)||jt(b,pe-ke-2,we-ke-2,pe+ke+2,we+ke+2)||(r.fillStyle=Zn(X,ke,r),r.beginPath(),r.arc(pe,we,ke,0,Math.PI*2),r.fill())}for(let X of ae.nodes){if(!X.visible)continue;let ne=X.node,oe=X.radius,le=X.x,be=X.y;if(_o(le,be,oe+6,m,w)||jt(b,le-oe-8,be-oe-8,le+oe+8,be+oe+8))continue;let pe=1,we=fe&&ne.file===fe;fe&&!we&&(pe=ae.neighbors.has(ne.file)?1:.25),!we&&X.dimmed&&(pe=Math.min(pe,.1)),r.fillStyle=X.color+Ge(pe),r.beginPath(),r.arc(le,be,oe,0,Math.PI*2),r.fill(),ne.isHub&&(r.strokeStyle=A.hubRing(.55*pe),r.lineWidth=.8,r.stroke()),ne.issue&&Te(le,be,oe,ne.issue,pe)}if(s.k>1.4){let ne=0;if(s.k<9&&!y.showLabels)for(let le of C.nodes){if(!ge(le))continue;let[be,pe]=J(le.x,le.y);if(!(be<0||be>m||pe<0||pe>w)&&(ne++,ne>=50))break}let oe=s.k>=9||ne<50;if(y.showLabels||oe){r.font="10px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",r.fillStyle=A.labelFill,r.textAlign="left",r.textBaseline="middle";let le=11,be=2,pe=250,we=(se,$e)=>se>-pe&&se<m+pe&&$e>-pe&&$e<w+pe,ke=[];for(let se of C.nodes){if(!ge(se))continue;let[$e,_e]=J(se.x,se.y);if(!we($e,_e))continue;let Ae=ye(se);ke.push({file:se.file,x0:$e-Ae,x1:$e+Ae,y0:_e-Ae,y1:_e+Ae})}let Pe=[];for(let se of C.nodes){if(!ge(se)||!se.isHub&&s.k<2.4)continue;let[$e,_e]=J(se.x,se.y);if(!we($e,_e))continue;let Ae=ye(se),Ie=$e+Ae+4,Re=_e+1,ze=r.measureText(se.label).width+be,Oe=se.file===fe,je=se.file===x,Ke=Oe?3:je?2:se.isHub?1:0;Pe.push({file:se.file,n:se,tx:Ie,ty:Re,prio:Ke,x0:Ie-be,x1:Ie+ze,y0:Re-le/2,y1:Re+le/2})}let Ye=Ro(Pe.filter(se=>!ke.some($e=>$e.file!==se.file&&oi(se,$e))));for(let se of Ye)r.fillText(se.n.label,se.tx,se.ty)}}if(ee&&ge(ee)){let[X,ne]=J(ee.x,ee.y),oe=ye(ee);r.strokeStyle=A.selectRing,r.lineWidth=1.5,r.beginPath(),r.arc(X,ne,oe+5,0,Math.PI*2),r.stroke()}q()}function si(b){if(s.k<.4)return;let A=80,H=(s.tx%A+A)%A,N=(s.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,w);for(let C=N;C<w;C+=A)r.moveTo(0,C),r.lineTo(m,C);r.stroke()}function ai(b,A,H){let N=he(y.focusedPkg),C=b.hubRing(.55),G=new Set;if(x){G.add(x);for(let E of t.adj.get(x)??[]){let U=t.edges[E];G.add(U.a),G.add(U.b)}}let ee=E=>(E.isHub?6:4)*y.nodeSize;for(let E of t.edges){let U=t.nodeByFile.get(E.a),j=t.nodeByFile.get(E.b);if(!U||!j||!ge(U)||!ge(j))continue;let Z=E.fromLo&&E.fromHi,ie=!Z&&E.fromHi,re=ie?j:U,X=ie?U:j,ne=x&&(E.a===x||E.b===x),oe=A&&(E.a===A||E.b===A),le=(A||x)&&!ne&&!oe,be=ee(re),pe=ee(X),[we,ke]=J(re.x,re.y),[Pe,Ye]=J(X.x,X.y),se=Pe-we,$e=Ye-ke,_e=Math.sqrt(se*se+$e*$e)||1,Ae=se/_e,Ie=$e/_e,Re=we+Ae*(be+1.5),ze=ke+Ie*(be+1.5),Oe=Pe-Ae*(pe+3.5),je=Ye-Ie*(pe+3.5),Ke=Math.min(_e*.15,30),tt=(Re+Oe)/2-Ie*Ke,Fe=(ze+je)/2+Ae*Ke;r.beginPath(),r.moveTo(Re,ze),r.quadraticCurveTo(tt,Fe,Oe,je);let Ve;oe?Ve=.9:ne?Ve=.85:le?Ve=.05:Ve=Math.min(.85,y.edgeOpacity*3),r.strokeStyle=N+Ge(Ve),r.lineWidth=oe||ne?1.5:.85,r.stroke(),!le&&(de(Re,ze,tt,Fe,Oe,je,!1),r.fillStyle=N+Ge(Math.min(1,Ve+.15)),r.fill(),Z&&(de(Re,ze,tt,Fe,Oe,je,!0),r.fill()))}for(let E of t.nodes){if(!ge(E))continue;let[U,j]=J(E.x,E.y),Z=ee(E),ie=E.file===x,re=E.file===A,X=(A||x)&&!G.has(E.file)&&!re?.15:1;if(r.globalAlpha=X,re||ie||E.isHub){let ne=Z*(re?4:ie?3:2.4),oe=r.createRadialGradient(U,j,Z*.6,U,j,ne);oe.addColorStop(0,N+Ge(re?.4:.25)),oe.addColorStop(1,N+"00"),r.fillStyle=oe,r.beginPath(),r.arc(U,j,ne,0,Math.PI*2),r.fill()}r.fillStyle=N,r.beginPath(),r.arc(U,j,Z,0,Math.PI*2),r.fill(),E.isHub&&(r.strokeStyle=C,r.lineWidth=.9,r.stroke()),E.issue&&Te(U,j,Z,E.issue,X),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,ae=2,ue=[];for(let E of t.nodes){if(!ge(E))continue;let[U,j]=J(E.x,E.y),Z=ee(E),ie=j+Z+4,re=r.measureText(E.label).width/2+ae,X=E.file===A,ne=E.file===x,oe=X?3:ne?2:E.isHub?1:0;ue.push({n:E,sx:U,ty:ie,halfW:re,isSel:X,isHov:ne,prio:oe,x0:U-re,x1:U+re,y0:ie,y1:ie+fe})}let D=Ro(ue);for(let E of D){let{n:U,sx:j,ty:Z,isSel:ie,isHov:re}=E,X=(A||x)&&!G.has(U.file)&&!ie?.2:1;r.globalAlpha=X,r.shadowColor=b.labelShadow,r.shadowBlur=4,r.strokeStyle=b.labelOutline,r.lineWidth=3,r.strokeText(U.label,j,Z),r.shadowBlur=0,r.fillStyle=ie?b.labelSelected:re?b.labelHover:b.labelDefault,r.fillText(U.label,j,Z),r.globalAlpha=1}if(H&&ge(H)){let[E,U]=J(H.x,H.y),j=ee(H);r.strokeStyle=b.selectRing,r.lineWidth=1.8,r.beginPath(),r.arc(E,U,j+4,0,Math.PI*2),r.stroke()}q()}function et(b){return Math.min(26,5+Math.sqrt(b.fileCount)*1.7)*y.nodeSize}function li(b){let A=Y(),H=y.solo&&A.byPkg.has(y.solo)?y.solo:null,N=x??H,C=new Set;if(N){C.add(N);for(let D of A.edges)D.a===N?C.add(D.b):D.b===N&&C.add(D.a)}let G=D=>{if(D.pkg===H||D.pkg===x)return 1;let E=1;return N&&!C.has(D.pkg)&&(E=.2),ce(D)&&(E=Math.min(E,.1)),E};for(let D of A.edges){let E=A.byPkg.get(D.a),U=A.byPkg.get(D.b);if(!E||!U||!ge(E)||!ge(U))continue;let j=D.fromLo&&D.fromHi,Z=!j&&D.fromHi,ie=Z?U:E,re=Z?E:U,X=N!==null&&(D.a===N||D.b===N),ne=ce(E)&&ce(U),oe=N!==null&&!X||ne,le=et(ie),be=et(re),[pe,we]=J(ie.x,ie.y),[ke,Pe]=J(re.x,re.y),Ye=ke-pe,se=Pe-we,$e=Math.sqrt(Ye*Ye+se*se)||1,_e=Ye/$e,Ae=se/$e,Ie=pe+_e*(le+1.5),Re=we+Ae*(le+1.5),ze=ke-_e*(be+3.5),Oe=Pe-Ae*(be+3.5),je=Math.min($e*.15,30),Ke=(Ie+ze)/2-Ae*je,tt=(Re+Oe)/2+_e*je,Fe;ne?Fe=.05:X?Fe=.9:oe?Fe=.06:Fe=.5;let Ve=r.createLinearGradient(Ie,Re,ze,Oe);Ve.addColorStop(0,he(ie.pkg)+Ge(Fe)),Ve.addColorStop(1,he(re.pkg)+Ge(Fe)),r.beginPath(),r.moveTo(Ie,Re),r.quadraticCurveTo(Ke,tt,ze,Oe),r.strokeStyle=Ve,r.lineWidth=Math.min(3.5,.8+Math.sqrt(D.count)*.3)*(X?1.3:1),r.stroke(),!oe&&(de(Ie,Re,Ke,tt,ze,Oe,!1),r.fillStyle=he(re.pkg)+Ge(Math.min(1,Fe+.15)),r.fill(),j&&(de(Ie,Re,Ke,tt,ze,Oe,!0),r.fillStyle=he(ie.pkg)+Ge(Math.min(1,Fe+.15)),r.fill()))}for(let D of A.nodes){if(!ge(D))continue;let[E,U]=J(D.x,D.y),j=et(D),Z=D.pkg===x,ie=D.pkg===H,re=he(D.pkg),X=G(D);if(ie||Z){let ne=j*(ie?2.6:2.2),oe=r.createRadialGradient(E,U,j*.6,E,U,ne);oe.addColorStop(0,re+Ge(ie?.4:.25)),oe.addColorStop(1,re+"00"),r.fillStyle=oe,r.beginPath(),r.arc(E,U,ne,0,Math.PI*2),r.fill()}r.fillStyle=re+Ge(X),r.beginPath(),r.arc(E,U,j,0,Math.PI*2),r.fill(),D.issue&&Te(E,U,j,D.issue,X)}r.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",r.textAlign="center",r.textBaseline="top",r.lineJoin="round";let ee=13,fe=2,ae=[];for(let D of A.nodes){if(!ge(D))continue;let[E,U]=J(D.x,D.y),j=et(D),Z=U+j+4,ie=r.measureText(D.label).width/2+fe,re=D.pkg===H,X=D.pkg===x,ne=re?1/0:X?1e9:D.fileCount;ae.push({p:D,sx:E,ty:Z,isSel:re,isHov:X,prio:ne,x0:E-ie,x1:E+ie,y0:Z,y1:Z+ee})}let ue=Ro(ae);for(let D of ue){let{p:E,sx:U,ty:j,isSel:Z,isHov:ie}=D;r.globalAlpha=Math.max(.25,G(E)),r.shadowColor=b.labelShadow,r.shadowBlur=4,r.strokeStyle=b.labelOutline,r.lineWidth=3,r.strokeText(E.label,U,j),r.shadowBlur=0,r.fillStyle=Z?b.labelSelected:ie?b.labelHover:b.labelDefault,r.fillText(E.label,U,j),r.globalAlpha=1}if(H){let D=A.byPkg.get(H),[E,U]=J(D.x,D.y);r.strokeStyle=b.selectRing,r.lineWidth=1.8,r.beginPath(),r.arc(E,U,et(D)+4,0,Math.PI*2),r.stroke()}q()}function To(b,A){if(R()){let[ae,ue]=ve(b,A),D=null,E=1/0;for(let[U,j]of M.nodes){let Z=(j.x-ae)**2+(j.y-ue)**2;Z<E&&Z<(14/Math.max(s.k,.1))**2&&(E=Z,D=W().nodeByFile.get(U))}return D}if(c()){let[ae,ue]=ve(b,A);for(let D of f.rects.values())if(D.width>0&&ae>=D.x&&ae<D.x+D.width&&ue>=D.y&&ue<=D.y+D.height)return Y().byPkg.get(D.id);return null}let H=F(),N=H?Y():t,C=H&&N.nodes.length<=50;if(N.nodes.length>50){z??=Qn(N.nodes);let ae=4.9*y.nodeSize*Math.max(.6,Math.min(1.6,s.k));return z(b,A,s,ae,ye,ge)}let G=null,ee=1/0,fe=6;for(let ae of N.nodes){if(!ge(ae))continue;let[ue,D]=J(ae.x,ae.y),E=ue-b,U=D-A,j=E*E+U*U,Z=(C?et(ae):ye(ae))+fe;j<Z*Z&&j<ee&&(ee=j,G=ae)}return G}function ci(b,A,H){if(!g)return;let N=he(b.pkg),C=Ne(b.pkg),G=Ft(b.file,b.pkg);ot(O`<div class="g2-tt-path">${G}</div><div class="g2-tt-head"><span class="g2-tt-dot" style="${`background:${N}`}"></span> <span class="g2-tt-pkg">${C}</span></div>${b.totalIssues>0?lt(b.own):null}`,g),Io(A,H)}function di(b,A,H){if(!g)return;let N=he(b.pkg),C=We(b.size);ot(O`<div class="g2-tt-path">${c()?xe(b.pkg):b.label}</div>${R()?O`<div class="g2-tt-pkg">${W().importedBy.get(b.pkg).length} importers · ${W().importsOf.get(b.pkg)?.length??0} dependencies</div>`:null} ${c()?O`<div class="g2-tt-pkg">${f.depth.has(b.pkg)?`Level ${f.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:${N}`}"></span> <span class="g2-tt-pkg">${b.fileCount} ${b.fileCount===1?"file":"files"}${C?` \xB7 ${C}`:""}</span></div>${b.totalIssues>0?lt(b.own):null}`,g),Io(A,H)}function Io(b,A){let H=p.getBoundingClientRect();g.classList.add("show");let N=g.offsetWidth,C=g.offsetHeight,G=b-H.left,ee=A-H.top,fe=H.width,ae=H.height,ue=12,D=G+ue;D+N>fe-4&&(D=G-N-ue),D<4&&(D=4);let E=ee+ue;E+C>ae-4&&(E=ee-C-ue),E<4&&(E=4),g.style.left=`${D}px`,g.style.top=`${E}px`}function qt(){g&&g.classList.remove("show")}let $t=!1,mt=null,Wt=!1,Co=b=>{b.button===0&&(b.target.closest(".g2-stage-overlay, .g2-stage-overlay-tr, .g2-zoom-ctrl")||($t=!0,Wt=!1,mt={x:b.clientX,y:b.clientY,tx:s.tx,ty:s.ty}))},Lo=b=>{let A=p.getBoundingClientRect(),H=b.clientX-A.left,N=b.clientY-A.top;if($t){let ee=b.clientX-mt.x,fe=b.clientY-mt.y;Math.abs(ee)+Math.abs(fe)>3&&(Wt=!0),s.tx=mt.tx+ee,s.ty=mt.ty+fe,qt(),Ee();return}let C=To(H,N),G=x;x=C?.file??null,l.style.cursor=C?"default":"grab",C?F()||T()?di(C,b.clientX,b.clientY):ci(C,b.clientX,b.clientY):G&&qt(),x!==G&&Ee()},Eo=b=>{if($t&&!Wt){let A=p.getBoundingClientRect(),H=b.clientX-A.left,N=b.clientY-A.top,C=To(H,N);F()||T()?(y.solo=C&&y.solo!==C.pkg?C.pkg:null,y.selected=null,o(),n?.()):(y.selected=C?.file??null,o()),Ee()}$t=!1},Po=()=>{let b=x!==null;x=null,qt(),b&&Ee()},zo=b=>{b.preventDefault();let A=p.getBoundingClientRect(),H=b.clientX-A.left,N=b.clientY-A.top,C=Math.exp(-b.deltaY*.0015),G=te();if(C<1&&s.k<=G.k*1.0001){s.k=G.k;let D=Math.min(.4,(1-C)*3);s.tx+=(G.tx-s.tx)*D,s.ty+=(G.ty-s.ty)*D,Ee();return}let[ee,fe]=ve(H,N),ae=Gt(s.k,G.k,R()),ue=Math.max(ae.min,Math.min(ae.max,s.k*C));s.k=ue,s.tx=H-ee*s.k,s.ty=N-fe*s.k,Ee()};p.addEventListener("mousedown",Co),window.addEventListener("mousemove",Lo),window.addEventListener("mouseup",Eo),p.addEventListener("mouseleave",Po),p.addEventListener("wheel",zo,{passive:!1});function Oo(b){let A=Gt(s.k,te().k,R());b=Math.max(A.min,Math.min(A.max,b));let H=m/2,N=w/2,[C,G]=ve(H,N);s.k=b,s.tx=H-C*s.k,s.ty=N-G*s.k,Ee()}let Yt=a.querySelector("#g2-zoom-in"),Kt=a.querySelector("#g2-zoom-out"),ui=a.querySelector("#g2-zoom-fit");Yt?.addEventListener("click",()=>Oo(s.k*1.4)),Kt?.addEventListener("click",()=>Oo(s.k/1.4)),ui?.addEventListener("click",()=>{K(),Ee()}),Se();let Fo=new ResizeObserver(()=>Se());Fo.observe(p);let Bo=new MutationObserver(b=>{for(let A of b){let H=(A.oldValue||"").includes("report-fullscreen"),N=document.body.classList.contains("report-fullscreen");if(H!==N){h=0,_=0,k=!0,v=!0,y.layoutCache=null,setTimeout(()=>Se(),80);return}Ee()}});Bo.observe(document.body,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0}),Ee(),y.graphState={requestDraw:Ee,_cleanup:()=>{Xt=!0,cancelAnimationFrame(De),Fo.disconnect(),Bo.disconnect(),p.removeEventListener("mousedown",Co),window.removeEventListener("mousemove",Lo),window.removeEventListener("mouseup",Eo),p.removeEventListener("mouseleave",Po),p.removeEventListener("wheel",zo)}}}function gl(e,t){let o=document.querySelector("graph-layout")?.shadowRoot;if(!o)return;let n=ni(e),i=o.querySelector("#g2-selection-area");i&&ot(kn(n,t),i);let a=o.querySelector("#g2-focus-overlay-slot");a&&ot(vn(n),a)}function hl(e){let t=document.querySelector("graph-layout")?.shadowRoot;if(!t)return;let o=t.querySelector("#g2-top-pkgs-block");o&&ot(wn(ni(e)),o)}function ni(e){let t=bn(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.reasons=e.reasons??[],t}export{Ni as _swapGraph2Impl,mr as attachGraph2Interaction,ni as buildGraphFromPrep,gl as refreshSidebar,hl as refreshTopPkgs};
12
12
  /*! Bundled license information:
13
13
 
14
14
  lit-html/lit-html.js: