@preventive/triage 1.0.0-alpha.44 → 1.0.0-alpha.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/common/bundle-sources.js +20 -1
  2. package/common/default-scan-models.ts +1 -1
  3. package/common/dependency-reviews.d.ts +0 -5
  4. package/common/dependency-reviews.js +0 -17
  5. package/common/managed/agent-tasks.ts +292 -0
  6. package/common/managed/github-agents.ts +92 -0
  7. package/common/managed/github-logins.ts +49 -0
  8. package/common/managed/roles.ts +7 -0
  9. package/common/managed/routes.js +88 -7
  10. package/common/managed/team-app.d.ts +5 -2
  11. package/common/managed/team-app.js +2 -2
  12. package/common/server-info.ts +3 -0
  13. package/common/workspace-app.js +6 -3
  14. package/out/brotli-fallback.js +3 -3
  15. package/out/chunk-2XUEZHIP.js +18 -18
  16. package/out/chunk-2ZDZWLFY.js +1 -0
  17. package/out/chunk-3PS4KWD2.js +10 -0
  18. package/out/chunk-5DHL5NG3.js +2 -0
  19. package/out/chunk-6HNXNIQY.js +52 -0
  20. package/out/chunk-7C7DWL7I.js +1 -0
  21. package/out/chunk-AFLZH7WG.js +1 -0
  22. package/out/chunk-BC2UCLFJ.js +1 -0
  23. package/out/chunk-C4Z6ZBXV.js +6 -6
  24. package/out/chunk-GDPCLSOS.js +2 -0
  25. package/out/chunk-GO7FT4OD.js +1 -0
  26. package/out/chunk-HMAJDVXN.js +1 -0
  27. package/out/chunk-I2MDGSQX.js +3 -0
  28. package/out/chunk-IYPY47MC.js +1 -0
  29. package/out/chunk-IZ7POWI3.js +18 -0
  30. package/out/chunk-JCIIBLKR.js +1 -1
  31. package/out/chunk-NPW52BM2.js +17 -0
  32. package/out/chunk-NRPC74AM.js +1 -1
  33. package/out/chunk-NV7ES4EW.js +1 -0
  34. package/out/chunk-OKRLLE5I.js +17 -0
  35. package/out/chunk-OOJM4CTU.js +1 -1
  36. package/out/chunk-PNHBZGDD.js +1 -1
  37. package/out/chunk-PTGDYLNS.js +36 -0
  38. package/out/chunk-PXK7EU4V.js +1 -0
  39. package/out/chunk-Q6MVYGYV.js +3 -0
  40. package/out/chunk-QB4CBOX2.js +1 -0
  41. package/out/chunk-QRD6GIG5.js +229 -0
  42. package/out/chunk-R3NZFXVR.js +1 -0
  43. package/out/chunk-R5O6FAW4.js +1 -1
  44. package/out/chunk-SXV2T5C4.js +80 -0
  45. package/out/chunk-TUII34K2.js +1 -1
  46. package/out/chunk-VFWMQ3LG.js +2 -0
  47. package/out/chunk-VH4XMZIW.js +2 -0
  48. package/out/chunk-WFYLMF6Z.js +10 -0
  49. package/out/chunk-WI7Z5A2T.js +6 -0
  50. package/out/chunk-WQ74ZBZF.js +7 -0
  51. package/out/chunk-XVBEOGOS.js +3 -0
  52. package/out/client-managed-import.js +3 -3
  53. package/out/client-managed.js +31 -35
  54. package/out/client-sync.js +11 -11
  55. package/out/compare.js +35 -0
  56. package/out/dialogs.js +51 -0
  57. package/out/github-issue-authorized.html +1 -1
  58. package/out/github-issue-authorized.js +1 -1
  59. package/out/graph.js +17 -17
  60. package/out/index.html +30 -34
  61. package/out/prism.js +14 -14
  62. package/out/scan.js +2 -0
  63. package/out/terminal.js +294 -293
  64. package/out/view.css +1 -1
  65. package/out/view.js +16 -107
  66. package/package.json +51 -6
  67. package/risk/actions/findings.js +156 -0
  68. package/risk/actions/resolve.js +219 -0
  69. package/risk/actions/scripts/commands.js +182 -0
  70. package/risk/actions/scripts/grade.js +113 -0
  71. package/risk/actions/scripts/packages.js +123 -0
  72. package/risk/actions/scripts/shell.js +165 -0
  73. package/risk/actions/uses.js +76 -0
  74. package/risk/actions/workflow.js +110 -0
  75. package/risk/files/hosts.js +6 -6
  76. package/risk/files/readability.js +23 -17
  77. package/risk/files/runs-code.js +18 -6
  78. package/risk/files/script.js +7 -3
  79. package/risk/files/stamps.js +8 -7
  80. package/risk/index.d.ts +68 -1
  81. package/risk/index.js +6 -2
  82. package/risk/npm/assess.js +1 -1
  83. package/risk/npm/compare.js +34 -10
  84. package/risk/npm/files.js +413 -2
  85. package/risk/npm/tarball.js +56 -73
  86. package/server-managed/agent-merges.ts +198 -0
  87. package/server-managed/app-agents.ts +30 -0
  88. package/server-managed/avatar-store.ts +1 -0
  89. package/server-managed/commit-coauthors.ts +83 -0
  90. package/server-managed/commit-lockfiles.ts +62 -0
  91. package/server-managed/db-methods.ts +29 -10
  92. package/server-managed/db-neon.ts +30 -2
  93. package/server-managed/db-schema.ts +9 -2
  94. package/server-managed/db.ts +7 -0
  95. package/server-managed/dependabot-access.ts +60 -0
  96. package/server-managed/dependabot-alerts.ts +185 -0
  97. package/server-managed/dependency-review-comments.ts +97 -0
  98. package/server-managed/dependency-reviews.ts +65 -15
  99. package/server-managed/github-accounts.ts +33 -0
  100. package/server-managed/github-actions.ts +71 -0
  101. package/server-managed/github-app.ts +23 -9
  102. package/server-managed/github-errors.ts +2 -0
  103. package/server-managed/github-link-oauth.ts +69 -0
  104. package/server-managed/github-links.ts +204 -0
  105. package/server-managed/github-oauth.ts +5 -2
  106. package/server-managed/github-users.ts +30 -0
  107. package/server-managed/http.ts +1122 -52
  108. package/server-managed/index.ts +6 -2
  109. package/server-managed/locked-packages.ts +37 -16
  110. package/server-managed/lockfile-scope.ts +49 -0
  111. package/server-managed/npm-delta-worker.js +23 -0
  112. package/server-managed/npm-delta.ts +173 -0
  113. package/server-managed/npm-insights.ts +20 -11
  114. package/server-managed/npm-kept.ts +51 -4
  115. package/server-managed/npm-loads.ts +20 -13
  116. package/server-managed/npm-packages.ts +24 -64
  117. package/server-managed/pull-comment-reviews.ts +161 -0
  118. package/server-managed/pull-dependencies.ts +280 -0
  119. package/server-managed/pull-dependency-reviews.ts +318 -0
  120. package/server-managed/pull-reviews.ts +205 -0
  121. package/server-managed/release-commits.ts +84 -0
  122. package/server-managed/repository-actions.ts +209 -0
  123. package/server-managed/repository-agents.ts +220 -0
  124. package/server-managed/repository-browser.ts +54 -13
  125. package/server-managed/repository-changes.ts +284 -0
  126. package/server-managed/repository-code.ts +52 -0
  127. package/server-managed/repository-dependency-reviews.ts +135 -0
  128. package/server-managed/repository-history.ts +445 -0
  129. package/server-managed/repository-issues.ts +181 -0
  130. package/server-managed/repository-pulse.ts +432 -0
  131. package/server-managed/repository-risk-read.ts +165 -0
  132. package/server-managed/repository-risk.ts +113 -105
  133. package/server-managed/reviewed-dependencies.ts +149 -0
  134. package/server-managed/session.ts +9 -5
  135. package/server-managed/sql.ts +1 -1
  136. package/server-managed/storage-stores.ts +5 -0
  137. package/server-managed/team-app.ts +19 -3
  138. package/server-managed/workspace-shares.ts +4 -1
  139. package/server.ts +11 -0
  140. package/out/chunk-2ABLKCOY.js +0 -46
  141. package/out/chunk-2KBF5TZ7.js +0 -2
  142. package/out/chunk-35VE6CDH.js +0 -2
  143. package/out/chunk-3BZ7JERB.js +0 -1
  144. package/out/chunk-4XCDFGDP.js +0 -10
  145. package/out/chunk-5LSXOLUS.js +0 -1
  146. package/out/chunk-5RCM2J63.js +0 -1
  147. package/out/chunk-7B6HB4D7.js +0 -1
  148. package/out/chunk-AJ4GTATZ.js +0 -3
  149. package/out/chunk-CH4UN6WK.js +0 -225
  150. package/out/chunk-CMQA4DM6.js +0 -1
  151. package/out/chunk-CVVJAXVY.js +0 -2
  152. package/out/chunk-DIJJNTRH.js +0 -10
  153. package/out/chunk-EDKLBQQN.js +0 -17
  154. package/out/chunk-F47DXCEV.js +0 -33
  155. package/out/chunk-FK3DZEKL.js +0 -1
  156. package/out/chunk-G6AJWENO.js +0 -1
  157. package/out/chunk-GJ4IUCNS.js +0 -1
  158. package/out/chunk-GNXOKIGP.js +0 -80
  159. package/out/chunk-GZ4MS3TE.js +0 -13
  160. package/out/chunk-GZWM7UQM.js +0 -2
  161. package/out/chunk-IU3CCINR.js +0 -3
  162. package/out/chunk-K3X5EJBQ.js +0 -2
  163. package/out/chunk-KEX2ATEW.js +0 -2
  164. package/out/chunk-KYCNJVB7.js +0 -1
  165. package/out/chunk-LPCTJYNA.js +0 -7
  166. package/out/chunk-O4RJY5TP.js +0 -2
  167. package/out/chunk-OD4LPN3H.js +0 -1
  168. package/out/chunk-QWDWTBM7.js +0 -1
  169. package/out/chunk-QYWKC557.js +0 -1
  170. package/out/chunk-R75XOKUP.js +0 -1
  171. package/out/chunk-SWTLADW5.js +0 -1
  172. package/out/chunk-T7OKH4VW.js +0 -1
  173. package/out/chunk-TZ5KB2Y5.js +0 -10
  174. package/out/chunk-UNTRGE26.js +0 -2
  175. package/out/chunk-UTR2LVME.js +0 -2
  176. package/out/chunk-UYAXVRVL.js +0 -1
  177. package/out/chunk-V3ME6FI5.js +0 -2
  178. package/out/chunk-V5O7M2YT.js +0 -1
  179. package/out/chunk-VIHGO77Y.js +0 -1
  180. package/out/chunk-W4J3MGLB.js +0 -1
  181. package/out/chunk-WGG7KQUH.js +0 -1
  182. package/out/chunk-XYFXXB2G.js +0 -10
  183. package/out/chunk-ZESLQCTF.js +0 -6
@@ -0,0 +1,36 @@
1
+ import{b as e,h as t}from"./chunk-I2MDGSQX.js";import{a as n}from"./chunk-3PS4KWD2.js";import{a as r,b as i,e as a}from"./chunk-IYPY47MC.js";import{A as o,B as s,E as c,b as l,c as u,d,j as f,m as p,p as m,s as h,t as g,w as _,z as v}from"./chunk-SXV2T5C4.js";import{A as ee,b as y,c as b,i as te,w as x,y as S}from"./chunk-WFYLMF6Z.js";import{a as C,b as w,c as T}from"./chunk-C4Z6ZBXV.js";import{c as E,f as D,g as O,i as ne}from"./chunk-2XUEZHIP.js";function k(e){return e.id??String(e._id)}function re(e){let t=m(e);return t!==``&&t!==`revalidation`}var ie=[{value:`confirmed`,label:`Confirmed`,kinds:[`confirmed`,`partial`,`revalidation`]},{value:`unreachable`,label:`Unreachable`,kinds:[`unreachable`]},{value:`refuted`,label:`Refuted`,kinds:[`refuted`]}];function ae(e){return ie.find(t=>t.value===e)?.kinds??null}var oe=[``,`exclude`,`only`];function A(e,t){let n=ae(e);return n?.includes(`partial`)?t===`only`?[`partial`]:t===`exclude`?[`confirmed`]:n:n}function j(e){if(e.confidence!==void 0)return e.confidence;if(e.critical===!0||e._source)return 10}var se=e=>e.confidence!==void 0||e.critical===!0;function ce(e){return e.every(e=>e.every(e=>j(e)!==void 0))&&e.some(e=>e.some(se))}function le(e,t,n){return e.some(e=>{let r=[`refuted`,`unreachable`].includes(n(e))?0:j(e);return r===void 0?t===0:r>=t})}function ue(e,t){let n=e.map(t).filter(e=>e.length>0);if(!n.some(e=>e.some(e=>j(e)!==void 0)))return 0;let r=e=>n.reduce((t,n)=>t+ +!!n.some(t=>(j(t)??-1)>=e),0),i;for(i=r(6)<=25?6:r(7)<=25?7:8;i>0&&r(i-1)===r(i);)i--;return i}function de(e,t){return ce(e)?t:0}function fe(e,t,n){let r=new Set(e.ruledOutIds??[]);for(let t of e)for(let e of t)[`refuted`,`unreachable`].includes(n(e))&&r.add(k(e));for(let i of e){let e=t(i);if(e.length!==0&&e.some(e=>A(`confirmed`,``).includes(n(e)||(e._source&&!e._sourcePass?`revalidation`:``)))){for(let e of i)if(r.add(k(e)),e.isApp&&Array.isArray(e.revalidateInputs))for(let t of e.revalidateInputs)t&&r.add(t)}}return r}function pe(e,t,n,r){let i=de(e,t),a=e.filter(e=>le(e,i,r));if(a.length===0)return!1;let o=new Set(A(`confirmed`,``));return e.some(e=>e.some(e=>o.has(r(e))))?a.every(e=>e.every(e=>n.has(k(e)))):!1}function me(e,{tabs:t,kindOf:n,severityMode:r}){let i=e.map(t).filter(e=>e.length>0),a=fe(e,t,n);if(!pe(i,ue(e,t),a,n))return!1;let o=de(i,6);return i.every(e=>!le(e,o,n)||!e.some(e=>p(e,r)!==`low`)||e.every(e=>a.has(k(e))))}var M=!0;function he(e,t=!1){M=e!==!1&&!t}function ge(){return M}function N(e){return M?m(e):``}function _e(e){return m(e)!==``}function ve(e){return e.some(e=>(e.groups??[]).some(e=>e.some(re)))}function ye(e){let t=N(e);return t&&t!==`revalidation`?t:null}function be(e){return N(e)===`revalidation`}var xe=new Set([`refuted`,`unreachable`]);function Se(e){return xe.has(N(e))}function Ce(e){return xe.has(N(e))}function we(e){let t=new Set(e);return ie.filter(e=>e.kinds.some(e=>t.has(e)))}function P(e){return RegExp(`(^|/)${e}/`,`u`)}function Te(e){return RegExp(`^(?:.*/)?${e}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,`u`)}var Ee=P(`node_modules`),De=P(`vendor`),F=`node_modules`,Oe=P(F),ke=Te(F);function Ae(e){e!==F&&(F=e,Oe=P(e),ke=Te(e))}function je(t){Ae(e(t))}function Me(){return F}function I(e){return Oe.test(e)}var L=new WeakSet;function Ne(e){let t=!1;for(let n of e??[])for(let e of n.groups??[])for(let n of e){if(n.isApp!==!1)continue;let e=L.has(n);`isUpstream`in n&&!e||(I(n.file)?(n.isUpstream!==!0&&(t=!0),n.isUpstream=!0,L.add(n)):e&&(t=!0,delete n.isUpstream,L.delete(n)))}return t}function Pe(e){let t=typeof e==`string`?e:``;return Ee.test(t)||De.test(t)||Oe.test(t)}var Fe=/^(.*(?:^|\/)node_modules\/(?:@[^/]+\/[^/]+|[^/]+))(?:\/|$)/u;function Ie(e){return Fe.exec(typeof e==`string`?e:``)?.[1]??null}function Le(e){return typeof e!=`number`||!Number.isFinite(e)?null:n(e)}function Re(e){if(e.length<=1)return{prefix:``,stripped:[...e]};let t=e.map(e=>e.split(`/`)),n=Math.min(...t.map(e=>e.length)),r=0;for(let e=0;e<n-1&&t.every(n=>n[e]===t[0][e]);e++)r=e+1;return r>0&&t[0][r-1].startsWith(`@`)&&r--,r>0&&t[0][r-1]===`node_modules`&&r--,r===0?{prefix:``,stripped:[...e]}:{prefix:`${t[0].slice(0,r).join(`/`)}/`,stripped:t.map(e=>e.slice(r).join(`/`))}}function ze(e){return e.match(ke)?.[1]??e}function Be(e){let t=M?[ye(e),e.revalidateVerdict,e.revalidateRecommendation]:[];return[e.file,e.title,e.description,e.impact,e.reproduction,xt(e),e.recommendation,e.confidenceReason,...t,e.discoveredIn,e.repo?.github].filter(Boolean).join(`
2
+ `).toLowerCase()}function Ve(e){return[typeof e?.category==`string`?e.category.trim():``,h(e,M)].filter(Boolean).join(` · `)}function He(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 Ue(e){if(!e)return``;let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}function We(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 Ge=/^(?:@[\w.-]+\/)?[\w.-]+@[^/\s@]+$/u;function Ke(e){return Ge.test(e||``)}function qe(e){if(e==null||typeof e==`string`)return{id:e??``,prefix:``};let t=c(e);return{id:typeof e.github==`string`?e.github:``,prefix:t?`${t}/`:``}}function Je(e,t,n){if(Ke(e))return null;let r=qe(t);if(r.id)return`https://github.com/${r.id}/blob/HEAD/${r.prefix}${ze(e)}`;if(I(e))return null;let i=qe(n),a=We(i.id);return a?`${a}/blob/HEAD/${i.prefix}${e}`:null}function Ye(e,t){let n=e?.file??``,r=R(e,t);return r?E`<a href="${Xe(r)}" target="_blank" rel="noopener">${n}</a>`:n}function Xe(e){return e.replace(/#L\d+(?:-L?\d+)?$/u,``)}function R(e,t){if(!e)return null;if(s(e.location))return e.location;let n=Je(e.file,e.repo,t);if(!n)return null;let r=parseInt(e.line,10);return Number.isFinite(r)?`${n}#L${r}`:n}var Ze=/^https?:\/\/(?:www\.)?github\.com\/([^/\s]+\/[^/\s]+)\/(?:blob|tree|blame)\/[^/\s]+\/(\S+)$/u,Qe=/#L(\d+)(?:-L?(\d+))?$/u;function $e(e){let t=typeof e==`string`?Ze.exec(e):null;if(!t)return``;let n=t[2],r=Qe.exec(n);if(!r)return`${t[1]}/${n}`;n=n.slice(0,r.index);let i=r[2]?`${r[1]}-${r[2]}`:r[1];return`${t[1]}/${n}:${i}`}var et=/^(?:\s+\S|[-*+] |\d+[.)] |>|#{1,6}(?:[ \t]|$)|\||`{3}|~{3})/u;function tt(e){return e.split(/(\n{2,})/u).map(e=>{if(/^\n+$/u.test(e))return e;let t=e.split(`
3
+ `);return t.some(e=>et.test(e)||B.test(e))?e:t.map(e=>e.trim()).filter(Boolean).join(` `)}).join(``)}function nt(e,t,n){let r=t?/^\n*/u.exec(e)[0]:``,i=e.slice(r.length),a=n?/\n*$/u.exec(i)[0]:``;return r+tt(i.slice(0,i.length-a.length))+a}function rt(e){if(!e)return e;let t=e.replaceAll(`\r
4
+ `,`
5
+ `),n=l(t);if(n.length===0)return tt(t);let r=[],i=0;for(let[e,a]of n)e>i&&r.push(nt(t.slice(i,e),i>0,!0)),r.push(t.slice(e,a)),i=a;return i<t.length&&r.push(nt(t.slice(i),!0,!1)),r.join(``)}var it=/^( *)(`{3,}|~{3,})(.*)$/u,at=/^[a-z0-9+#._-]{1,20}$/u;function ot(e,t){let n=0;for(;n<t&&e[n]===` `;)n++;return e.slice(n)}function st(e){let t=e.split(`
6
+ `),n=it.exec(t[0]),r=(n?.[2]??"```").slice(0,3),i=(n?.[3]??``).trim().split(/\s+/u)[0].toLowerCase(),a=!!(t.length>1?it.exec(t.at(-1)):null)?.[2].startsWith(r),o=n?.[1].length??0,s=t.slice(1,a?-1:void 0);return{lang:at.test(i)?i:``,code:(o>0?s.map(e=>ot(e,o)):s).join(`
7
+ `)}}function ct(e){let t=l(e||``);if(t.length===0)return[e];let n=[],r=0,i=(e,t)=>{let r=(t?e.replace(/^\n+/u,``):e).replace(/\n+$/u,``);r&&n.push(r)};for(let[a,o]of t)a>r&&i(e.slice(r,a),r>0),n.push(st(e.slice(a,o))),r=o;return r<e.length&&i(e.slice(r),!0),n}var z=/^( *)(?:[-*+]|(\d{1,9})[.)]) +(?=\S)/u,B=/^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/u;function lt(e){return/^ */u.exec(e)[0].length}function ut(e){let t=e.length;for(;t>0&&!e[t-1].trim();)t--;return e.slice(0,t).join(`
8
+ `)}function dt(e){let t=typeof e==`string`?e:``;if(!t)return[e];let n=l(t),r=t.split(`
9
+ `),i=[],a=0;for(let e of r)i.push(a),a+=e.length+1;let o=e=>!u(n,i[e])&&!B.test(r[e])&&z.test(r[e]),s=[],c=0,d=0,f=e=>{let t=r.slice(c,e).join(`
10
+ `).replace(/^\n+/u,``).replace(/\n+$/u,``);t.trim()&&s.push(t)};for(;d<r.length;){if(!o(d)){d++;continue}f(d);let e=z.exec(r[d]),t=!!e[2],a=[],l=null,p=!1;for(;d<r.length;){let e=r[d];if(!u(n,i[d])){if(!e.trim()){l.lines.push(``),p=!0,d++;continue}let n=lt(e),r=B.test(e)?null:z.exec(e);if(r&&(!l||n<l.column)){if(!!r[2]!==t)break;l&&a.push(ut(l.lines)),l={column:r[0].length,lines:[e.slice(r[0].length)]},p=!1,d++;continue}if(n<l.column&&(p||ft.test(e)||B.test(e)))break}l.lines.push(ot(e,l.column)),p=!1,d++}l&&a.push(ut(l.lines)),s.push({ordered:t,start:t?Number(e[2]):null,items:a}),c=d}return s.length===0?[e]:(f(r.length),s)}var ft=/^ {0,3}(#{1,6})[ \t]+(\S.*?)(?:[ \t]+#+)?[ \t]*$/u,pt=/^ {0,3}-+[ \t]*$/u;function mt(e){let t=e.split(`
11
+ `),n=[],r=0,i=e=>{let i=t.slice(r,e).join(`
12
+ `).replaceAll(/^(?:[ \t]*\n)+|(?:\n[ \t]*)+$/gu,``);i.trim()&&n.push(i)};return t.forEach((e,a)=>{let o=ft.exec(e),s=B.test(e)&&(a===r||!t[a-1].trim()||!pt.test(e));!o&&!s||(i(a),n.push(o?{level:o[1].length,text:o[2]}:{rule:!0}),r=a+1)}),n.length===0?[e]:(i(t.length),n)}var ht=/^(\d+)(?:\s*-\s*(\d+))?$/u;function V(e){if(typeof e==`number`)return Number.isFinite(e)&&e>=1?{start:Math.floor(e),end:Math.floor(e)}:null;let t=ht.exec(String(e??``).trim());if(!t)return null;let n=parseInt(t[1],10),r=t[2]===void 0?n:parseInt(t[2],10);return!Number.isFinite(n)||n<1||!Number.isFinite(r)||r<1?null:{start:Math.min(n,r),end:Math.max(n,r)}}function gt(e){return e?e.start===e.end?String(e.start):`${e.start}-${e.end}`:``}function _t(e){if(e&&typeof e==`object`){let t=V(e.start);if(!t)return null;let n=V(e.end)??t;return{start:t.start,end:Math.max(t.start,n.end)}}return V(e)}function vt(e,t,n=4){let r=typeof e==`string`&&e!==``?e.split(`
13
+ `):[];if(r.length===0)return{text:``,startLine:1,lines:[]};let i=_t(t),a=i&&{start:Math.min(i.start,r.length),end:Math.min(i.end,r.length)},o=a?Math.max(1,a.start-n):1,s=a?Math.min(r.length,a.end+n):Math.min(r.length,n*2+1),c=r.slice(o-1,s);return{text:c.join(`
14
+ `),startLine:o,lines:c}}function yt(e,t,n,r){if(s(e?.url))return e.url;let i=e?.file;if(typeof i!=`string`||i===``)return null;let a=t?.file??``,o=t?.repo?.github,c=()=>o?R({file:i,line:e?.line,repo:t.repo},null):null;if(r===0&&i===a)return c();let l=Ie(i);return l!==null&&l===Ie(a)?c():Pe(i)?null:o&&!Pe(a)?c():R({file:i,line:e?.line},n)}function bt(e,{spaced:t=!1}={}){let n=Array.isArray(e?.evidence)?e.evidence:[];return n.length===0?``:n.map((e,t)=>{let n=v(e),r=[`${t+1}. ${e.url?`[${n}](${e.url})`:n}`],i=o(e);if(i)for(let e of i.split(`
15
+ `))r.push(` ${e}`);return r.join(`
16
+ `)}).join(t?`
17
+
18
+ `:`
19
+ `)}function xt(e){let t=bt(e);return t?`**Evidence:**
20
+ ${t}`:``}function St(e){let t=/^\[([^\]]+)\]\(([^)\s]+)\)$/u.exec(e);return!t||!s(t[2])?null:{label:d(t[1].trim())||t[2],url:t[2]}}function Ct(e,t){let n=parseInt(e?.line,10);if(!Number.isFinite(n))return O;let r=R(e,t),i=`line ${n}`;return r?E`<a href="${r}" target="_blank" rel="noopener">${i}</a>`:i}function wt(e,t){return!e||!t?null:`${/^https?:/iu.test(e)?e.replace(/\/$/u,``):`https://github.com/${e}`}/commit/${t}`}var Tt=[[`Impact`,`impact`],[`Reproduction`,`reproduction`],[`Recommendation`,`recommendation`],[`Confidence reason`,`confidenceReason`],[`Revalidation verdict`,`revalidateVerdict`],[`Revalidation recommendation`,`revalidateRecommendation`]];function Et(e,t){let n=[];t&&n.push(`Repo: ${t}`);let r=v(e);r&&n.push(`Location: ${r}`),e?.confidence!=null&&n.push(`Confidence: ${e.confidence}/10`);let i=N(e);i&&n.push(`Revalidation: ${i}`);let a=[];n.length>0&&a.push(n.join(`
21
+ `));let{title:o,body:s}=_(e);o&&a.push(`# ${o}`),s&&a.push(s.trim());let c=bt(e,{spaced:!0});c&&a.push(`# Evidence
22
+
23
+ ${c}`);for(let[t,n]of Tt){if(!M&&n.startsWith(`revalidate`))continue;let r=g(e?.[n],e)?.trim();r&&a.push(`# ${t}
24
+
25
+ ${r}`)}return a.join(`
26
+
27
+ `)}function Dt(e,{title:t,body:n,labels:r=[]}={}){let i=We(e);if(!i)return null;let a;try{a=new URL(i).host.toLowerCase()}catch{return null}if(a!==`github.com`)return null;let o=new URLSearchParams;t&&o.set(`title`,t),n&&o.set(`body`,n),r.length>0&&o.set(`labels`,r.join(`,`));let s=o.toString();return s?`${i}/issues/new?${s}`:`${i}/issues/new`}var Ot=/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u,kt=/^[a-zA-Z\d._-]+$/u,At=/^[1-9]\d{0,9}$/u,jt=/^[a-fA-F\d]{7,40}$/u,Mt=/^#[\w-]+$/u,Nt=/^GHSA(?:-[0-9a-z]{4}){3}$/u;function Pt(e){return e.length<=39&&Ot.test(e)}function Ft(e){return e.length<=100&&e!==`.`&&e!==`..`&&kt.test(e)}function It(e){let t;try{t=new URL(e)}catch{return null}if(t.href!==e||t.protocol!==`https:`||t.hostname.toLowerCase()!==`github.com`||t.port||t.username||t.password)return null;let n=t.pathname.split(`/`);if(n.at(-1)===``&&n.pop(),n.length===3&&n[1]===`advisories`){let e=n[2];return Nt.test(e)?{url:`https://github.com/advisories/${e}`,label:e}:null}if(n.length===6&&n[3]===`security`&&n[4]===`advisories`){let[,e,t,,,r]=n;return!Pt(e)||!Ft(t)||!Nt.test(r)?null:{url:`https://github.com/${e}/${t}/security/advisories/${r}`,label:r}}if(n.length!==5)return null;let[,r,i,a,o]=n;if(!Pt(r)||!Ft(i))return null;let s;if(a===`issues`||a===`pull`){if(!At.test(o))return null;s=`${r}/${i}#${o}`}else if(a===`commit`){if(!jt.test(o))return null;s=`${r}/${i}@${o.slice(0,7)}`}else return null;return{url:`https://github.com/${r}/${i}/${a}/${o}${Mt.test(t.hash)?t.hash:``}`,label:s}}var Lt=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/u;function Rt(e){if(typeof e!=`string`)return null;let t=zt(e);return t!==e||Lt.test(e)?t.slice(0,8):null}function zt(e){let t=String(e);return t.startsWith(`https://chatgpt.com/codex/cloud/security/findings/`)?t.slice(50):t}function Bt(e,n){let r=t(e,{managed:n});if(!r)return null;let i=Rt(r.id);return{url:n?r.path:`#${r.fragment}`,label:i?`finding ${i}`:`finding`,self:!0}}var Vt=/https?:\/\/[^\s<>"'`(){}[\]|\\^]+/giu,Ht=new Set([`)`,`.`,`,`,`!`,`?`,`;`,`:`,`'`,`"`,`*`,`]`,`}`,`>`]);function Ut(e){let t=e.length;for(;t>0&&Ht.has(e[t-1]);)t--;return t===e.length?e:e.slice(0,t)}function Wt(e,{managed:t=!1}={}){if(typeof e!=`string`||e.length===0)return[];let n=[],r=0;Vt.lastIndex=0;let i;for(;(i=Vt.exec(e))!==null;){let a=Ut(i[0]),o=a?It(a)??Bt(a,t):null;o&&(i.index>r&&n.push(e.slice(r,i.index)),n.push(o),r=i.index+a.length,Vt.lastIndex=r)}return r<e.length&&n.push(e.slice(r)),n}function Gt(e){if(!e)return null;let t=Me(),n=RegExp(`^(?:.*/)?${t}/(@[^/]+/[^/]+|[^/]+)`,`u`),r=e.match(n);return r?r[1]:`__own__`}function Kt(e){return new Set(e.filter(e=>!I(e)))}var qt=[`#4e9af1`,`#f28e2b`,`#59a14f`,`#e15759`,`#76b7b2`,`#edc948`,`#b07aa1`,`#ff9da7`,`#9c755f`,`#5cd1e5`,`#f1ce63`,`#d37295`,`#a0cbe8`,`#86bcb6`,`#8cd17d`,`#b6992d`,`#499894`,`#e15759`,`#e879c7`,`#d4a6c8`],Jt=[`#2f8aef`,`#d2691e`,`#2ea043`,`#e63946`,`#2e9a92`,`#b88817`,`#9560e8`,`#d24a9c`,`#8a5d40`,`#0891b2`,`#a07a14`,`#c14e8e`,`#1f7ad0`,`#549b94`,`#3fb95f`,`#a07a14`,`#2a8278`,`#cb2c40`,`#c026d3`,`#965f93`];function Yt(){if(typeof document>`u`)return!1;let e=document.body?.classList;return!!e&&(e.contains(`theme-light`)||e.contains(`theme-pink`)||e.contains(`theme-w95`)||e.contains(`theme-paper`))}var Xt=new Map;function Zt(e){let t=Yt()?Jt:qt;return t[e%t.length]}var Qt=()=>Yt()?`#8c959f`:`#6e7681`;function $t(e){let t=Yt(),n=t?Jt:qt,r=e??`__own__`,i=`${t?`l`:`d`}:${r}`;if(Xt.has(i))return Xt.get(i);let a=0;for(let e of r)a=a*37+e.codePointAt(0)|0;let o=n[((a%n.length+n.length)%n.length*7+3)%n.length];return Xt.set(i,o),o}var en=e=>e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`),tn=e=>y(e)?e:en(b(String(e))),H=globalThis.trustedTypes?.createPolicy(`deepview`,{createHTML:tn,createScriptURL:e=>{let t=new URL(e,globalThis.location.href);if(t.origin!==globalThis.location.origin)throw TypeError(`Not a same-origin script: ${t.href}`);return t.href}}),U=e=>H?H.createHTML(e):tn(e),nn=e=>H?H.createScriptURL(String(e)):e,W={showAll:!1,packagesView:!1,dependencyPackagesView:!1,flowPackagesView:!1,bundleIssues:!1,bundleLayout:`graph`,lockfileLayout:`dependencies`,bundleReason:null,bundleReasonFor:null,selected:null,focusedPkg:null,topPkgsTab:`issues`,edgeOpacity:.22,nodeSize:1,showLabels:!1,selectedSeverities:new Set,selectedColors:new Set,pathFilter:``,hidden:new Set,solo:null,graphState:null,layoutCache:null,keptViewport:null};function rn({keepViewport:e=!1}={}){W.graphState?._cleanup?W.graphState._cleanup({keepViewport:e}):e||(W.keptViewport=null),W.graphState=null}var an=w(class extends T{constructor(e){if(super(e),e.type!==C.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(e=>e!==``)));for(let e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}let n=e.element.classList;for(let e of this.st)e in t||(n.remove(e),this.st.delete(e));for(let e in t){let r=!!t[e];r===this.st.has(e)||this.nt?.has(e)||(r?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return D}}),on={commit:S},sn=8;function cn(e){let t;try{t=e?JSON.parse(e):null}catch{return null}let n=e=>typeof e==`string`&&e?e:null;return t&&{tags:Array.isArray(t.tags)?t.tags.filter(n):[],details:typeof t.title==`string`?{title:t.title,authorName:n(t.authorName),authorLogin:n(t.authorLogin),date:Number.isSafeInteger(t.date)?t.date:null}:null}}function ln({title:e,authorName:t,authorLogin:n,date:r}){let i=document.createElement(`div`);i.className=`tooltip-commit-details`;let a=document.createElement(`span`);a.className=`tooltip-commit-message`,a.textContent=e;let o=document.createElement(`span`);return o.className=`tooltip-commit-meta`,o.textContent=[t&&n&&t!==n?`${t} (@${n})`:t??(n&&`@${n}`),r===null?``:new Date(r).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})].filter(Boolean).join(` · `),i.append(...e?[a]:[],o),i}var G;function un(){return G||(G=document.createElement(`div`),G.id=`styled-tooltip`,G.setAttribute(`popover`,`manual`),document.body.append(G),G)}function dn(e){typeof e.showPopover==`function`&&(e.matches(`:popover-open`)&&e.hidePopover(),e.showPopover())}var K=null,fn=``,q=null,J=null,pn=0,mn=0,hn=!1;function Y(){if(!hn){hn=!0,document.addEventListener(`mousemove`,e=>{pn=e.clientX,mn=e.clientY},{passive:!0});for(let e of[`pointerdown`,`wheel`,`scroll`])document.addEventListener(e,()=>Z(),{capture:!0,passive:!0});document.addEventListener(`keydown`,e=>{e.key===`Escape`&&Z()}),window.addEventListener(`blur`,()=>Z())}}var gn=100,_n=14,vn=8,X=8;function yn(e,{placement:t=`cursor`}={}){Y(),clearTimeout(q),q=null,J=null,e.prepareTooltip?.(e),t=e.dataset.tooltipPlacement??t;let n=un(),i=e.dataset.tooltip??``,a=Object.hasOwn(on,e.dataset.tooltipIcon??``)?e.dataset.tooltipIcon:``,o=e.dataset.tooltipRepo??``,s=r(e.dataset.tooltipCommit),c=cn(e.dataset.tooltipCommitInfo),l=[`stasis`,`sourcemap`].includes(e.dataset.tooltipBundle)?e.dataset.tooltipBundle:``,u=e.dataset.tooltipStats??``,d=e.dataset.tooltipBuilt===`true`,f=e.dataset.tooltipPackage??``,p=e.dataset.tooltipEcosystem??``,m=e.dataset.tooltipVersion??``,h=e.dataset.tooltipFiles??``,g=e.dataset.tooltipLoc??``,_=e.dataset.tooltipSize??``,v=e.tooltipContent??null,y=v??JSON.stringify([i,a,o,s,c,l,u,d,f,p,m,h,g,_]);if(!i){Z();return}if(K===e&&fn===y)return;if(n.textContent=a||v?``:i,v){let e=document.createElement(`div`);e.className=`tooltip-rich`,ne(v,e),n.append(e)}if(a){let e=document.createElement(`span`);e.className=`tooltip-text`,e.innerHTML=U(on[a]);let t=document.createElement(`span`);t.textContent=i,e.append(t),n.append(e)}if(f){let t=document.createElement(`div`);t.className=`tooltip-package`;let r=(e.querySelector(`[data-tooltip-package-icon] svg`)??e.querySelector(`svg`))?.cloneNode(!0);r&&t.append(r);let i=document.createElement(`span`);i.className=`tooltip-package-details`;let a=(e,t)=>/^\d+$/u.test(e)?`${Number(e).toLocaleString()} ${t}`:``;for(let e of[f,m,a(h,h===`1`?`file`:`files`),a(g,`LoC`),_].filter(Boolean)){let t=document.createElement(`span`);t.textContent=e,i.append(t)}t.append(i),n.append(t)}if(o||s){let e=document.createElement(`div`);if(e.className=`tooltip-repo`,o){e.innerHTML=U(x);let t=document.createElement(`span`);t.textContent=o,e.append(t)}if(s){let t=document.createElement(`span`);t.className=`tooltip-commit`,t.innerHTML=U(S);let n=document.createElement(`span`);n.textContent=s.slice(0,7),t.append(n),e.append(t)}if(n.append(e),s&&c?.tags.length){let e=document.createElement(`div`);e.className=`tooltip-tags`;for(let t of c.tags.slice(0,sn)){let n=document.createElement(`span`);n.className=`tooltip-tag`,n.innerHTML=U(ee);let r=document.createElement(`span`);r.textContent=t,n.append(r),e.append(n)}if(c.tags.length>sn){let t=document.createElement(`span`);t.className=`tooltip-tag-more`,t.textContent=`+${(c.tags.length-sn).toLocaleString()} more`,e.append(t)}n.append(e)}}if(c?.details&&n.append(ln(c.details)),l||u||d){let e=document.createElement(`div`);if(e.className=`tooltip-bundle`,l===`stasis`){let t=document.createElement(`img`);t.src=`./stasis.svg`,t.alt=``,e.append(t)}else e.innerHTML=U(te);let t=document.createElement(`span`);t.textContent=[l===`stasis`?`Stasis`:l===`sourcemap`?`Sourcemap`:``,d?`Built on server`:``,u].filter(Boolean).join(` · `),e.append(t),n.append(e)}dn(n),n.style.left=`0px`,n.style.top=`0px`,n.style.transform=`none`,n.classList.add(`visible`);let b=pn,C=mn+_n;if(t===`right`||t===`right-start`){let n=e.getBoundingClientRect();b=n.right+vn,C=n.top+(t===`right`?n.height/2:0)}let w=window.innerWidth-n.offsetWidth-X,T=Math.max(X,Math.min(b,w));n.style.left=`${Math.round(T)}px`;let E=n.offsetHeight,D=t===`right`?C-E/2:C,O=window.innerHeight-E-X,k=Math.max(X,Math.min(D,O));n.style.top=`${Math.round(k)}px`,K=e,fn=y}function Z(e){e&&!e.contains(K)&&!e.contains(J)||(clearTimeout(q),q=null,J=null,G&&(G.classList.remove(`visible`),typeof G.hidePopover==`function`&&G.matches(`:popover-open`)&&G.hidePopover()),K=null)}function bn(e,{gate:t,placement:n}={}){Y();let r=()=>e.isConnected!==!1&&(!Object.hasOwn(e.dataset,`tooltipTruncated`)||e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight)&&(!t||t(e));if(!r()){Z();return}e===K||e===J||(Z(),J=e,q=setTimeout(()=>{q=null,J=null,r()&&yn(e,{placement:n})},gn))}var xn=new WeakSet;function Sn(e,t){for(let n of e.composedPath()){if(n===t)break;if(n.nodeType===1&&Object.hasOwn(n.dataset,`tooltip`))return n}return null}function Cn(e,t){!e||xn.has(e)||(xn.add(e),e.ownerDocument&&Y(),e.addEventListener(`mouseover`,n=>{if(n.buttons){Z();return}let r=Sn(n,e);if(!r){Z();return}r!==K&&bn(r,t)}),e.addEventListener(`mouseout`,t=>{let n=Sn(t,e),r=t.relatedTarget?.closest?.(`[data-tooltip]`)??null;n&&n===r||Z()}),e.addEventListener(`scroll`,()=>Z(e),{capture:!0,passive:!0}))}var wn=!1;function Tn(){wn||(wn=!0,Y(),document.addEventListener(`tooltip-root-connected`,e=>{Cn(e.composedPath()[0]?.shadowRoot)}),document.body.addEventListener(`mouseover`,e=>{if(e.target.closest(`[data-tooltip-managed]`))return;if(e.buttons){Z();return}let t=e.target.closest(`[data-tooltip]`);!t||t===K||bn(t)}),document.body.addEventListener(`mouseout`,e=>{e.target.closest(`[data-tooltip-managed]`)||e.relatedTarget?.closest?.(`[data-tooltip-managed]`)||!K&&!q||(K??J)?.contains(e.relatedTarget)||Z()}))}function En(e){return`tree-`+e.replaceAll(/[^\w-]+/gu,`_`)}var Dn=()=>Object.fromEntries(f.map(e=>[e,0]));function On(e,t){let n=new Map;for(let r of e)for(let e of r){n.has(e.file)||n.set(e.file,Dn());let r=n.get(e.file),i=p(e,t);r[i]!==void 0&&r[i]++}return n}function kn(e){let t=null;for(let n of e)if(n?.tree){t||={};for(let e of Object.keys(n.tree)){let r=n.tree[e];if(!t[e]){t[e]={...r,imports:[...r.imports??[]]};continue}let i=new Set(t[e].imports);for(let n of r.imports??[])i.has(n)||(i.add(n),t[e].imports.push(n));t[e].size==null&&r.size!=null&&(t[e].size=r.size)}}return t}function An(e,t){let n=Object.keys(e),r=new Map(n.map((e,t)=>[e,t])),i=n.map(()=>Dn()),a=n.map(()=>[]);for(let[t,i]of n.entries())for(let n of e[i].imports??[]){let e=r.get(n);e!==void 0&&a[e].push(t)}let o=new Uint32Array(n.length),s=0;for(let[e,n]of t){let t=r.get(e);if(t===void 0||!n)continue;let c=f.map(e=>[e,n[e]??0]).filter(([,e])=>e!==0);if(c.length===0)continue;let l=++s,u=[],d=e=>{o[e]!==l&&(o[e]=l,u.push(e))};for(let e of a[t])d(e);for(;u.length>0;){let e=u.pop();for(let[t,n]of c)i[e][t]+=n;for(let t of a[e])d(t)}}return new Map(n.map((e,t)=>[e,i[t]]))}function jn(e,t,n){let r=t.get(e),i=n.get(e);return Q(r)>0||Q(i)>0}function Q(e){if(!e)return 0;let t=0;for(let n of f)t+=e[n]??0;return t}var Mn={package:`@babel/core`,path:/^lib\/config\//u},Nn={package:`@babel/core`,path:/^lib\/config\/files\/(?:module-types|plugins)\.js$/u},Pn=Object.freeze([{id:`react-native-codegen-discovery`,reason:`Codegen discovers package metadata and React Native configuration.`,from:{package:`react-native`,path:/^scripts\/codegen\/generate-artifacts-executor\.js$/u},to:{path:/(?:^|\/)(?:package\.json|react-native\.config\.js)$/u}},{id:`react-native-release-version`,reason:`The CLI release checker reads the installed React Native version.`,from:{package:`@react-native-community/cli-tools`,path:/^build\/releaseChecker\/index\.js$/u},to:{package:`react-native`,path:/^package\.json$/u}},{id:`react-native-platform-config`,reason:`React Native configuration loads platform CLIs supplied by the host project.`,from:{package:`react-native`,path:/^react-native\.config\.js$/u},to:{package:/^@react-native-community\/cli-platform-(?:android|ios)$/u,path:/^build\/index\.js$/u}},{id:`babel-project-config`,reason:`Babel discovers project configuration.`,from:Mn,to:{path:/(?:^|\/)babel\.config\.js$/u}},{id:`babel-typescript-preset`,reason:`Babel configuration loads the TypeScript preset.`,from:Mn,to:{package:`@babel/preset-typescript`,path:/./u}},{id:`babel-react-native-preset`,reason:`Babel config loaders load the configured React Native preset.`,from:Nn,to:{package:`@react-native/babel-preset`,path:/^(?:src\/)?index\.js$/u}},{id:`babel-reanimated-plugin`,reason:`Babel config loaders load the configured Reanimated plugin, including scoped copies.`,from:Nn,to:{package:/^(?:@[^/]+\/)?react-native-reanimated$/u,path:/^plugin\/index\.js$/u}},{id:`babel-transform-plugin`,reason:`Babel config loaders load configured transform plugins.`,from:Nn,to:{package:/^@babel\/plugin-transform-[^/]+$/u,path:/^lib\/index\.js$/u}},{id:`cosmiconfig-config`,reason:`Cosmiconfig loads discovered configuration, including dependency configuration.`,from:{package:`cosmiconfig`,path:/^dist\/loaders\.js$/u},to:{path:/\.config\.js$/u}},{id:`import-fresh-own-config`,reason:`import-fresh loads host-project configuration.`,from:{package:`import-fresh`,path:/./u},to:{path:/\.config\.js$/u},ownSourceOnly:!0}].map(e=>Object.freeze({...e,from:Object.freeze(e.from),to:Object.freeze(e.to)})));function Fn(e){return typeof e==`string`&&!e.includes(`\\`)&&!e.includes(`:`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e!==`node_modules`)}function In(e,t){let n=e.package;return n!==void 0&&t.ownSource===!0?!1:(n===void 0||(typeof n==`string`?n===t.package:n.test(t.package??``)))&&e.path.test(t.path)}function Ln(e,t){if(e?.ownSource!==!0&&Fn(e?.path)&&Fn(t?.path))return Pn.find(n=>(!n.ownSourceOnly||t.ownSource===!0)&&In(n.from,e)&&In(n.to,t))}function Rn(e,t){let n=e.split(/(?:^|\/)node_modules\//u).slice(1).at(-1)?.match(/^(@[^/]+\/[^/]+|[^/]+)\/(.+)$/u);return{package:n?.[1],path:n?.[2]??e.replace(/^\/+/u,``),ownSource:t??i(e)===`__own__`}}function zn(e,t,n,r){return!Ln(Rn(e,r),Rn(t,n))}function Bn(e,t=e=>e.file){let n=new Map(e.nodes.map(e=>[e.file,e])),r=new Map(e.nodes.map(e=>[t(e),new Set]));for(let[i,a]of e.importsOf){let o=n.get(i);if(o)for(let s of a){let a=n.get(s);a&&zn(o.origFile??i,a.origFile??s,e.ownSourceFiles?.has(s),e.ownSourceFiles?.has(i))&&r.get(t(o)).add(t(a))}}return r}var Vn=class{constructor(e){this.nodes=[...e];for(let[e,t]of this.nodes.entries())t.position=e;for(let e=(this.nodes.length>>1)-1;e>=0;e--)this.down(e)}before(e,t){return Math.abs(e.balance)>Math.abs(t.balance)||Math.abs(e.balance)===Math.abs(t.balance)&&(e.balance>t.balance||e.balance===t.balance&&e.tie<t.tie)}swap(e,t){let n=this.nodes,r=n[e];n[e]=n[t],n[t]=r,n[e].position=e,n[t].position=t}down(e){let t=this.nodes;for(;2*e+1<t.length;){let n=2*e+1;if(n+1<t.length&&this.before(t[n+1],t[n])&&n++,!this.before(t[n],t[e]))break;this.swap(e,n),e=n}}update(e){if(e.position<0)return;let t=e.position;for(;t>0;){let n=t-1>>1;if(!this.before(e,this.nodes[n]))break;this.swap(t,n),t=n}this.down(t)}take(){let e=this.nodes[0],t=this.nodes.pop();return e.position=-1,this.nodes.length>0&&(this.nodes[0]=t,t.position=0,this.down(0)),e}};function Hn(e,t){for(let n=0;n<8;n++){let r=!1;for(let i=0;i<e.length-1;i++){let a=n%2?e.length-2-i:i,o=e[a],s=e[a+1];(t.get(s)?.get(o)?.cycleCount??0)<=(t.get(o)?.get(s)?.cycleCount??0)||(e[a]=s,e[a+1]=o,r=!0)}if(!r)break}return e}function Un(e){let t=[],n=new Set;for(let t of e.values())t.outgoing.sort((e,t)=>t[1]-e[1]||e[0].tie-t[0].tie);for(let r of e.values()){if(n.has(r))continue;let e=[{node:r,next:0}];for(n.add(r);e.length>0;){let r=e.at(-1);if(r.next===r.node.outgoing.length){t.push(r.node.id),e.pop();continue}let i=r.node.outgoing[r.next++][0];n.has(i)||(n.add(i),e.push({node:i,next:0}))}}return t.toReversed()}function $(e,t){let n=new Map(e.map((e,t)=>[e,t])),r=0;for(let e of t.values())for(let[t,i]of e.outgoing)n.get(e.id)<n.get(t.id)&&(r+=i);return r}function Wn(e,t){let n=$(e,t),r=n,i=0;for(let a=0;a<e.length-1;a++)n-=t.get(e[a]).originalBalance,n>r&&(r=n,i=a+1);return[...e.slice(i),...e.slice(0,i)]}function Gn(e,t){if(e.length<2)return e;let n=new Map(e.map((e,t)=>[e,{id:e,tie:t,balance:0,incoming:[],outgoing:[]}]));for(let e of n.values())for(let r of t.get(e.id)?.values()??[]){let t=n.get(r.to);!t||t===e||!r.cycleCount||(e.outgoing.push([t,r.cycleCount]),t.incoming.push([e,r.cycleCount]),e.balance+=r.cycleCount,t.balance-=r.cycleCount)}for(let e of n.values())e.originalBalance=e.balance;let r=[],i=new Vn(n.values()),a=[];for(;i.nodes.length>0;){let e=i.take();e.balance>=0?r.push(e.id):a.push(e.id);for(let[t,n]of e.outgoing)t.position<0||(t.balance+=n,i.update(t));for(let[t,n]of e.incoming)t.position<0||(t.balance-=n,i.update(t))}let o=e,s=$(e,n);for(let i of[[...r,...a.toReversed()],Un(n),e,e.toReversed()]){let e=Hn(Wn(i,n),t),r=$(e,n);r>s&&(o=e,s=r)}return o}function Kn(e,t){let n=new Set(e),r=new Map(e.map(e=>[e,[]]));for(let[e,i]of t)for(let t of i)n.has(e)&&n.has(t)&&r.get(t).push(e);let i=[],a=new Set;for(let r of e){if(a.has(r))continue;a.add(r);let e=[[r,(t.get(r)??[])[Symbol.iterator]()]];for(;e.length>0;){let[r,o]=e.at(-1),s=o.next();if(s.done){i.push(r),e.pop();continue}n.has(s.value)&&!a.has(s.value)&&(a.add(s.value),e.push([s.value,(t.get(s.value)??[])[Symbol.iterator]()]))}}let o=new Map,s=[];for(let e of i.toReversed()){if(o.has(e))continue;let t=[],n=s.length,i=[e];for(o.set(e,n);i.length>0;){let e=i.pop();t.push(e);for(let t of r.get(e))o.has(t)||(o.set(t,n),i.push(t))}s.push(t.toSorted())}return{groups:s,componentOf:o}}function qn(e,{expanded:t=new Set,order:n=`structure`,query:r=``,neighborhood:i=null,cyclesOnly:o=!1}={}){let s=new Map,c=new Map,l=new Map;for(let n of e.nodes){let e=t.has(n.pkg),r=`${e?`f`:`p`}:${e?n.file:n.pkg}`;s.has(r)||s.set(r,{id:r,pkg:n.pkg,file:e?n.file:null,label:e?n.file:a(n.pkg),files:[],size:0,issues:0,incoming:0,outgoing:0,importers:0,dependencies:0});let i=s.get(r);i.files.push(n.file),i.size+=n.size??0,i.issues+=n.totalIssues??0,c.set(n.file,r),l.set(n.file,n.origFile??n.file)}let u=new Map,d=new Set,f=new Set,p=new Map([...s.keys()].map(e=>[e,new Set])),m=0;for(let[t,n]of e.importsOf){let r=c.get(t);if(r)for(let i of new Set(n)){let n=c.get(i);if(!n)continue;u.has(r)||u.set(r,new Map),u.get(r).has(n)||u.get(r).set(n,{from:r,to:n,count:0,cycleCount:0,examples:[]});let a=u.get(r).get(n);a.count++;let h=zn(l.get(t),l.get(i),e.ownSourceFiles?.has(i),e.ownSourceFiles?.has(t));a.examples.length<80&&(!o||h)&&a.examples.push([t,i]),m++,s.get(r).outgoing++,s.get(n).incoming++,r!==n&&(f.add(r),d.add(n)),h&&(a.cycleCount++,(r!==n||s.get(r).file)&&p.get(r).add(n))}}let h=[...s.keys()].toSorted(),{groups:g,componentOf:_}=Kn(h,p),v=new Set(g.flatMap(e=>e.length>1||p.get(e[0]).has(e[0])?e:[]));for(let e of s.values())e.cyclic=v.has(e.id),e.component=_.get(e.id);let ee=e.ownSourcePackages??new Set(e.layerRoots?.roots??[]),y=e=>e.pkg===`__own__`?0:ee.has(e.pkg)?1:2,b=e=>d.has(e.id)&&f.has(e.id)?0:1,te=new Map(g.map((e,t)=>[t,e.reduce((e,t)=>Math.min(e,y(s.get(t))),2)])),x=(e,t)=>e.pkg.localeCompare(t.pkg)||e.label.localeCompare(t.label),S=new Map;if(n===`structure`){for(let e of g)if(!(e.length<2))for(let t of Map.groupBy(e,e=>y(s.get(e))).values())Gn(t.toSorted((e,t)=>x(s.get(e),s.get(t))),u).forEach((e,t)=>S.set(e,t))}if(o){m=0,d.clear(),f.clear();for(let e of s.values())e.incoming=0,e.outgoing=0}for(let[e,t]of u){for(let n of t.values())if(n.cyclic=n.cycleCount>0&&v.has(e)&&_.get(e)===_.get(n.to)&&(e!==n.to||s.get(e).file!==null),o){if(!n.cyclic){t.delete(n.to);continue}n.count=n.cycleCount,m+=n.count,s.get(e).outgoing+=n.count,s.get(n.to).incoming+=n.count,e!==n.to&&(f.add(e),d.add(n.to))}t.size===0&&u.delete(e)}for(let[e,t]of u)for(let n of t.keys())e!==n&&(s.get(e).dependencies++,s.get(n).importers++);let C=r.trim().toLowerCase(),w=new Set(h.filter(e=>!C||s.get(e).files.some(e=>e.toLowerCase().includes(C))||s.get(e).label.toLowerCase().includes(C))),T=new Set(i?[i]:w);if(C||i)for(let[e,t]of u)for(let n of t.keys())(i?e===i:w.has(e))&&T.add(n),(i?n===i:w.has(n))&&T.add(e);let E=(e,t)=>{if(n===`structure`){let n=te.get(e.component)-te.get(t.component);if(n)return n;let r=b(e)-b(t);if(r)return r;let i=e.component-t.component;if(i)return i}let r=y(e)-y(t);if(r)return r;if(n===`importers`)return t.importers-e.importers||x(e,t);if(n===`imports`)return t.dependencies-e.dependencies||x(e,t);let i=b(e)-b(t);if(i)return i;if(n===`structure`&&e.component===t.component){let n=(S.get(e.id)??0)-(S.get(t.id)??0);if(n)return n}return x(e,t)},D=[...s.values()].filter(e=>T.has(e.id)&&(!o||e.cyclic)).toSorted(E),O=new Map(D.map((e,t)=>[e.id,t])),ne=[];for(let[e,t]of u)if(O.has(e))for(let n of t.values())O.has(n.to)&&ne.push({...n,row:O.get(e),col:O.get(n.to)});return{rows:D,byId:s,cells:u,visibleCells:ne,index:O,matches:w,importCount:m,totalRows:s.size,cycleCount:g.filter(e=>v.has(e[0])).length}}export{k as a,re as b,ie as c,ae as d,oe as e,A as f,j as g,ce as h,ue as i,fe as j,pe as k,me as l,he as m,ge as n,N as o,_e as p,ve as q,ye as r,be as s,Se as t,Ce as u,we as v,je as w,Me as x,I as y,Ne as z,Le as A,Re as B,Be as C,Ve as D,He as E,Ue as F,Ye as G,R as H,$e as I,rt as J,ct as K,dt as L,mt as M,V as N,gt as O,vt as P,yt as Q,xt as R,St as S,Ct as T,wt as U,Et as V,Dt as W,Rt as X,zt as Y,Wt as Z,Gt as _,Kt as $,Zt as aa,Qt as ba,$t as ca,U as da,nn as ea,W as fa,rn as ga,an as ha,yn as ia,Z as ja,bn as ka,Cn as la,Tn as ma,En as na,On as oa,kn as pa,An as qa,jn as ra,Q as sa,Gn as ta,zn as ua,Bn as va,Kn as wa,qn as xa};
28
+ /*! Bundled license information:
29
+
30
+ lit-html/directives/class-map.js:
31
+ (**
32
+ * @license
33
+ * Copyright 2018 Google LLC
34
+ * SPDX-License-Identifier: BSD-3-Clause
35
+ *)
36
+ */
@@ -0,0 +1 @@
1
+ var{Buffer:e}=globalThis,t=e&&!e.TYPED_ARRAY_SUPPORT,n=new Uint8Array(Uint16Array.of(258).buffer)[0]===2,r=e=>e&&(t||`${e}`.includes(`[native code]`));!t&&r(()=>{})&&(r=()=>!1);function i(e,t,n,r){let i=``,a=t;for(let t=n-3;a<t;a+=4){let t=e[a],n=e[a+1],o=e[a+2],s=e[a+3];i+=r[t],i+=r[n],i+=r[o],i+=r[s]}for(;a<n;)i+=r[e[a++]];return i}function a(e,t){let n=e.length;for(let r=0;r<n;r++)t[r]=e.charCodeAt(r);return t}var o=null,s=!1,c=!1,l=new TextEncoder,u=new TextDecoder(`utf-8`,{ignoreBOM:!0}),d=new TextDecoder(`latin1`,{ignoreBOM:!0});function f(e,t,n,r){if(n-t>3e4){let a=[];for(let o=t;o<n;){let t=o+500,s=t>n?n:t;a.push(i(e,o,s,r)),o=s}let o=a.join(``);return a.length=0,o}return i(e,t,n,r)}var p=globalThis.Buffer;function m(e){if(!(e&&e instanceof Uint8Array))throw TypeError(`Expected an Uint8Array`)}var h=`Input is not a string`,g=`Input is not well-formed Unicode`;function _(e,t){switch(t){case`uint8`:if(e.constructor!==Uint8Array)throw Error(`Unexpected`);return e;case`arraybuffer`:if(e.byteLength!==e.buffer.byteLength)throw Error(`Unexpected`);return e.buffer;case`buffer`:return e.length<=64?p.from(e):p.from(e.buffer,e.byteOffset,e.byteLength)}throw TypeError(`Unexpected format`)}function v(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 Error(`Unexpected`);return e}throw TypeError(`Unexpected format`)}export{n as a,a as b,o as c,s as d,c as e,l as f,u as g,d as h,f as i,m as j,h as k,g as l,_ as m,v as n};
@@ -0,0 +1,3 @@
1
+ import{a as e}from"./chunk-QB4CBOX2.js";import{a as t,b as n,c as r,f as i,g as a}from"./chunk-6HNXNIQY.js";import{i as o}from"./chunk-BC2UCLFJ.js";import{J as s}from"./chunk-SXV2T5C4.js";import{a as c}from"./chunk-TUII34K2.js";var l=[`dependencies`,`security`],u={dependencies:`Dependencies`,security:`Security`},d=e(),f=Object.freeze(d.models),p=d.defaultModel,m=`x-upload-encryption`,h=1,g=1,_={name:`X25519`},ee=34,v=1048576,y=65536,b=`deepview-managed-upload.v1.content-key`;function x(e,t){let n=new Uint8Array(12);return new DataView(n.buffer).setUint32(7,e),n[11]=+!!t,n}async function S(e,t,n){let r=await crypto.subtle.importKey(`raw`,e,`HKDF`,!1,[`deriveKey`]);return await crypto.subtle.deriveKey({name:`HKDF`,hash:`SHA-256`,salt:t,info:c(b)},r,{name:`AES-GCM`,length:256},!1,[n])}async function te(e){let t=new Uint8Array(await e.slice(0,y).arrayBuffer());if(t.includes(0))return!1;try{return new TextDecoder(`utf-8`,{fatal:!0}).decode(t,{stream:!0}),!0}catch{return!1}}async function C(e,t,n){let r=await te(e),[i,a]=await Promise.all([crypto.subtle.importKey(`raw`,t,_,!1,[]),crypto.subtle.generateKey(_,!1,[`deriveBits`])]),o=new Uint8Array(ee);o[0]=h,o[1]=r?g:0,o.set(new Uint8Array(await crypto.subtle.exportKey(`raw`,a.publicKey)),2);let s=await S(await crypto.subtle.deriveBits({name:`X25519`,public:i},a.privateKey,256),o,`encrypt`),c=[new Blob([o])],l=new Uint8Array(v),u=0,d=0,f=async e=>{c.push(new Blob([await crypto.subtle.encrypt({name:`AES-GCM`,iv:x(d++,e)},s,l.subarray(0,u))])),u=0},p=(r?e.stream().pipeThrough(new CompressionStream(`gzip`)):e.stream()).getReader();try{for(let e=await p.read();!e.done;e=await p.read()){n?.throwIfAborted();for(let t=0;t<e.value.length;){u===v&&await f(!1);let n=Math.min(v-u,e.value.length-t);l.set(e.value.subarray(t,t+n),u),u+=n,t+=n}}}catch(e){throw await p.cancel(e).catch(()=>{}),e}return await f(!0),new Blob(c)}var w=null,T=0;function E(){return w?.user.role??null}function D(e){if(e!==null&&!n(e))throw TypeError(`Unknown managed preview role: ${e}. Expected ${t.join(`, `)}.`);T++,w=e===null?null:{user:{id:`preview:${e}`,login:e,name:e[0].toUpperCase()+e.slice(1),role:e,avatarUrl:null,lastSeenAt:Date.now(),lastActivityAt:null},csrfToken:null}}function O(e,t){let n=new URL(e,`http://managed-preview.invalid`).pathname,i=(t?.method??`GET`).toUpperCase();if(i===`POST`&&n===`/api/auth/logout`)return Response.json({ok:!0});if(i!==`GET`)throw Error(`Changes are not saved in the managed UI preview`);if(n===`/api/auth/session`)return Response.json(w);if(n===`/api/teams`)return Response.json({teams:[]});if(n.startsWith(`/api/admin/`)&&!r(w.user.role,`manage`)||[`/api/admin/users`,`/api/admin/teams`,`/api/admin/repositories`,`/api/admin/repositories/aliases`,`/api/admin/repositories/risk`].includes(n)&&w.user.role!==`admin`)return Response.json({error:`forbidden`},{status:403});if(n===`/api/admin/repositories/risk`)return new Response(`{"type":"repos","repos":[]}
2
+ {"type":"done"}
3
+ `,{headers:{"content-type":`application/x-ndjson`}});let a={"/api/admin/users":{users:[w.user]},"/api/admin/teams":{teams:[],users:[w.user],repos:[],permissions:l},"/api/admin/links":{shares:[]},"/api/admin/repositories":{repositories:[],total:0,connectedCount:0,installUrl:null,tokenMissing:!1},"/api/admin/repositories/aliases":{aliases:[],repos:[]},"/api/admin/repositories/resolve":{location:null},"/api/admin/reports":{reports:[],repos:[],maxBytes:26214400},"/api/admin/bundles":{bundles:[],repos:[],maxBytes:209715200},"/api/admin/history":{history:[],total:0,page:1,limit:100,filters:{repos:[],users:[]}},"/api/admin/scan/models":{models:f,defaultModel:p},"/api/admin/scan-results":{bundles:[],results:[]},"/api/auth/profile":{profile:{login:w.user.login,name:w.user.name,githubName:w.user.name,nameAccount:null,avatarAccount:null,accounts:[]}}};return Object.hasOwn(a,n)?Response.json(a[n]):Response.json({error:`not-found`},{status:404})}var k=3145728,A=new Set([`/api/admin/reports`,`/api/admin/bundles`,`/api/admin/deduplication`]);async function j(e,t){let n=await t(`/api/admin/uploads/key`,{credentials:`same-origin`,signal:e.signal});if(n.status===404||n.status===405)return e;if(!n.ok)return n;let r=(await n.json())?.key;if(typeof r!=`string`)throw Error(`The server sent an invalid upload key`);let i=new Headers(e.headers);return i.set(m,`1`),{...e,headers:i,body:await C(e.body,Uint8Array.fromBase64(r,{alphabet:`base64url`}),e.signal)}}async function M(e,t,n){let r=null;if(e!==`/api/admin/deduplication`&&t.body.size>k){let i=await n(`/api/config`,{credentials:`same-origin`,signal:t.signal});if(!i.ok)return i;let a=(await i.json()).managed,o=a?.uploadMaxBytes?.[e.endsWith(`/reports`)?`reports`:`bundles`];if(Number.isSafeInteger(o)&&o>0&&t.body.size>o)return Response.json({error:`too-large`},{status:413});let s=a?.uploadChunkBytes;Number.isSafeInteger(s)&&s>0&&s<=k&&(r=s)}let i=await j(t,n);return i instanceof Response?i:r==null||i.body.size<=k?await n(e,i):await N(e,i,n,r)}async function N(e,t,n,r){let i=t.body,a=crypto.randomUUID(),o=e.endsWith(`/reports`)?`reports`:`bundles`,s=Math.ceil(i.size/r),c=new Headers(t.headers);c.set(`content-type`,`application/octet-stream`);let l=0,u=!1;try{for(let e=0;e<s;e++){l=e+1;let s=await n(`/api/admin/uploads/${o}/${a}/${e}`,{...t,headers:c,body:i.slice(e*r,(e+1)*r)});if(!s.ok)return s}let d=new Headers(t.headers);d.set(`x-upload-id`,a),d.set(`x-upload-parts`,String(s)),d.set(`x-upload-size`,String(i.size));let f=await n(e,{...t,headers:d,body:``});return u=f.ok,f}finally{if(!u&&l>0){let e=new Headers(t.headers);e.set(`x-upload-parts`,String(l)),await n(`/api/admin/uploads/${o}/${a}`,{...t,method:`DELETE`,headers:e,body:void 0,signal:AbortSignal.timeout(1e4)}).catch(()=>{})}}}async function P(e){await e.json().then(e=>e?.error,()=>null)===`view-only`&&globalThis.document?.dispatchEvent(new CustomEvent(`managed-view-only`))}async function F(e,t){if(t?.signal?.throwIfAborted(),w)return O(e,t);let n=T;async function r(e,t){if(n!==T)throw new DOMException(`Managed session changed`,`AbortError`);let r=i();if(r){if(new URL(e,globalThis.location.origin).origin!==globalThis.location.origin)throw Error(`Public workspace requests must be same-origin`);let n=new Headers(t?.headers);n.set(`x-deepview-share`,r.token),t={...t,headers:n,credentials:`omit`,redirect:`error`}}let a=await fetch(e,{...t,cache:`no-store`});if(n!==T)throw new DOMException(`Managed session changed`,`AbortError`);return a.status===403&&![`GET`,`HEAD`].includes((t?.method??`GET`).toUpperCase())&&P(a.clone()),a}return t?.method===`POST`&&A.has(e)&&t.body instanceof Blob?await M(e,t,r):await r(e,t)}var I=new class{constructor(e=()=>{}){this.resources=new Map,this.session=null,this.teamCatalog=null,this.reportCatalog=null,this.bundleCatalog=null,this.generation=0,this.sessionController=new AbortController,this.notify=e}setSession(e){(this.session?.id!==e?.id||this.session?.role!==e?.role)&&this.reset(),this.session=e}reset(){this.generation++,this.sessionController.abort(),this.sessionController=new AbortController,this.invalidate(),this.session=null,this.teamCatalog=null,this.reportCatalog=null,this.bundleCatalog=null}setReportCatalog(e){let t=new Set,n=new Map(e.map(e=>[e.id,JSON.stringify([e.cacheKey??null,e.reports.map(e=>[e.id,e.cacheKey??null,e.visible!==!1]).toSorted(),(e.bundles??[]).map(e=>[e.id,e.filename,e.repoFullName,e.repoDirectory??``]).toSorted()])]));for(let e of new Set([...this.teamCatalog?.keys()??[],...n.keys()]))this.teamCatalog?.get(e)!==n.get(e)&&t.add(`team:${e}`);for(let e of this.resources.keys())if(e.startsWith(`reports:content:team:`)){let[t]=e.slice(21).split(`:`);(!n.has(t)||this.teamCatalog?.get(t)!==n.get(t))&&this.invalidate([e])}this.teamCatalog=n;let r=new Map;for(let t of e)for(let e of t.reports){let n=r.get(e.id)??[];n.push(JSON.stringify([t.id,e.cacheKey??null])),r.set(e.id,n)}let i=new Map([...r].map(([e,t])=>[e,JSON.stringify(t.toSorted())])),a=this.reportCatalog;this.reportCatalog=i;let o=new Set(t);for(let e of new Set([...a?.keys()??[],...i.keys()]))a?.get(e)!==i.get(e)&&o.add(e);for(let e of this.resources.keys()){if(!e.startsWith(`reports:content:`)||e.startsWith(`reports:content:team:`))continue;let t=e.slice(16);(!i.has(t)||o.has(t))&&(this.invalidate([e]),o.add(t))}let s=new Map;for(let t of e)for(let e of t.bundles??[]){let n=s.get(e.id)??[];n.push(JSON.stringify([t.id,t.cacheKey??null,e.filename,e.repoFullName,e.repoDirectory??``])),s.set(e.id,n)}let c=!1,l=new Map([...s].map(([e,t])=>[e,JSON.stringify(t.toSorted())]));for(let e of new Set([...this.bundleCatalog?.keys()??[],...l.keys()]))this.bundleCatalog?.get(e)!==l.get(e)&&(c=!0,o.add(`bundle:${e}`),this.invalidate([`bundle-metadata:${e}`]));this.bundleCatalog=l;for(let e of this.resources.keys()){if(!e.startsWith(`report-sources:`)&&!e.startsWith(`finding-history:`))continue;let[,n,r]=e.split(`:`);(n?t.has(`team:${n}`):c||o.has(r))&&this.invalidate([e])}return o}read(e){return this.resources.get(e)?.data}invalidate(e){for(let[t,n]of this.resources)e&&!e.some(e=>t===e||t.startsWith(`${e}:`))||(n.controller?.abort(),this.resources.delete(t))}async mutate(e,t){let n=this.generation,r;try{r=await e()}catch(e){throw n===this.generation&&e?.name!==`AbortError`&&this.notify(`Couldn't save changes: ${e?.message??e}`),e}if(n!==this.generation)throw new DOMException(`Managed session changed`,`AbortError`);return this.invalidate(t),r}async load(e,t,n,{signal:r,apply:i=()=>{},retryInvalidated:a=!1}={}){let o=this.generation;for(;;){r?.throwIfAborted();let s=this.resources.get(e);if(s||(s={},this.resources.set(e,s)),s.data!==void 0&&i(s.data),!s.pending){let e=s.controller=new AbortController;s.pending=(async()=>{try{let t=await n(e.signal);return e.signal.throwIfAborted(),s.data=t,t}catch(n){throw!e.signal.aborted&&n?.name!==`AbortError`&&this.notify(`Couldn't refresh ${t}: ${n?.message??n}`),n}})().finally(()=>{s.pending=null})}try{let t=await s.pending;if(r?.throwIfAborted(),this.resources.get(e)!==s)throw new DOMException(`Managed data changed`,`AbortError`);return i(t),t}catch(t){if(!a||t?.name!==`AbortError`||r?.aborted||o!==this.generation||this.resources.get(e)===s)throw t}}}}(e=>{document.dispatchEvent(new CustomEvent(`managed-notice`,{detail:{message:e}}))});function L(e){I.setSession(e)}function R(e){return I.setReportCatalog(e)}function z(){I.reset()}async function B(e,t=null,n={}){let r;try{r=await F(e,{credentials:`same-origin`,headers:{accept:`application/json`},...n})}catch{return t}if(r.status===401||r.status===403)return null;if(!r.ok)return t;try{return await r.json()}catch{return t}}async function V({fallback:e=null,sent:t}={}){let n=i()||E()!==null?void 0:await t;if(n===null)return null;let r=H(n);if(r!==void 0)return r;let o;try{let t=i(),n=await F(t?a(t):`/api/auth/session`,{credentials:`same-origin`,headers:{accept:`application/json`}});if(n.status===401||n.status===403)return null;if(!n.ok)return e;o=await n.json()}catch{return e}let s=H(o);return s===void 0?e:s}function H(e){let t=e?.user;if(t===null)return null;if(t!==void 0&&typeof t.login==`string`)return{id:t.id,login:t.login,name:typeof t.name==`string`?t.name:null,avatarUrl:typeof t.avatarUrl==`string`?t.avatarUrl:null,role:typeof t.role==`string`?t.role:`none`,csrfToken:typeof e.csrfToken==`string`?e.csrfToken:null,...i()?{publicShare:!0}:{},...typeof e.viewer?.login==`string`?{viewer:{id:e.viewer.id,login:e.viewer.login,name:typeof e.viewer.name==`string`?e.viewer.name:null}}:{},...!i()&&e.dependencyReview===!0?{dependencyReview:!0}:{}}}function U(e){let t=t=>Number.isSafeInteger(e?.[t])&&e[t]>=0;return e?.appMode===!1?{appMode:!1,...t(`appReports`)&&{appReports:e.appReports},...t(`findings`)&&{findings:e.findings}}:e?.appMode===!0&&t(`appFindings`)?{appMode:!0,appFindings:e.appFindings}:null}function W(e){if(typeof e?.sha!=`string`||typeof e.github!=`string`||!Array.isArray(e.tags))return null;let t=e.details,n=e=>typeof e==`string`?e:null,r=e=>Number.isSafeInteger(e)?e:null;return{sha:e.sha,github:e.github,tags:e.tags.filter(e=>typeof e==`string`),details:typeof t?.subject==`string`?{subject:t.subject,authorName:n(t.authorName),authorLogin:n(t.authorLogin),authoredAt:r(t.authoredAt),committedAt:r(t.committedAt)}:null}}async function G({fallback:e=[],signal:t,onRevision:n}={}){let r=i(),o=r?await B(a(r),null,{signal:t}):null,s=r?{teams:o?.team?[o.team]:[]}:await B(`/api/teams`,{teams:e},{signal:t}),c=s?.teams;return Array.isArray(c)?(n?.(typeof s.revision==`string`?s.revision:null),c.filter(e=>e!=null&&typeof e.id==`string`&&typeof e.name==`string`).map(e=>({id:e.id,slug:e.slug,name:e.name,...!r&&e.dependencyReview===!0?{dependencyReview:!0}:{},...e.permissions?{permissions:{dependencies:e.permissions.dependencies===!0,security:e.permissions.security===!0}}:{},...typeof e.cacheKey==`string`?{cacheKey:e.cacheKey}:{},...U(e.app)?{app:U(e.app)}:{},repos:Array.isArray(e.repos)?e.repos.filter(e=>Number.isSafeInteger(e?.repoId)&&e.repoId>0&&typeof e.fullName==`string`).map(e=>({repoId:e.repoId,fullName:e.fullName,path:typeof e.path==`string`&&e.path?e.path:null})):[],reports:Array.isArray(e.reports)?e.reports.filter(e=>e!=null&&typeof e.id==`string`&&typeof e.filename==`string`).map(e=>({id:e.id,slug:e.slug,filename:e.filename,visible:e.visible!==!1,...e.analyzer===null||typeof e.analyzer==`string`?{analyzer:e.analyzer}:{},repoFullName:typeof e.repoFullName==`string`?e.repoFullName:``,repoDirectory:typeof e.repoDirectory==`string`?e.repoDirectory:``,...typeof e.cacheKey==`string`?{cacheKey:e.cacheKey}:{}})):[],bundles:Array.isArray(e.bundles)?e.bundles.filter(e=>e!=null&&typeof e.id==`string`&&typeof e.filename==`string`).map(e=>({id:e.id,slug:e.slug,integrity:e.integrity,byteSize:e.byteSize,repoId:e.repoId,filename:e.filename,kind:e.kind,visible:e.visible!==!1,summary:e.summary??null,summaryRetryAt:Number.isSafeInteger(e.summaryRetryAt)&&e.summaryRetryAt>0?e.summaryRetryAt:null,repoDirectory:typeof e.repoDirectory==`string`?e.repoDirectory:``,repoFullName:typeof e.repoFullName==`string`?e.repoFullName:``,commitInfo:W(e.commitInfo)})):[]}))):s==null?[]:e}function K(e){return e?.links===void 0?[]:Array.isArray(e.links)&&e.links.every(e=>Array.isArray(e)&&e.length>=2&&e.every(e=>typeof e==`string`))?e.links:null}function q(e){return s(e?.data)===null||typeof e.repo?.directory!=`string`||e.repo.github!==null&&typeof e.repo.github!=`string`||K(e)===null?null:{data:e.data,repo:e.repo,...e.links?{links:e.links}:{}}}async function J(e,{signal:t}={}){return q(await B(`/api/reports/${encodeURIComponent(e)}`,null,{signal:t}))}async function Y(e,{signal:t}={}){let n=[...new Set(e)];if(n.length===0)return[];let r=await B(`/api/reports/query`,null,{method:`POST`,signal:t,headers:{accept:`application/json`,"content-type":`application/json`},body:JSON.stringify({ids:n})});if(!Array.isArray(r?.reports)||r.reports.length!==n.length)return null;let i=new Map;for(let e of r.reports){let t=q(e);if(!t||!n.includes(e.id)||i.has(e.id))return null;i.set(e.id,t)}let a=K(r);return a===null?null:e.map(e=>({...i.get(e),...a.length>0?{links:a}:{}}))}async function X(e,{signal:t,reportId:n=null}={}){let r=n===null?``:`?reportId=${encodeURIComponent(n)}`,i=await B(`/api/teams/${encodeURIComponent(e)}/reports${r}`,null,{signal:t});if(!Array.isArray(i?.reports))return null;let a=[],o=new Set;for(let e of i.reports){let t=q(e);if(!t||typeof e.id!=`string`||typeof e.filename!=`string`||o.has(e.id))return null;o.add(e.id),a.push({id:e.id,filename:e.filename,...t})}let s=K(i);return s===null?null:(Object.defineProperty(a,"links",{value:s}),a)}function Z(e){return e?`?team=${encodeURIComponent(e)}`:``}async function Q(e,{reportId:t,...n}={}){let r=t==null?``:`?reportId=${encodeURIComponent(t)}`,{reports:i,entries:a,comments:o,issues:s={}}=await B(`/api/teams/${encodeURIComponent(e)}/annotations${r}`,null,n)??{};if(!i||typeof i!=`object`||Array.isArray(i)||!a||typeof a!=`object`||Array.isArray(a)||!Array.isArray(o)||!s||typeof s!=`object`||Array.isArray(s)||Object.values(i).some(e=>!Array.isArray(e)||e.some(e=>typeof e!=`string`))||o.some(e=>!e||typeof e.findingId!=`string`))return null;let c=new Map;for(let[e,t]of o.entries()){let n=t.findingId,r=c.get(n)??[];r.push(e),c.set(n,r)}let l=new Map,u=new Map;return e=>{if(!Object.hasOwn(i,e))return null;if(u.has(e))return u.get(e);let t=JSON.stringify(i[e]),n=l.get(t);if(!n){let r=[...new Set(i[e])],u=r.flatMap(e=>c.get(e)??[]);n={entries:Object.fromEntries(r.filter(e=>Object.hasOwn(a,e)).map(e=>[e,a[e]])),comments:u.toSorted((e,t)=>e-t).map(e=>o[e]),issues:Object.fromEntries(r.filter(e=>Object.hasOwn(s,e)).map(e=>[e,s[e]]))},l.set(t,n)}return u.set(e,n),n}}async function ne(e,t,n){let r=(await B(`/api/reports/${encodeURIComponent(e)}/triage${Z(t)}`,null,n))?.entries;return typeof r==`object`&&r&&!Array.isArray(r)?r:null}async function re(e,t,n=null){if(i())return[];let r=n===null?``:`?reportId=${encodeURIComponent(n)}`,a=await B(`/api/teams/${encodeURIComponent(e)}/fixes${r}`,null,{signal:t});return Array.isArray(a?.fixes)?a.fixes:null}async function ie(e,t,n){let r=await B(`/api/reports/${encodeURIComponent(e)}/comments${Z(t)}`,null,n);return Array.isArray(r?.comments)?r.comments:null}async function ae(e,{findingId:t,body:n,commentId:r=null,version:i},a,o){let s=r==null?``:`/${encodeURIComponent(r)}`;try{let c=await F(`/api/reports/${encodeURIComponent(e)}/comments${s}${Z(o)}`,{method:r==null?`POST`:`PATCH`,credentials:`same-origin`,headers:{"content-type":`application/json`,...a?{"x-csrf-token":a}:{}},body:JSON.stringify(r==null?{findingId:t,body:n}:{body:n,version:i})});return{status:c.status,comment:c.ok?(await c.json()).comment:null}}catch{return{status:0,comment:null}}}async function oe(e,t,n,r,i){try{return(await F(`/api/reports/${encodeURIComponent(e)}/comments/${encodeURIComponent(t)}${Z(i)}`,{method:`DELETE`,credentials:`same-origin`,headers:{"content-type":`application/json`,...r?{"x-csrf-token":r}:{}},body:JSON.stringify({version:n})})).status}catch{return 0}}async function $(e,t,n,r){try{return(await F(`/api/reports/${encodeURIComponent(e)}/triage${Z(r)}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`,...n?{"x-csrf-token":n}:{}},body:JSON.stringify({entries:t})})).status}catch{return 0}}function se(e){e&&(location.href=e)}async function ce(e){if(i()){location.href=`/`;return}try{await F(`/api/auth/logout`,{method:`POST`,credentials:`same-origin`,headers:e?{"x-csrf-token":e}:{}})}catch{}location.reload()}async function le(e,t){let n=await F(`/api/auth/view-as`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`,...t?{"x-csrf-token":t}:{}},body:JSON.stringify({userId:e})});if(!n.ok)throw Error(`HTTP ${n.status}`);location.assign(`/`)}async function ue(e){try{await F(`/api/auth/view-as`,{method:`DELETE`,credentials:`same-origin`,headers:e?{"x-csrf-token":e}:{}})}catch{}location.assign(o[`admin-users`])}async function de(e){let t=await F(`/api/teams/${encodeURIComponent(e)}/share`,{credentials:`same-origin`});if(!t.ok)throw Error(`Could not load public links (${t.status})`);return(await t.json()).shares}async function fe(e,t,{id:n,revoke:r=!1,dependencies:i=!1,security:a=!1}={}){let o=n?`/${encodeURIComponent(n)}`:``,s=await F(`/api/teams/${encodeURIComponent(e)}/share${o}`,{method:r?`DELETE`:n?`PATCH`:`POST`,credentials:`same-origin`,headers:{"x-csrf-token":t,"content-type":`application/json`},...r?{}:{body:JSON.stringify({dependencies:i,security:a})}});if(!s.ok)throw Error(`Could not ${r?`revoke`:n?`update`:`create`} public link (${s.status})`);return s.json()}async function pe(e,t){let n=await F(`/api/bundles/${encodeURIComponent(e)}/download`,{credentials:`same-origin`});if(!n.ok)throw Error(`Could not download bundle (${n.status})`);let r=URL.createObjectURL(await n.blob()),i=document.createElement(`a`);i.href=r,i.download=t,i.click(),setTimeout(()=>URL.revokeObjectURL(r),6e4)}export{u as a,E as b,D as c,F as d,I as e,L as f,R as g,z as h,V as i,G as j,J as k,Y as l,X as m,Z as n,Q as o,ne as p,re as q,ie as r,ae as s,oe as t,$ as u,se as v,ce as w,le as x,ue as y,de as z,fe as A,pe as B};
@@ -0,0 +1 @@
1
+ function e(e=null){let t=[`anthropic/claude-opus-5.5`,`anthropic/claude-fable-5.1`,`anthropic/claude-sonnet-5.5`,`anthropic/claude-haiku-5.5`,`openai/gpt-6-astra`,`openai/gpt-6-astra-pro`,`openai/gpt-6.1-sol`,`openai/gpt-6.1-sol-pro`,`openai/gpt-6-luna`,`openai/gpt-6-luna-pro`,`moonshotai/kimi-k3`,`google/gemini-4-argon`,`google/gemma-4-31b-it`,`x-ai/grok-4.7`,`z-ai/glm-5.3`,`qwen/qwen3.8-max`,`deepseek/deepseek-v4.1-flash`,`deepseek/deepseek-v4-pro`,`mistralai/mistral-large-4-0`],n=e===`moonshot`?`moonshotai`:e,r=t.filter(t=>![`anthropic`,`openai`,`moonshot`].includes(e??``)||t.startsWith(`${n}/`)).map(e=>({id:e,efforts:[`low`,`medium`,`high`,`xhigh`,`max`]}));return{models:r,defaultModel:r[0].id}}export{e as a};