@preventive/triage 1.0.0-alpha.14 → 1.0.0-alpha.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/common/scan-server.ts +13 -0
  2. package/common/server-info.ts +1 -0
  3. package/common/utf8.d.ts +3 -0
  4. package/common/utf8.js +45 -0
  5. package/out/brotli-fallback.js +3 -3
  6. package/out/client-managed.js +83 -1
  7. package/out/client-sync.js +14 -14
  8. package/out/graph.js +30 -5
  9. package/out/index.html +49 -8
  10. package/out/prism.js +2 -2
  11. package/out/provider-icons/claude.svg +1 -0
  12. package/out/provider-icons/deepseek.svg +1 -0
  13. package/out/provider-icons/google.svg +1 -0
  14. package/out/provider-icons/grok.svg +1 -0
  15. package/out/provider-icons/moonshot.svg +1 -0
  16. package/out/provider-icons/nvidia.svg +1 -0
  17. package/out/provider-icons/openai.svg +1 -0
  18. package/out/provider-icons/openrouter.svg +1 -0
  19. package/out/provider-icons/qwen.svg +1 -0
  20. package/out/provider-icons/zai.svg +1 -0
  21. package/out/stasis.svg +45 -0
  22. package/out/terminal.js +266 -45
  23. package/out/view.css +1 -1
  24. package/out/view.js +157 -119
  25. package/package.json +31 -5
  26. package/report/index.js +253 -0
  27. package/report/src/finding-id.js +80 -0
  28. package/report/src/finding.js +300 -0
  29. package/report/src/labels.js +33 -0
  30. package/report/src/md-structure.js +471 -0
  31. package/report/src/md-text.js +167 -0
  32. package/report/src/meta.js +76 -0
  33. package/report/src/parse-codex.js +147 -0
  34. package/report/src/parse-deepsec.js +197 -0
  35. package/report/src/parse-deepview-fields.js +375 -0
  36. package/report/src/parse-deepview-md.js +185 -0
  37. package/report/src/parse-md-id.js +137 -0
  38. package/report/src/parse-md.js +322 -0
  39. package/report/src/parse-piolium-id.js +79 -0
  40. package/report/src/parse-piolium-rows.js +131 -0
  41. package/report/src/parse-piolium-tokens.js +175 -0
  42. package/report/src/parse-piolium.js +400 -0
  43. package/report/src/utf8.js +21 -0
  44. package/report/src/write-md-finding.js +273 -0
  45. package/report/src/write-md.js +291 -0
  46. package/server-common/scan-config.ts +19 -0
  47. package/server-e2e/bus-receiver.ts +1 -0
  48. package/server-e2e/config.ts +6 -0
  49. package/server-e2e/http.ts +1 -1
  50. package/server-e2e/hub.ts +37 -6
  51. package/server-e2e/index.ts +4 -4
  52. package/server-e2e/objstore/handlers.ts +6 -5
  53. package/server-e2e/objstore/init.ts +1 -1
  54. package/server-e2e/objstore/rest-mint.ts +2 -2
  55. package/server-e2e/objstore/rest.ts +2 -2
  56. package/server-e2e/pubsub.ts +8 -5
  57. package/server-e2e/static.ts +19 -11
  58. package/server-e2e/sync-handlers.ts +54 -28
  59. package/out/client-admin.js +0 -28
package/out/view.js CHANGED
@@ -1,112 +1,144 @@
1
- var gs=globalThis,bs=gs.ShadowRoot&&(gs.ShadyCSS===void 0||gs.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,rh=Symbol(),th=new WeakMap,ms=class{constructor(t,r,n){if(this._$cssResult$=!0,n!==rh)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=r}get styleSheet(){let t=this.o,r=this.t;if(bs&&t===void 0){let n=r!==void 0&&r.length===1;n&&(t=th.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&th.set(r,t))}return t}toString(){return this.cssText}},B=e=>new ms(typeof e=="string"?e:e+"",void 0,rh);var nh=(e,t)=>{if(bs)e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(let r of t){let n=document.createElement("style"),o=gs.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=r.cssText,e.appendChild(n)}},Kl=bs?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r="";for(let n of t.cssRules)r+=n.cssText;return B(r)})(e):e;var{is:J0,defineProperty:Q0,getOwnPropertyDescriptor:Z0,getOwnPropertyNames:ek,getOwnPropertySymbols:tk,getPrototypeOf:rk}=Object,ys=globalThis,oh=ys.trustedTypes,nk=oh?oh.emptyScript:"",ok=ys.reactiveElementPolyfillSupport,Ao=(e,t)=>e,Gl={toAttribute(e,t){switch(t){case Boolean:e=e?nk:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=e!==null;break;case Number:r=e===null?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},sh=(e,t)=>!J0(e,t),ih={attribute:!0,type:String,converter:Gl,reflect:!1,useDefault:!1,hasChanged:sh};Symbol.metadata??=Symbol("metadata"),ys.litPropertyMetadata??=new WeakMap;var Kt=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,r=ih){if(r.state&&(r.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((r=Object.create(r)).wrapped=!0),this.elementProperties.set(t,r),!r.noAccessor){let n=Symbol(),o=this.getPropertyDescriptor(t,n,r);o!==void 0&&Q0(this.prototype,t,o)}}static getPropertyDescriptor(t,r,n){let{get:o,set:i}=Z0(this.prototype,t)??{get(){return this[r]},set(s){this[r]=s}};return{get:o,set(s){let l=o?.call(this);i?.call(this,s),this.requestUpdate(t,l,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ih}static _$Ei(){if(this.hasOwnProperty(Ao("elementProperties")))return;let t=rk(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Ao("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ao("properties"))){let r=this.properties,n=[...ek(r),...tk(r)];for(let o of n)this.createProperty(o,r[o])}let t=this[Symbol.metadata];if(t!==null){let r=litPropertyMetadata.get(t);if(r!==void 0)for(let[n,o]of r)this.elementProperties.set(n,o)}this._$Eh=new Map;for(let[r,n]of this.elementProperties){let o=this._$Eu(r,n);o!==void 0&&this._$Eh.set(o,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let r=[];if(Array.isArray(t)){let n=new Set(t.flat(1/0).reverse());for(let o of n)r.unshift(Kl(o))}else t!==void 0&&r.push(Kl(t));return r}static _$Eu(t,r){let n=r.attribute;return n===!1?void 0:typeof n=="string"?n:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,r=this.constructor.elementProperties;for(let n of r.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return nh(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,r,n){this._$AK(t,n)}_$ET(t,r){let n=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,n);if(o!==void 0&&n.reflect===!0){let i=(n.converter?.toAttribute!==void 0?n.converter:Gl).toAttribute(r,n.type);this._$Em=t,i==null?this.removeAttribute(o):this.setAttribute(o,i),this._$Em=null}}_$AK(t,r){let n=this.constructor,o=n._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let i=n.getPropertyOptions(o),s=typeof i.converter=="function"?{fromAttribute:i.converter}:i.converter?.fromAttribute!==void 0?i.converter:Gl;this._$Em=o;let l=s.fromAttribute(r,i.type);this[o]=l??this._$Ej?.get(o)??l,this._$Em=null}}requestUpdate(t,r,n,o=!1,i){if(t!==void 0){let s=this.constructor;if(o===!1&&(i=this[t]),n??=s.getPropertyOptions(t),!((n.hasChanged??sh)(i,r)||n.useDefault&&n.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,n))))return;this.C(t,r,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,r,{useDefault:n,reflect:o,wrapped:i},s){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??r??this[t]),i!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||n||(r=void 0),this._$AL.set(t,r)),o===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(r){Promise.reject(r)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[o,i]of this._$Ep)this[o]=i;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[o,i]of n){let{wrapped:s}=i,l=this[o];s!==!0||this._$AL.has(o)||l===void 0||this.C(o,void 0,i,l)}}let t=!1,r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(r)):this._$EM()}catch(n){throw t=!1,this._$EM(),n}t&&this._$AE(r)}willUpdate(t){}_$AE(t){this._$EO?.forEach(r=>r.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(r=>this._$ET(r,this[r])),this._$EM()}updated(t){}firstUpdated(t){}};Kt.elementStyles=[],Kt.shadowRootOptions={mode:"open"},Kt[Ao("elementProperties")]=new Map,Kt[Ao("finalized")]=new Map,ok?.({ReactiveElement:Kt}),(ys.reactiveElementVersions??=[]).push("2.1.2");var Yl=globalThis,ah=e=>e,vs=Yl.trustedTypes,lh=vs?vs.createPolicy("lit-html",{createHTML:e=>e}):void 0,Xl="$lit$",Gt=`lit$${Math.random().toFixed(9).slice(2)}$`,Jl="?"+Gt,ik=`<${Jl}>`,Yr=document,Ro=()=>Yr.createComment(""),Io=e=>e===null||typeof e!="object"&&typeof e!="function",Ql=Array.isArray,hh=e=>Ql(e)||typeof e?.[Symbol.iterator]=="function",ql=`[
2
- \f\r]`,To=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ch=/-->/g,dh=/>/g,Gr=RegExp(`>|${ql}(?:([^\\s"'>=/]+)(${ql}*=${ql}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),uh=/'/g,ph=/"/g,gh=/^(?:script|style|textarea|title)$/i,Zl=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),c=Zl(1),lr=Zl(2),CA=Zl(3),xe=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),fh=new WeakMap,qr=Yr.createTreeWalker(Yr,129);function mh(e,t){if(!Ql(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return lh!==void 0?lh.createHTML(t):t}var bh=(e,t)=>{let r=e.length-1,n=[],o,i=t===2?"<svg>":t===3?"<math>":"",s=To;for(let l=0;l<r;l++){let d=e[l],u,p,f=-1,h=0;for(;h<d.length&&(s.lastIndex=h,p=s.exec(d),p!==null);)h=s.lastIndex,s===To?p[1]==="!--"?s=ch:p[1]!==void 0?s=dh:p[2]!==void 0?(gh.test(p[2])&&(o=RegExp("</"+p[2],"g")),s=Gr):p[3]!==void 0&&(s=Gr):s===Gr?p[0]===">"?(s=o??To,f=-1):p[1]===void 0?f=-2:(f=s.lastIndex-p[2].length,u=p[1],s=p[3]===void 0?Gr:p[3]==='"'?ph:uh):s===ph||s===uh?s=Gr:s===ch||s===dh?s=To:(s=Gr,o=void 0);let m=s===Gr&&e[l+1].startsWith("/>")?" ":"";i+=s===To?d+ik:f>=0?(n.push(u),d.slice(0,f)+Xl+d.slice(f)+Gt+m):d+Gt+(f===-2?l:m)}return[mh(e,i+(e[r]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},Mo=class e{constructor({strings:t,_$litType$:r},n){let o;this.parts=[];let i=0,s=0,l=t.length-1,d=this.parts,[u,p]=bh(t,r);if(this.el=e.createElement(u,n),qr.currentNode=this.el.content,r===2||r===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(o=qr.nextNode())!==null&&d.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let f of o.getAttributeNames())if(f.endsWith(Xl)){let h=p[s++],m=o.getAttribute(f).split(Gt),b=/([.?@])?(.*)/.exec(h);d.push({type:1,index:i,name:b[2],strings:m,ctor:b[1]==="."?ks:b[1]==="?"?$s:b[1]==="@"?xs:Jr}),o.removeAttribute(f)}else f.startsWith(Gt)&&(d.push({type:6,index:i}),o.removeAttribute(f));if(gh.test(o.tagName)){let f=o.textContent.split(Gt),h=f.length-1;if(h>0){o.textContent=vs?vs.emptyScript:"";for(let m=0;m<h;m++)o.append(f[m],Ro()),qr.nextNode(),d.push({type:2,index:++i});o.append(f[h],Ro())}}}else if(o.nodeType===8)if(o.data===Jl)d.push({type:2,index:i});else{let f=-1;for(;(f=o.data.indexOf(Gt,f+1))!==-1;)d.push({type:7,index:i}),f+=Gt.length-1}i++}}static createElement(t,r){let n=Yr.createElement("template");return n.innerHTML=t,n}};function Xr(e,t,r=e,n){if(t===xe)return t;let o=n!==void 0?r._$Co?.[n]:r._$Cl,i=Io(t)?void 0:t._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(e),o._$AT(e,r,n)),n!==void 0?(r._$Co??=[])[n]=o:r._$Cl=o),o!==void 0&&(t=Xr(e,o._$AS(e,t.values),o,n)),t}var ws=class{constructor(t,r){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:r},parts:n}=this._$AD,o=(t?.creationScope??Yr).importNode(r,!0);qr.currentNode=o;let i=qr.nextNode(),s=0,l=0,d=n[0];for(;d!==void 0;){if(s===d.index){let u;d.type===2?u=new Rn(i,i.nextSibling,this,t):d.type===1?u=new d.ctor(i,d.name,d.strings,this,t):d.type===6&&(u=new Ss(i,this,t)),this._$AV.push(u),d=n[++l]}s!==d?.index&&(i=qr.nextNode(),s++)}return qr.currentNode=Yr,o}p(t){let r=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,r),r+=n.strings.length-2):n._$AI(t[r])),r++}},Rn=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,r,n,o){this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=t,this._$AB=r,this._$AM=n,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,r=this._$AM;return r!==void 0&&t?.nodeType===11&&(t=r.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,r=this){t=Xr(this,t,r),Io(t)?t===g||t==null||t===""?(this._$AH!==g&&this._$AR(),this._$AH=g):t!==this._$AH&&t!==xe&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):hh(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==g&&Io(this._$AH)?this._$AA.nextSibling.data=t:this.T(Yr.createTextNode(t)),this._$AH=t}$(t){let{values:r,_$litType$:n}=t,o=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=Mo.createElement(mh(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(r);else{let i=new ws(o,this),s=i.u(this.options);i.p(r),this.T(s),this._$AH=i}}_$AC(t){let r=fh.get(t.strings);return r===void 0&&fh.set(t.strings,r=new Mo(t)),r}k(t){Ql(this._$AH)||(this._$AH=[],this._$AR());let r=this._$AH,n,o=0;for(let i of t)o===r.length?r.push(n=new e(this.O(Ro()),this.O(Ro()),this,this.options)):n=r[o],n._$AI(i),o++;o<r.length&&(this._$AR(n&&n._$AB.nextSibling,o),r.length=o)}_$AR(t=this._$AA.nextSibling,r){for(this._$AP?.(!1,!0,r);t!==this._$AB;){let n=ah(t).nextSibling;ah(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Jr=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,r,n,o,i){this.type=1,this._$AH=g,this._$AN=void 0,this.element=t,this.name=r,this._$AM=o,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=g}_$AI(t,r=this,n,o){let i=this.strings,s=!1;if(i===void 0)t=Xr(this,t,r,0),s=!Io(t)||t!==this._$AH&&t!==xe,s&&(this._$AH=t);else{let l=t,d,u;for(t=i[0],d=0;d<i.length-1;d++)u=Xr(this,l[n+d],r,d),u===xe&&(u=this._$AH[d]),s||=!Io(u)||u!==this._$AH[d],u===g?t=g:t!==g&&(t+=(u??"")+i[d+1]),this._$AH[d]=u}s&&!o&&this.j(t)}j(t){t===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ks=class extends Jr{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===g?void 0:t}},$s=class extends Jr{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==g)}},xs=class extends Jr{constructor(t,r,n,o,i){super(t,r,n,o,i),this.type=5}_$AI(t,r=this){if((t=Xr(this,t,r,0)??g)===xe)return;let n=this._$AH,o=t===g&&n!==g||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==g&&(n===g||o);o&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Ss=class{constructor(t,r,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){Xr(this,t)}},yh={M:Xl,P:Gt,A:Jl,C:1,L:bh,R:ws,D:hh,V:Xr,I:Rn,H:Jr,N:$s,U:xs,B:ks,F:Ss},sk=Yl.litHtmlPolyfillSupport;sk?.(Mo,Rn),(Yl.litHtmlVersions??=[]).push("3.3.3");var Y=(e,t,r)=>{let n=r?.renderBefore??t,o=n._$litPart$;if(o===void 0){let i=r?.renderBefore??null;n._$litPart$=o=new Rn(t.insertBefore(Ro(),i),i,void 0,r??{})}return o._$AI(e),o};var ec=globalThis,Z=class extends Kt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Y(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return xe}};Z._$litElement$=!0,Z.finalized=!0,ec.litElementHydrateSupport?.({LitElement:Z});var ak=ec.litElementPolyfillSupport;ak?.({LitElement:Z});(ec.litElementVersions??=[]).push("4.2.2");var je={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},At=e=>(...t)=>({_$litDirective$:e,values:t}),ct=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,r,n){this._$Ct=t,this._$AM=r,this._$Ci=n}_$AS(t,r){return this.update(t,r)}update(t,r){return this.render(...r)}};var T=At(class extends ct{constructor(e){if(super(e),e.type!==je.ATTRIBUTE||e.name!=="class"||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(n=>n!=="")));for(let n in t)t[n]&&!this.nt?.has(n)&&this.st.add(n);return this.render(t)}let r=e.element.classList;for(let n of this.st)n in t||(r.remove(n),this.st.delete(n));for(let n in t){let o=!!t[n];o===this.st.has(n)||this.nt?.has(n)||(o?(r.add(n),this.st.add(n)):(r.remove(n),this.st.delete(n)))}return xe}});var{I:lk}=yh,vh=e=>e;var kh=e=>e.strings===void 0,wh=()=>document.createComment(""),In=(e,t,r)=>{let n=e._$AA.parentNode,o=t===void 0?e._$AB:t._$AA;if(r===void 0){let i=n.insertBefore(wh(),o),s=n.insertBefore(wh(),o);r=new lk(i,s,e,e.options)}else{let i=r._$AB.nextSibling,s=r._$AM,l=s!==e;if(l){let d;r._$AQ?.(e),r._$AM=e,r._$AP!==void 0&&(d=e._$AU)!==s._$AU&&r._$AP(d)}if(i!==o||l){let d=r._$AA;for(;d!==i;){let u=vh(d).nextSibling;vh(n).insertBefore(d,o),d=u}}}return r},cr=(e,t,r=e)=>(e._$AI(t,r),e),ck={},_s=(e,t=ck)=>e._$AH=t,$h=e=>e._$AH,Cs=e=>{e._$AR(),e._$AA.remove()};var xh=(e,t,r)=>{let n=new Map;for(let o=t;o<=r;o++)n.set(e[o],o);return n},X=At(class extends ct{constructor(e){if(super(e),e.type!==je.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,r){let n;r===void 0?r=t:t!==void 0&&(n=t);let o=[],i=[],s=0;for(let l of e)o[s]=n?n(l,s):s,i[s]=r(l,s),s++;return{values:i,keys:o}}render(e,t,r){return this.dt(e,t,r).values}update(e,[t,r,n]){let o=$h(e),{values:i,keys:s}=this.dt(t,r,n);if(!Array.isArray(o))return this.ut=s,i;let l=this.ut??=[],d=[],u,p,f=0,h=o.length-1,m=0,b=i.length-1;for(;f<=h&&m<=b;)if(o[f]===null)f++;else if(o[h]===null)h--;else if(l[f]===s[m])d[m]=cr(o[f],i[m]),f++,m++;else if(l[h]===s[b])d[b]=cr(o[h],i[b]),h--,b--;else if(l[f]===s[b])d[b]=cr(o[f],i[b]),In(e,d[b+1],o[f]),f++,b--;else if(l[h]===s[m])d[m]=cr(o[h],i[m]),In(e,o[f],o[h]),h--,m++;else if(u===void 0&&(u=xh(s,m,b),p=xh(l,f,h)),u.has(l[f]))if(u.has(l[h])){let v=p.get(s[m]),y=v!==void 0?o[v]:null;if(y===null){let w=In(e,o[f]);cr(w,i[m]),d[m]=w}else d[m]=cr(y,i[m]),In(e,o[f],y),o[v]=null;m++}else Cs(o[h]),h--;else Cs(o[f]),f++;for(;m<=b;){let v=In(e,d[b+1]);cr(v,i[m]),d[m++]=v}for(;f<=h;){let v=o[f++];v!==null&&Cs(v)}return this.ut=s,_s(e,d),xe}});var Sh="important",dk=" !"+Sh,ae=At(class extends ct{constructor(e){if(super(e),e.type!==je.ATTRIBUTE||e.name!=="style"||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return n==null?t:t+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(e,[t]){let{style:r}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let n of this.ft)t[n]==null&&(this.ft.delete(n),n.includes("-")?r.removeProperty(n):r[n]=null);for(let n in t){let o=t[n];if(o!=null){this.ft.add(n);let i=typeof o=="string"&&o.endsWith(dk);n.includes("-")||i?r.setProperty(n,i?o.slice(0,-11):o,i?Sh:""):r[n]=o}}return xe}});var oc=new WeakMap,Ah=Symbol("iteration key");function uk(e){oc.set(e,new Map)}function pk(e,{target:t,key:r,type:n}){n==="iterate"&&(r=Ah);let o=oc.get(t),i=o.get(r);i||(i=new Set,o.set(r,i)),i.has(e)||(i.add(e),e.cleaners.push(i))}function fk({target:e,key:t,type:r}){let n=oc.get(e),o=new Set;if(r==="clear"?n.forEach((i,s)=>{tc(o,n,s)}):tc(o,n,t),r==="add"||r==="delete"||r==="clear"){let i=Array.isArray(e)?"length":Ah;tc(o,n,i)}return o}function tc(e,t,r){let n=t.get(r);n&&n.forEach(e.add,e)}function Th(e){e.cleaners&&e.cleaners.forEach(hk,e),e.cleaners=[]}function hk(e){e.delete(this)}var Mn=[],rc=!1;function gk(e,t,r,n){if(e.unobserved)return Reflect.apply(t,r,n);if(Mn.indexOf(e)===-1){Th(e);try{return Mn.push(e),Reflect.apply(t,r,n)}finally{Mn.pop()}}}function wt(e){let t=Mn[Mn.length-1];t&&(Rh(t,e),pk(t,e))}function dr(e){fk(e).forEach(mk,e)}function mk(e){Rh(e,this),typeof e.scheduler=="function"?e.scheduler(e):typeof e.scheduler=="object"?e.scheduler.add(e):e()}function Rh(e,t){if(e.debugger&&!rc)try{rc=!0,e.debugger(t)}finally{rc=!1}}function Ih(){return Mn.length>0}var _h=Symbol("is reaction");function Mh(e,t={}){let r=e[_h]?e:function n(){return gk(n,e,this,arguments)};return r.scheduler=t.scheduler,r.debugger=t.debugger,r[_h]=!0,t.lazy||r(),r}function ic(e){e.unobserved||(e.unobserved=!0,Th(e)),typeof e.scheduler=="object"&&e.scheduler.delete(e)}var ze=new WeakMap,Ts=new WeakMap,bk=Object.prototype.hasOwnProperty;function As(e){let t=Ts.get(e);return Ih()&&typeof e=="object"&&e!==null?t||Rs(e):t||e}function nc(e,t){let r=e.next;return e.next=()=>{let{done:n,value:o}=r.call(e);return n||(t?o[1]=As(o[1]):o=As(o)),{done:n,value:o}},e}var Ch={has(e){let t=ze.get(this),r=Reflect.getPrototypeOf(this);return wt({target:t,key:e,type:"has"}),r.has.apply(t,arguments)},get(e){let t=ze.get(this),r=Reflect.getPrototypeOf(this);return wt({target:t,key:e,type:"get"}),As(r.get.apply(t,arguments))},add(e){let t=ze.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),o=r.add.apply(t,arguments);return n||dr({target:t,key:e,value:e,type:"add"}),o},set(e,t){let r=ze.get(this),n=Reflect.getPrototypeOf(this),o=n.has.call(r,e),i=n.get.call(r,e),s=n.set.apply(r,arguments);return o?t!==i&&dr({target:r,key:e,value:t,oldValue:i,type:"set"}):dr({target:r,key:e,value:t,type:"add"}),s},delete(e){let t=ze.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),o=r.get?r.get.call(t,e):void 0,i=r.delete.apply(t,arguments);return n&&dr({target:t,key:e,oldValue:o,type:"delete"}),i},clear(){let e=ze.get(this),t=Reflect.getPrototypeOf(this),r=e.size!==0,n=e instanceof Map?new Map(e):new Set(e),o=t.clear.apply(e,arguments);return r&&dr({target:e,oldTarget:n,type:"clear"}),o},forEach(e,...t){let r=ze.get(this),n=Reflect.getPrototypeOf(this);wt({target:r,type:"iterate"});let o=(i,...s)=>e(As(i),...s);return n.forEach.call(r,o,...t)},keys(){let e=ze.get(this),t=Reflect.getPrototypeOf(this);return wt({target:e,type:"iterate"}),t.keys.apply(e,arguments)},values(){let e=ze.get(this),t=Reflect.getPrototypeOf(this);wt({target:e,type:"iterate"});let r=t.values.apply(e,arguments);return nc(r,!1)},entries(){let e=ze.get(this),t=Reflect.getPrototypeOf(this);wt({target:e,type:"iterate"});let r=t.entries.apply(e,arguments);return nc(r,!0)},[Symbol.iterator](){let e=ze.get(this),t=Reflect.getPrototypeOf(this);wt({target:e,type:"iterate"});let r=t[Symbol.iterator].apply(e,arguments);return nc(r,e instanceof Map)},get size(){let e=ze.get(this),t=Reflect.getPrototypeOf(this);return wt({target:e,type:"iterate"}),Reflect.get(t,"size",e)}},Es={get(e,t,r){return e=bk.call(Ch,t)?Ch:e,Reflect.get(e,t,r)}},Eh=typeof window=="object"?window:Function("return this")(),Fh=new Map([[Map,Es],[Set,Es],[WeakMap,Es],[WeakSet,Es],[Object,!1],[Array,!1],[Int8Array,!1],[Uint8Array,!1],[Uint8ClampedArray,!1],[Int16Array,!1],[Uint16Array,!1],[Int32Array,!1],[Uint32Array,!1],[Float32Array,!1],[Float64Array,!1]]);function yk({constructor:e}){return!(typeof e=="function"&&e.name in Eh&&Eh[e.name]===e)||Fh.has(e)}function vk(e){return Fh.get(e.constructor)}var Bh=Object.prototype.hasOwnProperty,wk=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(e=>typeof e=="symbol"));function kk(e,t,r){let n=Reflect.get(e,t,r);if(typeof t=="symbol"&&wk.has(t))return n;wt({target:e,key:t,receiver:r,type:"get"});let o=Ts.get(n);if(Ih()&&typeof n=="object"&&n!==null){if(o)return o;let i=Reflect.getOwnPropertyDescriptor(e,t);if(!i||!(i.writable===!1&&i.configurable===!1))return Rs(n)}return o||n}function $k(e,t){let r=Reflect.has(e,t);return wt({target:e,key:t,type:"has"}),r}function xk(e){return wt({target:e,type:"iterate"}),Reflect.ownKeys(e)}function Sk(e,t,r,n){typeof r=="object"&&r!==null&&(r=ze.get(r)||r);let o=Bh.call(e,t),i=e[t],s=Reflect.set(e,t,r,n);return e!==ze.get(n)||(o?r!==i&&dr({target:e,key:t,value:r,oldValue:i,receiver:n,type:"set"}):dr({target:e,key:t,value:r,receiver:n,type:"add"})),s}function _k(e,t){let r=Bh.call(e,t),n=e[t],o=Reflect.deleteProperty(e,t);return r&&dr({target:e,key:t,oldValue:n,type:"delete"}),o}var Ck={get:kk,has:$k,ownKeys:xk,set:Sk,deleteProperty:_k};function Rs(e={}){return ze.has(e)||!yk(e)?e:Ts.get(e)||Ek(e)}function Ek(e){let t=vk(e)||Ck,r=new Proxy(e,t);return Ts.set(e,r),ze.set(r,e),uk(e),r}var Lh=Rs;function sc(e){let t=!0,r=Mh(()=>{try{e(t)}finally{t=!1}},{lazy:!0});try{r()}catch(n){throw ic(r),n}return()=>ic(r)}var N=class extends Z{_disposers=[];observes=null;connectedCallback(){super.connectedCallback(),this.bindState()}bindState(){if(this.observes){this._disposers.push(sc(t=>{this.observes(),t||this.requestUpdate()}));return}this._render||(this._render=this.render,this.render=()=>{let t,r=sc(n=>{if(!n){r(),this._dispose===r&&(this._dispose=null),this.updateComplete.then(()=>this.requestUpdate());return}t=this._render()});return this._dispose=r,t}),this._disposers.push(()=>this._dispose&&this._dispose())}disconnectedCallback(){for(super.disconnectedCallback();this._disposers.length>0;)this._disposers.pop()()}};globalThis[Symbol.for("@rray/frontend")]={LitElement:Z,html:c,nothing:g,render:Y,unsafeCSS:B,StateElement:N,classMap:T,repeat:X,styleMap:ae};var we=document.querySelector("#drop-zone"),S=document.querySelector("#report"),Ph=document.querySelector("app-sidebar");function qt(e,t){let r=URL.createObjectURL(e),n=document.createElement("span");n.style.display="none",Y(c`<a href="${r}" download="${t}"></a>`,n),document.body.append(n),n.firstElementChild.click(),n.remove(),URL.revokeObjectURL(r)}function Tt(e){return new Error("Another dialog is already open. Close it and try again.",{cause:e})}var Ak="solidity-bundle",Tk="0.0.0";function Fn(e){if(e?.name!==Ak)return!1;let t=e.version;return!t||t===Tk}function Nh(e){let t=e?.package?.npm,r=t?.version;if(typeof r=="string"&&r&&!Fn(t))return r;let n=e?.file;if(!n)return null;let o=/(?:^|\/)node_modules\/\.pnpm\/([^/]+)\/node_modules\//u.exec(n);if(!o)return null;let i=o[1],s=i.indexOf("_");s>0&&(i=i.slice(0,s));let l=i.lastIndexOf("@");return l<=0?null:i.slice(l+1)||null}function Is(){return{keys:new Set,findings:[],files:new Map,reports:new Set,_keyReports:new Map}}function Ms(e,t,r,n){e.reports.add(r);let o=e._keyReports.get(t);o||e._keyReports.set(t,o=new Set);let i=!o.has(r);return o.add(r),e.keys.has(t)||(e.keys.add(t),e.findings.push(n),e.files.has(n.file)||e.files.set(n.file,[]),e.files.get(n.file).push(n)),i}function Fs(e,t,r,n){e._keyReports.delete(t),e.keys.delete(t);let o=e.findings.findIndex(l=>n(l)===t);o>=0&&e.findings.splice(o,1);let i=e.files.get(r);if(!i)return;let s=i.findIndex(l=>n(l)===t);s>=0&&i.splice(s,1),i.length===0&&e.files.delete(r)}function Bs(e){let t=new Set;for(let r of e._keyReports.values())for(let n of r)t.add(n);e.reports=t}function Dh(e,t,r,n,o){let i=e.byVersion.get(t);i||(i=Is(),e.byVersion.set(t,i)),Ms(i,n,o,r)}function zh(e,t,r,n,o,i){let s=e.byVersion.get(t);if(!s)return;let l=s._keyReports.get(r);if(l&&(l.delete(o),l.size===0&&Fs(s,r,n,i)),s._keyReports.size===0){e.byVersion.delete(t);return}Bs(s)}function ac(e,t){if(e===t)return 0;if(e===null)return 1;if(t===null)return-1;let[r,n=""]=Oh(e,"-"),[o,i=""]=Oh(t,"-"),s=r.split("."),l=o.split("."),d=Math.max(s.length,l.length);for(let u=0;u<d;u++){let p=s[u]??"0",f=l[u]??"0",h=/^\d+$/u.test(p),m=/^\d+$/u.test(f);if(h&&m){let b=Number(f)-Number(p);if(b!==0)return b}else{let b=f.localeCompare(p);if(b!==0)return b}}return n===""&&i!==""?-1:n!==""&&i===""?1:i.localeCompare(n)}function Oh(e,t){let r=e.indexOf(t);return r<0?[e,""]:[e.slice(0,r),e.slice(r+1)]}var Rk=new TextEncoder,Ik=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function re(e){if(typeof e!="string")throw new TypeError(`encodeUtf8 expects a string, got ${typeof e}`);if(!e.isWellFormed())throw new TypeError("encodeUtf8: input contains lone surrogates");return Rk.encode(e)}function Ae(e){if(!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer))throw new TypeError(`decodeUtf8 expects a BufferSource, got ${e===null?"null":typeof e}`);return Ik.decode(e)}async function Fo(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(t).arrayBuffer())}async function Rt(e,{maxBytes:t}={}){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip"));if(t==null)return new Uint8Array(await new Response(r).arrayBuffer());let n=r.getReader(),o=[],i=0;for(;;){let{value:d,done:u}=await n.read();if(u)break;if(i+=d.length,i>t){try{await n.cancel()}catch{}throw new Error(`gunzipBytes: decompressed size exceeds ${t}-byte cap`)}o.push(d)}let s=new Uint8Array(i),l=0;for(let d of o)s.set(d,l),l+=d.length;return s}async function Ls(e){return await Fo(re(e))}async function Bo(e){return Ae(await Rt(e))}async function Uh(e){let t=await crypto.subtle.digest("SHA-512",e);return`sha512-${new Uint8Array(t).toBase64()}`}var kt=new Uint8Array([68,86,69,49]),Bn=12,Mk=32,Fk="deepview-passkey.v1.content-key";function Lo(){return!(typeof window>"u"||typeof PublicKeyCredential>"u"||typeof navigator>"u"||!navigator.credentials)}async function Hh(){if(typeof PublicKeyCredential>"u")return!1;let e=PublicKeyCredential.getClientCapabilities;if(typeof e!="function")return null;try{let t=await e.call(PublicKeyCredential);if(!t||typeof t!="object")return null;let r=t["extension:prf"],n=t.prf;return r===!0||n===!0?!0:r===!1||n===!1?!1:null}catch{return null}}function Ps(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}async function lc(e){if(e.length<32)throw new Error(`PRF output too short (${e.length} bytes; need \u2265 32)`);let t=await crypto.subtle.importKey("raw",e,"HKDF",!1,["deriveBits"]),r=await crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:new Uint8Array,info:re(Fk)},t,Mk*8);return new Uint8Array(r)}function cc(e){return crypto.subtle.importKey("raw",e,{name:"AES-GCM"},!1,["encrypt","decrypt"])}async function ur(e,t,r){let n=Ps(Bn),o=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:n,additionalData:r},e,t)),i=new Uint8Array(kt.length+Bn+o.length);return i.set(kt,0),i.set(n,kt.length),i.set(o,kt.length+Bn),i}async function Qr(e,t,r){if(!Ye(t))throw new Error("passkey: missing envelope magic");if(t.length<kt.length+Bn+16)throw new Error("passkey: envelope too short");let n=t.subarray(kt.length,kt.length+Bn),o=t.subarray(kt.length+Bn);return new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:r},e,o))}function Ye(e){if(e.length<kt.length)return!1;for(let t=0;t<kt.length;t++)if(e[t]!==kt[t])return!1;return!0}async function Vh(e){if(!Lo())throw new Error("passkey: not supported in this environment");let t=Ps(32),r=Ps(32),n=await navigator.credentials.create({publicKey:{challenge:t,rp:{name:e.rpName,id:e.rpId},user:{id:e.userId,name:e.userName,displayName:e.userName},pubKeyCredParams:[{type:"public-key",alg:-7},{type:"public-key",alg:-257}],authenticatorSelection:{residentKey:"required",userVerification:"required"},extensions:{prf:{eval:{first:r}}},timeout:e.timeoutMs??12e4},...e.signal?{signal:e.signal}:{}});if(!(n instanceof PublicKeyCredential))throw new Error("passkey: registration returned no credential");let o=new Uint8Array(n.rawId).toBase64({alphabet:"base64url",omitPadding:!0}),i=n.getClientExtensionResults().prf,s=i?.results?.first?new Uint8Array(i.results.first):null;return{credentialId:o,prfSalt:r.toBase64({alphabet:"base64url",omitPadding:!0}),prfOutput:s}}async function dc(e){if(!Lo())throw new Error("passkey: not supported in this environment");let t=Ps(32),r=Uint8Array.fromBase64(e.credentialId,{alphabet:"base64url"}),n=Uint8Array.fromBase64(e.prfSalt,{alphabet:"base64url"}),o=await navigator.credentials.get({publicKey:{challenge:t,rpId:e.rpId,allowCredentials:[{type:"public-key",id:r}],userVerification:"required",extensions:{prf:{eval:{first:n}}},timeout:e.timeoutMs??12e4},...e.signal?{signal:e.signal}:{}});if(!(o instanceof PublicKeyCredential))throw new Error("passkey: assertion returned no credential");let s=o.getClientExtensionResults().prf?.results?.first;if(!s)throw new Error("passkey: authenticator did not return PRF output (extension unsupported)");return new Uint8Array(s)}var Po=Object.freeze(["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.sync.password","deepview.repoUrls","deepview.fileCounts","deepview.lastFile"]),We=new Map,Ns=!1,Yt=new Map,dt=new Map,Os=new Set;function Ln(e){let t=()=>e();return Os.add(t),Ns&&queueMicrotask(()=>{if(Os.has(t))try{t()}catch(r){console.warn("secure-storage after-hydrate listener:",r)}}),()=>Os.delete(t)}function Bk(){for(let e of Os)try{e()}catch(t){console.warn("secure-storage after-hydrate listener:",t)}}function Ds(e){let t=Gh()??"";return re(`deepview.secure.v1|${t}|${e}`)}function uc(e){try{let t=Uint8Array.fromBase64(e);if(Ye(t))return t}catch{}return null}function Re(e){return We.get(e)??null}async function Pe(e,t){if(typeof t!="string")throw new TypeError("secure-storage: value must be a string");if(se()&&!Oe())throw new Error(`secure-storage: vault locked, cannot save "${e}"`);if(Kh())throw new Error(`secure-storage: wipe in progress, cannot save "${e}"`);let r=We.has(e),n=We.get(e);We.set(e,t),dt.set(e,t);let o=Yt.get(e)??Promise.resolve(),i=()=>{dt.get(e)===t&&dt.delete(e)},s=o.catch(()=>{}).then(()=>Lk(e,t)).then(()=>i(),l=>{throw i(),We.get(e)===t&&(r?We.set(e,n):We.delete(e)),l});Yt.set(e,s.catch(()=>{})),await s}async function Pn(e){let t=Symbol("secure-storage:removed");We.delete(e),dt.set(e,t);let r=Yt.get(e)??Promise.resolve(),n=()=>{try{localStorage.removeItem(e)}catch{}dt.get(e)===t&&(dt.delete(e),We.delete(e))},o=r.catch(()=>{}).then(()=>n());Yt.set(e,o.catch(()=>{})),await o}async function Lk(e,t){let r=Oe();if(r){let n=await ur(r,re(t),Ds(e));localStorage.setItem(e,n.toBase64())}else localStorage.setItem(e,t)}async function pr(){Ns||Ie(()=>{pr().catch(r=>console.warn("secure-storage rehydrate:",r))}),Ns=!0;for(let r of[...We.keys()])dt.has(r)||We.delete(r);let e=Oe(),t=[];for(let r of Po){if(dt.has(r))continue;let n=localStorage.getItem(r);if(n===null)continue;let o=uc(n);if(o){if(!e)continue;try{let i=await Qr(e,o,Ds(r));if(dt.has(r))continue;We.set(r,Ae(i))}catch(i){console.warn(`secure-storage: decrypt failed for "${r}":`,i)}}else We.set(r,n),e&&se()&&t.push([r,n])}Bk(),t.length>0&&queueMicrotask(()=>{for(let[r,n]of t)We.get(r)===n&&Pe(r,n).catch(o=>{console.warn(`secure-storage: self-heal failed for "${r}":`,o)})})}async function jh(e,t){let r=Yt.get(e)??Promise.resolve(),n=async()=>{if(dt.has(e))return;let i=localStorage.getItem(e);if(i===null)return;let s=await t(i);s!==null&&(dt.has(e)||(localStorage.setItem(e,s.storageValue),We.set(e,s.cacheValue)))},o=r.catch(()=>{}).then(n);Yt.set(e,o.catch(()=>{})),await o}async function pc({seal:e}){for(let t of Po)await jh(t,async r=>{if(uc(r))return null;let n=Oe();return n?{storageValue:(await ur(n,re(r),Ds(t))).toBase64(),cacheValue:r}:null})}async function fc({open:e}){for(let t of Po)await jh(t,async r=>{let n=uc(r);if(!n)return null;let o=await e(n,Ds(t)),i=Ae(o);return{storageValue:i,cacheValue:i}})}var Pk="deepview.secure.v1.mutate:";function hc(e,t){return Po.includes(e)?navigator.locks.request(Pk+e,async()=>{let r=Yt.get(e);r&&await r.catch(()=>{}),await pr();let n=Re(e),o=await t(n);if(!(o==null||o===n)){if(typeof o!="string")throw new TypeError(`secure-storage: mutate updater for "${e}" must return a string`);await Pe(e,o)}}):Promise.reject(new Error(`secure-storage: mutate() called with non-secure key "${e}"`))}async function Wh(){await Promise.allSettled([...Yt.values()]),dt.clear(),Yt.clear()}typeof window<"u"&&window.addEventListener("storage",e=>{!Ns||!e.key||!Po.includes(e.key)||pr().catch(()=>{})});var Do="deepview.passkey.v1",On="deepview.passkey.userId",Us="deepview.passkey.cleanDisable",et="deepview.passkey.v1.write",Nk="deepview.triage.v1|",Dk="deepview.opfs.v1|",zk="deepview.bundle.v1|",ue=null,It=null,fr=null,No=0;function bc(){return No>0}var gc=0;function Kh(){return gc>0}function Zr(){try{let e=localStorage.getItem(Do);if(!e)return null;let t=JSON.parse(e);return t&&typeof t=="object"&&t.enabled===!0&&typeof t.credentialId=="string"&&t.credentialId.length>0&&typeof t.prfSalt=="string"&&t.prfSalt.length>0&&typeof t.userId=="string"&&t.userId.length>0?t:null}catch{return null}}function qh(e){localStorage.setItem(Do,JSON.stringify(e))}function Uk(){localStorage.removeItem(Do)}function Hk(){try{let t=localStorage.getItem(On);if(t){let r=Uint8Array.fromBase64(t,{alphabet:"base64url"});if(r.length===16)return r}}catch{}let e=new Uint8Array(16);crypto.getRandomValues(e);try{localStorage.setItem(On,e.toBase64({alphabet:"base64url",omitPadding:!0}))}catch{}return e}function Hs(){return typeof location>"u"?"":location.hostname}function se(){return Zr()!==null}function $t(){return ue!==null}function Mt(){return!(!Lo()||typeof navigator>"u"||!navigator.locks?.request||!Hs())}function Gh(){return It}function zo(){if(Zr()!==null)return!1;try{return localStorage.getItem(Us)==="1"?!1:localStorage.getItem(On)!==null}catch{return!1}}function Oe(){return ue}function Uo(){return re(Nk+(It??""))}function Vs(e){if(typeof e!="string")throw new TypeError("passkey vault: OPFS AAD requires a filename string");return re(Dk+(It??"")+"|"+e)}function js(e){if(typeof e!="string")throw new TypeError("passkey vault: bundle AAD requires a slot string");return re(zk+(It??"")+"|"+e)}var mc=new Set;function Ie(e){return mc.add(e),()=>mc.delete(e)}function Nn(){for(let e of mc)try{e()}catch(t){console.warn("passkey vault listener:",t)}}async function Ho({signal:e}={}){let t=Zr();if(!t)return!1;let r;try{r=await dc({credentialId:t.credentialId,prfSalt:t.prfSalt,rpId:t.rpId??Hs(),...e?{signal:e}:{}})}catch(o){if(o&&o.name==="NotAllowedError"||o&&o.name==="AbortError")return!1;throw o&&o.message?.includes("PRF")?Oo(o):o}if(!r||r.length<32)throw Oo();let n=await lc(r);return r.fill(0),navigator.locks.request(et,async()=>{let o=Zr();if(!o||o.credentialId!==t.credentialId)throw n.fill(0),new Error("passkey: vault state changed during unlock (another tab wiped or re-enabled it). Reload this page and try again.");return ue=await cc(n),n.fill(0),It=o.userId,fr=o.credentialId,Nn(),!0})}function Oo(e){let t=new Error("Your browser or authenticator doesn't support passkey-derived encryption keys (the WebAuthn PRF extension). Try Chrome 116+, Safari 18+, or Firefox 130+ on a device with a platform authenticator (TouchID / Windows Hello).");return e&&(t.cause=e),t}function yc({migrate:e,userName:t,rpName:r,signal:n,acknowledgeOrphan:o}){if(!Lo())throw new Error("passkey: WebAuthn unavailable in this environment");if(zo()&&!o)throw new Error("passkey: a previous vault exists on this device with no metadata. Any data encrypted under the old passkey will be unreadable after a new setup. Call enableEncryption({acknowledgeOrphan: true}) to proceed, or wipeAllVaultData() to start clean first.");let i=Hs();return navigator.locks.request(et,async()=>{if(se())throw new Error("passkey: encryption is already enabled");if(await Hh()===!1)throw Oo();let l=Hk(),d=await Vh({userName:t||"DeepView user",userId:l,rpName:r||"DeepView",rpId:i,...n?{signal:n}:{}}),u=d.prfOutput;if(!u)try{u=await dc({credentialId:d.credentialId,prfSalt:d.prfSalt,rpId:i,...n?{signal:n}:{}})}catch(b){let v=l.toBase64({alphabet:"base64url",omitPadding:!0});await zs({credentialId:d.credentialId,rpId:i,userId:v}).catch(()=>{});try{localStorage.removeItem(On)}catch{}throw b&&b.message?.includes("PRF")?Oo(b):b}if(!u||u.length<32){let b=l.toBase64({alphabet:"base64url",omitPadding:!0});await zs({credentialId:d.credentialId,rpId:i,userId:b}).catch(()=>{});try{localStorage.removeItem(On)}catch{}throw Oo()}let p=await lc(u);u.fill(0);let f=await cc(p);p.fill(0);let h=l.toBase64({alphabet:"base64url",omitPadding:!0}),m={enabled:!0,credentialId:d.credentialId,prfSalt:d.prfSalt,userId:h,rpId:i,createdAt:Date.now()};ue=f,It=h,fr=d.credentialId,qh(m),typeof e=="function"&&await e({seal:(v,y)=>ur(f,v,y)});try{localStorage.removeItem(Us)}catch{}return Nn(),!0})}async function vc({migrate:e}){if(!se())return{disabled:!1,signalAttempted:!1};if(!$t())throw new Error("passkey: must unlock before disabling encryption");No+=1;try{return await navigator.locks.request(et,async()=>{let t=Zr();if(!t)return{disabled:!1,signalAttempted:!1};let r=ue;if(!r)return{disabled:!1,signalAttempted:!1};if(Uk(),ue=null,fr=null,typeof e=="function"){let o=(i,s)=>Qr(r,i,s);try{await e({open:o})}catch(i){throw qh(t),ue=r,fr=t.credentialId,Nn(),i}}It=null;try{localStorage.setItem(Us,"1")}catch{}let n=await zs(t).catch(()=>!1);return Nn(),{disabled:!0,signalAttempted:n}})}finally{No-=1}}async function zs({credentialId:e,rpId:t,userId:r}){if(typeof PublicKeyCredential>"u"||!t)return!1;let n=PublicKeyCredential,o=!1;if(typeof n.signalUnknownCredential=="function"){o=!0;try{await n.signalUnknownCredential({rpId:t,credentialId:e})}catch{}}if(typeof n.signalAllAcceptedCredentials=="function"&&r){o=!0;try{await n.signalAllAcceptedCredentials({rpId:t,userId:r,allAcceptedCredentialIds:[]})}catch{}}return o}async function Vk(e,t){try{return await e.removeEntry(t,{recursive:!0}),null}catch(r){return r?.name==="NotFoundError"?null:`${t}: ${r?.message??String(r)}`}}async function jk(e){let t=[];if(typeof navigator>"u"||!navigator.storage?.getDirectory)return t;let r;try{r=await navigator.storage.getDirectory()}catch(n){return t.push(`storage root: ${n?.message??String(n)}`),t}for(let n of e){let o=await Vk(r,n);o&&t.push(o)}return t}async function Vo({refuseIfEnabled:e=!1}={}){No+=1,gc+=1;try{return await navigator.locks.request(et,async()=>{if(e&&se())throw new Error("passkey: encryption was just enabled in another tab. Reload this page to unlock instead of wiping.");await Wh();let t=Zr();if(t)try{await zs({credentialId:t.credentialId,rpId:t.rpId??Hs(),userId:t.userId})}catch{}try{localStorage.removeItem(Do)}catch{}try{localStorage.removeItem(On)}catch{}try{localStorage.removeItem(Us)}catch{}for(let n of["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.repoUrls","deepview.fileCounts","deepview.lastFile","deepview.triage","deepview.triage.pending","deepview.passkey.firstImportPrompted","deepview.viewMode"])try{localStorage.removeItem(n)}catch{}try{let n=[];for(let o=0;o<localStorage.length;o+=1){let i=localStorage.key(o);i&&i.startsWith("deepview.report:")&&n.push(i)}for(let o of n)try{localStorage.removeItem(o)}catch{}}catch{}ue=null,It=null,fr=null,Nn();let r=await jk(["deepview-reports","deepview-bundles"]);if(r.length>0)throw new Error(`passkey: wipe partially succeeded \u2014 localStorage cleared but the following OPFS paths could not be removed: ${r.join("; ")}. Open DevTools \u2192 Application \u2192 Storage \u2192 Origin Private File System to inspect, or use the browser's site-data clear tool to finish.`)})}finally{No-=1,gc-=1}}function Yh(e){return ue?ur(ue,e,Uo()):Promise.reject(new Error("passkey: vault locked, cannot seal triage"))}function Xh(e){return ue?Qr(ue,e,Uo()):Promise.reject(new Error("passkey: vault locked, cannot open triage"))}function Ws(e,t){return ue?ur(ue,e,Vs(t)):Promise.reject(new Error("passkey: vault locked, cannot seal OPFS file"))}function Jh(e,t){return ue?Qr(ue,e,Vs(t)):Promise.reject(new Error("passkey: vault locked, cannot open OPFS file"))}function wc(e,t){return ue?ur(ue,e,js(t)):Promise.reject(new Error("passkey: vault locked, cannot seal bundle"))}function kc(e,t){return ue?Qr(ue,e,js(t)):Promise.reject(new Error("passkey: vault locked, cannot open bundle"))}typeof window<"u"&&window.addEventListener("storage",e=>{if(e.key!==Do)return;let t=Zr();(!t&&ue||t&&ue&&t.credentialId!==fr)&&(ue=null,It=null,fr=null),Nn()});var Sc="__meta__",Wk="deepview-reports",_c="deepview-bundles",gr="deepview.report:",Qh=!1;async function Cc(e,{create:t,warnOnce:r=!1}={}){try{return await(await navigator.storage.getDirectory()).getDirectoryHandle(e,{create:t})}catch(n){return r&&!Qh&&(Qh=!0,console.warn("OPFS unavailable, falling back to gzipped localStorage (limited quota).",n)),null}}async function Gs(e,t){let r=await e.createWritable();try{await r.write(t),await r.close()}catch(n){try{await r.abort(n)}catch{}throw n}}async function Ec(e,t){if(!Ye(e))return e;if(!Oe())throw new Error(`storage: vault locked, cannot decrypt "${t}"`);return await Jh(e,t)}function qs(e){return e.length===0?!0:e.length>=18&&e[0]===31&&e[1]===139&&e.at(-4)===0&&e.at(-3)===0&&e.at(-2)===0&&e.at(-1)===0}async function Ac(e,t){Wo(e)===t&&(console.warn(`storage: report "${e}" is an empty/corrupt on-disk entry \u2014 quarantining, will read as missing`),await navigator.locks.request(et,{mode:"exclusive"},async()=>{if(Wo(e)!==t)return;fe(e),ut.delete(e);let r=await mr();if(r)try{await r.removeEntry(e)}catch{}Ys(e),fe(e),en(e,"delete")}))}async function Tc(e,t,r){try{(await t.getFile()).size===0&&await e.removeEntry(r)}catch{}}async function jo(e,t,r,n,o=()=>{}){if(se()&&!Oe())throw o(),new Error(`storage: vault locked, cannot save ${n}`);let i=Oe(),s=i?await t(e,r):e;if(Oe()!==i)throw o(),new Error(`storage: vault state changed mid-save for ${n}; retry`);return s}function mr(){return Cc(Wk,{create:!0,warnOnce:!0})}function Ks(e){try{return localStorage.getItem(gr+e)}catch{return null}}function Ys(e){try{localStorage.removeItem(gr+e)}catch{}}function Kk(){let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r&&r.startsWith(gr)&&e.push(r.slice(gr.length))}return e}var ut=new Map,hr=new Map,$c=new Map;function fe(e){$c.set(e,($c.get(e)??0)+1)}function Wo(e){return $c.get(e)??0}var xc=new Set;function Go(e){return xc.add(e),()=>xc.delete(e)}function en(e,t){for(let r of xc)try{r(e,t)}catch(n){console.warn("storage file-change listener:",n)}}async function le(){let e=new Set(Kk()),t=await mr();if(t)for await(let[r]of t.entries())e.add(r);return[...e].toSorted()}async function pt(e,t){if(typeof e!="string"||e.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");if(t==="")throw new Error(`Refusing to save empty report "${e}"`);return fe(e),navigator.locks.request(et,{mode:"shared"},async()=>{let r=await mr();if(r){let i=await Fo(re(t));i=await jo(i,Ws,e,`"${e}"`,()=>fe(e));let s=await r.getFileHandle(e,{create:!0}),l=await s.createWritable();try{await l.write(i),await l.close()}catch(d){ut.delete(e),fe(e);try{await l.abort(d)}catch{}throw await Tc(r,s,e),d}ut.set(e,t),fe(e),Ys(e),en(e,"save");return}let n=re(t);n=await Fo(n),n=await jo(n,Ws,e,`"${e}"`,()=>fe(e));let o=n.toBase64();try{localStorage.setItem(gr+e,o),ut.set(e,t),fe(e),en(e,"save")}catch(i){throw fe(e),new Error(`localStorage write failed for ${e}: ${i.message}`,{cause:i})}})}async function Zh(e,t){let r=Ks(e);if(r===null)return null;let n=Uint8Array.fromBase64(r);if(n=await Ec(n,e),qs(n))throw await Ac(e,t),new Error(`File not found: ${e}`);return Ae(await Rt(n))}async function Ne(e){if(ut.has(e))return ut.get(e);if(hr.has(e))return hr.get(e);let t=Wo(e),r=(async()=>{let n=await mr();if(n){let i;try{i=await n.getFileHandle(e)}catch(u){if(u instanceof DOMException&&u.name==="NotFoundError"){let p=await Zh(e,t);if(p!==null)return pt(e,p).catch(f=>{console.warn(`storage: stranded-localStorage migration of "${e}" failed:`,f)}),p}throw u}let s=await i.getFile(),l=new Uint8Array(await s.arrayBuffer());if(l=await Ec(l,e),qs(l))throw await Ac(e,t),new Error(`File not found: ${e}`);if(l.length>=2&&l[0]===31&&l[1]===139){let u=await Rt(l);return Ae(u)}let d=Ae(l);return pt(e,d).catch(u=>{console.warn(`storage: legacy-uncompressed migration of "${e}" failed:`,u)}),d}let o=await Zh(e,t);if(o===null)throw new Error(`File not found: ${e}`);return o})();hr.set(e,r);try{let n=await r;return Wo(e)===t&&ut.set(e,n),n}finally{hr.delete(e)}}async function tn(e){let t=Wo(e),r=await mr(),n;if(r){let o=null;try{o=await r.getFileHandle(e)}catch(i){if(!(i instanceof DOMException)||i.name!=="NotFoundError")throw i;let s=Ks(e);if(s===null)throw i;n=Uint8Array.fromBase64(s)}if(o){let i=await o.getFile();n=new Uint8Array(await i.arrayBuffer())}}else{let o=Ks(e);if(o===null)throw new Error(`File not found: ${e}`);n=Uint8Array.fromBase64(o)}if(n=await Ec(n,e),qs(n))throw await Ac(e,t),new Error(`File not found: ${e}`);return n}async function qo(e,t){if(typeof e!="string"||e.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");if(qs(t))throw new Error(`Refusing to save empty report bytes for "${e}"`);return fe(e),ut.delete(e),navigator.locks.request(et,{mode:"shared"},async()=>{let r=await jo(t,Ws,e,`"${e}"`,()=>fe(e)),n=await mr();if(n){let o=await n.getFileHandle(e,{create:!0}),i=await o.createWritable();try{await i.write(r),await i.close()}catch(s){fe(e);try{await i.abort(s)}catch{}throw await Tc(n,o,e),s}fe(e),Ys(e),en(e,"save");return}try{localStorage.setItem(gr+e,r.toBase64()),fe(e),en(e,"save")}catch(o){throw fe(e),new Error(`localStorage write failed for ${e}: ${o.message}`,{cause:o})}})}async function Dn(e){return fe(e),ut.delete(e),hr.delete(e),navigator.locks.request(et,{mode:"shared"},async()=>{let t=await mr();if(t){try{await t.removeEntry(e)}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw fe(e),r}Ys(e),fe(e),en(e,"delete");return}localStorage.removeItem(gr+e),fe(e),en(e,"delete")})}var Ko="_meta.json";function Yo(){return Cc(_c,{create:!0})}function Rc(e){return e.replaceAll("/","_")}async function Ic(e){let t;try{let o=await(await e.getFileHandle(Ko)).getFile();t=new Uint8Array(await o.arrayBuffer())}catch(n){return n instanceof DOMException&&n.name==="NotFoundError"?[]:(console.warn("readBundleMeta: failed to read _meta.json:",n),[])}let r=t;if(Ye(t)){if(!Oe())return console.warn("readBundleMeta: vault locked, returning empty bundle list"),[];try{r=await kc(t,Sc)}catch(o){return console.warn("readBundleMeta: decrypt failed (tampering, key mismatch, or vault identity drift):",o),[]}}try{let n=JSON.parse(Ae(r));return Array.isArray(n)?n:[]}catch(n){return console.warn("readBundleMeta: JSON.parse failed:",n),[]}}async function eg(e,t){let r=re(JSON.stringify(t));r=await jo(r,wc,Sc,"bundle metadata");try{await e.removeEntry(Ko)}catch{}let n=await e.getFileHandle(Ko,{create:!0});await Gs(n,r)}var Gk=`${_c}/${Ko}`;function tg(e){return navigator.locks.request(Gk,e)}async function xt(){let e=await Yo();return e?[...await Ic(e)].toSorted((r,n)=>r.name.localeCompare(n.name)):[]}async function Xo(){if(typeof navigator>"u"||!navigator.storage?.getDirectory)return!1;let e=await Cc(_c,{create:!1});if(!e)return!1;try{for await(let t of e.entries())return!0}catch{}return!1}async function rn(e,t){let r=await Yo();if(!r)throw new Error(`Cannot save bundle ${e}: OPFS unavailable`);let n=t instanceof Uint8Array?t:re(t),o=await Uh(n),i=Rc(o),s=e.toLowerCase().endsWith(".map")?await Fo(n):n;return navigator.locks.request(et,{mode:"shared"},async()=>{s=await jo(s,wc,o,`bundle "${e}"`);try{await r.removeEntry(i)}catch{}let l=await r.getFileHandle(i,{create:!0});await Gs(l,s);try{await tg(async()=>{let d=await Ic(r),u=d.findIndex(p=>p.integrity===o);u>=0?d[u]={integrity:o,name:e}:d.push({integrity:o,name:e}),await eg(r,d)})}catch(d){try{await r.removeEntry(i)}catch{}throw d}return{integrity:o,name:e}})}async function Mc(e){let t=await Yo();if(t)return navigator.locks.request(et,{mode:"shared"},async()=>{try{await t.removeEntry(Rc(e))}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw r}await tg(async()=>{let r=await Ic(t),n=r.filter(o=>o.integrity!==e);n.length!==r.length&&await eg(t,n)})})}async function Xt(e){let t=await Yo();if(!t)throw new Error("OPFS unavailable");let n=await(await t.getFileHandle(Rc(e))).getFile(),o=new Uint8Array(await n.arrayBuffer());if(Ye(o)){if(!Oe())throw new Error(`storage: vault locked, cannot read bundle "${e}"`);o=await kc(o,e)}return o.length>=2&&o[0]===31&&o[1]===139?await Rt(o):o}async function qk(e,t){let r=await mr();if(r){let s=null;try{s=await r.getFileHandle(e)}catch(l){if(!(l instanceof DOMException)||l.name!=="NotFoundError")throw l}if(s){let l=await s.getFile(),d=new Uint8Array(await l.arrayBuffer()),u=await t(d);if(u===null)return;ut.delete(e),hr.delete(e),fe(e);let p=await r.getFileHandle(e,{create:!0});try{await Gs(p,u)}catch(f){throw await Tc(r,p,e),f}fe(e);return}}let n=Ks(e);if(n===null)return;let o=Uint8Array.fromBase64(n),i=await t(o);i!==null&&(ut.delete(e),hr.delete(e),fe(e),localStorage.setItem(gr+e,i.toBase64()),fe(e))}function rg(e,t){return e.seal?r=>Ye(r)?null:e.seal(r,t):r=>Ye(r)?e.open(r,t):null}async function ng(e){let t=await le();for(let r of t)try{await qk(r,rg(e,Vs(r)))}catch(n){if(n instanceof DOMException&&n.name==="NotFoundError")continue;throw n}}var Fc=({seal:e})=>ng({seal:e}),Bc=({open:e})=>ng({open:e});async function Yk(){let e=await Yo();if(!e)return{dir:null,keys:[]};let t=[];for await(let[r]of e.entries())t.push(r);return{dir:e,keys:t}}function Xk(e){return e===Ko?Sc:e.startsWith("sha512-")?e.replaceAll("_","/"):null}async function Jk(e,t,r){let o=await(await e.getFileHandle(t)).getFile(),i=new Uint8Array(await o.arrayBuffer()),s=await r(i);if(s===null)return;let l=await e.getFileHandle(t,{create:!0});await Gs(l,s)}async function og(e){let{dir:t,keys:r}=await Yk();if(t)for(let n of r){let o=Xk(n);if(o!==null)try{await Jk(t,n,rg(e,js(o)))}catch(i){if(i instanceof DOMException&&i.name==="NotFoundError")continue;throw i}}}var Lc=({seal:e})=>og({seal:e}),Pc=({open:e})=>og({open:e});Ie(()=>{ut.clear(),hr.clear()});var Xs="/api/config";var ig="deepview.sync.serverInfo";function Js(e){if(e==null||typeof e!="object")return null;let t=e.mode;if(t!=="e2e"&&t!=="managed")return null;let r=null,n=e.managed;if(n!=null&&typeof n=="object"){let o=n.loginPath,i=n.cookieName;typeof o=="string"&&typeof i=="string"&&(r={loginPath:o,cookieName:i})}return{mode:t,managed:r}}function Jt(){try{let e=localStorage.getItem(ig);return e==null?null:Js(JSON.parse(e))}catch{return null}}function Oc(e){try{localStorage.setItem(ig,JSON.stringify(e))}catch{}}function Nc(e,t){return e==null?"first":e===t?"match":"mismatch"}var Zs="deepview.viewMode",ea="deepview.severityMode",Qs="deepview.repoUrls",ta="deepview.focusSplit",ra="deepview.kanbanDetailFullscreen",Qk=new Set(["grouped","list","table","kanban","focus"]),Zk=new Set(["corrected","original"]),Jo=50,na=20,oa=80;function e$(){try{let e=localStorage.getItem(Zs);return e!==null&&Qk.has(e)?e:null}catch{return null}}function t$(){try{let e=localStorage.getItem(ea);return e!==null&&Zk.has(e)?e:null}catch{return null}}function r$(){try{let e=localStorage.getItem(ra);return e==="true"?!0:e==="false"?!1:null}catch{return null}}function Qo(e){if(!Number.isFinite(e))return Jo;let t=Math.round(e*10)/10;return Math.min(Math.max(t,na),oa)}function n$(){try{let e=localStorage.getItem(ta);if(e===null||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?Qo(t):null}catch{return null}}function zc(e){try{let t=JSON.parse(e||"{}");return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function ia(){return zc(Re(Qs))}function tt(e){return e?ia()[e]??"":""}var Dc=new Set;function ag(e){return Dc.add(e),()=>{Dc.delete(e)}}function o$(e){for(let t of Dc)try{t(e)}catch(r){console.warn("repo-url listener:",r)}}function rt(e,t){if(!e)return;let r=ia();t?r[e]=t:delete r[e],Pe(Qs,JSON.stringify(r)).catch(n=>console.warn("saveRepoUrlFor:",n)),hc(Qs,n=>{let o=zc(n);return t?o[e]=t:delete o[e],JSON.stringify(o)}).catch(n=>console.warn("saveRepoUrlFor cross-tab merge:",n)),o$(e)}async function lg(e,t){await hc(Qs,r=>{let n=zc(r),o=t==="replace"?{...e}:t==="prefer-imported"?{...n,...e}:{...e,...n};return JSON.stringify(o)}),cg()}var sg=Jt(),a=Lh({reports:[],workspaceMerges:[],currentFile:null,currentWorkspace:null,currentView:"findings",bundles:[],selectedBundle:null,bundleDetails:null,bundleDetailsTab:"overview",selectedPackage:null,selectedPackageVersion:null,packageDetailsTab:"overview",packageSlideTriage:null,packageSlideTransient:!1,packagesSearchQuery:"",packagesSortBy:"findings-desc",expandedPackages:new Set,selectedRepository:null,repositoryDetailsTab:"overview",repositorySlideTriage:null,repositorySlideTransient:!1,repositoriesSearchQuery:"",repositoriesSortBy:"findings-desc",bundleSourceFile:null,bundleSourceFindingIdx:null,bundleCodeSearchMode:"files",bundleCodeSearchQuery:"",bundleSearchQuery:"",bundleSearchRegex:!1,bundleSearchCase:!1,bundleSearchContext:!0,filterSeverities:new Set,filterColors:new Set,filterSources:new Set,filterAnalyzer:"",filterModel:"",filterRepo:"",filterRevalidate:"",filterPartial:"",showRevalidation:!0,codePreviews:new Set,filterConfMin:0,filterConfMax:10,filterInclude:"",filterIncludeNegate:!1,filterComment:"",filterFix:"",filterFlagged:"",repoUrl:"",repoEditing:!1,sortBy:"severity",viewMode:e$()??"kanban",severityMode:t$()??"corrected",triage:new Map,shownTriage:null,nextFindingId:0,activeTabByGroup:new Map,tableSelectedGid:null,filesViewMode:"table",filesSearch:"",filesSelectedFile:null,kanbanPopoverGid:null,kanbanDetailFullscreen:r$()??!1,kanbanExpandedColumn:null,focusGid:null,focusCodeTick:0,focusCodeStack:[],focusCodeAt:0,focusSplit:n$()??Jo,codeBlockTick:0,bundleHashTick:0,serverMode:sg?.mode??"e2e",managed:sg?.managed??null,serverModeMismatch:!1,managedSession:null,managedTeams:[]});function cg(){a.repoEditing||a.currentFile&&(a.repoUrl=tt(a.currentFile))}Ln(()=>{cg()});var i$=/^## ([A-Z][A-Z_]*)\s*\(\d+\)\s*$/mu;function s$(e){switch(e.toUpperCase()){case"CRITICAL":return"critical";case"HIGH":return"high";case"MEDIUM":return"medium";case"LOW":return"low";case"HIGH_BUG":return"high_bug";case"BUG":return"bug";case"INFO":case"INFORMATIONAL":return"informational";default:return"medium"}}function a$(e){if(e)switch(e.toLowerCase()){case"high":return 8;case"medium":return 5;case"low":return 2;default:return}}function l$(e){return typeof e=="string"?e.replace(/^`(.*)`$/u,"$1"):e}function zn(e){let t=e.replaceAll(/\r\n?/gu,`
4
- `).trim();if(!i$.test(t))return null;let r=t.split(/^## ([A-Z][A-Z_]*)\s*\(\d+\)\s*\n/mu),n=[];for(let o=1;o<r.length;o+=2){let i=s$(r[o]),l=(r[o+1]||"").split(/^### /mu).slice(1);for(let d of l){let u=c$(d,i);u&&n.push(u)}}return n.length===0?null:{type:"security",source:"deepsec",findings:n}}function c$(e,t){let r=e.indexOf(`
5
- `),n=(r===-1?e:e.slice(0,r)).trim();if(!n)return null;let o=r===-1?"":e.slice(r+1);o=o.replace(/\n---\s*$/u,"").trim();let i={};for(let v of o.matchAll(/^- \*\*([^:*]+):\*\*\s*(.+)$/gmu))i[v[1].trim().toLowerCase()]=v[2].trim();let s=/^\*\*Recommendation:\*\*\s*/mu.exec(o),l=o,d="";s&&(l=o.slice(0,s.index),d=o.slice(s.index+s[0].length).trim());let u=l.split(`
1
+ var B5=Object.defineProperty;var w=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var O5=(t,e)=>{for(var r in e)B5(t,r,{get:e[r],enumerable:!0})};var Qc,ed,Nf,Ok,ba,A,Qe,Pk,Df,zf=w(()=>{Qc=globalThis,ed=Qc.ShadowRoot&&(Qc.ShadyCSS===void 0||Qc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Nf=Symbol(),Ok=new WeakMap,ba=class{constructor(e,r,n){if(this._$cssResult$=!0,n!==Nf)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=r}get styleSheet(){let e=this.o,r=this.t;if(ed&&e===void 0){let n=r!==void 0&&r.length===1;n&&(e=Ok.get(r)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Ok.set(r,e))}return e}toString(){return this.cssText}},A=t=>new ba(typeof t=="string"?t:t+"",void 0,Nf),Qe=(t,...e)=>{let r=t.length===1?t[0]:e.reduce((n,o,i)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+t[i+1],t[0]);return new ba(r,t,Nf)},Pk=(t,e)=>{if(ed)t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(let r of e){let n=document.createElement("style"),o=Qc.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=r.cssText,t.appendChild(n)}},Df=ed?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let r="";for(let n of e.cssRules)r+=n.cssText;return A(r)})(t):t});var P5,N5,D5,z5,U5,H5,td,Nk,j5,V5,ya,Uf,zk,Dk,un,rd=w(()=>{zf();zf();({is:P5,defineProperty:N5,getOwnPropertyDescriptor:D5,getOwnPropertyNames:z5,getOwnPropertySymbols:U5,getPrototypeOf:H5}=Object),td=globalThis,Nk=td.trustedTypes,j5=Nk?Nk.emptyScript:"",V5=td.reactiveElementPolyfillSupport,ya=(t,e)=>t,Uf={toAttribute(t,e){switch(e){case Boolean:t=t?j5:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=t!==null;break;case Number:r=t===null?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch{r=null}}return r}},zk=(t,e)=>!P5(t,e),Dk={attribute:!0,type:String,converter:Uf,reflect:!1,useDefault:!1,hasChanged:zk};Symbol.metadata??=Symbol("metadata"),td.litPropertyMetadata??=new WeakMap;un=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,r=Dk){if(r.state&&(r.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((r=Object.create(r)).wrapped=!0),this.elementProperties.set(e,r),!r.noAccessor){let n=Symbol(),o=this.getPropertyDescriptor(e,n,r);o!==void 0&&N5(this.prototype,e,o)}}static getPropertyDescriptor(e,r,n){let{get:o,set:i}=D5(this.prototype,e)??{get(){return this[r]},set(s){this[r]=s}};return{get:o,set(s){let a=o?.call(this);i?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Dk}static _$Ei(){if(this.hasOwnProperty(ya("elementProperties")))return;let e=H5(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ya("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ya("properties"))){let r=this.properties,n=[...z5(r),...U5(r)];for(let o of n)this.createProperty(o,r[o])}let e=this[Symbol.metadata];if(e!==null){let r=litPropertyMetadata.get(e);if(r!==void 0)for(let[n,o]of r)this.elementProperties.set(n,o)}this._$Eh=new Map;for(let[r,n]of this.elementProperties){let o=this._$Eu(r,n);o!==void 0&&this._$Eh.set(o,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let r=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let o of n)r.unshift(Df(o))}else e!==void 0&&r.push(Df(e));return r}static _$Eu(e,r){let n=r.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,r=this.constructor.elementProperties;for(let n of r.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Pk(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,r,n){this._$AK(e,n)}_$ET(e,r){let n=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,n);if(o!==void 0&&n.reflect===!0){let i=(n.converter?.toAttribute!==void 0?n.converter:Uf).toAttribute(r,n.type);this._$Em=e,i==null?this.removeAttribute(o):this.setAttribute(o,i),this._$Em=null}}_$AK(e,r){let n=this.constructor,o=n._$Eh.get(e);if(o!==void 0&&this._$Em!==o){let i=n.getPropertyOptions(o),s=typeof i.converter=="function"?{fromAttribute:i.converter}:i.converter?.fromAttribute!==void 0?i.converter:Uf;this._$Em=o;let a=s.fromAttribute(r,i.type);this[o]=a??this._$Ej?.get(o)??a,this._$Em=null}}requestUpdate(e,r,n,o=!1,i){if(e!==void 0){let s=this.constructor;if(o===!1&&(i=this[e]),n??=s.getPropertyOptions(e),!((n.hasChanged??zk)(i,r)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,n))))return;this.C(e,r,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,r,{useDefault:n,reflect:o,wrapped:i},s){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??r??this[e]),i!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(r=void 0),this._$AL.set(e,r)),o===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(r){Promise.reject(r)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[o,i]of this._$Ep)this[o]=i;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[o,i]of n){let{wrapped:s}=i,a=this[o];s!==!0||this._$AL.has(o)||a===void 0||this.C(o,void 0,i,a)}}let e=!1,r=this._$AL;try{e=this.shouldUpdate(r),e?(this.willUpdate(r),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(r)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(r)}willUpdate(e){}_$AE(e){this._$EO?.forEach(r=>r.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(r=>this._$ET(r,this[r])),this._$EM()}updated(e){}firstUpdated(e){}};un.elementStyles=[],un.shadowRootOptions={mode:"open"},un[ya("elementProperties")]=new Map,un[ya("finalized")]=new Map,V5?.({ReactiveElement:un}),(td.reactiveElementVersions??=[]).push("2.1.2")});function Xk(t,e){if(!Kf(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Hk!==void 0?Hk.createHTML(e):e}function Wo(t,e,r=t,n){if(e===je)return e;let o=n!==void 0?r._$Co?.[n]:r._$Cl,i=ka(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(t),o._$AT(t,r,n)),n!==void 0?(r._$Co??=[])[n]=o:r._$Cl=o),o!==void 0&&(e=Wo(t,o._$AS(t,e.values),o,n)),e}var jf,Uk,nd,Hk,Vf,pn,Wf,W5,Vo,wa,ka,Kf,qk,Hf,va,jk,Vk,Ho,Wk,Kk,Yk,Gf,d,Wn,YP,je,m,Gk,jo,Jk,xa,od,qi,Ko,id,sd,ad,ld,Zk,K5,ie,Lr=w(()=>{jf=globalThis,Uk=t=>t,nd=jf.trustedTypes,Hk=nd?nd.createPolicy("lit-html",{createHTML:t=>t}):void 0,Vf="$lit$",pn=`lit$${Math.random().toFixed(9).slice(2)}$`,Wf="?"+pn,W5=`<${Wf}>`,Vo=document,wa=()=>Vo.createComment(""),ka=t=>t===null||typeof t!="object"&&typeof t!="function",Kf=Array.isArray,qk=t=>Kf(t)||typeof t?.[Symbol.iterator]=="function",Hf=`[
2
+ \f\r]`,va=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,jk=/-->/g,Vk=/>/g,Ho=RegExp(`>|${Hf}(?:([^\\s"'>=/]+)(${Hf}*=${Hf}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Wk=/'/g,Kk=/"/g,Yk=/^(?:script|style|textarea|title)$/i,Gf=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),d=Gf(1),Wn=Gf(2),YP=Gf(3),je=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Gk=new WeakMap,jo=Vo.createTreeWalker(Vo,129);Jk=(t,e)=>{let r=t.length-1,n=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=va;for(let a=0;a<r;a++){let c=t[a],u,p,f=-1,h=0;for(;h<c.length&&(s.lastIndex=h,p=s.exec(c),p!==null);)h=s.lastIndex,s===va?p[1]==="!--"?s=jk:p[1]!==void 0?s=Vk:p[2]!==void 0?(Yk.test(p[2])&&(o=RegExp("</"+p[2],"g")),s=Ho):p[3]!==void 0&&(s=Ho):s===Ho?p[0]===">"?(s=o??va,f=-1):p[1]===void 0?f=-2:(f=s.lastIndex-p[2].length,u=p[1],s=p[3]===void 0?Ho:p[3]==='"'?Kk:Wk):s===Kk||s===Wk?s=Ho:s===jk||s===Vk?s=va:(s=Ho,o=void 0);let g=s===Ho&&t[a+1].startsWith("/>")?" ":"";i+=s===va?c+W5:f>=0?(n.push(u),c.slice(0,f)+Vf+c.slice(f)+pn+g):c+pn+(f===-2?a:g)}return[Xk(t,i+(t[r]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},xa=class t{constructor({strings:e,_$litType$:r},n){let o;this.parts=[];let i=0,s=0,a=e.length-1,c=this.parts,[u,p]=Jk(e,r);if(this.el=t.createElement(u,n),jo.currentNode=this.el.content,r===2||r===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(o=jo.nextNode())!==null&&c.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let f of o.getAttributeNames())if(f.endsWith(Vf)){let h=p[s++],g=o.getAttribute(f).split(pn),y=/([.?@])?(.*)/.exec(h);c.push({type:1,index:i,name:y[2],strings:g,ctor:y[1]==="."?id:y[1]==="?"?sd:y[1]==="@"?ad:Ko}),o.removeAttribute(f)}else f.startsWith(pn)&&(c.push({type:6,index:i}),o.removeAttribute(f));if(Yk.test(o.tagName)){let f=o.textContent.split(pn),h=f.length-1;if(h>0){o.textContent=nd?nd.emptyScript:"";for(let g=0;g<h;g++)o.append(f[g],wa()),jo.nextNode(),c.push({type:2,index:++i});o.append(f[h],wa())}}}else if(o.nodeType===8)if(o.data===Wf)c.push({type:2,index:i});else{let f=-1;for(;(f=o.data.indexOf(pn,f+1))!==-1;)c.push({type:7,index:i}),f+=pn.length-1}i++}}static createElement(e,r){let n=Vo.createElement("template");return n.innerHTML=e,n}};od=class{constructor(e,r){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:r},parts:n}=this._$AD,o=(e?.creationScope??Vo).importNode(r,!0);jo.currentNode=o;let i=jo.nextNode(),s=0,a=0,c=n[0];for(;c!==void 0;){if(s===c.index){let u;c.type===2?u=new qi(i,i.nextSibling,this,e):c.type===1?u=new c.ctor(i,c.name,c.strings,this,e):c.type===6&&(u=new ld(i,this,e)),this._$AV.push(u),c=n[++a]}s!==c?.index&&(i=jo.nextNode(),s++)}return jo.currentNode=Vo,o}p(e){let r=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,r),r+=n.strings.length-2):n._$AI(e[r])),r++}},qi=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,r,n,o){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=e,this._$AB=r,this._$AM=n,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,r=this._$AM;return r!==void 0&&e?.nodeType===11&&(e=r.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,r=this){e=Wo(this,e,r),ka(e)?e===m||e==null||e===""?(this._$AH!==m&&this._$AR(),this._$AH=m):e!==this._$AH&&e!==je&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):qk(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==m&&ka(this._$AH)?this._$AA.nextSibling.data=e:this.T(Vo.createTextNode(e)),this._$AH=e}$(e){let{values:r,_$litType$:n}=e,o=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=xa.createElement(Xk(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(r);else{let i=new od(o,this),s=i.u(this.options);i.p(r),this.T(s),this._$AH=i}}_$AC(e){let r=Gk.get(e.strings);return r===void 0&&Gk.set(e.strings,r=new xa(e)),r}k(e){Kf(this._$AH)||(this._$AH=[],this._$AR());let r=this._$AH,n,o=0;for(let i of e)o===r.length?r.push(n=new t(this.O(wa()),this.O(wa()),this,this.options)):n=r[o],n._$AI(i),o++;o<r.length&&(this._$AR(n&&n._$AB.nextSibling,o),r.length=o)}_$AR(e=this._$AA.nextSibling,r){for(this._$AP?.(!1,!0,r);e!==this._$AB;){let n=Uk(e).nextSibling;Uk(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Ko=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,r,n,o,i){this.type=1,this._$AH=m,this._$AN=void 0,this.element=e,this.name=r,this._$AM=o,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=m}_$AI(e,r=this,n,o){let i=this.strings,s=!1;if(i===void 0)e=Wo(this,e,r,0),s=!ka(e)||e!==this._$AH&&e!==je,s&&(this._$AH=e);else{let a=e,c,u;for(e=i[0],c=0;c<i.length-1;c++)u=Wo(this,a[n+c],r,c),u===je&&(u=this._$AH[c]),s||=!ka(u)||u!==this._$AH[c],u===m?e=m:e!==m&&(e+=(u??"")+i[c+1]),this._$AH[c]=u}s&&!o&&this.j(e)}j(e){e===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},id=class extends Ko{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===m?void 0:e}},sd=class extends Ko{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==m)}},ad=class extends Ko{constructor(e,r,n,o,i){super(e,r,n,o,i),this.type=5}_$AI(e,r=this){if((e=Wo(this,e,r,0)??m)===je)return;let n=this._$AH,o=e===m&&n!==m||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==m&&(n===m||o);o&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},ld=class{constructor(e,r,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Wo(this,e)}},Zk={M:Vf,P:pn,A:Wf,C:1,L:Jk,R:od,D:qk,V:Wo,I:qi,H:Ko,N:sd,U:ad,B:id,F:ld},K5=jf.litHtmlPolyfillSupport;K5?.(xa,qi),(jf.litHtmlVersions??=[]).push("3.3.3");ie=(t,e,r)=>{let n=r?.renderBefore??e,o=n._$litPart$;if(o===void 0){let i=r?.renderBefore??null;n._$litPart$=o=new qi(e.insertBefore(wa(),i),i,void 0,r??{})}return o._$AI(t),o}});var qf,J,G5,Qk=w(()=>{rd();rd();Lr();Lr();qf=globalThis,J=class extends un{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ie(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return je}};J._$litElement$=!0,J.finalized=!0,qf.litElementHydrateSupport?.({LitElement:J});G5=qf.litElementPolyfillSupport;G5?.({LitElement:J});(qf.litElementVersions??=[]).push("4.2.2")});var e0=w(()=>{});var M=w(()=>{rd();Lr();Qk();e0()});var yt,Fr,Qt,Yi=w(()=>{yt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Fr=t=>(...e)=>({_$litDirective$:t,values:e}),Qt=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,r,n){this._$Ct=e,this._$AM=r,this._$Ci=n}_$AS(e,r){return this.update(e,r)}update(e,r){return this.render(...r)}}});var I,t0=w(()=>{Lr();Yi();I=Fr(class extends Qt{constructor(t){if(super(t),t.type!==yt.ATTRIBUTE||t.name!=="class"||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){if(this.st===void 0){this.st=new Set,t.strings!==void 0&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(n=>n!=="")));for(let n in e)e[n]&&!this.nt?.has(n)&&this.st.add(n);return this.render(e)}let r=t.element.classList;for(let n of this.st)n in e||(r.remove(n),this.st.delete(n));for(let n in e){let o=!!e[n];o===this.st.has(n)||this.nt?.has(n)||(o?(r.add(n),this.st.add(n)):(r.remove(n),this.st.delete(n)))}return je}})});var Me=w(()=>{t0()});var q5,r0,o0,n0,Xi,Kn,Y5,cd,i0,dd,Yf=w(()=>{Lr();({I:q5}=Zk),r0=t=>t,o0=t=>t.strings===void 0,n0=()=>document.createComment(""),Xi=(t,e,r)=>{let n=t._$AA.parentNode,o=e===void 0?t._$AB:e._$AA;if(r===void 0){let i=n.insertBefore(n0(),o),s=n.insertBefore(n0(),o);r=new q5(i,s,t,t.options)}else{let i=r._$AB.nextSibling,s=r._$AM,a=s!==t;if(a){let c;r._$AQ?.(t),r._$AM=t,r._$AP!==void 0&&(c=t._$AU)!==s._$AU&&r._$AP(c)}if(i!==o||a){let c=r._$AA;for(;c!==i;){let u=r0(c).nextSibling;r0(n).insertBefore(c,o),c=u}}}return r},Kn=(t,e,r=t)=>(t._$AI(e,r),t),Y5={},cd=(t,e=Y5)=>t._$AH=e,i0=t=>t._$AH,dd=t=>{t._$AR(),t._$AA.remove()}});var s0,te,a0=w(()=>{Lr();Yi();Yf();s0=(t,e,r)=>{let n=new Map;for(let o=e;o<=r;o++)n.set(t[o],o);return n},te=Fr(class extends Qt{constructor(t){if(super(t),t.type!==yt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(t,e,r){let n;r===void 0?r=e:e!==void 0&&(n=e);let o=[],i=[],s=0;for(let a of t)o[s]=n?n(a,s):s,i[s]=r(a,s),s++;return{values:i,keys:o}}render(t,e,r){return this.dt(t,e,r).values}update(t,[e,r,n]){let o=i0(t),{values:i,keys:s}=this.dt(e,r,n);if(!Array.isArray(o))return this.ut=s,i;let a=this.ut??=[],c=[],u,p,f=0,h=o.length-1,g=0,y=i.length-1;for(;f<=h&&g<=y;)if(o[f]===null)f++;else if(o[h]===null)h--;else if(a[f]===s[g])c[g]=Kn(o[f],i[g]),f++,g++;else if(a[h]===s[y])c[y]=Kn(o[h],i[y]),h--,y--;else if(a[f]===s[y])c[y]=Kn(o[f],i[y]),Xi(t,c[y+1],o[f]),f++,y--;else if(a[h]===s[g])c[g]=Kn(o[h],i[g]),Xi(t,o[f],o[h]),h--,g++;else if(u===void 0&&(u=s0(s,g,y),p=s0(a,f,h)),u.has(a[f]))if(u.has(a[h])){let b=p.get(s[g]),v=b!==void 0?o[b]:null;if(v===null){let x=Xi(t,o[f]);Kn(x,i[g]),c[g]=x}else c[g]=Kn(v,i[g]),Xi(t,o[f],v),o[b]=null;g++}else dd(o[h]),h--;else dd(o[f]),f++;for(;g<=y;){let b=Xi(t,c[y+1]);Kn(b,i[g]),c[g++]=b}for(;f<=h;){let b=o[f++];b!==null&&dd(b)}return this.ut=s,cd(t,c),je}})});var vt=w(()=>{a0()});var l0,X5,ve,c0=w(()=>{Lr();Yi();l0="important",X5=" !"+l0,ve=Fr(class extends Qt{constructor(t){if(super(t),t.type!==yt.ATTRIBUTE||t.name!=="style"||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return n==null?e:e+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(t,[e]){let{style:r}=t.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?r.removeProperty(n):r[n]=null);for(let n in e){let o=e[n];if(o!=null){this.ft.add(n);let i=typeof o=="string"&&o.endsWith(X5);n.includes("-")||i?r.setProperty(n,i?o.slice(0,-11):o,i?l0:""):r[n]=o}}return je}})});var fn=w(()=>{c0()});function J5(t){Qf.set(t,new Map)}function Z5(t,{target:e,key:r,type:n}){n==="iterate"&&(r=f0);let o=Qf.get(e),i=o.get(r);i||(i=new Set,o.set(r,i)),i.has(t)||(i.add(t),t.cleaners.push(i))}function Q5({target:t,key:e,type:r}){let n=Qf.get(t),o=new Set;if(r==="clear"?n.forEach((i,s)=>{Xf(o,n,s)}):Xf(o,n,e),r==="add"||r==="delete"||r==="clear"){let i=Array.isArray(t)?"length":f0;Xf(o,n,i)}return o}function Xf(t,e,r){let n=e.get(r);n&&n.forEach(t.add,t)}function h0(t){t.cleaners&&t.cleaners.forEach(eT,t),t.cleaners=[]}function eT(t){t.delete(this)}function tT(t,e,r,n){if(t.unobserved)return Reflect.apply(e,r,n);if(Ji.indexOf(t)===-1){h0(t);try{return Ji.push(t),Reflect.apply(e,r,n)}finally{Ji.pop()}}}function br(t){let e=Ji[Ji.length-1];e&&(m0(e,t),Z5(e,t))}function Gn(t){Q5(t).forEach(rT,t)}function rT(t){m0(t,this),typeof t.scheduler=="function"?t.scheduler(t):typeof t.scheduler=="object"?t.scheduler.add(t):t()}function m0(t,e){if(t.debugger&&!Jf)try{Jf=!0,t.debugger(e)}finally{Jf=!1}}function g0(){return Ji.length>0}function b0(t,e={}){let r=t[d0]?t:function n(){return tT(n,t,this,arguments)};return r.scheduler=e.scheduler,r.debugger=e.debugger,r[d0]=!0,e.lazy||r(),r}function eh(t){t.unobserved||(t.unobserved=!0,h0(t)),typeof t.scheduler=="object"&&t.scheduler.delete(t)}function pd(t){let e=fd.get(t);return g0()&&typeof t=="object"&&t!==null?e||hd(t):e||t}function Zf(t,e){let r=t.next;return t.next=()=>{let{done:n,value:o}=r.call(t);return n||(e?o[1]=pd(o[1]):o=pd(o)),{done:n,value:o}},t}function oT({constructor:t}){return!(typeof t=="function"&&t.name in p0&&p0[t.name]===t)||y0.has(t)}function iT(t){return y0.get(t.constructor)}function aT(t,e,r){let n=Reflect.get(t,e,r);if(typeof e=="symbol"&&sT.has(e))return n;br({target:t,key:e,receiver:r,type:"get"});let o=fd.get(n);if(g0()&&typeof n=="object"&&n!==null){if(o)return o;let i=Reflect.getOwnPropertyDescriptor(t,e);if(!i||!(i.writable===!1&&i.configurable===!1))return hd(n)}return o||n}function lT(t,e){let r=Reflect.has(t,e);return br({target:t,key:e,type:"has"}),r}function cT(t){return br({target:t,type:"iterate"}),Reflect.ownKeys(t)}function dT(t,e,r,n){typeof r=="object"&&r!==null&&(r=mt.get(r)||r);let o=v0.call(t,e),i=t[e],s=Reflect.set(t,e,r,n);return t!==mt.get(n)||(o?r!==i&&Gn({target:t,key:e,value:r,oldValue:i,receiver:n,type:"set"}):Gn({target:t,key:e,value:r,receiver:n,type:"add"})),s}function uT(t,e){let r=v0.call(t,e),n=t[e],o=Reflect.deleteProperty(t,e);return r&&Gn({target:t,key:e,oldValue:n,type:"delete"}),o}function hd(t={}){return mt.has(t)||!oT(t)?t:fd.get(t)||fT(t)}function fT(t){let e=iT(t)||pT,r=new Proxy(t,e);return fd.set(t,r),mt.set(r,t),J5(t),r}var Qf,f0,Ji,Jf,d0,mt,fd,nT,u0,ud,p0,y0,v0,sT,pT,w0=w(()=>{Qf=new WeakMap,f0=Symbol("iteration key");Ji=[],Jf=!1;d0=Symbol("is reaction");mt=new WeakMap,fd=new WeakMap,nT=Object.prototype.hasOwnProperty;u0={has(t){let e=mt.get(this),r=Reflect.getPrototypeOf(this);return br({target:e,key:t,type:"has"}),r.has.apply(e,arguments)},get(t){let e=mt.get(this),r=Reflect.getPrototypeOf(this);return br({target:e,key:t,type:"get"}),pd(r.get.apply(e,arguments))},add(t){let e=mt.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(e,t),o=r.add.apply(e,arguments);return n||Gn({target:e,key:t,value:t,type:"add"}),o},set(t,e){let r=mt.get(this),n=Reflect.getPrototypeOf(this),o=n.has.call(r,t),i=n.get.call(r,t),s=n.set.apply(r,arguments);return o?e!==i&&Gn({target:r,key:t,value:e,oldValue:i,type:"set"}):Gn({target:r,key:t,value:e,type:"add"}),s},delete(t){let e=mt.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(e,t),o=r.get?r.get.call(e,t):void 0,i=r.delete.apply(e,arguments);return n&&Gn({target:e,key:t,oldValue:o,type:"delete"}),i},clear(){let t=mt.get(this),e=Reflect.getPrototypeOf(this),r=t.size!==0,n=t instanceof Map?new Map(t):new Set(t),o=e.clear.apply(t,arguments);return r&&Gn({target:t,oldTarget:n,type:"clear"}),o},forEach(t,...e){let r=mt.get(this),n=Reflect.getPrototypeOf(this);br({target:r,type:"iterate"});let o=(i,...s)=>t(pd(i),...s);return n.forEach.call(r,o,...e)},keys(){let t=mt.get(this),e=Reflect.getPrototypeOf(this);return br({target:t,type:"iterate"}),e.keys.apply(t,arguments)},values(){let t=mt.get(this),e=Reflect.getPrototypeOf(this);br({target:t,type:"iterate"});let r=e.values.apply(t,arguments);return Zf(r,!1)},entries(){let t=mt.get(this),e=Reflect.getPrototypeOf(this);br({target:t,type:"iterate"});let r=e.entries.apply(t,arguments);return Zf(r,!0)},[Symbol.iterator](){let t=mt.get(this),e=Reflect.getPrototypeOf(this);br({target:t,type:"iterate"});let r=e[Symbol.iterator].apply(t,arguments);return Zf(r,t instanceof Map)},get size(){let t=mt.get(this),e=Reflect.getPrototypeOf(this);return br({target:t,type:"iterate"}),Reflect.get(e,"size",t)}},ud={get(t,e,r){return t=nT.call(u0,e)?u0:t,Reflect.get(t,e,r)}},p0=typeof window=="object"?window:Function("return this")(),y0=new Map([[Map,ud],[Set,ud],[WeakMap,ud],[WeakSet,ud],[Object,!1],[Array,!1],[Int8Array,!1],[Uint8Array,!1],[Uint8ClampedArray,!1],[Int16Array,!1],[Uint16Array,!1],[Int32Array,!1],[Uint32Array,!1],[Float32Array,!1],[Float64Array,!1]]);v0=Object.prototype.hasOwnProperty,sT=new Set(Object.getOwnPropertyNames(Symbol).map(t=>Symbol[t]).filter(t=>typeof t=="symbol"));pT={get:aT,has:lT,ownKeys:cT,set:dT,deleteProperty:uT}});function th(t){let e=!0,r=b0(()=>{try{t(e)}finally{e=!1}},{lazy:!0});try{r()}catch(n){throw eh(r),n}return()=>eh(r)}var md,gd=w(()=>{w0();md=hd});var k0=w(()=>{});var x0=w(()=>{k0()});var V,$e=w(()=>{M();gd();M();vt();x0();V=class extends J{_disposers=[];observes=null;connectedCallback(){super.connectedCallback(),this.bindState()}bindState(){if(this.observes){this._disposers.push(th(e=>{this.observes(),e||this.requestUpdate()}));return}this._render||(this._render=this.render,this.render=()=>{let e,r=th(n=>{if(!n){r(),this._dispose===r&&(this._dispose=null),this.updateComplete.then(()=>this.requestUpdate());return}e=this._render()});return this._dispose=r,e}),this._disposers.push(()=>this._dispose&&this._dispose())}disconnectedCallback(){for(super.disconnectedCallback();this._disposers.length>0;)this._disposers.pop()()}}});function hn(t,e){let r=URL.createObjectURL(t),n=document.createElement("span");n.style.display="none",ie(d`<a href="${r}" download="${e}"></a>`,n),document.body.append(n),n.firstElementChild.click(),n.remove(),URL.revokeObjectURL(r)}function Zi(t){return new Error("Another dialog is already open. Close it and try again.",{cause:t})}var Ue,T,$0,Nt=w(()=>{"use strict";M();Ue=document.querySelector("#drop-zone"),T=document.querySelector("#report"),$0=document.querySelector("app-sidebar")});function qn(t){if(t?.name!==hT)return!1;let e=t.version;return!e||e===mT}function S0(t){let e=t?.package?.npm,r=e?.version;if(typeof r=="string"&&r&&!qn(e))return r;let n=t?.file;if(!n)return null;let o=/(?:^|\/)node_modules\/\.pnpm\/([^/]+)\/node_modules\//u.exec(n);if(!o)return null;let i=o[1],s=i.indexOf("_");s>0&&(i=i.slice(0,s));let a=i.lastIndexOf("@");return a<=0?null:i.slice(a+1)||null}function bd(){return{keys:new Set,findings:[],files:new Map,reports:new Set,_keyReports:new Map}}function yd(t,e,r,n){t.reports.add(r);let o=t._keyReports.get(e);o||t._keyReports.set(e,o=new Set);let i=!o.has(r);return o.add(r),t.keys.has(e)||(t.keys.add(e),t.findings.push(n),t.files.has(n.file)||t.files.set(n.file,[]),t.files.get(n.file).push(n)),i}function vd(t,e,r,n){t._keyReports.delete(e),t.keys.delete(e);let o=t.findings.findIndex(a=>n(a)===e);o>=0&&t.findings.splice(o,1);let i=t.files.get(r);if(!i)return;let s=i.findIndex(a=>n(a)===e);s>=0&&i.splice(s,1),i.length===0&&t.files.delete(r)}function wd(t){let e=new Set;for(let r of t._keyReports.values())for(let n of r)e.add(n);t.reports=e}function C0(t,e,r,n,o){let i=t.byVersion.get(e);i||(i=bd(),t.byVersion.set(e,i)),yd(i,n,o,r)}function E0(t,e,r,n,o,i){let s=t.byVersion.get(e);if(!s)return;let a=s._keyReports.get(r);if(a&&(a.delete(o),a.size===0&&vd(s,r,n,i)),s._keyReports.size===0){t.byVersion.delete(e);return}wd(s)}function rh(t,e){if(t===e)return 0;if(t===null)return 1;if(e===null)return-1;let[r,n=""]=_0(t,"-"),[o,i=""]=_0(e,"-"),s=r.split("."),a=o.split("."),c=Math.max(s.length,a.length);for(let u=0;u<c;u++){let p=s[u]??"0",f=a[u]??"0",h=/^\d+$/u.test(p),g=/^\d+$/u.test(f);if(h&&g){let y=Number(f)-Number(p);if(y!==0)return y}else{let y=f.localeCompare(p);if(y!==0)return y}}return n===""&&i!==""?-1:n!==""&&i===""?1:i.localeCompare(n)}function _0(t,e){let r=t.indexOf(e);return r<0?[t,""]:[t.slice(0,r),t.slice(r+1)]}var hT,mT,nh=w(()=>{"use strict";hT="solidity-bundle",mT="0.0.0"});function ge(t){if(typeof t!="string")throw new TypeError(`encodeUtf8 expects a string, got ${typeof t}`);if(!t.isWellFormed())throw new TypeError("encodeUtf8: input contains lone surrogates");return R0.encode(t)}function Go(t){if(typeof t!="string")throw new TypeError(`utf8ByteLength expects a string, got ${typeof t}`);if(/[\u0100-\uFFFF]/.test(t))return R0.encode(t).byteLength;let e=/[\u0080-\u00FF]/gu,r=t.length;for(;e.test(t);){let n=e.lastIndex-1;for(let o=0;n<t.length&&o<bT;n++)t.codePointAt(n)>127?(r++,o=0):o++;e.lastIndex=n}return r}function Ve(t){if(!ArrayBuffer.isView(t)&&!(t instanceof ArrayBuffer))throw new TypeError(`decodeUtf8 expects a BufferSource, got ${t===null?"null":typeof t}`);return gT.decode(t)}var R0,gT,bT,gt=w(()=>{"use strict";R0=new TextEncoder,gT=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});bT=2});async function Qi(t){let e=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(e).arrayBuffer())}async function yr(t,{maxBytes:e}={}){let r=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));if(e==null)return new Uint8Array(await new Response(r).arrayBuffer());let n=r.getReader(),o=[],i=0;for(;;){let{value:c,done:u}=await n.read();if(u)break;if(i+=c.length,i>e){try{await n.cancel()}catch{}throw new Error(`gunzipBytes: decompressed size exceeds ${e}-byte cap`)}o.push(c)}let s=new Uint8Array(i),a=0;for(let c of o)s.set(c,a),a+=c.length;return s}async function $a(t){return await Qi(ge(t))}async function qo(t){return Ve(await yr(t))}var es=w(()=>{"use strict";gt()});async function A0(t){let e=await crypto.subtle.digest("SHA-512",t);return`sha512-${new Uint8Array(e).toBase64()}`}var T0=w(()=>{"use strict"});function _a(){return!(typeof window>"u"||typeof PublicKeyCredential>"u"||typeof navigator>"u"||!navigator.credentials)}async function M0(){if(typeof PublicKeyCredential>"u")return!1;let t=PublicKeyCredential.getClientCapabilities;if(typeof t!="function")return null;try{let e=await t.call(PublicKeyCredential);if(!e||typeof e!="object")return null;let r=e["extension:prf"],n=e.prf;return r===!0||n===!0?!0:r===!1||n===!1?!1:null}catch{return null}}function kd(t){let e=new Uint8Array(t);return crypto.getRandomValues(e),e}async function oh(t){if(t.length<32)throw new Error(`PRF output too short (${t.length} bytes; need \u2265 32)`);let e=await crypto.subtle.importKey("raw",t,"HKDF",!1,["deriveBits"]),r=await crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:new Uint8Array,info:ge(vT)},e,yT*8);return new Uint8Array(r)}function ih(t){return crypto.subtle.importKey("raw",t,{name:"AES-GCM"},!1,["encrypt","decrypt"])}async function Yn(t,e,r){let n=kd(ts),o=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:n,additionalData:r},t,e)),i=new Uint8Array(vr.length+ts+o.length);return i.set(vr,0),i.set(n,vr.length),i.set(o,vr.length+ts),i}async function Yo(t,e,r){if(!wt(e))throw new Error("passkey: missing envelope magic");if(e.length<vr.length+ts+16)throw new Error("passkey: envelope too short");let n=e.subarray(vr.length,vr.length+ts),o=e.subarray(vr.length+ts);return new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:r},t,o))}function wt(t){if(t.length<vr.length)return!1;for(let e=0;e<vr.length;e++)if(t[e]!==vr[e])return!1;return!0}async function I0(t){if(!_a())throw new Error("passkey: not supported in this environment");let e=kd(32),r=kd(32),n=await navigator.credentials.create({publicKey:{challenge:e,rp:{name:t.rpName,id:t.rpId},user:{id:t.userId,name:t.userName,displayName:t.userName},pubKeyCredParams:[{type:"public-key",alg:-7},{type:"public-key",alg:-257}],authenticatorSelection:{residentKey:"required",userVerification:"required"},extensions:{prf:{eval:{first:r}}},timeout:t.timeoutMs??12e4},...t.signal?{signal:t.signal}:{}});if(!(n instanceof PublicKeyCredential))throw new Error("passkey: registration returned no credential");let o=new Uint8Array(n.rawId).toBase64({alphabet:"base64url",omitPadding:!0}),i=n.getClientExtensionResults().prf,s=i?.results?.first?new Uint8Array(i.results.first):null;return{credentialId:o,prfSalt:r.toBase64({alphabet:"base64url",omitPadding:!0}),prfOutput:s}}async function sh(t){if(!_a())throw new Error("passkey: not supported in this environment");let e=kd(32),r=Uint8Array.fromBase64(t.credentialId,{alphabet:"base64url"}),n=Uint8Array.fromBase64(t.prfSalt,{alphabet:"base64url"}),o=await navigator.credentials.get({publicKey:{challenge:e,rpId:t.rpId,allowCredentials:[{type:"public-key",id:r}],userVerification:"required",extensions:{prf:{eval:{first:n}}},timeout:t.timeoutMs??12e4},...t.signal?{signal:t.signal}:{}});if(!(o instanceof PublicKeyCredential))throw new Error("passkey: assertion returned no credential");let s=o.getClientExtensionResults().prf?.results?.first;if(!s)throw new Error("passkey: authenticator did not return PRF output (extension unsupported)");return new Uint8Array(s)}var vr,ts,yT,vT,ah=w(()=>{"use strict";gt();vr=new Uint8Array([68,86,69,49]),ts=12,yT=32,vT="deepview-passkey.v1.content-key"});function Xn(t){let e=()=>t();return xd.add(e),$d&&queueMicrotask(()=>{if(xd.has(e))try{e()}catch(r){console.warn("secure-storage after-hydrate listener:",r)}}),()=>xd.delete(e)}function wT(){for(let t of xd)try{t()}catch(e){console.warn("secure-storage after-hydrate listener:",e)}}function _d(t){let e=O0()??"";return ge(`deepview.secure.v1|${e}|${t}`)}function lh(t){try{let e=Uint8Array.fromBase64(t);if(wt(e))return e}catch{}return null}function He(t){return kt.get(t)??null}async function Je(t,e){if(typeof e!="string")throw new TypeError("secure-storage: value must be a string");if(de()&&!et())throw new Error(`secure-storage: vault locked, cannot save "${t}"`);if(B0())throw new Error(`secure-storage: wipe in progress, cannot save "${t}"`);let r=kt.has(t),n=kt.get(t);kt.set(t,e),er.set(t,e);let o=mn.get(t)??Promise.resolve(),i=()=>{er.get(t)===e&&er.delete(t)},s=o.catch(()=>{}).then(()=>kT(t,e)).then(()=>i(),a=>{throw i(),kt.get(t)===e&&(r?kt.set(t,n):kt.delete(t)),a});mn.set(t,s.catch(()=>{})),await s}async function Jn(t){let e=Symbol("secure-storage:removed");kt.delete(t),er.set(t,e);let r=mn.get(t)??Promise.resolve(),n=()=>{try{localStorage.removeItem(t)}catch{}er.get(t)===e&&(er.delete(t),kt.delete(t))},o=r.catch(()=>{}).then(()=>n());mn.set(t,o.catch(()=>{})),await o}async function kT(t,e){let r=et();if(r){let n=await Yn(r,ge(e),_d(t));localStorage.setItem(t,n.toBase64())}else localStorage.setItem(t,e)}async function Br(){$d||tt(()=>{Br().catch(r=>console.warn("secure-storage rehydrate:",r))}),$d=!0;for(let r of[...kt.keys()])er.has(r)||kt.delete(r);let t=et(),e=[];for(let r of Sa){if(er.has(r))continue;let n=localStorage.getItem(r);if(n===null)continue;let o=lh(n);if(o){if(!t)continue;try{let i=await Yo(t,o,_d(r));if(er.has(r))continue;kt.set(r,Ve(i))}catch(i){console.warn(`secure-storage: decrypt failed for "${r}":`,i)}}else kt.set(r,n),t&&de()&&e.push([r,n])}wT(),e.length>0&&queueMicrotask(()=>{for(let[r,n]of e)kt.get(r)===n&&Je(r,n).catch(o=>{console.warn(`secure-storage: self-heal failed for "${r}":`,o)})})}async function L0(t,e){let r=mn.get(t)??Promise.resolve(),n=async()=>{if(er.has(t))return;let i=localStorage.getItem(t);if(i===null)return;let s=await e(i);s!==null&&(er.has(t)||(localStorage.setItem(t,s.storageValue),kt.set(t,s.cacheValue)))},o=r.catch(()=>{}).then(n);mn.set(t,o.catch(()=>{})),await o}async function ch({seal:t}){for(let e of Sa)await L0(e,async r=>{if(lh(r))return null;let n=et();return n?{storageValue:(await Yn(n,ge(r),_d(e))).toBase64(),cacheValue:r}:null})}async function dh({open:t}){for(let e of Sa)await L0(e,async r=>{let n=lh(r);if(!n)return null;let o=await t(n,_d(e)),i=Ve(o);return{storageValue:i,cacheValue:i}})}function Sd(t,e){return Sa.includes(t)?navigator.locks.request(xT+t,async()=>{let r=mn.get(t);r&&await r.catch(()=>{}),await Br();let n=He(t),o=await e(n);if(!(o==null||o===n)){if(typeof o!="string")throw new TypeError(`secure-storage: mutate updater for "${t}" must return a string`);await Je(t,o)}}):Promise.reject(new Error(`secure-storage: mutate() called with non-secure key "${t}"`))}async function F0(){await Promise.allSettled([...mn.values()]),er.clear(),mn.clear()}var Sa,kt,$d,mn,er,xd,xT,gn=w(()=>{"use strict";gt();ah();Ca();Sa=Object.freeze(["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.sync.password","deepview.repoUrls","deepview.fileCounts","deepview.lastFile","deepview.scan.access"]),kt=new Map,$d=!1,mn=new Map,er=new Map,xd=new Set;xT="deepview.secure.v1.mutate:";typeof window<"u"&&window.addEventListener("storage",t=>{!$d||!t.key||!Sa.includes(t.key)||Br().catch(()=>{})})});function fh(){return Ra>0}function B0(){return uh>0}function Xo(){try{let t=localStorage.getItem(Aa);if(!t)return null;let e=JSON.parse(t);return e&&typeof e=="object"&&e.enabled===!0&&typeof e.credentialId=="string"&&e.credentialId.length>0&&typeof e.prfSalt=="string"&&e.prfSalt.length>0&&typeof e.userId=="string"&&e.userId.length>0?e:null}catch{return null}}function P0(t){localStorage.setItem(Aa,JSON.stringify(t))}function ET(){localStorage.removeItem(Aa)}function RT(){try{let e=localStorage.getItem(rs);if(e){let r=Uint8Array.fromBase64(e,{alphabet:"base64url"});if(r.length===16)return r}}catch{}let t=new Uint8Array(16);crypto.getRandomValues(t);try{localStorage.setItem(rs,t.toBase64({alphabet:"base64url",omitPadding:!0}))}catch{}return t}function Rd(){return typeof location>"u"?"":location.hostname}function de(){return Xo()!==null}function tr(){return Re!==null}function Pr(){return!(!_a()||typeof navigator>"u"||!navigator.locks?.request||!Rd())}function O0(){return Or}function Ta(){if(Xo()!==null)return!1;try{return localStorage.getItem(Ed)==="1"?!1:localStorage.getItem(rs)!==null}catch{return!1}}function et(){return Re}function Ma(){return ge(_T+(Or??""))}function Ad(t){if(typeof t!="string")throw new TypeError("passkey vault: OPFS AAD requires a filename string");return ge(ST+(Or??"")+"|"+t)}function Td(t){if(typeof t!="string")throw new TypeError("passkey vault: bundle AAD requires a slot string");return ge(CT+(Or??"")+"|"+t)}function tt(t){return ph.add(t),()=>ph.delete(t)}function ns(){for(let t of ph)try{t()}catch(e){console.warn("passkey vault listener:",e)}}async function Ia({signal:t}={}){let e=Xo();if(!e)return!1;let r;try{r=await sh({credentialId:e.credentialId,prfSalt:e.prfSalt,rpId:e.rpId??Rd(),...t?{signal:t}:{}})}catch(o){if(o&&o.name==="NotAllowedError"||o&&o.name==="AbortError")return!1;throw o&&o.message?.includes("PRF")?Ea(o):o}if(!r||r.length<32)throw Ea();let n=await oh(r);return r.fill(0),navigator.locks.request(At,async()=>{let o=Xo();if(!o||o.credentialId!==e.credentialId)throw n.fill(0),new Error("passkey: vault state changed during unlock (another tab wiped or re-enabled it). Reload this page and try again.");return Re=await ih(n),n.fill(0),Or=o.userId,Zn=o.credentialId,ns(),!0})}function Ea(t){let e=new Error("Your browser or authenticator doesn't support passkey-derived encryption keys (the WebAuthn PRF extension). Try Chrome 116+, Safari 18+, or Firefox 130+ on a device with a platform authenticator (TouchID / Windows Hello).");return t&&(e.cause=t),e}function hh({migrate:t,userName:e,rpName:r,signal:n,acknowledgeOrphan:o}){if(!_a())throw new Error("passkey: WebAuthn unavailable in this environment");if(Ta()&&!o)throw new Error("passkey: a previous vault exists on this device with no metadata. Any data encrypted under the old passkey will be unreadable after a new setup. Call enableEncryption({acknowledgeOrphan: true}) to proceed, or wipeAllVaultData() to start clean first.");let i=Rd();return navigator.locks.request(At,async()=>{if(de())throw new Error("passkey: encryption is already enabled");if(await M0()===!1)throw Ea();let a=RT(),c=await I0({userName:e||"DeepView user",userId:a,rpName:r||"DeepView",rpId:i,...n?{signal:n}:{}}),u=c.prfOutput;if(!u)try{u=await sh({credentialId:c.credentialId,prfSalt:c.prfSalt,rpId:i,...n?{signal:n}:{}})}catch(y){let b=a.toBase64({alphabet:"base64url",omitPadding:!0});await Cd({credentialId:c.credentialId,rpId:i,userId:b}).catch(()=>{});try{localStorage.removeItem(rs)}catch{}throw y&&y.message?.includes("PRF")?Ea(y):y}if(!u||u.length<32){let y=a.toBase64({alphabet:"base64url",omitPadding:!0});await Cd({credentialId:c.credentialId,rpId:i,userId:y}).catch(()=>{});try{localStorage.removeItem(rs)}catch{}throw Ea()}let p=await oh(u);u.fill(0);let f=await ih(p);p.fill(0);let h=a.toBase64({alphabet:"base64url",omitPadding:!0}),g={enabled:!0,credentialId:c.credentialId,prfSalt:c.prfSalt,userId:h,rpId:i,createdAt:Date.now()};Re=f,Or=h,Zn=c.credentialId,P0(g),typeof t=="function"&&await t({seal:(b,v)=>Yn(f,b,v)});try{localStorage.removeItem(Ed)}catch{}return ns(),!0})}async function mh({migrate:t}){if(!de())return{disabled:!1,signalAttempted:!1};if(!tr())throw new Error("passkey: must unlock before disabling encryption");Ra+=1;try{return await navigator.locks.request(At,async()=>{let e=Xo();if(!e)return{disabled:!1,signalAttempted:!1};let r=Re;if(!r)return{disabled:!1,signalAttempted:!1};if(ET(),Re=null,Zn=null,typeof t=="function"){let o=(i,s)=>Yo(r,i,s);try{await t({open:o})}catch(i){throw P0(e),Re=r,Zn=e.credentialId,ns(),i}}Or=null;try{localStorage.setItem(Ed,"1")}catch{}let n=await Cd(e).catch(()=>!1);return ns(),{disabled:!0,signalAttempted:n}})}finally{Ra-=1}}async function Cd({credentialId:t,rpId:e,userId:r}){if(typeof PublicKeyCredential>"u"||!e)return!1;let n=PublicKeyCredential,o=!1;if(typeof n.signalUnknownCredential=="function"){o=!0;try{await n.signalUnknownCredential({rpId:e,credentialId:t})}catch{}}if(typeof n.signalAllAcceptedCredentials=="function"&&r){o=!0;try{await n.signalAllAcceptedCredentials({rpId:e,userId:r,allAcceptedCredentialIds:[]})}catch{}}return o}async function AT(t,e){try{return await t.removeEntry(e,{recursive:!0}),null}catch(r){return r?.name==="NotFoundError"?null:`${e}: ${r?.message??String(r)}`}}async function TT(t){let e=[];if(typeof navigator>"u"||!navigator.storage?.getDirectory)return e;let r;try{r=await navigator.storage.getDirectory()}catch(n){return e.push(`storage root: ${n?.message??String(n)}`),e}for(let n of t){let o=await AT(r,n);o&&e.push(o)}return e}async function La({refuseIfEnabled:t=!1}={}){Ra+=1,uh+=1;try{return await navigator.locks.request(At,async()=>{if(t&&de())throw new Error("passkey: encryption was just enabled in another tab. Reload this page to unlock instead of wiping.");await F0();let e=Xo();if(e)try{await Cd({credentialId:e.credentialId,rpId:e.rpId??Rd(),userId:e.userId})}catch{}try{localStorage.removeItem(Aa)}catch{}try{localStorage.removeItem(rs)}catch{}try{localStorage.removeItem(Ed)}catch{}for(let n of["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.repoUrls","deepview.fileCounts","deepview.lastFile","deepview.scan.access","deepview.triage","deepview.triage.pending","deepview.passkey.firstImportPrompted","deepview.viewMode"])try{localStorage.removeItem(n)}catch{}try{let n=[];for(let o=0;o<localStorage.length;o+=1){let i=localStorage.key(o);i&&i.startsWith("deepview.report:")&&n.push(i)}for(let o of n)try{localStorage.removeItem(o)}catch{}}catch{}Re=null,Or=null,Zn=null,ns();let r=await TT(["deepview-reports","deepview-bundles"]);if(r.length>0)throw new Error(`passkey: wipe partially succeeded \u2014 localStorage cleared but the following OPFS paths could not be removed: ${r.join("; ")}. Open DevTools \u2192 Application \u2192 Storage \u2192 Origin Private File System to inspect, or use the browser's site-data clear tool to finish.`)})}finally{Ra-=1,uh-=1}}function N0(t){return Re?Yn(Re,t,Ma()):Promise.reject(new Error("passkey: vault locked, cannot seal triage"))}function D0(t){return Re?Yo(Re,t,Ma()):Promise.reject(new Error("passkey: vault locked, cannot open triage"))}function Md(t,e){return Re?Yn(Re,t,Ad(e)):Promise.reject(new Error("passkey: vault locked, cannot seal OPFS file"))}function z0(t,e){return Re?Yo(Re,t,Ad(e)):Promise.reject(new Error("passkey: vault locked, cannot open OPFS file"))}function Id(t,e){return Re?Yn(Re,t,Td(e)):Promise.reject(new Error("passkey: vault locked, cannot seal bundle"))}function Ld(t,e){return Re?Yo(Re,t,Td(e)):Promise.reject(new Error("passkey: vault locked, cannot open bundle"))}var Aa,rs,Ed,At,_T,ST,CT,Re,Or,Zn,Ra,uh,ph,Ca=w(()=>{"use strict";ah();gt();gn();Aa="deepview.passkey.v1",rs="deepview.passkey.userId",Ed="deepview.passkey.cleanDisable",At="deepview.passkey.v1.write",_T="deepview.triage.v1|",ST="deepview.opfs.v1|",CT="deepview.bundle.v1|",Re=null,Or=null,Zn=null,Ra=0;uh=0;ph=new Set;typeof window<"u"&&window.addEventListener("storage",t=>{if(t.key!==Aa)return;let e=Xo();(!e&&Re||e&&Re&&e.credentialId!==Zn)&&(Re=null,Or=null,Zn=null),ns()})});async function wh(t,{create:e,warnOnce:r=!1}={}){try{return await(await navigator.storage.getDirectory()).getDirectoryHandle(t,{create:e})}catch(n){return r&&!U0&&(U0=!0,console.warn("OPFS unavailable, falling back to gzipped localStorage (limited quota).",n)),null}}async function Oa(t,e){let r=await t.createWritable();try{await r.write(e),await r.close()}catch(n){try{await r.abort(n)}catch{}throw n}}async function kh(t,e){if(!wt(t))return t;if(!et())throw new Error(`storage: vault locked, cannot decrypt "${e}"`);return await z0(t,e)}function Od(t){return t.length===0?!0:t.length>=18&&t[0]===31&&t[1]===139&&t.at(-4)===0&&t.at(-3)===0&&t.at(-2)===0&&t.at(-1)===0}async function xh(t,e){Fa(t)===e&&(console.warn(`storage: report "${t}" is an empty/corrupt on-disk entry \u2014 quarantining, will read as missing`),await navigator.locks.request(At,{mode:"exclusive"},async()=>{if(Fa(t)!==e)return;Ie(t),rr.delete(t);let r=await to();if(r)try{await r.removeEntry(t)}catch{}Pd(t),Ie(t),Jo(t,"delete")}))}async function $h(t,e,r){try{(await e.getFile()).size===0&&await t.removeEntry(r)}catch{}}async function os(t,e,r,n,o=()=>{}){if(de()&&!et())throw o(),new Error(`storage: vault locked, cannot save ${n}`);let i=et(),s=i?await e(t,r):t;if(et()!==i)throw o(),new Error(`storage: vault state changed mid-save for ${n}; retry`);return s}function to(){return wh(MT,{create:!0,warnOnce:!0})}function Fd(t){try{return localStorage.getItem(eo+t)}catch{return null}}function Pd(t){try{localStorage.removeItem(eo+t)}catch{}}function IT(){let t=[];for(let e=0;e<localStorage.length;e++){let r=localStorage.key(e);r&&r.startsWith(eo)&&t.push(r.slice(eo.length))}return t}function Ie(t){gh.set(t,(gh.get(t)??0)+1)}function Fa(t){return gh.get(t)??0}function Qo(t){return bh.add(t),()=>bh.delete(t)}function Jo(t,e){for(let r of bh)try{r(t,e)}catch(n){console.warn("storage file-change listener:",n)}}async function pe(){let t=new Set(IT()),e=await to();if(e)for await(let[r]of e.entries())t.add(r);return[...t].toSorted()}async function nr(t,e){if(typeof t!="string"||t.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");if(e==="")throw new Error(`Refusing to save empty report "${t}"`);return Ie(t),navigator.locks.request(At,{mode:"shared"},async()=>{let r=await to();if(r){let i=await Qi(ge(e));i=await os(i,Md,t,`"${t}"`,()=>Ie(t));let s=await r.getFileHandle(t,{create:!0}),a=await s.createWritable();try{await a.write(i),await a.close()}catch(c){rr.delete(t),Ie(t);try{await a.abort(c)}catch{}throw await $h(r,s,t),c}rr.set(t,e),Ie(t),Pd(t),Jo(t,"save");return}let n=ge(e);n=await Qi(n),n=await os(n,Md,t,`"${t}"`,()=>Ie(t));let o=n.toBase64();try{localStorage.setItem(eo+t,o),rr.set(t,e),Ie(t),Jo(t,"save")}catch(i){throw Ie(t),new Error(`localStorage write failed for ${t}: ${i.message}`,{cause:i})}})}async function H0(t,e){let r=Fd(t);if(r===null)return null;let n=Uint8Array.fromBase64(r);if(n=await kh(n,t),Od(n))throw await xh(t,e),new Error(`File not found: ${t}`);return Ve(await yr(n))}async function Le(t){if(rr.has(t))return rr.get(t);if(Qn.has(t))return Qn.get(t);let e=Fa(t),r=(async()=>{let n=await to();if(n){let i;try{i=await n.getFileHandle(t)}catch(u){if(u instanceof DOMException&&u.name==="NotFoundError"){let p=await H0(t,e);if(p!==null)return nr(t,p).catch(f=>{console.warn(`storage: stranded-localStorage migration of "${t}" failed:`,f)}),p}throw u}let s=await i.getFile(),a=new Uint8Array(await s.arrayBuffer());if(a=await kh(a,t),Od(a))throw await xh(t,e),new Error(`File not found: ${t}`);if(a.length>=2&&a[0]===31&&a[1]===139){let u=await yr(a);return Ve(u)}let c=Ve(a);return nr(t,c).catch(u=>{console.warn(`storage: legacy-uncompressed migration of "${t}" failed:`,u)}),c}let o=await H0(t,e);if(o===null)throw new Error(`File not found: ${t}`);return o})();Qn.set(t,r);try{let n=await r;return Fa(t)===e&&rr.set(t,n),n}finally{Qn.delete(t)}}async function ei(t){let e=Fa(t),r=await to(),n;if(r){let o=null;try{o=await r.getFileHandle(t)}catch(i){if(!(i instanceof DOMException)||i.name!=="NotFoundError")throw i;let s=Fd(t);if(s===null)throw i;n=Uint8Array.fromBase64(s)}if(o){let i=await o.getFile();n=new Uint8Array(await i.arrayBuffer())}}else{let o=Fd(t);if(o===null)throw new Error(`File not found: ${t}`);n=Uint8Array.fromBase64(o)}if(n=await kh(n,t),Od(n))throw await xh(t,e),new Error(`File not found: ${t}`);return n}async function Pa(t,e){if(typeof t!="string"||t.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");if(Od(e))throw new Error(`Refusing to save empty report bytes for "${t}"`);return Ie(t),rr.delete(t),navigator.locks.request(At,{mode:"shared"},async()=>{let r=await os(e,Md,t,`"${t}"`,()=>Ie(t)),n=await to();if(n){let o=await n.getFileHandle(t,{create:!0}),i=await o.createWritable();try{await i.write(r),await i.close()}catch(s){Ie(t);try{await i.abort(s)}catch{}throw await $h(n,o,t),s}Ie(t),Pd(t),Jo(t,"save");return}try{localStorage.setItem(eo+t,r.toBase64()),Ie(t),Jo(t,"save")}catch(o){throw Ie(t),new Error(`localStorage write failed for ${t}: ${o.message}`,{cause:o})}})}async function is(t){return Ie(t),rr.delete(t),Qn.delete(t),navigator.locks.request(At,{mode:"shared"},async()=>{let e=await to();if(e){try{await e.removeEntry(t)}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw Ie(t),r}Pd(t),Ie(t),Jo(t,"delete");return}localStorage.removeItem(eo+t),Ie(t),Jo(t,"delete")})}function ti(){return wh(vh,{create:!0})}function Zo(t){return t.replaceAll("/","_")}async function _h(t){let e;try{let o=await(await t.getFileHandle(Ba)).getFile();e=new Uint8Array(await o.arrayBuffer())}catch(n){return n instanceof DOMException&&n.name==="NotFoundError"?[]:(console.warn("readBundleMeta: failed to read _meta.json:",n),[])}let r=e;if(wt(e)){if(!et())return console.warn("readBundleMeta: vault locked, returning empty bundle list"),[];try{r=await Ld(e,yh)}catch(o){return console.warn("readBundleMeta: decrypt failed (tampering, key mismatch, or vault identity drift):",o),[]}}try{let n=JSON.parse(Ve(r));return Array.isArray(n)?n:[]}catch(n){return console.warn("readBundleMeta: JSON.parse failed:",n),[]}}async function j0(t,e){let r=ge(JSON.stringify(e));r=await os(r,Id,yh,"bundle metadata");try{await t.removeEntry(Ba)}catch{}let n=await t.getFileHandle(Ba,{create:!0});await Oa(n,r)}function Sh(t){return navigator.locks.request(LT,t)}async function Dt(){let t=await ti();return t?[...await _h(t)].toSorted((r,n)=>r.name.localeCompare(n.name)):[]}async function Na(){if(typeof navigator>"u"||!navigator.storage?.getDirectory)return!1;let t=await wh(vh,{create:!1});if(!t)return!1;try{for await(let e of t.entries())return!0}catch{}return!1}async function ri(t,e){let r=await ti();if(!r)throw new Error(`Cannot save bundle ${t}: OPFS unavailable`);let n=e instanceof Uint8Array?e:ge(e),o=await A0(n),i=Zo(o),s=t.toLowerCase().endsWith(".map")?await Qi(n):n;return navigator.locks.request(At,{mode:"shared"},async()=>{s=await os(s,Id,o,`bundle "${t}"`);try{await r.removeEntry(i)}catch{}let a=await r.getFileHandle(i,{create:!0});await Oa(a,s);try{await Sh(async()=>{let c=await _h(r),u=c.findIndex(p=>p.integrity===o);u>=0?c[u]={integrity:o,name:t}:c.push({integrity:o,name:t}),await j0(r,c)})}catch(c){try{await r.removeEntry(i)}catch{}throw c}return{integrity:o,name:t}})}async function Ch(t){let e=await ti();if(e)return navigator.locks.request(At,{mode:"shared"},async()=>{try{await e.removeEntry(Zo(t))}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw r}await Sh(async()=>{try{await e.removeEntry(Zo(t)+Bd)}catch(o){if(!(o instanceof DOMException)||o.name!=="NotFoundError")throw o}let r=await _h(e),n=r.filter(o=>o.integrity!==t);n.length!==r.length&&await j0(e,n)})})}async function bn(t){let e=await ti();if(!e)throw new Error("OPFS unavailable");let n=await(await e.getFileHandle(Zo(t))).getFile(),o=new Uint8Array(await n.arrayBuffer());if(wt(o)){if(!et())throw new Error(`storage: vault locked, cannot read bundle "${t}"`);o=await Ld(o,t)}return o.length>=2&&o[0]===31&&o[1]===139?await yr(o):o}async function Eh(t){let e=await ti();if(!e||de()&&!et())return null;try{let r=await e.getFileHandle(Zo(t)+Bd),n=new Uint8Array(await(await r.getFile()).arrayBuffer());return wt(n)&&(n=await Ld(n,t+Bd)),JSON.parse(Ve(await yr(n)))}catch{return null}}async function Rh(t,e){let r=await Qi(ge(JSON.stringify(e)));return navigator.locks.request(At,{mode:"shared"},()=>Sh(async()=>{let n=await ti();if(!n)return;await n.getFileHandle(Zo(t));let o=t+Bd,i=await os(r,Id,o,"bundle index"),s=await n.getFileHandle(Zo(o),{create:!0});await Oa(s,i)}))}async function FT(t,e){let r=await to();if(r){let s=null;try{s=await r.getFileHandle(t)}catch(a){if(!(a instanceof DOMException)||a.name!=="NotFoundError")throw a}if(s){let a=await s.getFile(),c=new Uint8Array(await a.arrayBuffer()),u=await e(c);if(u===null)return;rr.delete(t),Qn.delete(t),Ie(t);let p=await r.getFileHandle(t,{create:!0});try{await Oa(p,u)}catch(f){throw await $h(r,p,t),f}Ie(t);return}}let n=Fd(t);if(n===null)return;let o=Uint8Array.fromBase64(n),i=await e(o);i!==null&&(rr.delete(t),Qn.delete(t),Ie(t),localStorage.setItem(eo+t,i.toBase64()),Ie(t))}function V0(t,e){return t.seal?r=>wt(r)?null:t.seal(r,e):r=>wt(r)?t.open(r,e):null}async function W0(t){let e=await pe();for(let r of e)try{await FT(r,V0(t,Ad(r)))}catch(n){if(n instanceof DOMException&&n.name==="NotFoundError")continue;throw n}}async function BT(){let t=await ti();if(!t)return{dir:null,keys:[]};let e=[];for await(let[r]of t.entries())e.push(r);return{dir:t,keys:e}}function OT(t){return t===Ba?yh:t.startsWith("sha512-")?t.replaceAll("_","/"):null}async function PT(t,e,r){let o=await(await t.getFileHandle(e)).getFile(),i=new Uint8Array(await o.arrayBuffer()),s=await r(i);if(s===null)return;let a=await t.getFileHandle(e,{create:!0});await Oa(a,s)}async function K0(t){let{dir:e,keys:r}=await BT();if(e)for(let n of r){let o=OT(n);if(o!==null)try{await PT(e,n,V0(t,Td(o)))}catch(i){if(i instanceof DOMException&&i.name==="NotFoundError")continue;throw i}}}var yh,MT,vh,eo,U0,rr,Qn,gh,bh,Ba,Bd,LT,Ah,Th,Mh,Ih,wr=w(()=>{"use strict";gt();es();T0();Ca();yh="__meta__",MT="deepview-reports",vh="deepview-bundles",eo="deepview.report:",U0=!1;rr=new Map,Qn=new Map,gh=new Map;bh=new Set;Ba="_meta.json",Bd=".index-v1";LT=`${vh}/${Ba}`;Ah=({seal:t})=>W0({seal:t}),Th=({open:t})=>W0({open:t});Mh=({seal:t})=>K0({seal:t}),Ih=({open:t})=>K0({open:t});tt(()=>{rr.clear(),Qn.clear()})});var Lh,G0=w(()=>{"use strict";Lh="/api/config"});function Da(t){if(typeof t!="string"||!t.trim())return null;try{let e=new URL(t);return!["http:","https:"].includes(e.protocol)||e.username||e.password||e.search||e.hash?null:(e.pathname=e.pathname.replace(/\/+$/u,"")+"/",e.href)}catch{return null}}var q0,Fh=w(()=>{"use strict";q0="http://127.0.0.1:3123/"});function za(){try{return localStorage.getItem(Bh)==="1"}catch{return!1}}function Nd(){try{localStorage.setItem(Bh,"1")}catch{}}function Oh(t){if(t==null||typeof t!="object")return null;let e=t.mode;if(e!=="e2e"&&e!=="managed")return null;let r=null,n=t.managed;if(n!=null&&typeof n=="object"){let i=n.loginPath,s=n.cookieName;typeof i=="string"&&typeof s=="string"&&(r={loginPath:i,cookieName:s})}let o=e==="e2e"?Da(t.deepviewScanServer):null;return{mode:e,managed:r,...o?{deepviewScanServer:o}:{}}}async function Dd(){try{let t=await fetch(Lh,{credentials:"same-origin",cache:"no-store",headers:{accept:"application/json"}});return t.status===404?"standalone":t.ok?Oh(await t.json()):null}catch{return null}}async function Ph(t,e=3e3){let r;try{return await Promise.race([t,new Promise(n=>{r=setTimeout(()=>n(null),e)})])}catch{return null}finally{clearTimeout(r)}}function or(){try{let t=localStorage.getItem(Y0);if(t==null)return null;let e=Oh(JSON.parse(t));return e?{mode:e.mode,managed:e.managed}:null}catch{return null}}function Nh(t){try{localStorage.setItem(Y0,JSON.stringify({mode:t.mode,managed:t.managed})),localStorage.removeItem(Bh)}catch{}}function Dh(t,e){return t==null?"first":t===e?"match":"mismatch"}var Y0,Bh,zh=w(()=>{"use strict";G0();Fh();Y0="deepview.sync.serverInfo",Bh="deepview.sync.standaloneProbe"});function DT(){try{let t=localStorage.getItem(zd);return t!==null&&NT.has(t)?t:null}catch{return null}}function zT(){try{let t=localStorage.getItem(Hd);return t==="true"?!0:t==="false"?!1:null}catch{return null}}function ja(t){if(!Number.isFinite(t))return Ha;let e=Math.round(t*10)/10;return Math.min(Math.max(e,jd),Vd)}function UT(){try{let t=localStorage.getItem(Ud);if(t===null||t.trim()==="")return null;let e=Number(t);return Number.isFinite(e)?ja(e):null}catch{return null}}function Wd(t){try{let e=JSON.parse(t||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function Kd(){return Wd(He(Ua))}function xt(t){return t?Kd()[t]??"":""}function Z0(t){return Uh.add(t),()=>{Uh.delete(t)}}function Q0(t){for(let e of Uh)try{e(t)}catch(r){console.warn("repo-url listener:",r)}}function kr(t,e){if(!t)return;let r=Kd();e?r[t]=e:delete r[t],Je(Ua,JSON.stringify(r)).catch(n=>console.warn("saveRepoUrlFor:",n)),Sd(Ua,n=>{let o=Wd(n);return e?o[t]=e:delete o[t],JSON.stringify(o)}).catch(n=>console.warn("saveRepoUrlFor cross-tab merge:",n)),Q0(t)}async function ex(t,e){await Sd(Ua,r=>{let n=Wd(r),o=e==="replace"?{...t}:e==="prefer-imported"?{...n,...t}:{...t,...n};return JSON.stringify(o)}),jh()}async function Gd(t){if(!t||typeof t!="object")return[];let e=[];if(await Sd(Ua,r=>{let n=Wd(r);e=[];for(let[o,i]of Object.entries(t))!o||typeof i!="string"||!i||n[o]||(n[o]=i,e.push(o));return e.length===0?r:JSON.stringify(n)}),e.length===0)return e;jh();for(let r of e)Q0(r);return e}async function Hh(t,e){return!t||!e?!1:(await Gd({[t]:e})).length>0}function D(){return l.serverMode==="managed"&&!l.localMode}function ni(t){l.localMode=!!t}function Nr(){return l.serverMode==="standalone"&&l.localMode?"local":l.serverMode!=="managed"?l.serverMode:l.localMode?"local":"managed"}function jh(){l.repoEditing||l.currentFile&&(l.repoUrl=xt(l.currentFile))}var J0,zd,Ua,Ud,Hd,NT,Ha,jd,Vd,Uh,X0,l,xr=w(()=>{"use strict";gd();gn();zh();J0="deepview.viewMode",zd="deepview.severityMode",Ua="deepview.repoUrls",Ud="deepview.focusSplit",Hd="deepview.kanbanDetailFullscreen",NT=new Set(["corrected","original"]),Ha=50,jd=20,Vd=80;try{localStorage.removeItem(J0)}catch{}Uh=new Set;X0=or(),l=md({reports:[],workspaceMerges:[],currentFile:null,currentWorkspace:null,currentManagedTeam:null,currentManagedReport:null,currentReportWorkspace:null,currentView:"findings",currentLinks:null,bundles:[],storedFiles:[],selectedBundle:null,bundleDetails:null,bundleDetailsTab:"overview",selectedPackage:null,selectedPackageVersion:null,packageDetailsTab:"overview",packageSlideTriage:null,packageSlideTransient:!1,packagesSearchQuery:"",packagesSortBy:"findings-desc",expandedPackages:new Set,selectedRepository:null,repositoryDetailsTab:"overview",repositorySlideTriage:null,repositorySlideTransient:!1,repositoriesSearchQuery:"",repositoriesSortBy:"findings-desc",bundleSourceFile:null,bundleSourceFindingIdx:null,bundleCodeSearchMode:"files",bundleCodeSearchQuery:"",bundleSearchQuery:"",bundleSearchRegex:!1,bundleSearchCase:!1,bundleSearchContext:!0,filterSeverities:new Set,filterColors:new Set,filterSources:new Set,filterAnalyzer:"",filterModel:"",filterRepo:"",filterRevalidate:"",filterPartial:"",showRevalidation:!0,revalidationDetailed:!1,upstreamOnly:!1,revalidateConflicts:new Map,codePreviews:new Set,filterConfMin:0,filterConfMax:10,filterInclude:"",filterIncludeNegate:!1,filterComment:"",filterFix:"",filterFlagged:"",filterDuplicates:"",filterCrossContext:"",filterAppStacked:"",repoUrl:"",repoEditing:!1,sortBy:"severity",viewMode:"kanban",severityMode:DT()??"corrected",triage:new Map,shownTriage:null,nextFindingId:0,activeTabByGroup:new Map,tableSelectedGid:null,filesViewMode:"table",filesSearch:"",filesSelectedFile:null,kanbanPopoverGid:null,kanbanDetailFullscreen:zT()??!1,kanbanExpandedColumn:null,focusGid:null,focusCodeTick:0,focusCodeStack:[],focusCodeAt:0,focusSplit:UT()??Ha,codeBlockTick:0,bundleHashTick:0,linksTick:0,findingIndexTick:0,serverMode:X0?.mode??"e2e",deepviewScanServer:null,localMode:!1,managed:X0?.managed??null,serverModeMismatch:!1,managedSession:null,managedTeams:[],managedReport:null,managedReports:[]});Xn(()=>{jh()})});function rt(t){let e=[],r=-1,n="",o=0,i=0,s=0;for(let a of t.split(`
4
+ `)){let c=s;s+=a.length+1;let u=HT.exec(a);if(r!==-1){u&&u[2]===n&&u[1].length<=o+3&&(e.push([r,c+a.length]),r=-1);continue}if(u&&u[1].length<=i+3){r=c,n=u[2],o=u[1].length;continue}if(!a.trim())continue;let p=ss.exec(a),f=/^ */u.exec(a)[0].length;p&&p[1].length<=i+3?i=p[0].length:f<i&&(i=0)}return r!==-1&&e.push([r,t.length]),e}function zt(t,e){return t.some(([r,n])=>e>=r&&e<n)}function ir(t){return String(t??"").replaceAll(/\r\n?/gu,`
5
+ `)}function qd(t){return/^[0-9a-f]{7,64}$/iu.test(t)}function yn(t,e){let r=rt(t),n=[...t.matchAll(e)].filter(o=>!zt(r,o.index));return n.map((o,i)=>({heading:o[1],body:t.slice(o.index+o[0].length+1,n[i+1]?.index)}))}function ii(t,e){let r=rt(t),n=[...t.matchAll(e)].find(o=>!zt(r,o.index));return n?{head:t.slice(0,n.index),subs:yn(t,e)}:{head:t,subs:[]}}function Ka(t){let e=t.indexOf(`
6
+ `);return e===-1?{title:t.trim(),body:""}:{title:t.slice(0,e).trim(),body:t.slice(e+1)}}function jT(t){let e=[];for(let r of t.split(`
7
+ `)){let n=r.trim();if(!n.startsWith("|")||/^[\s:|-]+$/u.test(n)&&n.includes("-"))continue;let o=n.replace(/^\|/u,"").replace(/\|$/u,"").split("|").map(i=>i.trim());e.push(o)}return e}function Ga(t){let e=jT(t);if(e.length<2)return[];let r=e[0].map(o=>o.toLowerCase()),n=[];for(let o of e.slice(1)){if(o.length===r.length&&o.every((s,a)=>s.toLowerCase()===r[a]))continue;let i={};r.forEach((s,a)=>{s&&(i[s]=o[a]??"")}),n.push(i)}return n}function tx(t){let e=Object.create(null),r=Object.create(null),n=[],o=null,i="",s=[],a="",c=(f,h,g)=>{!f||f in e||(e[f]=g.trim(),r[f]=h)},u=()=>{o&&c(o,i,s.join(`
8
+ `)),o=null,i="",s=[]},p=f=>{(o?s:n).push(f)};for(let f of t.split(`
9
+ `)){let h=/^ {0,3}(```|~~~)/u.exec(f),g=h!==null&&(!a||h[1]===a);if(g&&(a=a?"":h[1]),g||a){p(f);continue}if(!f.trim()){o?u():n.push(f);continue}let y=/^\s*(?:[-*] +)?\*\*([^:*]+):\*\*\s*(.*)$/u.exec(f);if(y){u();let b=y[1].trim(),v=y[2],x;for(;(x=/\s+[·•]\s+\*\*([^:*]+):\*\*\s*/u.exec(v))!==null;)c(b.toLowerCase(),b,v.slice(0,x.index)),b=x[1].trim(),v=v.slice(x.index+x[0].length);o=b.toLowerCase(),i=b,s=[v];continue}if(/^\s*(?:#{1,6} |\||[-=*_]{3,}\s*$)/u.test(f)){u();continue}p(f)}return u(),{fields:e,labels:r,prose:n.join(`
10
+ `).trim()}}function Yd(t){let e=(t||"").trim(),r="",n=as(e);n&&(e=n.label.trim(),r=n.url.trim());let o="",i=/#L(\d+)/u.exec(r);i&&(o=i[1]);let c=[...e.matchAll(/`([^`]+)`/gu)].map(f=>f[1].trim()).find(f=>!f.includes("(")&&(f.includes("/")||/\.\w/u.test(f)))??(e.replaceAll("`","").trim().split(/[\s,]+/u).find(Boolean)||""),u=/^(.*?)#L(\d+)(?:-L?\d+)?$/u.exec(c);u&&(c=u[1],o||(o=u[2]));let p=Vh.exec(c);return p?(o||(o=p[2]),{file:p[1],line:o,locationLink:r}):{file:c,line:o||"?",locationLink:r}}function Wh(t){return t.replaceAll("**","")}function as(t){let e=String(t??""),r=VT(e,WT(e)),n=KT(e),o=e.indexOf("]");for(let i=e.indexOf("[");i!==-1;i=e.indexOf("[",i+1)){for(;o!==-1&&o<=i;)o=e.indexOf("]",o+1);for(let s of[o,r.get(i)??-1]){if(s===-1||s===i+1||e[s+1]!=="(")continue;let a=GT(e,s+1,n);if(a!==null)return{label:e.slice(i+1,s),url:a,index:i}}}return null}function VT(t,e){let r=new Map,n=[];for(let o=0;o<t.length;o++){let i=t[o];rx(t,o)?o++:i==="`"?o=e.get(o)??o:i==="["?n.push(o):i==="]"&&n.length>0&&r.set(n.pop(),o)}return r}function WT(t){let e=[];for(let o=t.indexOf("`");o!==-1;o=t.indexOf("`",o)){let i=1;for(;t[o+i]==="`";)i++;e.push([o,i]),o+=i}let r=new Map,n=new Map;for(let o=e.length-1;o>=0;o--){let[i,s]=e[o],a=n.get(s);a!==void 0&&r.set(i,a+s-1),n.set(s,i)}return r}function KT(t){let e=t.length,r=new Int32Array(e+1).fill(-1),n=new Int32Array(e+1).fill(-1),o=new Int32Array(e+1).fill(-1),i=new Int32Array(e+1).fill(-1);for(let c=e-1;c>=0;c--)r[c]=t[c]===")"?c:r[c+1],n[c]=/\s/u.test(t[c])?c:n[c+1],o[c]=t[c]===">"?c:o[c+1],i[c]=t[c]===`
11
+ `?c:i[c+1];let s=new Map,a=[];for(let c=0;c<e;c++){let u=t[c];rx(t,c)?c++:n[c]===c?a.length=0:u==="("?a.push(c):u===")"&&a.length>0&&s.set(a.pop(),c)}return{balanced:s,nextClose:r,nextSpace:n,nextAngle:o,nextLine:i}}function GT(t,e,r){let n=qT(t,e,r);if(n)return n;let o=r.balanced.get(e);if(o!==void 0)return o>e+1?t.slice(e+1,o):null;let i=r.nextClose[e+1],s=r.nextSpace[e+1];return i===-1||i===e+1||s!==-1&&s<i?null:t.slice(e+1,i)}function qT(t,e,r){if(t[e+1]!=="<")return"";let n=r.nextAngle[e+2],o=r.nextLine[e+2];return n===-1||o!==-1&&o<n||t[n+1]!==")"?"":t.slice(e+2,n)}function rx(t,e){return t[e]==="\\"&&XT.test(t[e+1]??"")}function qa(t){return typeof t=="string"?t.replace(YT,"$1"):t}function nx(t){let e=/^\[(.+)\]$/u.exec(t.trim());return e?e[1].trim():t.trim()}function si(t){let e=(t||"").trim();return/^[-–—]+$/u.test(e)?"":e}var HT,ss,Va,Wa,oi,Vh,YT,XT,sr=w(()=>{"use strict";HT=/^( *)(```|~~~)/u,ss=/^( *)(?:[-*+]|\d{1,9}[.)]) +(?=\S)/u;Va=/^## +(.*)$/gmu,Wa=/^### +(.*)$/gmu,oi=/^#### +(.*)$/gmu,Vh=/^(.+):(\d+(?:-\d+)?)$/u;YT=/\\([!-/:-@[-`{-~])/gu,XT=/[!-/:-@[-`{-~]/u});function ZT(t){switch(t.toUpperCase()){case"CRITICAL":return"critical";case"HIGH":return"high";case"MEDIUM":return"medium";case"LOW":return"low";case"HIGH_BUG":return"high_bug";case"BUG":return"bug";case"INFO":case"INFORMATIONAL":return"informational";default:return"medium"}}function QT(t){if(t!==void 0)return ox.get(ix(t))??ox.get("medium")}function sx(t){let r=ir(t).trim().split(JT);if(r.length===1)return null;let n=[];for(let o=1;o<r.length;o+=2){let i=ZT(r[o]);for(let s of r[o+1].split(/^### /mu).slice(1)){let a=tM(s,i);a&&n.push(a)}}return n.length===0?null:{type:"security",source:"deepsec",findings:n}}function tM(t,e){let{title:r,body:n}=Ka(t);if(!r)return null;let o=n.replace(/\n---\s*$/u,"").trim(),i={};for(let v of o.matchAll(/^- \*\*([^:*]+):\*\*\s*(.+)$/gmu))i[v[1].trim().toLowerCase()]=v[2].trim();let s=/^\*\*Recommendation:\*\*\s*/mu.exec(o),a=o,c="";s&&(a=o.slice(0,s.index),c=o.slice(s.index+s[0].length).trim());let u=a.split(`
6
12
  `).filter(v=>!/^\s*- \*\*/u.test(v)).join(`
7
- `).replaceAll("**","").trim(),p=n+(u?`
8
-
9
- `+u:""),f=l$(i.file||"unknown"),h=(i.lines||"").split(",").map(v=>v.trim()).find(Boolean)||"?",m={file:f,line:h,severity:t,description:p};d&&(m.recommendation=d.replaceAll("**",""));let b=a$(i.confidence);return b!==void 0&&(m.confidence=b),i.slug&&(m.slug=i.slug),m}var d$=/^( *)(```|~~~)/u,u$=/^( *)(?:[-*+]|\d{1,9}[.)]) +(?=\S)/u;function br(e){let t=[],r=-1,n="",o=0,i=0,s=0;for(let l of e.split(`
10
- `)){let d=s;s+=l.length+1;let u=d$.exec(l);if(r!==-1){u&&u[2]===n&&u[1].length<=o+3&&(t.push([r,d+l.length]),r=-1);continue}if(u&&u[1].length<=i+3){r=d,n=u[2],o=u[1].length;continue}if(!l.trim())continue;let p=u$.exec(l),f=/^ */u.exec(l)[0].length;p&&p[1].length<=i+3?i=p[0].length:f<i&&(i=0)}return r!==-1&&t.push([r,e.length]),t}function nn(e,t){return e.some(([r,n])=>t>=r&&t<n)}function yr(e,t){let r=br(e),n=[...e.matchAll(t)].filter(o=>!nn(r,o.index));return n.map((o,i)=>({heading:o[1],body:e.slice(o.index+o[0].length+1,i+1<n.length?n[i+1].index:e.length)}))}function p$(e){let t=[];for(let r of e.split(`
11
- `)){let n=r.trim();if(!n.startsWith("|")||/^[\s:|-]+$/u.test(n)&&n.includes("-"))continue;let o=n.replace(/^\|/u,"").replace(/\|$/u,"").split("|").map(i=>i.trim());t.push(o)}return t}function Zo(e){let t=p$(e);if(t.length<2)return[];let r=t[0].map(o=>o.toLowerCase()),n=[];for(let o of t.slice(1)){if(o.length===r.length&&o.every((s,l)=>s.toLowerCase()===r[l]))continue;let i={};r.forEach((s,l)=>{s&&(i[s]=o[l]??"")}),n.push(i)}return n}function dg(e){let t=Object.create(null),r=Object.create(null),n=[],o=null,i="",s=[],l="",d=(p,f,h)=>{!p||p in t||(t[p]=h.trim(),r[p]=f)},u=()=>{o&&d(o,i,s.join(`
12
- `)),o=null,i="",s=[]};for(let p of e.split(`
13
- `)){let f=/^ {0,3}(```|~~~)/u.exec(p);if(f&&(!l||f[1]===l)){l=l?"":f[1],(o?s:n).push(p);continue}if(l){(o?s:n).push(p);continue}if(!p.trim()){o?u():n.push(p);continue}let h=/^\s*(?:[-*] +)?\*\*([^:*]+):\*\*\s*(.*)$/u.exec(p);if(h){u();let m=h[1].trim(),b=h[2],v;for(;(v=/\s+[·•]\s+\*\*([^:*]+):\*\*\s*/u.exec(b))!==null;)d(m.toLowerCase(),m,b.slice(0,v.index)),m=v[1].trim(),b=b.slice(v.index+v[0].length);o=m.toLowerCase(),i=m,s=[b];continue}if(/^\s*(?:#{1,6} |\||[-=*_]{3,}\s*$)/u.test(p)){u();continue}o?s.push(p):n.push(p)}return u(),{fields:t,labels:r,prose:n.join(`
14
- `).trim()}}function sa(e){let t=(e||"").trim(),r="",n=/\[([^\]]+)\]\(([^)]+)\)/u.exec(t);n&&(t=n[1].trim(),r=n[2].trim());let o="",i=/#L(\d+)/u.exec(r);i&&(o=i[1]);let d=[...t.matchAll(/`([^`]+)`/gu)].map(f=>f[1].trim()).find(f=>!f.includes("(")&&(f.includes("/")||/\.\w/u.test(f)))??(t.replaceAll("`","").trim().split(/[\s,]+/u).find(Boolean)||""),u=/^(.*?)#L(\d+)(?:-L?\d+)?$/u.exec(d);u&&(d=u[1],o||(o=u[2]));let p=/^(.+):(\d+(?:-\d+)?)$/u.exec(d);return p?(o||(o=p[2]),{file:p[1],line:o,locationLink:r}):{file:d,line:o||"?",locationLink:r}}function Uc(e){return e.replaceAll("**","")}var f$=/\\([!-/:-@[-`{-~])/gu;function aa(e){return typeof e=="string"?e.replace(f$,"$1"):e}function on(e){let t=(e||"").trim();return/^[-–—]+$/u.test(t)?"":t}function vr(e){switch(((e||"").trim().split(/\s+/u)[0]||"").replaceAll(/[`*]+/gu,"").toUpperCase()){case"CRITICAL":return"critical";case"HIGH":return"high";case"MEDIUM":return"medium";case"LOW":return"low";case"INFO":case"INFORMATIONAL":return"informational";default:return""}}function ei(e){let t=/^([CHML])-?\d+$/iu.exec((e||"").trim());return t?{C:"critical",H:"high",M:"medium",L:"low"}[t[1].toUpperCase()]:""}function Hc(e){let t=/^(critical|high|medium|low|informational|info)(?:[ -](?:severity|risk))?(?:[ -]findings?)?(?:\s*\(\d+\))?$/iu.exec((e||"").trim());return t?vr(t[1]):""}function ug(e){let t=/^(critical|high|medium|low|informational|info)\b/iu.exec((e||"").trim());return t?vr(t[1]):""}function Hn(e){return/^variants?\s*(?:\(\d+\))?\s*:?$/iu.test((e||"").trim())}function Un(e){let t=/^([CHML]-?\d{1,4}|(?:p|q|b|r|m|l|x|diff)\d{0,4}-\d{2,4})(?:-([A-Za-z0-9][\w-]*))?$/iu.exec(e||"");return t?{id:t[1].toUpperCase(),slug:t[2]||""}:null}function la(e){return(e||"").replaceAll("-"," ")}function Vn(e){let t=(e||"").trim(),r=/^\[([^\]]+)\]\([^)]*\)$/u.exec(t),n=r?r[1].trim():t,o=/^\[(.+)\]$/u.exec(n);return(o?o[1].trim():n).toUpperCase()}function Vc(e){let t=e,r="",n=/^\[([^\]]+)\]\(([^)]+)\)\s*[:—–-]*\s*(.*)$/u.exec(t);n&&(r=n[2].trim(),t=n[3]?`${n[1].trim()} ${n[3].trim()}`:n[1].trim());let o=/^\[([^\]]+)\] *(.*)$/u.exec(t);if(o){let d=Un(o[1].trim());return d?{id:d.id,title:o[2].trim()||la(d.slug)||d.id,link:r}:{id:o[1].trim().toUpperCase(),title:o[2].trim(),link:r}}let i=t.search(/\s/u),s=(i===-1?t:t.slice(0,i)).replace(/[:.,—–-]+$/u,""),l=Un(s);if(l){let d=(i===-1?"":t.slice(i+1)).replace(/^[:—–-]+\s*/u,"").trim();return{id:l.id,title:d||la(l.slug)||l.id,link:r}}return{id:"",title:t.trim(),link:r}}function pg(e){let t={},r=i=>(/`([^`]+)`/u.exec(i)?.[1]??i.split(/\s+/u)[0]??"").trim(),n=/^\s*(?:[-*] +)?\*\*Target:?\*\*\s*(.*)$/imu.exec(e||"");if(n){let i=r(n[1]);/^[\w.-]+\/[\w.-]+$/u.test(i)&&(t.repo=i)}let o=/^\s*(?:[-*] +)?\*\*Commit[^:*]*:?\*\*\s*(.*)$/imu.exec(e||"");if(o){let i=r(o[1]);/^[0-9a-f]{7,64}$/iu.test(i)&&(t.commitHash=i)}return t}var jc=["key code reference","key code","code reference","location","affected file","file","path"];function fg(e){for(let t of jc)if(e[t])return e[t];return""}function ca(e){return{id:Vn(e.id||""),title:on(e.title),severity:on(e.severity),pocStatus:on(e["poc status"]||e.poc),status:on(e.status),parent:Vn(on(e.parent||"")),location:on(e.location)}}function da(e,t=""){let r=vr(e.severity)||t||ei(e.id)||"medium",{file:n,line:o,locationLink:i}=sa(e.location||""),s={file:n||"unknown",line:o,severity:r,description:Uc(e.title||e.id)};return i?s.location=i:s.file==="unknown"&&e.id&&(s.location=`piolium:${e.id}`),e.pocStatus&&(s.pocStatus=e.pocStatus),e.status&&(s.status=e.status),e.parent&&(s.parent=e.parent),s}function Wc(e,t,r){let n=[];for(let o of e.split(`
15
- `)){let i=/^\s{0,3}(?:[-*+]|\d{1,3}[.)])\s+(.+)$/u.exec(o);if(!i)continue;let s=i[1].trim();if(/^\*\*[^:*]+:\*\*/u.test(s))continue;let l="",d=/^\[([^\]]+)\]\(([^)]+)\)\s*[:—–-]*\s*(.*)$/u.exec(s);if(d)l=d[2].trim(),s=d[3]?`${d[1].trim()} ${d[3].trim()}`:d[1].trim();else{let w=/^\*\*([^*]+)\*\*\s*[:—–-]*\s*(.*)$/u.exec(s);w&&(s=w[2]?`${w[1].trim()} ${w[2].trim()}`:w[1].trim())}if(/^(?:none\b|no |n\/a\b)/iu.test(s))continue;let u=s.search(/\s/u),p=(u===-1?s:s.slice(0,u)).replace(/[:.,—–-]+$/u,""),f=Un(p),h="",m=s;if(f){h=f.id;let w=(u===-1?"":s.slice(u+1)).replace(/^[:—–-]+\s*/u,"").trim(),k=la(f.slug);m=k&&w?`${k}
16
-
17
- ${w}`:w||k||f.id}let b=r.get(h),y={file:"unknown",line:"?",severity:vr(b?.severity)||t||ei(h)||"medium",description:Uc(m)};h?y.location=`piolium:${h}`:l&&(y.location=l),l.endsWith("report.md")&&(y.reportPath=l),b?.pocStatus&&(y.pocStatus=b.pocStatus),b?.status&&(y.status=b.status),b?.parent&&(y.parent=b.parent),n.push({id:h,finding:y})}return n}function ti(e,t,r,n=""){let o=[];for(let s of Zo(e)){let l=ca(s);!l.id&&!l.title||(!l.parent&&r&&(l.parent=r),l.id&&!t.has(l.id)&&t.set(l.id,l),o.push({id:l.id,finding:da(l,n)}))}if(o.length>0)return o;let i=Wc(e,n,t);for(let s of i)r&&!s.finding.parent&&(s.finding.parent=r);return i}var Kc=/^### +(.*)$/gmu,pa=/^#### +(.*)$/gmu,h$=new Set(["technical findings detail","technical findings","detailed findings","findings detail","findings"]);function g$(e){return h$.has(e)||e.startsWith("findings by severity")}var m$=/^(?:summary of findings|deferred|methodolog|executive|conclusion|attack surface|coverage|discoveries|scope|table of contents|contents|appendix|recommendation|remediation)/u;function b$(e){return m$.test(e)}function gg(e){let{id:t}=Vc(e);return!!(t&&Un(t))}function y$(e){let t=yr(e,Kc);return(t.length>0?t:yr(e,pa)).some(({heading:n})=>gg(n))}function jn(e){let t=e.replaceAll(/\r\n?/gu,`
18
- `).trim();if(!/^# +Security Audit Report\b/mu.test(t)&&!/^## +Technical Findings Detail\s*$/imu.test(t)&&!/^## +Findings by Severity\b/imu.test(t))return null;let r=k$(t),n=$$(r["summary of findings"]||""),o=pg(qc(t,/^## +(.*)$/gmu).head),i=[],s=new Set,l=[],d=(p,f)=>{i.push(f),p&&s.add(p)},u=p=>{for(let f of p)d(f.id,f.finding)};for(let[p,f]of Object.entries(r)){let h=Hc(p);if(h){u(Gc(f,h,n,l));continue}if(g$(p)){u(hg(f,n,l));continue}!b$(p)&&y$(f)&&u(hg(f,n,l,ug(p)))}for(let p of l)p.id&&s.has(p.id)||d(p.id,p.finding);for(let p of n.values())s.has(p.id)||d(p.id,da(p));if(i.length===0)return null;for(let p of i)o.repo&&(p.repo={github:o.repo}),o.commitHash&&!p.auditedCommit&&(p.auditedCommit=o.commitHash);return{type:"security",source:"piolium",findings:i}}function hg(e,t,r,n=""){let o=yr(e,Kc);return o.length===0?Gc(e,n,t,r):mg(o,t,r,n)}function mg(e,t,r,n){let o=[],i="";for(let{heading:s,body:l}of e){let d=Hc(s);if(d){o.push(...Gc(l,d,t,r)),i="";continue}if(Hn(s)){o.push(...w$(l,t,i,r,n));continue}let u=v$(s,l,t,r,n);o.push(...u),i=u[0]?.id||i}return o}function v$(e,t,r,n,o=""){let{head:i,subs:s}=qc(t,pa),l=[],d=ua(e,i,r,o),u=!!d&&!d.id&&s.some(f=>!Hn(f.heading)&&gg(f.heading));d&&!u&&l.push({id:d.id,finding:d.finding});let p=u?"":d?.id||"";for(let f of s){if(Hn(f.heading)){n.push(...ti(f.body,r,p,o));continue}let h=ua(f.heading,f.body,r,o);h&&l.push({id:h.id,finding:h.finding})}return l}function w$(e,t,r,n,o=""){let{head:i,subs:s}=qc(e,pa);n.push(...ti(i,t,r,o));let l=[];for(let d of s){if(Hn(d.heading)){n.push(...ti(d.body,t,"",o));continue}let u=ua(d.heading,d.body,t,o);u&&l.push({id:u.id,finding:u.finding})}return l}function Gc(e,t,r,n){let o=yr(e,Kc);if(o.length>0)return mg(o,r,n,t);let i=[],s="";for(let{heading:d,body:u}of yr(e,pa)){if(Hn(d)){n.push(...ti(u,r,s,t));continue}let p=ua(d,u,r,t);p&&(i.push({id:p.id,finding:p.finding}),s=p.id||s)}if(i.length>0)return i;let l=Zo(e).map(ca).filter(d=>d.id||d.title);if(l.length>0){for(let d of l)!d.severity&&t&&(d.severity=t),d.id&&!r.has(d.id)?r.set(d.id,d):d.id||n.push({id:"",finding:da(d,t)});return[]}return n.push(...Wc(e,t,r)),[]}function ua(e,t,r,n=""){let o=e.trim();if(!o)return null;let{id:i,title:s,link:l}=Vc(o),d=r.get(i);if(!i&&s){for(let F of r.values())if(F.title.toLowerCase()===s.toLowerCase()){i=F.id,d=F;break}}let{fields:u,labels:p,prose:f}=dg(t),h=vr(u.severity)||vr(d?.severity)||n||ei(i)||"medium",{file:m,line:b,locationLink:v}=sa(fg(u)),y=b;if(y==="?"&&(u.line||u.lines)){let F=/\d+/u.exec(u.line||u.lines);F&&(y=F[0])}let w=/\*\*Variant of:?\*\*\s*\[?([^\]\s)]+)/iu.exec(t),k=f.split(`
19
- `).filter(F=>!/^\s*<a\s[^>]*>\s*<\/a>\s*$/iu.test(F)&&!/\*\*Variant of:?\*\*/iu.test(F)).join(`
20
- `).trim(),_={file:m||"unknown",line:y,severity:h,description:S$(s||i,u,p,k)};v?_.location=v:_.file==="unknown"&&i&&(_.location=`piolium:${i}`);let R=u["poc status"]||u.poc||d?.pocStatus;R&&(_.pocStatus=R);let C=u["detailed report"]||(l.endsWith("report.md")?l:"");C&&(_.reportPath=C),d?.status&&(_.status=d.status);let M=u["variant of"]?Vn(u["variant of"].split(/\s+/u)[0]):"",z=d?.parent||M||(w?Vn(w[1]):"");return z&&(_.parent=z),{id:i,finding:_}}function k$(e){let t=Object.create(null);for(let{heading:r,body:n}of yr(e,/^## +(.*)$/gmu)){let o=r.trim().toLowerCase();o&&(t[o]=o in t?`${t[o]}
21
- ${n}`:n)}return t}function qc(e,t){let r=br(e),n=[...e.matchAll(t)].find(o=>!nn(r,o.index));return n?{head:e.slice(0,n.index),subs:yr(e,t)}:{head:e,subs:[]}}function $$(e){let t=new Map;for(let r of Zo(e)){let n=ca(r);n.id&&t.set(n.id,n)}return t}var x$=new Set([...jc,"severity","summary","files","poc","poc status","line","lines","detailed report","proof of concept","evidence","variant of","pattern","status","id","title"]);function S$(e,t,r,n){let o=[e];t.summary&&o.push(t.summary),n&&o.push(n);for(let[i,s]of Object.entries(t))!s||x$.has(i)||o.push(`**${r[i]||i}:** ${s}`);return o.filter(Boolean).join(`
22
-
23
- `)}var _$=new Set(["critical","high","medium","low","high_bug","bug","informational"]);function bg(e){let t=C$(e);if(!t)return null;let{severity:r,description:n,location:o,file:i,line:s}=t;return o?{severity:r,description:n,location:o}:{severity:r,description:n,file:i,line:s}}function C$(e){let t=e.indexOf(`
24
- `),r=(t===-1?e:e.slice(0,t)).trim();if(!r)return null;let n=t===-1?"":e.slice(t+1),{sectionsText:o,metaText:i}=E$(n),s=A$(o),l=T$(i),{file:d,line:u,locationLink:p}=R$(s.location||""),f=(l.severity||"").toLowerCase();return{severity:_$.has(f)?f:"medium",description:I$(r,s),location:p,file:d||"unknown",line:u}}function E$(e){let t=/^---\s*$/mu,r=t.exec(e);if(!r)return{sectionsText:e,metaText:""};let n=e.slice(0,r.index).trim(),o=e.slice(r.index+r[0].length).replace(/^\n/u,""),i=t.exec(o),s=i?o.slice(0,i.index):o;return{sectionsText:n,metaText:s}}function A$(e){let t={},r=e.split(/^## /mu);for(let n=1;n<r.length;n++){let o=r[n],i=o.indexOf(`
25
- `),s=(i===-1?o:o.slice(0,i)).trim().toLowerCase(),l=(i===-1?"":o.slice(i+1)).trim();s&&(t[s]=l)}return t}function T$(e){let t={};for(let r of e.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))t[r[1].trim().toLowerCase()]=r[2].trim();return t}function R$(e){let t="",r="?",n="",o=e.match(/\[([^\]]+)\]\(([^)]+)\)/u);if(o){t=o[1].trim(),n=o[2];let s=o[2].match(/#L(\d+)/u);s&&(r=s[1])}else t=e.trim(),n=e.trim();let i=t.match(/^(.+):(\d+)$/u);return i&&(t=i[1],r==="?"&&(r=i[2])),{file:t,line:r,locationLink:n}}function I$(e,t){let r=[e];return t.details&&r.push(t.details),t.impact&&r.push(`Impact: ${t.impact}`),t["reproduction steps"]&&r.push(`Reproduction: ${t["reproduction steps"]}`),M$(r.join(`
26
-
27
- `))}function M$(e){return e.replaceAll("**","")}var F$=new Set(["critical","high","medium","low","high_bug","bug","informational"]);function Wn(e){let t=e.replaceAll(/\r\n?/gu,`
28
- `).trim();if(!t.startsWith("# "))return null;let r=t.split(/^# /mu).filter(i=>i.trim().length>0),n=[];for(let i of r){let s=B$(i);s&&n.push(s)}return n.length===0?null:{type:n.find(i=>i.type)?.type||"analysis",source:"claude-security",findings:n}}function B$(e){let t=e.indexOf(`
29
- `),r=(t===-1?e:e.slice(0,t)).trim();if(!r)return null;let n=t===-1?"":e.slice(t+1),{sectionsText:o,metaText:i}=L$(n),s=P$(o),l=O$(i),d=N$(s.evidence||""),{file:u,line:p,locationLink:f}=vg(s.location||d[0]?.ref||""),h=(l.severity||"").toLowerCase(),m=F$.has(h)?h:"medium",b=z$(r,s,d.length>0),v=s["recommended fix"]||void 0,y={file:u||"unknown",line:p,severity:m,description:b};f&&(y.location=f),d.length>0&&(y.evidence=d.map(D$)),v&&(y.recommendation=v),l.repository&&(y.repo={github:l.repository}),l.branch&&(y.branch=l.branch),l["date created"]&&(y.dateCreated=l["date created"]),l.status&&(y.status=l.status),l.category&&(y.type=l.category.toLowerCase());let w=bg(e);return w&&(y._idBasis=w),y}function L$(e){let t=/^---\s*$/mu,r=t.exec(e);if(!r)return{sectionsText:e,metaText:""};let n=e.slice(0,r.index).trim(),o=e.slice(r.index+r[0].length).replace(/^\n/u,""),i=t.exec(o),s=i?o.slice(0,i.index):o;return{sectionsText:n,metaText:s}}function P$(e){let t={},r=e.split(/^## /mu);for(let n=1;n<r.length;n++){let o=r[n],i=o.indexOf(`
30
- `),s=(i===-1?o:o.slice(0,i)).trim().toLowerCase(),l=(i===-1?"":o.slice(i+1)).trim();s&&(t[s]=l)}return t}function O$(e){let t={};for(let r of e.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))t[r[1].trim().toLowerCase()]=r[2].trim();return t}function vg(e){let t="",r="?",n="",o=e.match(/\[([^\]]+)\]\(([^)\s]+)\)/u);if(o){t=o[1].trim(),n=o[2].trim();let s=n.match(/#L(\d+)(?:-L?(\d+))?/u);s&&(r=s[2]?`${s[1]}-${s[2]}`:s[1])}else t=e.trim(),n=e.trim();t=aa(t.replaceAll("`","")).trim();let i=t.match(/^(.+):(\d+)(?:\s*[-–—]\s*L?(\d+))?$/u);return i&&(t=i[1],r==="?"&&(r=i[3]?`${i[2]}-${i[3]}`:i[2])),{file:t,line:r,locationLink:n}}var yg=/^[ \t]*(?:\d+[.)]|[-*+])\s+/u,wg=/\[[^\]]+\]\([^)\s]+\)/u;function N$(e){let t=[];for(let r of e.split(`
31
- `))yg.test(r)?t.push({ref:r.replace(yg,"").trim(),note:[]}):t.length>0&&r.trim()&&t.at(-1).note.push(r.trim());if(t.length===0){let r=e.split(`
32
- `).map(i=>i.trim()).filter(Boolean),n=r.findIndex(i=>wg.test(i));if(n===-1&&r.length!==1)return[];let o=n===-1?0:n;t.push({ref:r[o],note:r.filter((i,s)=>s!==o)})}return t.filter(r=>r.ref)}function D$({ref:e,note:t}){let{file:r,line:n,locationLink:o}=vg(e),i={file:r||"unknown",line:n};o&&wg.test(e)&&(i.url=o);let s=t.join(`
33
- `);return s&&(i.text=s),i}function z$(e,t,r){let n=[e];return t.details&&n.push(t.details),t.evidence&&!r&&n.push(`**Evidence:**
34
- ${t.evidence}`),t.impact&&n.push(`**Impact:** ${t.impact}`),t["reproduction steps"]&&n.push(`**Reproduction:** ${t["reproduction steps"]}`),n.join(`
35
-
36
- `)}function U$(e){return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}function H$(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return btoa(t)}async function kg(e){let t=typeof e=="string"?re(e):e,r=await crypto.subtle.digest("SHA-512",t);return`sha512-${H$(new Uint8Array(r))}`}async function V$(e){let t=re(JSON.stringify(e)),r=await crypto.subtle.digest("SHA-256",t),n=new Uint8Array(r,0,16);n[6]=n[6]&15|64,n[8]=n[8]&63|128;let o=U$(n);return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20,32)}`}async function fa(e){if(typeof crypto?.subtle?.digest!="function")return null;let t;e._idBasis?t=e._idBasis:e.fileHash?t={severity:e.severity,description:e.description,fileHash:e.fileHash}:e.location?t={severity:e.severity,description:e.description,location:e.location}:t={severity:e.severity,description:e.description,file:e.file,line:e.line};try{return await V$(t)}catch{return null}}function Ft(e){try{return JSON.parse(e)}catch{return zn(e)??jn(e)??Wn(e)}}function Bt(e){let t=[];for(let r of e){let n=Array.isArray(r)?r:[r];for(let o of n)o&&t.push(o)}return t}async function wr(e){let t=e.filter(n=>n&&!n.id);if(t.length===0)return;let r=await Promise.all(t.map(fa));t.forEach((n,o)=>{r[o]&&(n.id=r[o])})}var j$=["type","model","think","effort","exportsMode"];function ha(e,t){if(!t.source)for(let r of j$)e[r]==null&&t[r]!=null&&(e[r]=t[r])}var W$=/^(?:https?:\/\/)?(?:www\.)?github\.com\/([^/?#]+)\/([^/?#]+?)(?:\.git)?(?:[/?#].*)?$/iu,K$=/^[\w.-]+\/[\w.-]+$/u;function ga(e){let t=e?.repo?.github;if(typeof t!="string")return null;let r=t.trim().replace(/\/+$/u,"");if(!r)return null;let n=W$.exec(r),o=(n?`${n[1]}/${n[2]}`:r).replace(/\.git$/u,"");return K$.test(o)?o:null}var sn=new Map,Kn=new Map,Gn=new Map,ma=new Map;function G$(e){let t=e?.package?.npm;if(typeof t?.name=="string"&&t.name&&!Fn(t))return t.name;if(!e?.file)return null;let r=/(?:^|\/)(?:node_modules|dependencies)\/(@[^/]+\/[^/]+|[^/]+)/gu,n;for(;(n=r.exec(e.file))!==null;)if(n[1]!==".pnpm")return n[1];return null}function q$(e){return typeof e?.file!="string"?!1:/(?:^|\/)(?:node_modules|dependencies)\//u.test(e.file)}function Y$(e,t){return typeof e.repo?.github=="string"&&e.repo.github?e.repo.github:typeof e._repoFallback=="string"&&e._repoFallback?e._repoFallback:typeof t=="string"&&t?t:null}var ni=new Set,Yc=new Set,ri=null,Xc=!1;function Jc(e){return Yc.add(e),()=>Yc.delete(e)}function Qc(){for(let e of Yc)try{e()}catch{}}function oi(e){return sn.get(e)?.list??[]}function Zc(){let e=0;for(let t of sn.values())e+=t.list.length;return e}function Lt(){return Kn}function an(){return Gn}function ii(e,t){let r=sn.get(e);if(!r)return[];let n=r.reports.get(kr(t));return n?[...n]:[]}function ed(e,t){let r=Kn.get(e);if(!r)return[];let n=r._keyReports.get(kr(t));return n?[...n]:[]}function td(e,t){let r=Gn.get(e);if(!r)return[];let n=r._keyReports.get(kr(t));return n?[...n]:[]}function X$(e){let t=Array.isArray(e?.findings)?e.findings:Array.isArray(e?.groups)?e.groups:null;if(!t)return[];let r=[];for(let n of Bt(t))ha(n,e),r.push(n);return r}function kr(e){return e.id?`id:${e.id}`:`c:${e.severity??""}|${e.description??""}|${e.file??""}|${e.line??""}`}function rd(e,t,r){let n=ma.get(e);n||(n={hash:[],pkg:[],repo:[]},ma.set(e,n)),n[t].push(r)}function J$(e,t,r){let n=sn.get(e.fileHash);n||(n={keys:new Set,list:[],reports:new Map},sn.set(e.fileHash,n));let o=n.reports.get(t);o||(o=new Set,n.reports.set(t,o));let i=!o.has(r);return o.add(r),i&&rd(r,"hash",{hash:e.fileHash,key:t}),n.keys.has(t)?i:(n.keys.add(t),n.list.push(e),!0)}function Q$(e,t,r){let n=G$(e);if(!n)return!1;let o=Nh(e),i=Kn.get(n);if(i||(i={...Is(),repos:new Set,byVersion:new Map,_repoReports:new Map},Kn.set(n,i)),typeof e.repo?.github=="string"&&e.repo.github){i.repos.add(e.repo.github);let l=i._repoReports.get(e.repo.github);l||i._repoReports.set(e.repo.github,l=new Set),l.add(r)}Dh(i,o,e,t,r);let s=Ms(i,t,r,e);return rd(r,"pkg",{pkg:n,key:t,file:e.file,version:o}),s}function Z$(e,t,r,n){if(q$(e))return!1;let o=Y$(e,n);if(!o)return!1;let i=Gn.get(o);i||(i=Is(),Gn.set(o,i));let s=Ms(i,t,r,e);return s&&rd(r,"repo",{repo:o,key:t,file:e.file}),s}function nd(e){let t=ma.get(e);if(ma.delete(e),ni.delete(e),!t)return!1;let r=!1;for(let{hash:o,key:i}of t.hash){let s=sn.get(o);if(!s)continue;let l=s.reports.get(i);if(l){if(l.delete(e)&&(r=!0),l.size===0){s.reports.delete(i),s.keys.delete(i);let d=s.list.findIndex(u=>kr(u)===i);d>=0&&s.list.splice(d,1)}s.keys.size===0&&sn.delete(o)}}let n=new Set;for(let{pkg:o,key:i,file:s,version:l}of t.pkg){let d=Kn.get(o);if(!d)continue;let u=d._keyReports.get(i);if(u){if(u.delete(e)&&(r=!0),u.size===0&&Fs(d,i,s,kr),zh(d,l,i,s,e,kr),!n.has(o)){n.add(o);for(let p of[...d._repoReports.keys()]){let f=d._repoReports.get(p);f?.delete(e)&&f.size===0&&(d._repoReports.delete(p),d.repos.delete(p),r=!0)}}d._keyReports.size===0?Kn.delete(o):Bs(d)}}for(let{repo:o,key:i,file:s}of t.repo){let l=Gn.get(o);if(!l)continue;let d=l._keyReports.get(i);d&&(d.delete(e)&&(r=!0),d.size===0&&Fs(l,i,s,kr),l._keyReports.size===0?Gn.delete(o):Bs(l))}return r}async function ex(e){if(ni.has(e))return!1;ni.add(e);try{let t=await Ne(e),r=Ft(t);if(!r)return!1;let n=X$(r);if(n.length===0)return!1;let o=ga(r)??"";if(!o)try{o=tt(e)}catch{}let i=!1;for(let s of n){let l=kr(s);s.fileHash&&J$(s,l,e)&&(i=!0),s.file&&Q$(s,l,e)&&(i=!0),s.file&&Z$(s,l,e,o)&&(i=!0)}return ni.has(e)?i:(nd(e),Xc=!0,!1)}catch{return ni.delete(e),!1}}function Pt(){return ri||(ri=(async()=>{try{do{Xc=!1;let e=await le();for(let t of e)await ex(t)&&Qc()}while(Xc)}finally{ri=null}})(),ri)}Go(e=>{nd(e)&&Qc()});ag(e=>{nd(e)&&Qc(),Pt().catch(()=>{})});var si=new Map,qn=new Map,ba=new Map,od=new Set;function id(e){return od.add(e),()=>od.delete(e)}function $g(){for(let e of od)try{e()}catch{}}function ya(e,t){if(!e||!t)return!1;let r=!qn.has(e);qn.set(e,t),ba.delete(e);for(let[n,o]of t){if(!o)continue;let i=si.get(o);i||(i=new Map,si.set(o,i)),i.set(e,n)}return r&&$g(),r}function sd(e){let t=qn.get(e);if(qn.delete(e),ba.delete(e),!!t){for(let r of t.values()){let n=si.get(r);n&&(n.delete(e),n.size===0&&si.delete(r))}$g()}}function ai(e,t){let r=qn.get(e);if(!r||typeof t!="string"||t==="")return null;if(r.has(t))return t;let n=tx(e,r).get(xg(t));if(!n)return null;let o=t.startsWith("/")?t:`/${t}`,i=null;for(let s of n)if(s.endsWith(o)){if(i!==null)return null;i=s}return i}function xg(e){let t=e.lastIndexOf("/");return t<0?e:e.slice(t+1)}function tx(e,t){let r=ba.get(e);if(r)return r;r=new Map;for(let n of t.keys()){let o=xg(n),i=r.get(o);i?i.push(n):r.set(o,[n])}return ba.set(e,r),r}function ln(e){if(!e)return[];let t=si.get(e);if(!t)return[];let r=[];for(let[n,o]of t)r.push({integrity:n,file:o});return r}function ad(e){return qn.has(e)}var _g="deepview.fileCounts",Sg=2,$r=null;function wa(){if($r)return $r;try{$r=JSON.parse(Re(_g)||"{}")}catch{$r={}}return $r?.__v!==Sg&&($r={__v:Sg}),$r}function ld(){Pe(_g,JSON.stringify($r)).catch(e=>console.warn("counts persist:",e))}function Cg(e){if(e==="__v")return;let t=wa()[e];if(t!==void 0)return typeof t=="number"?{count:t}:t}function ci(e){return Cg(e)?.count}function di(e){return Cg(e)?.source}function nt(e,t,r){let n=wa();n[e]=r?{count:t,source:r}:{count:t},ld()}function Xn(e){let t=wa();delete t[e],ld()}function Xe(e){try{let o=JSON.parse(e);if(o&&Array.isArray(o.findings))return{count:o.findings.length,source:o.source,recognized:!0}}catch{}let t=zn(e);if(t)return{count:t.findings.length,source:t.source,recognized:!0};let r=jn(e);if(r)return{count:r.findings.length,source:r.source,recognized:!0};let n=Wn(e);return n?{count:n.findings.length,source:n.source,recognized:!0}:{count:0,recognized:!1}}var li=null,Yn=null,va=null;function rx(e,t){for(let{names:r,onUpdate:n}of va)if(r.has(e))try{n(e,t)}catch(o){console.warn("ensureCounts onUpdate:",o)}}function cd(e,t){if(li){t&&va.push({names:new Set(e),onUpdate:t});for(let r of e)Yn.add(r);return li}return Yn=new Set(e),va=t?[{names:new Set(e),onUpdate:t}]:[],li=(async()=>{await Promise.resolve();try{let r=wa();for(;Yn.size>0;){let n=Yn.values().next().value;if(Yn.delete(n),r[n]===void 0)try{let o=await Ne(n);if(r[n]!==void 0)continue;let{count:i,source:s}=Xe(o);r[n]=s?{count:i,source:s}:{count:i},ld(),rx(n,i)}catch{}}}finally{li=null,Yn=null,va=null}})(),li}var nx=/^\d+$/u;function ox(e){for(let t=0;t<e.length;t++){let r=e.codePointAt(t);if(r<32||r===127)return!0}return!1}var Ag=512;function ix(e){return typeof e=="string"&&e.length>0&&e.length<=Ag&&!ox(e)}function cn(e){return ix(e)&&!nx.test(e)}var sx=3,Eg=4,ax=/^[\w-]{4}$/u,lx=/^[\w-]{8}$/u,dd="AAAA",cx={report:`deepview/finding-link/report/v1
13
+ `).replaceAll("**","").trim(),p=[r,u].filter(Boolean).join(`
14
+
15
+ `),f=(i.file||"unknown").replace(/^`(.*)`$/u,"$1"),h=(i.lines||"").split(",").map(v=>v.trim()).find(Boolean)||"?",g={file:f,line:h,severity:e,description:p};c&&(g.recommendation=c.replaceAll("**",""));let y=QT(i.confidence);y!==void 0&&(g.confidence=y);let b=eM.get(ix(i.revalidation));return b&&(g.revalidate=b,g.revalidateSource="deepsec",i.reasoning&&(g.revalidateVerdict=i.reasoning.replaceAll("**",""))),i.slug&&(g.slug=i.slug),g}var JT,ix,ox,eM,ax=w(()=>{"use strict";sr();JT=/^## ([A-Z][A-Z_]*)\s*\(\d+\)\s*\n/mu;ix=t=>String(t??"").toLowerCase().replaceAll(/[^a-z]+/gu,""),ox=new Map([["high",8],["medium",6],["low",4]]);eM=new Map([["confirmed","confirmed"],["falsepositive","refuted"],["uncertain","unknown"]])});function Dr(t){return ls[t]??String(t??"")}var ls,ro,Ya,ct,cs=w(()=>{"use strict";ls={critical:"Critical",high:"High",medium:"Medium",low:"Low",high_bug:"High bug",bug:"Bug",informational:"Informational"},ro={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Deleted",ignored:"Ignored"},Ya={red:"Red",blue:"Blue",green:"Green",gray:"Gray",none:"Unmarked"},ct={"claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec",piolium:"Piolium"}});function lx(t){return t!=null&&t in Ne?t:null}function zr(t){return lx(t?.correctedSeverity)??t?.severity}function Ut(t){let e=lx(t?.correctedSeverity);return e!=null&&e!==t?.severity}function ae(t,e){return e==="original"?t?.severity:zr(t)}function ds(t){let e=t?._correctedByReport;return e&&new Set(Object.values(e).map(n=>n?.severity)).size>1?e:null}function Fe(t){return rM.has(t?.revalidate)?t.revalidate:""}function vn(t,e=t?.source){return Object.hasOwn(ct,e)||Fe(t)==="revalidation"}function li(t){return t&&t.replace(/^[^/]+\//u,"").replace(/^claude-/u,"").replaceAll("-"," ")}function Xa(t,e=!0){let r=e&&Fe(t)==="revalidation"?"revalidate":"";return[t?.type,r,li(t?.model),t?.effort,t?.exportsMode].filter(Boolean).join(" \xB7 ")}function $t(t,e){if(!t)return t;let r=t;e?.exportsMode==="isolate"&&(r=r.replace(/^\((?:[^()]|\([^()]*\))*\): \[export:\s*\w+\] /u,""),r=r.replace(/^\[export:\s*\w+\] /u,""));let n=[e?.exportName,e?.methodName].filter(Boolean).map(o=>o.replaceAll(/[.*+?^${}()|[\]\\]/gu,"\\$&"));for(let o of n)r=r.replaceAll(new RegExp(`\\[export:\\s*${o}\\]\\s*`,"gu"),"");for(let o of n)r=r.replace(new RegExp(`^\\(\`?${o}\`?\\): `,"u"),"");return r}function wn(t){let e=t?.exportName,r=t?.methodName;return e&&r&&e!==r?`${e}.${r}`:e||r||""}function ci(t){if(!t)return"";for(let e of t.split(`
16
+ `))if(e.trim())return e.trim();return""}function Kh(t){return typeof t?.title=="string"?t.title.trim():""}function dt(t){return Kh(t)||ci($t(t?.description,t))}function no(t){let e=$t(t?.description,t)||"",r=Kh(t);if(r){let i=e.trim(),s=i.indexOf(`
17
+ `);return(s<0?i:i.slice(0,s)).trim()!==r?{title:r,body:i}:{title:r,body:s<0?"":i.slice(s+1).replace(/^\s+/u,"")}}if(!e)return{title:"",body:""};let n=e.indexOf(`
18
+ `);if(n<0)return{title:"",body:e};if(rt(e)[0]?.[0]===0)return{title:"",body:e};let o=e.slice(n+1).replace(/^\s+/u,"");return o?{title:e.slice(0,n).trim(),body:o}:{title:"",body:e}}function us(t){let e=Kh(t);if(!e)return $t(t?.description,t)||"";let{body:r}=no(t);return r?`${e}
19
+
20
+ ${r}`:e}function oM(t){let e=rt(t);if(e.length===0)return t.split(/\n{2,}/u);let r=[],n=0;for(let o of t.matchAll(/\n{2,}/gu))zt(e,o.index)||(r.push(t.slice(n,o.index)),n=o.index+o[0].length);return r.push(t.slice(n)),r}function ps(t){let e=[];for(let r of oM(t||"")){if(!r.trim())continue;let n=nM.exec(r);if(n){e.push({label:n[1].trim(),body:r.slice(n[0].length).trim()});continue}let o=e.at(-1);o&&o.label===null?o.body+=`
21
+
22
+ ${r}`:e.push({label:null,body:r})}return e}function ut(t){return Number.isFinite(parseInt(t?.line,10))?`${t.file}:${t.line}`:t?.file??""}function di(t){let e=r=>typeof r=="string"?r:"";return`${e(t?.observation)}
23
+ ${e(t?.text)}`.trim()}var Ne,Ee,ai,rM,nM,fs=w(()=>{"use strict";sr();cs();Ne={critical:6,high:5,medium:4,low:3,high_bug:2,bug:1,informational:0},Ee=["critical","high","medium","low","high_bug","bug","informational"];ai=["revalidation","refuted","unreachable","confirmed","partial","unknown"],rM=new Set(ai);nM=/^\*\*([^*\n]+):\*\*[ \t]*/u});function Be(t){if(typeof t!="string"||t.length===0)return!1;try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function Gh(t){return String(t??"").replaceAll(/\s*\n\s*/gu," ").replaceAll("|","\\|").trim()}function nt(t){let e=String(t??"");if(e==="")return"";let r=Math.max(0,...[...e.matchAll(/`+/gu)].map(i=>i[0].length)),n="`".repeat(r+1),o=e.startsWith("`")||e.endsWith("`")?" ":"";return`${n}${o}${e}${o}${n}`}function dx(t){return String(t??"").replaceAll(/[[\]]/gu,"\\$&")}function ui(t,e){let r=/[\s()<>]/u.test(e)?`<${e.replaceAll(">","%3E")}>`:e;return`[${t}](${r})`}function Xd(t){return Be(t)?`<${t}>`:String(t??"")}function ux(t,e){let r=String(t??"").toLowerCase().replaceAll(/[^\p{L}\p{N}\p{M}\s_-]/gu,"").replaceAll(/\s/gu,"-"),n=r;for(let o=1;e.has(n);o++)n=`${r}-${o}`;return e.add(n),n}function Ur(t,e){return`${"#".repeat(Math.min(6,Math.max(1,t)))} ${e}`}function qh(t,e,r=[]){let n=t.map((o,i)=>r[i]==="right"?"---:":"---");return[t,n,...e].map(o=>`| ${o.join(" | ")} |`).join(`
24
+ `)}function px(t){let e=t instanceof Date?t:new Date(t);if(Number.isNaN(e.getTime()))return"";let r=n=>String(n).padStart(2,"0");return`${e.getUTCFullYear()}-${r(e.getUTCMonth()+1)}-${r(e.getUTCDate())} ${r(e.getUTCHours())}:${r(e.getUTCMinutes())} UTC`}function hs(t,e,r=`${e}s`){return`${t} ${t===1?e:r}`}function Ja(t){return t.filter(e=>typeof e=="string"&&e.trim()).map(e=>e.replace(/\s+$/u,"")).join(`
25
+
26
+ `)}function ms(t){let e=sM(ir(t).trim());return e?aM(e):""}function sM(t){if(!t)return"";let e=rt(t).at(-1);if(!e||e[1]<t.length)return t;let r=t.slice(e[0]).split(`
27
+ `),n=cx.exec(r[0])?.[1]??"```";return r.length>1&&cx.exec(r.at(-1))?.[1]?.startsWith(n.slice(0,3))?t:`${t}
28
+ ${n}`}function fx(t,e){let r=rt(t),n=0;return t.split(`
29
+ `).map(o=>{let i=n;return n+=o.length+1,zt(r,i)?o:e(o)}).join(`
30
+ `)}function aM(t){return fx(t,e=>e.replace(iM,"$1\\$2"))}function hx(t){return fx(String(t??""),e=>e.replace(/^( {0,3})\\(\\*#)/u,"$1$2"))}function mx(t,e){let r=" ".repeat(t.length);return e.split(`
31
+ `).map(n=>n?r+n:"").join(`
32
+ `)}var cx,iM,Za=w(()=>{"use strict";sr();cx=/^ *(`{3,}|~{3,})/u,iM=/^( {0,3})(\\*#)/u});function Hr(t){let e=/(`+)(.+?)\1(?!`)/u.exec(String(t??""));if(!e)return null;let r=e[2];if(r.length>2&&r.startsWith(" ")&&r.endsWith(" ")){let n=r.slice(1,-1);if(n.startsWith("`")||n.endsWith("`"))return n}return r}function Jd(t){let e=as(String(t??""));return e?.index===0?{label:e.label,url:e.url}:null}function yx(t){let e=/^<(https?:[^>\s]*)>$/u.exec(t.trim());return e?e[1]:null}function vx(t){let e=Vh.exec(t);return e?{file:e[1],line:e[2]}:{file:t,line:"?"}}function dM(t){let e=t.indexOf(".");return e>0?{exportName:t.slice(0,e),methodName:t.slice(e+1)}:{exportName:t}}function pi(t){let e=String(t??"").trim();return lM.get(e.toLowerCase())??e}function uM(t){let e={},r=t.trim(),n=/ · (`+)(.+?)\1$/u.exec(r);n&&(Object.assign(e,dM(Hr(n[0]))),r=r.slice(0,n.index));let o=Jd(r),i=Hr(o?o.label:r);return i!==null&&Object.assign(e,vx(i)),o&&Be(o.url)&&(e.location=o.url),e}function fM(t){let e={},r=t.trim();r.endsWith(gx)&&(e.critical=!0,r=r.slice(0,-gx.length));let n=r.indexOf(pM);n!==-1&&(r=r.slice(0,n));let o=/^(.*?) — corrected (from|to) (.*)$/u.exec(r);return o?o[2]==="from"?(e.severity=pi(o[3]),e.correctedSeverity=pi(o[1])):(e.severity=pi(o[1]),e.correctedSeverity=pi(o[3])):e.severity=pi(r),e}function gM(t){return/\d/u.test(t)||/^(?:opus|sonnet|haiku|gpt|gemini|fable|mythos|llama|mistral)\b/iu.test(t)}function Zd(t){let e=t.trim(),r=bx.get(e.toLowerCase());if(r)return{source:r};let n={},o=[];for(let i of e.split(" \xB7 ").map(s=>s.trim()).filter(Boolean))i==="revalidate"&&!n.revalidate?n.revalidate="revalidation":mM.has(i)&&!n.exportsMode?n.exportsMode=i:hM.has(i)&&!n.effort?n.effort=i:o.push(i);return o.length>1?[n.type,n.model]=o:o.length===1&&(n[gM(o[0])?"model":"type"]=o[0]),{run:n}}function Yh(t){let e=t.trim(),r=Jd(e);return r?r.label.trim():yx(e)??e}function bM(t){let e=Jd(t.trim());if(e){let r=e.url.split("/").at(-1)??"";return qd(r)?r:Hr(e.label)??r}return Hr(t)??t.trim()}function yM(t){let e=Hr(t)??t.trim(),r=e.lastIndexOf("@");return{npm:r>0?{name:e.slice(0,r),version:e.slice(r+1)}:{name:e}}}function vM(t){let e=t.trim().toLowerCase();return e==="the revalidation pass itself"?"revalidation":cM.has(e)?e:void 0}function wx(t,e,r){let n=wM.get(e.trim().toLowerCase());n&&n(t,r.trim())}function kx(t){let e=t.split(`
33
+ `),r=0,n=()=>{for(;r<e.length&&!e[r].trim();)r++},o=()=>{let a=[];for(;r<e.length;){let c=kM.exec(e[r]);if(!c)break;a.push([c[1].trim(),c[2].trim()]),r++}return a};n();let i=o();if(i.length>0)return{title:"",facts:i,rest:e.slice(r).join(`
34
+ `)};let s=[];for(;r<e.length&&e[r].trim();)s.push(e[r++]);return n(),i=o(),i.length===0?{title:"",facts:i,rest:t}:{title:gs(s.join(`
35
+ `).trim()),facts:i,rest:e.slice(r).join(`
36
+ `)}}function gs(t){return hx(t)}function xx(t,e){let r=new RegExp(`^#{${e}} +(.*)$`,"gmu"),n=rt(t),o=[...t.matchAll(r)].filter(a=>!zt(n,a.index)),i=t.slice(0,o[0]?.index??t.length).trim(),s=o.map((a,c)=>({label:a[1].trim(),body:t.slice(a.index+a[0].length,o[c+1]?.index).trim()}));return{lead:i,sections:s}}function $x(t){let e=[],r=rt(t),n=0;for(let o of t.split(`
37
+ `)){let i=zt(r,n)?null:xM.exec(o);n+=o.length+1,i?e.push({ref:i[2].trim(),indent:i[1].length+2,note:[]}):e.length>0&&e.at(-1).note.push(o)}return e.map(o=>$M(o))}function $M({ref:t,indent:e,note:r}){let n={},o=Jd(t),i=yx(t),s=i===null?Hr(o?o.label:t):null;s!==null&&Object.assign(n,vx(s));let a=o?o.url:i;Be(a)&&(n.url=a);let c=gs(r.map(u=>u.slice(Math.min(e,/^ */u.exec(u)[0].length))).join(`
38
+ `).trim());return c&&(n.text=c),n}function Sx(t){let e=t.length,r=1/0;for(let n=t.length-1;n>=0;n--){let o=_M.indexOf(t[n].label.toLowerCase());if(o===-1||o>=r)break;r=o,e=n}return{paragraphs:t.slice(0,e),fields:t.slice(e).map(n=>[_x.get(n.label.toLowerCase()),n.body])}}function Cx(t,e,r){let n=[],o=ci(e),i=t.endsWith("\u2026")?t.slice(0,-1).trimEnd():"";!t||o===t||i&&o.startsWith(i)?n.push(e):n.push(t,e);for(let{label:s,body:a}of r)n.push(a?`**${s}:** ${a}`:`**${s}:**`);return n.filter(Boolean).join(`
39
+
40
+ `)}var lM,bx,cM,gx,pM,hM,mM,wM,kM,xM,_x,_M,Ex=w(()=>{"use strict";fs();cs();sr();Za();lM=new Map(Object.entries(ls).map(([t,e])=>[e.toLowerCase(),t])),bx=new Map(Object.entries(ct).map(([t,e])=>[e.toLowerCase(),t])),cM=new Set(ai);gx=" \xB7 flagged critical by the analyzer",pM=" (varies across reports \u2014 ";hM=new Set(["max","xhigh","high","medium","low","minimal"]),mM=new Set(["list","isolate"]);wM=new Map([["location",(t,e)=>Object.assign(t,uM(e))],["severity",(t,e)=>Object.assign(t,fM(e))],["confidence",(t,e)=>{let r=/^(\d+(?:\.\d+)?)\/10$/u.exec(e);r&&(t.confidence=Number(r[1]))}],["revalidation",(t,e)=>{let r=vM(e);r&&(t.revalidate=r)}],["revalidated by",(t,e)=>{let r=e.trim();r&&(t.revalidateSource=bx.get(r.toLowerCase())??r)}],["repository",(t,e)=>{t.repo={github:Yh(e)}}],["introduced in",(t,e)=>{t.commitHash=bM(e)}],["package",(t,e)=>{t.package=yM(e)}],["priority",(t,e)=>{t.priority=/^-?\d+(?:\.\d+)?$/u.test(e)?Number(e):e}],["found while analyzing",(t,e)=>{t.discoveredIn=Hr(e)??e}],["detailed report",(t,e)=>{t.reportPath=Hr(e)??e}],["commit audited",(t,e)=>{t.auditedCommit=Hr(e)??e}],["id",(t,e)=>{t.id=Hr(e)??e}],...[["category","category"],["status","status"],["branch","branch"],["date created","dateCreated"],["detected at","detectedAt"],["committed at","committedAt"],["poc status","pocStatus"],["variant of","parent"],["slug","slug"]].map(([t,e])=>[t,(r,n)=>{r[e]=n}])]);kM=/^- \*\*([^*\n]+?):\*\* ?(.*)$/u;xM=/^(\d+)\. (.*)$/u;_x=new Map([["impact","impact"],["reproduction","reproduction"],["recommendation","recommendation"],["confidence reasoning","confidenceReason"],["revalidation verdict","revalidateVerdict"],["revalidation recommendation","revalidateRecommendation"]]),_M=[..._x.keys()]});function Ax(t){let e=ir(t).trim();if(!SM.test(e))return null;let{head:r,subs:n}=ii(e,Va),o=[];for(let{heading:i,body:s}of n){if(i.trim().toLowerCase()==="summary")continue;let a=AM(i);for(let c of yn(s,Wa))o.push(MM(c,a))}return LM(TM(r),o)}function AM(t){let e=/^(.*?)\s*\(\d+\)\s*$/u.exec(t.trim());return pi(e?e[1]:t)}function TM(t){let e=new Map;for(let r of t.matchAll(EM)){let n=r[1].trim().toLowerCase();e.has(n)||e.set(n,r[2].trim())}return{sources:(e.get("source")??"").split(",").map(r=>Zd(r).source).filter(Boolean),analyzers:(e.get("analyzer")??e.get("analyzers")??"").split(";").map(r=>r.trim()).filter(Boolean),repo:e.has("repository")?Yh(e.get("repository")):""}}function MM({heading:t,body:e},r){let n=t.trim().replace(/^\d+\.\s+/u,""),o=ii(e,oi).subs.filter(i=>CM.test(i.heading.trim()));return o.length===0?[Rx(e,4,n,r)]:o.map(i=>Rx(i.body,5,n,r))}function Rx(t,e,r,n){let{title:o,facts:i,rest:s}=kx(t),{lead:a,sections:c}=xx(s,e),u={file:"unknown",line:"?"},p=null;for(let[k,$]of i)k.trim().toLowerCase()==="analyzer"?p=Zd($):wx(u,k,$);u.severity||(u.severity=n||"medium");let f=o||r,h=f!=="Untitled finding"&&f!==ut(u),g=c.filter(k=>!RM.has(k.label.toLowerCase())).map(k=>({label:k.label,body:gs(k.body)})),{paragraphs:y,fields:b}=Sx(g);u.description=Cx(h?f:"",gs(a),y);let v=c.filter(k=>k.label.toLowerCase()==="evidence").flatMap(k=>$x(k.body));v.length>0&&(u.evidence=v);for(let[k,$]of b)u[k]=$;let x=c.find(k=>k.label.toLowerCase()==="severity correction");return x?.body&&(u.correctedSeverityReason=gs(x.body)),{finding:u,analyzer:p}}function IM(t,e){let r={source:null,run:{}};if(e.some(o=>o.analyzer!==null)){let o=new Set(e.map(i=>i.analyzer?.source??null));o.size===1&&!o.has(null)&&([r.source]=o);for(let i of e)i.analyzer?.run?Object.assign(i.finding,i.analyzer.run):i.analyzer?.source&&!r.source&&(i.finding.source=i.analyzer.source);return r}let n=t.analyzers.length===1?Zd(t.analyzers[0]):null;return n?.source?r.source=n.source:n?.run?r.run=n.run:t.analyzers.length===0&&t.sources.length===1&&([r.source]=t.sources),r}function LM(t,e){let r=e.flat(),{source:n,run:o}=IM(t,r),i={},s=new Set(r.map(u=>u.finding.type).filter(Boolean)),a=o.type??(s.size===1?[...s][0]:null)??(n?"security":null);a&&(i.type=a),n&&(i.source=n);for(let u of["model","effort","exportsMode"])o[u]&&(i[u]=o[u]);t.repo&&(i.repo={github:t.repo});let c=e.map(u=>u.map(p=>p.finding));return c.every(u=>u.length===1)?i.findings=c.flat():i.groups=c,i}var SM,CM,EM,RM,Tx=w(()=>{"use strict";fs();sr();Ex();SM=/^<!--\s*DeepView findings export\b[^>]*-->/u,CM=/^Case \d+ of \d+(?:\s|$)/u,EM=/^- \*\*([^*\n]+?):\*\* ?(.*)$/gmu,RM=new Set(["evidence","severity correction","comment"])});function Mx(t){let e=BM(t);if(!e)return null;let{severity:r,description:n,location:o,file:i,line:s}=e;return o?{severity:r,description:n,location:o}:{severity:r,description:n,file:i,line:s}}function BM(t){let e=t.indexOf(`
41
+ `),r=(e===-1?t:t.slice(0,e)).trim();if(!r)return null;let n=e===-1?"":t.slice(e+1),{sectionsText:o,metaText:i}=OM(n),s=PM(o),a=NM(i),{file:c,line:u,locationLink:p}=DM(s.location||""),f=(a.severity||"").toLowerCase();return{severity:FM.has(f)?f:"medium",description:zM(r,s),location:p,file:c||"unknown",line:u}}function OM(t){let e=/^---\s*$/mu,r=e.exec(t);if(!r)return{sectionsText:t,metaText:""};let n=t.slice(0,r.index).trim(),o=t.slice(r.index+r[0].length).replace(/^\n/u,""),i=e.exec(o),s=i?o.slice(0,i.index):o;return{sectionsText:n,metaText:s}}function PM(t){let e={},r=t.split(/^## /mu);for(let n=1;n<r.length;n++){let o=r[n],i=o.indexOf(`
42
+ `),s=(i===-1?o:o.slice(0,i)).trim().toLowerCase(),a=(i===-1?"":o.slice(i+1)).trim();s&&(e[s]=a)}return e}function NM(t){let e={};for(let r of t.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))e[r[1].trim().toLowerCase()]=r[2].trim();return e}function DM(t){let e="",r="?",n="",o=t.match(/\[([^\]]+)\]\(([^)]+)\)/u);if(o){e=o[1].trim(),n=o[2];let s=o[2].match(/#L(\d+)/u);s&&(r=s[1])}else e=t.trim(),n=t.trim();let i=e.match(/^(.+):(\d+)$/u);return i&&(e=i[1],r==="?"&&(r=i[2])),{file:e,line:r,locationLink:n}}function zM(t,e){let r=[t];return e.details&&r.push(e.details),e.impact&&r.push(`Impact: ${e.impact}`),e["reproduction steps"]&&r.push(`Reproduction: ${e["reproduction steps"]}`),UM(r.join(`
43
+
44
+ `))}function UM(t){return t.replaceAll("**","")}var FM,Ix=w(()=>{"use strict";FM=new Set(["critical","high","medium","low","high_bug","bug","informational"])});function Bx(t){let e=ir(t).trim();if(!e.startsWith("# "))return null;let r=e.split(/^# /mu).filter(o=>o.trim().length>0),n=[];for(let o of r){let i=jM(o);i&&n.push(i)}return n.length===0?null:{type:"security",source:"claude-security",findings:n}}function jM(t){let{title:e,body:r}=Ka(t);if(!e)return null;let{sectionsText:n,metaText:o}=VM(r),i=WM(n),s=KM(o),a=XM(i.evidence||""),{file:c,line:u,locationLink:p}=Ox(i.location||a[0]?.ref||""),f=(s.severity||"").toLowerCase(),h=HM.has(f)?f:"medium",g=ZM(e,i,a.length>0),y={file:c||"unknown",line:u,severity:h,description:g};p&&(y.location=p),a.length>0&&(y.evidence=a.map(JM)),i["reproduction steps"]&&(y.reproduction=GM(i["reproduction steps"])),i["recommended fix"]&&(y.recommendation=i["recommended fix"]),s.repository&&(y.repo={github:s.repository}),s.branch&&(y.branch=s.branch),s["date created"]&&(y.dateCreated=s["date created"]),s.status&&(y.status=s.status),s.category&&(y.category=s.category);let b=Mx(t);return b&&(y._idBasis=b),y}function VM(t){let e=/^---\s*$/mu,r=e.exec(t);if(!r)return{sectionsText:t,metaText:""};let n=t.slice(0,r.index).trim(),o=t.slice(r.index+r[0].length).replace(/^\n/u,""),i=e.exec(o),s=i?o.slice(0,i.index):o;return{sectionsText:n,metaText:s}}function WM(t){let e={};for(let r of t.split(/^## /mu).slice(1)){let{title:n,body:o}=Ka(r),i=n.toLowerCase();i&&(e[i]=o.trim())}return e}function KM(t){let e={};for(let r of t.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))e[r[1].trim().toLowerCase()]=r[2].trim();return e}function Ox(t){let e="",r="?",n="",o=as(t);if(o){e=o.label.trim(),n=o.url.trim();let s=n.match(/#L(\d+)(?:-L?(\d+))?/u);s&&(r=s[2]?`${s[1]}-${s[2]}`:s[1])}else e=t.trim(),n=t.trim();e=qa(e.replaceAll("`","")).trim();let i=e.match(/^(.+):(\d+)(?:\s*[-–—]\s*L?(\d+))?$/u);return i&&(e=i[1],r==="?"&&(r=i[3]?`${i[2]}-${i[3]}`:i[2])),{file:e,line:r,locationLink:n,linked:o!==null}}function GM(t){let e=t.split(`
45
+ `),r=e.findIndex(a=>a.trim());if(r===-1||!ss.test(e[r])||e.some((a,c)=>c!==r&&ss.test(a)))return t;let n=e[r].replace(/^ */u,""),o=n.replace(ss,"");if(!o.trim())return t;let i=Lx(o)??Lx(n);if(i===null&&(ss.test(o)||YM.test(n)))return t;let s=i===null?[o]:i.length===1?[i[0].step]:i.map(({number:a,step:c})=>`${a}. ${c}`);return e.splice(r,1,...s),e.join(`
46
+ `)}function Lx(t){let e=[...t.matchAll(qM)];if(e.length===0||e[0].index!==0)return null;let r=[];for(let[n,o]of e.entries()){let i=Number(o[1]);if(n>0&&i<=r[n-1].number)return null;let s=t.slice(o.index+o[0].length,e[n+1]?.index).trim();if(!s)return null;r.push({number:i,step:s})}return r}function XM(t){let e=[];for(let r of t.split(`
47
+ `))Fx.test(r)?e.push({ref:r.replace(Fx,"").trim(),note:[]}):e.length>0&&r.trim()&&e.at(-1).note.push(r.trim());if(e.length===0){let r=t.split(`
48
+ `).map(i=>i.trim()).filter(Boolean),n=r.findIndex(i=>as(i)!==null);if(n===-1&&r.length!==1)return[];let o=n===-1?0:n;e.push({ref:r[o],note:r.filter((i,s)=>s!==o)})}return e.filter(r=>r.ref)}function JM({ref:t,note:e}){let{file:r,line:n,locationLink:o,linked:i}=Ox(t),s={file:r||"unknown",line:n};o&&i&&(s.url=o);let a=e.join(`
49
+ `);return a&&(s.text=a),s}function ZM(t,e,r){let n=[t];return e.details&&n.push(e.details),e.evidence&&!r&&n.push(`**Evidence:**
50
+ ${e.evidence}`),e.impact&&n.push(`**Impact:** ${e.impact}`),n.join(`
51
+
52
+ `)}var HM,qM,YM,Fx,Px=w(()=>{"use strict";Ix();sr();HM=new Set(["critical","high","medium","low","high_bug","bug","informational"]);qM=/(?:^|[ \t])(\d{1,9})\)(?=[ \t]|$)/gu,YM=/^\d{1,9}\)(?=[ \t]|$)/u;Fx=/^[ \t]*(?:\d+[.)]|[-*+])\s+/u});function QM(t){let e=(t||"").trim(),r="",n=/\[([^\]]+)\]\(([^)]+)\)/u.exec(e);n&&(e=n[1].trim(),r=n[2].trim());let o="",i=/#L(\d+)/u.exec(r);i&&(o=i[1]);let c=[...e.matchAll(/`([^`]+)`/gu)].map(f=>f[1].trim()).find(f=>!f.includes("(")&&(f.includes("/")||/\.\w/u.test(f)))??(e.replaceAll("`","").trim().split(/[\s,]+/u).find(Boolean)||""),u=/^(.*?)#L(\d+)(?:-L?\d+)?$/u.exec(c);u&&(c=u[1],o||(o=u[2]));let p=/^(.+):(\d+(?:-\d+)?)$/u.exec(c);return p?(o||(o=p[2]),{file:p[1],line:o,locationLink:r}):{file:c,line:o||"?",locationLink:r}}function Qd({severity:t,description:e,ref:r,lineBullet:n="",id:o=""}){let i=QM(r),s=i.file||"unknown",a=i.line==="?"&&n?n:i.line,c=i.locationLink||(s==="unknown"&&o?`piolium:${o}`:"");return c?{severity:t,description:e,location:c}:{severity:t,description:e,file:s,line:a}}var Xh=w(()=>{"use strict"});function fi(t,e){if(!e.source)for(let r of Nx)t[r]==null&&e[r]!=null&&(t[r]=e[r])}function Qa(t){return tI.test(t)}function $r(t){let e=t?.repo?.github;if(typeof e!="string")return null;let r=e.trim().replace(/\/+$/u,"");if(!r)return null;let n=eI.exec(r),o=(n?`${n[1]}/${n[2]}`:r).replace(/\.git$/u,"");return Qa(o)?o:null}function hi(t){let r=(typeof t?.directory=="string"?t.directory.trim():"").replace(/^(?:\.\/)+/u,"").replaceAll(/^\/+|\/+$/gu,"").replaceAll(/\/{2,}/gu,"/");return!r||r==="."||/[?#]/u.test(r)||r.split("/").includes("..")?"":r}var Nx,eI,tI,eu=w(()=>{"use strict";Nx=["type","model","think","effort","exportsMode"];eI=/^(?:https?:\/\/)?(?:www\.)?github\.com\/([^/?#]+)\/([^/?#]+?)(?:\.git)?(?:[/?#].*)?$/iu,tI=/^[\w.-]+\/[\w.-]+$/u});function oo(t){switch(((t||"").trim().split(/\s+/u)[0]||"").replaceAll(/[`*]+/gu,"").toUpperCase()){case"CRITICAL":return"critical";case"HIGH":return"high";case"MEDIUM":return"medium";case"LOW":return"low";case"INFO":case"INFORMATIONAL":return"informational";default:return""}}function el(t){let e=/^([CHML])-?\d+$/iu.exec((t||"").trim());return e?{C:"critical",H:"high",M:"medium",L:"low"}[e[1].toUpperCase()]:""}function Jh(t){let e=/^(critical|high|medium|low|informational|info)(?:[ -](?:severity|risk))?(?:[ -]findings?)?(?:\s*\(\d+\))?$/iu.exec((t||"").trim());return e?oo(e[1]):""}function Dx(t){let e=/^(critical|high|medium|low|informational|info)\b/iu.exec((t||"").trim());return e?oo(e[1]):""}function ru(t){return/^variants?\s*(?:\(\d+\))?\s*:?$/iu.test((t||"").trim())}function nu(t){let e=/^([CHML]-?\d{1,4}|(?:p|q|b|r|m|l|x|diff)\d{0,4}-\d{2,4})(?:-([A-Za-z0-9][\w-]*))?$/iu.exec(t||"");return e?{id:e[1].toUpperCase(),slug:e[2]||""}:null}function tu(t){return(t||"").replaceAll("-"," ")}function tl(t){let e=(t||"").trim(),r=/^\[([^\]]+)\]\([^)]*\)$/u.exec(e);return nx(r?r[1]:e).toUpperCase()}function Zh(t){let e=/^\[([^\]]+)\]\(([^)]+)\)\s*[:—–-]*\s*(.*)$/u.exec(t);return e?{text:e[3]?`${e[1].trim()} ${e[3].trim()}`:e[1].trim(),link:e[2].trim()}:null}function Qh(t){let e=t.search(/\s/u),r=(e===-1?t:t.slice(0,e)).replace(/[:.,—–-]+$/u,""),n=nu(r);if(!n)return null;let o=(e===-1?"":t.slice(e+1)).replace(/^[:—–-]+\s*/u,"").trim();return{id:n.id,slug:n.slug,rest:o}}function em(t){let{text:e,link:r}=Zh(t)??{text:t,link:""},n=/^\[([^\]]+)\] *(.*)$/u.exec(e);if(n){let i=nu(n[1].trim());return i?{id:i.id,title:n[2].trim()||tu(i.slug)||i.id,link:r}:{id:n[1].trim().toUpperCase(),title:n[2].trim(),link:r}}let o=Qh(e);return o?{id:o.id,title:o.rest||tu(o.slug)||o.id,link:r}:{id:"",title:e.trim(),link:r}}function zx(t){let e={},r=i=>(/`([^`]+)`/u.exec(i)?.[1]??i.split(/\s+/u)[0]??"").trim(),n=/^\s*(?:[-*] +)?\*\*Target:?\*\*\s*(.*)$/imu.exec(t||"");if(n){let i=r(n[1]);Qa(i)&&(e.repo=i)}let o=/^\s*(?:[-*] +)?\*\*Commit[^:*]*:?\*\*\s*(.*)$/imu.exec(t||"");if(o){let i=r(o[1]);qd(i)&&(e.commitHash=i)}return e}function rm(t){for(let e of tm)if(t[e])return t[e];return""}var tm,nm=w(()=>{"use strict";sr();eu();tm=["key code reference","key code","code reference","location","affected file","file","path"]});function ou(t){return{id:tl(t.id||""),title:si(t.title),severity:si(t.severity),pocStatus:si(t["poc status"]||t.poc),status:si(t.status),parent:tl(si(t.parent||"")),location:si(t.location)}}function iu(t,e=""){let r=oo(t.severity)||e||el(t.id)||"medium",{file:n,line:o,locationLink:i}=Yd(t.location||""),s={file:n||"unknown",line:o,severity:r,description:Wh(t.title||t.id)};return i?s.location=i:s.file==="unknown"&&t.id&&(s.location=`piolium:${t.id}`),s._idBasis=Qd({severity:r,description:s.description,ref:t.location||"",id:t.id}),t.pocStatus&&(s.pocStatus=t.pocStatus),t.status&&(s.status=t.status),t.parent&&(s.parent=t.parent),s}function om(t,e,r){let n=[];for(let o of t.split(`
53
+ `)){let i=/^\s{0,3}(?:[-*+]|\d{1,3}[.)])\s+(.+)$/u.exec(o);if(!i)continue;let s=i[1].trim();if(/^\*\*[^:*]+:\*\*/u.test(s))continue;let a=Zh(s),c=a?.link??"";if(a)s=a.text;else{let b=/^\*\*([^*]+)\*\*\s*[:—–-]*\s*(.*)$/u.exec(s);b&&(s=b[2]?`${b[1].trim()} ${b[2].trim()}`:b[1].trim())}if(/^(?:none\b|no |n\/a\b)/iu.test(s))continue;let u=Qh(s),p=u?.id??"",f=s;if(u){let b=tu(u.slug);f=b&&u.rest?`${b}
54
+
55
+ ${u.rest}`:u.rest||b||u.id}let h=r.get(p),y={file:"unknown",line:"?",severity:oo(h?.severity)||e||el(p)||"medium",description:Wh(f)};p?y.location=`piolium:${p}`:c&&(y.location=c),c.endsWith("report.md")&&(y.reportPath=c),h?.pocStatus&&(y.pocStatus=h.pocStatus),h?.status&&(y.status=h.status),h?.parent&&(y.parent=h.parent),n.push({id:p,finding:y})}return n}function im(t,e,r,n=""){let o=[];for(let s of Ga(t)){let a=ou(s);!a.id&&!a.title||(!a.parent&&r&&(a.parent=r),a.id&&!e.has(a.id)&&e.set(a.id,a),o.push({id:a.id,finding:iu(a,n)}))}if(o.length>0)return o;let i=om(t,n,e);for(let s of i)r&&!s.finding.parent&&(s.finding.parent=r);return i}var Ux=w(()=>{"use strict";sr();Xh();nm()});function nI(t){return rI.has(t)||t.startsWith("findings by severity")}function iI(t){return oI.test(t)}function Hx(t){let{id:e}=em(t);return!!(e&&nu(e))}function sI(t){let e=yn(t,Wa);return(e.length>0?e:yn(t,oi)).some(({heading:n})=>Hx(n))}function jx(t){let e=ir(t).trim();if(!/^# +Security Audit Report\b/mu.test(e)&&!/^## +Technical Findings Detail\s*$/imu.test(e)&&!/^## +Findings by Severity\b/imu.test(e))return null;let r=dI(e),n=uI(r["summary of findings"]||""),o=zx(ii(e,Va).head),i=[],s=new Set,a=[],c=({id:p,finding:f})=>{i.push(f),p&&s.add(p)},u=p=>{for(let f of p)c(f)};for(let[p,f]of Object.entries(r)){let h=Jh(p);h||nI(p)?u(sm(f,h,n,a)):!iI(p)&&sI(f)&&u(sm(f,Dx(p),n,a))}for(let p of a)(!p.id||!s.has(p.id))&&c(p);for(let p of n.values())s.has(p.id)||c({id:p.id,finding:iu(p)});if(i.length===0)return null;for(let p of i)o.repo&&(p.repo={github:o.repo}),o.commitHash&&!p.auditedCommit&&(p.auditedCommit=o.commitHash);return{type:"security",source:"piolium",findings:i}}function aI(t,e,r,n){let o=[],i="";for(let{heading:s,body:a}of t){let c=Jh(s);if(c)o.push(...sm(a,c,e,r)),i="";else if(ru(s))o.push(...cI(a,e,i,r,n));else{let u=lI(s,a,e,r,n);o.push(...u),i=u[0]?.id||i}}return o}function lI(t,e,r,n,o){let{head:i,subs:s}=ii(e,oi),a=Vx(t,i,r,o),c=a!==null&&!a.id&&s.some(p=>!ru(p.heading)&&Hx(p.heading)),u=a&&!c?[a]:[];return u.push(...am(s,r,n,o,a?.id||"")),u}function cI(t,e,r,n,o){let{head:i,subs:s}=ii(t,oi);return n.push(...im(i,e,r,o)),am(s,e,n,o,"")}function am(t,e,r,n,o){let i=[],s="";for(let{heading:a,body:c}of t){if(ru(a)){r.push(...im(c,e,o??s,n));continue}let u=Vx(a,c,e,n);u&&(i.push(u),s=u.id||s)}return i}function sm(t,e,r,n){let o=yn(t,Wa);if(o.length>0)return aI(o,r,n,e);let i=am(yn(t,oi),r,n,e,null);if(i.length>0)return i;let s=Ga(t).map(ou).filter(a=>a.id||a.title);if(s.length>0){for(let a of s)!a.severity&&e&&(a.severity=e),a.id&&!r.has(a.id)?r.set(a.id,a):a.id||n.push({id:"",finding:iu(a,e)});return[]}return n.push(...om(t,e,r)),[]}function Vx(t,e,r,n=""){let o=t.trim();if(!o)return null;let{id:i,title:s,link:a}=em(o),c=r.get(i);!i&&s&&(c=[...r.values()].find(E=>E.title.toLowerCase()===s.toLowerCase()),i=c?.id??"");let{fields:u,labels:p,prose:f}=tx(e),h=oo(u.severity)||oo(c?.severity)||n||el(i)||"medium",g=Yd(rm(u)),y=/\d+/u.exec(u.line||u.lines||"")?.[0]??"",b=g.line==="?"&&y?y:g.line,v=/\*\*Variant of:?\*\*\s*\[?([^\]\s)]+)/iu.exec(e),x=f.split(`
56
+ `).filter(E=>!/^\s*<a\s[^>]*>\s*<\/a>\s*$/iu.test(E)&&!/\*\*Variant of:?\*\*/iu.test(E)).join(`
57
+ `).trim(),k={file:g.file||"unknown",line:b,severity:h,description:fI(s||i,u,p,x)};g.locationLink?k.location=g.locationLink:k.file==="unknown"&&i&&(k.location=`piolium:${i}`),k._idBasis=Qd({severity:h,description:k.description,ref:rm(u),lineBullet:y,id:i});let $=u["poc status"]||u.poc||c?.pocStatus;$&&(k.pocStatus=$);let C=u["detailed report"]||(a.endsWith("report.md")?a:"");C&&(k.reportPath=C),c?.status&&(k.status=c.status);let U=c?.parent||(v?tl(v[1]):"");return U&&(k.parent=U),{id:i,finding:k}}function dI(t){let e=Object.create(null);for(let{heading:r,body:n}of yn(t,Va)){let o=r.trim().toLowerCase();o&&(e[o]=o in e?`${e[o]}
58
+ ${n}`:n)}return e}function uI(t){let e=new Map;for(let r of Ga(t)){let n=ou(r);n.id&&e.set(n.id,n)}return e}function fI(t,e,r,n){let o=[t];e.summary&&o.push(e.summary),n&&o.push(n);for(let[i,s]of Object.entries(e))!s||pI.has(i)||o.push(`**${r[i]||i}:** ${s}`);return o.filter(Boolean).join(`
59
+
60
+ `)}var rI,oI,pI,Wx=w(()=>{"use strict";sr();Xh();Ux();nm();rI=new Set(["technical findings detail","technical findings","detailed findings","findings detail","findings"]);oI=/^(?:summary of findings|deferred|methodolog|executive|conclusion|attack surface|coverage|discoveries|scope|table of contents|contents|appendix|recommendation|remediation)/u;pI=new Set([...tm,"severity","summary","files","poc","poc status","line","lines","detailed report","proof of concept","evidence","variant of","pattern","status","id","title"])});function lm(t){if(typeof t!="string")throw new TypeError(`encodeUtf8 expects a string, got ${typeof t}`);if(!t.isWellFormed())throw new TypeError("encodeUtf8: input contains lone surrogates");return hI.encode(t)}var hI,Kx=w(()=>{"use strict";hI=new TextEncoder});function mI(t){return Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}async function cm(t){let e=typeof t=="string"?lm(t):t,r=new Uint8Array(await crypto.subtle.digest("SHA-512",e));return`sha512-${btoa(String.fromCodePoint(...r))}`}async function gI(t){let e=lm(JSON.stringify(t)),r=await crypto.subtle.digest("SHA-256",e),n=new Uint8Array(r,0,16);n[6]=n[6]&15|64,n[8]=n[8]&63|128;let o=mI(n);return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20,32)}`}async function dm(t){if(typeof crypto?.subtle?.digest!="function")return null;let e=bI(t);try{return await gI(e)}catch{return null}}function bI(t){if(t._idBasis)return t._idBasis;let{severity:e,description:r}=t;return t.fileHash?{severity:e,description:r,fileHash:t.fileHash}:t.location?{severity:e,description:r,location:t.location}:{severity:e,description:r,file:t.file,line:t.line}}var um=w(()=>{"use strict";Kx()});function vI(t){let e=[],r=[],n="",o=!1,i=t.length;for(let s=0;s<i;s++){let a=t[s];o?a==='"'?t[s+1]==='"'?(n+='"',s++):o=!1:n+=a:a==='"'?o=!0:a===","?(r.push(n),n=""):a===`
61
+ `||a==="\r"?(r.push(n),e.push(r),r=[],n="",a==="\r"&&t[s+1]===`
62
+ `&&s++):n+=a}for((n!==""||r.length>0)&&(r.push(n),e.push(r));e.length>0&&e.at(-1).length===1&&e.at(-1)[0]==="";)e.pop();return e}function wI(t,e){return e.map(r=>{let n=Object.create(null);return t.forEach((o,i)=>{n[o]=r[i]??""}),n})}function rl(t){let e=vI(t);if(e.length<2)throw new Error("Codex CSV: empty or missing header row");let[r,...n]=e;for(let s of yI)if(!r.includes(s))throw new Error(`Codex CSV: missing required column "${s}"`);let o=new Map;for(let s of wI(r,n)){let a=s.configured_scan_id;a&&(o.has(a)||o.set(a,[]),o.get(a).push(s))}if(o.size===0)throw new Error("Codex CSV: no rows with a configured_scan_id");let i=[];for(let[s,a]of o){let c=new Set(a.map(f=>f.repository).filter(Boolean));if(c.size>1)throw new Error(`Codex CSV: scan ${s} contains multiple repositories: ${[...c].join(", ")}`);let p=`${[...c][0]||"unknown-repo"}:${s.replace(/^[^:]+:/u,"")}`;i.push({displayName:p,data:{type:"security",source:"codex-security",findings:a.map(kI)}})}return i}function kI(t){let e=t.relevant_paths.split(" | ").map(o=>o.trim()).find(Boolean)||"unknown",r=[t.title,t.description].filter(Boolean).join(`
63
+
64
+ `),n={id:t.finding_url,file:e,line:"?",severity:(t.severity||"medium").toLowerCase(),description:r,repo:{github:t.repository}};return t.commit_hash&&(n.commitHash=t.commit_hash),t.detected_at&&(n.detectedAt=t.detected_at),t.committed_at&&(n.committedAt=t.committed_at),n}var yI,Gx=w(()=>{"use strict";yI=["finding_url","repository","title","description","severity","configured_scan_id","relevant_paths"]});function pm(t){let e=dt(t)||ut(t)||"Untitled finding";return e.length>qx?`${e.slice(0,qx-1).trimEnd()}\u2026`:e}function fm(t){let e=String(t??"").trim();return Be(e)?Xd(e):Qa(e)?ui(e,`https://github.com/${e}`):e}function Jx(t,e,r){return e?ct[e]??String(e):Xa(t,r)}function _r(t){return typeof t=="number"?Number.isFinite(t)?String(t):"":typeof t=="string"?t.replaceAll(/\s*\n\s*/gu," ").trim():""}function Yx(t){return typeof t=="string"?t.trim():""}function SI(t,e){let r=e.severityMode==="original",n=Dr(ae(t,e.severityMode));Ut(t)&&(n+=r?` \u2014 corrected to ${Dr(zr(t))}`:` \u2014 corrected from ${Dr(t.severity)}`);let o=ds(t);if(o){let i=Object.entries(o).map(([s,a])=>`${s||"this report"}: ${Dr(a?.severity)}`);n+=` (varies across reports \u2014 ${i.join("; ")})`}return t.critical===!0&&(n+=" \xB7 flagged critical by the analyzer"),n}function CI(t,e){let r=ut(t);if(!r)return"";let n=e.hooks.location(t),o=Be(n)?ui(nt(r),n):nt(r),i=wn(t);return i?`${o} \xB7 ${nt(i)}`:o}function EI(t){if(!t)return"";let e=[],r=ro[t.triage]??(t.ignored?ro.ignored:"");return r&&e.push(r),t.color&&e.push(`${Ya[t.color]??t.color} mark`),t.flagged===!0&&e.push("Flagged"),e.join(" \xB7 ")}function RI(t){let e=_r(t);return e?ct[e]??e:""}function AI(t,e){let r=_r(t.commitHash);if(!r)return"";let n=e.hooks.commit(t);return Be(n)?ui(nt(r.slice(0,7)),n):nt(r)}function TI(t,e,r){let n=[],o=(p,f)=>{f&&n.push(`- **${p}:** ${f}`)};o("Location",CI(t,e)),o("Severity",SI(t,e)),t.confidence!==void 0&&t.confidence!==null&&o("Confidence",`${t.confidence}/10`),e.showAnalyzer&&o("Analyzer",e.analyzerOf(t)),o("Category",_r(t.category));let i=e.revalidation?Fe(t):"";i&&o("Revalidation",i==="revalidation"?"the revalidation pass itself":i),i&&o("Revalidated by",RI(t.revalidateSource)),o("Triage",EI(r)),r?.fix&&o("Fix",Xd(String(r.fix).trim())),e.showReport&&o("Report",nt(e.hooks.report(t)??""));let s=_r(t.repo?.github);s&&s!==e.repo&&o("Repository",fm(s)),o("Introduced in",AI(t,e));let a=_r(t.discoveredIn);a&&a!==String(t.file??"").trim()&&o("Found while analyzing",nt(a));let c=t.package?.npm,u=_r(c?.name);u&&o("Package",nt(_r(c.version)?`${u}@${_r(c.version)}`:u));for(let[p,f]of $I)o(p,_r(t[f]));for(let[p,f]of _I)o(p,nt(_r(t[f])));return o("ID",nt(_r(t.id))),n.join(`
65
+ `)}function su(t,e,r){let n=ms(r);return n?`${Ur(t,e)}
66
+
67
+ ${n}`:Ur(t,e)}function MI(t,e){return(Array.isArray(t.evidence)?t.evidence:[]).map((n,o)=>{let i=`${o+1}. `,s=ut(n),a=e.hooks.evidence(n,t,o),c="";s?c=Be(a)?ui(nt(s),a):nt(s):Be(a)&&(c=Xd(a));let u=ms(di(n)),p=i+(c||"(no reference)");return u?`${p}
68
+
69
+ ${mx(i,u)}`:p}).join(`
70
+
71
+ `)}function II(t,e,r){let n=no(t),o=ir(n.body),i=dt(t),s=i!==""&&pm(t)!==i,a=!s&&!n.title&&o.trim()===i,c=s&&ci(o)!==i?`${i}
72
+
73
+ ${o}`:o,u=ps(a?"":c),p=u.findIndex(b=>b.label!==null),f=p===-1?u:u.slice(0,p),h=p===-1?[]:u.slice(p),g=f.map(b=>ms(b.body)),y=MI(t,e);y&&g.push(`${Ur(r,"Evidence")}
74
+
75
+ ${y}`);for(let b of h)g.push(b.label===null?ms(b.body):su(r,b.label,b.body));return g}function Xx(t,e,r){let n=e.hooks.annotation(t),o=[TI(t,e,n),...II(t,e,r)];for(let[s,a,c]of xI){if(c&&!e.revalidation)continue;let u=t[a],p=typeof u=="string"?$t(u,t):"";p.trim()&&o.push(su(r,s,p))}Ut(t)&&Yx(t.correctedSeverityReason)&&o.push(su(r,"Severity correction",t.correctedSeverityReason));let i=Yx(n?.comment);return i&&o.push(su(r,"Comment",i)),o}function Zx(t,e,{headingText:r,depth:n}){let o=[Ur(n,r)];if(t.length===1)return Ja([...o,...Xx(t[0],e,n+1)]);let i=[...new Set(t.map(c=>e.hooks.report(c)).filter(Boolean))],s=i.length>1?` \u2014 reported in ${i.map(c=>nt(c)).join(", ")}`:"";o.push(`${hs(t.length,"case")} of this finding${s}.`);let a=dt(t[0]);return t.forEach((c,u)=>{let p=ut(c);o.push(Ur(n+1,`Case ${u+1} of ${t.length}${p?` \u2014 ${nt(p)}`:""}`));let f=dt(c);f&&f!==a&&o.push(ms(f)),o.push(...Xx(c,e,n+2))}),Ja(o)}var qx,xI,$I,_I,Qx=w(()=>{"use strict";fs();cs();Za();eu();sr();qx=120;xI=[["Impact","impact",!1],["Reproduction","reproduction",!1],["Recommendation","recommendation",!1],["Confidence reasoning","confidenceReason",!1],["Revalidation verdict","revalidateVerdict",!0],["Revalidation recommendation","revalidateRecommendation",!0]],$I=[["Status","status"],["Branch","branch"],["Date created","dateCreated"],["Detected at","detectedAt"],["Committed at","committedAt"],["PoC status","pocStatus"],["Variant of","parent"],["Slug","slug"],["Priority","priority"]],_I=[["Detailed report","reportPath"],["Commit audited","auditedCommit"]]});function BI(t){let e={};for(let[r,n]of Object.entries(FI))e[r]=typeof t?.[r]=="function"?t[r]:n;return e}function OI(t,e){let r=o=>typeof o?.source=="string"&&o.source?o.source:null;if(t.length===1)return o=>r(o)??t[0].source??null;let n=new Map(t.map(o=>[o.name,o.source??null]));return o=>r(o)??n.get(e.report(o))??null}function PI(t,e,r){let n=t.view?.revalidation!==!1,o=(Array.isArray(t.reports)?t.reports:[]).filter(u=>u&&typeof u=="object"),i=OI(o,e),s=u=>Jx(u,i(u),n),a=new Set(r.map(s)),c=new Set(r.map(u=>e.report(u)).filter(Boolean));return{hooks:e,analyzerOf:s,severityMode:t.view?.severityMode==="original"?"original":"corrected",revalidation:n,showAnalyzer:a.size>1,showReport:c.size>1||o.length>1,repo:typeof t.repo=="string"&&t.repo?t.repo:null}}function NI(t){if(!t)return"";let e=[t.bucket?`${t.bucket} findings`:"Live findings"];return t.severityMode==="original"?e.push("original analyzer severities"):t.severityMode==="corrected"&&e.push("corrected severities"),t.revalidation===!1?e.push("code view \u2014 the revalidation pass is not applied"):t.revalidation===!0&&(t.revalidationDetail===!0?e.push("detailed app view \u2014 the revalidation pass is applied, with the rows it re-rated"):t.revalidationDetail===!1?e.push("app view \u2014 the revalidation pass is applied, standing in for the rows it re-rated"):e.push("app view \u2014 the revalidation pass is applied")),e.join(" \xB7 ")}function DI(t){if(!t)return"";let e=Number(t.included)||0,r=Number(t.total)||0;return r===0?"no findings":e>=r?`all ${hs(r,"finding")}`:`${e} of ${hs(r,"finding")} (${r-e} filtered out)`}function zI(t,e,r){let n=[],o=(p,f)=>{f&&n.push(`- **${p}:** ${f}`)},i=Array.isArray(t.reports)?t.reports:[],s=[...new Set(i.map(p=>ct[p?.source]??"").filter(Boolean))];o("Source",s.join(", "));let a=i.map(p=>p?.name).filter(Boolean);o(a.length===1?"Report":"Reports",a.map(p=>nt(p)).join(", ")),o("Workspace",typeof t.workspace=="string"?t.workspace.trim():""),e.repo&&o("Repository",fm(e.repo));let c=[...new Set(r.map(e.analyzerOf).filter(Boolean))],u=c.length===s.length&&c.every(p=>s.includes(p));return c.length>0&&!u&&o(c.length===1?"Analyzer":"Analyzers",c.join("; ")),t.generatedAt&&o("Exported",px(t.generatedAt)),o("View",NI(t.view)),Array.isArray(t.filters)&&o("Filters",t.filters.length>0?t.filters.map(p=>`${p.label}: ${p.value}`).join(" \xB7 "):"none"),o("Included",DI(t.counts)),n.join(`
76
+ `)}function UI(t,e){let r=new Map;for(let s of t){let a=ae(s[0],e.severityMode)??"informational";r.has(a)||r.set(a,[]),r.get(a).push(s)}let n=[...Ee,...[...r.keys()].filter(s=>!Ee.includes(s))],o=new Set,i=[];for(let s of n)for(let a of r.get(s)??[]){let c=i.length+1,u=pm(a[0]),p=`${c}. ${u}`;i.push({group:a,number:c,severity:s,title:u,headingText:p,slug:ux(p,o)})}return i}function e$(t){let e=new Map;for(let r of t)e.set(r.severity,(e.get(r.severity)??0)+1);return e}function HI(t,e){let r={flagged:0,marked:0,commented:0,fixed:0};for(let{group:o}of t)for(let i of o){let s=e.hooks.annotation(i);s&&(s.flagged===!0&&r.flagged++,s.color&&r.marked++,s.comment&&r.commented++,s.fix&&r.fixed++)}let n=[];return r.flagged&&n.push(`${r.flagged} flagged`),r.marked&&n.push(`${r.marked} colour-marked`),r.commented&&n.push(`${r.commented} commented`),r.fixed&&n.push(`${r.fixed} with a fix link`),n.length>0?`Annotations: ${n.join(", ")}.`:""}function jI(t){let e=t.some(({group:o})=>o.some(i=>i.confidence!==void 0&&i.confidence!==null)),r=["#","Severity","Finding","Location"];e&&r.push("Confidence");let n=t.map(o=>{let i=o.group[0],s=o.group.length>1?` (${hs(o.group.length,"case")})`:"",a=ut(i),c=[String(o.number),Dr(o.severity),ui(Gh(dx(o.title)),`#${o.slug}`)+s,a?Gh(nt(a)):""];return e&&c.push(i.confidence===void 0||i.confidence===null?"":`${i.confidence}/10`),c});return qh(r,n,["right"])}function VI(t,e){let r=[Ur(2,"Summary")];if(t.length===0)return[...r,"No findings are included."];let n=[...e$(t)].map(([i,s])=>[Dr(i),String(s)]);n.push(["**Total**",`**${t.length}**`]),r.push(qh(["Severity","Findings"],n,["left","right"]));let o=HI(t,e);return o&&r.push(o),r.push(jI(t)),r}function WI(t,e){let r=e$(t),n=[],o=null;for(let i of t)i.severity!==o&&(o=i.severity,n.push(Ur(2,`${Dr(o)} (${r.get(o)})`))),n.push(Zx(i.group,e,{headingText:i.headingText,depth:3}));return n}function hm(t={},e={}){let r=BI(e),n=(Array.isArray(t.groups)?t.groups:[]).map(c=>Array.isArray(c)?c:[c]).map(c=>c.filter(u=>u&&typeof u=="object")).filter(c=>c.length>0),o=n.flat(),i=PI(t,r,o),s=UI(n,i),a=[LI,Ur(1,typeof t.title=="string"&&t.title.trim()?t.title.trim():"Findings"),zI(t,i,o),...VI(s,i),...WI(s,i)];return`${Ja(a)}
77
+ `}var LI,FI,t$=w(()=>{"use strict";fs();cs();Qx();Za();LI="<!-- DeepView findings export -->",FI={annotation:()=>null,location:t=>typeof t?.location=="string"?t.location:null,evidence:t=>typeof t?.url=="string"?t.url:null,commit:()=>null,report:()=>null}});function ar(t){return Array.isArray(t?.findings)?t.findings:Array.isArray(t?.groups)?t.groups:null}function au(t,e){return typeof e=="string"&&/\.csv$/iu.test(e)?"codex":kn(t).format}function kn(t){let e;try{let r=JSON.parse(t);return ar(r)?{data:r,format:"json",reason:null}:{data:null,format:null,reason:"JSON, but not a report: no findings array"}}catch(r){e=r}for(let[r,n]of KI){let o=n(t);if(o)return{data:o,format:r,reason:null}}return{data:null,format:null,reason:`Not JSON, and not a recognized markdown format. (JSON error: ${e.message})`}}function r$(t){let{data:e}=kn(t);return e?{count:ar(e).length,source:e.source,recognized:!0}:{count:0,recognized:!1}}function GI(t){return t.flat().filter(e=>e&&typeof e=="object")}async function mm(t){let e=t.filter(n=>!n.id);if(e.length===0)return;let r=await Promise.all(e.map(dm));e.forEach((n,o)=>{r[o]&&(n.id=r[o])})}async function Ht(t){let{data:e,format:r}=kn(t);if(!e)return null;let n=GI(ar(e));return await mm(n),{format:r,data:e,findings:n}}var KI,Oe=w(()=>{"use strict";ax();Tx();Px();Wx();um();Gx();um();eu();t$();cs();fs();sr();Za();KI=[["deepview-md",Ax],["deepsec",sx],["piolium",jx],["claude-security",Bx]]});function qI(t){let e=t?.package?.npm;if(typeof e?.name=="string"&&e.name&&!qn(e))return e.name;if(!t?.file)return null;let r=/(?:^|\/)(?:node_modules|dependencies)\/(@[^/]+\/[^/]+|[^/]+)/gu,n;for(;(n=r.exec(t.file))!==null;)if(n[1]!==".pnpm")return n[1];return null}function YI(t){return typeof t?.file!="string"?!1:/(?:^|\/)(?:node_modules|dependencies)\//u.test(t.file)}function XI(t,e){return typeof t.repo?.github=="string"&&t.repo.github?t.repo.github:typeof t._repoFallback=="string"&&t._repoFallback?t._repoFallback:typeof e=="string"&&e?e:null}function ym(t){return gm.add(t),()=>gm.delete(t)}function vm(){for(let t of gm)try{t()}catch{}}function il(t){return mi.get(t)?.list??[]}function wm(){let t=0;for(let e of mi.values())t+=e.list.length;return t}function jr(){return bs}function bi(){return ys}function sl(t,e){let r=mi.get(t);if(!r)return[];let n=r.reports.get(io(e));return n?[...n]:[]}function km(t,e){let r=bs.get(t);if(!r)return[];let n=r._keyReports.get(io(e));return n?[...n]:[]}function xm(t,e){let r=ys.get(t);if(!r)return[];let n=r._keyReports.get(io(e));return n?[...n]:[]}function yi(t){let e=gi.get(t);return e?[...e.reports.keys()]:[]}function $m(t){let e=gi.get(t);if(!e)return"";for(let{title:r}of e.reports.values())if(r)return r;return""}function _m(t){let e=new Set;for(let r of t)for(let n of gi.get(r)?.reports.values()??[])for(let o of n.rows)e.add(o);return[...e]}function io(t){return t.id?`id:${t.id}`:`c:${t.severity??""}|${t.description??""}|${t.file??""}|${t.line??""}`}function cu(t,e,r){let n=lu.get(t);n||(n={hash:[],pkg:[],repo:[],id:[]},lu.set(t,n)),n[e].push(r)}function JI(t,e,r){let n=gi.get(t.id);n||gi.set(t.id,n={reports:new Map});let o=n.reports.get(e);return o?(o.rows.add(r),!1):(n.reports.set(e,{title:dt(t),rows:new Set([r])}),cu(e,"id",t.id),!0)}function ZI(t,e,r){let n=mi.get(t.fileHash);n||(n={keys:new Set,list:[],reports:new Map},mi.set(t.fileHash,n));let o=n.reports.get(e);o||(o=new Set,n.reports.set(e,o));let i=!o.has(r);return o.add(r),i&&cu(r,"hash",{hash:t.fileHash,key:e}),n.keys.has(e)?i:(n.keys.add(e),n.list.push(t),!0)}function QI(t,e,r){let n=qI(t);if(!n)return!1;let o=S0(t),i=bs.get(n);if(i||(i={...bd(),repos:new Set,byVersion:new Map,_repoReports:new Map},bs.set(n,i)),typeof t.repo?.github=="string"&&t.repo.github){i.repos.add(t.repo.github);let a=i._repoReports.get(t.repo.github);a||i._repoReports.set(t.repo.github,a=new Set),a.add(r)}C0(i,o,t,e,r);let s=yd(i,e,r,t);return cu(r,"pkg",{pkg:n,key:e,file:t.file,version:o}),s}function eL(t,e,r,n){if(YI(t))return!1;let o=XI(t,n);if(!o)return!1;let i=ys.get(o);i||(i=bd(),ys.set(o,i));let s=yd(i,e,r,t);return s&&cu(r,"repo",{repo:o,key:e,file:t.file}),s}function Sm(t){let e=lu.get(t);if(lu.delete(t),ol.delete(t),!e)return!1;let r=!1;for(let{hash:o,key:i}of e.hash){let s=mi.get(o);if(!s)continue;let a=s.reports.get(i);if(a){if(a.delete(t)&&(r=!0),a.size===0){s.reports.delete(i),s.keys.delete(i);let c=s.list.findIndex(u=>io(u)===i);c>=0&&s.list.splice(c,1)}s.keys.size===0&&mi.delete(o)}}let n=new Set;for(let{pkg:o,key:i,file:s,version:a}of e.pkg){let c=bs.get(o);if(!c)continue;let u=c._keyReports.get(i);if(u){if(u.delete(t)&&(r=!0),u.size===0&&vd(c,i,s,io),E0(c,a,i,s,t,io),!n.has(o)){n.add(o);for(let p of[...c._repoReports.keys()]){let f=c._repoReports.get(p);f?.delete(t)&&f.size===0&&(c._repoReports.delete(p),c.repos.delete(p),r=!0)}}c._keyReports.size===0?bs.delete(o):wd(c)}}for(let{repo:o,key:i,file:s}of e.repo){let a=ys.get(o);if(!a)continue;let c=a._keyReports.get(i);c&&(c.delete(t)&&(r=!0),c.size===0&&vd(a,i,s,io),a._keyReports.size===0?ys.delete(o):wd(a))}for(let o of e.id){let i=gi.get(o);i&&(i.reports.delete(t)&&(r=!0),i.reports.size===0&&gi.delete(o))}return r}async function tL(t){if(ol.has(t))return!1;ol.add(t);try{let e=await Le(t),r=await Ht(e);if(!r)return!1;let{data:n,findings:o}=r;if(o.length===0)return!1;for(let a of o)fi(a,n);let i=$r(n)??"";if(!i)try{i=xt(t)}catch{}let s=!1;for(let a of o){let c=io(a);a.fileHash&&ZI(a,c,t)&&(s=!0),a.file&&QI(a,c,t)&&(s=!0),a.file&&eL(a,c,t,i)&&(s=!0)}for(let[a,c]of ar(n).entries()){let u=(Array.isArray(c)?c:[c]).filter(f=>f?.id);if(u.length===0)continue;let p={report:t,index:a,members:u.map(f=>{let h=f.source??n.source??null;return{id:f.id,title:dt(f),source:h,revalidate:Fe(f),isApp:f.isApp??vn(f,h)}})};for(let f of u)JI(f,t,p)&&(s=!0)}return ol.has(t)?s:(Sm(t),bm=!0,!1)}catch{return ol.delete(t),!1}}function lr(){return nl||(nl=(async()=>{try{do{bm=!1;let t=await pe();for(let e of t)await tL(e)&&vm()}while(bm)}finally{nl=null}})(),nl)}var mi,bs,ys,gi,lu,ol,gm,nl,bm,n$=w(()=>{"use strict";nh();wr();xr();Oe();mi=new Map,bs=new Map,ys=new Map,gi=new Map,lu=new Map;ol=new Set,gm=new Set,nl=null,bm=!1;Qo(t=>{Sm(t)&&vm()});Z0(t=>{Sm(t)&&vm(),lr().catch(()=>{})})});function Em(t){return Cm.add(t),()=>Cm.delete(t)}function o$(){for(let t of Cm)try{t()}catch{}}function ll(t,e){if(!t||!e)return!1;let r=!vs.has(t);vs.set(t,e),du.delete(t);for(let[n,o]of e){if(!o)continue;let i=al.get(o);i||(i=new Map,al.set(o,i)),i.set(t,n)}return r&&o$(),r}function Rm(t){let e=vs.get(t);if(vs.delete(t),du.delete(t),!!e){for(let r of e.values()){let n=al.get(r);n&&(n.delete(t),n.size===0&&al.delete(r))}o$()}}function cl(t,e){let r=vs.get(t);if(!r||typeof e!="string"||e==="")return null;if(r.has(e))return e;let n=rL(t,r).get(i$(e));if(!n)return null;let o=e.startsWith("/")?e:`/${e}`,i=null;for(let s of n)if(s.endsWith(o)){if(i!==null)return null;i=s}return i}function i$(t){let e=t.lastIndexOf("/");return e<0?t:t.slice(e+1)}function rL(t,e){let r=du.get(t);if(r)return r;r=new Map;for(let n of e.keys()){let o=i$(n),i=r.get(o);i?i.push(n):r.set(o,[n])}return du.set(t,r),r}function vi(t){if(!t)return[];let e=al.get(t);if(!e)return[];let r=[];for(let[n,o]of e)r.push({integrity:n,file:o});return r}function Am(t){return vs.has(t)}var al,vs,du,Cm,s$=w(()=>{"use strict";al=new Map,vs=new Map,du=new Map,Cm=new Set});function oL(t){for(let e=0;e<t.length;e++){let r=t.codePointAt(e);if(r<32||r===127)return!0}return!1}function iL(t){return typeof t=="string"&&t.length>0&&t.length<=l$&&!oL(t)}function Sr(t){return iL(t)&&!nL.test(t)}function c$(t,e){return`${t}\0${e}`}function d$(t){return typeof t=="string"&&aL.test(t)}async function jt(t,e){let r=cL[t];if(!r||typeof e!="string"||!e)return null;let n=c$(t,e),o=Tm.get(n);if(o!==void 0)return o;let i;try{let s=await crypto.subtle.digest("SHA-256",ge(r+e));i=new Uint8Array(s).slice(0,sL).toBase64({alphabet:"base64url",omitPadding:!0})}catch{return null}return Tm.set(n,i),i}function uu(t,e){return typeof e!="string"||!e?null:Tm.get(c$(t,e))??null}function dL(t,e){let r=[];for(let[n,o]of[["report",t],["workspace",e]]){if(o==null||o===""){r.push(dl);continue}if(!d$(o))throw new TypeError(`encodeFindingRef: ${n} must be a link hint token, not a name`);r.push(o)}return r.every(n=>n===dl)?null:r[0]===dl?`w${r[1]}`:r.join("")}function uL(t){let e=[t.slice(0,a$),t.slice(a$)].map(r=>r===dl?null:r);return{report:e[0],workspace:e[1]}}function wi({id:t,report:e,workspace:r}={}){if(!Sr(t))throw new TypeError("encodeFindingRef: a persistent finding id is required");let n=[`finding=${encodeURIComponent(t)}`],o=dL(e,r);return o&&n.push(`v=${o}`),n.join("&")}function Mm(t){let e=wi(t);return typeof location>"u"?`#${e}`:`${location.origin}${location.pathname}#${e}`}function pu(t){let e=typeof t=="string"?t:typeof location>"u"?"":location.hash;if(!e)return null;let r=e.replace(/^#/u,"");if(!r)return null;let n={id:null,report:null,workspace:null};for(let o of r.split("&")){let i=o.indexOf("=");if(i<0)continue;let s=o.slice(0,i),a=o.slice(i+1);if(!a)continue;if(s==="v"){if(a.length===5&&a[0]==="w"&&d$(a.slice(1))){let u=a.slice(1);Object.assign(n,{report:null,workspace:u===dl?null:u});continue}if(!lL.test(a))continue;Object.assign(n,uL(a));continue}if(s!=="finding"||a.length>l$*3)continue;let c;try{c=decodeURIComponent(a)}catch{continue}Sr(c)&&(n.id=c)}return n.id?n:null}function u$(t){if(typeof location>"u")return null;let e;try{e=new URL(t)}catch{return null}if(e.href!==t||e.protocol!==location.protocol||e.host!==location.host||e.username||e.password)return null;let r=pu(e.hash);return r?{id:r.id,fragment:wi(r)}:null}var nL,l$,sL,a$,aL,lL,dl,cL,Tm,ul=w(()=>{"use strict";gt();nL=/^\d+$/u;l$=512;sL=3,a$=4,aL=/^[\w-]{4}$/u,lL=/^[\w-]{8}$/u,dl="AAAA",cL={report:`deepview/finding-link/report/v1
37
78
  `,workspace:`deepview/finding-link/workspace/v1
38
- `},ud=new Map;function Tg(e,t){return`${e}\0${t}`}function dx(e){return typeof e=="string"&&ax.test(e)}async function dn(e,t){let r=cx[e];if(!r||typeof t!="string"||!t)return null;let n=Tg(e,t),o=ud.get(n);if(o!==void 0)return o;let i;try{let s=await crypto.subtle.digest("SHA-256",re(r+t));i=new Uint8Array(s).slice(0,sx).toBase64({alphabet:"base64url",omitPadding:!0})}catch{return null}return ud.set(n,i),i}function ka(e,t){return typeof t!="string"||!t?null:ud.get(Tg(e,t))??null}function ux(e,t){let r=[];for(let[n,o]of[["report",e],["workspace",t]]){if(o==null||o===""){r.push(dd);continue}if(!dx(o))throw new TypeError(`encodeFindingRef: ${n} must be a link hint token, not a name`);r.push(o)}return r.every(n=>n===dd)?null:r.join("")}function px(e){let t=[e.slice(0,Eg),e.slice(Eg)].map(r=>r===dd?null:r);return{report:t[0],workspace:t[1]}}function Rg({id:e,report:t,workspace:r}={}){if(!cn(e))throw new TypeError("encodeFindingRef: a persistent finding id is required");let n=[`finding=${encodeURIComponent(e)}`],o=ux(t,r);return o&&n.push(`v=${o}`),n.join("&")}function pd(e){let t=Rg(e);return typeof location>"u"?`#${t}`:`${location.origin}${location.pathname}#${t}`}function $a(e){let t=typeof e=="string"?e:typeof location>"u"?"":location.hash;if(!t)return null;let r=t.replace(/^#/u,"");if(!r)return null;let n={id:null,report:null,workspace:null};for(let o of r.split("&")){let i=o.indexOf("=");if(i<0)continue;let s=o.slice(0,i),l=o.slice(i+1);if(!l)continue;if(s==="v"){if(!lx.test(l))continue;Object.assign(n,px(l));continue}if(s!=="finding"||l.length>Ag*3)continue;let d;try{d=decodeURIComponent(l)}catch{continue}cn(d)&&(n.id=d)}return n.id?n:null}function Ig(e){if(typeof location>"u")return null;let t;try{t=new URL(e)}catch{return null}if(t.href!==e||t.protocol!==location.protocol||t.host!==location.host||t.username||t.password)return null;let r=$a(t.hash);return r?{id:r.id,fragment:Rg(r)}:null}var fx=`deepview/workspace-id/v1
39
- `;async function ui(e){let t=Uint8Array.fromBase64(e),r=re(fx),n=new Uint8Array(r.length+t.length);n.set(r,0),n.set(t,r.length);let o=new Uint8Array(await crypto.subtle.digest("SHA-256",n)),s=Array.from(o.subarray(0,16),u=>u.toString(16).padStart(2,"0")).join("").split("");s[12]="8";let l=parseInt(s[16],16)&3|8;s[16]=l.toString(16);let d=s.join("");return`${d.slice(0,8)}-${d.slice(8,12)}-${d.slice(12,16)}-${d.slice(16,20)}-${d.slice(20,32)}`}function pi(e){let t=new Set;function r(o){return t.add(o),()=>t.delete(o)}function n(o){for(let i of t)try{i(o)}catch(s){console.warn(`workspace ${e} listener failed:`,s)}}return{on:r,fire:n}}var Mg=pi("create"),Fg=pi("delete"),Bg=pi("privateKey"),Lg=pi("report-membership"),Pg=pi("bundle-membership"),hx=Mg.on,fd=Fg.on,hd=Bg.on,gd=Lg.on,md=Pg.on,xa=Mg.fire,bd=Fg.fire,yd=Bg.fire,Sa=Lg.fire,_a=Pg.fire;var wd="deepview.workspaces",gx=1;function fi(){try{let e=Re(wd);if(!e)return[];let t=JSON.parse(e);return t&&typeof t=="object"&&Array.isArray(t.workspaces)?t.workspaces:Array.isArray(t)?t:[]}catch{return[]}}async function mx(e){await Pe(wd,JSON.stringify({version:gx,workspaces:e}))}var bx=wd;function Jn(e){return navigator.locks.request(bx,async()=>{await pr();let t=fi(),r=await e(t);if(r!==!1)return await mx(t),r})}function hi(e){return{id:e.id,privateKey:e.privateKey,reports:Array.isArray(e.reports)?[...e.reports]:[],bundles:Array.isArray(e.bundles)?[...e.bundles]:[]}}var St=fi().map(hi);function kd(){St=fi().map(hi)}function $d(e){St=St.filter(t=>t.id!==e.id),St.push(hi(e))}function yx(e,t){let r=Array.isArray(e[t])?[...e[t]]:[],n=St.find(o=>o.id===e.id);if(n){n[t]=r;return}St.push(hi(e))}function vx(e){St=St.filter(t=>t.id!==e)}function K(){let e=fi();for(let t of e)Array.isArray(t.reports)||(t.reports=[]),Array.isArray(t.bundles)||(t.bundles=[]);return e}var wx=200;function Ot(e){let t=(e??"").trim();return t&&t.replaceAll(/[\u0000-\u001F\u007F]/gu,"").slice(0,wx)||null}async function xd(e){let t=Ot(e);if(!t)return null;let r=new Uint8Array(32);crypto.getRandomValues(r);let n=r.toBase64(),o={id:await ui(n),name:t,privateKey:n,reports:[],bundles:[],createdAt:Date.now()};return await Jn(s=>s.some(l=>l.id===o.id)?!1:(s.push(o),o))?($d(o),o):null}async function Sd(e){await Jn(r=>{let n=r.findIndex(o=>o.id===e);return n<0?!1:(r.splice(n,1),!0)})&&(bd(e),vx(e))}async function _d(e,t){let r=Ot(t);return!(!r||!await Jn(o=>{let i=o.find(s=>s.id===e);return!i||i.name===r?!1:(i.name=r,i)}))}async function Og(e){let t=await Jn(o=>{let i=o.findIndex(p=>p.id===e.id),s=i>=0?o[i]:null,l=Ot(e.name)??s?.name??"Workspace",d=e.preserveBundles?Array.isArray(s?.bundles)?s.bundles:[]:Array.isArray(e.bundles)?e.bundles:[],u={id:e.id,name:l,privateKey:e.privateKey,reports:Array.isArray(e.reports)?[...new Set(e.reports)]:[],bundles:[...new Set(d)],createdAt:e.createdAt??Date.now()};return i>=0?o[i]=u:o.push(u),{previous:s,next:u}}),{next:r}=t,n=St.find(o=>o.id===r.id)??null;return n==null?xa(r.id):(n.privateKey!==r.privateKey&&yd(r.id),Ca(n.reports,r.reports)||Sa(r.id),Ca(n.bundles,r.bundles)||_a(r.id)),$d(r),r}async function Cd({id:e,name:t,privateKey:r,createdAt:n}){let o=null;return await Jn(i=>{let s=Ot(t);if(!s)return o={status:"name-collision",existing:null},!1;let l=i.find(p=>p.id===e)??null;if(l)return o={status:"already-attached",workspace:l},!1;let d=i.find(p=>Ot(p.name)===s)??null;if(d)return o={status:"name-collision",existing:d},!1;let u={id:e,name:s,privateKey:r,reports:[],bundles:[],createdAt:n??Date.now()};i.push(u),o={status:"attached",workspace:u}}),o?.status==="attached"&&(xa(o.workspace.id),$d(o.workspace)),o}function Ca(e,t){let r=new Set(e),n=new Set(t);if(r.size!==n.size)return!1;for(let o of r)if(!n.has(o))return!1;return!0}async function vd({identifier:e,workspaceId:t,field:r,fire:n,additive:o=!1,from:i=void 0}){let s=await Jn(u=>{if((u.find(b=>Array.isArray(b[r])&&b[r].includes(e))?.id??null)===(t??null))return!1;let f=null;if(t!=null&&(f=u.find(b=>b.id===t)??null,!f))return!1;let h=new Set;if(!o)for(let b of u)i!==void 0&&b.id!==i||(Array.isArray(b[r])||(b[r]=[]),b[r].includes(e)&&(b[r]=b[r].filter(v=>v!==e),h.add(b.id)));if(f&&(Array.isArray(f[r])||(f[r]=[]),f[r].includes(e)||(f[r].push(e),h.add(f.id))),h.size===0)return!1;let m=new Map;for(let b of h){let v=u.find(y=>y.id===b);v&&m.set(b,v)}return{affected:h,snapshot:m}});if(!s)return;let{affected:l,snapshot:d}=s;for(let u of l){n(u);let p=d.get(u);p&&yx(p,r)}}function Ng(e,t){return{move:(r,n)=>vd({identifier:r,workspaceId:n,field:e,fire:t}),add:(r,n)=>vd({identifier:r,workspaceId:n,field:e,fire:t,additive:!0}),remove:(r,n)=>vd({identifier:r,field:e,fire:t,from:n})}}var Ed=Ng("reports",Sa),Ad=Ng("bundles",_a),gi=Ed.move,Qt=Ed.add,mi=Ed.remove,Td=Ad.move,un=Ad.add,Rd=Ad.remove;function kx(){let e=fi().map(hi),t=St,r=new Map(t.map(o=>[o.id,o])),n=new Map(e.map(o=>[o.id,o]));for(let o of r.keys())n.has(o)||bd(o);for(let[o,i]of n){let s=r.get(o);if(!s){xa(o);continue}s.privateKey!==i.privateKey&&yd(o),Ca(s.reports,i.reports)||Sa(o),Ca(s.bundles,i.bundles)||_a(o)}St=e}Ln(()=>{kx()});async function Id(e){if(!e)return null;let t=K(),n=(await Promise.all(t.map(o=>dn("workspace",o.id)))).indexOf(e);return n===-1?null:t[n]}async function Md(e){if(!e)return null;let t=await le(),n=(await Promise.all(t.map(o=>dn("report",o)))).indexOf(e);return n===-1?null:t[n]}async function $x(e,t){let r;try{r=await Ne(e)}catch{return!1}if(r==null)return!1;let n=Ft(r);if(!Array.isArray(n?.findings))return!1;let o=Bt(n.findings);if(o.some(s=>s.id===t))return!0;let i=o.filter(s=>!s.id);return i.length===0?!1:(await wr(i),i.some(s=>s.id===t))}async function Fd(e,{skip:t=[]}={}){if(!e)return null;let r=new Set(t),n=(await le()).filter(o=>!r.has(o));for(let o of n)if(await $x(o,e))return o;return null}function Bd(e){return e?K().filter(t=>t.reports.includes(e)):[]}function Ld(e){if(!e)return"";for(let t of e.split(`
40
- `))if(t.trim())return t.trim();return""}function Pd(e){let t=new Set(e.map(n=>n.id)),r=new Map;for(let n of a.reports)for(let o of n.groups)for(let i of o){let s=i.id??String(i._id);if(!(!t.has(s)||r.has(s))&&(r.set(s,{severity:i.severity,file:i.file,line:i.line,description:Ld(i.description)}),r.size===t.size))return r}return r}function Dg(e){return e==="inprogress"||e==="fixed"||e==="invalid"||e==="deleted"?e:void 0}function Te(e){if(e)return Dg(e.triage)??(e.deleted?"deleted":void 0)}function xx(e){return e?!e.color&&!Te(e)&&!e.comment&&!e.fix&&!(e.ignoredReports&&e.ignoredReports.length>0)&&e.flagged===void 0:!0}function pn(e,t,r){let n=e.get(t)?.ignoredReports;return Array.isArray(n)&&n.includes(r)}function bi(e){if(!e||typeof e!="object")return;let t=e,r={};typeof t.color=="string"&&t.color&&(r.color=t.color);let n=Dg(t.triage)??(t.deleted?"deleted":void 0);if(n&&(r.triage=n),typeof t.comment=="string"&&t.comment&&(r.comment=t.comment),typeof t.fix=="string"&&t.fix&&(r.fix=t.fix),typeof t.flagged=="boolean"&&(r.flagged=t.flagged),Array.isArray(t.ignoredReports)){let o=t.ignoredReports.filter(i=>typeof i=="string"&&i.length>0);o.length>0&&(r.ignoredReports=o)}return xx(r)?void 0:r}function Sx(e,t){let r=e??[],n=t??[];if(r.length!==n.length)return!1;if(r.length===0)return!0;let o=new Set(r);for(let i of n)if(!o.has(i))return!1;return!0}function _x(e,t){let r=e??{},n=t??{};return(r.color??"")===(n.color??"")&&(Te(r)??"")===(Te(n)??"")&&(r.comment??"")===(n.comment??"")&&(r.fix??"")===(n.fix??"")&&r.flagged===n.flagged&&Sx(r.ignoredReports,n.ignoredReports)}function U(e,t,r){let n=e.get(t),o=bi({...n,...r});return o===void 0?e.delete(t):_x(n,o)?!1:(e.set(t,o),!0)}function De(e,t,r,n){let o=new Set(e.get(t)?.ignoredReports??[]);return n?o.add(r):o.delete(r),U(e,t,{ignoredReports:o.size>0?[...o]:void 0})}var Od=()=>{};function Ug(e){Od=typeof e=="function"?e:()=>{}}var Hg=()=>{};function Nd(e){Hg=typeof e=="function"?e:()=>{}}var xr="deepview.triage",Zt="deepview.triage.pending",Nt=/^\d+$/u;async function Cx(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("deflate"));return new Uint8Array(await new Response(t).arrayBuffer())}async function Ex(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream("deflate"));return new Uint8Array(await new Response(t).arrayBuffer())}var Ax="deepview.triage.save",zg=0;function Dd(){let e={};for(let[t,r]of a.triage){if(Nt.test(t))continue;let n=bi(r);n&&(e[t]=n)}return e}function ce(){let e=++zg,t=Dd(),r=Object.keys(t).length===0,n=r?null:JSON.stringify(t);if(n!=null)try{localStorage.setItem(Zt,n)}catch{}return navigator.locks.request(et,{mode:"shared"},async()=>{let o=null,i=null;if(n!=null)try{let s=re(n),l=await Cx(s);i=Oe(),o=(i?await Yh(l):l).toBase64()}catch(s){console.warn("Failed to save triage:",s),Od();return}await navigator.locks.request(Ax,()=>{try{if(e!==zg)return;if(n!=null&&Oe()!==i){queueMicrotask(()=>{ce()});return}if(r)localStorage.removeItem(xr),localStorage.removeItem(Zt);else{localStorage.setItem(xr,o);try{localStorage.removeItem(Zt)}catch{}}}catch(s){console.warn("Failed to save triage:",s)}}),Od()})}async function Vg(){let e=localStorage.getItem(Zt);if(e)try{return JSON.parse(e)}catch{}let t=localStorage.getItem(xr);if(!t)return null;let r=Uint8Array.fromBase64(t);if(Ye(r)){if(!Oe())throw new Error("triage: vault locked, cannot decrypt envelope");r=await Xh(r)}let n=await Ex(r);return JSON.parse(Ae(n))}function jg(e,{replace:t=!1}={}){let r=a.triage;if(t){let n=null,o=localStorage.getItem(Zt);if(o)try{n=JSON.parse(o)}catch{}let i=s=>n!=null&&s in n;for(let s of[...r.keys()]){if(Nt.test(s))continue;let l=e?.[s],d=!e||!(s in e);!(i(s)&&n[s]?.color)&&(d||!l?.color)&&U(r,s,{color:void 0}),!(i(s)&&(n[s]?.triage||n[s]?.deleted))&&!Te(l)&&U(r,s,{triage:void 0}),!(i(s)&&n[s]?.comment)&&(d||typeof l?.comment!="string"||!l.comment)&&U(r,s,{comment:void 0}),!(i(s)&&n[s]?.fix)&&(d||typeof l?.fix!="string"||!l.fix)&&U(r,s,{fix:void 0}),!(i(s)&&n[s]?.flagged!==void 0)&&(d||l?.flagged===void 0)&&U(r,s,{flagged:void 0})}for(let s of[...r.keys()]){if(Nt.test(s))continue;let l=r.get(s)?.ignoredReports;if(!l||l.length===0)continue;let d=e?.[s],u=!!Te(d);for(let p of[...l]){if(i(s)&&Array.isArray(n[s]?.ignoredReports)&&n[s].ignoredReports.includes(p))continue;if(u){De(r,s,p,!1);continue}let f=d?.ignoredReports;(!Array.isArray(f)||!f.includes(p))&&De(r,s,p,!1)}}}if(e)for(let[n,o]of Object.entries(e)){let i=Te(o),s={};if(o&&o.color&&(s.color=o.color),i&&(s.triage=i),o&&typeof o.comment=="string"&&o.comment&&(s.comment=o.comment),o&&typeof o.fix=="string"&&o.fix&&(s.fix=o.fix),o&&typeof o.flagged=="boolean"&&(s.flagged=o.flagged),Object.keys(s).length>0&&U(r,n,s),!i&&o&&Array.isArray(o.ignoredReports)){let l=new Set(r.get(n)?.ignoredReports??[]),d=!1;for(let u of o.ignoredReports)typeof u=="string"&&!l.has(u)&&(l.add(u),d=!0);d&&U(r,n,{ignoredReports:[...l]})}}}async function Tx(){try{let e=await Vg();jg(e)}catch(e){console.warn("Failed to load triage:",e)}}async function Wg(){try{let e=await Vg();jg(e,{replace:!0}),Hg()}catch(e){console.warn("Failed to reload triage:",e)}}typeof window<"u"&&window.addEventListener("storage",e=>{e.key!==xr&&e.key!==Zt||Wg()});var yi=Tx();Ie(()=>{Wg()});Ie(()=>{Oe()&&localStorage.getItem(Zt)&&ce()});async function zd({seal:e}){try{localStorage.removeItem(Zt)}catch{}let t=localStorage.getItem(xr);if(!t)return;let r=Uint8Array.fromBase64(t);if(Ye(r))return;let n=await e(r,Uo());localStorage.setItem(xr,n.toBase64())}async function Ud({open:e}){try{localStorage.removeItem(Zt)}catch{}let t=localStorage.getItem(xr);if(!t)return;let r=Uint8Array.fromBase64(t);if(!Ye(r))return;let n=await e(r,Uo());localStorage.setItem(xr,n.toBase64())}var Kg="deepview.lastFile",vi=null;function Hd(){return vi||(vi=Rx(),vi.catch(()=>{vi=null})),vi}async function Rx(){try{await yi}catch{}let e=await le(),t=new Set(e),r=new Set(e),n=new Set;for(let o of e){if(!o.toLowerCase().endsWith(".deepseek"))continue;let i=o.slice(0,-9)+".md";if(t.has(i))continue;let s;try{s=await Ne(o),await pt(i,s),await Dn(o)}catch(p){console.warn(`migrate: failed to rename ${o} -> ${i}`,p);continue}t.delete(o),t.add(i),n.add(o);let l=ci(o);if(Xn(o),l===void 0){let{count:p,source:f}=Xe(s);nt(i,p,f)}else{let{source:p}=Xe(s);nt(i,l,p)}let d=tt(o);d&&(rt(o,""),rt(i,d));let u=!1;for(let[p,f]of[...a.triage])f.ignoredReports?.includes(o)&&(De(a.triage,p,o,!1),De(a.triage,p,i,!0),u=!0);if(u&&await ce(),Re(Kg)===o)try{await Pe(Kg,i)}catch{}}for(let o of K())for(let i of o.reports){if(!i.toLowerCase().endsWith(".deepseek")||!n.has(i)&&r.has(i))continue;let s=i.slice(0,-9)+".md";await mi(i,o.id),await Qt(s,o.id)}}function Gg(){return typeof navigator<"u"&&typeof navigator.storage=="object"&&navigator.storage!==null}async function Qn(){if(!Gg()||typeof navigator.storage.persist!="function")return!1;try{return await navigator.storage.persist()===!0}catch{return!1}}async function Vd(){let e={supported:Gg(),persisted:null,usage:null,quota:null};if(!e.supported)return e;if(typeof navigator.storage.persisted=="function")try{e.persisted=await navigator.storage.persisted()}catch{}if(typeof navigator.storage.estimate=="function")try{let t=await navigator.storage.estimate();typeof t?.usage=="number"&&(e.usage=t.usage),typeof t?.quota=="number"&&(e.quota=t.quota)}catch{}return e}var jd=1;function Ix(){let e=Dd(),t=ia();return{version:jd,exportedAt:new Date().toISOString(),triage:e,repoUrls:t}}function Mx(){return`deepview-triage-${new Date().toISOString().replaceAll(/[:.]/gu,"-").slice(0,19)}.json.gz`}async function Wd(){let e=Ix();return{blob:new Blob([await Ls(JSON.stringify(e))]),filename:Mx()}}async function Kd(e){let t;try{t=await Bo(new Uint8Array(await e.arrayBuffer()))}catch(n){throw new Error(`Failed to gunzip: ${n.message}`,{cause:n})}let r;try{r=JSON.parse(t)}catch(n){throw new Error(`Failed to parse JSON: ${n.message}`,{cause:n})}if(!r||typeof r!="object")throw new Error("Invalid backup file (not an object)");if(r.version!==jd)throw new Error(`Unsupported backup version: ${r.version} (expected ${jd})`);if(!r.triage||typeof r.triage!="object")throw new Error("Backup is missing the `triage` map");if(!r.repoUrls||typeof r.repoUrls!="object")throw new Error("Backup is missing the `repoUrls` map");return r}async function Gd(e,t){if(!["replace","prefer-imported","prefer-current"].includes(t))throw new Error(`Unknown merge mode: ${t}`);if(!e||typeof e!="object")throw new Error("Invalid payload: not an object");if(!e.triage||typeof e.triage!="object"||Array.isArray(e.triage))throw new Error("Invalid payload: missing or non-object `triage`");if(!e.repoUrls||typeof e.repoUrls!="object"||Array.isArray(e.repoUrls))throw new Error("Invalid payload: missing or non-object `repoUrls`");let r=e.triage,n=a.triage;if(t==="replace")for(let l of[...n.keys()])Nt.test(l)||n.delete(l);let o=t==="prefer-current";for(let[l,d]of Object.entries(r)){if(Nt.test(l)||!d||typeof d!="object")continue;typeof d.color=="string"&&d.color&&(!o||!n.get(l)?.color)&&U(n,l,{color:d.color});let u=Te(d);if(u&&(!o||!Te(n.get(l)))&&U(n,l,{triage:u}),typeof d.comment=="string"&&d.comment&&(!o||!n.get(l)?.comment)&&U(n,l,{comment:d.comment}),typeof d.fix=="string"&&d.fix&&(!o||!n.get(l)?.fix)&&U(n,l,{fix:d.fix}),typeof d.flagged=="boolean"&&(!o||n.get(l)?.flagged===void 0)&&U(n,l,{flagged:d.flagged}),Array.isArray(d.ignoredReports)&&!Te(n.get(l)))for(let p of d.ignoredReports)typeof p=="string"&&(o&&pn(n,l,p)||De(n,l,p,!0))}await ce();let i=0,s=null;try{await lg(e.repoUrls,t),i=Object.keys(e.repoUrls).length}catch(l){console.warn("applyTriageImport: repo-URL import failed:",l),s=l}return{triageEntries:Object.keys(r).length,repoUrls:i,repoUrlError:s}}function Fx(e){return e?.name==="NotFoundError"||typeof e?.message=="string"&&e.message.startsWith("File not found:")}async function qd(e){let t=new Set;for(let r of e){let n;try{n=await Ne(r)}catch(s){if(Fx(s))continue;throw new Error(`Failed to read ${r}: ${s.message}`,{cause:s})}if(n==null)continue;let o=Ft(n);if(!Array.isArray(o?.findings))continue;let i=Bt(o.findings);await wr(i);for(let s of i)s.id&&t.add(s.id)}return t}function Bx(){let e=new Set;for(let t of a.triage.keys())Nt.test(t)||e.add(t);return e}async function Ea(e){let t=Bx();if(t.size===0)return{orphanedCount:0,sharedCount:0};let r=await qd(e),n=new Set;for(let p of t)r.has(p)&&n.add(p);if(n.size===0)return{orphanedCount:0,sharedCount:0};let o=await le(),i=new Set(e),s=o.filter(p=>!i.has(p)),l=await qd(s),d=0,u=0;for(let p of n)l.has(p)?u++:d++;return{orphanedCount:d,sharedCount:u}}async function Aa(){let e=new Set(a.triage.keys()),t=[];for(let[s,l]of a.triage)if(l.ignoredReports)for(let d of l.ignoredReports)t.push({id:s,report:d});let r=await le(),n=new Set(r),o=await qd(r),i=!1;for(let s of e){if(Nt.test(s)||o.has(s))continue;let l=a.triage.get(s);!l||!(l.color||Te(l)||l.comment||l.fix||l.flagged!==void 0)||U(a.triage,s,{color:void 0,triage:void 0,comment:void 0,fix:void 0,flagged:void 0,deleted:void 0})&&(i=!0)}for(let{id:s,report:l}of t)Nt.test(s)||o.has(s)&&n.has(l)||pn(a.triage,s,l)&&De(a.triage,s,l,!1)&&(i=!0);i&&await ce()}var Yd=1,_r=16,qg=12,Yg=1+_r+qg+16,Sr=1+_r+qg;async function Xg(e,t){let r=await crypto.subtle.importKey("raw",re(e),"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",hash:"SHA-256",salt:t,iterations:3e6},r,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}function Jg(e){return!(e instanceof Uint8Array)||e.length<Yg?!1:e[0]===Yd}async function Ta(e,t){if(!(e instanceof Uint8Array))throw new TypeError("encryptWithPassword: plaintext Uint8Array required");if(typeof t!="string"||!t)throw new TypeError("encryptWithPassword: password required");let r=new Uint8Array(Sr+e.length+16);r[0]=Yd,crypto.getRandomValues(r.subarray(1,1+_r)),crypto.getRandomValues(r.subarray(1+_r,Sr));let n=r.subarray(1,1+_r),o=r.subarray(1+_r,Sr),i=await Xg(t,n),s=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:o,additionalData:r.subarray(0,Sr)},i,e));return r.set(s,Sr),r}async function Px(e,t){if(typeof t!="string"||!t)throw new TypeError("tryDecryptWithPassword: password required");if(!(e instanceof Uint8Array)||e.length<Yg)return{ok:!1,reason:"malformed"};if(e[0]!==Yd)return{ok:!1,reason:"malformed"};let r=e.subarray(1,1+_r),n=e.subarray(1+_r,Sr),o=e.subarray(Sr),i=await Xg(t,r),s;try{s=new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:e.subarray(0,Sr)},i,o))}catch{return{ok:!1,reason:"wrong-password"}}return{ok:!0,plaintext:s}}async function Ra(e,t,r){if(!r||typeof r.malformedMsg!="string"||typeof r.wrongPasswordMsg!="string")throw new TypeError("decryptWithPasswordOrThrow: { malformedMsg, wrongPasswordMsg } strings required");let n=await Px(e,t);if(n.ok)return n.plaintext;throw n.reason==="wrong-password"?new Error(r.wrongPasswordMsg):new Error(r.malformedMsg)}var wi=Jg,Qg=Ta;function Zg(e,t){return Ra(e,t,{malformedMsg:"malformed encrypted bundle",wrongPasswordMsg:"wrong password or corrupt bundle"})}var Ox=1;async function Nx(e){let t=new Set,r=Ft(e);if(!Array.isArray(r?.findings))return t;let n=Bt(r.findings);await wr(n);for(let o of n)o.id&&t.add(o.id);return t}function em(e){return(e??"").replaceAll(/[^a-zA-Z0-9._-]+/gu,"_").replaceAll(/^_+|_+$/gu,"")||"workspace"}async function Dx(e){if(!Array.isArray(e)||e.length===0)return[];let t=await xt(),r=new Map(t.map(o=>[o.integrity,o.name])),n=[];for(let o of e){let i=r.get(o);if(!i)continue;let s;try{s=await Xt(o)}catch(l){console.warn(`Workspace export: failed to read bundle ${o}: ${l?.message??l}`);continue}n.push({integrity:o,name:i,data:s.toBase64()})}return n}async function zx(e,{includeBundleBytes:t=!1}={}){let r=[],n=new Set;for(let u of e.reports??[]){let p;try{p=await Ne(u)}catch(f){console.warn(`Workspace export: skipping ${u}: ${f?.message??f}`),(f instanceof DOMException&&f.name==="NotFoundError"||typeof f?.message=="string"&&f.message.startsWith("File not found:"))&&await gi(u,null);continue}r.push({name:u,content:p});for(let f of await Nx(p))n.add(f)}let o=new Set(e.reports??[]),i={};for(let[u,p]of a.triage){if(!n.has(u))continue;let f=(p.ignoredReports??[]).filter(m=>o.has(m)),h=bi({...p,ignoredReports:f});h&&(i[u]=h)}let s={};for(let u of r){let p=tt(u.name);p&&(s[u.name]=p)}let l=(e.bundles??[]).filter(u=>typeof u=="string"&&u.length>0),d={version:Ox,exportedAt:new Date().toISOString(),workspace:{id:e.id,name:e.name,privateKey:e.privateKey,createdAt:e.createdAt},reports:r,bundles:l,repoUrls:s,triage:i};if(t){let u=await Dx(l);u.length>0&&(d.bundleBlobs=u)}return d}async function tm(e,{includeBundleBytes:t=!1}={}){let r=await zx(e,{includeBundleBytes:t});return{blob:new Blob([await Ls(JSON.stringify(r))]),filename:`${em(e.name)}.deepview-workspace.json.gz`}}async function Ux(e,t,{includeBundleBytes:r=!1}={}){if(typeof t!="string"||!t)throw new TypeError("buildWorkspaceExportEncrypted: password required");let{blob:n}=await tm(e,{includeBundleBytes:r}),o=new Uint8Array(await n.arrayBuffer()),i=await Qg(o,t);return{blob:new Blob([i],{type:"application/octet-stream"}),filename:`${em(e.name)}.deepview-workspace.enc`}}async function Xd(e,{password:t,includeBundleBytes:r=!1}={}){return typeof t=="string"&&t?await Ux(e,t,{includeBundleBytes:r}):await tm(e,{includeBundleBytes:r})}var Hx=1,rm=1024,nm=1024,Ia=200,am=100*1024*1024,Vx=Math.ceil(am*4/3)+16,om=512,im=64;function jx(e){if(!e||typeof e!="object")return"payload is not an object";if(e.version!==Hx)return`unsupported export version: ${e.version}`;if(!e.workspace||typeof e.workspace!="object")return"workspace metadata missing";if(typeof e.workspace.id!="string")return"workspace.id must be a string";if(typeof e.workspace.name!="string")return"workspace.name must be a string";if(typeof e.workspace.privateKey!="string")return"workspace.privateKey must be a string";if(e.workspace.createdAt!==void 0&&!Number.isFinite(e.workspace.createdAt))return"workspace.createdAt must be a finite number or omitted";if(!Array.isArray(e.reports))return"reports field must be an array";if(e.reports.length>nm)return`reports count (${e.reports.length}) exceeds cap (${nm})`;if(e.bundles!==void 0){if(!Array.isArray(e.bundles))return"bundles field must be an array when present";if(e.bundles.length>rm)return`bundles count (${e.bundles.length}) exceeds cap (${rm})`;for(let t of e.bundles){if(typeof t!="string")return"bundles entries must be strings";if(t.length>Ia)return`bundle integrity exceeds per-entry length cap (${Ia})`}}if(e.bundleBlobs!==void 0){if(!Array.isArray(e.bundleBlobs))return"bundleBlobs field must be an array when present";if(e.bundleBlobs.length>im)return`bundleBlobs count (${e.bundleBlobs.length}) exceeds cap (${im})`;for(let t of e.bundleBlobs){if(!t||typeof t!="object"||Array.isArray(t))return"bundleBlobs entries must be objects";if(typeof t.integrity!="string"||t.integrity.length===0)return"bundleBlobs.integrity must be a non-empty string";if(t.integrity.length>Ia)return`bundleBlobs.integrity exceeds per-entry length cap (${Ia})`;if(typeof t.name!="string"||t.name.length===0)return"bundleBlobs.name must be a non-empty string";if(t.name.length>om)return`bundleBlobs.name exceeds per-entry length cap (${om})`;if(t.name.includes("\0"))return"bundleBlobs.name cannot contain NUL";if(typeof t.data!="string")return"bundleBlobs.data must be a base64 string";if(t.data.length>Vx)return`bundleBlobs.data exceeds per-blob size cap (${am} bytes raw)`}}return null}async function Jd(e){return new Uint8Array(await e.arrayBuffer())}async function Ma(e,t){if(wi(e)){if(typeof t!="string"||!t)throw new TypeError("parseWorkspaceBundleBytes: password required for encrypted bundle");let n=await Zg(e,t);try{return sm(await Bo(n))}catch(o){throw new Error("wrong password or corrupt bundle",{cause:o})}}let r;try{r=await Bo(e)}catch(n){throw new Error(`gzip decompression failed: ${n.message}`,{cause:n})}return sm(r)}function sm(e){let t;try{t=JSON.parse(e)}catch(o){throw new Error(`payload is not JSON: ${o.message}`,{cause:o})}let r=jx(t);if(r===null)return t;let n=r.includes("exceeds cap");throw new Error(n?r:`not a deepview workspace export: ${r}`)}function Wx(e){return Te(e)??null}async function Kx(e){let t=new Map;for(let r of e??[]){if(typeof r?.content!="string")continue;let n=Ft(r.content);if(!n?.findings)continue;let o=Bt(n.findings);await wr(o);for(let i of o)!i.id||t.has(i.id)||t.set(i.id,{severity:i.severity,file:i.file,line:i.line,description:Ld(i.description)})}return t}async function Gx(e,t,r){if(!e||typeof e!="object"||Array.isArray(e))return;let n=a.triage,o=[];for(let[i,s]of Object.entries(e)){if(!s||typeof s!="object")continue;let l=n.get(i)?.color,d=typeof s.color=="string"?s.color:void 0;d&&l&&l!==d?o.push({id:i,property:"color",local:l,imported:d}):d&&d!==l&&U(n,i,{color:d});let u=n.get(i)?.comment??"",p=typeof s.comment=="string"?s.comment:"";p&&u&&u!==p?o.push({id:i,property:"comment",local:u,imported:p}):p&&p!==u&&U(n,i,{comment:p});let f=n.get(i)?.fix??"",h=typeof s.fix=="string"?s.fix:"";h&&f&&f!==h?o.push({id:i,property:"fix",local:f,imported:h}):h&&h!==f&&U(n,i,{fix:h});let m=Wx(s),b=Te(n.get(i))??null;m&&b&&b!==m?o.push({id:i,property:"triage",local:b,imported:m}):m&&!b&&U(n,i,{triage:m,ignoredReports:void 0});let v=n.get(i)?.flagged,y=typeof s.flagged=="boolean"?s.flagged:void 0;y!==void 0&&v!==void 0&&v!==y?o.push({id:i,property:"flagged",local:v?"flagged":"not flagged",imported:y?"flagged":"not flagged"}):y!==void 0&&y!==v&&U(n,i,{flagged:y});let w=Array.isArray(s.ignoredReports)?s.ignoredReports:[];if(!Te(n.get(i)))for(let k of w)typeof k=="string"&&De(n,i,k,!0)}if(o.length>0&&t){let i=await t(o,r??new Map);i&&qx(o,i)}await ce()}function qx(e,t){for(let r of e){let n=`${r.id}:${r.property}`;t[n]==="imported"&&Yx(r.id,r.property)===r.local&&(r.property==="color"?U(a.triage,r.id,{color:r.imported}):r.property==="comment"?U(a.triage,r.id,{comment:r.imported}):r.property==="fix"?U(a.triage,r.id,{fix:r.imported}):r.property==="triage"?U(a.triage,r.id,{triage:r.imported,ignoredReports:void 0}):r.property==="flagged"&&U(a.triage,r.id,{flagged:r.imported==="flagged"?!0:r.imported==="not flagged"?!1:void 0}))}}function Yx(e,t){if(t==="color")return a.triage.get(e)?.color;if(t==="triage")return Te(a.triage.get(e))??null;if(t==="comment")return a.triage.get(e)?.comment??"";if(t==="fix")return a.triage.get(e)?.fix??"";if(t==="flagged"){let r=a.triage.get(e)?.flagged;return r===!0?"flagged":r===!1?"not flagged":""}}async function Xx(e){if(Array.isArray(e))for(let t of e){let r;try{r=Uint8Array.fromBase64(t.data)}catch(n){console.warn(`Workspace import: failed to decode bundle ${t.integrity}: ${n?.message??n}`);continue}try{let n=await rn(t.name,r);n?.integrity!==t.integrity&&console.warn(`Workspace import: bundle ${t.name} integrity mismatch (claimed ${t.integrity}, computed ${n?.integrity})`)}catch(n){console.warn(`Workspace import: failed to save bundle ${t.name}: ${n?.message??n}`)}}}async function Qd(e,{conflictResolver:t}={}){let r=[];for(let u of e.reports)if(!(typeof u?.name!="string"||typeof u?.content!="string"))try{await pt(u.name,u.content);let{count:p,source:f}=Xe(u.content);nt(u.name,p,f??di(u.name)),r.push(u.name)}catch(p){console.warn(`Workspace import: failed to save ${u.name}: ${p.message}`)}Array.isArray(e.bundleBlobs)&&e.bundleBlobs.length>0&&await Xx(e.bundleBlobs);let o=e.triage&&Object.keys(e.triage).length>0?await Kx(e.reports):new Map;await Gx(e.triage,t,o);let i=Array.isArray(e.bundles),s=i?e.bundles.filter(u=>typeof u=="string"&&u.length>0):[],l=await Og({id:e.workspace.id,name:e.workspace.name,privateKey:e.workspace.privateKey,reports:r,bundles:i?s:void 0,preserveBundles:!i,createdAt:e.workspace.createdAt}),d=new Set(r);if(e.repoUrls&&typeof e.repoUrls=="object")for(let[u,p]of Object.entries(e.repoUrls))!d.has(u)||typeof p!="string"||!p||tt(u)||(rt(u,p),a.currentFile===u&&(a.repoUrl=p));return l}async function Zd({id:e,name:t,privateKeyBase64:r,password:n}){if(typeof e!="string"||!e)throw new TypeError("encodeShareLink: id required");if(typeof t!="string"||!t)throw new TypeError("encodeShareLink: name required");if(typeof r!="string"||!r)throw new TypeError("encodeShareLink: privateKey required");if(typeof n!="string"||!n)throw new TypeError("encodeShareLink: password required");let i=await ui(r)===e?{v:1,n:t,k:r}:{v:1,i:e,n:t,k:r};return(await Ta(re(JSON.stringify(i)),n)).toBase64({alphabet:"base64url",omitPadding:!0})}async function eu({encoded:e,password:t}){if(typeof e!="string"||!e)throw new Error("malformed share link");if(typeof t!="string"||!t)throw new TypeError("decodeShareLink: password required");let r;try{r=Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch{throw new Error("malformed share link")}let n=await Ra(r,t,{malformedMsg:"malformed share link",wrongPasswordMsg:"wrong password or corrupt link"});try{return await Jx(n)}catch(o){throw new Error("wrong password or corrupt link",{cause:o})}}async function Jx(e){let t=JSON.parse(Ae(e));if(!t||typeof t!="object"||typeof t.n!="string"||typeof t.k!="string"||!t.n||!t.k)throw new Error("shape");if(t.i!==void 0&&(typeof t.i!="string"||!t.i))throw new Error("shape");if(typeof t.i=="string"&&t.i.length>256)throw new Error("shape");if(t.n.length>1024)throw new Error("shape");if(Uint8Array.fromBase64(t.k).length!==32)throw new Error("shape");return{id:typeof t.i=="string"?t.i:await ui(t.k),name:t.n,privateKeyBase64:t.k}}function tu(e){return typeof location>"u"?`#share=${e}`:`${location.origin}${location.pathname}#share=${e}`}function ru(e){let t=typeof e=="string"?e:typeof location>"u"?"":location.hash;if(!t)return null;let r=t.replace(/^#/u,"");if(!r)return null;for(let n of r.split("&")){let o=n.indexOf("=");if(o<0||n.slice(0,o)!=="share")continue;return n.slice(o+1)||null}return null}var Qx={get state(){return a},listWorkspaces:K,addReportToWorkspace:Qt,addBundleToWorkspace:un,onReportMembershipChanged:gd,onBundleMembershipChanged:md,onWorkspaceDeleted:fd,onWorkspacePrivateKeyChanged:hd,analyzeContent:Xe,setCount:nt,gunzipBytes:Rt,listBundles:xt,listFiles:le,readBundle:Xt,readFileBytes:tn,saveBundle:rn,saveFileBytes:qo,saveTriage:ce,getSecureItem:Re,setSecureItem:Pe,removeSecureItem:Pn,onSecureStorageHydrated:Ln};function lm(e){e.installSyncHost(Qx),Ug(()=>e.triageSync.notify())}var G=null,ki=null;function pm(){try{return Re("deepview.sync.userEnabled")!=="0"}catch{return!0}}var fm=!1;function hm(e){fm=!!e}function nu(){if(fm)return!0;try{return Jt()?.mode==="managed"}catch{return!1}}function ou(){return ki||(nu()&&!G?Promise.resolve(null):(ki=(async()=>{let e="./client-sync.js";try{let t=await import(e);return lm(t),G=t,Zx(),t}catch(t){throw ki=null,t}})(),ki))}function gm(){return ou()}var mm=[];function $i(e){G?e(G):mm.push(e)}function Zx(){let e=mm.splice(0);for(let t of e)try{t(G)}catch(r){console.warn("client-sync: deferred apply failed:",r)}}function fn(e,t){let r={cancelled:!1,unsub:null};return $i(n=>{r.cancelled||(r.unsub=t(n,e))}),()=>{r.cancelled=!0,r.unsub&&r.unsub()}}function iu(e,t){return G?G.isInRemote(e,t):!1}function bm(e,t){return G?G.isBundleInRemote(e,t):!1}var e1="deepview.objstore-presence.";function ym(e){try{let t=localStorage.getItem(e1+e);if(!t)return null;let r=JSON.parse(t);return r&&typeof r=="object"?r:null}catch{return null}}function Zn(e,t){if(G&&G.isInRemote(e,t))return!0;let r=ym(e);if(!r||typeof r.names!="object")return!1;for(let n of Object.values(r.names))if(n===t)return!0;return!1}function su(e,t){if(G&&G.isBundleInRemote(e,t))return!0;let r=ym(e);if(!r||typeof r.bundles!="object")return!1;for(let n of Object.values(r.bundles))if(n===t)return!0;return!1}function vm(e){return G?G.remoteCount(e):0}function wm(e){return fn(e,(t,r)=>t.onAutoDownloaded(r))}function km(e){return fn(e,(t,r)=>t.onBundleAutoDownloaded(r))}function $m(e){return fn(e,(t,r)=>t.onChange(r))}var cm=null,dm=null,um=null,Fa=[];function xm(e){if(G){G.setRedraw(e);return}cm=e,$i(t=>{cm===e&&t.setRedraw(e)})}function Sm(e){if(G){G.setAuthenticationResolver(e);return}dm=e,$i(t=>{dm===e&&t.setAuthenticationResolver(e)})}function _m(e){if(G){G.setHydrationConflictResolver(e);return}um=e,$i(t=>{um===e&&t.setHydrationConflictResolver(e)})}async function tr(e,t){if(!nu()&&!(!pm()&&!G))return(await ou())[e](...t)}function Cm(...e){return tr("fetchFile",e)}function Em(...e){return tr("fetchBundleFromRemote",e)}function Ba(...e){return tr("putFile",e)}function Am(...e){return tr("putBundleToRemote",e)}function La(...e){return tr("deleteFromRemote",e)}function Pa(...e){return tr("deleteBundleFromRemote",e)}function xi(...e){return tr("openWorkspace",e)}function Si(...e){return tr("closeWorkspace",e)}function Tm(...e){return tr("recheckRemoteStorage",e)}function er(e,t){if(G)return G.triageSync[e](...t);$i(r=>{r.triageSync[e](...t)})}var D={get status(){return G?G.triageSync.status:"off"},get openSessions(){return G?G.triageSync.openSessions:[]},get persistenceDegraded(){return G?G.triageSync.persistenceDegraded:!1},get proxyAuthRequired(){return G?G.triageSync.proxyAuthRequired:!1},setEnabled(e){if(e===!0)return nu()?Promise.resolve(null):ou().then(t=>{t.triageSync.setEnabled(!0);let r=Fa;Fa=[];for(let n of r)try{t.openWorkspace(n)}catch(o){console.warn(`client-sync: openWorkspace(${n}) failed during re-enable:`,o)}return null}).catch(t=>(console.warn("client-sync: setEnabled load failed:",t),null));if(G){Fa=G.openWorkspaceIds();for(let t of Fa)try{G.closeWorkspace(t)}catch(r){console.warn(`client-sync: closeWorkspace(${t}) failed during disable:`,r)}G.triageSync.setEnabled(!1);return}er("setEnabled",[e])},isEnabled(){return G?G.triageSync.isEnabled():pm()},openSession(e){er("openSession",[e])},closeSession(e){er("closeSession",[e])},refreshSession(e){er("refreshSession",[e])},dismissError(e){er("dismissError",[e])},setForcedOff(e){er("setForcedOff",[e])},setProtocolLocked(e){er("setProtocolLocked",[e])},setServerUrl(e){er("setServerUrl",[e])},getServerUrl(){return G?G.triageSync.getServerUrl():null},notify(){er("notify",[])},onStatusChange(e){return fn(e,(t,r)=>t.triageSync.onStatusChange(r))},onServerInfo(e){return fn(e,(t,r)=>t.triageSync.onServerInfo(r))},onPersistenceDegraded(e){return fn(e,(t,r)=>t.triageSync.onPersistenceDegraded(r))},onProxyAuthRequired(e){return fn(e,(t,r)=>t.triageSync.onProxyAuthRequired(r))}};var _i=class extends ct{constructor(t){if(super(t),this.it=g,t.type!==je.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===g||t==null)return this._t=void 0,this.it=t;if(t===xe)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let r=[t];return r.raw=r,this._t={_$litType$:this.constructor.resultType,strings:r,values:[]}}};_i.directiveName="unsafeHTML",_i.resultType=1;var me=At(_i);var Ci=null;function Ei(){return Ci||(Ci=(async()=>{let e="./client-managed.js";try{return await import(e)}catch(t){throw Ci=null,t}})(),Ci)}async function Rm(){return(await Ei()).probeSession()}async function Im(){return(await Ei()).probeTeams()}async function Mm(e){return(await Ei()).fetchReport(e)}async function Fm(e){return(await Ei()).login(e)}async function Bm(e){return(await Ei()).logout(e)}var Ai=null;function Ti(){return Ai||(Ai=(async()=>{let e="./client-admin.js";try{return await import(e)}catch(t){throw Ai=null,t}})(),Ai)}function Lm(){return Ti()}function Pm(){return Ti()}function Om(){return Ti()}function Nm(){return Ti()}function Dm(){return Ti()}var zm=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{width:260px;flex-shrink:0;height:100%;background:var(--surface);backdrop-filter:var(--glass-blur);border-right:1px solid var(--border);display:flex;flex-direction:column;transition:width .15s ease-out;overflow:hidden}:host(.collapsed){width:32px}:host(.empty){display:none}:host(.collapsed) .brand,:host(.collapsed) .sidebar-search,:host(.collapsed) #encryption-toggle,:host(.collapsed) #file-list{display:none}:host(.collapsed) .sidebar-header{padding:.5rem 0;justify-content:center}:host(.collapsed) .sidebar-actions{padding:.35rem 0;justify-content:center}:host(.collapsed) sidebar-delete-current,:host(.collapsed) #storage-status,:host(.collapsed) #sync-status .sync-label{display:none}:host(.collapsed) #sync-status{padding:.25rem;border:0}:host([data-mode="managed"]) #sidebar-toggle{display:none}.sidebar-header{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem .4rem;.brand{flex:1;min-width:0;display:flex;align-items:baseline;gap:.4rem;font-size:.95rem;font-weight:700;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;user-select:none}.brand-button{background:transparent;border:0;padding:0;margin:0;font:inherit;color:inherit;border-radius:4px;&:focus-visible{outline:2px solid var(--accent);outline-offset:2px}}.brand-tag{font-size:.65rem;font-weight:500;color:var(--muted);text-transform:lowercase;letter-spacing:.02em}}@media(display-mode:window-controls-overlay){.sidebar-header{min-height:env(titlebar-area-height,0px);padding-left:max(.75rem,env(titlebar-area-x,0px));-webkit-app-region:drag;app-region:drag;.brand-button,#encryption-toggle{-webkit-app-region:no-drag;app-region:no-drag}#sidebar-toggle{display:none}}}#sidebar-toggle{flex-shrink:0;width:22px;height:22px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:4px;padding:0;&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}}#encryption-toggle{flex-shrink:0;width:22px;height:22px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:4px;padding:0;&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.encrypted{color:var(--accent)}&.locked-pending{color:light-dark(#b25b00,#f0a060);outline:1px dashed currentcolor;outline-offset:-2px}}.sidebar-search{display:flex;align-items:center;margin:0 .55rem .25rem;padding:0 .25rem 0 .55rem;background:rgb(from var(--text) r g b / .04);border:1px solid var(--border);border-radius:5px;transition:background .12s,border-color .12s;-webkit-app-region:no-drag;app-region:no-drag;&:has(input:focus){border-color:var(--accent);background:rgb(from var(--text) r g b / .06)}.sidebar-search-icon{flex-shrink:0;color:var(--muted);pointer-events:none;margin-right:.4rem}& input{flex:1;min-width:0;padding:.3rem 0;background:transparent;color:var(--text);border:0;outline:none;font:inherit;font-size:.78rem;&::placeholder{color:var(--muted)}&:focus::placeholder{color:transparent}&::-webkit-search-cancel-button{display:none}}}sidebar-view-button{display:contents}.sidebar-view-btn{position:relative;flex-shrink:0;width:20px;height:20px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:3px;padding:0;margin-left:2px;transition:background .12s,color .12s;sidebar-view-button+sidebar-view-button>&{margin-left:.4rem}sidebar-view-button:last-of-type>&{margin-right:.1rem}& svg{width:14px;height:14px}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .08)}&.active{color:var(--accent);background:rgb(from var(--text) r g b / .1)}.view-btn-count{position:absolute;top:-4px;right:-4px;background:var(--bg);color:var(--muted);font-size:8.5px;font-weight:600;border-radius:999px;padding:0 3px;min-width:11px;text-align:center;line-height:11px;font-variant-numeric:tabular-nums;pointer-events:none}&.active .view-btn-count{color:var(--accent)}}#file-list{list-style:none;flex:1;overflow-y:auto;overscroll-behavior:none;scrollbar-gutter:stable;-webkit-app-region:no-drag;app-region:no-drag;padding:0 .35rem .25rem 0;margin:0;scrollbar-width:thin;scrollbar-color:var(--border) transparent;&::-webkit-scrollbar{width:5px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}}.file-group-header{display:flex;align-items:center;justify-content:space-between;padding:.45rem .35rem .2rem .55rem;font-size:.62rem;font-weight:700;text-transform:uppercase;letter-spacing:.12em;color:var(--muted);user-select:none;&:first-child{padding-top:.25rem}.group-count{font-weight:500;letter-spacing:.04em;color:var(--muted);font-size:.7rem}}.file-group-header.workspace-header .workspace-header-actions{display:flex;align-items:center;gap:.35rem}.workspace-add{width:18px;height:18px;display:grid;place-items:center;background:transparent;color:var(--muted);border:1px solid transparent;border-radius:4px;padding:0;&:hover{color:var(--text);border-color:var(--accent)}}.file-item.workspace-item{display:flex;align-items:stretch;gap:.15rem}.file-item.workspace-item button.file-name{flex:1;min-width:0}.file-item.workspace-item .workspace-count{align-self:center;margin-right:.35rem}.workspace-share,.workspace-export,.workspace-leave{flex-shrink:0;width:22px;align-self:center;height:22px;display:none;place-items:center;background:transparent;color:var(--muted);border:1px solid transparent;border-radius:4px;padding:0;&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .06);border-color:var(--accent)}}.workspace-leave:hover:not(:disabled){color:var(--critical, #f87171);border-color:var(--critical, #f87171)}@media(hover:hover){.file-item.workspace-item:hover .workspace-share,.file-item.workspace-item:hover .workspace-export,.file-item.workspace-item:hover .workspace-leave{display:grid}}.workspace-rename-input{width:100%;box-sizing:border-box;background:var(--surface);color:var(--text);border:1px solid var(--accent);border-radius:3px;padding:0 .25rem;margin:-1px 0;font:inherit;font-size:.76rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;outline:none}.file-item.team-item .team-name{display:flex;align-items:center;gap:.5rem;padding:.2rem .3rem .2rem .55rem;color:var(--text);font-size:.78rem}.file-item.team-item .team-icon{flex-shrink:0;color:var(--muted)}.file-item.team-item .team-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-item{list-style:none;position:relative;&.hidden{display:none}}.file-item.current:after{content:"";position:absolute;left:0;top:50%;transform:translateY(-50%);width:3px;height:18px;background:var(--accent);border-radius:0 2px 2px 0;pointer-events:none}.file-item button.file-name{display:flex;align-items:center;gap:.5rem;width:100%;box-sizing:border-box;padding:.2rem .3rem .2rem .55rem;background:transparent;color:var(--text);border:1px solid transparent;border-radius:0 5px 5px 0;font-family:inherit;font-size:.78rem;text-align:left;&:hover{background:rgb(from var(--text) r g b / .04)}.file-icon{flex-shrink:0;color:var(--muted)}.file-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.76rem;line-height:14.5px}}.file-item .file-count{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;color:var(--muted);opacity:.65;font-size:.68rem;font-weight:500;font-variant-numeric:tabular-nums}.workspace-count-missing{margin-left:2px;opacity:.55;font-style:italic}.file-item.current button.file-name{background:rgb(from var(--text) r g b / .05);border-color:var(--border);.file-icon,.file-count{color:var(--text)}}.file-item.indented button.file-name{padding-left:1.3rem}.file-item.indented:before{content:"";position:absolute;left:.85rem;top:0;bottom:0;width:1px;background:var(--border)}.file-item.bundle-missing>.file-name,.file-item.report-missing>.file-name{display:flex;align-items:center;gap:.5rem;padding:.2rem .3rem .2rem 1.4rem;color:var(--muted);font-size:.78rem;font-style:italic;cursor:help;.file-icon{flex-shrink:0;color:var(--muted);font-style:normal}.file-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.76rem;line-height:14.5px}}:host-context(body.theme-pink) .workspace-rename-input,:host-context(body.theme-pink) .file-item button.file-name .file-label,:host-context(body.theme-pink) .file-item.bundle-missing .file-label,:host-context(body.theme-pink) .file-item.report-missing .file-label{font-family:inherit}.file-item.dragging button.file-name{opacity:.4}.file-item.workspace-item.drag-over button.file-name,.file-item.indented.drag-over button.file-name{background:rgb(from var(--accent) r g b / .12);border-color:var(--accent)}.file-group-header.drag-over{background:rgb(from var(--accent) r g b / .12);border-radius:4px}.sidebar-actions{padding:.35rem .55rem .45rem;border-top:1px solid var(--border);display:flex;gap:.35rem;align-items:center;justify-content:space-between;& button{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:4px;padding:.2rem .5rem;font-size:.72rem;font-family:inherit;-webkit-app-region:no-drag;app-region:no-drag;&:hover{color:var(--text);border-color:var(--accent)}&.danger:hover{color:var(--critical);border-color:var(--critical)}&[disabled]{opacity:.4;border-color:var(--border)!important;color:var(--muted)!important}}}sidebar-delete-current{display:contents}sidebar-delete-current button{display:inline-flex;align-items:center;gap:.35rem;.trash-icon{flex-shrink:0}}#sync-status{display:inline-flex;align-items:center;gap:.35rem;border-color:transparent;&:hover{border-color:var(--accent)}.sync-dot{width:8px;height:8px;border-radius:50%;background:var(--muted);flex-shrink:0;box-shadow:0 0 0 1px rgb(from var(--text) r g b / .15)}&[data-status=online] .sync-dot{background:var(--green)}&[data-status=connecting] .sync-dot{background:var(--medium)}&[data-status=offline] .sync-dot{background:var(--critical)}}#sync-status[data-proxy-auth] .sync-dot{box-shadow:0 0 0 2px var(--accent)}#sync-status[data-degraded] .sync-dot{box-shadow:0 0 0 2px var(--medium)}#sync-status[hidden]{display:none}#storage-status{display:flex;align-items:center;gap:.4rem;margin:.3rem .55rem .45rem;padding:.3rem .55rem;background:rgb(from var(--medium) r g b / .12);border:1px solid rgb(from var(--medium) r g b / .3);border-radius:5px;color:light-dark(#b25b00,#f0a060);font-size:.72rem;font-family:inherit;cursor:pointer;text-align:left;-webkit-app-region:no-drag;app-region:no-drag;&:hover{background:rgb(from var(--medium) r g b / .18);border-color:rgb(from var(--medium) r g b / .5)}.storage-dot{width:7px;height:7px;border-radius:50%;background:var(--medium);flex-shrink:0}}#storage-status[hidden],#auth-status[hidden]{display:none}#auth-status{display:inline-flex;align-items:center}#auth-status[data-authed="1"]{padding:2px;border-color:transparent;border-radius:50%}#auth-status[data-authed="1"]:hover{border-color:var(--accent)}.user-avatar{position:relative;flex-shrink:0;width:22px;height:22px;border-radius:50%;overflow:hidden;background:var(--accent);display:inline-grid;place-items:center;user-select:none}.user-avatar-lg{width:38px;height:38px}.user-avatar-fallback{font-size:.72rem;font-weight:600;line-height:1;color:var(--bg);text-transform:uppercase}.user-avatar-lg .user-avatar-fallback{font-size:1.05rem}.user-avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.user-avatar img.broken{display:none}.user-menu[popover]{position:fixed;inset:auto;margin:0;min-width:11rem;flex-direction:column;gap:.1rem;background:var(--surface, var(--bg));border:1px solid var(--border);border-radius:6px;padding:.3rem;box-shadow:0 4px 14px #00000047}.user-menu[popover]:not(:popover-open){display:none}.user-menu[popover]:popover-open{display:flex}.user-card{display:flex;align-items:center;gap:.5rem;padding:.3rem .35rem .45rem;border-bottom:1px solid var(--border);margin-bottom:.2rem}.user-id{display:flex;flex-direction:column;min-width:0}.user-login{font-weight:600;font-size:.82rem;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.user-name{font-size:.74rem;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.user-menu-row{display:block;width:100%;text-align:left;background:transparent;border:0;border-radius:4px;padding:.4rem .5rem;font:inherit;font-size:.82rem;color:var(--text)}.user-menu-row:hover{background:rgb(from var(--text) r g b / .08)}.user-menu-group{display:flex;flex-direction:column;gap:.1rem;padding-bottom:.2rem;margin-bottom:.2rem;border-bottom:1px solid var(--border)}.user-menu-group-label{padding:.25rem .5rem .15rem;font-size:.62rem;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:var(--muted);user-select:none}
41
- `;var Um=`.file-icon.brand-deepview{.bg{fill:#2563eb}.fg{fill:#fff}}.file-icon.brand-claude{.bg{fill:#d97757}.fg{fill:#fff}}.file-icon.brand-codex{.bg{fill:#fff;stroke:#000;stroke-width:.5}.fg{fill:#000}}.file-icon.brand-vercel{.bg{fill:#000;stroke:#fff;stroke-width:.5}.fg{fill:#fff}}.file-icon.brand-piolium{.bg{fill:#fbb829}.fg{fill:#1c1b19}}
42
- `;var Hm=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}dialog{margin-top:5rem;margin-inline:auto;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);padding:1.1rem 1.25rem 1rem;max-width:480px;width:min(94vw,480px);box-shadow:0 20px 60px #00000059;&::backdrop{background:rgb(from var(--theme-bar) r g b / .55);backdrop-filter:blur(2px)}}header h3{margin:0 0 .6rem;font-size:1rem;font-weight:600}.nwd-input{display:block;width:100%;box-sizing:border-box;padding:.5rem .65rem;border:1px solid var(--border);border-radius:6px;background:var(--bg, var(--surface));color:var(--text);font:inherit;font-size:.88rem;&: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)}}.nwd-note{margin:.55rem 0 0;color:var(--muted);font-size:.74rem;line-height:1.45}.nwd-intro{margin:0 0 .8rem;color:var(--muted);font-size:.82rem;line-height:1.5}.nwd-actions{display:flex;align-items:center;gap:.4rem;margin-top:.8rem;padding-top:.7rem;border-top:1px solid var(--border)}.nwd-spacer{flex:1}.nwd-actions button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.35rem .9rem;font:inherit;font-size:.8rem;&:hover:not(:disabled){border-color:var(--accent);color:var(--accent)}&.primary{background:var(--accent);color:var(--surface);border-color:var(--accent);&:hover:not(:disabled){color:var(--surface);filter:brightness(1.08)}}&.quiet{border-color:transparent;color:var(--muted);&:hover:not(:disabled){border-color:transparent}}&.danger{color:var(--critical, #f87171);border-color:var(--border);&:hover:not(:disabled){border-color:var(--critical, #f87171);color:var(--critical, #f87171)}}&:disabled{opacity:.5}}@media(display-mode:window-controls-overlay){dialog{-webkit-app-region:no-drag;app-region:no-drag}}
43
- `;var I=class extends Z{static styles=[B(Hm)];firstUpdated(){this.beforeOpen();let t=this.renderRoot.querySelector("dialog");if(t){try{t.showModal()}catch(r){this._settled=!0,this.dispatchEvent(new CustomEvent("modal-conflict",{detail:{cause:r}}));return}this.focusInitial()}}beforeOpen(){}focusInitial(){(this.renderRoot.querySelector("input, textarea")??this.renderRoot.querySelector("button.primary")??this.renderRoot.querySelector("button"))?.focus()}_finish(t){this._settled||(this._settled=!0,this.renderRoot.querySelector("dialog")?.close(),this.dispatchEvent(new CustomEvent("resolve",{detail:t})))}_onClose=()=>this._finish(null)};function ee(e,t={}){return new Promise(r=>{let n=document.createElement(e);Object.assign(n,t),n.addEventListener("resolve",o=>{n.remove(),r(o.detail)}),document.body.append(n)})}var ft=`dialog{max-width:520px;width:min(94vw,520px)}.wsl-field{display:block;margin-top:.6rem;color:var(--text);font-size:.78rem;>span{display:block;margin-bottom:.25rem;color:var(--muted);font-size:.72rem;text-transform:uppercase;letter-spacing:.04em}}.wsl-ack{display:flex;align-items:flex-start;gap:.5rem;margin-top:.6rem;color:var(--text);font-size:.8rem;line-height:1.4;>input[type=checkbox]{flex:0 0 auto;margin-top:.15rem}>span{flex:1 1 auto}}.wsl-link{display:block;width:100%;box-sizing:border-box;padding:.5rem .65rem;border:1px solid var(--border);border-radius:6px;background:var(--bg, var(--surface));color:var(--text);font:inherit;font-size:.78rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;resize:vertical;word-break:break-all}.wsl-error{margin:.55rem 0 0;color:var(--critical, #f87171);font-size:.74rem;line-height:1.4}.wsl-warning{padding:.55rem .65rem;border:1px solid var(--critical, #f87171);border-radius:6px;background:rgb(from var(--critical, #f87171) r g b / .08)}.wsl-optout{display:flex;align-items:center;gap:.5rem;margin-top:.7rem;color:var(--text);font-size:.78rem}.nwd-input:disabled{opacity:.5}
44
- `;var au=class extends I{static styles=[...I.styles,B(ft)];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(t){if(t.has("_success")&&this._success){let r=this.renderRoot.querySelector("footer button.primary");r&&r.focus()}}beforeOpen(){typeof location<"u"&&(this._userName=location.hostname||"DeepView"),this._orphan=zo(),this._vaultStateUnsub=Ie(()=>{if(this._settled)return;let t=zo();this._orphan&&!t&&se()?(this._error="Encryption was just enabled in another tab. Close this dialog and reload to unlock.",this._busy=!1,this._canCancel=!0):this._orphan!==t&&(this._orphan=t)})}async focusInitial(){await this.updateComplete;let t=this._orphan?'input[data-role="orphan-ack"]':'input[data-role="name"]';this.renderRoot.querySelector(t)?.focus()}disconnectedCallback(){if(super.disconnectedCallback(),this._vaultStateUnsub){try{this._vaultStateUnsub()}catch{}this._vaultStateUnsub=null}}_finish(t){if(!this._settled){if(this._abortController)try{this._abortController.abort()}catch{}super._finish(!!t)}}_onClose=()=>this._finish(this._success);_onCancel=()=>{this._busy&&!this._canCancel||this._finish(!1)};_onDialogCancel=t=>{if(this._busy&&!this._canCancel){t.preventDefault();return}this._finish(!1)};_onNameInput=t=>{this._userName=t.target.value};_onOrphanAckInput=t=>{this._orphanAck=t.target.checked};_onWipeOrphan=async()=>{if(!this._busy&&this._orphanAck){if(se()){this._error="Encryption was just enabled in another tab. Reload this page to unlock.";return}this._busy=!0,this._canCancel=!1,this._error="",this._phase="Clearing previous vault state\u2026";try{await Vo({refuseIfEnabled:!0}),location.reload()}catch(t){this._error=`Could not clear previous vault state: ${t?.message??t}`,this._phase=""}finally{this._busy=!1,this._canCancel=!0}}};_onEnable=async()=>{if(!this._busy){if(!Mt()){this._error="Passkeys are not supported in this browser.";return}this._busy=!0,this._canCancel=!0,this._error="",this._phase="Registering passkey\u2026",this._abortController=new AbortController;try{await yc({userName:this._userName.trim()||"DeepView user",rpName:"DeepView",signal:this._abortController.signal,migrate:async({seal:r})=>{this._canCancel=!1,this._phase="Encrypting workspaces and metadata\u2026",await pc({seal:r}),this._phase="Encrypting triage data\u2026",await zd({seal:r}),this._phase="Encrypting report files\u2026",await Fc({seal:r}),this._phase="Encrypting bundles\u2026",await Lc({seal:r})}})&&(this._success=!0,this._phase="")}catch(t){t?.name==="AbortError"?this._error="":this._error=t?.message??String(t),this._phase=""}finally{this._busy=!1,this._canCancel=!0,this._abortController=null}}};_body(){if(this._orphan)return c`<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">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._phase?c`<p class="nwd-note">${this._phase}</p>`:g} ${this._error?c`<p class="wsl-error">${this._error}</p>`:g}<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="${this._busy||!this._orphanAck}" @click="${this._onWipeOrphan}">${this._busy?"Working\u2026":"Wipe and continue"}</button></footer>`;if(this._success)return c`<p class="nwd-note"><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>`;let t=Mt();return c`<p class="nwd-note">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"><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>${t?g:c`<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._phase?c`<p class="nwd-note">${this._phase}</p>`:g} ${this._error?c`<p class="wsl-error">${this._error}</p>`:g}<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||this._busy}" @click="${this._onEnable}">${this._busy?"Working\u2026":"Enable encryption"}</button></footer>`}render(){return c`<dialog @close="${this._onClose}" @cancel="${this._onDialogCancel}"><header><h3>${this._success?"Encryption enabled":this._orphan?"Previous passkey setup detected":"Enable passkey encryption"}</h3></header>${this._body()}</dialog>`}};customElements.define("passkey-setup-dialog",au);function Oa(){return ee("passkey-setup-dialog")}var lu=class extends I{static styles=[...I.styles,B(ft)];static properties={_busy:{state:!0},_error:{state:!0}};constructor(){super(),this._busy=!1,this._error="",this._abortController=null}_finish(t){if(!this._settled){if(this._abortController)try{this._abortController.abort()}catch{}super._finish(!!t)}}_onCancel=()=>this._finish(!1);_onUnlock=async()=>{if(!this._busy){this._busy=!0,this._error="",this._abortController=new AbortController;try{if(await Ho({signal:this._abortController.signal})){this._finish(!0);return}this._error=""}catch(t){this._error=t?.message??String(t)}finally{this._busy=!1,this._abortController=null}}};render(){return c`<dialog @close="${this._onClose}"><header><h3>Unlock your data</h3></header><p class="nwd-note">Your triage data and report files are encrypted with a passkey on this device. Unlock to load them.</p>${this._error?c`<p class="wsl-error">${this._error}</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">${this._busy?"Cancel":"Later"}</button> <button type="button" class="primary" ?disabled="${this._busy}" @click="${this._onUnlock}">${this._busy?"Waiting\u2026":"Unlock with passkey"}</button></footer></dialog>`}};customElements.define("passkey-unlock-dialog",lu);function Na(){return ee("passkey-unlock-dialog")}var Vm=c`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="8" width="10" height="6" rx="1"/><path d="M5 8V5.5a3 3 0 0 1 6 0V8"/></svg>`,i1=c`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="8" width="10" height="6" rx="1"/><path d="M5 8V5a3 3 0 0 1 6 -0.5"/></svg>`,Me=null;function cu(){if(!Me)return;if(!Mt()){Me.hidden=!0;return}let e=se();if(!e&&a.serverMode==="managed"){Me.hidden=!0;return}Me.hidden=!1;let t=$t();Me.classList.toggle("encrypted",e&&t),Me.classList.toggle("locked-pending",e&&!t),e&&t?(Me.title="Encryption on \u2014 click to disable",Me.setAttribute("aria-label","Disable encryption"),Y(Vm,Me)):e?(Me.title="Encryption on, locked \u2014 click to unlock",Me.setAttribute("aria-label","Unlock encrypted data"),Y(Vm,Me)):(Me.title="Encryption off \u2014 click to enable",Me.setAttribute("aria-label","Enable encryption"),Y(i1,Me))}async function s1(){if(confirm(`Disable encryption?
45
-
46
- Your local triage and report data will be rewritten as plaintext.
47
-
48
- IMPORTANT: DeepView cannot directly delete your passkey. Most browsers / password managers require you to remove the entry manually after disabling. You can re-enable encryption later.`))try{(await vc({migrate:async({open:t})=>{await fc({open:t}),await Ud({open:t}),await Bc({open:t}),await Pc({open:t})}}))?.disabled&&alert(`Encryption disabled. Your data is now plaintext.
49
-
50
- To complete cleanup, remove the DeepView passkey from your password manager / OS settings:
51
- \u2022 macOS / iOS: Settings \u2192 Passwords
52
- \u2022 Windows: Settings \u2192 Accounts \u2192 Sign-in options \u2192 Passkeys
53
- \u2022 Chrome: chrome://settings/passkeys
54
- \u2022 Hardware security key: use the vendor's management tool`)}catch(e){alert(`Could not disable encryption: ${e?.message??e}`)}}async function a1(){await Oa()}function jm(){cu()}function Wm(e){if(!e||e===Me)return;Me=e;let t=!1;Me.addEventListener("click",async()=>{if(!t){t=!0;try{if(!se()){await a1();return}if(!$t()){await Na();return}await s1()}finally{t=!1}}}),Ie(cu),cu()}var Km=`.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}
55
- `;function uu(){let e=navigator.userAgent;return/AppleWebKit/u.test(e)&&!/Chrome\/|Chromium|Edg\/|OPR\/|Android/u.test(e)?"webkit":/Firefox\//u.test(e)?"firefox":"chromium"}var du=class extends I{static styles=[...I.styles,B(Km)];static properties={_retryDenied:{state:!0}};constructor(){super(),this._retryDenied=!1}focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}_onConfirm=()=>this._finish(null);_onRetry=async()=>{if(await Qn()){this._finish("granted");return}this._retryDenied=!0};_chromiumBody(){let t=location.hostname==="localhost"?c`Plain <code>localhost</code> can never qualify — for local testing open the app via <code>127.0.0.1</code> instead.`:g;return c`<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">The browser re-evaluates on every request, so after any of the above press <strong>Try again</strong>.${t}</p>`}_firefoxBody(){return c`<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 c`<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 t=uu(),r=t==="webkit"?this._webkitBody():t==="firefox"?this._firefoxBody():this._chromiumBody();return c`<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>${r}<footer class="nwd-actions">${this._retryDenied?c`<span class="spd-denied" role="status">Still not granted.</span>`:g} <span class="nwd-spacer"></span> ${t==="webkit"?g:c`<button type="button" @click="${this._onRetry}">Try again</button>`} <button type="button" class="primary" @click="${this._onConfirm}">Got it</button></footer></dialog>`}};customElements.define("storage-persist-dialog",du);function Gm(){return new Promise(e=>{let t=document.createElement("storage-persist-dialog"),r=n=>{t.remove(),e(n)};t.addEventListener("resolve",n=>r(n.detail)),t.addEventListener("modal-conflict",()=>r(null)),document.body.append(t)})}var zt=null,Dt=null,hu=!1,Da=!1,pu=0;function fu(){return uu()==="webkit"}function qm(e){return e>=1e9?`${(e/1e9).toFixed(1)} GB`:e>=1e6?`${(e/1e6).toFixed(1)} MB`:e>=1e3?`${(e/1e3).toFixed(1)} kB`:`${e} B`}function c1(){if(!zt)return;if(!Dt||Dt.persisted!==!1||!hu){zt.hidden=!0;return}zt.hidden=!1;let e=Dt.usage===null||Dt.quota===null?"":` Using ${qm(Dt.usage)} of ${qm(Dt.quota)}.`;zt.querySelector(".storage-label").textContent="Storage at risk",zt.title="Reports, bundles and triage are in best-effort storage \u2014 the browser may delete them all under disk pressure or after long inactivity. "+(fu()?"Click for how to protect them (on Safari and iOS browsers this needs the app installed to the Home Screen or Dock).":"Click to request persistent storage \u2014 if the browser declines, instructions for enabling it follow.")+e}function Xm(e,t){let r=t?" (user gesture)":"";if(e){console.info(`storage: persistent-storage request granted${r}`);return}let n=!fu()&&location.hostname==="localhost"?" Note: plain localhost can NEVER pass \u2014 Chromium keys site importance by registerable domain (IP literals excepted) and localhost has none; for local testing use 127.0.0.1 instead.":"";console.info(`storage: persistent-storage request not granted${r} \u2014 `+(fu()?"Safari ties persistence to install state; add the app to the Home Screen / Dock.":"Chromium-based browsers never prompt and silently deny origins they don't consider important; installing the app, bookmarking it, allowing notifications, or regular use flips the heuristic (re-evaluated on every request). Firefox shows a prompt instead.")+n)}async function za(){if(!zt)return;let[e,t]=await Promise.all([Vd(),(async()=>{try{return(await le()).length>0||await Xo()}catch{return!1}})()]);Dt=e,hu=t,c1()}function gu(){!zt||pu||(pu=setTimeout(()=>{pu=0,za()},1e3))}async function Ym(){if(Da||(await za(),Dt?.persisted!==!1||!hu||Da))return;Da=!0;let e=await Qn();Xm(e,!1),await za()}async function d1(){if(Dt&&Dt.persisted===!1){Da=!0;let e=await Qn();Xm(e,!0),e||await Gm()}await za()}function Jm(e){zt=e,zt&&(zt.addEventListener("click",()=>{d1()}),Go((t,r)=>{gu(),r==="save"&&Ym()}),Ym())}var Ri='<path class="bg" d="M3 2h6l4 4v8H3z"/><path fill="rgba(0,0,0,.18)" d="M9 2v4h4Z"/>',oe={default:`<svg class="file-icon brand-deepview" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${Ri}<path class="fg" d="M7.843 6.719c-1.605 0-2.926 1.292-3.477 1.947.466.58 1.872 2.024 3.496 2.024s2.907-1.292 3.486-2.005c-.627-.703-1.88-1.966-3.505-1.966m.019 3.857c-1.51 0-2.802-1.263-3.353-1.9.55-.617 1.814-1.852 3.334-1.852 1.51 0 2.698 1.12 3.335 1.852-.533.618-1.787 1.9-3.316 1.9m-.019-3.42c-.826 0-1.577.694-1.577 1.596 0 .789.599 1.577 1.577 1.577.893 0 1.587-.684 1.587-1.577-.01-.779-.627-1.596-1.587-1.596m0 3.069a1.476 1.476 0 0 1-1.482-1.473c0-.722.599-1.491 1.482-1.491.846 0 1.482.693 1.492 1.491 0 .808-.618 1.473-1.492 1.473m.01-2.727c-.637 0-1.264.532-1.264 1.244 0 .627.475 1.235 1.245 1.245.684 0 1.254-.522 1.254-1.244 0-.58-.475-1.236-1.235-1.245m-.02 2.403a1.167 1.167 0 0 1-1.149-1.159c0-.532.456-1.14 1.169-1.149.56 0 1.149.427 1.159 1.15 0 .636-.485 1.158-1.179 1.158m-.769-1.833c-.19.238-.275.494-.237.864l.74.057zm1.026-.294c-.295-.057-.665 0-.912.228l.323.607zm.133.047-.38.56.988.114c-.057-.275-.323-.579-.608-.674m-.124.741.456.912c.21-.209.352-.484.314-.836zm-1.225.504a.97.97 0 0 0 .57.617l.399-.551zm.713.664c.313.076.636.01.845-.161l-.295-.618zm-.637 1.55c0 .028-.028.066-.066.066h-.59c-.028 0-.066-.028-.066-.066s.029-.066.067-.066h.579c.048 0 .076.028.076.066m.712 0c0 .028-.028.066-.066.066h-.437c-.028 0-.066-.028-.066-.066s.028-.066.066-.066h.437c.038 0 .066.028.066.066m.666 0c0 .028-.029.066-.067.066h-.37c-.029 0-.067-.028-.067-.066s.029-.066.067-.066h.37c.038 0 .067.028.067.066m-1.672.351c0 .029-.029.067-.067.067h-.295c-.028 0-.066-.028-.066-.066 0-.029.029-.067.067-.067h.294c.038 0 .066.028.066.066m.694 0c0 .029-.028.067-.066.067h-.409c-.028 0-.066-.028-.066-.066 0-.029.028-.067.066-.067h.399c.038 0 .076.028.076.066m.732 0c0 .029-.029.067-.067.067h-.465c-.029 0-.067-.028-.067-.066 0-.029.029-.067.067-.067h.465c.038 0 .067.028.067.066m-1.093.371a.065.065 0 0 1-.067.066h-.627c-.028 0-.075-.028-.066-.066 0-.028.029-.066.067-.066h.627c.038 0 .066.028.066.066m.684 0a.065.065 0 0 1-.066.066h-.39c-.028 0-.076-.028-.066-.066 0-.028.028-.066.066-.066h.39c.038 0 .066.028.066.066M5.088 6.263c-.019-.105-.114-.19-.237-.19s-.257.104-.257.237.105.238.247.238c.105 0 .218-.076.238-.18h.864v.826l.095-.048V6.31c0-.028-.019-.057-.048-.057h-.902zm-.237.19c-.076 0-.143-.066-.143-.143s.066-.142.143-.142.142.066.142.143c.01.076-.066.142-.143.142m2.89-.323H6.38l.418-.475v-.332a.255.255 0 0 0 .218-.248c0-.123-.114-.256-.256-.256s-.266.114-.266.257c0 .123.095.228.209.247v.284l-.456.523v.893l.095-.047v-.742h1.396c.029 0 .067-.009.067-.057 0-.028-.019-.047-.067-.047m-1.13-1.054c0-.076.066-.152.152-.152s.152.066.152.151c0 .076-.066.152-.152.152s-.152-.066-.152-.152m-.836 5.264h-.874c-.019-.105-.114-.219-.247-.219s-.256.105-.256.257c0 .132.114.275.266.275.104 0 .218-.076.237-.19h.827v.608l-.257.285a.3.3 0 0 0-.095-.019c-.133 0-.256.105-.256.228 0 .133.104.238.237.238.124 0 .247-.105.247-.238a.23.23 0 0 0-.057-.152l.285-.304v-.712c0-.029-.019-.058-.057-.058m-1.121.219a.16.16 0 0 1-.152-.161c0-.077.066-.162.152-.162s.152.066.152.152-.066.171-.152.171m.713 1.14c-.076 0-.143-.066-.143-.143s.066-.133.143-.133.142.067.142.143c0 .066-.066.133-.143.133m5.472-1.377a.24.24 0 0 0-.237.208h-1.13c-.029 0-.038.02-.038.048v.712l-.323.39h-.029a.245.245 0 0 0-.247.247c0 .133.114.256.247.256s.247-.113.247-.256a.26.26 0 0 0-.123-.219l.313-.38v-.674h1.083c.019.105.114.2.238.2.133 0 .266-.105.266-.257 0-.133-.105-.276-.266-.276m-1.758 1.767a.15.15 0 0 1-.143-.152c0-.075.067-.142.143-.142s.152.066.152.143a.15.15 0 0 1-.152.151m1.758-1.33a.15.15 0 0 1-.143-.152.147.147 0 0 1 .294.001.15.15 0 0 1-.152.151M8.917 5.55h-.399a.075.075 0 0 1-.076-.076c0-.028.029-.066.067-.066h.418c.028 0 .066.028.066.066s-.038.076-.076.076m.742 0H9.22c-.038 0-.067-.028-.067-.076 0-.028.029-.066.067-.066h.437c.038 0 .066.028.066.066s-.028.076-.066.076m.883 0h-.598c-.029 0-.067-.028-.067-.076 0-.028.029-.066.067-.066h.598c.028 0 .066.028.066.066s-.028.076-.066.076m-1.282.4h-.741c-.038 0-.076-.029-.076-.067s.028-.076.066-.076h.75c.039 0 .067.038.067.076 0 .029-.028.067-.066.067m.797 0h-.503c-.038 0-.076-.029-.076-.067s.028-.066.066-.066h.513c.038 0 .067.028.067.066 0 .029-.029.067-.067.067m.476 0h-.19c-.039 0-.067-.029-.067-.067s.028-.066.066-.066h.2c.028 0 .066.028.066.066 0 .029-.028.067-.075.067m-1.682.398h-.332c-.039 0-.077-.028-.077-.066s.029-.066.067-.066h.342c.038 0 .076.028.076.066s-.028.066-.076.066m.789 0h-.494c-.038 0-.067-.028-.067-.066s.029-.066.067-.066h.494c.038 0 .066.028.066.066s-.028.066-.066.066m.893 0h-.599c-.038 0-.076-.028-.076-.066s.028-.066.066-.066h.618c.028 0 .066.028.066.066s-.028.066-.076.066m.418.305a.69.69 0 0 0-.674.712c0 .086.019.18.048.257l.085.066c-.028-.085-.057-.171-.057-.304 0-.285.228-.646.598-.646.295 0 .599.228.599.636a.58.58 0 0 1-.599.59.8.8 0 0 1-.237-.048l.123.114a.4.4 0 0 0 .114.01c.39 0 .684-.276.684-.666 0-.313-.266-.712-.684-.722m.353.552-.019-.01-.161.19-.143-.01-.057-.047-.019-.133.19-.2a.28.28 0 0 0-.361.077c-.076.095-.076.209-.038.351l-.247.304.171.152.266-.266c.142.038.285.019.38-.095a.31.31 0 0 0 .038-.313"/></svg>`,"claude-security":`<svg class="file-icon brand-claude" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${Ri}<path class="fg" d="m5.875 10.154 1.376-.772.023-.067-.023-.037h-.067l-.23-.015-.787-.02-.681-.03-.661-.035-.166-.035-.156-.205.016-.103.14-.094.2.018.442.03.665.046.481.028.714.075h.113l.016-.047-.039-.028-.03-.028-.687-.466-.744-.492-.39-.284-.21-.143-.106-.135-.046-.294.19-.21.258.017.065.018.26.2.557.43.726.535.106.089.042-.03.006-.022-.048-.08-.395-.713-.422-.726-.187-.301-.05-.18a1 1 0 0 1-.03-.213l.218-.296.12-.039.29.039.123.106.18.413.293.65.453.884.133.262.07.242.027.075h.046v-.043l.038-.497.069-.611.067-.787.023-.221.11-.266.218-.143.17.081.14.2-.02.13-.083.54-.163.846-.106.567h.062l.07-.07.287-.382.482-.602.213-.239.248-.264.159-.125h.301l.221.329-.099.34-.31.393-.256.333-.369.496-.23.397.021.032.055-.006.832-.177.45-.081.537-.092.243.113.026.115-.096.236-.573.141-.673.135-1.003.237-.012.01.014.017.452.042.193.01h.473l.88.066.23.153.138.186-.023.141-.354.181-.478-.113-1.116-.266-.383-.096h-.053v.032l.32.312.584.528.731.68.037.168-.094.133-.099-.014-.643-.484-.248-.218-.561-.472H9.08v.05l.129.189.684 1.027.035.315-.05.103-.177.062-.194-.036-.4-.561-.413-.632-.333-.567-.041.023-.197 2.116-.092.108-.212.082-.177-.135-.094-.218.094-.43.113-.561.092-.447.083-.554.05-.184-.004-.013-.04.006-.418.574-.636.858-.503.539-.12.048-.21-.108.02-.193.117-.172.696-.886.42-.549.27-.317-.001-.046h-.016l-1.85 1.201-.328.042-.142-.132.018-.218.067-.071.556-.383Z"/></svg>`,"codex-security":`<svg class="file-icon brand-codex" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${Ri}<path class="fg" d="M11.04 8.364a1.72 1.72 0 0 0-.152-1.432 1.8 1.8 0 0 0-1.925-.846 1.8 1.8 0 0 0-.778-.498 1.8 1.8 0 0 0-.927-.05 1.8 1.8 0 0 0-.827.414 1.77 1.77 0 0 0-.507.767 1.8 1.8 0 0 0-.683.297 1.75 1.75 0 0 0-.499.549 1.75 1.75 0 0 0 .22 2.07 1.72 1.72 0 0 0 .151 1.432 1.8 1.8 0 0 0 1.926.846 1.77 1.77 0 0 0 1.333.587c.78 0 1.47-.496 1.707-1.227a1.8 1.8 0 0 0 .684-.298 1.75 1.75 0 0 0 .499-.548 1.75 1.75 0 0 0-.222-2.063m-2.667 3.678a1.33 1.33 0 0 1-.851-.304l.042-.024 1.413-.804a.23.23 0 0 0 .116-.199V8.747l.597.34q.01.005.011.015v1.629a1.323 1.323 0 0 1-1.328 1.31m-2.857-1.203a1.3 1.3 0 0 1-.158-.879l.042.025 1.414.805a.23.23 0 0 0 .23 0l1.729-.982v.68a.02.02 0 0 1-.01.018l-1.431.814a1.34 1.34 0 0 1-1.816-.48m-.372-3.037a1.32 1.32 0 0 1 .7-.574v1.656a.22.22 0 0 0 .114.197l1.72.979-.598.34a.02.02 0 0 1-.021 0L5.63 9.587a1.304 1.304 0 0 1-.487-1.791zm4.907 1.125L8.327 7.94l.596-.34a.02.02 0 0 1 .02 0l1.43.814a1.3 1.3 0 0 1 .512.528 1.3 1.3 0 0 1-.118 1.4 1.33 1.33 0 0 1-.595.436V9.122a.23.23 0 0 0-.12-.195m.594-.881-.042-.025-1.411-.812a.23.23 0 0 0-.232 0l-1.727.983v-.68a.02.02 0 0 1 .008-.018l1.429-.813a1.34 1.34 0 0 1 1.425.061 1.3 1.3 0 0 1 .55 1.298zM6.908 9.252l-.597-.34a.02.02 0 0 1-.012-.016V7.271c0-.249.073-.493.209-.703s.329-.378.557-.483a1.35 1.35 0 0 1 1.415.18l-.042.023-1.413.804a.23.23 0 0 0-.116.2zm.324-.69.77-.438.77.438v.875l-.768.437-.77-.437z"/></svg>`,deepsec:`<svg class="file-icon brand-vercel" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${Ri}<path class="fg" d="m8 5.97 3.5 6.062h-7Z"/></svg>`,piolium:`<svg class="file-icon brand-piolium" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${Ri}<path class="fg" d="M8 6.4 5.6 7.2v2.3c0 1.6 1 2.7 2.4 3.3 1.4-.6 2.4-1.7 2.4-3.3V7.2Z"/></svg>`};function ot(e){let t=di(e);if(t==="deepsec")return"deepsec";if(t==="piolium")return"piolium";if(t==="claude-security")return"claude-security";let r=e.toLowerCase();return r.endsWith(".codex")?"codex-security":r.endsWith(".md")?"claude-security":"default"}function Ue(e){return e.toLowerCase().endsWith(".codex")?e.slice(0,-6).replaceAll("__","/"):e}var Qm=globalThis[Symbol.for("@rray/frontend")];if(!Qm)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");var{LitElement:mI,html:mu,nothing:Zm,unsafeCSS:bI,render:yI,StateElement:vI,classMap:wI,repeat:kI,styleMap:$I}=Qm;var Se={critical:6,high:5,medium:4,low:3,high_bug:2,bug:1,informational:0},_e=["critical","high","medium","low","high_bug","bug","informational"];function cb(e){return e!=null&&e in Se?e:null}function rr(e){return cb(e?.correctedSeverity)??e?.severity}function nr(e){let t=cb(e?.correctedSeverity);return t!=null&&t!==e?.severity}function ne(e,t){return t==="original"?e?.severity:rr(e)}function Ua(e){let t=e?._correctedByReport;return t&&new Set(Object.values(t).map(n=>n?.severity)).size>1?t:null}var u1=["revalidation","refuted","unreachable","confirmed","partial","unknown"],p1=new Set(u1),Mi=!0;function Ha(e){Mi=e!==!1}function vu(){return Mi}function wu(e){let t=typeof e?.revalidate=="string"?e.revalidate.trim().toLowerCase():"";return p1.has(t)?t:""}function gt(e){return Mi?wu(e):""}function db(e){return wu(e)!==""}function ku(e){return wu(e)==="revalidation"}function $u(e){let t=gt(e);return t&&t!=="revalidation"?t:null}function Va(e){return gt(e)==="revalidation"}var f1=new Set(["refuted","unreachable"]);function xu(e){return f1.has(gt(e))}var ub=[{value:"confirmed",label:"Confirmed",kinds:["confirmed","partial","revalidation"]},{value:"unreachable",label:"Unreachable",kinds:["unreachable"]},{value:"refuted",label:"Refuted",kinds:["refuted"]}];function Su(e){return ub.find(t=>t.value===e)?.kinds??null}var ja=["","exclude","only"];function pb(e,t){let r=Su(e);return r?.includes("partial")?t==="only"?["partial"]:t==="exclude"?["confirmed"]:r:r}function fb(e){let t=new Set(e);return ub.filter(r=>r.kinds.some(n=>t.has(n)))}function Wa(e){return new RegExp(`(^|/)${e}/`,"u")}function hb(e){return new RegExp(`^(?:.*/)?${e}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,"u")}var gb=Wa("node_modules"),mb=Wa("vendor"),Ii="node_modules",_u=Wa(Ii),bb=hb(Ii);function h1(e){e!==Ii&&(Ii=e,_u=Wa(e),bb=hb(e))}function yb(e){let t=!1,r=!1,n=o=>(!t&&gb.test(o)&&(t=!0),!r&&mb.test(o)&&(r=!0),t);e:for(let o of e){for(let i of o.groups??[])for(let s of i)if(n(s.file))break e;if(o.tree){for(let i of Object.keys(o.tree))if(n(i))break e}}h1(t?"node_modules":r?"vendor":"dependencies")}function vb(){return Ii}function Er(e){return _u.test(e)}function eb(e){let t=typeof e=="string"?e:"";return gb.test(t)||mb.test(t)||_u.test(t)}var g1=/^(.*(?:^|\/)node_modules\/(?:@[^/]+\/[^/]+|[^/]+))(?:\/|$)/u;function tb(e){return g1.exec(typeof e=="string"?e:"")?.[1]??null}function ie(e){return typeof e!="number"||!Number.isFinite(e)?null:`${e.toLocaleString()} B`}function it(e){if(e.length<=1)return{prefix:"",stripped:[...e]};let t=e.map(s=>s.split("/")),r=Math.min(...t.map(s=>s.length)),n=0;for(let s=0;s<r-1&&t.every(l=>l[s]===t[0][s]);s++)n=s+1;if(n>0&&t[0][n-1].startsWith("@")&&n--,n>0&&t[0][n-1]==="node_modules"&&n--,n===0)return{prefix:"",stripped:[...e]};let o=`${t[0].slice(0,n).join("/")}/`,i=t.map(s=>s.slice(n).join("/"));return{prefix:o,stripped:i}}function m1(e){return e.match(bb)?.[1]??e}function Fe(e,t){if(!e)return e;let r=e;t?.exportsMode==="isolate"&&(r=r.replace(/^\((?:[^()]|\([^()]*\))*\): \[export:\s*\w+\] /u,""),r=r.replace(/^\[export:\s*\w+\] /u,""));let n=[t?.exportName,t?.methodName].filter(Boolean);for(let o of n){let i=o.replaceAll(/[.*+?^${}()|[\]\\]/gu,"\\$&");r=r.replaceAll(new RegExp(`\\[export:\\s*${i}\\]\\s*`,"gu"),"")}for(let o of n){let i=o.replaceAll(/[.*+?^${}()|[\]\\]/gu,"\\$&");r=r.replace(new RegExp(`^\\(\`?${i}\`?\\): `,"u"),"")}return r}function hn(e){let t=e?.exportName,r=e?.methodName;return t&&r&&t!==r?`${t}.${r}`:t||r||""}function wb(e){let t=Mi?[$u(e),e.revalidateVerdict,e.revalidateRecommendation]:[];return[e.file,e.title,e.description,e.impact,e.reproduction,Li(e),e.recommendation,e.confidenceReason,...t,e.discoveredIn,e.repo?.github].filter(Boolean).join(`
56
- `).toLowerCase()}function Fi(e){return e&&e.replace(/^[^/]+\//u,"").replace(/^claude-/u,"").replaceAll("-"," ")}function gn(e){return[e.type,Va(e)?"revalidate":"",Fi(e.model),e.effort,e.exportsMode].filter(Boolean).join(" \xB7 ")}function Ka(e){if(e.length===0)return"";let t=e[0];for(let r=1;r<e.length;r++){for(;t&&!e[r].startsWith(t);)t=t.slice(0,-1);if(!t)return""}return t}function kb(e){if(!e)return null;let t=e.trim().replace(/\/$/u,"");return t?/^https?:\/\//iu.test(t)?t:/^github\.com\//iu.test(t)?`https://${t}`:`https://github.com/${t}`:null}var b1=/^(?:@[\w.-]+\/)?[\w.-]+@[^/\s@]+$/u;function y1(e){return b1.test(e||"")}function v1(e,t,r){if(y1(e))return null;if(t)return`https://github.com/${t}/blob/HEAD/${m1(e)}`;if(Er(e))return null;let n=kb(r);return n?`${n}/blob/HEAD/${e}`:null}function Cu(e,t){let r=e?.file??"",n=Cr(e,t);return n?mu`<a href="${w1(n)}" target="_blank" rel="noopener">${r}</a>`:r}function w1(e){return e.replace(/#L\d+(?:-L?\d+)?$/u,"")}function _t(e){if(typeof e!="string"||e.length===0)return!1;try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function Cr(e,t){if(!e)return null;if(_t(e.location))return e.location;let r=v1(e.file,e.repo?.github,t);if(!r)return null;let n=parseInt(e.line,10);return Number.isFinite(n)?`${r}#L${n}`:r}var k1=/^https?:\/\/(?:www\.)?github\.com\/([^/\s]+\/[^/\s]+)\/(?:blob|tree|blame)\/[^/\s]+\/(\S+)$/u,$1=/#L(\d+)(?:-L?(\d+))?$/u;function $b(e){let t=typeof e=="string"?k1.exec(e):null;if(!t)return"";let r=t[2],n=$1.exec(r);if(!n)return`${t[1]}/${r}`;r=r.slice(0,n.index);let o=n[2]?`${n[1]}-${n[2]}`:n[1];return`${t[1]}/${r}:${o}`}var x1=/^(?:\s+\S|[-*+] |\d+[.)] |>|#{1,6} |\||`{3}|~{3})/u;function xb(e){return e.split(/(\n{2,})/u).map(t=>{if(/^\n+$/u.test(t))return t;let r=t.split(`
57
- `);return r.some(n=>x1.test(n))?t:r.map(n=>n.trim()).filter(Boolean).join(" ")}).join("")}function rb(e,t,r){let n=t?/^\n*/u.exec(e)[0]:"",o=e.slice(n.length),i=r?/\n*$/u.exec(o)[0]:"";return n+xb(o.slice(0,o.length-i.length))+i}function eo(e){if(!e)return e;let t=br(e);if(t.length===0)return xb(e);let r=[],n=0;for(let[o,i]of t)o>n&&r.push(rb(e.slice(n,o),n>0,!0)),r.push(e.slice(o,i)),n=i;return n<e.length&&r.push(rb(e.slice(n),!0,!1)),r.join("")}var S1=/^\*\*([^*\n]+):\*\*[ \t]*/u;function _1(e){let t=br(e);if(t.length===0)return e.split(/\n{2,}/u);let r=[],n=0;for(let o of e.matchAll(/\n{2,}/gu))nn(t,o.index)||(r.push(e.slice(n,o.index)),n=o.index+o[0].length);return r.push(e.slice(n)),r}function Sb(e){let t=[];for(let r of _1(e||"")){if(!r.trim())continue;let n=S1.exec(r);if(n){t.push({label:n[1].trim(),body:r.slice(n[0].length).trim()});continue}let o=t.at(-1);o&&o.label===null?o.body+=`
58
-
59
- ${r}`:t.push({label:null,body:r})}return t}var nb=/^( *)(`{3,}|~{3,})(.*)$/u,C1=/^[a-z0-9+#._-]{1,20}$/u;function _b(e,t){let r=0;for(;r<t&&e[r]===" ";)r++;return e.slice(r)}function E1(e){let t=e.split(`
60
- `),r=nb.exec(t[0]),n=(r?.[2]??"```").slice(0,3),o=(r?.[3]??"").trim().split(/\s+/u)[0].toLowerCase(),s=!!(t.length>1?nb.exec(t.at(-1)):null)?.[2].startsWith(n),l=r?.[1].length??0,d=t.slice(1,s?-1:void 0);return{lang:C1.test(o)?o:"",code:(l>0?d.map(u=>_b(u,l)):d).join(`
61
- `)}}function Eu(e){let t=br(e||"");if(t.length===0)return[e];let r=[],n=0,o=(i,s)=>{let l=(s?i.replace(/^\n+/u,""):i).replace(/\n+$/u,"");l&&r.push(l)};for(let[i,s]of t)i>n&&o(e.slice(n,i),n>0),r.push(E1(e.slice(i,s))),n=s;return n<e.length&&o(e.slice(n),!0),r}var bu=/^( *)(?:[-*+]|(\d{1,9})[.)]) +(?=\S)/u,ob=/^ {0,3}([-*_])(?: *\1){2,} *$/u;function A1(e){return/^ */u.exec(e)[0].length}function ib(e){let t=e.length;for(;t>0&&!e[t-1].trim();)t--;return e.slice(0,t).join(`
62
- `)}function Cb(e){let t=typeof e=="string"?e:"";if(!t)return[e];let r=br(t),n=t.split(`
63
- `),o=[],i=0;for(let f of n)o.push(i),i+=f.length+1;let s=f=>!nn(r,o[f])&&!ob.test(n[f])&&bu.test(n[f]),l=[],d=0,u=0,p=f=>{let h=n.slice(d,f).join(`
64
- `).replace(/^\n+/u,"").replace(/\n+$/u,"");h.trim()&&l.push(h)};for(;u<n.length;){if(!s(u)){u++;continue}p(u);let f=bu.exec(n[u]),h=!!f[2],m=[],b=null,v=!1;for(;u<n.length;){let y=n[u];if(!nn(r,o[u])){if(!y.trim()){b.lines.push(""),v=!0,u++;continue}let w=A1(y),k=ob.test(y)?null:bu.exec(y);if(k&&(!b||w<b.column)){if(!!k[2]!==h)break;b&&m.push(ib(b.lines)),b={column:k[0].length,lines:[y.slice(k[0].length)]},v=!1,u++;continue}if(w<b.column&&v)break}b.lines.push(_b(y,b.column)),v=!1,u++}b&&m.push(ib(b.lines)),l.push({ordered:h,start:h?Number(f[2]):null,items:m}),d=u}return l.length===0?[e]:(p(n.length),l)}var T1=/^(\d+)(?:\s*-\s*(\d+))?$/u;function ht(e){if(typeof e=="number")return Number.isFinite(e)&&e>=1?{start:Math.floor(e),end:Math.floor(e)}:null;let t=T1.exec(String(e??"").trim());if(!t)return null;let r=parseInt(t[1],10),n=t[2]===void 0?r:parseInt(t[2],10);return!Number.isFinite(r)||r<1||!Number.isFinite(n)||n<1?null:{start:Math.min(r,n),end:Math.max(r,n)}}function Eb(e){return e?e.start===e.end?String(e.start):`${e.start}-${e.end}`:""}function R1(e){if(e&&typeof e=="object"){let t=ht(e.start);if(!t)return null;let r=ht(e.end)??t;return{start:t.start,end:Math.max(t.start,r.end)}}return ht(e)}function Ab(e,t,r=4){let n=typeof e=="string"&&e!==""?e.split(`
65
- `):[];if(n.length===0)return{text:"",startLine:1,lines:[]};let o=R1(t),i=o&&{start:Math.min(o.start,n.length),end:Math.min(o.end,n.length)},s=i?Math.max(1,i.start-r):1,l=i?Math.min(n.length,i.end+r):Math.min(n.length,r*2+1),d=n.slice(s-1,l);return{text:d.join(`
66
- `),startLine:s,lines:d}}function I1(e){if(!e)return"";for(let t of e.split(`
67
- `))if(t.trim())return t.trim();return""}function Bi(e){return(typeof e?.title=="string"?e.title.trim():"")||I1(Fe(e?.description,e))}function to(e){let t=Fe(e?.description,e)||"",r=typeof e?.title=="string"?e.title.trim():"";if(r){let i=t.trim(),s=i.indexOf(`
68
- `);return(s<0?i:i.slice(0,s)).trim()!==r?{title:r,body:i}:{title:r,body:s<0?"":i.slice(s+1).replace(/^\s+/u,"")}}if(!t)return{title:"",body:""};let n=t.indexOf(`
69
- `);if(n<0)return{title:"",body:t};if(typeof Eu(t)[0]!="string")return{title:"",body:t};let o=t.slice(n+1).replace(/^\s+/u,"");return o?{title:t.slice(0,n).trim(),body:o}:{title:"",body:t}}function Ga(e){let t=typeof e?.title=="string"?e.title.trim():"";if(!t)return Fe(e?.description,e)||"";let{body:r}=to(e);return r?`${t}
70
-
71
- ${r}`:t}function Tb(e,t,r,n){if(_t(e?.url))return e.url;let o=e?.file;if(typeof o!="string"||o==="")return null;let i=t?.file??"",s=t?.repo?.github,l=()=>s?Cr({file:o,line:e?.line,repo:{github:s}},null):null;if(n===0&&o===i)return l();let d=tb(o);return d!==null&&d===tb(i)?l():eb(o)?null:s&&!eb(i)?l():Cr({file:o,line:e?.line},r)}function qa(e){return Number.isFinite(parseInt(e?.line,10))?`${e.file}:${e.line}`:e?.file??""}function Au(e){let t=r=>typeof r=="string"?r:"";return`${t(e?.observation)}
72
- ${t(e?.text)}`.trim()}function Rb(e,{spaced:t=!1}={}){let r=Array.isArray(e?.evidence)?e.evidence:[];return r.length===0?"":r.map((n,o)=>{let i=qa(n),s=[`${o+1}. ${n.url?`[${i}](${n.url})`:i}`],l=Au(n);if(l)for(let d of l.split(`
73
- `))s.push(` ${d}`);return s.join(`
74
- `)}).join(t?`
79
+ `},Tm=new Map});function pL(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let{id:e}=t;return typeof e=="string"&&e.length>0?e:null}function so(t){let e;try{e=JSON.parse(t)}catch{return null}if(!Array.isArray(e)||e.length===0)return null;let r=[],n=0;for(let o of e){if(!Array.isArray(o))return null;let i=new Set;for(let s of o){let a=pL(s);if(a===null)return null;Sr(a)?i.add(a):n++}i.size>1&&r.push([...i])}return{groups:r,skipped:n}}function p$(t){let e=new Set;for(let r of t)for(let n of r)e.add(n);return e.size}function f$(t,e){for(let r of t)for(let n of r){let o=e.get(n);o||e.set(n,o=new Set);for(let i of r)i!==n&&o.add(i)}return e}var Vt,fu=w(()=>{"use strict";ul();Vt="links"});function mu(){if(xn)return xn;try{xn=JSON.parse(He(h$)||"{}")}catch{xn={}}return fL.has(xn?.__v)?xn.__v=Im:xn={__v:Im},xn}function Lm(){Je(h$,JSON.stringify(xn)).catch(t=>console.warn("counts persist:",t))}function m$(t){if(t==="__v")return;let e=mu()[t];if(e!==void 0)return typeof e=="number"?{count:e}:e}function fl(t){return m$(t)?.count}function ao(t){return m$(t)?.source}function Tt(t,e,r){let n=mu();n[t]={count:e,source:r??null},Lm()}function ks(t){let e=mu();delete e[t],Lm()}function _t(t){let e=so(t);return e?{count:p$(e.groups),source:Vt,recognized:!0}:r$(t)}function hL(t,e){for(let{names:r,onUpdate:n}of hu)if(r.has(t))try{n(t,e)}catch(o){console.warn("ensureCounts onUpdate:",o)}}function Fm(t,e){if(pl){e&&hu.push({names:new Set(t),onUpdate:e});for(let r of t)ws.add(r);return pl}return ws=new Set(t),hu=e?[{names:new Set(t),onUpdate:e}]:[],pl=(async()=>{await Promise.resolve();try{let r=mu();for(;ws.size>0;){let n=ws.values().next().value;if(ws.delete(n),r[n]===void 0)try{let o=await Le(n);if(r[n]!==void 0)continue;let{count:i,source:s}=_t(o);r[n]=s?{count:i,source:s}:{count:i},Lm(),hL(n,i)}catch{}}}finally{pl=null,ws=null,hu=null}})(),pl}var h$,Im,fL,xn,pl,ws,hu,xs=w(()=>{"use strict";wr();Oe();fu();gn();h$="deepview.fileCounts",Im=4,fL=new Set([3,Im]),xn=null;pl=null,ws=null,hu=null});async function hl(t){let e=Uint8Array.fromBase64(t),r=ge(mL),n=new Uint8Array(r.length+e.length);n.set(r,0),n.set(e,r.length);let o=new Uint8Array(await crypto.subtle.digest("SHA-256",n)),s=Array.from(o.subarray(0,16),u=>u.toString(16).padStart(2,"0")).join("").split("");s[12]="8";let a=parseInt(s[16],16)&3|8;s[16]=a.toString(16);let c=s.join("");return`${c.slice(0,8)}-${c.slice(8,12)}-${c.slice(12,16)}-${c.slice(16,20)}-${c.slice(20,32)}`}var mL,Bm=w(()=>{"use strict";gt();mL=`deepview/workspace-id/v1
80
+ `});function ml(t){let e=new Set;function r(o){return e.add(o),()=>e.delete(o)}function n(o){for(let i of e)try{i(o)}catch(s){console.warn(`workspace ${t} listener failed:`,s)}}return{on:r,fire:n}}var g$,b$,y$,v$,w$,gL,Om,Pm,Nm,Dm,gu,zm,Um,bu,yu,k$=w(()=>{"use strict";g$=ml("create"),b$=ml("delete"),y$=ml("privateKey"),v$=ml("report-membership"),w$=ml("bundle-membership"),gL=g$.on,Om=b$.on,Pm=y$.on,Nm=v$.on,Dm=w$.on,gu=g$.fire,zm=b$.fire,Um=y$.fire,bu=v$.fire,yu=w$.fire});function gl(){try{let t=He(jm);if(!t)return[];let e=JSON.parse(t);return e&&typeof e=="object"&&Array.isArray(e.workspaces)?e.workspaces:Array.isArray(e)?e:[]}catch{return[]}}async function yL(t){await Je(jm,JSON.stringify({version:bL,workspaces:t}))}function $s(t){return navigator.locks.request(vL,async()=>{await Br();let e=gl(),r=await t(e);if(r!==!1)return await yL(e),r})}function bl(t){return{id:t.id,privateKey:t.privateKey,reports:Array.isArray(t.reports)?[...t.reports]:[],bundles:Array.isArray(t.bundles)?[...t.bundles]:[]}}function yl(){Cr=gl().map(bl)}function Vm(t){Cr=Cr.filter(e=>e.id!==t.id),Cr.push(bl(t))}function wL(t,e){let r=Array.isArray(t[e])?[...t[e]]:[],n=Cr.find(o=>o.id===t.id);if(n){n[e]=r;return}Cr.push(bl(t))}function kL(t){Cr=Cr.filter(e=>e.id!==t)}function re(){let t=gl();for(let e of t)Array.isArray(e.reports)||(e.reports=[]),Array.isArray(e.bundles)||(e.bundles=[]);return t}function Vr(t){let e=(t??"").trim();return e&&e.replaceAll(/[\u0000-\u001F\u007F]/gu,"").slice(0,xL)||null}async function Wm(t){let e=Vr(t);if(!e)return null;let r=new Uint8Array(32);crypto.getRandomValues(r);let n=r.toBase64(),o={id:await hl(n),name:e,privateKey:n,reports:[],bundles:[],createdAt:Date.now()};return await $s(s=>s.some(a=>a.id===o.id)?!1:(s.push(o),o))?(Vm(o),o):null}async function Km(t){await $s(r=>{let n=r.findIndex(o=>o.id===t);return n<0?!1:(r.splice(n,1),!0)})&&(zm(t),kL(t))}async function Gm(t,e){let r=Vr(e);return!(!r||!await $s(o=>{let i=o.find(s=>s.id===t);return!i||i.name===r?!1:(i.name=r,i)}))}async function x$(t){let e=await $s(o=>{let i=o.findIndex(p=>p.id===t.id),s=i>=0?o[i]:null,a=Vr(t.name)??s?.name??"Workspace",c=t.preserveBundles?Array.isArray(s?.bundles)?s.bundles:[]:Array.isArray(t.bundles)?t.bundles:[],u={id:t.id,name:a,privateKey:t.privateKey,reports:Array.isArray(t.reports)?[...new Set(t.reports)]:[],bundles:[...new Set(c)],createdAt:t.createdAt??Date.now()};return i>=0?o[i]=u:o.push(u),{previous:s,next:u}}),{next:r}=e,n=Cr.find(o=>o.id===r.id)??null;return n==null?gu(r.id):(n.privateKey!==r.privateKey&&Um(r.id),vu(n.reports,r.reports)||bu(r.id),vu(n.bundles,r.bundles)||yu(r.id)),Vm(r),r}async function qm({id:t,name:e,privateKey:r,createdAt:n}){let o=null;return await $s(i=>{let s=Vr(e);if(!s)return o={status:"name-collision",existing:null},!1;let a=i.find(p=>p.id===t)??null;if(a)return o={status:"already-attached",workspace:a},!1;let c=i.find(p=>Vr(p.name)===s)??null;if(c)return o={status:"name-collision",existing:c},!1;let u={id:t,name:s,privateKey:r,reports:[],bundles:[],createdAt:n??Date.now()};i.push(u),o={status:"attached",workspace:u}}),o?.status==="attached"&&(gu(o.workspace.id),Vm(o.workspace)),o}function vu(t,e){let r=new Set(t),n=new Set(e);if(r.size!==n.size)return!1;for(let o of r)if(!n.has(o))return!1;return!0}async function Hm({identifier:t,workspaceId:e,field:r,fire:n,additive:o=!1,from:i=void 0}){let s=await $s(u=>{if((u.find(y=>Array.isArray(y[r])&&y[r].includes(t))?.id??null)===(e??null))return!1;let f=null;if(e!=null&&(f=u.find(y=>y.id===e)??null,!f))return!1;let h=new Set;if(!o)for(let y of u)i!==void 0&&y.id!==i||(Array.isArray(y[r])||(y[r]=[]),y[r].includes(t)&&(y[r]=y[r].filter(b=>b!==t),h.add(y.id)));if(f&&(Array.isArray(f[r])||(f[r]=[]),f[r].includes(t)||(f[r].push(t),h.add(f.id))),h.size===0)return!1;let g=new Map;for(let y of h){let b=u.find(v=>v.id===y);b&&g.set(y,b)}return{affected:h,snapshot:g}});if(!s)return;let{affected:a,snapshot:c}=s;for(let u of a){n(u);let p=c.get(u);p&&wL(p,r)}}function $$(t,e){return{move:(r,n)=>Hm({identifier:r,workspaceId:n,field:t,fire:e}),add:(r,n)=>Hm({identifier:r,workspaceId:n,field:t,fire:e,additive:!0}),remove:(r,n)=>Hm({identifier:r,field:t,fire:e,from:n})}}function $L(){let t=gl().map(bl),e=Cr,r=new Map(e.map(o=>[o.id,o])),n=new Map(t.map(o=>[o.id,o]));for(let o of r.keys())n.has(o)||zm(o);for(let[o,i]of n){let s=r.get(o);if(!s){gu(o);continue}s.privateKey!==i.privateKey&&Um(o),vu(s.reports,i.reports)||bu(o),vu(s.bundles,i.bundles)||yu(o)}Cr=t}var jm,bL,vL,Cr,xL,Ym,Xm,vl,$n,wl,Jm,ki,Zm,xi=w(()=>{"use strict";Bm();gn();k$();jm="deepview.workspaces",bL=1;vL=jm;Cr=gl().map(bl);xL=200;Ym=$$("reports",bu),Xm=$$("bundles",yu),vl=Ym.move,$n=Ym.add,wl=Ym.remove,Jm=Xm.move,ki=Xm.add,Zm=Xm.remove;Xn(()=>{$L()})});async function Qm(t){if(!t)return null;let e=re(),n=(await Promise.all(e.map(o=>jt("workspace",o.id)))).indexOf(t);return n===-1?null:e[n]}async function eg(t){if(!t)return null;let e=await pe(),n=(await Promise.all(e.map(o=>jt("report",o)))).indexOf(t);return n===-1?null:e[n]}async function _L(t,e){let r;try{r=await Le(t)}catch{return!1}return r==null?!1:(await Ht(r))?.findings.some(o=>o.id===e)??!1}async function tg(t,{skip:e=[]}={}){if(!t)return null;let r=new Set(e),n=(await pe()).filter(o=>!r.has(o));for(let o of n)if(await _L(o,t))return o;return null}function kl(t){return t?re().filter(e=>e.reports.includes(t)):[]}var _$=w(()=>{"use strict";ul();wr();xi();Oe()});function rg(t){if(!t)return"";for(let e of t.split(`
81
+ `))if(e.trim())return e.trim();return""}function ng(t){let e=new Set(t.map(n=>n.id)),r=new Map;for(let n of l.reports)for(let o of n.groups)for(let i of o){let s=i.id??String(i._id);if(!(!e.has(s)||r.has(s))&&(r.set(s,{severity:i.severity,file:i.file,line:i.line,description:rg(i.description)}),r.size===e.size))return r}return r}var og=w(()=>{"use strict";xr()});function ag(t){return ig.add(t),()=>ig.delete(t)}function S$(){for(let t of ig)try{t()}catch(e){console.warn("linked-findings listener:",e)}}function C$(){let t=new Map;for(let e of _s.values())e&&f$(e.groups,t);sg=t}function $l(){return sg.size>0}function $i(t){let e=sg.get(t);return e?[...e]:[]}async function SL(t){if(_s.has(t))return!1;let e=ao(t);if(e===void 0)return!1;if(e!==Vt)return _s.set(t,null),!1;let r=wu.get(t)??0,n;try{n=await Le(t)}catch{return!1}if(n==null)return!1;if((wu.get(t)??0)!==r)return ku=!0,!1;let o=so(n);return _s.set(t,o),o!==null}function lg(){return xl||(xl=(async()=>{try{do{ku=!1;let t=!1;for(let e of await pe())await SL(e)&&(t=!0);t&&(C$(),S$())}while(ku)}finally{xl=null}})(),xl)}var _s,sg,wu,ig,xl,ku,E$=w(()=>{"use strict";fu();wr();xs();_s=new Map,sg=new Map,wu=new Map,ig=new Set,xl=null,ku=!1;Qo(t=>{wu.set(t,(wu.get(t)??0)+1),ku=!0;let e=_s.get(t)!=null;_s.delete(t),e&&(C$(),S$())})});function R$(t){return t==="inprogress"||t==="fixed"||t==="invalid"||t==="deleted"?t:void 0}function Pe(t){if(t)return R$(t.triage)??(t.deleted?"deleted":void 0)}function CL(t){return t?!t.color&&!Pe(t)&&!t.comment&&!t.fix&&!(t.ignoredReports&&t.ignoredReports.length>0)&&t.flagged===void 0:!0}function _n(t,e,r){let n=t.get(e)?.ignoredReports;return Array.isArray(n)&&n.includes(r)}function Ss(t){if(!t||typeof t!="object")return;let e=t,r={};typeof e.color=="string"&&e.color&&(r.color=e.color);let n=R$(e.triage)??(e.deleted?"deleted":void 0);if(n&&(r.triage=n),typeof e.comment=="string"&&e.comment&&(r.comment=e.comment),typeof e.fix=="string"&&e.fix&&(r.fix=e.fix),typeof e.flagged=="boolean"&&(r.flagged=e.flagged),Array.isArray(e.ignoredReports)){let o=e.ignoredReports.filter(i=>typeof i=="string"&&i.length>0);o.length>0&&(r.ignoredReports=o)}return CL(r)?void 0:r}function EL(t,e){let r=t??[],n=e??[];if(r.length!==n.length)return!1;if(r.length===0)return!0;let o=new Set(r);for(let i of n)if(!o.has(i))return!1;return!0}function A$(t,e){let r=t??{},n=e??{};return(r.color??"")===(n.color??"")&&(Pe(r)??"")===(Pe(n)??"")&&(r.comment??"")===(n.comment??"")&&(r.fix??"")===(n.fix??"")&&r.flagged===n.flagged&&EL(r.ignoredReports,n.ignoredReports)}function G(t,e,r){let n=t.get(e),o=Ss({...n,...r});return o===void 0?t.delete(e):A$(n,o)?!1:(t.set(e,o),!0)}function cg(t,e,r){let n=Ss(r),o=t.get(e);return n===void 0?t.delete(e):A$(o,n)?!1:(t.set(e,n),!0)}function pt(t,e,r,n){let o=new Set(t.get(e)?.ignoredReports??[]);return n?o.add(r):o.delete(r),G(t,e,{ignoredReports:o.size>0?[...o]:void 0})}var lo=w(()=>{"use strict"});function ug(t){dg=typeof t=="function"?t:()=>{}}function pg(t){M$=typeof t=="function"?t:()=>{}}function fg(t){I$=typeof t=="function"?t:()=>{}}async function RL(t){let e=new Blob([t]).stream().pipeThrough(new CompressionStream("deflate"));return new Uint8Array(await new Response(e).arrayBuffer())}async function AL(t){let e=new Blob([t]).stream().pipeThrough(new DecompressionStream("deflate"));return new Uint8Array(await new Response(e).arrayBuffer())}function hg(){let t={};for(let[e,r]of l.triage){if(Wr.test(e))continue;let n=Ss(r);n&&(t[e]=n)}return t}function we(){if(D())return M$(),Promise.resolve();let t=++T$,e=hg(),r=Object.keys(e).length===0,n=r?null:JSON.stringify(e);if(n!=null)try{localStorage.setItem(Sn,n)}catch{}return navigator.locks.request(At,{mode:"shared"},async()=>{let o=null,i=null;if(n!=null)try{let s=ge(n),a=await RL(s);i=et(),o=(i?await N0(a):a).toBase64()}catch(s){console.warn("Failed to save triage:",s),dg();return}await navigator.locks.request(TL,()=>{try{if(t!==T$)return;if(n!=null&&et()!==i){queueMicrotask(()=>{we()});return}if(r)localStorage.removeItem(co),localStorage.removeItem(Sn);else{localStorage.setItem(co,o);try{localStorage.removeItem(Sn)}catch{}}}catch(s){console.warn("Failed to save triage:",s)}}),dg()})}async function L$(){let t=localStorage.getItem(Sn);if(t)try{return JSON.parse(t)}catch{}let e=localStorage.getItem(co);if(!e)return null;let r=Uint8Array.fromBase64(e);if(wt(r)){if(!et())throw new Error("triage: vault locked, cannot decrypt envelope");r=await D0(r)}let n=await AL(r);return JSON.parse(Ve(n))}function F$(t,{replace:e=!1}={}){let r=l.triage;if(e){let n=null,o=localStorage.getItem(Sn);if(o)try{n=JSON.parse(o)}catch{}let i=s=>n!=null&&s in n;for(let s of[...r.keys()]){if(Wr.test(s))continue;let a=t?.[s],c=!t||!(s in t);!(i(s)&&n[s]?.color)&&(c||!a?.color)&&G(r,s,{color:void 0}),!(i(s)&&(n[s]?.triage||n[s]?.deleted))&&!Pe(a)&&G(r,s,{triage:void 0}),!(i(s)&&n[s]?.comment)&&(c||typeof a?.comment!="string"||!a.comment)&&G(r,s,{comment:void 0}),!(i(s)&&n[s]?.fix)&&(c||typeof a?.fix!="string"||!a.fix)&&G(r,s,{fix:void 0}),!(i(s)&&n[s]?.flagged!==void 0)&&(c||a?.flagged===void 0)&&G(r,s,{flagged:void 0})}for(let s of[...r.keys()]){if(Wr.test(s))continue;let a=r.get(s)?.ignoredReports;if(!a||a.length===0)continue;let c=t?.[s],u=!!Pe(c);for(let p of[...a]){if(i(s)&&Array.isArray(n[s]?.ignoredReports)&&n[s].ignoredReports.includes(p))continue;if(u){pt(r,s,p,!1);continue}let f=c?.ignoredReports;(!Array.isArray(f)||!f.includes(p))&&pt(r,s,p,!1)}}}if(t)for(let[n,o]of Object.entries(t)){let i=Pe(o),s={};if(o&&o.color&&(s.color=o.color),i&&(s.triage=i),o&&typeof o.comment=="string"&&o.comment&&(s.comment=o.comment),o&&typeof o.fix=="string"&&o.fix&&(s.fix=o.fix),o&&typeof o.flagged=="boolean"&&(s.flagged=o.flagged),Object.keys(s).length>0&&G(r,n,s),!i&&o&&Array.isArray(o.ignoredReports)){let a=new Set(r.get(n)?.ignoredReports??[]),c=!1;for(let u of o.ignoredReports)typeof u=="string"&&!a.has(u)&&(a.add(u),c=!0);c&&G(r,n,{ignoredReports:[...a]})}}}async function ML(){if(!D())try{let t=await L$();if(D())return;F$(t)}catch(t){console.warn("Failed to load triage:",t)}}async function _l(){if(!D())try{let t=await L$();if(D())return;F$(t,{replace:!0}),I$()}catch(t){console.warn("Failed to reload triage:",t)}}function _i(){return D()?Promise.resolve():IL??=ML()}async function mg({seal:t}){try{localStorage.removeItem(Sn)}catch{}let e=localStorage.getItem(co);if(!e)return;let r=Uint8Array.fromBase64(e);if(wt(r))return;let n=await t(r,Ma());localStorage.setItem(co,n.toBase64())}async function gg({open:t}){try{localStorage.removeItem(Sn)}catch{}let e=localStorage.getItem(co);if(!e)return;let r=Uint8Array.fromBase64(e);if(!wt(r))return;let n=await t(r,Ma());localStorage.setItem(co,n.toBase64())}var dg,M$,I$,co,Sn,Wr,TL,T$,IL,Si=w(()=>{"use strict";xr();gt();lo();Ca();dg=()=>{};M$=()=>{};I$=()=>{};co="deepview.triage",Sn="deepview.triage.pending",Wr=/^\d+$/u;TL="deepview.triage.save",T$=0;typeof window<"u"&&window.addEventListener("storage",t=>{t.key!==co&&t.key!==Sn||_l()});tt(()=>{_l()});tt(()=>{D()||et()&&localStorage.getItem(Sn)&&we()})});function xu(t,e){return e?`r:${JSON.stringify({name:t,workspaceId:e})}`:t}function $u(t){if(typeof t!="string"||!t)return null;if(t.startsWith("r:"))try{let e=JSON.parse(t.slice(2));if(e&&typeof e.name=="string"&&e.name&&typeof e.workspaceId=="string"&&e.workspaceId)return{name:e.name,workspaceId:e.workspaceId}}catch{}return{name:t,workspaceId:null}}var _u=w(()=>{"use strict"});function bg(){return Sl||(Sl=LL(),Sl.catch(()=>{Sl=null})),Sl}async function LL(){try{await _i()}catch{}let t=await pe(),e=new Set(t),r=new Set(t),n=new Set;for(let o of t){if(!o.toLowerCase().endsWith(".deepseek"))continue;let i=o.slice(0,-9)+".md";if(e.has(i))continue;let s;try{s=await Le(o),await nr(i,s),await is(o)}catch(f){console.warn(`migrate: failed to rename ${o} -> ${i}`,f);continue}e.delete(o),e.add(i),n.add(o);let a=fl(o);if(ks(o),a===void 0){let{count:f,source:h}=_t(s);Tt(i,f,h)}else{let{source:f}=_t(s);Tt(i,a,f)}let c=xt(o);c&&(kr(o,""),kr(i,c));let u=!1;for(let[f,h]of[...l.triage])h.ignoredReports?.includes(o)&&(pt(l.triage,f,o,!1),pt(l.triage,f,i,!0),u=!0);u&&await we();let p=$u(He(B$));if(p?.name===o)try{await Je(B$,xu(i,p.workspaceId))}catch{}}for(let o of re())for(let i of o.reports){if(!i.toLowerCase().endsWith(".deepseek")||!n.has(i)&&r.has(i))continue;let s=i.slice(0,-9)+".md";await wl(i,o.id),await $n(s,o.id)}}var B$,Sl,O$=w(()=>{"use strict";wr();xs();xi();xr();Si();gn();lo();_u();B$="deepview.lastFile",Sl=null});function P$(){return typeof navigator<"u"&&typeof navigator.storage=="object"&&navigator.storage!==null}async function Cs(){if(!P$()||typeof navigator.storage.persist!="function")return!1;try{return await navigator.storage.persist()===!0}catch{return!1}}async function yg(){let t={supported:P$(),persisted:null,usage:null,quota:null};if(!t.supported)return t;if(typeof navigator.storage.persisted=="function")try{t.persisted=await navigator.storage.persisted()}catch{}if(typeof navigator.storage.estimate=="function")try{let e=await navigator.storage.estimate();typeof e?.usage=="number"&&(t.usage=e.usage),typeof e?.quota=="number"&&(t.quota=e.quota)}catch{}return t}var N$=w(()=>{"use strict"});function D$(){for(let t of vg)t()}function Es(){return He(Su)!=null}function wg(t){try{let e=JSON.parse(He(Su)),r=e?.provider==="moonshotai"?"moonshot":e?.provider;return!t||e?.server!==t||typeof e.deepview!="string"||!e.deepview.trim()||![null,"anthropic","openai","moonshot","openrouter"].includes(r)||typeof e.token!="string"?null:{...e,provider:r}}catch{return null}}async function kg({server:t,deepview:e,provider:r,token:n}){await Je(Su,JSON.stringify({server:t,deepview:e,provider:r,token:n})),D$()}async function xg(){await Jn(Su),D$()}function $g(t){vg.add(t);let e=Xn(t);return()=>{vg.delete(t),e()}}var Su,vg,z$=w(()=>{"use strict";gn();Su="deepview.scan.access",vg=new Set});function FL(){let t=hg(),e=Kd();return{version:_g,exportedAt:new Date().toISOString(),triage:t,repoUrls:e}}function BL(){return`deepview-triage-${new Date().toISOString().replaceAll(/[:.]/gu,"-").slice(0,19)}.json.gz`}async function Sg(){let t=FL();return{blob:new Blob([await $a(JSON.stringify(t))]),filename:BL()}}async function Cg(t){let e;try{e=await qo(new Uint8Array(await t.arrayBuffer()))}catch(n){throw new Error(`Failed to gunzip: ${n.message}`,{cause:n})}let r;try{r=JSON.parse(e)}catch(n){throw new Error(`Failed to parse JSON: ${n.message}`,{cause:n})}if(!r||typeof r!="object")throw new Error("Invalid backup file (not an object)");if(r.version!==_g)throw new Error(`Unsupported backup version: ${r.version} (expected ${_g})`);if(!r.triage||typeof r.triage!="object")throw new Error("Backup is missing the `triage` map");if(!r.repoUrls||typeof r.repoUrls!="object")throw new Error("Backup is missing the `repoUrls` map");return r}async function Eg(t,e){if(!["replace","prefer-imported","prefer-current"].includes(e))throw new Error(`Unknown merge mode: ${e}`);if(!t||typeof t!="object")throw new Error("Invalid payload: not an object");if(!t.triage||typeof t.triage!="object"||Array.isArray(t.triage))throw new Error("Invalid payload: missing or non-object `triage`");if(!t.repoUrls||typeof t.repoUrls!="object"||Array.isArray(t.repoUrls))throw new Error("Invalid payload: missing or non-object `repoUrls`");let r=t.triage,n=l.triage;if(e==="replace")for(let a of[...n.keys()])Wr.test(a)||n.delete(a);let o=e==="prefer-current";for(let[a,c]of Object.entries(r)){if(Wr.test(a)||!c||typeof c!="object")continue;typeof c.color=="string"&&c.color&&(!o||!n.get(a)?.color)&&G(n,a,{color:c.color});let u=Pe(c);if(u&&(!o||!Pe(n.get(a)))&&G(n,a,{triage:u}),typeof c.comment=="string"&&c.comment&&(!o||!n.get(a)?.comment)&&G(n,a,{comment:c.comment}),typeof c.fix=="string"&&c.fix&&(!o||!n.get(a)?.fix)&&G(n,a,{fix:c.fix}),typeof c.flagged=="boolean"&&(!o||n.get(a)?.flagged===void 0)&&G(n,a,{flagged:c.flagged}),Array.isArray(c.ignoredReports)&&!Pe(n.get(a)))for(let p of c.ignoredReports)typeof p=="string"&&(o&&_n(n,a,p)||pt(n,a,p,!0))}await we();let i=0,s=null;try{await ex(t.repoUrls,e),i=Object.keys(t.repoUrls).length}catch(a){console.warn("applyTriageImport: repo-URL import failed:",a),s=a}return{triageEntries:Object.keys(r).length,repoUrls:i,repoUrlError:s}}var _g,U$=w(()=>{"use strict";es();lo();xr();Si();_g=1});function OL(t){return t?.name==="NotFoundError"||typeof t?.message=="string"&&t.message.startsWith("File not found:")}async function Rg(t){let e=new Set;for(let r of t){let n;try{n=await Le(r)}catch(i){if(OL(i))continue;throw new Error(`Failed to read ${r}: ${i.message}`,{cause:i})}if(n==null)continue;let o=await Ht(n);if(o)for(let i of o.findings)i.id&&e.add(i.id)}return e}function PL(){let t=new Set;for(let e of l.triage.keys())Wr.test(e)||t.add(e);return t}async function Cu(t){let e=PL();if(e.size===0)return{orphanedCount:0,sharedCount:0};let r=await Rg(t),n=new Set;for(let p of e)r.has(p)&&n.add(p);if(n.size===0)return{orphanedCount:0,sharedCount:0};let o=await pe(),i=new Set(t),s=o.filter(p=>!i.has(p)),a=await Rg(s),c=0,u=0;for(let p of n)a.has(p)?u++:c++;return{orphanedCount:c,sharedCount:u}}async function Eu(){let t=new Set(l.triage.keys()),e=[];for(let[s,a]of l.triage)if(a.ignoredReports)for(let c of a.ignoredReports)e.push({id:s,report:c});let r=await pe(),n=new Set(r),o=await Rg(r),i=!1;for(let s of t){if(Wr.test(s)||o.has(s))continue;let a=l.triage.get(s);!a||!(a.color||Pe(a)||a.comment||a.fix||a.flagged!==void 0)||G(l.triage,s,{color:void 0,triage:void 0,comment:void 0,fix:void 0,flagged:void 0,deleted:void 0})&&(i=!0)}for(let{id:s,report:a}of e)Wr.test(s)||o.has(s)&&n.has(a)||_n(l.triage,s,a)&&pt(l.triage,s,a,!1)&&(i=!0);i&&await we()}var H$=w(()=>{"use strict";xr();lo();Si();wr();Oe()});var j$=w(()=>{"use strict"});async function K$(t,e){let r=await crypto.subtle.importKey("raw",ge(t),"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",hash:"SHA-256",salt:e,iterations:3e6},r,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}function G$(t){return!(t instanceof Uint8Array)||t.length<W$?!1:t[0]===Ag}async function Ru(t,e){if(!(t instanceof Uint8Array))throw new TypeError("encryptWithPassword: plaintext Uint8Array required");if(typeof e!="string"||!e)throw new TypeError("encryptWithPassword: password required");let r=new Uint8Array(uo+t.length+16);r[0]=Ag,crypto.getRandomValues(r.subarray(1,1+po)),crypto.getRandomValues(r.subarray(1+po,uo));let n=r.subarray(1,1+po),o=r.subarray(1+po,uo),i=await K$(e,n),s=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:o,additionalData:r.subarray(0,uo)},i,t));return r.set(s,uo),r}async function DL(t,e){if(typeof e!="string"||!e)throw new TypeError("tryDecryptWithPassword: password required");if(!(t instanceof Uint8Array)||t.length<W$)return{ok:!1,reason:"malformed"};if(t[0]!==Ag)return{ok:!1,reason:"malformed"};let r=t.subarray(1,1+po),n=t.subarray(1+po,uo),o=t.subarray(uo),i=await K$(e,r),s;try{s=new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:t.subarray(0,uo)},i,o))}catch{return{ok:!1,reason:"wrong-password"}}return{ok:!0,plaintext:s}}async function Au(t,e,r){if(!r||typeof r.malformedMsg!="string"||typeof r.wrongPasswordMsg!="string")throw new TypeError("decryptWithPasswordOrThrow: { malformedMsg, wrongPasswordMsg } strings required");let n=await DL(t,e);if(n.ok)return n.plaintext;throw n.reason==="wrong-password"?new Error(r.wrongPasswordMsg):new Error(r.malformedMsg)}var Ag,po,V$,W$,uo,Tg=w(()=>{"use strict";gt();j$();Ag=1,po=16,V$=12,W$=1+po+V$+16,uo=1+po+V$});function Y$(t,e){return Au(t,e,{malformedMsg:"malformed encrypted bundle",wrongPasswordMsg:"wrong password or corrupt bundle"})}var Cl,q$,El=w(()=>{"use strict";Tg();Cl=G$,q$=Ru});async function UL(t){let e=new Set,r=await Ht(t);for(let n of r?.findings??[])n.id&&e.add(n.id);return e}function Mg(t){return(t??"").replaceAll(/[^a-zA-Z0-9._-]+/gu,"_").replaceAll(/^_+|_+$/gu,"")||"workspace"}async function HL(t){if(!Array.isArray(t)||t.length===0)return[];let e=await Dt(),r=new Map(e.map(o=>[o.integrity,o.name])),n=[];for(let o of t){let i=r.get(o);if(!i)continue;let s;try{s=await bn(o)}catch(a){console.warn(`Workspace export: failed to read bundle ${o}: ${a?.message??a}`);continue}n.push({integrity:o,name:i,data:s.toBase64()})}return n}function jL(t){let e=xt(t);return e?{github:e}:null}async function X$(t){let e=[];for(let r of t.reports??[]){let n;try{n=await Le(r)}catch(i){console.warn(`Workspace export: skipping ${r}: ${i?.message??i}`),(i instanceof DOMException&&i.name==="NotFoundError"||typeof i?.message=="string"&&i.message.startsWith("File not found:"))&&await vl(r,null);continue}let o=jL(r);e.push(o?{name:r,content:n,repo:o}:{name:r,content:n})}return e}async function VL(t,{includeBundleBytes:e=!1}={}){let r=await X$(t),n=new Set;for(let u of r)for(let p of await UL(u.content))n.add(p);let o=new Set(t.reports??[]),i={};for(let[u,p]of l.triage){if(!n.has(u))continue;let f=(p.ignoredReports??[]).filter(g=>o.has(g)),h=Ss({...p,ignoredReports:f});h&&(i[u]=h)}let s={};for(let u of r)u.repo?.github&&(s[u.name]=u.repo.github);let a=(t.bundles??[]).filter(u=>typeof u=="string"&&u.length>0),c={version:zL,exportedAt:new Date().toISOString(),workspace:{id:t.id,name:t.name,privateKey:t.privateKey,createdAt:t.createdAt},reports:r,bundles:a,repoUrls:s,triage:i};if(e){let u=await HL(a);u.length>0&&(c.bundleBlobs=u)}return c}async function J$(t,{includeBundleBytes:e=!1}={}){let r=await VL(t,{includeBundleBytes:e});return{blob:new Blob([await $a(JSON.stringify(r))]),filename:`${Mg(t.name)}.deepview-workspace.json.gz`}}async function WL(t,e,{includeBundleBytes:r=!1}={}){if(typeof e!="string"||!e)throw new TypeError("buildWorkspaceExportEncrypted: password required");let{blob:n}=await J$(t,{includeBundleBytes:r}),o=new Uint8Array(await n.arrayBuffer()),i=await q$(o,e);return{blob:new Blob([i],{type:"application/octet-stream"}),filename:`${Mg(t.name)}.deepview-workspace.enc`}}async function Ig(t,{password:e,includeBundleBytes:r=!1}={}){return typeof e=="string"&&e?await WL(t,e,{includeBundleBytes:r}):await J$(t,{includeBundleBytes:r})}async function KL(t){return{reports:await X$(t)}}async function Lg(t){let e=await KL(t);return{blob:new Blob([await $a(JSON.stringify(e))]),filename:`${Mg(t.name)}.deepview-reports.json.gz`}}var zL,Z$=w(()=>{"use strict";xr();lo();wr();xi();Oe();es();El();zL=1});function YL(t){if(!t||typeof t!="object")return"payload is not an object";if(t.version!==GL)return`unsupported export version: ${t.version}`;if(!t.workspace||typeof t.workspace!="object")return"workspace metadata missing";if(typeof t.workspace.id!="string")return"workspace.id must be a string";if(typeof t.workspace.name!="string")return"workspace.name must be a string";if(typeof t.workspace.privateKey!="string")return"workspace.privateKey must be a string";if(t.workspace.createdAt!==void 0&&!Number.isFinite(t.workspace.createdAt))return"workspace.createdAt must be a finite number or omitted";if(!Array.isArray(t.reports))return"reports field must be an array";if(t.reports.length>Rl)return`reports count (${t.reports.length}) exceeds cap (${Rl})`;if(t.bundles!==void 0){if(!Array.isArray(t.bundles))return"bundles field must be an array when present";if(t.bundles.length>Q$)return`bundles count (${t.bundles.length}) exceeds cap (${Q$})`;for(let e of t.bundles){if(typeof e!="string")return"bundles entries must be strings";if(e.length>Tu)return`bundle integrity exceeds per-entry length cap (${Tu})`}}if(t.bundleBlobs!==void 0){if(!Array.isArray(t.bundleBlobs))return"bundleBlobs field must be an array when present";if(t.bundleBlobs.length>t1)return`bundleBlobs count (${t.bundleBlobs.length}) exceeds cap (${t1})`;for(let e of t.bundleBlobs){if(!e||typeof e!="object"||Array.isArray(e))return"bundleBlobs entries must be objects";if(typeof e.integrity!="string"||e.integrity.length===0)return"bundleBlobs.integrity must be a non-empty string";if(e.integrity.length>Tu)return`bundleBlobs.integrity exceeds per-entry length cap (${Tu})`;if(typeof e.name!="string"||e.name.length===0)return"bundleBlobs.name must be a non-empty string";if(e.name.length>e1)return`bundleBlobs.name exceeds per-entry length cap (${e1})`;if(e.name.includes("\0"))return"bundleBlobs.name cannot contain NUL";if(typeof e.data!="string")return"bundleBlobs.data must be a base64 string";if(e.data.length>qL)return`bundleBlobs.data exceeds per-blob size cap (${r1} bytes raw)`}}return null}async function Fg(t){return new Uint8Array(await t.arrayBuffer())}async function Bg(t,e){if(Cl(t)){if(typeof e!="string"||!e)throw new TypeError("parseWorkspaceBundleBytes: password required for encrypted bundle");let n=await Y$(t,e);try{return Al(await qo(n))}catch(o){throw new Error("wrong password or corrupt bundle",{cause:o})}}let r;try{r=await qo(t)}catch(n){throw new Error(`gzip decompression failed: ${n.message}`,{cause:n})}return Al(r)}function Al(t){let e;try{e=JSON.parse(t)}catch(o){throw new Error(`payload is not JSON: ${o.message}`,{cause:o})}let r=YL(e);if(r===null)return e;let n=r.includes("exceeds cap");throw new Error(n?r:`not a deepview workspace export: ${r}`)}function XL(t){return Pe(t)??null}async function JL(t){let e=new Map;for(let r of t??[]){if(typeof r?.content!="string")continue;let n=await Ht(r.content);if(n)for(let o of n.findings)!o.id||e.has(o.id)||e.set(o.id,{severity:o.severity,file:o.file,line:o.line,description:rg(o.description)})}return e}async function ZL(t,e,r){if(!t||typeof t!="object"||Array.isArray(t))return;let n=l.triage,o=[];for(let[i,s]of Object.entries(t)){if(!s||typeof s!="object")continue;let a=n.get(i)?.color,c=typeof s.color=="string"?s.color:void 0;c&&a&&a!==c?o.push({id:i,property:"color",local:a,imported:c}):c&&c!==a&&G(n,i,{color:c});let u=n.get(i)?.comment??"",p=typeof s.comment=="string"?s.comment:"";p&&u&&u!==p?o.push({id:i,property:"comment",local:u,imported:p}):p&&p!==u&&G(n,i,{comment:p});let f=n.get(i)?.fix??"",h=typeof s.fix=="string"?s.fix:"";h&&f&&f!==h?o.push({id:i,property:"fix",local:f,imported:h}):h&&h!==f&&G(n,i,{fix:h});let g=XL(s),y=Pe(n.get(i))??null;g&&y&&y!==g?o.push({id:i,property:"triage",local:y,imported:g}):g&&!y&&G(n,i,{triage:g,ignoredReports:void 0});let b=n.get(i)?.flagged,v=typeof s.flagged=="boolean"?s.flagged:void 0;v!==void 0&&b!==void 0&&b!==v?o.push({id:i,property:"flagged",local:b?"flagged":"not flagged",imported:v?"flagged":"not flagged"}):v!==void 0&&v!==b&&G(n,i,{flagged:v});let x=Array.isArray(s.ignoredReports)?s.ignoredReports:[];if(!Pe(n.get(i)))for(let k of x)typeof k=="string"&&pt(n,i,k,!0)}if(o.length>0&&e){let i=await e(o,r??new Map);i&&QL(o,i)}await we()}function QL(t,e){for(let r of t){let n=`${r.id}:${r.property}`;e[n]==="imported"&&e6(r.id,r.property)===r.local&&(r.property==="color"?G(l.triage,r.id,{color:r.imported}):r.property==="comment"?G(l.triage,r.id,{comment:r.imported}):r.property==="fix"?G(l.triage,r.id,{fix:r.imported}):r.property==="triage"?G(l.triage,r.id,{triage:r.imported,ignoredReports:void 0}):r.property==="flagged"&&G(l.triage,r.id,{flagged:r.imported==="flagged"?!0:r.imported==="not flagged"?!1:void 0}))}}function e6(t,e){if(e==="color")return l.triage.get(t)?.color;if(e==="triage")return Pe(l.triage.get(t))??null;if(e==="comment")return l.triage.get(t)?.comment??"";if(e==="fix")return l.triage.get(t)?.fix??"";if(e==="flagged"){let r=l.triage.get(t)?.flagged;return r===!0?"flagged":r===!1?"not flagged":""}}async function t6(t){if(Array.isArray(t))for(let e of t){let r;try{r=Uint8Array.fromBase64(e.data)}catch(n){console.warn(`Workspace import: failed to decode bundle ${e.integrity}: ${n?.message??n}`);continue}try{let n=await ri(e.name,r);n?.integrity!==e.integrity&&console.warn(`Workspace import: bundle ${e.name} integrity mismatch (claimed ${e.integrity}, computed ${n?.integrity})`)}catch(n){console.warn(`Workspace import: failed to save bundle ${e.name}: ${n?.message??n}`)}}}async function Og(t,{conflictResolver:e}={}){let r=[];for(let p of t.reports)if(!(typeof p?.name!="string"||typeof p?.content!="string"))try{await nr(p.name,p.content);let{count:f,source:h}=_t(p.content);Tt(p.name,f,h??ao(p.name)),r.push(p.name)}catch(f){console.warn(`Workspace import: failed to save ${p.name}: ${f.message}`)}Array.isArray(t.bundleBlobs)&&t.bundleBlobs.length>0&&await t6(t.bundleBlobs);let o=t.triage&&Object.keys(t.triage).length>0?await JL(t.reports):new Map;await ZL(t.triage,e,o);let i=Array.isArray(t.bundles),s=i?t.bundles.filter(p=>typeof p=="string"&&p.length>0):[],a=await x$({id:t.workspace.id,name:t.workspace.name,privateKey:t.workspace.privateKey,reports:r,bundles:i?s:void 0,preserveBundles:!i,createdAt:t.workspace.createdAt}),c=new Set(r),u=Object.create(null);if(t.repoUrls&&typeof t.repoUrls=="object")for(let[p,f]of Object.entries(t.repoUrls))!c.has(p)||typeof f!="string"||!f||(u[p]=f);if(Object.keys(u).length>0)try{await Gd(u)}catch(p){console.warn("Workspace import: failed to adopt per-report repository URLs:",p)}return a}var GL,Q$,Rl,Tu,r1,qL,e1,t1,Pg=w(()=>{"use strict";xr();wr();xi();Si();xs();og();Oe();es();lo();El();GL=1,Q$=1024,Rl=1024,Tu=200,r1=100*1024*1024,qL=Math.ceil(r1*4/3)+16,e1=512,t1=64});function r6(t){return!t||typeof t!="object"||Array.isArray(t)?"payload is not an object":t.version!==void 0||t.workspace!==void 0?"payload claims to be a workspace export":Array.isArray(t.reports)?t.reports.length>Rl?`reports count (${t.reports.length}) exceeds cap (${Rl})`:null:"reports field must be an array"}function n1(t){return r6(t)===null}async function Ng(t){if(Cl(t))return{kind:"encrypted"};let e;try{e=await qo(t)}catch(n){throw new Error(`gzip decompression failed: ${n.message}`,{cause:n})}let r;try{r=JSON.parse(e)}catch{return{kind:"workspace",text:e}}return n1(r)?{kind:"reports",reports:r.reports}:{kind:"workspace",text:e}}var o1=w(()=>{"use strict";Pg();es();El()});async function Dg({id:t,name:e,privateKeyBase64:r,password:n}){if(typeof t!="string"||!t)throw new TypeError("encodeShareLink: id required");if(typeof e!="string"||!e)throw new TypeError("encodeShareLink: name required");if(typeof r!="string"||!r)throw new TypeError("encodeShareLink: privateKey required");if(typeof n!="string"||!n)throw new TypeError("encodeShareLink: password required");let i=await hl(r)===t?{v:1,n:e,k:r}:{v:1,i:t,n:e,k:r};return(await Ru(ge(JSON.stringify(i)),n)).toBase64({alphabet:"base64url",omitPadding:!0})}async function zg({encoded:t,password:e}){if(typeof t!="string"||!t)throw new Error("malformed share link");if(typeof e!="string"||!e)throw new TypeError("decodeShareLink: password required");let r;try{r=Uint8Array.fromBase64(t,{alphabet:"base64url"})}catch{throw new Error("malformed share link")}let n=await Au(r,e,{malformedMsg:"malformed share link",wrongPasswordMsg:"wrong password or corrupt link"});try{return await n6(n)}catch(o){throw new Error("wrong password or corrupt link",{cause:o})}}async function n6(t){let e=JSON.parse(Ve(t));if(!e||typeof e!="object"||typeof e.n!="string"||typeof e.k!="string"||!e.n||!e.k)throw new Error("shape");if(e.i!==void 0&&(typeof e.i!="string"||!e.i))throw new Error("shape");if(typeof e.i=="string"&&e.i.length>256)throw new Error("shape");if(e.n.length>1024)throw new Error("shape");if(Uint8Array.fromBase64(e.k).length!==32)throw new Error("shape");return{id:typeof e.i=="string"?e.i:await hl(e.k),name:e.n,privateKeyBase64:e.k}}function Ug(t){return typeof location>"u"?`#share=${t}`:`${location.origin}${location.pathname}#share=${t}`}function Hg(t){let e=typeof t=="string"?t:typeof location>"u"?"":location.hash;if(!e)return null;let r=e.replace(/^#/u,"");if(!r)return null;for(let n of r.split("&")){let o=n.indexOf("=");if(o<0||n.slice(0,o)!=="share")continue;return n.slice(o+1)||null}return null}var i1=w(()=>{"use strict";gt();Tg();Bm()});var O=w(()=>{"use strict";n$();nh();s$();xs();ul();_$();og();fu();E$();O$();Ca();N$();gn();z$();xr();zh();wr();U$();H$();Si();lo();El();Z$();Pg();o1();i1();xi()});function s1(t){t.installSyncHost(o6),ug(()=>t.triageSync.notify())}var o6,a1=w(()=>{"use strict";xr();xs();xi();wr();Si();gn();o6={get state(){return l},listWorkspaces:re,addReportToWorkspace:$n,addBundleToWorkspace:ki,onReportMembershipChanged:Nm,onBundleMembershipChanged:Dm,onWorkspaceDeleted:Om,onWorkspacePrivateKeyChanged:Pm,analyzeContent:_t,setCount:Tt,gunzipBytes:yr,listBundles:Dt,listFiles:pe,readBundle:bn,readFileBytes:ei,saveBundle:ri,saveFileBytes:Pa,saveTriage:we,getSecureItem:He,setSecureItem:Je,removeSecureItem:Jn,onSecureStorageHydrated:Xn}});function u1(){try{return He("deepview.sync.userEnabled")!=="0"}catch{return!0}}function Iu(t){p1=!!t}function jg(){if(p1)return!0;try{return or()?.mode==="managed"}catch{return!1}}function Ml(){return Tl||(jg()&&!ne?Promise.resolve(null):(Tl=(async()=>{let t="./client-sync.js";try{let e=await import(t);return s1(e),ne=e,i6(),e}catch(e){throw Tl=null,e}})(),Tl))}function Il(t){ne?t(ne):f1.push(t)}function i6(){let t=f1.splice(0);for(let e of t)try{e(ne)}catch(r){console.warn("client-sync: deferred apply failed:",r)}}function Ci(t,e){let r={cancelled:!1,unsub:null};return Il(n=>{r.cancelled||(r.unsub=e(n,t))}),()=>{r.cancelled=!0,r.unsub&&r.unsub()}}function Vg(t,e){return ne?ne.isInRemote(t,e):!1}function h1(t,e){return ne?ne.isBundleInRemote(t,e):!1}function m1(t){try{let e=localStorage.getItem(s6+t);if(!e)return null;let r=JSON.parse(e);return r&&typeof r=="object"?r:null}catch{return null}}function Rs(t,e){if(ne&&ne.isInRemote(t,e))return!0;let r=m1(t);return!r||typeof r.names!="object"?!1:Object.values(r.names).includes(e)}function Wg(t,e){if(ne&&ne.isBundleInRemote(t,e))return!0;let r=m1(t);return!r||typeof r.bundles!="object"?!1:Object.values(r.bundles).includes(e)}function g1(t){return ne?ne.remoteCount(t):0}function b1(t){return Ci(t,(e,r)=>e.onAutoDownloaded(r))}function y1(t){return Ci(t,(e,r)=>e.onBundleAutoDownloaded(r))}function v1(t){return Ci(t,(e,r)=>e.onChange(r))}function w1(t){if(ne){ne.setRedraw(t);return}l1=t,Il(e=>{l1===t&&e.setRedraw(t)})}function k1(t){if(ne){ne.setAuthenticationResolver(t);return}c1=t,Il(e=>{c1===t&&e.setAuthenticationResolver(t)})}function x1(t){if(ne){ne.setHydrationConflictResolver(t);return}d1=t,Il(e=>{d1===t&&e.setHydrationConflictResolver(t)})}async function En(t,e){if(!jg()&&!(!u1()&&!ne))return(await Ml())[t](...e)}function $1(...t){return En("fetchFile",t)}function _1(...t){return En("fetchBundleFromRemote",t)}function Lu(...t){return En("putFile",t)}function S1(...t){return En("putBundleToRemote",t)}function Fu(...t){return En("deleteFromRemote",t)}function Bu(...t){return En("deleteBundleFromRemote",t)}function Ll(...t){return En("openWorkspace",t)}function Kg(...t){return En("closeWorkspace",t)}function C1(...t){return En("recheckRemoteStorage",t)}function Cn(t,e){if(ne)return ne.triageSync[t](...e);Il(r=>{r.triageSync[t](...e)})}var ne,Tl,p1,f1,s6,l1,c1,d1,Mu,H,Er=w(()=>{"use strict";O();a1();ne=null,Tl=null;p1=!1;f1=[];s6="deepview.objstore-presence.";l1=null,c1=null,d1=null,Mu=[];H={get status(){return ne?ne.triageSync.status:"off"},get openSessions(){return ne?ne.triageSync.openSessions:[]},get persistenceDegraded(){return ne?ne.triageSync.persistenceDegraded:!1},get proxyAuthRequired(){return ne?ne.triageSync.proxyAuthRequired:!1},setEnabled(t){if(t===!0)return jg()?Promise.resolve(null):Ml().then(e=>{e.triageSync.setEnabled(!0);let r=Mu;Mu=[];for(let n of r)try{e.openWorkspace(n)}catch(o){console.warn(`client-sync: openWorkspace(${n}) failed during re-enable:`,o)}return null}).catch(e=>(console.warn("client-sync: setEnabled load failed:",e),null));if(ne){Mu=ne.openWorkspaceIds();for(let e of Mu)try{ne.closeWorkspace(e)}catch(r){console.warn(`client-sync: closeWorkspace(${e}) failed during disable:`,r)}ne.triageSync.setEnabled(!1);return}Cn("setEnabled",[t])},isEnabled(){return ne?ne.triageSync.isEnabled():u1()},openSession(t){Cn("openSession",[t])},closeSession(t){Cn("closeSession",[t])},refreshSession(t){Cn("refreshSession",[t])},dismissError(t){Cn("dismissError",[t])},setForcedOff(t){Cn("setForcedOff",[t])},setProtocolLocked(t){Cn("setProtocolLocked",[t])},setServerUrl(t){Cn("setServerUrl",[t])},getServerUrl(){return ne?ne.triageSync.getServerUrl():null},notify(){Cn("notify",[])},onStatusChange(t){return Ci(t,(e,r)=>e.triageSync.onStatusChange(r))},onServerInfo(t){return Ci(t,(e,r)=>e.triageSync.onServerInfo(r))},onPersistenceDegraded(t){return Ci(t,(e,r)=>e.triageSync.onPersistenceDegraded(r))},onProxyAuthRequired(t){return Ci(t,(e,r)=>e.triageSync.onProxyAuthRequired(r))}}});var Fl,Z,E1=w(()=>{Lr();Yi();Fl=class extends Qt{constructor(e){if(super(e),this.it=m,e.type!==yt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===m||e==null)return this._t=void 0,this.it=e;if(e===je)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let r=[e];return r.raw=r,this._t={_$litType$:this.constructor.resultType,strings:r,values:[]}}};Fl.directiveName="unsafeHTML",Fl.resultType=1;Z=Fr(Fl)});var bt=w(()=>{E1()});function Gg(){return Ou?.getPreviewRole()??null}function R1(){Ou?.setPreviewRole(null)}function Kr(){return Bl||(Bl=(async()=>{let t="./client-managed.js";try{return Ou=await import(t),Ou}catch(e){throw Bl=null,e}})(),Bl)}async function A1(){return(await Kr()).probeSession()}async function T1(){return(await Kr()).probeTeams()}async function M1(t){return(await Kr()).fetchReport(t)}async function I1(t){return(await Kr()).fetchReportTriage(t)}async function L1(t,e,r){return(await Kr()).pushReportTriage(t,e,r)}async function Pu(t){return(await Kr()).login(t)}async function F1(t){return(await Kr()).logout(t)}var Bl,Ou,Nu=w(()=>{"use strict";Bl=null,Ou=null});function B1(t){return typeof t=="string"&&Ol.includes(t)}function O1(t,e){let r=Ol.indexOf(t);return r!==-1&&r<=Ol.indexOf(e)}var Ol,qg=w(()=>{"use strict";Ol=["admin","manage","triage","view","none"]});var P1=w(()=>{"use strict"});var Du,Gr,fo,N1,zu,As,Wt=w(()=>{"use strict";Du="m5.875 10.154 1.376-.772.023-.067-.023-.037h-.067l-.23-.015-.787-.02-.681-.03-.661-.035-.166-.035-.156-.205.016-.103.14-.094.2.018.442.03.665.046.481.028.714.075h.113l.016-.047-.039-.028-.03-.028-.687-.466-.744-.492-.39-.284-.21-.143-.106-.135-.046-.294.19-.21.258.017.065.018.26.2.557.43.726.535.106.089.042-.03.006-.022-.048-.08-.395-.713-.422-.726-.187-.301-.05-.18a1 1 0 0 1-.03-.213l.218-.296.12-.039.29.039.123.106.18.413.293.65.453.884.133.262.07.242.027.075h.046v-.043l.038-.497.069-.611.067-.787.023-.221.11-.266.218-.143.17.081.14.2-.02.13-.083.54-.163.846-.106.567h.062l.07-.07.287-.382.482-.602.213-.239.248-.264.159-.125h.301l.221.329-.099.34-.31.393-.256.333-.369.496-.23.397.021.032.055-.006.832-.177.45-.081.537-.092.243.113.026.115-.096.236-.573.141-.673.135-1.003.237-.012.01.014.017.452.042.193.01h.473l.88.066.23.153.138.186-.023.141-.354.181-.478-.113-1.116-.266-.383-.096h-.053v.032l.32.312.584.528.731.68.037.168-.094.133-.099-.014-.643-.484-.248-.218-.561-.472H9.08v.05l.129.189.684 1.027.035.315-.05.103-.177.062-.194-.036-.4-.561-.413-.632-.333-.567-.041.023-.197 2.116-.092.108-.212.082-.177-.135-.094-.218.094-.43.113-.561.092-.447.083-.554.05-.184-.004-.013-.04.006-.418.574-.636.858-.503.539-.12.048-.21-.108.02-.193.117-.172.696-.886.42-.549.27-.317-.001-.046h-.016l-1.85 1.201-.328.042-.142-.132.018-.218.067-.071.556-.383Z",Gr='<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2 2 5v6l6 3 6-3V5L8 2Z"/><path d="M2 5l6 3 6-3"/><path d="M8 8v6"/></svg>',fo='<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="4" width="11" height="9" rx="1.2"/><path d="M6 4V3h4v1"/></svg>',N1='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" aria-hidden="true"><path d="m4.5 4.5 7 2-5 5z"/><circle cx="4.5" cy="4.5" r="2" fill="currentColor"/><circle cx="11.5" cy="6.5" r="2" fill="currentColor"/><circle cx="6.5" cy="11.5" r="2" fill="currentColor"/></svg>',zu='<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>',As='<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6.67 8.67a3.33 3.33 0 0 0 5.03.36l2-2a3.33 3.33 0 0 0-4.71-4.71l-1.15 1.14"/><path d="M9.33 7.33a3.33 3.33 0 0 0-5.03-.36l-2 2a3.33 3.33 0 0 0 4.71 4.71l1.14-1.14"/></svg>'});var D1,a6,Pl,We,Uu=w(()=>{"use strict";Wt();D1={default:{className:"brand-deepview",mark:'<path class="fg" d="M7.843 6.719c-1.605 0-2.926 1.292-3.477 1.947.466.58 1.872 2.024 3.496 2.024s2.907-1.292 3.486-2.005c-.627-.703-1.88-1.966-3.505-1.966m.019 3.857c-1.51 0-2.802-1.263-3.353-1.9.55-.617 1.814-1.852 3.334-1.852 1.51 0 2.698 1.12 3.335 1.852-.533.618-1.787 1.9-3.316 1.9m-.019-3.42c-.826 0-1.577.694-1.577 1.596 0 .789.599 1.577 1.577 1.577.893 0 1.587-.684 1.587-1.577-.01-.779-.627-1.596-1.587-1.596m0 3.069a1.476 1.476 0 0 1-1.482-1.473c0-.722.599-1.491 1.482-1.491.846 0 1.482.693 1.492 1.491 0 .808-.618 1.473-1.492 1.473m.01-2.727c-.637 0-1.264.532-1.264 1.244 0 .627.475 1.235 1.245 1.245.684 0 1.254-.522 1.254-1.244 0-.58-.475-1.236-1.235-1.245m-.02 2.403a1.167 1.167 0 0 1-1.149-1.159c0-.532.456-1.14 1.169-1.149.56 0 1.149.427 1.159 1.15 0 .636-.485 1.158-1.179 1.158m-.769-1.833c-.19.238-.275.494-.237.864l.74.057zm1.026-.294c-.295-.057-.665 0-.912.228l.323.607zm.133.047-.38.56.988.114c-.057-.275-.323-.579-.608-.674m-.124.741.456.912c.21-.209.352-.484.314-.836zm-1.225.504a.97.97 0 0 0 .57.617l.399-.551zm.713.664c.313.076.636.01.845-.161l-.295-.618zm-.637 1.55c0 .028-.028.066-.066.066h-.59c-.028 0-.066-.028-.066-.066s.029-.066.067-.066h.579c.048 0 .076.028.076.066m.712 0c0 .028-.028.066-.066.066h-.437c-.028 0-.066-.028-.066-.066s.028-.066.066-.066h.437c.038 0 .066.028.066.066m.666 0c0 .028-.029.066-.067.066h-.37c-.029 0-.067-.028-.067-.066s.029-.066.067-.066h.37c.038 0 .067.028.067.066m-1.672.351c0 .029-.029.067-.067.067h-.295c-.028 0-.066-.028-.066-.066 0-.029.029-.067.067-.067h.294c.038 0 .066.028.066.066m.694 0c0 .029-.028.067-.066.067h-.409c-.028 0-.066-.028-.066-.066 0-.029.028-.067.066-.067h.399c.038 0 .076.028.076.066m.732 0c0 .029-.029.067-.067.067h-.465c-.029 0-.067-.028-.067-.066 0-.029.029-.067.067-.067h.465c.038 0 .067.028.067.066m-1.093.371a.065.065 0 0 1-.067.066h-.627c-.028 0-.075-.028-.066-.066 0-.028.029-.066.067-.066h.627c.038 0 .066.028.066.066m.684 0a.065.065 0 0 1-.066.066h-.39c-.028 0-.076-.028-.066-.066 0-.028.028-.066.066-.066h.39c.038 0 .066.028.066.066M5.088 6.263c-.019-.105-.114-.19-.237-.19s-.257.104-.257.237.105.238.247.238c.105 0 .218-.076.238-.18h.864v.826l.095-.048V6.31c0-.028-.019-.057-.048-.057h-.902zm-.237.19c-.076 0-.143-.066-.143-.143s.066-.142.143-.142.142.066.142.143c.01.076-.066.142-.143.142m2.89-.323H6.38l.418-.475v-.332a.255.255 0 0 0 .218-.248c0-.123-.114-.256-.256-.256s-.266.114-.266.257c0 .123.095.228.209.247v.284l-.456.523v.893l.095-.047v-.742h1.396c.029 0 .067-.009.067-.057 0-.028-.019-.047-.067-.047m-1.13-1.054c0-.076.066-.152.152-.152s.152.066.152.151c0 .076-.066.152-.152.152s-.152-.066-.152-.152m-.836 5.264h-.874c-.019-.105-.114-.219-.247-.219s-.256.105-.256.257c0 .132.114.275.266.275.104 0 .218-.076.237-.19h.827v.608l-.257.285a.3.3 0 0 0-.095-.019c-.133 0-.256.105-.256.228 0 .133.104.238.237.238.124 0 .247-.105.247-.238a.23.23 0 0 0-.057-.152l.285-.304v-.712c0-.029-.019-.058-.057-.058m-1.121.219a.16.16 0 0 1-.152-.161c0-.077.066-.162.152-.162s.152.066.152.152-.066.171-.152.171m.713 1.14c-.076 0-.143-.066-.143-.143s.066-.133.143-.133.142.067.142.143c0 .066-.066.133-.143.133m5.472-1.377a.24.24 0 0 0-.237.208h-1.13c-.029 0-.038.02-.038.048v.712l-.323.39h-.029a.245.245 0 0 0-.247.247c0 .133.114.256.247.256s.247-.113.247-.256a.26.26 0 0 0-.123-.219l.313-.38v-.674h1.083c.019.105.114.2.238.2.133 0 .266-.105.266-.257 0-.133-.105-.276-.266-.276m-1.758 1.767a.15.15 0 0 1-.143-.152c0-.075.067-.142.143-.142s.152.066.152.143a.15.15 0 0 1-.152.151m1.758-1.33a.15.15 0 0 1-.143-.152.147.147 0 0 1 .294.001.15.15 0 0 1-.152.151M8.917 5.55h-.399a.075.075 0 0 1-.076-.076c0-.028.029-.066.067-.066h.418c.028 0 .066.028.066.066s-.038.076-.076.076m.742 0H9.22c-.038 0-.067-.028-.067-.076 0-.028.029-.066.067-.066h.437c.038 0 .066.028.066.066s-.028.076-.066.076m.883 0h-.598c-.029 0-.067-.028-.067-.076 0-.028.029-.066.067-.066h.598c.028 0 .066.028.066.066s-.028.076-.066.076m-1.282.4h-.741c-.038 0-.076-.029-.076-.067s.028-.076.066-.076h.75c.039 0 .067.038.067.076 0 .029-.028.067-.066.067m.797 0h-.503c-.038 0-.076-.029-.076-.067s.028-.066.066-.066h.513c.038 0 .067.028.067.066 0 .029-.029.067-.067.067m.476 0h-.19c-.039 0-.067-.029-.067-.067s.028-.066.066-.066h.2c.028 0 .066.028.066.066 0 .029-.028.067-.075.067m-1.682.398h-.332c-.039 0-.077-.028-.077-.066s.029-.066.067-.066h.342c.038 0 .076.028.076.066s-.028.066-.076.066m.789 0h-.494c-.038 0-.067-.028-.067-.066s.029-.066.067-.066h.494c.038 0 .066.028.066.066s-.028.066-.066.066m.893 0h-.599c-.038 0-.076-.028-.076-.066s.028-.066.066-.066h.618c.028 0 .066.028.066.066s-.028.066-.076.066m.418.305a.69.69 0 0 0-.674.712c0 .086.019.18.048.257l.085.066c-.028-.085-.057-.171-.057-.304 0-.285.228-.646.598-.646.295 0 .599.228.599.636a.58.58 0 0 1-.599.59.8.8 0 0 1-.237-.048l.123.114a.4.4 0 0 0 .114.01c.39 0 .684-.276.684-.666 0-.313-.266-.712-.684-.722m.353.552-.019-.01-.161.19-.143-.01-.057-.047-.019-.133.19-.2a.28.28 0 0 0-.361.077c-.076.095-.076.209-.038.351l-.247.304.171.152.266-.266c.142.038.285.019.38-.095a.31.31 0 0 0 .038-.313"/>'},"claude-security":{className:"brand-claude",mark:`<path class="fg" d="${Du}"/>`},"codex-security":{className:"brand-codex",mark:'<path class="fg" d="M11.04 8.364a1.72 1.72 0 0 0-.152-1.432 1.8 1.8 0 0 0-1.925-.846 1.8 1.8 0 0 0-.778-.498 1.8 1.8 0 0 0-.927-.05 1.8 1.8 0 0 0-.827.414 1.77 1.77 0 0 0-.507.767 1.8 1.8 0 0 0-.683.297 1.75 1.75 0 0 0-.499.549 1.75 1.75 0 0 0 .22 2.07 1.72 1.72 0 0 0 .151 1.432 1.8 1.8 0 0 0 1.926.846 1.77 1.77 0 0 0 1.333.587c.78 0 1.47-.496 1.707-1.227a1.8 1.8 0 0 0 .684-.298 1.75 1.75 0 0 0 .499-.548 1.75 1.75 0 0 0-.222-2.063m-2.667 3.678a1.33 1.33 0 0 1-.851-.304l.042-.024 1.413-.804a.23.23 0 0 0 .116-.199V8.747l.597.34q.01.005.011.015v1.629a1.323 1.323 0 0 1-1.328 1.31m-2.857-1.203a1.3 1.3 0 0 1-.158-.879l.042.025 1.414.805a.23.23 0 0 0 .23 0l1.729-.982v.68a.02.02 0 0 1-.01.018l-1.431.814a1.34 1.34 0 0 1-1.816-.48m-.372-3.037a1.32 1.32 0 0 1 .7-.574v1.656a.22.22 0 0 0 .114.197l1.72.979-.598.34a.02.02 0 0 1-.021 0L5.63 9.587a1.304 1.304 0 0 1-.487-1.791zm4.907 1.125L8.327 7.94l.596-.34a.02.02 0 0 1 .02 0l1.43.814a1.3 1.3 0 0 1 .512.528 1.3 1.3 0 0 1-.118 1.4 1.33 1.33 0 0 1-.595.436V9.122a.23.23 0 0 0-.12-.195m.594-.881-.042-.025-1.411-.812a.23.23 0 0 0-.232 0l-1.727.983v-.68a.02.02 0 0 1 .008-.018l1.429-.813a1.34 1.34 0 0 1 1.425.061 1.3 1.3 0 0 1 .55 1.298zM6.908 9.252l-.597-.34a.02.02 0 0 1-.012-.016V7.271c0-.249.073-.493.209-.703s.329-.378.557-.483a1.35 1.35 0 0 1 1.415.18l-.042.023-1.413.804a.23.23 0 0 0-.116.2zm.324-.69.77-.438.77.438v.875l-.768.437-.77-.437z"/>'},deepsec:{className:"brand-vercel",mark:'<path class="fg" d="m8 5.97 3.5 6.062h-7Z"/>'},piolium:{className:"brand-piolium",mark:'<path class="fg" d="M8 6.4 5.6 7.2v2.3c0 1.6 1 2.7 2.4 3.3 1.4-.6 2.4-1.7 2.4-3.3V7.2Z"/>'}},a6={default:["#2563eb","#fff"],"claude-security":["#d97757","#fff"],"codex-security":["#fff","#000"],deepsec:["#000","#fff"],piolium:["#fbb829","#1c1b19"]},Pl=Object.fromEntries(Object.entries(D1).map(([t,{className:e,mark:r}])=>{let[n,o]=a6[t],i=t==="codex-security"||t==="deepsec"?` stroke="${o}" stroke-width=".5"`:"";return[t,`<svg class="file-icon ${e}" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path class="bg" fill="${n}"${i} d="M3 2h6l4 4v8H3z"/><path fill="rgba(0,0,0,.18)" d="M9 2v4h4Z"/><g fill="${o}">${r}</g></svg>`]})),We=Object.fromEntries(Object.entries(D1).map(([t,{className:e,mark:r}])=>[t,`<span class="report-logo ${e}" aria-hidden="true"><svg viewBox="${t==="default"?"3.5 4 9 9":"4 5 8 8"}" width="14" height="14">${r}</svg></span>`]))});function z1(t){return t!=="default"&&Object.hasOwn(We,t)?t:null}function Nl(t){return z1(t._source??t.source)}function U1(t){let e=new Set;for(let o of t){let i=z1(o.source);i!==null&&e.add(i);for(let s of o.groups.flat()){let a=Nl(s);a!==null&&e.add(a)}}let r=Object.keys(ct),n=o=>{let i=r.indexOf(o);return i===-1?r.length:i};return[...e].toSorted((o,i)=>n(o)-n(i)||o.localeCompare(i))}function Ke(t){let e=ao(t);if(e===Vt)return Vt;if(e!==void 0)return l6.has(e)?e:"default";let r=t.toLowerCase();return r.endsWith(".codex")?"codex-security":r.endsWith(".md")?"claude-security":"default"}function Hu(t){return ao(t)===Vt}function ke(t){return t.toLowerCase().endsWith(".codex")?t.slice(0,-6).replaceAll("__","/"):t}var be,l6,Ei,Rr=w(()=>{"use strict";O();Uu();Uu();Oe();Wt();be={...Pl,[Vt]:As},l6=new Set(["claude-security","codex-security","deepsec","piolium"]),Ei={...ct,default:"DeepView"}});function c6(){return ho||(ho=document.createElement("div"),ho.id="styled-tooltip",document.body.append(ho),ho)}function Yg(t,{placement:e="cursor"}={}){let r=c6(),n=t.dataset.tooltip??"";if(n&&!(mo===t&&r.textContent===n)){if(r.textContent=n,e==="right"){let o=t.getBoundingClientRect();r.style.top=`${Math.round(o.top+o.height/2)}px`,r.style.left=`${Math.round(o.right+p6)}px`,r.style.transform="translateY(-50%)"}else{r.style.transform="none",r.style.top=`${G1+u6}px`,r.style.left="0px",r.classList.add("visible");let o=r.offsetWidth,i=window.innerWidth-o-H1,s=Math.max(H1,Math.min(K1,i));r.style.left=`${Math.round(s)}px`}r.classList.add("visible"),mo=t}}function Ts(){clearTimeout(Dl),Dl=null,ho&&ho.classList.remove("visible"),mo=null}function q1(t,{gate:e,placement:r}={}){e&&!e(t)||(clearTimeout(Dl),Dl=setTimeout(()=>{Yg(t,{placement:r})},d6))}function V1(t,e){for(let r of t.composedPath()){if(r===e)break;if(r.nodeType===1&&Object.hasOwn(r.dataset,"tooltip"))return r}return null}function cr(t,e){!t||j1.has(t)||(j1.add(t),t.addEventListener("mouseover",r=>{let n=V1(r,t);if(!n){Ts();return}n!==mo&&q1(n,e)}),t.addEventListener("mouseout",r=>{let n=V1(r,t),o=r.relatedTarget?.closest?.("[data-tooltip]")??null;n&&n===o||Ts()}))}function Y1(){W1||(W1=!0,document.body.addEventListener("mouseover",t=>{if(t.target.closest("[data-tooltip-managed]"))return;let e=t.target.closest("[data-tooltip]");!e||e===mo||(Ts(),q1(e))}),document.body.addEventListener("mouseout",t=>{t.target.closest("[data-tooltip-managed]")||t.relatedTarget?.closest?.("[data-tooltip-managed]")||!mo&&!Dl||mo&&mo.contains(t.relatedTarget)||Ts()}))}var ho,mo,Dl,K1,G1,d6,u6,p6,H1,j1,W1,go=w(()=>{"use strict";mo=null,Dl=null,K1=0,G1=0;document.addEventListener("mousemove",t=>{K1=t.clientX,G1=t.clientY},{passive:!0});d6=100,u6=14,p6=8,H1=8;j1=new WeakSet;W1=!1});var X1,J1,zl,Z1,Q1,C9,E9,R9,A9,T9,Xg=w(()=>{"use strict";X1=globalThis[Symbol.for("@rray/frontend")];if(!X1)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");({LitElement:J1,html:zl,nothing:Z1,unsafeCSS:Q1,render:C9,StateElement:E9,classMap:R9,repeat:A9,styleMap:T9}=X1)});function bo(t,e=!1){Ms=t!==!1&&!e}function eb(){return Ms}function Yr(t){return Ms?Fe(t):""}function d_(t){return Fe(t)!==""}function tb(t){let e=Fe(t);return e!==""&&e!=="revalidation"}function ju(t){return t.some(e=>(e.groups??[]).some(r=>r.some(tb)))}function rb(t){let e=Yr(t);return e&&e!=="revalidation"?e:null}function Hl(t){return Yr(t)==="revalidation"}function yo(t){return u_.has(Yr(t))}function nb(t){return u_.has(Yr(t))}function Wu(t){return Vu.find(e=>e.value===t)?.kinds??null}function Gu(t,e){let r=Wu(t);return r?.includes("partial")?e==="only"?["partial"]:e==="exclude"?["confirmed"]:r:r}function p_(t){let e=new Set(t);return Vu.filter(r=>r.kinds.some(n=>e.has(n)))}function qu(t){return new RegExp(`(^|/)${t}/`,"u")}function f_(t){return new RegExp(`^(?:.*/)?${t}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,"u")}function f6(t){t!==Ul&&(Ul=t,ob=qu(t),g_=f_(t))}function Yu(t){let e=!1,r=!1,n=o=>(!e&&h_.test(o)&&(e=!0),!r&&m_.test(o)&&(r=!0),e);e:for(let o of t){for(let i of o.groups??[])for(let s of i)if(n(s.file))break e;if(o.tree){for(let i of Object.keys(o.tree))if(n(i))break e}}f6(e?"node_modules":r?"vendor":"dependencies")}function b_(){return Ul}function It(t){return ob.test(t)}function Xu(t){let e=!1;for(let r of t??[])for(let n of r.groups??[])for(let o of n){if(o.isApp!==!1)continue;let i=Jg.has(o);"isUpstream"in o&&!i||(It(o.file)?(o.isUpstream!==!0&&(e=!0),o.isUpstream=!0,Jg.add(o)):i&&(e=!0,delete o.isUpstream,Jg.delete(o)))}return e}function e_(t){let e=typeof t=="string"?t:"";return h_.test(e)||m_.test(e)||ob.test(e)}function t_(t){return h6.exec(typeof t=="string"?t:"")?.[1]??null}function _e(t){return typeof t!="number"||!Number.isFinite(t)?null:`${t.toLocaleString()} B`}function Kt(t){if(t.length<=1)return{prefix:"",stripped:[...t]};let e=t.map(s=>s.split("/")),r=Math.min(...e.map(s=>s.length)),n=0;for(let s=0;s<r-1&&e.every(a=>a[s]===e[0][s]);s++)n=s+1;if(n>0&&e[0][n-1].startsWith("@")&&n--,n>0&&e[0][n-1]==="node_modules"&&n--,n===0)return{prefix:"",stripped:[...t]};let o=`${e[0].slice(0,n).join("/")}/`,i=e.map(s=>s.slice(n).join("/"));return{prefix:o,stripped:i}}function m6(t){return t.match(g_)?.[1]??t}function y_(t){let e=Ms?[rb(t),t.revalidateVerdict,t.revalidateRecommendation]:[];return[t.file,t.title,t.description,t.impact,t.reproduction,sb(t),t.recommendation,t.confidenceReason,...e,t.discoveredIn,t.repo?.github].filter(Boolean).join(`
82
+ `).toLowerCase()}function Ri(t){return[typeof t?.category=="string"?t.category.trim():"",Xa(t,Ms)].filter(Boolean).join(" \xB7 ")}function jl(t){if(t.length===0)return"";let e=t[0];for(let r=1;r<t.length;r++){for(;e&&!t[r].startsWith(e);)e=e.slice(0,-1);if(!e)return""}return e}function Ge(t){if(!t)return"";let e=t.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return e?e[1]:t}function v_(t){if(!t)return null;let e=t.trim().replace(/\/$/u,"");return e?/^https?:\/\//iu.test(e)?e:/^github\.com\//iu.test(e)?`https://${e}`:`https://github.com/${e}`:null}function b6(t){return g6.test(t||"")}function r_(t){if(t==null||typeof t=="string")return{id:t??"",prefix:""};let e=hi(t);return{id:typeof t.github=="string"?t.github:"",prefix:e?`${e}/`:""}}function y6(t,e,r){if(b6(t))return null;let n=r_(e);if(n.id)return`https://github.com/${n.id}/blob/HEAD/${n.prefix}${m6(t)}`;if(It(t))return null;let o=r_(r),i=v_(o.id);return i?`${i}/blob/HEAD/${o.prefix}${t}`:null}function ib(t,e){let r=t?.file??"",n=qr(t,e);return n?zl`<a href="${v6(n)}" target="_blank" rel="noopener">${r}</a>`:r}function v6(t){return t.replace(/#L\d+(?:-L?\d+)?$/u,"")}function qr(t,e){if(!t)return null;if(Be(t.location))return t.location;let r=y6(t.file,t.repo,e);if(!r)return null;let n=parseInt(t.line,10);return Number.isFinite(n)?`${r}#L${n}`:r}function w_(t){let e=typeof t=="string"?w6.exec(t):null;if(!e)return"";let r=e[2],n=k6.exec(r);if(!n)return`${e[1]}/${r}`;r=r.slice(0,n.index);let o=n[2]?`${n[1]}-${n[2]}`:n[1];return`${e[1]}/${r}:${o}`}function k_(t){return t.split(/(\n{2,})/u).map(e=>{if(/^\n+$/u.test(e))return e;let r=e.split(`
83
+ `);return r.some(n=>x6.test(n))?e:r.map(n=>n.trim()).filter(Boolean).join(" ")}).join("")}function n_(t,e,r){let n=e?/^\n*/u.exec(t)[0]:"",o=t.slice(n.length),i=r?/\n*$/u.exec(o)[0]:"";return n+k_(o.slice(0,o.length-i.length))+i}function Is(t){if(!t)return t;let e=rt(t);if(e.length===0)return k_(t);let r=[],n=0;for(let[o,i]of e)o>n&&r.push(n_(t.slice(n,o),n>0,!0)),r.push(t.slice(o,i)),n=i;return n<t.length&&r.push(n_(t.slice(n),!0,!1)),r.join("")}function x_(t,e){let r=0;for(;r<e&&t[r]===" ";)r++;return t.slice(r)}function _6(t){let e=t.split(`
84
+ `),r=o_.exec(e[0]),n=(r?.[2]??"```").slice(0,3),o=(r?.[3]??"").trim().split(/\s+/u)[0].toLowerCase(),s=!!(e.length>1?o_.exec(e.at(-1)):null)?.[2].startsWith(n),a=r?.[1].length??0,c=e.slice(1,s?-1:void 0);return{lang:$6.test(o)?o:"",code:(a>0?c.map(u=>x_(u,a)):c).join(`
85
+ `)}}function $_(t){let e=rt(t||"");if(e.length===0)return[t];let r=[],n=0,o=(i,s)=>{let a=(s?i.replace(/^\n+/u,""):i).replace(/\n+$/u,"");a&&r.push(a)};for(let[i,s]of e)i>n&&o(t.slice(n,i),n>0),r.push(_6(t.slice(i,s))),n=s;return n<t.length&&o(t.slice(n),!0),r}function S6(t){return/^ */u.exec(t)[0].length}function s_(t){let e=t.length;for(;e>0&&!t[e-1].trim();)e--;return t.slice(0,e).join(`
86
+ `)}function __(t){let e=typeof t=="string"?t:"";if(!e)return[t];let r=rt(e),n=e.split(`
87
+ `),o=[],i=0;for(let f of n)o.push(i),i+=f.length+1;let s=f=>!zt(r,o[f])&&!i_.test(n[f])&&Zg.test(n[f]),a=[],c=0,u=0,p=f=>{let h=n.slice(c,f).join(`
88
+ `).replace(/^\n+/u,"").replace(/\n+$/u,"");h.trim()&&a.push(h)};for(;u<n.length;){if(!s(u)){u++;continue}p(u);let f=Zg.exec(n[u]),h=!!f[2],g=[],y=null,b=!1;for(;u<n.length;){let v=n[u];if(!zt(r,o[u])){if(!v.trim()){y.lines.push(""),b=!0,u++;continue}let x=S6(v),k=i_.test(v)?null:Zg.exec(v);if(k&&(!y||x<y.column)){if(!!k[2]!==h)break;y&&g.push(s_(y.lines)),y={column:k[0].length,lines:[v.slice(k[0].length)]},b=!1,u++;continue}if(x<y.column&&b)break}y.lines.push(x_(v,y.column)),b=!1,u++}y&&g.push(s_(y.lines)),a.push({ordered:h,start:h?Number(f[2]):null,items:g}),c=u}return a.length===0?[t]:(p(n.length),a)}function Mt(t){if(typeof t=="number")return Number.isFinite(t)&&t>=1?{start:Math.floor(t),end:Math.floor(t)}:null;let e=C6.exec(String(t??"").trim());if(!e)return null;let r=parseInt(e[1],10),n=e[2]===void 0?r:parseInt(e[2],10);return!Number.isFinite(r)||r<1||!Number.isFinite(n)||n<1?null:{start:Math.min(r,n),end:Math.max(r,n)}}function Ju(t){return t?t.start===t.end?String(t.start):`${t.start}-${t.end}`:""}function E6(t){if(t&&typeof t=="object"){let e=Mt(t.start);if(!e)return null;let r=Mt(t.end)??e;return{start:e.start,end:Math.max(e.start,r.end)}}return Mt(t)}function S_(t,e,r=4){let n=typeof t=="string"&&t!==""?t.split(`
89
+ `):[];if(n.length===0)return{text:"",startLine:1,lines:[]};let o=E6(e),i=o&&{start:Math.min(o.start,n.length),end:Math.min(o.end,n.length)},s=i?Math.max(1,i.start-r):1,a=i?Math.min(n.length,i.end+r):Math.min(n.length,r*2+1),c=n.slice(s-1,a);return{text:c.join(`
90
+ `),startLine:s,lines:c}}function Zu(t,e,r,n){if(Be(t?.url))return t.url;let o=t?.file;if(typeof o!="string"||o==="")return null;let i=e?.file??"",s=e?.repo?.github,a=()=>s?qr({file:o,line:t?.line,repo:e.repo},null):null;if(n===0&&o===i)return a();let c=t_(o);return c!==null&&c===t_(i)?a():e_(o)?null:s&&!e_(i)?a():qr({file:o,line:t?.line},r)}function C_(t,{spaced:e=!1}={}){let r=Array.isArray(t?.evidence)?t.evidence:[];return r.length===0?"":r.map((n,o)=>{let i=ut(n),s=[`${o+1}. ${n.url?`[${i}](${n.url})`:i}`],a=di(n);if(a)for(let c of a.split(`
91
+ `))s.push(` ${c}`);return s.join(`
92
+ `)}).join(e?`
75
93
 
76
94
  `:`
77
- `)}function Li(e){let t=Rb(e);return t?`**Evidence:**
78
- ${t}`:""}function Ib(e){let t=/^\[([^\]]+)\]\(([^)\s]+)\)$/u.exec(e);return!t||!_t(t[2])?null:{label:aa(t[1].trim())||t[2],url:t[2]}}function Mb(e,t){let r=parseInt(e?.line,10);if(!Number.isFinite(r))return Zm;let n=Cr(e,t),o=`line ${r}`;return n?mu`<a href="${n}" target="_blank" rel="noopener">${o}</a>`:o}function Fb(e,t){return!e||!t?null:`${/^https?:/iu.test(e)?e.replace(/\/$/u,""):`https://github.com/${e}`}/commit/${t}`}var M1=[["Impact","impact"],["Reproduction","reproduction"],["Recommendation","recommendation"],["Confidence reason","confidenceReason"],["Revalidation verdict","revalidateVerdict"],["Revalidation recommendation","revalidateRecommendation"]];function Bb(e,t){let r=[];t&&r.push(`Repo: ${t}`);let n=qa(e);n&&r.push(`Location: ${n}`),e?.confidence!==void 0&&e?.confidence!==null&&r.push(`Confidence: ${e.confidence}/10`);let o=gt(e);o&&r.push(`Revalidation: ${o}`);let i=[];r.length>0&&i.push(r.join(`
79
- `));let{title:s,body:l}=to(e);s&&i.push(`# ${s}`),l&&i.push(l.trim());let d=Rb(e,{spaced:!0});d&&i.push(`# Evidence
95
+ `)}function sb(t){let e=C_(t);return e?`**Evidence:**
96
+ ${e}`:""}function E_(t){let e=/^\[([^\]]+)\]\(([^)\s]+)\)$/u.exec(t);return!e||!Be(e[2])?null:{label:qa(e[1].trim())||e[2],url:e[2]}}function R_(t,e){let r=parseInt(t?.line,10);if(!Number.isFinite(r))return Z1;let n=qr(t,e),o=`line ${r}`;return n?zl`<a href="${n}" target="_blank" rel="noopener">${o}</a>`:o}function Qu(t,e){return!t||!e?null:`${/^https?:/iu.test(t)?t.replace(/\/$/u,""):`https://github.com/${t}`}/commit/${e}`}function A_(t,e){let r=[];e&&r.push(`Repo: ${e}`);let n=ut(t);n&&r.push(`Location: ${n}`),t?.confidence!=null&&r.push(`Confidence: ${t.confidence}/10`);let o=Yr(t);o&&r.push(`Revalidation: ${o}`);let i=[];r.length>0&&i.push(r.join(`
97
+ `));let{title:s,body:a}=no(t);s&&i.push(`# ${s}`),a&&i.push(a.trim());let c=C_(t,{spaced:!0});c&&i.push(`# Evidence
80
98
 
81
- ${d}`);for(let[u,p]of M1){if(!Mi&&p.startsWith("revalidate"))continue;let f=Fe(e?.[p],e)?.trim();f&&i.push(`# ${u}
99
+ ${c}`);for(let[u,p]of R6){if(!Ms&&p.startsWith("revalidate"))continue;let f=$t(t?.[p],t)?.trim();f&&i.push(`# ${u}
82
100
 
83
101
  ${f}`)}return i.join(`
84
102
 
85
- `)}function Lb(e,{title:t,body:r}={}){let n=kb(e);if(!n)return null;let o;try{o=new URL(n).host.toLowerCase()}catch{return null}if(o!=="github.com")return null;let i=new URLSearchParams;t&&i.set("title",t),r&&i.set("body",r);let s=i.toString();return s?`${n}/issues/new?${s}`:`${n}/issues/new`}var F1=/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u,B1=/^[a-zA-Z\d._-]+$/u,L1=/^[1-9]\d{0,9}$/u,P1=/^[a-fA-F\d]{7,40}$/u,O1=/^#[\w-]+$/u,sb=/^GHSA(?:-[0-9a-z]{4}){3}$/u;function ab(e){return e.length<=39&&F1.test(e)}function lb(e){return e.length<=100&&e!=="."&&e!==".."&&B1.test(e)}function N1(e){let t;try{t=new URL(e)}catch{return null}if(t.href!==e||t.protocol!=="https:"||t.hostname.toLowerCase()!=="github.com"||t.port||t.username||t.password)return null;let r=t.pathname.split("/");if(r.at(-1)===""&&r.pop(),r.length===3&&r[1]==="advisories"){let p=r[2];return sb.test(p)?{url:`https://github.com/advisories/${p}`,label:p}:null}if(r.length===6&&r[3]==="security"&&r[4]==="advisories"){let[,p,f,,,h]=r;return!ab(p)||!lb(f)||!sb.test(h)?null:{url:`https://github.com/${p}/${f}/security/advisories/${h}`,label:h}}if(r.length!==5)return null;let[,n,o,i,s]=r;if(!ab(n)||!lb(o))return null;let l;if(i==="issues"||i==="pull"){if(!L1.test(s))return null;l=`${n}/${o}#${s}`}else if(i==="commit"){if(!P1.test(s))return null;l=`${n}/${o}@${s.slice(0,7)}`}else return null;let d=O1.test(t.hash)?t.hash:"";return{url:`https://github.com/${n}/${o}/${i}/${s}${d}`,label:l}}var D1=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/u;function z1(e){let t=Ig(e);if(!t)return null;let r=D1.test(t.id)?`finding ${t.id.slice(0,8)}`:"finding";return{url:`#${t.fragment}`,label:r,self:!0}}var yu=/https?:\/\/[^\s<>"'`(){}[\]|\\^]+/giu,U1=new Set([")",".",",","!","?",";",":","'",'"',"*","]","}",">"]);function H1(e){let t=e.length;for(;t>0&&U1.has(e[t-1]);)t--;return t===e.length?e:e.slice(0,t)}function Pb(e){if(typeof e!="string"||e.length===0)return[];let t=[],r=0;yu.lastIndex=0;let n;for(;(n=yu.exec(e))!==null;){let o=H1(n[0]),i=o?N1(o)??z1(o):null;i&&(n.index>r&&t.push(e.slice(r,n.index)),t.push(i),r=n.index+o.length,yu.lastIndex=r)}return r<e.length&&t.push(e.slice(r)),t}var Ar="\0",mn="",Tr="";function Pi(e){return Fi(e.model)||null}function Tu(e){if(a.filterAnalyzer){let t=e._analyzer??null,r=a.filterAnalyzer===Ar?null:a.filterAnalyzer;if(t!==r)return!1}if(a.filterModel){let t=Pi(e),r=a.filterModel===Tr?null:a.filterModel;if(t!==r)return!1}return!0}function Ru(e){return typeof e.repo?.github=="string"&&e.repo.github?e.repo.github:typeof e._repoFallback=="string"&&e._repoFallback?e._repoFallback:null}function ro(){a.filterSeverities=new Set,a.filterColors=new Set,a.filterSources=new Set,a.filterAnalyzer="",a.filterModel="",a.filterRepo="",a.filterConfMin=0,a.filterConfMax=10,a.filterInclude="",a.filterIncludeNegate=!1,a.filterComment="",a.filterFix="",a.filterFlagged="",a.filterRevalidate="",a.filterPartial="";let e=a.reports.some(t=>t.groups.some(r=>r.some(n=>n.priority!==void 0)));a.sortBy=e?"priority-desc":"severity"}function V1(e,t){return e.some(r=>{let n=xu(r)?0:r.confidence;return n===void 0?r.critical===!0||t===0:n>=t})}function Ya(e){if(!e.some(n=>n.some(o=>o.confidence!==void 0)))return 0;let t=n=>e.reduce((o,i)=>o+(i.some(s=>s.confidence!==void 0&&s.confidence>=n)?1:0),0),r;for(t(6)<=25?r=6:t(7)<=25?r=7:r=8;r>0&&t(r-1)===t(r);)r--;return r}function Xa(e,t){let r=e.filter(o=>V1(o,t));if(r.length===0||!r.every(o=>o.some(i=>gt(i))))return"";let n=new Set(Su("confirmed"));return e.some(o=>o.some(i=>n.has(gt(i))))?"confirmed":""}function j1(e){let t=a.filterInclude.toLowerCase();if(a.filterSeverities.size>0&&!a.filterSeverities.has(ne(e,a.severityMode)))return!1;if(a.filterColors.size>0){let r=a.triage.get(O(e))?.color??"none";if(!a.filterColors.has(r))return!1}if(a.filterSources.size===1){let r=a.filterSources.has("own");if(r&&Er(e.file)||!r&&!Er(e.file))return!1}if(!Tu(e))return!1;if(a.filterRepo){let r=Ru(e),n=a.filterRepo===mn?null:a.filterRepo;if(r!==n)return!1}if(a.filterRevalidate){let r=pb(a.filterRevalidate,a.filterPartial);if(r&&!r.includes(gt(e)))return!1}if(!a.filterRevalidate){let r=xu(e)?0:e.confidence;if(r===void 0){if(e.critical===!0){if(a.filterConfMax<10)return!1}else if(a.filterConfMin>0)return!1}else if(r<a.filterConfMin||a.filterConfMax<10&&r>a.filterConfMax)return!1}if(t){let r=a.triage.get(O(e)),n=wb(e).includes(t)||(r?.comment??"").toLowerCase().includes(t)||(r?.fix??"").toLowerCase().includes(t);return a.filterIncludeNegate?!n:n}return!0}function W1(e){if(!a.filterComment&&!a.filterFix&&!a.filterFlagged)return!0;let t=r=>e.some(n=>r(a.triage.get(O(n))));if(a.filterComment){let r=t(n=>!!n?.comment);if(a.filterComment==="with"?!r:r)return!1}if(a.filterFix){let r=t(n=>!!n?.fix);if(a.filterFix==="with"?!r:r)return!1}if(a.filterFlagged){let r=t(n=>n?.flagged===!0);if(a.filterFlagged==="with"?!r:r)return!1}return!0}function Rr(e){return e.filter(t=>t.some(j1)&&W1(t))}function Ob(e,t,r){return(n,o)=>{let i=n[e]??r,s=o[e]??r;return(t==="desc"?s-i:i-s)||n.file.localeCompare(o.file)}}function Db(e){let t=e==="desc"?-1:11;return(r,n)=>{let o=r.confidence===void 0&&r.critical===!0,i=n.confidence===void 0&&n.critical===!0,s=r.confidence??(o?10:t),l=n.confidence??(i?10:t);return(e==="desc"?l-s:s-l)||(o===i?0:o?-1:1)||r.file.localeCompare(n.file)}}var Nb=Db("desc"),K1={severity:(e,t)=>(Se[ne(t,a.severityMode)]||0)-(Se[ne(e,a.severityMode)]||0)||Nb(e,t)||parseInt(e.line,10)-parseInt(t.line,10),"confidence-desc":Nb,"confidence-asc":Db("asc"),"priority-desc":Ob("priority","desc",-1),"priority-asc":Ob("priority","asc",11)};function zb(e){let t=K1[a.sortBy];return t?e.map(r=>({p:bn(r),g:r})).toSorted((r,n)=>t(r.p,n.p)).map(r=>r.g):[...e]}function O(e){return e.id??String(e._id)}function de(e){return O(e[0])}function Iu(e){return Array.isArray(e)?e:[e]}function Mu(e){return e?._reportName??""}function Oi(e){return pn(a.triage,O(e),Mu(e))}function Fu(e,t=a.triage.get(O(e))){return t?.triage??(Oi(e)?"ignored":void 0)}function no(e){return e.length<=1?e:[...e].toSorted((t,r)=>{let n=Va(t)?1:0,o=Va(r)?1:0;if(n!==o)return o-n;let i=a.triage.get(O(t))?.color?1:0,s=a.triage.get(O(r))?.color?1:0;if(i!==s)return s-i;let l=Se[ne(t,a.severityMode)]||0,d=Se[ne(r,a.severityMode)]||0;if(l!==d)return d-l;let u=t.confidence??-1;return(r.confidence??-1)-u})}function bn(e){return e.length===1?e[0]:no(e)[0]}function G1(e){let t=a.triage.get(O(e));return!!t?.comment||!!t?.fix||t?.flagged===!0}function He(e){if(e.length===1)return e[0];let t=a.activeTabByGroup.get(de(e));if(t){let o=e.find(i=>O(i)===t);if(o)return o}let r=no(e),n=r;if(a.filterAnalyzer||a.filterModel){let o=r.filter(Tu);o.length>0&&(n=o)}return n.find(G1)??n[0]}function Ut(e){return e?._repoFallback||a.repoUrl||""}function Ja(e){for(let t of Lt().values())if(t.files.has(e.file))return t.repos&&t.repos.size===1?[...t.repos][0]:null;return e.repo?.github||Ut(e)||null}function pe(e){let t=0,r=!1,n,o=!1,i=!1,s,l=!1,d=null,u=!1,p=!0;for(let v of e){let y=a.triage.get(O(v)),w=Fu(v,y),k=y?.color;k===void 0&&w===void 0||(t++,k!==void 0&&(o?k!==n&&(r=!0):(o=!0,n=k)),l?w!==s&&(i=!0):(l=!0,s=w),w?(d===null&&(d=w),w==="ignored"?p=!1:u=!0):p=!1)}let f=r||i,h=!f&&o?n:null,m=t>0&&p,b=!f&&d!==null?d:null;return{hasConflict:f,commonColor:h,anyTriage:u,allTriaged:m,commonTriage:b,allIgnored:b==="ignored"&&t===e.length,isInProgress:b==="inprogress",isFixed:b==="fixed",isInvalid:b==="invalid",isDeleted:b==="deleted",isIgnored:b==="ignored"}}function Ub(e,t){if(!Array.isArray(e)||e.length<2)return!1;let r=(t??"").trim();return e.every(n=>Bu(n,r))}function Bu(e,t){let r=(a.triage.get(O(e))?.fix??"").trim();return r===""||r===(t??"").trim()}function Hb(e,t){let r=pe(e);return{targets:Lu(e,r),clearing:t==="restore"||Pu(e,r)===t}}function Lu(e,t=pe(e)){return t.hasConflict?[He(e)]:e}function Pu(e,t=pe(e),r=null){return t.hasConflict?Fu(r??He(e))??null:t.commonTriage??null}function Qa(e){if(!Array.isArray(e)||e.length<2)return!1;let r=pe(e).commonTriage;if(!r||r==="ignored")return!1;let n=!1;for(let o of e){let i=O(o),s=a.triage.get(i);Fu(o,s)!==r&&(s?.ignoredReports?.length||U(a.triage,i,{triage:r})&&(n=!0))}return n}function q1(e){if(a.showRevalidation||!e.some(r=>r.some(ku)))return e;let t=[];for(let r of e){let n=r.filter(o=>!ku(o));n.length>0&&t.push(n.length===r.length?r:n)}return t}function st(){return q1(Vb())}function Vb(){let e=a.reports.flatMap(d=>d.groups),t=a.workspaceMerges;if(!t||t.length===0)return e;let r=e.map((d,u)=>u),n=d=>{let u=d;for(;r[u]!==u;)u=r[u];for(;r[d]!==u;){let p=r[d];r[d]=u,d=p}return u},o=(d,u)=>{let p=n(d),f=n(u);p!==f&&(r[p]=f)},i=new Map;for(let d=0;d<e.length;d++)for(let u of e[d])u.id&&i.set(u.id,d);for(let d of t){let u=-1;for(let p of d){let f=i.get(p);f!==void 0&&(u===-1?u=f:o(u,f))}}let s=new Set,l=[];for(let d=0;d<e.length;d++){let u=n(d);if(s.has(u))continue;s.add(u);let p=[];for(let w=d;w<e.length;w++)n(w)===u&&p.push(...e[w]);let f=new Set(p.map(w=>w.id).filter(Boolean)),h=[],m=new Set;for(let w of t)for(let k of w)m.has(k)||f.has(k)&&(h.push(k),m.add(k));if(h.length===0){l.push(p);continue}let b=new Map;for(let w of p)w.id&&!b.has(w.id)&&b.set(w.id,w);let v=new Set,y=[];for(let w of h){let k=b.get(w);k&&(y.push(k),v.add(k))}for(let w of p)v.has(w)||y.push(w);l.push(y)}return l}function jb(e){if(a.showRevalidation||!Array.isArray(e)||e.length===0)return e;let t=new Set(e.map(O));return Vb().find(r=>r.some(n=>t.has(O(n))))??e}function Ht(e){for(let t of st())if(de(t)===e)return t;return null}var Nu={"claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec",piolium:"Piolium"};function Wb(e){return e==null?"(none)":Nu[e]??e}function Kb(e){return e??"(no model)"}var Ou=class extends N{static properties={analyzers:{attribute:!1},models:{attribute:!1},groups:{attribute:!1},_open:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.analyzers=[],this.models=[],this.groups=[],this._open=!1}render(){let t=this.analyzers.length>1,r=this.models.length>1;if(!t&&!r)return g;let n=a.filterAnalyzer===""?void 0:a.filterAnalyzer===Ar?null:a.filterAnalyzer,o=a.filterModel===""?void 0:a.filterModel===Tr?null:a.filterModel,i=new Map,s=new Map;for(let f of this.groups){let h=new Set,m=new Set;for(let b of f){let v=b._analyzer??null,y=Pi(b);(o===void 0||y===o)&&h.add(v),(n===void 0||v===n)&&m.add(y)}for(let b of h)i.set(b,(i.get(b)??0)+1);for(let b of m)s.set(b,(s.get(b)??0)+1)}let l=n===void 0?null:Wb(n),d=o===void 0?null:Kb(o),u=l!=null&&d!=null?`${l} \xB7 ${d}`:l??d??(t?"All analyzers":"All models"),p=l!=null||d!=null;return c`<button type="button" class="${T({"analyzer-btn":!0,active:p})}" popovertarget="analyzer-select-menu" popovertargetaction="toggle" title="Filter by analyzer / model" aria-label="${`Filter by analyzer / model: ${u}`}"><span class="analyzer-btn-label">${u}</span> <svg viewBox="0 0 12 12" width="11" height="11" aria-hidden="true"><path d="M2 4l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></button><div popover="auto" id="analyzer-select-menu" class="analyzer-menu" @beforetoggle="${this._onToggle}">${t?this._column({dim:"analyzer",heading:"Analyzer",allLabel:"All analyzers",values:this.analyzers,sentinel:Ar,labelOf:Wb,counts:i,current:a.filterAnalyzer}):g} ${t&&r?c`<div class="analyzer-menu-sep"></div>`:g} ${r?this._column({dim:"model",heading:"Model",allLabel:"All models",values:this.models,sentinel:Tr,labelOf:Kb,counts:s,current:a.filterModel}):g}</div>`}_column({dim:t,heading:r,allLabel:n,values:o,sentinel:i,labelOf:s,counts:l,current:d}){return c`<div class="analyzer-menu-col" role="group" aria-label="${`Filter by ${t}`}"><div class="analyzer-menu-head">${r}</div><button type="button" aria-pressed="${String(d==="")}" class="${T({"analyzer-menu-item":!0,active:d===""})}" @click="${()=>this._pick(t,"")}"><span class="analyzer-menu-label">${n}</span></button> ${o.map(u=>{let p=u??i,f=l.get(u)??0,h=d===p;return c`<button type="button" aria-pressed="${String(h)}" class="${T({"analyzer-menu-item":!0,active:h,zero:f===0})}" @click="${()=>this._pick(t,p)}"><span class="analyzer-menu-label">${s(u)}</span><span class="analyzer-menu-count">${f}</span></button>`})}</div>`}_pick(t,r){let n=t==="analyzer"?a.filterAnalyzer:a.filterModel,o=r!==""&&n===r?"":r;this.dispatchEvent(new CustomEvent("analyzer-change",{detail:{analyzer:t==="analyzer"?o:a.filterAnalyzer,model:t==="model"?o:a.filterModel},bubbles:!0,composed:!0}))}_onToggle=t=>{this._open=t.newState==="open",this._open&&this._position()};_position(){let t=this.querySelector(".analyzer-menu"),r=this.querySelector(".analyzer-btn");if(!t||!r)return;let n=r.getBoundingClientRect(),o=t.offsetWidth||240,i=t.offsetHeight||200,s=4,l=n.left;l+o>window.innerWidth-4&&(l=window.innerWidth-o-4),l<4&&(l=4);let d=n.bottom+s;d+i>window.innerHeight-4&&n.top>i+s&&(d=n.top-i-s),t.style.top=`${d}px`,t.style.left=`${l}px`}updated(){this._open&&this.querySelector(".analyzer-menu")?.matches(":popover-open")&&this._position()}};customElements.define("analyzer-select",Ou);var el=["type","model","effort","exportsMode"],Za=["security","correctness"],Y1=["max","xhigh","high","medium","low","minimal"],X1=["list","isolate"];function Gb(e,t){if(t==null)return e.length+1;let r=e.indexOf(t);return r===-1?e.length:r}var J1={type:e=>{if(e==="terminal")return Za.length+2;if(e==null)return Za.length+1;let t=Za.indexOf(e);return t===-1?Za.length:t},model:e=>e==null?1:0,effort:e=>Gb(Y1,e),exportsMode:e=>Gb(X1,e)};function Q1(e,t,r){for(let n of r){let o=J1[n],i=o(e[n])-o(t[n]);if(i!==0)return i;let s=String(e[n]??"").localeCompare(String(t[n]??""));if(s!==0)return s}return 0}function qb(e,t,{typePrefix:r=!0}={}){return e==="type"?r?`analyzer: ${t??"null"}`:`${t??"null"}`:t??null}function Z1(e,t){let r=t.filter(i=>i!=="exportsMode"),n=[],o=new Map;for(let i of e){if(i.exportsMode==null){n.push({...i});continue}let s=r.map(u=>i[u]??"").join("|"),l=o.get(s);if(l){l.exportsMode=`${l.exportsMode}+${i.exportsMode}`;continue}let d={...i};o.set(s,d),n.push(d)}return n}function Yb(e,t=el){let r=new Map;for(let h of e){let m={};for(let v of t)m[v]=v==="model"?Fi(h.model)??null:h[v]??null;let b=t.map(v=>m[v]??"").join("|");r.has(b)||r.set(b,m)}let n=[...r.values()].toSorted((h,m)=>Q1(h,m,t));if(n.length===0)return[];let o={};for(let h of t)o[h]=new Set(n.map(m=>m[h])).size===1;let i=t.filter(h=>!o[h]),s=i.includes("exportsMode")?Z1(n,t):n,l=s.length>2&&i.includes("type")&&i.length>1,d=["model","effort"].filter(h=>t.includes(h)&&o[h]),u=[...d,...t.filter(h=>!d.includes(h))],p=[],f=!1;for(let h of u)if(o[h]){let m=qb(h,s[0][h]);m!=null&&p.push(m)}else if(!f){for(let m of s){let b=i.map(v=>qb(v,m[v],{typePrefix:!l})).filter(v=>v!=null);b.length>0&&p.push(b.join(" \xB7 "))}f=!0}return p}var tl=null;function eS(){return tl||(tl=(async()=>await import("./prism.js"))(),tl)}var tS={js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",json:"json",css:"css",html:"markup",htm:"markup",xml:"markup",svg:"markup",yml:"yaml",yaml:"yaml",sh:"bash",bash:"bash",md:"markdown",markdown:"markdown",sol:"solidity",php:"php",phtml:"php",rs:"rust"};function rl(e){if(typeof e!="string")return null;let t=e.lastIndexOf(".");return t<0?null:tS[e.slice(t+1).toLowerCase()]??null}var rS={__proto__:null,js:"javascript",javascript:"javascript",mjs:"javascript",cjs:"javascript",node:"javascript",jsx:"jsx",ts:"typescript",typescript:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",json:"json",css:"css",html:"markup",htm:"markup",xml:"markup",svg:"markup",markup:"markup",yaml:"yaml",yml:"yaml",sh:"bash",bash:"bash",shell:"bash",zsh:"bash",console:"bash",md:"markdown",markdown:"markdown",sol:"solidity",solidity:"solidity",rs:"rust",rust:"rust",php:"php",phtml:"php"};function Xb(e){return typeof e!="string"?null:rS[e.toLowerCase()]??null}async function oo(e,t){if(!t)return null;try{return(await eS()).highlight(e,t)}catch{return null}}var Du=new Map,zu=new Set,Uu=!1;function nS(){Uu||(Uu=!0,queueMicrotask(()=>{Uu=!1,a.codeBlockTick++,x()}))}function Hu(e,t){let r=Xb(t);if(!r||!e)return null;let n=`${r}\0${e}`;return Du.has(n)?Du.get(n):(zu.has(n)||(zu.add(n),(async()=>{let o=await oo(e,r);Du.set(n,o??null),zu.delete(n),nS()})()),null)}var oS=new Set(["module","commonjs","json","module-typescript","commonjs-typescript"]),iS=new Set(["solidity","php","shell","rust"]),sS=new Set(["java","kotlin","gradle","objc","objcpp","swift","c","cpp","c-header","cpp-header","ruby","cmake","podspec","podfile","podfile-lock","template","xml","env","fastlane","pbxproj"]),aS=new Set(["resource","resource:base64"]),Zb=new Set(["stat:file","stat:directory"]),ey=new Set([...oS,...iS,...sS,...aS,"patch","directory",...Zb]),Vu=e=>Zb.has(e),Jb=e=>e==="directory"||e==="stat:directory"?"directory":"file";function lS(e,t,r){if(e===t)return e;let n=Vu(e),o=Vu(t);if(n!==o&&Jb(e)===Jb(t))return n?t:e;throw new Error(`format conflict for '${r}' ('${t}' vs '${e}')`)}function io(e,t){return t===""?e:e==="."?t:`${e}/${t}`}function ty(e,{scope:t="full"}={}){let r=new Set;for(let[n,{files:o}]of e)if(!(t!=="full"&&!lo(n)))for(let i of Object.keys(o))r.add(io(n,i));return r}function cS(e,{what:t,files:r,formats:n,scope:o}){if(mt(e))return"escapes the root";if(o!=="full"&&!lo(e))return`is outside node_modules, which a '${o}'-scope ${t} does not record`;if(!r.has(e))return`names no file the ${t} records`;let i=n.get(e);return i==="directory"?"is a directory capture, not a file":Vu(i)?`is a payload-free '${i}' record, not a file`:null}function ry(e,{what:t,files:r,formats:n,scope:o}){for(let i of e){let s=cS(i,{what:t,files:r,formats:n,scope:o});j(s===null,`${t}: executable entry '${i}' ${s}`)}}function ny(e,{what:t,files:r,formats:n,scope:o="full"}){if(e===void 0)return new Set;let i=`${t}: executable`;j(Array.isArray(e),`${i} must be an array of file paths`);let s=new Set;for(let l of e)j(typeof l=="string"&&l!=="",`${i} entry must be a non-empty string`),j(!s.has(l),`${i} entry '${l}' is listed twice`),s.add(l);return ry(s,{what:t,files:r,formats:n,scope:o}),s}function oy(e,{what:t,modules:r,formats:n,scope:o}){if(e.size!==0)return ry(e,{what:t,files:ty(r,{scope:o}),formats:n,scope:o}),nl(e)}function j(e,t){if(!e)throw new Error(t)}function so(e,t){let[r,n]=[e.split("/"),t.split("/")];for(;r.length>0&&r[0]===n[0];)r.shift(),n.shift();if(r.length===0&&n.length===0)return 0;if(r.length<2)return n.length<2&&r>n?1:-1;if(n.length<2)return 1;if(r[0]==="*")return-1;if(n[0]==="*"||r[0]==="node_modules")return 1;if(n[0]==="node_modules")return-1;let[o,i]=[r,n].map(s=>s.join(String.fromCodePoint(0)));if(o<i)return-1;if(o>i)return 1;throw new Error("Unreachable")}var Di=e=>e&&[null,Object.prototype].includes(Object.getPrototypeOf(e)),ao=e=>Object.setPrototypeOf(Object.fromEntries(e),null),nl=e=>[...e].toSorted((t,r)=>so(t,r)),Ni=(e,{sorted:t=!0}={})=>{if(!t){let r=Object.create(null);for(let[n,o]of e)r[n]=o instanceof Map?Ni(o,{sorted:t}):o;return r}return ao([...e].toSorted((r,n)=>so(r[0],n[0])).map(([r,n])=>[r,n instanceof Map?Ni(n,{sorted:t}):n]))},ju=e=>new Map(Object.entries(e).map(([t,r])=>[t,Di(r)?ju(r):r]));function mt(e){if(e.startsWith("/"))return!0;let t=0;for(let r of e.split("/"))if(!(r==="."||r==="")){if(r!=="..")t++;else if(--t<0)return!0}return!1}function dS(e,t){let r=e instanceof Map;if(r!==t instanceof Map)return!1;if(!r)return e===t;if(e.size!==t.size)return!1;for(let[n,o]of e)if(t.get(n)!==o)return!1;return!0}var Qb=e=>e instanceof Map?`{${[...e].map(([t,r])=>`${t}: ${r}`).join(", ")}}`:e;function iy(e,t,r){let n=new Map,o=i=>{for(let[s,l]of i){let d=n.get(s);d===void 0&&n.set(s,d=new Map);for(let[u,p]of l){let f=d.get(u);f===void 0&&d.set(u,f=new Map);for(let[h,m]of p)f.has(h)?j(dS(f.get(h),m),`${r}: import '${h}' from '${u}' resolves differently ('${Qb(f.get(h))}' vs '${Qb(m)}')`):f.set(h,m instanceof Map?new Map(m):m)}}};return o(e),o(t),n}function sy(e,t,r){let n=new Map,o=i=>{for(let[s,l]of i){let d=n.get(s);if(d===void 0){n.set(s,l);continue}try{n.set(s,lS(l,d,s))}catch(u){throw new Error(`${r}: ${u.message}`,{cause:u})}}};return o(e),o(t),n}function ay(e,t,r,n){if(e.size===0)return new Set(t);let o=ty(r,{scope:n}),i=new Set(t);for(let s of e)o.has(s)||i.add(s);return i}function ly(e,t,r){let n=new Map,o=i=>{for(let[s,l]of i){let d=n.get(s);if(d===void 0){n.set(s,{name:l.name,version:l.version,...l.ecosystem===void 0?{}:{ecosystem:l.ecosystem},files:Object.assign(Object.create(null),l.files)});continue}j(d.name===l.name,`${r}: module '${s}' name mismatch ('${d.name}' vs '${l.name}')`),j(d.version===l.version,`${r}: module '${s}' version mismatch ('${d.version}' vs '${l.version}')`),j(d.ecosystem===l.ecosystem,`${r}: module '${s}' ecosystem mismatch ('${d.ecosystem??"(none)"}' vs '${l.ecosystem??"(none)"}')`);for(let[u,p]of Object.entries(l.files))Object.hasOwn(d.files,u)?j(d.files[u]===p,`${r}: content mismatch for '${io(s,u)}'`):d.files[u]=p}};return o(e),o(t),n}function lo(e){return e.split("/").includes("node_modules")}function uS(e){let t="node_modules/",r=e.length;for(;(r=e.lastIndexOf(t,r-1))!==-1;)if(r===0||e[r-1]==="/")return r;return-1}function cy(e){let t="node_modules/",r=uS(e);if(r===-1)return null;let n=r+t.length,o=e.slice(n).split("/"),i=o[0].startsWith("@")?2:1;if(o.length<=i||o.slice(0,i).some(l=>!l))return null;let s=o.slice(0,i).join("/");return{dir:e.slice(0,n)+s,rel:o.slice(i).join("/"),name:s}}var Ir=1,dy=0,uy=({name:e,version:t,ecosystem:r,files:n})=>(j(r===void 0||typeof r=="string"),{name:e,version:t,...r===void 0?{}:{ecosystem:r},files:ao(Object.entries(n))}),pS=e=>cy(e)??{dir:".",rel:e,name:null},py=(e,t)=>{if(e===void 0)return t;if(t===void 0)return e;let r={};for(let n of[e,t])for(let[o,i]of Object.entries(n))r[o]=nl(new Set([...r[o]??[],...i]));return r},ol=class e{static VERSION=Ir;version=Ir;config;entries;modules;formats;imports;executable;reason;constructor({config:t={scope:"full"},entries:r,modules:n,formats:o,imports:i,executable:s,reason:l,version:d=Ir}={}){j([dy,Ir].includes(d)),j(["node_modules","full"].includes(t.scope)),this.version=d,this.config=t,this.entries=r??new Set,this.modules=n??new Map,this.formats=o??new Map,this.imports=i??new Map,this.executable=s??new Set,this.reason=l}get sources(){let t=new Map;for(let[r,{files:n}]of this.modules)for(let[o,i]of Object.entries(n))t.set(io(r,o),i);return t}static isResourceFormat(t){return t==="resource"||t==="resource:base64"||t==="directory"}get hasCode(){for(let[t,{files:r}]of this.modules)for(let n of Object.keys(r))if(!e.isResourceFormat(this.formats.get(io(t,n))))return!0;return!1}static parse(t){let r=JSON.parse(t);j(r.version===Ir||r.version===dy),j(["node_modules","full"].includes(r.config?.scope)),j(Di(r.formats)),j(Di(r.imports));let n=new Map;for(let[u,p]of Object.entries(r.formats)){j(!mt(u)),j(ey.has(p),`unknown format '${p}' for ${u}`);let f=u===""?".":u;j(!n.has(f),`duplicate format key '${f}'`),n.set(f,p)}let o=new Map,i=new Set;if(r.version===Ir){let u=r.config.scope==="full";if(r.modules!==void 0){j(typeof r.modules=="object"&&r.modules!==null);for(let[p,f]of Object.entries(r.modules))j(lo(p)),j(!mt(p)),j(f?.name&&f.version&&f.files),o.set(p,uy(f))}if(u){j(r.sources&&typeof r.sources=="object");for(let[p,f]of Object.entries(r.sources))j(!lo(p)),j(!mt(p)),j(f?.name&&f.version&&f.files),o.set(p,uy(f));j(r.entries===void 0||Array.isArray(r.entries)),i=new Set(r.entries)}else j(r.entries===void 0),j(r.sources===void 0);for(let[,{files:p}]of o)for(let f of Object.keys(p))j(!mt(f))}else{j(r.sources);for(let[u,p]of Object.entries(r.sources)){j(!mt(u));let{dir:f,rel:h,name:m}=pS(u);j(!mt(f)&&!mt(h)),o.has(f)||o.set(f,{name:m,version:null,files:Object.create(null)}),o.get(f).files[h]=p}}let s=new Set;for(let[u,{files:p}]of o)for(let f of Object.keys(p)){let h=io(u,f);j(!s.has(h),`duplicate file key '${h}' across bundle buckets`),s.add(h)}let l=ju(r.imports),d=u=>{if(typeof u=="string"){j(!mt(u));return}j(u instanceof Map&&u.size>0,"import target must be a file or a non-empty {platform: file} map");for(let[p,f]of u)j(typeof p=="string"&&p.length>0&&!p.includes("/"),`invalid platform key '${p}'`),j(typeof f=="string"),j(!mt(f))};for(let[,u]of l){j(u instanceof Map);for(let[p,f]of u){j(!mt(p)),j(f instanceof Map);for(let[,h]of f)d(h)}}return new e({version:r.version,config:r.config,entries:i,modules:o,formats:n,imports:l,executable:r.version===Ir?ny(r.executable,{what:"bundle",files:s,formats:n,scope:r.config.scope}):new Set,reason:Di(r.reason)?r.reason:void 0})}#e(){let t=[],r=[];for(let[n,{name:o,version:i,ecosystem:s,files:l}]of this.modules){if(Object.keys(l).length===0)continue;let d=lo(n);d&&j(o&&i&&l);let u=ao(Object.entries(l).toSorted((f,h)=>so(f[0],h[0])));(d?t:r).push([n,{name:o,version:i,...s===void 0?{}:{ecosystem:s},files:u}])}return t.sort((n,o)=>so(n[0],o[0])),r.sort((n,o)=>so(n[0],o[0])),{modules:ao(t),sources:ao(r)}}serialize(){let t=nl(this.entries),{modules:r,sources:n}=this.#e(),o=Ni(this.formats),i=Ni(this.imports),s={version:Ir,config:this.config};this.config.scope==="full"&&Object.assign(s,{entries:t,sources:n}),Object.assign(s,{modules:r,formats:o,imports:i});let l=oy(this.executable,{what:"bundle",modules:this.modules,formats:this.formats,scope:this.config.scope});return l!==void 0&&(s.executable=l),this.reason!==void 0&&(s.reason=this.reason),JSON.stringify(s,void 0,2)}withReason(t){let r=[...this.sources.keys()];return new e({version:this.version,config:this.config,entries:this.entries,modules:this.modules,formats:this.formats,imports:this.imports,executable:this.executable,reason:py(this.reason,{[t]:r})})}merge(t){return j(this.config.scope===t.config.scope,`bundle merge: scope mismatch ('${this.config.scope}' vs '${t.config.scope}')`),new e({config:{scope:this.config.scope},entries:new Set([...this.entries,...t.entries]),modules:ly(this.modules,t.modules,"bundle merge"),formats:sy(this.formats,t.formats,"bundle merge"),imports:iy(this.imports,t.imports,"bundle merge"),executable:ay(this.executable,t.executable,t.modules,this.config.scope),reason:py(this.reason,t.reason)})}};var il=null,sl=null,al=null;function fS(){for(let e of["br","brotli"])try{return new DecompressionStream(e),e}catch{}return null}async function hS(e,t){let r=new Blob([t]).stream().pipeThrough(new DecompressionStream(e));return new Uint8Array(await new Response(r).arrayBuffer())}async function gS(){if("serviceWorker"in navigator)try{let e=await navigator.serviceWorker.getRegistrations();for(let t of e){let r=t.active?.scriptURL??t.installing?.scriptURL??t.waiting?.scriptURL;r&&r.endsWith("/brotli-sw.js")&&await t.unregister()}}catch{}}function mS(){return al||(al=(async()=>await import("./brotli-fallback.js"))(),al)}async function bS(){await gS();let e=fS();return e?(il={kind:"native",format:e},il):(il={kind:"fallback"},il)}function fy(){return sl||(sl=bS(),sl)}async function hy(e){let t=await fy();return t.kind==="native"?hS(t.format,e):(await mS()).brotliDecompress(e)}fy().catch(()=>{});var Wu=(e,t,r)=>{for(let n of t)if(n[0]===e)return(0,n[1])();return r?.()};var co='<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2 2 5v6l6 3 6-3V5L8 2Z"/><path d="M2 5l6 3 6-3"/><path d="M8 8v6"/></svg>',ll='<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="4" width="11" height="9" rx="1.2"/><path d="M6 4V3h4v1"/></svg>';function Ke(e){let t=new Map;if(!e)return t;if(e.kind==="stasis"){if(!e.bundle)return t;for(let[r,n]of e.bundle.sources)typeof n=="string"&&t.set(r,n)}else if(e.kind==="sourcemap"){if(!e.json)return t;let r=e.json.sources??[],n=e.json.sourcesContent??[];for(let o=0;o<r.length;o++)typeof n[o]=="string"&&t.set(r[o],n[o])}return t}function Mr(e){if(e?.kind!=="stasis"||!e.bundle?.modules)return null;let t=new Map;for(let[r,n]of e.bundle.modules)for(let o of Object.keys(n.files))t.set(r==="."?o:`${r}/${o}`,r);return t}function zi(e){let t=new Map;if(e?.kind!=="stasis"||!e.bundle?.modules)return t;for(let[r,n]of e.bundle.modules){if(!r.includes("node_modules")||!n?.name||typeof n.version!="string"||!n.version)continue;let o=t.get(n.name);o||(o=new Set,t.set(n.name,o)),o.add(n.version)}return t}var gy="@preventive/triage";function Ku(e,t){let r=e.toLowerCase(),n="",o=r;if(r.startsWith("@")){let s=r.indexOf("/");s>0&&(n=r.slice(0,s),o=r.slice(s+1))}return`pkg:npm/${n?`${encodeURIComponent(n)}/`:""}${encodeURIComponent(o)}@${encodeURIComponent(t)}`}function cl(e){let t=/^(.*?)\.stasis\.(?:code|resources)\.br$/u.exec(e);return t?t[1]:e.replace(/\.[^.]+$/u,"")||e}function my(e){let t=[];if(e?.kind!=="stasis"||!e.bundle?.modules)return t;let r=new Map;for(let[n,o]of e.bundle.modules){if(!o?.name||typeof o.version!="string"||!o.version)continue;let i=`${o.name}@${o.version}`,s=r.get(i);if(s!==void 0){n==="."&&(t[s].dir=".");continue}r.set(i,t.length),t.push({name:o.name,version:o.version,dir:n})}return t}function by(e){if(e?.kind!=="stasis"||!e.bundle?.modules)return!1;for(let[,t]of e.bundle.modules)if(t?.name&&typeof t.version=="string"&&t.version)return!0;return!1}function yy(e,t){let r=e.find(i=>i.dir===".")??null,n=r?e.filter(i=>i!==r):e;return{root:r?{name:r.name,version:r.version,purl:Ku(r.name,r.version)}:{name:cl(t?.name??"bundle"),version:null,purl:null},rest:n}}function vy(e){return e??globalThis.crypto.randomUUID()}function wy(e,t,{now:r=new Date,uuid:n}={}){let o=my(e),{root:i,rest:s}=yy(o,t),l={type:"application","bom-ref":i.purl??`application:${i.name}`,name:i.name};i.version&&(l.version=i.version),i.purl&&(l.purl=i.purl);let d={bomFormat:"CycloneDX",specVersion:"1.5",serialNumber:`urn:uuid:${vy(n)}`,version:1,metadata:{timestamp:r.toISOString(),tools:{components:[{type:"application",name:gy}]},component:l},components:s.map(u=>{let p=Ku(u.name,u.version);return{type:"library","bom-ref":p,name:u.name,version:u.version,purl:p}})};return`${JSON.stringify(d,null,2)}
86
- `}function yS(e){return{referenceCategory:"PACKAGE-MANAGER",referenceType:"purl",referenceLocator:e}}function ky(e,t,{now:r=new Date,uuid:n}={}){let o=my(e),{root:i,rest:s}=yy(o,t),l=cl(t?.name??"bundle"),d=r.toISOString().replace(/\.\d{3}Z$/u,"Z"),u=(b,v,y,w)=>{let k={SPDXID:b,name:v,downloadLocation:"NOASSERTION",filesAnalyzed:!1,licenseConcluded:"NOASSERTION",licenseDeclared:"NOASSERTION",copyrightText:"NOASSERTION"};return y&&(k.versionInfo=y),w&&(k.externalRefs=[yS(w)]),k},p="SPDXRef-Package-root",f=[u(p,i.name,i.version,i.purl)],h=[{spdxElementId:"SPDXRef-DOCUMENT",relationshipType:"DESCRIBES",relatedSpdxElement:p}];s.forEach((b,v)=>{let y=`SPDXRef-Package-${v+1}`;f.push(u(y,b.name,b.version,Ku(b.name,b.version))),h.push({spdxElementId:p,relationshipType:"DEPENDS_ON",relatedSpdxElement:y})});let m={spdxVersion:"SPDX-2.3",dataLicense:"CC0-1.0",SPDXID:"SPDXRef-DOCUMENT",name:l,documentNamespace:`https://spdx.org/spdxdocs/${encodeURIComponent(l)}-${vy(n)}`,creationInfo:{created:d,creators:[`Tool: ${gy}`]},packages:f,relationships:h};return`${JSON.stringify(m,null,2)}
87
- `}function vS(e,t){let r=t?"gu":"giu",n=t?"g":"gi";try{return{re:new RegExp(e,r)}}catch{try{return{re:new RegExp(e,n)}}catch(o){return{error:o.message}}}}function Gu(e,t,r){if(t){let i=vS(e,r);if(i.error)return{error:i.error};let{re:s}=i;return{ranges(l){s.lastIndex=0;let d=[],u;for(;(u=s.exec(l))!==null;){if(u[0].length===0){s.lastIndex++;continue}if(d.push([u.index,u.index+u[0].length]),d.length>=50)break}return d}}}let n=r?e:e.toLowerCase(),o=n.length;return{ranges(i){let s=r?i:i.toLowerCase(),l=[],d=0,u;for(;(u=s.indexOf(n,d))!==-1&&(l.push([u,u+o]),d=u+o,!(l.length>=50)););return l}}}function wS(e,t){let r=[...e.keys()].toSorted(),n=[],o=0,i=!1;for(let s of r){let l=e.get(s);if(typeof l!="string")continue;let d=l.split(`
88
- `),u=[];for(let p=0;p<d.length;p++){let f=t.ranges(d[p]);if(f.length!==0&&(u.push({ln:p+1,ranges:f}),o++,o>=5e3)){i=!0;break}}if(u.length>0&&n.push({path:s,lines:d,hits:u}),i)break;if(n.length>=500){i=!0;break}}return{fileResults:n,totalHits:o,truncated:i}}function kS(e,t){let r=[],n=0;for(let{path:o,lines:i,hits:s}of e.fileResults){let l=[];for(let{ln:d}of s){let u=t.ranges(i[d-1]);u.length!==0&&(l.push({ln:d,ranges:u}),n++)}l.length>0&&r.push({path:o,lines:i,hits:l})}return{fileResults:r,totalHits:n,truncated:!1}}var Je={tag:null,useRegex:!1,caseSensitive:!1,entries:[]};function $y(e,t,r,n,o){if(!r)return{fileResults:[],totalHits:0,truncated:!1};let i=Gu(r,n,o);if(i.error)return{error:i.error};(Je.tag!==e||Je.useRegex!==n||Je.caseSensitive!==o)&&(Je.tag=e,Je.useRegex=n,Je.caseSensitive=o,Je.entries.length=0);let s=n||o?f=>f:f=>f.toLowerCase(),l=s(r),d=null,u=-1;for(let f=0;f<Je.entries.length;f++){let h=Je.entries[f],m=s(h.query);if(m===l)return Je.entries.splice(f,1),Je.entries.unshift(h),h.result;n||h.result.truncated||m.length<=u||!l.includes(m)||(d=h.result,u=m.length)}let p=d?kS(d,i):wS(t,i);return Je.entries.unshift({query:r,result:p}),Je.entries.length>8&&Je.entries.pop(),p}function bt(e,{splitOwnDirs:t=!0,packageDir:r=null}={}){let n=/(?:^|\/)(?:node_modules|dependencies)\/(@[^/]+\/[^/]+|[^/]+)/gu,o;for(;(o=n.exec(e))!==null;)if(o[1]!==".pnpm")return o[1];if(r&&r!=="."&&!r.includes("node_modules"))return r;if(t){let i=e.indexOf("/");if(i>0)return e.slice(0,i)}return"__own__"}function xy(e,t=null){let r=new Set;for(let n of e){let o=t?.(n)??null;if(bt(n,{splitOwnDirs:!1,packageDir:o})==="__own__"&&(r.add(bt(n,{splitOwnDirs:!0,packageDir:o})),r.size>1))return!0}return!1}function Ui(e){return"tree-"+e.replaceAll(/[^\w-]+/gu,"_")}var _y=()=>Object.fromEntries(_e.map(e=>[e,0]));function qu(e,t){let r=new Map;for(let n of e)for(let o of n){r.has(o.file)||r.set(o.file,_y());let i=r.get(o.file),s=ne(o,t);i[s]!==void 0&&i[s]++}return r}function Yu(e){let t=null;for(let r of e)if(r?.tree){t||(t={});for(let n of Object.keys(r.tree)){let o=r.tree[n];if(!t[n]){t[n]={...o,imports:[...o.imports??[]]};continue}let i=new Set(t[n].imports);for(let s of o.imports??[])i.has(s)||(i.add(s),t[n].imports.push(s));t[n].size==null&&o.size!=null&&(t[n].size=o.size)}}return t}function dl(e,t){let r=new Map;for(let n of Object.keys(e)){let o=new Set,i=[...(e[n].imports??[]).filter(l=>e[l])];for(;i.length>0;){let l=i.pop();if(!o.has(l)){o.add(l);for(let d of e[l]?.imports??[])e[d]&&i.push(d)}}let s=_y();for(let l of o){let d=t.get(l);if(d)for(let u of _e)s[u]+=d[u]??0}r.set(n,s)}return r}function Xu(e,t,r){let n=t.get(e),o=r.get(e);return Sy(n)>0||Sy(o)>0}function Sy(e){if(!e)return 0;let t=0;for(let r of _e)t+=e[r]??0;return t}function Ey(e){if(!e)return null;let t=vb(),r=new RegExp(`^(?:.*/)?${t}/(@[^/]+/[^/]+|[^/]+)`,"u"),n=e.match(r);if(n)return n[1];let o=e.indexOf("/");return o>0?e.slice(0,o):"/"}var $S=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],Cy=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];function xS(){if(typeof document>"u")return!1;let e=document.body?.classList;return!!e&&(e.contains("theme-light")||e.contains("theme-pink"))}var Ju=new Map;function Qe(e){let t=xS()?Cy:$S,n=`${t===Cy?"l":"d"}:${e??"__own__"}`;if(Ju.has(n))return Ju.get(n);let o=e??"__own__",i=0;for(let u of o)i=i*37+u.codePointAt(0)|0;let l=((i%t.length+t.length)%t.length*7+3)%t.length,d=t[l];return Ju.set(n,d),d}function SS(){return{showAll:!1,splitOwnDirs:!1,packagesView:!1,selected:null,focusedPkg:null,topPkgsTab:"issues",edgeOpacity:.22,nodeSize:1,showLabels:!1,selectedSeverities:new Set,selectedColors:new Set,pathFilter:"",hidden:new Set,solo:null,graphState:null,layoutCache:null}}var Fr=SS(),A=new Proxy(Fr,{get(e,t){return Fr[t]},set(e,t,r){return Fr[t]=r,!0},has(e,t){return t in Fr},deleteProperty(e,t){return delete Fr[t]},ownKeys(){return Reflect.ownKeys(Fr)},getOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(Fr,t)}});function Be(){A.graphState?._cleanup&&A.graphState._cleanup(),A.graphState=null}function Ay(){return Fr}var Hi=null,Ty=null;function uo(){return Ty}function _S(){return Hi||(Hi=(async()=>{let e="./graph.js";try{let t=await import(e);return t._swapGraph2Impl(Ay()),Ty=t,t}catch(t){throw Hi=null,t}})(),Hi)}async function Qu(e,t,r,n,o){try{let i=await _S(),s=i.buildGraphFromPrep(t);Y(c`<graph-layout .graph="${s}" .options="${r}"></graph-layout>`,e);let l=e.querySelector("graph-layout");return await l.updateComplete,n(),o(),i.attachGraph2Interaction(e,s,n,o),l}catch(i){let s=i instanceof Error?i.message:String(i);return e.textContent=`Graph failed to load: ${s}`,null}}var Ce=`.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: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: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{margin:0;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, #f87171);font-size:.72rem;line-height:1.35}
89
- `;var Zu=class extends I{static styles=[...I.styles,B(Ce)];static properties={reportName:{type:String},workspaceNames:{type:Array},existingNames:{type:Object},_choice:{state:!0},_newName:{state:!0}};constructor(){super(),this.reportName="",this.workspaceNames=[],this.existingNames=new Set,this._choice="replace",this._newName=""}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_onClose=()=>this._finish({action:"cancel"});_onCancel=()=>this._finish({action:"cancel"});_onChoiceChange=t=>{this._choice=t.target.value};_onNewNameInput=t=>{this._newName=t.target.value};_onNewNameKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onConfirm())};_onConfirm=()=>{if(this._choice==="rename"){let t=(this._newName??"").trim();if(!this._isRenameValid(t))return;this._finish({action:"rename",newName:t});return}this._finish({action:"replace"})};_replaceHint(){let t=this.workspaceNames.length;if(t===0)return c`<span class="lwd-option-hint">The local file will be overwritten.</span>`;let r=t===1?c`workspace <strong>"${this.workspaceNames[0]}"</strong>`:c`<strong>${t}</strong> workspaces (${this.workspaceNames.join(", ")})`;return c`<span class="lwd-option-hint">The local file will be overwritten. When sync is online, the new bytes are also uploaded to ${r} so the cloud copy matches.</span>`}_renameValidationTpl(t){return t?t===this.reportName?c`<p class="lwd-rename-error">Pick a name different from the original.</p>`:t.includes("\0")?c`<p class="lwd-rename-error">The new name cannot contain a NUL byte.</p>`:t.includes("/")||t.includes("\\")?c`<p class="lwd-rename-error">The new name cannot contain "/" or "\\".</p>`:this.existingNames.has(t)?c`<p class="lwd-rename-error">A file named "${t}" already exists — pick something else.</p>`:g:c`<p class="lwd-rename-error">Enter a new name.</p>`}_isRenameValid(t){return t.length>0&&t!==this.reportName&&!t.includes("\0")&&!t.includes("/")&&!t.includes("\\")&&!this.existingNames.has(t)}render(){let t=this._choice==="rename",r=(this._newName??"").trim(),n=t&&!this._isRenameValid(r),o=t?"Rename":"Replace",i=t?"primary":"danger",s=this.workspaceNames.length>0?c`<span class="lwd-option-hint">Saved as an unfiled report — the renamed copy isn't added to any workspace.</span>`:g;return c`<dialog @close="${this._onClose}"><header><h3>Import conflict</h3></header><p class="lwd-body"><strong>"${this.reportName}"</strong> already exists with different content.</p><fieldset class="lwd-choice"><legend>What should happen?</legend><label class="lwd-option"><input type="radio" name="icd-choice" value="replace" ?checked="${this._choice==="replace"}" @change="${this._onChoiceChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Replace</span> ${this._replaceHint()}</span></label> <label class="lwd-option"><input type="radio" name="icd-choice" value="rename" ?checked="${this._choice==="rename"}" @change="${this._onChoiceChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Rename to</span> <input type="text" class="nwd-input lwd-rename-input" maxlength="200" .value="${this._newName}" ?disabled="${!t}" @input="${this._onNewNameInput}" @keydown="${this._onNewNameKeydown}" @focus="${()=>{this._choice="rename"}}"> ${s} ${t?this._renameValidationTpl(r):g}</span></label></fieldset><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="${i}" ?disabled="${n}" @click="${this._onConfirm}">${o}</button></footer></dialog>`}};customElements.define("import-conflict-dialog",Zu);function Ry({name:e,workspaceNames:t,existingNames:r}={}){let n=r instanceof Set?r:new Set(r??[]);return new Promise(o=>{let i=document.createElement("import-conflict-dialog");Object.assign(i,{reportName:e??"",workspaceNames:Array.isArray(t)?t:[],existingNames:n,_newName:ES(e??"",n)}),i.addEventListener("resolve",s=>{i.remove(),o(s.detail)}),i.addEventListener("modal-conflict",()=>{i.remove(),o({action:"cancel"})}),document.body.append(i)})}function ES(e,t){if(typeof e!="string"||e.length===0)return"";let r=e.lastIndexOf("."),n=r>0?e.slice(0,r):e,o=r>0?e.slice(r):"",i=n.replace(/-\d+$/u,"");for(let s=2;s<1e3;s++){let l=`${i}-${s}${o}`;if(!t.has(l))return l}return""}var AS=["finding_url","repository","title","description","severity","configured_scan_id","relevant_paths"];function TS(e){let t=[],r=[],n="",o=!1,i=e.length;for(let s=0;s<i;s++){let l=e[s];o?l==='"'?e[s+1]==='"'?(n+='"',s++):o=!1:n+=l:l==='"'?o=!0:l===","?(r.push(n),n=""):l===`
90
- `||l==="\r"?(r.push(n),t.push(r),r=[],n="",l==="\r"&&e[s+1]===`
91
- `&&s++):n+=l}for((n!==""||r.length>0)&&(r.push(n),t.push(r));t.length>0&&t.at(-1).length===1&&t.at(-1)[0]==="";)t.pop();return t}function Iy(e){let t=TS(e);if(t.length<2)throw new Error("Codex CSV: empty or missing header row");let r=t[0],n=l=>r.indexOf(l);for(let l of AS)if(n(l)===-1)throw new Error(`Codex CSV: missing required column "${l}"`);let o={finding_url:n("finding_url"),repository:n("repository"),title:n("title"),description:n("description"),severity:n("severity"),detected_at:n("detected_at"),committed_at:n("committed_at"),configured_scan_id:n("configured_scan_id"),commit_hash:n("commit_hash"),relevant_paths:n("relevant_paths")},i=new Map;for(let l=1;l<t.length;l++){let d=t[l];if(d.length===1&&d[0]==="")continue;let u=d[o.configured_scan_id];u&&(i.has(u)||i.set(u,[]),i.get(u).push(d))}if(i.size===0)throw new Error("Codex CSV: no rows with a configured_scan_id");let s=[];for(let[l,d]of i){let u=new Set(d.map(b=>b[o.repository]).filter(Boolean));if(u.size>1)throw new Error(`Codex CSV: scan ${l} contains multiple repositories: ${[...u].join(", ")}`);let p=[...u][0]||"unknown-repo",f=l.replace(/^[^:]+:/u,""),h=`${p}:${f}`,m=d.map(b=>RS(b,o));s.push({displayName:h,data:{type:"security",source:"codex-security",findings:m}})}return s}function RS(e,t){let r=(e[t.relevant_paths]||"").split(" | ").map(d=>d.trim()).find(Boolean)||"unknown",n="?",o=e[t.title]||"",i=e[t.description]||"",s=o&&i?`${o}
103
+ `)}function T_(t,{title:e,body:r}={}){let n=v_(t);if(!n)return null;let o;try{o=new URL(n).host.toLowerCase()}catch{return null}if(o!=="github.com")return null;let i=new URLSearchParams;e&&i.set("title",e),r&&i.set("body",r);let s=i.toString();return s?`${n}/issues/new?${s}`:`${n}/issues/new`}function l_(t){return t.length<=39&&A6.test(t)}function c_(t){return t.length<=100&&t!=="."&&t!==".."&&T6.test(t)}function F6(t){let e;try{e=new URL(t)}catch{return null}if(e.href!==t||e.protocol!=="https:"||e.hostname.toLowerCase()!=="github.com"||e.port||e.username||e.password)return null;let r=e.pathname.split("/");if(r.at(-1)===""&&r.pop(),r.length===3&&r[1]==="advisories"){let p=r[2];return a_.test(p)?{url:`https://github.com/advisories/${p}`,label:p}:null}if(r.length===6&&r[3]==="security"&&r[4]==="advisories"){let[,p,f,,,h]=r;return!l_(p)||!c_(f)||!a_.test(h)?null:{url:`https://github.com/${p}/${f}/security/advisories/${h}`,label:h}}if(r.length!==5)return null;let[,n,o,i,s]=r;if(!l_(n)||!c_(o))return null;let a;if(i==="issues"||i==="pull"){if(!M6.test(s))return null;a=`${n}/${o}#${s}`}else if(i==="commit"){if(!I6.test(s))return null;a=`${n}/${o}@${s.slice(0,7)}`}else return null;let c=L6.test(e.hash)?e.hash:"";return{url:`https://github.com/${n}/${o}/${i}/${s}${c}`,label:a}}function Ai(t){if(typeof t!="string")return null;let e=Vl(t);return e!==t||B6.test(t)?e.slice(0,8):null}function Vl(t){let e=String(t),r="https://chatgpt.com/codex/cloud/security/findings/";return e.startsWith(r)?e.slice(r.length):e}function O6(t){let e=u$(t);if(!e)return null;let r=Ai(e.id);return{url:`#${e.fragment}`,label:r?`finding ${r}`:"finding",self:!0}}function N6(t){let e=t.length;for(;e>0&&P6.has(t[e-1]);)e--;return e===t.length?t:t.slice(0,e)}function M_(t){if(typeof t!="string"||t.length===0)return[];let e=[],r=0;Qg.lastIndex=0;let n;for(;(n=Qg.exec(t))!==null;){let o=N6(n[0]),i=o?F6(o)??O6(o):null;i&&(n.index>r&&e.push(t.slice(r,n.index)),e.push(i),r=n.index+o.length,Qg.lastIndex=r)}return r<t.length&&e.push(t.slice(r)),e}var Ms,u_,Vu,Ku,h_,m_,Ul,ob,g_,Jg,h6,g6,w6,k6,x6,o_,$6,Zg,i_,C6,R6,A6,T6,M6,I6,L6,a_,B6,Qg,P6,ue=w(()=>{"use strict";Oe();Xg();ul();Ms=!0;u_=new Set(["refuted","unreachable"]);Vu=[{value:"confirmed",label:"Confirmed",kinds:["confirmed","partial","revalidation"]},{value:"unreachable",label:"Unreachable",kinds:["unreachable"]},{value:"refuted",label:"Refuted",kinds:["refuted"]}];Ku=["","exclude","only"];h_=qu("node_modules"),m_=qu("vendor"),Ul="node_modules",ob=qu(Ul),g_=f_(Ul);Jg=new WeakSet;h6=/^(.*(?:^|\/)node_modules\/(?:@[^/]+\/[^/]+|[^/]+))(?:\/|$)/u;g6=/^(?:@[\w.-]+\/)?[\w.-]+@[^/\s@]+$/u;w6=/^https?:\/\/(?:www\.)?github\.com\/([^/\s]+\/[^/\s]+)\/(?:blob|tree|blame)\/[^/\s]+\/(\S+)$/u,k6=/#L(\d+)(?:-L?(\d+))?$/u;x6=/^(?:\s+\S|[-*+] |\d+[.)] |>|#{1,6} |\||`{3}|~{3})/u;o_=/^( *)(`{3,}|~{3,})(.*)$/u,$6=/^[a-z0-9+#._-]{1,20}$/u;Zg=/^( *)(?:[-*+]|(\d{1,9})[.)]) +(?=\S)/u,i_=/^ {0,3}([-*_])(?: *\1){2,} *$/u;C6=/^(\d+)(?:\s*-\s*(\d+))?$/u;R6=[["Impact","impact"],["Reproduction","reproduction"],["Recommendation","recommendation"],["Confidence reason","confidenceReason"],["Revalidation verdict","revalidateVerdict"],["Revalidation recommendation","revalidateRecommendation"]];A6=/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u,T6=/^[a-zA-Z\d._-]+$/u,M6=/^[1-9]\d{0,9}$/u,I6=/^[a-fA-F\d]{7,40}$/u,L6=/^#[\w-]+$/u,a_=/^GHSA(?:-[0-9a-z]{4}){3}$/u;B6=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/u;Qg=/https?:\/\/[^\s<>"'`(){}[\]|\\^]+/giu,P6=new Set([")",".",",","!","?",";",":","'",'"',"*","]","}",">"])});function ep(){let t=new Set;if(l.currentWorkspace||!$l())return t;let e=l.currentFile??l.reports[0]?.fileName;if(!e)return t;let r=new Set;for(let n of l.reports)if(n.fileName===e)for(let o of n.groups)for(let i of o)i.id!=null&&r.add(String(i.id));for(let n of r)$i(n).some(o=>!r.has(o)&&yi(o).some(i=>i!==e))&&t.add(n);return t}var ab=w(()=>{"use strict";O()});function Kl(t){return li(t.model)||null}function lb(t){let e=Rn();if(e.filterAnalyzer){let r=t._analyzer??null,n=e.filterAnalyzer===vo?null:e.filterAnalyzer;if(r!==n)return!1}if(e.filterModel){let r=Kl(t),n=e.filterModel===wo?null:e.filterModel;if(r!==n)return!1}return!0}function cb(t){let e=typeof t._repoFallback=="string"&&t._repoFallback?t._repoFallback:null;return t.isApp&&!(t._source??t.source)&&e?e:typeof t.repo?.github=="string"&&t.repo.github?t.repo.github:e}function F_(t){let e=new Set;for(let r of t)for(let n of r)e.add(cb(n));return e}function Ls(){l.filterSeverities=new Set,l.filterColors=new Set,l.filterSources=new Set,l.filterAnalyzer="",l.filterModel="",l.filterRepo="",l.filterConfMin=0,l.filterConfMax=10,l.filterInclude="",l.filterIncludeNegate=!1,l.filterComment="",l.filterFix="",l.filterFlagged="",l.filterDuplicates="",l.filterCrossContext="",l.filterAppStacked="",l.filterRevalidate="",l.filterPartial="",l.sortBy="severity"}function B_(){let t={};for(let e of D6){let r=l[e];t[e]=r instanceof Set?new Set(r):r}return t}function Gl(t){db=t}function ql(){db=null}function Rn(){return db??l}function Wl(t){if(t.confidence!==void 0)return t.confidence;if(t.critical===!0||t._source)return 10}function ub(t){return t.every(e=>e.every(r=>Wl(r)!==void 0))&&t.some(e=>e.some(z6))}function O_(t,e){return t.some(r=>{let n=nb(r)?0:Wl(r);return n===void 0?e===0:n>=e})}function tp(t){let e=t.map(dr).filter(o=>o.length>0);if(!e.some(o=>o.some(i=>Wl(i)!==void 0)))return 0;let r=o=>e.reduce((i,s)=>i+(s.some(a=>(Wl(a)??-1)>=o)?1:0),0),n;for(r(6)<=25?n=6:r(7)<=25?n=7:n=8;n>0&&r(n-1)===r(n);)n--;return n}function P_(t){return Yr(t)||(t._source&&!t._sourcePass?"revalidation":"")}function pb(t){let e=Gu("confirmed","");return t.some(r=>e.includes(P_(r)))}function N_(t,e){return ub(t)?e:0}function D_(t){let e=new Set(t.ruledOutIds??[]);for(let r of t)for(let n of r)yo(n)&&e.add(j(n));for(let r of t){let n=dr(r);if(n.length!==0&&pb(n)){for(let o of r)if(e.add(j(o)),o.isApp&&Array.isArray(o.revalidateInputs))for(let i of o.revalidateInputs)i&&e.add(i)}}return e}function z_(t,e,r){let n=N_(t,e),o=t.filter(s=>O_(s,n));if(o.length===0)return!1;let i=new Set(Gu("confirmed",""));return t.some(s=>s.some(a=>i.has(Yr(a))))?o.every(s=>s.every(a=>r.has(j(a)))):!1}function fb(t,e){let r=t.map(dr).filter(n=>n.length>0);return z_(r,e,D_(t))?"confirmed":""}function rp(t){if(l.showRevalidation===!1||l.upstreamOnly||Tn())return!1;let e=t.map(dr).filter(o=>o.length>0),r=D_(t);if(!z_(e,tp(t),r))return!1;let n=N_(e,6);return e.every(o=>!O_(o,n)||!o.some(i=>ae(i,l.severityMode)!=="low")||o.every(i=>r.has(j(i))))}function Fs(t,{resetSort:e=!0}={}){l.filterConfMin=tp(t),l.filterConfMax=10,l.filterRevalidate=fb(t,l.filterConfMin),l.filterPartial="",e&&(l.sortBy=hb(t)?"priority-desc":"severity")}function hb(t){return!Array.isArray(t)||t.length===0?!1:t.every(e=>{if(U_(e)===void 0)return!1;let r=e.filter(o=>o.isApp);if(r.length===0)return!0;let n=e.some(o=>o.priority!==void 0);return r.some(o=>o.priority!==void 0||!n&&yo(o))})}function U_(t){let e=t.find(r=>r.priority!==void 0);return e?e.priority:t.some(yo)?0:void 0}function H_(t){let e=Rn();if(e.filterSources.size===1){let r=e.filterSources.has("own");if(r&&It(t.file)||!r&&!It(t.file))return!1}if(e.filterRevalidate){let r=Gu(e.filterRevalidate,e.filterPartial);if(r&&!r.includes(P_(t)))return!1}if(!e.filterRevalidate){let r=nb(t)?0:Wl(t);if(r===void 0){if(e.filterConfMin>0)return!1}else if(r<e.filterConfMin||e.filterConfMax<10&&r>e.filterConfMax)return!1}return!0}function U6(t){if(!H_(t))return!1;let e=Rn(),r=e.filterInclude.toLowerCase();if(e.filterSeverities.size>0&&!e.filterSeverities.has(ae(t,l.severityMode)))return!1;if(e.filterColors.size>0){let n=ye(t)?.color??"none";if(!e.filterColors.has(n))return!1}if(!lb(t))return!1;if(e.filterRepo){let n=cb(t),o=e.filterRepo===Ti?null:e.filterRepo;if(n!==o)return!1}if(r){let n=ye(t),o=y_(t).includes(r)||(n?.comment??"").toLowerCase().includes(r)||(n?.fix??"").toLowerCase().includes(r);return e.filterIncludeNegate?!o:o}return!0}function H6(t){let e=Rn();if(!e.filterComment&&!e.filterFix&&!e.filterFlagged)return!0;let r=n=>t.some(o=>n(ye(o)));if(e.filterComment){let n=r(o=>!!o?.comment);if(e.filterComment==="with"?!n:n)return!1}if(e.filterFix){let n=r(o=>!!o?.fix);if(e.filterFix==="with"?!n:n)return!1}if(e.filterFlagged){let n=r(o=>o?.flagged===!0);if(e.filterFlagged==="with"?!n:n)return!1}return!0}function j6(t){let e=t?.package?.npm;if(typeof e?.name=="string"&&e.name&&!qn(e))return e.name;let r=typeof t?.file=="string"?t.file:"";return/(?:^|\/)(?:node_modules|dependencies|vendor)\/(@[^/]+\/[^/]+|[^/]+)(?:\/|$)/u.exec(r)?.[1]??null}function j_(){return l.showRevalidation!==!1&&!l.upstreamOnly}function mb(t){if(j_())return!1;let e=dr(t);if(e.length<2)return!1;let r=new Set,n=new Set;for(let o of e){let i=cb(o);i&&r.add(i);let s=j6(o);s&&n.add(s)}return r.size>1||n.size>1}function gb(t){if(!j_()||dr(t).length===0)return!1;let r=t.filter(n=>n.isApp);return r.length>0&&r.length>1}function V_(t){return t.filter(e=>e.some(H_)).map(dr)}function ko(t){let e=!l.currentWorkspace&&Rn().filterDuplicates,r=e?ep():null,n=Rn().filterCrossContext,o=Rn().filterAppStacked;return t.filter(i=>i.some(U6)&&H6(i)&&(!e||e==="with"===i.some(s=>r.has(j(s))))&&(!n||n==="with"===mb(i))&&(!o||o==="with"===gb(i)))}function I_(t,e){let r=e==="desc"?-1:11;return(n,o)=>{let i=n[t]??r,s=o[t]??r;return(e==="desc"?s-i:i-s)||n.file.localeCompare(o.file)}}function W_(t){let e=t==="desc"?-1:11;return(r,n)=>{let o=r.confidence===void 0&&r.critical===!0,i=n.confidence===void 0&&n.critical===!0,s=r.confidence??(o?10:e),a=n.confidence??(i?10:e);return(t==="desc"?a-s:s-a)||(o===i?0:o?-1:1)||r.file.localeCompare(n.file)}}function np(t){let e=V6[l.sortBy];if(!e)return[...t];if(l.sortBy==="priority-desc"||l.sortBy==="priority-asc"){let r=l.sortBy==="priority-desc"?"desc":"asc",n=r==="desc"?-1:11;return t.map(o=>({p:U_(o),g:o})).toSorted((o,i)=>{let s=o.p??n,a=i.p??n;return(r==="desc"?a-s:s-a)||An(o.g).file.localeCompare(An(i.g).file)}).map(o=>o.g)}return t.map(r=>({p:An(r),g:r})).toSorted((r,n)=>e(r.p,n.p)).map(r=>r.g)}var vo,Ti,wo,D6,db,z6,L_,V6,Xr=w(()=>{"use strict";O();ue();ot();ab();vo="\0",Ti="",wo="";D6=["filterSeverities","filterColors","filterSources","filterAnalyzer","filterModel","filterRepo","filterConfMin","filterConfMax","filterInclude","filterIncludeNegate","filterComment","filterFix","filterFlagged","filterDuplicates","filterCrossContext","filterAppStacked","filterRevalidate","filterPartial"];db=null;z6=t=>t.confidence!==void 0||t.critical===!0;L_=W_("desc"),V6={severity:(t,e)=>(Ne[ae(e,l.severityMode)]||0)-(Ne[ae(t,l.severityMode)]||0)||L_(t,e)||parseInt(t.line,10)-parseInt(e.line,10),"confidence-desc":L_,"confidence-asc":W_("asc"),"priority-desc":I_("priority","desc"),"priority-asc":I_("priority","asc")}});function K_(t){return Object.fromEntries(Object.entries(t).filter(([e,r])=>e.startsWith("revalidate")&&r!=null))}function G_(t,e,r){let n=K_(e);if(!t._revalidationCopies){let o=K_(t);if(Object.keys(o).length===0&&Object.keys(n).length===0)return[];t._revalidationCopies=Object.keys(o).length>0?[{reportName:t._reportName??"",fields:o}]:[]}return Object.keys(n).length>0&&t._revalidationCopies.push({reportName:r,fields:n}),t._revalidationCopies}function q_(t){let e=new Map,r=new Set(ai);for(let{reportName:n,fields:o}of t)for(let[i,s]of Object.entries(o)){if(s==null)continue;let a=i==="revalidate"?Fe(o)||String(s).trim().toLowerCase():String(s).trim();if(i==="revalidate"&&!a||i==="revalidate"&&!r.has(a))continue;e.has(i)||e.set(i,new Map);let c=e.get(i);c.has(a)||c.set(a,new Set),c.get(a).add(n)}return[...e].filter(([,n])=>n.size>1).map(([n,o])=>({field:n,variants:[...o].map(([i,s])=>({value:i,reports:[...s]}))}))}var bb=w(()=>{"use strict";Oe()});function Y_(t,e){if(!t||!e||t===e)return!1;let r=!1;for(let[n,o]of Object.entries(e)){if(n.startsWith("_")||W6.has(n)||o==null)continue;if(n==="revalidate"){let s=Fe(e);if(!s)continue;let a=Fe(t);a?a!==s&&(r=!0):t[n]=o;continue}let i=t[n];if(i==null){t[n]=o;continue}n.startsWith("revalidate")&&String(i).trim()!==String(o).trim()&&(r=!0)}return r}function yb(t,e,r,n){if(!t||!e||t===e)return;(t.correctedSeverity||e.correctedSeverity)&&(t._correctedByReport??={[t._reportName??""]:{severity:zr(t),reason:t.correctedSeverityReason}},t._correctedByReport[r]={severity:zr(e),reason:e.correctedSeverityReason});let o=G_(t,e,r);(Y_(t,e)||n.has(t.id))&&n.set(t.id,{finding:t,copies:o})}var W6,vb=w(()=>{"use strict";Oe();bb();ue();W6=new Set(["correctedSeverity","correctedSeverityReason","isApp","isUpstream","source"])});function Yl(t,e=null){let r=e??t.filter(p=>p.isApp),n=t.filter(p=>!p.isApp);if(r.length===0||n.length===0)return[t];if(e&&t.some(p=>p.isApp))return[t];if(n.some(p=>typeof p.id!="string"||!p.id))return[t];let o=new Set(n.map(p=>p.id)),i=new Map,s=new Set;for(let p of r){let f=p.revalidateInputs===void 0?[]:p.revalidateInputs;if(!Array.isArray(f))return[t];for(let h of f){if(!o.has(h))return[t];s.add(h)}i.set(p,f)}if(s.size!==o.size)return[t];let a=new Map([...o].map(p=>[p,p])),c=p=>{let f=p;for(;a.get(f)!==f;)f=a.get(f);for(;a.get(p)!==f;){let h=a.get(p);a.set(p,f),p=h}return f};for(let p of i.values()){if(p.length===0)continue;let f=c(p[0]);for(let h of p)a.set(c(h),f)}let u=new Map;for(let p of t){let f=i.get(p),h=f?f.length>0?c(f[0]):p:c(p.id);u.has(h)||u.set(h,[]),u.get(h).push(p)}return u.size===1?[t]:[...u.values()]}var wb=w(()=>{"use strict"});function J_(t,{showRevalidation:e=!0,upstreamOnly:r=!1,hideRuledOut:n=!1,merges:o=[]}={}){let i=[],s=new Set;for(let b=0;b<t.length;b++){let v=t[b];for(let x of v.groups){for(let C of x)C.id&&["refuted","unreachable"].includes(Fe(C))&&s.add(C.id);let k=r?x.filter(C=>C.isUpstream&&Fe(C)!=="revalidation").map(X_):e?n?x.filter(C=>!["refuted","unreachable"].includes(Fe(C))):x:x.filter(C=>Fe(C)!=="revalidation").map(X_),$=k.length===x.length&&k.every((C,U)=>C===x[U])?x:k;$.length>0&&i.push({group:$,sourceGroup:x,reportIndex:b,reportName:v.fileName??"",hasApp:$.some(C=>C.isApp)})}}let a=i.map((b,v)=>v),c=i.map(b=>b.hasApp),u=b=>{let v=b;for(;a[v]!==v;)v=a[v];for(;a[b]!==v;){let x=a[b];a[b]=v,b=x}return v},p=(b,v)=>{b=u(b),v=u(v),b!==v&&(a[v]=b,c[b]||=c[v])},f=new Map;for(let b=0;b<i.length;b++)for(let v of i[b].group)v.id&&(f.has(v.id)||f.set(v.id,[]),f.get(v.id).push({index:b,app:v.isApp}));for(let b of f.values()){let v=new Map,x=b.find(k=>k.app);for(let{index:k}of b){x&&p(x.index,k);let $=i[k].reportIndex;v.has($)?p(v.get($),k):v.set($,k)}}for(let b of f.values()){let v=null;for(let{index:x}of b)c[u(x)]||(v===null?v=x:p(v,x))}for(let b of o){let v=null;for(let x of b)for(let{index:k}of f.get(x)??[])v===null?v=k:p(v,k)}let h=new Map;for(let b=0;b<i.length;b++){let v=u(b);h.has(v)||h.set(v,[]),h.get(v).push(i[b])}let g=new Map,y=[];for(let b of h.values()){let v=b[0].group,x=v.map(B=>B.id).filter(Boolean);if(b.length===1&&new Set(x).size===x.length&&o.length===0){let B=t.length>1&&v.find(N=>N.isApp);if(B){let N=[...v];N.workspaceKey=B.id??String(B._id),y.push(...kb(b,N,e,r))}else y.push(...kb(b,v,e,r));continue}let k=new Map,$=new Map,C=[];for(let{group:B,reportName:N}of b)for(let K of B)if(K.id&&$.has(K.id))yb($.get(K.id),K,N,k);else{let W={...K,_reportName:K._reportName??N};K.id&&$.set(K.id,W),C.push(W)}let U=new Set;for(let B of o)for(let N of B)$.has(N)&&U.add(N);for(let{group:B}of b)if(B.length>1)for(let N of B)N.id&&U.add(N.id);let E=[...U].map(B=>$.get(B));for(let B of C)U.has(B.id)||E.push(B);if(t.length>1){let B=E.find(N=>N.isApp);B&&(E.workspaceKey=B.id??String(B._id))}y.push(...kb(b,E,e,r));for(let[B,N]of k){let K=g.get(B);g.set(B,K?{finding:K.finding,copies:[...K.copies,...N.copies]}:N)}}return Object.defineProperty(y,"ruledOutIds",{value:s,configurable:!0}),{groups:y,conflicts:g}}function kb(t,e,r,n){if(r)return[e];if(n){let i=t.flatMap(p=>p.sourceGroup),s=Yl(i);if(s.length===1)return[e];let a=[],c=new Set;for(let p of s){let f=new Set(p.filter(g=>!g.isApp&&g.id).map(g=>g.id)),h=e.filter(g=>f.has(g.id));if(h.length>0){a.push(h);for(let g of h)c.add(g.id)}}let u=new Set(e.map(p=>p.id).filter(Boolean));return c.size===u.size?a:[e]}let o=t.flatMap(i=>i.sourceGroup.filter(s=>s.isApp));return Yl(e,o)}function X_(t){let e=Object.keys(t).filter(n=>n.startsWith("revalidate")||n==="_revalidationCopies");if(e.length===0)return t;let r={...t};for(let n of e)delete r[n];return r}var Z_=w(()=>{"use strict";Oe();vb();wb()});function Gt(){return l.currentView==="links"&&Bs?.owner===l.currentLinks?Bs:null}function op(){xb++,Bs=null}async function Q_(t,e,r){if(l.currentView!=="links"||!l.currentLinks)return;let n=md(l.currentLinks),o=++xb;Bs={owner:n,id:t,reportName:e,group:null,error:""},l.focusCodeStack=[],l.focusCodeAt=0;let i=()=>o===xb&&l.currentView==="links"&&l.currentLinks===n;try{let s=await Ht(await Le(e));if(!i())return;let a=(ar(s?.data)??[]).map(h=>Array.isArray(h)?h:[h]),c=h=>h?.some(g=>String(g?.id)===t),u=c(a[r])?a[r]:a.find(c);if(!u)throw new Error("This finding is no longer in the report.");let{data:p}=s,f=u.filter(h=>h?.id).map(h=>{let g={...h,_reportName:e,_repoFallback:$r(p)??xt(e),_repoDirectory:hi(p?.repo),_bundleHashes:p.bundleHashes??[],_source:h.source??p.source??null};return fi(g,p),g._analyzer=g._source??g.type??null,"isApp"in g||(g.isApp=vn(g,g._source)),g});await Promise.all([_i(),jt("report",e),...kl(e).map(h=>jt("workspace",h.id))]),i()&&(Bs.group=f,l.activeTabByGroup.set(f[0].id,t))}catch(s){i()&&(Bs.error=s.message||"Unable to load this finding.")}}var Bs,xb,ip=w(()=>{"use strict";O();gd();Oe();Bs=null,xb=0});function eS(t,e,r,n=r){let o=t.map((f,h)=>h),i=f=>{for(;o[f]!==f;)o[f]=o[o[f]],f=o[f];return f},s=t.map(r),a=new Map;for(let f=0;f<s.length;f++)for(let h of s[f])h.id&&(a.has(h.id)||a.set(h.id,[]),a.get(h.id).push(f));for(let[f,h]of a)for(let g of e(f))if(g!==f)for(let y of h)for(let b of a.get(g)??[]){let v=i(y),x=i(b);v!==x&&(o[x]=v)}let c=new Map;for(let f=0;f<t.length;f++){let h=i(f);c.has(h)||c.set(h,[]),c.get(h).push(f)}if(c.size===t.length)return t;let u=f=>f.id??String(f._id),p=[...c.values()].map(f=>{if(f.length===1)return t[f[0]];let h=new Map;for(let v of f)for(let x of n(t[v]))h.has(u(x))||h.set(u(x),x);let g=new Map;for(let v of f)for(let x of t[v])g.has(u(x))||g.set(u(x),h.get(u(x))??x);let y=[...g.values()],b=t[f[0]];return y.workspaceKey=b.workspaceKey??u(b[0]),y.linkedTabs=[...h.values()],y});return Object.defineProperty(p,"ruledOutIds",{value:t.ruledOutIds,configurable:!0}),p}var tS=w(()=>{"use strict"});function j(t){return t.id??String(t._id)}function se(t){return t.workspaceKey??j(t[0])}function $b(t){return Array.isArray(t)?t:[t]}function Tn(){return l.revalidationDetailed===!0}function _b(t){return t?._reportName??""}function K6(){let t=l.reports;return!Array.isArray(t)||t.length===0?!0:(t!==rS&&(rS=t,nS=ju(t)),nS)}function De(t){return!t.isUpstream||l.showRevalidation===!1||l.upstreamOnly===!0||!K6()}function ye(t){return De(t)?l.triage.get(j(t)):void 0}function Sb(t){return De(t)&&_n(l.triage,j(t),_b(t))}function Xl(t,e=ye(t)){if(De(t))return e?.triage??(Sb(t)?"ignored":void 0)}function dr(t){return Gt()?.group===t?t:t.linkedTabs?t.linkedTabs:Tn()?t:oS(t)}function oS(t){return t.length<=1||!t.some(Hl)?t:t.filter(Hl)}function Zr(t){let e=dr(t);return e.length<=1?e:[...e].toSorted((r,n)=>{let o=Hl(r)?1:0,i=Hl(n)?1:0;if(o!==i)return i-o;let s=ye(r)?.color?1:0,a=ye(n)?.color?1:0;if(s!==a)return a-s;let c=Ne[ae(r,l.severityMode)]||0,u=Ne[ae(n,l.severityMode)]||0;if(c!==u)return u-c;let p=r.confidence??-1;return(n.confidence??-1)-p})}function An(t){return t.length===1?t[0]:Zr(t)[0]}function iS(t){let e=[],r=[];for(let n of t)(n.isApp?e:r).push(n);return{app:e,source:r}}function G6(t){let e=ye(t);return!!e?.comment||!!e?.fix||e?.flagged===!0}function ft(t){if(t.length===1)return t[0];let e=Zr(t);if(e.length===1)return e[0];let r=l.activeTabByGroup.get(se(t));if(r){let o=e.find(i=>j(i)===r);if(o)return o}let n=e;if(l.filterAnalyzer||l.filterModel){let o=e.filter(lb);o.length>0&&(n=o)}return n.find(G6)??n[0]}function sS(t){return t?._repoFallback||l.repoUrl||""}function ur(t){return{github:sS(t),directory:t?._repoDirectory??""}}function sp(t){for(let e of jr().values())if(e.files.has(t.file))return e.repos?.size===1?[...e.repos][0]:null;return t.repo?.github||sS(t)||null}function Os(t){if(!Array.isArray(t))return[];let e=t.filter(r=>!r.isUpstream);return e.length===0||e.length===t.length?t:e}function ze(t){let e=Os(t),r=0,n=!1,o,i=!1,s=!1,a,c=!1,u=null,p=!1,f=!0;for(let v of e){let x=ye(v),k=Xl(v,x),$=x?.color;$===void 0&&k===void 0||(r++,$!==void 0&&(i?$!==o&&(n=!0):(i=!0,o=$)),c?k!==a&&(s=!0):(c=!0,a=k),k?(u===null&&(u=k),k==="ignored"?f=!1:p=!0):f=!1)}let h=n||s,g=!h&&i?o:null,y=r>0&&f,b=!h&&u!==null?u:null;return{hasConflict:h,commonColor:g,anyTriage:p,allTriaged:y,commonTriage:b,allIgnored:b==="ignored"&&r===e.length,isInProgress:b==="inprogress",isFixed:b==="fixed",isInvalid:b==="invalid",isDeleted:b==="deleted",isIgnored:b==="ignored"}}function aS(t,e){if(!Array.isArray(t)||t.length<2)return!1;let r=t.filter(De);if(r.length<2)return!1;let n=(e??"").trim();return r.every(o=>Cb(o,n))}function Cb(t,e){if(!De(t))return!1;let r=(ye(t)?.fix??"").trim();return r===""||r===(e??"").trim()}function lS(t,e){if(!De(ft(t)))return{targets:[],clearing:!1};let r=ze(t);return{targets:xo(t,r),clearing:e==="restore"||Eb(t,r)===e}}function xo(t,e=ze(t)){let r=Os(t),n=t.linkedTabs||r!==t&&t.some(o=>o.isApp)?r:e.hasConflict?[ft(t)]:r;return n.every(De)?n:n.filter(De)}function Eb(t,e=ze(t),r=null){return t.linkedTabs||t.some(n=>n.isApp)&&Os(t)!==t||!e.hasConflict?e.commonTriage??null:Xl(r??ft(t))??null}function ap(t){let e=Os(t);if(e.length<2)return!1;let n=ze(t).commonTriage;if(!n||n==="ignored")return!1;let o=!1;for(let i of e){if(!De(i))continue;let s=j(i),a=l.triage.get(s);Xl(i,a)!==n&&(a?.ignoredReports?.length||G(l.triage,s,{triage:n})&&(o=!0))}return o}function $o(){Jr=null}function lp(t,e=!1,r=!1){let n=l.reports,o=l.workspaceMerges;(!Jr||Jr.reports.length!==n.length||Jr.reports.some((s,a)=>s!==n[a])||Jr.merges!==o||Jr.mergeCount!==o.length)&&(Jr={reports:[...n],merges:o,mergeCount:o.length});let i=e?"upstream":t?r?"workspace-app":"app":"code";return Jr[i]||(Jr[i]=J_(n,{showRevalidation:t&&!e,upstreamOnly:e,hideRuledOut:r,merges:o})),Jr[i]}function cS(){return lp(l.showRevalidation!==!1).groups}function Rb(){return lp(!0).groups}function dS(){return lp(!0,!1,!!l.currentWorkspace).conflicts}function qt(){let t=lp(l.showRevalidation!==!1,l.upstreamOnly===!0,!!l.currentWorkspace),e=t.groups;if(l.showRevalidation===!1||l.upstreamOnly)return e;if(l.currentWorkspace){let r=Tn();return(!t.linkedGroups||t.linksTick!==l.linksTick||t.linkedDetailed!==r)&&(t.linkedGroups=eS(e,$i,oS,dr),t.linksTick=l.linksTick,t.linkedDetailed=r),t.linkedGroups}return Tn()?e:t.visibleGroups??=(()=>{let r=e.flatMap(n=>{let o=n.filter(i=>!yo(i));return o.length===n.length?[n]:o.length===0?[]:(o.workspaceKey=se(n),[o])});return Object.defineProperty(r,"ruledOutIds",{value:e.ruledOutIds,configurable:!0}),r})()}function Mn(){let t=qt();if(l.viewMode==="kanban")return t;let e=t.filter(r=>ze(r).commonTriage===l.shownTriage);return Object.defineProperty(e,"ruledOutIds",{value:t.ruledOutIds,configurable:!0}),e}function uS(t){if(l.showRevalidation||l.upstreamOnly||!Array.isArray(t)||t.length===0)return t;let e=new Set(t.map(j)),r=new Map;for(let n of Rb())for(let o of Yl(n))if(o.some(i=>e.has(j(i))))for(let i of o)r.set(j(i),i);return r.size===t.length&&t.every(n=>r.get(j(n))===n)?t:r.size>0?[...r.values()]:t}function Yt(t){let e=Gt()?.group;if(e&&se(e)===t)return e;for(let r of qt())if(se(r)===t)return r;return null}var rS,nS,Jr,ot=w(()=>{"use strict";O();ue();Xr();Z_();ip();tS();wb();vb();rS=null,nS=!0;Jr=null});function pS(t){return t==null?"(none)":Tb[t]??t}function fS(t){return t??"(no model)"}var Tb,Ab,Mb=w(()=>{"use strict";M();Me();$e();O();Xr();Oe();Tb=ct;Ab=class extends V{static properties={analyzers:{attribute:!1},models:{attribute:!1},groups:{attribute:!1},_open:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.analyzers=[],this.models=[],this.groups=[],this._open=!1}render(){let e=this.analyzers.length>1,r=this.models.length>1;if(!e&&!r)return m;let n=l.filterAnalyzer===""?void 0:l.filterAnalyzer===vo?null:l.filterAnalyzer,o=l.filterModel===""?void 0:l.filterModel===wo?null:l.filterModel,i=new Map,s=new Map;for(let f of this.groups){let h=new Set,g=new Set;for(let y of f){let b=y._analyzer??null,v=Kl(y);(o===void 0||v===o)&&h.add(b),(n===void 0||b===n)&&g.add(v)}for(let y of h)i.set(y,(i.get(y)??0)+1);for(let y of g)s.set(y,(s.get(y)??0)+1)}let a=n===void 0?null:pS(n),c=o===void 0?null:fS(o),u=a!=null&&c!=null?`${a} \xB7 ${c}`:a??c??(e?"All analyzers":"All models"),p=a!=null||c!=null;return d`<button type="button" class="${I({"analyzer-btn":!0,active:p})}" popovertarget="analyzer-select-menu" popovertargetaction="toggle" data-tooltip="Filter by analyzer / model" aria-label="${`Filter by analyzer / model: ${u}`}"><span class="analyzer-btn-label">${u}</span> <svg viewBox="0 0 12 12" width="11" height="11" aria-hidden="true"><path d="M2 4l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></button><div popover="auto" id="analyzer-select-menu" class="analyzer-menu" @beforetoggle="${this._onToggle}">${e?this._column({dim:"analyzer",heading:"Analyzer",allLabel:"All analyzers",values:this.analyzers,sentinel:vo,labelOf:pS,counts:i,current:l.filterAnalyzer}):m} ${e&&r?d`<div class="analyzer-menu-sep"></div>`:m} ${r?this._column({dim:"model",heading:"Model",allLabel:"All models",values:this.models,sentinel:wo,labelOf:fS,counts:s,current:l.filterModel}):m}</div>`}_column({dim:e,heading:r,allLabel:n,values:o,sentinel:i,labelOf:s,counts:a,current:c}){return d`<div class="analyzer-menu-col" role="group" aria-label="${`Filter by ${e}`}"><div class="analyzer-menu-head">${r}</div><button type="button" aria-pressed="${String(c==="")}" class="${I({"analyzer-menu-item":!0,active:c===""})}" @click="${()=>this._pick(e,"")}"><span class="analyzer-menu-label">${n}</span></button> ${o.map(u=>{let p=u??i,f=a.get(u)??0,h=c===p;return d`<button type="button" aria-pressed="${String(h)}" class="${I({"analyzer-menu-item":!0,active:h,zero:f===0})}" @click="${()=>this._pick(e,p)}"><span class="analyzer-menu-label">${s(u)}</span><span class="analyzer-menu-count">${f}</span></button>`})}</div>`}_pick(e,r){let n=e==="analyzer"?l.filterAnalyzer:l.filterModel,o=r!==""&&n===r?"":r;this.dispatchEvent(new CustomEvent("analyzer-change",{detail:{analyzer:e==="analyzer"?o:l.filterAnalyzer,model:e==="model"?o:l.filterModel},bubbles:!0,composed:!0}))}_onToggle=e=>{this._open=e.newState==="open",this._open&&this._position()};_position(){let e=this.querySelector(".analyzer-menu"),r=this.querySelector(".analyzer-btn");if(!e||!r)return;let n=r.getBoundingClientRect(),o=e.offsetWidth||240,i=e.offsetHeight||200,s=4,a=n.left;a+o>window.innerWidth-4&&(a=window.innerWidth-o-4),a<4&&(a=4);let c=n.bottom+s;c+i>window.innerHeight-4&&n.top>i+s&&(c=n.top-i-s),e.style.top=`${c}px`,e.style.left=`${a}px`}updated(){this._open&&this.querySelector(".analyzer-menu")?.matches(":popover-open")&&this._position()}};customElements.define("analyzer-select",Ab)});function Ib(t,e){if(e==null)return t.length+1;let r=t.indexOf(e);return r===-1?t.length:r}function J6(t,e,r){for(let n of r){let o=X6[n],i=o(t[n])-o(e[n]);if(i!==0)return i;let s=String(t[n]??"").localeCompare(String(e[n]??""));if(s!==0)return s}return 0}function mS(t,e,{typePrefix:r=!0}={}){return t==="type"?r?`analyzer: ${e??"null"}`:`${e??"null"}`:e??null}function Z6(t,e){let r=e.filter(i=>i!=="exportsMode"),n=[],o=new Map;for(let i of t){if(i.exportsMode==null){n.push({...i});continue}let s=r.map(u=>i[u]??"").join("|"),a=o.get(s);if(a){a.exportsMode=`${a.exportsMode}+${i.exportsMode}`;continue}let c={...i};o.set(s,c),n.push(c)}return n}function gS(t,e=cp){let r=new Map;for(let h of t){let g={};for(let b of e)g[b]=b==="model"?li(h.model)??null:h[b]??null;let y=e.map(b=>g[b]??"").join("|");r.has(y)||r.set(y,g)}let n=[...r.values()].toSorted((h,g)=>J6(h,g,e));if(n.length===0)return[];let o={};for(let h of e)o[h]=new Set(n.map(g=>g[h])).size===1;let i=e.filter(h=>!o[h]),s=i.includes("exportsMode")?Z6(n,e):n,a=s.length>2&&i.includes("type")&&i.length>1,c=["model","effort"].filter(h=>e.includes(h)&&o[h]),u=[...c,...e.filter(h=>!c.includes(h))],p=[],f=!1;for(let h of u)if(o[h]){let g=mS(h,s[0][h]);g!=null&&p.push(g)}else if(!f){for(let g of s){let y=i.map(b=>mS(b,g[b],{typePrefix:!a})).filter(b=>b!=null);y.length>0&&p.push(y.join(" \xB7 "))}f=!0}return p}var cp,hS,q6,Y6,X6,bS=w(()=>{"use strict";ue();cp=["type","model","effort","exportsMode"],hS=["security","correctness"],q6=["max","xhigh","high","medium","low","minimal"],Y6=["list","isolate"];X6={type:t=>t==="terminal"?hS.length+2:Ib(hS,t),model:t=>t==null?1:0,effort:t=>Ib(q6,t),exportsMode:t=>Ib(Y6,t)}});function Q6(){return dp||(dp=(async()=>await import("./prism.js"))(),dp)}function Jl(t){if(typeof t!="string")return null;let e=t.slice(t.lastIndexOf("/")+1),r=e.lastIndexOf(".");return r<=0?null:eF[e.slice(r+1).toLowerCase()]??null}function yS(t){return typeof t!="string"?null:tF[t.toLowerCase()]??null}async function _o(t,e){if(!e)return null;try{return(await Q6()).highlight(t,e)}catch{return null}}function vS(t){let e=[],r=[],n="",o=0;for(;o<t.length;){let i=t.indexOf("<",o),a=(i===-1?t.slice(o):t.slice(o,i)).split(`
104
+ `);n+=a[0];for(let p=1;p<a.length;p++){for(let f=r.length-1;f>=0;f--)n+=r[f].close;e.push(n),n=r.map(f=>f.open).join("")+a[p]}if(i===-1)break;let c=t.indexOf(">",i);if(c===-1){n+=t.slice(i);break}let u=t.slice(i,c+1);u.startsWith("</")?r.pop():r.push({open:u,close:`</${/^<([a-zA-Z][^\s/>]*)/u.exec(u)?.[1]??"span"}>`}),n+=u,o=c+1}return e.push(n),e}var dp,eF,tF,Zl=w(()=>{"use strict";dp=null;eF={js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",json:"json",css:"css",html:"markup",htm:"markup",xml:"markup",svg:"markup",yml:"yaml",yaml:"yaml",sh:"bash",bash:"bash",md:"markdown",markdown:"markdown",sol:"solidity",php:"php",phtml:"php",rs:"rust",rb:"ruby",java:"java",cpp:"cpp",cc:"cpp",cxx:"cpp","c++":"cpp",hpp:"cpp",hh:"cpp",hxx:"cpp","h++":"cpp",h:"cpp",c:"c",m:"objectivec",mm:"objectivec"};tF={__proto__:null,js:"javascript",javascript:"javascript",mjs:"javascript",cjs:"javascript",node:"javascript",jsx:"jsx",ts:"typescript",typescript:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",json:"json",css:"css",html:"markup",htm:"markup",xml:"markup",svg:"markup",markup:"markup",yaml:"yaml",yml:"yaml",sh:"bash",bash:"bash",shell:"bash",zsh:"bash",console:"bash",md:"markdown",markdown:"markdown",sol:"solidity",solidity:"solidity",rs:"rust",rust:"rust",rb:"ruby",ruby:"ruby",php:"php",phtml:"php",java:"java",cpp:"cpp","c++":"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hh:"cpp",hxx:"cpp","h++":"cpp",h:"cpp",c:"c",objc:"objectivec",objectivec:"objectivec","objective-c":"objectivec",m:"objectivec",mm:"objectivec"}});function rF(){Bb||(Bb=!0,queueMicrotask(()=>{Bb=!1,l.codeBlockTick++,_()}))}function Ob(t,e){let r=yS(e);if(!r||!t)return null;let n=`${r}\0${t}`;return Lb.has(n)?Lb.get(n):(Fb.has(n)||(Fb.add(n),(async()=>{let o=await _o(t,r);Lb.set(n,o??null),Fb.delete(n),rF()})()),null)}var Lb,Fb,Bb,wS=w(()=>{"use strict";O();Zl();St();Lb=new Map,Fb=new Set,Bb=!1});function aF(t,e,r){if(t===e)return t;let n=Pb(t),o=Pb(e);if(n!==o&&kS(t)===kS(e))return n?e:t;throw new Error(`format conflict for '${r}' ('${e}' vs '${t}')`)}function Ps(t,e){return e===""?t:t==="."?e:`${t}/${e}`}function SS(t,{scope:e="full"}={}){let r=new Set;for(let[n,{files:o}]of t)if(!(e!=="full"&&!zs(n)))for(let i of Object.keys(o))r.add(Ps(n,i));return r}function lF(t,{what:e,files:r,formats:n,scope:o}){if(pr(t))return"escapes the root";if(o!=="full"&&!zs(t))return`is outside node_modules, which a '${o}'-scope ${e} does not record`;if(!r.has(t))return`names no file the ${e} records`;let i=n.get(t);return i==="directory"?"is a directory capture, not a file":Pb(i)?`is a payload-free '${i}' record, not a file`:null}function CS(t,{what:e,files:r,formats:n,scope:o}){for(let i of t){let s=lF(i,{what:e,files:r,formats:n,scope:o});Q(s===null,`${e}: executable entry '${i}' ${s}`)}}function ES(t,{what:e,files:r,formats:n,scope:o="full"}){if(t===void 0)return new Set;let i=`${e}: executable`;Q(Array.isArray(t),`${i} must be an array of file paths`);let s=new Set;for(let a of t)Q(typeof a=="string"&&a!=="",`${i} entry must be a non-empty string`),Q(!s.has(a),`${i} entry '${a}' is listed twice`),s.add(a);return CS(s,{what:e,files:r,formats:n,scope:o}),s}function RS(t,{what:e,modules:r,formats:n,scope:o}){if(t.size!==0)return CS(t,{what:e,files:SS(r,{scope:o}),formats:n,scope:o}),up(t)}function Q(t,e){if(!t)throw new Error(e)}function Ns(t,e){let[r,n]=[t.split("/"),e.split("/")];for(;r.length>0&&r[0]===n[0];)r.shift(),n.shift();if(r.length===0&&n.length===0)return 0;if(r.length<2)return n.length<2&&r>n?1:-1;if(n.length<2)return 1;if(r[0]==="*")return-1;if(n[0]==="*"||r[0]==="node_modules")return 1;if(n[0]==="node_modules")return-1;let[o,i]=[r,n].map(s=>s.join(String.fromCodePoint(0)));if(o<i)return-1;if(o>i)return 1;throw new Error("Unreachable")}function pr(t){if(t.startsWith("/"))return!0;let e=0;for(let r of t.split("/"))if(!(r==="."||r==="")){if(r!=="..")e++;else if(--e<0)return!0}return!1}function cF(t,e){let r=t instanceof Map;if(r!==e instanceof Map)return!1;if(!r)return t===e;if(t.size!==e.size)return!1;for(let[n,o]of t)if(e.get(n)!==o)return!1;return!0}function AS(t,e,r){let n=new Map,o=i=>{for(let[s,a]of i){let c=n.get(s);c===void 0&&n.set(s,c=new Map);for(let[u,p]of a){let f=c.get(u);f===void 0&&c.set(u,f=new Map);for(let[h,g]of p)f.has(h)?Q(cF(f.get(h),g),`${r}: import '${h}' from '${u}' resolves differently ('${xS(f.get(h))}' vs '${xS(g)}')`):f.set(h,g instanceof Map?new Map(g):g)}}};return o(t),o(e),n}function TS(t,e,r){let n=new Map,o=i=>{for(let[s,a]of i){let c=n.get(s);if(c===void 0){n.set(s,a);continue}try{n.set(s,aF(a,c,s))}catch(u){throw new Error(`${r}: ${u.message}`,{cause:u})}}};return o(t),o(e),n}function MS(t,e,r,n){if(t.size===0)return new Set(e);let o=SS(r,{scope:n}),i=new Set(e);for(let s of t)o.has(s)||i.add(s);return i}function IS(t,e,r){let n=new Map,o=i=>{for(let[s,a]of i){let c=n.get(s);if(c===void 0){n.set(s,{name:a.name,version:a.version,...a.ecosystem===void 0?{}:{ecosystem:a.ecosystem},files:Object.assign(Object.create(null),a.files)});continue}Q(c.name===a.name,`${r}: module '${s}' name mismatch ('${c.name}' vs '${a.name}')`),Q(c.version===a.version,`${r}: module '${s}' version mismatch ('${c.version}' vs '${a.version}')`),Q(c.ecosystem===a.ecosystem,`${r}: module '${s}' ecosystem mismatch ('${c.ecosystem??"(none)"}' vs '${a.ecosystem??"(none)"}')`);for(let[u,p]of Object.entries(a.files))Object.hasOwn(c.files,u)?Q(c.files[u]===p,`${r}: content mismatch for '${Ps(s,u)}'`):c.files[u]=p}};return o(t),o(e),n}function zs(t){return t.split("/").includes("node_modules")}function dF(t){let e="node_modules/",r=t.length;for(;(r=t.lastIndexOf(e,r-1))!==-1;)if(r===0||t[r-1]==="/")return r;return-1}function LS(t){let e="node_modules/",r=dF(t);if(r===-1)return null;let n=r+e.length,o=t.slice(n).split("/"),i=o[0].startsWith("@")?2:1;if(o.length<=i||o.slice(0,i).some(a=>!a))return null;let s=o.slice(0,i).join("/");return{dir:t.slice(0,n)+s,rel:o.slice(i).join("/"),name:s}}var nF,oF,iF,sF,$S,_S,Pb,kS,ec,Ds,up,Ql,Nb,xS,FS=w(()=>{nF=new Set(["module","commonjs","json","module-typescript","commonjs-typescript"]),oF=new Set(["solidity","php","shell","rust"]),iF=new Set(["java","kotlin","gradle","objc","objcpp","swift","c","cpp","c-header","cpp-header","ruby","cmake","podspec","podfile","podfile-lock","template","xml","env","fastlane","pbxproj"]),sF=new Set(["resource","resource:base64"]),$S=new Set(["stat:file","stat:directory"]),_S=new Set([...nF,...oF,...iF,...sF,"patch","directory",...$S]),Pb=t=>$S.has(t),kS=t=>t==="directory"||t==="stat:directory"?"directory":"file";ec=t=>t&&[null,Object.prototype].includes(Object.getPrototypeOf(t)),Ds=t=>Object.setPrototypeOf(Object.fromEntries(t),null),up=t=>[...t].toSorted((e,r)=>Ns(e,r)),Ql=(t,{sorted:e=!0}={})=>{if(!e){let r=Object.create(null);for(let[n,o]of t)r[n]=o instanceof Map?Ql(o,{sorted:e}):o;return r}return Ds([...t].toSorted((r,n)=>Ns(r[0],n[0])).map(([r,n])=>[r,n instanceof Map?Ql(n,{sorted:e}):n]))},Nb=t=>new Map(Object.entries(t).map(([e,r])=>[e,ec(r)?Nb(r):r]));xS=t=>t instanceof Map?`{${[...t].map(([e,r])=>`${e}: ${r}`).join(", ")}}`:t});var So,BS,OS,uF,PS,Ar,pp=w(()=>{FS();So=1,BS=0,OS=({name:t,version:e,ecosystem:r,files:n})=>(Q(r===void 0||typeof r=="string"),{name:t,version:e,...r===void 0?{}:{ecosystem:r},files:Ds(Object.entries(n))}),uF=t=>LS(t)??{dir:".",rel:t,name:null},PS=(t,e)=>{if(t===void 0)return e;if(e===void 0)return t;let r={};for(let n of[t,e])for(let[o,i]of Object.entries(n))r[o]=up(new Set([...r[o]??[],...i]));return r},Ar=class t{static VERSION=So;version=So;config;entries;modules;formats;imports;executable;reason;constructor({config:e={scope:"full"},entries:r,modules:n,formats:o,imports:i,executable:s,reason:a,version:c=So}={}){Q([BS,So].includes(c)),Q(["node_modules","full"].includes(e.scope)),this.version=c,this.config=e,this.entries=r??new Set,this.modules=n??new Map,this.formats=o??new Map,this.imports=i??new Map,this.executable=s??new Set,this.reason=a}get sources(){let e=new Map;for(let[r,{files:n}]of this.modules)for(let[o,i]of Object.entries(n))e.set(Ps(r,o),i);return e}static isResourceFormat(e){return e==="resource"||e==="resource:base64"||e==="directory"}get hasCode(){for(let[e,{files:r}]of this.modules)for(let n of Object.keys(r))if(!t.isResourceFormat(this.formats.get(Ps(e,n))))return!0;return!1}static parse(e){let r=JSON.parse(e);Q(r.version===So||r.version===BS),Q(["node_modules","full"].includes(r.config?.scope)),Q(ec(r.formats)),Q(ec(r.imports));let n=new Map;for(let[u,p]of Object.entries(r.formats)){Q(!pr(u)),Q(_S.has(p),`unknown format '${p}' for ${u}`);let f=u===""?".":u;Q(!n.has(f),`duplicate format key '${f}'`),n.set(f,p)}let o=new Map,i=new Set;if(r.version===So){let u=r.config.scope==="full";if(r.modules!==void 0){Q(typeof r.modules=="object"&&r.modules!==null);for(let[p,f]of Object.entries(r.modules))Q(zs(p)),Q(!pr(p)),Q(f?.name&&f.version&&f.files),o.set(p,OS(f))}if(u){Q(r.sources&&typeof r.sources=="object");for(let[p,f]of Object.entries(r.sources))Q(!zs(p)),Q(!pr(p)),Q(f?.name&&f.version&&f.files),o.set(p,OS(f));Q(r.entries===void 0||Array.isArray(r.entries)),i=new Set(r.entries)}else Q(r.entries===void 0),Q(r.sources===void 0);for(let[,{files:p}]of o)for(let f of Object.keys(p))Q(!pr(f))}else{Q(r.sources);for(let[u,p]of Object.entries(r.sources)){Q(!pr(u));let{dir:f,rel:h,name:g}=uF(u);Q(!pr(f)&&!pr(h)),o.has(f)||o.set(f,{name:g,version:null,files:Object.create(null)}),o.get(f).files[h]=p}}let s=new Set;for(let[u,{files:p}]of o)for(let f of Object.keys(p)){let h=Ps(u,f);Q(!s.has(h),`duplicate file key '${h}' across bundle buckets`),s.add(h)}let a=Nb(r.imports),c=u=>{if(typeof u=="string"){Q(!pr(u));return}Q(u instanceof Map&&u.size>0,"import target must be a file or a non-empty {platform: file} map");for(let[p,f]of u)Q(typeof p=="string"&&p.length>0&&!p.includes("/"),`invalid platform key '${p}'`),Q(typeof f=="string"),Q(!pr(f))};for(let[,u]of a){Q(u instanceof Map);for(let[p,f]of u){Q(!pr(p)),Q(f instanceof Map);for(let[,h]of f)c(h)}}return new t({version:r.version,config:r.config,entries:i,modules:o,formats:n,imports:a,executable:r.version===So?ES(r.executable,{what:"bundle",files:s,formats:n,scope:r.config.scope}):new Set,reason:ec(r.reason)?r.reason:void 0})}#e(){let e=[],r=[];for(let[n,{name:o,version:i,ecosystem:s,files:a}]of this.modules){if(Object.keys(a).length===0)continue;let c=zs(n);c&&Q(o&&i&&a);let u=Ds(Object.entries(a).toSorted((f,h)=>Ns(f[0],h[0])));(c?e:r).push([n,{name:o,version:i,...s===void 0?{}:{ecosystem:s},files:u}])}return e.sort((n,o)=>Ns(n[0],o[0])),r.sort((n,o)=>Ns(n[0],o[0])),{modules:Ds(e),sources:Ds(r)}}serialize(){let e=up(this.entries),{modules:r,sources:n}=this.#e(),o=Ql(this.formats),i=Ql(this.imports),s={version:So,config:this.config};this.config.scope==="full"&&Object.assign(s,{entries:e,sources:n}),Object.assign(s,{modules:r,formats:o,imports:i});let a=RS(this.executable,{what:"bundle",modules:this.modules,formats:this.formats,scope:this.config.scope});return a!==void 0&&(s.executable=a),this.reason!==void 0&&(s.reason=this.reason),JSON.stringify(s,void 0,2)}withReason(e){let r=[...this.sources.keys()];return new t({version:this.version,config:this.config,entries:this.entries,modules:this.modules,formats:this.formats,imports:this.imports,executable:this.executable,reason:PS(this.reason,{[e]:r})})}merge(e){return Q(this.config.scope===e.config.scope,`bundle merge: scope mismatch ('${this.config.scope}' vs '${e.config.scope}')`),new t({config:{scope:this.config.scope},entries:new Set([...this.entries,...e.entries]),modules:IS(this.modules,e.modules,"bundle merge"),formats:TS(this.formats,e.formats,"bundle merge"),imports:AS(this.imports,e.imports,"bundle merge"),executable:MS(this.executable,e.executable,e.modules,this.config.scope),reason:PS(this.reason,e.reason)})}}});function pF(){for(let t of["br","brotli"])try{return new DecompressionStream(t),t}catch{}return null}async function fF(t,e){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream(t));return new Uint8Array(await new Response(r).arrayBuffer())}async function hF(){if("serviceWorker"in navigator)try{let t=await navigator.serviceWorker.getRegistrations();for(let e of t){let r=e.active?.scriptURL??e.installing?.scriptURL??e.waiting?.scriptURL;r&&r.endsWith("/brotli-sw.js")&&await e.unregister()}}catch{}}function gF(){return hp||(hp=(async()=>await import(NS))(),hp)}function zb(){Db=!0,Qr&&(Qr.terminate(),Qr=null);let t=[...Us.values()];Us.clear();for(let e of t)e.resolve(mp)}function bF(t){let{id:e,bytes:r,error:n}=t.data??{},o=Us.get(e);o&&(Us.delete(e),n?o.reject(new Error(n)):o.resolve(r))}function yF(){if(Qr)return Qr;if(Db||typeof Worker>"u")return null;try{Qr=new Worker(new URL(NS,import.meta.url),{type:"module"})}catch{return Db=!0,null}return Qr.addEventListener("message",bF),Qr.addEventListener("error",zb),Qr.addEventListener("messageerror",zb),Qr}function vF(t){let e=yF();return e?new Promise((r,n)=>{let o=++mF;Us.set(o,{resolve:r,reject:n});try{e.postMessage({id:o,bytes:t})}catch{Us.delete(o),zb(),r(mp)}}):Promise.resolve(mp)}async function wF(){await hF();let t=pF();return t?{kind:"native",format:t}:{kind:"fallback"}}function DS(){return fp||(fp=wF(),fp)}async function zS(t){let e=await DS();if(e.kind==="native")return fF(e.format,t);let r=await vF(t);return r!==mp?r:(await gF()).brotliDecompress(t)}var fp,hp,NS,mp,Qr,Db,mF,Us,Ub=w(()=>{"use strict";fp=null,hp=null;NS="./brotli-fallback.js",mp=Symbol("brotli worker unavailable"),Qr=null,Db=!1,mF=0,Us=new Map;DS().catch(()=>{})});function kF(){return{showAll:!1,splitOwnDirs:!1,packagesView:!1,dependencyPackagesView:!1,bundleLayout:"graph",bundleReason:null,bundleReasonFor:null,selected:null,focusedPkg:null,topPkgsTab:"issues",edgeOpacity:.22,nodeSize:1,showLabels:!1,selectedSeverities:new Set,selectedColors:new Set,pathFilter:"",hidden:new Set,solo:null,graphState:null,layoutCache:null}}function it(){R.graphState?._cleanup&&R.graphState._cleanup(),R.graphState=null}function US(){return Co}var Co,R,Eo=w(()=>{"use strict";Co=kF(),R=new Proxy(Co,{get(t,e){return Co[e]},set(t,e,r){return Co[e]=r,!0},has(t,e){return e in Co},deleteProperty(t,e){return delete Co[e]},ownKeys(){return Reflect.ownKeys(Co)},getOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(Co,e)}})});function Xt(t){if(t?.metadataOnly)return new Map;let e=t?.bundle??t?.json;if(e&&Hb.has(e))return Hb.get(e);let r=new Map;if(!t)return r;if(t.kind==="stasis"){if(!t.bundle)return r;let n=t.bundle.formats;for(let[o,i]of t.bundle.sources)typeof i=="string"&&(Ar.isResourceFormat(n?.get(o))||r.set(o,i))}else if(t.kind==="sourcemap"){if(!t.json)return r;let n=t.json.sources??[],o=t.json.sourcesContent??[];for(let i=0;i<n.length;i++)typeof o[i]=="string"&&r.set(n[i],o[i])}return e&&Hb.set(e,r),r}function Mi(t){let e=t?.bundle??t?.json;if(e&&jb.has(e))return jb.get(e);let r=new Map(Xt(t));if(t?.kind==="stasis"&&t.bundle){let n=t.bundle.formats;for(let[o,i]of t.bundle.sources){if(typeof i!="string")continue;let s=n?.get(o);s==="resource"?r.set(o,i):s==="resource:base64"&&r.set(o,{format:"base64",data:i})}}return e&&jb.set(e,r),r}function $F(t){let e=t.endsWith("=");if(e?t.length%4!==0||t.at(-3)==="=":t.length%4===1)return null;let r=e?t.slice(0,t.endsWith("==")?-2:-1):t;if(/[^A-Za-z0-9+/]/u.test(r))return null;let n=r.length%4;return n>1&&xF.indexOf(r.at(-1))&(n===2?15:3)?null:Math.floor(r.length*3/4)}function qb(t){return typeof t=="string"?Go(t):t?.format==="base64"?$F(t.data):null}function fr(t){if(t?.fileSizes)return t.fileSizes;let e=t?.bundle??t?.json;if(e&&Vb.has(e))return Vb.get(e);let r=new Map,n=Mi(t),o=t?.kind==="stasis"?t.bundle?.sources.keys():t?.json?.sources;for(let i of o??[])r.set(i,qb(n.get(i)));return e&&Vb.set(e,r),r}function Yb(t){if(t?.metadataOnly)return t.unsizedFiles??new Set;let e=fr(t);if(Gb.has(e))return Gb.get(e);let r=new Set;for(let n of Mi(t).keys())e.get(n)===null&&r.add(n);return Gb.set(e,r),r}function Hs(t){let e=fr(t);if(Kb.has(e))return Kb.get(e);let r=Yb(t),n=t?.kind==="stasis"?t.bundle?.formats:null,o=new Map;for(let[i,s]of e)s===null&&!r.has(i)||o.set(i,Ar.isResourceFormat(n?.get(i))?"resource":"source");return Kb.set(e,o),o}function HS(t){let e=fr(t),r=t?.kind==="stasis"?t.bundle?.formats:null;if(!r||r.size===0)return e;if(Wb.has(e))return Wb.get(e);let n=new Map;for(let[o,i]of e)n.set(o,Ar.isResourceFormat(r.get(o))?null:i);return Wb.set(e,n),n}function en(t){if(t?.kind!=="stasis"||!t.bundle?.modules)return null;let e=new Map;for(let[r,n]of t.bundle.modules)for(let o of Object.keys(n.files))e.set(r==="."?o:`${r}/${o}`,r);return e}function tc(t){let e=new Map;if(t?.kind!=="stasis"||!t.bundle?.modules)return e;for(let[r,n]of t.bundle.modules){if(!r.includes("node_modules")||!n?.name||typeof n.version!="string"||!n.version)continue;let o=e.get(n.name);o||(o=new Set,e.set(n.name,o)),o.add(n.version)}return e}var Hb,jb,Vb,Wb,Kb,Gb,xF,tn=w(()=>{"use strict";pp();gt();Hb=new WeakMap,jb=new WeakMap,Vb=new WeakMap,Wb=new WeakMap,Kb=new WeakMap,Gb=new WeakMap;xF="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"});function js(t,e=null){return!!e||_F.has(t)}function rc(t){if(t.fileHashes)return Promise.resolve(t.fileHashes);if(gp.has(t))return gp.get(t);let e=(async()=>{let r=[...Xt(t)],n=new Map;for(let o=0;o<r.length;o+=32){let i=await Promise.all(r.slice(o,o+32).map(async([s,a])=>[s,await cm(a)]));for(let[s,a]of i)n.set(s,a)}return t.fileHashes=n,n})();return gp.set(t,e),e.catch(()=>gp.delete(t)),e}function nc(t){return typeof t!="string"||t.length===0?0:(t.match(/\r\n|\r|\n/gu)?.length??0)+(/[\r\n]$/u.test(t)?0:1)}function Jb(t){return t instanceof Map?Object.fromEntries([...t].map(([e,r])=>[e,Jb(r)])):t}async function jS(t){let e=await rc(t),r=fr(t),n=t.lineCounts??=new Map([...Xt(t)].map(([s,a])=>[s,nc(a)])),o={version:Xb,integrity:t.integrity,kind:t.kind,size:t.size,files:[...r].map(([s,a])=>[s,a,e.get(s)??null,n.get(s)??null])},i=Yb(t);if(i.size>0&&(o.unsized=[...i]),t.kind==="sourcemap"){let{version:s,file:a,sourceRoot:c,names:u,sources:p=[],sourcesContent:f=[]}=t.json;o.json={version:s,file:a,sourceRoot:c,sources:p},o.sourceSizes=p.map((h,g)=>typeof f[g]=="string"?Go(f[g]):null),o.namesCount=u?.length??null}else{let s=t.bundle,a={version:s.version,config:s.config,formats:Jb(s.formats),imports:Jb(s.imports),reason:s.reason};if(s.version===0)a.sources=Object.fromEntries([...r.keys()].map(c=>[c,null]));else{let c={},u={};for(let[p,f]of s.modules){let h=p.split("/").includes("node_modules")?c:u;Object.defineProperty(h,p,{enumerable:!0,value:{name:f.name,version:f.version,ecosystem:f.ecosystem,files:Object.fromEntries(Object.keys(f.files).map(g=>[g,null]))}})}a.modules=c,s.config.scope==="full"&&(a.sources=u,a.entries=[...s.entries])}o.bundle=a}return o}function VS(t,e){if(t?.version!==1&&t?.version!==Xb||t.integrity!==e||!["stasis","sourcemap"].includes(t.kind)||!Number.isSafeInteger(t.size)||t.size<0||!Array.isArray(t.files))throw new Error("Invalid bundle metadata");let r=t.version!==Xb,n=new Map,o=new Map,i=new Map;for(let c of t.files){if(!Array.isArray(c)||c.length!==4&&!(r&&c.length===3))throw new Error("Invalid bundle metadata file");let[u,p,f,h]=c;if(typeof u!="string"||o.has(u)||p!==null&&(!Number.isSafeInteger(p)||p<0)||f!==null&&(typeof f!="string"||!/^sha512-[A-Za-z0-9+/]{86}==$/u.test(f))||p===null&&f!==null||r&&p!==null&&f===null||h!=null&&(!Number.isSafeInteger(h)||h<0))throw new Error("Invalid bundle metadata file");o.set(u,p),f!==null&&n.set(u,f),h!=null&&i.set(u,h)}let s=new Set(t.unsized??[]);if(t.unsized!==void 0&&(r||!Array.isArray(t.unsized)||s.size!==t.unsized.length)||[...s].some(c=>typeof c!="string"||!o.has(c)||o.get(c)!==null))throw new Error("Invalid bundle metadata");let a={integrity:e,kind:t.kind,size:t.size,metadataOnly:!0,fileSizes:o,fileHashes:n,lineCounts:i,unsizedFiles:s,stale:r};if(t.kind==="stasis"){a.bundle=Ar.parse(JSON.stringify(t.bundle));let c=a.bundle.sources;if(c.size!==o.size||[...c.keys()].some(p=>!o.has(p)))throw new Error("Invalid bundle metadata inventory");let u=a.bundle.formats;if(!r&&[...o].some(([p,f])=>n.has(p)!==(f!==null&&!Ar.isResourceFormat(u.get(p)))))throw new Error("Invalid bundle metadata inventory");if([...s].some(p=>u.get(p)!=="resource:base64"))throw new Error("Invalid bundle metadata inventory")}else{if(!t.json||typeof t.json!="object"||![null,void 0].includes(t.namesCount)&&(!Number.isSafeInteger(t.namesCount)||t.namesCount<0))throw new Error("Invalid sourcemap metadata");if(!Array.isArray(t.json.sources)||t.json.sources.some(c=>!o.has(c))||!Array.isArray(t.sourceSizes)||t.sourceSizes.length!==t.json.sources.length||t.sourceSizes.some(c=>c!==null&&(!Number.isSafeInteger(c)||c<0))||[...o].some(([c,u])=>n.has(c)!==(u!==null))||s.size>0)throw new Error("Invalid sourcemap inventory");a.json=t.json,a.sourceSizes=t.sourceSizes,a.namesCount=t.namesCount}return a}var Xb,gp,_F,oc=w(()=>{"use strict";pp();Oe();gt();tn();Xb=2,gp=new WeakMap,_F=new Set(["terminal","code","search","compare"])});async function Qb(t){try{let e=await Eh(t);return e?VS(e,t):null}catch{return null}}function In(t,e,{sources:r=!0}={}){let n=r?SF:CF,o=e.name.toLowerCase().endsWith(".map")?"sourcemap":"stasis",i=l.bundleDetails;if(i?.integrity===t&&i.kind===o&&!i.error&&(!r||!i.metadataOnly))return Promise.resolve(i);let s=`${t}:${o}`;if(n.has(s))return n.get(s);let a=(async()=>{if(!r){let p=await Qb(t);return p?.kind===o&&!p.stale?p:In(t,e)}let[c,u]=await Promise.all([EF(t,e),Qb(t)]);if(!c.error){let p=u?.kind===c.kind&&!u.stale;p&&(c.fileHashes=u.fileHashes,c.fileSizes=u.fileSizes,c.lineCounts=u.lineCounts),p||jS(c).then(f=>Rh(t,f)).catch(()=>{})}return c})();return n.set(s,a),a.finally(()=>{n.get(s)===a&&n.delete(s)}).catch(()=>{}),a}function Ro(t,e=l.currentView==="bundles"?l.bundleDetailsTab:"overview"){l.currentView="bundles",l.selectedBundle=t,l.bundleDetails=null,l.bundleSourceFile=null,l.bundleSourceFindingIdx=null,l.bundleCodeSearchQuery="",l.bundleCodeSearchMode="files",l.bundleSearchQuery="",l.bundleSearchRegex=!1,l.bundleSearchCase=!1,l.bundleSearchContext=!0,l.bundleDetailsTab=e??"overview",R.showAll=!0,l.shownTriage=null}async function EF(t,e){try{let r=await bn(t),n=e.name.toLowerCase().endsWith(".map"),o=n?"sourcemap":"stasis";try{if(n){let a=JSON.parse(Ve(r));return{integrity:t,kind:o,size:r.byteLength,json:a}}let i=Ve(await zS(r)),s=Ar.parse(i);return{integrity:t,kind:o,size:r.byteLength,bundle:s}}catch(i){return{integrity:t,kind:o,size:r.byteLength,error:i.message}}}catch(r){return{integrity:t,error:r.message,size:0}}}function RF(t){if(!(!t?.json&&!t?.bundle)){if(t.fileHashes){ll(t.integrity,t.fileHashes);return}(async()=>{try{let e=await rc(t);if(ll(t.integrity,e),l.bundleDetails!==t)return;t.fileHashes=e,_()}catch{}})()}}async function ic(t){if(Am(t)||!(l.bundles??[]).find(n=>n.integrity===t))return;let r=await Qb(t);if(!(!r?.json&&!r?.bundle))try{let n=await rc(r);ll(t,n)}catch{}}async function Ln(t){let e=(l.bundles??[]).find(n=>n.integrity===t);if(!e)return;let r=await In(t,e,{sources:js(l.bundleDetailsTab,l.bundleSourceFile)});l.selectedBundle===t&&(l.bundleDetails=r,_(),RF(r),lr().catch(()=>{}))}function Ii(t=l.bundleDetails){if(!t?.metadataOnly)return Promise.resolve(t);if(Zb.has(t))return Zb.get(t);let e=(l.bundles??[]).find(n=>n.integrity===t.integrity);if(!e)return Promise.resolve(null);let r=In(t.integrity,e).then(n=>(l.bundleDetails!==t||(n.error||(n.fileHashes=t.fileHashes,n.fileSizes=t.fileSizes),l.bundleDetails=n,_()),n));return Zb.set(t,r),r}var SF,CF,Zb,Fn=w(()=>{"use strict";pp();O();gt();Ub();Eo();St();oc();SF=new Map,CF=new Map,Zb=new WeakMap});function bp(t,e){return!!t&&!!e&&t.integrity===e.integrity&&t.file===e.file&&(t.range?.start??null)===(e.range?.start??null)&&(t.range?.end??null)===(e.range?.end??null)}function ey(t,e,r){if(!r)return null;if(!Array.isArray(t)||t.length===0||!bp(t[0],r))return{stack:AF,at:0,pos:r};let n=Math.min(Math.max(e,0),t.length-1);return{stack:t,at:n,pos:t[n]}}function WS({stack:t,at:e,base:r},n){let o=t.length>0?t[e]:r;if(bp(o,n))return null;let i=t.length>0?t.slice(0,e+1):[r];return{stack:[...i,n],at:i.length}}function KS(t,e,r){return!Array.isArray(t)||t.length===0?0:Math.min(Math.max(e+r,0),t.length-1)}var AF,yp=w(()=>{"use strict";AF=[]});function vp(t,e){if(!t||!e||e.length===0)return;let r=t.getBoundingClientRect().top,n=e[0].getBoundingClientRect(),o=e.item(e.length-1).getBoundingClientRect(),i=n.top-r+t.scrollTop,s=o.bottom-r+t.scrollTop,a=i+(s-i)/2-t.clientHeight/2;t.scrollTo({top:Math.max(0,Math.min(a,i-n.height)),behavior:"instant"})}var ty=w(()=>{"use strict"});function TF(t,e,r){let n=`${t}\0${e}`;if(ac.has(n)||ry.has(n))return;let o=Jl(e);if(!o){ac.set(n,null);return}ry.add(n),(async()=>{let i=await _o(r,o);ac.set(n,i??null),ry.delete(n),l.focusCodeTick++,queueMicrotask(_)})()}async function MF(t){let e=sc.get(t);if(e&&(e.loading||e.sources))return;let r=(l.bundles??[]).find(n=>n.integrity===t);if(r){sc.set(t,{sources:null,loading:!0,error:null});try{let n=await In(t,r),o=Xt(n);sc.set(t,{sources:o,loading:!1,error:n.error??null})}catch(n){sc.set(t,{sources:null,loading:!1,error:n.message})}l.focusCodeTick++,queueMicrotask(_),queueMicrotask(Ao)}}function Ao(){let t=T.querySelectorAll(".focus-code-line-active");t.length!==0&&vp(t[0].closest(".focus-code-body"),t)}function wp(t){let e=t?._bundleHashes;return!t?.fileHash||!Array.isArray(e)||e.length===0?null:vi(t.fileHash).find(({integrity:r})=>e.includes(r))??null}function Vs(t,e,{kick:r=!0}={}){let n=sc.get(t);if(!n)return r?(MF(t),{loading:!0}):null;if(n.loading&&!r)return null;if(n.loading)return{loading:!0};if(!n.sources)return null;let o=n.sources.get(e);if(typeof o!="string")return null;TF(t,e,o);let i=`${t}\0${e}`;return{content:o,highlighted:ac.has(i)?ac.get(i):void 0,loading:!1}}function GS(t){let e=wp(t);return e?{integrity:e.integrity,file:e.file,range:Mt(t.line)}:null}function IF(t){return t?GS(ft(t)):null}function lc(t){let e=IF(t);return e?{base:e,...ey(l.focusCodeStack,l.focusCodeAt,e)}:null}function qS(t){let e=GS(t);return e?ey(l.focusCodeStack,l.focusCodeAt,e).pos:null}function YS(t){let e=lc(t);if(!e)return null;let{pos:r}=e,n=Vs(r.integrity,r.file);return!n||n.loading?n:{...n,file:r.file,integrity:r.integrity,range:r.range}}var sc,ac,ry,kp=w(()=>{"use strict";O();ot();Fn();tn();yp();ue();Zl();St();Nt();ty();sc=new Map,ac=new Map,ry=new Set});function xp(t){if(!t||D())return null;let e=j(t);if(!Sr(e))return null;let r=t._reportName||l.currentFile||"",n=l.currentWorkspace||Li(r);return Mm({id:e,report:l.currentWorkspace?null:uu("report",r),workspace:uu("workspace",n??"")})}function Li(t,e=l.currentReportWorkspace||l.currentWorkspace){let r=kl(t);return r.some(n=>n.id===e)?e:r.length===1?r[0].id:null}function cc(t){for(let e of[qt(),cS()])for(let r of e)for(let n of r)if(j(n)===t)return{group:r,finding:n};return null}function ny(t,e){l.currentView="findings",l.viewMode==="graph"&&(l.viewMode="table",it());let r=ze(t).commonTriage;if(l.viewMode==="kanban"){let s=r??"untriaged";l.kanbanExpandedColumn!==null&&l.kanbanExpandedColumn!==s&&(l.kanbanExpandedColumn=null)}else r!==l.shownTriage&&(l.shownTriage=r);l.upstreamOnly&&!t.every(s=>s.isUpstream)&&(l.upstreamOnly=!1),bo(l.showRevalidation,l.upstreamOnly);let n=t.find(s=>j(s)===e);if(yo(n)||rp(Mn())&&!pb(t)||!Zr(t).some(s=>j(s)===e))if(l.currentWorkspace){n?.isUpstream?l.upstreamOnly=!0:l.showRevalidation=!1,bo(l.showRevalidation,l.upstreamOnly);let s=qt().find(a=>a.some(c=>j(c)===e));if(s)return ny(s,e)}else l.revalidationDetailed=!0;if(ko([t]).length===0){let s=l.sortBy;Ls(),l.sortBy=s}let i=se(t);return t.length>1&&l.activeTabByGroup.set(i,e),l.viewMode==="table"?l.tableSelectedGid=i:l.viewMode==="focus"?l.focusGid=i:l.viewMode==="kanban"&&(l.kanbanPopoverGid=i),i}var Fi=w(()=>{"use strict";O();Xr();ot();ue();Eo()});function Ct(t){return t==="informational"?"info":t.replaceAll("_"," ")}function oy(t,{variant:e="full"}={}){let r=l.severityMode,n=ae(t,r),o=d`<span class="${`badge ${n}`}">${Ct(n)}</span>`,i=Ut(t),s=e==="tab"?null:ds(t);if(!i&&!s)return o;let a=s?`Corrected severity varies across reports \u2014 ${Object.entries(s).map(([$,C])=>`${$||"(this report)"}: ${Ct(C.severity)}`).join("; ")}`:null,c=s?d`<span class="badge-varies" title="${a}" aria-label="${a}">varies</span>`:m;if(!i)return d`<span class="${`badge-pair badge-pair-${e}`}">${o}${c}</span>`;let u=t.severity,p=zr(t),f=t.correctedSeverityReason,h=(Ne[p]??0)>(Ne[u]??0),g=h?"up":"down",y=h?"\u25B2":"\u25BC",b=r!=="original",v=(b?`Corrected ${g} from ${Ct(u)}`:`Original severity \u2014 corrected ${g} to ${Ct(p)}`)+(f?` \u2014 ${f}`:""),x=`Severity ${Ct(n)}; ${b?`corrected ${g} from ${Ct(u)}`:`original, corrected to ${Ct(p)}`}${f?`; reason: ${f}`:""}`;if(e==="tab")return d`<span class="badge-pair badge-pair-tab" title="${v}" aria-label="${x}">${o}<span class="${`badge-corr-mark ${g}`}" aria-hidden="true">${y}</span></span>`;let k=b?u:p;return d`<span class="${`badge-pair badge-pair-${e}`}" title="${v}" aria-label="${x}">${o}<span class="badge-orig-wrap"><span class="${`badge-arrow ${g}`}" aria-hidden="true">${y}</span>${b?d`<span class="badge-pre" aria-hidden="true">was</span>`:m}<span class="${`badge-orig ${k}${b?" struck":""}`}">${Ct(k)}</span></span>${c}</span>`}function uc(t){XS.lastIndex=0;let e=[],r=0,n;for(;(n=XS.exec(t))!==null;){n.index>r&&e.push(t.slice(r,n.index));let o=n[0].codePointAt(0);if(o===91){let i=E_(n[0]);e.push(i?d`<a href="${i.url}" target="_blank" rel="noopener noreferrer" data-tooltip="${i.url}">${i.label}</a>`:n[0])}else o===42?e.push(d`<strong>${n[0].slice(2,-2)}</strong>`):o===96?e.push(d`<span class="inline-code">${n[0].slice(1,-1)}</span>`):e.push(d`<span class="inline-quote">${n[0]}</span>`);r=n.index+n[0].length}return r===0?t:(r<t.length&&e.push(t.slice(r)),e)}function LF({lang:t,code:e}){l.codeBlockTick;let r=Ob(e,t);return d`<div class="code-block" data-lang="${t||m}">${t?d`<div class="code-block-lang">${t}</div>`:m}<pre><code>${r?Z(r):e}</code></pre></div>`}function FF(t,{wrap:e=!1}={}){let r=t.split(/\n{2,}/u).filter(n=>n.trim());return r.length<2?e?d`<div class="para">${uc(t)}</div>`:uc(t):r.map(n=>d`<div class="para">${uc(n)}</div>`)}function BF({ordered:t,start:e,items:r}){let n=r.map(o=>d`<li>${hr(o)}</li>`);return t?d`<ol class="md-list" start="${e>1?e:m}">${n}</ol>`:d`<ul class="md-list">${n}</ul>`}function hr(t,{paragraphs:e=!0}={}){if(!t)return t;let r=e?__(t):[t],n=r.length>1,o=s=>e?FF(s,{wrap:n}):uc(s),i=s=>{let a=$_(s);return a.length===1&&typeof a[0]=="string"?o(a[0]):a.map(c=>typeof c=="string"?o(c):LF(c))};return r.length===1&&typeof r[0]=="string"?i(r[0]):r.map(s=>typeof s=="string"?i(s):BF(s))}function OF(t){return M_(t).map(e=>typeof e=="string"?e:e.self?d`<a class="comment-self-ref" href="${e.url}" data-tooltip="Show this finding">${e.label}</a>`:d`<a href="${e.url}" target="_blank" rel="noopener noreferrer" data-tooltip="${e.url}">${e.label}</a>`)}function PF(t){let e=new Set;for(let r of t)e.add(Ke(r));return[...e]}function NF(t){let e=Ke(t);return Ei[e]??e}function DF(t,e){l.linksTick,l.findingIndexTick;let r=j(t),n=Sr(r)?$i(r).filter(o=>!e.has(o)):[];return n.length===0?m:d`<div class="duplicates-block"><span class="duplicates-label">Duplicates:</span>${n.map(o=>{let i=Vl(o),s=yi(o),a=s.length===0?"":` \u2014 in ${s.map(c=>`${ke(c)} (${NF(c)})`).join(", ")}`;return d`<a class="duplicate-ref" href="${`#${wi({id:o})}`}" data-tooltip="${`${i}${a}`}">${PF(s).map(c=>Z(be[c]??be.default))}<span class="duplicate-ref-id">${Ai(o)??i}</span></a>`})}</div>`}function zF(t){let e=rb(t);return e?d`<span class="${`revalidate-stamp ${e}`}">${e}</span><div class="value-label">Revalidation</div>`:m}function UF(t){let e=eb()?$t(t.revalidateVerdict,t):"";return e?d`<div class="revalidate-verdict">${hr(Is(e))}</div>`:m}function dc(t,e,r="section",{collapsible:n=!1}={}){let o=e?d`<div class="section-body">${hr(Is(e))}</div>`:m;return!n||!e?d`<div class="${r}"><div class="section-label">${t}</div>${o}</div>`:d`<details class="${r}"><summary class="section-label">${t}</summary>${o}</details>`}function HF(t,e,r){let n=t&&e?.file?cl(t.integrity,e.file):null;return n?d`<span class="evidence-ref" role="link" tabindex="0" data-code-nav-integrity="${t.integrity}" data-code-nav-file="${n}" data-code-nav-line="${e?.line??""}">${r}</span>`:d`<span class="evidence-ref">${r}</span>`}function jF(t,e){let r=Array.isArray(t.evidence)?t.evidence:[];if(r.length===0)return m;let n=ur(t),o=wp(t),i=e==="focus"&&o!==null,s=i?qS(t):null;return d`<details class="evidence"><summary class="section-label">Evidence<span class="evidence-count">(${r.length})</span></summary><ol class="evidence-list">${r.map((a,c)=>{let u=ut(a),p=Zu(a,t,n,c),f=di(a),h=QS(t,`ev${c}`,o,a?.file,a?.line),g=iy(p),y=i&&bp(s,{integrity:o.integrity,file:cl(o.integrity,a?.file),range:Mt(a?.line)});return d`<li class="${I({current:y})}">${i?HF(o,a,u):p?d`<a class="evidence-ref" href="${p}" target="_blank" rel="noopener">${u}</a>`:d`<span class="evidence-ref">${u}</span>`} ${h?.mark??m} ${g} ${h?.tip??m} ${f?d`<div class="evidence-note">${hr(Is(f))}</div>`:m} ${h?.body??m}</li>`})}</ol></details>`}function ZS(t,e){let r=ut(t);return e?d`<a href="${e}" target="_blank" rel="noopener">${r}</a>`:r}function VF(t,e){if(!e)return m;let r=e.slice(0,7),n=Qu(t,e);return n?d`<a href="${n}" target="_blank" rel="noopener" data-tooltip="${e}">${r}</a>`:d`<span title="${e}">${r}</span>`}function iy(t){let e=w_(t);return e?d`<a class="gh-ref-btn" href="${t}" target="_blank" rel="noopener noreferrer" data-tooltip="${e}" aria-label="${`Open ${e} on GitHub`}">${qF}</a>`:m}function YF(t,e,r,n){return`${j(t)}\0${e}\0${r}\0${n?`${n.start}-${n.end}`:""}`}function $p(t,e){if(Ws.key===t)return;let r=Ws.host,n=t===null?null:e?.getRootNode?.()?.host??null;Ws={key:t,host:n},r?.requestUpdate?.(),n!==r&&n?.requestUpdate?.()}function JS(t,e,r){l.codeBlockTick;let{text:n,lines:o,startLine:i}=S_(t,e);if(o.length===0)return m;let s=r.lastIndexOf("."),a=Ob(n,s<0?"":r.slice(s+1)),c=i+o.length-1;return d`<div class="code-preview" style="${ve({"--lineno-width":`${String(c).length}ch`})}"><aside class="code-preview-gutter" aria-hidden="true">${o.map((u,p)=>{let f=i+p,h=!!e&&f>=e.start&&f<=e.end;return d`<div class="${I({"code-preview-lineno":!0,cited:h})}">${f}</div>`})}</aside><pre class="code-preview-source"><code>${a?Z(a):n}</code></pre></div>`}function QS(t,e,r,n,o){if(l.bundleHashTick,!r||!n)return null;let i=cl(r.integrity,n);if(!i)return null;let s=Mt(o),a=YF(t,e,n,s),c=l.codePreviews.has(a);l.focusCodeTick;let u=d`<button type="button" class="${I({"code-preview-btn":!0,open:c})}" data-code-preview="${a}" aria-expanded="${String(c)}" aria-label="${c?`Hide the source at ${n}`:`Show the source at ${n}`}" @mouseenter="${h=>{$p(a,h.currentTarget),Vs(r.integrity,i)}}" @mouseleave="${h=>{Ws.key===a&&$p(null,h.currentTarget)}}" @focus="${h=>{$p(a,h.currentTarget),Vs(r.integrity,i)}}" @blur="${h=>{Ws.key===a&&$p(null,h.currentTarget)}}">${GF}</button>`;if(c){let h=Vs(r.integrity,i),g=!h||h.loading?d`<div class="code-preview code-preview-pending">${h?"Loading source\u2026":"Source unavailable"}</div>`:JS(h.content,s,i);return{mark:u,tip:m,body:g}}if(Ws.key!==a)return{mark:u,tip:m,body:m};let p=Vs(r.integrity,i,{kick:!1}),f=p&&!p.loading?d`<div class="code-preview-tip" role="tooltip">${JS(p.content,s,i)}</div>`:m;return{mark:u,tip:f,body:m}}function ZF(t,e=!1){let r=ye(t)?.flagged===!0,n=r?"Remove flag":"Flag this finding";return d`<button type="button" class="${I({"mark-flag":!0,flagged:r})}" data-flag-toggle="${j(t)}" ?disabled="${!De(t)}" aria-label="${n}" aria-pressed="${String(r)}">${Sp}${e?d`<span class="mark-btn-label">${r?"Flagged":"Flag"}</span>`:m}</button>`}function QF(t){let e=dt(t)||t.file||"Security finding";return e.length>120?`${e.slice(0,119)}\u2026`:e}function e3(t){let e=qr(t,ur(t)),r=ut(t),n=[];t.file&&n.push(`File: ${e?`[${r}](${e})`:r}`),t.description&&n.push(t.description);let o=sb(t);return o&&n.push(o),t.confidence!==void 0&&t.confidence!==null&&n.push(`Confidence: ${t.confidence}/10`),n.join(`
92
105
 
93
- ${i}`:o||i,l={id:e[t.finding_url],file:r,line:n,severity:(e[t.severity]||"medium").toLowerCase(),description:s,repo:{github:e[t.repository]}};return t.commit_hash!==-1&&e[t.commit_hash]&&(l.commitHash=e[t.commit_hash]),t.detected_at!==-1&&e[t.detected_at]&&(l.detectedAt=e[t.detected_at]),t.committed_at!==-1&&e[t.committed_at]&&(l.committedAt=e[t.committed_at]),l}var po=`.conflict-sev{display:inline-block;padding:1px .4rem;border-radius:3px;font-size:.62rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:#fff;flex-shrink:0;&.sev-critical{background:var(--critical)}&.sev-high{background:var(--high)}&.sev-medium{background:var(--medium)}&.sev-low{background:var(--low)}&.sev-high_bug{background:var(--high-bug)}&.sev-bug{background:var(--bug)}&.sev-informational{background:var(--info)}}
94
- `;var My=`dialog{max-width:720px;width:min(94vw,720px)}header h3{margin:0 0 .25rem}header p{margin:0 0 .75rem;color:var(--muted);font-size:.82rem}.bulk{display:flex;gap:.4rem;margin-bottom:.7rem;padding-bottom:.7rem;border-bottom:1px solid var(--border)}.bulk button,.actions button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.3rem .8rem;font:inherit;font-size:.78rem;&:hover{border-color:var(--accent);color:var(--accent)}&.primary{background:var(--accent);color:var(--surface);border-color:var(--accent)}&.primary:hover{filter:brightness(1.08)}}.list{list-style:none;margin:0;padding:0;max-height:60vh;overflow-y:auto;overscroll-behavior:none;-webkit-app-region:no-drag;app-region:no-drag;display:flex;flex-direction:column;gap:.5rem}.card{border:1px solid var(--border);border-radius:6px;padding:.55rem .7rem .6rem;background:rgb(from var(--text) r g b / .02)}.card-head{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}.id{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.68rem;color:var(--muted);padding:1px .3rem;background:rgb(from var(--text) r g b / .05);border-radius:3px}.desc{font-size:.78rem;color:var(--muted);margin-bottom:.55rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rows{display:flex;flex-direction:column;gap:.35rem}.row{display:grid;grid-template-columns:5rem 1fr 1fr;align-items:stretch;gap:.4rem}.row-label{color:var(--muted);font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;align-self:center}.choice{position:relative;display:flex;flex-direction:column;gap:.15rem;padding:.35rem .5rem;border:1px solid var(--border);border-radius:5px;min-width:0;&:has(input:checked){border-color:var(--accent);background:rgb(from var(--accent) r g b / .07)}&:has(input:focus-visible){outline:2px solid var(--accent);outline-offset:1px}}.choice input[type=radio]{position:absolute;opacity:0;pointer-events:none}.choice-label{font-size:.68rem;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.choice:has(input:checked) .choice-label{color:var(--accent)}.choice-value{font-size:.82rem;min-width:0}.flag-badge{font-size:.82rem;color:var(--muted)}.flag-badge.on{color:var(--accent);font-weight:600}.color{display:inline-flex;align-items:center;gap:.35rem}.color-dot{width:12px;height:12px;border-radius:50%;box-shadow:0 0 0 1px rgb(from var(--text) r g b / .2);flex-shrink:0;&.marker-red{background:var(--marker-red)}&.marker-blue{background:var(--marker-blue)}&.marker-green{background:var(--marker-green)}&.marker-gray{background:var(--marker-gray)}}.color-name{text-transform:capitalize}.comment-text{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;color:var(--text);white-space:pre-wrap;overflow-wrap:anywhere;& em{color:var(--muted);font-style:italic}}.fix-text{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-all;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}}.actions{display:flex;justify-content:flex-end;gap:.4rem;margin-top:.8rem;padding-top:.7rem;border-top:1px solid var(--border)}
95
- `;function fo(e){if(!e)return g;let t=e.replaceAll("_"," ");return c`<span class="${`conflict-sev sev-${e}`}">${t}</span>`}function FS(e){return`bundle-${e.slice(7,19)}\u2026`}function at(e){return e.kind==="bundle"?e.label??FS(e.identifier):e.identifier}function BS(e){return e?c`<span class="color"><span class="${`color-dot marker-${e}`}"></span> <span class="color-name">${e}</span></span>`:c`<em>none</em>`}function LS(e){return c`<span class="comment-text">${e||c`<em>empty</em>`}</span>`}function PS(e){return e?_t(e)?c`<span class="fix-text"><a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a></span>`:c`<span class="fix-text">${e}</span>`:c`<span class="comment-text"><em>empty</em></span>`}function OS(e){return e?c`<span class="${`triage triage-${e}`}">${e}</span>`:c`<em>none</em>`}function NS(e){return e?c`<span class="${`flag-badge${e==="flagged"?" on":""}`}">${e}</span>`:c`<em>none</em>`}function Fy(e,t){return e==="color"?BS(t):e==="comment"?LS(t):e==="fix"?PS(t):e==="triage"?OS(t):e==="flagged"?NS(t):c`${String(t)}`}function DS(e,t){let r=e?.file?e.line?`${e.file}:${e.line}`:e.file:"";return c`<div class="card-head">${fo(e?.severity)} ${r?c`<span class="loc" title="${r}">${r}</span>`:g} <code class="id" title="${t}">${t.slice(0,8)}…</code></div>${e?.description?c`<div class="desc" title="${e.description}">${e.description}</div>`:g}`}var Ly={title:"Triage conflicts",intro:"disagree with your local triage on",trailingNote:"",applyButton:"Apply",importedSideLabel:"Apply imported"},By={color:0,comment:1,fix:2,triage:3,flagged:4},zS={color:"Color",comment:"Comment",fix:"Fix",triage:"Triage state",flagged:"Flag"},ep=class extends I{static styles=[...I.styles,B(po),B(My)];static properties={conflicts:{attribute:!1},findingLookup:{attribute:!1},labels:{attribute:!1},_settled:{state:!0}};constructor(){super(),this.conflicts=[],this.findingLookup=new Map,this.labels={...Ly},this._settled=!1}focusInitial(){}_blockEscClose=t=>t.preventDefault();_onClick=t=>{let r=t.target.closest("[data-bulk]");if(!r)return;let n=r.dataset.bulk;for(let o of this.renderRoot.querySelectorAll(`input[type="radio"][value="${n}"]`))o.checked=!0};_onSubmit=t=>{t.preventDefault();let r={};for(let n of this.conflicts){let o=`${n.id}:${n.property}`,i=this.renderRoot.querySelector(`input[name="conflict-${CSS.escape(o)}"]:checked`);i&&(r[o]=i.value)}this._finish(r)};render(){let t=this.labels,r=new Map;for(let p of this.conflicts)r.has(p.id)||r.set(p.id,[]),r.get(p.id).push(p);for(let p of r.values())p.sort((f,h)=>(By[f.property]??99)-(By[h.property]??99));let n=this.conflicts.filter(p=>p.property==="color").length,o=this.conflicts.filter(p=>p.property==="comment").length,i=this.conflicts.filter(p=>p.property==="fix").length,s=this.conflicts.filter(p=>p.property==="triage").length,l=this.conflicts.filter(p=>p.property==="flagged").length,d=[n?`${n} color${n===1?"":"s"}`:"",o?`${o} comment${o===1?"":"s"}`:"",i?`${i} fix${i===1?"":"es"}`:"",s?`${s} triage state${s===1?"":"s"}`:"",l?`${l} flag${l===1?"":"s"}`:""].filter(Boolean).join(", "),u=`${r.size} finding${r.size===1?"":"s"}`;return c`<dialog @click="${this._onClick}" @cancel="${this._blockEscClose}" @close="${this._onClose}"><header><h3>${t.title}</h3><p>${u} ${t.intro} ${d}.${t.trailingNote?` ${t.trailingNote}`:""}</p><div class="bulk"><button type="button" data-bulk="local">Keep all current</button> <button type="button" data-bulk="imported">${t.importedSideLabel} (all)</button></div></header><form @submit="${this._onSubmit}"><ul class="list">${[...r.entries()].map(([p,f])=>c`<li class="card" data-id="${p}">${DS(this.findingLookup.get(p),p)}<div class="rows">${f.map(h=>{let m=`${h.id}:${h.property}`,b=`conflict-${m}`;return c`<div class="row" data-key="${m}"><span class="row-label">${zS[h.property]??h.property}</span> <label class="choice"><input type="radio" name="${b}" value="local" required> <span class="choice-label">Keep current</span> <span class="choice-value">${Fy(h.property,h.local)}</span></label> <label class="choice"><input type="radio" name="${b}" value="imported" required> <span class="choice-label">${t.importedSideLabel}</span> <span class="choice-value">${Fy(h.property,h.imported)}</span></label></div>`})}</div></li>`)}</ul><footer class="actions"><button type="submit" class="primary">${t.applyButton}</button></footer></form></dialog>`}};customElements.define("triage-conflict-dialog",ep);function ul(e,t,r={}){return new Promise((n,o)=>{let i=document.createElement("triage-conflict-dialog");i.conflicts=e,i.findingLookup=t,i.labels={...Ly,...r},i.addEventListener("resolve",s=>{i.remove(),n(s.detail)}),i.addEventListener("modal-conflict",s=>{i.remove(),o(Tt(s.detail?.cause))}),document.body.append(i)})}var tp=class extends I{static styles=[...I.styles,B(ft)];static properties={_password:{state:!0},_busy:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this._password="",this._busy=!1,this._error="",this._settled=!1,this._tryPassword=null}_finish(t){this._settled||(this._password="",this._tryPassword=null,super._finish(t))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_onPasswordInput=t=>{this._password=t.target.value,this._error=""};_onUnlock=async()=>{if(!(!this._password||this._busy)){this._busy=!0,this._error="";try{let t=await this._tryPassword(this._password);if(this._settled)return;this._finish(t)}catch(t){if(this._settled)return;this._error=t?.message??String(t)}finally{this._busy=!1}}};_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onUnlock())};render(){return c`<dialog @close="${this._onClose}"><header><h3>Unlock encrypted workspace</h3></header><p class="nwd-note">This workspace bundle is password-protected. Enter the password the sender shared with you separately to decrypt and import it.</p><label class="wsl-field"><span>Password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-bundle-unlock" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> ${this._error?c`<p class="wsl-error" role="alert">${this._error}</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._password||this._busy}" @click="${this._onUnlock}">${this._busy?"Unlocking\u2026":"Unlock"}</button></footer></dialog>`}};customElements.define("workspace-unlock-bundle-dialog",tp);function Py({tryPassword:e}={}){if(typeof e!="function")throw new TypeError("openWorkspaceUnlockBundleDialog: tryPassword required");return new Promise((t,r)=>{let n=document.createElement("workspace-unlock-bundle-dialog");n._tryPassword=e,n.addEventListener("resolve",o=>{n.remove(),t(o.detail)}),n.addEventListener("modal-conflict",o=>{n._tryPassword=null,n.remove(),r(Tt(o.detail?.cause))}),document.body.append(n)})}async function Oy(e){let t=await Jd(e),r;if(wi(t)){if(r=await Py({tryPassword:o=>Ma(t,o)}),!r)return null}else r=await Ma(t);let n=await Qd(r,{conflictResolver:async(o,i)=>{try{return await ul(o,i,{title:"Triage conflicts on import",intro:"disagree with your local triage on",trailingNote:"Reports and non-conflicting triage were already merged; pick which side to keep for these disagreements.",importedSideLabel:"Apply imported"})}catch{let s=o.length;return alert(`Imported ${e.name}. Kept your local triage on ${s} conflicting entr${s===1?"y":"ies"} because another dialog is open \u2014 re-drop the file to pick again.`),null}}});return(a.currentFile||a.currentWorkspace)&&x(),n}var Dy="deepview.passkey.firstImportPrompted";function US(){try{return localStorage.getItem(Dy)==="1"}catch{return!1}}function Ny(){try{localStorage.setItem(Dy,"1")}catch{}}async function rp(){if(se()||!Mt()||US())return;if(!confirm(`Encrypt your DeepView data with a passkey?
106
+ `)}function t3(t){if(!l.currentWorkspace)return m;let e=t._reportName;if(!e)return m;if(D()&&!t._managedReportId)return m;let r=We[Ke(e)]??We.default;return d`<button type="button" class="report-chip report-button" data-links-report="${e}" data-links-finding="${j(t)}" data-managed-report="${D()?t._managedReportId:m}">${Z(r)}<span class="report-chip-label report-button-label">${ke(e)}</span></button>`}function eC(t,e,r,n,o=null){let i=o==="table"?m:t3(n),s=ye(n),a=!De(n),c=s?.color??null,u=s?.comment??"",p=s?.fix??"",f=u?`Edit comment: ${u}`:"Add comment",h=p?`Edit fix link: ${p}`:"Add fix link (PR URL, etc.)",g=o==="focus"&&i===m,y=u?"Edit comment":"Comment",b=p?"Edit fix link":"Fix link",v=d`<button type="button" ?disabled="${a}" class="${I({"mark-comment":!0,"has-comment":u})}" data-tooltip="${f}" aria-label="${f}">${_p}${g?d`<span class="mark-btn-label">${y}</span>`:m}</button>`,x=d`<button type="button" ?disabled="${a}" class="${I({"mark-fix":!0,"has-fix":p})}" data-tooltip="${h}" aria-label="${h}">${pc}${g?d`<span class="mark-btn-label">${b}</span>`:m}</button>`,k=ZF(n,g),$=d`<button type="button" class="mark-copy" data-tooltip="Copy file, line, description, confidence to clipboard" aria-label="Copy finding details to clipboard">${WF}${g?d`<span class="mark-btn-label">Copy</span>`:m}</button>`,C=xp(n)?d`<button type="button" class="mark-link" data-tooltip="Copy a link to this finding" aria-label="Copy a link to this finding">${KF}${g?d`<span class="mark-btn-label">Link</span>`:m}</button>`:m,U=sp(n),E=T_(U,{title:QF(n),body:e3(n)}),B=E?d`<a class="mark-issue" href="${E}" target="_blank" rel="noopener" data-tooltip="Create a pre-filled GitHub issue for this finding" aria-label="Create a GitHub issue for this finding">${JF}${g?d`<span class="mark-btn-label">Issue</span>`:m}</a>`:m,N=d`<button type="button" class="mark-claude" data-tooltip="Open in Claude Code (claude://) with a confirm-and-fix prompt" aria-label="Open finding in Claude Code">${XF}${g?d`<span class="mark-btn-label">Claude</span>`:m}</button>`,K=d`<color-marker .selected="${c}" .disabled="${a}"></color-marker>`,W=Os(t)!==t,he=t.linkedTabs?"change triage state for linked findings":W?"change triage state for App and own-source findings":r.hasConflict?"change triage state (colors mismatch \u2014 acts per-tab)":e.length>1?"change triage state for the whole group":"change triage state";return d`<div class="finding-actions">${i}<div class="finding-action-controls"><span class="mark-action-group">${v}${x}${k}</span><span class="mark-action-group">${$}${C}${B}${N}</span>${K}${n3(t,he,o,r,n)}</div></div>`}function r3(t){if(t.newState!=="open")return;let e=t.currentTarget,n=e.getRootNode().querySelector?.(`[popovertarget="${e.id}"]`);if(!n)return;let o=n.getBoundingClientRect(),i=e.offsetWidth||110,s=e.offsetHeight||100,a=4,c=o.right-i;c<4&&(c=4),c+i>window.innerWidth-4&&(c=window.innerWidth-i-4);let u=o.bottom+a;u+s>window.innerHeight-4&&o.top>s+a&&(u=o.top-s-a),e.style.top=`${u}px`,e.style.left=`${c}px`}function n3(t,e,r,n,o){let i=se(t),s=!De(o)||xo(t,n).length===0,a=s?null:Eb(t,n,o),c={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Deleted",ignored:"Ignored"},u={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Delete",ignored:"Ignore"},p=!!l.shownTriage,f=p?c[l.shownTriage]:null,h=["inprogress","fixed","invalid","deleted","ignored"],y=p&&!(r==="focus")?[{key:"restore",label:"Restore"},...h.filter(x=>x!==l.shownTriage).map(x=>({key:x,label:u[x]}))]:h.map(x=>({key:x,label:u[x]})),b=["mark-triage-menu"];p&&b.push("with-label",`triage-state-${l.shownTriage}`);let v=`triage-menu-${i.replaceAll(/[^A-Za-z0-9_-]/gu,"_")}`;return d`<div class="triage-menu-wrap"><button type="button" class="${b.join(" ")}" popovertarget="${v}" popovertargetaction="toggle" data-tooltip="${e}" aria-label="${e}" ?disabled="${s}">${f?d`<span class="mark-triage-label">${f}</span>`:m} <svg viewBox="0 0 12 12" width="11" height="11" aria-hidden="true"><path d="M2 4l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></button><div popover="auto" id="${v}" class="triage-menu" data-gid="${i}" role="menu" @beforetoggle="${r3}">${y.map(x=>d`<button type="button" class="${I({"triage-menu-item":!0,[`triage-menu-${x.key}`]:!0,active:a===x.key})}" data-triage-action="${x.key}" ?disabled="${s}" role="menuitem">${x.label}</button>`)}</div></div>`}function o3(t){let e=!!t?.comment,r=!!t?.fix,n=t?.flagged===!0;return!e&&!r&&!n?m:d`<span class="tab-marks">${e?d`<span class="has-comment" title="Has a comment">${_p}</span>`:m}${r?d`<span class="has-fix" title="Has a fix link">${pc}</span>`:m}${n?d`<span class="flagged" title="Flagged">${Sp}</span>`:m}</span>`}function tC(t,e,r){let{app:n,source:o}=iS(t),i=s=>i3(s,j(s)===e,r);return d`<div class="tabs">${n.map(i)} ${n.length>0&&o.length>0?d`<span class="tab-level-separator" aria-hidden="true">•</span>`:m} ${o.map(i)}</div>`}function i3(t,e,r){let n=j(t),o=ye(t),i=o?.color,s=Xl(t,o),a=["tab",`tab-severity-${ae(t,l.severityMode)}`];e&&a.push("active"),i&&a.push(`tab-mark-${i}`),s==="ignored"&&!r.allIgnored?a.push("tab-ignored"):s&&s!=="ignored"&&r.commonTriage===null&&a.push(`tab-${s}`);let c=Nl(t),u=c?We[c]:null,p=!u&&t.confidence!=null;u?a.push("tab-with-analyzer"):p&&a.push("tab-with-confidence");let f=u?d`<span class="tab-analyzer" role="img" aria-label="${Ei[c]}">${Z(u)}</span>`:p?d`<span class="tab-conf" aria-label="${`Confidence ${t.confidence} out of 10`}">${t.confidence}<span class="tab-conf-max">/10</span></span>`:m;return d`<button type="button" class="${a.join(" ")}" data-tid="${n}" aria-pressed="${e}" aria-description="${i?`${i} color label`:m}"><span class="tab-label"><span class="tab-severity">${oy(t,{variant:"tab"})}</span><span class="tab-indicators">${o3(o)}</span></span>${f}</button>`}function s3(t){if(l.viewMode==="table"||l.viewMode==="focus"){let e=t.confidence*10;return d`<div class="${`conf-ring ${ae(t,l.severityMode)}`}"><svg viewBox="0 0 36 36" aria-hidden="true"><circle class="conf-ring-track" cx="18" cy="18" r="15.9155"/><circle class="conf-ring-arc" cx="18" cy="18" r="15.9155" style="${`stroke-dasharray: ${e} 100`}/"></circle></svg> <span>${t.confidence}<small>/10</small></span></div><div class="value-label">Confidence</div>`}return d`<div class="conf-score"><strong>${t.confidence}</strong>/10</div><div class="value-label">Confidence</div>`}function l3(t){if(qn(t))return m;let e=t?.name;if(typeof e!="string"||!a3.test(e))return m;let r=t?.version,n=typeof r=="string"&&r.length>0,o=n?`https://www.npmjs.com/package/${e}/v/${encodeURIComponent(r)}`:`https://www.npmjs.com/package/${e}`,i=n?`${e}@${r}`:e;return d`<span class="line-num"><a class="npm-link" href="${o}" target="_blank" rel="noopener noreferrer">npm: ${i}</a></span>`}function c3(t,e,r,n,o,i){let s=j(t),a=ye(t),c=a?.comment??"",u=a?.fix??"",p=qr(t,ur(t)),f=ZS(t,p),h=wn(t),g=wp(t),y=QS(t,"loc",g,t.file,t.line),b=iy(p),v=d`<span class="line-num">${h?d`${f}, ${h}`:f}${y?.mark??m}${b}</span>`,x=Ri(t),k=String(t.discoveredIn??"").trim(),$=k===String(t.file??"").trim()?"":k,C=o==="focus"?l3(t.package?.npm):m,U=m;if(o!=="focus"&&t.fileHash&&Array.isArray(t._bundleHashes)&&t._bundleHashes.length>0){l.bundleHashTick;let Ce=new Set(t._bundleHashes),Ot=vi(t.fileHash).find(({integrity:ce})=>Ce.has(ce));Ot&&(U=d`<button type="button" class="finding-code-btn" data-finding-code-bundle="${Ot.integrity}" data-finding-code-file="${Ot.file}" data-finding-code-line="${t.line??""}" data-tooltip="${`Open ${Ot.file} in bundle source viewer`}">Code</button>`)}let{title:E,body:B}=no(t),N=ps(B),K=N.findIndex(Ce=>Ce.label!==null),W=K===-1?N:N.slice(0,K),he=K===-1?[]:N.slice(K);return d`<div class="${I({"tab-body":!0,active:e})}" data-tid="${s}">${n>1?d`<div class="print-case-label">${r+1} of ${n}</div>`:m}<div class="finding-left">${a?.color||a?.flagged===!0?d`<div class="${a?.color?`finding-top-marks color-${a.color}`:"finding-top-marks"}">${a?.color?d`<span class="finding-color-mark" role="img" aria-label="${`Color label: ${a.color}`}"></span>`:m} ${a?.flagged===!0?d`<span class="finding-bookmark-mark" role="img" aria-label="Bookmarked"></span>`:m}</div>`:m} ${oy(t,{variant:"full"})}<div class="value-label">Severity</div>${t.confidence===void 0?m:s3(t)} ${zF(t)} ${U}</div><div class="finding-body"><div class="line-row">${v} ${y?.tip??m} ${C} ${$?d`<span class="line-num discovered-in">(found analyzing ${$})</span>`:m} ${x?d`<span class="run-meta">${x}</span>`:m}</div>${y?.body??m} ${E?d`<div class="desc-title">${uc(E)}</div>`:m} ${W.map(Ce=>d`<div class="desc">${hr(Is(Ce.body))}</div>`)} ${jF(t,o)} ${he.map(Ce=>Ce.label===null?d`<div class="desc">${hr(Is(Ce.body))}</div>`:dc(Ce.label,Ce.body))} ${t.impact?dc("Impact",$t(t.impact,t)):m} ${t.reproduction?dc("Reproduction",$t(t.reproduction,t),"section",{collapsible:!0}):m} ${t.recommendation?dc("Recommendation",$t(t.recommendation,t),"recommendation",{collapsible:!0}):m} ${t.confidenceReason?d`<div class="conf-reason">${hr($t(t.confidenceReason,t))}</div>`:m} ${UF(t)} ${t.revalidateRecommendation&&eb()?dc("Revalidation recommendation",$t(t.revalidateRecommendation,t),"recommendation",{collapsible:!0}):m} ${Ut(t)&&t.correctedSeverityReason?d`<div class="severity-reason"><span class="severity-reason-label">Severity correction:</span> ${hr(t.correctedSeverityReason)}</div>`:m} ${DF(t,i)} ${c?d`<div class="comment-block"><span class="comment-label">Comment:</span> ${OF(c)}</div>`:m} ${u?d`<div class="fix-block"><span class="fix-label">Fix:</span> ${Be(u)?d`<a href="${u}" target="_blank" rel="noopener noreferrer">${u}</a>`:u}</div>`:m}</div></div>`}function rC(t){let e=["finding",...sy(t)];return Zr(t).length>1&&e.push("multi-case"),e}function nC(t,e={}){let{context:r=null}=e,n=ze(t),o=Zr(t),i=new Set(o.map(j)),s=ft(t),a=j(s),c=s.commitHash?d`<div class="commit-ref">introduced in ${VF(s.repo?.github,s.commitHash)}</div>`:m,u=l.currentWorkspace&&c!==m;return d`${o.map((p,f)=>c3(p,j(p)===a,f,o.length,r,i))} ${u?d`<div class="marks-commit-row">${c}</div>`:m}<div class="marks"><div class="marks-left">${u?m:c} ${o.length>1?tC(o,a,n):m}</div>${eC(t,o,n,s,r)}</div>`}function sy(t){let e=ze(t),r=t.some(o=>o.critical||ae(o,l.severityMode)==="critical"),n=[];return r&&n.push("is-critical"),e.hasConflict?n.push("has-conflict"):e.commonColor&&n.push(`mark-${e.commonColor}`),l.shownTriage&&n.push(`triage-${l.shownTriage}`),n}function oC(t){let e=ze(t),r=Zr(t),n=ft(t),o=j(n),i=n,s=dt(i),a=Ri(i),c=wn(i),u=c?`, ${c}`:"",p=qr(i,ur(i));return d`<div class="row-score">${oy(i,{variant:"compact"})} ${i.confidence===void 0?m:d`<span class="row-conf"><strong>${i.confidence}</strong>/10</span>`}</div><div class="row-body"><div class="title-row"><span class="title">${s}</span> ${a?d`<span class="row-type">${a}</span>`:m}</div><div class="meta-row"><span class="row-loc">${ZS(i,p)}${u}</span> ${iy(p)}<div class="marks">${eC(t,r,e,n,"table")}</div></div>${r.length>1?d`<div class="tabs-row">${tC(r,o,e)}</div>`:m}</div>`}var XS,_p,pc,WF,KF,GF,qF,Ws,XF,JF,Sp,a3,fc=w(()=>{"use strict";M();Me();fn();bt();O();ue();ot();wS();kp();yp();Rr();Wt();Fi();XS=/\[[^\]\n]+\]\([^)\s]+\)|\*\*[^*\n]+\*\*|"[^"\n]+"|`[^`\n]+`/gu;_p=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><path class="bubble" d="M2.5 3h11a.5.5 0 0 1 .5.5v6.5a.5.5 0 0 1-.5.5H8.4l-3 2.6V10.5H2.5a.5.5 0 0 1-.5-.5V3.5a.5.5 0 0 1 .5-.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,pc=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><path class="wrench" d="M10.4 2.6a3 3 0 0 0-3.6 4.5L2 12l2 2 4.9-4.8a3 3 0 0 0 4.5-3.6l-1.8 1.8-1.5-.4-.4-1.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,WF=d`<svg viewBox="0 0 16 16" width="11" height="11" 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>`,KF=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"><path d="M6.2 11.2H4.8a3.2 3.2 0 0 1 0-6.4h1.4"/><path d="M9.8 4.8h1.4a3.2 3.2 0 0 1 0 6.4H9.8"/><path d="M5.6 8h4.8"/></g></svg>`,GF=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 4.6 1.3 8l3.1 3.4"/><path d="m11.6 4.6 3.1 3.4-3.1 3.4"/><path d="M9.8 2.6 6.2 13.4"/></g></svg>`,qF=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/></svg>`;Ws={key:null,host:null};XF=d`<svg viewBox="4 5 8 8" width="11" height="11" fill="currentColor" aria-hidden="true"><path d="${Du}/"></path></svg>`,JF=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="1.2"/><circle cx="8" cy="8" r="1.7" fill="currentColor"/></svg>`,Sp=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><path class="flag-cloth" d="M5 1.5h6v13l-3-2.7-3 2.7z" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/></svg>`;a3=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/iu});function hc(t){return"tree-"+t.replaceAll(/[^\w-]+/gu,"_")}function ay(t,e){let r=new Map;for(let n of t)for(let o of n){r.has(o.file)||r.set(o.file,sC());let i=r.get(o.file),s=ae(o,e);i[s]!==void 0&&i[s]++}return r}function ly(t){let e=null;for(let r of t)if(r?.tree){e||(e={});for(let n of Object.keys(r.tree)){let o=r.tree[n];if(!e[n]){e[n]={...o,imports:[...o.imports??[]]};continue}let i=new Set(e[n].imports);for(let s of o.imports??[])i.has(s)||(i.add(s),e[n].imports.push(s));e[n].size==null&&o.size!=null&&(e[n].size=o.size)}}return e}function Cp(t,e){let r=Object.keys(t),n=new Map(r.map((c,u)=>[c,u])),o=r.map(()=>sC()),i=r.map(()=>[]);for(let[c,u]of r.entries())for(let p of t[u].imports??[]){let f=n.get(p);f!==void 0&&i[f].push(c)}let s=new Uint32Array(r.length),a=0;for(let[c,u]of e){let p=n.get(c);if(p===void 0||!u)continue;let f=Ee.map(b=>[b,u[b]??0]).filter(([,b])=>b!==0);if(f.length===0)continue;let h=++a,g=[],y=b=>{s[b]!==h&&(s[b]=h,g.push(b))};for(let b of i[p])y(b);for(;g.length>0;){let b=g.pop();for(let[v,x]of f)o[b][v]+=x;for(let v of i[b])y(v)}}return new Map(r.map((c,u)=>[c,o[u]]))}function cy(t,e,r){let n=e.get(t),o=r.get(t);return iC(n)>0||iC(o)>0}function iC(t){if(!t)return 0;let e=0;for(let r of Ee)e+=t[r]??0;return e}var sC,mc=w(()=>{"use strict";ue();sC=()=>Object.fromEntries(Ee.map(t=>[t,0]))});function aC(t){if(!t)return m;let e=vi(t)[0];return e?d`<button type="button" class="tree-code-btn" data-finding-code-bundle="${e.integrity}" data-finding-code-file="${e.file}" data-tooltip="${`Open ${e.file} in bundle source viewer`}">Code</button>`:m}function lC(t,e){let r=Object.keys(t).toSorted(),n=new Map;for(let p of r)for(let f of t[p].imports??[]){let h=n.get(f)??[];h.push(p),n.set(f,h)}let o=l.filesSearch.trim().toLowerCase(),i=o?r.filter(p=>p.toLowerCase().includes(o)):r,s=p=>t[p]?d`<a href="${`#${hc(p)}`}"><span class="name">${p}</span></a>`:d`<span class="name">${p}</span>`,a=p=>{let f=e.get(p);if(!f)return null;let h=Ee.filter(g=>(f[g]??0)>0);return h.length===0?null:d`<span class="tree-count-chips">${h.map(g=>d`<span class="${`tree-count-chip ${g}`}">${f[g]} ${g.replaceAll("_"," ")}</span>`)}</span>`},c=p=>{let f=e.get(p);return f?Ee.reduce((h,g)=>h+(f[g]??0),0):0},u=d`<div class="tree-toolbar"><view-mode-buttons modes="table,list" kind="files"></view-mode-buttons><div class="search-row"><toolbar-search kind="files"></toolbar-search><span class="result-count">${i.length} of ${r.length}</span></div></div>`;if(l.filesViewMode==="table"){let p=l.filesSelectedFile&&t[l.filesSelectedFile]&&i.includes(l.filesSelectedFile)?l.filesSelectedFile:null;return d`<div class="${p?"tree-view tree-view-table with-details":"tree-view tree-view-table"}">${u}<div class="${p?"tree-table-layout open":"tree-table-layout"}"><div class="tree-table-list">${i.length===0?d`<div class="tree-table-empty">No files match the search.</div>`:m} ${i.map(g=>{let y=c(g),b=g===p,v=_e(t[g].size);return d`<div class="${`tree-table-row${b?" selected":""}${y===0?" clean":""}`}" data-tree-select="${g}"><span class="tree-table-name">${g}</span> ${a(g)??d`<span class="tree-table-clean-marker">—</span>`} ${v?d`<span class="tree-table-size">${v}</span>`:m}</div>`})}</div>${p?d`<aside class="tree-table-details" id="tree-table-details"><header class="tree-table-details-bar"><span class="tree-table-details-label">Details</span> <button type="button" class="tree-table-details-close" data-tree-deselect aria-label="Close details">×</button></header><div class="tree-table-details-body">${d3(t[p],p,n.get(p)??[],s)}</div></aside>`:m}</div></div>`}return d`<div class="tree-view">${u} ${i.length===0?d`<div class="tree-table-empty">No files match the search.</div>`:m} ${i.map(p=>{let f=t[p],h=n.get(p)??[],g=_e(f.size);return d`<section class="tree-file" id="${hc(p)}"><div class="tree-file-header"><span class="name">${p}</span> ${a(p)} ${g?d`<span class="tree-file-size">${g}</span>`:m} ${aC(f.fileHash)}</div>${cC(f,h,s)}</section>`})}</div>`}function cC(t,e,r){return d`${t.fileHash||t.treeHash?d`<div class="tree-hashes hashes">${t.fileHash?d`<div class="tree-hash">file: ${t.fileHash}</div>`:m} ${t.treeHash?d`<div class="tree-hash">tree: ${t.treeHash}</div>`:m}</div>`:m} ${t.imports?.length>0?d`<div class="tree-section"><span class="tree-section-label">imports</span><ul>${t.imports.map(n=>d`<li>${r(n)}</li>`)}</ul></div>`:m} ${e.length>0?d`<div class="tree-section"><span class="tree-section-label">imported by</span><ul>${e.map(n=>d`<li>${r(n)}</li>`)}</ul></div>`:m} ${t.exports?.length>0?d`<div class="tree-section"><span class="tree-section-label">exports</span><ul>${t.exports.map(n=>d`<li><span class="name">${n}</span></li>`)}</ul></div>`:m}`}function d3(t,e,r,n){let o=_e(t.size);return d`<div class="tree-detail-name"><span class="name">${e}</span> ${o?d`<span class="tree-detail-size">${o}</span>`:m} ${aC(t.fileHash)}</div>${cC(t,r,n)}`}var dC=w(()=>{"use strict";M();O();ue();mc()});function Ks(){return uC}function u3(){return gc||(gc=(async()=>{let t="./graph.js";try{let e=await import(t);return e._swapGraph2Impl(US()),uC=e,e}catch(e){throw gc=null,e}})(),gc)}async function dy(t,e,r,n,o){try{let i=await u3(),s=i.buildGraphFromPrep(e);ie(d`<graph-layout .graph="${s}" .options="${r}"></graph-layout>`,t);let a=t.querySelector("graph-layout");return await a.updateComplete,n(),o(),i.attachGraph2Interaction(t,s,n,o),a}catch(i){let s=i instanceof Error?i.message:String(i);return t.textContent=`Graph failed to load: ${s}`,null}}var gc,uC,uy=w(()=>{"use strict";M();Eo();gc=null,uC=null});function p3(){return bc||(bc=(async()=>{let t="./terminal.js";try{return await import(t)}catch(e){throw bc=null,e}})(),bc)}function f3(t){let e=Mi(t);if(e.size===0)return e;let r=[...e.keys()],{stripped:n}=Kt(r),o=new Map;for(let i=0;i<r.length;i++)o.set(n[i],e.get(r[i]));return o}async function pC(t,e){let r=e?.integrity??"";(!yc||yc.integrity!==r)&&(yc={integrity:r,promise:h3(e,r)});try{let n=await yc.promise;return!t.isConnected||t.contains(n)||t.replaceChildren(n),n}catch(n){yc=null;let o=n instanceof Error?n.message:String(n);return t.textContent=`Terminal failed to load: ${o}`,null}}async function h3(t,e){return(await p3()).createTerminalElement(f3(t),e)}var bc,yc,fC=w(()=>{"use strict";tn();ue();bc=null,yc=null});function hC(t){if(!t)return null;let e=b_(),r=new RegExp(`^(?:.*/)?${e}/(@[^/]+/[^/]+|[^/]+)`,"u"),n=t.match(r);if(n)return n[1];let o=t.indexOf("/");return o>0?t.slice(0,o):"/"}function b3(){if(typeof document>"u")return!1;let t=document.body?.classList;return!!t&&(t.contains("theme-light")||t.contains("theme-pink"))}function Lt(t){let e=b3(),r=e?g3:m3,n=t??"__own__",o=`${e?"l":"d"}:${n}`;if(py.has(o))return py.get(o);let i=0;for(let u of n)i=i*37+u.codePointAt(0)|0;let a=((i%r.length+r.length)%r.length*7+3)%r.length,c=r[a];return py.set(o,c),c}var m3,g3,py,Bi=w(()=>{"use strict";ue();m3=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],g3=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];py=new Map});var fy,mC=w(()=>{fy=(t,e,r)=>{for(let n of e)if(n[0]===t)return(0,n[1])();return r?.()}});var gC=w(()=>{mC()});function hy(t,e){let r=t.toLowerCase(),n="",o=r;if(r.startsWith("@")){let s=r.indexOf("/");s>0&&(n=r.slice(0,s),o=r.slice(s+1))}return`pkg:npm/${n?`${encodeURIComponent(n)}/`:""}${encodeURIComponent(o)}@${encodeURIComponent(e)}`}function Ep(t){let e=/^(.*?)\.stasis\.(?:code|resources)\.br$/u.exec(t);return e?e[1]:t.replace(/\.[^.]+$/u,"")||t}function yC(t){let e=[];if(t?.kind!=="stasis"||!t.bundle?.modules)return e;let r=new Map;for(let[n,o]of t.bundle.modules){if(!o?.name||typeof o.version!="string"||!o.version)continue;let i=`${o.name}@${o.version}`,s=r.get(i);if(s!==void 0){n==="."&&(e[s].dir=".");continue}r.set(i,e.length),e.push({name:o.name,version:o.version,dir:n})}return e}function vC(t){if(t?.kind!=="stasis"||!t.bundle?.modules)return!1;for(let[,e]of t.bundle.modules)if(e?.name&&typeof e.version=="string"&&e.version)return!0;return!1}function wC(t,e){let r=t.find(i=>i.dir===".")??null,n=r?t.filter(i=>i!==r):t;return{root:r?{name:r.name,version:r.version,purl:hy(r.name,r.version)}:{name:Ep(e?.name??"bundle"),version:null,purl:null},rest:n}}function kC(t){return t??globalThis.crypto.randomUUID()}function xC(t,e,{now:r=new Date,uuid:n}={}){let o=yC(t),{root:i,rest:s}=wC(o,e),a={type:"application","bom-ref":i.purl??`application:${i.name}`,name:i.name};i.version&&(a.version=i.version),i.purl&&(a.purl=i.purl);let c={bomFormat:"CycloneDX",specVersion:"1.5",serialNumber:`urn:uuid:${kC(n)}`,version:1,metadata:{timestamp:r.toISOString(),tools:{components:[{type:"application",name:bC}]},component:a},components:s.map(u=>{let p=hy(u.name,u.version);return{type:"library","bom-ref":p,name:u.name,version:u.version,purl:p}})};return`${JSON.stringify(c,null,2)}
107
+ `}function y3(t){return{referenceCategory:"PACKAGE-MANAGER",referenceType:"purl",referenceLocator:t}}function $C(t,e,{now:r=new Date,uuid:n}={}){let o=yC(t),{root:i,rest:s}=wC(o,e),a=Ep(e?.name??"bundle"),c=r.toISOString().replace(/\.\d{3}Z$/u,"Z"),u=(y,b,v,x)=>{let k={SPDXID:y,name:b,downloadLocation:"NOASSERTION",filesAnalyzed:!1,licenseConcluded:"NOASSERTION",licenseDeclared:"NOASSERTION",copyrightText:"NOASSERTION"};return v&&(k.versionInfo=v),x&&(k.externalRefs=[y3(x)]),k},p="SPDXRef-Package-root",f=[u(p,i.name,i.version,i.purl)],h=[{spdxElementId:"SPDXRef-DOCUMENT",relationshipType:"DESCRIBES",relatedSpdxElement:p}];s.forEach((y,b)=>{let v=`SPDXRef-Package-${b+1}`;f.push(u(v,y.name,y.version,hy(y.name,y.version))),h.push({spdxElementId:p,relationshipType:"DEPENDS_ON",relatedSpdxElement:v})});let g={spdxVersion:"SPDX-2.3",dataLicense:"CC0-1.0",SPDXID:"SPDXRef-DOCUMENT",name:a,documentNamespace:`https://spdx.org/spdxdocs/${encodeURIComponent(a)}-${kC(n)}`,creationInfo:{created:c,creators:[`Tool: ${bC}`]},packages:f,relationships:h};return`${JSON.stringify(g,null,2)}
108
+ `}var bC,my=w(()=>{"use strict";bC="@preventive/triage"});function v3(t,e){let r=e?"gu":"giu",n=e?"g":"gi";try{return{re:new RegExp(t,r)}}catch{try{return{re:new RegExp(t,n)}}catch(o){return{error:o.message}}}}function gy(t,e,r){if(e){let i=v3(t,r);if(i.error)return{error:i.error};let{re:s}=i;return{ranges(a){s.lastIndex=0;let c=[],u;for(;(u=s.exec(a))!==null;){if(u[0].length===0){s.lastIndex++;continue}if(c.push([u.index,u.index+u[0].length]),c.length>=50)break}return c}}}let n=r?t:t.toLowerCase(),o=n.length;return{ranges(i){let s=r?i:i.toLowerCase(),a=[],c=0,u;for(;(u=s.indexOf(n,c))!==-1&&(a.push([u,u+o]),c=u+o,!(a.length>=50)););return a}}}function w3(t,e){let r=[...t.keys()].toSorted(),n=[],o=0,i=!1;for(let s of r){let a=t.get(s);if(typeof a!="string")continue;let c=a.split(`
109
+ `),u=[];for(let p=0;p<c.length;p++){let f=e.ranges(c[p]);if(f.length!==0&&(u.push({ln:p+1,ranges:f}),o++,o>=5e3)){i=!0;break}}if(u.length>0&&n.push({path:s,lines:c,hits:u}),i)break;if(n.length>=500){i=!0;break}}return{fileResults:n,totalHits:o,truncated:i}}function k3(t,e){let r=[],n=0;for(let{path:o,lines:i,hits:s}of t.fileResults){let a=[];for(let{ln:c}of s){let u=e.ranges(i[c-1]);u.length!==0&&(a.push({ln:c,ranges:u}),n++)}a.length>0&&r.push({path:o,lines:i,hits:a})}return{fileResults:r,totalHits:n,truncated:!1}}function _C(t,e,r,n,o){if(!r)return{fileResults:[],totalHits:0,truncated:!1};let i=gy(r,n,o);if(i.error)return{error:i.error};(Ft.tag!==t||Ft.useRegex!==n||Ft.caseSensitive!==o)&&(Ft.tag=t,Ft.useRegex=n,Ft.caseSensitive=o,Ft.entries.length=0);let s=n||o?f=>f:f=>f.toLowerCase(),a=s(r),c=null,u=-1;for(let f=0;f<Ft.entries.length;f++){let h=Ft.entries[f],g=s(h.query);if(g===a)return Ft.entries.splice(f,1),Ft.entries.unshift(h),h.result;n||h.result.truncated||g.length<=u||!a.includes(g)||(c=h.result,u=g.length)}let p=c?k3(c,i):w3(e,i);return Ft.entries.unshift({query:r,result:p}),Ft.entries.length>8&&Ft.entries.pop(),p}var Ft,SC=w(()=>{"use strict";Ft={tag:null,useRegex:!1,caseSensitive:!1,entries:[]}});function st(t,{splitOwnDirs:e=!0,packageDir:r=null}={}){if(r){if(r!=="."){let n=r.match(/(?:^|\/)node_modules\/(@[^/]+\/[^/]+|[^/]+)$/u);return n&&n[1]!==".pnpm"?n[1]:r}}else{let n=/(?:^|\/)(?:node_modules|dependencies)\/(@[^/]+\/[^/]+|[^/]+)/gu,o;for(;(o=n.exec(t))!==null;)if(o[1]!==".pnpm")return o[1]}if(e){let n=t.indexOf("/");if(n>0)return t.slice(0,n)}return"__own__"}function CC(t,e=null){let r=new Set;for(let n of t){let o=e?.(n)??null;if(st(n,{splitOwnDirs:!1,packageDir:o})==="__own__"&&(r.add(st(n,{splitOwnDirs:!0,packageDir:o})),r.size>1))return!0}return!1}function To(t){return t==="__own__"?"own source":typeof t!="string"?t:t.match(/^(?:.*\/)?vendor\/(.+)$/u)?.[1]??t}var Gs=w(()=>{"use strict"});function qs(t,e){let r=new Map,n=t?.kind==="stasis"?t.bundle?.reason:null;if(!n||typeof n!="object"||Array.isArray(n))return r;let o=new Set(e);for(let[i,s]of Object.entries(n).toSorted(([a],[c])=>a.localeCompare(c))){if(!i||!Array.isArray(s))continue;let a=new Set(s.filter(c=>typeof c=="string"&&o.has(c)));a.size>0&&r.set(i,a)}return[...r.values()].some(i=>i.size<o.size)||r.clear(),r}function EC(t,e,r,n){let o=r.has(n)?n:null;if(o===null)return{tree:t,origToStripped:e,selected:o};let i=new Map([...e].filter(([c])=>r.get(o).has(c))),s=new Set(i.values());return{tree:Object.fromEntries([...s].map(c=>[c,{...t[c],imports:(t[c].imports??[]).filter(u=>s.has(u))}])),origToStripped:i,selected:o}}function by(t,e,{splitOwnDirs:r=!1,packageDir:n}={}){let o=st(e,{splitOwnDirs:!1,packageDir:n});return o==="__own__"?st(t,{splitOwnDirs:r,packageDir:n}):o}function yy(t){let e=new Map;if(t?.kind!=="stasis"||!t.bundle)return e;for(let r of t.bundle.imports.values())for(let[n,o]of r){e.has(n)||e.set(n,new Set);for(let i of o.values()){let s=typeof i=="string"?[i]:i instanceof Map?i.values():[];for(let a of s)typeof a=="string"&&e.get(n).add(a)}}return e}function RC(t,e,r,n,o=e){let i=yy(t),s=new Set;for(let[c,u]of e)st(c,{splitOwnDirs:!1,packageDir:n?.get(c)})==="__own__"&&s.add(r(u));for(let c of t?.bundle?.entries??[]){let u=e.get(c);u!==void 0&&s.add(r(u))}if(s.size===0){let c=new Set;for(let[p,f]of e){let h=n?.get(p);h&&h!=="."&&!/(?:^|\/)(?:node_modules|dependencies|vendor)(?:\/|$)/u.test(h)&&c.add(r(f))}let u=new Set;for(let[p,f]of i){let h=e.get(p);if(!(h===void 0||!c.has(r(h))))for(let g of f){let y=e.get(g);y!==void 0&&r(h)!==r(y)&&u.add(r(y))}}for(let p of c)u.has(p)||s.add(p)}let a=new Set;for(let[c,u]of i)if(!o.has(c)&&st(c,{splitOwnDirs:!1,packageDir:n?.get(c)})==="__own__")for(let p of u){let f=e.get(p);f!==void 0&&a.add(r(f))}return a.size>0&&s.add("__own__"),{roots:[...s],appImports:[...a]}}var Rp=w(()=>{"use strict";Gs()});var TC,AC=w(()=>{TC=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}dialog{margin-top:5rem;margin-inline:auto;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);padding:1.1rem 1.25rem 1rem;max-width:480px;width:min(94vw,480px);box-shadow:0 20px 60px #00000059;&::backdrop{background:rgb(from var(--theme-bar) r g b / .55);backdrop-filter:blur(2px)}}header h3{margin:0 0 .6rem;font-size:1rem;font-weight:600}.nwd-input{display:block;width:100%;box-sizing:border-box;padding:.5rem .65rem;border:1px solid var(--border);border-radius:6px;background:var(--bg, var(--surface));color:var(--text);font:inherit;font-size:.88rem;&: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)}}.nwd-note{margin:.55rem 0 0;color:var(--muted);font-size:.74rem;line-height:1.45}.nwd-intro{margin:0 0 .8rem;color:var(--muted);font-size:.82rem;line-height:1.5}.nwd-actions{display:flex;align-items:center;gap:.4rem;margin-top:.8rem;padding-top:.7rem;border-top:1px solid var(--border)}.nwd-spacer{flex:1}.nwd-actions button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.35rem .9rem;font:inherit;font-size:.8rem;&:hover:not(:disabled){border-color:var(--accent);color:var(--accent)}&.primary{background:var(--accent);color:var(--surface);border-color:var(--accent);&:hover:not(:disabled){color:var(--surface);filter:brightness(1.08)}}&.quiet{border-color:transparent;color:var(--muted);&:hover:not(:disabled){border-color:transparent}}&.danger{color:var(--critical, #f87171);border-color:var(--border);&:hover:not(:disabled){border-color:var(--critical, #f87171);color:var(--critical, #f87171)}}&:disabled{opacity:.5}}@media(display-mode:window-controls-overlay){dialog{-webkit-app-region:no-drag;app-region:no-drag}}
110
+ `});function le(t,e={}){return new Promise(r=>{let n=document.createElement(t);Object.assign(n,e),n.addEventListener("resolve",o=>{n.remove(),r(o.detail)}),document.body.append(n)})}function Ys(t,e,r){return new Promise((n,o)=>{let i=document.createElement(t);Object.assign(i,e),i.addEventListener("resolve",s=>{i.remove(),n(s.detail)}),i.addEventListener("modal-conflict",s=>{r(i),i.remove(),o(Zi(s.detail?.cause))}),document.body.append(i)})}var F,fe=w(()=>{"use strict";M();Nt();go();AC();F=class extends J{static styles=[A(TC)];firstUpdated(){cr(this.renderRoot),this.beforeOpen();let e=this.renderRoot.querySelector("dialog");if(e){try{e.showModal()}catch(r){this._settled=!0,this.dispatchEvent(new CustomEvent("modal-conflict",{detail:{cause:r}}));return}this.focusInitial()}}beforeOpen(){}focusInitial(){(this.renderRoot.querySelector("input, textarea")??this.renderRoot.querySelector("button.primary")??this.renderRoot.querySelector("button"))?.focus()}_finish(e){this._settled||(this._settled=!0,this.renderRoot.querySelector("dialog")?.close(),this.dispatchEvent(new CustomEvent("resolve",{detail:e})))}_onClose=()=>this._finish(null)}});var qe,Tr=w(()=>{qe=`.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: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: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{margin:0;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, #f87171);font-size:.72rem;line-height:1.35}
111
+ `});function MC({name:t,workspaceNames:e,existingNames:r}={}){let n=r instanceof Set?r:new Set(r??[]);return new Promise(o=>{let i=document.createElement("import-conflict-dialog");Object.assign(i,{reportName:t??"",workspaceNames:Array.isArray(e)?e:[],existingNames:n,_newName:_3(t??"",n)}),i.addEventListener("resolve",s=>{i.remove(),o(s.detail)}),i.addEventListener("modal-conflict",()=>{i.remove(),o({action:"cancel"})}),document.body.append(i)})}function _3(t,e){if(typeof t!="string"||t.length===0)return"";let r=t.lastIndexOf("."),n=r>0?t.slice(0,r):t,o=r>0?t.slice(r):"",i=n.replace(/-\d+$/u,"");for(let s=2;s<1e3;s++){let a=`${i}-${s}${o}`;if(!e.has(a))return a}return""}var vy,IC=w(()=>{"use strict";M();fe();Tr();vy=class extends F{static styles=[...F.styles,A(qe)];static properties={reportName:{type:String},workspaceNames:{type:Array},existingNames:{type:Object},_choice:{state:!0},_newName:{state:!0}};constructor(){super(),this.reportName="",this.workspaceNames=[],this.existingNames=new Set,this._choice="replace",this._newName=""}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_onClose=()=>this._finish({action:"cancel"});_onCancel=()=>this._finish({action:"cancel"});_onChoiceChange=e=>{this._choice=e.target.value};_onNewNameInput=e=>{this._newName=e.target.value};_onNewNameKeydown=e=>{e.key==="Enter"&&(e.preventDefault(),this._onConfirm())};_onConfirm=()=>{if(this._choice==="rename"){let e=(this._newName??"").trim();if(this._renameError(e)!==null)return;this._finish({action:"rename",newName:e});return}this._finish({action:"replace"})};_replaceHint(){let e=this.workspaceNames.length;if(e===0)return d`<span class="lwd-option-hint">The local file will be overwritten.</span>`;let r=e===1?d`workspace <strong>"${this.workspaceNames[0]}"</strong>`:d`<strong>${e}</strong> workspaces (${this.workspaceNames.join(", ")})`;return d`<span class="lwd-option-hint">The local file will be overwritten. When sync is online, the new bytes are also uploaded to ${r} so the cloud copy matches.</span>`}_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",r=(this._newName??"").trim(),n=e?this._renameError(r):null,o=n!==null,i=e?"Rename":"Replace",s=e?"primary":"danger",a=this.workspaceNames.length>0?d`<span class="lwd-option-hint">Saved as an unfiled report — the renamed copy isn't added to any workspace.</span>`:m;return d`<dialog @close="${this._onClose}"><header><h3>Import conflict</h3></header><p class="lwd-body"><strong>"${this.reportName}"</strong> already exists with different content.</p><fieldset class="lwd-choice"><legend>What should happen?</legend><label class="lwd-option"><input type="radio" name="icd-choice" value="replace" ?checked="${this._choice==="replace"}" @change="${this._onChoiceChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Replace</span> ${this._replaceHint()}</span></label> <label class="lwd-option"><input type="radio" name="icd-choice" value="rename" ?checked="${this._choice==="rename"}" @change="${this._onChoiceChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Rename to</span> <input type="text" class="nwd-input lwd-rename-input" maxlength="200" .value="${this._newName}" ?disabled="${!e}" @input="${this._onNewNameInput}" @keydown="${this._onNewNameKeydown}" @focus="${()=>{this._choice="rename"}}"> ${a} ${n===null?m:d`<p class="lwd-rename-error">${n}</p>`}</span></label></fieldset><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="${s}" ?disabled="${o}" @click="${this._onConfirm}">${i}</button></footer></dialog>`}};customElements.define("import-conflict-dialog",vy)});function wy(t,e){let r=kn(t);if(r.data!=null||au(t,e)!=="codex")return r;try{return{data:{type:"security",source:"codex-security",findings:rl(t).flatMap(o=>o.data.findings)},format:"codex",reason:null}}catch(n){return{data:null,format:null,reason:n instanceof Error?n.message:"Invalid Codex CSV"}}}var LC=w(()=>{"use strict";Oe()});var Mo,vc=w(()=>{Mo=`.conflict-sev{display:inline-block;padding:1px .4rem;border-radius:3px;font-size:.62rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:#fff;flex-shrink:0;&.sev-critical{background:var(--critical)}&.sev-high{background:var(--high)}&.sev-medium{background:var(--medium)}&.sev-low{background:var(--low)}&.sev-high_bug{background:var(--high-bug)}&.sev-bug{background:var(--bug)}&.sev-informational{background:var(--info)}}
112
+ `});var BC,FC=w(()=>{BC=`dialog{max-width:720px;width:min(94vw,720px)}header h3{margin:0 0 .25rem}header p{margin:0 0 .75rem;color:var(--muted);font-size:.82rem}.bulk{display:flex;gap:.4rem;margin-bottom:.7rem;padding-bottom:.7rem;border-bottom:1px solid var(--border)}.bulk button,.actions button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.3rem .8rem;font:inherit;font-size:.78rem;&:hover{border-color:var(--accent);color:var(--accent)}&.primary{background:var(--accent);color:var(--surface);border-color:var(--accent)}&.primary:hover{filter:brightness(1.08)}}.list{list-style:none;margin:0;padding:0;max-height:60vh;overflow-y:auto;overscroll-behavior:none;-webkit-app-region:no-drag;app-region:no-drag;display:flex;flex-direction:column;gap:.5rem}.card{border:1px solid var(--border);border-radius:6px;padding:.55rem .7rem .6rem;background:rgb(from var(--text) r g b / .02)}.card-head{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}.id{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.68rem;color:var(--muted);padding:1px .3rem;background:rgb(from var(--text) r g b / .05);border-radius:3px}.desc{font-size:.78rem;color:var(--muted);margin-bottom:.55rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rows{display:flex;flex-direction:column;gap:.35rem}.row{display:grid;grid-template-columns:5rem 1fr 1fr;align-items:stretch;gap:.4rem}.row-label{color:var(--muted);font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;align-self:center}.choice{position:relative;display:flex;flex-direction:column;gap:.15rem;padding:.35rem .5rem;border:1px solid var(--border);border-radius:5px;min-width:0;&:has(input:checked){border-color:var(--accent);background:rgb(from var(--accent) r g b / .07)}&:has(input:focus-visible){outline:2px solid var(--accent);outline-offset:1px}}.choice input[type=radio]{position:absolute;opacity:0;pointer-events:none}.choice-label{font-size:.68rem;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.choice:has(input:checked) .choice-label{color:var(--accent)}.choice-value{font-size:.82rem;min-width:0}.flag-badge{font-size:.82rem;color:var(--muted)}.flag-badge.on{color:var(--accent);font-weight:600}.color{display:inline-flex;align-items:center;gap:.35rem}.color-dot{width:12px;height:12px;border-radius:50%;box-shadow:0 0 0 1px rgb(from var(--text) r g b / .2);flex-shrink:0;&.marker-red{background:var(--marker-red)}&.marker-blue{background:var(--marker-blue)}&.marker-green{background:var(--marker-green)}&.marker-gray{background:var(--marker-gray)}}.color-name{text-transform:capitalize}.comment-text{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;color:var(--text);white-space:pre-wrap;overflow-wrap:anywhere;& em{color:var(--muted);font-style:italic}}.fix-text{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-all;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}}.actions{display:flex;justify-content:flex-end;gap:.4rem;margin-top:.8rem;padding-top:.7rem;border-top:1px solid var(--border)}
113
+ `});function Ap({tabs:t,current:e,prefix:r,select:n,disabled:o=!1}){return d`<div class="dlg-tabs" role="tablist" @keydown="${s=>{if(s.key!=="ArrowLeft"&&s.key!=="ArrowRight")return;s.preventDefault();let a=t.findIndex(f=>f.id===e),c=s.key==="ArrowRight"?1:-1,u=t[(a+c+t.length)%t.length];if(!u||u.id===e)return;let p=s.currentTarget;n(u.id),requestAnimationFrame(()=>p.querySelector(`#${r}-tab-${u.id}`)?.focus())}}">${t.map(s=>d`<button type="button" role="tab" class="dlg-tab" id="${`${r}-tab-${s.id}`}" aria-controls="${`${r}-panel-${s.id}`}" aria-selected="${String(e===s.id)}" tabindex="${e===s.id?0:-1}" ?disabled="${o&&e!==s.id}" @click="${()=>n(s.id)}">${s.icon??m}${s.label}</button>`)}</div>`}function Io(t){if(!t)return m;let e=t.replaceAll("_"," ");return d`<span class="${`conflict-sev sev-${t}`}">${e}</span>`}function E3(t){return`bundle-${t.slice(7,19)}\u2026`}function Lo(t){return t.kind==="bundle"?t.label??E3(t.identifier):t.identifier}function OC(t){return t.kind==="bundle"?"bundle":Hu(t.identifier)?"links file":"report"}function Tp(t){let e=t.length,r=e===1,n=new Set(t.map(OC)),o="items";if(n.size===1){let i=[...n][0];o=r?i:`${i}s`}return{count:e,singular:r,kindLabel:o}}function Mp(t){return d`<ul class="lwd-list">${t.map(e=>{let r=OC(e);return d`<li>${Lo(e)}${r==="report"?m:d`<span class="lwd-kind-tag">${r}</span>`}</li>`})}</ul>`}function Ip(t){return t.length===0?m:d`<ul class="lwd-list" role="alert">${t.map(e=>d`<li><strong>${e.label}</strong> — ${e.reason}</li>`)}</ul>`}var Bn=w(()=>{"use strict";M();Rr()});function R3(t){return t?d`<span class="color"><span class="${`color-dot marker-${t}`}"></span> <span class="color-name">${t}</span></span>`:d`<em>none</em>`}function A3(t){return d`<span class="comment-text">${t||d`<em>empty</em>`}</span>`}function T3(t){return t?Be(t)?d`<span class="fix-text"><a href="${t}" target="_blank" rel="noopener noreferrer">${t}</a></span>`:d`<span class="fix-text">${t}</span>`:d`<span class="comment-text"><em>empty</em></span>`}function M3(t){return t?d`<span class="${`triage triage-${t}`}">${t}</span>`:d`<em>none</em>`}function I3(t){return t?d`<span class="${`flag-badge${t==="flagged"?" on":""}`}">${t}</span>`:d`<em>none</em>`}function PC(t,e){return t==="color"?R3(e):t==="comment"?A3(e):t==="fix"?T3(e):t==="triage"?M3(e):t==="flagged"?I3(e):d`${String(e)}`}function L3(t,e){let r=t?.file?t.line?`${t.file}:${t.line}`:t.file:"";return d`<div class="card-head">${Io(t?.severity)} ${r?d`<span class="loc" title="${r}">${r}</span>`:m} <code class="id" title="${e}">${e.slice(0,8)}…</code></div>${t?.description?d`<div class="desc" title="${t.description}">${t.description}</div>`:m}`}function Lp(t,e,r={}){return new Promise((n,o)=>{let i=document.createElement("triage-conflict-dialog");i.conflicts=t,i.findingLookup=e,i.labels={...DC,...r},i.addEventListener("resolve",s=>{i.remove(),n(s.detail)}),i.addEventListener("modal-conflict",s=>{i.remove(),o(Zi(s.detail?.cause))}),document.body.append(i)})}var DC,NC,F3,ky,Fp=w(()=>{"use strict";M();ue();Nt();fe();vc();FC();Bn();DC={title:"Triage conflicts",intro:"disagree with your local triage on",trailingNote:"",applyButton:"Apply",importedSideLabel:"Apply imported"},NC={color:0,comment:1,fix:2,triage:3,flagged:4},F3={color:"Color",comment:"Comment",fix:"Fix",triage:"Triage state",flagged:"Flag"},ky=class extends F{static styles=[...F.styles,A(Mo),A(BC)];static properties={conflicts:{attribute:!1},findingLookup:{attribute:!1},labels:{attribute:!1},_settled:{state:!0}};constructor(){super(),this.conflicts=[],this.findingLookup=new Map,this.labels={...DC},this._settled=!1}focusInitial(){}_blockEscClose=e=>e.preventDefault();_onClick=e=>{let r=e.target.closest("[data-bulk]");if(!r)return;let n=r.dataset.bulk;for(let o of this.renderRoot.querySelectorAll(`input[type="radio"][value="${n}"]`))o.checked=!0};_onSubmit=e=>{e.preventDefault();let r={};for(let n of this.conflicts){let o=`${n.id}:${n.property}`,i=this.renderRoot.querySelector(`input[name="conflict-${CSS.escape(o)}"]:checked`);i&&(r[o]=i.value)}this._finish(r)};render(){let e=this.labels,r=new Map;for(let p of this.conflicts)r.has(p.id)||r.set(p.id,[]),r.get(p.id).push(p);for(let p of r.values())p.sort((f,h)=>(NC[f.property]??99)-(NC[h.property]??99));let n=this.conflicts.filter(p=>p.property==="color").length,o=this.conflicts.filter(p=>p.property==="comment").length,i=this.conflicts.filter(p=>p.property==="fix").length,s=this.conflicts.filter(p=>p.property==="triage").length,a=this.conflicts.filter(p=>p.property==="flagged").length,c=[n?`${n} color${n===1?"":"s"}`:"",o?`${o} comment${o===1?"":"s"}`:"",i?`${i} fix${i===1?"":"es"}`:"",s?`${s} triage state${s===1?"":"s"}`:"",a?`${a} flag${a===1?"":"s"}`:""].filter(Boolean).join(", "),u=`${r.size} finding${r.size===1?"":"s"}`;return d`<dialog @click="${this._onClick}" @cancel="${this._blockEscClose}" @close="${this._onClose}"><header><h3>${e.title}</h3><p>${u} ${e.intro} ${c}.${e.trailingNote?` ${e.trailingNote}`:""}</p><div class="bulk"><button type="button" data-bulk="local">Keep all current</button> <button type="button" data-bulk="imported">${e.importedSideLabel} (all)</button></div></header><form @submit="${this._onSubmit}"><ul class="list">${[...r.entries()].map(([p,f])=>d`<li class="card" data-id="${p}">${L3(this.findingLookup.get(p),p)}<div class="rows">${f.map(h=>{let g=`${h.id}:${h.property}`,y=`conflict-${g}`;return d`<div class="row" data-key="${g}"><span class="row-label">${F3[h.property]??h.property}</span> <label class="choice"><input type="radio" name="${y}" value="local" required> <span class="choice-label">Keep current</span> <span class="choice-value">${PC(h.property,h.local)}</span></label> <label class="choice"><input type="radio" name="${y}" value="imported" required> <span class="choice-label">${e.importedSideLabel}</span> <span class="choice-value">${PC(h.property,h.imported)}</span></label></div>`})}</div></li>`)}</ul><footer class="actions"><button type="submit" class="primary">${e.applyButton}</button></footer></form></dialog>`}};customElements.define("triage-conflict-dialog",ky)});var mr,Oi=w(()=>{mr=`dialog{max-width:520px;width:min(94vw,520px)}.wsl-field{display:block;margin-top:.6rem;color:var(--text);font-size:.78rem;>span{display:block;margin-bottom:.25rem;color:var(--muted);font-size:.72rem;text-transform:uppercase;letter-spacing:.04em}}.wsl-ack{display:flex;align-items:flex-start;gap:.5rem;margin-top:.6rem;color:var(--text);font-size:.8rem;line-height:1.4;>input[type=checkbox]{flex:0 0 auto;margin-top:.15rem}>span{flex:1 1 auto}}.wsl-link{display:block;width:100%;box-sizing:border-box;padding:.5rem .65rem;border:1px solid var(--border);border-radius:6px;background:var(--bg, var(--surface));color:var(--text);font:inherit;font-size:.78rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;resize:vertical;word-break:break-all}.wsl-error{margin:.55rem 0 0;color:var(--critical, #f87171);font-size:.74rem;line-height:1.4}.wsl-warning{padding:.55rem .65rem;border:1px solid var(--critical, #f87171);border-radius:6px;background:rgb(from var(--critical, #f87171) r g b / .08);>p+p{margin-top:.45rem}}.wsl-optout{display:flex;align-items:center;gap:.5rem;margin-top:.7rem;color:var(--text);font-size:.78rem}.nwd-input:disabled{opacity:.5}.nwd-actions button.primary.danger{background:var(--critical, #f87171);border-color:var(--critical, #f87171);color:var(--surface);&:hover:not(:disabled){border-color:var(--critical, #f87171);color:var(--surface);filter:brightness(1.08)}}
114
+ `});function zC({tryPassword:t}={}){if(typeof t!="function")throw new TypeError("openWorkspaceUnlockBundleDialog: tryPassword required");return Ys("workspace-unlock-bundle-dialog",{_tryPassword:t},e=>{e._tryPassword=null})}var xy,UC=w(()=>{"use strict";M();fe();Oi();xy=class extends F{static styles=[...F.styles,A(mr)];static properties={_password:{state:!0},_busy:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this._password="",this._busy=!1,this._error="",this._settled=!1,this._tryPassword=null}_finish(e){this._settled||(this._password="",this._tryPassword=null,super._finish(e))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_onPasswordInput=e=>{this._password=e.target.value,this._error=""};_onUnlock=async()=>{if(!(!this._password||this._busy)){this._busy=!0,this._error="";try{let e=await this._tryPassword(this._password);if(this._settled)return;this._finish(e)}catch(e){if(this._settled)return;this._error=e?.message??String(e)}finally{this._busy=!1}}};_onKeydown=e=>{e.key==="Enter"&&(e.preventDefault(),this._onUnlock())};render(){return d`<dialog @close="${this._onClose}"><header><h3>Unlock encrypted workspace</h3></header><p class="nwd-note">This workspace bundle is password-protected. Enter the password the sender shared with you separately to decrypt and import it.</p><label class="wsl-field"><span>Password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-bundle-unlock" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> ${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._password||this._busy}" @click="${this._onUnlock}">${this._busy?"Unlocking\u2026":"Unlock"}</button></footer></dialog>`}};customElements.define("workspace-unlock-bundle-dialog",xy)});async function HC(t){let e=await Fg(t),r=await Ng(e);if(r.kind==="reports")return{kind:"reports",reports:r.reports};let n;if(r.kind==="encrypted"){if(n=await zC({tryPassword:i=>Bg(e,i)}),!n)return null}else n=Al(r.text);let o=await Og(n,{conflictResolver:async(i,s)=>{try{return await Lp(i,s,{title:"Triage conflicts on import",intro:"disagree with your local triage on",trailingNote:"Reports and non-conflicting triage were already merged; pick which side to keep for these disagreements.",importedSideLabel:"Apply imported"})}catch{let a=i.length;return alert(`Imported ${t.name}. Kept your local triage on ${a} conflicting entr${a===1?"y":"ies"} because another dialog is open \u2014 re-drop the file to pick again.`),null}}});return(l.currentFile||l.currentWorkspace)&&_(),{kind:"workspace",workspace:o}}var jC=w(()=>{"use strict";O();St();Fp();UC()});function Bp(){return le("passkey-setup-dialog")}var $y,_y=w(()=>{"use strict";M();O();fe();Oi();$y=class extends F{static styles=[...F.styles,A(mr)];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){if(e.has("_success")&&this._success){let r=this.renderRoot.querySelector("footer button.primary");r&&r.focus()}}beforeOpen(){typeof location<"u"&&(this._userName=location.hostname||"DeepView"),this._orphan=Ta(),this._vaultStateUnsub=tt(()=>{if(this._settled)return;let e=Ta();this._orphan&&!e&&de()?(this._error="Encryption was just enabled in another tab. Close this dialog and reload to unlock.",this._busy=!1,this._canCancel=!0):this._orphan!==e&&(this._orphan=e)})}async focusInitial(){await this.updateComplete;let e=this._orphan?'input[data-role="orphan-ack"]':'input[data-role="name"]';this.renderRoot.querySelector(e)?.focus()}disconnectedCallback(){if(super.disconnectedCallback(),this._vaultStateUnsub){try{this._vaultStateUnsub()}catch{}this._vaultStateUnsub=null}}_finish(e){if(!this._settled){if(this._abortController)try{this._abortController.abort()}catch{}super._finish(!!e)}}_onClose=()=>this._finish(this._success);_onCancel=()=>{this._busy&&!this._canCancel||this._finish(!1)};_onDialogCancel=e=>{if(this._busy&&!this._canCancel){e.preventDefault();return}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(de()){this._error="Encryption was just enabled in another tab. Reload this page to unlock.";return}this._busy=!0,this._canCancel=!1,this._error="",this._phase="Clearing previous vault state\u2026";try{await La({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(!Pr()){this._error="Passkeys are not supported in this browser.";return}this._busy=!0,this._canCancel=!0,this._error="",this._phase="Registering passkey\u2026",this._abortController=new AbortController;try{await hh({userName:this._userName.trim()||"DeepView user",rpName:"DeepView",signal:this._abortController.signal,migrate:async({seal:r})=>{this._canCancel=!1,this._phase="Encrypting workspaces and metadata\u2026",await ch({seal:r}),this._phase="Encrypting triage data\u2026",await mg({seal:r}),this._phase="Encrypting report files\u2026",await Ah({seal:r}),this._phase="Encrypting bundles\u2026",await Mh({seal:r})}})&&(this._success=!0,this._phase="")}catch(e){e?.name==="AbortError"?this._error="":this._error=e?.message??String(e),this._phase=""}finally{this._busy=!1,this._canCancel=!0,this._abortController=null}}};_body(){if(this._orphan)return d`<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">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._phase?d`<p class="nwd-note">${this._phase}</p>`:m} ${this._error?d`<p class="wsl-error">${this._error}</p>`:m}<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="${this._busy||!this._orphanAck}" @click="${this._onWipeOrphan}">${this._busy?"Working\u2026":"Wipe and continue"}</button></footer>`;if(this._success)return d`<p class="nwd-note"><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>`;let e=Pr();return d`<p class="nwd-note">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"><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?m:d`<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._phase?d`<p class="nwd-note">${this._phase}</p>`:m} ${this._error?d`<p class="wsl-error">${this._error}</p>`:m}<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="${!e||this._busy}" @click="${this._onEnable}">${this._busy?"Working\u2026":"Enable encryption"}</button></footer>`}render(){return d`<dialog @close="${this._onClose}" @cancel="${this._onDialogCancel}"><header><h3>${this._success?"Encryption enabled":this._orphan?"Previous passkey setup detected":"Enable passkey encryption"}</h3></header>${this._body()}</dialog>`}};customElements.define("passkey-setup-dialog",$y)});function O3(){try{return localStorage.getItem(WC)==="1"}catch{return!1}}function VC(){try{localStorage.setItem(WC,"1")}catch{}}async function Op(){if(de()||!Pr()||O3())return;if(!confirm(`Encrypt your DeepView data with a passkey?
96
115
 
97
116
  Your triage notes, workspaces, and report files are stored on this device. Encryption locks them under a passkey (TouchID, Windows Hello, security key) so scripts running here can't read them without the passkey.
98
117
 
99
- You can change this anytime from the lock icon in the sidebar header.`)){Ny();return}await Oa(),se()&&Ny()}var zy=rp;var np=class extends I{static styles=[...I.styles,B(Ce)];static properties={workspaceId:{type:String},items:{type:Array},_running:{state:!0},_errors:{state:!0},_done:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.items=[],this._running=!1,this._errors=[],this._done=!1,this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="download"]')?.focus()}_onClose=()=>this._finish({downloaded:[],failed:[]});_onCancel=()=>this._finish({downloaded:[],failed:[]});_onDownload=async()=>{if(this._running)return;this._running=!0,this._errors=[];let t=[],r=[];for(let n of this.items)try{if(n.kind==="bundle"){let l=await Em(this.workspaceId,n.identifier);if(!l.ok){let d=l.reason??"unknown";r.push({kind:"bundle",identifier:n.identifier,reason:d}),this._errors=[...this._errors,{label:at(n),reason:d}];continue}await un(n.identifier,this.workspaceId),t.push({kind:"bundle",identifier:n.identifier});continue}let o=await Cm(this.workspaceId,n.identifier);if(!o){r.push({kind:"report",identifier:n.identifier,reason:"not found in remote"}),this._errors=[...this._errors,{label:at(n),reason:"not found in remote"}];continue}let i;try{i=Ae(await Rt(o.content))}catch{let l="remote payload is not gzipped UTF-8";r.push({kind:"report",identifier:n.identifier,reason:l}),this._errors=[...this._errors,{label:at(n),reason:l}];continue}let s=Xe(i);if(!s.recognized){let l="remote payload is not a recognized report format";r.push({kind:"report",identifier:n.identifier,reason:l}),this._errors=[...this._errors,{label:at(n),reason:l}];continue}await qo(n.identifier,o.content),nt(n.identifier,s.count,s.source),await Qt(n.identifier,this.workspaceId),t.push({kind:"report",identifier:n.identifier})}catch(o){let i=o?.message??String(o);r.push({kind:n.kind,identifier:n.identifier,reason:i}),this._errors=[...this._errors,{label:at(n),reason:i}]}if(this._running=!1,this._done=!0,t.some(n=>n.kind==="report"))try{a.currentWorkspace===this.workspaceId&&await Ct(this.workspaceId)}catch{}r.length===0&&this._finish({downloaded:t,failed:r})};_errorsSection(){return this._errors.length===0?g:c`<ul class="lwd-list" role="alert">${this._errors.map(t=>c`<li><strong>${t.label}</strong> — ${t.reason}</li>`)}</ul>`}render(){let t=this.items.length,r=t===1,n=this.items.filter(u=>u.kind==="report").length,o=t-n,i="items";o===0?i=r?"report":"reports":n===0&&(i=r?"bundle":"bundles");let s=r?c`Download <strong>"${at(this.items[0])}"</strong> from the workspace's remote inventory?`:c`Download <strong>${t}</strong> remote ${i} into this workspace?`,l=r?g:c`<ul class="lwd-list">${this.items.map(u=>c`<li>${at(u)}${u.kind==="bundle"?c`<span class="lwd-kind-tag">bundle</span>`:g}</li>`)}</ul>`,d=this._running?r?"Downloading\u2026":`Downloading ${t} ${i}\u2026`:r?"Download":`Download ${t}`;return c`<dialog @close="${this._onClose}"><header><h3>Download from remote</h3></header><p class="lwd-body">${s}</p>${l} ${this._errorsSection()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._running}">${this._done&&this._errors.length>0?"Close":"Cancel"}</button> ${this._done&&this._errors.length>0?g:c`<button type="button" data-role="download" @click="${this._onDownload}" ?disabled="${this._running||t===0}">${d}</button>`}</footer></dialog>`}};customElements.define("sync-download-dialog",np);function pl({workspaceId:e,items:t}={}){return ee("sync-download-dialog",{workspaceId:e??"",items:Array.isArray(t)?[...t]:[]})}var Br="deepview.lastFile",Vi=new Set(["overview","graph","treemap","compare","advisories","issues","code","search","terminal"]);function Lr(e,t="overview"){let r=t&&t!=="overview"&&Vi.has(t)?` ${t}`:"";Pe(Br,`b:${e}${r}`).catch(()=>{})}var yn=0,ke=e=>e!==yn;function op(e){let t=Hy(e.toLowerCase());return t.endsWith(".map")?"sourcemap":t==="stasis.code.br"||t.endsWith(".stasis.code.br")?"stasis":null}function Hy(e){return e.replace(/ \(\d+\)(?=\.[^.]*$)/u,"")}async function Uy({name:e,content:t,existingNames:r}){if(!r.has(e))return await pt(e,t),r.add(e),{name:e,content:t};let n;try{n=await Ne(e)}catch(l){if(!(l instanceof DOMException&&l.name==="NotFoundError"||typeof l?.message=="string"&&l.message.startsWith("File not found:")))throw l;return await pt(e,t),r.add(e),{name:e,content:t}}if(n===t)return{name:e,content:t};let i=K().filter(l=>Array.isArray(l.reports)&&l.reports.includes(e)).filter(l=>Zn(l.id,e)),s=await Ry({name:e,workspaceNames:i.map(l=>l.name),existingNames:r});if(s.action==="cancel")return null;if(s.action==="rename"){let l=s.newName;return await pt(l,t),r.add(l),{name:l,content:t}}return await pt(e,t),i.length>0&&await HS(e,i),{name:e,content:t}}async function HS(e,t){let r;try{r=await tn(e)}catch(n){console.warn(`Import: failed to read freshly-saved "${e}" for cloud sync:`,n);return}for(let n of t)try{await xi(n.id);let o=await Ba(n.id,e,r);o&&o.ok===!1&&console.warn(`Import: failed to upload "${e}" to workspace "${n.name}" (${n.id}): ${o.reason??"unknown"}`)}catch(o){console.warn(`Import: failed to upload "${e}" to workspace "${n.name}" (${n.id}):`,o)}}async function ip(e){if(a.serverMode==="managed")return;await zy();let t=null,r=null,n=new Set,o=new Set(await le());for(let i of e)try{let s=Hy(i.name.toLowerCase());if(s.endsWith(".gz")||s.endsWith(".deepview-workspace.enc")){await Oy(i);try{let u=await le();o.clear();for(let p of u)o.add(p)}catch(u){console.warn("Import: failed to refresh existingNames after workspace import:",u)}continue}if(op(i.name)){let u=new Uint8Array(await i.arrayBuffer()),{integrity:p}=await rn(i.name,u);r=p,n.add(p);continue}let d=await i.text();if(s.endsWith(".csv")){let u=Iy(d);for(let{displayName:p,data:f}of u){let h=p.replaceAll("/","__")+".codex",m=JSON.stringify(f),{count:b,source:v}=Xe(m),y=await Uy({name:h,content:m,existingNames:o});y&&(nt(y.name,b,v),t={name:y.name,content:y.content})}}else{let u=Xe(d);if(!u.recognized)throw new Error("not a recognized DeepView, DeepSec, Piolium, Claude Security, or Codex report");let p=await Uy({name:i.name,content:d,existingNames:o});if(!p)continue;nt(p.name,u.count,u.source),t={name:p.name,content:p.content}}}catch(s){alert(`Failed to load ${i.name}: ${s.message}`)}await W();for(let i of n)lp(i).catch(()=>{});t?await Ze(t.name,t.content):r&&(a.currentView="bundles",a.selectedBundle=r,a.bundleDetails=null,a.bundleDetailsTab="overview",a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.bundleCodeSearchQuery="",a.bundleCodeSearchMode="files",a.bundleSearchQuery="",a.bundleSearchRegex=!1,a.bundleSearchCase=!1,a.bundleSearchContext=!0,a.shownTriage=null,A.showAll=!0,Lr(r),x(),await W(),or(r))}async function Ze(e,t){let r=++yn,n=new Set(K().filter(o=>Array.isArray(o.reports)&&o.reports.includes(e)).map(o=>o.id));for(let o of D.openSessions)o&&!n.has(o.workspaceId)&&(D.closeSession(o.workspaceId),Si(o.workspaceId));if(a.reports=[],a.workspaceMerges=[],a.currentFile=e,a.currentWorkspace=null,(a.currentView==="bundles"||a.currentView==="packages"||a.currentView==="repositories")&&(a.currentView="findings"),a.repoUrl=tt(e),a.repoEditing=!1,A.selected=null,A.focusedPkg=null,A.layoutCache=null,A.solo=null,A.hidden.clear(),A.pathFilter="",Be(),Pe(Br,e).catch(()=>{}),t===void 0){try{t=await Ne(e)}catch(o){if(ke(r))return;if(o&&o.message?.includes("vault locked")){if(await Na()&&!ke(r)){await Ze(e);return}ke(r)||(a.currentFile=null,await W());return}if(o instanceof DOMException&&o.name==="NotFoundError"||typeof o?.message=="string"&&o.message.startsWith("File not found:")){let s=K().find(l=>Array.isArray(l.reports)&&l.reports.includes(e)&&Zn(l.id,e));if(s)try{if(await xi(s.id),ke(r))return;let l=await pl({workspaceId:s.id,items:[{kind:"report",identifier:e}]});if(ke(r))return;if(l?.downloaded?.some(d=>d.kind==="report"&&d.identifier===e)){await Ze(e);return}}catch(l){if(console.warn(`Re-download prompt for missing "${e}" failed:`,l),ke(r))return}ke(r)||(a.currentFile=null,await W());return}alert(`Failed to read ${e}: ${o.message}`),a.currentFile=null,await W();return}if(ke(r))return}if(await ap(e,t,r),!ke(r)){for(let o of n)D.openSession(o),D.refreshSession(o),xi(o);await W()}}async function Ct(e){let t=K().find(o=>o.id===e);if(!t)return;let r=++yn;for(let o of D.openSessions)o&&o.workspaceId!==e&&(D.closeSession(o.workspaceId),Si(o.workspaceId));(a.currentView==="bundles"||a.currentView==="packages"||a.currentView==="repositories")&&(a.currentView="findings"),dn("workspace",e),a.reports=[],a.workspaceMerges=[],a.currentFile=null,a.currentWorkspace=e,a.repoUrl="",a.repoEditing=!1,A.selected=null,A.focusedPkg=null,A.layoutCache=null,A.solo=null,A.hidden.clear(),A.pathFilter="",Be(),Pe(Br,`ws:${e}`).catch(()=>{}),t.reports.length===0&&(S.classList.remove("active"),Y(g,S),we.classList.remove("hidden"));let n=t.reports.map(o=>Ne(o).catch(()=>null));for(let o=0;o<t.reports.length;o++){let i=await n[o];if(ke(r))return;if(i!==null&&(await ap(t.reports[o],i,r),ke(r)))return}D.openSession(e),D.refreshSession(e),xi(e),await W()}async function Vy({triage:e="keep",deleteFromRemoteWorkspaceIds:t=[]}={}){if(!a.currentFile)return;let r=++yn,n=a.currentFile;Xn(n),rt(n,"");for(let o of t)try{let i=await La(o,n);if(ke(r))return;i&&i.ok===!1&&i.reason!=="not-found"&&console.warn(`Failed to delete '${n}' from workspace ${o} remote: ${i.reason}`)}catch(i){console.warn(`Failed to delete '${n}' from workspace ${o} remote:`,i)}if(await Dn(n),!ke(r)&&(await gi(n,null),!ke(r))){if(e==="wipe"){try{await Aa()}catch(o){console.warn("Skipped orphan-triage GC:",o)}if(ke(r))return}ke(r)||(sp(),await W())}}function sp(){a.currentFile=null,a.currentWorkspace=null,a.selectedBundle=null,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.reports=[],a.workspaceMerges=[],a.repoUrl="",a.repoEditing=!1,a.shownTriage=null,a.currentView="findings",A.selected=null,A.focusedPkg=null,A.layoutCache=null,A.solo=null,A.hidden.clear(),A.pathFilter="",Be(),Pn(Br),S.classList.remove("active"),Y(g,S),we.classList.remove("hidden"),document.title="DeepView"}async function jy(){++yn;for(let e of D.openSessions)e&&(D.closeSession(e.workspaceId),Si(e.workspaceId));sp(),await W()}async function Wy({deleteFromRemoteWorkspaceIds:e=[]}={}){if(!a.selectedBundle)return;let t=++yn,r=a.selectedBundle;for(let o of e)try{let i=await Pa(o,r);if(ke(t))return;i&&i.ok===!1&&i.reason!=="not-found"&&console.warn(`Failed to delete bundle from workspace ${o} remote: ${i.reason}`)}catch(i){console.warn(`Failed to delete bundle from workspace ${o} remote:`,i)}if(await Mc(r),ke(t)||(await Td(r,null),ke(t)))return;a.selectedBundle=null,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null;let n=Re(Br);typeof n=="string"&&(n===`b:${r}`||n.startsWith(`b:${r} `))&&Pn(Br),sd(r),a.bundles=await xt(),!ke(t)&&(x(),await W())}async function Ky(e,t="detach",{triage:r="keep"}={}){let n=K().find(l=>l.id===e);if(!n)return;++yn;let o=Array.isArray(n.reports)?[...n.reports]:[];if(D.closeSession(e),Si(e),t==="delete"){for(let l of o){try{await Dn(l)}catch{}Xn(l),rt(l,"")}if(r==="wipe")try{await Aa()}catch(l){console.warn("Skipped orphan-triage GC:",l)}}let i=a.currentWorkspace===e,s=t==="delete"&&a.currentFile!=null&&o.includes(a.currentFile);(i||s)&&sp(),await Sd(e),await W()}async function ap(e,t,r=null){let n=()=>r!==null&&ke(r);dn("report",e);try{if(await yi,n())return;let o;try{o=JSON.parse(t)}catch(y){if(o=zn(t)??jn(t)??Wn(t),!o)throw new Error(`Not JSON, and not a recognized markdown format. (JSON error: ${y.message})`,{cause:y})}let i=a.reports.length===0,s=new Set,l=new Map,d=new Map;for(let y=0;y<a.reports.length;y++){let w=a.reports[y];for(let k=0;k<w.groups.length;k++){let _=w.groups[k],R=`${y}:${k}`;for(let C of _)C.id&&(s.add(C.id),l.set(C.id,R),d.has(C.id)||d.set(C.id,C))}}let u=(y,w,k)=>{!y||!k.correctedSeverity&&!y.correctedSeverity||(y._correctedByReport||(y._correctedByReport={[y._reportName??""]:{severity:rr(y),reason:y.correctedSeverityReason}}),y._correctedByReport[w??""]={severity:rr(k),reason:k.correctedSeverityReason})},p=o.findings||[],f=p.flatMap(Iu).filter(y=>!y.id);if(f.length>0){let y=await Promise.all(f.map(fa));if(n())return;f.forEach((w,k)=>{y[k]&&(w.id=y[k])})}let h=ga(o),m=h??tt(e),b=[],v=0;for(let y of p){let w=Iu(y);if(w.length===0)continue;let k=w.filter(F=>F.id&&s.has(F.id)),_=w.filter(F=>!F.id||!s.has(F.id)),R=new Set;for(let F of k){let H=l.get(F.id);H!==void 0&&R.add(H)}let C=w.filter(F=>F.id).map(F=>F.id);if(_.length===0){R.size>1&&a.workspaceMerges.push(new Set(C));for(let F of k)u(d.get(F.id),e,F);v+=k.length;continue}let M=[];for(let F of _){F.id&&s.add(F.id);let H={...F,_id:a.nextFindingId++,_repoFallback:m,_reportName:e,_bundleHashes:o.bundleHashes??[]};ha(H,o),H._analyzer=o.source??H.type??null,H.id&&!d.has(H.id)&&d.set(H.id,H),M.push(H)}if(k.length>0){v+=k.length,a.workspaceMerges.push(new Set(C));for(let F of k)u(d.get(F.id),e,F)}let z=`${a.reports.length}:${b.length}`;for(let F of _)F.id&&l.set(F.id,z);b.push(M)}if(v>0&&console.log(`${e}: skipped ${v} duplicate finding${v===1?"":"s"}`),a.reports.push({type:o.type||"analysis",source:o.source??null,fileName:e,groups:b,repo:h,tree:o.tree??null,bundleHashes:o.bundleHashes??[]}),Array.isArray(o.bundleHashes)&&o.bundleHashes.length>0){let y=new Set((a.bundles??[]).map(w=>w.integrity));for(let w of o.bundleHashes)y.has(w)&&lp(w).catch(()=>{})}i&&(ro(),a.filterConfMin=Ya(b),a.filterRevalidate=Xa(b,a.filterConfMin)),x()}catch(o){alert(`Failed to parse ${e}: ${o.message}`)}}window.__loadFile=(e,t)=>ap(e,t);window.__setFilters=({severities:e,confMin:t}={})=>{e!=null&&(a.filterSeverities=new Set(e)),t!==void 0&&(a.filterConfMin=t),x()};document.addEventListener("keydown",e=>{e.key==="Escape"&&document.body.classList.contains("report-fullscreen")&&document.body.classList.remove("report-fullscreen")});document.addEventListener("dragover",e=>e.preventDefault());document.addEventListener("drop",e=>{e.preventDefault(),!e.target.closest("#drop-zone")&&ip(e.dataTransfer.files)});we.addEventListener("dragover",e=>{e.preventDefault(),we.classList.add("hover")});we.addEventListener("dragleave",()=>we.classList.remove("hover"));we.addEventListener("drop",e=>{e.preventDefault(),we.classList.remove("hover"),ip(e.dataTransfer.files)});var Vt=null;function VS(){Vt||(Vt=document.createElement("input"),Vt.type="file",Vt.multiple=!0,Vt.hidden=!0,Vt.addEventListener("change",()=>{let e=Vt.files;e&&e.length>0&&ip(e),Vt.value=""}),document.body.append(Vt)),Vt.click()}we.addEventListener("click",e=>{e.target.closest(".drop-prompt-action")&&VS()});var ir=new Map,Gy="deepview.advisories.proxyConsent";function qy(){try{return localStorage.getItem(Gy)==="1"}catch{return!1}}function Yy(){try{localStorage.setItem(Gy,"1")}catch{}}function jS(e){return zi(e)}function WS(e){if(!e||e.kind!=="stasis"||!e.bundle)return!1;for(let[t,r]of e.bundle.modules)if(t.includes("node_modules")&&r?.name&&typeof r.version=="string"&&r.version)return!0;return!1}function Xy(e,t){return!e||op(e.name)!=="stasis"?!1:!t||t.integrity!==e.integrity?!0:WS(t)}function KS(e){let t=Object.create(null);for(let[r,n]of e)t[r]=[...n].toSorted();return t}async function cp(e,t){if(!e?.integrity||ir.has(e.integrity)||!qy())return;let r=jS(e);if(r.size===0){ir.set(e.integrity,{state:"ok",byPackage:new Map,query:r});return}ir.set(e.integrity,{state:"loading",query:r});let n=e.integrity;try{let o=await fetch("/api/npm-advisories",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(KS(r))});if(!o.ok){let l=`HTTP ${o.status}`;try{let d=await o.json();d&&typeof d.error=="string"&&d.error&&(l=`${d.error} (HTTP ${o.status})`)}catch{}ir.set(n,{state:"error",reason:l,query:r}),t();return}let i=await o.json(),s=new Map;if(i&&typeof i=="object")for(let[l,d]of Object.entries(i)){if(!Array.isArray(d))continue;let u=d.filter(p=>p&&typeof p=="object"&&typeof p.title=="string"&&typeof p.severity=="string");u.length>0&&s.set(l,u)}ir.set(n,{state:"ok",byPackage:s,query:r})}catch(o){ir.set(n,{state:"error",reason:o?.message??"fetch-failed",query:r})}t()}async function Jy(e,t){e?.integrity&&ir.get(e.integrity)?.state==="error"&&(ir.delete(e.integrity),await cp(e,t))}var GS={critical:0,high:1,moderate:2,low:3,info:4};function fl(e){return GS[e]??999}function qS(e){return e.charAt(0).toUpperCase()+e.slice(1)}function YS(){let e=typeof window>"u"?"":window.location.host;return c`<div class="bundle-advisories-consent"><div class="bundle-advisories-consent-card"><p class="bundle-advisories-consent-text">This bundle's dependency names and versions will be sent to the npm registry through a same-origin proxy (<span class="mono">${e}</span> → <span class="mono">registry.npmjs.org</span>) to look up published security advisories.</p><button type="button" class="bundle-advisories-consent-btn" data-advisories-consent>Confirm</button><p class="bundle-advisories-consent-note">This preference will be saved and reused for other bundles.</p></div></div>`}function Qy(e){if(!e)return c`<div class="bundle-advisories-empty">Bundle not loaded yet.</div>`;if(e.kind!=="stasis"||!e.bundle)return c`<div class="bundle-advisories-empty">Advisories are only available for stasis bundles.</div>`;if(!qy())return YS();let t=ir.get(e.integrity);if(!t||t.state==="loading")return c`<div class="bundle-advisories-empty">Loading advisories from npm registry…</div>`;if(t.state==="error")return c`<div class="bundle-advisories-empty is-error"><span>Failed to fetch advisories: ${t.reason}</span> <button type="button" class="bundle-advisories-retry" data-advisories-retry>Retry</button></div>`;let r=t.query.size,n=t.byPackage.size;if(n===0)return c`<div class="bundle-advisories"><div class="bundle-advisories-summary">No advisories for the ${r} ${r===1?"package":"packages"} in this bundle.</div></div>`;let o=[...t.byPackage.entries()].toSorted(([s,l],[d,u])=>{let p=Math.min(...l.map(h=>fl(h.severity))),f=Math.min(...u.map(h=>fl(h.severity)));return p!==f?p-f:s.localeCompare(d)}),i=[...t.byPackage.values()].reduce((s,l)=>s+l.length,0);return c`<div class="bundle-advisories"><div class="bundle-advisories-summary">${i} ${i===1?"advisory":"advisories"} across ${n} of ${r} ${r===1?"package":"packages"}</div><ul class="bundle-advisories-list">${o.map(([s,l])=>XS(s,l,t.query.get(s)))}</ul></div>`}function XS(e,t,r){let n=[...t].toSorted((i,s)=>{let l=fl(i.severity)-fl(s.severity);return l!==0?l:(i.title??"").localeCompare(s.title??"")}),o=r?[...r].toSorted():[];return c`<li class="bundle-advisories-section"><div class="bundle-advisories-section-header"><span class="bundle-advisories-section-name">${e}</span> ${o.length>0?c`<span class="bundle-advisories-section-versions">${o.map(i=>c`<span class="bundle-advisories-version-chip">${i}</span>`)}</span>`:g} <span class="bundle-advisories-section-count">${n.length} ${n.length===1?"advisory":"advisories"}</span></div><ul class="bundle-advisories-rows">${n.map(i=>e_(i))}</ul></li>`}function JS(e){if(typeof e!="string")return null;let t=/\/(GHSA-[a-z0-9-]+)(?:[/?#]|$)/iu.exec(e);return t?t[1]:null}var QS=c`<svg class="bundle-advisory-ghsa-icon" viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 13L13 3"/><path d="M5 3h8v8"/></svg>`;function ZS(e){let t=/^CWE-(\d+)$/u.exec(e);if(!t)return c`<span>${e}</span>`;let r=`https://cwe.mitre.org/data/definitions/${t[1]}.html`;return c`<a class="bundle-advisory-cwe" href="${r}" target="_blank" rel="noopener noreferrer">${e}</a>`}function e_(e){let t=e.severity,r=e.title,n=typeof e?.cvss?.score=="number"?e.cvss.score.toFixed(1):"",o=typeof e?.cvss?.vectorString=="string"&&e.cvss.vectorString?e.cvss.vectorString:"",i=typeof e.vulnerable_versions=="string"?e.vulnerable_versions:null,s=typeof e.url=="string"&&/^https?:\/\//iu.test(e.url)?e.url:null,l=JS(s),d=Array.isArray(e.cwe)?e.cwe.filter(p=>typeof p=="string"):[],u=l&&s?c`<a class="bundle-advisory-ghsa" href="${s}" target="_blank" rel="noopener noreferrer">${l}${QS}</a>`:l?c`<span class="bundle-advisory-ghsa">${l}</span>`:g;return c`<li class="bundle-advisory-row"><div class="bundle-advisory-rail"><span class="${`bundle-advisory-severity sev-${t}`}">${qS(t)}</span> ${n?c`<span class="bundle-advisory-cvss-score">CVSS <span class="mono">${n}</span></span>`:g}</div><div class="bundle-advisory-body"><div class="bundle-advisory-header"><span class="bundle-advisory-title">${r}</span> ${u}</div><div class="bundle-advisory-subrow"><div class="bundle-advisory-meta">${i?c`<span>Affected <span class="mono">${i}</span></span>`:g} ${d.length>0?c`<span class="bundle-advisory-cwes">${d.map((p,f)=>c`${f===0?"":", "}${ZS(p)}`)}</span>`:g}</div>${o?c`<div class="bundle-advisory-cvss-vector mono">${o}</div>`:g}</div></div></li>`}var Wi=null;function t_(e){let t=new Map;if(!e||e.kind!=="stasis"||!e.bundle)return t;for(let r of e.bundle.imports.values())for(let[n,o]of r){t.has(n)||t.set(n,new Set);for(let i of o.values())typeof i=="string"&&t.get(n).add(i)}return t}function r_(e){let t=Ke(e),r=t_(e),n=[...t.keys()],{stripped:o}=it(n),i=new Map(n.map((l,d)=>[l,o[d]])),s={};for(let[l,d]of t){let u=i.get(l),p=r.get(l);s[u]={imports:p?[...p].map(f=>i.get(f)).filter(Boolean):[],size:new TextEncoder().encode(d).byteLength}}return{tree:s,origToStripped:i}}async function fp(e){let t=Ke(e),r=new Map;for(let[n,o]of t)r.set(n,await kg(o));return r}function rv(e){let t={inprogress:0,fixed:0,invalid:0,deleted:0};if(!e?.fileHashes)return t;let r=new Set;for(let n of e.fileHashes.values())if(!r.has(n)){r.add(n);for(let o of oi(n)){let i=a.triage.get(O(o))?.triage;i&&t[i]!==void 0&&t[i]++}}return t}function ho(e,t="graph"){if(!e||e.size===0)return new Map;let r=new Map;for(let[n,o]of e){let i=oi(o);if(i.length===0)continue;let s=i.filter(d=>{let u=a.triage.get(O(d))?.triage??null;return t==="issues"?u!=="invalid"&&u!=="deleted":u===a.shownTriage});if(s.length===0)continue;r.has(n)||r.set(n,[]);let l=r.get(n);for(let d of s)l.push(d)}return r}function nv(e){let{tree:t,origToStripped:r}=r_(e),n=Object.keys(t);if(n.length===0)return null;let o=null;if(e.fileHashes&&e.fileHashes.size>0){o=new Map;for(let[C,M]of e.fileHashes){let z=r.get(C);z!==void 0&&o.set(z,M)}}let i=ho(o),s=new Map,l=new Map,d=new Map,u=new Map;for(let[C,M]of i){let z={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},F=new Set,H=new Set,he=[];for(let te of M){z[te.severity]=(z[te.severity]||0)+1,F.add(te.severity);let lt=a.triage.get(O(te))?.color??"none";H.add(lt),he.push({severity:te.severity,color:lt})}s.set(C,z),l.set(C,F),d.set(C,H),u.set(C,he)}let p=dl(t,s),f=new Map;for(let[C,M]of r)f.set(M,C);let h=Mr(e),m=h?new Map([...r].map(([C,M])=>[M,h.get(C)])):null,b=m?C=>m.get(C):null,v=xy(n,b),y=A.splitOwnDirs&&v,w=C=>bt(C,{splitOwnDirs:y,packageDir:b?.(C)}),k=new Set;for(let C of n)if(k.add(w(C)),k.size>=3)break;let _=k.size>=3,R=n;if(A.focusedPkg){let C=n.filter(M=>w(M)===A.focusedPkg);C.length>0?R=C:A.focusedPkg=null}return A.selected&&!Object.hasOwn(t,A.selected)&&(A.selected=null),{treeData:t,files:R,ownCounts:s,transitiveCounts:p,severitySets:l,colorSets:d,fileFindings:u,options:{pkgOf:w},strippedToOrig:f,canSplitOwnDirs:v,canPackagesView:_}}function gl(){if(!Wi)return;let e=uo();e&&e.refreshSidebar(Wi,{isBundleContext:!0})}function ml(){if(!Wi)return;let e=uo();e&&e.refreshTopPkgs(Wi)}function ov(e){Wi=e}function n_(e){let t=new Map,r=0;for(let{path:o,size:i,pkgDir:s}of e){if(typeof i!="number"||i<=0)continue;let l=bt(o,{packageDir:s});t.set(l,(t.get(l)??0)+i),r+=i}if(r===0)return g;let n=[...t.entries()].toSorted((o,i)=>i[1]-o[1]);return c`<div class="bundles-dist"><div class="bundles-dist-bar" aria-hidden="true">${X(n,([o])=>o,([o,i])=>c`<span class="bundles-dist-seg" style="${ae({flexGrow:i,background:Qe(o)})}" data-tooltip="${o==="__own__"?g:`${o}: ${ie(i)}`}"></span>`)}</div><ul class="bundles-dist-list">${X(n,([o])=>o,([o,i])=>{let s=(i/r*100).toFixed(1),l=o==="__own__"?"own source":o,d=Qe(o);return c`<li><span class="bundles-dist-dot" style="${ae({background:d})}"></span> <span class="bundles-dist-pkg" data-tooltip="${o==="__own__"?g:o}">${l}</span> <span class="bundles-dist-bar-row" aria-hidden="true"><span class="bundles-dist-bar-fill" style="${ae({width:`${s}%`,background:d})}"></span> </span><span class="bundles-dist-size">${ie(i)}</span> <span class="bundles-dist-percent">${s}%</span></li>`})}</ul></div>`}function Zy(e,t,r,n,o,i){let{prefix:s,stripped:l}=it(r),d=C=>o?.get(r[C]),u=new Set;for(let C=0;C<l.length;C++)u.add(bt(l[C],{packageDir:d(C)}));let p=l.map((C,M)=>M).toSorted((C,M)=>l[C].localeCompare(l[M])),f=l.map((C,M)=>({path:C,size:n[M],pkgDir:d(M)})),h=n_(f),m=h===g?c`<p class="bundles-overview-col-empty">No size information for this bundle's sources.</p>`:h,b={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},v=0,y=new Map;if(a.bundleDetails?.fileHashes){let C=ho(a.bundleDetails.fileHashes,"issues");for(let M of C.values())for(let z of M){b[z.severity]!==void 0&&b[z.severity]++,v++;for(let F of ii(z.fileHash,z))y.set(F,(y.get(F)??0)+1)}}let w=[...y.keys()].toSorted(),k=_e.filter(C=>b[C]>0).map(C=>c`<span class="${`tree-count-chip ${C}`}">${b[C]} ${C.replaceAll("_"," ")}</span>`),_=r.length>0?c`<ul class="bundles-sources-list">${p.map(C=>{let M=r[C],z=l[C],F=n[C];return c`<li><button type="button" class="bundles-source-row" data-bundle-view-source="${M}" data-tooltip="${M}"><span class="bundles-source-path">${z}</span> ${F==null?g:c`<span class="bundles-source-size">${ie(F)}</span>`}</button></li>`})}</ul>`:c`<p class="bundles-overview-col-empty">No source files in this bundle.</p>`,R=w.length>0?c`<ul class="bundles-reports-list">${w.map(C=>{let M=oe[ot(C)]??oe.default,z=y.get(C)??0;return c`<li><button type="button" class="report-chip bundles-report-chip" data-tooltip="${C}" data-bundle-issue-report="${C}">${me(M)}<span class="report-chip-label">${Ue(C)}</span> <span class="bundles-report-count">${z} ${z===1?"issue":"issues"}</span></button></li>`})}</ul>`:c`<p class="bundles-overview-col-empty">No matching reports indexed yet.</p>`;return c`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${e}<dl class="bundles-detail-meta">${t}<dt>Sources</dt><dd>${r.length}</dd>${s?c`<dt>Prefix</dt><dd class="mono">${s}</dd>`:g}</dl>${i??g}</div>${v>0?c`<div class="bundles-issue-summary tree-count-chips">${k}</div>`:g}</div><div class="bundles-overview-columns"><section class="bundles-overview-col"><header class="bundles-overview-col-head">Packages <span class="bundles-overview-col-count">${u.size}</span></header><div class="bundles-overview-col-body">${m}</div></section><section class="bundles-overview-col"><header class="bundles-overview-col-head">Files <span class="bundles-overview-col-count">${r.length}</span></header><div class="bundles-overview-col-body bundles-overview-col-body--list">${_}</div></section>${w.length>0?c`<section class="bundles-overview-col"><header class="bundles-overview-col-head">Reports <span class="bundles-overview-col-count">${w.length}</span></header><div class="bundles-overview-col-body bundles-overview-col-body--list">${R}</div></section>`:g}</div></div>`}var dp=new Map,up=new Set,o_=c`<svg viewBox="0 0 16 16" width="11" height="11" 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>`,sr=null;function Ki(){queueMicrotask(()=>{document.querySelector(".bundle-code-rail-body .bundle-code-tree-link.current")?.scrollIntoView({block:"nearest"})})}function vn(e){for(let t of _e)for(let r of e)if(r.severity===t)return t;return e[0]?.severity??null}function hp(e,t,r,n,o=null){let i=e.split(`
100
- `).length,s=String(i).length,l=rl(t),d=`${r??""}\0${t}`;l&&!dp.has(d)&&!up.has(d)&&(up.add(d),(async()=>{let p=await oo(e,l);dp.set(d,p??null),up.delete(d),a.bundleSourceFile===t&&x()})());let u=dp.get(d);return c`<div class="bundle-source-lines" style="${ae({"--lineno-width":`${s}ch`})}"><aside class="bundle-source-lineno-col" aria-hidden="true">${Array.from({length:i},(p,f)=>{let h=f+1,m=n.get(h),b=m?vn(m.map(y=>y.f)):null,v=m&&a.bundleSourceFindingIdx!=null&&m.some(y=>y.idx===a.bundleSourceFindingIdx);return c`<div class="${T({"bundle-source-lineno-row":!0,"is-match":o?.has(h)??!1})}" data-line="${h}">${m?c`<button type="button" class="${T({"bundle-source-dot":!0,[`sev-${b}`]:!0,active:v})}" data-bundle-source-finding="${m[0].idx}" title="${`${m.length} ${m.length===1?"issue":"issues"} on line ${h}`}" aria-label="${`${m.length} issues on line ${h}`}"></button>`:c`<span class="bundle-source-dot-placeholder"></span>`} <span class="bundle-source-lineno-num">${h}</span></div>`})}</aside><pre class="bundle-source-code"><code class="${l?`language-${l}`:""}">${typeof u=="string"?me(u):e}</code></pre></div>`}function gp(e){let t=a.bundleSourceFindingIdx;if(t==null)return g;let r=e[t];if(!r)return g;let n=r.fileHash?ii(r.fileHash,r):[],o=a.triage.get(O(r))?.triage,i=o==="fixed"?"Fixed":o==="inprogress"?"In progress":null,s=gn(r),l=av(r.line);return c`<aside class="bundle-source-panel"><header class="bundle-source-panel-bar"><span class="${`bundle-source-panel-sev sev-${r.severity}`}">${r.severity.replaceAll("_"," ")}</span> ${i?c`<span class="${`bundle-source-panel-triage triage-${o}`}">${i}</span>`:g} <button type="button" class="bundle-source-panel-close" data-action="bundle-source-panel-close" title="Close (Esc)" aria-label="Close finding details">×</button></header><div class="bundle-source-panel-body">${l||s?c`<div class="bundle-source-panel-line-row">${l?c`<span class="bundle-source-panel-line">${l}</span>`:g} ${s?c`<span class="bundle-source-panel-meta" title="${s}">${s}</span>`:g}</div>`:g}<div class="bundle-source-panel-desc">${yt(Ga(r),{paragraphs:!1})}</div>${n.length>0?c`<div class="bundle-source-panel-reports"><div class="bundle-source-panel-reports-label">Reported by</div>${n.map(d=>{let u=oe[ot(d)]??oe.default;return c`<button type="button" class="report-chip bundle-source-panel-report" title="${d}" data-bundle-issue-report="${d}">${me(u)}<span class="report-chip-label">${Ue(d)}</span></button>`})}</div>`:g}</div></aside>`}function mp(e,t,r){let n=[],o=new Map;if(typeof r=="string"&&e?.fileHashes){let s=ho(e.fileHashes,"issues").get(t)??[];for(let l=0;l<s.length;l++){let d=s[l];n.push(d);let u=parseInt(d.line,10);Number.isFinite(u)&&u>0&&(o.has(u)||o.set(u,[]),o.get(u).push({f:d,idx:l}))}}return{fileFindings:n,lineFindings:o}}function iv(){let e=a.bundleSourceFile;if(!e)return g;if(a.bundleDetailsTab==="code"||a.bundleDetailsTab==="search")return g;let r=Ke(a.bundleDetails).get(e),{fileFindings:n,lineFindings:o}=mp(a.bundleDetails,e,r);return c`<div class="bundle-source-overlay"><div class="${T({"bundle-source-modal":!0,"with-panel":a.bundleSourceFindingIdx!=null})}"><header class="bundle-source-bar"><div class="bundle-source-title" title="${e}">${e}</div><button type="button" class="bundle-source-close" data-action="bundle-source-close" title="Close source viewer (Esc)" aria-label="Close source viewer">×</button></header><div class="bundle-source-body"><div class="bundle-source-code-wrap">${typeof r=="string"?hp(r,e,a.bundleDetails?.integrity,o):c`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${gp(n)}</div></div></div>`}function sv(e){let t={name:"",files:new Map,dirs:new Map};for(let r of e){let n=r.split("/"),o=t;for(let i=0;i<n.length-1;i++){let s=n[i],l=o.dirs.get(s);l||(l={name:s,files:new Map,dirs:new Map},o.dirs.set(s,l)),o=l}o.files.set(n.at(-1),r)}return t}var hl=new Map,ev=null;function i_(e,t){let r=0,n=null;if(!t||t.size===0)return{count:r,worst:n};let o=i=>{for(let s of i.files.values()){let l=t.get(s);if(!l||l.length===0)continue;r+=l.length;let d=vn(l);(n===null||(Se[d]??0)>(Se[n]??0))&&(n=d)}for(let s of i.dirs.values())o(s)};return o(e),{count:r,worst:n}}function pp(e,t,r=0,n=null,o="",i=!1){let s=[...e.dirs.entries()].toSorted(([f],[h])=>f.localeCompare(h)),l=[...e.files.entries()].toSorted(([f],[h])=>f.localeCompare(h)),d=f=>{if(!t)return!1;for(let h of f.files.values())if(h===t)return!0;for(let h of f.dirs.values())if(d(h))return!0;return!1},u=(f,h)=>i?!0:hl.has(f)?hl.get(f):r===0||d(h),p=f=>h=>{hl.set(f,!h.currentTarget.parentElement.open)};return c`<ul class="${T({"bundle-code-tree":!0,root:r===0})}">${X(s,([f])=>`${o}/${f}`,([f,h])=>{let m=o?`${o}/${f}`:f,b=i_(h,n);return c`<li class="bundle-code-tree-dir"><details ?open="${u(m,h)}"><summary @click="${p(m)}"><span class="bundle-code-tree-dirname">${f}</span> ${b.count>0?c`<span class="${`bundle-code-tree-count sev-${b.worst}`}" title="${`${b.count} ${b.count===1?"issue":"issues"} inside`}">${b.count}</span>`:g}</summary>${pp(h,t,r+1,n,m,i)}</details></li>`})} ${X(l,([,f])=>f,([f,h])=>{let m=n?.get(h),b=m&&m.length>0?vn(m):null,v=m?.length??0;return c`<li class="bundle-code-tree-file"><button type="button" class="${T({"bundle-code-tree-link":!0,current:h===t})}" data-bundle-view-source="${h}" title="${h}"><span class="bundle-code-tree-name">${f}</span> ${v>0?c`<span class="${`bundle-code-tree-count sev-${b}`}" title="${`${v} ${v===1?"issue":"issues"}`}">${v}</span>`:g}</button></li>`})}</ul>`}function s_(e,t,r,n,o=""){if(!r)return pp(e,t,0,n);let i=r.toLowerCase(),s=[],l=h=>{for(let[,m]of h.dirs)l(m);for(let[,m]of h.files)(o&&m.startsWith(o)?m.slice(o.length):m).toLowerCase().includes(i)&&s.push(m)};if(l(e),s.length===0)return c`<div class="bundle-code-search-empty">No files match.</div>`;let d=o?s.map(h=>h.startsWith(o)?h.slice(o.length):h):s,u=new Map;for(let h=0;h<s.length;h++)u.set(d[h],s[h]);let p=sv(d),f=h=>{let m=new Map;for(let[b,v]of h.files)m.set(b,u.get(v)??v);h.files=m;for(let b of h.dirs.values())f(b)};return f(p),pp(p,t,0,n,"",!0)}function a_(e,t,r,n=""){if(!t)return c`<div class="bundle-code-search-hint">Type to search across every source in this bundle.</div>`;let o=t.toLowerCase(),i=20,s=100,l=[],d=0;for(let[u,p]of e){if(typeof p!="string")continue;let f=[],h=p.split(`
101
- `);for(let m=0;m<h.length;m++){let b=h[m];if(b.toLowerCase().includes(o)&&(f.push({ln:m+1,text:b}),d++,f.length>=i))break}if(f.length>0&&l.push({path:u,hits:f}),l.length>=s)break}return l.length===0?c`<div class="bundle-code-search-empty">No matches.</div>`:c`<div class="bundle-code-search-results"><div class="bundle-code-search-summary">${d} ${d===1?"hit":"hits"} in ${l.length} ${l.length===1?"file":"files"}</div>${l.map(({path:u,hits:p})=>{let f=n&&u.startsWith(n)?u.slice(n.length):u;return c`<div class="${T({"bundle-code-search-file":!0,current:u===r})}"><button type="button" class="bundle-code-search-file-name" data-bundle-view-source="${u}" title="${u}">${f}</button><ul class="bundle-code-search-hits">${p.map(h=>c`<li class="bundle-code-search-hit"><button type="button" class="bundle-code-search-hit-link" data-bundle-view-source="${u}" data-bundle-view-line="${h.ln}" data-bundle-view-scroll-block="start" title="${`${u}:${h.ln}`}"><span class="bundle-code-search-hit-ln">${h.ln}</span> <span class="bundle-code-search-hit-text mono">${h.text.slice(0,200)}</span></button></li>`)}</ul></div>`})}</div>`}function l_(e,t,r,n=""){if(!e.fileHashes)return c`<div class="bundle-code-search-empty">Computing file hashes…</div>`;let o=ho(e.fileHashes,"issues");if(o.size===0)return c`<div class="bundle-code-search-empty">No issues match this bundle's files.</div>`;let i=t.toLowerCase(),s=[];for(let[l,d]of o)for(let u=0;u<d.length;u++){let p=d[u],f=p.description??"";i&&!l.toLowerCase().includes(i)&&!p.severity.includes(i)&&!p.severity.replaceAll("_"," ").includes(i)&&!f.toLowerCase().includes(i)||s.push({file:l,finding:p,fileIdx:u})}return s.sort((l,d)=>{let u=Se[l.finding.severity]??0,p=Se[d.finding.severity]??0;return p!==u?p-u:l.file.localeCompare(d.file)}),s.length===0?c`<div class="bundle-code-search-empty">No matches.</div>`:c`<div class="bundle-code-search-results"><div class="bundle-code-search-summary">${s.length} ${s.length===1?"issue":"issues"}</div><ul class="bundle-code-search-issues">${s.map(({file:l,finding:d,fileIdx:u})=>{let p=d.severity,f=n&&l.startsWith(n)?l.slice(n.length):l,h=l===r&&a.bundleSourceFindingIdx===u;return c`<li class="${T({"bundle-code-search-issue":!0,current:h})}"><button type="button" class="bundle-code-search-issue-link" data-bundle-view-source="${l}" data-bundle-view-finding-idx="${u}" data-bundle-view-line="${d.line??""}" title="${l}"><div class="bundle-code-search-issue-row"><span class="${`bundle-code-search-issue-sev sev-${p}`}">${p.replaceAll("_"," ")}</span> <span class="bundle-code-search-issue-path mono">${f}${d.line?`:${d.line}`:""}</span></div><div class="bundle-code-search-issue-desc">${yt(Ga(d),{paragraphs:!1})}</div></button></li>`})}</ul></div>`}function tv(e,t,r){let n=null,o=-1,i=0;for(let[d,u]of r){if(typeof t.get(d)!="string")continue;let p=Se[vn(u)]??0;(p>o||p===o&&u.length>i||p===o&&u.length===i&&(n===null||d.localeCompare(n)<0))&&(n=d,o=p,i=u.length)}if(n)return n;if(e.kind==="stasis"&&e.bundle){for(let d of e.bundle.entries)if(typeof t.get(d)=="string")return d}let s=null,l=-1;for(let[d,u]of t)typeof u=="string"&&u.length>l&&(s=d,l=u.length);return s}function c_(e){if(!e||!e.json&&!e.bundle)return g;let t=Ke(e);if(t.size===0)return c`<div class="bundle-code-empty">This bundle doesn't carry any source content.</div>`;ev!==a.selectedBundle&&(hl.clear(),ev=a.selectedBundle);let r=[...t.keys()].toSorted(),{prefix:n,stripped:o}=it(r),i=new Map;for(let w=0;w<r.length;w++)i.set(o[w],r[w]);let s=sv(o),l=w=>{let k=new Map;for(let[_,R]of w.files)k.set(_,i.get(R)??R);w.files=k;for(let _ of w.dirs.values())l(_)};l(s);let d=e.fileHashes?ho(e.fileHashes,"issues"):new Map,u=a.bundleSourceFile;if(sr&&(sr.bundle!==a.selectedBundle||u&&u!==sr.path)&&(sr=null),!u)u=tv(e,t,d),u&&(a.bundleSourceFile=u,sr={bundle:a.selectedBundle,path:u,hadIssues:d.size>0},Ki());else if(sr&&!sr.hadIssues&&d.size>0){sr.hadIssues=!0;let w=tv(e,t,d);w&&w!==u&&(u=w,a.bundleSourceFile=w,a.bundleSourceFindingIdx=null,sr.path=w,Ki())}let p=u?t.get(u):null,{fileFindings:f,lineFindings:h}=mp(e,u,p),b=d.size>0?["files","code","issues"]:["files","code"],v=b.includes(a.bundleCodeSearchMode)?a.bundleCodeSearchMode:"files",y=a.bundleCodeSearchQuery;return c`<div class="bundle-code-view"><aside class="bundle-code-rail"><div class="bundle-code-rail-head"><span class="bundle-code-rail-label">Files</span> <span class="bundle-code-rail-count">${r.length}</span></div>${n?c`<div class="bundle-code-rail-prefix mono" title="${n}">${n}</div>`:g}<bundle-code-search .modes="${b}"></bundle-code-search><div class="bundle-code-rail-body">${Wu(v,[["files",()=>s_(s,u,y,d,n)],["code",()=>a_(t,y,u,n)],["issues",()=>l_(e,y,u,n)]])}</div></aside><div class="${T({"bundle-code-main":!0,"with-panel":a.bundleSourceFindingIdx!=null})}">${u?d_(e,u,p,f,h):c`<div class="bundle-code-placeholder">Pick a file from the tree to view its source.</div>`}</div></div>`}function d_(e,t,r,n,o){let i=typeof r=="string"?r.split(`
102
- `).length:0,s=typeof r=="string"?new TextEncoder().encode(r).byteLength:0,l=n.map((d,u)=>({idx:u,line:parseInt(d.line,10)||0})).toSorted((d,u)=>d.line-u.line||d.idx-u.idx);return c`<header class="bundle-code-main-bar"><span class="bundle-code-main-path mono" title="${t}">${t}</span> <button type="button" class="bundle-code-copy-path" data-copy-path="${t}" title="Copy file path" aria-label="Copy file path">${o_}</button> <span class="bundle-code-main-spacer"></span> ${typeof r=="string"?c`<span class="bundle-code-main-stats">${i.toLocaleString()} ${i===1?"line":"lines"} · ${ie(s)}</span>`:g} ${n.length>0?c`<span class="bundle-code-main-issues" data-bundle-code-issue-order="${JSON.stringify(l)}"><span class="${`bundle-code-tree-count sev-${vn(n)}`}" title="${`${n.length} ${n.length===1?"issue":"issues"} in this file`}">${n.length}</span> <button type="button" class="bundle-code-issue-step" data-bundle-code-issue-step="-1" title="Previous issue" aria-label="Previous issue">‹</button> <button type="button" class="bundle-code-issue-step" data-bundle-code-issue-step="1" title="Next issue" aria-label="Next issue">›</button></span>`:g}</header><div class="bundle-code-main-body"><div class="bundle-source-code-wrap">${typeof r=="string"?hp(r,t,e.integrity,o):c`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${gp(n)}</div>`}var u_=400;function p_(e){return e<=5?8:e<=15?6:e<=40?4:e<=120?3:2}function f_(e,t,r){let n=[];for(let o of e){let i=Math.max(1,o.ln-r),s=Math.min(t,o.ln+r),l=n.at(-1);l&&i<=l.end+1?l.end=Math.max(l.end,s):n.push({start:i,end:s})}return n}function h_(e,t,r){if(e.length<=r)return{text:e,ranges:t,clipped:!1};let n=t.length>0?t[0][0]:0,o=n>r-60?Math.max(0,n-60):0,i=e.slice(o,o+r);if(o===0)return{text:i,ranges:t,clipped:!1};let s=[];for(let[l,d]of t){let u=l-o,p=d-o;p<=0||u>=i.length||s.push([Math.max(0,u),Math.min(i.length,p)])}return{text:i,ranges:s,clipped:!0}}function g_(e,t){if(t.length===0)return e;let r=[],n=0;for(let[o,i]of t){let s=Math.max(n,Math.min(o,e.length)),l=Math.max(s,Math.min(i,e.length));l<=s||(s>n&&r.push(e.slice(n,s)),r.push(c`<mark class="bundle-search-mark">${e.slice(s,l)}</mark>`),n=l)}return n<e.length&&r.push(e.slice(n)),r}function m_(e,t,r){let n=h_(e,r??[],u_);return c`<div class="${T({"bundle-search-line":!0,"is-match":r!=null})}"><span class="bundle-search-lineno">${t}</span> <span class="bundle-search-code">${n.clipped?c`<span class="bundle-search-clip">…</span>`:g}${g_(n.text,n.ranges)}</span></div>`}function b_(e,t,r,n,o){let{start:i,end:s}=r,l=i;for(let p=i;p<=s;p++)if(n.has(p)){l=p;break}let d=String(s).length,u=[];for(let p=i;p<=s;p++)u.push(m_(t[p-1]??"",p,n.get(p)??null));return c`${o?c`<div class="bundle-search-gap" aria-hidden="true"></div>`:g} <button type="button" class="bundle-search-snippet" style="${ae({"--bundle-search-lineno-w":`${d}ch`})}" data-bundle-view-source="${e}" data-bundle-view-line="${l}" data-bundle-view-scroll-block="center" title="${`${e}:${l}`}">${u}</button>`}function y_(e,t,r){let{path:n,lines:o,hits:i}=e,s=t&&n.startsWith(t)?n.slice(t.length):n,l=f_(i,o.length,r),d=new Map(i.map(f=>[f.ln,f.ranges])),u=i[0].ln,p=n===a.bundleSourceFile;return c`<section class="${T({"bundle-search-file":!0,current:p})}"><header class="bundle-search-file-head"><button type="button" class="bundle-search-file-name mono" data-bundle-view-source="${n}" data-bundle-view-line="${u}" data-bundle-view-scroll-block="center" title="${n}">${s}</button> <span class="bundle-search-file-count">${i.length} ${i.length===1?"match":"matches"}</span></header><div class="bundle-search-snippets">${l.map((f,h)=>b_(n,o,f,d,h>0))}</div></section>`}function v_(e,t,r,n,o,i){if(!r)return c`<div class="bundle-search-results"><div class="bundle-search-hint">Search across every source in this bundle. Each match shows the surrounding lines for context — fewer matches get more context. Toggle <span class="bundle-search-hint-kbd">Aa</span> for case-sensitive and <span class="bundle-search-hint-kbd">.*</span> for regular-expression matching.</div></div>`;let s=$y(e.integrity??"",t,r,n,o);if(s.error)return c`<div class="bundle-search-results"><div class="bundle-search-error"><span class="bundle-search-error-label">Invalid regular expression</span> <span class="bundle-search-error-msg mono">${s.error}</span></div></div>`;let{fileResults:l,totalHits:d,truncated:u}=s,p=[...t.keys()].toSorted(),{prefix:f}=it(p);if(l.length===0)return c`<div class="bundle-search-results"><div class="bundle-search-empty">No matches.</div></div>`;let h=i?p_(d):0,m=l.length;return c`<div class="bundle-search-results"><div class="bundle-search-summary"><span>${d}${u?"+":""} ${d===1?"match":"matches"} in ${m}${u?"+":""} ${m===1?"file":"files"}</span> ${f?c`<span class="bundle-search-summary-prefix mono" title="${f}">${f}</span>`:g} ${u?c`<span class="bundle-search-summary-more">results capped — refine to narrow</span>`:g}</div>${X(l,b=>b.path,b=>y_(b,f,h))}</div>`}function w_(e,t,r,n){if(!t||typeof e!="string")return null;let o=Gu(t,r,n);if(o.error)return null;let i=new Set,s=e.split(`
103
- `);for(let l=0;l<s.length;l++)o.ranges(s[l]).length>0&&i.add(l+1);return i}function k_(e,t,r){let n=a.bundleSourceFile;if(!n)return g;let o=t.get(n),{fileFindings:i,lineFindings:s}=mp(e,n,o);return c`<aside class="bundle-search-side"><header class="bundle-source-bar"><div class="bundle-source-title" title="${n}">${n}</div><button type="button" class="bundle-source-close" data-action="bundle-source-close" title="Close source viewer (Esc)" aria-label="Close source viewer">×</button></header><div class="bundle-source-body"><div class="bundle-source-code-wrap">${typeof o=="string"?hp(o,n,e.integrity,s,r):c`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${gp(i)}</div></aside>`}function $_(e){if(!e||!e.json&&!e.bundle)return g;let t=Ke(e);if(t.size===0)return c`<div class="bundle-search-view"><div class="bundle-code-empty">This bundle doesn't carry any source content.</div></div>`;let r=a.bundleSearchQuery,n=a.bundleSearchRegex,o=a.bundleSearchCase,i=null;if(a.bundleSourceFile){let l=w_(t.get(a.bundleSourceFile),r,n,o);l&&l.size===0?(a.bundleSourceFile=null,a.bundleSourceFindingIdx=null):i=l}let s=a.bundleSearchContext;return c`<div class="bundle-search-view"><div class="bundle-search-bar-row"><bundle-search></bundle-search><button type="button" class="${T({"bundle-search-context-toggle":!0,on:s})}" data-bundle-search-context aria-pressed="${String(s)}" aria-label="Toggle context lines"><span>Context</span><span class="bundle-search-switch" aria-hidden="true"></span></button></div><div class="bundle-search-main">${v_(e,t,r,n,o,s)} ${k_(e,t,i)}</div></div>`}function x_(e){let t=Xy(e,a.bundleDetails);a.bundleDetailsTab==="advisories"&&!t&&(a.bundleDetailsTab="overview");let r=(a.bundles?.length??0)>=2;a.bundleDetailsTab==="compare"&&!r&&(a.bundleDetailsTab="overview");let n=a.bundleDetailsTab,o=n==="overview",i=a.bundleDetails,s=!!(i&&i.integrity===e.integrity),l=s&&!i.error&&!!(i.json||i.bundle);return n==="advisories"&&t&&l&&cp(i,x).catch(()=>{}),c`<div class="bundles-view bundles-slide-view"><header class="bundles-slide-bar"><span class="bundles-slide-icon" aria-hidden="true">${me(co)}</span><div class="bundles-slide-title"><div class="bundles-slide-name">${e.name}</div></div><div class="bundles-slide-tabs" role="tablist">${t?c`<button type="button" class="${T({"bundles-tab":!0,active:n==="advisories"})}" data-bundle-tab="advisories" aria-selected="${String(n==="advisories")}" role="tab">Advisories</button>`:g} <button type="button" class="${T({"bundles-tab":!0,active:n==="issues"})}" data-bundle-tab="issues" aria-selected="${String(n==="issues")}" role="tab">Issues</button> <button type="button" class="${T({"bundles-tab":!0,active:n==="terminal"})}" data-bundle-tab="terminal" aria-selected="${String(n==="terminal")}" role="tab">Terminal</button> <button type="button" class="${T({"bundles-tab":!0,active:n==="treemap"})}" data-bundle-tab="treemap" aria-selected="${String(n==="treemap")}" role="tab">Treemap</button> <button type="button" class="${T({"bundles-tab":!0,active:n==="graph"})}" data-bundle-tab="graph" aria-selected="${String(n==="graph")}" role="tab">Graph</button> <button type="button" class="${T({"bundles-tab":!0,active:n==="code"})}" data-bundle-tab="code" aria-selected="${String(n==="code")}" role="tab">Code</button> <button type="button" class="${T({"bundles-tab":!0,active:n==="search"})}" data-bundle-tab="search" aria-selected="${String(n==="search")}" role="tab">Search</button> ${r?c`<button type="button" class="${T({"bundles-tab":!0,active:n==="compare"})}" data-bundle-tab="compare" aria-selected="${String(n==="compare")}" role="tab">Compare</button>`:g} <button type="button" class="${T({"bundles-tab":!0,active:o})}" data-bundle-tab="overview" aria-selected="${String(o)}" role="tab">Overview</button></div></header><div class="${T({"bundles-slide-body":!0,"bundles-slide-body-overview":o})}">${o?T_(e,i):l?Wu(n,[["terminal",()=>c`<div id="bundle-terminal-slot" class="bundle-terminal-slot"></div>`],["graph",()=>c`<div id="bundle-graph-slot" class="bundle-graph-slot"></div>`],["treemap",()=>c`<bundle-treemap .details="${i}"></bundle-treemap>`],["code",()=>c_(i)],["search",()=>$_(i)],["compare",()=>c`<bundle-compare .details="${i}" .integrity="${e.integrity}"></bundle-compare>`],["issues",()=>__(i)],["advisories",()=>Qy(i)]]):s?c`<div class="${T({"bundles-slide-placeholder":!0,"is-error":!!i.error})}">${i.error?`Failed to parse: ${i.error}`:"Bundle contents not parsed."}</div>`:c`<div class="bundles-slide-placeholder">Loading bundle…</div>`}</div></div>`}function S_(e,t={}){if(!e)return g;let r=[];if(e.fileHash&&(r=ii(e.fileHash,e)),r.length===0&&t.bucketKey&&(t.kind==="package"?r=ed(t.bucketKey,e):t.kind==="repository"&&(r=td(t.bucketKey,e))),r.length===0)return g;let n=r.slice(0,2),o=r.length-n.length;return c`<div class="bundle-issue-reports">${n.map(i=>{let s=oe[ot(i)]??oe.default;return c`<button type="button" class="report-chip" title="${i}" data-bundle-issue-report="${i}">${me(s)}<span class="report-chip-label">${Ue(i)}</span></button>`})} ${o>0?c`<span class="bundle-issue-reports-more">, and ${o} more…</span>`:g}</div>`}function av(e){if(e==null||e==="")return"";let t=String(e),r=t.indexOf("-");if(r>0){let o=parseInt(t.slice(0,r),10),i=parseInt(t.slice(r+1),10);return Number.isFinite(o)&&Number.isFinite(i)&&i>o?`Lines ${o}-${i}`:Number.isFinite(o)?`Line ${o}`:""}let n=parseInt(t,10);return Number.isFinite(n)?`Line ${n}`:""}function ji(e,t){return c`<div class="bundle-issues-empty"><p class="bundle-issues-empty-primary">${e}</p>${t?c`<p class="bundle-issues-empty-hint">${t}</p>`:g}</div>`}function __(e){if(!e||!e.json&&!e.bundle)return g;if(!e.fileHashes)return ji("Computing file hashes\u2026","Hashing this bundle's sources so findings from your reports can be matched against them.");if(e.fileHashes.size===0)return ji("This bundle doesn't carry any source content.","Issues are matched by source-file hash, so a bundle without inline sources has nothing to match findings against.");let t=ho(e.fileHashes,"issues");if(t.size===0){let r=Zc();if(r===0)return ji("No issues match this bundle's files.","Issues are analyzer findings matched to this bundle by source-file hash. No hash-carrying findings are indexed yet \u2014 hash matching needs the analyzer's native JSON reports; drop one and any matches will appear here automatically.");let n=0;for(let o of e.fileHashes.values())n+=oi(o).length;return n>0?ji("All matching issues are dismissed.",`${n} ${n===1?"finding matches":"findings match"} this bundle's files, but every one is triaged invalid or deleted.`):ji("No issues match this bundle's files.",`None of the ${r.toLocaleString()} indexed ${r===1?"finding":"findings"} reference a source file in this bundle \u2014 matching compares exact file hashes, so findings from a different build of the same project won't line up.`)}return Gi(t,{kind:"bundle"})}function Gi(e,{kind:t,bucketKey:r}={}){let n=[...e.keys()],{prefix:o,stripped:i}=it(n),s=new Map(n.map((u,p)=>[u,i[p]])),l=[...e.entries()].toSorted(([u,p],[f,h])=>{let m=Se[vn(p)]??0,b=Se[vn(h)]??0;return b!==m?b-m:(s.get(u)??u).localeCompare(s.get(f)??f)}),d=[...e.values()].reduce((u,p)=>u+p.length,0);return c`<div class="bundle-issues"><div class="bundle-issues-summary">${d} ${d===1?"issue":"issues"} across ${e.size} ${e.size===1?"file":"files"} ${o?c`<span class="mono">${o}</span>`:g}</div><ul class="bundle-issues-list">${X(l,([u])=>u,([u,p])=>{let f=s.get(u)??u,h=[...p].toSorted((b,v)=>{let y=Se[b.severity]??0,w=Se[v.severity]??0;if(w!==y)return w-y;let k=parseInt(b.line,10)||0,_=parseInt(v.line,10)||0;return k-_}),m=t==="repository"&&r?`${/^https?:/iu.test(r)?r.replace(/\/$/u,""):`https://github.com/${r}`}/blob/HEAD/${u}`:null;return c`<li class="bundle-issues-file-group"><header class="bundle-issues-file-header">${t==="bundle"?c`<button type="button" class="bundle-issues-file-name mono" data-bundle-view-source="${u}" title="${u}">${f}</button>`:m?c`<a class="bundle-issues-file-name bundle-issues-file-name-link mono" href="${m}" target="_blank" rel="noopener" title="${u}">${f}</a>`:c`<span class="bundle-issues-file-name bundle-issues-file-name-static mono" title="${u}">${f}</span>`} <span class="bundle-issues-file-count">${p.length} ${p.length===1?"issue":"issues"}</span></header><ul class="bundle-issues-findings">${X(h,b=>b.id??`${u}\0${b.line??""}\0${b.severity??""}\0${b.description??""}`,b=>{let v=p.indexOf(b),y=b.severity,w=a.triage.get(O(b))?.triage,k=w==="fixed"||w==="invalid"||w==="deleted"?w.toUpperCase():w==="inprogress"?"In progress":null,_=c`<div class="bundle-issues-finding-head"><span class="${`bundle-issue-sev sev-${y}`}">${y.replaceAll("_"," ")}</span> ${(()=>{let R=av(b.line);return R?c`<span class="bundle-issues-finding-line">${R}</span>`:g})()} ${k?c`<span class="${`bundle-issues-finding-triage triage-${w}`}">${k}</span>`:g} <span class="bundle-issues-finding-spacer"></span> ${S_(b,{kind:t,bucketKey:r})}</div><div class="bundle-issues-finding-desc">${yt(Ga(b),{paragraphs:!1})}</div>`;return c`<li class="bundle-issues-finding">${t==="bundle"?c`<button type="button" class="bundle-issues-finding-link" data-bundle-view-source="${u}" data-bundle-view-finding-idx="${v}" data-bundle-view-line="${b.line??""}" title="${u}">${_}</button>`:c`<div class="bundle-issues-finding-link bundle-issues-finding-static" title="${u}">${_}</div>`}</li>`})}</ul></li>`})}</ul></div>`}function lv(e){let t=a.selectedBundle,r=t?e.find(n=>n.integrity===t):null;return r?x_(r):c`<div class="bundles-view bundles-view-empty"><p class="bundles-empty-hint">${e.length===0?c`No bundles yet. Drop a <code>.map</code> sourcemap or a <code>.stasis.code.br</code> bundle to start.`:"Pick a bundle from the sidebar to open it."}</p></div>`}var C_=c`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2v8"/><path d="m4.5 7 3.5 3.5L11.5 7"/><path d="M2.5 13h11"/></svg>`,E_=c`<svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor" aria-hidden="true"><path d="M0 0v24H8.222l2.089-2.373 2.09-2.374V13.2H18.978l2.51-2.488L24 8.223V0H12zm5.2 5.2h13.791L12.2 12c-3.735 3.74-6.838 6.8-6.896 6.8-.057 0-.104-3.06-.104-6.8zm8.4 8.8v10H24V14h-5.2z"/></svg>`;function A_(e,t){let r=by(t);return c`<div class="bundles-overview-exports"><div class="bundles-overview-exports-row"><button type="button" class="bundles-download-btn" data-bundle-download="${e.integrity}">${C_}<span>Download bundle</span></button> ${r?c`<div class="bundles-export-pair"><button type="button" class="bundles-download-btn" data-bundle-export-sbom="cyclonedx" title="Export a CycloneDX SBOM (.cdx.json)">CycloneDX</button> <button type="button" class="bundles-download-btn" data-bundle-export-sbom="spdx" title="Export an SPDX SBOM (.spdx.json)">${E_}<span>SPDX</span></button></div>`:g}</div></div>`}function T_(e,t){let r=c`<dl class="bundles-detail-meta"><dt>Name</dt><dd>${e.name}</dd><dt>Integrity</dt><dd class="mono">${e.integrity}</dd>${t&&t.integrity===e.integrity?c`<dt>Size</dt><dd>${ie(t.size)}</dd>`:g}</dl>`,n=A_(e,t);if(!t||t.integrity!==e.integrity)return c`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${r}${n}</div></div></div>`;if(t.error)return c`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${r}${n}</div></div><div class="bundles-overview-placeholder is-error">Failed to parse: ${t.error}</div></div>`;if(t.kind==="sourcemap"&&t.json){let o=t.json,i=o.sources??[],s=o.sourcesContent??[],l=i.map((u,p)=>typeof s[p]=="string"?new TextEncoder().encode(s[p]).byteLength:null),d=c`<dt>Version</dt><dd>${String(o.version??"?")}</dd>${o.file?c`<dt>Output</dt><dd class="mono">${o.file}</dd>`:g} ${o.sourceRoot?c`<dt>Source root</dt><dd class="mono">${o.sourceRoot}</dd>`:g} ${o.names?c`<dt>Names</dt><dd>${o.names.length}</dd>`:g}`;return Zy(r,d,i,l,null,n)}if(t.kind==="stasis"&&t.bundle){let o=t.bundle,i=o.sources,s=[...i.keys()],l=new Set;for(let f of o.imports.keys()){let h=f.replace(/\s*\(with: .*\)\s*$/u,"");for(let m of h.split(", "))l.add(m)}let d=[...l].toSorted(),u=s.map(f=>{let h=i.get(f);return typeof h=="string"?new TextEncoder().encode(h).byteLength:null}),p=c`<dt>Version</dt><dd>${String(o.version)}</dd>${d.length>0?c`<dt>Resolution kinds</dt><dd>${d.join(", ")}</dd>`:g}`;return Zy(r,p,s,u,Mr(t),n)}return c`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${r}${n}</div></div><div class="bundles-overview-placeholder">Bundle contents not parsed.</div></div>`}async function go(e,t){try{let r=await Xt(e),n=t.name.toLowerCase().endsWith(".map"),o=n?"sourcemap":"stasis";try{if(n){let l=JSON.parse(Ae(r));return{integrity:e,kind:o,size:r.byteLength,json:l}}let i=Ae(await hy(r)),s=ol.parse(i);return{integrity:e,kind:o,size:r.byteLength,bundle:s}}catch(i){return{integrity:e,kind:o,size:r.byteLength,error:i.message}}}catch(r){return{integrity:e,error:r.message,size:0}}}function R_(e){!e?.json&&!e?.bundle||(async()=>{try{let t=await fp(e);if(ya(e.integrity,t),a.selectedBundle!==e.integrity)return;e.fileHashes=t,x()}catch{}})()}async function lp(e){if(ad(e))return;let t=(a.bundles??[]).find(n=>n.integrity===e);if(!t)return;let r=await go(e,t);if(!(!r?.json&&!r?.bundle))try{let n=await fp(r);ya(e,n)}catch{}}async function or(e){let t=(a.bundles??[]).find(n=>n.integrity===e);if(!t)return;let r=await go(e,t);a.selectedBundle===e&&(a.bundleDetails=r,x(),R_(r),Pt().catch(()=>{}))}function bl(e,t){return!!e&&!!t&&e.integrity===t.integrity&&e.file===t.file&&(e.range?.start??null)===(t.range?.start??null)&&(e.range?.end??null)===(t.range?.end??null)}var I_=[];function bp(e,t,r){if(!r)return null;if(!Array.isArray(e)||e.length===0||!bl(e[0],r))return{stack:I_,at:0,pos:r};let n=Math.min(Math.max(t,0),e.length-1);return{stack:e,at:n,pos:e[n]}}function cv({stack:e,at:t,base:r},n){let o=e.length>0?e[t]:r;if(bl(o,n))return null;let i=e.length>0?e.slice(0,t+1):[r];return{stack:[...i,n],at:i.length}}function dv(e,t,r){return!Array.isArray(e)||e.length===0?0:Math.min(Math.max(t+r,0),e.length-1)}function yl(e,t){if(!e||!t||t.length===0)return;let r=e.getBoundingClientRect().top,n=t[0].getBoundingClientRect(),o=t.item?t.item(t.length-1).getBoundingClientRect():n,i=n.top-r+e.scrollTop,s=o.bottom-r+e.scrollTop,l=i+(s-i)/2-e.clientHeight/2;e.scrollTo({top:Math.max(0,Math.min(l,i-n.height)),behavior:"instant"})}var qi=new Map,Yi=new Map,yp=new Set;function M_(e,t,r){let n=`${e}\0${t}`;if(Yi.has(n)||yp.has(n))return;let o=rl(t);if(!o){Yi.set(n,null);return}yp.add(n),(async()=>{let i=await oo(r,o);Yi.set(n,i??null),yp.delete(n),a.focusCodeTick++,queueMicrotask(x)})()}async function F_(e){let t=qi.get(e);if(t&&(t.loading||t.sources))return;let r=(a.bundles??[]).find(n=>n.integrity===e);if(r){qi.set(e,{sources:null,loading:!0,error:null});try{let n=await go(e,r),o=Ke(n);qi.set(e,{sources:o,loading:!1,error:n.error??null})}catch(n){qi.set(e,{sources:null,loading:!1,error:n.message})}a.focusCodeTick++,queueMicrotask(x),queueMicrotask(wn)}}function wn(){let e=S.querySelectorAll(".focus-code-line-active");e.length!==0&&yl(e[0].closest(".focus-code-body"),e)}function Xi(e){let t=e?._bundleHashes;return!e?.fileHash||!Array.isArray(t)||t.length===0?null:ln(e.fileHash).find(({integrity:r})=>t.includes(r))??null}function mo(e,t,{kick:r=!0}={}){let n=qi.get(e);if(!n)return r?(F_(e),{loading:!0}):null;if(n.loading&&!r)return null;if(n.loading)return{loading:!0};if(!n.sources)return null;let o=n.sources.get(t);if(typeof o!="string")return null;M_(e,t,o);let i=`${e}\0${t}`;return{content:o,highlighted:Yi.has(i)?Yi.get(i):void 0,loading:!1}}function B_(e){if(!e)return null;let t=He(e),r=Xi(t);return r?{integrity:r.integrity,file:r.file,range:ht(t.line)}:null}function Ji(e){let t=B_(e);return t?{base:t,...bp(a.focusCodeStack,a.focusCodeAt,t)}:null}function uv(e){let t=Xi(e);if(!t)return null;let r={integrity:t.integrity,file:t.file,range:ht(e?.line)};return bp(a.focusCodeStack,a.focusCodeAt,r).pos}function pv(e){let t=Ji(e);if(!t)return null;let{pos:r}=t,n=mo(r.integrity,r.file);return!n||n.loading?n:{...n,file:r.file,integrity:r.integrity,range:r.range}}function Ge(e){return e==="informational"?"info":e.replaceAll("_"," ")}function vp(e,{variant:t="full"}={}){let r=a.severityMode,n=ne(e,r),o=c`<span class="${`badge ${n}`}">${Ge(n)}</span>`,i=nr(e),s=t==="tab"?null:Ua(e);if(!i&&!s)return o;let l=s?`Corrected severity varies across reports \u2014 ${Object.entries(s).map(([_,R])=>`${_||"(this report)"}: ${Ge(R.severity)}`).join("; ")}`:null,d=s?c`<span class="badge-varies" title="${l}" aria-label="${l}">varies</span>`:g;if(!i)return c`<span class="${`badge-pair badge-pair-${t}`}">${o}${d}</span>`;let u=e.severity,p=rr(e),f=e.correctedSeverityReason,h=(Se[p]??0)>(Se[u]??0),m=h?"up":"down",b=h?"\u25B2":"\u25BC",v=r!=="original",y=(v?`Corrected ${m} from ${Ge(u)}`:`Original severity \u2014 corrected ${m} to ${Ge(p)}`)+(f?` \u2014 ${f}`:""),w=`Severity ${Ge(n)}; ${v?`corrected ${m} from ${Ge(u)}`:`original, corrected to ${Ge(p)}`}${f?`; reason: ${f}`:""}`;if(t==="tab")return c`<span class="badge-pair badge-pair-tab" title="${y}" aria-label="${w}">${o}<span class="${`badge-corr-mark ${m}`}" aria-hidden="true">${b}</span></span>`;let k=v?u:p;return c`<span class="${`badge-pair badge-pair-${t}`}" title="${y}" aria-label="${w}">${o}<span class="badge-orig-wrap"><span class="${`badge-arrow ${m}`}" aria-hidden="true">${b}</span>${v?c`<span class="badge-pre" aria-hidden="true">was</span>`:g}<span class="${`badge-orig ${k}${v?" struck":""}`}">${Ge(k)}</span></span>${d}</span>`}var fv=/\[[^\]\n]+\]\([^)\s]+\)|\*\*[^*\n]+\*\*|"[^"\n]+"|`[^`\n]+`/gu;function Zi(e){fv.lastIndex=0;let t=[],r=0,n;for(;(n=fv.exec(e))!==null;){n.index>r&&t.push(e.slice(r,n.index));let o=n[0].codePointAt(0);if(o===91){let i=Ib(n[0]);t.push(i?c`<a href="${i.url}" target="_blank" rel="noopener noreferrer" title="${i.url}">${i.label}</a>`:n[0])}else o===42?t.push(c`<strong>${n[0].slice(2,-2)}</strong>`):o===96?t.push(c`<span class="inline-code">${n[0].slice(1,-1)}</span>`):t.push(c`<span class="inline-quote">${n[0]}</span>`);r=n.index+n[0].length}return r===0?e:(r<e.length&&t.push(e.slice(r)),t)}function L_({lang:e,code:t}){a.codeBlockTick;let r=Hu(t,e);return c`<div class="code-block" data-lang="${e||g}">${e?c`<div class="code-block-lang">${e}</div>`:g}<pre><code>${r?me(r):t}</code></pre></div>`}function P_(e,{wrap:t=!1}={}){let r=e.split(/\n{2,}/u).filter(n=>n.trim());return r.length<2?t?c`<div class="para">${Zi(e)}</div>`:Zi(e):r.map(n=>c`<div class="para">${Zi(n)}</div>`)}function O_({ordered:e,start:t,items:r}){let n=r.map(o=>c`<li>${yt(o)}</li>`);return e?c`<ol class="md-list" start="${t>1?t:g}">${n}</ol>`:c`<ul class="md-list">${n}</ul>`}function yt(e,{paragraphs:t=!0}={}){if(!e)return e;let r=t?Cb(e):[e],n=r.length>1,o=s=>t?P_(s,{wrap:n}):Zi(s),i=s=>{let l=Eu(s);return l.length===1&&typeof l[0]=="string"?o(l[0]):l.map(d=>typeof d=="string"?o(d):L_(d))};return r.length===1&&typeof r[0]=="string"?i(r[0]):r.map(s=>typeof s=="string"?i(s):O_(s))}function N_(e){return Pb(e).map(t=>typeof t=="string"?t:t.self?c`<a class="comment-self-ref" href="${t.url}" title="Show this finding">${t.label}</a>`:c`<a href="${t.url}" target="_blank" rel="noopener noreferrer" title="${t.url}">${t.label}</a>`)}function D_(e){let t=$u(e);return t?c`<span class="${`revalidate-stamp ${t}`}">${t}</span><div class="value-label">Revalidation</div>`:g}function z_(e){let t=vu()?Fe(e.revalidateVerdict,e):"";return t?c`<div class="revalidate-verdict">${yt(eo(t))}</div>`:g}function Qi(e,t,r="section",{collapsible:n=!1}={}){let o=t?c`<div class="section-body">${yt(eo(t))}</div>`:g;return!n||!t?c`<div class="${r}"><div class="section-label">${e}</div>${o}</div>`:c`<details class="${r}"><summary class="section-label">${e}</summary>${o}</details>`}function U_(e,t,r){let n=e&&t?.file?ai(e.integrity,t.file):null;return n?c`<span class="evidence-ref" role="link" tabindex="0" data-code-nav-integrity="${e.integrity}" data-code-nav-file="${n}" data-code-nav-line="${t?.line??""}">${r}</span>`:c`<span class="evidence-ref">${r}</span>`}function H_(e,t){let r=Array.isArray(e.evidence)?e.evidence:[];if(r.length===0)return g;let n=Ut(e),o=Xi(e),i=t==="focus"&&o!==null,s=i?uv(e):null;return c`<details class="evidence"><summary class="section-label">Evidence<span class="evidence-count">(${r.length})</span></summary><ol class="evidence-list">${r.map((l,d)=>{let u=qa(l),p=Tb(l,e,n,d),f=Au(l),h=gv(e,`ev${d}`,o,l?.file,l?.line),m=wp(p),b=i&&bl(s,{integrity:o.integrity,file:ai(o.integrity,l?.file),range:ht(l?.line)});return c`<li class="${T({current:b})}">${i?U_(o,l,u):p?c`<a class="evidence-ref" href="${p}" target="_blank" rel="noopener">${u}</a>`:c`<span class="evidence-ref">${u}</span>`} ${h?.mark??g} ${m} ${h?.tip??g} ${f?c`<div class="evidence-note">${yt(eo(f))}</div>`:g} ${h?.body??g}</li>`})}</ol></details>`}function V_(e,t){let r=parseInt(e.line,10),n=Number.isFinite(r)?`${e.file}:${e.line}`:e.file;return t?c`<a href="${t}" target="_blank" rel="noopener">${n}</a>`:n}function j_(e,t){if(!t)return g;let r=t.slice(0,7),n=Fb(e,t);return n?c`<a href="${n}" target="_blank" rel="noopener" title="${t}">${r}</a>`:c`<span title="${t}">${r}</span>`}var wl=c`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><path class="bubble" d="M2.5 3h11a.5.5 0 0 1 .5.5v6.5a.5.5 0 0 1-.5.5H8.4l-3 2.6V10.5H2.5a.5.5 0 0 1-.5-.5V3.5a.5.5 0 0 1 .5-.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,es=c`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><path class="wrench" d="M10.4 2.6a3 3 0 0 0-3.6 4.5L2 12l2 2 4.9-4.8a3 3 0 0 0 4.5-3.6l-1.8 1.8-1.5-.4-.4-1.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,W_=c`<svg viewBox="0 0 16 16" width="11" height="11" 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>`,K_=c`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"><path d="M6.2 11.2H4.8a3.2 3.2 0 0 1 0-6.4h1.4"/><path d="M9.8 4.8h1.4a3.2 3.2 0 0 1 0 6.4H9.8"/><path d="M5.6 8h4.8"/></g></svg>`,G_=c`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 4.6 1.3 8l3.1 3.4"/><path d="m11.6 4.6 3.1 3.4-3.1 3.4"/><path d="M9.8 2.6 6.2 13.4"/></g></svg>`,q_=c`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/></svg>`;function wp(e){let t=$b(e);return t?c`<a class="gh-ref-btn" href="${e}" target="_blank" rel="noopener noreferrer" data-tooltip="${t}" aria-label="${`Open ${t} on GitHub`}">${q_}</a>`:g}function Y_(e,t,r,n){return`${O(e)}\0${t}\0${r}\0${n?`${n.start}-${n.end}`:""}`}var bo={key:null,host:null};function vl(e,t){if(bo.key===e)return;let r=bo.host,n=e===null?null:t?.getRootNode?.()?.host??null;bo={key:e,host:n},r?.requestUpdate?.(),n!==r&&n?.requestUpdate?.()}function hv(e,t,r){a.codeBlockTick;let{text:n,lines:o,startLine:i}=Ab(e,t);if(o.length===0)return g;let s=r.lastIndexOf("."),l=Hu(n,s<0?"":r.slice(s+1)),d=i+o.length-1;return c`<div class="code-preview" style="${ae({"--lineno-width":`${String(d).length}ch`})}"><aside class="code-preview-gutter" aria-hidden="true">${o.map((u,p)=>{let f=i+p,h=!!t&&f>=t.start&&f<=t.end;return c`<div class="${T({"code-preview-lineno":!0,cited:h})}">${f}</div>`})}</aside><pre class="code-preview-source"><code>${l?me(l):n}</code></pre></div>`}function gv(e,t,r,n,o){if(a.bundleHashTick,!r||!n)return null;let i=ai(r.integrity,n);if(!i)return null;let s=ht(o),l=Y_(e,t,n,s),d=a.codePreviews.has(l);a.focusCodeTick;let u=c`<button type="button" class="${T({"code-preview-btn":!0,open:d})}" data-code-preview="${l}" aria-expanded="${String(d)}" aria-label="${d?`Hide the source at ${n}`:`Show the source at ${n}`}" @mouseenter="${h=>{vl(l,h.currentTarget),mo(r.integrity,i)}}" @mouseleave="${h=>{bo.key===l&&vl(null,h.currentTarget)}}" @focus="${h=>{vl(l,h.currentTarget),mo(r.integrity,i)}}" @blur="${h=>{bo.key===l&&vl(null,h.currentTarget)}}">${G_}</button>`;if(d){let h=mo(r.integrity,i),m=!h||h.loading?c`<div class="code-preview code-preview-pending">${h?"Loading source\u2026":"Source unavailable"}</div>`:hv(h.content,s,i);return{mark:u,tip:g,body:m}}if(bo.key!==l)return{mark:u,tip:g,body:g};let p=mo(r.integrity,i,{kick:!1}),f=p&&!p.loading?c`<div class="code-preview-tip" role="tooltip">${hv(p.content,s,i)}</div>`:g;return{mark:u,tip:f,body:g}}var X_=c`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><g stroke="currentColor" stroke-width="1.2" stroke-linecap="round" fill="none"><line x1="8" y1="1.8" x2="8" y2="14.2"/><line x1="1.8" y1="8" x2="14.2" y2="8"/><line x1="3.6" y1="3.6" x2="12.4" y2="12.4"/><line x1="12.4" y1="3.6" x2="3.6" y2="12.4"/></g></svg>`,J_=c`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="1.2"/><circle cx="8" cy="8" r="1.7" fill="currentColor"/></svg>`,kl=c`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><path class="flag-cloth" d="M5 1.5h6v13l-3-2.7-3 2.7z" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/></svg>`;function Q_(e,t=!1){let r=a.triage.get(e)?.flagged===!0,n=r?"Remove flag":"Flag this finding";return c`<button type="button" class="${T({"mark-flag":!0,flagged:r})}" data-flag-toggle="${e}" title="${n}" aria-label="${n}" aria-pressed="${String(r)}">${kl}${t?c`<span class="mark-btn-label">${r?"Flagged":"Flag"}</span>`:g}</button>`}function Z_(e){let t=Bi(e)||e.file||"Security finding";return t.length>120?`${t.slice(0,119)}\u2026`:t}function eC(e){let t=Cr(e,Ut(e)),r=parseInt(e.line,10),n=Number.isFinite(r)?`${e.file}:${e.line}`:e.file,o=[];e.file&&o.push(`File: ${t?`[${n}](${t})`:n}`),e.description&&o.push(e.description);let i=Li(e);return i&&o.push(i),e.confidence!==void 0&&e.confidence!==null&&o.push(`Confidence: ${e.confidence}/10`),o.join(`
104
-
105
- `)}function tC(e){if(!a.currentWorkspace)return g;let t=e[0]?._reportName;if(!t)return g;let r=oe[ot(t)]??oe.default;return c`<span class="report-chip" title="${t}">${me(r)}<span class="report-chip-label">${Ue(t)}</span></span>`}function mv(e,t,r,n,o=null){let i=tC(e),s=O(n),l=a.triage.get(s),d=l?.color??null,u=l?.comment??"",p=l?.fix??"",f=u?`Edit comment: ${u}`:"Add comment",h=p?`Edit fix link: ${p}`:"Add fix link (PR URL, etc.)",m=o==="focus",b=u?"Edit comment":"Comment",v=p?"Edit fix link":"Fix link",y=c`<button type="button" class="${T({"mark-comment":!0,"has-comment":u})}" title="${f}" aria-label="${f}">${wl}${m?c`<span class="mark-btn-label">${b}</span>`:g}</button>`,w=c`<button type="button" class="${T({"mark-fix":!0,"has-fix":p})}" title="${h}" aria-label="${h}">${es}${m?c`<span class="mark-btn-label">${v}</span>`:g}</button>`,k=Q_(s,m),_=c`<button type="button" class="mark-copy" title="Copy file, line, description, confidence to clipboard" aria-label="Copy finding details to clipboard">${W_}${m?c`<span class="mark-btn-label">Copy</span>`:g}</button>`,R=cn(s)?c`<button type="button" class="mark-link" title="Copy a link to this finding" aria-label="Copy a link to this finding">${K_}${m?c`<span class="mark-btn-label">Link</span>`:g}</button>`:g,C=Ja(n),M=Lb(C,{title:Z_(n),body:eC(n)}),z=M?c`<a class="mark-issue" href="${M}" target="_blank" rel="noopener" title="Create a pre-filled GitHub issue for this finding" aria-label="Create a GitHub issue for this finding">${J_}${m?c`<span class="mark-btn-label">Issue</span>`:g}</a>`:g,F=c`<button type="button" class="mark-claude" title="Open in Claude Code (claude://) with a confirm-and-fix prompt" aria-label="Open finding in Claude Code">${X_}${m?c`<span class="mark-btn-label">Claude</span>`:g}</button>`,H=c`<color-marker .selected="${d}"></color-marker>`,he=r.hasConflict?"change triage state (colors mismatch \u2014 acts per-tab)":t.length>1?"change triage state for the whole group":"change triage state";return c`${i}<span class="mark-action-group">${y}${w}${k}</span><span class="mark-action-group">${_}${R}${z}${F}</span>${H}${nC(e,he,o,r,n)}`}function rC(e){if(e.newState!=="open")return;let t=e.currentTarget,n=t.getRootNode().querySelector?.(`[popovertarget="${t.id}"]`);if(!n)return;let o=n.getBoundingClientRect(),i=t.offsetWidth||110,s=t.offsetHeight||100,l=4,d=o.right-i;d<4&&(d=4),d+i>window.innerWidth-4&&(d=window.innerWidth-i-4);let u=o.bottom+l;u+s>window.innerHeight-4&&o.top>s+l&&(u=o.top-s-l),t.style.top=`${u}px`,t.style.left=`${d}px`}function nC(e,t,r,n,o){let i=O(e[0]),s=Pu(e,n,o),l={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Deleted",ignored:"Ignored"},d={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Delete",ignored:"Ignore"},u=!!a.shownTriage,p=u?l[a.shownTriage]:null,f=["inprogress","fixed","invalid","deleted","ignored"],h=r==="focus",m;h?m=f.map(y=>({key:y,label:d[y]})):u?m=[{key:"restore",label:"Restore"},...f.filter(y=>y!==a.shownTriage).map(y=>({key:y,label:d[y]}))]:m=f.map(y=>({key:y,label:d[y]}));let b=["mark-triage-menu"];u&&b.push("with-label",`triage-state-${a.shownTriage}`);let v=`triage-menu-${i.replaceAll(/[^A-Za-z0-9_-]/gu,"_")}`;return c`<div class="triage-menu-wrap"><button type="button" class="${b.join(" ")}" popovertarget="${v}" popovertargetaction="toggle" title="${t}" aria-label="${t}">${p?c`<span class="mark-triage-label">${p}</span>`:g} <svg viewBox="0 0 12 12" width="11" height="11" aria-hidden="true"><path d="M2 4l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></button><div popover="auto" id="${v}" class="triage-menu" data-gid="${i}" role="menu" @beforetoggle="${rC}">${m.map(y=>c`<button type="button" class="${T({"triage-menu-item":!0,[`triage-menu-${y.key}`]:!0,active:s===y.key})}" data-triage-action="${y.key}" role="menuitem">${y.label}</button>`)}</div></div>`}function oC(e){let t=!!e?.comment,r=!!e?.fix,n=e?.flagged===!0;return!t&&!r&&!n?g:c`<span class="tab-marks">${t?c`<span class="has-comment" title="Has a comment">${wl}</span>`:g}${r?c`<span class="has-fix" title="Has a fix link">${es}</span>`:g}${n?c`<span class="flagged" title="Flagged">${kl}</span>`:g}</span>`}function bv(e,t,r){let n=O(e),o=a.triage.get(n),i=o?.color,s=o?.triage,l=["tab"];return t&&l.push("active"),i&&l.push(`tab-mark-${i}`),s?r.commonTriage===null&&l.push(`tab-${s}`):!r.allIgnored&&Oi(e)&&l.push("tab-ignored"),c`<button type="button" class="${l.join(" ")}" data-tid="${n}"><span class="tab-label">${vp(e,{variant:"tab"})} ${e.confidence===void 0?g:c`<span class="tab-conf">${e.confidence}/10</span>`}${oC(o)}</span></button>`}function iC(e){if(a.viewMode==="table"||a.viewMode==="focus"){let t=e.confidence*10;return c`<div class="${`conf-ring ${ne(e,a.severityMode)}`}"><svg viewBox="0 0 36 36" aria-hidden="true"><circle class="conf-ring-track" cx="18" cy="18" r="15.9155"/><circle class="conf-ring-arc" cx="18" cy="18" r="15.9155" style="${`stroke-dasharray: ${t} 100`}"></circle></svg> <span>${e.confidence}<small>/10</small></span></div><div class="value-label">Confidence</div>`}return c`<div class="conf-score"><strong>${e.confidence}</strong>/10</div><div class="value-label">Confidence</div>`}var sC=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/iu;function aC(e){if(Fn(e))return g;let t=e?.name;if(typeof t!="string"||!sC.test(t))return g;let r=e?.version,n=typeof r=="string"&&r.length>0,o=n?`https://www.npmjs.com/package/${t}/v/${encodeURIComponent(r)}`:`https://www.npmjs.com/package/${t}`,i=n?`${t}@${r}`:t;return c`<span class="line-num"><a class="npm-link" href="${o}" target="_blank" rel="noopener noreferrer" title="${`Open ${i} on npmjs.com`}">npm: ${i}</a></span>`}function lC(e,t,r=0,n=1,o=null){let i=O(e),s=a.triage.get(i),l=s?.comment??"",d=s?.fix??"",u=Cr(e,Ut(e)),p=parseInt(e.line,10),f=Number.isFinite(p)?`${e.file}:${e.line}`:e.file,h=u?c`<a href="${u}" target="_blank" rel="noopener">${f}</a>`:f,m=hn(e),b=Xi(e),v=gv(e,"loc",b,e.file,e.line),y=wp(u),w=c`<span class="line-num">${m?c`${h}, ${m}`:h}${v?.mark??g}${y}</span>`,k=gn(e),_=String(e.discoveredIn??"").trim(),R=_===String(e.file??"").trim()?"":_,C=o==="focus"?aC(e.package?.npm):g,M=g;if(o!=="focus"&&e.fileHash&&Array.isArray(e._bundleHashes)&&e._bundleHashes.length>0){a.bundleHashTick;let ge=new Set(e._bundleHashes),Ve=ln(e.fileHash).find(({integrity:Ur})=>ge.has(Ur));Ve&&(M=c`<button type="button" class="finding-code-btn" data-finding-code-bundle="${Ve.integrity}" data-finding-code-file="${Ve.file}" data-finding-code-line="${e.line??""}" title="${`Open ${Ve.file} in bundle source viewer`}">Code</button>`)}let{title:z,body:F}=to(e),H=Sb(F),he=H.findIndex(ge=>ge.label!==null),te=he===-1?H:H.slice(0,he),lt=he===-1?[]:H.slice(he);return c`<div class="${T({"tab-body":!0,active:t})}" data-tid="${i}">${n>1?c`<div class="print-case-label">${r+1} of ${n}</div>`:g}<div class="finding-left">${vp(e,{variant:"full"})}<div class="value-label">Severity</div>${e.confidence===void 0?g:iC(e)} ${D_(e)} ${M}</div><div><div class="line-row">${w} ${v?.tip??g} ${C} ${R?c`<span class="line-num discovered-in">(found analyzing ${R})</span>`:g} ${k?c`<span class="run-meta">${k}</span>`:g}</div>${v?.body??g} ${z?c`<div class="desc-title">${Zi(z)}</div>`:g} ${te.map(ge=>c`<div class="desc">${yt(eo(ge.body))}</div>`)} ${H_(e,o)} ${lt.map(ge=>ge.label===null?c`<div class="desc">${yt(eo(ge.body))}</div>`:Qi(ge.label,ge.body))} ${e.impact?Qi("Impact",Fe(e.impact,e)):g} ${e.reproduction?Qi("Reproduction",Fe(e.reproduction,e),"section",{collapsible:!0}):g} ${e.recommendation?Qi("Recommendation",Fe(e.recommendation,e),"recommendation",{collapsible:!0}):g} ${e.confidenceReason?c`<div class="conf-reason">${yt(Fe(e.confidenceReason,e))}</div>`:g} ${z_(e)} ${e.revalidateRecommendation&&vu()?Qi("Revalidation recommendation",Fe(e.revalidateRecommendation,e),"recommendation",{collapsible:!0}):g} ${nr(e)&&e.correctedSeverityReason?c`<div class="severity-reason"><span class="severity-reason-label">Severity correction:</span> ${yt(e.correctedSeverityReason)}</div>`:g} ${l?c`<div class="comment-block"><span class="comment-label">Comment:</span> ${N_(l)}</div>`:g} ${d?c`<div class="fix-block"><span class="fix-label">Fix:</span> ${_t(d)?c`<a href="${d}" target="_blank" rel="noopener noreferrer">${d}</a>`:d}</div>`:g}</div></div>`}function yo(e){return de(e)}function yv(e){let t=pe(e),r=no(e),n=e.some(i=>i.critical||ne(i,a.severityMode)==="critical"),o=["finding"];return n&&o.push("is-critical"),t.hasConflict?o.push("has-conflict"):t.commonColor&&o.push(`mark-${t.commonColor}`),a.shownTriage&&o.push(`triage-${a.shownTriage}`),r.length>1&&o.push("multi-case"),o}function vv(e,t={}){let{context:r=null}=t,n=pe(e),o=no(e),i=He(e),s=O(i),l=i.commitHash?c`<div class="commit-ref">introduced in ${j_(i.repo?.github,i.commitHash)}</div>`:g,d=a.currentWorkspace&&l!==g;return c`${o.map((u,p)=>lC(u,O(u)===s,p,o.length,r))} ${d?c`<div class="marks-commit-row">${l}</div>`:g}<div class="marks"><div class="marks-left">${d?g:l} ${o.length>1?c`<div class="tabs">${o.map(u=>bv(u,O(u)===s,n))}</div>`:g}</div>${mv(e,o,n,i,r)}</div>`}function kn(e){return de(e)}function wv(e){let t=pe(e),r=e.some(o=>o.critical||ne(o,a.severityMode)==="critical"),n=[];return r&&n.push("is-critical"),t.hasConflict?n.push("has-conflict"):t.commonColor&&n.push(`mark-${t.commonColor}`),a.shownTriage&&n.push(`triage-${a.shownTriage}`),n}function kv(e){let t=pe(e),r=no(e),n=He(e),o=O(n),i=n,s=Bi(i),l=gn(i),d=hn(i),u=d?`, ${d}`:"",p=Cr(i,Ut(i));return c`<div class="row-score">${vp(i,{variant:"compact"})} ${i.confidence===void 0?g:c`<span class="row-conf"><strong>${i.confidence}</strong>/10</span>`}</div><div class="row-body"><div class="title-row"><span class="title">${s}</span> ${l?c`<span class="row-type">${l}</span>`:g}</div><div class="meta-row"><span class="row-loc">${V_(i,p)}${u}</span> ${wp(p)}<div class="marks">${mv(e,r,t,n)}</div></div>${r.length>1?c`<div class="tabs-row"><div class="tabs">${r.map(f=>bv(f,O(f)===o,t))}</div></div>`:g}</div>`}function $v(e){if(!e)return g;let t=ln(e)[0];return t?c`<button type="button" class="tree-code-btn" data-finding-code-bundle="${t.integrity}" data-finding-code-file="${t.file}" title="${`Open ${t.file} in bundle source viewer`}">Code</button>`:g}function xv(e,t){let r=Object.keys(e).toSorted(),n=new Map;for(let p of r)for(let f of e[p].imports??[]){let h=n.get(f)??[];h.push(p),n.set(f,h)}let o=a.filesSearch.trim().toLowerCase(),i=o?r.filter(p=>p.toLowerCase().includes(o)):r,s=p=>e[p]?c`<a href="${`#${Ui(p)}`}"><span class="name">${p}</span></a>`:c`<span class="name">${p}</span>`,l=p=>{let f=t.get(p);if(!f)return null;let h=_e.filter(m=>(f[m]??0)>0);return h.length===0?null:c`<span class="tree-count-chips">${h.map(m=>c`<span class="${`tree-count-chip ${m}`}">${f[m]} ${m.replaceAll("_"," ")}</span>`)}</span>`},d=p=>{let f=t.get(p);return f?_e.reduce((h,m)=>h+(f[m]??0),0):0},u=c`<div class="tree-toolbar"><view-mode-buttons modes="table,list" kind="files"></view-mode-buttons><div class="search-row"><toolbar-search kind="files"></toolbar-search><span class="result-count">${i.length} of ${r.length}</span></div></div>`;if(a.filesViewMode==="table"){let p=a.filesSelectedFile&&e[a.filesSelectedFile]&&i.includes(a.filesSelectedFile)?a.filesSelectedFile:null;return c`<div class="${p?"tree-view tree-view-table with-details":"tree-view tree-view-table"}">${u}<div class="${p?"tree-table-layout open":"tree-table-layout"}"><div class="tree-table-list">${i.length===0?c`<div class="tree-table-empty">No files match the search.</div>`:g} ${i.map(m=>{let b=d(m),v=m===p,y=ie(e[m]?.size);return c`<div class="${`tree-table-row${v?" selected":""}${b===0?" clean":""}`}" data-tree-select="${m}"><span class="tree-table-name">${m}</span> ${l(m)??c`<span class="tree-table-clean-marker">—</span>`} ${y?c`<span class="tree-table-size">${y}</span>`:g}</div>`})}</div>${p?c`<aside class="tree-table-details" id="tree-table-details"><header class="tree-table-details-bar"><span class="tree-table-details-label">Details</span> <button type="button" class="tree-table-details-close" data-tree-deselect title="Close details" aria-label="Close details">×</button></header><div class="tree-table-details-body">${cC(e[p],p,n.get(p)??[],s)}</div></aside>`:g}</div></div>`}return c`<div class="tree-view">${u} ${i.length===0?c`<div class="tree-table-empty">No files match the search.</div>`:g} ${i.map(p=>{let f=e[p],h=n.get(p)??[],m=ie(f?.size);return c`<section class="tree-file" id="${Ui(p)}"><div class="tree-file-header"><span class="name">${p}</span> ${l(p)} ${m?c`<span class="tree-file-size">${m}</span>`:g} ${$v(f.fileHash)}</div>${f.fileHash||f.treeHash?c`<div class="tree-hashes hashes">${f.fileHash?c`<div class="tree-hash">file: ${f.fileHash}</div>`:g} ${f.treeHash?c`<div class="tree-hash">tree: ${f.treeHash}</div>`:g}</div>`:g} ${f.imports?.length>0?c`<div class="tree-section"><span class="tree-section-label">imports</span><ul>${f.imports.map(b=>c`<li>${s(b)}</li>`)}</ul></div>`:g} ${h.length>0?c`<div class="tree-section"><span class="tree-section-label">imported by</span><ul>${h.map(b=>c`<li>${s(b)}</li>`)}</ul></div>`:g} ${f.exports?.length>0?c`<div class="tree-section"><span class="tree-section-label">exports</span><ul>${f.exports.map(b=>c`<li><span class="name">${b}</span></li>`)}</ul></div>`:g}</section>`})}</div>`}function cC(e,t,r,n){let o=ie(e?.size);return c`<div class="tree-detail-name"><span class="name">${t}</span> ${o?c`<span class="tree-detail-size">${o}</span>`:g} ${$v(e.fileHash)}</div>${e.fileHash||e.treeHash?c`<div class="tree-hashes hashes">${e.fileHash?c`<div class="tree-hash">file: ${e.fileHash}</div>`:g} ${e.treeHash?c`<div class="tree-hash">tree: ${e.treeHash}</div>`:g}</div>`:g} ${e.imports?.length>0?c`<div class="tree-section"><span class="tree-section-label">imports</span><ul>${e.imports.map(i=>c`<li>${n(i)}</li>`)}</ul></div>`:g} ${r.length>0?c`<div class="tree-section"><span class="tree-section-label">imported by</span><ul>${r.map(i=>c`<li>${n(i)}</li>`)}</ul></div>`:g} ${e.exports?.length>0?c`<div class="tree-section"><span class="tree-section-label">exports</span><ul>${e.exports.map(i=>c`<li><span class="name">${i}</span></li>`)}</ul></div>`:g}`}var ts=null,rs=null;function dC(){return ts||(ts=(async()=>{let e="./terminal.js";try{return await import(e)}catch(t){throw ts=null,t}})(),ts)}function uC(e){let t=Ke(e);if(t.size===0)return t;let r=[...t.keys()],{stripped:n}=it(r),o=new Map;for(let i=0;i<r.length;i++)o.set(n[i],t.get(r[i]));return o}async function Sv(e,t){let r=t?.integrity??"";(!rs||rs.integrity!==r)&&(rs={integrity:r,promise:pC(t,r)});try{let n=await rs.promise;return!e.isConnected||e.contains(n)||e.replaceChildren(n),n}catch(n){rs=null;let o=n instanceof Error?n.message:String(n);return e.textContent=`Terminal failed to load: ${o}`,null}}async function pC(e,t){return(await dC()).createTerminalElement(uC(e),t)}function _v(){Pt().catch(()=>{});let e=Lt(),t={inprogress:0,fixed:0,invalid:0,deleted:0},r=[];for(let[h,m]of e){let b=[],v=[],y=new Map,w=new Set;for(let[k,_]of m.byVersion){let R=[],C=new Map;for(let M of _.findings){let z=a.triage.get(O(M))?.triage??null;z==="inprogress"?t.inprogress++:z==="fixed"?t.fixed++:z==="invalid"?t.invalid++:z==="deleted"&&t.deleted++,z===a.shownTriage&&(R.push(M),C.has(M.file)||C.set(M.file,[]),C.get(M.file).push(M))}if(R.length!==0){b.push([k,{findings:R,files:C,reports:_.reports}]);for(let M of R)v.push(M),y.has(M.file)||y.set(M.file,[]),y.get(M.file).push(M);for(let M of _.reports)w.add(M)}}b.length!==0&&(b.sort(([k],[_])=>ac(k,_)),r.push([h,{findings:v,files:y,reports:w,versions:b}]))}let n=a.selectedPackage,o=n?r.find(([h])=>h===n)??null:null,i=null;if(o){let h=o[1].versions,m=a.selectedPackageVersion;i=h.find(([b])=>b===m)??null,!i&&h.length===1&&(i=h[0])}let s=i?i[1]:o?o[1]:null;if(o&&a.packageDetailsTab==="issues")return vC(o[0],s,i?i[0]:void 0);let l=a.packagesSearchQuery.trim().toLowerCase(),d=l?r.filter(([h])=>h.toLowerCase().includes(l)):r.slice();bC(d,a.packagesSortBy);let u=r.reduce((h,[,m])=>h+m.findings.length,0),p=new Set;for(let[,h]of r)for(let m of h.reports)p.add(m);let f=o?"packages-layout open":"packages-layout";return c`<div class="${T({"packages-view":!0,"with-details":!!o})}"><header class="page-head"><div class="page-title"><h1>Packages</h1><div class="meta-row"><span>${d.length===r.length?c`${r.length} ${r.length===1?"package":"packages"}`:c`${d.length} of ${r.length} ${r.length===1?"package":"packages"}`}</span> ${u>0?c`<span>${u} ${u===1?"finding":"findings"} across ${p.size} ${p.size===1?"report":"reports"}</span>`:g}</div></div>${gC(t)}</header>${r.length===0?c`<p style="color:var(--muted)">${e.size===0?"Indexing reports\u2026 this view populates as the OPFS scan finishes.":a.shownTriage?`No ${a.shownTriage} findings in any package.`:"No untriaged findings in any package."}</p>`:d.length===0?c`<p style="color:var(--muted)">No packages match "${a.packagesSearchQuery}".</p>`:c`<div class="${f}"><ul class="packages-list">${X(fC(d),hC,h=>wC(h,n,a.selectedPackageVersion))}</ul>${o?c`<aside class="packages-details" id="packages-details"><header class="packages-details-bar"><span class="packages-details-label">Details</span> <button type="button" class="packages-details-close" data-deselect-package title="Close details" aria-label="Close details">×</button></header><div class="packages-details-body">${xC(o[0],s,i?i[0]:void 0)}</div></aside>`:g}</div>`}</div>`}function fC(e){let t=[];for(let[r,n]of e){let o=n.versions;if(o.length<=1){let[d,u]=o[0];t.push({kind:"single",pkg:r,version:d,bucket:u,totalVersions:1});continue}let[i,s]=o[0],l=a.expandedPackages.has(r);if(t.push({kind:"latest",pkg:r,version:i,bucket:s,totalVersions:o.length,expanded:l}),l)for(let d=1;d<o.length;d++){let[u,p]=o[d];t.push({kind:"other",pkg:r,version:u,bucket:p,totalVersions:o.length})}}return t}function hC(e){return e.version===null?`${e.kind}:${e.pkg}`:`${e.kind}:${e.pkg}@${e.version}`}function gC(e){return c`<div class="packages-toolbar"><entity-search kind="packages"></entity-search><entity-sort kind="packages"></entity-sort><triage-selector variant="packages" .counts="${e}" .states="${mC}"></triage-selector></div>`}var mC=["inprogress","fixed","invalid","deleted"];function bC(e,t){let r=t==="name-asc"?(n,o)=>n[0].localeCompare(o[0]):t==="files-desc"?(n,o)=>o[1].files.size-n[1].files.size||n[0].localeCompare(o[0]):t==="reports-desc"?(n,o)=>o[1].reports.size-n[1].reports.size||n[0].localeCompare(o[0]):(n,o)=>o[1].findings.length-n[1].findings.length||n[0].localeCompare(o[0]);e.sort(r)}function yC(e,t){let r={live:0,invalid:0,deleted:0};if(!e)return r;let n=t===void 0?e.files.values():e.byVersion.get(t)?.files.values()??[].values();for(let o of n)for(let i of o){let s=a.triage.get(O(i))?.triage??null;s==="invalid"?r.invalid++:s==="deleted"?r.deleted++:r.live++}return r}function vC(e,t,r){let n=Lt().get(e),o=yC(n,r),i=a.packageSlideTriage??"live",s=n?Cv(n,e,i,r):new Map,l=[...s.values()].reduce((f,h)=>f+h.length,0),d=i==="live"?l===1?"issue":"issues":l===1?`${i} issue`:`${i} issues`,u=i==="live"?"No live issues for this package.":`No ${i} issues for this package.`,p=typeof r=="string"?` @ ${r}`:"";return c`<div class="packages-view packages-slide-view"><header class="bundles-slide-bar"><button type="button" class="bundles-slide-back" data-action="package-slide-back" title="Back to packages" aria-label="Back to packages">← Back</button><div class="bundles-slide-title"><div class="bundles-slide-name">${e}${p}</div><div class="bundles-slide-integrity">${l} ${d} · ${t.files.size} ${t.files.size===1?"file":"files"} · ${t.reports.size} ${t.reports.size===1?"report":"reports"}</div></div><slide-triage-tabs kind="package" .counts="${o}"></slide-triage-tabs></header><div class="bundles-slide-body">${s.size===0?c`<div class="bundle-issues-empty">${u}</div>`:Gi(s,{kind:"package",bucketKey:e})}</div></div>`}function wC(e,t,r){let{kind:n,pkg:o,version:i,bucket:s}=e,l={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let b of s.findings){let v=ne(b,a.severityMode);l[v]!==void 0&&l[v]++}let d=_e.filter(b=>l[b]>0),u=Qe(o),f={selected:o===t&&kC(e,r),"packages-row-latest":n==="latest","packages-row-other":n==="other"},h=i===null?"":i,m=i===null?`Open issues for ${o}`:`Open issues for ${o}@${i}`;return c`<li class="${T(f)}" data-select-package="${o}" data-select-package-version="${h}"><span class="packages-dot" style="${ae({background:u})}"></span><div class="packages-row-text"><div class="packages-name-line"><span class="packages-name">${o}${i===null?g:c`<span class="packages-version">@${i}</span>`} </span>${n==="latest"?$C(o,e.expanded,e.totalVersions-1):g}</div><span class="packages-row-meta">${s.findings.length} ${s.findings.length===1?"finding":"findings"} · ${s.files.size} ${s.files.size===1?"file":"files"} · ${s.reports.size} ${s.reports.size===1?"report":"reports"}</span></div>${d.length>0?c`<div class="packages-row-chips">${d.map(b=>c`<span class="${`tree-count-chip ${b}`}" title="${b.replaceAll("_"," ")}">${l[b]}</span>`)}</div>`:g} <button type="button" class="packages-row-issues" data-package-row-issues="${o}" data-package-row-issues-version="${h}" aria-label="${m}">Issues →</button></li>`}function kC(e,t){return e.kind==="single"?!0:e.version===t}function $C(e,t,r){let n=t?"Hide":`+${r} ${r===1?"version":"versions"}`;return c`<button type="button" class="${T({"packages-row-expand":!0,expanded:t})}" data-package-expand="${e}" aria-expanded="${String(t)}" aria-label="${t?`Hide older versions of ${e}`:`Show older versions of ${e}`}" title="${t?"Hide older versions":`Show older versions (${r})`}"><span class="packages-row-expand-chevron" aria-hidden="true"></span> <span class="packages-row-expand-label">${n}</span></button>`}function xC(e,t,r){let n=Lt().get(e),i=[...(n?Cv(n,e,"live",r):new Map).values()].reduce((s,l)=>s+l.length,0);return c`<div class="bundles-tabs" role="tablist"><button type="button" class="bundles-tab active" data-package-tab="overview" aria-selected="true" role="tab">Overview</button> <span class="bundles-tabs-spacer"></span> ${i>0?c`<button type="button" class="bundles-tab bundles-tab-action" data-package-tab="issues">Issues (${i}) →</button>`:g}</div>${SC(e,t,r)}`}function Cv(e,t,r="live",n){let o=new Map,i=n===void 0?e.files:e.byVersion.get(n)?.files??new Map;for(let[s,l]of i){let d=l.filter(f=>{let h=a.triage.get(O(f))?.triage??null;return r==="invalid"?h==="invalid":r==="deleted"?h==="deleted":h!=="invalid"&&h!=="deleted"});if(d.length===0)continue;let u=Ev(t,s);o.has(u)||o.set(u,[]);let p=o.get(u);for(let f of d)p.push(f)}return o}function SC(e,t,r){let n={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let f of t.findings){let h=ne(f,a.severityMode);n[h]!==void 0&&n[h]++}let o=_e.filter(f=>n[f]>0),i=[...t.files.entries()].toSorted(([f,h],[m,b])=>b.length!==h.length?b.length-h.length:f.localeCompare(m)),s=[...t.reports].toSorted((f,h)=>f.localeCompare(h)),d=Lt().get(e)?.repos,u=d&&d.size===1?[...d][0]:null,p=u?/^https?:/iu.test(u)?u:`https://github.com/${u}`:null;return c`<dl class="packages-detail-meta"><dt>Package</dt><dd class="mono">${e}</dd>${r?c`<dt>Version</dt><dd class="mono">${r}</dd>`:g} ${p?c`<dt>Repository</dt><dd class="mono"><a href="${p}" target="_blank" rel="noopener">${u}</a></dd>`:g}<dt>Findings</dt><dd>${t.findings.length}</dd><dt>Files</dt><dd>${t.files.size}</dd><dt>Reports</dt><dd>${t.reports.size}</dd></dl>${o.length>0?c`<div class="packages-detail-chips">${o.map(f=>c`<span class="${`tree-count-chip ${f}`}">${n[f]} ${f.replaceAll("_"," ")}</span>`)}</div>`:g}<h3 class="packages-detail-section">Reports</h3><ul class="packages-detail-reports">${s.map(f=>{let h=oe[ot(f)]??oe.default;return c`<li><button type="button" class="packages-detail-report" title="${f}" data-package-report="${f}">${me(h)}<span class="packages-detail-report-label">${Ue(f)}</span></button></li>`})}</ul><h3 class="packages-detail-section">Files</h3><ul class="packages-detail-files">${i.map(([f,h])=>{let m=Ev(e,f);return c`<li class="packages-detail-file"><span class="packages-detail-file-path mono" title="${f}">${m}</span> <span class="packages-detail-file-count">${h.length}</span></li>`})}</ul>`}function Ev(e,t){for(let r of["node_modules","dependencies"]){let n=`${r}/${e}/`,o=t.indexOf(n);if(o>=0)return t.slice(o+n.length)}return t.startsWith(`${e}/`)?t.slice(e.length+1):t}function vt(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}function Av(){Pt().catch(()=>{});let e=an(),t={inprogress:0,fixed:0,invalid:0,deleted:0},r=[];for(let[p,f]of e){let h=[],m=new Map;for(let b of f.findings){let v=a.triage.get(O(b))?.triage??null;v==="inprogress"?t.inprogress++:v==="fixed"?t.fixed++:v==="invalid"?t.invalid++:v==="deleted"&&t.deleted++,v===a.shownTriage&&(h.push(b),m.has(b.file)||m.set(b.file,[]),m.get(b.file).push(b))}h.length>0&&r.push([p,{findings:h,files:m,reports:f.reports}])}let n=a.selectedRepository,o=n?r.find(([p])=>p===n)??null:null;if(o&&a.repositoryDetailsTab==="issues")return TC(o[0],o[1]);let i=a.repositoriesSearchQuery.trim().toLowerCase(),s=i?r.filter(([p])=>p.toLowerCase().includes(i)||vt(p).toLowerCase().includes(i)):r.slice();EC(s,a.repositoriesSortBy);let l=r.reduce((p,[,f])=>p+f.findings.length,0),d=new Set;for(let[,p]of r)for(let f of p.reports)d.add(f);let u=o?"packages-layout open":"packages-layout";return c`<div class="${T({"packages-view":!0,"with-details":!!o})}"><header class="page-head"><div class="page-title"><h1>Repositories</h1><div class="meta-row"><span>${s.length===r.length?c`${r.length} ${r.length===1?"repository":"repositories"}`:c`${s.length} of ${r.length} ${r.length===1?"repository":"repositories"}`}</span> ${l>0?c`<span>${l} ${l===1?"finding":"findings"} across ${d.size} ${d.size===1?"report":"reports"}</span>`:g}</div></div>${_C(t)}</header>${r.length===0?c`<p style="color:var(--muted)">${e.size===0?"Indexing reports\u2026 this view populates as the OPFS scan finishes.":a.shownTriage?`No ${a.shownTriage} findings in any repository.`:"No untriaged findings in any repository."}</p>`:s.length===0?c`<p style="color:var(--muted)">No repositories match "${a.repositoriesSearchQuery}".</p>`:c`<div class="${u}"><ul class="packages-list">${X(s,([p])=>p,([p,f])=>RC(p,f,p===n))}</ul>${o?c`<aside class="packages-details" id="repositories-details"><header class="packages-details-bar"><span class="packages-details-label">Details</span> <button type="button" class="packages-details-close" data-deselect-repository title="Close details" aria-label="Close details">×</button></header><div class="packages-details-body">${IC(o[0],o[1])}</div></aside>`:g}</div>`}</div>`}function _C(e){return c`<div class="packages-toolbar"><entity-search kind="repositories"></entity-search><entity-sort kind="repositories"></entity-sort><triage-selector variant="packages" .counts="${e}" .states="${CC}"></triage-selector></div>`}var CC=["inprogress","fixed","invalid","deleted"];function EC(e,t){let r=t==="name-asc"?(n,o)=>vt(n[0]).localeCompare(vt(o[0])):t==="files-desc"?(n,o)=>o[1].files.size-n[1].files.size||vt(n[0]).localeCompare(vt(o[0])):t==="reports-desc"?(n,o)=>o[1].reports.size-n[1].reports.size||vt(n[0]).localeCompare(vt(o[0])):(n,o)=>o[1].findings.length-n[1].findings.length||vt(n[0]).localeCompare(vt(o[0]));e.sort(r)}function AC(e){let t={live:0,invalid:0,deleted:0};if(!e)return t;for(let r of e.files.values())for(let n of r){let o=a.triage.get(O(n))?.triage??null;o==="invalid"?t.invalid++:o==="deleted"?t.deleted++:t.live++}return t}function TC(e,t){let r=an().get(e),n=AC(r),o=a.repositorySlideTriage??"live",i=r?Tv(r,o):new Map,s=[...i.values()].reduce((u,p)=>u+p.length,0),l=o==="live"?s===1?"issue":"issues":s===1?`${o} issue`:`${o} issues`,d=o==="live"?"No live issues for this repository.":`No ${o} issues for this repository.`;return c`<div class="packages-view packages-slide-view"><header class="bundles-slide-bar"><button type="button" class="bundles-slide-back" data-action="repository-slide-back" title="Back to repositories" aria-label="Back to repositories">← Back</button><div class="bundles-slide-title"><div class="bundles-slide-name">${vt(e)}</div><div class="bundles-slide-integrity">${s} ${l} · ${t.files.size} ${t.files.size===1?"file":"files"} · ${t.reports.size} ${t.reports.size===1?"report":"reports"}</div></div><slide-triage-tabs kind="repository" .counts="${n}"></slide-triage-tabs></header><div class="bundles-slide-body">${i.size===0?c`<div class="bundle-issues-empty">${d}</div>`:Gi(i,{kind:"repository",bucketKey:e})}</div></div>`}function RC(e,t,r){let n={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let l of t.findings){let d=ne(l,a.severityMode);n[d]!==void 0&&n[d]++}let o=_e.filter(l=>n[l]>0),i=Qe(e),s=vt(e);return c`<li class="${r?"selected":""}" data-select-repository="${e}"><span class="packages-dot" style="${ae({background:i})}"></span><div class="packages-row-text"><span class="packages-name">${s}</span> <span class="packages-row-meta">${t.findings.length} ${t.findings.length===1?"finding":"findings"} · ${t.files.size} ${t.files.size===1?"file":"files"} · ${t.reports.size} ${t.reports.size===1?"report":"reports"}</span></div>${o.length>0?c`<div class="packages-row-chips">${o.map(l=>c`<span class="${`tree-count-chip ${l}`}" title="${l.replaceAll("_"," ")}">${n[l]}</span>`)}</div>`:g} <button type="button" class="packages-row-issues" data-repository-row-issues="${e}" aria-label="${`Open issues for ${s}`}">Issues →</button></li>`}function IC(e,t){let r=an().get(e),o=[...(r?Tv(r):new Map).values()].reduce((i,s)=>i+s.length,0);return c`<div class="bundles-tabs" role="tablist"><button type="button" class="bundles-tab active" data-repository-tab="overview" aria-selected="true" role="tab">Overview</button> <span class="bundles-tabs-spacer"></span> ${o>0?c`<button type="button" class="bundles-tab bundles-tab-action" data-repository-tab="issues">Issues (${o}) →</button>`:g}</div>${MC(e,t)}`}function Tv(e,t="live"){let r=new Map;for(let[n,o]of e.files){let i=o.filter(s=>{let l=a.triage.get(O(s))?.triage??null;return t==="invalid"?l==="invalid":t==="deleted"?l==="deleted":l!=="invalid"&&l!=="deleted"});i.length>0&&r.set(n,i)}return r}function MC(e,t){let r={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let l of t.findings){let d=ne(l,a.severityMode);r[d]!==void 0&&r[d]++}let n=_e.filter(l=>r[l]>0),o=[...t.files.entries()].toSorted(([l,d],[u,p])=>p.length!==d.length?p.length-d.length:l.localeCompare(u)),i=[...t.reports].toSorted((l,d)=>l.localeCompare(d)),s=/^https?:/iu.test(e)?e:`https://github.com/${e}`;return c`<dl class="packages-detail-meta"><dt>Repository</dt><dd class="mono"><a href="${s}" target="_blank" rel="noopener">${vt(e)}</a></dd><dt>Findings</dt><dd>${t.findings.length}</dd><dt>Files</dt><dd>${t.files.size}</dd><dt>Reports</dt><dd>${t.reports.size}</dd></dl>${n.length>0?c`<div class="packages-detail-chips">${n.map(l=>c`<span class="${`tree-count-chip ${l}`}">${r[l]} ${l.replaceAll("_"," ")}</span>`)}</div>`:g}<h3 class="packages-detail-section">Reports</h3><ul class="packages-detail-reports">${i.map(l=>{let d=oe[ot(l)]??oe.default;return c`<li><button type="button" class="packages-detail-report" title="${l}" data-package-report="${l}">${me(d)}<span class="packages-detail-report-label">${Ue(l)}</span></button></li>`})}</ul><h3 class="packages-detail-section">Files</h3><ul class="packages-detail-files">${o.map(([l,d])=>c`<li class="packages-detail-file"><span class="packages-detail-file-path mono" title="${l}">${l}</span> <span class="packages-detail-file-count">${d.length}</span></li>`)}</ul>`}var kp=class extends I{static styles=[...I.styles,B(Ce)];static properties={workspaceId:{type:String},items:{type:Array},_uploading:{state:!0},_errors:{state:!0},_done:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.items=[],this._uploading=!1,this._errors=[],this._done=!1,this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="upload"]')?.focus()}_onClose=()=>this._finish({uploaded:[],failed:[]});_onCancel=()=>this._finish({uploaded:[],failed:[]});_onUpload=async()=>{if(this._uploading)return;this._uploading=!0,this._errors=[];let t=[],r=[];for(let n of this.items)try{let o;if(n.kind==="bundle")o=await Am(this.workspaceId,n.identifier);else{let i=await tn(n.identifier);o=await Ba(this.workspaceId,n.identifier,i)}if(o.ok)t.push({kind:n.kind,identifier:n.identifier});else{let i=o.reason??"unknown";r.push({kind:n.kind,identifier:n.identifier,reason:i}),this._errors=[...this._errors,{label:at(n),reason:i}]}}catch(o){let i=o?.message??String(o);r.push({kind:n.kind,identifier:n.identifier,reason:i}),this._errors=[...this._errors,{label:at(n),reason:i}]}this._uploading=!1,this._done=!0,r.length===0&&this._finish({uploaded:t,failed:r})};_errorsSection(){return this._errors.length===0?g:c`<ul class="lwd-list" role="alert">${this._errors.map(t=>c`<li><strong>${t.label}</strong> — ${t.reason}</li>`)}</ul>`}render(){let t=this.items.length,r=t===1,n=this.items.filter(u=>u.kind==="report").length,o=t-n,i="items";o===0?i=r?"report":"reports":n===0&&(i=r?"bundle":"bundles");let s=r?c`Upload <strong>"${at(this.items[0])}"</strong> to the workspace's remote inventory?`:c`Upload <strong>${t}</strong> local ${i} to the workspace's remote inventory?`,l=r?g:c`<ul class="lwd-list">${this.items.map(u=>c`<li>${at(u)}${u.kind==="bundle"?c`<span class="lwd-kind-tag">bundle</span>`:g}</li>`)}</ul>`,d=this._uploading?r?"Uploading\u2026":`Uploading ${t} ${i}\u2026`:r?"Upload":`Upload ${t}`;return c`<dialog @close="${this._onClose}"><header><h3>Upload to remote</h3></header><p class="lwd-body">${s}</p>${l}<p class="nwd-note">End-to-end encrypted with the workspace key — only workspace members can decrypt the uploaded content.</p>${this._errorsSection()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._uploading}">${this._done&&this._errors.length>0?"Close":"Cancel"}</button> ${this._done&&this._errors.length>0?g:c`<button type="button" data-role="upload" @click="${this._onUpload}" ?disabled="${this._uploading||t===0}">${d}</button>`}</footer></dialog>`}};customElements.define("sync-upload-dialog",kp);function Rv({workspaceId:e,items:t}={}){return ee("sync-upload-dialog",{workspaceId:e??"",items:Array.isArray(t)?[...t]:[]})}var Iv=`.rec-list{margin:.2rem 0 .55rem;padding:0;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:var(--ok, #16a34a)}.rec-status-reuploaded{color:var(--accent, #2563eb)}.rec-status-failed,.rec-status-check-failed{color:var(--warning, #d97706)}.rec-status-missing{color:var(--critical, #dc2626)}.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, #f87171);font-size:.76rem;line-height:1.4}
106
- `;var BC={checking:"checking\u2026",good:"available",reuploaded:"re-uploaded",failed:"re-upload failed","check-failed":"check failed",missing:"missing"},$p=class extends I{static styles=[...I.styles,B(Ce),B(Iv)];static properties={workspaceId:{type:String},cloudCount:{type:Number},localFileNames:{type:Array},localBundles:{type:Array},_rows:{state:!0},_running:{state:!0},_ran:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.cloudCount=0,this.localFileNames=[],this.localBundles=[],this._rows=[],this._running=!1,this._ran=!1,this._error=null,this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="recheck"]')?.focus()}_result(){return{items:this._rows,counts:this._counts()}}_onClose=()=>this._finish(this._ran?this._result():null);_onCancel=()=>this._finish(this._ran?this._result():null);_counts(){let t={good:0,reuploaded:0,failed:0,"check-failed":0,missing:0};for(let r of this._rows)r.status in t&&(t[r.status]+=1);return t}_onRecheck=async()=>{if(!this._running){this._running=!0,this._error=null,this._rows=[];try{let{items:t}=await Tm(this.workspaceId,{onList:r=>{this._rows=r},onItem:r=>{this._rows=this._rows.map(n=>n.resourceTag===r.resourceTag?r:n)}});this._rows=t}catch(t){this._error=t?.message??String(t)}finally{this._running=!1,this._ran=!0}}};_downloadableItems(){let t=new Set(this.localFileNames),r=new Set(this.localBundles),n=[];for(let o of this._rows)o.status!=="good"||!o.identifier||(o.kind==="report"&&!t.has(o.identifier)?n.push({kind:"report",identifier:o.identifier}):o.kind==="bundle"&&!r.has(o.identifier)&&n.push({kind:"bundle",identifier:o.identifier,label:o.label}));return n}_onDownload=async()=>{let t=this._downloadableItems();t.length!==0&&await pl({workspaceId:this.workspaceId,items:t})};_rowsSection(){return this._rows.length===0?this._running?c`<p class="lwd-body">Fetching remote listing…</p>`:g:c`<ul class="rec-list">${this._rows.map(t=>c`<li class="rec-row"><span class="rec-label">${t.label}${t.kind==="bundle"?c`<span class="lwd-kind-tag">bundle</span>`:g}</span> <span class="${`rec-status rec-status-${t.status}`}" title="${t.detail??g}">${BC[t.status]??t.status}</span></li>`)}</ul>`}_summarySection(){if(!this._ran||this._rows.length===0)return g;let t=this._counts(),r=[];return t.good&&r.push(`${t.good} available`),t.reuploaded&&r.push(`${t.reuploaded} re-uploaded`),t.failed&&r.push(`${t.failed} failed`),t["check-failed"]&&r.push(`${t["check-failed"]} check failed`),t.missing&&r.push(`${t.missing} missing`),r.length>0?c`<p class="rec-summary" role="status" aria-live="polite">${r.join(" \xB7 ")}</p>`:g}render(){let t=this.cloudCount===1?"":"s",r=this._ran?g:c`<p class="lwd-body">Re-check ${this.cloudCount>0?c`the <strong>${this.cloudCount}</strong>`:g}remote object${t} for this workspace. Each is re-fetched from the relay; any whose bytes are missing are re-uploaded from a matching local copy.</p>`,n=this._ran&&this._rows.length===0&&!this._error?c`<p class="lwd-empty">No remote objects to check.</p>`:g,o=this._ran?this._downloadableItems().length:0;return c`<dialog @close="${this._onClose}"><header><h3>Re-check cloud storage</h3></header>${r} ${this._rowsSection()} ${n} ${this._summarySection()} ${this._error?c`<p class="rec-error" role="alert">${this._error}</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> ${o>0?c`<button type="button" data-role="download" @click="${this._onDownload}" ?disabled="${this._running}">Download ${o} not stored locally</button>`:g} <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._running?"Re-checking\u2026":this._ran?"Re-check again":"Re-check"}</button></footer></dialog>`}};customElements.define("objstore-recovery-dialog",$p);function Mv({workspaceId:e,cloudCount:t,localFileNames:r,localBundles:n}={}){return ee("objstore-recovery-dialog",{workspaceId:e??"",cloudCount:typeof t=="number"?t:0,localFileNames:Array.isArray(r)?[...r]:[],localBundles:Array.isArray(n)?[...n]:[]})}function _p(){let e=Yu(a.reports);if(!e)return null;let t=Object.keys(e),n=st().filter(p=>pe(p).commonTriage===a.shownTriage),o=qu(n,a.severityMode),i=dl(e,o),s=new Map,l=new Map,d=new Map;for(let p of n)for(let f of p){let h=ne(f,a.severityMode);s.has(f.file)||s.set(f.file,new Set),s.get(f.file).add(h);let m=a.triage.get(O(f))?.color??"none";l.has(f.file)||l.set(f.file,new Set),l.get(f.file).add(m),d.has(f.file)||d.set(f.file,[]),d.get(f.file).push({severity:h,color:m})}let u;return A.focusedPkg?(u=t.filter(p=>(Ey(p)??"__own__")===A.focusedPkg),A.showAll||(u=u.filter(p=>Xu(p,o,i)))):u=A.showAll?t:t.filter(p=>Xu(p,o,i)),{prep:{treeData:e,files:u,ownCounts:o,transitiveCounts:i,severitySets:s,colorSets:l,fileFindings:d},findingCounts:o}}function Cp(){let e=uo();if(!e)return;let t=_p();t&&e.refreshSidebar(t.prep,{isBundleContext:a.currentView==="bundles"})}function Ep(){let e=uo();if(!e)return;let t=_p();t&&e.refreshTopPkgs(t.prep)}var LC={"claude-security":"Claude Security findings","codex-security":"Codex Security findings",deepsec:"DeepSec findings",piolium:"Piolium findings"};function PC(e,t,r){return r?c`<repo-chip url="${r}"></repo-chip>`:a.currentWorkspace?t?c`<repo-chip url="${t}"></repo-chip>`:g:e?c`<repo-chip url="${a.repoUrl}" editable ?editing="${a.repoEditing}" ?empty="${!a.repoUrl}"></repo-chip>`:t?c`<repo-chip url="${t}"></repo-chip>`:g}function OC(e,t,r,n,o){let i=e.length,s=new Set(a.reports.map(te=>te.source)),l=s.size===1?[...s][0]:null,d=a.currentWorkspace?K().find(te=>te.id===a.currentWorkspace):null,u=d?`Workspace: ${d.name}`:l?LC[l]:"Findings",p=l&&oe[l]?l:"default",f=me(oe[p]),h=c`<svg class="file-icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"/><path d="M14 3v6h6"/></svg>`,m=g;t.length===1?m=c`<span class="file-chip" data-copy-report="${t[0]}" title="Copy report name">${f}<span>${t[0]}</span></span>`:t.length>1&&(m=c`<span class="file-chip" data-copy-report="${t.join(`
107
- `)}" title="Copy report names">${h}<span>${t.length} reports</span></span>`);let b=a.reports.flatMap(te=>te.groups.flat()),y=`${i} ${`finding${i===1?"":"s"}`}`,k=l||a.currentWorkspace?el.filter(te=>te!=="type"):el,_=Yb(b,k),R=g;if(i>0){let te={};for(let ge of e){let Ve=ne(bn(ge),a.severityMode);Ve&&(te[Ve]=(te[Ve]||0)+1)}let lt=_e.filter(ge=>te[ge]>0);lt.length>0&&(R=c`<span class="status-bar" aria-hidden="true">${lt.map(ge=>{let Ve=`${te[ge]} ${ge.replaceAll("_"," ")}`;return c`<span class="${`status-seg sev-${ge}`}" style="${ae({flexGrow:te[ge]})}" title="${Ve}"></span>`})}</span>`)}let C=new Set(a.reports.map(te=>te.repo??null)),M=C.size===1?[...C][0]:null,z=PC(r,n,M),F=c`<span class="sep" aria-hidden="true"></span>`,H=a.currentView==="files",he=(o??0)>1?c`<button type="button" class="${T({"files-toggle-btn":!0,active:H})}" data-action="toggle-files" title="${H?"exit files view":"show files"}" aria-pressed="${String(H)}">${`Files: ${o}`}</button>`:g;return c`<header class="page-head"><div class="page-title"><h1>${u}${m}${z}${he}${NC()}</h1><div class="meta-row"><span>${y}</span> ${R} ${_.length>0?c`${F}${_.map(te=>c`<span class="tag">${te}</span>`)}`:g}</div></div></header>`}function NC(){if(D.status!=="online")return g;if(a.currentView!=="findings"&&a.currentView!=="files")return g;let e=zC();if(!e)return g;let{workspaceId:t,fileNames:r,mode:n}=e;if(n==="single"){let y=r[0],w=iu(t,y)?"cloud":"local";return DC({status:w,label:w,title:w==="cloud"?"Synced to remote":"Local only \u2014 click to upload",onClick:w==="local"?()=>Fv({workspaceId:t,items:[{kind:"report",identifier:y}]}):null})}let o=K().find(y=>y.id===t),i=o&&Array.isArray(o.bundles)?o.bundles:[],s=vm(t),l=r.filter(y=>!iu(t,y)),d=i.filter(y=>!bm(t,y)),u=[...l.map(y=>({kind:"report",identifier:y})),...d.map(y=>({kind:"bundle",identifier:y}))];if(s===0&&u.length===0)return g;let p=s>0,f=u.length>0,h=[s>0?`${s} in cloud`:null,u.length>0?`${u.length} local-only`:null,s>0?'click "cloud" to re-check storage':null,u.length>0?`click "local" to upload ${u.length}`:null].filter(Boolean).join(" \u2014 "),m=s===0?g:c`<button type="button" class="sync-badge-chunk cloud" aria-label="${`re-check ${s} cloud object${s===1?"":"s"}`}" @click="${y=>{y.stopPropagation(),Mv({workspaceId:t,cloudCount:s,localFileNames:r,localBundles:i})}}">${Dv()}<span>${s} cloud</span></button>`,b=u.length===0?g:c`<button type="button" class="sync-badge-chunk local" aria-label="${`${u.length} items not yet uploaded \u2014 open upload dialog`}" @click="${y=>{y.stopPropagation(),Fv({workspaceId:t,items:u})}}">${Nv()}<span>${u.length} local</span></button>`,v=s>0&&u.length>0?c`<span class="sync-badge-divider" aria-hidden="true"></span>`:g;return c`<div class="${`report-sync-badge${p||f?" report-sync-badge-clickable":""}`}" data-status="mixed" title="${h}">${m}${v}${b}</div>`}function DC({status:e,label:t,title:r,onClick:n}){let o=e==="cloud"?Dv():Nv(),i=c`<span class="sync-badge-label">${t}</span>`;return typeof n!="function"?c`<span class="report-sync-badge" data-status="${e}" title="${r}" aria-label="${`report sync status: ${t}`}">${o}${i}</span>`:c`<button type="button" class="report-sync-badge report-sync-badge-clickable" data-status="${e}" title="${r}" aria-label="${`report sync status: ${t}`}" @click="${n}">${o}${i}</button>`}function Nv(){return c`<svg class="sync-badge-icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="14" width="20" height="8" rx="2" ry="2"/><line x1="6" y1="18" x2="6.01" y2="18"/><line x1="10" y1="18" x2="10.01" y2="18"/><path d="M6 14V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v10"/></svg>`}function Dv(){return c`<svg class="sync-badge-icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17.5 19a4.5 4.5 0 1 0-1-8.9A6 6 0 0 0 5.07 13.5 4 4 0 0 0 6 21h11.5z"/></svg>`}async function Fv({workspaceId:e,items:t}){let r=t.filter(n=>n.kind==="bundle");if(r.length>0){let n=await xt(),o=new Map(n.map(i=>[i.integrity,i.name]));for(let i of r){let s=o.get(i.identifier);s&&(i.label=s)}}await Rv({workspaceId:e,items:t})}function zC(){if(a.currentWorkspace)return{mode:"workspace",workspaceId:a.currentWorkspace,fileNames:a.reports.map(e=>e.fileName).filter(e=>typeof e=="string")};if(a.currentFile){let e=K().find(t=>Array.isArray(t.reports)&&t.reports.includes(a.currentFile));return e?{mode:"single",workspaceId:e.id,fileNames:[a.currentFile]}:null}return null}function UC(e){return Object.values(e).some(r=>r>0)||a.filterSeverities.size>0?c`<severity-chips .counts="${e}"></severity-chips>`:g}function HC(e){return Object.values(e).some(r=>r>0)||a.filterColors.size>0?c`<triage-filter .counts="${e}"></triage-filter>`:g}function VC(e,t,r,n,o,i,s,l){let{showSource:d,showConfidence:u,showPriority:p,showGraphMode:f,showFileSort:h,kanbanMode:m,showRepo:b,hasComment:v,hasFix:y,hasFlagged:w,showSeverityMode:k,revalidateOptions:_,hasPartialKind:R,hasAnyRevalidate:C}=i;return c`<div class="toolbar"><div class="toolbar-row"><view-mode-buttons modes="${f?"kanban,focus,table,list,grouped,graph":"kanban,focus,table,list,grouped"}"></view-mode-buttons><findings-sort ?show-file="${h}" ?show-confidence="${u}" ?show-priority="${p}"></findings-sort>${d?c`<source-filter></source-filter>`:g} ${v||y||w||a.filterComment||a.filterFix||a.filterFlagged?c`<annotation-filter .hasComment="${v}" .hasFix="${y}" .hasFlagged="${w}"></annotation-filter>`:g} ${u||_.length>0?c`<conf-filter ?range-disabled="${!u}" .revalidateOptions="${_}" ?has-partial="${R}"></conf-filter>`:g} ${m?g:c`<triage-selector .counts="${r}"></triage-selector>`} ${C?c`<revalidation-switch></revalidation-switch>`:g}</div><div class="toolbar-row sev-row">${k?c`<severity-mode-switch></severity-mode-switch>`:g} ${UC(n)} ${s.analyzers.length>1||s.models.length>1?c`<analyzer-select .analyzers="${s.analyzers}" .models="${s.models}" .groups="${s.groups}"></analyzer-select>`:g} ${b&&l.length>1?c`<repo-filter .options="${l}"></repo-filter>`:g} ${HC(o)}<div class="search-row"><toolbar-search kind="findings"></toolbar-search><span class="result-count">${e} of ${t}</span></div></div></div>`}function xp(e,t){return e.map(r=>({p:bn(r),g:r})).toSorted((r,n)=>t(r.p,n.p)).map(r=>r.g)}var Bv=(e,t)=>e.file.localeCompare(t.file)||parseInt(e.line,10)-parseInt(t.line,10),$l=null,Lv=0,vo=null,xl=new Map;function ns(e,t=!1,r=null){let n=yo(e);return xl.set(n,{group:e,inGroup:t}),t?r?c`<finding-card data-gid="${n}" in-group context="${r}"></finding-card>`:c`<finding-card data-gid="${n}" in-group></finding-card>`:r?c`<finding-card data-gid="${n}" context="${r}"></finding-card>`:c`<finding-card data-gid="${n}"></finding-card>`}var zv=c`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 2H2v4M10 2h4v4M14 10v4h-4M6 14H2v-4"/></svg>`,Uv=c`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 2v4H2M10 2v4h4M10 14v-4h4M6 14v-4H2"/></svg>`,Ap=c`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 3 5 8l5 5"/></svg>`,Tp=c`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 3 11 8l-5 5"/></svg>`,jC={critical:"C",high:"H",medium:"M",low:"L",high_bug:"H",bug:"B",informational:"i"};function Sp(e,t={}){let{variant:r="kanban",active:n=!1}=t,o=pe(e),i=He(e),s=Bi(i)||"(untitled finding)",l=r==="kanban",d=r==="kanban-side",u={"kanban-card":!0,"has-conflict":o.hasConflict,"focus-side-card":!l,active:n};!o.hasConflict&&o.commonColor&&(u[`mark-${o.commonColor}`]=!0);let p=parseInt(i.line,10),f=Number.isFinite(p)?`:${p}`:"",h=ne(i,a.severityMode),m=jC[h]??"?",b=nr(i)&&a.severityMode!=="original",v=a.triage.get(O(i)),y=v?.flagged===!0,w=v?.fix??"",k=v?.comment??"",_=g;l&&w?_=_t(w)?c`<a class="kanban-action kanban-fix-link" href="${w}" target="_blank" rel="noopener noreferrer" draggable="false" title="${`Open fix link: ${w}`}" aria-label="${`Open fix link: ${w}`}">${es}</a>`:c`<button type="button" class="kanban-action mark-fix" title="${`Edit fix link: ${w}`}" aria-label="${`Edit fix link: ${w}`}">${es}</button>`:l&&k&&(_=c`<button type="button" class="kanban-action mark-comment" title="${`Edit comment: ${k}`}" aria-label="${`Edit comment: ${k}`}">${wl}</button>`);let R=c`<div class="kanban-badge-col"><span class="${`kanban-badge sev-${h}`}" title="${b?`${Ge(h)} \u2014 corrected from ${Ge(i.severity)}`:Ge(h)}" aria-label="${b?`Severity ${Ge(h)}, corrected from ${Ge(i.severity)}`:`Severity ${Ge(h)}`}">${m}${b?"*":""}</span> ${y?c`<span class="kanban-flag" title="Flagged" aria-label="Flagged">${kl}</span>`:g} ${_}</div><span class="kanban-title">${s}</span><div class="kanban-meta"><span class="kanban-loc">${i.file}${f}</span> ${i.confidence===void 0||i.confidence===null?g:c`<span class="kanban-conf" title="${`Confidence ${i.confidence}/10`}">${i.confidence}</span>`}</div>`;return l?c`<div class="${T(u)}" data-gid="${de(e)}" data-kanban-source draggable="true" role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Open details for ${s}`}">${R}</div>`:d?c`<div class="${T(u)}" data-gid="${de(e)}" data-kanban-select role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Show details for ${s}`}">${R}</div>`:c`<div class="${T(u)}" data-gid="${de(e)}" data-focus-select role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Focus on ${s}`}">${R}</div>`}function WC(e){let{content:t,range:r,highlighted:n}=e,o=t.split(`
108
- `).length,i=String(o).length;return c`<div class="focus-code-lines" style="${ae({"--lineno-width":`${i}ch`})}"><aside class="focus-code-gutter" aria-hidden="true">${Array.from({length:o},(s,l)=>{let d=l+1,p={"focus-code-lineno":!0,"focus-code-line-active":!!r&&d>=r.start&&d<=r.end};return c`<div class="${T(p)}" data-focus-code-line="${d}">${d}</div>`})}</aside><pre class="focus-code-source"><code>${typeof n=="string"?me(n):t}</code></pre></div>`}function Hv(e,t=g){a.focusCodeTick;let r=pv(e),n=Ji(e),o=r?"focus-main with-code":"focus-main",i=ae({"--focus-split":String(a.focusSplit)});return c`<div class="${o}" style="${i}"><div class="focus-pane focus-pane-card"><div class="focus-card-wrapper">${ns(e,!1,"focus")}</div></div>${t} ${r?c`<div class="focus-splitter" data-focus-splitter role="separator" tabindex="0" aria-orientation="vertical" aria-label="Resize the finding and code panes" aria-valuemin="${na}" aria-valuemax="${oa}" aria-valuenow="${Math.round(a.focusSplit)}" title="Drag to resize · double-click to reset"></div><div class="focus-pane focus-pane-code">${r.loading?c`<div class="focus-code-empty">Loading source…</div>`:c`<header class="focus-code-bar" title="${r.file}"><span class="focus-code-file">${r.file}</span> ${r.range?c`<span class="focus-code-line">:${Eb(r.range)}</span>`:g} ${(n?.stack.length??0)>1?c`<div class="focus-code-nav"><button type="button" class="focus-code-nav-btn" data-code-history="back" ?disabled="${n.at===0}" aria-label="Back to the previously shown file">${Ap}</button> <button type="button" class="focus-code-nav-btn" data-code-history="forward" ?disabled="${n.at===n.stack.length-1}" aria-label="Forward to the next shown file">${Tp}</button></div>`:g}</header><div class="focus-code-body">${WC(r)}</div>`}</div>`:g}</div>`}function KC(e,t,r=[]){if(!e)return g;let n=pe(e),o=a.kanbanDetailFullscreen,i={"kanban-detail-modal":!0,fullscreen:o,"has-conflict":n.hasConflict};!n.hasConflict&&n.commonColor&&(i[`mark-${n.commonColor}`]=!0);let s=de(e),l=t?.items??[],d=l.findIndex(p=>de(p)===s),u=c`<div class="kanban-detail-actions"><button type="button" class="kanban-detail-expand" data-kanban-detail-fullscreen aria-pressed="${o?"true":"false"}" aria-label="${o?"Back to the readable width":"Fill the available space"}">${o?Uv:zv}</button> <button type="button" class="kanban-detail-close" aria-label="Close details">×</button></div>`;return c`<div class="kanban-detail-backdrop"><div class="kanban-detail-dim"></div><div class="${T(i)}" role="dialog" aria-modal="true">${o?g:u}<div class="kanban-detail-body">${o?Hv(e,u):ns(e,!1,"kanban-detail")}</div></div>${l.length===0?g:c`<aside class="kanban-detail-side" aria-label="${`${t.label} findings`}"><div class="kanban-detail-side-header"><span class="kanban-detail-side-pick"><select class="kanban-detail-side-select" data-kanban-column aria-label="Column to show">${r.map(p=>{let f=p.key===t.key,h=f?p.label:`${p.label} (${p.count})`;return c`<option value="${p.key}" data-gid="${p.firstGid}" .selected="${f}" ?disabled="${p.count===0}">${h}</option>`})}</select></span><div class="focus-nav"><button type="button" class="focus-nav-btn" data-kanban-nav="prev" ?disabled="${d===0}" aria-label="Previous finding">${Ap}</button> <span class="count">${d<0?l.length:`${d+1} / ${l.length}`}</span> <button type="button" class="focus-nav-btn" data-kanban-nav="next" ?disabled="${d===l.length-1}" aria-label="Next finding">${Tp}</button></div></div><div class="kanban-detail-side-body">${X(l,p=>de(p),p=>Sp(p,{variant:"kanban-side",active:de(p)===s}))}</div></aside>`}</div>`}function GC(e){if(a.viewMode==="table"){let r=a.sortBy==="file"?xp(e,Bv):e;if(r.length===0)return g;let n=a.tableSelectedGid?r.find(i=>de(i)===a.tableSelectedGid):null;return $l=r,c`<div class="${n?"findings-table-layout open":"findings-table-layout"}"><div class="findings-table-list"><div class="finding-table-slot"></div></div>${n?c`<aside class="findings-table-details" id="findings-table-details"><header class="findings-table-details-bar"><span class="findings-table-details-label">Details</span> <button type="button" class="findings-table-details-close" data-table-deselect title="Close details" aria-label="Close details">×</button></header><div class="findings-table-details-body">${ns(n)}</div></aside>`:g}</div>`}if(a.viewMode==="focus"){if(e.length===0)return g;let r=a.focusGid?e.findIndex(s=>de(s)===a.focusGid):-1;r<0&&(r=Math.min(Lv,e.length-1),r<0&&(r=0)),Lv=r;let n=e[r],o=r===0,i=r===e.length-1;return c`<div class="focus-view">${Hv(n)}<aside class="focus-sidebar" aria-label="Up next"><div class="focus-sidebar-header"><span class="label">Up next</span><div class="focus-nav"><button type="button" class="focus-nav-btn" data-focus-nav="prev" ?disabled="${o}" title="Previous finding (←)" aria-label="Previous finding">${Ap}</button> <span class="count">${r+1} / ${e.length}</span> <button type="button" class="focus-nav-btn" data-focus-nav="next" ?disabled="${i}" title="Next finding (→)" aria-label="Next finding">${Tp}</button></div></div><div class="focus-sidebar-body">${X(e,s=>de(s),s=>Sp(s,{variant:"focus",active:de(s)===de(n)}))}</div></aside></div>`}if(a.viewMode==="kanban"){let r=[{key:"untriaged",label:"Untriaged",target:"untriaged"},{key:"inprogress",label:"In progress",target:"inprogress"},{key:"fixed",label:"Fixed",target:"fixed"},{key:"invalid",label:"Invalid",target:"invalid"},{key:"deleted",label:"Deleted",target:"deleted"},{key:"ignored",label:"Ignored",target:"ignored"}],n=new Map(r.map(u=>[u.key,[]]));for(let u of e){let f=pe(u).commonTriage??"untriaged",h=n.get(f);h&&h.push(u)}let o=r.some(u=>u.key===a.kanbanExpandedColumn)?a.kanbanExpandedColumn:null,i=o?r.filter(u=>u.key===o):r,s={"--kanban-cols":String(r.length)},l=a.kanbanPopoverGid?e.find(u=>de(u)===a.kanbanPopoverGid):null,d=l?r.find(u=>u.key===(pe(l).commonTriage??"untriaged")):null;return c`<div class="kanban-board" style="${ae(s)}">${X(i,u=>u.key,u=>{let p=n.get(u.key),f=u.key===o;return c`<div class="${`kanban-column kanban-column-${u.key}${f?" expanded":""}`}" data-kanban-target="${u.target}"><div class="kanban-column-header"><span class="label">${u.label}</span> <span class="count">${p.length}</span> <button type="button" class="kanban-expand" data-kanban-expand="${u.key}" aria-pressed="${f}" title="${f?"Show all columns":`Show only ${u.label}`}" aria-label="${f?"Show all columns":`Show only ${u.label}`}">${f?Uv:zv}</button></div><div class="kanban-column-body">${p.length===0?c`<div class="kanban-empty">No ${u.label.toLowerCase()} findings.</div>`:X(p,h=>de(h),h=>Sp(h,{active:de(h)===a.kanbanPopoverGid}))}</div></div>`})}</div>${KC(l,d&&{key:d.key,label:d.label,items:n.get(d.key)},r.map(u=>{let p=n.get(u.key);return{key:u.key,label:u.label,count:p.length,firstGid:p.length>0?de(p[0]):""}}))}`}if(a.viewMode==="grouped"){let r=new Map;for(let o of e){let i=bn(o).file;r.has(i)||r.set(i,[]),r.get(i).push(o)}let n=a.sortBy==="file"?[...r.keys()].toSorted():[...r.keys()];return c`${X(n,o=>o,o=>{let i=a.sortBy==="file"?xp(r.get(o),(l,d)=>parseInt(l.line,10)-parseInt(d.line,10)):r.get(o),s=bn(i[0]);return c`<div class="file-group"><div class="file-header"><span>${Cu(s,Ut(s))}</span> <span class="count">${i.length}</span></div><div class="file-body">${X(i,l=>yo(l),l=>ns(l))}</div></div>`})}`}let t=a.sortBy==="file"?xp(e,Bv):e;return c`${X(t,r=>yo(r),r=>{let n=He(r),o=Mb(n,Ut(n)),i=gn(n),s=hn(n),l=r.length>1;return c`<div class="${T({"flat-group":!0,"multi-case":l})}"><div class="flat-group-loc"><span class="file">${Cu(n,Ut(n))}</span> ${o===g?g:c`<span class="line-num">${o}</span>`} ${s?c`<span class="meta">${s}</span>`:g} ${i?c`<span class="run-meta">${i}</span>`:g}</div>${ns(r,!0)}</div>`})}`}function qC(){let e=document.querySelector("#bundle-source-overlay-slot");e&&Y(iv(),e)}var Pv=null;function x(){let e=Pv;if(Pv=a.currentView,e!==null&&e!==a.currentView&&typeof document.startViewTransition=="function"&&!matchMedia("(prefers-reduced-motion: reduce)").matches){document.startViewTransition(()=>Ov());return}Ov()}function Ov(){if(qC(),yb(a.reports),Ha(a.showRevalidation),a.currentView==="bundles")if((a.bundles??[]).length===0)a.currentView="findings";else{let $=document.querySelector("#bundles-slot");if((!$||!S.contains($)||S.firstElementChild!==$)&&(S.innerHTML='<div id="bundles-slot"></div>',$=document.querySelector("#bundles-slot")),$&&Y(lv(a.bundles),$),a.selectedBundle&&a.bundleDetailsTab==="graph"&&a.bundleDetails&&(a.bundleDetails.json||a.bundleDetails.bundle)){let L=document.querySelector("#bundle-graph-slot");if(L){let ye=nv(a.bundleDetails);if(ye){ov(ye);let hs={hideAllFiles:!0,triageCounts:rv(a.bundleDetails),triageStates:["inprogress","fixed","invalid","deleted"],showSplitOwnDirs:ye.canSplitOwnDirs,showPackagesView:ye.canPackagesView};Qu(L,ye,hs,gl,ml)}}}if(a.selectedBundle&&a.bundleDetailsTab==="terminal"&&a.bundleDetails&&(a.bundleDetails.json||a.bundleDetails.bundle)){let L=document.querySelector("#bundle-terminal-slot");L&&Sv(L,a.bundleDetails)}S.classList.add("active"),we.classList.add("hidden"),document.title="DeepView \u2014 bundles";return}if(a.currentView==="packages"){let $=document.querySelector("#packages-slot");(!$||!S.contains($)||S.firstElementChild!==$)&&(S.innerHTML='<div id="packages-slot"></div>',$=document.querySelector("#packages-slot")),$&&Y(_v(),$),S.classList.add("active"),we.classList.add("hidden"),document.title="DeepView \u2014 packages";return}if(a.currentView==="repositories"){let $=document.querySelector("#repositories-slot");(!$||!S.contains($)||S.firstElementChild!==$)&&(S.innerHTML='<div id="repositories-slot"></div>',$=document.querySelector("#repositories-slot")),$&&Y(Av(),$),S.classList.add("active"),we.classList.add("hidden"),document.title="DeepView \u2014 repositories";return}if(a.currentView==="admin-users"){let $=document.querySelector("#admin-users-slot");(!$||!S.contains($)||S.firstElementChild!==$)&&(S.innerHTML='<div id="admin-users-slot"></div>',$=document.querySelector("#admin-users-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-users")),S.classList.add("active"),we.classList.add("hidden"),document.title="DeepView \u2014 users";return}if(a.currentView==="manage-repos"){let $=document.querySelector("#manage-repos-slot");(!$||!S.contains($)||S.firstElementChild!==$)&&(S.innerHTML='<div id="manage-repos-slot"></div>',$=document.querySelector("#manage-repos-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-repos")),S.classList.add("active"),we.classList.add("hidden"),document.title="DeepView \u2014 repositories";return}if(a.currentView==="manage-reports"){let $=document.querySelector("#manage-reports-slot");(!$||!S.contains($)||S.firstElementChild!==$)&&(S.innerHTML='<div id="manage-reports-slot"></div>',$=document.querySelector("#manage-reports-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-reports")),S.classList.add("active"),we.classList.add("hidden"),document.title="DeepView \u2014 reports";return}if(a.currentView==="manage-bundles"){let $=document.querySelector("#manage-bundles-slot");(!$||!S.contains($)||S.firstElementChild!==$)&&(S.innerHTML='<div id="manage-bundles-slot"></div>',$=document.querySelector("#manage-bundles-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-bundles")),S.classList.add("active"),we.classList.add("hidden"),document.title="DeepView \u2014 bundles";return}if(a.currentView==="manage-teams"){let $=document.querySelector("#manage-teams-slot");(!$||!S.contains($)||S.firstElementChild!==$)&&(S.innerHTML='<div id="manage-teams-slot"></div>',$=document.querySelector("#manage-teams-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-teams")),S.classList.add("active"),we.classList.add("hidden"),document.title="DeepView \u2014 teams";return}if(a.reports.length===0)return;let e=st(),t=a.viewMode==="kanban",r={inprogress:0,fixed:0,invalid:0,deleted:0,ignored:0},n=[];for(let $ of e){let L=pe($).commonTriage;L&&r[L]++,(t||L===a.shownTriage)&&n.push($)}let o=!1,i=!1,s=!1,l=!1,d=new Set;for(let $ of e)for(let L of $){nr(L)&&(l=!0);let ye=gt(L);ye&&d.add(ye);let ve=a.triage.get(O(L));ve&&(ve.comment&&(o=!0),ve.fix&&(i=!0),ve.flagged===!0&&(s=!0))}let p=[...new Set(a.reports.map($=>$.type))].join(", "),f=a.reports.map($=>$.fileName),h={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},m={red:0,blue:0,green:0,gray:0,none:0};for(let $ of n){if($.length===1){let ve=$[0],hs=ne(ve,a.severityMode);h[hs]=(h[hs]||0)+1;let eh=a.triage.get(O(ve))?.color??"none";m[eh]=(m[eh]||0)+1;continue}let L=new Set($.map(ve=>ne(ve,a.severityMode)));for(let ve of L)h[ve]=(h[ve]||0)+1;let ye=new Set($.map(ve=>a.triage.get(O(ve))?.color??"none"));for(let ve of ye)m[ve]=(m[ve]||0)+1}let b=n.length>0&&n.every($=>$.every(L=>L.confidence!==void 0||L.critical===!0)),v=e.some($=>$.some(L=>L.priority!==void 0)),y=e.some($=>$.some(L=>Er(L.file))),w=!1,k=!1,_;e:for(let $ of e)for(let L of $)if(!k)k=!0,_=L.file;else if(L.file!==_){w=!0;break e}let R=e.some($=>$.some(L=>!L.repo?.github&&!Er(L.file))),C=new Set;for(let $ of e)for(let L of $)!Er(L.file)&&L.repo?.github&&C.add(L.repo.github);let M=C.size===1?[...C][0]:null,z=new Set,F=new Set;for(let $ of e)for(let L of $)z.add(L._analyzer??null),F.add(Pi(L));let H=Object.keys(Nu),he=[...z].toSorted(($,L)=>{let ye=$==null?1/0:H.indexOf($)===-1?H.length:H.indexOf($),ve=L==null?1/0:H.indexOf(L)===-1?H.length:H.indexOf(L);return ye!==ve?ye-ve:String($??"").localeCompare(String(L??""))}),te=[...F].toSorted(($,L)=>$==null&&L==null?0:$==null?1:L==null?-1:$.localeCompare(L));if(a.filterAnalyzer){let $=a.filterAnalyzer===Ar?null:a.filterAnalyzer;(!z.has($)||z.size<2)&&(a.filterAnalyzer="")}if(a.filterModel){let $=a.filterModel===Tr?null:a.filterModel;(!F.has($)||F.size<2)&&(a.filterModel="")}let lt=new Set;for(let $ of e)for(let L of $)lt.add(Ru(L));let ge=[...lt].toSorted(($,L)=>$==null&&L==null?0:$==null?1:L==null?-1:$.localeCompare(L));if(a.filterRepo){let $=a.filterRepo===mn?null:a.filterRepo;lt.has($)||(a.filterRepo="")}let Ve=a.reports.some($=>$.groups.some(L=>L.some(db))),Ur=fb(d);a.filterRevalidate&&!Ur.some($=>$.value===a.filterRevalidate)&&(a.filterRevalidate="");let So=d.has("partial");So||(a.filterPartial=""),!y&&a.filterSources.size>0&&a.filterSources.clear(),b||(a.filterConfMin=0,a.filterConfMax=10,(a.sortBy==="confidence-desc"||a.sortBy==="confidence-asc")&&(a.sortBy="severity")),!v&&(a.sortBy==="priority-desc"||a.sortBy==="priority-asc")&&(a.sortBy="severity"),!w&&a.sortBy==="file"&&(a.sortBy="severity");let ar=zb(Rr(n)),_o=Yu(a.reports),En=_o?Object.keys(_o).length:0,Hr=En>1;!Hr&&a.currentView==="files"&&(a.currentView="findings"),!Hr&&a.viewMode==="graph"&&(a.viewMode="kanban");let Vr=OC(e,f,R,M,En);if(a.currentView==="files"){let $=qu(e,a.severityMode),L=document.querySelector("#header-slot"),ye=document.querySelector("#tree-view-slot");(!L||!ye||!S.contains(L)||!S.contains(ye))&&(S.innerHTML='<div id="header-slot"></div><div id="tree-view-slot"></div>',L=document.querySelector("#header-slot"),ye=document.querySelector("#tree-view-slot")),L&&Y(Vr,L),ye&&Y(xv(_o,$),ye),S.classList.add("active"),we.classList.add("hidden"),document.title=`DeepView \u2014 ${p||"no analyzer"}`;return}let An=a.viewMode==="table"&&a.tableSelectedGid&&ar.some($=>de($)===a.tableSelectedGid),jt=null;a.viewMode==="graph"&&_o&&(jt=_p(),jt||(a.viewMode="kanban"));let Co=!!jt,Et="findings-content";An&&(Et+=" with-details"),Co&&(Et+=" with-graph"),t&&(Et+=" with-kanban"),a.viewMode==="focus"&&(Et+=" with-focus");let Tn=g,jr=g,E=g;$l=null,xl.clear(),Co||(Tn=VC(ar.length,n.length,r,h,m,{showSource:y,showConfidence:b,showPriority:v,showGraphMode:Hr,showFileSort:w,kanbanMode:t,showRepo:!!a.currentWorkspace,hasComment:o,revalidateOptions:Ur,hasPartialKind:So,hasAnyRevalidate:Ve,hasFix:i,hasFlagged:s,showSeverityMode:l||a.severityMode==="original"},{analyzers:he,models:te,groups:n},ge),a.shownTriage&&n.length===0?jr=c`<p style="color:var(--muted);margin:1rem 0">No ${a.shownTriage} findings.</p>`:ar.length===0&&n.length>0&&!t?jr=c`<p style="color:var(--muted);margin:1rem 0">No findings match the current filters.</p>`:n.length===0&&(jr=e.length>0?c`<p style="color:var(--green)">All ${p} issues triaged.</p>`:c`<p style="color:var(--green)">No ${p} issues found.</p>`),E=GC(ar));let P=document.querySelector("#header-slot"),V=S.querySelector(":scope > .findings-content"),Q=V&&V.querySelector(":scope > #findings-graph-slot"),be=V&&V.querySelector(":scope > #findings-body-slot"),Wr=V&&(Q?"graph":be?"body":null)===(Co?"graph":"body");if(!P||!V||!S.contains(P)||!S.contains(V)||!Wr){let $=Co?'<div id="findings-graph-slot"></div>':'<div id="toolbar-slot"></div><div id="empty-state-slot"></div><div id="findings-body-slot"></div>';S.innerHTML=`<div id="header-slot"></div><div class="${Et}">${$}</div>`,P=document.querySelector("#header-slot"),V=S.querySelector(":scope > .findings-content")}else V.className!==Et&&(V.className=Et);P&&Y(Vr,P);let Eo=document.querySelector("#toolbar-slot");Eo&&Y(Tn,Eo);let Kr=document.querySelector("#empty-state-slot");Kr&&Y(jr,Kr);let Zf=document.querySelector("#findings-body-slot");if(Zf&&Y(E,Zf),jt){let $=document.querySelector("#findings-graph-slot");if($){let ye={extraTopRow:c`<view-mode-buttons modes="kanban,focus,table,list,grouped,graph"></view-mode-buttons>`,triageCounts:r,triageStates:["inprogress","fixed","invalid","deleted","ignored"]};Qu($,jt.prep,ye,Cp,Ep)}}if($l){let $=S.querySelector(".finding-table-slot");$&&(vo||(vo=document.createElement("finding-table")),vo.items=$l,vo.selectedGid=a.tableSelectedGid,vo.parentNode!==$&&$.append(vo))}if(xl.size>0)for(let $ of S.querySelectorAll("finding-card")){let L=xl.get($.dataset.gid);L&&($.group=L.group)}S.classList.add("active"),we.classList.add("hidden"),document.title=`DeepView \u2014 ${p||"no analyzer"}`}var Rp=class extends I{static styles=[...I.styles,B(ft)];static properties={workspace:{attribute:!1},_password:{state:!0},_confirm:{state:!0},_noPassword:{state:!0},_includeBundleBytes:{state:!0},_busy:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspace=null,this._password="",this._confirm="",this._noPassword=!1,this._includeBundleBytes=!1,this._busy=!1,this._error="",this._settled=!1}_finish(t){this._settled||(this._password="",this._confirm="",this.workspace=null,super._finish(t))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_onPasswordInput=t=>{this._password=t.target.value,this._error=""};_onConfirmInput=t=>{this._confirm=t.target.value,this._error=""};_onNoPasswordToggle=t=>{this._noPassword=t.target.checked,this._error="",this._noPassword&&(this._password="",this._confirm="")};_onIncludeBundleBytesToggle=t=>{this._includeBundleBytes=t.target.checked,this._error=""};_canExport(){return this._busy?!1:this._noPassword?!0:(this._password??"").length>0&&this._password===this._confirm}_onExport=async()=>{if(this._canExport()){if(!this.workspace){this._error="No workspace selected.";return}this._busy=!0,this._error="";try{let{blob:t,filename:r}=await Xd(this.workspace,{password:this._noPassword?void 0:this._password,includeBundleBytes:this._includeBundleBytes});if(this._settled)return;qt(t,r),this._finish({ok:!0})}catch(t){if(this._settled)return;this._error=t?.message??String(t)}finally{this._busy=!1}}};_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onExport())};_body(){let t=!this._password||!this._confirm||this._password===this._confirm,r=Array.isArray(this.workspace?.bundles)?this.workspace.bundles.length:0;return c`<p class="nwd-note">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><label class="wsl-field"><span>Password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-export-pw" maxlength="1024" ?disabled="${this._noPassword}" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-field"><span>Confirm password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-export-pw-confirm" maxlength="1024" ?disabled="${this._noPassword}" .value="${this._confirm}" @input="${this._onConfirmInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-optout"><input type="checkbox" .checked="${this._noPassword}" @change="${this._onNoPasswordToggle}"> <span>Export without password (not recommended)</span></label> ${r>0?c`<label class="wsl-optout"><input type="checkbox" .checked="${this._includeBundleBytes}" @change="${this._onIncludeBundleBytesToggle}"> <span>Include bundle bytes (${r} bundle${r===1?"":"s"}; significantly larger file)</span></label>`:g} ${this._noPassword?c`<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>`:g} ${this._error?c`<p class="wsl-error" role="alert">${this._error}</p>`:g} ${!this._noPassword&&!t?c`<p class="wsl-error" role="alert">Passwords don't match.</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._canExport()}" @click="${this._onExport}">${this._busy?"Exporting\u2026":this._noPassword?"Export without password":"Export"}</button></footer>`}render(){return c`<dialog @close="${this._onClose}"><header><h3>Export workspace</h3></header>${this._body()}</dialog>`}};customElements.define("workspace-export-dialog",Rp);function Vv({workspace:e}={}){return new Promise((t,r)=>{let n=document.createElement("workspace-export-dialog");n.workspace=e??null,n.addEventListener("resolve",o=>{n.remove(),t(o.detail)}),n.addEventListener("modal-conflict",o=>{n.workspace=null,n.remove(),r(Tt(o.detail?.cause))}),document.body.append(n)})}async function jv(e){await Vv({workspace:e})}var Ip=class extends I{static properties={_value:{state:!0}};constructor(){super(),this._value=""}_onInput=t=>{this._value=t.target.value};_onCreate=()=>{let t=(this._value??"").trim();t&&this._finish(t)};_onCancel=()=>this._finish(null);_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onCreate())};render(){let t=(this._value??"").trim().length>0;return c`<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">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="${!t}" @click="${this._onCreate}">Create</button></footer></dialog>`}};customElements.define("new-workspace-dialog",Ip);function Wv(){return ee("new-workspace-dialog")}var Mp=class extends I{static styles=[...I.styles,B(Ce)];static properties={workspaceName:{type:String},reportCount:{type:Number},bundleCount:{type:Number},orphanedTriage:{type:Number},sharedTriage:{type:Number},_mode:{state:!0},_triage:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceName="",this.reportCount=0,this.bundleCount=0,this.orphanedTriage=0,this.sharedTriage=0,this._mode="detach",this._triage="keep",this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){if(this._settled)return;let r=this.reportCount>0?this._mode:"detach",n=r==="delete"&&this.orphanedTriage>0?this._triage:"keep";super._finish({confirmed:!!t,mode:r,triage:n})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_onModeChange=t=>{this._mode=t.target.value};_onTriageChange=t=>{this._triage=t.target.value};_triageSection(){if(this._mode!=="delete"||this.reportCount===0)return"";let t=this.orphanedTriage,r=this.sharedTriage;return t===0&&r===0?c`<p class="lwd-note">No local triage is attached to ${this.reportCount===1?"this report":"these reports"}.</p>`:t===0?c`<p class="lwd-note">Local triage on ${this.reportCount===1?"this report":"these reports"} is also attached to ${r===1?"a report":"reports"} you're keeping. Nothing will be orphaned.</p>`:c`<fieldset class="lwd-choice"><legend><strong>${t}</strong> ${t===1?"triage entry won't":"triage entries won't"} be reachable from any remaining report. What should happen ${t===1?"to it":"to them"}?</legend><label class="lwd-option"><input type="radio" name="lwd-triage" value="keep" ?checked="${this._triage==="keep"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Keep</span> <span class="lwd-option-hint">Reapplied automatically if a matching report is imported later.</span></span></label> <label class="lwd-option"><input type="radio" name="lwd-triage" value="wipe" ?checked="${this._triage==="wipe"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Wipe</span> <span class="lwd-option-hint">Drop the orphaned triage from this browser.</span></span></label></fieldset>`}render(){let t=this.reportCount,r=this.bundleCount,n=t>0,o=t===1?"report":"reports",i=t===1?"it":"them",s=t===1?"stays":"stay",l=t===1?"is removed":"are removed",d=r>0?c`<p class="lwd-note">${r===1?"One bundle is":`${r} bundles are`} also attached. ${r===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>`:"",u=n?c`<fieldset class="lwd-choice"><legend>What should happen to the <strong>${t}</strong> attached ${o}?</legend><label class="lwd-option"><input type="radio" name="lwd-mode" value="detach" ?checked="${this._mode==="detach"}" @change="${this._onModeChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Move ${i} out of the workspace</span> <span class="lwd-option-hint">The ${o} ${s} in this browser as unattached ${o}.</span></span></label> <label class="lwd-option"><input type="radio" name="lwd-mode" value="delete" ?checked="${this._mode==="delete"}" @change="${this._onModeChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Delete ${i} along with the workspace</span> <span class="lwd-option-hint">The ${o} ${l} from this browser.</span></span></label></fieldset>`:r>0?c`<p class="lwd-empty">No reports are attached to this workspace (only bundles, see below).</p>`:c`<p class="lwd-empty">No reports are attached to this workspace.</p>`;return c`<dialog @close="${this._onClose}"><header><h3>Leave workspace</h3></header><p class="lwd-body">Leave workspace <strong>"${this.workspaceName}"</strong> on this device?</p>${u} ${d} ${this._triageSection()}<ul class="lwd-list"><li>Workspace synchronization data stays on the sync server — peers (and your other devices) keep their copy.</li></ul><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Leave</button></footer></dialog>`}};customElements.define("leave-workspace-dialog",Mp);function Kv({name:e,reportCount:t,bundleCount:r,triageImpact:n}={}){return ee("leave-workspace-dialog",{workspaceName:e??"",reportCount:t??0,bundleCount:r??0,orphanedTriage:n?.orphanedCount??0,sharedTriage:n?.sharedCount??0})}var Fp=class extends I{static styles=[...I.styles,B(ft)];static properties={workspaceId:{type:String},initialName:{type:String},privateKeyBase64:{type:String},_name:{state:!0},_password:{state:!0},_confirm:{state:!0},_url:{state:!0},_busy:{state:!0},_error:{state:!0},_copied:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.initialName="",this.privateKeyBase64="",this._name="",this._password="",this._confirm="",this._url="",this._busy=!1,this._error="",this._copied=!1,this._settled=!1}beforeOpen(){this._name=this.initialName}focusInitial(){this.renderRoot.querySelector('input[data-role="name"]')?.focus()}_finish(){this._settled||(this._copiedTimer&&(clearTimeout(this._copiedTimer),this._copiedTimer=null),this._password="",this._confirm="",this._url="",this.privateKeyBase64="",super._finish(null))}_onClose=()=>this._finish();_onCancel=()=>this._finish();_onNameInput=t=>{this._name=t.target.value};_onPasswordInput=t=>{this._password=t.target.value,this._error=""};_onConfirmInput=t=>{this._confirm=t.target.value,this._error=""};_canGenerate(){return(this._name??"").trim().length>0&&(this._password??"").length>0&&this._password===this._confirm&&!this._busy}_onGenerate=async()=>{if(this._canGenerate()){this._busy=!0,this._error="";try{let t=await Zd({id:this.workspaceId,name:this._name.trim(),privateKeyBase64:this.privateKeyBase64,password:this._password});if(this._settled)return;this._url=tu(t),this._password="",this._confirm=""}catch(t){if(this._settled)return;this._error=t?.message??String(t)}finally{this._busy=!1}}};_onCopy=async()=>{if(this._url){this._error="";try{if(await navigator.clipboard.writeText(this._url),this._settled)return;this._copied=!0,this._copiedTimer&&clearTimeout(this._copiedTimer),this._copiedTimer=setTimeout(()=>{this._copied=!1,this._copiedTimer=null},1500)}catch{if(this._settled)return;this._error="Copy failed \u2014 select the link and copy it manually."}}};_onKeydown=t=>{t.key==="Enter"&&!this._url&&(t.preventDefault(),this._onGenerate())};_body(){return this._url?c`<p class="nwd-note">Anyone with the link <strong>and</strong> the password can attach this workspace. Share them through separate channels.</p><label class="wsl-field"><span>Share link</span> <textarea class="wsl-link" readonly="readonly" rows="3" @focus="${t=>t.target.select()}">${this._url}</textarea></label> ${this._error?c`<p class="wsl-error" role="alert">${this._error}</p>`:g}<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>`:c`<label class="wsl-field"><span>Workspace name</span> <input type="text" class="nwd-input" data-role="name" placeholder="Workspace name" maxlength="200" .value="${this._name}" @input="${this._onNameInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-field"><span>Password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-share-link-pw" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-field"><span>Confirm password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-share-link-pw-confirm" maxlength="1024" .value="${this._confirm}" @input="${this._onConfirmInput}" @keydown="${this._onKeydown}"></label><p class="nwd-note">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._error?c`<p class="wsl-error" role="alert">${this._error}</p>`:g} ${this._password&&this._confirm&&this._password!==this._confirm?c`<p class="wsl-error" role="alert">Passwords don't match.</p>`:g}<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\u2026":"Generate link"}</button></footer>`}render(){return c`<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",Fp);function Gv({id:e,name:t,privateKeyBase64:r}={}){return new Promise((n,o)=>{let i=document.createElement("workspace-share-link-dialog");i.workspaceId=e??"",i.initialName=t??"",i.privateKeyBase64=r??"",i.addEventListener("resolve",()=>{i.remove(),n()}),i.addEventListener("modal-conflict",s=>{i.privateKeyBase64="",i.remove(),o(Tt(s.detail?.cause))}),document.body.append(i)})}var Bp=class extends I{static styles=[...I.styles,B(Ce)];static properties={reportName:{type:String},orphanedTriage:{type:Number},sharedTriage:{type:Number},inRemote:{type:Boolean},_triage:{state:!0}};constructor(){super(),this.reportName="",this.orphanedTriage=0,this.sharedTriage=0,this.inRemote=!1,this._triage="keep"}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){if(this._settled)return;let r=this.orphanedTriage>0?this._triage:"keep";super._finish({confirmed:!!t,triage:r})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_onTriageChange=t=>{this._triage=t.target.value};_remoteNotice(){return this.inRemote?c`<p class="lwd-note">This report 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).</p>`:g}_triageSection(){let t=this.orphanedTriage,r=this.sharedTriage;return t===0&&r===0?c`<p class="lwd-note">No local triage is attached to this report.</p>`:t===0?c`<p class="lwd-note">Local triage on this report is also attached to ${r===1?"a report":"reports"} you're keeping. Nothing will be orphaned.</p>`:c`<fieldset class="lwd-choice"><legend><strong>${t}</strong> ${t===1?"triage entry won't":"triage entries won't"} be reachable from any remaining report. What should happen ${t===1?"to it":"to them"}?</legend><label class="lwd-option"><input type="radio" name="drd-triage" value="keep" ?checked="${this._triage==="keep"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Keep</span> <span class="lwd-option-hint">Reapplied automatically if a matching report is imported later.</span></span></label> <label class="lwd-option"><input type="radio" name="drd-triage" value="wipe" ?checked="${this._triage==="wipe"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Wipe</span> <span class="lwd-option-hint">Drop the orphaned triage from this browser.</span></span></label></fieldset>`}render(){return c`<dialog @close="${this._onClose}"><header><h3>Delete report</h3></header><p class="lwd-body">Delete <strong>"${this.reportName}"</strong>?</p>${this._remoteNotice()} ${this._triageSection()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Delete</button></footer></dialog>`}};customElements.define("delete-report-dialog",Bp);function qv({name:e,triageImpact:t,inRemote:r}={}){return ee("delete-report-dialog",{reportName:e??"",orphanedTriage:t?.orphanedCount??0,sharedTriage:t?.sharedCount??0,inRemote:!!r})}var Lp=class extends I{static styles=[...I.styles,B(Ce)];static properties={bundleName:{type:String},inRemote:{type:Boolean}};constructor(){super(),this.bundleName="",this.inRemote=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_remoteNotice(){return this.inRemote?c`<p class="lwd-note">This bundle 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).</p>`:g}render(){return c`<dialog @close="${this._onClose}"><header><h3>Delete bundle</h3></header><p class="lwd-body">Delete <strong>"${this.bundleName}"</strong>?</p>${this._remoteNotice()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Delete</button></footer></dialog>`}};customElements.define("delete-bundle-dialog",Lp);function Yv({name:e,inRemote:t}={}){return ee("delete-bundle-dialog",{bundleName:e??"",inRemote:!!t})}var Pp=class extends I{static styles=[...I.styles,B(Ce)];static properties={bundleName:{type:String},workspaceName:{type:String}};constructor(){super(),this.bundleName="",this.workspaceName=""}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);render(){return c`<dialog @close="${this._onClose}"><header><h3>Detach bundle</h3></header><p class="lwd-body">Detach <strong>"${this.bundleName}"</strong> from workspace <strong>"${this.workspaceName}"</strong>?</p><p class="lwd-note">This bundle 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). The bundle bytes stay on this device — drop it onto another workspace to attach it there.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Detach</button></footer></dialog>`}};customElements.define("detach-bundle-dialog",Pp);function Xv({name:e,workspaceName:t}={}){return ee("detach-bundle-dialog",{bundleName:e??"",workspaceName:t??""})}var Op=class extends I{static styles=[...I.styles,B(Ce)];static properties={reportName:{type:String},workspaceName:{type:String}};constructor(){super(),this.reportName="",this.workspaceName=""}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);render(){return c`<dialog @close="${this._onClose}"><header><h3>Detach report</h3></header><p class="lwd-body">Detach <strong>"${this.reportName}"</strong> from workspace <strong>"${this.workspaceName}"</strong>?</p><p class="lwd-note">This report 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). The report bytes stay on this device — drop it onto another workspace to attach it there.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Detach</button></footer></dialog>`}};customElements.define("detach-report-dialog",Op);function Jv({name:e,workspaceName:t}={}){return ee("detach-report-dialog",{reportName:e??"",workspaceName:t??""})}var Np=class extends I{focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}_onConfirm=()=>this._finish(!0);render(){return c`<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">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._onConfirm}">Got it</button></footer></dialog>`}};customElements.define("persistence-degraded-dialog",Np);function Qv(){return new Promise(e=>{let t=document.createElement("persistence-degraded-dialog"),r=n=>{t.remove(),e({shown:n})};t.addEventListener("resolve",()=>r(!0)),t.addEventListener("modal-conflict",()=>r(!1)),document.body.append(t)})}var Dp=class extends I{focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}_onReload=()=>this._finish("reload");render(){return c`<dialog @close="${this._onClose}"><header><h3>Sign in to keep syncing</h3></header><p class="nwd-intro">Triage can't reach the sync server — the connection is being redirected to an <strong>authentication proxy</strong> (for example Cloudflare Access). This usually means your access session has expired.</p><p class="nwd-note">Reload the page to sign in again. Your triage is saved on this device, so reloading won't lose anything — or keep working offline and reload later.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onClose}">Not now</button> <button type="button" class="primary" @click="${this._onReload}">Reload page</button></footer></dialog>`}};customElements.define("proxy-auth-dialog",Dp);function Zv(){return new Promise(e=>{let t=document.createElement("proxy-auth-dialog"),r=(n,o)=>{t.remove(),e({shown:n,reload:o})};t.addEventListener("resolve",n=>r(!0,n.detail==="reload")),t.addEventListener("modal-conflict",()=>r(!1,!1)),document.body.append(t)})}var Pr;function YC(){return Pr||(Pr=document.createElement("div"),Pr.id="styled-tooltip",document.body.append(Pr),Pr)}var Or=null,os=null,ow=0,iw=0,ew=!1;function XC(){ew||(ew=!0,document.addEventListener("mousemove",e=>{ow=e.clientX,iw=e.clientY},{passive:!0}))}XC();var JC=100,QC=14,ZC=8,tw=8;function eE(e,{placement:t="cursor"}={}){let r=YC();if(Or===e)return;let n=e.dataset.tooltip??"";if(n){if(r.textContent=n,t==="right"){let o=e.getBoundingClientRect();r.style.top=`${Math.round(o.top+o.height/2)}px`,r.style.left=`${Math.round(o.right+ZC)}px`,r.style.transform="translateY(-50%)"}else{r.style.transform="none",r.style.top=`${iw+QC}px`,r.style.left="0px",r.classList.add("visible");let o=r.offsetWidth,i=window.innerWidth-o-tw,s=Math.max(tw,Math.min(ow,i));r.style.left=`${Math.round(s)}px`}r.classList.add("visible"),Or=e}}function $n(){clearTimeout(os),os=null,Pr&&Pr.classList.remove("visible"),Or=null}function Sl(e,{gate:t,placement:r}={}){t&&!t(e)||(clearTimeout(os),os=setTimeout(()=>{eE(e,{placement:r})},JC))}var rw=new WeakSet;function _l(e,t){!e||rw.has(e)||(rw.add(e),e.addEventListener("mouseover",r=>{let n=r.target.closest?.("[data-tooltip]");if(!n){$n();return}n!==Or&&Sl(n,t)}),e.addEventListener("mouseout",r=>{let n=r.target.closest?.("[data-tooltip]"),o=r.relatedTarget?.closest?.("[data-tooltip]")??null;n&&n===o||$n()}))}var nw=!1;function sw(){nw||(nw=!0,document.body.addEventListener("mouseover",e=>{let t=e.target.closest("[data-tooltip]");!t||t===Or||($n(),Sl(t))}),document.body.addEventListener("mouseout",e=>{!Or&&!os||Or&&Or.contains(e.relatedTarget)||$n()}))}var Sn=null,J=null,Cl=null;sw();function tE(){return Lt().size}function rE(){return an().size}var is=typeof location>"u"||location.hostname.endsWith(".github.io")?"":`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/sync`,Gp="application/x-deepview-report",Vp="application/x-deepview-source-ws",ss="application/x-deepview-bundle",El=!1,Al=!1,nE={default:"Reports","claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec",piolium:"Piolium"},aw=["default","claude-security","codex-security","deepsec","piolium"],xn="";function lw(e,t={}){let n=`file-item${e===a.currentFile&&(a.currentView==="findings"||a.currentView==="files")?" current":""}${t.indented?" indented":""}`,o=Ue(e),i=ci(e),s=oe[ot(e)]??oe.default;return c`<li class="${n}" data-file="${e}" data-workspace-id="${t.workspaceId??g}" draggable="true"><button type="button" class="file-name" data-tooltip="${o}">${me(s)}<span class="file-label">${o}</span>${i===void 0?g:c`<span class="file-count">${i}</span>`}</button></li>`}function uw(e,t={}){let r=`file-group-header${t.dropTarget?" default-reports":""}`;return c`<li class="${r}" data-default-reports="${t.dropTarget?"true":g}"><span class="group-label">${e}</span></li>`}var oE=c`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M8 3.5v9M3.5 8h9"/></svg>`;function iE(){let e=a.serverMode==="managed"?g:c`<span class="workspace-header-actions"><button type="button" class="workspace-add" data-action="new-workspace" title="Create a new workspace" aria-label="Create a new workspace">${oE}</button></span>`;return c`<li class="file-group-header workspace-header"><span class="group-label">Workspaces</span>${e}</li>`}function sE(){if(a.serverMode!=="managed")return g;let e=Array.isArray(a.managedTeams)?a.managedTeams:[];return e.length===0?g:c`${uw("Teams")} ${X(e,t=>t.id,t=>c`<li class="file-item team-item"><span class="team-name">${hE}<span class="team-label">${t.name}</span></span></li>${X(Array.isArray(t.reports)?t.reports:[],r=>r.id,r=>aE(r))}`)}`}function aE(e){return c`<li class="file-item indented team-report-item"><button type="button" class="file-name" data-tooltip="${e.filename}" @click="${()=>{lE(e)}}">${me(oe.default)}<span class="file-label">${e.filename}</span></button></li>`}async function lE(e){let t=await Mm(e.id);if(t==null){console.warn("managed: could not load team report",e.id);return}await Ze(e.filename,t)}function cE(){return c`<li class="file-group-header bundles-header" data-default-bundles="true"><span class="group-label">Bundles</span></li>`}var dE=c`${me(co)}`;function cw(e,t={}){let{integrity:r,name:n}=e,o=a.selectedBundle===r&&a.currentView==="bundles",s=`file-item bundle-item${t.workspaceId!=null?" indented":""}${o?" current":""}`;return c`<li class="${s}" data-bundle-integrity="${r}" data-workspace-id="${t.workspaceId??g}" draggable="true"><button type="button" class="file-name" data-tooltip="${`${n}
109
- ${r}`}">${dE}<span class="file-label">${n}</span></button></li>`}function uE(e,t){let r=e.slice(0,15);return c`<li class="file-item indented bundle-item bundle-missing" data-bundle-integrity="${e}" data-workspace-id="${t}" data-tooltip="Bundle bytes not on this device — drop the matching bundle to attach."><span class="file-name"><span class="file-icon" aria-hidden="true">?</span><span class="file-label"><em>missing · ${r}…</em></span></span></li>`}function pE(e,t){return c`<li class="file-item indented report-missing" data-workspace-id="${t}" data-tooltip="Report not on this device — it re-downloads automatically if a workspace member has uploaded it."><span class="file-name"><span class="file-icon" aria-hidden="true">?</span><span class="file-label"><em>missing · ${Ue(e)}</em></span></span></li>`}var fE=c`${me(ll)}`,hE=c`<svg class="team-icon" viewBox="0 0 16 16" width="13" height="13" fill="currentColor" aria-hidden="true"><path d="M5.5 8a2.25 2.25 0 1 0 0-4.5 2.25 2.25 0 0 0 0 4.5Zm0 1C3.2 9 1.75 10.2 1.75 11.6V13h7.5v-1.4C9.25 10.2 7.8 9 5.5 9Zm5.25-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm.25 1c-.43 0-.83.05-1.2.15.86.62 1.45 1.5 1.45 2.45V13h3.25v-1.3C14.5 10.1 13.15 9 11 9Z"/></svg>`,gE=c`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2v8M5 7l3 3 3-3M3 13h10"/></svg>`,mE=c`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 3H4v10h5"/><path d="M7 8h7M11 5l3 3-3 3"/></svg>`,bE=c`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 9.5L9 7.5"/><path d="M9.5 5.5L10.5 4.5a2.1 2.1 0 1 1 3 3l-1 1"/><path d="M6.5 11.5L5.5 12.5a2.1 2.1 0 1 1-3-3l1-1"/></svg>`;function yE(e){let r=`file-item workspace-item${a.currentWorkspace===e.id&&(a.currentView==="findings"||a.currentView==="files")?" current":""}`;return c`<li class="${r}" data-workspace-id="${e.id}"><button type="button" class="file-name">${fE}<span class="file-label" .textContent="${e.name}"></span></button><button type="button" class="workspace-share" data-action="share-workspace" title="Share by link" aria-label="Share workspace by link">${bE}</button><button type="button" class="workspace-export" data-action="export-workspace" title="Export workspace" aria-label="Export workspace">${gE}</button><button type="button" class="workspace-leave" data-action="leave-workspace" title="Leave workspace" aria-label="Leave workspace">${mE}</button></li>`}function wo(e){return xn?Ue(e).toLowerCase().includes(xn):!0}var zp=(e,t)=>Ue(e).localeCompare(Ue(t));async function W(){await Hd(),Pt().catch(()=>{});let e=await le(),t=K(),r=await xt();if(a.bundles=r,gu(),!J)return;Sn.classList.remove("empty");let n=new Set(e),o=new Set;for(let h of t)for(let m of h.reports)n.has(m)&&o.add(m);let i=new Map(r.map(h=>[h.integrity,h])),s=new Set;for(let h of t)for(let m of h.bundles)i.has(m)&&s.add(m);let l=new Map;for(let h of aw)l.set(h,[]);for(let h of e){if(o.has(h)||!wo(h))continue;let m=ot(h);l.has(m)||l.set(m,[]),l.get(m).push(h)}let d=t.filter(h=>!xn||h.name.toLowerCase().includes(xn)||h.reports.some(m=>wo(m))?!0:h.bundles.some(m=>{let b=i.get(m);return b&&wo(b.name)})),u=r.filter(h=>!s.has(h.integrity)&&wo(h.name));Y(c`${sE()} ${a.serverMode==="managed"&&t.length===0?g:iE()} ${X(d,h=>h.id,h=>{let m=[],b=[];for(let w of h.reports)wo(w)&&(n.has(w)?m.push(w):b.push(w));m.sort(zp),b.sort(zp);let v=[],y=[];for(let w of h.bundles){let k=i.get(w);k?(!xn||wo(k.name))&&v.push(k):xn||y.push(w)}return c`${yE(h)} ${m.map(w=>lw(w,{indented:!0,workspaceId:h.id}))} ${b.map(w=>pE(w,h.id))} ${v.map(w=>cw(w,{workspaceId:h.id}))} ${y.map(w=>uE(w,h.id))}`})} ${aw.map(h=>{let m=(l.get(h)??[]).toSorted(zp),b=h==="default";return m.length===0&&!(b&&El)?null:c`${uw(nE[h]??h,{dropTarget:b})} ${m.map(v=>lw(v))}`})} ${u.length>0||Al?cE():null} ${X(u,h=>h.integrity,h=>cw(h))}`,Cl);let p=J.querySelector('sidebar-view-button[kind="packages"]');p&&(p.count=tE());let f=J.querySelector('sidebar-view-button[kind="repositories"]');f&&(f.count=rE()),Nr(),cd(e,()=>{W()})}Ie(()=>{W()});async function vE(e){if(e.target.closest('[data-action="go-home"]')){await jy();return}let t=e.target.closest(".file-item[data-bundle-integrity]");if(t){if(t.classList.contains("bundle-missing"))return;let d=t.dataset.bundleIntegrity;if(a.selectedBundle===d&&a.currentView==="bundles")return;a.currentView="bundles",a.selectedBundle=d,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.bundleCodeSearchQuery="",a.bundleCodeSearchMode="files",a.bundleSearchQuery="",a.bundleSearchRegex=!1,a.bundleSearchCase=!1,a.bundleSearchContext=!0,a.bundleDetailsTab="overview",A.showAll=!0,a.shownTriage=null,Lr(d),x(),W(),or(d);return}let r=e.target.closest("sidebar-view-button");if(r){let d=r.getAttribute("kind");(d==="packages"||d==="repositories")&&(a.currentView=d,x(),W());return}if(e.target.closest('[data-action="new-workspace"]')){if(a.serverMode==="managed")return;let d=await Wv();d&&(await rp(),await xd(d),W());return}let n=e.target.closest('[data-action="share-workspace"]');if(n){let d=n.closest("[data-workspace-id]"),u=d?K().find(p=>p.id===d.dataset.workspaceId):null;u&&Gv({id:u.id,name:u.name,privateKeyBase64:u.privateKey}).catch(p=>alert(`Failed to open share dialog: ${p.message}`));return}let o=e.target.closest('[data-action="export-workspace"]');if(o){let d=o.closest("[data-workspace-id]"),u=d?K().find(p=>p.id===d.dataset.workspaceId):null;u&&jv(u).catch(p=>alert(`Failed to open export dialog: ${p.message}`));return}let i=e.target.closest('[data-action="leave-workspace"]');if(i){let d=i.closest("[data-workspace-id]"),u=d?K().find(v=>v.id===d.dataset.workspaceId):null;if(!u)return;let p=Array.isArray(u.reports)?u.reports:[],f;try{f=await Ea(p)}catch(v){alert(`Couldn't read reports to analyze triage impact: ${v.message}`);return}let{confirmed:h,mode:m,triage:b}=await Kv({name:u.name,reportCount:p.length,bundleCount:u.bundles.length,triageImpact:f});if(!h)return;if(!K().some(v=>v.id===u.id)){alert(`Workspace "${u.name}" was removed elsewhere; nothing to leave.`);return}try{await Ky(u.id,m,{triage:b})}catch(v){alert(`Failed to leave workspace: ${v.message}`)}return}let s=e.target.closest(".file-item.workspace-item[data-workspace-id]");if(s){let d=s.dataset.workspaceId,u=a.currentView==="findings"||a.currentView==="files";d&&(d!==a.currentWorkspace||!u)&&Ct(d);return}let l=e.target.closest(".file-item[data-file]");if(l){let d=l.dataset.file;d&&(d!==a.currentFile||a.currentView!=="findings")&&Ze(d);return}if(e.target.closest("sidebar-delete-current")){if(a.currentView==="bundles"&&a.selectedBundle){let b=a.selectedBundle,v=(a.bundles??[]).find(k=>k.integrity===b)?.name??b,y=K().filter(k=>Array.isArray(k.bundles)&&k.bundles.includes(b)).filter(k=>su(k.id,b)).map(k=>k.id),{confirmed:w}=await Yv({name:v,inRemote:y.length>0});if(!w)return;if(a.selectedBundle!==b){alert(`Active bundle changed during confirmation; aborting delete of "${v}".`);return}try{await Wy({deleteFromRemoteWorkspaceIds:y})}catch(k){alert(`Failed to delete bundle: ${k.message}`)}return}if(!a.currentFile)return;let d=a.currentFile,u;try{u=await Ea([d])}catch(b){alert(`Couldn't read reports to analyze triage impact: ${b.message}`);return}let p=K().filter(b=>Array.isArray(b.reports)&&b.reports.includes(d)).filter(b=>Zn(b.id,d)).map(b=>b.id),f=p.length>0,{confirmed:h,triage:m}=await qv({name:d,triageImpact:u,inRemote:f});if(!h)return;if(a.currentFile!==d){alert(`Active report changed during confirmation; aborting delete of "${d}".`);return}try{await Vy({triage:m,deleteFromRemoteWorkspaceIds:p})}catch(b){alert(`Failed to delete report: ${b.message}`)}return}if(e.target.closest("#sync-status")){if(a.serverModeMismatch)return;D.status==="error"?D.dismissError():D.status==="off"?(!D.getServerUrl()&&is&&D.setServerUrl(is),D.setEnabled(!0)):D.setEnabled(!1);return}if(e.target.closest('[data-action="admin-users"]')){J?.querySelector("#user-menu")?.hidePopover?.(),BE();return}if(e.target.closest('[data-action="manage-repos"]')){J?.querySelector("#user-menu")?.hidePopover?.(),LE();return}if(e.target.closest('[data-action="manage-reports"]')){J?.querySelector("#user-menu")?.hidePopover?.(),PE();return}if(e.target.closest('[data-action="manage-bundles"]')){J?.querySelector("#user-menu")?.hidePopover?.(),OE();return}if(e.target.closest('[data-action="manage-teams"]')){J?.querySelector("#user-menu")?.hidePopover?.(),NE();return}if(e.target.closest('[data-action="managed-logout"]')){Bm(a.managedSession?.csrfToken);return}if(e.target.closest("#auth-status")){a.managedSession==null&&Fm(a.managed?.loginPath);return}if(e.target.closest("#sidebar-toggle")){if(a.serverMode==="managed")return;Sn.classList.toggle("collapsed");try{localStorage.setItem("deepview.sidebarCollapsed",Sn.classList.contains("collapsed")?"1":"0")}catch{}}}function wE(e){let t=e.target.closest("[data-tooltip]");if(!t){$n();return}Sl(t,{placement:"right",gate:r=>{let n=r.querySelector(".file-label");return!n||(r.dataset.tooltip??"")!==n.textContent?!0:n.scrollWidth>n.clientWidth}})}function kE(e){let t=e.target.closest("[data-tooltip]"),r=e.relatedTarget?.closest?.("[data-tooltip]")??null;t&&t===r||$n()}function $E(e){xn=e.target.value.trim().toLowerCase(),W()}var xE={off:"Sync off",online:"Online",offline:"Offline",connecting:"Connecting\u2026",error:"Sync error"};function SE(){return D.getServerUrl()||is?K().length>0:!1}function pw(){let e=J?.querySelector("#auth-status");if(!e)return;e.hidden=!1;let t=J?.querySelector("#user-menu"),r=a.managedSession;if(r==null){e.dataset.authed="0",e.removeAttribute("popovertarget"),e.setAttribute("aria-label","Log in"),Y(c`Log in`,e),t&&Y(g,t);return}let n=(r.login[0]??"?").toUpperCase();e.dataset.authed="1",e.setAttribute("popovertarget","user-menu"),e.setAttribute("aria-label",`Account: ${r.login}`),Y(dw(n,r.id),e),t&&Y(c`<div class="user-card">${dw(n,r.id,!0)} <span class="user-id"><span class="user-login">${r.login}</span> ${r.name?c`<span class="user-name">${r.name}</span>`:g}</span></div>${r.role==="admin"||r.role==="manage"?c`<div class="user-menu-group" role="group" aria-label="Manage"><div class="user-menu-group-label">Manage</div>${r.role==="admin"?c`<button type="button" class="user-menu-row" data-action="admin-users">Users</button>`:g} <button type="button" class="user-menu-row" data-action="manage-repos">Repositories</button> <button type="button" class="user-menu-row" data-action="manage-reports">Reports</button> <button type="button" class="user-menu-row" data-action="manage-bundles">Bundles</button> <button type="button" class="user-menu-row" data-action="manage-teams">Teams</button></div>`:g} <button type="button" class="user-menu-row" data-action="managed-logout">Log out</button>`,t)}function dw(e,t,r=!1){let n=`/api/avatar/${encodeURIComponent(t)}`;return c`<span class="${r?"user-avatar user-avatar-lg":"user-avatar"}"><span class="user-avatar-fallback">${e}</span> <img alt="" src="${n}" @error="${_E}"></span>`}function _E(e){e.currentTarget.classList.add("broken")}function CE(){let e=J?.querySelector(".brand-tag");e&&(e.textContent=a.serverMode)}function EE(){Sn&&(Sn.dataset.mode=a.serverMode),a.serverMode==="managed"&&Sn?.classList.remove("collapsed"),jm()}function Nr(e){let t=J?.querySelector("#sync-status");if(!t)return;if(CE(),EE(),a.serverModeMismatch){let u=J?.querySelector("#auth-status");u&&(u.hidden=!0),D.setForcedOff(!0),D.setProtocolLocked(!0),t.hidden=!1,t.dataset.status="paused",t.title="This server speaks a different sync protocol than this app is set up for. Switching isn\u2019t supported yet.";let p=t.querySelector(".sync-label");p&&(p.textContent="Sync paused");return}if(a.serverMode==="managed"){t.hidden=!0,D.setForcedOff(!0),pw();return}if(a.serverMode==="standalone"){t.hidden=!0;let u=J?.querySelector("#auth-status");u&&(u.hidden=!0);return}let r=J?.querySelector("#auth-status");r&&(r.hidden=!0);let n=SE(),o=Jt()!=null;if(n&&o&&D.isEnabled()&&gm().catch(u=>{console.warn("sync: load failed",u)}),n&&o&&!D.getServerUrl()&&is&&D.isEnabled()&&D.setServerUrl(is),D.setForcedOff(!n),!n){t.hidden=!0;return}t.hidden=!1;let i=e??D.status;t.dataset.status=i;let s=D.persistenceDegraded;t.toggleAttribute("data-degraded",s);let l=D.proxyAuthRequired;t.toggleAttribute("data-proxy-auth",l),t.title=s?"Not saving to this browser right now (storage may be full, or another tab is on a newer version). Changes that haven\u2019t synced could be lost on reload.":l?"Can\u2019t reach the sync server \u2014 the connection is being redirected to a sign-in proxy (e.g. Cloudflare Access). Reload the page to sign in again.":"";let d=t.querySelector(".sync-label");d&&(d.textContent=xE[i]??"")}D.onStatusChange(Nr);var Up=!1,jp=!1;async function fw(){if(!D.persistenceDegraded||jp||Up)return;Up=!0;let{shown:e}=await Qv();if(Up=!1,e){jp=!0;return}D.persistenceDegraded&&setTimeout(fw,1500)}D.onPersistenceDegraded(e=>{Nr(),e?fw():jp=!1});var Hp=!1,Wp=!1;async function hw(){if(!D.proxyAuthRequired||Wp||Hp)return;Hp=!0;let{shown:e,reload:t}=await Zv();if(Hp=!1,!e){D.proxyAuthRequired&&setTimeout(hw,1500);return}Wp=!0,t&&location.reload()}D.onProxyAuthRequired(e=>{Nr(),e?hw():Wp=!1});function AE(e){let t=e.target.closest(".file-item.workspace-item");if(!t)return;let r=t.querySelector(".file-label");if(!r||r.querySelector("input"))return;let n=t.dataset.workspaceId,o=K().find(d=>d.id===n);if(!o)return;e.preventDefault();let i=document.createElement("input");i.type="text",i.value=o.name,i.className="workspace-rename-input",r.textContent="",r.append(i),i.focus(),i.select();let s=!1,l=async d=>{s||(s=!0,d&&await _d(n,i.value),W())};i.addEventListener("keydown",d=>{d.key==="Enter"?(d.preventDefault(),l(!0)):d.key==="Escape"&&(d.preventDefault(),l(!1))}),i.addEventListener("blur",()=>l(!0)),i.addEventListener("click",d=>d.stopPropagation()),i.addEventListener("dblclick",d=>d.stopPropagation())}function Tl(){for(let e of J.querySelectorAll(".drag-over"))e.classList.remove("drag-over")}function gw(e){return e.dataTransfer.types.includes(Gp)||e.dataTransfer.types.includes(ss)}function TE(e){let t=e.target.closest(".file-item[data-bundle-integrity]");if(t){if(t.classList.contains("bundle-missing")){e.preventDefault();return}let n=t.dataset.bundleIntegrity;e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(ss,n),e.dataTransfer.setData(Vp,t.dataset.workspaceId??""),e.dataTransfer.setData("text/plain",n),t.classList.add("dragging"),Al=!0,W();return}let r=e.target.closest(".file-item[data-file]");r&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(Gp,r.dataset.file),e.dataTransfer.setData(Vp,r.dataset.workspaceId??""),e.dataTransfer.setData("text/plain",r.dataset.file),r.classList.add("dragging"),El=!0,W())}function RE(){for(let e of J.querySelectorAll(".dragging"))e.classList.remove("dragging");Tl(),(El||Al)&&(El=!1,Al=!1,W())}function IE(e){if(!gw(e))return;e.preventDefault();let t=e.target.closest("[data-workspace-id]"),r=J.querySelector(".dragging")?.closest("[data-workspace-id]")?.dataset.workspaceId??null,i=t&&r&&t.dataset.workspaceId===r||!t&&!r;if(e.dataTransfer.dropEffect=i?"none":"move",Tl(),!i)if(t){let s=t.dataset.workspaceId;for(let l of J.querySelectorAll(`[data-workspace-id="${CSS.escape(s)}"]`))l.classList.contains("dragging")||l.classList.add("drag-over")}else{let l=e.dataTransfer.types.includes(ss)?"[data-default-bundles]":"[data-default-reports]",d=J.querySelector(l);d&&d.classList.add("drag-over")}}function ME(e){J.contains(e.relatedTarget)||Tl()}async function FE(e){if(!gw(e))return;e.preventDefault(),e.stopPropagation(),Tl();let t=e.target.closest("[data-workspace-id]"),r=t?t.dataset.workspaceId:null,n=e.dataTransfer.getData(Vp)||null;if(e.dataTransfer.types.includes(ss)){let i=e.dataTransfer.getData(ss);if(!i)return;if(n&&n!==r&&su(n,i)){let s=(a.bundles??[]).find(u=>u.integrity===i)?.name??i,l=K().find(u=>u.id===n),{confirmed:d}=await Xv({name:s,workspaceName:l?.name??""});if(!d)return;try{await Pa(n,i)}catch(u){console.warn(`Failed to remove '${s}' from source workspace ${n} remote:`,u)}}r&&await un(i,r),n&&n!==r&&await Rd(i,n),W();return}let o=e.dataTransfer.getData(Gp);if(o){if(n&&n!==r&&Zn(n,o)){let i=K().find(l=>l.id===n),{confirmed:s}=await Jv({name:o,workspaceName:i?.name??""});if(!s)return;try{await La(n,o)}catch(l){console.warn(`Failed to remove '${o}' from source workspace ${n} remote:`,l)}}r&&await Qt(o,r),n&&n!==r&&await mi(o,n),W()}}function mw(e){let t=Jt();if(Nc(t?t.mode:null,e.mode)==="mismatch"){a.serverModeMismatch=!0,D.setForcedOff(!0),D.setProtocolLocked(!0),console.warn(`sync: server is '${e.mode}' but this client is bound to '${t?.mode}' \u2014 refusing to switch (migration not yet supported)`),Nr(D.status);return}a.serverModeMismatch=!1,D.setProtocolLocked(!1);let n=a.serverMode!==e.mode;a.serverMode=e.mode,a.managed=e.managed,Oc(e),Nr(D.status),n&&W(),e.mode==="managed"&&bw()}async function bw(){try{a.managedSession=await Rm(),pw(),a.managedTeams=a.managedSession==null?[]:await Im(),W()}catch(e){console.warn("managed: session probe failed:",e)}}async function BE(){try{await Lm()}catch(e){console.warn("admin: bundle load failed:",e);return}a.currentView="admin-users",x(),W()}async function LE(){try{await Pm()}catch(e){console.warn("admin: repos bundle load failed:",e);return}a.currentView="manage-repos",x(),W()}async function PE(){try{await Om()}catch(e){console.warn("admin: reports bundle load failed:",e);return}a.currentView="manage-reports",x(),W()}async function OE(){try{await Nm()}catch(e){console.warn("admin: bundles bundle load failed:",e);return}a.currentView="manage-bundles",x(),W()}async function NE(){try{await Dm()}catch(e){console.warn("admin: teams bundle load failed:",e);return}a.currentView="manage-teams",x(),W()}async function DE(){if(Jt())return;let e=0,t=null;try{let r=await fetch(Xs,{credentials:"same-origin",headers:{accept:"application/json"}});e=r.status,r.ok&&(t=Js(await r.json()))}catch{}if(t){mw(t);return}e===404&&(a.serverMode="standalone",hm(!0),Nr(D.status),W())}function zE(){let e=J?.querySelector("#user-menu"),t=J?.querySelector("#auth-status");!e||!t||e.addEventListener("beforetoggle",r=>{if(r.newState!=="open")return;let n=t.getBoundingClientRect();e.style.left=`${Math.round(n.left)}px`,e.style.bottom=`${Math.round(window.innerHeight-n.top+6)}px`,e.style.top="auto",e.style.right="auto"})}function UE(e){Sn=e,J=e.renderRoot,Cl=J.querySelector("#file-list"),Wm(J.querySelector("#encryption-toggle")),Jm(J.querySelector("#storage-status")),J.addEventListener("click",vE),J.addEventListener("dblclick",AE),J.addEventListener("dragstart",TE),J.addEventListener("dragend",RE),J.addEventListener("dragover",IE),J.addEventListener("dragleave",ME),J.addEventListener("drop",FE),Cl.addEventListener("mouseover",wE),Cl.addEventListener("mouseout",kE),J.querySelector("#sidebar-search-input")?.addEventListener("input",$E),zE(),Nr(D.status),W(),D.onServerInfo(mw),DE(),a.serverMode==="managed"&&bw()}var Kp=class extends Z{static styles=[B(Um),B(zm)];render(){return c`<div class="sidebar-header"><h2 class="brand"><button class="brand-button" type="button" data-action="go-home"><span class="brand-name">DeepView</span></button> <span class="brand-tag">dev</span></h2><button id="encryption-toggle" type="button" hidden></button> <button id="sidebar-toggle" type="button" title="toggle sidebar" aria-label="toggle sidebar"><svg viewBox="0 0 16 16" width="14" height="14" fill="currentColor" aria-hidden="true"><path d="M2 4h12v1.5H2zM2 7.25h12v1.5H2zM2 10.5h12V12H2z"/></svg></button></div><div class="sidebar-search"><svg class="sidebar-search-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg> <input id="sidebar-search-input" type="search" placeholder="Search reports..." autocomplete="off"><sidebar-view-button kind="packages"></sidebar-view-button><sidebar-view-button kind="repositories"></sidebar-view-button></div><ul id="file-list"></ul><button id="storage-status" type="button" hidden><span class="storage-dot" aria-hidden="true"></span> <span class="storage-label"></span></button><div class="sidebar-actions"><sidebar-delete-current></sidebar-delete-current><button id="sync-status" type="button" data-status="off"><span class="sync-dot" aria-hidden="true"></span> <span class="sync-label">Sync off</span></button> <button id="auth-status" type="button" hidden></button></div><div id="user-menu" popover class="user-menu"></div>`}firstUpdated(){UE(this)}};customElements.define("app-sidebar",Kp);function yw(e){if(!e)return null;let t=O(e);if(!cn(t))return null;let r=e._reportName||a.currentFile||"";return pd({id:t,report:ka("report",r),workspace:ka("workspace",a.currentWorkspace??"")})}function Rl(e){for(let t of st())for(let r of t)if(O(r)===e)return{group:t,finding:r};return null}function vw(e,t){if(a.currentView="findings",a.viewMode==="graph"&&(a.viewMode="table",Be()),a.viewMode==="kanban"){let n=pe(e).commonTriage??"untriaged";a.kanbanExpandedColumn!==null&&a.kanbanExpandedColumn!==n&&(a.kanbanExpandedColumn=null)}if(Rr([e]).length===0){let n=a.sortBy;ro(),a.sortBy=n}let r=de(e);return e.length>1&&a.activeTabByGroup.set(r,t),a.viewMode==="table"?a.tableSelectedGid=r:a.viewMode==="focus"?a.focusGid=r:a.viewMode==="kanban"&&(a.kanbanPopoverGid=r),r}var HE=1600,Il="link-target",VE="Couldn't find that finding in any of your reports. Import the report it came from, then open the link again.",Ml=null;function jE(e){Ml!==null&&clearTimeout(Ml);for(let t of document.querySelectorAll(`.${Il}`))t.classList.remove(Il);e.classList.add(Il),Ml=setTimeout(()=>{e.classList.remove(Il),Ml=null},HE)}async function WE(e){let t=CSS.escape(e);if(a.viewMode==="table"){let r=S.querySelector("finding-table");if(r){try{await r.updateComplete}catch{}for(let n of r.shadowRoot?.querySelectorAll("finding-row")??[])if(n.group&&kn(n.group)===e)return n}}if(a.viewMode==="kanban"){let r=S.querySelector(`.kanban-card[data-gid="${t}"]`);if(r)return r}return S.querySelector(`finding-card[data-gid="${t}"]`)??S.querySelector(`[data-gid="${t}"]`)}async function ww(e){let t=Bd(e);if(t.length===1){a.currentWorkspace!==t[0].id&&await Ct(t[0].id);return}a.currentFile!==e&&await Ze(e)}async function KE({report:e,workspace:t}){let r=await Id(t);if(r&&r.id!==a.currentWorkspace)return await Ct(r.id),!0;let n=await Md(e);return!n||a.currentFile===n||(a.currentWorkspace?K().find(i=>i.id===a.currentWorkspace):null)?.reports.includes(n)?!1:(await ww(n),!0)}async function GE(e){let t=a.reports.map(n=>n.fileName).filter(Boolean),r=await Fd(e,{skip:t});return r?(await ww(r),!0):!1}async function kw(e){if(!e?.id)return{ok:!1,reason:"This link is missing a finding id."};let t=Rl(e.id);if(!t&&await KE(e)&&(t=Rl(e.id)),!t&&await GE(e.id)&&(t=Rl(e.id)),!t)return{ok:!1,reason:VE};let r=vw(t.group,e.id);Qa(t.group)&&queueMicrotask(ce),x();let n=await WE(r);return n?(n.scrollIntoView({block:"center",behavior:"smooth"}),jE(n),{ok:!0}):{ok:!0}}var $w={attach:{title:"Synced triage on report attach",intro:"have triage from your workspace that disagrees with your local view on",trailingNote:"Other findings in this report whose chain value didn't conflict were applied automatically; this list only covers disagreements. Pick which side to keep.",importedSideLabel:"Apply from chain",applyButton:"Apply"},chain:{title:"Triage conflict from peer update",intro:"were changed by a peer (or by another tab) in a way that disagrees with your local triage on",trailingNote:`Other findings whose remote value didn't conflict were applied automatically; this list only covers disagreements. Pick which side to keep for each \u2014 a "keep current" pick re-publishes your local value to the chain on your next save.`,importedSideLabel:"Apply from chain",applyButton:"Apply"}};function xw(){_m(async(e,t,r)=>{let n=Pd(e);try{return await ul(e,n,$w[r]??$w.attach)}catch{let o=e.length;return alert(`${r==="attach"?"A report attach":"A workspace sync"} had ${o} triage disagreement${o===1?"":"s"} with your local view. Kept your local values because another dialog is open. ${r==="attach"?"Detach and re-attach the report to pick again.":"Your local values will re-publish to the chain on the next change."}`),null}})}var qp=class extends I{static properties={retry:{type:Boolean},_value:{state:!0}};constructor(){super(),this.retry=!1,this._value=""}_finish(t){this._value="",super._finish(t)}_onCancel=()=>this._finish(null);_onInput=t=>{this._value=t.target.value};_onSubmit=()=>{let t=this._value??"";t&&this._finish(t)};_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onSubmit())};render(){let t=(this._value??"").length>0,r=this.retry?"That password didn't match. Try again, or cancel to leave the workspace unsynced for now.":"This sync server requires a password before it accepts a new workspace. Enter it to create the workspace on the server.";return c`<dialog @close="${this._onClose}"><header><h3>Sync server password</h3></header><p class="nwd-intro">${r}</p><input type="password" class="nwd-input" placeholder="Password" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-sync-auth" maxlength="4096" .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!t}" @click="${this._onSubmit}">${this.retry?"Retry":"Authenticate"}</button></footer></dialog>`}};customElements.define("sync-auth-dialog",qp);function Sw({retry:e=!1}={}){return ee("sync-auth-dialog",{retry:!!e})}function _w(){Sm(async({retry:e})=>{try{return await Sw({retry:e})}catch(t){return console.warn("Sync auth dialog failed to open:",t),null}})}var Fl="https://triage.space/",qE=[{hostname:"deepaudit.dev",pathPrefix:"/",supportsSync:!0},{hostname:"chalker.github.io",pathPrefix:"/deepview/",supportsSync:!1}];function YE(){for(let e of qE)if(location.hostname===e.hostname&&location.pathname.startsWith(e.pathPrefix))return e;return null}var XE=["deepview.triage","deepview.triage.pending"],JE="deepview.repoUrls";function QE(){try{for(let e of XE)if(localStorage.getItem(e))return!0}catch{return!0}try{let e=localStorage.getItem(JE);if(e){let t=JSON.parse(e);if(t&&typeof t=="object"&&Object.keys(t).length>0)return!0}}catch{return!0}return!1}async function ZE(){if(QE())return!0;let e=[];try{e=await le()}catch{return!0}if(e.length>0)return!0;try{if(K().length>0)return!0}catch{return!0}try{return await Xo()}catch{return!0}}var Yp=class extends Z{static properties={supportsSync:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.supportsSync=!1}firstUpdated(){let t=this.querySelector("dialog");t&&t.showModal();let r=this.querySelector("button.om-stay");r&&r.focus()}_finish(t){if(this._settled)return;this._settled=!0;let r=this.querySelector("dialog");r&&r.close(),this.dispatchEvent(new CustomEvent("resolve",{detail:t}))}_onClose=()=>this._finish(!1);_onStay=()=>this._finish(!1);_onMigrate=()=>this._finish(!0);render(){let t=()=>c`<a class="om-link" href="${Fl}" target="_blank" rel="noopener noreferrer">${Fl}</a>`;return c`<dialog class="origin-migration-dialog" @close="${this._onClose}"><header class="om-head"><h3>This deepview build has moved</h3><p><code>${location.host}${location.pathname}</code> has moved to ${t()}.</p></header><section class="om-body"><p>Workspaces and reports don't migrate automatically — they live in this origin's browser storage (OPFS where available, localStorage as a fallback) and have to be re-imported on ${t()}.</p>${this.supportsSync?c`<p>For each workspace, use the <strong>Export workspace</strong> button in the sidebar to download a <code>.gz</code> bundle (workspace + its reports + its triage), then drop that file on ${t()}. Workspaces that had sync configured will pick their triage state back up from the sync server once you re-import them with the same key.</p><p>For triage attached to loose reports (or as a top-up after re-importing workspaces), call <code>DeepView.export()</code> in the browser console — that downloads just the triage entries plus saved repo URLs, no reports or workspaces.</p>`:c`<p>This build has no sync layer. For each workspace, use the <strong>Export workspace</strong> button in the sidebar to download a <code>.gz</code> bundle (workspace + its reports + its triage), then drop that file on ${t()}.</p><p>For triage attached to loose reports, call <code>DeepView.export()</code> in the browser console — that downloads just the triage entries plus saved repo URLs, no reports or workspaces. Reports themselves need to be re-dropped from their original JSON on the new origin.</p>`}</section><footer class="om-actions"><button type="button" class="om-stay" @click="${this._onStay}">Keep editing on ${location.host}</button> <button type="button" class="primary om-go" @click="${this._onMigrate}">Switch to triage.space</button></footer></dialog>`}};customElements.define("origin-migration-dialog",Yp);function e2(e){return new Promise(t=>{let r=document.createElement("origin-migration-dialog");r.supportsSync=e.supportsSync,r.addEventListener("resolve",n=>{r.remove(),t(!!n.detail)}),document.body.append(r)})}async function Cw(){let e=YE();return e?await ZE()?await e2(e)?(location.assign(Fl),!0):!1:(location.replace(Fl),!0):!1}var Xp=class extends I{static styles=[...I.styles,B(ft)];static properties={encoded:{type:String},_stage:{state:!0},_password:{state:!0},_name:{state:!0},_decoded:{state:!0},_existingById:{state:!0},_busy:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this.encoded="",this._stage="password",this._password="",this._name="",this._decoded=null,this._existingById=null,this._busy=!1,this._error="",this._settled=!1}focusInitial(){this._focusActiveInput()}updated(t){t.has("_stage")&&this._focusActiveInput()}_focusActiveInput(){if(this._stage==="password")this.renderRoot.querySelector('input[type="password"]')?.focus();else if(this._stage==="name"){let t=this.renderRoot.querySelector('input[data-role="name"]');t&&(t.focus(),t.select())}}_finish(t){this._settled||(this._decoded=null,this._password="",this.encoded="",super._finish(t))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_onPasswordInput=t=>{this._password=t.target.value,this._error=""};_onNameInput=t=>{this._name=t.target.value};_onUnlock=async()=>{if(!(!this._password||this._busy)){this._busy=!0,this._error="";try{let t=await eu({encoded:this.encoded,password:this._password});if(this._settled)return;let r=K().find(n=>n.id===t.id)??null;this._decoded=t,this._existingById=r,this._name=t.name,this._password="",this._stage="name"}catch(t){if(this._settled)return;this._error=t?.message??String(t)}finally{this._busy=!1}}};_onAttach=()=>{if(!this._decoded)return;let t=Ot(this._name);if(!t)return;let r=K().find(n=>n.id===this._decoded.id)??null;if(r){this._existingById=r;return}this._nameCollision(t)||this._finish({id:this._decoded.id,name:t,privateKeyBase64:this._decoded.privateKeyBase64})};_nameCollision(t){if(!t||!this._decoded)return null;for(let r of K())if(r.id!==this._decoded.id&&Ot(r.name)===t)return r;return null}_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._stage==="password"?this._onUnlock():this._stage==="name"&&this._onAttach())};_passwordStage(){return c`<p class="nwd-note">Someone shared a workspace with you. Enter the password they sent separately to attach it to this browser.</p><label class="wsl-field"><span>Password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-share-link-unlock" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> ${this._error?c`<p class="wsl-error" role="alert">${this._error}</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._password||this._busy}" @click="${this._onUnlock}">${this._busy?"Unlocking\u2026":"Unlock"}</button></footer>`}_alreadyAttachedStage(){let t=this._existingById;return c`<p class="nwd-note">This workspace is already attached as <strong>"${t?.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>`}_nameStage(){if(this._existingById)return this._alreadyAttachedStage();let t=Ot(this._name),r=this._nameCollision(t),n=!!t&&!r;return c`<p class="nwd-note">Pick a name for the workspace on this device. The shared identity is preserved either way — only the visible label changes.</p><label class="wsl-field"><span>Workspace name</span> <input type="text" class="nwd-input" data-role="name" placeholder="Workspace name" maxlength="200" .value="${this._name}" @input="${this._onNameInput}" @keydown="${this._onKeydown}"></label> ${r?c`<p class="wsl-error" role="alert">A workspace named "${t}" already exists on this device. Pick a different name.</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!n}" @click="${this._onAttach}">Attach</button></footer>`}render(){let t=this._stage==="password"?"Attach shared workspace":this._existingById?"Workspace already attached":"Name the workspace";return c`<dialog @close="${this._onClose}"><header><h3>${t}</h3></header>${this._stage==="password"?this._passwordStage():this._nameStage()}</dialog>`}};customElements.define("workspace-unlock-link-dialog",Xp);function Ew({encoded:e}={}){return new Promise((t,r)=>{let n=document.createElement("workspace-unlock-link-dialog");n.encoded=e??"",n.addEventListener("resolve",o=>{n.remove(),t(o.detail)}),n.addEventListener("modal-conflict",o=>{n.encoded="",n.remove(),r(Tt(o.detail?.cause))}),document.body.append(n)})}var qe=null,Bl=!1,as=null;function t2(e){if(!e)return"Could not unlock. Try again.";switch(e.name??""){case"NotAllowedError":case"AbortError":return"";case"SecurityError":return"The site identity does not match the one this passkey was registered for. If you opened DeepView through a different URL (different subdomain, different port), reload via the original URL.";case"InvalidStateError":return"The passkey state on this device is inconsistent. Try reloading the page or removing and re-creating the passkey.";case"NotSupportedError":return"This browser does not support the WebAuthn PRF extension this site needs. Try a recent Chrome, Safari, or Edge with a platform authenticator.";case"NetworkError":return"A network error prevented the passkey from completing. Check your connection and try again.";case"UnknownError":return"The authenticator returned an unknown error. Try again, or use a different passkey.";default:{let r=e.message??String(e);return r.length>200?r.slice(0,197)+"\u2026":r}}}function r2(){if(qe)return qe;qe=document.createElement("div"),qe.id="lock-overlay",qe.setAttribute("role","dialog"),qe.setAttribute("aria-modal","true"),qe.setAttribute("aria-label","Unlock DeepView"),qe.innerHTML=`
118
+ You can change this anytime from the lock icon in the sidebar header.`)){VC();return}await Bp(),de()&&VC()}var WC,Sy=w(()=>{"use strict";O();_y();WC="deepview.passkey.firstImportPrompted"});function Pp(){return le("passkey-unlock-dialog")}var Cy,Ey=w(()=>{"use strict";M();O();fe();Oi();Cy=class extends F{static styles=[...F.styles,A(mr)];static properties={_busy:{state:!0},_error:{state:!0}};constructor(){super(),this._busy=!1,this._error="",this._abortController=null}_finish(e){if(!this._settled){if(this._abortController)try{this._abortController.abort()}catch{}super._finish(!!e)}}_onCancel=()=>this._finish(!1);_onUnlock=async()=>{if(!this._busy){this._busy=!0,this._error="",this._abortController=new AbortController;try{if(await Ia({signal:this._abortController.signal})){this._finish(!0);return}this._error=""}catch(e){this._error=e?.message??String(e)}finally{this._busy=!1,this._abortController=null}}};render(){return d`<dialog @close="${this._onClose}"><header><h3>Unlock your data</h3></header><p class="nwd-note">Your triage data and report files are encrypted with a passkey on this device. Unlock to load them.</p>${this._error?d`<p class="wsl-error">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">${this._busy?"Cancel":"Later"}</button> <button type="button" class="primary" ?disabled="${this._busy}" @click="${this._onUnlock}">${this._busy?"Waiting\u2026":"Unlock with passkey"}</button></footer></dialog>`}};customElements.define("passkey-unlock-dialog",Cy)});function Np({workspaceId:t,items:e}={}){return le("sync-download-dialog",{workspaceId:t??"",items:Array.isArray(e)?[...e]:[]})}var Ry,Ay=w(()=>{"use strict";M();gt();O();Er();Fo();fe();Tr();Bn();Ry=class extends F{static styles=[...F.styles,A(qe)];static properties={workspaceId:{type:String},items:{type:Array},_running:{state:!0},_errors:{state:!0},_done:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.items=[],this._running=!1,this._errors=[],this._done=!1,this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="download"]')?.focus()}_onClose=()=>this._finish({downloaded:[],failed:[]});_onCancel=()=>this._finish({downloaded:[],failed:[]});_fail(e,r,n,o){e.push({kind:n,identifier:r.identifier,reason:o}),this._errors=[...this._errors,{label:Lo(r),reason:o}]}_onDownload=async()=>{if(this._running)return;this._running=!0,this._errors=[];let e=[],r=[];for(let n of this.items)try{if(n.kind==="bundle"){let a=await _1(this.workspaceId,n.identifier);if(!a.ok){this._fail(r,n,"bundle",a.reason??"unknown");continue}await ki(n.identifier,this.workspaceId),e.push({kind:"bundle",identifier:n.identifier});continue}let o=await $1(this.workspaceId,n.identifier);if(!o){this._fail(r,n,"report","not found in remote");continue}let i;try{i=Ve(await yr(o.content))}catch{this._fail(r,n,"report","remote payload is not gzipped UTF-8");continue}let s=_t(i);if(!s.recognized){this._fail(r,n,"report","remote payload is not a recognized report format");continue}await Pa(n.identifier,o.content),Tt(n.identifier,s.count,s.source),await $n(n.identifier,this.workspaceId),e.push({kind:"report",identifier:n.identifier})}catch(o){this._fail(r,n,n.kind,o?.message??String(o))}if(this._running=!1,this._done=!0,e.some(n=>n.kind==="report"))try{l.currentWorkspace===this.workspaceId&&await gr(this.workspaceId)}catch{}r.length===0&&this._finish({downloaded:e,failed:r})};render(){let{count:e,singular:r,kindLabel:n}=Tp(this.items),o=r?d`Download <strong>"${Lo(this.items[0])}"</strong> from the workspace's remote inventory?`:d`Download <strong>${e}</strong> remote ${n} into this workspace?`,i=r?m:Mp(this.items),s=this._running?r?"Downloading\u2026":`Downloading ${e} ${n}\u2026`:r?"Download":`Download ${e}`;return d`<dialog @close="${this._onClose}"><header><h3>Download from remote</h3></header><p class="lwd-body">${o}</p>${i} ${Ip(this._errors)}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._running}">${this._done&&this._errors.length>0?"Close":"Cancel"}</button> ${this._done&&this._errors.length>0?m:d`<button type="button" data-role="download" @click="${this._onDownload}" ?disabled="${this._running||e===0}">${s}</button>`}</footer></dialog>`}};customElements.define("sync-download-dialog",Ry)});function P3(){return rn||(rn=document.createElement("div"),rn.id="app-toast",rn.setAttribute("role","status"),rn.setAttribute("aria-live","polite"),document.body.append(rn),rn)}function On(t,{kind:e="info",duration:r=5200}={}){let n=P3(),o=++Dp;clearTimeout(wc),wc=null,n.className=e,n.textContent=t,requestAnimationFrame(()=>{Dp===o&&n.classList.add("visible")});let i=()=>{Dp===o&&Ty()};return r>0&&(wc=setTimeout(i,r)),i}function Ty(){Dp++,rn&&(clearTimeout(wc),wc=null,rn.classList.remove("visible"))}var rn,wc,Dp,zp=w(()=>{"use strict";rn=null,wc=null,Dp=0});function Oo(t,e="overview"){let r=e&&e!=="overview"&&kc.has(e)?` ${e}`:"";Je(Bo,`b:${t}${r}`).catch(()=>{})}function Xs(){return on}function N3(){return new Promise(t=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(t):setTimeout(t,0)})}async function Iy(t){return await N3(),t!==null&&Se(t)?!1:(_(),!0)}function Hp(){R.selected=null,R.focusedPkg=null,R.layoutCache=null,R.solo=null,R.hidden.clear(),R.pathFilter="",it()}function xc(t){for(let e of H.openSessions)e&&!t.has(e.workspaceId)&&(H.closeSession(e.workspaceId),Kg(e.workspaceId))}function Up(){T.classList.remove("active"),T.replaceChildren(),Ue.classList.remove("hidden")}function KC(t){return t instanceof DOMException&&t.name==="NotFoundError"||typeof t?.message=="string"&&t.message.startsWith("File not found:")}function Ly(t){let e=GC(t.toLowerCase());return e.endsWith(".map")?"sourcemap":e==="stasis.code.br"||e.endsWith(".stasis.code.br")?"stasis":null}function GC(t){return t.replace(/ \(\d+\)(?=\.[^.]*$)/u,"")}async function My({name:t,content:e,existingNames:r}){if(!r.has(t))return await nr(t,e),r.add(t),{name:t,content:e};let n;try{n=await Le(t)}catch(a){if(!KC(a))throw a;return await nr(t,e),r.add(t),{name:t,content:e}}if(n===e)return{name:t,content:e};let i=re().filter(a=>Array.isArray(a.reports)&&a.reports.includes(t)).filter(a=>Rs(a.id,t)),s=await MC({name:t,workspaceNames:i.map(a=>a.name),existingNames:r});if(s.action==="cancel")return null;if(s.action==="rename"){let a=s.newName;return await nr(a,e),r.add(a),{name:a,content:e}}return await nr(t,e),i.length>0&&await z3(t,i),{name:t,content:e}}async function D3(t,e){let r=typeof e?.github=="string"?e.github:"";if(r)try{await Hh(t,r)}catch(n){console.warn(`Import: failed to adopt the repository "${r}" for "${t}":`,n)}}async function z3(t,e){let r;try{r=await ei(t)}catch(n){console.warn(`Import: failed to read freshly-saved "${t}" for cloud sync:`,n);return}for(let n of e)try{await Ll(n.id);let o=await Lu(n.id,t,r);o&&o.ok===!1&&console.warn(`Import: failed to upload "${t}" to workspace "${n.name}" (${n.id}): ${o.reason??"unknown"}`)}catch(o){console.warn(`Import: failed to upload "${t}" to workspace "${n.name}" (${n.id}):`,o)}}async function Fy(t){if(t=[...t],t.length===0||(await at(),D())||(await Op(),D()))return;let e=null,r=null,n=new Set,o=new Set(await pe()),i=[];for(let s of t)try{let a=GC(s.name.toLowerCase());if(a.endsWith(".gz")||a.endsWith(".deepview-workspace.enc")){let p=await HC(s);if(p?.kind==="reports")for(let f of p.reports){if(typeof f?.name!="string"||!f.name||typeof f?.content!="string")continue;let h=_t(f.content);if(!h.recognized){i.push(f.name);continue}let g=await My({name:f.name,content:f.content,existingNames:o});g&&(Tt(g.name,h.count,h.source),await D3(g.name,f.repo),e={name:g.name,content:g.content})}try{let f=await pe();o.clear();for(let h of f)o.add(h)}catch(f){console.warn("Import: failed to refresh existingNames after workspace import:",f)}continue}if(Ly(s.name)){let p=new Uint8Array(await s.arrayBuffer()),{integrity:f}=await ri(s.name,p);r=f,n.add(f);continue}let u=await s.text();if(au(u,a)==="codex"){let p=rl(u);for(let{displayName:f,data:h}of p){let g=f.replaceAll("/","__")+".codex",y=JSON.stringify(h),{count:b,source:v}=_t(y),x=await My({name:g,content:y,existingNames:o});x&&(Tt(x.name,b,v),e={name:x.name,content:x.content})}}else{let p=_t(u);if(!p.recognized)throw new Error("not a recognized DeepView, DeepSec, Piolium, Claude Security, or Codex report, and not a links file");let f=await My({name:s.name,content:u,existingNames:o});if(!f)continue;Tt(f.name,p.count,p.source),e={name:f.name,content:f.content}}}catch(a){alert(`Failed to load ${s.name}: ${a.message}`)}if(i.length>0){let s=i.length;alert(`Skipped ${s} report${s===1?"":"s"} no parser recognised: ${i.join(", ")}`)}await ee();for(let s of n)ic(s).catch(()=>{});e?await Bt(e.name,e.content):r&&(Ro(r),Oo(r,l.bundleDetailsTab),_(),await ee(),Ln(r))}async function Bt(t,e,{workspaceId:r}={}){if(D())return;let n=++on;l.currentManagedTeam=null,l.currentManagedReport=null,l.currentReportWorkspace=Li(t,r);let o=new Set(re().filter(s=>Array.isArray(s.reports)&&s.reports.includes(t)).map(s=>s.id));if(xc(o),l.reports=[],$o(),l.workspaceMerges=[],l.revalidateConflicts=new Map,l.currentFile=t,l.currentWorkspace=null,l.currentLinks=null,l.managedReport=null,l.managedReports=[],(l.currentView==="bundles"||l.currentView==="packages"||l.currentView==="repositories"||l.currentView==="links")&&(l.currentView="findings"),l.repoUrl=xt(t),l.repoEditing=!1,Hp(),Je(Bo,xu(t,l.currentReportWorkspace)).catch(()=>{}),e===void 0){try{e=await Le(t)}catch(s){if(Se(n))return;if(s&&s.message?.includes("vault locked")){if(await Pp()&&!Se(n)){await Bt(t);return}Se(n)||(l.currentFile=null,await ee());return}if(KC(s)){let a=re().find(c=>Array.isArray(c.reports)&&c.reports.includes(t)&&Rs(c.id,t));if(a)try{if(await Ll(a.id),Se(n))return;let c=await Np({workspaceId:a.id,items:[{kind:"report",identifier:t}]});if(Se(n))return;if(c?.downloaded?.some(u=>u.kind==="report"&&u.identifier===t)){await Bt(t);return}}catch(c){if(console.warn(`Re-download prompt for missing "${t}" failed:`,c),Se(n))return}Se(n)||(l.currentFile=null,await ee());return}alert(`Failed to read ${t}: ${s.message}`),l.currentFile=null,await ee();return}if(Se(n))return}let i=so(e);if(i?(l.currentLinks={name:t,...i},l.currentView="links",_()):await Vp(t,e,n),!Se(n)){for(let s of o)H.openSession(s),H.refreshSession(s),Ll(s);return await ee(),!0}}async function Js(t,e=null){if(!D()||!t||!Array.isArray(t.reports))return!1;let r=e===null?t.reports:t.reports.filter(s=>s.id===e);if(e!==null&&r.length===0)return!1;let n=++on,o=await Promise.all(r.map(s=>M1(s.id)));if(Se(n))return!1;if(o.some(s=>s===null))return On("Could not load all team reports. Please try again."),!1;if(o.some((s,a)=>!wy(s,r[a].filename).data))return On("One of the team reports could not be read."),!1;xc(new Set);let i=document.createElement("p");i.setAttribute("role","status"),i.textContent="Loading report triage\u2026",T.replaceChildren(i),T.classList.add("active"),Ue.classList.add("hidden"),l.currentView="findings",l.reports=[],$o(),l.workspaceMerges=[],l.revalidateConflicts=new Map,l.currentFile=e===null?null:r[0].filename,l.currentWorkspace=e===null?`managed-team:${t.id}`:null,l.currentManagedTeam=t.id,l.currentManagedReport=e,l.managedReports=r.map(s=>({id:s.id,filename:s.filename})),l.managedReport=e===null?null:l.managedReports[0]??null,l.currentReportWorkspace=null,l.currentLinks=null,l.selectedBundle=null,l.repoUrl="",l.repoEditing=!1,Hp();for(let s=0;s<r.length;s++)if(await Vp(r[s].filename,o[s],n,{renderView:!1,managedReportId:r[s].id}),Se(n))return!1;if(r.length>0){let{hydrateManagedReportTriage:s}=await Promise.resolve().then(()=>(Py(),JC));if(Se(n))return!1;for(let a of r){let c=await s(a.id,{renderView:!1});if(Se(n))return!1;if(!c)return await Zs(),On("Could not load report triage. Open the team or report again to retry."),!1}}if(r.length===0)Up();else if(Fs(Mn()),!await Iy(n))return!1;return await ee(),!0}async function gr(t){if(D())return;l.currentManagedTeam=null,l.currentManagedReport=null,l.managedReport=null,l.managedReports=[];let e=re().find(i=>i.id===t);if(!e)return;let r=++on;xc(new Set([t])),(l.currentView==="bundles"||l.currentView==="packages"||l.currentView==="repositories"||l.currentView==="links")&&(l.currentView="findings"),jt("workspace",t),l.reports=[],$o(),l.workspaceMerges=[],l.revalidateConflicts=new Map,l.currentFile=null,l.currentWorkspace=t,l.currentReportWorkspace=null,l.currentLinks=null,l.repoUrl="",l.repoEditing=!1,Hp(),Je(Bo,`ws:${t}`).catch(()=>{}),e.reports.length===0&&Up();let n=e.reports.map(i=>Le(i).catch(()=>null)),o=0;for(let i=0;i<e.reports.length;i++){let s=await n[i];if(Se(r))return;if(s!==null&&!so(s)&&(await Vp(e.reports[i],s,r,{renderView:!1}),o++,Se(r)))return}o===0&&e.reports.length>0&&Up(),!(o>0&&(Fs(Mn()),!await Iy(r)))&&(H.openSession(t),H.refreshSession(t),Ll(t),await ee())}async function qC({triage:t="keep",deleteFromRemoteWorkspaceIds:e=[]}={}){if(!l.currentFile)return;let r=++on,n=l.currentFile;ks(n),kr(n,"");for(let o of e)try{let i=await Fu(o,n);if(Se(r))return;i&&i.ok===!1&&i.reason!=="not-found"&&console.warn(`Failed to delete '${n}' from workspace ${o} remote: ${i.reason}`)}catch(i){console.warn(`Failed to delete '${n}' from workspace ${o} remote:`,i)}if(await is(n),!Se(r)&&(await vl(n,null),!Se(r))){if(t==="wipe"){try{await Eu()}catch(o){console.warn("Skipped orphan-triage GC:",o)}if(Se(r))return}Se(r)||(jp(),await ee())}}function jp({forgetLastView:t=!0}={}){l.currentManagedTeam=null,l.currentManagedReport=null,l.currentFile=null,l.currentWorkspace=null,l.currentReportWorkspace=null,l.currentLinks=null,l.managedReport=null,l.managedReports=[],l.selectedBundle=null,l.bundleDetails=null,l.bundleDetailsTab="overview",l.bundleSourceFile=null,l.bundleSourceFindingIdx=null,l.selectedPackage=null,l.selectedPackageVersion=null,l.packageDetailsTab="overview",l.packageSlideTriage=null,l.packageSlideTransient=!1,l.expandedPackages.clear(),l.selectedRepository=null,l.repositoryDetailsTab="overview",l.repositorySlideTriage=null,l.repositorySlideTransient=!1,l.filesSelectedFile=null,l.tableSelectedGid=null,l.kanbanPopoverGid=null,l.kanbanExpandedColumn=null,l.focusGid=null,l.activeTabByGroup.clear(),l.reports=[],$o(),l.workspaceMerges=[],l.revalidateConflicts=new Map,l.repoUrl="",l.repoEditing=!1,l.shownTriage=null,l.currentView="findings",Hp(),t&&Jn(Bo),Up(),document.title="DeepView"}function By(t){++on,xc(new Set),jp(t)}async function Zs(){++on,xc(new Set),jp(),await ee()}async function YC({deleteFromRemoteWorkspaceIds:t=[]}={}){if(!l.selectedBundle)return;let e=++on,r=l.selectedBundle;for(let o of t)try{let i=await Bu(o,r);if(Se(e))return;i&&i.ok===!1&&i.reason!=="not-found"&&console.warn(`Failed to delete bundle from workspace ${o} remote: ${i.reason}`)}catch(i){console.warn(`Failed to delete bundle from workspace ${o} remote:`,i)}if(await Ch(r),Se(e)||(await Jm(r,null),Se(e)))return;l.selectedBundle=null,l.bundleDetails=null,l.bundleSourceFile=null,l.bundleSourceFindingIdx=null;let n=He(Bo);typeof n=="string"&&(n===`b:${r}`||n.startsWith(`b:${r} `))&&Jn(Bo),Rm(r),l.bundles=await Dt(),!Se(e)&&(_(),await ee())}async function XC(t,e="detach",{triage:r="keep"}={}){let n=re().find(a=>a.id===t);if(!n)return;++on;let o=Array.isArray(n.reports)?[...n.reports]:[];if(H.closeSession(t),Kg(t),e==="delete"){for(let a of o){try{await is(a)}catch{}ks(a),kr(a,"")}if(r==="wipe")try{await Eu()}catch(a){console.warn("Skipped orphan-triage GC:",a)}}let i=l.currentWorkspace===t,s=e==="delete"&&l.currentFile!=null&&o.includes(l.currentFile);(i||s)&&jp(),await Km(t),await ee()}async function Vp(t,e,r=null,{renderView:n=!0,managedReportId:o=null}={}){let i=()=>r!==null&&Se(r);try{if(await Promise.all([jt("report",t),jt("workspace",l.currentWorkspace||l.currentReportWorkspace)]),i()||(await _i(),i()))return;let{data:s,reason:a}=D()?wy(e,t):kn(e);if(!s)throw new Error(a);let c=l.reports.length===0,u=ar(s)??[],p=u.flatMap($b);if(await mm(p),i())return;let f=new Set(p.filter(tb).map(v=>v.source??s.source??null)),h=$r(s),g=h??xt(t),y=hi(s?.repo),b=[];for(let v of u){let x=$b(v);if(x.length===0)continue;let k=[];for(let $ of x){let C={...$,_id:l.nextFindingId++,_repoFallback:g,_repoDirectory:y,_reportName:t,_managedReportId:o,_bundleHashes:s.bundleHashes??[]};fi(C,s),C._source=C.source??s.source??null,"isApp"in C||(C.isApp=vn(C,C._source)),C._sourcePass=f.has(C._source),C._analyzer=C._source??C.type??null,k.push(C)}b.push(k)}if(l.reports.push({type:s.type||"analysis",source:s.source??null,fileName:t,_managedReportId:o,groups:b,repo:h,tree:s.tree??null,bundleHashes:s.bundleHashes??[]}),Yu(l.reports),Xu(l.reports)&&$o(),l.revalidateConflicts=dS(),Oy(),Array.isArray(s.bundleHashes)&&s.bundleHashes.length>0){let v=new Set((l.bundles??[]).map(x=>x.integrity));for(let x of s.bundleHashes)v.has(x)&&ic(x).catch(()=>{})}c&&(Ls(),Fs(Mn())),n&&await Iy(r)}catch(s){alert(`Failed to parse ${t}: ${s.message}`)}}function U3(){D()||(nn||(nn=document.createElement("input"),nn.type="file",nn.multiple=!0,nn.hidden=!0,nn.addEventListener("change",()=>{let t=[...nn.files];t.length>0&&Fy(t),nn.value=""}),document.body.append(nn)),nn.click())}var Bo,kc,on,Se,nn,Fo=w(()=>{"use strict";O();Er();IC();Nt();ot();ue();Xr();Fi();LC();_u();St();Pn();Eo();Fn();Oe();jC();Sy();Ey();Ay();Nu();zp();Bo="deepview.lastFile",kc=new Set(["overview","graph","treemap","compare","advisories","issues","code","search","terminal"]);on=0,Se=t=>t!==on;window.__loadFile=(t,e)=>Vp(t,e);window.__setFilters=({severities:t,confMin:e}={})=>{t!=null&&(l.filterSeverities=new Set(t)),e!==void 0&&(l.filterConfMin=e),_()};document.addEventListener("keydown",t=>{t.key==="Escape"&&document.body.classList.contains("report-fullscreen")&&document.body.classList.remove("report-fullscreen")});document.addEventListener("dragover",t=>t.preventDefault());document.addEventListener("drop",t=>{t.preventDefault(),!t.target.closest("#drop-zone")&&Fy(t.dataTransfer.files)});Ue.addEventListener("dragover",t=>{t.preventDefault(),D()||Ue.classList.add("hover")});Ue.addEventListener("dragleave",()=>Ue.classList.remove("hover"));Ue.addEventListener("drop",t=>{t.preventDefault(),Ue.classList.remove("hover"),Fy(t.dataTransfer.files)});nn=null;Ue.addEventListener("click",t=>{let e=t.target.closest("[data-managed-page]");if(e){Wp(e.dataset.managedPage);return}if(t.target.closest("[data-managed-login]")){Pu(l.managed?.loginPath);return}let r=t.target.closest("[data-managed-team]");if(r){let o=l.managedTeams.find(i=>i.id===r.dataset.managedTeam);o&&Js(o);return}let n=t.target.closest("[data-landing-workspace]");if(n){gr(n.dataset.landingWorkspace);return}t.target.closest(".drop-prompt-action")&&U3()})});function QC(){try{return localStorage.getItem(ZC)==="1"}catch{return!1}}function e2(){try{localStorage.setItem(ZC,"1")}catch{}}function H3(t){if(!t||t.kind!=="stasis"||!t.bundle)return!1;for(let[e,r]of t.bundle.modules)if(e.includes("node_modules")&&r?.name&&typeof r.version=="string"&&r.version)return!0;return!1}function t2(t,e){return!t||Ly(t.name)!=="stasis"?!1:!e||e.integrity!==t.integrity?!0:H3(e)}function j3(t){let e=Object.create(null);for(let[r,n]of t)e[r]=[...n].toSorted();return e}async function Ny(t,e){if(!t?.integrity||Nn.has(t.integrity)||!QC())return;let r=tc(t);if(r.size===0){Nn.set(t.integrity,{state:"ok",byPackage:new Map,query:r});return}Nn.set(t.integrity,{state:"loading",query:r});let n=t.integrity;try{let o=await fetch("/api/npm-advisories",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(j3(r))});if(!o.ok){let a=`HTTP ${o.status}`;try{let c=await o.json();c&&typeof c.error=="string"&&c.error&&(a=`${c.error} (HTTP ${o.status})`)}catch{}Nn.set(n,{state:"error",reason:a,query:r}),e();return}let i=await o.json(),s=new Map;if(i&&typeof i=="object")for(let[a,c]of Object.entries(i)){if(!Array.isArray(c))continue;let u=c.filter(p=>p&&typeof p=="object"&&typeof p.title=="string"&&typeof p.severity=="string");u.length>0&&s.set(a,u)}Nn.set(n,{state:"ok",byPackage:s,query:r})}catch(o){Nn.set(n,{state:"error",reason:o?.message??"fetch-failed",query:r})}e()}async function r2(t,e){t?.integrity&&Nn.get(t.integrity)?.state==="error"&&(Nn.delete(t.integrity),await Ny(t,e))}function Kp(t){return V3[t]??999}function W3(t){return t.charAt(0).toUpperCase()+t.slice(1)}function K3(){let t=typeof window>"u"?"":window.location.host;return d`<div class="bundle-advisories-consent"><div class="bundle-advisories-consent-card"><p class="bundle-advisories-consent-text">This bundle's dependency names and versions will be sent to the npm registry through a same-origin proxy (<span class="mono">${t}</span> → <span class="mono">registry.npmjs.org</span>) to look up published security advisories.</p><button type="button" class="bundle-advisories-consent-btn" data-advisories-consent>Confirm</button><p class="bundle-advisories-consent-note">This preference will be saved and reused for other bundles.</p></div></div>`}function n2(t){if(!t)return d`<div class="bundle-advisories-empty">Bundle not loaded yet.</div>`;if(t.kind!=="stasis"||!t.bundle)return d`<div class="bundle-advisories-empty">Advisories are only available for stasis bundles.</div>`;if(!QC())return K3();let e=Nn.get(t.integrity);if(!e||e.state==="loading")return d`<div class="bundle-advisories-empty">Loading advisories from npm registry…</div>`;if(e.state==="error")return d`<div class="bundle-advisories-empty is-error"><span>Failed to fetch advisories: ${e.reason}</span> <button type="button" class="bundle-advisories-retry" data-advisories-retry>Retry</button></div>`;let r=e.query.size,n=e.byPackage.size;if(n===0)return d`<div class="bundle-advisories"><div class="bundle-advisories-summary">No advisories for the ${r} ${r===1?"package":"packages"} in this bundle.</div></div>`;let o=[...e.byPackage.entries()].toSorted(([s,a],[c,u])=>{let p=Math.min(...a.map(h=>Kp(h.severity))),f=Math.min(...u.map(h=>Kp(h.severity)));return p!==f?p-f:s.localeCompare(c)}),i=[...e.byPackage.values()].reduce((s,a)=>s+a.length,0);return d`<div class="bundle-advisories"><div class="bundle-advisories-summary">${i} ${i===1?"advisory":"advisories"} across ${n} of ${r} ${r===1?"package":"packages"}</div><ul class="bundle-advisories-list">${o.map(([s,a])=>G3(s,a,e.query.get(s)))}</ul></div>`}function G3(t,e,r){let n=[...e].toSorted((i,s)=>{let a=Kp(i.severity)-Kp(s.severity);return a!==0?a:(i.title??"").localeCompare(s.title??"")}),o=r?[...r].toSorted():[];return d`<li class="bundle-advisories-section"><div class="bundle-advisories-section-header"><span class="bundle-advisories-section-name">${t}</span> ${o.length>0?d`<span class="bundle-advisories-section-versions">${o.map(i=>d`<span class="bundle-advisories-version-chip">${i}</span>`)}</span>`:m} <span class="bundle-advisories-section-count">${n.length} ${n.length===1?"advisory":"advisories"}</span></div><ul class="bundle-advisories-rows">${n.map(i=>J3(i))}</ul></li>`}function q3(t){if(typeof t!="string")return null;let e=/\/(GHSA-[a-z0-9-]+)(?:[/?#]|$)/iu.exec(t);return e?e[1]:null}function X3(t){let e=/^CWE-(\d+)$/u.exec(t);if(!e)return d`<span>${t}</span>`;let r=`https://cwe.mitre.org/data/definitions/${e[1]}.html`;return d`<a class="bundle-advisory-cwe" href="${r}" target="_blank" rel="noopener noreferrer">${t}</a>`}function J3(t){let e=t.severity,r=t.title,n=typeof t.cvss?.score=="number"?t.cvss.score.toFixed(1):"",o=typeof t.cvss?.vectorString=="string"&&t.cvss.vectorString?t.cvss.vectorString:"",i=typeof t.vulnerable_versions=="string"?t.vulnerable_versions:null,s=typeof t.url=="string"&&/^https?:\/\//iu.test(t.url)?t.url:null,a=q3(s),c=Array.isArray(t.cwe)?t.cwe.filter(p=>typeof p=="string"):[],u=a?d`<a class="bundle-advisory-ghsa" href="${s}" target="_blank" rel="noopener noreferrer">${a}${Y3}</a>`:m;return d`<li class="bundle-advisory-row"><div class="bundle-advisory-rail"><span class="${`bundle-advisory-severity sev-${e}`}">${W3(e)}</span> ${n?d`<span class="bundle-advisory-cvss-score">CVSS <span class="mono">${n}</span></span>`:m}</div><div class="bundle-advisory-body"><div class="bundle-advisory-header"><span class="bundle-advisory-title">${r}</span> ${u}</div><div class="bundle-advisory-subrow"><div class="bundle-advisory-meta">${i?d`<span>Affected <span class="mono">${i}</span></span>`:m} ${c.length>0?d`<span class="bundle-advisory-cwes">${c.map((p,f)=>d`${f===0?"":", "}${X3(p)}`)}</span>`:m}</div>${o?d`<div class="bundle-advisory-cvss-vector mono">${o}</div>`:m}</div></div></li>`}var Nn,ZC,V3,Y3,Dy=w(()=>{"use strict";M();Fo();tn();Nn=new Map,ZC="deepview.advisories.proxyConsent";V3={critical:0,high:1,moderate:2,low:3,info:4};Y3=d`<svg class="bundle-advisory-ghsa-icon" viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 13L13 3"/><path d="M5 3h8v8"/></svg>`});function Z3(t){if(zy.has(t))return zy.get(t);let e=HS(t),r=yy(t),n=[...e.keys()].filter(c=>e.get(c)!==null),{stripped:o}=Kt(n),i=new Map(n.map((c,u)=>[c,o[u]])),s={};for(let c of n){let u=i.get(c),p=r.get(c);s[u]={imports:p?[...p].map(f=>i.get(f)).filter(Boolean):[],size:e.get(c)}}let a={tree:s,origToStripped:i};return zy.set(t,a),a}function c2(t,e=null){let r={inprogress:0,fixed:0,invalid:0,deleted:0};if(!t?.fileHashes)return r;let n=new Set;for(let[o,i]of t.fileHashes)if(!(e&&!e.has(o))&&!n.has(i)){n.add(i);for(let s of il(i)){let a=l.triage.get(j(s))?.triage;a&&r[a]!==void 0&&r[a]++}}return r}function Qs(t,e="graph"){if(!t||t.size===0)return new Map;let r=new Map;for(let[n,o]of t){let i=il(o);if(i.length===0)continue;let s=i.filter(a=>{let c=l.triage.get(j(a))?.triage??null;return e==="issues"?c!=="invalid"&&c!=="deleted":c===l.shownTriage});s.length!==0&&r.set(n,s)}return r}function d2(t){let e=Z3(t),r=qs(t,e.origToStripped.keys());R.bundleReasonFor!==t.integrity&&(R.bundleReasonFor=t.integrity,R.dependencyPackagesView=!1,R.bundleReason=null);let{tree:n,origToStripped:o,selected:i}=EC(e.tree,e.origToStripped,r,R.bundleReason);R.bundleReason=i;let s=Object.keys(n);if(s.length===0)return null;let a=null;if(t.fileHashes&&t.fileHashes.size>0){a=new Map;for(let[W,he]of t.fileHashes){let Ce=o.get(W);Ce!==void 0&&a.set(Ce,he)}}let c=Qs(a),u=new Map,p=new Map,f=new Map,h=new Map;for(let[W,he]of c){let Ce={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},Ot=new Set,ce=new Set,Zt=[];for(let Xe of he){Ce[Xe.severity]=(Ce[Xe.severity]||0)+1,Ot.add(Xe.severity);let ht=l.triage.get(j(Xe))?.color??"none";ce.add(ht),Zt.push({severity:Xe.severity,color:ht})}u.set(W,Ce),p.set(W,Ot),f.set(W,ce),h.set(W,Zt)}let g=R.bundleLayout==="matrix"||u.size===0?null:Cp(n,u),y=new Map;for(let[W,he]of o)y.set(he,W);let b=en(t),v=b?new Map([...o].map(([W,he])=>[he,b.get(W)])):null,x=v?W=>v.get(W):null,k=s.filter(W=>by(W,y.get(W)??W,{packageDir:x?.(W)})==="__own__"),$=CC(k,x),C=R.splitOwnDirs&&$,U=W=>by(W,y.get(W)??W,{splitOwnDirs:C,packageDir:x?.(W)}),E=RC(t,o,U,b,e.origToStripped),B=new Set;for(let W of s)if(B.add(U(W)),B.size>=3)break;let N=B.size>=3,K=s;if(R.focusedPkg){let W=s.filter(he=>U(he)===R.focusedPkg);W.length>0?K=W:R.focusedPkg=null}return R.selected&&!Object.hasOwn(n,R.selected)&&(R.selected=null),{treeData:n,files:K,ownCounts:u,transitiveCounts:g,severitySets:p,colorSets:f,fileFindings:h,options:{pkgOf:U},strippedToOrig:y,canSplitOwnDirs:$,canPackagesView:N,supportsLayers:!0,layerRoots:E,ownSourcePackages:k.length>0?new Set(k.map(U)):void 0,reasons:[...r.keys()]}}function qp(){if(!_c)return;let t=Ks();t&&t.refreshSidebar(_c,{isBundleContext:!0})}function Yp(){if(!_c)return;let t=Ks();t&&t.refreshTopPkgs(_c)}function u2(t){_c=t}function Q3(t){let e=new Map,r=0;for(let{path:o,size:i,pkgDir:s}of t){if(typeof i!="number"||i<=0)continue;let a=st(o,{packageDir:s});e.set(a,(e.get(a)??0)+i),r+=i}if(r===0)return m;let n=[...e.entries()].toSorted((o,i)=>i[1]-o[1]);return d`<div class="bundles-dist"><div class="bundles-dist-bar" aria-hidden="true">${te(n,([o])=>o,([o,i])=>d`<span class="bundles-dist-seg" style="${ve({flexGrow:i,background:Lt(o)})}" data-tooltip="${o==="__own__"?m:`${o}: ${_e(i)}`}"></span>`)}</div><ul class="bundles-dist-list">${te(n,([o])=>o,([o,i])=>{let s=(i/r*100).toFixed(1),a=To(o),c=Lt(o);return d`<li><span class="bundles-dist-dot" style="${ve({background:c})}"></span> <span class="bundles-dist-pkg" data-tooltip="${o==="__own__"?m:o}">${a}</span> <span class="bundles-dist-bar-row" aria-hidden="true"><span class="bundles-dist-bar-fill" style="${ve({width:`${s}%`,background:c})}"></span> </span><span class="bundles-dist-size">${_e(i)}</span> <span class="bundles-dist-percent">${s}%</span></li>`})}</ul></div>`}function o2(t,e,r,n,o,i,s=null){let{prefix:a,stripped:c}=Kt(r),u=E=>o?.get(r[E]),p=new Set;for(let E=0;E<c.length;E++)p.add(st(c[E],{packageDir:u(E)}));let f=c.map((E,B)=>B).toSorted((E,B)=>c[E].localeCompare(c[B])),h=c.map((E,B)=>({path:E,size:n[B],pkgDir:u(B)})),g=Q3(h),y=g===m?d`<p class="bundles-overview-col-empty">No size information for this bundle's sources.</p>`:g,b={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},v=0,x=new Map;if(l.bundleDetails?.fileHashes){let E=Qs(l.bundleDetails.fileHashes,"issues");for(let B of E.values())for(let N of B){b[N.severity]!==void 0&&b[N.severity]++,v++;for(let K of sl(N.fileHash,N))x.set(K,(x.get(K)??0)+1)}}let k=[...x.keys()].toSorted(),$=Ee.filter(E=>b[E]>0).map(E=>d`<span class="${`tree-count-chip ${E}`}">${b[E]} ${E.replaceAll("_"," ")}</span>`),C=r.length>0?d`<ul class="bundles-sources-list">${f.map(E=>{let B=r[E],N=n[E],K=d`<span class="bundles-source-path">${c[E]}</span> ${N==null?m:d`<span class="bundles-source-size">${_e(N)}</span>`}`;return d`<li>${s?.has(B)?d`<div class="bundles-source-row is-resource" data-tooltip="${B}">${K}</div>`:d`<button type="button" class="bundles-source-row" data-bundle-view-source="${B}" data-tooltip="${B}">${K}</button>`}</li>`})}</ul>`:d`<p class="bundles-overview-col-empty">No source files in this bundle.</p>`,U=k.length>0?d`<ul class="bundles-reports-list">${k.map(E=>{let B=be[Ke(E)]??be.default,N=x.get(E)??0;return d`<li><button type="button" class="report-chip bundles-report-chip" data-tooltip="${E}" data-bundle-issue-report="${E}">${Z(B)}<span class="report-chip-label">${ke(E)}</span> <span class="bundles-report-count">${N} ${N===1?"issue":"issues"}</span></button></li>`})}</ul>`:d`<p class="bundles-overview-col-empty">No matching reports indexed yet.</p>`;return d`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${t}<dl class="bundles-detail-meta">${e}<dt>Sources</dt><dd>${r.length-(s?.size??0)}</dd>${s?.size?d`<dt>Resources</dt><dd>${s.size}</dd>`:m} ${a?d`<dt>Prefix</dt><dd class="mono">${a}</dd>`:m}</dl>${i??m}</div>${v>0?d`<div class="bundles-issue-summary tree-count-chips">${$}</div>`:m}</div><div class="bundles-overview-columns"><section class="bundles-overview-col"><header class="bundles-overview-col-head">Packages <span class="bundles-overview-col-count">${p.size}</span></header><div class="bundles-overview-col-body">${y}</div></section><section class="bundles-overview-col"><header class="bundles-overview-col-head">Files <span class="bundles-overview-col-count">${r.length}</span></header><div class="bundles-overview-col-body bundles-overview-col-body--list">${C}</div></section>${k.length>0?d`<section class="bundles-overview-col"><header class="bundles-overview-col-head">Reports <span class="bundles-overview-col-count">${k.length}</span></header><div class="bundles-overview-col-body bundles-overview-col-body--list">${U}</div></section>`:m}</div></div>`}function Sc(){queueMicrotask(()=>{document.querySelector(".bundle-code-rail-body .bundle-code-tree-link.current")?.scrollIntoView({block:"nearest"})})}function Pi(t){for(let e of Ee)for(let r of t)if(r.severity===e)return e;return t[0]?.severity??null}function tB(t,e,r,n,o=null){let i=t.split(`
119
+ `).length,s=String(i).length,a=Jl(e),c=`${r??""}\0${e}`;a&&!Uy.has(c)&&!Hy.has(c)&&(Hy.add(c),(async()=>{let p=await _o(t,a);Uy.set(c,p??null),Hy.delete(c),l.bundleSourceFile===e&&_()})());let u=Uy.get(c);return d`<div class="bundle-source-lines" style="${ve({"--lineno-width":`${s}ch`})}"><aside class="bundle-source-lineno-col" aria-hidden="true">${Array.from({length:i},(p,f)=>{let h=f+1,g=n.get(h),y=g?Pi(g.map(v=>v.f)):null,b=g&&l.bundleSourceFindingIdx!=null&&g.some(v=>v.idx===l.bundleSourceFindingIdx);return d`<div class="${I({"bundle-source-lineno-row":!0,"is-match":o?.has(h)??!1})}" data-line="${h}">${g?d`<button type="button" class="${I({"bundle-source-dot":!0,[`sev-${y}`]:!0,active:b})}" data-bundle-source-finding="${g[0].idx}" data-tooltip="${`${g.length} ${g.length===1?"issue":"issues"} on line ${h}`}" aria-label="${`${g.length} issues on line ${h}`}"></button>`:d`<span class="bundle-source-dot-placeholder"></span>`} <span class="bundle-source-lineno-num">${h}</span></div>`})}</aside><pre class="bundle-source-code"><code class="${a?`language-${a}`:""}">${typeof u=="string"?Z(u):t}</code></pre></div>`}function rB(t){let e=l.bundleSourceFindingIdx;if(e==null)return m;let r=t[e];if(!r)return m;let n=r.fileHash?sl(r.fileHash,r):[],o=l.triage.get(j(r))?.triage,i=o==="fixed"?"Fixed":o==="inprogress"?"In progress":null,s=Ri(r),a=m2(r.line);return d`<aside class="bundle-source-panel"><header class="bundle-source-panel-bar"><span class="${`bundle-source-panel-sev sev-${r.severity}`}">${r.severity.replaceAll("_"," ")}</span> ${i?d`<span class="${`bundle-source-panel-triage triage-${o}`}">${i}</span>`:m} <button type="button" class="bundle-source-panel-close" data-action="bundle-source-panel-close" aria-label="Close finding details">×</button></header><div class="bundle-source-panel-body">${a||s?d`<div class="bundle-source-panel-line-row">${a?d`<span class="bundle-source-panel-line">${a}</span>`:m} ${s?d`<span class="bundle-source-panel-meta" title="${s}">${s}</span>`:m}</div>`:m}<div class="bundle-source-panel-desc">${hr(us(r),{paragraphs:!1})}</div>${n.length>0?d`<div class="bundle-source-panel-reports"><div class="bundle-source-panel-reports-label">Reported by</div>${n.map(c=>{let u=We[Ke(c)]??We.default;return d`<button type="button" class="report-chip bundle-source-panel-report" data-tooltip="${c}" data-bundle-issue-report="${c}">${Z(u)}<span class="report-chip-label">${ke(c)}</span></button>`})}</div>`:m}</div></aside>`}function Wy(t,e,r){let n=[],o=new Map;if(typeof r=="string"&&t?.fileHashes){let s=Qs(t.fileHashes,"issues").get(e)??[];for(let a=0;a<s.length;a++){let c=s[a];n.push(c);let u=parseInt(c.line,10);Number.isFinite(u)&&u>0&&(o.has(u)||o.set(u,[]),o.get(u).push({f:c,idx:a}))}}return{fileFindings:n,lineFindings:o}}function p2(t){return d`<header class="bundle-source-bar"><div class="bundle-source-title" title="${t}">${t}</div><button type="button" class="bundle-source-close" data-action="bundle-source-close" aria-label="Close source viewer">×</button></header>`}function Ky(t,e,r,n,o,i=null){return d`<div class="bundle-source-code-wrap">${typeof e=="string"?tB(e,t,r,o,i):d`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${rB(n)}`}function f2(){let t=l.bundleSourceFile;if(!t)return m;if(l.bundleDetailsTab==="code"||l.bundleDetailsTab==="search")return m;let r=Xt(l.bundleDetails).get(t),{fileFindings:n,lineFindings:o}=Wy(l.bundleDetails,t,r);return d`<div class="bundle-source-overlay"><div class="${I({"bundle-source-modal":!0,"with-panel":l.bundleSourceFindingIdx!=null})}">${p2(t)}<div class="bundle-source-body">${l.bundleDetails?.metadataOnly?d`<div class="bundles-slide-placeholder">Loading source…</div>`:Ky(t,r,l.bundleDetails?.integrity,n,o)}</div></div></div>`}function nB(t){let e={name:"",files:new Map,dirs:new Map};for(let r of t){let n=r.split("/"),o=e;for(let i=0;i<n.length-1;i++){let s=n[i],a=o.dirs.get(s);a||(a={name:s,files:new Map,dirs:new Map},o.dirs.set(s,a)),o=a}o.files.set(n.at(-1),r)}return e}function oB(t,e){let r=0,n=null;if(!e||e.size===0)return{count:r,worst:n};let o=i=>{for(let s of i.files.values()){let a=e.get(s);if(!a||a.length===0)continue;r+=a.length;let c=Pi(a);(n===null||(Ne[c]??0)>(Ne[n]??0))&&(n=c)}for(let s of i.dirs.values())o(s)};return o(t),{count:r,worst:n}}function Vy(t,e,r=0,n=null,o="",i=!1){let s=[...t.dirs.entries()].toSorted(([f],[h])=>f.localeCompare(h)),a=[...t.files.entries()].toSorted(([f],[h])=>f.localeCompare(h)),c=f=>{if(!e)return!1;for(let h of f.files.values())if(h===e)return!0;for(let h of f.dirs.values())if(c(h))return!0;return!1},u=(f,h)=>i?!0:Gp.has(f)?Gp.get(f):r===0||c(h),p=f=>h=>{Gp.set(f,!h.currentTarget.parentElement.open)};return d`<ul class="${I({"bundle-code-tree":!0,root:r===0})}">${te(s,([f])=>`${o}/${f}`,([f,h])=>{let g=o?`${o}/${f}`:f,y=oB(h,n);return d`<li class="bundle-code-tree-dir"><details ?open="${u(g,h)}"><summary @click="${p(g)}"><span class="bundle-code-tree-dirname">${f}</span> ${y.count>0?d`<span class="${`bundle-code-tree-count sev-${y.worst}`}" title="${`${y.count} ${y.count===1?"issue":"issues"} inside`}">${y.count}</span>`:m}</summary>${Vy(h,e,r+1,n,g,i)}</details></li>`})} ${te(a,([,f])=>f,([f,h])=>{let g=n?.get(h),y=g&&g.length>0?Pi(g):null,b=g?.length??0;return d`<li class="bundle-code-tree-file"><button type="button" class="${I({"bundle-code-tree-link":!0,current:h===e})}" data-bundle-view-source="${h}" data-tooltip="${h}"><span class="bundle-code-tree-name">${f}</span> ${b>0?d`<span class="${`bundle-code-tree-count sev-${y}`}" title="${`${b} ${b===1?"issue":"issues"}`}">${b}</span>`:m}</button></li>`})}</ul>`}function Cc(t,e){return e&&t.startsWith(e)?t.slice(e.length):t}function h2(t,e){let r=new Map;for(let i=0;i<e.length;i++)r.set(t[i],e[i]);let n=nB(t),o=i=>{let s=new Map;for(let[a,c]of i.files)s.set(a,r.get(c)??c);i.files=s;for(let a of i.dirs.values())o(a)};return o(n),n}function iB(t,e,r,n,o=""){if(!r)return Vy(t,e,0,n);let i=r.toLowerCase(),s=[],a=p=>{for(let[,f]of p.dirs)a(f);for(let[,f]of p.files)Cc(f,o).toLowerCase().includes(i)&&s.push(f)};if(a(t),s.length===0)return d`<div class="bundle-code-search-empty">No files match.</div>`;let c=o?s.map(p=>Cc(p,o)):s,u=h2(c,s);return Vy(u,e,0,n,"",!0)}function sB(t,e,r,n=""){if(!e)return d`<div class="bundle-code-search-hint">Type to search across every source in this bundle.</div>`;let o=e.toLowerCase(),i=20,s=100,a=[],c=0;for(let[u,p]of t){if(typeof p!="string")continue;let f=[],h=p.split(`
120
+ `);for(let g=0;g<h.length;g++){let y=h[g];if(y.toLowerCase().includes(o)&&(f.push({ln:g+1,text:y}),c++,f.length>=i))break}if(f.length>0&&a.push({path:u,hits:f}),a.length>=s)break}return a.length===0?d`<div class="bundle-code-search-empty">No matches.</div>`:d`<div class="bundle-code-search-results"><div class="bundle-code-search-summary">${c} ${c===1?"hit":"hits"} in ${a.length} ${a.length===1?"file":"files"}</div>${a.map(({path:u,hits:p})=>{let f=Cc(u,n);return d`<div class="${I({"bundle-code-search-file":!0,current:u===r})}"><button type="button" class="bundle-code-search-file-name" data-bundle-view-source="${u}" data-tooltip="${u}">${f}</button><ul class="bundle-code-search-hits">${p.map(h=>d`<li class="bundle-code-search-hit"><button type="button" class="bundle-code-search-hit-link" data-bundle-view-source="${u}" data-bundle-view-line="${h.ln}" data-bundle-view-scroll-block="start" data-tooltip="${`${u}:${h.ln}`}"><span class="bundle-code-search-hit-ln">${h.ln}</span> <span class="bundle-code-search-hit-text mono">${h.text.slice(0,200)}</span></button></li>`)}</ul></div>`})}</div>`}function aB(t,e,r,n=""){if(!t.fileHashes)return d`<div class="bundle-code-search-empty">Computing file hashes…</div>`;let o=Qs(t.fileHashes,"issues");if(o.size===0)return d`<div class="bundle-code-search-empty">No issues match this bundle's files.</div>`;let i=e.toLowerCase(),s=[];for(let[a,c]of o)for(let u=0;u<c.length;u++){let p=c[u],f=p.description??"";i&&!a.toLowerCase().includes(i)&&!p.severity.includes(i)&&!p.severity.replaceAll("_"," ").includes(i)&&!f.toLowerCase().includes(i)||s.push({file:a,finding:p,fileIdx:u})}return s.sort((a,c)=>{let u=Ne[a.finding.severity]??0,p=Ne[c.finding.severity]??0;return p!==u?p-u:a.file.localeCompare(c.file)}),s.length===0?d`<div class="bundle-code-search-empty">No matches.</div>`:d`<div class="bundle-code-search-results"><div class="bundle-code-search-summary">${s.length} ${s.length===1?"issue":"issues"}</div><ul class="bundle-code-search-issues">${s.map(({file:a,finding:c,fileIdx:u})=>{let p=c.severity,f=Cc(a,n),h=a===r&&l.bundleSourceFindingIdx===u;return d`<li class="${I({"bundle-code-search-issue":!0,current:h})}"><button type="button" class="bundle-code-search-issue-link" data-bundle-view-source="${a}" data-bundle-view-finding-idx="${u}" data-bundle-view-line="${c.line??""}" data-tooltip="${a}"><div class="bundle-code-search-issue-row"><span class="${`bundle-code-search-issue-sev sev-${p}`}">${p.replaceAll("_"," ")}</span> <span class="bundle-code-search-issue-path mono">${f}${c.line?`:${c.line}`:""}</span></div><div class="bundle-code-search-issue-desc">${hr(us(c),{paragraphs:!1})}</div></button></li>`})}</ul></div>`}function s2(t,e,r){let n=null,o=-1,i=0;for(let[c,u]of r){if(typeof e.get(c)!="string")continue;let p=Ne[Pi(u)]??0;(p>o||p===o&&u.length>i||p===o&&u.length===i&&(n===null||c.localeCompare(n)<0))&&(n=c,o=p,i=u.length)}if(n)return n;if(t.kind==="stasis"&&t.bundle){for(let c of t.bundle.entries)if(typeof e.get(c)=="string")return c}let s=null,a=-1;for(let[c,u]of e)typeof u=="string"&&u.length>a&&(s=c,a=u.length);return s}function lB(t){let e=Xt(t);if(e.size===0)return d`<div class="bundle-code-empty">This bundle doesn't carry any source content.</div>`;i2!==l.selectedBundle&&(Gp.clear(),i2=l.selectedBundle);let r=[...e.keys()].toSorted(),{prefix:n,stripped:o}=Kt(r),i=h2(o,r),s=t.fileHashes?Qs(t.fileHashes,"issues"):new Map,a=l.bundleSourceFile;if(Dn&&(Dn.bundle!==l.selectedBundle||a&&a!==Dn.path)&&(Dn=null),!a)a=s2(t,e,s),a&&(l.bundleSourceFile=a,Dn={bundle:l.selectedBundle,path:a,hadIssues:s.size>0},Sc());else if(Dn&&!Dn.hadIssues&&s.size>0){Dn.hadIssues=!0;let b=s2(t,e,s);b&&b!==a&&(a=b,l.bundleSourceFile=b,l.bundleSourceFindingIdx=null,Dn.path=b,Sc())}let c=a?e.get(a):null,{fileFindings:u,lineFindings:p}=Wy(t,a,c),h=s.size>0?["files","code","issues"]:["files","code"],g=h.includes(l.bundleCodeSearchMode)?l.bundleCodeSearchMode:"files",y=l.bundleCodeSearchQuery;return d`<div class="bundle-code-view"><aside class="bundle-code-rail"><div class="bundle-code-rail-head"><span class="bundle-code-rail-label">Files</span> <span class="bundle-code-rail-count">${r.length}</span></div>${n?d`<div class="bundle-code-rail-prefix mono" title="${n}">${n}</div>`:m}<bundle-code-search .modes="${h}"></bundle-code-search><div class="bundle-code-rail-body">${fy(g,[["files",()=>iB(i,a,y,s,n)],["code",()=>sB(e,y,a,n)],["issues",()=>aB(t,y,a,n)]])}</div></aside><div class="${I({"bundle-code-main":!0,"with-panel":l.bundleSourceFindingIdx!=null})}">${a?cB(t,a,c,u,p):d`<div class="bundle-code-placeholder">Pick a file from the tree to view its source.</div>`}</div></div>`}function cB(t,e,r,n,o){let i=typeof r=="string"?r.split(`
121
+ `).length:0,s=typeof r=="string"?Go(r):0,a=n.map((c,u)=>({idx:u,line:parseInt(c.line,10)||0})).toSorted((c,u)=>c.line-u.line||c.idx-u.idx);return d`<header class="bundle-code-main-bar"><span class="bundle-code-main-path mono" title="${e}">${e}</span> <button type="button" class="bundle-code-copy-path" data-copy-path="${e}" aria-label="Copy file path">${eB}</button> <span class="bundle-code-main-spacer"></span> ${typeof r=="string"?d`<span class="bundle-code-main-stats">${i.toLocaleString()} ${i===1?"line":"lines"} · ${_e(s)}</span>`:m} ${n.length>0?d`<span class="bundle-code-main-issues" data-bundle-code-issue-order="${JSON.stringify(a)}"><span class="${`bundle-code-tree-count sev-${Pi(n)}`}" title="${`${n.length} ${n.length===1?"issue":"issues"} in this file`}">${n.length}</span> <button type="button" class="bundle-code-issue-step" data-bundle-code-issue-step="-1" aria-label="Previous issue">‹</button> <button type="button" class="bundle-code-issue-step" data-bundle-code-issue-step="1" aria-label="Next issue">›</button></span>`:m}</header><div class="bundle-code-main-body">${Ky(e,r,t.integrity,n,o)}</div>`}function uB(t){return t<=5?8:t<=15?6:t<=40?4:t<=120?3:2}function pB(t,e,r){let n=[];for(let o of t){let i=Math.max(1,o.ln-r),s=Math.min(e,o.ln+r),a=n.at(-1);a&&i<=a.end+1?a.end=Math.max(a.end,s):n.push({start:i,end:s})}return n}function fB(t,e,r){if(t.length<=r)return{text:t,ranges:e,clipped:!1};let n=e.length>0?e[0][0]:0,o=n>r-60?Math.max(0,n-60):0,i=t.slice(o,o+r);if(o===0)return{text:i,ranges:e,clipped:!1};let s=[];for(let[a,c]of e){let u=a-o,p=c-o;p<=0||u>=i.length||s.push([Math.max(0,u),Math.min(i.length,p)])}return{text:i,ranges:s,clipped:!0}}function hB(t,e){if(e.length===0)return t;let r=[],n=0;for(let[o,i]of e){let s=Math.max(n,Math.min(o,t.length)),a=Math.max(s,Math.min(i,t.length));a<=s||(s>n&&r.push(t.slice(n,s)),r.push(d`<mark class="bundle-search-mark">${t.slice(s,a)}</mark>`),n=a)}return n<t.length&&r.push(t.slice(n)),r}function mB(t,e,r){let n=fB(t,r??[],dB);return d`<div class="${I({"bundle-search-line":!0,"is-match":r!=null})}"><span class="bundle-search-lineno">${e}</span> <span class="bundle-search-code">${n.clipped?d`<span class="bundle-search-clip">…</span>`:m}${hB(n.text,n.ranges)}</span></div>`}function gB(t,e,r,n,o){let{start:i,end:s}=r,a=i;for(let p=i;p<=s;p++)if(n.has(p)){a=p;break}let c=String(s).length,u=[];for(let p=i;p<=s;p++)u.push(mB(e[p-1]??"",p,n.get(p)??null));return d`${o?d`<div class="bundle-search-gap" aria-hidden="true"></div>`:m} <button type="button" class="bundle-search-snippet" style="${ve({"--bundle-search-lineno-w":`${c}ch`})}" data-bundle-view-source="${t}" data-bundle-view-line="${a}" data-bundle-view-scroll-block="center" data-tooltip="${`${t}:${a}`}">${u}</button>`}function bB(t,e,r){let{path:n,lines:o,hits:i}=t,s=Cc(n,e),a=pB(i,o.length,r),c=new Map(i.map(f=>[f.ln,f.ranges])),u=i[0].ln,p=n===l.bundleSourceFile;return d`<section class="${I({"bundle-search-file":!0,current:p})}"><header class="bundle-search-file-head"><button type="button" class="bundle-search-file-name mono" data-bundle-view-source="${n}" data-bundle-view-line="${u}" data-bundle-view-scroll-block="center" data-tooltip="${n}">${s}</button> <span class="bundle-search-file-count">${i.length} ${i.length===1?"match":"matches"}</span></header><div class="bundle-search-snippets">${a.map((f,h)=>gB(n,o,f,c,h>0))}</div></section>`}function yB(t,e,r,n,o,i){if(!r)return d`<div class="bundle-search-results"><div class="bundle-search-hint">Search across every source in this bundle. Each match shows the surrounding lines for context — fewer matches get more context. Toggle <span class="bundle-search-hint-kbd">Aa</span> for case-sensitive and <span class="bundle-search-hint-kbd">.*</span> for regular-expression matching.</div></div>`;let s=_C(t.integrity??"",e,r,n,o);if(s.error)return d`<div class="bundle-search-results"><div class="bundle-search-error"><span class="bundle-search-error-label">Invalid regular expression</span> <span class="bundle-search-error-msg mono">${s.error}</span></div></div>`;let{fileResults:a,totalHits:c,truncated:u}=s,p=[...e.keys()].toSorted(),{prefix:f}=Kt(p);if(a.length===0)return d`<div class="bundle-search-results"><div class="bundle-search-empty">No matches.</div></div>`;let h=i?uB(c):0,g=a.length;return d`<div class="bundle-search-results"><div class="bundle-search-summary"><span>${c}${u?"+":""} ${c===1?"match":"matches"} in ${g}${u?"+":""} ${g===1?"file":"files"}</span> ${f?d`<span class="bundle-search-summary-prefix mono" title="${f}">${f}</span>`:m} ${u?d`<span class="bundle-search-summary-more">results capped — refine to narrow</span>`:m}</div>${te(a,y=>y.path,y=>bB(y,f,h))}</div>`}function vB(t,e,r,n){if(!e||typeof t!="string")return null;let o=gy(e,r,n);if(o.error)return null;let i=new Set,s=t.split(`
122
+ `);for(let a=0;a<s.length;a++)o.ranges(s[a]).length>0&&i.add(a+1);return i}function wB(t,e,r){let n=l.bundleSourceFile;if(!n)return m;let o=e.get(n),{fileFindings:i,lineFindings:s}=Wy(t,n,o);return d`<aside class="bundle-search-side">${p2(n)}<div class="bundle-source-body">${Ky(n,o,t.integrity,i,s,r)}</div></aside>`}function kB(t){let e=Xt(t);if(e.size===0)return d`<div class="bundle-search-view"><div class="bundle-code-empty">This bundle doesn't carry any source content.</div></div>`;let r=l.bundleSearchQuery,n=l.bundleSearchRegex,o=l.bundleSearchCase,i=null;if(l.bundleSourceFile){let a=vB(e.get(l.bundleSourceFile),r,n,o);a&&a.size===0?(l.bundleSourceFile=null,l.bundleSourceFindingIdx=null):i=a}let s=l.bundleSearchContext;return d`<div class="bundle-search-view"><div class="bundle-search-bar-row"><bundle-search></bundle-search><mode-switch data-bundle-search-context label="Context" .checked="${s}" accessible-label="Toggle context lines"></mode-switch></div><div class="bundle-search-main">${yB(t,e,r,n,o,s)} ${wB(t,e,i)}</div></div>`}function xB(t){let e=t2(t,l.bundleDetails);l.bundleDetailsTab==="advisories"&&!e&&(l.bundleDetailsTab="overview");let r=(l.bundles?.length??0)>=2;l.bundleDetailsTab==="compare"&&!r&&(l.bundleDetailsTab="overview");let n=l.bundleDetailsTab,o=n==="overview",i=l.bundleDetails,s=!!(i&&i.integrity===t.integrity),a=s&&!i.error&&!!(i.json||i.bundle)&&!(i.metadataOnly&&js(n));return n==="advisories"&&e&&a&&Ny(i,_).catch(()=>{}),d`<div class="bundles-view bundles-slide-view"><header class="bundles-slide-bar"><span class="bundles-slide-icon" aria-hidden="true">${Z(Gr)}</span><div class="bundles-slide-title"><div class="bundles-slide-name">${t.name}</div></div><div class="bundles-slide-tabs" role="tablist">${e?d`<button type="button" class="${I({"bundles-tab":!0,active:n==="advisories"})}" data-bundle-tab="advisories" aria-selected="${String(n==="advisories")}" role="tab">Advisories</button>`:m} <button type="button" class="${I({"bundles-tab":!0,active:n==="issues"})}" data-bundle-tab="issues" aria-selected="${String(n==="issues")}" role="tab">Issues</button> <button type="button" class="${I({"bundles-tab":!0,active:n==="terminal"})}" data-bundle-tab="terminal" aria-selected="${String(n==="terminal")}" role="tab">Terminal</button> <button type="button" class="${I({"bundles-tab":!0,active:n==="treemap"})}" data-bundle-tab="treemap" aria-selected="${String(n==="treemap")}" role="tab">Treemap</button> <button type="button" class="${I({"bundles-tab":!0,active:n==="graph"})}" data-bundle-tab="graph" aria-selected="${String(n==="graph")}" role="tab">Graph</button> <button type="button" class="${I({"bundles-tab":!0,active:n==="code"})}" data-bundle-tab="code" aria-selected="${String(n==="code")}" role="tab">Code</button> <button type="button" class="${I({"bundles-tab":!0,active:n==="search"})}" data-bundle-tab="search" aria-selected="${String(n==="search")}" role="tab">Search</button> ${r?d`<button type="button" class="${I({"bundles-tab":!0,active:n==="compare"})}" data-bundle-tab="compare" aria-selected="${String(n==="compare")}" role="tab">Compare</button>`:m} <button type="button" class="${I({"bundles-tab":!0,active:o})}" data-bundle-tab="overview" aria-selected="${String(o)}" role="tab">Overview</button></div></header><div class="${I({"bundles-slide-body":!0,"bundles-slide-body-overview":o})}">${o?BB(t,i):a?fy(n,[["terminal",()=>d`<div id="bundle-terminal-slot" class="bundle-terminal-slot"></div>`],["graph",()=>d`<div id="bundle-graph-slot" class="bundle-graph-slot"></div>`],["treemap",()=>d`<bundle-treemap .details="${i}"></bundle-treemap>`],["code",()=>lB(i)],["search",()=>kB(i)],["compare",()=>d`<bundle-compare .details="${i}" .integrity="${t.integrity}"></bundle-compare>`],["issues",()=>_B(i)],["advisories",()=>n2(i)]]):s&&!i.metadataOnly?d`<div class="${I({"bundles-slide-placeholder":!0,"is-error":!!i.error})}">${i.error?`Failed to parse: ${i.error}`:"Bundle contents not parsed."}</div>`:d`<div class="bundles-slide-placeholder">Loading bundle…</div>`}</div></div>`}function $B(t,e={}){if(!t)return m;let r=[];if(t.fileHash&&(r=sl(t.fileHash,t)),r.length===0&&e.bucketKey&&(e.kind==="package"?r=km(e.bucketKey,t):e.kind==="repository"&&(r=xm(e.bucketKey,t))),r.length===0)return m;let n=r.slice(0,2),o=r.length-n.length;return d`<div class="bundle-issue-reports">${n.map(i=>{let s=We[Ke(i)]??We.default;return d`<button type="button" class="report-chip" data-tooltip="${i}" data-bundle-issue-report="${i}">${Z(s)}<span class="report-chip-label">${ke(i)}</span></button>`})} ${o>0?d`<span class="bundle-issue-reports-more">, and ${o} more…</span>`:m}</div>`}function m2(t){if(t==null||t==="")return"";let e=String(t),r=e.indexOf("-");if(r>0){let o=parseInt(e.slice(0,r),10),i=parseInt(e.slice(r+1),10);return Number.isFinite(o)&&Number.isFinite(i)&&i>o?`Lines ${o}-${i}`:Number.isFinite(o)?`Line ${o}`:""}let n=parseInt(e,10);return Number.isFinite(n)?`Line ${n}`:""}function $c(t,e){return d`<div class="bundle-issues-empty"><p class="bundle-issues-empty-primary">${t}</p>${e?d`<p class="bundle-issues-empty-hint">${e}</p>`:m}</div>`}function _B(t){if(!t.fileHashes)return $c("Computing file hashes\u2026","Hashing this bundle's sources so findings from your reports can be matched against them.");if(t.fileHashes.size===0)return $c("This bundle doesn't carry any source content.","Issues are matched by source-file hash, so a bundle without inline sources has nothing to match findings against.");let e=Qs(t.fileHashes,"issues");if(e.size===0){let r=wm();if(r===0)return $c("No issues match this bundle's files.","Issues are analyzer findings matched to this bundle by source-file hash. No hash-carrying findings are indexed yet \u2014 hash matching needs the analyzer's native JSON reports; drop one and any matches will appear here automatically.");let n=0;for(let o of t.fileHashes.values())n+=il(o).length;return n>0?$c("All matching issues are dismissed.",`${n} ${n===1?"finding matches":"findings match"} this bundle's files, but every one is triaged invalid or deleted.`):$c("No issues match this bundle's files.",`None of the ${r.toLocaleString()} indexed ${r===1?"finding":"findings"} reference a source file in this bundle \u2014 matching compares exact file hashes, so findings from a different build of the same project won't line up.`)}return Ec(e,{kind:"bundle"})}function Ec(t,{kind:e,bucketKey:r}={}){let n=[...t.keys()],{prefix:o,stripped:i}=Kt(n),s=new Map(n.map((u,p)=>[u,i[p]])),a=[...t.entries()].toSorted(([u,p],[f,h])=>{let g=Ne[Pi(p)]??0,y=Ne[Pi(h)]??0;return y!==g?y-g:(s.get(u)??u).localeCompare(s.get(f)??f)}),c=[...t.values()].reduce((u,p)=>u+p.length,0);return d`<div class="bundle-issues"><div class="bundle-issues-summary">${c} ${c===1?"issue":"issues"} across ${t.size} ${t.size===1?"file":"files"} ${o?d`<span class="mono">${o}</span>`:m}</div><ul class="bundle-issues-list">${te(a,([u])=>u,([u,p])=>{let f=s.get(u)??u,h=[...p].toSorted((y,b)=>{let v=Ne[y.severity]??0,x=Ne[b.severity]??0;if(x!==v)return x-v;let k=parseInt(y.line,10)||0,$=parseInt(b.line,10)||0;return k-$}),g=e==="repository"&&r?`${/^https?:/iu.test(r)?r.replace(/\/$/u,""):`https://github.com/${r}`}/blob/HEAD/${u}`:null;return d`<li class="bundle-issues-file-group"><header class="bundle-issues-file-header">${e==="bundle"?d`<button type="button" class="bundle-issues-file-name mono" data-bundle-view-source="${u}" data-tooltip="${u}">${f}</button>`:g?d`<a class="bundle-issues-file-name bundle-issues-file-name-link mono" href="${g}" target="_blank" rel="noopener" data-tooltip="${u}">${f}</a>`:d`<span class="bundle-issues-file-name bundle-issues-file-name-static mono" title="${u}">${f}</span>`} <span class="bundle-issues-file-count">${p.length} ${p.length===1?"issue":"issues"}</span></header><ul class="bundle-issues-findings">${te(h,y=>y.id??`${u}\0${y.line??""}\0${y.severity??""}\0${y.description??""}`,y=>{let b=p.indexOf(y),v=y.severity,x=m2(y.line),k=l.triage.get(j(y))?.triage,$=k==="fixed"||k==="invalid"||k==="deleted"?k.toUpperCase():k==="inprogress"?"In progress":null,C=d`<div class="bundle-issues-finding-head"><span class="${`bundle-issue-sev sev-${v}`}">${v.replaceAll("_"," ")}</span> ${x?d`<span class="bundle-issues-finding-line">${x}</span>`:m} ${$?d`<span class="${`bundle-issues-finding-triage triage-${k}`}">${$}</span>`:m} <span class="bundle-issues-finding-spacer"></span> ${$B(y,{kind:e,bucketKey:r})}</div><div class="bundle-issues-finding-desc">${hr(us(y),{paragraphs:!1})}</div>`;return d`<li class="bundle-issues-finding">${e==="bundle"?d`<button type="button" class="bundle-issues-finding-link" data-bundle-view-source="${u}" data-bundle-view-finding-idx="${b}" data-bundle-view-line="${y.line??""}" data-tooltip="${u}">${C}</button>`:d`<div class="bundle-issues-finding-link bundle-issues-finding-static" title="${u}">${C}</div>`}</li>`})}</ul></li>`})}</ul></div>`}function g2(t){let e=l.selectedBundle,r=e?t.find(n=>n.integrity===e):null;return r?xB(r):d`<div class="bundles-view bundles-view-empty"><p class="bundles-empty-hint">${t.length===0?d`No bundles yet. Drop a <code>.map</code> sourcemap or a <code>.stasis.code.br</code> bundle to start.`:"Pick a bundle from the sidebar to open it."}</p></div>`}function AB(t){let e=typeof t=="string"?t.slice(t.lastIndexOf("/")+1):"",r=e.lastIndexOf("."),n=r>0?e.slice(r+1).trim().toLowerCase():"",o=Jl(t)??RB[n];return o?{key:o,label:EB[o]??o}:n?{key:`extension:${n}`,label:`.${n}`}:{key:"other",label:"Other"}}function TB(t){if(a2[t])return a2[t];let e=0;for(let r of t)e=Math.imul(e,31)+r.codePointAt(0)|0;return l2[(e>>>0)%l2.length]}function MB(t){let e=t.currentTarget,r=t.target.closest?.(".bundles-languages-segment");!r||!e.contains(r)||(e.dataset.tooltip=r.dataset.languageTooltip??"",Yg(e))}function IB(t){delete t.currentTarget.dataset.tooltip,Ts()}function LB(t){if(t?.kind!=="stasis"||!t.bundle)return m;let e=t.lineCounts?.size>0?t.lineCounts:new Map([...Xt(t)].map(([i,s])=>[i,nc(s)])),r=new Map,n=0;for(let[i,s]of e){if(s<=0)continue;let a=AB(i);r.set(a.key,{label:a.label,lines:(r.get(a.key)?.lines??0)+s}),n+=s}if(n<=0||r.size===0)return m;let o=[...r.entries()].toSorted((i,s)=>s[1].lines-i[1].lines||i[1].label.localeCompare(s[1].label));return d`<div class="bundles-languages-bar" data-tooltip-managed aria-label="Languages in this bundle" @pointerover="${MB}" @pointerleave="${IB}">${o.map(([i,{label:s,lines:a}])=>{let c=a/n*100;return d`<span class="bundles-languages-segment" style="${ve({flexGrow:a,background:TB(i)})}" data-language-tooltip="${`${s} \xB7 ${c<1?c.toFixed(1):c.toFixed(0)}% \xB7 ${a} ${a===1?"line":"lines"}`}"></span>`})}</div>`}function FB(t,e){let r=vC(e),n=LB(e);return d`<div class="bundles-overview-exports">${n}<div class="bundles-overview-exports-row"><button type="button" class="bundles-download-btn" data-bundle-download="${t.integrity}">${SB}<span>Download bundle</span></button> ${r?d`<div class="bundles-export-pair"><button type="button" class="bundles-download-btn" data-bundle-export-sbom="cyclonedx" data-tooltip="Export a CycloneDX SBOM (.cdx.json)">CycloneDX</button> <button type="button" class="bundles-download-btn" data-bundle-export-sbom="spdx" data-tooltip="Export an SPDX SBOM (.spdx.json)">${CB}<span>SPDX</span></button></div>`:m}</div></div>`}function jy(t,e,r=m){return d`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${t}${e}</div></div>${r}</div>`}function BB(t,e){let r=d`<dl class="bundles-detail-meta"><dt>Name</dt><dd>${t.name}</dd><dt>Integrity</dt><dd class="mono">${t.integrity}</dd>${e&&e.integrity===t.integrity?d`<dt>Size</dt><dd>${_e(e.size)}</dd>`:m}</dl>`,n=FB(t,e);if(!e||e.integrity!==t.integrity)return jy(r,n);if(e.error)return jy(r,n,d`<div class="bundles-overview-placeholder is-error">Failed to parse: ${e.error}</div>`);if(e.kind==="sourcemap"&&e.json){let o=e.json,i=o.sources??[],s=fr(e),a=e.sourceSizes??(s.size===i.length?i.map(u=>s.get(u)??null):i.map((u,p)=>typeof o.sourcesContent?.[p]=="string"?Go(o.sourcesContent[p]):null)),c=d`<dt>Version</dt><dd>${String(o.version??"?")}</dd>${o.file?d`<dt>Output</dt><dd class="mono">${o.file}</dd>`:m} ${o.sourceRoot?d`<dt>Source root</dt><dd class="mono">${o.sourceRoot}</dd>`:m} ${o.names||e.namesCount!=null?d`<dt>Names</dt><dd>${o.names?.length??e.namesCount}</dd>`:m}`;return o2(r,c,i,a,null,n)}if(e.kind==="stasis"&&e.bundle){let o=e.bundle,i=fr(e),s=Hs(e),a=[...s.keys()],c=new Set(a.filter(g=>s.get(g)==="resource")),u=new Set;for(let g of o.imports.keys()){let y=g.replace(/\s*\(with: .*\)\s*$/u,"");for(let b of y.split(", "))u.add(b)}let p=[...u].toSorted(),f=a.map(g=>i.get(g)),h=d`<dt>Version</dt><dd>${String(o.version)}</dd>${p.length>0?d`<dt>Resolution kinds</dt><dd>${p.join(", ")}</dd>`:m}`;return o2(r,h,a,f,en(e),n,c)}return jy(r,n,d`<div class="bundles-overview-placeholder">Bundle contents not parsed.</div>`)}var _c,zy,Uy,Hy,eB,Dn,Gp,i2,dB,SB,CB,EB,a2,l2,RB,Rc=w(()=>{"use strict";M();gC();Me();vt();fn();bt();Rr();Wt();O();ue();gt();tn();oc();my();SC();Gs();Rp();ot();Zl();mc();Bi();Eo();uy();go();Dy();fc();St();_c=null,zy=new WeakMap;Uy=new Map,Hy=new Set,eB=d`<svg viewBox="0 0 16 16" width="11" height="11" 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>`,Dn=null;Gp=new Map,i2=null;dB=400;SB=d`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2v8"/><path d="m4.5 7 3.5 3.5L11.5 7"/><path d="M2.5 13h11"/></svg>`,CB=d`<svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor" aria-hidden="true"><path d="M0 0v24H8.222l2.089-2.373 2.09-2.374V13.2H18.978l2.51-2.488L24 8.223V0H12zm5.2 5.2h13.791L12.2 12c-3.735 3.74-6.838 6.8-6.896 6.8-.057 0-.104-3.06-.104-6.8zm8.4 8.8v10H24V14h-5.2z"/></svg>`,EB=Object.freeze({javascript:"JavaScript",jsx:"JSX",typescript:"TypeScript",tsx:"TSX",json:"JSON",css:"CSS",markup:"HTML",yaml:"YAML",bash:"Shell",markdown:"Markdown",solidity:"Solidity",php:"PHP",rust:"Rust",ruby:"Ruby",java:"Java",cpp:"C++",c:"C",objectivec:"Objective-C",python:"Python",go:"Go",kotlin:"Kotlin",swift:"Swift",dart:"Dart",sql:"SQL",lua:"Lua",csharp:"C#",scala:"Scala",vue:"Vue",svelte:"Svelte"}),a2=Object.freeze({javascript:"#f1e05a",jsx:"#f1e05a",typescript:"#3178c6",tsx:"#3178c6",json:"#f1e05a",css:"#663399",markup:"#e34c26",yaml:"#cb171e",bash:"#89e051",markdown:"#083fa1",solidity:"#AA6746",php:"#4F5D95",rust:"#dea584",ruby:"#701516",java:"#b07219",cpp:"#f34b7d",c:"#555555",objectivec:"#438eff",python:"#3572A5",go:"#00ADD8",kotlin:"#A97BFF",swift:"#F05138",dart:"#00B4AB",sql:"#e38c00",lua:"#000080",csharp:"#178600",scala:"#DC322F",vue:"#41B883",svelte:"#FF3E00"}),l2=Object.freeze(["#8b5cf6","#ec4899","#14b8a6","#f97316","#06b6d4","#84cc16","#e11d48","#a855f7"]),RB=Object.freeze({py:"python",pyw:"python",go:"go",kt:"kotlin",kts:"kotlin",swift:"swift",dart:"dart",sql:"sql",lua:"lua",cs:"csharp",scala:"scala",sc:"scala",vue:"vue",svelte:"svelte"})});function b2(){lr().catch(()=>{});let t=jr(),e={inprogress:0,fixed:0,invalid:0,deleted:0},r=[];for(let[h,g]of t){let y=[],b=[],v=new Map,x=new Set;for(let[k,$]of g.byVersion){let C=[],U=new Map;for(let E of $.findings){let B=l.triage.get(j(E))?.triage??null;B==="inprogress"?e.inprogress++:B==="fixed"?e.fixed++:B==="invalid"?e.invalid++:B==="deleted"&&e.deleted++,B===l.shownTriage&&(C.push(E),U.has(E.file)||U.set(E.file,[]),U.get(E.file).push(E))}if(C.length!==0){y.push([k,{findings:C,files:U,reports:$.reports}]);for(let E of C)b.push(E),v.has(E.file)||v.set(E.file,[]),v.get(E.file).push(E);for(let E of $.reports)x.add(E)}}y.length!==0&&(y.sort(([k],[$])=>rh(k,$)),r.push([h,{findings:b,files:v,reports:x,versions:y}]))}let n=l.selectedPackage,o=n?r.find(([h])=>h===n)??null:null,i=null;if(o){let h=o[1].versions,g=l.selectedPackageVersion;i=h.find(([y])=>y===g)??null,!i&&h.length===1&&(i=h[0])}let s=i?i[1]:o?o[1]:null;if(o&&l.packageDetailsTab==="issues")return HB(o[0],s,i?i[0]:void 0);let a=l.packagesSearchQuery.trim().toLowerCase(),c=a?r.filter(([h])=>h.toLowerCase().includes(a)):r.slice();zB(c,l.packagesSortBy);let u=r.reduce((h,[,g])=>h+g.findings.length,0),p=new Set;for(let[,h]of r)for(let g of h.reports)p.add(g);let f=o?"packages-layout open":"packages-layout";return d`<div class="${I({"packages-view":!0,"with-details":!!o})}"><header class="page-head"><div class="page-title"><h1>Packages</h1><div class="meta-row"><span>${c.length===r.length?d`${r.length} ${r.length===1?"package":"packages"}`:d`${c.length} of ${r.length} ${r.length===1?"package":"packages"}`}</span> ${u>0?d`<span>${u} ${u===1?"finding":"findings"} across ${p.size} ${p.size===1?"report":"reports"}</span>`:m}</div></div>${NB(e)}</header>${r.length===0?d`<p style="color:var(--muted)">${t.size===0?"Indexing reports\u2026 this view populates as the OPFS scan finishes.":l.shownTriage?`No ${l.shownTriage} findings in any package.`:"No untriaged findings in any package."}</p>`:c.length===0?d`<p style="color:var(--muted)">No packages match "${l.packagesSearchQuery}".</p>`:d`<div class="${f}"><ul class="packages-list">${te(OB(c),PB,h=>jB(h,n,l.selectedPackageVersion))}</ul>${o?d`<aside class="packages-details" id="packages-details"><header class="packages-details-bar"><span class="packages-details-label">Details</span> <button type="button" class="packages-details-close" data-deselect-package aria-label="Close details">×</button></header><div class="packages-details-body">${KB(o[0],s,i?i[0]:void 0)}</div></aside>`:m}</div>`}</div>`}function OB(t){let e=[];for(let[r,n]of t){let o=n.versions;if(o.length<=1){let[c,u]=o[0];e.push({kind:"single",pkg:r,version:c,bucket:u,totalVersions:1});continue}let[i,s]=o[0],a=l.expandedPackages.has(r);if(e.push({kind:"latest",pkg:r,version:i,bucket:s,totalVersions:o.length,expanded:a}),a)for(let c=1;c<o.length;c++){let[u,p]=o[c];e.push({kind:"other",pkg:r,version:u,bucket:p,totalVersions:o.length})}}return e}function PB(t){return t.version===null?`${t.kind}:${t.pkg}`:`${t.kind}:${t.pkg}@${t.version}`}function NB(t){return d`<div class="packages-toolbar"><entity-search kind="packages"></entity-search><entity-sort kind="packages"></entity-sort><triage-selector variant="packages" .counts="${t}" .states="${DB}"></triage-selector></div>`}function zB(t,e){let r=e==="name-asc"?(n,o)=>n[0].localeCompare(o[0]):e==="files-desc"?(n,o)=>o[1].files.size-n[1].files.size||n[0].localeCompare(o[0]):e==="reports-desc"?(n,o)=>o[1].reports.size-n[1].reports.size||n[0].localeCompare(o[0]):(n,o)=>o[1].findings.length-n[1].findings.length||n[0].localeCompare(o[0]);t.sort(r)}function UB(t,e){let r={live:0,invalid:0,deleted:0};if(!t)return r;let n=e===void 0?t.files.values():t.byVersion.get(e)?.files.values()??[].values();for(let o of n)for(let i of o){let s=l.triage.get(j(i))?.triage??null;s==="invalid"?r.invalid++:s==="deleted"?r.deleted++:r.live++}return r}function HB(t,e,r){let n=jr().get(t),o=UB(n,r),i=l.packageSlideTriage??"live",s=n?y2(n,t,i,r):new Map,a=[...s.values()].reduce((f,h)=>f+h.length,0),c=i==="live"?a===1?"issue":"issues":a===1?`${i} issue`:`${i} issues`,u=i==="live"?"No live issues for this package.":`No ${i} issues for this package.`,p=typeof r=="string"?` @ ${r}`:"";return d`<div class="packages-view packages-slide-view"><header class="bundles-slide-bar"><button type="button" class="bundles-slide-back" data-action="package-slide-back" aria-label="Back to packages">← Back</button><div class="bundles-slide-title"><div class="bundles-slide-name">${t}${p}</div><div class="bundles-slide-integrity">${a} ${c} · ${e.files.size} ${e.files.size===1?"file":"files"} · ${e.reports.size} ${e.reports.size===1?"report":"reports"}</div></div><slide-triage-tabs kind="package" .counts="${o}"></slide-triage-tabs></header><div class="bundles-slide-body">${s.size===0?d`<div class="bundle-issues-empty">${u}</div>`:Ec(s,{kind:"package",bucketKey:t})}</div></div>`}function jB(t,e,r){let{kind:n,pkg:o,version:i,bucket:s}=t,a={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let y of s.findings){let b=ae(y,l.severityMode);a[b]!==void 0&&a[b]++}let c=Ee.filter(y=>a[y]>0),u=Lt(o),f={selected:o===e&&VB(t,r),"packages-row-latest":n==="latest","packages-row-other":n==="other"},h=i===null?"":i,g=i===null?`Open issues for ${o}`:`Open issues for ${o}@${i}`;return d`<li class="${I(f)}" data-select-package="${o}" data-select-package-version="${h}"><span class="packages-dot" style="${ve({background:u})}"></span><div class="packages-row-text"><div class="packages-name-line"><span class="packages-name">${o}${i===null?m:d`<span class="packages-version">@${i}</span>`} </span>${n==="latest"?WB(o,t.expanded,t.totalVersions-1):m}</div><span class="packages-row-meta">${s.findings.length} ${s.findings.length===1?"finding":"findings"} · ${s.files.size} ${s.files.size===1?"file":"files"} · ${s.reports.size} ${s.reports.size===1?"report":"reports"}</span></div>${c.length>0?d`<div class="packages-row-chips">${c.map(y=>d`<span class="${`tree-count-chip ${y}`}" title="${y.replaceAll("_"," ")}">${a[y]}</span>`)}</div>`:m} <button type="button" class="packages-row-issues" data-package-row-issues="${o}" data-package-row-issues-version="${h}" aria-label="${g}">Issues →</button></li>`}function VB(t,e){return t.kind==="single"?!0:t.version===e}function WB(t,e,r){let n=e?"Hide":`+${r} ${r===1?"version":"versions"}`;return d`<button type="button" class="${I({"packages-row-expand":!0,expanded:e})}" data-package-expand="${t}" aria-expanded="${String(e)}" aria-label="${e?`Hide older versions of ${t}`:`Show older versions of ${t}`}" data-tooltip="${e?"Hide older versions":`Show older versions (${r})`}"><span class="packages-row-expand-chevron" aria-hidden="true"></span> <span class="packages-row-expand-label">${n}</span></button>`}function KB(t,e,r){let n=jr().get(t),i=[...(n?y2(n,t,"live",r):new Map).values()].reduce((s,a)=>s+a.length,0);return d`<div class="bundles-tabs" role="tablist"><button type="button" class="bundles-tab active" data-package-tab="overview" aria-selected="true" role="tab">Overview</button> <span class="bundles-tabs-spacer"></span> ${i>0?d`<button type="button" class="bundles-tab bundles-tab-action" data-package-tab="issues">Issues (${i}) →</button>`:m}</div>${GB(t,e,r)}`}function y2(t,e,r="live",n){let o=new Map,i=n===void 0?t.files:t.byVersion.get(n)?.files??new Map;for(let[s,a]of i){let c=a.filter(f=>{let h=l.triage.get(j(f))?.triage??null;return r==="invalid"?h==="invalid":r==="deleted"?h==="deleted":h!=="invalid"&&h!=="deleted"});if(c.length===0)continue;let u=v2(e,s);o.has(u)||o.set(u,[]);let p=o.get(u);for(let f of c)p.push(f)}return o}function GB(t,e,r){let n={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let f of e.findings){let h=ae(f,l.severityMode);n[h]!==void 0&&n[h]++}let o=Ee.filter(f=>n[f]>0),i=[...e.files.entries()].toSorted(([f,h],[g,y])=>y.length!==h.length?y.length-h.length:f.localeCompare(g)),s=[...e.reports].toSorted((f,h)=>f.localeCompare(h)),c=jr().get(t)?.repos,u=c&&c.size===1?[...c][0]:null,p=u?/^https?:/iu.test(u)?u:`https://github.com/${u}`:null;return d`<dl class="packages-detail-meta"><dt>Package</dt><dd class="mono">${t}</dd>${r?d`<dt>Version</dt><dd class="mono">${r}</dd>`:m} ${p?d`<dt>Repository</dt><dd class="mono"><a href="${p}" target="_blank" rel="noopener">${u}</a></dd>`:m}<dt>Findings</dt><dd>${e.findings.length}</dd><dt>Files</dt><dd>${e.files.size}</dd><dt>Reports</dt><dd>${e.reports.size}</dd></dl>${o.length>0?d`<div class="packages-detail-chips">${o.map(f=>d`<span class="${`tree-count-chip ${f}`}">${n[f]} ${f.replaceAll("_"," ")}</span>`)}</div>`:m}<h3 class="packages-detail-section">Reports</h3><ul class="packages-detail-reports">${s.map(f=>{let h=be[Ke(f)]??be.default;return d`<li><button type="button" class="packages-detail-report" data-tooltip="${f}" data-package-report="${f}">${Z(h)}<span class="packages-detail-report-label">${ke(f)}</span></button></li>`})}</ul><h3 class="packages-detail-section">Files</h3><ul class="packages-detail-files">${i.map(([f,h])=>{let g=v2(t,f);return d`<li class="packages-detail-file"><span class="packages-detail-file-path mono" title="${f}">${g}</span> <span class="packages-detail-file-count">${h.length}</span></li>`})}</ul>`}function v2(t,e){for(let r of["node_modules","dependencies"]){let n=`${r}/${t}/`,o=e.indexOf(n);if(o>=0)return e.slice(o+n.length)}return e.startsWith(`${t}/`)?e.slice(t.length+1):e}var DB,w2=w(()=>{"use strict";M();Me();vt();fn();bt();O();ot();ue();Rr();Bi();Rc();DB=["inprogress","fixed","invalid","deleted"]});function k2(){lr().catch(()=>{});let t=bi(),e={inprogress:0,fixed:0,invalid:0,deleted:0},r=[];for(let[p,f]of t){let h=[],g=new Map;for(let y of f.findings){let b=l.triage.get(j(y))?.triage??null;b==="inprogress"?e.inprogress++:b==="fixed"?e.fixed++:b==="invalid"?e.invalid++:b==="deleted"&&e.deleted++,b===l.shownTriage&&(h.push(y),g.has(y.file)||g.set(y.file,[]),g.get(y.file).push(y))}h.length>0&&r.push([p,{findings:h,files:g,reports:f.reports}])}let n=l.selectedRepository,o=n?r.find(([p])=>p===n)??null:null;if(o&&l.repositoryDetailsTab==="issues")return ZB(o[0],o[1]);let i=l.repositoriesSearchQuery.trim().toLowerCase(),s=i?r.filter(([p])=>p.toLowerCase().includes(i)||Ge(p).toLowerCase().includes(i)):r.slice();XB(s,l.repositoriesSortBy);let a=r.reduce((p,[,f])=>p+f.findings.length,0),c=new Set;for(let[,p]of r)for(let f of p.reports)c.add(f);let u=o?"packages-layout open":"packages-layout";return d`<div class="${I({"packages-view":!0,"with-details":!!o})}"><header class="page-head"><div class="page-title"><h1>Repositories</h1><div class="meta-row"><span>${s.length===r.length?d`${r.length} ${r.length===1?"repository":"repositories"}`:d`${s.length} of ${r.length} ${r.length===1?"repository":"repositories"}`}</span> ${a>0?d`<span>${a} ${a===1?"finding":"findings"} across ${c.size} ${c.size===1?"report":"reports"}</span>`:m}</div></div>${qB(e)}</header>${r.length===0?d`<p style="color:var(--muted)">${t.size===0?"Indexing reports\u2026 this view populates as the OPFS scan finishes.":l.shownTriage?`No ${l.shownTriage} findings in any repository.`:"No untriaged findings in any repository."}</p>`:s.length===0?d`<p style="color:var(--muted)">No repositories match "${l.repositoriesSearchQuery}".</p>`:d`<div class="${u}"><ul class="packages-list">${te(s,([p])=>p,([p,f])=>QB(p,f,p===n))}</ul>${o?d`<aside class="packages-details" id="repositories-details"><header class="packages-details-bar"><span class="packages-details-label">Details</span> <button type="button" class="packages-details-close" data-deselect-repository aria-label="Close details">×</button></header><div class="packages-details-body">${e4(o[0],o[1])}</div></aside>`:m}</div>`}</div>`}function qB(t){return d`<div class="packages-toolbar"><entity-search kind="repositories"></entity-search><entity-sort kind="repositories"></entity-sort><triage-selector variant="packages" .counts="${t}" .states="${YB}"></triage-selector></div>`}function XB(t,e){let r=e==="name-asc"?(n,o)=>Ge(n[0]).localeCompare(Ge(o[0])):e==="files-desc"?(n,o)=>o[1].files.size-n[1].files.size||Ge(n[0]).localeCompare(Ge(o[0])):e==="reports-desc"?(n,o)=>o[1].reports.size-n[1].reports.size||Ge(n[0]).localeCompare(Ge(o[0])):(n,o)=>o[1].findings.length-n[1].findings.length||Ge(n[0]).localeCompare(Ge(o[0]));t.sort(r)}function JB(t){let e={live:0,invalid:0,deleted:0};if(!t)return e;for(let r of t.files.values())for(let n of r){let o=l.triage.get(j(n))?.triage??null;o==="invalid"?e.invalid++:o==="deleted"?e.deleted++:e.live++}return e}function ZB(t,e){let r=bi().get(t),n=JB(r),o=l.repositorySlideTriage??"live",i=r?x2(r,o):new Map,s=[...i.values()].reduce((u,p)=>u+p.length,0),a=o==="live"?s===1?"issue":"issues":s===1?`${o} issue`:`${o} issues`,c=o==="live"?"No live issues for this repository.":`No ${o} issues for this repository.`;return d`<div class="packages-view packages-slide-view"><header class="bundles-slide-bar"><button type="button" class="bundles-slide-back" data-action="repository-slide-back" aria-label="Back to repositories">← Back</button><div class="bundles-slide-title"><div class="bundles-slide-name">${Ge(t)}</div><div class="bundles-slide-integrity">${s} ${a} · ${e.files.size} ${e.files.size===1?"file":"files"} · ${e.reports.size} ${e.reports.size===1?"report":"reports"}</div></div><slide-triage-tabs kind="repository" .counts="${n}"></slide-triage-tabs></header><div class="bundles-slide-body">${i.size===0?d`<div class="bundle-issues-empty">${c}</div>`:Ec(i,{kind:"repository",bucketKey:t})}</div></div>`}function QB(t,e,r){let n={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let a of e.findings){let c=ae(a,l.severityMode);n[c]!==void 0&&n[c]++}let o=Ee.filter(a=>n[a]>0),i=Lt(t),s=Ge(t);return d`<li class="${r?"selected":""}" data-select-repository="${t}"><span class="packages-dot" style="${ve({background:i})}"></span><div class="packages-row-text"><span class="packages-name">${s}</span> <span class="packages-row-meta">${e.findings.length} ${e.findings.length===1?"finding":"findings"} · ${e.files.size} ${e.files.size===1?"file":"files"} · ${e.reports.size} ${e.reports.size===1?"report":"reports"}</span></div>${o.length>0?d`<div class="packages-row-chips">${o.map(a=>d`<span class="${`tree-count-chip ${a}`}" title="${a.replaceAll("_"," ")}">${n[a]}</span>`)}</div>`:m} <button type="button" class="packages-row-issues" data-repository-row-issues="${t}" aria-label="${`Open issues for ${s}`}">Issues →</button></li>`}function e4(t,e){let r=bi().get(t),o=[...(r?x2(r):new Map).values()].reduce((i,s)=>i+s.length,0);return d`<div class="bundles-tabs" role="tablist"><button type="button" class="bundles-tab active" data-repository-tab="overview" aria-selected="true" role="tab">Overview</button> <span class="bundles-tabs-spacer"></span> ${o>0?d`<button type="button" class="bundles-tab bundles-tab-action" data-repository-tab="issues">Issues (${o}) →</button>`:m}</div>${t4(t,e)}`}function x2(t,e="live"){let r=new Map;for(let[n,o]of t.files){let i=o.filter(s=>{let a=l.triage.get(j(s))?.triage??null;return e==="invalid"?a==="invalid":e==="deleted"?a==="deleted":a!=="invalid"&&a!=="deleted"});i.length>0&&r.set(n,i)}return r}function t4(t,e){let r={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let a of e.findings){let c=ae(a,l.severityMode);r[c]!==void 0&&r[c]++}let n=Ee.filter(a=>r[a]>0),o=[...e.files.entries()].toSorted(([a,c],[u,p])=>p.length!==c.length?p.length-c.length:a.localeCompare(u)),i=[...e.reports].toSorted((a,c)=>a.localeCompare(c)),s=/^https?:/iu.test(t)?t:`https://github.com/${t}`;return d`<dl class="packages-detail-meta"><dt>Repository</dt><dd class="mono"><a href="${s}" target="_blank" rel="noopener">${Ge(t)}</a></dd><dt>Findings</dt><dd>${e.findings.length}</dd><dt>Files</dt><dd>${e.files.size}</dd><dt>Reports</dt><dd>${e.reports.size}</dd></dl>${n.length>0?d`<div class="packages-detail-chips">${n.map(a=>d`<span class="${`tree-count-chip ${a}`}">${r[a]} ${a.replaceAll("_"," ")}</span>`)}</div>`:m}<h3 class="packages-detail-section">Reports</h3><ul class="packages-detail-reports">${i.map(a=>{let c=be[Ke(a)]??be.default;return d`<li><button type="button" class="packages-detail-report" data-tooltip="${a}" data-package-report="${a}">${Z(c)}<span class="packages-detail-report-label">${ke(a)}</span></button></li>`})}</ul><h3 class="packages-detail-section">Files</h3><ul class="packages-detail-files">${o.map(([a,c])=>d`<li class="packages-detail-file"><span class="packages-detail-file-path mono" title="${a}">${a}</span> <span class="packages-detail-file-count">${c.length}</span></li>`)}</ul>`}var YB,$2=w(()=>{"use strict";M();Me();vt();fn();bt();O();ot();ue();Rr();Bi();Rc();YB=["inprogress","fixed","invalid","deleted"]});function _2(t,e){let r=new Set(t),n=new Set,o=new Map,i=new Map(t.map((s,a)=>[s,a]));for(let s of e){let a=[...new Map(s.members.map(h=>[h.id,h])).values()],c=a.filter(h=>r.has(h.id));if(c.length===0)continue;for(let h of c)n.add(h.id);let u=a.filter(h=>r.has(h.id)||h.isApp),p=JSON.stringify([a.map(h=>h.id).toSorted(),u.map(h=>[h.id,h.title??"",h.source??null,h.revalidate??""]).toSorted(([h],[g])=>h.localeCompare(g))]),f=o.get(p);f||(f={key:p,members:u,reports:[],first:Math.min(...c.map(h=>i.get(h.id)))},o.set(p,f)),f.reports.some(h=>h.name===s.report)||f.reports.push({name:s.report,findingId:c[0].id,rowIndex:s.index})}return{rows:[...o.values()].toSorted((s,a)=>s.first-a.first),missing:t.filter(s=>!n.has(s))}}var S2=w(()=>{"use strict"});function Ni(t,e,r){return`${t} ${t===1?e:r}`}function r4(t,e){let r=Pe(l.triage.get(t)),n=e.filter(({name:a})=>_n(l.triage,t,a)),o=r??(n.length>0?"ignored":null);if(!o)return m;let i=o==="ignored"&&n.length<e.length,s=i?`Ignored in ${n.length}/${e.length} reports`:ro[o];return d`<span class="${`links-finding-status triage-${o}`}" data-tooltip="${i?n.map(({name:a})=>ke(a)).join(", "):m}">${s}</span>`}function Gy({id:t,title:e},r=[],n=!0,o=m){let i=r[0]?.name,s=Vl(t),a=Ai(t)??s;return d`<li class="${n?"links-finding":"links-finding links-finding-context"}">${i?d`<button type="button" class="links-finding-id mono" data-links-preview="${t}" data-preview-report="${i}" data-preview-row="${r[0].rowIndex??m}" data-tooltip="${s}" aria-haspopup="dialog">${a}</button>`:Sr(t)?d`<a class="links-finding-id mono" href="${`#${wi({id:t})}`}" data-tooltip="${s}">${a}</a>`:d`<span class="links-finding-id mono">${a}</span>`} ${e?d`<span class="links-finding-title">${e}</span>`:m} ${r4(t,r)} ${n?m:d`<span class="links-member-context">not in this link</span>`} ${o}</li>`}function C2(t){return d`<div class="links-finding-reports">${t.map(({name:e,findingId:r})=>d`<button type="button" class="links-finding-report report-button" data-tooltip="${ke(e)}" data-links-report="${e}" data-links-finding="${r}">${Z(We[Ke(e)]??We.default)}<span class="links-finding-report-label report-button-label">${ke(e)}</span></button>`)}</div>`}function n4(t,e){let r=t.reports.toSorted((n,o)=>ke(n.name).localeCompare(ke(o.name)));if(t.members.length===1){let n=t.members[0];return d`<li class="links-report-row links-report-row-single"><ul class="links-row-members">${Gy(n,r,e.has(n.id),C2(r))}</ul></li>`}return d`<li class="links-report-row"><div class="links-report-row-head"><span class="links-row-count">${Ni(t.members.length,"finding","findings")} in row</span> ${C2(r)}</div><ul class="links-row-members">${t.members.map(n=>Gy(n,r,e.has(n.id)))}</ul></li>`}function o4(t,e){let{rows:r,missing:n}=_2(t,_m(t)),o=new Set(t);return d`<li class="links-group"><div class="links-group-head"><span class="links-group-index">Link ${e+1}</span> <span class="links-group-count">${Ni(t.length,"finding","findings")}</span></div><ul class="links-group-rows">${te(r,i=>i.key,i=>n4(i,o))}</ul>${n.length>0?d`<div class="links-unlocated"><div class="links-finding-missing">Not in your reports</div><ul class="links-row-members">${n.map(i=>Gy({id:i,title:$m(i)}))}</ul></div>`:m}</li>`}function E2(t=m){let e=l.currentLinks;if(!e)return m;lr().catch(()=>{});let{name:r,groups:n,skipped:o}=e,i=new Set,s=new Set,a=0;for(let c of n)for(let u of c){if(i.has(u))continue;i.add(u);let p=yi(u);if(p.length!==0){a++;for(let f of p)s.add(f)}}return d`<div class="links-view"><header class="page-head"><div class="page-title"><h1>Links${t}</h1><div class="meta-row"><span class="links-file-name" data-tooltip="${r}">${Z(be[Ke(r)]??be.default)}${ke(r)}</span> <span>${Ni(n.length,"link","links")}</span> <span>${Ni(i.size,"finding","findings")}</span> ${s.size>0?d`<span>found in ${Ni(s.size,"report","reports")}</span>`:m}</div></div></header>${a<i.size?d`<p class="links-note">${Ni(i.size-a,"linked finding is","linked findings are")} not in any report you hold. Import the reports they came from and this page fills in.</p>`:m} ${o>0?d`<p class="links-note">${Ni(o,"entry","entries")} in this file could not be linked — an id the app can't follow (a session-local number, or something that isn't an id at all).</p>`:m} ${n.length===0?d`<p class="links-empty">This file declares no links: every entry in it named fewer than two findings this app can reach.</p>`:d`<ol class="links-list">${te(n,(c,u)=>`${u}:${c.join(" ")}`,(c,u)=>o4(c,u))}</ol>`}</div>`}var R2=w(()=>{"use strict";M();vt();bt();O();Rr();ue();S2();Oe()});function i4(t,e,r){let n=new Set(e);for(let o of r)n.add(o);return t.filter(o=>n.has(o))}function A2(){if(l.currentWorkspace){let t=re().find(r=>r.id===l.currentWorkspace),e=l.reports.map(r=>r.fileName).filter(r=>typeof r=="string");return{mode:"workspace",workspaceId:l.currentWorkspace,fileNames:t?i4(t.reports??[],l.storedFiles??[],e):e}}if(l.currentFile){let t=re().find(e=>Array.isArray(e.reports)&&e.reports.includes(l.currentFile));return t?{mode:"single",workspaceId:t.id,fileNames:[l.currentFile]}:null}return null}var T2=w(()=>{"use strict";O()});function M2({workspaceId:t,items:e}={}){return le("sync-upload-dialog",{workspaceId:t??"",items:Array.isArray(e)?[...e]:[]})}var qy,I2=w(()=>{"use strict";M();O();Er();fe();Tr();Bn();qy=class extends F{static styles=[...F.styles,A(qe)];static properties={workspaceId:{type:String},items:{type:Array},_uploading:{state:!0},_errors:{state:!0},_done:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.items=[],this._uploading=!1,this._errors=[],this._done=!1,this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="upload"]')?.focus()}_onClose=()=>this._finish({uploaded:[],failed:[]});_onCancel=()=>this._finish({uploaded:[],failed:[]});_onUpload=async()=>{if(this._uploading)return;this._uploading=!0,this._errors=[];let e=[],r=[];for(let n of this.items)try{let o;if(n.kind==="bundle")o=await S1(this.workspaceId,n.identifier);else{let i=await ei(n.identifier);o=await Lu(this.workspaceId,n.identifier,i)}if(o.ok)e.push({kind:n.kind,identifier:n.identifier});else{let i=o.reason??"unknown";r.push({kind:n.kind,identifier:n.identifier,reason:i}),this._errors=[...this._errors,{label:Lo(n),reason:i}]}}catch(o){let i=o?.message??String(o);r.push({kind:n.kind,identifier:n.identifier,reason:i}),this._errors=[...this._errors,{label:Lo(n),reason:i}]}this._uploading=!1,this._done=!0,r.length===0&&this._finish({uploaded:e,failed:r})};render(){let{count:e,singular:r,kindLabel:n}=Tp(this.items),o=r?d`Upload <strong>"${Lo(this.items[0])}"</strong> to the workspace's remote inventory?`:d`Upload <strong>${e}</strong> local ${n} to the workspace's remote inventory?`,i=r?m:Mp(this.items),s=this._uploading?r?"Uploading\u2026":`Uploading ${e} ${n}\u2026`:r?"Upload":`Upload ${e}`;return d`<dialog @close="${this._onClose}"><header><h3>Upload to remote</h3></header><p class="lwd-body">${o}</p>${i}<p class="nwd-note">End-to-end encrypted with the workspace key — only workspace members can decrypt the uploaded content.</p>${Ip(this._errors)}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._uploading}">${this._done&&this._errors.length>0?"Close":"Cancel"}</button> ${this._done&&this._errors.length>0?m:d`<button type="button" data-role="upload" @click="${this._onUpload}" ?disabled="${this._uploading||e===0}">${s}</button>`}</footer></dialog>`}};customElements.define("sync-upload-dialog",qy)});var F2,L2=w(()=>{F2=`.rec-list{margin:.2rem 0 .55rem;padding:0;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:var(--ok, #16a34a)}.rec-status-reuploaded{color:var(--accent, #2563eb)}.rec-status-failed,.rec-status-check-failed{color:var(--warning, #d97706)}.rec-status-missing{color:var(--critical, #dc2626)}.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, #f87171);font-size:.76rem;line-height:1.4}
123
+ `});function B2({workspaceId:t,cloudCount:e,localFileNames:r,localBundles:n}={}){return le("objstore-recovery-dialog",{workspaceId:t??"",cloudCount:typeof e=="number"?e:0,localFileNames:Array.isArray(r)?[...r]:[],localBundles:Array.isArray(n)?[...n]:[]})}var a4,Yy,O2=w(()=>{"use strict";M();Er();fe();Ay();Tr();L2();a4={checking:"checking\u2026",good:"available",reuploaded:"re-uploaded",failed:"re-upload failed","check-failed":"check failed",missing:"missing"},Yy=class extends F{static styles=[...F.styles,A(qe),A(F2)];static properties={workspaceId:{type:String},cloudCount:{type:Number},localFileNames:{type:Array},localBundles:{type:Array},_rows:{state:!0},_running:{state:!0},_ran:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.cloudCount=0,this.localFileNames=[],this.localBundles=[],this._rows=[],this._running=!1,this._ran=!1,this._error=null,this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="recheck"]')?.focus()}_result(){return{items:this._rows,counts:this._counts()}}_onClose=()=>this._finish(this._ran?this._result():null);_onCancel=()=>this._finish(this._ran?this._result():null);_counts(){let e={good:0,reuploaded:0,failed:0,"check-failed":0,missing:0};for(let r of this._rows)r.status in e&&(e[r.status]+=1);return e}_onRecheck=async()=>{if(!this._running){this._running=!0,this._error=null,this._rows=[];try{let{items:e}=await C1(this.workspaceId,{onList:r=>{this._rows=r},onItem:r=>{this._rows=this._rows.map(n=>n.resourceTag===r.resourceTag?r:n)}});this._rows=e}catch(e){this._error=e?.message??String(e)}finally{this._running=!1,this._ran=!0}}};_downloadableItems(){let e=new Set(this.localFileNames),r=new Set(this.localBundles),n=[];for(let o of this._rows)o.status!=="good"||!o.identifier||(o.kind==="report"&&!e.has(o.identifier)?n.push({kind:"report",identifier:o.identifier}):o.kind==="bundle"&&!r.has(o.identifier)&&n.push({kind:"bundle",identifier:o.identifier,label:o.label}));return n}_onDownload=async()=>{let e=this._downloadableItems();e.length!==0&&await Np({workspaceId:this.workspaceId,items:e})};_rowsSection(){return this._rows.length===0?this._running?d`<p class="lwd-body">Fetching remote listing…</p>`:m:d`<ul class="rec-list">${this._rows.map(e=>d`<li class="rec-row"><span class="rec-label">${e.label}${e.kind==="bundle"?d`<span class="lwd-kind-tag">bundle</span>`:m}</span> <span class="${`rec-status rec-status-${e.status}`}" title="${e.detail??m}">${a4[e.status]??e.status}</span></li>`)}</ul>`}_summarySection(){if(!this._ran||this._rows.length===0)return m;let e=this._counts(),r=[];return e.good&&r.push(`${e.good} available`),e.reuploaded&&r.push(`${e.reuploaded} re-uploaded`),e.failed&&r.push(`${e.failed} failed`),e["check-failed"]&&r.push(`${e["check-failed"]} check failed`),e.missing&&r.push(`${e.missing} missing`),r.length>0?d`<p class="rec-summary" role="status" aria-live="polite">${r.join(" \xB7 ")}</p>`:m}render(){let e=this.cloudCount===1?"":"s",r=this._ran?m:d`<p class="lwd-body">Re-check ${this.cloudCount>0?d`the <strong>${this.cloudCount}</strong>`:m}remote object${e} for this workspace. Each is re-fetched from the relay; any whose bytes are missing are re-uploaded from a matching local copy.</p>`,n=this._ran&&this._rows.length===0&&!this._error?d`<p class="lwd-empty">No remote objects to check.</p>`:m,o=this._ran?this._downloadableItems().length:0;return d`<dialog @close="${this._onClose}"><header><h3>Re-check cloud storage</h3></header>${r} ${this._rowsSection()} ${n} ${this._summarySection()} ${this._error?d`<p class="rec-error" role="alert">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> ${o>0?d`<button type="button" data-role="download" @click="${this._onDownload}" ?disabled="${this._running}">Download ${o} not stored locally</button>`:m} <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._running?"Re-checking\u2026":this._ran?"Re-check again":"Re-check"}</button></footer></dialog>`}};customElements.define("objstore-recovery-dialog",Yy)});function Zy(){let t=ly(l.reports);if(!t)return null;let e=Object.keys(t),n=qt().filter(p=>ze(p).commonTriage===l.shownTriage),o=ay(n,l.severityMode),i=Cp(t,o),s=new Map,a=new Map,c=new Map;for(let p of n)for(let f of p){let h=ae(f,l.severityMode);s.has(f.file)||s.set(f.file,new Set),s.get(f.file).add(h);let g=ye(f)?.color??"none";a.has(f.file)||a.set(f.file,new Set),a.get(f.file).add(g),c.has(f.file)||c.set(f.file,[]),c.get(f.file).push({severity:h,color:g})}let u;return R.focusedPkg?(u=e.filter(p=>(hC(p)??"__own__")===R.focusedPkg),R.showAll||(u=u.filter(p=>cy(p,o,i)))):u=R.showAll?e:e.filter(p=>cy(p,o,i)),{treeData:t,files:u,ownCounts:o,transitiveCounts:i,severitySets:s,colorSets:a,fileFindings:c}}function Qy(){let t=Ks();if(!t)return;let e=Zy();e&&t.refreshSidebar(e,{isBundleContext:l.currentView==="bundles"})}function ev(){let t=Ks();if(!t)return;let e=Zy();e&&t.refreshTopPkgs(e)}function l4(t){return`${ct[t]??t} findings`}function c4(t,e,r){return r?d`<repo-chip url="${r}"></repo-chip>`:l.currentWorkspace?e?d`<repo-chip url="${e}"></repo-chip>`:m:t?d`<repo-chip url="${l.repoUrl}" editable ?editing="${l.repoEditing}" ?empty="${!l.repoUrl}"></repo-chip>`:e?d`<repo-chip url="${e}"></repo-chip>`:m}function d4(t,e,r,n,o){let i=t.length,s=new Set(l.reports.map(ce=>ce.source)),a=s.size===1?[...s][0]:null,c=l.currentWorkspace?re().find(ce=>ce.id===l.currentWorkspace):null,u=l.currentWorkspace&&l.currentManagedTeam?l.managedTeams.find(ce=>ce.id===l.currentManagedTeam):null,p=u?`Team: ${u.name}`:c?`Workspace: ${c.name}`:a?l4(a):"Findings",f=a&&be[a]?a:"default",h=Z(be[f]),g=d`<svg class="file-icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"/><path d="M14 3v6h6"/></svg>`,y=m;e.length===1?y=d`<span class="file-chip" data-copy-report="${e[0]}" title="Copy report name">${h}<span>${e[0]}</span></span>`:e.length>1&&(y=d`<span class="file-chip" data-copy-report="${e.join(`
124
+ `)}" title="Copy report names">${g}<span>${e.length} reports</span></span>`);let b=l.reports.flatMap(ce=>ce.groups.flat()),x=`${i} ${`finding${i===1?"":"s"}`}`,$=a||l.currentWorkspace?cp.filter(ce=>ce!=="type"):cp,C=gS(b,$),U=l.currentWorkspace?U1(l.reports).map(ce=>Ei[ce]??ce):[],E=[...C,...U],B=m;if(i>0){let ce={};for(let Xe of t){let ht=ae(An(Xe),l.severityMode);ht&&(ce[ht]=(ce[ht]||0)+1)}let Zt=Ee.filter(Xe=>ce[Xe]>0);Zt.length>0&&(B=d`<span class="status-bar" aria-hidden="true">${Zt.map(Xe=>{let ht=`${ce[Xe]} ${Xe.replaceAll("_"," ")}`;return d`<span class="${`status-seg sev-${Xe}`}" style="${ve({flexGrow:ce[Xe]})}" title="${ht}"></span>`})}</span>`)}let N=new Set(l.reports.map(ce=>ce.repo??null)),K=N.size===1?[...N][0]:null,W=c4(r,n,K),he=d`<span class="sep" aria-hidden="true"></span>`,Ce=l.currentView==="files",Ot=(o??0)>1?d`<button type="button" class="${I({"files-toggle-btn":!0,active:Ce})}" data-action="toggle-files" aria-pressed="${String(Ce)}">${`Files: ${o}`}</button>`:m;return d`<header class="page-head"><div class="page-title"><h1>${p}${y}${W}${Ot}${j2()}</h1><div class="meta-row"><span>${x}</span> ${B} ${E.length>0?d`${he}${E.map(ce=>d`<span class="tag">${ce}</span>`)}`:m}</div></div></header>`}function j2(){if(H.status!=="online")return m;if(!u4.has(l.currentView))return m;let t=A2();if(!t)return m;let{workspaceId:e,fileNames:r,mode:n}=t;if(n==="single"){let y=r[0],b=Vg(e,y)?"cloud":"local";return p4({status:b,label:b,title:b==="cloud"?"Synced to remote":"Local only \u2014 click to upload",onClick:b==="local"?()=>P2({workspaceId:e,items:[{kind:"report",identifier:y}]}):null})}let o=re().find(y=>y.id===e),i=o&&Array.isArray(o.bundles)?o.bundles:[],s=g1(e),a=r.filter(y=>!Vg(e,y)),c=i.filter(y=>!h1(e,y)),u=[...a.map(y=>({kind:"report",identifier:y})),...c.map(y=>({kind:"bundle",identifier:y}))];if(s===0&&u.length===0)return m;let p=[s>0?`${s} in cloud`:null,u.length>0?`${u.length} local-only`:null,s>0?'click "cloud" to re-check storage':null,u.length>0?`click "local" to upload ${u.length}`:null].filter(Boolean).join(" \u2014 "),f=s===0?m:d`<button type="button" class="sync-badge-chunk cloud" aria-label="${`re-check ${s} cloud object${s===1?"":"s"}`}" @click="${y=>{y.stopPropagation(),B2({workspaceId:e,cloudCount:s,localFileNames:r,localBundles:i})}}">${W2()}<span>${s} cloud</span></button>`,h=u.length===0?m:d`<button type="button" class="sync-badge-chunk local" aria-label="${`${u.length} items not yet uploaded \u2014 open upload dialog`}" @click="${y=>{y.stopPropagation(),P2({workspaceId:e,items:u})}}">${V2()}<span>${u.length} local</span></button>`,g=s>0&&u.length>0?d`<span class="sync-badge-divider" aria-hidden="true"></span>`:m;return d`<div class="report-sync-badge report-sync-badge-clickable" data-status="mixed" title="${p}">${f}${g}${h}</div>`}function p4({status:t,label:e,title:r,onClick:n}){let o=t==="cloud"?W2():V2(),i=d`<span class="sync-badge-label">${e}</span>`;return typeof n!="function"?d`<span class="report-sync-badge" data-status="${t}" title="${r}" aria-label="${`report sync status: ${e}`}">${o}${i}</span>`:d`<button type="button" class="report-sync-badge report-sync-badge-clickable" data-status="${t}" data-tooltip="${r}" aria-label="${`report sync status: ${e}`}" @click="${n}">${o}${i}</button>`}function V2(){return d`<svg class="sync-badge-icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="14" width="20" height="8" rx="2" ry="2"/><line x1="6" y1="18" x2="6.01" y2="18"/><line x1="10" y1="18" x2="10.01" y2="18"/><path d="M6 14V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v10"/></svg>`}function W2(){return d`<svg class="sync-badge-icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17.5 19a4.5 4.5 0 1 0-1-8.9A6 6 0 0 0 5.07 13.5 4 4 0 0 0 6 21h11.5z"/></svg>`}async function P2({workspaceId:t,items:e}){let r=e.filter(n=>n.kind==="bundle");if(r.length>0){let n=await Dt(),o=new Map(n.map(i=>[i.integrity,i.name]));for(let i of r){let s=o.get(i.identifier);s&&(i.label=s)}}await M2({workspaceId:t,items:e})}function f4(t){return Object.values(t).some(r=>r>0)||l.filterSeverities.size>0?d`<severity-chips .counts="${t}"></severity-chips>`:m}function h4(t){return Object.values(t).some(r=>r>0)||l.filterColors.size>0?d`<triage-filter .counts="${t}"></triage-filter>`:m}function m4(t,e,r,n,o,i,s,a){let{showSource:c,showConfidence:u,showPriority:p,showGraphMode:f,showFileSort:h,kanbanMode:g,showRepo:y,hasComment:b,hasFix:v,hasFlagged:x,hasDuplicates:k,hasCrossContext:$,hasAppStacked:C,showSeverityMode:U,revalidateOptions:E,showPartial:B,canDropLayer:N,canDetailLayer:K,canUpstreamLens:W,confirmedLocked:he}=i;return d`<div class="toolbar"><div class="toolbar-row"><view-mode-buttons modes="${f?"kanban,focus,table,list,grouped,graph":"kanban,focus,table,list,grouped"}"></view-mode-buttons><findings-sort ?show-file="${h}" ?show-confidence="${u}" ?show-priority="${p}"></findings-sort>${c?d`<source-filter></source-filter>`:m} ${!he&&(u||E.length>0)?d`<conf-filter ?range-disabled="${!u}" .revalidateOptions="${E}" ?has-partial="${B}"></conf-filter>`:m} ${b||v||x||l.filterComment||l.filterFix||l.filterFlagged?d`<annotation-filter .hasComment="${b}" .hasFix="${v}" .hasFlagged="${x}"></annotation-filter>`:m} ${g?m:d`<triage-selector .counts="${r}"></triage-selector>`}<div class="toolbar-end"><download-button></download-button>${!l.currentWorkspace&&(k||l.filterDuplicates)||$||C||l.filterCrossContext||l.filterAppStacked?d`<annotation-filter group="context" .hasDuplicates="${k}" .hasCrossContext="${$}" .hasAppStacked="${C}"></annotation-filter>`:m} ${N||l.revalidateConflicts.size>0?d`<revalidation-switch ?can-drop="${N}" ?can-detail="${K}" ?can-upstream="${W&&N}" .upstreamDisabled="${l.showRevalidation===!1&&N}"></revalidation-switch>`:m}</div></div><div class="toolbar-row sev-row">${U?d`<severity-mode-switch></severity-mode-switch>`:m} ${f4(n)} ${s.analyzers.length>1||s.models.length>1?d`<analyzer-select .analyzers="${s.analyzers}" .models="${s.models}" .groups="${s.groups}"></analyzer-select>`:m} ${y&&a.length>1?d`<repo-filter .options="${a}"></repo-filter>`:m} ${h4(o)}<div class="search-row"><toolbar-search kind="findings"></toolbar-search><span class="result-count">${t} of ${e}</span></div></div></div>`}function Xy(t,e){return t.map(r=>({p:An(r),g:r})).toSorted((r,n)=>e(r.p,n.p)).map(r=>r.g)}function Ac(t,e=!1,r=null,n=!1,o=!1){return d`<finding-card data-gid="${se(t)}" .group="${t}" ?in-group="${e}" context="${r??m}" ?lazy="${n}" ?popup="${o}"></finding-card>`}function Jy(t,e={}){let{variant:r="kanban",active:n=!1,expandedTrackLast:o=!1}=e,i=ze(t),s=ft(t),a=dt(s)||"(untitled finding)",c=r==="kanban",u=r==="kanban-side",p=c&&l.currentWorkspace?Nl(s):null,f={"kanban-card":!0,"has-conflict":i.hasConflict,"focus-side-card":!c,"kanban-expanded-track-last":o,active:n};!i.hasConflict&&i.commonColor&&(f[`mark-${i.commonColor}`]=!0);let h=parseInt(s.line,10),g=Number.isFinite(h)?`:${h}`:"",y=ae(s,l.severityMode),b=g4[y]??"?",v=Ut(s)&&l.severityMode!=="original",x=ye(s),k=x?.flagged===!0,$=x?.fix??"",C=x?.comment??"",U=m;c&&$?U=Be($)?d`<a class="kanban-action kanban-fix-link" href="${$}" target="_blank" rel="noopener noreferrer" draggable="false" data-tooltip="${`Open fix link: ${$}`}" aria-label="${`Open fix link: ${$}`}">${pc}</a>`:d`<button type="button" class="kanban-action mark-fix" data-tooltip="${`Edit fix link: ${$}`}" aria-label="${`Edit fix link: ${$}`}">${pc}</button>`:c&&C&&(U=d`<button type="button" class="kanban-action mark-comment" data-tooltip="${`Edit comment: ${C}`}" aria-label="${`Edit comment: ${C}`}">${_p}</button>`);let E=d`<div class="kanban-badge-col"><span class="${`kanban-badge sev-${y}`}" title="${v?`${Ct(y)} \u2014 corrected from ${Ct(s.severity)}`:Ct(y)}" aria-label="${v?`Severity ${Ct(y)}, corrected from ${Ct(s.severity)}`:`Severity ${Ct(y)}`}">${b}${v?"*":""}</span> ${k?d`<span class="kanban-flag" title="Flagged" aria-label="Flagged">${Sp}</span>`:m} ${U}</div><span class="kanban-title">${a}</span><div class="kanban-meta"><span class="kanban-loc">${s.file}${g}</span> ${s.confidence===void 0||s.confidence===null?m:d`<span class="kanban-conf" title="${`Confidence ${s.confidence}/10`}">${s.confidence}</span>`} ${p?d`<span class="kanban-analyzer" role="img" title="${Ei[p]}" aria-label="${Ei[p]}">${Z(We[p])}</span>`:m}</div>`;return c?d`<div class="${I(f)}" data-gid="${se(t)}" data-kanban-source draggable="${xo(t,i).length>0?"true":"false"}" role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Open details for ${a}`}">${E}</div>`:u?d`<div class="${I(f)}" data-gid="${se(t)}" data-kanban-select role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Show details for ${a}`}">${E}</div>`:d`<div class="${I(f)}" data-gid="${se(t)}" data-focus-select role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Focus on ${a}`}">${E}</div>`}function b4(t){let{content:e,range:r,highlighted:n}=t,o=e.split(`
125
+ `).length,i=String(o).length;return d`<div class="focus-code-lines" style="${ve({"--lineno-width":`${i}ch`})}"><aside class="focus-code-gutter" aria-hidden="true">${Array.from({length:o},(s,a)=>{let c=a+1,p={"focus-code-lineno":!0,"focus-code-line-active":!!r&&c>=r.start&&c<=r.end};return d`<div class="${I(p)}" data-focus-code-line="${c}">${c}</div>`})}</aside><pre class="focus-code-source"><code>${typeof n=="string"?Z(n):e}</code></pre></div>`}function q2(t,e=m,r=!1){l.focusCodeTick;let n=YS(t),o=lc(t),i=n?"focus-main with-code":"focus-main",s=ve({"--focus-split":String(l.focusSplit)});return d`<div class="${i}" style="${s}"><div class="focus-pane focus-pane-card"><div class="focus-card-wrapper">${Ac(t,!1,"focus",!1,r)}</div></div>${e} ${n?d`<div class="focus-splitter" data-focus-splitter role="separator" tabindex="0" aria-orientation="vertical" aria-label="Resize the finding and code panes" aria-valuemin="${jd}" aria-valuemax="${Vd}" aria-valuenow="${Math.round(l.focusSplit)}" data-tooltip="Drag to resize · double-click to reset"></div><div class="focus-pane focus-pane-code">${n.loading?d`<div class="focus-code-empty">Loading source…</div>`:d`<header class="focus-code-bar" title="${n.file}"><span class="focus-code-file">${n.file}</span> ${n.range?d`<span class="focus-code-line">:${Ju(n.range)}</span>`:m} ${(o?.stack.length??0)>1?d`<div class="focus-code-nav"><button type="button" class="focus-code-nav-btn" data-code-history="back" ?disabled="${o.at===0}" aria-label="Back to the previously shown file">${tv}</button> <button type="button" class="focus-code-nav-btn" data-code-history="forward" ?disabled="${o.at===o.stack.length-1}" aria-label="Forward to the next shown file">${rv}</button></div>`:m}</header><div class="focus-code-body">${b4(n)}</div>`}</div>`:m}</div>`}function Y2(t,e,r=[],n=null){if(!t&&!n)return m;let o=t?ze(t):{},i=l.kanbanDetailFullscreen,s={"kanban-detail-modal":!0,fullscreen:i,"has-conflict":o.hasConflict},a=t?se(t):null,c=e?.items??[],u=c.findIndex(f=>se(f)===a),p=d`<div class="kanban-detail-actions"><button type="button" class="kanban-detail-expand detail-action" data-kanban-detail-fullscreen aria-pressed="${i?"true":"false"}" aria-label="${i?"Back to the readable width":"Fill the available space"}">${i?G2:K2}</button> <button type="button" class="kanban-detail-close detail-action" aria-label="Close details">×</button></div>`;return d`<div class="${I({"kanban-detail-backdrop":!0,"links-preview-backdrop":!!n})}"><div class="kanban-detail-dim"></div><div class="${I(s)}" role="dialog" aria-modal="true" aria-label="${n?"Finding preview":"Finding details"}">${i&&t?m:p}<div class="kanban-detail-body">${t?i?q2(t,p,!0):Ac(t,!1,"kanban-detail",!1,!0):d`<div class="links-preview-message" role="status">${n.error||"Loading finding\u2026"}</div>`}</div></div>${c.length===0?m:d`<aside class="kanban-detail-side" aria-label="${`${e.label} findings`}"><div class="kanban-detail-side-header"><span class="kanban-detail-side-pick"><select class="kanban-detail-side-select" data-kanban-column aria-label="Column to show">${r.map(f=>{let h=f.key===e.key,g=h?f.label:`${f.label} (${f.count})`;return d`<option value="${f.key}" data-gid="${f.firstGid}" .selected="${h}" ?disabled="${f.count===0}">${g}</option>`})}</select></span><div class="focus-nav"><button type="button" class="focus-nav-btn" data-kanban-nav="prev" ?disabled="${u===0}" aria-label="Previous finding">${tv}</button> <span class="count">${u<0?c.length:`${u+1} / ${c.length}`}</span> <button type="button" class="focus-nav-btn" data-kanban-nav="next" ?disabled="${u===c.length-1}" aria-label="Next finding">${rv}</button></div></div><div class="kanban-detail-side-body">${te(c,f=>se(f),f=>Jy(f,{variant:"kanban-side",active:se(f)===a}))}</div></aside>`}</div>`}function y4(t){if(l.viewMode==="table"){let r=l.sortBy==="file"?Xy(t,N2):t;if(r.length===0)return m;let n=l.tableSelectedGid?r.find(i=>se(i)===l.tableSelectedGid):null;return Jp=r,d`<div class="${n?"findings-table-layout open":"findings-table-layout"}"><div class="findings-table-list"><div class="finding-table-slot"></div></div>${n?d`<aside class="findings-table-details" id="findings-table-details" aria-label="Finding details"><button type="button" class="findings-table-details-close" data-table-deselect aria-label="Close details">×</button><div class="findings-table-details-body">${Ac(n)}</div></aside>`:m}</div>`}if(l.viewMode==="focus"){if(t.length===0)return m;let r=l.focusGid?t.findIndex(s=>se(s)===l.focusGid):-1;r<0&&(r=Math.min(D2,t.length-1)),D2=r;let n=t[r],o=r===0,i=r===t.length-1;return d`<div class="focus-view">${q2(n)}<aside class="focus-sidebar" aria-label="Up next"><div class="focus-sidebar-header"><span class="label">Up next</span><div class="focus-nav"><button type="button" class="focus-nav-btn" data-focus-nav="prev" ?disabled="${o}" aria-label="Previous finding">${tv}</button> <span class="count">${r+1} / ${t.length}</span> <button type="button" class="focus-nav-btn" data-focus-nav="next" ?disabled="${i}" aria-label="Next finding">${rv}</button></div></div><div class="focus-sidebar-body">${te(t,s=>se(s),s=>Jy(s,{variant:"focus",active:se(s)===se(n)}))}</div></aside></div>`}if(l.viewMode==="kanban"){let r=[{key:"untriaged",label:"Untriaged"},{key:"inprogress",label:"In progress"},{key:"fixed",label:"Fixed"},{key:"invalid",label:"Invalid"},{key:"deleted",label:"Deleted"},{key:"ignored",label:"Ignored"}],n=new Map(r.map(u=>[u.key,[]]));for(let u of t){let f=ze(u).commonTriage??"untriaged",h=n.get(f);h&&h.push(u)}let o=r.some(u=>u.key===l.kanbanExpandedColumn)?l.kanbanExpandedColumn:null,i=o?r.filter(u=>u.key===o):r,s={"--kanban-cols":String(r.length)},a=l.kanbanPopoverGid?t.find(u=>se(u)===l.kanbanPopoverGid):null,c=a?r.find(u=>u.key===(ze(a).commonTriage??"untriaged")):null;return d`<div class="kanban-board" style="${ve(s)}">${te(i,u=>u.key,u=>{let p=n.get(u.key),f=u.key===o;return d`<div class="${`kanban-column kanban-column-${u.key}${f?" expanded":""}`}" data-kanban-target="${u.key}"><div class="kanban-column-header"><span class="label">${u.label}</span> <span class="count">${p.length}</span> <button type="button" class="kanban-expand" data-kanban-expand="${u.key}" aria-pressed="${f}" aria-label="${f?"Show all columns":`Show only ${u.label}`}">${f?G2:K2}</button></div><div class="kanban-column-body">${p.length===0?d`<div class="kanban-empty">No ${u.label.toLowerCase()} findings.</div>`:te(p,h=>se(h),(h,g)=>Jy(h,{active:se(h)===l.kanbanPopoverGid,expandedTrackLast:(g+1)%r.length===0}))}</div></div>`})}</div>${Y2(a,c&&{key:c.key,label:c.label,items:n.get(c.key)},r.map(u=>{let p=n.get(u.key);return{key:u.key,label:u.label,count:p.length,firstGid:p.length>0?se(p[0]):""}}))}`}if(l.viewMode==="grouped"){let r=new Map;for(let o of t){let i=An(o).file;r.has(i)||r.set(i,[]),r.get(i).push(o)}let n=l.sortBy==="file"?[...r.keys()].toSorted():[...r.keys()];return d`${te(n,o=>o,o=>{let i=l.sortBy==="file"?Xy(r.get(o),(a,c)=>parseInt(a.line,10)-parseInt(c.line,10)):r.get(o),s=An(i[0]);return d`<div class="file-group"><div class="file-header"><span>${ib(s,ur(s))}</span> <span class="count">${i.length}</span></div><div class="file-body">${te(i,a=>se(a),a=>Ac(a,!1,null,!0))}</div></div>`})}`}let e=l.sortBy==="file"?Xy(t,N2):t;return d`${te(e,r=>se(r),r=>{let n=ft(r),o=R_(n,ur(n)),i=Ri(n),s=wn(n),a=r.length>1;return d`<div class="${I({"flat-group":!0,"multi-case":a})}"><div class="flat-group-loc"><span class="file">${ib(n,ur(n))}</span> ${o===m?m:d`<span class="line-num">${o}</span>`} ${s?d`<span class="meta">${s}</span>`:m} ${i?d`<span class="run-meta">${i}</span>`:m}</div>${Ac(r,!0,null,!0)}</div>`})}`}function v4(){l.bundleSourceFile&&Ii().catch(()=>{});let t=document.querySelector("#bundle-source-overlay-slot");t&&ie(f2(),t)}function _(){let t=z2;if(z2=l.currentView,t!==null&&t!==l.currentView&&typeof document.startViewTransition=="function"&&!matchMedia("(prefers-reduced-motion: reduce)").matches){document.startViewTransition(()=>H2());return}H2()}function ta(t){let e=document.querySelector(`#${t}`);return(!e||!T.contains(e)||T.firstElementChild!==e)&&(T.innerHTML=`<div id="${t}"></div>`,e=document.querySelector(`#${t}`)),e}function Oy(){let t=l.revalidateConflicts.size>0,e=!t&&ju(l.reports);return t?l.showRevalidation!==!1&&(Xp=l.showRevalidation,l.showRevalidation=!1):(Xp!==null&&(l.showRevalidation=Xp,Xp=null),!e&&l.showRevalidation===!1&&(l.showRevalidation=!0)),l.upstreamOnly&&(!e||l.showRevalidation===!1||!l.reports.some(r=>(r.groups??[]).some(n=>n.some(o=>o.isUpstream))))&&(l.upstreamOnly=!1),bo(l.showRevalidation,l.upstreamOnly),e}function H2(){Gt()||op(),v4(),Yu(l.reports),Xu(l.reports)&&$o();let t=Oy(),e=l.reports.some(L=>(L.groups??[]).some(z=>z.some(me=>me.isUpstream)));if(l.currentView==="bundles")if((l.bundles??[]).length===0)l.currentView="findings";else{js(l.bundleDetailsTab,l.bundleSourceFile)&&Ii().catch(()=>{});let L=ta("bundles-slot");L&&ie(g2(l.bundles),L);let z=l.bundleDetails,me=l.selectedBundle&&z&&(z.json||z.bundle);if(me&&l.bundleDetailsTab==="graph"){let Te=document.querySelector("#bundle-graph-slot");if(Te){let Rt=d2(l.bundleDetails);if(Rt){u2(Rt);let F5={hideAllFiles:!0,triageCounts:c2(l.bundleDetails,new Set(Rt.strippedToOrig.values())),triageStates:["inprogress","fixed","invalid","deleted"],showSplitOwnDirs:Rt.canSplitOwnDirs,showPackagesView:Rt.canPackagesView,showBundleLayouts:!0};dy(Te,Rt,F5,qp,Yp)}}}if(me&&!z.metadataOnly&&l.bundleDetailsTab==="terminal"){let Te=document.querySelector("#bundle-terminal-slot");Te&&pC(Te,l.bundleDetails)}T.classList.add("active"),Ue.classList.add("hidden"),document.title="DeepView \u2014 bundles";return}if(l.currentView==="packages"){let L=ta("packages-slot");L&&ie(b2(),L),T.classList.add("active"),Ue.classList.add("hidden"),document.title="DeepView \u2014 packages";return}if(l.currentView==="repositories"){let L=ta("repositories-slot");L&&ie(k2(),L),T.classList.add("active"),Ue.classList.add("hidden"),document.title="DeepView \u2014 repositories";return}if(l.currentView==="links"){if(l.currentLinks){let L=ta("links-slot"),z=Gt();L&&ie(d`${E2(j2())}${z?Y2(z.group,null,[],z):m}`,L),T.classList.add("active"),Ue.classList.add("hidden"),document.title=`DeepView \u2014 ${l.currentLinks.name}`;return}l.currentView="findings"}if(l.currentView==="scan"&&customElements.get("local-scan-page")){let L=ta("scan-slot");L&&!L.firstElementChild&&L.append(document.createElement("local-scan-page")),T.classList.add("active"),Ue.classList.add("hidden"),document.title="DeepView \u2014 scans";return}let r=w4[l.currentView];if(r){let L=ta(r.slot);if(L&&!L.firstElementChild){let z=document.createElement(r.tag);L.append(z),(async()=>{await customElements.whenDefined(r.tag),await z.updateComplete,cr(z.renderRoot)})().catch(()=>{})}T.classList.add("active"),Ue.classList.add("hidden"),document.title=r.title;return}if(l.reports.length===0)return;let n=qt(),o=l.viewMode==="kanban",i={inprogress:0,fixed:0,invalid:0,deleted:0,ignored:0},s=[];for(let L of n){let z=ze(L).commonTriage;z&&i[z]++,(o||z===l.shownTriage)&&s.push(L)}Object.defineProperty(s,"ruledOutIds",{value:n.ruledOutIds});let a=!1,c=!1,u=!1,p=!1;for(let L of n)for(let z of L){Ut(z)&&(p=!0);let me=ye(z);me&&(me.comment&&(a=!0),me.fix&&(c=!0),me.flagged===!0&&(u=!0))}let f=ep(),h=n.some(L=>L.some(z=>f.has(z.id)));h||(l.filterDuplicates="");let g=s.some(mb),y=s.some(gb);g||(l.filterCrossContext=""),y||(l.filterAppStacked="");let b=new Set,v=!1,x=!1,k=!1;for(let L of s)for(let z of L){let me=Yr(z);me&&b.add(me)}for(let L of Rb()){let z=!1,me=!1;for(let Te of L){let Rt=Fe(Te);Rt==="partial"&&(x=!0),!((Rt==="unreachable"||Rt==="refuted")&&(k=!0,l.currentWorkspace))&&(Rt==="revalidation"?z=!0:me=!0)}z&&me&&(v=!0)}let C=[...new Set(l.reports.map(L=>L.type))].join(", "),U=l.reports.map(L=>L.fileName),E=s.map(dr).filter(L=>L.length>0),B=E.length>0&&ub(E),N=hb(n),K=n.some(L=>L.some(z=>It(z.file))),W=n.some(L=>L.some(z=>!It(z.file))),he=!1,Ce=!1,Ot;e:for(let L of n)for(let z of L)if(!Ce)Ce=!0,Ot=z.file;else if(z.file!==Ot){he=!0;break e}let ce=n.some(L=>L.some(z=>!z.repo?.github&&!It(z.file))),Zt=new Set;for(let L of n)for(let z of L)!It(z.file)&&z.repo?.github&&Zt.add(z.repo.github);let Xe=Zt.size===1?[...Zt][0]:null,ht=new Set,jn=new Set;for(let L of n)for(let z of L)ht.add(z._analyzer??null),jn.add(Kl(z));let Of=Object.keys(Tb),da=L=>{if(L==null)return 1/0;let z=Of.indexOf(L);return z===-1?Of.length:z},qc=[...ht].toSorted((L,z)=>{let me=da(L),Te=da(z);return me!==Te?me-Te:String(L??"").localeCompare(String(z??""))}),ua=[...jn].toSorted(U2);if(l.filterAnalyzer){let L=l.filterAnalyzer===vo?null:l.filterAnalyzer;(!ht.has(L)||ht.size<2)&&(l.filterAnalyzer="")}if(l.filterModel){let L=l.filterModel===wo?null:l.filterModel;(!jn.has(L)||jn.size<2)&&(l.filterModel="")}let Ki=p_(b);l.filterRevalidate&&!Ki.some(L=>L.value===l.filterRevalidate)&&(l.filterRevalidate="");let pa=rp(s);pa&&(l.filterRevalidate="confirmed");let Pf=b.has("partial")&&Tn();Pf||(l.filterPartial="");let Yc=t&&(v||x||!l.currentWorkspace&&k),fa=!(t&&l.showRevalidation!==!1)&&!l.upstreamOnly&&K&&W;!fa&&l.filterSources.size>0&&l.filterSources.clear(),B||(l.filterConfMin=0,l.filterConfMax=10,(l.sortBy==="confidence-desc"||l.sortBy==="confidence-asc")&&(l.sortBy="severity")),!N&&(l.sortBy==="priority-desc"||l.sortBy==="priority-asc")&&(l.sortBy="severity"),!he&&l.sortBy==="file"&&(l.sortBy="severity");let S=V_(s),P={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},q={red:0,blue:0,green:0,gray:0,none:0};for(let L of S){if(L.length===1){let Te=ae(L[0],l.severityMode);P[Te]=(P[Te]||0)+1;let Rt=ye(L[0])?.color??"none";q[Rt]=(q[Rt]||0)+1;continue}let z=new Set(L.map(Te=>ae(Te,l.severityMode)));for(let Te of z)P[Te]=(P[Te]||0)+1;let me=new Set(L.map(Te=>ye(Te)?.color??"none"));for(let Te of me)q[Te]=(q[Te]||0)+1}let X=F_(S),Ae=[...X].toSorted(U2);if(l.filterRepo){let L=l.filterRepo===Ti?null:l.filterRepo;X.has(L)||(l.filterRepo="")}let Ze=np(ko(s)),Pt=ly(l.reports),ha=Pt?Object.keys(Pt).length:0,Gi=ha>1;!Gi&&l.currentView==="files"&&(l.currentView="findings"),!Gi&&l.viewMode==="graph"&&(l.viewMode="kanban");let Vn=d4(n,U,ce,Xe,ha);if(l.currentView==="files"){let L=ay(n,l.severityMode),z=document.querySelector("#header-slot"),me=document.querySelector("#tree-view-slot");(!z||!me||!T.contains(z)||!T.contains(me))&&(T.innerHTML='<div id="header-slot"></div><div id="tree-view-slot"></div>',z=document.querySelector("#header-slot"),me=document.querySelector("#tree-view-slot")),z&&ie(Vn,z),me&&ie(lC(Pt,L),me),T.classList.add("active"),Ue.classList.add("hidden"),document.title=`DeepView \u2014 ${C||"no analyzer"}`;return}let T5=l.viewMode==="table"&&l.tableSelectedGid&&Ze.some(L=>se(L)===l.tableSelectedGid),ma=null;l.viewMode==="graph"&&Pt&&(ma=Zy(),ma||(l.viewMode="kanban"));let Jc=!!ma,Uo="findings-content";T5&&(Uo+=" with-details"),Jc&&(Uo+=" with-graph"),o&&(Uo+=" with-kanban"),l.viewMode==="focus"&&(Uo+=" with-focus");let Mk=m,Zc=m,Ik=m;Jp=null,Jc||(Mk=m4(Ze.length,s.length,i,P,q,{showSource:fa,showConfidence:B,showPriority:N,showGraphMode:Gi,showFileSort:he,kanbanMode:o,showRepo:!!l.currentWorkspace,hasComment:a,revalidateOptions:Ki,showPartial:Pf,canDropLayer:t,canDetailLayer:Yc,canUpstreamLens:e,confirmedLocked:pa,hasFix:c,hasFlagged:u,hasDuplicates:h,hasCrossContext:g,hasAppStacked:y,showSeverityMode:p||l.severityMode==="original"},{analyzers:qc,models:ua,groups:S},Ae),l.shownTriage&&s.length===0?Zc=d`<p style="color:var(--muted); margin: 1rem 0;">No ${l.shownTriage} findings.</p>`:Ze.length===0&&s.length>0&&!o?Zc=d`<p style="color:var(--muted); margin: 1rem 0;">No findings match the current filters.</p>`:s.length===0&&(Zc=n.length>0?d`<p style="color:var(--green)">All ${C} issues triaged.</p>`:d`<p style="color:var(--green)">No ${C} issues found.</p>`),Ik=y4(Ze));let ga=document.querySelector("#header-slot"),Ir=T.querySelector(":scope > .findings-content"),M5=Ir&&Ir.querySelector(":scope > #findings-graph-slot"),I5=Ir&&Ir.querySelector(":scope > #findings-body-slot"),L5=Ir&&(M5?"graph":I5?"body":null)===(Jc?"graph":"body");if(!ga||!Ir||!T.contains(ga)||!T.contains(Ir)||!L5){let L=Jc?'<div id="findings-graph-slot"></div>':'<div id="toolbar-slot"></div><div id="empty-state-slot"></div><div id="findings-body-slot"></div>';T.innerHTML=`<div id="header-slot"></div><div class="${Uo}">${L}</div>`,ga=document.querySelector("#header-slot"),Ir=T.querySelector(":scope > .findings-content")}else Ir.className!==Uo&&(Ir.className=Uo);ga&&ie(Vn,ga);let Lk=document.querySelector("#toolbar-slot");Lk&&ie(Mk,Lk);let Fk=document.querySelector("#empty-state-slot");Fk&&ie(Zc,Fk);let Bk=document.querySelector("#findings-body-slot");if(Bk&&ie(Ik,Bk),ma){let L=document.querySelector("#findings-graph-slot");if(L){let me={extraTopRow:d`<view-mode-buttons modes="kanban,focus,table,list,grouped,graph"></view-mode-buttons>`,triageCounts:i,triageStates:["inprogress","fixed","invalid","deleted","ignored"]};dy(L,ma,me,Qy,ev)}}if(Jp){let L=T.querySelector(".finding-table-slot");L&&(ea||(ea=document.createElement("finding-table")),ea.items=Jp,ea.selectedGid=l.tableSelectedGid,ea.parentNode!==L&&L.append(ea))}T.classList.add("active"),Ue.classList.add("hidden"),document.title=`DeepView \u2014 ${C||"no analyzer"}`}var u4,N2,Jp,D2,ea,K2,G2,tv,rv,g4,z2,w4,U2,Xp,St=w(()=>{"use strict";M();Me();vt();fn();bt();Rr();O();Er();go();Nt();ue();ot();Xr();Mb();ab();Oe();bS();fc();mc();dC();Eo();uy();fC();Fn();oc();Bi();w2();$2();R2();ip();T2();Rc();kp();I2();O2();u4=new Set(["findings","files","links"]);N2=(t,e)=>t.file.localeCompare(e.file)||parseInt(t.line,10)-parseInt(e.line,10),Jp=null,D2=0,ea=null;K2=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 2H2v4M10 2h4v4M14 10v4h-4M6 14H2v-4"/></svg>`,G2=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 2v4H2M10 2v4h4M10 14v-4h4M6 14v-4H2"/></svg>`,tv=d`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 3 5 8l5 5"/></svg>`,rv=d`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 3 11 8l-5 5"/></svg>`,g4={critical:"C",high:"H",medium:"M",low:"L",high_bug:"H",bug:"B",informational:"i"};z2=null;w4={manage:{slot:"manage-slot",tag:"managed-admin-home",title:"DeepView \u2014 manage"},"admin-users":{slot:"admin-users-slot",tag:"managed-admin-users",title:"DeepView \u2014 users"},"manage-repos":{slot:"manage-repos-slot",tag:"managed-admin-repos",title:"DeepView \u2014 repositories"},"manage-reports":{slot:"manage-reports-slot",tag:"managed-admin-reports",title:"DeepView \u2014 reports"},"manage-bundles":{slot:"manage-bundles-slot",tag:"managed-admin-bundles",title:"DeepView \u2014 bundles"},"manage-history":{slot:"manage-history-slot",tag:"managed-admin-history",title:"DeepView \u2014 history"},"manage-teams":{slot:"manage-teams-slot",tag:"managed-admin-teams",title:"DeepView \u2014 teams"},"manage-scans":{slot:"manage-scans-slot",tag:"managed-admin-scans",title:"DeepView \u2014 scans"}},U2=(t,e)=>t==null&&e==null?0:t==null?1:e==null?-1:t.localeCompare(e),Xp=null});var JC={};O5(JC,{hydrateManagedReportTriage:()=>F4,initManagedTriagePush:()=>av,resetManagedTriage:()=>lv});function Z2(t){if(!t)return null;let e={};t.color&&(e.color=t.color);let r=Pe(t);return r&&(e.triage=r),typeof t.comment=="string"&&t.comment&&(e.comment=t.comment),typeof t.fix=="string"&&t.fix&&(e.fix=t.fix),typeof t.flagged=="boolean"&&(e.flagged=t.flagged),Object.keys(e).length>0?e:null}function ov(t){return t==null?"":JSON.stringify([t.color??"",t.triage??"",t.comment??"",t.fix??"",t.flagged])}function E4(t,e){return t.length>100?!1:e==null?!0:(e.color?.length??0)<=50&&(e.comment?.length??0)<=1e4&&(e.fix?.length??0)<=1e4}function Q2(){let t=new Set;for(let e of l.reports)for(let r of e.groups)for(let n of r)typeof n.id=="string"&&n.id&&t.add(n.id);return t}function iv(){return Array.isArray(l.managedReports)&&l.managedReports.length>0?l.managedReports:l.managedReport==null?[]:[l.managedReport]}function A4(t){let e=new Set,r=!1;for(let n of l.reports)if(n._managedReportId===t){r=!0;for(let o of n.groups??[])for(let i of o)typeof i.id=="string"&&i.id&&e.add(i.id)}return r||l.reports.length===0?e:new Set(Q2())}function T4(t){let e=iv();for(let r of l.reports)if(r._managedReportId!=null&&(r.groups??[]).some(n=>n.some(o=>o.id===t))){let n=e.find(o=>o.id===r._managedReportId);if(n)return n}return e[0]??null}function sv(){let t=l.managedSession;return l.serverMode==="managed"&&l.localMode!==!0&&t!=null&&O1(t.role,"triage")}function M4(t){return t>=400&&t<500&&t!==401&&t!==403&&t!==408&&t!==429}function I4(t,e){let r=Po.get(t.report.id);r==null&&(r={report:t.report,changes:new Map},Po.set(t.report.id,r));for(let n of e)r.changes.has(n)||r.changes.set(n,t.changes.get(n))}async function L4(t){if(!sv())return;let e=[...t.changes.keys()],r=0;for(;r<e.length;){let n=r,o={},i=0,s=C4;for(;r<e.length&&i<200;){let u=e[r],p=R4(`${JSON.stringify(u)}:${JSON.stringify(t.changes.get(u))},`);if(i>0&&s+p>262144)break;o[u]=t.changes.get(u),s+=p,i++,r++}let a=await L1(t.report.id,o,l.managedSession?.csrfToken),c=a>=200&&a<300;if(!c&&!M4(a)){I4(t,e.slice(n));return}c||console.warn("managed: the server refused a triage batch",t.report.id,a,Object.keys(o));for(let u of Object.keys(o))ra.set(u,ov(o[u]))}}function eE(){zn!=null&&(clearTimeout(zn),zn=null);let t=[...Po.values()];Po.clear();for(let e of t)nv=nv.then(()=>L4(e)).catch(r=>{console.warn("managed: triage push failed",r)})}function tE(){if(!(iv().length===0||!sv()||Tc.size===0)){for(let e of Q2()){let r=Z2(l.triage.get(e)),n=ov(r);if((ra.get(e)??"")===n)continue;if(!E4(e,r)){console.warn("managed: triage entry exceeds the server caps, kept local only",e),ra.set(e,n);continue}let o=T4(e);if(o==null||!Tc.has(o.id))continue;let i=Po.get(o.id);i==null&&(i={report:o,changes:new Map},Po.set(o.id,i)),i.changes.set(e,r)}Po.size!==0&&(zn!=null&&clearTimeout(zn),zn=setTimeout(eE,S4))}}function av(){J2||!sv()||(J2=!0,pg(tE))}function lv(){zn!=null&&(clearTimeout(zn),zn=null),Po.clear(),Tc.clear(),ra.clear()}async function F4(t,{renderView:e=!0}={}){let r=l.reports,n=()=>l.serverMode==="managed"&&l.localMode!==!0&&l.managedSession!=null&&l.reports===r&&iv().some(a=>a.id===t);if(!n()||(Tc.delete(t),eE(),await nv,!n()))return!1;let o=await I1(t);if(o==null||!n())return!1;let i=!1,s=A4(t);for(let a of s){if(!Object.hasOwn(o,a)){ra.delete(a);continue}let c=Z2(o[a]);ra.set(a,ov(c));let u=c?.triage==null?l.triage.get(a)?.ignoredReports:void 0;cg(l.triage,a,{...c,ignoredReports:u})&&(i=!0)}if(Tc.add(t),i){if(await we(),!n())return!1;e&&_()}return tE(),!0}var S4,C4,R4,ra,Tc,Po,zn,nv,J2,Py=w(()=>{"use strict";O();qg();P1();Nu();St();S4=500,C4=14;R4=t=>new TextEncoder().encode(t).length,ra=new Map,Tc=new Set,Po=new Map,zn=null,nv=Promise.resolve();J2=!1});var nE,rE=w(()=>{nE=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{width:260px;flex-shrink:0;height:100%;background:var(--surface);backdrop-filter:var(--glass-blur);border-right:1px solid var(--border);display:flex;flex-direction:column;transition:width .15s ease-out;overflow:hidden}:host(.collapsed){width:32px}:host([inert]) .brand-tag,:host([inert]) .sidebar-search,:host([inert]) .sidebar-actions,:host([inert]) #file-list,:host([inert]) #sidebar-toggle,:host([inert]) #encryption-toggle,:host([inert]) #storage-status{visibility:hidden}:host(.collapsed) .brand,:host(.collapsed) .sidebar-search,:host(.collapsed) #encryption-toggle,:host(.collapsed) #file-list{display:none}:host(.collapsed) .sidebar-header{padding:.5rem 0;justify-content:center}:host(.collapsed) .sidebar-actions{padding:.35rem 0;justify-content:center}:host(.collapsed) sidebar-delete-current,:host(.collapsed) #storage-status,:host(.collapsed) #sync-status .sync-label{display:none}:host(.collapsed) #sync-status{padding:.25rem;border:0}:host([data-mode="managed"]) #sidebar-toggle{display:none}.sidebar-header{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem .4rem;.brand{flex:1;min-width:0;display:flex;align-items:center;gap:.4rem;font-size:.95rem;font-weight:700;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;user-select:none}.brand-button{display:inline-flex;align-items:center;gap:.5rem;background:transparent;border:0;padding:0;margin:0;font:inherit;color:inherit;border-radius:4px;&:focus-visible{outline:2px solid var(--accent);outline-offset:2px}}.brand-tag{padding:.08rem .25rem;border:0;border-radius:4px;background:transparent;font:inherit;font-size:.65rem;font-weight:500;color:var(--muted);text-transform:lowercase;letter-spacing:.02em;&[role=button]{cursor:pointer}&[role=button]:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&:focus-visible{outline:2px solid var(--accent);outline-offset:2px}}}@media(display-mode:window-controls-overlay){.sidebar-header{min-height:env(titlebar-area-height,0px);padding-left:max(.75rem,env(titlebar-area-x,0px));-webkit-app-region:drag;app-region:drag;.brand-button,.brand-tag,#encryption-toggle{-webkit-app-region:no-drag;app-region:no-drag}#sidebar-toggle{display:none}}}#sidebar-toggle{flex-shrink:0;width:22px;height:22px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:4px;padding:0;&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}}#encryption-toggle{flex-shrink:0;width:22px;height:22px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:4px;padding:0;&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.encrypted{color:var(--accent)}&.locked-pending{color:light-dark(#b25b00,#f0a060);outline:1px dashed currentcolor;outline-offset:-2px}}#encryption-toggle[hidden]{display:none!important}.sidebar-search{display:flex;align-items:center;margin:0 .55rem .25rem;padding:0 .25rem 0 .55rem;background:rgb(from var(--bg) r g b / .45);border:1px solid var(--border);border-radius:7px;transition:background .12s,border-color .12s;-webkit-app-region:no-drag;app-region:no-drag;&:has(input:focus){border-color:var(--accent);background:rgb(from var(--text) r g b / .06)}.sidebar-search-icon{flex-shrink:0;color:var(--muted);pointer-events:none;margin-right:.4rem}& input{flex:1;min-width:0;padding:.3rem 0;background:transparent;color:var(--text);border:0;outline:none;font:inherit;font-size:.78rem;&::placeholder{color:var(--muted)}&:focus::placeholder{color:transparent}&::-webkit-search-cancel-button{display:none}}}sidebar-view-button{display:contents}sidebar-view-button[hidden]{display:none!important}.sidebar-view-btn{position:relative;flex-shrink:0;width:20px;height:20px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:3px;padding:0;margin-left:2px;transition:background .12s,color .12s;sidebar-view-button+sidebar-view-button>&{margin-left:.4rem}sidebar-view-button:last-of-type>&{margin-right:.1rem}& svg{width:14px;height:14px}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .08)}&.active{color:var(--accent);background:rgb(from var(--text) r g b / .1)}.view-btn-count{position:absolute;top:-4px;right:-4px;background:var(--bg);color:color-mix(in srgb,var(--muted),var(--text) 15%);font-size:8.5px;font-weight:600;border-radius:999px;padding:0 3px;min-width:11px;text-align:center;line-height:11px;font-variant-numeric:tabular-nums;pointer-events:none}&.active .view-btn-count{color:var(--accent)}}#file-list{list-style:none;flex:1;overflow-y:auto;overscroll-behavior:none;scrollbar-gutter:stable;-webkit-app-region:no-drag;app-region:no-drag;padding:0 .35rem .25rem 0;margin:0;scrollbar-width:thin;scrollbar-color:var(--border) transparent;&::-webkit-scrollbar{width:5px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}}.file-group-header{display:flex;align-items:center;justify-content:space-between;padding:.45rem .35rem .2rem .55rem;font-size:.62rem;font-weight:700;text-transform:uppercase;letter-spacing:.12em;color:var(--muted);user-select:none;&:first-child{padding-top:.25rem}}.file-group-header.workspace-header .workspace-header-actions{display:flex;align-items:center;gap:.35rem}.workspace-add{width:18px;height:18px;display:grid;place-items:center;background:transparent;color:var(--muted);border:1px solid transparent;border-radius:4px;padding:0;&:hover{color:var(--text);border-color:var(--accent)}}.file-item.workspace-item{display:flex;align-items:stretch;gap:.15rem}.file-item.workspace-item button.file-name{flex:1;min-width:0}.workspace-share,.workspace-export,.workspace-leave{flex-shrink:0;width:22px;align-self:center;height:22px;display:none;place-items:center;background:transparent;color:var(--muted);border:1px solid transparent;border-radius:4px;padding:0;&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .06);border-color:var(--accent)}}.workspace-leave:hover:not(:disabled){color:var(--critical, #f87171);border-color:var(--critical, #f87171)}@media(hover:hover){.file-item.workspace-item:hover .workspace-share,.file-item.workspace-item:hover .workspace-export,.file-item.workspace-item:hover .workspace-leave{display:grid}}.workspace-rename-input{width:100%;box-sizing:border-box;background:var(--surface);color:var(--text);border:1px solid var(--accent);border-radius:3px;padding:0 .25rem;margin:-1px 0;font:inherit;font-size:.76rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;outline:none}.file-item.team-item .team-icon{flex-shrink:0;color:var(--muted)}.file-item.team-bundle-item>.file-name{display:flex;align-items:center;gap:.5rem;width:100%;box-sizing:border-box;padding:.2rem .3rem .2rem 1.3rem;color:var(--muted);font-family:inherit;font-size:.78rem;text-align:left}.file-item.team-bundle-item .file-icon{flex-shrink:0;color:var(--muted)}.file-item.team-bundle-item .file-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.76rem;line-height:14.5px}.file-item{list-style:none;position:relative}.file-item.current:after{content:"";position:absolute;left:0;top:50%;transform:translateY(-50%);width:3px;height:18px;background:var(--accent);border-radius:0 2px 2px 0;pointer-events:none}.file-item button.file-name{display:flex;align-items:center;gap:.5rem;width:100%;box-sizing:border-box;padding:.2rem .3rem .2rem .55rem;background:transparent;color:var(--text);border:1px solid transparent;border-radius:0 5px 5px 0;font-family:inherit;font-size:.78rem;text-align:left;&:hover{background:rgb(from var(--text) r g b / .04)}.file-icon{flex-shrink:0;color:var(--muted)}.file-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.76rem;line-height:14.5px}}.file-item .file-count{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;color:var(--muted);opacity:.65;font-size:.68rem;font-weight:500;font-variant-numeric:tabular-nums}.file-item.current button.file-name{background:rgb(from var(--accent) r g b / .09);border-color:rgb(from var(--accent) r g b / .16);.file-icon,.file-count{color:var(--text)}}button:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}@media(prefers-reduced-motion:reduce){:host,*,*:before,*:after{transition:none!important}}.file-item.indented button.file-name{padding-left:1.3rem}.file-item.indented:before{content:"";position:absolute;left:.85rem;top:0;bottom:0;width:1px;background:var(--border)}.file-item.bundle-missing>.file-name,.file-item.report-missing>.file-name{display:flex;align-items:center;gap:.5rem;padding:.2rem .3rem .2rem 1.4rem;color:var(--muted);font-size:.78rem;font-style:italic;cursor:help;.file-icon{flex-shrink:0;color:var(--muted);font-style:normal}.file-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.76rem;line-height:14.5px}}:host-context(body.theme-pink) .workspace-rename-input,:host-context(body.theme-pink) .file-item button.file-name .file-label,:host-context(body.theme-pink) .file-item.bundle-missing .file-label,:host-context(body.theme-pink) .file-item.report-missing .file-label{font-family:inherit}.file-item.dragging button.file-name{opacity:.4}.file-item.workspace-item.drag-over button.file-name,.file-item.indented.drag-over button.file-name{background:rgb(from var(--accent) r g b / .12);border-color:var(--accent)}.file-group-header.drag-over{background:rgb(from var(--accent) r g b / .12);border-radius:4px}.sidebar-actions{padding:.35rem .55rem .45rem;border-top:1px solid var(--border);display:flex;gap:.35rem;align-items:center;justify-content:space-between;& button{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:4px;padding:.2rem .5rem;font-size:.72rem;font-family:inherit;-webkit-app-region:no-drag;app-region:no-drag;&:hover{color:var(--text);border-color:var(--accent)}&.danger:hover{color:var(--critical);border-color:var(--critical)}&[disabled]{opacity:.4;border-color:var(--border)!important;color:var(--muted)!important}}}sidebar-delete-current{display:contents}sidebar-delete-current[hidden]{display:none!important}sidebar-delete-current button{display:inline-flex;align-items:center;gap:.35rem;.trash-icon{flex-shrink:0}}#sync-status{display:inline-flex;align-items:center;gap:.35rem;border-color:transparent;&:hover{border-color:var(--accent)}.sync-dot{width:8px;height:8px;border-radius:50%;background:var(--muted);flex-shrink:0;box-shadow:0 0 0 1px rgb(from var(--text) r g b / .15)}&[data-status=online] .sync-dot{background:var(--green)}&[data-status=connecting] .sync-dot{background:var(--medium)}&[data-status=offline] .sync-dot{background:var(--critical)}}#sync-status[data-proxy-auth] .sync-dot{box-shadow:0 0 0 2px var(--accent)}#sync-status[data-degraded] .sync-dot{box-shadow:0 0 0 2px var(--medium)}#sync-status[hidden]{display:none}#storage-status{display:flex;align-items:center;gap:.4rem;margin:.3rem .55rem .45rem;padding:.3rem .55rem;background:rgb(from var(--medium) r g b / .12);border:1px solid rgb(from var(--medium) r g b / .3);border-radius:5px;color:light-dark(#b25b00,#f0a060);font-size:.72rem;font-family:inherit;cursor:pointer;text-align:left;-webkit-app-region:no-drag;app-region:no-drag;&:hover{background:rgb(from var(--medium) r g b / .18);border-color:rgb(from var(--medium) r g b / .5)}.storage-dot{width:7px;height:7px;border-radius:50%;background:var(--medium);flex-shrink:0}}#storage-status[hidden]{display:none}#auth-status[hidden],#manage-status[hidden]{display:none!important}#auth-status{display:inline-flex;align-items:center}#auth-status[data-authed="1"]{display:inline-flex;align-items:center;gap:.4rem;max-width:12rem;padding:.2rem .35rem;border-color:transparent;border-radius:5px}#auth-status[data-authed="1"]:hover{border-color:transparent;background:rgb(from var(--text) r g b / .07)}#manage-status[hidden]{display:none}#manage-status{display:inline-grid;place-items:center;width:1.8rem;height:1.8rem;padding:.25rem;border-color:transparent;color:var(--accent)}#manage-status:hover{border-color:transparent;background:rgb(from var(--text) r g b / .07)}.auth-login{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text);font:inherit;font-size:.72rem;font-weight:400}.user-avatar{position:relative;flex-shrink:0;width:22px;height:22px;border-radius:50%;overflow:hidden;background:var(--accent);display:inline-grid;place-items:center;user-select:none}.user-avatar-lg{width:38px;height:38px}.user-avatar-fallback{font-size:.72rem;font-weight:600;line-height:1;color:var(--bg);text-transform:uppercase}.user-avatar-lg .user-avatar-fallback{font-size:1.05rem}.user-avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.user-avatar img.broken{display:none}.user-menu[popover]{position:fixed;inset:auto;margin:0;min-width:11rem;flex-direction:column;gap:.1rem;background:var(--surface, var(--bg));border:1px solid var(--border);border-radius:6px;padding:.3rem;box-shadow:0 4px 14px #00000047}.user-menu[popover]:not(:popover-open){display:none}.user-menu[popover]:popover-open{display:flex}.user-card{display:flex;align-items:center;gap:.5rem;padding:.3rem .35rem .45rem;border-bottom:1px solid var(--border);margin-bottom:.2rem}.user-id{display:flex;flex-direction:column;min-width:0}.user-login{font-weight:600;font-size:.82rem;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.user-name{font-size:.74rem;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.user-menu-row{display:block;width:100%;text-align:left;background:transparent;border:0;border-radius:4px;padding:.4rem .5rem;font:inherit;font-size:.82rem;color:var(--text)}.user-menu-row.logout-row{display:inline-flex;align-items:center;gap:.4rem;font-size:.76rem}.logout-row svg{flex:0 0 auto}.user-menu-row:hover{background:rgb(from var(--text) r g b / .08)}.user-menu-group{display:flex;flex-direction:column;gap:.1rem;padding-bottom:.2rem;margin-bottom:.2rem;border-bottom:1px solid var(--border)}.user-menu-group-label{padding:.25rem .5rem .15rem;font-size:.62rem;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:var(--muted);user-select:none}
126
+ `});var No,Mc=w(()=>{No=`:is(.file-icon,.report-logo){&.brand-deepview{--brand-bg: #2563eb;--brand-fg: #fff}&.brand-claude{--brand-bg: #d97757;--brand-fg: #fff}&.brand-codex{--brand-bg: #fff;--brand-fg: #000}&.brand-vercel{--brand-bg: #000;--brand-fg: #fff}&.brand-piolium{--brand-bg: #fbb829;--brand-fg: #1c1b19}.bg{fill:var(--brand-bg)}.fg{fill:var(--brand-fg)}}.file-icon:is(.brand-codex,.brand-vercel) .bg{stroke:var(--brand-fg);stroke-width:.5}.report-logo{display:grid;place-items:center;align-self:stretch;flex:0 0 20px;background:var(--brand-bg);border-right:1px solid var(--border)}
127
+ `});async function cv(){if(!lt)return;if(await at(),D()){lt.hidden=!0;return}if(!Pr()){lt.hidden=!0;return}let t=de();lt.hidden=!1;let e=tr();lt.classList.toggle("encrypted",t&&e),lt.classList.toggle("locked-pending",t&&!e),t&&e?(lt.dataset.tooltip="Encryption on \u2014 click to disable",lt.setAttribute("aria-label","Disable encryption"),ie(oE,lt)):t?(lt.dataset.tooltip="Encryption on, locked \u2014 click to unlock",lt.setAttribute("aria-label","Unlock encrypted data"),ie(oE,lt)):(lt.dataset.tooltip="Encryption off \u2014 click to enable",lt.setAttribute("aria-label","Enable encryption"),ie(P4,lt))}async function N4(){if(confirm(`Disable encryption?
128
+
129
+ Your local triage and report data will be rewritten as plaintext.
130
+
131
+ IMPORTANT: DeepView cannot directly delete your passkey. Most browsers / password managers require you to remove the entry manually after disabling. You can re-enable encryption later.`))try{(await mh({migrate:async({open:e})=>{await dh({open:e}),await gg({open:e}),await Th({open:e}),await Ih({open:e})}}))?.disabled&&alert(`Encryption disabled. Your data is now plaintext.
132
+
133
+ To complete cleanup, remove the DeepView passkey from your password manager / OS settings:
134
+ \u2022 macOS / iOS: Settings \u2192 Passwords
135
+ \u2022 Windows: Settings \u2192 Accounts \u2192 Sign-in options \u2192 Passkeys
136
+ \u2022 Chrome: chrome://settings/passkeys
137
+ \u2022 Hardware security key: use the vendor's management tool`)}catch(t){alert(`Could not disable encryption: ${t?.message??t}`)}}function iE(){cv()}function sE(t){if(!t||t===lt)return;lt=t;let e=!1;lt.addEventListener("click",async()=>{if(await at(),!D()&&!e){e=!0;try{if(!de()){await Bp();return}if(!tr()){await Pp();return}await N4()}finally{e=!1}}}),tt(cv),cv()}var oE,P4,lt,dv=w(()=>{"use strict";M();O();_y();Ey();Pn();oE=d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="8" width="10" height="6" rx="1"/><path d="M5 8V5.5a3 3 0 0 1 6 0V8"/></svg>`,P4=d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="8" width="10" height="6" rx="1"/><path d="M5 8V5a3 3 0 0 1 6 -0.5"/></svg>`,lt=null});var lE,aE=w(()=>{lE=`.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}
138
+ `});function pv(){let t=navigator.userAgent;return/AppleWebKit/u.test(t)&&!/Chrome\/|Chromium|Edg\/|OPR\/|Android/u.test(t)?"webkit":/Firefox\//u.test(t)?"firefox":"chromium"}function cE(){return new Promise(t=>{let e=document.createElement("storage-persist-dialog"),r=n=>{e.remove(),t(n)};e.addEventListener("resolve",n=>r(n.detail)),e.addEventListener("modal-conflict",()=>r(null)),document.body.append(e)})}var uv,dE=w(()=>{"use strict";M();fe();O();aE();uv=class extends F{static styles=[...F.styles,A(lE)];static properties={_retryDenied:{state:!0}};constructor(){super(),this._retryDenied=!1}_onConfirm=()=>this._finish(null);_onRetry=async()=>{if(await Cs()){this._finish("granted");return}this._retryDenied=!0};_chromiumBody(){let e=location.hostname==="localhost"?d`Plain <code>localhost</code> can never qualify — for local testing open the app via <code>127.0.0.1</code> instead.`:m;return d`<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">The browser re-evaluates on every request, so after any of the above press <strong>Try again</strong>.${e}</p>`}_firefoxBody(){return d`<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 d`<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=pv(),r=e==="webkit"?this._webkitBody():e==="firefox"?this._firefoxBody():this._chromiumBody();return d`<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>${r}<footer class="nwd-actions">${this._retryDenied?d`<span class="spd-denied" role="status">Still not granted.</span>`:m} <span class="nwd-spacer"></span> ${e==="webkit"?m:d`<button type="button" @click="${this._onRetry}">Try again</button>`} <button type="button" class="primary" @click="${this._onConfirm}">Got it</button></footer></dialog>`}};customElements.define("storage-persist-dialog",uv)});function hv(){return pv()==="webkit"}function uE(t){return t>=1e9?`${(t/1e9).toFixed(1)} GB`:t>=1e6?`${(t/1e6).toFixed(1)} MB`:t>=1e3?`${(t/1e3).toFixed(1)} kB`:`${t} B`}function pE(){if(!an)return;if(D()||!sn||sn.persisted!==!1||!mv){an.hidden=!0;return}an.hidden=!1;let t=sn.usage===null||sn.quota===null?"":` Using ${uE(sn.usage)} of ${uE(sn.quota)}.`;an.querySelector(".storage-label").textContent="Storage at risk",an.dataset.tooltip="Reports, bundles and triage are in best-effort storage \u2014 the browser may delete them all under disk pressure or after long inactivity. "+(hv()?"Click for how to protect them (on Safari and iOS browsers this needs the app installed to the Home Screen or Dock).":"Click to request persistent storage \u2014 if the browser declines, instructions for enabling it follow.")+t}function hE(t,e){let r=e?" (user gesture)":"";if(t){console.info(`storage: persistent-storage request granted${r}`);return}let n=!hv()&&location.hostname==="localhost"?" Note: plain localhost can NEVER pass \u2014 Chromium keys site importance by registerable domain (IP literals excepted) and localhost has none; for local testing use 127.0.0.1 instead.":"";console.info(`storage: persistent-storage request not granted${r} \u2014 `+(hv()?"Safari ties persistence to install state; add the app to the Home Screen / Dock.":"Chromium-based browsers never prompt and silently deny origins they don't consider important; installing the app, bookmarking it, allowing notifications, or regular use flips the heuristic (re-evaluated on every request). Firefox shows a prompt instead.")+n)}async function Qp(){if(await at(),!an||D()){pE();return}let[t,e]=await Promise.all([yg(),(async()=>{try{return(await pe()).length>0||await Na()}catch{return!1}})()]);sn=t,mv=e,pE()}function gv(){!an||fv||(fv=setTimeout(()=>{fv=0,Qp()},1e3))}async function fE(){if(Zp||(await Qp(),D()||sn?.persisted!==!1||!mv||Zp))return;Zp=!0;let t=await Cs();hE(t,!1),await Qp()}async function z4(){if(sn&&sn.persisted===!1){Zp=!0;let t=await Cs();hE(t,!0),t||await cE()}await Qp()}function mE(t){an=t,an&&(an.addEventListener("click",()=>{z4()}),Qo((e,r)=>{gv(),r==="save"&&fE()}),fE())}var an,sn,mv,Zp,fv,gE=w(()=>{"use strict";O();Pn();dE();an=null,sn=null,mv=!1,Zp=!1,fv=0});function bv(t){let e=document.querySelector("#landing-workspaces");if(!e)return;let r=t.toSorted((n,o)=>o.reports.length-n.reports.length||n.name.localeCompare(o.name)).slice(0,5);ie(r.length>0?d`<nav class="landing-workspaces" aria-label="Workspaces"><div class="landing-workspace-row">${te(r,n=>n.id,n=>d`<button type="button" class="landing-workspace" data-landing-workspace="${n.id}">${Z(fo)} <span class="landing-workspace-text"><span class="landing-workspace-name">${n.name}</span> <span class="landing-workspace-count">${n.reports.length} ${n.reports.length===1?"report":"reports"}</span></span></button>`)}</div></nav>`:m,e)}var bE=w(()=>{"use strict";M();vt();bt();Wt()});function yE({serverMode:t,session:e,teams:r=[]}){let n=document.querySelector("#drop-zone"),o=n?.querySelector(".managed-landing");if(!o)return;let i=t==="managed",s=t==="local";n.dataset.serverMode=i?"managed":"local",n.setAttribute("aria-label",i?"Team findings":"Drop reports here");let a=n.querySelector(".drop-local-copy");a&&(a.textContent=s?"Review locally in your browser.":"Review locally in your browser. Sync across devices when you need it.");let c=e?.role==="admin"||e?.role==="manage";ie(i?d`<div class="managed-landing-hero"><p class="drop-eyebrow">Your security workspace</p><h1>Your team's findings, in focus.</h1><p class="drop-prompt-intro">${r.length>0?"Review the security findings shared with your account and turn them into clear next steps.":e?"Reports shared with your teams will appear here.":"Log in to see the reports shared with your teams."}</p></div>${r.length>0?d`<nav class="managed-team-list" aria-label="Teams">${te(r,u=>u.id,u=>d`<button type="button" class="managed-team-button" data-managed-team="${u.id}"><span class="managed-team-icon" aria-hidden="true">${Z(fo)}</span> <span class="managed-team-copy"><strong>${u.name}</strong> <span>${u.reports.length} ${u.reports.length===1?"report":"reports"} · Open findings</span> </span><svg class="managed-team-arrow" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg></button>`)}</nav>`:e?d`<p class="managed-landing-empty">No team reports are available yet.</p>`:m} ${c?d`<div class="managed-landing-actions"><button type="button" class="managed-manage-button" data-managed-page="manage"><span aria-hidden="true">${Z(zu)}</span><span>Manage</span></button></div>`:e?m:d`<button type="button" class="drop-prompt-action" data-managed-login>Log in</button>`}`:m,o)}var vE=w(()=>{"use strict";M();vt();bt();Wt()});function wE(t){let e=t.replace(/:free$/u,"").replaceAll("_","-").split("-").filter(Boolean),r=[];for(let o=0;o<e.length;o++){let i=e[o],s=e[o+1];if(/^\d+$/u.test(i)&&/^\d+$/u.test(s??"")){r.push(`${i}.${s}`),o++;continue}let a=j4.get(i.toLowerCase());r.push(a??(/^(?:[a-z]+\d+|\d+[a-z]+)$/iu.test(i)?i.toUpperCase():i[0]?.toUpperCase()+i.slice(1)))}return r.join(" ").replace(/^GPT (\d)/u,"GPT-$1")}function Ic(t){return U4.get(t)??wE(t.includes("/")?t.slice(t.indexOf("/")+1):t)}function Lc(t){let e=t.includes("/")?t.split("/")[0]:"other";return{key:e,name:H4.get(e)??(e==="other"?"Other":wE(e))}}function Fc(t){return t==="xhigh"?"Extra high":t?t[0].toUpperCase()+t.slice(1):"Unavailable"}function Bc(t){return t.efforts.includes("max")?"max":t.efforts.at(-1)??null}async function ef(t,e=fetch){let r=await e("/api/admin/models",{credentials:"same-origin",headers:{accept:"application/json"},signal:t});if(!r.ok)throw new Error(`HTTP ${r.status}`);let n=await r.json();return yv(n)}function yv(t){if(!Array.isArray(t?.models))throw new Error("No model catalogue returned");let e=t.models.filter(r=>typeof r?.id=="string"&&r.id.length>0).map(r=>({id:r.id,efforts:Array.isArray(r.efforts)?[...new Set(r.efforts.filter(n=>typeof n=="string"&&n.length>0))]:[]}));if(e.length===0)throw new Error("No models available");return{models:e,defaultModel:e.find(r=>r.id===t.defaultModel)?.id??e[0].id}}var U4,H4,j4,Di=w(()=>{"use strict";U4=new Map([["openai/gpt-6-astra","GPT-6 Astra"],["openai/gpt-6-astra-pro","GPT-6 Astra Pro"],["openai/gpt-5.6-sol","GPT-5.6 Sol"],["openai/gpt-5.6-terra","GPT-5.6 Terra"],["openai/gpt-5.6-luna","GPT-5.6 Luna"],["anthropic/claude-fable-5.1","Claude Fable 5.1"],["anthropic/claude-opus-5","Claude Opus 5"],["anthropic/claude-sonnet-5","Claude Sonnet 5"],["moonshotai/kimi-k3","Kimi K3"],["z-ai/glm-5.3","GLM 5.3"],["qwen/qwen3.8-max","Qwen3.8 Max"],["deepseek/deepseek-v4.1-flash","DeepSeek V4.1 Flash"],["deepseek/deepseek-v4-pro","DeepSeek V4 Pro"]]),H4=new Map([["openai","OpenAI"],["anthropic","Anthropic"],["moonshotai","Moonshot AI"],["google","Google"],["nvidia","NVIDIA"],["qwen","Qwen"],["deepseek","DeepSeek"],["x-ai","xAI"],["z-ai","Z.ai"]]),j4=new Map([["gpt","GPT"],["gptoss","GPT OSS"],["oss","OSS"],["o","O"],["ai","AI"],["api","API"],["4o","4o"],["k3","K3"],["k4","K4"],["qwen","Qwen"],["kimi","Kimi"],["gemini","Gemini"],["claude","Claude"],["fable","Fable"],["opus","Opus"],["sonnet","Sonnet"],["astra","Astra"],["terra","Terra"],["luna","Luna"],["codex","Codex"],["deepseek","DeepSeek"],["nemotron","Nemotron"],["gemma","Gemma"]])});function kE(t=null){let e=["anthropic/claude-opus-5.5","anthropic/claude-fable-5.1","anthropic/claude-sonnet-5","anthropic/claude-haiku-4.5","openai/gpt-6-astra","openai/gpt-6-astra-pro","openai/gpt-6-sol","openai/gpt-6-sol-pro","openai/gpt-6-luna","openai/gpt-6-luna-pro","moonshotai/kimi-k3","google/gemini-3.8-flash","google/gemma-4-31b-it","x-ai/grok-4.7","z-ai/glm-5.3","qwen/qwen3.8-max","deepseek/deepseek-v4.1-flash","deepseek/deepseek-v4-pro"],r=t==="moonshot"?"moonshotai":t,n=e.filter(o=>!["anthropic","openai","moonshot"].includes(t)||o.startsWith(`${r}/`)).map(o=>({id:o,efforts:["low","medium","high","xhigh","max"]}));return{models:n,defaultModel:n[0].id}}var xE=w(()=>{"use strict"});function $E(t,e=fetch,r=""){let n=new URL(t);return(o,i={})=>{let s=new URL(o.replace(/^\/+/u,""),n);if(s.origin!==n.origin)throw new Error("Scan requests must use the configured server");let a=new Headers(i.headers);return r&&a.set("authorization",`Bearer ${r}`),e(s,{...i,headers:a,credentials:"omit",redirect:"error"})}}var _E=w(()=>{"use strict"});var tf,SE=w(()=>{"use strict";Di();xE();_E();tf=class{constructor(e,r=()=>{},n=fetch){this.onChange=r,this.request=n,this.reset(e)}reset(e=this.server){this.server=e,this.apiKey="",this.provider=null,this._remoteModels=!1,this._disconnect()}_previewModels(){let e=kE(this.provider);this.loadModels=()=>Promise.resolve(e)}_disconnect(){this._controller?.abort(),this.connected=!1,this.managed=!1,this.loading=!1,this.error=null,this.catalogue=null,this._remoteModels||this._previewModels(),this.onChange()}get ready(){return this.connected&&!this.loading&&this.catalogue!=null}setKey(e){this.apiKey!==e&&(this.apiKey=e,this._disconnect())}setProvider(e){if(!(this.provider===e||this.managed)){if(this.provider=e,this.connected&&e)return this._load(e);this.connected&&(this._controller?.abort(),this.loading=!1,this.error=null,this.catalogue=null),this._remoteModels||this._previewModels(),this.onChange()}}connect(){if(this._disconnect(),!(!this.server||!this.apiKey.trim()))return this._load(null)}async _fetch(e,r){let n=$E(this.server,this.request,this.apiKey.trim()),o=e?`?${new URLSearchParams({provider:e})}`:"",i=await n(`api/models${o}`,{headers:{accept:"application/json"},cache:"no-store",signal:r});if(i.status===401)throw Object.assign(new Error("DeepView API key not recognized."),{status:401});if(!i.ok)throw new Error(`Scan server returned HTTP ${i.status}.`);let s=await i.json();if(s?.valid!==!0||typeof s.managed!="boolean")throw new Error("Invalid response from scan server.");return{managed:s.managed,catalogue:s.managed||e?yv(s):null}}async _load(e){this._controller?.abort();let r=this._controller=new AbortController;this.loading=!0,this.error=null,this.catalogue=null;let n=this._fetch(e,r.signal);this.onChange();try{let o=await n;if(r.signal.aborted)return;if(this.connected=!0,this.managed=o.managed,this.catalogue=o.catalogue,!o.managed&&!e&&this.provider)return this._load(this.provider);if(o.catalogue){let i=o.catalogue;this._remoteModels=!0,this.loadModels=()=>Promise.resolve(i)}else this._remoteModels||this._previewModels();this.loading=!1,this.onChange()}catch(o){if(r.signal.aborted)return;(!e||o.status===401)&&this._disconnect(),this.loading=!1,this.error=o instanceof TypeError?"Couldn\u2019t reach the scan server. Check your connection and try again.":String(o?.message??o),this.onChange()}}}});function CE(t){let e=t.trim();return/^sk-ant-[A-Za-z0-9_-]*$/u.test(e)?"anthropic":/^sk-or-v1-[A-Za-z0-9_-]*$/u.test(e)?"openrouter":/^sk-kimi-[A-Za-z0-9_-]*$/u.test(e)?"moonshot":/^sk-(?:proj|svcacct)-[A-Za-z0-9_-]*$/u.test(e)?"openai":null}var EE=w(()=>{"use strict"});var xe,RE=w(()=>{Lr();Yi();Yf();xe=Fr(class extends Qt{constructor(t){if(super(t),t.type!==yt.PROPERTY&&t.type!==yt.ATTRIBUTE&&t.type!==yt.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!o0(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===je||e===m)return e;let r=t.element,n=t.name;if(t.type===yt.PROPERTY){if(e===r[n])return je}else if(t.type===yt.BOOLEAN_ATTRIBUTE){if(!!e===r.hasAttribute(n))return je}else if(t.type===yt.ATTRIBUTE&&r.getAttribute(n)===e+"")return je;return cd(t),e}})});var Jt=w(()=>{RE()});function vv(t){let e=new Map(t.map(n=>[n.id,n])),r=new Set;return t.flatMap(n=>{if(r.has(n.id))return[];let o=n.id.endsWith("-pro")?n.id.slice(0,-4):n.id,i=e.get(o),s=e.get(`${o}-pro`);return!/(?:^|\/)gpt-.+$/u.test(o)||o.endsWith("-pro")||!i||!s?[n]:(r.add(i.id),r.add(s.id),[{...i,pro:s}])})}function wv(t){return[...Map.groupBy(vv(t),r=>Lc(r.id).key)].map(([r,n])=>({key:r,models:n}))}function AE(t,e){if(t.length===0)return[];let r=Math.min(t.length,Math.max(1,e)),n=t.map(u=>u.models.length*2+3),o=n.reduce((u,p)=>u+p,0),i=Math.max(...n);for(;i<o;){let u=Math.floor((i+o)/2),p=0,f=1;for(let h of n)p+h>u&&(f++,p=0),p+=h;f>r?i=u+1:o=u}let s=[],a=[],c=0;for(let[u,p]of t.entries())a.length>0&&(c+n[u]>i||t.length-u===r-s.length-1)&&(s.push(a),a=[],c=0),a.push(p),c+=n[u];return s.push(a),s}var TE=w(()=>{"use strict";Di()});function ME(t){if(t==="google")return d`<svg class="google-mark" viewBox="0 0 24 24" aria-hidden="true"><path fill="#4285F4" d="M21.35 12.27c0-.79-.07-1.55-.2-2.27H12v4.3h5.24a4.48 4.48 0 0 1-1.94 2.94v2.45h3.15c1.85-1.7 2.9-4.2 2.9-7.42Z"/><path fill="#34A853" d="M12 21.8c2.64 0 4.86-.87 6.48-2.35l-3.15-2.45c-.87.58-1.98.92-3.33.92-2.56 0-4.73-1.73-5.51-4.06H3.24v2.52A9.8 9.8 0 0 0 12 21.8Z"/><path fill="#FBBC05" d="M6.49 13.86a5.9 5.9 0 0 1 0-3.72V7.62H3.24a9.8 9.8 0 0 0 0 8.76l3.25-2.52Z"/><path fill="#EA4335" d="M12 6.08c1.43 0 2.72.49 3.74 1.45l2.8-2.8C16.85 3.14 14.63 2.2 12 2.2a9.8 9.8 0 0 0-8.76 5.42l3.25 2.52C7.27 7.81 9.44 6.08 12 6.08Z"/></svg>`;let e={openai:"openai",anthropic:"claude",moonshotai:"moonshot",nvidia:"nvidia",qwen:"qwen",deepseek:"deepseek","x-ai":"grok","z-ai":"zai"};return e[t]?d`<span class="provider-mark" style="${`--provider-icon: url('/provider-icons/${e[t]}.svg')`}" aria-hidden="true"></span>`:d`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><rect x="4" y="4" width="12" height="12" rx="3"/><path d="M8 1v3m4-3v3M8 16v3m4-3v3M1 8h3m-3 4h3m12-4h3m-3 4h3"/></svg>`}var V4,kv,xv=w(()=>{"use strict";M();Di();TE();V4=d`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4"/></svg>`;kv=class extends J{static properties={loadModels:{attribute:!1},value:{attribute:!1},effort:{attribute:!1},hasExtra:{type:Boolean,attribute:"has-extra"},_models:{state:!0},_error:{state:!0},_menuColumns:{state:!0}};static styles=Qe`:host{display:block;min-width:0;container:scan-controls/inline-size}*{box-sizing:border-box}.layout{display:grid;grid-template-columns:minmax(13rem,1fr) minmax(14rem,1fr);gap:1.25rem;align-items:start}.layout.with-extra{grid-template-columns:minmax(13rem,.9fr) minmax(14rem,1.2fr) minmax(14rem,auto)}.field{min-width:0}.label{display:flex;justify-content:space-between;align-items:center;margin-bottom:.4rem;color:var(--muted);font-size:.72rem}output{color:var(--text);font-size:.72rem;font-weight:500}details{position:relative}.model-control{position:relative}summary{display:flex;align-items:center;gap:.55rem;padding:.5rem .6rem;border:1px solid var(--border);border-radius:6px;background:var(--bg);color:var(--text);list-style:none;transition:border-color .12s,background .12s}details[open] summary,summary:hover{border-color:var(--muted);background:var(--surface-active)}summary::-webkit-details-marker{display:none}.menu,summary{user-select:none}summary>svg{width:.9rem;height:.9rem;margin-left:auto;color:var(--muted)}.selected-copy{display:grid;gap:.1rem;flex:1;min-width:0}.selected-copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.8rem;font-weight:500}.selected-copy small{color:var(--muted);font-size:.63rem}.pro-space{width:3.65rem;flex:0 0 3.65rem}.pro-toggle{position:absolute;right:2.05rem;top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;gap:.3rem;width:3.65rem;height:1.65rem;padding:.2rem .3rem;border:1px solid var(--border);border-radius:5px;background:var(--bg);color:var(--muted);font:inherit;font-size:.65rem;font-weight:600;cursor:default;user-select:none}.pro-toggle:hover{border-color:var(--muted);color:var(--text)}.pro-track{position:relative;flex:0 0 1.3rem;height:.8rem;border-radius:999px;background:var(--border)}.pro-track::after{content:'';position:absolute;top:.15rem;left:.15rem;width:.5rem;height:.5rem;border-radius:50%;background:var(--muted);transition:transform .12s,background .12s}.pro-toggle[aria-checked=true]{color:var(--accent);border-color:rgb(from var(--accent) r g b / .45);background:rgb(from var(--accent) r g b / .08)}.pro-toggle[aria-checked=true] .pro-track{background:rgb(from var(--accent) r g b / .25)}.pro-toggle[aria-checked=true] .pro-track::after{transform:translateX(.5rem);background:var(--accent)}.icon{display:inline-grid;place-items:center;width:1.7rem;height:1.5rem;flex:0 0 1.7rem;color:var(--text)}.icon svg{display:block;width:1.1rem;height:1.1rem}.provider-mark{display:block;width:1.12rem;height:1.12rem;background:currentColor;-webkit-mask:var(--provider-icon) center/contain no-repeat;mask:var(--provider-icon) center/contain no-repeat}.icon.openai{color:#10a37f}.icon.anthropic{color:#d97757}.icon.moonshotai{color:#8068d9}.icon.google{color:#4285f4}.icon.nvidia{color:#76b900}.icon.qwen{color:#f97316}.icon.deepseek{color:#4d8dff}.icon.moonshotai .provider-mark{transform:scale(.78)}.icon.qwen .provider-mark{transform:scale(.82)}.icon.nvidia .provider-mark{transform:scale(.86)}.icon.deepseek .provider-mark{transform:scale(.9)}.extra{display:flex;min-width:0;min-height:4.9rem;align-items:flex-end;align-self:end;padding-bottom:.05rem}.menu{visibility:hidden;position:fixed;z-index:1000;width:min(46rem,calc(100vw - 1rem));max-height:calc(100dvh - 1rem);overflow:auto;overscroll-behavior:contain;padding:.65rem;border:1px solid var(--border);border-radius:9px;background:var(--surface-active);color:var(--text);box-shadow:0 .65rem 1.8rem rgb(0 0 0 / .55)}details[open] .menu[data-positioned]{visibility:visible}.groups{display:grid;grid-template-columns:repeat(var(--model-columns,1),minmax(0,1fr));gap:1rem;align-items:start}.provider-column{min-width:0}fieldset{min-width:0;margin:0 0 .6rem;padding:0;border:0}fieldset:last-child{margin-bottom:0}legend{display:flex;align-items:center;gap:.45rem;width:100%;min-height:1.9rem;padding:.35rem .5rem .25rem;border-bottom:1px solid rgb(from var(--border) r g b / .7);color:var(--muted);font-size:.64rem;font-weight:700;letter-spacing:.055em;text-transform:uppercase}legend .icon{width:.88rem;height:1.25rem;flex-basis:.88rem}legend .icon svg{width:.88rem;height:.88rem}legend .provider-mark{width:.88rem;height:.88rem}.choice{display:flex;align-items:center;gap:.5rem;padding:.35rem .5rem;border-radius:4px;font-size:.76rem}.choice:hover{background:rgb(from var(--text) r g b / .05)}.choice:has(:checked){color:var(--accent);background:rgb(from var(--accent) r g b / .1)}.choice input{margin:0;accent-color:var(--accent)}.choice span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.slider{--thumb-size:1rem;padding:.15rem .6rem 0}input[type=range]{appearance:none;display:block;width:100%;height:var(--thumb-size);margin:.4rem 0 .5rem;padding:0;border:0;background:0 0}input[type=range]::-webkit-slider-runnable-track{height:.3rem;border-radius:999px;background:linear-gradient(to right,var(--accent) var(--effort-fill),var(--surface-active) var(--effort-fill))}input[type=range]::-moz-range-track{height:.3rem;border-radius:999px;background:linear-gradient(to right,var(--accent) var(--effort-fill),var(--surface-active) var(--effort-fill))}input[type=range]::-webkit-slider-thumb{appearance:none;width:var(--thumb-size);height:var(--thumb-size);margin-top:calc((.3rem - var(--thumb-size))/ 2);border:0;border-radius:50%;background:var(--accent)}input[type=range]::-moz-range-thumb{width:var(--thumb-size);height:var(--thumb-size);border:0;border-radius:50%;background:var(--accent)}input[type=range]:disabled{opacity:.5}.steps{position:relative;height:1.3rem;margin:0 calc(var(--thumb-size)/ 2)}.step{position:absolute;top:0;left:var(--step-position);transform:translateX(-50%);padding:.35rem 0 0;border:0;background:0 0;color:var(--muted);font:inherit;font-size:.62rem;white-space:nowrap;cursor:default}.step::before{content:'';position:absolute;top:0;left:50%;transform:translateX(-50%);width:1px;height:.2rem;background:var(--muted)}.step.active{color:var(--accent)}:is(summary,input,button):focus-visible{outline:2px solid var(--accent);outline-offset:2px}.message{margin:0;color:var(--muted);font-size:.75rem}.error{color:var(--critical,#e5534b)}.retry{margin-left:.5rem;padding:.2rem .4rem;border:1px solid var(--border);border-radius:4px;background:var(--bg);color:var(--text);font:inherit}.layout.with-extra .extra{grid-column:1/-1;align-self:start;min-height:0}.layout.with-extra .extra{grid-column:auto}`;constructor(){super(),this.loadModels=ef,this.value=null,this.effort=null,this.hasExtra=!1,this._models=[],this._error=null,this._menuColumns=1,this._positionRequest=0,this._onOutside=e=>{e.composedPath().includes(this)||this._close()},this._onViewportChange=()=>this._positionMenu()}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onOutside),window.addEventListener("resize",this._onViewportChange),window.addEventListener("scroll",this._onViewportChange,!0),this.hasUpdated&&this._load()}updated(e){e.has("loadModels")&&this.isConnected&&this._load(),e.has("_models")&&this.renderRoot.querySelector("details")?.open&&(this._resetMenuPosition(),this._positionMenu())}disconnectedCallback(){super.disconnectedCallback(),this._controller?.abort(),document.removeEventListener("pointerdown",this._onOutside),window.removeEventListener("resize",this._onViewportChange),window.removeEventListener("scroll",this._onViewportChange,!0)}async _load(){this._controller?.abort();let e=new AbortController;this._controller=e,this._error=null;try{let r=await this.loadModels(e.signal);if(e.signal.aborted)return;this._models=r.models;let n=r.models.find(o=>o.id===this.value);n?n.efforts.includes(this.effort)||this._setEffort(Bc(n)):this._select(r.defaultModel)}catch(r){e.signal.aborted||(this._error=String(r?.message??r))}}_close(){this._resetMenuPosition();let e=this.renderRoot.querySelector("details");e&&(e.open=!1)}_resetMenuPosition(){this._positionRequest++;let e=this.renderRoot.querySelector(".menu");e&&delete e.dataset.positioned}_toggleMenu(e){this._resetMenuPosition(),e.currentTarget.open&&this._positionMenu()}get _selectedRow(){return vv(this._models).find(e=>e.id===this.value||e.pro?.id===this.value)}async _positionMenu(){let e=++this._positionRequest,r=this.renderRoot.querySelector("details"),n=this.renderRoot.querySelector("summary"),o=this.renderRoot.querySelector(".menu");if(!r?.open||!n||!o)return;let i=n.getBoundingClientRect(),s=6,a=8,c=wv(this._models),u=c.reduce((E,B)=>E+B.models.length,0),p=Math.min(3,c.length,Math.ceil((u+c.length*1.5)/9)),f=parseFloat(getComputedStyle(o).fontSize),h=0;for(let E of o.querySelectorAll(".choice span, legend")){let B=document.createRange();B.selectNodeContents(E),h=Math.max(h,B.getBoundingClientRect().width)}let g=Math.max(11*f,Math.min(18*f,h+2.5*f)),y=1.3*f+2,b=Math.max(1,Math.min(p,Math.floor((window.innerWidth-a*2-y+f)/(g+f)))),v=Math.min(b*g+(b-1)*f+y,window.innerWidth-a*2),x=Math.max(a,Math.min(i.left,window.innerWidth-v-a));if(this._menuColumns=b,await this.updateComplete,e!==this._positionRequest||!this.isConnected||!r.open)return;o.style.left=`${x}px`,o.style.width=`${v}px`,o.style.setProperty("--model-columns",b),o.style.maxHeight=`${Math.max(0,window.innerHeight-a*2)}px`;let k=o.getBoundingClientRect().height,$=window.innerHeight-i.bottom-s-a,C=i.top-s-a,U=$<k&&C>$?i.top-s-k:i.bottom+s;o.style.bottom="auto",o.style.top=`${Math.max(a,Math.min(U,window.innerHeight-k-a))}px`,o.dataset.positioned=""}_select(e,{preserveEffort:r=!1,close:n=!0}={}){let o=this._models.find(i=>i.id===e);o&&(this.value=e,this._setEffort(r&&o.efforts.includes(this.effort)?this.effort:Bc(o)),n&&this._close())}_selectRow(e){let r=this._selectedRow?.pro?.id===this.value;this._select(r&&e.pro?e.pro.id:e.id)}_togglePro(){let e=this._selectedRow;e?.pro&&this._select(this.value===e.pro.id?e.id:e.pro.id,{preserveEffort:!0,close:!1})}_setEffort(e){this.effort=e,this.dispatchEvent(new CustomEvent("model-change",{detail:{model:this.value,effort:e},bubbles:!0,composed:!0}))}render(){if(this._error)return d`<p class="message error" role="alert">Couldn’t load models: ${this._error}<button class="retry" @click="${()=>{this._load()}}">Retry</button></p>`;let e=this._models.find(i=>i.id===this.value);if(!e)return d`<p class="message" role="status">Loading models…</p>`;let r=this._selectedRow,n=Lc(e.id),o=AE(wv(this._models),this._menuColumns);return d`<div class="${`layout ${this.hasExtra?"with-extra":""}`}"><div class="field"><span class="label" id="model-label">Model</span><div class="model-control"><details @toggle="${this._toggleMenu}" @keydown="${i=>{i.key==="Escape"&&(this._close(),this.renderRoot.querySelector("summary")?.focus())}}"><summary aria-labelledby="model-label selected-model" @click="${this._resetMenuPosition}"><span class="${`icon ${n.key}`}">${ME(n.key)}</span><span class="selected-copy"><strong id="selected-model">${Ic(r.id)}</strong><small>${n.name}</small></span>${r.pro?d`<span class="pro-space" aria-hidden="true"></span>`:m}${V4}</summary><div class="menu"><div class="groups">${o.map(i=>d`<div class="provider-column">${i.map(s=>this._modelSection(s))}</div>`)}</div></div></details>${r.pro?d`<button type="button" class="pro-toggle" role="switch" aria-label="Pro model" aria-checked="${e.id===r.pro.id}" @click="${this._togglePro}"><span>Pro</span><span class="pro-track" aria-hidden="true"></span></button>`:m}</div></div>${e.efforts.length>0?this._effortSlider(e.efforts):m} ${this.hasExtra?d`<div class="extra"><slot name="effort-extra"></slot></div>`:m}</div>`}_modelSection({key:e,models:r}){return d`<fieldset><legend><span class="${`icon ${e}`}">${ME(e)}</span>${Lc(r[0].id).name}</legend>${r.map(n=>d`<label class="choice"><input type="radio" name="scan-model" value="${n.id}" .checked="${n.id===this.value||n.pro?.id===this.value}" @change="${()=>{this._selectRow(n),this.renderRoot.querySelector("summary")?.focus()}}"><span>${Ic(n.id)}</span></label>`)}</fieldset>`}_effortSlider(e){let r=Math.max(0,e.indexOf(this.effort)),n=Math.max(1,e.length-1);return d`<div class="field"><div class="label"><label for="effort">Effort</label><output for="effort">${Fc(e[r])}</output></div><div class="slider" style="${`--effort-fill: calc(var(--thumb-size) / 2 + (100% - var(--thumb-size)) * ${r/n})`}"><input id="effort" type="range" min="0" max="${n}" step="1" .value="${String(r)}" ?disabled="${e.length===1}" aria-valuetext="${Fc(e[r])}" @input="${o=>this._setEffort(e[Number(o.target.value)])}"><div class="steps">${e.map((o,i)=>d`<button type="button" class="${`step ${o===this.effort?"active":""}`}" style="${`--step-position: ${i/n*100}%`}" aria-label="${`Set effort to ${Fc(o)}`}" aria-pressed="${o===this.effort}" @click="${()=>this._setEffort(o)}">${Fc(o)}</button>`)}</div></div></div>`}};customElements.get("scan-model-picker")||customElements.define("scan-model-picker",kv)});var Un,rf=w(()=>{"use strict";M();Jt();Un=class extends J{static properties={options:{attribute:!1},value:{attribute:!1},label:{type:String},placeholder:{type:String},disabled:{type:Boolean},_query:{state:!0},_facet:{state:!0},_open:{state:!0}};static styles=Qe`:host{display:block;min-width:0}*{box-sizing:border-box}button,input{font:inherit;color:var(--text)}button{cursor:default;user-select:none}.trigger{display:flex;align-items:center;gap:.6rem;width:100%;height:2rem;padding:.28rem .5rem;border:1px solid var(--border);border-radius:5px;background:var(--bg);text-align:left;font-size:.76rem}.trigger:hover:not(:disabled){border-color:var(--muted)}.trigger:disabled{opacity:.5}:host([variant=filter]){display:inline-block;max-width:min(20rem,100%)}:host([variant=filter]) .trigger{height:30px;min-width:8.5rem;background:0 0;font-size:.8rem;font-weight:500;border-radius:4px}.name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.option-copy{flex:1;min-width:0;display:grid;gap:.08rem}.secondary{color:var(--muted);font-size:.64rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.avatar{display:grid;place-items:center;flex:0 0 1.5rem;width:1.5rem;height:1.5rem;border-radius:50%;color:var(--accent);background:rgb(from var(--accent) r g b / .13);font-family:sans-serif;font-size:.62rem;font-weight:600}.count,.detail{flex:0 0 auto;color:var(--muted);font-size:.66rem;font-variant-numeric:tabular-nums;white-space:nowrap}svg{flex:0 0 auto;width:.9rem;height:.9rem;color:var(--muted)}.menu{visibility:hidden;position:fixed;inset:auto;margin:0;padding:0;overflow:hidden;border:1px solid var(--border);border-radius:8px;background:var(--bg);color:var(--text);box-shadow:0 .6rem 1.6rem rgb(0 0 0 / .4);user-select:none}.menu:popover-open{display:flex;flex-direction:column}.menu[data-positioned]{visibility:visible}.search{display:flex;align-items:center;gap:.5rem;flex:0 0 auto;padding:.55rem .65rem;border-bottom:1px solid var(--border)}input{flex:1;min-width:0;width:0;padding:.15rem 0;border:0;background:0 0;font-size:.78rem;outline:0}input::placeholder{color:var(--muted)}.search:focus-within{box-shadow:inset 0 -2px var(--accent)}.body{display:flex;min-height:0;flex:1}.facets{width:10.5rem;flex:0 0 auto;padding:.35rem;overflow:auto;overscroll-behavior:none;border-right:1px solid var(--border);background:rgb(from var(--bg) r g b / .25)}.org{display:flex;align-items:center;gap:.4rem;width:100%;padding:.4rem .45rem;border:0;border-radius:4px;background:0 0;text-align:left;font-size:.7rem}.org[aria-pressed=true]{color:var(--accent);background:rgb(from var(--accent) r g b / .1)}.results{flex:1;min-width:0;overflow:auto;overscroll-behavior:none;padding:.3rem}.group+.group{margin-top:.35rem;padding-top:.35rem;border-top:1px solid var(--border)}.heading{position:sticky;top:-.3rem;z-index:1;display:flex;align-items:center;gap:.4rem;margin:0;padding:.4rem .5rem;color:var(--muted);background:var(--bg);font-size:.68rem;font-weight:600}.heading svg{width:.8rem;height:.8rem}.option{display:flex;align-items:center;gap:.65rem;width:100%;padding:.35rem .5rem;border:0;border-radius:4px;background:0 0;text-align:left;font-size:.76rem}.option svg{width:.8rem;height:.8rem;opacity:0;color:var(--accent)}.option[aria-selected=true]{color:var(--accent);background:rgb(from var(--accent) r g b / .1)}.option[aria-selected=true] svg{opacity:1}.option:disabled{opacity:.45}.option:hover:not(:disabled),.org:hover{background:rgb(from var(--text) r g b / .05)}.pinned{padding-bottom:.25rem;margin-bottom:.25rem;border-bottom:1px solid var(--border)}.empty{margin:0;padding:1.3rem .7rem;color:var(--muted);font-size:.76rem}button:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}@media (max-width:40rem){.facets{width:8.5rem}}@media (max-width:28rem){.facets{width:7rem}.option{gap:.35rem}}`;constructor(){super(),this.options=[],this.value=null,this.label="Choose",this.placeholder="Choose",this.disabled=!1,this._query="",this._facet=null,this._open=!1,this._menuHeight=null,this._onViewport=()=>this._position()}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._onViewport),window.addEventListener("scroll",this._onViewport,!0)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._onViewport),window.removeEventListener("scroll",this._onViewport,!0)}render(){let e=this.options.find(s=>s.value===this.value),r=this.choices(),o=[...r.pinned,...r.sections.flatMap(s=>s.options)].filter(s=>!s.disabled),i=o.find(s=>s.value===this.value)?.value??o[0]?.value;return d`<button type="button" class="trigger" popovertarget="selector-menu" aria-label="${this.label}" aria-haspopup="dialog" aria-expanded="${this._open}" ?disabled="${this.disabled}">${e?this.optionIcon(e):m}<span class="name">${e?.label??this.placeholder}</span>${e?.detail?d`<span class="detail">${e.detail}</span>`:m} <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4"/></svg></button><div class="menu" id="selector-menu" popover="auto" role="dialog" aria-label="${this.label}" @beforetoggle="${this._beforeToggle}" @toggle="${this._toggle}" @keydown="${this._keyDown}"><div class="search"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="7" cy="7" r="4.5"/><path d="m10.5 10.5 3.5 3.5"/></svg> <input type="search" placeholder="${`${this.searchLabel}\u2026`}" aria-label="${this.searchLabel}" aria-controls="selector-options" .value="${xe(this._query)}" @input="${s=>{this._query=s.target.value}}"> <span class="count" role="status">${r.count}${r.count===r.total?"":` / ${r.total}`}</span></div><div class="body">${r.showFacets?d`<div class="facets" role="group" aria-label="${this.facetLabel}"><button type="button" class="org" aria-pressed="${r.activeFacet==null}" @click="${()=>this._filterFacet(null)}"><span class="name">${this.allFacetsLabel}</span><span class="count">${r.total}</span></button> ${r.facets.map(s=>d`<button type="button" class="org" title="${s.name}" aria-pressed="${r.activeFacet===s.value}" @click="${()=>this._filterFacet(s.value)}"><span class="name">${s.name}</span><span class="count">${s.count}</span></button>`)}</div>`:m}<div class="results" id="selector-options" role="listbox" aria-label="${this.optionsLabel}">${r.pinned.length>0?d`<div class="pinned">${r.pinned.map(s=>this._option(s,!1,i))}</div>`:m} ${r.sections.map((s,a)=>d`<div class="group" role="group" aria-labelledby="${s.label?`selector-group-${a}`:m}">${s.label?d`<h3 class="heading" id="${`selector-group-${a}`}">${s.organization?d`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.2" aria-hidden="true"><path d="M3 14V3h6v11M9 7h4v7M1 14h14M5 6h2M5 9h2M5 12h2"/></svg>`:m}${s.label}</h3>`:m} ${s.options.map(c=>this._option(c,s.organization,i))}</div>`)} ${r.count?m:d`<p class="empty">${this.options.length>0?this.noMatchesLabel:this.emptyLabel}</p>`}</div></div></div>`}optionIcon(e){return m}optionTitle(e){return e.label}_option(e,r,n){return d`<button type="button" class="option" role="option" ?data-reset="${e.reset}" ?disabled="${e.disabled}" aria-label="${e.label}" title="${this.optionTitle(e)}" aria-selected="${e.value===this.value}" tabindex="${e.value===n?0:-1}" @click="${()=>this._pick(e.value)}"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m3 8 3 3 7-7"/></svg>${this.optionIcon(e)}${e.initials?d`<span class="avatar" aria-hidden="true">${e.initials}</span>`:m}<span class="option-copy"><span class="name">${e.displayLabel??(r?e.name:e.label)}</span>${e.secondary?d`<span class="secondary">${e.secondary}</span>`:m}</span>${e.detail?d`<span class="detail">${e.detail}</span>`:m}</button>`}updated(e){this.disabled&&this._open&&this._close(!1),e.has("options")&&(this._menuHeight=null),this._position(),(e.has("_query")||e.has("_facet"))&&(this.renderRoot.querySelector(".results").scrollTop=0)}_beforeToggle(e){this._open=e.newState==="open",delete e.target.dataset.positioned,this._open&&(this._query="",this._facet=null,this._menuHeight=null)}async _toggle(e){e.newState==="open"&&(await this.updateComplete,!(!this._open||!this.isConnected)&&(this._position(),this.renderRoot.querySelector("input").focus({preventScroll:!0})))}_position(){let e=this.renderRoot.querySelector(".menu");if(!e?.matches(":popover-open"))return;let r=this.renderRoot.querySelector(".trigger").getBoundingClientRect(),n=8,o=e.querySelector(".facets")!=null,i=Math.min(Math.max(r.width,o?560:360),window.innerWidth-n*2),s=window.innerHeight-r.bottom-n-4,a=r.top-n-4;e.style.width=`${i}px`,this._menuHeight??=Math.min(480,e.querySelector(".search").offsetHeight+Math.max(e.querySelector(".results").scrollHeight,e.querySelector(".facets")?.scrollHeight??0)+2);let c=this._menuHeight,u=s<c&&a>s;e.style.maxHeight=`${Math.max(0,Math.min(c,u?a:s))}px`,e.style.left=`${Math.max(n,Math.min(r.left,window.innerWidth-i-n))}px`,e.style.top=`${Math.max(n,u?r.top-e.offsetHeight-4:r.bottom+4)}px`,e.dataset.positioned=""}_filterFacet(e){this._facet=e,this.renderRoot.querySelector("input").focus({preventScroll:!0})}_keyDown(e){if(e.stopPropagation(),e.key==="Escape"){e.preventDefault(),this._close();return}let r=this.renderRoot.querySelector("input"),n=this.renderRoot.activeElement,o=[...this.renderRoot.querySelectorAll(".option:not(:disabled)")],i=o.indexOf(n);if(n!==r&&i<0)return;if(e.key==="Enter"&&n===r){e.preventDefault(),(this.renderRoot.querySelector(".option:not([data-reset]):not(:disabled)")??o[0])?.click();return}let s;if(e.key==="ArrowDown")s=Math.min(i+1,o.length-1);else if(e.key==="ArrowUp")s=i-1;else if(n!==r&&e.key==="Home")s=0;else if(n!==r&&e.key==="End")s=o.length-1;else if(n!==r&&e.key.length===1&&e.key!==" "&&!e.ctrlKey&&!e.metaKey&&!e.altKey){e.preventDefault(),this._query+=e.key,r.focus();return}else return;e.preventDefault();for(let[a,c]of o.entries())c.tabIndex=a===s?0:-1;s<0?r.focus():o[s]?.focus()}_pick(e){this.disabled||!this.options.some(r=>r.value===e&&!r.disabled)||(this._close(),this.dispatchEvent(new CustomEvent(this.changeEvent,{detail:{value:e},bubbles:!0,composed:!0})))}_close(e=!0){this.renderRoot.querySelector(".menu").hidePopover(),this._open=!1,e&&this.renderRoot.querySelector(".trigger").focus({preventScroll:!0})}}});function W4(t){if(/^https?:\/\//iu.test(t)){try{let r=new URL(t),n=r.pathname.split("/").filter(Boolean);if(n.length>=2)return{owner:`${r.host}/${n[0]}`,name:n.slice(1).join("/")}}catch{}return{owner:null,name:t}}let e=/^([^\s/:]+)\/(.+)$/u.exec(t);return e?{owner:e[1],name:e[2]}:{owner:null,name:t}}function LE(t,e="",r=null){let n=t.map(b=>({...b,...b.special?{owner:null,name:b.label}:W4(b.label)})),o=new Map;for(let b of n)b.owner!=null&&o.set(b.owner,(o.get(b.owner)??0)+1);let i=[...o].filter(([,b])=>b>1).toSorted(([b],[v])=>$v(b,v)).map(([b,v])=>({value:b,name:b,count:v})),s=b=>(o.get(b.owner)??0)<=1,a=n.filter(b=>!b.special&&!b.reset&&s(b)).length;a>0&&i.push({value:_v,name:"Other",count:a});let c=i.some(b=>b.value===r)?r:null,u=IE(e.trim()).split(/\s+/u).filter(Boolean),p=b=>u.every(v=>IE(b.label).includes(v)),f=n.filter(b=>b.reset||b.special&&p(b)),h=n.filter(b=>!b.reset&&!b.special&&p(b)&&(c==null||(c===_v?s(b):b.owner===c))),g=new Map;for(let b of h){let v=(o.get(b.owner)??0)>1?b.owner:null;g.has(v)||g.set(v,[]),g.get(v).push(b)}let y=[...g].toSorted(([b],[v])=>b==null?1:v==null?-1:$v(b,v)).map(([b,v])=>({label:b??(i.some(x=>x.value!==_v)?"Other":null),organization:b!=null,options:v.toSorted((x,k)=>$v(x.label,k.label))}));return{facets:i,activeFacet:c,pinned:f,sections:y,count:h.length+f.filter(b=>!b.reset).length,total:n.filter(b=>!b.reset).length,showFacets:i.length>1}}var IE,$v,_v,FE=w(()=>{"use strict";IE=t=>t.normalize("NFKC").toLocaleLowerCase(),$v=(t,e)=>t.localeCompare(e,void 0,{numeric:!0,sensitivity:"base"}),_v=Symbol("other repositories")});var Sv,nf=w(()=>{"use strict";rf();FE();Sv=class extends Un{constructor(){super(),this.label="Choose repository",this.placeholder="Choose repository"}get searchLabel(){return"Search repositories"}get optionsLabel(){return"Repositories"}get facetLabel(){return"Filter by organization"}get allFacetsLabel(){return"All organizations"}get noMatchesLabel(){return"No matching repositories"}get emptyLabel(){return"No repositories available"}get changeEvent(){return"repository-change"}choices(){return LE(this.options,this._query,this._facet)}};customElements.get("repository-selector")||customElements.define("repository-selector",Sv)});function zi(t){return!Number.isFinite(t)||t<0?"\u2014":t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KiB`:t<1073741824?`${(t/1048576).toFixed(1)} MiB`:`${(t/1073741824).toFixed(1)} GiB`}function Oc(t){return Array.isArray(t)?t.reduce((e,r)=>({bytes:e.bytes!=null&&Number.isFinite(r.bytes)?e.bytes+r.bytes:null,lines:e.lines!=null&&Number.isFinite(r.lines)?e.lines+r.lines:null}),{bytes:0,lines:0}):{bytes:null,lines:null}}function Cv(t){return(t??[]).filter(e=>!["resource:base64","directory"].includes(e.format))}var Pc=w(()=>{"use strict"});function K4(t){return t.map(e=>{let r=["sourcemap","sourcemaps"].includes(e.kind)||e.filename.toLowerCase().endsWith(".map")?"sourcemap":"stasis",n=r==="sourcemap"?"Sourcemap":"Stasis",o=[];if(typeof e.size=="string"&&!["","\u2014"].includes(e.size)&&o.push(e.size),e.files){o.push(`${e.files.length.toLocaleString()} files`);let{lines:i}=Oc(e.files);i!=null&&o.push(`${i.toLocaleString()} LoC`)}return{value:e.id,label:e.filename,detail:n,format:r,secondary:o.join(" \xB7 ")}})}var Ev,Rv=w(()=>{"use strict";M();bt();rf();Wt();Pc();Ev=class extends Un{static properties={bundles:{attribute:!1}};static styles=[Un.styles,Qe`.bundle-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 1.05rem;width:1.05rem;height:1.05rem;color:var(--muted)}.bundle-icon img,.bundle-icon svg{display:block;width:100%;height:100%;opacity:1}.option{gap:.5rem;padding-block:.25rem}.option-copy{gap:0}.option .name{line-height:1.3}.option .bundle-icon{flex-basis:1.35rem;width:1.35rem;height:1.35rem;margin-right:.15rem}.secondary{line-height:1.25;font-variant-numeric:tabular-nums}`];constructor(){super(),this.bundles=[],this.label="Choose bundle",this.placeholder="Choose bundle"}get searchLabel(){return"Search bundles"}get optionsLabel(){return"Bundles"}get noMatchesLabel(){return"No matching bundles"}get emptyLabel(){return"No stored bundles"}get changeEvent(){return"bundle-change"}willUpdate(e){e.has("bundles")&&(this.options=K4(this.bundles))}optionIcon(e){return d`<span class="bundle-icon" aria-hidden="true">${e.format==="sourcemap"?Z(Gr):d`<img src="./stasis.svg" alt="">`}</span>`}optionTitle(e){return m}choices(){let e=this._query.normalize("NFKC").toLocaleLowerCase().trim().split(/\s+/u).filter(Boolean),r=this.options.filter(n=>e.every(o=>`${n.label} ${n.detail}`.normalize("NFKC").toLocaleLowerCase().includes(o))).toSorted((n,o)=>n.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"}));return{pinned:[],sections:[{label:null,options:r}],facets:[],showFacets:!1,count:r.length,total:this.options.length}}};customElements.get("bundle-selector")||customElements.define("bundle-selector",Ev)});var Av,BE=w(()=>{"use strict";rf();Av=class extends Un{constructor(){super(),this.label="Choose workspace",this.placeholder="Choose workspace"}get searchLabel(){return"Search workspaces"}get optionsLabel(){return"Workspaces"}get noMatchesLabel(){return"No matching workspaces"}get emptyLabel(){return"No workspaces available"}get changeEvent(){return"workspace-change"}choices(){let e=this._query.normalize("NFKC").toLocaleLowerCase().trim().split(/\s+/u).filter(Boolean),r=this.options.filter(n=>e.every(o=>n.label.normalize("NFKC").toLocaleLowerCase().includes(o))).toSorted((n,o)=>n.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"}));return{pinned:[],sections:[{label:null,options:r}],facets:[],showFacets:!1,count:r.length,total:this.options.length}}};customElements.get("workspace-selector")||customElements.define("workspace-selector",Av)});var Nc,Tv,OE=w(()=>{"use strict";M();bt();Uu();Di();Rv();nf();BE();Nc=t=>({kind:t,sourceId:null,ids:new Set}),Tv=class extends J{static properties={mode:{type:String},loadSources:{attribute:!1},restore:{attribute:!1},_sources:{state:!0},_loading:{state:!0},_error:{state:!0},_merge:{state:!0},_link:{state:!0}};constructor(){super(),this.mode="link",this._sources=null,this._loading=!1,this._error=null,this._merge=Nc("bundle"),this._link=Nc("repository")}disconnectedCallback(){super.disconnectedCallback(),this._controller?.abort()}updated(e){if(e.has("loadSources")){this._load();return}e.has("mode")&&this._selectOnlySource(),e.has("restore")&&this._restore(),["_sources","_merge","_link","mode","restore"].some(r=>e.has(r))&&this._notify()}get _current(){return this.mode==="merge"?this._merge:this._link}get _parents(){if(this.mode==="merge")return this._sources?.merge?.bundles??[];let e=this._sources?.link?.reports??[];return this._current.kind==="workspace"?(this._sources?.link?.workspaces??[]).filter(r=>e.some(n=>r.reports.includes(n.id))):(this._sources?.link?.repositories??[]).filter(r=>e.some(n=>n.repoIds.includes(r.id)))}get _parent(){return this._parents.find(e=>e.id===this._current.sourceId)}get _scopeOptions(){let e=this._sources?.link?.reports??[];return this._parents.map(r=>{let n=e.filter(o=>this._current.kind==="workspace"?r.reports.includes(o.id):o.repoIds.includes(r.id)).length;return{value:r.id,label:r.label,detail:`${n} ${n===1?"report":"reports"}`}})}get _inputs(){return this._parent?this.mode==="merge"?(this._sources?.merge?.results??[]).filter(e=>e.bundleId===this._parent.id):(this._sources?.link?.reports??[]).filter(e=>this._current.kind==="workspace"?this._parent.reports.includes(e.id):e.repoIds.includes(this._parent.id)):[]}get selection(){let e=this._parent;return{mode:this.mode,source:e?{kind:this._current.kind,id:e.id,label:e.label??e.filename}:null,inputs:this._loading||this._error?[]:this._inputs.filter(r=>this._current.ids.has(r.id))}}_notify(){this.dispatchEvent(new CustomEvent("report-inputs-change",{detail:this.selection,bubbles:!0,composed:!0}))}async _load(){this._controller?.abort();let e=this._controller=new AbortController;this._loading=!0,this._error=null,this._notify();try{let r=this.loadSources?await this.loadSources(e.signal):{merge:{bundles:[],results:[]},link:{repositories:[],reports:[]}};if(e.signal.aborted)return;this._sources=r,this._merge=Nc("bundle"),this._link=Nc(Array.isArray(r.link?.workspaces)?"workspace":"repository"),this._selectOnlySource(),this._restore()}catch(r){e.signal.aborted||(this._error=String(r?.message??r))}finally{e.signal.aborted||(this._loading=!1,this._notify())}}_setCurrent(e){this.mode==="merge"?this._merge=e:this._link=e}_selectSource(e){e===this._current.sourceId||!this._parents.some(r=>r.id===e)||(this._setCurrent({...this._current,sourceId:e,ids:new Set}),this._setCurrent({...this._current,ids:new Set(this._inputs.map(r=>r.id))}),this._notify())}_changeKind(e){["workspace","repository"].includes(e)&&(e==="workspace"&&!Array.isArray(this._sources?.link?.workspaces)||(e!==this._link.kind&&(this._link=Nc(e)),this._selectOnlySource(),this._notify()))}_selectOnlySource(){this.mode==="link"&&this._current.sourceId==null&&this._parents.length===1&&this._selectSource(this._parents[0].id)}_toggle(e,r){if(!this._inputs.some(o=>o.id===e))return;let n=new Set(this._current.ids);r?n.add(e):n.delete(e),this._setCurrent({...this._current,ids:n}),this._notify()}_selectAll(e){this._setCurrent({...this._current,ids:new Set(e?this._inputs.map(r=>r.id):[])}),this._notify()}_restore(){let e=this.restore;if(!this._sources||e?.mode!==this.mode||!e.source)return;let r=this.mode==="merge"?"bundle":e.source.kind;this.mode==="link"&&(r==="workspace"?!Array.isArray(this._sources.link?.workspaces):r!=="repository")||(this._setCurrent({kind:r,sourceId:e.source.id,ids:new Set}),this._setCurrent({...this._current,ids:new Set(this._inputs.filter(n=>e.inputIds.includes(n.id)).map(n=>n.id))}))}render(){let e=this.mode==="merge",r=this._inputs,n=this.selection.inputs.length,o=Array.isArray(this._sources?.link?.workspaces),i=this._parent?e?"No scan results for this bundle.":`No saved reports in this ${this._current.kind}.`:e?"Choose a bundle to see its scan results.":this._parents.length===0?"No saved reports with app findings.":`Choose a ${this._current.kind} to see its saved reports.`;return d`<section class="panel" aria-label="${e?"Merge scan results":"Link saved reports"}" aria-busy="${this._loading}"><div class="source">${!e&&o?d`<div class="kinds" role="radiogroup" aria-label="Report source">${[["workspace","Workspace"],["repository","Repository"]].map(([s,a])=>d`<button type="button" role="radio" aria-checked="${s===this._link.kind}" @click="${()=>this._changeKind(s)}">${a}</button>`)}</div>`:m}<div class="field">${e?d`<span>Bundle with scan results</span>`:m} ${e?d`<bundle-selector .bundles="${this._parents}" .value="${this._current.sourceId}" ?disabled="${this._loading||this._parents.length===0}" @bundle-change="${s=>this._selectSource(s.detail.value)}"></bundle-selector>`:this._current.kind==="workspace"?d`<workspace-selector .options="${this._scopeOptions}" .value="${this._current.sourceId}" ?disabled="${this._loading}" @workspace-change="${s=>this._selectSource(s.detail.value)}"></workspace-selector>`:d`<repository-selector .options="${this._scopeOptions}" .value="${this._current.sourceId}" ?disabled="${this._loading}" @repository-change="${s=>this._selectSource(s.detail.value)}"></repository-selector>`}</div></div>${this._error?d`<p class="empty" role="alert">Couldn’t load report inputs: ${this._error} <button type="button" @click="${()=>{this._load()}}">Retry</button></p>`:this._loading?d`<p class="empty" role="status">Loading report inputs…</p>`:r.length>0?d`<div class="list-head"><label><input type="checkbox" aria-label="Select all" .checked="${n===r.length}" .indeterminate="${n>0&&n<r.length}" @change="${s=>this._selectAll(s.target.checked)}"><strong>All</strong></label><span>${n} of ${r.length} selected</span></div><div class="list">${r.map(s=>this._row(s))}</div>`:d`<p class="empty">${e&&this._parents.length===0?"No scan results available.":i}</p>`}</section>`}_row(e){let r=this.mode==="link"?e.appFindings:e.findings,n=[e.model?Ic(e.model):null,r==null?null:`${r} ${this.mode==="link"?"app ":""}${r===1?"finding":"findings"}`,e.createdAt,e.repo?`${e.repo}${e.directory?`/${e.directory}`:""}`:null].filter(Boolean);return d`<label class="option"><input type="checkbox" .checked="${this._current.ids.has(e.id)}" @change="${o=>this._toggle(e.id,o.target.checked)}">${Z(Pl[e.analyzer]??Pl.default)}<span class="copy"><strong>${e.title??e.filename}</strong><span>${n.join(" \xB7 ")}</span></span></label>`}static styles=Qe`:host{display:block;min-width:0}*{box-sizing:border-box}.panel{border:1px solid var(--border);border-radius:9px;background:var(--surface);overflow:hidden}.source{display:flex;flex-wrap:wrap;align-items:center;gap:.7rem;padding:.85rem .9rem;border-bottom:1px solid var(--border)}.field{display:grid;flex:1 1 14rem;gap:.3rem;max-width:32rem;min-width:0}.field>span{color:var(--muted);font-size:.72rem}button{padding:.3rem .55rem;border:1px solid var(--border);border-radius:5px;color:var(--text);background:var(--bg);font:inherit;font-size:.74rem;cursor:default}.kinds{display:flex;width:fit-content;border:1px solid var(--border);border-radius:5px;overflow:hidden}.kinds button{padding-block:.5rem;border:0;border-radius:0;color:var(--muted)}.kinds button+button{border-left:1px solid var(--border)}.kinds button[aria-checked=true]{color:var(--text);background:var(--surface-active)}.list-head{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.55rem .9rem;border-bottom:1px solid var(--border)}.list-head label{display:flex;align-items:center;gap:.55rem;user-select:none}.list-head strong{color:var(--text);font-size:.74rem;font-weight:600}.list-head>span{color:var(--muted);font-size:.68rem}.list{max-height:24rem;overflow:auto;overscroll-behavior:none}.option{display:flex;align-items:center;gap:.55rem;min-width:0;padding:.35rem .9rem;user-select:none}.option+.option{border-top:1px solid var(--border)}.option:hover{background:var(--surface-active)}input{width:.85rem;height:.85rem;margin:0;flex:0 0 auto;accent-color:var(--accent)}.file-icon{width:1.4rem;height:1.4rem;flex:0 0 auto}.copy{display:flex;align-items:center;justify-content:space-between;gap:.75rem;flex:1;min-width:0}.copy span,.copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.copy strong{flex:1;color:var(--text);font-size:.74rem;font-weight:500}.copy span{max-width:55%;color:var(--muted);font-size:.66rem}.empty{margin:0;padding:1rem .9rem;color:var(--muted);font-size:.76rem}button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}`};customElements.get("scan-report-inputs")||customElements.define("scan-report-inputs",Tv)});var G4,q4,Mv,Iv=w(()=>{"use strict";M();G4=d`<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6 4h7M6 8h7M6 12h7M3 4h.01M3 8h.01M3 12h.01"/></svg>`,q4=d`<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="7" cy="7" r="4.5"/><path d="m10.5 10.5 3 3M7 5v4M5 7h4"/></svg>`,Mv=class extends J{static properties={isolate:{type:Boolean},vertical:{type:Boolean,reflect:!0}};constructor(){super(),this.isolate=!1,this.vertical=!1}_select(e){this.isolate!==e&&(this.isolate=e,this.dispatchEvent(new CustomEvent("depth-change",{detail:{isolate:e},bubbles:!0,composed:!0})))}render(){return d`<div class="scan-depth"><div class="depth-options" role="radiogroup" aria-label="Scan depth" aria-orientation="${this.vertical?"vertical":"horizontal"}" aria-describedby="${this.vertical?m:"scan-depth-description"}">${[[!1,"List",G4],[!0,"Isolate",q4]].map(([e,r,n])=>d`<label class="depth-choice"><input type="radio" name="scan-depth" value="${e?"isolate":"list"}" .checked="${this.isolate===e}" @change="${()=>this._select(e)}"><span>${n}${r}</span></label>`)}</div>${this.vertical?m:d`<div class="depth-description" id="scan-depth-description" aria-live="polite"><span class="${this.isolate?"inactive":""}" aria-hidden="${this.isolate}">Regular scan depth</span><span class="${this.isolate?"":"inactive"}" aria-hidden="${!this.isolate}">Deeper search at ~10x the tokens spent</span></div>`}</div>`}static styles=Qe`:host{display:block;width:19rem;max-width:100%;min-width:0}*{box-sizing:border-box}.scan-depth{display:grid;gap:.4rem;width:100%;min-width:0;user-select:none}.depth-options{display:flex;position:relative;padding:.2rem;border:1px solid var(--border);border-radius:8px;background:var(--bg)}.depth-options::before{content:'';position:absolute;inset:.2rem auto .2rem .2rem;width:calc((100% - .4rem)/ 2);border-radius:5px;background:var(--surface-active);box-shadow:0 1px 3px rgb(0 0 0 / .12),inset 0 0 0 1px rgb(from var(--accent) r g b / .18);transition:transform .16s ease-out}.depth-options:has(input[value=isolate]:checked)::before{transform:translateX(100%)}.depth-choice{position:relative;flex:1;min-width:0}.depth-choice input{position:absolute;width:1px;height:1px;opacity:0}.depth-choice span{display:flex;align-items:center;justify-content:center;gap:.4rem;height:1.9rem;padding:.3rem .65rem;border-radius:5px;color:var(--muted);font-size:.76rem;font-weight:500;transition:color .12s}.depth-choice svg{width:.95rem;height:.95rem;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}.depth-choice:hover span{color:var(--text)}.depth-choice input:checked+span{color:var(--accent)}.depth-choice input:focus-visible+span{outline:2px solid var(--accent);outline-offset:-2px}.depth-description{display:grid;color:var(--muted);font-size:.68rem;line-height:1.4}.depth-description span{grid-area:1/1}.depth-description .inactive{visibility:hidden}@media (prefers-reduced-motion:reduce){.depth-choice span,.depth-options::before{transition:none}}:host([vertical]){width:5.8rem}:host([vertical]) .depth-options{flex-direction:column}:host([vertical]) .depth-options::before{inset:.2rem .2rem auto;width:auto;height:calc((100% - .4rem)/ 2)}:host([vertical]) .depth-options:has(input[value=isolate]:checked)::before{transform:translateY(100%)}:host([vertical]) .depth-choice span{justify-content:flex-start;height:1.7rem;padding:.25rem .5rem;font-size:.72rem}`};customElements.get("scan-depth-toggle")||customElements.define("scan-depth-toggle",Mv)});function Fv(t,e){let r=e.models.find(n=>n.id===e.defaultModel)??e.models[0];return r?(t.length>0?t:[{mode:"generic",isolate:!1}]).map(n=>{let o=e.models.find(i=>i.id===n.model)??r;return{...n,mode:Lv.includes(n.mode)?n.mode:"generic",model:o.id,effort:o.efforts.includes(n.effort)?n.effort:Bc(o),isolate:!!n.isolate}}):[]}function Bv(t){let e=new Set;return t.map(r=>{let n=Y4(r),o=e.has(n);return e.add(n),o})}var Lv,Y4,PE=w(()=>{"use strict";Di();Lv=["security","generic","correctness"],Y4=t=>JSON.stringify([t.mode,t.model,t.effort,t.isolate])});var Ov,NE=w(()=>{"use strict";M();Jt();vt();xv();Iv();PE();Ov=class extends J{static properties={value:{attribute:!1},loadModels:{attribute:!1},_rows:{state:!0},_loading:{state:!0},_error:{state:!0}};constructor(){super(),this.value=[],this._rows=[],this._catalogue={models:[]},this._nextId=0,this._loading=!0,this._error=null}disconnectedCallback(){super.disconnectedCallback(),this._controller?.abort()}updated(e){if(e.has("loadModels")){this._load();return}e.has("value")&&this.value!==this._lastEmitted&&!this._loading&&(this._setRows(this.value),this._notify())}_setRows(e){this._rows=Fv(e,this._catalogue).map(r=>({...r,id:r.id??++this._nextId}))}_notify(){let e=this._loading&&this._rows.length===0?this.value:this._rows.map(({id:n,...o})=>o),r=!this._loading&&!this._error&&e.length>0&&!Bv(e).includes(!0);this._lastEmitted=e,this.dispatchEvent(new CustomEvent("regimes-change",{detail:{value:e,ready:r},bubbles:!0,composed:!0}))}async _load(){this._controller?.abort();let e=this._controller=new AbortController;this._loading=!0,this._error=null,this._notify();try{let r=await this.loadModels(e.signal);if(e.signal.aborted)return;this._catalogue=r,this._sharedModels=()=>Promise.resolve(r),this._setRows(this._rows.length>0?this._rows:this.value)}catch(r){e.signal.aborted||(this._error=String(r?.message??r))}finally{e.signal.aborted||(this._loading=!1,this._notify())}}_change(e,r){let n=this._rows.find(i=>i.id===e);if(!n)return;let o=Fv([{...n,...r}],this._catalogue)[0];o&&(this._rows=this._rows.map(i=>i.id===e?o:i),this._notify())}_add(){let e=this._rows.at(-1);e&&(this._rows=[...this._rows,{...e,id:++this._nextId}],this._notify())}_remove(e){this._rows.length<=1||(this._rows=this._rows.filter(r=>r.id!==e),this._notify())}render(){let e=Bv(this._rows);return d`<section aria-label="Scan regimes" aria-busy="${this._loading}"><div class="heading"><h2>Scan regimes</h2><span>${this._rows.length} ${this._rows.length===1?"regime":"regimes"}</span></div>${this._error?d`<p class="message" role="alert">Couldn’t load models: ${this._error} <button type="button" @click="${()=>{this._load()}}">Retry</button></p>`:this._loading&&this._rows.length===0?d`<p class="message" role="status">Loading models…</p>`:d`${te(this._rows,r=>r.id,(r,n)=>this._row(r,n,e[n]))}<div class="footer"><button type="button" class="add" ?disabled="${this._rows.length===0}" @click="${this._add}"><span aria-hidden="true">+</span> Add regime</button><span class="message" role="status">${e.includes(!0)?"Change or remove duplicate regimes to run the scan":"Results from these regimes will be merged"}</span></div>`}</section>`}_row(e,r,n){return d`<div class="${`row${n?" duplicate":""}`}" role="group" aria-label="${`Regime ${r+1}`}" aria-describedby="${n?`duplicate-${e.id}`:m}"><div class="mode" role="radiogroup" aria-label="Scan mode">${Lv.map(o=>d`<label class="mode-choice"><input type="radio" name="${`regime-mode-${e.id}`}" .checked="${e.mode===o}" @change="${()=>this._change(e.id,{mode:o})}"><span>${o[0].toUpperCase()+o.slice(1)}</span></label>`)}</div><scan-model-picker .loadModels="${this._sharedModels}" .value="${xe(e.model)}" .effort="${xe(e.effort)}" @model-change="${o=>{o.stopPropagation(),this._change(e.id,o.detail)}}"></scan-model-picker><div class="row-actions"><scan-depth-toggle vertical .isolate="${e.isolate}" @depth-change="${o=>{o.stopPropagation(),this._change(e.id,{isolate:o.detail.isolate})}}"></scan-depth-toggle>${n?d`<span class="duplicate-label" id="${`duplicate-${e.id}`}">Duplicate regime</span>`:m}</div><button type="button" class="remove" aria-label="${`Remove regime ${r+1}`}" ?disabled="${this._rows.length===1}" @click="${()=>this._remove(e.id)}"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="m4 4 8 8M12 4l-8 8"/></svg></button></div>`}static styles=Qe`:host{display:block;min-width:0;container:regime-editor/inline-size}*{box-sizing:border-box}.heading{display:flex;align-items:baseline;gap:.65rem;margin-bottom:.75rem}h2{margin:0;color:var(--text);font-size:.85rem;font-weight:600}.heading>span{color:var(--muted);font-size:.7rem}.row{position:relative;display:grid;grid-template-columns:7.75rem minmax(0,1fr) 5.8rem;align-items:start;gap:1rem;padding:.85rem 0;border-top:1px solid var(--border)}.mode{display:grid;min-width:0;border:1px solid var(--border);border-radius:6px;overflow:hidden;background:var(--bg)}.mode-choice{position:relative;user-select:none}.mode-choice+.mode-choice{border-top:1px solid var(--border)}.mode-choice input{position:absolute;width:1px;height:1px;opacity:0}.mode-choice span{display:block;padding:.2rem .6rem;color:var(--muted);font-size:.72rem;line-height:1.15rem}.mode-choice:hover span{background:var(--surface-active)}.mode-choice input:checked+span{color:var(--accent);background:rgb(from var(--accent) r g b / .1);box-shadow:inset 2px 0 var(--accent);font-weight:600}.mode-choice input:focus-visible+span{outline:2px solid var(--accent);outline-offset:-2px}button{border:1px solid var(--border);border-radius:5px;color:var(--text);background:var(--bg);font:inherit;font-size:.74rem;cursor:default}button{padding:.4rem .55rem;user-select:none}button:hover:not(:disabled){background:var(--surface-active)}button:disabled{opacity:.35}.row-actions{position:relative;display:flex;align-items:center;align-self:stretch;min-height:4.65rem;padding:.8rem 0 .25rem}.remove{position:absolute;top:.15rem;right:0;display:grid;place-items:center;width:1.5rem;height:1.5rem;padding:.25rem;border:0;background:0 0;color:var(--muted)}.duplicate-label{position:absolute;right:.15rem;bottom:-.05rem;transform:rotate(-7deg);padding:.1rem .3rem;border:1px solid rgb(from var(--critical,#e5534b) r g b / .45);border-radius:3px;color:var(--critical,#e5534b);background:var(--surface);font-size:.6rem;line-height:1rem;white-space:nowrap;pointer-events:none;user-select:none}svg{width:1rem;height:1rem}.footer{display:flex;flex-wrap:wrap;align-items:center;gap:.7rem;padding-top:.6rem;border-top:1px solid var(--border)}.add{display:flex;align-items:center;gap:.3rem}.message{margin:0;color:var(--muted);font-size:.7rem}button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}scan-model-picker{grid-row:2;grid-column:1/-1}.mode{grid-column:1;max-width:9rem}.row-actions{grid-column:2}`};customElements.get("scan-regime-editor")||customElements.define("scan-regime-editor",Ov)});var DE,zE=w(()=>{"use strict";M();DE=Qe`:host{display:block;box-sizing:border-box;color:var(--text)}*{box-sizing:border-box}.wrap{max-width:68rem;margin:0 auto;container:scan-page/inline-size}.head{display:flex;flex-wrap:wrap;align-items:center;gap:.65rem;min-height:2.1rem;margin-bottom:.45rem}.head-title{display:flex;align-items:center;gap:.65rem}h1{margin:0;font-size:1.65rem;font-weight:600;letter-spacing:-.035em}.head-tabs{display:inline-flex;margin-left:.7rem;border:1px solid var(--border);border-radius:6px;overflow:hidden}.head-tabs button{border:0;border-right:1px solid var(--border);padding:.25rem .6rem;color:var(--muted);background:0 0;font:inherit;font-size:.75rem}.head-tabs button:last-child{border-right:0}.head-tabs button.active{color:var(--text);background:var(--surface-active)}.head-tabs button:hover{color:var(--text)}.source-choice.single-repository{grid-template-columns:1fr}.head-actions{margin-left:auto;display:flex;gap:.45rem}button,input,select{font:inherit}button{cursor:default}button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.intro{margin:0 0 1.15rem;max-width:52rem;color:var(--muted);font-size:.82rem;line-height:1.5}.intro span{display:block}.notice{margin:0 0 1rem;padding:.55rem .7rem;border:1px solid rgb(from var(--accent) r g b / .35);border-radius:7px;color:var(--text);background:rgb(from var(--accent) r g b / .08);font-size:.78rem}.setup{display:grid;gap:.85rem}.panel{border:1px solid var(--border);border-radius:9px;background:var(--surface);overflow:hidden}.panel-head{display:flex;align-items:baseline;justify-content:space-between;gap:.7rem;padding:.72rem .9rem;border-bottom:1px solid var(--border)}.panel-head h2{margin:0;font-size:.86rem;font-weight:600}.panel-head p{margin:0;color:var(--muted);font-size:.72rem}.bundle-choice{display:grid;grid-template-columns:minmax(16rem,1.2fr) minmax(0,1fr);gap:1rem;align-items:end;padding:.85rem .9rem}.field{display:grid;gap:.3rem;min-width:0}.field label,.scope-field>span{color:var(--muted);font-size:.68rem}select{min-width:0;height:2rem;padding:.28rem .5rem;border:1px solid var(--border);border-radius:5px;color:var(--text);background:var(--bg);font-size:.76rem}.bundle-stats{display:grid;grid-template-columns:repeat(4,max-content);align-items:center;gap:.45rem 1.1rem;min-width:0}.metric{display:inline-flex;align-items:center;gap:.3rem;min-width:0;white-space:nowrap}.metric svg{flex:0 0 auto;width:.85rem;height:.85rem;margin-right:.1rem;color:var(--muted)}.metric strong{min-width:0;overflow:hidden;text-overflow:ellipsis;font-size:.72rem;font-weight:600;font-variant-numeric:tabular-nums}.metric span{color:var(--muted);font-size:.7rem}.mode-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.45rem;padding:.7rem .9rem .85rem}.mode-option{display:grid;gap:.25rem;min-width:0;padding:.55rem .6rem;border:1px solid var(--border);border-radius:6px;color:var(--muted);background:var(--bg);text-align:left}.mode-title{display:flex;align-items:center;gap:.35rem;min-width:0}.mode-title svg{width:.95rem;height:.95rem;flex:0 0 auto;color:var(--muted)}.mode-option strong{color:var(--text);font-size:.75rem;font-weight:600}.mode-option span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.63rem}.mode-option.active{border-color:rgb(from var(--accent) r g b / .55);background:rgb(from var(--accent) r g b / .1)}.mode-option.active .mode-title svg,.mode-option.active strong{color:var(--accent)}.subtype-wrap{border-top:1px solid var(--border);background:rgb(from var(--accent) r g b / .025)}.subtype-options{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.45rem;padding:.7rem .9rem .45rem}.report-subtypes{grid-template-columns:repeat(2,minmax(0,1fr));padding-bottom:.7rem}.subtype-option{display:grid;gap:.12rem;padding:.42rem .55rem;border:1px solid var(--border);border-radius:5px;color:var(--muted);background:var(--bg);text-align:left}.subtype-option strong{color:var(--text);font-size:.72rem;font-weight:500}.subtype-option span{font-size:.62rem}.subtype-option.active{border-color:rgb(from var(--accent) r g b / .55);background:rgb(from var(--accent) r g b / .1)}.subtype-option.active strong{color:var(--accent)}.subtype-help{margin:0;padding:.15rem .9rem .72rem;color:var(--muted);font-size:.68rem;line-height:1.4}.source-choice{display:grid;grid-template-columns:minmax(12rem,.8fr) minmax(16rem,1.2fr);gap:.7rem;align-items:end;padding:.85rem .9rem}.source-footer{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:.7rem 1rem;grid-column:1/-1;min-width:0}.scope-slot{justify-self:end;width:min(34rem,100%);min-height:2rem}.source-footer .bundle-stats{min-height:2rem}.scope-toggle{display:flex;align-items:center;justify-content:end;gap:.7rem;min-width:0;min-height:2rem}.scope-options{display:flex;flex-shrink:0;min-width:0;border:1px solid var(--border);border-radius:5px;overflow:hidden;background:var(--bg)}.scope-option{position:relative;flex:1 0 auto;user-select:none}.scope-option+.scope-option{border-left:1px solid var(--border)}.scope-option input{position:absolute;width:1px;height:1px;opacity:0}.scope-option span{display:grid;place-items:center;height:calc(2rem - 2px);padding:.3rem .55rem;color:var(--muted);font-size:.74rem;white-space:nowrap}.scope-option:hover span{color:var(--text);background:var(--surface-active)}.scope-option input:checked+span{color:var(--text);background:var(--surface-active);font-weight:500}.scope-option input:focus-visible+span{outline:2px solid var(--accent);outline-offset:-2px}.scope-description{order:-1;min-width:0;color:var(--muted);font-size:.66rem;line-height:1rem;text-align:right}.scope-field{display:flex;align-items:center;justify-content:end;gap:.5rem;min-width:0;max-width:100%;margin-left:auto}.scope-field select{width:13rem;max-width:100%;flex:1 1 auto}.choice-empty{display:flex;align-items:center;height:2rem;padding:.28rem .5rem;border:1px dashed var(--border);border-radius:5px;color:var(--muted);background:var(--bg);font-size:.72rem}.scope-head{display:flex;align-items:center;gap:.55rem;padding:.72rem .9rem;list-style:none;cursor:default;user-select:none}.scope-head::-webkit-details-marker{display:none}.scope-head:hover{background:var(--surface-active)}.scope-head:focus-visible{outline:2px solid var(--accent);outline-offset:-3px;border-radius:8px}.scope-chevron{width:.85rem;height:.85rem;flex:0 0 auto;transition:transform .15s}.scope-panel[open] .scope-chevron{transform:rotate(90deg)}.scope-panel[open] .scope-head{border-bottom:1px solid var(--border)}.scope-head h2{margin:0;font-size:.86rem;font-weight:600}.scope-head p{display:flex;flex-wrap:wrap;justify-content:end;gap:.15rem .65rem;margin:0 0 0 auto;color:var(--muted);font-size:.7rem;font-variant-numeric:tabular-nums;text-align:right}.scope-head p span{white-space:nowrap}.scope-head p span+span{padding-left:.65rem;border-left:1px solid var(--border)}.scope-grid{display:grid;grid-template-columns:minmax(13rem,.75fr) minmax(0,1.25fr);min-height:0}.scope-pane{min-width:0}.scope-pane+.scope-pane{border-left:1px solid var(--border)}.pane-head{display:flex;align-items:baseline;justify-content:space-between;gap:.5rem;padding:.55rem .75rem;border-bottom:1px solid var(--border)}.pane-head strong{font-size:.72rem;font-weight:600}.pane-head span{color:var(--muted);font-size:.65rem;font-variant-numeric:tabular-nums}.package-list{max-height:22rem;overflow:auto;overscroll-behavior:none}.package-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.45rem;width:100%;padding:.42rem .7rem;border:0;border-bottom:1px solid var(--border);color:var(--text);background:0 0;text-align:left}.package-row:hover{background:var(--surface-active)}.file input,.package-row input{width:.85rem;height:.85rem;accent-color:var(--accent)}.package-name,.package-size{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.package-name{font-size:.7rem}.package-size{color:var(--muted);font-size:.64rem;font-variant-numeric:tabular-nums}.package-row.excluded .package-name{color:var(--muted);text-decoration:line-through}.file-panel{min-width:0}.file-list{display:grid;grid-template-columns:minmax(0,1fr);max-height:22rem;overflow:auto;overscroll-behavior:none}.file{display:flex;align-items:center;gap:.45rem;min-width:0;padding:.35rem .75rem;border-bottom:1px solid var(--border)}.file input{flex:0 0 auto}.file-copy{display:flex;align-items:center;gap:.75rem;flex:1;min-width:0}.file-path{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem}.file-meta{flex:0 1 auto;min-width:0;max-width:50%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:.66rem;font-variant-numeric:tabular-nums}.excluded .file-path{color:var(--muted);text-decoration:line-through}.file-foot{display:flex;justify-content:space-between;gap:.6rem;padding:.6rem .8rem;color:var(--muted);font-size:.7rem}.options{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:1rem;position:relative;z-index:2;overflow:visible;padding:.85rem .9rem 1rem}.options-grid{display:grid;grid-column:1/-1;gap:.7rem;min-width:0}.checks{position:relative;display:grid;grid-column:2;grid-row:3;align-content:center;justify-items:end;margin-top:1rem}.offline-help{position:absolute;top:calc(50% + .75rem);right:0;color:var(--muted);font-size:.66rem;line-height:1.4;white-space:nowrap}.check{display:inline-flex;align-items:center;gap:.4rem;color:var(--text);font-size:.75rem}.check input{width:.85rem;height:.85rem;accent-color:var(--accent)}.switch{display:inline-flex;align-items:center;gap:.45rem;color:var(--text);font-size:.74rem;cursor:default}.switch input{position:absolute;width:1px;height:1px;opacity:0}.switch-track{position:relative;width:2rem;height:1.1rem;border-radius:999px;background:var(--surface-active);transition:background .12s}.switch-track::after{content:'';position:absolute;top:.15rem;left:.15rem;width:.8rem;height:.8rem;border-radius:50%;background:var(--muted);transition:transform .12s,background .12s}.switch input:checked+.switch-track{background:rgb(from var(--accent) r g b / .4)}.switch input:checked+.switch-track::after{transform:translateX(.9rem);background:var(--accent)}.checks .switch input:checked+.switch-track{background:rgb(from var(--critical,#e5534b) r g b / .3)}.checks .switch input:checked+.switch-track::after{background:var(--critical,#e5534b)}.switch input:focus-visible+.switch-track{outline:2px solid var(--accent);outline-offset:2px}.options-footer{display:flex;flex-wrap:wrap;grid-column:1;grid-row:3;align-items:end;gap:.7rem;min-width:0;margin-top:1rem}.options-footer slot[name=before-run]{display:contents}.agentic-fields{display:grid;gap:.65rem;padding:.85rem .9rem 1rem}.agentic-panel .panel-head{align-items:center}.prompt-row{display:flex;align-items:start;gap:.4rem;min-width:0}.prompt-row textarea{flex:1;width:0}.prompt-action{display:grid;place-items:center;flex:0 0 auto;width:1.5rem;height:1.5rem;padding:.25rem;border:0;border-radius:4px;color:var(--muted);background:0 0}.prompt-action:hover{color:var(--text);background:var(--surface-active)}.prompt-action svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-width:1.4}textarea{min-width:0;resize:vertical;padding:.4rem .5rem;border:1px solid var(--border);border-radius:5px;color:var(--text);background:var(--bg);font:inherit;font-size:.76rem}.run{padding:.48rem .8rem;border:0;border-radius:6px;color:var(--bg);background:var(--accent);font-size:.8rem;font-weight:600}.run:disabled{opacity:.45}.summary{align-self:end;padding-block:.48rem;color:var(--muted);font-size:.74rem}.history{display:grid;gap:.6rem}.scan-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:1rem;padding:.85rem .9rem}.scan-row+.scan-row{border-top:1px solid var(--border)}.scan-main{min-width:0}.scan-title{display:flex;align-items:center;gap:.45rem;min-width:0}.scan-title strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.82rem}.scan-meta{display:block;margin-top:.25rem;color:var(--muted);font-size:.7rem}.status{display:inline-flex;align-items:center;gap:.3rem;padding:.15rem .4rem;border-radius:999px;font-size:.66rem;font-weight:600;text-transform:capitalize}.status::before{content:'';width:.4rem;height:.4rem;border-radius:50%;background:currentColor}.status.running{color:var(--accent);background:rgb(from var(--accent) r g b / .1)}.status.completed{color:#48b878;background:rgb(72 184 120 / .1)}.status.stopped{color:var(--muted);background:var(--surface-active)}.scan-actions{display:flex;align-items:center;gap:.45rem}.action{padding:.35rem .55rem;border:1px solid var(--border);border-radius:5px;color:var(--text);background:var(--bg);font-size:.72rem;white-space:nowrap}.action:hover{border-color:var(--muted);background:var(--surface-active)}.empty{margin:0;padding:1.2rem;color:var(--muted);font-size:.8rem}@container scan-page (max-width: 48rem){gap:.7rem}.scope-grid{grid-template-columns:1fr}.scope-pane+.scope-pane{border-top:1px solid var(--border);border-left:0}.checks{margin-top:.8rem}.offline-help{max-width:100%;white-space:normal}.options-footer{margin-top:.8rem}.bundle-stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:.45rem .65rem}.scope-head{flex-wrap:wrap}.scope-head p{flex-basis:100%;justify-content:start;margin-left:1.4rem;text-align:left}.scope-head p span{white-space:normal}.scope-head p span+span{padding-left:0;border-left:0}.scan-row{grid-template-columns:1fr;gap:.55rem}.scan-actions{justify-content:flex-start}.head-tabs{margin-left:0}`});function HE(t){let e=t.filter(n=>n.id!=="all");if(e.length===0)return null;let r=new Map(e.map(n=>[String(n.id).replace(/^reason:/u,""),n]));return r.size!==e.length||[...r.keys()].some(n=>!UE.some(o=>o.key===n))?null:[{id:"",label:"All files",subtitle:"Everything"},...UE.filter(n=>r.has(n.key)).map(({key:n,...o})=>({...o,id:r.get(n).id,subtitle:n==="run"&&r.has("metro")?"Bundler and Node.js CLI":o.subtitle}))]}var UE,jE=w(()=>{"use strict";UE=[{key:"metro",label:"metro",subtitle:"Metro bundle contents"},{key:"run",label:"run",subtitle:"Node.js CLI"},{key:"add",label:"add",subtitle:"Manually added files"}]});var Pv,Nv,VE=w(()=>{"use strict";M();bt();Jt();vt();Wt();Di();xv();nf();Rv();OE();NE();Iv();zE();Pc();jE();Pv={dependencies:d`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="4" cy="8" r="2"/><circle cx="12" cy="4" r="2"/><circle cx="12" cy="12" r="2"/><path d="M6 8h2M10.2 5.3 6 7.3M10.2 10.7 6 8.7"/></svg>`,code:d`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m5.5 3-3 5 3 5M10.5 3l3 5-3 5M9 2.5 7 13.5"/></svg>`,agentic:d`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m8 1.8.8 4.4L12.5 8l-3.7 1.8L8 14.2l-.8-4.4L3.5 8l3.7-1.8Z"/><path d="m13 2 .25 1.25L14.5 3.5 13.25 3.25 13 2ZM3 11.5l.2 1 .95.2-.95.2-.2 1-.2-1-.95-.2.95-.2Z"/></svg>`,report:d`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 1.8h5l3 3V14H4zM9 1.8V5h3M6 8h4M6 10.5h4"/></svg>`},Nv=class extends J{static properties={source:{attribute:!1},loadBundle:{attribute:!1},loadModels:{attribute:!1},loadReportSources:{attribute:!1},canRun:{attribute:!1},_loadingBundle:{state:!0},_bundleError:{state:!0},_tab:{state:!0},_mode:{state:!0},_bundles:{state:!0},_repositories:{state:!0},_reportMode:{state:!0},_reportInput:{state:!0},_reportRestore:{state:!0},_scans:{state:!0},_selectedRepoId:{state:!0},_selectedBundleId:{state:!0},_reason:{state:!0},_excluded:{state:!0},_excludedModules:{state:!0},_prompts:{state:!0},_options:{state:!0},_regimes:{state:!0},_regimesReady:{state:!0},_notice:{state:!0}};static styles=DE;constructor(){super(),this.loadModels=ef,this.canRun=!0,this._tab="new",this._mode="code",this.source=null,this.loadBundle=null,this._loadingBundle=!1,this._bundleError=null,this._bundles=[],this._repositories=[],this._reportMode="link",this._reportInput=null,this._reportRestore=null,this._scans=[],this._selectedRepoId=this._bundles[0]?.repoId??"unattached",this._selectedBundleId=this._bundles[0]?.id??null,this._reason=this._bundles[0]?.reasons[0]?.id??"",this._excluded=new Set,this._excludedModules=new Set,this._nextPromptId=1,this._prompts=[{id:1,text:""}],this._options={analyzer:"generic",model:null,effort:null,cached:!1,isolate:!1},this._regimes=[],this._regimesReady=!1,this._notice=null,this._timers=new Set}willUpdate(e){if(e.has("source")){this._bundles=this.source?.bundles??[],this._repositories=this.source?.repositories??[],this._scans=this.source?.scans??[],this._excluded=new Set,this._excludedModules=new Set;let r=this._bundles.find(n=>n.id===this._selectedBundleId)??this._bundles[0];this._selectedRepoId=r?.repoId??"unattached",this._selectedBundleId=r?.id??null,this._reason=r?.reasons?.[0]?.id??""}}updated(e){(e.has("source")||e.has("loadBundle"))&&this._loadSelectedBundle()}async _loadSelectedBundle(){this._bundleController?.abort(),this._loadingBundle=!1,this._bundleError=null;let e=this._bundle;if(!this.loadBundle||!e||Array.isArray(e.files))return;let r=this._bundleController=new AbortController;this._loadingBundle=!0;try{let n=await this.loadBundle(e,r.signal);if(r.signal.aborted)return;this._bundles=this._bundles.map(o=>o.id===e.id?n:o),this._reason=n.reasons?.[0]?.id??""}catch(n){r.signal.aborted||(this._bundleError=String(n?.message??n))}finally{r.signal.aborted||(this._loadingBundle=!1)}}disconnectedCallback(){super.disconnectedCallback(),this._bundleController?.abort();for(let e of this._timers)clearTimeout(e);this._timers.clear()}get _repoBundles(){return this._bundles.filter(e=>e.repoId===this._selectedRepoId)}get _bundle(){return this._repoBundles.find(e=>e.id===this._selectedBundleId)}get _reasonData(){return this._bundle?.reasons.find(e=>e.id===this._reason)??this._bundle?.reasons[0]}_packageLabel(e){return e==="__own__"?"Own code":e}get _files(){let e=this._reasonData,r=e?.fileModules,n=e?.filePaths?new Set(e.filePaths):null;return Cv(this._bundle?.files).filter(o=>(r==null||r.includes(o.module))&&(n==null||n.has(o.path))).toSorted((o,i)=>i.bytes-o.bytes)}render(){return d`<div class="wrap"><div class="head"><div class="head-title"><slot name="navigation"></slot><h1>Scans</h1></div><div class="head-tabs" role="tablist" aria-label="Scan views"><button class="${this._tab==="new"?"active":""}" role="tab" aria-selected="${this._tab==="new"}" @click="${()=>{this._tab="new"}}">New scan</button> <button class="${this._tab==="history"?"active":""}" role="tab" aria-selected="${this._tab==="history"}" @click="${()=>{this._tab="history"}}">Scan history</button></div></div><p class="intro">${this._mode==="report"?"Choose inputs and start a scan. Save the report when it finishes.":"Choose a bundle and start a scan. Save the report when it finishes."}</p>${this._notice?d`<p class="notice" role="status">${this._notice}</p>`:m} ${this._bundleError?d`<p class="notice" role="alert">Couldn’t load bundle: ${this._bundleError}<button @click="${()=>{this._loadSelectedBundle()}}">Retry</button></p>`:m} ${this._tab==="new"?this._newScan():this._history()}</div>`}_newScan(){let e=this._mode,r=this._bundle,n=e==="code"?this._files:r?.files??[],o=this._excluded,i=this._excludedModules,s=n.filter(g=>!o.has(g.path)&&!i.has(g.module)),a=Oc(r?.files?s:null),c=new Map;for(let g of n){let y=c.get(g.module)??{bytes:0,count:0,included:0};y.bytes+=g.bytes,y.count++,o.has(g.path)||y.included++,c.set(g.module,y)}let u=[...c.keys()].toSorted((g,y)=>c.get(y).bytes-c.get(g).bytes||this._packageLabel(g).localeCompare(this._packageLabel(y))),p=n.slice(0,80),f=u.filter(g=>!i.has(g)).length,h=this._reportInput?.mode===this._reportMode?this._reportInput.inputs:[];return d`<div class="setup"><section class="panel mode-panel" aria-labelledby="scan-mode-heading"><div class="panel-head"><h2 id="scan-mode-heading">Scan mode</h2><p>Choose what the server should analyze</p></div><div class="mode-grid" role="tablist" aria-label="Scan mode">${[["dependencies","Dependency alerts","Revalidate incoming alerts against actual code"],["code","Code","Run a full scan of the codebase"],["agentic","Agentic","Free-form analysis with your instructions"],["report","Reports","Link saved reports or merge scan results"]].map(([g,y,b])=>d`<button type="button" role="tab" aria-selected="${e===g}" class="${`mode-option ${e===g?"active":""}`}" @click="${()=>this._changeMode(g)}"><span class="mode-title">${Pv[g]}<strong>${y}</strong></span><span>${b}</span></button>`)}</div>${e==="code"?d`<div class="subtype-wrap"><div class="subtype-options" role="radiogroup" aria-label="Code subtype">${[["security","Security","Security findings only"],["generic","Generic","Free-form code scan: wide-scoped, most results"],["correctness","Correctness","Guided correctness scan"],["advanced","Advanced","Merge multiple regimes"]].map(([g,y,b])=>d`<button type="button" role="radio" aria-checked="${this._options.analyzer===g}" class="${`subtype-option ${this._options.analyzer===g?"active":""}`}" @click="${()=>this._setOption("analyzer",g)}"><strong>${y}</strong><span>${b}</span></button>`)}</div><p class="subtype-help">Focusing controls how effort is spent: while Generic can also find security issues, a focused Security scan is likely to find more.</p></div>`:m} ${e==="report"?d`<div class="subtype-wrap"><div class="subtype-options report-subtypes" role="radiogroup" aria-label="Reports submode">${[["link","Link","Link findings across saved reports"],["merge","Merge","Combine scan results for one bundle"]].map(([g,y,b])=>d`<button type="button" role="radio" aria-checked="${this._reportMode===g}" class="${`subtype-option ${this._reportMode===g?"active":""}`}" @click="${()=>{this._reportMode=g,this._reportRestore=null}}"><strong>${y}</strong><span>${b}</span></button>`)}</div></div>`:m}</section>${e==="report"?d`<scan-report-inputs .mode="${this._reportMode}" .loadSources="${this.loadReportSources}" .restore="${this._reportRestore}" @report-inputs-change="${g=>{this._reportInput=g.detail}}"></scan-report-inputs>`:this._sourcePanel(r,n)} ${e==="code"?d`<details class="panel scope-panel"><summary class="scope-head"><svg class="scope-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 3 5 5-5 5"/></svg><h2>Source filter</h2><p><span>${s.length} of ${n.length} files · ${f} of ${u.length} packages</span> <span>${zi(a.bytes)} · ${a.lines==null?"\u2014":a.lines.toLocaleString()} LoC</span></p></summary><div class="scope-grid"><section class="scope-pane package-pane" aria-label="Packages in bundle"><div class="pane-head"><strong>Packages</strong><span>${u.length} total · sorted by size</span></div><div class="package-list">${u.map(g=>{let{bytes:y,count:b,included:v}=c.get(g),x=!i.has(g);return d`<label class="${`package-row ${x?"":"excluded"}`}"><input type="checkbox" .checked="${x}" @change="${k=>this._toggleModule(g)}"><span class="package-name">${this._packageLabel(g)}</span><span class="package-size">${zi(y)} · ${v}/${b}</span></label>`})}</div></section><section class="scope-pane file-panel" aria-label="Largest files in bundle"><div class="pane-head"><strong>Largest files</strong><span>showing ${p.length} of ${n.length}</span></div>${n.length===0?d`<p class="empty">No files in this selection.</p>`:d`<div class="file-list">${p.map(g=>{let y=!o.has(g.path)&&!i.has(g.module);return d`<label class="${`file ${y?"":"excluded"}`}"><input type="checkbox" .checked="${y}" @change="${b=>this._toggleFile(g,b.target.checked)}"><span class="file-copy"><span class="file-path" title="${g.path}">${g.path}</span><span class="file-meta">${g.size} · ${this._packageLabel(g.module)}</span></span></label>`})}</div>`}</section></div></details>`:m} ${e==="agentic"?this._agenticPanel():m}<slot name="access"></slot>${this._optionsPanel(e,r,e==="report"?h.length:s.length)}</div>`}_sourcePanel(e,r){let n=this._mode==="code"?this._repoBundles.map(u=>u.files?{...u,files:Cv(u.files)}:u):this._repoBundles,{lines:o}=Oc(e?.files?r:null),i=new Map;for(let u of this._bundles)i.set(u.repoId,(i.get(u.repoId)??0)+1);let s=i.size>1,a=["code","agentic"].includes(this._mode)&&e!=null&&(!e.filename.toLowerCase().endsWith(".map")||e.reasons?.some(u=>u.id!=="all")),c=this._repositories.map(u=>{let p=i.get(u.id)??0;return{value:u.id,label:u.label,detail:`${p} ${p===1?"bundle":"bundles"}`,special:u.id==="unattached"}});return d`<section class="panel source-panel" aria-busy="${this._loadingBundle}"><div class="panel-head"><h2>Source</h2></div><div class="${`source-choice ${s?"":"single-repository"}`}">${s?d`<div class="field"><span>Repository</span><repository-selector .options="${c}" .value="${this._selectedRepoId}" @repository-change="${u=>this._selectRepoById(u.detail.value)}"></repository-selector></div>`:m}<div class="field">${s?d`<span>Bundle</span>`:m}${n.length>0?d`<bundle-selector .bundles="${n}" .value="${e?.id??null}" @bundle-change="${u=>this._selectBundleById(u.detail.value)}"></bundle-selector>`:d`<div class="choice-empty">${this._bundles.length===0?"No stored bundles.":"No stored bundles for this repository."}</div>`}</div><div class="source-footer"><div class="bundle-stats" aria-label="Bundle statistics"><div class="metric"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><ellipse cx="8" cy="4" rx="5" ry="2"/><path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/></svg><strong>${e?.size??"\u2014"}</strong><span>bundle size</span></div><div class="metric">${Pv.report}<strong>${r.length}</strong><span>files</span></div><div class="metric">${Pv.code}<strong>${o==null?"\u2014":o.toLocaleString()}</strong><span>LoC</span></div><div class="metric">${Z(Gr)}<strong>${new Set(r.map(u=>u.module)).size}</strong><span>packages</span></div></div>${a?d`<div class="scope-slot">${this._scopeField(e)}</div>`:m}</div></div></section>`}_scopeField(e){if(!["code","agentic"].includes(this._mode))return m;let r=(e?.reasons??[]).filter(i=>i.id!=="all");if(r.length===0)return m;let n=this._mode==="agentic",o=HE(r);if(o){let i=o.find(s=>s.id===this._reason)??o[0];return d`<div class="scope-toggle"><div class="scope-options" role="radiogroup" aria-label="${n?"Choose agentic scope":"Choose scan scope"}" aria-describedby="scan-scope-description">${o.map(s=>d`<label class="scope-option"><input type="radio" name="scan-scope" value="${s.id}" .checked="${i.id===s.id}" @change="${()=>this._changeReason(s.id)}"><span>${s.label}</span></label>`)}</div><span class="scope-description" id="scan-scope-description">${i.subtitle}</span></div>`}return d`<label class="scope-field"><span>Scope</span><select id="${n?"scan-agentic-scope":"scan-reason"}" aria-label="${n?"Choose agentic scope":"Choose scan scope"}" @change="${i=>this._changeReason(i.target.value)}"><option value="" .selected="${xe(!this._reason||this._reason==="all")}">All files</option>${r.map(i=>d`<option value="${i.id}" .selected="${xe(i.id===this._reason)}">${i.label??i.id}</option>`)}</select></label>`}_optionsPanel(e,r,n){let o=e==="report"?`${n} ${this._reportMode==="merge"?"scan results":"reports"} selected`:`${r?.filename??"No bundle selected"} \xB7 ${n} files will be analyzed`,i=e==="code"&&this._options.analyzer==="advanced",s=!this.canRun||(e==="report"?n===0:r==null||n===0||i&&(!this._regimesReady||this._regimes.length===0));return d`<section class="panel options"><div class="options-grid">${i?d`<scan-regime-editor .loadModels="${this.loadModels}" .value="${this._regimes}" @regimes-change="${a=>{this._regimesReady=a.detail.ready,this._regimes=a.detail.value}}"></scan-regime-editor>`:d`<scan-model-picker .loadModels="${this.loadModels}" ?has-extra="${e==="code"}" .value="${this._options.model}" .effort="${this._options.effort}" @model-change="${a=>{this._options={...this._options,model:a.detail.model,effort:a.detail.effort}}}">${e==="code"?d`<scan-depth-toggle slot="effort-extra" .isolate="${this._options.isolate}" @depth-change="${a=>this._setOption("isolate",a.detail.isolate)}"></scan-depth-toggle>`:m}</scan-model-picker>`}</div><div class="options-footer"><slot name="before-run"></slot><button type="button" class="run" ?disabled="${s}" @click="${()=>this._runScan()}">${e==="report"?this._reportMode==="merge"?"Merge results":"Link reports":"Run scan"}</button><span class="summary">${o}</span></div><div class="checks"><label class="switch"><input type="checkbox" aria-describedby="${this._options.cached?"offline-help":m}" .checked="${this._options.cached}" @change="${a=>this._setOption("cached",a.target.checked)}"><span class="switch-track" aria-hidden="true"></span><span>Offline</span></label>${this._options.cached?d`<small class="offline-help" id="offline-help">Cache only, no new model requests</small>`:m}</div></section>`}_history(){return d`<section class="panel history"><div class="panel-head"><h2>Scan history</h2><p>${this._scans.length} scans</p></div>${this._scans.length===0?d`<p class="empty">No scans yet.</p>`:this._scans.map(e=>this._scanRow(e))}</section>`}_scanRow(e){let r=e.status==="completed"?e.reportSaved?d`<button type="button" class="action" @click="${()=>this._deleteSavedReport(e)}">Delete saved report</button>`:d`<button type="button" class="action" @click="${()=>this._saveReport(e)}">Save report</button>`:m;return d`<div class="scan-row"><div class="scan-main"><div class="scan-title"><strong>${e.bundleName}</strong><span class="${`status ${e.status}`}">${e.status}</span></div><span class="scan-meta">${e.reason} · ${e.files} ${e.mode==="report"?e.reportMode==="merge"?"results":"reports":"files"} · ${e.createdAt}${e.duration?` \xB7 ${e.duration}`:""}${e.reportSaved?" \xB7 Report saved":e.status==="completed"?" \xB7 Report available":""}</span></div><span class="scan-actions">${r}${e.status==="running"?d`<button type="button" class="action" @click="${()=>this._stopScan(e)}">Stop</button>`:m}${e.status==="stopped"?d`<button type="button" class="action" @click="${()=>this._restartScan(e)}">Restart as new scan</button>`:m}</span><span aria-hidden="true"></span></div>`}_selectBundle(e){this._selectedRepoId=e.repoId,this._selectedBundleId=e.id,this._reason=e.reasons?.[0]?.id??"",this._excluded=new Set,this._excludedModules=new Set,this._notice=null,this._loadSelectedBundle()}_selectBundleById(e){let r=this._repoBundles.find(n=>n.id===e);r!=null&&this._selectBundle(r)}_selectRepoById(e){if(e===this._selectedRepoId||!this._repositories.some(n=>n.id===e))return;this._selectedRepoId=e;let r=this._bundles.find(n=>n.repoId===e);this._selectedBundleId=r?.id??null,this._reason=r?.reasons[0]?.id??"",this._excluded=new Set,this._excludedModules=new Set,this._notice=null,this._loadSelectedBundle()}_changeMode(e){!["dependencies","code","agentic","report"].includes(e)||e===this._mode||(this._mode=e,this._reportInput=null,this._reportRestore=null,this._excluded=new Set,this._excludedModules=new Set,this._notice=null)}_changeReason(e){this._reason=e,this._excluded=new Set,this._excludedModules=new Set}_toggleFile(e,r){let n=new Set(this._excluded);r?n.delete(e.path):n.add(e.path),this._excluded=n}_toggleModule(e){let r=new Set(this._excludedModules);r.has(e)?r.delete(e):r.add(e),this._excludedModules=r}_setOption(e,r){this._options[e]!==r&&(e==="analyzer"&&r==="advanced"&&(this._regimesReady=!1,this._regimes.length===0&&(this._regimes=[{mode:this._options.analyzer,model:this._options.model,effort:this._options.effort,isolate:this._options.isolate}])),this._options={...this._options,[e]:r})}_agenticPanel(){return d`<section class="panel agentic-panel"><div class="panel-head"><h2>Agentic instructions</h2><button type="button" class="prompt-action" aria-label="Add prompt" @click="${()=>this._addPrompt()}"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 3v10M3 8h10"/></svg></button></div><div class="agentic-fields">${te(this._prompts,e=>e.id,(e,r)=>d`<div class="prompt-row"><textarea aria-label="${`Prompt ${r+1}`}" rows="3" placeholder="${this._promptPlaceholder(r)}" .value="${xe(e.text)}" @input="${n=>{this._prompts=this._prompts.map(o=>o.id===e.id?{...o,text:n.target.value}:o)}}"></textarea>${this._prompts.length>1?d`<button type="button" class="prompt-action" aria-label="${`Remove prompt ${r+1}`}" @click="${()=>this._removePrompt(e.id)}"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="m4 4 8 8M12 4l-8 8"/></svg></button>`:m}</div>`)}</div></section>`}_promptPlaceholder(e){let r=["","second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth"][e];return r!=null?`What should the ${r?`${r} `:""}agent focus on?`:`What should agent ${e+1} focus on?`}async _addPrompt(){this._prompts=[...this._prompts,{id:++this._nextPromptId,text:""}],await this.updateComplete,this.renderRoot?.querySelector(".prompt-row:last-child textarea")?.focus()}_removePrompt(e){this._prompts.length>1&&(this._prompts=this._prompts.filter(r=>r.id!==e))}_runScan(){if(!this.canRun)return;let e=this._mode,r=e==="code"&&this._options.analyzer==="advanced";if(r&&(!this._regimesReady||this._regimes.length===0))return;let n=this._bundle,o=this._reportInput?.mode===this._reportMode?this._reportInput:null,i=o?.inputs??[],s=e==="code"?this._files.filter(u=>!this._excluded.has(u.path)&&!this._excludedModules.has(u.module)):n?.files??[];if(e==="report"&&(!o?.source||i.length===0)||e!=="report"&&(!n||s.length===0))return;let a={id:`scan-${Date.now()}`,mode:e,bundleId:e==="report"?this._reportMode==="merge"?o.source.id:null:n?.id??null,bundleName:e==="report"?o.source.label:n.filename,reason:e==="agentic"?this._reasonData?.label??"All files":e==="report"?this._reportMode==="merge"?"Merge scan results":"Link saved reports":e==="code"?this._reasonData?.label??"All files":"Dependencies",status:"running",createdAt:"Just now",duration:"",files:e==="report"?i.length:s.length,reportSaved:!1,cached:this._options.cached,isolate:e==="code"&&this._options.isolate,model:this._options.model,effort:this._options.effort};e==="code"&&(a.analyzer=this._options.analyzer),r&&(a.regimes=this._regimes.map(u=>({...u})),a.reason=`Advanced \xB7 ${a.regimes.length} regimes \xB7 ${a.reason}`,a.scopeId=this._reason,a.model=null,a.effort=null,a.isolate=!1),e==="agentic"&&(a.prompts=this._prompts.map(u=>u.text)),e==="report"&&(a.reportMode=this._reportMode,a.reportSource={...o.source},a.inputIds=i.map(u=>u.id)),this._scans=[a,...this._scans],this._tab="history",this._notice="Scan started. The server will update its status as work progresses.";let c=setTimeout(()=>{this._timers.delete(c),a.status==="running"&&(a.status="completed",a.duration="2m 14s",this._notice="Scan completed. Its report is ready to save.",this.requestUpdate())},2200);this._timers.add(c)}_stopScan(e){e.status==="running"&&(e.status="stopped",e.duration=e.duration||"stopped by user",this._notice="Scan stopped. It cannot continue, but you can restart it as a new scan.",this.requestUpdate())}_restartScan(e){if(this._options={...this._options,model:e.model??this._options.model,effort:e.effort??this._options.effort,cached:e.cached??!1,isolate:e.isolate??!1,analyzer:e.analyzer??"generic"},e.mode==="report"){this._mode="report",this._reportMode=e.reportMode==="link"?"link":"merge",this._reportInput=null,this._reportRestore={mode:this._reportMode,source:e.reportSource,inputIds:e.inputIds??[]},this._tab="new",this._notice="New report scan settings restored from the stopped run.";return}let r=this._bundles.find(n=>n.id===e.bundleId);r&&(this._selectBundle(r),this._mode=e.mode??"dependencies",e.mode==="agentic"&&(this._prompts=(e.prompts?.length>0?e.prompts:[""]).map(n=>({id:++this._nextPromptId,text:n}))),e.regimes?.length>0&&(this._options={...this._options,analyzer:"advanced"},this._regimes=e.regimes.map(n=>({...n})),this._regimesReady=!1),this._reason=r.reasons.find(n=>n.label===e.reason)?.id??r.reasons[0]?.id??"",e.regimes?.length>0&&(this._reason=e.scopeId??this._reason),this._tab="new",this._notice="New scan settings restored from the stopped run.")}_saveReport(e){e.reportSaved=!0,this._notice="Report saved. You can delete it from Reports and save this completed scan again.",this.requestUpdate()}_deleteSavedReport(e){e.reportSaved=!1,this._notice="Saved report deleted. The completed scan can be saved again.",this.requestUpdate()}};customElements.get("deepview-scan-page")||customElements.define("deepview-scan-page",Nv)});function WE(t){return{repositories:t.length>0?[{id:"unattached",label:"Unattached"}]:[],bundles:t.map(e=>({id:e.integrity,integrity:e.integrity,filename:e.name,repoId:"unattached",repo:"Unattached",files:null,reasons:[],size:"\u2014"})),reports:[],scans:[]}}function KE(t,e){if(e.error)throw new Error(e.error);let r=en(e),n=e.kind==="stasis"?e.bundle?.formats:null,o=e.lineCounts??new Map([...Xt(e)].map(([a,c])=>[a,nc(c)])),i=[...fr(e)].filter(([,a])=>a!=null).map(([a,c])=>({path:a,format:n?.get(a)??null,bytes:c,lines:o.get(a)??0,size:zi(c),module:st(a,{splitOwnDirs:!1,packageDir:r?.get(a)})})),s=[{id:"all",label:"All",filePaths:null},...[...qs(e,i.map(a=>a.path))].map(([a,c])=>({id:`reason:${a}`,label:a,filePaths:[...c]}))];return{...t,files:i,reasons:s,size:zi(e.size)}}var GE=w(()=>{"use strict";tn();oc();Gs();Rp();Pc()});function X4(t){let{data:e}=kn(t);return e&&qE(e)>0?e:null}function qE(t){return(ar(t)??[]).filter(e=>(Array.isArray(e)?e:[e]).some(r=>r&&typeof r=="object"&&vn(r,r.source??t.source))).length}function YE(t,e){let r=[],n=new Map;for(let{name:i,content:s,fallbackRepo:a}of t){if(typeof s!="string")continue;let c=X4(s);if(!c)continue;let u=ar(c),p=$r(c)??$r({repo:{github:a}}),f=new Set(p?[p]:[]);if(!p)for(let h of u.flat()){if(/(?:^|\/)(?:node_modules|dependencies)\//u.test(h?.file??""))continue;let g=$r(h);g&&f.add(g)}for(let h of f)n.set(h,{id:h,label:h});r.push({id:i,filename:i,repoIds:[...f],analyzer:c.source,appFindings:qE(c)})}let o=new Set(r.map(i=>i.id));return{merge:{bundles:[],results:[]},link:{reports:r,repositories:[...n.values()],workspaces:e.map(i=>({id:i.id,label:i.name,reports:i.reports.filter(s=>o.has(s))})).filter(i=>i.reports.length>0)}}}var XE=w(()=>{"use strict";Oe();Pc()});function Do(t){if(t?.throwIfAborted(),D())throw new DOMException("Local scan closed","AbortError")}async function JE(t){Do(t);let e=await Dt();return Do(t),WE(e)}async function ZE(t,e){Do(e);let r=await In(t.integrity,{name:t.filename},{sources:!1});return Do(e),KE(t,r)}async function QE(t){Do(t);let e=await pe(),r=[];for(let n of e){Do(t);let o=await Le(n);Do(t),r.push({name:n,content:o,fallbackRepo:xt(n)})}return Do(t),YE(r,re())}var eR=w(()=>{"use strict";O();Fn();GE();XE()});function tR({hostname:t,devServer:e,serverMode:r,localMode:n,deepviewScanServer:o}){return r==="managed"&&!n?null:r==="e2e"?Da(o):Da(e)??(t==="127.0.0.1"?q0:null)}var rR=w(()=>{"use strict";Fh()});async function nR(t,e,r){let n=On(t,{duration:0});e.addEventListener("abort",n,{once:!0});try{return await r()}finally{e.removeEventListener("abort",n),n()}}function of(){return tR({hostname:window.location.hostname,devServer:document.querySelector('meta[name="deepview-scan-server"]')?.content,serverMode:l.serverMode,localMode:l.localMode,deepviewScanServer:l.deepviewScanServer})}function zv(){let t=document.querySelector("#drop-zone");if(!t)return;let e=t.querySelector(".local-scan-button");e||(e=document.createElement("button"),e.type="button",e.className="local-scan-button",e.textContent="Scan",e.addEventListener("click",async()=>{if(await at(),!of())return;let n=Zs(),o=Xs();await n,!(!of()||o!==Xs())&&(l.currentView="scan",_(),ee())}),t.append(e));let r=of();e.hidden=!r,document.querySelector("local-scan-page")?.setScanServer(r)}var Dv,Uv=w(()=>{"use strict";M();O();Fo();Pn();St();SE();EE();VE();eR();rR();zp();Dv=class extends J{static properties={_source:{state:!0},_error:{state:!0},_providerToken:{state:!0},_savedAccess:{state:!0},_savingAccess:{state:!0}};constructor(){super(),this._server=of(),this._access=new tf(this._server,()=>this.requestUpdate()),this._resetAccess(),this._source=null,this._error=null,this._loadBundle=(e,r)=>nR("Loading bundle\u2026",r,()=>ZE(e,r))}connectedCallback(){super.connectedCallback(),this._restoreAccess(),this._unsubscribeSavedAccess=$g(()=>{this._savedAccess=Es()}),this._loadSource()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeSavedAccess?.(),this._controller?.abort(),this._resetAccess()}async _loadSource(){this._controller?.abort();let e=this._controller=new AbortController;this._error=null;try{this._source=await nR("Loading bundles\u2026",e.signal,()=>JE(e.signal))}catch(r){e.signal.aborted||(this._error=String(r?.message??r))}}_resetAccess(){this._access.reset(this._server),this._providerToken=""}_restoreAccess(){this._savedAccess=Es();let e=wg(this._server);e&&(this._access.setKey(e.deepview),this._access.setProvider(e.provider),this._providerToken=e.token,this._access.connect())}async _saveOrForgetAccess(){if(this._savingAccess)return;let e=Es();if(!(!e&&!this._access.connected)){this._savingAccess=!0;try{e?(await xg(),this._resetAccess()):await kg({server:this._server,deepview:this._access.apiKey,provider:this._access.provider,token:this._providerToken}),this._savedAccess=Es()}catch{On(e?"Couldn\u2019t forget scan credentials. Try again.":"Couldn\u2019t save scan credentials. Try again.",{kind:"warning"})}finally{this._savingAccess=!1}}}_connect(e){e.preventDefault(),this._access.connect()}_setProvider(e){this._access.provider!==e&&(this._access.setProvider(e),this._providerToken="")}_setProviderToken(e){this._providerToken=e;let r=CE(e);r&&this._access.setProvider(r)}setScanServer(e){this._server!==e&&(this._server=e,this._resetAccess(),this._restoreAccess())}static styles=Qe`:host{display:block}*{box-sizing:border-box}button{display:inline-flex;align-items:center;gap:.35rem;padding:.25rem .5rem;color:var(--muted);background:0 0;border:1px solid var(--border);border-radius:5px;font:inherit;font-size:.8rem;cursor:default}button:hover:not(:disabled){color:var(--text);background:var(--surface)}button:disabled{opacity:.5}.access{min-width:0;border:1px solid var(--border);border-radius:9px;background:var(--surface);container:scan-access/inline-size}.access-heading{display:flex;align-items:center;justify-content:space-between;min-height:2.5rem;padding:.45rem .9rem;border-bottom:1px solid var(--border)}.access h2{margin:0;color:var(--text);font-size:.86rem;font-weight:600}.save-access{min-height:1.6rem;margin-left:auto;flex-shrink:0}.access-fields{display:grid;gap:.8rem;padding:.85rem .9rem}.connection-row,.provider-row{display:grid;align-items:end;gap:.65rem;margin:0}.connection-row{grid-template-columns:minmax(0,1fr) auto;width:min(42rem,100%)}.provider-row{grid-template-columns:max-content minmax(0,1fr);width:100%}.access label{display:grid;gap:.3rem;min-width:0;color:var(--muted);font-size:.72rem}input{min-width:0;width:100%;height:2rem;padding:.35rem .55rem;border:1px solid var(--border);border-radius:5px;background:var(--bg);color:var(--text);font:inherit;font-size:.8rem}.provider-field{min-width:0;margin:0;padding:0;border:0}.provider-field legend{margin-bottom:.3rem;padding:0;color:var(--muted);font-size:.72rem}.provider-options{display:flex;width:fit-content;max-width:100%;border:1px solid var(--border);border-radius:5px;background:var(--bg);overflow:hidden}.access .provider-choice{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:.35rem;height:calc(2rem - 2px);padding:.3rem .6rem;color:var(--muted);font-size:.74rem;white-space:nowrap;user-select:none}.provider-choice+.provider-choice{border-left:1px solid var(--border)}.provider-choice:hover{color:var(--text);background:var(--surface)}.provider-choice:has(:checked){color:var(--text);background:var(--surface-active)}.provider-choice:has(:focus-visible){outline:2px solid var(--accent);outline-offset:-2px}.provider-choice input{position:absolute;inset:0;margin:0;width:100%;height:100%;opacity:0;cursor:default}.provider-icon{display:block;width:1rem;height:1rem;flex:0 0 1rem;background:currentColor;-webkit-mask:var(--provider-icon) center/contain no-repeat;mask:var(--provider-icon) center/contain no-repeat}.provider-icon.anthropic{--provider-icon:url('/provider-icons/claude.svg');color:#d97757}.provider-icon.openai{--provider-icon:url('/provider-icons/openai.svg');color:#10a37f}.provider-icon.moonshot{--provider-icon:url('/provider-icons/moonshot.svg');color:#8068d9;-webkit-mask-size:80%;mask-size:80%}.provider-icon.openrouter{--provider-icon:url('/provider-icons/openrouter.svg');color:var(--text)}.connect{justify-content:center;height:2rem;padding:.35rem .8rem;color:var(--text);background:var(--surface-active)}.connection-status{flex:1;min-width:0;margin:0 .7rem;line-height:1rem;color:var(--muted);font-size:.7rem}.connection-status.error{color:var(--critical,#e5534b)}button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.provider-choice:nth-child(odd){border-left:0}.provider-choice:nth-child(n+3){border-top:1px solid var(--border)}`;_accessPanel(){let e=this._access,r=e.catalogue?.models.length??0,n=e.error??(e.loading?e.connected?"Loading provider models\u2026":"Connecting\u2026":e.connected?e.catalogue?`Connected \xB7 ${r} ${r===1?"model":"models"}`:"Connected. Choose a provider.":"");return d`<section slot="access" class="access" aria-labelledby="scan-access-heading"><div class="access-heading"><h2 id="scan-access-heading">Access</h2><p class="${`connection-status ${e.error?"error":""}`}" role="${e.error?"alert":"status"}">${n}</p>${this._savedAccess||e.connected?d`<button class="save-access" type="button" ?disabled="${this._savingAccess}" @click="${this._saveOrForgetAccess}">${this._savedAccess?"Forget":"Save"}</button>`:m}</div><div class="access-fields"><form class="connection-row" @submit="${this._connect}"><label>DeepView API Key<input type="password" name="deepview-api-key" placeholder="Enter API key" autocomplete="off" spellcheck="false" .value="${e.apiKey}" @input="${o=>e.setKey(o.target.value)}"></label> <button type="submit" class="connect" ?disabled="${!e.apiKey.trim()||e.loading||e.connected&&!e.error}">${e.connected&&!e.error?"Connected":"Connect"}</button></form>${e.managed?m:d`<div class="provider-row"><fieldset class="provider-field"><legend>Provider</legend><div class="provider-options">${[["anthropic","Anthropic"],["openai","OpenAI"],["moonshot","Moonshot"],["openrouter","OpenRouter"]].map(([o,i])=>d`<label class="provider-choice"><input type="radio" name="scan-provider" value="${o}" .checked="${e.provider===o}" @change="${()=>this._setProvider(o)}"><span class="${`provider-icon ${o}`}" aria-hidden="true"></span><span>${i}</span></label>`)}</div></fieldset><label>Token<input type="password" name="provider-token" placeholder="Enter provider token" autocomplete="off" spellcheck="false" .value="${this._providerToken}" @input="${o=>this._setProviderToken(o.target.value)}"></label></div>`}</div></section>`}render(){return d`${this._error?d`<p role="alert">Couldn’t load saved bundles: ${this._error} <button @click="${()=>{this._loadSource()}}">Retry</button></p>`:m}<deepview-scan-page .source="${this._source}" .loadBundle="${this._loadBundle}" .loadModels="${this._access.loadModels}" .canRun="${this._access.ready}" .loadReportSources="${QE}"><button slot="navigation" type="button" @click="${()=>{Zs()}}"><span aria-hidden="true">‹</span> Home</button>${this._accessPanel()}</deepview-scan-page>`}};customElements.get("local-scan-page")||customElements.define("local-scan-page",Dv)});var sf,Hv=w(()=>{sf=`.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}}
139
+ `});function oR({workspace:t}={}){return Ys("workspace-export-dialog",{workspace:t??null},e=>{e.workspace=null})}var Z4,jv,iR=w(()=>{"use strict";M();O();Nt();fe();Bn();Oi();Hv();Z4=[{id:"workspace",label:"Export workspace"},{id:"raw",label:"Raw reports export"}],jv=class extends F{static styles=[...F.styles,A(mr),A(sf)];static properties={workspace:{attribute:!1},_tab:{state:!0},_password:{state:!0},_confirm:{state:!0},_noPassword:{state:!0},_includeBundleBytes:{state:!0},_busy:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspace=null,this._tab="workspace",this._password="",this._confirm="",this._noPassword=!1,this._includeBundleBytes=!1,this._busy=!1,this._error="",this._settled=!1}_finish(e){this._settled||(this._password="",this._confirm="",this.workspace=null,super._finish(e))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_reportCount(){return Array.isArray(this.workspace?.reports)?this.workspace.reports.length:0}_bundleCount(){return Array.isArray(this.workspace?.bundles)?this.workspace.bundles.length:0}_selectTab(e){this._busy||this._tab===e||(this._tab=e,this._error="",e!=="workspace"&&(this._password="",this._confirm=""))}_onPasswordInput=e=>{this._password=e.target.value,this._error=""};_onConfirmInput=e=>{this._confirm=e.target.value,this._error=""};_onNoPasswordToggle=e=>{this._noPassword=e.target.checked,this._error="",this._noPassword&&(this._password="",this._confirm="")};_onIncludeBundleBytesToggle=e=>{this._includeBundleBytes=e.target.checked,this._error=""};_canExport(){return this._busy?!1:this._tab==="raw"?this._reportCount()>0:this._noPassword?!0:(this._password??"").length>0&&this._password===this._confirm}_onExport=async()=>{if(!this._canExport())return;if(!this.workspace){this._error="No workspace selected.";return}let e=this._tab;this._busy=!0,this._error="";try{let{blob:r,filename:n}=e==="raw"?await Lg(this.workspace):await Ig(this.workspace,{password:this._noPassword?void 0:this._password,includeBundleBytes:this._includeBundleBytes});if(this._settled)return;hn(r,n),this._finish({ok:!0,tab:e})}catch(r){if(this._settled)return;this._error=r?.message??String(r)}finally{this._busy=!1}};_onKeydown=e=>{e.key==="Enter"&&(e.preventDefault(),this._onExport())};_tabsTemplate(){return Ap({tabs:Z4,current:this._tab,prefix:"wsl",disabled:this._busy,select:e=>this._selectTab(e)})}_workspacePanel(){let e=!this._password||!this._confirm||this._password===this._confirm,r=this._bundleCount();return d`<p class="nwd-note">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><label class="wsl-field"><span>Password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-export-pw" maxlength="1024" ?disabled="${this._noPassword}" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-field"><span>Confirm password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-export-pw-confirm" maxlength="1024" ?disabled="${this._noPassword}" .value="${this._confirm}" @input="${this._onConfirmInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-optout"><input type="checkbox" .checked="${this._noPassword}" @change="${this._onNoPasswordToggle}"> <span>Export without password (not recommended)</span></label> ${r>0?d`<label class="wsl-optout"><input type="checkbox" .checked="${this._includeBundleBytes}" @change="${this._onIncludeBundleBytesToggle}"> <span>Include bundle bytes (${r} bundle${r===1?"":"s"}; significantly larger file)</span></label>`:m} ${this._noPassword?d`<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>`:m} ${!this._noPassword&&!e?d`<p class="wsl-error" role="alert">Passwords don't match.</p>`:m}`}_rawPanel(){let e=this._reportCount(),r=this._bundleCount();return d`<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${r>0?d`— and none of this workspace's ${r} attached bundle${r===1?"":"s"}`:m}.</p><p>This file is written unencrypted: anyone who obtains it can read every report in it.</p></div>${e===0?d`<p class="wsl-error" role="alert">This workspace has no reports to export.</p>`:m}`}_primaryLabel(){return this._busy?"Exporting\u2026":this._tab==="raw"?"Download reports":this._noPassword?"Export without password":"Export"}_primaryDanger(){return this._tab==="raw"||this._noPassword}_body(){return d`<div role="tabpanel" id="${`wsl-panel-${this._tab}`}" aria-labelledby="${`wsl-tab-${this._tab}`}">${this._tab==="raw"?this._rawPanel():this._workspacePanel()}</div>${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="${this._primaryDanger()?"primary danger":"primary"}" ?disabled="${!this._canExport()}" @click="${this._onExport}">${this._primaryLabel()}</button></footer>`}render(){return d`<dialog @close="${this._onClose}"><header>${this._tabsTemplate()}</header>${this._body()}</dialog>`}};customElements.define("workspace-export-dialog",jv)});async function sR(t){await oR({workspace:t})}var aR=w(()=>{"use strict";iR()});function lR(){return le("new-workspace-dialog")}var Vv,cR=w(()=>{"use strict";M();fe();Vv=class extends F{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)};_onCancel=()=>this._finish(null);_onKeydown=e=>{e.key==="Enter"&&(e.preventDefault(),this._onCreate())};render(){let e=(this._value??"").trim().length>0;return d`<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">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="${!e}" @click="${this._onCreate}">Create</button></footer></dialog>`}};customElements.define("new-workspace-dialog",Vv)});function dR({name:t,reportCount:e,bundleCount:r,triageImpact:n}={}){return le("leave-workspace-dialog",{workspaceName:t??"",reportCount:e??0,bundleCount:r??0,orphanedTriage:n?.orphanedCount??0,sharedTriage:n?.sharedCount??0})}var Wv,uR=w(()=>{"use strict";M();fe();Tr();Wv=class extends F{static styles=[...F.styles,A(qe)];static properties={workspaceName:{type:String},reportCount:{type:Number},bundleCount:{type:Number},orphanedTriage:{type:Number},sharedTriage:{type:Number},_mode:{state:!0},_triage:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceName="",this.reportCount=0,this.bundleCount=0,this.orphanedTriage=0,this.sharedTriage=0,this._mode="detach",this._triage="keep",this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(e){if(this._settled)return;let r=this.reportCount>0?this._mode:"detach",n=r==="delete"&&this.orphanedTriage>0?this._triage:"keep";super._finish({confirmed:!!e,mode:r,triage:n})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_onModeChange=e=>{this._mode=e.target.value};_onTriageChange=e=>{this._triage=e.target.value};_triageSection(){if(this._mode!=="delete"||this.reportCount===0)return"";let e=this.orphanedTriage,r=this.sharedTriage;return e===0&&r===0?d`<p class="lwd-note">No local triage is attached to ${this.reportCount===1?"this report":"these reports"}.</p>`:e===0?d`<p class="lwd-note">Local triage on ${this.reportCount===1?"this report":"these reports"} is also attached to ${r===1?"a report":"reports"} you're keeping. Nothing will be orphaned.</p>`:d`<fieldset class="lwd-choice"><legend><strong>${e}</strong> ${e===1?"triage entry won't":"triage entries won't"} be reachable from any remaining report. What should happen ${e===1?"to it":"to them"}?</legend><label class="lwd-option"><input type="radio" name="lwd-triage" value="keep" ?checked="${this._triage==="keep"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Keep</span> <span class="lwd-option-hint">Reapplied automatically if a matching report is imported later.</span></span></label> <label class="lwd-option"><input type="radio" name="lwd-triage" value="wipe" ?checked="${this._triage==="wipe"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Wipe</span> <span class="lwd-option-hint">Drop the orphaned triage from this browser.</span></span></label></fieldset>`}render(){let e=this.reportCount,r=this.bundleCount,n=e>0,o=e===1?"report":"reports",i=e===1?"it":"them",s=e===1?"stays":"stay",a=e===1?"is removed":"are removed",c=r>0?d`<p class="lwd-note">${r===1?"One bundle is":`${r} bundles are`} also attached. ${r===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>`:"",u=n?d`<fieldset class="lwd-choice"><legend>What should happen to the <strong>${e}</strong> attached ${o}?</legend><label class="lwd-option"><input type="radio" name="lwd-mode" value="detach" ?checked="${this._mode==="detach"}" @change="${this._onModeChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Move ${i} out of the workspace</span> <span class="lwd-option-hint">The ${o} ${s} in this browser as unattached ${o}.</span></span></label> <label class="lwd-option"><input type="radio" name="lwd-mode" value="delete" ?checked="${this._mode==="delete"}" @change="${this._onModeChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Delete ${i} along with the workspace</span> <span class="lwd-option-hint">The ${o} ${a} from this browser.</span></span></label></fieldset>`:r>0?d`<p class="lwd-empty">No reports are attached to this workspace (only bundles, see below).</p>`:d`<p class="lwd-empty">No reports are attached to this workspace.</p>`;return d`<dialog @close="${this._onClose}"><header><h3>Leave workspace</h3></header><p class="lwd-body">Leave workspace <strong>"${this.workspaceName}"</strong> on this device?</p>${u} ${c} ${this._triageSection()}<ul class="lwd-list"><li>Workspace synchronization data stays on the sync server — peers (and your other devices) keep their copy.</li></ul><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Leave</button></footer></dialog>`}};customElements.define("leave-workspace-dialog",Wv)});function pR({id:t,name:e,privateKeyBase64:r}={}){return new Promise((n,o)=>{let i=document.createElement("workspace-share-link-dialog");i.workspaceId=t??"",i.initialName=e??"",i.privateKeyBase64=r??"",i.addEventListener("resolve",()=>{i.remove(),n()}),i.addEventListener("modal-conflict",s=>{i.privateKeyBase64="",i.remove(),o(Zi(s.detail?.cause))}),document.body.append(i)})}var Kv,fR=w(()=>{"use strict";M();O();Nt();fe();Oi();Kv=class extends F{static styles=[...F.styles,A(mr)];static properties={workspaceId:{type:String},initialName:{type:String},privateKeyBase64:{type:String},_name:{state:!0},_password:{state:!0},_confirm:{state:!0},_url:{state:!0},_busy:{state:!0},_error:{state:!0},_copied:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.initialName="",this.privateKeyBase64="",this._name="",this._password="",this._confirm="",this._url="",this._busy=!1,this._error="",this._copied=!1,this._settled=!1}beforeOpen(){this._name=this.initialName}focusInitial(){this.renderRoot.querySelector('input[data-role="name"]')?.focus()}_finish(){this._settled||(this._copiedTimer&&(clearTimeout(this._copiedTimer),this._copiedTimer=null),this._password="",this._confirm="",this._url="",this.privateKeyBase64="",super._finish(null))}_onClose=()=>this._finish();_onCancel=()=>this._finish();_onNameInput=e=>{this._name=e.target.value};_onPasswordInput=e=>{this._password=e.target.value,this._error=""};_onConfirmInput=e=>{this._confirm=e.target.value,this._error=""};_canGenerate(){return(this._name??"").trim().length>0&&(this._password??"").length>0&&this._password===this._confirm&&!this._busy}_onGenerate=async()=>{if(this._canGenerate()){this._busy=!0,this._error="";try{let e=await Dg({id:this.workspaceId,name:this._name.trim(),privateKeyBase64:this.privateKeyBase64,password:this._password});if(this._settled)return;this._url=Ug(e),this._password="",this._confirm=""}catch(e){if(this._settled)return;this._error=e?.message??String(e)}finally{this._busy=!1}}};_onCopy=async()=>{if(this._url){this._error="";try{if(await navigator.clipboard.writeText(this._url),this._settled)return;this._copied=!0,this._copiedTimer&&clearTimeout(this._copiedTimer),this._copiedTimer=setTimeout(()=>{this._copied=!1,this._copiedTimer=null},1500)}catch{if(this._settled)return;this._error="Copy failed \u2014 select the link and copy it manually."}}};_onKeydown=e=>{e.key==="Enter"&&!this._url&&(e.preventDefault(),this._onGenerate())};_body(){return this._url?d`<p class="nwd-note">Anyone with the link <strong>and</strong> the password can attach this workspace. Share them through separate channels.</p><label class="wsl-field"><span>Share link</span> <textarea class="wsl-link" readonly="readonly" rows="3" @focus="${e=>e.target.select()}">${this._url}</textarea></label> ${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:m}<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>`:d`<label class="wsl-field"><span>Workspace name</span> <input type="text" class="nwd-input" data-role="name" placeholder="Workspace name" maxlength="200" .value="${this._name}" @input="${this._onNameInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-field"><span>Password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-share-link-pw" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-field"><span>Confirm password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-share-link-pw-confirm" maxlength="1024" .value="${this._confirm}" @input="${this._onConfirmInput}" @keydown="${this._onKeydown}"></label><p class="nwd-note">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._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:m} ${this._password&&this._confirm&&this._password!==this._confirm?d`<p class="wsl-error" role="alert">Passwords don't match.</p>`:m}<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\u2026":"Generate link"}</button></footer>`}render(){return d`<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",Kv)});function hR({name:t,kindLabel:e,triageImpact:r,inRemote:n}={}){return le("delete-report-dialog",{reportName:t??"",kindLabel:e||"report",orphanedTriage:r?.orphanedCount??0,sharedTriage:r?.sharedCount??0,inRemote:!!n})}var Gv,mR=w(()=>{"use strict";M();fe();Tr();Gv=class extends F{static styles=[...F.styles,A(qe)];static properties={reportName:{type:String},kindLabel:{type:String},orphanedTriage:{type:Number},sharedTriage:{type:Number},inRemote:{type:Boolean},_triage:{state:!0}};constructor(){super(),this.reportName="",this.kindLabel="report",this.orphanedTriage=0,this.sharedTriage=0,this.inRemote=!1,this._triage="keep"}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(e){if(this._settled)return;let r=this.orphanedTriage>0?this._triage:"keep";super._finish({confirmed:!!e,triage:r})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_onTriageChange=e=>{this._triage=e.target.value};_remoteNotice(){return this.inRemote?d`<p class="lwd-note">This report 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).</p>`:m}_triageSection(){let e=this.orphanedTriage,r=this.sharedTriage;return e===0&&r===0?d`<p class="lwd-note">No local triage is attached to this ${this.kindLabel}.</p>`:e===0?d`<p class="lwd-note">Local triage on this report is also attached to ${r===1?"a report":"reports"} you're keeping. Nothing will be orphaned.</p>`:d`<fieldset class="lwd-choice"><legend><strong>${e}</strong> ${e===1?"triage entry won't":"triage entries won't"} be reachable from any remaining report. What should happen ${e===1?"to it":"to them"}?</legend><label class="lwd-option"><input type="radio" name="drd-triage" value="keep" ?checked="${this._triage==="keep"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Keep</span> <span class="lwd-option-hint">Reapplied automatically if a matching report is imported later.</span></span></label> <label class="lwd-option"><input type="radio" name="drd-triage" value="wipe" ?checked="${this._triage==="wipe"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Wipe</span> <span class="lwd-option-hint">Drop the orphaned triage from this browser.</span></span></label></fieldset>`}render(){return d`<dialog @close="${this._onClose}"><header><h3>Delete ${this.kindLabel}</h3></header><p class="lwd-body">Delete <strong>"${this.reportName}"</strong>?</p>${this._remoteNotice()} ${this._triageSection()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Delete</button></footer></dialog>`}};customElements.define("delete-report-dialog",Gv)});function gR({name:t,inRemote:e}={}){return le("delete-bundle-dialog",{bundleName:t??"",inRemote:!!e})}var qv,bR=w(()=>{"use strict";M();fe();Tr();qv=class extends F{static styles=[...F.styles,A(qe)];static properties={bundleName:{type:String},inRemote:{type:Boolean}};constructor(){super(),this.bundleName="",this.inRemote=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(e){this._settled||super._finish({confirmed:!!e})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_remoteNotice(){return this.inRemote?d`<p class="lwd-note">This bundle 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).</p>`:m}render(){return d`<dialog @close="${this._onClose}"><header><h3>Delete bundle</h3></header><p class="lwd-body">Delete <strong>"${this.bundleName}"</strong>?</p>${this._remoteNotice()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Delete</button></footer></dialog>`}};customElements.define("delete-bundle-dialog",qv)});function yR({name:t,workspaceName:e}={}){return le("detach-bundle-dialog",{bundleName:t??"",workspaceName:e??""})}var Yv,vR=w(()=>{"use strict";M();fe();Tr();Yv=class extends F{static styles=[...F.styles,A(qe)];static properties={bundleName:{type:String},workspaceName:{type:String}};constructor(){super(),this.bundleName="",this.workspaceName=""}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(e){this._settled||super._finish({confirmed:!!e})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);render(){return d`<dialog @close="${this._onClose}"><header><h3>Detach bundle</h3></header><p class="lwd-body">Detach <strong>"${this.bundleName}"</strong> from workspace <strong>"${this.workspaceName}"</strong>?</p><p class="lwd-note">This bundle 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). The bundle bytes stay on this device — drop it onto another workspace to attach it there.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Detach</button></footer></dialog>`}};customElements.define("detach-bundle-dialog",Yv)});function wR({name:t,workspaceName:e}={}){return le("detach-report-dialog",{reportName:t??"",workspaceName:e??""})}var Xv,kR=w(()=>{"use strict";M();fe();Tr();Xv=class extends F{static styles=[...F.styles,A(qe)];static properties={reportName:{type:String},workspaceName:{type:String}};constructor(){super(),this.reportName="",this.workspaceName=""}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(e){this._settled||super._finish({confirmed:!!e})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);render(){return d`<dialog @close="${this._onClose}"><header><h3>Detach report</h3></header><p class="lwd-body">Detach <strong>"${this.reportName}"</strong> from workspace <strong>"${this.workspaceName}"</strong>?</p><p class="lwd-note">This report 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). The report bytes stay on this device — drop it onto another workspace to attach it there.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Detach</button></footer></dialog>`}};customElements.define("detach-report-dialog",Xv)});function xR(){return new Promise(t=>{let e=document.createElement("persistence-degraded-dialog"),r=n=>{e.remove(),t({shown:n})};e.addEventListener("resolve",()=>r(!0)),e.addEventListener("modal-conflict",()=>r(!1)),document.body.append(e)})}var Jv,$R=w(()=>{"use strict";M();fe();Jv=class extends F{_onConfirm=()=>this._finish(!0);render(){return d`<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">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._onConfirm}">Got it</button></footer></dialog>`}};customElements.define("persistence-degraded-dialog",Jv)});function _R(){return new Promise(t=>{let e=document.createElement("proxy-auth-dialog"),r=(n,o)=>{e.remove(),t({shown:n,reload:o})};e.addEventListener("resolve",n=>r(!0,n.detail==="reload")),e.addEventListener("modal-conflict",()=>r(!1,!1)),document.body.append(e)})}var Zv,SR=w(()=>{"use strict";M();fe();Zv=class extends F{focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}_onReload=()=>this._finish("reload");render(){return d`<dialog @close="${this._onClose}"><header><h3>Sign in to keep syncing</h3></header><p class="nwd-intro">Triage can't reach the sync server — the connection is being redirected to an <strong>authentication proxy</strong> (for example Cloudflare Access). This usually means your access session has expired.</p><p class="nwd-note">Reload the page to sign in again. Your triage is saved on this device, so reloading won't lose anything — or keep working offline and reload later.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onClose}">Not now</button> <button type="button" class="primary" @click="${this._onReload}">Reload page</button></footer></dialog>`}};customElements.define("proxy-auth-dialog",Zv)});function af(t){let e=document.querySelector("#drop-zone");e&&(t?e.dataset.serverModePending="true":delete e.dataset.serverModePending)}function Q4(){return jr().size}function eO(){return bi().size}function ER(t,e={}){let n=`file-item${t===l.currentFile&&(e.workspaceId??null)===Li(t)&&(l.currentView==="findings"||l.currentView==="files"||l.currentView==="links")?" current":""}${e.indented?" indented":""}`,o=ke(t),i=fl(t),s=be[Ke(t)]??be.default;return d`<li class="${n}" data-file="${t}" data-workspace-id="${e.workspaceId??m}" draggable="true"><button type="button" class="file-name" data-tooltip="${o}">${Z(s)}<span class="file-label">${o}</span>${i===void 0?m:d`<span class="file-count">${i}</span>`}</button></li>`}function LR(t,e={}){let r=`file-group-header${e.dropTarget?" default-reports":""}`;return d`<li class="${r}" data-default-reports="${e.dropTarget?"true":m}"><span class="group-label">${t}</span></li>`}function oO(){let t=D()?m:d`<span class="workspace-header-actions"><button type="button" class="workspace-add" data-action="new-workspace" aria-label="Create a new workspace">${rO}</button></span>`;return d`<li class="file-group-header workspace-header"><span class="group-label">Workspaces</span>${t}</li>`}function RR(){if(!D())return m;let t=Array.isArray(l.managedTeams)?l.managedTeams:[];return t.length===0?m:d`${LR("Teams")} ${te(t,e=>e.id,e=>d`<li class="${`file-item team-item${l.currentManagedTeam===e.id&&l.currentWorkspace&&l.currentView==="findings"?" current":""}`}"><button type="button" class="file-name" @click="${()=>{Js(e)}}">${pO}<span class="file-label">${e.name}</span></button></li>${te(e.reports,r=>r.id,r=>iO(e,r))} ${te(e.bundles??[],r=>r.id,r=>aO(r))}`)}`}function iO(t,e){let r=l.currentManagedTeam===t.id&&l.currentManagedReport===e.id&&l.currentView==="findings";return d`<li class="${`file-item indented team-report-item${r?" current":""}`}"><button type="button" class="file-name" data-tooltip="${e.filename}" @click="${()=>{sO(t,e)}}">${Z(be.default)}<span class="file-label">${e.filename}</span></button></li>`}function sO(t,e){return Js(t,e.id)}function aO(t){let e=typeof t.repoFullName=="string"&&t.repoFullName!==""?t.repoFullName:"Repository";return d`<li class="file-item indented team-bundle-item"><span class="file-name" data-tooltip="${`${t.filename}
140
+ ${e}`}">${FR}<span class="file-label">${t.filename}</span></span></li>`}function lO(){return d`<li class="file-group-header bundles-header" data-default-bundles="true"><span class="group-label">Bundles</span></li>`}function AR(t,e={}){let{integrity:r,name:n}=t,o=l.selectedBundle===r&&l.currentView==="bundles",s=`file-item bundle-item${e.workspaceId!=null?" indented":""}${o?" current":""}`;return d`<li class="${s}" data-bundle-integrity="${r}" data-workspace-id="${e.workspaceId??m}" draggable="true"><button type="button" class="file-name" data-tooltip="${`${n}
141
+ ${r}`}">${FR}<span class="file-label">${n}</span></button></li>`}function cO(t,e){let r=t.slice(0,15);return d`<li class="file-item indented bundle-item bundle-missing" data-bundle-integrity="${t}" data-workspace-id="${e}" data-tooltip="Bundle bytes not on this device — drop the matching bundle to attach."><span class="file-name"><span class="file-icon" aria-hidden="true">?</span><span class="file-label"><em>missing · ${r}…</em></span></span></li>`}function dO(t,e){return d`<li class="file-item indented report-missing" data-workspace-id="${e}" data-tooltip="Report not on this device — it re-downloads automatically if a workspace member has uploaded it."><span class="file-name"><span class="file-icon" aria-hidden="true">?</span><span class="file-label"><em>missing · ${ke(t)}</em></span></span></li>`}function gO(t){let r=`file-item workspace-item${l.currentWorkspace===t.id&&(l.currentView==="findings"||l.currentView==="files")?" current":""}`;return d`<li class="${r}" data-workspace-id="${t.id}"><button type="button" class="file-name">${uO}<span class="file-label" .textContent="${t.name}"></span></button><button type="button" class="workspace-share" data-action="share-workspace" data-tooltip="Share by link" aria-label="Share workspace by link">${mO}</button><button type="button" class="workspace-export" data-action="export-workspace" data-tooltip="Export workspace" aria-label="Export workspace">${fO}</button><button type="button" class="workspace-leave" data-action="leave-workspace" data-tooltip="Leave workspace" aria-label="Leave workspace">${hO}</button></li>`}function na(t){return Hi?ke(t).toLowerCase().includes(Hi):!0}async function ee(){await at();let t=Nr();if(yE({serverMode:t,session:l.managedSession,teams:l.managedTeams}),zv(),D()){if(l.bundles=[],l.storedFiles=[],bv([]),!Y)return;ie(d`${RR()}`,nw),Y.querySelector('sidebar-view-button[kind="packages"]')?.setAttribute("hidden",""),Y.querySelector('sidebar-view-button[kind="repositories"]')?.setAttribute("hidden",""),Y.querySelector("#storage-status")?.setAttribute("hidden",""),Mr();return}if(Y?.querySelector('sidebar-view-button[kind="packages"]')?.removeAttribute("hidden"),Y?.querySelector('sidebar-view-button[kind="repositories"]')?.removeAttribute("hidden"),await bg(),t!==Nr()){await ee();return}lr().catch(()=>{}),lg().catch(()=>{});let e=await pe();if(t!==Nr()){await ee();return}let r=re();bv(r);let[n]=await Promise.all([Dt(),...r.map(g=>jt("workspace",g.id))]);if(t!==Nr()){await ee();return}if(l.bundles=n,l.storedFiles=e,gv(),!Y)return;let o=new Set(e),i=new Set;for(let g of r)for(let y of g.reports)o.has(y)&&i.add(y);let s=new Map(n.map(g=>[g.integrity,g])),a=new Set;for(let g of r)for(let y of g.bundles)s.has(y)&&a.add(y);let c=new Map;for(let g of CR)c.set(g,[]);for(let g of e){if(i.has(g)||!na(g))continue;let y=Ke(g);c.has(y)||c.set(y,[]),c.get(y).push(g)}let u=r.filter(g=>!Hi||g.name.toLowerCase().includes(Hi)||g.reports.some(y=>na(y))?!0:g.bundles.some(y=>{let b=s.get(y);return b&&na(b.name)})),p=n.filter(g=>!a.has(g.integrity)&&na(g.name));ie(d`${RR()} ${D()&&r.length===0?m:oO()} ${te(u,g=>g.id,g=>{let y=[],b=[];for(let k of g.reports)na(k)&&(o.has(k)?y.push(k):b.push(k));y.sort(Qv),b.sort(Qv);let v=[],x=[];for(let k of g.bundles){let $=s.get(k);$?(!Hi||na($.name))&&v.push($):Hi||x.push(k)}return d`${gO(g)} ${y.map(k=>ER(k,{indented:!0,workspaceId:g.id}))} ${b.map(k=>dO(k,g.id))} ${v.map(k=>AR(k,{workspaceId:g.id}))} ${x.map(k=>cO(k,g.id))}`})} ${CR.map(g=>{let y=(c.get(g)??[]).toSorted(Qv),b=g==="default";return y.length===0&&!(b&&lf)?null:d`${LR(tO[g]??g,{dropTarget:b})} ${y.map(v=>ER(v))}`})} ${p.length>0||cf?lO():null} ${te(p,g=>g.integrity,g=>AR(g))}`,nw);let f=Y.querySelector('sidebar-view-button[kind="packages"]');f&&(f.count=Q4());let h=Y.querySelector('sidebar-view-button[kind="repositories"]');h&&(h.count=eO()),Mr(),Fm(e,bO)}function bO(){ew||(ew=!0,requestAnimationFrame(()=>{ew=!1,ee().catch(t=>console.warn("counts repaint:",t))}))}async function TR(t){if(t.target.closest('[data-action="toggle-client-mode"]')){cn?await AO():l.serverMode==="managed"&&(ni(!l.localMode),await uw());return}if(t.target.closest('[data-action="go-home"]')){await Zs();return}let e=t.target.closest(".file-item[data-bundle-integrity]");if(e){if(e.classList.contains("bundle-missing"))return;let c=e.dataset.bundleIntegrity;if(l.selectedBundle===c&&l.currentView==="bundles")return;Ro(c),Oo(c,l.bundleDetailsTab),_(),ee(),Ln(c);return}let r=t.target.closest("sidebar-view-button");if(r){let c=r.getAttribute("kind");(c==="packages"||c==="repositories")&&(l.currentView=c,_(),ee());return}if(t.target.closest('[data-action="new-workspace"]')){if(D())return;let c=await lR();c&&(await Op(),await Wm(c),ee());return}let n=t.target.closest('[data-action="share-workspace"]');if(n){let c=n.closest("[data-workspace-id]"),u=c?re().find(p=>p.id===c.dataset.workspaceId):null;u&&pR({id:u.id,name:u.name,privateKeyBase64:u.privateKey}).catch(p=>alert(`Failed to open share dialog: ${p.message}`));return}let o=t.target.closest('[data-action="export-workspace"]');if(o){let c=o.closest("[data-workspace-id]"),u=c?re().find(p=>p.id===c.dataset.workspaceId):null;u&&sR(u).catch(p=>alert(`Failed to open export dialog: ${p.message}`));return}let i=t.target.closest('[data-action="leave-workspace"]');if(i){let c=i.closest("[data-workspace-id]"),u=c?re().find(b=>b.id===c.dataset.workspaceId):null;if(!u)return;let p=Array.isArray(u.reports)?u.reports:[],f;try{f=await Cu(p)}catch(b){alert(`Couldn't read reports to analyze triage impact: ${b.message}`);return}let{confirmed:h,mode:g,triage:y}=await dR({name:u.name,reportCount:p.length,bundleCount:u.bundles.length,triageImpact:f});if(!h)return;if(!re().some(b=>b.id===u.id)){alert(`Workspace "${u.name}" was removed elsewhere; nothing to leave.`);return}try{await XC(u.id,g,{triage:y})}catch(b){alert(`Failed to leave workspace: ${b.message}`)}return}let s=t.target.closest(".file-item.workspace-item[data-workspace-id]");if(s){let c=s.dataset.workspaceId,u=l.currentView==="findings"||l.currentView==="files";c&&(c!==l.currentWorkspace||!u)&&gr(c);return}let a=t.target.closest(".file-item[data-file]");if(a){let c=a.dataset.file,u=l.currentView==="findings"||l.currentView==="links",p=a.dataset.workspaceId??null;c&&(c!==l.currentFile||p!==l.currentReportWorkspace||!u)&&Bt(c,void 0,{workspaceId:p});return}if(t.target.closest("sidebar-delete-current")){if(l.currentView==="bundles"&&l.selectedBundle){let b=l.selectedBundle,v=(l.bundles??[]).find($=>$.integrity===b)?.name??b,x=re().filter($=>Array.isArray($.bundles)&&$.bundles.includes(b)).filter($=>Wg($.id,b)).map($=>$.id),{confirmed:k}=await gR({name:v,inRemote:x.length>0});if(!k)return;if(l.selectedBundle!==b){alert(`Active bundle changed during confirmation; aborting delete of "${v}".`);return}try{await YC({deleteFromRemoteWorkspaceIds:x})}catch($){alert(`Failed to delete bundle: ${$.message}`)}return}if(!l.currentFile)return;let c=l.currentFile,u;try{u=await Cu([c])}catch(b){alert(`Couldn't read reports to analyze triage impact: ${b.message}`);return}let p=re().filter(b=>Array.isArray(b.reports)&&b.reports.includes(c)).filter(b=>Rs(b.id,c)).map(b=>b.id),f=p.length>0,h=Hu(c)?"links file":"report",{confirmed:g,triage:y}=await hR({name:c,kindLabel:h,triageImpact:u,inRemote:f});if(!g)return;if(l.currentFile!==c){alert(`Active file changed during confirmation; aborting delete of "${c}".`);return}try{await qC({triage:y,deleteFromRemoteWorkspaceIds:p})}catch(b){alert(`Failed to delete ${h}: ${b.message}`)}return}if(t.target.closest("#sync-status")){if(l.serverModeMismatch)return;H.status==="error"?H.dismissError():H.status==="off"?(!H.getServerUrl()&&Dc&&H.setServerUrl(Dc),H.setEnabled(!0)):H.setEnabled(!1);return}for(let c of Object.keys(lw))if(t.target.closest(`[data-action="${c}"]`)){Y?.querySelector("#user-menu")?.hidePopover?.(),Wp(c);return}if(t.target.closest('[data-action="managed-logout"]')){F1(l.managedSession?.csrfToken);return}if(t.target.closest("#auth-status")){l.managedSession==null&&Pu(l.managed?.loginPath);return}if(t.target.closest("#sidebar-toggle")){if(D())return;oa.classList.toggle("collapsed");try{localStorage.setItem("deepview.sidebarCollapsed",oa.classList.contains("collapsed")?"1":"0")}catch{}}}function vO(t){Hi=t.target.value.trim().toLowerCase(),ee()}function BR(){return H.getServerUrl()||Dc?re().length>0:!1}function OR(){let t=Y?.querySelector("#auth-status");if(!t)return;let e=Y?.querySelector("#manage-status");t.hidden=!1;let r=Y?.querySelector("#user-menu"),n=l.managedSession;if(n==null){e&&(e.hidden=!0),t.dataset.authed="0",t.removeAttribute("popovertarget"),t.setAttribute("aria-label","Log in"),ie(d`Log in`,t),r&&ie(m,r);return}let o=(n.login[0]??"?").toUpperCase(),i=typeof n.name=="string"&&/\s/u.test(n.name.trim())?n.name.trim():`@${n.login}`;if(t.dataset.authed="1",t.setAttribute("popovertarget","user-menu"),t.setAttribute("aria-label",`Account: ${n.login}`),ie(d`${MR(o,n.id)}<span class="auth-login">${i}</span>`,t),e){let s=D()&&(n.role==="admin"||n.role==="manage");e.hidden=!s}r&&ie(d`<div class="user-card">${MR(o,n.id,!0)} <span class="user-id"><span class="user-login">${n.login}</span> ${n.name?d`<span class="user-name">${n.name}</span>`:m}</span></div><button type="button" class="user-menu-row logout-row" data-action="managed-logout">${nO}<span>Log out</span></button>`,r)}function MR(t,e,r=!1){let n=`/api/avatar/${encodeURIComponent(e)}`;return d`<span class="${r?"user-avatar user-avatar-lg":"user-avatar"}"><span class="user-avatar-fallback">${t}</span> ${Gg()?m:d`<img alt="" src="${n}" @error="${kO}">`}</span>`}function kO(t){t.currentTarget.classList.add("broken")}function PR(){let t=Y?.querySelector(".brand-tag");if(t){let e=l.serverMode==="managed";t.textContent=Nr(),e?(t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label",`Switch from ${Nr()} mode`)):(t.removeAttribute("role"),t.removeAttribute("tabindex"),t.removeAttribute("aria-label"))}}function xO(){oa&&(oa.dataset.mode=Nr()),D()?(oa?.classList.remove("collapsed"),Y?.querySelector("sidebar-delete-current")?.setAttribute("hidden",""),Y?.querySelector("#encryption-toggle")?.setAttribute("hidden",""),Y?.querySelector("#auth-status")?.removeAttribute("hidden")):(Y?.querySelector("sidebar-delete-current")?.removeAttribute("hidden"),Y?.querySelector("#encryption-toggle")?.removeAttribute("hidden"),Y?.querySelector("#manage-status")?.setAttribute("hidden",""),Y?.querySelector("#auth-status")?.setAttribute("hidden","")),iE()}function Mr(t){let e=Y?.querySelector("#sync-status");if(!e)return;if(PR(),xO(),l.serverModeMismatch){let p=Y?.querySelector("#auth-status");p&&(p.hidden=!0),H.setForcedOff(!0),H.setProtocolLocked(!0),e.hidden=!1,e.dataset.status="paused",e.dataset.tooltip="This server speaks a different sync protocol than this app is set up for. Switching isn\u2019t supported yet.";let f=e.querySelector(".sync-label");f&&(f.textContent="Sync paused");return}if(l.serverMode==="managed"&&l.localMode){e.hidden=!0,H.setForcedOff(!0);let p=Y?.querySelector("#auth-status");p&&(p.hidden=!0);return}if(D()){e.hidden=!0,H.setForcedOff(!0),OR();return}if(l.serverMode==="standalone"){e.hidden=!0;let p=Y?.querySelector("#auth-status");p&&(p.hidden=!0);return}let r=Y?.querySelector("#auth-status");r&&(r.hidden=!0);let n=BR(),o=or()!=null;if(n&&o&&H.isEnabled()&&Ml().catch(p=>{console.warn("sync: load failed",p)}),n&&o&&!H.getServerUrl()&&Dc&&H.isEnabled()&&H.setServerUrl(Dc),H.setForcedOff(!n),!n){e.hidden=!0;return}e.hidden=!1;let i=t??H.status;e.dataset.status=i;let s=H.persistenceDegraded;e.toggleAttribute("data-degraded",s);let a=H.proxyAuthRequired;e.toggleAttribute("data-proxy-auth",a);let c=s?"Not saving to this browser right now (storage may be full, or another tab is on a newer version). Changes that haven\u2019t synced could be lost on reload.":a?"Can\u2019t reach the sync server \u2014 the connection is being redirected to a sign-in proxy (e.g. Cloudflare Access). Reload the page to sign in again.":"";c?e.dataset.tooltip=c:delete e.dataset.tooltip;let u=e.querySelector(".sync-label");u&&(u.textContent=wO[i]??"")}async function NR(){if(!H.persistenceDegraded||iw||tw)return;tw=!0;let{shown:t}=await xR();if(tw=!1,t){iw=!0;return}H.persistenceDegraded&&setTimeout(NR,1500)}async function DR(){if(!H.proxyAuthRequired||sw||rw)return;rw=!0;let{shown:t,reload:e}=await _R();if(rw=!1,!t){H.proxyAuthRequired&&setTimeout(DR,1500);return}sw=!0,e&&location.reload()}function $O(t){let e=t.target.closest(".file-item.workspace-item");if(!e)return;let r=e.querySelector(".file-label");if(!r||r.querySelector("input"))return;let n=e.dataset.workspaceId,o=re().find(c=>c.id===n);if(!o)return;t.preventDefault();let i=document.createElement("input");i.type="text",i.value=o.name,i.className="workspace-rename-input",r.textContent="",r.append(i),i.focus(),i.select();let s=!1,a=async c=>{s||(s=!0,c&&await Gm(n,i.value),ee())};i.addEventListener("keydown",c=>{c.key==="Enter"?(c.preventDefault(),a(!0)):c.key==="Escape"&&(c.preventDefault(),a(!1))}),i.addEventListener("blur",()=>a(!0)),i.addEventListener("click",c=>c.stopPropagation()),i.addEventListener("dblclick",c=>c.stopPropagation())}function df(){for(let t of Y.querySelectorAll(".drag-over"))t.classList.remove("drag-over")}function zR(t){return t.dataTransfer.types.includes(dw)||t.dataTransfer.types.includes(zc)}function _O(t){let e=t.target.closest(".file-item[data-bundle-integrity]");if(e){if(e.classList.contains("bundle-missing")){t.preventDefault();return}let n=e.dataset.bundleIntegrity;t.dataTransfer.effectAllowed="move",t.dataTransfer.setData(zc,n),t.dataTransfer.setData(ow,e.dataset.workspaceId??""),t.dataTransfer.setData("text/plain",n),e.classList.add("dragging"),cf=!0,ee();return}let r=t.target.closest(".file-item[data-file]");r&&(t.dataTransfer.effectAllowed="move",t.dataTransfer.setData(dw,r.dataset.file),t.dataTransfer.setData(ow,r.dataset.workspaceId??""),t.dataTransfer.setData("text/plain",r.dataset.file),r.classList.add("dragging"),lf=!0,ee())}function SO(){for(let t of Y.querySelectorAll(".dragging"))t.classList.remove("dragging");df(),(lf||cf)&&(lf=!1,cf=!1,ee())}function CO(t){if(!zR(t))return;t.preventDefault();let e=t.target.closest("[data-workspace-id]"),r=Y.querySelector(".dragging")?.closest("[data-workspace-id]")?.dataset.workspaceId??null,i=e&&r&&e.dataset.workspaceId===r||!e&&!r;if(t.dataTransfer.dropEffect=i?"none":"move",df(),!i)if(e){let s=e.dataset.workspaceId;for(let a of Y.querySelectorAll(`[data-workspace-id="${CSS.escape(s)}"]`))a.classList.contains("dragging")||a.classList.add("drag-over")}else{let a=t.dataTransfer.types.includes(zc)?"[data-default-bundles]":"[data-default-reports]",c=Y.querySelector(a);c&&c.classList.add("drag-over")}}function EO(t){Y.contains(t.relatedTarget)||df()}async function RO(t){if(!zR(t))return;t.preventDefault(),t.stopPropagation(),df();let e=t.target.closest("[data-workspace-id]"),r=e?e.dataset.workspaceId:null,n=t.dataTransfer.getData(ow)||null;if(t.dataTransfer.types.includes(zc)){let s=t.dataTransfer.getData(zc);if(!s)return;if(n&&n!==r&&Wg(n,s)){let a=(l.bundles??[]).find(p=>p.integrity===s)?.name??s,c=re().find(p=>p.id===n),{confirmed:u}=await yR({name:a,workspaceName:c?.name??""});if(!u)return;try{await Bu(n,s)}catch(p){console.warn(`Failed to remove '${a}' from source workspace ${n} remote:`,p)}}r&&await ki(s,r),n&&n!==r&&await Zm(s,n),ee();return}let o=t.dataTransfer.getData(dw);if(!o)return;if(n&&n!==r&&Rs(n,o)){let s=re().find(c=>c.id===n),{confirmed:a}=await wR({name:o,workspaceName:s?.name??""});if(!a)return;try{await Fu(n,o)}catch(c){console.warn(`Failed to remove '${o}' from source workspace ${n} remote:`,c)}}r&&await $n(o,r),n&&n!==r&&await wl(o,n),l.currentWorkspace&&(l.currentWorkspace===r||l.currentWorkspace===n)?await gr(l.currentWorkspace):ee()}async function uw({forgetLastView:t=!0}={}){let e=++ln;if(lv(),Iu(l.serverMode!=="e2e"),H.setForcedOff(!0),H.setProtocolLocked(!!cn||l.serverModeMismatch),By({forgetLastView:t}),l.triage.clear(),D()){let r=pw();if(Gg()&&(await r,e!==ln))return}else{if(l.managedSession=null,l.managedTeams=[],await Br(),e!==ln||(await _l(),e!==ln))return;yl()}document.dispatchEvent(new CustomEvent("managed-client-mode-change")),PR(),Mr(H.status),_(),await ee()}async function UR(t){if(t!==void 0&&!B1(t))throw new TypeError(`Unknown managed preview role: ${t}. Expected ${Ol.join(", ")}.`);if(await at(),t===void 0&&(cn||D()))return;let e=ln,r=t===void 0?null:await Kr();e===ln&&(cn??={serverMode:l.serverMode,localMode:l.localMode,managed:l.managed,serverModeMismatch:l.serverModeMismatch},r&&r.setPreviewRole(t),l.serverMode="managed",ni(!1),l.serverModeMismatch=!1,l.managedSession=null,l.managedTeams=[],await uw({forgetLastView:!1}))}async function AO(){let t=cn,e=aw;cn=null,aw=null,R1(),Object.assign(l,t),await uw({forgetLastView:!1}),e&&Ui(e)}function Ui(t,{runtime:e=!0}={}){if(cn){aw=t;return}af(!1);let r=or();if(Dh(r?r.mode:null,t.mode)==="mismatch"){l.serverModeMismatch=!0,H.setForcedOff(!0),H.setProtocolLocked(!0),console.warn(`sync: server is '${t.mode}' but this client is bound to '${r?.mode}' \u2014 refusing to switch (migration not yet supported)`),Mr(H.status);return}l.serverModeMismatch=!1,H.setProtocolLocked(!1);let o=l.serverMode!==t.mode;o&&t.mode==="managed"&&!l.localMode&&By({forgetLastView:!1}),l.serverMode=t.mode,l.managed=t.managed,e&&(l.deepviewScanServer=t.mode==="e2e"?t.deepviewScanServer??null:null),zv(),t.mode==="e2e"&&ni(!1),Iu(t.mode!=="e2e"),Nh(t),Mr(H.status),o&&t.mode==="e2e"&&BR()&&H.isEnabled()&&Ml().then(i=>{for(let s of i.triageSync.openSessions)i.openWorkspace(s.workspaceId)}).catch(i=>console.warn("sync: resume failed",i)),o&&ee(),D()&&pw()}async function pw(){let t=ln,e=++IR,r=()=>t===ln&&e===IR&&D();try{let n=await A1();if(!r())return;l.managedSession=n,l.managedSession?.role!=="admin"&&HR.has(l.currentView)&&(l.currentView="manage",_()),OR(),av();let o=n==null?[]:await T1();if(!r())return;l.managedTeams=o,ee()}catch(n){console.warn("managed: session probe failed:",n)}}async function Wp(t,e={}){if(!(t in lw)||!D()||!["admin","manage"].includes(l.managedSession?.role)||HR.has(t)&&l.managedSession.role!=="admin")return;let r=ln;try{await Kr()}catch(n){console.warn(lw[t],n);return}r!==ln||!D()||(l.currentView=t,_(),ee(),t==="manage-history"&&typeof e.actor=="string"&&e.actor.length>0&&document.dispatchEvent(new CustomEvent("managed-history-filter",{detail:{actor:e.actor},bubbles:!0,composed:!0})))}function at(){return TO??=MO().then(()=>document.querySelector("app-sidebar")?.removeAttribute("inert"))}async function MO(){let t=or();if(t){l.serverMode=t.mode,l.managed=t.managed,Dd().then(o=>{if(o&&o!=="standalone")return Ui(o)}).catch(o=>console.warn("server mode revalidation:",o));return}af(!za());let e=Dd(),r=await Ph(e,za()?0:3e3),n=or();if(n){r&&r!=="standalone"?Ui(r):Ui(n,{runtime:!1});return}if(r&&r!=="standalone"){Ui(r);return}r==="standalone"&&Nd(),l.serverMode="standalone",ni(r===null),Iu(!0),af(!1),Mr(H.status),ee(),r===null&&e.then(o=>{let i=or(),s=o&&o!=="standalone"?o:i??o;if(s==="standalone"){if(Nd(),cn){cn.serverMode="standalone",cn.localMode=!1;return}return ni(!1),Mr(H.status),ee()}if(s)return Ui(s,{runtime:s!==i})}).catch(o=>console.warn("server mode probe:",o))}function IO(){let t=Y?.querySelector("#user-menu"),e=Y?.querySelector("#auth-status");!t||!e||t.addEventListener("beforetoggle",r=>{if(r.newState!=="open")return;let n=e.getBoundingClientRect();t.style.left=`${Math.round(n.left)}px`,t.style.bottom=`${Math.round(window.innerHeight-n.top+6)}px`,t.style.top="auto",t.style.right="auto"})}function LO(t){oa=t,Y=t.renderRoot,nw=Y.querySelector("#file-list"),sE(Y.querySelector("#encryption-toggle")),mE(Y.querySelector("#storage-status")),Y.addEventListener("click",TR),Y.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&e.target.closest?.('[data-action="toggle-client-mode"]')&&(e.preventDefault(),TR(e))}),Y.addEventListener("dblclick",$O),Y.addEventListener("dragstart",_O),Y.addEventListener("dragend",SO),Y.addEventListener("dragover",CO),Y.addEventListener("dragleave",EO),Y.addEventListener("drop",RO),cr(Y,yO),Y.querySelector("#sidebar-search-input")?.addEventListener("input",vO),IO(),Mr(H.status),or()||af(!za()),ee(),H.onServerInfo(Ui),at(),l.serverMode==="managed"&&pw()}var oa,Y,nw,Dc,dw,ow,zc,lf,cf,tO,CR,Hi,rO,nO,FR,uO,pO,fO,hO,mO,Qv,ew,yO,wO,tw,iw,rw,sw,cn,aw,ln,IR,lw,HR,TO,cw,Pn=w(()=>{"use strict";M();vt();bt();O();Er();Nu();qg();Py();rE();Mc();dv();gE();St();bE();vE();Uv();Fo();Fi();aR();Sy();cR();uR();fR();mR();bR();vR();kR();$R();SR();Rr();Wt();Fn();go();oa=null,Y=null,nw=null;Y1();Dc=typeof location>"u"||location.hostname.endsWith(".github.io")?"":`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/sync`,dw="application/x-deepview-report",ow="application/x-deepview-source-ws",zc="application/x-deepview-bundle",lf=!1,cf=!1,tO={default:"Reports","claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec",piolium:"Piolium",[Vt]:"Links"},CR=["default","claude-security","codex-security","deepsec","piolium",Vt],Hi="";rO=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M8 3.5v9M3.5 8h9"/></svg>`,nO=d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2.5H3.5v11H8M10 5l3 3-3 3M13 8H6"/></svg>`;FR=d`${Z(Gr)}`;uO=d`${Z(fo)}`,pO=d`<svg class="team-icon" viewBox="0 0 16 16" width="13" height="13" fill="currentColor" aria-hidden="true"><path d="M5.5 8a2.25 2.25 0 1 0 0-4.5 2.25 2.25 0 0 0 0 4.5Zm0 1C3.2 9 1.75 10.2 1.75 11.6V13h7.5v-1.4C9.25 10.2 7.8 9 5.5 9Zm5.25-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm.25 1c-.43 0-.83.05-1.2.15.86.62 1.45 1.5 1.45 2.45V13h3.25v-1.3C14.5 10.1 13.15 9 11 9Z"/></svg>`,fO=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2v8M5 7l3 3 3-3M3 13h10"/></svg>`,hO=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 3H4v10h5"/><path d="M7 8h7M11 5l3 3-3 3"/></svg>`,mO=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 9.5L9 7.5"/><path d="M9.5 5.5L10.5 4.5a2.1 2.1 0 1 1 3 3l-1 1"/><path d="M6.5 11.5L5.5 12.5a2.1 2.1 0 1 1-3-3l1-1"/></svg>`;Qv=(t,e)=>ke(t).localeCompare(ke(e));ew=!1;tt(()=>{ee()});yO={placement:"right",gate:t=>{let e=t.querySelector(".file-label");return!e||(t.dataset.tooltip??"")!==e.textContent?!0:e.scrollWidth>e.clientWidth}};wO={off:"Sync off",online:"Online",offline:"Offline",connecting:"Connecting\u2026",error:"Sync error"};H.onStatusChange(Mr);tw=!1,iw=!1;H.onPersistenceDegraded(t=>{Mr(),t?NR():iw=!1});rw=!1,sw=!1;H.onProxyAuthRequired(t=>{Mr(),t?DR():sw=!1});cn=null,aw=null,ln=0,IR=0;lw={manage:"admin: bundle load failed:","admin-users":"admin: bundle load failed:","manage-repos":"admin: repos bundle load failed:","manage-reports":"admin: reports bundle load failed:","manage-bundles":"admin: bundles bundle load failed:","manage-history":"admin: history bundle load failed:","manage-teams":"admin: teams bundle load failed:","manage-scans":"admin: scans bundle load failed:"},HR=new Set(["admin-users","manage-repos","manage-teams"]);document.addEventListener("managed-admin-navigate",t=>{let e=t.detail?.view,r=t.detail?.actor;typeof e=="string"&&Wp(e,{actor:r})});cw=class extends J{static styles=[A(No),A(nE)];render(){return d`<div class="sidebar-header"><h2 class="brand"><button class="brand-button" type="button" data-action="go-home"><img class="brand-icon" src="./icon.svg" width="18" height="18" alt=""> <span class="brand-name">DeepView</span></button> <span class="brand-tag" data-action="toggle-client-mode">${Nr()}</span></h2><button id="encryption-toggle" type="button" hidden></button> <button id="sidebar-toggle" type="button" aria-label="toggle sidebar"><svg viewBox="0 0 16 16" width="14" height="14" fill="currentColor" aria-hidden="true"><path d="M2 4h12v1.5H2zM2 7.25h12v1.5H2zM2 10.5h12V12H2z"/></svg></button></div><div class="sidebar-search"><svg class="sidebar-search-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg> <input id="sidebar-search-input" type="search" placeholder="Search reports…" aria-label="Search reports" autocomplete="off"><sidebar-view-button kind="packages"></sidebar-view-button><sidebar-view-button kind="repositories"></sidebar-view-button></div><ul id="file-list"></ul><button id="storage-status" type="button" hidden><span class="storage-dot" aria-hidden="true"></span> <span class="storage-label"></span></button><div class="sidebar-actions"><sidebar-delete-current></sidebar-delete-current><button id="sync-status" type="button" data-status="off"><span class="sync-dot" aria-hidden="true"></span> <span class="sync-label">Sync off</span></button> <button id="auth-status" type="button" hidden></button> <button id="manage-status" type="button" hidden data-action="manage" aria-label="Manage">${Z(zu)}</button></div><div id="user-menu" popover class="user-menu"></div>`}firstUpdated(){LO(this)}};customElements.define("app-sidebar",cw)});M();Me();vt();fn();$e();globalThis[Symbol.for("@rray/frontend")]={LitElement:J,html:d,nothing:m,render:ie,unsafeCSS:A,StateElement:V,classMap:I,repeat:te,styleMap:ve};Nt();O();Er();Pn();Fo();Fn();O();Nt();Fi();O();Fi();async function jR(t,e,r,{openReport:n,openManagedReport:o}){if(D()){let i=l.managedTeams.find(s=>s.id===l.currentManagedTeam);if(!r||!i?.reports.some(s=>s.id===r)||(l.currentManagedReport!==r||l.currentWorkspace)&&!await o(i,r)||!D()||l.currentManagedTeam!==i.id||l.currentManagedReport!==r||l.currentWorkspace)return null}else if(r||((l.currentFile!==e||l.currentWorkspace)&&await n(e),D()||l.currentFile!==e||l.currentWorkspace))return null;return cc(t)}async function VR(t,{openReport:e,openWorkspace:r}){let[n,o]=await Promise.all([eg(t.report),Qm(t.workspace)]);async function i(u){let p=Li(u,o?.id);return(l.currentFile!==u||l.currentWorkspace||l.currentReportWorkspace!==p)&&await e(u,void 0,{workspaceId:p}),cc(t.id)}if(n){let u=await i(n);if(u)return u}if(o){l.currentWorkspace!==o.id&&await r(o.id);let u=cc(t.id);if(u)return u}let s=cc(t.id);if(s)return s;let a=l.reports.map(u=>u.fileName).filter(Boolean),c=await tg(t.id,{skip:a});return c?await i(c):null}ot();Fo();var FO="100% 0px",WR=new WeakMap,ia=new WeakMap,fw=[],hw=!1,KR=new WeakMap;function BO(t){let e=KR.get(t);if(e===void 0){let r=getComputedStyle(t).overflowY;e=r==="auto"||r==="scroll"||r==="overlay",KR.set(t,e)}return e}function mw(t){let e=t.parentNode;for(;e;){if(e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){e=e.host??null;continue}if(e.nodeType!==Node.ELEMENT_NODE||e===document.documentElement)return null;if(BO(e))return e;e=e.parentNode}return null}function OO(t){for(let e of t)ia.get(e.target)?.cb(e.isIntersecting)}function PO(t){let e=t??document,r=WR.get(e);return r||(r=new IntersectionObserver(OO,{root:t,rootMargin:FO,threshold:0}),WR.set(e,r)),r}function sa(t,e){let r=ia.get(t);r?.io&&r.io.unobserve(t),ia.set(t,{cb:e,io:null}),fw.push(t),hw||(hw=!0,queueMicrotask(NO))}function NO(){hw=!1;let t=fw;fw=[];for(let e of t){let r=ia.get(e);!r||r.io||(r.io=PO(mw(e)),r.io.observe(e))}}function Hn(t){let e=ia.get(t);e&&(e.io?.unobserve(t),ia.delete(t))}St();var DO=1600,uf="link-target",zO="Couldn't find that finding in any of your reports. Import the report it came from, then open the link again.",pf=null,UO=3,HO=150,jO=5;function VO(t){pf!==null&&clearTimeout(pf);for(let e of document.querySelectorAll(`.${uf}`))e.classList.remove(uf);t.classList.add(uf),pf=setTimeout(()=>{t.classList.remove(uf),pf=null},DO)}function WO(t){return new Promise(e=>{let r=null,n=0,o=0,i=()=>{let s=Math.round(t.getBoundingClientRect().top);n=s===r?n+1:0,r=s,n>=UO||++o>=HO?e():requestAnimationFrame(i)};requestAnimationFrame(i)})}function KO(t){let e=0,r=window.innerHeight,n=mw(t);if(n){let o=n.getBoundingClientRect();e=Math.max(e,o.top),r=Math.min(r,o.bottom)}return{top:e,bottom:r}}function GO(t){let e=t.getBoundingClientRect();if(e.height===0)return!1;let{top:r,bottom:n}=KO(t);if(n<=r)return!1;let o=(r+n)/2;return e.top>=r&&e.bottom<=n||e.top<=o&&e.bottom>=o}async function qO(t){t.scrollIntoView({block:"center",behavior:"smooth"});for(let e=0;e<jO;e++){if(await WO(t),!t.isConnected||GO(t))return;t.scrollIntoView({block:"center",behavior:"instant"})}}async function YO(t){let e=CSS.escape(t);if(l.viewMode==="table"){let r=T.querySelector("finding-table");if(r){try{await r.updateComplete}catch{}for(let n of r.shadowRoot?.querySelectorAll("finding-row")??[])if(n.group&&se(n.group)===t)return n}}if(l.viewMode==="kanban"){let r=T.querySelector(`.kanban-card[data-gid="${e}"]`);if(r)return r}return T.querySelector(`finding-card[data-gid="${e}"]`)??T.querySelector(`[data-gid="${e}"]`)}async function GR(t,e){let r=ny(t.group,e),n=Yt(r);n&&ap(n)&&queueMicrotask(we),_();let o=await YO(r);return o?(typeof o.ensureRendered=="function"&&await o.ensureRendered(),await qO(o),VO(o),{ok:!0}):{ok:!0}}async function qR(t){if(!t?.id)return{ok:!1,reason:"This link is missing a finding id."};let e=await VR(t,{openReport:Bt,openWorkspace:gr});return e?await GR(e,t.id):{ok:!1,reason:zO}}async function gw(t,e,r=null){if(!t||!e)return{ok:!1,reason:"Missing finding id or report name."};let n=await jR(t,e,r,{openReport:Bt,openManagedReport:Js});return n?await GR(n,t):{ok:!1,reason:r?`Could not open that finding in "${e}". Open the team and try again.`:`Couldn't find that finding in "${e}". It may have been re-imported since this links file was written.`}}_u();O();Er();Fp();var YR={attach:{title:"Synced triage on report attach",intro:"have triage from your workspace that disagrees with your local view on",trailingNote:"Other findings in this report whose chain value didn't conflict were applied automatically; this list only covers disagreements. Pick which side to keep.",importedSideLabel:"Apply from chain",applyButton:"Apply"},chain:{title:"Triage conflict from peer update",intro:"were changed by a peer (or by another tab) in a way that disagrees with your local triage on",trailingNote:`Other findings whose remote value didn't conflict were applied automatically; this list only covers disagreements. Pick which side to keep for each \u2014 a "keep current" pick re-publishes your local value to the chain on your next save.`,importedSideLabel:"Apply from chain",applyButton:"Apply"}};function XR(){x1(async(t,e,r)=>{let n=ng(t);try{return await Lp(t,n,YR[r]??YR.attach)}catch{let o=t.length;return alert(`${r==="attach"?"A report attach":"A workspace sync"} had ${o} triage disagreement${o===1?"":"s"} with your local view. Kept your local values because another dialog is open. ${r==="attach"?"Detach and re-attach the report to pick again.":"Your local values will re-publish to the chain on the next change."}`),null}})}Er();M();fe();var bw=class extends F{static properties={retry:{type:Boolean},_value:{state:!0}};constructor(){super(),this.retry=!1,this._value=""}_finish(e){this._value="",super._finish(e)}_onCancel=()=>this._finish(null);_onInput=e=>{this._value=e.target.value};_onSubmit=()=>{let e=this._value??"";e&&this._finish(e)};_onKeydown=e=>{e.key==="Enter"&&(e.preventDefault(),this._onSubmit())};render(){let e=(this._value??"").length>0,r=this.retry?"That password didn't match. Try again, or cancel to leave the workspace unsynced for now.":"This sync server requires a password before it accepts a new workspace. Enter it to create the workspace on the server.";return d`<dialog @close="${this._onClose}"><header><h3>Sync server password</h3></header><p class="nwd-intro">${r}</p><input type="password" class="nwd-input" placeholder="Password" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-sync-auth" maxlength="4096" .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!e}" @click="${this._onSubmit}">${this.retry?"Retry":"Authenticate"}</button></footer></dialog>`}};customElements.define("sync-auth-dialog",bw);function JR({retry:t=!1}={}){return le("sync-auth-dialog",{retry:!!t})}function ZR(){k1(async({retry:t})=>{try{return await JR({retry:t})}catch(e){return console.warn("Sync auth dialog failed to open:",e),null}})}M();O();var ff="https://triage.space/",XO=[{hostname:"deepaudit.dev",pathPrefix:"/",supportsSync:!0},{hostname:"chalker.github.io",pathPrefix:"/deepview/",supportsSync:!1}];function JO(){for(let t of XO)if(location.hostname===t.hostname&&location.pathname.startsWith(t.pathPrefix))return t;return null}var ZO=["deepview.triage","deepview.triage.pending"],QO="deepview.repoUrls";function e8(){try{for(let t of ZO)if(localStorage.getItem(t))return!0}catch{return!0}try{let t=localStorage.getItem(QO);if(t){let e=JSON.parse(t);if(e&&typeof e=="object"&&Object.keys(e).length>0)return!0}}catch{return!0}return!1}async function t8(){if(e8())return!0;let t=[];try{t=await pe()}catch{return!0}if(t.length>0)return!0;try{if(re().length>0)return!0}catch{return!0}try{return await Na()}catch{return!0}}var yw=class extends J{static properties={supportsSync:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.supportsSync=!1}firstUpdated(){let e=this.querySelector("dialog");e&&e.showModal();let r=this.querySelector("button.om-stay");r&&r.focus()}_finish(e){if(this._settled)return;this._settled=!0;let r=this.querySelector("dialog");r&&r.close(),this.dispatchEvent(new CustomEvent("resolve",{detail:e}))}_onClose=()=>this._finish(!1);_onStay=()=>this._finish(!1);_onMigrate=()=>this._finish(!0);render(){let e=()=>d`<a class="om-link" href="${ff}" target="_blank" rel="noopener noreferrer">${ff}</a>`;return d`<dialog class="origin-migration-dialog" @close="${this._onClose}"><header class="om-head"><h3>This deepview build has moved</h3><p><code>${location.host}${location.pathname}</code> has moved to ${e()}.</p></header><section class="om-body"><p>Workspaces and reports don't migrate automatically — they live in this origin's browser storage (OPFS where available, localStorage as a fallback) and have to be re-imported on ${e()}.</p>${this.supportsSync?d`<p>For each workspace, use the <strong>Export workspace</strong> button in the sidebar to download a <code>.gz</code> bundle (workspace + its reports + its triage), then drop that file on ${e()}. Workspaces that had sync configured will pick their triage state back up from the sync server once you re-import them with the same key.</p><p>For triage attached to loose reports (or as a top-up after re-importing workspaces), call <code>DeepView.export()</code> in the browser console — that downloads just the triage entries plus saved repo URLs, no reports or workspaces.</p>`:d`<p>This build has no sync layer. For each workspace, use the <strong>Export workspace</strong> button in the sidebar to download a <code>.gz</code> bundle (workspace + its reports + its triage), then drop that file on ${e()}.</p><p>For triage attached to loose reports, call <code>DeepView.export()</code> in the browser console — that downloads just the triage entries plus saved repo URLs, no reports or workspaces. Reports themselves need to be re-dropped from their original JSON on the new origin.</p>`}</section><footer class="om-actions"><button type="button" class="om-stay" @click="${this._onStay}">Keep editing on ${location.host}</button> <button type="button" class="primary om-go" @click="${this._onMigrate}">Switch to triage.space</button></footer></dialog>`}};customElements.define("origin-migration-dialog",yw);function r8(t){return new Promise(e=>{let r=document.createElement("origin-migration-dialog");r.supportsSync=t.supportsSync,r.addEventListener("resolve",n=>{r.remove(),e(!!n.detail)}),document.body.append(r)})}async function QR(){let t=JO();return t?await t8()?await r8(t)?(location.assign(ff),!0):!1:(location.replace(ff),!0):!1}St();M();O();fe();Oi();var vw=class extends F{static styles=[...F.styles,A(mr)];static properties={encoded:{type:String},_stage:{state:!0},_password:{state:!0},_name:{state:!0},_decoded:{state:!0},_existingById:{state:!0},_busy:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this.encoded="",this._stage="password",this._password="",this._name="",this._decoded=null,this._existingById=null,this._busy=!1,this._error="",this._settled=!1}focusInitial(){this._focusActiveInput()}updated(e){e.has("_stage")&&this._focusActiveInput()}_focusActiveInput(){if(this._stage==="password")this.renderRoot.querySelector('input[type="password"]')?.focus();else if(this._stage==="name"){let e=this.renderRoot.querySelector('input[data-role="name"]');e&&(e.focus(),e.select())}}_finish(e){this._settled||(this._decoded=null,this._password="",this.encoded="",super._finish(e))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_onPasswordInput=e=>{this._password=e.target.value,this._error=""};_onNameInput=e=>{this._name=e.target.value};_onUnlock=async()=>{if(!(!this._password||this._busy)){this._busy=!0,this._error="";try{let e=await zg({encoded:this.encoded,password:this._password});if(this._settled)return;let r=re().find(n=>n.id===e.id)??null;this._decoded=e,this._existingById=r,this._name=e.name,this._password="",this._stage="name"}catch(e){if(this._settled)return;this._error=e?.message??String(e)}finally{this._busy=!1}}};_onAttach=()=>{if(!this._decoded)return;let e=Vr(this._name);if(!e)return;let r=re().find(n=>n.id===this._decoded.id)??null;if(r){this._existingById=r;return}this._nameCollision(e)||this._finish({id:this._decoded.id,name:e,privateKeyBase64:this._decoded.privateKeyBase64})};_nameCollision(e){if(!e||!this._decoded)return null;for(let r of re())if(r.id!==this._decoded.id&&Vr(r.name)===e)return r;return null}_onKeydown=e=>{e.key==="Enter"&&(e.preventDefault(),this._stage==="password"?this._onUnlock():this._stage==="name"&&this._onAttach())};_passwordStage(){return d`<p class="nwd-note">Someone shared a workspace with you. Enter the password they sent separately to attach it to this browser.</p><label class="wsl-field"><span>Password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-share-link-unlock" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> ${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._password||this._busy}" @click="${this._onUnlock}">${this._busy?"Unlocking\u2026":"Unlock"}</button></footer>`}_alreadyAttachedStage(){let e=this._existingById;return d`<p class="nwd-note">This workspace is already attached as <strong>"${e?.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>`}_nameStage(){if(this._existingById)return this._alreadyAttachedStage();let e=Vr(this._name),r=this._nameCollision(e),n=!!e&&!r;return d`<p class="nwd-note">Pick a name for the workspace on this device. The shared identity is preserved either way — only the visible label changes.</p><label class="wsl-field"><span>Workspace name</span> <input type="text" class="nwd-input" data-role="name" placeholder="Workspace name" maxlength="200" .value="${this._name}" @input="${this._onNameInput}" @keydown="${this._onKeydown}"></label> ${r?d`<p class="wsl-error" role="alert">A workspace named "${e}" already exists on this device. Pick a different name.</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!n}" @click="${this._onAttach}">Attach</button></footer>`}render(){let e=this._stage==="password"?"Attach shared workspace":this._existingById?"Workspace already attached":"Name the workspace";return d`<dialog @close="${this._onClose}"><header><h3>${e}</h3></header>${this._stage==="password"?this._passwordStage():this._nameStage()}</dialog>`}};customElements.define("workspace-unlock-link-dialog",vw);function eA({encoded:t}={}){return Ys("workspace-unlock-link-dialog",{encoded:t??""},e=>{e.encoded=""})}dv();O();Pn();var Et=null,hf=!1,Uc=null;function n8(t){if(!t)return"Could not unlock. Try again.";switch(t.name??""){case"NotAllowedError":case"AbortError":return"";case"SecurityError":return"The site identity does not match the one this passkey was registered for. If you opened DeepView through a different URL (different subdomain, different port), reload via the original URL.";case"InvalidStateError":return"The passkey state on this device is inconsistent. Try reloading the page or removing and re-creating the passkey.";case"NotSupportedError":return"This browser does not support the WebAuthn PRF extension this site needs. Try a recent Chrome, Safari, or Edge with a platform authenticator.";case"NetworkError":return"A network error prevented the passkey from completing. Check your connection and try again.";case"UnknownError":return"The authenticator returned an unknown error. Try again, or use a different passkey.";default:{let r=t.message??String(t);return r.length>200?r.slice(0,197)+"\u2026":r}}}function o8(){if(Et)return Et;Et=document.createElement("div"),Et.id="lock-overlay",Et.setAttribute("role","dialog"),Et.setAttribute("aria-modal","true"),Et.setAttribute("aria-label","Unlock DeepView"),Et.innerHTML=`
110
142
  <div class="lock-overlay-card">
111
143
  <div class="lock-overlay-icon" aria-hidden="true">
112
144
  <svg viewBox="0 0 32 32" width="40" height="40" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="7" y="15" width="18" height="12" rx="1.5"/><path d="M11 15v-4a5 5 0 0 1 10 0v4"/></svg>
@@ -123,31 +155,37 @@ ${r}`}">${dE}<span class="file-label">${n}</span></button></li>`}function uE(e,t
123
155
  <a href="#" class="lock-overlay-wipe">Wipe local data and start over</a>
124
156
  </p>
125
157
  </div>
126
- `;let e=qe.querySelector("button"),t=qe.querySelector(".lock-overlay-error");return e.addEventListener("click",async()=>{if(!Bl){Bl=!0,t.hidden=!0,t.textContent="",e.disabled=!0,e.textContent="Waiting\u2026",as=new AbortController;try{let n=await Ho({signal:as.signal})}catch(n){let o=t2(n);t.textContent=o,t.hidden=!o}finally{Bl=!1,as=null,e.disabled=!1,e.textContent="Unlock with passkey"}}}),qe.querySelector(".lock-overlay-wipe").addEventListener("click",async n=>{if(n.preventDefault(),!Bl&&confirm(`Wipe ALL local DeepView data and start over?
158
+ `;let t=Et.querySelector("button"),e=Et.querySelector(".lock-overlay-error");return t.addEventListener("click",async()=>{if(!(hf||!ww())){hf=!0,e.hidden=!0,e.textContent="",t.disabled=!0,t.textContent="Waiting\u2026",Uc=new AbortController;try{await Ia({signal:Uc.signal})}catch(n){let o=n8(n);e.textContent=o,e.hidden=!o}finally{hf=!1,Uc=null,t.disabled=!1,t.textContent="Unlock with passkey"}}}),Et.querySelector(".lock-overlay-wipe").addEventListener("click",async n=>{if(n.preventDefault(),!(hf||!ww())&&confirm(`Wipe ALL local DeepView data and start over?
127
159
 
128
160
  This deletes your encrypted triage, all reports, and the passkey registration on this device. The data CANNOT be recovered after this \u2014 there is no backup.
129
161
 
130
- Use this only if you have lost access to your passkey and have no other way to unlock.`)&&confirm("Really wipe everything? This cannot be undone.")){try{await Vo()}catch(o){alert(`Wipe failed: ${o?.message??o}. Try again or clear localStorage manually via DevTools.`);return}location.reload()}}),document.body.append(qe),qe}function n2(){return Mt()?se()&&!$t():!1}function Aw(){if(n2()){let e=r2();e.hidden=!1;let t=e.querySelector("button");t&&t.focus()}else if(qe&&(qe.hidden=!0,as))try{as.abort()}catch{}}Ie(Aw);Aw();var Tw=`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%;box-sizing:border-box;min-height:9rem;max-height:50vh;resize:vertical;padding:.55rem .65rem;border:1px solid var(--border);border-radius:6px;background:var(--bg, var(--surface));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)}}
131
- `;var Jp=class extends I{static styles=[...I.styles,B(po),B(Tw)];static properties={initial:{attribute:!1},finding:{attribute:!1},_value:{state:!0}};constructor(){super(),this.initial="",this.finding=null,this._value=""}beforeOpen(){this._value=this.initial??""}focusInitial(){let t=this.renderRoot.querySelector("textarea");if(!t)return;t.focus();let r=t.value.length;try{t.setSelectionRange(r,r)}catch{}}_onInput=t=>{this._value=t.target.value};_onSave=()=>{let t=(this._value??"").trim(),r=(this.initial??"").trim();if(t===r){this._finish(null);return}this._finish(t)};_onClear=()=>this._finish("");_onCancel=()=>this._finish(null);_onKeydown=t=>{t.key==="Enter"&&(t.ctrlKey||t.metaKey)&&(t.preventDefault(),this._onSave())};render(){let t=this.finding??{},r=t.file?t.line?`${t.file}:${t.line}`:t.file:"",n=(this.initial??"").length>0;return c`<dialog @close="${this._onClose}"><header><h3>${n?"Edit comment":"Add comment"}</h3><div class="finding">${fo(ne(t,a.severityMode))} ${r?c`<span class="loc" title="${r}">${r}</span>`:g}</div>${t.description?c`<div class="desc" title="${t.description}">${t.description}</div>`:g}</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">${n?c`<button type="button" class="danger" @click="${this._onClear}">Clear</button>`:g} <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",Jp);function Rw({initial:e="",finding:t=null}={}){return ee("comment-dialog",{initial:e,finding:t})}var Qp=class extends I{static styles=[...I.styles,B(Ce)];static properties={bundleName:{type:String},encrypted:{type:Boolean}};constructor(){super(),this.bundleName="",this.encrypted=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_securityNote(){return this.encrypted?c`<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>`:c`<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>`}render(){return c`<dialog @close="${this._onClose}"><header><h3>Download bundle</h3></header><p class="lwd-body">Download <strong>"${this.bundleName}"</strong> to disk?</p>${this._securityNote()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onConfirm}">Download</button></footer></dialog>`}};customElements.define("download-bundle-dialog",Qp);function Iw({name:e,encrypted:t}={}){return ee("download-bundle-dialog",{bundleName:e??"",encrypted:!!t})}var i2={critical:"Critical",high:"High",medium:"Medium",low:"Low",high_bug:"High bug",bug:"Bug",informational:"Informational"},s2={red:"Red",blue:"Blue",green:"Green",gray:"Gray",none:"Unmarked"},a2={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Deleted",ignored:"Ignored"};function l2(e){return _e.filter(t=>e.has(t)).map(t=>i2[t]??t).join(", ")}function c2(){let e=[];if(a.filterSeverities.size>0&&e.push({label:"Severity",value:l2(a.filterSeverities)}),a.filterColors.size>0&&e.push({label:"Marks",value:[...a.filterColors].map(t=>s2[t]??t).join(", ")}),a.filterSources.size===1&&e.push({label:"Source",value:a.filterSources.has("own")?"Sources only":"Dependencies only"}),a.filterAnalyzer&&e.push({label:"Analyzer",value:a.filterAnalyzer===Ar?"(none)":a.filterAnalyzer}),a.filterModel&&e.push({label:"Model",value:a.filterModel===Tr?"(none)":a.filterModel}),a.filterRepo&&e.push({label:"Repository",value:a.filterRepo===mn?"(no repo)":a.filterRepo}),a.filterConfMin>0||a.filterConfMax<10){let t;a.filterConfMin>0&&a.filterConfMax<10?t=`${a.filterConfMin}\u2013${a.filterConfMax}`:a.filterConfMin>0?t=`\u2265 ${a.filterConfMin}`:t=`\u2264 ${a.filterConfMax}`,e.push({label:"Confidence",value:t})}a.filterInclude&&e.push({label:a.filterIncludeNegate?"Excluding":"Search",value:`"${a.filterInclude}"`});for(let[t,r]of[["filterComment","comment"],["filterFix","fix"],["filterFlagged","flag"]]){let n=a[t];n&&e.push({label:"Annotation",value:`${n==="with"?"With":"Without"} ${r}`})}return e}function d2(e){return(e==="download"?a.reports.flatMap(r=>r.groups??[]):st()).filter(r=>pe(r).commonTriage===a.shownTriage)}function Mw(e){let t=d2(e),r=t.length,n=Rr(t).length;return{included:n,total:r,excluded:r-n,filters:c2(),bucketLabel:a.shownTriage?a2[a.shownTriage]??a.shownTriage:null,focusedOnly:e==="print"&&a.viewMode==="focus"}}var Fw=`.ecd-count{margin:0;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{color:var(--text);overflow-wrap:anywhere}.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}
132
- `;var Zp=class extends I{static styles=[...I.styles,B(Fw)];static properties={mode:{type:String},included:{type:Number},excluded:{type:Number},total:{type:Number},filters:{attribute:!1},bucketLabel:{type:String},focusedOnly:{type:Boolean}};constructor(){super(),this.mode="print",this.included=0,this.excluded=0,this.total=0,this.filters=[],this.bucketLabel=null,this.focusedOnly=!1}focusInitial(){let t=this.included===0?'button[data-role="cancel"]':"button.primary";this.renderRoot.querySelector(t)?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_countSection(){if(this.total===0)return c`<p class="ecd-count">No findings to ${this.mode==="print"?"print":"download"}.</p>`;if(this.focusedOnly&&this.included>0)return c`<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 r=this.excluded===0&&this.filters.length===0?c`All <strong>${this.included}</strong> ${this.included===1?"finding":"findings"} included.`:c`<strong>${this.included}</strong> of ${this.total} ${this.total===1?"finding":"findings"} included.`;return c`<p class="ecd-count">${r}</p>${this.excluded>0?c`<p class="ecd-excluded">${this.excluded} filtered out and ${this.mode==="print"?"won't be printed":"won't be downloaded"}.</p>`:g}`}_filtersSection(){return this.filters.length===0?c`<p class="ecd-filters-label">No filters active — the full ${this.bucketLabel?`${this.bucketLabel.toLowerCase()} `:""}set is included.</p>`:c`<p class="ecd-filters-label">Active filters</p><dl class="ecd-filters">${this.filters.map(t=>c`<dt>${t.label}</dt><dd>${t.value}</dd>`)}</dl>`}render(){let t=this.mode==="print",r=t?"Print report":"Download report",n=this.focusedOnly?"You're in focus mode \u2014 printing outputs just the finding you're focused on.":t?"Prints only the findings matching your current filters \u2014 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 \u2014 the same set shown on screen. Use the toolbar to change the selection first.";return c`<dialog @close="${this._onClose}"><header><h3>${r}</h3></header><p class="nwd-intro">${n}</p>${this._countSection()} ${this.bucketLabel?c`<p class="nwd-note">Scoped to the <strong>${this.bucketLabel}</strong> list — live findings are not included.</p>`:g} ${this._filtersSection()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${this.included===0}" @click="${this._onConfirm}">${t?"Print":"Download"}</button></footer></dialog>`}};customElements.define("export-confirm-dialog",Zp);function ef(e){let t=Mw(e);return new Promise(r=>{let n=document.createElement("export-confirm-dialog");Object.assign(n,{mode:e,included:t.included,excluded:t.excluded,total:t.total,filters:t.filters,bucketLabel:t.bucketLabel,focusedOnly:t.focusedOnly});let o=i=>{n.remove(),r({confirmed:i})};n.addEventListener("resolve",i=>o(!!i.detail?.confirmed)),n.addEventListener("modal-conflict",()=>o(!1)),document.body.append(n)})}var Bw=`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:6px;background:var(--bg, var(--surface));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: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}
133
- `;var tf=class extends I{static styles=[...I.styles,B(po),B(Bw)];static properties={initial:{attribute:!1},finding:{attribute:!1},canApplyToGroup:{attribute:!1},_value:{state:!0}};constructor(){super(),this.initial="",this.finding=null,this.canApplyToGroup=!1,this._value=""}beforeOpen(){this._value=this.initial??""}focusInitial(){let t=this.renderRoot.querySelector('input[type="url"]');if(t){t.focus();try{t.select()}catch{}}}_onInput=t=>{this._value=t.target.value};get _trimmed(){return(this._value??"").trim()}_onSave=()=>{let t=(this.initial??"").trim();if(this._trimmed===t){this._finish(null);return}this._finish({value:this._trimmed,scope:"finding"})};_onApplyToGroup=()=>{this._trimmed&&this._finish({value:this._trimmed,scope:"group"})};_onClear=()=>this._finish({value:"",scope:"finding"});_onCancel=()=>this._finish(null);_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onSave())};render(){let t=this.finding??{},r=t.file?t.line?`${t.file}:${t.line}`:t.file:"",n=(this.initial??"").length>0,o=this._trimmed,i=_t(o);return c`<dialog @close="${this._onClose}"><header><h3>${n?"Edit fix link":"Add fix link"}</h3><div class="finding">${fo(ne(t,a.severityMode))} ${r?c`<span class="loc" title="${r}">${r}</span>`:g}</div>${t.description?c`<div class="desc" title="${t.description}">${t.description}</div>`:g}</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}"> ${i?c`<a class="open" href="${o}" target="_blank" rel="noopener noreferrer" title="Open in a new tab">Open ↗</a>`:g}</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">${n?c`<button type="button" class="danger" @click="${this._onClear}">Clear</button>`:g} <span class="nwd-spacer"></span> ${this.canApplyToGroup?c`<button type="button" class="quiet" ?disabled="${!o}" @click="${this._onApplyToGroup}">Apply to whole group</button> <span class="nwd-spacer"></span>`:g} <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",tf);function Lw({initial:e="",finding:t=null,canApplyToGroup:r=!1}={}){return ee("fix-link-dialog",{initial:e,finding:t,canApplyToGroup:r})}var Pw=2;function Ow(e,t){a.focusSplit=t,e.closest(".focus-main")?.style.setProperty("--focus-split",String(t)),e.setAttribute("aria-valuenow",String(Math.round(t)))}function Nw(){try{localStorage.setItem(ta,String(a.focusSplit))}catch{}}function Dw(e,t){Ow(e,Qo(t)),Nw()}function zw(e,t){Dw(e,a.focusSplit+t)}function Uw(e){Dw(e,Jo)}function Hw(e,t){let r=e.closest(".focus-main");if(!r)return;t.preventDefault(),e.classList.add("dragging");try{e.setPointerCapture(t.pointerId)}catch{}let n=i=>{let s=r.getBoundingClientRect();s.width!==0&&Ow(e,Qo((i.clientX-s.left)/s.width*100))},o=()=>{e.removeEventListener("pointermove",n),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",o),e.classList.remove("dragging"),Nw()};e.addEventListener("pointermove",n),e.addEventListener("pointerup",o),e.addEventListener("pointercancel",o)}var f2={critical:"Critical",high:"High",medium:"Medium",low:"Low",high_bug:"High Bug",bug:"Bug",informational:"Informational"},h2=["critical","high","medium","low","high_bug","bug","informational"];function rf(e){return f2[e]??e}function Vw(e){let t=h2.indexOf(e);return t===-1?999:t}function jw(e){let t=parseInt(e.line,10);return Number.isFinite(t)?`${e.file}:${t}`:e.file}function g2(e){let t=O(e),r=a.triage.get(t),n=r?.triage,o=Oi(e),i=r?.color,s=r?.comment??"",l=r?.fix??"",{title:d,body:u}=to(e),p=hn(e),h=[p?`### ${jw(e)} - ${p}`:`### ${jw(e)}`,""],m=[];if(nr(e)){let y=Ua(e)?", varies across reports":"";m.push(`**Severity:** ${rf(rr(e))} (corrected from ${rf(e.severity)}${y})`)}e.confidence!==void 0&&m.push(`**Confidence:** ${e.confidence}/10`);let b=gt(e);b&&m.push(`**Revalidation:** ${b}`),n?m.push(`**Triage:** ${n}`):o&&m.push("**Ignored**"),i&&m.push(`**Mark:** ${i}`),r?.flagged===!0&&m.push("**Flagged**"),m.length>0&&(h.push(m.join(", ")),h.push("")),d&&(h.push(d),h.push("")),u&&(h.push(u.trim()),h.push(""));let v=Li(e);return v&&(h.push(v),h.push("")),e.impact&&(h.push(`**Impact:** ${Fe(e.impact,e).trim()}`),h.push("")),e.reproduction&&(h.push(`**Reproduction:** ${Fe(e.reproduction,e).trim()}`),h.push("")),e.recommendation&&(h.push(`**Recommendation:** ${Fe(e.recommendation,e).trim()}`),h.push("")),e.confidenceReason&&(h.push(`**Confidence reason:** ${Fe(e.confidenceReason,e).trim()}`),h.push("")),e.revalidateVerdict&&(h.push(`**Revalidation verdict:** ${Fe(e.revalidateVerdict,e).trim()}`),h.push("")),e.revalidateRecommendation&&(h.push(`**Revalidation recommendation:** ${Fe(e.revalidateRecommendation,e).trim()}`),h.push("")),nr(e)&&e.correctedSeverityReason&&(h.push(`**Severity correction:** ${e.correctedSeverityReason.trim()}`),h.push("")),l&&(h.push(`**Fix:** ${l.trim()}`),h.push("")),s&&(h.push(`**Comment:** ${s.trim()}`),h.push("")),h.join(`
134
- `)}function m2(e){let t=(e.groups??[]).filter(r=>pe(r).commonTriage===a.shownTriage);return Rr(t)}function b2(e,t){let r=t.flat(),n=[`# ${e.fileName}`,""];if(e.source&&(n.push(`**Source:** ${e.source}`),n.push("")),n.push(`**Findings:** ${r.length}`),n.push(""),r.length===0)return n.join(`
135
- `);let o=new Map;for(let s of r){let l=rr(s)??"informational";o.has(l)||o.set(l,[]),o.get(l).push(s)}let i=[...o.keys()].toSorted((s,l)=>Vw(s)-Vw(l));for(let s of i){let l=o.get(s);n.push(`## ${rf(s)} (${l.length})`),n.push("");for(let d of l)n.push(g2(d))}return n.join(`
136
- `).trimEnd()+`
137
- `}function y2(e){let t=[];for(let r of e){let n=m2(r);n.length!==0&&t.push(b2(r,n))}return t.join(`
138
- ---
139
-
140
- `)}function v2(e){let t=e.map(n=>n.fileName),r="";return t.length===1?r=t[0]:t.length>1&&(r=Ka(t)),r=r.replace(/\.json$/u,""),`${r||"deepview-report"}.md`}function Ww(e){if(e.length===0)return;let t=y2(e),r=new Blob([t],{type:"text/markdown;charset=utf-8"});qt(r,v2(e))}Jc(()=>{a.currentView==="bundles"&&a.selectedBundle?x():a.currentView==="packages"?x():a.currentView==="repositories"?x():(a.currentView==="findings"||a.currentView==="files")&&W().catch(()=>{})});var nf=!1;id(()=>{a.currentView!=="findings"&&a.currentView!=="files"||nf||(nf=!0,queueMicrotask(()=>{nf=!1,!(a.currentView!=="findings"&&a.currentView!=="files")&&(a.bundleHashTick++,x())}))});function Kw(){a.currentView==="bundles"&&a.bundleDetailsTab==="graph"?gl():Cp()}function Pl(){a.currentView==="bundles"&&a.bundleDetailsTab==="graph"?ml():Ep()}function ko(){let e=document.querySelector(".bundle-source-code-wrap"),t=e?.scrollTop??0,r=e?.scrollLeft??0;x();let n=document.querySelector(".bundle-source-code-wrap");n&&(n.scrollTop=t,n.scrollLeft=r)}function ls(e){let r=document.querySelector(e)?.scrollTop??0;x();let n=document.querySelector(e);n&&(n.scrollTop=r)}function Dr(){a.viewMode==="table"?ls(".findings-table-list"):x()}var of=0;function w2(){of||(of=requestAnimationFrame(()=>{of=0,x()}))}function q(e,t){for(let r of e.composedPath())if(r?.matches?.(t))return r;return null}function Gw(e){let r=q(e,"[data-gid]")?.dataset?.gid,n=r?Ht(r):null;if(!n)return null;let o=He(n);return Bb(o,Ja(o))}S.addEventListener("click",e=>{let t=q(e,"[data-code-nav-file]");if(t){Zw(Qw(e),{integrity:t.dataset.codeNavIntegrity,file:t.dataset.codeNavFile,range:ht(t.dataset.codeNavLine)});return}let r=q(e,"[data-code-history]");if(r){x2(r.dataset.codeHistory==="forward"?1:-1);return}let n=q(e,"[data-code-preview]");if(n){let E=n.dataset.codePreview,P=new Set(a.codePreviews);P.delete(E)||P.add(E),a.codePreviews=P,x();return}let o=q(e,"[data-finding-code-bundle]");if(o){let E=o.dataset.findingCodeBundle,P=o.dataset.findingCodeFile,V=o.dataset.findingCodeLine,Q=V?parseInt(V,10):null;a.bundleSourceFile=P||null,a.bundleSourceFindingIdx=null,(a.bundleDetailsTab==="code"||a.bundleDetailsTab==="search")&&(a.bundleDetailsTab="overview");let be=()=>{Number.isFinite(Q)&&queueMicrotask(()=>{let $e=document.querySelector(`.bundle-source-lineno-row[data-line="${Q}"]`);$e&&$e.scrollIntoView({block:"start",behavior:"instant"})})};if(a.selectedBundle===E&&a.bundleDetails?.integrity===E){x(),be();return}a.selectedBundle=E,a.bundleDetails=null,x(),(async()=>(await or(E),be()))();return}let i=e.target.closest("[data-package-expand]");if(i){let E=i.dataset.packageExpand;a.expandedPackages.has(E)?a.expandedPackages.delete(E):a.expandedPackages.add(E),x();return}let s=e.target.closest("[data-package-row-issues]");if(s){let E=s.dataset.packageRowIssues,P=s.dataset.packageRowIssuesVersion;a.selectedPackage=E,a.selectedPackageVersion=P||null,a.packageDetailsTab="issues",a.packageSlideTriage=null,a.packageSlideTransient=!0,x();return}let l=e.target.closest("[data-repository-row-issues]");if(l){let E=l.dataset.repositoryRowIssues;a.selectedRepository=E,a.repositoryDetailsTab="issues",a.repositorySlideTriage=null,a.repositorySlideTransient=!0,x();return}let d=e.target.closest("[data-select-package]");if(d){let E=d.dataset.selectPackage,P=d.dataset.selectPackageVersion??"",V=P===""?null:P;if(a.selectedPackage===E&&a.selectedPackageVersion===V)return;a.selectedPackage=E,a.selectedPackageVersion=V,a.packageDetailsTab="overview",a.packageSlideTriage=null,a.packageSlideTransient=!1,x();return}if(e.target.closest("[data-deselect-package]")){a.selectedPackage=null,a.selectedPackageVersion=null,x();return}let u=e.target.closest("[data-package-tab]");if(u){let E=u.dataset.packageTab;(E==="overview"||E==="issues")&&a.packageDetailsTab!==E&&(a.packageDetailsTab=E,x());return}if(e.target.closest('[data-action="package-slide-back"]')){a.packageDetailsTab="overview",a.packageSlideTriage=null,a.packageSlideTransient&&(a.selectedPackage=null,a.selectedPackageVersion=null,a.packageSlideTransient=!1),x();return}let p=e.target.closest("[data-package-report]");if(p){let E=p.dataset.packageReport;E&&Ze(E);return}let f=e.target.closest("[data-select-repository]");if(f){let E=f.dataset.selectRepository;if(a.selectedRepository===E)return;a.selectedRepository=E,a.repositoryDetailsTab="overview",a.repositorySlideTriage=null,a.repositorySlideTransient=!1,x();return}if(e.target.closest("[data-deselect-repository]")){a.selectedRepository=null,x();return}let h=e.target.closest("[data-repository-tab]");if(h){let E=h.dataset.repositoryTab;(E==="overview"||E==="issues")&&a.repositoryDetailsTab!==E&&(a.repositoryDetailsTab=E,x());return}if(e.target.closest('[data-action="repository-slide-back"]')){a.repositoryDetailsTab="overview",a.repositorySlideTriage=null,a.repositorySlideTransient&&(a.selectedRepository=null,a.repositorySlideTransient=!1),x();return}let m=e.target.closest("[data-bundle-tab]");if(m){let E=m.dataset.bundleTab;if(Vi.has(E)){if(E===a.bundleDetailsTab){a.selectedBundle&&Lr(a.selectedBundle,E);return}a.bundleDetailsTab==="graph"&&E!=="graph"&&Be(),a.bundleDetailsTab=E,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.selectedBundle&&Lr(a.selectedBundle,E),x(),E==="code"&&Ki()}return}let b=e.target.closest("[data-bundle-download]");if(b){let E=b.dataset.bundleDownload,P=(a.bundles??[]).find(V=>V.integrity===E);if(!P)return;(async()=>{let{confirmed:V}=await Iw({name:P.name,encrypted:se()});if(V)try{let Q=await Xt(E);qt(new Blob([Q],{type:"application/octet-stream"}),P.name)}catch(Q){alert(`Failed to download bundle: ${Q.message}`)}})();return}let v=e.target.closest("[data-bundle-export-sbom]");if(v){let E=v.dataset.bundleExportSbom,P=a.bundleDetails,V=(a.bundles??[]).find(Q=>Q.integrity===a.selectedBundle);if(!V||!P||P.integrity!==V.integrity)return;try{let Q=E==="cyclonedx",be=Q?wy(P,V):ky(P,V),$e=`${cl(V.name)}.${Q?"cdx":"spdx"}.json`;qt(new Blob([be],{type:"application/json"}),$e)}catch(Q){alert(`Failed to export ${E==="cyclonedx"?"CycloneDX":"SPDX"}: ${Q.message}`)}return}if(q(e,"[data-bundle-search-context]")){a.bundleSearchContext=!a.bundleSearchContext,ls(".bundle-search-results");return}if(e.target.closest("[data-advisories-consent]")){Yy(),x();return}if(e.target.closest("[data-advisories-retry]")){Jy(a.bundleDetails,x).catch(()=>{}),x();return}let w=e.target.closest("[data-bundle-issue-report]");if(w){let E=w.dataset.bundleIssueReport;E&&Ze(E);return}if(e.target.classList?.contains("bundle-source-overlay")||e.target.closest('[data-action="bundle-source-close"]')){a.bundleSourceFile&&(a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,x());return}if(e.target.closest('[data-action="bundle-source-panel-close"]')){a.bundleSourceFindingIdx!=null&&(a.bundleSourceFindingIdx=null,ko());return}let k=e.target.closest("[data-bundle-source-finding]");if(k){let E=parseInt(k.dataset.bundleSourceFinding,10);Number.isFinite(E)&&(a.bundleSourceFindingIdx=a.bundleSourceFindingIdx===E?null:E,ko());return}let _=e.target.closest("[data-bundle-code-issue-step]");if(_){let E=_.closest("[data-bundle-code-issue-order]"),P=null;try{P=JSON.parse(E?.dataset.bundleCodeIssueOrder??"null")}catch{}if(Array.isArray(P)&&P.length>0){let V=_.dataset.bundleCodeIssueStep==="-1"?-1:1,Q=P.findIndex($e=>$e.idx===a.bundleSourceFindingIdx),be=Q===-1?V>0?P[0]:P.at(-1):P[(Q+V+P.length)%P.length];a.bundleSourceFindingIdx=be.idx,ko(),be.line>0&&queueMicrotask(()=>{let $e=document.querySelector(`.bundle-source-lineno-row[data-line="${be.line}"]`);$e&&$e.scrollIntoView({block:"center",behavior:"smooth"})})}return}let R=q(e,"[data-bundle-view-source]");if(R){let E=R.dataset.bundleViewSource;if(!E)return;let P=R.dataset.bundleViewFindingIdx,V=P===void 0?null:parseInt(P,10),Q=R.dataset.bundleViewLine,be=Q?parseInt(Q,10):null,$e=a.bundleSourceFile!==E;if(a.bundleSourceFile=E,Number.isFinite(V)?a.bundleSourceFindingIdx=V:$e&&(a.bundleSourceFindingIdx=null),R.closest(".bundle-code-rail")?ls(".bundle-code-rail-body"):R.closest(".bundle-search-results")?ls(".bundle-search-results"):R.closest(".bundles-slide-body")?ls(".bundles-slide-body"):x(),Number.isFinite(be)){let Wt=R.dataset.bundleViewScrollBlock||"center";queueMicrotask(()=>{let Wr=document.querySelector(`.bundle-source-lineno-row[data-line="${be}"]`);Wr&&Wr.scrollIntoView({block:Wt,behavior:"smooth"})})}return}if(e.target.closest('[data-action="toggle-files"]')){a.currentView==="files"?a.currentView="findings":(a.viewMode==="graph"&&Be(),a.currentView="files"),document.body.classList.remove("report-fullscreen"),x();return}let M=q(e,"[data-g2-pkg]");if(M){let E=M.dataset.g2Pkg;A.solo=A.solo===E?null:E,A.solo&&(A.selected=null),Kw(),Pl(),A.graphState?.requestDraw?.();return}let z=q(e,"[data-g2-select]");if(z){A.selected=z.dataset.g2Select,Kw(),A.graphState?.requestDraw?.();return}let F=q(e,"[data-g2-top-pkgs]");if(F){A.topPkgsTab=F.dataset.g2TopPkgs,Pl();return}let H=q(e,"[data-g2-jump-findings]");if(H){if(a.currentView==="bundles"){a.bundleDetailsTab==="graph"&&Be(),a.bundleDetailsTab="issues",a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.selectedBundle&&Lr(a.selectedBundle,"issues"),x();return}ro(),a.filterConfMin=0,a.filterInclude=H.dataset.g2JumpFindings,a.currentView="findings",a.viewMode==="graph"&&(a.viewMode="table"),Be(),x();return}let he=q(e,"[data-g2-jump-file]");if(he){let E=he.dataset.g2JumpFile;a.currentView="files",Be(),x(),requestAnimationFrame(()=>{let P=document.querySelector(`#${Ui(E)}`);P&&P.scrollIntoView({behavior:"smooth",block:"start"})});return}if(q(e,"#g2-path-filter-clear")){A.pathFilter="";let E=document.querySelector("graph-layout")?.shadowRoot?.querySelector("#g2-path-filter");E&&(E.value=""),A.graphState?.requestDraw?.();return}if(q(e,"#g2-fullscreen")){document.body.classList.toggle("report-fullscreen");return}if(q(e,"[data-g2-show-all]")){A.showAll=!A.showAll,A.layoutCache=null,A.selected=null,Be(),x();return}if(q(e,"[data-g2-split-own]")){A.splitOwnDirs=!A.splitOwnDirs,A.layoutCache=null,A.solo=null,A.focusedPkg=null,A.packagesView&&(A.selected=null),Be(),x();return}if(q(e,"[data-g2-packages-view]")){A.packagesView=!A.packagesView,A.layoutCache=null,A.selected=null,A.focusedPkg=null,Be(),x();return}let Ve=q(e,".graph2-triage-selector [data-triage-show]");if(Ve){let E=Ve.dataset.triageShow;a.shownTriage=a.shownTriage===E?null:E,A.layoutCache=null,A.selected=null,Be(),x();return}let Ur=q(e,"[data-g2-focus-pkg]");if(Ur){A.focusedPkg=Ur.dataset.g2FocusPkg,A.layoutCache=null,Be(),x();return}if(q(e,"#g2-back-to-full")){A.focusedPkg=null,A.layoutCache=null,A.packagesView&&(A.selected=null),Be(),x();return}let So=q(e,".tab");if(So&&q(e,".tabs")){let P=q(e,"[data-gid]").dataset.gid,V=So.dataset.tid;a.activeTabByGroup.set(P,V),Dr();return}let ar=q(e,"[data-triage-action]");if(ar){let E=ar.closest(".triage-menu"),P=E?.dataset.gid;if(!P)return;let V=Ht(P);if(!V)return;let Q=ar.dataset.triageAction;if(!["inprogress","fixed","invalid","deleted","ignored","restore"].includes(Q))return;let{targets:be,clearing:$e}=Hb(V,Q);Xw(be,$e?"untriaged":Q);try{E.hidePopover()}catch{}ce(),Dr();return}if(q(e,".mark-comment")){let P=q(e,"[data-gid]").dataset.gid,V=Ht(P);if(!V)return;let Q=He(V),be=O(Q),$e=a.triage.get(be)?.comment??"";Rw({initial:$e,finding:Q}).then(Wt=>(Wt===null||(U(a.triage,be,{comment:Wt||void 0}),ce(),Dr()),null)).catch(()=>{});return}let En=q(e,".mark-copy");if(En){let E=Gw(e);if(E===null)return;try{navigator.clipboard.writeText(E).then(()=>(En.classList.add("copied"),setTimeout(()=>En.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let Hr=q(e,".mark-link");if(Hr){let E=q(e,"[data-gid]"),P=E?Ht(E.dataset.gid):null;if(!P)return;let V=yw(He(P));if(!V)return;try{navigator.clipboard.writeText(V).then(()=>(Hr.classList.add("copied"),setTimeout(()=>Hr.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let Vr=q(e,"[data-copy-report]");if(Vr){let E=Vr.dataset.copyReport;try{navigator.clipboard.writeText(E).then(()=>(Vr.classList.add("copied"),setTimeout(()=>Vr.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let An=q(e,"[data-copy-path]");if(An){let E=An.dataset.copyPath;try{navigator.clipboard.writeText(E).then(()=>(An.classList.add("copied"),setTimeout(()=>An.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let jt=q(e,".mark-claude");if(jt){let E=Gw(e);if(E===null)return;let P=`claude://code/new?q=${encodeURIComponent(`Confirm and fix:
141
-
142
- ${E}`)}`;try{window.location.href=P,jt.classList.add("copied"),setTimeout(()=>jt.classList.remove("copied"),1e3)}catch{}return}if(q(e,".mark-fix")){let P=q(e,"[data-gid]")?.dataset.gid,V=P?Ht(P):null;if(!V)return;let Q=He(V),be=jb(V),$e=a.triage.get(O(Q))?.fix??"";Lw({initial:$e,finding:Q,canApplyToGroup:Ub(be,$e)}).then(Wt=>{if(Wt===null)return null;let Wr=Wt.scope==="group"?be.filter(Kr=>Kr===Q||Bu(Kr,$e)):[Q],Eo=!1;for(let Kr of Wr)U(a.triage,O(Kr),{fix:Wt.value||void 0})&&(Eo=!0);return Eo&&(Wr.length>1&&a.activeTabByGroup.set(P,O(Q)),Dr(),queueMicrotask(ce)),null}).catch(()=>{});return}let Et=q(e,"[data-flag-toggle]");if(Et){let E=Et.dataset.flagToggle,P=a.triage.get(E)?.flagged;U(a.triage,E,{flagged:P!==!0}),ce(),Dr();return}let Tn=e.target.closest("[data-triage-show]");if(Tn&&!Tn.closest(".graph2-triage-selector")){let E=Tn.dataset.triageShow;a.shownTriage=a.shownTriage===E?null:E,x();return}if(e.target.closest("[data-table-deselect]")){a.tableSelectedGid=null,Dr();return}let jr=e.target.closest("[data-tree-select]");if(jr){let E=jr.dataset.treeSelect;a.filesSelectedFile=a.filesSelectedFile===E?null:E,x();return}e.target.closest("[data-tree-deselect]")&&(a.filesSelectedFile=null,x())});var qw=document.querySelector("#bundle-source-overlay-slot");qw&&qw.addEventListener("click",e=>{if(e.target.classList?.contains("bundle-source-overlay")||e.target.closest('[data-action="bundle-source-close"]')){a.bundleSourceFile&&(a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,x());return}if(e.target.closest('[data-action="bundle-source-panel-close"]')){a.bundleSourceFindingIdx!=null&&(a.bundleSourceFindingIdx=null,ko());return}let t=e.target.closest("[data-bundle-source-finding]");if(t){let r=parseInt(t.dataset.bundleSourceFinding,10);Number.isFinite(r)&&(a.bundleSourceFindingIdx=a.bundleSourceFindingIdx===r?null:r,ko())}});function Ol(e){let t=e?Ht(e):null;t&&Qa(t)&&queueMicrotask(ce)}S.addEventListener("row-select",e=>{let t=e.detail?.gid;if(!t)return;let r=a.tableSelectedGid!==t;a.tableSelectedGid=r?t:null,r&&Ol(t),Dr()});var Nl="application/x-deepview-kanban-gid";function Xw(e,t){for(let r of e){let n=O(r),o=Mu(r);t==="untriaged"?(U(a.triage,n,{triage:void 0}),De(a.triage,n,o,!1)):t==="ignored"?(U(a.triage,n,{triage:void 0}),De(a.triage,n,o,!0)):(U(a.triage,n,{triage:t}),De(a.triage,n,o,!1))}}function k2(e,t){Xw(Lu(e),t)}function lf(){for(let e of S.querySelectorAll(".kanban-card.dragging"))e.classList.remove("dragging");for(let e of S.querySelectorAll(".kanban-column.drag-over"))e.classList.remove("drag-over")}S.addEventListener("dragstart",e=>{let t=e.target.closest?.(".kanban-card[data-kanban-source]");if(!t||!e.dataTransfer)return;let r=t.dataset.gid;r&&(e.dataTransfer.setData(Nl,r),e.dataTransfer.setData("text/plain",r),e.dataTransfer.effectAllowed="move",t.classList.add("dragging"))});S.addEventListener("dragend",()=>{lf()});S.addEventListener("dragover",e=>{if(!e.dataTransfer?.types.includes(Nl))return;let t=e.target.closest?.(".kanban-column[data-kanban-target]");if(t&&(e.preventDefault(),e.dataTransfer.dropEffect="move",!t.classList.contains("drag-over"))){for(let r of S.querySelectorAll(".kanban-column.drag-over"))r!==t&&r.classList.remove("drag-over");t.classList.add("drag-over")}});S.addEventListener("dragleave",e=>{let t=e.target.closest?.(".kanban-column[data-kanban-target]");t&&(t.contains(e.relatedTarget)||t.classList.remove("drag-over"))});S.addEventListener("drop",e=>{if(!e.dataTransfer?.types.includes(Nl))return;let t=e.target.closest?.(".kanban-column[data-kanban-target]");if(!t){lf();return}e.preventDefault();let r=e.dataTransfer.getData(Nl),n=t.dataset.kanbanTarget;if(lf(),!r||!n)return;let o=Ht(r);!o||(pe(o).commonTriage??"untriaged")===n||(k2(o,n),x(),queueMicrotask(ce))});var sf=!1;function _n(e){return e?S.querySelector(`.kanban-card[data-gid="${CSS.escape(e)}"]`):null}function Ll(e){let t=e??S.querySelector(".kanban-card");if(!t)return;let r=t.getBoundingClientRect();r.width<=0||r.height<=0||(document.documentElement.style.setProperty("--kanban-clip-card-w",`${Math.floor(r.width)}px`),document.documentElement.style.setProperty("--kanban-clip-card-h",`${Math.floor(r.height)}px`))}function $2(){let e=S.querySelector(".kanban-detail-side [data-kanban-select].active");e&&e.scrollIntoView({block:"nearest",behavior:"instant"})}function af(e){a.kanbanPopoverGid=e,a.focusCodeStack=[],a.focusCodeAt=0}function Yw(){$2(),wn()}function Cn(e){let t=a.kanbanPopoverGid;if(t===e)return;let r=t===null&&e!==null,n=t!==null&&e===null;if(!document.startViewTransition||!r&&!n){Ol(e),af(e),x(),Yw();return}if(sf)return;Ol(e),sf=!0;let o=r?"kanban-opening":"kanban-closing";document.documentElement.classList.add(o);let i=u=>{u&&(u.style.viewTransitionName=""),document.documentElement.classList.remove(o),sf=!1};if(r){let u=_n(e);u?(Ll(u),u.style.viewTransitionName="kanban-detail-modal",u.getBoundingClientRect()):Ll(),af(e);let p=document.startViewTransition(()=>{x(),Yw(),u&&(u.style.viewTransitionName="")}),f=setTimeout(()=>i(u),600);(async()=>{try{await p.finished}catch{}clearTimeout(f),i(u)})();return}Ll(),af(e);let s=null,l=document.startViewTransition(()=>{x(),s=_n(t),s&&(Ll(s),s.style.viewTransitionName="kanban-detail-modal")}),d=setTimeout(()=>i(s??_n(t)),600);(async()=>{try{await l.finished}catch{}clearTimeout(d),i(s??_n(t))})()}function Jw(e){let t=_n(a.kanbanPopoverGid),r=t?.closest(".kanban-column");if(!r)return;let n=[...r.querySelectorAll(".kanban-card[data-kanban-source]")],o=n.indexOf(t);if(o<0)return;let i=Math.min(Math.max(o+e,0),n.length-1);if(i===o)return;let s=n[i].dataset.gid;if(!s)return;Cn(s);let l=_n(s);l&&(l.focus({preventScroll:!0}),l.scrollIntoView({block:"nearest",behavior:"instant"}))}S.addEventListener("click",e=>{if(e.target.closest?.(".kanban-detail-close")){Cn(null);return}if(e.target.closest?.("[data-kanban-detail-fullscreen]")){a.kanbanDetailFullscreen=!a.kanbanDetailFullscreen;try{localStorage.setItem(ra,String(a.kanbanDetailFullscreen))}catch{}x(),wn();return}let t=e.target.closest?.("[data-kanban-expand]");if(t){let i=t.dataset.kanbanExpand,s=a.kanbanExpandedColumn===i?null:i;a.kanbanExpandedColumn=s,s&&a.kanbanPopoverGid&&_n(a.kanbanPopoverGid)?.closest(".kanban-column")?.dataset.kanbanTarget!==s&&(a.kanbanPopoverGid=null),x();return}let r=e.target.closest?.("[data-kanban-nav]");if(r){Jw(r.dataset.kanbanNav==="next"?1:-1);return}let n=e.target.closest?.("[data-kanban-select]");if(n){if(window.getSelection?.()?.toString())return;let i=n.dataset.gid;i&&Cn(i);return}if(e.target.closest?.(".kanban-action"))return;let o=e.target.closest?.(".kanban-card[data-kanban-source]");if(o){if(window.getSelection?.()?.toString())return;let i=o.dataset.gid;if(!i)return;Cn(a.kanbanPopoverGid===i?null:i);return}e.target.closest?.(".kanban-detail-modal, .kanban-detail-side")||a.kanbanPopoverGid&&Cn(null)});S.addEventListener("change",e=>{let t=e.target.closest?.("[data-kanban-column]");if(!t)return;let r=t.selectedOptions[0]?.dataset.gid;r&&Cn(r)});document.addEventListener("keydown",e=>{if(e.key==="Escape"){if(a.kanbanPopoverGid){Cn(null);return}a.viewMode!=="kanban"||a.kanbanExpandedColumn===null||(a.kanbanExpandedColumn=null,x())}});function Qw(e){let r=q(e,"[data-gid]")?.dataset?.gid;return r?Ht(r):null}function Zw(e,t){if(!t.integrity||!t.file)return;let r=Ji(e);if(!r)return;let n=cv(r,t);n&&(a.focusCodeStack=n.stack,a.focusCodeAt=n.at,x()),wn()}S.addEventListener("keydown",e=>{if(e.key!=="Enter"&&e.key!==" ")return;let t=q(e,"[data-code-nav-file]");t&&(e.preventDefault(),Zw(Qw(e),{integrity:t.dataset.codeNavIntegrity,file:t.dataset.codeNavFile,range:ht(t.dataset.codeNavLine)}))});function x2(e){let t=dv(a.focusCodeStack,a.focusCodeAt,e);t!==a.focusCodeAt&&(a.focusCodeAt=t,x(),wn())}function e0(e){if(!e||a.focusGid===e)return;Ol(e),a.focusGid=e,a.focusCodeStack=[],a.focusCodeAt=0,x();let t=S.querySelector(".focus-side-card.active");t&&t.scrollIntoView({block:"nearest",behavior:"instant"}),wn()}function t0(e){let t=S.querySelectorAll(".focus-side-card[data-focus-select]");if(t.length===0)return;let r=-1;for(let i=0;i<t.length;i++)if(t[i].classList.contains("active")){r=i;break}let n=r<0?e>0?0:t.length-1:Math.min(Math.max(r+e,0),t.length-1);if(n===r)return;let o=t[n].dataset.gid;o&&e0(o)}S.addEventListener("click",e=>{let t=e.target.closest?.("[data-focus-nav]");if(t){t0(t.dataset.focusNav==="next"?1:-1);return}let r=e.target.closest?.(".focus-side-card[data-focus-select]");if(!r||window.getSelection?.()?.toString())return;let n=r.dataset.gid;n&&e0(n)});S.addEventListener("pointerdown",e=>{if(e.button!==0)return;let t=e.target.closest?.("[data-focus-splitter]");t&&Hw(t,e)});S.addEventListener("dblclick",e=>{let t=e.target.closest?.("[data-focus-splitter]");t&&Uw(t)});function S2(e){if(document.querySelector("dialog[open]"))return!0;for(let t of e.composedPath()){if(!t||t.nodeType!==1)continue;let r=t.tagName;if(r==="INPUT"||r==="TEXTAREA"||r==="SELECT"||r==="DIALOG"&&t.open||t.isContentEditable)return!0}return!1}document.addEventListener("keydown",e=>{if(a.currentView!=="findings")return;let t=a.viewMode==="focus",r=a.viewMode==="kanban"&&a.kanbanPopoverGid!==null;if(!t&&!r||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||S2(e))return;let n=0;if(e.key==="ArrowRight")n=1;else if(e.key==="ArrowLeft")n=-1;else return;e.preventDefault();let o=e.target?.closest?.("[data-focus-splitter]");if(o){zw(o,n*Pw);return}t?t0(n):Jw(n)});S.addEventListener("mark-color",e=>{let t=q(e,"[data-gid]");if(!t)return;let r=t.dataset.gid,n=Ht(r);if(!n)return;let o=O(He(n)),i=e.detail?.color;if(!i)return;a.triage.get(o)?.color===i?U(a.triage,o,{color:void 0}):U(a.triage,o,{color:i}),ce(),Dr()});var zr=null,cf=null;function r0(){if(zr!==null||a.reports.length===0)return;zr=a.viewMode,cf=document.title,a.viewMode==="table"&&(a.viewMode="list",x());let e=a.reports.map(r=>r.fileName),t="";e.length===1?t=e[0]:e.length>1&&(t=Ka(e)),t=t.replace(/\.json$/u,""),t&&(document.title=t)}function n0(){zr!==null&&(a.viewMode!==zr&&(a.viewMode=zr,x()),document.title=cf,zr=null,cf=null)}window.addEventListener("beforeprint",r0);window.addEventListener("afterprint",n0);document.addEventListener("print-requested",async()=>{if(a.reports.length===0||zr!==null)return;let{confirmed:e}=await ef("print");if(e&&zr===null){r0();try{await Promise.all([...S.querySelectorAll("finding-card")].map(t=>t.updateComplete)),window.print()}catch(t){throw n0(),t}}});document.addEventListener("download-requested",async()=>{if(a.reports.length===0)return;let{confirmed:e}=await ef("download");e&&Ww(a.reports)});S.addEventListener("analyzer-change",e=>{a.filterAnalyzer=e.detail.analyzer,a.filterModel=e.detail.model,x()});S.addEventListener("repo-change",e=>{a.filterRepo=e.detail.value,x()});S.addEventListener("revalidate-change",e=>{a.filterRevalidate=e.detail.value,x()});S.addEventListener("partial-change",e=>{a.filterPartial=e.detail.value,x()});S.addEventListener("revalidation-change",e=>{a.showRevalidation=e.detail.on,Ha(a.showRevalidation);let t=st();a.filterConfMin=Ya(t),a.filterConfMax=10,a.filterRevalidate=Xa(t,a.filterConfMin),a.filterPartial="",x()});S.addEventListener("bundle-search-mode-change",e=>{let t=e.detail?.mode;t!=="files"&&t!=="code"&&t!=="issues"||(a.bundleCodeSearchMode=t,x(),t==="files"&&Ki())});S.addEventListener("bundle-search-regex-toggle",()=>{a.bundleSearchRegex=!a.bundleSearchRegex,x()});S.addEventListener("bundle-search-case-toggle",()=>{a.bundleSearchCase=!a.bundleSearchCase,x()});S.addEventListener("bundle-swap",e=>{let t=e.detail?.integrity;!t||!(a.bundles??[]).some(r=>r.integrity===t)||(a.currentView="bundles",a.selectedBundle=t,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.bundleCodeSearchQuery="",a.bundleCodeSearchMode="files",a.bundleSearchQuery="",a.bundleSearchRegex=!1,a.bundleSearchCase=!1,a.bundleSearchContext=!0,a.bundleDetailsTab="compare",A.showAll=!0,a.shownTriage=null,Lr(t,"compare"),x(),W(),or(t))});S.addEventListener("sort-change",e=>{let{kind:t,value:r}=e.detail;if(t==="findings")a.sortBy=r;else if(t==="packages")a.packagesSortBy=r;else if(t==="repositories")a.repositoriesSortBy=r;else return;x()});S.addEventListener("range-change",e=>{e.target.id==="conf-range"&&(a.filterConfMin=e.detail.low,a.filterConfMax=e.detail.high,x())});S.addEventListener("input",e=>{let t=e.composedPath()[0],r=t?.id,n=t?.value;r==="g2-path-filter"&&(A.pathFilter=n,A.graphState?.requestDraw?.())});S.addEventListener("search-input",e=>{if(!e.detail)return;let{kind:t,value:r}=e.detail;if(t==="findings")a.filterInclude=r,r||(a.filterIncludeNegate=!1);else if(t==="files")a.filesSearch=r;else if(t==="packages")a.packagesSearchQuery=r;else if(t==="repositories")a.repositoriesSearchQuery=r;else if(t==="bundle-code")a.bundleCodeSearchQuery=r;else if(t==="bundle-search"){a.bundleSearchQuery=r,w2();return}else return;x()});S.addEventListener("search-negate-toggle",()=>{a.filterIncludeNegate=!a.filterIncludeNegate,x()});S.addEventListener("severity-toggle",e=>{let t=e.detail.severity;if(e.detail.kind==="graph"){A.selectedSeverities.has(t)?A.selectedSeverities.delete(t):A.selectedSeverities.add(t),e.composedPath()[0].selected=[...A.selectedSeverities],A.graphState?.requestDraw?.(),Pl();return}a.filterSeverities.has(t)?a.filterSeverities.delete(t):a.filterSeverities.add(t),x()});S.addEventListener("color-toggle",e=>{let t=e.detail.color;if(e.detail.kind==="graph"){A.selectedColors.has(t)?A.selectedColors.delete(t):A.selectedColors.add(t),e.composedPath()[0].selected=[...A.selectedColors],A.graphState?.requestDraw?.(),Pl();return}a.filterColors.has(t)?a.filterColors.delete(t):a.filterColors.add(t),x()});S.addEventListener("source-toggle",e=>{let t=e.detail.source,r=a.filterSources.has(t);a.filterSources.clear(),r||a.filterSources.add(t),x()});S.addEventListener("annotation-filter-toggle",e=>{let t=e.detail?.key,r=n=>n===""?"with":n==="with"?"without":"";if(t==="comment")a.filterComment=r(a.filterComment);else if(t==="fix")a.filterFix=r(a.filterFix);else if(t==="flag")a.filterFlagged=r(a.filterFlagged);else return;x()});S.addEventListener("slide-triage-toggle",e=>{let{kind:t,value:r}=e.detail;if(t==="package")a.packageSlideTriage=a.packageSlideTriage===r?null:r;else if(t==="repository")a.repositorySlideTriage=a.repositorySlideTriage===r?null:r;else return;x()});S.addEventListener("view-mode-change",e=>{if(e.detail.kind==="files"){a.filesViewMode=e.detail.mode,x();return}a.viewMode=e.detail.mode;try{localStorage.setItem(Zs,a.viewMode)}catch{}a.viewMode!=="kanban"&&(a.kanbanPopoverGid=null),a.viewMode!=="focus"&&(a.focusGid=null),x()});S.addEventListener("severity-mode-change",e=>{let t=e.detail?.mode;if(!(t!=="corrected"&&t!=="original")){a.severityMode=t;try{localStorage.setItem(ea,t)}catch{}x()}});S.addEventListener("repo-edit-start",()=>{a.repoEditing=!0,x()});S.addEventListener("repo-input",e=>{a.repoUrl=e.detail.url,rt(a.currentFile,a.repoUrl)});S.addEventListener("repo-commit",e=>{a.repoUrl=e.detail.url,rt(a.currentFile,a.repoUrl),a.repoEditing=!1,x()});S.addEventListener("repo-cancel",e=>{a.repoUrl=e.detail.url,rt(a.currentFile,a.repoUrl),a.repoEditing=!1,x()});document.addEventListener("keydown",e=>{if(e.key==="Escape"){if(a.bundleSourceFindingIdx!=null){a.bundleSourceFindingIdx=null,ko();return}if(a.bundleSourceFile){if(a.currentView==="bundles"&&a.bundleDetailsTab==="code")return;a.bundleSourceFile=null,x()}}});var o0=`:host{position:absolute;top:.5rem;right:.5rem;z-index:1000;width:30px;height:30px;background:transparent;color:var(--muted);border:0;border-radius:6px;font-size:1rem;line-height:1;font-family:inherit;display:flex;align-items:center;justify-content:center;transition:color .12s,background .12s;cursor:default;user-select:none}:host(:hover){color:var(--text);background:rgb(from var(--text) r g b / .06)}:host(:focus-visible){outline:2px solid var(--accent);outline-offset:2px}@media print{:host{display:none!important}}
143
- `;var df="deepview.theme",$o=Object.freeze(["dark","light","green","pink"]),C2={dark:{base:"#1a1a1b",dim:"#0a0a0a"},light:{base:"#f6f6fa",dim:"#646464"},green:{base:"#0a140a",dim:"#050a05"},pink:{base:"#ffe4ee",dim:"#a3727f"}},E2="\u2600",A2="\u263E",uf="deepview-theme-changed",Dl="dark",ff=!1;function T2(){try{let e=localStorage.getItem(df);return $o.includes(e)?e:"dark"}catch{return"dark"}}function cs(e){$o.includes(e)||(e="dark"),Dl=e;for(let r of $o)r!=="dark"&&document.body.classList.remove(`theme-${r}`);e!=="dark"&&document.body.classList.add(`theme-${e}`);try{e==="dark"?localStorage.removeItem(df):localStorage.setItem(df,e)}catch{}let t=document.querySelector('meta[name="theme-color"]');if(t){let{base:r,dim:n}=C2[e];t.setAttribute("content",ff?n:r)}window.dispatchEvent(new CustomEvent(uf,{detail:{theme:e}}))}cs(T2());window.addEventListener("beforeprint",()=>{ff=!0,cs(Dl)});window.addEventListener("afterprint",()=>{ff=!1,cs(Dl)});function i0(e){if(!$o.includes(e))throw new TypeError(`DeepView.setTheme: unknown theme ${JSON.stringify(e)} (expected one of ${$o.map(t=>JSON.stringify(t)).join(", ")})`);cs(e)}function s0(){return Dl}var a0=$o,pf=class extends Z{static properties={_light:{state:!0}};static styles=B(o0);constructor(){super(),this._light=document.body.classList.contains("theme-light")}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("aria-label")||this.setAttribute("aria-label","toggle theme"),this.hasAttribute("title")||this.setAttribute("title","toggle light/dark theme"),this.addEventListener("click",this._toggle),this.addEventListener("keydown",this._onKeydown),window.addEventListener(uf,this._onThemeChanged)}disconnectedCallback(){window.removeEventListener(uf,this._onThemeChanged),this.removeEventListener("click",this._toggle),this.removeEventListener("keydown",this._onKeydown),super.disconnectedCallback()}_onThemeChanged=()=>{this._light=document.body.classList.contains("theme-light")};_toggle=()=>{let t=document.body.classList.contains("theme-light");cs(t?"dark":"light")};_onKeydown=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this._toggle())};render(){return c`${this._light?A2:E2}`}};customElements.define("theme-toggle",pf);var l0=`:host{display:block}.row{display:grid;grid-template-columns:5.5rem minmax(0,1fr);gap:.2rem .85rem;padding:.25rem .7rem;font-size:.8rem;border-bottom:1px solid var(--border);transition:background .12s}:host(:last-child) .row{border-bottom:none}:host(:hover) .row{background:rgb(from var(--text) r g b / .04)}:host(.mark-red) .row{background:var(--mark-red-bg)}:host(.mark-blue) .row{background:var(--mark-blue-bg)}:host(.mark-green) .row{background:var(--mark-green-bg)}:host(.mark-gray) .row{background:var(--mark-gray-bg)}:host(.has-conflict) .row{outline:2px dashed var(--accent);outline-offset:-2px}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:.75}:host(.selected) .row{outline:2px solid var(--accent);outline-offset:-2px}:host(.link-target) .row{animation:link-target-flash 1.6s ease-out}@keyframes link-target-flash{0%,30%{box-shadow:inset 0 0 0 2px var(--accent)}to{box-shadow:inset 0 0 0 2px rgb(from var(--accent) r g b / 0)}}@media(prefers-reduced-motion:reduce){:host(.link-target) .row{animation:none;box-shadow:inset 0 0 0 2px var(--accent)}}:host(:first-of-type) .row{border-top-left-radius:6px;border-top-right-radius:6px}:host(:last-of-type) .row{border-bottom-left-radius:6px;border-bottom-right-radius:6px}.row-score{grid-column:1;grid-row:1 / 3;align-self:center;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.2rem;font-variant-numeric:tabular-nums;.badge{min-width:4.4rem;text-align:center}.row-conf{color:var(--muted);font-size:.72rem;user-select:none;& strong{color:var(--text);font-size:.8rem}}}.row-body{display:contents}.title-row{grid-column:2;grid-row:1;min-width:0;display:flex;align-items:baseline;gap:.5rem;.title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500;user-select:none}.row-type{color:var(--muted);font-size:.68rem;flex-shrink:0}}.meta-row{grid-column:2;grid-row:2;min-width:0;display:flex;align-items:center;gap:.55rem;.row-loc{color:var(--muted);font-size:.72rem;flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;& a{color:inherit;text-decoration:none;cursor:default}& a:hover{color:var(--accent)}}.marks{display:flex;gap:.35rem;align-items:center;flex-shrink:0;margin-left:auto;user-select:none}}.gh-ref-btn{display:inline-flex;align-items:center;position:relative;flex-shrink:0;padding:0 .15rem;color:var(--muted);cursor:default;&:before{content:"";position:absolute;inset:-.25rem -2px}&:hover{color:var(--accent)}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px;border-radius:2px}}.tabs-row{grid-column:2;grid-row:3;min-width:0;.tabs{display:flex;gap:.25rem;flex-wrap:wrap}}.badge,.tabs,.tab,.row-type{cursor:default;user-select:none}.badge{display:inline-block;font-size:.7rem;font-weight:600;text-transform:uppercase;padding:.15rem .45rem;border-radius:3px;letter-spacing:.03em;line-height:1;&.critical{background:var(--critical);color:#fff}&.high{background:var(--high);color:#fff}&.medium{background:var(--medium);color:#000}&.low{background:var(--low);color:var(--badge-low-text)}&.high_bug{background:var(--high-bug);color:#fff}&.bug{background:var(--bug);color:#fff}&.informational{background:var(--info);color:#fff}}.badge-pair{display:inline-flex;align-items:center;gap:.25rem}.badge-pair-full,.badge-pair-compact{flex-direction:column;gap:.15rem}.badge-orig-wrap{display:inline-flex;align-items:center;gap:.15rem;line-height:1}.badge-arrow,.badge-corr-mark{font-size:.6rem;line-height:1;color:var(--muted)}.badge-arrow.up,.badge-corr-mark.up{color:var(--high)}.badge-pre{font-size:.55rem;text-transform:uppercase;letter-spacing:.03em;color:var(--muted)}.badge-orig{display:inline-block;font-size:.58rem;font-weight:600;text-transform:uppercase;padding:.08rem .3rem;border-radius:3px;letter-spacing:.03em;line-height:1;background:transparent;color:var(--muted);border:1px solid var(--border);&.struck{text-decoration:line-through;text-decoration-thickness:1px}&.critical{border-color:rgb(from var(--critical) r g b / .55)}&.high{border-color:rgb(from var(--high) r g b / .55)}&.medium{border-color:rgb(from var(--medium) r g b / .55)}&.low{border-color:rgb(from var(--low) r g b / .55)}&.high_bug{border-color:rgb(from var(--high-bug) r g b / .55)}&.bug{border-color:rgb(from var(--bug) r g b / .55)}&.informational{border-color:rgb(from var(--info) r g b / .55)}}.badge-varies{font-size:.55rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;padding:.08rem .3rem;border-radius:3px;line-height:1;background:transparent;color:var(--muted);border:1px dashed var(--border)}.tab{background:transparent;color:var(--text);border:1px solid var(--border);border-radius:4px;padding:.2rem .5rem;font-size:.75rem;line-height:1.3;display:inline-flex;align-items:center;gap:.35rem;font-family:inherit;&:hover{border-color:var(--accent)}&.active{border-color:var(--accent);background:var(--surface-active)}&.tab-mark-red{background:var(--mark-red-bg);border-color:var(--mark-red-tab-border)}&.tab-mark-blue{background:var(--mark-blue-bg);border-color:var(--mark-blue-tab-border)}&.tab-mark-green{background:var(--mark-green-bg);border-color:var(--mark-green-tab-border)}&.tab-mark-gray{background:var(--mark-gray-bg);border-color:var(--mark-gray-tab-border)}&.tab-mark-red.active,&.tab-mark-blue.active,&.tab-mark-green.active,&.tab-mark-gray.active{border-color:var(--text)}&.tab-deleted .tab-label{text-decoration:line-through;opacity:.6}&.tab-inprogress .tab-label:after{content:" \\25d0";opacity:.6}&.tab-fixed .tab-label{opacity:.65}&.tab-fixed .tab-label:after{content:" \\2713";opacity:.6}&.tab-invalid .tab-label{opacity:.65}&.tab-invalid .tab-label:after{content:" \\2298";opacity:.6}&.tab-ignored .tab-label{opacity:.55}&.tab-ignored .tab-label:after{content:" \\1f441";opacity:.6;font-size:.7em}.tab-conf{color:var(--muted);font-size:.7rem}&.tab-mark-red .tab-conf,&.tab-mark-blue .tab-conf,&.tab-mark-green .tab-conf,&.tab-mark-gray .tab-conf{color:var(--text)}.tab-marks{display:inline-flex;align-items:center;gap:.15rem;margin-left:.25rem;vertical-align:middle;color:var(--accent)}.tab-marks svg{display:block}.tab-marks .has-comment .bubble,.tab-marks .has-fix .wrench,.tab-marks .flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}}.report-chip{display:inline-flex;align-items:center;gap:.3rem;padding:0 .35rem;height:1.4rem;border:1px solid var(--border);border-radius:3px;color:var(--muted);font-size:.72rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;margin-right:.65rem;max-width:12rem;min-width:0;.report-chip-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.file-icon{flex-shrink:0}.brand-deepview{.bg{fill:#2563eb}.fg{fill:#fff}}.brand-claude{.bg{fill:#d97757}.fg{fill:#fff}}.brand-codex{.bg{fill:#fff;stroke:#000;stroke-width:.5}.fg{fill:#000}}.brand-vercel{.bg{fill:#000;stroke:#fff;stroke-width:.5}.fg{fill:#fff}}.brand-piolium{.bg{fill:#fbb829}.fg{fill:#1c1b19}}}.mark-action-group{display:inline-flex;border:1px solid var(--border);border-radius:3px;overflow:hidden;margin-right:.25rem;flex-shrink:0}.mark-comment,.mark-fix,.mark-flag,.mark-copy,.mark-link,.mark-issue,.mark-claude{background:transparent;border:0;color:var(--muted);padding:0 .25rem;height:1.4rem;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--accent);background:var(--surface-active)}}.mark-issue{text-decoration:none}.mark-comment.has-comment,.mark-fix.has-fix,.mark-flag.flagged{color:var(--accent)}.mark-flag svg{display:block}.mark-copy.copied,.mark-link.copied,.mark-claude.copied{color:var(--green, #4ade80);background:color-mix(in srgb,var(--green, #4ade80) 14%,transparent)}.mark-comment.has-comment .bubble,.mark-fix.has-fix .wrench,.mark-flag.flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}.mark-x{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .35rem;font-size:.85rem;line-height:1.1;margin-left:.25rem;&:hover{color:var(--critical);border-color:var(--critical)}}.triage-menu-wrap{position:relative;display:inline-flex;margin-left:.25rem;flex-shrink:0}.mark-triage-menu{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .3rem;height:1.5rem;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;font:inherit}.mark-triage-menu:hover{color:var(--text);border-color:var(--accent)}.mark-triage-menu.open{border-color:var(--accent);color:var(--text)}.mark-triage-menu.with-label{padding:0 .35rem 0 .5rem;font-size:.72rem;height:1.5rem}.mark-triage-menu .mark-triage-label{text-transform:uppercase;letter-spacing:.05em;font-weight:600}.mark-triage-menu.triage-state-deleted{border-color:var(--critical);color:var(--critical)}.mark-triage-menu.triage-state-fixed{border-color:var(--green, #4ade80);color:var(--green, #4ade80)}.mark-triage-menu.triage-state-inprogress{border-color:var(--warning, #d97706);color:var(--warning, #d97706)}.mark-triage-menu.triage-state-invalid{border-color:var(--muted);color:var(--text)}.mark-triage-menu.triage-state-ignored{border-color:var(--accent, #2563eb);color:var(--accent, #2563eb)}.triage-menu[popover]{position:fixed;inset:auto;margin:0;min-width:7rem;background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:.25rem;box-shadow:0 4px 12px #00000040;display:flex;flex-direction:column;gap:1px;-webkit-app-region:no-drag;app-region:no-drag}.triage-menu[popover]:not(:popover-open){display:none}.triage-menu[popover]:popover-open{display:flex}.triage-menu-item{background:transparent;border:0;padding:.35rem .5rem;font-size:.78rem;color:var(--text);text-align:left;border-radius:3px;font-family:inherit}.triage-menu-item:hover{background:var(--surface)}.triage-menu-item.active:before{content:"\\2713 ";color:var(--accent)}.triage-menu-inprogress:hover{color:var(--warning, #d97706)}.triage-menu-fixed:hover{color:var(--green, #4ade80)}.triage-menu-invalid:hover{color:var(--muted)}.triage-menu-deleted:hover{color:var(--critical)}.mark-restore{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .45rem;font-size:.75rem;line-height:1.3;margin-left:.25rem;&:hover{color:var(--green);border-color:var(--green)}}.line-num{color:var(--muted);font-size:.75rem}.line-num a{color:inherit}.line-num a:hover{color:var(--accent)}@media print{:host(:hover) .row,:host(.mark-red) .row,:host(.mark-blue) .row,:host(.mark-green) .row,:host(.mark-gray) .row{background:transparent!important}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:1}:host(.selected) .row,:host(.has-conflict) .row{outline:none!important}:host(.link-target) .row{animation:none;box-shadow:none!important}.row{break-inside:avoid}.marks,.mark-x,.mark-restore{display:none!important}.badge{-webkit-print-color-adjust:exact;print-color-adjust:exact;&.critical{background:#a30b0f!important;color:#fff!important}&.high{background:#b8400a!important;color:#fff!important}&.medium{background:#855107!important;color:#fff!important}&.low{background:#374151!important;color:#fff!important}&.high_bug{background:#7a3e0c!important;color:#fff!important}&.bug{background:#4d4538!important;color:#fff!important}&.informational{background:#0550ae!important;color:#fff!important}}.badge-orig{background:transparent!important;color:#555!important;border-color:#999!important}.badge-varies{color:#555!important;border-color:#999!important}.badge-arrow,.badge-corr-mark,.badge-pre{color:#555!important}a,.line-num,.line-num a{color:inherit}}
144
- `;var I2=["is-critical","mark-red","mark-blue","mark-green","mark-gray","has-conflict","triage-inprogress","triage-fixed","triage-invalid","triage-deleted","triage-ignored","selected"],hf=class extends N{static properties={group:{attribute:!1},selected:{type:Boolean}};static styles=B(l0);constructor(){super(),this.group=null,this.selected=!1}render(){if(!this.group)return c``;this.dataset.gid=kn(this.group);let t=new Set(wv(this.group));this.selected&&t.add("selected");for(let r of I2)this.classList.toggle(r,t.has(r));return c`<div class="row">${kv(this.group)}</div>`}connectedCallback(){super.connectedCallback(),_l(this.renderRoot),this.addEventListener("click",this._onClick),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){this.removeEventListener("click",this._onClick),super.disconnectedCallback()}_onClick=t=>{t.composedPath().some(n=>n?.matches?.("a, button, label"))||this.dataset.gid&&this.dispatchEvent(new CustomEvent("row-select",{detail:{gid:this.dataset.gid},bubbles:!0,composed:!0}))}};customElements.define("finding-row",hf);var c0=`:host{display:block;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:6px;overflow:hidden;box-shadow:var(--shadow-glass);margin-bottom:1rem;max-width:1200px}@media not print{finding-row{content-visibility:auto;contain-intrinsic-size:auto 3.2rem}}
145
- `;var gf=class extends Z{static properties={items:{attribute:!1},selectedGid:{attribute:!1}};static styles=B(c0);constructor(){super(),this.items=[],this.selectedGid=null}render(){return c`${X(this.items??[],t=>kn(t),t=>c`<finding-row .group="${t}" ?selected="${kn(t)===this.selectedGid}"></finding-row>`)}`}};customElements.define("finding-table",gf);var d0=`:host{display:block}:host(.hidden){display:none}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:.75}.card{padding:.5rem .75rem;border-bottom:1px solid var(--border);font-size:.875rem}:host(:last-child) .card{border-bottom:none}:host(.mark-red) .card{background:var(--mark-red-bg)}:host(.mark-blue) .card{background:var(--mark-blue-bg)}:host(.mark-green) .card{background:var(--mark-green-bg)}:host(.mark-gray) .card{background:var(--mark-gray-bg)}:host(.has-conflict) .card{outline:2px dashed var(--accent);outline-offset:-2px}:host(.link-target) .card{animation:link-target-flash 1.6s ease-out}@keyframes link-target-flash{0%,30%{box-shadow:inset 0 0 0 2px var(--accent)}to{box-shadow:inset 0 0 0 2px rgb(from var(--accent) r g b / 0)}}@media(prefers-reduced-motion:reduce){:host(.link-target) .card{animation:none;box-shadow:inset 0 0 0 2px var(--accent)}}:host([in-group]) .line-row{display:none}@media not print{:host([in-group]) .line-row+*{margin-top:0}:host([in-group]) .line-row+:is(.conf-reason,.revalidate-verdict,.severity-reason){padding-top:0;border-top:0}}.tabs{display:flex;gap:.25rem;flex-wrap:wrap}.marks-left{display:flex;align-items:center;gap:.5rem;margin-right:auto;flex-wrap:wrap}.commit-ref{color:var(--muted);font-size:.8rem;& a{color:var(--accent);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}& a:hover{text-decoration:underline}& span{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}}.marks-commit-row{margin-top:.4rem;padding-left:4.75rem}.tab-body{display:none;grid-template-columns:auto 1fr;gap:.25rem .75rem;&.active{display:grid}}.tab-body>:not(.finding-left){min-width:0;overflow-wrap:break-word}.desc-title{grid-column:2;font-size:1.08em;font-weight:600;letter-spacing:-.005em;line-height:1.35;color:var(--text)}.desc{grid-column:2;white-space:pre-wrap;font-size:.96em;line-height:1.6;color:rgb(from var(--text) r g b / .82);margin-top:.4rem}.section,.evidence,.recommendation{grid-column:2;margin-top:.55rem;font-size:.92em}.section-label{display:flex;align-items:center;gap:.3rem;color:var(--muted);font-weight:600;font-size:.62rem;text-transform:uppercase;letter-spacing:.06em;&:before{content:"";flex:none;width:2px;height:.58rem;margin-left:calc((2px + .3rem)*-1);border-radius:1px;background:currentcolor;opacity:.75;-webkit-print-color-adjust:exact;print-color-adjust:exact}}.code-preview-btn{display:inline-flex;align-items:center;margin-left:.35rem;padding:0 .15rem;border:0;background:transparent;color:var(--muted);vertical-align:-2px;&.open{color:var(--accent)}}.gh-ref-btn{display:inline-flex;align-items:center;margin-left:.25rem;padding:0 .15rem;color:var(--muted);vertical-align:-2px}:is(.code-preview-btn,.gh-ref-btn){position:relative;&:before{content:"";position:absolute;inset:-.25rem -2px}&:hover{color:var(--accent)}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px;border-radius:2px}}.code-preview-tip{position:absolute;z-index:20;top:100%;left:0;margin-top:.3rem;width:max-content;max-width:min(100%,46rem);visibility:hidden;filter:drop-shadow(0 2px 6px rgb(0 0 0 / .35));background:var(--bg);border-radius:4px;.code-preview{margin:0}}:is(.line-row,.evidence-list li):has(.code-preview-btn:is(:hover,:focus-visible))>.code-preview-tip{visibility:visible}.code-preview{margin:.3rem 0 .1rem;border:1px solid var(--border);border-radius:4px;background:var(--surface);backdrop-filter:var(--glass-blur);max-height:calc(10lh + .7rem);overflow:auto;display:flex;align-items:flex-start;white-space:normal;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.75rem;line-height:1.5}.code-preview-pending{display:block;padding:.35rem .5rem;color:var(--muted);font-style:italic}.code-preview-gutter{flex:none;padding:.35rem .45rem .35rem .5rem;border-right:1px solid var(--border);color:var(--muted);text-align:right;user-select:none;position:sticky;left:0;z-index:1;background-color:var(--bg);background-image:linear-gradient(rgb(from var(--text) r g b / .03),rgb(from var(--text) r g b / .03)),linear-gradient(var(--surface),var(--surface));.code-preview-lineno{width:var(--lineno-width, 3ch);opacity:.7}.cited{opacity:1;color:var(--accent);font-weight:600}}.code-preview-source{margin:0;padding:.35rem .6rem;white-space:pre;color:var(--text);font:inherit;& code{font:inherit}}summary.section-label{cursor:default;list-style:none;&::-webkit-details-marker{display:none}&:after{content:"";flex:none;width:.3rem;height:.3rem;margin-left:.05rem;border-right:1.5px solid currentcolor;border-bottom:1.5px solid currentcolor;transform:translateY(-1px) rotate(-45deg);transition:transform .12s;opacity:.8}}details[open]>summary.section-label:after{transform:translateY(-2px) rotate(45deg)}.evidence-count{font-weight:500;opacity:.8}.section-body{white-space:pre-wrap;line-height:1.55;color:rgb(from var(--text) r g b / .82);margin-top:.1rem}.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)}.recommendation .section-label,.recommendation .section-body{color:var(--green)}.conf-reason,.revalidate-verdict{grid-column:2;white-space:pre-wrap;font-size:.92em;font-style:italic;color:var(--muted);margin-top:.6rem;padding-top:.55rem;border-top:1px dashed var(--border)}.revalidate-stamp{display:inline-block;margin-top:.1rem;font-size:.55rem;font-weight:600;line-height:1;text-transform:uppercase;letter-spacing:.03em;padding:.14rem .3rem;border-radius:3px;background:transparent;color:var(--muted);border:1px solid var(--border);white-space:nowrap;&.confirmed{color:var(--critical);border-color:rgb(from var(--critical) r g b / .55)}&.partial{color:var(--yellow);border-color:rgb(from var(--yellow) r g b / .55)}&.unknown{color:var(--warning);border-color:rgb(from var(--warning) r g b / .55)}}.evidence-list{margin:.25rem 0 0;padding-left:1.6rem;display:flex;flex-direction:column;gap:.15rem;>li{position:relative}& li::marker{color:var(--muted);font-size:.9em}>li.current:before{content:"";position:absolute;left:-1.5rem;top:.58em;width:.35rem;height:.35rem;border-radius:50%;background:var(--accent)}>li.current::marker{color:var(--accent)}& li:has(.evidence-note):not(:last-child){margin-bottom:.3rem}}.evidence-ref{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.92em;overflow-wrap:anywhere;color:var(--accent);text-decoration:none;&:is(a,[role=link]):hover{text-decoration:underline}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px;border-radius:2px}}:is(.line-num a,.evidence-ref,.gh-ref-btn){cursor:default}span.evidence-ref:not([role]){color:var(--muted)}.evidence-note{white-space:pre-wrap;line-height:1.5;color:rgb(from var(--text) r g b / .78);margin-top:.1rem}.desc-title a,.desc a,.section-body a,.conf-reason a,.revalidate-verdict a{color:var(--accent);text-decoration:none;&:hover{text-decoration:underline}}.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)}.code-block{white-space:normal;margin:.5rem 0;border:1px solid var(--border);border-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:.45rem .6rem;overflow-x:auto;white-space:pre;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.85em;line-height:1.5;color:var(--text)}& code{font:inherit}}:is(.code-block,.code-preview){.token.comment,.token.prolog,.token.cdata{color:var(--code-comment);font-style:italic}.token.punctuation{color:var(--muted)}.token.string,.token.attr-value,.token.char,.token.regex{color:var(--code-string)}.token.number,.token.boolean,.token.constant,.token.symbol{color:var(--code-number)}.token.keyword,.token.builtin,.token.important,.token.atrule{color:var(--code-keyword)}.token.function,.token.class-name,.token.tag{color:var(--code-function)}.token.operator,.token.entity,.token.url,.token.attr-name,.token.selector{color:var(--code-operator)}.token.variable,.token.property,.token.parameter{color:var(--code-variable)}.token.deleted{color:var(--code-deleted)}.token.inserted{color:var(--code-inserted)}.token.italic{font-style:italic}.token.bold{font-weight:700}}.line-row{display:flex;justify-content:space-between;align-items:baseline;gap:.5rem;flex-wrap:wrap;position:relative}.run-meta{color:var(--muted);font-size:.65rem}.finding-code-btn{display:inline-block;margin-top:.35rem;padding:.1rem .45rem;background:transparent;border:1px solid var(--border);border-radius:999px;color:var(--muted);font:inherit;font-size:.65rem;font-weight:500;white-space:nowrap}.finding-code-btn:hover{border-color:var(--accent);color:var(--accent)}.marks{display:flex;gap:.35rem;justify-content:flex-end;margin-top:.4rem;align-items:center;position:var(--finding-marks-position, static);bottom:0;background:var(--finding-marks-bg, transparent);padding-bottom:var(--finding-marks-pad-bottom, 0);padding-left:4.75rem;user-select:none}.finding-left{align-self:start;text-align:center;min-width:4rem;padding-top:var(--finding-left-inset, 0);position:var(--finding-left-position, static);top:0;.value-label:last-child{margin-bottom:0}}.conf-score{font-size:.75rem;color:var(--muted);margin-top:.3rem;& strong{color:var(--text);font-size:.85rem}}.conf-ring{--col: var(--muted);position:relative;width:3rem;height:3rem;margin:.7rem auto .15rem;display:flex;align-items:center;justify-content:center;& svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg)}& circle{fill:none;stroke-width:4}.conf-ring-track{stroke:var(--border)}.conf-ring-arc{stroke:var(--col);stroke-linecap:round}& span{position:relative;z-index:1;font-size:.8rem;font-weight:700;color:var(--text);font-variant-numeric:tabular-nums}& small{font-size:.55rem;color:var(--muted);font-weight:500}&.critical{--col: var(--critical)}&.high{--col: var(--high)}&.medium{--col: var(--medium)}&.low{--col: var(--low)}&.high_bug{--col: var(--high-bug)}&.bug{--col: var(--bug)}&.informational{--col: var(--info)}}.value-label{display:block;font-size:.45rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;margin-top:.1rem;margin-bottom:.3rem;font-weight:500}.print-case-label{display:none}.badge,.tabs,.tab,.value-label,.run-meta,.conf-ring{cursor:default;user-select:none}.badge{display:inline-block;font-size:.7rem;font-weight:600;text-transform:uppercase;padding:.15rem .45rem;border-radius:3px;letter-spacing:.03em;line-height:1;&.critical{background:var(--critical);color:#fff}&.high{background:var(--high);color:#fff}&.medium{background:var(--medium);color:#000}&.low{background:var(--low);color:var(--badge-low-text)}&.high_bug{background:var(--high-bug);color:#fff}&.bug{background:var(--bug);color:#fff}&.informational{background:var(--info);color:#fff}}.badge-pair{display:inline-flex;align-items:center;gap:.25rem}.badge-pair-full,.badge-pair-compact{flex-direction:column;gap:.15rem}.badge-orig-wrap{display:inline-flex;align-items:center;gap:.15rem;line-height:1}.badge-arrow,.badge-corr-mark{font-size:.6rem;line-height:1;color:var(--muted)}.badge-arrow.up,.badge-corr-mark.up{color:var(--high)}.badge-pre{font-size:.55rem;text-transform:uppercase;letter-spacing:.03em;color:var(--muted)}.badge-orig{display:inline-block;font-size:.58rem;font-weight:600;text-transform:uppercase;padding:.08rem .3rem;border-radius:3px;letter-spacing:.03em;line-height:1;background:transparent;color:var(--muted);border:1px solid var(--border);&.struck{text-decoration:line-through;text-decoration-thickness:1px}&.critical{border-color:rgb(from var(--critical) r g b / .55)}&.high{border-color:rgb(from var(--high) r g b / .55)}&.medium{border-color:rgb(from var(--medium) r g b / .55)}&.low{border-color:rgb(from var(--low) r g b / .55)}&.high_bug{border-color:rgb(from var(--high-bug) r g b / .55)}&.bug{border-color:rgb(from var(--bug) r g b / .55)}&.informational{border-color:rgb(from var(--info) r g b / .55)}}.badge-varies{font-size:.55rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;padding:.08rem .3rem;border-radius:3px;line-height:1;background:transparent;color:var(--muted);border:1px dashed var(--border)}.severity-reason{margin-top:.4rem;padding-top:.35rem;border-top:1px dashed var(--border);font-size:.82em;font-style:italic;color:var(--muted)}.severity-reason-label{font-style:normal;font-weight:600;text-transform:uppercase;font-size:.85em;letter-spacing:.04em;margin-right:.35rem}.tab{background:transparent;color:var(--text);border:1px solid var(--border);border-radius:4px;padding:.2rem .5rem;font-size:.75rem;line-height:1.3;display:inline-flex;align-items:center;gap:.35rem;font-family:inherit;&:hover{border-color:var(--accent)}&.active{border-color:var(--accent);background:var(--surface-active)}&.tab-mark-red{background:var(--mark-red-bg);border-color:var(--mark-red-tab-border)}&.tab-mark-blue{background:var(--mark-blue-bg);border-color:var(--mark-blue-tab-border)}&.tab-mark-green{background:var(--mark-green-bg);border-color:var(--mark-green-tab-border)}&.tab-mark-gray{background:var(--mark-gray-bg);border-color:var(--mark-gray-tab-border)}&.tab-mark-red.active,&.tab-mark-blue.active,&.tab-mark-green.active,&.tab-mark-gray.active{border-color:var(--text)}&.tab-deleted .tab-label{text-decoration:line-through;opacity:.6}&.tab-inprogress .tab-label:after{content:" \\25d0";opacity:.6}&.tab-fixed .tab-label{opacity:.65}&.tab-fixed .tab-label:after{content:" \\2713";opacity:.6}&.tab-invalid .tab-label{opacity:.65}&.tab-invalid .tab-label:after{content:" \\2298";opacity:.6}&.tab-ignored .tab-label{opacity:.55}&.tab-ignored .tab-label:after{content:" \\1f441";opacity:.6;font-size:.7em}.tab-conf{color:var(--muted);font-size:.7rem}&.tab-mark-red .tab-conf,&.tab-mark-blue .tab-conf,&.tab-mark-green .tab-conf,&.tab-mark-gray .tab-conf{color:var(--text)}.tab-marks{display:inline-flex;align-items:center;gap:.15rem;margin-left:.25rem;vertical-align:middle;color:var(--accent)}.tab-marks svg{display:block}.tab-marks .has-comment .bubble,.tab-marks .has-fix .wrench,.tab-marks .flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}}.report-chip{display:inline-flex;align-items:center;gap:.3rem;padding:0 .35rem;height:1.4rem;border:1px solid var(--border);border-radius:3px;color:var(--muted);font-size:.72rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;margin-right:.65rem;max-width:16rem;min-width:0;.report-chip-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.file-icon{flex-shrink:0}.brand-deepview{.bg{fill:#2563eb}.fg{fill:#fff}}.brand-claude{.bg{fill:#d97757}.fg{fill:#fff}}.brand-codex{.bg{fill:#fff;stroke:#000;stroke-width:.5}.fg{fill:#000}}.brand-vercel{.bg{fill:#000;stroke:#fff;stroke-width:.5}.fg{fill:#fff}}.brand-piolium{.bg{fill:#fbb829}.fg{fill:#1c1b19}}}.mark-action-group{display:inline-flex;border:1px solid var(--border);border-radius:3px;overflow:hidden;margin-right:.25rem;flex-shrink:0}.mark-comment,.mark-fix,.mark-flag,.mark-copy,.mark-link,.mark-issue,.mark-claude{background:transparent;border:0;color:var(--muted);padding:0 .25rem;height:1.4rem;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--accent);background:var(--surface-active)}}.mark-issue{text-decoration:none}.mark-comment.has-comment,.mark-fix.has-fix,.mark-flag.flagged{color:var(--accent)}.mark-flag svg{display:block}.mark-copy.copied,.mark-link.copied,.mark-claude.copied{color:var(--green, #4ade80);background:color-mix(in srgb,var(--green, #4ade80) 14%,transparent)}.mark-comment.has-comment .bubble,.mark-fix.has-fix .wrench,.mark-flag.flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}.mark-x{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .35rem;font-size:.85rem;line-height:1.1;margin-left:.25rem;&:hover{color:var(--critical);border-color:var(--critical)}}.triage-menu-wrap{position:relative;display:inline-flex;margin-left:.25rem;flex-shrink:0}.mark-triage-menu{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .3rem;height:1.5rem;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;font:inherit}.mark-triage-menu:hover{color:var(--text);border-color:var(--accent)}.mark-triage-menu.open{border-color:var(--accent);color:var(--text)}.mark-triage-menu.with-label{padding:0 .35rem 0 .5rem;font-size:.72rem;height:1.5rem}.mark-triage-menu .mark-triage-label{text-transform:uppercase;letter-spacing:.05em;font-weight:600}.mark-triage-menu.triage-state-deleted{border-color:var(--critical);color:var(--critical)}.mark-triage-menu.triage-state-fixed{border-color:var(--green, #4ade80);color:var(--green, #4ade80)}.mark-triage-menu.triage-state-inprogress{border-color:var(--warning, #d97706);color:var(--warning, #d97706)}.mark-triage-menu.triage-state-invalid{border-color:var(--muted);color:var(--text)}.mark-triage-menu.triage-state-ignored{border-color:var(--accent, #2563eb);color:var(--accent, #2563eb)}.triage-menu[popover]{position:fixed;inset:auto;margin:0;min-width:7rem;background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:.25rem;box-shadow:0 4px 12px #00000040;display:flex;flex-direction:column;gap:1px;-webkit-app-region:no-drag;app-region:no-drag}.triage-menu[popover]:not(:popover-open){display:none}.triage-menu[popover]:popover-open{display:flex}.triage-menu-item{background:transparent;border:0;padding:.35rem .5rem;font-size:.78rem;color:var(--text);text-align:left;border-radius:3px;font-family:inherit}.triage-menu-item:hover{background:var(--surface)}.triage-menu-item.active:before{content:"\\2713 ";color:var(--accent)}.triage-menu-inprogress:hover{color:var(--warning, #d97706)}.triage-menu-fixed:hover{color:var(--green, #4ade80)}.triage-menu-invalid:hover{color:var(--muted)}.triage-menu-deleted:hover{color:var(--critical)}:host([context="focus"]) .triage-menu-wrap>.mark-triage-menu{display:none}:host([context="focus"]) .triage-menu-wrap{display:inline-flex}:host([context="focus"]) .triage-menu[popover]{position:static;inset:auto;display:inline-flex!important;flex-flow:row wrap;margin:0;padding:0;background:transparent;border:0;border-radius:0;box-shadow:none;min-width:0;gap:.25rem}:host([context="focus"]) .triage-menu-item{background:transparent;border:1px solid var(--border);padding:.2rem .5rem;border-radius:3px;font-size:.72rem;font-weight:500;text-transform:uppercase;letter-spacing:.04em}:host([context="focus"]) .triage-menu-item.active{background:rgb(from var(--accent) r g b / .12);border-color:var(--accent);color:var(--accent)}:host([context="focus"]) .triage-menu-item:hover{background:var(--surface-active)}:host([context="focus"]) .triage-menu-inprogress.active{background:rgb(from var(--warning, #d97706) r g b / .12);border-color:var(--warning, #d97706);color:var(--warning, #d97706)}:host([context="focus"]) .triage-menu-fixed.active{background:rgb(from var(--green, #4ade80) r g b / .12);border-color:var(--green, #4ade80);color:var(--green, #4ade80)}:host([context="focus"]) .triage-menu-deleted.active{background:rgb(from var(--critical) r g b / .12);border-color:var(--critical);color:var(--critical)}:host([context="focus"]) .triage-menu-item.active:before{content:"";margin:0}:host([context="focus"]) .marks{gap:.5rem;margin-top:.65rem;padding-left:0;padding-top:.55rem;border-top:1px solid var(--border);flex-wrap:wrap}:host([context="focus"]) .marks-commit-row{padding-left:0}:host([context="focus"]) .mark-comment,:host([context="focus"]) .mark-fix,:host([context="focus"]) .mark-flag,:host([context="focus"]) .mark-copy,:host([context="focus"]) .mark-link,:host([context="focus"]) .mark-issue,:host([context="focus"]) .mark-claude{height:1.75rem;padding:0 .55rem;gap:.35rem;display:inline-flex;align-items:center;font-size:.72rem}:host([context="focus"]) .mark-btn-label{color:inherit;font-weight:500;letter-spacing:.02em}:host([context="focus"].mark-red) .card{background:color-mix(in srgb,var(--mark-red-bg) 15%,var(--bg))}:host([context="focus"].mark-blue) .card{background:color-mix(in srgb,var(--mark-blue-bg) 15%,var(--bg))}:host([context="focus"].mark-green) .card{background:color-mix(in srgb,var(--mark-green-bg) 15%,var(--bg))}:host([context="focus"].mark-gray) .card{background:color-mix(in srgb,var(--mark-gray-bg) 15%,var(--bg))}.comment-block,.fix-block{margin-top:.5rem;padding:.35rem .55rem;border-left:3px solid var(--accent);background:rgb(from var(--accent) r g b / .08);border-radius:0 4px 4px 0;font-size:.82rem;color:var(--text)}.comment-block{white-space:pre-wrap;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}& a.comment-self-ref{text-decoration:underline dotted;text-underline-offset:2px}& a.comment-self-ref:hover{text-decoration:underline solid}}.fix-block{word-break:break-all;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}}.comment-label,.fix-label{color:var(--muted);font-weight:600;margin-right:.35rem}.mark-restore{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .45rem;font-size:.75rem;line-height:1.3;margin-left:.25rem;&:hover{color:var(--green);border-color:var(--green)}}.line-num{color:var(--muted);font-size:.8rem}.line-num a{color:inherit;text-decoration:none}.line-num a:hover{color:var(--accent)}.npm-link{display:inline-block;padding:0 .4rem;border:1px solid var(--border);border-radius:3px;font-size:.72rem;font-weight:500;color:var(--muted);text-decoration:none}.npm-link:hover{border-color:var(--accent);color:var(--accent)}@media print{.card{break-inside:avoid;padding:.45rem .25rem}.finding-code-btn,.mark-copy,.mark-link,.mark-issue,.mark-claude{display:none!important}.npm-link{border:0;padding:0}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:1}:host(.link-target) .card{animation:none;box-shadow:none!important}:host(.multi-case) .card:before{content:"Multiple reports of one finding";display:block;font-size:.7rem;font-weight:700;color:#555;text-transform:uppercase;letter-spacing:.06em;border-bottom:1px solid #bbb;padding-bottom:.2rem;margin-bottom:.35rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}.marks,.tabs{display:none!important}.tab-body{display:grid!important}.tab-body+.tab-body{margin-top:.5rem;padding-top:.5rem;border-top:1px dashed #999}:host([in-group].multi-case) .tab-body .line-row{display:flex}:host([in-group]:not(.multi-case)) .line-row+*{margin-top:0}:host([in-group]:not(.multi-case)) .line-row+.conf-reason{padding-top:0;border-top:0}.line-row .discovered-in{flex-basis:100%;order:99}.print-case-label{display:block;grid-column:1 / -1;font-size:.65rem;font-weight:600;color:#555;background:#eee;padding:.1rem .35rem;border-radius:3px;margin-bottom:.25rem;letter-spacing:.04em;-webkit-print-color-adjust:exact;print-color-adjust:exact}.value-label{color:#777}.badge{-webkit-print-color-adjust:exact;print-color-adjust:exact;&.critical{background:#a30b0f!important;color:#fff!important}&.high{background:#b8400a!important;color:#fff!important}&.medium{background:#855107!important;color:#fff!important}&.low{background:#374151!important;color:#fff!important}&.high_bug{background:#7a3e0c!important;color:#fff!important}&.bug{background:#4d4538!important;color:#fff!important}&.informational{background:#0550ae!important;color:#fff!important}}.badge-orig{background:transparent!important;color:#555!important;border-color:#999!important}.badge-varies,.revalidate-stamp{color:#555!important;border-color:#999!important}.badge-arrow,.badge-corr-mark,.badge-pre,.severity-reason{color:#555!important}a,.line-num,.line-num a,.desc-title a,.desc a,.section-body a,.conf-reason a,.revalidate-verdict a,.evidence-ref{color:inherit}details:not([open])>:not(summary){display:block}details::details-content{content-visibility:visible}summary.section-label{cursor:auto;&:after{display:none}}.code-preview-btn,.gh-ref-btn{display:none}.inline-code{border:0;background:transparent}.code-block{background:transparent;border-color:#bbb;.code-block-lang{color:#555;border-bottom-color:#bbb}& pre{white-space:pre-wrap;overflow:visible}.token{color:#333!important}.token.comment,.token.prolog,.token.cdata{color:#666!important}}}
146
- `;var B2=["finding","is-critical","mark-red","mark-blue","mark-green","mark-gray","has-conflict","triage-inprogress","triage-fixed","triage-invalid","triage-deleted","triage-ignored","multi-case"],mf=class extends N{static properties={group:{attribute:!1},inGroup:{type:Boolean,attribute:"in-group",reflect:!0},context:{type:String,reflect:!0}};static styles=B(d0);constructor(){super(),this.group=null,this.inGroup=!1,this.context=null}render(){if(!this.group)return c``;this.dataset.gid=yo(this.group);let t=new Set(yv(this.group));for(let r of B2)this.classList.toggle(r,t.has(r));return c`<div class="card">${vv(this.group,{context:this.context})}</div>`}updated(){for(let t of this.renderRoot.querySelectorAll(".code-preview")){let r=t.dataset.revealedTo;if(r!==void 0&&Math.round(t.scrollTop)!==Number(r))continue;let n=t.querySelectorAll(".code-preview-lineno.cited");n.length!==0&&(yl(t,n),t.dataset.revealedTo=String(Math.round(t.scrollTop)))}}connectedCallback(){super.connectedCallback(),_l(this.renderRoot),this.hasUpdated&&this.requestUpdate()}};customElements.define("finding-card",mf);var u0=`:host{display:inline-flex;gap:4px;align-items:center;flex-shrink:0}button{width:14px;height:14px;user-select:none;padding:0;background:transparent;border:1.5px solid currentcolor;border-radius:50%;opacity:.55;transition:opacity .12s,transform .12s}button:hover{opacity:1;transform:scale(1.12)}button.active{background:currentcolor;opacity:1;box-shadow:0 0 0 2px var(--surface),0 0 0 3px currentcolor}.color-red{color:var(--marker-red)}.color-blue{color:var(--marker-blue)}.color-green{color:var(--marker-green)}.color-gray{color:var(--marker-gray)}
147
- `;var P2=["red","blue","green","gray"],bf=class extends Z{static properties={selected:{type:String}};static styles=B(u0);constructor(){super(),this.selected=null}render(){return c`${P2.map(t=>c`<button type="button" class="${`color-${t}${this.selected===t?" active":""}`}" data-color="${t}" title="${`mark ${t}`}" @click="${this._onClick}"></button>`)}`}_onClick=t=>{let r=t.currentTarget.dataset.color;this.dispatchEvent(new CustomEvent("mark-color",{detail:{color:r},bubbles:!0,composed:!0}))}};customElements.define("color-marker",bf);var yf=class extends N{static properties={rangeDisabled:{type:Boolean,attribute:"range-disabled"},revalidateOptions:{attribute:!1},hasPartial:{type:Boolean,attribute:"has-partial"}};createRenderRoot(){return this}constructor(){super(),this.rangeDisabled=!1,this.revalidateOptions=[],this.hasPartial=!1}render(){let t=a.filterConfMin,r=a.filterConfMax,n=this.revalidateOptions??[],o=this.rangeDisabled,i=n.length>0&&!!a.filterRevalidate,s=o?"No confidence range: some findings on screen carry no confidence score":g;return c`<span class="${T({"conf-range-label":!0,replaced:i,disabled:o})}">Confidence</span> <span class="${T({"conf-range":!0,replaced:i,disabled:o})}" title="${s}" ?inert="${o||i}"><range-slider id="conf-range" min="0" max="10" step="1" low="${t}" high="${r}" aria-label="Confidence range"></range-slider><conf-range-mirror id="conf-range-vals" class="conf-vals" for="conf-range" .low="${t}" .high="${r}"></conf-range-mirror></span>${n.length>0?c`<revalidate-filter class="${T({replaces:i})}" .options="${n}" ?has-partial="${this.hasPartial}"></revalidate-filter>`:g}`}};customElements.define("conf-filter",yf);var Ee=At(class extends ct{constructor(e){if(super(e),e.type!==je.PROPERTY&&e.type!==je.ATTRIBUTE&&e.type!==je.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!kh(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===xe||t===g)return t;let r=e.element,n=e.name;if(e.type===je.PROPERTY){if(t===r[n])return xe}else if(e.type===je.BOOLEAN_ATTRIBUTE){if(!!t===r.hasAttribute(n))return xe}else if(e.type===je.ATTRIBUTE&&r.getAttribute(n)===t+"")return xe;return _s(e),t}});var p0={files:"Filter files\u2026",code:"Search code\u2026",issues:"Search issues\u2026"},f0={files:"Filter files",code:"Search code",issues:"Search issues"},O2=c`<svg class="bundle-code-search-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg>`,N2={files:c`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 4.5a1 1 0 0 1 1-1h3.2l1.3 1.5H13a1 1 0 0 1 1 1V12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4.5Z"/></svg>`,code:c`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5.5 4.5L2 8l3.5 3.5"/><path d="M10.5 4.5L14 8l-3.5 3.5"/></svg>`,issues:c`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.3" aria-hidden="true"><circle cx="8" cy="8" r="6"/><path d="M8 4.8v3.6" stroke-linecap="round"/><circle cx="8" cy="11" r=".7" fill="currentColor" stroke="none"/></svg>`},vf=class extends N{static properties={modes:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.modes=[]}render(){let t=a.bundleCodeSearchQuery,r=a.bundleCodeSearchMode,n=this.modes.includes(r)?r:"files",o=p0[n]??p0.files;return c`${O2} <input type="text" class="bundle-code-search-input" placeholder="${o}" aria-label="${o}" .value="${Ee(t)}" @input="${this._onInput}"> ${t?c`<button type="button" class="bundle-code-search-clear" title="Clear search" aria-label="Clear search" @click="${this._onClear}">×</button>`:g} ${this.modes.length>0?c`<span class="bundle-code-search-modes" role="tablist">${this.modes.map(i=>c`<button type="button" class="${T({"bundle-code-search-mode":!0,active:n===i})}" role="tab" aria-selected="${String(n===i)}" title="${f0[i]??i}" aria-label="${f0[i]??i}" @click="${()=>this._selectMode(i)}">${N2[i]??g}</button>`)}</span>`:g}`}_onInput=t=>{this._dispatchInput(t.target.value)};_onClear=()=>{this._dispatchInput("")};_dispatchInput(t){this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:"bundle-code",value:t},bubbles:!0,composed:!0}))}_selectMode(t){this.dispatchEvent(new CustomEvent("bundle-search-mode-change",{detail:{mode:t},bubbles:!0,composed:!0}))}};customElements.define("bundle-code-search",vf);var D2=c`<svg class="bundle-search-icon" viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg>`,wf=class extends N{createRenderRoot(){return this}render(){let t=a.bundleSearchQuery,r=a.bundleSearchRegex,n=a.bundleSearchCase,o=r?"Search by regular expression\u2026":"Search all source\u2026";return c`${D2} <input type="text" class="bundle-search-input" placeholder="${o}" aria-label="${o}" spellcheck="false" autocapitalize="off" autocomplete="off" .value="${Ee(t)}" @input="${this._onInput}"> ${t?c`<button type="button" class="bundle-search-clear" title="Clear search" aria-label="Clear search" @click="${this._onClear}">×</button>`:g} <span class="bundle-search-mods"><button type="button" class="${T({"bundle-search-mod":!0,active:n})}" title="${n?"Case-sensitive on \u2014 click to ignore case":"Match case"}" aria-label="Match case" aria-pressed="${String(n)}" @click="${this._onToggleCase}">Aa</button> <button type="button" class="${T({"bundle-search-mod":!0,active:r})}" title="${r?"Regular expression on \u2014 click for plain text":"Match by regular expression"}" aria-label="Match by regular expression" aria-pressed="${String(r)}" @click="${this._onToggleRegex}">.*</button></span>`}_onInput=t=>{this._dispatchInput(t.target.value)};_onClear=()=>{this._dispatchInput("")};_dispatchInput(t){this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:"bundle-search",value:t},bubbles:!0,composed:!0}))}_onToggleRegex=()=>{this.dispatchEvent(new CustomEvent("bundle-search-regex-toggle",{bubbles:!0,composed:!0}))};_onToggleCase=()=>{this.dispatchEvent(new CustomEvent("bundle-search-case-toggle",{bubbles:!0,composed:!0}))}};customElements.define("bundle-search",wf);var h0={packages:{stateKey:"packagesSearchQuery",label:"Filter packages"},repositories:{stateKey:"repositoriesSearchQuery",label:"Filter repositories"}},kf=class extends N{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=h0[this.kind];return t?c`<input type="search" class="packages-search" placeholder="${`${t.label}\u2026`}" aria-label="${t.label}" .value="${Ee(a[t.stateKey])}" @input="${this._onInput}">`:(console.warn(`<entity-search>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(h0).map(r=>JSON.stringify(r)).join(", ")}.`),g)}_onInput=t=>{this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:this.kind,value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-search",kf);var z2=[["findings-desc","Findings \u2193"],["files-desc","Files \u2193"],["reports-desc","Reports \u2193"],["name-asc","Name A\u2192Z"]],g0={packages:{stateKey:"packagesSortBy",aria:"Sort packages"},repositories:{stateKey:"repositoriesSortBy",aria:"Sort repositories"}},$f=class extends N{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=g0[this.kind];return t?c`<select class="packages-sort" aria-label="${t.aria}" .value="${Ee(a[t.stateKey])}" @change="${this._onChange}">${z2.map(([r,n])=>c`<option value="${r}" ?selected="${a[t.stateKey]===r}">${n}</option>`)}</select>`:(console.warn(`<entity-sort>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(g0).map(r=>JSON.stringify(r)).join(", ")}.`),g)}_onChange=t=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:this.kind,value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-sort",$f);var xf=class extends N{static properties={showFile:{type:Boolean,attribute:"show-file"},showConfidence:{type:Boolean,attribute:"show-confidence"},showPriority:{type:Boolean,attribute:"show-priority"}};createRenderRoot(){return this}constructor(){super(),this.showFile=!1,this.showConfidence=!1,this.showPriority=!1}render(){let t=(r,n)=>c`<option value="${r}" ?selected="${a.sortBy===r}">${n}</option>`;return c`<select class="sort-select" aria-label="Sort findings" .value="${Ee(a.sortBy)}" @change="${this._onChange}">${t("severity","Severity \u2193")} ${this.showFile?t("file","File \u2191"):g} ${this.showConfidence?c`${t("confidence-desc","Confidence \u2193")}${t("confidence-asc","Confidence \u2191")}`:g} ${this.showPriority?c`${t("priority-desc","Priority \u2193")}${t("priority-asc","Priority \u2191")}`:g}</select>`}_onChange=t=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:"findings",value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("findings-sort",xf);var m0=`:host{display:inline-flex;align-items:center;width:8.5rem;height:16px;--rs-thumb-size: 14px;--rs-track-height: 3px;--rs-rail: rgb(from currentcolor r g b / .25);--rs-fill: var(--accent, currentColor)}.track-wrap{position:relative;flex:1;height:var(--rs-thumb-size)}.track{position:absolute;left:0;right:0;top:50%;height:var(--rs-track-height);transform:translateY(-50%);border-radius:99px;background:linear-gradient(to right,var(--rs-rail) 0,var(--rs-rail) var(--low, 0%),var(--rs-fill) var(--low, 0%),var(--rs-fill) var(--high, 100%),var(--rs-rail) var(--high, 100%))}input[type=range]{appearance:none;-webkit-appearance:none;position:absolute;left:0;right:0;top:0;width:100%;height:var(--rs-thumb-size);background:transparent;pointer-events:none;margin:0;padding:0;outline:none}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;pointer-events:auto;width:var(--rs-thumb-size);height:var(--rs-thumb-size);border-radius:50%;background:var(--rs-fill);border:0;box-shadow:0 1px 3px #00000080}input[type=range]::-moz-range-thumb{pointer-events:auto;width:var(--rs-thumb-size);height:var(--rs-thumb-size);border-radius:50%;background:var(--rs-fill);border:0;box-shadow:0 1px 3px #00000080}input[type=range]::-webkit-slider-runnable-track{background:transparent;height:var(--rs-thumb-size)}
148
- `;var Sf=class extends Z{static properties={min:{type:Number},max:{type:Number},step:{type:Number},low:{type:Number},high:{type:Number}};static styles=B(m0);constructor(){super(),this.min=0,this.max=100,this.step=1,this.low=0,this.high=100}willUpdate(){this.low<this.min&&(this.low=this.min),this.high>this.max&&(this.high=this.max),this.low>this.high&&(this.low=this.high)}render(){let t=this.max-this.min||1,r=(this.low-this.min)/t*100,n=(this.high-this.min)/t*100;return c`<div class="track-wrap" style="${`--low:${r}%;--high:${n}%`}"><div class="track"></div><input type="range" min="${this.min}" max="${this.max}" step="${this.step}" @input="${this._onInput}" @change="${this._onChange}"> <input type="range" min="${this.min}" max="${this.max}" step="${this.step}" @input="${this._onInput}" @change="${this._onChange}"></div>`}firstUpdated(){this._inputs=[...this.renderRoot.querySelectorAll('input[type="range"]')],this._inputs[0].value=this.low,this._inputs[1].value=this.high}updated(t){if(!this._inputs||!(t.has("low")||t.has("high")))return;let r=this._inputs.map(s=>Number(s.value)),n=r[0]>r[1],o=n?1:0,i=n?0:1;this.low!==r[o]&&(this._inputs[o].value=this.low),this.high!==r[i]&&(this._inputs[i].value=this.high)}_onInput=()=>{let t=Number(this._inputs[0].value),r=Number(this._inputs[1].value);this.low=Math.min(t,r),this.high=Math.max(t,r),this._emit("range-input")};_onChange=()=>{this._emit("range-change")};_emit(t){this.dispatchEvent(new CustomEvent(t,{detail:{low:this.low,high:this.high},bubbles:!0,composed:!0}))}};customElements.define("range-slider",Sf);var _f=class extends Z{static properties={low:{type:Number},high:{type:Number},for:{type:String}};createRenderRoot(){return this}constructor(){super(),this.low=0,this.high=10,this.for="conf-range",this._dragging=!1,this._liveLow=0,this._liveHigh=10}connectedCallback(){super.connectedCallback(),document.addEventListener("range-input",this._onRangeInput),document.addEventListener("range-change",this._onRangeChange)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("range-input",this._onRangeInput),document.removeEventListener("range-change",this._onRangeChange)}willUpdate(t){this._dragging&&(t.has("low")&&this.low!==this._liveLow&&(this.low=this._liveLow),t.has("high")&&this.high!==this._liveHigh&&(this.high=this._liveHigh))}_onRangeInput=t=>{t.target?.id===this.for&&(this._dragging=!0,this._liveLow=t.detail.low,this._liveHigh=t.detail.high,this.low=t.detail.low,this.high=t.detail.high)};_onRangeChange=t=>{t.target?.id===this.for&&(this._dragging=!1)};render(){return c`<span>${this.low}</span><span class="dash">–</span><span>${this.high}</span>`}};customElements.define("conf-range-mirror",_f);var b0=`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{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.35rem .9rem;font:inherit;font-size:.8rem;&:hover{border-color:var(--accent);color:var(--accent)}&.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{margin:.5rem 0;padding:.4rem .6rem;border:1px solid var(--critical, #f87171);border-radius:5px;background:rgb(from var(--critical, #f87171) r g b / .07);color:var(--text);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: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)}&.status-err{border:1px solid var(--critical, #f87171);background:rgb(from var(--critical, #f87171) r g b / .07);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{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.3rem .8rem;font:inherit;font-size:.78rem;&:hover{border-color:var(--accent);color:var(--accent)}}
149
- `;var Cf=class extends I{static styles=[...I.styles,B(b0)];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:t,filename:r}=await Wd();qt(t,r),this.status={kind:"ok",text:`Downloaded ${r}`}}catch(t){this.status={kind:"err",text:`Export failed: ${t.message}`}}finally{this.busy=!1}}async _onFile(t){let r=t.target.files?.[0];if(this.parsed=null,this.parseError=null,this.status=null,!!r)try{this.parsed=await Kd(r)}catch(n){this.parseError=n.message}}_onMode(t){this.mode=t.target.value}async _onApply(){if(!(!this.parsed||this.busy)){this.busy=!0,this.status=null;try{let t=await Gd(this.parsed,this.mode);x(),this.status=t.repoUrlError?{kind:"err",text:`Applied ${t.triageEntries} triage entries (${this.mode}), but saving repo URLs failed: ${t.repoUrlError.message}`}:{kind:"ok",text:`Applied ${t.triageEntries} triage entries and ${t.repoUrls} repo URLs (${this.mode}).`},this.parsed=null;let r=this.renderRoot.querySelector('input[type="file"]');r&&(r.value="")}catch(t){this.status={kind:"err",text:`Import failed: ${t.message}`}}finally{this.busy=!1}}}render(){let t=this.parsed;return c`<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\u2026":"Download backup"}</button></section><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?c`<div class="error">Failed to parse: ${this.parseError}</div>`:g} ${t?c`<div class="summary">Found <strong>${Object.keys(t.triage).length}</strong> triage entries and <strong>${Object.keys(t.repoUrls).length}</strong> repo URLs. ${t.exportedAt?c`<span class="meta">Exported ${t.exportedAt}.</span>`:g}</div><fieldset class="mode"><legend>Merge mode</legend><label><input type="radio" name="te-mode" value="prefer-current" .checked="${this.mode==="prefer-current"}" @change="${this._onMode}"> <span>Merge — keep current on conflict <em>(safest, only fills gaps)</em></span></label> <label><input type="radio" name="te-mode" value="prefer-imported" .checked="${this.mode==="prefer-imported"}" @change="${this._onMode}"> <span>Merge — prefer imported on conflict <em>(overwrites where both have a value)</em></span></label> <label><input type="radio" name="te-mode" value="replace" .checked="${this.mode==="replace"}" @change="${this._onMode}"> <span>Replace all <em>(drops every current persisted entry first — destructive)</em></span></label></fieldset><button type="button" class="primary" @click="${this._onApply}" ?disabled="${this.busy}">${this.busy?"Applying\u2026":"Apply import"}</button>`:g}</section>${this.status?c`<div class="${`status status-${this.status.kind}`}">${this.status.text}</div>`:g}<footer class="actions"><button type="button" @click="${this._onClose}">Close</button></footer></dialog>`}};customElements.define("triage-export-dialog",Cf);function y0(){return ee("triage-export-dialog")}var v0=`:host{display:inline-block;vertical-align:middle;position:relative}.chip{display:inline-flex;align-items:center;gap:.375rem;cursor:default;user-select:none;position:relative;min-height:24px;box-sizing:border-box;padding:.125rem .375rem .125rem .5rem;background:var(--surface);border:1px solid var(--border);border-radius:999px;color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;font-weight:500}.chip svg{color:var(--muted);flex-shrink:0}.chip.empty:hover{border-color:var(--accent)}.chip.empty .label{color:var(--muted);font-style:italic}.chip.readonly{padding-right:.5rem}.chip.copied:after{content:"Copied";position:absolute;inset:0;display:grid;place-items:center;background:var(--surface);backdrop-filter:var(--glass-blur);border-radius:999px;color:var(--text);font-weight:400;white-space:nowrap;pointer-events:none}.edit-btn{width:18px;height:18px;display:grid;place-items:center;padding:0;margin-left:.125rem;background:transparent;border:0;border-radius:4px;color:var(--muted)}.edit-btn:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}.chip[inert]{visibility:hidden;min-width:19rem}input{position:absolute;inset:0;box-sizing:border-box;padding:0 .55rem;background:var(--surface);border:1px solid var(--accent);border-radius:999px;color:var(--text);font:inherit;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;font-weight:400;outline:none}@media print{.chip{color:#000!important;border:0!important}.chip svg{color:#000!important}.edit-btn,input{display:none!important}}
150
- `;function zl(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}var Ef=c`<svg viewBox="0 0 16 16" width="12" height="12" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>`,w0=c`<svg viewBox="0 0 16 16" width="11" height="11" fill="currentColor" aria-hidden="true"><path d="M11.013 1.427a1.75 1.75 0 0 1 2.474 0l1.086 1.086a1.75 1.75 0 0 1 0 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 0 1-.927-.928l.929-3.25c.082-.286.235-.547.445-.758l8.61-8.61z"/></svg>`,Af=class extends Z{static properties={url:{type:String},editable:{type:Boolean,reflect:!0},editing:{type:Boolean,reflect:!0},_copied:{state:!0}};static styles=B(v0);constructor(){super(),this.url="",this.editable=!1,this.editing=!1,this._copied=!1,this._opener=""}render(){if(this.editable&&this.editing){let t=!!this.url,r=t?zl(this.url):"Set repo";return c`<span class="${t?"chip":"chip empty"}" aria-hidden="true" inert>${Ef} <span class="label">${r}</span> <button type="button" class="edit-btn">${w0}</button> </span><input type="text" .value="${Ee(this.url)}" placeholder="user/repo or https://github.com/user/repo" @input="${this._onInput}" @focus="${this._onFocus}" @keydown="${this._onKeydown}" @blur="${this._onBlur}">`}if(this.editable){let t=!!this.url,r=t?zl(this.url):"Set repo",n=t?this._copied?"chip copied":"chip":"chip empty";return c`<span class="${n}" @click="${t?null:this._onEdit}">${Ef} ${t?this._slugLabel(r):c`<span class="label">${r}</span>`} <button type="button" class="edit-btn" title="Edit repo URL" aria-label="Edit repo URL" @click="${this._onEdit}">${w0}</button></span>`}if(this.url){let t=this._copied?"chip readonly copied":"chip readonly";return c`<span class="${t}" title="Repo from findings (read-only)">${Ef} ${this._slugLabel(zl(this.url))}</span>`}return g}_slugLabel(t){return c`<span class="label" title="Copy repo name" @click="${this._onCopyLabel}">${t}</span>`}updated(t){if(t.has("editing")&&this.editing){let r=this.renderRoot.querySelector("input");r&&(r.focus(),r.select())}}_onEdit=t=>{t&&t.stopPropagation(),this._emit("repo-edit-start")};_onCopyLabel=t=>{t&&t.stopPropagation();let r=zl(this.url);if(r)try{navigator.clipboard.writeText(r).then(()=>(this._copied=!0,setTimeout(()=>{this._copied=!1},1e3),null)).catch(()=>{})}catch{}};_onFocus=t=>{this._opener=t.target.value};_onInput=t=>{this.url=t.target.value,this._emit("repo-input",{url:this.url})};_onKeydown=t=>{t.key==="Enter"?(t.preventDefault(),this._emit("repo-commit",{url:this.url})):t.key==="Escape"&&(t.preventDefault(),this.url=this._opener,this._emit("repo-cancel",{url:this._opener}))};_onBlur=()=>{this.editing&&this._emit("repo-commit",{url:this.url})};_emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}};customElements.define("repo-chip",Af);function Le(e,t){for(let[r,n]of Object.entries(t))e.hasAttribute(r)||e.setAttribute(r,n)}var j2=c`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="bubble" d="M2.5 3h11a.5.5 0 0 1 .5.5v6.5a.5.5 0 0 1-.5.5H8.4l-3 2.6V10.5H2.5a.5.5 0 0 1-.5-.5V3.5a.5.5 0 0 1 .5-.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,W2=c`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="wrench" d="M10.4 2.6a3 3 0 0 0-3.6 4.5L2 12l2 2 4.9-4.8a3 3 0 0 0 4.5-3.6l-1.8 1.8-1.5-.4-.4-1.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,K2=c`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="flag-cloth" d="M5 1.5h6v13l-3-2.7-3 2.7z" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/></svg>`,G2=[{key:"comment",glyph:j2,label:"commented",stateKey:"filterComment",hasKey:"hasComment"},{key:"fix",glyph:W2,label:"fixed",stateKey:"filterFix",hasKey:"hasFix"},{key:"flag",glyph:K2,label:"flagged",stateKey:"filterFlagged",hasKey:"hasFlagged"}],Tf=class extends N{static properties={hasComment:{attribute:!1},hasFix:{attribute:!1},hasFlagged:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.hasComment=!1,this.hasFix=!1,this.hasFlagged=!1}connectedCallback(){super.connectedCallback(),Le(this,{role:"group","aria-label":"Annotation filter"})}render(){let t=G2.filter(r=>this[r.hasKey]||a[r.stateKey]);return t.length===0?g:c`${t.map(r=>{let n=a[r.stateKey],o=n==="with"?`Showing only ${r.label} findings \u2014 click to exclude them`:n==="without"?`Excluding ${r.label} findings \u2014 click to clear`:`Show only ${r.label} findings`;return c`<button type="button" class="${T({"annotation-chip":!0,"sel-with":n==="with","sel-without":n==="without"})}" title="${o}" aria-label="${o}" aria-pressed="${String(n!=="")}" @click="${()=>this._toggle(r.key)}">${r.glyph}</button>`})}`}_toggle(t){this.dispatchEvent(new CustomEvent("annotation-filter-toggle",{detail:{key:t},bubbles:!0,composed:!0}))}};customElements.define("annotation-filter",Tf);var q2=[["critical","Critical"],["high","High"],["medium","Medium"],["low","Low"],["high_bug","High bug"],["bug","Bug"],["informational","Info"]],Rf=class extends N{static properties={counts:{attribute:!1},selected:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.selected=[],this.kind="findings"}connectedCallback(){super.connectedCallback(),Le(this,{role:"group","aria-label":"Filter by severity"})}render(){let t=this.kind==="graph"?new Set(this.selected):a.filterSeverities,r=q2.filter(([n])=>(this.counts[n]??0)||t.has(n));return r.length===0?g:c`${r.map(([n,o])=>{let i=this.counts[n]??0,s=t.has(n);return c`<button type="button" class="${T({"sev-chip":!0,[n]:!0,active:s})}" aria-pressed="${String(s)}" @click="${()=>this._toggle(n)}"><span class="sd"></span><span class="name">${o}</span><span class="n">${i}</span></button>`})}`}_toggle(t){this.dispatchEvent(new CustomEvent("severity-toggle",{detail:{severity:t,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("severity-chips",Rf);var Y2=[["corrected","Corrected","Show corrected severities (application-specific re-ratings)"],["original","Original","Show the original analyzer severities"]],If=class extends N{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Le(this,{role:"group","aria-label":"Severity display mode"})}render(){let t=a.severityMode;return c`<span class="severity-mode-label">Severity</span><span class="severity-mode-chips">${Y2.map(([r,n,o])=>{let i=t===r;return c`<button type="button" class="${T({"severity-mode-chip":!0,active:i})}" aria-pressed="${String(i)}" title="${o}" @click="${()=>this._select(r)}">${n}</button>`})}</span>`}_select(t){t!==a.severityMode&&this.dispatchEvent(new CustomEvent("severity-mode-change",{detail:{mode:t},bubbles:!0,composed:!0}))}};customElements.define("severity-mode-switch",If);var Mf=class extends N{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Le(this,{role:"group","aria-label":"Revalidation layer"})}render(){let t=a.showRevalidation!==!1;return c`<button type="button" class="${T({"revalidation-toggle":!0,on:t})}" aria-pressed="${String(t)}" aria-label="App view — hide the issues the revalidation pass ruled out" @click="${this._toggle}"><span>App</span><span class="revalidation-switch"></span></button>`}_toggle=()=>{this.dispatchEvent(new CustomEvent("revalidation-change",{detail:{on:a.showRevalidation===!1},bubbles:!0,composed:!0}))}};customElements.define("revalidation-switch",Mf);var X2=c`<svg class="trash-icon" viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 4h10M6.5 4V2.5h3V4M5 4l.7 9h4.6L11 4"/></svg>`,Ff=class extends N{createRenderRoot(){return this}render(){let t=a.currentView==="bundles"&&a.selectedBundle,r=!a.currentFile&&!t;return c`<button type="button" class="danger" ?disabled="${r}">${X2}<span>Delete current</span></button>`}};customElements.define("sidebar-delete-current",Ff);var J2=c`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 6h12v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6Z"/><path d="M2 6l1.6-3.3A1.3 1.3 0 0 1 4.8 2h6.4a1.3 1.3 0 0 1 1.2.7L14 6"/><path d="M8 2v4"/></svg>`,Q2=c`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" x2="4" y1="2.5" y2="10"/><circle cx="12" cy="4" r="2"/><circle cx="4" cy="12" r="2"/><path d="M12 6a6 6 0 0 1-6 6"/></svg>`,k0={packages:{title:"Show packages",icon:J2,view:"packages"},repositories:{title:"Show repositories",icon:Q2,view:"repositories"}},Bf=class extends N{static properties={kind:{type:String},count:{type:Number}};createRenderRoot(){return this}constructor(){super(),this.kind="",this.count=0}render(){if(this.count===0)return g;let t=k0[this.kind];if(!t)return console.warn(`<sidebar-view-button>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(k0).map(n=>JSON.stringify(n)).join(", ")}.`),g;let r=a.currentView===t.view;return c`<button type="button" class="${T({"sidebar-view-btn":!0,active:r})}" title="${t.title}" aria-label="${t.title}">${t.icon}<span class="view-btn-count">${this.count}</span></button>`}};customElements.define("sidebar-view-button",Bf);var Z2=["invalid","deleted"],$0={package:{stateKey:"packageSlideTriage"},repository:{stateKey:"repositorySlideTriage"}},Lf=class extends N{static properties={counts:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.kind=""}connectedCallback(){super.connectedCallback(),Le(this,{role:"group","aria-label":"Triage view"})}render(){let t=$0[this.kind];if(!t)return console.warn(`<slide-triage-tabs>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys($0).map(o=>JSON.stringify(o)).join(", ")}.`),g;let r=a[t.stateKey],n=Z2.filter(o=>(this.counts[o]??0)>0||r===o);return n.length===0?g:c`${n.map(o=>{let i=r===o,s=this.counts[o]??0;return c`<button type="button" class="${T({"triage-state-btn":!0,[`triage-state-${o}`]:!0,active:i})}" title="${i?`Exit ${o} view`:`Show ${o} (${s})`}" aria-pressed="${String(i)}" @click="${()=>this._toggle(o)}">${o.charAt(0).toUpperCase()+o.slice(1)} (${s})</button>`})}`}_toggle(t){this.dispatchEvent(new CustomEvent("slide-triage-toggle",{detail:{kind:this.kind,value:t},bubbles:!0,composed:!0}))}};customElements.define("slide-triage-tabs",Lf);var eA=[["own","Sources"],["modules","Dependencies"]],Pf=class extends N{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Le(this,{role:"group","aria-label":"Source filter"})}render(){return c`${eA.map(([t,r])=>{let n=a.filterSources.has(t);return c`<button type="button" class="${T({"source-chip":!0,active:n})}" aria-pressed="${String(n)}" @click="${()=>this._toggle(t)}">${r}</button>`})}`}_toggle(t){this.dispatchEvent(new CustomEvent("source-toggle",{detail:{source:t},bubbles:!0,composed:!0}))}};customElements.define("source-filter",Pf);var tA=c`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>`,rA=c`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h10v4"/></svg>`,x0={findings:{stateKey:"filterInclude",placeholder:"Search findings\u2026"},files:{stateKey:"filesSearch",placeholder:"Search files\u2026"}},Of=class extends N{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=x0[this.kind];if(!t)return console.warn(`<toolbar-search>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(x0).map(n=>JSON.stringify(n)).join(", ")}.`),g;let r=a[t.stateKey];return c`${tA} <input type="text" aria-label="${t.placeholder}" placeholder="${t.placeholder}" .value="${Ee(r)}" @input="${this._onInput}"> ${this.kind==="findings"&&r?this._negateToggle():g}`}_negateToggle(){let t=a.filterIncludeNegate;return c`<button type="button" class="${T({"search-negate-btn":!0,active:t})}" title="${t?"Negation on \u2014 click to undo":"Negate: show non-matching findings"}" aria-label="Negate search" aria-pressed="${String(t)}" @click="${this._onToggleNegate}">${rA}</button>`}_onInput=t=>{this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:this.kind,value:t.target.value},bubbles:!0,composed:!0}))};_onToggleNegate=()=>{this.dispatchEvent(new CustomEvent("search-negate-toggle",{bubbles:!0,composed:!0}))}};customElements.define("toolbar-search",Of);function nA(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}var Nf=class extends N{static properties={options:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.options=[]}render(){return c`<select class="sort-select" aria-label="Filter by repository" .value="${Ee(a.filterRepo)}" @change="${this._onChange}"><option value="" ?selected="${a.filterRepo===""}">All repositories</option>${this.options.map(t=>{let r=t??mn,n=t==null?"(no repo)":nA(t);return c`<option value="${r}" ?selected="${a.filterRepo===r}">${n}</option>`})}</select>`}_onChange=t=>{this.dispatchEvent(new CustomEvent("repo-change",{detail:{value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("repo-filter",Nf);var S0={"":"+ Partial",exclude:"\u2212 Partial",only:"only Partial"},_0={"":"included",exclude:"excluded",only:"only"},C0={"":"Confirmed, partial and revalidation rows \u2014 click for full confirmations only",exclude:"Full confirmations only \u2014 click to show the partial ones only",only:"Partial confirmations only \u2014 click to show all of them again"},Df=class extends N{static properties={options:{attribute:!1},hasPartial:{type:Boolean,attribute:"has-partial"}};createRenderRoot(){return this}constructor(){super(),this.options=[],this.hasPartial=!1}render(){return c`<select class="sort-select" aria-label="Filter by revalidation outcome" .value="${Ee(a.filterRevalidate)}" @change="${this._onChange}"><option value="" hidden ?selected="${a.filterRevalidate===""}"></option><option value="">Confidence</option>${this.options.map(t=>c`<option value="${t.value}" ?selected="${a.filterRevalidate===t.value}">${t.label}</option>`)}</select> ${this.hasPartial&&a.filterRevalidate==="confirmed"?c`<button type="button" class="${T({"partial-cycle":!0,[_0[a.filterPartial]??_0[""]]:!0})}" title="${C0[a.filterPartial]??C0[""]}" @click="${this._onPartial}">${S0[a.filterPartial]??S0[""]}</button>`:g}`}_onPartial=()=>{let t=ja.indexOf(a.filterPartial),r=ja[(t+1)%ja.length];this.dispatchEvent(new CustomEvent("partial-change",{detail:{value:r},bubbles:!0,composed:!0}))};_onChange=t=>{let{value:r}=t.target;r||(t.target.selectedIndex=0),this.dispatchEvent(new CustomEvent("revalidate-change",{detail:{value:r},bubbles:!0,composed:!0}))}};customElements.define("revalidate-filter",Df);var E0=[["none","none","unmarked"],["red","r","red"],["blue","b","blue"],["green","g","green"],["gray","x","gray"]],zf=class extends N{static properties={counts:{attribute:!1},selected:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.selected=[],this.kind="findings"}connectedCallback(){super.connectedCallback(),Le(this,{role:"group","aria-label":"Filter by mark color"})}render(){let t=this.kind==="graph"?new Set(this.selected):a.filterColors;return E0.some(([n])=>(this.counts[n]??0)||t.has(n))?c`${E0.map(([n,o,i])=>{let s=this.counts[n]??0,l=t.has(n);return c`<button type="button" class="${l?"active":""}" title="${`${i} (${s})`}" aria-pressed="${String(l)}" @click="${()=>this._toggle(n)}"><span class="${`td ${o}`}"></span><span class="count">${s}</span></button>`})}`:g}_toggle(t){this.dispatchEvent(new CustomEvent("color-toggle",{detail:{color:t,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("triage-filter",zf);var oA=["inprogress","fixed","invalid","deleted","ignored"],Uf={graph:"graph2-triage-selector",packages:"packages-triage-selector"},iA={inprogress:"In progress"},sA=e=>iA[e]??e.charAt(0).toUpperCase()+e.slice(1),Hf=class extends N{static properties={counts:{attribute:!1},states:{attribute:!1},variant:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.states=null,this.variant=""}connectedCallback(){super.connectedCallback(),Le(this,{role:"group","aria-label":"Triage view"})}render(){let t=this.states??oA,r=t.reduce((i,s)=>i+(this.counts[s]??0),0),n=this.variant?Uf[this.variant]:null;this.variant&&n===void 0&&console.warn(`<triage-selector>: unknown variant ${JSON.stringify(this.variant)}; expected one of ${Object.keys(Uf).map(i=>JSON.stringify(i)).join(", ")} or "".`);for(let i of Object.values(Uf))this.classList.toggle(i,i===n);let o=r===0&&!a.shownTriage;return this.classList.toggle("is-empty",o),o?g:c`${t.map(i=>{let s=this.counts[i]??0,l=a.shownTriage===i;if(s===0&&!l)return g;let d=sA(i);return c`<button type="button" class="${T({"triage-state-btn":!0,[`triage-state-${i}`]:!0,active:l})}" data-triage-show="${i}" title="${l?`Exit ${d.toLowerCase()} view`:`Show ${d.toLowerCase()} (${s})`}" aria-pressed="${String(l)}">${d} (${s})</button>`})}`}};customElements.define("triage-selector",Hf);var aA={table:c`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="3" y2="21"/></svg>`,list:c`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="3" x2="21" y1="6" y2="6"/><line x1="3" x2="21" y1="12" y2="12"/><line x1="3" x2="21" y1="18" y2="18"/></svg>`,grouped:c`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="2" y="1.5" width="12" height="2" rx=".4"/><rect x="5" y="4.4" width="9" height="1.3"/><rect x="5" y="6.2" width="9" height="1.3"/><rect x="2" y="8.5" width="12" height="2" rx=".4"/><rect x="5" y="11.4" width="9" height="1.3"/><rect x="5" y="13.2" width="9" height="1.3"/></svg>`,kanban:c`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1.5" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="6.1" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="10.7" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="2.4" y="3.6" width="2" height="1.4" rx=".2"/><rect x="2.4" y="5.6" width="2" height="1.4" rx=".2"/><rect x="7" y="3.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="3.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="5.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="7.6" width="2" height="1.4" rx=".2"/></svg>`,focus:c`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1.5" y="2.5" width="8.5" height="11" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="3" y="4.4" width="5.5" height="1"/><rect x="3" y="6.4" width="5.5" height="1"/><rect x="3" y="8.4" width="3.5" height="1"/><rect x="11.2" y="2.5" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".55"/><rect x="11.2" y="5.7" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".35"/><rect x="11.2" y="8.9" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".22"/></svg>`,graph:c`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" aria-hidden="true"><line x1="4.5" y1="4.5" x2="11.5" y2="6.5"/><line x1="4.5" y1="4.5" x2="6.5" y2="11.5"/><line x1="11.5" y1="6.5" x2="6.5" y2="11.5"/><circle cx="4.5" cy="4.5" r="2" fill="currentColor"/><circle cx="11.5" cy="6.5" r="2" fill="currentColor"/><circle cx="6.5" cy="11.5" r="2" fill="currentColor"/></svg>`},A0={table:"Table view (compact rows, click a row to expand)",list:"List view (flat, one card per finding)",grouped:"List view, grouped by file",focus:"Focus view (one finding centered + a queue of next findings)",kanban:"Kanban board, columns grouped by triage status",graph:"Graph view (canvas with imports / exports)"},Vf=["kanban","focus","table","list","grouped","graph"],jf=class extends N{static properties={modes:{type:String},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.modes=Vf.join(","),this.kind="findings"}connectedCallback(){super.connectedCallback(),Le(this,{role:"group","aria-label":"View mode"})}render(){let t=this.kind==="files"?a.filesViewMode:a.viewMode,r=this.modes.split(",").map(o=>o.trim()).filter(o=>Vf.includes(o)),n=r.length>0?r:Vf;return c`${n.map(o=>c`<button type="button" class="${T({"view-mode-btn":!0,active:t===o})}" title="${A0[o]}" aria-label="${A0[o]}" aria-pressed="${String(t===o)}" @click="${()=>this._select(o,t)}">${aA[o]}</button>`)}`}_select(t,r){t!==r&&this.dispatchEvent(new CustomEvent("view-mode-change",{detail:{mode:t,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("view-mode-buttons",jf);var M0=6,T0=14,Ul=2,R0=24,ds=4,lA=1.5,Hl=new Map,I0="treemap";function cA(e){let t=/^#?([0-9a-f]{6})$/iu.exec(e);if(!t)return"#fff";let r=parseInt(t[1],16),n=r>>16&255,o=r>>8&255,i=r&255;return(.2126*n+.7152*o+.0722*i)/255>.6?"#1a1a1a":"#fff"}function dA(e,t,r,n){let o=r*r,i=n*n;return Math.max(i*e/o,o/(i*t))}function F0(e,t){let r=[],n=e.filter(f=>f.value>0),{x:o,y:i,w:s,h:l}=t;if(n.length===0||s<=0||l<=0)return r;let d=0;for(let f of n)d+=f.value;let u=s*l/d,p=0;for(;p<n.length&&s>.5&&l>.5;){let f=Math.min(s,l),h=p,m=0,b=0,v=1/0,y=1/0;for(;h<n.length;){let k=n[h].value*u,_=k>b?k:b,R=k<v?k:v,C=dA(_,R,m+k,f);if(h===p||C<=y)y=C,m+=k,b=_,v=R,h++;else break}let w=m/f;if(s>=l){let k=i;for(let _=p;_<h;_++){let R=_===h-1?i+l-k:n[_].value*u/w;r.push({node:n[_],x:o,y:k,w,h:R}),k+=R}o+=w,s-=w}else{let k=o;for(let _=p;_<h;_++){let R=_===h-1?o+s-k:n[_].value*u/w;r.push({node:n[_],x:k,y:i,w:R,h:w}),k+=R}i+=w,l-=w}p=h}return r}function B0(e){for(;e.children&&e.children.size===1;){let t=e.children.values().next().value;if(t.isFile)break;e.name=`${e.name}/${t.name}`,e.children=t.children}if(e.children)for(let t of e.children.values())B0(t)}function L0(e,t,r,n){if(e.path=e.name?t?`${t}/${e.name}`:e.name:t,e.parent=r,e.isFile)return e.count=1,e.value;n.set(e.path,e);let o=0,i=0,s;for(let l of e.children.values())o+=L0(l,e.path,e,n),i+=l.count,s===void 0?s=l.pkg:s!==l.pkg&&(s=null);return e.value=o,e.count=i,e.pkg=s??null,o}function P0(e,t,r,n,o,i,s){if(n<ds||o<ds)return;if(e.isFile){s.push({kind:"file",node:e,x:t,y:r,w:n,h:o});return}if(!(i<M0&&n>=R0&&o>=R0&&e.children.size>0)){s.push({kind:"agg",node:e,x:t,y:r,w:n,h:o});return}s.push({kind:"dir",node:e,x:t,y:r,w:n,h:o});let d=o>=T0+ds+Ul?T0:0,u=t+Ul,p=r+d,f=n-Ul*2,h=o-d-Ul;if(f<ds||h<ds)return;let m=[...e.children.values()].toSorted((b,v)=>v.value-b.value);for(let b of F0(m,{x:u,y:p,w:f,h}))P0(b.node,b.x,b.y,b.w,b.h,i+1,s)}function Wf(e,t){let r=e/(t||1)*100;return r>=10?r.toFixed(0):r.toFixed(r>=1?1:2)}function O0(e,t){if(t<=0||e.isFile||!e.children||e.children.size===0)return 0;let r=1;for(let n of e.children.values()){if(r>=t)break;let o=1+O0(n,t-1);o>r&&(r=o)}return r}function uA(e,t,r,n,o,i){let s=Math.min(i-o,Math.PI*2-1e-4),l=o+s,d=s>Math.PI?1:0,u=Math.cos(o),p=Math.sin(o),f=Math.cos(l),h=Math.sin(l),m=b=>b.toFixed(2);return`M${m(e+n*u)} ${m(t+n*p)}A${m(n)} ${m(n)} 0 ${d} 1 ${m(e+n*f)} ${m(t+n*h)}L${m(e+r*f)} ${m(t+r*h)}A${m(r)} ${m(r)} 0 ${d} 0 ${m(e+r*u)} ${m(t+r*p)}Z`}function pA(e,t){let r=Math.max(4,Math.floor(t/6.4));return e.length>r?`${e.slice(0,r-1)}\u2026`:e}var Kf=class extends Z{static properties={details:{attribute:!1},_w:{state:!0},_h:{state:!0},_focus:{state:!0},_mode:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this._w=0,this._h=0,this._root=null,this._focus=[],this._mode=I0,this._dirByPath=new Map,this._status="loading",this._meta={files:0,total:0,prefix:""},this._ro=null,this._plot=null,this._tooltip=null,this._ttCell=null,this._onPointerMove=this._onPointerMove.bind(this),this._onPointerLeave=this._onPointerLeave.bind(this),this._onPlotClick=this._onPlotClick.bind(this)}willUpdate(t){t.has("details")&&this._rebuild()}firstUpdated(){this._plot=this.querySelector(".bundle-treemap-plot"),this._tooltip=this.querySelector(".bundle-treemap-tooltip"),!(!this._plot||typeof ResizeObserver>"u")&&(this._ro=new ResizeObserver(t=>{let r=t[0]?.contentRect;if(!r)return;let n=Math.floor(r.width),o=Math.floor(r.height);(n!==this._w||o!==this._h)&&(this._w=n,this._h=o)}),this._ro.observe(this._plot))}disconnectedCallback(){super.disconnectedCallback(),this._ro&&(this._ro.disconnect(),this._ro=null)}_onPointerMove(t){let r=t.target.closest(".bundle-treemap-node");if(!r||!this._tooltip){this._hideTooltip();return}if(r!==this._ttCell){this._ttCell=r;let n=r.dataset;Y(c`<div class="bundle-treemap-tt-path">${n.ttPath}</div>${n.ttPkg?c`<div class="bundle-treemap-tt-head"><span class="bundle-treemap-tt-dot" style="${`background:${n.ttColor}`}"></span> <span class="bundle-treemap-tt-pkg">${n.ttPkg}</span></div>`:""}<div class="bundle-treemap-tt-meta">${n.ttMeta}</div>`,this._tooltip)}this._positionTooltip(t.clientX,t.clientY)}_onPointerLeave(){this._hideTooltip()}_positionTooltip(t,r){let n=this._tooltip;if(!n||!this._plot)return;n.classList.add("show");let o=this._plot.getBoundingClientRect(),i=t-o.left,s=r-o.top,l=12,d=i+l;d+n.offsetWidth>o.width-4&&(d=i-n.offsetWidth-l),d<4&&(d=4);let u=s+l;u+n.offsetHeight>o.height-4&&(u=s-n.offsetHeight-l),u<4&&(u=4),n.style.left=`${d}px`,n.style.top=`${u}px`}_hideTooltip(){this._ttCell=null,this._tooltip&&this._tooltip.classList.remove("show")}_rebuild(){if(this._root=null,this._focus=[],this._dirByPath=new Map,this._meta={files:0,total:0,prefix:""},!this.details){this._status="loading";return}let t=Ke(this.details);if(!t||t.size===0){this._status="empty";return}let r=[...t.keys()],n=Mr(this.details),{prefix:o,stripped:i}=it(r),s=new TextEncoder,l={name:"",children:new Map,value:0,isFile:!1},d=0,u=0;for(let h=0;h<r.length;h++){let m=t.get(r[h]),b=typeof m=="string"?s.encode(m).byteLength:0;if(b<=0)continue;let v=i[h].split("/"),y=l,w=!1;for(let R=0;R<v.length-1;R++){let C=y.children.get(v[R]);if(C&&C.isFile){w=!0;break}C||(C={name:v[R],children:new Map,value:0,isFile:!1},y.children.set(v[R],C)),y=C}if(w)continue;let k=v.at(-1),_=y.children.get(k);if(!(_&&!_.isFile)){if(!_){let R=bt(i[h],{packageDir:n?.get(r[h])});_={name:k,isFile:!0,value:0,origPath:r[h],pkg:R},y.children.set(k,_)}_.value+=b,d+=b,u++}}if(d===0){this._status="empty";return}for(let h of l.children.values())B0(h);let p=new Map;L0(l,"",null,p),this._root=l,this._dirByPath=p,this._meta={files:u,total:d,prefix:o},this._status="ok";let f=this.details?.integrity?Hl.get(this.details.integrity):null;if(f){let h=p.get(f);h?this._focus=this._chainTo(h):Hl.delete(this.details.integrity)}}get _focusNode(){return this._focus.length>0?this._focus.at(-1):this._root}_chainTo(t){let r=[];for(let n=t;n&&n!==this._root;n=n.parent)r.push(n);return r.reverse(),r}_rememberFocus(){let t=this.details?.integrity;if(!t)return;let r=this._focus.at(-1)?.path;r?Hl.set(t,r):Hl.delete(t)}_drillInto(t){!t||t.isFile||!t.children||t.children.size===0||(this._focus=this._chainTo(t),this._rememberFocus(),this._hideTooltip())}_focusTo(t){let r=t<0?[]:this._focus.slice(0,t+1);r.length!==this._focus.length&&(this._focus=r,this._rememberFocus(),this._hideTooltip())}_toggleMode(){this._mode=this._mode==="sunburst"?"treemap":"sunburst",I0=this._mode,this._hideTooltip()}_onPlotClick(t){let r=t.target.closest("[data-treemap-into]");if(!r)return;let n=this._dirByPath.get(r.dataset.treemapInto);n&&this._drillInto(n)}_renderCrumbs(){let t=this._focus,r=t.length===0,n=t.slice(0,-1),o=r?null:t.at(-1);return c`<nav class="bundle-treemap-crumbs" aria-label="Treemap location"><span class="bundle-treemap-crumbs-lead"><button type="button" class="${T({"bundle-treemap-crumb-home":!0,"at-root":r})}" @click="${()=>this._focusTo(-1)}">Source ${this._mode==="sunburst"?"sunburst":"treemap"}</button> ${n.map((i,s)=>c`<span class="bundle-treemap-crumb-sep" aria-hidden="true">›</span><button type="button" class="bundle-treemap-crumb" @click="${()=>this._focusTo(s)}" title="${i.path}">${i.name}</button>`)} </span>${o?c`<span class="bundle-treemap-crumb-sep" aria-hidden="true">›</span><span class="bundle-treemap-crumb-current" aria-current="location" title="${o.path}">${o.name}</span>`:""}</nav>`}_cell(t){let r=Wf(t.node.value,this._meta.total),n={left:`${t.x}px`,top:`${t.y}px`,width:`${t.w}px`,height:`${t.h}px`},o=`${t.node.count} ${t.node.count===1?"file":"files"}`;if(t.kind==="dir")return c`<div class="bundle-treemap-node bundle-treemap-dir" style="${ae(n)}" data-treemap-into="${t.node.path}" data-tt-path="${`${t.node.path}/`}" data-tt-meta="${`${ie(t.node.value)} \xB7 ${o} \xB7 ${r}%`}"><span class="bundle-treemap-dirname">${t.node.name}</span></div>`;let i=t.node.pkg??bt(t.node.path),s=Qe(i),l=ae({...n,background:s,color:cA(s)}),d=i==="__own__"?"own source":i;return t.kind==="agg"?c`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-agg" style="${l}" data-treemap-into="${t.node.path}" data-tt-path="${`${t.node.path}/`}" data-tt-pkg="${d}" data-tt-color="${s}" data-tt-meta="${`${ie(t.node.value)} \xB7 ${o} \xB7 ${r}%`}"><span class="bundle-treemap-label">${t.node.name}/</span></div>`:c`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-file" style="${l}" data-bundle-view-source="${t.node.origPath}" data-tt-path="${t.node.path}" data-tt-pkg="${d}" data-tt-color="${s}" data-tt-meta="${`${ie(t.node.value)} \xB7 ${r}% of bundle`}"><span class="bundle-treemap-label">${t.node.name}</span></div>`}_arc(t,r,n){let o=Wf(t.value,n),i=t.pkg??bt(t.path),s=Qe(i),l=i==="__own__"?"own source":i;if(t.isFile)return lr`<path class="bundle-treemap-node bundle-treemap-arc" d="${r}" fill="${s}" data-bundle-view-source="${t.origPath}" data-tt-path="${t.path}" data-tt-pkg="${l}" data-tt-color="${s}" data-tt-meta="${`${ie(t.value)} \xB7 ${o}% of bundle`}"></path>`;let d=`${t.count} ${t.count===1?"file":"files"}`;return lr`<path class="bundle-treemap-node bundle-treemap-arc" d="${r}" fill="${s}" data-treemap-into="${t.path}" data-tt-path="${`${t.path}/`}" data-tt-pkg="${t.pkg?l:g}" data-tt-color="${t.pkg?s:g}" data-tt-meta="${`${ie(t.value)} \xB7 ${d} \xB7 ${o}%`}"></path>`}_renderSunburst(t){let r=this._w,n=this._h,o=r/2,i=n/2,s=Math.min(r,n)/2-6;if(s<30)return g;let l=O0(t,M0),d=Math.min(Math.max(s*.18,26),s*.45),u=(s-d)/l,p=this._meta.total||1,f=[],h=(w,k,_,R)=>{let C=[...w.children.values()].toSorted((F,H)=>H.value-F.value),M=_-k,z=k;for(let F of C){let H=M*(F.value/w.value),he=d+(R-1)*u,te=he+u;H*te>=lA&&(f.push(this._arc(F,uA(o,i,he,te,z,z+H),p)),!F.isFile&&R<l&&F.children.size>0&&h(F,z,z+H,R+1)),z+=H}};h(t,-Math.PI/2,Math.PI*1.5,1);let m=this._focus.length>0,b=Math.max(d-4,10),v=m?lr`<circle class="bundle-treemap-node bundle-treemap-center" cx="${o}" cy="${i}" r="${b}" data-treemap-into="${t.parent.path}" data-tt-path="${`${t.path}/`}" data-tt-meta="${`${ie(t.value)} \xB7 ${t.count} ${t.count===1?"file":"files"} \xB7 ${Wf(t.value,p)}%`}"></circle>`:lr`<circle class="bundle-treemap-center" cx="${o}" cy="${i}" r="${b}"></circle>`,y=lr`<text class="bundle-treemap-center-label" x="${o}" y="${i}" text-anchor="middle">${m?lr`<tspan x="${o}" dy="-0.3em">${pA(t.name,b*2-12)}</tspan><tspan class="bundle-treemap-center-sub" x="${o}" dy="1.5em">${ie(t.value)}</tspan>`:lr`<tspan x="${o}" dy="0.35em">${ie(t.value)}</tspan>`}</text>`;return c`<svg class="bundle-treemap-sunburst" width="${r}" height="${n}" viewBox="${`0 0 ${r} ${n}`}">${f}${v}${y}</svg>`}render(){let t=this._focusNode,r=this._mode==="sunburst",n=this._status==="ok"&&t&&t.children&&this._w>0&&this._h>0,o=[];if(n&&!r){let p=[...t.children.values()].toSorted((f,h)=>h.value-f.value);for(let f of F0(p,{x:0,y:0,w:this._w,h:this._h}))P0(f.node,f.x,f.y,f.w,f.h,1,o)}let{files:i,total:s,prefix:l}=this._meta,d=this._status==="ok"&&t?t.count:i,u=this._status==="ok"&&t?t.value:s;return c`<header class="bundle-treemap-head">${this._renderCrumbs()} <span class="bundle-treemap-head-right"><span class="bundle-treemap-sub">${d} ${d===1?"file":"files"} · ${ie(u)}${l?c`· <span class="mono">${l}</span>`:""}</span> <button type="button" class="${T({"bundle-treemap-mode-toggle":!0,on:r})}" aria-pressed="${String(r)}" aria-label="Toggle sunburst view" @click="${this._toggleMode}"><span>Sunburst</span><span class="bundle-treemap-switch" aria-hidden="true"></span></button></span></header><div class="bundle-treemap-plot" @click="${this._onPlotClick}" @pointermove="${this._onPointerMove}" @pointerleave="${this._onPointerLeave}">${this._status==="loading"?c`<div class="bundle-treemap-empty">Loading…</div>`:this._status==="empty"?c`<div class="bundle-treemap-empty">This bundle doesn't carry any source content.</div>`:r?n?this._renderSunburst(t):g:o.map(p=>this._cell(p))}<div class="bundle-treemap-tooltip"></div></div>`}};customElements.define("bundle-treemap",Kf);var fA=new TextEncoder;function Vl(e){return typeof e=="string"?fA.encode(e).byteLength:0}function N0(e){return(t,r)=>Math.abs(r.delta)-Math.abs(t.delta)||t[e].localeCompare(r[e])}function jl(e){return(t,r)=>r.bytes-t.bytes||t[e].localeCompare(r[e])}function hA(){return{baseBytes:0,otherBytes:0,onlyBaseFiles:0,onlyOtherFiles:0,changedFiles:0}}function z0(e,t,r){let n=[],o=[],i=[],s=0,l=0,d=0,u=0,p=0,f=0,h=new Map,m=k=>{let _=r(k),R=h.get(_);return R||(R=hA(),h.set(_,R)),R},b=new Set([...e.keys(),...t.keys()]);for(let k of b){let _=e.has(k),R=t.has(k),C=m(k);if(_&&R){let M=e.get(k),z=t.get(k),F=Vl(M),H=M===z?F:Vl(z);if(s+=F,l+=H,C.baseBytes+=F,C.otherBytes+=H,M===z)f++;else{let he=H-F;i.push({path:k,baseBytes:F,otherBytes:H,delta:he}),p+=he,C.changedFiles++}}else if(_){let M=Vl(e.get(k));s+=M,d+=M,C.baseBytes+=M,C.onlyBaseFiles++,n.push({path:k,bytes:M})}else{let M=Vl(t.get(k));l+=M,u+=M,C.otherBytes+=M,C.onlyOtherFiles++,o.push({path:k,bytes:M})}}let v=[],y=[],w=[];for(let[k,_]of h){let R=_.baseBytes>0||_.onlyBaseFiles>0||_.changedFiles>0,C=_.otherBytes>0||_.onlyOtherFiles>0||_.changedFiles>0,M=_.onlyBaseFiles+_.onlyOtherFiles+_.changedFiles;R&&!C?v.push({pkg:k,bytes:_.baseBytes}):C&&!R?y.push({pkg:k,bytes:_.otherBytes}):(M>0||_.baseBytes!==_.otherBytes)&&w.push({pkg:k,baseBytes:_.baseBytes,otherBytes:_.otherBytes,delta:_.otherBytes-_.baseBytes})}return n.sort(jl("path")),o.sort(jl("path")),i.sort(N0("path")),v.sort(jl("pkg")),y.sort(jl("pkg")),w.sort(N0("pkg")),{totals:{baseFiles:e.size,baseBytes:s,otherFiles:t.size,otherBytes:l,onlyBaseFiles:n.length,onlyBaseBytes:d,onlyOtherFiles:o.length,onlyOtherBytes:u,changedFiles:i.length,changedDelta:p,unchangedFiles:f,fileDelta:t.size-e.size,byteDelta:l-s,identical:n.length===0&&o.length===0&&i.length===0},files:{onlyBase:n,onlyOther:o,changed:i},packages:{onlyBase:v,onlyOther:y,changed:w}}}function D0(e){let r=String(e).trim().split("+",1)[0],n=r.indexOf("-");return n===-1?{core:r,pre:""}:{core:r.slice(0,n),pre:r.slice(n+1)}}function us(e,t){if(e===t)return 0;let r=D0(e),n=D0(t),o=r.core.split("."),i=n.core.split(".");for(let d=0;d<Math.max(o.length,i.length);d++){let u=Number(o[d]??0),p=Number(i[d]??0);if(Number.isNaN(u)||Number.isNaN(p))return e<t?-1:1;if(u!==p)return u<p?-1:1}if(r.pre===n.pre)return 0;if(!r.pre)return 1;if(!n.pre)return-1;let s=r.pre.split("."),l=n.pre.split(".");for(let d=0;d<Math.max(s.length,l.length);d++){let u=s[d],p=l[d];if(u===void 0)return-1;if(p===void 0)return 1;if(u===p)continue;let f=/^\d+$/u.test(u),h=/^\d+$/u.test(p);return f&&h?Number(u)<Number(p)?-1:1:f!==h?f?-1:1:u<p?-1:1}return 0}function gA(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function mA(e,t){let r=us(t.at(-1),e.at(-1));return r>0?"up":r<0?"down":"changed"}function U0(e,t){let r=[],n=[],o=[],i=new Set([...e.keys(),...t.keys()]);for(let l of i){let d=e.get(l),u=t.get(l);if(d&&u){let p=[...d].toSorted(us),f=[...u].toSorted(us);if(gA(p,f))continue;r.push({pkg:l,baseVersions:p,otherVersions:f,direction:mA(p,f)})}else d?o.push({pkg:l,versions:[...d].toSorted(us)}):n.push({pkg:l,versions:[...u].toSorted(us)})}let s=(l,d)=>l.pkg.localeCompare(d.pkg);return r.sort(s),n.sort(s),o.sort(s),{updated:r,added:n,removed:o,totals:{baseDeps:e.size,otherDeps:t.size}}}var Wl=400,ps=null;function Gf(e){return e===0?"\xB10 B":`${e>0?"+":"\u2212"}${Math.abs(e).toLocaleString()} B`}function H0(e){return e===0?"\xB10":`${e>0?"+":"\u2212"}${Math.abs(e).toLocaleString()}`}function qf(e){return e>0?"up":e<0?"down":""}function bA(e,t){if(!t)return"";let r=e/t*100;return`${r>0?"+":r<0?"\u2212":"\xB1"}${Math.abs(r).toFixed(1)}%`}function V0(e){return e==="__own__"?"own source":e}function Yf(e){return e.join(", ")}var Xf=class extends Z{static properties={details:{attribute:!1},integrity:{attribute:!1},_targetIntegrity:{state:!0},_otherDetails:{state:!0},_status:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this.integrity=null,this._targetIntegrity=null,this._otherDetails=null,this._status="idle",this._diff=null,this._diffKey=null}willUpdate(t){if(t.has("integrity")){if(ps&&this.integrity===ps.base){let r=ps.target;ps=null,this._targetIntegrity=r,this._otherDetails=null,this._status="loading",this._diff=null,this._diffKey=null,this._loadOther(r);return}this._targetIntegrity=null,this._otherDetails=null,this._status="idle",this._diff=null,this._diffKey=null}}_swap(){let t=this._targetIntegrity;!t||t===this.integrity||(a.bundles??[]).some(r=>r.integrity===t)&&(ps={base:t,target:this.integrity},this.dispatchEvent(new CustomEvent("bundle-swap",{bubbles:!0,composed:!0,detail:{integrity:t}})))}_nameFor(t){return(a.bundles??[]).find(n=>n.integrity===t)?.name??`${t.slice(0,15)}\u2026`}_onPick(t){let r=t.target.value||null;if(this._targetIntegrity=r,this._otherDetails=null,this._diff=null,this._diffKey=null,!r){this._status="idle";return}this._status="loading",this._loadOther(r)}async _loadOther(t){let r=(a.bundles??[]).find(o=>o.integrity===t);if(!r){this._status="idle",this._targetIntegrity=null;return}let n=await go(t,r);this._targetIntegrity===t&&(this._otherDetails=n,this._status="ready")}get _baseReady(){return!!(this.details&&this.details.integrity===this.integrity&&(this.details.json||this.details.bundle))}_fileRow(t,r,n,o){let i=c`<span class="bundle-compare-row-path mono">${r}</span>${o}`;return n?c`<li><button type="button" class="bundle-compare-row bundle-compare-row-link" data-bundle-view-source="${t}" title="${t}">${i}</button></li>`:c`<li><div class="bundle-compare-row" title="${t}">${i}</div></li>`}_fileGroup(t,r,n,o,i){if(r.length===0)return g;let s=r.slice(0,Wl),l=r.length-s.length;return c`<section class="${`bundle-compare-group bundle-compare-${n}`}"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title">${t}</span> <span class="bundle-compare-group-count">${r.length}</span></header><ul class="bundle-compare-rows">${X(s,d=>d.path,d=>{let u=d.delta===void 0?c`<span class="bundle-compare-row-size">${ie(d.bytes)}</span>`:c`<span class="bundle-compare-row-size">${ie(d.baseBytes)} → ${ie(d.otherBytes)}</span> <span class="${`bundle-compare-row-delta ${d.delta>0?"up":d.delta<0?"down":""}`}">${Gf(d.delta)}</span>`;return this._fileRow(d.path,i(d.path),o,u)})}</ul>${l>0?c`<div class="bundle-compare-more">and ${l.toLocaleString()} more…</div>`:g}</section>`}_pkgGroup(t,r,n){if(r.length===0)return g;let o=r.slice(0,Wl),i=r.length-o.length;return c`<section class="${`bundle-compare-group bundle-compare-${n}`}"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title">${t}</span> <span class="bundle-compare-group-count">${r.length}</span></header><ul class="bundle-compare-rows">${X(o,s=>s.pkg,s=>{let l=s.delta===void 0?c`<span class="bundle-compare-row-size">${ie(s.bytes)}</span>`:c`<span class="bundle-compare-row-size">${ie(s.baseBytes)} → ${ie(s.otherBytes)}</span> <span class="${`bundle-compare-row-delta ${s.delta>0?"up":s.delta<0?"down":""}`}">${Gf(s.delta)}</span>`;return c`<li><div class="bundle-compare-row" title="${V0(s.pkg)}"><span class="bundle-compare-pkg-dot" style="${ae({background:Qe(s.pkg)})}"></span> <span class="bundle-compare-row-path">${V0(s.pkg)}</span> ${l}</div></li>`})}</ul>${i>0?c`<div class="bundle-compare-more">and ${i.toLocaleString()} more…</div>`:g}</section>`}_versionRow(t){let r=t.direction==="up"?"\u2191":t.direction==="down"?"\u2193":"\xB1",n=t.direction==="up"?"Upgraded":t.direction==="down"?"Downgraded":"Changed";return c`<li><div class="bundle-compare-row" title="${`${t.pkg} \xB7 ${n}`}"><span class="bundle-compare-pkg-dot" style="${ae({background:Qe(t.pkg)})}"></span> <span class="bundle-compare-row-path">${t.pkg}</span> <span class="bundle-compare-ver"><span class="bundle-compare-ver-from">${Yf(t.baseVersions)}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="${`bundle-compare-ver-to ${t.direction}`}">${Yf(t.otherVersions)}</span> <span class="${`bundle-compare-ver-dir ${t.direction}`}" aria-hidden="true">${r}</span></span></div></li>`}_depGroup(t,r,n){if(r.length===0)return g;let o=r.slice(0,Wl),i=r.length-o.length;return c`<section class="${`bundle-compare-group bundle-compare-${n}`}"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title">${t}</span> <span class="bundle-compare-group-count">${r.length}</span></header><ul class="bundle-compare-rows">${X(o,s=>s.pkg,s=>c`<li><div class="bundle-compare-row" title="${s.pkg}"><span class="bundle-compare-pkg-dot" style="${ae({background:Qe(s.pkg)})}"></span> <span class="bundle-compare-row-path">${s.pkg}</span> <span class="bundle-compare-dep-ver">${Yf(s.versions)}</span></div></li>`)}</ul>${i>0?c`<div class="bundle-compare-more">and ${i.toLocaleString()} more…</div>`:g}</section>`}_renderVersionUpdates(t,r,n){let{updated:o,added:i,removed:s}=t;if(o.length===0&&i.length===0&&s.length===0)return g;let l=o.slice(0,Wl),d=o.length-l.length;return c`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Dependency updates</h3>${o.length>0?c`<div class="bundle-compare-ver-changes"><header class="bundle-compare-group-head"><span class="bundle-compare-group-title">Updated</span> <span class="bundle-compare-group-count">${o.length}</span></header><ul class="bundle-compare-rows">${X(l,u=>u.pkg,u=>this._versionRow(u))}</ul>${d>0?c`<div class="bundle-compare-more">and ${d.toLocaleString()} more…</div>`:g}</div>`:g} ${i.length>0||s.length>0?c`<div class="bundle-compare-cols">${this._depGroup(`Removed \xB7 only in ${r}`,s,"removed")} ${this._depGroup(`Added \xB7 only in ${n}`,i,"added")}</div>`:g}</section>`}_diffFor(){let t=`${this.integrity}|${this._targetIntegrity}`;if(this._diffKey!==t||!this._diff){let r=Ke(this.details),n=Ke(this._otherDetails),{prefix:o}=it([...r.keys(),...n.keys()]),i=Mr(this.details),s=Mr(this._otherDetails),l=i||s?new Map([...i??[],...s??[]]):null,d=u=>bt(o&&u.startsWith(o)?u.slice(o.length):u,{packageDir:l?.get(u)});this._diff=z0(r,n,d),this._diff.versionUpdates=U0(zi(this.details),zi(this._otherDetails)),this._diffKey=t}return this._diff}_renderSummary(t){let r=t.totals,n=t.versionUpdates.totals,o=n.baseDeps>0||n.otherDeps>0,i=n.otherDeps-n.baseDeps;return c`<div class="bundle-compare-summary"><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Files</span> <span class="bundle-compare-metric-value">${r.baseFiles.toLocaleString()} → ${r.otherFiles.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${qf(r.fileDelta)}`}">${H0(r.fileDelta)}</span></div><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Size</span> <span class="bundle-compare-metric-value">${ie(r.baseBytes)} → ${ie(r.otherBytes)}</span> <span class="${`bundle-compare-metric-delta ${qf(r.byteDelta)}`}">${Gf(r.byteDelta)}${(()=>{let s=bA(r.byteDelta,r.baseBytes);return s?c`${" "}<span class="bundle-compare-pct">(${s})</span>`:g})()}</span></div>${o?c`<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Deps</span> <span class="bundle-compare-metric-value">${n.baseDeps.toLocaleString()} → ${n.otherDeps.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${qf(i)}`}">${H0(i)}</span></div>`:g}<div class="bundle-compare-chips"><span class="bundle-compare-chip removed">−${r.onlyBaseFiles.toLocaleString()} removed</span> <span class="bundle-compare-chip added">+${r.onlyOtherFiles.toLocaleString()} added</span> <span class="bundle-compare-chip changed">${r.changedFiles.toLocaleString()} changed</span> <span class="bundle-compare-chip unchanged">${r.unchangedFiles.toLocaleString()} unchanged</span></div></div>`}_renderPicker(t,r){let n=this._nameFor(this.integrity);return c`<div class="bundle-compare-picker"><span class="bundle-compare-base" title="${n}">${n}</span> <span class="bundle-compare-arrow" aria-hidden="true">→</span> <label class="bundle-compare-select-wrap"><span class="bundle-compare-select-hint">Compare with</span> <select class="bundle-compare-select" .value="${Ee(this._targetIntegrity??"")}" @change="${o=>this._onPick(o)}" aria-label="Bundle to compare with"><option value="">Choose a bundle…</option>${t.map(o=>c`<option value="${o.integrity}">${o.label}</option>`)}</select></label> ${r?c`<button type="button" class="bundle-compare-swap" @click="${()=>this._swap()}" aria-label="Swap the two bundles"><span class="bundle-compare-swap-icon" aria-hidden="true">↔</span>Swap</button>`:g}</div>`}_otherOptions(){let t=(a.bundles??[]).filter(n=>n.integrity!==this.integrity),r=new Map;for(let n of t)r.set(n.name,(r.get(n.name)??0)+1);return t.map(n=>({integrity:n.integrity,label:r.get(n.name)>1?`${n.name} \xB7 ${n.integrity.slice(7,13)}\u2026`:n.name}))}render(){let t=this._otherOptions(),r=!!this._targetIntegrity&&t.some(s=>s.integrity===this._targetIntegrity),n=t.length>0?this._renderPicker(t,r):g,o=r&&this._status==="ready"&&this._otherDetails&&(this._otherDetails.json||this._otherDetails.bundle)&&!this._otherDetails.error,i;return this._baseReady?t.length===0?i=c`<div class="bundle-compare-empty">No other bundles to compare with. Drop a second <code>.map</code> or <code>.stasis.code.br</code> bundle to diff against this one.</div>`:r?this._status==="loading"||!this._otherDetails?i=c`<div class="bundle-compare-empty">Comparing…</div>`:this._otherDetails.error?i=c`<div class="bundle-compare-empty is-error">Couldn't read the selected bundle: ${this._otherDetails.error}</div>`:!this._otherDetails.json&&!this._otherDetails.bundle?i=c`<div class="bundle-compare-empty is-error">The selected bundle couldn't be parsed.</div>`:i=this._renderDiff():i=c`<div class="bundle-compare-empty">Pick a bundle above to compare against <strong>${this._nameFor(this.integrity)}</strong>.</div>`:i=c`<div class="bundle-compare-empty">Loading bundle…</div>`,c`<div class="bundle-compare"><header class="bundle-compare-head">${n} ${this._baseReady&&o?this._renderSummary(this._diffFor()):g}</header><div class="bundle-compare-body">${i}</div></div>`}_renderDiff(){let t=this._diffFor(),r=this._nameFor(this._targetIntegrity),n=this._nameFor(this.integrity),o=[...t.files.onlyBase.map(p=>p.path),...t.files.onlyOther.map(p=>p.path),...t.files.changed.map(p=>p.path)],{prefix:i,stripped:s}=it(o),l=new Map;for(let p=0;p<o.length;p++)l.set(o[p],s[p]);let d=p=>l.get(p)??p,u=t.packages.onlyOther.length>0||t.packages.onlyBase.length>0||t.packages.changed.length>0;return c`<div class="bundle-compare-caption">Changes from <strong>${n}</strong> to <strong>${r}</strong> ${i?c`· <span class="mono">${i}</span>`:g}</div>${this._renderVersionUpdates(t.versionUpdates,n,r)} ${t.totals.identical?c`<div class="bundle-compare-identical">These two bundles carry identical sources (${t.totals.unchangedFiles.toLocaleString()} ${t.totals.unchangedFiles===1?"file":"files"}).</div>`:c`${u?c`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Packages</h3><div class="bundle-compare-cols">${this._pkgGroup(`Removed \xB7 only in ${n}`,t.packages.onlyBase,"removed")} ${this._pkgGroup(`Added \xB7 only in ${r}`,t.packages.onlyOther,"added")} ${this._pkgGroup("Changed size",t.packages.changed,"changed")}</div></section>`:g}<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Files</h3><div class="bundle-compare-cols bundle-compare-cols--files">${this._fileGroup(`Removed \xB7 only in ${n}`,t.files.onlyBase,"removed",!0,d)} ${this._fileGroup(`Added \xB7 only in ${r}`,t.files.onlyOther,"added",!1,d)} ${this._fileGroup("Changed",t.files.changed,"changed",!0,d)}</div></section>`}`}};customElements.define("bundle-compare",Xf);var yA=c`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M6 9V2h12v7"/><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><rect x="6" y="14" width="12" height="8"/></svg>`,Jf=class extends N{createRenderRoot(){return this}render(){return a.reports.length>0&&a.currentView==="findings"&&a.viewMode!=="graph"&&a.viewMode!=="kanban"?c`<button type="button" title="print this report" aria-label="print" @click="${this._onClick}">${yA}</button>`:g}_onClick=()=>{this.dispatchEvent(new CustomEvent("print-requested",{bubbles:!0,composed:!0}))}};customElements.define("print-button",Jf);var vA=c`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>`,Qf=class extends N{createRenderRoot(){return this}render(){return a.reports.length>0&&a.currentView==="findings"&&a.viewMode!=="graph"&&a.viewMode!=="kanban"?c`<button type="button" title="download this report" aria-label="download" @click="${this._onClick}">${vA}</button>`:g}_onClick=()=>{this.dispatchEvent(new CustomEvent("download-requested",{bubbles:!0,composed:!0}))}};customElements.define("download-button",Qf);function fs(e){let t=new Map;for(let[r,n]of a.triage)n[e]&&t.set(r,n[e]);return t}var wA={get markers(){return fs("color")},get triageState(){return fs("triage")},get comments(){return fs("comment")},get fixes(){return fs("fix")},get flags(){return fs("flagged")},get(e){let t=a.triage.get(e),r={};return t?.color&&(r.color=t.color),t?.triage&&(r.triage=t.triage),t?.comment&&(r.comment=t.comment),t?.fix&&(r.fix=t.fix),t?.flagged!==void 0&&(r.flagged=t.flagged),r},async set(e,{color:t,triage:r,comment:n,fix:o,flagged:i}={}){let s=!1;if(t!==void 0&&(t===null||t===""?U(a.triage,e,{color:void 0})&&(s=!0):a.triage.get(e)?.color!==t&&(U(a.triage,e,{color:t}),s=!0)),r!==void 0)if(r===null||r===""||r===!1)U(a.triage,e,{triage:void 0})&&(s=!0);else if(r==="inprogress"||r==="fixed"||r==="invalid"||r==="deleted")a.triage.get(e)?.triage!==r&&(U(a.triage,e,{triage:r}),s=!0);else throw new TypeError(`DeepView.triage.set: unknown triage value ${JSON.stringify(r)} (expected 'inprogress' | 'fixed' | 'invalid' | 'deleted' | null)`);if(n!==void 0){let l=n?String(n):"";l?a.triage.get(e)?.comment!==l&&(U(a.triage,e,{comment:l}),s=!0):U(a.triage,e,{comment:void 0})&&(s=!0)}if(o!==void 0){let l=o?String(o):"";l?a.triage.get(e)?.fix!==l&&(U(a.triage,e,{fix:l}),s=!0):U(a.triage,e,{fix:void 0})&&(s=!0)}if(i!==void 0){let l=i===null||i===""?void 0:!!i;a.triage.get(e)?.flagged!==l&&(U(a.triage,e,{flagged:l}),s=!0)}return s&&(await ce(),x()),s}};window.DeepView={get reports(){return a.reports.slice()},get groups(){return st()},get findings(){return st().flat()},get currentFile(){return a.currentFile},get currentWorkspace(){return a.currentWorkspace},triage:wA,themes:a0,setTheme:i0,get theme(){return s0()},triageSync:D,refresh(){x()},export(){return y0()}};var kA={default:oe.default,"claude-security":oe["claude-security"],"codex-security":oe["codex-security"],deepsec:oe.deepsec,piolium:oe.piolium,bundle:co,workspace:ll};for(let e of document.querySelectorAll(".drop-supported-icon[data-icon]")){let t=kA[e.dataset.icon];t&&(e.innerHTML=t)}xm(x);Nd(x);$m(x);D.onStatusChange(x);wm(async(e,t)=>{a.currentWorkspace===e?await Ct(e):a.currentFile&&a.currentFile===t?await Ze(t):await W()});km(async()=>{await W(),a.currentView==="bundles"&&x()});xw();_w();async function G0(){let e=ru();if(!e)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let t;try{t=await Ew({encoded:e})}catch(n){return alert(`Couldn't open the share-link unlock prompt: ${n.message}`),!1}if(!t)return!1;let r=await Cd({id:t.id,name:t.name,privateKey:t.privateKeyBase64});if(r.status==="already-attached")return alert(`This workspace is already attached as "${r.workspace.name}".`),!1;if(r.status==="name-collision"){let n=r.existing?.name;return alert(n?`A workspace named "${n}" already exists. Open the share link again and pick a different name.`:"The shared workspace name is empty or invalid. Ask the sender to re-share with a real name."),!1}return r.workspace?.id?await Ct(r.workspace.id):await W(),!0}async function q0(){let e=$a();if(!e)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let t=await kw(e);return t.ok?!0:(alert(t.reason),!1)}var xo=!1;async function Y0(){if(xo||(xo=!0,await pr(),kd(),await W(),await G0())||await q0())return;let r=Re(Br);if(r)if(r.startsWith("ws:")){let n=r.slice(3);K().some(o=>o.id===n)&&await Ct(n)}else if(r.startsWith("b:")){let n=r.slice(2),o=n.indexOf(" "),i=o>=0?n.slice(0,o):n,s=o>=0?n.slice(o+1):"",l=Vi.has(s)?s:"overview";(a.bundles??[]).some(d=>d.integrity===i)&&(a.currentView="bundles",a.selectedBundle=i,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.bundleCodeSearchQuery="",a.bundleCodeSearchMode="files",a.bundleSearchQuery="",a.bundleSearchRegex=!1,a.bundleSearchCase=!1,a.bundleSearchContext=!0,a.bundleDetailsTab=l,a.shownTriage=null,A.showAll=!0,x(),or(i))}else(await le()).includes(r)&&await Ze(r)}var j0=se(),W0=!1;function K0(e){W0||(W0=!0,queueMicrotask(()=>{alert(e+" This tab will reload to refresh its state. Any unsaved edits in this tab will be lost."),location.reload()}))}Ie(()=>{let e=j0,t=se();if(j0=t,x(),!xo&&$t()){Y0().catch(r=>console.warn("continueBoot:",r));return}if(xo&&t&&!$t()){K0("Encryption was just enabled in another tab.");return}xo&&e&&!t&&!bc()&&K0("Encryption was disabled in another tab.")});window.addEventListener("hashchange",()=>{xo&&(async()=>{await G0()||await q0()})().catch(e=>console.warn("deep-link hashchange:",e))});(async()=>{if(!await Cw()){try{let e=window.matchMedia?.("(display-mode: window-controls-overlay)").matches;if(!e&&a.serverMode!=="managed"&&localStorage.getItem("deepview.sidebarCollapsed")==="1"&&Ph.classList.add("collapsed"),window.matchMedia?.("(display-mode: standalone)").matches||e){let r=document.querySelector('meta[name="viewport"]');r&&r.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"),window.addEventListener("wheel",n=>{(n.ctrlKey||n.metaKey)&&n.preventDefault()},{passive:!1}),window.addEventListener("keydown",n=>{(n.ctrlKey||n.metaKey)&&(n.key==="="||n.key==="+"||n.key==="-"||n.key==="0")&&n.preventDefault()})}}catch{}se()&&!$t()||await Y0()}})();
162
+ Use this only if you have lost access to your passkey and have no other way to unlock.`)&&confirm("Really wipe everything? This cannot be undone.")){try{await La()}catch(o){alert(`Wipe failed: ${o?.message??o}. Try again or clear localStorage manually via DevTools.`);return}location.reload()}}),document.body.append(Et),Et}function ww(){return D()||!Pr()?!1:de()&&!tr()}async function kw(){if(await at(),ww()){let t=o8();t.hidden=!1;let e=t.querySelector("button");e&&e.focus()}else if(Et&&(Et.hidden=!0,Uc))try{Uc.abort()}catch{}}tt(kw);document.addEventListener("managed-client-mode-change",kw);kw();O();Nt();ue();ot();Xr();kp();yp();St();Rc();Dy();M();O();ue();fe();vc();var tA=`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%;box-sizing:border-box;min-height:9rem;max-height:50vh;resize:vertical;padding:.55rem .65rem;border:1px solid var(--border);border-radius:6px;background:var(--bg, var(--surface));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)}}
163
+ `;Bn();var xw=class extends F{static styles=[...F.styles,A(Mo),A(tA)];static properties={initial:{attribute:!1},finding:{attribute:!1},_value:{state:!0}};constructor(){super(),this.initial="",this.finding=null,this._value=""}beforeOpen(){this._value=this.initial??""}focusInitial(){let e=this.renderRoot.querySelector("textarea");if(!e)return;e.focus();let r=e.value.length;try{e.setSelectionRange(r,r)}catch{}}_onInput=e=>{this._value=e.target.value};_onSave=()=>{let e=(this._value??"").trim(),r=(this.initial??"").trim();if(e===r){this._finish(null);return}this._finish(e)};_onClear=()=>this._finish("");_onCancel=()=>this._finish(null);_onKeydown=e=>{e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this._onSave())};render(){let e=this.finding??{},r=e.file?e.line?`${e.file}:${e.line}`:e.file:"",n=(this.initial??"").length>0;return d`<dialog @close="${this._onClose}"><header><h3>${n?"Edit comment":"Add comment"}</h3><div class="finding">${Io(ae(e,l.severityMode))} ${r?d`<span class="loc" title="${r}">${r}</span>`:m}</div>${e.description?d`<div class="desc" title="${e.description}">${e.description}</div>`:m}</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">${n?d`<button type="button" class="danger" @click="${this._onClear}">Clear</button>`:m} <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",xw);function rA({initial:t="",finding:e=null}={}){return le("comment-dialog",{initial:t,finding:e})}M();fe();Tr();var $w=class extends F{static styles=[...F.styles,A(qe)];static properties={bundleName:{type:String},encrypted:{type:Boolean}};constructor(){super(),this.bundleName="",this.encrypted=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(e){this._settled||super._finish({confirmed:!!e})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_securityNote(){return this.encrypted?d`<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>`:d`<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>`}render(){return d`<dialog @close="${this._onClose}"><header><h3>Download bundle</h3></header><p class="lwd-body">Download <strong>"${this.bundleName}"</strong> to disk?</p>${this._securityNote()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onConfirm}">Download</button></footer></dialog>`}};customElements.define("download-bundle-dialog",$w);function nA({name:t,encrypted:e}={}){return le("download-bundle-dialog",{bundleName:t??"",encrypted:!!e})}M();fe();Bn();M();var oA=d`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>`,iA=d`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="1.8" y="5" width="20.4" height="14" rx="2"/><path d="M5.6 15.6V8.4l3.1 3.6 3.1-3.6v7.2"/><path d="M16.9 8.4v7.2m-2.6-2.9 2.6 2.9 2.6-2.9"/></svg>`,sA=d`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M6 9V2h12v7"/><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><rect x="6" y="14" width="12" height="8"/></svg>`;O();Xr();ue();ot();Oe();function s8(t,e){let r=Vu.find(n=>n.value===t)?.label??t;return Wu(t)?.includes("partial")?e==="exclude"?`${r} (full only)`:e==="only"?`${r} (partial only)`:r:r}function a8(t){return Ee.filter(e=>t.has(e)).map(e=>ls[e]??e).join(", ")}function _w(t=l){let e=[];if(t.filterSeverities.size>0&&e.push({key:"severity",label:"Severity",value:a8(t.filterSeverities),clear:{filterSeverities:new Set}}),t.filterColors.size>0&&e.push({key:"marks",label:"Marks",value:[...t.filterColors].map(r=>Ya[r]??r).join(", "),clear:{filterColors:new Set}}),t.filterSources.size===1&&e.push({key:"source",label:"Source",value:t.filterSources.has("own")?"Sources only":"Dependencies only",clear:{filterSources:new Set}}),t.filterAnalyzer&&e.push({key:"analyzer",label:"Analyzer",value:t.filterAnalyzer===vo?"(none)":t.filterAnalyzer,clear:{filterAnalyzer:""}}),t.filterModel&&e.push({key:"model",label:"Model",value:t.filterModel===wo?"(none)":t.filterModel,clear:{filterModel:""}}),t.filterRepo&&e.push({key:"repo",label:"Repository",value:t.filterRepo===Ti?"(no repo)":t.filterRepo,clear:{filterRepo:""}}),Wu(t.filterRevalidate)&&e.push({key:"revalidate",label:"Revalidation",value:s8(t.filterRevalidate,t.filterPartial),clear:{filterRevalidate:"",filterPartial:""}}),!t.filterRevalidate&&(t.filterConfMin>0||t.filterConfMax<10)){let r;t.filterConfMin>0&&t.filterConfMax<10?r=`${t.filterConfMin}\u2013${t.filterConfMax}`:t.filterConfMin>0?r=`\u2265 ${t.filterConfMin}`:r=`\u2264 ${t.filterConfMax}`,e.push({key:"confidence",label:"Confidence",value:r,clear:{filterConfMin:0,filterConfMax:10}})}t.filterInclude&&e.push({key:"search",label:t.filterIncludeNegate?"Excluding":"Search",value:`"${t.filterInclude}"`,clear:{filterInclude:"",filterIncludeNegate:!1}});for(let[r,n]of[["filterComment","comment"],["filterFix","fix"],["filterFlagged","flag"]]){let o=t[r];o&&e.push({key:`annotation:${n}`,label:"Annotation",value:`${o==="with"?"With":"Without"} ${n}`,clear:{[r]:""}})}return!l.currentWorkspace&&t.filterDuplicates&&e.push({key:"duplicates",label:"Duplicates",value:t.filterDuplicates==="with"?"Only rows linked to other reports":"Exclude rows linked to other reports",clear:{filterDuplicates:""}}),t.filterCrossContext&&e.push({key:"cross-context",label:"Context",value:t.filterCrossContext==="with"?"Only rows across multiple repos or packages":"Exclude rows across multiple repos or packages",clear:{filterCrossContext:""}}),t.filterAppStacked&&e.push({key:"app-stacked",label:"App stack",value:t.filterAppStacked==="with"?"Only rows with multiple App findings":"Exclude rows with multiple App findings",clear:{filterAppStacked:""}}),e}function Sw(){return qt().filter(t=>ze(t).commonTriage===l.shownTriage)}function Cw(){return l.shownTriage?ro[l.shownTriage]??l.shownTriage:null}function mf(t,e=B_()){let r=Sw(),n=r.length;Gl(e);let o;try{o=ko(r).length}finally{ql()}return{included:o,total:n,excluded:n-o,fields:e,filters:_w(e),bucketLabel:Cw(),focusedOnly:t==="print"&&l.viewMode==="focus"}}var aA=`dialog{max-width:515px;width:min(94vw,515px)}.ecd-count{margin:0;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:4px;background:none;color:var(--muted);font:inherit;font-size:1rem;line-height:1;&:hover{color:var(--critical, #f87171)}&: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}
164
+ `;Hv();var c8=[{id:"download",label:"Markdown",icon:iA},{id:"print",label:"Print",icon:sA}],Ew=class extends F{static styles=[...F.styles,A(aA),A(sf)];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}};constructor(){super(),this.mode="download",this.included=0,this.excluded=0,this.total=0,this.filters=[],this.fields=null,this._relaxed=!1,this.bucketLabel=null,this.focusedOnly=!1}get _focusedOnly(){return this.mode==="print"&&this.focusedOnly}_selectTab(e){this.mode!==e&&(this.mode=e)}focusInitial(){let e=this.included===0?'button[data-role="cancel"]':"button.primary";this.renderRoot.querySelector(e)?.focus()}_finish(e){this._settled||super._finish({confirmed:e==="confirm",view:e==="view",fields:this._relaxed?this.fields:null,mode:this.mode})}_onClose=()=>this._finish("cancel");_onCancel=()=>this._finish("cancel");_onView=()=>this._finish("view");_onConfirm=()=>this._finish("confirm");async _onDropFilter(e){let r=this.filters.findIndex(s=>s.key===e);if(r===-1)return;let n=mf(this.mode,{...this.fields,...this.filters[r].clear});this._relaxed=!0,this.fields=n.fields,this.filters=n.filters,this.included=n.included,this.excluded=n.excluded,this.total=n.total,await this.updateComplete;let o=[...this.renderRoot.querySelectorAll("button[data-drop]")];(o[Math.min(r,o.length-1)]??this.renderRoot.querySelector("button.primary")??this.renderRoot.querySelector('button[data-role="cancel"]'))?.focus()}_countSection(){if(this.total===0)return d`<p class="ecd-count">No findings to ${this.mode==="print"?"print":"download"}.</p>`;if(this._focusedOnly&&this.included>0)return d`<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 r=this.excluded===0&&this.filters.length===0?d`All <strong>${this.included}</strong> ${this.included===1?"finding":"findings"} included.`:d`<strong>${this.included}</strong> of ${this.total} ${this.total===1?"finding":"findings"} included.`;return d`<p class="ecd-count">${r}</p>${this.excluded>0?d`<p class="ecd-excluded">${this.excluded} filtered out and ${this.mode==="print"?"won't be printed":"won't be downloaded"}.</p>`:m}`}_filtersSection(){return this.filters.length===0?d`<p class="ecd-filters-label">No filters active — the full ${this.bucketLabel?`${this.bucketLabel.toLowerCase()} `:""}set is included.</p>`:d`<p class="ecd-filters-label">Active filters</p><dl class="ecd-filters">${this.filters.map(e=>d`<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",r=this._focusedOnly?"You're in focus mode \u2014 printing outputs just the finding you're focused on.":e?"Prints only the findings matching your current filters \u2014 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 \u2014 the same set shown on screen. Use the toolbar to change the selection first.";return d`<dialog @close="${this._onClose}"><header>${Ap({tabs:c8,current:this.mode,prefix:"ecd",select:n=>this._selectTab(n)})}</header><div role="tabpanel" id="${`ecd-panel-${this.mode}`}" aria-labelledby="${`ecd-tab-${this.mode}`}"><p class="nwd-intro">${r}</p>${this._countSection()} ${this.bucketLabel?d`<p class="nwd-note">Scoped to the <strong>${this.bucketLabel}</strong> list — live findings are not included.</p>`:m} ${this._filtersSection()}</div><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> ${e?m:d`<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",Ew);function lA(t="download"){let e=mf(t),r=t==="print"?e.focusedOnly:mf("print").focusedOnly;return new Promise(n=>{let o=document.createElement("export-confirm-dialog");Object.assign(o,{mode:t,included:e.included,excluded:e.excluded,total:e.total,filters:e.filters,fields:e.fields,bucketLabel:e.bucketLabel,focusedOnly:r});let i=s=>{o.remove(),n(s)};o.addEventListener("resolve",s=>i({confirmed:!!s.detail?.confirmed,view:!!s.detail?.view,fields:s.detail?.fields??null,mode:s.detail?.mode??t})),o.addEventListener("modal-conflict",()=>i({confirmed:!1,view:!1,fields:null,mode:t})),document.body.append(o)})}M();fe();Zl();Oe();var d8=160,u8=320,p8=/^ {0,3}#{1,6}(?: |$)/u,f8=/^ {0,3}(?:=+|-+) *$/u,gf=/^\|?[^|\n]+(?:\|[^|\n]+)+\|?$/u,cA=/^\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?$/u;function dA(t,e=t.join(`
165
+ `),{target:r=d8,max:n=u8}={}){let o=t.length;if(o===0)return[];let i=rt(e),s=0,a=0,c=()=>{for(;s<i.length&&i[s][1]<=a-1;)s++;return s<i.length&&a-1>=i[s][0]},u=b=>t[b].trim()==="",p=b=>gf.test(t[b]),f=b=>!c()&&!(cA.test(t[b])&&p(b-1))&&!(f8.test(t[b])&&!u(b-1)),h=b=>u(b-1)||p8.test(t[b]),g=[],y=0;for(let b=1;b<o;b++){a+=t[b-1].length+1;let v=b-y;v<r||!f(b)||(v>=n||h(b))&&(g.push([y,b]),y=b)}return g.push([y,o]),g}function uA(t,e){if(e<2||!gf.test(t[e])||!gf.test(t[e-1]))return null;let r=e-1;for(;r>0&&gf.test(t[r-1]);)r--;for(let n=r+1;n<e;n++)if(cA.test(t[n]))return[n-1,n+1];return null}function pA(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}var bf=`.token.comment,.token.prolog,.token.cdata{color:var(--code-comment);font-style:italic}.token.punctuation{color:var(--muted)}.token.string,.token.attr-value,.token.char,.token.regex{color:var(--code-string)}.token.number,.token.boolean,.token.constant,.token.symbol{color:var(--code-number)}.token.keyword,.token.builtin,.token.important,.token.atrule{color:var(--code-keyword)}.token.function,.token.class-name,.token.tag{color:var(--code-function)}.token.operator,.token.entity,.token.url,.token.attr-name,.token.selector{color:var(--code-operator)}.token.variable,.token.property,.token.parameter{color:var(--code-variable)}.token.annotation{color:var(--code-function)}.token.deleted{color:var(--code-deleted)}.token.inserted{color:var(--code-inserted)}.token.italic{font-style:italic}.token.bold{font-weight:700}
166
+ `;var fA=`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:4px;color:var(--muted);font:500 16px/1 ui-monospace,monospace;cursor:pointer;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}.evd-code{flex:1 1 auto;min-height:0;margin:0;overflow:auto;border:1px solid var(--border);border-radius:6px;background:var(--bg, var(--surface));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:3px;font:inherit;font-size:.72rem;font-weight:500;letter-spacing:.02em;cursor:pointer;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}&.evd-done{color:var(--green, #4ade80);background:color-mix(in srgb,var(--green, #4ade80) 14%,transparent)}&.evd-failed{color:var(--critical, #f87171);background:color-mix(in srgb,var(--critical, #f87171) 14%,transparent)}}
167
+ `;var g8=d`<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 b8(t,e,r,n=null){let o="";for(let i=e;i<r;i++){let s=n===null?pA(t[i]):n[i-e];o+=`<span class="evd-lineno" aria-hidden="true">${i+1}</span><code class="evd-line">${s}
168
+ </code>`}return o}var Rw=class extends F{static styles=[...F.styles,A(bf),A(fA)];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 r=this.markdown.split(`
169
+ `),n=r.length>1&&r.at(-1)===""?r.length-1:r.length;this._lines=r.slice(0,n),this._kb=(new TextEncoder().encode(this.markdown).length/1024).toFixed(1),this._chunks=dA(this._lines,this.markdown).map(([o,i])=>({start:o,end:i,asked:!1}))}render(){let e=this._lines.length,r=this._copied==="done"?"Copied":this._copied==="failed"?"Copy failed":"Copy",n=this._copied==="failed"?"Select the text and copy it by hand":m;return d`<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}">${g8}${r}</button></header><div class="evd-code" tabindex="0"><div class="evd-lines" style="--evd-lineno-width: ${String(e).length}ch">${this._chunks.map((o,i)=>d`<div class="evd-chunk evd-pending" data-chunk="${i}" style="--evd-chunk-lines: ${o.end-o.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 r=Number(e.dataset.chunk),n=this._chunks[r];e.textContent=`${this._lines.slice(n.start,n.end).join(`
170
+ `)}
171
+ `,sa(e,o=>{o&&(Hn(e),this._paint(e,r))})}}disconnectedCallback(){for(let e of this.renderRoot.querySelectorAll(".evd-chunk[data-watched]"))Hn(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,r){let n=this._chunks[r];if(!n||n.asked)return;n.asked=!0;let o=uA(this._lines,n.start),i=[...o?this._lines.slice(o[0],o[1]):[],...this._lines.slice(n.start,n.end)].join(`
172
+ `),s=await _o(i,"markdown");if(!this.isConnected)return;let a=s===null?null:vS(s).slice(o?o[1]-o[0]:0);e.innerHTML=b8(this._lines,n.start,n.end,a?.length===n.end-n.start?a:null),e.classList.remove("evd-pending")}};customElements.define("export-view-dialog",Rw);function hA(t){return new Promise(e=>{let r=document.createElement("export-view-dialog");r.markdown=t;let n=()=>{r.remove(),e()};r.addEventListener("resolve",n),r.addEventListener("modal-conflict",n),document.body.append(r)})}M();O();ue();fe();vc();var mA=`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:6px;background:var(--bg, var(--surface));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: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}
173
+ `;Bn();var Aw=class extends F{static styles=[...F.styles,A(Mo),A(mA)];static properties={initial:{attribute:!1},finding:{attribute:!1},canApplyToGroup:{attribute:!1},_value:{state:!0}};constructor(){super(),this.initial="",this.finding=null,this.canApplyToGroup=!1,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=()=>{let e=(this.initial??"").trim();if(this._trimmed===e){this._finish(null);return}this._finish({value:this._trimmed,scope:"finding"})};_onApplyToGroup=()=>{this._trimmed&&this._finish({value:this._trimmed,scope:"group"})};_onClear=()=>this._finish({value:"",scope:"finding"});_onCancel=()=>this._finish(null);_onKeydown=e=>{e.key==="Enter"&&(e.preventDefault(),this._onSave())};render(){let e=this.finding??{},r=e.file?e.line?`${e.file}:${e.line}`:e.file:"",n=(this.initial??"").length>0,o=this._trimmed,i=Be(o);return d`<dialog @close="${this._onClose}"><header><h3>${n?"Edit fix link":"Add fix link"}</h3><div class="finding">${Io(ae(e,l.severityMode))} ${r?d`<span class="loc" title="${r}">${r}</span>`:m}</div>${e.description?d`<div class="desc" title="${e.description}">${e.description}</div>`:m}</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}"> ${i?d`<a class="open" href="${o}" target="_blank" rel="noopener noreferrer">Open ↗</a>`:m}</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">${n?d`<button type="button" class="danger" @click="${this._onClear}">Clear</button>`:m} <span class="nwd-spacer"></span> ${this.canApplyToGroup?d`<button type="button" class="quiet" ?disabled="${!o}" @click="${this._onApplyToGroup}">Apply to whole group</button> <span class="nwd-spacer"></span>`:m} <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",Aw);function gA({initial:t="",finding:e=null,canApplyToGroup:r=!1}={}){return le("fix-link-dialog",{initial:t,finding:e,canApplyToGroup:r})}M();bt();fe();Bn();Rr();ue();bb();vc();Mc();var bA=`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: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: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)}}
174
+ `;var w8={revalidate:"Outcome",revalidateVerdict:"Explanation",revalidateRecommendation:"Recommendation"},Tw=class extends F{static styles=[...F.styles,A(Mo),A(No),A(bA)];static properties={conflicts:{attribute:!1}};constructor(){super(),this.conflicts=[]}render(){return d`<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:r})=>d`<li class="conflict-card"><div class="finding-meta">${Io(e.severity)} ${e.file?d`<span class="location">${e.file}${Mt(e.line)?`:${Ju(Mt(e.line))}`:""}</span>`:m} <code>${Ai(e.id)??e.id}</code></div><h4>${dt(e)}</h4><dl>${q_(r).map(({field:n,variants:o})=>d`<dt>${w8[n]??n}</dt>${o.map(({value:i,reports:s})=>d`<dd class="variant"><div class="value">${i||d`<em>Empty</em>`}</div><div class="reports">${s.map(a=>a?d`<button type="button" class="report-button" aria-label="${`Open ${ke(a)} at this finding`}" @click="${()=>this._finish({id:e.id,reportName:a})}">${Z(We[Ke(a)]??We.default)}<span>${ke(a)}</span></button>`:d`<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",Tw);function yA(t){return le("revalidation-conflicts-dialog",{conflicts:[...t.values()]})}Fi();ip();O();var vA=2;function wA(t,e){l.focusSplit=e,t.closest(".focus-main")?.style.setProperty("--focus-split",String(e)),t.setAttribute("aria-valuenow",String(Math.round(e)))}function kA(){try{localStorage.setItem(Ud,String(l.focusSplit))}catch{}}function xA(t,e){wA(t,ja(e)),kA()}function $A(t,e){xA(t,l.focusSplit+e)}function _A(t){xA(t,Ha)}function SA(t,e){let r=t.closest(".focus-main");if(!r)return;e.preventDefault(),t.classList.add("dragging");try{t.setPointerCapture(e.pointerId)}catch{}let n=i=>{let s=r.getBoundingClientRect();s.width!==0&&wA(t,ja((i.clientX-s.left)/s.width*100))},o=()=>{t.removeEventListener("pointermove",n),t.removeEventListener("pointerup",o),t.removeEventListener("pointercancel",o),t.classList.remove("dragging"),kA()};t.addEventListener("pointermove",n),t.addEventListener("pointerup",o),t.addEventListener("pointercancel",o)}O();Nt();Xr();ue();ot();Oe();function k8(t){return np(ko(t)).map(e=>Zr(e))}var x8={annotation(t){let e=ye(t),r=Sb(t);return!e&&!r?null:{triage:e?.triage,color:e?.color,comment:e?.comment,fix:e?.fix,flagged:e?.flagged===!0,ignored:r}},location:t=>qr(t,ur(t)),evidence:(t,e,r)=>Zu(t,e,ur(e),r),commit:t=>Qu(t.repo?.github,t.commitHash),report:t=>t._reportName??null};function $8(t,e){let r=new Set(t.map(i=>i.repo??null)),n=r.size===1?[...r][0]:null;if(n)return n;let o=new Set;for(let i of e)for(let s of i)s.repo?.github&&!It(s.file)&&o.add(s.repo.github);return o.size===1?[...o][0]:o.size===0&&!l.currentWorkspace&&l.repoUrl?l.repoUrl:null}function Mw(t){return t.replace(/\.(?:json|md|codex)$/iu,"")}function CA(){return l.currentWorkspace?re().find(t=>t.id===l.currentWorkspace)??null:null}function _8(t,e){if(e)return e.name;let r=t.map(o=>o.fileName);return r.length===1?Mw(r[0]):jl(r).replace(/[-_. ]+$/u,"")||`${r.length} reports`}function Iw(){let t=l.reports,e=Rn(),r=Sw(),n=k8(r),o=CA(),i=t.flatMap(c=>c.groups??[]),s=i.some(c=>c.some(Ut)),a=i.some(c=>c.some(d_));return hm({title:_8(t,o),workspace:o?.name??null,reports:t.map(c=>({name:c.fileName,source:c.source})),repo:$8(t,n),generatedAt:new Date,view:{bucket:Cw(),severityMode:s?l.severityMode:null,revalidation:a?l.showRevalidation:null,revalidationDetail:a&&l.showRevalidation!==!1?Tn():null},filters:_w(e),counts:{included:n.length,total:r.length},groups:n},x8)}function S8(){let t=CA(),e=l.reports.map(n=>n.fileName),r="";return t?r=t.name:e.length===1?r=Mw(e[0]):e.length>1&&(r=Mw(jl(e))),r=r.replaceAll(/[\\/:*?"<>|\p{Cc}]/gu,"-").trim(),`${r||"deepview-report"}.md`}function EA(){if(l.reports.length===0)return;let t=new Blob([Iw()],{type:"text/markdown;charset=utf-8"});hn(t,S8())}my();Fn();Pn();Fo();mc();Eo();zp();var Nw=!1;ym(()=>{if(Nw)return;Nw=!0;let t=2;function e(){--t===0&&C8()}requestAnimationFrame(e),setTimeout(e,350)});function C8(){Nw=!1,l.currentView==="bundles"&&l.selectedBundle?_():l.currentView==="packages"?_():l.currentView==="repositories"?_():l.currentView==="links"?_():(l.currentView==="findings"||l.currentView==="files")&&(ee().catch(()=>{}),$l()&&(l.findingIndexTick++,l.currentView==="findings"&&!l.currentWorkspace&&_()))}var Lw=!1;Em(()=>{l.currentView!=="findings"&&l.currentView!=="files"&&!Gt()||Lw||(Lw=!0,queueMicrotask(()=>{Lw=!1,!(l.currentView!=="findings"&&l.currentView!=="files"&&!Gt())&&(l.bundleHashTick++,_())}))});ag(()=>{l.linksTick++,_()});function RA(){l.currentView==="bundles"&&l.bundleDetailsTab==="graph"?qp():Qy()}function kf(){l.currentView==="bundles"&&l.bundleDetailsTab==="graph"?Yp():ev()}function xf(){let t=document.querySelector(".bundle-source-code-wrap"),e=t?.scrollTop??0,r=t?.scrollLeft??0;_();let n=document.querySelector(".bundle-source-code-wrap");n&&(n.scrollTop=e,n.scrollLeft=r)}function Hc(t){let r=document.querySelector(t)?.scrollTop??0;_();let n=document.querySelector(t);n&&(n.scrollTop=r)}function zo(){l.viewMode==="table"?Hc(".findings-table-list"):_()}var Fw=0;function AA(){Fw||(Fw=requestAnimationFrame(()=>{Fw=0,_()}))}function oe(t,e){for(let r of t.composedPath())if(r?.matches?.(e))return r;return null}function Bw(t,e){queueMicrotask(()=>{let r=document.querySelector(`.bundle-source-lineno-row[data-line="${t}"]`);r&&r.scrollIntoView(e)})}function FA(t){t.classList.add("copied"),setTimeout(()=>t.classList.remove("copied"),1e3)}function yf(t,e){try{navigator.clipboard.writeText(e).then(()=>(FA(t),null)).catch(()=>{})}catch{}}function BA(t){if(t.target.classList?.contains("bundle-source-overlay")||t.target.closest('[data-action="bundle-source-close"]'))return l.bundleSourceFile&&(l.bundleSourceFile=null,l.bundleSourceFindingIdx=null,_()),!0;if(t.target.closest('[data-action="bundle-source-panel-close"]'))return l.bundleSourceFindingIdx!=null&&(l.bundleSourceFindingIdx=null,xf()),!0;let e=t.target.closest("[data-bundle-source-finding]");if(e){let r=parseInt(e.dataset.bundleSourceFinding,10);return Number.isFinite(r)&&(l.bundleSourceFindingIdx=l.bundleSourceFindingIdx===r?null:r,xf()),!0}return!1}function TA(t){let e=Hw(t);if(!e)return null;let r=ft(e);return A_(r,sp(r))}T.addEventListener("click",t=>{let e=oe(t,"[data-code-nav-file]");if(e){NA(Hw(t),{integrity:e.dataset.codeNavIntegrity,file:e.dataset.codeNavFile,range:Mt(e.dataset.codeNavLine)});return}let r=oe(t,"[data-code-history]");if(r){R8(r.dataset.codeHistory==="forward"?1:-1);return}let n=oe(t,"[data-code-preview]");if(n){let S=n.dataset.codePreview,P=new Set(l.codePreviews);P.delete(S)||P.add(S),l.codePreviews=P,_();return}let o=oe(t,"[data-finding-code-bundle]");if(o){let S=o.dataset.findingCodeBundle,P=o.dataset.findingCodeFile,q=o.dataset.findingCodeLine,X=q?parseInt(q,10):null;l.bundleSourceFile=P||null,l.bundleSourceFindingIdx=null,(l.bundleDetailsTab==="code"||l.bundleDetailsTab==="search")&&(l.bundleDetailsTab="overview");let Ae=()=>{Number.isFinite(X)&&Bw(X,{block:"start",behavior:"instant"})};if(l.selectedBundle===S&&l.bundleDetails?.integrity===S){_(),Ii().then(()=>(l.selectedBundle===S&&l.bundleSourceFile===P&&Ae(),null));return}l.selectedBundle=S,l.bundleDetails=null,_(),(async()=>(await Ln(S),Ae()))();return}let i=t.target.closest("[data-package-expand]");if(i){let S=i.dataset.packageExpand;l.expandedPackages.has(S)?l.expandedPackages.delete(S):l.expandedPackages.add(S),_();return}let s=t.target.closest("[data-package-row-issues]");if(s){let S=s.dataset.packageRowIssues,P=s.dataset.packageRowIssuesVersion;l.selectedPackage=S,l.selectedPackageVersion=P||null,l.packageDetailsTab="issues",l.packageSlideTriage=null,l.packageSlideTransient=!0,_();return}let a=t.target.closest("[data-repository-row-issues]");if(a){let S=a.dataset.repositoryRowIssues;l.selectedRepository=S,l.repositoryDetailsTab="issues",l.repositorySlideTriage=null,l.repositorySlideTransient=!0,_();return}let c=t.target.closest("[data-select-package]");if(c){let S=c.dataset.selectPackage,P=c.dataset.selectPackageVersion??"",q=P===""?null:P;if(l.selectedPackage===S&&l.selectedPackageVersion===q)return;l.selectedPackage=S,l.selectedPackageVersion=q,l.packageDetailsTab="overview",l.packageSlideTriage=null,l.packageSlideTransient=!1,_();return}if(t.target.closest("[data-deselect-package]")){l.selectedPackage=null,l.selectedPackageVersion=null,_();return}let u=t.target.closest("[data-package-tab]");if(u){let S=u.dataset.packageTab;(S==="overview"||S==="issues")&&l.packageDetailsTab!==S&&(l.packageDetailsTab=S,_());return}if(t.target.closest('[data-action="package-slide-back"]')){l.packageDetailsTab="overview",l.packageSlideTriage=null,l.packageSlideTransient&&(l.selectedPackage=null,l.selectedPackageVersion=null,l.packageSlideTransient=!1),_();return}let p=oe(t,"[data-links-report][data-links-finding]");if(p){t.preventDefault();let{linksReport:S,linksFinding:P,managedReport:q}=p.dataset;S&&P&&(async()=>{let X=await gw(P,S,q);X.ok||alert(X.reason)})().catch(X=>console.warn("links: reveal in report failed:",X));return}let f=t.target.closest("[data-package-report]");if(f){let S=f.dataset.packageReport;S&&Bt(S);return}let h=t.target.closest("[data-select-repository]");if(h){let S=h.dataset.selectRepository;if(l.selectedRepository===S)return;l.selectedRepository=S,l.repositoryDetailsTab="overview",l.repositorySlideTriage=null,l.repositorySlideTransient=!1,_();return}if(t.target.closest("[data-deselect-repository]")){l.selectedRepository=null,_();return}let g=t.target.closest("[data-repository-tab]");if(g){let S=g.dataset.repositoryTab;(S==="overview"||S==="issues")&&l.repositoryDetailsTab!==S&&(l.repositoryDetailsTab=S,_());return}if(t.target.closest('[data-action="repository-slide-back"]')){l.repositoryDetailsTab="overview",l.repositorySlideTriage=null,l.repositorySlideTransient&&(l.selectedRepository=null,l.repositorySlideTransient=!1),_();return}let y=t.target.closest("[data-bundle-tab]");if(y){let S=y.dataset.bundleTab;if(kc.has(S)){if(S===l.bundleDetailsTab){l.selectedBundle&&Oo(l.selectedBundle,S);return}l.bundleDetailsTab==="graph"&&S!=="graph"&&(it(),document.body.classList.remove("report-fullscreen")),l.bundleDetailsTab=S,l.bundleSourceFile=null,l.bundleSourceFindingIdx=null,l.selectedBundle&&Oo(l.selectedBundle,S),_(),S==="code"&&Ii().then(()=>(l.bundleDetailsTab==="code"&&Sc(),null))}return}let b=t.target.closest("[data-bundle-download]");if(b){let S=b.dataset.bundleDownload,P=(l.bundles??[]).find(q=>q.integrity===S);if(!P)return;(async()=>{let{confirmed:q}=await nA({name:P.name,encrypted:de()});if(q)try{let X=await bn(S);hn(new Blob([X],{type:"application/octet-stream"}),P.name)}catch(X){alert(`Failed to download bundle: ${X.message}`)}})();return}let v=t.target.closest("[data-bundle-export-sbom]");if(v){let S=v.dataset.bundleExportSbom,P=l.bundleDetails,q=(l.bundles??[]).find(X=>X.integrity===l.selectedBundle);if(!q||!P||P.integrity!==q.integrity)return;try{let X=S==="cyclonedx",Ae=X?xC(P,q):$C(P,q),Ze=`${Ep(q.name)}.${X?"cdx":"spdx"}.json`;hn(new Blob([Ae],{type:"application/json"}),Ze)}catch(X){alert(`Failed to export ${S==="cyclonedx"?"CycloneDX":"SPDX"}: ${X.message}`)}return}if(oe(t,"[data-bundle-search-context]")){l.bundleSearchContext=!l.bundleSearchContext,Hc(".bundle-search-results");return}if(t.target.closest("[data-advisories-consent]")){e2(),_();return}if(t.target.closest("[data-advisories-retry]")){r2(l.bundleDetails,_).catch(()=>{}),_();return}let k=t.target.closest("[data-bundle-issue-report]");if(k){let S=k.dataset.bundleIssueReport;S&&Bt(S);return}if(BA(t))return;let $=t.target.closest("[data-bundle-code-issue-step]");if($){let S=$.closest("[data-bundle-code-issue-order]"),P=null;try{P=JSON.parse(S?.dataset.bundleCodeIssueOrder??"null")}catch{}if(Array.isArray(P)&&P.length>0){let q=$.dataset.bundleCodeIssueStep==="-1"?-1:1,X=P.findIndex(Ze=>Ze.idx===l.bundleSourceFindingIdx),Ae=X===-1?q>0?P[0]:P.at(-1):P[(X+q+P.length)%P.length];l.bundleSourceFindingIdx=Ae.idx,xf(),Ae.line>0&&Bw(Ae.line,{block:"center",behavior:"smooth"})}return}let C=oe(t,"[data-bundle-view-source]");if(C){let S=C.dataset.bundleViewSource;if(!S)return;let P=C.dataset.bundleViewFindingIdx,q=P===void 0?null:parseInt(P,10),X=C.dataset.bundleViewLine,Ae=X?parseInt(X,10):null,Ze=l.bundleSourceFile!==S;if(l.bundleSourceFile=S,Number.isFinite(q)?l.bundleSourceFindingIdx=q:Ze&&(l.bundleSourceFindingIdx=null),C.closest(".bundle-code-rail")?Hc(".bundle-code-rail-body"):C.closest(".bundle-search-results")?Hc(".bundle-search-results"):C.closest(".bundles-slide-body")?Hc(".bundles-slide-body"):_(),Number.isFinite(Ae)){let Pt=C.dataset.bundleViewScrollBlock||"center";Ii().then(()=>(l.bundleSourceFile===S&&Bw(Ae,{block:Pt,behavior:"smooth"}),null))}return}if(t.target.closest('[data-action="toggle-files"]')){l.currentView==="files"?l.currentView="findings":(l.viewMode==="graph"&&it(),l.currentView="files"),document.body.classList.remove("report-fullscreen"),_();return}let E=oe(t,"[data-g2-pkg]");if(E){let S=E.dataset.g2Pkg;R.solo=R.solo===S?null:S,R.solo&&(R.selected=null),RA(),kf(),R.graphState?.requestDraw?.();return}let B=oe(t,"[data-g2-select]");if(B){R.selected=B.dataset.g2Select,RA(),R.graphState?.requestDraw?.();return}let N=oe(t,"[data-g2-top-pkgs]");if(N){R.topPkgsTab=N.dataset.g2TopPkgs,kf();return}let K=oe(t,"[data-g2-jump-findings]");if(K){if(l.currentView==="bundles"){l.bundleDetailsTab==="graph"&&it(),l.bundleDetailsTab="issues",l.bundleSourceFile=null,l.bundleSourceFindingIdx=null,l.selectedBundle&&Oo(l.selectedBundle,"issues"),_();return}Ls(),l.filterConfMin=0,l.filterInclude=K.dataset.g2JumpFindings,l.currentView="findings",l.viewMode==="graph"&&(l.viewMode="table"),it(),_();return}let W=oe(t,"[data-g2-jump-file]");if(W){let S=W.dataset.g2JumpFile;l.currentView="files",it(),_(),requestAnimationFrame(()=>{let P=document.querySelector(`#${hc(S)}`);P&&P.scrollIntoView({behavior:"smooth",block:"start"})});return}if(oe(t,"#g2-path-filter-clear")){R.pathFilter="";let S=document.querySelector("graph-layout")?.shadowRoot?.querySelector("#g2-path-filter");S&&(S.value=""),R.graphState?.requestDraw?.();return}if(oe(t,"#g2-fullscreen")){document.body.classList.toggle("report-fullscreen");return}if(oe(t,"[data-g2-show-all]")){R.showAll=!R.showAll,R.layoutCache=null,R.selected=null,it(),_();return}if(oe(t,"[data-g2-split-own]")){R.splitOwnDirs=!R.splitOwnDirs,R.layoutCache=null,R.solo=null,R.focusedPkg=null,(R.packagesView||R.bundleLayout==="layers")&&(R.selected=null),it(),_();return}if(oe(t,"[data-g2-packages-view]")){R.bundleLayout==="dependencies"?(R.dependencyPackagesView=!R.dependencyPackagesView,R.solo=null):R.packagesView=!R.packagesView,R.layoutCache=null,R.selected=null,R.focusedPkg=null,it(),_();return}let ce=oe(t,"[data-g2-layout]");if(ce){let S=ce.dataset.g2Layout;if(S!=="graph"&&S!=="layers"&&S!=="matrix"&&S!=="dependencies"||R.bundleLayout===S&&!R.focusedPkg)return;R.bundleLayout=S,S==="dependencies"&&(R.dependencyPackagesView=!1),R.layoutCache=null,R.selected=null,R.solo=null,R.focusedPkg=null,it(),_();return}let Zt=oe(t,".graph2-triage-selector [data-triage-show]");if(Zt){let S=Zt.dataset.triageShow;l.shownTriage=l.shownTriage===S?null:S,R.layoutCache=null,R.selected=null,it(),_();return}let Xe=oe(t,"[data-g2-focus-pkg]");if(Xe){R.focusedPkg=Xe.dataset.g2FocusPkg,R.layoutCache=null,it(),_();return}if(oe(t,"#g2-back-to-full")){R.focusedPkg=null,R.layoutCache=null,(R.packagesView||R.bundleLayout==="layers")&&(R.selected=null),it(),_();return}let ht=oe(t,".tab");if(ht&&oe(t,".tabs")){let P=oe(t,"[data-gid]").dataset.gid,q=ht.dataset.tid;l.activeTabByGroup.set(P,q),zo();return}let jn=oe(t,"[data-triage-action]");if(jn){let S=jn.closest(".triage-menu"),P=S?.dataset.gid;if(!P)return;let q=Yt(P);if(!q)return;let X=jn.dataset.triageAction;if(!["inprogress","fixed","invalid","deleted","ignored","restore"].includes(X))return;let{targets:Ae,clearing:Ze}=lS(q,X);if(Ae.length===0)return;OA(Ae,Ze?"untriaged":X);try{S.hidePopover()}catch{}we(),zo();return}if(oe(t,".mark-comment")){let P=oe(t,"[data-gid]").dataset.gid,q=Yt(P);if(!q)return;let X=ft(q);if(!De(X))return;let Ae=j(X),Ze=ye(X)?.comment??"";rA({initial:Ze,finding:X}).then(Pt=>(Pt===null||!De(X)||(G(l.triage,Ae,{comment:Pt||void 0}),we(),zo()),null)).catch(()=>{});return}let da=oe(t,".mark-copy");if(da){let S=TA(t);if(S===null)return;yf(da,S);return}let qc=oe(t,".mark-link");if(qc){let S=oe(t,"[data-gid]"),P=S?Yt(S.dataset.gid):null;if(!P)return;let q=xp(ft(P));if(!q)return;yf(qc,q);return}let ua=oe(t,"[data-copy-report]");if(ua){yf(ua,ua.dataset.copyReport);return}let Ki=oe(t,"[data-copy-path]");if(Ki){yf(Ki,Ki.dataset.copyPath);return}let pa=oe(t,".mark-claude");if(pa){let S=TA(t);if(S===null)return;let P=`claude://code/new?q=${encodeURIComponent(`Confirm and fix:
175
+
176
+ ${S}`)}`;try{window.location.href=P,FA(pa)}catch{}return}if(oe(t,".mark-fix")){let P=oe(t,"[data-gid]")?.dataset.gid,q=P?Yt(P):null;if(!q)return;let X=ft(q);if(!De(X))return;let Ae=uS(q),Ze=ye(X)?.fix??"";gA({initial:Ze,finding:X,canApplyToGroup:aS(Ae,Ze)}).then(Pt=>{if(Pt===null||!De(X))return null;let ha=Pt.scope==="group"?Ae.filter(Vn=>De(Vn)&&(Vn===X||Cb(Vn,Ze))):[X],Gi=!1;for(let Vn of ha)G(l.triage,j(Vn),{fix:Pt.value||void 0})&&(Gi=!0);return Gi&&(ha.length>1&&l.activeTabByGroup.set(P,j(X)),zo(),queueMicrotask(we)),null}).catch(()=>{});return}let Yc=oe(t,"[data-flag-toggle]");if(Yc){let S=Yc.dataset.flagToggle,P=oe(t,"[data-gid]")?.dataset.gid,q=(P?Yt(P):null)?.find(Ae=>j(Ae)===S);if(!q||!De(q))return;let X=ye(q)?.flagged;G(l.triage,S,{flagged:X!==!0}),we(),zo();return}let Xc=t.target.closest("[data-triage-show]");if(Xc&&!Xc.closest(".graph2-triage-selector")){let S=Xc.dataset.triageShow;l.shownTriage=l.shownTriage===S?null:S,_();return}if(t.target.closest("[data-table-deselect]")){l.tableSelectedGid=null,zo();return}let fa=t.target.closest("[data-tree-select]");if(fa){let S=fa.dataset.treeSelect;l.filesSelectedFile=l.filesSelectedFile===S?null:S,_();return}t.target.closest("[data-tree-deselect]")&&(l.filesSelectedFile=null,_())});var MA=document.querySelector("#bundle-source-overlay-slot");MA&&MA.addEventListener("click",BA);function $f(t){let e=t?Yt(t):null;e&&ap(e)&&queueMicrotask(we)}T.addEventListener("row-select",t=>{let e=t.detail?.gid;if(!e)return;let r=l.tableSelectedGid!==e;l.tableSelectedGid=r?e:null,r&&$f(e),zo()});var _f="application/x-deepview-kanban-gid";function OA(t,e){for(let r of t){if(!De(r))continue;let n=j(r),o=_b(r);e==="untriaged"?(G(l.triage,n,{triage:void 0}),pt(l.triage,n,o,!1)):e==="ignored"?(G(l.triage,n,{triage:void 0}),pt(l.triage,n,o,!0)):(G(l.triage,n,{triage:e}),pt(l.triage,n,o,!1))}}function Dw(){for(let t of T.querySelectorAll(".kanban-card.dragging"))t.classList.remove("dragging");for(let t of T.querySelectorAll(".kanban-column.drag-over"))t.classList.remove("drag-over")}T.addEventListener("dragstart",t=>{let e=t.target.closest?.(".kanban-card[data-kanban-source]");if(!e||!t.dataTransfer)return;let r=e.dataset.gid;if(!r)return;let n=Yt(r);if(!n||xo(n).length===0){t.preventDefault();return}t.dataTransfer.setData(_f,r),t.dataTransfer.setData("text/plain",r),t.dataTransfer.effectAllowed="move",e.classList.add("dragging")});T.addEventListener("dragend",Dw);T.addEventListener("dragover",t=>{if(!t.dataTransfer?.types.includes(_f))return;let e=t.target.closest?.(".kanban-column[data-kanban-target]");if(e&&(t.preventDefault(),t.dataTransfer.dropEffect="move",!e.classList.contains("drag-over"))){for(let r of T.querySelectorAll(".kanban-column.drag-over"))r!==e&&r.classList.remove("drag-over");e.classList.add("drag-over")}});T.addEventListener("dragleave",t=>{let e=t.target.closest?.(".kanban-column[data-kanban-target]");e&&(e.contains(t.relatedTarget)||e.classList.remove("drag-over"))});T.addEventListener("drop",t=>{if(!t.dataTransfer?.types.includes(_f))return;let e=t.target.closest?.(".kanban-column[data-kanban-target]");if(!e){Dw();return}t.preventDefault();let r=t.dataTransfer.getData(_f),n=e.dataset.kanbanTarget;if(Dw(),!r||!n)return;let o=Yt(r);if(!o||(ze(o).commonTriage??"untriaged")===n)return;let s=xo(o);s.length!==0&&(OA(s,n),_(),queueMicrotask(we))});var Ow=!1;function ji(t){return t?T.querySelector(`.kanban-card[data-gid="${CSS.escape(t)}"]`):null}function vf(t){let e=t??T.querySelector(".kanban-card");if(!e)return;let r=e.getBoundingClientRect();r.width<=0||r.height<=0||(document.documentElement.style.setProperty("--kanban-clip-card-w",`${Math.floor(r.width)}px`),document.documentElement.style.setProperty("--kanban-clip-card-h",`${Math.floor(r.height)}px`),document.documentElement.style.setProperty("--kanban-return-card-bg",getComputedStyle(e).backgroundColor))}function E8(){let t=T.querySelector(".kanban-detail-side [data-kanban-select].active");t&&t.scrollIntoView({block:"nearest",behavior:"instant"})}function Pw(t){l.kanbanPopoverGid=t,l.focusCodeStack=[],l.focusCodeAt=0}function IA(){E8(),Ao()}function Vi(t){let e=l.kanbanPopoverGid;if(e===t)return;let r=e===null&&t!==null,n=e!==null&&t===null;if(!document.startViewTransition||!r&&!n){$f(t),Pw(t),_(),IA();return}if(Ow)return;$f(t),Ow=!0;let o=r?"kanban-opening":"kanban-closing";document.documentElement.classList.add(o);let i=u=>{u&&(u.style.viewTransitionName=""),document.documentElement.classList.remove(o),Ow=!1};if(r){let u=ji(t);u?(vf(u),u.style.viewTransitionName="kanban-detail-modal",u.getBoundingClientRect()):vf(),Pw(t);let p=document.startViewTransition(()=>{_(),IA(),u&&(u.style.viewTransitionName="")}),f=setTimeout(()=>i(u),600);(async()=>{try{await p.finished}catch{}clearTimeout(f),i(u)})();return}vf(),Pw(t);let s=null,a=document.startViewTransition(()=>{_(),s=ji(e),s&&(vf(s),s.style.viewTransitionName="kanban-detail-modal")}),c=setTimeout(()=>i(s??ji(e)),600);(async()=>{try{await a.finished}catch{}clearTimeout(c),i(s??ji(e))})()}function PA(t){let e=ji(l.kanbanPopoverGid),r=e?.closest(".kanban-column");if(!r)return;let n=[...r.querySelectorAll(".kanban-card[data-kanban-source]")],o=n.indexOf(e);if(o<0)return;let i=Math.min(Math.max(o+t,0),n.length-1);if(i===o)return;let s=n[i].dataset.gid;if(!s)return;Vi(s);let a=ji(s);a&&(a.focus({preventScroll:!0}),a.scrollIntoView({block:"nearest",behavior:"instant"}))}var wf=null;function zw(){op(),l.focusCodeStack=[],l.focusCodeAt=0,_(),wf?.isConnected&&wf.focus({preventScroll:!0}),wf=null}T.addEventListener("click",t=>{let e=t.target.closest?.("[data-links-preview]");if(e){t.preventDefault(),wf=e;let s=e.dataset.previewRow,a=Q_(e.dataset.linksPreview,e.dataset.previewReport,s===void 0?void 0:Number(s));_(),T.querySelector(".kanban-detail-close")?.focus({preventScroll:!0}),a.then(()=>{_(),Ao();let c=Gt()?.group?.[0]._bundleHashes;if(Array.isArray(c))for(let u of c)ic(u).catch(()=>{});return null});return}if(t.target.closest?.(".kanban-detail-close")){if(Gt()){zw();return}Vi(null);return}if(t.target.closest?.("[data-kanban-detail-fullscreen]")){l.kanbanDetailFullscreen=!l.kanbanDetailFullscreen;try{localStorage.setItem(Hd,String(l.kanbanDetailFullscreen))}catch{}_(),Ao();return}let r=t.target.closest?.("[data-kanban-expand]");if(r){let s=r.dataset.kanbanExpand,a=l.kanbanExpandedColumn===s?null:s;l.kanbanExpandedColumn=a,a&&l.kanbanPopoverGid&&ji(l.kanbanPopoverGid)?.closest(".kanban-column")?.dataset.kanbanTarget!==a&&(l.kanbanPopoverGid=null),_();return}let n=t.target.closest?.("[data-kanban-nav]");if(n){PA(n.dataset.kanbanNav==="next"?1:-1);return}let o=t.target.closest?.("[data-kanban-select]");if(o){if(window.getSelection?.()?.toString())return;let s=o.dataset.gid;s&&Vi(s);return}if(t.target.closest?.(".kanban-action"))return;let i=t.target.closest?.(".kanban-card[data-kanban-source]");if(i){if(window.getSelection?.()?.toString())return;let s=i.dataset.gid;if(!s)return;Vi(l.kanbanPopoverGid===s?null:s);return}if(!t.target.closest?.(".kanban-detail-modal, .kanban-detail-side")){if(Gt()){zw();return}l.kanbanPopoverGid&&Vi(null)}});T.addEventListener("change",t=>{let e=t.target.closest?.("[data-kanban-column]");if(!e)return;let r=e.selectedOptions[0]?.dataset.gid;r&&Vi(r)});document.addEventListener("keydown",t=>{if(t.key==="Escape"){if(Gt()){!t.defaultPrevented&&!UA(t)&&!document.querySelector(":popover-open")&&zw();return}if(l.kanbanPopoverGid){Vi(null);return}l.viewMode!=="kanban"||l.kanbanExpandedColumn===null||(l.kanbanExpandedColumn=null,_())}});function Hw(t){let r=oe(t,"[data-gid]")?.dataset?.gid;return r?Yt(r):null}function NA(t,e){if(!e.integrity||!e.file)return;let r=lc(t);if(!r)return;let n=WS(r,e);n&&(l.focusCodeStack=n.stack,l.focusCodeAt=n.at,_()),Ao()}T.addEventListener("keydown",t=>{if(t.key!=="Enter"&&t.key!==" ")return;let e=oe(t,"[data-code-nav-file]");e&&(t.preventDefault(),NA(Hw(t),{integrity:e.dataset.codeNavIntegrity,file:e.dataset.codeNavFile,range:Mt(e.dataset.codeNavLine)}))});function R8(t){let e=KS(l.focusCodeStack,l.focusCodeAt,t);e!==l.focusCodeAt&&(l.focusCodeAt=e,_(),Ao())}function DA(t){if(!t||l.focusGid===t)return;$f(t),l.focusGid=t,l.focusCodeStack=[],l.focusCodeAt=0,_();let e=T.querySelector(".focus-side-card.active");e&&e.scrollIntoView({block:"nearest",behavior:"instant"}),Ao()}function zA(t){let e=[...T.querySelectorAll(".focus-side-card[data-focus-select]")];if(e.length===0)return;let r=e.findIndex(i=>i.classList.contains("active")),n=r<0?t>0?0:e.length-1:Math.min(Math.max(r+t,0),e.length-1);if(n===r)return;let o=e[n].dataset.gid;o&&DA(o)}T.addEventListener("click",t=>{let e=t.target.closest?.("[data-focus-nav]");if(e){zA(e.dataset.focusNav==="next"?1:-1);return}let r=t.target.closest?.(".focus-side-card[data-focus-select]");if(!r||window.getSelection?.()?.toString())return;let n=r.dataset.gid;n&&DA(n)});T.addEventListener("pointerdown",t=>{if(t.button!==0)return;let e=t.target.closest?.("[data-focus-splitter]");e&&SA(e,t)});T.addEventListener("dblclick",t=>{let e=t.target.closest?.("[data-focus-splitter]");e&&_A(e)});function UA(t){if(document.querySelector("dialog[open]"))return!0;for(let e of t.composedPath()){if(!e||e.nodeType!==1)continue;let r=e.tagName;if(r==="INPUT"||r==="TEXTAREA"||r==="SELECT"||r==="DIALOG"&&e.open||e.isContentEditable)return!0}return!1}document.addEventListener("keydown",t=>{if(l.currentView!=="findings")return;let e=l.viewMode==="focus",r=l.viewMode==="kanban"&&l.kanbanPopoverGid!==null;if(!e&&!r||t.metaKey||t.ctrlKey||t.altKey||t.shiftKey||UA(t))return;let n=0;if(t.key==="ArrowRight")n=1;else if(t.key==="ArrowLeft")n=-1;else return;t.preventDefault();let o=t.target?.closest?.("[data-focus-splitter]");if(o){$A(o,n*vA);return}e?zA(n):PA(n)});T.addEventListener("mark-color",t=>{let e=oe(t,"[data-gid]");if(!e)return;let r=e.dataset.gid,n=Yt(r);if(!n)return;let o=ft(n);if(!De(o))return;let i=j(o),s=t.detail?.color;if(!s)return;ye(o)?.color===s?G(l.triage,i,{color:void 0}):G(l.triage,i,{color:s}),we(),zo()});var Wi=null,Uw=null,aa=null;function HA(){if(Wi!==null)return;if(l.reports.length===0){aa=null;return}Wi=l.viewMode,Uw=document.title;let t=!1;l.viewMode==="table"&&(l.viewMode="list",t=!0),aa&&(Gl(aa),t=!0),t&&_();for(let n of T.querySelectorAll("finding-card"))n.ensureRendered({sync:!0});let e=l.reports.map(n=>n.fileName),r="";e.length===1?r=e[0]:e.length>1&&(r=jl(e)),r=r.replace(/\.json$/u,""),r&&(document.title=r)}function jA(){if(Wi===null)return;let t=!1;l.viewMode!==Wi&&(l.viewMode=Wi,t=!0),aa&&(ql(),aa=null,t=!0),t&&_(),document.title=Uw,Wi=null,Uw=null}window.addEventListener("beforeprint",HA);window.addEventListener("afterprint",jA);async function A8(t){if(Wi===null){aa=t,HA();try{await Promise.all([...T.querySelectorAll("finding-card")].map(e=>e.ensureRendered())),window.print()}catch(e){throw jA(),e}}}function LA(t,e){if(!t)return e();Gl(t);try{return e()}finally{ql()}}document.addEventListener("download-requested",async()=>{if(l.reports.length===0)return;let{confirmed:t,view:e,fields:r,mode:n}=await lA("download");if(e){await hA(LA(r,()=>Iw()));return}if(t){if(n==="print"){await A8(r);return}LA(r,()=>EA())}});T.addEventListener("analyzer-change",t=>{l.filterAnalyzer=t.detail.analyzer,l.filterModel=t.detail.model,_()});T.addEventListener("repo-change",t=>{l.filterRepo=t.detail.value,_()});T.addEventListener("revalidate-change",t=>{l.filterRevalidate=t.detail.value,_()});T.addEventListener("partial-change",t=>{l.filterPartial=t.detail.value,_()});T.addEventListener("revalidation-change",t=>{l.showRevalidation=t.detail.on,!t.detail.on&&l.reports.some(r=>(r.groups??[]).some(n=>n.some(o=>!o.isApp&&(o.isUpstream||It(o.file)))))?On("App mode off is not recommended; it can conflate triage for issues in dependencies.",{kind:"warning"}):t.detail.on&&Ty(),bo(l.showRevalidation,l.upstreamOnly),Fs(Mn(),{resetSort:!1}),_()});T.addEventListener("revalidation-conflicts-open",()=>{(async()=>{let t=await yA(l.revalidateConflicts);if(!t)return;let e=await gw(t.id,t.reportName);e.ok||alert(e.reason)})().catch(t=>console.warn("revalidation: open conflicting finding failed:",t))});T.addEventListener("revalidation-detail-change",t=>{l.revalidationDetailed=t.detail.on===!0,_()});T.addEventListener("upstream-only-change",t=>{if(l.upstreamOnly=t.detail.on===!0,bo(l.showRevalidation,l.upstreamOnly),!l.upstreamOnly){let e=Mn();fb(e,tp(e))==="confirmed"&&(l.filterRevalidate="confirmed",l.filterPartial="")}_()});T.addEventListener("bundle-search-mode-change",t=>{let e=t.detail?.mode;e!=="files"&&e!=="code"&&e!=="issues"||(l.bundleCodeSearchMode=e,_(),e==="files"&&Sc())});T.addEventListener("bundle-graph-reason-change",t=>{let e=t.detail?.reason;e!==null&&typeof e!="string"||(R.bundleReason=e,R.layoutCache=null,R.selected=null,R.solo=null,R.focusedPkg=null,it(),_())});T.addEventListener("bundle-search-regex-toggle",()=>{l.bundleSearchRegex=!l.bundleSearchRegex,_()});T.addEventListener("bundle-search-case-toggle",()=>{l.bundleSearchCase=!l.bundleSearchCase,_()});T.addEventListener("bundle-swap",t=>{let e=t.detail?.integrity;!e||!(l.bundles??[]).some(r=>r.integrity===e)||(Ro(e,"compare"),Oo(e,"compare"),_(),ee(),Ln(e))});T.addEventListener("sort-change",t=>{let{kind:e,value:r}=t.detail;if(e==="findings")l.sortBy=r;else if(e==="packages")l.packagesSortBy=r;else if(e==="repositories")l.repositoriesSortBy=r;else return;_()});T.addEventListener("range-change",t=>{t.target.id==="conf-range"&&(l.filterConfMin=t.detail.low,l.filterConfMax=t.detail.high,_())});T.addEventListener("input",t=>{let e=t.composedPath()[0],r=e?.id,n=e?.value;r==="g2-path-filter"&&(R.pathFilter=n,R.graphState?.requestDraw?.())});T.addEventListener("search-input",t=>{if(!t.detail)return;let{kind:e,value:r}=t.detail;if(e==="findings"){l.filterInclude=r,r||(l.filterIncludeNegate=!1),AA();return}else if(e==="files")l.filesSearch=r;else if(e==="packages")l.packagesSearchQuery=r;else if(e==="repositories")l.repositoriesSearchQuery=r;else if(e==="bundle-code")l.bundleCodeSearchQuery=r;else if(e==="bundle-search"){l.bundleSearchQuery=r,AA();return}else return;_()});T.addEventListener("search-negate-toggle",()=>{l.filterIncludeNegate=!l.filterIncludeNegate,_()});T.addEventListener("severity-toggle",t=>{let e=t.detail.severity;if(t.detail.kind==="graph"){R.selectedSeverities.has(e)?R.selectedSeverities.delete(e):R.selectedSeverities.add(e),t.composedPath()[0].selected=[...R.selectedSeverities],R.graphState?.requestDraw?.(),kf();return}l.filterSeverities.has(e)?l.filterSeverities.delete(e):l.filterSeverities.add(e),_()});T.addEventListener("color-toggle",t=>{let e=t.detail.color;if(t.detail.kind==="graph"){R.selectedColors.has(e)?R.selectedColors.delete(e):R.selectedColors.add(e),t.composedPath()[0].selected=[...R.selectedColors],R.graphState?.requestDraw?.(),kf();return}l.filterColors.has(e)?l.filterColors.delete(e):l.filterColors.add(e),_()});T.addEventListener("source-toggle",t=>{let e=t.detail.source,r=l.filterSources.has(e);l.filterSources.clear(),r||l.filterSources.add(e),_()});T.addEventListener("annotation-filter-toggle",t=>{let e=t.detail?.key,r=n=>n===""?"with":n==="with"?"without":"";if(e==="comment")l.filterComment=r(l.filterComment);else if(e==="fix")l.filterFix=r(l.filterFix);else if(e==="flag")l.filterFlagged=r(l.filterFlagged);else if(e==="duplicates"&&!l.currentWorkspace)l.filterDuplicates=r(l.filterDuplicates);else if(e==="cross-context")l.filterCrossContext=r(l.filterCrossContext);else if(e==="app-stacked")l.filterAppStacked=r(l.filterAppStacked);else return;_()});T.addEventListener("slide-triage-toggle",t=>{let{kind:e,value:r}=t.detail;if(e==="package")l.packageSlideTriage=l.packageSlideTriage===r?null:r;else if(e==="repository")l.repositorySlideTriage=l.repositorySlideTriage===r?null:r;else return;_()});T.addEventListener("view-mode-change",t=>{if(t.detail.kind==="files"){l.filesViewMode=t.detail.mode,_();return}l.viewMode=t.detail.mode,l.viewMode!=="kanban"&&(l.kanbanPopoverGid=null),l.viewMode!=="focus"&&(l.focusGid=null),_()});T.addEventListener("severity-mode-change",t=>{let e=t.detail?.mode;if(!(e!=="corrected"&&e!=="original")){l.severityMode=e;try{localStorage.setItem(zd,e)}catch{}_()}});T.addEventListener("repo-edit-start",()=>{l.repoEditing=!0,_()});T.addEventListener("repo-input",t=>{l.repoUrl=t.detail.url,kr(l.currentFile,l.repoUrl)});T.addEventListener("repo-commit",t=>{l.repoUrl=t.detail.url,kr(l.currentFile,l.repoUrl),l.repoEditing=!1,_()});T.addEventListener("repo-cancel",t=>{l.repoUrl=t.detail.url,kr(l.currentFile,l.repoUrl),l.repoEditing=!1,_()});document.addEventListener("keydown",t=>{if(t.key==="Escape"){if(l.bundleSourceFindingIdx!=null){l.bundleSourceFindingIdx=null,xf();return}if(l.bundleSourceFile){if(l.currentView==="bundles"&&l.bundleDetailsTab==="code")return;l.bundleSourceFile=null,_()}}});M();function Ye(t,e){for(let[r,n]of Object.entries(e))t.hasAttribute(r)||t.setAttribute(r,n)}var VA=`:host{position:absolute;top:.5rem;right:.5rem;z-index:1000;width:30px;height:30px;background:transparent;color:var(--muted);border:0;border-radius:6px;font-size:1rem;line-height:1;font-family:inherit;display:flex;align-items:center;justify-content:center;transition:color .12s,background .12s;cursor:default;user-select:none}:host(:hover){color:var(--text);background:rgb(from var(--text) r g b / .06)}:host(:focus-visible){outline:2px solid var(--accent);outline-offset:2px}@media print{:host{display:none!important}}@media(display-mode:window-controls-overlay){:host{-webkit-app-region:no-drag;app-region:no-drag}}
177
+ `;var jw="deepview.theme",la=Object.freeze(["dark","light","green","pink"]),M8={dark:{base:"#1a1a1b",dim:"#0a0a0a"},light:{base:"#f6f6fa",dim:"#646464"},green:{base:"#0a140a",dim:"#050a05"},pink:{base:"#ffe4ee",dim:"#a3727f"}},I8="\u2600",L8="\u263E",Vw="deepview-theme-changed",Sf="dark",Kw=!1;function F8(){try{let t=localStorage.getItem(jw);return la.includes(t)?t:"dark"}catch{return"dark"}}function jc(t){la.includes(t)||(t="dark"),Sf=t;for(let r of la)r!=="dark"&&document.body.classList.remove(`theme-${r}`);t!=="dark"&&document.body.classList.add(`theme-${t}`);try{t==="dark"?localStorage.removeItem(jw):localStorage.setItem(jw,t)}catch{}let e=document.querySelector('meta[name="theme-color"]');if(e){let{base:r,dim:n}=M8[t];e.setAttribute("content",Kw?n:r)}window.dispatchEvent(new CustomEvent(Vw,{detail:{theme:t}}))}jc(F8());window.addEventListener("beforeprint",()=>{Kw=!0,jc(Sf)});window.addEventListener("afterprint",()=>{Kw=!1,jc(Sf)});function WA(t){if(!la.includes(t))throw new TypeError(`DeepView.setTheme: unknown theme ${JSON.stringify(t)} (expected one of ${la.map(e=>JSON.stringify(e)).join(", ")})`);jc(t)}function KA(){return Sf}var GA=la,Ww=class extends J{static properties={_light:{state:!0}};static styles=A(VA);constructor(){super(),this._light=document.body.classList.contains("theme-light")}connectedCallback(){super.connectedCallback(),Ye(this,{role:"button",tabindex:"0","aria-label":"toggle theme"}),this.addEventListener("click",this._toggle),this.addEventListener("keydown",this._onKeydown),window.addEventListener(Vw,this._onThemeChanged)}disconnectedCallback(){window.removeEventListener(Vw,this._onThemeChanged),this.removeEventListener("click",this._toggle),this.removeEventListener("keydown",this._onKeydown),super.disconnectedCallback()}_onThemeChanged=()=>{this._light=document.body.classList.contains("theme-light")};_toggle=()=>{let e=document.body.classList.contains("theme-light");jc(e?"dark":"light")};_onKeydown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._toggle())};render(){return d`${this._light?L8:I8}`}};customElements.define("theme-toggle",Ww);M();vt();ot();M();$e();go();ot();fc();var qA=`:host{display:block}.row{display:grid;grid-template-columns:5.5rem minmax(0,1fr);gap:.2rem .85rem;padding:.25rem .7rem;font-size:.8rem;border-bottom:1px solid var(--border);transition:background .12s}:host(:last-child) .row{border-bottom:none}.row.row-pending{min-height:3rem}:host(:hover) .row{background:rgb(from var(--text) r g b / .04)}:host(.mark-red) .row{background:var(--mark-red-bg)}:host(.mark-blue) .row{background:var(--mark-blue-bg)}:host(.mark-green) .row{background:var(--mark-green-bg)}:host(.mark-gray) .row{background:var(--mark-gray-bg)}:host(.has-conflict) .row{outline:2px dashed var(--accent);outline-offset:-2px}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:.75}:host(.selected) .row{outline:2px solid var(--accent);outline-offset:-2px}:host(.link-target) .row{animation:link-target-flash 1.6s ease-out}@keyframes link-target-flash{0%,30%{box-shadow:inset 0 0 0 2px var(--accent)}to{box-shadow:inset 0 0 0 2px rgb(from var(--accent) r g b / 0)}}@media(prefers-reduced-motion:reduce){:host(.link-target) .row{animation:none;box-shadow:inset 0 0 0 2px var(--accent)}}:host(:first-of-type) .row{border-top-left-radius:6px;border-top-right-radius:6px}:host(:last-of-type) .row{border-bottom-left-radius:6px;border-bottom-right-radius:6px}.row-score{grid-column:1;grid-row:1 / 3;align-self:center;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.2rem;font-variant-numeric:tabular-nums;.badge{min-width:4.4rem;text-align:center}.row-conf{color:var(--muted);font-size:.72rem;user-select:none;& strong{color:var(--text);font-size:.8rem}}}.row-body{display:contents}.title-row{grid-column:2;grid-row:1;min-width:0;display:flex;align-items:baseline;gap:.5rem;.title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500;user-select:none}.row-type{color:var(--muted);font-size:.68rem;flex-shrink:0}}.meta-row{grid-column:2;grid-row:2;min-width:0;display:flex;align-items:center;gap:.55rem;.row-loc{color:var(--muted);font-size:.72rem;flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;& a{color:inherit;text-decoration:none;cursor:default}& a:hover{color:var(--accent)}}.marks{display:flex;gap:.35rem;align-items:center;min-width:0;margin-left:auto;user-select:none}}.gh-ref-btn{display:inline-flex;align-items:center;position:relative;flex-shrink:0;padding:0 .15rem;color:var(--muted);cursor:default;&:before{content:"";position:absolute;inset:-.25rem -2px}&:hover{color:var(--accent)}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px;border-radius:2px}}.tabs-row{grid-column:2;grid-row:3;min-width:0;.tabs{display:flex;gap:.25rem;flex-wrap:wrap}}.badge,.tabs,.tab,.row-type{cursor:default;user-select:none}.badge{display:inline-block;font-size:.7rem;font-weight:600;text-transform:uppercase;padding:.15rem .45rem;border-radius:3px;letter-spacing:.03em;line-height:1;&.critical{background:var(--critical);color:#fff}&.high{background:var(--high);color:#fff}&.medium{background:var(--medium);color:#000}&.low{background:var(--low);color:var(--badge-low-text)}&.high_bug{background:var(--high-bug);color:#fff}&.bug{background:var(--bug);color:#fff}&.informational{background:var(--info);color:#fff}}.badge-pair{display:inline-flex;align-items:center;gap:.25rem}.badge-pair-full,.badge-pair-compact{flex-direction:column;gap:.15rem}.badge-orig-wrap{display:inline-flex;align-items:center;gap:.15rem;line-height:1}.badge-arrow,.badge-corr-mark{font-size:.6rem;line-height:1;color:var(--muted)}.badge-arrow.up,.badge-corr-mark.up{color:var(--high)}.badge-pre{font-size:.55rem;text-transform:uppercase;letter-spacing:.03em;color:var(--muted)}.badge-orig{display:inline-block;font-size:.58rem;font-weight:600;text-transform:uppercase;padding:.08rem .3rem;border-radius:3px;letter-spacing:.03em;line-height:1;background:transparent;color:var(--muted);border:1px solid var(--border);&.struck{text-decoration:line-through;text-decoration-thickness:1px}&.critical{border-color:rgb(from var(--critical) r g b / .55)}&.high{border-color:rgb(from var(--high) r g b / .55)}&.medium{border-color:rgb(from var(--medium) r g b / .55)}&.low{border-color:rgb(from var(--low) r g b / .55)}&.high_bug{border-color:rgb(from var(--high-bug) r g b / .55)}&.bug{border-color:rgb(from var(--bug) r g b / .55)}&.informational{border-color:rgb(from var(--info) r g b / .55)}}.badge-varies{font-size:.55rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;padding:.08rem .3rem;border-radius:3px;line-height:1;background:transparent;color:var(--muted);border:1px dashed var(--border)}.mark-action-group{display:inline-flex;border:1px solid var(--border);border-radius:3px;background:linear-gradient(var(--surface),var(--surface)),var(--bg);overflow:hidden;margin-right:.25rem;flex-shrink:0}.mark-comment,.mark-fix,.mark-flag,.mark-copy,.mark-link,.mark-issue,.mark-claude{background:transparent;border:0;color:var(--muted);padding:0 .25rem;height:1.4rem;cursor:default;display:inline-flex;align-items:center;justify-content:center;&:not(:last-child){border-right:1px solid var(--border)}&:not(:disabled):hover{color:var(--accent);background:var(--surface-active)}}.mark-issue{text-decoration:none}.mark-comment.has-comment,.mark-fix.has-fix,.mark-flag.flagged{color:var(--accent)}.mark-flag svg{display:block}.mark-copy.copied,.mark-link.copied,.mark-claude.copied{color:var(--green, #4ade80);background:color-mix(in srgb,var(--green, #4ade80) 14%,transparent)}.mark-comment.has-comment .bubble,.mark-fix.has-fix .wrench,.mark-flag.flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}.triage-menu-wrap{position:relative;display:inline-flex;margin-left:.25rem;flex-shrink:0}.mark-triage-menu{cursor:default;background:linear-gradient(var(--surface),var(--surface)),var(--bg);border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .3rem;height:1.5rem;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;font:inherit}.mark-triage-menu:not(:disabled):hover{color:var(--text);border-color:var(--accent)}.mark-comment:disabled,.mark-fix:disabled,.mark-flag:disabled,.mark-triage-menu:disabled,.triage-menu-item:disabled{opacity:.4}.mark-triage-menu.with-label{padding:0 .35rem 0 .5rem;font-size:.72rem;height:1.5rem}.mark-triage-menu .mark-triage-label{text-transform:uppercase;letter-spacing:.05em;font-weight:600}.mark-triage-menu.triage-state-deleted{border-color:var(--critical);color:var(--critical)}.mark-triage-menu.triage-state-fixed{border-color:var(--green, #4ade80);color:var(--green, #4ade80)}.mark-triage-menu.triage-state-inprogress{border-color:var(--warning, #d97706);color:var(--warning, #d97706)}.mark-triage-menu.triage-state-invalid{border-color:var(--muted);color:var(--text)}.mark-triage-menu.triage-state-ignored{border-color:var(--accent, #2563eb);color:var(--accent, #2563eb)}.triage-menu[popover]{position:fixed;inset:auto;margin:0;min-width:7rem;background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:.25rem;box-shadow:0 4px 12px #00000040;display:flex;flex-direction:column;gap:1px;-webkit-app-region:no-drag;app-region:no-drag}.triage-menu[popover]:not(:popover-open){display:none}.triage-menu[popover]:popover-open{display:flex}.triage-menu-item{cursor:default;background:transparent;border:0;padding:.35rem .5rem;font-size:.78rem;color:var(--text);text-align:left;border-radius:3px;font-family:inherit}.triage-menu-item:not(:disabled):hover{background:var(--surface)}.triage-menu-item.active:before{content:"\\2713 ";color:var(--accent)}.triage-menu-inprogress:not(:disabled):hover{color:var(--warning, #d97706)}.triage-menu-fixed:not(:disabled):hover{color:var(--green, #4ade80)}.triage-menu-invalid:not(:disabled):hover{color:var(--muted)}.triage-menu-deleted:not(:disabled):hover{color:var(--critical)}.line-num{color:var(--muted);font-size:.75rem}.line-num a{color:inherit}.line-num a:hover{color:var(--accent)}@media print{:host(:hover) .row,:host(.mark-red) .row,:host(.mark-blue) .row,:host(.mark-green) .row,:host(.mark-gray) .row{background:transparent!important}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:1}:host(.selected) .row,:host(.has-conflict) .row{outline:none!important}:host(.link-target) .row{animation:none;box-shadow:none!important}.row{break-inside:avoid}.marks{display:none!important}.badge{-webkit-print-color-adjust:exact;print-color-adjust:exact;&.critical{background:#a30b0f!important;color:#fff!important}&.high{background:#b8400a!important;color:#fff!important}&.medium{background:#855107!important;color:#fff!important}&.low{background:#374151!important;color:#fff!important}&.high_bug{background:#7a3e0c!important;color:#fff!important}&.bug{background:#4d4538!important;color:#fff!important}&.informational{background:#0550ae!important;color:#fff!important}}.badge-orig{background:transparent!important;color:#555!important;border-color:#999!important}.badge-varies{color:#555!important;border-color:#999!important}.badge-arrow,.badge-corr-mark,.badge-pre{color:#555!important}a,.line-num,.line-num a{color:inherit}}
178
+ `;var Cf=`.tab-level-separator{align-self:center;padding-inline:.125rem;color:var(--muted);font-size:.75rem;line-height:1}.tab{--tab-severity: var(--bg);position:relative;display:inline-flex;align-items:center;gap:.35rem;border:1px solid transparent;border-radius:4px;padding-block:calc(.35rem - .1em);padding-inline:.5rem;min-width:0;font-family:inherit;font-size:.75rem;line-height:1.3;color:var(--text);background:var(--tab-severity);background-image:linear-gradient(135deg,var(--tab-marker, transparent) 50%,var(--tab-marker-shadow, transparent) 50%,transparent 60%);background-size:12px 12px;background-repeat:no-repeat;background-origin:border-box;&.tab-with-confidence{padding-right:1rem;min-width:3.25rem}&.tab-with-analyzer{padding-right:calc(.5rem + 20px)}&.tab-severity-critical{--tab-severity: var(--critical);color:#fff}&.tab-severity-high{--tab-severity: var(--high);color:#fff}&.tab-severity-medium{--tab-severity: var(--medium);color:#000}&.tab-severity-low{--tab-severity: var(--low);color:var(--badge-low-text)}&.tab-severity-high_bug{--tab-severity: var(--high-bug);color:#fff}&.tab-severity-bug{--tab-severity: var(--bug);color:#fff}&.tab-severity-informational{--tab-severity: var(--info);color:#fff}&.tab-mark-red{--tab-marker: var(--marker-red)}&.tab-mark-blue{--tab-marker: var(--marker-blue)}&.tab-mark-green{--tab-marker: var(--marker-green)}&.tab-mark-gray{--tab-marker: var(--marker-gray)}&:is(.tab-mark-red,.tab-mark-blue,.tab-mark-green,.tab-mark-gray){--tab-marker-shadow: rgb(0 0 0 / .3)}&:hover{border-color:var(--muted)}&.active{border-color:var(--text);box-shadow:inset 0 0 0 1px var(--text)}&.active:before{content:"";position:absolute;z-index:1;top:-1px;left:-1px;width:12px;height:12px;border-top-left-radius:inherit;background:var(--tab-marker, transparent);clip-path:polygon(0 0,100% 0,0 100%);pointer-events:none}&.tab-with-analyzer:is(:hover,.active):after{content:"";position:absolute;inset:-1px;border:1px solid var(--muted);border-radius:inherit;pointer-events:none}&.tab-with-analyzer.active:after{border-color:var(--text);box-shadow:inset 0 0 0 1px var(--text)}&.tab-deleted .tab-label{text-decoration:line-through;opacity:.6}&.tab-inprogress .tab-label:after{content:" \\25d0";opacity:.6}&.tab-fixed .tab-label{opacity:.65}&.tab-fixed .tab-label:after{content:" \\2713";opacity:.6}&.tab-invalid .tab-label{opacity:.65}&.tab-invalid .tab-label:after{content:" \\2298";opacity:.6}&.tab-ignored .tab-label{opacity:.55}&.tab-ignored .tab-label:after{content:" \\1f441";opacity:.6;font-size:.7em}.tab-label{display:flex;align-items:center;gap:.35rem;text-align:left}.tab-conf{position:absolute;right:.25rem;bottom:.15rem;font-size:.6rem;line-height:1;color:inherit}.tab-analyzer{position:absolute;inset:-1px -1px -1px auto;width:20px;display:flex;overflow:hidden;border-radius:0 4px 4px 0;box-shadow:0 0 2px #0003}.tab-analyzer .report-logo{flex:1;border:0}.tab-analyzer svg{display:block}.tab-conf-max{display:none}.tab-severity{display:inline-flex}.badge{padding:0;background:none;color:inherit}.tab-indicators{display:inline-flex;align-items:center;gap:.25rem}.tab-indicators:empty{display:none}.tab-marks{display:inline-flex;align-items:center;gap:.15rem;color:inherit}.tab-marks svg{display:block}.tab-marks :is(.bubble,.wrench,.flag-cloth){fill:currentcolor;fill-opacity:.15}.badge-corr-mark{color:inherit}}
179
+ `;Mc();var Ef=`.report-button{display:inline-flex;align-items:center;max-width:16rem;padding:0;overflow:hidden;background:transparent;border:1px solid var(--border);border-radius:3px;color:var(--muted);font:inherit;font-size:.7rem;cursor:default;transition:border-color .12s,color .12s;&:hover{border-color:var(--accent);color:var(--accent)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}.report-button-label{min-width:0;padding:.1rem .4rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
180
+ `;var Rf=`.finding-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:.25rem 1rem;min-width:0;max-width:100%}.finding-action-controls{display:flex;flex:0 0 auto;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:.35rem;max-width:100%}.finding-actions .report-chip{flex:0 1 auto;width:max-content;min-width:0;max-width:100%;min-height:1.4rem}.finding-actions .report-chip-label{white-space:normal;overflow-wrap:anywhere;text-align:left}
181
+ `;var D8=["is-critical","mark-red","mark-blue","mark-green","mark-gray","has-conflict","triage-inprogress","triage-fixed","triage-invalid","triage-deleted","triage-ignored","selected"],Gw=class extends V{static properties={group:{attribute:!1},selected:{type:Boolean}};static styles=[A(No),A(Ef),A(qA),A(Rf),A(Cf)];_near=!1;_watching=!1;constructor(){super(),this.group=null,this.selected=!1}render(){if(!this.group)return d``;if(this.dataset.gid=se(this.group),!this._near)return this.classList.toggle("selected",this.selected),d`<div class="row row-pending" aria-busy="true"></div>`;let e=new Set(sy(this.group));this.selected&&e.add("selected");for(let r of D8)this.classList.toggle(r,e.has(r));return d`<div class="row">${oC(this.group)}</div>`}connectedCallback(){super.connectedCallback(),cr(this.renderRoot),this.addEventListener("click",this._onClick),this._watching=!0,sa(this,e=>this._onNear(e))}disconnectedCallback(){this.removeEventListener("click",this._onClick),this._watching&&(Hn(this),this._watching=!1),super.disconnectedCallback()}_onNear(e){e?(this._watching&&(Hn(this),this._watching=!1),this._near=!0,this.requestUpdate()):this._near&&(this._near=!1,this.requestUpdate())}ensureRendered({sync:e=!1}={}){return this._near||this._onNear(!0),e&&this.isConnected&&this.isUpdatePending&&this.performUpdate(),this.updateComplete}_onClick=e=>{e.composedPath().some(n=>n?.matches?.("a, button, label"))||this.dataset.gid&&this.dispatchEvent(new CustomEvent("row-select",{detail:{gid:this.dataset.gid},bubbles:!0,composed:!0}))}};customElements.define("finding-row",Gw);var YA=`:host{display:block;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:6px;overflow:hidden;box-shadow:var(--shadow-glass);margin-bottom:1rem;max-width:1200px}@media not print{finding-row{content-visibility:auto;contain-intrinsic-size:auto 3.2rem}}
182
+ `;var qw=class extends J{static properties={items:{attribute:!1},selectedGid:{attribute:!1}};static styles=A(YA);constructor(){super(),this.items=[],this.selectedGid=null}render(){return d`${te(this.items??[],e=>se(e),e=>d`<finding-row .group="${e}" ?selected="${se(e)===this.selectedGid}"></finding-row>`)}`}};customElements.define("finding-table",qw);M();$e();go();ot();fc();ty();var XA=`:host{display:block}:host(.hidden){display:none}:host([lazy]:not(.content-ready)){visibility:hidden}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:.75}.card{padding:.5rem .75rem;padding-bottom:var(--finding-card-pad-bottom, .5rem);border-bottom:1px solid var(--border);font-size:.875rem;display:var(--finding-card-display, block);flex-direction:column;flex:1}:host(:last-child) .card{border-bottom:none}.card.card-pending{min-height:8rem}:host(.has-conflict) .card{outline:2px dashed var(--accent);outline-offset:-2px}:host(.has-conflict[popup][context="kanban-detail"]) .card{outline:none}:host(.link-target) .card{animation:link-target-flash 1.6s ease-out}@keyframes link-target-flash{0%,30%{box-shadow:inset 0 0 0 2px var(--accent)}to{box-shadow:inset 0 0 0 2px rgb(from var(--accent) r g b / 0)}}@media(prefers-reduced-motion:reduce){:host(.link-target) .card{animation:none;box-shadow:inset 0 0 0 2px var(--accent)}}:host([in-group]) .line-row{display:none}@media not print{:host([in-group]) .line-row+*{margin-top:0}:host([in-group]) .line-row+:is(.conf-reason,.revalidate-verdict,.severity-reason){padding-top:0;border-top:0}}.tabs{display:flex;gap:.25rem;flex-wrap:wrap}.marks-left{display:flex;align-items:center;gap:.5rem;margin-right:auto;flex-wrap:wrap}.commit-ref{color:var(--muted);font-size:.8rem;& a{color:var(--accent);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}& a:hover{text-decoration:underline}& span{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}}.marks-commit-row{margin-top:.4rem;padding-left:4.75rem}.tab-body{display:none;grid-template-columns:auto 1fr;gap:.25rem .75rem;&.active{display:grid}}.tab-body>:not(.finding-left){min-width:0;overflow-wrap:break-word}.desc-title{grid-column:2;font-size:1.08em;font-weight:600;letter-spacing:-.005em;line-height:1.35;color:var(--text)}.desc{grid-column:2;white-space:pre-wrap;font-size:.96em;line-height:1.6;color:rgb(from var(--text) r g b / .82);margin-top:.4rem}.section,.evidence,.recommendation{grid-column:2;margin-top:.55rem;font-size:.92em}.section-label{display:flex;align-items:center;gap:.3rem;color:var(--muted);font-weight:600;font-size:.62rem;text-transform:uppercase;letter-spacing:.06em;&:before{content:"";flex:none;width:2px;height:.58rem;margin-left:calc((2px + .3rem)*-1);border-radius:1px;background:currentcolor;opacity:.75;-webkit-print-color-adjust:exact;print-color-adjust:exact}}.code-preview-btn{display:inline-flex;align-items:center;margin-left:.35rem;padding:0 .15rem;border:0;background:transparent;color:var(--muted);vertical-align:-2px;&.open{color:var(--accent)}}.gh-ref-btn{display:inline-flex;align-items:center;margin-left:.25rem;padding:0 .15rem;color:var(--muted);vertical-align:-2px}:is(.code-preview-btn,.gh-ref-btn){position:relative;&:before{content:"";position:absolute;inset:-.25rem -2px}&:hover{color:var(--accent)}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px;border-radius:2px}}.code-preview-tip{position:absolute;z-index:20;top:100%;left:0;margin-top:.3rem;width:max-content;max-width:min(100%,46rem);visibility:hidden;filter:drop-shadow(0 2px 6px rgb(0 0 0 / .35));background:var(--bg);border-radius:4px;.code-preview{margin:0}}:is(.line-row,.evidence-list li):has(.code-preview-btn:is(:hover,:focus-visible))>.code-preview-tip{visibility:visible}.code-preview{margin:.3rem 0 .1rem;border:1px solid var(--border);border-radius:4px;background:var(--surface);backdrop-filter:var(--glass-blur);max-height:calc(10lh + .7rem);overflow:auto;display:flex;align-items:flex-start;white-space:normal;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.75rem;line-height:1.5}.code-preview-pending{display:block;padding:.35rem .5rem;color:var(--muted);font-style:italic}.code-preview-gutter{flex:none;padding:.35rem .45rem .35rem .5rem;border-right:1px solid var(--border);color:var(--muted);text-align:right;user-select:none;position:sticky;left:0;z-index:1;background-color:var(--bg);background-image:linear-gradient(rgb(from var(--text) r g b / .03),rgb(from var(--text) r g b / .03)),linear-gradient(var(--surface),var(--surface));.code-preview-lineno{width:var(--lineno-width, 3ch);opacity:.7}.cited{opacity:1;color:var(--accent);font-weight:600}}.code-preview-source{margin:0;padding:.35rem .6rem;white-space:pre;color:var(--text);font:inherit;& code{font:inherit}}summary.section-label{cursor:default;list-style:none;&::-webkit-details-marker{display:none}&:after{content:"";flex:none;width:.3rem;height:.3rem;margin-left:.05rem;border-right:1.5px solid currentcolor;border-bottom:1.5px solid currentcolor;transform:translateY(-1px) rotate(-45deg);transition:transform .12s;opacity:.8}}details[open]>summary.section-label:after{transform:translateY(-2px) rotate(45deg)}.evidence-count{font-weight:500;opacity:.8}.section-body{white-space:pre-wrap;line-height:1.55;color:rgb(from var(--text) r g b / .82);margin-top:.1rem}.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)}.recommendation .section-label,.recommendation .section-body{color:var(--green)}.conf-reason,.revalidate-verdict{grid-column:2;white-space:pre-wrap;font-size:.92em;font-style:italic;color:var(--muted);margin-top:.6rem;padding-top:.55rem;border-top:1px dashed var(--border)}.revalidate-stamp{display:inline-block;margin-top:.1rem;font-size:.55rem;font-weight:600;line-height:1;text-transform:uppercase;letter-spacing:.03em;padding:.14rem .3rem;border-radius:3px;background:transparent;color:var(--muted);border:1px solid var(--border);white-space:nowrap;&.confirmed{color:var(--critical);border-color:rgb(from var(--critical) r g b / .55)}&.partial{color:var(--yellow);border-color:rgb(from var(--yellow) r g b / .55)}&.unknown{color:var(--warning);border-color:rgb(from var(--warning) r g b / .55)}}.evidence-list{margin:.25rem 0 0;padding-left:1.6rem;display:flex;flex-direction:column;gap:.15rem;>li{position:relative}& li::marker{color:var(--muted);font-size:.9em}>li.current:before{content:"";position:absolute;left:-1.5rem;top:.58em;width:.35rem;height:.35rem;border-radius:50%;background:var(--accent)}>li.current::marker{color:var(--accent)}& li:has(.evidence-note):not(:last-child){margin-bottom:.3rem}}.evidence-ref{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.92em;overflow-wrap:anywhere;color:var(--accent);text-decoration:none;&:is(a,[role=link]):hover{text-decoration:underline}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px;border-radius:2px}}:is(.line-num a,.evidence-ref,.gh-ref-btn){cursor:default}span.evidence-ref:not([role]){color:var(--muted)}.evidence-note{white-space:pre-wrap;line-height:1.5;color:rgb(from var(--text) r g b / .78);margin-top:.1rem}.desc-title a,.desc a,.section-body a,.conf-reason a,.revalidate-verdict a{color:var(--accent);text-decoration:none;&:hover{text-decoration:underline}}.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)}.code-block{white-space:normal;margin:.5rem 0;border:1px solid var(--border);border-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:.45rem .6rem;overflow-x:auto;white-space:pre;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.85em;line-height:1.5;color:var(--text)}& code{font:inherit}}.line-row{display:flex;justify-content:space-between;align-items:baseline;gap:.5rem;flex-wrap:wrap;padding-right:var(--finding-line-end-inset, 0);position:relative}.run-meta{color:var(--muted);font-size:.65rem}.finding-code-btn{display:inline-block;margin-top:.35rem;padding:.1rem .45rem;background:transparent;border:1px solid var(--border);border-radius:999px;color:var(--muted);font:inherit;font-size:.65rem;font-weight:500;white-space:nowrap}.finding-code-btn:hover{border-color:var(--accent);color:var(--accent)}.marks{display:flex;gap:.35rem;justify-content:flex-end;margin-top:.4rem;align-items:center;position:var(--finding-marks-position, static);bottom:0;background:var(--finding-marks-bg, transparent);padding-bottom:var(--finding-marks-pad-bottom, 0);padding-left:4.75rem;user-select:none}.finding-left{align-self:start;text-align:center;min-width:4rem;padding-top:var(--finding-left-inset, 0);position:var(--finding-left-position, relative);top:var(--finding-mark-sticky-top, 0);.value-label:last-child{margin-bottom:0}}:host(:not([popup])) .finding-left{padding-top:calc(var(--finding-left-inset, 0px) + 2px)}.conf-score{font-size:.75rem;color:var(--muted);margin-top:.3rem;& strong{color:var(--text);font-size:.85rem}}.conf-ring{--col: var(--muted);position:relative;width:3rem;height:3rem;margin:.7rem auto .15rem;display:flex;align-items:center;justify-content:center;& svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg)}& circle{fill:none;stroke-width:4}.conf-ring-track{stroke:var(--border)}.conf-ring-arc{stroke:var(--col);stroke-linecap:round}& span{position:relative;z-index:1;font-size:.8rem;font-weight:700;color:var(--text);font-variant-numeric:tabular-nums}& small{font-size:.55rem;color:var(--muted);font-weight:500}&.critical{--col: var(--critical)}&.high{--col: var(--high)}&.medium{--col: var(--medium)}&.low{--col: var(--low)}&.high_bug{--col: var(--high-bug)}&.bug{--col: var(--bug)}&.informational{--col: var(--info)}}.value-label{display:block;font-size:.45rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;margin-top:.1rem;margin-bottom:.3rem;font-weight:500}.print-case-label{display:none}.badge,.tabs,.tab,.value-label,.run-meta,.conf-ring{cursor:default;user-select:none}.badge{display:inline-block;font-size:.7rem;font-weight:600;text-transform:uppercase;padding:.15rem .45rem;border-radius:3px;letter-spacing:.03em;line-height:1;&.critical{background:var(--critical);color:#fff}&.high{background:var(--high);color:#fff}&.medium{background:var(--medium);color:#000}&.low{background:var(--low);color:var(--badge-low-text)}&.high_bug{background:var(--high-bug);color:#fff}&.bug{background:var(--bug);color:#fff}&.informational{background:var(--info);color:#fff}}.badge-pair{display:inline-flex;align-items:center;gap:.25rem}.badge-pair-full,.badge-pair-compact{flex-direction:column;gap:.15rem}.badge-orig-wrap{display:inline-flex;align-items:center;gap:.15rem;line-height:1}.badge-arrow,.badge-corr-mark{font-size:.6rem;line-height:1;color:var(--muted)}.badge-arrow.up,.badge-corr-mark.up{color:var(--high)}.badge-pre{font-size:.55rem;text-transform:uppercase;letter-spacing:.03em;color:var(--muted)}.badge-orig{display:inline-block;font-size:.58rem;font-weight:600;text-transform:uppercase;padding:.08rem .3rem;border-radius:3px;letter-spacing:.03em;line-height:1;background:transparent;color:var(--muted);border:1px solid var(--border);&.struck{text-decoration:line-through;text-decoration-thickness:1px}&.critical{border-color:rgb(from var(--critical) r g b / .55)}&.high{border-color:rgb(from var(--high) r g b / .55)}&.medium{border-color:rgb(from var(--medium) r g b / .55)}&.low{border-color:rgb(from var(--low) r g b / .55)}&.high_bug{border-color:rgb(from var(--high-bug) r g b / .55)}&.bug{border-color:rgb(from var(--bug) r g b / .55)}&.informational{border-color:rgb(from var(--info) r g b / .55)}}.badge-varies{font-size:.55rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;padding:.08rem .3rem;border-radius:3px;line-height:1;background:transparent;color:var(--muted);border:1px dashed var(--border)}.severity-reason{margin-top:.4rem;padding-top:.35rem;border-top:1px dashed var(--border);font-size:.82em;font-style:italic;color:var(--muted)}.severity-reason-label{font-style:normal;font-weight:600;text-transform:uppercase;font-size:.85em;letter-spacing:.04em;margin-right:.35rem}.duplicates-block .file-icon{flex-shrink:0}.mark-action-group{display:inline-flex;border:1px solid var(--border);border-radius:3px;background:linear-gradient(var(--surface),var(--surface)),var(--bg);overflow:hidden;margin-right:.25rem;flex-shrink:0}.mark-comment,.mark-fix,.mark-flag,.mark-copy,.mark-link,.mark-issue,.mark-claude{background:transparent;border:0;color:var(--muted);padding:0 .25rem;height:1.4rem;cursor:default;display:inline-flex;align-items:center;justify-content:center;&:not(:last-child){border-right:1px solid var(--border)}&:not(:disabled):hover{color:var(--accent);background:var(--surface-active)}}.mark-issue{text-decoration:none}.mark-comment.has-comment,.mark-fix.has-fix,.mark-flag.flagged{color:var(--accent)}.mark-flag svg{display:block}.mark-copy.copied,.mark-link.copied,.mark-claude.copied{color:var(--green, #4ade80);background:color-mix(in srgb,var(--green, #4ade80) 14%,transparent)}.mark-comment.has-comment .bubble,.mark-fix.has-fix .wrench,.mark-flag.flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}.triage-menu-wrap{position:relative;display:inline-flex;margin-left:.25rem;flex-shrink:0}.mark-triage-menu{cursor:default;background:linear-gradient(var(--surface),var(--surface)),var(--bg);border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .3rem;height:1.5rem;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;font:inherit}.mark-triage-menu:not(:disabled):hover{color:var(--text);border-color:var(--accent)}.mark-comment:disabled,.mark-fix:disabled,.mark-flag:disabled,.mark-triage-menu:disabled,.triage-menu-item:disabled{opacity:.4}.mark-triage-menu.with-label{padding:0 .35rem 0 .5rem;font-size:.72rem;height:1.5rem}.mark-triage-menu .mark-triage-label{text-transform:uppercase;letter-spacing:.05em;font-weight:600}.mark-triage-menu.triage-state-deleted{border-color:var(--critical);color:var(--critical)}.mark-triage-menu.triage-state-fixed{border-color:var(--green, #4ade80);color:var(--green, #4ade80)}.mark-triage-menu.triage-state-inprogress{border-color:var(--warning, #d97706);color:var(--warning, #d97706)}.mark-triage-menu.triage-state-invalid{border-color:var(--muted);color:var(--text)}.mark-triage-menu.triage-state-ignored{border-color:var(--accent, #2563eb);color:var(--accent, #2563eb)}.triage-menu[popover]{position:fixed;inset:auto;margin:0;min-width:7rem;background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:.25rem;box-shadow:0 4px 12px #00000040;display:flex;flex-direction:column;gap:1px;-webkit-app-region:no-drag;app-region:no-drag}.triage-menu[popover]:not(:popover-open){display:none}.triage-menu[popover]:popover-open{display:flex}.triage-menu-item{cursor:default;background:transparent;border:0;padding:.35rem .5rem;font-size:.78rem;color:var(--text);text-align:left;border-radius:3px;font-family:inherit}.triage-menu-item:not(:disabled):hover{background:var(--surface)}.triage-menu-item.active:before{content:"\\2713 ";color:var(--accent)}.triage-menu-inprogress:not(:disabled):hover{color:var(--warning, #d97706)}.triage-menu-fixed:not(:disabled):hover{color:var(--green, #4ade80)}.triage-menu-invalid:not(:disabled):hover{color:var(--muted)}.triage-menu-deleted:not(:disabled):hover{color:var(--critical)}:host([context="focus"]) .triage-menu-wrap>.mark-triage-menu{display:none}:host([context="focus"]) .triage-menu-wrap{display:inline-flex}:host([context="focus"]) .triage-menu[popover]{position:static;inset:auto;display:inline-flex!important;flex-flow:row wrap;margin:0;padding:0;background:transparent;border:0;border-radius:0;box-shadow:none;min-width:0;gap:.25rem}:host([context="focus"]) .triage-menu-item{background:transparent;border:1px solid var(--border);padding:.2rem .5rem;border-radius:3px;font-size:.72rem;font-weight:500;text-transform:uppercase;letter-spacing:.04em}:host([context="focus"]) .triage-menu-item.active{background:rgb(from var(--accent) r g b / .12);border-color:var(--accent);color:var(--accent)}:host([context="focus"]) .triage-menu-item:not(:disabled):hover{background:var(--surface-active)}:host([context="focus"]) .triage-menu-inprogress.active{background:rgb(from var(--warning, #d97706) r g b / .12);border-color:var(--warning, #d97706);color:var(--warning, #d97706)}:host([context="focus"]) .triage-menu-fixed.active{background:rgb(from var(--green, #4ade80) r g b / .12);border-color:var(--green, #4ade80);color:var(--green, #4ade80)}:host([context="focus"]) .triage-menu-deleted.active{background:rgb(from var(--critical) r g b / .12);border-color:var(--critical);color:var(--critical)}:host([context="focus"]) .triage-menu-item.active:before{content:"";margin:0}:host([context="focus"]) .marks{gap:.5rem;margin-top:var(--finding-marks-margin-top, .65rem);padding-left:0;padding-top:.55rem;border-top:1px solid var(--border);flex-wrap:wrap}:host([context="focus"]) .marks-commit-row{padding-left:0}:host([context="focus"]) .mark-comment,:host([context="focus"]) .mark-fix,:host([context="focus"]) .mark-flag,:host([context="focus"]) .mark-copy,:host([context="focus"]) .mark-link,:host([context="focus"]) .mark-issue,:host([context="focus"]) .mark-claude{height:1.75rem;padding:0 .55rem;gap:.35rem;display:inline-flex;align-items:center;font-size:.72rem}:host([context="focus"]) .mark-btn-label{color:inherit;font-weight:500;letter-spacing:.02em}.finding-top-marks{position:absolute;top:calc(var(--finding-left-inset, 0px) - var(--finding-mark-inset, .5rem));left:calc(.75rem - var(--finding-mark-inset, .5rem));display:grid;grid-template-columns:24px 12px;column-gap:31px;&.color-red{color:var(--marker-red)}&.color-blue{color:var(--marker-blue)}&.color-green{color:var(--marker-green)}&.color-gray{color:var(--marker-gray)}}.finding-color-mark{grid-column:1;display:block;width:24px;height:12px;border-radius:0 0 6px 6px;background:currentcolor;box-shadow:inset 0 0 0 1px rgb(from var(--text) r g b / .15)}.finding-bookmark-mark{grid-column:2;display:block;width:12px;height:12px;background:var(--bookmark-color);clip-path:polygon(0 0,100% 0,100% 100%,50% 75%,0 100%)}:host(:not([popup])) :is(.finding-color-mark,.finding-bookmark-mark){height:10px}.comment-block,.fix-block{margin-top:.5rem;padding:.35rem .55rem;border-left:3px solid var(--accent);background:rgb(from var(--accent) r g b / .08);border-radius:0 4px 4px 0;font-size:.82rem;color:var(--text)}.comment-block{white-space:pre-wrap;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}& a.comment-self-ref{text-decoration:underline dotted;text-underline-offset:2px}& a.comment-self-ref:hover{text-decoration:underline solid}}.fix-block{word-break:break-all;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}}.duplicates-block{display:flex;align-items:baseline;flex-wrap:wrap;gap:.1rem .4rem;margin-top:.5rem;padding:.35rem .55rem;border-left:3px solid var(--muted);background:rgb(from var(--muted) r g b / .1);border-radius:0 4px 4px 0;font-size:.82rem;color:var(--text);.duplicates-label{color:var(--muted);font-weight:600}& a.duplicate-ref{display:inline-flex;align-items:center;gap:.25rem;color:var(--accent);text-decoration:none}& a.duplicate-ref .duplicate-ref-id{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.78rem;text-decoration:underline dotted;text-underline-offset:2px}& a.duplicate-ref:hover .duplicate-ref-id{text-decoration:underline solid}}.comment-label,.fix-label{color:var(--muted);font-weight:600;margin-right:.35rem}.line-num{color:var(--muted);font-size:.8rem}.line-num a{color:inherit;text-decoration:none}.line-num a:hover{color:var(--accent)}.npm-link{display:inline-block;padding:0 .4rem;border:1px solid var(--border);border-radius:3px;font-size:.72rem;font-weight:500;color:var(--muted);text-decoration:none}.npm-link:hover{border-color:var(--accent);color:var(--accent)}@media print{.card{break-inside:var(--finding-print-break, avoid);box-decoration-break:clone;padding:.45rem .25rem}.finding-code-btn,.mark-copy,.mark-link,.mark-issue,.mark-claude{display:none!important}.npm-link{border:0;padding:0}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:1}:host(.link-target) .card{animation:none;box-shadow:none!important}:host(.multi-case) .card:before{content:"Multiple reports of one finding";display:block;font-size:.7rem;font-weight:700;color:#555;text-transform:uppercase;letter-spacing:.06em;border-bottom:1px solid #bbb;padding-bottom:.2rem;margin-bottom:.35rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}.marks,.tabs{display:none!important}.tab-body{display:grid!important;break-inside:var(--finding-print-break, avoid)}:host(.multi-case) .tab-body{break-inside:auto}:host(.multi-case) .tab-body+.tab-body{break-inside:avoid}.tab-body+.tab-body{margin-top:.5rem;padding-top:.5rem;border-top:1px dashed #999}.finding-body{display:flex;flex-direction:column;>*{flex-shrink:0}}.line-row,.desc-title,.conf-reason,.severity-reason{break-inside:avoid}.section-label{break-after:avoid}.desc,.section-body{orphans:2;widows:2}.section,.recommendation,.evidence{break-inside:avoid}.evidence{order:99}.evidence>summary{break-after:avoid}.evidence-list>li{break-inside:avoid}:host([in-group].multi-case) .tab-body .line-row{display:flex}:host([in-group]:not(.multi-case)) .line-row+*{margin-top:0}:host([in-group]:not(.multi-case)) .line-row+.conf-reason{padding-top:0;border-top:0}.line-row .discovered-in{flex-basis:100%;order:99}.print-case-label{display:block;grid-column:1 / -1;break-after:avoid;font-size:.65rem;font-weight:600;color:#555;background:#eee;padding:.1rem .35rem;border-radius:3px;margin-bottom:.25rem;letter-spacing:.04em;-webkit-print-color-adjust:exact;print-color-adjust:exact}.value-label{color:#777}.badge{-webkit-print-color-adjust:exact;print-color-adjust:exact;&.critical{background:#a30b0f!important;color:#fff!important}&.high{background:#b8400a!important;color:#fff!important}&.medium{background:#855107!important;color:#fff!important}&.low{background:#374151!important;color:#fff!important}&.high_bug{background:#7a3e0c!important;color:#fff!important}&.bug{background:#4d4538!important;color:#fff!important}&.informational{background:#0550ae!important;color:#fff!important}}.badge-orig{background:transparent!important;color:#555!important;border-color:#999!important}.badge-varies,.revalidate-stamp{color:#555!important;border-color:#999!important}.badge-arrow,.badge-corr-mark,.badge-pre,.severity-reason{color:#555!important}a,.line-num,.line-num a,.desc-title a,.desc a,.section-body a,.conf-reason a,.revalidate-verdict a,.evidence-ref{color:inherit}details:not([open])>:not(summary){display:block}details::details-content{content-visibility:visible}summary.section-label{cursor:auto;&:after{display:none}}.code-preview-btn,.gh-ref-btn{display:none}.inline-code{border:0;background:transparent}.code-block{background:transparent;border-color:#bbb;.code-block-lang{color:#555;border-bottom-color:#bbb}& pre{white-space:pre-wrap;overflow:visible}.token{color:#333!important}.token.comment,.token.prolog,.token.cdata{color:#666!important}}}
183
+ `;Mc();var H8=["finding","is-critical","mark-red","mark-blue","mark-green","mark-gray","has-conflict","triage-inprogress","triage-fixed","triage-invalid","triage-deleted","triage-ignored","multi-case"],Yw=class extends V{static properties={group:{attribute:!1},inGroup:{type:Boolean,attribute:"in-group",reflect:!0},context:{type:String,reflect:!0},lazy:{type:Boolean}};static styles=[A(No),A(Ef),A(XA),A(Rf),A(Cf),A(bf)];_near=!1;_watched=null;constructor(){super(),this.group=null,this.inGroup=!1,this.context=null,this.lazy=!1}render(){if(!this.group)return d``;if(this.dataset.gid=se(this.group),this.lazy&&!this._near)return this.classList.add("finding"),d`<div class="card card-pending" aria-busy="true"></div>`;let e=new Set(rC(this.group));for(let r of H8)this.classList.toggle(r,e.has(r));return d`<div class="card">${nC(this.group,{context:this.context})}</div>`}updated(){this.classList.toggle("content-ready",!!this.group&&(!this.lazy||this._near));for(let e of this.renderRoot.querySelectorAll(".code-preview")){let r=e.dataset.revealedTo;if(r!==void 0&&Math.round(e.scrollTop)!==Number(r))continue;let n=e.querySelectorAll(".code-preview-lineno.cited");n.length!==0&&(vp(e,n),e.dataset.revealedTo=String(Math.round(e.scrollTop)))}}connectedCallback(){if(super.connectedCallback(),cr(this.renderRoot),this.lazy){this._watched=this.closest(".flat-group")??this,sa(this._watched,e=>this._onNear(e));return}this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){this._watched&&(Hn(this._watched),this._watched=null),super.disconnectedCallback()}_onNear(e){e?(this._watched&&(Hn(this._watched),this._watched=null),this._near=!0,this.requestUpdate()):this._near&&(this._near=!1,this.requestUpdate())}ensureRendered({sync:e=!1}={}){return this.lazy&&!this._near&&this._onNear(!0),e&&this.isConnected&&this.isUpdatePending&&this.performUpdate(),this.updateComplete}};customElements.define("finding-card",Yw);M();var JA=`:host{display:inline-flex;gap:4px;align-items:center;flex-shrink:0}button{width:14px;height:14px;user-select:none;padding:0;background:transparent;border:1.5px solid currentcolor;border-radius:50%;opacity:.55;transition:opacity .12s,transform .12s}button:not(:disabled):hover{opacity:1;transform:scale(1.12)}button:disabled{opacity:.25}button.active{background:currentcolor;opacity:1;box-shadow:0 0 0 2px var(--surface),0 0 0 3px currentcolor}.color-red{color:var(--marker-red)}.color-blue{color:var(--marker-blue)}.color-green{color:var(--marker-green)}.color-gray{color:var(--marker-gray)}
184
+ `;go();var V8=["red","blue","green","gray"],Xw=class extends J{static properties={selected:{type:String},disabled:{type:Boolean}};static styles=A(JA);constructor(){super(),this.selected=null,this.disabled=!1}connectedCallback(){super.connectedCallback(),cr(this.renderRoot)}render(){return d`${V8.map(e=>d`<button type="button" class="${`color-${e}${this.selected===e?" active":""}`}" data-color="${e}" aria-label="${`mark ${e}`}" data-tooltip="${`mark ${e}`}" ?disabled="${this.disabled}" @click="${this._onClick}"></button>`)}`}_onClick=e=>{if(this.disabled)return;let r=e.currentTarget.dataset.color;this.dispatchEvent(new CustomEvent("mark-color",{detail:{color:r},bubbles:!0,composed:!0}))}};customElements.define("color-marker",Xw);Mb();M();Me();$e();O();var Jw=class extends V{static properties={rangeDisabled:{type:Boolean,attribute:"range-disabled"},revalidateOptions:{attribute:!1},hasPartial:{type:Boolean,attribute:"has-partial"}};createRenderRoot(){return this}constructor(){super(),this.rangeDisabled=!1,this.revalidateOptions=[],this.hasPartial=!1}render(){let e=l.filterConfMin,r=l.filterConfMax,n=this.revalidateOptions??[],o=this.rangeDisabled,i=n.length>0&&!!l.filterRevalidate,s=o?"No confidence range: some findings on screen carry no confidence score":m;return d`<span class="${I({"conf-range-label":!0,replaced:i,disabled:o})}">Confidence</span> <span class="${I({"conf-range":!0,replaced:i,disabled:o})}" title="${s}" ?inert="${o||i}"><range-slider id="conf-range" min="0" max="10" step="1" low="${e}" high="${r}" aria-label="Confidence range"></range-slider><conf-range-mirror id="conf-range-vals" class="conf-vals" for="conf-range" .low="${e}" .high="${r}"></conf-range-mirror></span>${n.length>0?d`<revalidate-filter class="${I({replaces:i})}" .options="${n}" ?has-partial="${this.hasPartial}"></revalidate-filter>`:m}`}};customElements.define("conf-filter",Jw);M();Me();Jt();$e();O();var ZA={files:"Filter files\u2026",code:"Search code\u2026",issues:"Search issues\u2026"},QA={files:"Filter files",code:"Search code",issues:"Search issues"},W8=d`<svg class="bundle-code-search-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg>`,K8={files:d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 4.5a1 1 0 0 1 1-1h3.2l1.3 1.5H13a1 1 0 0 1 1 1V12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4.5Z"/></svg>`,code:d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5.5 4.5L2 8l3.5 3.5"/><path d="M10.5 4.5L14 8l-3.5 3.5"/></svg>`,issues:d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.3" aria-hidden="true"><circle cx="8" cy="8" r="6"/><path d="M8 4.8v3.6" stroke-linecap="round"/><circle cx="8" cy="11" r=".7" fill="currentColor" stroke="none"/></svg>`},Zw=class extends V{static properties={modes:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.modes=[]}render(){let e=l.bundleCodeSearchQuery,r=l.bundleCodeSearchMode,n=this.modes.includes(r)?r:"files",o=ZA[n]??ZA.files;return d`${W8} <input type="text" class="bundle-code-search-input" placeholder="${o}" aria-label="${o}" .value="${xe(e)}" @input="${this._onInput}"> ${e?d`<button type="button" class="bundle-code-search-clear" aria-label="Clear search" @click="${this._onClear}">×</button>`:m} ${this.modes.length>0?d`<span class="bundle-code-search-modes" role="tablist">${this.modes.map(i=>d`<button type="button" class="${I({"bundle-code-search-mode":!0,active:n===i})}" role="tab" aria-selected="${String(n===i)}" data-tooltip="${QA[i]??i}" aria-label="${QA[i]??i}" @click="${()=>this._selectMode(i)}">${K8[i]??m}</button>`)}</span>`:m}`}_onInput=e=>{this._dispatchInput(e.target.value)};_onClear=()=>{this._dispatchInput("")};_dispatchInput(e){this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:"bundle-code",value:e},bubbles:!0,composed:!0}))}_selectMode(e){this.dispatchEvent(new CustomEvent("bundle-search-mode-change",{detail:{mode:e},bubbles:!0,composed:!0}))}};customElements.define("bundle-code-search",Zw);M();Me();Jt();$e();O();var G8=d`<svg class="bundle-search-icon" viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg>`,Qw=class extends V{createRenderRoot(){return this}render(){let e=l.bundleSearchQuery,r=l.bundleSearchRegex,n=l.bundleSearchCase,o=r?"Search by regular expression\u2026":"Search all source\u2026";return d`${G8} <input type="text" class="bundle-search-input" placeholder="${o}" aria-label="${o}" spellcheck="false" autocapitalize="off" autocomplete="off" .value="${xe(e)}" @input="${this._onInput}"> ${e?d`<button type="button" class="bundle-search-clear" aria-label="Clear search" @click="${this._onClear}">×</button>`:m} <span class="bundle-search-mods"><button type="button" class="${I({"bundle-search-mod":!0,active:n})}" data-tooltip="${n?"Case-sensitive on \u2014 click to ignore case":"Match case"}" aria-label="Match case" aria-pressed="${String(n)}" @click="${this._onToggleCase}">Aa</button> <button type="button" class="${I({"bundle-search-mod":!0,active:r})}" data-tooltip="${r?"Regular expression on \u2014 click for plain text":"Match by regular expression"}" aria-label="Match by regular expression" aria-pressed="${String(r)}" @click="${this._onToggleRegex}">.*</button></span>`}_onInput=e=>{this._dispatchInput(e.target.value)};_onClear=()=>{this._dispatchInput("")};_dispatchInput(e){this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:"bundle-search",value:e},bubbles:!0,composed:!0}))}_onToggleRegex=()=>{this.dispatchEvent(new CustomEvent("bundle-search-regex-toggle",{bubbles:!0,composed:!0}))};_onToggleCase=()=>{this.dispatchEvent(new CustomEvent("bundle-search-case-toggle",{bubbles:!0,composed:!0}))}};customElements.define("bundle-search",Qw);M();Jt();$e();O();function dn(t,e,r){let n=e[r];return n||console.warn(`<${t}>: unknown kind ${JSON.stringify(r)}; expected one of ${Object.keys(e).map(o=>JSON.stringify(o)).join(", ")}.`),n}var q8={packages:{stateKey:"packagesSearchQuery",label:"Filter packages"},repositories:{stateKey:"repositoriesSearchQuery",label:"Filter repositories"}},ek=class extends V{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let e=dn("entity-search",q8,this.kind);return e?d`<input type="search" class="packages-search" placeholder="${`${e.label}\u2026`}" aria-label="${e.label}" .value="${xe(l[e.stateKey])}" @input="${this._onInput}">`:m}_onInput=e=>{this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:this.kind,value:e.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-search",ek);M();Jt();$e();O();var Y8=[["findings-desc","Findings \u2193"],["files-desc","Files \u2193"],["reports-desc","Reports \u2193"],["name-asc","Name A\u2192Z"]],X8={packages:{stateKey:"packagesSortBy",aria:"Sort packages"},repositories:{stateKey:"repositoriesSortBy",aria:"Sort repositories"}},tk=class extends V{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let e=dn("entity-sort",X8,this.kind);return e?d`<select class="packages-sort" aria-label="${e.aria}" .value="${xe(l[e.stateKey])}" @change="${this._onChange}">${Y8.map(([r,n])=>d`<option value="${r}" ?selected="${l[e.stateKey]===r}">${n}</option>`)}</select>`:m}_onChange=e=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:this.kind,value:e.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-sort",tk);M();Jt();$e();O();var rk=class extends V{static properties={showFile:{type:Boolean,attribute:"show-file"},showConfidence:{type:Boolean,attribute:"show-confidence"},showPriority:{type:Boolean,attribute:"show-priority"}};createRenderRoot(){return this}constructor(){super(),this.showFile=!1,this.showConfidence=!1,this.showPriority=!1}render(){let e=(r,n)=>d`<option value="${r}" ?selected="${l.sortBy===r}">${n}</option>`;return d`<select class="sort-select" aria-label="Sort findings" .value="${xe(l.sortBy)}" @change="${this._onChange}">${e("severity","Severity \u2193")} ${this.showFile?e("file","File \u2191"):m} ${this.showConfidence?d`${e("confidence-desc","Confidence \u2193")}${e("confidence-asc","Confidence \u2191")}`:m} ${this.showPriority?d`${e("priority-desc","Priority \u2193")}${e("priority-asc","Priority \u2191")}`:m}</select>`}_onChange=e=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:"findings",value:e.target.value},bubbles:!0,composed:!0}))}};customElements.define("findings-sort",rk);M();var e5=`:host{display:inline-flex;align-items:center;width:8.5rem;height:16px;--rs-thumb-size: 14px;--rs-track-height: 3px;--rs-rail: rgb(from currentcolor r g b / .25);--rs-fill: var(--accent, currentColor)}.track-wrap{position:relative;flex:1;height:var(--rs-thumb-size)}.track{position:absolute;left:0;right:0;top:50%;height:var(--rs-track-height);transform:translateY(-50%);border-radius:99px;background:linear-gradient(to right,var(--rs-rail) 0,var(--rs-rail) var(--low, 0%),var(--rs-fill) var(--low, 0%),var(--rs-fill) var(--high, 100%),var(--rs-rail) var(--high, 100%))}input[type=range]{appearance:none;-webkit-appearance:none;position:absolute;left:0;right:0;top:0;width:100%;height:var(--rs-thumb-size);background:transparent;pointer-events:none;margin:0;padding:0;outline:none}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;pointer-events:auto;width:var(--rs-thumb-size);height:var(--rs-thumb-size);border-radius:50%;background:var(--rs-fill);border:0;box-shadow:0 1px 3px #00000080}input[type=range]::-moz-range-thumb{pointer-events:auto;width:var(--rs-thumb-size);height:var(--rs-thumb-size);border-radius:50%;background:var(--rs-fill);border:0;box-shadow:0 1px 3px #00000080}input[type=range]::-webkit-slider-runnable-track{background:transparent;height:var(--rs-thumb-size)}
185
+ `;var nk=class extends J{static properties={min:{type:Number},max:{type:Number},step:{type:Number},low:{type:Number},high:{type:Number}};static styles=A(e5);constructor(){super(),this.min=0,this.max=100,this.step=1,this.low=0,this.high=100}willUpdate(){this.low<this.min&&(this.low=this.min),this.high>this.max&&(this.high=this.max),this.low>this.high&&(this.low=this.high)}render(){let e=this.max-this.min||1,r=(this.low-this.min)/e*100,n=(this.high-this.min)/e*100;return d`<div class="track-wrap" style="${`--low:${r}%;--high:${n}%`}"><div class="track"></div><input type="range" min="${this.min}" max="${this.max}" step="${this.step}" @input="${this._onInput}" @change="${this._onChange}"> <input type="range" min="${this.min}" max="${this.max}" step="${this.step}" @input="${this._onInput}" @change="${this._onChange}"></div>`}firstUpdated(){this._inputs=[...this.renderRoot.querySelectorAll('input[type="range"]')],this._inputs[0].value=this.low,this._inputs[1].value=this.high}updated(e){if(!this._inputs||!(e.has("low")||e.has("high")))return;let r=this._inputs.map(s=>Number(s.value)),n=r[0]>r[1],o=n?1:0,i=n?0:1;this.low!==r[o]&&(this._inputs[o].value=this.low),this.high!==r[i]&&(this._inputs[i].value=this.high)}_onInput=()=>{let e=Number(this._inputs[0].value),r=Number(this._inputs[1].value);this.low=Math.min(e,r),this.high=Math.max(e,r),this._emit("range-input")};_onChange=()=>{this._emit("range-change")};_emit(e){this.dispatchEvent(new CustomEvent(e,{detail:{low:this.low,high:this.high},bubbles:!0,composed:!0}))}};customElements.define("range-slider",nk);M();var ok=class extends J{static properties={low:{type:Number},high:{type:Number},for:{type:String}};createRenderRoot(){return this}constructor(){super(),this.low=0,this.high=10,this.for="conf-range",this._dragging=!1,this._liveLow=0,this._liveHigh=10}connectedCallback(){super.connectedCallback(),document.addEventListener("range-input",this._onRangeInput),document.addEventListener("range-change",this._onRangeChange)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("range-input",this._onRangeInput),document.removeEventListener("range-change",this._onRangeChange)}willUpdate(e){this._dragging&&(e.has("low")&&this.low!==this._liveLow&&(this.low=this._liveLow),e.has("high")&&this.high!==this._liveHigh&&(this.high=this._liveHigh))}_onRangeInput=e=>{e.target?.id===this.for&&(this._dragging=!0,this._liveLow=e.detail.low,this._liveHigh=e.detail.high,this.low=e.detail.low,this.high=e.detail.high)};_onRangeChange=e=>{e.target?.id===this.for&&(this._dragging=!1)};render(){return d`<span>${this.low}</span><span class="dash">–</span><span>${this.high}</span>`}};customElements.define("conf-range-mirror",ok);Fp();M();O();Nt();St();fe();var t5=`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{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.35rem .9rem;font:inherit;font-size:.8rem;&:hover{border-color:var(--accent);color:var(--accent)}&.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{margin:.5rem 0;padding:.4rem .6rem;border:1px solid var(--critical, #f87171);border-radius:5px;background:rgb(from var(--critical, #f87171) r g b / .07);color:var(--text);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: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)}&.status-err{border:1px solid var(--critical, #f87171);background:rgb(from var(--critical, #f87171) r g b / .07);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{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.3rem .8rem;font:inherit;font-size:.78rem;&:hover{border-color:var(--accent);color:var(--accent)}}
186
+ `;var ik=class extends F{static styles=[...F.styles,A(t5)];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:r}=await Sg();hn(e,r),this.status={kind:"ok",text:`Downloaded ${r}`}}catch(e){this.status={kind:"err",text:`Export failed: ${e.message}`}}finally{this.busy=!1}}async _onFile(e){let r=e.target.files?.[0];if(this.parsed=null,this.parseError=null,this.status=null,!!r)try{this.parsed=await Cg(r)}catch(n){this.parseError=n.message}}_onMode(e){this.mode=e.target.value}async _onApply(){if(!(!this.parsed||this.busy)){this.busy=!0,this.status=null;try{let e=await Eg(this.parsed,this.mode);_(),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 r=this.renderRoot.querySelector('input[type="file"]');r&&(r.value="")}catch(e){this.status={kind:"err",text:`Import failed: ${e.message}`}}finally{this.busy=!1}}}render(){let e=this.parsed;return d`<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\u2026":"Download backup"}</button></section><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?d`<div class="error">Failed to parse: ${this.parseError}</div>`:m} ${e?d`<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?d`<span class="meta">Exported ${e.exportedAt}.</span>`:m}</div><fieldset class="mode"><legend>Merge mode</legend><label><input type="radio" name="te-mode" value="prefer-current" .checked="${this.mode==="prefer-current"}" @change="${this._onMode}"> <span>Merge — keep current on conflict <em>(safest, only fills gaps)</em></span></label> <label><input type="radio" name="te-mode" value="prefer-imported" .checked="${this.mode==="prefer-imported"}" @change="${this._onMode}"> <span>Merge — prefer imported on conflict <em>(overwrites where both have a value)</em></span></label> <label><input type="radio" name="te-mode" value="replace" .checked="${this.mode==="replace"}" @change="${this._onMode}"> <span>Replace all <em>(drops every current persisted entry first — destructive)</em></span></label></fieldset><button type="button" class="primary" @click="${this._onApply}" ?disabled="${this.busy}">${this.busy?"Applying\u2026":"Apply import"}</button>`:m}</section>${this.status?d`<div class="${`status status-${this.status.kind}`}">${this.status.text}</div>`:m}<footer class="actions"><button type="button" @click="${this._onClose}">Close</button></footer></dialog>`}};customElements.define("triage-export-dialog",ik);function r5(){return le("triage-export-dialog")}M();Jt();var n5=`:host{display:inline-block;vertical-align:middle;position:relative}.chip{display:inline-flex;align-items:center;gap:.375rem;cursor:default;user-select:none;position:relative;min-height:24px;box-sizing:border-box;padding:.125rem .375rem .125rem .5rem;background:var(--surface);border:1px solid var(--border);border-radius:999px;color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;font-weight:500}.chip svg{color:var(--muted);flex-shrink:0}.chip.empty:hover{border-color:var(--accent)}.chip.empty .label{color:var(--muted);font-style:italic}.chip.readonly{padding-right:.5rem}.chip.copied:after{content:"Copied";position:absolute;inset:0;display:grid;place-items:center;background:var(--surface);backdrop-filter:var(--glass-blur);border-radius:999px;color:var(--text);font-weight:400;white-space:nowrap;pointer-events:none}.edit-btn{width:18px;height:18px;display:grid;place-items:center;padding:0;margin-left:.125rem;background:transparent;border:0;border-radius:4px;color:var(--muted)}.edit-btn:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}@media(display-mode:window-controls-overlay){.edit-btn,.url-input,input{-webkit-app-region:no-drag;app-region:no-drag}}.chip[inert]{visibility:hidden;min-width:19rem}input{position:absolute;inset:0;box-sizing:border-box;padding:0 .55rem;background:var(--surface);border:1px solid var(--accent);border-radius:999px;color:var(--text);font:inherit;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;font-weight:400;outline:none}@media print{.chip{color:#000!important;border:0!important}.chip svg{color:#000!important}.edit-btn,input{display:none!important}}
187
+ `;ue();var sk=d`<svg viewBox="0 0 16 16" width="12" height="12" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>`,o5=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="currentColor" aria-hidden="true"><path d="M11.013 1.427a1.75 1.75 0 0 1 2.474 0l1.086 1.086a1.75 1.75 0 0 1 0 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 0 1-.927-.928l.929-3.25c.082-.286.235-.547.445-.758l8.61-8.61z"/></svg>`,ak=class extends J{static properties={url:{type:String},editable:{type:Boolean,reflect:!0},editing:{type:Boolean,reflect:!0},_copied:{state:!0}};static styles=A(n5);constructor(){super(),this.url="",this.editable=!1,this.editing=!1,this._copied=!1,this._opener=""}render(){if(this.editable&&this.editing){let e=!!this.url,r=e?Ge(this.url):"Set repo";return d`<span class="${e?"chip":"chip empty"}" aria-hidden="true" inert>${sk} <span class="label">${r}</span> <button type="button" class="edit-btn">${o5}</button> </span><input type="text" .value="${xe(this.url)}" placeholder="user/repo or https://github.com/user/repo" @input="${this._onInput}" @focus="${this._onFocus}" @keydown="${this._onKeydown}" @blur="${this._onBlur}">`}if(this.editable){let e=!!this.url,r=e?Ge(this.url):"Set repo",n=e?this._copied?"chip copied":"chip":"chip empty";return d`<span class="${n}" @click="${e?null:this._onEdit}">${sk} ${e?this._slugLabel(r):d`<span class="label">${r}</span>`} <button type="button" class="edit-btn" aria-label="Edit repo URL" @click="${this._onEdit}">${o5}</button></span>`}if(this.url){let e=this._copied?"chip readonly copied":"chip readonly";return d`<span class="${e}" title="Repo from findings (read-only)">${sk} ${this._slugLabel(Ge(this.url))}</span>`}return m}_slugLabel(e){return d`<span class="label" title="Copy repo name" @click="${this._onCopyLabel}">${e}</span>`}updated(e){if(e.has("editing")&&this.editing){let r=this.renderRoot.querySelector("input");r&&(r.focus(),r.select())}}_onEdit=e=>{e&&e.stopPropagation(),this._emit("repo-edit-start")};_onCopyLabel=e=>{e&&e.stopPropagation();let r=Ge(this.url);if(r)try{navigator.clipboard.writeText(r).then(()=>(this._copied=!0,setTimeout(()=>{this._copied=!1},1e3),null)).catch(()=>{})}catch{}};_onFocus=e=>{this._opener=e.target.value};_onInput=e=>{this.url=e.target.value,this._emit("repo-input",{url:this.url})};_onKeydown=e=>{e.key==="Enter"?(e.preventDefault(),this._emit("repo-commit",{url:this.url})):e.key==="Escape"&&(e.preventDefault(),this.url=this._opener,this._emit("repo-cancel",{url:this._opener}))};_onBlur=()=>{this.editing&&this._emit("repo-commit",{url:this.url})};_emit(e,r){this.dispatchEvent(new CustomEvent(e,{detail:r,bubbles:!0,composed:!0}))}};customElements.define("repo-chip",ak);M();Me();bt();$e();O();Wt();var eP=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="bubble" d="M2.5 3h11a.5.5 0 0 1 .5.5v6.5a.5.5 0 0 1-.5.5H8.4l-3 2.6V10.5H2.5a.5.5 0 0 1-.5-.5V3.5a.5.5 0 0 1 .5-.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,tP=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="wrench" d="M10.4 2.6a3 3 0 0 0-3.6 4.5L2 12l2 2 4.9-4.8a3 3 0 0 0 4.5-3.6l-1.8 1.8-1.5-.4-.4-1.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,rP=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="flag-cloth" d="M5 1.5h6v13l-3-2.7-3 2.7z" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/></svg>`,nP=Z(As.replace('width="14" height="14"','width="12" height="12"')),oP=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.15" stroke-linecap="round" stroke-linejoin="round"><path d="M5 1.2 1.3 3.1v5.7L5 10.7l3.7-1.9V3.1Z M1.3 3.1 5 5l3.7-1.9 M5 5v5.7"/><path d="M11 5.2 7.3 7.1v5.7l3.7 1.9 3.7-1.9V7.1Z M7.3 7.1 11 9l3.7-1.9 M11 9v5.7"/></g></svg>`,iP=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"><rect x="3.4" y="1.5" width="10" height="3.6" rx=".8"/><rect x="2.2" y="5.3" width="10" height="3.6" rx=".8"/><rect x="1" y="9.1" width="10" height="3.6" rx=".8"/></g></svg>`,sP=[{key:"comment",glyph:eP,label:"commented",stateKey:"filterComment",hasKey:"hasComment"},{key:"fix",glyph:tP,label:"fixed",stateKey:"filterFix",hasKey:"hasFix"},{key:"flag",glyph:rP,label:"flagged",stateKey:"filterFlagged",hasKey:"hasFlagged"},{key:"duplicates",glyph:nP,label:"rows with duplicates in other reports",stateKey:"filterDuplicates",hasKey:"hasDuplicates"},{key:"cross-context",glyph:oP,label:"rows across multiple repos or packages",stateKey:"filterCrossContext",hasKey:"hasCrossContext"},{key:"app-stacked",glyph:iP,label:"stacked App rows",stateKey:"filterAppStacked",hasKey:"hasAppStacked"}],aP=new Set(["duplicates","cross-context","app-stacked"]),lk=class extends V{static properties={group:{type:String},hasComment:{attribute:!1},hasFix:{attribute:!1},hasFlagged:{attribute:!1},hasDuplicates:{attribute:!1},hasCrossContext:{attribute:!1},hasAppStacked:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.group="marks",this.hasComment=!1,this.hasFix=!1,this.hasFlagged=!1,this.hasDuplicates=!1,this.hasCrossContext=!1,this.hasAppStacked=!1}connectedCallback(){super.connectedCallback(),Ye(this,{role:"group","aria-label":this.group==="context"?"Finding row filters":"Annotation filter"})}render(){let e=sP.filter(n=>this.group==="context"===aP.has(n.key)).filter(n=>n.key==="duplicates"?!l.currentWorkspace&&(this.hasDuplicates||l[n.stateKey]):this[n.hasKey]||l[n.stateKey]);if(e.length===0)return m;let r=n=>{let o=l[n.stateKey],i=n.key==="duplicates"||n.key==="cross-context"||n.key==="app-stacked"?n.label:`${n.label} findings`,s=o==="with"?`Showing only ${i} \u2014 click to exclude them`:o==="without"?`Excluding ${i} \u2014 click to clear`:`Show only ${i}`;return d`<button type="button" class="${I({"annotation-chip":!0,"sel-with":o==="with","sel-without":o==="without"})}" aria-label="${s}" aria-pressed="${String(o!=="")}" @click="${()=>this._toggle(n.key)}">${n.glyph}</button>`};return d`${e.map(r)}`}_toggle(e){this.dispatchEvent(new CustomEvent("annotation-filter-toggle",{detail:{key:e},bubbles:!0,composed:!0}))}};customElements.define("annotation-filter",lk);M();Me();$e();O();var lP=[["critical","Critical"],["high","High"],["medium","Medium"],["low","Low"],["high_bug","High bug"],["bug","Bug"],["informational","Info"]],ck=class extends V{static properties={counts:{attribute:!1},selected:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.selected=[],this.kind="findings"}connectedCallback(){super.connectedCallback(),Ye(this,{role:"group","aria-label":"Filter by severity"})}render(){let e=this.kind==="graph"?new Set(this.selected):l.filterSeverities,r=lP.filter(([n])=>(this.counts[n]??0)||e.has(n));return r.length===0?m:d`${r.map(([n,o])=>{let i=this.counts[n]??0,s=e.has(n);return d`<button type="button" class="${I({"sev-chip":!0,[n]:!0,active:s})}" aria-pressed="${String(s)}" @click="${()=>this._toggle(n)}"><span class="sd"></span><span class="name">${o}</span><span class="n">${i}</span></button>`})}`}_toggle(e){this.dispatchEvent(new CustomEvent("severity-toggle",{detail:{severity:e,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("severity-chips",ck);Me();$e();O();var cP=[["corrected","Corrected","Show corrected severities (application-specific re-ratings)"],["original","Original","Show the original analyzer severities"]],dk=class extends V{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Ye(this,{role:"group","aria-label":"Severity display mode"})}render(){let e=l.severityMode;return d`<span class="severity-mode-label">Severity</span><span class="severity-mode-chips">${cP.map(([r,n,o])=>{let i=e===r;return d`<button type="button" class="${I({"severity-mode-chip":!0,active:i})}" aria-pressed="${String(i)}" data-tooltip="${o}" @click="${()=>this._select(r)}">${n}</button>`})}</span>`}_select(e){e!==l.severityMode&&this.dispatchEvent(new CustomEvent("severity-mode-change",{detail:{mode:e},bubbles:!0,composed:!0}))}};customElements.define("severity-mode-switch",dk);M();Me();$e();O();var dP=d`<svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"><path d="M8 1.8 14.4 5 8 8.2 1.6 5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><path d="M2.6 8 8 10.7 13.4 8" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/><path d="M2.6 11 8 13.7 13.4 11" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,i5="Show underlying code findings",uP=d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 5.5v2h10v-2M8 7.5v3"/><rect x="1" y="1.5" width="4" height="4" rx=".6"/><rect x="11" y="1.5" width="4" height="4" rx=".6"/><rect x="6" y="10.5" width="4" height="4" rx=".6"/></svg>`,s5="Show only upstream dependency findings",uk=class extends V{static properties={canDrop:{type:Boolean,attribute:"can-drop"},canDetail:{type:Boolean,attribute:"can-detail"},canUpstream:{type:Boolean,attribute:"can-upstream"},upstreamDisabled:{type:Boolean,attribute:"upstream-disabled"}};createRenderRoot(){return this}constructor(){super(),this.canDrop=!1,this.canDetail=!1,this.canUpstream=!1,this.upstreamDisabled=!1}connectedCallback(){super.connectedCallback(),Ye(this,{role:"group","aria-label":"Revalidation layer"})}render(){let e=l.revalidateConflicts.size,r=e>0?d`<button type="button" class="revalidation-toggle revalidation-conflicts" aria-haspopup="dialog" aria-label="${`View ${e} revalidation conflict${e===1?"":"s"}`}" @click="${this._openConflicts}">${e} ${e===1?"conflict":"conflicts"}</button>`:m,n=l.showRevalidation!==!1,o=n&&l.revalidationDetailed===!0,i=l.upstreamOnly===!0,s=i&&!this.upstreamDisabled;return d`${r}${e===0&&this.canDrop?d`<mode-switch class="revalidation-toggle" label="App" borderless .checked="${n}" accessible-label="App view — hide the issues the revalidation pass ruled out" .disabled="${i}" @click="${this._toggle}"></mode-switch>`:m}${e===0&&this.canDrop&&this.canDetail?d`<button type="button" class="${I({"revalidation-detail":!0,on:o})}" aria-pressed="${String(o)}" aria-label="${i5}" data-tooltip="${i5}" ?disabled="${!n||i}" @click="${this._toggleDetail}">${dP}</button>`:m}${this.canUpstream?d`<button type="button" class="${I({"revalidation-upstream":!0,on:s})}" aria-pressed="${String(s)}" aria-label="${s5}" data-tooltip="${s5}" ?disabled="${this.upstreamDisabled}" @click="${this._toggleUpstream}">${uP}</button>`:m}`}_toggle=()=>{this.dispatchEvent(new CustomEvent("revalidation-change",{detail:{on:l.showRevalidation===!1},bubbles:!0,composed:!0}))};_openConflicts=()=>{this.dispatchEvent(new CustomEvent("revalidation-conflicts-open",{bubbles:!0,composed:!0}))};_toggleDetail=()=>{this.dispatchEvent(new CustomEvent("revalidation-detail-change",{detail:{on:l.revalidationDetailed!==!0},bubbles:!0,composed:!0}))};_toggleUpstream=()=>{this.upstreamDisabled||this.dispatchEvent(new CustomEvent("upstream-only-change",{detail:{on:l.upstreamOnly!==!0},bubbles:!0,composed:!0}))}};customElements.define("revalidation-switch",uk);Xg();var a5=`:host{display:inline-flex;flex-shrink:0;vertical-align:middle;--switch-track-width: 26px;--switch-track-height: 14px}button{display:inline-flex;align-items:center;gap:8px;box-sizing:border-box;height:30px;margin:0;padding:0 .6rem;border:1px solid var(--border);border-radius:4px;background:transparent;color:var(--muted);font:inherit;font-size:.78rem;font-weight:500;line-height:1;white-space:nowrap;cursor:default;&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .04)}&[aria-pressed=true]{color:var(--text)}&:disabled{opacity:.4}&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}.track{position:relative;flex-shrink:0;width:var(--switch-track-width);height:var(--switch-track-height);background:var(--border);border-radius:8px;transition:background .15s;&:after{content:"";position:absolute;top:2px;left:2px;width:calc(var(--switch-track-height) - 4px);height:calc(var(--switch-track-height) - 4px);border-radius:50%;background:var(--muted);transition:transform .15s,background .15s}}button[aria-pressed=true] .track{background:color-mix(in oklch,var(--accent) 22%,transparent);&:after{transform:translate(calc(var(--switch-track-width) - var(--switch-track-height)));background:var(--accent)}}:host([borderless]) button{height:100%;border:0;border-radius:0}:host([compact]){--switch-track-width: 22px;--switch-track-height: 12px}:host([compact]) button{height:auto;gap:7px;padding:2px 8px;border-radius:6px;font-size:.68rem;line-height:1.2}
188
+ `;var pk=class extends J1{static properties={checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},label:{type:String},accessibleLabel:{type:String,attribute:"accessible-label"}};static styles=Q1(a5);constructor(){super(),this.checked=!1,this.disabled=!1,this.label="",this.accessibleLabel=""}render(){return zl`<button type="button" part="button" aria-pressed="${String(this.checked)}" aria-label="${this.accessibleLabel||this.label}" ?disabled="${this.disabled}"><span>${this.label}</span><span class="track" part="track" aria-hidden="true"></span></button>`}};customElements.get("mode-switch")||customElements.define("mode-switch",pk);$e();O();var fP=d`<svg class="trash-icon" viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 4h10M6.5 4V2.5h3V4M5 4l.7 9h4.6L11 4"/></svg>`,fk=class extends V{createRenderRoot(){return this}render(){let e=l.currentView==="bundles"&&l.selectedBundle,r=!l.currentFile&&!e;return d`<button type="button" class="danger" ?disabled="${r}">${fP}<span>Delete current</span></button>`}};customElements.define("sidebar-delete-current",fk);M();Me();$e();O();var hP=d`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 6h12v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6Z"/><path d="M2 6l1.6-3.3A1.3 1.3 0 0 1 4.8 2h6.4a1.3 1.3 0 0 1 1.2.7L14 6"/><path d="M8 2v4"/></svg>`,mP=d`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" x2="4" y1="2.5" y2="10"/><circle cx="12" cy="4" r="2"/><circle cx="4" cy="12" r="2"/><path d="M12 6a6 6 0 0 1-6 6"/></svg>`,gP={packages:{title:"Show packages",icon:hP,view:"packages"},repositories:{title:"Show repositories",icon:mP,view:"repositories"}},hk=class extends V{static properties={kind:{type:String},count:{type:Number}};createRenderRoot(){return this}constructor(){super(),this.kind="",this.count=0}render(){if(this.count===0)return m;let e=dn("sidebar-view-button",gP,this.kind);if(!e)return m;let r=l.currentView===e.view;return d`<button type="button" class="${I({"sidebar-view-btn":!0,active:r})}" data-tooltip="${e.title}" aria-label="${e.title}">${e.icon}<span class="view-btn-count">${this.count}</span></button>`}};customElements.define("sidebar-view-button",hk);M();Me();$e();O();var bP=["invalid","deleted"],yP={package:{stateKey:"packageSlideTriage"},repository:{stateKey:"repositorySlideTriage"}},mk=class extends V{static properties={counts:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.kind=""}connectedCallback(){super.connectedCallback(),Ye(this,{role:"group","aria-label":"Triage view"})}render(){let e=dn("slide-triage-tabs",yP,this.kind);if(!e)return m;let r=l[e.stateKey],n=bP.filter(o=>(this.counts[o]??0)>0||r===o);return n.length===0?m:d`${n.map(o=>{let i=r===o,s=this.counts[o]??0;return d`<button type="button" class="${I({"triage-state-btn":!0,[`triage-state-${o}`]:!0,active:i})}" aria-pressed="${String(i)}" @click="${()=>this._toggle(o)}">${o.charAt(0).toUpperCase()+o.slice(1)} (${s})</button>`})}`}_toggle(e){this.dispatchEvent(new CustomEvent("slide-triage-toggle",{detail:{kind:this.kind,value:e},bubbles:!0,composed:!0}))}};customElements.define("slide-triage-tabs",mk);Me();$e();O();var vP=[["own","Sources"],["modules","Deps"]],gk=class extends V{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Ye(this,{role:"group","aria-label":"Source filter"})}render(){return d`${vP.map(([e,r])=>{let n=l.filterSources.has(e);return d`<button type="button" class="${I({"source-chip":!0,active:n})}" aria-pressed="${String(n)}" @click="${()=>this._toggle(e)}">${r}</button>`})}`}_toggle(e){this.dispatchEvent(new CustomEvent("source-toggle",{detail:{source:e},bubbles:!0,composed:!0}))}};customElements.define("source-filter",gk);M();Me();Jt();$e();O();var wP=d`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>`,kP=d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h10v4"/></svg>`,xP={findings:{stateKey:"filterInclude",placeholder:"Search findings\u2026"},files:{stateKey:"filesSearch",placeholder:"Search files\u2026"}},bk=class extends V{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let e=dn("toolbar-search",xP,this.kind);if(!e)return m;let r=l[e.stateKey];return d`${wP} <input type="text" aria-label="${e.placeholder}" placeholder="${e.placeholder}" .value="${xe(r)}" @input="${this._onInput}"> ${this.kind==="findings"&&r?this._negateToggle():m}`}_negateToggle(){let e=l.filterIncludeNegate;return d`<button type="button" class="${I({"search-negate-btn":!0,active:e})}" data-tooltip="${e?"Negation on \u2014 click to undo":"Negate: show non-matching findings"}" aria-label="Negate search" aria-pressed="${String(e)}" @click="${this._onToggleNegate}">${kP}</button>`}_onInput=e=>{this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:this.kind,value:e.target.value},bubbles:!0,composed:!0}))};_onToggleNegate=()=>{this.dispatchEvent(new CustomEvent("search-negate-toggle",{bubbles:!0,composed:!0}))}};customElements.define("toolbar-search",bk);$e();O();Xr();ue();nf();var yk=class extends V{static properties={options:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.options=[]}render(){let e=[{value:"",label:"All repositories",special:!0,reset:!0},...this.options.map(r=>({value:r??Ti,label:r==null?"(no repo)":Ge(r),special:r==null}))];return d`<repository-selector variant="filter" label="Filter by repository" .options="${e}" .value="${l.filterRepo}" @repository-change="${r=>this.dispatchEvent(new CustomEvent("repo-change",{detail:{value:r.detail.value},bubbles:!0,composed:!0}))}"></repository-selector>`}};customElements.define("repo-filter",yk);M();Jt();Me();$e();ue();O();var l5={"":{cls:"included",label:"+ Partial",title:"Confirmed, partial and revalidation rows \u2014 click for full confirmations only"},exclude:{cls:"excluded",label:"\u2212 Partial",title:"Full confirmations only \u2014 click to show the partial ones only"},only:{cls:"only",label:"only Partial",title:"Partial confirmations only \u2014 click to show all of them again"}},vk=class extends V{static properties={options:{attribute:!1},hasPartial:{type:Boolean,attribute:"has-partial"}};createRenderRoot(){return this}constructor(){super(),this.options=[],this.hasPartial=!1}render(){return d`<select class="sort-select" aria-label="Filter by revalidation outcome" .value="${xe(l.filterRevalidate)}" @change="${this._onChange}"><option value="" hidden ?selected="${l.filterRevalidate===""}"></option><option value="">Confidence</option>${this.options.map(e=>d`<option value="${e.value}" ?selected="${l.filterRevalidate===e.value}">${e.label}</option>`)}</select> ${this.hasPartial&&l.filterRevalidate==="confirmed"?this._partialChip():m}`}_partialChip(){let e=l5[l.filterPartial]??l5[""];return d`<button type="button" class="${I({"partial-cycle":!0,[e.cls]:!0})}" data-tooltip="${e.title}" @click="${this._onPartial}">${e.label}</button>`}_onPartial=()=>{let e=Ku.indexOf(l.filterPartial),r=Ku[(e+1)%Ku.length];this.dispatchEvent(new CustomEvent("partial-change",{detail:{value:r},bubbles:!0,composed:!0}))};_onChange=e=>{let{value:r}=e.target;r||(e.target.selectedIndex=0),this.dispatchEvent(new CustomEvent("revalidate-change",{detail:{value:r},bubbles:!0,composed:!0}))}};customElements.define("revalidate-filter",vk);M();$e();O();var c5=[["none","none","unmarked"],["red","r","red"],["blue","b","blue"],["green","g","green"],["gray","x","gray"]],wk=class extends V{static properties={counts:{attribute:!1},selected:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.selected=[],this.kind="findings"}connectedCallback(){super.connectedCallback(),Ye(this,{role:"group","aria-label":"Filter by mark color"})}render(){let e=this.kind==="graph"?new Set(this.selected):l.filterColors;return c5.some(([n])=>(this.counts[n]??0)||e.has(n))?d`${c5.map(([n,o,i])=>{let s=this.counts[n]??0,a=e.has(n);return d`<button type="button" class="${a?"active":""}" aria-label="${`${i} (${s})`}" data-tooltip="${`${i} (${s})`}" aria-pressed="${String(a)}" @click="${()=>this._toggle(n)}"><span class="${`td ${o}`}"></span><span class="count">${s}</span></button>`})}`:m}_toggle(e){this.dispatchEvent(new CustomEvent("color-toggle",{detail:{color:e,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("triage-filter",wk);M();Me();$e();O();var $P=["inprogress","fixed","invalid","deleted","ignored"],kk={graph:"graph2-triage-selector",packages:"packages-triage-selector"},_P={inprogress:"In progress"},SP=t=>_P[t]??t.charAt(0).toUpperCase()+t.slice(1),xk=class extends V{static properties={counts:{attribute:!1},states:{attribute:!1},variant:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.states=null,this.variant=""}connectedCallback(){super.connectedCallback(),Ye(this,{role:"group","aria-label":"Triage view"})}render(){let e=this.states??$P,r=e.reduce((i,s)=>i+(this.counts[s]??0),0),n=this.variant?kk[this.variant]:null;this.variant&&n===void 0&&console.warn(`<triage-selector>: unknown variant ${JSON.stringify(this.variant)}; expected one of ${Object.keys(kk).map(i=>JSON.stringify(i)).join(", ")} or "".`);for(let i of Object.values(kk))this.classList.toggle(i,i===n);let o=r===0&&!l.shownTriage;return this.classList.toggle("is-empty",o),o?m:d`${e.map(i=>{let s=this.counts[i]??0,a=l.shownTriage===i;if(s===0&&!a)return m;let c=SP(i);return d`<button type="button" class="${I({"triage-state-btn":!0,[`triage-state-${i}`]:!0,active:a})}" data-triage-show="${i}" aria-pressed="${String(a)}"><span>${c}</span><span class="n">${s}</span></button>`})}`}};customElements.define("triage-selector",xk);Me();$e();O();bt();Wt();var CP={table:d`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="3" y2="21"/></svg>`,list:d`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="3" x2="21" y1="6" y2="6"/><line x1="3" x2="21" y1="12" y2="12"/><line x1="3" x2="21" y1="18" y2="18"/></svg>`,grouped:d`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="2" y="1.5" width="12" height="2" rx=".4"/><rect x="5" y="4.4" width="9" height="1.3"/><rect x="5" y="6.2" width="9" height="1.3"/><rect x="2" y="8.5" width="12" height="2" rx=".4"/><rect x="5" y="11.4" width="9" height="1.3"/><rect x="5" y="13.2" width="9" height="1.3"/></svg>`,kanban:d`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1.5" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="6.1" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="10.7" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="2.4" y="3.6" width="2" height="1.4" rx=".2"/><rect x="2.4" y="5.6" width="2" height="1.4" rx=".2"/><rect x="7" y="3.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="3.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="5.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="7.6" width="2" height="1.4" rx=".2"/></svg>`,focus:d`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1.5" y="2.5" width="8.5" height="11" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="3" y="4.4" width="5.5" height="1"/><rect x="3" y="6.4" width="5.5" height="1"/><rect x="3" y="8.4" width="3.5" height="1"/><rect x="11.2" y="2.5" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".55"/><rect x="11.2" y="5.7" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".35"/><rect x="11.2" y="8.9" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".22"/></svg>`,graph:d`${Z(N1)}`},EP={table:"Table view (compact rows, click a row to expand)",list:"List view (flat, one card per finding)",grouped:"List view, grouped by file",focus:"Focus view (one finding centered + a queue of next findings)",kanban:"Kanban board, columns grouped by triage status",graph:"Graph view (canvas with imports / exports)"},$k=["kanban","focus","table","list","grouped","graph"],_k=class extends V{static properties={modes:{type:String},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.modes=$k.join(","),this.kind="findings"}connectedCallback(){super.connectedCallback(),Ye(this,{role:"group","aria-label":"View mode"})}render(){let e=this.kind==="files"?l.filesViewMode:l.viewMode,r=this.modes.split(",").map(o=>o.trim()).filter(o=>$k.includes(o)),n=r.length>0?r:$k;return d`${n.map(o=>d`<button type="button" class="${I({"view-mode-btn":!0,active:e===o})}" aria-label="${EP[o]}" aria-pressed="${String(e===o)}" @click="${()=>this._select(o,e)}">${CP[o]}</button>`)}`}_select(e,r){e!==r&&this.dispatchEvent(new CustomEvent("view-mode-change",{detail:{mode:e,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("view-mode-buttons",_k);M();fn();Me();tn();Rp();ue();Bi();Gs();var f5=6,d5=14,Af=2,u5=24,Vc=4,RP=1.5,Tf=new Map,Mf=new Map,p5="treemap";function AP(t){let e=/^#?([0-9a-f]{6})$/iu.exec(t);if(!e)return"#fff";let r=parseInt(e[1],16),n=r>>16&255,o=r>>8&255,i=r&255;return(.2126*n+.7152*o+.0722*i)/255>.6?"#1a1a1a":"#fff"}function TP(t,e,r,n){let o=r*r,i=n*n;return Math.max(i*t/o,o/(i*e))}function h5(t,e){let r=[],n=t.filter(f=>f.value>0),{x:o,y:i,w:s,h:a}=e;if(n.length===0||s<=0||a<=0)return r;let c=0;for(let f of n)c+=f.value;let u=s*a/c,p=0;for(;p<n.length&&s>.5&&a>.5;){let f=Math.min(s,a),h=p,g=0,y=0,b=1/0,v=1/0;for(;h<n.length;){let k=n[h].value*u,$=k>y?k:y,C=k<b?k:b,U=TP($,C,g+k,f);if(h===p||U<=v)v=U,g+=k,y=$,b=C,h++;else break}let x=g/f;if(s>=a){let k=i;for(let $=p;$<h;$++){let C=$===h-1?i+a-k:n[$].value*u/x;r.push({node:n[$],x:o,y:k,w:x,h:C}),k+=C}o+=x,s-=x}else{let k=o;for(let $=p;$<h;$++){let C=$===h-1?o+s-k:n[$].value*u/x;r.push({node:n[$],x:k,y:i,w:C,h:x}),k+=C}i+=x,a-=x}p=h}return r}function m5(t){for(;t.children&&t.children.size===1;){let e=t.children.values().next().value;if(e.isFile)break;t.name=`${t.name}/${e.name}`,t.children=e.children}if(t.children)for(let e of t.children.values())m5(e)}function g5(t,e,r,n){if(t.path=t.name?e?`${e}/${t.name}`:t.name:e,t.parent=r,t.isFile)return t.count=1,t.value;n.set(t.path,t);let o=0,i=0,s;for(let a of t.children.values())o+=g5(a,t.path,t,n),i+=a.count,s===void 0?s=a.pkg:s!==a.pkg&&(s=null);return t.value=o,t.count=i,t.pkg=s??null,o}function b5(t,e,r,n,o,i,s){if(n<Vc||o<Vc)return;if(t.isFile){s.push({kind:"file",node:t,x:e,y:r,w:n,h:o});return}if(!(i<f5&&n>=u5&&o>=u5&&t.children.size>0)){s.push({kind:"agg",node:t,x:e,y:r,w:n,h:o});return}s.push({kind:"dir",node:t,x:e,y:r,w:n,h:o});let c=o>=d5+Vc+Af?d5:0,u=e+Af,p=r+c,f=n-Af*2,h=o-c-Af;if(f<Vc||h<Vc)return;let g=[...t.children.values()].toSorted((y,b)=>b.value-y.value);for(let y of h5(g,{x:u,y:p,w:f,h}))b5(y.node,y.x,y.y,y.w,y.h,i+1,s)}function Sk(t,e){let r=t/(e||1)*100;return r>=10?r.toFixed(0):r.toFixed(r>=1?1:2)}function y5(t,e){if(e<=0||t.isFile||!t.children||t.children.size===0)return 0;let r=1;for(let n of t.children.values()){if(r>=e)break;let o=1+y5(n,e-1);o>r&&(r=o)}return r}function MP(t,e,r,n,o,i){let s=Math.min(i-o,Math.PI*2-1e-4),a=o+s,c=s>Math.PI?1:0,u=Math.cos(o),p=Math.sin(o),f=Math.cos(a),h=Math.sin(a),g=y=>y.toFixed(2);return`M${g(t+n*u)} ${g(e+n*p)}A${g(n)} ${g(n)} 0 ${c} 1 ${g(t+n*f)} ${g(e+n*h)}L${g(t+r*f)} ${g(e+r*h)}A${g(r)} ${g(r)} 0 ${c} 0 ${g(t+r*u)} ${g(e+r*p)}Z`}function IP(t,e){let r=Math.max(4,Math.floor(e/6.4));return t.length>r?`${t.slice(0,r-1)}\u2026`:t}var Ck=class extends J{static properties={details:{attribute:!1},_w:{state:!0},_h:{state:!0},_focus:{state:!0},_mode:{state:!0},_reason:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this._w=0,this._h=0,this._root=null,this._focus=[],this._mode=p5,this._reason="",this._reasons=new Map,this._dirByPath=new Map,this._status="loading",this._meta={total:0,prefix:""},this._ro=null,this._plot=null,this._tooltip=null,this._ttCell=null}willUpdate(e){e.has("details")&&(this._reason=Mf.get(this.details?.integrity)??""),(e.has("details")||e.has("_reason"))&&this._rebuild()}firstUpdated(){this._plot=this.querySelector(".bundle-treemap-plot"),this._tooltip=this.querySelector(".bundle-treemap-tooltip"),!(!this._plot||typeof ResizeObserver>"u")&&(this._ro=new ResizeObserver(e=>{let r=e[0]?.contentRect;if(!r)return;let n=Math.floor(r.width),o=Math.floor(r.height);(n!==this._w||o!==this._h)&&(this._w=n,this._h=o)}),this._ro.observe(this._plot))}disconnectedCallback(){super.disconnectedCallback(),this._ro&&(this._ro.disconnect(),this._ro=null)}_onPointerMove(e){let r=e.target.closest(".bundle-treemap-node");if(!r||!this._tooltip){this._hideTooltip();return}if(r!==this._ttCell){this._ttCell=r;let n=r.dataset;ie(d`<div class="bundle-treemap-tt-path">${n.ttPath}</div>${n.ttPkg?d`<div class="bundle-treemap-tt-head"><span class="bundle-treemap-tt-dot" style="${`background:${n.ttColor}`}"></span> <span class="bundle-treemap-tt-pkg">${n.ttPkg}</span></div>`:""}<div class="bundle-treemap-tt-meta">${n.ttMeta}</div>`,this._tooltip)}this._positionTooltip(e.clientX,e.clientY)}_onPointerLeave(){this._hideTooltip()}_positionTooltip(e,r){let n=this._tooltip;if(!n||!this._plot)return;n.classList.add("show");let o=this._plot.getBoundingClientRect(),i=e-o.left,s=r-o.top,a=12,c=i+a;c+n.offsetWidth>o.width-4&&(c=i-n.offsetWidth-a),c<4&&(c=4);let u=s+a;u+n.offsetHeight>o.height-4&&(u=s-n.offsetHeight-a),u<4&&(u=4),n.style.left=`${c}px`,n.style.top=`${u}px`}_hideTooltip(){this._ttCell=null,this._tooltip&&this._tooltip.classList.remove("show")}_rebuild(){if(this._root=null,this._focus=[],this._dirByPath=new Map,this._reasons=new Map,this._meta={total:0,prefix:""},this._hideTooltip(),!this.details){this._status="loading";return}let e=fr(this.details),r=[...e.keys()].filter(h=>e.get(h)!==null);if(r.length===0){this._status="empty";return}this._reasons=qs(this.details,r),this._reasons.has(this._reason)||(this._reason="",Mf.delete(this.details.integrity));let n=this._reasons.get(this._reason),o=en(this.details),i=Hs(this.details),{prefix:s,stripped:a}=Kt(r),c={name:"",children:new Map,value:0,isFile:!1},u=0;for(let h=0;h<r.length;h++){if(n&&!n.has(r[h]))continue;let g=e.get(r[h]);if(g<=0)continue;let y=a[h].split("/"),b=c,v=!1;for(let $=0;$<y.length-1;$++){let C=b.children.get(y[$]);if(C&&C.isFile){v=!0;break}C||(C={name:y[$],children:new Map,value:0,isFile:!1},b.children.set(y[$],C)),b=C}if(v)continue;let x=y.at(-1),k=b.children.get(x);if(!(k&&!k.isFile)){if(!k){let $=st(a[h],{packageDir:o?.get(r[h])});k={name:x,isFile:!0,value:0,origPath:r[h],pkg:$,resource:i.get(r[h])==="resource"},b.children.set(x,k)}k.value+=g,u+=g}}if(u===0){this._status="empty";return}for(let h of c.children.values())m5(h);let p=new Map;g5(c,"",null,p),this._root=c,this._dirByPath=p,this._meta={total:u,prefix:s},this._status="ok";let f=this.details?.integrity?Tf.get(this.details.integrity):null;if(f){let h=p.get(f);h?this._focus=this._chainTo(h):Tf.delete(this.details.integrity)}}get _focusNode(){return this._focus.length>0?this._focus.at(-1):this._root}_chainTo(e){let r=[];for(let n=e;n&&n!==this._root;n=n.parent)r.push(n);return r.reverse(),r}_rememberFocus(){let e=this.details?.integrity;if(!e)return;let r=this._focus.at(-1)?.path;r?Tf.set(e,r):Tf.delete(e)}_drillInto(e){!e||e.isFile||!e.children||e.children.size===0||(this._focus=this._chainTo(e),this._rememberFocus(),this._hideTooltip())}_focusTo(e){let r=e<0?[]:this._focus.slice(0,e+1);r.length!==this._focus.length&&(this._focus=r,this._rememberFocus(),this._hideTooltip())}_toggleMode(){this._mode=this._mode==="sunburst"?"treemap":"sunburst",p5=this._mode,this._hideTooltip()}_changeReason(e){this._reason=e.target.value;let r=this.details?.integrity;r&&(this._reason?Mf.set(r,this._reason):Mf.delete(r))}_onPlotClick(e){let r=e.target.closest("[data-treemap-into]");if(!r)return;let n=this._dirByPath.get(r.dataset.treemapInto);n&&this._drillInto(n)}_renderCrumbs(){let e=this._focus,r=e.length===0,n=e.slice(0,-1),o=r?null:e.at(-1);return d`<nav class="bundle-treemap-crumbs" aria-label="Treemap location"><span class="bundle-treemap-crumbs-lead"><button type="button" class="${I({"bundle-treemap-crumb-home":!0,"at-root":r})}" @click="${()=>this._focusTo(-1)}">Source ${this._mode==="sunburst"?"sunburst":"treemap"}</button> ${n.map((i,s)=>d`<span class="bundle-treemap-crumb-sep" aria-hidden="true">›</span><button type="button" class="bundle-treemap-crumb" @click="${()=>this._focusTo(s)}" data-tooltip="${i.path}">${i.name}</button>`)} </span>${o?d`<span class="bundle-treemap-crumb-sep" aria-hidden="true">›</span><span class="bundle-treemap-crumb-current" aria-current="location" title="${o.path}">${o.name}</span>`:""}</nav>`}_cell(e){let r=Sk(e.node.value,this._meta.total),n={left:`${e.x}px`,top:`${e.y}px`,width:`${e.w}px`,height:`${e.h}px`},o=`${e.node.count} ${e.node.count===1?"file":"files"}`;if(e.kind==="dir")return d`<div class="bundle-treemap-node bundle-treemap-dir" style="${ve(n)}" data-treemap-into="${e.node.path}" data-tt-path="${`${e.node.path}/`}" data-tt-meta="${`${_e(e.node.value)} \xB7 ${o} \xB7 ${r}%`}"><span class="bundle-treemap-dirname">${e.node.name}</span></div>`;let i=e.node.pkg??st(e.node.path),s=Lt(i),a=ve({...n,background:s,color:AP(s)}),c=To(i);return e.kind==="agg"?d`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-agg" style="${a}" data-treemap-into="${e.node.path}" data-tt-path="${`${e.node.path}/`}" data-tt-pkg="${c}" data-tt-color="${s}" data-tt-meta="${`${_e(e.node.value)} \xB7 ${o} \xB7 ${r}%`}"><span class="bundle-treemap-label">${e.node.name}/</span></div>`:d`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-file" style="${a}" data-bundle-view-source="${e.node.resource?m:e.node.origPath}" data-tt-path="${e.node.path}" data-tt-pkg="${c}" data-tt-color="${s}" data-tt-meta="${`${_e(e.node.value)} \xB7 ${r}% of bundle`}"><span class="bundle-treemap-label">${e.node.name}</span></div>`}_arc(e,r,n){let o=Sk(e.value,n),i=e.pkg??st(e.path),s=Lt(i),a=To(i);if(e.isFile)return Wn`<path class="bundle-treemap-node bundle-treemap-arc" d="${r}" fill="${s}" data-bundle-view-source="${e.resource?m:e.origPath}" data-tt-path="${e.path}" data-tt-pkg="${a}" data-tt-color="${s}" data-tt-meta="${`${_e(e.value)} \xB7 ${o}% of bundle`}"></path>`;let c=`${e.count} ${e.count===1?"file":"files"}`;return Wn`<path class="bundle-treemap-node bundle-treemap-arc" d="${r}" fill="${s}" data-treemap-into="${e.path}" data-tt-path="${`${e.path}/`}" data-tt-pkg="${e.pkg?a:m}" data-tt-color="${e.pkg?s:m}" data-tt-meta="${`${_e(e.value)} \xB7 ${c} \xB7 ${o}%`}"></path>`}_renderSunburst(e){let r=this._w,n=this._h,o=r/2,i=n/2,s=Math.min(r,n)/2-6;if(s<30)return m;let a=y5(e,f5),c=Math.min(Math.max(s*.18,26),s*.45),u=(s-c)/a,p=this._meta.total||1,f=[],h=(x,k,$,C)=>{let U=[...x.children.values()].toSorted((N,K)=>K.value-N.value),E=$-k,B=k;for(let N of U){let K=E*(N.value/x.value),W=c+(C-1)*u,he=W+u;K*he>=RP&&(f.push(this._arc(N,MP(o,i,W,he,B,B+K),p)),!N.isFile&&C<a&&N.children.size>0&&h(N,B,B+K,C+1)),B+=K}};h(e,-Math.PI/2,Math.PI*1.5,1);let g=this._focus.length>0,y=Math.max(c-4,10),b=g?Wn`<circle class="bundle-treemap-node bundle-treemap-center" cx="${o}" cy="${i}" r="${y}" data-treemap-into="${e.parent.path}" data-tt-path="${`${e.path}/`}" data-tt-meta="${`${_e(e.value)} \xB7 ${e.count} ${e.count===1?"file":"files"} \xB7 ${Sk(e.value,p)}%`}"></circle>`:Wn`<circle class="bundle-treemap-center" cx="${o}" cy="${i}" r="${y}"></circle>`,v=Wn`<text class="bundle-treemap-center-label" x="${o}" y="${i}" text-anchor="middle">${g?Wn`<tspan x="${o}" dy="-0.3em">${IP(e.name,y*2-12)}</tspan><tspan class="bundle-treemap-center-sub" x="${o}" dy="1.5em">${_e(e.value)}</tspan>`:Wn`<tspan x="${o}" dy="0.35em">${_e(e.value)}</tspan>`}</text>`;return d`<svg class="bundle-treemap-sunburst" width="${r}" height="${n}" viewBox="${`0 0 ${r} ${n}`}">${f}${b}${v}</svg>`}render(){let e=this._focusNode,r=this._mode==="sunburst",n=this._status==="ok"&&e&&e.children&&this._w>0&&this._h>0,o=[];if(n&&!r){let c=[...e.children.values()].toSorted((u,p)=>p.value-u.value);for(let u of h5(c,{x:0,y:0,w:this._w,h:this._h}))b5(u.node,u.x,u.y,u.w,u.h,1,o)}let{prefix:i}=this._meta,s=e?e.count:0,a=e?e.value:0;return d`<header class="bundle-treemap-head">${this._renderCrumbs()} <span class="bundle-treemap-head-right"><span class="bundle-treemap-sub">${s} ${s===1?"file":"files"} · ${_e(a)}${i?d`· <span class="mono">${i}</span>`:""}</span> ${this._reasons.size>0?d`<select class="bundle-treemap-reason" aria-label="Filter files" @change="${this._changeReason}"><option value="" ?selected="${!this._reason}">All</option>${[...this._reasons.keys()].map(c=>d`<option value="${c}" ?selected="${this._reason===c}">${c}</option>`)}</select>`:m}<mode-switch compact="compact" label="Sunburst" .checked="${r}" accessible-label="Toggle sunburst view" @click="${this._toggleMode}"></mode-switch></span></header><div class="bundle-treemap-plot" @click="${this._onPlotClick}" @pointermove="${this._onPointerMove}" @pointerleave="${this._onPointerLeave}">${this._status==="loading"?d`<div class="bundle-treemap-empty">Loading…</div>`:this._status==="empty"?d`<div class="bundle-treemap-empty">This bundle doesn't carry any source content.</div>`:r?n?this._renderSunburst(e):m:o.map(c=>this._cell(c))}<div class="bundle-treemap-tooltip"></div></div>`}};customElements.define("bundle-treemap",Ck);M();Jt();vt();fn();O();ue();Bi();Gs();tn();Fn();tn();function If(t){return qb(t)??0}function LP(t,e){return t===e||t?.format==="base64"&&e?.format==="base64"&&t.data===e.data}function v5(t){return(e,r)=>Math.abs(r.delta)-Math.abs(e.delta)||e[t].localeCompare(r[t])}function Lf(t){return(e,r)=>r.bytes-e.bytes||e[t].localeCompare(r[t])}function FP(){return{baseBytes:0,otherBytes:0,onlyBaseFiles:0,onlyOtherFiles:0,changedFiles:0}}function k5(t,e,r){let n=[],o=[],i=[],s=0,a=0,c=0,u=0,p=0,f=0,h=new Map,g=k=>{let $=r(k),C=h.get($);return C||(C=FP(),h.set($,C)),C},y=new Set([...t.keys(),...e.keys()]);for(let k of y){let $=t.has(k),C=e.has(k),U=g(k);if($&&C){let E=t.get(k),B=e.get(k),N=LP(E,B),K=If(E),W=N?K:If(B);if(s+=K,a+=W,U.baseBytes+=K,U.otherBytes+=W,N)f++;else{let he=W-K;i.push({path:k,baseBytes:K,otherBytes:W,delta:he}),p+=he,U.changedFiles++}}else if($){let E=If(t.get(k));s+=E,c+=E,U.baseBytes+=E,U.onlyBaseFiles++,n.push({path:k,bytes:E})}else{let E=If(e.get(k));a+=E,u+=E,U.otherBytes+=E,U.onlyOtherFiles++,o.push({path:k,bytes:E})}}let b=[],v=[],x=[];for(let[k,$]of h){let C=$.baseBytes>0||$.onlyBaseFiles>0||$.changedFiles>0,U=$.otherBytes>0||$.onlyOtherFiles>0||$.changedFiles>0,E=$.onlyBaseFiles+$.onlyOtherFiles+$.changedFiles;C&&!U?b.push({pkg:k,bytes:$.baseBytes}):U&&!C?v.push({pkg:k,bytes:$.otherBytes}):(E>0||$.baseBytes!==$.otherBytes)&&x.push({pkg:k,baseBytes:$.baseBytes,otherBytes:$.otherBytes,delta:$.otherBytes-$.baseBytes})}return n.sort(Lf("path")),o.sort(Lf("path")),i.sort(v5("path")),b.sort(Lf("pkg")),v.sort(Lf("pkg")),x.sort(v5("pkg")),{totals:{baseFiles:t.size,baseBytes:s,otherFiles:e.size,otherBytes:a,onlyBaseFiles:n.length,onlyBaseBytes:c,onlyOtherFiles:o.length,onlyOtherBytes:u,changedFiles:i.length,changedDelta:p,unchangedFiles:f,fileDelta:e.size-t.size,byteDelta:a-s,identical:n.length===0&&o.length===0&&i.length===0},files:{onlyBase:n,onlyOther:o,changed:i},packages:{onlyBase:b,onlyOther:v,changed:x}}}function w5(t){let r=String(t).trim().split("+",1)[0],n=r.indexOf("-");return n===-1?{core:r,pre:""}:{core:r.slice(0,n),pre:r.slice(n+1)}}function Wc(t,e){if(t===e)return 0;let r=w5(t),n=w5(e),o=r.core.split("."),i=n.core.split(".");for(let c=0;c<Math.max(o.length,i.length);c++){let u=Number(o[c]??0),p=Number(i[c]??0);if(Number.isNaN(u)||Number.isNaN(p))return t<e?-1:1;if(u!==p)return u<p?-1:1}if(r.pre===n.pre)return 0;if(!r.pre)return 1;if(!n.pre)return-1;let s=r.pre.split("."),a=n.pre.split(".");for(let c=0;c<Math.max(s.length,a.length);c++){let u=s[c],p=a[c];if(u===void 0)return-1;if(p===void 0)return 1;if(u===p)continue;let f=/^\d+$/u.test(u),h=/^\d+$/u.test(p);return f&&h?Number(u)<Number(p)?-1:1:f!==h?f?-1:1:u<p?-1:1}return 0}function BP(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function OP(t,e){let r=Wc(e.at(-1),t.at(-1));return r>0?"up":r<0?"down":"changed"}function x5(t,e){let r=[],n=[],o=[],i=new Set([...t.keys(),...e.keys()]);for(let a of i){let c=t.get(a),u=e.get(a);if(c&&u){let p=[...c].toSorted(Wc),f=[...u].toSorted(Wc);if(BP(p,f))continue;r.push({pkg:a,baseVersions:p,otherVersions:f,direction:OP(p,f)})}else c?o.push({pkg:a,versions:[...c].toSorted(Wc)}):n.push({pkg:a,versions:[...u].toSorted(Wc)})}let s=(a,c)=>a.pkg.localeCompare(c.pkg);return r.sort(s),n.sort(s),o.sort(s),{updated:r,added:n,removed:o,totals:{baseDeps:t.size,otherDeps:e.size}}}var $5=400,Kc=null;function Rk(t){return t===0?"\xB10":`${t>0?"+":"\u2212"}${Math.abs(t).toLocaleString()}`}function _5(t){return`${Rk(t)} B`}function Ff(t){return t>0?"up":t<0?"down":""}function PP(t,e){if(!e)return"";let r=t/e*100;return`${r>0?"+":r<0?"\u2212":"\xB1"}${Math.abs(r).toFixed(1)}%`}function Ek(t){return t.join(", ")}var Ak=class extends J{static properties={details:{attribute:!1},integrity:{attribute:!1},_targetIntegrity:{state:!0},_otherDetails:{state:!0},_status:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this.integrity=null,this._targetIntegrity=null,this._otherDetails=null,this._status="idle",this._diff=null,this._diffKey=null}willUpdate(e){if(e.has("integrity")){if(Kc&&this.integrity===Kc.base){let r=Kc.target;Kc=null,this._targetIntegrity=r,this._otherDetails=null,this._status="loading",this._diff=null,this._diffKey=null,this._loadOther(r);return}this._targetIntegrity=null,this._otherDetails=null,this._status="idle",this._diff=null,this._diffKey=null}}_swap(){let e=this._targetIntegrity;!e||e===this.integrity||(l.bundles??[]).some(r=>r.integrity===e)&&(Kc={base:e,target:this.integrity},this.dispatchEvent(new CustomEvent("bundle-swap",{bubbles:!0,composed:!0,detail:{integrity:e}})))}_nameFor(e){return(l.bundles??[]).find(n=>n.integrity===e)?.name??`${e.slice(0,15)}\u2026`}_onPick(e){let r=e.target.value||null;if(this._targetIntegrity=r,this._otherDetails=null,this._diff=null,this._diffKey=null,!r){this._status="idle";return}this._status="loading",this._loadOther(r)}async _loadOther(e){let r=(l.bundles??[]).find(o=>o.integrity===e);if(!r){this._status="idle",this._targetIntegrity=null;return}let n=await In(e,r);this._targetIntegrity===e&&(this._otherDetails=n,this._status="ready")}get _baseReady(){return!!(this.details&&this.details.integrity===this.integrity&&(this.details.json||this.details.bundle))}_fileRow(e,r,n,o){let i=d`<span class="bundle-compare-row-path mono">${r}</span>${o}`;return n&&Hs(this.details).get(e)!=="resource"?d`<li><button type="button" class="bundle-compare-row bundle-compare-row-link" data-bundle-view-source="${e}" data-tooltip="${e}">${i}</button></li>`:d`<li><div class="bundle-compare-row" title="${e}">${i}</div></li>`}_group(e,r,n,o,i){if(r.length===0)return m;let s=r.slice(0,$5),a=r.length-s.length;return d`<section class="${`bundle-compare-group bundle-compare-${n}`}"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title">${e}</span> <span class="bundle-compare-group-count">${r.length}</span></header><ul class="bundle-compare-rows">${te(s,o,i)}</ul>${a>0?d`<div class="bundle-compare-more">and ${a.toLocaleString()} more…</div>`:m}</section>`}_sizeCells(e){return e.delta===void 0?d`<span class="bundle-compare-row-size">${_e(e.bytes)}</span>`:d`<span class="bundle-compare-row-size">${_e(e.baseBytes)} → ${_e(e.otherBytes)}</span> <span class="${`bundle-compare-row-delta ${Ff(e.delta)}`}">${_5(e.delta)}</span>`}_fileGroup(e,r,n,o,i){return this._group(e,r,n,s=>s.path,s=>this._fileRow(s.path,i(s.path),o,this._sizeCells(s)))}_pkgGroup(e,r,n){return this._group(e,r,n,o=>o.pkg,o=>d`<li><div class="bundle-compare-row" title="${To(o.pkg)}"><span class="bundle-compare-pkg-dot" style="${ve({background:Lt(o.pkg)})}"></span> <span class="bundle-compare-row-path">${To(o.pkg)}</span> ${this._sizeCells(o)}</div></li>`)}_versionRow(e){let r=e.direction==="up"?"\u2191":e.direction==="down"?"\u2193":"\xB1",n=e.direction==="up"?"Upgraded":e.direction==="down"?"Downgraded":"Changed";return d`<li><div class="bundle-compare-row" title="${`${e.pkg} \xB7 ${n}`}"><span class="bundle-compare-pkg-dot" style="${ve({background:Lt(e.pkg)})}"></span> <span class="bundle-compare-row-path">${e.pkg}</span> <span class="bundle-compare-ver"><span class="bundle-compare-ver-from">${Ek(e.baseVersions)}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="${`bundle-compare-ver-to ${e.direction}`}">${Ek(e.otherVersions)}</span> <span class="${`bundle-compare-ver-dir ${e.direction}`}" aria-hidden="true">${r}</span></span></div></li>`}_depGroup(e,r,n){return this._group(e,r,n,o=>o.pkg,o=>d`<li><div class="bundle-compare-row" title="${o.pkg}"><span class="bundle-compare-pkg-dot" style="${ve({background:Lt(o.pkg)})}"></span> <span class="bundle-compare-row-path">${o.pkg}</span> <span class="bundle-compare-dep-ver">${Ek(o.versions)}</span></div></li>`)}_renderVersionUpdates(e,r,n){let{updated:o,added:i,removed:s}=e;if(o.length===0&&i.length===0&&s.length===0)return m;let a=o.slice(0,$5),c=o.length-a.length;return d`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Dependency updates</h3>${o.length>0?d`<div class="bundle-compare-ver-changes"><header class="bundle-compare-group-head"><span class="bundle-compare-group-title">Updated</span> <span class="bundle-compare-group-count">${o.length}</span></header><ul class="bundle-compare-rows">${te(a,u=>u.pkg,u=>this._versionRow(u))}</ul>${c>0?d`<div class="bundle-compare-more">and ${c.toLocaleString()} more…</div>`:m}</div>`:m} ${i.length>0||s.length>0?d`<div class="bundle-compare-cols">${this._depGroup(`Removed \xB7 only in ${r}`,s,"removed")} ${this._depGroup(`Added \xB7 only in ${n}`,i,"added")}</div>`:m}</section>`}_diffFor(){let e=`${this.integrity}|${this._targetIntegrity}`;if(this._diffKey!==e||!this._diff){let r=Mi(this.details),n=Mi(this._otherDetails),{prefix:o}=Kt([...r.keys(),...n.keys()]),i=en(this.details),s=en(this._otherDetails),a=i||s?new Map([...i??[],...s??[]]):null,c=u=>st(o&&u.startsWith(o)?u.slice(o.length):u,{packageDir:a?.get(u)});this._diff=k5(r,n,c),this._diff.versionUpdates=x5(tc(this.details),tc(this._otherDetails)),this._diffKey=e}return this._diff}_renderSummary(e){let r=e.totals,n=e.versionUpdates.totals,o=n.baseDeps>0||n.otherDeps>0,i=n.otherDeps-n.baseDeps,s=PP(r.byteDelta,r.baseBytes);return d`<div class="bundle-compare-summary"><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Files</span> <span class="bundle-compare-metric-value">${r.baseFiles.toLocaleString()} → ${r.otherFiles.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${Ff(r.fileDelta)}`}">${Rk(r.fileDelta)}</span></div><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Size</span> <span class="bundle-compare-metric-value">${_e(r.baseBytes)} → ${_e(r.otherBytes)}</span> <span class="${`bundle-compare-metric-delta ${Ff(r.byteDelta)}`}">${_5(r.byteDelta)}${s?d`${" "}<span class="bundle-compare-pct">(${s})</span>`:m}</span></div>${o?d`<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Deps</span> <span class="bundle-compare-metric-value">${n.baseDeps.toLocaleString()} → ${n.otherDeps.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${Ff(i)}`}">${Rk(i)}</span></div>`:m}<div class="bundle-compare-chips"><span class="bundle-compare-chip removed">−${r.onlyBaseFiles.toLocaleString()} removed</span> <span class="bundle-compare-chip added">+${r.onlyOtherFiles.toLocaleString()} added</span> <span class="bundle-compare-chip changed">${r.changedFiles.toLocaleString()} changed</span> <span class="bundle-compare-chip unchanged">${r.unchangedFiles.toLocaleString()} unchanged</span></div></div>`}_renderPicker(e,r){let n=this._nameFor(this.integrity);return d`<div class="bundle-compare-picker"><span class="bundle-compare-base" title="${n}">${n}</span> <span class="bundle-compare-arrow" aria-hidden="true">→</span> <label class="bundle-compare-select-wrap"><span class="bundle-compare-select-hint">Compare with</span> <select class="bundle-compare-select" .value="${xe(this._targetIntegrity??"")}" @change="${o=>this._onPick(o)}" aria-label="Bundle to compare with"><option value="">Choose a bundle…</option>${e.map(o=>d`<option value="${o.integrity}">${o.label}</option>`)}</select></label> ${r?d`<button type="button" class="bundle-compare-swap" @click="${()=>this._swap()}" aria-label="Swap the two bundles"><span class="bundle-compare-swap-icon" aria-hidden="true">↔</span>Swap</button>`:m}</div>`}_otherOptions(){let e=(l.bundles??[]).filter(n=>n.integrity!==this.integrity),r=new Map;for(let n of e)r.set(n.name,(r.get(n.name)??0)+1);return e.map(n=>({integrity:n.integrity,label:r.get(n.name)>1?`${n.name} \xB7 ${n.integrity.slice(7,13)}\u2026`:n.name}))}render(){let e=this._otherOptions(),r=!!this._targetIntegrity&&e.some(s=>s.integrity===this._targetIntegrity),n=e.length>0?this._renderPicker(e,r):m,o=r&&this._status==="ready"&&this._otherDetails&&(this._otherDetails.json||this._otherDetails.bundle)&&!this._otherDetails.error,i;return this._baseReady?e.length===0?i=d`<div class="bundle-compare-empty">No other bundles to compare with. Drop a second <code>.map</code> or <code>.stasis.code.br</code> bundle to diff against this one.</div>`:r?this._status==="loading"||!this._otherDetails?i=d`<div class="bundle-compare-empty">Comparing…</div>`:this._otherDetails.error?i=d`<div class="bundle-compare-empty is-error">Couldn't read the selected bundle: ${this._otherDetails.error}</div>`:!this._otherDetails.json&&!this._otherDetails.bundle?i=d`<div class="bundle-compare-empty is-error">The selected bundle couldn't be parsed.</div>`:i=this._renderDiff():i=d`<div class="bundle-compare-empty">Pick a bundle above to compare against <strong>${this._nameFor(this.integrity)}</strong>.</div>`:i=d`<div class="bundle-compare-empty">Loading bundle…</div>`,d`<div class="bundle-compare"><header class="bundle-compare-head">${n} ${this._baseReady&&o?this._renderSummary(this._diffFor()):m}</header><div class="bundle-compare-body">${i}</div></div>`}_renderDiff(){let e=this._diffFor(),r=this._nameFor(this._targetIntegrity),n=this._nameFor(this.integrity),o=[...e.files.onlyBase.map(p=>p.path),...e.files.onlyOther.map(p=>p.path),...e.files.changed.map(p=>p.path)],{prefix:i,stripped:s}=Kt(o),a=new Map;for(let p=0;p<o.length;p++)a.set(o[p],s[p]);let c=p=>a.get(p)??p,u=e.packages.onlyOther.length>0||e.packages.onlyBase.length>0||e.packages.changed.length>0;return d`<div class="bundle-compare-caption">Changes from <strong>${n}</strong> to <strong>${r}</strong> ${i?d`· <span class="mono">${i}</span>`:m}</div>${this._renderVersionUpdates(e.versionUpdates,n,r)} ${e.totals.identical?d`<div class="bundle-compare-identical">These two bundles carry identical files (${e.totals.unchangedFiles.toLocaleString()} ${e.totals.unchangedFiles===1?"file":"files"}).</div>`:d`${u?d`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Packages</h3><div class="bundle-compare-cols">${this._pkgGroup(`Removed \xB7 only in ${n}`,e.packages.onlyBase,"removed")} ${this._pkgGroup(`Added \xB7 only in ${r}`,e.packages.onlyOther,"added")} ${this._pkgGroup("Changed size",e.packages.changed,"changed")}</div></section>`:m}<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Files</h3><div class="bundle-compare-cols bundle-compare-cols--files">${this._fileGroup(`Removed \xB7 only in ${n}`,e.files.onlyBase,"removed",!0,c)} ${this._fileGroup(`Added \xB7 only in ${r}`,e.files.onlyOther,"added",!1,c)} ${this._fileGroup("Changed",e.files.changed,"changed",!0,c)}</div></section>`}`}};customElements.define("bundle-compare",Ak);M();$e();O();var Tk=class extends V{createRenderRoot(){return this}render(){return l.reports.length>0&&l.currentView==="findings"&&l.viewMode!=="graph"&&l.viewMode!=="kanban"?d`<button type="button" class="toolbar-export-btn" aria-label="Download or print report" @click="${this._onClick}">${oA}</button>`:m}_onClick=()=>{this.dispatchEvent(new CustomEvent("download-requested",{bubbles:!0,composed:!0}))}};customElements.define("download-button",Tk);O();Er();St();Pn();ot();function Gc(t){let e=new Map;for(let[r,n]of l.triage)n[t]&&e.set(r,n[t]);return e}var NP={get markers(){return Gc("color")},get triageState(){return Gc("triage")},get comments(){return Gc("comment")},get fixes(){return Gc("fix")},get flags(){return Gc("flagged")},get(t){let e=l.triage.get(t),r={};return e?.color&&(r.color=e.color),e?.triage&&(r.triage=e.triage),e?.comment&&(r.comment=e.comment),e?.fix&&(r.fix=e.fix),e?.flagged!==void 0&&(r.flagged=e.flagged),r},async set(t,{color:e,triage:r,comment:n,fix:o,flagged:i}={}){let s=!1;if(e!==void 0&&(e===null||e===""?G(l.triage,t,{color:void 0})&&(s=!0):l.triage.get(t)?.color!==e&&(G(l.triage,t,{color:e}),s=!0)),r!==void 0)if(r===null||r===""||r===!1)G(l.triage,t,{triage:void 0})&&(s=!0);else if(r==="inprogress"||r==="fixed"||r==="invalid"||r==="deleted")l.triage.get(t)?.triage!==r&&(G(l.triage,t,{triage:r}),s=!0);else throw new TypeError(`DeepView.triage.set: unknown triage value ${JSON.stringify(r)} (expected 'inprogress' | 'fixed' | 'invalid' | 'deleted' | null)`);if(n!==void 0){let a=n?String(n):"";a?l.triage.get(t)?.comment!==a&&(G(l.triage,t,{comment:a}),s=!0):G(l.triage,t,{comment:void 0})&&(s=!0)}if(o!==void 0){let a=o?String(o):"";a?l.triage.get(t)?.fix!==a&&(G(l.triage,t,{fix:a}),s=!0):G(l.triage,t,{fix:void 0})&&(s=!0)}if(i!==void 0){let a=i===null||i===""?void 0:!!i;l.triage.get(t)?.flagged!==a&&(G(l.triage,t,{flagged:a}),s=!0)}return s&&(await we(),_()),s}};window.DeepView={get reports(){return l.reports.slice()},get groups(){return qt()},get findings(){return qt().flat()},get currentFile(){return l.currentFile},get currentWorkspace(){return l.currentWorkspace},triage:NP,forceManagedMode:UR,themes:GA,setTheme:WA,get theme(){return KA()},triageSync:H,refresh(){_()},export(){return r5()}};Ub();Rr();Wt();var DP={default:be.default,"claude-security":be["claude-security"],"codex-security":be["codex-security"],deepsec:be.deepsec,piolium:be.piolium,bundle:Gr,workspace:fo,links:As};for(let t of document.querySelectorAll(".drop-supported-icon[data-icon]")){let e=DP[t.dataset.icon];e&&(t.innerHTML=e)}Uv();w1(_);fg(_);v1(_);H.onStatusChange(_);b1(async(t,e)=>{l.currentWorkspace===t?await gr(t):l.currentFile&&l.currentFile===e?await Bt(e):await ee()});y1(async()=>{await ee(),l.currentView==="bundles"&&_()});XR();ZR();async function E5(){let t=Hg();if(!t)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let e;try{e=await eA({encoded:t})}catch(n){return alert(`Couldn't open the share-link unlock prompt: ${n.message}`),!1}if(!e)return!1;let r=await qm({id:e.id,name:e.name,privateKey:e.privateKeyBase64});if(r.status==="already-attached")return alert(`This workspace is already attached as "${r.workspace.name}".`),!1;if(r.status==="name-collision"){let n=r.existing?.name;return alert(n?`A workspace named "${n}" already exists. Open the share link again and pick a different name.`:"The shared workspace name is empty or invalid. Ask the sender to re-share with a real name."),!1}return r.workspace?.id?await gr(r.workspace.id):await ee(),!0}async function R5(){let t=pu();if(!t)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let e=await qR(t);return e.ok?!0:(alert(e.reason),!1)}var ca=!1;async function A5(){if(await at(),!ca&&!(!D()&&de()&&!tr())){ca=!0;try{await zP()}finally{Ue.hidden=!1}}}async function zP(){let t=Xs(),e=()=>t===Xs()&&!D();if(D()){await ee();return}if(await Br(),!e()||(yl(),await ee(),!e())||await E5()||!e()||await R5()||!e())return;let o=He(Bo);if(o)if(o.startsWith("ws:")){let i=o.slice(3);re().some(s=>s.id===i)&&await gr(i)}else if(o.startsWith("b:")){let i=o.slice(2),s=i.indexOf(" "),a=s>=0?i.slice(0,s):i,c=s>=0?i.slice(s+1):"",u=kc.has(c)?c:"overview";(l.bundles??[]).some(p=>p.integrity===a)&&(Ro(a,u),_(),Ln(a))}else{let i=await pe();if(!e())return;let s=$u(o);s&&i.includes(s.name)&&await Bt(s.name,void 0,{workspaceId:s.workspaceId})}}var Bf=!1,S5=!1;document.addEventListener("managed-client-mode-change",()=>{Bf=!D()&&de()});function C5(t){S5||(S5=!0,queueMicrotask(()=>{alert(t+" This tab will reload to refresh its state. Any unsaved edits in this tab will be lost."),location.reload()}))}tt(async()=>{if(await at(),D()){_();return}let t=Bf,e=de();if(Bf=e,_(),!ca&&tr()){A5().catch(r=>console.warn("continueBoot:",r));return}if(ca&&e&&!tr()){C5("Encryption was just enabled in another tab.");return}ca&&t&&!e&&!fh()&&C5("Encryption was disabled in another tab.")});window.addEventListener("hashchange",()=>{ca&&(async()=>{await E5()||await R5()})().catch(t=>console.warn("deep-link hashchange:",t))});(async()=>{if(!await QR()){await at(),Bf=!D()&&de();try{let t=window.matchMedia?.("(display-mode: window-controls-overlay)").matches;if(!t&&!D()&&localStorage.getItem("deepview.sidebarCollapsed")==="1"&&$0.classList.add("collapsed"),window.matchMedia?.("(display-mode: standalone)").matches||t){let r=document.querySelector('meta[name="viewport"]');r&&r.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"),window.addEventListener("wheel",n=>{(n.ctrlKey||n.metaKey)&&n.preventDefault()},{passive:!1}),window.addEventListener("keydown",n=>{(n.ctrlKey||n.metaKey)&&(n.key==="="||n.key==="+"||n.key==="-"||n.key==="0")&&n.preventDefault()})}}catch{}!D()&&de()&&!tr()||await A5()}})();
151
189
  /*! Bundled license information:
152
190
 
153
191
  @lit/reactive-element/css-tag.js: