@preventive/triage 1.0.0-alpha.42 → 1.0.0-alpha.44
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/bundle-compare-diff.js +2 -167
- package/common/bundle-compare-versions.js +172 -0
- package/common/bundle-comparison.d.ts +8 -0
- package/common/bundle-comparison.js +62 -0
- package/common/managed/report-filter.ts +2 -1
- package/common/managed/routes.js +3 -3
- package/common/security-links.d.ts +5 -0
- package/common/security-links.js +33 -0
- package/common/server-info.ts +8 -0
- package/common/workspace-app.js +14 -1
- package/out/chunk-2ABLKCOY.js +46 -0
- package/out/chunk-5LSXOLUS.js +1 -0
- package/out/chunk-5RCM2J63.js +1 -0
- package/out/chunk-7B6HB4D7.js +1 -0
- package/out/{chunk-4F6JSF57.js → chunk-AJ4GTATZ.js} +1 -1
- package/out/chunk-CH4UN6WK.js +225 -0
- package/out/chunk-EDKLBQQN.js +17 -0
- package/out/{chunk-UXNUAIIC.js → chunk-F47DXCEV.js} +1 -1
- package/out/chunk-FK3DZEKL.js +1 -0
- package/out/chunk-G6AJWENO.js +1 -0
- package/out/chunk-GZWM7UQM.js +2 -0
- package/out/chunk-JCIIBLKR.js +1 -0
- package/out/chunk-LPCTJYNA.js +7 -0
- package/out/{chunk-DGVQPIYB.js → chunk-O4RJY5TP.js} +1 -1
- package/out/chunk-OD4LPN3H.js +1 -0
- package/out/{chunk-D7AF2JXL.js → chunk-QWDWTBM7.js} +1 -1
- package/out/chunk-QYWKC557.js +1 -0
- package/out/chunk-R75XOKUP.js +1 -0
- package/out/{chunk-RSHMVYNS.js → chunk-SWTLADW5.js} +1 -1
- package/out/chunk-T7OKH4VW.js +1 -0
- package/out/{chunk-ZMQQCGF6.js → chunk-UTR2LVME.js} +1 -1
- package/out/chunk-ZESLQCTF.js +6 -0
- package/out/client-managed-import.js +1 -1
- package/out/client-managed.js +21 -21
- package/out/client-sync.js +1 -1
- package/out/graph.js +1 -1
- package/out/index.html +14 -10
- package/out/terminal.js +1 -1
- package/out/view.css +1 -1
- package/out/view.js +58 -58
- package/package.json +13 -3
- package/risk/index.d.ts +26 -0
- package/risk/index.js +1 -1
- package/risk/npm/assess.js +66 -15
- package/risk/npm/dependencies.js +22 -3
- package/risk/npm/new-dependency.js +42 -12
- package/risk/npm/registry.js +122 -21
- package/server-managed/comparison.ts +41 -0
- package/server-managed/http.ts +161 -56
- package/server-managed/locked-packages.ts +29 -6
- package/server-managed/npm-kept.ts +38 -14
- package/server-managed/npm-packages.ts +27 -13
- package/server-managed/npm-risk.ts +69 -11
- package/server-managed/pretty-print.ts +14 -9
- package/server-managed/public-workspace.ts +26 -8
- package/server-managed/queue.ts +23 -0
- package/server-managed/report-sources.ts +1 -1
- package/server-managed/repository-risk-assess.ts +105 -0
- package/server-managed/repository-risk-audit.ts +66 -0
- package/server-managed/repository-risk.ts +265 -209
- package/server-managed/scan-downloads.ts +87 -0
- package/server-managed/sql.ts +1 -1
- package/server-managed/team-app.ts +38 -14
- package/server-managed/team-reports.ts +6 -11
- package/server-managed/upstream-cache.ts +16 -0
- package/out/chunk-CLPKNNC7.js +0 -51
- package/out/chunk-Q7ZSIEHP.js +0 -1
- package/out/chunk-RFZQQXSG.js +0 -17
- package/out/chunk-VQJCXGIY.js +0 -7
- package/out/chunk-WOTMRDM3.js +0 -226
- package/out/chunk-WZDTZE64.js +0 -1
- package/out/chunk-YP2537WX.js +0 -1
- package/out/chunk-YQRVLRDH.js +0 -1
- package/out/chunk-YVZH5SHP.js +0 -1
- package/out/chunk-ZBBOBQ43.js +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var{Buffer:ne}=globalThis,re=ne&&!ne.TYPED_ARRAY_SUPPORT;var Te=new Uint8Array(Uint16Array.of(258).buffer)[0]===2,oe=e=>e&&(re||`${e}`.includes("[native code]"));!re&&oe(()=>{})&&(oe=()=>!1);function _(e,t,n,r){let f="",o=t;for(let i=n-3;o<i;o+=4){let s=e[o],l=e[o+1],c=e[o+2],a=e[o+3];f+=r[s],f+=r[l],f+=r[c],f+=r[a]}for(;o<n;)f+=r[e[o++]];return f}function Ce(e,t){let n=e.length;for(let r=0;r<n;r++)t[r]=e.charCodeAt(r);return t}var et=null,tt=!1,nt=!1,v=new TextEncoder,L=new TextDecoder("utf-8",{ignoreBOM:!0}),ot=new TextDecoder("latin1",{ignoreBOM:!0});function rt(e,t,n,r){if(n-t>3e4){let f=[];for(let i=t;i<n;){let s=i+500,l=s>n?n:s;f.push(_(e,i,l,r)),i=l}let o=f.join("");return f.length=0,o}return _(e,t,n,r)}var P=globalThis.Buffer;function ie(e){if(!(e&&e instanceof Uint8Array))throw new TypeError("Expected an Uint8Array")}var fe="Input is not a string",B="Input is not well-formed Unicode";function j(e,t){switch(t){case"uint8":if(e.constructor!==Uint8Array)throw new Error("Unexpected");return e;case"arraybuffer":if(e.byteLength!==e.buffer.byteLength)throw new Error("Unexpected");return e.buffer;case"buffer":return e.length<=64?P.from(e):P.from(e.buffer,e.byteOffset,e.byteLength)}throw new TypeError("Unexpected format")}function st(e,t){switch(t){case"uint8":return e.length<=64||e.byteOffset!==0||e.byteLength!==e.buffer.byteLength?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);case"arraybuffer":return e.buffer.byteLength===e.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);case"buffer":if(e.constructor!==P)throw new Error("Unexpected");return e}throw new TypeError("Unexpected format")}var Me=L,Fe=L?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):null,{isWellFormed:le}=String.prototype;function Oe(e,t,n){if(t||e.length===n.length)return n;if(le){if(le.call(e))return n;throw new TypeError(B)}let r=0,f=n.length-3;for(;r<=f;){let o=n.indexOf(239,r);if(o===-1||o>f)break;if(r=o+1,n[o+1]===191&&n[o+2]===189){if(null)try{if(encodeURI(e)!==null)return n}catch{}else if(e===H(n))return n;throw new TypeError(B)}}return n}function ce(e,t=!1){if(typeof e!="string")throw new TypeError(fe);return e.length===0?new Uint8Array:v||!null?Oe(e,t,v.encode(e)):null(e,t)}function H(e,t=!1){return ie(e),e.byteLength===0?"":L||!null?t?Me.decode(e):Fe.decode(e):null(e,t)}var ht=(e,t="uint8")=>j(ce(e,!1),t),dt=(e,t="uint8")=>j(ce(e,!0),t),mt=e=>H(e,!1),pt=e=>H(e,!0);var W=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: ?(.*?))?\n?$/u,k=/^\*{15,}(?: (.*?))?\n?$/u,D=/^\*{3} (\d+)(?:,(\d+))? \*{4}\n?$/u,U=/^--- (\d+)(?:,(\d+))? ----\n?$/u,X=/^(\d+)(?:,(\d+))?([acd])(\d+)(?:,(\d+))?[ \t]*\r?\n?$/u;var Ae=/[ \t\n\v\f\r]/gu,Le=/[ \t\n\v\f\r]+/gu,ue=/[ \t\n\v\f\r]+$/u,ae=e=>e.replace(/[A-Z]/gu,t=>t.toLowerCase());function R({ignoreCase:e=!1,whitespace:t="none"}={}){let n=null;return t==="all"?n=r=>r.replace(Ae,""):t==="change"?n=r=>r.replace(ue,"").replace(Le," "):t==="trailing"&&(n=r=>r.replace(ue,"")),e?n?r=>ae(n(r)):ae:n}function N(e){let t=[];for(let n=0;n<e.length;){let r=e.indexOf(`
|
|
2
|
+
`,n),f=r<0?e.length:r+1;t.push(e.slice(n,f)),n=f}return t}var T=class extends Error{constructor(t,n){super(n===void 0?t:`${t} at line ${n+1}`),this.name="PatchError",this.line=n}},I=(e,t)=>t===0?Number(e):Number(e)-1,z=e=>e!==void 0&&e.startsWith("\\"),K=e=>e.replace(/\n$/u,"");function q(e){let t=N(e),n=[],r={old:null,new:null},f=!1;for(let o=0;o<t.length;){let i=t[o],s=he(i,f);if(f=i.startsWith("***************")?!1:i.startsWith("*** "),s){r=s.names??{...r,[s.slot]:s.name},o++;continue}let l=W.test(i)?"unified":k.test(i)?"context":X.test(i)?"normal":null;if(l===null){o++;continue}let c=[],a=_e[l];for(let u=a(t,o);u!==null&&(c.push(u.hunk),o=u.next,!(o>=t.length||he(t[o],!1)));u=a(t,o));n.push({old:r.old,new:r.new,format:l,hunks:c,blocks:Ue(c)}),r={old:null,new:null}}return n}function he(e,t){let n=/^diff --git (\S+) (\S+)\n?$/u.exec(e);if(n)return{names:{old:n[1],new:n[2]}};if(D.test(e)||U.test(e))return null;let r=/^(\*\*\* |--- |\+\+\+ )(.*?)(?:\t.*)?\n?$/u.exec(e);return r?r[1]==="--- "?{slot:t?"new":"old",name:r[2]}:{slot:r[1]==="*** "?"old":"new",name:r[2]}:null}function Ue(e){let t=[];for(let n of e){let r=n.oldStart,f=n.newStart,o=null,i=()=>{o&&(t.push(o),r=o.a1,f=o.b1,o=null)};for(let{tag:s,text:l}of n.lines){if(s===" "){i(),r++,f++;continue}s==="-"&&o?.insert.length&&i(),o??={a0:r,a1:r,b0:f,b1:f,remove:[],insert:[]},s==="-"?(o.a1++,o.remove.push(l)):(o.b1++,o.insert.push(l))}i()}return t}function Re(e,t){let n=W.exec(e[t]??"");if(!n)return null;let r=n[2]===void 0?1:Number(n[2]),f=n[4]===void 0?1:Number(n[4]),o={oldStart:I(n[1],r),newStart:I(n[3],f),label:n[5]||null,lines:[]},i=0,s=t+1,l=0;for(;l<r||i<f;s++){let c=e[s];if(c===void 0)throw new T("the patch ends inside a hunk",s);let a=c===`
|
|
3
|
+
`?" ":c[0];if(a!==" "&&a!=="-"&&a!=="+")throw new T(`a hunk line begins with ${JSON.stringify(a)}`,s);let u=c===`
|
|
4
|
+
`?c:c.slice(1);if(z(e[s+1])&&(u=K(u),s++),a!=="+"&&l++,a!=="-"&&i++,l>r||i>f)throw new T("a hunk has more lines than its header says",s);o.lines.push({tag:a,text:u})}return{hunk:o,next:s}}function ke(e,t){let n=X.exec(e[t]??"");if(!n)return null;let[,r,f,o,i,s]=n,l=o==="a"?0:Number(f??r)-Number(r)+1,c=o==="d"?0:Number(s??i)-Number(i)+1;if(l<0||c<0)throw new T("a change command counts backwards",t);let a={oldStart:o==="a"?Number(r):Number(r)-1,newStart:o==="d"?Number(i):Number(i)-1,label:null,lines:[]},u=t+1,h=(g,d,m)=>{for(let b=0;b<g;b++,u++){let E=e[u];if(E===void 0)throw new T("the patch ends inside a hunk",u);if(E[0]!==d)throw new T(`${JSON.stringify(d)} expected`,u);let p=E.slice(2);z(e[u+1])&&(p=K(p),u++),a.lines.push({tag:m,text:p})}};if(h(l,"<","-"),o==="c"){if(e[u]!==`---
|
|
5
|
+
`)throw new T("'---' expected",u);u++}return h(c,">","+"),{hunk:a,next:u}}function De(e,t){let n=k.exec(e[t]??"");if(!n)return null;let r=D.exec(e[t+1]??"");if(!r)throw new T("'*** ' range expected",t+1);let f=t+2,o=de(e,f,U,"-");f=o.next;let i=U.exec(e[f]??"");if(!i)throw new T("'--- ' range expected",f);let s=de(e,f+1,null,"+"),l=o.lines.length===0?s.lines.filter(h=>h.tag===" "):o.lines,c=s.lines.length===0?o.lines.filter(h=>h.tag===" "):s.lines,a=I(r[1],l.length),u=I(i[1],c.length);return{hunk:{oldStart:a,newStart:u,label:n[1]||null,lines:Ie(l,c)},next:s.next}}function de(e,t,n,r){let f=[],o=t;for(;o<e.length;o++){let i=e[o];if(n&&n.test(i)||k.test(i)||D.test(i)||!n&&U.test(i))break;if(z(i)){f[f.length-1].text=K(f.at(-1).text);continue}let s=i===`
|
|
6
|
+
`?" ":i[0];if(s!==" "&&s!=="!"&&s!=="-"&&s!=="+")break;f.push({tag:s===" "?" ":r,text:i===`
|
|
7
|
+
`?i:i.slice(2)})}return{lines:f,next:o}}function Ie(e,t){let n=[],r=0,f=0;for(;r<e.length||f<t.length;){if(e[r]?.tag===" "&&t[f]?.tag===" "){n.push(e[r]),r++,f++;continue}for(;r<e.length&&e[r].tag!==" ";)n.push(e[r]),r++;for(;f<t.length&&t[f].tag!==" ";)n.push(t[f]),f++;e[r]?.tag===" "&&t[f]===void 0?(n.push(e[r]),r++):t[f]?.tag===" "&&e[r]===void 0&&(n.push(t[f]),f++)}return n}var _e={unified:Re,context:De,normal:ke};var M=class extends Error{constructor(t){super(`the rendered diff does not say what the change set says (${t})`),this.name="FormatError"}};function we(e,t,n,r){if(n.length===0){if(r!=="")throw new M("there was nothing to print, and something was printed");return}let f;try{f=q(r)}catch(i){throw new M(`it does not read back (${i.message})`)}if(f.length!==1)throw new M(`${f.length} files read back, not one`);let o=f[0].blocks;if(o.length!==n.length)throw new M(`${o.length} blocks read back, not ${n.length}`);for(let[i,s]of o.entries()){let l=n[i];if(s.a0!==l.a0||s.a1!==l.a1||s.b0!==l.b0||s.b1!==l.b1)throw new M(`block ${i+1} reads back somewhere else`)}for(let i of f[0].hunks){let s=i.oldStart,l=i.newStart;for(let{tag:c,text:a}of i.lines){let u=c==="+"?t[l]:e[s];if(a!==u)throw new M(`a ${c==="+"?"added":c==="-"?"removed":"kept"} line is not the line it stands for`);c!=="+"&&s++,c!=="-"&&l++}}}function ve(e,t,n,r){let f=[],o=0;for(;o<e.length;){let i=o;for(;i+1<e.length&&e[i+1].a0-e[i].a1<=2*t;)i++;let s=e[o],l=e[i];f.push({blocks:e.slice(o,i+1),a0:Math.max(0,s.a0-t),a1:Math.min(n,l.a1+t),b0:Math.max(0,s.b0-t),b1:Math.min(r,l.b1+t)}),o=i+1}return f}var be=e=>(t,n,r,{context:f,label:o=null})=>{let i="";for(let s of ve(r,f,t.length,n.length))i+=e(t,n,s,o?o(s.a0):null);return we(t,n,r,i),i},Pe=`
|
|
8
|
+
\
|
|
9
|
+
`,F=(e,t)=>e+t+(t.endsWith(`
|
|
10
|
+
`)?"":Pe);function me(e,t){return t>e+1?`${e+1},${t}`:`${t>e?e+1:e}`}function ye(e,t,n){let r="";for(let{a0:f,a1:o,b0:i,b1:s}of n){let l=f===o?"a":i===s?"d":"c";r+=me(f,o)+l+me(i,s)+`
|
|
11
|
+
`;for(let c=f;c<o;c++)r+=F("< ",e[c]);l==="c"&&(r+=`---
|
|
12
|
+
`);for(let c=i;c<s;c++)r+=F("> ",t[c])}return we(e,t,n,r),r}function pe(e,t){return t<=e?`${e},0`:t===e+1?`${e+1}`:`${e+1},${t-e}`}var Ee=be((e,t,n,r)=>{let f=`@@ -${pe(n.a0,n.a1)} +${pe(n.b0,n.b1)} @@${r===null?"":" "+r}
|
|
13
|
+
`,o=n.a0,i=n.b0;for(let{a0:s,a1:l,b1:c}of n.blocks){for(;o<s;o++,i++)f+=F(" ",e[o]);for(;o<l;o++)f+=F("-",e[o]);for(;i<c;i++)f+=F("+",t[i])}for(;o<n.a1;o++,i++)f+=F(" ",e[o]);return f});function xe(e,t){return t<=e?`${e}`:t===e+1?`${e+1}`:`${e+1},${t}`}var $e=be((e,t,n,r)=>{let f=`***************${r===null?"":" "+r}
|
|
14
|
+
`;return f+=`*** ${xe(n.a0,n.a1)} ****
|
|
15
|
+
`,n.blocks.some(o=>o.a0<o.a1)&&(f+=ge(e,n.a0,n.a1,n.blocks,"a")),f+=`--- ${xe(n.b0,n.b1)} ----
|
|
16
|
+
`,n.blocks.some(o=>o.b0<o.b1)&&(f+=ge(t,n.b0,n.b1,n.blocks,"b")),f});function ge(e,t,n,r,f){let o=f+"1",i=f+"0",s=f==="a"?"b":"a",l="",c=t;for(let a of r){for(;c<a[i];c++)l+=F(" ",e[c]);let u=a[s+"0"]<a[s+"1"]?"! ":f==="a"?"- ":"+ ";for(;c<a[o];c++)l+=F(u,e[c])}for(;c<n;c++)l+=F(" ",e[c]);return l}function Be(e){let t=[];for(let n=0;;){let r=n;for(;n<e.length&&e[n];)n++;if(t.push(n>r),n===e.length)return t;n++}}function G(e,t,n){let r=t.length,f=Be(n),o=0,i=0,s=0,l=()=>{if(o===r||e[s]!==e[o])return!1;for(t[s++]=0,t[o++]=1,i++;o<r&&t[o];)o++;return!0},c=()=>{if(s===0||e[s-1]!==e[o-1])return!1;for(t[--s]=1,t[--o]=0,i--;s>0&&t[s-1];)s--;return!0};for(let a=0;a<r;a++){if(!t[a]){i++;continue}for(s=a,o=a;o<r&&t[o];o++);let u=-1;for(let h=-1;h!==o-s;){for(h=o-s;c(););for(u=f[i]?o:-1;l();)f[i]&&(u=o)}if(u!==-1)for(let h=o-u;h>0;h--)c();a=o-1}}function je(e){let t=1;for(let n=e;n!==0;n>>=2)t<<=1;return Math.max(256,t)}function Y(e,t,{ignoreCase:n=!1,whitespace:r="none",minimal:f=!1,slide:o=!0,horizon:i=1/0}={}){let s=R({ignoreCase:n,whitespace:r});if(s===null&&J(e,t,null))return[];let{A:l,B:c}=We(e,t,s),a=new Uint8Array(l.length),u=new Uint8Array(c.length),h=He(e,t,i);if(Xe(l,c,a,u,f,h),o){let{lo:d,hiA:m,hiB:b}=h;G(l.subarray(d,m),a.subarray(d,m),u.subarray(d,b)),G(c.subarray(d,b),u.subarray(d,b),a.subarray(d,m))}let g=qe(a,u);return V(e,t,g,s),g}function He(e,t,n){let r=Math.min(e.length,t.length),f=0;for(;f<r&&e[f]===t[f];)f++;let o=Math.max(0,f-n),i=0;for(;i<r-o&&e[e.length-1-i]===t[t.length-1-i];)i++;let s=Math.max(0,i-n);return{lo:o,hiA:e.length-s,hiB:t.length-s}}function J(e,t,n=null){if(e.length!==t.length)return!1;let r=n?(f,o)=>n(f)===n(o):(f,o)=>f===o;for(let f=0;f<e.length;f++)if(!r(e[f],t[f]))return!1;return!0}function We(e,t,n){let r=new Map,f=i=>{let s=n?n(i):i,l=r.get(s);return l===void 0&&(l=r.size,r.set(s,l)),l};return{A:Int32Array.from(e,f),B:Int32Array.from(t,f)}}function Xe(e,t,n,r,f,{lo:o,hiA:i,hiB:s}){let l=e.length+t.length+3,c={A:e,B:t,fd:new Int32Array(l),bd:new Int32Array(l),base:t.length+1,limit:je(e.length+t.length)},a=[{xoff:o,xlim:i,yoff:o,ylim:s,minimal:f}],u={xmid:0,ymid:0,loMinimal:!1,hiMinimal:!1};for(;a.length;){let{xoff:h,xlim:g,yoff:d,ylim:m,minimal:b}=a.pop();for(;h<g&&d<m&&e[h]===t[d];)h++,d++;for(;h<g&&d<m&&e[g-1]===t[m-1];)g--,m--;if(h===g){for(;d<m;d++)r[d]=1;continue}if(d===m){for(;h<g;h++)n[h]=1;continue}ze(c,h,g,d,m,b,u),a.push({xoff:u.xmid,xlim:g,yoff:u.ymid,ylim:m,minimal:u.hiMinimal}),a.push({xoff:h,xlim:u.xmid,yoff:d,ylim:u.ymid,minimal:u.loMinimal})}}function ze(e,t,n,r,f,o,i){let{A:s,B:l,fd:c,bd:a,base:u,limit:h}=e,g=n-r,d=t-f,m=n-f,b=t-r,E=m,p=m,w=b,y=b,ee=(b-m&1)!==0;c[u+b]=t,a[u+m]=n;for(let te=1;;te++){y>d?c[u+--y-1]=-1:++y,w<g?c[u+ ++w+1]=-1:--w;for(let x=w;x>=y;x-=2){let O=c[u+x+1],A=c[u+x-1],$=A<O?O:A+1,S=$-x;for(;$<n&&S<f&&s[$]===l[S];)$++,S++;if(c[u+x]=$,ee&&p<=x&&x<=E&&a[u+x]<=$){i.xmid=$,i.ymid=S,i.loMinimal=i.hiMinimal=!0;return}}p>d?a[u+--p-1]=2147483647:++p,E<g?a[u+ ++E+1]=2147483647:--E;for(let x=E;x>=p;x-=2){let O=a[u+x+1],A=a[u+x-1],$=A<O?A:O-1,S=$-x;for(;t<$&&r<S&&s[$-1]===l[S-1];)$--,S--;if(a[u+x]=$,!ee&&y<=x&&x<=w&&$<=c[u+x]){i.xmid=$,i.ymid=S,i.loMinimal=i.hiMinimal=!0;return}}if(!(o||te<h)){Ke(e,{xoff:t,xlim:n,yoff:r,ylim:f,fmin:y,fmax:w,bmin:p,bmax:E},i);return}}}function Ke(e,t,n){let{fd:r,bd:f,base:o}=e,{xoff:i,xlim:s,yoff:l,ylim:c,fmin:a,fmax:u,bmin:h,bmax:g}=t,d=0,m=-1;for(let p=u;p>=a;p-=2){let w=Math.min(r[o+p],s),y=w-p;c<y&&(w=c+p,y=c),m<w+y&&(m=w+y,d=w)}let b=0,E=2147483647;for(let p=g;p>=h;p-=2){let w=Math.max(i,f[o+p]),y=w-p;y<l&&(w=l+p,y=l),w+y<E&&(E=w+y,b=w)}s+c-E<m-(i+l)?(n.xmid=d,n.ymid=m-d,n.loMinimal=!0,n.hiMinimal=!1):(n.xmid=b,n.ymid=E-b,n.loMinimal=!1,n.hiMinimal=!0)}function qe(e,t){let n=[],r=t.length,f=e.length,o=0,i=0;for(;o<f||i<r;){if(o<f&&i<r&&!e[o]&&!t[i]){o++,i++;continue}let s=o,l=i;for(;o<f&&e[o];)o++;for(;i<r&&t[i];)i++;if(s===o&&l===i)throw new C("a kept line has no counterpart");n.push({a0:s,a1:o,b0:l,b1:i})}return n}function V(e,t,n,r=null){let f=r?(s,l)=>r(s)===r(l):(s,l)=>s===l,o=0,i=0;for(let{a0:s,a1:l,b0:c,b1:a}of n){if(s<o||c<i||l<s||a<c||l>e.length||a>t.length)throw new C("a block is out of order or out of range");if(s===l&&c===a)throw new C("a block changes nothing");if(s-o!==c-i)throw new C("the kept lines before a block differ in count");for(;o<s;o++,i++)if(!f(e[o],t[i]))throw new C(`kept line ${o+1} does not match`);o=l,i=a}if(e.length-o!==t.length-i)throw new C("the kept lines after the last block differ in count");for(;o<e.length;o++,i++)if(!f(e[o],t[i]))throw new C(`kept line ${o+1} does not match`)}var C=class extends Error{constructor(t){super(`the computed change set does not reconstruct the second file (${t})`),this.name="DiffError"}};var Z={unified:Ee,context:$e,normal:ye},Ne=`Files differ
|
|
17
|
+
`;function Ge(e,t,n){if(e===t)return"";let r=R(n);return r===null?Ne:J(N(e),N(t),r)?"":Ne}function Q(e,t){if(!(Number.isInteger(e)&&e>=0)&&e!==1/0)throw new RangeError(`${t} is a number of lines, not ${e}`);return e}function Ye(e,t,{slide:n=!0,horizon:r=3,...f}={}){let o=N(e),i=N(t);return Y(o,i,{...f,slide:n,horizon:Q(r,"horizon")}).map(({a0:s,a1:l,b0:c,b1:a})=>({a0:s,a1:l,b0:c,b1:a,remove:o.slice(s,l),insert:i.slice(c,a)}))}function Je(e,t,n,{format:r="unified",context:f=3,label:o=null,...i}={}){if(!Object.hasOwn(Z,r))throw new RangeError(`a change set prints as unified, context or normal, not ${r}`);let s=N(e),l=N(t);return V(s,l,n,R(i)),n.length===0?"":Z[r](s,l,n,{context:f,label:o})}function Ve(e,t,{format:n="unified",context:r=3,label:f=null,...o}={}){if(n==="brief")return Ge(e,t,o);let i=N(e),s=N(t),{slide:l=!0,horizon:c=0,...a}=o,u=Q(c,"horizon"),h=Y(i,s,{...a,slide:l,horizon:n==="normal"?u:Math.max(u,Q(r,"context"))});return h.length===0?"":Z[n](i,s,h,{context:r,label:f})}export{Te as a,Ce as b,et as c,tt as d,nt as e,v as f,L as g,ot as h,rt as i,ie as j,fe as k,j as l,st as m,ht as n,dt as o,mt as p,pt as q,W as r,k as s,X as t,q as u,M as v,C as w,Ye as x,Je as y,Ve as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as _e,h as Ee}from"./chunk-
|
|
1
|
+
import{b as _e,h as Ee}from"./chunk-AJ4GTATZ.js";import{a as Le}from"./chunk-R75XOKUP.js";import{a as Ce,d as Ie}from"./chunk-OD4LPN3H.js";import{A as Re,B as z,E as Se,b as G,c as ee,d as ye,j as L,m as C,p as I,s as xe,t as $e,w as ke,z as te}from"./chunk-GNXOKIGP.js";import{a as P,b as U,c as B}from"./chunk-C4Z6ZBXV.js";import{c as Q,f as N,g as ve}from"./chunk-2XUEZHIP.js";var tn=U(class extends B{constructor(e){if(super(e),e.type!==P.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(o=>o!=="")));for(let o in t)t[o]&&!this.nt?.has(o)&&this.st.add(o);return this.render(t)}let n=e.element.classList;for(let o of this.st)o in t||(n.remove(o),this.st.delete(o));for(let o in t){let i=!!t[o];i===this.st.has(o)||this.nt?.has(o)||(i?(n.add(o),this.st.add(o)):(n.remove(o),this.st.delete(o)))}return N}});var Me="important",ut=" !"+Me,ln=U(class extends B{constructor(e){if(super(e),e.type!==P.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,n)=>{let o=e[n];return o==null?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`},"")}update(e,[t]){let{style:n}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let o of this.ft)t[o]==null&&(this.ft.delete(o),o.includes("-")?n.removeProperty(o):n[o]=null);for(let o in t){let i=t[o];if(i!=null){this.ft.add(o);let r=typeof i=="string"&&i.endsWith(ut);o.includes("-")||r?n.setProperty(o,r?i.slice(0,-11):i,r?Me:""):n[o]=i}}return N}});function H(e){return e.id??String(e._id)}function ne(e){let t=I(e);return t!==""&&t!=="revalidation"}var K=[{value:"confirmed",label:"Confirmed",kinds:["confirmed","partial","revalidation"]},{value:"unreachable",label:"Unreachable",kinds:["unreachable"]},{value:"refuted",label:"Refuted",kinds:["refuted"]}];function Ae(e){return K.find(t=>t.value===e)?.kinds??null}var ft=["","exclude","only"];function oe(e,t){let n=Ae(e);return n?.includes("partial")?t==="only"?["partial"]:t==="exclude"?["confirmed"]:n:n}function V(e){if(e.confidence!==void 0)return e.confidence;if(e.critical===!0||e._source)return 10}var pt=e=>e.confidence!==void 0||e.critical===!0;function dt(e){return e.every(t=>t.every(n=>V(n)!==void 0))&&e.some(t=>t.some(pt))}function Te(e,t,n){return e.some(o=>{let i=["refuted","unreachable"].includes(n(o))?0:V(o);return i===void 0?t===0:i>=t})}function gt(e,t){let n=e.map(t).filter(r=>r.length>0);if(!n.some(r=>r.some(s=>V(s)!==void 0)))return 0;let o=r=>n.reduce((s,l)=>s+(l.some(a=>(V(a)??-1)>=r)?1:0),0),i;for(o(6)<=25?i=6:o(7)<=25?i=7:i=8;i>0&&o(i-1)===o(i);)i--;return i}function je(e,t){return dt(e)?t:0}function ht(e,t,n){let o=new Set(e.ruledOutIds??[]);for(let i of e)for(let r of i)["refuted","unreachable"].includes(n(r))&&o.add(H(r));for(let i of e){let r=t(i);if(r.length!==0&&r.some(s=>oe("confirmed","").includes(n(s)||(s._source&&!s._sourcePass?"revalidation":"")))){for(let s of i)if(o.add(H(s)),s.isApp&&Array.isArray(s.revalidateInputs))for(let l of s.revalidateInputs)l&&o.add(l)}}return o}function mt(e,t,n,o){let i=je(e,t),r=e.filter(l=>Te(l,i,o));if(r.length===0)return!1;let s=new Set(oe("confirmed",""));return e.some(l=>l.some(a=>s.has(o(a))))?r.every(l=>l.every(a=>n.has(H(a)))):!1}function hn(e,{tabs:t,kindOf:n,severityMode:o}){let i=e.map(t).filter(l=>l.length>0),r=ht(e,t,n);if(!mt(i,gt(e,t),r,n))return!1;let s=je(i,6);return i.every(l=>!Te(l,s,n)||!l.some(a=>C(a,o)!=="low")||l.every(a=>r.has(H(a))))}var S=!0;function jn(e,t=!1){S=e!==!1&&!t}function Fn(){return S}function A(e){return S?I(e):""}function Dn(e){return I(e)!==""}function On(e){return e.some(t=>(t.groups??[]).some(n=>n.some(ne)))}function bt(e){let t=A(e);return t&&t!=="revalidation"?t:null}function Nn(e){return A(e)==="revalidation"}var Ve=new Set(["refuted","unreachable"]);function Pn(e){return Ve.has(A(e))}function Un(e){return Ve.has(A(e))}function Bn(e){let t=new Set(e);return K.filter(n=>n.kinds.some(o=>t.has(o)))}function Z(e){return new RegExp(`(^|/)${e}/`,"u")}function Ke(e){return new RegExp(`^(?:.*/)?${e}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,"u")}var wt=Z("node_modules"),vt=Z("vendor"),M="node_modules",ae=Z(M),We=Ke(M);function yt(e){e!==M&&(M=e,ae=Z(e),We=Ke(e))}function Gn(e){yt(_e(e))}function Ze(){return M}function q(e){return ae.test(e)}var ie=new WeakSet;function zn(e){let t=!1;for(let n of e??[])for(let o of n.groups??[])for(let i of o){if(i.isApp!==!1)continue;let r=ie.has(i);"isUpstream"in i&&!r||(q(i.file)?(i.isUpstream!==!0&&(t=!0),i.isUpstream=!0,ie.add(i)):r&&(t=!0,delete i.isUpstream,ie.delete(i)))}return t}function Fe(e){let t=typeof e=="string"?e:"";return wt.test(t)||vt.test(t)||ae.test(t)}var xt=/^(.*(?:^|\/)node_modules\/(?:@[^/]+\/[^/]+|[^/]+))(?:\/|$)/u;function De(e){return xt.exec(typeof e=="string"?e:"")?.[1]??null}function Hn(e){return typeof e!="number"||!Number.isFinite(e)?null:Le(e)}function Vn(e){if(e.length<=1)return{prefix:"",stripped:[...e]};let t=e.map(s=>s.split("/")),n=Math.min(...t.map(s=>s.length)),o=0;for(let s=0;s<n-1&&t.every(l=>l[s]===t[0][s]);s++)o=s+1;if(o>0&&t[0][o-1].startsWith("@")&&o--,o>0&&t[0][o-1]==="node_modules"&&o--,o===0)return{prefix:"",stripped:[...e]};let i=`${t[0].slice(0,o).join("/")}/`,r=t.map(s=>s.slice(o).join("/"));return{prefix:i,stripped:r}}function $t(e){return e.match(We)?.[1]??e}function Kn(e){let t=S?[bt(e),e.revalidateVerdict,e.revalidateRecommendation]:[];return[e.file,e.title,e.description,e.impact,e.reproduction,Ft(e),e.recommendation,e.confidenceReason,...t,e.discoveredIn,e.repo?.github].filter(Boolean).join(`
|
|
2
2
|
`).toLowerCase()}function Wn(e){return[typeof e?.category=="string"?e.category.trim():"",xe(e,S)].filter(Boolean).join(" \xB7 ")}function Zn(e){if(e.length===0)return"";let t=e[0];for(let n=1;n<e.length;n++){for(;t&&!e[n].startsWith(t);)t=t.slice(0,-1);if(!t)return""}return t}function qn(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}function qe(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 kt=/^(?:@[\w.-]+\/)?[\w.-]+@[^/\s@]+$/u;function Rt(e){return kt.test(e||"")}function Oe(e){if(e==null||typeof e=="string")return{id:e??"",prefix:""};let t=Se(e);return{id:typeof e.github=="string"?e.github:"",prefix:t?`${t}/`:""}}function St(e,t,n){if(Rt(e))return null;let o=Oe(t);if(o.id)return`https://github.com/${o.id}/blob/HEAD/${o.prefix}${$t(e)}`;if(q(e))return null;let i=Oe(n),r=qe(i.id);return r?`${r}/blob/HEAD/${i.prefix}${e}`:null}function Yn(e,t){let n=e?.file??"",o=W(e,t);return o?Q`<a href="${_t(o)}" target="_blank" rel="noopener">${n}</a>`:n}function _t(e){return e.replace(/#L\d+(?:-L?\d+)?$/u,"")}function W(e,t){if(!e)return null;if(z(e.location))return e.location;let n=St(e.file,e.repo,t);if(!n)return null;let o=parseInt(e.line,10);return Number.isFinite(o)?`${n}#L${o}`:n}var Et=/^https?:\/\/(?:www\.)?github\.com\/([^/\s]+\/[^/\s]+)\/(?:blob|tree|blame)\/[^/\s]+\/(\S+)$/u,Lt=/#L(\d+)(?:-L?(\d+))?$/u;function Jn(e){let t=typeof e=="string"?Et.exec(e):null;if(!t)return"";let n=t[2],o=Lt.exec(n);if(!o)return`${t[1]}/${n}`;n=n.slice(0,o.index);let i=o[2]?`${o[1]}-${o[2]}`:o[1];return`${t[1]}/${n}:${i}`}var Ct=/^(?:\s+\S|[-*+] |\d+[.)] |>|#{1,6} |\||`{3}|~{3})/u;function Ye(e){return e.split(/(\n{2,})/u).map(t=>{if(/^\n+$/u.test(t))return t;let n=t.split(`
|
|
3
3
|
`);return n.some(o=>Ct.test(o))?t:n.map(o=>o.trim()).filter(Boolean).join(" ")}).join("")}function Ne(e,t,n){let o=t?/^\n*/u.exec(e)[0]:"",i=e.slice(o.length),r=n?/\n*$/u.exec(i)[0]:"";return o+Ye(i.slice(0,i.length-r.length))+r}function Xn(e){if(!e)return e;let t=G(e);if(t.length===0)return Ye(e);let n=[],o=0;for(let[i,r]of t)i>o&&n.push(Ne(e.slice(o,i),o>0,!0)),n.push(e.slice(i,r)),o=r;return o<e.length&&n.push(Ne(e.slice(o),!0,!1)),n.join("")}var Pe=/^( *)(`{3,}|~{3,})(.*)$/u,It=/^[a-z0-9+#._-]{1,20}$/u;function Je(e,t){let n=0;for(;n<t&&e[n]===" ";)n++;return e.slice(n)}function Mt(e){let t=e.split(`
|
|
4
4
|
`),n=Pe.exec(t[0]),o=(n?.[2]??"```").slice(0,3),i=(n?.[3]??"").trim().split(/\s+/u)[0].toLowerCase(),s=!!(t.length>1?Pe.exec(t.at(-1)):null)?.[2].startsWith(o),l=n?.[1].length??0,a=t.slice(1,s?-1:void 0);return{lang:It.test(i)?i:"",code:(l>0?a.map(u=>Je(u,l)):a).join(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as b,d as x,j as y}from"./chunk-EDKLBQQN.js";function d(){let t=new(x?Uint32Array:Int32Array)(4096);for(let r=0;r<256;r++){let f=r;for(let o=0;o<8;o++)f=f&1?3988292384^f>>>1:f>>>1;t[r]=f}for(let r=0;r<256;r++){let f=t[r];for(let o=256+r;o<t.length;o+=256)f=t[o]=f>>>8^t[f&255]}return t}var e=d(),[a,u,A,g,h,w,U,H,I,O,j,v,E,L,W,k]=Array.from({length:16},(t,r)=>e.subarray(r*256,r*256+256));function F(t){y(t);let r=-1,f=0,o=t.length;if(b&&o>1024){let n=4-(t.byteOffset&3)&3;for(;f<n;f++)r=a[(r^t[f])&255]^r>>>8;let m=o-f>>>2,s=new(x?Uint32Array:Int32Array)(t.buffer,t.byteOffset+f,m),c=0;for(let p=m-3;c<p;c+=4){let T=s[c]^r,_=s[c+1],l=s[c+2],i=s[c+3];r=e[3840+(T&255)]^e[3584+(T>>>8&255)]^e[3328+(T>>>16&255)]^e[3072+(T>>>24)]^e[2816+(_&255)]^e[2560+(_>>>8&255)]^e[2304+(_>>>16&255)]^e[2048+(_>>>24)]^e[1792+(l&255)]^e[1536+(l>>>8&255)]^e[1280+(l>>>16&255)]^e[1024+(l>>>24)]^e[768+(i&255)]^e[512+(i>>>8&255)]^e[256+(i>>>16&255)]^e[i>>>24]}f+=c*4}else for(let n=o-15;f<n;f+=16)r=k[(t[f]^r)&255]^W[(t[f+1]^r>>>8)&255]^L[(t[f+2]^r>>>16)&255]^E[t[f+3]^r>>>24]^v[t[f+4]]^j[t[f+5]]^O[t[f+6]]^I[t[f+7]]^H[t[f+8]]^U[t[f+9]]^w[t[f+10]]^h[t[f+11]]^g[t[f+12]]^A[t[f+13]]^u[t[f+14]]^a[t[f+15]];for(let n=f;n<o;n++)r=a[(r^t[n])&255]^r>>>8;return~r>>>0}export{F as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as a,d as b}from"./chunk-QWDWTBM7.js";import"./chunk-CH4UN6WK.js";import"./chunk-JCIIBLKR.js";import"./chunk-K3X5EJBQ.js";import"./chunk-CVVJAXVY.js";import"./chunk-VIHGO77Y.js";import"./chunk-SWTLADW5.js";import"./chunk-2ABLKCOY.js";import"./chunk-ZESLQCTF.js";import"./chunk-UYAXVRVL.js";import"./chunk-NRPC74AM.js";import"./chunk-LPCTJYNA.js";import"./chunk-W4J3MGLB.js";import"./chunk-GJ4IUCNS.js";import"./chunk-PNHBZGDD.js";import"./chunk-F47DXCEV.js";import"./chunk-R5O6FAW4.js";import"./chunk-CMQA4DM6.js";import"./chunk-AJ4GTATZ.js";import"./chunk-R75XOKUP.js";import"./chunk-OD4LPN3H.js";import"./chunk-4XCDFGDP.js";import"./chunk-3BZ7JERB.js";import"./chunk-TZ5KB2Y5.js";import"./chunk-XYFXXB2G.js";import"./chunk-DIJJNTRH.js";import"./chunk-QYWKC557.js";import"./chunk-GNXOKIGP.js";import"./chunk-C4Z6ZBXV.js";import"./chunk-2XUEZHIP.js";import"./chunk-TUII34K2.js";import"./chunk-V5O7M2YT.js";import"./chunk-OOJM4CTU.js";export{a as revealFinding,b as revealFindingInReport};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{p as E,w as x,x as b,y as A}from"./chunk-EDKLBQQN.js";import{j as w}from"./chunk-ZESLQCTF.js";function K(t,n){return t?t.base===""?`${t.other}${n}`:n.startsWith(t.base)?n.slice(t.base.length):null:n}var W=(t,n)=>`${"../".repeat(t.base.split("/").length-1)}${n}`;function ct({root:t,paths:n},e,r){if(!t||e===".")return e;for(let s of r){let l=n.get(`${e}/${s}`);if(l?.endsWith(`/${s}`))return l.slice(0,-s.length-1)}let o=K(t,`${e}/`);return o===null?W(t,e):o.slice(0,-1)||"."}function ft(t,n){if(!t)return{prefix:n,from:null,to:null};let e=n.startsWith(t.other)?n:"";return{prefix:e,from:`./${t.base}${e.slice(t.other.length)}`,to:`./${e||t.other}`}}function ht(...t){let n=new Set;for(let r of t){let o=w(r);for(let[s,l]of Object.entries(r?.bundle?.reason??{}))Array.isArray(l)&&l.some(i=>o.has(i))&&n.add(s)}let e=r=>t.some(o=>{if(o?.kind!=="stasis")return!1;let s=w(o),l=o?.bundle?.reason?.[r];return new Set(Array.isArray(l)?l.filter(i=>s.has(i)):[]).size<s.size});return[...n].some(e)?[...n].toSorted().map(r=>({id:`reason:${r}`,label:r})):[]}function F(t,n=""){let e=w(t);if(!n||t?.kind!=="stasis")return e;let r=t?.bundle?.reason?.[n.replace(/^reason:/u,"")],o=new Set(Array.isArray(r)?r:[]);return new Map([...e].filter(([s])=>o.has(s)))}function P(t,n,e,r){return JSON.stringify([t,n,e,r])}function gt(t,n=""){let e=new Map;if(t?.kind!=="stasis"||!t.bundle)return e;let r=n?w(t):null,o=n?F(t,n):null;for(let[s,l]of t.bundle.imports)for(let[i,c]of l)for(let[p,u]of c){let f=typeof u=="string"?[[null,u]]:u;for(let[a,h]of f){if(o&&!o.has(i)&&(r.has(i)||!o.has(h)))continue;let g=P(i,p,s,a);e.set(g,{key:g,parent:i,specifier:p,conditions:s,platform:a,target:h})}}return e}var S=(t,{lo:n,start:e},r)=>t[e+(r-n)/2];function N(t,n,{low:e,high:r},o,s){return t===-n||t-1<e||t!==n&&t+1<=r&&S(o,s,t-1)<S(o,s,t+1)?t+1:t-1}function j(t,n,e,{first:r,n:o,m:s,d:l,...i}){t.a.fill(1,0,r).fill(1,o),t.b.fill(1,0,r).fill(1,s);let c=o,p=s;for(let u=l;u>0;u--){let f=c-p,a=N(f,u,i,n,e[u]),h=S(n,e[u],a);for(let g=a>f?h:h+1;g<c;g++)t.a[g]=t.b[g-f]=1;c=h,p=c-a}for(let u=r;u<c;u++)t.a[u]=t.b[u]=1}function O(t,n,e){let r=0,o=n.length,s=t.length,l=2*(s+o);for(;r<s&&r<o&&t[r]===n[r];)r++;for(;s>r&&o>r&&t[s-1]===n[o-1];)s--,o--;let i={high:s-r,low:r-o},c=[r],p=[{lo:1,start:0}];for(let u=0;u<=i.high-i.low;u++){let f=p[u],a=Math.min(u,i.high),h=Math.max(-u,i.low+(i.low+u&1));p.push({lo:h,start:c.length});for(let g=h;g<=a;g+=2){let m=N(g,u,i,c,f),y=S(c,f,m),d=m>g?y:y+1,B=d;for(;d<s&&d-g<o&&t[d]===n[d-g];)d++;if(l+=2+d-B,c.push(d),d>=s&&d-g>=o)return j(e,c,p,{first:r,n:s,m:o,d:u,...i}),l}}throw new Error("no edit script between two lines")}var z=/[\p{L}\p{N}_$]+|\s+|[^\p{L}\p{N}_$\s]/gu,G=2e3,V=800,I=.6;function M(t,n){if(t.length>G)return null;let e=t.match(z)??[];return e.length>V?null:{line:t,tokens:e,words:e.map(r=>(n.has(r)||n.set(r,n.size),n.get(r)))}}function _({tokens:t,line:n},e){let r=[];for(let o=0,s=0;s<t.length;o+=t[s++].length){if(e[s])continue;let l=r.at(-1);l&&/^\s*$/u.test(n.slice(l[1],o))?l[1]=o+t[s].length:r.push([o,o+t[s].length])}return r}var L=(t,n)=>t.reduce((e,[r,o])=>e+o-r,0)/Math.max(1,n.length);function C(t,n){let e={a:t.words.map(()=>0),b:n.words.map(()=>0)},r=O(t.words,n.words,e),o={a:_(t,e.a),b:_(n,e.b)};return{ranges:o,share:e.a.includes(1)?Math.min(L(o.a,t.line),L(o.b,n.line)):1,steps:r}}function wt(t,n){if(t===n)return{a:[],b:[]};let e=new Map,r=M(t,e),o=M(n,e);if(r===null||o===null)return null;let{ranges:s,share:l}=C(r,o);return l<=I?s:null}var R=200,J=5e6,U=6,Y=60,q=3;function Q(t){let n=new Map;for(let e of t?.tokens??[])n.set(e,(n.get(e)??0)+1);return n}function Z(t,n){let e=new Map,r=[t,n].map(f=>f.map(a=>M(a,e))),o=r.map(f=>f.map(Q)),s=0,l=(f,a,h)=>{let g=0;for(let[m,y]of f)if(s+=q,(g+=m.length*Math.max(0,y-(a.get(m)??0)))>I*h.length)return 1/0;return g/Math.max(1,h.length)},i=(f,a)=>r[0][f]===null||r[1][a]===null?1/0:Math.min(l(o[0][f],o[1][a],t[f]),l(o[1][a],o[0][f],n[a])),c=(f,a)=>{if(s+=Y,i(f,a)===1/0)return 1/0;let{share:h,steps:g}=C(r[0][f],r[1][a]);return s+=g,h<=I?h:1/0},p=new Float64Array(t.length*n.length).fill(Number.NaN);return{share:(f,a)=>{let h=f*n.length+a;return Number.isNaN(p[h])&&(p[h]=t[f]===n[a]?0:c(f,a)),p[h]},floor:i,spent:()=>s}}function tt(t,n,{share:e,spent:r}){let o=Array.from({length:t+1},()=>new Float64Array(n+1)),s=(i,c)=>e(i,c)===1/0?-1/0:1e3-e(i,c)+o[i][c];for(let i=0;i<t;i++)for(let c=0;c<n;c++)if(o[i+1][c+1]=Math.max(o[i][c+1],o[i+1][c],s(i,c)),r()>J)return null;let l=[];for(let i=t,c=n;i>0&&c>0;)o[i][c]===o[i][c-1]?c--:o[i][c]===o[i-1][c]?i--:l.push([--i,--c]);return l.toReversed()}function nt(t,n,{share:e,floor:r}){let o=[];for(let s=0,l=0;s<t&&l<n;s++){let i=null,c=1/0,p=Array.from({length:Math.min(n,l+U)-l},(u,f)=>[l+f,r(s,l+f)]);for(let[u,f]of p.toSorted((a,h)=>a[1]-h[1]||a[0]-h[0])){if(f>c)break;(e(s,u)<c||e(s,u)===c&&u<i)&&([i,c]=[u,e(s,u)])}i!==null&&(o.push([s,i]),l=i+1)}return o}function bt(t,n){if(t.length>R||n.length>R)return[];let e=Z(t,n);return tt(t.length,n.length,e)??nt(t.length,n.length,e)}function T(t){if(t===null)return"";let n=t.type==="symlink"?t.target:t.data;if(typeof n=="string")return n.includes("\0")?void 0:n;if(!n.includes(0))try{return E(n)}catch{return}}var et=new Set(["none","all","change","trailing"]);function H({horizon:t=1/0,whitespace:n="none",ignoreCase:e=!1}={}){if(t!==1/0&&!(Number.isSafeInteger(t)&&t>=0))throw new RangeError(`horizon must be a whole number or Infinity, not ${t}`);if(!et.has(n))throw new RangeError(`whitespace must be 'none', 'all', 'change' or 'trailing', not ${n}`);if(typeof e!="boolean")throw new TypeError(`ignoreCase must be a boolean, not ${typeof e}`);return{horizon:t,whitespace:n,ignoreCase:e}}var $=t=>t.reduce((n,{a0:e,a1:r,b0:o,b1:s})=>n+r-e+s-o,0),k=t=>t===""?[]:t.split(/(?<=\n)/u),rt=t=>({...t,ignoreCase:!1,whitespace:"none"}),ot=t=>(t.whitespace??"none")!=="none"||!!t.ignoreCase;function st(t,n,e,r,o){let s=k(t),l=k(n),i=(f,a,h,g)=>({a0:f,a1:a,b0:h,b1:g,remove:s.slice(f,a),insert:l.slice(h,g)}),c=o.flatMap(({a0:f,a1:a,b0:h,b1:g})=>f===a||h===g?[i(f,a,h,g)]:b(s.slice(f,a).join(""),l.slice(h,g).join(""),e).map(m=>i(f+m.a0,f+m.a1,h+m.b0,h+m.b1))),p=f=>{try{return A(t,n,f,{format:"normal",ignoreCase:e.ignoreCase,whitespace:e.whitespace}),!0}catch(a){if(a instanceof x)return!1;throw a}},u=$(c)<$(r)&&p(c)?c:r;return $(u)<$(o)?u:o}function it(t,n,e){let r=b(t,n,e);return ot(e)?st(t,n,e,r,b(t,n,rt(e))):r}function It(t,n,e){let r=T(t),o=T(n);if(r===void 0||o===void 0)return{binary:!0,blocks:[],insertions:null,deletions:null};let s=r===o?[]:it(r,o,e),l=(i,c)=>s.reduce((p,u)=>p+u[c]-u[i],0);return{binary:!1,blocks:s,insertions:l("b0","b1"),deletions:l("a0","a1")}}function D(t,n,e,r){let{whitespace:o,ignoreCase:s}=H(r);try{return A(t,n,e,{format:"normal",whitespace:o,ignoreCase:s}),!0}catch(l){if(l instanceof x)return!1;throw l}}var X=/[ \t\n\v\f\r]/u,v=t=>{let n=t.split(`
|
|
2
|
+
`);return n.at(-1)===""&&n.pop(),n};function lt(t,n){for(let e=0,r=0;;e++,r++){let o="",s="";for(;e<t.length&&X.test(t[e]);)o+=t[e++];for(;r<n.length&&X.test(n[r]);)s+=n[r++];if(o!==s&&new Set(o+s).size>1)return!0;if(e>=t.length||r>=n.length)return!1}}function _t(t,n,e){try{if(!D(t,n,e,{whitespace:"all"}))return!0}catch{return!0}let r=v(t),o=v(n),s=0,l=0;for(let i=0;i<=e.length;i++){let c=i<e.length?e[i].a0:r.length;for(;s<c;s++,l++)if(r[s]!==o[l]&<(r[s],o[l]))return!0;i<e.length&&({a1:s,b1:l}=e[i])}return!1}function Rt(t,n,{extension:e=!0}={}){let r=t.split("/"),o=n.split("/"),s=0;for(;s<r.length-1&&s<o.length-1&&r[s]===o[s];)s++;let l=0;for(;l<r.length-s-1&&l<o.length-s-1&&r.at(-1-l)===o.at(-1-l);)l++;let i={head:s?`${r.slice(0,s).join("/")}/`:"",from:r.slice(s,r.length-l).join("/"),to:o.slice(s,o.length-l).join("/"),tail:l?`/${r.slice(-l).join("/")}`:""},c=i.from.lastIndexOf(".");return e&&!i.from.includes("/")&&!i.to.includes("/")&&c>0&&i.to.lastIndexOf(".")===c&&i.from.slice(0,c)===i.to.slice(0,c)?{...i,head:i.head+i.from.slice(0,c),from:i.from.slice(c),to:i.to.slice(c)}:i}export{wt as a,bt as b,T as c,H as d,It as e,_t as f,Rt as g,K as h,W as i,ct as j,ft as k,ht as l,F as m,P as n,gt as o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function k(n,c,t){let r=new Map;for(let e of n.onlyBase)r.set(e.pkg,{base:e.bytes,other:null});for(let e of n.onlyOther)r.set(e.pkg,{base:null,other:e.bytes});for(let e of n.changed)r.set(e.pkg,{base:e.baseBytes,other:e.otherBytes});for(let e of n.unchanged??[])r.set(e.pkg,{base:e.bytes,other:e.bytes});let u=(e,s)=>[...e.get(s)??[]].toSorted(h),d=new Set([...n.onlyBase,...n.onlyOther,...n.changed].map(e=>e.pkg));for(let e of new Set([...c.keys(),...t.keys()]))g(u(c,e),u(t,e))||d.add(e);let f=[],i=[],o=[];for(let e of d){let s=r.get(e)??{base:null,other:null},p=u(t,e),a=u(c,e),b=s.base!==null||a.length>0,m=s.other!==null||p.length>0;b&&!m?o.push({pkg:e,bytes:s.base,versions:a}):m&&!b?f.push({pkg:e,bytes:s.other,versions:p}):i.push({pkg:e,baseBytes:s.base,otherBytes:s.other,delta:s.base!==null&&s.other!==null?s.other-s.base:null,baseVersions:a,otherVersions:p,direction:a.length>0&&p.length>0&&!g(a,p)?S(a,p):null})}let l=(e,s)=>e.pkg.localeCompare(s.pkg);return{removed:o.toSorted(l),added:f.toSorted(l),changed:i.toSorted(l)}}function y(n){let t=String(n).trim().split("+",1)[0],r=t.indexOf("-");return r===-1?{core:t,pre:""}:{core:t.slice(0,r),pre:t.slice(r+1)}}function h(n,c){if(n===c)return 0;let t=y(n),r=y(c),u=t.core.split("."),d=r.core.split(".");for(let o=0;o<Math.max(u.length,d.length);o++){let l=Number(u[o]??0),e=Number(d[o]??0);if(Number.isNaN(l)||Number.isNaN(e))return n<c?-1:1;if(l!==e)return l<e?-1:1}if(t.pre===r.pre)return 0;if(!t.pre)return 1;if(!r.pre)return-1;let f=t.pre.split("."),i=r.pre.split(".");for(let o=0;o<Math.max(f.length,i.length);o++){let l=f[o],e=i[o];if(l===void 0)return-1;if(e===void 0)return 1;if(l===e)continue;let s=/^\d+$/u.test(l),p=/^\d+$/u.test(e);return s&&p?Number(l)<Number(e)?-1:1:s!==p?s?-1:1:l<e?-1:1}return 0}function g(n,c){if(n.length!==c.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==c[t])return!1;return!0}function S(n,c){let t=n.filter(o=>!c.includes(o)).toSorted(h),r=c.filter(o=>!n.includes(o)).toSorted(h),u=n.filter(o=>c.includes(o)).toSorted(h),[d,f]=t.length>0&&r.length>0?[t,r]:t.length>0?[t,u]:[u,r];if(d.length===0||f.length===0)return"changed";let i=(o,l)=>h(o.at(-1),l[0])<0;return i(d,f)?"up":i(f,d)?"down":"changed"}function N(n,c){let t=[],r=[],u=[],d=new Set([...n.keys(),...c.keys()]);for(let i of d){let o=n.get(i),l=c.get(i);if(o&&l){let e=[...o].toSorted(h),s=[...l].toSorted(h);if(g(e,s))continue;t.push({pkg:i,baseVersions:e,otherVersions:s,direction:S(e,s)})}else o?u.push({pkg:i,versions:[...o].toSorted(h)}):r.push({pkg:i,versions:[...l].toSorted(h)})}let f=(i,o)=>i.pkg.localeCompare(o.pkg);return t.sort(f),r.sort(f),u.sort(f),{updated:t,added:r,removed:u,totals:{baseDeps:n.size,otherDeps:c.size}}}export{k as a,h as b,N as c};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{a}from"./chunk-TUII34K2.js";var v="deepview-objstore.v1.put",y="deepview-objstore.v1.delete",h="deepview-objstore.v1.fetch",w="deepview-objstore.v1.fetch-rest",I="deepview-objstore.v1.put-rest",j="deepview-objstore.v1.delete-rest";function l(e){return e==null?"":String(e)}function g(e){return e??""}function x(e,n){return a([v,e.workspaceTag,e.resourceTag,l(e.prevVersion),g(e.prevIncarnation),e.contentHash,String(e.expectedLength),n].join(`
|
|
2
|
+
`))}function O(e,n){return a([y,e.workspaceTag,e.resourceTag,l(e.prevVersion),g(e.prevIncarnation),n].join(`
|
|
3
|
+
`))}function P(e,n,r){return a([h,e,n,r].join(`
|
|
4
|
+
`))}async function i(e,n){return new Uint8Array(await crypto.subtle.sign({name:"Ed25519"},e,n)).toBase64({alphabet:"base64url",omitPadding:!0})}function B(e,n,r){return i(e,x(n,r))}function D(e,n,r){return i(e,O(n,r))}function R(e,n,r,o){return i(e,P(n,r,o))}function A(e,n,r){return a([w,e,n,String(r)].join(`
|
|
5
|
+
`))}function _(e,n,r,o){return i(e,A(n,r,o))}function T(e,n){return a([I,e.workspaceTag,e.resourceTag,l(e.prevVersion),g(e.prevIncarnation),e.contentHash,String(e.expectedLength),String(n)].join(`
|
|
6
|
+
`))}function U(e,n,r){return i(e,T(n,r))}function N(e,n){return a([j,e.workspaceTag,e.resourceTag,l(e.prevVersion),g(e.prevIncarnation),String(n)].join(`
|
|
7
|
+
`))}function L(e,n,r){return i(e,N(n,r))}async function H(e){let n=await crypto.subtle.digest("SHA-256",e);return new Uint8Array(n).toBase64({alphabet:"base64url",omitPadding:!0})}var d="/api/config";var J="http://127.0.0.1:3123/";function m(e){if(typeof e!="string"||!e.trim())return null;try{let n=new URL(e);return!["http:","https:"].includes(n.protocol)||n.username||n.password||n.search||n.hash?null:(n.pathname=n.pathname.replace(/\/+$/u,"")+"/",n.href)}catch{return null}}var b="deepview.sync.serverInfo",p="deepview.sync.standaloneProbe";function $(){try{return localStorage.getItem(p)==="1"}catch{return!1}}function X(){try{localStorage.setItem(p,"1")}catch{}}function f(e){return e==="managed+e2e"||e==="e2e+managed"}function q(e,n){return(e==="managed"||f(e))&&/^\/(?:team|manage|npm|my)(?:\/|$)/u.test(n)}function Q(e,n=null){return n&&(f(e)||e===n)?n:e==="managed"||e==="managed+e2e"?"managed":"e2e"}function W(e,n){return e&&f(e.mode)&&n.mode==="e2e"?{...e,githubNewIssueLabels:n.githubNewIssueLabels??"",...n.deepviewScanServer?{deepviewScanServer:n.deepviewScanServer}:{}}:n}function S(e){if(e==null||typeof e!="object")return null;let n=e.mode;if(n!=="e2e"&&n!=="managed"&&n!=="managed+e2e"&&n!=="e2e+managed")return null;let r=null,o=e.managed;if(o!=null&&typeof o=="object"){let u=o.loginPath,c=o.cookieName;typeof u=="string"&&typeof c=="string"&&(r={loginPath:u,cookieName:c},o.allowShare===!0&&(r.allowShare=!0))}let t=n==="managed"?null:m(e.deepviewScanServer),s=e.githubNewIssueLabels;return{mode:n,managed:r,...t?{deepviewScanServer:t}:{},...typeof s=="string"&&s.length<=4096?{githubNewIssueLabels:s}:{}}}async function Z(){try{let e=await fetch(d,{credentials:"same-origin",cache:"no-store",headers:{accept:"application/json"}});if(e.status===404)return"standalone";if(!e.ok)return null;let n=await e.json(),r=S(n);return r&&n.session!==void 0?{...r,session:n.session}:r}catch{return null}}async function ee(e,n=3e3){let r;try{return await Promise.race([e,new Promise(o=>{r=setTimeout(()=>o(null),n)})])}catch{return null}finally{clearTimeout(r)}}function ne(){try{let e=localStorage.getItem(b);if(e==null)return null;let n=S(JSON.parse(e));return n?{mode:n.mode,managed:n.managed}:null}catch{return null}}function re(e){try{localStorage.setItem(b,JSON.stringify({mode:e.mode,managed:e.managed})),localStorage.removeItem(p)}catch{}}var E="deepview.objstore-presence.";function M(e){return E+e}function k(e){try{let n=localStorage.getItem(M(e));if(!n)return null;let r=JSON.parse(n);return!r||typeof r!="object"?null:{names:r.names&&typeof r.names=="object"?r.names:{},bundles:r.bundles&&typeof r.bundles=="object"?r.bundles:{},bundleNames:r.bundleNames&&typeof r.bundleNames=="object"?r.bundleNames:{},baselines:C(r.baselines,r.localVersions)}}catch{return null}}function C(e,n){let r={};if(n&&typeof n=="object")for(let[o,t]of Object.entries(n))Number.isSafeInteger(t)&&t>=0&&(r[o]={version:t,incarnation:null,synced:!0,hash:null});if(e&&typeof e=="object")for(let[o,t]of Object.entries(e))!t||typeof t!="object"||!Number.isSafeInteger(t.version)||t.version<0||t.incarnation!=null&&typeof t.incarnation!="string"||(r[o]={version:t.version,incarnation:t.incarnation??null,synced:t.synced===!0,hash:typeof t.hash=="string"?t.hash:null});return r}function oe(e,n,r,o){let t=k(e),s=Object.entries((n==="bundle"?t?.bundles:t?.names)??{}).find(([,c])=>c===r)?.[0],u=t?.baselines?.[s];return{synced:s!==void 0&&(n==="bundle"||u?.synced===!0&&u.hash===o),cached:!0}}export{B as a,D as b,R as c,_ as d,U as e,L as f,H as g,J as h,m as i,$ as j,X as k,f as l,q as m,Q as n,W as o,S as p,Z as q,ee as r,ne as s,re as t,M as u,k as v,oe as w};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as E}from"./chunk-KEX2ATEW.js";import{gb as y,h as a,hb as o,ib as x,jb as m,kb as C,lb as $,mb as w,nb as k,ob as S}from"./chunk-
|
|
1
|
+
import{a as E}from"./chunk-KEX2ATEW.js";import{gb as y,h as a,hb as o,ib as x,jb as m,kb as C,lb as $,mb as w,nb as k,ob as S}from"./chunk-CH4UN6WK.js";import"./chunk-JCIIBLKR.js";import{a as v}from"./chunk-2KBF5TZ7.js";import{a as f,b as _}from"./chunk-K3X5EJBQ.js";import{g as c,h as b}from"./chunk-CVVJAXVY.js";import"./chunk-VIHGO77Y.js";import"./chunk-SWTLADW5.js";import"./chunk-2ABLKCOY.js";import"./chunk-ZESLQCTF.js";import"./chunk-UYAXVRVL.js";import"./chunk-NRPC74AM.js";import"./chunk-LPCTJYNA.js";import"./chunk-W4J3MGLB.js";import"./chunk-GJ4IUCNS.js";import"./chunk-PNHBZGDD.js";import"./chunk-F47DXCEV.js";import"./chunk-R5O6FAW4.js";import"./chunk-CMQA4DM6.js";import"./chunk-AJ4GTATZ.js";import"./chunk-R75XOKUP.js";import"./chunk-OD4LPN3H.js";import"./chunk-4XCDFGDP.js";import"./chunk-3BZ7JERB.js";import"./chunk-TZ5KB2Y5.js";import"./chunk-XYFXXB2G.js";import{a as l}from"./chunk-DIJJNTRH.js";import"./chunk-QYWKC557.js";import"./chunk-GNXOKIGP.js";import"./chunk-C4Z6ZBXV.js";import{a as d,c as i,g as s}from"./chunk-2XUEZHIP.js";import"./chunk-TUII34K2.js";import{s as g,t as p}from"./chunk-V5O7M2YT.js";import"./chunk-OOJM4CTU.js";var T=`dialog{width:min(94vw,800px);max-width:800px;max-height:calc(100dvh - 4rem);margin-block:2rem;padding:0}dialog[open]{display:flex;flex-direction:column}.discussion-header{display:flex;align-items:start;gap:1rem;padding:1rem 1.25rem;border-bottom:1px solid var(--border)}.discussion-heading{flex:1;min-width:0}header h3{display:flex;align-items:center;gap:.5rem;margin:0;line-height:1.5}.comment-count{padding:.05rem .4rem;border-radius:1rem;background:rgb(from var(--muted) r g b / .12);color:var(--muted);font-size:.72rem;font-weight:400}.discussion-finding{margin-top:.4rem;font-size:.85rem;overflow-wrap:anywhere}.loc{margin-top:.25rem;color:var(--muted)}.header-actions{display:flex;flex:none;align-items:center;gap:.7rem}.header-actions button{display:inline-flex;flex:none;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:0;background:transparent;color:var(--muted);line-height:0;& svg{display:block;width:1rem;height:1rem}&:hover:not(:disabled){color:var(--text)}&:disabled{opacity:.5}}.comment-action{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:.2rem;border:1px solid transparent;border-radius:var(--ui-radius, 4px);background:transparent;color:var(--muted);cursor:default;& svg{width:.9rem;height:.9rem}&:hover:not(:disabled),&[aria-pressed=true]{border-color:var(--border);background:rgb(from var(--muted) r g b / .08);color:var(--text)}&.danger:hover:not(:disabled),&[aria-expanded=true]{color:var(--critical, #f87171)}&:disabled{opacity:.5}}button:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:var(--ui-radius, 3px)}.discussion-log{min-height:0;max-height:50dvh;overflow-y:auto;overscroll-behavior:contain;padding:.5rem;scrollbar-gutter:stable}.comments{display:flex;flex-direction:column;gap:.15rem;list-style:none}.comment{padding:.6rem .75rem;border-radius:var(--ui-radius, 6px);font-size:.84rem}.comment:hover{background:rgb(from var(--muted) r g b / .035)}.comment.editing{background:rgb(from var(--accent) r g b / .08);box-shadow:inset 0 0 0 1px rgb(from var(--accent) r g b / .2)}.delete-confirm{display:flex;align-items:center;justify-content:end;flex-wrap:wrap;gap:.5rem;margin-top:.6rem;color:var(--muted);font-size:.75rem;& button{padding:.25rem .55rem;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:transparent;color:var(--text);font:inherit;&:hover:not(:disabled){background:rgb(from var(--muted) r g b / .08)}&.danger{color:var(--critical, #f87171)}&:disabled{opacity:.5}}}.empty-discussion{padding:2.5rem 0;color:var(--muted);text-align:center;font-size:.85rem}.composer{padding:1rem 1.25rem;border-top:1px solid var(--border)}.composer-label{display:flex;align-items:center;gap:.45rem;margin-bottom:.6rem;font-size:.78rem}.composer-label strong{font-weight:600}textarea{min-height:4.5rem;max-height:25dvh;font-size:.84rem}.nwd-actions{border:0;padding-top:0;margin-top:.65rem}.shortcut{color:var(--muted);font-size:.7rem}.error{padding:.65rem 1.25rem;color:var(--danger, #c44);font-size:.8rem}.read-only{padding:1rem 1.25rem;border-top:1px solid var(--border);color:var(--muted);font-size:.8rem}@media(width<=480px){.discussion-header,.composer{padding:.8rem}.discussion-log{padding-inline:.3rem}.comment{padding-inline:.5rem}.shortcut{max-width:8rem}}
|
|
2
2
|
`;var h=class extends c{static styles=[...c.styles,d(E),d(v),d(T)];static properties={finding:{attribute:!1},changed:{attribute:!1},_comments:{state:!0},_value:{state:!0},_editing:{state:!0},_busy:{state:!0},_error:{state:!0},_deleting:{state:!0}};constructor(){super(),this.finding=null,this.changed=null,this._comments=[],this._value="",this._editing=null,this._busy=!1,this._error="",this._deleting=null}connectedCallback(){super.connectedCallback(),document.addEventListener("managed-comments-reset",this._close)}disconnectedCallback(){this._unsubscribeComments?.(),this._unsubscribeComments=null,document.removeEventListener("managed-comments-reset",this._close),super.disconnectedCallback()}beforeOpen(){this._current=C(this.finding?._managedReportId),this._comments=o(this.finding),this._unsubscribeComments?.(),this._unsubscribeComments=y(this.finding.id,this._commentsChanged),this._refresh({scroll:!0})}_commentsChanged=()=>{if(!this.isConnected)return;if(!this._current()){this._close();return}let e=this.renderRoot.querySelector(".discussion-log"),t=e&&e.scrollHeight-e.scrollTop-e.clientHeight<32;this._comments=o(this.finding),t&&this._scrollToLatest()};_close=()=>this._finish(null);_scrollToLatest=async()=>{await this.updateComplete;let e=this.renderRoot.querySelector(".discussion-log");e&&(e.scrollTop=e.scrollHeight)};_refresh=async({scroll:e=!1}={})=>{if(!this._current()){this._close();return}let t=this.renderRoot.querySelector(".discussion-log"),r=t&&t.scrollHeight-t.scrollTop-t.clientHeight<32;this._busy=!0,this._error="";let n=await $(this.finding._managedReportId);if(this.isConnected){if(!this._current()){this._close();return}if(this._busy=!1,!n){this._error="Could not load comments. Please retry.";return}this._comments=o(this.finding),this.changed?.(),(e||r)&&this._scrollToLatest()}};_edit(e){this._deleting=null,this._editing=e,this._value=e.body,this._error="",this.updateComplete.then(()=>this.renderRoot.querySelector("textarea")?.focus())}_cancelEdit=()=>{this._editing=null,this._value="",this._error=""};_delete=async e=>{if(this._busy||!this._current())return;this._busy=!0,this._error="";let t=await k(this.finding,e);if(!this.isConnected){t===204&&this._current()&&this.changed?.();return}if(!this._current()){this._close();return}if(this._busy=!1,this._deleting=null,t===409){await this._refresh(),this.isConnected&&(this._error="This comment changed elsewhere. Review the latest version before deleting it.");return}if(t!==204){this._error=t===403||t===404?"This comment is unavailable or you no longer have permission to delete it.":"Could not delete the comment. Please retry.";return}this._comments=o(this.finding),this._editing?.id===e.id&&this._cancelEdit(),this.changed?.()};_save=async()=>{let e=this._value.trim();if(this._busy||!e||e.length>1e4||!this._current())return;this._busy=!0,this._error="";let t=await w(this.finding,e,this._editing);if(!this.isConnected)return;if(!this._current()){this._close();return}if(this._busy=!1,t.status===409){if(await this._refresh(),!this.isConnected)return;this._editing=this._comments.find(n=>n.id===this._editing?.id)??this._editing,this._error="This comment changed elsewhere. Your draft is kept. Review the latest version above before saving again.";return}if(!t.comment){this._error=t.status===403||t.status===404?"You no longer have permission to save this comment.":"Could not save the comment. Your draft is kept; please retry.";return}let r=this._editing!=null;this._comments=o(this.finding),this._cancelEdit(),this.changed?.(),r||await this._scrollToLatest(),await this.updateComplete,this.renderRoot.querySelector("textarea")?.focus()};_keydown=e=>{e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this._save())};_commentActions(e,t){let r=t&&e.authorId===a.managedSession?.id,n=m(e);return!r&&!n?s:i`${r?i`<button type="button" class="comment-action" aria-label="Edit comment" aria-pressed="${this._editing?.id===e.id}" ?disabled="${this._busy}" @click="${()=>this._edit(e)}">${l(g)}</button>`:s} ${n?i`<button type="button" class="comment-action danger" aria-label="Delete comment" aria-expanded="${this._deleting===e.id}" ?disabled="${this._busy}" @click="${()=>{this._deleting=this._deleting===e.id?null:e.id}}">${l(p)}</button>`:s}`}_deleteConfirmation(e){return this._deleting!==e.id||!m(e)?s:i`<div class="delete-confirm" role="group" aria-label="Confirm comment deletion"><span>Delete this comment?</span> <button type="button" ?disabled="${this._busy}" @click="${()=>{this._deleting=null}}">Cancel</button> <button type="button" class="danger" ?disabled="${this._busy}" @click="${()=>this._delete(e)}">Delete</button></div>`}render(){let e=x();return i`<dialog aria-labelledby="comments-title" @close="${this._onClose}"><header class="discussion-header"><div class="discussion-heading"><h3 id="comments-title">Discussion <span class="comment-count">${this._comments.length}</span></h3>${this.finding?.title?i`<p class="discussion-finding">${this.finding.title}</p>`:s}<p class="loc">${this.finding?.file??""}</p></div><div class="header-actions"><button type="button" class="refresh" aria-label="Refresh discussion" ?disabled="${this._busy}" @click="${()=>this._refresh()}"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8M21 3v5h-5"/></svg></button> <button type="button" class="close" aria-label="Close discussion" @click="${this._close}"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="m6 6 12 12M6 18 18 6"/></svg></button></div></header><section class="discussion-log" role="log" aria-label="Discussion" aria-relevant="additions text" aria-busy="${this._busy}"><ol class="comments">${this._comments.map(t=>i`<li class="${`comment${this._editing?.id===t.id?" editing":""}`}">${_(t,S(t.body),this._commentActions(t,e))} ${this._deleteConfirmation(t)}</li>`)}</ol>${this._comments.length===0?i`<p class="empty-discussion">${this._busy?"Loading discussion\u2026":e?"No comments yet. Start the discussion below.":"No comments yet."}</p>`:s}</section>${this._error?i`<p class="error" role="alert">${this._error}</p>`:s} ${e?i`<form class="composer" @submit="${t=>{t.preventDefault(),this._save()}}"><label class="composer-label" for="comment-body">${f(a.managedSession.id,a.managedSession.login)} ${this._editing?"Edit your comment":i`Reply as <strong>${a.managedSession.login}</strong>`}</label> <textarea id="comment-body" rows="3" maxlength="${1e4}" .value="${this._value}" placeholder="Write a comment…" aria-describedby="comment-shortcut" ?disabled="${this._busy}" @input="${t=>{this._value=t.target.value}}" @keydown="${this._keydown}"></textarea><footer class="nwd-actions"><span id="comment-shortcut" class="shortcut">Ctrl / ⌘ + Enter to send</span><span class="nwd-spacer"></span> ${this._editing?i`<button type="button" class="quiet" ?disabled="${this._busy}" @click="${this._cancelEdit}">Cancel edit</button>`:s} <button type="submit" class="primary" ?disabled="${this._busy||!this._value.trim()}">${this._editing?"Save changes":"Comment"}</button></footer></form>`:i`<p class="read-only">You have read-only access to this discussion.</p>`}</dialog>`}};customElements.define("managed-comments-dialog",h);function G(u,e){return b("managed-comments-dialog",{finding:u,changed:e})}export{G as openManagedCommentsDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(n,{packageDir:e=null}={}){if(e){if(e!=="."){let o=e.match(/(?:^|\/)node_modules\/(@[^/]+\/[^/]+|[^/]+)$/u);return o&&o[1]!==".pnpm"?o[1]:e}}else{let o=/\.sol$/iu.test(n)?/(?:^|\/)(?:node_modules\/(@[^/]+\/[^/]+|[^/]+)|dependencies\/(@[^/]+\/[^/]+|[^/]+)\/)/gu:/(?:^|\/)node_modules\/(@[^/]+\/[^/]+|[^/]+)/gu,t;for(;(t=o.exec(n))!==null;){let u=t[1]??t[2];if(u!==".pnpm")return u}}return"__own__"}function s(n,e=null){return r(n,{packageDir:e})==="__own__"||!!e&&!/(?:^|\/)(?:node_modules|dependencies|vendor)(?:\/|$)/u.test(e)}function l(n,e=null){let o=[],t=[];for(let u of n)(s(u,e?.get(u))?o:t).push(u);return[...o,...t]}function d(n){return n==="__own__"?"Own source":typeof n!="string"?n:n.match(/^(?:.*\/)?vendor\/(.+)$/u)?.[1]??n}export{r as a,s as b,l as c,d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{$c as D,Fa as N,Ja as H,Kc as R,Mc as v,Nc as U,db as I,eb as p,fb as B,h as o,i as f,od as G,pa as q,q as A,r as C,s as _,vd as P,x as $}from"./chunk-CH4UN6WK.js";import{b as M}from"./chunk-CVVJAXVY.js";import{u as x}from"./chunk-SWTLADW5.js";import{c as b}from"./chunk-AJ4GTATZ.js";async function V(e,{openManagedReport:n,readTeam:t=G,isCurrent:i=()=>!0}){let c=o.managedSession,r=()=>i()&&f()&&o.managedSession?.id===c?.id&&o.managedSession?.role===c?.role,u=o.managedTeams;if(!r())return null;async function m(a,s){return!r()||(o.currentManagedTeam!==a.id||o.currentManagedReport!==s)&&!await n(a,s)||!r()||o.currentManagedTeam!==a.id||o.currentManagedReport!==s?null:p(e.id)}if(e.teamId){let a=u.find(s=>s.id===e.teamId);return!a||e.reportId&&!a.reports.some(s=>s.id===e.reportId)?null:m(a,e.reportId??null)}let w=u.flatMap(a=>a.reports.map(s=>({team:a,report:s}))),h=new Set,d=new Map;async function k(a){for(let{team:s,report:l}of a){if(!r())return null;if(h.has(`${s.id}:${l.id}`))continue;h.add(`${s.id}:${l.id}`),d.has(s.id)||d.set(s.id,await t(s.id));let y=d.get(s.id)?.find(S=>S.id===l.id);if(!r())return null;if(y==null)continue;let j=await x(JSON.stringify(y.data),l.filename);if(!r())return null;if(j?.findings.some(S=>S.id===e.id))return m(s,l.id)}return null}if(e.report){let a=await Promise.all(w.map(({report:l})=>b("report",l.filename))),s=await k(w.filter((l,y)=>a[y]===e.report));if(s||!r())return s}if(e.workspace){let a=await Promise.all(u.map(l=>b("workspace",`managed-team:${l.id}`))),s=u[a.indexOf(e.workspace)];if(s){let l=await m(s,null);if(l||!r())return l}}if(!r())return null;let O=u.find(a=>a.id===o.currentManagedTeam);if(O&&(o.currentManagedReport==null||O.reports.some(a=>a.id===o.currentManagedReport))){let a=p(e.id);if(a)return a}return k(w)}async function J(e,n,t,{openReport:i,openManagedReport:c}){if(f()){let r=o.managedTeams.find(u=>u.id===o.currentManagedTeam);if(!t||!r?.reports.some(u=>u.id===t)||(o.currentManagedReport!==t||o.currentWorkspace)&&!await c(r,t)||!f()||o.currentManagedTeam!==r.id||o.currentManagedReport!==t||o.currentWorkspace)return null}else if(t||((o.currentFile!==n||o.currentWorkspace)&&await i(n),f()||o.currentFile!==n||o.currentWorkspace))return null;return p(e)}async function K(e,n){if(f())return V(e,n);let{openReport:t,openWorkspace:i}=n,[c,r]=await Promise.all([C(e.report),A(e.workspace)]);async function u(d){let k=I(d,r?.id);return(o.currentFile!==d||o.currentWorkspace||o.currentReportWorkspace!==k)&&await t(d,void 0,{workspaceId:k}),p(e.id)}if(c){let d=await u(c);if(d)return d}if(r){o.currentWorkspace!==r.id&&await i(r.id);let d=p(e.id);if(d)return d}let m=p(e.id);if(m)return m;let w=o.reports.map(d=>d.fileName).filter(Boolean),h=await _(e.id,{skip:w});return h?await u(h):null}var z="100% 0px",Q=new WeakMap,g=new WeakMap,L=[],E=!1,X=new WeakMap;function Z(e){let n=X.get(e);if(n===void 0){let t=getComputedStyle(e).overflowY;n=t==="auto"||t==="scroll"||t==="overlay",X.set(e,n)}return n}function W(e){let n=e.parentNode;for(;n;){if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){n=n.host??null;continue}if(n.nodeType!==Node.ELEMENT_NODE||n===document.documentElement)return null;if(Z(n))return n;n=n.parentNode}return null}function ee(e){for(let n of e)g.get(n.target)?.cb(n.isIntersecting)}function ne(e){let n=e??document,t=Q.get(n);return t||(t=new IntersectionObserver(ee,{root:e,rootMargin:z,threshold:0}),Q.set(n,t)),t}function Se(e,n){let t=g.get(e);t?.io&&t.io.unobserve(e),g.set(e,{cb:n,io:null}),L.push(e),E||(E=!0,queueMicrotask(te))}function te(){E=!1;let e=L;L=[];for(let n of e){let t=g.get(n);!t||t.io||(t.io=ne(W(n)),t.io.observe(n))}}function be(e){let n=g.get(e);n&&(n.io?.unobserve(e),g.delete(e))}var oe=1600,F="link-target",ie="Couldn't find that finding in any of your reports. Import the report it came from, then open the link again.",T=null,re=3,ae=150,se=5;function ce(e){T!==null&&clearTimeout(T);for(let n of document.querySelectorAll(`.${F}`))n.classList.remove(F);e.classList.add(F),T=setTimeout(()=>{e.classList.remove(F),T=null},oe)}function ue(e){return new Promise(n=>{let t=null,i=0,c=0,r=()=>{let u=Math.round(e.getBoundingClientRect().top);i=u===t?i+1:0,t=u,i>=re||++c>=ae?n():requestAnimationFrame(r)};requestAnimationFrame(r)})}function de(e){let n=0,t=window.innerHeight,i=W(e);if(i){let c=i.getBoundingClientRect();n=Math.max(n,c.top),t=Math.min(t,c.bottom)}return{top:n,bottom:t}}function le(e){let n=e.getBoundingClientRect();if(n.height===0)return!1;let{top:t,bottom:i}=de(e);if(i<=t)return!1;let c=(t+i)/2;return n.top>=t&&n.bottom<=i||n.top<=c&&n.bottom>=c}async function fe(e){e.scrollIntoView({block:"center",behavior:"smooth"});for(let n=0;n<se;n++){if(await ue(e),!e.isConnected||le(e))return;e.scrollIntoView({block:"center",behavior:"instant"})}}async function pe(e){let n=CSS.escape(e);if(o.viewMode==="table"){let t=M.querySelector("finding-table");if(t){try{await t.updateComplete}catch{}for(let i of t.shadowRoot?.querySelectorAll("finding-row")??[])if(i.group&&q(i.group)===e)return i}}if(o.viewMode==="kanban"){let t=M.querySelector(`.kanban-card[data-gid="${n}"]`);if(t)return t}return M.querySelector(`finding-card[data-gid="${n}"]`)??M.querySelector(`[data-gid="${n}"]`)}async function Y(e,n,t=()=>!0){let i=B(e.group,n),c=H(i);if(c&&N(c)&&queueMicrotask($),D(),await P({revealSelection:!0}),!t())return{ok:!1};let r=await pe(i);return t()?r?(typeof r.ensureRendered=="function"&&await r.ensureRendered(),await fe(r),t()?(ce(r),{ok:!0}):{ok:!1}):{ok:!0}:{ok:!1}}async function $e(e,{openManagedReport:n=v,isCurrent:t=()=>!0}={}){if(!e?.id)return{ok:!1,reason:"This link is missing a finding id."};let i=await K(e,{openReport:R,openWorkspace:U,openManagedReport:n,isCurrent:t});return t()?i?await Y(i,e.id,t):{ok:!1,reason:f()?"Couldn't find that finding in the team reports you can access.":ie}:{ok:!1}}async function qe(e,n,t=null){if(!e||!n)return{ok:!1,reason:"Missing finding id or report name."};let i=await J(e,n,t,{openReport:R,openManagedReport:v});return i?await Y(i,e):{ok:!1,reason:t?`Could not open that finding in "${n}". Open the team and try again.`:`Couldn't find that finding in "${n}". It may have been re-imported since this links file was written.`}}export{Se as a,be as b,$e as c,qe as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var A=new Set(["overview","graph","treemap","compare","advisories","issues","code","search","terminal"]);var Z=/^\d+$/u;function D(e){for(let l=0;l<e.length;l++){let a=e.codePointAt(l);if(a<32||a===127)return!0}return!1}var L=512;function G(e){return typeof e=="string"&&e.length>0&&e.length<=L&&!D(e)}function E(e){return G(e)&&!Z.test(e)}var F=/^(?=.{1,214}$)(?:@[\w.-]+\/[\w-]|[\dA-Za-z])[\w.-]*$/u,j=/^(?=.{1,256}$)[\dA-Za-z][\w.+-]*$/u,X=/^@[\da-z~-][\w.~-]*$/u;function $(e){return typeof e=="string"&&F.test(e)}function m(e){return typeof e=="string"&&j.test(e)}function J(e){if(typeof e!="string")return null;let l=e.trim().toLowerCase(),a=l.startsWith("@")?l:`@${l}`;return a.length<=214&&X.test(a)?a:null}var h=new Set(["code","diff"]),ne=e=>h.has(e)?"code":"overview",x=e=>h.has(e)?{compareMode:"code"}:{},y=e=>h.has(e)?"/code":"",M=Object.freeze({manage:"/manage","manage-bundles":"/manage/bundle","manage-scans":"/manage/scans","manage-reports":"/manage/report","manage-repos":"/manage/repositories","manage-repo-risk":"/manage/repositories/risk","admin-users":"/manage/users","manage-teams":"/manage/team","manage-import":"/manage/import","manage-links":"/manage/links","manage-deduplication":"/manage/deduplication","manage-history":"/manage/history"});function O(e){if(!E(e)||e==="."||e==="..")return null;try{return`/finding/${encodeURIComponent(e)}`}catch{return null}}function ae(e){if(!e)return null;if(e.view==="home")return"/";if(e.view==="reviews")return"/my/reviews";if(e.view==="npm")return H(e);if(e.view==="workspace-reports"||e.view==="workspace-bundles")return/^[A-Za-z0-9_-]+$/u.test(e.teamSlug??"")?`/team/${e.teamSlug}/${e.view.slice(10)}`:null;if(e.view==="bundles"){if(!/^[A-Za-z0-9_-]+$/u.test(e.bundleSlug??"")||[e.teamSlug,e.compareSlug].some(u=>u!=null&&!/^[A-Za-z0-9_-]+$/u.test(u)))return null;let n=e.bundleTab??"overview";if(!A.has(n))return null;let r=e.teamSlug?`/team/${e.teamSlug}`:"/manage",o=n==="code"&&g(e.file)?`/${e.file}`:"",s=o&&g(e.line)?`#L${e.line}${g(e.endLine)&&e.endLine>e.line?`-L${e.endLine}`:""}`:"",t=n==="compare"&&e.compareSlug!=null?`/${e.compareSlug}${y(e.compareMode)}`:"";return`${r}/bundle/${e.bundleSlug}${n==="overview"?"":`/${n}`}${o}${t}${s}`}if(Object.hasOwn(M,e.view)){let n=M[e.view];return e.view==="manage-deduplication"&&e.linkId?`${n}?report=${encodeURIComponent(e.linkId)}`:e.view==="manage-bundles"&&Number.isSafeInteger(e.createRepoId)&&e.createRepoId>0?`${n}?createRepo=${e.createRepoId}`:e.view==="manage-scans"&&e.scanMode==="link"?`${n}?mode=link`:e.view==="manage-scans"&&e.bundleId?`${n}?bundle=${encodeURIComponent(e.bundleId)}${e.scanMode==="dependencies"?"&mode=dependencies":""}`:e.view==="manage-history"&&e.actor?`${n}?actor=${encodeURIComponent(e.actor)}`:n}if(!["findings","files"].includes(e.view)||!e.teamSlug||[e.teamSlug,e.reportSlug].some(n=>n!=null&&!/^[A-Za-z0-9_-]+$/u.test(n)))return null;let l=`/team/${encodeURIComponent(e.teamSlug)}`,a=e.reportSlug?`/report/${encodeURIComponent(e.reportSlug)}`:"";if(e.finding){let n=O(e.finding.id);return e.view==="findings"&&n?`${l}${a}${n}`:null}return`${l}${a}${e.view==="files"?"/files":""}`}var B=new Set(["overview","code","search","compare","review","treemap"]);function H(e){if(e.packageName==null)return"/npm";let l=e.bundleTab??"overview";if(!$(e.packageName)||e.packageSpec!=null&&!m(e.packageSpec)||!B.has(l)||e.compareSpec!=null&&!m(e.compareSpec))return null;if(l==="review"){if(e.reviewPackage!=null&&!$(e.reviewPackage)||e.reviewSpec!=null&&!m(e.reviewSpec))return null;let o=e.reviewPackage==null?"":`/${e.reviewPackage}${e.reviewSpec==null?"":`@${e.reviewSpec}`}`;return`/npm/${e.packageName}${e.packageSpec==null?"":`@${e.packageSpec}`}/review${o}`}let a=l==="code"&&g(e.file)?`/${e.file}`:"",n=a&&g(e.line)?`#L${e.line}${g(e.endLine)&&e.endLine>e.line?`-L${e.endLine}`:""}`:"",r=l==="compare"&&e.compareSpec!=null?`/${e.compareSpec}${y(e.compareMode)}`:"";return`/npm/${e.packageName}${e.packageSpec==null?"":`@${e.packageSpec}`}${l==="overview"?"":`/${l}`}${a}${r}${n}`}function K(e,l){let a=/^\/npm\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?\/review(?:\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?)?$/u.exec(e);if(a){if(!$(a[1])||a[2]!=null&&!m(a[2])||a[3]!=null&&!$(a[3])||a[4]!=null&&!m(a[4]))return null;let s=a[3]&&/^\d+\.\d+\.\d+(?:[-+].*)?$/u.test(a[3])&&a[4]==null;return{view:"npm",packageName:a[1],packageSpec:a[2]??null,bundleTab:"review",...a[3]?{reviewPackage:s?a[1]:a[3],reviewSpec:s?a[3]:a[4]??null}:{}}}let n=/^\/npm(?:\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?(?:\/(code|search|compare|treemap)(?:\/([^/]+)(?:\/([a-z]+))?)?)?)?$/u.exec(e);if(!n)return;if(n[1]==null)return{view:"npm"};if(!$(n[1])||n[2]!=null&&!m(n[2]))return null;let r={view:"npm",packageName:n[1],packageSpec:n[2]??null,bundleTab:n[3]??"overview"};if(n[4]==null)return r;if(r.bundleTab==="compare")return m(n[4])&&(n[5]==null||h.has(n[5]))?{...r,compareSpec:n[4],...x(n[5])}:null;if(r.bundleTab!=="code")return null;let o=Number(n[4]);return!n[5]&&/^[1-9]\d*$/u.test(n[4])&&Number.isSafeInteger(o)?{...r,file:o,...T(l)}:null}function g(e){return Number.isSafeInteger(e)&&e>0}function T(e){let l=/^#L([1-9]\d*)(?:-L([1-9]\d*))?$/u.exec(e),[a,n]=l?[Number(l[1]),Number(l[2]??l[1])]:[];return!g(a)||!g(n)?{}:a===n?{line:a}:{line:Math.min(a,n),endLine:Math.max(a,n)}}function le(e){let l=e.pathname.replace(/\/$/u,"")||"/";if(l==="/"||l==="/index.html")return{view:"home"};if(l==="/my/reviews")return{view:"reviews"};let a=Object.keys(M).find(t=>M[t]===l);if(a){let t=Number(e.searchParams.get("createRepo"));return{view:a,...a==="manage-deduplication"&&e.searchParams.get("report")?{linkId:e.searchParams.get("report")}:{},...a==="manage-bundles"&&Number.isSafeInteger(t)&&t>0?{createRepoId:t}:{},...a==="manage-history"&&e.searchParams.get("actor")?{actor:e.searchParams.get("actor")}:{},...a==="manage-scans"?e.searchParams.get("mode")==="link"?{scanMode:"link"}:e.searchParams.get("bundle")?{bundleId:e.searchParams.get("bundle"),...e.searchParams.get("mode")==="dependencies"?{scanMode:"dependencies"}:{}}:{}:{}}}let n=/^(?:\/team\/([A-Za-z0-9_-]+)|\/manage)\/bundle\/([A-Za-z0-9_-]+)(?:\/([a-z]+)(?:\/([A-Za-z0-9_-]+)(?:\/([a-z]+))?)?)?$/u.exec(l);if(n){let t=n[3]??"overview";if(!A.has(t))return null;let u={view:"bundles",teamSlug:n[1]??null,bundleSlug:n[2],bundleTab:t};if(n[4]==null)return u;if(t==="compare")return n[5]==null||h.has(n[5])?{...u,compareSlug:n[4],...x(n[5])}:null;let c=Number(n[4]);return t!=="code"||n[5]||!/^[1-9]\d*$/u.test(n[4])||!Number.isSafeInteger(c)?null:{...u,file:c,...T(e.hash)}}let r=K(l,e.hash);if(r!==void 0)return r;let o=/^\/team\/([A-Za-z0-9_-]+)\/(reports|bundles)$/u.exec(l);if(o)return{view:`workspace-${o[2]}`,teamSlug:o[1]};let s=/^\/team\/([^/]+)(?:\/report\/([^/]+))?(?:\/(files)|\/finding\/([^/]+))?$/u.exec(l);if(!s)return null;try{let t=decodeURIComponent(s[1]),u=s[2]?decodeURIComponent(s[2]):null;if([t,u].some(p=>p!=null&&!/^[A-Za-z0-9_-]+$/u.test(p))||s[4]?.length>L*9)return null;let c=s[4]?decodeURIComponent(s[4]):null;return c!=null&&!O(c)?null:{view:s[3]?"files":"findings",teamSlug:t,reportSlug:u,...c==null?{}:{finding:{id:c}}}}catch{return null}}function R(e,l,a=[]){if(e.view==="workspace-reports"||e.view==="workspace-bundles"){let i=l.filter(f=>f.slug===e.teamSlug);return i.length===1?{view:e.view,teamId:i[0].id}:null}if(e.view==="bundles"){let{teamSlug:i,bundleSlug:f,compareSlug:I,compareMode:v,...k}=e,b=i==null?[]:l.filter(S=>S.slug===i);if(i!=null&&b.length!==1)return null;let w=b[0],N=i==null?a:l.flatMap(S=>S.bundles??[]),d=S=>new Set(N.filter(_=>_.slug===S).map(_=>_.id)),z=d(f),P=(w?.bundles??a).find(S=>S.slug===f);if(!f||!P||z.size!==1)return null;let C=I==null?null:d(I),U=C?.size===1?{compareId:[...C][0],...x(v)}:{};return{...k,teamId:w?.id??null,bundleId:P.id,...U}}if(!["findings","files"].includes(e.view))return e;let{teamSlug:n,reportSlug:r,...o}=e,s=l.filter(i=>i.slug===n);if(!n||s.length!==1)return null;let t=s[0];if(r==null)return{...o,teamId:t.id,reportId:null};let u=l.flatMap(i=>i.reports??[]).filter(i=>i.slug===r),c=new Set(u.map(i=>i.id)),p=(t.reports??[]).find(i=>i.slug===r);return p&&c.size===1?{...o,teamId:t.id,reportId:p.id}:null}function ie(e,l,a=[]){if(e.view==="workspace-reports"||e.view==="workspace-bundles"){let c=l.find(i=>i.id===e.teamId),p={view:e.view,teamSlug:c?.slug};return c?.slug&&R(p,l)?p:null}if(e.view==="bundles"){let{teamId:c,bundleId:p,compareId:i,compareMode:f,...I}=e,v=l.find(d=>d.id===c);if(c!=null&&!v?.slug)return null;let k=(v?.bundles??a).find(d=>d.id===p);if(!k?.slug)return null;let b=i==null?null:(c==null?a:l.flatMap(d=>d.bundles??[])).find(d=>d.id===i),w={...I,teamSlug:v?.slug??null,bundleSlug:k.slug,...b?.slug?{compareSlug:b.slug,...x(f)}:{}},N=R(w,l,a);if(!N)return null;if(w.compareSlug!=null&&N.compareId!==i){let{compareSlug:d,compareMode:z,...P}=w;return P}return w}if(!["findings","files"].includes(e.view))return e;let{teamId:n,reportId:r,...o}=e,s=l.find(c=>c.id===n),t=r==null?null:s?.reports?.find(c=>c.id===r);if(!s?.slug||r!=null&&!t?.slug)return null;let u={...o,teamSlug:s.slug,reportSlug:t?.slug??null};return R(u,l)?u:null}export{A as a,L as b,E as c,$ as d,m as e,J as f,ne as g,x as h,M as i,ae as j,B as k,le as l,R as m,ie as n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function l(e){return!Number.isFinite(e)||e<0?"\u2014":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KiB`:e<1073741824?`${(e/1048576).toFixed(1)} MiB`:`${(e/1073741824).toFixed(1)} GiB`}function u(e){return Array.isArray(e)?e.reduce((r,n)=>({bytes:r.bytes!=null&&Number.isFinite(n.bytes)?r.bytes+n.bytes:null,lines:r.lines!=null&&Number.isFinite(n.lines)?r.lines+n.lines:null}),{bytes:0,lines:0}):{bytes:null,lines:null}}function o(e,r,n){if(Array.isArray(e?.files))return{files:r.length,lines:u(r).lines,packages:new Set(r.map(i=>i.module)).size};let s=i=>Number.isSafeInteger(i)&&i>=0?i:null,t=e?.summary;return{files:s(t?.[n==="code"?"codeFiles":"files"]),lines:s(t?.lines),packages:null}}function c(e){return(e??[]).filter(r=>!["resource:base64","directory"].includes(r.format))}export{l as a,u as b,o as c,c as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as P}from"./chunk-NRPC74AM.js";import{a as b,d as x,f as h,h as y}from"./chunk-W4J3MGLB.js";import{d as B}from"./chunk-PNHBZGDD.js";import{a as g,b as d}from"./chunk-
|
|
1
|
+
import{b as P}from"./chunk-NRPC74AM.js";import{a as b,d as x,f as h,h as y}from"./chunk-W4J3MGLB.js";import{d as B}from"./chunk-PNHBZGDD.js";import{a as g,b as d}from"./chunk-AJ4GTATZ.js";import{c as O}from"./chunk-QYWKC557.js";import{C as k,D as R,G as S,J as I,K as N,L as M,O as m,q as _}from"./chunk-GNXOKIGP.js";import{a as v}from"./chunk-TUII34K2.js";var H=["inprogress","fixed","invalid","deleted","ignored"];function Q(e){return typeof e=="string"&&H.includes(e)}function ue(e){if(e===null)return null;if(typeof e!="object"||Array.isArray(e))return"invalid";let r=e,n={},t=r.color;if(t!=null){if(typeof t!="string"||t.length>50)return"invalid";t!==""&&(n.color=t)}let o=r.triage;if(o!=null){if(!Q(o))return"invalid";n.triage=o}for(let a of["comment","fix"]){let c=r[a];if(c!=null){if(typeof c!="string"||c.length>1e4)return"invalid";c!==""&&(n[a]=c)}}let s=r.flagged;if(s!=null){if(typeof s!="boolean")return"invalid";n.flagged=s}return n}function ge(e,r){let n=d([{groups:[e],tree:r.tree}]);for(let t of e)k(t,r),t.isApp??=_(t,t.source??r.source),t._depsDirectory=n}function w(e,r){return!(e.isApp??_(e,e._source??e.source))&&g(e.file,e._depsDirectory??r??d([{groups:[[e]]}]))}function ye(e,r,n){let t=b(r);return t==="ignored"&&w(e,n)?void 0:t}function we(e,r,n,t){let o=r.id??String(r._id),s=r._reportName??"";w(r,t)&&(n==="ignored"||n==="untriaged")?(b(e.get(o))!=="ignored"&&h(e,o,{triage:void 0}),y(e,o,s,n==="ignored",!0)):(h(e,o,{triage:n==="untriaged"?void 0:n}),n!=="ignored"&&n!=="untriaged"&&y(e,o,s,!1))}function Z(e,r){if(![...e.values()].some(t=>t?.ignoredReports?.length))return!1;let n=!1;for(let t of r){let o=d([t]),s=(t.groups??[]).flat(),a=i=>({...i,_source:i._source??i.source??t.source}),c=new Set(s.filter(i=>w(a(i),o)).map(i=>i.id??String(i._id)));for(let i of s){let l=i.id??String(i._id),p=i._reportName??t.name??t.fileName??"",A=e.get(l);A?.ignoredReports?.includes(p)&&(x(A,p)||w(a(i),o)||(b(A)||(n=h(e,l,{triage:"ignored"})||n),c.has(l)||(n=y(e,l,p,!1)||n)))}for(let i of s){if(!w(a(i),o))continue;let l=i.id??String(i._id),p=i._reportName??t.name??t.fileName??"";e.get(l)?.ignoredReports?.includes(p)&&(n=y(e,l,p,!0,!0)||n)}}return n}async function ee(e,r){let n=new Set(Object.values(e??{}).flatMap(o=>Array.isArray(o?.ignoredReports)?o.ignoredReports.filter(s=>typeof s=="string"&&!x(o,s)):[])),t=[];for(let o of n){let s;try{let a=await r(o);if(typeof a!="string")continue;s=await m(a)}catch{continue}s&&t.push({...s.data,name:o,groups:[s.findings]})}return t}async function me(e,r){if(e!=null&&(typeof e!="object"||Array.isArray(e)))return{entries:e,changed:!1};let n=new Map(Object.entries(e??{})),t=await ee(e,r),o=Z(n,t);return{entries:Object.fromEntries(n),changed:o}}var T=1,f=16,D=12,L=1+f+D+16,u=1+f+D;async function F(e,r){let n=await crypto.subtle.importKey("raw",v(e),"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",hash:"SHA-256",salt:r,iterations:3e6},n,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}function X(e){return!(e instanceof Uint8Array)||e.length<L?!1:e[0]===T}async function W(e,r){if(!(e instanceof Uint8Array))throw new TypeError("encryptWithPassword: plaintext Uint8Array required");if(typeof r!="string"||!r)throw new TypeError("encryptWithPassword: password required");let n=new Uint8Array(u+e.length+16);n[0]=T,crypto.getRandomValues(n.subarray(1,1+f)),crypto.getRandomValues(n.subarray(1+f,u));let t=n.subarray(1,1+f),o=n.subarray(1+f,u),s=await F(r,t),a=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:o,additionalData:n.subarray(0,u)},s,e));return n.set(a,u),n}async function ne(e,r){if(typeof r!="string"||!r)throw new TypeError("tryDecryptWithPassword: password required");if(!(e instanceof Uint8Array)||e.length<L)return{ok:!1,reason:"malformed"};if(e[0]!==T)return{ok:!1,reason:"malformed"};let n=e.subarray(1,1+f),t=e.subarray(1+f,u),o=e.subarray(u),s=await F(r,n),a;try{a=new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:t,additionalData:e.subarray(0,u)},s,o))}catch{return{ok:!1,reason:"wrong-password"}}return{ok:!0,plaintext:a}}async function U(e,r,n){if(!n||typeof n.malformedMsg!="string"||typeof n.wrongPasswordMsg!="string")throw new TypeError("decryptWithPasswordOrThrow: { malformedMsg, wrongPasswordMsg } strings required");let t=await ne(e,r);if(t.ok)return t.plaintext;throw t.reason==="wrong-password"?new Error(n.wrongPasswordMsg):new Error(n.malformedMsg)}var K=X,Be=W;function j(e,r){return U(e,r,{malformedMsg:"malformed encrypted bundle",wrongPasswordMsg:"wrong password or corrupt bundle"})}var te=1,C=1024,G=1024,E=200,J=100*1024*1024,oe=Math.ceil(J*4/3)+16,$=512,z=64;function se(e){if(!e||typeof e!="object")return"payload is not an object";if(e.version!==te)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>G)return`reports count (${e.reports.length}) exceeds cap (${G})`;if(e.bundles!==void 0){if(!Array.isArray(e.bundles))return"bundles field must be an array when present";if(e.bundles.length>C)return`bundles count (${e.bundles.length}) exceeds cap (${C})`;for(let r of e.bundles){if(typeof r!="string")return"bundles entries must be strings";if(r.length>E)return`bundle integrity exceeds per-entry length cap (${E})`}}if(e.bundleBlobs!==void 0){if(!Array.isArray(e.bundleBlobs))return"bundleBlobs field must be an array when present";if(e.bundleBlobs.length>z)return`bundleBlobs count (${e.bundleBlobs.length}) exceeds cap (${z})`;for(let r of e.bundleBlobs){if(!r||typeof r!="object"||Array.isArray(r))return"bundleBlobs entries must be objects";if(typeof r.integrity!="string"||r.integrity.length===0)return"bundleBlobs.integrity must be a non-empty string";if(r.integrity.length>E)return`bundleBlobs.integrity exceeds per-entry length cap (${E})`;if(typeof r.name!="string"||r.name.length===0)return"bundleBlobs.name must be a non-empty string";if(r.name.length>$)return`bundleBlobs.name exceeds per-entry length cap (${$})`;if(r.name.includes("\0"))return"bundleBlobs.name cannot contain NUL";if(typeof r.data!="string")return"bundleBlobs.data must be a base64 string";if(r.data.length>oe)return`bundleBlobs.data exceeds per-blob size cap (${J} bytes raw)`}}return null}async function Se(e){return new Uint8Array(await e.arrayBuffer())}async function Ie(e,r){if(K(e)){if(typeof r!="string"||!r)throw new TypeError("parseWorkspaceBundleBytes: password required for encrypted bundle");let t=await j(e,r);try{return q(await B(t))}catch(o){throw new Error("wrong password or corrupt bundle",{cause:o})}}let n;try{n=await B(e)}catch(t){throw new Error(`gzip decompression failed: ${t.message}`,{cause:t})}return q(n)}function q(e){let r;try{r=JSON.parse(e)}catch(o){throw new Error(`payload is not JSON: ${o.message}`,{cause:o})}let n=se(r);if(n===null)return r;let t=n.includes("exceeds cap");throw new Error(t?n:`not a deepview workspace export: ${n}`)}var ve="links";function ie(e){if(typeof e=="string")return e.length>0?e:null;if(!e||typeof e!="object"||Array.isArray(e))return null;let{id:r}=e;return typeof r=="string"&&r.length>0?r:null}function V(e){let r;try{r=JSON.parse(e)}catch{return null}if(!Array.isArray(r)||r.length===0)return null;let n=[],t=0;for(let o of r){if(!Array.isArray(o))return null;let s=new Set;for(let a of o){let c=ie(a);if(c===null)return null;O(c)?s.add(c):t++}s.size>1&&n.push([...s])}return{groups:n,skipped:t}}function Oe(e){let r=new Set;for(let n of e)for(let t of n)r.add(t);return r.size}function Pe(e,r){for(let n of e)for(let t of n){let o=r.get(t);o||r.set(t,o=new Set);for(let s of n)s!==t&&o.add(s)}return r}function ae(e,r){let n=e.trimStart().startsWith("[")?V(e):null;if(n)return{data:{source:"links",findings:[],links:n.groups},format:"links",reason:null};let t=M(e);if(t.data!=null||N(e,r)!=="codex")return t;try{return{data:{type:"security",source:"codex-security",findings:S(e).flatMap(s=>s.data.findings)},format:"codex",reason:null}}catch(o){return{data:null,format:null,reason:o instanceof Error?o.message:"Invalid Codex CSV"}}}function Ue(e,r){let n=ae(e,r);return n.data==null?Promise.resolve(null):m(JSON.stringify(n.data))}function ce(e){let r=new Set;for(let n of e){if(!n||typeof n!="object")continue;let t=n;typeof t.file=="string"&&t.file&&r.add(t.file);for(let o of Array.isArray(t.evidence)?t.evidence:[])typeof o?.file=="string"&&o.file&&r.add(o.file)}return r}function Y(e){let r=(I(e)??[]).flat().filter(t=>t!=null&&typeof t=="object"),n=d([{groups:[r],tree:e?.tree}]);return{directory:n,own:r.filter(t=>!g(t.file,n))}}function Ke(e){let r=new Map;for(let n of Y(e).own){let t=R(n);t&&r.set(t.toLowerCase(),t)}return r.size===1?[...r.values()][0]:null}function je(e){let{directory:r,own:n}=Y(e);return P([...ce(n)].filter(t=>!g(t,r)))}export{ge as a,w as b,ye as c,we as d,Z as e,ee as f,me as g,W as h,U as i,K as j,Be as k,G as l,Se as m,Ie as n,q as o,ve as p,V as q,Oe as r,Pe as s,ae as t,Ue as u,Ke as v,je as w,ue as x};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$c as c,Zc as a,_c as b,ad as d,bd as e}from"./chunk-CH4UN6WK.js";import"./chunk-JCIIBLKR.js";import"./chunk-K3X5EJBQ.js";import"./chunk-CVVJAXVY.js";import"./chunk-VIHGO77Y.js";import"./chunk-SWTLADW5.js";import"./chunk-2ABLKCOY.js";import"./chunk-ZESLQCTF.js";import"./chunk-UYAXVRVL.js";import"./chunk-NRPC74AM.js";import"./chunk-LPCTJYNA.js";import"./chunk-W4J3MGLB.js";import"./chunk-GJ4IUCNS.js";import"./chunk-PNHBZGDD.js";import"./chunk-F47DXCEV.js";import"./chunk-R5O6FAW4.js";import"./chunk-CMQA4DM6.js";import"./chunk-AJ4GTATZ.js";import"./chunk-R75XOKUP.js";import"./chunk-OD4LPN3H.js";import"./chunk-4XCDFGDP.js";import"./chunk-3BZ7JERB.js";import"./chunk-TZ5KB2Y5.js";import"./chunk-XYFXXB2G.js";import"./chunk-DIJJNTRH.js";import"./chunk-QYWKC557.js";import"./chunk-GNXOKIGP.js";import"./chunk-C4Z6ZBXV.js";import"./chunk-2XUEZHIP.js";import"./chunk-TUII34K2.js";import"./chunk-V5O7M2YT.js";import"./chunk-OOJM4CTU.js";export{e as configureReportRevalidation,a as refreshGraph2Sidebar,b as refreshGraph2TopPkgs,c as render,d as renderEmptyWorkspace};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as a,h as u}from"./chunk-CVVJAXVY.js";import{r as o,s as h}from"./chunk-
|
|
1
|
+
import{g as a,h as u}from"./chunk-CVVJAXVY.js";import{r as o,s as h}from"./chunk-5LSXOLUS.js";import{a as c}from"./chunk-KYCNJVB7.js";import"./chunk-IU3CCINR.js";import"./chunk-UYAXVRVL.js";import"./chunk-PNHBZGDD.js";import"./chunk-CMQA4DM6.js";import"./chunk-3BZ7JERB.js";import"./chunk-QYWKC557.js";import"./chunk-GNXOKIGP.js";import{a as d,c as i,g as n}from"./chunk-2XUEZHIP.js";import"./chunk-TUII34K2.js";import"./chunk-V5O7M2YT.js";import"./chunk-OOJM4CTU.js";var p=`.share-field{display:grid;gap:.35rem;margin-top:.8rem;font-size:.82rem}fieldset{display:grid;gap:.55rem;border:0;margin-top:1rem;font-size:.82rem}legend{margin-bottom:.55rem;font-weight:600}fieldset label{display:flex;align-items:center;gap:.5rem}input[type=checkbox]{accent-color:var(--accent)}.nwd-actions{flex-wrap:wrap}.revoke-all{margin-top:.75rem;border:0;background:none;color:var(--muted);font:inherit;font-size:.74rem}.revoke-all:hover:not(:disabled){color:var(--critical)}
|
|
2
2
|
`;var l=class extends a{static styles=[...a.styles,d(p)];static properties={team:{attribute:!1},session:{attribute:!1},initialId:{attribute:!1},selectedId:{state:!0},links:{state:!0},dependencies:{state:!0},security:{state:!0},busy:{state:!0},message:{state:!0}};constructor(){super(),this.team=null,this.initialId="",this.selectedId="",this.links=[],this.dependencies=!1,this.security=!1,this.busy=!0,this.message="",this.urls=new Map}beforeOpen(){this.load(this.initialId)}select(s){let e=this.links.find(t=>t.id===s);this.selectedId=e?.id??"",this.dependencies=e?.permissions.dependencies===!0,this.security=e?.permissions.security===!0,this.message=""}async load(s=this.selectedId){this.busy=!0;try{let e=await o(this.team.id);return this._settled?void 0:(this.links=e,this.select(s),!0)}catch(e){return this.message=e.message,!1}finally{this.busy=!1}}async change(s=!1,e=!1){if(!this.busy){this.busy=!0,this.message="";try{let t=await h(this.team.id,this.session?.csrfToken,{id:e?void 0:this.selectedId||void 0,revoke:s,dependencies:this.dependencies,security:this.security});if(c.invalidate(["links","history"]),this._settled)return;t.path&&(this.urls.set(t.id,new URL(t.path,location.origin).href),this.links=[{id:t.id,createdAt:Date.now(),createdBy:this.session?.login??"",permissions:{dependencies:this.dependencies,security:this.security}},...this.links],this.selectedId=t.id),s&&(e?this.urls.clear():this.urls.delete(this.selectedId)),await this.load(s?"":t.id??this.selectedId)&&(this.message=s?e?"All public links revoked.":"Link revoked.":t.path?"Link created.":"Permissions saved. The link URL is unchanged.")}catch(t){this.message=t.message}finally{this.busy=!1}}}async copy(){try{await navigator.clipboard.writeText(this.urls.get(this.selectedId)),this.message="Link copied."}catch{this.message="Select the link and copy it."}}render(){let s=this.urls.get(this.selectedId);return i`<dialog @close="${this._onClose}"><header><h3>Share ${this.team?.name}</h3></header><p class="nwd-intro ui-hint">Anyone with this link can read this workspace’s published reports, comments, triage, and available source files without signing in.<br>New published reports will also be included.</p><label class="share-field">Public links <select class="nwd-input" ?disabled="${this.busy}" @change="${e=>this.select(e.target.value)}"><option value="" ?selected="${!this.selectedId}">Create a new link</option>${this.links.map(e=>i`<option value="${e.id}" ?selected="${this.selectedId===e.id}">${new Date(e.createdAt).toLocaleString()} · ${e.createdBy} · ${e.id.slice(0,8)}</option>`)}</select></label><fieldset ?disabled="${this.busy}"><legend>Include in this link</legend><label><input type="checkbox" .checked="${this.security}" @change="${e=>{this.security=e.target.checked}}"> Security findings and advisories</label> <label><input type="checkbox" .checked="${this.dependencies}" @change="${e=>{this.dependencies=e.target.checked}}"> Findings in dependencies</label></fieldset><p class="nwd-note ui-hint">Both options are off for new links.<br>Existing links keep their URL when permissions change.</p>${s?i`<label class="share-field">Public link<input class="nwd-input" readonly="readonly" .value="${s}" @focus="${e=>e.target.select()}"></label>`:n} ${this.message?i`<p class="nwd-note" role="status">${this.message}</p>`:n}<footer class="nwd-actions">${this.selectedId?i`<button class="danger" ?disabled="${this.busy}" @click="${()=>this.change(!0)}">Revoke link</button>`:n} <span class="nwd-spacer"></span> ${s?i`<button @click="${()=>this.copy()}">Copy link</button>`:n} <button class="primary" ?disabled="${this.busy}" @click="${()=>this.change()}">${this.selectedId?"Save changes":"Create public link"}</button> <button @click="${()=>this._finish(null)}">Close</button></footer>${this.links.length>0?i`<button class="revoke-all" ?disabled="${this.busy}" @click="${()=>this.change(!0,!0)}">Revoke all links for this workspace</button>`:n}</dialog>`}};customElements.define("managed-share-dialog",l);function w(r,s="",e=null){return u("managed-share-dialog",{team:r,initialId:s,session:e})}export{w as openManagedShareDialog};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as Ae}from"./chunk-GNXOKIGP.js";import{b as B}from"./chunk-TUII34K2.js";var Dt={__proto__:null,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",py:"python",pyw:"python",pyi:"python",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"},_e={__proto__:null,module:"javascript",commonjs:"javascript","module-typescript":"typescript","commonjs-typescript":"typescript",json:"json",solidity:"solidity",php:"php",shell:"bash",rust:"rust",java:"java",objc:"objectivec",objcpp:"objectivec",c:"c","c-header":"c",cpp:"cpp","cpp-header":"cpp",ruby:"ruby",podspec:"ruby",podfile:"ruby",fastlane:"ruby","podfile-lock":"yaml",xml:"markup"};function Wt(e){if(typeof e!="string")return!1;let t=e.length-1,n=0;for(;n<t&&/\s/u.test(e[n]);)n++;for(;t>n&&/\s/u.test(e[t]);)t--;return n<t&&e[n]==="{"&&e[t]==="}"}function ze(e,t,n){if(typeof t=="string"&&_e[t])return _e[t];if(typeof e!="string")return null;let s=e.slice(e.lastIndexOf("/")+1),o=s.lastIndexOf(".");if(o<=0)return null;let r=s.slice(o+1).toLowerCase();return r==="map"?Wt(n)?"json":null:Dt[r]??null}var Ut=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"}),Jt=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 Gt(e){let t=typeof e=="string"?e.slice(e.lastIndexOf("/")+1):"",n=t.lastIndexOf("."),s=n>0?t.slice(n+1).trim().toLowerCase():"",o=ze(e)??Jt[s];return o?{key:o,label:Ut[o]??o}:s?{key:`extension:${s}`,label:`.${s}`}:{key:"other",label:"Other"}}function Q(e,t){let n=new Map,s=0,o=0;for(let[r,i]of e){let c=Gt(r),a=n.get(c.key)??{...c,files:0,lines:0,bytes:0};a.files++,a.lines+=i,a.bytes+=t.get(r)??0,n.set(c.key,a),o+=i,s+=t.get(r)??0}return{files:e.size,lines:o,bytes:s,languages:[...n.values()].toSorted((r,i)=>i.lines-r.lines||r.label.localeCompare(i.label))}}var Kt=new Set(["module","commonjs","json","module-typescript","commonjs-typescript"]),qt=new Set(["solidity","php","shell","rust"]),Ht=new Set(["java","kotlin","gradle","objc","objcpp","swift","c","cpp","c-header","cpp-header","ruby","python","cmake","podspec","podfile","podfile-lock","template","xml","env","fastlane","pbxproj"]),Vt=new Set(["resource","resource:base64"]),Ce=new Set(["stat:file","stat:directory"]),Zt=new Set([...Kt,...qt,...Ht,...Vt,"patch","directory",...Ce]),ee=e=>Ce.has(e);var Ie=e=>e==="directory"||e==="stat:directory"?"directory":"file";function Xt(e,t,n){if(e===t)return e;let s=ee(e);if(s!==ee(t)&&Ie(e)===Ie(t))return s?t:e;throw new Error(`format conflict for '${n}' ('${t}' vs '${e}')`)}function $(e,t){return t===""?e:e==="."?t:`${e}/${t}`}var Yt=/^(?=[A-Za-z0-9-]{1,39}\/)[A-Za-z0-9](?:-?[A-Za-z0-9])*\/(?!\.\.?$)[\w.-]{1,100}$/u,Qt=/^(?!\.\.?(?:\/|$))[\w.~@+-]+(?:\/(?!\.\.?(?:\/|$))[\w.~@+-]+)*$/u,en=/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u,I={github:e=>typeof e=="string"&&Yt.test(e),directory:e=>typeof e=="string"&&e.length<=1024&&(e===""||Qt.test(e)),commit:e=>typeof e=="string"&&en.test(e)},Pe=(e,t)=>e?.toLowerCase()===t?.toLowerCase();var U=(e,t,n)=>{if(e===void 0)return;v(e)||m(!1,`${n} must be an object`);for(let o of Object.keys(e))Object.hasOwn(t,o)||m(!1,`unknown ${n} key '${o}'`);let s=Object.entries(t).map(([o,r])=>typeof r=="object"?[o,U(e[o],r,`${n}.${o}`)]:(e[o]!==void 0&&!r(e[o])&&m(!1,`invalid ${n}.${o}: ${JSON.stringify(e[o])}`),[o,e[o]])).filter(([,o])=>o!==void 0);return s.length===0?void 0:Object.freeze(y(s))},J=(e,t="bundle repo")=>U(e,I,t),tn=(e,t)=>t??(E(e)?"npm":void 0),Le=(e,{ecosystem:t,repo:n},s)=>{if(n===void 0)return;tn(e,t)===void 0&&m(!1,`${s}: '${e}' is no dependency's bucket, and carries no repo`);let o=J(n,`${s} module '${e}' repo`);return o?.github===void 0&&m(!1,`${s} module '${e}' repo has no github`),o},W=({name:e,version:t,ecosystem:n,repo:s,files:o})=>({name:e,version:t,...n===void 0?{}:{ecosystem:n},...s===void 0?{}:{repo:s},files:o});function te({name:e,version:t,ecosystem:n,repo:s,files:o},r,i){return m(n===void 0||typeof n=="string"),W({name:e,version:t??void 0,ecosystem:n,repo:Le(r,{ecosystem:n,repo:s},i),files:y(Object.entries(o))})}function Fe(e,{scope:t="full"}={}){let n=new Set;for(let[s,{files:o}]of e)if(!(t!=="full"&&!E(s)))for(let r of Object.keys(o))n.add($(s,r));return n}function nn(e,{what:t,files:n,formats:s,scope:o}){if(e.includes("\\"))return"holds a '\\'";if(R(e))return"escapes the root";if(o!=="full"&&!E(e))return`is outside node_modules, which a '${o}'-scope ${t} does not record`;if(!n.has(e))return`names no file the ${t} records`;let r=s.get(e);return r==="directory"?"is a directory capture, not a file":ee(r)?`is a payload-free '${r}' record, not a file`:null}function Te(e,{what:t,files:n,formats:s,scope:o}){for(let r of e){let i=nn(r,{what:t,files:n,formats:s,scope:o});m(i===null,`${t}: executable entry '${r}' ${i}`)}}function Be(e,{what:t,files:n,formats:s,scope:o="full"}){if(e===void 0)return new Set;let r=`${t}: executable`;m(Array.isArray(e),`${r} must be an array of file paths`);let i=new Set;for(let c of e)m(typeof c=="string"&&c!=="",`${r} entry must be a non-empty string`),m(!i.has(c),`${r} entry '${c}' is listed twice`),i.add(c);return Te(i,{what:t,files:n,formats:s,scope:o}),i}function De(e,{what:t,modules:n,formats:s,scope:o}){if(e.size!==0)return Te(e,{what:t,files:Fe(n,{scope:o}),formats:s,scope:o}),G(e)}function m(e,t){if(!e)throw new Error(t)}function We(e,t){let[n,s]=[e.split("/"),t.split("/")];for(;n.length>0&&n[0]===s[0];)n.shift(),s.shift();if(n.length===0&&s.length===0)return 0;if(n.length<2)return s.length<2&&n>s?1:-1;if(s.length<2)return 1;if(n[0]==="*")return-1;if(s[0]==="*"||n[0]==="node_modules")return 1;if(s[0]==="node_modules")return-1;let[o,r]=[n,s].map(i=>i.join(String.fromCodePoint(0)));if(o<r)return-1;if(o>r)return 1;throw new Error("Unreachable")}var D=(e,t)=>We(e[0],t[0]),v=e=>e&&[null,Object.prototype].includes(Object.getPrototypeOf(e)),y=e=>Object.setPrototypeOf(Object.fromEntries(e),null),G=e=>[...e].toSorted(We),ne=(e,{sorted:t=!0}={})=>{let n=t?[...e].toSorted(D):[...e];return y(n.map(([s,o])=>[s,o instanceof Map?ne(o,{sorted:t}):o]))},Re=(e,t)=>e.get(t)??e.set(t,new Map).get(t),Ue=e=>new Map(Object.entries(e).map(([t,n])=>[t,v(n)?Ue(n):n]));function R(e){if(e.startsWith("/"))return!0;if(!e.includes(".."))return!1;let t=0;for(let n of e.split("/"))if(!(n==="."||n==="")){if(n!=="..")t++;else if(--t<0)return!0}return!1}var Je=e=>e.includes("\\")||R(e),x=(e,t)=>m(!Je(e),`${t}: path '${e}' escapes the root or holds a '\\'`),Ge=(e,t)=>m(typeof e=="string"&&e!==""&&!Je(e),`${t}: invalid entry ${JSON.stringify(e)}`);function Ke(e,t){m(Array.isArray(e),`${t}: entries must be an array of file paths`);let n=new Set;for(let s of e)Ge(s,t),m(!n.has(s),`${t}: entry '${s}' is listed twice`),n.add(s);return n}function qe(e,t){for(let n of e)Ge(n,t);return G(e)}function He(e,t){x(e,"formats"),m(Zt.has(t),`unknown format '${t}' for ${e}`)}function Ve(e){m(v(e));let t=new Map;for(let[n,s]of Object.entries(e)){He(n,s);let o=n===""?".":n;m(!t.has(o),`duplicate format key '${o}'`),t.set(o,s)}return t}function Ze(e){for(let[t,n]of e)He(t,n);return ne(e)}function Xe(e){for(let[,t]of e){m(t instanceof Map);for(let[n,s]of t){x(n,"imports"),m(s instanceof Map);for(let[,o]of s){if(typeof o=="string"){x(o,"imports");continue}m(o instanceof Map&&o.size>0,"import target must be a file or a non-empty {platform: file} map");for(let[r,i]of o)m(typeof r=="string"&&r.length>0&&!r.includes("/"),`invalid platform key '${r}'`),m(typeof i=="string"),x(i,"imports")}}}}function Ye(e){m(v(e));let t=Ue(e);return Xe(t),t}function Qe(e){return Xe(e),ne(e)}function et(e,{skipEmpty:t=!1,repo:n=!0,what:s}={}){let o={modules:[],sources:[]};for(let[r,i]of e){if(t&&Object.keys(i.files).length===0)continue;let c=E(r);c&&m(i.name&&i.version&&i.files);let a=y(Object.entries(i.files).toSorted(D));o[c?"modules":"sources"].push([r,W({...i,repo:n?Le(r,i,s):void 0,files:a})])}return{modules:y(o.modules.toSorted(D)),sources:y(o.sources.toSorted(D))}}function sn(e,t){let n=e instanceof Map;if(n!==t instanceof Map)return!1;if(!n)return e===t;if(e.size!==t.size)return!1;for(let[s,o]of e)if(t.get(s)!==o)return!1;return!0}var Ne=e=>e instanceof Map?`{${[...e].map(([t,n])=>`${t}: ${n}`).join(", ")}}`:e;function tt(e,t,n){let s=new Map,o=r=>{for(let[i,c]of r){let a=Re(s,i);for(let[u,f]of c){let l=Re(a,u);for(let[p,d]of f)l.has(p)?m(sn(l.get(p),d),`${n}: import '${p}' from '${u}' resolves differently ('${Ne(l.get(p))}' vs '${Ne(d)}')`):l.set(p,d instanceof Map?new Map(d):d)}}};return o(e),o(t),s}function nt(e,t,n){let s=new Map,o=r=>{for(let[i,c]of r){let a=s.get(i);if(a===void 0){s.set(i,c);continue}try{s.set(i,Xt(c,a,i))}catch(u){throw new Error(`${n}: ${u.message}`,{cause:u})}}};return o(e),o(t),s}function st(e,t,n,s){if(e.size===0)return new Set(t);let o=Fe(n,{scope:s}),r=new Set(t);for(let i of e)o.has(i)||r.add(i);return r}var on=/(?:^|\/)\.{0,2}(?:\/|$)/u;function K(e,t,n){let s=$(e,t);return(s!=="."||t!=="")&&on.test(s)&&m(!1,`${n}: non-canonical file key ${JSON.stringify(s)}`),s.includes("\\")&&m(!1,`${n}: file key '${s}' holds a '\\', which no path may`),s}function q(e,t,n){let s=new Map;for(let[o,{files:r}]of e){typeof o!="string"&&m(!1,`${t}: bucket dir ${String(o)} is not a string`),x(o,t);for(let i of Object.keys(r)){let c=K(o,i,t),a=s.get(c);a!==void 0&&n(c,a,o),s.set(c,o)}}return s}var ot=(e,t)=>n=>m(!1,`duplicate file key '${n}' across ${e} buckets -- module bucketing changed between writes (a workspace package without a version now owns its own bucket); regenerate the ${t}`);function rt(e,t,n){let s=new Map,o=r=>{for(let[i,c]of r){let a=s.get(i);if(a===void 0){s.set(i,W({...c,files:Object.assign(Object.create(null),c.files)}));continue}m(a.name===c.name,`${n}: module '${i}' name mismatch ('${a.name}' vs '${c.name}')`),m(a.version===c.version,`${n}: module '${i}' version mismatch ('${a.version}' vs '${c.version}')`+(a.version==null==(c.version==null)?"":" -- an artifact from an older stasis may record a placeholder version for a workspace package without one; regenerate it (bundle=replace / lock=replace)")),m(a.ecosystem===c.ecosystem,`${n}: module '${i}' ecosystem mismatch ('${a.ecosystem??"(none)"}' vs '${c.ecosystem??"(none)"}')`),a.repo===void 0&&c.repo!==void 0&&s.set(i,W({...a,repo:c.repo}));for(let[u,f]of Object.entries(c.files))Object.hasOwn(a.files,u)?m(a.files[u]===f,`${n}: content mismatch for '${$(i,u)}'`):a.files[u]=f}};return o(e),o(t),q(s,n,(r,i,c)=>m(!1,`${n}: file '${r}' is bucketed under both '${i}' and '${c}' -- module bucketing changed between the artifacts (a workspace package without a version now owns its own bucket); regenerate the artifact (bundle=replace / lock=replace)`)),s}function E(e){return e.split("/").includes("node_modules")}function rn(e){let t="node_modules/",n=e.length;for(;(n=e.lastIndexOf(t,n-1))!==-1;)if(n===0||e[n-1]==="/")return n;return-1}function it(e){let t="node_modules/",n=rn(e);if(n===-1)return null;let s=n+t.length,o=e.slice(s).split("/"),r=o[0].startsWith("@")?2:1;if(o.length<=r||o.slice(0,r).some(c=>!c))return null;let i=o.slice(0,r).join("/");return{dir:e.slice(0,s)+i,rel:o.slice(r).join("/"),name:i}}var O=1,ct=0,ut=ot("bundle","artifact (bundle=replace)"),lt=e=>it(e)??{dir:".",rel:e==="."?"":e,name:null};function cn(){throw new Error("bundle: file contents are not retained by this contents-free Bundle")}var un=(e,{files:t,...n})=>{let s=Object.create(null);for(let[o,r]of Object.entries(t))typeof r!="symbol"&&m(!1,`bundle: file '${$(e,o)}' is not a placeholder`),Object.defineProperty(s,o,{get:cn,enumerable:!0});return{...n,files:Object.freeze(s)}},se=(e,t)=>{if(e===void 0&&t===void 0)return;let n=new Map;for(let s of[e,t])for(let[o,r]of Object.entries(s??{})){if(!Array.isArray(r))continue;let i=n.get(o);i===void 0&&n.set(o,i=new Set);for(let c of r)i.add(c)}return y([...n.keys()].toSorted().map(s=>[s,G(n.get(s))]))},Ns=(e,t)=>Object.hasOwn(I,e)&&I[e](t),ln=(e,t)=>{if(e?.github===void 0||!Pe(e.github,t?.github))return;let n=Object.keys(I).filter(s=>e[s]!==void 0&&(s==="github"||e[s]===t[s]));return y(n.map(s=>[s,e[s]]))},an=e=>{if(!v(e)||e.root!==!0||Object.hasOwn(e,"directory"))return e;let{root:t,...n}=e;return n},at=e=>typeof e=="string"&&/^[\w.+@/~'!()*-]+$/u.test(e),oe={name:at,version:at},ft={npm:oe,composer:oe,cargo:oe},fn=(e,t)=>y(Object.keys(ft).map(n=>{let[s,o]=[e?.[n],t?.[n]];return[n,s?.name!==void 0&&s.name===o?.name?y(Object.entries(s).filter(([r,i])=>i===o[r])):void 0]})),S=class e{static VERSION=O;version=O;config;entries;modules;formats;imports;executable;reason;#e;get repo(){return this.#e}set repo(t){this.#e=J(t)}#t;get package(){return this.#t}set package(t){this.#t=U(t,ft,"bundle package")}constructor({config:t={scope:"full"},entries:n,modules:s,formats:o,imports:r,executable:i,reason:c,repo:a,package:u,version:f=O}={}){m([ct,O].includes(f)),m(["node_modules","full"].includes(t.scope)),this.version=f,this.config=t,this.entries=n??new Set,this.modules=s??new Map,this.formats=o??new Map,this.imports=r??new Map,this.executable=i??new Set,this.reason=c,this.repo=J(a),this.package=u}get sources(){let t=new Map;for(let[n,{files:s}]of this.modules)for(let[o,r]of Object.entries(s))t.set($(n,o),r);return t}static isResourceFormat(t){return t==="resource"||t==="resource:base64"||t==="directory"}get hasCode(){for(let[t,{files:n}]of this.modules)for(let s of Object.keys(n))if(!e.isResourceFormat(this.formats.get($(t,s))))return!0;return!1}static parse(t){return e.fromJSON(JSON.parse(t))}static fileKeyAt(t){let[n,s,o,r]=t;if(typeof s=="string"){if(t.length===2&&n==="sources"){let i=lt(s);return K(i.dir,i.rel,"bundle")}if(t.length===4&&(n==="sources"||n==="modules")&&o==="files"&&typeof r=="string")return K(s,r,"bundle")}}static fromJSON(t,{contents:n=!0}={}){m(t.version===O||t.version===ct),m(["node_modules","full"].includes(t.config?.scope));let s=Ve(t.formats),o=new Map,r=new Set;if(t.version===O){let a=t.config.scope==="full";if(t.modules!==void 0){m(typeof t.modules=="object"&&t.modules!==null);for(let[u,f]of Object.entries(t.modules))m(E(u)),x(u,"bundle"),m(f?.name&&f.version&&f.files),o.set(u,te(f,u,"bundle"))}if(a){m(t.sources&&typeof t.sources=="object");for(let[u,f]of Object.entries(t.sources))m(!E(u)),x(u,"bundle"),m(f?.name&&f.files),o.set(u,te(f,u,"bundle"));t.entries!==void 0&&(r=Ke(t.entries,"bundle"))}else m(t.entries===void 0),m(t.sources===void 0)}else{m(t.sources);for(let[a,u]of Object.entries(t.sources)){x(a,"bundle");let{dir:f,rel:l,name:p}=lt(a);m(!R(f)&&!R(l)),o.has(f)||o.set(f,{name:p,version:null,files:Object.create(null)});let{files:d}=o.get(f);m(!Object.hasOwn(d,l),"bundle: duplicate file key '.' (v0 '' and '.')"),d[l]=u}}let i=q(o,"bundle",ut),c=Ye(t.imports);if(!n)for(let[a,u]of o)o.set(a,un(a,u));return new e({version:t.version,config:t.config,entries:r,modules:o,formats:s,imports:c,executable:t.version===O?Be(t.executable,{what:"bundle",files:i,formats:s,scope:t.config.scope}):new Set,reason:v(t.reason)?t.reason:void 0,repo:an(t.repo),package:t.package})}serialize(){q(this.modules,"bundle",ut);let{modules:t,sources:n}=et(this.modules,{skipEmpty:!0,what:"bundle"}),s=this.config.scope==="full",o={version:O,config:this.config};this.repo!==void 0&&(o.repo=this.repo),this.package!==void 0&&(o.package=this.package),s&&(o.entries=qe(this.entries,"bundle")),o.formats=Ze(this.formats),o.imports=Qe(this.imports);let r=De(this.executable,{what:"bundle",modules:this.modules,formats:this.formats,scope:this.config.scope});return r!==void 0&&(o.executable=r),this.reason!==void 0&&(o.reason=se(this.reason,void 0)),s&&(o.sources=n),o.modules=t,JSON.stringify(o,void 0,2)}withReason(t){let{version:n,config:s,entries:o,modules:r,formats:i,imports:c,executable:a,repo:u,package:f}=this,l=se(this.reason,{[t]:[...this.sources.keys()]});return new e({version:n,config:s,entries:o,modules:r,formats:i,imports:c,executable:a,reason:l,repo:u,package:f})}merge(t){return m(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:rt(this.modules,t.modules,"bundle merge"),formats:nt(this.formats,t.formats,"bundle merge"),imports:tt(this.imports,t.imports,"bundle merge"),executable:st(this.executable,t.executable,t.modules,this.config.scope),reason:se(this.reason,t.reason),repo:ln(this.repo,t.repo),package:fn(this.package,t.package)})}};var pt=/^webpack(?:-internal)?:\/\/[^/]*\//u,dt=/^[a-z][\d+.a-z-]*:/iu,pn=/^file:/iu,mt=/^(?:file|ftp|https?|wss?):/iu,dn=/^(?:[a-z][\d+.a-z-]*:\/\/[^/]*\/?|\/\/[^/]+\/|[a-z]:\/|\/)?/iu,M=e=>dn.exec(e)[0],V=e=>M(e).includes("://"),z=e=>e.replace(V(e)?/[#?].*$/su:/\?.*$/su,""),gt=e=>e.slice(e.lastIndexOf("/")+1),H=(e,t)=>URL.parse(e,t)?.href??null;function k(e){let t=M(e),n=t.includes("://")&&H(e);if(n)return n;let s=[];for(let r of e.slice(t.length).split("/"))r===""||r==="."||(r!==".."?s.push(r):s.length>0&&s.at(-1)!==".."?s.pop():t||s.push(".."));let o=/^[a-z]:\/$/iu.test(t)?t.toUpperCase():t.startsWith("//")?t.toLowerCase():t;return o?o.replace(/\/?$/u,"/")+s.join("/"):s.join("/")||"."}function ht(e,t){let n=M(t);return V(e)&&!n.includes(":")?H(t,e)??k(`${e}/../${t}`):k(n==="/"?M(e).replace(/\/?$/u,"")+t:n?t:`${e}/../${t}`)}function mn(e){try{return decodeURIComponent(e)}catch{return e}}function C(e,t){let n=e.replaceAll("\\","/");if(pt.test(n))return k(n.replace(pt,""));let s=mt.test(n)?H(n)??n:n,o=/^file:\/\/([^/#]*)([^#]*)/isu.exec(s);if(o){let[,i,c]=o;return k(mn(i&&i.toLowerCase()!=="localhost"?`//${i}${c}`:c).replace(/^\/(?=[a-z]:\/)/iu,""))}if(dt.test(s)&&!M(s).includes(":"))return s;if(t===void 0)return k(s);if(pn.test(t)&&!M(s))return C(H(s,t)??s);let r=C(t);return M(s)&&!V(r)?k(s):ht(r,s)}var gn=/^(?:@[\dA-Za-z~-][\w.~-]*\/)?[\dA-Za-z~-][\w.~-]*$/u;function re(e){let t=e.split("/").slice(0,e.startsWith("@")?2:1).join("/");return gn.test(t)?t:null}var hn=new Set([".pnpm",".bun",".deno"]),bn=/^\d+\.\d+\.\d+(?:-[\d.a-z-]+)?(?:\+[\d.a-z-]+)?$/iu;function yn(e,t){let n=`${t.replace("/","+")}@`,s=e.startsWith(n)?e.slice(n.length).split(/[(_]/u)[0]:null;return bn.test(s)?s:null}function bt(e){let t=z(e).split("/"),n=t.lastIndexOf("node_modules"),s=n<0?null:re(t.slice(n+1).join("/"));if(s===null)return null;let o=n+1+s.split("/").length;if(o>=t.length||t.slice(o).includes(""))return null;let r=t.slice(0,o).join("/");return{name:s,version:hn.has(t[n-2])?yn(t[n-1],s):null,root:r,path:e.slice(r.length+1)}}var wn=new Map([["js","jsx"],["mjs","jsx"],["cjs","jsx"],["jsx","jsx"],["es","jsx"],["es6","jsx"],["ts","ts"],["mts","ts"],["cts","ts"],["tsx","tsx"],["json","json"]]);function ie(e){let t=gt(z(e));return/^[\w-]+$/u.test(t)?"jsx":wn.get(/\.([\da-z]+)$/iu.exec(t)?.[1].toLowerCase())??null}var Sn=[".js",".mjs",".cjs",".jsx",".ts",".tsx",".mts",".cts",".json"],xn=[".ios",".android",".web"];function On(e){let t=e.map(i=>/\.[a-z]+(?=\.\w+$)/u.exec(gt(z(i.path??"")))?.[0]),n=xn.map(i=>[i,t.filter(c=>c===i).length]).toSorted((i,c)=>c[1]-i[1]),[[s,o],[,r]]=n;return[...o===r?[]:[s],".native","",".browser",".node"]}var $n=new Map([[".js",[".ts",".tsx"]],[".jsx",[".tsx"]],[".mjs",[".mts"]],[".cjs",[".cts"]]]),vn=["index","main","browser","node"],En=["","src/","lib/","dist/","build/"],kn=new Set(["lib","dist","build","out","esm","cjs"]);function*Mn(e,t){yield e;let n=/\.[^./]+$/u.exec(e)?.[0];for(let s of $n.get(n)??[])yield e.slice(0,-n.length)+s;for(let s of e.endsWith("/")?[`${e}index`]:[e,`${e}/index`])for(let o of Sn)for(let r of t)yield s+r+o;if(n)for(let s of t.filter(Boolean))yield e.slice(0,-n.length)+s+n}function*jn(e){let t=e;for(;;){t.startsWith("src/")||(yield`src/${t}`),t!==e&&(yield t);let n=t.indexOf("/");if(n<0||!kn.has(t.slice(0,n)))return;t=t.slice(n+1)}}function yt(e){let t=new Map,n=new Map,s=new Map;for(let o of e){if(o.path!==null&&t.set(o.path,o),!o.package)continue;n.set(o.package.name,(n.get(o.package.name)??new Set).add(o.package.root)),(s.get(o.package.root)??s.set(o.package.root,[]).get(o.package.root)).push(o)}return{byPath:t,roots:n,byRoot:s,platforms:On(e),found:new Map}}function N(e,t){if(!e.found.has(t)){let n=z(t),s=Mn(n,e.platforms).map(o=>o+t.slice(n.length));e.found.set(t,e.byPath.get(s.find(o=>e.byPath.has(o)))??null)}return e.found.get(t)}function An(e,t,n){let s=e.roots.get(n);if(!s)return null;let o=t.path.split("/");for(let r=o.length-1;r>=0;r--){let i=[...o.slice(0,r),"node_modules",n].join("/");if(s.has(i))return i}return s.size===1?[...s][0]:null}var _n=new Set(["assert","async_hooks","buffer","child_process","cluster","console","constants","crypto","dgram","diagnostics_channel","dns","domain","events","fs","http","http2","https","inspector","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","string_decoder","sys","timers","tls","trace_events","tty","url","util","v8","vm","wasi","worker_threads","zlib","_http_agent","_http_client","_http_common","_http_incoming","_http_outgoing","_http_server","_stream_duplex","_stream_passthrough","_stream_readable","_stream_transform","_stream_wrap","_stream_writable","_tls_common","_tls_wrap","assert/strict","dns/promises","fs/promises","inspector/promises","path/posix","path/win32","readline/promises","stream/consumers","stream/promises","stream/web","timers/promises","util/types"]);function zn(e){if(e.startsWith("node:")||_n.has(e))return{builtin:!0};let t=re(z(e));return t===null?{}:{package:t}}function ce(){let e=[],t=new Map,n=(o,r,i)=>{let c=t.get(o)??t.set(o,new Set).get(o);c.has(r)||(c.add(r),e.push(i))};return{edges:e,add:n,link:(o,r,i)=>{o&&r&&r!==o&&n(o,r,{from:o,to:r,kind:i})}}}function In(e,t){for(let s of vn)for(let o of En){let r=N(e,`${t}/${o}${s}`);if(r)return r}let n=e.byRoot.get(t);return n?.length===1?n[0]:null}function Rn(e,t,n,s){return/^\/[^?]/u.test(n)?N(e,t+n)??jn(n.slice(1)).map(o=>N(e,`${t}/${o}`)).find(Boolean):N(e,t+n)??s(e,t)}function ue(e,t,n,s=In){let o=/^(?:\.{1,2}|[a-z]:)?\\/iu.test(n)?n.replaceAll("\\","/"):n,r=mt.test(o);if(r||/^(?:\.{1,2}(?:\/|$)|\/|[a-z]:\/)/iu.test(o)||V(o)){let u=r?C(o):ht(t.path,o),f=N(e,u);return f?{to:f}:{to:null,path:u}}if(dt.test(o)&&e.byPath.has(o))return{to:e.byPath.get(o)};let i=re(z(n)),c=i===null?null:An(e,t,i);if(c===null)return{to:null,...zn(n)};let a=Rn(e,c,n.slice(i.length),s);return a?{to:a}:{to:null,package:i}}var h=class extends Error{name="SourceMapError"},St=new Uint8Array(128).fill(255);for(let[e,t]of[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/,;"].entries())St[t.codePointAt(0)]=e;function le(e){let t=new Int32Array(e.length*2);return t.set(e),t}function Nn(e){let{starts:t,columns:n,sources:s,names:o}=e;for(let r=0;r+1<t.length;r++){let[i,c]=[t[r],t[r+1]],a=i+1;for(;a<c&&n[a-1]<=n[a];)a++;if(a>=c)continue;let u=Array.from(n.subarray(i,c),(f,l)=>[f,s[i+l],o[i+l]]).sort((f,l)=>f[0]-l[0]);for(let[f,[l,p,d]]of u.entries())[n[i+f],s[i+f],o[i+f]]=[l,p,d]}return e}function Cn(e){let t=[0],n=new Int32Array(1024),s=new Int32Array(1024),o=new Int32Array(1024),r=0;for(let{mappings:i,files:c,line:a,column:u,names:f,nameCount:l}of e){if(typeof i!="string")throw new h("mappings is not a string");for(;t.length<=a;)t.push(r);let p=[0,0,0,0,0],d=0,g=0,A=1,Me=u;for(let b=0;b<=i.length;b++){let _=b<i.length?St[i.codePointAt(b)]??255:64;if(_<32){if(g+=_*A,d===5)throw new h(`mappings: a segment of more than 5 fields at ${b}`);p[d++]+=g%2?(1-g)/2:g/2,g=0,A=1;continue}if(_<64){if(g+=(_-32)*A,A*=32,A>2**30)throw new h(`mappings: a value at ${b} runs past 32 bits`);continue}if(_===255)throw new h(`mappings: ${JSON.stringify(i[b])} at ${b} is not a base64 digit`);if(A!==1)throw new h(`mappings: the value before ${b} is cut off`);if(d>0){if(d===2||d===3)throw new h(`mappings: a segment of ${d} fields before ${b}`);let je=d===1?-1:c[p[1]];if(je===void 0)throw new h(`mappings: source ${p[1]} before ${b} is not in sources`);if(p[0]<0)throw new h(`mappings: a negative generated column before ${b}`);r===n.length&&([n,s,o]=[le(n),le(s),le(o)]),n[r]=p[0]+Me,s[r]=je,o[r++]=d===5&&p[4]>=0&&p[4]<l?f+p[4]:-1,d=0}_===65&&(t.push(r),p[0]=0,Me=0)}}return t.push(r),Nn({starts:Int32Array.from(t),columns:n.slice(0,r),sources:s.slice(0,r),names:o.slice(0,r)})}var xt=new WeakMap,ae=e=>xt.get(e),P=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function w(e,t){if(!e)throw new h(t)}function wt(e,t){if(e===void 0)return[];w(Array.isArray(e),`${t} is not an array`);for(let n of e)w(typeof n=="string"||n===null,`${t} holds ${JSON.stringify(n)}`);return e}function Pn(e,t,n,s){let o=e.bySource.get(t);if(o!==void 0)return e.files[o].content??=n,e.files[o].ignored||=s,o;let r=t===null?null:C(t,e.mapPath);return e.files.push({source:t,path:r,package:r===null?null:bt(r),content:n,ignored:s}),t!==null&&e.bySource.set(t,e.files.length-1),e.files.length-1}function Ot(e,t,n,s){w(e.version===3,`version ${JSON.stringify(e.version)} is not 3`),w(e.sourceRoot===void 0||typeof e.sourceRoot=="string","sourceRoot is not a string");let o=wt(e.sources,"sources"),r=wt(e.sourcesContent,"sourcesContent"),i=e.ignoreList??e.x_google_ignoreList??[];w(Array.isArray(i)&&i.every(l=>Number.isInteger(l)&&l>=0&&l<o.length),"ignoreList is not a list of indices into sources");let c=new Set(i),a=e.sourceRoot?e.sourceRoot.replace(/\/?$/u,"/"):"",u=o.map((l,p)=>Pn(t,l===null?null:a+l,r[p]??null,c.has(p))),f=Array.isArray(e.names)?e.names:[];t.parts.push({mappings:e.mappings,files:u,line:n,column:s,names:t.names.length,nameCount:f.length}),t.names.push(...f)}function Ln(e,t){w(e.version===3,`version ${JSON.stringify(e.version)} is not 3`),w(Array.isArray(e.sections),"sections is not an array");for(let[n,s]of e.sections.entries()){let{offset:o,map:r}=P(s)?s:{};w(P(o)&&[o.line,o.column].every(c=>Number.isInteger(c)&&c>=0),`sections[${n}].offset is not a line and a column`),w(P(r)&&r.sections===void 0,`sections[${n}].map is not a plain source map`);let i=e.sections[n-1]?.offset;w(!i||i.line<o.line||i.line===o.line&&i.column<=o.column,`sections[${n}] starts before sections[${n-1}]`),Ot(r,t,o.line,o.column)}}function fe(e,t={}){if(!P(t))throw new TypeError("readSourceMap: options is not an object");if(t.path!==void 0&&typeof t.path!="string")throw new TypeError("readSourceMap: options.path is not a string");let n=e;if(typeof e=="string"||e instanceof Uint8Array)try{let r=typeof e=="string"?e:new TextDecoder("utf-8",{fatal:!0}).decode(e);n=JSON.parse(r.replace(/^\)\]\}'[^\n]*\n/u,""))}catch(r){throw new h(`not JSON: ${r.message}`,{cause:r})}w(P(n),"not a JSON object");let s={files:[],bySource:new Map,mapPath:t.path,parts:[],names:[]};n.sections===void 0?Ot(n,s,0,0):Ln(n,s);let o={files:s.files};return xt.set(o,{...Cn(s.parts),nameList:s.names}),o}var Fn=/\r\n?|[\n\u2028\u2029]/gu;function $t(e){let t=[0];for(let n of e.matchAll(Fn))t.push(n.index+n[0].length);return t}function vt(e,t,n,s){let[o,r]=[t,n];for(;o<r;){let i=o+r>>1;e[i]<=s?o=i+1:r=i}return o-1}function L(e,t){let n=vt(e,0,e.length,t);return[n,t-e[n]]}function Tn(e,[t,n]){if(t>=e.starts.length-1)return-1;let s=e.starts[t],o=vt(e.columns,s,e.starts[t+1],n);return o<s?-1:o}function Et(e,t,n,s){let o=ae(e),r=L(t,n),[i,c]=L(t,s),a=new Map,u=Tn(o,r);for(let l=r[0];l<=i&&l<o.starts.length-1;l++){let p=l===r[0]&&u>=0?u:o.starts[l];for(let d=p;d<o.starts[l+1];d++){let g=o.sources[d];if(l===i&&o.columns[d]>=c)break;g>=0&&a.set(g,(a.get(g)??0)+1)}}let[f]=[...a].reduce((l,p)=>p[1]>l[1]?p:l,[-1,0]);return f<0?null:e.files[f]}var pe=/\s+/uy,Mt=`
|
|
2
|
+
\r\u2028\u2029`,de=/[\n\r\u2028\u2029]/gu,kt=/[\n\r\u2028\u2029]/u,j=/[\w$\u0080-]+/uy,jt=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","default","extends","do","else","yield","await"]),Bn=new Set(["if","while","for","with"]),At=new Set(["break","continue","debugger"]),Dn=new Set(["(","[","${",",","=",":","?","!","~","+","-","*","/","%","&","|","^","<",">"]);function Wn(e,t){return e?.type!=="word"?Dn.has(e?.value):t&&["return","yield"].includes(e.value)?!1:jt.has(e.value)&&!["do","else"].includes(e.value)}function Un(e){let t=e.at(-1);return t?.type==="word"&&(Bn.has(t.value)||t.value==="await"&&e.at(-2)?.value==="for")}function Jn(e){return e?e.type==="word"?jt.has(e.value)||At.has(e.value)||e.label===!0:e.value===")"?e.control:e.value==="}"?!e.object:e.type==="punctuator"&&!["++","--","]"].includes(e.value):!0}var Gn=(e,t)=>e.startsWith(`\r
|
|
3
|
+
`,t+1)?3:2,Kn=/\\(?:u\{([\da-f]+)\}|u([\da-f]{4})|x([\da-f]{2})|([0-3][0-7]{0,2}|[4-7][0-7]?)|(\r\n|[\n\r\u2028\u2029])|(.))/giu,qn={b:"\b",f:"\f",n:`
|
|
4
|
+
`,r:"\r",t:" ",v:"\v"};function _t(e){return e.includes("\\")?e.replace(Kn,(t,n,s,o,r,i,c)=>{if(i!==void 0)return"";if(r!==void 0)return String.fromCodePoint(Number.parseInt(r,8));let a=Number.parseInt(n??s??o,16);return Number.isNaN(a)?qn[c]??c:String.fromCodePoint(Math.min(a,1114111))}):e}function Hn(e,t){let n=e[t],s=t+1;for(;s<e.length&&e[s]!==n&&!Mt.includes(e[s]);)s+=e[s]==="\\"?Gn(e,s):1;return[e[s]===n?_t(e.slice(t+1,s)):null,s+1]}function Vn(e,t){let n=t+1,s=!1;for(;n<e.length&&!Mt.includes(e[n])&&(s||e[n]!=="/");)e[n]==="\\"?n++:e[n]==="["?s=!0:e[n]==="]"&&(s=!1),n++;return j.lastIndex=n+1,j.test(e)?j.lastIndex:n+1}function Zn(e,t,n){for(let s=t;s<e.length;s++)if(e[s]==="\\")s++;else{if(e[s]==="`")return s+1;if(e[s]==="$"&&e[s+1]==="{")return n.push("template"),s+2}return e.length}function Xn(e){let t=[],n=[],s=[],o=0,r=0;for(;o<e.length;){let i=t.length;if(pe.lastIndex=o,pe.test(e)&&(o=pe.lastIndex),o>=e.length)break;let c=e[o],a=e[o+1];if(j.lastIndex=o,c==="/"&&a==="/")de.lastIndex=o+2,o=de.test(e)?de.lastIndex-1:e.length;else if(c==="/"&&a==="*"){let u=e.indexOf("*/",o+2);o=u<0?e.length:u+2}else if(c==='"'||c==="'"){let[u,f]=Hn(e,o);t.push({type:"string",value:u}),o=f}else if(c==="`"||c==="}"&&n.at(-1)==="template"){c==="}"&&n.pop();let u=n.length,f=Zn(e,o+1,n),l=c==="`"&&n.length===u&&e[f-1]==="`";t.push({type:"string",value:l?_t(e.slice(o+1,f-1)):null}),n.length>u&&t.push({type:"punctuator",value:"${"}),o=f}else if(c==="/"&&Jn(t.at(-1)))o=Vn(e,o),t.push({type:"regex"});else if(j.test(e)){let u=At.has(t.at(-1)?.value)&&!kt.test(e.slice(r,o));t.push({type:"word",value:e.slice(o,j.lastIndex),...u&&{label:u}}),o=j.lastIndex}else{c==="{"&&n.push(Wn(t.at(-1),kt.test(e.slice(r,o)))?"object":"block");let u=c==="}"?n.pop():void 0;c==="("&&s.push(Un(t));let f=(c==="+"||c==="-")&&a===c||c==="="&&a===">"?c+a:c;t.push({type:"punctuator",value:f,...c===")"&&{control:s.pop()===!0},...c==="}"&&{object:u==="object"}}),o+=f.length}t.length>i&&(r=o)}return t}var me=e=>e?.type==="string"&&e.value!==null,zt=new Set(["type","typeof"]),Yn=(e,t)=>e[t+1]?.type==="word"&&!(e[t+1].value==="as"&&e[t+2]?.type==="word"&&e[t+2].value!=="as");function Qn(e,t){let n=!1;for(let s=t+1;s<e.length&&e[s].value!=="}";s++)if(!(s>t+1&&e[s-1].value!==",")){if(!zt.has(e[s].value)||!Yn(e,s))return!1;n=!0}return n}function es(e,t){for(let n=t;n<e.length;n++){let{value:s}=e[n];if(s===";"||n>t&&(s==="import"||s==="export"))return null;if(s==="from"&&me(e[n+1]))return e[n+1].value}return null}function ts(e,t){let[n,s,o]=[e[t].value,e[t+1],e[t+2]],r=n==="import"?"import":"export-from";if(n==="import"&&me(s))return{kind:r,specifier:s.value};if(zt.has(s?.value)&&![",","from"].includes(o?.value)||s?.value==="{"&&Qn(e,t+1)||n==="export"&&!["{","*"].includes(s?.value)||n==="import"&&s?.type!=="word"&&!["{","*"].includes(s?.value))return null;let i=es(e,t+1);return i===null?null:{kind:r,specifier:i}}function ns(e,t){let[n,s]=[e[t+2],e[t+3]];if(n?.value!==")")return me(n)&&[")",","].includes(s?.value)?n.value:null}function It(e,t=new Set){let n=Xn(e),s=[];for(let[o,r]of n.entries()){if(r.type!=="word"||[".","#","function"].includes(n[o-1]?.value)||n[o-1]?.value==="="&&n[o-3]?.value==="type"&&n[o-4]?.value==="import")continue;let i=n[o+1]?.value==="(",c=i?ns(n,o):void 0;if((r.value==="require"||t.has(r.value))&&c!==void 0)s.push({kind:"require",specifier:c,...r.value!=="require"&&{callee:r.value}});else if(r.value==="import"&&i)c!==void 0&&s.push({kind:"dynamic-import",specifier:c});else if(r.value==="import"||r.value==="export"){let a=ts(n,o);a&&s.push(a)}}return s}var ss=/^[\w$]*__d\(/gmu,os=([e,t,n,...s])=>(typeof e=="number"||typeof e=="string")&&(t===void 0||typeof t=="object")&&(n===void 0||typeof n=="string")&&s.length===0;function Rt(e){let t=/\);?\s*$/u.exec(e)?.index,n=null,s=t===void 0?-1:e.lastIndexOf("},",t);for(;s>=0&&/[\d"]/u.test(e[s+2]);){let o;try{o=JSON.parse(`[${e.slice(s+2,t)}]`)}catch{break}if(!os(o))break;n=o,s=s>0?e.lastIndexOf("},",s-1):-1}return n}function rs(e){let t=/^[^(]*\(\s*(?:function\s*[\w$]*\s*)?\(([^)]*)\)/u.exec(e)?.[1].split(",").slice(1,4).map(s=>s.trim().replaceAll("$","\\$"));if(!t?.length)return[];let n=e.matchAll(new RegExp(`(?<=[^\\w$.#]|\\.\\.\\.)(?:${t.join("|")})\\((\\d+|"(?:[^"\\\\]|\\\\.)*")[,)]`,"gu"));return[...new Set([...n].map(s=>JSON.parse(s[1])))]}function is(e,t){if(Array.isArray(e))return e;let n=Object.entries(e??{}).filter(([s])=>/^\d+$/u.test(s)).map(([,s])=>s);return n.length>0?n:rs(t)}function cs(e,t){let n=new Map(t.files.map((o,r)=>[o,r])),s=e.flatMap((o,r)=>o.file?[{k:r,at:n.get(o.file)}]:[]);for(let o=0;o<(s[0]?.k??0);o++)e[o].file=t.files[s[0].at-s[0].k+o]??null;for(let[o,{k:r,at:i}]of s.entries()){let c=s[o+1];if(!(c&&c.at-i!==c.k-r))for(let a=r+1;a<(c?.k??e.length);a++)e[a].file=t.files[i+a-r]??null}}function us(e,t){let n=[...e.matchAll(ss)].map(u=>u.index);if(n.length===0)return null;let s=$t(e),o=u=>e.slice(s[u],s[u+1]),r=[];for(let[u,f]of n.entries()){let[l]=L(s,f),[p]=L(s,(n[u+1]??e.length)-1),d=Rt(o(p));for(;!d&&p>l;)d=Rt(o(--p));if(!d)throw new Error(`bundleEdges: the Metro module at line ${l+1} ends in no define params`);let g=s[p+1]??e.length;r.push({id:d[0],file:Et(t,s,f,g),dependencies:is(d[1],e.slice(f,g))})}cs(r,t);let i=new Map(r.map(u=>[u.id,u])),{edges:c,link:a}=ce();for(let{file:u,dependencies:f}of r)for(let l of f)a(u,i.get(l)?.file,"dependency");return c}var ls=e=>e.path!==null&&!["json",null].includes(ie(e.path)),Nt=e=>e.path!==null&&ie(e.path)===null;function Ct(e){let t=/^_([A-Za-z]+)\d+$/u.exec(e)?.[1];if(t)return[t,"interopRequireDefault"];let n=/^_(interopRequire(?:Default|Wildcard)|jsx(?:Dev)?Runtime|callSuper)$/u.exec(e)?.[1];return n==="callSuper"?["getPrototypeOf","possibleConstructorReturn","interopRequireDefault"]:n?[n]:[]}var as={jsxRuntime:"react/jsx-runtime",jsxDevRuntime:"react/jsx-dev-runtime"};function fs(e){let{sources:t,names:n,nameList:s}=ae(e),o=new Map,r=new Map,i=e.files.map(()=>new Set);for(let c=0;c<n.length;c++)n[c]<0||t[c]<0||(r.has(n[c])||r.set(n[c],Ct(s[n[c]]).length>0),r.get(n[c])&&i[t[c]].add(s[n[c]]));for(let[c,a]of i.entries()){if(a.size===0)continue;let u=e.files[c],f=new Set(Array.from((u.content??"").matchAll(/(?:function|var|let|const)\s+(_[A-Za-z]+\d*)\b/gu),p=>p[1])),l=[...a].filter(p=>!f.has(p)&&!f.has(p.replace(/\d+$/u,""))).flatMap(Ct);l.length>0&&o.set(u,l.map(p=>as[p]??`@babel/runtime/helpers/${p}`))}return o}function ps(e,t){let n=new Map;for(let[r,i]of e){let c=n.get(r)??n.set(r,new Map).get(r);for(let a of i)c.set(a,ue(t,r,a,()=>null))}let s=new Set([...n.values()].flatMap(r=>[...r.values()].map(i=>i.to))),o=(r,i)=>t.byRoot.get(i).find(c=>!s.has(c))??t.byRoot.get(i)[0];return(r,i)=>{let c=n.get(r)?.get(i);return c?.to?c:ue(t,r,i,o)}}var Pt=e=>/(?:^|\/)__prelude__$/u.test(e.source??""),Lt=e=>e?.package?.name==="metro-runtime"&&e.package.path==="src/polyfills/require.js";function ds(e){if(!e.files.some(Pt)&&!Lt(e.files[0]))return null;if(!e.files.some(l=>l.content!==null&&!Pt(l)&&!Lt(l)))throw new Error("bundleEdges: the Metro map carries no sourcesContent, which its edges are read from; pass the bundle as `code`");let t=yt(e.files),n=e.files[e.files.findIndex(Nt)+1],s=e.files.find(l=>l.package?.name==="metro-runtime"&&l.package.path==="src/modules/asyncRequire.js"),o=new Map(e.files.filter(l=>l.content!==null&&ls(l)).map(l=>[l,It(l.content)])),r=fs(e),i=[...o].map(([l,p])=>[l,p.flatMap(({specifier:d})=>d===null?[]:[d])]),c=ps([...i,...r],t),{edges:a,add:u,link:f}=ce();for(let l of e.files){Nt(l)&&f(l,n,"dependency");for(let{kind:p,specifier:d}of o.get(l)??[]){let g=d===null?{to:null}:c(l,d);g.to!==l&&u(l,`${p}\0${JSON.stringify(d)}`,{from:l,kind:p,specifier:d,...g}),p==="dynamic-import"&&f(l,s,"dependency")}for(let p of r.get(l)??[])f(l,c(l,p).to,"dependency")}return a}var ms=(e,t)=>t==null?ds(e):us(t,e);function ge(e,t){let n=ms(e,t);if(!n)throw new Error(`bundleEdges: not a Metro ${t==null?"map":"bundle"}; edges-lite.js reads only those, edges.js reads others`);return{edges:n}}function Ft(e){let t=JSON.parse(e.replace(/^\)\]\}'[^\n]*\n/u,"")),n=fe(t),s=t.sections?t.sections.reduce((o,r)=>o+(r.map.names?.length??0),0):t.names?.length??null;return{json:{version:t.version,file:t.file,sourceRoot:t.sourceRoot},map:n,namesCount:s}}function F(e){if(e.map)return e.map.files.flatMap(n=>n.source===null?[]:[[n.source,n.content]]);let t=e.json?.sourcesContent??[];return(e.json?.sources??[]).map((n,s)=>[n,t[s]??null])}function gs(e,t){let n=new Map;for(let{from:s,to:o,specifier:r}of t(e).edges){if(s.source===null||o?.source==null||o.source===s.source)continue;let i=typeof r=="string"?[s.source,o.source,r]:[s.source,o.source];n.set(i.join("\0"),i)}return[...n.values()]}function hs(e){try{return ge(e)}catch{return{edges:[]}}}var bs=Object.freeze([]);function Z(e){return e?.edges?e.edges:e?.map?(e.edges=gs(e.map,hs),e.edges):bs}var he=new WeakMap,be=new WeakMap;function Zs(e){let t=Z(e);if(!he.has(t)){let n=new Map;for(let[s,o]of t)n.has(s)||n.set(s,new Set),n.get(s).add(o);he.set(t,n)}return he.get(t)}function Xs(e){let t=Z(e);if(!be.has(t)){let n=new Map;for(let[s,o,r]of t)r!==void 0&&(n.has(s)||n.set(s,new Map),n.get(s).set(r,o));be.set(t,n)}return be.get(t)}var ye=new WeakMap,we=new WeakMap,Se=new WeakMap,xe=new WeakMap,Oe=new WeakMap,$e=new WeakMap;function X(e){if(e?.metadataOnly)return new Map;let t=e?.bundle??e?.json;if(t&&ye.has(t))return ye.get(t);let n=new Map;if(!e)return n;if(e.kind==="stasis"){if(!e.bundle)return n;let s=e.bundle.formats;for(let[o,r]of e.bundle.sources)typeof r=="string"&&(S.isResourceFormat(s?.get(o))||n.set(o,r))}else if(e.kind==="sourcemap")for(let[s,o]of F(e))typeof o=="string"&&n.set(s,o);return t&&ye.set(t,n),n}function no(e){let t=1;for(let n=e.indexOf(`
|
|
5
|
+
`);n!==-1;n=e.indexOf(`
|
|
6
|
+
`,n+1))t++;return t}var Tt=new WeakMap;function so(e){let t=Tt.get(e);if(!t){let n=[...e.keys()].toSorted();t={paths:n,numbers:new Map(n.map((s,o)=>[s,o+1]))},Tt.set(e,t)}return t}function Bt(e){let t=e?.bundle??e?.json;if(t&&we.has(t))return we.get(t);let n=new Map(X(e));for(let[s,o]of e?.npmBinaries??[])n.set(s,{format:"digest",...o});if(e?.kind==="stasis"&&e.bundle){let s=e.bundle.formats;for(let[o,r]of e.bundle.sources){if(typeof r!="string")continue;let i=s?.get(o);i==="resource"?n.set(o,r):i==="resource:base64"&&n.set(o,{format:"base64",data:r})}}return t&&we.set(t,n),n}var ys="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function ws(e){let t=e.endsWith("=");if(t?e.length%4!==0||e.at(-3)==="=":e.length%4===1)return null;let n=t?e.slice(0,e.endsWith("==")?-2:-1):e;if(/[^A-Za-z0-9+/]/u.test(n))return null;let s=n.length%4;return s>1&&ys.indexOf(n.at(-1))&(s===2?15:3)?null:Math.floor(n.length*3/4)}function Ss(e){return typeof e=="string"?B(e):e?.format==="digest"?e.size:e?.format==="base64"?ws(e.data):null}function T(e){if(e?.fileSizes)return e.fileSizes;let t=e?.bundle??e?.json;if(t&&Se.has(t))return Se.get(t);let n=new Map,s=Bt(e),o=e?.kind==="stasis"?e.bundle?.sources.keys():e&&F(e).map(([r])=>r);for(let r of o??[])n.set(r,Ss(s.get(r)));return t&&Se.set(t,n),n}function ve(e){if(e?.metadataOnly)return e.unsizedFiles??new Set;let t=T(e);if($e.has(t))return $e.get(t);let n=new Set;for(let s of Bt(e).keys())t.get(s)===null&&n.add(s);return $e.set(t,n),n}function oo(e){let t=T(e);if(Oe.has(t))return Oe.get(t);let n=ve(e),s=e?.kind==="stasis"?e.bundle?.formats:null,o=new Map;for(let[r,i]of t)i===null&&!n.has(r)||o.set(r,S.isResourceFormat(s?.get(r))||e?.npmBinaries?.has(r)?"resource":"source");return Oe.set(t,o),o}function ro(e){let t=T(e),n=e?.kind==="stasis"?e.bundle?.formats:null;if(!n||n.size===0)return t;if(xe.has(t))return xe.get(t);let s=new Map;for(let[o,r]of t)S.isResourceFormat(n.get(o))||s.set(o,r);return xe.set(t,s),s}function xs(e){if(e?.kind!=="stasis"||!e.bundle?.modules)return null;let t=new Map;for(let[n,s]of e.bundle.modules)for(let o of Object.keys(s.files))t.set(n==="."?o:`${n}/${o}`,n);return t}function io(e,t=null,n=(s,o)=>o.name){let s=new Map;if(e?.kind!=="stasis"||!e.bundle?.modules)return s;let o=t===null?null:xs(e),r=t===null?null:new Set([...t].map(i=>o?.get(i)));for(let[i,c]of e.bundle.modules){if(r&&!r.has(i)||!i.includes("node_modules")||!c?.name||typeof c.version!="string"||!c.version)continue;let a=n(i,c),u=s.get(a);u||(u=new Set,s.set(a,u)),u.add(c.version)}return s}var Os=6,Ee=Os,Y=new WeakMap,$s=new Set(["terminal","code","search","compare"]);function bo(e,t=null){return!!t||$s.has(e)}var vs=/^sha512-[A-Za-z0-9+/]{86}==$/u;function Es(e){if(e.fileHashes)return Promise.resolve(e.fileHashes);if(Y.has(e))return Y.get(e);let t=(async()=>{let n=[...X(e)],s=new Map;for(let o=0;o<n.length;o+=32){let r=await Promise.all(n.slice(o,o+32).map(async([i,c])=>[i,await Ae(c)]));for(let[i,c]of r)s.set(i,c)}return e.fileHashes=s,s})();return Y.set(e,t),t.catch(()=>Y.delete(e)),t}function ks(e){if(typeof e!="string")return 0;let t=/\S/gu,n=/[\r\n]/gu,s=0;for(;t.test(e)&&(s++,n.lastIndex=t.lastIndex,!!n.test(e));)t.lastIndex=n.lastIndex;return s}function Ms(e){return e.lineCounts??=new Map([...X(e)].map(([t,n])=>[t,ks(n)]))}function ke(e){return e instanceof Map?Object.fromEntries([...e].map(([t,n])=>[t,ke(n)])):e}async function yo(e){let t=await Es(e),n=T(e),s=Ms(e),o={version:Ee,integrity:e.integrity,kind:e.kind,size:e.size,codeStats:Q(s,n),files:[...n].map(([i,c])=>[i,c,t.get(i)??null,s.get(i)??null])},r=ve(e);if(r.size>0&&(o.unsized=[...r]),e.kind==="sourcemap"){let{version:i,file:c,sourceRoot:a,names:u}=e.json,f=F(e);o.json={version:i,file:c,sourceRoot:a,sources:f.map(([p])=>p)},o.sourceSizes=f.map(([,p])=>typeof p=="string"?B(p):null),o.namesCount=e.namesCount??u?.length??null;let l=new Map(o.files.map(([p],d)=>[p,d]));o.edges=Z(e).map(([p,d,...g])=>[l.get(p),l.get(d),...g])}else{let i=e.bundle,c={version:i.version,config:i.config,repo:i.repo,package:i.package,formats:ke(i.formats),imports:ke(i.imports),reason:i.reason,executable:[...i.executable]};if(i.version===0)c.sources=Object.fromEntries([...n.keys()].map(a=>[a,null]));else{let a={},u={};for(let[f,l]of i.modules){let p=f.split("/").includes("node_modules")?a:u;Object.defineProperty(p,f,{enumerable:!0,value:{name:l.name,version:l.version,ecosystem:l.ecosystem,repo:l.repo,files:Object.fromEntries(Object.keys(l.files).map(d=>[d,null]))}})}c.modules=a,i.config.scope==="full"&&(c.sources=u,c.entries=[...i.entries])}o.bundle=c}return o}function wo(e,t){if(![1,2,3,4,5,Ee].includes(e?.version)||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 n=e.version!==Ee,s=e.version===1,o=new Map,r=new Map,i=new Map;for(let u of e.files){if(!Array.isArray(u)||u.length!==4&&!(s&&u.length===3))throw new Error("Invalid bundle metadata file");let[f,l,p,d]=u;if(typeof f!="string"||r.has(f)||l!==null&&(!Number.isSafeInteger(l)||l<0)||p!==null&&(typeof p!="string"||!vs.test(p))||l===null&&p!==null||s&&l!==null&&p===null||d!=null&&(!Number.isSafeInteger(d)||d<0))throw new Error("Invalid bundle metadata file");r.set(f,l),p!==null&&o.set(f,p),d!=null&&i.set(f,d)}let c=new Set(e.unsized??[]);if(e.unsized!==void 0&&(s||!Array.isArray(e.unsized)||c.size!==e.unsized.length)||[...c].some(u=>typeof u!="string"||!r.has(u)||r.get(u)!==null))throw new Error("Invalid bundle metadata");let a={integrity:t,kind:e.kind,size:e.size,metadataOnly:!0,fileSizes:r,fileHashes:o,lineCounts:i,unsizedFiles:c,stale:n};if(e.kind==="stasis"){a.bundle=S.parse(JSON.stringify(e.bundle));let u=a.bundle.sources;if(u.size!==r.size||[...u.keys()].some(l=>!r.has(l)))throw new Error("Invalid bundle metadata inventory");let f=a.bundle.formats;if(!s&&[...r].some(([l,p])=>o.has(l)!==(p!==null&&!S.isResourceFormat(f.get(l)))))throw new Error("Invalid bundle metadata inventory");if([...c].some(l=>f.get(l)!=="resource:base64"))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(u=>!r.has(u))||!Array.isArray(e.sourceSizes)||e.sourceSizes.length!==e.json.sources.length||e.sourceSizes.some(u=>u!==null&&(!Number.isSafeInteger(u)||u<0))||[...r].some(([u,f])=>o.has(u)!==(f!==null))||c.size>0)throw new Error("Invalid sourcemap inventory");a.json=e.json,a.sourceSizes=e.sourceSizes,a.namesCount=e.namesCount,e.edges!==void 0&&(a.edges=js(e.edges,e.files))}if(e.codeStats===void 0)a.codeStats=Q(i,r);else{let u=e.codeStats,f=l=>Number.isSafeInteger(l)&&l>=0;if(!u||![u.files,u.lines,u.bytes].every(f)||!Array.isArray(u.languages)||u.languages.some(l=>!l||typeof l.key!="string"||typeof l.label!="string"||![l.files,l.lines,l.bytes].every(f)))throw new Error("Invalid bundle code stats");a.codeStats=u}return a}function js(e,t){if(!Array.isArray(e))throw new Error("Invalid sourcemap edges");return e.map(n=>{if(!Array.isArray(n)||![2,3].includes(n.length)||n[0]===n[1]||n.length===3&&typeof n[2]!="string"||n.slice(0,2).some(s=>!Number.isSafeInteger(s)||s<0||s>=t.length))throw new Error("Invalid sourcemap edges");return[t[n[0]][0],t[n[1]][0],...n.slice(2)]})}function So(e,{integrity:t,kind:n,size:s}){if(n==="stasis")return{integrity:t,kind:n,size:s,bundle:S.parse(e)};if(n!=="sourcemap")throw new Error("Unsupported bundle format");return{integrity:t,kind:n,size:s,...Ft(e)}}export{ze as a,Q as b,Ns as c,S as d,Zs as e,Xs as f,X as g,no as h,so as i,Bt as j,Ss as k,T as l,oo as m,ro as n,xs as o,io as p,bo as q,Es as r,ks as s,Ms as t,yo as u,wo as v,So as w};
|