@preventive/triage 1.0.0-alpha.46 → 1.0.0-alpha.47
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/managed/agent-tasks.ts +5 -3
- package/common/managed/github-agents.ts +28 -10
- package/out/activity.js +4 -0
- package/out/chunk-5AHIQFFG.js +36 -0
- package/out/chunk-6ANSHRFQ.js +6 -0
- package/out/chunk-6WF3KNTL.js +3 -0
- package/out/chunk-7BKKYVWR.js +7 -0
- package/out/{chunk-7XRR4OFU.js → chunk-FH24VHSJ.js} +1 -1
- package/out/chunk-NOZJULWS.js +52 -0
- package/out/{chunk-OKRLLE5I.js → chunk-PWFUOLZK.js} +1 -1
- package/out/chunk-S6U2J62U.js +232 -0
- package/out/{chunk-G24A42V6.js → chunk-SPEFPML6.js} +1 -1
- package/out/chunk-UENXT2HK.js +3 -0
- package/out/chunk-VL43BTSO.js +1 -0
- package/out/{chunk-3PS4KWD2.js → chunk-WCPJDAYA.js} +1 -1
- package/out/chunk-ZCS4UYHI.js +1 -0
- package/out/chunk-ZGNMDGSB.js +1 -0
- package/out/client-managed-import.js +1 -1
- package/out/client-managed.js +22 -22
- package/out/client-sync.js +2 -2
- package/out/compare.js +14 -14
- package/out/dialogs.js +40 -40
- package/out/graph.js +11 -11
- package/out/index.html +11 -11
- package/out/scan.js +2 -2
- package/out/terminal.js +6 -6
- package/out/view.css +1 -1
- package/out/view.js +15 -15
- package/package.json +2 -1
- package/risk/index.d.ts +4 -2
- package/risk/npm/assess.js +15 -4
- package/risk/npm/registry.js +6 -1
- package/server-managed/activity.ts +24 -11
- package/server-managed/app-agents.ts +10 -21
- package/server-managed/bundle-build-worker.js +7 -3
- package/server-managed/bundle-build.ts +5 -3
- package/server-managed/bundle-cache.ts +9 -3
- package/server-managed/bundle.ts +3 -4
- package/server-managed/commit-coauthors.ts +5 -9
- package/server-managed/db-methods.ts +286 -149
- package/server-managed/db-neon.ts +11 -4
- package/server-managed/http.ts +75 -33
- package/server-managed/link-reports.ts +5 -1
- package/server-managed/npm-kept.ts +19 -5
- package/server-managed/npm-loads.ts +27 -15
- package/server-managed/npm-packages.ts +18 -11
- package/server-managed/npm-risk.ts +64 -17
- package/server-managed/pretty-print.ts +45 -12
- package/server-managed/report-store.ts +16 -11
- package/server-managed/repository-agents.ts +1 -1
- package/server-managed/repository-browser.ts +4 -2
- package/server-managed/repository-code.ts +28 -11
- package/server-managed/repository-pulse.ts +1 -1
- package/server-managed/solidity-entry-points.ts +5 -3
- package/server-managed/sql-postgres.ts +3 -0
- package/server-managed/sql.ts +2 -1
- package/server-managed/storage-db.ts +11 -3
- package/server-managed/storage-encryption.ts +7 -4
- package/server-managed/storage.ts +4 -2
- package/server-managed/team-feed.ts +3 -1
- package/server-managed/team-reports.ts +6 -1
- package/server-managed/uploads.ts +29 -9
- package/out/chunk-4UFAMJAX.js +0 -1
- package/out/chunk-BOIXMUU5.js +0 -3
- package/out/chunk-CC4OM6TZ.js +0 -3
- package/out/chunk-JKGQ3O7O.js +0 -6
- package/out/chunk-LE5ZWLG4.js +0 -235
- package/out/chunk-MSION3G4.js +0 -36
- package/out/chunk-S6GIXWQW.js +0 -52
- package/out/chunk-V3KWNNMY.js +0 -1
- package/out/chunk-WQ74ZBZF.js +0 -7
package/out/chunk-BOIXMUU5.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
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-S6GIXWQW.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};
|
package/out/chunk-CC4OM6TZ.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{Cb as e,Tb as t,Zb as n,rb as r,sb as i,tb as a,v as o,vb as s,wb as c,xb as l}from"./chunk-LE5ZWLG4.js";import{c as u,d}from"./chunk-MSION3G4.js";import{e as f,f as p,g as m,j as h}from"./chunk-SXV2T5C4.js";import{c as g}from"./chunk-2XUEZHIP.js";var _=`.token.comment,.token.prolog,.token.cdata{color:var(--code-comment);font-style:italic}.token.punctuation{color:var(--muted)}.token.string,.token.attr-value,.token.char,.token.regex{color:var(--code-string)}.token.number,.token.boolean,.token.constant,.token.symbol{color:var(--code-number)}.token.keyword,.token.builtin,.token.important,.token.atrule{color:var(--code-keyword)}.token.function,.token.class-name,.token.tag{color:var(--code-function)}.token.operator,.token.entity,.token.url,.token.attr-name,.token.selector{color:var(--code-operator)}.token.variable,.token.property,.token.parameter{color:var(--code-variable)}.token.annotation{color:var(--code-function)}.token.deleted{color:var(--code-deleted)}.token.inserted{color:var(--code-inserted)}.token.italic{font-style:italic}.token.bold{font-weight:700}.code-control{padding:0 .3em;margin:0 .1em;border-radius:3px;font-size:.8em;line-height:0;font-style:normal;font-weight:400;color:var(--warning);background:rgb(from var(--warning) r g b / .14);box-shadow:inset 0 0 0 1px rgb(from var(--warning) r g b / .45);white-space:nowrap;user-select:none}
|
|
2
|
-
`,v=g`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>`,y=g`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="1.8" y="5" width="20.4" height="14" rx="2"/><path d="M5.6 15.6V8.4l3.1 3.6 3.1-3.6v7.2"/><path d="M16.9 8.4v7.2m-2.6-2.9 2.6 2.9 2.6-2.9"/></svg>`,b=g`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M6 9V2h12v7"/><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><rect x="6" y="14" width="12" height="8"/></svg>`;function x(e,t){let n=u.find(t=>t.value===e)?.label??e;return d(e)?.includes(`partial`)?t===`exclude`?`${n} (full only)`:t===`only`?`${n} (partial only)`:n:n}function S(e){return h.filter(t=>e.has(t)).map(e=>f[e]??e).join(`, `)}function C(e=o){let t=[];if(e.filterSeverities.size>0&&t.push({key:`severity`,label:`Severity`,value:S(e.filterSeverities),clear:{filterSeverities:new Set}}),e.filterColors.size>0&&t.push({key:`marks`,label:`Marks`,value:[...e.filterColors].map(e=>m[e]??e).join(`, `),clear:{filterColors:new Set}}),e.filterSources.size===1&&t.push({key:`source`,label:`Source`,value:e.filterSources.has(`own`)?`Sources only`:`Dependencies only`,clear:{filterSources:new Set}}),e.filterAnalyzer&&t.push({key:`analyzer`,label:`Analyzer`,value:e.filterAnalyzer===r?`(none)`:e.filterAnalyzer,clear:{filterAnalyzer:``}}),e.filterModel&&t.push({key:`model`,label:`Model`,value:e.filterModel===a?`(none)`:e.filterModel,clear:{filterModel:``}}),e.filterRepo&&t.push({key:`repo`,label:`Repository`,value:e.filterRepo===i?`(no repo)`:e.filterRepo,clear:{filterRepo:``}}),d(e.filterRevalidate)&&t.push({key:`revalidate`,label:`Revalidation`,value:x(e.filterRevalidate,e.filterPartial),clear:{filterRevalidate:``,filterPartial:``}}),!e.filterRevalidate&&(e.filterConfMin>0||e.filterConfMax<10)){let n;n=e.filterConfMin>0&&e.filterConfMax<10?`${e.filterConfMin}\u2013${e.filterConfMax}`:e.filterConfMin>0?`\u2265 ${e.filterConfMin}`:`\u2264 ${e.filterConfMax}`,t.push({key:`confidence`,label:`Confidence`,value:n,clear:{filterConfMin:0,filterConfMax:10}})}e.filterInclude&&t.push({key:`search`,label:e.filterIncludeNegate?`Excluding`:`Search`,value:`"${e.filterInclude}"`,clear:{filterInclude:``,filterIncludeNegate:!1}});for(let[n,r]of[[`filterComment`,`comment`],[`filterFix`,`fix`],[`filterFlagged`,`flag`]]){let i=e[n];i&&t.push({key:`annotation:${r}`,label:`Annotation`,value:`${i===`with`?`With`:`Without`} ${r}`,clear:{[n]:``}})}return!o.currentWorkspace&&e.filterDuplicates&&t.push({key:`duplicates`,label:`Duplicates`,value:e.filterDuplicates===`with`?`Only rows linked to other reports`:`Exclude rows linked to other reports`,clear:{filterDuplicates:``}}),e.filterCrossContext&&t.push({key:`cross-context`,label:`Context`,value:e.filterCrossContext===`with`?`Only rows across multiple repos or packages`:`Exclude rows across multiple repos or packages`,clear:{filterCrossContext:``}}),e.filterAppStacked&&t.push({key:`app-stacked`,label:`App stack`,value:e.filterAppStacked===`with`?`Only rows with multiple App findings`:`Exclude rows with multiple App findings`,clear:{filterAppStacked:``}}),e.filterSecurity&&t.push({key:`security`,label:`Security`,value:e.filterSecurity===`with`?`Only security-related rows`:`Exclude security-related rows`,clear:{filterSecurity:``}}),t}function w(){return n().filter(e=>t(e).commonTriage===o.shownTriage)}function T(){return o.shownTriage?p[o.shownTriage]??o.shownTriage:null}function E(t,n=s()){let r=w(),i=r.length;c(n);let a;try{a=e(r).length}finally{l()}return{included:a,total:i,excluded:i-a,fields:n,filters:C(n),bucketLabel:T(),focusedOnly:t===`print`&&o.viewMode===`focus`}}var D=`.managed-comment{container:managed-comment / inline-size;white-space:normal}.managed-comment-row{display:grid;grid-template-columns:minmax(0,max-content) minmax(0,1fr) auto;align-items:start;gap:.35rem .65rem;line-height:1.5}.managed-comment-author{grid-column:1;grid-row:1;display:flex;align-items:center;gap:.45rem;min-width:0;max-width:14rem;& strong{overflow:hidden;text-overflow:ellipsis;font-weight:600}}.managed-comment-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;flex:none;width:1.3rem;height:1.3rem;overflow:hidden;border-radius:50%;background:rgb(from var(--muted) r g b / .15);color:var(--muted);font-size:.65rem;font-weight:600;& img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}& img[hidden]{display:none}}.managed-comment-body{grid-column:2;grid-row:1;min-width:0;white-space:pre-wrap;overflow-wrap:anywhere;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}& a.comment-self-ref{text-decoration:underline dotted;text-underline-offset:2px}& a.comment-self-ref:hover{text-decoration:underline solid}}.managed-comment-time{color:var(--muted);font-size:.7rem;font-weight:400;white-space:nowrap;text-align:right}.managed-comment-meta{grid-column:3;grid-row:1;justify-self:end;display:flex;align-items:center;gap:.5rem;min-height:1.3rem}.managed-comment-actions{display:flex;align-items:center;gap:.15rem}.managed-comment-row:not(:has(.managed-comment-author)){grid-template-columns:minmax(0,1fr) auto;.managed-comment-body{grid-column:1}.managed-comment-meta{grid-column:2}}@container managed-comment (max-width: 28rem){.managed-comment-row:has(.managed-comment-meta){grid-template-columns:minmax(0,max-content) minmax(0,1fr);.managed-comment-meta{grid-column:1 / -1;grid-row:1}.managed-comment-author,.managed-comment-body{grid-row:2}}.managed-comment-row:not(:has(.managed-comment-author)){grid-template-columns:minmax(0,1fr)}.managed-comment-author{max-width:9rem}}
|
|
3
|
-
`;export{_ as a,v as b,y as c,b as d,C as e,w as f,T as g,E as h,D as i};
|
package/out/chunk-JKGQ3O7O.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./chunk-SXV2T5C4.js";import{b as t}from"./chunk-TUII34K2.js";var n={__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`},r={__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 i(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 a(e,t,a){if(typeof t==`string`&&r[t])return r[t];if(typeof e!=`string`)return null;let o=e.slice(e.lastIndexOf(`/`)+1),s=o.lastIndexOf(`.`);if(s<=0)return null;let c=o.slice(s+1).toLowerCase();return c===`map`?i(a)?`json`:null:n[c]??null}var o=new Set([`module`,`commonjs`,`json`,`module-typescript`,`commonjs-typescript`]),s=new Set([`solidity`,`php`,`shell`,`rust`]),c=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`]),l=new Set([`resource`,`resource:base64`]),u=new Set([`stat:file`,`stat:directory`]),d=new Set([...o,...s,...c,...l,`patch`,`directory`,...u]),f=e=>u.has(e),p=e=>e===`directory`||e===`stat:directory`?`directory`:`file`;function m(e,t,n){if(e===t)return e;let r=f(e);if(r!==f(t)&&p(e)===p(t))return r?t:e;throw Error(`format conflict for '${n}' ('${t}' vs '${e}')`)}function h(e,t){return t===``?e:e===`.`?t:`${e}/${t}`}var ee=/^(?=[A-Za-z0-9-]{1,39}\/)[A-Za-z0-9](?:-?[A-Za-z0-9])*\/(?!\.\.?$)[\w.-]{1,100}$/u,te=/^(?!\.\.?(?:\/|$))[\w.~@+-]+(?:\/(?!\.\.?(?:\/|$))[\w.~@+-]+)*$/u,ne=/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u,g={github:e=>typeof e==`string`&&ee.test(e),directory:e=>typeof e==`string`&&e.length<=1024&&(e===``||te.test(e)),commit:e=>typeof e==`string`&&ne.test(e)},re=(e,t)=>e?.toLowerCase()===t?.toLowerCase(),_=(e,t,n)=>{if(e===void 0)return;x(e)||y(!1,`${n} must be an object`);for(let r of Object.keys(e))Object.hasOwn(t,r)||y(!1,`unknown ${n} key '${r}'`);let r=Object.entries(t).map(([t,r])=>typeof r==`object`?[t,_(e[t],r,`${n}.${t}`)]:(e[t]!==void 0&&!r(e[t])&&y(!1,`invalid ${n}.${t}: ${JSON.stringify(e[t])}`),[t,e[t]])).filter(([,e])=>e!==void 0);return r.length===0?void 0:Object.freeze(S(r))},ie=(e,t=`bundle repo`)=>_(e,g,t),ae=(e,t)=>t??(O(e)?`npm`:void 0),oe=(e,{ecosystem:t,repo:n},r)=>{if(n===void 0)return;ae(e,t)===void 0&&y(!1,`${r}: '${e}' is no dependency's bucket, and carries no repo`);let i=ie(n,`${r} module '${e}' repo`);return i?.github===void 0&&y(!1,`${r} module '${e}' repo has no github`),i},v=({name:e,version:t,ecosystem:n,repo:r,files:i})=>({name:e,version:t,...n===void 0?{}:{ecosystem:n},...r===void 0?{}:{repo:r},files:i});function se({name:e,version:t,ecosystem:n,repo:r,files:i},a,o){return y(n===void 0||typeof n==`string`),v({name:e,version:t??void 0,ecosystem:n,repo:oe(a,{ecosystem:n,repo:r},o),files:S(Object.entries(i))})}function ce(e,{scope:t=`full`}={}){let n=new Set;for(let[r,{files:i}]of e)if(t===`full`||O(r))for(let e of Object.keys(i))n.add(h(r,e));return n}function le(e,{what:t,files:n,formats:r,scope:i}){if(e.includes(`\\`))return`holds a '\\'`;if(w(e))return`escapes the root`;if(i!==`full`&&!O(e))return`is outside node_modules, which a '${i}'-scope ${t} does not record`;if(!n.has(e))return`names no file the ${t} records`;let a=r.get(e);return a===`directory`?`is a directory capture, not a file`:f(a)?`is a payload-free '${a}' record, not a file`:null}function ue(e,{what:t,files:n,formats:r,scope:i}){for(let a of e){let e=le(a,{what:t,files:n,formats:r,scope:i});y(e===null,`${t}: executable entry '${a}' ${e}`)}}function de(e,{what:t,files:n,formats:r,scope:i=`full`}){if(e===void 0)return new Set;let a=`${t}: executable`;y(Array.isArray(e),`${a} must be an array of file paths`);let o=new Set;for(let t of e)y(typeof t==`string`&&t!==``,`${a} entry must be a non-empty string`),y(!o.has(t),`${a} entry '${t}' is listed twice`),o.add(t);return ue(o,{what:t,files:n,formats:r,scope:i}),o}function fe(e,{what:t,modules:n,formats:r,scope:i}){if(e.size!==0)return ue(e,{what:t,files:ce(n,{scope:i}),formats:r,scope:i}),C(e)}function y(e,t){if(!e)throw Error(t)}function pe(e,t){let[n,r]=[e.split(`/`),t.split(`/`)];for(;n.length>0&&n[0]===r[0];)n.shift(),r.shift();if(n.length===0&&r.length===0)return 0;if(n.length<2)return r.length<2&&n>r?1:-1;if(r.length<2)return 1;if(n[0]===`*`)return-1;if(r[0]===`*`||n[0]===`node_modules`)return 1;if(r[0]===`node_modules`)return-1;let[i,a]=[n,r].map(e=>e.join(String.fromCodePoint(0)));if(i<a)return-1;if(i>a)return 1;throw Error(`Unreachable`)}var b=(e,t)=>pe(e[0],t[0]),x=e=>e&&[null,Object.prototype].includes(Object.getPrototypeOf(e)),S=e=>Object.setPrototypeOf(Object.fromEntries(e),null),C=e=>[...e].toSorted(pe),me=(e,{sorted:t=!0}={})=>S((t?[...e].toSorted(b):[...e]).map(([e,n])=>[e,n instanceof Map?me(n,{sorted:t}):n])),he=(e,t)=>e.get(t)??e.set(t,new Map).get(t),ge=e=>new Map(Object.entries(e).map(([e,t])=>[e,x(t)?ge(t):t]));function w(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 _e=e=>e.includes(`\\`)||w(e),T=(e,t)=>y(!_e(e),`${t}: path '${e}' escapes the root or holds a '\\'`),ve=(e,t)=>y(typeof e==`string`&&e!==``&&!_e(e),`${t}: invalid entry ${JSON.stringify(e)}`);function ye(e,t){y(Array.isArray(e),`${t}: entries must be an array of file paths`);let n=new Set;for(let r of e)ve(r,t),y(!n.has(r),`${t}: entry '${r}' is listed twice`),n.add(r);return n}function be(e,t){for(let n of e)ve(n,t);return C(e)}function xe(e,t){T(e,`formats`),y(d.has(t),`unknown format '${t}' for ${e}`)}function Se(e){y(x(e));let t=new Map;for(let[n,r]of Object.entries(e)){xe(n,r);let e=n===``?`.`:n;y(!t.has(e),`duplicate format key '${e}'`),t.set(e,r)}return t}function Ce(e){for(let[t,n]of e)xe(t,n);return me(e)}function we(e){for(let[,t]of e){y(t instanceof Map);for(let[e,n]of t){T(e,`imports`),y(n instanceof Map);for(let[,e]of n){if(typeof e==`string`){T(e,`imports`);continue}y(e instanceof Map&&e.size>0,`import target must be a file or a non-empty {platform: file} map`);for(let[t,n]of e)y(typeof t==`string`&&t.length>0&&!t.includes(`/`),`invalid platform key '${t}'`),y(typeof n==`string`),T(n,`imports`)}}}}function Te(e){y(x(e));let t=ge(e);return we(t),t}function Ee(e){return we(e),me(e)}function De(e,{skipEmpty:t=!1,repo:n=!0,what:r}={}){let i={modules:[],sources:[]};for(let[a,o]of e){if(t&&Object.keys(o.files).length===0)continue;let e=O(a);e&&y(o.name&&o.version&&o.files);let s=S(Object.entries(o.files).toSorted(b));i[e?`modules`:`sources`].push([a,v({...o,repo:n?oe(a,o,r):void 0,files:s})])}return{modules:S(i.modules.toSorted(b)),sources:S(i.sources.toSorted(b))}}function Oe(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[n,r]of e)if(t.get(n)!==r)return!1;return!0}var ke=e=>e instanceof Map?`{${[...e].map(([e,t])=>`${e}: ${t}`).join(`, `)}}`:e;function Ae(e,t,n){let r=new Map,i=e=>{for(let[t,i]of e){let e=he(r,t);for(let[t,r]of i){let i=he(e,t);for(let[e,a]of r)i.has(e)?y(Oe(i.get(e),a),`${n}: import '${e}' from '${t}' resolves differently ('${ke(i.get(e))}' vs '${ke(a)}')`):i.set(e,a instanceof Map?new Map(a):a)}}};return i(e),i(t),r}function je(e,t,n){let r=new Map,i=e=>{for(let[t,i]of e){let e=r.get(t);if(e===void 0){r.set(t,i);continue}try{r.set(t,m(i,e,t))}catch(e){throw Error(`${n}: ${e.message}`,{cause:e})}}};return i(e),i(t),r}function Me(e,t,n,r){if(e.size===0)return new Set(t);let i=ce(n,{scope:r}),a=new Set(t);for(let t of e)i.has(t)||a.add(t);return a}var Ne=/(?:^|\/)\.{0,2}(?:\/|$)/u;function E(e,t,n){let r=h(e,t);return(r!==`.`||t!==``)&&Ne.test(r)&&y(!1,`${n}: non-canonical file key ${JSON.stringify(r)}`),r.includes(`\\`)&&y(!1,`${n}: file key '${r}' holds a '\\', which no path may`),r}function D(e,t,n){let r=new Map;for(let[i,{files:a}]of e){typeof i!=`string`&&y(!1,`${t}: bucket dir ${String(i)} is not a string`),T(i,t);for(let e of Object.keys(a)){let a=E(i,e,t),o=r.get(a);o!==void 0&&n(a,o,i),r.set(a,i)}}return r}var Pe=(e,t)=>n=>y(!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 Fe(e,t,n){let r=new Map,i=e=>{for(let[t,i]of e){let e=r.get(t);if(e===void 0){r.set(t,v({...i,files:Object.assign(Object.create(null),i.files)}));continue}y(e.name===i.name,`${n}: module '${t}' name mismatch ('${e.name}' vs '${i.name}')`),y(e.version===i.version,`${n}: module '${t}' version mismatch ('${e.version}' vs '${i.version}')`+(e.version==null==(i.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)`)),y(e.ecosystem===i.ecosystem,`${n}: module '${t}' ecosystem mismatch ('${e.ecosystem??`(none)`}' vs '${i.ecosystem??`(none)`}')`),e.repo===void 0&&i.repo!==void 0&&r.set(t,v({...e,repo:i.repo}));for(let[r,a]of Object.entries(i.files))Object.hasOwn(e.files,r)?y(e.files[r]===a,`${n}: content mismatch for '${h(t,r)}'`):e.files[r]=a}};return i(e),i(t),D(r,n,(e,t,r)=>y(!1,`${n}: file '${e}' is bucketed under both '${t}' and '${r}' -- module bucketing changed between the artifacts (a workspace package without a version now owns its own bucket); regenerate the artifact (bundle=replace / lock=replace)`)),r}function O(e){return e.split(`/`).includes(`node_modules`)}function Ie(e){let t=e.length;for(;(t=e.lastIndexOf(`node_modules/`,t-1))!==-1;)if(t===0||e[t-1]===`/`)return t;return-1}function Le(e){let t=Ie(e);if(t===-1)return null;let n=t+13,r=e.slice(n).split(`/`),i=r[0].startsWith(`@`)?2:1;if(r.length<=i||r.slice(0,i).some(e=>!e))return null;let a=r.slice(0,i).join(`/`);return{dir:e.slice(0,n)+a,rel:r.slice(i).join(`/`),name:a}}var k=1,Re=0,ze=Pe(`bundle`,`artifact (bundle=replace)`),Be=e=>Le(e)??{dir:`.`,rel:e===`.`?``:e,name:null};function Ve(){throw Error(`bundle: file contents are not retained by this contents-free Bundle`)}var He=(e,{files:t,...n})=>{let r=Object.create(null);for(let[n,i]of Object.entries(t))typeof i!=`symbol`&&y(!1,`bundle: file '${h(e,n)}' is not a placeholder`),Object.defineProperty(r,n,{get:Ve,enumerable:!0});return{...n,files:Object.freeze(r)}},A=(e,t)=>{if(e===void 0&&t===void 0)return;let n=new Map;for(let r of[e,t])for(let[e,t]of Object.entries(r??{})){if(!Array.isArray(t))continue;let r=n.get(e);r===void 0&&n.set(e,r=new Set);for(let e of t)r.add(e)}return S([...n.keys()].toSorted().map(e=>[e,C(n.get(e))]))},Ue=(e,t)=>Object.hasOwn(g,e)&&g[e](t),We=(e,t)=>e?.github===void 0||!re(e.github,t?.github)?void 0:S(Object.keys(g).filter(n=>e[n]!==void 0&&(n===`github`||e[n]===t[n])).map(t=>[t,e[t]])),Ge=e=>{if(!x(e)||e.root!==!0||Object.hasOwn(e,`directory`))return e;let{root:t,...n}=e;return n},Ke=e=>typeof e==`string`&&/^[\w.+@/~'!()*-]+$/u.test(e),j={name:Ke,version:Ke},qe={npm:j,composer:j,cargo:j},Je=(e,t)=>S(Object.keys(qe).map(n=>{let[r,i]=[e?.[n],t?.[n]];return[n,r?.name!==void 0&&r.name===i?.name?S(Object.entries(r).filter(([e,t])=>t===i[e])):void 0]})),M=class e{static VERSION=k;version=k;config;entries;modules;formats;imports;executable;reason;#e;get repo(){return this.#e}set repo(e){this.#e=ie(e)}#t;get package(){return this.#t}set package(e){this.#t=_(e,qe,`bundle package`)}constructor({config:e={scope:`full`},entries:t,modules:n,formats:r,imports:i,executable:a,reason:o,repo:s,package:c,version:l=k}={}){y([Re,k].includes(l)),y([`node_modules`,`full`].includes(e.scope)),this.version=l,this.config=e,this.entries=t??new Set,this.modules=n??new Map,this.formats=r??new Map,this.imports=i??new Map,this.executable=a??new Set,this.reason=o,this.repo=ie(s),this.package=c}get sources(){let e=new Map;for(let[t,{files:n}]of this.modules)for(let[r,i]of Object.entries(n))e.set(h(t,r),i);return e}static isResourceFormat(e){return e===`resource`||e===`resource:base64`||e===`directory`}get hasCode(){for(let[t,{files:n}]of this.modules)for(let r of Object.keys(n))if(!e.isResourceFormat(this.formats.get(h(t,r))))return!0;return!1}static parse(t){return e.fromJSON(JSON.parse(t))}static fileKeyAt(e){let[t,n,r,i]=e;if(typeof n==`string`){if(e.length===2&&t===`sources`){let e=Be(n);return E(e.dir,e.rel,`bundle`)}if(e.length===4&&(t===`sources`||t===`modules`)&&r===`files`&&typeof i==`string`)return E(n,i,`bundle`)}}static fromJSON(t,{contents:n=!0}={}){y(t.version===k||t.version===Re),y([`node_modules`,`full`].includes(t.config?.scope));let r=Se(t.formats),i=new Map,a=new Set;if(t.version===k){let e=t.config.scope===`full`;if(t.modules!==void 0){y(typeof t.modules==`object`&&t.modules!==null);for(let[e,n]of Object.entries(t.modules))y(O(e)),T(e,`bundle`),y(n?.name&&n.version&&n.files),i.set(e,se(n,e,`bundle`))}if(e){y(t.sources&&typeof t.sources==`object`);for(let[e,n]of Object.entries(t.sources))y(!O(e)),T(e,`bundle`),y(n?.name&&n.files),i.set(e,se(n,e,`bundle`));t.entries!==void 0&&(a=ye(t.entries,`bundle`))}else y(t.entries===void 0),y(t.sources===void 0)}else{y(t.sources);for(let[e,n]of Object.entries(t.sources)){T(e,`bundle`);let{dir:t,rel:r,name:a}=Be(e);y(!w(t)&&!w(r)),i.has(t)||i.set(t,{name:a,version:null,files:Object.create(null)});let{files:o}=i.get(t);y(!Object.hasOwn(o,r),`bundle: duplicate file key '.' (v0 '' and '.')`),o[r]=n}}let o=D(i,`bundle`,ze),s=Te(t.imports);if(!n)for(let[e,t]of i)i.set(e,He(e,t));return new e({version:t.version,config:t.config,entries:a,modules:i,formats:r,imports:s,executable:t.version===k?de(t.executable,{what:`bundle`,files:o,formats:r,scope:t.config.scope}):new Set,reason:x(t.reason)?t.reason:void 0,repo:Ge(t.repo),package:t.package})}serialize(){D(this.modules,`bundle`,ze);let{modules:e,sources:t}=De(this.modules,{skipEmpty:!0,what:`bundle`}),n=this.config.scope===`full`,r={version:k,config:this.config};this.repo!==void 0&&(r.repo=this.repo),this.package!==void 0&&(r.package=this.package),n&&(r.entries=be(this.entries,`bundle`)),r.formats=Ce(this.formats),r.imports=Ee(this.imports);let i=fe(this.executable,{what:`bundle`,modules:this.modules,formats:this.formats,scope:this.config.scope});return i!==void 0&&(r.executable=i),this.reason!==void 0&&(r.reason=A(this.reason,void 0)),n&&(r.sources=t),r.modules=e,JSON.stringify(r,void 0,2)}withReason(t){let{version:n,config:r,entries:i,modules:a,formats:o,imports:s,executable:c,repo:l,package:u}=this,d=A(this.reason,{[t]:[...this.sources.keys()]});return new e({version:n,config:r,entries:i,modules:a,formats:o,imports:s,executable:c,reason:d,repo:l,package:u})}merge(t){return y(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:Fe(this.modules,t.modules,`bundle merge`),formats:je(this.formats,t.formats,`bundle merge`),imports:Ae(this.imports,t.imports,`bundle merge`),executable:Me(this.executable,t.executable,t.modules,this.config.scope),reason:A(this.reason,t.reason),repo:We(this.repo,t.repo),package:Je(this.package,t.package)})}},Ye=/^webpack(?:-internal)?:\/\/[^/]*\//u,Xe=/^[a-z][\d+.a-z-]*:/iu,Ze=/^file:/iu,Qe=/^(?:file|ftp|https?|wss?):/iu,$e=/^(?:[a-z][\d+.a-z-]*:\/\/[^/]*\/?|\/\/[^/]+\/|[a-z]:\/|\/)?/iu,N=e=>$e.exec(e)[0],P=e=>N(e).includes(`://`),F=e=>e.replace(P(e)?/[#?].*$/su:/\?.*$/su,``),et=e=>e.slice(e.lastIndexOf(`/`)+1),I=(e,t)=>URL.parse(e,t)?.href??null;function L(e){let t=N(e),n=t.includes(`://`)&&I(e);if(n)return n;let r=[];for(let n of e.slice(t.length).split(`/`))n===``||n===`.`||(n===`..`?r.length>0&&r.at(-1)!==`..`?r.pop():t||r.push(`..`):r.push(n));let i=/^[a-z]:\/$/iu.test(t)?t.toUpperCase():t.startsWith(`//`)?t.toLowerCase():t;return i?i.replace(/\/?$/u,`/`)+r.join(`/`):r.join(`/`)||`.`}function tt(e,t){let n=N(t);return P(e)&&!n.includes(`:`)?I(t,e)??L(`${e}/../${t}`):L(n===`/`?N(e).replace(/\/?$/u,``)+t:n?t:`${e}/../${t}`)}function nt(e){try{return decodeURIComponent(e)}catch{return e}}function R(e,t){let n=e.replaceAll(`\\`,`/`);if(Ye.test(n))return L(n.replace(Ye,``));let r=Qe.test(n)?I(n)??n:n,i=/^file:\/\/([^/#]*)([^#]*)/isu.exec(r);if(i){let[,e,t]=i;return L(nt(e&&e.toLowerCase()!==`localhost`?`//${e}${t}`:t).replace(/^\/(?=[a-z]:\/)/iu,``))}if(Xe.test(r)&&!N(r).includes(`:`))return r;if(t===void 0)return L(r);if(Ze.test(t)&&!N(r))return R(I(r,t)??r);let a=R(t);return N(r)&&!P(a)?L(r):tt(a,r)}var rt=/^(?:@[\dA-Za-z~-][\w.~-]*\/)?[\dA-Za-z~-][\w.~-]*$/u;function z(e){let t=e.split(`/`).slice(0,e.startsWith(`@`)?2:1).join(`/`);return rt.test(t)?t:null}var it=new Set([`.pnpm`,`.bun`,`.deno`]),at=/^\d+\.\d+\.\d+(?:-[\d.a-z-]+)?(?:\+[\d.a-z-]+)?$/iu;function ot(e,t){let n=`${t.replace(`/`,`+`)}@`,r=e.startsWith(n)?e.slice(n.length).split(/[(_]/u)[0]:null;return at.test(r)?r:null}function st(e){let t=F(e).split(`/`),n=t.lastIndexOf(`node_modules`),r=n<0?null:z(t.slice(n+1).join(`/`));if(r===null)return null;let i=n+1+r.split(`/`).length;if(i>=t.length||t.slice(i).includes(``))return null;let a=t.slice(0,i).join(`/`);return{name:r,version:it.has(t[n-2])?ot(t[n-1],r):null,root:a,path:e.slice(a.length+1)}}var ct=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 lt(e){let t=et(F(e));return/^[\w-]+$/u.test(t)?`jsx`:ct.get(/\.([\da-z]+)$/iu.exec(t)?.[1].toLowerCase())??null}var ut=[`.js`,`.mjs`,`.cjs`,`.jsx`,`.ts`,`.tsx`,`.mts`,`.cts`,`.json`],dt=[`.ios`,`.android`,`.web`];function ft(e){let t=e.map(e=>/\.[a-z]+(?=\.\w+$)/u.exec(et(F(e.path??``)))?.[0]),[[n,r],[,i]]=dt.map(e=>[e,t.filter(t=>t===e).length]).toSorted((e,t)=>t[1]-e[1]);return[...r===i?[]:[n],`.native`,``,`.browser`,`.node`]}var pt=new Map([[`.js`,[`.ts`,`.tsx`]],[`.jsx`,[`.tsx`]],[`.mjs`,[`.mts`]],[`.cjs`,[`.cts`]]]),mt=[`index`,`main`,`browser`,`node`],ht=[``,`src/`,`lib/`,`dist/`,`build/`],gt=new Set([`lib`,`dist`,`build`,`out`,`esm`,`cjs`]);function*_t(e,t){yield e;let n=/\.[^./]+$/u.exec(e)?.[0];for(let t of pt.get(n)??[])yield e.slice(0,-n.length)+t;for(let n of e.endsWith(`/`)?[`${e}index`]:[e,`${e}/index`])for(let e of ut)for(let r of t)yield n+r+e;if(n)for(let r of t.filter(Boolean))yield e.slice(0,-n.length)+r+n}function*vt(e){let t=e;for(;;){t.startsWith(`src/`)||(yield`src/${t}`),t!==e&&(yield t);let n=t.indexOf(`/`);if(n<0||!gt.has(t.slice(0,n)))return;t=t.slice(n+1)}}function yt(e){let t=new Map,n=new Map,r=new Map;for(let i of e)i.path!==null&&t.set(i.path,i),i.package&&(n.set(i.package.name,(n.get(i.package.name)??new Set).add(i.package.root)),(r.get(i.package.root)??r.set(i.package.root,[]).get(i.package.root)).push(i));return{byPath:t,roots:n,byRoot:r,platforms:ft(e),found:new Map}}function B(e,t){if(!e.found.has(t)){let n=F(t),r=_t(n,e.platforms).map(e=>e+t.slice(n.length));e.found.set(t,e.byPath.get(r.find(t=>e.byPath.has(t)))??null)}return e.found.get(t)}function bt(e,t,n){let r=e.roots.get(n);if(!r)return null;let i=t.path.split(`/`);for(let e=i.length-1;e>=0;e--){let t=[...i.slice(0,e),`node_modules`,n].join(`/`);if(r.has(t))return t}return r.size===1?[...r][0]:null}var xt=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`.split(`.`));function St(e){if(e.startsWith(`node:`)||xt.has(e))return{builtin:!0};let t=z(F(e));return t===null?{}:{package:t}}function Ct(){let e=[],t=new Map,n=(n,r,i)=>{let a=t.get(n)??t.set(n,new Set).get(n);a.has(r)||(a.add(r),e.push(i))};return{edges:e,add:n,link:(e,t,r)=>{e&&t&&t!==e&&n(e,t,{from:e,to:t,kind:r})}}}function wt(e,t){for(let n of mt)for(let r of ht){let i=B(e,`${t}/${r}${n}`);if(i)return i}let n=e.byRoot.get(t);return n?.length===1?n[0]:null}function Tt(e,t,n,r){return/^\/[^?]/u.test(n)?B(e,t+n)??vt(n.slice(1)).map(n=>B(e,`${t}/${n}`)).find(Boolean):B(e,t+n)??r(e,t)}function Et(e,t,n,r=wt){let i=/^(?:\.{1,2}|[a-z]:)?\\/iu.test(n)?n.replaceAll(`\\`,`/`):n,a=Qe.test(i);if(a||/^(?:\.{1,2}(?:\/|$)|\/|[a-z]:\/)/iu.test(i)||P(i)){let n=a?R(i):tt(t.path,i),r=B(e,n);return r?{to:r}:{to:null,path:n}}if(Xe.test(i)&&e.byPath.has(i))return{to:e.byPath.get(i)};let o=z(F(n)),s=o===null?null:bt(e,t,o);if(s===null)return{to:null,...St(n)};let c=Tt(e,s,n.slice(o.length),r);return c?{to:c}:{to:null,package:o}}var V=class extends Error{name=`SourceMapError`},Dt=new Uint8Array(128).fill(255);for(let[e,t]of[...`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/,;`].entries())Dt[t.codePointAt(0)]=e;function H(e){let t=new Int32Array(e.length*2);return t.set(e),t}function Ot(e){let{starts:t,columns:n,sources:r,names:i}=e;for(let e=0;e+1<t.length;e++){let[a,o]=[t[e],t[e+1]],s=a+1;for(;s<o&&n[s-1]<=n[s];)s++;if(s>=o)continue;let c=Array.from(n.subarray(a,o),(e,t)=>[e,r[a+t],i[a+t]]).sort((e,t)=>e[0]-t[0]);for(let[e,[t,o,s]]of c.entries())[n[a+e],r[a+e],i[a+e]]=[t,o,s]}return e}function kt(e){let t=[0],n=new Int32Array(1024),r=new Int32Array(1024),i=new Int32Array(1024),a=0;for(let{mappings:o,files:s,line:c,column:l,names:u,nameCount:d}of e){if(typeof o!=`string`)throw new V(`mappings is not a string`);for(;t.length<=c;)t.push(a);let e=[0,0,0,0,0],f=0,p=0,m=1,h=l;for(let c=0;c<=o.length;c++){let l=c<o.length?Dt[o.codePointAt(c)]??255:64;if(l<32){if(p+=l*m,f===5)throw new V(`mappings: a segment of more than 5 fields at ${c}`);e[f++]+=p%2?(1-p)/2:p/2,p=0,m=1;continue}if(l<64){if(p+=(l-32)*m,m*=32,m>2**30)throw new V(`mappings: a value at ${c} runs past 32 bits`);continue}if(l===255)throw new V(`mappings: ${JSON.stringify(o[c])} at ${c} is not a base64 digit`);if(m!==1)throw new V(`mappings: the value before ${c} is cut off`);if(f>0){if(f===2||f===3)throw new V(`mappings: a segment of ${f} fields before ${c}`);let t=f===1?-1:s[e[1]];if(t===void 0)throw new V(`mappings: source ${e[1]} before ${c} is not in sources`);if(e[0]<0)throw new V(`mappings: a negative generated column before ${c}`);a===n.length&&([n,r,i]=[H(n),H(r),H(i)]),n[a]=e[0]+h,r[a]=t,i[a++]=f===5&&e[4]>=0&&e[4]<d?u+e[4]:-1,f=0}l===65&&(t.push(a),e[0]=0,h=0)}}return t.push(a),Ot({starts:Int32Array.from(t),columns:n.slice(0,a),sources:r.slice(0,a),names:i.slice(0,a)})}var At=new WeakMap,jt=e=>At.get(e),U=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function W(e,t){if(!e)throw new V(t)}function Mt(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 Nt(e,t,n,r){let i=e.bySource.get(t);if(i!==void 0)return e.files[i].content??=n,e.files[i].ignored||=r,i;let a=t===null?null:R(t,e.mapPath);return e.files.push({source:t,path:a,package:a===null?null:st(a),content:n,ignored:r}),t!==null&&e.bySource.set(t,e.files.length-1),e.files.length-1}function Pt(e,t,n,r){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 i=Mt(e.sources,`sources`),a=Mt(e.sourcesContent,`sourcesContent`),o=e.ignoreList??e.x_google_ignoreList??[];W(Array.isArray(o)&&o.every(e=>Number.isInteger(e)&&e>=0&&e<i.length),`ignoreList is not a list of indices into sources`);let s=new Set(o),c=e.sourceRoot?e.sourceRoot.replace(/\/?$/u,`/`):``,l=i.map((e,n)=>Nt(t,e===null?null:c+e,a[n]??null,s.has(n))),u=Array.isArray(e.names)?e.names:[];t.parts.push({mappings:e.mappings,files:l,line:n,column:r,names:t.names.length,nameCount:u.length}),t.names.push(...u)}function Ft(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,r]of e.sections.entries()){let{offset:i,map:a}=U(r)?r:{};W(U(i)&&[i.line,i.column].every(e=>Number.isInteger(e)&&e>=0),`sections[${n}].offset is not a line and a column`),W(U(a)&&a.sections===void 0,`sections[${n}].map is not a plain source map`);let o=e.sections[n-1]?.offset;W(!o||o.line<i.line||o.line===i.line&&o.column<=i.column,`sections[${n}] starts before sections[${n-1}]`),Pt(a,t,i.line,i.column)}}function It(e,t={}){if(!U(t))throw TypeError(`readSourceMap: options is not an object`);if(t.path!==void 0&&typeof t.path!=`string`)throw TypeError(`readSourceMap: options.path is not a string`);let n=e;if(typeof e==`string`||e instanceof Uint8Array)try{let t=typeof e==`string`?e:new TextDecoder(`utf-8`,{fatal:!0}).decode(e);n=JSON.parse(t.replace(/^\)\]\}'[^\n]*\n/u,``))}catch(e){throw new V(`not JSON: ${e.message}`,{cause:e})}W(U(n),`not a JSON object`);let r={files:[],bySource:new Map,mapPath:t.path,parts:[],names:[]};n.sections===void 0?Pt(n,r,0,0):Ft(n,r);let i={files:r.files};return At.set(i,{...kt(r.parts),nameList:r.names}),i}var Lt=/\r\n?|[\n\u2028\u2029]/gu;function Rt(e){let t=[0];for(let n of e.matchAll(Lt))t.push(n.index+n[0].length);return t}function zt(e,t,n,r){let[i,a]=[t,n];for(;i<a;){let t=i+a>>1;e[t]<=r?i=t+1:a=t}return i-1}function G(e,t){let n=zt(e,0,e.length,t);return[n,t-e[n]]}function Bt(e,[t,n]){if(t>=e.starts.length-1)return-1;let r=e.starts[t],i=zt(e.columns,r,e.starts[t+1],n);return i<r?-1:i}function Vt(e,t,n,r){let i=jt(e),a=G(t,n),[o,s]=G(t,r),c=new Map,l=Bt(i,a);for(let e=a[0];e<=o&&e<i.starts.length-1;e++){let t=e===a[0]&&l>=0?l:i.starts[e];for(let n=t;n<i.starts[e+1];n++){let t=i.sources[n];if(e===o&&i.columns[n]>=s)break;t>=0&&c.set(t,(c.get(t)??0)+1)}}let[u]=[...c].reduce((e,t)=>t[1]>e[1]?t:e,[-1,0]);return u<0?null:e.files[u]}var K=/\s+/uy,Ht=`
|
|
2
|
-
\r\u2028\u2029`,q=/[\n\r\u2028\u2029]/gu,Ut=/[\n\r\u2028\u2029]/u,J=/[\w$\u0080-]+/uy,Wt=new Set([`return`,`typeof`,`instanceof`,`in`,`of`,`new`,`delete`,`void`,`throw`,`case`,`default`,`extends`,`do`,`else`,`yield`,`await`]),Gt=new Set([`if`,`while`,`for`,`with`]),Kt=new Set([`break`,`continue`,`debugger`]),qt=new Set([`(`,`[`,"${",`,`,`=`,`:`,`?`,`!`,`~`,`+`,`-`,`*`,`/`,`%`,`&`,`|`,`^`,`<`,`>`]);function Jt(e,t){return e?.type===`word`?t&&[`return`,`yield`].includes(e.value)?!1:Wt.has(e.value)&&![`do`,`else`].includes(e.value):qt.has(e?.value)}function Yt(e){let t=e.at(-1);return t?.type===`word`&&(Gt.has(t.value)||t.value===`await`&&e.at(-2)?.value===`for`)}function Xt(e){return e?e.type===`word`?Wt.has(e.value)||Kt.has(e.value)||e.label===!0:e.value===`)`?e.control:e.value===`}`?!e.object:e.type===`punctuator`&&![`++`,`--`,`]`].includes(e.value):!0}var Zt=(e,t)=>e.startsWith(`\r
|
|
3
|
-
`,t+1)?3:2,Qt=/\\(?: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,$t={b:`\b`,f:`\f`,n:`
|
|
4
|
-
`,r:`\r`,t:` `,v:`\v`};function en(e){return e.includes(`\\`)?e.replace(Qt,(e,t,n,r,i,a,o)=>{if(a!==void 0)return``;if(i!==void 0)return String.fromCodePoint(Number.parseInt(i,8));let s=Number.parseInt(t??n??r,16);return Number.isNaN(s)?$t[o]??o:String.fromCodePoint(Math.min(s,1114111))}):e}function tn(e,t){let n=e[t],r=t+1;for(;r<e.length&&e[r]!==n&&!Ht.includes(e[r]);)r+=e[r]===`\\`?Zt(e,r):1;return[e[r]===n?en(e.slice(t+1,r)):null,r+1]}function nn(e,t){let n=t+1,r=!1;for(;n<e.length&&!Ht.includes(e[n])&&(r||e[n]!==`/`);)e[n]===`\\`?n++:e[n]===`[`?r=!0:e[n]===`]`&&(r=!1),n++;return J.lastIndex=n+1,J.test(e)?J.lastIndex:n+1}function rn(e,t,n){for(let r=t;r<e.length;r++)if(e[r]===`\\`)r++;else{if(e[r]==="`")return r+1;if(e[r]===`$`&&e[r+1]===`{`)return n.push(`template`),r+2}return e.length}function an(e){let t=[],n=[],r=[],i=0,a=0;for(;i<e.length;){let o=t.length;if(K.lastIndex=i,K.test(e)&&(i=K.lastIndex),i>=e.length)break;let s=e[i],c=e[i+1];if(J.lastIndex=i,s===`/`&&c===`/`)q.lastIndex=i+2,i=q.test(e)?q.lastIndex-1:e.length;else if(s===`/`&&c===`*`){let t=e.indexOf(`*/`,i+2);i=t<0?e.length:t+2}else if(s===`"`||s===`'`){let[n,r]=tn(e,i);t.push({type:`string`,value:n}),i=r}else if(s==="`"||s===`}`&&n.at(-1)===`template`){s===`}`&&n.pop();let r=n.length,a=rn(e,i+1,n),o=s==="`"&&n.length===r&&e[a-1]==="`";t.push({type:`string`,value:o?en(e.slice(i+1,a-1)):null}),n.length>r&&t.push({type:`punctuator`,value:"${"}),i=a}else if(s===`/`&&Xt(t.at(-1)))i=nn(e,i),t.push({type:`regex`});else if(J.test(e)){let n=Kt.has(t.at(-1)?.value)&&!Ut.test(e.slice(a,i));t.push({type:`word`,value:e.slice(i,J.lastIndex),...n&&{label:n}}),i=J.lastIndex}else{s===`{`&&n.push(Jt(t.at(-1),Ut.test(e.slice(a,i)))?`object`:`block`);let o=s===`}`?n.pop():void 0;s===`(`&&r.push(Yt(t));let l=(s===`+`||s===`-`)&&c===s||s===`=`&&c===`>`?s+c:s;t.push({type:`punctuator`,value:l,...s===`)`&&{control:r.pop()===!0},...s===`}`&&{object:o===`object`}}),i+=l.length}t.length>o&&(a=i)}return t}var on=e=>e?.type===`string`&&e.value!==null,sn=new Set([`type`,`typeof`]),cn=(e,t)=>e[t+1]?.type===`word`&&(e[t+1].value!==`as`||e[t+2]?.type!==`word`||e[t+2].value===`as`);function ln(e,t){let n=!1;for(let r=t+1;r<e.length&&e[r].value!==`}`;r++)if(!(r>t+1&&e[r-1].value!==`,`)){if(!sn.has(e[r].value)||!cn(e,r))return!1;n=!0}return n}function un(e,t){for(let n=t;n<e.length;n++){let{value:r}=e[n];if(r===`;`||n>t&&(r===`import`||r===`export`))return null;if(r===`from`&&on(e[n+1]))return e[n+1].value}return null}function dn(e,t){let[n,r,i]=[e[t].value,e[t+1],e[t+2]],a=n===`import`?`import`:`export-from`;if(n===`import`&&on(r))return{kind:a,specifier:r.value};if(sn.has(r?.value)&&![`,`,`from`].includes(i?.value)||r?.value===`{`&&ln(e,t+1)||n===`export`&&![`{`,`*`].includes(r?.value)||n===`import`&&r?.type!==`word`&&![`{`,`*`].includes(r?.value))return null;let o=un(e,t+1);return o===null?null:{kind:a,specifier:o}}function fn(e,t){let[n,r]=[e[t+2],e[t+3]];if(n?.value!==`)`)return on(n)&&[`)`,`,`].includes(r?.value)?n.value:null}function pn(e,t=new Set){let n=an(e),r=[];for(let[e,i]of n.entries()){if(i.type!==`word`||[`.`,`#`,`function`].includes(n[e-1]?.value)||n[e-1]?.value===`=`&&n[e-3]?.value===`type`&&n[e-4]?.value===`import`)continue;let a=n[e+1]?.value===`(`,o=a?fn(n,e):void 0;if((i.value===`require`||t.has(i.value))&&o!==void 0)r.push({kind:`require`,specifier:o,...i.value!==`require`&&{callee:i.value}});else if(i.value===`import`&&a)o!==void 0&&r.push({kind:`dynamic-import`,specifier:o});else if(i.value===`import`||i.value===`export`){let t=dn(n,e);t&&r.push(t)}}return r}var mn=/^[\w$]*__d\(/gmu,hn=([e,t,n,...r])=>(typeof e==`number`||typeof e==`string`)&&(t===void 0||typeof t==`object`)&&(n===void 0||typeof n==`string`)&&r.length===0;function gn(e){let t=/\);?\s*$/u.exec(e)?.index,n=null,r=t===void 0?-1:e.lastIndexOf(`},`,t);for(;r>=0&&/[\d"]/u.test(e[r+2]);){let i;try{i=JSON.parse(`[${e.slice(r+2,t)}]`)}catch{break}if(!hn(i))break;n=i,r=r>0?e.lastIndexOf(`},`,r-1):-1}return n}function _n(e){let t=/^[^(]*\(\s*(?:function\s*[\w$]*\s*)?\(([^)]*)\)/u.exec(e)?.[1].split(`,`).slice(1,4).map(e=>e.trim().replaceAll(`$`,`\\$`));if(!t?.length)return[];let n=e.matchAll(RegExp(`(?<=[^\\w$.#]|\\.\\.\\.)(?:${t.join(`|`)})\\((\\d+|"(?:[^"\\\\]|\\\\.)*")[,)]`,`gu`));return[...new Set([...n].map(e=>JSON.parse(e[1])))]}function vn(e,t){if(Array.isArray(e))return e;let n=Object.entries(e??{}).filter(([e])=>/^\d+$/u.test(e)).map(([,e])=>e);return n.length>0?n:_n(t)}function yn(e,t){let n=new Map(t.files.map((e,t)=>[e,t])),r=e.flatMap((e,t)=>e.file?[{k:t,at:n.get(e.file)}]:[]);for(let n=0;n<(r[0]?.k??0);n++)e[n].file=t.files[r[0].at-r[0].k+n]??null;for(let[n,{k:i,at:a}]of r.entries()){let o=r[n+1];if(!(o&&o.at-a!==o.k-i))for(let n=i+1;n<(o?.k??e.length);n++)e[n].file=t.files[a+n-i]??null}}function bn(e,t){let n=[...e.matchAll(mn)].map(e=>e.index);if(n.length===0)return null;let r=Rt(e),i=t=>e.slice(r[t],r[t+1]),a=[];for(let[o,s]of n.entries()){let[c]=G(r,s),[l]=G(r,(n[o+1]??e.length)-1),u=gn(i(l));for(;!u&&l>c;)u=gn(i(--l));if(!u)throw Error(`bundleEdges: the Metro module at line ${c+1} ends in no define params`);let d=r[l+1]??e.length;a.push({id:u[0],file:Vt(t,r,s,d),dependencies:vn(u[1],e.slice(s,d))})}yn(a,t);let o=new Map(a.map(e=>[e.id,e])),{edges:s,link:c}=Ct();for(let{file:e,dependencies:t}of a)for(let n of t)c(e,o.get(n)?.file,`dependency`);return s}var xn=e=>e.path!==null&&![`json`,null].includes(lt(e.path)),Sn=e=>e.path!==null&<(e.path)===null;function Cn(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 wn={jsxRuntime:`react/jsx-runtime`,jsxDevRuntime:`react/jsx-dev-runtime`};function Tn(e){let{sources:t,names:n,nameList:r}=jt(e),i=new Map,a=new Map,o=e.files.map(()=>new Set);for(let e=0;e<n.length;e++)n[e]<0||t[e]<0||(a.has(n[e])||a.set(n[e],Cn(r[n[e]]).length>0),a.get(n[e])&&o[t[e]].add(r[n[e]]));for(let[t,n]of o.entries()){if(n.size===0)continue;let r=e.files[t],a=new Set(Array.from((r.content??``).matchAll(/(?:function|var|let|const)\s+(_[A-Za-z]+\d*)\b/gu),e=>e[1])),o=[...n].filter(e=>!a.has(e)&&!a.has(e.replace(/\d+$/u,``))).flatMap(Cn);o.length>0&&i.set(r,o.map(e=>wn[e]??`@babel/runtime/helpers/${e}`))}return i}function En(e,t){let n=new Map;for(let[r,i]of e){let e=n.get(r)??n.set(r,new Map).get(r);for(let n of i)e.set(n,Et(t,r,n,()=>null))}let r=new Set([...n.values()].flatMap(e=>[...e.values()].map(e=>e.to))),i=(e,n)=>t.byRoot.get(n).find(e=>!r.has(e))??t.byRoot.get(n)[0];return(e,r)=>{let a=n.get(e)?.get(r);return a?.to?a:Et(t,e,r,i)}}var Dn=e=>/(?:^|\/)__prelude__$/u.test(e.source??``),On=e=>e?.package?.name===`metro-runtime`&&e.package.path===`src/polyfills/require.js`;function kn(e){if(!e.files.some(Dn)&&!On(e.files[0]))return null;if(!e.files.some(e=>e.content!==null&&!Dn(e)&&!On(e)))throw 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(Sn)+1],r=e.files.find(e=>e.package?.name===`metro-runtime`&&e.package.path===`src/modules/asyncRequire.js`),i=new Map(e.files.filter(e=>e.content!==null&&xn(e)).map(e=>[e,pn(e.content)])),a=Tn(e),o=En([...[...i].map(([e,t])=>[e,t.flatMap(({specifier:e})=>e===null?[]:[e])]),...a],t),{edges:s,add:c,link:l}=Ct();for(let t of e.files){Sn(t)&&l(t,n,`dependency`);for(let{kind:e,specifier:n}of i.get(t)??[]){let i=n===null?{to:null}:o(t,n);i.to!==t&&c(t,`${e}\0${JSON.stringify(n)}`,{from:t,kind:e,specifier:n,...i}),e===`dynamic-import`&&l(t,r,`dependency`)}for(let e of a.get(t)??[])l(t,o(t,e).to,`dependency`)}return s}var An=(e,t)=>t==null?kn(e):bn(t,e);function jn(e,t){let n=An(e,t);if(!n)throw Error(`bundleEdges: not a Metro ${t==null?`map`:`bundle`}; edges-lite.js reads only those, edges.js reads others`);return{edges:n}}function Mn(e){let t=JSON.parse(e.replace(/^\)\]\}'[^\n]*\n/u,``)),n=It(t),r=t.sections?t.sections.reduce((e,t)=>e+(t.map.names?.length??0),0):t.names?.length??null;return{json:{version:t.version,file:t.file,sourceRoot:t.sourceRoot},map:n,namesCount:r}}function Nn(e){if(e.map)return e.map.files.flatMap(e=>e.source===null?[]:[[e.source,e.content]]);let t=e.json?.sourcesContent??[];return(e.json?.sources??[]).map((e,n)=>[e,t[n]??null])}function Pn(e,t){let n=new Map;for(let{from:r,to:i,specifier:a}of t(e).edges){if(r.source===null||i?.source==null||i.source===r.source)continue;let e=typeof a==`string`?[r.source,i.source,a]:[r.source,i.source];n.set(e.join(`\0`),e)}return[...n.values()]}function Fn(e){try{return jn(e)}catch{return{edges:[]}}}var In=Object.freeze([]);function Ln(e){return e?.edges?e.edges:e?.map?(e.edges=Pn(e.map,Fn),e.edges):In}var Rn=new WeakMap,zn=new WeakMap;function Bn(e){let t=Ln(e);if(!Rn.has(t)){let e=new Map;for(let[n,r]of t)e.has(n)||e.set(n,new Set),e.get(n).add(r);Rn.set(t,e)}return Rn.get(t)}function Vn(e){let t=Ln(e);if(!zn.has(t)){let e=new Map;for(let[n,r,i]of t)i!==void 0&&(e.has(n)||e.set(n,new Map),e.get(n).set(i,r));zn.set(t,e)}return zn.get(t)}var Hn=new WeakMap,Un=new WeakMap,Wn=new WeakMap,Gn=new WeakMap,Kn=new WeakMap,Y=new WeakMap;function X(e){if(e?.metadataOnly)return new Map;let t=e?.bundle??e?.json;if(t&&Hn.has(t))return Hn.get(t);let n=new Map;if(!e)return n;if(e.kind===`stasis`){if(!e.bundle)return n;let t=e.bundle.formats;for(let[r,i]of e.bundle.sources)typeof i==`string`&&(M.isResourceFormat(t?.get(r))||n.set(r,i))}else if(e.kind===`sourcemap`)for(let[t,r]of Nn(e))typeof r==`string`&&n.set(t,r);return t&&Hn.set(t,n),n}function qn(e){let t=1;for(let n=e.indexOf(`
|
|
5
|
-
`);n!==-1;n=e.indexOf(`
|
|
6
|
-
`,n+1))t++;return t}var Jn=new WeakMap;function Yn(e){let t=Jn.get(e);if(!t){let n=[...e.keys()].toSorted();t={paths:n,numbers:new Map(n.map((e,t)=>[e,t+1]))},Jn.set(e,t)}return t}function Xn(e,t){let n=Array.isArray(t)?t:[];return{integrity:e.integrity,kind:`sourcemap`,size:e.size,json:{version:3,sources:n.map(([e])=>e),sourcesContent:n.map(([,,e])=>typeof e==`string`?e:null)},fileSizes:new Map(n.map(([e,t])=>[e,t])),npmBinaries:new Map(n.filter(([,,e,t])=>typeof e!=`string`&&typeof t==`string`).map(([e,t,,n])=>[e,{size:t,digest:n}]))}}function Zn(e){let t=e?.bundle??e?.json;if(t&&Un.has(t))return Un.get(t);let n=new Map(X(e));for(let[t,r]of e?.npmBinaries??[])n.set(t,{format:`digest`,...r});if(e?.kind===`stasis`&&e.bundle){let t=e.bundle.formats;for(let[r,i]of e.bundle.sources){if(typeof i!=`string`)continue;let e=t?.get(r);e===`resource`?n.set(r,i):e===`resource:base64`&&n.set(r,{format:`base64`,data:i})}}return t&&Un.set(t,n),n}var Qn=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;function $n(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 r=n.length%4;return r>1&&Qn.indexOf(n.at(-1))&(r===2?15:3)?null:Math.floor(n.length*3/4)}function er(e){return typeof e==`string`?t(e):e?.format===`digest`?e.size:e?.format===`base64`?$n(e.data):null}function Z(e){if(e?.fileSizes)return e.fileSizes;let t=e?.bundle??e?.json;if(t&&Wn.has(t))return Wn.get(t);let n=new Map,r=Zn(e),i=e?.kind===`stasis`?e.bundle?.sources.keys():e&&Nn(e).map(([e])=>e);for(let e of i??[])n.set(e,er(r.get(e)));return t&&Wn.set(t,n),n}function tr(e){if(e?.metadataOnly)return e.unsizedFiles??new Set;let t=Z(e);if(Y.has(t))return Y.get(t);let n=new Set;for(let r of Zn(e).keys())t.get(r)===null&&n.add(r);return Y.set(t,n),n}function nr(e){let t=Z(e);if(Kn.has(t))return Kn.get(t);let n=tr(e),r=e?.kind===`stasis`?e.bundle?.formats:null,i=new Map;for(let[a,o]of t)o===null&&!n.has(a)||i.set(a,M.isResourceFormat(r?.get(a))||e?.npmBinaries?.has(a)?`resource`:`source`);return Kn.set(t,i),i}function rr(e){let t=Z(e),n=e?.kind===`stasis`?e.bundle?.formats:null;if(!n||n.size===0)return t;if(Gn.has(t))return Gn.get(t);let r=new Map;for(let[e,i]of t)M.isResourceFormat(n.get(e))||r.set(e,i);return Gn.set(t,r),r}var ir=new WeakMap;function ar(e){if(e?.kind!==`stasis`||!e.bundle?.modules)return null;if(ir.has(e.bundle))return ir.get(e.bundle);let t=new Map;for(let[n,r]of e.bundle.modules)for(let e of Object.keys(r.files))t.set(n===`.`?e:`${n}/${e}`,n);return ir.set(e.bundle,t),t}function or(e,t=null,n=(e,t)=>t.name){let r=new Map;if(e?.kind!==`stasis`||!e.bundle?.modules)return r;let i=t===null?null:ar(e),a=t===null?null:new Set([...t].map(e=>i?.get(e)));for(let[t,i]of e.bundle.modules){if(a&&!a.has(t)||!t.includes(`node_modules`)||!i?.name||typeof i.version!=`string`||!i.version)continue;let e=n(t,i),o=r.get(e);o||(o=new Set,r.set(e,o)),o.add(i.version)}return r}var sr=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`}),cr=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 lr(e){let t=typeof e==`string`?e.slice(e.lastIndexOf(`/`)+1):``,n=t.lastIndexOf(`.`),r=n>0?t.slice(n+1).trim().toLowerCase():``,i=a(e)??cr[r];return i?{key:i,label:sr[i]??i}:r?{key:`extension:${r}`,label:`.${r}`}:{key:`other`,label:`Other`}}function ur(e,t){let n=new Map,r=0,i=0;for(let[a,o]of e){let e=lr(a),s=n.get(e.key)??{...e,files:0,lines:0,bytes:0};s.files++,s.lines+=o,s.bytes+=t.get(a)??0,n.set(e.key,s),i+=o,r+=t.get(a)??0}return{files:e.size,lines:i,bytes:r,languages:[...n.values()].toSorted((e,t)=>t.lines-e.lines||e.label.localeCompare(t.label))}}var dr=6,Q=new WeakMap,fr=new Set([`terminal`,`code`,`search`,`compare`]);function pr(e,t=null){return!!t||fr.has(e)}var mr=/^sha512-[A-Za-z0-9+/]{86}==$/u;function hr(t){if(t.fileHashes)return Promise.resolve(t.fileHashes);if(Q.has(t))return Q.get(t);let n=(async()=>{let n=[...X(t)],r=new Map;for(let t=0;t<n.length;t+=32){let i=await Promise.all(n.slice(t,t+32).map(async([t,n])=>[t,await e(n)]));for(let[e,t]of i)r.set(e,t)}return t.fileHashes=r,r})();return Q.set(t,n),n.catch(()=>Q.delete(t)),n}function gr(e){if(typeof e!=`string`)return 0;let t=/\S/gu,n=/[\r\n]/gu,r=0;for(;t.test(e)&&(r++,n.lastIndex=t.lastIndex,n.test(e));)t.lastIndex=n.lastIndex;return r}function _r(e){return e.lineCounts??=new Map([...X(e)].map(([e,t])=>[e,gr(t)]))}function $(e){return e instanceof Map?Object.fromEntries([...e].map(([e,t])=>[e,$(t)])):e}async function vr(e){let n=await hr(e),r=Z(e),i=_r(e),a={version:dr,integrity:e.integrity,kind:e.kind,size:e.size,codeStats:ur(i,r),files:[...r].map(([e,t])=>[e,t,n.get(e)??null,i.get(e)??null])},o=tr(e);if(o.size>0&&(a.unsized=[...o]),e.kind===`sourcemap`){let{version:n,file:r,sourceRoot:i,names:o}=e.json,s=Nn(e);a.json={version:n,file:r,sourceRoot:i,sources:s.map(([e])=>e)},a.sourceSizes=s.map(([,e])=>typeof e==`string`?t(e):null),a.namesCount=e.namesCount??o?.length??null;let c=new Map(a.files.map(([e],t)=>[e,t]));a.edges=Ln(e).map(([e,t,...n])=>[c.get(e),c.get(t),...n])}else{let t=e.bundle,n={version:t.version,config:t.config,repo:t.repo,package:t.package,formats:$(t.formats),imports:$(t.imports),reason:t.reason,executable:[...t.executable]};if(t.version===0)n.sources=Object.fromEntries([...r.keys()].map(e=>[e,null]));else{let e={},r={};for(let[n,i]of t.modules){let t=n.split(`/`).includes(`node_modules`)?e:r;Object.defineProperty(t,n,{enumerable:!0,value:{name:i.name,version:i.version,ecosystem:i.ecosystem,repo:i.repo,files:Object.fromEntries(Object.keys(i.files).map(e=>[e,null]))}})}n.modules=e,t.config.scope===`full`&&(n.sources=r,n.entries=[...t.entries])}a.bundle=n}return a}function yr(e,t){if(![1,2,3,4,5,dr].includes(e?.version)||e.integrity!==t||![`stasis`,`sourcemap`].includes(e.kind)||!Number.isSafeInteger(e.size)||e.size<0||!Array.isArray(e.files))throw Error(`Invalid bundle metadata`);let n=e.version!==dr,r=e.version===1,i=new Map,a=new Map,o=new Map;for(let t of e.files){if(!Array.isArray(t)||t.length!==4&&!(r&&t.length===3))throw Error(`Invalid bundle metadata file`);let[e,n,s,c]=t;if(typeof e!=`string`||a.has(e)||n!==null&&(!Number.isSafeInteger(n)||n<0)||s!==null&&(typeof s!=`string`||!mr.test(s))||n===null&&s!==null||r&&n!==null&&s===null||c!=null&&(!Number.isSafeInteger(c)||c<0))throw Error(`Invalid bundle metadata file`);a.set(e,n),s!==null&&i.set(e,s),c!=null&&o.set(e,c)}let s=new Set(e.unsized??[]);if(e.unsized!==void 0&&(r||!Array.isArray(e.unsized)||s.size!==e.unsized.length)||[...s].some(e=>typeof e!=`string`||!a.has(e)||a.get(e)!==null))throw Error(`Invalid bundle metadata`);let c={integrity:t,kind:e.kind,size:e.size,metadataOnly:!0,fileSizes:a,fileHashes:i,lineCounts:o,unsizedFiles:s,stale:n};if(e.kind===`stasis`){c.bundle=M.fromJSON(e.bundle);let t=c.bundle.sources;if(t.size!==a.size||[...t.keys()].some(e=>!a.has(e)))throw Error(`Invalid bundle metadata inventory`);let n=c.bundle.formats;if(!r&&[...a].some(([e,t])=>i.has(e)!==(t!==null&&!M.isResourceFormat(n.get(e))))||[...s].some(e=>n.get(e)!==`resource:base64`))throw 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 Error(`Invalid sourcemap metadata`);if(!Array.isArray(e.json.sources)||e.json.sources.some(e=>!a.has(e))||!Array.isArray(e.sourceSizes)||e.sourceSizes.length!==e.json.sources.length||e.sourceSizes.some(e=>e!==null&&(!Number.isSafeInteger(e)||e<0))||[...a].some(([e,t])=>i.has(e)!==(t!==null))||s.size>0)throw Error(`Invalid sourcemap inventory`);c.json=e.json,c.sourceSizes=e.sourceSizes,c.namesCount=e.namesCount,e.edges!==void 0&&(c.edges=br(e.edges,e.files))}if(e.codeStats===void 0)c.codeStats=ur(o,a);else{let t=e.codeStats,n=e=>Number.isSafeInteger(e)&&e>=0;if(!t||![t.files,t.lines,t.bytes].every(n)||!Array.isArray(t.languages)||t.languages.some(e=>!e||typeof e.key!=`string`||typeof e.label!=`string`||![e.files,e.lines,e.bytes].every(n)))throw Error(`Invalid bundle code stats`);c.codeStats=t}return c}function br(e,t){if(!Array.isArray(e))throw Error(`Invalid sourcemap edges`);return e.map(e=>{if(!Array.isArray(e)||![2,3].includes(e.length)||e[0]===e[1]||e.length===3&&typeof e[2]!=`string`||e.slice(0,2).some(e=>!Number.isSafeInteger(e)||e<0||e>=t.length))throw Error(`Invalid sourcemap edges`);return[t[e[0]][0],t[e[1]][0],...e.slice(2)]})}function xr(e,{integrity:t,kind:n,size:r}){if(n===`stasis`)return{integrity:t,kind:n,size:r,bundle:M.parse(e)};if(n!==`sourcemap`)throw Error(`Unsupported bundle format`);return{integrity:t,kind:n,size:r,...Mn(e)}}export{a,ur as b,Ue as c,M as d,Bn as e,Vn as f,X as g,qn as h,Yn as i,Xn as j,Zn as k,er as l,Z as m,nr as n,rr as o,ar as p,or as q,pr as r,hr as s,gr as t,_r as u,vr as v,yr as w,xr as x};
|