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