@preventive/triage 1.0.0-alpha.15 → 1.0.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/scan-server.ts +13 -0
- package/common/server-info.ts +1 -0
- package/common/utf8.d.ts +3 -0
- package/common/utf8.js +45 -0
- package/out/client-managed.js +83 -1
- package/out/client-sync.js +14 -14
- package/out/graph.js +11 -11
- package/out/index.html +3 -2
- package/out/provider-icons/claude.svg +1 -0
- package/out/provider-icons/deepseek.svg +1 -0
- package/out/provider-icons/google.svg +1 -0
- package/out/provider-icons/grok.svg +1 -0
- package/out/provider-icons/moonshot.svg +1 -0
- package/out/provider-icons/nvidia.svg +1 -0
- package/out/provider-icons/openai.svg +1 -0
- package/out/provider-icons/openrouter.svg +1 -0
- package/out/provider-icons/qwen.svg +1 -0
- package/out/provider-icons/zai.svg +1 -0
- package/out/terminal.js +230 -212
- package/out/view.css +1 -1
- package/out/view.js +138 -135
- package/package.json +6 -3
- package/report/index.js +1 -1
- package/report/src/md-structure.js +1 -1
- package/report/src/meta.js +25 -0
- package/report/src/parse-md.js +71 -2
- package/server-common/scan-config.ts +19 -0
- package/server-e2e/config.ts +6 -0
- package/server-e2e/http.ts +1 -1
- package/server-e2e/index.ts +1 -2
- package/server-e2e/static.ts +19 -11
- package/out/client-admin.js +0 -28
package/out/view.js
CHANGED
|
@@ -1,141 +1,144 @@
|
|
|
1
|
-
var
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),jb=/'/g,Wb=/"/g,Gb=/^(?:script|style|textarea|title)$/i,vu=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),d=vu(1),Vr=vu(2),Y6=vu(3),Ie=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Vb=new WeakMap,Nn=Pn.createTreeWalker(Pn,129);function qb(e,t){if(!yu(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return zb!==void 0?zb.createHTML(t):t}var Yb=(e,t)=>{let r=e.length-1,n=[],o,i=t===2?"<svg>":t===3?"<math>":"",s=Xi;for(let a=0;a<r;a++){let c=e[a],u,p,f=-1,h=0;for(;h<c.length&&(s.lastIndex=h,p=s.exec(c),p!==null);)h=s.lastIndex,s===Xi?p[1]==="!--"?s=Ub:p[1]!==void 0?s=Hb:p[2]!==void 0?(Gb.test(p[2])&&(o=RegExp("</"+p[2],"g")),s=Dn):p[3]!==void 0&&(s=Dn):s===Dn?p[0]===">"?(s=o??Xi,f=-1):p[1]===void 0?f=-2:(f=s.lastIndex-p[2].length,u=p[1],s=p[3]===void 0?Dn:p[3]==='"'?Wb:jb):s===Wb||s===jb?s=Dn:s===Ub||s===Hb?s=Xi:(s=Dn,o=void 0);let g=s===Dn&&e[a+1].startsWith("/>")?" ":"";i+=s===Xi?c+g_:f>=0?(n.push(u),c.slice(0,f)+gu+c.slice(f)+$r+g):c+$r+(f===-2?a:g)}return[qb(e,i+(e[r]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},Qi=class e{constructor({strings:t,_$litType$:r},n){let o;this.parts=[];let i=0,s=0,a=t.length-1,c=this.parts,[u,p]=Yb(t,r);if(this.el=e.createElement(u,n),Nn.currentNode=this.el.content,r===2||r===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(o=Nn.nextNode())!==null&&c.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let f of o.getAttributeNames())if(f.endsWith(gu)){let h=p[s++],g=o.getAttribute(f).split($r),b=/([.?@])?(.*)/.exec(h);c.push({type:1,index:i,name:b[2],strings:g,ctor:b[1]==="."?ul:b[1]==="?"?pl:b[1]==="@"?fl:Un}),o.removeAttribute(f)}else f.startsWith($r)&&(c.push({type:6,index:i}),o.removeAttribute(f));if(Gb.test(o.tagName)){let f=o.textContent.split($r),h=f.length-1;if(h>0){o.textContent=cl?cl.emptyScript:"";for(let g=0;g<h;g++)o.append(f[g],Ji()),Nn.nextNode(),c.push({type:2,index:++i});o.append(f[h],Ji())}}}else if(o.nodeType===8)if(o.data===bu)c.push({type:2,index:i});else{let f=-1;for(;(f=o.data.indexOf($r,f+1))!==-1;)c.push({type:7,index:i}),f+=$r.length-1}i++}}static createElement(t,r){let n=Pn.createElement("template");return n.innerHTML=t,n}};function zn(e,t,r=e,n){if(t===Ie)return t;let o=n!==void 0?r._$Co?.[n]:r._$Cl,i=Zi(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=zn(e,o._$AS(e,t.values),o,n)),t}var dl=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??Pn).importNode(r,!0);Nn.currentNode=o;let i=Nn.nextNode(),s=0,a=0,c=n[0];for(;c!==void 0;){if(s===c.index){let u;c.type===2?u=new Oo(i,i.nextSibling,this,t):c.type===1?u=new c.ctor(i,c.name,c.strings,this,t):c.type===6&&(u=new hl(i,this,t)),this._$AV.push(u),c=n[++a]}s!==c?.index&&(i=Nn.nextNode(),s++)}return Nn.currentNode=Pn,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++}},Oo=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,r,n,o){this.type=2,this._$AH=m,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=zn(this,t,r),Zi(t)?t===m||t==null||t===""?(this._$AH!==m&&this._$AR(),this._$AH=m):t!==this._$AH&&t!==Ie&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Kb(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!==m&&Zi(this._$AH)?this._$AA.nextSibling.data=t:this.T(Pn.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=Qi.createElement(qb(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(r);else{let i=new dl(o,this),s=i.u(this.options);i.p(r),this.T(s),this._$AH=i}}_$AC(t){let r=Vb.get(t.strings);return r===void 0&&Vb.set(t.strings,r=new Qi(t)),r}k(t){yu(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(Ji()),this.O(Ji()),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=Pb(t).nextSibling;Pb(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Un=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,r,n,o,i){this.type=1,this._$AH=m,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=m}_$AI(t,r=this,n,o){let i=this.strings,s=!1;if(i===void 0)t=zn(this,t,r,0),s=!Zi(t)||t!==this._$AH&&t!==Ie,s&&(this._$AH=t);else{let a=t,c,u;for(t=i[0],c=0;c<i.length-1;c++)u=zn(this,a[n+c],r,c),u===Ie&&(u=this._$AH[c]),s||=!Zi(u)||u!==this._$AH[c],u===m?t=m:t!==m&&(t+=(u??"")+i[c+1]),this._$AH[c]=u}s&&!o&&this.j(t)}j(t){t===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ul=class extends Un{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===m?void 0:t}},pl=class extends Un{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==m)}},fl=class extends Un{constructor(t,r,n,o,i){super(t,r,n,o,i),this.type=5}_$AI(t,r=this){if((t=zn(this,t,r,0)??m)===Ie)return;let n=this._$AH,o=t===m&&n!==m||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==m&&(n===m||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)}},hl=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){zn(this,t)}},Xb={M:gu,P:$r,A:bu,C:1,L:Yb,R:dl,D:Kb,V:zn,I:Oo,H:Un,N:pl,U:fl,B:ul,F:hl},b_=mu.litHtmlPolyfillSupport;b_?.(Qi,Oo),(mu.litHtmlVersions??=[]).push("3.3.3");var Q=(e,t,r)=>{let n=r?.renderBefore??t,o=n._$litPart$;if(o===void 0){let i=r?.renderBefore??null;n._$litPart$=o=new Oo(t.insertBefore(Ji(),i),i,void 0,r??{})}return o._$AI(e),o};var wu=globalThis,oe=class extends xr{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=Q(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ie}};oe._$litElement$=!0,oe.finalized=!0,wu.litElementHydrateSupport?.({LitElement:oe});var y_=wu.litElementPolyfillSupport;y_?.({LitElement:oe});(wu.litElementVersions??=[]).push("4.2.2");var ot={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},tr=e=>(...t)=>({_$litDirective$:e,values:t}),Tt=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 E=tr(class extends Tt{constructor(e){if(super(e),e.type!==ot.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 Ie}});var{I:v_}=Xb,Jb=e=>e;var Qb=e=>e.strings===void 0,Zb=()=>document.createComment(""),Do=(e,t,r)=>{let n=e._$AA.parentNode,o=t===void 0?e._$AB:t._$AA;if(r===void 0){let i=n.insertBefore(Zb(),o),s=n.insertBefore(Zb(),o);r=new v_(i,s,e,e.options)}else{let i=r._$AB.nextSibling,s=r._$AM,a=s!==e;if(a){let c;r._$AQ?.(e),r._$AM=e,r._$AP!==void 0&&(c=e._$AU)!==s._$AU&&r._$AP(c)}if(i!==o||a){let c=r._$AA;for(;c!==i;){let u=Jb(c).nextSibling;Jb(n).insertBefore(c,o),c=u}}}return r},Kr=(e,t,r=e)=>(e._$AI(t,r),e),w_={},ml=(e,t=w_)=>e._$AH=t,ey=e=>e._$AH,gl=e=>{e._$AR(),e._$AA.remove()};var ty=(e,t,r)=>{let n=new Map;for(let o=t;o<=r;o++)n.set(e[o],o);return n},J=tr(class extends Tt{constructor(e){if(super(e),e.type!==ot.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 a of e)o[s]=n?n(a,s):s,i[s]=r(a,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=ey(e),{values:i,keys:s}=this.dt(t,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,b=i.length-1;for(;f<=h&&g<=b;)if(o[f]===null)f++;else if(o[h]===null)h--;else if(a[f]===s[g])c[g]=Kr(o[f],i[g]),f++,g++;else if(a[h]===s[b])c[b]=Kr(o[h],i[b]),h--,b--;else if(a[f]===s[b])c[b]=Kr(o[f],i[b]),Do(e,c[b+1],o[f]),f++,b--;else if(a[h]===s[g])c[g]=Kr(o[h],i[g]),Do(e,o[f],o[h]),h--,g++;else if(u===void 0&&(u=ty(s,g,b),p=ty(a,f,h)),u.has(a[f]))if(u.has(a[h])){let y=p.get(s[g]),v=y!==void 0?o[y]:null;if(v===null){let k=Do(e,o[f]);Kr(k,i[g]),c[g]=k}else c[g]=Kr(v,i[g]),Do(e,o[f],v),o[y]=null;g++}else gl(o[h]),h--;else gl(o[f]),f++;for(;g<=b;){let y=Do(e,c[b+1]);Kr(y,i[g]),c[g++]=y}for(;f<=h;){let y=o[f++];y!==null&&gl(y)}return this.ut=s,ml(e,c),Ie}});var ry="important",k_=" !"+ry,pe=tr(class extends Tt{constructor(e){if(super(e),e.type!==ot.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(k_);n.includes("-")||i?r.setProperty(n,i?o.slice(0,-11):o,i?ry:""):r[n]=o}}return Ie}});var Su=new WeakMap,sy=Symbol("iteration key");function x_(e){Su.set(e,new Map)}function $_(e,{target:t,key:r,type:n}){n==="iterate"&&(r=sy);let o=Su.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 S_({target:e,key:t,type:r}){let n=Su.get(e),o=new Set;if(r==="clear"?n.forEach((i,s)=>{ku(o,n,s)}):ku(o,n,t),r==="add"||r==="delete"||r==="clear"){let i=Array.isArray(e)?"length":sy;ku(o,n,i)}return o}function ku(e,t,r){let n=t.get(r);n&&n.forEach(e.add,e)}function ay(e){e.cleaners&&e.cleaners.forEach(__,e),e.cleaners=[]}function __(e){e.delete(this)}var No=[],xu=!1;function C_(e,t,r,n){if(e.unobserved)return Reflect.apply(t,r,n);if(No.indexOf(e)===-1){ay(e);try{return No.push(e),Reflect.apply(t,r,n)}finally{No.pop()}}}function Wt(e){let t=No[No.length-1];t&&(ly(t,e),$_(t,e))}function Gr(e){S_(e).forEach(E_,e)}function E_(e){ly(e,this),typeof e.scheduler=="function"?e.scheduler(e):typeof e.scheduler=="object"?e.scheduler.add(e):e()}function ly(e,t){if(e.debugger&&!xu)try{xu=!0,e.debugger(t)}finally{xu=!1}}function cy(){return No.length>0}var ny=Symbol("is reaction");function dy(e,t={}){let r=e[ny]?e:function n(){return C_(n,e,this,arguments)};return r.scheduler=t.scheduler,r.debugger=t.debugger,r[ny]=!0,t.lazy||r(),r}function _u(e){e.unobserved||(e.unobserved=!0,ay(e)),typeof e.scheduler=="object"&&e.scheduler.delete(e)}var Ze=new WeakMap,vl=new WeakMap,A_=Object.prototype.hasOwnProperty;function yl(e){let t=vl.get(e);return cy()&&typeof e=="object"&&e!==null?t||wl(e):t||e}function $u(e,t){let r=e.next;return e.next=()=>{let{done:n,value:o}=r.call(e);return n||(t?o[1]=yl(o[1]):o=yl(o)),{done:n,value:o}},e}var oy={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"}),yl(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||Gr({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&&Gr({target:r,key:e,value:t,oldValue:i,type:"set"}):Gr({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&&Gr({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&&Gr({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(yl(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 $u(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 $u(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 $u(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)}},bl={get(e,t,r){return e=A_.call(oy,t)?oy:e,Reflect.get(e,t,r)}},iy=typeof window=="object"?window:Function("return this")(),uy=new Map([[Map,bl],[Set,bl],[WeakMap,bl],[WeakSet,bl],[Object,!1],[Array,!1],[Int8Array,!1],[Uint8Array,!1],[Uint8ClampedArray,!1],[Int16Array,!1],[Uint16Array,!1],[Int32Array,!1],[Uint32Array,!1],[Float32Array,!1],[Float64Array,!1]]);function R_({constructor:e}){return!(typeof e=="function"&&e.name in iy&&iy[e.name]===e)||uy.has(e)}function T_(e){return uy.get(e.constructor)}var py=Object.prototype.hasOwnProperty,I_=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(e=>typeof e=="symbol"));function L_(e,t,r){let n=Reflect.get(e,t,r);if(typeof t=="symbol"&&I_.has(t))return n;Wt({target:e,key:t,receiver:r,type:"get"});let o=vl.get(n);if(cy()&&typeof n=="object"&&n!==null){if(o)return o;let i=Reflect.getOwnPropertyDescriptor(e,t);if(!i||!(i.writable===!1&&i.configurable===!1))return wl(n)}return o||n}function F_(e,t){let r=Reflect.has(e,t);return Wt({target:e,key:t,type:"has"}),r}function M_(e){return Wt({target:e,type:"iterate"}),Reflect.ownKeys(e)}function B_(e,t,r,n){typeof r=="object"&&r!==null&&(r=Ze.get(r)||r);let o=py.call(e,t),i=e[t],s=Reflect.set(e,t,r,n);return e!==Ze.get(n)||(o?r!==i&&Gr({target:e,key:t,value:r,oldValue:i,receiver:n,type:"set"}):Gr({target:e,key:t,value:r,receiver:n,type:"add"})),s}function O_(e,t){let r=py.call(e,t),n=e[t],o=Reflect.deleteProperty(e,t);return r&&Gr({target:e,key:t,oldValue:n,type:"delete"}),o}var D_={get:L_,has:F_,ownKeys:M_,set:B_,deleteProperty:O_};function wl(e={}){return Ze.has(e)||!R_(e)?e:vl.get(e)||N_(e)}function N_(e){let t=T_(e)||D_,r=new Proxy(e,t);return vl.set(e,r),Ze.set(r,e),x_(e),r}var kl=wl;function Cu(e){let t=!0,r=dy(()=>{try{e(t)}finally{t=!1}},{lazy:!0});try{r()}catch(n){throw _u(r),n}return()=>_u(r)}var P=class extends oe{_disposers=[];observes=null;connectedCallback(){super.connectedCallback(),this.bindState()}bindState(){if(this.observes){this._disposers.push(Cu(t=>{this.observes(),t||this.requestUpdate()}));return}this._render||(this._render=this.render,this.render=()=>{let t,r=Cu(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:oe,html:d,nothing:m,render:Q,unsafeCSS:C,StateElement:P,classMap:E,repeat:J,styleMap:pe};var Ne=document.querySelector("#drop-zone"),R=document.querySelector("#report"),fy=document.querySelector("app-sidebar");function Sr(e,t){let r=URL.createObjectURL(e),n=document.createElement("span");n.style.display="none",Q(d`<a href="${r}" download="${t}"></a>`,n),document.body.append(n),n.firstElementChild.click(),n.remove(),URL.revokeObjectURL(r)}function Po(e){return new Error("Another dialog is already open. Close it and try again.",{cause:e})}var P_="solidity-bundle",z_="0.0.0";function qr(e){if(e?.name!==P_)return!1;let t=e.version;return!t||t===z_}function my(e){let t=e?.package?.npm,r=t?.version;if(typeof r=="string"&&r&&!qr(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 a=i.lastIndexOf("@");return a<=0?null:i.slice(a+1)||null}function xl(){return{keys:new Set,findings:[],files:new Map,reports:new Set,_keyReports:new Map}}function $l(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 Sl(e,t,r,n){e._keyReports.delete(t),e.keys.delete(t);let o=e.findings.findIndex(a=>n(a)===t);o>=0&&e.findings.splice(o,1);let i=e.files.get(r);if(!i)return;let s=i.findIndex(a=>n(a)===t);s>=0&&i.splice(s,1),i.length===0&&e.files.delete(r)}function _l(e){let t=new Set;for(let r of e._keyReports.values())for(let n of r)t.add(n);e.reports=t}function gy(e,t,r,n,o){let i=e.byVersion.get(t);i||(i=xl(),e.byVersion.set(t,i)),$l(i,n,o,r)}function by(e,t,r,n,o,i){let s=e.byVersion.get(t);if(!s)return;let a=s._keyReports.get(r);if(a&&(a.delete(o),a.size===0&&Sl(s,r,n,i)),s._keyReports.size===0){e.byVersion.delete(t);return}_l(s)}function Eu(e,t){if(e===t)return 0;if(e===null)return 1;if(t===null)return-1;let[r,n=""]=hy(e,"-"),[o,i=""]=hy(t,"-"),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 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 hy(e,t){let r=e.indexOf(t);return r<0?[e,""]:[e.slice(0,r),e.slice(r+1)]}var U_=new TextEncoder,H_=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function ae(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 U_.encode(e)}function Le(e){if(!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer))throw new TypeError(`decodeUtf8 expects a BufferSource, got ${e===null?"null":typeof e}`);return H_.decode(e)}async function zo(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(t).arrayBuffer())}async function Vt(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:c,done:u}=await n.read();if(u)break;if(i+=c.length,i>t){try{await n.cancel()}catch{}throw new Error(`gunzipBytes: decompressed size exceeds ${t}-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 es(e){return await zo(ae(e))}async function Hn(e){return Le(await Vt(e))}async function yy(e){let t=await crypto.subtle.digest("SHA-512",e);return`sha512-${new Uint8Array(t).toBase64()}`}var Kt=new Uint8Array([68,86,69,49]),Uo=12,j_=32,W_="deepview-passkey.v1.content-key";function ts(){return!(typeof window>"u"||typeof PublicKeyCredential>"u"||typeof navigator>"u"||!navigator.credentials)}async function vy(){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 Cl(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}async function Au(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:ae(W_)},t,j_*8);return new Uint8Array(r)}function Ru(e){return crypto.subtle.importKey("raw",e,{name:"AES-GCM"},!1,["encrypt","decrypt"])}async function Yr(e,t,r){let n=Cl(Uo),o=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:n,additionalData:r},e,t)),i=new Uint8Array(Kt.length+Uo+o.length);return i.set(Kt,0),i.set(n,Kt.length),i.set(o,Kt.length+Uo),i}async function jn(e,t,r){if(!it(t))throw new Error("passkey: missing envelope magic");if(t.length<Kt.length+Uo+16)throw new Error("passkey: envelope too short");let n=t.subarray(Kt.length,Kt.length+Uo),o=t.subarray(Kt.length+Uo);return new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:r},e,o))}function it(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 wy(e){if(!ts())throw new Error("passkey: not supported in this environment");let t=Cl(32),r=Cl(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 Tu(e){if(!ts())throw new Error("passkey: not supported in this environment");let t=Cl(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 rs=Object.freeze(["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.sync.password","deepview.repoUrls","deepview.fileCounts","deepview.lastFile"]),st=new Map,Al=!1,_r=new Map,It=new Map,El=new Set;function Ho(e){let t=()=>e();return El.add(t),Al&&queueMicrotask(()=>{if(El.has(t))try{t()}catch(r){console.warn("secure-storage after-hydrate listener:",r)}}),()=>El.delete(t)}function V_(){for(let e of El)try{e()}catch(t){console.warn("secure-storage after-hydrate listener:",t)}}function Rl(e){let t=Sy()??"";return ae(`deepview.secure.v1|${t}|${e}`)}function Iu(e){try{let t=Uint8Array.fromBase64(e);if(it(t))return t}catch{}return null}function ze(e){return st.get(e)??null}async function Ge(e,t){if(typeof t!="string")throw new TypeError("secure-storage: value must be a string");if(le()&&!Ue())throw new Error(`secure-storage: vault locked, cannot save "${e}"`);if($y())throw new Error(`secure-storage: wipe in progress, cannot save "${e}"`);let r=st.has(e),n=st.get(e);st.set(e,t),It.set(e,t);let o=_r.get(e)??Promise.resolve(),i=()=>{It.get(e)===t&&It.delete(e)},s=o.catch(()=>{}).then(()=>K_(e,t)).then(()=>i(),a=>{throw i(),st.get(e)===t&&(r?st.set(e,n):st.delete(e)),a});_r.set(e,s.catch(()=>{})),await s}async function jo(e){let t=Symbol("secure-storage:removed");st.delete(e),It.set(e,t);let r=_r.get(e)??Promise.resolve(),n=()=>{try{localStorage.removeItem(e)}catch{}It.get(e)===t&&(It.delete(e),st.delete(e))},o=r.catch(()=>{}).then(()=>n());_r.set(e,o.catch(()=>{})),await o}async function K_(e,t){let r=Ue();if(r){let n=await Yr(r,ae(t),Rl(e));localStorage.setItem(e,n.toBase64())}else localStorage.setItem(e,t)}async function Xr(){Al||He(()=>{Xr().catch(r=>console.warn("secure-storage rehydrate:",r))}),Al=!0;for(let r of[...st.keys()])It.has(r)||st.delete(r);let e=Ue(),t=[];for(let r of rs){if(It.has(r))continue;let n=localStorage.getItem(r);if(n===null)continue;let o=Iu(n);if(o){if(!e)continue;try{let i=await jn(e,o,Rl(r));if(It.has(r))continue;st.set(r,Le(i))}catch(i){console.warn(`secure-storage: decrypt failed for "${r}":`,i)}}else st.set(r,n),e&&le()&&t.push([r,n])}V_(),t.length>0&&queueMicrotask(()=>{for(let[r,n]of t)st.get(r)===n&&Ge(r,n).catch(o=>{console.warn(`secure-storage: self-heal failed for "${r}":`,o)})})}async function ky(e,t){let r=_r.get(e)??Promise.resolve(),n=async()=>{if(It.has(e))return;let i=localStorage.getItem(e);if(i===null)return;let s=await t(i);s!==null&&(It.has(e)||(localStorage.setItem(e,s.storageValue),st.set(e,s.cacheValue)))},o=r.catch(()=>{}).then(n);_r.set(e,o.catch(()=>{})),await o}async function Lu({seal:e}){for(let t of rs)await ky(t,async r=>{if(Iu(r))return null;let n=Ue();return n?{storageValue:(await Yr(n,ae(r),Rl(t))).toBase64(),cacheValue:r}:null})}async function Fu({open:e}){for(let t of rs)await ky(t,async r=>{let n=Iu(r);if(!n)return null;let o=await e(n,Rl(t)),i=Le(o);return{storageValue:i,cacheValue:i}})}var G_="deepview.secure.v1.mutate:";function Tl(e,t){return rs.includes(e)?navigator.locks.request(G_+e,async()=>{let r=_r.get(e);r&&await r.catch(()=>{}),await Xr();let n=ze(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 Ge(e,o)}}):Promise.reject(new Error(`secure-storage: mutate() called with non-secure key "${e}"`))}async function xy(){await Promise.allSettled([..._r.values()]),It.clear(),_r.clear()}typeof window<"u"&&window.addEventListener("storage",e=>{!Al||!e.key||!rs.includes(e.key)||Xr().catch(()=>{})});var is="deepview.passkey.v1",Wo="deepview.passkey.userId",Ll="deepview.passkey.cleanDisable",ft="deepview.passkey.v1.write",Y_="deepview.triage.v1|",X_="deepview.opfs.v1|",J_="deepview.bundle.v1|",ye=null,rr=null,Jr=null,os=0;function Ou(){return os>0}var Mu=0;function $y(){return Mu>0}function Wn(){try{let e=localStorage.getItem(is);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 _y(e){localStorage.setItem(is,JSON.stringify(e))}function Z_(){localStorage.removeItem(is)}function Q_(){try{let t=localStorage.getItem(Wo);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(Wo,e.toBase64({alphabet:"base64url",omitPadding:!0}))}catch{}return e}function Fl(){return typeof location>"u"?"":location.hostname}function le(){return Wn()!==null}function Gt(){return ye!==null}function nr(){return!(!ts()||typeof navigator>"u"||!navigator.locks?.request||!Fl())}function Sy(){return rr}function ss(){if(Wn()!==null)return!1;try{return localStorage.getItem(Ll)==="1"?!1:localStorage.getItem(Wo)!==null}catch{return!1}}function Ue(){return ye}function as(){return ae(Y_+(rr??""))}function Ml(e){if(typeof e!="string")throw new TypeError("passkey vault: OPFS AAD requires a filename string");return ae(X_+(rr??"")+"|"+e)}function Bl(e){if(typeof e!="string")throw new TypeError("passkey vault: bundle AAD requires a slot string");return ae(J_+(rr??"")+"|"+e)}var Bu=new Set;function He(e){return Bu.add(e),()=>Bu.delete(e)}function Vo(){for(let e of Bu)try{e()}catch(t){console.warn("passkey vault listener:",t)}}async function ls({signal:e}={}){let t=Wn();if(!t)return!1;let r;try{r=await Tu({credentialId:t.credentialId,prfSalt:t.prfSalt,rpId:t.rpId??Fl(),...e?{signal:e}:{}})}catch(o){if(o&&o.name==="NotAllowedError"||o&&o.name==="AbortError")return!1;throw o&&o.message?.includes("PRF")?ns(o):o}if(!r||r.length<32)throw ns();let n=await Au(r);return r.fill(0),navigator.locks.request(ft,async()=>{let o=Wn();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 ye=await Ru(n),n.fill(0),rr=o.userId,Jr=o.credentialId,Vo(),!0})}function ns(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 Du({migrate:e,userName:t,rpName:r,signal:n,acknowledgeOrphan:o}){if(!ts())throw new Error("passkey: WebAuthn unavailable in this environment");if(ss()&&!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=Fl();return navigator.locks.request(ft,async()=>{if(le())throw new Error("passkey: encryption is already enabled");if(await vy()===!1)throw ns();let a=Q_(),c=await wy({userName:t||"DeepView user",userId:a,rpName:r||"DeepView",rpId:i,...n?{signal:n}:{}}),u=c.prfOutput;if(!u)try{u=await Tu({credentialId:c.credentialId,prfSalt:c.prfSalt,rpId:i,...n?{signal:n}:{}})}catch(b){let y=a.toBase64({alphabet:"base64url",omitPadding:!0});await Il({credentialId:c.credentialId,rpId:i,userId:y}).catch(()=>{});try{localStorage.removeItem(Wo)}catch{}throw b&&b.message?.includes("PRF")?ns(b):b}if(!u||u.length<32){let b=a.toBase64({alphabet:"base64url",omitPadding:!0});await Il({credentialId:c.credentialId,rpId:i,userId:b}).catch(()=>{});try{localStorage.removeItem(Wo)}catch{}throw ns()}let p=await Au(u);u.fill(0);let f=await Ru(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()};ye=f,rr=h,Jr=c.credentialId,_y(g),typeof e=="function"&&await e({seal:(y,v)=>Yr(f,y,v)});try{localStorage.removeItem(Ll)}catch{}return Vo(),!0})}async function Nu({migrate:e}){if(!le())return{disabled:!1,signalAttempted:!1};if(!Gt())throw new Error("passkey: must unlock before disabling encryption");os+=1;try{return await navigator.locks.request(ft,async()=>{let t=Wn();if(!t)return{disabled:!1,signalAttempted:!1};let r=ye;if(!r)return{disabled:!1,signalAttempted:!1};if(Z_(),ye=null,Jr=null,typeof e=="function"){let o=(i,s)=>jn(r,i,s);try{await e({open:o})}catch(i){throw _y(t),ye=r,Jr=t.credentialId,Vo(),i}}rr=null;try{localStorage.setItem(Ll,"1")}catch{}let n=await Il(t).catch(()=>!1);return Vo(),{disabled:!0,signalAttempted:n}})}finally{os-=1}}async function Il({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 eC(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 tC(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 eC(r,n);o&&t.push(o)}return t}async function cs({refuseIfEnabled:e=!1}={}){os+=1,Mu+=1;try{return await navigator.locks.request(ft,async()=>{if(e&&le())throw new Error("passkey: encryption was just enabled in another tab. Reload this page to unlock instead of wiping.");await xy();let t=Wn();if(t)try{await Il({credentialId:t.credentialId,rpId:t.rpId??Fl(),userId:t.userId})}catch{}try{localStorage.removeItem(is)}catch{}try{localStorage.removeItem(Wo)}catch{}try{localStorage.removeItem(Ll)}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{}ye=null,rr=null,Jr=null,Vo();let r=await tC(["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{os-=1,Mu-=1}}function Cy(e){return ye?Yr(ye,e,as()):Promise.reject(new Error("passkey: vault locked, cannot seal triage"))}function Ey(e){return ye?jn(ye,e,as()):Promise.reject(new Error("passkey: vault locked, cannot open triage"))}function Ol(e,t){return ye?Yr(ye,e,Ml(t)):Promise.reject(new Error("passkey: vault locked, cannot seal OPFS file"))}function Ay(e,t){return ye?jn(ye,e,Ml(t)):Promise.reject(new Error("passkey: vault locked, cannot open OPFS file"))}function Dl(e,t){return ye?Yr(ye,e,Bl(t)):Promise.reject(new Error("passkey: vault locked, cannot seal bundle"))}function Nl(e,t){return ye?jn(ye,e,Bl(t)):Promise.reject(new Error("passkey: vault locked, cannot open bundle"))}typeof window<"u"&&window.addEventListener("storage",e=>{if(e.key!==is)return;let t=Wn();(!t&&ye||t&&ye&&t.credentialId!==Jr)&&(ye=null,rr=null,Jr=null),Vo()});var Uu="__meta__",rC="deepview-reports",Hu="deepview-bundles",Qr="deepview.report:",Ry=!1;async function ju(e,{create:t,warnOnce:r=!1}={}){try{return await(await navigator.storage.getDirectory()).getDirectoryHandle(e,{create:t})}catch(n){return r&&!Ry&&(Ry=!0,console.warn("OPFS unavailable, falling back to gzipped localStorage (limited quota).",n)),null}}async function ps(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 Wu(e,t){if(!it(e))return e;if(!Ue())throw new Error(`storage: vault locked, cannot decrypt "${t}"`);return await Ay(e,t)}function Ul(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 Vu(e,t){ds(e)===t&&(console.warn(`storage: report "${e}" is an empty/corrupt on-disk entry \u2014 quarantining, will read as missing`),await navigator.locks.request(ft,{mode:"exclusive"},async()=>{if(ds(e)!==t)return;ke(e),Lt.delete(e);let r=await en();if(r)try{await r.removeEntry(e)}catch{}Hl(e),ke(e),Vn(e,"delete")}))}async function Ku(e,t,r){try{(await t.getFile()).size===0&&await e.removeEntry(r)}catch{}}async function Ko(e,t,r,n,o=()=>{}){if(le()&&!Ue())throw o(),new Error(`storage: vault locked, cannot save ${n}`);let i=Ue(),s=i?await t(e,r):e;if(Ue()!==i)throw o(),new Error(`storage: vault state changed mid-save for ${n}; retry`);return s}function en(){return ju(rC,{create:!0,warnOnce:!0})}function Pl(e){try{return localStorage.getItem(Qr+e)}catch{return null}}function Hl(e){try{localStorage.removeItem(Qr+e)}catch{}}function nC(){let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r&&r.startsWith(Qr)&&e.push(r.slice(Qr.length))}return e}var Lt=new Map,Zr=new Map,Pu=new Map;function ke(e){Pu.set(e,(Pu.get(e)??0)+1)}function ds(e){return Pu.get(e)??0}var zu=new Set;function Gn(e){return zu.add(e),()=>zu.delete(e)}function Vn(e,t){for(let r of zu)try{r(e,t)}catch(n){console.warn("storage file-change listener:",n)}}async function fe(){let e=new Set(nC()),t=await en();if(t)for await(let[r]of t.entries())e.add(r);return[...e].toSorted()}async function Ft(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 ke(e),navigator.locks.request(ft,{mode:"shared"},async()=>{let r=await en();if(r){let i=await zo(ae(t));i=await Ko(i,Ol,e,`"${e}"`,()=>ke(e));let s=await r.getFileHandle(e,{create:!0}),a=await s.createWritable();try{await a.write(i),await a.close()}catch(c){Lt.delete(e),ke(e);try{await a.abort(c)}catch{}throw await Ku(r,s,e),c}Lt.set(e,t),ke(e),Hl(e),Vn(e,"save");return}let n=ae(t);n=await zo(n),n=await Ko(n,Ol,e,`"${e}"`,()=>ke(e));let o=n.toBase64();try{localStorage.setItem(Qr+e,o),Lt.set(e,t),ke(e),Vn(e,"save")}catch(i){throw ke(e),new Error(`localStorage write failed for ${e}: ${i.message}`,{cause:i})}})}async function Ty(e,t){let r=Pl(e);if(r===null)return null;let n=Uint8Array.fromBase64(r);if(n=await Wu(n,e),Ul(n))throw await Vu(e,t),new Error(`File not found: ${e}`);return Le(await Vt(n))}async function Ae(e){if(Lt.has(e))return Lt.get(e);if(Zr.has(e))return Zr.get(e);let t=ds(e),r=(async()=>{let n=await en();if(n){let i;try{i=await n.getFileHandle(e)}catch(u){if(u instanceof DOMException&&u.name==="NotFoundError"){let p=await Ty(e,t);if(p!==null)return Ft(e,p).catch(f=>{console.warn(`storage: stranded-localStorage migration of "${e}" failed:`,f)}),p}throw u}let s=await i.getFile(),a=new Uint8Array(await s.arrayBuffer());if(a=await Wu(a,e),Ul(a))throw await Vu(e,t),new Error(`File not found: ${e}`);if(a.length>=2&&a[0]===31&&a[1]===139){let u=await Vt(a);return Le(u)}let c=Le(a);return Ft(e,c).catch(u=>{console.warn(`storage: legacy-uncompressed migration of "${e}" failed:`,u)}),c}let o=await Ty(e,t);if(o===null)throw new Error(`File not found: ${e}`);return o})();Zr.set(e,r);try{let n=await r;return ds(e)===t&&Lt.set(e,n),n}finally{Zr.delete(e)}}async function qn(e){let t=ds(e),r=await en(),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=Pl(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=Pl(e);if(o===null)throw new Error(`File not found: ${e}`);n=Uint8Array.fromBase64(o)}if(n=await Wu(n,e),Ul(n))throw await Vu(e,t),new Error(`File not found: ${e}`);return n}async function fs(e,t){if(typeof e!="string"||e.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");if(Ul(t))throw new Error(`Refusing to save empty report bytes for "${e}"`);return ke(e),Lt.delete(e),navigator.locks.request(ft,{mode:"shared"},async()=>{let r=await Ko(t,Ol,e,`"${e}"`,()=>ke(e)),n=await en();if(n){let o=await n.getFileHandle(e,{create:!0}),i=await o.createWritable();try{await i.write(r),await i.close()}catch(s){ke(e);try{await i.abort(s)}catch{}throw await Ku(n,o,e),s}ke(e),Hl(e),Vn(e,"save");return}try{localStorage.setItem(Qr+e,r.toBase64()),ke(e),Vn(e,"save")}catch(o){throw ke(e),new Error(`localStorage write failed for ${e}: ${o.message}`,{cause:o})}})}async function Go(e){return ke(e),Lt.delete(e),Zr.delete(e),navigator.locks.request(ft,{mode:"shared"},async()=>{let t=await en();if(t){try{await t.removeEntry(e)}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw ke(e),r}Hl(e),ke(e),Vn(e,"delete");return}localStorage.removeItem(Qr+e),ke(e),Vn(e,"delete")})}var us="_meta.json",zl=".index-v1";function Yn(){return ju(Hu,{create:!0})}function Kn(e){return e.replaceAll("/","_")}async function Gu(e){let t;try{let o=await(await e.getFileHandle(us)).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(it(t)){if(!Ue())return console.warn("readBundleMeta: vault locked, returning empty bundle list"),[];try{r=await Nl(t,Uu)}catch(o){return console.warn("readBundleMeta: decrypt failed (tampering, key mismatch, or vault identity drift):",o),[]}}try{let n=JSON.parse(Le(r));return Array.isArray(n)?n:[]}catch(n){return console.warn("readBundleMeta: JSON.parse failed:",n),[]}}async function Iy(e,t){let r=ae(JSON.stringify(t));r=await Ko(r,Dl,Uu,"bundle metadata");try{await e.removeEntry(us)}catch{}let n=await e.getFileHandle(us,{create:!0});await ps(n,r)}var oC=`${Hu}/${us}`;function qu(e){return navigator.locks.request(oC,e)}async function qt(){let e=await Yn();return e?[...await Gu(e)].toSorted((r,n)=>r.name.localeCompare(n.name)):[]}async function hs(){if(typeof navigator>"u"||!navigator.storage?.getDirectory)return!1;let e=await ju(Hu,{create:!1});if(!e)return!1;try{for await(let t of e.entries())return!0}catch{}return!1}async function Xn(e,t){let r=await Yn();if(!r)throw new Error(`Cannot save bundle ${e}: OPFS unavailable`);let n=t instanceof Uint8Array?t:ae(t),o=await yy(n),i=Kn(o),s=e.toLowerCase().endsWith(".map")?await zo(n):n;return navigator.locks.request(ft,{mode:"shared"},async()=>{s=await Ko(s,Dl,o,`bundle "${e}"`);try{await r.removeEntry(i)}catch{}let a=await r.getFileHandle(i,{create:!0});await ps(a,s);try{await qu(async()=>{let c=await Gu(r),u=c.findIndex(p=>p.integrity===o);u>=0?c[u]={integrity:o,name:e}:c.push({integrity:o,name:e}),await Iy(r,c)})}catch(c){try{await r.removeEntry(i)}catch{}throw c}return{integrity:o,name:e}})}async function Yu(e){let t=await Yn();if(t)return navigator.locks.request(ft,{mode:"shared"},async()=>{try{await t.removeEntry(Kn(e))}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw r}await qu(async()=>{try{await t.removeEntry(Kn(e)+zl)}catch(o){if(!(o instanceof DOMException)||o.name!=="NotFoundError")throw o}let r=await Gu(t),n=r.filter(o=>o.integrity!==e);n.length!==r.length&&await Iy(t,n)})})}async function Cr(e){let t=await Yn();if(!t)throw new Error("OPFS unavailable");let n=await(await t.getFileHandle(Kn(e))).getFile(),o=new Uint8Array(await n.arrayBuffer());if(it(o)){if(!Ue())throw new Error(`storage: vault locked, cannot read bundle "${e}"`);o=await Nl(o,e)}return o.length>=2&&o[0]===31&&o[1]===139?await Vt(o):o}async function Xu(e){let t=await Yn();if(!t||le()&&!Ue())return null;try{let r=await t.getFileHandle(Kn(e)+zl),n=new Uint8Array(await(await r.getFile()).arrayBuffer());return it(n)&&(n=await Nl(n,e+zl)),JSON.parse(Le(await Vt(n)))}catch{return null}}async function Ju(e,t){let r=await zo(ae(JSON.stringify(t)));return navigator.locks.request(ft,{mode:"shared"},()=>qu(async()=>{let n=await Yn();if(!n)return;await n.getFileHandle(Kn(e));let o=e+zl,i=await Ko(r,Dl,o,"bundle index"),s=await n.getFileHandle(Kn(o),{create:!0});await ps(s,i)}))}async function iC(e,t){let r=await en();if(r){let s=null;try{s=await r.getFileHandle(e)}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 t(c);if(u===null)return;Lt.delete(e),Zr.delete(e),ke(e);let p=await r.getFileHandle(e,{create:!0});try{await ps(p,u)}catch(f){throw await Ku(r,p,e),f}ke(e);return}}let n=Pl(e);if(n===null)return;let o=Uint8Array.fromBase64(n),i=await t(o);i!==null&&(Lt.delete(e),Zr.delete(e),ke(e),localStorage.setItem(Qr+e,i.toBase64()),ke(e))}function Ly(e,t){return e.seal?r=>it(r)?null:e.seal(r,t):r=>it(r)?e.open(r,t):null}async function Fy(e){let t=await fe();for(let r of t)try{await iC(r,Ly(e,Ml(r)))}catch(n){if(n instanceof DOMException&&n.name==="NotFoundError")continue;throw n}}var Zu=({seal:e})=>Fy({seal:e}),Qu=({open:e})=>Fy({open:e});async function sC(){let e=await Yn();if(!e)return{dir:null,keys:[]};let t=[];for await(let[r]of e.entries())t.push(r);return{dir:e,keys:t}}function aC(e){return e===us?Uu:e.startsWith("sha512-")?e.replaceAll("_","/"):null}async function lC(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 a=await e.getFileHandle(t,{create:!0});await ps(a,s)}async function My(e){let{dir:t,keys:r}=await sC();if(t)for(let n of r){let o=aC(n);if(o!==null)try{await lC(t,n,Ly(e,Bl(o)))}catch(i){if(i instanceof DOMException&&i.name==="NotFoundError")continue;throw i}}}var ep=({seal:e})=>My({seal:e}),tp=({open:e})=>My({open:e});He(()=>{Lt.clear(),Zr.clear()});var jl="/api/config";var By="deepview.sync.serverInfo";function Wl(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 Er(){try{let e=localStorage.getItem(By);return e==null?null:Wl(JSON.parse(e))}catch{return null}}function rp(e){try{localStorage.setItem(By,JSON.stringify(e))}catch{}}function np(e,t){return e==null?"first":e===t?"match":"mismatch"}var Dy="deepview.viewMode",Vl="deepview.severityMode",ms="deepview.repoUrls",Kl="deepview.focusSplit",Gl="deepview.kanbanDetailFullscreen",cC=new Set(["corrected","original"]),gs=50,ql=20,Yl=80;try{localStorage.removeItem(Dy)}catch{}function dC(){try{let e=localStorage.getItem(Vl);return e!==null&&cC.has(e)?e:null}catch{return null}}function uC(){try{let e=localStorage.getItem(Gl);return e==="true"?!0:e==="false"?!1:null}catch{return null}}function bs(e){if(!Number.isFinite(e))return gs;let t=Math.round(e*10)/10;return Math.min(Math.max(t,ql),Yl)}function pC(){try{let e=localStorage.getItem(Kl);if(e===null||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?bs(t):null}catch{return null}}function Xl(e){try{let t=JSON.parse(e||"{}");return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Jl(){return Xl(ze(ms))}function wt(e){return e?Jl()[e]??"":""}var op=new Set;function Ny(e){return op.add(e),()=>{op.delete(e)}}function Py(e){for(let t of op)try{t(e)}catch(r){console.warn("repo-url listener:",r)}}function Yt(e,t){if(!e)return;let r=Jl();t?r[e]=t:delete r[e],Ge(ms,JSON.stringify(r)).catch(n=>console.warn("saveRepoUrlFor:",n)),Tl(ms,n=>{let o=Xl(n);return t?o[e]=t:delete o[e],JSON.stringify(o)}).catch(n=>console.warn("saveRepoUrlFor cross-tab merge:",n)),Py(e)}async function zy(e,t){await Tl(ms,r=>{let n=Xl(r),o=t==="replace"?{...e}:t==="prefer-imported"?{...n,...e}:{...e,...n};return JSON.stringify(o)}),sp()}async function Zl(e){if(!e||typeof e!="object")return[];let t=[];if(await Tl(ms,r=>{let n=Xl(r);t=[];for(let[o,i]of Object.entries(e))!o||typeof i!="string"||!i||n[o]||(n[o]=i,t.push(o));return t.length===0?r:JSON.stringify(n)}),t.length===0)return t;sp();for(let r of t)Py(r);return t}async function ip(e,t){return!e||!t?!1:(await Zl({[e]:t})).length>0}var Oy=Er(),l=kl({reports:[],workspaceMerges:[],currentFile:null,currentWorkspace: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:dC()??"corrected",triage:new Map,shownTriage:null,nextFindingId:0,activeTabByGroup:new Map,tableSelectedGid:null,filesViewMode:"table",filesSearch:"",filesSelectedFile:null,kanbanPopoverGid:null,kanbanDetailFullscreen:uC()??!1,kanbanExpandedColumn:null,focusGid:null,focusCodeTick:0,focusCodeStack:[],focusCodeAt:0,focusSplit:pC()??gs,codeBlockTick:0,bundleHashTick:0,linksTick:0,findingIndexTick:0,serverMode:Oy?.mode??"e2e",managed:Oy?.managed??null,serverModeMismatch:!1,managedSession:null,managedTeams:[]});function sp(){l.repoEditing||l.currentFile&&(l.repoUrl=wt(l.currentFile))}Ho(()=>{sp()});var fC=/^( *)(```|~~~)/u,hC=/^( *)(?:[-*+]|\d{1,9}[.)]) +(?=\S)/u;function je(e){let t=[],r=-1,n="",o=0,i=0,s=0;for(let a of e.split(`
|
|
4
|
-
`)){let c=s;s+=a.length+1;let u=
|
|
5
|
-
`)}
|
|
6
|
-
`);return
|
|
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());
|
|
8
|
-
`)),o=null,i="",s=[]},p=f=>{(o?s:n).push(f)};for(let f of
|
|
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
|
|
10
|
-
`).trim()}}function
|
|
11
|
-
`?c:i[c+1];let s=new Map,a=[];for(let c=0;c<
|
|
1
|
+
var P5=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 N5=(t,e)=>{for(var r in e)P5(t,r,{get:e[r],enumerable:!0})};var Qc,ed,Nf,Ok,wa,R,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,wa=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}},R=t=>new wa(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 wa(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 R(r)})(t):t});var D5,z5,U5,H5,j5,V5,td,Nk,W5,K5,ka,Uf,zk,Dk,un,rd=w(()=>{zf();zf();({is:D5,defineProperty:z5,getOwnPropertyDescriptor:U5,getOwnPropertyNames:H5,getOwnPropertySymbols:j5,getPrototypeOf:V5}=Object),td=globalThis,Nk=td.trustedTypes,W5=Nk?Nk.emptyScript:"",K5=td.reactiveElementPolyfillSupport,ka=(t,e)=>t,Uf={toAttribute(t,e){switch(e){case Boolean:t=t?W5: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)=>!D5(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&&z5(this.prototype,e,o)}}static getPropertyDescriptor(e,r,n){let{get:o,set:i}=U5(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(ka("elementProperties")))return;let e=V5(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ka("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ka("properties"))){let r=this.properties,n=[...H5(r),...j5(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[ka("elementProperties")]=new Map,un[ka("finalized")]=new Map,K5?.({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 Ko(t,e,r=t,n){if(e===je)return e;let o=n!==void 0?r._$Co?.[n]:r._$Cl,i=_a(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=Ko(t,o._$AS(t,e.values),o,n)),e}var jf,Uk,nd,Hk,Vf,pn,Wf,G5,Wo,$a,_a,Kf,qk,Hf,xa,jk,Vk,jo,Wk,Kk,Yk,Gf,d,Wn,JP,je,m,Gk,Vo,Jk,Sa,od,Xi,Go,id,sd,ad,ld,Zk,q5,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,G5=`<${Wf}>`,Wo=document,$a=()=>Wo.createComment(""),_a=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]`,xa=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,jk=/-->/g,Vk=/>/g,jo=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),JP=Gf(3),je=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Gk=new WeakMap,Vo=Wo.createTreeWalker(Wo,129);Jk=(t,e)=>{let r=t.length-1,n=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=xa;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===xa?p[1]==="!--"?s=jk:p[1]!==void 0?s=Vk:p[2]!==void 0?(Yk.test(p[2])&&(o=RegExp("</"+p[2],"g")),s=jo):p[3]!==void 0&&(s=jo):s===jo?p[0]===">"?(s=o??xa,f=-1):p[1]===void 0?f=-2:(f=s.lastIndex-p[2].length,u=p[1],s=p[3]===void 0?jo:p[3]==='"'?Kk:Wk):s===Kk||s===Wk?s=jo:s===jk||s===Vk?s=xa:(s=jo,o=void 0);let g=s===jo&&t[a+1].startsWith("/>")?" ":"";i+=s===xa?c+G5: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]},Sa=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),Vo.currentNode=this.el.content,r===2||r===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(o=Vo.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:Go}),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],$a()),Vo.nextNode(),c.push({type:2,index:++i});o.append(f[h],$a())}}}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=Wo.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??Wo).importNode(r,!0);Vo.currentNode=o;let i=Vo.nextNode(),s=0,a=0,c=n[0];for(;c!==void 0;){if(s===c.index){let u;c.type===2?u=new Xi(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=Vo.nextNode(),s++)}return Vo.currentNode=Wo,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++}},Xi=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=Ko(this,e,r),_a(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&&_a(this._$AH)?this._$AA.nextSibling.data=e:this.T(Wo.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=Sa.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 Sa(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($a()),this.O($a()),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))}},Go=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=Ko(this,e,r,0),s=!_a(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=Ko(this,a[n+c],r,c),u===je&&(u=this._$AH[c]),s||=!_a(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 Go{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===m?void 0:e}},sd=class extends Go{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==m)}},ad=class extends Go{constructor(e,r,n,o,i){super(e,r,n,o,i),this.type=5}_$AI(e,r=this){if((e=Ko(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){Ko(this,e)}},Zk={M:Vf,P:pn,A:Wf,C:1,L:Jk,R:od,D:qk,V:Ko,I:Xi,H:Go,N:sd,U:ad,B:id,F:ld},q5=jf.litHtmlPolyfillSupport;q5?.(Sa,Xi),(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 Xi(e.insertBefore($a(),i),i,void 0,r??{})}return o._$AI(t),o}});var qf,J,Y5,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});Y5=qf.litElementPolyfillSupport;Y5?.({LitElement:J});(qf.litElementVersions??=[]).push("4.2.2")});var e0=w(()=>{});var T=w(()=>{rd();Lr();Qk();e0()});var yt,Fr,Qt,Ji=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();Ji();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 Te=w(()=>{t0()});var X5,r0,o0,n0,Zi,Kn,J5,cd,i0,dd,Yf=w(()=>{Lr();({I:X5}=Zk),r0=t=>t,o0=t=>t.strings===void 0,n0=()=>document.createComment(""),Zi=(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 X5(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),J5={},cd=(t,e=J5)=>t._$AH=e,i0=t=>t._$AH,dd=t=>{t._$AR(),t._$AA.remove()}});var s0,te,a0=w(()=>{Lr();Ji();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]),Zi(t,c[y+1],o[f]),f++,y--;else if(a[h]===s[g])c[g]=Kn(o[h],i[g]),Zi(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=Zi(t,o[f]);Kn(x,i[g]),c[g]=x}else c[g]=Kn(v,i[g]),Zi(t,o[f],v),o[b]=null;g++}else dd(o[h]),h--;else dd(o[f]),f++;for(;g<=y;){let b=Zi(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,Z5,we,c0=w(()=>{Lr();Ji();l0="important",Z5=" !"+l0,we=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(Z5);n.includes("-")||i?r.setProperty(n,i?o.slice(0,-11):o,i?l0:""):r[n]=o}}return je}})});var fn=w(()=>{c0()});function Q5(t){Qf.set(t,new Map)}function eM(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 tM({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(rM,t),t.cleaners=[]}function rM(t){t.delete(this)}function nM(t,e,r,n){if(t.unobserved)return Reflect.apply(e,r,n);if(Qi.indexOf(t)===-1){h0(t);try{return Qi.push(t),Reflect.apply(e,r,n)}finally{Qi.pop()}}}function br(t){let e=Qi[Qi.length-1];e&&(m0(e,t),eM(e,t))}function Gn(t){tM(t).forEach(oM,t)}function oM(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 Qi.length>0}function b0(t,e={}){let r=t[d0]?t:function n(){return nM(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 sM({constructor:t}){return!(typeof t=="function"&&t.name in p0&&p0[t.name]===t)||y0.has(t)}function aM(t){return y0.get(t.constructor)}function cM(t,e,r){let n=Reflect.get(t,e,r);if(typeof e=="symbol"&&lM.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 dM(t,e){let r=Reflect.has(t,e);return br({target:t,key:e,type:"has"}),r}function uM(t){return br({target:t,type:"iterate"}),Reflect.ownKeys(t)}function pM(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 fM(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)||!sM(t)?t:fd.get(t)||mM(t)}function mM(t){let e=aM(t)||hM,r=new Proxy(t,e);return fd.set(t,r),mt.set(r,t),Q5(t),r}var Qf,f0,Qi,Jf,d0,mt,fd,iM,u0,ud,p0,y0,v0,lM,hM,w0=w(()=>{Qf=new WeakMap,f0=Symbol("iteration key");Qi=[],Jf=!1;d0=Symbol("is reaction");mt=new WeakMap,fd=new WeakMap,iM=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=iM.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,lM=new Set(Object.getOwnPropertyNames(Symbol).map(t=>Symbol[t]).filter(t=>typeof t=="symbol"));hM={get:cM,has:dM,ownKeys:uM,set:pM,deleteProperty:fM}});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(()=>{T();gd();T();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 es(t){return new Error("Another dialog is already open. Close it and try again.",{cause:t})}var Ue,M,$0,Nt=w(()=>{"use strict";T();Ue=document.querySelector("#drop-zone"),M=document.querySelector("#report"),$0=document.querySelector("app-sidebar")});function qn(t){if(t?.name!==gM)return!1;let e=t.version;return!e||e===bM}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 gM,bM,nh=w(()=>{"use strict";gM="solidity-bundle",bM="0.0.0"});function be(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 A0.encode(t)}function qo(t){if(typeof t!="string")throw new TypeError(`utf8ByteLength expects a string, got ${typeof t}`);if(/[\u0100-\uFFFF]/.test(t))return A0.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<vM;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 yM.decode(t)}var A0,yM,vM,gt=w(()=>{"use strict";A0=new TextEncoder,yM=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});vM=2});async function ts(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 Ca(t){return await ts(be(t))}async function Yo(t){return Ve(await yr(t))}var rs=w(()=>{"use strict";gt()});async function R0(t){let e=await crypto.subtle.digest("SHA-512",t);return`sha512-${new Uint8Array(e).toBase64()}`}var M0=w(()=>{"use strict"});function Ea(){return!(typeof window>"u"||typeof PublicKeyCredential>"u"||typeof navigator>"u"||!navigator.credentials)}async function T0(){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:be(kM)},e,wM*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(ns),o=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:n,additionalData:r},t,e)),i=new Uint8Array(vr.length+ns+o.length);return i.set(vr,0),i.set(n,vr.length),i.set(o,vr.length+ns),i}async function Xo(t,e,r){if(!wt(e))throw new Error("passkey: missing envelope magic");if(e.length<vr.length+ns+16)throw new Error("passkey: envelope too short");let n=e.subarray(vr.length,vr.length+ns),o=e.subarray(vr.length+ns);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(!Ea())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(!Ea())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,ns,wM,kM,ah=w(()=>{"use strict";gt();vr=new Uint8Array([68,86,69,49]),ns=12,wM=32,kM="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 xM(){for(let t of xd)try{t()}catch(e){console.warn("secure-storage after-hydrate listener:",e)}}function _d(t){let e=O0()??"";return be(`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(()=>$M(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 $M(t,e){let r=et();if(r){let n=await Yn(r,be(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 Aa){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 Xo(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])}xM(),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 Aa)await L0(e,async r=>{if(lh(r))return null;let n=et();return n?{storageValue:(await Yn(n,be(r),_d(e))).toBase64(),cacheValue:r}:null})}async function dh({open:t}){for(let e of Aa)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 Aa.includes(t)?navigator.locks.request(_M+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 Aa,kt,$d,mn,er,xd,_M,gn=w(()=>{"use strict";gt();ah();Ra();Aa=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;_M="deepview.secure.v1.mutate:";typeof window<"u"&&window.addEventListener("storage",t=>{!$d||!t.key||!Aa.includes(t.key)||Br().catch(()=>{})})});function fh(){return Ta>0}function B0(){return uh>0}function Jo(){try{let t=localStorage.getItem(Ia);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(Ia,JSON.stringify(t))}function RM(){localStorage.removeItem(Ia)}function MM(){try{let e=localStorage.getItem(os);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(os,t.toBase64({alphabet:"base64url",omitPadding:!0}))}catch{}return t}function Ad(){return typeof location>"u"?"":location.hostname}function de(){return Jo()!==null}function tr(){return Ae!==null}function Pr(){return!(!Ea()||typeof navigator>"u"||!navigator.locks?.request||!Ad())}function O0(){return Or}function La(){if(Jo()!==null)return!1;try{return localStorage.getItem(Ed)==="1"?!1:localStorage.getItem(os)!==null}catch{return!1}}function et(){return Ae}function Fa(){return be(CM+(Or??""))}function Rd(t){if(typeof t!="string")throw new TypeError("passkey vault: OPFS AAD requires a filename string");return be(EM+(Or??"")+"|"+t)}function Md(t){if(typeof t!="string")throw new TypeError("passkey vault: bundle AAD requires a slot string");return be(AM+(Or??"")+"|"+t)}function tt(t){return ph.add(t),()=>ph.delete(t)}function is(){for(let t of ph)try{t()}catch(e){console.warn("passkey vault listener:",e)}}async function Ba({signal:t}={}){let e=Jo();if(!e)return!1;let r;try{r=await sh({credentialId:e.credentialId,prfSalt:e.prfSalt,rpId:e.rpId??Ad(),...t?{signal:t}:{}})}catch(o){if(o&&o.name==="NotAllowedError"||o&&o.name==="AbortError")return!1;throw o&&o.message?.includes("PRF")?Ma(o):o}if(!r||r.length<32)throw Ma();let n=await oh(r);return r.fill(0),navigator.locks.request(Rt,async()=>{let o=Jo();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 Ae=await ih(n),n.fill(0),Or=o.userId,Zn=o.credentialId,is(),!0})}function Ma(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(!Ea())throw new Error("passkey: WebAuthn unavailable in this environment");if(La()&&!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=Ad();return navigator.locks.request(Rt,async()=>{if(de())throw new Error("passkey: encryption is already enabled");if(await T0()===!1)throw Ma();let a=MM(),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(os)}catch{}throw y&&y.message?.includes("PRF")?Ma(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(os)}catch{}throw Ma()}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()};Ae=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 is(),!0})}async function mh({migrate:t}){if(!de())return{disabled:!1,signalAttempted:!1};if(!tr())throw new Error("passkey: must unlock before disabling encryption");Ta+=1;try{return await navigator.locks.request(Rt,async()=>{let e=Jo();if(!e)return{disabled:!1,signalAttempted:!1};let r=Ae;if(!r)return{disabled:!1,signalAttempted:!1};if(RM(),Ae=null,Zn=null,typeof t=="function"){let o=(i,s)=>Xo(r,i,s);try{await t({open:o})}catch(i){throw P0(e),Ae=r,Zn=e.credentialId,is(),i}}Or=null;try{localStorage.setItem(Ed,"1")}catch{}let n=await Cd(e).catch(()=>!1);return is(),{disabled:!0,signalAttempted:n}})}finally{Ta-=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 TM(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 IM(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 TM(r,n);o&&e.push(o)}return e}async function Oa({refuseIfEnabled:t=!1}={}){Ta+=1,uh+=1;try{return await navigator.locks.request(Rt,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=Jo();if(e)try{await Cd({credentialId:e.credentialId,rpId:e.rpId??Ad(),userId:e.userId})}catch{}try{localStorage.removeItem(Ia)}catch{}try{localStorage.removeItem(os)}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{}Ae=null,Or=null,Zn=null,is();let r=await IM(["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{Ta-=1,uh-=1}}function N0(t){return Ae?Yn(Ae,t,Fa()):Promise.reject(new Error("passkey: vault locked, cannot seal triage"))}function D0(t){return Ae?Xo(Ae,t,Fa()):Promise.reject(new Error("passkey: vault locked, cannot open triage"))}function Td(t,e){return Ae?Yn(Ae,t,Rd(e)):Promise.reject(new Error("passkey: vault locked, cannot seal OPFS file"))}function z0(t,e){return Ae?Xo(Ae,t,Rd(e)):Promise.reject(new Error("passkey: vault locked, cannot open OPFS file"))}function Id(t,e){return Ae?Yn(Ae,t,Md(e)):Promise.reject(new Error("passkey: vault locked, cannot seal bundle"))}function Ld(t,e){return Ae?Xo(Ae,t,Md(e)):Promise.reject(new Error("passkey: vault locked, cannot open bundle"))}var Ia,os,Ed,Rt,CM,EM,AM,Ae,Or,Zn,Ta,uh,ph,Ra=w(()=>{"use strict";ah();gt();gn();Ia="deepview.passkey.v1",os="deepview.passkey.userId",Ed="deepview.passkey.cleanDisable",Rt="deepview.passkey.v1.write",CM="deepview.triage.v1|",EM="deepview.opfs.v1|",AM="deepview.bundle.v1|",Ae=null,Or=null,Zn=null,Ta=0;uh=0;ph=new Set;typeof window<"u"&&window.addEventListener("storage",t=>{if(t.key!==Ia)return;let e=Jo();(!e&&Ae||e&&Ae&&e.credentialId!==Zn)&&(Ae=null,Or=null,Zn=null),is()})});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 Da(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){Pa(t)===e&&(console.warn(`storage: report "${t}" is an empty/corrupt on-disk entry \u2014 quarantining, will read as missing`),await navigator.locks.request(Rt,{mode:"exclusive"},async()=>{if(Pa(t)!==e)return;Ie(t),rr.delete(t);let r=await to();if(r)try{await r.removeEntry(t)}catch{}Pd(t),Ie(t),Zo(t,"delete")}))}async function $h(t,e,r){try{(await e.getFile()).size===0&&await t.removeEntry(r)}catch{}}async function ss(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(LM,{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 FM(){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 Pa(t){return gh.get(t)??0}function ei(t){return bh.add(t),()=>bh.delete(t)}function Zo(t,e){for(let r of bh)try{r(t,e)}catch(n){console.warn("storage file-change listener:",n)}}async function fe(){let t=new Set(FM()),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(Rt,{mode:"shared"},async()=>{let r=await to();if(r){let i=await ts(be(e));i=await ss(i,Td,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),Zo(t,"save");return}let n=be(e);n=await ts(n),n=await ss(n,Td,t,`"${t}"`,()=>Ie(t));let o=n.toBase64();try{localStorage.setItem(eo+t,o),rr.set(t,e),Ie(t),Zo(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=Pa(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 Pa(t)===e&&rr.set(t,n),n}finally{Qn.delete(t)}}async function ti(t){let e=Pa(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 za(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(Rt,{mode:"shared"},async()=>{let r=await ss(e,Td,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),Zo(t,"save");return}try{localStorage.setItem(eo+t,r.toBase64()),Ie(t),Zo(t,"save")}catch(o){throw Ie(t),new Error(`localStorage write failed for ${t}: ${o.message}`,{cause:o})}})}async function as(t){return Ie(t),rr.delete(t),Qn.delete(t),navigator.locks.request(Rt,{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),Zo(t,"delete");return}localStorage.removeItem(eo+t),Ie(t),Zo(t,"delete")})}function ri(){return wh(vh,{create:!0})}function Qo(t){return t.replaceAll("/","_")}async function _h(t){let e;try{let o=await(await t.getFileHandle(Na)).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=be(JSON.stringify(e));r=await ss(r,Id,yh,"bundle metadata");try{await t.removeEntry(Na)}catch{}let n=await t.getFileHandle(Na,{create:!0});await Da(n,r)}function Sh(t){return navigator.locks.request(BM,t)}async function Dt(){let t=await ri();return t?[...await _h(t)].toSorted((r,n)=>r.name.localeCompare(n.name)):[]}async function Ua(){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 ni(t,e){let r=await ri();if(!r)throw new Error(`Cannot save bundle ${t}: OPFS unavailable`);let n=e instanceof Uint8Array?e:be(e),o=await R0(n),i=Qo(o),s=t.toLowerCase().endsWith(".map")?await ts(n):n;return navigator.locks.request(Rt,{mode:"shared"},async()=>{s=await ss(s,Id,o,`bundle "${t}"`);try{await r.removeEntry(i)}catch{}let a=await r.getFileHandle(i,{create:!0});await Da(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 ri();if(e)return navigator.locks.request(Rt,{mode:"shared"},async()=>{try{await e.removeEntry(Qo(t))}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw r}await Sh(async()=>{try{await e.removeEntry(Qo(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 ri();if(!e)throw new Error("OPFS unavailable");let n=await(await e.getFileHandle(Qo(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 ri();if(!e||de()&&!et())return null;try{let r=await e.getFileHandle(Qo(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 Ah(t,e){let r=await ts(be(JSON.stringify(e)));return navigator.locks.request(Rt,{mode:"shared"},()=>Sh(async()=>{let n=await ri();if(!n)return;await n.getFileHandle(Qo(t));let o=t+Bd,i=await ss(r,Id,o,"bundle index"),s=await n.getFileHandle(Qo(o),{create:!0});await Da(s,i)}))}async function OM(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 Da(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 fe();for(let r of e)try{await OM(r,V0(t,Rd(r)))}catch(n){if(n instanceof DOMException&&n.name==="NotFoundError")continue;throw n}}async function PM(){let t=await ri();if(!t)return{dir:null,keys:[]};let e=[];for await(let[r]of t.entries())e.push(r);return{dir:t,keys:e}}function NM(t){return t===Na?yh:t.startsWith("sha512-")?t.replaceAll("_","/"):null}async function DM(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 Da(a,s)}async function K0(t){let{dir:e,keys:r}=await PM();if(e)for(let n of r){let o=NM(n);if(o!==null)try{await DM(e,n,V0(t,Md(o)))}catch(i){if(i instanceof DOMException&&i.name==="NotFoundError")continue;throw i}}}var yh,LM,vh,eo,U0,rr,Qn,gh,bh,Na,Bd,BM,Rh,Mh,Th,Ih,wr=w(()=>{"use strict";gt();rs();M0();Ra();yh="__meta__",LM="deepview-reports",vh="deepview-bundles",eo="deepview.report:",U0=!1;rr=new Map,Qn=new Map,gh=new Map;bh=new Set;Na="_meta.json",Bd=".index-v1";BM=`${vh}/${Na}`;Rh=({seal:t})=>W0({seal:t}),Mh=({open:t})=>W0({open:t});Th=({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 Ha(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 ja(){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"?Ha(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 UM(){try{let t=localStorage.getItem(zd);return t!==null&&zM.has(t)?t:null}catch{return null}}function HM(){try{let t=localStorage.getItem(Hd);return t==="true"?!0:t==="false"?!1:null}catch{return null}}function Ka(t){if(!Number.isFinite(t))return Wa;let e=Math.round(t*10)/10;return Math.min(Math.max(e,jd),Vd)}function jM(){try{let t=localStorage.getItem(Ud);if(t===null||t.trim()==="")return null;let e=Number(t);return Number.isFinite(e)?Ka(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(Va))}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(Va,JSON.stringify(r)).catch(n=>console.warn("saveRepoUrlFor:",n)),Sd(Va,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(Va,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(Va,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 oi(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,Va,Ud,Hd,zM,Wa,jd,Vd,Uh,X0,l,xr=w(()=>{"use strict";gd();gn();zh();J0="deepview.viewMode",zd="deepview.severityMode",Va="deepview.repoUrls",Ud="deepview.focusSplit",Hd="deepview.kanbanDetailFullscreen",zM=new Set(["corrected","original"]),Wa=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:UM()??"corrected",triage:new Map,shownTriage:null,nextFindingId:0,activeTabByGroup:new Map,tableSelectedGid:null,filesViewMode:"table",filesSearch:"",filesSelectedFile:null,kanbanPopoverGid:null,kanbanDetailFullscreen:HM()??!1,kanbanExpandedColumn:null,focusGid:null,focusCodeTick:0,focusCodeStack:[],focusCodeAt:0,focusSplit:jM()??Wa,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=VM.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=ls.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 si(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 Ya(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 WM(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 Xa(t){let e=WM(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=cs(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 cs(t){let e=String(t??""),r=KM(e,GM(e)),n=qM(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=YM(e,s+1,n);if(a!==null)return{label:e.slice(i+1,s),url:a,index:i}}}return null}function KM(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 GM(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 qM(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 YM(t,e,r){let n=XM(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 XM(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]==="\\"&&ZM.test(t[e+1]??"")}function Ja(t){return typeof t=="string"?t.replace(JM,"$1"):t}function nx(t){let e=/^\[(.+)\]$/u.exec(t.trim());return e?e[1].trim():t.trim()}function ai(t){let e=(t||"").trim();return/^[-–—]+$/u.test(e)?"":e}var VM,ls,Ga,qa,ii,Vh,JM,ZM,sr=w(()=>{"use strict";VM=/^( *)(```|~~~)/u,ls=/^( *)(?:[-*+]|\d{1,9}[.)]) +(?=\S)/u;Ga=/^## +(.*)$/gmu,qa=/^### +(.*)$/gmu,ii=/^#### +(.*)$/gmu,Vh=/^(.+):(\d+(?:-\d+)?)$/u;JM=/\\([!-/:-@[-`{-~])/gu,ZM=/[!-/:-@[-`{-~]/u});function eT(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 tT(t){if(t!==void 0)return ox.get(ix(t))??ox.get("medium")}function sx(t){let r=ir(t).trim().split(QM);if(r.length===1)return null;let n=[];for(let o=1;o<r.length;o+=2){let i=eT(r[o]);for(let s of r[o+1].split(/^### /mu).slice(1)){let a=nT(s,i);a&&n.push(a)}}return n.length===0?null:{type:"security",source:"deepsec",findings:n}}function nT(t,e){let{title:r,body:n}=Ya(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(`
|
|
12
12
|
`).filter(v=>!/^\s*- \*\*/u.test(v)).join(`
|
|
13
13
|
`).replaceAll("**","").trim(),p=[r,u].filter(Boolean).join(`
|
|
14
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:
|
|
16
|
-
`))if(
|
|
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(!
|
|
18
|
-
`);if(n<0)return{title:"",body:
|
|
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=tT(i.confidence);y!==void 0&&(g.confidence=y);let b=rT.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 QM,ix,ox,rT,ax=w(()=>{"use strict";sr();QM=/^## ([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]]);rT=new Map([["confirmed","confirmed"],["falsepositive","refuted"],["uncertain","unknown"]])});function Dr(t){return ds[t]??String(t??"")}var ds,ro,Za,ct,us=w(()=>{"use strict";ds={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"},Za={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 ps(t){let e=t?._correctedByReport;return e&&new Set(Object.values(e).map(n=>n?.severity)).size>1?e:null}function Fe(t){return oT.has(t?.revalidate)?t.revalidate:""}function vn(t,e=t?.source){return Object.hasOwn(ct,e)||Fe(t)==="revalidation"}function ci(t){return t&&t.replace(/^[^/]+\//u,"").replace(/^claude-/u,"").replaceAll("-"," ")}function Qa(t,e=!0){let r=e&&Fe(t)==="revalidation"?"revalidate":"";return[t?.type,r,ci(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 di(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)||di($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 fs(t){let e=Kh(t);if(!e)return $t(t?.description,t)||"";let{body:r}=no(t);return r?`${e}
|
|
19
19
|
|
|
20
|
-
${r}`:
|
|
20
|
+
${r}`:e}function sT(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 hs(t){let e=[];for(let r of sT(t||"")){if(!r.trim())continue;let n=iT.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
21
|
|
|
22
|
-
${r}`:
|
|
23
|
-
${t
|
|
24
|
-
`)}function
|
|
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 ui(t){let e=r=>typeof r=="string"?r:"";return`${e(t?.observation)}
|
|
23
|
+
${e(t?.text)}`.trim()}var Ne,Ee,li,oT,iT,ms=w(()=>{"use strict";sr();us();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"];li=["revalidation","refuted","unreachable","confirmed","partial","unknown"],oT=new Set(li);iT=/^\*\*([^*\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 pi(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 gs(t,e,r=`${e}s`){return`${t} ${t===1?e:r}`}function el(t){return t.filter(e=>typeof e=="string"&&e.trim()).map(e=>e.replace(/\s+$/u,"")).join(`
|
|
25
25
|
|
|
26
|
-
`)}
|
|
27
|
-
`),n=
|
|
28
|
-
${n}`}function
|
|
29
|
-
`).map(o=>{let i=n;return n+=o.length+1,
|
|
30
|
-
`)}function
|
|
26
|
+
`)}function bs(t){let e=lT(ir(t).trim());return e?cT(e):""}function lT(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 cT(t){return fx(t,e=>e.replace(aT,"$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
31
|
`).map(n=>n?r+n:"").join(`
|
|
32
|
-
`)}var
|
|
33
|
-
`),r=0,n=()=>{for(;r<
|
|
34
|
-
`)};let s=[];for(;r<
|
|
35
|
-
`).trim()),facts:i,rest:
|
|
36
|
-
`)}}function
|
|
37
|
-
`)){let i=
|
|
38
|
-
`).trim());return c&&(n.text=c),n}
|
|
32
|
+
`)}var cx,aT,tl=w(()=>{"use strict";sr();cx=/^ *(`{3,}|~{3,})/u,aT=/^( {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=cs(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 pT(t){let e=t.indexOf(".");return e>0?{exportName:t.slice(0,e),methodName:t.slice(e+1)}:{exportName:t}}function fi(t){let e=String(t??"").trim();return dT.get(e.toLowerCase())??e}function fT(t){let e={},r=t.trim(),n=/ · (`+)(.+?)\1$/u.exec(r);n&&(Object.assign(e,pT(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 mT(t){let e={},r=t.trim();r.endsWith(gx)&&(e.critical=!0,r=r.slice(0,-gx.length));let n=r.indexOf(hT);n!==-1&&(r=r.slice(0,n));let o=/^(.*?) — corrected (from|to) (.*)$/u.exec(r);return o?o[2]==="from"?(e.severity=fi(o[3]),e.correctedSeverity=fi(o[1])):(e.severity=fi(o[1]),e.correctedSeverity=fi(o[3])):e.severity=fi(r),e}function yT(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":bT.has(i)&&!n.exportsMode?n.exportsMode=i:gT.has(i)&&!n.effort?n.effort=i:o.push(i);return o.length>1?[n.type,n.model]=o:o.length===1&&(n[yT(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 vT(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 wT(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 kT(t){let e=t.trim().toLowerCase();return e==="the revalidation pass itself"?"revalidation":uT.has(e)?e:void 0}function wx(t,e,r){let n=xT.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=$T.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:ys(s.join(`
|
|
35
|
+
`).trim()),facts:i,rest:e.slice(r).join(`
|
|
36
|
+
`)}}function ys(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:_T.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=>ST(o))}function ST({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=ys(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=CT.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=di(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
39
|
|
|
40
|
-
`)}var
|
|
41
|
-
`),r=(
|
|
42
|
-
`),s=(i===-1?o:o.slice(0,i)).trim().toLowerCase(),a=(i===-1?"":o.slice(i+1)).trim();s&&(
|
|
40
|
+
`)}var dT,bx,uT,gx,hT,gT,bT,xT,$T,_T,_x,CT,Ex=w(()=>{"use strict";ms();us();sr();tl();dT=new Map(Object.entries(ds).map(([t,e])=>[e.toLowerCase(),t])),bx=new Map(Object.entries(ct).map(([t,e])=>[e.toLowerCase(),t])),uT=new Set(li);gx=" \xB7 flagged critical by the analyzer",hT=" (varies across reports \u2014 ";gT=new Set(["max","xhigh","high","medium","low","minimal"]),bT=new Set(["list","isolate"]);xT=new Map([["location",(t,e)=>Object.assign(t,fT(e))],["severity",(t,e)=>Object.assign(t,mT(e))],["confidence",(t,e)=>{let r=/^(\d+(?:\.\d+)?)\/10$/u.exec(e);r&&(t.confidence=Number(r[1]))}],["revalidation",(t,e)=>{let r=kT(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=vT(e)}],["package",(t,e)=>{t.package=wT(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}])]);$T=/^- \*\*([^*\n]+?):\*\* ?(.*)$/u;_T=/^(\d+)\. (.*)$/u;_x=new Map([["impact","impact"],["reproduction","reproduction"],["recommendation","recommendation"],["confidence reasoning","confidenceReason"],["revalidation verdict","revalidateVerdict"],["revalidation recommendation","revalidateRecommendation"]]),CT=[..._x.keys()]});function Rx(t){let e=ir(t).trim();if(!ET.test(e))return null;let{head:r,subs:n}=si(e,Ga),o=[];for(let{heading:i,body:s}of n){if(i.trim().toLowerCase()==="summary")continue;let a=TT(i);for(let c of yn(s,qa))o.push(LT(c,a))}return BT(IT(r),o)}function TT(t){let e=/^(.*?)\s*\(\d+\)\s*$/u.exec(t.trim());return fi(e?e[1]:t)}function IT(t){let e=new Map;for(let r of t.matchAll(RT)){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 LT({heading:t,body:e},r){let n=t.trim().replace(/^\d+\.\s+/u,""),o=si(e,ii).subs.filter(i=>AT.test(i.heading.trim()));return o.length===0?[Ax(e,4,n,r)]:o.map(i=>Ax(i.body,5,n,r))}function Ax(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=>!MT.has(k.label.toLowerCase())).map(k=>({label:k.label,body:ys(k.body)})),{paragraphs:y,fields:b}=Sx(g);u.description=Cx(h?f:"",ys(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=ys(x.body)),{finding:u,analyzer:p}}function FT(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 BT(t,e){let r=e.flat(),{source:n,run:o}=FT(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 ET,AT,RT,MT,Mx=w(()=>{"use strict";ms();sr();Ex();ET=/^<!--\s*DeepView findings export\b[^>]*-->/u,AT=/^Case \d+ of \d+(?:\s|$)/u,RT=/^- \*\*([^*\n]+?):\*\* ?(.*)$/gmu,MT=new Set(["evidence","severity correction","comment"])});function Tx(t){let e=PT(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 PT(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}=NT(n),s=DT(o),a=zT(i),{file:c,line:u,locationLink:p}=UT(s.location||""),f=(a.severity||"").toLowerCase();return{severity:OT.has(f)?f:"medium",description:HT(r,s),location:p,file:c||"unknown",line:u}}function NT(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 DT(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 zT(t){let e={};for(let r of t.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))e[r[1].trim().toLowerCase()]=r[2].trim();return e}function UT(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 HT(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"]}`),jT(r.join(`
|
|
43
43
|
|
|
44
|
-
`))}function
|
|
45
|
-
`))
|
|
46
|
-
`)
|
|
47
|
-
`)
|
|
48
|
-
|
|
44
|
+
`))}function jT(t){return t.replaceAll("**","")}var OT,Ix=w(()=>{"use strict";OT=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=WT(o);i&&n.push(i)}return n.length===0?null:{type:"security",source:"claude-security",findings:n}}function WT(t){let{title:e,body:r}=Ya(t);if(!e)return null;let{sectionsText:n,metaText:o}=KT(r),i=GT(n),s=qT(o),a=ZT(i.evidence||""),{file:c,line:u,locationLink:p}=Ox(i.location||a[0]?.ref||""),f=(s.severity||"").toLowerCase(),h=VT.has(f)?f:"medium",g=eI(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(QT)),i["reproduction steps"]&&(y.reproduction=YT(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=Tx(t);return b&&(y._idBasis=b),y}function KT(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 GT(t){let e={};for(let r of t.split(/^## /mu).slice(1)){let{title:n,body:o}=Ya(r),i=n.toLowerCase();i&&(e[i]=o.trim())}return e}function qT(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=cs(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=Ja(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 YT(t){let e=t.split(`
|
|
45
|
+
`),r=e.findIndex(a=>a.trim());if(r===-1||!ls.test(e[r])||e.some((a,c)=>c!==r&&ls.test(a)))return t;let n=e[r].replace(/^ */u,""),o=n.replace(ls,"");if(!o.trim())return t;let i=Lx(o)??Lx(n);if(i===null&&(ls.test(o)||JT.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(XT)];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 ZT(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=>cs(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 QT({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 eI(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(`
|
|
49
51
|
|
|
50
|
-
`)}function
|
|
51
|
-
`)){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=
|
|
52
|
+
`)}var VT,XT,JT,Fx,Px=w(()=>{"use strict";Ix();sr();VT=new Set(["critical","high","medium","low","high_bug","bug","informational"]);XT=/(?:^|[ \t])(\d{1,9})\)(?=[ \t]|$)/gu,JT=/^\d{1,9}\)(?=[ \t]|$)/u;Fx=/^[ \t]*(?:\d+[.)]|[-*+])\s+/u});function tI(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=tI(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 hi(t,e){if(!e.source)for(let r of Nx)t[r]==null&&e[r]!=null&&(t[r]=e[r])}function rl(t){return nI.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=rI.exec(r),o=(n?`${n[1]}/${n[2]}`:r).replace(/\.git$/u,"");return rl(o)?o:null}function mi(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,rI,nI,eu=w(()=>{"use strict";Nx=["type","model","think","effort","exportsMode"];rI=/^(?:https?:\/\/)?(?:www\.)?github\.com\/([^/?#]+)\/([^/?#]+?)(?:\.git)?(?:[/?#].*)?$/iu,nI=/^[\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 nl(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 ol(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]);rl(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:ol(t.id||""),title:ai(t.title),severity:ai(t.severity),pocStatus:ai(t["poc status"]||t.poc),status:ai(t.status),parent:ol(ai(t.parent||"")),location:ai(t.location)}}function iu(t,e=""){let r=oo(t.severity)||e||nl(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}
|
|
52
54
|
|
|
53
|
-
${u.rest}`:u.rest||
|
|
54
|
-
`).filter(
|
|
55
|
-
`).trim(),
|
|
56
|
-
${n}`:n)}return
|
|
55
|
+
${u.rest}`:u.rest||b||u.id}let h=r.get(p),y={file:"unknown",line:"?",severity:oo(h?.severity)||e||nl(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 Xa(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 iI(t){return oI.has(t)||t.startsWith("findings by severity")}function aI(t){return sI.test(t)}function Hx(t){let{id:e}=em(t);return!!(e&&nu(e))}function lI(t){let e=yn(t,qa);return(e.length>0?e:yn(t,ii)).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=pI(e),n=fI(r["summary of findings"]||""),o=zx(si(e,Ga).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||iI(p)?u(sm(f,h,n,a)):!aI(p)&&lI(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 cI(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(...uI(a,e,i,r,n));else{let u=dI(s,a,e,r,n);o.push(...u),i=u[0]?.id||i}}return o}function dI(t,e,r,n,o){let{head:i,subs:s}=si(e,ii),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 uI(t,e,r,n,o){let{head:i,subs:s}=si(t,ii);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,qa);if(o.length>0)return cI(o,r,n,e);let i=am(yn(t,ii),r,n,e,null);if(i.length>0)return i;let s=Xa(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||nl(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:mI(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?ol(v[1]):"");return U&&(k.parent=U),{id:i,finding:k}}function pI(t){let e=Object.create(null);for(let{heading:r,body:n}of yn(t,Ga)){let o=r.trim().toLowerCase();o&&(e[o]=o in e?`${e[o]}
|
|
58
|
+
${n}`:n)}return e}function fI(t){let e=new Map;for(let r of Xa(t)){let n=ou(r);n.id&&e.set(n.id,n)}return e}function mI(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||hI.has(i)||o.push(`**${r[i]||i}:** ${s}`);return o.filter(Boolean).join(`
|
|
57
59
|
|
|
58
|
-
`)}var
|
|
59
|
-
`||a==="\r"?(r.push(n),
|
|
60
|
-
`&&s++):n+=a}for((n!==""||r.length>0)&&(r.push(n),
|
|
60
|
+
`)}var oI,sI,hI,Wx=w(()=>{"use strict";sr();Xh();Ux();nm();oI=new Set(["technical findings detail","technical findings","detailed findings","findings detail","findings"]);sI=/^(?:summary of findings|deferred|methodolog|executive|conclusion|attack surface|coverage|discoveries|scope|table of contents|contents|appendix|recommendation|remediation)/u;hI=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 gI.encode(t)}var gI,Kx=w(()=>{"use strict";gI=new TextEncoder});function bI(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 yI(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=bI(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=vI(t);try{return await yI(e)}catch{return null}}function vI(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 kI(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 xI(t,e){return e.map(r=>{let n=Object.create(null);return t.forEach((o,i)=>{n[o]=r[i]??""}),n})}function il(t){let e=kI(t);if(e.length<2)throw new Error("Codex CSV: empty or missing header row");let[r,...n]=e;for(let s of wI)if(!r.includes(s))throw new Error(`Codex CSV: missing required column "${s}"`);let o=new Map;for(let s of xI(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($I)}})}return i}function $I(t){let e=t.relevant_paths.split(" | ").map(o=>o.trim()).find(Boolean)||"unknown",r=[t.title,t.description].filter(Boolean).join(`
|
|
61
63
|
|
|
62
|
-
`),n={id:
|
|
63
|
-
`)}function
|
|
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 wI,Gx=w(()=>{"use strict";wI=["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):rl(e)?pi(e,`https://github.com/${e}`):e}function Jx(t,e,r){return e?ct[e]??String(e):Qa(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 EI(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=ps(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 AI(t,e){let r=ut(t);if(!r)return"";let n=e.hooks.location(t),o=Be(n)?pi(nt(r),n):nt(r),i=wn(t);return i?`${o} \xB7 ${nt(i)}`:o}function RI(t){if(!t)return"";let e=[],r=ro[t.triage]??(t.ignored?ro.ignored:"");return r&&e.push(r),t.color&&e.push(`${Za[t.color]??t.color} mark`),t.flagged===!0&&e.push("Flagged"),e.join(" \xB7 ")}function MI(t){let e=_r(t);return e?ct[e]??e:""}function TI(t,e){let r=_r(t.commitHash);if(!r)return"";let n=e.hooks.commit(t);return Be(n)?pi(nt(r.slice(0,7)),n):nt(r)}function II(t,e,r){let n=[],o=(p,f)=>{f&&n.push(`- **${p}:** ${f}`)};o("Location",AI(t,e)),o("Severity",EI(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",MI(t.revalidateSource)),o("Triage",RI(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",TI(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 SI)o(p,_r(t[f]));for(let[p,f]of CI)o(p,nt(_r(t[f])));return o("ID",nt(_r(t.id))),n.join(`
|
|
65
|
+
`)}function su(t,e,r){let n=bs(r);return n?`${Ur(t,e)}
|
|
64
66
|
|
|
65
|
-
${n}`:
|
|
67
|
+
${n}`:Ur(t,e)}function LI(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)?pi(nt(s),a):nt(s):Be(a)&&(c=Xd(a));let u=bs(ui(n)),p=i+(c||"(no reference)");return u?`${p}
|
|
66
68
|
|
|
67
|
-
${
|
|
69
|
+
${mx(i,u)}`:p}).join(`
|
|
68
70
|
|
|
69
|
-
`)}function
|
|
71
|
+
`)}function FI(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&&di(o)!==i?`${i}
|
|
70
72
|
|
|
71
|
-
${o}`:o,u=
|
|
73
|
+
${o}`:o,u=hs(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=>bs(b.body)),y=LI(t,e);y&&g.push(`${Ur(r,"Evidence")}
|
|
72
74
|
|
|
73
|
-
${
|
|
74
|
-
`)}function
|
|
75
|
-
`}var
|
|
75
|
+
${y}`);for(let b of h)g.push(b.label===null?bs(b.body):su(r,b.label,b.body));return g}function Xx(t,e,r){let n=e.hooks.annotation(t),o=[II(t,e,n),...FI(t,e,r)];for(let[s,a,c]of _I){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 el([...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(`${gs(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(bs(f)),o.push(...Xx(c,e,n+2))}),el(o)}var qx,_I,SI,CI,Qx=w(()=>{"use strict";ms();us();tl();eu();sr();qx=120;_I=[["Impact","impact",!1],["Reproduction","reproduction",!1],["Recommendation","recommendation",!1],["Confidence reasoning","confidenceReason",!1],["Revalidation verdict","revalidateVerdict",!0],["Revalidation recommendation","revalidateRecommendation",!0]],SI=[["Status","status"],["Branch","branch"],["Date created","dateCreated"],["Detected at","detectedAt"],["Committed at","committedAt"],["PoC status","pocStatus"],["Variant of","parent"],["Slug","slug"],["Priority","priority"]],CI=[["Detailed report","reportPath"],["Commit audited","auditedCommit"]]});function PI(t){let e={};for(let[r,n]of Object.entries(OI))e[r]=typeof t?.[r]=="function"?t[r]:n;return e}function NI(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 DI(t,e,r){let n=t.view?.revalidation!==!1,o=(Array.isArray(t.reports)?t.reports:[]).filter(u=>u&&typeof u=="object"),i=NI(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 zI(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 UI(t){if(!t)return"";let e=Number(t.included)||0,r=Number(t.total)||0;return r===0?"no findings":e>=r?`all ${gs(r,"finding")}`:`${e} of ${gs(r,"finding")} (${r-e} filtered out)`}function HI(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",zI(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",UI(t.counts)),n.join(`
|
|
76
|
+
`)}function jI(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 VI(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 WI(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?` (${gs(o.group.length,"case")})`:"",a=ut(i),c=[String(o.number),Dr(o.severity),pi(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 KI(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=VI(t,e);return o&&r.push(o),r.push(WI(t)),r}function GI(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=PI(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=DI(t,r,o),s=jI(n,i),a=[BI,Ur(1,typeof t.title=="string"&&t.title.trim()?t.title.trim():"Findings"),HI(t,i,o),...KI(s,i),...GI(s,i)];return`${el(a)}
|
|
77
|
+
`}var BI,OI,t$=w(()=>{"use strict";ms();us();Qx();tl();BI="<!-- DeepView findings export -->",OI={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 qI){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 YI(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=YI(ar(e));return await mm(n),{format:r,data:e,findings:n}}var qI,Oe=w(()=>{"use strict";ax();Mx();Px();Wx();um();Gx();um();eu();t$();us();ms();sr();tl();qI=[["deepview-md",Rx],["deepsec",sx],["piolium",jx],["claude-security",Bx]]});function XI(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 JI(t){return typeof t?.file!="string"?!1:/(?:^|\/)(?:node_modules|dependencies)\//u.test(t.file)}function ZI(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 ll(t){return gi.get(t)?.list??[]}function wm(){let t=0;for(let e of gi.values())t+=e.list.length;return t}function jr(){return vs}function yi(){return ws}function cl(t,e){let r=gi.get(t);if(!r)return[];let n=r.reports.get(io(e));return n?[...n]:[]}function km(t,e){let r=vs.get(t);if(!r)return[];let n=r._keyReports.get(io(e));return n?[...n]:[]}function xm(t,e){let r=ws.get(t);if(!r)return[];let n=r._keyReports.get(io(e));return n?[...n]:[]}function vi(t){let e=bi.get(t);return e?[...e.reports.keys()]:[]}function $m(t){let e=bi.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 bi.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 QI(t,e,r){let n=bi.get(t.id);n||bi.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 eL(t,e,r){let n=gi.get(t.fileHash);n||(n={keys:new Set,list:[],reports:new Map},gi.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 tL(t,e,r){let n=XI(t);if(!n)return!1;let o=S0(t),i=vs.get(n);if(i||(i={...bd(),repos:new Set,byVersion:new Map,_repoReports:new Map},vs.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 rL(t,e,r,n){if(JI(t))return!1;let o=ZI(t,n);if(!o)return!1;let i=ws.get(o);i||(i=bd(),ws.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),al.delete(t),!e)return!1;let r=!1;for(let{hash:o,key:i}of e.hash){let s=gi.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&&gi.delete(o)}}let n=new Set;for(let{pkg:o,key:i,file:s,version:a}of e.pkg){let c=vs.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?vs.delete(o):wd(c)}}for(let{repo:o,key:i,file:s}of e.repo){let a=ws.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?ws.delete(o):wd(a))}for(let o of e.id){let i=bi.get(o);i&&(i.reports.delete(t)&&(r=!0),i.reports.size===0&&bi.delete(o))}return r}async function nL(t){if(al.has(t))return!1;al.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)hi(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&&eL(a,c,t)&&(s=!0),a.file&&tL(a,c,t)&&(s=!0),a.file&&rL(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)QI(f,t,p)&&(s=!0)}return al.has(t)?s:(Sm(t),bm=!0,!1)}catch{return al.delete(t),!1}}function lr(){return sl||(sl=(async()=>{try{do{bm=!1;let t=await fe();for(let e of t)await nL(e)&&vm()}while(bm)}finally{sl=null}})(),sl)}var gi,vs,ws,bi,lu,al,gm,sl,bm,n$=w(()=>{"use strict";nh();wr();xr();Oe();gi=new Map,vs=new Map,ws=new Map,bi=new Map,lu=new Map;al=new Set,gm=new Set,sl=null,bm=!1;ei(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 ul(t,e){if(!t||!e)return!1;let r=!ks.has(t);ks.set(t,e),du.delete(t);for(let[n,o]of e){if(!o)continue;let i=dl.get(o);i||(i=new Map,dl.set(o,i)),i.set(t,n)}return r&&o$(),r}function Am(t){let e=ks.get(t);if(ks.delete(t),du.delete(t),!!e){for(let r of e.values()){let n=dl.get(r);n&&(n.delete(t),n.size===0&&dl.delete(r))}o$()}}function pl(t,e){let r=ks.get(t);if(!r||typeof e!="string"||e==="")return null;if(r.has(e))return e;let n=oL(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 oL(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 wi(t){if(!t)return[];let e=dl.get(t);if(!e)return[];let r=[];for(let[n,o]of e)r.push({integrity:n,file:o});return r}function Rm(t){return ks.has(t)}var dl,ks,du,Cm,s$=w(()=>{"use strict";dl=new Map,ks=new Map,du=new Map,Cm=new Set});function sL(t){for(let e=0;e<t.length;e++){let r=t.codePointAt(e);if(r<32||r===127)return!0}return!1}function aL(t){return typeof t=="string"&&t.length>0&&t.length<=l$&&!sL(t)}function Sr(t){return aL(t)&&!iL.test(t)}function c$(t,e){return`${t}\0${e}`}function d$(t){return typeof t=="string"&&cL.test(t)}async function jt(t,e){let r=uL[t];if(!r||typeof e!="string"||!e)return null;let n=c$(t,e),o=Mm.get(n);if(o!==void 0)return o;let i;try{let s=await crypto.subtle.digest("SHA-256",be(r+e));i=new Uint8Array(s).slice(0,lL).toBase64({alphabet:"base64url",omitPadding:!0})}catch{return null}return Mm.set(n,i),i}function uu(t,e){return typeof e!="string"||!e?null:Mm.get(c$(t,e))??null}function pL(t,e){let r=[];for(let[n,o]of[["report",t],["workspace",e]]){if(o==null||o===""){r.push(fl);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===fl)?null:r[0]===fl?`w${r[1]}`:r.join("")}function fL(t){let e=[t.slice(0,a$),t.slice(a$)].map(r=>r===fl?null:r);return{report:e[0],workspace:e[1]}}function ki({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=pL(e,r);return o&&n.push(`v=${o}`),n.join("&")}function Tm(t){let e=ki(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===fl?null:u});continue}if(!dL.test(a))continue;Object.assign(n,fL(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:ki(r)}:null}var iL,l$,lL,a$,cL,dL,fl,uL,Mm,hl=w(()=>{"use strict";gt();iL=/^\d+$/u;l$=512;lL=3,a$=4,cL=/^[\w-]{4}$/u,dL=/^[\w-]{8}$/u,fl="AAAA",uL={report:`deepview/finding-link/report/v1
|
|
76
78
|
`,workspace:`deepview/finding-link/workspace/v1
|
|
77
|
-
`},
|
|
78
|
-
|
|
79
|
-
`))if(t.trim())return t.trim();return""}function vf(e){let t=new Set(e.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(!(!t.has(s)||r.has(s))&&(r.set(s,{severity:i.severity,file:i.file,line:i.line,description:yf(i.description)}),r.size===t.size))return r}return r}var li=new Map,kf=new Map,xc=new Map,wf=new Set,Gs=null,$c=!1;function xf(e){return wf.add(e),()=>wf.delete(e)}function Xv(){for(let e of wf)try{e()}catch(t){console.warn("linked-findings listener:",t)}}function Jv(){let e=new Map;for(let t of li.values())t&&zv(t.groups,e);kf=e}function qs(){return kf.size>0}function bo(e){let t=kf.get(e);return t?[...t]:[]}async function q2(e){if(li.has(e))return!1;let t=an(e);if(t===void 0)return!1;if(t!==St)return li.set(e,null),!1;let r=xc.get(e)??0,n;try{n=await Ae(e)}catch{return!1}if(n==null)return!1;if((xc.get(e)??0)!==r)return $c=!0,!1;let o=sn(n);return li.set(e,o),o!==null}function $f(){return Gs||(Gs=(async()=>{try{do{$c=!1;let e=!1;for(let t of await fe())await q2(t)&&(e=!0);e&&(Jv(),Xv())}while($c)}finally{Gs=null}})(),Gs)}Gn(e=>{xc.set(e,(xc.get(e)??0)+1),$c=!0;let t=li.get(e)!=null;li.delete(e),t&&(Jv(),Xv())});function Zv(e){return e==="inprogress"||e==="fixed"||e==="invalid"||e==="deleted"?e:void 0}function Re(e){if(e)return Zv(e.triage)??(e.deleted?"deleted":void 0)}function Y2(e){return e?!e.color&&!Re(e)&&!e.comment&&!e.fix&&!(e.ignoredReports&&e.ignoredReports.length>0)&&e.flagged===void 0:!0}function Fr(e,t,r){let n=e.get(t)?.ignoredReports;return Array.isArray(n)&&n.includes(r)}function Ys(e){if(!e||typeof e!="object")return;let t=e,r={};typeof t.color=="string"&&t.color&&(r.color=t.color);let n=Zv(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 Y2(r)?void 0:r}function X2(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 J2(e,t){let r=e??{},n=t??{};return(r.color??"")===(n.color??"")&&(Re(r)??"")===(Re(n)??"")&&(r.comment??"")===(n.comment??"")&&(r.fix??"")===(n.fix??"")&&r.flagged===n.flagged&&X2(r.ignoredReports,n.ignoredReports)}function U(e,t,r){let n=e.get(t),o=Ys({...n,...r});return o===void 0?e.delete(t):J2(n,o)?!1:(e.set(t,o),!0)}function Xe(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 Sf=()=>{};function ew(e){Sf=typeof e=="function"?e:()=>{}}var tw=()=>{};function _f(e){tw=typeof e=="function"?e:()=>{}}var ln="deepview.triage",Mr="deepview.triage.pending",dr=/^\d+$/u;async function Z2(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("deflate"));return new Uint8Array(await new Response(t).arrayBuffer())}async function Q2(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream("deflate"));return new Uint8Array(await new Response(t).arrayBuffer())}var eA="deepview.triage.save",Qv=0;function Cf(){let e={};for(let[t,r]of l.triage){if(dr.test(t))continue;let n=Ys(r);n&&(e[t]=n)}return e}function be(){let e=++Qv,t=Cf(),r=Object.keys(t).length===0,n=r?null:JSON.stringify(t);if(n!=null)try{localStorage.setItem(Mr,n)}catch{}return navigator.locks.request(ft,{mode:"shared"},async()=>{let o=null,i=null;if(n!=null)try{let s=ae(n),a=await Z2(s);i=Ue(),o=(i?await Cy(a):a).toBase64()}catch(s){console.warn("Failed to save triage:",s),Sf();return}await navigator.locks.request(eA,()=>{try{if(e!==Qv)return;if(n!=null&&Ue()!==i){queueMicrotask(()=>{be()});return}if(r)localStorage.removeItem(ln),localStorage.removeItem(Mr);else{localStorage.setItem(ln,o);try{localStorage.removeItem(Mr)}catch{}}}catch(s){console.warn("Failed to save triage:",s)}}),Sf()})}async function rw(){let e=localStorage.getItem(Mr);if(e)try{return JSON.parse(e)}catch{}let t=localStorage.getItem(ln);if(!t)return null;let r=Uint8Array.fromBase64(t);if(it(r)){if(!Ue())throw new Error("triage: vault locked, cannot decrypt envelope");r=await Ey(r)}let n=await Q2(r);return JSON.parse(Le(n))}function nw(e,{replace:t=!1}={}){let r=l.triage;if(t){let n=null,o=localStorage.getItem(Mr);if(o)try{n=JSON.parse(o)}catch{}let i=s=>n!=null&&s in n;for(let s of[...r.keys()]){if(dr.test(s))continue;let a=e?.[s],c=!e||!(s in e);!(i(s)&&n[s]?.color)&&(c||!a?.color)&&U(r,s,{color:void 0}),!(i(s)&&(n[s]?.triage||n[s]?.deleted))&&!Re(a)&&U(r,s,{triage:void 0}),!(i(s)&&n[s]?.comment)&&(c||typeof a?.comment!="string"||!a.comment)&&U(r,s,{comment:void 0}),!(i(s)&&n[s]?.fix)&&(c||typeof a?.fix!="string"||!a.fix)&&U(r,s,{fix:void 0}),!(i(s)&&n[s]?.flagged!==void 0)&&(c||a?.flagged===void 0)&&U(r,s,{flagged:void 0})}for(let s of[...r.keys()]){if(dr.test(s))continue;let a=r.get(s)?.ignoredReports;if(!a||a.length===0)continue;let c=e?.[s],u=!!Re(c);for(let p of[...a]){if(i(s)&&Array.isArray(n[s]?.ignoredReports)&&n[s].ignoredReports.includes(p))continue;if(u){Xe(r,s,p,!1);continue}let f=c?.ignoredReports;(!Array.isArray(f)||!f.includes(p))&&Xe(r,s,p,!1)}}}if(e)for(let[n,o]of Object.entries(e)){let i=Re(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 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&&U(r,n,{ignoredReports:[...a]})}}}async function tA(){try{let e=await rw();nw(e)}catch(e){console.warn("Failed to load triage:",e)}}async function ow(){try{let e=await rw();nw(e,{replace:!0}),tw()}catch(e){console.warn("Failed to reload triage:",e)}}typeof window<"u"&&window.addEventListener("storage",e=>{e.key!==ln&&e.key!==Mr||ow()});var yo=tA();He(()=>{ow()});He(()=>{Ue()&&localStorage.getItem(Mr)&&be()});async function Ef({seal:e}){try{localStorage.removeItem(Mr)}catch{}let t=localStorage.getItem(ln);if(!t)return;let r=Uint8Array.fromBase64(t);if(it(r))return;let n=await e(r,as());localStorage.setItem(ln,n.toBase64())}async function Af({open:e}){try{localStorage.removeItem(Mr)}catch{}let t=localStorage.getItem(ln);if(!t)return;let r=Uint8Array.fromBase64(t);if(!it(r))return;let n=await e(r,as());localStorage.setItem(ln,n.toBase64())}function Sc(e,t){return t?`r:${JSON.stringify({name:e,workspaceId:t})}`:e}function _c(e){if(typeof e!="string"||!e)return null;if(e.startsWith("r:"))try{let t=JSON.parse(e.slice(2));if(t&&typeof t.name=="string"&&t.name&&typeof t.workspaceId=="string"&&t.workspaceId)return{name:t.name,workspaceId:t.workspaceId}}catch{}return{name:e,workspaceId:null}}var iw="deepview.lastFile",Xs=null;function Rf(){return Xs||(Xs=rA(),Xs.catch(()=>{Xs=null})),Xs}async function rA(){try{await yo}catch{}let e=await fe(),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 Ae(o),await Ft(i,s),await Go(o)}catch(f){console.warn(`migrate: failed to rename ${o} -> ${i}`,f);continue}t.delete(o),t.add(i),n.add(o);let a=Ps(o);if(si(o),a===void 0){let{count:f,source:h}=lt(s);ht(i,f,h)}else{let{source:f}=lt(s);ht(i,a,f)}let c=wt(o);c&&(Yt(o,""),Yt(i,c));let u=!1;for(let[f,h]of[...l.triage])h.ignoredReports?.includes(o)&&(Xe(l.triage,f,o,!1),Xe(l.triage,f,i,!0),u=!0);u&&await be();let p=_c(ze(iw));if(p?.name===o)try{await Ge(iw,Sc(i,p.workspaceId))}catch{}}for(let o of G())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 Vs(i,o.id),await Lr(s,o.id)}}function sw(){return typeof navigator<"u"&&typeof navigator.storage=="object"&&navigator.storage!==null}async function ci(){if(!sw()||typeof navigator.storage.persist!="function")return!1;try{return await navigator.storage.persist()===!0}catch{return!1}}async function Tf(){let e={supported:sw(),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 If=1;function nA(){let e=Cf(),t=Jl();return{version:If,exportedAt:new Date().toISOString(),triage:e,repoUrls:t}}function oA(){return`deepview-triage-${new Date().toISOString().replaceAll(/[:.]/gu,"-").slice(0,19)}.json.gz`}async function Lf(){let e=nA();return{blob:new Blob([await es(JSON.stringify(e))]),filename:oA()}}async function Ff(e){let t;try{t=await Hn(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!==If)throw new Error(`Unsupported backup version: ${r.version} (expected ${If})`);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 Mf(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=l.triage;if(t==="replace")for(let a of[...n.keys()])dr.test(a)||n.delete(a);let o=t==="prefer-current";for(let[a,c]of Object.entries(r)){if(dr.test(a)||!c||typeof c!="object")continue;typeof c.color=="string"&&c.color&&(!o||!n.get(a)?.color)&&U(n,a,{color:c.color});let u=Re(c);if(u&&(!o||!Re(n.get(a)))&&U(n,a,{triage:u}),typeof c.comment=="string"&&c.comment&&(!o||!n.get(a)?.comment)&&U(n,a,{comment:c.comment}),typeof c.fix=="string"&&c.fix&&(!o||!n.get(a)?.fix)&&U(n,a,{fix:c.fix}),typeof c.flagged=="boolean"&&(!o||n.get(a)?.flagged===void 0)&&U(n,a,{flagged:c.flagged}),Array.isArray(c.ignoredReports)&&!Re(n.get(a)))for(let p of c.ignoredReports)typeof p=="string"&&(o&&Fr(n,a,p)||Xe(n,a,p,!0))}await be();let i=0,s=null;try{await zy(e.repoUrls,t),i=Object.keys(e.repoUrls).length}catch(a){console.warn("applyTriageImport: repo-URL import failed:",a),s=a}return{triageEntries:Object.keys(r).length,repoUrls:i,repoUrlError:s}}function iA(e){return e?.name==="NotFoundError"||typeof e?.message=="string"&&e.message.startsWith("File not found:")}async function Bf(e){let t=new Set;for(let r of e){let n;try{n=await Ae(r)}catch(i){if(iA(i))continue;throw new Error(`Failed to read ${r}: ${i.message}`,{cause:i})}if(n==null)continue;let o=await Bt(n);if(o)for(let i of o.findings)i.id&&t.add(i.id)}return t}function sA(){let e=new Set;for(let t of l.triage.keys())dr.test(t)||e.add(t);return e}async function Cc(e){let t=sA();if(t.size===0)return{orphanedCount:0,sharedCount:0};let r=await Bf(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 fe(),i=new Set(e),s=o.filter(p=>!i.has(p)),a=await Bf(s),c=0,u=0;for(let p of n)a.has(p)?u++:c++;return{orphanedCount:c,sharedCount:u}}async function Ec(){let e=new Set(l.triage.keys()),t=[];for(let[s,a]of l.triage)if(a.ignoredReports)for(let c of a.ignoredReports)t.push({id:s,report:c});let r=await fe(),n=new Set(r),o=await Bf(r),i=!1;for(let s of e){if(dr.test(s)||o.has(s))continue;let a=l.triage.get(s);!a||!(a.color||Re(a)||a.comment||a.fix||a.flagged!==void 0)||U(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 t)dr.test(s)||o.has(s)&&n.has(a)||Fr(l.triage,s,a)&&Xe(l.triage,s,a,!1)&&(i=!0);i&&await be()}var Of=1,dn=16,aw=12,lw=1+dn+aw+16,cn=1+dn+aw;async function cw(e,t){let r=await crypto.subtle.importKey("raw",ae(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 dw(e){return!(e instanceof Uint8Array)||e.length<lw?!1:e[0]===Of}async function Ac(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(cn+e.length+16);r[0]=Of,crypto.getRandomValues(r.subarray(1,1+dn)),crypto.getRandomValues(r.subarray(1+dn,cn));let n=r.subarray(1,1+dn),o=r.subarray(1+dn,cn),i=await cw(t,n),s=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:o,additionalData:r.subarray(0,cn)},i,e));return r.set(s,cn),r}async function lA(e,t){if(typeof t!="string"||!t)throw new TypeError("tryDecryptWithPassword: password required");if(!(e instanceof Uint8Array)||e.length<lw)return{ok:!1,reason:"malformed"};if(e[0]!==Of)return{ok:!1,reason:"malformed"};let r=e.subarray(1,1+dn),n=e.subarray(1+dn,cn),o=e.subarray(cn),i=await cw(t,r),s;try{s=new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:e.subarray(0,cn)},i,o))}catch{return{ok:!1,reason:"wrong-password"}}return{ok:!0,plaintext:s}}async function Rc(e,t,r){if(!r||typeof r.malformedMsg!="string"||typeof r.wrongPasswordMsg!="string")throw new TypeError("decryptWithPasswordOrThrow: { malformedMsg, wrongPasswordMsg } strings required");let n=await lA(e,t);if(n.ok)return n.plaintext;throw n.reason==="wrong-password"?new Error(r.wrongPasswordMsg):new Error(r.malformedMsg)}var Js=dw,uw=Ac;function pw(e,t){return Rc(e,t,{malformedMsg:"malformed encrypted bundle",wrongPasswordMsg:"wrong password or corrupt bundle"})}var cA=1;async function dA(e){let t=new Set,r=await Bt(e);for(let n of r?.findings??[])n.id&&t.add(n.id);return t}function Df(e){return(e??"").replaceAll(/[^a-zA-Z0-9._-]+/gu,"_").replaceAll(/^_+|_+$/gu,"")||"workspace"}async function uA(e){if(!Array.isArray(e)||e.length===0)return[];let t=await qt(),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 Cr(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 pA(e){let t=wt(e);return t?{github:t}:null}async function fw(e){let t=[];for(let r of e.reports??[]){let n;try{n=await Ae(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 Ws(r,null);continue}let o=pA(r);t.push(o?{name:r,content:n,repo:o}:{name:r,content:n})}return t}async function fA(e,{includeBundleBytes:t=!1}={}){let r=await fw(e),n=new Set;for(let u of r)for(let p of await dA(u.content))n.add(p);let o=new Set(e.reports??[]),i={};for(let[u,p]of l.triage){if(!n.has(u))continue;let f=(p.ignoredReports??[]).filter(g=>o.has(g)),h=Ys({...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=(e.bundles??[]).filter(u=>typeof u=="string"&&u.length>0),c={version:cA,exportedAt:new Date().toISOString(),workspace:{id:e.id,name:e.name,privateKey:e.privateKey,createdAt:e.createdAt},reports:r,bundles:a,repoUrls:s,triage:i};if(t){let u=await uA(a);u.length>0&&(c.bundleBlobs=u)}return c}async function hw(e,{includeBundleBytes:t=!1}={}){let r=await fA(e,{includeBundleBytes:t});return{blob:new Blob([await es(JSON.stringify(r))]),filename:`${Df(e.name)}.deepview-workspace.json.gz`}}async function hA(e,t,{includeBundleBytes:r=!1}={}){if(typeof t!="string"||!t)throw new TypeError("buildWorkspaceExportEncrypted: password required");let{blob:n}=await hw(e,{includeBundleBytes:r}),o=new Uint8Array(await n.arrayBuffer()),i=await uw(o,t);return{blob:new Blob([i],{type:"application/octet-stream"}),filename:`${Df(e.name)}.deepview-workspace.enc`}}async function Nf(e,{password:t,includeBundleBytes:r=!1}={}){return typeof t=="string"&&t?await hA(e,t,{includeBundleBytes:r}):await hw(e,{includeBundleBytes:r})}async function mA(e){return{reports:await fw(e)}}async function Pf(e){let t=await mA(e);return{blob:new Blob([await es(JSON.stringify(t))]),filename:`${Df(e.name)}.deepview-reports.json.gz`}}var gA=1,mw=1024,Zs=1024,Tc=200,yw=100*1024*1024,bA=Math.ceil(yw*4/3)+16,gw=512,bw=64;function yA(e){if(!e||typeof e!="object")return"payload is not an object";if(e.version!==gA)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>Zs)return`reports count (${e.reports.length}) exceeds cap (${Zs})`;if(e.bundles!==void 0){if(!Array.isArray(e.bundles))return"bundles field must be an array when present";if(e.bundles.length>mw)return`bundles count (${e.bundles.length}) exceeds cap (${mw})`;for(let t of e.bundles){if(typeof t!="string")return"bundles entries must be strings";if(t.length>Tc)return`bundle integrity exceeds per-entry length cap (${Tc})`}}if(e.bundleBlobs!==void 0){if(!Array.isArray(e.bundleBlobs))return"bundleBlobs field must be an array when present";if(e.bundleBlobs.length>bw)return`bundleBlobs count (${e.bundleBlobs.length}) exceeds cap (${bw})`;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>Tc)return`bundleBlobs.integrity exceeds per-entry length cap (${Tc})`;if(typeof t.name!="string"||t.name.length===0)return"bundleBlobs.name must be a non-empty string";if(t.name.length>gw)return`bundleBlobs.name exceeds per-entry length cap (${gw})`;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>bA)return`bundleBlobs.data exceeds per-blob size cap (${yw} bytes raw)`}}return null}async function zf(e){return new Uint8Array(await e.arrayBuffer())}async function Uf(e,t){if(Js(e)){if(typeof t!="string"||!t)throw new TypeError("parseWorkspaceBundleBytes: password required for encrypted bundle");let n=await pw(e,t);try{return Qs(await Hn(n))}catch(o){throw new Error("wrong password or corrupt bundle",{cause:o})}}let r;try{r=await Hn(e)}catch(n){throw new Error(`gzip decompression failed: ${n.message}`,{cause:n})}return Qs(r)}function Qs(e){let t;try{t=JSON.parse(e)}catch(o){throw new Error(`payload is not JSON: ${o.message}`,{cause:o})}let r=yA(t);if(r===null)return t;let n=r.includes("exceeds cap");throw new Error(n?r:`not a deepview workspace export: ${r}`)}function vA(e){return Re(e)??null}async function wA(e){let t=new Map;for(let r of e??[]){if(typeof r?.content!="string")continue;let n=await Bt(r.content);if(n)for(let o of n.findings)!o.id||t.has(o.id)||t.set(o.id,{severity:o.severity,file:o.file,line:o.line,description:yf(o.description)})}return t}async function kA(e,t,r){if(!e||typeof e!="object"||Array.isArray(e))return;let n=l.triage,o=[];for(let[i,s]of Object.entries(e)){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&&U(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&&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 g=vA(s),b=Re(n.get(i))??null;g&&b&&b!==g?o.push({id:i,property:"triage",local:b,imported:g}):g&&!b&&U(n,i,{triage:g,ignoredReports:void 0});let y=n.get(i)?.flagged,v=typeof s.flagged=="boolean"?s.flagged:void 0;v!==void 0&&y!==void 0&&y!==v?o.push({id:i,property:"flagged",local:y?"flagged":"not flagged",imported:v?"flagged":"not flagged"}):v!==void 0&&v!==y&&U(n,i,{flagged:v});let k=Array.isArray(s.ignoredReports)?s.ignoredReports:[];if(!Re(n.get(i)))for(let w of k)typeof w=="string"&&Xe(n,i,w,!0)}if(o.length>0&&t){let i=await t(o,r??new Map);i&&xA(o,i)}await be()}function xA(e,t){for(let r of e){let n=`${r.id}:${r.property}`;t[n]==="imported"&&$A(r.id,r.property)===r.local&&(r.property==="color"?U(l.triage,r.id,{color:r.imported}):r.property==="comment"?U(l.triage,r.id,{comment:r.imported}):r.property==="fix"?U(l.triage,r.id,{fix:r.imported}):r.property==="triage"?U(l.triage,r.id,{triage:r.imported,ignoredReports:void 0}):r.property==="flagged"&&U(l.triage,r.id,{flagged:r.imported==="flagged"?!0:r.imported==="not flagged"?!1:void 0}))}}function $A(e,t){if(t==="color")return l.triage.get(e)?.color;if(t==="triage")return Re(l.triage.get(e))??null;if(t==="comment")return l.triage.get(e)?.comment??"";if(t==="fix")return l.triage.get(e)?.fix??"";if(t==="flagged"){let r=l.triage.get(e)?.flagged;return r===!0?"flagged":r===!1?"not flagged":""}}async function SA(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 Xn(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 Hf(e,{conflictResolver:t}={}){let r=[];for(let p of e.reports)if(!(typeof p?.name!="string"||typeof p?.content!="string"))try{await Ft(p.name,p.content);let{count:f,source:h}=lt(p.content);ht(p.name,f,h??an(p.name)),r.push(p.name)}catch(f){console.warn(`Workspace import: failed to save ${p.name}: ${f.message}`)}Array.isArray(e.bundleBlobs)&&e.bundleBlobs.length>0&&await SA(e.bundleBlobs);let o=e.triage&&Object.keys(e.triage).length>0?await wA(e.reports):new Map;await kA(e.triage,t,o);let i=Array.isArray(e.bundles),s=i?e.bundles.filter(p=>typeof p=="string"&&p.length>0):[],a=await qv({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}),c=new Set(r),u=Object.create(null);if(e.repoUrls&&typeof e.repoUrls=="object")for(let[p,f]of Object.entries(e.repoUrls))!c.has(p)||typeof f!="string"||!f||(u[p]=f);if(Object.keys(u).length>0)try{await Zl(u)}catch(p){console.warn("Workspace import: failed to adopt per-report repository URLs:",p)}return a}function _A(e){return!e||typeof e!="object"||Array.isArray(e)?"payload is not an object":e.version!==void 0||e.workspace!==void 0?"payload claims to be a workspace export":Array.isArray(e.reports)?e.reports.length>Zs?`reports count (${e.reports.length}) exceeds cap (${Zs})`:null:"reports field must be an array"}function vw(e){return _A(e)===null}async function jf(e){if(Js(e))return{kind:"encrypted"};let t;try{t=await Hn(e)}catch(n){throw new Error(`gzip decompression failed: ${n.message}`,{cause:n})}let r;try{r=JSON.parse(t)}catch{return{kind:"workspace",text:t}}return vw(r)?{kind:"reports",reports:r.reports}:{kind:"workspace",text:t}}async function Wf({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 zs(r)===e?{v:1,n:t,k:r}:{v:1,i:e,n:t,k:r};return(await Ac(ae(JSON.stringify(i)),n)).toBase64({alphabet:"base64url",omitPadding:!0})}async function Vf({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 Rc(r,t,{malformedMsg:"malformed share link",wrongPasswordMsg:"wrong password or corrupt link"});try{return await CA(n)}catch(o){throw new Error("wrong password or corrupt link",{cause:o})}}async function CA(e){let t=JSON.parse(Le(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 zs(t.k),name:t.n,privateKeyBase64:t.k}}function Kf(e){return typeof location>"u"?`#share=${e}`:`${location.origin}${location.pathname}#share=${e}`}function Gf(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 EA={get state(){return l},listWorkspaces:G,addReportToWorkspace:Lr,addBundleToWorkspace:go,onReportMembershipChanged:Zp,onBundleMembershipChanged:Qp,onWorkspaceDeleted:Xp,onWorkspacePrivateKeyChanged:Jp,analyzeContent:lt,setCount:ht,gunzipBytes:Vt,listBundles:qt,listFiles:fe,readBundle:Cr,readFileBytes:qn,saveBundle:Xn,saveFileBytes:fs,saveTriage:be,getSecureItem:ze,setSecureItem:Ge,removeSecureItem:jo,onSecureStorageHydrated:Ho};function ww(e){e.installSyncHost(EA),ew(()=>e.triageSync.notify())}var Y=null,ea=null;function Sw(){try{return ze("deepview.sync.userEnabled")!=="0"}catch{return!0}}var _w=!1;function Cw(e){_w=!!e}function qf(){if(_w)return!0;try{return Er()?.mode==="managed"}catch{return!1}}function Lc(){return ea||(qf()&&!Y?Promise.resolve(null):(ea=(async()=>{let e="./client-sync.js";try{let t=await import(e);return ww(t),Y=t,AA(),t}catch(t){throw ea=null,t}})(),ea))}var Ew=[];function ta(e){Y?e(Y):Ew.push(e)}function AA(){let e=Ew.splice(0);for(let t of e)try{t(Y)}catch(r){console.warn("client-sync: deferred apply failed:",r)}}function vo(e,t){let r={cancelled:!1,unsub:null};return ta(n=>{r.cancelled||(r.unsub=t(n,e))}),()=>{r.cancelled=!0,r.unsub&&r.unsub()}}function Yf(e,t){return Y?Y.isInRemote(e,t):!1}function Aw(e,t){return Y?Y.isBundleInRemote(e,t):!1}var RA="deepview.objstore-presence.";function Rw(e){try{let t=localStorage.getItem(RA+e);if(!t)return null;let r=JSON.parse(t);return r&&typeof r=="object"?r:null}catch{return null}}function di(e,t){if(Y&&Y.isInRemote(e,t))return!0;let r=Rw(e);return!r||typeof r.names!="object"?!1:Object.values(r.names).includes(t)}function Xf(e,t){if(Y&&Y.isBundleInRemote(e,t))return!0;let r=Rw(e);return!r||typeof r.bundles!="object"?!1:Object.values(r.bundles).includes(t)}function Tw(e){return Y?Y.remoteCount(e):0}function Iw(e){return vo(e,(t,r)=>t.onAutoDownloaded(r))}function Lw(e){return vo(e,(t,r)=>t.onBundleAutoDownloaded(r))}function Fw(e){return vo(e,(t,r)=>t.onChange(r))}var kw=null,xw=null,$w=null,Ic=[];function Mw(e){if(Y){Y.setRedraw(e);return}kw=e,ta(t=>{kw===e&&t.setRedraw(e)})}function Bw(e){if(Y){Y.setAuthenticationResolver(e);return}xw=e,ta(t=>{xw===e&&t.setAuthenticationResolver(e)})}function Ow(e){if(Y){Y.setHydrationConflictResolver(e);return}$w=e,ta(t=>{$w===e&&t.setHydrationConflictResolver(e)})}async function Or(e,t){if(!qf()&&!(!Sw()&&!Y))return(await Lc())[e](...t)}function Dw(...e){return Or("fetchFile",e)}function Nw(...e){return Or("fetchBundleFromRemote",e)}function Fc(...e){return Or("putFile",e)}function Pw(...e){return Or("putBundleToRemote",e)}function Mc(...e){return Or("deleteFromRemote",e)}function Bc(...e){return Or("deleteBundleFromRemote",e)}function ra(...e){return Or("openWorkspace",e)}function Jf(...e){return Or("closeWorkspace",e)}function zw(...e){return Or("recheckRemoteStorage",e)}function Br(e,t){if(Y)return Y.triageSync[e](...t);ta(r=>{r.triageSync[e](...t)})}var j={get status(){return Y?Y.triageSync.status:"off"},get openSessions(){return Y?Y.triageSync.openSessions:[]},get persistenceDegraded(){return Y?Y.triageSync.persistenceDegraded:!1},get proxyAuthRequired(){return Y?Y.triageSync.proxyAuthRequired:!1},setEnabled(e){if(e===!0)return qf()?Promise.resolve(null):Lc().then(t=>{t.triageSync.setEnabled(!0);let r=Ic;Ic=[];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(Y){Ic=Y.openWorkspaceIds();for(let t of Ic)try{Y.closeWorkspace(t)}catch(r){console.warn(`client-sync: closeWorkspace(${t}) failed during disable:`,r)}Y.triageSync.setEnabled(!1);return}Br("setEnabled",[e])},isEnabled(){return Y?Y.triageSync.isEnabled():Sw()},openSession(e){Br("openSession",[e])},closeSession(e){Br("closeSession",[e])},refreshSession(e){Br("refreshSession",[e])},dismissError(e){Br("dismissError",[e])},setForcedOff(e){Br("setForcedOff",[e])},setProtocolLocked(e){Br("setProtocolLocked",[e])},setServerUrl(e){Br("setServerUrl",[e])},getServerUrl(){return Y?Y.triageSync.getServerUrl():null},notify(){Br("notify",[])},onStatusChange(e){return vo(e,(t,r)=>t.triageSync.onStatusChange(r))},onServerInfo(e){return vo(e,(t,r)=>t.triageSync.onServerInfo(r))},onPersistenceDegraded(e){return vo(e,(t,r)=>t.triageSync.onPersistenceDegraded(r))},onProxyAuthRequired(e){return vo(e,(t,r)=>t.triageSync.onProxyAuthRequired(r))}};var na=class extends Tt{constructor(t){if(super(t),this.it=m,t.type!==ot.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===m||t==null)return this._t=void 0,this.it=t;if(t===Ie)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:[]}}};na.directiveName="unsafeHTML",na.resultType=1;var re=tr(na);var oa=null;function ia(){return oa||(oa=(async()=>{let e="./client-managed.js";try{return await import(e)}catch(t){throw oa=null,t}})(),oa)}async function Uw(){return(await ia()).probeSession()}async function Hw(){return(await ia()).probeTeams()}async function jw(e){return(await ia()).fetchReport(e)}async function Ww(e){return(await ia()).login(e)}async function Vw(e){return(await ia()).logout(e)}var sa=null;function Kw(){return sa||(sa=(async()=>{let e="./client-admin.js";try{return await import(e)}catch(t){throw sa=null,t}})(),sa)}var Gw=`*,*: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(.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{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(--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-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-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}.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 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}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
To complete cleanup, remove the DeepView passkey from your password manager / OS settings:
|
|
90
|
-
\u2022 macOS / iOS: Settings \u2192 Passwords
|
|
91
|
-
\u2022 Windows: Settings \u2192 Accounts \u2192 Sign-in options \u2192 Passkeys
|
|
92
|
-
\u2022 Chrome: chrome://settings/passkeys
|
|
93
|
-
\u2022 Hardware security key: use the vendor's management tool`)}catch(e){alert(`Could not disable encryption: ${e?.message??e}`)}}function ok(){th()}function ik(e){if(!e||e===Ve)return;Ve=e;let t=!1;Ve.addEventListener("click",async()=>{if(!t){t=!0;try{if(!le()){await Oc();return}if(!Gt()){await Dc();return}await PA()}finally{t=!1}}}),He(th),th()}var sk=`.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}
|
|
94
|
-
`;function nh(){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 rh=class extends I{static styles=[...I.styles,C(sk)];static properties={_retryDenied:{state:!0}};constructor(){super(),this._retryDenied=!1}_onConfirm=()=>this._finish(null);_onRetry=async()=>{if(await ci()){this._finish("granted");return}this._retryDenied=!0};_chromiumBody(){let t=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>.${t}</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 t=nh(),r=t==="webkit"?this._webkitBody():t==="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> ${t==="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",rh);function ak(){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 pr=null,ur=null,sh=!1,Nc=!1,oh=0;function ih(){return nh()==="webkit"}function lk(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 UA(){if(!pr)return;if(!ur||ur.persisted!==!1||!sh){pr.hidden=!0;return}pr.hidden=!1;let e=ur.usage===null||ur.quota===null?"":` Using ${lk(ur.usage)} of ${lk(ur.quota)}.`;pr.querySelector(".storage-label").textContent="Storage at risk",pr.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. "+(ih()?"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 dk(e,t){let r=t?" (user gesture)":"";if(e){console.info(`storage: persistent-storage request granted${r}`);return}let n=!ih()&&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 `+(ih()?"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 Pc(){if(!pr)return;let[e,t]=await Promise.all([Tf(),(async()=>{try{return(await fe()).length>0||await hs()}catch{return!1}})()]);ur=e,sh=t,UA()}function ah(){!pr||oh||(oh=setTimeout(()=>{oh=0,Pc()},1e3))}async function ck(){if(Nc||(await Pc(),ur?.persisted!==!1||!sh||Nc))return;Nc=!0;let e=await ci();dk(e,!1),await Pc()}async function HA(){if(ur&&ur.persisted===!1){Nc=!0;let e=await ci();dk(e,!0),e||await ak()}await Pc()}function uk(e){pr=e,pr&&(pr.addEventListener("click",()=>{HA()}),Gn((t,r)=>{ah(),r==="save"&&ck()}),ck())}var zc="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",fi='<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>',hi='<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>',pk='<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>';var mi='<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 jA='<path class="bg" d="M3 2h6l4 4v8H3z"/><path fill="rgba(0,0,0,.18)" d="M9 2v4h4Z"/>',fk={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="${zc}"/>`},"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"/>'}},ce={...Object.fromEntries(Object.entries(fk).map(([e,{className:t,mark:r}])=>[e,`<svg class="file-icon ${t}" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${jA}${r}</svg>`])),[St]:mi},et=Object.fromEntries(Object.entries(fk).map(([e,{className:t,mark:r}])=>[e,`<span class="report-logo ${t}" aria-hidden="true"><svg viewBox="${e==="default"?"3.5 4 9 9":"4 5 8 8"}" width="14" height="14">${r}</svg></span>`])),WA=new Set(["claude-security","codex-security","deepsec","piolium"]),lh={...Qe,default:"DeepView"};function Fe(e){let t=an(e);if(t===St)return St;if(t!==void 0)return WA.has(t)?t:"default";let r=e.toLowerCase();return r.endsWith(".codex")?"codex-security":r.endsWith(".md")?"claude-security":"default"}function Uc(e){return an(e)===St}function he(e){return e.toLowerCase().endsWith(".codex")?e.slice(0,-6).replaceAll("__","/"):e}var hk=globalThis[Symbol.for("@rray/frontend")];if(!hk)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");var{LitElement:mk,html:la,nothing:gk,unsafeCSS:bk,render:YD,StateElement:XD,classMap:JD,repeat:ZD,styleMap:QD}=hk;var gi=!0;function hn(e,t=!1){gi=e!==!1&&!t}function ph(){return gi}function hr(e){return gi?xe(e):""}function Ek(e){return xe(e)!==""}function fh(e){let t=xe(e);return t!==""&&t!=="revalidation"}function Hc(e){return e.some(t=>(t.groups??[]).some(r=>r.some(fh)))}function hh(e){let t=hr(e);return t&&t!=="revalidation"?t:null}function da(e){return hr(e)==="revalidation"}var Ak=new Set(["refuted","unreachable"]);function mn(e){return Ak.has(hr(e))}function mh(e){return Ak.has(hr(e))}var jc=[{value:"confirmed",label:"Confirmed",kinds:["confirmed","partial","revalidation"]},{value:"unreachable",label:"Unreachable",kinds:["unreachable"]},{value:"refuted",label:"Refuted",kinds:["refuted"]}];function Wc(e){return jc.find(t=>t.value===e)?.kinds??null}var Vc=["","exclude","only"];function Kc(e,t){let r=Wc(e);return r?.includes("partial")?t==="only"?["partial"]:t==="exclude"?["confirmed"]:r:r}function Rk(e){let t=new Set(e);return jc.filter(r=>r.kinds.some(n=>t.has(n)))}function Gc(e){return new RegExp(`(^|/)${e}/`,"u")}function Tk(e){return new RegExp(`^(?:.*/)?${e}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,"u")}var Ik=Gc("node_modules"),Lk=Gc("vendor"),ca="node_modules",gh=Gc(ca),Fk=Tk(ca);function VA(e){e!==ca&&(ca=e,gh=Gc(e),Fk=Tk(e))}function qc(e){let t=!1,r=!1,n=o=>(!t&&Ik.test(o)&&(t=!0),!r&&Lk.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}}VA(t?"node_modules":r?"vendor":"dependencies")}function Mk(){return ca}function gt(e){return gh.test(e)}var ch=new WeakSet;function Yc(e){let t=!1;for(let r of e??[])for(let n of r.groups??[])for(let o of n){if(o.isApp!==!1)continue;let i=ch.has(o);"isUpstream"in o&&!i||(gt(o.file)?(o.isUpstream!==!0&&(t=!0),o.isUpstream=!0,ch.add(o)):i&&(t=!0,delete o.isUpstream,ch.delete(o)))}return t}function yk(e){let t=typeof e=="string"?e:"";return Ik.test(t)||Lk.test(t)||gh.test(t)}var KA=/^(.*(?:^|\/)node_modules\/(?:@[^/]+\/[^/]+|[^/]+))(?:\/|$)/u;function vk(e){return KA.exec(typeof e=="string"?e:"")?.[1]??null}function me(e){return typeof e!="number"||!Number.isFinite(e)?null:`${e.toLocaleString()} B`}function _t(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(a=>a[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 GA(e){return e.match(Fk)?.[1]??e}function Bk(e){let t=gi?[hh(e),e.revalidateVerdict,e.revalidateRecommendation]:[];return[e.file,e.title,e.description,e.impact,e.reproduction,yh(e),e.recommendation,e.confidenceReason,...t,e.discoveredIn,e.repo?.github].filter(Boolean).join(`
|
|
95
|
-
`).toLowerCase()}function wo(e){return[typeof e?.category=="string"?e.category.trim():"",Ss(e,gi)].filter(Boolean).join(" \xB7 ")}function ua(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 Me(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}function Ok(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 qA=/^(?:@[\w.-]+\/)?[\w.-]+@[^/\s@]+$/u;function YA(e){return qA.test(e||"")}function XA(e,t,r){if(YA(e))return null;if(t)return`https://github.com/${t}/blob/HEAD/${GA(e)}`;if(gt(e))return null;let n=Ok(r);return n?`${n}/blob/HEAD/${e}`:null}function bh(e,t){let r=e?.file??"",n=fr(e,t);return n?la`<a href="${JA(n)}" target="_blank" rel="noopener">${r}</a>`:r}function JA(e){return e.replace(/#L\d+(?:-L?\d+)?$/u,"")}function fr(e,t){if(!e)return null;if($e(e.location))return e.location;let r=XA(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 ZA=/^https?:\/\/(?:www\.)?github\.com\/([^/\s]+\/[^/\s]+)\/(?:blob|tree|blame)\/[^/\s]+\/(\S+)$/u,QA=/#L(\d+)(?:-L?(\d+))?$/u;function Dk(e){let t=typeof e=="string"?ZA.exec(e):null;if(!t)return"";let r=t[2],n=QA.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 eR=/^(?:\s+\S|[-*+] |\d+[.)] |>|#{1,6} |\||`{3}|~{3})/u;function Nk(e){return e.split(/(\n{2,})/u).map(t=>{if(/^\n+$/u.test(t))return t;let r=t.split(`
|
|
96
|
-
`);return r.some(n=>eR.test(n))?t:r.map(n=>n.trim()).filter(Boolean).join(" ")}).join("")}function wk(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+Nk(o.slice(0,o.length-i.length))+i}function bi(e){if(!e)return e;let t=je(e);if(t.length===0)return Nk(e);let r=[],n=0;for(let[o,i]of t)o>n&&r.push(wk(e.slice(n,o),n>0,!0)),r.push(e.slice(o,i)),n=i;return n<e.length&&r.push(wk(e.slice(n),!0,!1)),r.join("")}var kk=/^( *)(`{3,}|~{3,})(.*)$/u,tR=/^[a-z0-9+#._-]{1,20}$/u;function Pk(e,t){let r=0;for(;r<t&&e[r]===" ";)r++;return e.slice(r)}function rR(e){let t=e.split(`
|
|
97
|
-
`),r=kk.exec(t[0]),n=(r?.[2]??"```").slice(0,3),o=(r?.[3]??"").trim().split(/\s+/u)[0].toLowerCase(),s=!!(t.length>1?kk.exec(t.at(-1)):null)?.[2].startsWith(n),a=r?.[1].length??0,c=t.slice(1,s?-1:void 0);return{lang:tR.test(o)?o:"",code:(a>0?c.map(u=>Pk(u,a)):c).join(`
|
|
98
|
-
`)}}function zk(e){let t=je(e||"");if(t.length===0)return[e];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 t)i>n&&o(e.slice(n,i),n>0),r.push(rR(e.slice(i,s))),n=s;return n<e.length&&o(e.slice(n),!0),r}var dh=/^( *)(?:[-*+]|(\d{1,9})[.)]) +(?=\S)/u,xk=/^ {0,3}([-*_])(?: *\1){2,} *$/u;function nR(e){return/^ */u.exec(e)[0].length}function $k(e){let t=e.length;for(;t>0&&!e[t-1].trim();)t--;return e.slice(0,t).join(`
|
|
99
|
-
`)}function Uk(e){let t=typeof e=="string"?e:"";if(!t)return[e];let r=je(t),n=t.split(`
|
|
100
|
-
`),o=[],i=0;for(let f of n)o.push(i),i+=f.length+1;let s=f=>!kt(r,o[f])&&!xk.test(n[f])&&dh.test(n[f]),a=[],c=0,u=0,p=f=>{let h=n.slice(c,f).join(`
|
|
101
|
-
`).replace(/^\n+/u,"").replace(/\n+$/u,"");h.trim()&&a.push(h)};for(;u<n.length;){if(!s(u)){u++;continue}p(u);let f=dh.exec(n[u]),h=!!f[2],g=[],b=null,y=!1;for(;u<n.length;){let v=n[u];if(!kt(r,o[u])){if(!v.trim()){b.lines.push(""),y=!0,u++;continue}let k=nR(v),w=xk.test(v)?null:dh.exec(v);if(w&&(!b||k<b.column)){if(!!w[2]!==h)break;b&&g.push($k(b.lines)),b={column:w[0].length,lines:[v.slice(w[0].length)]},y=!1,u++;continue}if(k<b.column&&y)break}b.lines.push(Pk(v,b.column)),y=!1,u++}b&&g.push($k(b.lines)),a.push({ordered:h,start:h?Number(f[2]):null,items:g}),c=u}return a.length===0?[e]:(p(n.length),a)}var oR=/^(\d+)(?:\s*-\s*(\d+))?$/u;function mt(e){if(typeof e=="number")return Number.isFinite(e)&&e>=1?{start:Math.floor(e),end:Math.floor(e)}:null;let t=oR.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 Xc(e){return e?e.start===e.end?String(e.start):`${e.start}-${e.end}`:""}function iR(e){if(e&&typeof e=="object"){let t=mt(e.start);if(!t)return null;let r=mt(e.end)??t;return{start:t.start,end:Math.max(t.start,r.end)}}return mt(e)}function Hk(e,t,r=4){let n=typeof e=="string"&&e!==""?e.split(`
|
|
102
|
-
`):[];if(n.length===0)return{text:"",startLine:1,lines:[]};let o=iR(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,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(`
|
|
103
|
-
`),startLine:s,lines:c}}function Jc(e,t,r,n){if($e(e?.url))return e.url;let o=e?.file;if(typeof o!="string"||o==="")return null;let i=t?.file??"",s=t?.repo?.github,a=()=>s?fr({file:o,line:e?.line,repo:{github:s}},null):null;if(n===0&&o===i)return a();let c=vk(o);return c!==null&&c===vk(i)?a():yk(o)?null:s&&!yk(i)?a():fr({file:o,line:e?.line},r)}function jk(e,{spaced:t=!1}={}){let r=Array.isArray(e?.evidence)?e.evidence:[];return r.length===0?"":r.map((n,o)=>{let i=Ye(n),s=[`${o+1}. ${n.url?`[${i}](${n.url})`:i}`],a=oo(n);if(a)for(let c of a.split(`
|
|
79
|
+
`},Mm=new Map});function hL(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=hL(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";hl();Vt="links"});function mu(){if(xn)return xn;try{xn=JSON.parse(He(h$)||"{}")}catch{xn={}}return mL.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 gl(t){return m$(t)?.count}function ao(t){return m$(t)?.source}function Mt(t,e,r){let n=mu();n[t]={count:e,source:r??null},Lm()}function $s(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 gL(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(ml){e&&hu.push({names:new Set(t),onUpdate:e});for(let r of t)xs.add(r);return ml}return xs=new Set(t),hu=e?[{names:new Set(t),onUpdate:e}]:[],ml=(async()=>{await Promise.resolve();try{let r=mu();for(;xs.size>0;){let n=xs.values().next().value;if(xs.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(),gL(n,i)}catch{}}}finally{ml=null,xs=null,hu=null}})(),ml}var h$,Im,mL,xn,ml,xs,hu,_s=w(()=>{"use strict";wr();Oe();fu();gn();h$="deepview.fileCounts",Im=4,mL=new Set([3,Im]),xn=null;ml=null,xs=null,hu=null});async function bl(t){let e=Uint8Array.fromBase64(t),r=be(bL),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 bL,Bm=w(()=>{"use strict";gt();bL=`deepview/workspace-id/v1
|
|
80
|
+
`});function yl(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$,yL,Om,Pm,Nm,Dm,gu,zm,Um,bu,yu,k$=w(()=>{"use strict";g$=yl("create"),b$=yl("delete"),y$=yl("privateKey"),v$=yl("report-membership"),w$=yl("bundle-membership"),yL=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 vl(){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 wL(t){await Je(jm,JSON.stringify({version:vL,workspaces:t}))}function Ss(t){return navigator.locks.request(kL,async()=>{await Br();let e=vl(),r=await t(e);if(r!==!1)return await wL(e),r})}function wl(t){return{id:t.id,privateKey:t.privateKey,reports:Array.isArray(t.reports)?[...t.reports]:[],bundles:Array.isArray(t.bundles)?[...t.bundles]:[]}}function kl(){Cr=vl().map(wl)}function Vm(t){Cr=Cr.filter(e=>e.id!==t.id),Cr.push(wl(t))}function xL(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(wl(t))}function $L(t){Cr=Cr.filter(e=>e.id!==t)}function re(){let t=vl();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,_L)||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 bl(n),name:e,privateKey:n,reports:[],bundles:[],createdAt:Date.now()};return await Ss(s=>s.some(a=>a.id===o.id)?!1:(s.push(o),o))?(Vm(o),o):null}async function Km(t){await Ss(r=>{let n=r.findIndex(o=>o.id===t);return n<0?!1:(r.splice(n,1),!0)})&&(zm(t),$L(t))}async function Gm(t,e){let r=Vr(e);return!(!r||!await Ss(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 Ss(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 Ss(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 Ss(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&&xL(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 SL(){let t=vl().map(wl),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,vL,kL,Cr,_L,Ym,Xm,xl,$n,$l,Jm,xi,Zm,$i=w(()=>{"use strict";Bm();gn();k$();jm="deepview.workspaces",vL=1;kL=jm;Cr=vl().map(wl);_L=200;Ym=$$("reports",bu),Xm=$$("bundles",yu),xl=Ym.move,$n=Ym.add,$l=Ym.remove,Jm=Xm.move,xi=Xm.add,Zm=Xm.remove;Xn(()=>{SL()})});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 fe(),n=(await Promise.all(e.map(o=>jt("report",o)))).indexOf(t);return n===-1?null:e[n]}async function CL(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 fe()).filter(o=>!r.has(o));for(let o of n)if(await CL(o,t))return o;return null}function _l(t){return t?re().filter(e=>e.reports.includes(t)):[]}var _$=w(()=>{"use strict";hl();wr();$i();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 Cs.values())e&&f$(e.groups,t);sg=t}function Cl(){return sg.size>0}function _i(t){let e=sg.get(t);return e?[...e]:[]}async function EL(t){if(Cs.has(t))return!1;let e=ao(t);if(e===void 0)return!1;if(e!==Vt)return Cs.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 Cs.set(t,o),o!==null}function lg(){return Sl||(Sl=(async()=>{try{do{ku=!1;let t=!1;for(let e of await fe())await EL(e)&&(t=!0);t&&(C$(),S$())}while(ku)}finally{Sl=null}})(),Sl)}var Cs,sg,wu,ig,Sl,ku,E$=w(()=>{"use strict";fu();wr();_s();Cs=new Map,sg=new Map,wu=new Map,ig=new Set,Sl=null,ku=!1;ei(t=>{wu.set(t,(wu.get(t)??0)+1),ku=!0;let e=Cs.get(t)!=null;Cs.delete(t),e&&(C$(),S$())})});function A$(t){return t==="inprogress"||t==="fixed"||t==="invalid"||t==="deleted"?t:void 0}function Pe(t){if(t)return A$(t.triage)??(t.deleted?"deleted":void 0)}function AL(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 Es(t){if(!t||typeof t!="object")return;let e=t,r={};typeof e.color=="string"&&e.color&&(r.color=e.color);let n=A$(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 AL(r)?void 0:r}function RL(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 R$(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&&RL(r.ignoredReports,n.ignoredReports)}function G(t,e,r){let n=t.get(e),o=Es({...n,...r});return o===void 0?t.delete(e):R$(n,o)?!1:(t.set(e,o),!0)}function cg(t,e,r){let n=Es(r),o=t.get(e);return n===void 0?t.delete(e):R$(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){T$=typeof t=="function"?t:()=>{}}function fg(t){I$=typeof t=="function"?t:()=>{}}async function ML(t){let e=new Blob([t]).stream().pipeThrough(new CompressionStream("deflate"));return new Uint8Array(await new Response(e).arrayBuffer())}async function TL(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=Es(r);n&&(t[e]=n)}return t}function ke(){if(D())return T$(),Promise.resolve();let t=++M$,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(Rt,{mode:"shared"},async()=>{let o=null,i=null;if(n!=null)try{let s=be(n),a=await ML(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(IL,()=>{try{if(t!==M$)return;if(n!=null&&et()!==i){queueMicrotask(()=>{ke()});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 TL(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 LL(){if(!D())try{let t=await L$();if(D())return;F$(t)}catch(t){console.warn("Failed to load triage:",t)}}async function El(){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 Si(){return D()?Promise.resolve():FL??=LL()}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,Fa());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,Fa());localStorage.setItem(co,n.toBase64())}var dg,T$,I$,co,Sn,Wr,IL,M$,FL,Ci=w(()=>{"use strict";xr();gt();lo();Ra();dg=()=>{};T$=()=>{};I$=()=>{};co="deepview.triage",Sn="deepview.triage.pending",Wr=/^\d+$/u;IL="deepview.triage.save",M$=0;typeof window<"u"&&window.addEventListener("storage",t=>{t.key!==co&&t.key!==Sn||El()});tt(()=>{El()});tt(()=>{D()||et()&&localStorage.getItem(Sn)&&ke()})});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 Al||(Al=BL(),Al.catch(()=>{Al=null})),Al}async function BL(){try{await Si()}catch{}let t=await fe(),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 as(o)}catch(f){console.warn(`migrate: failed to rename ${o} -> ${i}`,f);continue}e.delete(o),e.add(i),n.add(o);let a=gl(o);if($s(o),a===void 0){let{count:f,source:h}=_t(s);Mt(i,f,h)}else{let{source:f}=_t(s);Mt(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 ke();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 $l(i,o.id),await $n(s,o.id)}}var B$,Al,O$=w(()=>{"use strict";wr();_s();$i();xr();Ci();gn();lo();_u();B$="deepview.lastFile",Al=null});function P$(){return typeof navigator<"u"&&typeof navigator.storage=="object"&&navigator.storage!==null}async function As(){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 Rs(){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 OL(){let t=hg(),e=Kd();return{version:_g,exportedAt:new Date().toISOString(),triage:t,repoUrls:e}}function PL(){return`deepview-triage-${new Date().toISOString().replaceAll(/[:.]/gu,"-").slice(0,19)}.json.gz`}async function Sg(){let t=OL();return{blob:new Blob([await Ca(JSON.stringify(t))]),filename:PL()}}async function Cg(t){let e;try{e=await Yo(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 ke();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";rs();lo();xr();Ci();_g=1});function NL(t){return t?.name==="NotFoundError"||typeof t?.message=="string"&&t.message.startsWith("File not found:")}async function Ag(t){let e=new Set;for(let r of t){let n;try{n=await Le(r)}catch(i){if(NL(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 DL(){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=DL();if(e.size===0)return{orphanedCount:0,sharedCount:0};let r=await Ag(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 fe(),i=new Set(t),s=o.filter(p=>!i.has(p)),a=await Ag(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 fe(),n=new Set(r),o=await Ag(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 ke()}var H$=w(()=>{"use strict";xr();lo();Ci();wr();Oe()});var j$=w(()=>{"use strict"});async function K$(t,e){let r=await crypto.subtle.importKey("raw",be(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]===Rg}async function Au(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]=Rg,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 UL(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]!==Rg)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 Ru(t,e,r){if(!r||typeof r.malformedMsg!="string"||typeof r.wrongPasswordMsg!="string")throw new TypeError("decryptWithPasswordOrThrow: { malformedMsg, wrongPasswordMsg } strings required");let n=await UL(t,e);if(n.ok)return n.plaintext;throw n.reason==="wrong-password"?new Error(r.wrongPasswordMsg):new Error(r.malformedMsg)}var Rg,po,V$,W$,uo,Mg=w(()=>{"use strict";gt();j$();Rg=1,po=16,V$=12,W$=1+po+V$+16,uo=1+po+V$});function Y$(t,e){return Ru(t,e,{malformedMsg:"malformed encrypted bundle",wrongPasswordMsg:"wrong password or corrupt bundle"})}var Rl,q$,Ml=w(()=>{"use strict";Mg();Rl=G$,q$=Au});async function jL(t){let e=new Set,r=await Ht(t);for(let n of r?.findings??[])n.id&&e.add(n.id);return e}function Tg(t){return(t??"").replaceAll(/[^a-zA-Z0-9._-]+/gu,"_").replaceAll(/^_+|_+$/gu,"")||"workspace"}async function VL(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 WL(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 xl(r,null);continue}let o=WL(r);e.push(o?{name:r,content:n,repo:o}:{name:r,content:n})}return e}async function KL(t,{includeBundleBytes:e=!1}={}){let r=await X$(t),n=new Set;for(let u of r)for(let p of await jL(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=Es({...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:HL,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 VL(a);u.length>0&&(c.bundleBlobs=u)}return c}async function J$(t,{includeBundleBytes:e=!1}={}){let r=await KL(t,{includeBundleBytes:e});return{blob:new Blob([await Ca(JSON.stringify(r))]),filename:`${Tg(t.name)}.deepview-workspace.json.gz`}}async function GL(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:`${Tg(t.name)}.deepview-workspace.enc`}}async function Ig(t,{password:e,includeBundleBytes:r=!1}={}){return typeof e=="string"&&e?await GL(t,e,{includeBundleBytes:r}):await J$(t,{includeBundleBytes:r})}async function qL(t){return{reports:await X$(t)}}async function Lg(t){let e=await qL(t);return{blob:new Blob([await Ca(JSON.stringify(e))]),filename:`${Tg(t.name)}.deepview-reports.json.gz`}}var HL,Z$=w(()=>{"use strict";xr();lo();wr();$i();Oe();rs();Ml();HL=1});function JL(t){if(!t||typeof t!="object")return"payload is not an object";if(t.version!==YL)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>Tl)return`reports count (${t.reports.length}) exceeds cap (${Tl})`;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>Mu)return`bundle integrity exceeds per-entry length cap (${Mu})`}}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>Mu)return`bundleBlobs.integrity exceeds per-entry length cap (${Mu})`;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>XL)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(Rl(t)){if(typeof e!="string"||!e)throw new TypeError("parseWorkspaceBundleBytes: password required for encrypted bundle");let n=await Y$(t,e);try{return Il(await Yo(n))}catch(o){throw new Error("wrong password or corrupt bundle",{cause:o})}}let r;try{r=await Yo(t)}catch(n){throw new Error(`gzip decompression failed: ${n.message}`,{cause:n})}return Il(r)}function Il(t){let e;try{e=JSON.parse(t)}catch(o){throw new Error(`payload is not JSON: ${o.message}`,{cause:o})}let r=JL(e);if(r===null)return e;let n=r.includes("exceeds cap");throw new Error(n?r:`not a deepview workspace export: ${r}`)}function ZL(t){return Pe(t)??null}async function QL(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 e6(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=ZL(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&&t6(o,i)}await ke()}function t6(t,e){for(let r of t){let n=`${r.id}:${r.property}`;e[n]==="imported"&&r6(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 r6(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 n6(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 ni(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);Mt(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 n6(t.bundleBlobs);let o=t.triage&&Object.keys(t.triage).length>0?await QL(t.reports):new Map;await e6(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 YL,Q$,Tl,Mu,r1,XL,e1,t1,Pg=w(()=>{"use strict";xr();wr();$i();Ci();_s();og();Oe();rs();lo();Ml();YL=1,Q$=1024,Tl=1024,Mu=200,r1=100*1024*1024,XL=Math.ceil(r1*4/3)+16,e1=512,t1=64});function o6(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>Tl?`reports count (${t.reports.length}) exceeds cap (${Tl})`:null:"reports field must be an array"}function n1(t){return o6(t)===null}async function Ng(t){if(Rl(t))return{kind:"encrypted"};let e;try{e=await Yo(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();rs();Ml()});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 bl(r)===t?{v:1,n:e,k:r}:{v:1,i:t,n:e,k:r};return(await Au(be(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 Ru(r,e,{malformedMsg:"malformed share link",wrongPasswordMsg:"wrong password or corrupt link"});try{return await i6(n)}catch(o){throw new Error("wrong password or corrupt link",{cause:o})}}async function i6(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 bl(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();Mg();Bm()});var O=w(()=>{"use strict";n$();nh();s$();_s();hl();_$();og();fu();E$();O$();Ra();N$();gn();z$();xr();zh();wr();U$();H$();Ci();lo();Ml();Z$();Pg();o1();i1();$i()});function s1(t){t.installSyncHost(s6),ug(()=>t.triageSync.notify())}var s6,a1=w(()=>{"use strict";xr();_s();$i();wr();Ci();gn();s6={get state(){return l},listWorkspaces:re,addReportToWorkspace:$n,addBundleToWorkspace:xi,onReportMembershipChanged:Nm,onBundleMembershipChanged:Dm,onWorkspaceDeleted:Om,onWorkspacePrivateKeyChanged:Pm,analyzeContent:_t,setCount:Mt,gunzipBytes:yr,listBundles:Dt,listFiles:fe,readBundle:bn,readFileBytes:ti,saveBundle:ni,saveFileBytes:za,saveTriage:ke,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 Fl(){return Ll||(jg()&&!ne?Promise.resolve(null):(Ll=(async()=>{let t="./client-sync.js";try{let e=await import(t);return s1(e),ne=e,a6(),e}catch(e){throw Ll=null,e}})(),Ll))}function Bl(t){ne?t(ne):f1.push(t)}function a6(){let t=f1.splice(0);for(let e of t)try{e(ne)}catch(r){console.warn("client-sync: deferred apply failed:",r)}}function Ei(t,e){let r={cancelled:!1,unsub:null};return Bl(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(l6+t);if(!e)return null;let r=JSON.parse(e);return r&&typeof r=="object"?r:null}catch{return null}}function Ms(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 Ei(t,(e,r)=>e.onAutoDownloaded(r))}function y1(t){return Ei(t,(e,r)=>e.onBundleAutoDownloaded(r))}function v1(t){return Ei(t,(e,r)=>e.onChange(r))}function w1(t){if(ne){ne.setRedraw(t);return}l1=t,Bl(e=>{l1===t&&e.setRedraw(t)})}function k1(t){if(ne){ne.setAuthenticationResolver(t);return}c1=t,Bl(e=>{c1===t&&e.setAuthenticationResolver(t)})}function x1(t){if(ne){ne.setHydrationConflictResolver(t);return}d1=t,Bl(e=>{d1===t&&e.setHydrationConflictResolver(t)})}async function En(t,e){if(!jg()&&!(!u1()&&!ne))return(await Fl())[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 Ol(...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);Bl(r=>{r.triageSync[t](...e)})}var ne,Ll,p1,f1,l6,l1,c1,d1,Tu,H,Er=w(()=>{"use strict";O();a1();ne=null,Ll=null;p1=!1;f1=[];l6="deepview.objstore-presence.";l1=null,c1=null,d1=null,Tu=[];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):Fl().then(e=>{e.triageSync.setEnabled(!0);let r=Tu;Tu=[];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){Tu=ne.openWorkspaceIds();for(let e of Tu)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 Ei(t,(e,r)=>e.triageSync.onStatusChange(r))},onServerInfo(t){return Ei(t,(e,r)=>e.triageSync.onServerInfo(r))},onPersistenceDegraded(t){return Ei(t,(e,r)=>e.triageSync.onPersistenceDegraded(r))},onProxyAuthRequired(t){return Ei(t,(e,r)=>e.triageSync.onProxyAuthRequired(r))}}});var Pl,Z,E1=w(()=>{Lr();Ji();Pl=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:[]}}};Pl.directiveName="unsafeHTML",Pl.resultType=1;Z=Fr(Pl)});var bt=w(()=>{E1()});function Gg(){return Ou?.getPreviewRole()??null}function A1(){Ou?.setPreviewRole(null)}function Kr(){return Nl||(Nl=(async()=>{let t="./client-managed.js";try{return Ou=await import(t),Ou}catch(e){throw Nl=null,e}})(),Nl)}async function R1(){return(await Kr()).probeSession()}async function M1(){return(await Kr()).probeTeams()}async function T1(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 Nl,Ou,Nu=w(()=>{"use strict";Nl=null,Ou=null});function B1(t){return typeof t=="string"&&Dl.includes(t)}function O1(t,e){let r=Dl.indexOf(t);return r!==-1&&r<=Dl.indexOf(e)}var Dl,qg=w(()=>{"use strict";Dl=["admin","manage","triage","view","none"]});var P1=w(()=>{"use strict"});var Du,Gr,fo,N1,zu,Ts,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>',Ts='<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,c6,zl,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"/>'}},c6={default:["#2563eb","#fff"],"claude-security":["#d97757","#fff"],"codex-security":["#fff","#000"],deepsec:["#000","#fff"],piolium:["#fbb829","#1c1b19"]},zl=Object.fromEntries(Object.entries(D1).map(([t,{className:e,mark:r}])=>{let[n,o]=c6[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 Ul(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=Ul(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 d6.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 xe(t){return t.toLowerCase().endsWith(".codex")?t.slice(0,-6).replaceAll("__","/"):t}var ye,d6,Ai,Ar=w(()=>{"use strict";O();Uu();Uu();Oe();Wt();ye={...zl,[Vt]:Ts},d6=new Set(["claude-security","codex-security","deepsec","piolium"]),Ai={...ct,default:"DeepView"}});function u6(){return ho||(ho=document.createElement("div"),ho.id="styled-tooltip",document.body.append(ho),ho)}function Yg(t,{placement:e="cursor"}={}){let r=u6(),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+h6)}px`,r.style.transform="translateY(-50%)"}else{r.style.transform="none",r.style.top=`${G1+f6}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 Is(){clearTimeout(Hl),Hl=null,ho&&ho.classList.remove("visible"),mo=null}function q1(t,{gate:e,placement:r}={}){e&&!e(t)||(clearTimeout(Hl),Hl=setTimeout(()=>{Yg(t,{placement:r})},p6))}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){Is();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||Is()}))}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||(Is(),q1(e))}),document.body.addEventListener("mouseout",t=>{t.target.closest("[data-tooltip-managed]")||t.relatedTarget?.closest?.("[data-tooltip-managed]")||!mo&&!Hl||mo&&mo.contains(t.relatedTarget)||Is()}))}var ho,mo,Hl,K1,G1,p6,f6,h6,H1,j1,W1,go=w(()=>{"use strict";mo=null,Hl=null,K1=0,G1=0;document.addEventListener("mousemove",t=>{K1=t.clientX,G1=t.clientY},{passive:!0});p6=100,f6=14,h6=8,H1=8;j1=new WeakSet;W1=!1});var X1,J1,jl,Z1,Q1,A9,R9,M9,T9,I9,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:jl,nothing:Z1,unsafeCSS:Q1,render:A9,StateElement:R9,classMap:M9,repeat:T9,styleMap:I9}=X1)});function bo(t,e=!1){Ls=t!==!1&&!e}function eb(){return Ls}function Yr(t){return Ls?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 Wl(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 m6(t){t!==Vl&&(Vl=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}}m6(e?"node_modules":r?"vendor":"dependencies")}function b_(){return Vl}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 g6.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 b6(t){return t.match(g_)?.[1]??t}function y_(t){let e=Ls?[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():"",Qa(t,Ls)].filter(Boolean).join(" \xB7 ")}function Kl(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 v6(t){return y6.test(t||"")}function r_(t){if(t==null||typeof t=="string")return{id:t??"",prefix:""};let e=mi(t);return{id:typeof t.github=="string"?t.github:"",prefix:e?`${e}/`:""}}function w6(t,e,r){if(v6(t))return null;let n=r_(e);if(n.id)return`https://github.com/${n.id}/blob/HEAD/${n.prefix}${b6(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?jl`<a href="${k6(n)}" target="_blank" rel="noopener">${r}</a>`:r}function k6(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=w6(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"?x6.exec(t):null;if(!e)return"";let r=e[2],n=$6.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=>_6.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 Fs(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 C6(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:S6.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(C6(t.slice(i,s))),n=s;return n<t.length&&o(t.slice(n),!0),r}function E6(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=E6(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 Tt(t){if(typeof t=="number")return Number.isFinite(t)&&t>=1?{start:Math.floor(t),end:Math.floor(t)}:null;let e=A6.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 R6(t){if(t&&typeof t=="object"){let e=Tt(t.start);if(!e)return null;let r=Tt(t.end)??e;return{start:e.start,end:Math.max(e.start,r.end)}}return Tt(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=R6(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=ui(n);if(a)for(let c of a.split(`
|
|
104
91
|
`))s.push(` ${c}`);return s.join(`
|
|
105
|
-
`)}).join(
|
|
92
|
+
`)}).join(e?`
|
|
106
93
|
|
|
107
94
|
`:`
|
|
108
|
-
`)}function
|
|
109
|
-
${
|
|
110
|
-
`));let{title:s,body:a}=
|
|
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:Ja(e[1].trim())||e[2],url:e[2]}}function A_(t,e){let r=parseInt(t?.line,10);if(!Number.isFinite(r))return Z1;let n=qr(t,e),o=`line ${r}`;return n?jl`<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 R_(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
|
|
111
98
|
|
|
112
|
-
${c}`);for(let[u,p]of
|
|
99
|
+
${c}`);for(let[u,p]of M6){if(!Ls&&p.startsWith("revalidate"))continue;let f=$t(t?.[p],t)?.trim();f&&i.push(`# ${u}
|
|
113
100
|
|
|
114
101
|
${f}`)}return i.join(`
|
|
115
102
|
|
|
116
|
-
`)}function Gk(e,{title:t,body:r}={}){let n=Ok(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 aR=/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u,lR=/^[a-zA-Z\d._-]+$/u,cR=/^[1-9]\d{0,9}$/u,dR=/^[a-fA-F\d]{7,40}$/u,uR=/^#[\w-]+$/u,Sk=/^GHSA(?:-[0-9a-z]{4}){3}$/u;function _k(e){return e.length<=39&&aR.test(e)}function Ck(e){return e.length<=100&&e!=="."&&e!==".."&&lR.test(e)}function pR(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 Sk.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!_k(p)||!Ck(f)||!Sk.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(!_k(n)||!Ck(o))return null;let a;if(i==="issues"||i==="pull"){if(!cR.test(s))return null;a=`${n}/${o}#${s}`}else if(i==="commit"){if(!dR.test(s))return null;a=`${n}/${o}@${s.slice(0,7)}`}else return null;let c=uR.test(t.hash)?t.hash:"";return{url:`https://github.com/${n}/${o}/${i}/${s}${c}`,label:a}}var fR=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/u;function ko(e){if(typeof e!="string")return null;let t=pa(e);return t!==e||fR.test(e)?t.slice(0,8):null}function pa(e){let t=String(e),r="https://chatgpt.com/codex/cloud/security/findings/";return t.startsWith(r)?t.slice(r.length):t}function hR(e){let t=Nv(e);if(!t)return null;let r=ko(t.id);return{url:`#${t.fragment}`,label:r?`finding ${r}`:"finding",self:!0}}var uh=/https?:\/\/[^\s<>"'`(){}[\]|\\^]+/giu,mR=new Set([")",".",",","!","?",";",":","'",'"',"*","]","}",">"]);function gR(e){let t=e.length;for(;t>0&&mR.has(e[t-1]);)t--;return t===e.length?e:e.slice(0,t)}function qk(e){if(typeof e!="string"||e.length===0)return[];let t=[],r=0;uh.lastIndex=0;let n;for(;(n=uh.exec(e))!==null;){let o=gR(n[0]),i=o?pR(o)??hR(o):null;i&&(n.index>r&&t.push(e.slice(r,n.index)),t.push(i),r=n.index+o.length,uh.lastIndex=r)}return r<e.length&&t.push(e.slice(r)),t}function Qc(){let e=new Set;if(l.currentWorkspace||!qs())return e;let t=l.currentFile??l.reports[0]?.fileName;if(!t)return e;let r=new Set;for(let n of l.reports)if(n.fileName===t)for(let o of n.groups)for(let i of o)i.id!=null&&r.add(String(i.id));for(let n of r)bo(n).some(o=>!r.has(o)&&fo(o).some(i=>i!==t))&&e.add(n);return e}var gn="\0",xo="",bn="";function ha(e){return ro(e.model)||null}function vh(e){let t=Dr();if(t.filterAnalyzer){let r=e._analyzer??null,n=t.filterAnalyzer===gn?null:t.filterAnalyzer;if(r!==n)return!1}if(t.filterModel){let r=ha(e),n=t.filterModel===bn?null:t.filterModel;if(r!==n)return!1}return!0}function wh(e){let t=typeof e._repoFallback=="string"&&e._repoFallback?e._repoFallback:null;return e.isApp&&!(e._source??e.source)&&t?t:typeof e.repo?.github=="string"&&e.repo.github?e.repo.github:t}function Jk(e){let t=new Set;for(let r of e)for(let n of r)t.add(wh(n));return t}function yi(){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"}var bR=["filterSeverities","filterColors","filterSources","filterAnalyzer","filterModel","filterRepo","filterConfMin","filterConfMax","filterInclude","filterIncludeNegate","filterComment","filterFix","filterFlagged","filterDuplicates","filterCrossContext","filterAppStacked","filterRevalidate","filterPartial"];function Zk(){let e={};for(let t of bR){let r=l[t];e[t]=r instanceof Set?new Set(r):r}return e}var kh=null;function ma(e){kh=e}function ga(){kh=null}function Dr(){return kh??l}function fa(e){if(e.confidence!==void 0)return e.confidence;if(e.critical===!0||e._source)return 10}var yR=e=>e.confidence!==void 0||e.critical===!0;function xh(e){return e.every(t=>t.every(r=>fa(r)!==void 0))&&e.some(t=>t.some(yR))}function Qk(e,t){return e.some(r=>{let n=mh(r)?0:fa(r);return n===void 0?t===0:n>=t})}function ed(e){let t=e.map(zt).filter(o=>o.length>0);if(!t.some(o=>o.some(i=>fa(i)!==void 0)))return 0;let r=o=>t.reduce((i,s)=>i+(s.some(a=>(fa(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 e0(e){return hr(e)||(e._source&&!e._sourcePass?"revalidation":"")}function $h(e){let t=Kc("confirmed","");return e.some(r=>t.includes(e0(r)))}function t0(e,t){return xh(e)?t:0}function r0(e){let t=new Set(e.ruledOutIds??[]);for(let r of e)for(let n of r)mn(n)&&t.add(N(n));for(let r of e){let n=zt(r);if(n.length!==0&&$h(n)){for(let o of r)if(t.add(N(o)),o.isApp&&Array.isArray(o.revalidateInputs))for(let i of o.revalidateInputs)i&&t.add(i)}}return t}function n0(e,t,r){let n=t0(e,t),o=e.filter(s=>Qk(s,n));if(o.length===0)return!1;let i=new Set(Kc("confirmed",""));return e.some(s=>s.some(a=>i.has(hr(a))))?o.every(s=>s.every(a=>r.has(N(a)))):!1}function Sh(e,t){let r=e.map(zt).filter(n=>n.length>0);return n0(r,t,r0(e))?"confirmed":""}function td(e){if(l.showRevalidation===!1||l.upstreamOnly||vn())return!1;let t=e.map(zt).filter(o=>o.length>0),r=r0(e);if(!n0(t,ed(e),r))return!1;let n=t0(t,6);return t.every(o=>!Qk(o,n)||!o.some(i=>ee(i,l.severityMode)!=="low")||o.every(i=>r.has(N(i))))}function ba(e,{resetSort:t=!0}={}){l.filterConfMin=ed(e),l.filterConfMax=10,l.filterRevalidate=Sh(e,l.filterConfMin),l.filterPartial="",t&&(l.sortBy=_h(e)?"priority-desc":"severity")}function _h(e){return!Array.isArray(e)||e.length===0?!1:e.every(t=>{if(o0(t)===void 0)return!1;let r=t.filter(o=>o.isApp);if(r.length===0)return!0;let n=t.some(o=>o.priority!==void 0);return r.some(o=>o.priority!==void 0||!n&&mn(o))})}function o0(e){let t=e.find(r=>r.priority!==void 0);return t?t.priority:e.some(mn)?0:void 0}function i0(e){let t=Dr();if(t.filterSources.size===1){let r=t.filterSources.has("own");if(r&>(e.file)||!r&&!gt(e.file))return!1}if(t.filterRevalidate){let r=Kc(t.filterRevalidate,t.filterPartial);if(r&&!r.includes(e0(e)))return!1}if(!t.filterRevalidate){let r=mh(e)?0:fa(e);if(r===void 0){if(t.filterConfMin>0)return!1}else if(r<t.filterConfMin||t.filterConfMax<10&&r>t.filterConfMax)return!1}return!0}function vR(e){if(!i0(e))return!1;let t=Dr(),r=t.filterInclude.toLowerCase();if(t.filterSeverities.size>0&&!t.filterSeverities.has(ee(e,l.severityMode)))return!1;if(t.filterColors.size>0){let n=de(e)?.color??"none";if(!t.filterColors.has(n))return!1}if(!vh(e))return!1;if(t.filterRepo){let n=wh(e),o=t.filterRepo===xo?null:t.filterRepo;if(n!==o)return!1}if(r){let n=de(e),o=Bk(e).includes(r)||(n?.comment??"").toLowerCase().includes(r)||(n?.fix??"").toLowerCase().includes(r);return t.filterIncludeNegate?!o:o}return!0}function wR(e){let t=Dr();if(!t.filterComment&&!t.filterFix&&!t.filterFlagged)return!0;let r=n=>e.some(o=>n(de(o)));if(t.filterComment){let n=r(o=>!!o?.comment);if(t.filterComment==="with"?!n:n)return!1}if(t.filterFix){let n=r(o=>!!o?.fix);if(t.filterFix==="with"?!n:n)return!1}if(t.filterFlagged){let n=r(o=>o?.flagged===!0);if(t.filterFlagged==="with"?!n:n)return!1}return!0}function kR(e){let t=e?.package?.npm;if(typeof t?.name=="string"&&t.name&&!qr(t))return t.name;let r=typeof e?.file=="string"?e.file:"";return/(?:^|\/)(?:node_modules|dependencies|vendor)\/(@[^/]+\/[^/]+|[^/]+)(?:\/|$)/u.exec(r)?.[1]??null}function s0(){return l.showRevalidation!==!1&&!l.upstreamOnly}function Ch(e){if(s0())return!1;let t=zt(e);if(t.length<2)return!1;let r=new Set,n=new Set;for(let o of t){let i=wh(o);i&&r.add(i);let s=kR(o);s&&n.add(s)}return r.size>1||n.size>1}function Eh(e){if(!s0()||zt(e).length===0)return!1;let r=e.filter(n=>n.isApp);return r.length>0&&r.length>1}function a0(e){return e.filter(t=>t.some(i0)).map(zt)}function yn(e){let t=!l.currentWorkspace&&Dr().filterDuplicates,r=t?Qc():null,n=Dr().filterCrossContext,o=Dr().filterAppStacked;return e.filter(i=>i.some(vR)&&wR(i)&&(!t||t==="with"===i.some(s=>r.has(N(s))))&&(!n||n==="with"===Ch(i))&&(!o||o==="with"===Eh(i)))}function Yk(e,t){let r=t==="desc"?-1:11;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 l0(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),a=n.confidence??(i?10:t);return(e==="desc"?a-s:s-a)||(o===i?0:o?-1:1)||r.file.localeCompare(n.file)}}var Xk=l0("desc"),xR={severity:(e,t)=>(Se[ee(t,l.severityMode)]||0)-(Se[ee(e,l.severityMode)]||0)||Xk(e,t)||parseInt(e.line,10)-parseInt(t.line,10),"confidence-desc":Xk,"confidence-asc":l0("asc"),"priority-desc":Yk("priority","desc"),"priority-asc":Yk("priority","asc")};function rd(e){let t=xR[l.sortBy];if(!t)return[...e];if(l.sortBy==="priority-desc"||l.sortBy==="priority-asc"){let r=l.sortBy==="priority-desc"?"desc":"asc",n=r==="desc"?-1:11;return e.map(o=>({p:o0(o),g:o})).toSorted((o,i)=>{let s=o.p??n,a=i.p??n;return(r==="desc"?a-s:s-a)||Nr(o.g).file.localeCompare(Nr(i.g).file)}).map(o=>o.g)}return e.map(r=>({p:Nr(r),g:r})).toSorted((r,n)=>t(r.p,n.p)).map(r=>r.g)}function c0(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>t.startsWith("revalidate")&&r!=null))}function d0(e,t,r){let n=c0(t);if(!e._revalidationCopies){let o=c0(e);if(Object.keys(o).length===0&&Object.keys(n).length===0)return[];e._revalidationCopies=Object.keys(o).length>0?[{reportName:e._reportName??"",fields:o}]:[]}return Object.keys(n).length>0&&e._revalidationCopies.push({reportName:r,fields:n}),e._revalidationCopies}function u0(e){let t=new Map,r=new Set(eo);for(let{reportName:n,fields:o}of e)for(let[i,s]of Object.entries(o)){if(s==null)continue;let a=i==="revalidate"?xe(o)||String(s).trim().toLowerCase():String(s).trim();if(i==="revalidate"&&!a||i==="revalidate"&&!r.has(a))continue;t.has(i)||t.set(i,new Map);let c=t.get(i);c.has(a)||c.set(a,new Set),c.get(a).add(n)}return[...t].filter(([,n])=>n.size>1).map(([n,o])=>({field:n,variants:[...o].map(([i,s])=>({value:i,reports:[...s]}))}))}var $R=new Set(["correctedSeverity","correctedSeverityReason","isApp","isUpstream","source"]);function p0(e,t){if(!e||!t||e===t)return!1;let r=!1;for(let[n,o]of Object.entries(t)){if(n.startsWith("_")||$R.has(n)||o==null)continue;if(n==="revalidate"){let s=xe(t);if(!s)continue;let a=xe(e);a?a!==s&&(r=!0):e[n]=o;continue}let i=e[n];if(i==null){e[n]=o;continue}n.startsWith("revalidate")&&String(i).trim()!==String(o).trim()&&(r=!0)}return r}function Ah(e,t,r,n){if(!e||!t||e===t)return;(e.correctedSeverity||t.correctedSeverity)&&(e._correctedByReport??={[e._reportName??""]:{severity:ir(e),reason:e.correctedSeverityReason}},e._correctedByReport[r]={severity:ir(t),reason:t.correctedSeverityReason});let o=d0(e,t,r);(p0(e,t)||n.has(e.id))&&n.set(e.id,{finding:e,copies:o})}function ya(e,t=null){let r=t??e.filter(p=>p.isApp),n=e.filter(p=>!p.isApp);if(r.length===0||n.length===0)return[e];if(t&&e.some(p=>p.isApp))return[e];if(n.some(p=>typeof p.id!="string"||!p.id))return[e];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[e];for(let h of f){if(!o.has(h))return[e];s.add(h)}i.set(p,f)}if(s.size!==o.size)return[e];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 e){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?[e]:[...u.values()]}function h0(e,{showRevalidation:t=!0,upstreamOnly:r=!1,hideRuledOut:n=!1,merges:o=[]}={}){let i=[],s=new Set;for(let y=0;y<e.length;y++){let v=e[y];for(let k of v.groups){for(let A of k)A.id&&["refuted","unreachable"].includes(xe(A))&&s.add(A.id);let w=r?k.filter(A=>A.isUpstream&&xe(A)!=="revalidation").map(f0):t?n?k.filter(A=>!["refuted","unreachable"].includes(xe(A))):k:k.filter(A=>xe(A)!=="revalidation").map(f0),$=w.length===k.length&&w.every((A,T)=>A===k[T])?k:w;$.length>0&&i.push({group:$,sourceGroup:k,reportIndex:y,reportName:v.fileName??"",hasApp:$.some(A=>A.isApp)})}}let a=i.map((y,v)=>v),c=i.map(y=>y.hasApp),u=y=>{let v=y;for(;a[v]!==v;)v=a[v];for(;a[y]!==v;){let k=a[y];a[y]=v,y=k}return v},p=(y,v)=>{y=u(y),v=u(v),y!==v&&(a[v]=y,c[y]||=c[v])},f=new Map;for(let y=0;y<i.length;y++)for(let v of i[y].group)v.id&&(f.has(v.id)||f.set(v.id,[]),f.get(v.id).push({index:y,app:v.isApp}));for(let y of f.values()){let v=new Map,k=y.find(w=>w.app);for(let{index:w}of y){k&&p(k.index,w);let $=i[w].reportIndex;v.has($)?p(v.get($),w):v.set($,w)}}for(let y of f.values()){let v=null;for(let{index:k}of y)c[u(k)]||(v===null?v=k:p(v,k))}for(let y of o){let v=null;for(let k of y)for(let{index:w}of f.get(k)??[])v===null?v=w:p(v,w)}let h=new Map;for(let y=0;y<i.length;y++){let v=u(y);h.has(v)||h.set(v,[]),h.get(v).push(i[y])}let g=new Map,b=[];for(let y of h.values()){let v=y[0].group,k=v.map(M=>M.id).filter(Boolean);if(y.length===1&&new Set(k).size===k.length&&o.length===0){let M=e.length>1&&v.find(O=>O.isApp);if(M){let O=[...v];O.workspaceKey=M.id??String(M._id),b.push(...Rh(y,O,t,r))}else b.push(...Rh(y,v,t,r));continue}let w=new Map,$=new Map,A=[];for(let{group:M,reportName:O}of y)for(let V of M)if(V.id&&$.has(V.id))Ah($.get(V.id),V,O,w);else{let H={...V,_reportName:V._reportName??O};V.id&&$.set(V.id,H),A.push(H)}let T=new Set;for(let M of o)for(let O of M)$.has(O)&&T.add(O);for(let{group:M}of y)if(M.length>1)for(let O of M)O.id&&T.add(O.id);let F=[...T].map(M=>$.get(M));for(let M of A)T.has(M.id)||F.push(M);if(e.length>1){let M=F.find(O=>O.isApp);M&&(F.workspaceKey=M.id??String(M._id))}b.push(...Rh(y,F,t,r));for(let[M,O]of w){let V=g.get(M);g.set(M,V?{finding:V.finding,copies:[...V.copies,...O.copies]}:O)}}return Object.defineProperty(b,"ruledOutIds",{value:s,configurable:!0}),{groups:b,conflicts:g}}function Rh(e,t,r,n){if(r)return[t];if(n){let i=e.flatMap(p=>p.sourceGroup),s=ya(i);if(s.length===1)return[t];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=t.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(t.map(p=>p.id).filter(Boolean));return c.size===u.size?a:[t]}let o=e.flatMap(i=>i.sourceGroup.filter(s=>s.isApp));return ya(t,o)}function f0(e){let t=Object.keys(e).filter(n=>n.startsWith("revalidate")||n==="_revalidationCopies");if(t.length===0)return e;let r={...e};for(let n of t)delete r[n];return r}var vi=null,Th=0;function Ct(){return l.currentView==="links"&&vi?.owner===l.currentLinks?vi:null}function nd(){Th++,vi=null}async function m0(e,t,r){if(l.currentView!=="links"||!l.currentLinks)return;let n=kl(l.currentLinks),o=++Th;vi={owner:n,id:e,reportName:t,group:null,error:""},l.focusCodeStack=[],l.focusCodeAt=0;let i=()=>o===Th&&l.currentView==="links"&&l.currentLinks===n;try{let s=await Bt(await Ae(t));if(!i())return;let a=(Tr(s?.data)??[]).map(h=>Array.isArray(h)?h:[h]),c=h=>h?.some(g=>String(g?.id)===e),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:t,_repoFallback:lo(p)??wt(t),_bundleHashes:p.bundleHashes??[],_source:h.source??p.source??null};return ao(g,p),g._analyzer=g._source??g.type??null,"isApp"in g||(g.isApp=to(g,g._source)),g});await Promise.all([yo,$t("report",t),...Ks(t).map(h=>$t("workspace",h.id))]),i()&&(vi.group=f,l.activeTabByGroup.set(f[0].id,e))}catch(s){i()&&(vi.error=s.message||"Unable to load this finding.")}}function g0(e,t,r){let n=e.map((p,f)=>f),o=p=>{for(;n[p]!==p;)n[p]=n[n[p]],p=n[p];return p},i=e.map(r),s=new Map;for(let p=0;p<i.length;p++)for(let f of i[p])f.id&&(s.has(f.id)||s.set(f.id,[]),s.get(f.id).push(p));for(let[p,f]of s)for(let h of t(p))if(h!==p)for(let g of f)for(let b of s.get(h)??[]){let y=o(g),v=o(b);y!==v&&(n[v]=y)}let a=new Map;for(let p=0;p<e.length;p++){let f=o(p);a.has(f)||a.set(f,[]),a.get(f).push(p)}if(a.size===e.length)return e;let c=p=>p.id??String(p._id),u=[...a.values()].map(p=>{if(p.length===1)return e[p[0]];let f=new Map;for(let y of p)for(let v of i[y])f.has(c(v))||f.set(c(v),v);let h=new Map;for(let y of p)for(let v of e[y])h.has(c(v))||h.set(c(v),f.get(c(v))??v);let g=[...h.values()],b=e[p[0]];return g.workspaceKey=b.workspaceKey??c(b[0]),g.linkedTabs=[...f.values()],g});return Object.defineProperty(u,"ruledOutIds",{value:e.ruledOutIds,configurable:!0}),u}function N(e){return e.id??String(e._id)}function Z(e){return e.workspaceKey??N(e[0])}function Ih(e){return Array.isArray(e)?e:[e]}function vn(){return!l.currentWorkspace&&l.revalidationDetailed===!0}function Lh(e){return e?._reportName??""}var b0=null,y0=!0;function SR(){let e=l.reports;return!Array.isArray(e)||e.length===0?!0:(e!==b0&&(b0=e,y0=Hc(e)),y0)}function _e(e){return!e.isUpstream||l.showRevalidation===!1||l.upstreamOnly===!0||!SR()}function de(e){return _e(e)?l.triage.get(N(e)):void 0}function Fh(e){return _e(e)&&Fr(l.triage,N(e),Lh(e))}function va(e,t=de(e)){if(_e(e))return t?.triage??(Fh(e)?"ignored":void 0)}function zt(e){return Ct()?.group===e?e:e.linkedTabs?e.linkedTabs:vn()||e.length<=1||!e.some(da)?e:e.filter(da)}function gr(e){let t=zt(e);return t.length<=1?t:[...t].toSorted((r,n)=>{let o=da(r)?1:0,i=da(n)?1:0;if(o!==i)return i-o;let s=de(r)?.color?1:0,a=de(n)?.color?1:0;if(s!==a)return a-s;let c=Se[ee(r,l.severityMode)]||0,u=Se[ee(n,l.severityMode)]||0;if(c!==u)return u-c;let p=r.confidence??-1;return(n.confidence??-1)-p})}function Nr(e){return e.length===1?e[0]:gr(e)[0]}function v0(e){let t=[],r=[];for(let n of e)(n.isApp?t:r).push(n);return{app:t,source:r}}function _R(e){let t=de(e);return!!t?.comment||!!t?.fix||t?.flagged===!0}function Je(e){if(e.length===1)return e[0];let t=gr(e);if(t.length===1)return t[0];let r=l.activeTabByGroup.get(Z(e));if(r){let o=t.find(i=>N(i)===r);if(o)return o}let n=t;if(l.filterAnalyzer||l.filterModel){let o=t.filter(vh);o.length>0&&(n=o)}return n.find(_R)??n[0]}function Et(e){return e?._repoFallback||l.repoUrl||""}function od(e){for(let t of lr().values())if(t.files.has(e.file))return t.repos?.size===1?[...t.repos][0]:null;return e.repo?.github||Et(e)||null}function wi(e){if(!Array.isArray(e))return[];let t=e.filter(r=>!r.isUpstream);return t.length===0||t.length===e.length?e:t}function Ce(e){let t=wi(e),r=0,n=!1,o,i=!1,s=!1,a,c=!1,u=null,p=!1,f=!0;for(let v of t){let k=de(v),w=va(v,k),$=k?.color;$===void 0&&w===void 0||(r++,$!==void 0&&(i?$!==o&&(n=!0):(i=!0,o=$)),c?w!==a&&(s=!0):(c=!0,a=w),w?(u===null&&(u=w),w==="ignored"?f=!1:p=!0):f=!1)}let h=n||s,g=!h&&i?o:null,b=r>0&&f,y=!h&&u!==null?u:null;return{hasConflict:h,commonColor:g,anyTriage:p,allTriaged:b,commonTriage:y,allIgnored:y==="ignored"&&r===t.length,isInProgress:y==="inprogress",isFixed:y==="fixed",isInvalid:y==="invalid",isDeleted:y==="deleted",isIgnored:y==="ignored"}}function w0(e,t){if(!Array.isArray(e)||e.length<2)return!1;let r=e.filter(_e);if(r.length<2)return!1;let n=(t??"").trim();return r.every(o=>Mh(o,n))}function Mh(e,t){if(!_e(e))return!1;let r=(de(e)?.fix??"").trim();return r===""||r===(t??"").trim()}function k0(e,t){if(!_e(Je(e)))return{targets:[],clearing:!1};let r=Ce(e);return{targets:wn(e,r),clearing:t==="restore"||Bh(e,r)===t}}function wn(e,t=Ce(e)){let r=wi(e),n=e.linkedTabs||r!==e&&e.some(o=>o.isApp)?r:t.hasConflict?[Je(e)]:r;return n.every(_e)?n:n.filter(_e)}function Bh(e,t=Ce(e),r=null){return e.linkedTabs||e.some(n=>n.isApp)&&wi(e)!==e||!t.hasConflict?t.commonTriage??null:va(r??Je(e))??null}function id(e){let t=wi(e);if(t.length<2)return!1;let n=Ce(e).commonTriage;if(!n||n==="ignored")return!1;let o=!1;for(let i of t){if(!_e(i))continue;let s=N(i),a=l.triage.get(s);va(i,a)!==n&&(a?.ignoredReports?.length||U(l.triage,s,{triage:n})&&(o=!0))}return o}var mr=null;function $o(){mr=null}function sd(e,t=!1,r=!1){let n=l.reports,o=l.workspaceMerges;(!mr||mr.reports.length!==n.length||mr.reports.some((s,a)=>s!==n[a])||mr.merges!==o||mr.mergeCount!==o.length)&&(mr={reports:[...n],merges:o,mergeCount:o.length});let i=t?"upstream":e?r?"workspace-app":"app":"code";return mr[i]||(mr[i]=h0(n,{showRevalidation:e&&!t,upstreamOnly:t,hideRuledOut:r,merges:o})),mr[i]}function x0(){return sd(l.showRevalidation!==!1).groups}function Oh(){return sd(!0).groups}function $0(){return sd(!0,!1,!!l.currentWorkspace).conflicts}function At(){let e=sd(l.showRevalidation!==!1,l.upstreamOnly===!0,!!l.currentWorkspace),t=e.groups;return l.showRevalidation===!1||l.upstreamOnly||vn()?t:l.currentWorkspace?((!e.linkedGroups||e.linksTick!==l.linksTick)&&(e.linkedGroups=g0(t,bo,zt),e.linksTick=l.linksTick),e.linkedGroups):e.visibleGroups??=(()=>{let r=t.flatMap(n=>{let o=n.filter(i=>!mn(i));return o.length===n.length?[n]:o.length===0?[]:(o.workspaceKey=Z(n),[o])});return Object.defineProperty(r,"ruledOutIds",{value:t.ruledOutIds,configurable:!0}),r})()}function kn(){let e=At();if(l.viewMode==="kanban")return e;let t=e.filter(r=>Ce(r).commonTriage===l.shownTriage);return Object.defineProperty(t,"ruledOutIds",{value:e.ruledOutIds,configurable:!0}),t}function S0(e){if(l.showRevalidation||l.upstreamOnly||!Array.isArray(e)||e.length===0)return e;let t=new Set(e.map(N)),r=new Map;for(let n of Oh())for(let o of ya(n))if(o.some(i=>t.has(N(i))))for(let i of o)r.set(N(i),i);return r.size===e.length&&e.every(n=>r.get(N(n))===n)?e:r.size>0?[...r.values()]:e}function Rt(e){let t=Ct()?.group;if(t&&Z(t)===e)return t;for(let r of At())if(Z(r)===e)return r;return null}var Nh=Qe;function _0(e){return e==null?"(none)":Nh[e]??e}function C0(e){return e??"(no model)"}var Dh=class extends P{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 m;let n=l.filterAnalyzer===""?void 0:l.filterAnalyzer===gn?null:l.filterAnalyzer,o=l.filterModel===""?void 0:l.filterModel===bn?null:l.filterModel,i=new Map,s=new Map;for(let f of this.groups){let h=new Set,g=new Set;for(let b of f){let y=b._analyzer??null,v=ha(b);(o===void 0||v===o)&&h.add(y),(n===void 0||y===n)&&g.add(v)}for(let b of h)i.set(b,(i.get(b)??0)+1);for(let b of g)s.set(b,(s.get(b)??0)+1)}let a=n===void 0?null:_0(n),c=o===void 0?null:C0(o),u=a!=null&&c!=null?`${a} \xB7 ${c}`:a??c??(t?"All analyzers":"All models"),p=a!=null||c!=null;return d`<button type="button" class="${E({"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}">${t?this._column({dim:"analyzer",heading:"Analyzer",allLabel:"All analyzers",values:this.analyzers,sentinel:gn,labelOf:_0,counts:i,current:l.filterAnalyzer}):m} ${t&&r?d`<div class="analyzer-menu-sep"></div>`:m} ${r?this._column({dim:"model",heading:"Model",allLabel:"All models",values:this.models,sentinel:bn,labelOf:C0,counts:s,current:l.filterModel}):m}</div>`}_column({dim:t,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 ${t}`}"><div class="analyzer-menu-head">${r}</div><button type="button" aria-pressed="${String(c==="")}" class="${E({"analyzer-menu-item":!0,active:c===""})}" @click="${()=>this._pick(t,"")}"><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="${E({"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"?l.filterAnalyzer:l.filterModel,o=r!==""&&n===r?"":r;this.dispatchEvent(new CustomEvent("analyzer-change",{detail:{analyzer:t==="analyzer"?o:l.filterAnalyzer,model:t==="model"?o:l.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,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),t.style.top=`${c}px`,t.style.left=`${a}px`}updated(){this._open&&this.querySelector(".analyzer-menu")?.matches(":popover-open")&&this._position()}};customElements.define("analyzer-select",Dh);var ad=["type","model","effort","exportsMode"],E0=["security","correctness"],CR=["max","xhigh","high","medium","low","minimal"],ER=["list","isolate"];function Ph(e,t){if(t==null)return e.length+1;let r=e.indexOf(t);return r===-1?e.length:r}var AR={type:e=>e==="terminal"?E0.length+2:Ph(E0,e),model:e=>e==null?1:0,effort:e=>Ph(CR,e),exportsMode:e=>Ph(ER,e)};function RR(e,t,r){for(let n of r){let o=AR[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 A0(e,t,{typePrefix:r=!0}={}){return e==="type"?r?`analyzer: ${t??"null"}`:`${t??"null"}`:t??null}function TR(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("|"),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 R0(e,t=ad){let r=new Map;for(let h of e){let g={};for(let y of t)g[y]=y==="model"?ro(h.model)??null:h[y]??null;let b=t.map(y=>g[y]??"").join("|");r.has(b)||r.set(b,g)}let n=[...r.values()].toSorted((h,g)=>RR(h,g,t));if(n.length===0)return[];let o={};for(let h of t)o[h]=new Set(n.map(g=>g[h])).size===1;let i=t.filter(h=>!o[h]),s=i.includes("exportsMode")?TR(n,t):n,a=s.length>2&&i.includes("type")&&i.length>1,c=["model","effort"].filter(h=>t.includes(h)&&o[h]),u=[...c,...t.filter(h=>!c.includes(h))],p=[],f=!1;for(let h of u)if(o[h]){let g=A0(h,s[0][h]);g!=null&&p.push(g)}else if(!f){for(let g of s){let b=i.map(y=>A0(y,g[y],{typePrefix:!a})).filter(y=>y!=null);b.length>0&&p.push(b.join(" \xB7 "))}f=!0}return p}var ld=null;function IR(){return ld||(ld=(async()=>await import("./prism.js"))(),ld)}var LR={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"};function wa(e){if(typeof e!="string")return null;let t=e.slice(e.lastIndexOf("/")+1),r=t.lastIndexOf(".");return r<=0?null:LR[t.slice(r+1).toLowerCase()]??null}var FR={__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 T0(e){return typeof e!="string"?null:FR[e.toLowerCase()]??null}async function xn(e,t){if(!t)return null;try{return(await IR()).highlight(e,t)}catch{return null}}function I0(e){let t=[],r=[],n="",o=0;for(;o<e.length;){let i=e.indexOf("<",o),a=(i===-1?e.slice(o):e.slice(o,i)).split(`
|
|
117
|
-
`);n+=a[0];for(let p=1;p<a.length;p++){for(let f=r.length-1;f>=0;f--)n+=r[f].close;t.push(n),n=r.map(f=>f.open).join("")+a[p]}if(i===-1)break;let c=e.indexOf(">",i);if(c===-1){n+=e.slice(i);break}let u=e.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 t.push(n),t}var zh=new Map,Uh=new Set,Hh=!1;function MR(){Hh||(Hh=!0,queueMicrotask(()=>{Hh=!1,l.codeBlockTick++,x()}))}function jh(e,t){let r=T0(t);if(!r||!e)return null;let n=`${r}\0${e}`;return zh.has(n)?zh.get(n):(Uh.has(n)||(Uh.add(n),(async()=>{let o=await xn(e,r);zh.set(n,o??null),Uh.delete(n),MR()})()),null)}var BR=new Set(["module","commonjs","json","module-typescript","commonjs-typescript"]),OR=new Set(["solidity","php","shell","rust"]),DR=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"]),NR=new Set(["resource","resource:base64"]),M0=new Set(["stat:file","stat:directory"]),B0=new Set([...BR,...OR,...DR,...NR,"patch","directory",...M0]),Wh=e=>M0.has(e),L0=e=>e==="directory"||e==="stat:directory"?"directory":"file";function PR(e,t,r){if(e===t)return e;let n=Wh(e),o=Wh(t);if(n!==o&&L0(e)===L0(t))return n?t:e;throw new Error(`format conflict for '${r}' ('${t}' vs '${e}')`)}function ki(e,t){return t===""?e:e==="."?t:`${e}/${t}`}function O0(e,{scope:t="full"}={}){let r=new Set;for(let[n,{files:o}]of e)if(!(t!=="full"&&!Si(n)))for(let i of Object.keys(o))r.add(ki(n,i));return r}function zR(e,{what:t,files:r,formats:n,scope:o}){if(Ut(e))return"escapes the root";if(o!=="full"&&!Si(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":Wh(i)?`is a payload-free '${i}' record, not a file`:null}function D0(e,{what:t,files:r,formats:n,scope:o}){for(let i of e){let s=zR(i,{what:t,files:r,formats:n,scope:o});W(s===null,`${t}: executable entry '${i}' ${s}`)}}function N0(e,{what:t,files:r,formats:n,scope:o="full"}){if(e===void 0)return new Set;let i=`${t}: executable`;W(Array.isArray(e),`${i} must be an array of file paths`);let s=new Set;for(let a of e)W(typeof a=="string"&&a!=="",`${i} entry must be a non-empty string`),W(!s.has(a),`${i} entry '${a}' is listed twice`),s.add(a);return D0(s,{what:t,files:r,formats:n,scope:o}),s}function P0(e,{what:t,modules:r,formats:n,scope:o}){if(e.size!==0)return D0(e,{what:t,files:O0(r,{scope:o}),formats:n,scope:o}),cd(e)}function W(e,t){if(!e)throw new Error(t)}function xi(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 xa=e=>e&&[null,Object.prototype].includes(Object.getPrototypeOf(e)),$i=e=>Object.setPrototypeOf(Object.fromEntries(e),null),cd=e=>[...e].toSorted((t,r)=>xi(t,r)),ka=(e,{sorted:t=!0}={})=>{if(!t){let r=Object.create(null);for(let[n,o]of e)r[n]=o instanceof Map?ka(o,{sorted:t}):o;return r}return $i([...e].toSorted((r,n)=>xi(r[0],n[0])).map(([r,n])=>[r,n instanceof Map?ka(n,{sorted:t}):n]))},Vh=e=>new Map(Object.entries(e).map(([t,r])=>[t,xa(r)?Vh(r):r]));function Ut(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 UR(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 F0=e=>e instanceof Map?`{${[...e].map(([t,r])=>`${t}: ${r}`).join(", ")}}`:e;function z0(e,t,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)?W(UR(f.get(h),g),`${r}: import '${h}' from '${u}' resolves differently ('${F0(f.get(h))}' vs '${F0(g)}')`):f.set(h,g instanceof Map?new Map(g):g)}}};return o(e),o(t),n}function U0(e,t,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,PR(a,c,s))}catch(u){throw new Error(`${r}: ${u.message}`,{cause:u})}}};return o(e),o(t),n}function H0(e,t,r,n){if(e.size===0)return new Set(t);let o=O0(r,{scope:n}),i=new Set(t);for(let s of e)o.has(s)||i.add(s);return i}function j0(e,t,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}W(c.name===a.name,`${r}: module '${s}' name mismatch ('${c.name}' vs '${a.name}')`),W(c.version===a.version,`${r}: module '${s}' version mismatch ('${c.version}' vs '${a.version}')`),W(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)?W(c.files[u]===p,`${r}: content mismatch for '${ki(s,u)}'`):c.files[u]=p}};return o(e),o(t),n}function Si(e){return e.split("/").includes("node_modules")}function HR(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 W0(e){let t="node_modules/",r=HR(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(a=>!a))return null;let s=o.slice(0,i).join("/");return{dir:e.slice(0,n)+s,rel:o.slice(i).join("/"),name:s}}var $n=1,V0=0,K0=({name:e,version:t,ecosystem:r,files:n})=>(W(r===void 0||typeof r=="string"),{name:e,version:t,...r===void 0?{}:{ecosystem:r},files:$i(Object.entries(n))}),jR=e=>W0(e)??{dir:".",rel:e,name:null},G0=(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]=cd(new Set([...r[o]??[],...i]));return r},_i=class e{static VERSION=$n;version=$n;config;entries;modules;formats;imports;executable;reason;constructor({config:t={scope:"full"},entries:r,modules:n,formats:o,imports:i,executable:s,reason:a,version:c=$n}={}){W([V0,$n].includes(c)),W(["node_modules","full"].includes(t.scope)),this.version=c,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=a}get sources(){let t=new Map;for(let[r,{files:n}]of this.modules)for(let[o,i]of Object.entries(n))t.set(ki(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(ki(t,n))))return!0;return!1}static parse(t){let r=JSON.parse(t);W(r.version===$n||r.version===V0),W(["node_modules","full"].includes(r.config?.scope)),W(xa(r.formats)),W(xa(r.imports));let n=new Map;for(let[u,p]of Object.entries(r.formats)){W(!Ut(u)),W(B0.has(p),`unknown format '${p}' for ${u}`);let f=u===""?".":u;W(!n.has(f),`duplicate format key '${f}'`),n.set(f,p)}let o=new Map,i=new Set;if(r.version===$n){let u=r.config.scope==="full";if(r.modules!==void 0){W(typeof r.modules=="object"&&r.modules!==null);for(let[p,f]of Object.entries(r.modules))W(Si(p)),W(!Ut(p)),W(f?.name&&f.version&&f.files),o.set(p,K0(f))}if(u){W(r.sources&&typeof r.sources=="object");for(let[p,f]of Object.entries(r.sources))W(!Si(p)),W(!Ut(p)),W(f?.name&&f.version&&f.files),o.set(p,K0(f));W(r.entries===void 0||Array.isArray(r.entries)),i=new Set(r.entries)}else W(r.entries===void 0),W(r.sources===void 0);for(let[,{files:p}]of o)for(let f of Object.keys(p))W(!Ut(f))}else{W(r.sources);for(let[u,p]of Object.entries(r.sources)){W(!Ut(u));let{dir:f,rel:h,name:g}=jR(u);W(!Ut(f)&&!Ut(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=ki(u,f);W(!s.has(h),`duplicate file key '${h}' across bundle buckets`),s.add(h)}let a=Vh(r.imports),c=u=>{if(typeof u=="string"){W(!Ut(u));return}W(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)W(typeof p=="string"&&p.length>0&&!p.includes("/"),`invalid platform key '${p}'`),W(typeof f=="string"),W(!Ut(f))};for(let[,u]of a){W(u instanceof Map);for(let[p,f]of u){W(!Ut(p)),W(f instanceof Map);for(let[,h]of f)c(h)}}return new e({version:r.version,config:r.config,entries:i,modules:o,formats:n,imports:a,executable:r.version===$n?N0(r.executable,{what:"bundle",files:s,formats:n,scope:r.config.scope}):new Set,reason:xa(r.reason)?r.reason:void 0})}#e(){let t=[],r=[];for(let[n,{name:o,version:i,ecosystem:s,files:a}]of this.modules){if(Object.keys(a).length===0)continue;let c=Si(n);c&&W(o&&i&&a);let u=$i(Object.entries(a).toSorted((f,h)=>xi(f[0],h[0])));(c?t:r).push([n,{name:o,version:i,...s===void 0?{}:{ecosystem:s},files:u}])}return t.sort((n,o)=>xi(n[0],o[0])),r.sort((n,o)=>xi(n[0],o[0])),{modules:$i(t),sources:$i(r)}}serialize(){let t=cd(this.entries),{modules:r,sources:n}=this.#e(),o=ka(this.formats),i=ka(this.imports),s={version:$n,config:this.config};this.config.scope==="full"&&Object.assign(s,{entries:t,sources:n}),Object.assign(s,{modules:r,formats:o,imports:i});let a=P0(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(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:G0(this.reason,{[t]:r})})}merge(t){return W(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:j0(this.modules,t.modules,"bundle merge"),formats:U0(this.formats,t.formats,"bundle merge"),imports:z0(this.imports,t.imports,"bundle merge"),executable:H0(this.executable,t.executable,t.modules,this.config.scope),reason:G0(this.reason,t.reason)})}};var dd=null,ud=null;function WR(){for(let e of["br","brotli"])try{return new DecompressionStream(e),e}catch{}return null}async function VR(e,t){let r=new Blob([t]).stream().pipeThrough(new DecompressionStream(e));return new Uint8Array(await new Response(r).arrayBuffer())}async function KR(){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{}}var q0="./brotli-fallback.js",pd=Symbol("brotli worker unavailable"),br=null,Kh=!1,GR=0,Ci=new Map;function qR(){return ud||(ud=(async()=>await import(q0))(),ud)}function Gh(){Kh=!0,br&&(br.terminate(),br=null);let e=[...Ci.values()];Ci.clear();for(let t of e)t.resolve(pd)}function YR(e){let{id:t,bytes:r,error:n}=e.data??{},o=Ci.get(t);o&&(Ci.delete(t),n?o.reject(new Error(n)):o.resolve(r))}function XR(){if(br)return br;if(Kh||typeof Worker>"u")return null;try{br=new Worker(new URL(q0,import.meta.url),{type:"module"})}catch{return Kh=!0,null}return br.addEventListener("message",YR),br.addEventListener("error",Gh),br.addEventListener("messageerror",Gh),br}function JR(e){let t=XR();return t?new Promise((r,n)=>{let o=++GR;Ci.set(o,{resolve:r,reject:n});try{t.postMessage({id:o,bytes:e})}catch{Ci.delete(o),Gh(),r(pd)}}):Promise.resolve(pd)}async function ZR(){await KR();let e=WR();return e?{kind:"native",format:e}:{kind:"fallback"}}function Y0(){return dd||(dd=ZR(),dd)}async function X0(e){let t=await Y0();if(t.kind==="native")return VR(t.format,e);let r=await JR(e);return r!==pd?r:(await qR()).brotliDecompress(e)}Y0().catch(()=>{});function QR(){return{showAll:!1,splitOwnDirs:!1,packagesView:!1,bundleLayout:"graph",bundleReason:null,bundleReasonFor:null,selected:null,focusedPkg:null,topPkgsTab:"issues",edgeOpacity:.22,nodeSize:1,showLabels:!1,selectedSeverities:new Set,selectedColors:new Set,pathFilter:"",hidden:new Set,solo:null,graphState:null,layoutCache:null}}var Sn=QR(),_=new Proxy(Sn,{get(e,t){return Sn[t]},set(e,t,r){return Sn[t]=r,!0},has(e,t){return t in Sn},deleteProperty(e,t){return delete Sn[t]},ownKeys(){return Reflect.ownKeys(Sn)},getOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(Sn,t)}});function Ke(){_.graphState?._cleanup&&_.graphState._cleanup(),_.graphState=null}function J0(){return Sn}var qh=new WeakMap,Yh=new WeakMap;function tt(e){if(e?.metadataOnly)return new Map;let t=e?.bundle??e?.json;if(t&&qh.has(t))return qh.get(t);let r=new Map;if(!e)return r;if(e.kind==="stasis"){if(!e.bundle)return r;for(let[n,o]of e.bundle.sources)typeof o=="string"&&r.set(n,o)}else if(e.kind==="sourcemap"){if(!e.json)return r;let n=e.json.sources??[],o=e.json.sourcesContent??[];for(let i=0;i<n.length;i++)typeof o[i]=="string"&&r.set(n[i],o[i])}return t&&qh.set(t,r),r}function _n(e){if(e?.fileSizes)return e.fileSizes;let t=e?.bundle??e?.json;if(t&&Yh.has(t))return Yh.get(t);let r=new Map,n=new TextEncoder,o=tt(e),i=e?.kind==="stasis"?e.bundle?.sources.keys():e?.json?.sources;for(let s of i??[]){let a=o.get(s);r.set(s,typeof a=="string"?n.encode(a).byteLength:null)}return t&&Yh.set(t,r),r}function Cn(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 $a(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 fd=new WeakMap,eT=new Set(["terminal","code","search","compare"]);function Ei(e,t=null){return!!t||eT.has(e)}function Sa(e){if(e.fileHashes)return Promise.resolve(e.fileHashes);if(fd.has(e))return fd.get(e);let t=(async()=>{let r=[...tt(e)],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 Sp(a)]));for(let[s,a]of i)n.set(s,a)}return e.fileHashes=n,n})();return fd.set(e,t),t.catch(()=>fd.delete(e)),t}function Jh(e){return typeof e!="string"||e.length===0?0:(e.match(/\r\n|\r|\n/gu)?.length??0)+(/[\r\n]$/u.test(e)?0:1)}function Xh(e){return e instanceof Map?Object.fromEntries([...e].map(([t,r])=>[t,Xh(r)])):e}async function Z0(e){let t=await Sa(e),r=_n(e),n=e.lineCounts??=new Map([...tt(e)].map(([i,s])=>[i,Jh(s)])),o={version:1,integrity:e.integrity,kind:e.kind,size:e.size,files:[...r].map(([i,s])=>[i,s,t.get(i)??null,n.get(i)??null])};if(e.kind==="sourcemap"){let{version:i,file:s,sourceRoot:a,names:c,sources:u=[],sourcesContent:p=[]}=e.json;o.json={version:i,file:s,sourceRoot:a,sources:u};let f=new TextEncoder;o.sourceSizes=u.map((h,g)=>typeof p[g]=="string"?f.encode(p[g]).byteLength:null),o.namesCount=c?.length??null}else{let i=e.bundle,s={version:i.version,config:i.config,formats:Xh(i.formats),imports:Xh(i.imports),reason:i.reason};if(i.version===0)s.sources=Object.fromEntries([...r.keys()].map(a=>[a,null]));else{let a={},c={};for(let[u,p]of i.modules){let f=u.split("/").includes("node_modules")?a:c;Object.defineProperty(f,u,{enumerable:!0,value:{name:p.name,version:p.version,ecosystem:p.ecosystem,files:Object.fromEntries(Object.keys(p.files).map(h=>[h,null]))}})}s.modules=a,i.config.scope==="full"&&(s.sources=c,s.entries=[...i.entries])}o.bundle=s}return o}function Q0(e,t){if(e?.version!==1||e.integrity!==t||!["stasis","sourcemap"].includes(e.kind)||!Number.isSafeInteger(e.size)||e.size<0||!Array.isArray(e.files))throw new Error("Invalid bundle metadata");let r=new Map,n=new Map,o=new Map,i=!1;for(let a of e.files){if(!Array.isArray(a)||a.length!==3&&a.length!==4)throw new Error("Invalid bundle metadata file");let[c,u,p,f]=a;if(a.length===3&&(i=!0),typeof c!="string"||n.has(c)||u!==null&&(!Number.isSafeInteger(u)||u<0)||(u===null?p!==null:typeof p!="string"||!/^sha512-[A-Za-z0-9+/]{86}==$/u.test(p))||f!=null&&(!Number.isSafeInteger(f)||f<0))throw new Error("Invalid bundle metadata file");n.set(c,u),p!==null&&r.set(c,p),f!=null&&o.set(c,f)}let s={integrity:t,kind:e.kind,size:e.size,metadataOnly:!0,fileSizes:n,fileHashes:r,lineCounts:o,needsLineCounts:i};if(e.kind==="stasis"){s.bundle=_i.parse(JSON.stringify(e.bundle));let a=s.bundle.sources;if(a.size!==n.size||[...a.keys()].some(c=>!n.has(c)))throw new Error("Invalid bundle metadata inventory")}else{if(!e.json||typeof e.json!="object"||![null,void 0].includes(e.namesCount)&&(!Number.isSafeInteger(e.namesCount)||e.namesCount<0))throw new Error("Invalid sourcemap metadata");if(!Array.isArray(e.json.sources)||e.json.sources.some(a=>!n.has(a))||!Array.isArray(e.sourceSizes)||e.sourceSizes.length!==e.json.sources.length||e.sourceSizes.some(a=>a!==null&&(!Number.isSafeInteger(a)||a<0)))throw new Error("Invalid sourcemap inventory");s.json=e.json,s.sourceSizes=e.sourceSizes,s.namesCount=e.namesCount}return s}var tT=new Map,rT=new Map,Zh=new WeakMap;async function Qh(e){try{let t=await Xu(e);return t?Q0(t,e):null}catch{return null}}function So(e,t,{sources:r=!0}={}){let n=r?tT:rT,o=t.name.toLowerCase().endsWith(".map")?"sourcemap":"stasis",i=l.bundleDetails;if(i?.integrity===e&&i.kind===o&&!i.error&&(!r||!i.metadataOnly))return Promise.resolve(i);let s=`${e}:${o}`;if(n.has(s))return n.get(s);let a=(async()=>{if(!r){let p=await Qh(e);return p?.kind===o&&!p.needsLineCounts?p:So(e,t)}let[c,u]=await Promise.all([nT(e,t),Qh(e)]);return c.error||(u?.kind===c.kind&&(c.fileHashes=u.fileHashes,c.fileSizes=u.fileSizes,u.needsLineCounts||(c.lineCounts=u.lineCounts)),(!u||u.kind!==c.kind||u.needsLineCounts)&&Z0(c).then(p=>Ju(e,p)).catch(()=>{})),c})();return n.set(s,a),a.finally(()=>{n.get(s)===a&&n.delete(s)}).catch(()=>{}),a}function En(e,t="overview"){l.currentView="bundles",l.selectedBundle=e,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=t,_.showAll=!0,l.shownTriage=null}async function nT(e,t){try{let r=await Cr(e),n=t.name.toLowerCase().endsWith(".map"),o=n?"sourcemap":"stasis";try{if(n){let a=JSON.parse(Le(r));return{integrity:e,kind:o,size:r.byteLength,json:a}}let i=Le(await X0(r)),s=_i.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 oT(e){if(!(!e?.json&&!e?.bundle)){if(e.fileHashes){Bs(e.integrity,e.fileHashes);return}(async()=>{try{let t=await Sa(e);if(Bs(e.integrity,t),l.bundleDetails!==e)return;e.fileHashes=t,x()}catch{}})()}}async function _a(e){if(Wp(e)||!(l.bundles??[]).find(n=>n.integrity===e))return;let r=await Qh(e);if(!(!r?.json&&!r?.bundle))try{let n=await Sa(r);Bs(e,n)}catch{}}async function Pr(e){let t=(l.bundles??[]).find(n=>n.integrity===e);if(!t)return;let r=await So(e,t,{sources:Ei(l.bundleDetailsTab,l.bundleSourceFile)});l.selectedBundle===e&&(l.bundleDetails=r,x(),oT(r),Ot().catch(()=>{}))}function _o(e=l.bundleDetails){if(!e?.metadataOnly)return Promise.resolve(e);if(Zh.has(e))return Zh.get(e);let t=(l.bundles??[]).find(n=>n.integrity===e.integrity);if(!t)return Promise.resolve(null);let r=So(e.integrity,t).then(n=>(l.bundleDetails!==e||(n.error||(n.fileHashes=e.fileHashes,n.fileSizes=e.fileSizes),l.bundleDetails=n,x()),n));return Zh.set(e,r),r}function hd(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 iT=[];function em(e,t,r){if(!r)return null;if(!Array.isArray(e)||e.length===0||!hd(e[0],r))return{stack:iT,at:0,pos:r};let n=Math.min(Math.max(t,0),e.length-1);return{stack:e,at:n,pos:e[n]}}function ex({stack:e,at:t,base:r},n){let o=e.length>0?e[t]:r;if(hd(o,n))return null;let i=e.length>0?e.slice(0,t+1):[r];return{stack:[...i,n],at:i.length}}function tx(e,t,r){return!Array.isArray(e)||e.length===0?0:Math.min(Math.max(t+r,0),e.length-1)}function md(e,t){if(!e||!t||t.length===0)return;let r=e.getBoundingClientRect().top,n=t[0].getBoundingClientRect(),o=t.item(t.length-1).getBoundingClientRect(),i=n.top-r+e.scrollTop,s=o.bottom-r+e.scrollTop,a=i+(s-i)/2-e.clientHeight/2;e.scrollTo({top:Math.max(0,Math.min(a,i-n.height)),behavior:"instant"})}var Ca=new Map,Ea=new Map,tm=new Set;function sT(e,t,r){let n=`${e}\0${t}`;if(Ea.has(n)||tm.has(n))return;let o=wa(t);if(!o){Ea.set(n,null);return}tm.add(n),(async()=>{let i=await xn(r,o);Ea.set(n,i??null),tm.delete(n),l.focusCodeTick++,queueMicrotask(x)})()}async function aT(e){let t=Ca.get(e);if(t&&(t.loading||t.sources))return;let r=(l.bundles??[]).find(n=>n.integrity===e);if(r){Ca.set(e,{sources:null,loading:!0,error:null});try{let n=await So(e,r),o=tt(n);Ca.set(e,{sources:o,loading:!1,error:n.error??null})}catch(n){Ca.set(e,{sources:null,loading:!1,error:n.message})}l.focusCodeTick++,queueMicrotask(x),queueMicrotask(An)}}function An(){let e=R.querySelectorAll(".focus-code-line-active");e.length!==0&&md(e[0].closest(".focus-code-body"),e)}function gd(e){let t=e?._bundleHashes;return!e?.fileHash||!Array.isArray(t)||t.length===0?null:ho(e.fileHash).find(({integrity:r})=>t.includes(r))??null}function Ai(e,t,{kick:r=!0}={}){let n=Ca.get(e);if(!n)return r?(aT(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;sT(e,t,o);let i=`${e}\0${t}`;return{content:o,highlighted:Ea.has(i)?Ea.get(i):void 0,loading:!1}}function rx(e){let t=gd(e);return t?{integrity:t.integrity,file:t.file,range:mt(e.line)}:null}function lT(e){return e?rx(Je(e)):null}function Aa(e){let t=lT(e);return t?{base:t,...em(l.focusCodeStack,l.focusCodeAt,t)}:null}function nx(e){let t=rx(e);return t?em(l.focusCodeStack,l.focusCodeAt,t).pos:null}function ox(e){let t=Aa(e);if(!t)return null;let{pos:r}=t,n=Ai(r.integrity,r.file);return!n||n.loading?n:{...n,file:r.file,integrity:r.integrity,range:r.range}}function ct(e){return e==="informational"?"info":e.replaceAll("_"," ")}function rm(e,{variant:t="full"}={}){let r=l.severityMode,n=ee(e,r),o=d`<span class="${`badge ${n}`}">${ct(n)}</span>`,i=xt(e),s=t==="tab"?null:Xo(e);if(!i&&!s)return o;let a=s?`Corrected severity varies across reports \u2014 ${Object.entries(s).map(([$,A])=>`${$||"(this report)"}: ${ct(A.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-${t}`}">${o}${c}</span>`;let u=e.severity,p=ir(e),f=e.correctedSeverityReason,h=(Se[p]??0)>(Se[u]??0),g=h?"up":"down",b=h?"\u25B2":"\u25BC",y=r!=="original",v=(y?`Corrected ${g} from ${ct(u)}`:`Original severity \u2014 corrected ${g} to ${ct(p)}`)+(f?` \u2014 ${f}`:""),k=`Severity ${ct(n)}; ${y?`corrected ${g} from ${ct(u)}`:`original, corrected to ${ct(p)}`}${f?`; reason: ${f}`:""}`;if(t==="tab")return d`<span class="badge-pair badge-pair-tab" title="${v}" aria-label="${k}">${o}<span class="${`badge-corr-mark ${g}`}" aria-hidden="true">${b}</span></span>`;let w=y?u:p;return d`<span class="${`badge-pair badge-pair-${t}`}" title="${v}" aria-label="${k}">${o}<span class="badge-orig-wrap"><span class="${`badge-arrow ${g}`}" aria-hidden="true">${b}</span>${y?d`<span class="badge-pre" aria-hidden="true">was</span>`:m}<span class="${`badge-orig ${w}${y?" struck":""}`}">${ct(w)}</span></span>${c}</span>`}var ix=/\[[^\]\n]+\]\([^)\s]+\)|\*\*[^*\n]+\*\*|"[^"\n]+"|`[^`\n]+`/gu;function Ta(e){ix.lastIndex=0;let t=[],r=0,n;for(;(n=ix.exec(e))!==null;){n.index>r&&t.push(e.slice(r,n.index));let o=n[0].codePointAt(0);if(o===91){let i=Wk(n[0]);t.push(i?d`<a href="${i.url}" target="_blank" rel="noopener noreferrer" data-tooltip="${i.url}">${i.label}</a>`:n[0])}else o===42?t.push(d`<strong>${n[0].slice(2,-2)}</strong>`):o===96?t.push(d`<span class="inline-code">${n[0].slice(1,-1)}</span>`):t.push(d`<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 cT({lang:e,code:t}){l.codeBlockTick;let r=jh(t,e);return d`<div class="code-block" data-lang="${e||m}">${e?d`<div class="code-block-lang">${e}</div>`:m}<pre><code>${r?re(r):t}</code></pre></div>`}function dT(e,{wrap:t=!1}={}){let r=e.split(/\n{2,}/u).filter(n=>n.trim());return r.length<2?t?d`<div class="para">${Ta(e)}</div>`:Ta(e):r.map(n=>d`<div class="para">${Ta(n)}</div>`)}function uT({ordered:e,start:t,items:r}){let n=r.map(o=>d`<li>${Ht(o)}</li>`);return e?d`<ol class="md-list" start="${t>1?t:m}">${n}</ol>`:d`<ul class="md-list">${n}</ul>`}function Ht(e,{paragraphs:t=!0}={}){if(!e)return e;let r=t?Uk(e):[e],n=r.length>1,o=s=>t?dT(s,{wrap:n}):Ta(s),i=s=>{let a=zk(s);return a.length===1&&typeof a[0]=="string"?o(a[0]):a.map(c=>typeof c=="string"?o(c):cT(c))};return r.length===1&&typeof r[0]=="string"?i(r[0]):r.map(s=>typeof s=="string"?i(s):uT(s))}function pT(e){return qk(e).map(t=>typeof t=="string"?t:t.self?d`<a class="comment-self-ref" href="${t.url}" data-tooltip="Show this finding">${t.label}</a>`:d`<a href="${t.url}" target="_blank" rel="noopener noreferrer" data-tooltip="${t.url}">${t.label}</a>`)}function fT(e){let t=new Set;for(let r of e)t.add(Fe(r));return[...t]}function hT(e){let t=Fe(e);return lh[t]??t}function mT(e,t){l.linksTick,l.findingIndexTick;let r=N(e),n=Dt(r)?bo(r).filter(o=>!t.has(o)):[];return n.length===0?m:d`<div class="duplicates-block"><span class="duplicates-label">Duplicates:</span>${n.map(o=>{let i=pa(o),s=fo(o),a=s.length===0?"":` \u2014 in ${s.map(c=>`${he(c)} (${hT(c)})`).join(", ")}`;return d`<a class="duplicate-ref" href="${`#${mo({id:o})}`}" data-tooltip="${`${i}${a}`}">${fT(s).map(c=>re(ce[c]??ce.default))}<span class="duplicate-ref-id">${ko(o)??i}</span></a>`})}</div>`}function gT(e){let t=hh(e);return t?d`<span class="${`revalidate-stamp ${t}`}">${t}</span><div class="value-label">Revalidation</div>`:m}function bT(e){let t=ph()?at(e.revalidateVerdict,e):"";return t?d`<div class="revalidate-verdict">${Ht(bi(t))}</div>`:m}function Ra(e,t,r="section",{collapsible:n=!1}={}){let o=t?d`<div class="section-body">${Ht(bi(t))}</div>`:m;return!n||!t?d`<div class="${r}"><div class="section-label">${e}</div>${o}</div>`:d`<details class="${r}"><summary class="section-label">${e}</summary>${o}</details>`}function yT(e,t,r){let n=e&&t?.file?Os(e.integrity,t.file):null;return n?d`<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>`:d`<span class="evidence-ref">${r}</span>`}function vT(e,t){let r=Array.isArray(e.evidence)?e.evidence:[];if(r.length===0)return m;let n=Et(e),o=gd(e),i=t==="focus"&&o!==null,s=i?nx(e):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=Ye(a),p=Jc(a,e,n,c),f=oo(a),h=lx(e,`ev${c}`,o,a?.file,a?.line),g=nm(p),b=i&&hd(s,{integrity:o.integrity,file:Os(o.integrity,a?.file),range:mt(a?.line)});return d`<li class="${E({current:b})}">${i?yT(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">${Ht(bi(f))}</div>`:m} ${h?.body??m}</li>`})}</ol></details>`}function ax(e,t){let r=Ye(e);return t?d`<a href="${t}" target="_blank" rel="noopener">${r}</a>`:r}function wT(e,t){if(!t)return m;let r=t.slice(0,7),n=Zc(e,t);return n?d`<a href="${n}" target="_blank" rel="noopener" data-tooltip="${t}">${r}</a>`:d`<span title="${t}">${r}</span>`}var yd=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>`,Ia=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>`,kT=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>`,xT=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>`,$T=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>`,ST=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>`;function nm(e){let t=Dk(e);return t?d`<a class="gh-ref-btn" href="${e}" target="_blank" rel="noopener noreferrer" data-tooltip="${t}" aria-label="${`Open ${t} on GitHub`}">${ST}</a>`:m}function _T(e,t,r,n){return`${N(e)}\0${t}\0${r}\0${n?`${n.start}-${n.end}`:""}`}var Ri={key:null,host:null};function bd(e,t){if(Ri.key===e)return;let r=Ri.host,n=e===null?null:t?.getRootNode?.()?.host??null;Ri={key:e,host:n},r?.requestUpdate?.(),n!==r&&n?.requestUpdate?.()}function sx(e,t,r){l.codeBlockTick;let{text:n,lines:o,startLine:i}=Hk(e,t);if(o.length===0)return m;let s=r.lastIndexOf("."),a=jh(n,s<0?"":r.slice(s+1)),c=i+o.length-1;return d`<div class="code-preview" style="${pe({"--lineno-width":`${String(c).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 d`<div class="${E({"code-preview-lineno":!0,cited:h})}">${f}</div>`})}</aside><pre class="code-preview-source"><code>${a?re(a):n}</code></pre></div>`}function lx(e,t,r,n,o){if(l.bundleHashTick,!r||!n)return null;let i=Os(r.integrity,n);if(!i)return null;let s=mt(o),a=_T(e,t,n,s),c=l.codePreviews.has(a);l.focusCodeTick;let u=d`<button type="button" class="${E({"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=>{bd(a,h.currentTarget),Ai(r.integrity,i)}}" @mouseleave="${h=>{Ri.key===a&&bd(null,h.currentTarget)}}" @focus="${h=>{bd(a,h.currentTarget),Ai(r.integrity,i)}}" @blur="${h=>{Ri.key===a&&bd(null,h.currentTarget)}}">${$T}</button>`;if(c){let h=Ai(r.integrity,i),g=!h||h.loading?d`<div class="code-preview code-preview-pending">${h?"Loading source\u2026":"Source unavailable"}</div>`:sx(h.content,s,i);return{mark:u,tip:m,body:g}}if(Ri.key!==a)return{mark:u,tip:m,body:m};let p=Ai(r.integrity,i,{kick:!1}),f=p&&!p.loading?d`<div class="code-preview-tip" role="tooltip">${sx(p.content,s,i)}</div>`:m;return{mark:u,tip:f,body:m}}var CT=d`<svg viewBox="4 5 8 8" width="11" height="11" fill="currentColor" aria-hidden="true"><path d="${zc}/"></path></svg>`,ET=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>`,vd=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>`;function AT(e,t=!1){let r=de(e)?.flagged===!0,n=r?"Remove flag":"Flag this finding";return d`<button type="button" class="${E({"mark-flag":!0,flagged:r})}" data-flag-toggle="${N(e)}" ?disabled="${!_e(e)}" aria-label="${n}" aria-pressed="${String(r)}">${vd}${t?d`<span class="mark-btn-label">${r?"Flagged":"Flag"}</span>`:m}</button>`}function RT(e){let t=qe(e)||e.file||"Security finding";return t.length>120?`${t.slice(0,119)}\u2026`:t}function TT(e){let t=fr(e,Et(e)),r=Ye(e),n=[];e.file&&n.push(`File: ${t?`[${r}](${t})`:r}`),e.description&&n.push(e.description);let o=yh(e);return o&&n.push(o),e.confidence!==void 0&&e.confidence!==null&&n.push(`Confidence: ${e.confidence}/10`),n.join(`
|
|
103
|
+
`)}function M_(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&&T6.test(t)}function c_(t){return t.length<=100&&t!=="."&&t!==".."&&I6.test(t)}function O6(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(!L6.test(s))return null;a=`${n}/${o}#${s}`}else if(i==="commit"){if(!F6.test(s))return null;a=`${n}/${o}@${s.slice(0,7)}`}else return null;let c=B6.test(e.hash)?e.hash:"";return{url:`https://github.com/${n}/${o}/${i}/${s}${c}`,label:a}}function Mi(t){if(typeof t!="string")return null;let e=Gl(t);return e!==t||P6.test(t)?e.slice(0,8):null}function Gl(t){let e=String(t),r="https://chatgpt.com/codex/cloud/security/findings/";return e.startsWith(r)?e.slice(r.length):e}function N6(t){let e=u$(t);if(!e)return null;let r=Mi(e.id);return{url:`#${e.fragment}`,label:r?`finding ${r}`:"finding",self:!0}}function z6(t){let e=t.length;for(;e>0&&D6.has(t[e-1]);)e--;return e===t.length?t:t.slice(0,e)}function T_(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=z6(n[0]),i=o?O6(o)??N6(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 Ls,u_,Vu,Ku,h_,m_,Vl,ob,g_,Jg,g6,y6,x6,$6,_6,o_,S6,Zg,i_,A6,M6,T6,I6,L6,F6,B6,a_,P6,Qg,D6,ue=w(()=>{"use strict";Oe();Xg();hl();Ls=!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"),Vl="node_modules",ob=qu(Vl),g_=f_(Vl);Jg=new WeakSet;g6=/^(.*(?:^|\/)node_modules\/(?:@[^/]+\/[^/]+|[^/]+))(?:\/|$)/u;y6=/^(?:@[\w.-]+\/)?[\w.-]+@[^/\s@]+$/u;x6=/^https?:\/\/(?:www\.)?github\.com\/([^/\s]+\/[^/\s]+)\/(?:blob|tree|blame)\/[^/\s]+\/(\S+)$/u,$6=/#L(\d+)(?:-L?(\d+))?$/u;_6=/^(?:\s+\S|[-*+] |\d+[.)] |>|#{1,6} |\||`{3}|~{3})/u;o_=/^( *)(`{3,}|~{3,})(.*)$/u,S6=/^[a-z0-9+#._-]{1,20}$/u;Zg=/^( *)(?:[-*+]|(\d{1,9})[.)]) +(?=\S)/u,i_=/^ {0,3}([-*_])(?: *\1){2,} *$/u;A6=/^(\d+)(?:\s*-\s*(\d+))?$/u;M6=[["Impact","impact"],["Reproduction","reproduction"],["Recommendation","recommendation"],["Confidence reason","confidenceReason"],["Revalidation verdict","revalidateVerdict"],["Revalidation recommendation","revalidateRecommendation"]];T6=/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u,I6=/^[a-zA-Z\d._-]+$/u,L6=/^[1-9]\d{0,9}$/u,F6=/^[a-fA-F\d]{7,40}$/u,B6=/^#[\w-]+$/u,a_=/^GHSA(?:-[0-9a-z]{4}){3}$/u;P6=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/u;Qg=/https?:\/\/[^\s<>"'`(){}[\]|\\^]+/giu,D6=new Set([")",".",",","!","?",";",":","'",'"',"*","]","}",">"])});function ep(){let t=new Set;if(l.currentWorkspace||!Cl())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)&&vi(o).some(i=>i!==e))&&t.add(n);return t}var ab=w(()=>{"use strict";O()});function Yl(t){return ci(t.model)||null}function lb(t){let e=An();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=Yl(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 Bs(){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 U6){let r=l[e];t[e]=r instanceof Set?new Set(r):r}return t}function Xl(t){db=t}function Jl(){db=null}function An(){return db??l}function ql(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=>ql(r)!==void 0))&&t.some(e=>e.some(H6))}function O_(t,e){return t.some(r=>{let n=nb(r)?0:ql(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=>ql(i)!==void 0)))return 0;let r=o=>e.reduce((i,s)=>i+(s.some(a=>(ql(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||Mn())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 Os(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=An();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:ql(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 j6(t){if(!H_(t))return!1;let e=An(),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=ve(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=ve(t),o=y_(t).includes(r)||(n?.comment??"").toLowerCase().includes(r)||(n?.fix??"").toLowerCase().includes(r);return e.filterIncludeNegate?!o:o}return!0}function V6(t){let e=An();if(!e.filterComment&&!e.filterFix&&!e.filterFlagged)return!0;let r=n=>t.some(o=>n(ve(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 W6(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=W6(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&&An().filterDuplicates,r=e?ep():null,n=An().filterCrossContext,o=An().filterAppStacked;return t.filter(i=>i.some(j6)&&V6(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=K6[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)||Rn(o.g).file.localeCompare(Rn(i.g).file)}).map(o=>o.g)}return t.map(r=>({p:Rn(r),g:r})).toSorted((r,n)=>e(r.p,n.p)).map(r=>r.g)}var vo,Ti,wo,U6,db,H6,L_,K6,Xr=w(()=>{"use strict";O();ue();ot();ab();vo="\0",Ti="",wo="";U6=["filterSeverities","filterColors","filterSources","filterAnalyzer","filterModel","filterRepo","filterConfMin","filterConfMax","filterInclude","filterIncludeNegate","filterComment","filterFix","filterFlagged","filterDuplicates","filterCrossContext","filterAppStacked","filterRevalidate","filterPartial"];db=null;H6=t=>t.confidence!==void 0||t.critical===!0;L_=W_("desc"),K6={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(li);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("_")||G6.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 G6,vb=w(()=>{"use strict";Oe();bb();ue();G6=new Set(["correctedSeverity","correctedSeverityReason","isApp","isUpstream","source"])});function Zl(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=Zl(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 Zl(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"&&Ps?.owner===l.currentLinks?Ps:null}function op(){xb++,Ps=null}async function Q_(t,e,r){if(l.currentView!=="links"||!l.currentLinks)return;let n=md(l.currentLinks),o=++xb;Ps={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:mi(p?.repo),_bundleHashes:p.bundleHashes??[],_source:h.source??p.source??null};return hi(g,p),g._analyzer=g._source??g.type??null,"isApp"in g||(g.isApp=vn(g,g._source)),g});await Promise.all([Si(),jt("report",e),..._l(e).map(h=>jt("workspace",h.id))]),i()&&(Ps.group=f,l.activeTabByGroup.set(f[0].id,t))}catch(s){i()&&(Ps.error=s.message||"Unable to load this finding.")}}var Ps,xb,ip=w(()=>{"use strict";O();gd();Oe();Ps=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 Mn(){return l.revalidationDetailed===!0}function _b(t){return t?._reportName??""}function q6(){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||!q6()}function ve(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 Ql(t,e=ve(t)){if(De(t))return e?.triage??(Sb(t)?"ignored":void 0)}function dr(t){return Gt()?.group===t?t:t.linkedTabs?t.linkedTabs:Mn()?t:oS(t)}function oS(t){return t.length<=1||!t.some(Wl)?t:t.filter(Wl)}function Zr(t){let e=dr(t);return e.length<=1?e:[...e].toSorted((r,n)=>{let o=Wl(r)?1:0,i=Wl(n)?1:0;if(o!==i)return i-o;let s=ve(r)?.color?1:0,a=ve(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 Rn(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 Y6(t){let e=ve(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(Y6)??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 Ns(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=Ns(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=ve(v),k=Ql(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=(ve(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=Ns(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)&&Ns(t)!==t||!e.hasConflict?e.commonTriage??null:Ql(r??ft(t))??null}function ap(t){let e=Ns(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);Ql(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 Ab(){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=Mn();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 Mn()?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 Tn(){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 Ab())for(let o of Zl(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)":Mb[t]??t}function fS(t){return t??"(no model)"}var Mb,Rb,Tb=w(()=>{"use strict";T();Te();$e();O();Xr();Oe();Mb=ct;Rb=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=Yl(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",Rb)});function Ib(t,e){if(e==null)return t.length+1;let r=t.indexOf(e);return r===-1?t.length:r}function Q6(t,e,r){for(let n of r){let o=Z6[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 eF(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"?ci(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)=>Q6(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")?eF(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,X6,J6,Z6,bS=w(()=>{"use strict";ue();cp=["type","model","effort","exportsMode"],hS=["security","correctness"],X6=["max","xhigh","high","medium","low","minimal"],J6=["list","isolate"];Z6={type:t=>t==="terminal"?hS.length+2:Ib(hS,t),model:t=>t==null?1:0,effort:t=>Ib(X6,t),exportsMode:t=>Ib(J6,t)}});function tF(){return dp||(dp=(async()=>await import("./prism.js"))(),dp)}function ec(t){if(typeof t!="string")return null;let e=t.slice(t.lastIndexOf("/")+1),r=e.lastIndexOf(".");return r<=0?null:rF[e.slice(r+1).toLowerCase()]??null}function yS(t){return typeof t!="string"?null:nF[t.toLowerCase()]??null}async function _o(t,e){if(!e)return null;try{return(await tF()).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,rF,nF,tc=w(()=>{"use strict";dp=null;rF={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"};nF={__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 oF(){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),oF()})()),null)}var Lb,Fb,Bb,wS=w(()=>{"use strict";O();tc();St();Lb=new Map,Fb=new Set,Bb=!1});function cF(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 Ds(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"&&!Hs(n)))for(let i of Object.keys(o))r.add(Ds(n,i));return r}function dF(t,{what:e,files:r,formats:n,scope:o}){if(pr(t))return"escapes the root";if(o!=="full"&&!Hs(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=dF(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 AS(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 zs(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 uF(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 RS(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(uF(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 MS(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,cF(a,c,s))}catch(u){throw new Error(`${r}: ${u.message}`,{cause:u})}}};return o(t),o(e),n}function TS(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 '${Ds(s,u)}'`):c.files[u]=p}};return o(t),o(e),n}function Hs(t){return t.split("/").includes("node_modules")}function pF(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=pF(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 iF,sF,aF,lF,$S,_S,Pb,kS,nc,Us,up,rc,Nb,xS,FS=w(()=>{iF=new Set(["module","commonjs","json","module-typescript","commonjs-typescript"]),sF=new Set(["solidity","php","shell","rust"]),aF=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"]),lF=new Set(["resource","resource:base64"]),$S=new Set(["stat:file","stat:directory"]),_S=new Set([...iF,...sF,...aF,...lF,"patch","directory",...$S]),Pb=t=>$S.has(t),kS=t=>t==="directory"||t==="stat:directory"?"directory":"file";nc=t=>t&&[null,Object.prototype].includes(Object.getPrototypeOf(t)),Us=t=>Object.setPrototypeOf(Object.fromEntries(t),null),up=t=>[...t].toSorted((e,r)=>zs(e,r)),rc=(t,{sorted:e=!0}={})=>{if(!e){let r=Object.create(null);for(let[n,o]of t)r[n]=o instanceof Map?rc(o,{sorted:e}):o;return r}return Us([...t].toSorted((r,n)=>zs(r[0],n[0])).map(([r,n])=>[r,n instanceof Map?rc(n,{sorted:e}):n]))},Nb=t=>new Map(Object.entries(t).map(([e,r])=>[e,nc(r)?Nb(r):r]));xS=t=>t instanceof Map?`{${[...t].map(([e,r])=>`${e}: ${r}`).join(", ")}}`:t});var So,BS,OS,fF,PS,Rr,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:Us(Object.entries(n))}),fF=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},Rr=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(Ds(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(Ds(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(nc(r.formats)),Q(nc(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(Hs(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(!Hs(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}=fF(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=Ds(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:nc(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=Hs(n);c&&Q(o&&i&&a);let u=Us(Object.entries(a).toSorted((f,h)=>zs(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)=>zs(n[0],o[0])),r.sort((n,o)=>zs(n[0],o[0])),{modules:Us(e),sources:Us(r)}}serialize(){let e=up(this.entries),{modules:r,sources:n}=this.#e(),o=rc(this.formats),i=rc(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=AS(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:MS(this.formats,e.formats,"bundle merge"),imports:RS(this.imports,e.imports,"bundle merge"),executable:TS(this.executable,e.executable,e.modules,this.config.scope),reason:PS(this.reason,e.reason)})}}});function hF(){for(let t of["br","brotli"])try{return new DecompressionStream(t),t}catch{}return null}async function mF(t,e){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream(t));return new Uint8Array(await new Response(r).arrayBuffer())}async function gF(){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 yF(){return hp||(hp=(async()=>await import(NS))(),hp)}function zb(){Db=!0,Qr&&(Qr.terminate(),Qr=null);let t=[...js.values()];js.clear();for(let e of t)e.resolve(mp)}function vF(t){let{id:e,bytes:r,error:n}=t.data??{},o=js.get(e);o&&(js.delete(e),n?o.reject(new Error(n)):o.resolve(r))}function wF(){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",vF),Qr.addEventListener("error",zb),Qr.addEventListener("messageerror",zb),Qr}function kF(t){let e=wF();return e?new Promise((r,n)=>{let o=++bF;js.set(o,{resolve:r,reject:n});try{e.postMessage({id:o,bytes:t})}catch{js.delete(o),zb(),r(mp)}}):Promise.resolve(mp)}async function xF(){await gF();let t=hF();return t?{kind:"native",format:t}:{kind:"fallback"}}function DS(){return fp||(fp=xF(),fp)}async function zS(t){let e=await DS();if(e.kind==="native")return mF(e.format,t);let r=await kF(t);return r!==mp?r:(await yF()).brotliDecompress(t)}var fp,hp,NS,mp,Qr,Db,bF,js,Ub=w(()=>{"use strict";fp=null,hp=null;NS="./brotli-fallback.js",mp=Symbol("brotli worker unavailable"),Qr=null,Db=!1,bF=0,js=new Map;DS().catch(()=>{})});function $F(){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(){A.graphState?._cleanup&&A.graphState._cleanup(),A.graphState=null}function US(){return Co}var Co,A,Eo=w(()=>{"use strict";Co=$F(),A=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"&&(Rr.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 Ii(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 SF(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&&_F.indexOf(r.at(-1))&(n===2?15:3)?null:Math.floor(r.length*3/4)}function qb(t){return typeof t=="string"?qo(t):t?.format==="base64"?SF(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=Ii(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 Ii(t).keys())e.get(n)===null&&r.add(n);return Gb.set(e,r),r}function Vs(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,Rr.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,Rr.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 oc(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,_F,tn=w(()=>{"use strict";pp();gt();Hb=new WeakMap,jb=new WeakMap,Vb=new WeakMap,Wb=new WeakMap,Kb=new WeakMap,Gb=new WeakMap;_F="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"});function Ws(t,e=null){return!!e||CF.has(t)}function ic(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 sc(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 ic(t),r=fr(t),n=t.lineCounts??=new Map([...Xt(t)].map(([s,a])=>[s,sc(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"?qo(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=Rr.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&&!Rr.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,CF,ac=w(()=>{"use strict";pp();Oe();gt();tn();Xb=2,gp=new WeakMap,CF=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?EF:AF,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([RF(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=>Ah(t,f)).catch(()=>{})}return c})();return n.set(s,a),a.finally(()=>{n.get(s)===a&&n.delete(s)}).catch(()=>{}),a}function Ao(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",A.showAll=!0,l.shownTriage=null}async function RF(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=Rr.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 MF(t){if(!(!t?.json&&!t?.bundle)){if(t.fileHashes){ul(t.integrity,t.fileHashes);return}(async()=>{try{let e=await ic(t);if(ul(t.integrity,e),l.bundleDetails!==t)return;t.fileHashes=e,_()}catch{}})()}}async function lc(t){if(Rm(t)||!(l.bundles??[]).find(n=>n.integrity===t))return;let r=await Qb(t);if(!(!r?.json&&!r?.bundle))try{let n=await ic(r);ul(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:Ws(l.bundleDetailsTab,l.bundleSourceFile)});l.selectedBundle===t&&(l.bundleDetails=r,_(),MF(r),lr().catch(()=>{}))}function Li(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 EF,AF,Zb,Fn=w(()=>{"use strict";pp();O();gt();Ub();Eo();St();ac();EF=new Map,AF=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:TF,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 TF,yp=w(()=>{"use strict";TF=[]});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 IF(t,e,r){let n=`${t}\0${e}`;if(dc.has(n)||ry.has(n))return;let o=ec(e);if(!o){dc.set(n,null);return}ry.add(n),(async()=>{let i=await _o(r,o);dc.set(n,i??null),ry.delete(n),l.focusCodeTick++,queueMicrotask(_)})()}async function LF(t){let e=cc.get(t);if(e&&(e.loading||e.sources))return;let r=(l.bundles??[]).find(n=>n.integrity===t);if(r){cc.set(t,{sources:null,loading:!0,error:null});try{let n=await In(t,r),o=Xt(n);cc.set(t,{sources:o,loading:!1,error:n.error??null})}catch(n){cc.set(t,{sources:null,loading:!1,error:n.message})}l.focusCodeTick++,queueMicrotask(_),queueMicrotask(Ro)}}function Ro(){let t=M.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:wi(t.fileHash).find(({integrity:r})=>e.includes(r))??null}function Ks(t,e,{kick:r=!0}={}){let n=cc.get(t);if(!n)return r?(LF(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;IF(t,e,o);let i=`${t}\0${e}`;return{content:o,highlighted:dc.has(i)?dc.get(i):void 0,loading:!1}}function GS(t){let e=wp(t);return e?{integrity:e.integrity,file:e.file,range:Tt(t.line)}:null}function FF(t){return t?GS(ft(t)):null}function uc(t){let e=FF(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=uc(t);if(!e)return null;let{pos:r}=e,n=Ks(r.integrity,r.file);return!n||n.loading?n:{...n,file:r.file,integrity:r.integrity,range:r.range}}var cc,dc,ry,kp=w(()=>{"use strict";O();ot();Fn();tn();yp();ue();tc();St();Nt();ty();cc=new Map,dc=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||Fi(r);return Tm({id:e,report:l.currentWorkspace?null:uu("report",r),workspace:uu("workspace",n??"")})}function Fi(t,e=l.currentReportWorkspace||l.currentWorkspace){let r=_l(t);return r.some(n=>n.id===e)?e:r.length===1?r[0].id:null}function pc(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(Tn())&&!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;Bs(),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 Bi=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:ps(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 hc(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 BF({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 OF(t,{wrap:e=!1}={}){let r=t.split(/\n{2,}/u).filter(n=>n.trim());return r.length<2?e?d`<div class="para">${hc(t)}</div>`:hc(t):r.map(n=>d`<div class="para">${hc(n)}</div>`)}function PF({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?OF(s,{wrap:n}):hc(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):BF(c))};return r.length===1&&typeof r[0]=="string"?i(r[0]):r.map(s=>typeof s=="string"?i(s):PF(s))}function NF(t){return T_(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 DF(t){let e=new Set;for(let r of t)e.add(Ke(r));return[...e]}function zF(t){let e=Ke(t);return Ai[e]??e}function UF(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=Gl(o),s=vi(o),a=s.length===0?"":` \u2014 in ${s.map(c=>`${xe(c)} (${zF(c)})`).join(", ")}`;return d`<a class="duplicate-ref" href="${`#${ki({id:o})}`}" data-tooltip="${`${i}${a}`}">${DF(s).map(c=>Z(ye[c]??ye.default))}<span class="duplicate-ref-id">${Mi(o)??i}</span></a>`})}</div>`}function HF(t){let e=rb(t);return e?d`<span class="${`revalidate-stamp ${e}`}">${e}</span><div class="value-label">Revalidation</div>`:m}function jF(t){let e=eb()?$t(t.revalidateVerdict,t):"";return e?d`<div class="revalidate-verdict">${hr(Fs(e))}</div>`:m}function fc(t,e,r="section",{collapsible:n=!1}={}){let o=e?d`<div class="section-body">${hr(Fs(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 VF(t,e,r){let n=t&&e?.file?pl(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 WF(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=ui(a),h=QS(t,`ev${c}`,o,a?.file,a?.line),g=iy(p),y=i&&bp(s,{integrity:o.integrity,file:pl(o.integrity,a?.file),range:Tt(a?.line)});return d`<li class="${I({current:y})}">${i?VF(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(Fs(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 KF(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`}">${XF}</a>`:m}function JF(t,e,r,n){return`${j(t)}\0${e}\0${r}\0${n?`${n.start}-${n.end}`:""}`}function $p(t,e){if(Gs.key===t)return;let r=Gs.host,n=t===null?null:e?.getRootNode?.()?.host??null;Gs={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="${we({"--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=pl(r.integrity,n);if(!i)return null;let s=Tt(o),a=JF(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),Ks(r.integrity,i)}}" @mouseleave="${h=>{Gs.key===a&&$p(null,h.currentTarget)}}" @focus="${h=>{$p(a,h.currentTarget),Ks(r.integrity,i)}}" @blur="${h=>{Gs.key===a&&$p(null,h.currentTarget)}}">${YF}</button>`;if(c){let h=Ks(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(Gs.key!==a)return{mark:u,tip:m,body:m};let p=Ks(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 e3(t,e=!1){let r=ve(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 t3(t){let e=dt(t)||t.file||"Security finding";return e.length>120?`${e.slice(0,119)}\u2026`:e}function r3(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(`
|
|
118
105
|
|
|
119
|
-
`)}function IT(e){if(!l.currentWorkspace)return m;let t=e._reportName;if(!t)return m;let r=et[Fe(t)]??et.default;return d`<button type="button" class="report-chip report-button" data-links-report="${t}" data-links-finding="${N(e)}">${re(r)}<span class="report-chip-label report-button-label">${he(t)}</span></button>`}function cx(e,t,r,n,o=null){let i=o==="table"?m:IT(n),s=N(n),a=de(n),c=!_e(n),u=a?.color??null,p=a?.comment??"",f=a?.fix??"",h=p?`Edit comment: ${p}`:"Add comment",g=f?`Edit fix link: ${f}`:"Add fix link (PR URL, etc.)",b=o==="focus"&&i===m,y=p?"Edit comment":"Comment",v=f?"Edit fix link":"Fix link",k=d`<button type="button" ?disabled="${c}" class="${E({"mark-comment":!0,"has-comment":p})}" data-tooltip="${h}" aria-label="${h}">${yd}${b?d`<span class="mark-btn-label">${y}</span>`:m}</button>`,w=d`<button type="button" ?disabled="${c}" class="${E({"mark-fix":!0,"has-fix":f})}" data-tooltip="${g}" aria-label="${g}">${Ia}${b?d`<span class="mark-btn-label">${v}</span>`:m}</button>`,$=AT(n,b),A=d`<button type="button" class="mark-copy" data-tooltip="Copy file, line, description, confidence to clipboard" aria-label="Copy finding details to clipboard">${kT}${b?d`<span class="mark-btn-label">Copy</span>`:m}</button>`,T=Dt(s)?d`<button type="button" class="mark-link" data-tooltip="Copy a link to this finding" aria-label="Copy a link to this finding">${xT}${b?d`<span class="mark-btn-label">Link</span>`:m}</button>`:m,F=od(n),M=Gk(F,{title:RT(n),body:TT(n)}),O=M?d`<a class="mark-issue" href="${M}" target="_blank" rel="noopener" data-tooltip="Create a pre-filled GitHub issue for this finding" aria-label="Create a GitHub issue for this finding">${ET}${b?d`<span class="mark-btn-label">Issue</span>`:m}</a>`:m,V=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">${CT}${b?d`<span class="mark-btn-label">Claude</span>`:m}</button>`,H=d`<color-marker .selected="${u}" .disabled="${c}"></color-marker>`,q=wi(e)!==e,ue=e.linkedTabs?"change triage state for linked findings":q?"change triage state for App and own-source findings":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 d`<div class="finding-actions">${i}<div class="finding-action-controls"><span class="mark-action-group">${k}${w}${$}</span><span class="mark-action-group">${A}${T}${O}${V}</span>${H}${FT(e,ue,o,r,n)}</div></div>`}function LT(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,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),t.style.top=`${u}px`,t.style.left=`${c}px`}function FT(e,t,r,n,o){let i=Z(e),s=!_e(o)||wn(e,n).length===0,a=s?null:Bh(e,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"],b=p&&!(r==="focus")?[{key:"restore",label:"Restore"},...h.filter(k=>k!==l.shownTriage).map(k=>({key:k,label:u[k]}))]:h.map(k=>({key:k,label:u[k]})),y=["mark-triage-menu"];p&&y.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="${y.join(" ")}" popovertarget="${v}" popovertargetaction="toggle" data-tooltip="${t}" aria-label="${t}" ?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="${LT}">${b.map(k=>d`<button type="button" class="${E({"triage-menu-item":!0,[`triage-menu-${k.key}`]:!0,active:a===k.key})}" data-triage-action="${k.key}" ?disabled="${s}" role="menuitem">${k.label}</button>`)}</div></div>`}function MT(e){let t=!!e?.comment,r=!!e?.fix,n=e?.flagged===!0;return!t&&!r&&!n?m:d`<span class="tab-marks">${t?d`<span class="has-comment" title="Has a comment">${yd}</span>`:m}${r?d`<span class="has-fix" title="Has a fix link">${Ia}</span>`:m}${n?d`<span class="flagged" title="Flagged">${vd}</span>`:m}</span>`}function dx(e,t,r){let{app:n,source:o}=v0(e),i=s=>BT(s,N(s)===t,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 BT(e,t,r){let n=N(e),o=de(e),i=o?.color,s=va(e,o),a=["tab",`tab-severity-${ee(e,l.severityMode)}`];t&&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=e._source??e.source,u=c!=="default"&&Object.hasOwn(et,c)?et[c]:null,p=!u&&e.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="${lh[c]}">${re(u)}</span>`:p?d`<span class="tab-conf" aria-label="${`Confidence ${e.confidence} out of 10`}">${e.confidence}<span class="tab-conf-max">/10</span></span>`:m;return d`<button type="button" class="${a.join(" ")}" data-tid="${n}" aria-pressed="${t}" aria-description="${i?`${i} color label`:m}"><span class="tab-label"><span class="tab-severity">${rm(e,{variant:"tab"})}</span><span class="tab-indicators">${MT(o)}</span></span>${f}</button>`}function OT(e){if(l.viewMode==="table"||l.viewMode==="focus"){let t=e.confidence*10;return d`<div class="${`conf-ring ${ee(e,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: ${t} 100`}"></circle></svg> <span>${e.confidence}<small>/10</small></span></div><div class="value-label">Confidence</div>`}return d`<div class="conf-score"><strong>${e.confidence}</strong>/10</div><div class="value-label">Confidence</div>`}var DT=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/iu;function NT(e){if(qr(e))return m;let t=e?.name;if(typeof t!="string"||!DT.test(t))return m;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 d`<span class="line-num"><a class="npm-link" href="${o}" target="_blank" rel="noopener noreferrer">npm: ${i}</a></span>`}function PT(e,t,r,n,o,i){let s=N(e),a=de(e),c=a?.comment??"",u=a?.fix??"",p=fr(e,Et(e)),f=ax(e,p),h=Rr(e),g=gd(e),b=lx(e,"loc",g,e.file,e.line),y=nm(p),v=d`<span class="line-num">${h?d`${f}, ${h}`:f}${b?.mark??m}${y}</span>`,k=wo(e),w=String(e.discoveredIn??"").trim(),$=w===String(e.file??"").trim()?"":w,A=o==="focus"?NT(e.package?.npm):m,T=m;if(o!=="focus"&&e.fileHash&&Array.isArray(e._bundleHashes)&&e._bundleHashes.length>0){l.bundleHashTick;let ue=new Set(e._bundleHashes),Te=ho(e.fileHash).find(({integrity:nt})=>ue.has(nt));Te&&(T=d`<button type="button" class="finding-code-btn" data-finding-code-bundle="${Te.integrity}" data-finding-code-file="${Te.file}" data-finding-code-line="${e.line??""}" data-tooltip="${`Open ${Te.file} in bundle source viewer`}">Code</button>`)}let{title:F,body:M}=rn(e),O=Zo(M),V=O.findIndex(ue=>ue.label!==null),H=V===-1?O:O.slice(0,V),q=V===-1?[]:O.slice(V);return d`<div class="${E({"tab-body":!0,active:t})}" 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} ${rm(e,{variant:"full"})}<div class="value-label">Severity</div>${e.confidence===void 0?m:OT(e)} ${gT(e)} ${T}</div><div class="finding-body"><div class="line-row">${v} ${b?.tip??m} ${A} ${$?d`<span class="line-num discovered-in">(found analyzing ${$})</span>`:m} ${k?d`<span class="run-meta">${k}</span>`:m}</div>${b?.body??m} ${F?d`<div class="desc-title">${Ta(F)}</div>`:m} ${H.map(ue=>d`<div class="desc">${Ht(bi(ue.body))}</div>`)} ${vT(e,o)} ${q.map(ue=>ue.label===null?d`<div class="desc">${Ht(bi(ue.body))}</div>`:Ra(ue.label,ue.body))} ${e.impact?Ra("Impact",at(e.impact,e)):m} ${e.reproduction?Ra("Reproduction",at(e.reproduction,e),"section",{collapsible:!0}):m} ${e.recommendation?Ra("Recommendation",at(e.recommendation,e),"recommendation",{collapsible:!0}):m} ${e.confidenceReason?d`<div class="conf-reason">${Ht(at(e.confidenceReason,e))}</div>`:m} ${bT(e)} ${e.revalidateRecommendation&&ph()?Ra("Revalidation recommendation",at(e.revalidateRecommendation,e),"recommendation",{collapsible:!0}):m} ${xt(e)&&e.correctedSeverityReason?d`<div class="severity-reason"><span class="severity-reason-label">Severity correction:</span> ${Ht(e.correctedSeverityReason)}</div>`:m} ${mT(e,i)} ${c?d`<div class="comment-block"><span class="comment-label">Comment:</span> ${pT(c)}</div>`:m} ${u?d`<div class="fix-block"><span class="fix-label">Fix:</span> ${$e(u)?d`<a href="${u}" target="_blank" rel="noopener noreferrer">${u}</a>`:u}</div>`:m}</div></div>`}function ux(e){let t=["finding",...om(e)];return gr(e).length>1&&t.push("multi-case"),t}function px(e,t={}){let{context:r=null}=t,n=Ce(e),o=gr(e),i=new Set(o.map(N)),s=Je(e),a=N(s),c=s.commitHash?d`<div class="commit-ref">introduced in ${wT(s.repo?.github,s.commitHash)}</div>`:m,u=l.currentWorkspace&&c!==m;return d`${o.map((p,f)=>PT(p,N(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?dx(o,a,n):m}</div>${cx(e,o,n,s,r)}</div>`}function om(e){let t=Ce(e),r=e.some(o=>o.critical||ee(o,l.severityMode)==="critical"),n=[];return r&&n.push("is-critical"),t.hasConflict?n.push("has-conflict"):t.commonColor&&n.push(`mark-${t.commonColor}`),l.shownTriage&&n.push(`triage-${l.shownTriage}`),n}function fx(e){let t=Ce(e),r=gr(e),n=Je(e),o=N(n),i=n,s=qe(i),a=wo(i),c=Rr(i),u=c?`, ${c}`:"",p=fr(i,Et(i));return d`<div class="row-score">${rm(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">${ax(i,p)}${u}</span> ${nm(p)}<div class="marks">${cx(e,r,t,n,"table")}</div></div>${r.length>1?d`<div class="tabs-row">${dx(r,o,t)}</div>`:m}</div>`}function La(e){return"tree-"+e.replaceAll(/[^\w-]+/gu,"_")}var mx=()=>Object.fromEntries(ge.map(e=>[e,0]));function im(e,t){let r=new Map;for(let n of e)for(let o of n){r.has(o.file)||r.set(o.file,mx());let i=r.get(o.file),s=ee(o,t);i[s]!==void 0&&i[s]++}return r}function sm(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 wd(e,t){let r=Object.keys(e),n=new Map(r.map((c,u)=>[c,u])),o=r.map(()=>mx()),i=r.map(()=>[]);for(let[c,u]of r.entries())for(let p of e[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 t){let p=n.get(c);if(p===void 0||!u)continue;let f=ge.map(y=>[y,u[y]??0]).filter(([,y])=>y!==0);if(f.length===0)continue;let h=++a,g=[],b=y=>{s[y]!==h&&(s[y]=h,g.push(y))};for(let y of i[p])b(y);for(;g.length>0;){let y=g.pop();for(let[v,k]of f)o[y][v]+=k;for(let v of i[y])b(v)}}return new Map(r.map((c,u)=>[c,o[u]]))}function am(e,t,r){let n=t.get(e),o=r.get(e);return hx(n)>0||hx(o)>0}function hx(e){if(!e)return 0;let t=0;for(let r of ge)t+=e[r]??0;return t}function gx(e){if(!e)return m;let t=ho(e)[0];return t?d`<button type="button" class="tree-code-btn" data-finding-code-bundle="${t.integrity}" data-finding-code-file="${t.file}" data-tooltip="${`Open ${t.file} in bundle source viewer`}">Code</button>`:m}function bx(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=l.filesSearch.trim().toLowerCase(),i=o?r.filter(p=>p.toLowerCase().includes(o)):r,s=p=>e[p]?d`<a href="${`#${La(p)}`}"><span class="name">${p}</span></a>`:d`<span class="name">${p}</span>`,a=p=>{let f=t.get(p);if(!f)return null;let h=ge.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=t.get(p);return f?ge.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&&e[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 b=c(g),y=g===p,v=me(e[g].size);return d`<div class="${`tree-table-row${y?" selected":""}${b===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">${zT(e[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=e[p],h=n.get(p)??[],g=me(f.size);return d`<section class="tree-file" id="${La(p)}"><div class="tree-file-header"><span class="name">${p}</span> ${a(p)} ${g?d`<span class="tree-file-size">${g}</span>`:m} ${gx(f.fileHash)}</div>${yx(f,h,s)}</section>`})}</div>`}function yx(e,t,r){return d`${e.fileHash||e.treeHash?d`<div class="tree-hashes hashes">${e.fileHash?d`<div class="tree-hash">file: ${e.fileHash}</div>`:m} ${e.treeHash?d`<div class="tree-hash">tree: ${e.treeHash}</div>`:m}</div>`:m} ${e.imports?.length>0?d`<div class="tree-section"><span class="tree-section-label">imports</span><ul>${e.imports.map(n=>d`<li>${r(n)}</li>`)}</ul></div>`:m} ${t.length>0?d`<div class="tree-section"><span class="tree-section-label">imported by</span><ul>${t.map(n=>d`<li>${r(n)}</li>`)}</ul></div>`:m} ${e.exports?.length>0?d`<div class="tree-section"><span class="tree-section-label">exports</span><ul>${e.exports.map(n=>d`<li><span class="name">${n}</span></li>`)}</ul></div>`:m}`}function zT(e,t,r,n){let o=me(e.size);return d`<div class="tree-detail-name"><span class="name">${t}</span> ${o?d`<span class="tree-detail-size">${o}</span>`:m} ${gx(e.fileHash)}</div>${yx(e,r,n)}`}var Fa=null,vx=null;function Ti(){return vx}function UT(){return Fa||(Fa=(async()=>{let e="./graph.js";try{let t=await import(e);return t._swapGraph2Impl(J0()),vx=t,t}catch(t){throw Fa=null,t}})(),Fa)}async function lm(e,t,r,n,o){try{let i=await UT(),s=i.buildGraphFromPrep(t);Q(d`<graph-layout .graph="${s}" .options="${r}"></graph-layout>`,e);let a=e.querySelector("graph-layout");return await a.updateComplete,n(),o(),i.attachGraph2Interaction(e,s,n,o),a}catch(i){let s=i instanceof Error?i.message:String(i);return e.textContent=`Graph failed to load: ${s}`,null}}var Ma=null,Ba=null;function HT(){return Ma||(Ma=(async()=>{let e="./terminal.js";try{return await import(e)}catch(t){throw Ma=null,t}})(),Ma)}function jT(e){let t=tt(e);if(t.size===0)return t;let r=[...t.keys()],{stripped:n}=_t(r),o=new Map;for(let i=0;i<r.length;i++)o.set(n[i],t.get(r[i]));return o}async function wx(e,t){let r=t?.integrity??"";(!Ba||Ba.integrity!==r)&&(Ba={integrity:r,promise:WT(t,r)});try{let n=await Ba.promise;return!e.isConnected||e.contains(n)||e.replaceChildren(n),n}catch(n){Ba=null;let o=n instanceof Error?n.message:String(n);return e.textContent=`Terminal failed to load: ${o}`,null}}async function WT(e,t){return(await HT()).createTerminalElement(jT(e),t)}function kx(e){if(!e)return null;let t=Mk(),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 VT=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],KT=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];function GT(){if(typeof document>"u")return!1;let e=document.body?.classList;return!!e&&(e.contains("theme-light")||e.contains("theme-pink"))}var cm=new Map;function bt(e){let t=GT(),r=t?KT:VT,n=e??"__own__",o=`${t?"l":"d"}:${n}`;if(cm.has(o))return cm.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 cm.set(o,c),c}var dm=(e,t,r)=>{for(let n of t)if(n[0]===e)return(0,n[1])();return r?.()};var xx="@preventive/triage";function um(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 kd(e){let t=/^(.*?)\.stasis\.(?:code|resources)\.br$/u.exec(e);return t?t[1]:e.replace(/\.[^.]+$/u,"")||e}function $x(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 Sx(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 _x(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:um(r.name,r.version)}:{name:kd(t?.name??"bundle"),version:null,purl:null},rest:n}}function Cx(e){return e??globalThis.crypto.randomUUID()}function Ex(e,t,{now:r=new Date,uuid:n}={}){let o=$x(e),{root:i,rest:s}=_x(o,t),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:${Cx(n)}`,version:1,metadata:{timestamp:r.toISOString(),tools:{components:[{type:"application",name:xx}]},component:a},components:s.map(u=>{let p=um(u.name,u.version);return{type:"library","bom-ref":p,name:u.name,version:u.version,purl:p}})};return`${JSON.stringify(c,null,2)}
|
|
120
|
-
`}function
|
|
121
|
-
`}function
|
|
122
|
-
`),u=[];for(let p=0;p<c.length;p++){let f=
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
106
|
+
`)}function n3(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">${xe(e)}</span></button>`}function eC(t,e,r,n,o=null){let i=o==="table"?m:n3(n),s=ve(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}">${mc}${g?d`<span class="mark-btn-label">${b}</span>`:m}</button>`,k=e3(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">${GF}${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">${qF}${g?d`<span class="mark-btn-label">Link</span>`:m}</button>`:m,U=sp(n),E=M_(U,{title:t3(n),body:r3(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">${QF}${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">${ZF}${g?d`<span class="mark-btn-label">Claude</span>`:m}</button>`,K=d`<color-marker .selected="${c}" .disabled="${a}"></color-marker>`,W=Ns(t)!==t,me=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}${i3(t,me,o,r,n)}</div></div>`}function o3(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 i3(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="${o3}">${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 s3(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">${mc}</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=>a3(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 a3(t,e,r){let n=j(t),o=ve(t),i=o?.color,s=Ql(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=Ul(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="${Ai[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">${s3(o)}</span></span>${f}</button>`}function l3(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 d3(t){if(qn(t))return m;let e=t?.name;if(typeof e!="string"||!c3.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 u3(t,e,r,n,o,i){let s=j(t),a=ve(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"?d3(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=wi(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=hs(B),K=N.findIndex(Ce=>Ce.label!==null),W=K===-1?N:N.slice(0,K),me=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:l3(t)} ${HF(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">${hc(E)}</div>`:m} ${W.map(Ce=>d`<div class="desc">${hr(Fs(Ce.body))}</div>`)} ${WF(t,o)} ${me.map(Ce=>Ce.label===null?d`<div class="desc">${hr(Fs(Ce.body))}</div>`:fc(Ce.label,Ce.body))} ${t.impact?fc("Impact",$t(t.impact,t)):m} ${t.reproduction?fc("Reproduction",$t(t.reproduction,t),"section",{collapsible:!0}):m} ${t.recommendation?fc("Recommendation",$t(t.recommendation,t),"recommendation",{collapsible:!0}):m} ${t.confidenceReason?d`<div class="conf-reason">${hr($t(t.confidenceReason,t))}</div>`:m} ${jF(t)} ${t.revalidateRecommendation&&eb()?fc("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} ${UF(t,i)} ${c?d`<div class="comment-block"><span class="comment-label">Comment:</span> ${NF(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 ${KF(s.repo?.github,s.commitHash)}</div>`:m,u=l.currentWorkspace&&c!==m;return d`${o.map((p,f)=>u3(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,mc,GF,qF,YF,XF,Gs,ZF,QF,Sp,c3,gc=w(()=>{"use strict";T();Te();fn();bt();O();ue();ot();wS();kp();yp();Ar();Wt();Bi();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>`,mc=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>`,GF=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>`,qF=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>`,YF=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>`,XF=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>`;Gs={key:null,host:null};ZF=d`<svg viewBox="4 5 8 8" width="11" height="11" fill="currentColor" aria-hidden="true"><path d="${Du}/"></path></svg>`,QF=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>`;c3=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/iu});function bc(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,yc=w(()=>{"use strict";ue();sC=()=>Object.fromEntries(Ee.map(t=>[t,0]))});function aC(t){if(!t)return m;let e=wi(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="${`#${bc(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">${p3(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="${bc(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 p3(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";T();O();ue();yc()});function qs(){return uC}function f3(){return vc||(vc=(async()=>{let t="./graph.js";try{let e=await import(t);return e._swapGraph2Impl(US()),uC=e,e}catch(e){throw vc=null,e}})(),vc)}async function dy(t,e,r,n,o){try{let i=await f3(),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 vc,uC,uy=w(()=>{"use strict";T();Eo();vc=null,uC=null});function h3(){return wc||(wc=(async()=>{let t="./terminal.js";try{return await import(t)}catch(e){throw wc=null,e}})(),wc)}function m3(t){let e=Ii(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??"";(!kc||kc.integrity!==r)&&(kc={integrity:r,promise:g3(e,r)});try{let n=await kc.promise;return!t.isConnected||t.contains(n)||t.replaceChildren(n),n}catch(n){kc=null;let o=n instanceof Error?n.message:String(n);return t.textContent=`Terminal failed to load: ${o}`,null}}async function g3(t,e){return(await h3()).createTerminalElement(m3(t),e)}var wc,kc,fC=w(()=>{"use strict";tn();ue();wc=null,kc=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 v3(){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=v3(),r=e?y3:b3,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 b3,y3,py,Oi=w(()=>{"use strict";ue();b3=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],y3=["#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 w3(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=[w3(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 k3(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=k3(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 x3(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 $3(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?$3(c,i):x3(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 Mo(t){return t==="__own__"?"own source":typeof t!="string"?t:t.match(/^(?:.*\/)?vendor\/(.+)$/u)?.[1]??t}var Ys=w(()=>{"use strict"});function Xs(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 AC(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 Ap=w(()=>{"use strict";Ys()});var MC,RC=w(()=>{MC=`*,*: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 Js(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(es(s.detail?.cause))}),document.body.append(i)})}var F,he=w(()=>{"use strict";T();Nt();go();RC();F=class extends J{static styles=[R(MC)];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,Mr=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 TC({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:C3(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 C3(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";T();he();Mr();vy=class extends F{static styles=[...F.styles,R(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:il(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 To,xc=w(()=>{To=`.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 Rp({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 R3(t){return`bundle-${t.slice(7,19)}\u2026`}function Lo(t){return t.kind==="bundle"?t.label??R3(t.identifier):t.identifier}function OC(t){return t.kind==="bundle"?"bundle":Hu(t.identifier)?"links file":"report"}function Mp(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 Tp(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";T();Ar()});function M3(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 T3(t){return d`<span class="comment-text">${t||d`<em>empty</em>`}</span>`}function I3(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 L3(t){return t?d`<span class="${`triage triage-${t}`}">${t}</span>`:d`<em>none</em>`}function F3(t){return t?d`<span class="${`flag-badge${t==="flagged"?" on":""}`}">${t}</span>`:d`<em>none</em>`}function PC(t,e){return t==="color"?M3(e):t==="comment"?T3(e):t==="fix"?I3(e):t==="triage"?L3(e):t==="flagged"?F3(e):d`${String(e)}`}function B3(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(es(s.detail?.cause))}),document.body.append(i)})}var DC,NC,O3,ky,Fp=w(()=>{"use strict";T();ue();Nt();he();xc();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},O3={color:"Color",comment:"Comment",fix:"Fix",triage:"Triage state",flagged:"Flag"},ky=class extends F{static styles=[...F.styles,R(To),R(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}">${B3(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">${O3[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,Pi=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 Js("workspace-unlock-bundle-dialog",{_tryPassword:t},e=>{e._tryPassword=null})}var xy,UC=w(()=>{"use strict";T();he();Pi();xy=class extends F{static styles=[...F.styles,R(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=Il(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";T();O();he();Pi();$y=class extends F{static styles=[...F.styles,R(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=La(),this._vaultStateUnsub=tt(()=>{if(this._settled)return;let e=La();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 Oa({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 Rh({seal:r}),this._phase="Encrypting bundles\u2026",await Th({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 N3(){try{return localStorage.getItem(WC)==="1"}catch{return!1}}function VC(){try{localStorage.setItem(WC,"1")}catch{}}async function Op(){if(de()||!Pr()||N3())return;if(!confirm(`Encrypt your DeepView data with a passkey?
|
|
126
115
|
|
|
127
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.
|
|
128
117
|
|
|
129
|
-
You can change this anytime from the lock icon in the sidebar header.`)){Hx();return}await Oc(),le()&&Hx()}var vm=class extends I{static styles=[...I.styles,C(Be)];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(t,r,n,o){t.push({kind:n,identifier:r.identifier,reason:o}),this._errors=[...this._errors,{label:In(r),reason:o}]}_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 a=await Nw(this.workspaceId,n.identifier);if(!a.ok){this._fail(r,n,"bundle",a.reason??"unknown");continue}await go(n.identifier,this.workspaceId),t.push({kind:"bundle",identifier:n.identifier});continue}let o=await Dw(this.workspaceId,n.identifier);if(!o){this._fail(r,n,"report","not found in remote");continue}let i;try{i=Le(await Vt(o.content))}catch{this._fail(r,n,"report","remote payload is not gzipped UTF-8");continue}let s=lt(i);if(!s.recognized){this._fail(r,n,"report","remote payload is not a recognized report format");continue}await fs(n.identifier,o.content),ht(n.identifier,s.count,s.source),await Lr(n.identifier,this.workspaceId),t.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,t.some(n=>n.kind==="report"))try{l.currentWorkspace===this.workspaceId&&await jt(this.workspaceId)}catch{}r.length===0&&this._finish({downloaded:t,failed:r})};render(){let{count:t,singular:r,kindLabel:n}=Sd(this.items),o=r?d`Download <strong>"${In(this.items[0])}"</strong> from the workspace's remote inventory?`:d`Download <strong>${t}</strong> remote ${n} into this workspace?`,i=r?m:_d(this.items),s=this._running?r?"Downloading\u2026":`Downloading ${t} ${n}\u2026`:r?"Download":`Download ${t}`;return d`<dialog @close="${this._onClose}"><header><h3>Download from remote</h3></header><p class="lwd-body">${o}</p>${i} ${Cd(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||t===0}">${s}</button>`}</footer></dialog>`}};customElements.define("sync-download-dialog",vm);function Rd({workspaceId:e,items:t}={}){return ne("sync-download-dialog",{workspaceId:e??"",items:Array.isArray(t)?[...t]:[]})}var Ln="deepview.lastFile",Oa=new Set(["overview","graph","treemap","compare","advisories","issues","code","search","terminal"]);function Fn(e,t="overview"){let r=t&&t!=="overview"&&Oa.has(t)?` ${t}`:"";Ge(Ln,`b:${e}${r}`).catch(()=>{})}var Eo=0,Ee=e=>e!==Eo;function uI(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,0)})}async function Wx(e){return await uI(),e!==null&&Ee(e)?!1:(x(),!0)}function xm(){_.selected=null,_.focusedPkg=null,_.layoutCache=null,_.solo=null,_.hidden.clear(),_.pathFilter="",Ke()}function $m(e){for(let t of j.openSessions)t&&!e.has(t.workspaceId)&&(j.closeSession(t.workspaceId),Jf(t.workspaceId))}function km(){R.classList.remove("active"),Q(m,R),Ne.classList.remove("hidden")}function Vx(e){return e instanceof DOMException&&e.name==="NotFoundError"||typeof e?.message=="string"&&e.message.startsWith("File not found:")}function Sm(e){let t=Kx(e.toLowerCase());return t.endsWith(".map")?"sourcemap":t==="stasis.code.br"||t.endsWith(".stasis.code.br")?"stasis":null}function Kx(e){return e.replace(/ \(\d+\)(?=\.[^.]*$)/u,"")}async function wm({name:e,content:t,existingNames:r}){if(!r.has(e))return await Ft(e,t),r.add(e),{name:e,content:t};let n;try{n=await Ae(e)}catch(a){if(!Vx(a))throw a;return await Ft(e,t),r.add(e),{name:e,content:t}}if(n===t)return{name:e,content:t};let i=G().filter(a=>Array.isArray(a.reports)&&a.reports.includes(e)).filter(a=>di(a.id,e)),s=await Fx({name:e,workspaceNames:i.map(a=>a.name),existingNames:r});if(s.action==="cancel")return null;if(s.action==="rename"){let a=s.newName;return await Ft(a,t),r.add(a),{name:a,content:t}}return await Ft(e,t),i.length>0&&await fI(e,i),{name:e,content:t}}async function pI(e,t){let r=typeof t?.github=="string"?t.github:"";if(r)try{await ip(e,r)}catch(n){console.warn(`Import: failed to adopt the repository "${r}" for "${e}":`,n)}}async function fI(e,t){let r;try{r=await qn(e)}catch(n){console.warn(`Import: failed to read freshly-saved "${e}" for cloud sync:`,n);return}for(let n of t)try{await ra(n.id);let o=await Fc(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 _m(e){if(l.serverMode==="managed")return;await Ad();let t=null,r=null,n=new Set,o=new Set(await fe()),i=[];for(let s of e)try{let a=Kx(s.name.toLowerCase());if(a.endsWith(".gz")||a.endsWith(".deepview-workspace.enc")){let p=await Ux(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=lt(f.content);if(!h.recognized){i.push(f.name);continue}let g=await wm({name:f.name,content:f.content,existingNames:o});g&&(ht(g.name,h.count,h.source),await pI(g.name,f.repo),t={name:g.name,content:g.content})}try{let f=await fe();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(Sm(s.name)){let p=new Uint8Array(await s.arrayBuffer()),{integrity:f}=await Xn(s.name,p);r=f,n.add(f);continue}let u=await s.text();if(Tv(u,a)==="codex"){let p=Cp(u);for(let{displayName:f,data:h}of p){let g=f.replaceAll("/","__")+".codex",b=JSON.stringify(h),{count:y,source:v}=lt(b),k=await wm({name:g,content:b,existingNames:o});k&&(ht(k.name,y,v),t={name:k.name,content:k.content})}}else{let p=lt(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 wm({name:s.name,content:u,existingNames:o});if(!f)continue;ht(f.name,p.count,p.source),t={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 te();for(let s of n)_a(s).catch(()=>{});t?await dt(t.name,t.content):r&&(En(r),Fn(r),x(),await te(),Pr(r))}async function dt(e,t,{workspaceId:r}={}){let n=++Eo;l.currentReportWorkspace=Co(e,r);let o=new Set(G().filter(s=>Array.isArray(s.reports)&&s.reports.includes(e)).map(s=>s.id));if($m(o),l.reports=[],$o(),l.workspaceMerges=[],l.revalidateConflicts=new Map,l.currentFile=e,l.currentWorkspace=null,l.currentLinks=null,(l.currentView==="bundles"||l.currentView==="packages"||l.currentView==="repositories"||l.currentView==="links")&&(l.currentView="findings"),l.repoUrl=wt(e),l.repoEditing=!1,xm(),Ge(Ln,Sc(e,l.currentReportWorkspace)).catch(()=>{}),t===void 0){try{t=await Ae(e)}catch(s){if(Ee(n))return;if(s&&s.message?.includes("vault locked")){if(await Dc()&&!Ee(n)){await dt(e);return}Ee(n)||(l.currentFile=null,await te());return}if(Vx(s)){let a=G().find(c=>Array.isArray(c.reports)&&c.reports.includes(e)&&di(c.id,e));if(a)try{if(await ra(a.id),Ee(n))return;let c=await Rd({workspaceId:a.id,items:[{kind:"report",identifier:e}]});if(Ee(n))return;if(c?.downloaded?.some(u=>u.kind==="report"&&u.identifier===e)){await dt(e);return}}catch(c){if(console.warn(`Re-download prompt for missing "${e}" failed:`,c),Ee(n))return}Ee(n)||(l.currentFile=null,await te());return}alert(`Failed to read ${e}: ${s.message}`),l.currentFile=null,await te();return}if(Ee(n))return}let i=sn(t);if(i?(l.currentLinks={name:e,...i},l.currentView="links",x()):await Em(e,t,n),!Ee(n)){for(let s of o)j.openSession(s),j.refreshSession(s),ra(s);await te()}}async function jt(e){let t=G().find(i=>i.id===e);if(!t)return;let r=++Eo;$m(new Set([e])),(l.currentView==="bundles"||l.currentView==="packages"||l.currentView==="repositories"||l.currentView==="links")&&(l.currentView="findings"),$t("workspace",e),l.reports=[],$o(),l.workspaceMerges=[],l.revalidateConflicts=new Map,l.currentFile=null,l.currentWorkspace=e,l.currentReportWorkspace=null,l.currentLinks=null,l.repoUrl="",l.repoEditing=!1,xm(),Ge(Ln,`ws:${e}`).catch(()=>{}),t.reports.length===0&&km();let n=t.reports.map(i=>Ae(i).catch(()=>null)),o=0;for(let i=0;i<t.reports.length;i++){let s=await n[i];if(Ee(r))return;if(s!==null&&!sn(s)&&(await Em(t.reports[i],s,r,{renderView:!1}),o++,Ee(r)))return}o===0&&t.reports.length>0&&km(),!(o>0&&(ba(kn()),!await Wx(r)))&&(j.openSession(e),j.refreshSession(e),ra(e),await te())}async function Gx({triage:e="keep",deleteFromRemoteWorkspaceIds:t=[]}={}){if(!l.currentFile)return;let r=++Eo,n=l.currentFile;si(n),Yt(n,"");for(let o of t)try{let i=await Mc(o,n);if(Ee(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 Go(n),!Ee(r)&&(await Ws(n,null),!Ee(r))){if(e==="wipe"){try{await Ec()}catch(o){console.warn("Skipped orphan-triage GC:",o)}if(Ee(r))return}Ee(r)||(Cm(),await te())}}function Cm(){l.currentFile=null,l.currentWorkspace=null,l.currentReportWorkspace=null,l.currentLinks=null,l.selectedBundle=null,l.bundleDetails=null,l.bundleSourceFile=null,l.bundleSourceFindingIdx=null,l.reports=[],$o(),l.workspaceMerges=[],l.revalidateConflicts=new Map,l.repoUrl="",l.repoEditing=!1,l.shownTriage=null,l.currentView="findings",xm(),jo(Ln),km(),document.title="DeepView"}async function qx(){++Eo,$m(new Set),Cm(),await te()}async function Yx({deleteFromRemoteWorkspaceIds:e=[]}={}){if(!l.selectedBundle)return;let t=++Eo,r=l.selectedBundle;for(let o of e)try{let i=await Bc(o,r);if(Ee(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 Yu(r),Ee(t)||(await ff(r,null),Ee(t)))return;l.selectedBundle=null,l.bundleDetails=null,l.bundleSourceFile=null,l.bundleSourceFindingIdx=null;let n=ze(Ln);typeof n=="string"&&(n===`b:${r}`||n.startsWith(`b:${r} `))&&jo(Ln),jp(r),l.bundles=await qt(),!Ee(t)&&(x(),await te())}async function Xx(e,t="detach",{triage:r="keep"}={}){let n=G().find(a=>a.id===e);if(!n)return;++Eo;let o=Array.isArray(n.reports)?[...n.reports]:[];if(j.closeSession(e),Jf(e),t==="delete"){for(let a of o){try{await Go(a)}catch{}si(a),Yt(a,"")}if(r==="wipe")try{await Ec()}catch(a){console.warn("Skipped orphan-triage GC:",a)}}let i=l.currentWorkspace===e,s=t==="delete"&&l.currentFile!=null&&o.includes(l.currentFile);(i||s)&&Cm(),await lf(e),await te()}async function Em(e,t,r=null,{renderView:n=!0}={}){let o=()=>r!==null&&Ee(r);try{if(await Promise.all([$t("report",e),$t("workspace",l.currentWorkspace||l.currentReportWorkspace)]),o()||(await yo,o()))return;let{data:i,reason:s}=Rs(t);if(!i)throw new Error(s);let a=l.reports.length===0,c=Tr(i)??[],u=c.flatMap(Ih);if(await Tp(u),o())return;let p=new Set(u.filter(fh).map(b=>b.source??i.source??null)),f=lo(i),h=f??wt(e),g=[];for(let b of c){let y=Ih(b);if(y.length===0)continue;let v=[];for(let k of y){let w={...k,_id:l.nextFindingId++,_repoFallback:h,_reportName:e,_bundleHashes:i.bundleHashes??[]};ao(w,i),w._source=w.source??i.source??null,"isApp"in w||(w.isApp=to(w,w._source)),w._sourcePass=p.has(w._source),w._analyzer=w._source??w.type??null,v.push(w)}g.push(v)}if(l.reports.push({type:i.type||"analysis",source:i.source??null,fileName:e,groups:g,repo:f,tree:i.tree??null,bundleHashes:i.bundleHashes??[]}),qc(l.reports),Yc(l.reports)&&$o(),l.revalidateConflicts=$0(),Am(),Array.isArray(i.bundleHashes)&&i.bundleHashes.length>0){let b=new Set((l.bundles??[]).map(y=>y.integrity));for(let y of i.bundleHashes)b.has(y)&&_a(y).catch(()=>{})}a&&(yi(),ba(kn())),n&&await Wx(r)}catch(i){alert(`Failed to parse ${e}: ${i.message}`)}}window.__loadFile=(e,t)=>Em(e,t);window.__setFilters=({severities:e,confMin:t}={})=>{e!=null&&(l.filterSeverities=new Set(e)),t!==void 0&&(l.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")&&_m(e.dataTransfer.files)});Ne.addEventListener("dragover",e=>{e.preventDefault(),Ne.classList.add("hover")});Ne.addEventListener("dragleave",()=>Ne.classList.remove("hover"));Ne.addEventListener("drop",e=>{e.preventDefault(),Ne.classList.remove("hover"),_m(e.dataTransfer.files)});var yr=null;function hI(){yr||(yr=document.createElement("input"),yr.type="file",yr.multiple=!0,yr.hidden=!0,yr.addEventListener("change",()=>{let e=[...yr.files];e.length>0&&_m(e),yr.value=""}),document.body.append(yr)),yr.click()}Ne.addEventListener("click",e=>{let t=e.target.closest("[data-landing-workspace]");if(t){jt(t.dataset.landingWorkspace);return}e.target.closest(".drop-prompt-action")&&hI()});var zr=new Map,Jx="deepview.advisories.proxyConsent";function Zx(){try{return localStorage.getItem(Jx)==="1"}catch{return!1}}function Qx(){try{localStorage.setItem(Jx,"1")}catch{}}function mI(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 e$(e,t){return!e||Sm(e.name)!=="stasis"?!1:!t||t.integrity!==e.integrity?!0:mI(t)}function gI(e){let t=Object.create(null);for(let[r,n]of e)t[r]=[...n].toSorted();return t}async function Rm(e,t){if(!e?.integrity||zr.has(e.integrity)||!Zx())return;let r=$a(e);if(r.size===0){zr.set(e.integrity,{state:"ok",byPackage:new Map,query:r});return}zr.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(gI(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{}zr.set(n,{state:"error",reason:a,query:r}),t();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)}zr.set(n,{state:"ok",byPackage:s,query:r})}catch(o){zr.set(n,{state:"error",reason:o?.message??"fetch-failed",query:r})}t()}async function t$(e,t){e?.integrity&&zr.get(e.integrity)?.state==="error"&&(zr.delete(e.integrity),await Rm(e,t))}var bI={critical:0,high:1,moderate:2,low:3,info:4};function Td(e){return bI[e]??999}function yI(e){return e.charAt(0).toUpperCase()+e.slice(1)}function vI(){let e=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">${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 r$(e){if(!e)return d`<div class="bundle-advisories-empty">Bundle not loaded yet.</div>`;if(e.kind!=="stasis"||!e.bundle)return d`<div class="bundle-advisories-empty">Advisories are only available for stasis bundles.</div>`;if(!Zx())return vI();let t=zr.get(e.integrity);if(!t||t.state==="loading")return d`<div class="bundle-advisories-empty">Loading advisories from npm registry…</div>`;if(t.state==="error")return d`<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 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=[...t.byPackage.entries()].toSorted(([s,a],[c,u])=>{let p=Math.min(...a.map(h=>Td(h.severity))),f=Math.min(...u.map(h=>Td(h.severity)));return p!==f?p-f:s.localeCompare(c)}),i=[...t.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])=>wI(s,a,t.query.get(s)))}</ul></div>`}function wI(e,t,r){let n=[...t].toSorted((i,s)=>{let a=Td(i.severity)-Td(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">${e}</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=>SI(i))}</ul></li>`}function kI(e){if(typeof e!="string")return null;let t=/\/(GHSA-[a-z0-9-]+)(?:[/?#]|$)/iu.exec(e);return t?t[1]:null}var xI=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 $I(e){let t=/^CWE-(\d+)$/u.exec(e);if(!t)return d`<span>${e}</span>`;let r=`https://cwe.mitre.org/data/definitions/${t[1]}.html`;return d`<a class="bundle-advisory-cwe" href="${r}" target="_blank" rel="noopener noreferrer">${e}</a>`}function SI(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,a=kI(s),c=Array.isArray(e.cwe)?e.cwe.filter(p=>typeof p=="string"):[],u=a?d`<a class="bundle-advisory-ghsa" href="${s}" target="_blank" rel="noopener noreferrer">${a}${xI}</a>`:m;return d`<li class="bundle-advisory-row"><div class="bundle-advisory-rail"><span class="${`bundle-advisory-severity sev-${t}`}">${yI(t)}</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?"":", "}${$I(p)}`)}</span>`:m}</div>${o?d`<div class="bundle-advisory-cvss-vector mono">${o}</div>`:m}</div></div></li>`}var Na=null,Tm=new WeakMap;function _I(e){if(Tm.has(e))return Tm.get(e);let t=_n(e),r=hm(e),n=[...t.keys()].filter(c=>t.get(c)!==null),{stripped:o}=_t(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:t.get(c)}}let a={tree:s,origToStripped:i};return Tm.set(e,a),a}function l$(e,t=null){let r={inprogress:0,fixed:0,invalid:0,deleted:0};if(!e?.fileHashes)return r;let n=new Set;for(let[o,i]of e.fileHashes)if(!(t&&!t.has(o))&&!n.has(i)){n.add(i);for(let s of Ls(i)){let a=l.triage.get(N(s))?.triage;a&&r[a]!==void 0&&r[a]++}}return r}function Fi(e,t="graph"){if(!e||e.size===0)return new Map;let r=new Map;for(let[n,o]of e){let i=Ls(o);if(i.length===0)continue;let s=i.filter(a=>{let c=l.triage.get(N(a))?.triage??null;return t==="issues"?c!=="invalid"&&c!=="deleted":c===l.shownTriage});s.length!==0&&r.set(n,s)}return r}function c$(e){let t=_I(e),r=xd(e,t.origToStripped.keys());_.bundleReasonFor!==e.integrity&&(_.bundleReasonFor=e.integrity,_.bundleReason=null);let{tree:n,origToStripped:o,selected:i}=Ix(t.tree,t.origToStripped,r,_.bundleReason);_.bundleReason=i;let s=Object.keys(n);if(s.length===0)return null;let a=null;if(e.fileHashes&&e.fileHashes.size>0){a=new Map;for(let[H,q]of e.fileHashes){let ue=o.get(H);ue!==void 0&&a.set(ue,q)}}let c=Fi(a),u=new Map,p=new Map,f=new Map,h=new Map;for(let[H,q]of c){let ue={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},Te=new Set,nt=new Set,kr=[];for(let Zt of q){ue[Zt.severity]=(ue[Zt.severity]||0)+1,Te.add(Zt.severity);let Qt=l.triage.get(N(Zt))?.color??"none";nt.add(Qt),kr.push({severity:Zt.severity,color:Qt})}u.set(H,ue),p.set(H,Te),f.set(H,nt),h.set(H,kr)}let g=_.bundleLayout==="matrix"||u.size===0?null:wd(n,u),b=new Map;for(let[H,q]of o)b.set(q,H);let y=Cn(e),v=y?new Map([...o].map(([H,q])=>[q,y.get(H)])):null,k=v?H=>v.get(H):null,w=s.filter(H=>fm(H,b.get(H)??H,{packageDir:k?.(H)})==="__own__"),$=Tx(w,k),A=_.splitOwnDirs&&$,T=H=>fm(H,b.get(H)??H,{splitOwnDirs:A,packageDir:k?.(H)}),F=Lx(e,o,T,y,t.origToStripped),M=new Set;for(let H of s)if(M.add(T(H)),M.size>=3)break;let O=M.size>=3,V=s;if(_.focusedPkg){let H=s.filter(q=>T(q)===_.focusedPkg);H.length>0?V=H:_.focusedPkg=null}return _.selected&&!Object.hasOwn(n,_.selected)&&(_.selected=null),{treeData:n,files:V,ownCounts:u,transitiveCounts:g,severitySets:p,colorSets:f,fileFindings:h,options:{pkgOf:T},strippedToOrig:b,canSplitOwnDirs:$,canPackagesView:O,supportsLayers:!0,layerRoots:F,ownSourcePackages:w.length>0?new Set(w.map(T)):void 0,reasons:[...r.keys()]}}function Ld(){if(!Na)return;let e=Ti();e&&e.refreshSidebar(Na,{isBundleContext:!0})}function Fd(){if(!Na)return;let e=Ti();e&&e.refreshTopPkgs(Na)}function d$(e){Na=e}function CI(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 a=rt(o,{packageDir:s});t.set(a,(t.get(a)??0)+i),r+=i}if(r===0)return m;let n=[...t.entries()].toSorted((o,i)=>i[1]-o[1]);return d`<div class="bundles-dist"><div class="bundles-dist-bar" aria-hidden="true">${J(n,([o])=>o,([o,i])=>d`<span class="bundles-dist-seg" style="${pe({flexGrow:i,background:bt(o)})}" data-tooltip="${o==="__own__"?m:`${o}: ${me(i)}`}"></span>`)}</div><ul class="bundles-dist-list">${J(n,([o])=>o,([o,i])=>{let s=(i/r*100).toFixed(1),a=o==="__own__"?"own source":o,c=bt(o);return d`<li><span class="bundles-dist-dot" style="${pe({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="${pe({width:`${s}%`,background:c})}"></span> </span><span class="bundles-dist-size">${me(i)}</span> <span class="bundles-dist-percent">${s}%</span></li>`})}</ul></div>`}function n$(e,t,r,n,o,i){let{prefix:s,stripped:a}=_t(r),c=T=>o?.get(r[T]),u=new Set;for(let T=0;T<a.length;T++)u.add(rt(a[T],{packageDir:c(T)}));let p=a.map((T,F)=>F).toSorted((T,F)=>a[T].localeCompare(a[F])),f=a.map((T,F)=>({path:T,size:n[F],pkgDir:c(F)})),h=CI(f),g=h===m?d`<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},y=0,v=new Map;if(l.bundleDetails?.fileHashes){let T=Fi(l.bundleDetails.fileHashes,"issues");for(let F of T.values())for(let M of F){b[M.severity]!==void 0&&b[M.severity]++,y++;for(let O of Fs(M.fileHash,M))v.set(O,(v.get(O)??0)+1)}}let k=[...v.keys()].toSorted(),w=ge.filter(T=>b[T]>0).map(T=>d`<span class="${`tree-count-chip ${T}`}">${b[T]} ${T.replaceAll("_"," ")}</span>`),$=r.length>0?d`<ul class="bundles-sources-list">${p.map(T=>{let F=r[T],M=a[T],O=n[T];return d`<li><button type="button" class="bundles-source-row" data-bundle-view-source="${F}" data-tooltip="${F}"><span class="bundles-source-path">${M}</span> ${O==null?m:d`<span class="bundles-source-size">${me(O)}</span>`}</button></li>`})}</ul>`:d`<p class="bundles-overview-col-empty">No source files in this bundle.</p>`,A=k.length>0?d`<ul class="bundles-reports-list">${k.map(T=>{let F=ce[Fe(T)]??ce.default,M=v.get(T)??0;return d`<li><button type="button" class="report-chip bundles-report-chip" data-tooltip="${T}" data-bundle-issue-report="${T}">${re(F)}<span class="report-chip-label">${he(T)}</span> <span class="bundles-report-count">${M} ${M===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">${e}<dl class="bundles-detail-meta">${t}<dt>Sources</dt><dd>${r.length}</dd>${s?d`<dt>Prefix</dt><dd class="mono">${s}</dd>`:m}</dl>${i??m}</div>${y>0?d`<div class="bundles-issue-summary tree-count-chips">${w}</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">${u.size}</span></header><div class="bundles-overview-col-body">${g}</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>${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">${A}</div></section>`:m}</div></div>`}var Im=new Map,Lm=new Set,EI=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>`,Ur=null;function Pa(){queueMicrotask(()=>{document.querySelector(".bundle-code-rail-body .bundle-code-tree-link.current")?.scrollIntoView({block:"nearest"})})}function Ao(e){for(let t of ge)for(let r of e)if(r.severity===t)return t;return e[0]?.severity??null}function AI(e,t,r,n,o=null){let i=e.split(`
|
|
130
|
-
`).length,s=String(i).length,a=
|
|
131
|
-
`);for(let g=0;g<h.length;g++){let
|
|
132
|
-
`).length:0,s=typeof r=="string"?
|
|
133
|
-
`);for(let a=0;a<s.length;a++)o.ranges(s[a]).length>0&&i.add(a+1);return i}function GI(e,t,r){let n=l.bundleSourceFile;if(!n)return m;let o=t.get(n),{fileFindings:i,lineFindings:s}=Bm(e,n,o);return d`<aside class="bundle-search-side">${u$(n)}<div class="bundle-source-body">${Om(n,o,e.integrity,i,s,r)}</div></aside>`}function qI(e){let t=tt(e);if(t.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=KI(t.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">${VI(e,t,r,n,o,s)} ${GI(e,t,i)}</div></div>`}function YI(e){let t=e$(e,l.bundleDetails);l.bundleDetailsTab==="advisories"&&!t&&(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===e.integrity),a=s&&!i.error&&!!(i.json||i.bundle)&&!(i.metadataOnly&&Ei(n));return n==="advisories"&&t&&a&&Rm(i,x).catch(()=>{}),d`<div class="bundles-view bundles-slide-view"><header class="bundles-slide-bar"><span class="bundles-slide-icon" aria-hidden="true">${re(fi)}</span><div class="bundles-slide-title"><div class="bundles-slide-name">${e.name}</div></div><div class="bundles-slide-tabs" role="tablist">${t?d`<button type="button" class="${E({"bundles-tab":!0,active:n==="advisories"})}" data-bundle-tab="advisories" aria-selected="${String(n==="advisories")}" role="tab">Advisories</button>`:m} <button type="button" class="${E({"bundles-tab":!0,active:n==="issues"})}" data-bundle-tab="issues" aria-selected="${String(n==="issues")}" role="tab">Issues</button> <button type="button" class="${E({"bundles-tab":!0,active:n==="terminal"})}" data-bundle-tab="terminal" aria-selected="${String(n==="terminal")}" role="tab">Terminal</button> <button type="button" class="${E({"bundles-tab":!0,active:n==="treemap"})}" data-bundle-tab="treemap" aria-selected="${String(n==="treemap")}" role="tab">Treemap</button> <button type="button" class="${E({"bundles-tab":!0,active:n==="graph"})}" data-bundle-tab="graph" aria-selected="${String(n==="graph")}" role="tab">Graph</button> <button type="button" class="${E({"bundles-tab":!0,active:n==="code"})}" data-bundle-tab="code" aria-selected="${String(n==="code")}" role="tab">Code</button> <button type="button" class="${E({"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="${E({"bundles-tab":!0,active:n==="compare"})}" data-bundle-tab="compare" aria-selected="${String(n==="compare")}" role="tab">Compare</button>`:m} <button type="button" class="${E({"bundles-tab":!0,active:o})}" data-bundle-tab="overview" aria-selected="${String(o)}" role="tab">Overview</button></div></header><div class="${E({"bundles-slide-body":!0,"bundles-slide-body-overview":o})}">${o?lL(e,i):a?dm(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",()=>BI(i)],["search",()=>qI(i)],["compare",()=>d`<bundle-compare .details="${i}" .integrity="${e.integrity}"></bundle-compare>`],["issues",()=>JI(i)],["advisories",()=>r$(i)]]):s&&!i.metadataOnly?d`<div class="${E({"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 XI(e,t={}){if(!e)return m;let r=[];if(e.fileHash&&(r=Fs(e.fileHash,e)),r.length===0&&t.bucketKey&&(t.kind==="package"?r=Op(t.bucketKey,e):t.kind==="repository"&&(r=Dp(t.bucketKey,e))),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=et[Fe(i)]??et.default;return d`<button type="button" class="report-chip" data-tooltip="${i}" data-bundle-issue-report="${i}">${re(s)}<span class="report-chip-label">${he(i)}</span></button>`})} ${o>0?d`<span class="bundle-issue-reports-more">, and ${o} more…</span>`:m}</div>`}function h$(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 Da(e,t){return d`<div class="bundle-issues-empty"><p class="bundle-issues-empty-primary">${e}</p>${t?d`<p class="bundle-issues-empty-hint">${t}</p>`:m}</div>`}function JI(e){if(!e.fileHashes)return Da("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 Da("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=Fi(e.fileHashes,"issues");if(t.size===0){let r=Bp();if(r===0)return Da("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+=Ls(o).length;return n>0?Da("All matching issues are dismissed.",`${n} ${n===1?"finding matches":"findings match"} this bundle's files, but every one is triaged invalid or deleted.`):Da("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 Ua(t,{kind:"bundle"})}function Ua(e,{kind:t,bucketKey:r}={}){let n=[...e.keys()],{prefix:o,stripped:i}=_t(n),s=new Map(n.map((u,p)=>[u,i[p]])),a=[...e.entries()].toSorted(([u,p],[f,h])=>{let g=Se[Ao(p)]??0,b=Se[Ao(h)]??0;return b!==g?b-g:(s.get(u)??u).localeCompare(s.get(f)??f)}),c=[...e.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 ${e.size} ${e.size===1?"file":"files"} ${o?d`<span class="mono">${o}</span>`:m}</div><ul class="bundle-issues-list">${J(a,([u])=>u,([u,p])=>{let f=s.get(u)??u,h=[...p].toSorted((b,y)=>{let v=Se[b.severity]??0,k=Se[y.severity]??0;if(k!==v)return k-v;let w=parseInt(b.line,10)||0,$=parseInt(y.line,10)||0;return w-$}),g=t==="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">${t==="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">${J(h,b=>b.id??`${u}\0${b.line??""}\0${b.severity??""}\0${b.description??""}`,b=>{let y=p.indexOf(b),v=b.severity,k=h$(b.line),w=l.triage.get(N(b))?.triage,$=w==="fixed"||w==="invalid"||w==="deleted"?w.toUpperCase():w==="inprogress"?"In progress":null,A=d`<div class="bundle-issues-finding-head"><span class="${`bundle-issue-sev sev-${v}`}">${v.replaceAll("_"," ")}</span> ${k?d`<span class="bundle-issues-finding-line">${k}</span>`:m} ${$?d`<span class="${`bundle-issues-finding-triage triage-${w}`}">${$}</span>`:m} <span class="bundle-issues-finding-spacer"></span> ${XI(b,{kind:t,bucketKey:r})}</div><div class="bundle-issues-finding-desc">${Ht(Jo(b),{paragraphs:!1})}</div>`;return d`<li class="bundle-issues-finding">${t==="bundle"?d`<button type="button" class="bundle-issues-finding-link" data-bundle-view-source="${u}" data-bundle-view-finding-idx="${y}" data-bundle-view-line="${b.line??""}" data-tooltip="${u}">${A}</button>`:d`<div class="bundle-issues-finding-link bundle-issues-finding-static" title="${u}">${A}</div>`}</li>`})}</ul></li>`})}</ul></div>`}function m$(e){let t=l.selectedBundle,r=t?e.find(n=>n.integrity===t):null;return r?YI(r):d`<div class="bundles-view bundles-view-empty"><p class="bundles-empty-hint">${e.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>`}var ZI=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>`,QI=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>`,eL=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"}),s$=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"}),a$=Object.freeze(["#8b5cf6","#ec4899","#14b8a6","#f97316","#06b6d4","#84cc16","#e11d48","#a855f7"]),tL=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 rL(e){let t=typeof e=="string"?e.slice(e.lastIndexOf("/")+1):"",r=t.lastIndexOf("."),n=r>0?t.slice(r+1).trim().toLowerCase():"",o=wa(e)??tL[n];return o?{key:o,label:eL[o]??o}:n?{key:`extension:${n}`,label:`.${n}`}:{key:"other",label:"Other"}}function nL(e){if(s$[e])return s$[e];let t=0;for(let r of e)t=Math.imul(t,31)+r.codePointAt(0)|0;return a$[(t>>>0)%a$.length]}function oL(e){let t=e.currentTarget,r=e.target.closest?.(".bundles-languages-segment");!r||!t.contains(r)||(t.dataset.tooltip=r.dataset.languageTooltip??"",Zf(t))}function iL(e){delete e.currentTarget.dataset.tooltip,ui()}function sL(e){if(e?.kind!=="stasis"||!e.bundle)return m;let t=e.lineCounts?.size>0?e.lineCounts:new Map([...tt(e)].map(([i,s])=>[i,Jh(s)])),r=new Map,n=0;for(let[i,s]of t){if(s<=0)continue;let a=rL(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="${oL}" @pointerleave="${iL}">${o.map(([i,{label:s,lines:a}])=>{let c=a/n*100;return d`<span class="bundles-languages-segment" style="${pe({flexGrow:a,background:nL(i)})}" data-language-tooltip="${`${s} \xB7 ${c<1?c.toFixed(1):c.toFixed(0)}% \xB7 ${a} ${a===1?"line":"lines"}`}"></span>`})}</div>`}function aL(e,t){let r=Sx(t),n=sL(t);return d`<div class="bundles-overview-exports">${n}<div class="bundles-overview-exports-row"><button type="button" class="bundles-download-btn" data-bundle-download="${e.integrity}">${ZI}<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)">${QI}<span>SPDX</span></button></div>`:m}</div></div>`}function Fm(e,t,r=m){return d`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${e}${t}</div></div>${r}</div>`}function lL(e,t){let r=d`<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?d`<dt>Size</dt><dd>${me(t.size)}</dd>`:m}</dl>`,n=aL(e,t);if(!t||t.integrity!==e.integrity)return Fm(r,n);if(t.error)return Fm(r,n,d`<div class="bundles-overview-placeholder is-error">Failed to parse: ${t.error}</div>`);if(t.kind==="sourcemap"&&t.json){let o=t.json,i=o.sources??[],s=_n(t),a=t.sourceSizes??(s.size===i.length?i.map(u=>s.get(u)??null):i.map((u,p)=>typeof o.sourcesContent?.[p]=="string"?new TextEncoder().encode(o.sourcesContent[p]).byteLength: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||t.namesCount!=null?d`<dt>Names</dt><dd>${o.names?.length??t.namesCount}</dd>`:m}`;return n$(r,c,i,a,null,n)}if(t.kind==="stasis"&&t.bundle){let o=t.bundle,i=_n(t),s=[...i.keys()],a=new Set;for(let f of o.imports.keys()){let h=f.replace(/\s*\(with: .*\)\s*$/u,"");for(let g of h.split(", "))a.add(g)}let c=[...a].toSorted(),u=s.map(f=>i.get(f)),p=d`<dt>Version</dt><dd>${String(o.version)}</dd>${c.length>0?d`<dt>Resolution kinds</dt><dd>${c.join(", ")}</dd>`:m}`;return n$(r,p,s,u,Cn(t),n)}return Fm(r,n,d`<div class="bundles-overview-placeholder">Bundle contents not parsed.</div>`)}function g$(){Ot().catch(()=>{});let e=lr(),t={inprogress:0,fixed:0,invalid:0,deleted:0},r=[];for(let[h,g]of e){let b=[],y=[],v=new Map,k=new Set;for(let[w,$]of g.byVersion){let A=[],T=new Map;for(let F of $.findings){let M=l.triage.get(N(F))?.triage??null;M==="inprogress"?t.inprogress++:M==="fixed"?t.fixed++:M==="invalid"?t.invalid++:M==="deleted"&&t.deleted++,M===l.shownTriage&&(A.push(F),T.has(F.file)||T.set(F.file,[]),T.get(F.file).push(F))}if(A.length!==0){b.push([w,{findings:A,files:T,reports:$.reports}]);for(let F of A)y.push(F),v.has(F.file)||v.set(F.file,[]),v.get(F.file).push(F);for(let F of $.reports)k.add(F)}}b.length!==0&&(b.sort(([w],[$])=>Eu(w,$)),r.push([h,{findings:y,files:v,reports:k,versions:b}]))}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(([b])=>b===g)??null,!i&&h.length===1&&(i=h[0])}let s=i?i[1]:o?o[1]:null;if(o&&l.packageDetailsTab==="issues")return mL(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();fL(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="${E({"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>${uL(t)}</header>${r.length===0?d`<p style="color:var(--muted)">${e.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">${J(cL(c),dL,h=>gL(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">${vL(o[0],s,i?i[0]:void 0)}</div></aside>`:m}</div>`}</div>`}function cL(e){let t=[];for(let[r,n]of e){let o=n.versions;if(o.length<=1){let[c,u]=o[0];t.push({kind:"single",pkg:r,version:c,bucket:u,totalVersions:1});continue}let[i,s]=o[0],a=l.expandedPackages.has(r);if(t.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];t.push({kind:"other",pkg:r,version:u,bucket:p,totalVersions:o.length})}}return t}function dL(e){return e.version===null?`${e.kind}:${e.pkg}`:`${e.kind}:${e.pkg}@${e.version}`}function uL(e){return d`<div class="packages-toolbar"><entity-search kind="packages"></entity-search><entity-sort kind="packages"></entity-sort><triage-selector variant="packages" .counts="${e}" .states="${pL}"></triage-selector></div>`}var pL=["inprogress","fixed","invalid","deleted"];function fL(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 hL(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=l.triage.get(N(i))?.triage??null;s==="invalid"?r.invalid++:s==="deleted"?r.deleted++:r.live++}return r}function mL(e,t,r){let n=lr().get(e),o=hL(n,r),i=l.packageSlideTriage??"live",s=n?b$(n,e,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">${e}${p}</div><div class="bundles-slide-integrity">${a} ${c} · ${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?d`<div class="bundle-issues-empty">${u}</div>`:Ua(s,{kind:"package",bucketKey:e})}</div></div>`}function gL(e,t,r){let{kind:n,pkg:o,version:i,bucket:s}=e,a={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let b of s.findings){let y=ee(b,l.severityMode);a[y]!==void 0&&a[y]++}let c=ge.filter(b=>a[b]>0),u=bt(o),f={selected:o===t&&bL(e,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="${E(f)}" data-select-package="${o}" data-select-package-version="${h}"><span class="packages-dot" style="${pe({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"?yL(o,e.expanded,e.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(b=>d`<span class="${`tree-count-chip ${b}`}" title="${b.replaceAll("_"," ")}">${a[b]}</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 bL(e,t){return e.kind==="single"?!0:e.version===t}function yL(e,t,r){let n=t?"Hide":`+${r} ${r===1?"version":"versions"}`;return d`<button type="button" class="${E({"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}`}" data-tooltip="${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 vL(e,t,r){let n=lr().get(e),i=[...(n?b$(n,e,"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>${wL(e,t,r)}`}function b$(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,a]of i){let c=a.filter(f=>{let h=l.triage.get(N(f))?.triage??null;return r==="invalid"?h==="invalid":r==="deleted"?h==="deleted":h!=="invalid"&&h!=="deleted"});if(c.length===0)continue;let u=y$(t,s);o.has(u)||o.set(u,[]);let p=o.get(u);for(let f of c)p.push(f)}return o}function wL(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=ee(f,l.severityMode);n[h]!==void 0&&n[h]++}let o=ge.filter(f=>n[f]>0),i=[...t.files.entries()].toSorted(([f,h],[g,b])=>b.length!==h.length?b.length-h.length:f.localeCompare(g)),s=[...t.reports].toSorted((f,h)=>f.localeCompare(h)),c=lr().get(e)?.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">${e}</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>${t.findings.length}</dd><dt>Files</dt><dd>${t.files.size}</dd><dt>Reports</dt><dd>${t.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=ce[Fe(f)]??ce.default;return d`<li><button type="button" class="packages-detail-report" data-tooltip="${f}" data-package-report="${f}">${re(h)}<span class="packages-detail-report-label">${he(f)}</span></button></li>`})}</ul><h3 class="packages-detail-section">Files</h3><ul class="packages-detail-files">${i.map(([f,h])=>{let g=y$(e,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 y$(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 v$(){Ot().catch(()=>{});let e=po(),t={inprogress:0,fixed:0,invalid:0,deleted:0},r=[];for(let[p,f]of e){let h=[],g=new Map;for(let b of f.findings){let y=l.triage.get(N(b))?.triage??null;y==="inprogress"?t.inprogress++:y==="fixed"?t.fixed++:y==="invalid"?t.invalid++:y==="deleted"&&t.deleted++,y===l.shownTriage&&(h.push(b),g.has(b.file)||g.set(b.file,[]),g.get(b.file).push(b))}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 _L(o[0],o[1]);let i=l.repositoriesSearchQuery.trim().toLowerCase(),s=i?r.filter(([p])=>p.toLowerCase().includes(i)||Me(p).toLowerCase().includes(i)):r.slice();$L(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="${E({"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>${kL(t)}</header>${r.length===0?d`<p style="color:var(--muted)">${e.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">${J(s,([p])=>p,([p,f])=>CL(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">${EL(o[0],o[1])}</div></aside>`:m}</div>`}</div>`}function kL(e){return d`<div class="packages-toolbar"><entity-search kind="repositories"></entity-search><entity-sort kind="repositories"></entity-sort><triage-selector variant="packages" .counts="${e}" .states="${xL}"></triage-selector></div>`}var xL=["inprogress","fixed","invalid","deleted"];function $L(e,t){let r=t==="name-asc"?(n,o)=>Me(n[0]).localeCompare(Me(o[0])):t==="files-desc"?(n,o)=>o[1].files.size-n[1].files.size||Me(n[0]).localeCompare(Me(o[0])):t==="reports-desc"?(n,o)=>o[1].reports.size-n[1].reports.size||Me(n[0]).localeCompare(Me(o[0])):(n,o)=>o[1].findings.length-n[1].findings.length||Me(n[0]).localeCompare(Me(o[0]));e.sort(r)}function SL(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=l.triage.get(N(n))?.triage??null;o==="invalid"?t.invalid++:o==="deleted"?t.deleted++:t.live++}return t}function _L(e,t){let r=po().get(e),n=SL(r),o=l.repositorySlideTriage??"live",i=r?w$(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">${Me(e)}</div><div class="bundles-slide-integrity">${s} ${a} · ${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?d`<div class="bundle-issues-empty">${c}</div>`:Ua(i,{kind:"repository",bucketKey:e})}</div></div>`}function CL(e,t,r){let n={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let a of t.findings){let c=ee(a,l.severityMode);n[c]!==void 0&&n[c]++}let o=ge.filter(a=>n[a]>0),i=bt(e),s=Me(e);return d`<li class="${r?"selected":""}" data-select-repository="${e}"><span class="packages-dot" style="${pe({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?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="${e}" aria-label="${`Open issues for ${s}`}">Issues →</button></li>`}function EL(e,t){let r=po().get(e),o=[...(r?w$(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>${AL(e,t)}`}function w$(e,t="live"){let r=new Map;for(let[n,o]of e.files){let i=o.filter(s=>{let a=l.triage.get(N(s))?.triage??null;return t==="invalid"?a==="invalid":t==="deleted"?a==="deleted":a!=="invalid"&&a!=="deleted"});i.length>0&&r.set(n,i)}return r}function AL(e,t){let r={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let a of t.findings){let c=ee(a,l.severityMode);r[c]!==void 0&&r[c]++}let n=ge.filter(a=>r[a]>0),o=[...t.files.entries()].toSorted(([a,c],[u,p])=>p.length!==c.length?p.length-c.length:a.localeCompare(u)),i=[...t.reports].toSorted((a,c)=>a.localeCompare(c)),s=/^https?:/iu.test(e)?e:`https://github.com/${e}`;return d`<dl class="packages-detail-meta"><dt>Repository</dt><dd class="mono"><a href="${s}" target="_blank" rel="noopener">${Me(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?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=ce[Fe(a)]??ce.default;return d`<li><button type="button" class="packages-detail-report" data-tooltip="${a}" data-package-report="${a}">${re(c)}<span class="packages-detail-report-label">${he(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>`}function k$(e,t){let r=new Set(e),n=new Set,o=new Map,i=new Map(e.map((s,a)=>[s,a]));for(let s of t){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:e.filter(s=>!n.has(s))}}function Ro(e,t,r){return`${e} ${e===1?t:r}`}function RL(e,t){let r=Re(l.triage.get(e)),n=t.filter(({name:a})=>Fr(l.triage,e,a)),o=r??(n.length>0?"ignored":null);if(!o)return m;let i=o==="ignored"&&n.length<t.length,s=i?`Ignored in ${n.length}/${t.length} reports`:tn[o];return d`<span class="${`links-finding-status triage-${o}`}" data-tooltip="${i?n.map(({name:a})=>he(a)).join(", "):m}">${s}</span>`}function Dm({id:e,title:t},r=[],n=!0,o=m){let i=r[0]?.name,s=pa(e),a=ko(e)??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="${e}" data-preview-report="${i}" data-preview-row="${r[0].rowIndex??m}" data-tooltip="${s}" aria-haspopup="dialog">${a}</button>`:Dt(e)?d`<a class="links-finding-id mono" href="${`#${mo({id:e})}`}" data-tooltip="${s}">${a}</a>`:d`<span class="links-finding-id mono">${a}</span>`} ${t?d`<span class="links-finding-title">${t}</span>`:m} ${RL(e,r)} ${n?m:d`<span class="links-member-context">not in this link</span>`} ${o}</li>`}function x$(e){return d`<div class="links-finding-reports">${e.map(({name:t,findingId:r})=>d`<button type="button" class="links-finding-report report-button" data-tooltip="${he(t)}" data-links-report="${t}" data-links-finding="${r}">${re(et[Fe(t)]??et.default)}<span class="links-finding-report-label report-button-label">${he(t)}</span></button>`)}</div>`}function TL(e,t){let r=e.reports.toSorted((n,o)=>he(n.name).localeCompare(he(o.name)));if(e.members.length===1){let n=e.members[0];return d`<li class="links-report-row links-report-row-single"><ul class="links-row-members">${Dm(n,r,t.has(n.id),x$(r))}</ul></li>`}return d`<li class="links-report-row"><div class="links-report-row-head"><span class="links-row-count">${Ro(e.members.length,"finding","findings")} in row</span> ${x$(r)}</div><ul class="links-row-members">${e.members.map(n=>Dm(n,r,t.has(n.id)))}</ul></li>`}function IL(e,t){let{rows:r,missing:n}=k$(e,Pp(e)),o=new Set(e);return d`<li class="links-group"><div class="links-group-head"><span class="links-group-index">Link ${t+1}</span> <span class="links-group-count">${Ro(e.length,"finding","findings")}</span></div><ul class="links-group-rows">${J(r,i=>i.key,i=>TL(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=>Dm({id:i,title:Np(i)}))}</ul></div>`:m}</li>`}function $$(e=m){let t=l.currentLinks;if(!t)return m;Ot().catch(()=>{});let{name:r,groups:n,skipped:o}=t,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=fo(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${e}</h1><div class="meta-row"><span class="links-file-name" data-tooltip="${r}">${re(ce[Fe(r)]??ce.default)}${he(r)}</span> <span>${Ro(n.length,"link","links")}</span> <span>${Ro(i.size,"finding","findings")}</span> ${s.size>0?d`<span>found in ${Ro(s.size,"report","reports")}</span>`:m}</div></div></header>${a<i.size?d`<p class="links-note">${Ro(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">${Ro(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">${J(n,(c,u)=>`${u}:${c.join(" ")}`,(c,u)=>IL(c,u))}</ol>`}</div>`}function LL(e,t,r){let n=new Set(t);for(let o of r)n.add(o);return e.filter(o=>n.has(o))}function S$(){if(l.currentWorkspace){let e=G().find(r=>r.id===l.currentWorkspace),t=l.reports.map(r=>r.fileName).filter(r=>typeof r=="string");return{mode:"workspace",workspaceId:l.currentWorkspace,fileNames:e?LL(e.reports??[],l.storedFiles??[],t):t}}if(l.currentFile){let e=G().find(t=>Array.isArray(t.reports)&&t.reports.includes(l.currentFile));return e?{mode:"single",workspaceId:e.id,fileNames:[l.currentFile]}:null}return null}var Nm=class extends I{static styles=[...I.styles,C(Be)];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 Pw(this.workspaceId,n.identifier);else{let i=await qn(n.identifier);o=await Fc(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:In(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:In(n),reason:i}]}this._uploading=!1,this._done=!0,r.length===0&&this._finish({uploaded:t,failed:r})};render(){let{count:t,singular:r,kindLabel:n}=Sd(this.items),o=r?d`Upload <strong>"${In(this.items[0])}"</strong> to the workspace's remote inventory?`:d`Upload <strong>${t}</strong> local ${n} to the workspace's remote inventory?`,i=r?m:_d(this.items),s=this._uploading?r?"Uploading\u2026":`Uploading ${t} ${n}\u2026`:r?"Upload":`Upload ${t}`;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>${Cd(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||t===0}">${s}</button>`}</footer></dialog>`}};customElements.define("sync-upload-dialog",Nm);function _$({workspaceId:e,items:t}={}){return ne("sync-upload-dialog",{workspaceId:e??"",items:Array.isArray(t)?[...t]:[]})}var C$=`.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}
|
|
134
|
-
|
|
135
|
-
`)}" title="Copy report names">${h}<span>${t.length} reports</span></span>`);let b=l.reports.flatMap(q=>q.groups.flat()),v=`${i} ${`finding${i===1?"":"s"}`}`,w=a||l.currentWorkspace?ad.filter(q=>q!=="type"):ad,$=R0(b,w),A=m;if(i>0){let q={};for(let Te of e){let nt=ee(Nr(Te),l.severityMode);nt&&(q[nt]=(q[nt]||0)+1)}let ue=ge.filter(Te=>q[Te]>0);ue.length>0&&(A=d`<span class="status-bar" aria-hidden="true">${ue.map(Te=>{let nt=`${q[Te]} ${Te.replaceAll("_"," ")}`;return d`<span class="${`status-seg sev-${Te}`}" style="${pe({flexGrow:q[Te]})}" title="${nt}"></span>`})}</span>`)}let T=new Set(l.reports.map(q=>q.repo??null)),F=T.size===1?[...T][0]:null,M=OL(r,n,F),O=d`<span class="sep" aria-hidden="true"></span>`,V=l.currentView==="files",H=(o??0)>1?d`<button type="button" class="${E({"files-toggle-btn":!0,active:V})}" data-action="toggle-files" aria-pressed="${String(V)}">${`Files: ${o}`}</button>`:m;return d`<header class="page-head"><div class="page-title"><h1>${u}${g}${M}${H}${M$()}</h1><div class="meta-row"><span>${v}</span> ${A} ${$.length>0?d`${O}${$.map(q=>d`<span class="tag">${q}</span>`)}`:m}</div></div></header>`}var NL=new Set(["findings","files","links"]);function M$(){if(j.status!=="online")return m;if(!NL.has(l.currentView))return m;let e=S$();if(!e)return m;let{workspaceId:t,fileNames:r,mode:n}=e;if(n==="single"){let b=r[0],y=Yf(t,b)?"cloud":"local";return PL({status:y,label:y,title:y==="cloud"?"Synced to remote":"Local only \u2014 click to upload",onClick:y==="local"?()=>A$({workspaceId:t,items:[{kind:"report",identifier:b}]}):null})}let o=G().find(b=>b.id===t),i=o&&Array.isArray(o.bundles)?o.bundles:[],s=Tw(t),a=r.filter(b=>!Yf(t,b)),c=i.filter(b=>!Aw(t,b)),u=[...a.map(b=>({kind:"report",identifier:b})),...c.map(b=>({kind:"bundle",identifier:b}))];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="${b=>{b.stopPropagation(),E$({workspaceId:t,cloudCount:s,localFileNames:r,localBundles:i})}}">${O$()}<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="${b=>{b.stopPropagation(),A$({workspaceId:t,items:u})}}">${B$()}<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 PL({status:e,label:t,title:r,onClick:n}){let o=e==="cloud"?O$():B$(),i=d`<span class="sync-badge-label">${t}</span>`;return typeof n!="function"?d`<span class="report-sync-badge" data-status="${e}" title="${r}" aria-label="${`report sync status: ${t}`}">${o}${i}</span>`:d`<button type="button" class="report-sync-badge report-sync-badge-clickable" data-status="${e}" data-tooltip="${r}" aria-label="${`report sync status: ${t}`}" @click="${n}">${o}${i}</button>`}function B$(){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 O$(){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 A$({workspaceId:e,items:t}){let r=t.filter(n=>n.kind==="bundle");if(r.length>0){let n=await qt(),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 _$({workspaceId:e,items:t})}function zL(e){return Object.values(e).some(r=>r>0)||l.filterSeverities.size>0?d`<severity-chips .counts="${e}"></severity-chips>`:m}function UL(e){return Object.values(e).some(r=>r>0)||l.filterColors.size>0?d`<triage-filter .counts="${e}"></triage-filter>`:m}function HL(e,t,r,n,o,i,s,a){let{showSource:c,showConfidence:u,showPriority:p,showGraphMode:f,showFileSort:h,kanbanMode:g,showRepo:b,hasComment:y,hasFix:v,hasFlagged:k,hasDuplicates:w,hasCrossContext:$,hasAppStacked:A,showSeverityMode:T,revalidateOptions:F,showPartial:M,canDropLayer:O,canDetailLayer:V,canUpstreamLens:H,confirmedLocked:q}=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} ${!q&&(u||F.length>0)?d`<conf-filter ?range-disabled="${!u}" .revalidateOptions="${F}" ?has-partial="${M}"></conf-filter>`:m} ${y||v||k||l.filterComment||l.filterFix||l.filterFlagged?d`<annotation-filter .hasComment="${y}" .hasFix="${v}" .hasFlagged="${k}"></annotation-filter>`:m} ${g?m:d`<triage-selector .counts="${r}"></triage-selector>`}<div class="toolbar-end"><download-button></download-button>${!l.currentWorkspace&&(w||l.filterDuplicates)||$||A||l.filterCrossContext||l.filterAppStacked?d`<annotation-filter group="context" .hasDuplicates="${w}" .hasCrossContext="${$}" .hasAppStacked="${A}"></annotation-filter>`:m} ${O||l.revalidateConflicts.size>0?d`<revalidation-switch ?can-drop="${O}" ?can-detail="${V}" ?can-upstream="${H&&O}" .upstreamDisabled="${l.showRevalidation===!1&&O}"></revalidation-switch>`:m}</div></div><div class="toolbar-row sev-row">${T?d`<severity-mode-switch></severity-mode-switch>`:m} ${zL(n)} ${s.analyzers.length>1||s.models.length>1?d`<analyzer-select .analyzers="${s.analyzers}" .models="${s.models}" .groups="${s.groups}"></analyzer-select>`:m} ${b&&a.length>1?d`<repo-filter .options="${a}"></repo-filter>`:m} ${UL(o)}<div class="search-row"><toolbar-search kind="findings"></toolbar-search><span class="result-count">${e} of ${t}</span></div></div></div>`}function zm(e,t){return e.map(r=>({p:Nr(r),g:r})).toSorted((r,n)=>t(r.p,n.p)).map(r=>r.g)}var R$=(e,t)=>e.file.localeCompare(t.file)||parseInt(e.line,10)-parseInt(t.line,10),Bd=null,T$=0,Mi=null;function ja(e,t=!1,r=null,n=!1,o=!1){return d`<finding-card data-gid="${Z(e)}" .group="${e}" ?in-group="${t}" context="${r??m}" ?lazy="${n}" ?popup="${o}"></finding-card>`}var D$=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>`,N$=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>`,Vm=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>`,Km=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>`,jL={critical:"C",high:"H",medium:"M",low:"L",high_bug:"H",bug:"B",informational:"i"};function Um(e,t={}){let{variant:r="kanban",active:n=!1,expandedTrackLast:o=!1}=t,i=Ce(e),s=Je(e),a=qe(s)||"(untitled finding)",c=r==="kanban",u=r==="kanban-side",p={"kanban-card":!0,"has-conflict":i.hasConflict,"focus-side-card":!c,"kanban-expanded-track-last":o,active:n};!i.hasConflict&&i.commonColor&&(p[`mark-${i.commonColor}`]=!0);let f=parseInt(s.line,10),h=Number.isFinite(f)?`:${f}`:"",g=ee(s,l.severityMode),b=jL[g]??"?",y=xt(s)&&l.severityMode!=="original",v=de(s),k=v?.flagged===!0,w=v?.fix??"",$=v?.comment??"",A=m;c&&w?A=$e(w)?d`<a class="kanban-action kanban-fix-link" href="${w}" target="_blank" rel="noopener noreferrer" draggable="false" data-tooltip="${`Open fix link: ${w}`}" aria-label="${`Open fix link: ${w}`}">${Ia}</a>`:d`<button type="button" class="kanban-action mark-fix" data-tooltip="${`Edit fix link: ${w}`}" aria-label="${`Edit fix link: ${w}`}">${Ia}</button>`:c&&$&&(A=d`<button type="button" class="kanban-action mark-comment" data-tooltip="${`Edit comment: ${$}`}" aria-label="${`Edit comment: ${$}`}">${yd}</button>`);let T=d`<div class="kanban-badge-col"><span class="${`kanban-badge sev-${g}`}" title="${y?`${ct(g)} \u2014 corrected from ${ct(s.severity)}`:ct(g)}" aria-label="${y?`Severity ${ct(g)}, corrected from ${ct(s.severity)}`:`Severity ${ct(g)}`}">${b}${y?"*":""}</span> ${k?d`<span class="kanban-flag" title="Flagged" aria-label="Flagged">${vd}</span>`:m} ${A}</div><span class="kanban-title">${a}</span><div class="kanban-meta"><span class="kanban-loc">${s.file}${h}</span> ${s.confidence===void 0||s.confidence===null?m:d`<span class="kanban-conf" title="${`Confidence ${s.confidence}/10`}">${s.confidence}</span>`}</div>`;return c?d`<div class="${E(p)}" data-gid="${Z(e)}" data-kanban-source draggable="${wn(e,i).length>0?"true":"false"}" role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Open details for ${a}`}">${T}</div>`:u?d`<div class="${E(p)}" data-gid="${Z(e)}" data-kanban-select role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Show details for ${a}`}">${T}</div>`:d`<div class="${E(p)}" data-gid="${Z(e)}" data-focus-select role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Focus on ${a}`}">${T}</div>`}function WL(e){let{content:t,range:r,highlighted:n}=e,o=t.split(`
|
|
136
|
-
`).length,i=String(o).length;return d`<div class="focus-code-lines" style="${pe({"--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="${E(p)}" data-focus-code-line="${c}">${c}</div>`})}</aside><pre class="focus-code-source"><code>${typeof n=="string"?re(n):t}</code></pre></div>`}function P$(e,t=m,r=!1){l.focusCodeTick;let n=ox(e),o=Aa(e),i=n?"focus-main with-code":"focus-main",s=pe({"--focus-split":String(l.focusSplit)});return d`<div class="${i}" style="${s}"><div class="focus-pane focus-pane-card"><div class="focus-card-wrapper">${ja(e,!1,"focus",!1,r)}</div></div>${t} ${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="${ql}" aria-valuemax="${Yl}" 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">:${Xc(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">${Vm}</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">${Km}</button></div>`:m}</header><div class="focus-code-body">${WL(n)}</div>`}</div>`:m}</div>`}function z$(e,t,r=[],n=null){if(!e&&!n)return m;let o=e?Ce(e):{},i=l.kanbanDetailFullscreen,s={"kanban-detail-modal":!0,fullscreen:i,"has-conflict":o.hasConflict},a=e?Z(e):null,c=t?.items??[],u=c.findIndex(f=>Z(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?N$:D$}</button> <button type="button" class="kanban-detail-close detail-action" aria-label="Close details">×</button></div>`;return d`<div class="${E({"kanban-detail-backdrop":!0,"links-preview-backdrop":!!n})}"><div class="kanban-detail-dim"></div><div class="${E(s)}" role="dialog" aria-modal="true" aria-label="${n?"Finding preview":"Finding details"}">${i&&e?m:p}<div class="kanban-detail-body">${e?i?P$(e,p,!0):ja(e,!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="${`${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(f=>{let h=f.key===t.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">${Vm}</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">${Km}</button></div></div><div class="kanban-detail-side-body">${J(c,f=>Z(f),f=>Um(f,{variant:"kanban-side",active:Z(f)===a}))}</div></aside>`}</div>`}function VL(e){if(l.viewMode==="table"){let r=l.sortBy==="file"?zm(e,R$):e;if(r.length===0)return m;let n=l.tableSelectedGid?r.find(i=>Z(i)===l.tableSelectedGid):null;return Bd=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">${ja(n)}</div></aside>`:m}</div>`}if(l.viewMode==="focus"){if(e.length===0)return m;let r=l.focusGid?e.findIndex(s=>Z(s)===l.focusGid):-1;r<0&&(r=Math.min(T$,e.length-1)),T$=r;let n=e[r],o=r===0,i=r===e.length-1;return d`<div class="focus-view">${P$(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">${Vm}</button> <span class="count">${r+1} / ${e.length}</span> <button type="button" class="focus-nav-btn" data-focus-nav="next" ?disabled="${i}" aria-label="Next finding">${Km}</button></div></div><div class="focus-sidebar-body">${J(e,s=>Z(s),s=>Um(s,{variant:"focus",active:Z(s)===Z(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 e){let f=Ce(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?e.find(u=>Z(u)===l.kanbanPopoverGid):null,c=a?r.find(u=>u.key===(Ce(a).commonTriage??"untriaged")):null;return d`<div class="kanban-board" style="${pe(s)}">${J(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?N$:D$}</button></div><div class="kanban-column-body">${p.length===0?d`<div class="kanban-empty">No ${u.label.toLowerCase()} findings.</div>`:J(p,h=>Z(h),(h,g)=>Um(h,{active:Z(h)===l.kanbanPopoverGid,expandedTrackLast:(g+1)%r.length===0}))}</div></div>`})}</div>${z$(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?Z(p[0]):""}}))}`}if(l.viewMode==="grouped"){let r=new Map;for(let o of e){let i=Nr(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`${J(n,o=>o,o=>{let i=l.sortBy==="file"?zm(r.get(o),(a,c)=>parseInt(a.line,10)-parseInt(c.line,10)):r.get(o),s=Nr(i[0]);return d`<div class="file-group"><div class="file-header"><span>${bh(s,Et(s))}</span> <span class="count">${i.length}</span></div><div class="file-body">${J(i,a=>Z(a),a=>ja(a,!1,null,!0))}</div></div>`})}`}let t=l.sortBy==="file"?zm(e,R$):e;return d`${J(t,r=>Z(r),r=>{let n=Je(r),o=Vk(n,Et(n)),i=wo(n),s=Rr(n),a=r.length>1;return d`<div class="${E({"flat-group":!0,"multi-case":a})}"><div class="flat-group-loc"><span class="file">${bh(n,Et(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>${ja(r,!0,null,!0)}</div>`})}`}function KL(){l.bundleSourceFile&&_o().catch(()=>{});let e=document.querySelector("#bundle-source-overlay-slot");e&&Q(p$(),e)}var I$=null;function x(){let e=I$;if(I$=l.currentView,e!==null&&e!==l.currentView&&typeof document.startViewTransition=="function"&&!matchMedia("(prefers-reduced-motion: reduce)").matches){document.startViewTransition(()=>F$());return}F$()}function Ha(e){let t=document.querySelector(`#${e}`);return(!t||!R.contains(t)||R.firstElementChild!==t)&&(R.innerHTML=`<div id="${e}"></div>`,t=document.querySelector(`#${e}`)),t}var GL={"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-teams":{slot:"manage-teams-slot",tag:"managed-admin-teams",title:"DeepView \u2014 teams"}},L$=(e,t)=>e==null&&t==null?0:e==null?1:t==null?-1:e.localeCompare(t),Md=null;function Am(){l.currentWorkspace&&l.revalidationDetailed&&(l.revalidationDetailed=!1);let e=l.revalidateConflicts.size>0,t=!e&&Hc(l.reports);return e?l.showRevalidation!==!1&&(Md=l.showRevalidation,l.showRevalidation=!1):(Md!==null&&(l.showRevalidation=Md,Md=null),!t&&l.showRevalidation===!1&&(l.showRevalidation=!0)),l.upstreamOnly&&(!t||l.showRevalidation===!1||!l.reports.some(r=>(r.groups??[]).some(n=>n.some(o=>o.isUpstream))))&&(l.upstreamOnly=!1),hn(l.showRevalidation,l.upstreamOnly),t}function F$(){Ct()||nd(),KL(),qc(l.reports),Yc(l.reports)&&$o();let e=Am(),t=l.reports.some(L=>(L.groups??[]).some(D=>D.some(se=>se.isUpstream)));if(l.currentView==="bundles")if((l.bundles??[]).length===0)l.currentView="findings";else{Ei(l.bundleDetailsTab,l.bundleSourceFile)&&_o().catch(()=>{});let L=Ha("bundles-slot");L&&Q(m$(l.bundles),L);let D=l.bundleDetails,se=l.selectedBundle&&D&&(D.json||D.bundle);if(se&&l.bundleDetailsTab==="graph"){let we=document.querySelector("#bundle-graph-slot");if(we){let pt=c$(l.bundleDetails);if(pt){d$(pt);let s_={hideAllFiles:!0,triageCounts:l$(l.bundleDetails,new Set(pt.strippedToOrig.values())),triageStates:["inprogress","fixed","invalid","deleted"],showSplitOwnDirs:pt.canSplitOwnDirs,showPackagesView:pt.canPackagesView,showBundleLayouts:!0};lm(we,pt,s_,Ld,Fd)}}}if(se&&!D.metadataOnly&&l.bundleDetailsTab==="terminal"){let we=document.querySelector("#bundle-terminal-slot");we&&wx(we,l.bundleDetails)}R.classList.add("active"),Ne.classList.add("hidden"),document.title="DeepView \u2014 bundles";return}if(l.currentView==="packages"){let L=Ha("packages-slot");L&&Q(g$(),L),R.classList.add("active"),Ne.classList.add("hidden"),document.title="DeepView \u2014 packages";return}if(l.currentView==="repositories"){let L=Ha("repositories-slot");L&&Q(v$(),L),R.classList.add("active"),Ne.classList.add("hidden"),document.title="DeepView \u2014 repositories";return}if(l.currentView==="links"){if(l.currentLinks){let L=Ha("links-slot"),D=Ct();L&&Q(d`${$$(M$())}${D?z$(D.group,null,[],D):m}`,L),R.classList.add("active"),Ne.classList.add("hidden"),document.title=`DeepView \u2014 ${l.currentLinks.name}`;return}l.currentView="findings"}let r=GL[l.currentView];if(r){let L=Ha(r.slot);if(L&&!L.firstElementChild){let D=document.createElement(r.tag);L.append(D),(async()=>{await customElements.whenDefined(r.tag),await D.updateComplete,Nt(D.renderRoot)})().catch(()=>{})}R.classList.add("active"),Ne.classList.add("hidden"),document.title=r.title;return}if(l.reports.length===0)return;let n=At(),o=l.viewMode==="kanban",i={inprogress:0,fixed:0,invalid:0,deleted:0,ignored:0},s=[];for(let L of n){let D=Ce(L).commonTriage;D&&i[D]++,(o||D===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 D of L){xt(D)&&(p=!0);let se=de(D);se&&(se.comment&&(a=!0),se.fix&&(c=!0),se.flagged===!0&&(u=!0))}let f=Qc(),h=n.some(L=>L.some(D=>f.has(D.id)));h||(l.filterDuplicates="");let g=s.some(Ch),b=s.some(Eh);g||(l.filterCrossContext=""),b||(l.filterAppStacked="");let y=new Set,v=!1,k=!1,w=!1;for(let L of s)for(let D of L){let se=hr(D);se&&y.add(se)}for(let L of Oh()){let D=!1,se=!1;for(let we of L){let pt=xe(we);pt==="partial"&&(k=!0),(pt==="unreachable"||pt==="refuted")&&(w=!0),pt==="revalidation"?D=!0:se=!0}D&&se&&(v=!0)}let A=[...new Set(l.reports.map(L=>L.type))].join(", "),T=l.reports.map(L=>L.fileName),F=s.map(zt).filter(L=>L.length>0),M=F.length>0&&xh(F),O=_h(n),V=n.some(L=>L.some(D=>gt(D.file))),H=n.some(L=>L.some(D=>!gt(D.file))),q=!1,ue=!1,Te;e:for(let L of n)for(let D of L)if(!ue)ue=!0,Te=D.file;else if(D.file!==Te){q=!0;break e}let nt=n.some(L=>L.some(D=>!D.repo?.github&&!gt(D.file))),kr=new Set;for(let L of n)for(let D of L)!gt(D.file)&&D.repo?.github&&kr.add(D.repo.github);let Zt=kr.size===1?[...kr][0]:null,Qt=new Set,jr=new Set;for(let L of n)for(let D of L)Qt.add(D._analyzer??null),jr.add(ha(D));let du=Object.keys(Nh),Hi=L=>{if(L==null)return 1/0;let D=du.indexOf(L);return D===-1?du.length:D},el=[...Qt].toSorted((L,D)=>{let se=Hi(L),we=Hi(D);return se!==we?se-we:String(L??"").localeCompare(String(D??""))}),ji=[...jr].toSorted(L$);if(l.filterAnalyzer){let L=l.filterAnalyzer===gn?null:l.filterAnalyzer;(!Qt.has(L)||Qt.size<2)&&(l.filterAnalyzer="")}if(l.filterModel){let L=l.filterModel===bn?null:l.filterModel;(!jr.has(L)||jr.size<2)&&(l.filterModel="")}let Mo=Rk(y);l.filterRevalidate&&!Mo.some(L=>L.value===l.filterRevalidate)&&(l.filterRevalidate="");let Wi=td(s);Wi&&(l.filterRevalidate="confirmed");let uu=y.has("partial")&&vn();uu||(l.filterPartial="");let tl=!l.currentWorkspace&&e&&(v||k||w),Vi=!(e&&l.showRevalidation!==!1)&&!l.upstreamOnly&&V&&H;!Vi&&l.filterSources.size>0&&l.filterSources.clear(),M||(l.filterConfMin=0,l.filterConfMax=10,(l.sortBy==="confidence-desc"||l.sortBy==="confidence-asc")&&(l.sortBy="severity")),!O&&(l.sortBy==="priority-desc"||l.sortBy==="priority-asc")&&(l.sortBy="severity"),!q&&l.sortBy==="file"&&(l.sortBy="severity");let S=a0(s),B={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},z={red:0,blue:0,green:0,gray:0,none:0};for(let L of S){if(L.length===1){let we=ee(L[0],l.severityMode);B[we]=(B[we]||0)+1;let pt=de(L[0])?.color??"none";z[pt]=(z[pt]||0)+1;continue}let D=new Set(L.map(we=>ee(we,l.severityMode)));for(let we of D)B[we]=(B[we]||0)+1;let se=new Set(L.map(we=>de(we)?.color??"none"));for(let we of se)z[we]=(z[we]||0)+1}let K=Jk(S),ve=[...K].toSorted(L$);if(l.filterRepo){let L=l.filterRepo===xo?null:l.filterRepo;K.has(L)||(l.filterRepo="")}let Pe=rd(yn(s)),vt=sm(l.reports),Ki=vt?Object.keys(vt).length:0,Bo=Ki>1;!Bo&&l.currentView==="files"&&(l.currentView="findings"),!Bo&&l.viewMode==="graph"&&(l.viewMode="kanban");let Wr=DL(n,T,nt,Zt,Ki);if(l.currentView==="files"){let L=im(n,l.severityMode),D=document.querySelector("#header-slot"),se=document.querySelector("#tree-view-slot");(!D||!se||!R.contains(D)||!R.contains(se))&&(R.innerHTML='<div id="header-slot"></div><div id="tree-view-slot"></div>',D=document.querySelector("#header-slot"),se=document.querySelector("#tree-view-slot")),D&&Q(Wr,D),se&&Q(bx(vt,L),se),R.classList.add("active"),Ne.classList.add("hidden"),document.title=`DeepView \u2014 ${A||"no analyzer"}`;return}let r_=l.viewMode==="table"&&l.tableSelectedGid&&Pe.some(L=>Z(L)===l.tableSelectedGid),Gi=null;l.viewMode==="graph"&&vt&&(Gi=Hm(),Gi||(l.viewMode="kanban"));let nl=!!Gi,On="findings-content";r_&&(On+=" with-details"),nl&&(On+=" with-graph"),o&&(On+=" with-kanban"),l.viewMode==="focus"&&(On+=" with-focus");let Ab=m,ol=m,Rb=m;Bd=null,nl||(Ab=HL(Pe.length,s.length,i,B,z,{showSource:Vi,showConfidence:M,showPriority:O,showGraphMode:Bo,showFileSort:q,kanbanMode:o,showRepo:!!l.currentWorkspace,hasComment:a,revalidateOptions:Mo,showPartial:uu,canDropLayer:e,canDetailLayer:tl,canUpstreamLens:t,confirmedLocked:Wi,hasFix:c,hasFlagged:u,hasDuplicates:h,hasCrossContext:g,hasAppStacked:b,showSeverityMode:p||l.severityMode==="original"},{analyzers:el,models:ji,groups:S},ve),l.shownTriage&&s.length===0?ol=d`<p style="color:var(--muted);margin:1rem 0">No ${l.shownTriage} findings.</p>`:Pe.length===0&&s.length>0&&!o?ol=d`<p style="color:var(--muted);margin:1rem 0">No findings match the current filters.</p>`:s.length===0&&(ol=n.length>0?d`<p style="color:var(--green)">All ${A} issues triaged.</p>`:d`<p style="color:var(--green)">No ${A} issues found.</p>`),Rb=VL(Pe));let qi=document.querySelector("#header-slot"),er=R.querySelector(":scope > .findings-content"),n_=er&&er.querySelector(":scope > #findings-graph-slot"),o_=er&&er.querySelector(":scope > #findings-body-slot"),i_=er&&(n_?"graph":o_?"body":null)===(nl?"graph":"body");if(!qi||!er||!R.contains(qi)||!R.contains(er)||!i_){let L=nl?'<div id="findings-graph-slot"></div>':'<div id="toolbar-slot"></div><div id="empty-state-slot"></div><div id="findings-body-slot"></div>';R.innerHTML=`<div id="header-slot"></div><div class="${On}">${L}</div>`,qi=document.querySelector("#header-slot"),er=R.querySelector(":scope > .findings-content")}else er.className!==On&&(er.className=On);qi&&Q(Wr,qi);let Tb=document.querySelector("#toolbar-slot");Tb&&Q(Ab,Tb);let Ib=document.querySelector("#empty-state-slot");Ib&&Q(ol,Ib);let Lb=document.querySelector("#findings-body-slot");if(Lb&&Q(Rb,Lb),Gi){let L=document.querySelector("#findings-graph-slot");if(L){let se={extraTopRow:d`<view-mode-buttons modes="kanban,focus,table,list,grouped,graph"></view-mode-buttons>`,triageCounts:i,triageStates:["inprogress","fixed","invalid","deleted","ignored"]};lm(L,Gi,se,jm,Wm)}}if(Bd){let L=R.querySelector(".finding-table-slot");L&&(Mi||(Mi=document.createElement("finding-table")),Mi.items=Bd,Mi.selectedGid=l.tableSelectedGid,Mi.parentNode!==L&&L.append(Mi))}R.classList.add("active"),Ne.classList.add("hidden"),document.title=`DeepView \u2014 ${A||"no analyzer"}`}function U$(e){let t=document.querySelector("#landing-workspaces");if(!t)return;let r=e.toSorted((n,o)=>o.reports.length-n.reports.length||n.name.localeCompare(o.name)).slice(0,5);Q(r.length>0?d`<nav class="landing-workspaces" aria-label="Workspaces"><div class="landing-workspace-row">${J(r,n=>n.id,n=>d`<button type="button" class="landing-workspace" data-landing-workspace="${n.id}">${re(hi)} <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,t)}var Od=`.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}}
|
|
137
|
-
`;var YL=[{id:"workspace",label:"Export workspace"},{id:"raw",label:"Raw reports export"}],Gm=class extends I{static styles=[...I.styles,C(Pt),C(Od)];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(t){this._settled||(this._password="",this._confirm="",this.workspace=null,super._finish(t))}_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(t){this._busy||this._tab===t||(this._tab=t,this._error="",t!=="workspace"&&(this._password="",this._confirm=""))}_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._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 t=this._tab;this._busy=!0,this._error="";try{let{blob:r,filename:n}=t==="raw"?await Pf(this.workspace):await Nf(this.workspace,{password:this._noPassword?void 0:this._password,includeBundleBytes:this._includeBundleBytes});if(this._settled)return;Sr(r,n),this._finish({ok:!0,tab:t})}catch(r){if(this._settled)return;this._error=r?.message??String(r)}finally{this._busy=!1}};_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onExport())};_tabsTemplate(){return $d({tabs:YL,current:this._tab,prefix:"wsl",disabled:this._busy,select:t=>this._selectTab(t)})}_workspacePanel(){let t=!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&&!t?d`<p class="wsl-error" role="alert">Passwords don't match.</p>`:m}`}_rawPanel(){let t=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>${t===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",Gm);function H$({workspace:e}={}){return pi("workspace-export-dialog",{workspace:e??null},t=>{t.workspace=null})}async function j$(e){await H$({workspace:e})}var qm=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 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="${!t}" @click="${this._onCreate}">Create</button></footer></dialog>`}};customElements.define("new-workspace-dialog",qm);function W$(){return ne("new-workspace-dialog")}var Ym=class extends I{static styles=[...I.styles,C(Be)];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?d`<p class="lwd-note">No local triage is attached to ${this.reportCount===1?"this report":"these reports"}.</p>`:t===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>${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",a=t===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>${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} ${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",Ym);function V$({name:e,reportCount:t,bundleCount:r,triageImpact:n}={}){return ne("leave-workspace-dialog",{workspaceName:e??"",reportCount:t??0,bundleCount:r??0,orphanedTriage:n?.orphanedCount??0,sharedTriage:n?.sharedCount??0})}var Xm=class extends I{static styles=[...I.styles,C(Pt)];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 Wf({id:this.workspaceId,name:this._name.trim(),privateKeyBase64:this.privateKeyBase64,password:this._password});if(this._settled)return;this._url=Kf(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?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="${t=>t.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",Xm);function K$({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(Po(s.detail?.cause))}),document.body.append(i)})}var Jm=class extends I{static styles=[...I.styles,C(Be)];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(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?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 t=this.orphanedTriage,r=this.sharedTriage;return t===0&&r===0?d`<p class="lwd-note">No local triage is attached to this ${this.kindLabel}.</p>`:t===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>${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 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",Jm);function G$({name:e,kindLabel:t,triageImpact:r,inRemote:n}={}){return ne("delete-report-dialog",{reportName:e??"",kindLabel:t||"report",orphanedTriage:r?.orphanedCount??0,sharedTriage:r?.sharedCount??0,inRemote:!!n})}var Zm=class extends I{static styles=[...I.styles,C(Be)];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?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",Zm);function q$({name:e,inRemote:t}={}){return ne("delete-bundle-dialog",{bundleName:e??"",inRemote:!!t})}var Qm=class extends I{static styles=[...I.styles,C(Be)];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 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",Qm);function Y$({name:e,workspaceName:t}={}){return ne("detach-bundle-dialog",{bundleName:e??"",workspaceName:t??""})}var eg=class extends I{static styles=[...I.styles,C(Be)];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 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",eg);function X$({name:e,workspaceName:t}={}){return ne("detach-report-dialog",{reportName:e??"",workspaceName:t??""})}var tg=class extends I{_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",tg);function J$(){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 rg=class extends I{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",rg);function Z$(){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 Oi=null,ie=null,n1=null;tk();function XL(){return lr().size}function JL(){return po().size}var Wa=typeof location>"u"||location.hostname.endsWith(".github.io")?"":`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/sync`,ug="application/x-deepview-report",ag="application/x-deepview-source-ws",Va="application/x-deepview-bundle",Dd=!1,Nd=!1,ZL={default:"Reports","claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec",piolium:"Piolium",[St]:"Links"},Q$=["default","claude-security","codex-security","deepsec","piolium",St],To="";function e1(e,t={}){let n=`file-item${e===l.currentFile&&(t.workspaceId??null)===Co(e)&&(l.currentView==="findings"||l.currentView==="files"||l.currentView==="links")?" current":""}${t.indented?" indented":""}`,o=he(e),i=Ps(e),s=ce[Fe(e)]??ce.default;return d`<li class="${n}" data-file="${e}" data-workspace-id="${t.workspaceId??m}" draggable="true"><button type="button" class="file-name" data-tooltip="${o}">${re(s)}<span class="file-label">${o}</span>${i===void 0?m:d`<span class="file-count">${i}</span>`}</button></li>`}function o1(e,t={}){let r=`file-group-header${t.dropTarget?" default-reports":""}`;return d`<li class="${r}" data-default-reports="${t.dropTarget?"true":m}"><span class="group-label">${e}</span></li>`}var QL=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>`;function e5(){let e=l.serverMode==="managed"?m:d`<span class="workspace-header-actions"><button type="button" class="workspace-add" data-action="new-workspace" aria-label="Create a new workspace">${QL}</button></span>`;return d`<li class="file-group-header workspace-header"><span class="group-label">Workspaces</span>${e}</li>`}function t5(){if(l.serverMode!=="managed")return m;let e=Array.isArray(l.managedTeams)?l.managedTeams:[];return e.length===0?m:d`${o1("Teams")} ${J(e,t=>t.id,t=>d`<li class="file-item team-item"><span class="team-name">${c5}<span class="team-label">${t.name}</span></span></li>${J(Array.isArray(t.reports)?t.reports:[],r=>r.id,r=>r5(r))}`)}`}function r5(e){return d`<li class="file-item indented team-report-item"><button type="button" class="file-name" data-tooltip="${e.filename}" @click="${()=>{n5(e)}}">${re(ce.default)}<span class="file-label">${e.filename}</span></button></li>`}async function n5(e){let t=await jw(e.id);if(t==null){console.warn("managed: could not load team report",e.id);return}await dt(e.filename,t)}function o5(){return d`<li class="file-group-header bundles-header" data-default-bundles="true"><span class="group-label">Bundles</span></li>`}var i5=d`${re(fi)}`;function t1(e,t={}){let{integrity:r,name:n}=e,o=l.selectedBundle===r&&l.currentView==="bundles",s=`file-item bundle-item${t.workspaceId!=null?" indented":""}${o?" current":""}`;return d`<li class="${s}" data-bundle-integrity="${r}" data-workspace-id="${t.workspaceId??m}" draggable="true"><button type="button" class="file-name" data-tooltip="${`${n}
|
|
138
|
-
${r}`}">${i5}<span class="file-label">${n}</span></button></li>`}function s5(e,t){let r=e.slice(0,15);return d`<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 a5(e,t){return d`<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 · ${he(e)}</em></span></span></li>`}var l5=d`${re(hi)}`,c5=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>`,d5=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>`,u5=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>`,p5=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>`;function f5(e){let r=`file-item workspace-item${l.currentWorkspace===e.id&&(l.currentView==="findings"||l.currentView==="files")?" current":""}`;return d`<li class="${r}" data-workspace-id="${e.id}"><button type="button" class="file-name">${l5}<span class="file-label" .textContent="${e.name}"></span></button><button type="button" class="workspace-share" data-action="share-workspace" data-tooltip="Share by link" aria-label="Share workspace by link">${p5}</button><button type="button" class="workspace-export" data-action="export-workspace" data-tooltip="Export workspace" aria-label="Export workspace">${d5}</button><button type="button" class="workspace-leave" data-action="leave-workspace" data-tooltip="Leave workspace" aria-label="Leave workspace">${u5}</button></li>`}function Bi(e){return To?he(e).toLowerCase().includes(To):!0}var ng=(e,t)=>he(e).localeCompare(he(t));async function te(){await Rf(),Ot().catch(()=>{}),$f().catch(()=>{});let e=await fe(),t=G();U$(t);let[r]=await Promise.all([qt(),...t.map(h=>$t("workspace",h.id))]);if(l.bundles=r,l.storedFiles=e,ah(),!ie)return;let n=new Set(e),o=new Set;for(let h of t)for(let g of h.reports)n.has(g)&&o.add(g);let i=new Map(r.map(h=>[h.integrity,h])),s=new Set;for(let h of t)for(let g of h.bundles)i.has(g)&&s.add(g);let a=new Map;for(let h of Q$)a.set(h,[]);for(let h of e){if(o.has(h)||!Bi(h))continue;let g=Fe(h);a.has(g)||a.set(g,[]),a.get(g).push(h)}let c=t.filter(h=>!To||h.name.toLowerCase().includes(To)||h.reports.some(g=>Bi(g))?!0:h.bundles.some(g=>{let b=i.get(g);return b&&Bi(b.name)})),u=r.filter(h=>!s.has(h.integrity)&&Bi(h.name));Q(d`${t5()} ${l.serverMode==="managed"&&t.length===0?m:e5()} ${J(c,h=>h.id,h=>{let g=[],b=[];for(let k of h.reports)Bi(k)&&(n.has(k)?g.push(k):b.push(k));g.sort(ng),b.sort(ng);let y=[],v=[];for(let k of h.bundles){let w=i.get(k);w?(!To||Bi(w.name))&&y.push(w):To||v.push(k)}return d`${f5(h)} ${g.map(k=>e1(k,{indented:!0,workspaceId:h.id}))} ${b.map(k=>a5(k,h.id))} ${y.map(k=>t1(k,{workspaceId:h.id}))} ${v.map(k=>s5(k,h.id))}`})} ${Q$.map(h=>{let g=(a.get(h)??[]).toSorted(ng),b=h==="default";return g.length===0&&!(b&&Dd)?null:d`${o1(ZL[h]??h,{dropTarget:b})} ${g.map(y=>e1(y))}`})} ${u.length>0||Nd?o5():null} ${J(u,h=>h.integrity,h=>t1(h))}`,n1);let p=ie.querySelector('sidebar-view-button[kind="packages"]');p&&(p.count=XL());let f=ie.querySelector('sidebar-view-button[kind="repositories"]');f&&(f.count=JL()),Mn(),Yp(e,h5)}var og=!1;function h5(){og||(og=!0,requestAnimationFrame(()=>{og=!1,te().catch(e=>console.warn("counts repaint:",e))}))}He(()=>{te()});async function m5(e){if(e.target.closest('[data-action="go-home"]')){await qx();return}let t=e.target.closest(".file-item[data-bundle-integrity]");if(t){if(t.classList.contains("bundle-missing"))return;let c=t.dataset.bundleIntegrity;if(l.selectedBundle===c&&l.currentView==="bundles")return;En(c),Fn(c),x(),te(),Pr(c);return}let r=e.target.closest("sidebar-view-button");if(r){let c=r.getAttribute("kind");(c==="packages"||c==="repositories")&&(l.currentView=c,x(),te());return}if(e.target.closest('[data-action="new-workspace"]')){if(l.serverMode==="managed")return;let c=await W$();c&&(await Ad(),await af(c),te());return}let n=e.target.closest('[data-action="share-workspace"]');if(n){let c=n.closest("[data-workspace-id]"),u=c?G().find(p=>p.id===c.dataset.workspaceId):null;u&&K$({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 c=o.closest("[data-workspace-id]"),u=c?G().find(p=>p.id===c.dataset.workspaceId):null;u&&j$(u).catch(p=>alert(`Failed to open export dialog: ${p.message}`));return}let i=e.target.closest('[data-action="leave-workspace"]');if(i){let c=i.closest("[data-workspace-id]"),u=c?G().find(y=>y.id===c.dataset.workspaceId):null;if(!u)return;let p=Array.isArray(u.reports)?u.reports:[],f;try{f=await Cc(p)}catch(y){alert(`Couldn't read reports to analyze triage impact: ${y.message}`);return}let{confirmed:h,mode:g,triage:b}=await V$({name:u.name,reportCount:p.length,bundleCount:u.bundles.length,triageImpact:f});if(!h)return;if(!G().some(y=>y.id===u.id)){alert(`Workspace "${u.name}" was removed elsewhere; nothing to leave.`);return}try{await Xx(u.id,g,{triage:b})}catch(y){alert(`Failed to leave workspace: ${y.message}`)}return}let s=e.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)&&jt(c);return}let a=e.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)&&dt(c,void 0,{workspaceId:p});return}if(e.target.closest("sidebar-delete-current")){if(l.currentView==="bundles"&&l.selectedBundle){let y=l.selectedBundle,v=(l.bundles??[]).find($=>$.integrity===y)?.name??y,k=G().filter($=>Array.isArray($.bundles)&&$.bundles.includes(y)).filter($=>Xf($.id,y)).map($=>$.id),{confirmed:w}=await q$({name:v,inRemote:k.length>0});if(!w)return;if(l.selectedBundle!==y){alert(`Active bundle changed during confirmation; aborting delete of "${v}".`);return}try{await Yx({deleteFromRemoteWorkspaceIds:k})}catch($){alert(`Failed to delete bundle: ${$.message}`)}return}if(!l.currentFile)return;let c=l.currentFile,u;try{u=await Cc([c])}catch(y){alert(`Couldn't read reports to analyze triage impact: ${y.message}`);return}let p=G().filter(y=>Array.isArray(y.reports)&&y.reports.includes(c)).filter(y=>di(y.id,c)).map(y=>y.id),f=p.length>0,h=Uc(c)?"links file":"report",{confirmed:g,triage:b}=await G$({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 Gx({triage:b,deleteFromRemoteWorkspaceIds:p})}catch(y){alert(`Failed to delete ${h}: ${y.message}`)}return}if(e.target.closest("#sync-status")){if(l.serverModeMismatch)return;j.status==="error"?j.dismissError():j.status==="off"?(!j.getServerUrl()&&Wa&&j.setServerUrl(Wa),j.setEnabled(!0)):j.setEnabled(!1);return}for(let c of Object.keys(u1))if(e.target.closest(`[data-action="${c}"]`)){ie?.querySelector("#user-menu")?.hidePopover?.(),R5(c);return}if(e.target.closest('[data-action="managed-logout"]')){Vw(l.managedSession?.csrfToken);return}if(e.target.closest("#auth-status")){l.managedSession==null&&Ww(l.managed?.loginPath);return}if(e.target.closest("#sidebar-toggle")){if(l.serverMode==="managed")return;Oi.classList.toggle("collapsed");try{localStorage.setItem("deepview.sidebarCollapsed",Oi.classList.contains("collapsed")?"1":"0")}catch{}}}var g5={placement:"right",gate:e=>{let t=e.querySelector(".file-label");return!t||(e.dataset.tooltip??"")!==t.textContent?!0:t.scrollWidth>t.clientWidth}};function b5(e){To=e.target.value.trim().toLowerCase(),te()}var y5={off:"Sync off",online:"Online",offline:"Offline",connecting:"Connecting\u2026",error:"Sync error"};function v5(){return j.getServerUrl()||Wa?G().length>0:!1}function i1(){let e=ie?.querySelector("#auth-status");if(!e)return;e.hidden=!1;let t=ie?.querySelector("#user-menu"),r=l.managedSession;if(r==null){e.dataset.authed="0",e.removeAttribute("popovertarget"),e.setAttribute("aria-label","Log in"),Q(d`Log in`,e),t&&Q(m,t);return}let n=(r.login[0]??"?").toUpperCase();e.dataset.authed="1",e.setAttribute("popovertarget","user-menu"),e.setAttribute("aria-label",`Account: ${r.login}`),Q(r1(n,r.id),e),t&&Q(d`<div class="user-card">${r1(n,r.id,!0)} <span class="user-id"><span class="user-login">${r.login}</span> ${r.name?d`<span class="user-name">${r.name}</span>`:m}</span></div>${r.role==="admin"||r.role==="manage"?d`<div class="user-menu-group" role="group" aria-label="Manage"><div class="user-menu-group-label">Manage</div>${r.role==="admin"?d`<button type="button" class="user-menu-row" data-action="admin-users">Users</button>`:m} <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>`:m} <button type="button" class="user-menu-row" data-action="managed-logout">Log out</button>`,t)}function r1(e,t,r=!1){let n=`/api/avatar/${encodeURIComponent(t)}`;return d`<span class="${r?"user-avatar user-avatar-lg":"user-avatar"}"><span class="user-avatar-fallback">${e}</span> <img alt="" src="${n}" @error="${w5}"></span>`}function w5(e){e.currentTarget.classList.add("broken")}function k5(){let e=ie?.querySelector(".brand-tag");e&&(e.textContent=l.serverMode)}function x5(){Oi&&(Oi.dataset.mode=l.serverMode),l.serverMode==="managed"&&Oi?.classList.remove("collapsed"),ok()}function Mn(e){let t=ie?.querySelector("#sync-status");if(!t)return;if(k5(),x5(),l.serverModeMismatch){let p=ie?.querySelector("#auth-status");p&&(p.hidden=!0),j.setForcedOff(!0),j.setProtocolLocked(!0),t.hidden=!1,t.dataset.status="paused",t.dataset.tooltip="This server speaks a different sync protocol than this app is set up for. Switching isn\u2019t supported yet.";let f=t.querySelector(".sync-label");f&&(f.textContent="Sync paused");return}if(l.serverMode==="managed"){t.hidden=!0,j.setForcedOff(!0),i1();return}if(l.serverMode==="standalone"){t.hidden=!0;let p=ie?.querySelector("#auth-status");p&&(p.hidden=!0);return}let r=ie?.querySelector("#auth-status");r&&(r.hidden=!0);let n=v5(),o=Er()!=null;if(n&&o&&j.isEnabled()&&Lc().catch(p=>{console.warn("sync: load failed",p)}),n&&o&&!j.getServerUrl()&&Wa&&j.isEnabled()&&j.setServerUrl(Wa),j.setForcedOff(!n),!n){t.hidden=!0;return}t.hidden=!1;let i=e??j.status;t.dataset.status=i;let s=j.persistenceDegraded;t.toggleAttribute("data-degraded",s);let a=j.proxyAuthRequired;t.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?t.dataset.tooltip=c:delete t.dataset.tooltip;let u=t.querySelector(".sync-label");u&&(u.textContent=y5[i]??"")}j.onStatusChange(Mn);var ig=!1,lg=!1;async function s1(){if(!j.persistenceDegraded||lg||ig)return;ig=!0;let{shown:e}=await J$();if(ig=!1,e){lg=!0;return}j.persistenceDegraded&&setTimeout(s1,1500)}j.onPersistenceDegraded(e=>{Mn(),e?s1():lg=!1});var sg=!1,cg=!1;async function a1(){if(!j.proxyAuthRequired||cg||sg)return;sg=!0;let{shown:e,reload:t}=await Z$();if(sg=!1,!e){j.proxyAuthRequired&&setTimeout(a1,1500);return}cg=!0,t&&location.reload()}j.onProxyAuthRequired(e=>{Mn(),e?a1():cg=!1});function $5(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=G().find(c=>c.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,a=async c=>{s||(s=!0,c&&await cf(n,i.value),te())};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 Pd(){for(let e of ie.querySelectorAll(".drag-over"))e.classList.remove("drag-over")}function l1(e){return e.dataTransfer.types.includes(ug)||e.dataTransfer.types.includes(Va)}function S5(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(Va,n),e.dataTransfer.setData(ag,t.dataset.workspaceId??""),e.dataTransfer.setData("text/plain",n),t.classList.add("dragging"),Nd=!0,te();return}let r=e.target.closest(".file-item[data-file]");r&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(ug,r.dataset.file),e.dataTransfer.setData(ag,r.dataset.workspaceId??""),e.dataTransfer.setData("text/plain",r.dataset.file),r.classList.add("dragging"),Dd=!0,te())}function _5(){for(let e of ie.querySelectorAll(".dragging"))e.classList.remove("dragging");Pd(),(Dd||Nd)&&(Dd=!1,Nd=!1,te())}function C5(e){if(!l1(e))return;e.preventDefault();let t=e.target.closest("[data-workspace-id]"),r=ie.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",Pd(),!i)if(t){let s=t.dataset.workspaceId;for(let a of ie.querySelectorAll(`[data-workspace-id="${CSS.escape(s)}"]`))a.classList.contains("dragging")||a.classList.add("drag-over")}else{let a=e.dataTransfer.types.includes(Va)?"[data-default-bundles]":"[data-default-reports]",c=ie.querySelector(a);c&&c.classList.add("drag-over")}}function E5(e){ie.contains(e.relatedTarget)||Pd()}async function A5(e){if(!l1(e))return;e.preventDefault(),e.stopPropagation(),Pd();let t=e.target.closest("[data-workspace-id]"),r=t?t.dataset.workspaceId:null,n=e.dataTransfer.getData(ag)||null;if(e.dataTransfer.types.includes(Va)){let s=e.dataTransfer.getData(Va);if(!s)return;if(n&&n!==r&&Xf(n,s)){let a=(l.bundles??[]).find(p=>p.integrity===s)?.name??s,c=G().find(p=>p.id===n),{confirmed:u}=await Y$({name:a,workspaceName:c?.name??""});if(!u)return;try{await Bc(n,s)}catch(p){console.warn(`Failed to remove '${a}' from source workspace ${n} remote:`,p)}}r&&await go(s,r),n&&n!==r&&await hf(s,n),te();return}let o=e.dataTransfer.getData(ug);if(!o)return;if(n&&n!==r&&di(n,o)){let s=G().find(c=>c.id===n),{confirmed:a}=await X$({name:o,workspaceName:s?.name??""});if(!a)return;try{await Mc(n,o)}catch(c){console.warn(`Failed to remove '${o}' from source workspace ${n} remote:`,c)}}r&&await Lr(o,r),n&&n!==r&&await Vs(o,n),l.currentWorkspace&&(l.currentWorkspace===r||l.currentWorkspace===n)?await jt(l.currentWorkspace):te()}function c1(e){let t=Er();if(np(t?t.mode:null,e.mode)==="mismatch"){l.serverModeMismatch=!0,j.setForcedOff(!0),j.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)`),Mn(j.status);return}l.serverModeMismatch=!1,j.setProtocolLocked(!1);let n=l.serverMode!==e.mode;l.serverMode=e.mode,l.managed=e.managed,rp(e),Mn(j.status),n&&te(),e.mode==="managed"&&d1()}async function d1(){try{l.managedSession=await Uw(),i1(),l.managedTeams=l.managedSession==null?[]:await Hw(),te()}catch(e){console.warn("managed: session probe failed:",e)}}var u1={"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-teams":"admin: teams bundle load failed:"};async function R5(e){try{await Kw()}catch(t){console.warn(u1[e],t);return}l.currentView=e,x(),te()}async function T5(){if(Er())return;let e=0,t=null;try{let r=await fetch(jl,{credentials:"same-origin",headers:{accept:"application/json"}});e=r.status,r.ok&&(t=Wl(await r.json()))}catch{}if(t){c1(t);return}e===404&&(l.serverMode="standalone",Cw(!0),Mn(j.status),te())}function I5(){let e=ie?.querySelector("#user-menu"),t=ie?.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 L5(e){Oi=e,ie=e.renderRoot,n1=ie.querySelector("#file-list"),ik(ie.querySelector("#encryption-toggle")),uk(ie.querySelector("#storage-status")),ie.addEventListener("click",m5),ie.addEventListener("dblclick",$5),ie.addEventListener("dragstart",S5),ie.addEventListener("dragend",_5),ie.addEventListener("dragover",C5),ie.addEventListener("dragleave",E5),ie.addEventListener("drop",A5),Nt(ie,g5),ie.querySelector("#sidebar-search-input")?.addEventListener("input",b5),I5(),Mn(j.status),te(),j.onServerInfo(c1),T5(),l.serverMode==="managed"&&d1()}var dg=class extends oe{static styles=[C(un),C(Gw)];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">dev</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></div><div id="user-menu" popover class="user-menu"></div>`}firstUpdated(){L5(this)}};customElements.define("app-sidebar",dg);async function p1(e,{openReport:t,openWorkspace:r}){let[n,o]=await Promise.all([gf(e.report),mf(e.workspace)]);async function i(u){let p=Co(u,o?.id);return(l.currentFile!==u||l.currentWorkspace||l.currentReportWorkspace!==p)&&await t(u,void 0,{workspaceId:p}),Li(e.id)}if(n){let u=await i(n);if(u)return u}if(o){l.currentWorkspace!==o.id&&await r(o.id);let u=Li(e.id);if(u)return u}let s=Li(e.id);if(s)return s;let a=l.reports.map(u=>u.fileName).filter(Boolean),c=await bf(e.id,{skip:a});return c?await i(c):null}var F5="100% 0px",f1=new WeakMap,Di=new WeakMap,pg=[],fg=!1,h1=new WeakMap;function M5(e){let t=h1.get(e);if(t===void 0){let r=getComputedStyle(e).overflowY;t=r==="auto"||r==="scroll"||r==="overlay",h1.set(e,t)}return t}function hg(e){let t=e.parentNode;for(;t;){if(t.nodeType===Node.DOCUMENT_FRAGMENT_NODE){t=t.host??null;continue}if(t.nodeType!==Node.ELEMENT_NODE||t===document.documentElement)return null;if(M5(t))return t;t=t.parentNode}return null}function B5(e){for(let t of e)Di.get(t.target)?.cb(t.isIntersecting)}function O5(e){let t=e??document,r=f1.get(t);return r||(r=new IntersectionObserver(B5,{root:e,rootMargin:F5,threshold:0}),f1.set(t,r)),r}function Ni(e,t){let r=Di.get(e);r?.io&&r.io.unobserve(e),Di.set(e,{cb:t,io:null}),pg.push(e),fg||(fg=!0,queueMicrotask(D5))}function D5(){fg=!1;let e=pg;pg=[];for(let t of e){let r=Di.get(t);!r||r.io||(r.io=O5(hg(t)),r.io.observe(t))}}function Hr(e){let t=Di.get(e);t&&(t.io?.unobserve(e),Di.delete(e))}var N5=1600,zd="link-target",P5="Couldn't find that finding in any of your reports. Import the report it came from, then open the link again.",Ud=null,z5=3,U5=150,H5=5;function j5(e){Ud!==null&&clearTimeout(Ud);for(let t of document.querySelectorAll(`.${zd}`))t.classList.remove(zd);e.classList.add(zd),Ud=setTimeout(()=>{e.classList.remove(zd),Ud=null},N5)}function W5(e){return new Promise(t=>{let r=null,n=0,o=0,i=()=>{let s=Math.round(e.getBoundingClientRect().top);n=s===r?n+1:0,r=s,n>=z5||++o>=U5?t():requestAnimationFrame(i)};requestAnimationFrame(i)})}function V5(e){let t=0,r=window.innerHeight,n=hg(e);if(n){let o=n.getBoundingClientRect();t=Math.max(t,o.top),r=Math.min(r,o.bottom)}return{top:t,bottom:r}}function K5(e){let t=e.getBoundingClientRect();if(t.height===0)return!1;let{top:r,bottom:n}=V5(e);if(n<=r)return!1;let o=(r+n)/2;return t.top>=r&&t.bottom<=n||t.top<=o&&t.bottom>=o}async function G5(e){e.scrollIntoView({block:"center",behavior:"smooth"});for(let t=0;t<H5;t++){if(await W5(e),!e.isConnected||K5(e))return;e.scrollIntoView({block:"center",behavior:"instant"})}}async function q5(e){let t=CSS.escape(e);if(l.viewMode==="table"){let r=R.querySelector("finding-table");if(r){try{await r.updateComplete}catch{}for(let n of r.shadowRoot?.querySelectorAll("finding-row")??[])if(n.group&&Z(n.group)===e)return n}}if(l.viewMode==="kanban"){let r=R.querySelector(`.kanban-card[data-gid="${t}"]`);if(r)return r}return R.querySelector(`finding-card[data-gid="${t}"]`)??R.querySelector(`[data-gid="${t}"]`)}async function m1(e,t){let r=gm(e.group,t),n=Rt(r);n&&id(n)&&queueMicrotask(be),x();let o=await q5(r);return o?(typeof o.ensureRendered=="function"&&await o.ensureRendered(),await G5(o),j5(o),{ok:!0}):{ok:!0}}async function g1(e){if(!e?.id)return{ok:!1,reason:"This link is missing a finding id."};let t=await p1(e,{openReport:dt,openWorkspace:jt});return t?await m1(t,e.id):{ok:!1,reason:P5}}async function mg(e,t){if(!e||!t)return{ok:!1,reason:"Missing finding id or report name."};(l.currentFile!==t||l.currentWorkspace)&&await dt(t);let r=Li(e);return r?await m1(r,e):{ok:!1,reason:`Couldn't find that finding in "${t}". It may have been re-imported since this links file was written.`}}var b1={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 y1(){Ow(async(e,t,r)=>{let n=vf(e);try{return await Ed(e,n,b1[r]??b1.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 gg=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 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="${!t}" @click="${this._onSubmit}">${this.retry?"Retry":"Authenticate"}</button></footer></dialog>`}};customElements.define("sync-auth-dialog",gg);function v1({retry:e=!1}={}){return ne("sync-auth-dialog",{retry:!!e})}function w1(){Bw(async({retry:e})=>{try{return await v1({retry:e})}catch(t){return console.warn("Sync auth dialog failed to open:",t),null}})}var Hd="https://triage.space/",Y5=[{hostname:"deepaudit.dev",pathPrefix:"/",supportsSync:!0},{hostname:"chalker.github.io",pathPrefix:"/deepview/",supportsSync:!1}];function X5(){for(let e of Y5)if(location.hostname===e.hostname&&location.pathname.startsWith(e.pathPrefix))return e;return null}var J5=["deepview.triage","deepview.triage.pending"],Z5="deepview.repoUrls";function Q5(){try{for(let e of J5)if(localStorage.getItem(e))return!0}catch{return!0}try{let e=localStorage.getItem(Z5);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 eF(){if(Q5())return!0;let e=[];try{e=await fe()}catch{return!0}if(e.length>0)return!0;try{if(G().length>0)return!0}catch{return!0}try{return await hs()}catch{return!0}}var bg=class extends oe{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=()=>d`<a class="om-link" href="${Hd}" target="_blank" rel="noopener noreferrer">${Hd}</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 ${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?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 ${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>`: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 ${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",bg);function tF(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 k1(){let e=X5();return e?await eF()?await tF(e)?(location.assign(Hd),!0):!1:(location.replace(Hd),!0):!1}var yg=class extends I{static styles=[...I.styles,C(Pt)];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 Vf({encoded:this.encoded,password:this._password});if(this._settled)return;let r=G().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=cr(this._name);if(!t)return;let r=G().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 G())if(r.id!==this._decoded.id&&cr(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 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 t=this._existingById;return d`<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=cr(this._name),r=this._nameCollision(t),n=!!t&&!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 "${t}" 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 t=this._stage==="password"?"Attach shared workspace":this._existingById?"Workspace already attached":"Name the workspace";return d`<dialog @close="${this._onClose}"><header><h3>${t}</h3></header>${this._stage==="password"?this._passwordStage():this._nameStage()}</dialog>`}};customElements.define("workspace-unlock-link-dialog",yg);function x1({encoded:e}={}){return pi("workspace-unlock-link-dialog",{encoded:e??""},t=>{t.encoded=""})}var ut=null,jd=!1,Ka=null;function rF(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 nF(){if(ut)return ut;ut=document.createElement("div"),ut.id="lock-overlay",ut.setAttribute("role","dialog"),ut.setAttribute("aria-modal","true"),ut.setAttribute("aria-label","Unlock DeepView"),ut.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";T();O();he();Pi();Cy=class extends F{static styles=[...F.styles,R(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 Ba({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 Ay,Ry=w(()=>{"use strict";T();gt();O();Er();Fo();he();Mr();Bn();Ay=class extends F{static styles=[...F.styles,R(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 xi(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 za(n.identifier,o.content),Mt(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}=Mp(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:Tp(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",Ay)});function D3(){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=D3(),o=++Dp;clearTimeout($c),$c=null,n.className=e,n.textContent=t,requestAnimationFrame(()=>{Dp===o&&n.classList.add("visible")});let i=()=>{Dp===o&&My()};return r>0&&($c=setTimeout(i,r)),i}function My(){Dp++,rn&&(clearTimeout($c),$c=null,rn.classList.remove("visible"))}var rn,$c,Dp,zp=w(()=>{"use strict";rn=null,$c=null,Dp=0});function Oo(t,e="overview"){let r=e&&e!=="overview"&&_c.has(e)?` ${e}`:"";Je(Bo,`b:${t}${r}`).catch(()=>{})}function Zs(){return on}function z3(){return new Promise(t=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(t):setTimeout(t,0)})}async function Iy(t){return await z3(),t!==null&&Se(t)?!1:(_(),!0)}function Hp(){A.selected=null,A.focusedPkg=null,A.layoutCache=null,A.solo=null,A.hidden.clear(),A.pathFilter="",it()}function Sc(t){for(let e of H.openSessions)e&&!t.has(e.workspaceId)&&(H.closeSession(e.workspaceId),Kg(e.workspaceId))}function Up(){M.classList.remove("active"),M.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 Ty({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=>Ms(a.id,t)),s=await TC({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 H3(t,i),{name:t,content:e}}async function U3(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 H3(t,e){let r;try{r=await ti(t)}catch(n){console.warn(`Import: failed to read freshly-saved "${t}" for cloud sync:`,n);return}for(let n of e)try{await Ol(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 fe()),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 Ty({name:f.name,content:f.content,existingNames:o});g&&(Mt(g.name,h.count,h.source),await U3(g.name,f.repo),e={name:g.name,content:g.content})}try{let f=await fe();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 ni(s.name,p);r=f,n.add(f);continue}let u=await s.text();if(au(u,a)==="codex"){let p=il(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 Ty({name:g,content:y,existingNames:o});x&&(Mt(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 Ty({name:s.name,content:u,existingNames:o});if(!f)continue;Mt(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)lc(s).catch(()=>{});e?await Bt(e.name,e.content):r&&(Ao(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=Fi(t,r);let o=new Set(re().filter(s=>Array.isArray(s.reports)&&s.reports.includes(t)).map(s=>s.id));if(Sc(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)&&Ms(c.id,t));if(a)try{if(await Ol(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),Ol(s);return await ee(),!0}}async function Qs(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=>T1(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;Sc(new Set);let i=document.createElement("p");i.setAttribute("role","status"),i.textContent="Loading report triage\u2026",M.replaceChildren(i),M.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 ea(),On("Could not load report triage. Open the team or report again to retry."),!1}}if(r.length===0)Up();else if(Os(Tn()),!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;Sc(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&&(Os(Tn()),!await Iy(r)))&&(H.openSession(t),H.refreshSession(t),Ol(t),await ee())}async function qC({triage:t="keep",deleteFromRemoteWorkspaceIds:e=[]}={}){if(!l.currentFile)return;let r=++on,n=l.currentFile;$s(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 as(n),!Se(r)&&(await xl(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,Sc(new Set),jp(t)}async function ea(){++on,Sc(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),Am(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 as(a)}catch{}$s(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 Si(),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=mi(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??[]};hi(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)&&lc(x).catch(()=>{})}c&&(Bs(),Os(Tn())),n&&await Iy(r)}catch(s){alert(`Failed to parse ${t}: ${s.message}`)}}function j3(){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,_c,on,Se,nn,Fo=w(()=>{"use strict";O();Er();IC();Nt();ot();ue();Xr();Bi();LC();_u();St();Pn();Eo();Fn();Oe();jC();Sy();Ey();Ry();Nu();zp();Bo="deepview.lastFile",_c=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&&Qs(o);return}let n=t.target.closest("[data-landing-workspace]");if(n){gr(n.dataset.landingWorkspace);return}t.target.closest(".drop-prompt-action")&&j3()})});function QC(){try{return localStorage.getItem(ZC)==="1"}catch{return!1}}function e2(){try{localStorage.setItem(ZC,"1")}catch{}}function V3(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:V3(e)}function W3(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=oc(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(W3(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 K3[t]??999}function G3(t){return t.charAt(0).toUpperCase()+t.slice(1)}function q3(){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 q3();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])=>Y3(s,a,e.query.get(s)))}</ul></div>`}function Y3(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=>Q3(i))}</ul></li>`}function X3(t){if(typeof t!="string")return null;let e=/\/(GHSA-[a-z0-9-]+)(?:[/?#]|$)/iu.exec(t);return e?e[1]:null}function Z3(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 Q3(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=X3(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}${J3}</a>`:m;return d`<li class="bundle-advisory-row"><div class="bundle-advisory-rail"><span class="${`bundle-advisory-severity sev-${e}`}">${G3(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?"":", "}${Z3(p)}`)}</span>`:m}</div>${o?d`<div class="bundle-advisory-cvss-vector mono">${o}</div>`:m}</div></div></li>`}var Nn,ZC,K3,J3,Dy=w(()=>{"use strict";T();Fo();tn();Nn=new Map,ZC="deepview.advisories.proxyConsent";K3={critical:0,high:1,moderate:2,low:3,info:4};J3=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 eB(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 ll(i)){let a=l.triage.get(j(s))?.triage;a&&r[a]!==void 0&&r[a]++}}return r}function ta(t,e="graph"){if(!t||t.size===0)return new Map;let r=new Map;for(let[n,o]of t){let i=ll(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=eB(t),r=Xs(t,e.origToStripped.keys());A.bundleReasonFor!==t.integrity&&(A.bundleReasonFor=t.integrity,A.dependencyPackagesView=!1,A.bundleReason=null);let{tree:n,origToStripped:o,selected:i}=EC(e.tree,e.origToStripped,r,A.bundleReason);A.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,me]of t.fileHashes){let Ce=o.get(W);Ce!==void 0&&a.set(Ce,me)}}let c=ta(a),u=new Map,p=new Map,f=new Map,h=new Map;for(let[W,me]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 me){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=A.bundleLayout==="matrix"||u.size===0?null:Cp(n,u),y=new Map;for(let[W,me]of o)y.set(me,W);let b=en(t),v=b?new Map([...o].map(([W,me])=>[me,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=A.splitOwnDirs&&$,U=W=>by(W,y.get(W)??W,{splitOwnDirs:C,packageDir:x?.(W)}),E=AC(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(A.focusedPkg){let W=s.filter(me=>U(me)===A.focusedPkg);W.length>0?K=W:A.focusedPkg=null}return A.selected&&!Object.hasOwn(n,A.selected)&&(A.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(!Ec)return;let t=qs();t&&t.refreshSidebar(Ec,{isBundleContext:!0})}function Yp(){if(!Ec)return;let t=qs();t&&t.refreshTopPkgs(Ec)}function u2(t){Ec=t}function tB(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="${we({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=Mo(o),c=Lt(o);return d`<li><span class="bundles-dist-dot" style="${we({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="${we({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=tB(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=ta(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 cl(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=ye[Ke(E)]??ye.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">${xe(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 Ac(){queueMicrotask(()=>{document.querySelector(".bundle-code-rail-body .bundle-code-tree-link.current")?.scrollIntoView({block:"nearest"})})}function Ni(t){for(let e of Ee)for(let r of t)if(r.severity===e)return e;return t[0]?.severity??null}function nB(t,e,r,n,o=null){let i=t.split(`
|
|
119
|
+
`).length,s=String(i).length,a=ec(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="${we({"--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?Ni(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 oB(t){let e=l.bundleSourceFindingIdx;if(e==null)return m;let r=t[e];if(!r)return m;let n=r.fileHash?cl(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(fs(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">${xe(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=ta(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"?nB(e,t,r,o,i):d`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${oB(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 iB(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 sB(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=Ni(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=sB(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?Ni(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 Rc(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=iB(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 aB(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)Rc(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=>Rc(p,o)):s,u=h2(c,s);return Vy(u,e,0,n,"",!0)}function lB(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=Rc(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 cB(t,e,r,n=""){if(!t.fileHashes)return d`<div class="bundle-code-search-empty">Computing file hashes…</div>`;let o=ta(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=Rc(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(fs(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[Ni(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 dB(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?ta(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},Ac());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,Ac())}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",()=>aB(i,a,y,s,n)],["code",()=>lB(e,y,a,n)],["issues",()=>cB(t,y,a,n)]])}</div></aside><div class="${I({"bundle-code-main":!0,"with-panel":l.bundleSourceFindingIdx!=null})}">${a?uB(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 uB(t,e,r,n,o){let i=typeof r=="string"?r.split(`
|
|
121
|
+
`).length:0,s=typeof r=="string"?qo(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">${rB}</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-${Ni(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 fB(t){return t<=5?8:t<=15?6:t<=40?4:t<=120?3:2}function hB(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 mB(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 gB(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 bB(t,e,r){let n=mB(t,r??[],pB);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}${gB(n.text,n.ranges)}</span></div>`}function yB(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(bB(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="${we({"--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 vB(t,e,r){let{path:n,lines:o,hits:i}=t,s=Rc(n,e),a=hB(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)=>yB(n,o,f,c,h>0))}</div></section>`}function wB(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?fB(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=>vB(y,f,h))}</div>`}function kB(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 xB(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 $B(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=kB(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">${wB(t,e,r,n,o,s)} ${xB(t,e,i)}</div></div>`}function _B(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&&Ws(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?PB(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",()=>dB(i)],["search",()=>$B(i)],["compare",()=>d`<bundle-compare .details="${i}" .integrity="${t.integrity}"></bundle-compare>`],["issues",()=>CB(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 SB(t,e={}){if(!t)return m;let r=[];if(t.fileHash&&(r=cl(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">${xe(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 Cc(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 CB(t){if(!t.fileHashes)return Cc("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 Cc("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=ta(t.fileHashes,"issues");if(e.size===0){let r=wm();if(r===0)return Cc("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+=ll(o).length;return n>0?Cc("All matching issues are dismissed.",`${n} ${n===1?"finding matches":"findings match"} this bundle's files, but every one is triaged invalid or deleted.`):Cc("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 Mc(e,{kind:"bundle"})}function Mc(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[Ni(p)]??0,y=Ne[Ni(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> ${SB(y,{kind:e,bucketKey:r})}</div><div class="bundle-issues-finding-desc">${hr(fs(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?_B(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 TB(t){let e=typeof t=="string"?t.slice(t.lastIndexOf("/")+1):"",r=e.lastIndexOf("."),n=r>0?e.slice(r+1).trim().toLowerCase():"",o=ec(t)??MB[n];return o?{key:o,label:RB[o]??o}:n?{key:`extension:${n}`,label:`.${n}`}:{key:"other",label:"Other"}}function IB(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 LB(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 FB(t){delete t.currentTarget.dataset.tooltip,Is()}function BB(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,sc(s)])),r=new Map,n=0;for(let[i,s]of e){if(s<=0)continue;let a=TB(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="${LB}" @pointerleave="${FB}">${o.map(([i,{label:s,lines:a}])=>{let c=a/n*100;return d`<span class="bundles-languages-segment" style="${we({flexGrow:a,background:IB(i)})}" data-language-tooltip="${`${s} \xB7 ${c<1?c.toFixed(1):c.toFixed(0)}% \xB7 ${a} ${a===1?"line":"lines"}`}"></span>`})}</div>`}function OB(t,e){let r=vC(e),n=BB(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}">${EB}<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)">${AB}<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 PB(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=OB(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"?qo(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=Vs(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 Ec,zy,Uy,Hy,rB,Dn,Gp,i2,pB,EB,AB,RB,a2,l2,MB,Tc=w(()=>{"use strict";T();gC();Te();vt();fn();bt();Ar();Wt();O();ue();gt();tn();ac();my();SC();Ys();Ap();ot();tc();yc();Oi();Eo();uy();go();Dy();gc();St();Ec=null,zy=new WeakMap;Uy=new Map,Hy=new Set,rB=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;pB=400;EB=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>`,AB=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>`,RB=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"]),MB=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 VB(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();HB(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>${zB(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(NB(c),DB,h=>WB(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">${qB(o[0],s,i?i[0]:void 0)}</div></aside>`:m}</div>`}</div>`}function NB(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 DB(t){return t.version===null?`${t.kind}:${t.pkg}`:`${t.kind}:${t.pkg}@${t.version}`}function zB(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="${UB}"></triage-selector></div>`}function HB(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 jB(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 VB(t,e,r){let n=jr().get(t),o=jB(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>`:Mc(s,{kind:"package",bucketKey:t})}</div></div>`}function WB(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&&KB(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="${we({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"?GB(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 KB(t,e){return t.kind==="single"?!0:t.version===e}function GB(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 qB(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>${YB(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 YB(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=ye[Ke(f)]??ye.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">${xe(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 UB,w2=w(()=>{"use strict";T();Te();vt();fn();bt();O();ot();ue();Ar();Oi();Tc();UB=["inprogress","fixed","invalid","deleted"]});function k2(){lr().catch(()=>{});let t=yi(),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 e4(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();ZB(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>${XB(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])=>t4(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">${r4(o[0],o[1])}</div></aside>`:m}</div>`}</div>`}function XB(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="${JB}"></triage-selector></div>`}function ZB(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 QB(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 e4(t,e){let r=yi().get(t),n=QB(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>`:Mc(i,{kind:"repository",bucketKey:t})}</div></div>`}function t4(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="${we({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 r4(t,e){let r=yi().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>${n4(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 n4(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=ye[Ke(a)]??ye.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">${xe(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 JB,$2=w(()=>{"use strict";T();Te();vt();fn();bt();O();ot();ue();Ar();Oi();Tc();JB=["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 Di(t,e,r){return`${t} ${t===1?e:r}`}function o4(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})=>xe(a)).join(", "):m}">${s}</span>`}function Gy({id:t,title:e},r=[],n=!0,o=m){let i=r[0]?.name,s=Gl(t),a=Mi(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="${`#${ki({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} ${o4(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="${xe(e)}" data-links-report="${e}" data-links-finding="${r}">${Z(We[Ke(e)]??We.default)}<span class="links-finding-report-label report-button-label">${xe(e)}</span></button>`)}</div>`}function i4(t,e){let r=t.reports.toSorted((n,o)=>xe(n.name).localeCompare(xe(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">${Di(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 s4(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">${Di(t.length,"finding","findings")}</span></div><ul class="links-group-rows">${te(r,i=>i.key,i=>i4(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=vi(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(ye[Ke(r)]??ye.default)}${xe(r)}</span> <span>${Di(n.length,"link","links")}</span> <span>${Di(i.size,"finding","findings")}</span> ${s.size>0?d`<span>found in ${Di(s.size,"report","reports")}</span>`:m}</div></div></header>${a<i.size?d`<p class="links-note">${Di(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">${Di(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)=>s4(c,u))}</ol>`}</div>`}var A2=w(()=>{"use strict";T();vt();bt();O();Ar();ue();S2();Oe()});function a4(t,e,r){let n=new Set(e);for(let o of r)n.add(o);return t.filter(o=>n.has(o))}function R2(){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?a4(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 M2=w(()=>{"use strict";O()});function T2({workspaceId:t,items:e}={}){return le("sync-upload-dialog",{workspaceId:t??"",items:Array.isArray(e)?[...e]:[]})}var qy,I2=w(()=>{"use strict";T();O();Er();he();Mr();Bn();qy=class extends F{static styles=[...F.styles,R(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 ti(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}=Mp(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:Tp(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 c4,Yy,O2=w(()=>{"use strict";T();Er();he();Ry();Mr();L2();c4={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,R(qe),R(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}">${c4[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=ve(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 A.focusedPkg?(u=e.filter(p=>(hC(p)??"__own__")===A.focusedPkg),A.showAll||(u=u.filter(p=>cy(p,o,i)))):u=A.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=qs();if(!t)return;let e=Zy();e&&t.refreshSidebar(e,{isBundleContext:l.currentView==="bundles"})}function ev(){let t=qs();if(!t)return;let e=Zy();e&&t.refreshTopPkgs(e)}function d4(t){return`${ct[t]??t} findings`}function u4(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 p4(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?d4(a):"Findings",f=a&&ye[a]?a:"default",h=Z(ye[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=>Ai[ce]??ce):[],E=[...C,...U],B=m;if(i>0){let ce={};for(let Xe of t){let ht=ae(Rn(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="${we({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=u4(r,n,K),me=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`${me}${E.map(ce=>d`<span class="tag">${ce}</span>`)}`:m}</div></div></header>`}function j2(){if(H.status!=="online")return m;if(!f4.has(l.currentView))return m;let t=R2();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 h4({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 h4({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 T2({workspaceId:t,items:e})}function m4(t){return Object.values(t).some(r=>r>0)||l.filterSeverities.size>0?d`<severity-chips .counts="${t}"></severity-chips>`:m}function g4(t){return Object.values(t).some(r=>r>0)||l.filterColors.size>0?d`<triage-filter .counts="${t}"></triage-filter>`:m}function b4(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:me}=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} ${!me&&(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} ${m4(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} ${g4(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:Rn(r),g:r})).toSorted((r,n)=>e(r.p,n.p)).map(r=>r.g)}function Ic(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?Ul(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=y4[y]??"?",v=Ut(s)&&l.severityMode!=="original",x=ve(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: ${$}`}">${mc}</a>`:d`<button type="button" class="kanban-action mark-fix" data-tooltip="${`Edit fix link: ${$}`}" aria-label="${`Edit fix link: ${$}`}">${mc}</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="${Ai[p]}" aria-label="${Ai[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 v4(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="${we({"--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=uc(t),i=n?"focus-main with-code":"focus-main",s=we({"--focus-split":String(l.focusSplit)});return d`<div class="${i}" style="${s}"><div class="focus-pane focus-pane-card"><div class="focus-card-wrapper">${Ic(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">${v4(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):Ic(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 w4(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">${Ic(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="${we(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=Rn(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=Rn(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=>Ic(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=A_(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>${Ic(r,!0,null,!0)}</div>`})}`}function k4(){l.bundleSourceFile&&Li().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 na(t){let e=document.querySelector(`#${t}`);return(!e||!M.contains(e)||M.firstElementChild!==e)&&(M.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(),k4(),Yu(l.reports),Xu(l.reports)&&$o();let t=Oy(),e=l.reports.some(L=>(L.groups??[]).some(z=>z.some(ge=>ge.isUpstream)));if(l.currentView==="bundles")if((l.bundles??[]).length===0)l.currentView="findings";else{Ws(l.bundleDetailsTab,l.bundleSourceFile)&&Li().catch(()=>{});let L=na("bundles-slot");L&&ie(g2(l.bundles),L);let z=l.bundleDetails,ge=l.selectedBundle&&z&&(z.json||z.bundle);if(ge&&l.bundleDetailsTab==="graph"){let Me=document.querySelector("#bundle-graph-slot");if(Me){let At=d2(l.bundleDetails);if(At){u2(At);let O5={hideAllFiles:!0,triageCounts:c2(l.bundleDetails,new Set(At.strippedToOrig.values())),triageStates:["inprogress","fixed","invalid","deleted"],showSplitOwnDirs:At.canSplitOwnDirs,showPackagesView:At.canPackagesView,showBundleLayouts:!0};dy(Me,At,O5,qp,Yp)}}}if(ge&&!z.metadataOnly&&l.bundleDetailsTab==="terminal"){let Me=document.querySelector("#bundle-terminal-slot");Me&&pC(Me,l.bundleDetails)}M.classList.add("active"),Ue.classList.add("hidden"),document.title="DeepView \u2014 bundles";return}if(l.currentView==="packages"){let L=na("packages-slot");L&&ie(b2(),L),M.classList.add("active"),Ue.classList.add("hidden"),document.title="DeepView \u2014 packages";return}if(l.currentView==="repositories"){let L=na("repositories-slot");L&&ie(k2(),L),M.classList.add("active"),Ue.classList.add("hidden"),document.title="DeepView \u2014 repositories";return}if(l.currentView==="links"){if(l.currentLinks){let L=na("links-slot"),z=Gt();L&&ie(d`${E2(j2())}${z?Y2(z.group,null,[],z):m}`,L),M.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=na("scan-slot");L&&!L.firstElementChild&&L.append(document.createElement("local-scan-page")),M.classList.add("active"),Ue.classList.add("hidden"),document.title="DeepView \u2014 scans";return}let r=x4[l.currentView];if(r){let L=na(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(()=>{})}M.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 ge=ve(z);ge&&(ge.comment&&(a=!0),ge.fix&&(c=!0),ge.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 ge=Yr(z);ge&&b.add(ge)}for(let L of Ab()){let z=!1,ge=!1;for(let Me of L){let At=Fe(Me);At==="partial"&&(x=!0),!((At==="unreachable"||At==="refuted")&&(k=!0,l.currentWorkspace))&&(At==="revalidation"?z=!0:ge=!0)}z&&ge&&(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))),me=!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){me=!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(Yl(z));let Of=Object.keys(Mb),fa=L=>{if(L==null)return 1/0;let z=Of.indexOf(L);return z===-1?Of.length:z},qc=[...ht].toSorted((L,z)=>{let ge=fa(L),Me=fa(z);return ge!==Me?ge-Me:String(L??"").localeCompare(String(z??""))}),ha=[...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 qi=p_(b);l.filterRevalidate&&!qi.some(L=>L.value===l.filterRevalidate)&&(l.filterRevalidate="");let ma=rp(s);ma&&(l.filterRevalidate="confirmed");let Pf=b.has("partial")&&Mn();Pf||(l.filterPartial="");let Yc=t&&(v||x||!l.currentWorkspace&&k),ga=!(t&&l.showRevalidation!==!1)&&!l.upstreamOnly&&K&&W;!ga&&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"),!me&&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 Me=ae(L[0],l.severityMode);P[Me]=(P[Me]||0)+1;let At=ve(L[0])?.color??"none";q[At]=(q[At]||0)+1;continue}let z=new Set(L.map(Me=>ae(Me,l.severityMode)));for(let Me of z)P[Me]=(P[Me]||0)+1;let ge=new Set(L.map(Me=>ve(Me)?.color??"none"));for(let Me of ge)q[Me]=(q[Me]||0)+1}let X=F_(S),Re=[...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),ba=Pt?Object.keys(Pt).length:0,Yi=ba>1;!Yi&&l.currentView==="files"&&(l.currentView="findings"),!Yi&&l.viewMode==="graph"&&(l.viewMode="kanban");let Vn=p4(n,U,ce,Xe,ba);if(l.currentView==="files"){let L=ay(n,l.severityMode),z=document.querySelector("#header-slot"),ge=document.querySelector("#tree-view-slot");(!z||!ge||!M.contains(z)||!M.contains(ge))&&(M.innerHTML='<div id="header-slot"></div><div id="tree-view-slot"></div>',z=document.querySelector("#header-slot"),ge=document.querySelector("#tree-view-slot")),z&&ie(Vn,z),ge&&ie(lC(Pt,L),ge),M.classList.add("active"),Ue.classList.add("hidden"),document.title=`DeepView \u2014 ${C||"no analyzer"}`;return}let I5=l.viewMode==="table"&&l.tableSelectedGid&&Ze.some(L=>se(L)===l.tableSelectedGid),ya=null;l.viewMode==="graph"&&Pt&&(ya=Zy(),ya||(l.viewMode="kanban"));let Jc=!!ya,Ho="findings-content";I5&&(Ho+=" with-details"),Jc&&(Ho+=" with-graph"),o&&(Ho+=" with-kanban"),l.viewMode==="focus"&&(Ho+=" with-focus");let Tk=m,Zc=m,Ik=m;Jp=null,Jc||(Tk=b4(Ze.length,s.length,i,P,q,{showSource:ga,showConfidence:B,showPriority:N,showGraphMode:Yi,showFileSort:me,kanbanMode:o,showRepo:!!l.currentWorkspace,hasComment:a,revalidateOptions:qi,showPartial:Pf,canDropLayer:t,canDetailLayer:Yc,canUpstreamLens:e,confirmedLocked:ma,hasFix:c,hasFlagged:u,hasDuplicates:h,hasCrossContext:g,hasAppStacked:y,showSeverityMode:p||l.severityMode==="original"},{analyzers:qc,models:ha,groups:S},Re),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=w4(Ze));let va=document.querySelector("#header-slot"),Ir=M.querySelector(":scope > .findings-content"),L5=Ir&&Ir.querySelector(":scope > #findings-graph-slot"),F5=Ir&&Ir.querySelector(":scope > #findings-body-slot"),B5=Ir&&(L5?"graph":F5?"body":null)===(Jc?"graph":"body");if(!va||!Ir||!M.contains(va)||!M.contains(Ir)||!B5){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>';M.innerHTML=`<div id="header-slot"></div><div class="${Ho}">${L}</div>`,va=document.querySelector("#header-slot"),Ir=M.querySelector(":scope > .findings-content")}else Ir.className!==Ho&&(Ir.className=Ho);va&&ie(Vn,va);let Lk=document.querySelector("#toolbar-slot");Lk&&ie(Tk,Lk);let Fk=document.querySelector("#empty-state-slot");Fk&&ie(Zc,Fk);let Bk=document.querySelector("#findings-body-slot");if(Bk&&ie(Ik,Bk),ya){let L=document.querySelector("#findings-graph-slot");if(L){let ge={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,ya,ge,Qy,ev)}}if(Jp){let L=M.querySelector(".finding-table-slot");L&&(ra||(ra=document.createElement("finding-table")),ra.items=Jp,ra.selectedGid=l.tableSelectedGid,ra.parentNode!==L&&L.append(ra))}M.classList.add("active"),Ue.classList.add("hidden"),document.title=`DeepView \u2014 ${C||"no analyzer"}`}var f4,N2,Jp,D2,ra,K2,G2,tv,rv,y4,z2,x4,U2,Xp,St=w(()=>{"use strict";T();Te();vt();fn();bt();Ar();O();Er();go();Nt();ue();ot();Xr();Tb();ab();Oe();bS();gc();yc();dC();Eo();uy();fC();Fn();ac();Oi();w2();$2();A2();ip();M2();Tc();kp();I2();O2();f4=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,ra=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>`,y4={critical:"C",high:"H",medium:"M",low:"L",high_bug:"H",bug:"B",informational:"i"};z2=null;x4={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={};N5(JC,{hydrateManagedReportTriage:()=>O4,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 R4(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 T4(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 I4(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 L4(t){return t>=400&&t<500&&t!==401&&t!==403&&t!==408&&t!==429}function F4(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 B4(t){if(!sv())return;let e=[...t.changes.keys()],r=0;for(;r<e.length;){let n=r,o={},i=0,s=A4;for(;r<e.length&&i<200;){let u=e[r],p=M4(`${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&&!L4(a)){F4(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))oa.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(()=>B4(e)).catch(r=>{console.warn("managed: triage push failed",r)})}function tE(){if(!(iv().length===0||!sv()||Lc.size===0)){for(let e of Q2()){let r=Z2(l.triage.get(e)),n=ov(r);if((oa.get(e)??"")===n)continue;if(!R4(e,r)){console.warn("managed: triage entry exceeds the server caps, kept local only",e),oa.set(e,n);continue}let o=I4(e);if(o==null||!Lc.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,E4))}}function av(){J2||!sv()||(J2=!0,pg(tE))}function lv(){zn!=null&&(clearTimeout(zn),zn=null),Po.clear(),Lc.clear(),oa.clear()}async function O4(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()||(Lc.delete(t),eE(),await nv,!n()))return!1;let o=await I1(t);if(o==null||!n())return!1;let i=!1,s=T4(t);for(let a of s){if(!Object.hasOwn(o,a)){oa.delete(a);continue}let c=Z2(o[a]);oa.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(Lc.add(t),i){if(await ke(),!n())return!1;e&&_()}return tE(),!0}var E4,A4,M4,oa,Lc,Po,zn,nv,J2,Py=w(()=>{"use strict";O();qg();P1();Nu();St();E4=500,A4=14;M4=t=>new TextEncoder().encode(t).length,oa=new Map,Lc=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,Fc=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(D4,lt))}async function z4(){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 Mh({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 z4()}finally{e=!1}}}),tt(cv),cv()}var oE,D4,lt,dv=w(()=>{"use strict";T();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>`,D4=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";T();he();O();aE();uv=class extends F{static styles=[...F.styles,R(lE)];static properties={_retryDenied:{state:!0}};constructor(){super(),this._retryDenied=!1}_onConfirm=()=>this._finish(null);_onRetry=async()=>{if(await As()){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 fe()).length>0||await Ua()}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 As();hE(t,!1),await Qp()}async function H4(){if(sn&&sn.persisted===!1){Zp=!0;let t=await As();hE(t,!0),t||await cE()}await Qp()}function mE(t){an=t,an&&(an.addEventListener("click",()=>{H4()}),ei((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";T();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";T();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=W4.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 zi(t){return j4.get(t)??wE(t.includes("/")?t.slice(t.indexOf("/")+1):t)}function Bc(t){let e=t.includes("/")?t.split("/")[0]:"other";return{key:e,name:V4.get(e)??(e==="other"?"Other":wE(e))}}function Ui(t){return t==="xhigh"?"Extra high":t?t[0].toUpperCase()+t.slice(1):"Unavailable"}function ia(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 j4,V4,W4,Do=w(()=>{"use strict";j4=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"]]),V4=new Map([["openai","OpenAI"],["anthropic","Anthropic"],["moonshotai","Moonshot AI"],["google","Google"],["nvidia","NVIDIA"],["qwen","Qwen"],["deepseek","DeepSeek"],["x-ai","xAI"],["z-ai","Z.ai"]]),W4=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";Do();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 pe,AE=w(()=>{Lr();Ji();Yf();pe=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(()=>{AE()});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=>Bc(r.id).key)].map(([r,n])=>({key:r,models:n}))}function RE(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 ME=w(()=>{"use strict";Do()});function TE(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 K4,kv,xv=w(()=>{"use strict";T();Do();ME();K4=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}summary:hover,details[open] summary{border-color:var(--muted);background:var(--surface-active)}summary::-webkit-details-marker{display:none}summary,.menu{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:translate(.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 #0000008c}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:transparent}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:translate(-50%);padding:.35rem 0 0;border:0;background:transparent;color:var(--muted);font:inherit;font-size:.62rem;white-space:nowrap;cursor:default}.step:before{content:"";position:absolute;top:0;left:50%;transform:translate(-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}@container scan-controls (max-width: 50rem){.layout.with-extra{grid-template-columns:minmax(13rem,1fr) minmax(14rem,1fr)}.layout.with-extra .extra{grid-column:1 / -1;align-self:start;min-height:0}}@container scan-controls (max-width: 30rem){.layout,.layout.with-extra{grid-template-columns:minmax(0,1fr);gap:1rem}.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(ia(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:ia(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=Bc(e.id),o=RE(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}`}">${TE(n.key)}</span><span class="selected-copy"><strong id="selected-model">${zi(r.id)}</strong><small>${n.name}</small></span>${r.pro?d`<span class="pro-space" aria-hidden="true"></span>`:m}${K4}</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}`}">${TE(e)}</span>${Bc(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>${zi(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">${Ui(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="${Ui(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 ${Ui(o)}`}" aria-pressed="${o===this.effort}" @click="${()=>this._setEffort(o)}">${Ui(o)}</button>`)}</div></div></div>`}};customElements.get("scan-model-picker")||customElements.define("scan-model-picker",kv)});var Un,rf=w(()=>{"use strict";T();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:transparent;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}.detail,.count{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 #0006;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:transparent;font-size:.78rem;outline:none}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:transparent;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:transparent;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="${pe(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 G4(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}:G4(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 Hi(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 q4(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,Av=w(()=>{"use strict";T();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=q4(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 Rv,BE=w(()=>{"use strict";rf();Rv=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",Rv)});var Nc,Mv,OE=w(()=>{"use strict";T();bt();Uu();Do();Av();nf();BE();Nc=t=>({kind:t,sourceId:null,ids:new Set}),Mv=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?zi(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(zl[e.analyzer]??zl.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 strong,.copy span{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",Mv)});var Y4,X4,Tv,Iv=w(()=>{"use strict";T();Y4=d`<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6 4h7M6 8h7M6 12h7M3 4h.01M3 8h.01M3 12h.01"/></svg>`,X4=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>`,Tv=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",Y4],[!0,"Isolate",X4]].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 #0000001f,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:translate(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-options:before,.depth-choice span{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",Tv)});function PE(t){let e=t[0];return e?.model&&t.every(r=>r.model===e.model&&r.effort===e.effort)?{model:e.model,effort:e.effort}:null}function NE(t,e){let r=e.models.find(n=>n.id===t?.model)??e.models.find(n=>n.id===e.defaultModel)??e.models[0];return r?{model:r.id,effort:r.efforts.includes(t?.effort)?t.effort:ia(r)}:null}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:ia(o),isolate:!!n.isolate}}):[]}function Bv(t){let e=new Set;return t.map(r=>{let n=J4(r),o=e.has(n);return e.add(n),o})}var Lv,J4,DE=w(()=>{"use strict";Do();Lv=["security","generic","correctness"],J4=t=>JSON.stringify([t.mode,t.model,t.effort,t.isolate])});var Ov,zE=w(()=>{"use strict";T();Jt();vt();xv();Iv();Do();DE();Ov=class extends J{static properties={value:{attribute:!1},loadModels:{attribute:!1},appModel:{attribute:!1},appModelAutomatic:{attribute:!1},_rows:{state:!0},_loading:{state:!0},_error:{state:!0},_resolvedAppModel:{state:!0},_appModelOpen:{state:!0}};constructor(){super(),this.value=[],this.appModel=null,this.appModelAutomatic=!0,this._resolvedAppModel=null,this._appModelOpen=!1,this._appModelsAgree=!0,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()):(e.has("appModel")||e.has("appModelAutomatic"))&&!this._loading&&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);this._loading||this._syncAppModel();let r=!this._loading&&!this._error&&this._resolvedAppModel!=null&&e.length>0&&!Bv(e).includes(!0);this._lastEmitted=e,this.dispatchEvent(new CustomEvent("regimes-change",{detail:{value:e,ready:r,appModel:this._resolvedAppModel??this.appModel,appModelAutomatic:this.appModelAutomatic},bubbles:!0,composed:!0}))}_syncAppModel(){let e=PE(this._rows),r=NE((this.appModelAutomatic?e:null)??this.appModel??this._rows[0],this._catalogue);(this.appModel?.model!==r?.model||this.appModel?.effort!==r?.effort)&&(this.appModel=r),this._resolvedAppModel=this.appModel;let n=!!e&&e.model===r?.model&&e.effort===r?.effort;n!==this._appModelsAgree&&(this._appModelOpen=!n),this._appModelsAgree=n}_changeAppModel(e){e.model===this._resolvedAppModel?.model&&e.effort===this._resolvedAppModel?.effort||(this.appModelAutomatic=!1,this.appModel={model:e.model,effort:e.effort},this._notify())}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>${this._appModelRow()}`}</section>`}_appModelRow(){let e=this._resolvedAppModel;return e?d`<details class="app-model" .open="${pe(this._appModelOpen)}" @toggle="${r=>{this._appModelOpen=r.currentTarget.open}}"><summary><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m6 3 5 5-5 5"/></svg><span class="app-model-name">App model: <strong>${zi(e.model)}</strong></span><span class="app-model-effort">Effort: <strong>${Ui(e.effort)}</strong></span></summary><div class="app-model-controls"><scan-model-picker .loadModels="${this._sharedModels}" .value="${pe(e.model)}" .effort="${pe(e.effort)}" @model-change="${r=>{r.stopPropagation(),this._changeAppModel(r.detail)}}"></scan-model-picker></div></details>`:m}_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="${pe(e.model)}" .effort="${pe(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:transparent;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}.app-model{margin-top:.7rem;border-top:1px solid var(--border)}.app-model>summary{display:flex;flex-wrap:wrap;align-items:center;gap:.35rem .8rem;padding:.65rem 0 .1rem;color:var(--muted);font-size:.74rem;list-style:none;cursor:default;user-select:none}.app-model>summary::-webkit-details-marker{display:none}.app-model>summary:hover{color:var(--text)}.app-model>summary:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:3px}.app-model>summary svg{width:.8rem;height:.8rem;flex:0 0 .8rem}.app-model[open]>summary svg{transform:rotate(90deg)}.app-model strong{color:var(--text);font-weight:500}.app-model-name{min-width:0;overflow-wrap:anywhere}.app-model-effort{white-space:nowrap}.app-model-controls{padding:.85rem 0 .15rem}.message{margin:0;color:var(--muted);font-size:.7rem}button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}@container regime-editor (max-width: 54rem){.row{grid-template-columns:minmax(0,1fr) 5.8rem}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 UE,HE=w(()=>{"use strict";T();UE=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:transparent;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,select,input{font:inherit}button{cursor:default}button:focus-visible,select:focus-visible,input: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 strong,.mode-option.active .mode-title svg{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:transparent;text-align:left}.package-row:hover{background:var(--surface-active)}.package-row input,.file 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:translate(.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:transparent}.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:#48b8781a}.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){.bundle-choice,.source-choice,.source-footer{grid-template-columns:1fr;gap:.7rem}.scope-grid{grid-template-columns:1fr}.scope-pane+.scope-pane{border-top:1px solid var(--border);border-left:0}}@container scan-page (max-width: 42rem){.options{display:block;padding-bottom:3rem}.checks{margin-top:.8rem}.offline-help{max-width:100%;white-space:normal}.options-footer{margin-top:.8rem}}@container scan-page (max-width: 34rem){.mode-grid,.subtype-options{grid-template-columns:1fr 1fr}.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 VE(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=>!jE.some(o=>o.key===n))?null:[{id:"",label:"All files",subtitle:"Everything"},...jE.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 jE,WE=w(()=>{"use strict";jE=[{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,KE=w(()=>{"use strict";T();bt();Jt();vt();Wt();Do();xv();nf();Av();OE();zE();Iv();HE();Pc();WE();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},_appModel:{state:!0},_appModelAutomatic:{state:!0},_notice:{state:!0}};static styles=UE;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._appModel=null,this._appModelAutomatic=!0,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>${Hi(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">${Hi(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=VE(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="${pe(!this._reason||this._reason==="all")}">All files</option>${r.map(i=>d`<option value="${i.id}" .selected="${pe(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}" .appModel="${this._appModel}" .appModelAutomatic="${this._appModelAutomatic}" @regimes-change="${a=>{this._regimesReady=a.detail.ready,this._regimes=a.detail.value,this._appModel=a.detail.appModel,this._appModelAutomatic=a.detail.appModelAutomatic}}"></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="${pe(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.appModel=this._appModel?{...this._appModel}:null,a.appModelAutomatic=this._appModelAutomatic,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._appModel=e.appModel?{...e.appModel}:null,this._appModelAutomatic=e.appModelAutomatic!==!1,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 GE(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 qE(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,sc(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:Hi(c),module:st(a,{splitOwnDirs:!1,packageDir:r?.get(a)})})),s=[{id:"all",label:"All",filePaths:null},...[...Xs(e,i.map(a=>a.path))].map(([a,c])=>({id:`reason:${a}`,label:a,filePaths:[...c]}))];return{...t,files:i,reasons:s,size:Hi(e.size)}}var YE=w(()=>{"use strict";tn();ac();Ys();Ap();Pc()});function Z4(t){let{data:e}=kn(t);return e&&XE(e)>0?e:null}function XE(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 JE(t,e){let r=[],n=new Map;for(let{name:i,content:s,fallbackRepo:a}of t){if(typeof s!="string")continue;let c=Z4(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:XE(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 ZE=w(()=>{"use strict";Oe();Pc()});function zo(t){if(t?.throwIfAborted(),D())throw new DOMException("Local scan closed","AbortError")}async function QE(t){zo(t);let e=await Dt();return zo(t),GE(e)}async function eA(t,e){zo(e);let r=await In(t.integrity,{name:t.filename},{sources:!1});return zo(e),qE(t,r)}async function tA(t){zo(t);let e=await fe(),r=[];for(let n of e){zo(t);let o=await Le(n);zo(t),r.push({name:n,content:o,fallbackRepo:xt(n)})}return zo(t),JE(r,re())}var rA=w(()=>{"use strict";O();Fn();YE();ZE()});function nA({hostname:t,devServer:e,serverMode:r,localMode:n,deepviewScanServer:o}){return r==="managed"&&!n?null:r==="e2e"?Ha(o):Ha(e)??(t==="127.0.0.1"?q0:null)}var oA=w(()=>{"use strict";Fh()});async function iA(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 nA({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=ea(),o=Zs();await n,!(!of()||o!==Zs())&&(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";T();O();Fo();Pn();St();SE();EE();KE();rA();oA();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)=>iA("Loading bundle\u2026",r,()=>eA(e,r))}connectedCallback(){super.connectedCallback(),this._restoreAccess(),this._unsubscribeSavedAccess=$g(()=>{this._savedAccess=Rs()}),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 iA("Loading bundles\u2026",e.signal,()=>QE(e.signal))}catch(r){e.signal.aborted||(this._error=String(r?.message??r))}}_resetAccess(){this._access.reset(this._server),this._providerToken=""}_restoreAccess(){this._savedAccess=Rs();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=Rs();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=Rs()}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:transparent;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}@container scan-access (max-width: 38rem){.provider-row{grid-template-columns:minmax(0,1fr)}}@container scan-access (max-width: 28rem){.provider-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}.provider-choice:nth-child(odd){border-left:0}.provider-choice:nth-child(n+3){border-top:1px solid var(--border)}}@container scan-access (max-width: 23rem){.access .provider-choice{gap:.25rem;padding-inline:.4rem;font-size:.7rem}}`;_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="${tA}"><button slot="navigation" type="button" @click="${()=>{ea()}}"><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 sA({workspace:t}={}){return Js("workspace-export-dialog",{workspace:t??null},e=>{e.workspace=null})}var eO,jv,aA=w(()=>{"use strict";T();O();Nt();he();Bn();Pi();Hv();eO=[{id:"workspace",label:"Export workspace"},{id:"raw",label:"Raw reports export"}],jv=class extends F{static styles=[...F.styles,R(mr),R(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 Rp({tabs:eO,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 lA(t){await sA({workspace:t})}var cA=w(()=>{"use strict";aA()});function dA(){return le("new-workspace-dialog")}var Vv,uA=w(()=>{"use strict";T();he();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 pA({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,fA=w(()=>{"use strict";T();he();Mr();Wv=class extends F{static styles=[...F.styles,R(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 hA({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(es(s.detail?.cause))}),document.body.append(i)})}var Kv,mA=w(()=>{"use strict";T();O();Nt();he();Pi();Kv=class extends F{static styles=[...F.styles,R(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 gA({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,bA=w(()=>{"use strict";T();he();Mr();Gv=class extends F{static styles=[...F.styles,R(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 yA({name:t,inRemote:e}={}){return le("delete-bundle-dialog",{bundleName:t??"",inRemote:!!e})}var qv,vA=w(()=>{"use strict";T();he();Mr();qv=class extends F{static styles=[...F.styles,R(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 wA({name:t,workspaceName:e}={}){return le("detach-bundle-dialog",{bundleName:t??"",workspaceName:e??""})}var Yv,kA=w(()=>{"use strict";T();he();Mr();Yv=class extends F{static styles=[...F.styles,R(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 xA({name:t,workspaceName:e}={}){return le("detach-report-dialog",{reportName:t??"",workspaceName:e??""})}var Xv,$A=w(()=>{"use strict";T();he();Mr();Xv=class extends F{static styles=[...F.styles,R(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 _A(){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,SA=w(()=>{"use strict";T();he();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 CA(){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,EA=w(()=>{"use strict";T();he();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 tO(){return jr().size}function rO(){return yi().size}function RA(t,e={}){let n=`file-item${t===l.currentFile&&(e.workspaceId??null)===Fi(t)&&(l.currentView==="findings"||l.currentView==="files"||l.currentView==="links")?" current":""}${e.indented?" indented":""}`,o=xe(t),i=gl(t),s=ye[Ke(t)]??ye.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 BA(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 sO(){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">${oO}</button></span>`;return d`<li class="file-group-header workspace-header"><span class="group-label">Workspaces</span>${t}</li>`}function MA(){if(!D())return m;let t=Array.isArray(l.managedTeams)?l.managedTeams:[];return t.length===0?m:d`${BA("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="${()=>{Qs(e)}}">${hO}<span class="file-label">${e.name}</span></button></li>${te(e.reports,r=>r.id,r=>aO(e,r))} ${te(e.bundles??[],r=>r.id,r=>cO(r))}`)}`}function aO(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="${()=>{lO(t,e)}}">${Z(ye.default)}<span class="file-label">${e.filename}</span></button></li>`}function lO(t,e){return Qs(t,e.id)}function cO(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}`}">${OA}<span class="file-label">${t.filename}</span></span></li>`}function dO(){return d`<li class="file-group-header bundles-header" data-default-bundles="true"><span class="group-label">Bundles</span></li>`}function TA(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}`}">${OA}<span class="file-label">${n}</span></button></li>`}function uO(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 pO(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 · ${xe(t)}</em></span></span></li>`}function yO(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">${fO}<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">${bO}</button><button type="button" class="workspace-export" data-action="export-workspace" data-tooltip="Export workspace" aria-label="Export workspace">${mO}</button><button type="button" class="workspace-leave" data-action="leave-workspace" data-tooltip="Leave workspace" aria-label="Leave workspace">${gO}</button></li>`}function sa(t){return Vi?xe(t).toLowerCase().includes(Vi):!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`${MA()}`,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",""),Tr();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 fe();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 AA)c.set(g,[]);for(let g of e){if(i.has(g)||!sa(g))continue;let y=Ke(g);c.has(y)||c.set(y,[]),c.get(y).push(g)}let u=r.filter(g=>!Vi||g.name.toLowerCase().includes(Vi)||g.reports.some(y=>sa(y))?!0:g.bundles.some(y=>{let b=s.get(y);return b&&sa(b.name)})),p=n.filter(g=>!a.has(g.integrity)&&sa(g.name));ie(d`${MA()} ${D()&&r.length===0?m:sO()} ${te(u,g=>g.id,g=>{let y=[],b=[];for(let k of g.reports)sa(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);$?(!Vi||sa($.name))&&v.push($):Vi||x.push(k)}return d`${yO(g)} ${y.map(k=>RA(k,{indented:!0,workspaceId:g.id}))} ${b.map(k=>pO(k,g.id))} ${v.map(k=>TA(k,{workspaceId:g.id}))} ${x.map(k=>uO(k,g.id))}`})} ${AA.map(g=>{let y=(c.get(g)??[]).toSorted(Qv),b=g==="default";return y.length===0&&!(b&&lf)?null:d`${BA(nO[g]??g,{dropTarget:b})} ${y.map(v=>RA(v))}`})} ${p.length>0||cf?dO():null} ${te(p,g=>g.integrity,g=>TA(g))}`,nw);let f=Y.querySelector('sidebar-view-button[kind="packages"]');f&&(f.count=tO());let h=Y.querySelector('sidebar-view-button[kind="repositories"]');h&&(h.count=rO()),Tr(),Fm(e,vO)}function vO(){ew||(ew=!0,requestAnimationFrame(()=>{ew=!1,ee().catch(t=>console.warn("counts repaint:",t))}))}async function IA(t){if(t.target.closest('[data-action="toggle-client-mode"]')){cn?await TO():l.serverMode==="managed"&&(oi(!l.localMode),await uw());return}if(t.target.closest('[data-action="go-home"]')){await ea();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;Ao(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 dA();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&&hA({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&&lA(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 pA({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 yA({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=>Ms(b.id,c)).map(b=>b.id),f=p.length>0,h=Hu(c)?"links file":"report",{confirmed:g,triage:y}=await gA({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;aa.classList.toggle("collapsed");try{localStorage.setItem("deepview.sidebarCollapsed",aa.classList.contains("collapsed")?"1":"0")}catch{}}}function kO(t){Vi=t.target.value.trim().toLowerCase(),ee()}function PA(){return H.getServerUrl()||Dc?re().length>0:!1}function NA(){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`${LA(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">${LA(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">${iO}<span>Log out</span></button>`,r)}function LA(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="${$O}">`}</span>`}function $O(t){t.currentTarget.classList.add("broken")}function DA(){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 _O(){aa&&(aa.dataset.mode=Nr()),D()?(aa?.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 Tr(t){let e=Y?.querySelector("#sync-status");if(!e)return;if(DA(),_O(),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),NA();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=PA(),o=or()!=null;if(n&&o&&H.isEnabled()&&Fl().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=xO[i]??"")}async function zA(){if(!H.persistenceDegraded||iw||tw)return;tw=!0;let{shown:t}=await _A();if(tw=!1,t){iw=!0;return}H.persistenceDegraded&&setTimeout(zA,1500)}async function UA(){if(!H.proxyAuthRequired||sw||rw)return;rw=!0;let{shown:t,reload:e}=await CA();if(rw=!1,!t){H.proxyAuthRequired&&setTimeout(UA,1500);return}sw=!0,e&&location.reload()}function SO(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 HA(t){return t.dataTransfer.types.includes(dw)||t.dataTransfer.types.includes(zc)}function CO(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 EO(){for(let t of Y.querySelectorAll(".dragging"))t.classList.remove("dragging");df(),(lf||cf)&&(lf=!1,cf=!1,ee())}function AO(t){if(!HA(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 RO(t){Y.contains(t.relatedTarget)||df()}async function MO(t){if(!HA(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 wA({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 xi(s,r),n&&n!==r&&await Zm(s,n),ee();return}let o=t.dataTransfer.getData(dw);if(!o)return;if(n&&n!==r&&Ms(n,o)){let s=re().find(c=>c.id===n),{confirmed:a}=await xA({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 $l(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 El(),e!==ln))return;kl()}document.dispatchEvent(new CustomEvent("managed-client-mode-change")),DA(),Tr(H.status),_(),await ee()}async function jA(t){if(t!==void 0&&!B1(t))throw new TypeError(`Unknown managed preview role: ${t}. Expected ${Dl.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",oi(!1),l.serverModeMismatch=!1,l.managedSession=null,l.managedTeams=[],await uw({forgetLastView:!1}))}async function TO(){let t=cn,e=aw;cn=null,aw=null,A1(),Object.assign(l,t),await uw({forgetLastView:!1}),e&&ji(e)}function ji(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)`),Tr(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"&&oi(!1),Iu(t.mode!=="e2e"),Nh(t),Tr(H.status),o&&t.mode==="e2e"&&PA()&&H.isEnabled()&&Fl().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=++FA,r=()=>t===ln&&e===FA&&D();try{let n=await R1();if(!r())return;l.managedSession=n,l.managedSession?.role!=="admin"&&VA.has(l.currentView)&&(l.currentView="manage",_()),NA(),av();let o=n==null?[]:await M1();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)||VA.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 IO??=LO().then(()=>document.querySelector("app-sidebar")?.removeAttribute("inert"))}async function LO(){let t=or();if(t){l.serverMode=t.mode,l.managed=t.managed,Dd().then(o=>{if(o&&o!=="standalone")return ji(o)}).catch(o=>console.warn("server mode revalidation:",o));return}af(!ja());let e=Dd(),r=await Ph(e,ja()?0:3e3),n=or();if(n){r&&r!=="standalone"?ji(r):ji(n,{runtime:!1});return}if(r&&r!=="standalone"){ji(r);return}r==="standalone"&&Nd(),l.serverMode="standalone",oi(r===null),Iu(!0),af(!1),Tr(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 oi(!1),Tr(H.status),ee()}if(s)return ji(s,{runtime:s!==i})}).catch(o=>console.warn("server mode probe:",o))}function FO(){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 BO(t){aa=t,Y=t.renderRoot,nw=Y.querySelector("#file-list"),sE(Y.querySelector("#encryption-toggle")),mE(Y.querySelector("#storage-status")),Y.addEventListener("click",IA),Y.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&e.target.closest?.('[data-action="toggle-client-mode"]')&&(e.preventDefault(),IA(e))}),Y.addEventListener("dblclick",SO),Y.addEventListener("dragstart",CO),Y.addEventListener("dragend",EO),Y.addEventListener("dragover",AO),Y.addEventListener("dragleave",RO),Y.addEventListener("drop",MO),cr(Y,wO),Y.querySelector("#sidebar-search-input")?.addEventListener("input",kO),FO(),Tr(H.status),or()||af(!ja()),ee(),H.onServerInfo(ji),at(),l.serverMode==="managed"&&pw()}var aa,Y,nw,Dc,dw,ow,zc,lf,cf,nO,AA,Vi,oO,iO,OA,fO,hO,mO,gO,bO,Qv,ew,wO,xO,tw,iw,rw,sw,cn,aw,ln,FA,lw,VA,IO,cw,Pn=w(()=>{"use strict";T();vt();bt();O();Er();Nu();qg();Py();rE();Fc();dv();gE();St();bE();vE();Uv();Fo();Bi();cA();Sy();uA();fA();mA();bA();vA();kA();$A();SA();EA();Ar();Wt();Fn();go();aa=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,nO={default:"Reports","claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec",piolium:"Piolium",[Vt]:"Links"},AA=["default","claude-security","codex-security","deepsec","piolium",Vt],Vi="";oO=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>`,iO=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>`;OA=d`${Z(Gr)}`;fO=d`${Z(fo)}`,hO=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>`,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="M8 2v8M5 7l3 3 3-3M3 13h10"/></svg>`,gO=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>`,bO=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)=>xe(t).localeCompare(xe(e));ew=!1;tt(()=>{ee()});wO={placement:"right",gate:t=>{let e=t.querySelector(".file-label");return!e||(t.dataset.tooltip??"")!==e.textContent?!0:e.scrollWidth>e.clientWidth}};xO={off:"Sync off",online:"Online",offline:"Offline",connecting:"Connecting\u2026",error:"Sync error"};H.onStatusChange(Tr);tw=!1,iw=!1;H.onPersistenceDegraded(t=>{Tr(),t?zA():iw=!1});rw=!1,sw=!1;H.onProxyAuthRequired(t=>{Tr(),t?UA():sw=!1});cn=null,aw=null,ln=0,FA=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:"},VA=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=[R(No),R(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(){BO(this)}};customElements.define("app-sidebar",cw)});T();Te();vt();fn();$e();globalThis[Symbol.for("@rray/frontend")]={LitElement:J,html:d,nothing:m,render:ie,unsafeCSS:R,StateElement:V,classMap:I,repeat:te,styleMap:we};Nt();O();Er();Pn();Fo();Fn();O();Nt();Bi();O();Bi();async function WA(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 pc(t)}async function KA(t,{openReport:e,openWorkspace:r}){let[n,o]=await Promise.all([eg(t.report),Qm(t.workspace)]);async function i(u){let p=Fi(u,o?.id);return(l.currentFile!==u||l.currentWorkspace||l.currentReportWorkspace!==p)&&await e(u,void 0,{workspaceId:p}),pc(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=pc(t.id);if(u)return u}let s=pc(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 OO="100% 0px",GA=new WeakMap,la=new WeakMap,fw=[],hw=!1,qA=new WeakMap;function PO(t){let e=qA.get(t);if(e===void 0){let r=getComputedStyle(t).overflowY;e=r==="auto"||r==="scroll"||r==="overlay",qA.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(PO(e))return e;e=e.parentNode}return null}function NO(t){for(let e of t)la.get(e.target)?.cb(e.isIntersecting)}function DO(t){let e=t??document,r=GA.get(e);return r||(r=new IntersectionObserver(NO,{root:t,rootMargin:OO,threshold:0}),GA.set(e,r)),r}function ca(t,e){let r=la.get(t);r?.io&&r.io.unobserve(t),la.set(t,{cb:e,io:null}),fw.push(t),hw||(hw=!0,queueMicrotask(zO))}function zO(){hw=!1;let t=fw;fw=[];for(let e of t){let r=la.get(e);!r||r.io||(r.io=DO(mw(e)),r.io.observe(e))}}function Hn(t){let e=la.get(t);e&&(e.io?.unobserve(t),la.delete(t))}St();var UO=1600,uf="link-target",HO="Couldn't find that finding in any of your reports. Import the report it came from, then open the link again.",pf=null,jO=3,VO=150,WO=5;function KO(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},UO)}function GO(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>=jO||++o>=VO?e():requestAnimationFrame(i)};requestAnimationFrame(i)})}function qO(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 YO(t){let e=t.getBoundingClientRect();if(e.height===0)return!1;let{top:r,bottom:n}=qO(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 XO(t){t.scrollIntoView({block:"center",behavior:"smooth"});for(let e=0;e<WO;e++){if(await GO(t),!t.isConnected||YO(t))return;t.scrollIntoView({block:"center",behavior:"instant"})}}async function JO(t){let e=CSS.escape(t);if(l.viewMode==="table"){let r=M.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=M.querySelector(`.kanban-card[data-gid="${e}"]`);if(r)return r}return M.querySelector(`finding-card[data-gid="${e}"]`)??M.querySelector(`[data-gid="${e}"]`)}async function YA(t,e){let r=ny(t.group,e),n=Yt(r);n&&ap(n)&&queueMicrotask(ke),_();let o=await JO(r);return o?(typeof o.ensureRendered=="function"&&await o.ensureRendered(),await XO(o),KO(o),{ok:!0}):{ok:!0}}async function XA(t){if(!t?.id)return{ok:!1,reason:"This link is missing a finding id."};let e=await KA(t,{openReport:Bt,openWorkspace:gr});return e?await YA(e,t.id):{ok:!1,reason:HO}}async function gw(t,e,r=null){if(!t||!e)return{ok:!1,reason:"Missing finding id or report name."};let n=await WA(t,e,r,{openReport:Bt,openManagedReport:Qs});return n?await YA(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 JA={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 ZA(){x1(async(t,e,r)=>{let n=ng(t);try{return await Lp(t,n,JA[r]??JA.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();T();he();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 QA({retry:t=!1}={}){return le("sync-auth-dialog",{retry:!!t})}function eR(){k1(async({retry:t})=>{try{return await QA({retry:t})}catch(e){return console.warn("Sync auth dialog failed to open:",e),null}})}T();O();var ff="https://triage.space/",ZO=[{hostname:"deepaudit.dev",pathPrefix:"/",supportsSync:!0},{hostname:"chalker.github.io",pathPrefix:"/deepview/",supportsSync:!1}];function QO(){for(let t of ZO)if(location.hostname===t.hostname&&location.pathname.startsWith(t.pathPrefix))return t;return null}var e8=["deepview.triage","deepview.triage.pending"],t8="deepview.repoUrls";function r8(){try{for(let t of e8)if(localStorage.getItem(t))return!0}catch{return!0}try{let t=localStorage.getItem(t8);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 n8(){if(r8())return!0;let t=[];try{t=await fe()}catch{return!0}if(t.length>0)return!0;try{if(re().length>0)return!0}catch{return!0}try{return await Ua()}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 o8(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 tR(){let t=QO();return t?await n8()?await o8(t)?(location.assign(ff),!0):!1:(location.replace(ff),!0):!1}St();T();O();he();Pi();var vw=class extends F{static styles=[...F.styles,R(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 rR({encoded:t}={}){return Js("workspace-unlock-link-dialog",{encoded:t??""},e=>{e.encoded=""})}dv();O();Pn();var Et=null,hf=!1,Uc=null;function i8(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 s8(){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=`
|
|
139
142
|
<div class="lock-overlay-card">
|
|
140
143
|
<div class="lock-overlay-icon" aria-hidden="true">
|
|
141
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>
|
|
@@ -152,37 +155,37 @@ ${r}`}">${i5}<span class="file-label">${n}</span></button></li>`}function s5(e,t
|
|
|
152
155
|
<a href="#" class="lock-overlay-wipe">Wipe local data and start over</a>
|
|
153
156
|
</p>
|
|
154
157
|
</div>
|
|
155
|
-
`;let
|
|
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 Ba({signal:Uc.signal})}catch(n){let o=i8(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?
|
|
156
159
|
|
|
157
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.
|
|
158
161
|
|
|
159
|
-
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
|
|
160
|
-
`;var
|
|
161
|
-
`;var
|
|
162
|
-
`),{target:r=
|
|
163
|
-
`;var
|
|
164
|
-
`;var
|
|
165
|
-
</code>`}return o}var
|
|
166
|
-
`),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=
|
|
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 Oa()}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=s8();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();Tc();Dy();T();O();ue();he();xc();var nR=`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,R(To),R(nR)];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 oR({initial:t="",finding:e=null}={}){return le("comment-dialog",{initial:t,finding:e})}T();he();Mr();var $w=class extends F{static styles=[...F.styles,R(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 iR({name:t,encrypted:e}={}){return le("download-bundle-dialog",{bundleName:t??"",encrypted:!!e})}T();he();Bn();T();var sR=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>`,aR=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>`,lR=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 l8(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 c8(t){return Ee.filter(e=>t.has(e)).map(e=>ds[e]??e).join(", ")}function _w(t=l){let e=[];if(t.filterSeverities.size>0&&e.push({key:"severity",label:"Severity",value:c8(t.filterSeverities),clear:{filterSeverities:new Set}}),t.filterColors.size>0&&e.push({key:"marks",label:"Marks",value:[...t.filterColors].map(r=>Za[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:l8(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;Xl(e);let o;try{o=ko(r).length}finally{Jl()}return{included:o,total:n,excluded:n-o,fields:e,filters:_w(e),bucketLabel:Cw(),focusedOnly:t==="print"&&l.viewMode==="focus"}}var cR=`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 u8=[{id:"download",label:"Markdown",icon:aR},{id:"print",label:"Print",icon:lR}],Ew=class extends F{static styles=[...F.styles,R(cR),R(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>${Rp({tabs:u8,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 dR(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)})}T();he();tc();Oe();var p8=160,f8=320,h8=/^ {0,3}#{1,6}(?: |$)/u,m8=/^ {0,3}(?:=+|-+) *$/u,gf=/^\|?[^|\n]+(?:\|[^|\n]+)+\|?$/u,uR=/^\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?$/u;function pR(t,e=t.join(`
|
|
165
|
+
`),{target:r=p8,max:n=f8}={}){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()&&!(uR.test(t[b])&&p(b-1))&&!(m8.test(t[b])&&!u(b-1)),h=b=>u(b-1)||h8.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 fR(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(uR.test(t[n]))return[n-1,n+1];return null}function hR(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}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 mR=`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 y8=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 v8(t,e,r,n=null){let o="";for(let i=e;i<r;i++){let s=n===null?hR(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 Aw=class extends F{static styles=[...F.styles,R(bf),R(mR)];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=pR(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}">${y8}${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(`
|
|
167
170
|
`)}
|
|
168
|
-
`,
|
|
169
|
-
`),s=await
|
|
170
|
-
`;var
|
|
171
|
-
`;var wF={revalidate:"Outcome",revalidateVerdict:"Explanation",revalidateRecommendation:"Recommendation"},Eg=class extends I{static styles=[...I.styles,C(Rn),C(un),C(z1)];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:t,copies:r})=>d`<li class="conflict-card"><div class="finding-meta">${Tn(t.severity)} ${t.file?d`<span class="location">${t.file}${mt(t.line)?`:${Xc(mt(t.line))}`:""}</span>`:m} <code>${ko(t.id)??t.id}</code></div><h4>${qe(t)}</h4><dl>${u0(r).map(({field:n,variants:o})=>d`<dt>${wF[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 ${he(a)} at this finding`}" @click="${()=>this._finish({id:t.id,reportName:a})}">${re(et[Fe(a)]??et.default)}<span>${he(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",Eg);function U1(e){return ne("revalidation-conflicts-dialog",{conflicts:[...e.values()]})}var H1=2;function j1(e,t){l.focusSplit=t,e.closest(".focus-main")?.style.setProperty("--focus-split",String(t)),e.setAttribute("aria-valuenow",String(Math.round(t)))}function W1(){try{localStorage.setItem(Kl,String(l.focusSplit))}catch{}}function V1(e,t){j1(e,bs(t)),W1()}function K1(e,t){V1(e,l.focusSplit+t)}function G1(e){V1(e,gs)}function q1(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&&j1(e,bs((i.clientX-s.left)/s.width*100))},o=()=>{e.removeEventListener("pointermove",n),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",o),e.classList.remove("dragging"),W1()};e.addEventListener("pointermove",n),e.addEventListener("pointerup",o),e.addEventListener("pointercancel",o)}function kF(e){return rd(yn(e)).map(t=>gr(t))}var xF={annotation(e){let t=de(e),r=Fh(e);return!t&&!r?null:{triage:t?.triage,color:t?.color,comment:t?.comment,fix:t?.fix,flagged:t?.flagged===!0,ignored:r}},location:e=>fr(e,Et(e)),evidence:(e,t,r)=>Jc(e,t,Et(t),r),commit:e=>Zc(e.repo?.github,e.commitHash),report:e=>e._reportName??null};function $F(e,t){let r=new Set(e.map(i=>i.repo??null)),n=r.size===1?[...r][0]:null;if(n)return n;let o=new Set;for(let i of t)for(let s of i)s.repo?.github&&!gt(s.file)&&o.add(s.repo.github);return o.size===1?[...o][0]:o.size===0&&!l.currentWorkspace&&l.repoUrl?l.repoUrl:null}function Ag(e){return e.replace(/\.(?:json|md|codex)$/iu,"")}function Y1(){return l.currentWorkspace?G().find(e=>e.id===l.currentWorkspace)??null:null}function SF(e,t){if(t)return t.name;let r=e.map(o=>o.fileName);return r.length===1?Ag(r[0]):ua(r).replace(/[-_. ]+$/u,"")||`${r.length} reports`}function Rg(){let e=l.reports,t=Dr(),r=xg(),n=kF(r),o=Y1(),i=e.flatMap(c=>c.groups??[]),s=i.some(c=>c.some(xt)),a=i.some(c=>c.some(Ek));return Rp({title:SF(e,o),workspace:o?.name??null,reports:e.map(c=>({name:c.fileName,source:c.source})),repo:$F(e,n),generatedAt:new Date,view:{bucket:$g(),severityMode:s?l.severityMode:null,revalidation:a?l.showRevalidation:null,revalidationDetail:a&&l.showRevalidation!==!1?vn():null},filters:kg(t),counts:{included:n.length,total:r.length},groups:n},xF)}function _F(){let e=Y1(),t=l.reports.map(n=>n.fileName),r="";return e?r=e.name:t.length===1?r=Ag(t[0]):t.length>1&&(r=Ag(ua(t))),r=r.replaceAll(/[\\/:*?"<>|\p{Cc}]/gu,"-").trim(),`${r||"deepview-report"}.md`}function X1(){if(l.reports.length===0)return;let e=new Blob([Rg()],{type:"text/markdown;charset=utf-8"});Sr(e,_F())}var vr=null,Ga=null;function CF(){return vr||(vr=document.createElement("div"),vr.id="app-toast",vr.setAttribute("role","status"),vr.setAttribute("aria-live","polite"),document.body.append(vr),vr)}function J1(e,{kind:t="info",duration:r=5200}={}){let n=CF();clearTimeout(Ga),n.className=t,n.textContent=e,requestAnimationFrame(()=>n.classList.add("visible")),Ga=setTimeout(()=>{n.classList.remove("visible"),Ga=null},r)}function Z1(){vr&&(clearTimeout(Ga),Ga=null,vr.classList.remove("visible"))}var Bg=!1;Fp(()=>{if(Bg)return;Bg=!0;let e=2;function t(){--e===0&&EF()}requestAnimationFrame(t),setTimeout(t,350)});function EF(){Bg=!1,l.currentView==="bundles"&&l.selectedBundle?x():l.currentView==="packages"?x():l.currentView==="repositories"?x():l.currentView==="links"?x():(l.currentView==="findings"||l.currentView==="files")&&(te().catch(()=>{}),qs()&&(l.findingIndexTick++,l.currentView==="findings"&&!l.currentWorkspace&&x()))}var Tg=!1;Hp(()=>{l.currentView!=="findings"&&l.currentView!=="files"&&!Ct()||Tg||(Tg=!0,queueMicrotask(()=>{Tg=!1,!(l.currentView!=="findings"&&l.currentView!=="files"&&!Ct())&&(l.bundleHashTick++,x())}))});xf(()=>{l.linksTick++,x()});function Q1(){l.currentView==="bundles"&&l.bundleDetailsTab==="graph"?Ld():jm()}function Xd(){l.currentView==="bundles"&&l.bundleDetailsTab==="graph"?Fd():Wm()}function Jd(){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 qa(e){let r=document.querySelector(e)?.scrollTop??0;x();let n=document.querySelector(e);n&&(n.scrollTop=r)}function Bn(){l.viewMode==="table"?qa(".findings-table-list"):x()}var Ig=0;function eS(){Ig||(Ig=requestAnimationFrame(()=>{Ig=0,x()}))}function X(e,t){for(let r of e.composedPath())if(r?.matches?.(t))return r;return null}function Lg(e,t){queueMicrotask(()=>{let r=document.querySelector(`.bundle-source-lineno-row[data-line="${e}"]`);r&&r.scrollIntoView(t)})}function iS(e){e.classList.add("copied"),setTimeout(()=>e.classList.remove("copied"),1e3)}function Gd(e,t){try{navigator.clipboard.writeText(t).then(()=>(iS(e),null)).catch(()=>{})}catch{}}function sS(e){if(e.target.classList?.contains("bundle-source-overlay")||e.target.closest('[data-action="bundle-source-close"]'))return l.bundleSourceFile&&(l.bundleSourceFile=null,l.bundleSourceFindingIdx=null,x()),!0;if(e.target.closest('[data-action="bundle-source-panel-close"]'))return l.bundleSourceFindingIdx!=null&&(l.bundleSourceFindingIdx=null,Jd()),!0;let t=e.target.closest("[data-bundle-source-finding]");if(t){let r=parseInt(t.dataset.bundleSourceFinding,10);return Number.isFinite(r)&&(l.bundleSourceFindingIdx=l.bundleSourceFindingIdx===r?null:r,Jd()),!0}return!1}function tS(e){let t=Pg(e);if(!t)return null;let r=Je(t);return Kk(r,od(r))}R.addEventListener("click",e=>{let t=X(e,"[data-code-nav-file]");if(t){cS(Pg(e),{integrity:t.dataset.codeNavIntegrity,file:t.dataset.codeNavFile,range:mt(t.dataset.codeNavLine)});return}let r=X(e,"[data-code-history]");if(r){RF(r.dataset.codeHistory==="forward"?1:-1);return}let n=X(e,"[data-code-preview]");if(n){let S=n.dataset.codePreview,B=new Set(l.codePreviews);B.delete(S)||B.add(S),l.codePreviews=B,x();return}let o=X(e,"[data-finding-code-bundle]");if(o){let S=o.dataset.findingCodeBundle,B=o.dataset.findingCodeFile,z=o.dataset.findingCodeLine,K=z?parseInt(z,10):null;l.bundleSourceFile=B||null,l.bundleSourceFindingIdx=null,(l.bundleDetailsTab==="code"||l.bundleDetailsTab==="search")&&(l.bundleDetailsTab="overview");let ve=()=>{Number.isFinite(K)&&Lg(K,{block:"start",behavior:"instant"})};if(l.selectedBundle===S&&l.bundleDetails?.integrity===S){x(),_o().then(()=>(l.selectedBundle===S&&l.bundleSourceFile===B&&ve(),null));return}l.selectedBundle=S,l.bundleDetails=null,x(),(async()=>(await Pr(S),ve()))();return}let i=e.target.closest("[data-package-expand]");if(i){let S=i.dataset.packageExpand;l.expandedPackages.has(S)?l.expandedPackages.delete(S):l.expandedPackages.add(S),x();return}let s=e.target.closest("[data-package-row-issues]");if(s){let S=s.dataset.packageRowIssues,B=s.dataset.packageRowIssuesVersion;l.selectedPackage=S,l.selectedPackageVersion=B||null,l.packageDetailsTab="issues",l.packageSlideTriage=null,l.packageSlideTransient=!0,x();return}let a=e.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,x();return}let c=e.target.closest("[data-select-package]");if(c){let S=c.dataset.selectPackage,B=c.dataset.selectPackageVersion??"",z=B===""?null:B;if(l.selectedPackage===S&&l.selectedPackageVersion===z)return;l.selectedPackage=S,l.selectedPackageVersion=z,l.packageDetailsTab="overview",l.packageSlideTriage=null,l.packageSlideTransient=!1,x();return}if(e.target.closest("[data-deselect-package]")){l.selectedPackage=null,l.selectedPackageVersion=null,x();return}let u=e.target.closest("[data-package-tab]");if(u){let S=u.dataset.packageTab;(S==="overview"||S==="issues")&&l.packageDetailsTab!==S&&(l.packageDetailsTab=S,x());return}if(e.target.closest('[data-action="package-slide-back"]')){l.packageDetailsTab="overview",l.packageSlideTriage=null,l.packageSlideTransient&&(l.selectedPackage=null,l.selectedPackageVersion=null,l.packageSlideTransient=!1),x();return}let p=X(e,"[data-links-report][data-links-finding]");if(p){e.preventDefault();let{linksReport:S,linksFinding:B}=p.dataset;S&&B&&(async()=>{let z=await mg(B,S);z.ok||alert(z.reason)})().catch(z=>console.warn("links: reveal in report failed:",z));return}let f=e.target.closest("[data-package-report]");if(f){let S=f.dataset.packageReport;S&&dt(S);return}let h=e.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,x();return}if(e.target.closest("[data-deselect-repository]")){l.selectedRepository=null,x();return}let g=e.target.closest("[data-repository-tab]");if(g){let S=g.dataset.repositoryTab;(S==="overview"||S==="issues")&&l.repositoryDetailsTab!==S&&(l.repositoryDetailsTab=S,x());return}if(e.target.closest('[data-action="repository-slide-back"]')){l.repositoryDetailsTab="overview",l.repositorySlideTriage=null,l.repositorySlideTransient&&(l.selectedRepository=null,l.repositorySlideTransient=!1),x();return}let b=e.target.closest("[data-bundle-tab]");if(b){let S=b.dataset.bundleTab;if(Oa.has(S)){if(S===l.bundleDetailsTab){l.selectedBundle&&Fn(l.selectedBundle,S);return}l.bundleDetailsTab==="graph"&&S!=="graph"&&(Ke(),document.body.classList.remove("report-fullscreen")),l.bundleDetailsTab=S,l.bundleSourceFile=null,l.bundleSourceFindingIdx=null,l.selectedBundle&&Fn(l.selectedBundle,S),x(),S==="code"&&_o().then(()=>(l.bundleDetailsTab==="code"&&Pa(),null))}return}let y=e.target.closest("[data-bundle-download]");if(y){let S=y.dataset.bundleDownload,B=(l.bundles??[]).find(z=>z.integrity===S);if(!B)return;(async()=>{let{confirmed:z}=await C1({name:B.name,encrypted:le()});if(z)try{let K=await Cr(S);Sr(new Blob([K],{type:"application/octet-stream"}),B.name)}catch(K){alert(`Failed to download bundle: ${K.message}`)}})();return}let v=e.target.closest("[data-bundle-export-sbom]");if(v){let S=v.dataset.bundleExportSbom,B=l.bundleDetails,z=(l.bundles??[]).find(K=>K.integrity===l.selectedBundle);if(!z||!B||B.integrity!==z.integrity)return;try{let K=S==="cyclonedx",ve=K?Ex(B,z):Ax(B,z),Pe=`${kd(z.name)}.${K?"cdx":"spdx"}.json`;Sr(new Blob([ve],{type:"application/json"}),Pe)}catch(K){alert(`Failed to export ${S==="cyclonedx"?"CycloneDX":"SPDX"}: ${K.message}`)}return}if(X(e,"[data-bundle-search-context]")){l.bundleSearchContext=!l.bundleSearchContext,qa(".bundle-search-results");return}if(e.target.closest("[data-advisories-consent]")){Qx(),x();return}if(e.target.closest("[data-advisories-retry]")){t$(l.bundleDetails,x).catch(()=>{}),x();return}let w=e.target.closest("[data-bundle-issue-report]");if(w){let S=w.dataset.bundleIssueReport;S&&dt(S);return}if(sS(e))return;let $=e.target.closest("[data-bundle-code-issue-step]");if($){let S=$.closest("[data-bundle-code-issue-order]"),B=null;try{B=JSON.parse(S?.dataset.bundleCodeIssueOrder??"null")}catch{}if(Array.isArray(B)&&B.length>0){let z=$.dataset.bundleCodeIssueStep==="-1"?-1:1,K=B.findIndex(Pe=>Pe.idx===l.bundleSourceFindingIdx),ve=K===-1?z>0?B[0]:B.at(-1):B[(K+z+B.length)%B.length];l.bundleSourceFindingIdx=ve.idx,Jd(),ve.line>0&&Lg(ve.line,{block:"center",behavior:"smooth"})}return}let A=X(e,"[data-bundle-view-source]");if(A){let S=A.dataset.bundleViewSource;if(!S)return;let B=A.dataset.bundleViewFindingIdx,z=B===void 0?null:parseInt(B,10),K=A.dataset.bundleViewLine,ve=K?parseInt(K,10):null,Pe=l.bundleSourceFile!==S;if(l.bundleSourceFile=S,Number.isFinite(z)?l.bundleSourceFindingIdx=z:Pe&&(l.bundleSourceFindingIdx=null),A.closest(".bundle-code-rail")?qa(".bundle-code-rail-body"):A.closest(".bundle-search-results")?qa(".bundle-search-results"):A.closest(".bundles-slide-body")?qa(".bundles-slide-body"):x(),Number.isFinite(ve)){let vt=A.dataset.bundleViewScrollBlock||"center";_o().then(()=>(l.bundleSourceFile===S&&Lg(ve,{block:vt,behavior:"smooth"}),null))}return}if(e.target.closest('[data-action="toggle-files"]')){l.currentView==="files"?l.currentView="findings":(l.viewMode==="graph"&&Ke(),l.currentView="files"),document.body.classList.remove("report-fullscreen"),x();return}let F=X(e,"[data-g2-pkg]");if(F){let S=F.dataset.g2Pkg;_.solo=_.solo===S?null:S,_.solo&&(_.selected=null),Q1(),Xd(),_.graphState?.requestDraw?.();return}let M=X(e,"[data-g2-select]");if(M){_.selected=M.dataset.g2Select,Q1(),_.graphState?.requestDraw?.();return}let O=X(e,"[data-g2-top-pkgs]");if(O){_.topPkgsTab=O.dataset.g2TopPkgs,Xd();return}let V=X(e,"[data-g2-jump-findings]");if(V){if(l.currentView==="bundles"){l.bundleDetailsTab==="graph"&&Ke(),l.bundleDetailsTab="issues",l.bundleSourceFile=null,l.bundleSourceFindingIdx=null,l.selectedBundle&&Fn(l.selectedBundle,"issues"),x();return}yi(),l.filterConfMin=0,l.filterInclude=V.dataset.g2JumpFindings,l.currentView="findings",l.viewMode==="graph"&&(l.viewMode="table"),Ke(),x();return}let H=X(e,"[data-g2-jump-file]");if(H){let S=H.dataset.g2JumpFile;l.currentView="files",Ke(),x(),requestAnimationFrame(()=>{let B=document.querySelector(`#${La(S)}`);B&&B.scrollIntoView({behavior:"smooth",block:"start"})});return}if(X(e,"#g2-path-filter-clear")){_.pathFilter="";let S=document.querySelector("graph-layout")?.shadowRoot?.querySelector("#g2-path-filter");S&&(S.value=""),_.graphState?.requestDraw?.();return}if(X(e,"#g2-fullscreen")){document.body.classList.toggle("report-fullscreen");return}if(X(e,"[data-g2-show-all]")){_.showAll=!_.showAll,_.layoutCache=null,_.selected=null,Ke(),x();return}if(X(e,"[data-g2-split-own]")){_.splitOwnDirs=!_.splitOwnDirs,_.layoutCache=null,_.solo=null,_.focusedPkg=null,(_.packagesView||_.bundleLayout==="layers")&&(_.selected=null),Ke(),x();return}if(X(e,"[data-g2-packages-view]")){_.packagesView=!_.packagesView,_.layoutCache=null,_.selected=null,_.focusedPkg=null,Ke(),x();return}let nt=X(e,"[data-g2-layout]");if(nt){let S=nt.dataset.g2Layout;if(S!=="graph"&&S!=="layers"&&S!=="matrix"||_.bundleLayout===S&&!_.focusedPkg)return;_.bundleLayout=S,_.layoutCache=null,_.selected=null,_.solo=null,_.focusedPkg=null,Ke(),x();return}let kr=X(e,".graph2-triage-selector [data-triage-show]");if(kr){let S=kr.dataset.triageShow;l.shownTriage=l.shownTriage===S?null:S,_.layoutCache=null,_.selected=null,Ke(),x();return}let Zt=X(e,"[data-g2-focus-pkg]");if(Zt){_.focusedPkg=Zt.dataset.g2FocusPkg,_.layoutCache=null,Ke(),x();return}if(X(e,"#g2-back-to-full")){_.focusedPkg=null,_.layoutCache=null,(_.packagesView||_.bundleLayout==="layers")&&(_.selected=null),Ke(),x();return}let Qt=X(e,".tab");if(Qt&&X(e,".tabs")){let B=X(e,"[data-gid]").dataset.gid,z=Qt.dataset.tid;l.activeTabByGroup.set(B,z),Bn();return}let jr=X(e,"[data-triage-action]");if(jr){let S=jr.closest(".triage-menu"),B=S?.dataset.gid;if(!B)return;let z=Rt(B);if(!z)return;let K=jr.dataset.triageAction;if(!["inprogress","fixed","invalid","deleted","ignored","restore"].includes(K))return;let{targets:ve,clearing:Pe}=k0(z,K);if(ve.length===0)return;aS(ve,Pe?"untriaged":K);try{S.hidePopover()}catch{}be(),Bn();return}if(X(e,".mark-comment")){let B=X(e,"[data-gid]").dataset.gid,z=Rt(B);if(!z)return;let K=Je(z);if(!_e(K))return;let ve=N(K),Pe=de(K)?.comment??"";_1({initial:Pe,finding:K}).then(vt=>(vt===null||!_e(K)||(U(l.triage,ve,{comment:vt||void 0}),be(),Bn()),null)).catch(()=>{});return}let Hi=X(e,".mark-copy");if(Hi){let S=tS(e);if(S===null)return;Gd(Hi,S);return}let el=X(e,".mark-link");if(el){let S=X(e,"[data-gid]"),B=S?Rt(S.dataset.gid):null;if(!B)return;let z=Mx(Je(B));if(!z)return;Gd(el,z);return}let ji=X(e,"[data-copy-report]");if(ji){Gd(ji,ji.dataset.copyReport);return}let Mo=X(e,"[data-copy-path]");if(Mo){Gd(Mo,Mo.dataset.copyPath);return}let Wi=X(e,".mark-claude");if(Wi){let S=tS(e);if(S===null)return;let B=`claude://code/new?q=${encodeURIComponent(`Confirm and fix:
|
|
172
|
-
|
|
173
|
-
${S}`)}`;try{window.location.href=B,iS(Wi)}catch{}return}if(X(e,".mark-fix")){let B=X(e,"[data-gid]")?.dataset.gid,z=B?Rt(B):null;if(!z)return;let K=Je(z);if(!_e(K))return;let ve=S0(z),Pe=de(K)?.fix??"";P1({initial:Pe,finding:K,canApplyToGroup:w0(ve,Pe)}).then(vt=>{if(vt===null||!_e(K))return null;let Ki=vt.scope==="group"?ve.filter(Wr=>_e(Wr)&&(Wr===K||Mh(Wr,Pe))):[K],Bo=!1;for(let Wr of Ki)U(l.triage,N(Wr),{fix:vt.value||void 0})&&(Bo=!0);return Bo&&(Ki.length>1&&l.activeTabByGroup.set(B,N(K)),Bn(),queueMicrotask(be)),null}).catch(()=>{});return}let tl=X(e,"[data-flag-toggle]");if(tl){let S=tl.dataset.flagToggle,B=X(e,"[data-gid]")?.dataset.gid,z=(B?Rt(B):null)?.find(ve=>N(ve)===S);if(!z||!_e(z))return;let K=de(z)?.flagged;U(l.triage,S,{flagged:K!==!0}),be(),Bn();return}let rl=e.target.closest("[data-triage-show]");if(rl&&!rl.closest(".graph2-triage-selector")){let S=rl.dataset.triageShow;l.shownTriage=l.shownTriage===S?null:S,x();return}if(e.target.closest("[data-table-deselect]")){l.tableSelectedGid=null,Bn();return}let Vi=e.target.closest("[data-tree-select]");if(Vi){let S=Vi.dataset.treeSelect;l.filesSelectedFile=l.filesSelectedFile===S?null:S,x();return}e.target.closest("[data-tree-deselect]")&&(l.filesSelectedFile=null,x())});var rS=document.querySelector("#bundle-source-overlay-slot");rS&&rS.addEventListener("click",sS);function Zd(e){let t=e?Rt(e):null;t&&id(t)&&queueMicrotask(be)}R.addEventListener("row-select",e=>{let t=e.detail?.gid;if(!t)return;let r=l.tableSelectedGid!==t;l.tableSelectedGid=r?t:null,r&&Zd(t),Bn()});var Qd="application/x-deepview-kanban-gid";function aS(e,t){for(let r of e){if(!_e(r))continue;let n=N(r),o=Lh(r);t==="untriaged"?(U(l.triage,n,{triage:void 0}),Xe(l.triage,n,o,!1)):t==="ignored"?(U(l.triage,n,{triage:void 0}),Xe(l.triage,n,o,!0)):(U(l.triage,n,{triage:t}),Xe(l.triage,n,o,!1))}}function Og(){for(let e of R.querySelectorAll(".kanban-card.dragging"))e.classList.remove("dragging");for(let e of R.querySelectorAll(".kanban-column.drag-over"))e.classList.remove("drag-over")}R.addEventListener("dragstart",e=>{let t=e.target.closest?.(".kanban-card[data-kanban-source]");if(!t||!e.dataTransfer)return;let r=t.dataset.gid;if(!r)return;let n=Rt(r);if(!n||wn(n).length===0){e.preventDefault();return}e.dataTransfer.setData(Qd,r),e.dataTransfer.setData("text/plain",r),e.dataTransfer.effectAllowed="move",t.classList.add("dragging")});R.addEventListener("dragend",Og);R.addEventListener("dragover",e=>{if(!e.dataTransfer?.types.includes(Qd))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 R.querySelectorAll(".kanban-column.drag-over"))r!==t&&r.classList.remove("drag-over");t.classList.add("drag-over")}});R.addEventListener("dragleave",e=>{let t=e.target.closest?.(".kanban-column[data-kanban-target]");t&&(t.contains(e.relatedTarget)||t.classList.remove("drag-over"))});R.addEventListener("drop",e=>{if(!e.dataTransfer?.types.includes(Qd))return;let t=e.target.closest?.(".kanban-column[data-kanban-target]");if(!t){Og();return}e.preventDefault();let r=e.dataTransfer.getData(Qd),n=t.dataset.kanbanTarget;if(Og(),!r||!n)return;let o=Rt(r);if(!o||(Ce(o).commonTriage??"untriaged")===n)return;let s=wn(o);s.length!==0&&(aS(s,n),x(),queueMicrotask(be))});var Fg=!1;function Io(e){return e?R.querySelector(`.kanban-card[data-gid="${CSS.escape(e)}"]`):null}function qd(e){let t=e??R.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`),document.documentElement.style.setProperty("--kanban-return-card-bg",getComputedStyle(t).backgroundColor))}function AF(){let e=R.querySelector(".kanban-detail-side [data-kanban-select].active");e&&e.scrollIntoView({block:"nearest",behavior:"instant"})}function Mg(e){l.kanbanPopoverGid=e,l.focusCodeStack=[],l.focusCodeAt=0}function nS(){AF(),An()}function Lo(e){let t=l.kanbanPopoverGid;if(t===e)return;let r=t===null&&e!==null,n=t!==null&&e===null;if(!document.startViewTransition||!r&&!n){Zd(e),Mg(e),x(),nS();return}if(Fg)return;Zd(e),Fg=!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),Fg=!1};if(r){let u=Io(e);u?(qd(u),u.style.viewTransitionName="kanban-detail-modal",u.getBoundingClientRect()):qd(),Mg(e);let p=document.startViewTransition(()=>{x(),nS(),u&&(u.style.viewTransitionName="")}),f=setTimeout(()=>i(u),600);(async()=>{try{await p.finished}catch{}clearTimeout(f),i(u)})();return}qd(),Mg(e);let s=null,a=document.startViewTransition(()=>{x(),s=Io(t),s&&(qd(s),s.style.viewTransitionName="kanban-detail-modal")}),c=setTimeout(()=>i(s??Io(t)),600);(async()=>{try{await a.finished}catch{}clearTimeout(c),i(s??Io(t))})()}function lS(e){let t=Io(l.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;Lo(s);let a=Io(s);a&&(a.focus({preventScroll:!0}),a.scrollIntoView({block:"nearest",behavior:"instant"}))}var Yd=null;function Dg(){nd(),l.focusCodeStack=[],l.focusCodeAt=0,x(),Yd?.isConnected&&Yd.focus({preventScroll:!0}),Yd=null}R.addEventListener("click",e=>{let t=e.target.closest?.("[data-links-preview]");if(t){e.preventDefault(),Yd=t;let s=t.dataset.previewRow,a=m0(t.dataset.linksPreview,t.dataset.previewReport,s===void 0?void 0:Number(s));x(),R.querySelector(".kanban-detail-close")?.focus({preventScroll:!0}),a.then(()=>{x(),An();let c=Ct()?.group?.[0]._bundleHashes;if(Array.isArray(c))for(let u of c)_a(u).catch(()=>{});return null});return}if(e.target.closest?.(".kanban-detail-close")){if(Ct()){Dg();return}Lo(null);return}if(e.target.closest?.("[data-kanban-detail-fullscreen]")){l.kanbanDetailFullscreen=!l.kanbanDetailFullscreen;try{localStorage.setItem(Gl,String(l.kanbanDetailFullscreen))}catch{}x(),An();return}let r=e.target.closest?.("[data-kanban-expand]");if(r){let s=r.dataset.kanbanExpand,a=l.kanbanExpandedColumn===s?null:s;l.kanbanExpandedColumn=a,a&&l.kanbanPopoverGid&&Io(l.kanbanPopoverGid)?.closest(".kanban-column")?.dataset.kanbanTarget!==a&&(l.kanbanPopoverGid=null),x();return}let n=e.target.closest?.("[data-kanban-nav]");if(n){lS(n.dataset.kanbanNav==="next"?1:-1);return}let o=e.target.closest?.("[data-kanban-select]");if(o){if(window.getSelection?.()?.toString())return;let s=o.dataset.gid;s&&Lo(s);return}if(e.target.closest?.(".kanban-action"))return;let i=e.target.closest?.(".kanban-card[data-kanban-source]");if(i){if(window.getSelection?.()?.toString())return;let s=i.dataset.gid;if(!s)return;Lo(l.kanbanPopoverGid===s?null:s);return}if(!e.target.closest?.(".kanban-detail-modal, .kanban-detail-side")){if(Ct()){Dg();return}l.kanbanPopoverGid&&Lo(null)}});R.addEventListener("change",e=>{let t=e.target.closest?.("[data-kanban-column]");if(!t)return;let r=t.selectedOptions[0]?.dataset.gid;r&&Lo(r)});document.addEventListener("keydown",e=>{if(e.key==="Escape"){if(Ct()){!e.defaultPrevented&&!pS(e)&&!document.querySelector(":popover-open")&&Dg();return}if(l.kanbanPopoverGid){Lo(null);return}l.viewMode!=="kanban"||l.kanbanExpandedColumn===null||(l.kanbanExpandedColumn=null,x())}});function Pg(e){let r=X(e,"[data-gid]")?.dataset?.gid;return r?Rt(r):null}function cS(e,t){if(!t.integrity||!t.file)return;let r=Aa(e);if(!r)return;let n=ex(r,t);n&&(l.focusCodeStack=n.stack,l.focusCodeAt=n.at,x()),An()}R.addEventListener("keydown",e=>{if(e.key!=="Enter"&&e.key!==" ")return;let t=X(e,"[data-code-nav-file]");t&&(e.preventDefault(),cS(Pg(e),{integrity:t.dataset.codeNavIntegrity,file:t.dataset.codeNavFile,range:mt(t.dataset.codeNavLine)}))});function RF(e){let t=tx(l.focusCodeStack,l.focusCodeAt,e);t!==l.focusCodeAt&&(l.focusCodeAt=t,x(),An())}function dS(e){if(!e||l.focusGid===e)return;Zd(e),l.focusGid=e,l.focusCodeStack=[],l.focusCodeAt=0,x();let t=R.querySelector(".focus-side-card.active");t&&t.scrollIntoView({block:"nearest",behavior:"instant"}),An()}function uS(e){let t=[...R.querySelectorAll(".focus-side-card[data-focus-select]")];if(t.length===0)return;let r=t.findIndex(i=>i.classList.contains("active")),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&&dS(o)}R.addEventListener("click",e=>{let t=e.target.closest?.("[data-focus-nav]");if(t){uS(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&&dS(n)});R.addEventListener("pointerdown",e=>{if(e.button!==0)return;let t=e.target.closest?.("[data-focus-splitter]");t&&q1(t,e)});R.addEventListener("dblclick",e=>{let t=e.target.closest?.("[data-focus-splitter]");t&&G1(t)});function pS(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(l.currentView!=="findings")return;let t=l.viewMode==="focus",r=l.viewMode==="kanban"&&l.kanbanPopoverGid!==null;if(!t&&!r||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||pS(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){K1(o,n*H1);return}t?uS(n):lS(n)});R.addEventListener("mark-color",e=>{let t=X(e,"[data-gid]");if(!t)return;let r=t.dataset.gid,n=Rt(r);if(!n)return;let o=Je(n);if(!_e(o))return;let i=N(o),s=e.detail?.color;if(!s)return;de(o)?.color===s?U(l.triage,i,{color:void 0}):U(l.triage,i,{color:s}),be(),Bn()});var Fo=null,Ng=null,Pi=null;function fS(){if(Fo!==null)return;if(l.reports.length===0){Pi=null;return}Fo=l.viewMode,Ng=document.title;let e=!1;l.viewMode==="table"&&(l.viewMode="list",e=!0),Pi&&(ma(Pi),e=!0),e&&x();for(let n of R.querySelectorAll("finding-card"))n.ensureRendered({sync:!0});let t=l.reports.map(n=>n.fileName),r="";t.length===1?r=t[0]:t.length>1&&(r=ua(t)),r=r.replace(/\.json$/u,""),r&&(document.title=r)}function hS(){if(Fo===null)return;let e=!1;l.viewMode!==Fo&&(l.viewMode=Fo,e=!0),Pi&&(ga(),Pi=null,e=!0),e&&x(),document.title=Ng,Fo=null,Ng=null}window.addEventListener("beforeprint",fS);window.addEventListener("afterprint",hS);async function TF(e){if(Fo===null){Pi=e,fS();try{await Promise.all([...R.querySelectorAll("finding-card")].map(t=>t.ensureRendered())),window.print()}catch(t){throw hS(),t}}}function oS(e,t){if(!e)return t();ma(e);try{return t()}finally{ga()}}document.addEventListener("download-requested",async()=>{if(l.reports.length===0)return;let{confirmed:e,view:t,fields:r,mode:n}=await I1("download");if(t){await D1(oS(r,()=>Rg()));return}if(e){if(n==="print"){await TF(r);return}oS(r,()=>X1())}});R.addEventListener("analyzer-change",e=>{l.filterAnalyzer=e.detail.analyzer,l.filterModel=e.detail.model,x()});R.addEventListener("repo-change",e=>{l.filterRepo=e.detail.value,x()});R.addEventListener("revalidate-change",e=>{l.filterRevalidate=e.detail.value,x()});R.addEventListener("partial-change",e=>{l.filterPartial=e.detail.value,x()});R.addEventListener("revalidation-change",e=>{l.showRevalidation=e.detail.on,!e.detail.on&&l.reports.some(r=>(r.groups??[]).some(n=>n.some(o=>!o.isApp&&(o.isUpstream||gt(o.file)))))?J1("App mode off is not recommended; it can conflate triage for issues in dependencies.",{kind:"warning"}):e.detail.on&&Z1(),hn(l.showRevalidation,l.upstreamOnly),ba(kn(),{resetSort:!1}),x()});R.addEventListener("revalidation-conflicts-open",()=>{(async()=>{let e=await U1(l.revalidateConflicts);if(!e)return;let t=await mg(e.id,e.reportName);t.ok||alert(t.reason)})().catch(e=>console.warn("revalidation: open conflicting finding failed:",e))});R.addEventListener("revalidation-detail-change",e=>{l.currentWorkspace||(l.revalidationDetailed=e.detail.on===!0,x())});R.addEventListener("upstream-only-change",e=>{if(l.upstreamOnly=e.detail.on===!0,hn(l.showRevalidation,l.upstreamOnly),!l.upstreamOnly){let t=kn();Sh(t,ed(t))==="confirmed"&&(l.filterRevalidate="confirmed",l.filterPartial="")}x()});R.addEventListener("bundle-search-mode-change",e=>{let t=e.detail?.mode;t!=="files"&&t!=="code"&&t!=="issues"||(l.bundleCodeSearchMode=t,x(),t==="files"&&Pa())});R.addEventListener("bundle-graph-reason-change",e=>{let t=e.detail?.reason;t!==null&&typeof t!="string"||(_.bundleReason=t,_.layoutCache=null,_.selected=null,_.solo=null,_.focusedPkg=null,Ke(),x())});R.addEventListener("bundle-search-regex-toggle",()=>{l.bundleSearchRegex=!l.bundleSearchRegex,x()});R.addEventListener("bundle-search-case-toggle",()=>{l.bundleSearchCase=!l.bundleSearchCase,x()});R.addEventListener("bundle-swap",e=>{let t=e.detail?.integrity;!t||!(l.bundles??[]).some(r=>r.integrity===t)||(En(t,"compare"),Fn(t,"compare"),x(),te(),Pr(t))});R.addEventListener("sort-change",e=>{let{kind:t,value:r}=e.detail;if(t==="findings")l.sortBy=r;else if(t==="packages")l.packagesSortBy=r;else if(t==="repositories")l.repositoriesSortBy=r;else return;x()});R.addEventListener("range-change",e=>{e.target.id==="conf-range"&&(l.filterConfMin=e.detail.low,l.filterConfMax=e.detail.high,x())});R.addEventListener("input",e=>{let t=e.composedPath()[0],r=t?.id,n=t?.value;r==="g2-path-filter"&&(_.pathFilter=n,_.graphState?.requestDraw?.())});R.addEventListener("search-input",e=>{if(!e.detail)return;let{kind:t,value:r}=e.detail;if(t==="findings"){l.filterInclude=r,r||(l.filterIncludeNegate=!1),eS();return}else if(t==="files")l.filesSearch=r;else if(t==="packages")l.packagesSearchQuery=r;else if(t==="repositories")l.repositoriesSearchQuery=r;else if(t==="bundle-code")l.bundleCodeSearchQuery=r;else if(t==="bundle-search"){l.bundleSearchQuery=r,eS();return}else return;x()});R.addEventListener("search-negate-toggle",()=>{l.filterIncludeNegate=!l.filterIncludeNegate,x()});R.addEventListener("severity-toggle",e=>{let t=e.detail.severity;if(e.detail.kind==="graph"){_.selectedSeverities.has(t)?_.selectedSeverities.delete(t):_.selectedSeverities.add(t),e.composedPath()[0].selected=[..._.selectedSeverities],_.graphState?.requestDraw?.(),Xd();return}l.filterSeverities.has(t)?l.filterSeverities.delete(t):l.filterSeverities.add(t),x()});R.addEventListener("color-toggle",e=>{let t=e.detail.color;if(e.detail.kind==="graph"){_.selectedColors.has(t)?_.selectedColors.delete(t):_.selectedColors.add(t),e.composedPath()[0].selected=[..._.selectedColors],_.graphState?.requestDraw?.(),Xd();return}l.filterColors.has(t)?l.filterColors.delete(t):l.filterColors.add(t),x()});R.addEventListener("source-toggle",e=>{let t=e.detail.source,r=l.filterSources.has(t);l.filterSources.clear(),r||l.filterSources.add(t),x()});R.addEventListener("annotation-filter-toggle",e=>{let t=e.detail?.key,r=n=>n===""?"with":n==="with"?"without":"";if(t==="comment")l.filterComment=r(l.filterComment);else if(t==="fix")l.filterFix=r(l.filterFix);else if(t==="flag")l.filterFlagged=r(l.filterFlagged);else if(t==="duplicates"&&!l.currentWorkspace)l.filterDuplicates=r(l.filterDuplicates);else if(t==="cross-context")l.filterCrossContext=r(l.filterCrossContext);else if(t==="app-stacked")l.filterAppStacked=r(l.filterAppStacked);else return;x()});R.addEventListener("slide-triage-toggle",e=>{let{kind:t,value:r}=e.detail;if(t==="package")l.packageSlideTriage=l.packageSlideTriage===r?null:r;else if(t==="repository")l.repositorySlideTriage=l.repositorySlideTriage===r?null:r;else return;x()});R.addEventListener("view-mode-change",e=>{if(e.detail.kind==="files"){l.filesViewMode=e.detail.mode,x();return}l.viewMode=e.detail.mode,l.viewMode!=="kanban"&&(l.kanbanPopoverGid=null),l.viewMode!=="focus"&&(l.focusGid=null),x()});R.addEventListener("severity-mode-change",e=>{let t=e.detail?.mode;if(!(t!=="corrected"&&t!=="original")){l.severityMode=t;try{localStorage.setItem(Vl,t)}catch{}x()}});R.addEventListener("repo-edit-start",()=>{l.repoEditing=!0,x()});R.addEventListener("repo-input",e=>{l.repoUrl=e.detail.url,Yt(l.currentFile,l.repoUrl)});R.addEventListener("repo-commit",e=>{l.repoUrl=e.detail.url,Yt(l.currentFile,l.repoUrl),l.repoEditing=!1,x()});R.addEventListener("repo-cancel",e=>{l.repoUrl=e.detail.url,Yt(l.currentFile,l.repoUrl),l.repoEditing=!1,x()});document.addEventListener("keydown",e=>{if(e.key==="Escape"){if(l.bundleSourceFindingIdx!=null){l.bundleSourceFindingIdx=null,Jd();return}if(l.bundleSourceFile){if(l.currentView==="bundles"&&l.bundleDetailsTab==="code")return;l.bundleSourceFile=null,x()}}});function Oe(e,t){for(let[r,n]of Object.entries(t))e.hasAttribute(r)||e.setAttribute(r,n)}var mS=`: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}}
|
|
174
|
-
`;var zg="deepview.theme",zi=Object.freeze(["dark","light","green","pink"]),LF={dark:{base:"#1a1a1b",dim:"#0a0a0a"},light:{base:"#f6f6fa",dim:"#646464"},green:{base:"#0a140a",dim:"#050a05"},pink:{base:"#ffe4ee",dim:"#a3727f"}},FF="\u2600",MF="\u263E",Ug="deepview-theme-changed",eu="dark",jg=!1;function BF(){try{let e=localStorage.getItem(zg);return zi.includes(e)?e:"dark"}catch{return"dark"}}function Ya(e){zi.includes(e)||(e="dark"),eu=e;for(let r of zi)r!=="dark"&&document.body.classList.remove(`theme-${r}`);e!=="dark"&&document.body.classList.add(`theme-${e}`);try{e==="dark"?localStorage.removeItem(zg):localStorage.setItem(zg,e)}catch{}let t=document.querySelector('meta[name="theme-color"]');if(t){let{base:r,dim:n}=LF[e];t.setAttribute("content",jg?n:r)}window.dispatchEvent(new CustomEvent(Ug,{detail:{theme:e}}))}Ya(BF());window.addEventListener("beforeprint",()=>{jg=!0,Ya(eu)});window.addEventListener("afterprint",()=>{jg=!1,Ya(eu)});function gS(e){if(!zi.includes(e))throw new TypeError(`DeepView.setTheme: unknown theme ${JSON.stringify(e)} (expected one of ${zi.map(t=>JSON.stringify(t)).join(", ")})`);Ya(e)}function bS(){return eu}var yS=zi,Hg=class extends oe{static properties={_light:{state:!0}};static styles=C(mS);constructor(){super(),this._light=document.body.classList.contains("theme-light")}connectedCallback(){super.connectedCallback(),Oe(this,{role:"button",tabindex:"0","aria-label":"toggle theme"}),this.addEventListener("click",this._toggle),this.addEventListener("keydown",this._onKeydown),window.addEventListener(Ug,this._onThemeChanged)}disconnectedCallback(){window.removeEventListener(Ug,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");Ya(t?"dark":"light")};_onKeydown=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this._toggle())};render(){return d`${this._light?MF:FF}`}};customElements.define("theme-toggle",Hg);var vS=`: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}}
|
|
175
|
-
`;var
|
|
176
|
-
`;var
|
|
177
|
-
`;var
|
|
178
|
-
`;var
|
|
179
|
-
`;var Vg=class extends oe{static properties={items:{attribute:!1},selectedGid:{attribute:!1}};static styles=C(wS);constructor(){super(),this.items=[],this.selectedGid=null}render(){return d`${J(this.items??[],t=>Z(t),t=>d`<finding-row .group="${t}" ?selected="${Z(t)===this.selectedGid}"></finding-row>`)}`}};customElements.define("finding-table",Vg);var kS=`: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}}}
|
|
180
|
-
`;var
|
|
181
|
-
`;var VF=["red","blue","green","gray"],Gg=class extends oe{static properties={selected:{type:String},disabled:{type:Boolean}};static styles=C(xS);constructor(){super(),this.selected=null,this.disabled=!1}connectedCallback(){super.connectedCallback(),Nt(this.renderRoot)}render(){return d`${VF.map(t=>d`<button type="button" class="${`color-${t}${this.selected===t?" active":""}`}" data-color="${t}" aria-label="${`mark ${t}`}" data-tooltip="${`mark ${t}`}" ?disabled="${this.disabled}" @click="${this._onClick}"></button>`)}`}_onClick=t=>{if(this.disabled)return;let r=t.currentTarget.dataset.color;this.dispatchEvent(new CustomEvent("mark-color",{detail:{color:r},bubbles:!0,composed:!0}))}};customElements.define("color-marker",Gg);var qg=class extends P{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=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="${E({"conf-range-label":!0,replaced:i,disabled:o})}">Confidence</span> <span class="${E({"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?d`<revalidate-filter class="${E({replaces:i})}" .options="${n}" ?has-partial="${this.hasPartial}"></revalidate-filter>`:m}`}};customElements.define("conf-filter",qg);var De=tr(class extends Tt{constructor(e){if(super(e),e.type!==ot.PROPERTY&&e.type!==ot.ATTRIBUTE&&e.type!==ot.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Qb(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===Ie||t===m)return t;let r=e.element,n=e.name;if(e.type===ot.PROPERTY){if(t===r[n])return Ie}else if(e.type===ot.BOOLEAN_ATTRIBUTE){if(!!t===r.hasAttribute(n))return Ie}else if(e.type===ot.ATTRIBUTE&&r.getAttribute(n)===t+"")return Ie;return ml(e),t}});var $S={files:"Filter files\u2026",code:"Search code\u2026",issues:"Search issues\u2026"},SS={files:"Filter files",code:"Search code",issues:"Search issues"},KF=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>`,GF={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>`},Yg=class extends P{static properties={modes:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.modes=[]}render(){let t=l.bundleCodeSearchQuery,r=l.bundleCodeSearchMode,n=this.modes.includes(r)?r:"files",o=$S[n]??$S.files;return d`${KF} <input type="text" class="bundle-code-search-input" placeholder="${o}" aria-label="${o}" .value="${De(t)}" @input="${this._onInput}"> ${t?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="${E({"bundle-code-search-mode":!0,active:n===i})}" role="tab" aria-selected="${String(n===i)}" data-tooltip="${SS[i]??i}" aria-label="${SS[i]??i}" @click="${()=>this._selectMode(i)}">${GF[i]??m}</button>`)}</span>`:m}`}_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",Yg);var qF=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>`,Xg=class extends P{createRenderRoot(){return this}render(){let t=l.bundleSearchQuery,r=l.bundleSearchRegex,n=l.bundleSearchCase,o=r?"Search by regular expression\u2026":"Search all source\u2026";return d`${qF} <input type="text" class="bundle-search-input" placeholder="${o}" aria-label="${o}" spellcheck="false" autocapitalize="off" autocomplete="off" .value="${De(t)}" @input="${this._onInput}"> ${t?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="${E({"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="${E({"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=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",Xg);function wr(e,t,r){let n=t[r];return n||console.warn(`<${e}>: unknown kind ${JSON.stringify(r)}; expected one of ${Object.keys(t).map(o=>JSON.stringify(o)).join(", ")}.`),n}var YF={packages:{stateKey:"packagesSearchQuery",label:"Filter packages"},repositories:{stateKey:"repositoriesSearchQuery",label:"Filter repositories"}},Jg=class extends P{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=wr("entity-search",YF,this.kind);return t?d`<input type="search" class="packages-search" placeholder="${`${t.label}\u2026`}" aria-label="${t.label}" .value="${De(l[t.stateKey])}" @input="${this._onInput}">`:m}_onInput=t=>{this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:this.kind,value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-search",Jg);var XF=[["findings-desc","Findings \u2193"],["files-desc","Files \u2193"],["reports-desc","Reports \u2193"],["name-asc","Name A\u2192Z"]],JF={packages:{stateKey:"packagesSortBy",aria:"Sort packages"},repositories:{stateKey:"repositoriesSortBy",aria:"Sort repositories"}},Zg=class extends P{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=wr("entity-sort",JF,this.kind);return t?d`<select class="packages-sort" aria-label="${t.aria}" .value="${De(l[t.stateKey])}" @change="${this._onChange}">${XF.map(([r,n])=>d`<option value="${r}" ?selected="${l[t.stateKey]===r}">${n}</option>`)}</select>`:m}_onChange=t=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:this.kind,value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-sort",Zg);var Qg=class extends P{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)=>d`<option value="${r}" ?selected="${l.sortBy===r}">${n}</option>`;return d`<select class="sort-select" aria-label="Sort findings" .value="${De(l.sortBy)}" @change="${this._onChange}">${t("severity","Severity \u2193")} ${this.showFile?t("file","File \u2191"):m} ${this.showConfidence?d`${t("confidence-desc","Confidence \u2193")}${t("confidence-asc","Confidence \u2191")}`:m} ${this.showPriority?d`${t("priority-desc","Priority \u2193")}${t("priority-asc","Priority \u2191")}`:m}</select>`}_onChange=t=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:"findings",value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("findings-sort",Qg);var _S=`: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)}
|
|
182
|
-
`;var
|
|
183
|
-
`;var
|
|
184
|
-
`;var nb=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>`,RS=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>`,ob=class extends oe{static properties={url:{type:String},editable:{type:Boolean,reflect:!0},editing:{type:Boolean,reflect:!0},_copied:{state:!0}};static styles=C(AS);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?Me(this.url):"Set repo";return d`<span class="${t?"chip":"chip empty"}" aria-hidden="true" inert>${nb} <span class="label">${r}</span> <button type="button" class="edit-btn">${RS}</button> </span><input type="text" .value="${De(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?Me(this.url):"Set repo",n=t?this._copied?"chip copied":"chip":"chip empty";return d`<span class="${n}" @click="${t?null:this._onEdit}">${nb} ${t?this._slugLabel(r):d`<span class="label">${r}</span>`} <button type="button" class="edit-btn" aria-label="Edit repo URL" @click="${this._onEdit}">${RS}</button></span>`}if(this.url){let t=this._copied?"chip readonly copied":"chip readonly";return d`<span class="${t}" title="Repo from findings (read-only)">${nb} ${this._slugLabel(Me(this.url))}</span>`}return m}_slugLabel(t){return d`<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=Me(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",ob);var t6=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>`,r6=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>`,n6=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>`,o6=re(mi.replace('width="14" height="14"','width="12" height="12"')),i6=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>`,s6=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>`,a6=[{key:"comment",glyph:t6,label:"commented",stateKey:"filterComment",hasKey:"hasComment"},{key:"fix",glyph:r6,label:"fixed",stateKey:"filterFix",hasKey:"hasFix"},{key:"flag",glyph:n6,label:"flagged",stateKey:"filterFlagged",hasKey:"hasFlagged"},{key:"duplicates",glyph:o6,label:"rows with duplicates in other reports",stateKey:"filterDuplicates",hasKey:"hasDuplicates"},{key:"cross-context",glyph:i6,label:"rows across multiple repos or packages",stateKey:"filterCrossContext",hasKey:"hasCrossContext"},{key:"app-stacked",glyph:s6,label:"stacked App rows",stateKey:"filterAppStacked",hasKey:"hasAppStacked"}],l6=new Set(["duplicates","cross-context","app-stacked"]),ib=class extends P{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(),Oe(this,{role:"group","aria-label":this.group==="context"?"Finding row filters":"Annotation filter"})}render(){let t=a6.filter(n=>this.group==="context"===l6.has(n.key)).filter(n=>n.key==="duplicates"?!l.currentWorkspace&&(this.hasDuplicates||l[n.stateKey]):this[n.hasKey]||l[n.stateKey]);if(t.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="${E({"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`${t.map(r)}`}_toggle(t){this.dispatchEvent(new CustomEvent("annotation-filter-toggle",{detail:{key:t},bubbles:!0,composed:!0}))}};customElements.define("annotation-filter",ib);var c6=[["critical","Critical"],["high","High"],["medium","Medium"],["low","Low"],["high_bug","High bug"],["bug","Bug"],["informational","Info"]],sb=class extends P{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(),Oe(this,{role:"group","aria-label":"Filter by severity"})}render(){let t=this.kind==="graph"?new Set(this.selected):l.filterSeverities,r=c6.filter(([n])=>(this.counts[n]??0)||t.has(n));return r.length===0?m:d`${r.map(([n,o])=>{let i=this.counts[n]??0,s=t.has(n);return d`<button type="button" class="${E({"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",sb);var d6=[["corrected","Corrected","Show corrected severities (application-specific re-ratings)"],["original","Original","Show the original analyzer severities"]],ab=class extends P{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Oe(this,{role:"group","aria-label":"Severity display mode"})}render(){let t=l.severityMode;return d`<span class="severity-mode-label">Severity</span><span class="severity-mode-chips">${d6.map(([r,n,o])=>{let i=t===r;return d`<button type="button" class="${E({"severity-mode-chip":!0,active:i})}" aria-pressed="${String(i)}" data-tooltip="${o}" @click="${()=>this._select(r)}">${n}</button>`})}</span>`}_select(t){t!==l.severityMode&&this.dispatchEvent(new CustomEvent("severity-mode-change",{detail:{mode:t},bubbles:!0,composed:!0}))}};customElements.define("severity-mode-switch",ab);var u6=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>`,TS="Show underlying code findings",p6=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>`,IS="Show only upstream dependency findings",lb=class extends P{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(),Oe(this,{role:"group","aria-label":"Revalidation layer"})}render(){let t=l.revalidateConflicts.size,r=t>0?d`<button type="button" class="revalidation-toggle revalidation-conflicts" aria-haspopup="dialog" aria-label="${`View ${t} revalidation conflict${t===1?"":"s"}`}" @click="${this._openConflicts}">${t} ${t===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}${t===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}${t===0&&this.canDrop&&this.canDetail?d`<button type="button" class="${E({"revalidation-detail":!0,on:o})}" aria-pressed="${String(o)}" aria-label="${TS}" data-tooltip="${TS}" ?disabled="${!n||i}" @click="${this._toggleDetail}">${u6}</button>`:m}${this.canUpstream?d`<button type="button" class="${E({"revalidation-upstream":!0,on:s})}" aria-pressed="${String(s)}" aria-label="${IS}" data-tooltip="${IS}" ?disabled="${this.upstreamDisabled}" @click="${this._toggleUpstream}">${p6}</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",lb);var LS=`: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}
|
|
185
|
-
`;var cb=class extends mk{static properties={checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},label:{type:String},accessibleLabel:{type:String,attribute:"accessible-label"}};static styles=bk(LS);constructor(){super(),this.checked=!1,this.disabled=!1,this.label="",this.accessibleLabel=""}render(){return la`<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",cb);var h6=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>`,db=class extends P{createRenderRoot(){return this}render(){let t=l.currentView==="bundles"&&l.selectedBundle,r=!l.currentFile&&!t;return d`<button type="button" class="danger" ?disabled="${r}">${h6}<span>Delete current</span></button>`}};customElements.define("sidebar-delete-current",db);var m6=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>`,g6=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>`,b6={packages:{title:"Show packages",icon:m6,view:"packages"},repositories:{title:"Show repositories",icon:g6,view:"repositories"}},ub=class extends P{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 t=wr("sidebar-view-button",b6,this.kind);if(!t)return m;let r=l.currentView===t.view;return d`<button type="button" class="${E({"sidebar-view-btn":!0,active:r})}" data-tooltip="${t.title}" aria-label="${t.title}">${t.icon}<span class="view-btn-count">${this.count}</span></button>`}};customElements.define("sidebar-view-button",ub);var y6=["invalid","deleted"],v6={package:{stateKey:"packageSlideTriage"},repository:{stateKey:"repositorySlideTriage"}},pb=class extends P{static properties={counts:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.kind=""}connectedCallback(){super.connectedCallback(),Oe(this,{role:"group","aria-label":"Triage view"})}render(){let t=wr("slide-triage-tabs",v6,this.kind);if(!t)return m;let r=l[t.stateKey],n=y6.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="${E({"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(t){this.dispatchEvent(new CustomEvent("slide-triage-toggle",{detail:{kind:this.kind,value:t},bubbles:!0,composed:!0}))}};customElements.define("slide-triage-tabs",pb);var w6=[["own","Sources"],["modules","Deps"]],fb=class extends P{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Oe(this,{role:"group","aria-label":"Source filter"})}render(){return d`${w6.map(([t,r])=>{let n=l.filterSources.has(t);return d`<button type="button" class="${E({"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",fb);var k6=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>`,x6=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>`,$6={findings:{stateKey:"filterInclude",placeholder:"Search findings\u2026"},files:{stateKey:"filesSearch",placeholder:"Search files\u2026"}},hb=class extends P{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=wr("toolbar-search",$6,this.kind);if(!t)return m;let r=l[t.stateKey];return d`${k6} <input type="text" aria-label="${t.placeholder}" placeholder="${t.placeholder}" .value="${De(r)}" @input="${this._onInput}"> ${this.kind==="findings"&&r?this._negateToggle():m}`}_negateToggle(){let t=l.filterIncludeNegate;return d`<button type="button" class="${E({"search-negate-btn":!0,active:t})}" data-tooltip="${t?"Negation on \u2014 click to undo":"Negate: show non-matching findings"}" aria-label="Negate search" aria-pressed="${String(t)}" @click="${this._onToggleNegate}">${x6}</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",hb);var mb=class extends P{static properties={options:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.options=[]}render(){return d`<select class="sort-select" aria-label="Filter by repository" .value="${De(l.filterRepo)}" @change="${this._onChange}"><option value="" ?selected="${l.filterRepo===""}">All repositories</option>${this.options.map(t=>{let r=t??xo,n=t==null?"(no repo)":Me(t);return d`<option value="${r}" ?selected="${l.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",mb);var FS={"":{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"}},gb=class extends P{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="${De(l.filterRevalidate)}" @change="${this._onChange}"><option value="" hidden ?selected="${l.filterRevalidate===""}"></option><option value="">Confidence</option>${this.options.map(t=>d`<option value="${t.value}" ?selected="${l.filterRevalidate===t.value}">${t.label}</option>`)}</select> ${this.hasPartial&&l.filterRevalidate==="confirmed"?this._partialChip():m}`}_partialChip(){let t=FS[l.filterPartial]??FS[""];return d`<button type="button" class="${E({"partial-cycle":!0,[t.cls]:!0})}" data-tooltip="${t.title}" @click="${this._onPartial}">${t.label}</button>`}_onPartial=()=>{let t=Vc.indexOf(l.filterPartial),r=Vc[(t+1)%Vc.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",gb);var MS=[["none","none","unmarked"],["red","r","red"],["blue","b","blue"],["green","g","green"],["gray","x","gray"]],bb=class extends P{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(),Oe(this,{role:"group","aria-label":"Filter by mark color"})}render(){let t=this.kind==="graph"?new Set(this.selected):l.filterColors;return MS.some(([n])=>(this.counts[n]??0)||t.has(n))?d`${MS.map(([n,o,i])=>{let s=this.counts[n]??0,a=t.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(t){this.dispatchEvent(new CustomEvent("color-toggle",{detail:{color:t,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("triage-filter",bb);var S6=["inprogress","fixed","invalid","deleted","ignored"],yb={graph:"graph2-triage-selector",packages:"packages-triage-selector"},_6={inprogress:"In progress"},C6=e=>_6[e]??e.charAt(0).toUpperCase()+e.slice(1),vb=class extends P{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(),Oe(this,{role:"group","aria-label":"Triage view"})}render(){let t=this.states??S6,r=t.reduce((i,s)=>i+(this.counts[s]??0),0),n=this.variant?yb[this.variant]:null;this.variant&&n===void 0&&console.warn(`<triage-selector>: unknown variant ${JSON.stringify(this.variant)}; expected one of ${Object.keys(yb).map(i=>JSON.stringify(i)).join(", ")} or "".`);for(let i of Object.values(yb))this.classList.toggle(i,i===n);let o=r===0&&!l.shownTriage;return this.classList.toggle("is-empty",o),o?m:d`${t.map(i=>{let s=this.counts[i]??0,a=l.shownTriage===i;if(s===0&&!a)return m;let c=C6(i);return d`<button type="button" class="${E({"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",vb);var E6={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`${re(pk)}`},A6={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)"},wb=["kanban","focus","table","list","grouped","graph"],kb=class extends P{static properties={modes:{type:String},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.modes=wb.join(","),this.kind="findings"}connectedCallback(){super.connectedCallback(),Oe(this,{role:"group","aria-label":"View mode"})}render(){let t=this.kind==="files"?l.filesViewMode:l.viewMode,r=this.modes.split(",").map(o=>o.trim()).filter(o=>wb.includes(o)),n=r.length>0?r:wb;return d`${n.map(o=>d`<button type="button" class="${E({"view-mode-btn":!0,active:t===o})}" aria-label="${A6[o]}" aria-pressed="${String(t===o)}" @click="${()=>this._select(o,t)}">${E6[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",kb);var NS=6,BS=14,ou=2,OS=24,Xa=4,R6=1.5,iu=new Map,su=new Map,DS="treemap";function T6(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 I6(e,t,r,n){let o=r*r,i=n*n;return Math.max(i*e/o,o/(i*t))}function PS(e,t){let r=[],n=e.filter(f=>f.value>0),{x:o,y:i,w:s,h:a}=t;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,b=0,y=1/0,v=1/0;for(;h<n.length;){let w=n[h].value*u,$=w>b?w:b,A=w<y?w:y,T=I6($,A,g+w,f);if(h===p||T<=v)v=T,g+=w,b=$,y=A,h++;else break}let k=g/f;if(s>=a){let w=i;for(let $=p;$<h;$++){let A=$===h-1?i+a-w:n[$].value*u/k;r.push({node:n[$],x:o,y:w,w:k,h:A}),w+=A}o+=k,s-=k}else{let w=o;for(let $=p;$<h;$++){let A=$===h-1?o+s-w:n[$].value*u/k;r.push({node:n[$],x:w,y:i,w:A,h:k}),w+=A}i+=k,a-=k}p=h}return r}function zS(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())zS(t)}function US(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 a of e.children.values())o+=US(a,e.path,e,n),i+=a.count,s===void 0?s=a.pkg:s!==a.pkg&&(s=null);return e.value=o,e.count=i,e.pkg=s??null,o}function HS(e,t,r,n,o,i,s){if(n<Xa||o<Xa)return;if(e.isFile){s.push({kind:"file",node:e,x:t,y:r,w:n,h:o});return}if(!(i<NS&&n>=OS&&o>=OS&&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 c=o>=BS+Xa+ou?BS:0,u=t+ou,p=r+c,f=n-ou*2,h=o-c-ou;if(f<Xa||h<Xa)return;let g=[...e.children.values()].toSorted((b,y)=>y.value-b.value);for(let b of PS(g,{x:u,y:p,w:f,h}))HS(b.node,b.x,b.y,b.w,b.h,i+1,s)}function xb(e,t){let r=e/(t||1)*100;return r>=10?r.toFixed(0):r.toFixed(r>=1?1:2)}function jS(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+jS(n,t-1);o>r&&(r=o)}return r}function L6(e,t,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=b=>b.toFixed(2);return`M${g(e+n*u)} ${g(t+n*p)}A${g(n)} ${g(n)} 0 ${c} 1 ${g(e+n*f)} ${g(t+n*h)}L${g(e+r*f)} ${g(t+r*h)}A${g(r)} ${g(r)} 0 ${c} 0 ${g(e+r*u)} ${g(t+r*p)}Z`}function F6(e,t){let r=Math.max(4,Math.floor(t/6.4));return e.length>r?`${e.slice(0,r-1)}\u2026`:e}var $b=class extends oe{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=DS,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(t){t.has("details")&&(this._reason=su.get(this.details?.integrity)??""),(t.has("details")||t.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(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;Q(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(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,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 t=_n(this.details),r=[...t.keys()].filter(f=>t.get(f)!==null);if(r.length===0){this._status="empty";return}this._reasons=xd(this.details,r),this._reasons.has(this._reason)||(this._reason="",su.delete(this.details.integrity));let n=this._reasons.get(this._reason),o=Cn(this.details),{prefix:i,stripped:s}=_t(r),a={name:"",children:new Map,value:0,isFile:!1},c=0;for(let f=0;f<r.length;f++){if(n&&!n.has(r[f]))continue;let h=t.get(r[f]);if(h<=0)continue;let g=s[f].split("/"),b=a,y=!1;for(let w=0;w<g.length-1;w++){let $=b.children.get(g[w]);if($&&$.isFile){y=!0;break}$||($={name:g[w],children:new Map,value:0,isFile:!1},b.children.set(g[w],$)),b=$}if(y)continue;let v=g.at(-1),k=b.children.get(v);if(!(k&&!k.isFile)){if(!k){let w=rt(s[f],{packageDir:o?.get(r[f])});k={name:v,isFile:!0,value:0,origPath:r[f],pkg:w},b.children.set(v,k)}k.value+=h,c+=h}}if(c===0){this._status="empty";return}for(let f of a.children.values())zS(f);let u=new Map;US(a,"",null,u),this._root=a,this._dirByPath=u,this._meta={total:c,prefix:i},this._status="ok";let p=this.details?.integrity?iu.get(this.details.integrity):null;if(p){let f=u.get(p);f?this._focus=this._chainTo(f):iu.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?iu.set(t,r):iu.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",DS=this._mode,this._hideTooltip()}_changeReason(t){this._reason=t.target.value;let r=this.details?.integrity;r&&(this._reason?su.set(r,this._reason):su.delete(r))}_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 d`<nav class="bundle-treemap-crumbs" aria-label="Treemap location"><span class="bundle-treemap-crumbs-lead"><button type="button" class="${E({"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(t){let r=xb(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 d`<div class="bundle-treemap-node bundle-treemap-dir" style="${pe(n)}" data-treemap-into="${t.node.path}" data-tt-path="${`${t.node.path}/`}" data-tt-meta="${`${me(t.node.value)} \xB7 ${o} \xB7 ${r}%`}"><span class="bundle-treemap-dirname">${t.node.name}</span></div>`;let i=t.node.pkg??rt(t.node.path),s=bt(i),a=pe({...n,background:s,color:T6(s)}),c=Ii(i);return t.kind==="agg"?d`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-agg" style="${a}" data-treemap-into="${t.node.path}" data-tt-path="${`${t.node.path}/`}" data-tt-pkg="${c}" data-tt-color="${s}" data-tt-meta="${`${me(t.node.value)} \xB7 ${o} \xB7 ${r}%`}"><span class="bundle-treemap-label">${t.node.name}/</span></div>`:d`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-file" style="${a}" data-bundle-view-source="${t.node.origPath}" data-tt-path="${t.node.path}" data-tt-pkg="${c}" data-tt-color="${s}" data-tt-meta="${`${me(t.node.value)} \xB7 ${r}% of bundle`}"><span class="bundle-treemap-label">${t.node.name}</span></div>`}_arc(t,r,n){let o=xb(t.value,n),i=t.pkg??rt(t.path),s=bt(i),a=Ii(i);if(t.isFile)return Vr`<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="${a}" data-tt-color="${s}" data-tt-meta="${`${me(t.value)} \xB7 ${o}% of bundle`}"></path>`;let c=`${t.count} ${t.count===1?"file":"files"}`;return Vr`<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?a:m}" data-tt-color="${t.pkg?s:m}" data-tt-meta="${`${me(t.value)} \xB7 ${c} \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 m;let a=jS(t,NS),c=Math.min(Math.max(s*.18,26),s*.45),u=(s-c)/a,p=this._meta.total||1,f=[],h=(k,w,$,A)=>{let T=[...k.children.values()].toSorted((O,V)=>V.value-O.value),F=$-w,M=w;for(let O of T){let V=F*(O.value/k.value),H=c+(A-1)*u,q=H+u;V*q>=R6&&(f.push(this._arc(O,L6(o,i,H,q,M,M+V),p)),!O.isFile&&A<a&&O.children.size>0&&h(O,M,M+V,A+1)),M+=V}};h(t,-Math.PI/2,Math.PI*1.5,1);let g=this._focus.length>0,b=Math.max(c-4,10),y=g?Vr`<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="${`${me(t.value)} \xB7 ${t.count} ${t.count===1?"file":"files"} \xB7 ${xb(t.value,p)}%`}"></circle>`:Vr`<circle class="bundle-treemap-center" cx="${o}" cy="${i}" r="${b}"></circle>`,v=Vr`<text class="bundle-treemap-center-label" x="${o}" y="${i}" text-anchor="middle">${g?Vr`<tspan x="${o}" dy="-0.3em">${F6(t.name,b*2-12)}</tspan><tspan class="bundle-treemap-center-sub" x="${o}" dy="1.5em">${me(t.value)}</tspan>`:Vr`<tspan x="${o}" dy="0.35em">${me(t.value)}</tspan>`}</text>`;return d`<svg class="bundle-treemap-sunburst" width="${r}" height="${n}" viewBox="${`0 0 ${r} ${n}`}">${f}${y}${v}</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 c=[...t.children.values()].toSorted((u,p)=>p.value-u.value);for(let u of PS(c,{x:0,y:0,w:this._w,h:this._h}))HS(u.node,u.x,u.y,u.w,u.h,1,o)}let{prefix:i}=this._meta,s=t?t.count:0,a=t?t.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"} · ${me(a)}${i?d`· <span class="mono">${i}</span>`:""}</span> ${this._reasons.size>0?d`<select class="bundle-treemap-reason" aria-label="Reason" @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(t):m:o.map(c=>this._cell(c))}<div class="bundle-treemap-tooltip"></div></div>`}};customElements.define("bundle-treemap",$b);var M6=new TextEncoder;function au(e){return typeof e=="string"?M6.encode(e).byteLength:0}function WS(e){return(t,r)=>Math.abs(r.delta)-Math.abs(t.delta)||t[e].localeCompare(r[e])}function lu(e){return(t,r)=>r.bytes-t.bytes||t[e].localeCompare(r[e])}function B6(){return{baseBytes:0,otherBytes:0,onlyBaseFiles:0,onlyOtherFiles:0,changedFiles:0}}function KS(e,t,r){let n=[],o=[],i=[],s=0,a=0,c=0,u=0,p=0,f=0,h=new Map,g=w=>{let $=r(w),A=h.get($);return A||(A=B6(),h.set($,A)),A},b=new Set([...e.keys(),...t.keys()]);for(let w of b){let $=e.has(w),A=t.has(w),T=g(w);if($&&A){let F=e.get(w),M=t.get(w),O=au(F),V=F===M?O:au(M);if(s+=O,a+=V,T.baseBytes+=O,T.otherBytes+=V,F===M)f++;else{let H=V-O;i.push({path:w,baseBytes:O,otherBytes:V,delta:H}),p+=H,T.changedFiles++}}else if($){let F=au(e.get(w));s+=F,c+=F,T.baseBytes+=F,T.onlyBaseFiles++,n.push({path:w,bytes:F})}else{let F=au(t.get(w));a+=F,u+=F,T.otherBytes+=F,T.onlyOtherFiles++,o.push({path:w,bytes:F})}}let y=[],v=[],k=[];for(let[w,$]of h){let A=$.baseBytes>0||$.onlyBaseFiles>0||$.changedFiles>0,T=$.otherBytes>0||$.onlyOtherFiles>0||$.changedFiles>0,F=$.onlyBaseFiles+$.onlyOtherFiles+$.changedFiles;A&&!T?y.push({pkg:w,bytes:$.baseBytes}):T&&!A?v.push({pkg:w,bytes:$.otherBytes}):(F>0||$.baseBytes!==$.otherBytes)&&k.push({pkg:w,baseBytes:$.baseBytes,otherBytes:$.otherBytes,delta:$.otherBytes-$.baseBytes})}return n.sort(lu("path")),o.sort(lu("path")),i.sort(WS("path")),y.sort(lu("pkg")),v.sort(lu("pkg")),k.sort(WS("pkg")),{totals:{baseFiles:e.size,baseBytes:s,otherFiles:t.size,otherBytes:a,onlyBaseFiles:n.length,onlyBaseBytes:c,onlyOtherFiles:o.length,onlyOtherBytes:u,changedFiles:i.length,changedDelta:p,unchangedFiles:f,fileDelta:t.size-e.size,byteDelta:a-s,identical:n.length===0&&o.length===0&&i.length===0},files:{onlyBase:n,onlyOther:o,changed:i},packages:{onlyBase:y,onlyOther:v,changed:k}}}function VS(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 Ja(e,t){if(e===t)return 0;let r=VS(e),n=VS(t),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 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("."),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 O6(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 D6(e,t){let r=Ja(t.at(-1),e.at(-1));return r>0?"up":r<0?"down":"changed"}function GS(e,t){let r=[],n=[],o=[],i=new Set([...e.keys(),...t.keys()]);for(let a of i){let c=e.get(a),u=t.get(a);if(c&&u){let p=[...c].toSorted(Ja),f=[...u].toSorted(Ja);if(O6(p,f))continue;r.push({pkg:a,baseVersions:p,otherVersions:f,direction:D6(p,f)})}else c?o.push({pkg:a,versions:[...c].toSorted(Ja)}):n.push({pkg:a,versions:[...u].toSorted(Ja)})}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:e.size,otherDeps:t.size}}}var qS=400,Za=null;function _b(e){return e===0?"\xB10":`${e>0?"+":"\u2212"}${Math.abs(e).toLocaleString()}`}function YS(e){return`${_b(e)} B`}function cu(e){return e>0?"up":e<0?"down":""}function N6(e,t){if(!t)return"";let r=e/t*100;return`${r>0?"+":r<0?"\u2212":"\xB1"}${Math.abs(r).toFixed(1)}%`}function Sb(e){return e.join(", ")}var Cb=class extends oe{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(Za&&this.integrity===Za.base){let r=Za.target;Za=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||(l.bundles??[]).some(r=>r.integrity===t)&&(Za={base:t,target:this.integrity},this.dispatchEvent(new CustomEvent("bundle-swap",{bubbles:!0,composed:!0,detail:{integrity:t}})))}_nameFor(t){return(l.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=(l.bundles??[]).find(o=>o.integrity===t);if(!r){this._status="idle",this._targetIntegrity=null;return}let n=await So(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=d`<span class="bundle-compare-row-path mono">${r}</span>${o}`;return n?d`<li><button type="button" class="bundle-compare-row bundle-compare-row-link" data-bundle-view-source="${t}" data-tooltip="${t}">${i}</button></li>`:d`<li><div class="bundle-compare-row" title="${t}">${i}</div></li>`}_group(t,r,n,o,i){if(r.length===0)return m;let s=r.slice(0,qS),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">${t}</span> <span class="bundle-compare-group-count">${r.length}</span></header><ul class="bundle-compare-rows">${J(s,o,i)}</ul>${a>0?d`<div class="bundle-compare-more">and ${a.toLocaleString()} more…</div>`:m}</section>`}_sizeCells(t){return t.delta===void 0?d`<span class="bundle-compare-row-size">${me(t.bytes)}</span>`:d`<span class="bundle-compare-row-size">${me(t.baseBytes)} → ${me(t.otherBytes)}</span> <span class="${`bundle-compare-row-delta ${cu(t.delta)}`}">${YS(t.delta)}</span>`}_fileGroup(t,r,n,o,i){return this._group(t,r,n,s=>s.path,s=>this._fileRow(s.path,i(s.path),o,this._sizeCells(s)))}_pkgGroup(t,r,n){return this._group(t,r,n,o=>o.pkg,o=>d`<li><div class="bundle-compare-row" title="${Ii(o.pkg)}"><span class="bundle-compare-pkg-dot" style="${pe({background:bt(o.pkg)})}"></span> <span class="bundle-compare-row-path">${Ii(o.pkg)}</span> ${this._sizeCells(o)}</div></li>`)}_versionRow(t){let r=t.direction==="up"?"\u2191":t.direction==="down"?"\u2193":"\xB1",n=t.direction==="up"?"Upgraded":t.direction==="down"?"Downgraded":"Changed";return d`<li><div class="bundle-compare-row" title="${`${t.pkg} \xB7 ${n}`}"><span class="bundle-compare-pkg-dot" style="${pe({background:bt(t.pkg)})}"></span> <span class="bundle-compare-row-path">${t.pkg}</span> <span class="bundle-compare-ver"><span class="bundle-compare-ver-from">${Sb(t.baseVersions)}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="${`bundle-compare-ver-to ${t.direction}`}">${Sb(t.otherVersions)}</span> <span class="${`bundle-compare-ver-dir ${t.direction}`}" aria-hidden="true">${r}</span></span></div></li>`}_depGroup(t,r,n){return this._group(t,r,n,o=>o.pkg,o=>d`<li><div class="bundle-compare-row" title="${o.pkg}"><span class="bundle-compare-pkg-dot" style="${pe({background:bt(o.pkg)})}"></span> <span class="bundle-compare-row-path">${o.pkg}</span> <span class="bundle-compare-dep-ver">${Sb(o.versions)}</span></div></li>`)}_renderVersionUpdates(t,r,n){let{updated:o,added:i,removed:s}=t;if(o.length===0&&i.length===0&&s.length===0)return m;let a=o.slice(0,qS),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">${J(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 t=`${this.integrity}|${this._targetIntegrity}`;if(this._diffKey!==t||!this._diff){let r=tt(this.details),n=tt(this._otherDetails),{prefix:o}=_t([...r.keys(),...n.keys()]),i=Cn(this.details),s=Cn(this._otherDetails),a=i||s?new Map([...i??[],...s??[]]):null,c=u=>rt(o&&u.startsWith(o)?u.slice(o.length):u,{packageDir:a?.get(u)});this._diff=KS(r,n,c),this._diff.versionUpdates=GS($a(this.details),$a(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,s=N6(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 ${cu(r.fileDelta)}`}">${_b(r.fileDelta)}</span></div><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Size</span> <span class="bundle-compare-metric-value">${me(r.baseBytes)} → ${me(r.otherBytes)}</span> <span class="${`bundle-compare-metric-delta ${cu(r.byteDelta)}`}">${YS(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 ${cu(i)}`}">${_b(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(t,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="${De(this._targetIntegrity??"")}" @change="${o=>this._onPick(o)}" aria-label="Bundle to compare with"><option value="">Choose a bundle…</option>${t.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 t=(l.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):m,o=r&&this._status==="ready"&&this._otherDetails&&(this._otherDetails.json||this._otherDetails.bundle)&&!this._otherDetails.error,i;return this._baseReady?t.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 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}=_t(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=t.packages.onlyOther.length>0||t.packages.onlyBase.length>0||t.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(t.versionUpdates,n,r)} ${t.totals.identical?d`<div class="bundle-compare-identical">These two bundles carry identical sources (${t.totals.unchangedFiles.toLocaleString()} ${t.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}`,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>`: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}`,t.files.onlyBase,"removed",!0,c)} ${this._fileGroup(`Added \xB7 only in ${r}`,t.files.onlyOther,"added",!1,c)} ${this._fileGroup("Changed",t.files.changed,"changed",!0,c)}</div></section>`}`}};customElements.define("bundle-compare",Cb);var Eb=class extends P{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}">${E1}</button>`:m}_onClick=()=>{this.dispatchEvent(new CustomEvent("download-requested",{bubbles:!0,composed:!0}))}};customElements.define("download-button",Eb);function Qa(e){let t=new Map;for(let[r,n]of l.triage)n[e]&&t.set(r,n[e]);return t}var P6={get markers(){return Qa("color")},get triageState(){return Qa("triage")},get comments(){return Qa("comment")},get fixes(){return Qa("fix")},get flags(){return Qa("flagged")},get(e){let t=l.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(l.triage,e,{color:void 0})&&(s=!0):l.triage.get(e)?.color!==t&&(U(l.triage,e,{color:t}),s=!0)),r!==void 0)if(r===null||r===""||r===!1)U(l.triage,e,{triage:void 0})&&(s=!0);else if(r==="inprogress"||r==="fixed"||r==="invalid"||r==="deleted")l.triage.get(e)?.triage!==r&&(U(l.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 a=n?String(n):"";a?l.triage.get(e)?.comment!==a&&(U(l.triage,e,{comment:a}),s=!0):U(l.triage,e,{comment:void 0})&&(s=!0)}if(o!==void 0){let a=o?String(o):"";a?l.triage.get(e)?.fix!==a&&(U(l.triage,e,{fix:a}),s=!0):U(l.triage,e,{fix:void 0})&&(s=!0)}if(i!==void 0){let a=i===null||i===""?void 0:!!i;l.triage.get(e)?.flagged!==a&&(U(l.triage,e,{flagged:a}),s=!0)}return s&&(await be(),x()),s}};window.DeepView={get reports(){return l.reports.slice()},get groups(){return At()},get findings(){return At().flat()},get currentFile(){return l.currentFile},get currentWorkspace(){return l.currentWorkspace},triage:P6,themes:yS,setTheme:gS,get theme(){return bS()},triageSync:j,refresh(){x()},export(){return ES()}};var z6={default:ce.default,"claude-security":ce["claude-security"],"codex-security":ce["codex-security"],deepsec:ce.deepsec,piolium:ce.piolium,bundle:fi,workspace:hi,links:mi};for(let e of document.querySelectorAll(".drop-supported-icon[data-icon]")){let t=z6[e.dataset.icon];t&&(e.innerHTML=t)}Mw(x);_f(x);Fw(x);j.onStatusChange(x);Iw(async(e,t)=>{l.currentWorkspace===e?await jt(e):l.currentFile&&l.currentFile===t?await dt(t):await te()});Lw(async()=>{await te(),l.currentView==="bundles"&&x()});y1();w1();async function QS(){let e=Gf();if(!e)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let t;try{t=await x1({encoded:e})}catch(n){return alert(`Couldn't open the share-link unlock prompt: ${n.message}`),!1}if(!t)return!1;let r=await df({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 jt(r.workspace.id):await te(),!0}async function e_(){let e=mc();if(!e)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let t=await g1(e);return t.ok?!0:(alert(t.reason),!1)}var Ui=!1;async function t_(){if(!Ui){Ui=!0;try{await U6()}finally{Ne.hidden=!1}}}async function U6(){if(await Xr(),of(),await te(),await QS()||await e_())return;let r=ze(Ln);if(r)if(r.startsWith("ws:")){let n=r.slice(3);G().some(o=>o.id===n)&&await jt(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):"",a=Oa.has(s)?s:"overview";(l.bundles??[]).some(c=>c.integrity===i)&&(En(i,a),x(),Pr(i))}else{let n=await fe(),o=_c(r);o&&n.includes(o.name)&&await dt(o.name,void 0,{workspaceId:o.workspaceId})}}var XS=le(),JS=!1;function ZS(e){JS||(JS=!0,queueMicrotask(()=>{alert(e+" This tab will reload to refresh its state. Any unsaved edits in this tab will be lost."),location.reload()}))}He(()=>{let e=XS,t=le();if(XS=t,x(),!Ui&&Gt()){t_().catch(r=>console.warn("continueBoot:",r));return}if(Ui&&t&&!Gt()){ZS("Encryption was just enabled in another tab.");return}Ui&&e&&!t&&!Ou()&&ZS("Encryption was disabled in another tab.")});window.addEventListener("hashchange",()=>{Ui&&(async()=>{await QS()||await e_()})().catch(e=>console.warn("deep-link hashchange:",e))});(async()=>{if(!await k1()){try{let e=window.matchMedia?.("(display-mode: window-controls-overlay)").matches;if(!e&&l.serverMode!=="managed"&&localStorage.getItem("deepview.sidebarCollapsed")==="1"&&fy.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{}le()&&!Gt()||await t_()}})();
|
|
171
|
+
`,ca(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=fR(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=v8(this._lines,n.start,n.end,a?.length===n.end-n.start?a:null),e.classList.remove("evd-pending")}};customElements.define("export-view-dialog",Aw);function gR(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)})}T();O();ue();he();xc();var bR=`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 Rw=class extends F{static styles=[...F.styles,R(To),R(bR)];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",Rw);function yR({initial:t="",finding:e=null,canApplyToGroup:r=!1}={}){return le("fix-link-dialog",{initial:t,finding:e,canApplyToGroup:r})}T();bt();he();Bn();Ar();ue();bb();xc();Fc();var vR=`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 x8={revalidate:"Outcome",revalidateVerdict:"Explanation",revalidateRecommendation:"Recommendation"},Mw=class extends F{static styles=[...F.styles,R(To),R(No),R(vR)];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}${Tt(e.line)?`:${Ju(Tt(e.line))}`:""}</span>`:m} <code>${Mi(e.id)??e.id}</code></div><h4>${dt(e)}</h4><dl>${q_(r).map(({field:n,variants:o})=>d`<dt>${x8[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 ${xe(a)} at this finding`}" @click="${()=>this._finish({id:e.id,reportName:a})}">${Z(We[Ke(a)]??We.default)}<span>${xe(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",Mw);function wR(t){return le("revalidation-conflicts-dialog",{conflicts:[...t.values()]})}Bi();ip();O();var kR=2;function xR(t,e){l.focusSplit=e,t.closest(".focus-main")?.style.setProperty("--focus-split",String(e)),t.setAttribute("aria-valuenow",String(Math.round(e)))}function $R(){try{localStorage.setItem(Ud,String(l.focusSplit))}catch{}}function _R(t,e){xR(t,Ka(e)),$R()}function SR(t,e){_R(t,l.focusSplit+e)}function CR(t){_R(t,Wa)}function ER(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&&xR(t,Ka((i.clientX-s.left)/s.width*100))},o=()=>{t.removeEventListener("pointermove",n),t.removeEventListener("pointerup",o),t.removeEventListener("pointercancel",o),t.classList.remove("dragging"),$R()};t.addEventListener("pointermove",n),t.addEventListener("pointerup",o),t.addEventListener("pointercancel",o)}O();Nt();Xr();ue();ot();Oe();function $8(t){return np(ko(t)).map(e=>Zr(e))}var _8={annotation(t){let e=ve(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 S8(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 Tw(t){return t.replace(/\.(?:json|md|codex)$/iu,"")}function AR(){return l.currentWorkspace?re().find(t=>t.id===l.currentWorkspace)??null:null}function C8(t,e){if(e)return e.name;let r=t.map(o=>o.fileName);return r.length===1?Tw(r[0]):Kl(r).replace(/[-_. ]+$/u,"")||`${r.length} reports`}function Iw(){let t=l.reports,e=An(),r=Sw(),n=$8(r),o=AR(),i=t.flatMap(c=>c.groups??[]),s=i.some(c=>c.some(Ut)),a=i.some(c=>c.some(d_));return hm({title:C8(t,o),workspace:o?.name??null,reports:t.map(c=>({name:c.fileName,source:c.source})),repo:S8(t,n),generatedAt:new Date,view:{bucket:Cw(),severityMode:s?l.severityMode:null,revalidation:a?l.showRevalidation:null,revalidationDetail:a&&l.showRevalidation!==!1?Mn():null},filters:_w(e),counts:{included:n.length,total:r.length},groups:n},_8)}function E8(){let t=AR(),e=l.reports.map(n=>n.fileName),r="";return t?r=t.name:e.length===1?r=Tw(e[0]):e.length>1&&(r=Tw(Kl(e))),r=r.replaceAll(/[\\/:*?"<>|\p{Cc}]/gu,"-").trim(),`${r||"deepview-report"}.md`}function RR(){if(l.reports.length===0)return;let t=new Blob([Iw()],{type:"text/markdown;charset=utf-8"});hn(t,E8())}my();Fn();Pn();Fo();yc();Eo();zp();var Nw=!1;ym(()=>{if(Nw)return;Nw=!0;let t=2;function e(){--t===0&&A8()}requestAnimationFrame(e),setTimeout(e,350)});function A8(){Nw=!1,l.currentView==="bundles"&&l.selectedBundle?_():l.currentView==="packages"?_():l.currentView==="repositories"?_():l.currentView==="links"?_():(l.currentView==="findings"||l.currentView==="files")&&(ee().catch(()=>{}),Cl()&&(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 MR(){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 Uo(){l.viewMode==="table"?Hc(".findings-table-list"):_()}var Fw=0;function TR(){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 OR(t){t.classList.add("copied"),setTimeout(()=>t.classList.remove("copied"),1e3)}function yf(t,e){try{navigator.clipboard.writeText(e).then(()=>(OR(t),null)).catch(()=>{})}catch{}}function PR(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 IR(t){let e=Hw(t);if(!e)return null;let r=ft(e);return R_(r,sp(r))}M.addEventListener("click",t=>{let e=oe(t,"[data-code-nav-file]");if(e){zR(Hw(t),{integrity:e.dataset.codeNavIntegrity,file:e.dataset.codeNavFile,range:Tt(e.dataset.codeNavLine)});return}let r=oe(t,"[data-code-history]");if(r){M8(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 Re=()=>{Number.isFinite(X)&&Bw(X,{block:"start",behavior:"instant"})};if(l.selectedBundle===S&&l.bundleDetails?.integrity===S){_(),Li().then(()=>(l.selectedBundle===S&&l.bundleSourceFile===P&&Re(),null));return}l.selectedBundle=S,l.bundleDetails=null,_(),(async()=>(await Ln(S),Re()))();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(_c.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"&&Li().then(()=>(l.bundleDetailsTab==="code"&&Ac(),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 iR({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",Re=X?xC(P,q):$C(P,q),Ze=`${Ep(q.name)}.${X?"cdx":"spdx"}.json`;hn(new Blob([Re],{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(PR(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),Re=X===-1?q>0?P[0]:P.at(-1):P[(X+q+P.length)%P.length];l.bundleSourceFindingIdx=Re.idx,xf(),Re.line>0&&Bw(Re.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,Re=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(Re)){let Pt=C.dataset.bundleViewScrollBlock||"center";Li().then(()=>(l.bundleSourceFile===S&&Bw(Re,{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;A.solo=A.solo===S?null:S,A.solo&&(A.selected=null),MR(),kf(),A.graphState?.requestDraw?.();return}let B=oe(t,"[data-g2-select]");if(B){A.selected=B.dataset.g2Select,MR(),A.graphState?.requestDraw?.();return}let N=oe(t,"[data-g2-top-pkgs]");if(N){A.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}Bs(),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(`#${bc(S)}`);P&&P.scrollIntoView({behavior:"smooth",block:"start"})});return}if(oe(t,"#g2-path-filter-clear")){A.pathFilter="";let S=document.querySelector("graph-layout")?.shadowRoot?.querySelector("#g2-path-filter");S&&(S.value=""),A.graphState?.requestDraw?.();return}if(oe(t,"#g2-fullscreen")){document.body.classList.toggle("report-fullscreen");return}if(oe(t,"[data-g2-show-all]")){A.showAll=!A.showAll,A.layoutCache=null,A.selected=null,it(),_();return}if(oe(t,"[data-g2-split-own]")){A.splitOwnDirs=!A.splitOwnDirs,A.layoutCache=null,A.solo=null,A.focusedPkg=null,(A.packagesView||A.bundleLayout==="layers")&&(A.selected=null),it(),_();return}if(oe(t,"[data-g2-packages-view]")){A.bundleLayout==="dependencies"?(A.dependencyPackagesView=!A.dependencyPackagesView,A.solo=null):A.packagesView=!A.packagesView,A.layoutCache=null,A.selected=null,A.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"||A.bundleLayout===S&&!A.focusedPkg)return;A.bundleLayout=S,S==="dependencies"&&(A.dependencyPackagesView=!1),A.layoutCache=null,A.selected=null,A.solo=null,A.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,A.layoutCache=null,A.selected=null,it(),_();return}let Xe=oe(t,"[data-g2-focus-pkg]");if(Xe){A.focusedPkg=Xe.dataset.g2FocusPkg,A.layoutCache=null,it(),_();return}if(oe(t,"#g2-back-to-full")){A.focusedPkg=null,A.layoutCache=null,(A.packagesView||A.bundleLayout==="layers")&&(A.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),Uo();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:Re,clearing:Ze}=lS(q,X);if(Re.length===0)return;NR(Re,Ze?"untriaged":X);try{S.hidePopover()}catch{}ke(),Uo();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 Re=j(X),Ze=ve(X)?.comment??"";oR({initial:Ze,finding:X}).then(Pt=>(Pt===null||!De(X)||(G(l.triage,Re,{comment:Pt||void 0}),ke(),Uo()),null)).catch(()=>{});return}let fa=oe(t,".mark-copy");if(fa){let S=IR(t);if(S===null)return;yf(fa,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 ha=oe(t,"[data-copy-report]");if(ha){yf(ha,ha.dataset.copyReport);return}let qi=oe(t,"[data-copy-path]");if(qi){yf(qi,qi.dataset.copyPath);return}let ma=oe(t,".mark-claude");if(ma){let S=IR(t);if(S===null)return;let P=`claude://code/new?q=${encodeURIComponent(`Confirm and fix:
|
|
175
|
+
|
|
176
|
+
${S}`)}`;try{window.location.href=P,OR(ma)}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 Re=uS(q),Ze=ve(X)?.fix??"";yR({initial:Ze,finding:X,canApplyToGroup:aS(Re,Ze)}).then(Pt=>{if(Pt===null||!De(X))return null;let ba=Pt.scope==="group"?Re.filter(Vn=>De(Vn)&&(Vn===X||Cb(Vn,Ze))):[X],Yi=!1;for(let Vn of ba)G(l.triage,j(Vn),{fix:Pt.value||void 0})&&(Yi=!0);return Yi&&(ba.length>1&&l.activeTabByGroup.set(P,j(X)),Uo(),queueMicrotask(ke)),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(Re=>j(Re)===S);if(!q||!De(q))return;let X=ve(q)?.flagged;G(l.triage,S,{flagged:X!==!0}),ke(),Uo();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,Uo();return}let ga=t.target.closest("[data-tree-select]");if(ga){let S=ga.dataset.treeSelect;l.filesSelectedFile=l.filesSelectedFile===S?null:S,_();return}t.target.closest("[data-tree-deselect]")&&(l.filesSelectedFile=null,_())});var LR=document.querySelector("#bundle-source-overlay-slot");LR&&LR.addEventListener("click",PR);function $f(t){let e=t?Yt(t):null;e&&ap(e)&&queueMicrotask(ke)}M.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),Uo()});var _f="application/x-deepview-kanban-gid";function NR(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 M.querySelectorAll(".kanban-card.dragging"))t.classList.remove("dragging");for(let t of M.querySelectorAll(".kanban-column.drag-over"))t.classList.remove("drag-over")}M.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")});M.addEventListener("dragend",Dw);M.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 M.querySelectorAll(".kanban-column.drag-over"))r!==e&&r.classList.remove("drag-over");e.classList.add("drag-over")}});M.addEventListener("dragleave",t=>{let e=t.target.closest?.(".kanban-column[data-kanban-target]");e&&(e.contains(t.relatedTarget)||e.classList.remove("drag-over"))});M.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&&(NR(s,n),_(),queueMicrotask(ke))});var Ow=!1;function Wi(t){return t?M.querySelector(`.kanban-card[data-gid="${CSS.escape(t)}"]`):null}function vf(t){let e=t??M.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 R8(){let t=M.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 FR(){R8(),Ro()}function Ki(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),_(),FR();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=Wi(t);u?(vf(u),u.style.viewTransitionName="kanban-detail-modal",u.getBoundingClientRect()):vf(),Pw(t);let p=document.startViewTransition(()=>{_(),FR(),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=Wi(e),s&&(vf(s),s.style.viewTransitionName="kanban-detail-modal")}),c=setTimeout(()=>i(s??Wi(e)),600);(async()=>{try{await a.finished}catch{}clearTimeout(c),i(s??Wi(e))})()}function DR(t){let e=Wi(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;Ki(s);let a=Wi(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}M.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));_(),M.querySelector(".kanban-detail-close")?.focus({preventScroll:!0}),a.then(()=>{_(),Ro();let c=Gt()?.group?.[0]._bundleHashes;if(Array.isArray(c))for(let u of c)lc(u).catch(()=>{});return null});return}if(t.target.closest?.(".kanban-detail-close")){if(Gt()){zw();return}Ki(null);return}if(t.target.closest?.("[data-kanban-detail-fullscreen]")){l.kanbanDetailFullscreen=!l.kanbanDetailFullscreen;try{localStorage.setItem(Hd,String(l.kanbanDetailFullscreen))}catch{}_(),Ro();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&&Wi(l.kanbanPopoverGid)?.closest(".kanban-column")?.dataset.kanbanTarget!==a&&(l.kanbanPopoverGid=null),_();return}let n=t.target.closest?.("[data-kanban-nav]");if(n){DR(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&&Ki(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;Ki(l.kanbanPopoverGid===s?null:s);return}if(!t.target.closest?.(".kanban-detail-modal, .kanban-detail-side")){if(Gt()){zw();return}l.kanbanPopoverGid&&Ki(null)}});M.addEventListener("change",t=>{let e=t.target.closest?.("[data-kanban-column]");if(!e)return;let r=e.selectedOptions[0]?.dataset.gid;r&&Ki(r)});document.addEventListener("keydown",t=>{if(t.key==="Escape"){if(Gt()){!t.defaultPrevented&&!jR(t)&&!document.querySelector(":popover-open")&&zw();return}if(l.kanbanPopoverGid){Ki(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 zR(t,e){if(!e.integrity||!e.file)return;let r=uc(t);if(!r)return;let n=WS(r,e);n&&(l.focusCodeStack=n.stack,l.focusCodeAt=n.at,_()),Ro()}M.addEventListener("keydown",t=>{if(t.key!=="Enter"&&t.key!==" ")return;let e=oe(t,"[data-code-nav-file]");e&&(t.preventDefault(),zR(Hw(t),{integrity:e.dataset.codeNavIntegrity,file:e.dataset.codeNavFile,range:Tt(e.dataset.codeNavLine)}))});function M8(t){let e=KS(l.focusCodeStack,l.focusCodeAt,t);e!==l.focusCodeAt&&(l.focusCodeAt=e,_(),Ro())}function UR(t){if(!t||l.focusGid===t)return;$f(t),l.focusGid=t,l.focusCodeStack=[],l.focusCodeAt=0,_();let e=M.querySelector(".focus-side-card.active");e&&e.scrollIntoView({block:"nearest",behavior:"instant"}),Ro()}function HR(t){let e=[...M.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&&UR(o)}M.addEventListener("click",t=>{let e=t.target.closest?.("[data-focus-nav]");if(e){HR(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&&UR(n)});M.addEventListener("pointerdown",t=>{if(t.button!==0)return;let e=t.target.closest?.("[data-focus-splitter]");e&&ER(e,t)});M.addEventListener("dblclick",t=>{let e=t.target.closest?.("[data-focus-splitter]");e&&CR(e)});function jR(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||jR(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){SR(o,n*kR);return}e?HR(n):DR(n)});M.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;ve(o)?.color===s?G(l.triage,i,{color:void 0}):G(l.triage,i,{color:s}),ke(),Uo()});var Gi=null,Uw=null,da=null;function VR(){if(Gi!==null)return;if(l.reports.length===0){da=null;return}Gi=l.viewMode,Uw=document.title;let t=!1;l.viewMode==="table"&&(l.viewMode="list",t=!0),da&&(Xl(da),t=!0),t&&_();for(let n of M.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=Kl(e)),r=r.replace(/\.json$/u,""),r&&(document.title=r)}function WR(){if(Gi===null)return;let t=!1;l.viewMode!==Gi&&(l.viewMode=Gi,t=!0),da&&(Jl(),da=null,t=!0),t&&_(),document.title=Uw,Gi=null,Uw=null}window.addEventListener("beforeprint",VR);window.addEventListener("afterprint",WR);async function T8(t){if(Gi===null){da=t,VR();try{await Promise.all([...M.querySelectorAll("finding-card")].map(e=>e.ensureRendered())),window.print()}catch(e){throw WR(),e}}}function BR(t,e){if(!t)return e();Xl(t);try{return e()}finally{Jl()}}document.addEventListener("download-requested",async()=>{if(l.reports.length===0)return;let{confirmed:t,view:e,fields:r,mode:n}=await dR("download");if(e){await gR(BR(r,()=>Iw()));return}if(t){if(n==="print"){await T8(r);return}BR(r,()=>RR())}});M.addEventListener("analyzer-change",t=>{l.filterAnalyzer=t.detail.analyzer,l.filterModel=t.detail.model,_()});M.addEventListener("repo-change",t=>{l.filterRepo=t.detail.value,_()});M.addEventListener("revalidate-change",t=>{l.filterRevalidate=t.detail.value,_()});M.addEventListener("partial-change",t=>{l.filterPartial=t.detail.value,_()});M.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&&My(),bo(l.showRevalidation,l.upstreamOnly),Os(Tn(),{resetSort:!1}),_()});M.addEventListener("revalidation-conflicts-open",()=>{(async()=>{let t=await wR(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))});M.addEventListener("revalidation-detail-change",t=>{l.revalidationDetailed=t.detail.on===!0,_()});M.addEventListener("upstream-only-change",t=>{if(l.upstreamOnly=t.detail.on===!0,bo(l.showRevalidation,l.upstreamOnly),!l.upstreamOnly){let e=Tn();fb(e,tp(e))==="confirmed"&&(l.filterRevalidate="confirmed",l.filterPartial="")}_()});M.addEventListener("bundle-search-mode-change",t=>{let e=t.detail?.mode;e!=="files"&&e!=="code"&&e!=="issues"||(l.bundleCodeSearchMode=e,_(),e==="files"&&Ac())});M.addEventListener("bundle-graph-reason-change",t=>{let e=t.detail?.reason;e!==null&&typeof e!="string"||(A.bundleReason=e,A.layoutCache=null,A.selected=null,A.solo=null,A.focusedPkg=null,it(),_())});M.addEventListener("bundle-search-regex-toggle",()=>{l.bundleSearchRegex=!l.bundleSearchRegex,_()});M.addEventListener("bundle-search-case-toggle",()=>{l.bundleSearchCase=!l.bundleSearchCase,_()});M.addEventListener("bundle-swap",t=>{let e=t.detail?.integrity;!e||!(l.bundles??[]).some(r=>r.integrity===e)||(Ao(e,"compare"),Oo(e,"compare"),_(),ee(),Ln(e))});M.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;_()});M.addEventListener("range-change",t=>{t.target.id==="conf-range"&&(l.filterConfMin=t.detail.low,l.filterConfMax=t.detail.high,_())});M.addEventListener("input",t=>{let e=t.composedPath()[0],r=e?.id,n=e?.value;r==="g2-path-filter"&&(A.pathFilter=n,A.graphState?.requestDraw?.())});M.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),TR();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,TR();return}else return;_()});M.addEventListener("search-negate-toggle",()=>{l.filterIncludeNegate=!l.filterIncludeNegate,_()});M.addEventListener("severity-toggle",t=>{let e=t.detail.severity;if(t.detail.kind==="graph"){A.selectedSeverities.has(e)?A.selectedSeverities.delete(e):A.selectedSeverities.add(e),t.composedPath()[0].selected=[...A.selectedSeverities],A.graphState?.requestDraw?.(),kf();return}l.filterSeverities.has(e)?l.filterSeverities.delete(e):l.filterSeverities.add(e),_()});M.addEventListener("color-toggle",t=>{let e=t.detail.color;if(t.detail.kind==="graph"){A.selectedColors.has(e)?A.selectedColors.delete(e):A.selectedColors.add(e),t.composedPath()[0].selected=[...A.selectedColors],A.graphState?.requestDraw?.(),kf();return}l.filterColors.has(e)?l.filterColors.delete(e):l.filterColors.add(e),_()});M.addEventListener("source-toggle",t=>{let e=t.detail.source,r=l.filterSources.has(e);l.filterSources.clear(),r||l.filterSources.add(e),_()});M.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;_()});M.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;_()});M.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),_()});M.addEventListener("severity-mode-change",t=>{let e=t.detail?.mode;if(!(e!=="corrected"&&e!=="original")){l.severityMode=e;try{localStorage.setItem(zd,e)}catch{}_()}});M.addEventListener("repo-edit-start",()=>{l.repoEditing=!0,_()});M.addEventListener("repo-input",t=>{l.repoUrl=t.detail.url,kr(l.currentFile,l.repoUrl)});M.addEventListener("repo-commit",t=>{l.repoUrl=t.detail.url,kr(l.currentFile,l.repoUrl),l.repoEditing=!1,_()});M.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,_()}}});T();function Ye(t,e){for(let[r,n]of Object.entries(e))t.hasAttribute(r)||t.setAttribute(r,n)}var KR=`: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",ua=Object.freeze(["dark","light","green","pink"]),L8={dark:{base:"#1a1a1b",dim:"#0a0a0a"},light:{base:"#f6f6fa",dim:"#646464"},green:{base:"#0a140a",dim:"#050a05"},pink:{base:"#ffe4ee",dim:"#a3727f"}},F8="\u2600",B8="\u263E",Vw="deepview-theme-changed",Sf="dark",Kw=!1;function O8(){try{let t=localStorage.getItem(jw);return ua.includes(t)?t:"dark"}catch{return"dark"}}function jc(t){ua.includes(t)||(t="dark"),Sf=t;for(let r of ua)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}=L8[t];e.setAttribute("content",Kw?n:r)}window.dispatchEvent(new CustomEvent(Vw,{detail:{theme:t}}))}jc(O8());window.addEventListener("beforeprint",()=>{Kw=!0,jc(Sf)});window.addEventListener("afterprint",()=>{Kw=!1,jc(Sf)});function GR(t){if(!ua.includes(t))throw new TypeError(`DeepView.setTheme: unknown theme ${JSON.stringify(t)} (expected one of ${ua.map(e=>JSON.stringify(e)).join(", ")})`);jc(t)}function qR(){return Sf}var YR=ua,Ww=class extends J{static properties={_light:{state:!0}};static styles=R(KR);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?B8:F8}`}};customElements.define("theme-toggle",Ww);T();vt();ot();T();$e();go();ot();gc();var XR=`: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
|
+
`;Fc();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 Af=`.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 U8=["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=[R(No),R(Ef),R(XR),R(Af),R(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 U8)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,ca(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 JR=`: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=R(JR);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);T();$e();go();ot();gc();ty();var ZR=`: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
|
+
`;Fc();var V8=["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=[R(No),R(Ef),R(ZR),R(Af),R(Cf),R(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 V8)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,ca(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);T();var QR=`: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 K8=["red","blue","green","gray"],Xw=class extends J{static properties={selected:{type:String},disabled:{type:Boolean}};static styles=R(QR);constructor(){super(),this.selected=null,this.disabled=!1}connectedCallback(){super.connectedCallback(),cr(this.renderRoot)}render(){return d`${K8.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);Tb();T();Te();$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);T();Te();Jt();$e();O();var e5={files:"Filter files\u2026",code:"Search code\u2026",issues:"Search issues\u2026"},t5={files:"Filter files",code:"Search code",issues:"Search issues"},G8=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>`,q8={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=e5[n]??e5.files;return d`${G8} <input type="text" class="bundle-code-search-input" placeholder="${o}" aria-label="${o}" .value="${pe(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="${t5[i]??i}" aria-label="${t5[i]??i}" @click="${()=>this._selectMode(i)}">${q8[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);T();Te();Jt();$e();O();var Y8=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`${Y8} <input type="text" class="bundle-search-input" placeholder="${o}" aria-label="${o}" spellcheck="false" autocapitalize="off" autocomplete="off" .value="${pe(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);T();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 X8={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",X8,this.kind);return e?d`<input type="search" class="packages-search" placeholder="${`${e.label}\u2026`}" aria-label="${e.label}" .value="${pe(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);T();Jt();$e();O();var J8=[["findings-desc","Findings \u2193"],["files-desc","Files \u2193"],["reports-desc","Reports \u2193"],["name-asc","Name A\u2192Z"]],Z8={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",Z8,this.kind);return e?d`<select class="packages-sort" aria-label="${e.aria}" .value="${pe(l[e.stateKey])}" @change="${this._onChange}">${J8.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);T();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="${pe(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);T();var r5=`: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=R(r5);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);T();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();T();O();Nt();St();he();var n5=`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,R(n5)];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 o5(){return le("triage-export-dialog")}T();Jt();var i5=`: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>`,s5=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=R(i5);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">${s5}</button> </span><input type="text" .value="${pe(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}">${s5}</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);T();Te();bt();$e();O();Wt();var rP=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>`,nP=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>`,oP=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>`,iP=Z(Ts.replace('width="14" height="14"','width="12" height="12"')),sP=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>`,aP=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>`,lP=[{key:"comment",glyph:rP,label:"commented",stateKey:"filterComment",hasKey:"hasComment"},{key:"fix",glyph:nP,label:"fixed",stateKey:"filterFix",hasKey:"hasFix"},{key:"flag",glyph:oP,label:"flagged",stateKey:"filterFlagged",hasKey:"hasFlagged"},{key:"duplicates",glyph:iP,label:"rows with duplicates in other reports",stateKey:"filterDuplicates",hasKey:"hasDuplicates"},{key:"cross-context",glyph:sP,label:"rows across multiple repos or packages",stateKey:"filterCrossContext",hasKey:"hasCrossContext"},{key:"app-stacked",glyph:aP,label:"stacked App rows",stateKey:"filterAppStacked",hasKey:"hasAppStacked"}],cP=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=lP.filter(n=>this.group==="context"===cP.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);T();Te();$e();O();var dP=[["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=dP.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);Te();$e();O();var uP=[["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">${uP.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);T();Te();$e();O();var pP=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>`,a5="Show underlying code findings",fP=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>`,l5="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="${a5}" data-tooltip="${a5}" ?disabled="${!n||i}" @click="${this._toggleDetail}">${pP}</button>`:m}${this.canUpstream?d`<button type="button" class="${I({"revalidation-upstream":!0,on:s})}" aria-pressed="${String(s)}" aria-label="${l5}" data-tooltip="${l5}" ?disabled="${this.upstreamDisabled}" @click="${this._toggleUpstream}">${fP}</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 c5=`: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(c5);constructor(){super(),this.checked=!1,this.disabled=!1,this.label="",this.accessibleLabel=""}render(){return jl`<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 mP=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}">${mP}<span>Delete current</span></button>`}};customElements.define("sidebar-delete-current",fk);T();Te();$e();O();var gP=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>`,bP=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>`,yP={packages:{title:"Show packages",icon:gP,view:"packages"},repositories:{title:"Show repositories",icon:bP,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",yP,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);T();Te();$e();O();var vP=["invalid","deleted"],wP={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",wP,this.kind);if(!e)return m;let r=l[e.stateKey],n=vP.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);Te();$e();O();var kP=[["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`${kP.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);T();Te();Jt();$e();O();var xP=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>`,$P=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>`,_P={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",_P,this.kind);if(!e)return m;let r=l[e.stateKey];return d`${xP} <input type="text" aria-label="${e.placeholder}" placeholder="${e.placeholder}" .value="${pe(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}">${$P}</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);T();Jt();Te();$e();ue();O();var d5={"":{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="${pe(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=d5[l.filterPartial]??d5[""];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);T();$e();O();var u5=[["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 u5.some(([n])=>(this.counts[n]??0)||e.has(n))?d`${u5.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);T();Te();$e();O();var SP=["inprogress","fixed","invalid","deleted","ignored"],kk={graph:"graph2-triage-selector",packages:"packages-triage-selector"},CP={inprogress:"In progress"},EP=t=>CP[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??SP,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=EP(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);Te();$e();O();bt();Wt();var AP={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)}`},RP={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="${RP[o]}" aria-pressed="${String(e===o)}" @click="${()=>this._select(o,e)}">${AP[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);T();fn();Te();tn();Ap();ue();Oi();Ys();var m5=6,p5=14,Rf=2,f5=24,Vc=4,MP=1.5,Mf=new Map,Tf=new Map,h5="treemap";function TP(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 IP(t,e,r,n){let o=r*r,i=n*n;return Math.max(i*t/o,o/(i*e))}function g5(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=IP($,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 b5(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())b5(e)}function y5(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+=y5(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 v5(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<m5&&n>=f5&&o>=f5&&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>=p5+Vc+Rf?p5:0,u=e+Rf,p=r+c,f=n-Rf*2,h=o-c-Rf;if(f<Vc||h<Vc)return;let g=[...t.children.values()].toSorted((y,b)=>b.value-y.value);for(let y of g5(g,{x:u,y:p,w:f,h}))v5(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 w5(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+w5(n,e-1);o>r&&(r=o)}return r}function LP(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 FP(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=h5,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=Tf.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=Xs(this.details,r),this._reasons.has(this._reason)||(this._reason="",Tf.delete(this.details.integrity));let n=this._reasons.get(this._reason),o=en(this.details),i=Vs(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())b5(h);let p=new Map;y5(c,"",null,p),this._root=c,this._dirByPath=p,this._meta={total:u,prefix:s},this._status="ok";let f=this.details?.integrity?Mf.get(this.details.integrity):null;if(f){let h=p.get(f);h?this._focus=this._chainTo(h):Mf.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?Mf.set(e,r):Mf.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",h5=this._mode,this._hideTooltip()}_changeReason(e){this._reason=e.target.value;let r=this.details?.integrity;r&&(this._reason?Tf.set(r,this._reason):Tf.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="${we(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=we({...n,background:s,color:TP(s)}),c=Mo(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=Mo(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=w5(e,m5),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,me=W+u;K*me>=MP&&(f.push(this._arc(N,LP(o,i,W,me,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">${FP(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 g5(c,{x:0,y:0,w:this._w,h:this._h}))v5(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);T();Jt();vt();fn();O();ue();Oi();Ys();tn();Fn();tn();function If(t){return qb(t)??0}function BP(t,e){return t===e||t?.format==="base64"&&e?.format==="base64"&&t.data===e.data}function k5(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 OP(){return{baseBytes:0,otherBytes:0,onlyBaseFiles:0,onlyOtherFiles:0,changedFiles:0}}function $5(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=OP(),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=BP(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 me=W-K;i.push({path:k,baseBytes:K,otherBytes:W,delta:me}),p+=me,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(k5("path")),b.sort(Lf("pkg")),v.sort(Lf("pkg")),x.sort(k5("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 x5(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=x5(t),n=x5(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 PP(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 NP(t,e){let r=Wc(e.at(-1),t.at(-1));return r>0?"up":r<0?"down":"changed"}function _5(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(PP(p,f))continue;r.push({pkg:a,baseVersions:p,otherVersions:f,direction:NP(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 S5=400,Kc=null;function Ak(t){return t===0?"\xB10":`${t>0?"+":"\u2212"}${Math.abs(t).toLocaleString()}`}function C5(t){return`${Ak(t)} B`}function Ff(t){return t>0?"up":t<0?"down":""}function DP(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 Rk=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&&Vs(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,S5),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)}`}">${C5(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="${Mo(o.pkg)}"><span class="bundle-compare-pkg-dot" style="${we({background:Lt(o.pkg)})}"></span> <span class="bundle-compare-row-path">${Mo(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="${we({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="${we({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,S5),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=Ii(this.details),n=Ii(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=$5(r,n,c),this._diff.versionUpdates=_5(oc(this.details),oc(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=DP(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)}`}">${Ak(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)}`}">${C5(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)}`}">${Ak(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="${pe(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",Rk);T();$e();O();var Mk=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}">${sR}</button>`:m}_onClick=()=>{this.dispatchEvent(new CustomEvent("download-requested",{bubbles:!0,composed:!0}))}};customElements.define("download-button",Mk);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 zP={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 ke(),_()),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:zP,forceManagedMode:jA,themes:YR,setTheme:GR,get theme(){return qR()},triageSync:H,refresh(){_()},export(){return o5()}};Ub();Ar();Wt();var UP={default:ye.default,"claude-security":ye["claude-security"],"codex-security":ye["codex-security"],deepsec:ye.deepsec,piolium:ye.piolium,bundle:Gr,workspace:fo,links:Ts};for(let t of document.querySelectorAll(".drop-supported-icon[data-icon]")){let e=UP[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"&&_()});ZA();eR();async function R5(){let t=Hg();if(!t)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let e;try{e=await rR({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 M5(){let t=pu();if(!t)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let e=await XA(t);return e.ok?!0:(alert(e.reason),!1)}var pa=!1;async function T5(){if(await at(),!pa&&!(!D()&&de()&&!tr())){pa=!0;try{await HP()}finally{Ue.hidden=!1}}}async function HP(){let t=Zs(),e=()=>t===Zs()&&!D();if(D()){await ee();return}if(await Br(),!e()||(kl(),await ee(),!e())||await R5()||!e()||await M5()||!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=_c.has(c)?c:"overview";(l.bundles??[]).some(p=>p.integrity===a)&&(Ao(a,u),_(),Ln(a))}else{let i=await fe();if(!e())return;let s=$u(o);s&&i.includes(s.name)&&await Bt(s.name,void 0,{workspaceId:s.workspaceId})}}var Bf=!1,E5=!1;document.addEventListener("managed-client-mode-change",()=>{Bf=!D()&&de()});function A5(t){E5||(E5=!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,_(),!pa&&tr()){T5().catch(r=>console.warn("continueBoot:",r));return}if(pa&&e&&!tr()){A5("Encryption was just enabled in another tab.");return}pa&&t&&!e&&!fh()&&A5("Encryption was disabled in another tab.")});window.addEventListener("hashchange",()=>{pa&&(async()=>{await R5()||await M5()})().catch(t=>console.warn("deep-link hashchange:",t))});(async()=>{if(!await tR()){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 T5()}})();
|
|
186
189
|
/*! Bundled license information:
|
|
187
190
|
|
|
188
191
|
@lit/reactive-element/css-tag.js:
|