@preventive/triage 1.0.0-alpha.85 → 1.0.0-alpha.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/common/bundle-compare-diff.js +3 -2
  2. package/common/dependency-reviews.d.ts +1 -0
  3. package/common/dependency-reviews.js +3 -0
  4. package/common/github-issue-labels.d.ts +3 -1
  5. package/common/github-issue-labels.js +37 -6
  6. package/common/managed/roles.ts +7 -0
  7. package/common/managed/routes.js +7 -6
  8. package/out/activity.js +2 -2
  9. package/out/{chunk-ULI2BIWN.js → chunk-3TJCEPHF.js} +1 -1
  10. package/out/chunk-5LY6QSPD.js +265 -0
  11. package/out/chunk-7PXMWWTQ.js +1 -0
  12. package/out/{chunk-ZQQALNFP.js → chunk-BZJU5EEV.js} +1 -1
  13. package/out/{chunk-YU3IUQY6.js → chunk-PSS7UX5T.js} +1 -1
  14. package/out/chunk-Q2NFBTNH.js +1 -0
  15. package/out/{chunk-CE2FMDK3.js → chunk-TKPNRQNN.js} +1 -1
  16. package/out/{chunk-ZJDDTEL2.js → chunk-WKXQOUNH.js} +2 -2
  17. package/out/{chunk-XHYX3Q34.js → chunk-XRAAYXPR.js} +1 -1
  18. package/out/{chunk-R7HUX4PF.js → chunk-ZKJ7COEH.js} +1 -1
  19. package/out/chunk-ZPIUN4FW.js +55 -0
  20. package/out/client-managed-import.js +1 -1
  21. package/out/client-managed.js +28 -28
  22. package/out/compare.js +13 -13
  23. package/out/dialogs.js +38 -38
  24. package/out/graph.js +1 -1
  25. package/out/index.html +8 -8
  26. package/out/scan.js +2 -2
  27. package/out/view.css +1 -1
  28. package/out/view.js +8 -8
  29. package/package.json +2 -2
  30. package/risk/files/script.js +19 -9
  31. package/server-e2e/config.ts +3 -1
  32. package/server-managed/dependabot-access.ts +41 -17
  33. package/server-managed/dependabot-alerts.ts +19 -2
  34. package/server-managed/github-issues.ts +26 -14
  35. package/server-managed/github-users.ts +23 -0
  36. package/server-managed/http.ts +271 -123
  37. package/server-managed/npm-patch.ts +3 -1
  38. package/server-managed/repository-browser.ts +3 -2
  39. package/server-managed/repository-risk-assess.ts +10 -0
  40. package/out/chunk-7I6SZIJU.js +0 -1
  41. package/out/chunk-EZ62FJ5T.js +0 -266
  42. package/out/chunk-V4U7URJF.js +0 -54
  43. package/out/chunk-WOCJFOXN.js +0 -1
  44. /package/out/{chunk-6WMQVUT2.js → chunk-3YPZ7UBC.js} +0 -0
package/out/dialogs.js CHANGED
@@ -1,40 +1,40 @@
1
- import{a as e,b as t,d as n,e as r,i,j as a}from"./chunk-ZJDDTEL2.js";import{b as o,c as s,d as c,e as l,g as u}from"./chunk-7I6SZIJU.js";import{A as d,d as f,e as p,z as m}from"./chunk-YU3IUQY6.js";import"./chunk-6CCSTJWB.js";import{$ as h,$e as g,Af as ee,Bf as te,C as ne,Cc as re,Cf as ie,D as ae,Dc as _,Df as oe,Ea as se,Ec as ce,Ef as le,Fc as ue,Gc as de,H as fe,Hc as pe,Hf as me,Ic as he,If as ge,J as _e,Jc as ve,Jf as ye,K as v,Kc as be,Kf as xe,Lc as Se,M as Ce,Mc as we,Mf as Te,Mg as Ee,Nc as De,Oc as Oe,Pc as ke,Pf as Ae,Qb as je,S as Me,Tf as Ne,U as Pe,Uf as Fe,Wc as Ie,Xb as Le,Xf as Re,Ya as ze,Yf as Be,Za as Ve,Zf as y,_ as He,_f as Ue,aa as We,b as Ge,ba as Ke,bb as qe,ca as Je,cf as Ye,cg as Xe,d as Ze,da as Qe,db as b,df as $e,dg as et,e as tt,ea as nt,eb as x,f as rt,fa as it,fb as S,fg as at,gb as C,gg as ot,h as st,hb as ct,hg as lt,i as ut,ib as dt,ig as ft,jb as w,jg as pt,kb as mt,l as ht,lg as gt,mb as T,nc as _t,oc as vt,oe as yt,pe as bt,qa as xt,ra as St,rf as Ct,u as E,ub as wt,v as Tt,vb as Et,vc as Dt,w as Ot,wb as kt,x as At,xa as jt,xb as Mt,y as Nt,ya as Pt,yb as Ft,zb as It,zf as Lt}from"./chunk-EZ62FJ5T.js";import"./chunk-A4BBBHQU.js";import"./chunk-6WMQVUT2.js";import"./chunk-VYYUMYVW.js";import"./chunk-7HP2VYIC.js";import"./chunk-N57OWFKY.js";import"./chunk-7YFJUT2P.js";import"./chunk-PXK7EU4V.js";import{h as Rt,i as zt}from"./chunk-XHYX3Q34.js";import{Wa as Bt,b as D,m as Vt,n as Ht}from"./chunk-V4U7URJF.js";import{a as Ut}from"./chunk-KP2XM324.js";import"./chunk-DUASGS2O.js";import"./chunk-NRPC74AM.js";import"./chunk-7BKKYVWR.js";import"./chunk-7C7DWL7I.js";import"./chunk-PNHBZGDD.js";import{a as O}from"./chunk-R5O6FAW4.js";import{$ as k,Ga as Wt,U as Gt,aa as Kt,e as qt,ja as Jt}from"./chunk-ULI2BIWN.js";import"./chunk-CE2FMDK3.js";import"./chunk-74JZTGTO.js";import{e as Yt}from"./chunk-IYPY47MC.js";import{E as Xt,F as Zt,d as A}from"./chunk-G5JKKNZF.js";import{a as j,d as Qt}from"./chunk-PWFUOLZK.js";import"./chunk-C4Z6ZBXV.js";import{n as $t,s as M}from"./chunk-ZQQALNFP.js";import{B as en,J as tn,L as nn,b as rn,k as an,p as on,v as N}from"./chunk-QRKFPLA4.js";import{a as P,c as F,d as sn,g as I}from"./chunk-2XUEZHIP.js";import"./chunk-TUII34K2.js";import"./chunk-OOJM4CTU.js";var cn=`.inline-quote{background:rgb(from var(--accent) r g b / .1);padding:1px;border-radius:3px;color:var(--text)}.inline-code{background:var(--surface-active);border-radius:3px;border:1px solid var(--border);padding:0 .25em;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.9em;color:var(--text)}.para+.para{margin-top:.5lh}.md-list{margin:0;padding-inline-start:1.2em}.md-list li+li{margin-top:.25lh}.para+.md-list,.md-list+.para,.md-list+.md-list{margin-top:.5lh}.md-list li::marker{color:rgb(from currentcolor r g b / .45)}.md-list li.md-task{list-style:none;position:relative}.md-task>input{position:absolute;inset-inline-start:-1.2em;top:calc((1lh - .9em)/2);width:.9em;height:.9em;margin:0;font:inherit}.md-heading{font-weight:600}.md-heading:is([aria-level="1"],[aria-level="2"]){font-size:1.15em}.md-heading:not(:first-child){margin-top:.75lh}.md-heading+*{margin-top:.25lh}.md-rule{margin:.75lh 0;border:0;border-top:1px solid var(--border)}.code-block:not(.token){white-space:normal;margin:.4rem 0;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:rgb(from var(--text) r g b / .05);overflow:hidden;width:fit-content;max-width:100%;.code-block-lang{padding:.15rem .5rem;border-bottom:1px solid var(--border);color:var(--muted);font-size:.62rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em}& pre{margin:0;padding:.4rem .55rem;overflow-x:auto;white-space:pre;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.95em;line-height:1.5;color:var(--text)}& code{font:inherit}}
2
- `,ln=`dialog{width:min(94vw,80rem);max-width:none;max-height:90dvh;margin:auto;padding:0;overflow:hidden}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:start;gap:1rem;flex-shrink:0;padding:.8rem 1rem;border-bottom:1px solid var(--border)}header h3{display:flex;align-items:baseline;gap:.6rem;flex:1;min-width:0;margin:0;overflow-wrap:anywhere}header h3>span:last-child{min-width:0}header button{flex-shrink:0;border:0;background:transparent;color:var(--muted);font-family:inherit;font-size:1.4rem;line-height:1;padding:0 .25rem}header button:hover{color:var(--text)}.advisory-description{min-height:0;padding:1rem;overflow:auto;overscroll-behavior:contain;white-space:pre-wrap;overflow-wrap:anywhere;font-size:.85rem;line-height:1.6}a{color:var(--accent)}button:focus-visible,.advisory-description:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
3
- `,un=class extends b{static styles=[...b.styles,P(cn),P(e),P(t),P(C),P(ln)];static properties={heading:{attribute:!1},severity:{attribute:!1},_body:{state:!0}};connectedCallback(){super.connectedCallback(),this._dispose=D(()=>{this.isCurrent()?this._body=Ie(Gt(this.markdown)):(this._body=I,queueMicrotask(this._onClose))})}disconnectedCallback(){this._dispose?.(),super.disconnectedCallback()}render(){return F`<dialog aria-labelledby="advisory-title" @close="${this._onClose}"><header><h3 id="advisory-title">${ct(this.severity===`unknown`?`unrated`:this.severity)}<span>${this.heading}</span></h3><button type="button" aria-label="Close advisory details" @click="${this._onClose}">×</button></header><div class="advisory-description" tabindex="0">${this._body}</div></dialog>`}};customElements.define(`advisory-details-dialog`,un);function dn(e){return x(`advisory-details-dialog`,e)}var fn=`dialog{max-width:640px;width:min(94vw,640px)}header h3{margin:0 0 .4rem}.finding{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin-bottom:.35rem}.loc{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.76rem;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1}.desc{font-size:.78rem;color:var(--muted);margin:0 0 .7rem;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}textarea{display:block;width:100%;min-height:9rem;max-height:50vh;resize:vertical;padding:.55rem .65rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:var(--bg);color:var(--text);font:inherit;font-size:.88rem;line-height:1.4;&:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgb(from var(--accent) r g b / .18)}&::placeholder{color:var(--muted)}}
4
- `,pn=class extends b{static styles=[...b.styles,P(C),P(fn)];static properties={_value:{state:!0}};constructor(){super(),this._value=``}beforeOpen(){this._value=this.initial}focusInitial(){let e=this.renderRoot.querySelector(`textarea`);if(e){e.focus();try{e.setSelectionRange(e.value.length,e.value.length)}catch{}}}_onInput=e=>{this._value=e.target.value};_onSave=()=>{let e=this._value.trim();this._finish(e===this.initial.trim()?null:e)};_onKeydown=e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this._onSave())};render(){let e=this.initial.length>0;return F`<dialog @close="${this._onClose}"><header><h3>${e?`Edit comment`:`Add comment`}</h3>${dt(this.finding??{})}</header><textarea rows="6" placeholder="Write your notes here. Markdown is not rendered. Ctrl/⌘+Enter to save, Esc to cancel." .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"></textarea><footer class="nwd-actions">${e?F`<button type="button" class="danger" @click="${()=>this._finish(``)}">Clear</button>`:I} <span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onSave}">Save</button></footer></dialog>`}};customElements.define(`comment-dialog`,pn);function mn({initial:e=``,finding:t=null}={}){return x(`comment-dialog`,{initial:e??``,finding:t})}var L=`.lwd-body{margin:.2rem 0 .55rem;color:var(--text);font-size:.86rem;line-height:1.5}.lwd-empty{margin:.2rem 0 .55rem;color:var(--muted);font-size:.78rem}.lwd-note{margin:.2rem 0 .65rem;padding:.55rem .7rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:rgb(from var(--text) r g b / .03);color:var(--muted);font-size:.78rem;line-height:1.45}.lwd-choice{margin:.2rem 0 .65rem;padding:.55rem .7rem .6rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:rgb(from var(--text) r g b / .03);& legend{padding:0 .35rem;color:var(--text);font-size:.78rem;font-weight:500;& strong{font-weight:600}}}.lwd-option{display:flex;align-items:flex-start;gap:.5rem;padding:.3rem .15rem;& input[type=radio]{margin:.15rem 0 0;accent-color:var(--accent)}.lwd-option-text{display:flex;flex-direction:column;gap:.1rem;min-width:0}.lwd-option-title{color:var(--text);font-size:.82rem;line-height:1.35}.lwd-option-hint{color:var(--muted);font-size:.72rem;line-height:1.4}}.lwd-list{padding-left:1.1rem;color:var(--muted);font-size:.76rem;line-height:1.5;& li+li{margin-top:.2rem}& strong{color:var(--text);font-weight:600}}.lwd-kind-tag{display:inline-block;vertical-align:middle;margin-left:.3rem;padding:0 .35rem;border:1px solid var(--border);border-radius:3px;background:rgb(from var(--text) r g b / .04);color:var(--muted);font-size:.62rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em}.lwd-rename-input{margin-top:.2rem}.lwd-rename-error{margin:.25rem 0 0;color:var(--critical);font-size:.72rem;line-height:1.35}
5
- `,R=class extends b{static styles=[...b.styles,P(L)];firstUpdated(){this.signal?.aborted?this._onCancel():(this.signal?.addEventListener(`abort`,this._onCancel,{once:!0}),super.firstUpdated())}disconnectedCallback(){this.signal?.removeEventListener(`abort`,this._onCancel),super.disconnectedCallback()}focusInitial(){this.renderRoot.querySelector(`button[data-role="cancel"]`)?.focus()}confirmationResult(e){return{confirmed:e&&!this.signal?.aborted}}_finish(e){this._settled||super._finish(this.confirmationResult(!!e))}_onClose=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);prompt({title:e,titleId:t,body:n,notes:r=I,action:i,kind:a=`danger`,disabled:o=!1,cancel:s=`Cancel`,status:c=I}){return F`<dialog aria-labelledby="${t??I}" @close="${this._onClose}"><header><h3 id="${t??I}">${e}</h3></header><p class="lwd-body">${n}</p>${r}<footer class="nwd-actions">${c}<span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">${s}</button> ${i?F`<button type="button" class="${a}" ?disabled="${o}" @click="${this._onConfirm}">${i}</button>`:I}</footer></dialog>`}},z=(e,t=!1)=>F`<p class="lwd-note">This ${e} is also stored in the workspace's <strong>remote</strong> inventory and will be removed from there too. Newly synced workspace members won't see it; members who already downloaded it keep their local copy (and could re-upload).${t?` The ${e} bytes stay on this device \u2014 drop it onto another workspace to attach it there.`:``}</p>`,B=({name:e,value:t,current:n,change:r,title:i},a)=>F`<label class="lwd-option"><input type="radio" name="${e}" value="${t}" ?checked="${n===t}" @change="${r}"> <span class="lwd-option-text"><span class="lwd-option-title">${i}</span> ${a}</span></label>`,V=e=>F`<span class="lwd-option-hint">${e}</span>`;function hn({name:e,orphaned:t,shared:n,current:r,change:i,subject:a,sharedSubject:o=a}){if(t===0)return F`<p class="lwd-note">${n===0?`No local triage is attached to ${a}.`:`Local triage on ${o} is also attached to ${n===1?`a report`:`reports`} you're keeping. Nothing will be orphaned.`}</p>`;let s=t===1;return F`<fieldset class="lwd-choice"><legend><strong>${t}</strong> ${s?`triage entry won't`:`triage entries won't`} be reachable from any remaining report. What should happen ${s?`to it`:`to them`}?</legend>${B({name:e,value:`keep`,current:r,change:i,title:`Keep`},V(`Reapplied automatically if a matching report is imported later.`))} ${B({name:e,value:`wipe`,current:r,change:i,title:`Wipe`},V(`Drop the orphaned triage from this browser.`))}</fieldset>`}var gn=class extends R{render(){return this.prompt({title:`Delete bundle`,action:`Delete`,body:F`Delete <strong>"${this.bundleName}"</strong>?`,notes:this.inRemote?z(`bundle`):I})}};customElements.define(`delete-bundle-dialog`,gn);function _n({name:e,inRemote:t}={}){return x(`delete-bundle-dialog`,{bundleName:e??``,inRemote:!!t})}var vn=class extends R{static properties={_triage:{state:!0}};constructor(){super(),this._triage=`keep`}confirmationResult(e){return{confirmed:e,triage:this.orphanedTriage>0?this._triage:`keep`}}_onTriageChange=e=>{this._triage=e.target.value};render(){return this.prompt({title:`Delete ${this.kindLabel}`,action:`Delete`,body:F`Delete <strong>"${this.reportName}"</strong>?`,notes:F`${this.inRemote?z(`report`):I} ${hn({name:`drd-triage`,orphaned:this.orphanedTriage,shared:this.sharedTriage,current:this._triage,change:this._onTriageChange,subject:`this ${this.kindLabel}`,sharedSubject:`this report`})}`})}};customElements.define(`delete-report-dialog`,vn);function yn({name:e,kindLabel:t,triageImpact:n,inRemote:r}={}){return x(`delete-report-dialog`,{reportName:e??``,kindLabel:t||`report`,orphanedTriage:n?.orphanedCount??0,sharedTriage:n?.sharedCount??0,inRemote:!!r})}var bn=class extends R{render(){return this.prompt({title:`Detach bundle`,action:`Detach`,notes:z(`bundle`,!0),body:F`Detach <strong>"${this.bundleName}"</strong> from workspace <strong>"${this.workspaceName}"</strong>?`})}};customElements.define(`detach-bundle-dialog`,bn);function xn({name:e,workspaceName:t}={}){return x(`detach-bundle-dialog`,{bundleName:e??``,workspaceName:t??``})}var Sn=class extends R{render(){return this.prompt({title:`Detach report`,action:`Detach`,notes:z(`report`,!0),body:F`Detach <strong>"${this.reportName}"</strong> from workspace <strong>"${this.workspaceName}"</strong>?`})}};customElements.define(`detach-report-dialog`,Sn);function Cn({name:e,workspaceName:t}={}){return x(`detach-report-dialog`,{reportName:e??``,workspaceName:t??``})}var wn=class extends R{render(){return this.prompt({title:`Discard unpublished review?`,titleId:`discard-review-title`,action:`Discard review`,body:F`<strong>${this.reviewTitle}</strong>`,notes:F`<p class="lwd-note">This permanently deletes this review and all its file verdicts and notes. This cannot be undone.</p>`})}};customElements.define(`discard-review-dialog`,wn);function Tn(e){return x(`discard-review-dialog`,e)}var En=class extends R{render(){return this.prompt({title:`Download bundle`,action:`Download`,kind:`primary`,body:F`Download <strong>"${this.bundleName}"</strong> to disk?`,notes:this.encrypted?F`<p class="lwd-note">The bundle is saved <strong>unencrypted</strong> — even though your vault keeps its stored copy encrypted — and the file contains <strong>all of the bundle's related sources</strong>. Anyone with access to the downloaded file can read every bundled source, so store or share it with care.</p>`:F`<p class="lwd-note">The downloaded file is <strong>unencrypted</strong> and contains <strong>all of the bundle's related sources</strong>. Anyone with access to it can read every bundled source, so store or share it with care.</p>`})}};customElements.define(`download-bundle-dialog`,En);function Dn({name:e,encrypted:t}={}){return x(`download-bundle-dialog`,{bundleName:e??``,encrypted:!!t})}var On=`dialog{max-width:515px;width:min(94vw,515px)}.ecd-count{font-size:1.02rem;color:var(--text);& strong{color:var(--accent);font-weight:700}}.ecd-excluded{margin:.25rem 0 0;color:var(--muted);font-size:.82rem}.ecd-filters{margin:.9rem 0 0;display:grid;grid-template-columns:auto minmax(0,1fr);gap:.3rem .7rem;font-size:.82rem}.ecd-filters dt{color:var(--muted);font-weight:600;white-space:nowrap}.ecd-filters dd{display:flex;align-items:baseline;gap:.5rem;color:var(--text);overflow-wrap:anywhere}.ecd-filter-value{min-width:0}.ecd-filter-drop{margin-left:auto;flex:none;padding:0 .2rem;border:0;border-radius:var(--ui-radius, 4px);background:none;color:var(--muted);font:inherit;font-size:1rem;line-height:1;&:hover{color:var(--critical)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}.ecd-filters-label{margin:.9rem 0 0;font-size:.76rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}.ecd-filters-label+.ecd-filters{margin-top:.35rem}.ecd-samples{display:flex;align-items:flex-start;gap:.5rem;margin-top:1rem;font-size:.82rem;color:var(--text)}.ecd-samples input{margin-top:.15rem;accent-color:var(--accent)}.ecd-samples-hint{display:block;margin-top:.2rem;color:var(--muted);font-size:.76rem}
6
- `,kn=`.dlg-tabs{display:flex;gap:.1rem;margin:0 0 .55rem;border-bottom:1px solid var(--border)}.dlg-tab{display:inline-flex;align-items:center;gap:.35rem;background:transparent;border:none;color:var(--muted);padding:.1rem .6rem .4rem;font:inherit;font-size:.85rem;font-weight:600;border-bottom:2px solid transparent;margin-bottom:-1px;transition:color .12s,border-color .12s;&:first-child{padding-left:0}&:hover:not(:disabled){color:var(--text)}&[aria-selected=true]{color:var(--accent);border-bottom-color:var(--accent)}&:disabled{opacity:.5}& svg{display:block}}
7
- `,An=[{id:`download`,label:`Markdown`,icon:n},{id:`print`,label:`Print`,icon:r}],jn=class extends b{static styles=[...b.styles,P(On),P(kn)];static properties={mode:{type:String},included:{type:Number},excluded:{type:Number},total:{type:Number},filters:{attribute:!1},fields:{attribute:!1},bucketLabel:{type:String},focusedOnly:{type:Boolean},oneSamplePerGroup:{type:Boolean}};constructor(){super(),this.mode=`download`,this.filters=[],this.fields=null,this._relaxed=!1,this.bucketLabel=null,this.focusedOnly=!1,this.oneSamplePerGroup=!1}get _focusedOnly(){return this.mode===`print`&&this.focusedOnly}focusInitial(){this.renderRoot.querySelector(this.included===0?`button[data-role="cancel"]`:`button.primary`)?.focus()}_finish(e){this._settled||super._finish({confirmed:e===`confirm`,view:e===`view`,fields:this._relaxed?this.fields:null,mode:this.mode,oneSamplePerGroup:this.oneSamplePerGroup})}_onClose=()=>this._finish(`cancel`);_onView=()=>this._finish(`view`);_onConfirm=()=>this._finish(`confirm`);async _onDropFilter(e){let t=this.filters.findIndex(t=>t.key===e);if(t===-1)return;let{fields:n,filters:r,included:a,excluded:o,total:s}=i(this.mode,{...this.fields,...this.filters[t].clear});Object.assign(this,{_relaxed:!0,fields:n,filters:r,included:a,excluded:o,total:s}),await this.updateComplete;let c=[...this.renderRoot.querySelectorAll(`button[data-drop]`)];(c[Math.min(t,c.length-1)]??this.renderRoot.querySelector(`button.primary`)??this.renderRoot.querySelector(`button[data-role="cancel"]`))?.focus()}_countSection(){let e=this.mode===`print`;if(this.total===0)return F`<p class="ecd-count">No findings to ${e?`print`:`download`}.</p>`;if(this._focusedOnly&&this.included>0)return F`<p class="ecd-count">Only the <strong>focused</strong> finding will be printed.</p><p class="ecd-excluded">Focus mode prints just the finding you're viewing. Switch to the list or grouped view to print all ${this.included} matching ${this.included===1?`finding`:`findings`}.</p>`;let t=this.excluded===0&&this.filters.length===0?F`All <strong>${this.included}</strong> ${this.included===1?`finding`:`findings`} included.`:F`<strong>${this.included}</strong> of ${this.total} ${this.total===1?`finding`:`findings`} included.`;return F`<p class="ecd-count">${t}</p>${this.excluded>0?F`<p class="ecd-excluded">${this.excluded} filtered out and ${e?`won't be printed`:`won't be downloaded`}.</p>`:I}`}_filtersSection(){return this.filters.length===0?F`<p class="ecd-filters-label">No filters active — the full ${this.bucketLabel?`${this.bucketLabel.toLowerCase()} `:``}set is included.</p>`:F`<p class="ecd-filters-label">Active filters</p><dl class="ecd-filters">${this.filters.map(e=>F`<dt>${e.label}</dt><dd><span class="ecd-filter-value">${e.value}</span> <button type="button" class="ecd-filter-drop" data-drop="${e.key}" aria-label="${`Drop the ${e.label.toLowerCase()} filter (${e.value}) from this export`}" @click="${()=>this._onDropFilter(e.key)}">×</button></dd>`)}</dl>`}render(){let e=this.mode===`print`,t=this._focusedOnly?`You're in focus mode — printing outputs just the finding you're focused on.`:e?`Prints only the findings matching your current filters — the same set shown on screen. Use the toolbar to change the selection first.`:`Downloads a Markdown file of the findings matching your current filters — the same set shown on screen. Use the toolbar to change the selection first.`;return F`<dialog @close="${this._onClose}"><header>${gt({tabs:An,current:this.mode,prefix:`ecd`,select:e=>{this.mode=e}})}</header><div role="tabpanel" id="${`ecd-panel-${this.mode}`}" aria-labelledby="${`ecd-tab-${this.mode}`}"><p class="nwd-intro">${t}</p>${this._countSection()} ${this.bucketLabel?F`<p class="nwd-note">Scoped to the <strong>${this.bucketLabel}</strong> list — live findings are not included.</p>`:I} ${this._filtersSection()} <label class="ecd-samples"><input type="checkbox" .checked="${this.oneSamplePerGroup}" @change="${e=>{this.oneSamplePerGroup=e.target.checked}}"> <span>One sample per group<span class="ecd-samples-hint">Include only the currently selected sample from each group.</span></span></label></div><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> ${e?I:F`<button type="button" data-role="view" ?disabled="${this.included===0}" @click="${this._onView}">View</button>`} <button type="button" class="primary" ?disabled="${this.included===0}" @click="${this._onConfirm}">${e?`Print`:`Download`}</button></footer></dialog>`}};customElements.define(`export-confirm-dialog`,jn);function Mn(e=`download`){let{included:t,excluded:n,total:r,filters:a,fields:o,bucketLabel:s,...c}=i(e),l=e===`print`?c.focusedOnly:i(`print`).focusedOnly;return x(`export-confirm-dialog`,{mode:e,included:t,excluded:n,total:r,filters:a,fields:o,bucketLabel:s,focusedOnly:l},{conflict:()=>({confirmed:!1,view:!1,fields:null,mode:e})})}var Nn=160,Pn=320,Fn=/^ {0,3}#{1,6}(?: |$)/u,In=/^ {0,3}(?:=+|-+) *$/u,H=/^\|?[^|\n]+(?:\|[^|\n]+)+\|?$/u,Ln=/^\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?$/u;function Rn(e,t=e.join(`
8
- `),{target:n=Nn,max:r=Pn}={}){let i=e.length;if(i===0)return[];let a=rn(t),o=0,s=0,c=()=>{for(;o<a.length&&a[o][1]<=s-1;)o++;return o<a.length&&s-1>=a[o][0]},l=t=>e[t].trim()===``,u=t=>H.test(e[t]),d=t=>!c()&&!(Ln.test(e[t])&&u(t-1))&&!(In.test(e[t])&&!l(t-1)),f=t=>l(t-1)||Fn.test(e[t]),p=[],m=0;for(let t=1;t<i;t++){s+=e[t-1].length+1;let i=t-m;i<n||!d(t)||(i>=r||f(t))&&(p.push([m,t]),m=t)}return p.push([m,i]),p}function zn(e,t){if(t<2||!H.test(e[t])||!H.test(e[t-1]))return null;let n=t-1;for(;n>0&&H.test(e[n-1]);)n--;for(let r=n+1;r<t;r++)if(Ln.test(e[r]))return[r-1,r+1];return null}function Bn(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}var Vn=`dialog{max-width:none;max-height:none;width:calc(100vw - 4rem);height:calc(100vh - 4rem);margin:2rem auto;position:relative;padding:12px}dialog[open]{display:flex;flex-direction:column}dialog::backdrop{backdrop-filter:none}header{display:flex;align-items:center;gap:.45rem;margin-bottom:.6rem;padding-right:3rem;user-select:none}header h3{margin:0}.evd-close{position:absolute;top:6px;right:6px;z-index:1;width:22px;height:22px;display:grid;place-items:center;background:transparent;border:0;border-radius:var(--ui-radius, 4px);color:var(--muted);font:500 16px/1 ui-monospace,monospace;cursor:default;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}.evd-code{flex:1 1 auto;min-height:0;overflow:auto;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:var(--bg);color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.78rem;line-height:1.55;scrollbar-width:thin;scrollbar-color:var(--border) transparent;&::-webkit-scrollbar{width:6px;height:6px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}}.evd-lines{--evd-gutter: calc(var(--evd-lineno-width, 3ch) + 1.4rem);padding:.5rem 0;background-image:linear-gradient(to right,rgb(from var(--text) r g b / .03) 0 calc(var(--evd-gutter) - 1px),var(--border) calc(var(--evd-gutter) - 1px) var(--evd-gutter),transparent var(--evd-gutter))}.evd-chunk{display:grid;grid-template-columns:var(--evd-gutter) minmax(0,1fr);align-items:start;content-visibility:auto;contain-intrinsic-size:auto calc(var(--evd-chunk-lines, 1) * 1.55em)}.evd-chunk.evd-pending{display:block;padding:0 .75rem 0 calc(var(--evd-gutter) + .6rem);white-space:pre-wrap;overflow-wrap:anywhere}.evd-lineno{padding:0 .55rem 0 .4rem;color:var(--muted);text-align:right;font-variant-numeric:tabular-nums;user-select:none}.evd-line{padding:0 .75rem 0 .6rem;font:inherit;background:none;white-space:pre-wrap;overflow-wrap:anywhere}.evd-meta{color:var(--muted);font-size:.74rem;font-variant-numeric:tabular-nums}.evd-copy{margin-left:auto;flex-shrink:0;height:1.75rem;padding:0 .55rem;gap:.35rem;display:inline-flex;align-items:center;background:transparent;color:var(--muted);border:1px solid var(--border);border-radius:var(--ui-radius, 3px);font:inherit;font-size:.72rem;font-weight:500;letter-spacing:.02em;cursor:default;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}&.evd-done{color:var(--green);background:color-mix(in srgb,var(--green) 14%,transparent)}&.evd-failed{color:var(--critical);background:color-mix(in srgb,var(--critical) 14%,transparent)}}
9
- `,Hn=F`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><rect x="3" y="2.5" width="8" height="10" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><rect x="5.5" y="5" width="8" height="9" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`;function Un(e,t,n,r=null){let i=``;for(let a=t;a<n;a++){let n=r===null?Bn(e[a]):r[a-t];i+=`<span class="evd-lineno" aria-hidden="true">${a+1}</span><code class="evd-line">${n}
10
- </code>`}return i}var Wn=class extends b{static styles=[...b.styles,P(t),P(Vn)];static properties={markdown:{attribute:!1},_copied:{state:!0}};_lines=[];_kb=`0.0`;_chunks=[];_copiedTimer=null;constructor(){super(),this.markdown=``,this._copied=``}focusInitial(){this.renderRoot.querySelector(`button[data-role="cancel"]`)?.focus()}willUpdate(e){if(!e.has(`markdown`))return;let t=this.markdown.split(`
11
- `),n=t.length>1&&t.at(-1)===``?t.length-1:t.length;this._lines=t.slice(0,n),this._kb=(new TextEncoder().encode(this.markdown).length/1024).toFixed(1),this._chunks=Rn(this._lines,this.markdown).map(([e,t])=>({start:e,end:t,asked:!1}))}render(){let e=this._lines.length,t=this._copied===`done`?`Copied`:this._copied===`failed`?`Copy failed`:`Copy`,n=this._copied===`failed`?`Select the text and copy it by hand`:I;return F`<dialog @close="${this._onClose}"><button type="button" class="evd-close" data-role="cancel" aria-label="Close" @click="${this._onClose}">×</button><header><h3>Report markdown</h3><span class="evd-meta">· ${e} ${e===1?`line`:`lines`} · ${this._kb} KB</span> <button type="button" class="evd-copy ${this._copied===`done`?`evd-done`:this._copied===`failed`?`evd-failed`:``}" data-role="copy" data-tooltip="${n}" @click="${this._onCopy}">${Hn}${t}</button></header><div class="evd-code" tabindex="0"><div class="evd-lines" style="${j({"--evd-lineno-width":`${String(e).length}ch`})}">${this._chunks.map((e,t)=>F`<div class="evd-chunk evd-pending" data-chunk="${t}" style="${j({"--evd-chunk-lines":`${e.end-e.start}`})}"></div>`)}</div></div></dialog>`}updated(){if(this.isConnected)for(let e of this.renderRoot.querySelectorAll(`.evd-chunk:not([data-watched])`)){e.dataset.watched=``;let t=Number(e.dataset.chunk),n=this._chunks[t];e.textContent=`${this._lines.slice(n.start,n.end).join(`
1
+ import{a as e,b as t,d as n,e as r,i,j as a}from"./chunk-WKXQOUNH.js";import{b as o,c as s,d as c,e as l,g as u}from"./chunk-Q2NFBTNH.js";import{A as d,d as f,e as p,z as m}from"./chunk-PSS7UX5T.js";import"./chunk-6CCSTJWB.js";import{$ as h,$a as g,Ac as ee,Bc as te,C as ne,Cc as re,Cf as _,D as ie,Dc as ae,Ec as oe,Fc as se,Gb as ce,Gf as le,H as ue,Hf as de,J as fe,K as v,Kf as pe,Lf as me,M as he,Mc as ge,Mf as y,Nb as _e,Nf as ve,Oa as ye,Oe as b,Pa as be,Re as xe,Rf as Se,S as Ce,Se as we,Sf as Te,Ta as Ee,U as De,Uf as Oe,Va as x,Vf as ke,Wa as S,Wf as Ae,Xa as C,Xf as je,Ya as w,Yf as Me,Za as Ne,_ as Pe,_a as Fe,_f as Ie,aa as Le,ab as Re,b as ze,ba as Be,ca as Ve,cb as T,d as He,da as Ue,dc as We,e as Ge,ea as Ke,ec as qe,ee as Je,ef as Ye,f as Xe,fa as Ze,fe as Qe,h as $e,i as et,kb as tt,l as nt,lb as rt,lc as it,ma as at,mb as ot,mf as st,na as ct,nb as lt,nf as ut,ob as dt,of as ft,pb as pt,pf as mt,qf as ht,rf as gt,sc as _t,ta as vt,tc as E,u as D,uc as yt,uf as bt,v as xt,vc as St,vf as Ct,w as wt,wc as Tt,wf as Et,x as Dt,xc as Ot,xf as kt,y as At,yc as jt,zc as Mt,zf as Nt,zg as Pt}from"./chunk-5LY6QSPD.js";import"./chunk-A4BBBHQU.js";import"./chunk-3YPZ7UBC.js";import"./chunk-VYYUMYVW.js";import"./chunk-7HP2VYIC.js";import"./chunk-N57OWFKY.js";import"./chunk-7YFJUT2P.js";import"./chunk-PXK7EU4V.js";import{h as Ft,i as It}from"./chunk-XRAAYXPR.js";import{C as Lt,D as Rt,b as O,kb as zt,u as k,w as Bt}from"./chunk-ZPIUN4FW.js";import{a as Vt}from"./chunk-KP2XM324.js";import"./chunk-DUASGS2O.js";import"./chunk-NRPC74AM.js";import"./chunk-7BKKYVWR.js";import"./chunk-7C7DWL7I.js";import"./chunk-PNHBZGDD.js";import{a as A}from"./chunk-R5O6FAW4.js";import{$ as j,Ga as Ht,U as Ut,aa as Wt,e as Gt,ja as Kt}from"./chunk-3TJCEPHF.js";import"./chunk-TKPNRQNN.js";import"./chunk-74JZTGTO.js";import{e as qt}from"./chunk-IYPY47MC.js";import{E as Jt,F as Yt,d as M}from"./chunk-G5JKKNZF.js";import{a as N,d as Xt}from"./chunk-PWFUOLZK.js";import"./chunk-C4Z6ZBXV.js";import{n as Zt,s as P}from"./chunk-BZJU5EEV.js";import{B as Qt,J as $t,L as en,b as tn,k as nn,p as rn,v as F}from"./chunk-QRKFPLA4.js";import{a as I,c as L,d as an,g as R}from"./chunk-2XUEZHIP.js";import"./chunk-TUII34K2.js";import"./chunk-OOJM4CTU.js";var on=`.inline-quote{background:rgb(from var(--accent) r g b / .1);padding:1px;border-radius:3px;color:var(--text)}.inline-code{background:var(--surface-active);border-radius:3px;border:1px solid var(--border);padding:0 .25em;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.9em;color:var(--text)}.para+.para{margin-top:.5lh}.md-list{margin:0;padding-inline-start:1.2em}.md-list li+li{margin-top:.25lh}.para+.md-list,.md-list+.para,.md-list+.md-list{margin-top:.5lh}.md-list li::marker{color:rgb(from currentcolor r g b / .45)}.md-list li.md-task{list-style:none;position:relative}.md-task>input{position:absolute;inset-inline-start:-1.2em;top:calc((1lh - .9em)/2);width:.9em;height:.9em;margin:0;font:inherit}.md-heading{font-weight:600}.md-heading:is([aria-level="1"],[aria-level="2"]){font-size:1.15em}.md-heading:not(:first-child){margin-top:.75lh}.md-heading+*{margin-top:.25lh}.md-rule{margin:.75lh 0;border:0;border-top:1px solid var(--border)}.code-block:not(.token){white-space:normal;margin:.4rem 0;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:rgb(from var(--text) r g b / .05);overflow:hidden;width:fit-content;max-width:100%;.code-block-lang{padding:.15rem .5rem;border-bottom:1px solid var(--border);color:var(--muted);font-size:.62rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em}& pre{margin:0;padding:.4rem .55rem;overflow-x:auto;white-space:pre;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.95em;line-height:1.5;color:var(--text)}& code{font:inherit}}
2
+ `,sn=`dialog{width:min(94vw,80rem);max-width:none;max-height:90dvh;margin:auto;padding:0;overflow:hidden}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:start;gap:1rem;flex-shrink:0;padding:.8rem 1rem;border-bottom:1px solid var(--border)}header h3{display:flex;align-items:baseline;gap:.6rem;flex:1;min-width:0;margin:0;overflow-wrap:anywhere}header h3>span:last-child{min-width:0}header button{flex-shrink:0;border:0;background:transparent;color:var(--muted);font-family:inherit;font-size:1.4rem;line-height:1;padding:0 .25rem}header button:hover{color:var(--text)}.advisory-description{min-height:0;padding:1rem;overflow:auto;overscroll-behavior:contain;white-space:pre-wrap;overflow-wrap:anywhere;font-size:.85rem;line-height:1.6}a{color:var(--accent)}button:focus-visible,.advisory-description:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
3
+ `,cn=class extends x{static styles=[...x.styles,I(on),I(e),I(t),I(w),I(sn)];static properties={heading:{attribute:!1},severity:{attribute:!1},_body:{state:!0}};connectedCallback(){super.connectedCallback(),this._dispose=O(()=>{this.isCurrent()?this._body=ge(Ut(this.markdown)):(this._body=R,queueMicrotask(this._onClose))})}disconnectedCallback(){this._dispose?.(),super.disconnectedCallback()}render(){return L`<dialog aria-labelledby="advisory-title" @close="${this._onClose}"><header><h3 id="advisory-title">${Ne(this.severity===`unknown`?`unrated`:this.severity)}<span>${this.heading}</span></h3><button type="button" aria-label="Close advisory details" @click="${this._onClose}">×</button></header><div class="advisory-description" tabindex="0">${this._body}</div></dialog>`}};customElements.define(`advisory-details-dialog`,cn);function ln(e){return S(`advisory-details-dialog`,e)}var un=`dialog{max-width:640px;width:min(94vw,640px)}header h3{margin:0 0 .4rem}.finding{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin-bottom:.35rem}.loc{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.76rem;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1}.desc{font-size:.78rem;color:var(--muted);margin:0 0 .7rem;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}textarea{display:block;width:100%;min-height:9rem;max-height:50vh;resize:vertical;padding:.55rem .65rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:var(--bg);color:var(--text);font:inherit;font-size:.88rem;line-height:1.4;&:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgb(from var(--accent) r g b / .18)}&::placeholder{color:var(--muted)}}
4
+ `,dn=class extends x{static styles=[...x.styles,I(w),I(un)];static properties={_value:{state:!0}};constructor(){super(),this._value=``}beforeOpen(){this._value=this.initial}focusInitial(){let e=this.renderRoot.querySelector(`textarea`);if(e){e.focus();try{e.setSelectionRange(e.value.length,e.value.length)}catch{}}}_onInput=e=>{this._value=e.target.value};_onSave=()=>{let e=this._value.trim();this._finish(e===this.initial.trim()?null:e)};_onKeydown=e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this._onSave())};render(){let e=this.initial.length>0;return L`<dialog @close="${this._onClose}"><header><h3>${e?`Edit comment`:`Add comment`}</h3>${Fe(this.finding??{})}</header><textarea rows="6" placeholder="Write your notes here. Markdown is not rendered. Ctrl/⌘+Enter to save, Esc to cancel." .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"></textarea><footer class="nwd-actions">${e?L`<button type="button" class="danger" @click="${()=>this._finish(``)}">Clear</button>`:R} <span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onSave}">Save</button></footer></dialog>`}};customElements.define(`comment-dialog`,dn);function fn({initial:e=``,finding:t=null}={}){return S(`comment-dialog`,{initial:e??``,finding:t})}var z=`.lwd-body{margin:.2rem 0 .55rem;color:var(--text);font-size:.86rem;line-height:1.5}.lwd-empty{margin:.2rem 0 .55rem;color:var(--muted);font-size:.78rem}.lwd-note{margin:.2rem 0 .65rem;padding:.55rem .7rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:rgb(from var(--text) r g b / .03);color:var(--muted);font-size:.78rem;line-height:1.45}.lwd-choice{margin:.2rem 0 .65rem;padding:.55rem .7rem .6rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:rgb(from var(--text) r g b / .03);& legend{padding:0 .35rem;color:var(--text);font-size:.78rem;font-weight:500;& strong{font-weight:600}}}.lwd-option{display:flex;align-items:flex-start;gap:.5rem;padding:.3rem .15rem;& input[type=radio]{margin:.15rem 0 0;accent-color:var(--accent)}.lwd-option-text{display:flex;flex-direction:column;gap:.1rem;min-width:0}.lwd-option-title{color:var(--text);font-size:.82rem;line-height:1.35}.lwd-option-hint{color:var(--muted);font-size:.72rem;line-height:1.4}}.lwd-list{padding-left:1.1rem;color:var(--muted);font-size:.76rem;line-height:1.5;& li+li{margin-top:.2rem}& strong{color:var(--text);font-weight:600}}.lwd-kind-tag{display:inline-block;vertical-align:middle;margin-left:.3rem;padding:0 .35rem;border:1px solid var(--border);border-radius:3px;background:rgb(from var(--text) r g b / .04);color:var(--muted);font-size:.62rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em}.lwd-rename-input{margin-top:.2rem}.lwd-rename-error{margin:.25rem 0 0;color:var(--critical);font-size:.72rem;line-height:1.35}
5
+ `,B=class extends x{static styles=[...x.styles,I(z)];firstUpdated(){this.signal?.aborted?this._onCancel():(this.signal?.addEventListener(`abort`,this._onCancel,{once:!0}),super.firstUpdated())}disconnectedCallback(){this.signal?.removeEventListener(`abort`,this._onCancel),super.disconnectedCallback()}focusInitial(){this.renderRoot.querySelector(`button[data-role="cancel"]`)?.focus()}confirmationResult(e){return{confirmed:e&&!this.signal?.aborted}}_finish(e){this._settled||super._finish(this.confirmationResult(!!e))}_onClose=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);prompt({title:e,titleId:t,body:n,notes:r=R,action:i,kind:a=`danger`,disabled:o=!1,cancel:s=`Cancel`,status:c=R}){return L`<dialog aria-labelledby="${t??R}" @close="${this._onClose}"><header><h3 id="${t??R}">${e}</h3></header><p class="lwd-body">${n}</p>${r}<footer class="nwd-actions">${c}<span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">${s}</button> ${i?L`<button type="button" class="${a}" ?disabled="${o}" @click="${this._onConfirm}">${i}</button>`:R}</footer></dialog>`}},V=(e,t=!1)=>L`<p class="lwd-note">This ${e} is also stored in the workspace's <strong>remote</strong> inventory and will be removed from there too. Newly synced workspace members won't see it; members who already downloaded it keep their local copy (and could re-upload).${t?` The ${e} bytes stay on this device \u2014 drop it onto another workspace to attach it there.`:``}</p>`,H=({name:e,value:t,current:n,change:r,title:i},a)=>L`<label class="lwd-option"><input type="radio" name="${e}" value="${t}" ?checked="${n===t}" @change="${r}"> <span class="lwd-option-text"><span class="lwd-option-title">${i}</span> ${a}</span></label>`,U=e=>L`<span class="lwd-option-hint">${e}</span>`;function pn({name:e,orphaned:t,shared:n,current:r,change:i,subject:a,sharedSubject:o=a}){if(t===0)return L`<p class="lwd-note">${n===0?`No local triage is attached to ${a}.`:`Local triage on ${o} is also attached to ${n===1?`a report`:`reports`} you're keeping. Nothing will be orphaned.`}</p>`;let s=t===1;return L`<fieldset class="lwd-choice"><legend><strong>${t}</strong> ${s?`triage entry won't`:`triage entries won't`} be reachable from any remaining report. What should happen ${s?`to it`:`to them`}?</legend>${H({name:e,value:`keep`,current:r,change:i,title:`Keep`},U(`Reapplied automatically if a matching report is imported later.`))} ${H({name:e,value:`wipe`,current:r,change:i,title:`Wipe`},U(`Drop the orphaned triage from this browser.`))}</fieldset>`}var mn=class extends B{render(){return this.prompt({title:`Delete bundle`,action:`Delete`,body:L`Delete <strong>"${this.bundleName}"</strong>?`,notes:this.inRemote?V(`bundle`):R})}};customElements.define(`delete-bundle-dialog`,mn);function hn({name:e,inRemote:t}={}){return S(`delete-bundle-dialog`,{bundleName:e??``,inRemote:!!t})}var gn=class extends B{static properties={_triage:{state:!0}};constructor(){super(),this._triage=`keep`}confirmationResult(e){return{confirmed:e,triage:this.orphanedTriage>0?this._triage:`keep`}}_onTriageChange=e=>{this._triage=e.target.value};render(){return this.prompt({title:`Delete ${this.kindLabel}`,action:`Delete`,body:L`Delete <strong>"${this.reportName}"</strong>?`,notes:L`${this.inRemote?V(`report`):R} ${pn({name:`drd-triage`,orphaned:this.orphanedTriage,shared:this.sharedTriage,current:this._triage,change:this._onTriageChange,subject:`this ${this.kindLabel}`,sharedSubject:`this report`})}`})}};customElements.define(`delete-report-dialog`,gn);function _n({name:e,kindLabel:t,triageImpact:n,inRemote:r}={}){return S(`delete-report-dialog`,{reportName:e??``,kindLabel:t||`report`,orphanedTriage:n?.orphanedCount??0,sharedTriage:n?.sharedCount??0,inRemote:!!r})}var vn=class extends B{render(){return this.prompt({title:`Detach bundle`,action:`Detach`,notes:V(`bundle`,!0),body:L`Detach <strong>"${this.bundleName}"</strong> from workspace <strong>"${this.workspaceName}"</strong>?`})}};customElements.define(`detach-bundle-dialog`,vn);function yn({name:e,workspaceName:t}={}){return S(`detach-bundle-dialog`,{bundleName:e??``,workspaceName:t??``})}var bn=class extends B{render(){return this.prompt({title:`Detach report`,action:`Detach`,notes:V(`report`,!0),body:L`Detach <strong>"${this.reportName}"</strong> from workspace <strong>"${this.workspaceName}"</strong>?`})}};customElements.define(`detach-report-dialog`,bn);function xn({name:e,workspaceName:t}={}){return S(`detach-report-dialog`,{reportName:e??``,workspaceName:t??``})}var Sn=class extends B{render(){return this.prompt({title:`Discard unpublished review?`,titleId:`discard-review-title`,action:`Discard review`,body:L`<strong>${this.reviewTitle}</strong>`,notes:L`<p class="lwd-note">This permanently deletes this review and all its file verdicts and notes. This cannot be undone.</p>`})}};customElements.define(`discard-review-dialog`,Sn);function Cn(e){return S(`discard-review-dialog`,e)}var wn=class extends B{render(){return this.prompt({title:`Download bundle`,action:`Download`,kind:`primary`,body:L`Download <strong>"${this.bundleName}"</strong> to disk?`,notes:this.encrypted?L`<p class="lwd-note">The bundle is saved <strong>unencrypted</strong> — even though your vault keeps its stored copy encrypted — and the file contains <strong>all of the bundle's related sources</strong>. Anyone with access to the downloaded file can read every bundled source, so store or share it with care.</p>`:L`<p class="lwd-note">The downloaded file is <strong>unencrypted</strong> and contains <strong>all of the bundle's related sources</strong>. Anyone with access to it can read every bundled source, so store or share it with care.</p>`})}};customElements.define(`download-bundle-dialog`,wn);function Tn({name:e,encrypted:t}={}){return S(`download-bundle-dialog`,{bundleName:e??``,encrypted:!!t})}var En=`dialog{max-width:515px;width:min(94vw,515px)}.ecd-count{font-size:1.02rem;color:var(--text);& strong{color:var(--accent);font-weight:700}}.ecd-excluded{margin:.25rem 0 0;color:var(--muted);font-size:.82rem}.ecd-filters{margin:.9rem 0 0;display:grid;grid-template-columns:auto minmax(0,1fr);gap:.3rem .7rem;font-size:.82rem}.ecd-filters dt{color:var(--muted);font-weight:600;white-space:nowrap}.ecd-filters dd{display:flex;align-items:baseline;gap:.5rem;color:var(--text);overflow-wrap:anywhere}.ecd-filter-value{min-width:0}.ecd-filter-drop{margin-left:auto;flex:none;padding:0 .2rem;border:0;border-radius:var(--ui-radius, 4px);background:none;color:var(--muted);font:inherit;font-size:1rem;line-height:1;&:hover{color:var(--critical)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}.ecd-filters-label{margin:.9rem 0 0;font-size:.76rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}.ecd-filters-label+.ecd-filters{margin-top:.35rem}.ecd-samples{display:flex;align-items:flex-start;gap:.5rem;margin-top:1rem;font-size:.82rem;color:var(--text)}.ecd-samples input{margin-top:.15rem;accent-color:var(--accent)}.ecd-samples-hint{display:block;margin-top:.2rem;color:var(--muted);font-size:.76rem}
6
+ `,Dn=`.dlg-tabs{display:flex;gap:.1rem;margin:0 0 .55rem;border-bottom:1px solid var(--border)}.dlg-tab{display:inline-flex;align-items:center;gap:.35rem;background:transparent;border:none;color:var(--muted);padding:.1rem .6rem .4rem;font:inherit;font-size:.85rem;font-weight:600;border-bottom:2px solid transparent;margin-bottom:-1px;transition:color .12s,border-color .12s;&:first-child{padding-left:0}&:hover:not(:disabled){color:var(--text)}&[aria-selected=true]{color:var(--accent);border-bottom-color:var(--accent)}&:disabled{opacity:.5}& svg{display:block}}
7
+ `,On=[{id:`download`,label:`Markdown`,icon:n},{id:`print`,label:`Print`,icon:r}],kn=class extends x{static styles=[...x.styles,I(En),I(Dn)];static properties={mode:{type:String},included:{type:Number},excluded:{type:Number},total:{type:Number},filters:{attribute:!1},fields:{attribute:!1},bucketLabel:{type:String},focusedOnly:{type:Boolean},oneSamplePerGroup:{type:Boolean}};constructor(){super(),this.mode=`download`,this.filters=[],this.fields=null,this._relaxed=!1,this.bucketLabel=null,this.focusedOnly=!1,this.oneSamplePerGroup=!1}get _focusedOnly(){return this.mode===`print`&&this.focusedOnly}focusInitial(){this.renderRoot.querySelector(this.included===0?`button[data-role="cancel"]`:`button.primary`)?.focus()}_finish(e){this._settled||super._finish({confirmed:e===`confirm`,view:e===`view`,fields:this._relaxed?this.fields:null,mode:this.mode,oneSamplePerGroup:this.oneSamplePerGroup})}_onClose=()=>this._finish(`cancel`);_onView=()=>this._finish(`view`);_onConfirm=()=>this._finish(`confirm`);async _onDropFilter(e){let t=this.filters.findIndex(t=>t.key===e);if(t===-1)return;let{fields:n,filters:r,included:a,excluded:o,total:s}=i(this.mode,{...this.fields,...this.filters[t].clear});Object.assign(this,{_relaxed:!0,fields:n,filters:r,included:a,excluded:o,total:s}),await this.updateComplete;let c=[...this.renderRoot.querySelectorAll(`button[data-drop]`)];(c[Math.min(t,c.length-1)]??this.renderRoot.querySelector(`button.primary`)??this.renderRoot.querySelector(`button[data-role="cancel"]`))?.focus()}_countSection(){let e=this.mode===`print`;if(this.total===0)return L`<p class="ecd-count">No findings to ${e?`print`:`download`}.</p>`;if(this._focusedOnly&&this.included>0)return L`<p class="ecd-count">Only the <strong>focused</strong> finding will be printed.</p><p class="ecd-excluded">Focus mode prints just the finding you're viewing. Switch to the list or grouped view to print all ${this.included} matching ${this.included===1?`finding`:`findings`}.</p>`;let t=this.excluded===0&&this.filters.length===0?L`All <strong>${this.included}</strong> ${this.included===1?`finding`:`findings`} included.`:L`<strong>${this.included}</strong> of ${this.total} ${this.total===1?`finding`:`findings`} included.`;return L`<p class="ecd-count">${t}</p>${this.excluded>0?L`<p class="ecd-excluded">${this.excluded} filtered out and ${e?`won't be printed`:`won't be downloaded`}.</p>`:R}`}_filtersSection(){return this.filters.length===0?L`<p class="ecd-filters-label">No filters active — the full ${this.bucketLabel?`${this.bucketLabel.toLowerCase()} `:``}set is included.</p>`:L`<p class="ecd-filters-label">Active filters</p><dl class="ecd-filters">${this.filters.map(e=>L`<dt>${e.label}</dt><dd><span class="ecd-filter-value">${e.value}</span> <button type="button" class="ecd-filter-drop" data-drop="${e.key}" aria-label="${`Drop the ${e.label.toLowerCase()} filter (${e.value}) from this export`}" @click="${()=>this._onDropFilter(e.key)}">×</button></dd>`)}</dl>`}render(){let e=this.mode===`print`,t=this._focusedOnly?`You're in focus mode — printing outputs just the finding you're focused on.`:e?`Prints only the findings matching your current filters — the same set shown on screen. Use the toolbar to change the selection first.`:`Downloads a Markdown file of the findings matching your current filters — the same set shown on screen. Use the toolbar to change the selection first.`;return L`<dialog @close="${this._onClose}"><header>${Ie({tabs:On,current:this.mode,prefix:`ecd`,select:e=>{this.mode=e}})}</header><div role="tabpanel" id="${`ecd-panel-${this.mode}`}" aria-labelledby="${`ecd-tab-${this.mode}`}"><p class="nwd-intro">${t}</p>${this._countSection()} ${this.bucketLabel?L`<p class="nwd-note">Scoped to the <strong>${this.bucketLabel}</strong> list — live findings are not included.</p>`:R} ${this._filtersSection()} <label class="ecd-samples"><input type="checkbox" .checked="${this.oneSamplePerGroup}" @change="${e=>{this.oneSamplePerGroup=e.target.checked}}"> <span>One sample per group<span class="ecd-samples-hint">Include only the currently selected sample from each group.</span></span></label></div><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> ${e?R:L`<button type="button" data-role="view" ?disabled="${this.included===0}" @click="${this._onView}">View</button>`} <button type="button" class="primary" ?disabled="${this.included===0}" @click="${this._onConfirm}">${e?`Print`:`Download`}</button></footer></dialog>`}};customElements.define(`export-confirm-dialog`,kn);function An(e=`download`){let{included:t,excluded:n,total:r,filters:a,fields:o,bucketLabel:s,...c}=i(e),l=e===`print`?c.focusedOnly:i(`print`).focusedOnly;return S(`export-confirm-dialog`,{mode:e,included:t,excluded:n,total:r,filters:a,fields:o,bucketLabel:s,focusedOnly:l},{conflict:()=>({confirmed:!1,view:!1,fields:null,mode:e})})}var jn=160,Mn=320,Nn=/^ {0,3}#{1,6}(?: |$)/u,Pn=/^ {0,3}(?:=+|-+) *$/u,W=/^\|?[^|\n]+(?:\|[^|\n]+)+\|?$/u,Fn=/^\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?$/u;function In(e,t=e.join(`
8
+ `),{target:n=jn,max:r=Mn}={}){let i=e.length;if(i===0)return[];let a=tn(t),o=0,s=0,c=()=>{for(;o<a.length&&a[o][1]<=s-1;)o++;return o<a.length&&s-1>=a[o][0]},l=t=>e[t].trim()===``,u=t=>W.test(e[t]),d=t=>!c()&&!(Fn.test(e[t])&&u(t-1))&&!(Pn.test(e[t])&&!l(t-1)),f=t=>l(t-1)||Nn.test(e[t]),p=[],m=0;for(let t=1;t<i;t++){s+=e[t-1].length+1;let i=t-m;i<n||!d(t)||(i>=r||f(t))&&(p.push([m,t]),m=t)}return p.push([m,i]),p}function Ln(e,t){if(t<2||!W.test(e[t])||!W.test(e[t-1]))return null;let n=t-1;for(;n>0&&W.test(e[n-1]);)n--;for(let r=n+1;r<t;r++)if(Fn.test(e[r]))return[r-1,r+1];return null}function Rn(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}var zn=`dialog{max-width:none;max-height:none;width:calc(100vw - 4rem);height:calc(100vh - 4rem);margin:2rem auto;position:relative;padding:12px}dialog[open]{display:flex;flex-direction:column}dialog::backdrop{backdrop-filter:none}header{display:flex;align-items:center;gap:.45rem;margin-bottom:.6rem;padding-right:3rem;user-select:none}header h3{margin:0}.evd-close{position:absolute;top:6px;right:6px;z-index:1;width:22px;height:22px;display:grid;place-items:center;background:transparent;border:0;border-radius:var(--ui-radius, 4px);color:var(--muted);font:500 16px/1 ui-monospace,monospace;cursor:default;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}.evd-code{flex:1 1 auto;min-height:0;overflow:auto;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:var(--bg);color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.78rem;line-height:1.55;scrollbar-width:thin;scrollbar-color:var(--border) transparent;&::-webkit-scrollbar{width:6px;height:6px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}}.evd-lines{--evd-gutter: calc(var(--evd-lineno-width, 3ch) + 1.4rem);padding:.5rem 0;background-image:linear-gradient(to right,rgb(from var(--text) r g b / .03) 0 calc(var(--evd-gutter) - 1px),var(--border) calc(var(--evd-gutter) - 1px) var(--evd-gutter),transparent var(--evd-gutter))}.evd-chunk{display:grid;grid-template-columns:var(--evd-gutter) minmax(0,1fr);align-items:start;content-visibility:auto;contain-intrinsic-size:auto calc(var(--evd-chunk-lines, 1) * 1.55em)}.evd-chunk.evd-pending{display:block;padding:0 .75rem 0 calc(var(--evd-gutter) + .6rem);white-space:pre-wrap;overflow-wrap:anywhere}.evd-lineno{padding:0 .55rem 0 .4rem;color:var(--muted);text-align:right;font-variant-numeric:tabular-nums;user-select:none}.evd-line{padding:0 .75rem 0 .6rem;font:inherit;background:none;white-space:pre-wrap;overflow-wrap:anywhere}.evd-meta{color:var(--muted);font-size:.74rem;font-variant-numeric:tabular-nums}.evd-copy{margin-left:auto;flex-shrink:0;height:1.75rem;padding:0 .55rem;gap:.35rem;display:inline-flex;align-items:center;background:transparent;color:var(--muted);border:1px solid var(--border);border-radius:var(--ui-radius, 3px);font:inherit;font-size:.72rem;font-weight:500;letter-spacing:.02em;cursor:default;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}&.evd-done{color:var(--green);background:color-mix(in srgb,var(--green) 14%,transparent)}&.evd-failed{color:var(--critical);background:color-mix(in srgb,var(--critical) 14%,transparent)}}
9
+ `,Bn=L`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><rect x="3" y="2.5" width="8" height="10" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><rect x="5.5" y="5" width="8" height="9" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`;function Vn(e,t,n,r=null){let i=``;for(let a=t;a<n;a++){let n=r===null?Rn(e[a]):r[a-t];i+=`<span class="evd-lineno" aria-hidden="true">${a+1}</span><code class="evd-line">${n}
10
+ </code>`}return i}var Hn=class extends x{static styles=[...x.styles,I(t),I(zn)];static properties={markdown:{attribute:!1},_copied:{state:!0}};_lines=[];_kb=`0.0`;_chunks=[];_copiedTimer=null;constructor(){super(),this.markdown=``,this._copied=``}focusInitial(){this.renderRoot.querySelector(`button[data-role="cancel"]`)?.focus()}willUpdate(e){if(!e.has(`markdown`))return;let t=this.markdown.split(`
11
+ `),n=t.length>1&&t.at(-1)===``?t.length-1:t.length;this._lines=t.slice(0,n),this._kb=(new TextEncoder().encode(this.markdown).length/1024).toFixed(1),this._chunks=In(this._lines,this.markdown).map(([e,t])=>({start:e,end:t,asked:!1}))}render(){let e=this._lines.length,t=this._copied===`done`?`Copied`:this._copied===`failed`?`Copy failed`:`Copy`,n=this._copied===`failed`?`Select the text and copy it by hand`:R;return L`<dialog @close="${this._onClose}"><button type="button" class="evd-close" data-role="cancel" aria-label="Close" @click="${this._onClose}">×</button><header><h3>Report markdown</h3><span class="evd-meta">· ${e} ${e===1?`line`:`lines`} · ${this._kb} KB</span> <button type="button" class="evd-copy ${this._copied===`done`?`evd-done`:this._copied===`failed`?`evd-failed`:``}" data-role="copy" data-tooltip="${n}" @click="${this._onCopy}">${Bn}${t}</button></header><div class="evd-code" tabindex="0"><div class="evd-lines" style="${N({"--evd-lineno-width":`${String(e).length}ch`})}">${this._chunks.map((e,t)=>L`<div class="evd-chunk evd-pending" data-chunk="${t}" style="${N({"--evd-chunk-lines":`${e.end-e.start}`})}"></div>`)}</div></div></dialog>`}updated(){if(this.isConnected)for(let e of this.renderRoot.querySelectorAll(`.evd-chunk:not([data-watched])`)){e.dataset.watched=``;let t=Number(e.dataset.chunk),n=this._chunks[t];e.textContent=`${this._lines.slice(n.start,n.end).join(`
12
12
  `)}
13
- `,yt(e,n=>{n&&(bt(e),this._paint(e,t))})}}disconnectedCallback(){for(let e of this.renderRoot.querySelectorAll(`.evd-chunk[data-watched]`))bt(e);clearTimeout(this._copiedTimer),super.disconnectedCallback()}_onCopy=async()=>{let e=`done`;try{await navigator.clipboard.writeText(this.markdown)}catch{e=`failed`}this.isConnected&&(this._copied=e,clearTimeout(this._copiedTimer),this._copiedTimer=setTimeout(()=>{this._copied=``,this._copiedTimer=null},1500))};async _paint(e,t){let n=this._chunks[t];if(!n||n.asked)return;n.asked=!0;let r=zn(this._lines,n.start),i=[...r?this._lines.slice(r[0],r[1]):[],...this._lines.slice(n.start,n.end)].join(`
14
- `),a=await _t(i,`markdown`);if(!this.isConnected)return;let o=a===null?null:vt(a).slice(r?r[1]-r[0]:0);e.innerHTML=qt(Un(this._lines,n.start,n.end,o?.length===n.end-n.start?o:null)),e.classList.remove(`evd-pending`)}};customElements.define(`export-view-dialog`,Wn);function Gn(e){return x(`export-view-dialog`,{markdown:e},{conflict:()=>{}}).then(()=>{})}var Kn={triage:`Status`,color:`Label`,flagged:`Flagged`,fix:`Fix`,comment:`Comment`},qn={inprogress:`In progress`,fixed:`Fixed`,invalid:`Invalid`,deleted:`Deleted`,ignored:`Ignored`};function Jn(e,t){return t===`triage`?qn[e?.triage]??`Untriaged`:t===`flagged`?e?.flagged?`Yes`:`No`:e?.[t]||`None`}function Yn(e,t){return Object.entries(Kn).flatMap(([n,r])=>{let i=Jn(e,n);if(t===void 0)return e?.[n]===void 0?[]:[{label:r,after:i}];let a=Jn(t,n);return a===i?[]:[{label:r,before:a,after:i}]})}var Xn=`dialog{width:min(94vw,720px);max-width:720px;max-height:calc(100dvh - 4rem);margin-block:2rem;padding:0;overflow:hidden;background:rgb(from var(--surface) r g b / 1)}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:start;justify-content:space-between;gap:1rem;padding:.75rem 1rem;border-bottom:1px solid var(--border);flex:none}.history-heading{min-width:0}header h3{display:flex;align-items:center;gap:.55rem;margin:0;line-height:1.5}header svg{flex:none;color:var(--muted)}header .detail-action{flex:none;width:1.75rem;height:1.75rem}.location{margin-top:.4rem;color:var(--muted);font:.76rem/1.5 ui-monospace,monospace;overflow-wrap:anywhere}.history-summary{display:flex;justify-content:space-between;gap:.5rem;flex:none;padding:.5rem 1rem .25rem;color:var(--muted);font-size:.72rem}.history-body{min-height:0;overflow:auto;overscroll-behavior:contain;padding:.75rem 1rem 1rem;font-size:.82rem;line-height:1.5}.timeline{list-style:none}.event{position:relative;display:grid;grid-template-columns:2rem minmax(0,1fr);gap:.75rem;padding-bottom:1rem}.event:last-child{padding-bottom:0}.event:not(:last-child):before{content:"";position:absolute;top:2.4rem;bottom:.4rem;left:calc(1rem - .5px);width:1px;background:var(--border)}.managed-comment-avatar{width:2rem;height:2rem;font-size:.8rem;background:var(--surface-active)}.event-content{min-width:0}.event-meta{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:.15rem .75rem}.event-user{display:flex;flex-wrap:wrap;align-items:baseline;gap:.1rem .45rem;min-width:0;overflow-wrap:anywhere}.event-user strong{font-weight:600}.username{color:var(--muted);font-size:.75rem}time{color:var(--muted);font-size:.7rem;white-space:nowrap}.event-action{margin-top:.1rem;color:var(--muted);font-size:.75rem}.changes{margin-top:.65rem;border:1px solid var(--border);border-radius:var(--ui-radius, 7px);overflow:hidden}.change{display:grid;grid-template-columns:4.5rem minmax(0,1fr);align-items:baseline;gap:.65rem;padding:.4rem .6rem}.change+.change{border-top:1px solid var(--border)}dt{color:var(--muted);font-size:.75rem}dd{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:baseline;gap:.65rem}dd.snapshot{grid-template-columns:minmax(0,1fr)}.before,.after{white-space:pre-wrap;overflow-wrap:anywhere}.before,.change-arrow{color:var(--muted)}.after{font-weight:500}.history-state{padding:1.5rem .5rem;text-align:center;color:var(--muted)}.history-state strong{display:block;margin-bottom:.35rem;color:var(--text);font-weight:500}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@media(width<=540px){dialog{margin-block:1rem;max-height:calc(100dvh - 2rem)}header{padding:.65rem}.history-summary{padding-inline:.65rem}.history-body{padding:.65rem}.event{gap:.6rem}.event-meta{flex-direction:column}.change{grid-template-columns:minmax(0,1fr);gap:.3rem;padding:.35rem .5rem}dd{gap:.45rem}}
15
- `,Zn=class extends b{static styles=[...b.styles,P(O),P(a),P(Xn)];static properties={finding:{attribute:!1},teamId:{attribute:!1},_events:{state:!0},_loading:{state:!0},_error:{state:!0}};constructor(){super(),this._events=[],this._loading=!0,this._error=!1}beforeOpen(){this._load()}async _load(){if(!this.isCurrent()){this._finish(null);return}this._loading=!0,this._error=!1;let{_managedReportId:e,id:t}=this.finding;this._key=`finding-history:${this.teamId??``}:${e}:${t}`,p.invalidate([this._key]);let n=p.load(this._key,`issue history`,async n=>{let r=new URLSearchParams({finding:t});this.teamId&&r.set(`team`,this.teamId);let i=await f(`/api/reports/${encodeURIComponent(e)}/triage/history?${r}`,{credentials:`same-origin`,signal:n});if(!i.ok)throw Error(`History request failed (${i.status})`);let a=await i.json();if(a.finding!==t||!Array.isArray(a.events))throw Error(`Invalid history response`);return a.events});this._owner=p.resources.get(this._key),this._signal=this._owner.controller.signal,this._signal.addEventListener(`abort`,this._onClose,{once:!0});try{let e=await n;if(this._settled||!this.isConnected)return;if(!this.isCurrent()){this._finish(null);return}this._events=e}catch(e){if(this._settled||!this.isConnected)return;e.name===`AbortError`||!this.isCurrent()?this._finish(null):this._error=!0}finally{this._loading=!1}}disconnectedCallback(){this._signal?.removeEventListener(`abort`,this._onClose),this._owner&&p.resources.get(this._key)===this._owner&&p.invalidate([this._key]),this._events=[],super.disconnectedCallback()}_onKeydown=e=>{e.key===`Escape`&&e.stopPropagation()};_renderEvent(e,t){let n=this._events[t+1],r=Yn(e.entry,n?.entry),i=new Date(e.at),a=e.actorLogin?`@${e.actorLogin}`:``;return F`<li class="event">${e.actorId?De(e.actorId,e.actorName||e.actorLogin):F`<span class="managed-comment-avatar" aria-hidden="true">${(e.actorLogin?.[0]||`?`).toUpperCase()}</span>`}<div class="event-content"><div class="event-meta"><div class="event-user"><strong>${e.actorName||a||`Unknown user`}</strong> ${e.actorName&&a?F`<span class="username">${a}</span>`:I}</div><time datetime="${i.toISOString()}" data-tooltip="${i.toLocaleString()}">${i.toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}</time></div><p class="event-action">${e.entry===null?`Cleared triage`:n?`Updated triage`:`Recorded triage state`}</p>${r.length>0?F`<dl class="changes">${r.map(e=>F`<div class="change"><dt>${e.label}</dt><dd class="${e.before===void 0?`snapshot`:``}">${e.before===void 0?I:F`<span class="before"><span class="sr-only">Previously: </span>${e.before}</span> <span class="change-arrow" aria-hidden="true">→</span>`} <span class="after"><span class="sr-only">${e.before===void 0?`Recorded: `:`Changed to: `}</span>${e.after}</span></dd></div>`)}</dl>`:I}</div></li>`}render(){let e=this.finding??{};return F`<dialog aria-labelledby="history-title" @close="${this._onClose}" @keydown="${this._onKeydown}"><header><div class="history-heading"><h3 id="history-title"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 11a9 9 0 1 1 2.5 7M3 5v6h6M12 7v5l3 2"/></svg>Issue history</h3><p class="location">${e.file}${e.line?`:${e.line}`:``}</p></div><button type="button" class="detail-action" aria-label="Close issue history" @click="${this._onClose}">×</button></header>${!this._loading&&!this._error&&this._events.length>0?F`<div class="history-summary"><span>${this._events.length} ${this._events.length===1?`record`:`records`}</span><span>Newest first</span></div>`:I}<div class="history-body" aria-busy="${String(this._loading)}">${this._loading?F`<p class="history-state" role="status">Loading history…</p>`:this._error?F`<div class="history-state" role="alert"><strong>Couldn’t load issue history</strong><p>Close and reopen to try again.</p></div>`:this._events.length===0?F`<div class="history-state" role="status"><strong>No triage changes yet</strong><p>Changes to status, labels, flags, and fixes will appear here.</p></div>`:F`<ol class="timeline">${this._events.map((e,t)=>this._renderEvent(e,t))}</ol>`}</div></dialog>`}};customElements.define(`finding-history-dialog`,Zn);function Qn(e){return e.isCurrent()?x(`finding-history-dialog`,e):Promise.resolve(null)}var $n=`dialog{width:min(96vw,1400px);max-width:1400px;height:min(88dvh,1000px);max-height:92dvh;margin:auto;padding:0;overflow:hidden}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:center;gap:1rem;padding:.7rem 1rem;border-bottom:1px solid var(--border);flex:0 0 auto;& h3{margin:0;min-width:0;flex:1;overflow-wrap:anywhere;font:.85rem ui-monospace,monospace}& button{border:0;background:transparent;color:var(--muted);font-size:1.4rem;padding:0 .3rem;&:hover{color:var(--text)}}}.source-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}.source-status{padding:1rem;color:var(--muted)}.source-lines{display:flex;min-width:100%;width:max-content;font:.8rem/1.6 ui-monospace,monospace;& aside{position:sticky;left:0;align-self:stretch;flex:0 0 auto;padding:.75rem 0;background:var(--surface);color:var(--muted);border-right:1px solid var(--border);text-align:right;user-select:none;& div{padding:0 .75rem}.cited{background:rgb(from var(--accent) r g b / .18);color:var(--accent);font-weight:700}}& pre{padding:.75rem 1rem;tab-size:4}& pre,code{font:inherit;white-space:pre}}
16
- `,er=class extends b{static styles=[...b.styles,P($n),P(t)];static properties={reportId:{attribute:!1},file:{attribute:!1},line:{attribute:!1},_path:{state:!0},_content:{state:!0},_highlighted:{state:!0},_loading:{state:!0}};constructor(){super(),this.reportId=``,this.file=``,this.line=``,this._path=``,this._content=null,this._highlighted=null,this._loading=!0}beforeOpen(){this._load()}async _load(){try{let{data:e,error:t}=await Pt(this.reportId).then(e=>({data:e}),e=>({error:e}));if(this._settled||!this.isConnected)return;let n=jt(this.reportId),r=t?n?.error===t:n?.data===e||e===null&&!!n?.error;if(!n||!r||t?.name===`AbortError`||n.controller?.signal.aborted){this._finish(null);return}if(this._sourceSignal=n.controller?.signal,this._sourceSignal?.addEventListener(`abort`,this._onClose,{once:!0}),this._path=e?.paths.get(this.file)??this.file,this._content=e?.sources.get(this._path)??null,this._loading=!1,await this.updateComplete,this._settled||!this.isConnected)return;Dt(this.renderRoot.querySelector(`.source-scroll`),this.renderRoot.querySelectorAll(`.cited`));let i=Ut(this._path,e?.formats?.get(this._path),this._content);if(i&&this._content!==null){let e=await _t(this._content,i);!this._settled&&this.isConnected&&(this._highlighted=e)}}catch(e){e.name===`AbortError`?this._finish(null):this._loading=!1}}disconnectedCallback(){this._sourceSignal?.removeEventListener(`abort`,this._onClose),this._content=null,this._highlighted=null,super.disconnectedCallback()}_onKeydown=e=>{e.key===`Escape`&&e.stopPropagation()};render(){let e=k(this.line);return F`<dialog aria-labelledby="source-title" @close="${this._onClose}" @keydown="${this._onKeydown}" @click="${this._onBackdrop}"><header><h3 id="source-title" class="mono">${this._path||this.file}</h3><button type="button" aria-label="Close source viewer" @click="${this._onClose}">×</button></header><div class="source-scroll" tabindex="0" aria-label="Full source code" aria-busy="${String(this._loading)}">${this._content===null?F`<p class="source-status" role="status">${this._loading?`Loading source…`:`Source unavailable`}</p>`:F`<div class="source-lines"><aside aria-hidden="true">${this._content.split(`
17
- `).map((t,n)=>F`<div class="${e&&n+1>=e.start&&n+1<=e.end?`cited`:``}">${n+1}</div>`)}</aside><pre><code>${typeof this._highlighted==`string`?A(this._highlighted):this._content}</code></pre></div>`}</div></dialog>`}};customElements.define(`finding-source-dialog`,er);function tr({reportId:e,file:t,line:n}){return x(`finding-source-dialog`,{reportId:e,file:t,line:n})}var nr=`dialog{max-width:560px;width:min(94vw,560px)}header h3{margin:0 0 .4rem}.finding{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin-bottom:.35rem}.loc{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.76rem;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1}.desc{font-size:.78rem;color:var(--muted);margin:0 0 .7rem;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.input-row{display:flex;align-items:stretch;gap:.4rem}input{flex:1;min-width:0;padding:.5rem .65rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:var(--bg);color:var(--text);font:inherit;font-size:.88rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;&:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgb(from var(--accent) r g b / .18)}&::placeholder{color:var(--muted);font-family:inherit}}.open{display:inline-flex;align-items:center;padding:0 .7rem;border:1px solid var(--accent);border-radius:var(--ui-radius, 6px);color:var(--accent);text-decoration:none;font-size:.8rem;font-weight:600;white-space:nowrap;&:hover{background:rgb(from var(--accent) r g b / .1)}}.hint{margin:.45rem 0 0;color:var(--muted);font-size:.74rem}
18
- `,rr=class extends b{static styles=[...b.styles,P(C),P(nr)];static properties={_value:{state:!0}};constructor(){super(),this._value=``}beforeOpen(){this._value=this.initial}focusInitial(){let e=this.renderRoot.querySelector(`input[type="url"]`);if(e){e.focus();try{e.select()}catch{}}}_onInput=e=>{this._value=e.target.value};get _trimmed(){return this._value.trim()}_onSave=()=>{this._finish(this._trimmed===this.initial.trim()?null:{value:this._trimmed,scope:`finding`})};_onApplyToGroup=()=>{this._trimmed&&this._finish({value:this._trimmed,scope:`group`})};_onKeydown=w(()=>this._onSave());render(){let e=this.initial.length>0,t=this._trimmed;return F`<dialog @close="${this._onClose}"><header><h3>${e?`Edit fix link`:`Add fix link`}</h3>${dt(this.finding??{})}</header><div class="input-row"><input type="url" inputmode="url" autocomplete="off" spellcheck="false" placeholder="https://github.com/owner/repo/pull/123" .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"> ${en(t)?F`<a class="open" href="${t}" target="_blank" rel="noopener noreferrer">Open ↗</a>`:I}</div><p class="hint">PR URL, issue link, commit, or any free-form reference. Enter to save, Esc to cancel.</p><footer class="nwd-actions">${e?F`<button type="button" class="danger" @click="${()=>this._finish({value:``,scope:`finding`})}">Clear</button>`:I} <span class="nwd-spacer"></span> ${this.canApplyToGroup?F`<button type="button" class="quiet" ?disabled="${!t}" @click="${this._onApplyToGroup}">Apply to whole group</button> <span class="nwd-spacer"></span>`:I} <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onSave}">Save</button></footer></dialog>`}};customElements.define(`fix-link-dialog`,rr);function ir({initial:e=``,finding:t=null,canApplyToGroup:n=!1}={}){return x(`fix-link-dialog`,{initial:e??``,finding:t,canApplyToGroup:n})}var ar=class extends R{static properties={_choice:{state:!0},_newName:{state:!0}};constructor(){super(),this._choice=`replace`,this._newName=``}get _trimmed(){return(this._newName??``).trim()}confirmationResult(e){return e?this._choice===`rename`?{action:`rename`,newName:this._trimmed}:{action:`replace`}:{action:`cancel`}}_onConfirm=()=>{(this._choice!==`rename`||this._renameError(this._trimmed)===null)&&this._finish(!0)};_onChoiceChange=e=>{this._choice=e.target.value};_onNameInput=e=>{this._newName=e.target.value};_onNameKeydown=w(()=>this._onConfirm());_replaceHint(){let e=this.workspaceNames.length;if(e===0)return`The local file will be overwritten.`;let t=e===1?F`workspace <strong>"${this.workspaceNames[0]}"</strong>`:F`<strong>${e}</strong> workspaces (${this.workspaceNames.join(`, `)})`;return F`The local file will be overwritten. When sync is online, the new bytes are also uploaded to ${t} so the cloud copy matches.`}_renameError(e){return e?e===this.reportName?`Pick a name different from the original.`:e.includes(`\0`)?`The new name cannot contain a NUL byte.`:e.includes(`/`)||e.includes(`\\`)?`The new name cannot contain "/" or "\\".`:this.existingNames.has(e)?`A file named "${e}" already exists \u2014 pick something else.`:null:`Enter a new name.`}render(){let e=this._choice===`rename`,t=e?this._renameError(this._trimmed):null,n={name:`icd-choice`,current:this._choice,change:this._onChoiceChange},r=this.workspaceNames.length>0?V(`Saved as an unfiled report — the renamed copy isn't added to any workspace.`):I;return this.prompt({title:`Import conflict`,body:F`<strong>"${this.reportName}"</strong> already exists with different content.`,notes:F`<fieldset class="lwd-choice"><legend>What should happen?</legend>${B({...n,value:`replace`,title:`Replace`},V(this._replaceHint()))} ${B({...n,value:`rename`,title:`Rename to`},F`<input type="text" class="nwd-input lwd-rename-input" maxlength="200" .value="${this._newName}" ?disabled="${!e}" @input="${this._onNameInput}" @keydown="${this._onNameKeydown}" @focus="${()=>{this._choice=`rename`}}"> ${r} ${t===null?I:F`<p class="lwd-rename-error">${t}</p>`}`)}</fieldset>`,action:e?`Rename`:`Replace`,kind:e?`primary`:`danger`,disabled:t!==null})}};customElements.define(`import-conflict-dialog`,ar);function or({name:e,workspaceNames:t,existingNames:n}={}){let r=n instanceof Set?n:new Set(n??[]);return x(`import-conflict-dialog`,{reportName:e??``,workspaceNames:Array.isArray(t)?t:[],existingNames:r,_newName:sr(e??``,r)},{conflict:()=>({action:`cancel`})})}function sr(e,t){if(typeof e!=`string`||e.length===0)return``;let n=e.lastIndexOf(`.`),r=n>0?e.slice(0,n):e,i=n>0?e.slice(n):``,a=r.replace(/-\d+$/u,``);for(let e=2;e<1e3;e++){let n=`${a}-${e}${i}`;if(!t.has(n))return n}return``}var cr=class extends R{static properties={_mode:{state:!0},_triage:{state:!0}};constructor(){super(),this._mode=`detach`,this._triage=`keep`}confirmationResult(e){let t=this.reportCount>0?this._mode:`detach`;return{confirmed:e,mode:t,triage:t===`delete`&&this.orphanedTriage>0?this._triage:`keep`}}_onModeChange=e=>{this._mode=e.target.value};_onTriageChange=e=>{this._triage=e.target.value};_modeChoice(){let e=this.reportCount,t=e===1,n=t?`report`:`reports`,r=(e,t,n)=>B({name:`lwd-mode`,value:e,current:this._mode,change:this._onModeChange,title:t},V(n));return F`<fieldset class="lwd-choice"><legend>What should happen to the <strong>${e}</strong> attached ${n}?</legend>${r(`detach`,`Move ${t?`it`:`them`} out of the workspace`,`The ${n} ${t?`stays`:`stay`} in this browser as unattached ${n}.`)} ${r(`delete`,`Delete ${t?`it`:`them`} along with the workspace`,`The ${n} ${t?`is removed`:`are removed`} from this browser.`)}</fieldset>`}render(){let e=this.reportCount,t=this.bundleCount,n=t>0?F`<p class="lwd-note">${t===1?`One bundle is`:`${t} bundles are`} also attached. ${t===1?`It`:`They`} will become unfiled — the bundle bytes stay on this device either way (delete bundles manually from the Bundles list if you want them gone).</p>`:I;return this.prompt({title:`Leave workspace`,action:`Leave`,body:F`Leave workspace <strong>"${this.workspaceName}"</strong> on this device?`,notes:F`${e>0?this._modeChoice():F`<p class="lwd-empty">No reports are attached to this workspace${t>0?` (only bundles, see below)`:``}.</p>`} ${n} ${this._mode===`delete`&&e>0?hn({name:`lwd-triage`,orphaned:this.orphanedTriage,shared:this.sharedTriage,current:this._triage,change:this._onTriageChange,subject:e===1?`this report`:`these reports`}):I}<ul class="lwd-list"><li>Workspace synchronization data stays on the sync server — peers (and your other devices) keep their copy.</li></ul>`})}};customElements.define(`leave-workspace-dialog`,cr);function lr({name:e,reportCount:t,bundleCount:n,triageImpact:r}={}){return x(`leave-workspace-dialog`,{workspaceName:e??``,reportCount:t??0,bundleCount:n??0,orphanedTriage:r?.orphanedCount??0,sharedTriage:r?.sharedCount??0})}var ur=`dialog{width:min(42rem,90vw)}.content-import-groups{max-height:55vh;overflow:auto}fieldset{margin:.7rem 0;padding:.5rem .75rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px)}legend{padding:0 .35rem;font-size:.85rem;font-weight:600}.content-import-item{display:flex;gap:.65rem;align-items:flex-start;padding:.65rem 0}.content-import-item+.content-import-item{border-top:1px solid var(--border)}.content-import-item input{margin:.15rem 0 0;accent-color:var(--accent)}.content-import-item.unavailable{opacity:.55;cursor:default}.content-import-label{display:grid;gap:.25rem;min-width:0;overflow-wrap:anywhere;font-size:.82rem}.content-import-status{display:flex;flex-wrap:wrap;gap:.4rem;color:var(--muted);font-size:.74rem}.content-import-present{border:1px solid var(--border);border-radius:3px;padding:0 .3rem}input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}button:disabled{opacity:.5}
19
- `,U=e=>!e.present&&!e.error,dr=class extends R{static styles=[...R.styles,P(ur)];static properties={selected:{state:!0}};constructor(){super(),this.plan={kind:`report`,items:[],groups:[]},this.selected=new Set}beforeOpen(){this.selected=new Set(this.plan.items.filter(e=>e.synced&&U(e)).map(e=>e.value))}toggle(e,t){if(!U(e))return;let n=new Set(this.selected);t?n.add(e.value):n.delete(e.value),this.selected=n}confirmationResult(e){let t=this.plan.items.filter(e=>this.selected.has(e.value)&&U(e)).map(e=>e.value),n=e&&t.length>0&&!this.signal?.aborted;return{confirmed:n,selected:n?t:[]}}render(){let e=this.plan.kind===`bundle`?`bundles`:`reports`;return this.prompt({title:`Import ${e}`,titleId:`content-import-title`,body:`Choose files to upload. Cloud-synced files are selected by default.`,notes:F`<p class="lwd-note">Workspaces are shown for organization only. Teams and triage are not imported. Repository locations follow each file’s embedded metadata; files without it stay unattached.</p><div class="content-import-groups">${this.plan.groups.map(e=>F`<fieldset><legend>${e.name}</legend>${e.items.map(({item:e,synced:t,cached:n})=>F`<label class="${`content-import-item${U(e)?``:` unavailable`}`}"><input type="checkbox" .checked="${this.selected.has(e.value)}" ?disabled="${e.present||!!e.error}" @change="${t=>this.toggle(e,t.target.checked)}"> <span class="content-import-label"><strong>${e.name}</strong> <span class="content-import-status">${t?`Cloud synced`:`Not synced`}${n?` · last known status`:``} ${e.present?F`<span class="content-import-present">Already present</span>`:I}</span> ${e.error?F`<span>${e.error}</span>`:I}</span></label>`)}</fieldset>`)} ${this.plan.items.length===0?F`<p class="lwd-empty">No local ${e} available.</p>`:I}</div>`,status:F`<span class="lwd-empty" role="status">${this.selected.size} selected</span>`,action:`Import ${e}`,kind:`primary`,disabled:this.selected.size===0})}};customElements.define(`local-content-import-dialog`,dr);function fr(e){return x(`local-content-import-dialog`,e)}var pr=class extends R{constructor(){super(),this.matched=0,this.available=0}confirmationResult(e){return{confirmed:e&&this.matched>0&&!this.signal?.aborted}}render(){let e=this.matched>0;return this.prompt({title:`Import local triage`,titleId:`import-title`,body:F`<strong>${this.matched}</strong> of <strong>${this.available}</strong> local triage ${this.available===1?`entry`:`entries`} can be imported.`,notes:F`<p class="lwd-note">${e?`Import saved triage and comments for these findings? Conflicting values will prompt for resolution.`:this.available>0?`None match findings in managed reports.`:`There is no saved local triage to import.`}</p>${this.available>this.matched?F`<p class="lwd-empty">Unmatched entries stay in this browser.</p>`:I}`,cancel:e?`Cancel`:`Close`,action:e?`Import triage`:null,kind:`primary`})}};customElements.define(`local-triage-import-dialog`,pr);function mr(e){return x(`local-triage-import-dialog`,e)}var hr=`dialog{width:min(94vw,800px);max-width:800px;max-height:calc(100dvh - 4rem);margin-block:2rem;padding:0}dialog[open]{display:flex;flex-direction:column}.discussion-header{display:flex;align-items:start;gap:1rem;padding:1rem 1.25rem;border-bottom:1px solid var(--border)}.discussion-heading{flex:1;min-width:0}header h3{display:flex;align-items:center;gap:.5rem;margin:0;line-height:1.5}.comment-count{padding:.05rem .4rem;border-radius:1rem;background:rgb(from var(--muted) r g b / .12);color:var(--muted);font-size:.72rem;font-weight:400}.discussion-finding{margin-top:.4rem;font-size:.85rem;overflow-wrap:anywhere}.loc{margin-top:.25rem;color:var(--muted)}.header-actions{display:flex;flex:none;align-items:center;gap:.7rem}.header-actions button{display:inline-flex;flex:none;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:0;background:transparent;color:var(--muted);line-height:0;& svg{display:block;width:1rem;height:1rem}&:hover:not(:disabled){color:var(--text)}&:disabled{opacity:.5}}.comment-action{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:.2rem;border:1px solid transparent;border-radius:var(--ui-radius, 4px);background:transparent;color:var(--muted);cursor:default;& svg{width:.9rem;height:.9rem}&:hover:not(:disabled),&[aria-pressed=true]{border-color:var(--border);background:rgb(from var(--muted) r g b / .08);color:var(--text)}&.danger:hover:not(:disabled),&[aria-expanded=true]{color:var(--critical)}&:disabled{opacity:.5}}button:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:var(--ui-radius, 3px)}.discussion-log{min-height:0;max-height:50dvh;overflow-y:auto;overscroll-behavior:contain;padding:.5rem;scrollbar-gutter:stable}.comments{display:flex;flex-direction:column;gap:.15rem;list-style:none}.comment{padding:.6rem .75rem;border-radius:var(--ui-radius, 6px);font-size:.84rem}.comment:hover{background:rgb(from var(--muted) r g b / .035)}.comment.editing{background:rgb(from var(--accent) r g b / .08);box-shadow:inset 0 0 0 1px rgb(from var(--accent) r g b / .2)}.delete-confirm{display:flex;align-items:center;justify-content:end;flex-wrap:wrap;gap:.5rem;margin-top:.6rem;color:var(--muted);font-size:.75rem;& button{padding:.25rem .55rem;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:transparent;color:var(--text);font:inherit;&:hover:not(:disabled){background:rgb(from var(--muted) r g b / .08)}&.danger{color:var(--critical)}&:disabled{opacity:.5}}}.empty-discussion{padding:2.5rem 0;color:var(--muted);text-align:center;font-size:.85rem}.composer{padding:1rem 1.25rem;border-top:1px solid var(--border)}.composer-label{display:flex;align-items:center;gap:.45rem;margin-bottom:.6rem;font-size:.78rem}.composer-label strong{font-weight:600}textarea{min-height:4.5rem;max-height:25dvh;font-size:.84rem}.nwd-actions{border:0;padding-top:0;margin-top:.65rem}.shortcut{color:var(--muted);font-size:.7rem}.error{padding:.65rem 1.25rem;color:#c44;font-size:.8rem}.read-only{padding:1rem 1.25rem;border-top:1px solid var(--border);color:var(--muted);font-size:.8rem}@media(width<=480px){.discussion-header,.composer{padding:.8rem}.discussion-log{padding-inline:.3rem}.comment{padding-inline:.5rem}.shortcut{max-width:8rem}}
20
- `,gr=()=>E.managedSession.name?.trim()||E.managedSession.login,_r=class extends b{static styles=[...b.styles,P(fn),P(a),P(hr)];static properties={finding:{attribute:!1},changed:{attribute:!1},_comments:{state:!0},_value:{state:!0},_editing:{state:!0},_busy:{state:!0},_error:{state:!0},_deleting:{state:!0}};constructor(){super(),this.finding=null,this.changed=null,this._comments=[],this._value=``,this._editing=null,this._busy=!1,this._error=``,this._deleting=null}connectedCallback(){super.connectedCallback(),document.addEventListener(`managed-comments-reset`,this._close)}disconnectedCallback(){this._unsubscribeComments?.(),this._unsubscribeComments=null,document.removeEventListener(`managed-comments-reset`,this._close),super.disconnectedCallback()}beforeOpen(){this._current=de(this.finding?._managedReportId),this._comments=_(this.finding),this._unsubscribeComments?.(),this._unsubscribeComments=re(this.finding.id,this._commentsChanged),this._refresh({scroll:!0})}_commentsChanged=()=>{if(!this.isConnected)return;if(!this._current()){this._close();return}let e=this._atBottom();this._comments=_(this.finding),e&&this._scrollToLatest()};_close=()=>this._finish(null);_atBottom(){let e=this.renderRoot.querySelector(`.discussion-log`);return e&&e.scrollHeight-e.scrollTop-e.clientHeight<32}_scrollToLatest=async()=>{await this.updateComplete;let e=this.renderRoot.querySelector(`.discussion-log`);e&&(e.scrollTop=e.scrollHeight)};_refresh=async({scroll:e=!1}={})=>{if(!this._current()){this._close();return}let t=this._atBottom();this._busy=!0,this._error=``;let n=await pe(this.finding._managedReportId);if(this.isConnected){if(!this._current()){this._close();return}if(this._busy=!1,!n){this._error=`Could not load comments. Please retry.`;return}this._comments=_(this.finding),this.changed?.(),(e||t)&&this._scrollToLatest()}};_edit(e){this._deleting=null,this._editing=e,this._value=e.body,this._error=``,this.updateComplete.then(()=>this.renderRoot.querySelector(`textarea`)?.focus())}_cancelEdit=()=>{this._editing=null,this._value=``,this._error=``};_delete=async e=>{if(this._busy||!this._current())return;this._busy=!0,this._error=``;let t=await ve(this.finding,e);this.isConnected?this._current()?(this._busy=!1,this._deleting=null,t===409?(await this._refresh(),this.isConnected&&(this._error=`This comment changed elsewhere. Review the latest version before deleting it.`)):t===204?(this._comments=_(this.finding),this._editing?.id===e.id&&this._cancelEdit(),this.changed?.()):this._error=t===403||t===404?`This comment is unavailable or you no longer have permission to delete it.`:`Could not delete the comment. Please retry.`):this._close():t===204&&this._current()&&this.changed?.()};_save=async()=>{let e=this._value.trim();if(this._busy||!e||e.length>1e4||!this._current())return;this._busy=!0,this._error=``;let t=await he(this.finding,e,this._editing);if(!this.isConnected)return;if(!this._current()){this._close();return}if(this._busy=!1,t.status===409){if(await this._refresh(),!this.isConnected)return;this._editing=this._comments.find(e=>e.id===this._editing?.id)??this._editing,this._error=`This comment changed elsewhere. Your draft is kept. Review the latest version above before saving again.`;return}if(!t.comment){this._error=t.status===403||t.status===404?`You no longer have permission to save this comment.`:`Could not save the comment. Your draft is kept; please retry.`;return}let n=this._editing!=null;this._comments=_(this.finding),this._cancelEdit(),this.changed?.(),n||await this._scrollToLatest(),await this.updateComplete,this.renderRoot.querySelector(`textarea`)?.focus()};_keydown=e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this._save())};_commentActions(e,t){let n=t&&e.authorId===E.managedSession?.id,r=ue(e);return!n&&!r?I:F`${n?F`<button type="button" class="comment-action" aria-label="Edit comment" aria-pressed="${this._editing?.id===e.id}" ?disabled="${this._busy}" @click="${()=>this._edit(e)}">${A(Xt)}</button>`:I} ${r?F`<button type="button" class="comment-action danger" aria-label="Delete comment" aria-expanded="${this._deleting===e.id}" ?disabled="${this._busy}" @click="${()=>{this._deleting=this._deleting===e.id?null:e.id}}">${A(Zt)}</button>`:I}`}_deleteConfirmation(e){return this._deleting!==e.id||!ue(e)?I:F`<div class="delete-confirm" role="group" aria-label="Confirm comment deletion"><span>Delete this comment?</span> <button type="button" ?disabled="${this._busy}" @click="${()=>{this._deleting=null}}">Cancel</button> <button type="button" class="danger" ?disabled="${this._busy}" @click="${()=>this._delete(e)}">Delete</button></div>`}render(){let e=ce();return F`<dialog aria-labelledby="comments-title" @close="${this._onClose}"><header class="discussion-header"><div class="discussion-heading"><h3 id="comments-title">Discussion <span class="comment-count">${this._comments.length}</span></h3>${this.finding?.title?F`<p class="discussion-finding">${this.finding.title}</p>`:I}<p class="loc">${this.finding?.file??``}</p></div><div class="header-actions"><button type="button" class="refresh" aria-label="Refresh discussion" ?disabled="${this._busy}" @click="${()=>this._refresh()}"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8M21 3v5h-5"/></svg></button> <button type="button" class="close" aria-label="Close discussion" @click="${this._close}"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="m6 6 12 12M6 18 18 6"/></svg></button></div></header><section class="discussion-log" role="log" aria-label="Discussion" aria-relevant="additions text" aria-busy="${this._busy}"><ol class="comments">${this._comments.map(t=>F`<li class="${`comment${this._editing?.id===t.id?` editing`:``}`}">${Oe(t,ke(t.body),this._commentActions(t,e))} ${this._deleteConfirmation(t)}</li>`)}</ol>${this._comments.length===0?F`<p class="empty-discussion">${this._busy?`Loading discussion…`:e?`No comments yet. Start the discussion below.`:`No comments yet.`}</p>`:I}</section>${this._error?F`<p class="error" role="alert">${this._error}</p>`:I} ${e?F`<form class="composer" @submit="${e=>{e.preventDefault(),this._save()}}"><label class="composer-label" for="comment-body">${De(E.managedSession.id,gr())} ${this._editing?`Edit your comment`:F`Reply as <strong>${gr()}</strong>`}</label> <textarea id="comment-body" rows="3" maxlength="${1e4}" .value="${this._value}" placeholder="Write a comment…" aria-describedby="comment-shortcut" ?disabled="${this._busy}" @input="${e=>{this._value=e.target.value}}" @keydown="${this._keydown}"></textarea><footer class="nwd-actions"><span id="comment-shortcut" class="shortcut">Ctrl / ⌘ + Enter to send</span><span class="nwd-spacer"></span> ${this._editing?F`<button type="button" class="quiet" ?disabled="${this._busy}" @click="${this._cancelEdit}">Cancel edit</button>`:I} <button type="submit" class="primary" ?disabled="${this._busy||!this._value.trim()}">${this._editing?`Save changes`:`Comment`}</button></footer></form>`:F`<p class="read-only">You have read-only access to this discussion.</p>`}</dialog>`}};customElements.define(`managed-comments-dialog`,_r);function vr(e,t){return x(`managed-comments-dialog`,{finding:e,changed:t})}var yr=new Set([`github-unavailable`,`unavailable`,`shutting-down`,`github-create-failed`]);async function br(e,t,n,r=null){let i=`/api/teams/${encodeURIComponent(e)}/issues`,a,o;try{a=await f(r?i:`${i}?${new URLSearchParams(t)}`,{method:r?`POST`:`GET`,credentials:`same-origin`,headers:{accept:`application/json`,...r?{"content-type":`application/json`,"x-csrf-token":n}:{}},...r?{body:JSON.stringify({...t,...r})}:{}}),o=await a.json()}catch{throw Error(r?`github-create-uncertain`:`github-unavailable`)}if(!a.ok){let e=typeof o?.error==`string`&&o.error?o.error:null;throw Error(r&&a.status>=500&&!yr.has(e)?`github-create-uncertain`:e??(r?`github-create-uncertain`:`github-unavailable`))}return o}var xr=`dialog{max-width:1040px;width:min(1040px,calc(100vw - 32px));margin-top:2rem;max-height:calc(100dvh - 4rem);overflow:hidden}dialog[open]{display:flex;flex-direction:column}header,.nwd-actions{flex-shrink:0}.dialog-content{min-height:0;overflow:auto;scrollbar-gutter:stable;padding:3px}.nwd-intro{overflow-wrap:anywhere}label{display:flex;flex-direction:column;gap:6px;margin:12px 0}textarea{min-height:clamp(240px,45dvh,540px);resize:vertical;line-height:1.55}.description-heading{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px;margin:16px 0 6px}.description-heading label{margin:0}.description-sections{display:flex;flex:1;flex-wrap:wrap;justify-content:flex-end;gap:6px}.description-sections label{flex-direction:row;align-items:center;font-size:.8rem;line-height:1.3;cursor:default;padding:5px 8px;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);color:var(--muted);background:var(--surface)}.description-sections label:has(input:checked){color:var(--text);border-color:color-mix(in srgb,var(--accent) 65%,var(--border));background:color-mix(in srgb,var(--accent) 10%,var(--surface))}.description-sections label:has(input:focus-visible){outline:2px solid var(--accent);outline-offset:2px}.description-sections label:has(input:disabled){opacity:.55}.description-sections input{accent-color:var(--accent);flex-shrink:0}.description-help{margin:0 0 8px}.nwd-actions{flex-wrap:wrap}.nwd-actions a{font-size:.8rem}@media(width<=600px){dialog{margin-top:1rem;max-height:calc(100dvh - 2rem)}.description-sections{flex-basis:100%;justify-content:flex-start}}a{color:var(--accent)}.created-issue{padding:16px;border:1px solid var(--border);border-radius:var(--ui-radius, 8px)}.issue-heading{display:flex;align-items:center;gap:8px;margin-bottom:12px}.issue-status{padding:3px 10px;border-radius:20px;background:#238636;color:#fff;font-size:.8rem}.issue-status.closed{background:#8250df}.issue-status.not_planned,.issue-status.duplicate,.issue-status.unknown{background:#656d76}.issue-number{color:var(--muted)}h4{font-size:1.15rem;line-height:1.4;overflow-wrap:anywhere}.issue-description{margin-top:16px;white-space:pre-wrap;overflow-wrap:anywhere;max-height:40vh;overflow:auto;line-height:1.5;font-size:.9rem}.issue-labels{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px}.issue-labels span{border:1px solid var(--border);border-radius:12px;padding:2px 8px;font-size:.75rem}.para+.para,.md-list{margin-top:.75em}.md-list{padding-left:1.5em}.md-list li.md-task{list-style:none;position:relative}.md-task>input{position:absolute;left:-1.4em;top:.2em;margin:0}.md-heading{font-weight:600;margin-top:.75em}.md-rule{border:0;border-top:1px solid var(--border)}.inline-code,.code-block{font-family:monospace;background:var(--bg);border-radius:4px}.inline-code{padding:1px 4px}.code-block{white-space:pre;overflow:auto;padding:10px;margin:10px 0}
21
- `,W={"github-unavailable":`GitHub could not be reached. Try checking again.`,"github-issue-forbidden":`GitHub did not permit issue creation. Check your repository access and authorization.`,"github-create-uncertain":`GitHub may have created this issue. Check the repository before trying again.`,"github-create-failed":`GitHub could not create the issue. Check the title and description before trying again.`,unauthenticated:`Your session expired. Sign in again before creating an issue.`,"workspace-changed":`Your workspace access changed. Reopen the finding before creating an issue.`,"bad-issue-repository":`The finding’s repository changed. Reopen the finding before creating an issue.`,"no-finding":`This finding is no longer available in this workspace.`},Sr={not_planned:`Not planned`,duplicate:`Duplicate`,completed:`Completed`},Cr=3e3;function wr(e,t){let n,r=new Promise(e=>{n=setTimeout(e,t,null)});return Promise.race([e.catch(()=>null),r]).finally(()=>clearTimeout(n))}var Tr=class extends b{static styles=[...b.styles,P(xr),P(e)];static properties={teamId:{attribute:!1},context:{attribute:!1},session:{attribute:!1},formUrl:{attribute:!1},title:{state:!0},body:{state:!0},prepared:{state:!0},busy:{state:!0},creating:{state:!0},message:{state:!0},uncertain:{state:!0},createdUrl:{state:!0},createdIssue:{state:!0},detailsUnavailable:{state:!0},sections:{state:!0}};constructor(){super(),this.title=``,this.body=``,this.prepared=null,this.busy=!1,this.creating=!1,this.message=``,this.uncertain=!1,this.createdUrl=``,this.createdIssue=null,this.detailsUnavailable=!1,this.sections=[],this.footer=null,this.draftEdited=!1}beforeOpen(){this.finding&&Object.assign(this,be(this.finding,{...this.draftOptions,allSections:!0})),this.check(!0)}editBody(e){this.draftEdited=!0,Object.assign(this,Se(this,e))}toggleSection(e,t){this.draftEdited=!0,Object.assign(this,we(this,e,t))}current(){return!this._settled&&this.isCurrent()}fallbackUrl(){let e=new URL(this.formUrl);return e.searchParams.set(`title`,this.title),e.searchParams.set(`body`,this.body),this.prepared?.labels&&e.searchParams.set(`labels`,this.prepared.labels.join(`,`)),e.href}async check(e=!1){if(!this.busy&&this.current()){this.busy=!0,this.message=``;try{this.optionsWait??=this.draftOptionsReady?wr(this.draftOptionsReady,Cr):null;let[t,n]=await Promise.all([br(this.teamId,this.context,this.session.csrfToken),this.optionsWait]);if(!this.current())return;n&&(this.draftOptions=n),this.prepared=t,this.uncertain=!1,this.finding&&!this.draftEdited&&Object.assign(this,be(this.finding,{...this.draftOptions,allSections:t.mode!==`form`})),t.mode===`existing`&&(this.onCreated?.(t.url),window.location.assign(t.url)),e&&t.mode===`form`&&window.location.assign(this.fallbackUrl())}catch(e){!this.uncertain&&![`pending`,`created-unavailable`].includes(this.prepared?.mode)&&(this.prepared=null),this.message=W[e.message]??`Unable to check this issue. Please retry.`}finally{this.busy=!1}}}async create(){if(!(this.busy||this.uncertain||this.createdUrl||this.prepared?.mode!==`api`)){if(!this.current()){this.message=W[`workspace-changed`],this.prepared=null;return}this.busy=!0,this.creating=!0,this.message=``;try{let e=await br(this.teamId,this.context,this.session.csrfToken,{title:this.title,body:this.body});if(!this.current())return;e.mode===`existing`?(this.onCreated?.(e.url),window.location.assign(e.url)):e.url?(this.createdUrl=e.url,this.createdIssue=e.issue,this.detailsUnavailable=e.detailsUnavailable===!0,this.onCreated?.(e.url)):this.prepared=e}catch(e){e.message===`github-authorization-required`?this.prepared={mode:`authorize`,authorizationPath:`/api/oauth/github/issues/login`}:(this.uncertain=e.message===`github-create-uncertain`,[`workspace-changed`,`bad-issue-repository`,`no-team`,`no-report`,`no-finding`,`unauthenticated`,`forbidden`].includes(e.message)&&(this.prepared=null),this.message=W[e.message]??`Could not create this issue. Check the title, description, and repository access.`)}finally{this.busy=!1,this.creating=!1}}}render(){let e=this.createdIssue,t=this.prepared,n=t?.mode===`created-unavailable`,r=this.createdUrl||n,i=this.uncertain||t?.mode===`pending`,a=this.creating||i,o=!this.busy&&!i&&t?.mode===`form`;return F`<dialog aria-labelledby="issue-dialog-title" @close="${this._onClose}" @cancel="${e=>{this.creating&&e.preventDefault()}}"><header><h3 id="issue-dialog-title">${r?`Issue created`:`Create a GitHub issue`}</h3></header><div class="dialog-content"><p class="nwd-intro">${r?`Created`:`Create`} in <strong>${this.context?.repository}</strong> as <strong>@${this.session?.login}</strong>.</p>${this.createdUrl?F`<section class="created-issue" aria-label="Created GitHub issue"><div class="issue-heading"><span class="${`issue-status ${e?.status??`open`} ${e?.stateReason??``}`}">${e?.status===`closed`?Sr[e.stateReason]??`Closed`:`Open`}</span> <span class="issue-number">${e?.number?`#${e.number}`:``}</span></div><h4><a href="${this.createdUrl}" target="_blank" rel="noopener">${e?.title??this.title}</a></h4><p class="nwd-note">Opened by @${e?.author??this.session?.login}</p>${e?.labels?.length?F`<div class="issue-labels">${e.labels.map(e=>F`<span>${e}</span>`)}</div>`:I}<div class="issue-description">${this.renderBody?this.renderBody(e?.description??this.body):e?.description??this.body}</div><p class="nwd-note ui-hint">Linked permanently to this finding. The Issue button will open this issue next time.</p>${this.detailsUnavailable?F`<p class="nwd-note">GitHub’s latest details could not be loaded. The issue was created and its link is saved.</p>`:I}</section>`:n?F`<p role="status">The issue was created and linked permanently to this finding. Its details cannot be shown because workspace access could not be confirmed. Check its status again once workspace access is available.</p>`:F`<label>Title<input class="nwd-input" maxlength="256" .value="${this.title}" ?disabled="${a}" @input="${e=>{this.title=e.target.value}}"></label><div class="description-heading"><label for="issue-description">Description</label> ${this.sections.length>0?F`<div class="description-sections" role="group" aria-label="Include in description">${this.sections.map(e=>F`<label><input type="checkbox" .checked="${e.selected}" ?disabled="${a}" @change="${t=>this.toggleSection(e.id,t.target.checked)}">${e.label}</label>`)}</div>`:I}</div><p id="description-help" class="nwd-note description-help ui-hint">${this.sections.length>0?`Add or remove sections above. Your edits are kept when toggling them.`:`Edit the description before creating the issue.`}</p><textarea id="issue-description" class="nwd-input" maxlength="65536" .value="${this.body}" aria-describedby="description-help" ?disabled="${a}" @input="${e=>this.editBody(e.target.value)}"></textarea> ${t?.labels?.length?F`<p class="nwd-note">Labels: ${t.labels.join(`, `)}</p>`:I} ${t?.mode===`permissions`?F`<p>Ask a repository owner to approve the app’s Issues read and write permission. ${t.authorizationPath?F`<a href="${t.authorizationPath}" target="_blank" rel="noopener">Review repository permissions</a>`:I}</p>`:I} ${t?.mode===`authorize`?F`<p><a href="${t.authorizationPath}" target="_blank" rel="noopener">Authorize GitHub</a>, then check authorization here.</p>`:I} ${t?.mode===`pending`?F`<p role="status">An issue is being created, or its creation could not be confirmed. Check its status before continuing; another issue will not be created.</p>`:I} ${t?.mode===`unavailable`?F`<p role="status">This finding already has a managed issue in a repository outside this workspace.</p>`:I}`} ${!this.createdUrl&&this.message?F`<p class="nwd-note" role="status">${this.message}</p>`:I} ${!this.createdUrl&&this.busy?F`<p role="status">${this.creating?`Creating issue…`:`Checking repository access…`}</p>`:I}</div><footer class="nwd-actions">${this.createdUrl?F`<a href="${this.createdUrl}" target="_blank" rel="noopener">Open issue on GitHub</a>`:!this.busy&&i?F`<a href="${t?.repositoryUrl??`https://github.com/${this.context?.repository}/issues`}" target="_blank" rel="noopener">Check repository issues</a>`:o?F`<a href="${this.fallbackUrl()}" target="_blank" rel="noopener">Use GitHub form</a>`:I} <span class="nwd-spacer"></span> ${!this.createdUrl&&t?.mode!==`unavailable`?t?.mode===`api`&&!this.uncertain?F`<button class="primary" ?disabled="${this.busy||!this.title.trim()}" @click="${this.create}">Create issue</button>`:F`<button ?disabled="${this.busy}" @click="${()=>this.check()}">${i||n?`Check issue status`:`Check authorization`}</button>`:I} <button ?disabled="${this.creating}" @click="${()=>this._finish(null)}">${r?`Close`:`Cancel`}</button></footer></dialog>`}};customElements.define(`managed-issue-dialog`,Tr);function Er(e){return x(`managed-issue-dialog`,e)}var Dr=`.share-field{display:grid;gap:.35rem;margin-top:.8rem;font-size:.82rem}fieldset{display:grid;gap:.55rem;border:0;margin-top:1rem;font-size:.82rem}legend{margin-bottom:.55rem;font-weight:600}fieldset label{display:flex;align-items:center;gap:.5rem}input[type=checkbox]{accent-color:var(--accent)}.nwd-actions{flex-wrap:wrap}.revoke-all{margin-top:.75rem;border:0;background:none;color:var(--muted);font:inherit;font-size:.74rem}.revoke-all:hover:not(:disabled){color:var(--critical)}
22
- `,Or=class extends b{static styles=[...b.styles,P(Dr)];static properties={team:{attribute:!1},session:{attribute:!1},initialId:{attribute:!1},selectedId:{state:!0},links:{state:!0},dependencies:{state:!0},security:{state:!0},busy:{state:!0},message:{state:!0}};constructor(){super(),this.team=null,this.initialId=``,this.selectedId=``,this.links=[],this.dependencies=!1,this.security=!1,this.busy=!0,this.message=``,this.urls=new Map}beforeOpen(){this.load(this.initialId)}select(e){let t=this.links.find(t=>t.id===e);this.selectedId=t?.id??``,this.dependencies=t?.permissions.dependencies===!0,this.security=t?.permissions.security===!0,this.message=``}async load(e=this.selectedId){this.busy=!0;try{let t=await m(this.team.id);return this._settled?void 0:(this.links=t,this.select(e),!0)}catch(e){return this.message=e.message,!1}finally{this.busy=!1}}async change(e=!1,t=!1){if(!this.busy){this.busy=!0,this.message=``;try{let n=await d(this.team.id,this.session?.csrfToken,{id:t?void 0:this.selectedId||void 0,revoke:e,dependencies:this.dependencies,security:this.security});if(p.invalidate([`links`,`history`]),this._settled)return;n.path&&(this.urls.set(n.id,new URL(n.path,location.origin).href),this.links=[{id:n.id,createdAt:Date.now(),createdBy:this.session?.login??``,permissions:{dependencies:this.dependencies,security:this.security}},...this.links],this.selectedId=n.id),e&&(t?this.urls.clear():this.urls.delete(this.selectedId)),await this.load(e?``:n.id??this.selectedId)&&(this.message=e?t?`All public links revoked.`:`Link revoked.`:n.path?`Link created.`:`Permissions saved. The link URL is unchanged.`)}catch(e){this.message=e.message}finally{this.busy=!1}}}async copy(){try{await navigator.clipboard.writeText(this.urls.get(this.selectedId)),this.message=`Link copied.`}catch{this.message=`Select the link and copy it.`}}render(){let e=this.urls.get(this.selectedId);return F`<dialog @close="${this._onClose}"><header><h3>Share ${this.team?.name}</h3></header><p class="nwd-intro ui-hint">Anyone with this link can read this workspace’s published reports, comments, triage, and available source files without signing in.<br>New published reports will also be included.</p><label class="share-field">Public links <select class="nwd-input" ?disabled="${this.busy}" @change="${e=>this.select(e.target.value)}"><option value="" ?selected="${!this.selectedId}">Create a new link</option>${this.links.map(e=>F`<option value="${e.id}" ?selected="${this.selectedId===e.id}">${new Date(e.createdAt).toLocaleString()} · ${e.createdBy} · ${e.id.slice(0,8)}</option>`)}</select></label><fieldset ?disabled="${this.busy}"><legend>Include in this link</legend><label><input type="checkbox" .checked="${this.security}" @change="${e=>{this.security=e.target.checked}}"> Security findings and advisories</label> <label><input type="checkbox" .checked="${this.dependencies}" @change="${e=>{this.dependencies=e.target.checked}}"> Findings in dependencies</label></fieldset><p class="nwd-note ui-hint">Both options are off for new links.<br>Existing links keep their URL when permissions change.</p>${e?F`<label class="share-field">Public link<input class="nwd-input" readonly="readonly" .value="${e}" @focus="${e=>e.target.select()}"></label>`:I} ${this.message?F`<p class="nwd-note" role="status">${this.message}</p>`:I}<footer class="nwd-actions">${this.selectedId?F`<button class="danger" ?disabled="${this.busy}" @click="${()=>this.change(!0)}">Revoke link</button>`:I} <span class="nwd-spacer"></span> ${e?F`<button @click="${()=>this.copy()}">Copy link</button>`:I} <button class="primary" ?disabled="${this.busy}" @click="${()=>this.change()}">${this.selectedId?`Save changes`:`Create public link`}</button> <button @click="${()=>this._finish(null)}">Close</button></footer>${this.links.length>0?F`<button class="revoke-all" ?disabled="${this.busy}" @click="${()=>this.change(!0,!0)}">Revoke all links for this workspace</button>`:I}</dialog>`}};customElements.define(`managed-share-dialog`,Or);function kr(e,t=``,n=null){return x(`managed-share-dialog`,{team:e,initialId:t,session:n})}var Ar=class extends b{static properties={_value:{state:!0}};constructor(){super(),this._value=``}_onInput=e=>{this._value=e.target.value};_onCreate=()=>{let e=this._value.trim();e&&this._finish(e)};_onKeydown=w(()=>this._onCreate());render(){return F`<dialog @close="${this._onClose}"><header><h3>New workspace</h3></header><input type="text" class="nwd-input" placeholder="Workspace name" maxlength="200" .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"><p class="nwd-note ui-hint">Workspace triage is synchronized by default over an end-to-end encrypted channel. Triage on unattached reports stays local to this browser.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._value.trim()}" @click="${this._onCreate}">Create</button></footer></dialog>`}};customElements.define(`new-workspace-dialog`,Ar);function jr(){return x(`new-workspace-dialog`)}var Mr=`.bundle-advisories-rows{list-style:none;margin:0;padding:0;min-width:0;display:flex;flex-direction:column}.bundle-advisory-row{display:flex;align-items:flex-start;gap:.65rem;padding:.25rem 0;line-height:1.35}.bundle-advisory-row+.bundle-advisory-row{border-top:1px solid color-mix(in oklch,var(--border) 65%,transparent)}.bundle-advisory-rail{flex-shrink:0;display:flex;flex-direction:column;align-items:center;gap:.125rem;min-width:4.5rem;padding-top:.1rem}.bundle-advisory-severity{text-transform:uppercase;letter-spacing:.04em;font-size:.6rem;font-weight:700;padding:.15rem .4rem;border-radius:3px;color:#000;&.sev-critical{background:var(--critical);color:#fff}&.sev-high{background:var(--high)}&.sev-moderate{background:var(--medium)}&.sev-low{background:var(--low);color:var(--badge-low-text)}&.sev-info{background:var(--info);color:#fff}}.bundle-advisory-cvss-score{color:var(--muted);font-size:.62rem;letter-spacing:.02em}.bundle-advisory-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:.125rem}.bundle-advisory-header{display:flex;align-items:baseline;gap:.5rem}.bundle-advisory-title{flex:1;min-width:0;color:var(--text);font-size:.82rem;font-weight:500;overflow-wrap:anywhere}button.bundle-advisory-title{border:0;background:transparent;padding:0;font-family:inherit;line-height:inherit;text-align:left}button.bundle-advisory-title:hover{color:var(--accent)}button.bundle-advisory-title:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.bundle-advisory-reference{display:inline-flex;align-items:center;gap:.4rem;flex-shrink:0}.bundle-advisory-source{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;color:var(--muted);user-select:none}.bundle-advisory-source>svg{width:14px;height:14px}.bundle-advisory-subrow{display:flex;align-items:baseline;gap:.75rem}.bundle-advisory-meta{flex:1;min-width:0;color:var(--muted);font-size:.7rem;display:flex;flex-wrap:wrap;gap:.65rem;align-items:baseline}.bundle-advisory-meta .mono{font-size:.68rem}.bundle-advisory-cwes{margin-left:1.25rem}.bundle-advisory-ghsa{flex-shrink:0;display:inline-flex;align-items:center;gap:.2rem;color:var(--muted);text-decoration:none;font-size:.7rem;font-family:ui-monospace,monospace;cursor:default;user-select:text}.bundle-advisory-ghsa .external-link-icon{flex-shrink:0;opacity:.75;user-select:none}a.bundle-advisory-ghsa:hover .external-link-icon{opacity:1}.bundle-advisory-cwe{color:var(--muted);text-decoration:none;user-select:text;cursor:default}a.bundle-advisory-ghsa:hover,.bundle-advisory-cwe:hover{color:var(--accent)}.bundle-advisory-cvss-vector{flex-shrink:1;min-width:0;text-align:right;color:var(--muted);font-size:.65rem;font-family:ui-monospace,monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
23
- `,Nr=`dialog{width:min(94vw,56rem)}.compare-advisories{min-height:0;padding:.75rem 1rem 1rem;overflow:auto;overscroll-behavior:contain}.compare-advisories:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.compare-advisory-group+.compare-advisory-group{margin-top:.9rem}.compare-advisory-group h4{display:flex;align-items:baseline;gap:.4rem;margin:0 0 .25rem;padding:0 .55rem;color:var(--muted);font-size:.68rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase}.compare-advisory-count{font-variant-numeric:tabular-nums}.compare-advisory-group>.bundle-advisories-rows{padding:.1rem .55rem;border:1px solid transparent;border-radius:var(--ui-radius, 4px)}.compare-advisory-group .bundle-advisory-rail{width:5rem;align-items:stretch;text-align:center}.compare-advisory-group.is-new{& h4{color:var(--critical)}>.bundle-advisories-rows{background:color-mix(in srgb,var(--critical) 6%,var(--bg));border-color:color-mix(in srgb,var(--critical) 55%,var(--border))}}.compare-advisory-group.is-fixed{.bundle-advisory-title{color:var(--muted);text-decoration:line-through}.bundle-advisory-severity{opacity:.55}}
24
- `,Pr=class extends b{static styles=[...b.styles,P(Mr),P(ln),P(Nr)];static properties={heading:{attribute:!1},groups:{attribute:!1},_current:{state:!0}};connectedCallback(){super.connectedCallback(),this._dispose=D(()=>{this._current=this.isCurrent(),this._current||queueMicrotask(this._onClose)})}disconnectedCallback(){this._dispose?.(),super.disconnectedCallback()}render(){return F`<dialog aria-labelledby="compare-advisories-title" @close="${this._onClose}"><header><h3 id="compare-advisories-title"><span>${this.heading}</span></h3><button type="button" aria-label="Close advisories" @click="${this._onClose}">×</button></header><div class="compare-advisories" tabindex="0">${this._current?this.groups.map(e=>F`<section class="${`compare-advisory-group is-${e.status}`}"><h4>${e.heading} <span class="compare-advisory-count">${e.rows.length}</span></h4><ul class="bundle-advisories-rows">${e.rows}</ul></section>`):I}</div></dialog>`}};customElements.define(`npm-compare-advisories-dialog`,Pr);function Fr(e){return x(`npm-compare-advisories-dialog`,e)}var Ir=e=>e.kind===`bundle`?e.label??`bundle-${e.identifier.slice(7,19)}\u2026`:e.identifier,Lr=e=>e.kind===`bundle`?`bundle`:Ve(e.identifier)?`links file`:`report`,Rr=class extends b{static styles=[...b.styles,P(L)];static properties={_running:{state:!0},_errors:{state:!0},_done:{state:!0}};constructor(){super(),this._running=!1,this._errors=[],this._done=!1}get copy(){return this.constructor.copy}focusInitial(){this.renderRoot.querySelector(`button[data-role="${this.copy.verb.toLowerCase()}"]`)?.focus()}_onClose=()=>this._finish({[this.copy.key]:[],failed:[]});transferred(){}_onRun=async()=>{if(this._running)return;this._running=!0,this._errors=[];let e=[],t=[];for(let n of this.items){let{kind:r,identifier:i}=n,a;try{a=await this.transfer(n)}catch(e){a=e?.message??String(e)}a===void 0?e.push({kind:r,identifier:i}):(t.push({kind:r,identifier:i,reason:a}),this._errors=[...this._errors,{label:Ir(n),reason:a}])}this._running=!1,this._done=!0,await this.transferred(e),t.length===0&&this._finish({[this.copy.key]:e,failed:t})};render(){let{verb:e,heading:t,one:n,many:r,note:i=I}=this.copy,a=this.items.length,o=a===1,s=new Set(this.items.map(Lr)),c=s.size===1?`${[...s][0]}${o?``:`s`}`:`items`,l=this._done&&this._errors.length>0,u=this._running?o?`${e}ing\u2026`:`${e}ing ${a} ${c}\u2026`:o?e:`${e} ${a}`;return F`<dialog @close="${this._onClose}"><header><h3>${t}</h3></header><p class="lwd-body">${o?n(Ir(this.items[0])):r(a,c)}</p>${o?I:F`<ul class="lwd-list">${this.items.map(e=>{let t=Lr(e);return F`<li>${Ir(e)}${t===`report`?I:F`<span class="lwd-kind-tag">${t}</span>`}</li>`})}</ul>`} ${i} ${this._errors.length===0?I:F`<ul class="lwd-list" role="alert">${this._errors.map(e=>F`<li><strong>${e.label}</strong> — ${e.reason}</li>`)}</ul>`}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._running}">${l?`Close`:`Cancel`}</button> ${l?I:F`<button type="button" data-role="${e.toLowerCase()}" @click="${this._onRun}" ?disabled="${this._running||a===0}">${u}</button>`}</footer></dialog>`}};function zr(e,{workspaceId:t,items:n}={}){return x(e,{workspaceId:t??``,items:Array.isArray(n)?[...n]:[]})}var Br=class extends Rr{static copy={verb:`Download`,heading:`Download from remote`,key:`downloaded`,one:e=>F`Download <strong>"${e}"</strong> from the workspace's remote inventory?`,many:(e,t)=>F`Download <strong>${e}</strong> remote ${t} into this workspace?`};async transfer({kind:e,identifier:t}){if(e===`bundle`){let e=await Et(this.workspaceId,t);if(!e.ok)return e.reason??`unknown`;await Ce(t,this.workspaceId);return}let n=await wt(this.workspaceId,t);return n?.ok?void 0:n?.reason??`sync is not available`}async transferred(e){if(e.some(e=>e.kind===`report`))try{E.currentWorkspace===this.workspaceId&&await Ct(this.workspaceId)}catch{}}};customElements.define(`sync-download-dialog`,Br);function Vr(e){return zr(`sync-download-dialog`,e)}var Hr=`.rec-close{position:absolute;top:6px;right:6px;z-index:1}header{padding-right:1.5rem}.rec-list{margin:.2rem 0 .55rem;list-style:none;max-height:320px;overflow-y:auto}.rec-row{display:flex;align-items:center;gap:.5rem;padding:.28rem .15rem;font-size:.8rem;line-height:1.4;border-bottom:1px solid rgb(from var(--text) r g b / .06)}.rec-row:last-child{border-bottom:none}.rec-label{flex:1 1 auto;min-width:0;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rec-status{flex:0 0 auto;padding:0 .4rem;border-radius:4px;font-size:.68rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em}.rec-status-checking{color:var(--muted)}.rec-status-good{color:#16a34a}.rec-status-uploaded,.rec-status-reuploaded{color:var(--accent)}.rec-status-updated{color:var(--high)}.rec-status-differs,.rec-status-failed,.rec-status-check-failed{color:var(--warning);background:rgb(from var(--warning) r g b / .14)}.rec-status-missing{color:var(--critical)}.rec-choice{flex:0 0 auto;display:flex;gap:.3rem;& button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:var(--ui-radius, 4px);padding:.1rem .45rem;font:inherit;font-size:.72rem;cursor:default;&:hover:not(:disabled){border-color:var(--accent);color:var(--accent)}&:disabled{opacity:.5}}}.rec-summary{margin:.1rem 0 .2rem;color:var(--muted);font-size:.76rem;line-height:1.45}.rec-error{margin:.3rem 0 .2rem;color:var(--critical);font-size:.76rem;line-height:1.4}
25
- `,Ur=e=>e===1?`copy`:`copies`,G={checking:{label:`checking…`,hint:`Checking the cloud copy…`},good:{label:`available`,hint:`The cloud copy is intact.`,summary:e=>`${e} available`},updated:{label:`local updated`,hint:`Your copy was out of date. It was replaced with the cloud copy.`,summary:e=>`${e} local ${Ur(e)} updated from the cloud`},uploaded:{label:`cloud updated`,hint:`Your copy was newer. It was uploaded to the cloud.`,summary:e=>`${e} cloud ${Ur(e)} updated from yours`},differs:{label:`differs`,hint:`Your copy differs from the cloud copy, and nothing shows which one is newer. Choose which to keep.`,summary:e=>`${e} ${e===1?`differs`:`differ`} \u2014 choose which copy to keep`},reuploaded:{label:`re-uploaded`,hint:`The cloud copy's data was missing. It was restored from your copy.`,summary:e=>`${e} re-uploaded`},failed:{label:`failed`,hint:`Couldn't bring this back in line. Re-check again to retry.`,summary:e=>`${e} failed`},"check-failed":{label:`check failed`,hint:`Couldn't download the cloud copy to check it, so its state is unknown. Re-check again to retry.`,summary:e=>`${e} check failed`},missing:{label:`missing`,hint:`The cloud copy's data is gone, and there's no matching copy here to restore it from.`,summary:e=>`${e} missing`}},Wr=Object.keys(G).filter(e=>G[e].summary);function Gr(e){let t=Object.fromEntries(Wr.map(e=>[e,0]));for(let n of e)n.status in t&&(t[n.status]+=1);return t}var Kr=class extends b{static styles=[...b.styles,P(O),P(L),P(Hr)];static properties={_rows:{state:!0},_running:{state:!0},_ran:{state:!0},_error:{state:!0},_resolving:{state:!0},_bulk:{state:!0}};constructor(){super(),this._rows=[],this._running=!1,this._ran=!1,this._error=null,this._resolving=new Set,this._bulk=!1}focusInitial(){this.renderRoot.querySelector(`button[data-role="recheck"]`)?.focus(),this.autoRun&&this._onRecheck()}_onClose=()=>this._finish(this._ran?{items:this._rows,counts:Gr(this._rows)}:null);_differingRows(){return this._rows.filter(e=>e.status===`differs`)}_onResolve=async(e,t)=>{if(this._resolving.has(e.resourceTag))return;this._resolving=new Set([...this._resolving,e.resourceTag]);let n;try{let r=await It(this.workspaceId,e.identifier,t,e.compared);n=r?{status:r.status,detail:r.detail}:{status:`failed`,detail:`sync is not available`}}catch(e){n={status:`failed`,detail:e?.message??String(e)}}this._rows=this._rows.map(t=>t.resourceTag===e.resourceTag?{...t,...n}:t),this._resolving=new Set([...this._resolving].filter(t=>t!==e.resourceTag))};_onUseCloudForAll=async()=>{if(!(this._bulk||this._running)){this._bulk=!0;try{for(let e of this._differingRows())await this._onResolve(e,`cloud`)}finally{this._bulk=!1}}};_onRecheck=async()=>{if(!(this._running||this._bulk||this._resolving.size>0)){this._running=!0,this._error=null,this._rows=[];try{let{items:e}=await Ft(this.workspaceId,{onList:e=>{this._rows=e},onItem:e=>{this._rows=this._rows.map(t=>t.resourceTag===e.resourceTag?e:t)}});this._rows=e}catch(e){this._error=e?.message??String(e)}finally{this._running=!1,this._ran=!0}}};_heldLocally(e){return e.identifier?e.kind===`bundle`?this.localBundles.includes(e.identifier):this.localFileNames.includes(e.identifier):!1}_downloadableItems(){return this._rows.filter(e=>e.status===`good`&&e.identifier&&(e.kind===`report`||e.kind===`bundle`)&&!this._heldLocally(e)).map(e=>e.kind===`report`?{kind:`report`,identifier:e.identifier}:{kind:`bundle`,identifier:e.identifier,label:e.label})}_onDownload=async()=>{let e=this._downloadableItems();e.length>0&&await Vr({workspaceId:this.workspaceId,items:e})};_statusHint(e){let t=e.status===`good`&&this._heldLocally(e)?`The cloud copy is intact and matches your copy.`:G[e.status]?.hint??``;return e.detail?`${t}
26
- ${e.detail}`:t}_choice(e){if(e.status!==`differs`)return I;let t=this._running||this._bulk||this._resolving.has(e.resourceTag);return F`<span class="rec-choice"><button type="button" data-role="keep-cloud" data-tooltip="Replace your copy with the cloud copy" @click="${()=>this._onResolve(e,`cloud`)}" ?disabled="${t}">Use cloud copy</button> <button type="button" data-role="keep-local" data-tooltip="Upload your copy, replacing the cloud copy" @click="${()=>this._onResolve(e,`local`)}" ?disabled="${t}">Upload mine</button></span>`}_rowsSection(){return this._rows.length===0?this._running?F`<p class="lwd-body">Fetching remote listing…</p>`:I:F`<ul class="rec-list">${this._rows.map(e=>F`<li class="rec-row"><span class="rec-label">${e.label}${e.kind===`bundle`?F`<span class="lwd-kind-tag">bundle</span>`:I}</span> ${this._choice(e)} <span class="${`rec-status rec-status-${e.status}`}" data-tooltip="${this._statusHint(e)}">${G[e.status]?.label??e.status}</span></li>`)}</ul>`}_summarySection(){if(!this._ran||this._rows.length===0)return I;let e=Gr(this._rows),t=Wr.filter(t=>e[t]).map(t=>G[t].summary(e[t]));return t.length>0?F`<p class="rec-summary" role="status" aria-live="polite">${t.join(` · `)}</p>`:I}render(){let e=this.cloudCount===1?``:`s`,t=this.cloudCount>0?F`the <strong>${this.cloudCount}</strong> remote`:`remote`,n=this._ran?this._downloadableItems().length:0,r=this._differingRows().length>1||this._bulk;return F`<dialog @close="${this._onClose}"><button type="button" class="detail-action rec-close" data-role="close" aria-label="Close" @click="${this._onCancel}">×</button><header><h3>Re-check cloud storage</h3></header>${this._ran?I:F`<p class="lwd-body">Re-check ${t} object${e} for this workspace. Each is re-fetched from the relay and compared with your copy. When one copy is provably newer, the other is updated to match; when it isn't clear, you choose which to keep. Any whose bytes are missing are re-uploaded from a matching local copy.</p>`} ${this._rowsSection()} ${this._ran&&this._rows.length===0&&!this._error?F`<p class="lwd-empty">No remote objects to check.</p>`:I} ${this._summarySection()} ${this._error?F`<p class="rec-error" role="alert">${this._error}</p>`:I}<footer class="nwd-actions"><span class="nwd-spacer"></span> ${r?F`<button type="button" data-role="use-cloud-all" data-tooltip="Replace your copy of every report that differs with its cloud copy" @click="${this._onUseCloudForAll}" ?disabled="${this._running||this._bulk}">${this._bulk?`Using cloud copies…`:`Use cloud for all ${this._differingRows().length} conflicts`}</button>`:I} ${!r&&n>0?F`<button type="button" data-role="download" @click="${this._onDownload}" ?disabled="${this._running}">Download ${n} not stored locally</button>`:I} ${r?I:F`<button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._running}">${this._ran?`Close`:`Cancel`}</button>`} <button type="button" data-role="recheck" @click="${this._onRecheck}" ?disabled="${this._running||this._bulk||this._resolving.size>0}">${this._running?`Re-checking…`:this._ran?`Re-check again`:`Re-check`}</button></footer></dialog>`}};customElements.define(`objstore-recovery-dialog`,Kr);function qr({workspaceId:e,cloudCount:t,localFileNames:n,localBundles:r,autoRun:i}={}){return x(`objstore-recovery-dialog`,{workspaceId:e??``,cloudCount:typeof t==`number`?t:0,localFileNames:Array.isArray(n)?[...n]:[],localBundles:Array.isArray(r)?[...r]:[],autoRun:i===!0})}var Jr=`Encryption was just enabled in another tab.`,Yr=class extends b{static styles=[...b.styles,P(g)];static properties={_userName:{state:!0},_busy:{state:!0},_error:{state:!0},_phase:{state:!0},_success:{state:!0},_orphan:{state:!0},_orphanAck:{state:!0},_canCancel:{state:!0}};constructor(){super(),this._userName=``,this._busy=!1,this._error=``,this._phase=``,this._success=!1,this._orphan=!1,this._orphanAck=!1,this._canCancel=!0,this._abortController=null}updated(e){e.has(`_success`)&&this._success&&this.renderRoot.querySelector(`footer button.primary`)?.focus()}beforeOpen(){typeof location<`u`&&(this._userName=location.hostname||`DeepView`),this._orphan=tt(),this._vaultStateUnsub=rt(()=>{if(this._settled)return;let e=tt();this._orphan&&!e&&Ge()?(this._error=`${Jr} Close this dialog and reload to unlock.`,this._busy=!1,this._canCancel=!0):this._orphan!==e&&(this._orphan=e)})}async focusInitial(){await this.updateComplete,this.renderRoot.querySelector(this._orphan?`input[data-role="orphan-ack"]`:`input[data-role="name"]`)?.focus()}disconnectedCallback(){super.disconnectedCallback();try{this._vaultStateUnsub?.()}catch{}this._vaultStateUnsub=null}_finish(e){if(!this._settled){try{this._abortController?.abort()}catch{}super._finish(!!e)}}_onClose=()=>this._finish(this._success);_onCancel=e=>{this._busy&&!this._canCancel?e?.preventDefault():this._finish(!1)};_onNameInput=e=>{this._userName=e.target.value};_onOrphanAckInput=e=>{this._orphanAck=e.target.checked};_onWipeOrphan=async()=>{if(!this._busy&&this._orphanAck){if(Ge()){this._error=`${Jr} Reload this page to unlock.`;return}this._busy=!0,this._canCancel=!1,this._error=``,this._phase=`Clearing previous vault state…`;try{await ut({refuseIfEnabled:!0}),location.reload()}catch(e){this._error=`Could not clear previous vault state: ${e?.message??e}`,this._phase=``}finally{this._busy=!1,this._canCancel=!0}}};_onEnable=async()=>{if(!this._busy){if(!Ze()){this._error=`Passkeys are not supported in this browser.`;return}this._busy=!0,this._canCancel=!0,this._error=``,this._phase=`Registering passkey…`,this._abortController=new AbortController;try{await st({userName:this._userName.trim()||`DeepView user`,rpName:`DeepView`,signal:this._abortController.signal,migrate:async({seal:e})=>{this._canCancel=!1,this._phase=`Encrypting workspaces and metadata…`,await ht({seal:e}),this._phase=`Encrypting triage data…`,await Me({seal:e}),this._phase=`Encrypting report files…`,await ne({seal:e}),this._phase=`Encrypting bundles…`,await ae({seal:e})}})&&(this._success=!0,this._phase=``)}catch(e){this._error=e?.name===`AbortError`?``:e?.message??String(e),this._phase=``}finally{this._busy=!1,this._canCancel=!0,this._abortController=null}}};_status(){return F`${this._phase?F`<p class="nwd-note">${this._phase}</p>`:I} ${this._error?F`<p class="wsl-error">${this._error}</p>`:I}`}_footer(e,t,n){return F`<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" ?disabled="${this._busy&&!this._canCancel}" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${t}" @click="${n}">${this._busy?`Working…`:e}</button></footer>`}_orphanBody(){return F`<p class="wsl-error">DeepView found an abandoned passkey setup on this device. The original passkey can no longer be accessed, so any local data still encrypted under it is <strong>unreadable</strong> and cannot be recovered.</p><p class="nwd-note ui-hint">To enable encryption, DeepView will <strong>permanently delete ALL local DeepView data on this device</strong> — including any plaintext workspaces or reports you may have added after the previous passkey was lost — and then register a fresh passkey. This is irreversible. There is no backup.</p><label class="wsl-ack"><input type="checkbox" data-role="orphan-ack" .checked="${this._orphanAck}" ?disabled="${this._busy}" @change="${this._onOrphanAckInput}"> <span>I understand all local DeepView data on this device will be deleted.</span></label> ${this._status()} ${this._footer(`Wipe and continue`,this._busy||!this._orphanAck,this._onWipeOrphan)}`}_enableBody(){let e=Ze();return F`<p class="nwd-note ui-hint">Passkey encryption protects your local triage and report data with a hardware-backed key (TouchID, Windows Hello, security key). Without the passkey, the data on disk is unreadable — even to scripts running on this origin.</p><p class="wsl-error"><strong>If you lose access to this passkey, your data CANNOT be recovered.</strong> DeepView has no backup key, no recovery code, and no escrow. Make sure your passkey is backed up (iCloud Keychain / Google Password Manager sync, or a second registered device) before relying on encryption for important data.</p><p class="nwd-note ui-hint"><strong>Opt-in.</strong> You can disable encryption later from the lock icon in the sidebar header — the data is rewritten as plaintext and DeepView signals your authenticator to remove the passkey (where supported).</p>${e?I:F`<p class="wsl-error">Your browser doesn't expose the WebAuthn passkey API. Try Chrome, Safari, Edge, or Firefox in a recent version on a device with a platform authenticator.</p>`} <label class="wsl-field"><span>Passkey label</span> <input type="text" class="nwd-input" data-role="name" placeholder="DeepView" maxlength="200" .value="${this._userName}" @input="${this._onNameInput}"></label> ${this._status()} ${this._footer(`Enable encryption`,!e||this._busy,this._onEnable)}`}_successBody(){return F`<p class="nwd-note ui-hint"><strong>Encryption is on.</strong> Your triage data and report files are now sealed under your passkey. You'll be asked to unlock with the passkey on every fresh load.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" class="primary" @click="${()=>this._finish(!0)}">Close</button></footer>`}render(){return F`<dialog @close="${this._onClose}" @cancel="${this._onCancel}"><header><h3>${this._success?`Encryption enabled`:this._orphan?`Previous passkey setup detected`:`Enable passkey encryption`}</h3></header>${this._orphan?this._orphanBody():this._success?this._successBody():this._enableBody()}</dialog>`}};customElements.define(`passkey-setup-dialog`,Yr);function Xr(){return x(`passkey-setup-dialog`)}var Zr=class extends b{_onClose=()=>this._finish({shown:!0});render(){return F`<dialog @close="${this._onClose}"><header><h3>Changes might not be saved</h3></header><p class="nwd-intro">Triage works in this tab, but this browser <strong>can't save its sync state right now</strong> — so changes that haven't reached the server could be lost if you reload the page.</p><p class="nwd-intro">This usually means the browser's storage is full, or another tab is running a newer version of the app (to avoid overwriting that newer version's data, this tab has paused saving).</p><p class="nwd-note ui-hint">Free up space if storage is full, and close or reload other tabs of this app to the same version. This notice clears on its own once saving works again.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" class="primary" @click="${this._onClose}">Got it</button></footer></dialog>`}};customElements.define(`persistence-degraded-dialog`,Zr);function Qr(){return x(`persistence-degraded-dialog`,{},{exclusive:!0,conflict:()=>({shown:!1})})}function $r(e){if(zt(e))throw Error(`This is a links file, not a report. Wrap report rows in a groups or findings object to compare them.`);let t=e;try{let n=JSON.parse(e);Array.isArray(n)&&(t=JSON.stringify({groups:n}))}catch{}let{data:n,reason:r}=nn(t);if(!n)throw Error(r);let i=[],a=new Map,o=0;for(let e of tn(n)){let t=new Set;for(let n of Array.isArray(e)?e:[e])if(n&&typeof n==`object`&&!Array.isArray(n)){if(typeof n.id!=`string`||!n.id){o++;continue}t.add(n.id),a.has(n.id)||a.set(n.id,[]),a.get(n.id).push(n)}i.push([...t].toSorted())}return{rows:i,byId:a,missingIds:o}}function ei(e){let t=new Set;for(let n of e){let e=[...new Set(n)].toSorted();for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++)t.add(JSON.stringify([e[n],e[r]]))}return t}function ti(e){let t=new Map,n=e=>{let n=e;for(;t.get(n)!==n;)t.set(n,t.get(t.get(n))),n=t.get(n);return n};for(let r of e){let[e,i]=JSON.parse(r);for(let n of[e,i])t.has(n)||t.set(n,n);t.set(n(e),n(i))}let r=new Map;for(let e of[...t.keys()].toSorted()){let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}return[...r.values()].toSorted((e,t)=>e[0].localeCompare(t[0]))}function K(e,t,n){let r=(e.byId.get(t)??[]).map(e=>n===`verdict`?on(e)||null:n===`severity`?an(e)??null:n===`originalSeverity`?e.severity??null:n===`confidence`&&Number.isFinite(e.confidence)?e.confidence:null);return[...new Set(r)].toSorted((e,t)=>String(e).localeCompare(String(t),void 0,{numeric:!0}))}var ni=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),q=(e,t)=>[...e].filter(e=>!t.has(e)).toSorted();function ri(e,t){let n=new Set(e.byId.keys()),r=new Set(t.byId.keys()),i=[...n].filter(e=>r.has(e)).toSorted(),a=new Set(i),o=e=>ei(e.rows.map(e=>e.filter(e=>a.has(e)))),s=o(e),c=o(t),l={confirmed:[],refuted:[],otherVerdicts:[],confidence:[],severity:[]};for(let n of i)for(let r of[`verdict`,`confidence`,`severity`]){let i=K(e,n,r),a=K(t,n,r),o={id:n,before:i,after:a};r===`severity`&&(o.originalBefore=K(e,n,`originalSeverity`),o.originalAfter=K(t,n,`originalSeverity`)),(!ni(i,a)||r===`severity`&&!ni(o.originalBefore,o.originalAfter))&&(r===`verdict`?l[a.length===1&&a[0]===`confirmed`?`confirmed`:a.length===1&&a[0]===`refuted`?`refuted`:`otherVerdicts`].push(o):l[r].push(o))}let u=ti(q(c,s)),d=ti(q(s,c)),f=q(r,n),p=q(n,r);return{before:e,after:t,added:f,removed:p,shared:i,joined:u,split:d,...l,unchanged:f.length===0&&p.length===0&&u.length===0&&d.length===0&&Object.values(l).every(e=>e.length===0)}}var ii=`dialog{width:min(94vw,1180px);max-width:1180px;height:min(88dvh,960px);max-height:92dvh;margin-block:auto;padding:0;overflow:hidden;background:var(--theme-bar)}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1.1rem 1.3rem}header h3{margin-bottom:.25rem;font-size:1.1rem}header p,.muted,.note,.empty{color:var(--muted);font-size:.78rem;line-height:1.5}button,select,input{font:inherit;font-size:.8rem}button,select,.file-button,.search{color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);padding:.45rem .65rem}button:not(:disabled):hover,.file-button:hover{background:var(--surface-active)}button:disabled{opacity:.45}button:focus-visible,select:focus-visible,.search:focus-visible,.file-button:focus-within{outline:2px solid var(--accent);outline-offset:2px}.pickers{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:start;gap:1rem;padding:0 1.3rem 1rem;border-bottom:1px solid var(--border)}.picker{min-width:0}.picker>label{display:block;font-size:.72rem;font-weight:600;margin-bottom:.4rem;color:var(--muted)}.picker select{width:100%;text-overflow:ellipsis}.file-picker{display:flex;align-items:center;flex-wrap:wrap;gap:.6rem;margin-top:.55rem}.file-button{position:relative;display:inline-block;font-size:.74rem;padding:.3rem .5rem;overflow:hidden}.file-button input{position:absolute;inset:0;opacity:0;width:100%}.swap{align-self:start;margin-top:1.5rem;font-size:1rem}.results{overflow:auto;min-height:0;padding:1.1rem 1.3rem 1.4rem}.summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.65rem}.summary>div{display:flex;flex-direction:column;gap:.35rem;padding:.8rem 1rem;background:var(--bg);border:1px solid var(--border);border-radius:var(--ui-radius, 7px)}.summary span{font-size:.72rem;color:var(--muted)}.summary strong{font-size:1.15rem;font-variant-numeric:tabular-nums}.positive h4{color:var(--green)}.negative h4,.verdict-confirmed h4,.summary .verdict-confirmed strong{color:var(--critical)}.verdict-refuted h4,.summary .verdict-refuted strong{color:var(--muted)}.change-counts{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.7rem}.change-counts span{font-size:.7rem;padding:.3rem .5rem;border-radius:5px;background:var(--bg);color:var(--muted)}.results-head{display:flex;align-items:center;flex-wrap:wrap;gap:.75rem;margin-block:1rem}.results-head p{flex:1;font-size:.78rem;color:var(--muted);overflow-wrap:anywhere}.search{width:min(100%,17rem)}.section-title{margin:1.2rem 0 .5rem;font-size:.87rem}.note{margin:-.15rem 0 .6rem}.columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.8rem}.change-section{border:1px solid var(--border);border-radius:var(--ui-radius, 7px);overflow:hidden;margin-bottom:.6rem}.change-section h4{display:flex;justify-content:space-between;align-items:center;gap:.5rem;font-size:.78rem;font-weight:600;padding:.65rem .8rem;background:var(--bg)}.count{font-variant-numeric:tabular-nums;font-size:.7rem}ul{list-style:none}li{border-top:1px solid var(--border);padding:.7rem .8rem}.change-row{display:flex;justify-content:space-between;align-items:start;gap:.8rem}.finding{display:flex;flex-direction:column;gap:.2rem;min-width:0;overflow-wrap:anywhere}.finding strong{font-size:.77rem;font-weight:500;line-height:1.4}.finding code,.finding small{color:var(--muted);font-size:.66rem;line-height:1.4}.change-value{display:flex;align-items:center;justify-content:end;flex-wrap:wrap;gap:.3rem;max-width:48%;flex-shrink:0;font-size:.73rem;text-align:end;overflow-wrap:anywhere}.from{color:var(--muted)}.change-value small{width:100%;color:var(--muted);font-size:.67rem}.group-members{display:flex;flex-direction:column;gap:.55rem}.group-shape{display:flex;flex-wrap:wrap;gap:.45rem;margin-top:.7rem;font:.66rem/1.5 monospace;overflow-wrap:anywhere}.group-shape>span{min-width:0}.empty{padding:.7rem .8rem}.more{margin:.5rem .8rem .7rem;font-size:.72rem}.placeholder{padding:4rem 1rem;text-align:center;color:var(--muted);font-size:.85rem}.identical{color:var(--green);font-size:.82rem;padding-block:.5rem}.error,.warning{font-size:.75rem;line-height:1.5;margin-top:.5rem;overflow-wrap:anywhere}.error{color:var(--critical)}.warning{color:var(--yellow)}dialog>.error{padding:0 1.3rem .6rem}@media(width<=650px){.pickers{gap:.5rem;padding-inline:.8rem}.columns{grid-template-columns:minmax(0,1fr);gap:0}.summary{grid-template-columns:repeat(2,minmax(0,1fr))}.summary>div{padding:.6rem}.results-head p{flex-basis:100%}.search{width:100%}header,.results{padding-inline:.8rem}.change-row{flex-wrap:wrap}.change-value{max-width:100%}}
27
- `,ai=()=>({key:``,name:``,report:null,error:``,loading:!1}),J=(e,t)=>e.map(e=>e===null?`Not supplied`:t===`confidence`?`${e}/10`:String(e).replaceAll(`_`,` `)).join(` / `),oi=50,si=class extends b{static styles=[...b.styles,P(ii)];static properties={_names:{state:!0},_sides:{state:!0},_catalogError:{state:!0},_catalogLoading:{state:!0},_diff:{state:!0},_query:{state:!0},_limits:{state:!0}};constructor(){super(),this._names=[],this._sides=[ai(),ai()],this._tokens=[0,0],this._catalogError=``,this._catalogLoading=!0,this._diff=null,this._query=``,this._limits={}}beforeOpen(){this._loadCatalog()}focusInitial(){this.renderRoot.querySelector(`select`)?.focus()}async _loadCatalog(){try{let e=await Ot();if(this._settled)return;this._names=e.filter(e=>fe(e)!==Rt);let t=this._names.includes(E.currentFile)?E.currentFile:this._names[0];t&&!this._tokens[0]&&this._select(0,t);let n=this._names.find(e=>e!==t);n&&!this._tokens[1]&&this._select(1,n)}catch(e){this._settled||(this._catalogError=`Couldn't list saved reports: ${e.message}`)}finally{this._settled||(this._catalogLoading=!1)}}_setSide(e,t){this._sides=this._sides.map((n,r)=>r===e?t:n),this._limits={};let[n,r]=this._sides.map(e=>e.report);this._diff=n&&r?ri(n,r):null}async _select(e,t,n){let r=++this._tokens[e],i={...ai(),key:n?``:t,name:t,loading:!!t};if(this._setSide(e,i),t)try{let a=n?await n.text():await At(t);if(this._settled||this._tokens[e]!==r)return;this._setSide(e,{...i,loading:!1,report:$r(a)})}catch(n){!this._settled&&this._tokens[e]===r&&this._setSide(e,{...i,loading:!1,error:`Couldn't read ${t}: ${n.message}`})}}_file(e,t){let n=t.target.files?.[0];t.target.value=``,n&&this._select(e,n.name,n)}_swap(){this._sides.some(e=>e.loading)||(this._tokens=this._tokens.map(e=>e+1),this._sides=this._sides.toReversed(),this._setSide(0,this._sides[0]))}_picker(e){let t=this._sides[e],n=e===0?`Before`:`After`;return F`<section class="picker"><label for="${`report-${e}`}">${n}</label> <select id="${`report-${e}`}" @change="${t=>this._select(e,t.target.value)}"><option value="" .selected="${!t.key}">${t.name&&!t.key?t.name:`Choose a saved report…`}</option>${this._names.map(e=>F`<option value="${e}" .selected="${t.key===e}">${e}</option>`)}</select><div class="file-picker"><label class="file-button">Open file…<input type="file" accept=".json,.md,.markdown" aria-label="${`Open ${n.toLowerCase()} report file`}" @change="${t=>this._file(e,t)}"></label> <span class="muted">${t.loading?`Reading report…`:t.report?`${t.report.byId.size.toLocaleString()} unique findings`:`JSON or Markdown`}</span></div>${t.error?F`<p class="error" role="alert">${t.error}</p>`:I} ${t.report?.missingIds?F`<p class="warning">${t.report.missingIds} findings without an id excluded.</p>`:I}</section>`}_finding(e){let t=this._diff.after.byId.get(e)?.[0]??this._diff.before.byId.get(e)?.[0];return F`<span class="finding"><strong>${N(t)||e}</strong><code>${e}</code>${t.file?F`<small>${t.file}</small>`:I}</span>`}_matches(e){let t=this._query.trim().toLowerCase();return!t||[e,...[...this._diff.before.byId.get(e)??[],...this._diff.after.byId.get(e)??[]].flatMap(e=>[N(e),e.file])].filter(Boolean).some(e=>e.toLowerCase().includes(t))}_section(e,t,n,r,i=``){let a=n.filter(e=>(Array.isArray(e)?e:[e.id??e]).some(e=>this._matches(e))),o=this._limits[e]??oi;return F`<section class="${`change-section ${i}`}" aria-label="${t}"><h4>${t}<span class="count">${this._query.trim()?`${a.length} / `:``}${n.length}</span></h4>${a.length>0?F`<ul>${a.slice(0,o).map(r)}</ul>`:F`<p class="empty">${n.length>0?`No matching findings.`:`No changes.`}</p>`} ${a.length>o?F`<button class="more" @click="${()=>{this._limits={...this._limits,[e]:o+oi}}}">Show ${Math.min(oi,a.length-o)} more (${a.length-o} remaining)</button>`:I}</section>`}_changeRow(e,t){let n=t===`severity`&&JSON.stringify(e.originalBefore)!==JSON.stringify(e.originalAfter);return F`<li class="change-row">${this._finding(e.id)}<span class="change-value"> <span class="from">${J(e.before,t)}</span><span aria-label="to">→</span><span>${J(e.after,t)}</span> ${n?F`<small>Original: ${J(e.originalBefore)} → ${J(e.originalAfter)}</small>`:I}</span></li>`}_presenceRow(e,t){let n=J(K(t,e,`verdict`));return F`<li class="change-row">${this._finding(e)}<span class="change-value"> <span>${J(K(t,e,`severity`))}</span><span>${J(K(t,e,`confidence`),`confidence`)}</span> ${n===`Not supplied`?I:F`<small>${n}</small>`}</span></li>`}_groupRow(e){let t=new Set(e),n=e=>e.rows.map(e=>e.filter(e=>t.has(e))).filter(e=>e.length).map(e=>e.join(`, `)).filter((e,t,n)=>n.indexOf(e)===t).join(` | `);return F`<li class="group-row"><div class="group-members">${e.map(e=>this._finding(e))}</div><div class="group-shape"><span class="from">${n(this._diff.before)}</span><span aria-label="to">→</span><span>${n(this._diff.after)}</span></div></li>`}_verdictCount(e,t){return[...e.byId.keys()].filter(n=>K(e,n,`verdict`).includes(t)).length}_results(){let e=this._diff;return e?F`<div class="summary" aria-label="Comparison summary"><div><span>Unique findings</span><strong>${e.before.byId.size} → ${e.after.byId.size}</strong></div><div><span>In common</span><strong>${e.shared.length}</strong></div><div class="verdict-confirmed"><span>Confirmed</span><strong>${this._verdictCount(e.before,`confirmed`)} → ${this._verdictCount(e.after,`confirmed`)}</strong></div><div class="verdict-refuted"><span>Refuted</span><strong>${this._verdictCount(e.before,`refuted`)} → ${this._verdictCount(e.after,`refuted`)}</strong></div></div><div class="change-counts" aria-label="Change counts"><span>${e.added.length} added</span><span>${e.removed.length} removed</span> <span>${e.joined.length} joined</span><span>${e.split.length} split</span> <span>${e.confidence.length} confidence</span><span>${e.severity.length} severity</span></div><div class="results-head"><p>Changes from <strong>${this._sides[0].name}</strong> to <strong>${this._sides[1].name}</strong>.</p><input class="search" type="search" aria-label="Filter comparison findings" placeholder="Filter by id, title or file…" .value="${this._query}" @input="${e=>{this._query=e.target.value,this._limits={}}}"></div>${e.shared.length===0&&(e.before.missingIds||e.after.missingIds)?F`<p class="warning" role="status">No shared ids to compare. Findings without ids cannot be matched.</p>`:e.unchanged?F`<p class="identical" role="status">No differences in finding ids, grouping, verdicts, confidence or severity.</p>`:I}<h3 class="section-title">Findings</h3><div class="columns">${this._section(`added`,`Added`,e.added,t=>this._presenceRow(t,e.after),`positive`)} ${this._section(`removed`,`Removed`,e.removed,t=>this._presenceRow(t,e.before),`negative`)}</div><h3 class="section-title">Revalidation</h3><p class="note">Changed verdicts for shared ids, grouped by the after report’s verdict.</p><div class="columns">${this._section(`confirmed`,`Confirmed`,e.confirmed,e=>this._changeRow(e,`verdict`),`verdict-confirmed`)} ${this._section(`refuted`,`Refuted`,e.refuted,e=>this._changeRow(e,`verdict`),`verdict-refuted`)}</div>${e.otherVerdicts.length>0?this._section(`other`,`Other verdict changes`,e.otherVerdicts,e=>this._changeRow(e,`verdict`)):I}<h3 class="section-title">Grouping</h3><p class="note">Only shared ids. Each cluster connects changed pairs; added or removed findings do not count as regrouping.</p><div class="columns">${this._section(`joined`,`Joined`,e.joined,e=>this._groupRow(e),`positive`)} ${this._section(`split`,`Split`,e.split,e=>this._groupRow(e),`negative`)}</div><h3 class="section-title">Ratings</h3><p class="note">Shared ids only. Severity includes report corrections; changes to original severity are also shown.</p><div class="columns">${this._section(`confidence`,`Confidence changes`,e.confidence,e=>this._changeRow(e,`confidence`))} ${this._section(`severity`,`Severity changes`,e.severity,e=>this._changeRow(e,`severity`))}</div>`:F`<p class="placeholder" role="status">${this._sides.some(e=>e.loading)||this._catalogLoading?`Loading reports…`:`Choose two saved reports or open two files to compare.`}</p>`}render(){return F`<dialog aria-labelledby="compare-title" @close="${this._onClose}"><header><div><h3 id="compare-title">Compare reports</h3><p>Compare findings, grouping and ratings between two reports.</p></div><button aria-label="Close report comparison" @click="${this._onClose}">Close</button></header><div class="pickers">${this._picker(0)}<button class="swap" aria-label="Swap before and after reports" ?disabled="${this._sides.some(e=>e.loading)}" @click="${this._swap}">⇄</button>${this._picker(1)}</div>${this._catalogError?F`<p class="error" role="alert">${this._catalogError} You can still open files directly.</p>`:I}<div class="results">${this._results()}</div></dialog>`}};customElements.define(`report-compare-dialog`,si);function ci(){if(Tt())throw Error(`Report comparison is available in local/E2E mode.`);return x(`report-compare-dialog`)}var li=`dialog{--issue-open: var(--green);--issue-merged: #a371f7;--issue-closed: var(--critical);--issue-quiet: var(--muted);--claude: #d97757;width:min(94vw,52rem);max-width:none;max-height:calc(100dvh - 7rem);padding:0;overflow:hidden}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:start;gap:.6rem;flex-shrink:0;padding:.8rem 1rem;border-bottom:1px solid var(--border)}header h3{display:flex;align-items:baseline;gap:.5rem;flex:1;min-width:0;margin:0;font-size:1rem;line-height:1.35;overflow-wrap:anywhere}header button{flex-shrink:0;border:0;background:transparent;color:var(--muted);font-family:inherit;font-size:1.4rem;line-height:1;padding:0 .25rem;&:hover{color:var(--text)}&.back{font-size:1.1rem}}.repo-item-body{display:flex;flex-direction:column;gap:.75rem;min-height:0;padding:.9rem 1rem 1rem;overflow:auto;overscroll-behavior:contain;font-size:.85rem}.repo-item-number{color:var(--muted);font-weight:400;font-variant-numeric:tabular-nums}.repo-item-meta{display:flex;flex-wrap:wrap;align-items:center;gap:.3rem .9rem;color:var(--muted)}.repo-item-meta strong{color:var(--text);font-weight:500}code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.9em;color:var(--text)}:is(.repo-item-badge,.repo-item-state){--state: var(--issue-open);&.is-merged,&.is-completed{--state: var(--issue-merged)}&.is-closed{--state: var(--issue-closed)}&.is-draft,&.is-not-planned{--state: var(--issue-quiet)}}.repo-item-badge{padding:.1rem .55rem;border-radius:999px;background:var(--state);color:var(--surface);font-weight:500}svg{flex:none;width:14px;height:14px;fill:none;stroke:currentcolor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}svg .fill{fill:currentcolor;stroke:none}svg .dotted{stroke-dasharray:1 2.2}.repo-item-state{display:inline-flex;align-self:center;color:var(--state)}.repo-item-mark{display:inline-flex;align-items:center;gap:.25rem;& svg{width:12px;height:12px}&.is-approved,&.is-success{color:var(--green)}&.is-changes,&.is-failure{color:var(--critical)}&.is-pending{color:var(--medium)}}.is-added{color:var(--green)}.is-deleted{color:var(--critical)}npm-delta{display:inline-block;flex:none;min-width:1px;min-height:1em}.npm-delta{flex:none;color:var(--muted);font-size:.7rem;white-space:nowrap;font-variant-numeric:tabular-nums}.npm-delta-published{margin-left:.35em;opacity:.8}.repo-item-labels{display:flex;flex-wrap:wrap;gap:.3rem}.repo-item-label{padding:0 .45rem;border:1px solid var(--border);border-radius:999px;font-size:.75rem;line-height:1.5;&:before{content:"";display:inline-block;width:.5rem;height:.5rem;margin-right:.3rem;border-radius:50%;background:var(--label, var(--muted));vertical-align:middle}}.repo-item-agents{display:inline-flex;align-items:center;align-self:start;gap:.25rem;height:1lh}.agent-mark{display:inline-flex}.agent-mark :is(svg,img){width:16px;height:16px}.agent-mark:is(.is-claude,.is-codex,.is-copilot) svg{fill:currentcolor;stroke:none}.agent-mark.is-claude svg{color:var(--claude)}.agent-logo{display:inline-flex}.agent-logo svg{flex:none}.agent-avatar{border-radius:3px}.repo-item-section{& h4{margin:0 0 .3rem;color:var(--muted);font-size:.72rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase}& h4.repo-item-deps-heading{display:flex;align-items:center;justify-content:space-between;gap:.5rem;min-height:1.6rem}& ul{margin:0;padding:0;list-style:none;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);overflow:hidden}& li+li{border-top:1px solid var(--border)}}.dependency-review-copy-button{display:inline-flex;align-items:center;justify-content:center;width:1.6rem;height:1.6rem;padding:0;border:0;border-radius:var(--ui-radius, 4px);background:transparent;color:var(--muted);&:hover{background:var(--surface-active);color:var(--text)}&.copied{color:var(--green)}& svg{width:.9rem;height:.9rem}}.repo-item-row{display:flex;align-items:center;gap:.5rem;width:100%;padding:.35rem .6rem;border:0;background:none;color:var(--text);font:inherit;text-align:left;text-decoration:none;&:hover{background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}}.repo-item-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.review-row{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem .7rem;padding:.35rem .6rem;& time{margin-left:auto;color:var(--muted);font-variant-numeric:tabular-nums}}.review-state{display:inline-flex;align-items:center;gap:.25rem;& svg{width:12px;height:12px}&.is-approved>svg{color:var(--green)}&:is(.is-changes,.is-failed)>svg{color:var(--critical)}&.is-running>svg{color:var(--medium)}&:is(.is-commented,.is-dismissed,.is-requested){color:var(--muted)}}.review-on{color:var(--muted);& a{color:var(--text);text-decoration:none;&:hover{color:var(--accent)}}}.review-path{flex:none;max-width:45%;margin-left:auto;overflow:hidden;color:var(--muted);text-overflow:ellipsis;white-space:nowrap}.review-severity{flex:none;padding:0 .35rem;border-radius:999px;background:var(--low);color:#fff;font-size:.68rem;font-weight:600;line-height:1.5;&.is-p0{background:var(--critical)}&.is-p1{background:var(--high)}&.is-p2{background:var(--medium);color:#000}}.repo-item-lockfiles+.repo-item-lockfiles{margin-top:.6rem}.repo-item-lockfiles>p{margin:0 0 .3rem;overflow-wrap:anywhere}.repo-item-version{color:var(--muted)}.repo-item-was{flex:0 1000 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted)}span.repo-item-row:hover{background:none}.repo-item-review{display:inline-flex;align-items:center;gap:.2rem;flex:none;font-size:.75rem;font-variant-numeric:tabular-nums;&.is-passed{color:var(--green)}&.is-wanted{color:var(--medium)}&.is-failed{color:var(--critical)}& svg{width:12px;height:12px}}.repo-item-failed{margin-bottom:.6rem;>p{margin:0 0 .3rem;color:var(--critical)}}.repo-item-unreviewed{margin-top:.6rem;& summary{color:var(--medium);cursor:default}& ul{margin-top:.3rem}}.repo-item-tag{flex:none;padding:0 .4rem;border:1px solid var(--border);border-radius:999px;color:var(--muted);font-size:.72rem;line-height:1.5}.repo-item-description{padding-top:.75rem;border-top:1px solid var(--border);white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6}.repo-item-quiet{color:var(--muted)}.nwd-actions{margin:0;padding:.6rem 1rem}.nwd-actions a{border:1px solid var(--border);border-radius:var(--ui-radius, 5px);padding:.35rem .9rem;color:var(--text);font-size:.8rem;text-decoration:none;&:hover{border-color:var(--accent);color:var(--accent)}&.primary{background:var(--accent);border-color:var(--accent);color:var(--surface);&:hover{color:var(--surface);filter:brightness(1.08)}}&:focus-visible{outline:2px solid var(--accent);outline-offset:2px}}a,button{cursor:default}:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.repo-item-body:focus{outline:none}
28
- `,ui=`.app-user{display:inline-flex;align-items:center;gap:.3em;min-width:0;max-width:100%;vertical-align:bottom}.app-user-avatar,.commit-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;flex:none;width:1.6em;height:1.6em;overflow:hidden;border-radius:50%;background:var(--surface-active);color:var(--muted);font-size:.7em;font-weight:600;line-height:1;& img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}}.app-user-mark{display:inline-flex;flex:none;width:1.15em;height:1.15em;& svg{flex:none;width:100%;height:100%;fill:currentcolor;stroke:none}& img{width:100%;height:100%;border-radius:3px;object-fit:cover}&.is-claude{color:var(--claude, #d97757)}&:is(.is-codex,.is-copilot){color:var(--text)}}.app-user-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.commit-avatars{display:inline-flex;flex:none;isolation:isolate}.commit-avatar{box-shadow:0 0 0 1.5px var(--bg);+.commit-avatar{margin-left:-.45em}&:nth-child(1){z-index:4}&:nth-child(2){z-index:3}&:nth-child(3){z-index:2}& svg{flex:none;width:62%;height:62%;fill:currentcolor;stroke:none}&.is-claude{background:#d97757;color:#fff}&.is-codex{background:#fff;color:#000}&.is-copilot{background:#0d1117;color:#fff}&:is(.is-codex,.is-copilot){box-shadow:0 0 0 1.5px var(--bg),inset 0 0 0 1px var(--border)}}
29
- `,di={open:[`open`,`Open`],merged:[`merged`,`Merged`],closed:[`closed`,`Closed`],branch:[`draft`,`A branch alone`]},Y=e=>e==null?``:new Date(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`}),X=(e,t)=>`${e.toLocaleString(`en-US`)} ${t}${e===1?``:`s`}`,fi=(e,t,n=!1)=>e?F`<a class="${n?`primary`:``}" href="${e}" target="_blank" rel="noopener noreferrer">${t}</a>`:I,pi=e=>e.map((e,t)=>F`${t>0?`, `:``}<code>${e}</code>`),mi=e=>e>0?F`<p class="repo-item-quiet">and ${e.toLocaleString(`en-US`)} more</p>`:I,hi={mirror:`mirror`,git:`git`,tarball:`tarball`,file:`file`},gi={"lockfile-unreadable":`A lockfile here couldn’t be read`,"lockfile-unsupported":`Bun’s lockfile here isn’t read`,"github-not-found":`GitHub has none of a lockfile here at a commit compared`},_i=6e4,Z=new Map,vi=(e,t)=>`${E.managedSession?.id}\0${E.managedSession?.role}\0${e}\0${t}`,yi=class extends b{static styles=[...b.styles,P(cn),P(e),P(t),P(ui),P(li)];static properties={repository:{attribute:!1},target:{attribute:!1},_trail:{state:!0},_items:{state:!0}};constructor(){super(),this._trail=[],this._items=new Map,this._controller=new AbortController}connectedCallback(){super.connectedCallback(),this._unsubscribe=me(e=>{(!e||e.repoId===this.repository?.repoId&&e.number===this._trail.at(-1)?.number)&&this.requestUpdate()}),this._unobserve=D(e=>{u(),e||this.requestUpdate()}),this._trail.length===0&&this.target&&this.open(this.target)}disconnectedCallback(){this._controller.abort(),this._unsubscribe?.(),this._unobserve?.(),super.disconnectedCallback()}focusInitial(){this.renderRoot.querySelector(`.repo-item-body`)?.focus()}open(e){if(this._trail=[...this._trail,e],e.number==null||this._items.has(e.number))return;let t=e.number,{repoId:n}=this.repository,r=Z.get(vi(n,t));r&&Date.now()-r.at<_i?this._items=new Map(this._items).set(t,{status:`ready`,item:r.item}):(this._items=new Map(this._items).set(t,{status:`loading`}),se(n,t,{signal:this._controller.signal}).then(e=>{c(n,[e],s(e));for(let[e,{at:t}]of Z)Date.now()-t>=_i&&Z.delete(e);return Z.set(vi(n,t),{item:e,at:Date.now()}),{status:`ready`,item:e}},e=>e?.name===`AbortError`?null:{status:`error`,error:e?.message||`It could not be read.`}).then(e=>(e&&(this._items=new Map(this._items).set(t,e)),null)))}back(){this._trail=this._trail.slice(0,-1)}render(){let e=this._trail.at(-1);if(!e)return I;let[t,n,r]=e.session?this.renderSession(e.session):this.renderItem(e);return F`<dialog aria-labelledby="repo-item-title" @close="${this._onClose}" @click="${this._onBackdrop}"><header>${this._trail.length>1?F`<button type="button" class="back" aria-label="Back" @click="${()=>this.back()}">←</button>`:I}<h3 id="repo-item-title">${t}</h3><button type="button" aria-label="Close" @click="${this._onClose}">×</button></header><div class="repo-item-body" tabindex="-1">${n}</div><div class="nwd-actions"><span class="nwd-spacer"></span>${r}</div></dialog>`}renderItem({number:e,preview:t}){let n=this._items.get(e),r=l(this.repository.repoId,e)?.item,i=r?{...t,...n?.item,...r}:n?.item??t??null,a=i?.kind??`issues`,s=this.repository.repo,c=s?`https://github.com/${s}/${a===`pulls`?`pull`:`issues`}/${e}`:null,[u,d]=i?et(a,i):[`open`,``],f=F`${i?F`<span class="${`repo-item-state is-${u}`}" role="img" aria-label="${d}">${Re[a][u]}</span>`:I} <span>${i?.title||`(no title)`} <span class="repo-item-number">#${e}</span></span>`,p=n?.status===`ready`?n.item:null,m=a===`pulls`,h=([e,t],n)=>F`<span class="${`repo-item-mark is-${n}`}">${t}${e}</span>`;return[f,F`<p class="repo-item-meta">${i?F`<span class="${`repo-item-badge is-${u}`}">${d}</span>`:I} ${i?.author?F`<span><strong>${xt(i.author)}</strong> opened ${Y(i.createdAt)}</span>`:i?.createdAt?F`<span>Opened ${Y(i.createdAt)}</span>`:I} ${i?.state===`merged`?F`<span>merged${p?.mergedBy?F` by <strong>${xt(p.mergedBy)}</strong>`:I} ${Y(i.mergedAt??i.closedAt)}</span>`:i?.closedAt&&i.state!==`open`?F`<span>closed ${Y(i.closedAt)}</span>`:I} ${i?.comments>0?F`<span class="repo-item-mark">${Be}${X(i.comments,`comment`)}</span>`:I}</p>${i?.labels?.length>0?F`<p class="repo-item-labels">${i.labels.map(e=>F`<span class="repo-item-label" style="${j(e.color?{"--label":`#${e.color}`}:{})}">${e.name}</span>`)}${i.moreLabels>0?F`<span class="repo-item-label">+${i.moreLabels}</span>`:I}</p>`:I} ${m&&i?.head?F`<p class="repo-item-meta"><span><code>${i.head}</code>${i.base?F` → <code>${i.base}</code>`:I}</span> <span><span class="is-added">+${i.additions.toLocaleString(`en-US`)}</span> <span class="is-deleted">−${i.deletions.toLocaleString(`en-US`)}</span></span> ${p?F`<span>${X(p.commits,`commit`)}</span><span>${X(p.files,`file`)} changed</span>`:I} ${Ue[i.review]&&i.state===`open`?h(Ue[i.review],i.review):I} ${y[i.checks]?h(y[i.checks],i.checks):I}</p>`:I} ${m&&p?o(p.reviews,s):I} ${p?this.renderLinked(m?`Closes`:`Closed by`,m?`issues`:`pulls`,m?p.closes:p.closedBy,p.moreLinked):I} ${m&&ge(i)?this.renderDependencies(e,i.state===`open`):I} ${p?F`<div class="repo-item-description">${p.body?Ie(Gt(p.body)):F`<p class="repo-item-quiet">No description.</p>`}</div>${p.bodyShortened?F`<p class="repo-item-quiet">Shortened here; the rest of it is on GitHub.</p>`:I}`:n?.status===`error`?F`<p class="repo-item-quiet" role="alert">${n.error}</p>`:F`<p class="repo-item-quiet" role="status">Reading it…</p>`}`,fi(c,`Open on GitHub`,!0)]}renderDependencies(e,t){let n=Te(this.repository.repoId,e,t);if(n.status===`ready`&&n.lockfiles.length===0&&!n.cut)return I;let r=n.status===`loading`?F`<p class="repo-item-quiet" role="status">Reading its lockfiles…</p>`:n.status===`error`?F`<p class="repo-item-quiet" role="alert">${n.error}</p>`:this.renderAdded(n);return F`<section class="repo-item-section"><h4 class="repo-item-deps-heading">New dependency versions${n.formatted?F`<dependency-review-copy .text="${n.formatted}" .label="${`Copy your dependency reviews`}"></dependency-review-copy>`:I}</h4>${r}</section>`}renderAdded(e){let{lockfiles:t,cut:n,review:r}=e,i=t.filter(e=>e.error||e.added.length>0),a=r?Ne(e):null;return F`${r?F`${this.renderReviewTerms(r)}${this.renderFailures(Fe(e),r)}`:I} ${i.length===0&&t.length>0?F`<p class="repo-item-quiet">None: every version its lockfiles lock, they locked before.</p>`:I} ${i.map(t=>F`<div class="repo-item-lockfiles"><p>${pi(t.paths)}</p>${xe(t)?F`<p class="repo-item-quiet" role="status">Stasis is still working out what its entries reach, which can take a few minutes. It is asked again as it does.</p>`:t.error===`stasis-failed`?F`<p class="repo-item-quiet" role="alert">Stasis couldn’t work out what its entries reach (${t.detail??`build-failed`}).</p>`:t.error?F`<p class="repo-item-quiet" role="alert">${gi[t.error]??`These lockfiles couldn’t be read`}${t.detail?`: ${t.detail}`:`.`}</p>`:F`<ul>${t.added.toSorted((e,t)=>+!!e.was-!!t.was).map(t=>F`<li>${this.renderPackage(t,r,!1,e.head)}</li>`)}</ul>${mi(t.more)}`}</div>`)} ${a?.count>0?F`<details class="repo-item-unreviewed"><summary>${a.count.toLocaleString(`en-US`)} on the base branch</summary><ul>${a.versions.map(t=>F`<li>${this.renderPackage(t,r,!0,e.head)}</li>`)}</ul>${mi(a.count-a.versions.length)}</details>`:I} ${n?F`<p class="repo-item-quiet">It changes more files, or lockfiles in more directories, than are read; those past them aren’t told.</p>`:I}`}renderReviewTerms({unasked:e,baselineError:t,baselineUnread:n=[],commentReviews:r,commentsFailed:i,byComments:a,lockfiles:o}){let s=n.slice(0,5);return F`${t?F`<p class="repo-item-quiet" role="alert">The versions its lockfiles locked at that commit couldn’t be read (${t}), so every version wants its reviews.</p>`:I} ${s.length>0?F`<p class="repo-item-quiet" role="alert">At that commit, ${pi(s)}${n.length>s.length?` and ${(n.length-s.length).toLocaleString(`en-US`)} more`:``} couldn’t be read, so the versions ${n.length===1?`it`:`they`} locked want reviews.</p>`:I} ${e?F`<p class="repo-item-quiet" role="alert">The server’s reviewed dependencies didn’t answer for ${X(e,`version`)}, so ${e===1?`it wants`:`they want`} reviews.</p>`:I} ${r&&!a?F`<p class="repo-item-quiet">Reviews in its comments by ${X(r,`reviewer`)} count too while it is open.</p>`:I} ${i?F`<p class="repo-item-quiet" role="alert">Its comments couldn’t be read for reviews, so none of theirs count.</p>`:I} ${o?F`<p class="repo-item-quiet">${o.mode===`include`?`Only these lockfiles are reviewed: `:`These lockfiles aren’t reviewed: `}${o.paths.length===0?`none`:pi(o.paths)}.</p>`:I}`}renderFailures(e,t){if(!e)return I;let{versions:n,count:r,unread:i,unchecked:a,cut:o}=e;return F`<div class="repo-item-failed" role="alert">${r>0?F`<p>Its review fails: ${X(r,`version`)} its lockfiles lock can’t be reviewed, as only npm’s registry’s, locked with an integrity, are.</p><ul>${n.map(e=>F`<li>${this.renderPackage(e,t,!0)}</li>`)}</ul>${mi(r-n.length)}`:I} ${i.length>0||a>0||o?F`<p>Its review fails: not every lockfile it changes was read${a>0?`, and they lock ${X(a,`version`)} past those checked`:``}.</p>`:I}</div>`}renderPackage(e,t=null,n=!1,r=null){let{name:i,version:a,source:o,from:s,dev:c,was:l}=e,u=(o===`registry`||o===`mirror`)&&a,d=n?null:$t(e,t),f=d?.name===i&&d.version!==a?d.version:void 0,p=e.patch?.path&&r?{hash:e.patch.hash,repoId:this.repository.repoId,commit:r,path:e.patch.path}:null,m=u&&(!e.patch||p)&&t?.canReview&&Ae(e,t)!==`unsupported`?M({view:`npm`,packageName:i,packageSpec:a,bundleTab:`review`,...d?{reviewPackage:d.name,reviewSpec:d.version}:{},...p?{patch:p}:{}}):null,h=u?m||f&&M({view:`npm`,packageName:i,packageSpec:a,bundleTab:`compare`,compareSpec:f})||M({view:`npm`,packageName:i,packageSpec:a}):null,g=F`${Xe}<span class="repo-item-title">${i}${a?F`<span class="repo-item-version">@${a}</span>`:I}</span> ${!n&&l?F`<span class="repo-item-was" data-tooltip-truncated data-tooltip="${`Was ${l.join(`, `)}`}">from ${l.join(`, `)}</span>`:I} ${this.renderReview(e,t)} ${o===`registry`&&a&&(!e.patch||p)&&Ae(e,t)===`wanted`?F`<npm-delta .name="${i}" .version="${a}" .base="${d?.version??`(empty)`}" .baseName="${d?.name??i}" .patch="${p}"></npm-delta>`:I} ${c?F`<span class="repo-item-tag" data-tooltip="Only devDependencies need it">dev</span>`:I} ${e.patch?F`<span class="repo-item-tag" data-tooltip="${e.patch.path?`pnpm patches it as it installs it, by ${e.patch.path}, which its reviews are of`:`pnpm patches it as it installs it, by a patch whose file isn’t known, which reviews here can’t read`}">patched</span>`:I} ${hi[o]?F`<span class="repo-item-tag" data-tooltip="${s??I}">${hi[o]}</span>`:I}`;return h?F`<a class="repo-item-row" href="${h}" target="_blank" rel="noopener noreferrer">${g}</a>`:F`<span class="repo-item-row">${g}</span>`}renderReview(e,t){let n=Ae(e,t);if(n===`unsupported`)return F`<span class="repo-item-review is-failed" data-tooltip="${ye[e.unsupported]}">can’t review</span>`;if(e.reviewed&&n===`passed`)return F`<span class="repo-item-review is-passed" data-tooltip="The server’s reviewed dependencies pass it">${y.success[1]}reviewed</span>`;if(e.rejected)return F`<span class="repo-item-review is-failed" data-tooltip="A reviewer rejects it: it wants their newer accepting review">rejected</span>`;if(n===`baseline`)return F`<span class="repo-item-tag" data-tooltip="Locked at the commit reviews are counted since: it needs none">baseline</span>`;if(!n)return I;let r=`${X(e.reviews,`full, accepting review`)} of ${t.required} required`;return F`<span class="${`repo-item-review is-${n}`}" data-tooltip="${r}">${n===`passed`?y.success[1]:I}${e.reviews}/${t.required}</span>`}renderLinked(e,t,n,r=0){return!n?.length&&!r?I:F`<section class="repo-item-section"><h4>${e}</h4>${n?.length?F`<ul>${n.map(e=>{let n={...e,kind:t,labels:[],comments:0},[r,i]=et(t,n);return F`<li><button type="button" class="repo-item-row" @click="${()=>this.open({number:e.number,preview:n})}"><span class="${`repo-item-state is-${r}`}" role="img" aria-label="${i}">${Re[t][r]}</span> <span class="repo-item-number">#${e.number}</span><span class="repo-item-title">${e.title||`(no title)`}</span></button></li>`})}</ul>`:I}${r>0?F`<p class="repo-item-quiet">${n?.length?`and `:``}${r.toLocaleString(`en-US`)} more, on GitHub</p>`:I}</section>`}renderSession(e){let t=this.repository.repo,[n,r]=di[e.state]??di.branch,i=e.pulls.length+e.commits.length,a=F`<span class="repo-item-agents">${e.agents.map(e=>F`<span class="${`agent-mark is-${e}`}" role="img" aria-label="${at(e)}">${ot(e)}</span>`)}</span><span>${e.title||`(no title)`}</span>`,o=lt(e);return[a,F`<p class="repo-item-meta"><span class="${`repo-item-badge is-${n}`}">${r}</span> ${e.authors.length>0?F`<span><strong>${St(e.authors).map((e,t)=>F`${t>0?`, `:``}${xt(e)}`)}</strong></span>`:I} ${e.startedAt==null?I:F`<span>${Y(e.startedAt)}${e.updatedAt!=null&&Y(e.updatedAt)!==Y(e.startedAt)?` \u2013 ${Y(e.updatedAt)}`:``}</span>`} <span>${i>0?X(i,`task`):`no pull request`}</span> ${e.additions||e.deletions?F`<span><span class="is-added">+${e.additions.toLocaleString(`en-US`)}</span> <span class="is-deleted">−${e.deletions.toLocaleString(`en-US`)}</span></span>`:I}</p>${this.renderLinked(`Pull requests`,`pulls`,e.pulls)} ${e.commits.length>0?F`<section class="repo-item-section"><h4>Commits to the default branch</h4><ul>${e.commits.map(e=>F`<li><a class="repo-item-row" href="${t?`https://github.com/${t}/commit/${e.oid}`:I}" target="_blank" rel="noopener noreferrer"><code>${e.oid.slice(0,7)}</code><span class="repo-item-title">${e.title||`(no message)`}</span></a></li>`)}</ul></section>`:I} ${this.renderLinked(`Issues`,`issues`,e.issues.map(e=>({...e,reason:null})))} ${e.branches.length>0?F`<section class="repo-item-section"><h4>${e.branches.length===1?`Branch`:`Branches`}</h4><ul>${e.branches.map(e=>F`<li><a class="repo-item-row" href="${t?pt(t,e):I}" target="_blank" rel="noopener noreferrer"><code>${e}</code></a></li>`)}</ul></section>`:I}`,F`${fi(o,e.sessions[0]?`Open in Claude Code`:`Open the Codex task`)}${fi(ft(e,t),`Open on GitHub`,!0)}`]}};customElements.define(`repository-item-dialog`,yi);function bi(e){return x(`repository-item-dialog`,e)}var xi=`dialog{width:min(94vw,880px);max-width:880px}.conflicts-list{list-style:none;display:flex;flex-direction:column;gap:.6rem;max-height:65vh;overflow-y:auto;overscroll-behavior:contain}.conflict-card{padding:.6rem .7rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px)}.finding-meta{display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;color:var(--muted);font-size:.72rem}.location,code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow-wrap:anywhere}.location{flex:1}h4{margin:.4rem 0 .55rem;font-size:.88rem;font-weight:600;overflow-wrap:anywhere}dt{margin-top:.5rem;color:var(--muted);font-size:.72rem}.variant{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,15rem);gap:.65rem;padding:.4rem 0;font-size:.8rem;+&{border-top:1px solid var(--border)}}.value{white-space:pre-wrap;overflow-wrap:anywhere}.reports{display:flex;flex-wrap:wrap;place-content:start flex-end;gap:.3rem}.report-button{display:inline-flex;align-items:center;gap:.4rem;max-width:100%;min-height:22px;padding:0 .4rem 0 0;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden;background:var(--bg);color:var(--text);font:inherit;font-size:.72rem;cursor:default;text-align:left;>span:last-child{min-width:0;overflow-wrap:anywhere}&:hover{border-color:var(--accent)}}
30
- `,Si={revalidate:`Outcome`,revalidateVerdict:`Explanation`,revalidateRecommendation:`Recommendation`},Ci=class extends b{static styles=[...b.styles,P(C),P(Ye),P(xi)];render(){return F`<dialog aria-labelledby="revalidation-conflicts-title" @close="${this._onClose}"><header><h3 id="revalidation-conflicts-title">Revalidation conflicts</h3><p class="nwd-intro">Reports disagree about ${this.conflicts.length} finding${this.conflicts.length===1?``:`s`}. App view is unavailable until the conflicting reports are separated or updated.</p></header><ul class="conflicts-list">${this.conflicts.map(({finding:e,copies:t})=>F`<li class="conflict-card"><div class="finding-meta">${ct(e.severity)} ${e.file?F`<span class="location">${e.file}${k(e.line)?`:${Kt(k(e.line))}`:``}</span>`:I} <code>${Jt(e.id)??e.id}</code></div><h4>${N(e)}</h4><dl>${je(t).map(({field:t,variants:n})=>F`<dt>${Si[t]??t}</dt>${n.map(({value:t,reports:n})=>F`<dd class="variant"><div class="value">${t||F`<em>Empty</em>`}</div><div class="reports">${n.map(t=>t?F`<button type="button" class="report-button" aria-label="${`Open ${Ht(t)} at this finding`}" @click="${()=>this._finish({id:e.id,reportName:t})}">${A(Vt[ze(t)]??Vt.default)}<span>${Ht(t)}</span></button>`:F`<span>Loaded report</span>`)}</div></dd>`)}`)}</dl></li>`)}</ul><footer class="nwd-actions"><span class="nwd-spacer"></span><button type="button" @click="${this._onClose}">Close</button></footer></dialog>`}};customElements.define(`revalidation-conflicts-dialog`,Ci);function wi(e){return x(`revalidation-conflicts-dialog`,{conflicts:[...e.values()]})}var Ti=`.spd-list{margin:0 0 .8rem 1.15rem;color:var(--muted);font-size:.82rem;line-height:1.5;& li{margin:.3rem 0}& strong{color:var(--text);font-weight:600}}.spd-denied{color:light-dark(#b25b00,#f0a060);font-size:.78rem}code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.92em}
31
- `,Ei=class extends b{static styles=[...b.styles,P(Ti)];static properties={_retryDenied:{state:!0}};constructor(){super(),this._retryDenied=!1}_onRetry=async()=>{await Pe()?this._finish(`granted`):this._retryDenied=!0};_chromiumBody(){let e=location.hostname===`localhost`?F` Plain <code>localhost</code> can never qualify — for local testing open the app via <code>127.0.0.1</code> instead.`:I;return F`<p class="nwd-intro">Chromium-based browsers (Chrome, Edge, Brave, …) never show a prompt — persistence is granted silently, and only to sites the browser considers important. Any of these qualifies it:</p><ul class="spd-list"><li><strong>Install the app</strong> — the install icon at the right end of the address bar, or the browser menu's Install entry.</li><li><strong>Bookmark</strong> this page.</li><li>Keep using the site — regular visits raise its engagement score.</li></ul><p class="nwd-note ui-hint">The browser re-evaluates on every request, so after any of the above press <strong>Try again</strong>.${e}</p>`}_firefoxBody(){return F`<p class="nwd-intro">Firefox asks with a permission prompt. A dismissed or blocked prompt is remembered, and the site can't re-ask until the old answer is cleared:</p><ol class="spd-list"><li>Click the permissions icon next to the address bar.</li><li>Clear the <strong>Store Data in Persistent Storage</strong> entry if it's blocked.</li><li>Press <strong>Try again</strong> below and choose <strong>Allow</strong>.</li></ol>`}_webkitBody(){return F`<p class="nwd-intro">Safari — and every iOS browser — additionally deletes a site's storage after <strong>7 days</strong> of browser use without interacting with the site, and no permission exempts a normal tab. Installing the app is what does:</p><ul class="spd-list"><li>On iPhone / iPad: open the <strong>Share</strong> menu, choose <strong>Add to Home Screen</strong>, and use the app from that icon.</li><li>In Safari on macOS: choose <strong>File → Add to Dock…</strong> and use the app from the Dock.</li><li>Installed web apps are exempt from the 7-day cleanup. Otherwise, use the site at least once a week.</li></ul>`}render(){let e=$e(),t=e===`webkit`?this._webkitBody():e===`firefox`?this._firefoxBody():this._chromiumBody();return F`<dialog @close="${this._onClose}"><header><h3>Protect stored data</h3></header><p class="nwd-intro">Reports, bundles and triage live in the browser's <strong>best-effort storage</strong> — the browser is allowed to delete all of it at once under disk pressure or after long inactivity, without asking. The persistent-storage request that would prevent this was just declined.</p>${t}<footer class="nwd-actions">${this._retryDenied?F`<span class="spd-denied" role="status">Still not granted.</span>`:I} <span class="nwd-spacer"></span> ${e===`webkit`?I:F`<button type="button" @click="${this._onRetry}">Try again</button>`} <button type="button" class="primary" @click="${this._onClose}">Got it</button></footer></dialog>`}};customElements.define(`storage-persist-dialog`,Ei);function Di(){return x(`storage-persist-dialog`,{},{conflict:()=>null})}var Oi=`.ssd-close{position:absolute;top:6px;right:6px;z-index:1}header{padding-right:1.5rem}.lwd-list{margin:.5rem 0 0}
32
- `,ki=10,Ai=class extends b{static styles=[...b.styles,P(O),P(L),P(Oi)];_onClose=()=>this._finish({shown:!0,sync:!1});_onSync=()=>this._finish({shown:!0,sync:!0});_list(){if(this.names.length<2)return I;let e=this.names.slice(0,ki),t=this.names.length-e.length;return F`<ul class="lwd-list">${e.map(e=>F`<li><strong>${e}</strong></li>`)} ${t>0?F`<li>and ${t} more</li>`:I}</ul>`}render(){let e=this.names.length===1,t=e?F`Your copy of <strong>"${this.names[0]}"</strong> no longer matches its cloud copy, so other members may be seeing a different version.`:F`<strong>${this.names.length}</strong> reports no longer match their cloud copies, so other members may be seeing different versions.`;return F`<dialog @close="${this._onClose}"><button type="button" class="detail-action ssd-close" data-role="close" aria-label="Close" @click="${this._onClose}">×</button><header><h3>Reports out of sync</h3></header><p class="lwd-body">${t}</p>${this._list()}<p class="nwd-note ui-hint">Sync compares ${e?`it`:`each one`} with the cloud. Where it's clear which copy is newer, the other is updated; otherwise you choose which to keep.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="dismiss" @click="${this._onClose}">Not now</button> <button type="button" class="primary" data-role="sync" @click="${this._onSync}">Sync</button></footer></dialog>`}};customElements.define(`sync-suggest-dialog`,Ai);function ji({names:e}={}){return x(`sync-suggest-dialog`,{names:Array.isArray(e)?[...e]:[]},{exclusive:!0,conflict:()=>({shown:!1,sync:!1})})}var Mi=class extends Rr{static copy={verb:`Upload`,heading:`Upload to remote`,key:`uploaded`,one:e=>F`Upload <strong>"${e}"</strong> to the workspace's remote inventory?`,many:(e,t)=>F`Upload <strong>${e}</strong> local ${t} to the workspace's remote inventory?`,note:F`<p class="nwd-note ui-hint">End-to-end encrypted with the workspace key — only workspace members can decrypt the uploaded content.</p>`};async transfer({kind:e,identifier:t}){let n=e===`bundle`?await Mt(this.workspaceId,t):await kt(this.workspaceId,t,await Nt(t));return n.ok?void 0:n.reason??`unknown`}};customElements.define(`sync-upload-dialog`,Mi);function Ni(e){return zr(`sync-upload-dialog`,e)}var Pi=`dialog{width:min(94vw,68rem);max-width:68rem;max-height:calc(100dvh - 7rem);display:flex;flex-direction:column}dialog:not([open]){display:none}.comparison-results{overflow:auto;min-height:0}.difference-counts{display:flex;flex-wrap:wrap;gap:.5rem 1rem;margin:.8rem 0;font-size:.8rem}.difference-counts span{border-inline-start:3px solid var(--difference);padding-inline-start:.5rem}.managed-only{--difference: var(--marker-blue)}.local-only{--difference: var(--marker-green)}.mismatch{--difference: var(--high)}.finding{margin:.8rem 0 1.3rem}h4{font-size:.9rem;font-weight:600;overflow-wrap:anywhere}.location,.finding-id{margin-top:.3rem;color:var(--muted);font-size:.75rem;overflow-wrap:anywhere}.table-scroll{margin-top:.6rem;overflow-x:auto}table{width:100%;min-width:32rem;border-collapse:collapse;table-layout:fixed;font-size:.8rem}th,td{padding:.6rem .7rem;text-align:left;vertical-align:top;border:1px solid var(--border);overflow-wrap:anywhere}thead th{color:var(--muted);font-weight:500}th:first-child{width:8rem}tbody th{font-weight:500}td{white-space:pre-wrap}.difference-kind{display:block;margin-top:.3rem;color:var(--difference);font-size:.72rem}.highlight{background:rgb(from var(--difference) r g b / .08)}.unset{color:var(--muted);font-style:normal}.comment+.comment{margin-top:.6rem}.comment.changed{border-inline-start:3px solid var(--difference);padding-inline-start:.5rem}.skipped{color:var(--high);margin:.75rem 0;font-size:.8rem}.skipped ul{padding:.6rem 0 .6rem 1.2rem;overflow-wrap:anywhere}.empty{margin:1rem 0;color:var(--muted);font-size:.85rem}
33
- `,Fi={triage:`Triage state`,color:`Color`,fix:`Fix`,flagged:`Flag`,comment:`Comments`,ignoredReports:`Per-report ignores`},Ii={"managed-only":`Only managed`,"local-only":`Only local`,mismatch:`Different`},Li={inprogress:`In progress`,fixed:`Fixed`,invalid:`Invalid`,deleted:`Deleted`,ignored:`Ignored`};function Ri(e,t){return t===void 0||Array.isArray(t)&&t.length===0?F`<em class="unset">Not set</em>`:e===`comment`?t.map(e=>F`<div class="${`comment${e.different?` changed`:``}`}">${e.text}</div>`):e===`ignoredReports`?F`${t.join(`
34
- `)}`:e===`flagged`?t?`Flagged`:`Not flagged`:e===`triage`?Li[t]??t:t}var zi=class extends R{static styles=[...R.styles,P(Pi)];static properties={comparison:{attribute:!1}};constructor(){super(),this.comparison={matched:0,localFindings:0,findings:[],skipped:[]}}render(){let{matched:e,localFindings:t,findings:n,skipped:r}=this.comparison,i={"managed-only":0,"local-only":0,mismatch:0};for(let e of n)for(let t of e.differences)i[t.kind]++;return F`<dialog aria-labelledby="compare-triage-title" @close="${this._onClose}"><header><h3 id="compare-triage-title">Compare triage</h3><p class="lwd-body">${e} shared ${e===1?`finding`:`findings`} compared · ${n.length} with differences</p><p class="lwd-note">Local reports and managed reports are matched by finding ID. This comparison does not change either side. Comments are compared by text; per-report ignores only exist locally.</p>${n.length>0?F`<div class="difference-counts">Field differences: ${Object.entries(Ii).map(([e,t])=>F`<span class="${e}">${t}: ${i[e]}</span>`)}</div>`:I}</header><div class="comparison-results">${r.length>0?F`<details class="skipped"><summary>${r.length} local ${r.length===1?`report could`:`reports could`} not be read; comparison is incomplete.</summary><ul>${r.map(e=>F`<li>${e.name}: ${e.reason}</li>`)}</ul></details>`:I} ${n.map(({id:e,finding:t,differences:n})=>F`<section class="finding"><h4>${t.title||t.description?.split(`
35
- `)[0]||e}</h4>${t.file?F`<p class="location">${t.file}${t.line?`:${t.line}`:``}</p>`:I}<p class="finding-id"><code>${e}</code> · ${t.reports.join(`, `)}</p><div class="table-scroll"><table><thead><tr><th scope="col">Field</th><th scope="col">Local</th><th scope="col">Managed</th></tr></thead><tbody>${n.map(e=>F`<tr class="${e.kind}"><th scope="row">${Fi[e.property]}<span class="difference-kind">${Ii[e.kind]}</span></th><td class="${e.kind===`managed-only`?``:`highlight`}">${Ri(e.property,e.local)}</td><td class="${e.kind===`local-only`?``:`highlight`}">${Ri(e.property,e.managed)}</td></tr>`)}</tbody></table></div></section>`)} ${n.length===0?F`<p class="empty">${e>0?`No triage differences in the shared findings.`:t===0?`No findings were found in the readable local reports.`:`No findings are present in both local and managed reports.`}</p>`:I}</div><footer class="nwd-actions"><span class="nwd-spacer"></span><button type="button" data-role="cancel" @click="${this._onCancel}">Close</button></footer></dialog>`}};customElements.define(`triage-comparison-dialog`,zi);var Bi=e=>x(`triage-comparison-dialog`,e),Vi=`dialog{max-width:560px;width:min(94vw,560px)}header h3{margin:0 0 .25rem}header p{margin:0 0 .9rem;color:var(--muted);font-size:.82rem}hr{border:0;border-top:1px solid var(--border);margin:.9rem 0}.section h4{margin:0 0 .25rem;font-size:.82rem;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}.section p{margin:0 0 .55rem;color:var(--muted);font-size:.78rem}.section button,.actions button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:var(--ui-radius, 5px);font:inherit;&:hover{border-color:var(--accent);color:var(--accent)}}.section button{padding:.35rem .9rem;font-size:.8rem;&.primary{background:var(--accent);color:var(--surface);border-color:var(--accent)}&.primary:hover{filter:brightness(1.08)}&:disabled{opacity:.5}}input[type=file]{display:block;color:var(--text);font:inherit;font-size:.78rem;margin-bottom:.5rem}.error,.status.status-err{border:1px solid var(--critical);background:rgb(from var(--critical) r g b / .07);color:var(--text)}.error{margin:.5rem 0;padding:.4rem .6rem;border-radius:var(--ui-radius, 5px);font-size:.78rem}.summary{margin:.5rem 0;font-size:.82rem;& strong{color:var(--text)}.meta{margin-left:.4rem;color:var(--muted);font-size:.74rem}}.mode{border:1px solid var(--border);border-radius:var(--ui-radius, 6px);padding:.55rem .7rem;margin:.55rem 0 .7rem;display:flex;flex-direction:column;gap:.35rem}.mode legend{padding:0 .35rem;font-size:.68rem;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.mode label{display:flex;align-items:flex-start;gap:.5rem;font-size:.82rem;& em{color:var(--muted);font-style:normal;font-size:.74rem}}.status{margin:.8rem 0 0;padding:.4rem .6rem;border-radius:5px;font-size:.78rem;&.status-ok{border:1px solid var(--accent);background:rgb(from var(--accent) r g b / .08);color:var(--text)}}.actions{display:flex;justify-content:flex-end;gap:.4rem;margin-top:.8rem;padding-top:.7rem;border-top:1px solid var(--border)}.actions button{padding:.3rem .8rem;font-size:.78rem}
36
- `,Hi=class extends b{static styles=[...b.styles,P(Vi)];static properties={parsed:{state:!0},parseError:{state:!0},mode:{state:!0},busy:{state:!0},status:{state:!0}};constructor(){super(),this.parsed=null,this.parseError=null,this.mode=`prefer-current`,this.busy=!1,this.status=null}focusInitial(){this.renderRoot.querySelector(`button.primary`)?.focus()}async _onDownload(){this.busy=!0,this.status=null;try{let{blob:e,filename:t}=await He();qe(e,t),this.status={kind:`ok`,text:`Downloaded ${t}`}}catch(e){this.status={kind:`err`,text:`Export failed: ${e.message}`}}finally{this.busy=!1}}async _onFile(e){let t=e.target.files?.[0];if(this.parsed=null,this.parseError=null,this.status=null,t)try{this.parsed=await h(t)}catch(e){this.parseError=e.message}}_onMode(e){this.mode=e.target.value}async _onApply(){if(!(!this.parsed||this.busy||Le())){this.busy=!0,this.status=null;try{let e=await We(this.parsed,this.mode);Ee(),this.status=e.repoUrlError?{kind:`err`,text:`Applied ${e.triageEntries} triage entries (${this.mode}), but saving repo URLs failed: ${e.repoUrlError.message}`}:{kind:`ok`,text:`Applied ${e.triageEntries} triage entries and ${e.repoUrls} repo URLs (${this.mode}).`},this.parsed=null;let t=this.renderRoot.querySelector(`input[type="file"]`);t&&(t.value=``)}catch(e){this.status={kind:`err`,text:`Import failed: ${e.message}`}}finally{this.busy=!1}}}render(){return F`<dialog @close="${this._onClose}"><header><h3>Triage backup</h3><p>Bundles every triage entry (markers, triage states, comments, fixes, per-report ignores) and all saved repo URLs into a single gzipped JSON file.</p></header><section class="section"><h4>Export</h4><p>Download the current triage + repo-URL set as a portable backup.</p><button type="button" class="primary" @click="${this._onDownload}" ?disabled="${this.busy}">${this.busy?`Working…`:`Download backup`}</button></section>${Le()?I:this._importTemplate()} ${this.status?F`<div class="${`status status-${this.status.kind}`}">${this.status.text}</div>`:I}<footer class="actions"><button type="button" @click="${this._onClose}">Close</button></footer></dialog>`}_importTemplate(){let e=this.parsed,t=(e,t,n)=>F`<label><input type="radio" name="te-mode" value="${e}" .checked="${this.mode===e}" @change="${this._onMode}"> <span>${t} <em>(${n})</em></span></label>`;return F`<hr><section class="section"><h4>Import</h4><p>Pick a previously-exported backup. Nothing is applied until you click Apply.</p><input type="file" accept=".gz,application/gzip" @change="${this._onFile}" ?disabled="${this.busy}"> ${this.parseError?F`<div class="error">Failed to parse: ${this.parseError}</div>`:I} ${e?F`<div class="summary">Found <strong>${Object.keys(e.triage).length}</strong> triage entries and <strong>${Object.keys(e.repoUrls).length}</strong> repo URLs. ${e.exportedAt?F`<span class="meta">Exported ${e.exportedAt}.</span>`:I}</div><fieldset class="mode"><legend>Merge mode</legend>${t(`prefer-current`,`Merge — keep current on conflict`,`safest, only fills gaps`)} ${t(`prefer-imported`,`Merge — prefer imported on conflict`,`overwrites where both have a value`)} ${t(`replace`,`Replace all`,`drops every current persisted entry first — destructive`)}</fieldset><button type="button" class="primary" @click="${this._onApply}" ?disabled="${this.busy}">${this.busy?`Applying…`:`Apply import`}</button>`:I}</section>`}};customElements.define(`triage-export-dialog`,Hi);function Ui(){return x(`triage-export-dialog`)}var Wi=`dialog{width:min(94vw,var(--graph-dialog-width));max-width:80rem;max-height:90dvh;margin:auto;padding:0;overflow:hidden}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:start;justify-content:space-between;gap:1rem;flex-shrink:0;padding:.7rem .9rem;border-bottom:1px solid var(--border)}header h3{display:flex;flex-wrap:wrap;gap:.35rem .7rem;min-width:0;margin:0;font-size:.92rem;overflow-wrap:anywhere}.heading-version{color:var(--accent);font-family:monospace}header button{flex-shrink:0;border:0;background:transparent;color:var(--muted);font-family:inherit;font-size:1.4rem;line-height:1;padding:0 .25rem}header button:hover{color:var(--text)}.graph-caption{display:flex;flex-wrap:wrap;justify-content:space-between;gap:.5rem;padding:.45rem .9rem;font-size:.68rem;color:var(--muted);flex-shrink:0;user-select:none}.graph-scroll{min-height:0;overflow:auto;overscroll-behavior:contain;background:var(--bg);padding:.4rem}.graph{position:relative;margin-inline:auto}.connections{position:absolute;inset:0;overflow:visible;pointer-events:none}.connections>path{fill:none;stroke:var(--connection-color, var(--muted));stroke-width:1.5;opacity:.65}.package-group{position:absolute;cursor:default}.package-group.stacked{background:var(--bg);border-radius:var(--ui-radius, 6px)}.stacked.collapsed{background:linear-gradient(var(--surface),var(--surface)),var(--bg)}.stacked.selected-cycle{background:color-mix(in srgb,var(--accent) 9%,var(--bg))}.stacked:hover,.stacked:focus-within{z-index:1;box-shadow:0 2px 8px #0005}.stacked.dimmed{opacity:1}.stacked.dimmed:after{content:"";position:absolute;inset:0;background:var(--surface);opacity:.8;border-radius:inherit;pointer-events:none}.package{position:absolute;width:var(--package-width);height:var(--package-height);display:flex;flex-direction:column;gap:4px;padding:5px 7px;background:var(--surface);border:1px solid var(--border);border-left:3px solid var(--package-color);border-radius:var(--ui-radius, 6px);font-size:.75rem;overflow:hidden}.package.selected{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 9%,var(--surface))}.name,.location,.version{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.package-main,.package-meta{display:flex;align-items:baseline;gap:.4rem;min-width:0}.name{flex:1;font-weight:600;line-height:17px}.version{max-width:45%;flex-shrink:0;font-family:monospace;font-size:.65rem}.badge{flex-shrink:0;font-size:.6rem;color:var(--muted);user-select:none}.selected-badge{color:var(--accent)}.location{flex:1;color:var(--muted);font-family:monospace;font-size:.61rem;line-height:14px}.cycle{border-radius:var(--ui-radius, 8px);outline:1px solid var(--border);background:color-mix(in srgb,var(--muted) 4%,transparent)}.cycle-label{position:absolute;top:7px;left:14px;color:var(--muted);font-size:.63rem;user-select:none}.cycle-toggle{display:flex;align-items:center;gap:.4rem;padding:0;border:0;background:transparent;font-family:inherit;line-height:16px}.cycle-toggle:hover{color:var(--text)}.cycle-chevron{font-size:.85rem}.cycle-summary{display:flex;gap:.4rem;text-align:left}.cycle-count{color:var(--muted)}.cycle-count:before{content:"\\b7 "}.collapsed .cycle-toggle{inset:0;width:100%;padding:5px 7px;border-radius:inherit;font-size:.75rem}.collapsed .cycle-summary{flex:1;flex-direction:column;gap:2px}.collapsed .cycle-count{font-size:.65rem}.collapsed .cycle-count:before{content:none}.selected-cycle{outline-color:var(--accent);background:color-mix(in srgb,var(--accent) 9%,var(--surface))}.cycle-connections>path{stroke:var(--connection-color);stroke-width:1.25;opacity:.8}.large-cycle .cycle-connections>path{stroke:var(--muted);opacity:.18}.cycle-connections>path.subdued{opacity:.04}.connections>path.traced{stroke:var(--connection-color);stroke-width:1.75;opacity:1}.package-subdued{opacity:.35}.dimmed,.connections>path.dimmed{opacity:.18}.note,.empty{padding:1rem;color:var(--muted);font-size:.78rem;line-height:1.5}.note{position:sticky;left:0;max-width:65rem;margin:auto}button:focus-visible,.graph-scroll:focus-visible,.package:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
37
- `,Q=e=>Wt(e.own?`__own__`:e.name),Gi=()=>Math.floor(Math.min(document.documentElement.clientWidth*.94,80*Number.parseFloat(getComputedStyle(document.documentElement).fontSize))),Ki=class extends b{static styles=[...b.styles,P(Wi)];static properties={_active:{state:!0},_current:{state:!0},_hovered:{state:!0},_focused:{state:!0},_error:{state:!0},layout:{state:!0}};constructor(){super(),this._active=null,this._hovered=null,this._focused=null}_expandedCycles=new Set;layoutForViewport(){let e=this.renderRoot?.activeElement;this._hovered=null,this._maxWidth=Gi(),this.layout=oe(this.graph,{maxWidth:this._maxWidth,expandedCycles:this._expandedCycles}),e?.matches(`.package, .cycle-toggle`)&&this.updateComplete.then(()=>{this._current&&e.isConnected&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:`nearest`,inline:`nearest`}))})}toggleCycle(e){this._expandedCycles.has(e)?this._expandedCycles.delete(e):this._expandedCycles.add(e),this._focused=null,this.layoutForViewport()}connectedCallback(){super.connectedCallback(),this.graph=this.load?null:ie(this.details,this),this.graph?this.layoutForViewport():this.load.then(e=>(this.isConnected&&Object.assign(this,{graph:e}).layoutForViewport(),e),e=>{this._error=e.message}),this._dispose=D(()=>{this._current=this.isCurrent(),this._current||queueMicrotask(this._onClose)})}updated(){let e=this._resize?null:this.renderRoot.querySelector(`.graph-scroll`);e&&(this._resize=new ResizeObserver(()=>{Gi()===this._maxWidth?this.renderRoot.activeElement?.matches(`.package, .cycle-toggle`)||(e.scrollLeft=(this.layout.width-e.clientWidth)/2):this.layoutForViewport()}),this._resize.observe(e),this._resize.observe(document.documentElement))}disconnectedCallback(){this._dispose?.(),this._resize?.disconnect(),super.disconnectedCallback()}renderNode({id:e,x:t,y:n},r){let i=this.graph.nodes.get(e),a=[...this.graph.importedBy.get(e)].map(e=>this.graph.nodes.get(e)),o=`${i.version||`Source`}${i.ecosystem&&i.ecosystem!==`npm`?` \xB7 ${i.ecosystem}`:``}`,s=a.length>0?`${this.lockfile?`Depended on by`:`Imported by`} ${a.map(e=>`${e.name}${e.version?`@${e.version}`:``}`).join(`, `)}.`:i.root?`Bundle entry point or app source.`:i.traceBoundary||i.excludedImporters?.size?`Dependency tracing stops here.`:`No importer is recorded in this scope.`;return F`<div class="${`package${i.target?` selected`:``}${r&&!r.has(e)?` package-subdued`:``}`}" tabindex="0" role="group" @pointerenter="${()=>{this._hovered=e}}" @pointerleave="${()=>{this._hovered=null}}" @focus="${()=>{this._focused=e}}" @blur="${()=>{this._focused=null}}" aria-label="${`${i.ecosystem?`${i.ecosystem}:`:``}${i.name}${i.version?`@${i.version}`:``}. ${s} Location: ${e}.`}" style="${j({left:`${t}px`,top:`${n}px`,"--package-color":Q(i)})}"><div class="package-main"><span class="name" data-tooltip="${i.name}" data-tooltip-truncated>${i.name}</span> <span class="version" data-tooltip="${o}" data-tooltip-truncated>${o}</span></div><div class="package-meta"><span class="location" data-tooltip="${e}" data-tooltip-truncated>${i.own?`App source`:e}</span> ${i.target?F`<span class="badge selected-badge">Selected</span>`:I} ${i.root?F`<span class="badge">${i.own?`App`:`Entry point`}</span>`:I}</div></div>`}renderGraph(){let{boxes:e,edges:t,width:n,height:r}=this.layout,i=this._hovered??this._focused,a=i===null?this._active:this.layout.componentOf.get(i),o=le(this.layout,a),s=i===null?null:new Set([i,...this.graph.imports.get(i),...this.graph.importedBy.get(i)]),c=new Set(t.map(e=>e.to)),l=e.filter(e=>!c.has(e.id)&&!e.members.some(t=>{let n=this.graph.nodes.get(t);return n.root||n.traceBoundary||[...n.excludedImporters??[]].some(t=>this.layout.componentOf.get(t)!==e.id)}));return F`<div class="graph-scroll" tabindex="0" aria-label="Package dependency chains. Arrows point from importer to dependency."><div class="graph" style="${j({width:`${n}px`,height:`${r}px`,"--package-width":`${Lt}px`,"--package-height":`${ee}px`})}"><svg class="connections" width="${n}" height="${r}" aria-hidden="true"><defs><marker id="dependency-arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10z" fill="context-stroke"/></marker></defs>${t.map(e=>{let t=e.fromPackage===i||e.toPackage===i,n=o&&!o.edges.has(e)||i!==null&&(e.from===a||e.to===a)&&!t;return sn`<path d=${e.path} class=${n?`dimmed`:t?`traced`:``}
38
- style=${j({"--connection-color":Q(this.graph.nodes.get(e.fromPackage))})} marker-end="url(#dependency-arrow)"/>`})}</svg> ${e.map(e=>this.renderGroup(e,o,i,s))}</div>${l.length>0?F`<p class="note">Some chains have no recorded app or entry point. These packages are bundled, but their origin is not captured in this scope.</p>`:I}</div>`}renderGroup(e,t,n,r){let i=e.members.some(e=>this.graph.nodes.get(e).target),a=r&&e.members.some(e=>r.has(e));return F`<div class="${`package-group${e.stacked?` stacked`:``}${e.members.length>1?` cycle`:``}${e.members.length>8?` large-cycle`:``}${e.collapsed?` collapsed`:``}${e.collapsed&&i?` selected-cycle`:``}${t&&!t.groups.has(e.id)?` dimmed`:``}`}" style="${j({left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`})}" @pointerenter="${()=>{this._active=e.id}}" @pointerleave="${()=>{this._active=null}}">${e.collapsible?F`<button type="button" class="cycle-label cycle-toggle" aria-expanded="${!e.collapsed}" aria-controls="${`cycle-content-${e.id}`}" @click="${()=>this.toggleCycle(e.id)}"><span class="cycle-chevron" aria-hidden="true">${e.collapsed?`▸`:`▾`}</span> <span class="cycle-summary"><span>Circular imports</span><span class="cycle-count">${e.members.length} packages</span></span> ${e.collapsed&&i?F`<span class="badge selected-badge">Selected</span>`:I}</button>`:e.members.length>1?F`<div class="cycle-label">Circular imports${e.members.length>8?` \xB7 ${e.members.length} packages`:``}</div>`:I}<div id="${`cycle-content-${e.id}`}" ?hidden="${e.collapsed}">${e.internalEdges.length>0?F`<svg class="connections cycle-connections" width="${e.width}" height="${e.height}" aria-hidden="true">${e.internalEdges.map(e=>sn`<path d=${e.path}
13
+ `,Je(e,n=>{n&&(Qe(e),this._paint(e,t))})}}disconnectedCallback(){for(let e of this.renderRoot.querySelectorAll(`.evd-chunk[data-watched]`))Qe(e);clearTimeout(this._copiedTimer),super.disconnectedCallback()}_onCopy=async()=>{let e=`done`;try{await navigator.clipboard.writeText(this.markdown)}catch{e=`failed`}this.isConnected&&(this._copied=e,clearTimeout(this._copiedTimer),this._copiedTimer=setTimeout(()=>{this._copied=``,this._copiedTimer=null},1500))};async _paint(e,t){let n=this._chunks[t];if(!n||n.asked)return;n.asked=!0;let r=Ln(this._lines,n.start),i=[...r?this._lines.slice(r[0],r[1]):[],...this._lines.slice(n.start,n.end)].join(`
14
+ `),a=await We(i,`markdown`);if(!this.isConnected)return;let o=a===null?null:qe(a).slice(r?r[1]-r[0]:0);e.innerHTML=Gt(Vn(this._lines,n.start,n.end,o?.length===n.end-n.start?o:null)),e.classList.remove(`evd-pending`)}};customElements.define(`export-view-dialog`,Hn);function Un(e){return S(`export-view-dialog`,{markdown:e},{conflict:()=>{}}).then(()=>{})}var Wn={triage:`Status`,color:`Label`,flagged:`Flagged`,fix:`Fix`,comment:`Comment`},Gn={inprogress:`In progress`,fixed:`Fixed`,invalid:`Invalid`,deleted:`Deleted`,ignored:`Ignored`};function Kn(e,t){return t===`triage`?Gn[e?.triage]??`Untriaged`:t===`flagged`?e?.flagged?`Yes`:`No`:e?.[t]||`None`}function qn(e,t){return Object.entries(Wn).flatMap(([n,r])=>{let i=Kn(e,n);if(t===void 0)return e?.[n]===void 0?[]:[{label:r,after:i}];let a=Kn(t,n);return a===i?[]:[{label:r,before:a,after:i}]})}var Jn=`dialog{width:min(94vw,720px);max-width:720px;max-height:calc(100dvh - 4rem);margin-block:2rem;padding:0;overflow:hidden;background:rgb(from var(--surface) r g b / 1)}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:start;justify-content:space-between;gap:1rem;padding:.75rem 1rem;border-bottom:1px solid var(--border);flex:none}.history-heading{min-width:0}header h3{display:flex;align-items:center;gap:.55rem;margin:0;line-height:1.5}header svg{flex:none;color:var(--muted)}header .detail-action{flex:none;width:1.75rem;height:1.75rem}.location{margin-top:.4rem;color:var(--muted);font:.76rem/1.5 ui-monospace,monospace;overflow-wrap:anywhere}.history-summary{display:flex;justify-content:space-between;gap:.5rem;flex:none;padding:.5rem 1rem .25rem;color:var(--muted);font-size:.72rem}.history-body{min-height:0;overflow:auto;overscroll-behavior:contain;padding:.75rem 1rem 1rem;font-size:.82rem;line-height:1.5}.timeline{list-style:none}.event{position:relative;display:grid;grid-template-columns:2rem minmax(0,1fr);gap:.75rem;padding-bottom:1rem}.event:last-child{padding-bottom:0}.event:not(:last-child):before{content:"";position:absolute;top:2.4rem;bottom:.4rem;left:calc(1rem - .5px);width:1px;background:var(--border)}.managed-comment-avatar{width:2rem;height:2rem;font-size:.8rem;background:var(--surface-active)}.event-content{min-width:0}.event-meta{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:.15rem .75rem}.event-user{display:flex;flex-wrap:wrap;align-items:baseline;gap:.1rem .45rem;min-width:0;overflow-wrap:anywhere}.event-user strong{font-weight:600}.username{color:var(--muted);font-size:.75rem}time{color:var(--muted);font-size:.7rem;white-space:nowrap}.event-action{margin-top:.1rem;color:var(--muted);font-size:.75rem}.changes{margin-top:.65rem;border:1px solid var(--border);border-radius:var(--ui-radius, 7px);overflow:hidden}.change{display:grid;grid-template-columns:4.5rem minmax(0,1fr);align-items:baseline;gap:.65rem;padding:.4rem .6rem}.change+.change{border-top:1px solid var(--border)}dt{color:var(--muted);font-size:.75rem}dd{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:baseline;gap:.65rem}dd.snapshot{grid-template-columns:minmax(0,1fr)}.before,.after{white-space:pre-wrap;overflow-wrap:anywhere}.before,.change-arrow{color:var(--muted)}.after{font-weight:500}.history-state{padding:1.5rem .5rem;text-align:center;color:var(--muted)}.history-state strong{display:block;margin-bottom:.35rem;color:var(--text);font-weight:500}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@media(width<=540px){dialog{margin-block:1rem;max-height:calc(100dvh - 2rem)}header{padding:.65rem}.history-summary{padding-inline:.65rem}.history-body{padding:.65rem}.event{gap:.6rem}.event-meta{flex-direction:column}.change{grid-template-columns:minmax(0,1fr);gap:.3rem;padding:.35rem .5rem}dd{gap:.45rem}}
15
+ `,Yn=class extends x{static styles=[...x.styles,I(A),I(a),I(Jn)];static properties={finding:{attribute:!1},teamId:{attribute:!1},_events:{state:!0},_loading:{state:!0},_error:{state:!0}};constructor(){super(),this._events=[],this._loading=!0,this._error=!1}beforeOpen(){this._load()}async _load(){if(!this.isCurrent()){this._finish(null);return}this._loading=!0,this._error=!1;let{_managedReportId:e,id:t}=this.finding;this._key=`finding-history:${this.teamId??``}:${e}:${t}`,p.invalidate([this._key]);let n=p.load(this._key,`issue history`,async n=>{let r=new URLSearchParams({finding:t});this.teamId&&r.set(`team`,this.teamId);let i=await f(`/api/reports/${encodeURIComponent(e)}/triage/history?${r}`,{credentials:`same-origin`,signal:n});if(!i.ok)throw Error(`History request failed (${i.status})`);let a=await i.json();if(a.finding!==t||!Array.isArray(a.events))throw Error(`Invalid history response`);return a.events});this._owner=p.resources.get(this._key),this._signal=this._owner.controller.signal,this._signal.addEventListener(`abort`,this._onClose,{once:!0});try{let e=await n;if(this._settled||!this.isConnected)return;if(!this.isCurrent()){this._finish(null);return}this._events=e}catch(e){if(this._settled||!this.isConnected)return;e.name===`AbortError`||!this.isCurrent()?this._finish(null):this._error=!0}finally{this._loading=!1}}disconnectedCallback(){this._signal?.removeEventListener(`abort`,this._onClose),this._owner&&p.resources.get(this._key)===this._owner&&p.invalidate([this._key]),this._events=[],super.disconnectedCallback()}_onKeydown=e=>{e.key===`Escape`&&e.stopPropagation()};_renderEvent(e,t){let n=this._events[t+1],r=qn(e.entry,n?.entry),i=new Date(e.at),a=e.actorLogin?`@${e.actorLogin}`:``;return L`<li class="event">${e.actorId?ae(e.actorId,e.actorName||e.actorLogin):L`<span class="managed-comment-avatar" aria-hidden="true">${(e.actorLogin?.[0]||`?`).toUpperCase()}</span>`}<div class="event-content"><div class="event-meta"><div class="event-user"><strong>${e.actorName||a||`Unknown user`}</strong> ${e.actorName&&a?L`<span class="username">${a}</span>`:R}</div><time datetime="${i.toISOString()}" data-tooltip="${i.toLocaleString()}">${i.toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}</time></div><p class="event-action">${e.entry===null?`Cleared triage`:n?`Updated triage`:`Recorded triage state`}</p>${r.length>0?L`<dl class="changes">${r.map(e=>L`<div class="change"><dt>${e.label}</dt><dd class="${e.before===void 0?`snapshot`:``}">${e.before===void 0?R:L`<span class="before"><span class="sr-only">Previously: </span>${e.before}</span> <span class="change-arrow" aria-hidden="true">→</span>`} <span class="after"><span class="sr-only">${e.before===void 0?`Recorded: `:`Changed to: `}</span>${e.after}</span></dd></div>`)}</dl>`:R}</div></li>`}render(){let e=this.finding??{};return L`<dialog aria-labelledby="history-title" @close="${this._onClose}" @keydown="${this._onKeydown}"><header><div class="history-heading"><h3 id="history-title"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 11a9 9 0 1 1 2.5 7M3 5v6h6M12 7v5l3 2"/></svg>Issue history</h3><p class="location">${e.file}${e.line?`:${e.line}`:``}</p></div><button type="button" class="detail-action" aria-label="Close issue history" @click="${this._onClose}">×</button></header>${!this._loading&&!this._error&&this._events.length>0?L`<div class="history-summary"><span>${this._events.length} ${this._events.length===1?`record`:`records`}</span><span>Newest first</span></div>`:R}<div class="history-body" aria-busy="${String(this._loading)}">${this._loading?L`<p class="history-state" role="status">Loading history…</p>`:this._error?L`<div class="history-state" role="alert"><strong>Couldn’t load issue history</strong><p>Close and reopen to try again.</p></div>`:this._events.length===0?L`<div class="history-state" role="status"><strong>No triage changes yet</strong><p>Changes to status, labels, flags, and fixes will appear here.</p></div>`:L`<ol class="timeline">${this._events.map((e,t)=>this._renderEvent(e,t))}</ol>`}</div></dialog>`}};customElements.define(`finding-history-dialog`,Yn);function Xn(e){return e.isCurrent()?S(`finding-history-dialog`,e):Promise.resolve(null)}var Zn=`dialog{width:min(96vw,1400px);max-width:1400px;height:min(88dvh,1000px);max-height:92dvh;margin:auto;padding:0;overflow:hidden}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:center;gap:1rem;padding:.7rem 1rem;border-bottom:1px solid var(--border);flex:0 0 auto;& h3{margin:0;min-width:0;flex:1;overflow-wrap:anywhere;font:.85rem ui-monospace,monospace}& button{border:0;background:transparent;color:var(--muted);font-size:1.4rem;padding:0 .3rem;&:hover{color:var(--text)}}}.source-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}.source-status{padding:1rem;color:var(--muted)}.source-lines{display:flex;min-width:100%;width:max-content;font:.8rem/1.6 ui-monospace,monospace;& aside{position:sticky;left:0;align-self:stretch;flex:0 0 auto;padding:.75rem 0;background:var(--surface);color:var(--muted);border-right:1px solid var(--border);text-align:right;user-select:none;& div{padding:0 .75rem}.cited{background:rgb(from var(--accent) r g b / .18);color:var(--accent);font-weight:700}}& pre{padding:.75rem 1rem;tab-size:4}& pre,code{font:inherit;white-space:pre}}
16
+ `,Qn=class extends x{static styles=[...x.styles,I(Zn),I(t)];static properties={reportId:{attribute:!1},file:{attribute:!1},line:{attribute:!1},_path:{state:!0},_content:{state:!0},_highlighted:{state:!0},_loading:{state:!0}};constructor(){super(),this.reportId=``,this.file=``,this.line=``,this._path=``,this._content=null,this._highlighted=null,this._loading=!0}beforeOpen(){this._load()}async _load(){try{let{data:e,error:t}=await ct(this.reportId).then(e=>({data:e}),e=>({error:e}));if(this._settled||!this.isConnected)return;let n=at(this.reportId),r=t?n?.error===t:n?.data===e||e===null&&!!n?.error;if(!n||!r||t?.name===`AbortError`||n.controller?.signal.aborted){this._finish(null);return}if(this._sourceSignal=n.controller?.signal,this._sourceSignal?.addEventListener(`abort`,this._onClose,{once:!0}),this._path=e?.paths.get(this.file)??this.file,this._content=e?.sources.get(this._path)??null,this._loading=!1,await this.updateComplete,this._settled||!this.isConnected)return;it(this.renderRoot.querySelector(`.source-scroll`),this.renderRoot.querySelectorAll(`.cited`));let i=Vt(this._path,e?.formats?.get(this._path),this._content);if(i&&this._content!==null){let e=await We(this._content,i);!this._settled&&this.isConnected&&(this._highlighted=e)}}catch(e){e.name===`AbortError`?this._finish(null):this._loading=!1}}disconnectedCallback(){this._sourceSignal?.removeEventListener(`abort`,this._onClose),this._content=null,this._highlighted=null,super.disconnectedCallback()}_onKeydown=e=>{e.key===`Escape`&&e.stopPropagation()};render(){let e=j(this.line);return L`<dialog aria-labelledby="source-title" @close="${this._onClose}" @keydown="${this._onKeydown}" @click="${this._onBackdrop}"><header><h3 id="source-title" class="mono">${this._path||this.file}</h3><button type="button" aria-label="Close source viewer" @click="${this._onClose}">×</button></header><div class="source-scroll" tabindex="0" aria-label="Full source code" aria-busy="${String(this._loading)}">${this._content===null?L`<p class="source-status" role="status">${this._loading?`Loading source…`:`Source unavailable`}</p>`:L`<div class="source-lines"><aside aria-hidden="true">${this._content.split(`
17
+ `).map((t,n)=>L`<div class="${e&&n+1>=e.start&&n+1<=e.end?`cited`:``}">${n+1}</div>`)}</aside><pre><code>${typeof this._highlighted==`string`?M(this._highlighted):this._content}</code></pre></div>`}</div></dialog>`}};customElements.define(`finding-source-dialog`,Qn);function $n({reportId:e,file:t,line:n}){return S(`finding-source-dialog`,{reportId:e,file:t,line:n})}var er=`dialog{max-width:560px;width:min(94vw,560px)}header h3{margin:0 0 .4rem}.finding{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin-bottom:.35rem}.loc{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.76rem;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1}.desc{font-size:.78rem;color:var(--muted);margin:0 0 .7rem;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.input-row{display:flex;align-items:stretch;gap:.4rem}input{flex:1;min-width:0;padding:.5rem .65rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:var(--bg);color:var(--text);font:inherit;font-size:.88rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;&:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgb(from var(--accent) r g b / .18)}&::placeholder{color:var(--muted);font-family:inherit}}.open{display:inline-flex;align-items:center;padding:0 .7rem;border:1px solid var(--accent);border-radius:var(--ui-radius, 6px);color:var(--accent);text-decoration:none;font-size:.8rem;font-weight:600;white-space:nowrap;&:hover{background:rgb(from var(--accent) r g b / .1)}}.hint{margin:.45rem 0 0;color:var(--muted);font-size:.74rem}
18
+ `,tr=class extends x{static styles=[...x.styles,I(w),I(er)];static properties={_value:{state:!0}};constructor(){super(),this._value=``}beforeOpen(){this._value=this.initial}focusInitial(){let e=this.renderRoot.querySelector(`input[type="url"]`);if(e){e.focus();try{e.select()}catch{}}}_onInput=e=>{this._value=e.target.value};get _trimmed(){return this._value.trim()}_onSave=()=>{this._finish(this._trimmed===this.initial.trim()?null:{value:this._trimmed,scope:`finding`})};_onApplyToGroup=()=>{this._trimmed&&this._finish({value:this._trimmed,scope:`group`})};_onKeydown=g(()=>this._onSave());render(){let e=this.initial.length>0,t=this._trimmed;return L`<dialog @close="${this._onClose}"><header><h3>${e?`Edit fix link`:`Add fix link`}</h3>${Fe(this.finding??{})}</header><div class="input-row"><input type="url" inputmode="url" autocomplete="off" spellcheck="false" placeholder="https://github.com/owner/repo/pull/123" .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"> ${Qt(t)?L`<a class="open" href="${t}" target="_blank" rel="noopener noreferrer">Open ↗</a>`:R}</div><p class="hint">PR URL, issue link, commit, or any free-form reference. Enter to save, Esc to cancel.</p><footer class="nwd-actions">${e?L`<button type="button" class="danger" @click="${()=>this._finish({value:``,scope:`finding`})}">Clear</button>`:R} <span class="nwd-spacer"></span> ${this.canApplyToGroup?L`<button type="button" class="quiet" ?disabled="${!t}" @click="${this._onApplyToGroup}">Apply to whole group</button> <span class="nwd-spacer"></span>`:R} <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onSave}">Save</button></footer></dialog>`}};customElements.define(`fix-link-dialog`,tr);function nr({initial:e=``,finding:t=null,canApplyToGroup:n=!1}={}){return S(`fix-link-dialog`,{initial:e??``,finding:t,canApplyToGroup:n})}var rr=class extends B{static properties={_choice:{state:!0},_newName:{state:!0}};constructor(){super(),this._choice=`replace`,this._newName=``}get _trimmed(){return(this._newName??``).trim()}confirmationResult(e){return e?this._choice===`rename`?{action:`rename`,newName:this._trimmed}:{action:`replace`}:{action:`cancel`}}_onConfirm=()=>{(this._choice!==`rename`||this._renameError(this._trimmed)===null)&&this._finish(!0)};_onChoiceChange=e=>{this._choice=e.target.value};_onNameInput=e=>{this._newName=e.target.value};_onNameKeydown=g(()=>this._onConfirm());_replaceHint(){let e=this.workspaceNames.length;if(e===0)return`The local file will be overwritten.`;let t=e===1?L`workspace <strong>"${this.workspaceNames[0]}"</strong>`:L`<strong>${e}</strong> workspaces (${this.workspaceNames.join(`, `)})`;return L`The local file will be overwritten. When sync is online, the new bytes are also uploaded to ${t} so the cloud copy matches.`}_renameError(e){return e?e===this.reportName?`Pick a name different from the original.`:e.includes(`\0`)?`The new name cannot contain a NUL byte.`:e.includes(`/`)||e.includes(`\\`)?`The new name cannot contain "/" or "\\".`:this.existingNames.has(e)?`A file named "${e}" already exists \u2014 pick something else.`:null:`Enter a new name.`}render(){let e=this._choice===`rename`,t=e?this._renameError(this._trimmed):null,n={name:`icd-choice`,current:this._choice,change:this._onChoiceChange},r=this.workspaceNames.length>0?U(`Saved as an unfiled report — the renamed copy isn't added to any workspace.`):R;return this.prompt({title:`Import conflict`,body:L`<strong>"${this.reportName}"</strong> already exists with different content.`,notes:L`<fieldset class="lwd-choice"><legend>What should happen?</legend>${H({...n,value:`replace`,title:`Replace`},U(this._replaceHint()))} ${H({...n,value:`rename`,title:`Rename to`},L`<input type="text" class="nwd-input lwd-rename-input" maxlength="200" .value="${this._newName}" ?disabled="${!e}" @input="${this._onNameInput}" @keydown="${this._onNameKeydown}" @focus="${()=>{this._choice=`rename`}}"> ${r} ${t===null?R:L`<p class="lwd-rename-error">${t}</p>`}`)}</fieldset>`,action:e?`Rename`:`Replace`,kind:e?`primary`:`danger`,disabled:t!==null})}};customElements.define(`import-conflict-dialog`,rr);function ir({name:e,workspaceNames:t,existingNames:n}={}){let r=n instanceof Set?n:new Set(n??[]);return S(`import-conflict-dialog`,{reportName:e??``,workspaceNames:Array.isArray(t)?t:[],existingNames:r,_newName:ar(e??``,r)},{conflict:()=>({action:`cancel`})})}function ar(e,t){if(typeof e!=`string`||e.length===0)return``;let n=e.lastIndexOf(`.`),r=n>0?e.slice(0,n):e,i=n>0?e.slice(n):``,a=r.replace(/-\d+$/u,``);for(let e=2;e<1e3;e++){let n=`${a}-${e}${i}`;if(!t.has(n))return n}return``}var or=class extends B{static properties={_mode:{state:!0},_triage:{state:!0}};constructor(){super(),this._mode=`detach`,this._triage=`keep`}confirmationResult(e){let t=this.reportCount>0?this._mode:`detach`;return{confirmed:e,mode:t,triage:t===`delete`&&this.orphanedTriage>0?this._triage:`keep`}}_onModeChange=e=>{this._mode=e.target.value};_onTriageChange=e=>{this._triage=e.target.value};_modeChoice(){let e=this.reportCount,t=e===1,n=t?`report`:`reports`,r=(e,t,n)=>H({name:`lwd-mode`,value:e,current:this._mode,change:this._onModeChange,title:t},U(n));return L`<fieldset class="lwd-choice"><legend>What should happen to the <strong>${e}</strong> attached ${n}?</legend>${r(`detach`,`Move ${t?`it`:`them`} out of the workspace`,`The ${n} ${t?`stays`:`stay`} in this browser as unattached ${n}.`)} ${r(`delete`,`Delete ${t?`it`:`them`} along with the workspace`,`The ${n} ${t?`is removed`:`are removed`} from this browser.`)}</fieldset>`}render(){let e=this.reportCount,t=this.bundleCount,n=t>0?L`<p class="lwd-note">${t===1?`One bundle is`:`${t} bundles are`} also attached. ${t===1?`It`:`They`} will become unfiled — the bundle bytes stay on this device either way (delete bundles manually from the Bundles list if you want them gone).</p>`:R;return this.prompt({title:`Leave workspace`,action:`Leave`,body:L`Leave workspace <strong>"${this.workspaceName}"</strong> on this device?`,notes:L`${e>0?this._modeChoice():L`<p class="lwd-empty">No reports are attached to this workspace${t>0?` (only bundles, see below)`:``}.</p>`} ${n} ${this._mode===`delete`&&e>0?pn({name:`lwd-triage`,orphaned:this.orphanedTriage,shared:this.sharedTriage,current:this._triage,change:this._onTriageChange,subject:e===1?`this report`:`these reports`}):R}<ul class="lwd-list"><li>Workspace synchronization data stays on the sync server — peers (and your other devices) keep their copy.</li></ul>`})}};customElements.define(`leave-workspace-dialog`,or);function sr({name:e,reportCount:t,bundleCount:n,triageImpact:r}={}){return S(`leave-workspace-dialog`,{workspaceName:e??``,reportCount:t??0,bundleCount:n??0,orphanedTriage:r?.orphanedCount??0,sharedTriage:r?.sharedCount??0})}var cr=`dialog{width:min(42rem,90vw)}.content-import-groups{max-height:55vh;overflow:auto}fieldset{margin:.7rem 0;padding:.5rem .75rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px)}legend{padding:0 .35rem;font-size:.85rem;font-weight:600}.content-import-item{display:flex;gap:.65rem;align-items:flex-start;padding:.65rem 0}.content-import-item+.content-import-item{border-top:1px solid var(--border)}.content-import-item input{margin:.15rem 0 0;accent-color:var(--accent)}.content-import-item.unavailable{opacity:.55;cursor:default}.content-import-label{display:grid;gap:.25rem;min-width:0;overflow-wrap:anywhere;font-size:.82rem}.content-import-status{display:flex;flex-wrap:wrap;gap:.4rem;color:var(--muted);font-size:.74rem}.content-import-present{border:1px solid var(--border);border-radius:3px;padding:0 .3rem}input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}button:disabled{opacity:.5}
19
+ `,G=e=>!e.present&&!e.error,lr=class extends B{static styles=[...B.styles,I(cr)];static properties={selected:{state:!0}};constructor(){super(),this.plan={kind:`report`,items:[],groups:[]},this.selected=new Set}beforeOpen(){this.selected=new Set(this.plan.items.filter(e=>e.synced&&G(e)).map(e=>e.value))}toggle(e,t){if(!G(e))return;let n=new Set(this.selected);t?n.add(e.value):n.delete(e.value),this.selected=n}confirmationResult(e){let t=this.plan.items.filter(e=>this.selected.has(e.value)&&G(e)).map(e=>e.value),n=e&&t.length>0&&!this.signal?.aborted;return{confirmed:n,selected:n?t:[]}}render(){let e=this.plan.kind===`bundle`?`bundles`:`reports`;return this.prompt({title:`Import ${e}`,titleId:`content-import-title`,body:`Choose files to upload. Cloud-synced files are selected by default.`,notes:L`<p class="lwd-note">Workspaces are shown for organization only. Teams and triage are not imported. Repository locations follow each file’s embedded metadata; files without it stay unattached.</p><div class="content-import-groups">${this.plan.groups.map(e=>L`<fieldset><legend>${e.name}</legend>${e.items.map(({item:e,synced:t,cached:n})=>L`<label class="${`content-import-item${G(e)?``:` unavailable`}`}"><input type="checkbox" .checked="${this.selected.has(e.value)}" ?disabled="${e.present||!!e.error}" @change="${t=>this.toggle(e,t.target.checked)}"> <span class="content-import-label"><strong>${e.name}</strong> <span class="content-import-status">${t?`Cloud synced`:`Not synced`}${n?` · last known status`:``} ${e.present?L`<span class="content-import-present">Already present</span>`:R}</span> ${e.error?L`<span>${e.error}</span>`:R}</span></label>`)}</fieldset>`)} ${this.plan.items.length===0?L`<p class="lwd-empty">No local ${e} available.</p>`:R}</div>`,status:L`<span class="lwd-empty" role="status">${this.selected.size} selected</span>`,action:`Import ${e}`,kind:`primary`,disabled:this.selected.size===0})}};customElements.define(`local-content-import-dialog`,lr);function ur(e){return S(`local-content-import-dialog`,e)}var dr=class extends B{constructor(){super(),this.matched=0,this.available=0}confirmationResult(e){return{confirmed:e&&this.matched>0&&!this.signal?.aborted}}render(){let e=this.matched>0;return this.prompt({title:`Import local triage`,titleId:`import-title`,body:L`<strong>${this.matched}</strong> of <strong>${this.available}</strong> local triage ${this.available===1?`entry`:`entries`} can be imported.`,notes:L`<p class="lwd-note">${e?`Import saved triage and comments for these findings? Conflicting values will prompt for resolution.`:this.available>0?`None match findings in managed reports.`:`There is no saved local triage to import.`}</p>${this.available>this.matched?L`<p class="lwd-empty">Unmatched entries stay in this browser.</p>`:R}`,cancel:e?`Cancel`:`Close`,action:e?`Import triage`:null,kind:`primary`})}};customElements.define(`local-triage-import-dialog`,dr);function fr(e){return S(`local-triage-import-dialog`,e)}var pr=`dialog{width:min(94vw,800px);max-width:800px;max-height:calc(100dvh - 4rem);margin-block:2rem;padding:0}dialog[open]{display:flex;flex-direction:column}.discussion-header{display:flex;align-items:start;gap:1rem;padding:1rem 1.25rem;border-bottom:1px solid var(--border)}.discussion-heading{flex:1;min-width:0}header h3{display:flex;align-items:center;gap:.5rem;margin:0;line-height:1.5}.comment-count{padding:.05rem .4rem;border-radius:1rem;background:rgb(from var(--muted) r g b / .12);color:var(--muted);font-size:.72rem;font-weight:400}.discussion-finding{margin-top:.4rem;font-size:.85rem;overflow-wrap:anywhere}.loc{margin-top:.25rem;color:var(--muted)}.header-actions{display:flex;flex:none;align-items:center;gap:.7rem}.header-actions button{display:inline-flex;flex:none;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:0;background:transparent;color:var(--muted);line-height:0;& svg{display:block;width:1rem;height:1rem}&:hover:not(:disabled){color:var(--text)}&:disabled{opacity:.5}}.comment-action{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:.2rem;border:1px solid transparent;border-radius:var(--ui-radius, 4px);background:transparent;color:var(--muted);cursor:default;& svg{width:.9rem;height:.9rem}&:hover:not(:disabled),&[aria-pressed=true]{border-color:var(--border);background:rgb(from var(--muted) r g b / .08);color:var(--text)}&.danger:hover:not(:disabled),&[aria-expanded=true]{color:var(--critical)}&:disabled{opacity:.5}}button:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:var(--ui-radius, 3px)}.discussion-log{min-height:0;max-height:50dvh;overflow-y:auto;overscroll-behavior:contain;padding:.5rem;scrollbar-gutter:stable}.comments{display:flex;flex-direction:column;gap:.15rem;list-style:none}.comment{padding:.6rem .75rem;border-radius:var(--ui-radius, 6px);font-size:.84rem}.comment:hover{background:rgb(from var(--muted) r g b / .035)}.comment.editing{background:rgb(from var(--accent) r g b / .08);box-shadow:inset 0 0 0 1px rgb(from var(--accent) r g b / .2)}.delete-confirm{display:flex;align-items:center;justify-content:end;flex-wrap:wrap;gap:.5rem;margin-top:.6rem;color:var(--muted);font-size:.75rem;& button{padding:.25rem .55rem;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:transparent;color:var(--text);font:inherit;&:hover:not(:disabled){background:rgb(from var(--muted) r g b / .08)}&.danger{color:var(--critical)}&:disabled{opacity:.5}}}.empty-discussion{padding:2.5rem 0;color:var(--muted);text-align:center;font-size:.85rem}.composer{padding:1rem 1.25rem;border-top:1px solid var(--border)}.composer-label{display:flex;align-items:center;gap:.45rem;margin-bottom:.6rem;font-size:.78rem}.composer-label strong{font-weight:600}textarea{min-height:4.5rem;max-height:25dvh;font-size:.84rem}.nwd-actions{border:0;padding-top:0;margin-top:.65rem}.shortcut{color:var(--muted);font-size:.7rem}.error{padding:.65rem 1.25rem;color:#c44;font-size:.8rem}.read-only{padding:1rem 1.25rem;border-top:1px solid var(--border);color:var(--muted);font-size:.8rem}@media(width<=480px){.discussion-header,.composer{padding:.8rem}.discussion-log{padding-inline:.3rem}.comment{padding-inline:.5rem}.shortcut{max-width:8rem}}
20
+ `,mr=()=>D.managedSession.name?.trim()||D.managedSession.login,hr=class extends x{static styles=[...x.styles,I(un),I(a),I(pr)];static properties={finding:{attribute:!1},changed:{attribute:!1},_comments:{state:!0},_value:{state:!0},_editing:{state:!0},_busy:{state:!0},_error:{state:!0},_deleting:{state:!0}};constructor(){super(),this.finding=null,this.changed=null,this._comments=[],this._value=``,this._editing=null,this._busy=!1,this._error=``,this._deleting=null}connectedCallback(){super.connectedCallback(),document.addEventListener(`managed-comments-reset`,this._close)}disconnectedCallback(){this._unsubscribeComments?.(),this._unsubscribeComments=null,document.removeEventListener(`managed-comments-reset`,this._close),super.disconnectedCallback()}beforeOpen(){this._current=Tt(this.finding?._managedReportId),this._comments=E(this.finding),this._unsubscribeComments?.(),this._unsubscribeComments=_t(this.finding.id,this._commentsChanged),this._refresh({scroll:!0})}_commentsChanged=()=>{if(!this.isConnected)return;if(!this._current()){this._close();return}let e=this._atBottom();this._comments=E(this.finding),e&&this._scrollToLatest()};_close=()=>this._finish(null);_atBottom(){let e=this.renderRoot.querySelector(`.discussion-log`);return e&&e.scrollHeight-e.scrollTop-e.clientHeight<32}_scrollToLatest=async()=>{await this.updateComplete;let e=this.renderRoot.querySelector(`.discussion-log`);e&&(e.scrollTop=e.scrollHeight)};_refresh=async({scroll:e=!1}={})=>{if(!this._current()){this._close();return}let t=this._atBottom();this._busy=!0,this._error=``;let n=await Ot(this.finding._managedReportId);if(this.isConnected){if(!this._current()){this._close();return}if(this._busy=!1,!n){this._error=`Could not load comments. Please retry.`;return}this._comments=E(this.finding),this.changed?.(),(e||t)&&this._scrollToLatest()}};_edit(e){this._deleting=null,this._editing=e,this._value=e.body,this._error=``,this.updateComplete.then(()=>this.renderRoot.querySelector(`textarea`)?.focus())}_cancelEdit=()=>{this._editing=null,this._value=``,this._error=``};_delete=async e=>{if(this._busy||!this._current())return;this._busy=!0,this._error=``;let t=await Mt(this.finding,e);this.isConnected?this._current()?(this._busy=!1,this._deleting=null,t===409?(await this._refresh(),this.isConnected&&(this._error=`This comment changed elsewhere. Review the latest version before deleting it.`)):t===204?(this._comments=E(this.finding),this._editing?.id===e.id&&this._cancelEdit(),this.changed?.()):this._error=t===403||t===404?`This comment is unavailable or you no longer have permission to delete it.`:`Could not delete the comment. Please retry.`):this._close():t===204&&this._current()&&this.changed?.()};_save=async()=>{let e=this._value.trim();if(this._busy||!e||e.length>1e4||!this._current())return;this._busy=!0,this._error=``;let t=await jt(this.finding,e,this._editing);if(!this.isConnected)return;if(!this._current()){this._close();return}if(this._busy=!1,t.status===409){if(await this._refresh(),!this.isConnected)return;this._editing=this._comments.find(e=>e.id===this._editing?.id)??this._editing,this._error=`This comment changed elsewhere. Your draft is kept. Review the latest version above before saving again.`;return}if(!t.comment){this._error=t.status===403||t.status===404?`You no longer have permission to save this comment.`:`Could not save the comment. Your draft is kept; please retry.`;return}let n=this._editing!=null;this._comments=E(this.finding),this._cancelEdit(),this.changed?.(),n||await this._scrollToLatest(),await this.updateComplete,this.renderRoot.querySelector(`textarea`)?.focus()};_keydown=e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this._save())};_commentActions(e,t){let n=t&&e.authorId===D.managedSession?.id,r=St(e);return!n&&!r?R:L`${n?L`<button type="button" class="comment-action" aria-label="Edit comment" aria-pressed="${this._editing?.id===e.id}" ?disabled="${this._busy}" @click="${()=>this._edit(e)}">${M(Jt)}</button>`:R} ${r?L`<button type="button" class="comment-action danger" aria-label="Delete comment" aria-expanded="${this._deleting===e.id}" ?disabled="${this._busy}" @click="${()=>{this._deleting=this._deleting===e.id?null:e.id}}">${M(Yt)}</button>`:R}`}_deleteConfirmation(e){return this._deleting!==e.id||!St(e)?R:L`<div class="delete-confirm" role="group" aria-label="Confirm comment deletion"><span>Delete this comment?</span> <button type="button" ?disabled="${this._busy}" @click="${()=>{this._deleting=null}}">Cancel</button> <button type="button" class="danger" ?disabled="${this._busy}" @click="${()=>this._delete(e)}">Delete</button></div>`}render(){let e=yt();return L`<dialog aria-labelledby="comments-title" @close="${this._onClose}"><header class="discussion-header"><div class="discussion-heading"><h3 id="comments-title">Discussion <span class="comment-count">${this._comments.length}</span></h3>${this.finding?.title?L`<p class="discussion-finding">${this.finding.title}</p>`:R}<p class="loc">${this.finding?.file??``}</p></div><div class="header-actions"><button type="button" class="refresh" aria-label="Refresh discussion" ?disabled="${this._busy}" @click="${()=>this._refresh()}"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8M21 3v5h-5"/></svg></button> <button type="button" class="close" aria-label="Close discussion" @click="${this._close}"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="m6 6 12 12M6 18 18 6"/></svg></button></div></header><section class="discussion-log" role="log" aria-label="Discussion" aria-relevant="additions text" aria-busy="${this._busy}"><ol class="comments">${this._comments.map(t=>L`<li class="${`comment${this._editing?.id===t.id?` editing`:``}`}">${oe(t,se(t.body),this._commentActions(t,e))} ${this._deleteConfirmation(t)}</li>`)}</ol>${this._comments.length===0?L`<p class="empty-discussion">${this._busy?`Loading discussion…`:e?`No comments yet. Start the discussion below.`:`No comments yet.`}</p>`:R}</section>${this._error?L`<p class="error" role="alert">${this._error}</p>`:R} ${e?L`<form class="composer" @submit="${e=>{e.preventDefault(),this._save()}}"><label class="composer-label" for="comment-body">${ae(D.managedSession.id,mr())} ${this._editing?`Edit your comment`:L`Reply as <strong>${mr()}</strong>`}</label> <textarea id="comment-body" rows="3" maxlength="${1e4}" .value="${this._value}" placeholder="Write a comment…" aria-describedby="comment-shortcut" ?disabled="${this._busy}" @input="${e=>{this._value=e.target.value}}" @keydown="${this._keydown}"></textarea><footer class="nwd-actions"><span id="comment-shortcut" class="shortcut">Ctrl / ⌘ + Enter to send</span><span class="nwd-spacer"></span> ${this._editing?L`<button type="button" class="quiet" ?disabled="${this._busy}" @click="${this._cancelEdit}">Cancel edit</button>`:R} <button type="submit" class="primary" ?disabled="${this._busy||!this._value.trim()}">${this._editing?`Save changes`:`Comment`}</button></footer></form>`:L`<p class="read-only">You have read-only access to this discussion.</p>`}</dialog>`}};customElements.define(`managed-comments-dialog`,hr);function gr(e,t){return S(`managed-comments-dialog`,{finding:e,changed:t})}var _r=new Set([`github-unavailable`,`unavailable`,`shutting-down`,`github-create-failed`]);async function vr(e,t,n,r=null){let i=`/api/teams/${encodeURIComponent(e)}/issues`,a,o;try{a=await f(r?i:`${i}?${new URLSearchParams(t)}`,{method:r?`POST`:`GET`,credentials:`same-origin`,headers:{accept:`application/json`,...r?{"content-type":`application/json`,"x-csrf-token":n}:{}},...r?{body:JSON.stringify({...t,...r})}:{}}),o=await a.json()}catch{throw Error(r?`github-create-uncertain`:`github-unavailable`)}if(!a.ok){let e=typeof o?.error==`string`&&o.error?o.error:null;throw Error(r&&a.status>=500&&!_r.has(e)?`github-create-uncertain`:e??(r?`github-create-uncertain`:`github-unavailable`))}return o}var yr=`dialog{max-width:1040px;width:min(1040px,calc(100vw - 32px));margin-top:2rem;max-height:calc(100dvh - 4rem);overflow:hidden}dialog[open]{display:flex;flex-direction:column}header,.nwd-actions{flex-shrink:0}.dialog-content{min-height:0;overflow:auto;scrollbar-gutter:stable;padding:3px}.nwd-intro{overflow-wrap:anywhere}label{display:flex;flex-direction:column;gap:6px;margin:12px 0}textarea{min-height:clamp(240px,45dvh,540px);resize:vertical;line-height:1.55}.description-heading{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px;margin:16px 0 6px}.description-heading label{margin:0}.description-sections{display:flex;flex:1;flex-wrap:wrap;justify-content:flex-end;gap:6px}.description-sections label,.issue-label-choices label{flex-direction:row;align-items:center;font-size:.8rem;line-height:1.3;cursor:default;padding:5px 8px;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);color:var(--muted);background:var(--surface)}.description-sections label:has(input:checked),.issue-label-choices label:has(input:checked){color:var(--text);border-color:color-mix(in srgb,var(--accent) 65%,var(--border));background:color-mix(in srgb,var(--accent) 10%,var(--surface))}.description-sections label:has(input:focus-visible),.issue-label-choices label:has(input:focus-visible){outline:2px solid var(--accent);outline-offset:2px}.description-sections label:has(input:disabled),.issue-label-choices label:has(input:disabled){opacity:.55}.description-sections input,.issue-label-choices input{accent-color:var(--accent);flex-shrink:0}.issue-label-choices{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:12px 0 0}.issue-label-choices>span{margin-right:4px}.issue-label-choices label{margin:0;padding:3px 10px 3px 6px;border-radius:999px;overflow-wrap:anywhere}.description-help{margin:0 0 8px}.nwd-actions{flex-wrap:wrap}.nwd-actions a{font-size:.8rem}@media(width<=600px){dialog{margin-top:1rem;max-height:calc(100dvh - 2rem)}.description-sections{flex-basis:100%;justify-content:flex-start}}a{color:var(--accent)}.created-issue{padding:16px;border:1px solid var(--border);border-radius:var(--ui-radius, 8px)}.issue-heading{display:flex;align-items:center;gap:8px;margin-bottom:12px}.issue-status{padding:3px 10px;border-radius:20px;background:#238636;color:#fff;font-size:.8rem}.issue-status.closed{background:#8250df}.issue-status.not_planned,.issue-status.duplicate,.issue-status.unknown{background:#656d76}.issue-number{color:var(--muted)}h4{font-size:1.15rem;line-height:1.4;overflow-wrap:anywhere}.issue-description{margin-top:16px;white-space:pre-wrap;overflow-wrap:anywhere;max-height:40vh;overflow:auto;line-height:1.5;font-size:.9rem}.issue-labels{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px}.issue-labels span{border:1px solid var(--border);border-radius:12px;padding:2px 8px;font-size:.75rem}.para+.para,.md-list{margin-top:.75em}.md-list{padding-left:1.5em}.md-list li.md-task{list-style:none;position:relative}.md-task>input{position:absolute;left:-1.4em;top:.2em;margin:0}.md-heading{font-weight:600;margin-top:.75em}.md-rule{border:0;border-top:1px solid var(--border)}.inline-code,.code-block{font-family:monospace;background:var(--bg);border-radius:4px}.inline-code{padding:1px 4px}.code-block{white-space:pre;overflow:auto;padding:10px;margin:10px 0}
21
+ `,br={"github-unavailable":`GitHub could not be reached. Try checking again.`,"github-issue-forbidden":`GitHub did not permit issue creation. Check your repository access and authorization.`,"github-create-uncertain":`GitHub may have created this issue. Check the repository before trying again.`,"github-create-failed":`GitHub could not create the issue. Check the title and description before trying again.`,unauthenticated:`Your session expired. Sign in again before creating an issue.`,"workspace-changed":`Your workspace access changed. Reopen the finding before creating an issue.`,"bad-issue-repository":`The finding’s repository changed. Reopen the finding before creating an issue.`,"no-finding":`This finding is no longer available in this workspace.`},xr={not_planned:`Not planned`,duplicate:`Duplicate`,completed:`Completed`},Sr=3e3;function Cr(e,t){let n,r=new Promise(e=>{n=setTimeout(e,t,null)});return Promise.race([e.catch(()=>null),r]).finally(()=>clearTimeout(n))}var wr=class extends x{static styles=[...x.styles,I(yr),I(e)];static properties={teamId:{attribute:!1},context:{attribute:!1},session:{attribute:!1},formUrl:{attribute:!1},title:{state:!0},body:{state:!0},prepared:{state:!0},busy:{state:!0},creating:{state:!0},message:{state:!0},uncertain:{state:!0},createdUrl:{state:!0},createdIssue:{state:!0},detailsUnavailable:{state:!0},sections:{state:!0},uncheckedLabels:{state:!0}};constructor(){super(),this.title=``,this.body=``,this.prepared=null,this.busy=!1,this.creating=!1,this.message=``,this.uncertain=!1,this.createdUrl=``,this.createdIssue=null,this.detailsUnavailable=!1,this.sections=[],this.footer=null,this.draftEdited=!1,this.uncheckedLabels=new Set}beforeOpen(){this.finding&&Object.assign(this,ee(this.finding,{...this.draftOptions,allSections:!0})),this.check(!0)}editBody(e){this.draftEdited=!0,Object.assign(this,te(this,e))}toggleSection(e,t){this.draftEdited=!0,Object.assign(this,re(this,e,t))}chosenLabels(){return(this.prepared?.labels??[]).filter(e=>!this.uncheckedLabels.has(e))}toggleLabel(e,t){let n=new Set(this.uncheckedLabels);t?n.delete(e):n.add(e),this.uncheckedLabels=n}current(){return!this._settled&&this.isCurrent()}fallbackUrl(){let e=new URL(this.formUrl);if(e.searchParams.set(`title`,this.title),e.searchParams.set(`body`,this.body),this.prepared?.labels){let t=this.chosenLabels();t.length>0?e.searchParams.set(`labels`,t.join(`,`)):e.searchParams.delete(`labels`)}return e.href}async check(e=!1){if(!this.busy&&this.current()){this.busy=!0,this.message=``;try{this.optionsWait??=this.draftOptionsReady?Cr(this.draftOptionsReady,Sr):null;let[t,n]=await Promise.all([vr(this.teamId,this.context,this.session.csrfToken),this.optionsWait]);if(!this.current())return;n&&(this.draftOptions=n),this.prepared=t,this.uncertain=!1,this.finding&&!this.draftEdited&&Object.assign(this,ee(this.finding,{...this.draftOptions,allSections:t.mode!==`form`})),t.mode===`existing`&&(this.onCreated?.(t.url),window.location.assign(t.url)),e&&t.mode===`form`&&window.location.assign(this.fallbackUrl())}catch(e){!this.uncertain&&![`pending`,`created-unavailable`].includes(this.prepared?.mode)&&(this.prepared=null),this.message=br[e.message]??`Unable to check this issue. Please retry.`}finally{this.busy=!1}}}async create(){if(!(this.busy||this.uncertain||this.createdUrl||this.prepared?.mode!==`api`)){if(!this.current()){this.message=br[`workspace-changed`],this.prepared=null;return}this.busy=!0,this.creating=!0,this.message=``;try{let e=await vr(this.teamId,this.context,this.session.csrfToken,{title:this.title,body:this.body,labels:this.chosenLabels()});if(!this.current())return;e.mode===`existing`?(this.onCreated?.(e.url),window.location.assign(e.url)):e.url?(this.createdUrl=e.url,this.createdIssue=e.issue,this.detailsUnavailable=e.detailsUnavailable===!0,this.onCreated?.(e.url)):this.prepared=e}catch(e){e.message===`github-authorization-required`?this.prepared={mode:`authorize`,authorizationPath:`/api/oauth/github/issues/login`}:(this.uncertain=e.message===`github-create-uncertain`,[`workspace-changed`,`bad-issue-repository`,`no-team`,`no-report`,`no-finding`,`unauthenticated`,`forbidden`].includes(e.message)&&(this.prepared=null),this.message=br[e.message]??`Could not create this issue. Check the title, description, and repository access.`)}finally{this.busy=!1,this.creating=!1}}}render(){let e=this.createdIssue,t=this.prepared,n=t?.mode===`created-unavailable`,r=this.createdUrl||n,i=this.uncertain||t?.mode===`pending`,a=this.creating||i,o=!this.busy&&!i&&t?.mode===`form`;return L`<dialog aria-labelledby="issue-dialog-title" @close="${this._onClose}" @cancel="${e=>{this.creating&&e.preventDefault()}}"><header><h3 id="issue-dialog-title">${r?`Issue created`:`Create a GitHub issue`}</h3></header><div class="dialog-content"><p class="nwd-intro">${r?`Created`:`Create`} in <strong>${this.context?.repository}</strong> as <strong>@${this.session?.login}</strong>.</p>${this.createdUrl?L`<section class="created-issue" aria-label="Created GitHub issue"><div class="issue-heading"><span class="${`issue-status ${e?.status??`open`} ${e?.stateReason??``}`}">${e?.status===`closed`?xr[e.stateReason]??`Closed`:`Open`}</span> <span class="issue-number">${e?.number?`#${e.number}`:``}</span></div><h4><a href="${this.createdUrl}" target="_blank" rel="noopener">${e?.title??this.title}</a></h4><p class="nwd-note">Opened by @${e?.author??this.session?.login}</p>${e?.labels?.length?L`<div class="issue-labels">${e.labels.map(e=>L`<span>${e}</span>`)}</div>`:R}<div class="issue-description">${this.renderBody?this.renderBody(e?.description??this.body):e?.description??this.body}</div><p class="nwd-note ui-hint">Linked permanently to this finding. The Issue button will open this issue next time.</p>${this.detailsUnavailable?L`<p class="nwd-note">GitHub’s latest details could not be loaded. The issue was created and its link is saved.</p>`:R}</section>`:n?L`<p role="status">The issue was created and linked permanently to this finding. Its details cannot be shown because workspace access could not be confirmed. Check its status again once workspace access is available.</p>`:L`<label>Title<input class="nwd-input" maxlength="256" .value="${this.title}" ?disabled="${a}" @input="${e=>{this.title=e.target.value}}"></label><div class="description-heading"><label for="issue-description">Description</label> ${this.sections.length>0?L`<div class="description-sections" role="group" aria-label="Include in description">${this.sections.map(e=>L`<label><input type="checkbox" .checked="${e.selected}" ?disabled="${a}" @change="${t=>this.toggleSection(e.id,t.target.checked)}">${e.label}</label>`)}</div>`:R}</div><p id="description-help" class="nwd-note description-help ui-hint">${this.sections.length>0?`Add or remove sections above. Your edits are kept when toggling them.`:`Edit the description before creating the issue.`}</p><textarea id="issue-description" class="nwd-input" maxlength="65536" .value="${this.body}" aria-describedby="description-help" ?disabled="${a}" @input="${e=>this.editBody(e.target.value)}"></textarea> ${t?.labels?.length?L`<div class="issue-label-choices" role="group" aria-labelledby="issue-labels-heading"><span id="issue-labels-heading">Labels</span> ${t.labels.map(e=>L`<label><input type="checkbox" .checked="${!this.uncheckedLabels.has(e)}" ?disabled="${a}" @change="${t=>this.toggleLabel(e,t.target.checked)}">${e}</label>`)}</div>`:R} ${t?.mode===`permissions`?L`<p>Ask a repository owner to approve the app’s Issues read and write permission. ${t.authorizationPath?L`<a href="${t.authorizationPath}" target="_blank" rel="noopener">Review repository permissions</a>`:R}</p>`:R} ${t?.mode===`authorize`?L`<p><a href="${t.authorizationPath}" target="_blank" rel="noopener">Authorize GitHub</a>, then check authorization here.</p>`:R} ${t?.mode===`pending`?L`<p role="status">An issue is being created, or its creation could not be confirmed. Check its status before continuing; another issue will not be created.</p>`:R} ${t?.mode===`unavailable`?L`<p role="status">This finding already has a managed issue in a repository outside this workspace.</p>`:R}`} ${!this.createdUrl&&this.message?L`<p class="nwd-note" role="status">${this.message}</p>`:R} ${!this.createdUrl&&this.busy?L`<p role="status">${this.creating?`Creating issue…`:`Checking repository access…`}</p>`:R}</div><footer class="nwd-actions">${this.createdUrl?L`<a href="${this.createdUrl}" target="_blank" rel="noopener">Open issue on GitHub</a>`:!this.busy&&i?L`<a href="${t?.repositoryUrl??`https://github.com/${this.context?.repository}/issues`}" target="_blank" rel="noopener">Check repository issues</a>`:o?L`<a href="${this.fallbackUrl()}" target="_blank" rel="noopener">Use GitHub form</a>`:R} <span class="nwd-spacer"></span> ${!this.createdUrl&&t?.mode!==`unavailable`?t?.mode===`api`&&!this.uncertain?L`<button class="primary" ?disabled="${this.busy||!this.title.trim()}" @click="${this.create}">Create issue</button>`:L`<button ?disabled="${this.busy}" @click="${()=>this.check()}">${i||n?`Check issue status`:`Check authorization`}</button>`:R} <button ?disabled="${this.creating}" @click="${()=>this._finish(null)}">${r?`Close`:`Cancel`}</button></footer></dialog>`}};customElements.define(`managed-issue-dialog`,wr);function Tr(e){return S(`managed-issue-dialog`,e)}var Er=`.share-field{display:grid;gap:.35rem;margin-top:.8rem;font-size:.82rem}fieldset{display:grid;gap:.55rem;border:0;margin-top:1rem;font-size:.82rem}legend{margin-bottom:.55rem;font-weight:600}fieldset label{display:flex;align-items:center;gap:.5rem}input[type=checkbox]{accent-color:var(--accent)}.nwd-actions{flex-wrap:wrap}.revoke-all{margin-top:.75rem;border:0;background:none;color:var(--muted);font:inherit;font-size:.74rem}.revoke-all:hover:not(:disabled){color:var(--critical)}
22
+ `,Dr=class extends x{static styles=[...x.styles,I(Er)];static properties={team:{attribute:!1},session:{attribute:!1},initialId:{attribute:!1},selectedId:{state:!0},links:{state:!0},dependencies:{state:!0},security:{state:!0},busy:{state:!0},message:{state:!0}};constructor(){super(),this.team=null,this.initialId=``,this.selectedId=``,this.links=[],this.dependencies=!1,this.security=!1,this.busy=!0,this.message=``,this.urls=new Map}beforeOpen(){this.load(this.initialId)}select(e){let t=this.links.find(t=>t.id===e);this.selectedId=t?.id??``,this.dependencies=t?.permissions.dependencies===!0,this.security=t?.permissions.security===!0,this.message=``}async load(e=this.selectedId){this.busy=!0;try{let t=await m(this.team.id);return this._settled?void 0:(this.links=t,this.select(e),!0)}catch(e){return this.message=e.message,!1}finally{this.busy=!1}}async change(e=!1,t=!1){if(!this.busy){this.busy=!0,this.message=``;try{let n=await d(this.team.id,this.session?.csrfToken,{id:t?void 0:this.selectedId||void 0,revoke:e,dependencies:this.dependencies,security:this.security});if(p.invalidate([`links`,`history`]),this._settled)return;n.path&&(this.urls.set(n.id,new URL(n.path,location.origin).href),this.links=[{id:n.id,createdAt:Date.now(),createdBy:this.session?.login??``,permissions:{dependencies:this.dependencies,security:this.security}},...this.links],this.selectedId=n.id),e&&(t?this.urls.clear():this.urls.delete(this.selectedId)),await this.load(e?``:n.id??this.selectedId)&&(this.message=e?t?`All public links revoked.`:`Link revoked.`:n.path?`Link created.`:`Permissions saved. The link URL is unchanged.`)}catch(e){this.message=e.message}finally{this.busy=!1}}}async copy(){try{await navigator.clipboard.writeText(this.urls.get(this.selectedId)),this.message=`Link copied.`}catch{this.message=`Select the link and copy it.`}}render(){let e=this.urls.get(this.selectedId);return L`<dialog @close="${this._onClose}"><header><h3>Share ${this.team?.name}</h3></header><p class="nwd-intro ui-hint">Anyone with this link can read this workspace’s published reports, comments, triage, and available source files without signing in.<br>New published reports will also be included.</p><label class="share-field">Public links <select class="nwd-input" ?disabled="${this.busy}" @change="${e=>this.select(e.target.value)}"><option value="" ?selected="${!this.selectedId}">Create a new link</option>${this.links.map(e=>L`<option value="${e.id}" ?selected="${this.selectedId===e.id}">${new Date(e.createdAt).toLocaleString()} · ${e.createdBy} · ${e.id.slice(0,8)}</option>`)}</select></label><fieldset ?disabled="${this.busy}"><legend>Include in this link</legend><label><input type="checkbox" .checked="${this.security}" @change="${e=>{this.security=e.target.checked}}"> Security findings and advisories</label> <label><input type="checkbox" .checked="${this.dependencies}" @change="${e=>{this.dependencies=e.target.checked}}"> Findings in dependencies</label></fieldset><p class="nwd-note ui-hint">Both options are off for new links.<br>Existing links keep their URL when permissions change.</p>${e?L`<label class="share-field">Public link<input class="nwd-input" readonly="readonly" .value="${e}" @focus="${e=>e.target.select()}"></label>`:R} ${this.message?L`<p class="nwd-note" role="status">${this.message}</p>`:R}<footer class="nwd-actions">${this.selectedId?L`<button class="danger" ?disabled="${this.busy}" @click="${()=>this.change(!0)}">Revoke link</button>`:R} <span class="nwd-spacer"></span> ${e?L`<button @click="${()=>this.copy()}">Copy link</button>`:R} <button class="primary" ?disabled="${this.busy}" @click="${()=>this.change()}">${this.selectedId?`Save changes`:`Create public link`}</button> <button @click="${()=>this._finish(null)}">Close</button></footer>${this.links.length>0?L`<button class="revoke-all" ?disabled="${this.busy}" @click="${()=>this.change(!0,!0)}">Revoke all links for this workspace</button>`:R}</dialog>`}};customElements.define(`managed-share-dialog`,Dr);function Or(e,t=``,n=null){return S(`managed-share-dialog`,{team:e,initialId:t,session:n})}var kr=class extends x{static properties={_value:{state:!0}};constructor(){super(),this._value=``}_onInput=e=>{this._value=e.target.value};_onCreate=()=>{let e=this._value.trim();e&&this._finish(e)};_onKeydown=g(()=>this._onCreate());render(){return L`<dialog @close="${this._onClose}"><header><h3>New workspace</h3></header><input type="text" class="nwd-input" placeholder="Workspace name" maxlength="200" .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"><p class="nwd-note ui-hint">Workspace triage is synchronized by default over an end-to-end encrypted channel. Triage on unattached reports stays local to this browser.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._value.trim()}" @click="${this._onCreate}">Create</button></footer></dialog>`}};customElements.define(`new-workspace-dialog`,kr);function Ar(){return S(`new-workspace-dialog`)}var jr=`.bundle-advisories-rows{list-style:none;margin:0;padding:0;min-width:0;display:flex;flex-direction:column}.bundle-advisory-row{display:flex;align-items:flex-start;gap:.65rem;padding:.25rem 0;line-height:1.35}.bundle-advisory-row+.bundle-advisory-row{border-top:1px solid color-mix(in oklch,var(--border) 65%,transparent)}.bundle-advisory-rail{flex-shrink:0;display:flex;flex-direction:column;align-items:center;gap:.125rem;min-width:4.5rem;padding-top:.1rem}.bundle-advisory-severity{text-transform:uppercase;letter-spacing:.04em;font-size:.6rem;font-weight:700;padding:.15rem .4rem;border-radius:3px;color:#000;&.sev-critical{background:var(--critical);color:#fff}&.sev-high{background:var(--high)}&.sev-moderate{background:var(--medium)}&.sev-low{background:var(--low);color:var(--badge-low-text)}&.sev-info{background:var(--info);color:#fff}}.bundle-advisory-cvss-score{color:var(--muted);font-size:.62rem;letter-spacing:.02em}.bundle-advisory-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:.125rem}.bundle-advisory-header{display:flex;align-items:baseline;gap:.5rem}.bundle-advisory-title{flex:1;min-width:0;color:var(--text);font-size:.82rem;font-weight:500;overflow-wrap:anywhere}button.bundle-advisory-title{border:0;background:transparent;padding:0;font-family:inherit;line-height:inherit;text-align:left}button.bundle-advisory-title:hover{color:var(--accent)}button.bundle-advisory-title:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.bundle-advisory-reference{display:inline-flex;align-items:center;gap:.4rem;flex-shrink:0}.bundle-advisory-source{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;color:var(--muted);user-select:none}.bundle-advisory-source>svg{width:14px;height:14px}.bundle-advisory-subrow{display:flex;align-items:baseline;gap:.75rem}.bundle-advisory-meta{flex:1;min-width:0;color:var(--muted);font-size:.7rem;display:flex;flex-wrap:wrap;gap:.65rem;align-items:baseline}.bundle-advisory-meta .mono{font-size:.68rem}.bundle-advisory-cwes{margin-left:1.25rem}.bundle-advisory-ghsa{flex-shrink:0;display:inline-flex;align-items:center;gap:.2rem;color:var(--muted);text-decoration:none;font-size:.7rem;font-family:ui-monospace,monospace;cursor:default;user-select:text}.bundle-advisory-ghsa .external-link-icon{flex-shrink:0;opacity:.75;user-select:none}a.bundle-advisory-ghsa:hover .external-link-icon{opacity:1}.bundle-advisory-cwe{color:var(--muted);text-decoration:none;user-select:text;cursor:default}a.bundle-advisory-ghsa:hover,.bundle-advisory-cwe:hover{color:var(--accent)}.bundle-advisory-cvss-vector{flex-shrink:1;min-width:0;text-align:right;color:var(--muted);font-size:.65rem;font-family:ui-monospace,monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
23
+ `,Mr=`dialog{width:min(94vw,56rem)}.compare-advisories{min-height:0;padding:.75rem 1rem 1rem;overflow:auto;overscroll-behavior:contain}.compare-advisories:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.compare-advisory-group+.compare-advisory-group{margin-top:.9rem}.compare-advisory-group h4{display:flex;align-items:baseline;gap:.4rem;margin:0 0 .25rem;padding:0 .55rem;color:var(--muted);font-size:.68rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase}.compare-advisory-count{font-variant-numeric:tabular-nums}.compare-advisory-group>.bundle-advisories-rows{padding:.1rem .55rem;border:1px solid transparent;border-radius:var(--ui-radius, 4px)}.compare-advisory-group .bundle-advisory-rail{width:5rem;align-items:stretch;text-align:center}.compare-advisory-group.is-new{& h4{color:var(--critical)}>.bundle-advisories-rows{background:color-mix(in srgb,var(--critical) 6%,var(--bg));border-color:color-mix(in srgb,var(--critical) 55%,var(--border))}}.compare-advisory-group.is-fixed{.bundle-advisory-title{color:var(--muted);text-decoration:line-through}.bundle-advisory-severity{opacity:.55}}
24
+ `,Nr=class extends x{static styles=[...x.styles,I(jr),I(sn),I(Mr)];static properties={heading:{attribute:!1},groups:{attribute:!1},_current:{state:!0}};connectedCallback(){super.connectedCallback(),this._dispose=O(()=>{this._current=this.isCurrent(),this._current||queueMicrotask(this._onClose)})}disconnectedCallback(){this._dispose?.(),super.disconnectedCallback()}render(){return L`<dialog aria-labelledby="compare-advisories-title" @close="${this._onClose}"><header><h3 id="compare-advisories-title"><span>${this.heading}</span></h3><button type="button" aria-label="Close advisories" @click="${this._onClose}">×</button></header><div class="compare-advisories" tabindex="0">${this._current?this.groups.map(e=>L`<section class="${`compare-advisory-group is-${e.status}`}"><h4>${e.heading} <span class="compare-advisory-count">${e.rows.length}</span></h4><ul class="bundle-advisories-rows">${e.rows}</ul></section>`):R}</div></dialog>`}};customElements.define(`npm-compare-advisories-dialog`,Nr);function Pr(e){return S(`npm-compare-advisories-dialog`,e)}var Fr=e=>e.kind===`bundle`?e.label??`bundle-${e.identifier.slice(7,19)}\u2026`:e.identifier,Ir=e=>e.kind===`bundle`?`bundle`:be(e.identifier)?`links file`:`report`,Lr=class extends x{static styles=[...x.styles,I(z)];static properties={_running:{state:!0},_errors:{state:!0},_done:{state:!0}};constructor(){super(),this._running=!1,this._errors=[],this._done=!1}get copy(){return this.constructor.copy}focusInitial(){this.renderRoot.querySelector(`button[data-role="${this.copy.verb.toLowerCase()}"]`)?.focus()}_onClose=()=>this._finish({[this.copy.key]:[],failed:[]});transferred(){}_onRun=async()=>{if(this._running)return;this._running=!0,this._errors=[];let e=[],t=[];for(let n of this.items){let{kind:r,identifier:i}=n,a;try{a=await this.transfer(n)}catch(e){a=e?.message??String(e)}a===void 0?e.push({kind:r,identifier:i}):(t.push({kind:r,identifier:i,reason:a}),this._errors=[...this._errors,{label:Fr(n),reason:a}])}this._running=!1,this._done=!0,await this.transferred(e),t.length===0&&this._finish({[this.copy.key]:e,failed:t})};render(){let{verb:e,heading:t,one:n,many:r,note:i=R}=this.copy,a=this.items.length,o=a===1,s=new Set(this.items.map(Ir)),c=s.size===1?`${[...s][0]}${o?``:`s`}`:`items`,l=this._done&&this._errors.length>0,u=this._running?o?`${e}ing\u2026`:`${e}ing ${a} ${c}\u2026`:o?e:`${e} ${a}`;return L`<dialog @close="${this._onClose}"><header><h3>${t}</h3></header><p class="lwd-body">${o?n(Fr(this.items[0])):r(a,c)}</p>${o?R:L`<ul class="lwd-list">${this.items.map(e=>{let t=Ir(e);return L`<li>${Fr(e)}${t===`report`?R:L`<span class="lwd-kind-tag">${t}</span>`}</li>`})}</ul>`} ${i} ${this._errors.length===0?R:L`<ul class="lwd-list" role="alert">${this._errors.map(e=>L`<li><strong>${e.label}</strong> — ${e.reason}</li>`)}</ul>`}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._running}">${l?`Close`:`Cancel`}</button> ${l?R:L`<button type="button" data-role="${e.toLowerCase()}" @click="${this._onRun}" ?disabled="${this._running||a===0}">${u}</button>`}</footer></dialog>`}};function Rr(e,{workspaceId:t,items:n}={}){return S(e,{workspaceId:t??``,items:Array.isArray(n)?[...n]:[]})}var zr=class extends Lr{static copy={verb:`Download`,heading:`Download from remote`,key:`downloaded`,one:e=>L`Download <strong>"${e}"</strong> from the workspace's remote inventory?`,many:(e,t)=>L`Download <strong>${e}</strong> remote ${t} into this workspace?`};async transfer({kind:e,identifier:t}){if(e===`bundle`){let e=await rt(this.workspaceId,t);if(!e.ok)return e.reason??`unknown`;await he(t,this.workspaceId);return}let n=await tt(this.workspaceId,t);return n?.ok?void 0:n?.reason??`sync is not available`}async transferred(e){if(e.some(e=>e.kind===`report`))try{D.currentWorkspace===this.workspaceId&&await Ye(this.workspaceId)}catch{}}};customElements.define(`sync-download-dialog`,zr);function Br(e){return Rr(`sync-download-dialog`,e)}var Vr=`.rec-close{position:absolute;top:6px;right:6px;z-index:1}header{padding-right:1.5rem}.rec-list{margin:.2rem 0 .55rem;list-style:none;max-height:320px;overflow-y:auto}.rec-row{display:flex;align-items:center;gap:.5rem;padding:.28rem .15rem;font-size:.8rem;line-height:1.4;border-bottom:1px solid rgb(from var(--text) r g b / .06)}.rec-row:last-child{border-bottom:none}.rec-label{flex:1 1 auto;min-width:0;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rec-status{flex:0 0 auto;padding:0 .4rem;border-radius:4px;font-size:.68rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em}.rec-status-checking{color:var(--muted)}.rec-status-good{color:#16a34a}.rec-status-uploaded,.rec-status-reuploaded{color:var(--accent)}.rec-status-updated{color:var(--high)}.rec-status-differs,.rec-status-failed,.rec-status-check-failed{color:var(--warning);background:rgb(from var(--warning) r g b / .14)}.rec-status-missing{color:var(--critical)}.rec-choice{flex:0 0 auto;display:flex;gap:.3rem;& button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:var(--ui-radius, 4px);padding:.1rem .45rem;font:inherit;font-size:.72rem;cursor:default;&:hover:not(:disabled){border-color:var(--accent);color:var(--accent)}&:disabled{opacity:.5}}}.rec-summary{margin:.1rem 0 .2rem;color:var(--muted);font-size:.76rem;line-height:1.45}.rec-error{margin:.3rem 0 .2rem;color:var(--critical);font-size:.76rem;line-height:1.4}
25
+ `,Hr=e=>e===1?`copy`:`copies`,K={checking:{label:`checking…`,hint:`Checking the cloud copy…`},good:{label:`available`,hint:`The cloud copy is intact.`,summary:e=>`${e} available`},updated:{label:`local updated`,hint:`Your copy was out of date. It was replaced with the cloud copy.`,summary:e=>`${e} local ${Hr(e)} updated from the cloud`},uploaded:{label:`cloud updated`,hint:`Your copy was newer. It was uploaded to the cloud.`,summary:e=>`${e} cloud ${Hr(e)} updated from yours`},differs:{label:`differs`,hint:`Your copy differs from the cloud copy, and nothing shows which one is newer. Choose which to keep.`,summary:e=>`${e} ${e===1?`differs`:`differ`} \u2014 choose which copy to keep`},reuploaded:{label:`re-uploaded`,hint:`The cloud copy's data was missing. It was restored from your copy.`,summary:e=>`${e} re-uploaded`},failed:{label:`failed`,hint:`Couldn't bring this back in line. Re-check again to retry.`,summary:e=>`${e} failed`},"check-failed":{label:`check failed`,hint:`Couldn't download the cloud copy to check it, so its state is unknown. Re-check again to retry.`,summary:e=>`${e} check failed`},missing:{label:`missing`,hint:`The cloud copy's data is gone, and there's no matching copy here to restore it from.`,summary:e=>`${e} missing`}},Ur=Object.keys(K).filter(e=>K[e].summary);function Wr(e){let t=Object.fromEntries(Ur.map(e=>[e,0]));for(let n of e)n.status in t&&(t[n.status]+=1);return t}var Gr=class extends x{static styles=[...x.styles,I(A),I(z),I(Vr)];static properties={_rows:{state:!0},_running:{state:!0},_ran:{state:!0},_error:{state:!0},_resolving:{state:!0},_bulk:{state:!0}};constructor(){super(),this._rows=[],this._running=!1,this._ran=!1,this._error=null,this._resolving=new Set,this._bulk=!1}focusInitial(){this.renderRoot.querySelector(`button[data-role="recheck"]`)?.focus(),this.autoRun&&this._onRecheck()}_onClose=()=>this._finish(this._ran?{items:this._rows,counts:Wr(this._rows)}:null);_differingRows(){return this._rows.filter(e=>e.status===`differs`)}_onResolve=async(e,t)=>{if(this._resolving.has(e.resourceTag))return;this._resolving=new Set([...this._resolving,e.resourceTag]);let n;try{let r=await pt(this.workspaceId,e.identifier,t,e.compared);n=r?{status:r.status,detail:r.detail}:{status:`failed`,detail:`sync is not available`}}catch(e){n={status:`failed`,detail:e?.message??String(e)}}this._rows=this._rows.map(t=>t.resourceTag===e.resourceTag?{...t,...n}:t),this._resolving=new Set([...this._resolving].filter(t=>t!==e.resourceTag))};_onUseCloudForAll=async()=>{if(!(this._bulk||this._running)){this._bulk=!0;try{for(let e of this._differingRows())await this._onResolve(e,`cloud`)}finally{this._bulk=!1}}};_onRecheck=async()=>{if(!(this._running||this._bulk||this._resolving.size>0)){this._running=!0,this._error=null,this._rows=[];try{let{items:e}=await dt(this.workspaceId,{onList:e=>{this._rows=e},onItem:e=>{this._rows=this._rows.map(t=>t.resourceTag===e.resourceTag?e:t)}});this._rows=e}catch(e){this._error=e?.message??String(e)}finally{this._running=!1,this._ran=!0}}};_heldLocally(e){return e.identifier?e.kind===`bundle`?this.localBundles.includes(e.identifier):this.localFileNames.includes(e.identifier):!1}_downloadableItems(){return this._rows.filter(e=>e.status===`good`&&e.identifier&&(e.kind===`report`||e.kind===`bundle`)&&!this._heldLocally(e)).map(e=>e.kind===`report`?{kind:`report`,identifier:e.identifier}:{kind:`bundle`,identifier:e.identifier,label:e.label})}_onDownload=async()=>{let e=this._downloadableItems();e.length>0&&await Br({workspaceId:this.workspaceId,items:e})};_statusHint(e){let t=e.status===`good`&&this._heldLocally(e)?`The cloud copy is intact and matches your copy.`:K[e.status]?.hint??``;return e.detail?`${t}
26
+ ${e.detail}`:t}_choice(e){if(e.status!==`differs`)return R;let t=this._running||this._bulk||this._resolving.has(e.resourceTag);return L`<span class="rec-choice"><button type="button" data-role="keep-cloud" data-tooltip="Replace your copy with the cloud copy" @click="${()=>this._onResolve(e,`cloud`)}" ?disabled="${t}">Use cloud copy</button> <button type="button" data-role="keep-local" data-tooltip="Upload your copy, replacing the cloud copy" @click="${()=>this._onResolve(e,`local`)}" ?disabled="${t}">Upload mine</button></span>`}_rowsSection(){return this._rows.length===0?this._running?L`<p class="lwd-body">Fetching remote listing…</p>`:R:L`<ul class="rec-list">${this._rows.map(e=>L`<li class="rec-row"><span class="rec-label">${e.label}${e.kind===`bundle`?L`<span class="lwd-kind-tag">bundle</span>`:R}</span> ${this._choice(e)} <span class="${`rec-status rec-status-${e.status}`}" data-tooltip="${this._statusHint(e)}">${K[e.status]?.label??e.status}</span></li>`)}</ul>`}_summarySection(){if(!this._ran||this._rows.length===0)return R;let e=Wr(this._rows),t=Ur.filter(t=>e[t]).map(t=>K[t].summary(e[t]));return t.length>0?L`<p class="rec-summary" role="status" aria-live="polite">${t.join(` · `)}</p>`:R}render(){let e=this.cloudCount===1?``:`s`,t=this.cloudCount>0?L`the <strong>${this.cloudCount}</strong> remote`:`remote`,n=this._ran?this._downloadableItems().length:0,r=this._differingRows().length>1||this._bulk;return L`<dialog @close="${this._onClose}"><button type="button" class="detail-action rec-close" data-role="close" aria-label="Close" @click="${this._onCancel}">×</button><header><h3>Re-check cloud storage</h3></header>${this._ran?R:L`<p class="lwd-body">Re-check ${t} object${e} for this workspace. Each is re-fetched from the relay and compared with your copy. When one copy is provably newer, the other is updated to match; when it isn't clear, you choose which to keep. Any whose bytes are missing are re-uploaded from a matching local copy.</p>`} ${this._rowsSection()} ${this._ran&&this._rows.length===0&&!this._error?L`<p class="lwd-empty">No remote objects to check.</p>`:R} ${this._summarySection()} ${this._error?L`<p class="rec-error" role="alert">${this._error}</p>`:R}<footer class="nwd-actions"><span class="nwd-spacer"></span> ${r?L`<button type="button" data-role="use-cloud-all" data-tooltip="Replace your copy of every report that differs with its cloud copy" @click="${this._onUseCloudForAll}" ?disabled="${this._running||this._bulk}">${this._bulk?`Using cloud copies…`:`Use cloud for all ${this._differingRows().length} conflicts`}</button>`:R} ${!r&&n>0?L`<button type="button" data-role="download" @click="${this._onDownload}" ?disabled="${this._running}">Download ${n} not stored locally</button>`:R} ${r?R:L`<button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._running}">${this._ran?`Close`:`Cancel`}</button>`} <button type="button" data-role="recheck" @click="${this._onRecheck}" ?disabled="${this._running||this._bulk||this._resolving.size>0}">${this._running?`Re-checking…`:this._ran?`Re-check again`:`Re-check`}</button></footer></dialog>`}};customElements.define(`objstore-recovery-dialog`,Gr);function Kr({workspaceId:e,cloudCount:t,localFileNames:n,localBundles:r,autoRun:i}={}){return S(`objstore-recovery-dialog`,{workspaceId:e??``,cloudCount:typeof t==`number`?t:0,localFileNames:Array.isArray(n)?[...n]:[],localBundles:Array.isArray(r)?[...r]:[],autoRun:i===!0})}var qr=`Encryption was just enabled in another tab.`,Jr=class extends x{static styles=[...x.styles,I(b)];static properties={_userName:{state:!0},_busy:{state:!0},_error:{state:!0},_phase:{state:!0},_success:{state:!0},_orphan:{state:!0},_orphanAck:{state:!0},_canCancel:{state:!0}};constructor(){super(),this._userName=``,this._busy=!1,this._error=``,this._phase=``,this._success=!1,this._orphan=!1,this._orphanAck=!1,this._canCancel=!0,this._abortController=null}updated(e){e.has(`_success`)&&this._success&&this.renderRoot.querySelector(`footer button.primary`)?.focus()}beforeOpen(){typeof location<`u`&&(this._userName=location.hostname||`DeepView`),this._orphan=Ge(),this._vaultStateUnsub=Xe(()=>{if(this._settled)return;let e=Ge();this._orphan&&!e&&ze()?(this._error=`${qr} Close this dialog and reload to unlock.`,this._busy=!1,this._canCancel=!0):this._orphan!==e&&(this._orphan=e)})}async focusInitial(){await this.updateComplete,this.renderRoot.querySelector(this._orphan?`input[data-role="orphan-ack"]`:`input[data-role="name"]`)?.focus()}disconnectedCallback(){super.disconnectedCallback();try{this._vaultStateUnsub?.()}catch{}this._vaultStateUnsub=null}_finish(e){if(!this._settled){try{this._abortController?.abort()}catch{}super._finish(!!e)}}_onClose=()=>this._finish(this._success);_onCancel=e=>{this._busy&&!this._canCancel?e?.preventDefault():this._finish(!1)};_onNameInput=e=>{this._userName=e.target.value};_onOrphanAckInput=e=>{this._orphanAck=e.target.checked};_onWipeOrphan=async()=>{if(!this._busy&&this._orphanAck){if(ze()){this._error=`${qr} Reload this page to unlock.`;return}this._busy=!0,this._canCancel=!1,this._error=``,this._phase=`Clearing previous vault state…`;try{await et({refuseIfEnabled:!0}),location.reload()}catch(e){this._error=`Could not clear previous vault state: ${e?.message??e}`,this._phase=``}finally{this._busy=!1,this._canCancel=!0}}};_onEnable=async()=>{if(!this._busy){if(!He()){this._error=`Passkeys are not supported in this browser.`;return}this._busy=!0,this._canCancel=!0,this._error=``,this._phase=`Registering passkey…`,this._abortController=new AbortController;try{await $e({userName:this._userName.trim()||`DeepView user`,rpName:`DeepView`,signal:this._abortController.signal,migrate:async({seal:e})=>{this._canCancel=!1,this._phase=`Encrypting workspaces and metadata…`,await nt({seal:e}),this._phase=`Encrypting triage data…`,await Ce({seal:e}),this._phase=`Encrypting report files…`,await ne({seal:e}),this._phase=`Encrypting bundles…`,await ie({seal:e})}})&&(this._success=!0,this._phase=``)}catch(e){this._error=e?.name===`AbortError`?``:e?.message??String(e),this._phase=``}finally{this._busy=!1,this._canCancel=!0,this._abortController=null}}};_status(){return L`${this._phase?L`<p class="nwd-note">${this._phase}</p>`:R} ${this._error?L`<p class="wsl-error">${this._error}</p>`:R}`}_footer(e,t,n){return L`<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" ?disabled="${this._busy&&!this._canCancel}" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${t}" @click="${n}">${this._busy?`Working…`:e}</button></footer>`}_orphanBody(){return L`<p class="wsl-error">DeepView found an abandoned passkey setup on this device. The original passkey can no longer be accessed, so any local data still encrypted under it is <strong>unreadable</strong> and cannot be recovered.</p><p class="nwd-note ui-hint">To enable encryption, DeepView will <strong>permanently delete ALL local DeepView data on this device</strong> — including any plaintext workspaces or reports you may have added after the previous passkey was lost — and then register a fresh passkey. This is irreversible. There is no backup.</p><label class="wsl-ack"><input type="checkbox" data-role="orphan-ack" .checked="${this._orphanAck}" ?disabled="${this._busy}" @change="${this._onOrphanAckInput}"> <span>I understand all local DeepView data on this device will be deleted.</span></label> ${this._status()} ${this._footer(`Wipe and continue`,this._busy||!this._orphanAck,this._onWipeOrphan)}`}_enableBody(){let e=He();return L`<p class="nwd-note ui-hint">Passkey encryption protects your local triage and report data with a hardware-backed key (TouchID, Windows Hello, security key). Without the passkey, the data on disk is unreadable — even to scripts running on this origin.</p><p class="wsl-error"><strong>If you lose access to this passkey, your data CANNOT be recovered.</strong> DeepView has no backup key, no recovery code, and no escrow. Make sure your passkey is backed up (iCloud Keychain / Google Password Manager sync, or a second registered device) before relying on encryption for important data.</p><p class="nwd-note ui-hint"><strong>Opt-in.</strong> You can disable encryption later from the lock icon in the sidebar header — the data is rewritten as plaintext and DeepView signals your authenticator to remove the passkey (where supported).</p>${e?R:L`<p class="wsl-error">Your browser doesn't expose the WebAuthn passkey API. Try Chrome, Safari, Edge, or Firefox in a recent version on a device with a platform authenticator.</p>`} <label class="wsl-field"><span>Passkey label</span> <input type="text" class="nwd-input" data-role="name" placeholder="DeepView" maxlength="200" .value="${this._userName}" @input="${this._onNameInput}"></label> ${this._status()} ${this._footer(`Enable encryption`,!e||this._busy,this._onEnable)}`}_successBody(){return L`<p class="nwd-note ui-hint"><strong>Encryption is on.</strong> Your triage data and report files are now sealed under your passkey. You'll be asked to unlock with the passkey on every fresh load.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" class="primary" @click="${()=>this._finish(!0)}">Close</button></footer>`}render(){return L`<dialog @close="${this._onClose}" @cancel="${this._onCancel}"><header><h3>${this._success?`Encryption enabled`:this._orphan?`Previous passkey setup detected`:`Enable passkey encryption`}</h3></header>${this._orphan?this._orphanBody():this._success?this._successBody():this._enableBody()}</dialog>`}};customElements.define(`passkey-setup-dialog`,Jr);function Yr(){return S(`passkey-setup-dialog`)}var Xr=class extends x{_onClose=()=>this._finish({shown:!0});render(){return L`<dialog @close="${this._onClose}"><header><h3>Changes might not be saved</h3></header><p class="nwd-intro">Triage works in this tab, but this browser <strong>can't save its sync state right now</strong> — so changes that haven't reached the server could be lost if you reload the page.</p><p class="nwd-intro">This usually means the browser's storage is full, or another tab is running a newer version of the app (to avoid overwriting that newer version's data, this tab has paused saving).</p><p class="nwd-note ui-hint">Free up space if storage is full, and close or reload other tabs of this app to the same version. This notice clears on its own once saving works again.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" class="primary" @click="${this._onClose}">Got it</button></footer></dialog>`}};customElements.define(`persistence-degraded-dialog`,Xr);function Zr(){return S(`persistence-degraded-dialog`,{},{exclusive:!0,conflict:()=>({shown:!1})})}function Qr(e){if(It(e))throw Error(`This is a links file, not a report. Wrap report rows in a groups or findings object to compare them.`);let t=e;try{let n=JSON.parse(e);Array.isArray(n)&&(t=JSON.stringify({groups:n}))}catch{}let{data:n,reason:r}=en(t);if(!n)throw Error(r);let i=[],a=new Map,o=0;for(let e of $t(n)){let t=new Set;for(let n of Array.isArray(e)?e:[e])if(n&&typeof n==`object`&&!Array.isArray(n)){if(typeof n.id!=`string`||!n.id){o++;continue}t.add(n.id),a.has(n.id)||a.set(n.id,[]),a.get(n.id).push(n)}i.push([...t].toSorted())}return{rows:i,byId:a,missingIds:o}}function $r(e){let t=new Set;for(let n of e){let e=[...new Set(n)].toSorted();for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++)t.add(JSON.stringify([e[n],e[r]]))}return t}function ei(e){let t=new Map,n=e=>{let n=e;for(;t.get(n)!==n;)t.set(n,t.get(t.get(n))),n=t.get(n);return n};for(let r of e){let[e,i]=JSON.parse(r);for(let n of[e,i])t.has(n)||t.set(n,n);t.set(n(e),n(i))}let r=new Map;for(let e of[...t.keys()].toSorted()){let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}return[...r.values()].toSorted((e,t)=>e[0].localeCompare(t[0]))}function q(e,t,n){let r=(e.byId.get(t)??[]).map(e=>n===`verdict`?rn(e)||null:n===`severity`?nn(e)??null:n===`originalSeverity`?e.severity??null:n===`confidence`&&Number.isFinite(e.confidence)?e.confidence:null);return[...new Set(r)].toSorted((e,t)=>String(e).localeCompare(String(t),void 0,{numeric:!0}))}var ti=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),J=(e,t)=>[...e].filter(e=>!t.has(e)).toSorted();function ni(e,t){let n=new Set(e.byId.keys()),r=new Set(t.byId.keys()),i=[...n].filter(e=>r.has(e)).toSorted(),a=new Set(i),o=e=>$r(e.rows.map(e=>e.filter(e=>a.has(e)))),s=o(e),c=o(t),l={confirmed:[],refuted:[],otherVerdicts:[],confidence:[],severity:[]};for(let n of i)for(let r of[`verdict`,`confidence`,`severity`]){let i=q(e,n,r),a=q(t,n,r),o={id:n,before:i,after:a};r===`severity`&&(o.originalBefore=q(e,n,`originalSeverity`),o.originalAfter=q(t,n,`originalSeverity`)),(!ti(i,a)||r===`severity`&&!ti(o.originalBefore,o.originalAfter))&&(r===`verdict`?l[a.length===1&&a[0]===`confirmed`?`confirmed`:a.length===1&&a[0]===`refuted`?`refuted`:`otherVerdicts`].push(o):l[r].push(o))}let u=ei(J(c,s)),d=ei(J(s,c)),f=J(r,n),p=J(n,r);return{before:e,after:t,added:f,removed:p,shared:i,joined:u,split:d,...l,unchanged:f.length===0&&p.length===0&&u.length===0&&d.length===0&&Object.values(l).every(e=>e.length===0)}}var ri=`dialog{width:min(94vw,1180px);max-width:1180px;height:min(88dvh,960px);max-height:92dvh;margin-block:auto;padding:0;overflow:hidden;background:var(--theme-bar)}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1.1rem 1.3rem}header h3{margin-bottom:.25rem;font-size:1.1rem}header p,.muted,.note,.empty{color:var(--muted);font-size:.78rem;line-height:1.5}button,select,input{font:inherit;font-size:.8rem}button,select,.file-button,.search{color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);padding:.45rem .65rem}button:not(:disabled):hover,.file-button:hover{background:var(--surface-active)}button:disabled{opacity:.45}button:focus-visible,select:focus-visible,.search:focus-visible,.file-button:focus-within{outline:2px solid var(--accent);outline-offset:2px}.pickers{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:start;gap:1rem;padding:0 1.3rem 1rem;border-bottom:1px solid var(--border)}.picker{min-width:0}.picker>label{display:block;font-size:.72rem;font-weight:600;margin-bottom:.4rem;color:var(--muted)}.picker select{width:100%;text-overflow:ellipsis}.file-picker{display:flex;align-items:center;flex-wrap:wrap;gap:.6rem;margin-top:.55rem}.file-button{position:relative;display:inline-block;font-size:.74rem;padding:.3rem .5rem;overflow:hidden}.file-button input{position:absolute;inset:0;opacity:0;width:100%}.swap{align-self:start;margin-top:1.5rem;font-size:1rem}.results{overflow:auto;min-height:0;padding:1.1rem 1.3rem 1.4rem}.summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.65rem}.summary>div{display:flex;flex-direction:column;gap:.35rem;padding:.8rem 1rem;background:var(--bg);border:1px solid var(--border);border-radius:var(--ui-radius, 7px)}.summary span{font-size:.72rem;color:var(--muted)}.summary strong{font-size:1.15rem;font-variant-numeric:tabular-nums}.positive h4{color:var(--green)}.negative h4,.verdict-confirmed h4,.summary .verdict-confirmed strong{color:var(--critical)}.verdict-refuted h4,.summary .verdict-refuted strong{color:var(--muted)}.change-counts{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.7rem}.change-counts span{font-size:.7rem;padding:.3rem .5rem;border-radius:5px;background:var(--bg);color:var(--muted)}.results-head{display:flex;align-items:center;flex-wrap:wrap;gap:.75rem;margin-block:1rem}.results-head p{flex:1;font-size:.78rem;color:var(--muted);overflow-wrap:anywhere}.search{width:min(100%,17rem)}.section-title{margin:1.2rem 0 .5rem;font-size:.87rem}.note{margin:-.15rem 0 .6rem}.columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.8rem}.change-section{border:1px solid var(--border);border-radius:var(--ui-radius, 7px);overflow:hidden;margin-bottom:.6rem}.change-section h4{display:flex;justify-content:space-between;align-items:center;gap:.5rem;font-size:.78rem;font-weight:600;padding:.65rem .8rem;background:var(--bg)}.count{font-variant-numeric:tabular-nums;font-size:.7rem}ul{list-style:none}li{border-top:1px solid var(--border);padding:.7rem .8rem}.change-row{display:flex;justify-content:space-between;align-items:start;gap:.8rem}.finding{display:flex;flex-direction:column;gap:.2rem;min-width:0;overflow-wrap:anywhere}.finding strong{font-size:.77rem;font-weight:500;line-height:1.4}.finding code,.finding small{color:var(--muted);font-size:.66rem;line-height:1.4}.change-value{display:flex;align-items:center;justify-content:end;flex-wrap:wrap;gap:.3rem;max-width:48%;flex-shrink:0;font-size:.73rem;text-align:end;overflow-wrap:anywhere}.from{color:var(--muted)}.change-value small{width:100%;color:var(--muted);font-size:.67rem}.group-members{display:flex;flex-direction:column;gap:.55rem}.group-shape{display:flex;flex-wrap:wrap;gap:.45rem;margin-top:.7rem;font:.66rem/1.5 monospace;overflow-wrap:anywhere}.group-shape>span{min-width:0}.empty{padding:.7rem .8rem}.more{margin:.5rem .8rem .7rem;font-size:.72rem}.placeholder{padding:4rem 1rem;text-align:center;color:var(--muted);font-size:.85rem}.identical{color:var(--green);font-size:.82rem;padding-block:.5rem}.error,.warning{font-size:.75rem;line-height:1.5;margin-top:.5rem;overflow-wrap:anywhere}.error{color:var(--critical)}.warning{color:var(--yellow)}dialog>.error{padding:0 1.3rem .6rem}@media(width<=650px){.pickers{gap:.5rem;padding-inline:.8rem}.columns{grid-template-columns:minmax(0,1fr);gap:0}.summary{grid-template-columns:repeat(2,minmax(0,1fr))}.summary>div{padding:.6rem}.results-head p{flex-basis:100%}.search{width:100%}header,.results{padding-inline:.8rem}.change-row{flex-wrap:wrap}.change-value{max-width:100%}}
27
+ `,ii=()=>({key:``,name:``,report:null,error:``,loading:!1}),Y=(e,t)=>e.map(e=>e===null?`Not supplied`:t===`confidence`?`${e}/10`:String(e).replaceAll(`_`,` `)).join(` / `),ai=50,oi=class extends x{static styles=[...x.styles,I(ri)];static properties={_names:{state:!0},_sides:{state:!0},_catalogError:{state:!0},_catalogLoading:{state:!0},_diff:{state:!0},_query:{state:!0},_limits:{state:!0}};constructor(){super(),this._names=[],this._sides=[ii(),ii()],this._tokens=[0,0],this._catalogError=``,this._catalogLoading=!0,this._diff=null,this._query=``,this._limits={}}beforeOpen(){this._loadCatalog()}focusInitial(){this.renderRoot.querySelector(`select`)?.focus()}async _loadCatalog(){try{let e=await wt();if(this._settled)return;this._names=e.filter(e=>ue(e)!==Ft);let t=this._names.includes(D.currentFile)?D.currentFile:this._names[0];t&&!this._tokens[0]&&this._select(0,t);let n=this._names.find(e=>e!==t);n&&!this._tokens[1]&&this._select(1,n)}catch(e){this._settled||(this._catalogError=`Couldn't list saved reports: ${e.message}`)}finally{this._settled||(this._catalogLoading=!1)}}_setSide(e,t){this._sides=this._sides.map((n,r)=>r===e?t:n),this._limits={};let[n,r]=this._sides.map(e=>e.report);this._diff=n&&r?ni(n,r):null}async _select(e,t,n){let r=++this._tokens[e],i={...ii(),key:n?``:t,name:t,loading:!!t};if(this._setSide(e,i),t)try{let a=n?await n.text():await Dt(t);if(this._settled||this._tokens[e]!==r)return;this._setSide(e,{...i,loading:!1,report:Qr(a)})}catch(n){!this._settled&&this._tokens[e]===r&&this._setSide(e,{...i,loading:!1,error:`Couldn't read ${t}: ${n.message}`})}}_file(e,t){let n=t.target.files?.[0];t.target.value=``,n&&this._select(e,n.name,n)}_swap(){this._sides.some(e=>e.loading)||(this._tokens=this._tokens.map(e=>e+1),this._sides=this._sides.toReversed(),this._setSide(0,this._sides[0]))}_picker(e){let t=this._sides[e],n=e===0?`Before`:`After`;return L`<section class="picker"><label for="${`report-${e}`}">${n}</label> <select id="${`report-${e}`}" @change="${t=>this._select(e,t.target.value)}"><option value="" .selected="${!t.key}">${t.name&&!t.key?t.name:`Choose a saved report…`}</option>${this._names.map(e=>L`<option value="${e}" .selected="${t.key===e}">${e}</option>`)}</select><div class="file-picker"><label class="file-button">Open file…<input type="file" accept=".json,.md,.markdown" aria-label="${`Open ${n.toLowerCase()} report file`}" @change="${t=>this._file(e,t)}"></label> <span class="muted">${t.loading?`Reading report…`:t.report?`${t.report.byId.size.toLocaleString()} unique findings`:`JSON or Markdown`}</span></div>${t.error?L`<p class="error" role="alert">${t.error}</p>`:R} ${t.report?.missingIds?L`<p class="warning">${t.report.missingIds} findings without an id excluded.</p>`:R}</section>`}_finding(e){let t=this._diff.after.byId.get(e)?.[0]??this._diff.before.byId.get(e)?.[0];return L`<span class="finding"><strong>${F(t)||e}</strong><code>${e}</code>${t.file?L`<small>${t.file}</small>`:R}</span>`}_matches(e){let t=this._query.trim().toLowerCase();return!t||[e,...[...this._diff.before.byId.get(e)??[],...this._diff.after.byId.get(e)??[]].flatMap(e=>[F(e),e.file])].filter(Boolean).some(e=>e.toLowerCase().includes(t))}_section(e,t,n,r,i=``){let a=n.filter(e=>(Array.isArray(e)?e:[e.id??e]).some(e=>this._matches(e))),o=this._limits[e]??ai;return L`<section class="${`change-section ${i}`}" aria-label="${t}"><h4>${t}<span class="count">${this._query.trim()?`${a.length} / `:``}${n.length}</span></h4>${a.length>0?L`<ul>${a.slice(0,o).map(r)}</ul>`:L`<p class="empty">${n.length>0?`No matching findings.`:`No changes.`}</p>`} ${a.length>o?L`<button class="more" @click="${()=>{this._limits={...this._limits,[e]:o+ai}}}">Show ${Math.min(ai,a.length-o)} more (${a.length-o} remaining)</button>`:R}</section>`}_changeRow(e,t){let n=t===`severity`&&JSON.stringify(e.originalBefore)!==JSON.stringify(e.originalAfter);return L`<li class="change-row">${this._finding(e.id)}<span class="change-value"> <span class="from">${Y(e.before,t)}</span><span aria-label="to">→</span><span>${Y(e.after,t)}</span> ${n?L`<small>Original: ${Y(e.originalBefore)} → ${Y(e.originalAfter)}</small>`:R}</span></li>`}_presenceRow(e,t){let n=Y(q(t,e,`verdict`));return L`<li class="change-row">${this._finding(e)}<span class="change-value"> <span>${Y(q(t,e,`severity`))}</span><span>${Y(q(t,e,`confidence`),`confidence`)}</span> ${n===`Not supplied`?R:L`<small>${n}</small>`}</span></li>`}_groupRow(e){let t=new Set(e),n=e=>e.rows.map(e=>e.filter(e=>t.has(e))).filter(e=>e.length).map(e=>e.join(`, `)).filter((e,t,n)=>n.indexOf(e)===t).join(` | `);return L`<li class="group-row"><div class="group-members">${e.map(e=>this._finding(e))}</div><div class="group-shape"><span class="from">${n(this._diff.before)}</span><span aria-label="to">→</span><span>${n(this._diff.after)}</span></div></li>`}_verdictCount(e,t){return[...e.byId.keys()].filter(n=>q(e,n,`verdict`).includes(t)).length}_results(){let e=this._diff;return e?L`<div class="summary" aria-label="Comparison summary"><div><span>Unique findings</span><strong>${e.before.byId.size} → ${e.after.byId.size}</strong></div><div><span>In common</span><strong>${e.shared.length}</strong></div><div class="verdict-confirmed"><span>Confirmed</span><strong>${this._verdictCount(e.before,`confirmed`)} → ${this._verdictCount(e.after,`confirmed`)}</strong></div><div class="verdict-refuted"><span>Refuted</span><strong>${this._verdictCount(e.before,`refuted`)} → ${this._verdictCount(e.after,`refuted`)}</strong></div></div><div class="change-counts" aria-label="Change counts"><span>${e.added.length} added</span><span>${e.removed.length} removed</span> <span>${e.joined.length} joined</span><span>${e.split.length} split</span> <span>${e.confidence.length} confidence</span><span>${e.severity.length} severity</span></div><div class="results-head"><p>Changes from <strong>${this._sides[0].name}</strong> to <strong>${this._sides[1].name}</strong>.</p><input class="search" type="search" aria-label="Filter comparison findings" placeholder="Filter by id, title or file…" .value="${this._query}" @input="${e=>{this._query=e.target.value,this._limits={}}}"></div>${e.shared.length===0&&(e.before.missingIds||e.after.missingIds)?L`<p class="warning" role="status">No shared ids to compare. Findings without ids cannot be matched.</p>`:e.unchanged?L`<p class="identical" role="status">No differences in finding ids, grouping, verdicts, confidence or severity.</p>`:R}<h3 class="section-title">Findings</h3><div class="columns">${this._section(`added`,`Added`,e.added,t=>this._presenceRow(t,e.after),`positive`)} ${this._section(`removed`,`Removed`,e.removed,t=>this._presenceRow(t,e.before),`negative`)}</div><h3 class="section-title">Revalidation</h3><p class="note">Changed verdicts for shared ids, grouped by the after report’s verdict.</p><div class="columns">${this._section(`confirmed`,`Confirmed`,e.confirmed,e=>this._changeRow(e,`verdict`),`verdict-confirmed`)} ${this._section(`refuted`,`Refuted`,e.refuted,e=>this._changeRow(e,`verdict`),`verdict-refuted`)}</div>${e.otherVerdicts.length>0?this._section(`other`,`Other verdict changes`,e.otherVerdicts,e=>this._changeRow(e,`verdict`)):R}<h3 class="section-title">Grouping</h3><p class="note">Only shared ids. Each cluster connects changed pairs; added or removed findings do not count as regrouping.</p><div class="columns">${this._section(`joined`,`Joined`,e.joined,e=>this._groupRow(e),`positive`)} ${this._section(`split`,`Split`,e.split,e=>this._groupRow(e),`negative`)}</div><h3 class="section-title">Ratings</h3><p class="note">Shared ids only. Severity includes report corrections; changes to original severity are also shown.</p><div class="columns">${this._section(`confidence`,`Confidence changes`,e.confidence,e=>this._changeRow(e,`confidence`))} ${this._section(`severity`,`Severity changes`,e.severity,e=>this._changeRow(e,`severity`))}</div>`:L`<p class="placeholder" role="status">${this._sides.some(e=>e.loading)||this._catalogLoading?`Loading reports…`:`Choose two saved reports or open two files to compare.`}</p>`}render(){return L`<dialog aria-labelledby="compare-title" @close="${this._onClose}"><header><div><h3 id="compare-title">Compare reports</h3><p>Compare findings, grouping and ratings between two reports.</p></div><button aria-label="Close report comparison" @click="${this._onClose}">Close</button></header><div class="pickers">${this._picker(0)}<button class="swap" aria-label="Swap before and after reports" ?disabled="${this._sides.some(e=>e.loading)}" @click="${this._swap}">⇄</button>${this._picker(1)}</div>${this._catalogError?L`<p class="error" role="alert">${this._catalogError} You can still open files directly.</p>`:R}<div class="results">${this._results()}</div></dialog>`}};customElements.define(`report-compare-dialog`,oi);function si(){if(xt())throw Error(`Report comparison is available in local/E2E mode.`);return S(`report-compare-dialog`)}var ci=`dialog{--issue-open: var(--green);--issue-merged: #a371f7;--issue-closed: var(--critical);--issue-quiet: var(--muted);--claude: #d97757;width:min(94vw,52rem);max-width:none;max-height:calc(100dvh - 7rem);padding:0;overflow:hidden}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:start;gap:.6rem;flex-shrink:0;padding:.8rem 1rem;border-bottom:1px solid var(--border)}header h3{display:flex;align-items:baseline;gap:.5rem;flex:1;min-width:0;margin:0;font-size:1rem;line-height:1.35;overflow-wrap:anywhere}header button{flex-shrink:0;border:0;background:transparent;color:var(--muted);font-family:inherit;font-size:1.4rem;line-height:1;padding:0 .25rem;&:hover{color:var(--text)}&.back{font-size:1.1rem}}.repo-item-body{display:flex;flex-direction:column;gap:.75rem;min-height:0;padding:.9rem 1rem 1rem;overflow:auto;overscroll-behavior:contain;font-size:.85rem}.repo-item-number{color:var(--muted);font-weight:400;font-variant-numeric:tabular-nums}.repo-item-meta{display:flex;flex-wrap:wrap;align-items:center;gap:.3rem .9rem;color:var(--muted)}.repo-item-meta strong{color:var(--text);font-weight:500}code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.9em;color:var(--text)}:is(.repo-item-badge,.repo-item-state){--state: var(--issue-open);&.is-merged,&.is-completed{--state: var(--issue-merged)}&.is-closed{--state: var(--issue-closed)}&.is-draft,&.is-not-planned{--state: var(--issue-quiet)}}.repo-item-badge{padding:.1rem .55rem;border-radius:999px;background:var(--state);color:var(--surface);font-weight:500}svg{flex:none;width:14px;height:14px;fill:none;stroke:currentcolor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}svg .fill{fill:currentcolor;stroke:none}svg .dotted{stroke-dasharray:1 2.2}.repo-item-state{display:inline-flex;align-self:center;color:var(--state)}.repo-item-mark{display:inline-flex;align-items:center;gap:.25rem;& svg{width:12px;height:12px}&.is-approved,&.is-success{color:var(--green)}&.is-changes,&.is-failure{color:var(--critical)}&.is-pending{color:var(--medium)}}.is-added{color:var(--green)}.is-deleted{color:var(--critical)}npm-delta{display:inline-block;flex:none;min-width:1px;min-height:1em}.npm-delta{flex:none;color:var(--muted);font-size:.7rem;white-space:nowrap;font-variant-numeric:tabular-nums}.npm-delta-published{margin-left:.35em;opacity:.8}.repo-item-labels{display:flex;flex-wrap:wrap;gap:.3rem}.repo-item-label{padding:0 .45rem;border:1px solid var(--border);border-radius:999px;font-size:.75rem;line-height:1.5;&:before{content:"";display:inline-block;width:.5rem;height:.5rem;margin-right:.3rem;border-radius:50%;background:var(--label, var(--muted));vertical-align:middle}}.repo-item-agents{display:inline-flex;align-items:center;align-self:start;gap:.25rem;height:1lh}.agent-mark{display:inline-flex}.agent-mark :is(svg,img){width:16px;height:16px}.agent-mark:is(.is-claude,.is-codex,.is-copilot) svg{fill:currentcolor;stroke:none}.agent-mark.is-claude svg{color:var(--claude)}.agent-logo{display:inline-flex}.agent-logo svg{flex:none}.agent-avatar{border-radius:3px}.repo-item-section{& h4{margin:0 0 .3rem;color:var(--muted);font-size:.72rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase}& h4.repo-item-deps-heading{display:flex;align-items:center;justify-content:space-between;gap:.5rem;min-height:1.6rem}& ul{margin:0;padding:0;list-style:none;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);overflow:hidden}& li+li{border-top:1px solid var(--border)}}.dependency-review-copy-button{display:inline-flex;align-items:center;justify-content:center;width:1.6rem;height:1.6rem;padding:0;border:0;border-radius:var(--ui-radius, 4px);background:transparent;color:var(--muted);&:hover{background:var(--surface-active);color:var(--text)}&.copied{color:var(--green)}& svg{width:.9rem;height:.9rem}}.repo-item-row{display:flex;align-items:center;gap:.5rem;width:100%;padding:.35rem .6rem;border:0;background:none;color:var(--text);font:inherit;text-align:left;text-decoration:none;&:hover{background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}}.repo-item-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.review-row{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem .7rem;padding:.35rem .6rem;& time{margin-left:auto;color:var(--muted);font-variant-numeric:tabular-nums}}.review-state{display:inline-flex;align-items:center;gap:.25rem;& svg{width:12px;height:12px}&.is-approved>svg{color:var(--green)}&:is(.is-changes,.is-failed)>svg{color:var(--critical)}&.is-running>svg{color:var(--medium)}&:is(.is-commented,.is-dismissed,.is-requested){color:var(--muted)}}.review-on{color:var(--muted);& a{color:var(--text);text-decoration:none;&:hover{color:var(--accent)}}}.review-path{flex:none;max-width:45%;margin-left:auto;overflow:hidden;color:var(--muted);text-overflow:ellipsis;white-space:nowrap}.review-severity{flex:none;padding:0 .35rem;border-radius:999px;background:var(--low);color:#fff;font-size:.68rem;font-weight:600;line-height:1.5;&.is-p0{background:var(--critical)}&.is-p1{background:var(--high)}&.is-p2{background:var(--medium);color:#000}}.repo-item-lockfiles+.repo-item-lockfiles{margin-top:.6rem}.repo-item-lockfiles>p{margin:0 0 .3rem;overflow-wrap:anywhere}.repo-item-version{color:var(--muted)}.repo-item-was{flex:0 1000 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted)}span.repo-item-row:hover{background:none}.repo-item-review{display:inline-flex;align-items:center;gap:.2rem;flex:none;font-size:.75rem;font-variant-numeric:tabular-nums;&.is-passed{color:var(--green)}&.is-wanted{color:var(--medium)}&.is-failed{color:var(--critical)}& svg{width:12px;height:12px}}.repo-item-failed{margin-bottom:.6rem;>p{margin:0 0 .3rem;color:var(--critical)}}.repo-item-unreviewed{margin-top:.6rem;& summary{color:var(--medium);cursor:default}& ul{margin-top:.3rem}}.repo-item-tag{flex:none;padding:0 .4rem;border:1px solid var(--border);border-radius:999px;color:var(--muted);font-size:.72rem;line-height:1.5}.repo-item-description{padding-top:.75rem;border-top:1px solid var(--border);white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6}.repo-item-quiet{color:var(--muted)}.nwd-actions{margin:0;padding:.6rem 1rem}.nwd-actions a{border:1px solid var(--border);border-radius:var(--ui-radius, 5px);padding:.35rem .9rem;color:var(--text);font-size:.8rem;text-decoration:none;&:hover{border-color:var(--accent);color:var(--accent)}&.primary{background:var(--accent);border-color:var(--accent);color:var(--surface);&:hover{color:var(--surface);filter:brightness(1.08)}}&:focus-visible{outline:2px solid var(--accent);outline-offset:2px}}a,button{cursor:default}:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.repo-item-body:focus{outline:none}
28
+ `,li=`.app-user{display:inline-flex;align-items:center;gap:.3em;min-width:0;max-width:100%;vertical-align:bottom}.app-user-avatar,.commit-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;flex:none;width:1.6em;height:1.6em;overflow:hidden;border-radius:50%;background:var(--surface-active);color:var(--muted);font-size:.7em;font-weight:600;line-height:1;& img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}}.app-user-mark{display:inline-flex;flex:none;width:1.15em;height:1.15em;& svg{flex:none;width:100%;height:100%;fill:currentcolor;stroke:none}& img{width:100%;height:100%;border-radius:3px;object-fit:cover}&.is-claude{color:var(--claude, #d97757)}&:is(.is-codex,.is-copilot){color:var(--text)}}.app-user-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.commit-avatars{display:inline-flex;flex:none;isolation:isolate}.commit-avatar{box-shadow:0 0 0 1.5px var(--bg);+.commit-avatar{margin-left:-.45em}&:nth-child(1){z-index:4}&:nth-child(2){z-index:3}&:nth-child(3){z-index:2}& svg{flex:none;width:62%;height:62%;fill:currentcolor;stroke:none}&.is-claude{background:#d97757;color:#fff}&.is-codex{background:#fff;color:#000}&.is-copilot{background:#0d1117;color:#fff}&:is(.is-codex,.is-copilot){box-shadow:0 0 0 1.5px var(--bg),inset 0 0 0 1px var(--border)}}
29
+ `,ui={open:[`open`,`Open`],merged:[`merged`,`Merged`],closed:[`closed`,`Closed`],branch:[`draft`,`A branch alone`]},X=e=>e==null?``:new Date(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`}),Z=(e,t)=>`${e.toLocaleString(`en-US`)} ${t}${e===1?``:`s`}`,di=(e,t,n=!1)=>e?L`<a class="${n?`primary`:``}" href="${e}" target="_blank" rel="noopener noreferrer">${t}</a>`:R,fi=e=>e.map((e,t)=>L`${t>0?`, `:``}<code>${e}</code>`),pi=e=>e>0?L`<p class="repo-item-quiet">and ${e.toLocaleString(`en-US`)} more</p>`:R,mi={mirror:`mirror`,git:`git`,tarball:`tarball`,file:`file`},hi={"lockfile-unreadable":`A lockfile here couldn’t be read`,"lockfile-unsupported":`Bun’s lockfile here isn’t read`,"github-not-found":`GitHub has none of a lockfile here at a commit compared`},gi=6e4,Q=new Map,_i=(e,t)=>`${D.managedSession?.id}\0${D.managedSession?.role}\0${e}\0${t}`,vi=class extends x{static styles=[...x.styles,I(on),I(e),I(t),I(li),I(ci)];static properties={repository:{attribute:!1},target:{attribute:!1},_trail:{state:!0},_items:{state:!0}};constructor(){super(),this._trail=[],this._items=new Map,this._controller=new AbortController}connectedCallback(){super.connectedCallback(),this._unsubscribe=bt(e=>{(!e||e.repoId===this.repository?.repoId&&e.number===this._trail.at(-1)?.number)&&this.requestUpdate()}),this._unobserve=O(e=>{u(),e||this.requestUpdate()}),this._trail.length===0&&this.target&&this.open(this.target)}disconnectedCallback(){this._controller.abort(),this._unsubscribe?.(),this._unobserve?.(),super.disconnectedCallback()}focusInitial(){this.renderRoot.querySelector(`.repo-item-body`)?.focus()}open(e){if(this._trail=[...this._trail,e],e.number==null||this._items.has(e.number))return;let t=e.number,{repoId:n}=this.repository,r=Q.get(_i(n,t));r&&Date.now()-r.at<gi?this._items=new Map(this._items).set(t,{status:`ready`,item:r.item}):(this._items=new Map(this._items).set(t,{status:`loading`}),vt(n,t,{signal:this._controller.signal}).then(e=>{c(n,[e],s(e));for(let[e,{at:t}]of Q)Date.now()-t>=gi&&Q.delete(e);return Q.set(_i(n,t),{item:e,at:Date.now()}),{status:`ready`,item:e}},e=>e?.name===`AbortError`?null:{status:`error`,error:e?.message||`It could not be read.`}).then(e=>(e&&(this._items=new Map(this._items).set(t,e)),null)))}back(){this._trail=this._trail.slice(0,-1)}render(){let e=this._trail.at(-1);if(!e)return R;let[t,n,r]=e.session?this.renderSession(e.session):this.renderItem(e);return L`<dialog aria-labelledby="repo-item-title" @close="${this._onClose}" @click="${this._onBackdrop}"><header>${this._trail.length>1?L`<button type="button" class="back" aria-label="Back" @click="${()=>this.back()}">←</button>`:R}<h3 id="repo-item-title">${t}</h3><button type="button" aria-label="Close" @click="${this._onClose}">×</button></header><div class="repo-item-body" tabindex="-1">${n}</div><div class="nwd-actions"><span class="nwd-spacer"></span>${r}</div></dialog>`}renderItem({number:e,preview:t}){let n=this._items.get(e),r=l(this.repository.repoId,e)?.item,i=r?{...t,...n?.item,...r}:n?.item??t??null,a=i?.kind??`issues`,s=this.repository.repo,c=s?`https://github.com/${s}/${a===`pulls`?`pull`:`issues`}/${e}`:null,[u,d]=i?Te(a,i):[`open`,``],f=L`${i?L`<span class="${`repo-item-state is-${u}`}" role="img" aria-label="${d}">${pe[a][u]}</span>`:R} <span>${i?.title||`(no title)`} <span class="repo-item-number">#${e}</span></span>`,p=n?.status===`ready`?n.item:null,m=a===`pulls`,h=([e,t],n)=>L`<span class="${`repo-item-mark is-${n}`}">${t}${e}</span>`;return[f,L`<p class="repo-item-meta">${i?L`<span class="${`repo-item-badge is-${u}`}">${d}</span>`:R} ${i?.author?L`<span><strong>${k(i.author)}</strong> opened ${X(i.createdAt)}</span>`:i?.createdAt?L`<span>Opened ${X(i.createdAt)}</span>`:R} ${i?.state===`merged`?L`<span>merged${p?.mergedBy?L` by <strong>${k(p.mergedBy)}</strong>`:R} ${X(i.mergedAt??i.closedAt)}</span>`:i?.closedAt&&i.state!==`open`?L`<span>closed ${X(i.closedAt)}</span>`:R} ${i?.comments>0?L`<span class="repo-item-mark">${me}${Z(i.comments,`comment`)}</span>`:R}</p>${i?.labels?.length>0?L`<p class="repo-item-labels">${i.labels.map(e=>L`<span class="repo-item-label" style="${N(e.color?{"--label":`#${e.color}`}:{})}">${e.name}</span>`)}${i.moreLabels>0?L`<span class="repo-item-label">+${i.moreLabels}</span>`:R}</p>`:R} ${m&&i?.head?L`<p class="repo-item-meta"><span><code>${i.head}</code>${i.base?L` → <code>${i.base}</code>`:R}</span> <span><span class="is-added">+${i.additions.toLocaleString(`en-US`)}</span> <span class="is-deleted">−${i.deletions.toLocaleString(`en-US`)}</span></span> ${p?L`<span>${Z(p.commits,`commit`)}</span><span>${Z(p.files,`file`)} changed</span>`:R} ${ve[i.review]&&i.state===`open`?h(ve[i.review],i.review):R} ${y[i.checks]?h(y[i.checks],i.checks):R}</p>`:R} ${m&&p?o(p.reviews,s):R} ${p?this.renderLinked(m?`Closes`:`Closed by`,m?`issues`:`pulls`,m?p.closes:p.closedBy,p.moreLinked):R} ${m&&Ct(i)?this.renderDependencies(e,i.state===`open`):R} ${p?L`<div class="repo-item-description">${p.body?ge(Ut(p.body)):L`<p class="repo-item-quiet">No description.</p>`}</div>${p.bodyShortened?L`<p class="repo-item-quiet">Shortened here; the rest of it is on GitHub.</p>`:R}`:n?.status===`error`?L`<p class="repo-item-quiet" role="alert">${n.error}</p>`:L`<p class="repo-item-quiet" role="status">Reading it…</p>`}`,di(c,`Open on GitHub`,!0)]}renderDependencies(e,t){let n=Nt(this.repository.repoId,e,t);if(n.status===`ready`&&n.lockfiles.length===0&&!n.cut)return R;let r=n.status===`loading`?L`<p class="repo-item-quiet" role="status">Reading its lockfiles…</p>`:n.status===`error`?L`<p class="repo-item-quiet" role="alert">${n.error}</p>`:this.renderAdded(n);return L`<section class="repo-item-section"><h4 class="repo-item-deps-heading">New dependency versions${n.formatted?L`<dependency-review-copy .text="${n.formatted}" .label="${`Copy your dependency reviews`}"></dependency-review-copy>`:R}</h4>${r}</section>`}renderAdded(e){let{lockfiles:t,cut:n,review:r}=e,i=t.filter(e=>e.error||e.added.length>0),a=r?le(e):null;return L`${r?L`${this.renderReviewTerms(r)}${this.renderFailures(de(e),r)}`:R} ${i.length===0&&t.length>0?L`<p class="repo-item-quiet">None: every version its lockfiles lock, they locked before.</p>`:R} ${i.map(t=>L`<div class="repo-item-lockfiles"><p>${fi(t.paths)}</p>${kt(t)?L`<p class="repo-item-quiet" role="status">Stasis is still working out what its entries reach, which can take a few minutes. It is asked again as it does.</p>`:t.error===`stasis-failed`?L`<p class="repo-item-quiet" role="alert">Stasis couldn’t work out what its entries reach (${t.detail??`build-failed`}).</p>`:t.error?L`<p class="repo-item-quiet" role="alert">${hi[t.error]??`These lockfiles couldn’t be read`}${t.detail?`: ${t.detail}`:`.`}</p>`:L`<ul>${t.added.toSorted((e,t)=>+!!e.was-!!t.was).map(t=>L`<li>${this.renderPackage(t,r,!1,e.head)}</li>`)}</ul>${pi(t.more)}`}</div>`)} ${a?.count>0?L`<details class="repo-item-unreviewed"><summary>${a.count.toLocaleString(`en-US`)} on the base branch</summary><ul>${a.versions.map(t=>L`<li>${this.renderPackage(t,r,!0,e.head)}</li>`)}</ul>${pi(a.count-a.versions.length)}</details>`:R} ${n?L`<p class="repo-item-quiet">It changes more files, or lockfiles in more directories, than are read; those past them aren’t told.</p>`:R}`}renderReviewTerms({unasked:e,baselineError:t,baselineUnread:n=[],commentReviews:r,commentsFailed:i,byComments:a,lockfiles:o}){let s=n.slice(0,5);return L`${t?L`<p class="repo-item-quiet" role="alert">The versions its lockfiles locked at that commit couldn’t be read (${t}), so every version wants its reviews.</p>`:R} ${s.length>0?L`<p class="repo-item-quiet" role="alert">At that commit, ${fi(s)}${n.length>s.length?` and ${(n.length-s.length).toLocaleString(`en-US`)} more`:``} couldn’t be read, so the versions ${n.length===1?`it`:`they`} locked want reviews.</p>`:R} ${e?L`<p class="repo-item-quiet" role="alert">The server’s reviewed dependencies didn’t answer for ${Z(e,`version`)}, so ${e===1?`it wants`:`they want`} reviews.</p>`:R} ${r&&!a?L`<p class="repo-item-quiet">Reviews in its comments by ${Z(r,`reviewer`)} count too while it is open.</p>`:R} ${i?L`<p class="repo-item-quiet" role="alert">Its comments couldn’t be read for reviews, so none of theirs count.</p>`:R} ${o?L`<p class="repo-item-quiet">${o.mode===`include`?`Only these lockfiles are reviewed: `:`These lockfiles aren’t reviewed: `}${o.paths.length===0?`none`:fi(o.paths)}.</p>`:R}`}renderFailures(e,t){if(!e)return R;let{versions:n,count:r,unread:i,unchecked:a,cut:o}=e;return L`<div class="repo-item-failed" role="alert">${r>0?L`<p>Its review fails: ${Z(r,`version`)} its lockfiles lock can’t be reviewed, as only npm’s registry’s, locked with an integrity, are.</p><ul>${n.map(e=>L`<li>${this.renderPackage(e,t,!0)}</li>`)}</ul>${pi(r-n.length)}`:R} ${i.length>0||a>0||o?L`<p>Its review fails: not every lockfile it changes was read${a>0?`, and they lock ${Z(a,`version`)} past those checked`:``}.</p>`:R}</div>`}renderPackage(e,t=null,n=!1,r=null){let{name:i,version:a,source:o,from:s,dev:c,was:l}=e,u=(o===`registry`||o===`mirror`)&&a,d=n?null:Zt(e,t),f=d?.name===i&&d.version!==a?d.version:void 0,p=e.patch?.path&&r?{hash:e.patch.hash,repoId:this.repository.repoId,commit:r,path:e.patch.path}:null,m=u&&(!e.patch||p)&&t?.canReview&&_(e,t)!==`unsupported`?P({view:`npm`,packageName:i,packageSpec:a,bundleTab:`review`,...d?{reviewPackage:d.name,reviewSpec:d.version}:{},...p?{patch:p}:{}}):null,h=u?m||f&&P({view:`npm`,packageName:i,packageSpec:a,bundleTab:`compare`,compareSpec:f})||P({view:`npm`,packageName:i,packageSpec:a}):null,g=L`${Se}<span class="repo-item-title">${i}${a?L`<span class="repo-item-version">@${a}</span>`:R}</span> ${!n&&l?L`<span class="repo-item-was" data-tooltip-truncated data-tooltip="${`Was ${l.join(`, `)}`}">from ${l.join(`, `)}</span>`:R} ${this.renderReview(e,t)} ${o===`registry`&&a&&(!e.patch||p)&&_(e,t)===`wanted`?L`<npm-delta .name="${i}" .version="${a}" .base="${d?.version??`(empty)`}" .baseName="${d?.name??i}" .patch="${p}"></npm-delta>`:R} ${c?L`<span class="repo-item-tag" data-tooltip="Only devDependencies need it">dev</span>`:R} ${e.patch?L`<span class="repo-item-tag" data-tooltip="${e.patch.path?`pnpm patches it as it installs it, by ${e.patch.path}, which its reviews are of`:`pnpm patches it as it installs it, by a patch whose file isn’t known, which reviews here can’t read`}">patched</span>`:R} ${mi[o]?L`<span class="repo-item-tag" data-tooltip="${s??R}">${mi[o]}</span>`:R}`;return h?L`<a class="repo-item-row" href="${h}" target="_blank" rel="noopener noreferrer">${g}</a>`:L`<span class="repo-item-row">${g}</span>`}renderReview(e,t){let n=_(e,t);if(n===`unsupported`)return L`<span class="repo-item-review is-failed" data-tooltip="${Et[e.unsupported]}">can’t review</span>`;if(e.reviewed&&n===`passed`)return L`<span class="repo-item-review is-passed" data-tooltip="The server’s reviewed dependencies pass it">${y.success[1]}reviewed</span>`;if(e.rejected)return L`<span class="repo-item-review is-failed" data-tooltip="A reviewer rejects it: it wants their newer accepting review">rejected</span>`;if(n===`baseline`)return L`<span class="repo-item-tag" data-tooltip="Locked at the commit reviews are counted since: it needs none">baseline</span>`;if(!n)return R;let r=`${Z(e.reviews,`full, accepting review`)} of ${t.required} required`;return L`<span class="${`repo-item-review is-${n}`}" data-tooltip="${r}">${n===`passed`?y.success[1]:R}${e.reviews}/${t.required}</span>`}renderLinked(e,t,n,r=0){return!n?.length&&!r?R:L`<section class="repo-item-section"><h4>${e}</h4>${n?.length?L`<ul>${n.map(e=>{let n={...e,kind:t,labels:[],comments:0},[r,i]=Te(t,n);return L`<li><button type="button" class="repo-item-row" @click="${()=>this.open({number:e.number,preview:n})}"><span class="${`repo-item-state is-${r}`}" role="img" aria-label="${i}">${pe[t][r]}</span> <span class="repo-item-number">#${e.number}</span><span class="repo-item-title">${e.title||`(no title)`}</span></button></li>`})}</ul>`:R}${r>0?L`<p class="repo-item-quiet">${n?.length?`and `:``}${r.toLocaleString(`en-US`)} more, on GitHub</p>`:R}</section>`}renderSession(e){let t=this.repository.repo,[n,r]=ui[e.state]??ui.branch,i=e.pulls.length+e.commits.length,a=L`<span class="repo-item-agents">${e.agents.map(e=>L`<span class="${`agent-mark is-${e}`}" role="img" aria-label="${Oe(e)}">${ke(e)}</span>`)}</span><span>${e.title||`(no title)`}</span>`,o=Ae(e);return[a,L`<p class="repo-item-meta"><span class="${`repo-item-badge is-${n}`}">${r}</span> ${e.authors.length>0?L`<span><strong>${Bt(e.authors).map((e,t)=>L`${t>0?`, `:``}${k(e)}`)}</strong></span>`:R} ${e.startedAt==null?R:L`<span>${X(e.startedAt)}${e.updatedAt!=null&&X(e.updatedAt)!==X(e.startedAt)?` \u2013 ${X(e.updatedAt)}`:``}</span>`} <span>${i>0?Z(i,`task`):`no pull request`}</span> ${e.additions||e.deletions?L`<span><span class="is-added">+${e.additions.toLocaleString(`en-US`)}</span> <span class="is-deleted">−${e.deletions.toLocaleString(`en-US`)}</span></span>`:R}</p>${this.renderLinked(`Pull requests`,`pulls`,e.pulls)} ${e.commits.length>0?L`<section class="repo-item-section"><h4>Commits to the default branch</h4><ul>${e.commits.map(e=>L`<li><a class="repo-item-row" href="${t?`https://github.com/${t}/commit/${e.oid}`:R}" target="_blank" rel="noopener noreferrer"><code>${e.oid.slice(0,7)}</code><span class="repo-item-title">${e.title||`(no message)`}</span></a></li>`)}</ul></section>`:R} ${this.renderLinked(`Issues`,`issues`,e.issues.map(e=>({...e,reason:null})))} ${e.branches.length>0?L`<section class="repo-item-section"><h4>${e.branches.length===1?`Branch`:`Branches`}</h4><ul>${e.branches.map(e=>L`<li><a class="repo-item-row" href="${t?Me(t,e):R}" target="_blank" rel="noopener noreferrer"><code>${e}</code></a></li>`)}</ul></section>`:R}`,L`${di(o,e.sessions[0]?`Open in Claude Code`:`Open the Codex task`)}${di(je(e,t),`Open on GitHub`,!0)}`]}};customElements.define(`repository-item-dialog`,vi);function yi(e){return S(`repository-item-dialog`,e)}var bi=`dialog{width:min(94vw,880px);max-width:880px}.conflicts-list{list-style:none;display:flex;flex-direction:column;gap:.6rem;max-height:65vh;overflow-y:auto;overscroll-behavior:contain}.conflict-card{padding:.6rem .7rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px)}.finding-meta{display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;color:var(--muted);font-size:.72rem}.location,code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow-wrap:anywhere}.location{flex:1}h4{margin:.4rem 0 .55rem;font-size:.88rem;font-weight:600;overflow-wrap:anywhere}dt{margin-top:.5rem;color:var(--muted);font-size:.72rem}.variant{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,15rem);gap:.65rem;padding:.4rem 0;font-size:.8rem;+&{border-top:1px solid var(--border)}}.value{white-space:pre-wrap;overflow-wrap:anywhere}.reports{display:flex;flex-wrap:wrap;place-content:start flex-end;gap:.3rem}.report-button{display:inline-flex;align-items:center;gap:.4rem;max-width:100%;min-height:22px;padding:0 .4rem 0 0;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden;background:var(--bg);color:var(--text);font:inherit;font-size:.72rem;cursor:default;text-align:left;>span:last-child{min-width:0;overflow-wrap:anywhere}&:hover{border-color:var(--accent)}}
30
+ `,xi={revalidate:`Outcome`,revalidateVerdict:`Explanation`,revalidateRecommendation:`Recommendation`},Si=class extends x{static styles=[...x.styles,I(w),I(xe),I(bi)];render(){return L`<dialog aria-labelledby="revalidation-conflicts-title" @close="${this._onClose}"><header><h3 id="revalidation-conflicts-title">Revalidation conflicts</h3><p class="nwd-intro">Reports disagree about ${this.conflicts.length} finding${this.conflicts.length===1?``:`s`}. App view is unavailable until the conflicting reports are separated or updated.</p></header><ul class="conflicts-list">${this.conflicts.map(({finding:e,copies:t})=>L`<li class="conflict-card"><div class="finding-meta">${Ne(e.severity)} ${e.file?L`<span class="location">${e.file}${j(e.line)?`:${Wt(j(e.line))}`:``}</span>`:R} <code>${Kt(e.id)??e.id}</code></div><h4>${F(e)}</h4><dl>${ce(t).map(({field:t,variants:n})=>L`<dt>${xi[t]??t}</dt>${n.map(({value:t,reports:n})=>L`<dd class="variant"><div class="value">${t||L`<em>Empty</em>`}</div><div class="reports">${n.map(t=>t?L`<button type="button" class="report-button" aria-label="${`Open ${Rt(t)} at this finding`}" @click="${()=>this._finish({id:e.id,reportName:t})}">${M(Lt[ye(t)]??Lt.default)}<span>${Rt(t)}</span></button>`:L`<span>Loaded report</span>`)}</div></dd>`)}`)}</dl></li>`)}</ul><footer class="nwd-actions"><span class="nwd-spacer"></span><button type="button" @click="${this._onClose}">Close</button></footer></dialog>`}};customElements.define(`revalidation-conflicts-dialog`,Si);function Ci(e){return S(`revalidation-conflicts-dialog`,{conflicts:[...e.values()]})}var wi=`.spd-list{margin:0 0 .8rem 1.15rem;color:var(--muted);font-size:.82rem;line-height:1.5;& li{margin:.3rem 0}& strong{color:var(--text);font-weight:600}}.spd-denied{color:light-dark(#b25b00,#f0a060);font-size:.78rem}code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.92em}
31
+ `,Ti=class extends x{static styles=[...x.styles,I(wi)];static properties={_retryDenied:{state:!0}};constructor(){super(),this._retryDenied=!1}_onRetry=async()=>{await De()?this._finish(`granted`):this._retryDenied=!0};_chromiumBody(){let e=location.hostname===`localhost`?L` Plain <code>localhost</code> can never qualify — for local testing open the app via <code>127.0.0.1</code> instead.`:R;return L`<p class="nwd-intro">Chromium-based browsers (Chrome, Edge, Brave, …) never show a prompt — persistence is granted silently, and only to sites the browser considers important. Any of these qualifies it:</p><ul class="spd-list"><li><strong>Install the app</strong> — the install icon at the right end of the address bar, or the browser menu's Install entry.</li><li><strong>Bookmark</strong> this page.</li><li>Keep using the site — regular visits raise its engagement score.</li></ul><p class="nwd-note ui-hint">The browser re-evaluates on every request, so after any of the above press <strong>Try again</strong>.${e}</p>`}_firefoxBody(){return L`<p class="nwd-intro">Firefox asks with a permission prompt. A dismissed or blocked prompt is remembered, and the site can't re-ask until the old answer is cleared:</p><ol class="spd-list"><li>Click the permissions icon next to the address bar.</li><li>Clear the <strong>Store Data in Persistent Storage</strong> entry if it's blocked.</li><li>Press <strong>Try again</strong> below and choose <strong>Allow</strong>.</li></ol>`}_webkitBody(){return L`<p class="nwd-intro">Safari — and every iOS browser — additionally deletes a site's storage after <strong>7 days</strong> of browser use without interacting with the site, and no permission exempts a normal tab. Installing the app is what does:</p><ul class="spd-list"><li>On iPhone / iPad: open the <strong>Share</strong> menu, choose <strong>Add to Home Screen</strong>, and use the app from that icon.</li><li>In Safari on macOS: choose <strong>File → Add to Dock…</strong> and use the app from the Dock.</li><li>Installed web apps are exempt from the 7-day cleanup. Otherwise, use the site at least once a week.</li></ul>`}render(){let e=we(),t=e===`webkit`?this._webkitBody():e===`firefox`?this._firefoxBody():this._chromiumBody();return L`<dialog @close="${this._onClose}"><header><h3>Protect stored data</h3></header><p class="nwd-intro">Reports, bundles and triage live in the browser's <strong>best-effort storage</strong> — the browser is allowed to delete all of it at once under disk pressure or after long inactivity, without asking. The persistent-storage request that would prevent this was just declined.</p>${t}<footer class="nwd-actions">${this._retryDenied?L`<span class="spd-denied" role="status">Still not granted.</span>`:R} <span class="nwd-spacer"></span> ${e===`webkit`?R:L`<button type="button" @click="${this._onRetry}">Try again</button>`} <button type="button" class="primary" @click="${this._onClose}">Got it</button></footer></dialog>`}};customElements.define(`storage-persist-dialog`,Ti);function Ei(){return S(`storage-persist-dialog`,{},{conflict:()=>null})}var Di=`.ssd-close{position:absolute;top:6px;right:6px;z-index:1}header{padding-right:1.5rem}.lwd-list{margin:.5rem 0 0}
32
+ `,Oi=10,ki=class extends x{static styles=[...x.styles,I(A),I(z),I(Di)];_onClose=()=>this._finish({shown:!0,sync:!1});_onSync=()=>this._finish({shown:!0,sync:!0});_list(){if(this.names.length<2)return R;let e=this.names.slice(0,Oi),t=this.names.length-e.length;return L`<ul class="lwd-list">${e.map(e=>L`<li><strong>${e}</strong></li>`)} ${t>0?L`<li>and ${t} more</li>`:R}</ul>`}render(){let e=this.names.length===1,t=e?L`Your copy of <strong>"${this.names[0]}"</strong> no longer matches its cloud copy, so other members may be seeing a different version.`:L`<strong>${this.names.length}</strong> reports no longer match their cloud copies, so other members may be seeing different versions.`;return L`<dialog @close="${this._onClose}"><button type="button" class="detail-action ssd-close" data-role="close" aria-label="Close" @click="${this._onClose}">×</button><header><h3>Reports out of sync</h3></header><p class="lwd-body">${t}</p>${this._list()}<p class="nwd-note ui-hint">Sync compares ${e?`it`:`each one`} with the cloud. Where it's clear which copy is newer, the other is updated; otherwise you choose which to keep.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="dismiss" @click="${this._onClose}">Not now</button> <button type="button" class="primary" data-role="sync" @click="${this._onSync}">Sync</button></footer></dialog>`}};customElements.define(`sync-suggest-dialog`,ki);function Ai({names:e}={}){return S(`sync-suggest-dialog`,{names:Array.isArray(e)?[...e]:[]},{exclusive:!0,conflict:()=>({shown:!1,sync:!1})})}var ji=class extends Lr{static copy={verb:`Upload`,heading:`Upload to remote`,key:`uploaded`,one:e=>L`Upload <strong>"${e}"</strong> to the workspace's remote inventory?`,many:(e,t)=>L`Upload <strong>${e}</strong> local ${t} to the workspace's remote inventory?`,note:L`<p class="nwd-note ui-hint">End-to-end encrypted with the workspace key — only workspace members can decrypt the uploaded content.</p>`};async transfer({kind:e,identifier:t}){let n=e===`bundle`?await lt(this.workspaceId,t):await ot(this.workspaceId,t,await At(t));return n.ok?void 0:n.reason??`unknown`}};customElements.define(`sync-upload-dialog`,ji);function Mi(e){return Rr(`sync-upload-dialog`,e)}var Ni=`dialog{width:min(94vw,68rem);max-width:68rem;max-height:calc(100dvh - 7rem);display:flex;flex-direction:column}dialog:not([open]){display:none}.comparison-results{overflow:auto;min-height:0}.difference-counts{display:flex;flex-wrap:wrap;gap:.5rem 1rem;margin:.8rem 0;font-size:.8rem}.difference-counts span{border-inline-start:3px solid var(--difference);padding-inline-start:.5rem}.managed-only{--difference: var(--marker-blue)}.local-only{--difference: var(--marker-green)}.mismatch{--difference: var(--high)}.finding{margin:.8rem 0 1.3rem}h4{font-size:.9rem;font-weight:600;overflow-wrap:anywhere}.location,.finding-id{margin-top:.3rem;color:var(--muted);font-size:.75rem;overflow-wrap:anywhere}.table-scroll{margin-top:.6rem;overflow-x:auto}table{width:100%;min-width:32rem;border-collapse:collapse;table-layout:fixed;font-size:.8rem}th,td{padding:.6rem .7rem;text-align:left;vertical-align:top;border:1px solid var(--border);overflow-wrap:anywhere}thead th{color:var(--muted);font-weight:500}th:first-child{width:8rem}tbody th{font-weight:500}td{white-space:pre-wrap}.difference-kind{display:block;margin-top:.3rem;color:var(--difference);font-size:.72rem}.highlight{background:rgb(from var(--difference) r g b / .08)}.unset{color:var(--muted);font-style:normal}.comment+.comment{margin-top:.6rem}.comment.changed{border-inline-start:3px solid var(--difference);padding-inline-start:.5rem}.skipped{color:var(--high);margin:.75rem 0;font-size:.8rem}.skipped ul{padding:.6rem 0 .6rem 1.2rem;overflow-wrap:anywhere}.empty{margin:1rem 0;color:var(--muted);font-size:.85rem}
33
+ `,Pi={triage:`Triage state`,color:`Color`,fix:`Fix`,flagged:`Flag`,comment:`Comments`,ignoredReports:`Per-report ignores`},Fi={"managed-only":`Only managed`,"local-only":`Only local`,mismatch:`Different`},Ii={inprogress:`In progress`,fixed:`Fixed`,invalid:`Invalid`,deleted:`Deleted`,ignored:`Ignored`};function Li(e,t){return t===void 0||Array.isArray(t)&&t.length===0?L`<em class="unset">Not set</em>`:e===`comment`?t.map(e=>L`<div class="${`comment${e.different?` changed`:``}`}">${e.text}</div>`):e===`ignoredReports`?L`${t.join(`
34
+ `)}`:e===`flagged`?t?`Flagged`:`Not flagged`:e===`triage`?Ii[t]??t:t}var Ri=class extends B{static styles=[...B.styles,I(Ni)];static properties={comparison:{attribute:!1}};constructor(){super(),this.comparison={matched:0,localFindings:0,findings:[],skipped:[]}}render(){let{matched:e,localFindings:t,findings:n,skipped:r}=this.comparison,i={"managed-only":0,"local-only":0,mismatch:0};for(let e of n)for(let t of e.differences)i[t.kind]++;return L`<dialog aria-labelledby="compare-triage-title" @close="${this._onClose}"><header><h3 id="compare-triage-title">Compare triage</h3><p class="lwd-body">${e} shared ${e===1?`finding`:`findings`} compared · ${n.length} with differences</p><p class="lwd-note">Local reports and managed reports are matched by finding ID. This comparison does not change either side. Comments are compared by text; per-report ignores only exist locally.</p>${n.length>0?L`<div class="difference-counts">Field differences: ${Object.entries(Fi).map(([e,t])=>L`<span class="${e}">${t}: ${i[e]}</span>`)}</div>`:R}</header><div class="comparison-results">${r.length>0?L`<details class="skipped"><summary>${r.length} local ${r.length===1?`report could`:`reports could`} not be read; comparison is incomplete.</summary><ul>${r.map(e=>L`<li>${e.name}: ${e.reason}</li>`)}</ul></details>`:R} ${n.map(({id:e,finding:t,differences:n})=>L`<section class="finding"><h4>${t.title||t.description?.split(`
35
+ `)[0]||e}</h4>${t.file?L`<p class="location">${t.file}${t.line?`:${t.line}`:``}</p>`:R}<p class="finding-id"><code>${e}</code> · ${t.reports.join(`, `)}</p><div class="table-scroll"><table><thead><tr><th scope="col">Field</th><th scope="col">Local</th><th scope="col">Managed</th></tr></thead><tbody>${n.map(e=>L`<tr class="${e.kind}"><th scope="row">${Pi[e.property]}<span class="difference-kind">${Fi[e.kind]}</span></th><td class="${e.kind===`managed-only`?``:`highlight`}">${Li(e.property,e.local)}</td><td class="${e.kind===`local-only`?``:`highlight`}">${Li(e.property,e.managed)}</td></tr>`)}</tbody></table></div></section>`)} ${n.length===0?L`<p class="empty">${e>0?`No triage differences in the shared findings.`:t===0?`No findings were found in the readable local reports.`:`No findings are present in both local and managed reports.`}</p>`:R}</div><footer class="nwd-actions"><span class="nwd-spacer"></span><button type="button" data-role="cancel" @click="${this._onCancel}">Close</button></footer></dialog>`}};customElements.define(`triage-comparison-dialog`,Ri);var zi=e=>S(`triage-comparison-dialog`,e),Bi=`dialog{max-width:560px;width:min(94vw,560px)}header h3{margin:0 0 .25rem}header p{margin:0 0 .9rem;color:var(--muted);font-size:.82rem}hr{border:0;border-top:1px solid var(--border);margin:.9rem 0}.section h4{margin:0 0 .25rem;font-size:.82rem;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}.section p{margin:0 0 .55rem;color:var(--muted);font-size:.78rem}.section button,.actions button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:var(--ui-radius, 5px);font:inherit;&:hover{border-color:var(--accent);color:var(--accent)}}.section button{padding:.35rem .9rem;font-size:.8rem;&.primary{background:var(--accent);color:var(--surface);border-color:var(--accent)}&.primary:hover{filter:brightness(1.08)}&:disabled{opacity:.5}}input[type=file]{display:block;color:var(--text);font:inherit;font-size:.78rem;margin-bottom:.5rem}.error,.status.status-err{border:1px solid var(--critical);background:rgb(from var(--critical) r g b / .07);color:var(--text)}.error{margin:.5rem 0;padding:.4rem .6rem;border-radius:var(--ui-radius, 5px);font-size:.78rem}.summary{margin:.5rem 0;font-size:.82rem;& strong{color:var(--text)}.meta{margin-left:.4rem;color:var(--muted);font-size:.74rem}}.mode{border:1px solid var(--border);border-radius:var(--ui-radius, 6px);padding:.55rem .7rem;margin:.55rem 0 .7rem;display:flex;flex-direction:column;gap:.35rem}.mode legend{padding:0 .35rem;font-size:.68rem;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.mode label{display:flex;align-items:flex-start;gap:.5rem;font-size:.82rem;& em{color:var(--muted);font-style:normal;font-size:.74rem}}.status{margin:.8rem 0 0;padding:.4rem .6rem;border-radius:5px;font-size:.78rem;&.status-ok{border:1px solid var(--accent);background:rgb(from var(--accent) r g b / .08);color:var(--text)}}.actions{display:flex;justify-content:flex-end;gap:.4rem;margin-top:.8rem;padding-top:.7rem;border-top:1px solid var(--border)}.actions button{padding:.3rem .8rem;font-size:.78rem}
36
+ `,Vi=class extends x{static styles=[...x.styles,I(Bi)];static properties={parsed:{state:!0},parseError:{state:!0},mode:{state:!0},busy:{state:!0},status:{state:!0}};constructor(){super(),this.parsed=null,this.parseError=null,this.mode=`prefer-current`,this.busy=!1,this.status=null}focusInitial(){this.renderRoot.querySelector(`button.primary`)?.focus()}async _onDownload(){this.busy=!0,this.status=null;try{let{blob:e,filename:t}=await Pe();Ee(e,t),this.status={kind:`ok`,text:`Downloaded ${t}`}}catch(e){this.status={kind:`err`,text:`Export failed: ${e.message}`}}finally{this.busy=!1}}async _onFile(e){let t=e.target.files?.[0];if(this.parsed=null,this.parseError=null,this.status=null,t)try{this.parsed=await h(t)}catch(e){this.parseError=e.message}}_onMode(e){this.mode=e.target.value}async _onApply(){if(!(!this.parsed||this.busy||_e())){this.busy=!0,this.status=null;try{let e=await Le(this.parsed,this.mode);Pt(),this.status=e.repoUrlError?{kind:`err`,text:`Applied ${e.triageEntries} triage entries (${this.mode}), but saving repo URLs failed: ${e.repoUrlError.message}`}:{kind:`ok`,text:`Applied ${e.triageEntries} triage entries and ${e.repoUrls} repo URLs (${this.mode}).`},this.parsed=null;let t=this.renderRoot.querySelector(`input[type="file"]`);t&&(t.value=``)}catch(e){this.status={kind:`err`,text:`Import failed: ${e.message}`}}finally{this.busy=!1}}}render(){return L`<dialog @close="${this._onClose}"><header><h3>Triage backup</h3><p>Bundles every triage entry (markers, triage states, comments, fixes, per-report ignores) and all saved repo URLs into a single gzipped JSON file.</p></header><section class="section"><h4>Export</h4><p>Download the current triage + repo-URL set as a portable backup.</p><button type="button" class="primary" @click="${this._onDownload}" ?disabled="${this.busy}">${this.busy?`Working…`:`Download backup`}</button></section>${_e()?R:this._importTemplate()} ${this.status?L`<div class="${`status status-${this.status.kind}`}">${this.status.text}</div>`:R}<footer class="actions"><button type="button" @click="${this._onClose}">Close</button></footer></dialog>`}_importTemplate(){let e=this.parsed,t=(e,t,n)=>L`<label><input type="radio" name="te-mode" value="${e}" .checked="${this.mode===e}" @change="${this._onMode}"> <span>${t} <em>(${n})</em></span></label>`;return L`<hr><section class="section"><h4>Import</h4><p>Pick a previously-exported backup. Nothing is applied until you click Apply.</p><input type="file" accept=".gz,application/gzip" @change="${this._onFile}" ?disabled="${this.busy}"> ${this.parseError?L`<div class="error">Failed to parse: ${this.parseError}</div>`:R} ${e?L`<div class="summary">Found <strong>${Object.keys(e.triage).length}</strong> triage entries and <strong>${Object.keys(e.repoUrls).length}</strong> repo URLs. ${e.exportedAt?L`<span class="meta">Exported ${e.exportedAt}.</span>`:R}</div><fieldset class="mode"><legend>Merge mode</legend>${t(`prefer-current`,`Merge — keep current on conflict`,`safest, only fills gaps`)} ${t(`prefer-imported`,`Merge — prefer imported on conflict`,`overwrites where both have a value`)} ${t(`replace`,`Replace all`,`drops every current persisted entry first — destructive`)}</fieldset><button type="button" class="primary" @click="${this._onApply}" ?disabled="${this.busy}">${this.busy?`Applying…`:`Apply import`}</button>`:R}</section>`}};customElements.define(`triage-export-dialog`,Vi);function Hi(){return S(`triage-export-dialog`)}var Ui=`dialog{width:min(94vw,var(--graph-dialog-width));max-width:80rem;max-height:90dvh;margin:auto;padding:0;overflow:hidden}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:start;justify-content:space-between;gap:1rem;flex-shrink:0;padding:.7rem .9rem;border-bottom:1px solid var(--border)}header h3{display:flex;flex-wrap:wrap;gap:.35rem .7rem;min-width:0;margin:0;font-size:.92rem;overflow-wrap:anywhere}.heading-version{color:var(--accent);font-family:monospace}header button{flex-shrink:0;border:0;background:transparent;color:var(--muted);font-family:inherit;font-size:1.4rem;line-height:1;padding:0 .25rem}header button:hover{color:var(--text)}.graph-caption{display:flex;flex-wrap:wrap;justify-content:space-between;gap:.5rem;padding:.45rem .9rem;font-size:.68rem;color:var(--muted);flex-shrink:0;user-select:none}.graph-scroll{min-height:0;overflow:auto;overscroll-behavior:contain;background:var(--bg);padding:.4rem}.graph{position:relative;margin-inline:auto}.connections{position:absolute;inset:0;overflow:visible;pointer-events:none}.connections>path{fill:none;stroke:var(--connection-color, var(--muted));stroke-width:1.5;opacity:.65}.package-group{position:absolute;cursor:default}.package-group.stacked{background:var(--bg);border-radius:var(--ui-radius, 6px)}.stacked.collapsed{background:linear-gradient(var(--surface),var(--surface)),var(--bg)}.stacked.selected-cycle{background:color-mix(in srgb,var(--accent) 9%,var(--bg))}.stacked:hover,.stacked:focus-within{z-index:1;box-shadow:0 2px 8px #0005}.stacked.dimmed{opacity:1}.stacked.dimmed:after{content:"";position:absolute;inset:0;background:var(--surface);opacity:.8;border-radius:inherit;pointer-events:none}.package{position:absolute;width:var(--package-width);height:var(--package-height);display:flex;flex-direction:column;gap:4px;padding:5px 7px;background:var(--surface);border:1px solid var(--border);border-left:3px solid var(--package-color);border-radius:var(--ui-radius, 6px);font-size:.75rem;overflow:hidden}.package.selected{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 9%,var(--surface))}.name,.location,.version{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.package-main,.package-meta{display:flex;align-items:baseline;gap:.4rem;min-width:0}.name{flex:1;font-weight:600;line-height:17px}.version{max-width:45%;flex-shrink:0;font-family:monospace;font-size:.65rem}.badge{flex-shrink:0;font-size:.6rem;color:var(--muted);user-select:none}.selected-badge{color:var(--accent)}.location{flex:1;color:var(--muted);font-family:monospace;font-size:.61rem;line-height:14px}.cycle{border-radius:var(--ui-radius, 8px);outline:1px solid var(--border);background:color-mix(in srgb,var(--muted) 4%,transparent)}.cycle-label{position:absolute;top:7px;left:14px;color:var(--muted);font-size:.63rem;user-select:none}.cycle-toggle{display:flex;align-items:center;gap:.4rem;padding:0;border:0;background:transparent;font-family:inherit;line-height:16px}.cycle-toggle:hover{color:var(--text)}.cycle-chevron{font-size:.85rem}.cycle-summary{display:flex;gap:.4rem;text-align:left}.cycle-count{color:var(--muted)}.cycle-count:before{content:"\\b7 "}.collapsed .cycle-toggle{inset:0;width:100%;padding:5px 7px;border-radius:inherit;font-size:.75rem}.collapsed .cycle-summary{flex:1;flex-direction:column;gap:2px}.collapsed .cycle-count{font-size:.65rem}.collapsed .cycle-count:before{content:none}.selected-cycle{outline-color:var(--accent);background:color-mix(in srgb,var(--accent) 9%,var(--surface))}.cycle-connections>path{stroke:var(--connection-color);stroke-width:1.25;opacity:.8}.large-cycle .cycle-connections>path{stroke:var(--muted);opacity:.18}.cycle-connections>path.subdued{opacity:.04}.connections>path.traced{stroke:var(--connection-color);stroke-width:1.75;opacity:1}.package-subdued{opacity:.35}.dimmed,.connections>path.dimmed{opacity:.18}.note,.empty{padding:1rem;color:var(--muted);font-size:.78rem;line-height:1.5}.note{position:sticky;left:0;max-width:65rem;margin:auto}button:focus-visible,.graph-scroll:focus-visible,.package:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
37
+ `,Wi=e=>Ht(e.own?`__own__`:e.name),Gi=()=>Math.floor(Math.min(document.documentElement.clientWidth*.94,80*Number.parseFloat(getComputedStyle(document.documentElement).fontSize))),Ki=class extends x{static styles=[...x.styles,I(Ui)];static properties={_active:{state:!0},_current:{state:!0},_hovered:{state:!0},_focused:{state:!0},_error:{state:!0},layout:{state:!0}};constructor(){super(),this._active=null,this._hovered=null,this._focused=null}_expandedCycles=new Set;layoutForViewport(){let e=this.renderRoot?.activeElement;this._hovered=null,this._maxWidth=Gi(),this.layout=ht(this.graph,{maxWidth:this._maxWidth,expandedCycles:this._expandedCycles}),e?.matches(`.package, .cycle-toggle`)&&this.updateComplete.then(()=>{this._current&&e.isConnected&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:`nearest`,inline:`nearest`}))})}toggleCycle(e){this._expandedCycles.has(e)?this._expandedCycles.delete(e):this._expandedCycles.add(e),this._focused=null,this.layoutForViewport()}connectedCallback(){super.connectedCallback(),this.graph=this.load?null:mt(this.details,this),this.graph?this.layoutForViewport():this.load.then(e=>(this.isConnected&&Object.assign(this,{graph:e}).layoutForViewport(),e),e=>{this._error=e.message}),this._dispose=O(()=>{this._current=this.isCurrent(),this._current||queueMicrotask(this._onClose)})}updated(){let e=this._resize?null:this.renderRoot.querySelector(`.graph-scroll`);e&&(this._resize=new ResizeObserver(()=>{Gi()===this._maxWidth?this.renderRoot.activeElement?.matches(`.package, .cycle-toggle`)||(e.scrollLeft=(this.layout.width-e.clientWidth)/2):this.layoutForViewport()}),this._resize.observe(e),this._resize.observe(document.documentElement))}disconnectedCallback(){this._dispose?.(),this._resize?.disconnect(),super.disconnectedCallback()}renderNode({id:e,x:t,y:n},r){let i=this.graph.nodes.get(e),a=[...this.graph.importedBy.get(e)].map(e=>this.graph.nodes.get(e)),o=`${i.version||`Source`}${i.ecosystem&&i.ecosystem!==`npm`?` \xB7 ${i.ecosystem}`:``}`,s=a.length>0?`${this.lockfile?`Depended on by`:`Imported by`} ${a.map(e=>`${e.name}${e.version?`@${e.version}`:``}`).join(`, `)}.`:i.root?`Bundle entry point or app source.`:i.traceBoundary||i.excludedImporters?.size?`Dependency tracing stops here.`:`No importer is recorded in this scope.`;return L`<div class="${`package${i.target?` selected`:``}${r&&!r.has(e)?` package-subdued`:``}`}" tabindex="0" role="group" @pointerenter="${()=>{this._hovered=e}}" @pointerleave="${()=>{this._hovered=null}}" @focus="${()=>{this._focused=e}}" @blur="${()=>{this._focused=null}}" aria-label="${`${i.ecosystem?`${i.ecosystem}:`:``}${i.name}${i.version?`@${i.version}`:``}. ${s} Location: ${e}.`}" style="${N({left:`${t}px`,top:`${n}px`,"--package-color":Wi(i)})}"><div class="package-main"><span class="name" data-tooltip="${i.name}" data-tooltip-truncated>${i.name}</span> <span class="version" data-tooltip="${o}" data-tooltip-truncated>${o}</span></div><div class="package-meta"><span class="location" data-tooltip="${e}" data-tooltip-truncated>${i.own?`App source`:e}</span> ${i.target?L`<span class="badge selected-badge">Selected</span>`:R} ${i.root?L`<span class="badge">${i.own?`App`:`Entry point`}</span>`:R}</div></div>`}renderGraph(){let{boxes:e,edges:t,width:n,height:r}=this.layout,i=this._hovered??this._focused,a=i===null?this._active:this.layout.componentOf.get(i),o=gt(this.layout,a),s=i===null?null:new Set([i,...this.graph.imports.get(i),...this.graph.importedBy.get(i)]),c=new Set(t.map(e=>e.to)),l=e.filter(e=>!c.has(e.id)&&!e.members.some(t=>{let n=this.graph.nodes.get(t);return n.root||n.traceBoundary||[...n.excludedImporters??[]].some(t=>this.layout.componentOf.get(t)!==e.id)}));return L`<div class="graph-scroll" tabindex="0" aria-label="Package dependency chains. Arrows point from importer to dependency."><div class="graph" style="${N({width:`${n}px`,height:`${r}px`,"--package-width":`${st}px`,"--package-height":`${ut}px`})}"><svg class="connections" width="${n}" height="${r}" aria-hidden="true"><defs><marker id="dependency-arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10z" fill="context-stroke"/></marker></defs>${t.map(e=>{let t=e.fromPackage===i||e.toPackage===i,n=o&&!o.edges.has(e)||i!==null&&(e.from===a||e.to===a)&&!t;return an`<path d=${e.path} class=${n?`dimmed`:t?`traced`:``}
38
+ style=${N({"--connection-color":Wi(this.graph.nodes.get(e.fromPackage))})} marker-end="url(#dependency-arrow)"/>`})}</svg> ${e.map(e=>this.renderGroup(e,o,i,s))}</div>${l.length>0?L`<p class="note">Some chains have no recorded app or entry point. These packages are bundled, but their origin is not captured in this scope.</p>`:R}</div>`}renderGroup(e,t,n,r){let i=e.members.some(e=>this.graph.nodes.get(e).target),a=r&&e.members.some(e=>r.has(e));return L`<div class="${`package-group${e.stacked?` stacked`:``}${e.members.length>1?` cycle`:``}${e.members.length>8?` large-cycle`:``}${e.collapsed?` collapsed`:``}${e.collapsed&&i?` selected-cycle`:``}${t&&!t.groups.has(e.id)?` dimmed`:``}`}" style="${N({left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`})}" @pointerenter="${()=>{this._active=e.id}}" @pointerleave="${()=>{this._active=null}}">${e.collapsible?L`<button type="button" class="cycle-label cycle-toggle" aria-expanded="${!e.collapsed}" aria-controls="${`cycle-content-${e.id}`}" @click="${()=>this.toggleCycle(e.id)}"><span class="cycle-chevron" aria-hidden="true">${e.collapsed?`▸`:`▾`}</span> <span class="cycle-summary"><span>Circular imports</span><span class="cycle-count">${e.members.length} packages</span></span> ${e.collapsed&&i?L`<span class="badge selected-badge">Selected</span>`:R}</button>`:e.members.length>1?L`<div class="cycle-label">Circular imports${e.members.length>8?` \xB7 ${e.members.length} packages`:``}</div>`:R}<div id="${`cycle-content-${e.id}`}" ?hidden="${e.collapsed}">${e.internalEdges.length>0?L`<svg class="connections cycle-connections" width="${e.width}" height="${e.height}" aria-hidden="true">${e.internalEdges.map(e=>an`<path d=${e.path}
39
39
  class=${a?e.from===n||e.to===n?`traced`:`subdued`:``}
40
- style=${j({"--connection-color":Q(this.graph.nodes.get(e.from))})} marker-end="url(#dependency-arrow)"/>`)}</svg>`:I} ${Qt(e.packages,e=>e.id,e=>this.renderNode(e,a?r:null))}</div></div>`}render(){if(!this._current)return I;let e=this.packageGroup===void 0?this.packageKey:Yt(this.packageGroup),t=this.version===void 0?`package`:`version`;return F`<dialog aria-labelledby="why-title" style="${j({"--graph-dialog-width":`${Math.max(480,(this.layout?.width??0)+te)}px`})}" @close="${this._onClose}" @click="${this._onBackdrop}"><header><h3 id="why-title">${e}${this.version===void 0?I:F`<span class="heading-version">${this.version}</span>`}</h3><button type="button" aria-label="Close dependency chains" @click="${this._onClose}">×</button></header>${this.graph?F`<div class="graph-caption"><span>${this.graph.nodes.size} ${this.graph.nodes.size===1?`package`:`packages`}${this.graph.targets.length>1?` \xB7 ${this.graph.targets.length} installations${this.version===void 0?``:` of this version`}`:``}${this.scope?` \xB7 Scope: ${Bt(this.scope)}`:``}${this.lockfile?` \xB7 ${this.lockfile}`:``}</span> <span>${this.lockfile?`↓ depends on`:`↓ imports`}</span></div>${this.graph.targets.length>0?this.renderGraph():F`<p class="empty">${this.lockfile?`This lockfile locks no such ${t}.`:`Dependency metadata for this ${t} is not available in this bundle scope.`}</p>`}`:F`<p class="empty">${this._error?`${this.lockfile} couldn\u2019t be read: ${this._error}`:`Reading ${this.lockfile}\u2026`}</p>`}</dialog>`}};customElements.define(`why-dialog`,Ki);function qi(e){return x(`why-dialog`,e)}var Ji=[{id:`workspace`,label:`Export workspace`},{id:`raw`,label:`Raw reports export`}],$=e=>Array.isArray(e)?e.length:0,Yi=class extends T{static styles=[...T.styles,P(g),P(kn)];static properties={_tab:{state:!0},_noPassword:{state:!0},_includeBundleBytes:{state:!0}};static secrets={_password:``,_confirm:``,workspace:null};constructor(){super(),this._tab=`workspace`,this._noPassword=!1,this._includeBundleBytes=!1}_forgetPassword(){this._password=``,this._confirm=``}_selectTab(e){this._busy||this._tab===e||(this._tab=e,this._error=``,e!==`workspace`&&this._forgetPassword())}_onNoPasswordToggle=e=>{this._noPassword=e.target.checked,this._error=``,this._noPassword&&this._forgetPassword()};_onIncludeBundleBytesToggle=e=>{this._includeBundleBytes=e.target.checked,this._error=``};_canExport(){return this._busy?!1:this._tab===`raw`?$(this.workspace?.reports)>0:this._noPassword||this._password.length>0&&this._password===this._confirm}_onExport=()=>{if(!this._canExport())return;if(!this.workspace){this._error=`No workspace selected.`;return}let{workspace:e,_tab:t}=this,n=t===`raw`?()=>Je(e):()=>Ke(e,{password:this._noPassword?void 0:this._password,includeBundleBytes:this._includeBundleBytes});this._attempt(n,({blob:e,filename:n})=>{qe(e,n),this._finish({ok:!0,tab:t})})};_onKeydown=w(this._onExport);_workspacePanel(){let e=this._password&&this._confirm&&this._password!==this._confirm,t=$(this.workspace?.bundles);return F`<p class="nwd-note ui-hint">The export file carries this workspace's reports, triage state, comments, fixes, references to attached bundles (integrities only by default), and its private key. Encrypting the file with a password ensures only those with the password can attach the workspace after download.</p>${this.newPasswordFields(`dv-export-pw`,this._noPassword)} <label class="wsl-optout"><input type="checkbox" .checked="${this._noPassword}" @change="${this._onNoPasswordToggle}"> <span>Export without password (not recommended)</span></label> ${t>0?F`<label class="wsl-optout"><input type="checkbox" .checked="${this._includeBundleBytes}" @change="${this._onIncludeBundleBytesToggle}"> <span>Include bundle bytes (${t} bundle${t===1?``:`s`}; significantly larger file)</span></label>`:I} ${this._noPassword?F`<p class="wsl-error wsl-warning">Anyone who obtains this file can attach the workspace and read every report, triage decision, comment, and fix. Only opt out when you control where the file goes.</p>`:I} ${!this._noPassword&&e?F`<p class="wsl-error" role="alert">Passwords don't match.</p>`:I}`}_rawPanel(){let e=$(this.workspace?.bundles);return F`<div class="wsl-error wsl-warning"><p>This is the raw form of the reports.</p><p>It carries no triage data — no markers, triage states, comments, fixes, or per-report ignores${e>0?F` — and none of this workspace's ${e} attached bundle${e===1?``:`s`}`:I}.</p><p>This file is written unencrypted: anyone who obtains it can read every report in it.</p></div>${$(this.workspace?.reports)===0?F`<p class="wsl-error" role="alert">This workspace has no reports to export.</p>`:I}`}render(){let e=this._tab===`raw`,t=this._busy?`Exporting…`:e?`Download reports`:this._noPassword?`Export without password`:`Export`;return F`<dialog @close="${this._onClose}"><header>${gt({tabs:Ji,current:this._tab,prefix:`wsl`,disabled:this._busy,select:e=>this._selectTab(e)})}</header><div role="tabpanel" id="${`wsl-panel-${this._tab}`}" aria-labelledby="${`wsl-tab-${this._tab}`}">${e?this._rawPanel():this._workspacePanel()}</div>${this._error?F`<p class="wsl-error" role="alert">${this._error}</p>`:I}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="${e||this._noPassword?`primary danger`:`primary`}" ?disabled="${!this._canExport()}" @click="${this._onExport}">${t}</button></footer></dialog>`}};customElements.define(`workspace-export-dialog`,Yi);function Xi({workspace:e}={}){return x(`workspace-export-dialog`,{workspace:e??null},{exclusive:!0,conflict:S})}var Zi=class extends T{static styles=[...T.styles,P(g)];static properties={_name:{state:!0},_url:{state:!0},_copied:{state:!0}};static secrets={_password:``,_confirm:``,_url:``,privateKeyBase64:``};constructor(){super(),this._name=``,this._url=``,this._copied=!1}beforeOpen(){this._name=this.initialName}disconnectedCallback(){clearTimeout(this._copiedTimer),super.disconnectedCallback()}_onNameInput=e=>{this._name=e.target.value};_canGenerate(){return this._name.trim().length>0&&this._password.length>0&&this._password===this._confirm&&!this._busy}_onGenerate=()=>{if(!this._canGenerate())return;let e={id:this.workspaceId,name:this._name.trim(),privateKeyBase64:this.privateKeyBase64,password:this._password};this._attempt(()=>Qe(e),e=>{this._url=it(e),this._password=``,this._confirm=``})};_onCopy=async()=>{if(this._url){this._error=``;try{if(await navigator.clipboard.writeText(this._url),this._settled)return;this._copied=!0,clearTimeout(this._copiedTimer),this._copiedTimer=setTimeout(()=>{this._copied=!1},1500)}catch{this._settled||(this._error=`Copy failed — select the link and copy it manually.`)}}};_onKeydown=w(()=>{this._url||this._onGenerate()});_errorLine(){return this._error?F`<p class="wsl-error" role="alert">${this._error}</p>`:I}_body(){return this._url?F`<p class="nwd-note ui-hint">Anyone with the link <strong>and</strong> the password can attach this workspace. Share them through separate channels.</p>${mt(`Share link`,F`<textarea class="wsl-link" readonly="readonly" rows="3" @focus="${e=>e.target.select()}">${this._url}</textarea>`)} ${this._errorLine()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Close</button> <button type="button" class="primary" @click="${this._onCopy}">${this._copied?`Copied`:`Copy link`}</button></footer>`:F`${mt(`Workspace name`,F`<input type="text" class="nwd-input" data-role="name" placeholder="Workspace name" maxlength="200" .value="${this._name}" @input="${this._onNameInput}" @keydown="${this._onKeydown}">`)} ${this.newPasswordFields(`dv-share-link-pw`)}<p class="nwd-note ui-hint">The link carries the workspace's identity (id, name, and private key) so the recipient joins the same sync chain. Triage, reports, and comments aren't in the link itself — they sync over once the recipient joins. The link decrypts with the password above; without it the link is useless.</p>${this._errorLine()} ${this._password&&this._confirm&&this._password!==this._confirm?F`<p class="wsl-error" role="alert">Passwords don't match.</p>`:I}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._canGenerate()}" @click="${this._onGenerate}">${this._busy?`Generating…`:`Generate link`}</button></footer>`}render(){return F`<dialog @close="${this._onClose}"><header><h3>${this._url?`Workspace share link`:`Share workspace by link`}</h3></header>${this._body()}</dialog>`}};customElements.define(`workspace-share-link-dialog`,Zi);function Qi({id:e,name:t,privateKeyBase64:n}={}){return x(`workspace-share-link-dialog`,{workspaceId:e??``,initialName:t??``,privateKeyBase64:n??``},{conflict:S}).then(()=>{})}var $i=class extends T{static styles=[...T.styles,P(g)];static secrets={_password:``,_tryPassword:null};unlock(e){return this._tryPassword(e)}unlocked(e){this._finish(e)}render(){return F`<dialog @close="${this._onClose}"><header><h3>Unlock encrypted workspace</h3></header>${this.passwordStage(`This workspace bundle is password-protected. Enter the password the sender shared with you separately to decrypt and import it.`,`dv-bundle-unlock`)}</dialog>`}};customElements.define(`workspace-unlock-bundle-dialog`,$i);function ea({tryPassword:e}={}){if(typeof e!=`function`)throw TypeError(`openWorkspaceUnlockBundleDialog: tryPassword required`);return x(`workspace-unlock-bundle-dialog`,{_tryPassword:e},{exclusive:!0,conflict:S})}var ta=e=>_e().find(t=>t.id===e)??null,na=class extends T{static styles=[...T.styles,P(g)];static properties={encoded:{type:String},_stage:{state:!0},_name:{state:!0},_decoded:{state:!0},_existingById:{state:!0}};static secrets={_decoded:null,_password:``,encoded:``};constructor(){super(),this.encoded=``,this._stage=`password`,this._name=``,this._decoded=null,this._existingById=null}updated(e){if(!e.has(`_stage`))return;if(this._stage===`password`){this.renderRoot.querySelector(`input[type="password"]`)?.focus();return}let t=this.renderRoot.querySelector(`input[data-role="name"]`);t?.focus(),t?.select()}_onNameInput=e=>{this._name=e.target.value};unlock(e){return nt({encoded:this.encoded,password:e})}unlocked(e){this._existingById=ta(e.id),this._decoded=e,this._name=e.name,this._password=``,this._stage=`name`}_onAttach=()=>{if(!this._decoded)return;let e=v(this._name);if(!e)return;let t=ta(this._decoded.id);t?this._existingById=t:this._nameCollision(e)||this._finish({id:this._decoded.id,name:e,privateKeyBase64:this._decoded.privateKeyBase64})};_nameCollision(e){return!e||!this._decoded?null:_e().find(t=>t.id!==this._decoded.id&&v(t.name)===e)??null}_onKeydown=w(()=>this._stage===`password`?this._onUnlock():this._onAttach());_nameStage(){if(this._existingById)return F`<p class="nwd-note">This workspace is already attached as <strong>"${this._existingById.name??``}"</strong>. Open it from the sidebar.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" class="primary" @click="${this._onCancel}">Close</button></footer>`;let e=v(this._name),t=this._nameCollision(e);return F`<p class="nwd-note ui-hint">Pick a name for the workspace on this device. The shared identity is preserved either way — only the visible label changes.</p>${mt(`Workspace name`,F`<input type="text" class="nwd-input" data-role="name" placeholder="Workspace name" maxlength="200" .value="${this._name}" @input="${this._onNameInput}" @keydown="${this._onKeydown}">`)} ${t?F`<p class="wsl-error" role="alert">A workspace named "${e}" already exists on this device. Pick a different name.</p>`:I}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!e||!!t}" @click="${this._onAttach}">Attach</button></footer>`}render(){let e=this._stage===`password`?`Attach shared workspace`:this._existingById?`Workspace already attached`:`Name the workspace`;return F`<dialog @close="${this._onClose}"><header><h3>${e}</h3></header>${this._stage===`password`?this.passwordStage(`Someone shared a workspace with you. Enter the password they sent separately to attach it to this browser.`,`dv-share-link-unlock`):this._nameStage()}</dialog>`}};customElements.define(`workspace-unlock-link-dialog`,na);function ra({encoded:e}={}){return x(`workspace-unlock-link-dialog`,{encoded:e??``},{exclusive:!0,conflict:S})}export{dn as openAdvisoryDetailsDialog,mn as openCommentDialog,_n as openDeleteBundleDialog,yn as openDeleteReportDialog,xn as openDetachBundleDialog,Cn as openDetachReportDialog,Tn as openDiscardReviewDialog,Dn as openDownloadBundleDialog,Mn as openExportConfirmDialog,Gn as openExportViewDialog,Qn as openFindingHistoryDialog,tr as openFindingSourceDialog,ir as openFixLinkDialog,or as openImportConflictDialog,lr as openLeaveWorkspaceDialog,fr as openLocalContentImportDialog,mr as openLocalTriageImportDialog,vr as openManagedCommentsDialog,Er as openManagedIssueDialog,kr as openManagedShareDialog,jr as openNewWorkspaceDialog,Fr as openNpmCompareAdvisoriesDialog,qr as openObjstoreRecoveryDialog,Xr as openPasskeySetupDialog,Qr as openPersistenceDegradedDialog,ci as openReportCompareDialog,bi as openRepositoryItemDialog,wi as openRevalidationConflictsDialog,Di as openStoragePersistDialog,Vr as openSyncDownloadDialog,ji as openSyncSuggestDialog,Ni as openSyncUploadDialog,Bi as openTriageComparisonDialog,Ui as openTriageExportDialog,qi as openWhyDialog,Xi as openWorkspaceExportDialog,Qi as openWorkspaceShareLinkDialog,ea as openWorkspaceUnlockBundleDialog,ra as openWorkspaceUnlockLinkDialog};
40
+ style=${N({"--connection-color":Wi(this.graph.nodes.get(e.from))})} marker-end="url(#dependency-arrow)"/>`)}</svg>`:R} ${Xt(e.packages,e=>e.id,e=>this.renderNode(e,a?r:null))}</div></div>`}render(){if(!this._current)return R;let e=this.packageGroup===void 0?this.packageKey:qt(this.packageGroup),t=this.version===void 0?`package`:`version`;return L`<dialog aria-labelledby="why-title" style="${N({"--graph-dialog-width":`${Math.max(480,(this.layout?.width??0)+ft)}px`})}" @close="${this._onClose}" @click="${this._onBackdrop}"><header><h3 id="why-title">${e}${this.version===void 0?R:L`<span class="heading-version">${this.version}</span>`}</h3><button type="button" aria-label="Close dependency chains" @click="${this._onClose}">×</button></header>${this.graph?L`<div class="graph-caption"><span>${this.graph.nodes.size} ${this.graph.nodes.size===1?`package`:`packages`}${this.graph.targets.length>1?` \xB7 ${this.graph.targets.length} installations${this.version===void 0?``:` of this version`}`:``}${this.scope?` \xB7 Scope: ${zt(this.scope)}`:``}${this.lockfile?` \xB7 ${this.lockfile}`:``}</span> <span>${this.lockfile?`↓ depends on`:`↓ imports`}</span></div>${this.graph.targets.length>0?this.renderGraph():L`<p class="empty">${this.lockfile?`This lockfile locks no such ${t}.`:`Dependency metadata for this ${t} is not available in this bundle scope.`}</p>`}`:L`<p class="empty">${this._error?`${this.lockfile} couldn\u2019t be read: ${this._error}`:`Reading ${this.lockfile}\u2026`}</p>`}</dialog>`}};customElements.define(`why-dialog`,Ki);function qi(e){return S(`why-dialog`,e)}var Ji=[{id:`workspace`,label:`Export workspace`},{id:`raw`,label:`Raw reports export`}],$=e=>Array.isArray(e)?e.length:0,Yi=class extends T{static styles=[...T.styles,I(b),I(Dn)];static properties={_tab:{state:!0},_noPassword:{state:!0},_includeBundleBytes:{state:!0}};static secrets={_password:``,_confirm:``,workspace:null};constructor(){super(),this._tab=`workspace`,this._noPassword=!1,this._includeBundleBytes=!1}_forgetPassword(){this._password=``,this._confirm=``}_selectTab(e){this._busy||this._tab===e||(this._tab=e,this._error=``,e!==`workspace`&&this._forgetPassword())}_onNoPasswordToggle=e=>{this._noPassword=e.target.checked,this._error=``,this._noPassword&&this._forgetPassword()};_onIncludeBundleBytesToggle=e=>{this._includeBundleBytes=e.target.checked,this._error=``};_canExport(){return this._busy?!1:this._tab===`raw`?$(this.workspace?.reports)>0:this._noPassword||this._password.length>0&&this._password===this._confirm}_onExport=()=>{if(!this._canExport())return;if(!this.workspace){this._error=`No workspace selected.`;return}let{workspace:e,_tab:t}=this,n=t===`raw`?()=>Ve(e):()=>Be(e,{password:this._noPassword?void 0:this._password,includeBundleBytes:this._includeBundleBytes});this._attempt(n,({blob:e,filename:n})=>{Ee(e,n),this._finish({ok:!0,tab:t})})};_onKeydown=g(this._onExport);_workspacePanel(){let e=this._password&&this._confirm&&this._password!==this._confirm,t=$(this.workspace?.bundles);return L`<p class="nwd-note ui-hint">The export file carries this workspace's reports, triage state, comments, fixes, references to attached bundles (integrities only by default), and its private key. Encrypting the file with a password ensures only those with the password can attach the workspace after download.</p>${this.newPasswordFields(`dv-export-pw`,this._noPassword)} <label class="wsl-optout"><input type="checkbox" .checked="${this._noPassword}" @change="${this._onNoPasswordToggle}"> <span>Export without password (not recommended)</span></label> ${t>0?L`<label class="wsl-optout"><input type="checkbox" .checked="${this._includeBundleBytes}" @change="${this._onIncludeBundleBytesToggle}"> <span>Include bundle bytes (${t} bundle${t===1?``:`s`}; significantly larger file)</span></label>`:R} ${this._noPassword?L`<p class="wsl-error wsl-warning">Anyone who obtains this file can attach the workspace and read every report, triage decision, comment, and fix. Only opt out when you control where the file goes.</p>`:R} ${!this._noPassword&&e?L`<p class="wsl-error" role="alert">Passwords don't match.</p>`:R}`}_rawPanel(){let e=$(this.workspace?.bundles);return L`<div class="wsl-error wsl-warning"><p>This is the raw form of the reports.</p><p>It carries no triage data — no markers, triage states, comments, fixes, or per-report ignores${e>0?L` — and none of this workspace's ${e} attached bundle${e===1?``:`s`}`:R}.</p><p>This file is written unencrypted: anyone who obtains it can read every report in it.</p></div>${$(this.workspace?.reports)===0?L`<p class="wsl-error" role="alert">This workspace has no reports to export.</p>`:R}`}render(){let e=this._tab===`raw`,t=this._busy?`Exporting…`:e?`Download reports`:this._noPassword?`Export without password`:`Export`;return L`<dialog @close="${this._onClose}"><header>${Ie({tabs:Ji,current:this._tab,prefix:`wsl`,disabled:this._busy,select:e=>this._selectTab(e)})}</header><div role="tabpanel" id="${`wsl-panel-${this._tab}`}" aria-labelledby="${`wsl-tab-${this._tab}`}">${e?this._rawPanel():this._workspacePanel()}</div>${this._error?L`<p class="wsl-error" role="alert">${this._error}</p>`:R}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="${e||this._noPassword?`primary danger`:`primary`}" ?disabled="${!this._canExport()}" @click="${this._onExport}">${t}</button></footer></dialog>`}};customElements.define(`workspace-export-dialog`,Yi);function Xi({workspace:e}={}){return S(`workspace-export-dialog`,{workspace:e??null},{exclusive:!0,conflict:C})}var Zi=class extends T{static styles=[...T.styles,I(b)];static properties={_name:{state:!0},_url:{state:!0},_copied:{state:!0}};static secrets={_password:``,_confirm:``,_url:``,privateKeyBase64:``};constructor(){super(),this._name=``,this._url=``,this._copied=!1}beforeOpen(){this._name=this.initialName}disconnectedCallback(){clearTimeout(this._copiedTimer),super.disconnectedCallback()}_onNameInput=e=>{this._name=e.target.value};_canGenerate(){return this._name.trim().length>0&&this._password.length>0&&this._password===this._confirm&&!this._busy}_onGenerate=()=>{if(!this._canGenerate())return;let e={id:this.workspaceId,name:this._name.trim(),privateKeyBase64:this.privateKeyBase64,password:this._password};this._attempt(()=>Ue(e),e=>{this._url=Ze(e),this._password=``,this._confirm=``})};_onCopy=async()=>{if(this._url){this._error=``;try{if(await navigator.clipboard.writeText(this._url),this._settled)return;this._copied=!0,clearTimeout(this._copiedTimer),this._copiedTimer=setTimeout(()=>{this._copied=!1},1500)}catch{this._settled||(this._error=`Copy failed — select the link and copy it manually.`)}}};_onKeydown=g(()=>{this._url||this._onGenerate()});_errorLine(){return this._error?L`<p class="wsl-error" role="alert">${this._error}</p>`:R}_body(){return this._url?L`<p class="nwd-note ui-hint">Anyone with the link <strong>and</strong> the password can attach this workspace. Share them through separate channels.</p>${Re(`Share link`,L`<textarea class="wsl-link" readonly="readonly" rows="3" @focus="${e=>e.target.select()}">${this._url}</textarea>`)} ${this._errorLine()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Close</button> <button type="button" class="primary" @click="${this._onCopy}">${this._copied?`Copied`:`Copy link`}</button></footer>`:L`${Re(`Workspace name`,L`<input type="text" class="nwd-input" data-role="name" placeholder="Workspace name" maxlength="200" .value="${this._name}" @input="${this._onNameInput}" @keydown="${this._onKeydown}">`)} ${this.newPasswordFields(`dv-share-link-pw`)}<p class="nwd-note ui-hint">The link carries the workspace's identity (id, name, and private key) so the recipient joins the same sync chain. Triage, reports, and comments aren't in the link itself — they sync over once the recipient joins. The link decrypts with the password above; without it the link is useless.</p>${this._errorLine()} ${this._password&&this._confirm&&this._password!==this._confirm?L`<p class="wsl-error" role="alert">Passwords don't match.</p>`:R}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._canGenerate()}" @click="${this._onGenerate}">${this._busy?`Generating…`:`Generate link`}</button></footer>`}render(){return L`<dialog @close="${this._onClose}"><header><h3>${this._url?`Workspace share link`:`Share workspace by link`}</h3></header>${this._body()}</dialog>`}};customElements.define(`workspace-share-link-dialog`,Zi);function Qi({id:e,name:t,privateKeyBase64:n}={}){return S(`workspace-share-link-dialog`,{workspaceId:e??``,initialName:t??``,privateKeyBase64:n??``},{conflict:C}).then(()=>{})}var $i=class extends T{static styles=[...T.styles,I(b)];static secrets={_password:``,_tryPassword:null};unlock(e){return this._tryPassword(e)}unlocked(e){this._finish(e)}render(){return L`<dialog @close="${this._onClose}"><header><h3>Unlock encrypted workspace</h3></header>${this.passwordStage(`This workspace bundle is password-protected. Enter the password the sender shared with you separately to decrypt and import it.`,`dv-bundle-unlock`)}</dialog>`}};customElements.define(`workspace-unlock-bundle-dialog`,$i);function ea({tryPassword:e}={}){if(typeof e!=`function`)throw TypeError(`openWorkspaceUnlockBundleDialog: tryPassword required`);return S(`workspace-unlock-bundle-dialog`,{_tryPassword:e},{exclusive:!0,conflict:C})}var ta=e=>fe().find(t=>t.id===e)??null,na=class extends T{static styles=[...T.styles,I(b)];static properties={encoded:{type:String},_stage:{state:!0},_name:{state:!0},_decoded:{state:!0},_existingById:{state:!0}};static secrets={_decoded:null,_password:``,encoded:``};constructor(){super(),this.encoded=``,this._stage=`password`,this._name=``,this._decoded=null,this._existingById=null}updated(e){if(!e.has(`_stage`))return;if(this._stage===`password`){this.renderRoot.querySelector(`input[type="password"]`)?.focus();return}let t=this.renderRoot.querySelector(`input[data-role="name"]`);t?.focus(),t?.select()}_onNameInput=e=>{this._name=e.target.value};unlock(e){return Ke({encoded:this.encoded,password:e})}unlocked(e){this._existingById=ta(e.id),this._decoded=e,this._name=e.name,this._password=``,this._stage=`name`}_onAttach=()=>{if(!this._decoded)return;let e=v(this._name);if(!e)return;let t=ta(this._decoded.id);t?this._existingById=t:this._nameCollision(e)||this._finish({id:this._decoded.id,name:e,privateKeyBase64:this._decoded.privateKeyBase64})};_nameCollision(e){return!e||!this._decoded?null:fe().find(t=>t.id!==this._decoded.id&&v(t.name)===e)??null}_onKeydown=g(()=>this._stage===`password`?this._onUnlock():this._onAttach());_nameStage(){if(this._existingById)return L`<p class="nwd-note">This workspace is already attached as <strong>"${this._existingById.name??``}"</strong>. Open it from the sidebar.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" class="primary" @click="${this._onCancel}">Close</button></footer>`;let e=v(this._name),t=this._nameCollision(e);return L`<p class="nwd-note ui-hint">Pick a name for the workspace on this device. The shared identity is preserved either way — only the visible label changes.</p>${Re(`Workspace name`,L`<input type="text" class="nwd-input" data-role="name" placeholder="Workspace name" maxlength="200" .value="${this._name}" @input="${this._onNameInput}" @keydown="${this._onKeydown}">`)} ${t?L`<p class="wsl-error" role="alert">A workspace named "${e}" already exists on this device. Pick a different name.</p>`:R}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!e||!!t}" @click="${this._onAttach}">Attach</button></footer>`}render(){let e=this._stage===`password`?`Attach shared workspace`:this._existingById?`Workspace already attached`:`Name the workspace`;return L`<dialog @close="${this._onClose}"><header><h3>${e}</h3></header>${this._stage===`password`?this.passwordStage(`Someone shared a workspace with you. Enter the password they sent separately to attach it to this browser.`,`dv-share-link-unlock`):this._nameStage()}</dialog>`}};customElements.define(`workspace-unlock-link-dialog`,na);function ra({encoded:e}={}){return S(`workspace-unlock-link-dialog`,{encoded:e??``},{exclusive:!0,conflict:C})}export{ln as openAdvisoryDetailsDialog,fn as openCommentDialog,hn as openDeleteBundleDialog,_n as openDeleteReportDialog,yn as openDetachBundleDialog,xn as openDetachReportDialog,Cn as openDiscardReviewDialog,Tn as openDownloadBundleDialog,An as openExportConfirmDialog,Un as openExportViewDialog,Xn as openFindingHistoryDialog,$n as openFindingSourceDialog,nr as openFixLinkDialog,ir as openImportConflictDialog,sr as openLeaveWorkspaceDialog,ur as openLocalContentImportDialog,fr as openLocalTriageImportDialog,gr as openManagedCommentsDialog,Tr as openManagedIssueDialog,Or as openManagedShareDialog,Ar as openNewWorkspaceDialog,Pr as openNpmCompareAdvisoriesDialog,Kr as openObjstoreRecoveryDialog,Yr as openPasskeySetupDialog,Zr as openPersistenceDegradedDialog,si as openReportCompareDialog,yi as openRepositoryItemDialog,Ci as openRevalidationConflictsDialog,Ei as openStoragePersistDialog,Br as openSyncDownloadDialog,Ai as openSyncSuggestDialog,Mi as openSyncUploadDialog,zi as openTriageComparisonDialog,Hi as openTriageExportDialog,qi as openWhyDialog,Xi as openWorkspaceExportDialog,Qi as openWorkspaceShareLinkDialog,ea as openWorkspaceUnlockBundleDialog,ra as openWorkspaceUnlockLinkDialog};