@preventive/triage 1.0.0-alpha.53 → 1.0.0-alpha.54

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 (109) hide show
  1. package/common/bundle-compare-diff.js +28 -9
  2. package/common/bundle-compare-inputs.d.ts +1 -0
  3. package/common/bundle-compare-inputs.js +91 -15
  4. package/common/bundle-comparison.js +14 -7
  5. package/common/default-scan-models.ts +3 -0
  6. package/common/dependency-reviews.d.ts +1 -1
  7. package/common/dependency-reviews.js +1 -1
  8. package/common/managed/finding-detail.d.ts +1 -1
  9. package/common/managed/finding-detail.js +7 -7
  10. package/common/managed/team-app.d.ts +7 -0
  11. package/common/managed/team-app.js +31 -7
  12. package/common/workspace-app.js +19 -7
  13. package/out/activity.js +4 -4
  14. package/out/chunk-4EMM6UCD.js +1 -0
  15. package/out/chunk-4ISO5F7Y.js +7 -0
  16. package/out/chunk-4XIH7YTX.js +1 -0
  17. package/out/chunk-6W5BMATD.js +1 -0
  18. package/out/{chunk-WFYLMF6Z.js → chunk-74AEKRES.js} +1 -1
  19. package/out/chunk-DEVAORP2.js +1 -0
  20. package/out/{chunk-KOGNQDSJ.js → chunk-DTM47KGS.js} +1 -1
  21. package/out/chunk-E3LFSUDJ.js +9 -0
  22. package/out/chunk-FHIVVVUA.js +6 -0
  23. package/out/chunk-G3LY2FV4.js +1 -0
  24. package/out/chunk-HAZKDK4M.js +4 -0
  25. package/out/chunk-HOB3YPS5.js +1 -0
  26. package/out/chunk-I47TYPXO.js +52 -0
  27. package/out/chunk-J7A5OSZE.js +244 -0
  28. package/out/chunk-JFL7WLRV.js +1 -0
  29. package/out/chunk-JMG5DXII.js +2 -0
  30. package/out/chunk-JOXLZXMI.js +1 -0
  31. package/out/chunk-L4CTEMRG.js +2 -0
  32. package/out/chunk-M37X4LCF.js +14 -0
  33. package/out/chunk-M3Y6SLC4.js +1 -0
  34. package/out/chunk-NXATZJQ2.js +1 -0
  35. package/out/{chunk-MYGJBYYJ.js → chunk-ORIP5INC.js} +1 -1
  36. package/out/chunk-PAD2JHZT.js +1 -0
  37. package/out/chunk-QMVOEBWC.js +13 -0
  38. package/out/{chunk-SXV2T5C4.js → chunk-QRKFPLA4.js} +1 -1
  39. package/out/chunk-RRBIJL2B.js +1 -0
  40. package/out/{chunk-GDPCLSOS.js → chunk-SYXT3SFP.js} +1 -1
  41. package/out/chunk-TOXMUOIW.js +5 -0
  42. package/out/chunk-UBOCLLF2.js +1 -0
  43. package/out/chunk-UCP3JRE2.js +1 -0
  44. package/out/{chunk-JEFZTVNX.js → chunk-VC72ZO3P.js} +1 -1
  45. package/out/chunk-VRX2APNA.js +9 -0
  46. package/out/{chunk-NE2UGKRJ.js → chunk-VZMELPVL.js} +4 -3
  47. package/out/{chunk-YA4ETCFU.js → chunk-WHVXTJHK.js} +1 -1
  48. package/out/chunk-WMFDQS2L.js +11 -0
  49. package/out/chunk-WNSVBOSO.js +41 -0
  50. package/out/chunk-WREU7JAG.js +1 -0
  51. package/out/chunk-Y5ZHFNBD.js +2 -0
  52. package/out/chunk-YF4M5OCI.js +1 -0
  53. package/out/chunk-Z667U2UJ.js +1 -0
  54. package/out/chunk-ZQHLECTI.js +1 -0
  55. package/out/client-managed-import.js +1 -1
  56. package/out/client-managed.js +27 -26
  57. package/out/compare.js +14 -14
  58. package/out/dialogs.js +36 -51
  59. package/out/graph.js +17 -15
  60. package/out/index.html +26 -10
  61. package/out/prism.js +1 -1
  62. package/out/scan.js +2 -2
  63. package/out/terminal.js +232 -232
  64. package/out/view.css +1 -1
  65. package/out/view.js +15 -15
  66. package/package.json +11 -7
  67. package/risk/actions/resolve.js +36 -5
  68. package/risk/index.d.ts +20 -2
  69. package/risk/npm/malware.js +6 -4
  70. package/risk/npm/registry.js +8 -6
  71. package/server-managed/bundle-advisories.ts +56 -74
  72. package/server-managed/bundle-build-worker.js +61 -4
  73. package/server-managed/bundle-build.ts +13 -4
  74. package/server-managed/bundle-dependency-reviews.ts +74 -0
  75. package/server-managed/bundle-validation.ts +32 -0
  76. package/server-managed/db-methods.ts +51 -16
  77. package/server-managed/db-neon.ts +18 -2
  78. package/server-managed/db.ts +11 -2
  79. package/server-managed/github-issue-links.ts +151 -47
  80. package/server-managed/github-pulls.ts +34 -15
  81. package/server-managed/http.ts +227 -12
  82. package/server-managed/index.ts +13 -1
  83. package/server-managed/managed-issues.ts +29 -15
  84. package/server-managed/npm-insights.ts +4 -3
  85. package/server-managed/npm-kept.ts +4 -0
  86. package/server-managed/package-entry-points.ts +37 -9
  87. package/server-managed/pretty-print.ts +7 -5
  88. package/server-managed/public-workspace.ts +2 -2
  89. package/server-managed/repository-actions.ts +7 -4
  90. package/server-managed/repository-browser.ts +11 -4
  91. package/server-managed/repository-risk-audit.ts +4 -5
  92. package/server-managed/repository-risk.ts +4 -4
  93. package/server-managed/sql.ts +2 -1
  94. package/server-managed/stasis-config.ts +46 -0
  95. package/server-managed/team-app-summaries.ts +54 -0
  96. package/server-managed/team-app.ts +52 -31
  97. package/server-managed/team-reports.ts +27 -7
  98. package/server-managed/upstream-cache.ts +41 -32
  99. package/server-managed/workspace-shares.ts +3 -1
  100. package/out/chunk-2ZDZWLFY.js +0 -1
  101. package/out/chunk-7VAWINQF.js +0 -6
  102. package/out/chunk-FMXWXDR4.js +0 -36
  103. package/out/chunk-IZ7POWI3.js +0 -18
  104. package/out/chunk-LJ7XRXFU.js +0 -52
  105. package/out/chunk-QB4CBOX2.js +0 -1
  106. package/out/chunk-TQJDYHVE.js +0 -2
  107. package/out/chunk-TSIFIFBX.js +0 -232
  108. package/out/chunk-VH4XMZIW.js +0 -2
  109. package/out/chunk-WYLQWYLA.js +0 -1
@@ -9,11 +9,13 @@ import type { ManagedSql } from './sql.ts'
9
9
 
10
10
  // Records @preventive/upstream would otherwise keep in its disk cache, shared
11
11
  // by every instance: each repository's published advisory listing, written by
12
- // dependency audits that ask repositories, keyed `github/advisories/owner/name`.
13
- // Upstream stamps, validates and expires each value (90 minutes for a listing);
14
- // a refresh replaces the row, and there is one row per repository, so rows are
15
- // not evicted. Only public repositories publish advisories: rows are shared
16
- // across viewers.
12
+ // dependency audits that ask repositories, keyed `github/advisories/owner/name`,
13
+ // and each npm package npm's registry serves anyone, written by audits that ask
14
+ // OSV, keyed `npm/public/name`. Upstream stamps, validates and expires each
15
+ // value (90 minutes for a listing, a month for a public name); a refresh
16
+ // replaces the row, and there is one row per repository or name, so rows are
17
+ // not evicted. Only public repositories publish advisories, and only names
18
+ // anyone may read are kept: rows are shared across viewers.
17
19
  export const UPSTREAM_CACHE_SCHEMA = `
18
20
  CREATE TABLE IF NOT EXISTS managed_upstream_cache (
19
21
  cache_key TEXT PRIMARY KEY,
@@ -88,35 +90,42 @@ export function upstreamCacheMethods(db: ManagedSql): UpstreamCacheStore {
88
90
  }
89
91
 
90
92
  // An audit's `cache`: where the server has an upstream disk cache (off Vercel,
91
- // set at startup), that keeps everything; else this store keeps listings.
92
- export function auditCache(cacheDir: string | null | undefined, db: UpstreamCacheStore, signal: AbortSignal, debug = false, repos: Iterable<string> = []): CacheStore | undefined {
93
- return cacheDir ? undefined : upstreamCache(db, signal, debug, repos)
93
+ // set at startup), that keeps everything; else this store keeps listings and
94
+ // public names, those of `keys` (auditedKeys) read at once.
95
+ export function auditCache(cacheDir: string | null | undefined, db: UpstreamCacheStore, signal: AbortSignal, debug = false, keys: Iterable<string> = []): CacheStore | undefined {
96
+ return cacheDir ? undefined : upstreamCache(db, signal, debug, keys)
94
97
  }
95
98
 
96
- // The repositories whose listings an audit of `packages` asks for, where they
97
- // are already known: each `github` package, each `soldeer` package's given
98
- // repository, and with `repoAdvisories`, every other package's. Upstream looks
99
- // up the rest itself.
100
- export function auditedRepos(packages: Iterable<Package>, repoAdvisories: boolean): string[] {
101
- const repos = [...packages].map(pkg => (pkg.ecosystem === 'github' ? pkg.name
102
- : pkg.ecosystem === 'soldeer' || repoAdvisories ? pkg.github : undefined))
103
- return [...new Set(repos.filter(repo => repo !== undefined))]
104
- }
99
+ // Only listings and public names are kept: upstream's other records (npm
100
+ // version documents, registries' repository lookups) read as misses and are
101
+ // not written.
102
+ const LISTINGS = 'github/advisories'
103
+ const PUBLIC_NAMES = 'npm/public'
104
+ const CACHED_TYPES = new Set([LISTINGS, PUBLIC_NAMES])
105
105
 
106
- // Only listings are kept: upstream's other records (npm version documents,
107
- // registries' repository lookups) read as misses and are not written.
108
- const CACHED_TYPE = 'github/advisories'
106
+ // What an audit of `packages` reads first, where it is already known: the
107
+ // listings of the repositories it knows, each `github` package, each `soldeer`
108
+ // package's given repository, and with `repoAdvisories`, every other
109
+ // package's, upstream looking up the rest itself; and whether each npm package
110
+ // is public, as upstream asks before it asks OSV of it. Each as upstream asks
111
+ // for it, a listing by its repository's lowercased name.
112
+ export function auditedKeys(packages: Iterable<Package>, repoAdvisories: boolean): string[] {
113
+ return [...new Set([...packages].flatMap(pkg => {
114
+ const repo = pkg.ecosystem === 'github' ? pkg.name : pkg.ecosystem === 'soldeer' || repoAdvisories ? pkg.github : undefined
115
+ return [...pkg.ecosystem === 'npm' ? [`${PUBLIC_NAMES}/${pkg.name}`] : [], ...repo === undefined ? [] : [`${LISTINGS}/${repo.toLowerCase()}`]]
116
+ }))]
117
+ }
109
118
 
110
119
  // The cache is an optimization: a database failure is a miss, never a failed
111
120
  // audit. Upstream keeps listing after an abandoned audit; once `signal` aborts,
112
121
  // the request's database work is over and the store is left alone.
113
- // Upstream reads one listing at a time per repository, and a request's queries
114
- // share one connection (Neon), so a recheck of hundreds of packages would wait
115
- // on as many round trips: the first read asks for every listing of `repos`
116
- // at once. Any other key, or all of them if that read fails, is read alone.
117
- export function upstreamCache(db: UpstreamCacheStore, signal: AbortSignal, debug = false, repos: Iterable<string> = []): CacheStore {
118
- // Upstream asks for a listing by its repository's lowercased name.
119
- const batched = new Set([...repos].map(repo => `${CACHED_TYPE}/${repo.toLowerCase()}`))
122
+ // Upstream reads one listing at a time per repository, and whether a name is
123
+ // public eight at a time, and a request's queries share one connection (Neon),
124
+ // so a recheck of hundreds of packages would wait on as many round trips: the
125
+ // first read asks for every one of `keys` at once. Any other key, or all of
126
+ // them if that read fails, is read alone.
127
+ export function upstreamCache(db: UpstreamCacheStore, signal: AbortSignal, debug = false, keys: Iterable<string> = []): CacheStore {
128
+ const batched = new Set(keys)
120
129
  let batch: Promise<Map<string, string> | null> | undefined
121
130
  const readBatch = () => batch ??= db.getUpstreamCacheEntries([...batched]).catch((error: unknown) => {
122
131
  if (debug) console.warn('managed: upstream cache read failed:', error)
@@ -124,7 +133,7 @@ export function upstreamCache(db: UpstreamCacheStore, signal: AbortSignal, debug
124
133
  })
125
134
  return {
126
135
  async read(type, key) {
127
- if (type !== CACHED_TYPE || signal.aborted) return null
136
+ if (!CACHED_TYPES.has(type) || signal.aborted) return null
128
137
  const cacheKey = `${type}/${key}`
129
138
  try {
130
139
  const found = batched.has(cacheKey) ? await readBatch() : null
@@ -136,7 +145,7 @@ export function upstreamCache(db: UpstreamCacheStore, signal: AbortSignal, debug
136
145
  }
137
146
  },
138
147
  async write(type, key, value) {
139
- if (type !== CACHED_TYPE || signal.aborted) return
148
+ if (!CACHED_TYPES.has(type) || signal.aborted) return
140
149
  try { await db.setUpstreamCacheEntry(`${type}/${key}`, JSON.stringify(value), Date.now()) } catch (error) {
141
150
  if (debug) console.warn('managed: upstream cache write failed:', error)
142
151
  }
@@ -224,10 +233,10 @@ export async function lastListing(cacheDir: string | null | undefined, db: Upstr
224
233
  let kept: { at?: unknown } | null
225
234
  try {
226
235
  if (cacheDir) {
227
- const bytes = await readKeptFile(upstreamCachePath(cacheDir, CACHED_TYPE, `${key}.json.gz`), LISTING_BYTES)
236
+ const bytes = await readKeptFile(upstreamCachePath(cacheDir, LISTINGS, `${key}.json.gz`), LISTING_BYTES)
228
237
  kept = bytes && JSON.parse((await gunzipAsync(bytes, { maxOutputLength: LISTING_BYTES })).toString('utf8'))
229
238
  } else {
230
- const value = await db.getUpstreamCacheEntry(`${CACHED_TYPE}/${key}`)
239
+ const value = await db.getUpstreamCacheEntry(`${LISTINGS}/${key}`)
231
240
  kept = value === null ? null : JSON.parse(value)
232
241
  }
233
242
  } catch (error) {
@@ -237,7 +246,7 @@ export async function lastListing(cacheDir: string | null | undefined, db: Upstr
237
246
  const at = kept?.at
238
247
  if (typeof at !== 'number') return null
239
248
  return { at, cache: {
240
- read: (type, name) => Promise.resolve(type === CACHED_TYPE && name === key ? { ...kept, at: Date.now() } : null),
249
+ read: (type, name) => Promise.resolve(type === LISTINGS && name === key ? { ...kept, at: Date.now() } : null),
241
250
  write: () => Promise.resolve(),
242
251
  } }
243
252
  }
@@ -146,6 +146,7 @@ export function workspaceShareMethods(db: ManagedSql): WorkspaceShareStore {
146
146
  const bundleRows = (await q.bundles.all(team.id) as (Omit<ManagedBundle, 'buildConditions'> & { buildConditions: string | null; repoFullName: string })[])
147
147
  .map(row => ({ ...row, buildConditions: row.buildConditions == null ? null : JSON.parse(row.buildConditions) as BundleBuildConditions }))
148
148
  const repositories = await q.repositories.all(team.id) as WorkspaceShareSnapshot['repositories']
149
+ const keyOf = (row: typeof rows[number]) => JSON.stringify([row.sha256, row.github, row.directory, row.filename, permissions, links])
149
150
  return {
150
151
  user: { id: `share:${tokenHash}`, login: 'public', name: 'Public workspace', avatarUrl: null, role: 'view' },
151
152
  teamId: team.id,
@@ -154,11 +155,12 @@ export function workspaceShareMethods(db: ManagedSql): WorkspaceShareStore {
154
155
  repositories,
155
156
  reports: rows.map(row => ({ id: row.id, filename: row.filename, byteSize: row.byteSize, sha256: row.sha256,
156
157
  repo: { github: row.github, directory: row.directory }, permissions })),
158
+ catalogKeys: Object.fromEntries(rows.map(row => [row.id, keyOf(row)])),
157
159
  team: { ...team, permissions, cacheKey: links,
158
160
  repos: repositories.map(repo => ({ repoId: repo.repoId, fullName: repo.github, path: repo.path || null }))
159
161
  .toSorted((a, b) => a.fullName.localeCompare(b.fullName) || (a.path ?? '').localeCompare(b.path ?? '')),
160
162
  reports: rows.map(row => ({ id: row.id, slug: row.slug, filename: row.filename, visible: true, analyzer: row.analyzer, repoFullName: row.github, repoDirectory: row.directory,
161
- cacheKey: JSON.stringify([row.sha256, row.github, row.directory, row.filename, permissions, links]) })),
163
+ cacheKey: keyOf(row) })),
162
164
  bundles: bundleRows.map(row => ({ id: row.id, slug: row.slug, integrity: row.integrity,
163
165
  filename: row.filename, visible: true, kind: row.kind, byteSize: row.byteSize, repoId: row.repoId!, repoDirectory: row.repoDirectory, repoFullName: row.repoFullName, provenance: row.provenance })),
164
166
  },
@@ -1 +0,0 @@
1
- import{b as e,c as t,d as n,e as r,f as i,g as a,h as o,i as s,j as c,k as l,m as u,n as d}from"./chunk-PXK7EU4V.js";import{b as f}from"./chunk-OOJM4CTU.js";var p=globalThis.atob,m=Uint8Array.prototype.toBase64,h=8192,g=m&&p;function _(e,t=0,n=e.length){t|=0,n|=0;let r=n-t;if(r===0)return``;if(g&&r>=256&&r<1e8&&e.toBase64===m&&e.BYTES_PER_ELEMENT===1)return p((t===0&&n===e.length?e:e.subarray(t,n)).toBase64());if(r>h){let r=``;for(let i=t;i<n;){let t=Math.min(n,i+h);r+=String.fromCharCode.apply(String,e.subarray(i,t)),i=t}return r}let i=t===0&&n===e.length?e:e.subarray(t,n);return String.fromCharCode.apply(String,i)}var v=t?e=>e.byteLength>=768&&!r?t.from(e.buffer,e.byteOffset,e.byteLength).latin1Slice(0,e.byteLength):a.decode(e):o?e=>o.decode(e):e=>_(e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),ee=t=>e(t,new Uint8Array(t.length)),y=n&&i?.encodeInto?(e,t)=>{let n=new Uint8Array(e.length+4),r=i.encodeInto(e,n);if(r.read!==e.length||r.written!==e.length)throw SyntaxError(t);return n.subarray(0,e.length)}:t?(e,n)=>{let r=t.from(e,`utf8`);if(r.length!==e.length)throw SyntaxError(n);return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}:(e,t)=>{let n=i.encode(e);if(n.length!==e.length)throw SyntaxError(t);return n},b,x,S,C=12336,te=26214,ne=`0123456789ABCDEFabcdef`,w=`Input is not a hex string`;function re(e){b||=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));let t=e.length;if(a){if(!x){x=new Uint16Array(256);let e=new Uint8Array(x.buffer,x.byteOffset,x.byteLength);for(let t=0;t<256;t++){let n=b[t];e[2*t]=n.charCodeAt(0),e[2*t+1]=n.charCodeAt(1)}}let n=new Uint16Array(t),r=0;for(let t=e.length-3;!(r>=t);r+=4){let t=e[r],i=e[r+1],a=e[r+2],o=e[r+3];n[r]=x[t],n[r+1]=x[i],n[r+2]=x[a],n[r+3]=x[o]}for(;r<t;r++)n[r]=x[e[r]];return v(n)}return s(e,0,t,b)}function ie(e){if(typeof e!=`string`)throw TypeError(l);if(e.length%2!=0)throw SyntaxError(w);let t=e.length/2,n=new Uint8Array(t);if(i){if(!S){S=new Uint8Array(te+1);let e=new Uint8Array(2),t=new Uint16Array(e.buffer,e.byteOffset,1),n=[...ne].map(e=>[e.charCodeAt(0),parseInt(e,16)]);for(let[r,i]of n){e[0]=r;for(let[r,a]of n)e[1]=r,S[t[0]]=i<<4|a}}let r=y(e,w),i=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),a=0;for(let e=t-3;a<e;a+=4){let e=i[a],t=i[a+1],r=i[a+2],o=i[a+3],s=S[e],c=S[t],l=S[r],u=S[o];if(!s&&e!==C||!c&&t!==C||!l&&r!==C||!u&&o!==C)throw SyntaxError(w);n[a]=s,n[a+1]=c,n[a+2]=l,n[a+3]=u}for(;a<t;){let e=i[a],t=S[e];if(!t&&e!==C)throw SyntaxError(w);n[a++]=t}}else{if(!S){S=new Int8Array(128).fill(-1);for(let e=0;e<16;e++){let t=e.toString(16);S[t.charCodeAt(0)]=S[t.toUpperCase().charCodeAt(0)]=e}}let r=0;for(let i=0;i<t;i++){let t=e.charCodeAt(r++),a=e.charCodeAt(r++),o=S[t]<<4|S[a];if(o<0||(127|t|a)!=127)throw SyntaxError(w);n[i]=o}}return n}var{toHex:T}=Uint8Array.prototype;function ae(e){return c(e),e.length===0?``:T&&e.toHex===T?e.toHex():re(e)}var oe=Uint8Array.fromHex?(e,t=`uint8`)=>u(Uint8Array.fromHex(e),t):(e,t=`uint8`)=>u(ie(e),t);function E(e){if(Object.keys(e).length>0)throw TypeError(`Unexpected extra options`)}Object.getPrototypeOf(Uint8Array);var D={};f(D,{E_CHAR:()=>M,E_LAST:()=>F,E_LENGTH:()=>P,E_PADDING:()=>N,fromBase64:()=>L,toBase64:()=>I});var O=[...`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`],k=[...`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`],A={},j={},M=`Invalid character in base64 input`,N=`Invalid base64 padding`,P=`Invalid base64 length`,F=`Invalid last chunk`;function I(e,t,n){let r=e.length/3|0,i=r*3,o=``,s=0,c=t?k:O,l=t?j:A;if(!l.pairs){if(l.pairs=[],a){l.codepairs=new Uint16Array(4096);let e=l.codepairs,t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e<64;e++){let n=c[e].charCodeAt(0);for(let r=0;r<64;r++)t[e<<7|r<<1]=t[r<<7|(e<<1)+1]=n}}else{let e=l.pairs;for(let t=0;t<64;t++)for(let n=0;n<64;n++)e.push(`${c[t]}${c[n]}`)}}let{pairs:u,codepairs:d}=l;if(a){let t=new Uint16Array(r*2),n=0;for(let r=e.length-11;s<r;s+=12,n+=8){let r=e[s],i=e[s+1],a=e[s+2],o=e[s+3],c=e[s+4],l=e[s+5],u=e[s+6],f=e[s+7],p=e[s+8],m=e[s+9],h=e[s+10],g=e[s+11];t[n]=d[r<<4|i>>4],t[n+1]=d[(i&15)<<8|a],t[n+2]=d[o<<4|c>>4],t[n+3]=d[(c&15)<<8|l],t[n+4]=d[u<<4|f>>4],t[n+5]=d[(f&15)<<8|p],t[n+6]=d[m<<4|h>>4],t[n+7]=d[(h&15)<<8|g]}for(let r=e.length-2;s<r;s+=3,n+=2){let r=e[s],i=e[s+1],a=e[s+2];t[n]=d[r<<4|i>>4],t[n+1]=d[(i&15)<<8|a]}o=v(t)}else for(;s<i;s+=3){let t=e[s],n=e[s+1],r=e[s+2];o+=u[t<<4|n>>4],o+=u[(n&15)<<8|r]}let f=0,p=2,m=e.length;for(;s<m;s++){let t=e[s];o+=c[f|t>>p],p===6&&(p=0,o+=c[t&63]),f=t<<6-p&63,p+=2}return p!==2&&(o+=c[f]),n&&(o+=[``,`==`,`=`][m-i]),o}var se=i?128:65536;function L(e,t){let n=e.length;for(;e[n-1]===`=`;)n--;let r=e.length-n,a=n%4,o=n-a;if(a===1)throw SyntaxError(P);if(r>3||r!==0&&e.length%4!=0)throw SyntaxError(N);let s=t?k:O,c=t?j:A;c.fromMap||(c.fromMap=new Int8Array(se).fill(-1),s.forEach((e,t)=>c.fromMap[e.charCodeAt(0)]=t));let l=c.fromMap,u=new Uint8Array(Math.floor(n*3/4)),d=0,f=0;if(i){let t=y(e,M);for(;f<o;f+=4){let e=t[f],n=t[f+1],r=t[f+2],i=t[f+3],a=l[e]<<18|l[n]<<12|l[r]<<6|l[i];if(a<0)throw SyntaxError(M);u[d]=a>>16,u[d+1]=a>>8&255,u[d+2]=a&255,d+=3}}else for(;f<o;f+=4){let t=e.charCodeAt(f),n=e.charCodeAt(f+1),r=e.charCodeAt(f+2),i=e.charCodeAt(f+3),a=l[t]<<18|l[n]<<12|l[r]<<6|l[i];if(a<0)throw SyntaxError(M);u[d]=a>>16,u[d+1]=a>>8&255,u[d+2]=a&255,d+=3}if(a<2)return u;let p=l[e.charCodeAt(f++)]<<6|l[e.charCodeAt(f++)];if(p<0)throw SyntaxError(M);if(u[d++]=p>>4,a<3){if(p&15)throw SyntaxError(F);return u}let m=l[e.charCodeAt(f++)];if(m<0)throw SyntaxError(M);if(u[d++]=p<<4&255|m>>2,m&3)throw SyntaxError(F);return u}var{Buffer:R,atob:z,btoa:B}=globalThis,V=R&&!R.TYPED_ARRAY_SUPPORT,{toBase64:H}=Uint8Array.prototype,{E_CHAR:U,E_PADDING:W,E_LENGTH:ce,E_LAST:le}=D,ue=B&&n,de=z&&n,fe=e=>e.constructor===R&&R.isBuffer(e),pe=e=>fe(e)?e:R.from(e.buffer,e.byteOffset,e.byteLength);function G(e,t){if(t)return e;let n=e.indexOf(`=`,e.length-3);return n===-1?e:e.slice(0,n)}function K(e,t){return t&&e.length%4!=0?e+`=`.repeat(4-e.length%4):e}var me=e=>H&&e.toBase64===H;function q(e,{padding:t=!0}={}){return c(e),me(e)?t?e.toBase64():e.toBase64({omitPadding:!t}):V?G(pe(e).base64Slice(0,e.byteLength),t):ue?G(B(_(e)),t):I(e,!1,t)}function he(e,t){if(typeof t==`string`&&(t={format:t}),!t)return J(e,!1,`both`,`uint8`,null);let{format:n=`uint8`,padding:r=`both`,...i}=t;return J(e,!1,r,n,i)}function J(e,t,n,r,i){if(typeof e!=`string`)throw TypeError(l);i!==null&&E(i);let a=n===`both`?e.endsWith(`=`):void 0;if(n===!0||a===!0){if(e.length%4!=0||e[e.length-3]===`=`)throw SyntaxError(W)}else if(n===!1||a===!1){if(e.length%4==1)throw SyntaxError(ce);if(n===!1&&e.endsWith(`=`))throw SyntaxError(`Did not expect padding in base64 input`)}else throw TypeError(`Invalid padding option`);return _e(e,t,n,r)}var ge=/[\t\n\f\r ]/;function Y(e,t){let n=e.indexOf(`=`,e.length-3),r=n>=0?e.length-n:0,i=e.length-r,a=i%4,o=t.length-(i-a)/4*3;return a===0&&o===0||a===2&&o===1||a===3&&o===2}var _e=Uint8Array.fromBase64?(e,t,n,r)=>{let i=t?`base64url`:`base64`,a;if(n===!0)a=Uint8Array.fromBase64(e,{alphabet:i,lastChunkHandling:`strict`});else try{let t=e.length%4>0?`${e}${`=`.repeat(4-e.length%4)}`:e;a=Uint8Array.fromBase64(t,{alphabet:i,lastChunkHandling:`strict`})}catch(t){throw ge.test(e)?SyntaxError(U):t}if(!Y(e,a))throw SyntaxError(U);return u(a,r)}:V?(e,t,n,r)=>{let i=R.byteLength(e,`base64`),a=R.allocUnsafeSlow(i);if(a.base64Write(e)!==i)throw SyntaxError(W);let o=t?a.base64urlSlice(0,a.length):a.base64Slice(0,a.length);if(e!==o&&(n===!t||K(e,!0)!==K(o,t)))throw SyntaxError(W);return d(a,r)}:de?(e,t,n,r)=>{let i;if(t){if(/[\t\n\f\r +/]/.test(e))throw SyntaxError(U);e=e.replaceAll(`-`,`+`).replaceAll(`_`,`/`)}try{i=ee(z(e))}catch{throw SyntaxError(U)}if(!t&&!Y(e,i))throw SyntaxError(U);if(i.length%3!=0&&q(i.subarray(-(i.length%3)))!==(e.length%4==0?e.slice(-4):e.slice(-(e.length%4)).padEnd(4,`=`)))throw SyntaxError(le);return u(i,r)}:(e,t,n,r)=>u(L(e,t),r),X=[{},{},{}],Z=[[...`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`],[...`0123456789ABCDEFGHIJKLMNOPQRSTUV`],[...`0123456789ABCDEFGHJKMNPQRSTVWXYZ`]],Q=`Invalid character in base32 input`,ve=`Invalid base32 padding`,ye=`Invalid base32 length`,$=`Invalid last chunk`,be=n;function xe(e,t,n){c(e);let r=Math.floor(e.length/5),i=r*5,o=``,s=0,l=Z[t],u=X[t];if(!u.pairs){if(u.pairs=[],a){u.codepairs=new Uint16Array(1024);let e=u.codepairs,t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e<32;e++){let n=l[e].charCodeAt(0);for(let r=0;r<32;r++)t[e<<6|r<<1]=t[r<<6|(e<<1)+1]=n}}else{let e=u.pairs;for(let t=0;t<32;t++)for(let n=0;n<32;n++)e.push(`${l[t]}${l[n]}`)}}let{pairs:d,codepairs:f}=u;if(a){let t=new Uint16Array(r*4);for(let n=0;s<i;s+=5){let r=e[s],i=e[s+1],a=e[s+2],o=e[s+3],c=e[s+4],l=r<<2|i>>6,u=(i&63)<<4|a>>4,d=(a&15)<<6|o>>2,p=(o&3)<<8|c;t[n]=f[l],t[n+1]=f[u],t[n+2]=f[d],t[n+3]=f[p],n+=4}o=v(t)}else if(be)for(;s<i;s+=5){let t=e[s],n=e[s+1],r=e[s+2],i=e[s+3],a=e[s+4],c=t<<2|n>>6,l=(n&63)<<4|r>>4,u=(r&15)<<6|i>>2,f=(i&3)<<8|a;o+=`${d[c]}${d[l]}${d[u]}${d[f]}`}else for(;s<i;s+=5){let t=e[s],n=e[s+1],r=e[s+2],i=e[s+3],a=e[s+4],c=t<<2|n>>6,l=(n&63)<<4|r>>4,u=(r&15)<<6|i>>2,f=(i&3)<<8|a;o+=d[c],o+=d[l],o+=d[u],o+=d[f]}let p=0,m=3;for(;s<e.length;s++){let t=e[s];o+=l[p|t>>m],m>=5&&(m-=5,o+=l[t>>m&31]),p=t<<5-m&31,m+=3}return m!==3&&(o+=l[p]),n&&(o+=[``,`======`,`====`,`===`,`=`][e.length-i]),o}var Se=i?128:65536;function Ce(e,t){let n=e.length;for(;e[n-1]===`=`;)n--;let r=e.length-n,a=n%8,o=n-a;if(![0,2,4,5,7].includes(a))throw SyntaxError(ye);if(r>7||r!==0&&e.length%8!=0)throw SyntaxError(ve);let s=Z[t],c=X[t];if(!c.fromMap){c.fromMap=new Int8Array(Se).fill(-1);let e=c.fromMap;s.forEach((t,n)=>{e[t.charCodeAt(0)]=e[t.toLowerCase().charCodeAt(0)]=n}),t===2&&(e[73]=e[76]=e[105]=e[108]=e[49],e[79]=e[111]=e[48])}let l=c.fromMap,u=new Uint8Array(Math.floor(n*5/8)),d=0,f=0;if(i){let t=y(e,Q);for(;f<o;f+=8){let e=t[f],n=t[f+1],r=t[f+2],i=t[f+3],a=t[f+4],o=t[f+5],s=t[f+6],c=t[f+7],p=l[e]<<15|l[n]<<10|l[r]<<5|l[i],m=l[a]<<15|l[o]<<10|l[s]<<5|l[c];if(p<0||m<0)throw SyntaxError(Q);u[d]=p>>12,u[d+1]=p>>4&255,u[d+2]=p<<4&255|m>>16,u[d+3]=m>>8&255,u[d+4]=m&255,d+=5}}else for(;f<o;f+=8){let t=e.charCodeAt(f),n=e.charCodeAt(f+1),r=e.charCodeAt(f+2),i=e.charCodeAt(f+3),a=e.charCodeAt(f+4),o=e.charCodeAt(f+5),s=e.charCodeAt(f+6),c=e.charCodeAt(f+7),p=l[t]<<15|l[n]<<10|l[r]<<5|l[i],m=l[a]<<15|l[o]<<10|l[s]<<5|l[c];if(p<0||m<0)throw SyntaxError(Q);u[d]=p>>12,u[d+1]=p>>4&255,u[d+2]=p<<4&255|m>>16,u[d+3]=m>>8&255,u[d+4]=m&255,d+=5}if(a<2)return u;let p=l[e.charCodeAt(f++)]<<5|l[e.charCodeAt(f++)];if(p<0)throw SyntaxError(Q);if(u[d++]=p>>2,a<4){if(p&3)throw SyntaxError($);return u}let m=l[e.charCodeAt(f++)]<<5|l[e.charCodeAt(f++)];if(m<0)throw SyntaxError(Q);if(u[d++]=p<<6&255|m>>4,a<5){if(m&15)throw SyntaxError($);return u}let h=l[e.charCodeAt(f++)];if(h<0)throw SyntaxError(Q);if(u[d++]=m<<4&255|h>>1,a<7){if(h&1)throw SyntaxError($);return u}let g=l[e.charCodeAt(f++)]<<5|l[e.charCodeAt(f++)];if(g<0)throw SyntaxError(Q);if(u[d++]=h<<7&255|g>>3,g&7)throw SyntaxError($);return u}function we(e,t,n,r,i){if(typeof e!=`string`)throw TypeError(l);if(i!==null&&E(i),n===!0){if(e.length%8!=0)throw SyntaxError(ve)}else if(n===!1){if(e.endsWith(`=`))throw SyntaxError(`Did not expect padding in base32 input`)}else if(n!==`both`)throw TypeError(`Invalid padding option`);return u(Ce(e,t),r)}var Te=(e=>(t,n)=>{if(!n)return we(t,e,`both`,`uint8`,null);let{format:r=`uint8`,padding:i=`both`,...a}=n;return we(t,e,i,r,a)})(0),Ee=(e,{padding:t=!1}={})=>xe(e,0,t);export{q as a,he as b,ae as c,oe as d,Te as e,Ee as f};
@@ -1,6 +0,0 @@
1
- import{a as e}from"./chunk-SXV2T5C4.js";import{b as t}from"./chunk-TUII34K2.js";var n=new Set([`module`,`commonjs`,`json`,`module-typescript`,`commonjs-typescript`]),r=new Set([`solidity`,`php`,`shell`,`rust`]),i=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`]),a=new Set([`resource`,`resource:base64`]),o=new Set([`stat:file`,`stat:directory`]),s=new Set([...n,...r,...i,...a,`patch`,`directory`,...o]),c=e=>o.has(e),l=e=>e===`directory`||e===`stat:directory`?`directory`:`file`;function u(e,t,n){if(e===t)return e;let r=c(e);if(r!==c(t)&&l(e)===l(t))return r?t:e;throw Error(`format conflict for '${n}' ('${t}' vs '${e}')`)}function d(e,t){return t===``?e:e===`.`?t:`${e}/${t}`}var f=/^(?=[A-Za-z0-9-]{1,39}\/)[A-Za-z0-9](?:-?[A-Za-z0-9])*\/(?!\.\.?$)[\w.-]{1,100}$/u,p=/^(?!\.\.?(?:\/|$))[\w.~@+-]+(?:\/(?!\.\.?(?:\/|$))[\w.~@+-]+)*$/u,m=/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u,h={github:e=>typeof e==`string`&&f.test(e),directory:e=>typeof e==`string`&&e.length<=1024&&(e===``||p.test(e)),commit:e=>typeof e==`string`&&m.test(e)},ee=(e,t)=>e?.toLowerCase()===t?.toLowerCase(),g=(e,t,n)=>{if(e===void 0)return;T(e)||S(!1,`${n} must be an object`);for(let r of Object.keys(e))Object.hasOwn(t,r)||S(!1,`unknown ${n} key '${r}'`);let r=Object.entries(t).map(([t,r])=>typeof r==`object`?[t,g(e[t],r,`${n}.${t}`)]:(e[t]!==void 0&&!r(e[t])&&S(!1,`invalid ${n}.${t}: ${JSON.stringify(e[t])}`),[t,e[t]])).filter(([,e])=>e!==void 0);return r.length===0?void 0:Object.freeze(E(r))},_=(e,t=`bundle repo`)=>g(e,h,t),te=(e,t)=>t??(j(e)?`npm`:void 0),ne=(e,{ecosystem:t,repo:n},r)=>{if(n===void 0)return;te(e,t)===void 0&&S(!1,`${r}: '${e}' is no dependency's bucket, and carries no repo`);let i=_(n,`${r} module '${e}' repo`);return i?.github===void 0&&S(!1,`${r} module '${e}' repo has no github`),i},re=e=>typeof e==`string`&&/^[\w.+@/~'!()*-]+$/u.test(e),v={name:re,version:re},ie=e=>typeof e==`string`&&e!==``&&!e.includes(`\\`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e!==`node_modules`),ae=(e,t,n)=>typeof e==`string`&&ie(n)&&e===`${t}/${n}`,y={vendored:()=>!0,subpackages:(e,t,n)=>ae(e.name,t,n)},oe=(e,t)=>{for(let n=t.lastIndexOf(`/`);n>0;n=t.lastIndexOf(`/`,n-1))if(Object.hasOwn(e,t.slice(0,n)))return t.slice(0,n)};function se(e,t){if(e===void 0)return;let n=new Set;for(let r of Object.keys(t)){let t=oe(e,r);t!==void 0&&n.add(t)}return n.size===0?void 0:Object.freeze(E([...n].toSorted(C).map(t=>[t,e[t]])))}var b=(e,t,{name:n,ecosystem:r,files:i,[e]:a},o)=>{if(a===void 0)return;te(t,r)===void 0&&S(!1,`${o}: '${t}' is no dependency's bucket, and carries no ${e}`),T(a)||S(!1,`${o} module '${t}' ${e} must be an object`);let s=E(Object.entries(a).map(([r,i])=>{ie(r)||S(!1,`${o} module '${t}' ${e}: invalid directory ${JSON.stringify(r)}`);let a=g(i,v,`${o} module '${t}' ${e} '${r}'`);return a?.name===void 0&&S(!1,`${o} module '${t}' ${e} '${r}' has no name`),y[e](a,n,r)||S(!1,`${o} module '${t}' ${e} '${r}' is named '${a.name}', not '${n}/${r}'`),[r,a]})),c=se(s,i);for(let n of Object.keys(s))Object.hasOwn(c??{},n)||S(!1,`${o} module '${t}' ${e} '${n}' holds none of its files`);return c},x=({name:e,version:t,ecosystem:n,repo:r,vendored:i,subpackages:a,files:o})=>({name:e,version:t,...n===void 0?{}:{ecosystem:n},...r===void 0?{}:{repo:r},...i===void 0?{}:{vendored:i},...a===void 0?{}:{subpackages:a},files:o});function ce(e,t){let n=e.repo??t.repo,r=Object.keys(y).filter(n=>t[n]!==void 0&&Object.keys(t[n]).some(t=>!Object.hasOwn(e[n]??{},t)));if(n===e.repo&&r.length===0)return e;let i=E(r.map(n=>[n,Object.freeze(E([...Object.entries(t[n]),...Object.entries(e[n]??{})]))]));return x({...e,repo:n,...i})}var le=(e,t,n,r,i)=>E(Object.keys(y).map(a=>[a,i.includes(a)?b(a,e,{...t,files:n,[a]:se(t[a],n)},r):void 0]));function ue({name:e,version:t,ecosystem:n,repo:r,vendored:i,subpackages:a,files:o},s,c){return S(n===void 0||typeof n==`string`),o=E(Object.entries(o)),x({name:e,version:t??void 0,ecosystem:n,repo:ne(s,{ecosystem:n,repo:r},c),vendored:b(`vendored`,s,{name:e,ecosystem:n,files:o,vendored:i},c),subpackages:b(`subpackages`,s,{name:e,ecosystem:n,files:o,subpackages:a},c),files:o})}function de(e,{scope:t=`full`}={}){let n=new Set;for(let[r,{files:i}]of e)if(t===`full`||j(r))for(let e of Object.keys(i))n.add(d(r,e));return n}function fe(e,{what:t,files:n,formats:r,scope:i}){if(e.includes(`\\`))return`holds a '\\'`;if(D(e))return`escapes the root`;if(i!==`full`&&!j(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`:c(a)?`is a payload-free '${a}' record, not a file`:null}function pe(e,{what:t,files:n,formats:r,scope:i}){for(let a of e){let e=fe(a,{what:t,files:n,formats:r,scope:i});S(e===null,`${t}: executable entry '${a}' ${e}`)}}function me(e,{what:t,files:n,formats:r,scope:i=`full`}){if(e===void 0)return new Set;let a=`${t}: executable`;S(Array.isArray(e),`${a} must be an array of file paths`);let o=new Set;for(let t of e)S(typeof t==`string`&&t!==``,`${a} entry must be a non-empty string`),S(!o.has(t),`${a} entry '${t}' is listed twice`),o.add(t);return pe(o,{what:t,files:n,formats:r,scope:i}),o}function he(e,{what:t,modules:n,formats:r,scope:i}){if(e.size!==0)return pe(e,{what:t,files:de(n,{scope:i}),formats:r,scope:i}),ge(e)}function S(e,t){if(!e)throw Error(t)}function C(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 w=(e,t)=>C(e[0],t[0]),T=e=>e&&[null,Object.prototype].includes(Object.getPrototypeOf(e)),E=e=>Object.setPrototypeOf(Object.fromEntries(e),null),ge=e=>[...e].toSorted(C),_e=(e,{sorted:t=!0}={})=>E((t?[...e].toSorted(w):[...e]).map(([e,n])=>[e,n instanceof Map?_e(n,{sorted:t}):n])),ve=(e,t)=>e.get(t)??e.set(t,new Map).get(t),ye=e=>new Map(Object.entries(e).map(([e,t])=>[e,T(t)?ye(t):t]));function D(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 be=e=>e.includes(`\\`)||D(e),O=(e,t)=>S(!be(e),`${t}: path '${e}' escapes the root or holds a '\\'`),xe=(e,t)=>S(typeof e==`string`&&e!==``&&!be(e),`${t}: invalid entry ${JSON.stringify(e)}`);function Se(e,t){S(Array.isArray(e),`${t}: entries must be an array of file paths`);let n=new Set;for(let r of e)xe(r,t),S(!n.has(r),`${t}: entry '${r}' is listed twice`),n.add(r);return n}function Ce(e,t){for(let n of e)xe(n,t);return ge(e)}function we(e,t){O(e,`formats`),S(s.has(t),`unknown format '${t}' for ${e}`)}function Te(e){S(T(e));let t=new Map;for(let[n,r]of Object.entries(e)){we(n,r);let e=n===``?`.`:n;S(!t.has(e),`duplicate format key '${e}'`),t.set(e,r)}return t}function Ee(e){for(let[t,n]of e)we(t,n);return _e(e)}function De(e){for(let[,t]of e){S(t instanceof Map);for(let[e,n]of t){O(e,`imports`),S(n instanceof Map);for(let[,e]of n){if(typeof e==`string`){O(e,`imports`);continue}S(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)S(typeof t==`string`&&t.length>0&&!t.includes(`/`),`invalid platform key '${t}'`),S(typeof n==`string`),O(n,`imports`)}}}}function Oe(e){S(T(e));let t=ye(e);return De(t),t}function ke(e){return De(e),_e(e)}function Ae(e,{skipEmpty:t=!1,metadata:n=!0,what:r}={}){let i=n===!0?[`repo`,...Object.keys(y)]:n===!1?[]:n,a={modules:[],sources:[]};for(let[n,o]of e){if(t&&Object.keys(o.files).length===0)continue;let e=j(n);e&&S(o.name&&o.version&&o.files);let s=E(Object.entries(o.files).toSorted(w));a[e?`modules`:`sources`].push([n,x({...o,repo:i.includes(`repo`)?ne(n,o,r):void 0,...le(n,o,s,r,i),files:s})])}return{modules:E(a.modules.toSorted(w)),sources:E(a.sources.toSorted(w))}}function je(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 Me=e=>e instanceof Map?`{${[...e].map(([e,t])=>`${e}: ${t}`).join(`, `)}}`:e;function Ne(e,t,n){let r=new Map,i=e=>{for(let[t,i]of e){let e=ve(r,t);for(let[t,r]of i){let i=ve(e,t);for(let[e,a]of r)i.has(e)?S(je(i.get(e),a),`${n}: import '${e}' from '${t}' resolves differently ('${Me(i.get(e))}' vs '${Me(a)}')`):i.set(e,a instanceof Map?new Map(a):a)}}};return i(e),i(t),r}function Pe(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,u(i,e,t))}catch(e){throw Error(`${n}: ${e.message}`,{cause:e})}}};return i(e),i(t),r}function Fe(e,t,n,r){if(e.size===0)return new Set(t);let i=de(n,{scope:r}),a=new Set(t);for(let t of e)i.has(t)||a.add(t);return a}var Ie=/(?:^|\/)\.{0,2}(?:\/|$)/u;function k(e,t,n){let r=d(e,t);return(r!==`.`||t!==``)&&Ie.test(r)&&S(!1,`${n}: non-canonical file key ${JSON.stringify(r)}`),r.includes(`\\`)&&S(!1,`${n}: file key '${r}' holds a '\\', which no path may`),r}function A(e,t,n){let r=new Map;for(let[i,{files:a}]of e){typeof i!=`string`&&S(!1,`${t}: bucket dir ${String(i)} is not a string`),O(i,t);for(let e of Object.keys(a)){let a=k(i,e,t),o=r.get(a);o!==void 0&&n(a,o,i),r.set(a,i)}}return r}var Le=(e,t)=>n=>S(!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 Re(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,x({...i,files:Object.assign(Object.create(null),i.files)}));continue}S(e.name===i.name,`${n}: module '${t}' name mismatch ('${e.name}' vs '${i.name}')`),S(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)`)),S(e.ecosystem===i.ecosystem,`${n}: module '${t}' ecosystem mismatch ('${e.ecosystem??`(none)`}' vs '${i.ecosystem??`(none)`}')`);let a=ce(e,i);a!==e&&r.set(t,a);for(let[r,a]of Object.entries(i.files))Object.hasOwn(e.files,r)?S(e.files[r]===a,`${n}: content mismatch for '${d(t,r)}'`):e.files[r]=a}};return i(e),i(t),A(r,n,(e,t,r)=>S(!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 j(e){return e.split(`/`).includes(`node_modules`)}function ze(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 Be(e){let t=ze(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 M=1,Ve=0,He=Le(`bundle`,`artifact (bundle=replace)`),Ue=e=>Be(e)??{dir:`.`,rel:e===`.`?``:e,name:null};function We(){throw Error(`bundle: file contents are not retained by this contents-free Bundle`)}var Ge=(e,{files:t,...n})=>{let r=Object.create(null);for(let[n,i]of Object.entries(t))typeof i!=`symbol`&&S(!1,`bundle: file '${d(e,n)}' is not a placeholder`),Object.defineProperty(r,n,{get:We,enumerable:!0});return{...n,files:Object.freeze(r)}},N=(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 E([...n.keys()].toSorted().map(e=>[e,ge(n.get(e))]))},Ke=(e,t)=>Object.hasOwn(h,e)&&h[e](t),qe=(e,t)=>e?.github===void 0||!ee(e.github,t?.github)?void 0:E(Object.keys(h).filter(n=>e[n]!==void 0&&(n===`github`||e[n]===t[n])).map(t=>[t,e[t]])),Je=e=>{if(!T(e)||e.root!==!0||Object.hasOwn(e,`directory`))return e;let{root:t,...n}=e;return n},Ye={npm:v,composer:v,cargo:v},Xe=(e,t)=>E(Object.keys(Ye).map(n=>{let[r,i]=[e?.[n],t?.[n]];return[n,r?.name!==void 0&&r.name===i?.name?E(Object.entries(r).filter(([e,t])=>t===i[e])):void 0]})),P=class e{static VERSION=M;version=M;config;entries;modules;formats;imports;executable;reason;#e;get repo(){return this.#e}set repo(e){this.#e=_(e)}#t;get package(){return this.#t}set package(e){this.#t=g(e,Ye,`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=M}={}){S([Ve,M].includes(l)),S([`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=_(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(d(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(d(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=Ue(n);return k(e.dir,e.rel,`bundle`)}if(e.length===4&&(t===`sources`||t===`modules`)&&r===`files`&&typeof i==`string`)return k(n,i,`bundle`)}}static fromJSON(t,{contents:n=!0}={}){S(t.version===M||t.version===Ve),S([`node_modules`,`full`].includes(t.config?.scope));let r=Te(t.formats),i=new Map,a=new Set;if(t.version===M){let e=t.config.scope===`full`;if(t.modules!==void 0){S(typeof t.modules==`object`&&t.modules!==null);for(let[e,n]of Object.entries(t.modules))S(j(e)),O(e,`bundle`),S(n?.name&&n.version&&n.files),i.set(e,ue(n,e,`bundle`))}if(e){S(t.sources&&typeof t.sources==`object`);for(let[e,n]of Object.entries(t.sources))S(!j(e)),O(e,`bundle`),S(n?.name&&n.files),i.set(e,ue(n,e,`bundle`));t.entries!==void 0&&(a=Se(t.entries,`bundle`))}else S(t.entries===void 0),S(t.sources===void 0)}else{S(t.sources);for(let[e,n]of Object.entries(t.sources)){O(e,`bundle`);let{dir:t,rel:r,name:a}=Ue(e);S(!D(t)&&!D(r)),i.has(t)||i.set(t,{name:a,version:null,files:Object.create(null)});let{files:o}=i.get(t);S(!Object.hasOwn(o,r),`bundle: duplicate file key '.' (v0 '' and '.')`),o[r]=n}}let o=A(i,`bundle`,He),s=Oe(t.imports);if(!n)for(let[e,t]of i)i.set(e,Ge(e,t));return new e({version:t.version,config:t.config,entries:a,modules:i,formats:r,imports:s,executable:t.version===M?me(t.executable,{what:`bundle`,files:o,formats:r,scope:t.config.scope}):new Set,reason:T(t.reason)?t.reason:void 0,repo:Je(t.repo),package:t.package})}serialize(){A(this.modules,`bundle`,He);let{modules:e,sources:t}=Ae(this.modules,{skipEmpty:!0,what:`bundle`}),n=this.config.scope===`full`,r={version:M,config:this.config};this.repo!==void 0&&(r.repo=this.repo),this.package!==void 0&&(r.package=this.package),n&&(r.entries=Ce(this.entries,`bundle`)),r.formats=Ee(this.formats),r.imports=ke(this.imports);let i=he(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=N(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=N(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 S(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:Re(this.modules,t.modules,`bundle merge`),formats:Pe(this.formats,t.formats,`bundle merge`),imports:Ne(this.imports,t.imports,`bundle merge`),executable:Fe(this.executable,t.executable,t.modules,this.config.scope),reason:N(this.reason,t.reason),repo:qe(this.repo,t.repo),package:Xe(this.package,t.package)})}},Ze={__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`},Qe={__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 $e(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 et(e,t,n){if(typeof t==`string`&&Qe[t])return Qe[t];if(typeof e!=`string`)return null;let r=e.slice(e.lastIndexOf(`/`)+1),i=r.lastIndexOf(`.`);if(i<=0)return null;let a=r.slice(i+1).toLowerCase();return a===`map`?$e(n)?`json`:null:Ze[a]??null}var tt=/^webpack(?:-internal)?:\/\/[^/]*\//u,nt=/^[a-z][\d+.a-z-]*:/iu,rt=/^file:/iu,it=/^(?:file|ftp|https?|wss?):/iu,at=/^(?:[a-z][\d+.a-z-]*:\/\/[^/]*\/?|\/\/[^/]+\/|[a-z]:\/|\/)?/iu,F=e=>at.exec(e)[0],I=e=>F(e).includes(`://`),L=e=>e.replace(I(e)?/[#?].*$/su:/\?.*$/su,``),ot=e=>e.slice(e.lastIndexOf(`/`)+1),R=(e,t)=>URL.parse(e,t)?.href??null;function z(e){let t=F(e),n=t.includes(`://`)&&R(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 st(e,t){let n=F(t);return I(e)&&!n.includes(`:`)?R(t,e)??z(`${e}/../${t}`):z(n===`/`?F(e).replace(/\/?$/u,``)+t:n?t:`${e}/../${t}`)}function ct(e){try{return decodeURIComponent(e)}catch{return e}}function B(e,t){let n=e.replaceAll(`\\`,`/`);if(tt.test(n))return z(n.replace(tt,``));let r=it.test(n)?R(n)??n:n,i=/^file:\/\/([^/#]*)([^#]*)/isu.exec(r);if(i){let[,e,t]=i;return z(ct(e&&e.toLowerCase()!==`localhost`?`//${e}${t}`:t).replace(/^\/(?=[a-z]:\/)/iu,``))}if(nt.test(r)&&!F(r).includes(`:`))return r;if(t===void 0)return z(r);if(rt.test(t)&&!F(r))return B(R(r,t)??r);let a=B(t);return F(r)&&!I(a)?z(r):st(a,r)}var lt=/^(?:@[\dA-Za-z~-][\w.~-]*\/)?[\dA-Za-z~-][\w.~-]*$/u;function V(e){let t=e.split(`/`).slice(0,e.startsWith(`@`)?2:1).join(`/`);return lt.test(t)?t:null}var ut=new Set([`.pnpm`,`.bun`,`.deno`]),dt=/^\d+\.\d+\.\d+(?:-[\d.a-z-]+)?(?:\+[\d.a-z-]+)?$/iu;function ft(e,t){let n=`${t.replace(`/`,`+`)}@`,r=e.startsWith(n)?e.slice(n.length).split(/[(_]/u)[0]:null;return dt.test(r)?r:null}function pt(e){let t=L(e).split(`/`),n=t.lastIndexOf(`node_modules`),r=n<0?null:V(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:ut.has(t[n-2])?ft(t[n-1],r):null,root:a,path:e.slice(a.length+1)}}var mt=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 ht(e){let t=ot(L(e));return/^[\w-]+$/u.test(t)?`jsx`:mt.get(/\.([\da-z]+)$/iu.exec(t)?.[1].toLowerCase())??null}var gt=[`.js`,`.mjs`,`.cjs`,`.jsx`,`.ts`,`.tsx`,`.mts`,`.cts`,`.json`],_t=[`.ios`,`.android`,`.web`];function vt(e){let t=e.map(e=>/\.[a-z]+(?=\.\w+$)/u.exec(ot(L(e.path??``)))?.[0]),[[n,r],[,i]]=_t.map(e=>[e,t.filter(t=>t===e).length]).toSorted((e,t)=>t[1]-e[1]);return[...r===i?[]:[n],`.native`,``,`.browser`,`.node`]}var yt=new Map([[`.js`,[`.ts`,`.tsx`]],[`.jsx`,[`.tsx`]],[`.mjs`,[`.mts`]],[`.cjs`,[`.cts`]]]),bt=[`index`,`main`,`browser`,`node`],xt=[``,`src/`,`lib/`,`dist/`,`build/`],St=new Set([`lib`,`dist`,`build`,`out`,`esm`,`cjs`]);function*Ct(e,t){yield e;let n=/\.[^./]+$/u.exec(e)?.[0];for(let t of yt.get(n)??[])yield e.slice(0,-n.length)+t;for(let n of e.endsWith(`/`)?[`${e}index`]:[e,`${e}/index`])for(let e of gt)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*wt(e){let t=e;for(;;){t.startsWith(`src/`)||(yield`src/${t}`),t!==e&&(yield t);let n=t.indexOf(`/`);if(n<0||!St.has(t.slice(0,n)))return;t=t.slice(n+1)}}function Tt(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:vt(e),found:new Map}}function H(e,t){if(!e.found.has(t)){let n=L(t),r=Ct(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 Et(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 Dt=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 Ot(e){if(e.startsWith(`node:`)||Dt.has(e))return{builtin:!0};let t=V(L(e));return t===null?{}:{package:t}}function kt(){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 At(e,t){for(let n of bt)for(let r of xt){let i=H(e,`${t}/${r}${n}`);if(i)return i}let n=e.byRoot.get(t);return n?.length===1?n[0]:null}function jt(e,t,n,r){return/^\/[^?]/u.test(n)?H(e,t+n)??wt(n.slice(1)).map(n=>H(e,`${t}/${n}`)).find(Boolean):H(e,t+n)??r(e,t)}function Mt(e,t,n,r=At){let i=/^(?:\.{1,2}|[a-z]:)?\\/iu.test(n)?n.replaceAll(`\\`,`/`):n,a=it.test(i);if(a||/^(?:\.{1,2}(?:\/|$)|\/|[a-z]:\/)/iu.test(i)||I(i)){let n=a?B(i):st(t.path,i),r=H(e,n);return r?{to:r}:{to:null,path:n}}if(nt.test(i)&&e.byPath.has(i))return{to:e.byPath.get(i)};let o=V(L(n)),s=o===null?null:Et(e,t,o);if(s===null)return{to:null,...Ot(n)};let c=jt(e,s,n.slice(o.length),r);return c?{to:c}:{to:null,package:o}}var U=class extends Error{name=`SourceMapError`},Nt=new Uint8Array(128).fill(255);for(let[e,t]of[...`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/,;`].entries())Nt[t.codePointAt(0)]=e;function W(e){let t=new Int32Array(e.length*2);return t.set(e),t}function Pt(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 Ft(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 U(`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?Nt[o.codePointAt(c)]??255:64;if(l<32){if(p+=l*m,f===5)throw new U(`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 U(`mappings: a value at ${c} runs past 32 bits`);continue}if(l===255)throw new U(`mappings: ${JSON.stringify(o[c])} at ${c} is not a base64 digit`);if(m!==1)throw new U(`mappings: the value before ${c} is cut off`);if(f>0){if(f===2||f===3)throw new U(`mappings: a segment of ${f} fields before ${c}`);let t=f===1?-1:s[e[1]];if(t===void 0)throw new U(`mappings: source ${e[1]} before ${c} is not in sources`);if(e[0]<0)throw new U(`mappings: a negative generated column before ${c}`);a===n.length&&([n,r,i]=[W(n),W(r),W(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),Pt({starts:Int32Array.from(t),columns:n.slice(0,a),sources:r.slice(0,a),names:i.slice(0,a)})}var It=new WeakMap,Lt=e=>It.get(e),G=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function K(e,t){if(!e)throw new U(t)}function Rt(e,t){if(e===void 0)return[];K(Array.isArray(e),`${t} is not an array`);for(let n of e)K(typeof n==`string`||n===null,`${t} holds ${JSON.stringify(n)}`);return e}function zt(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:B(t,e.mapPath);return e.files.push({source:t,path:a,package:a===null?null:pt(a),content:n,ignored:r}),t!==null&&e.bySource.set(t,e.files.length-1),e.files.length-1}function Bt(e,t,n,r){K(e.version===3,`version ${JSON.stringify(e.version)} is not 3`),K(e.sourceRoot===void 0||typeof e.sourceRoot==`string`,`sourceRoot is not a string`);let i=Rt(e.sources,`sources`),a=Rt(e.sourcesContent,`sourcesContent`),o=e.ignoreList??e.x_google_ignoreList??[];K(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)=>zt(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 Vt(e,t){K(e.version===3,`version ${JSON.stringify(e.version)} is not 3`),K(Array.isArray(e.sections),`sections is not an array`);for(let[n,r]of e.sections.entries()){let{offset:i,map:a}=G(r)?r:{};K(G(i)&&[i.line,i.column].every(e=>Number.isInteger(e)&&e>=0),`sections[${n}].offset is not a line and a column`),K(G(a)&&a.sections===void 0,`sections[${n}].map is not a plain source map`);let o=e.sections[n-1]?.offset;K(!o||o.line<i.line||o.line===i.line&&o.column<=i.column,`sections[${n}] starts before sections[${n-1}]`),Bt(a,t,i.line,i.column)}}function Ht(e,t={}){if(!G(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 U(`not JSON: ${e.message}`,{cause:e})}K(G(n),`not a JSON object`);let r={files:[],bySource:new Map,mapPath:t.path,parts:[],names:[]};n.sections===void 0?Bt(n,r,0,0):Vt(n,r);let i={files:r.files};return It.set(i,{...Ft(r.parts),nameList:r.names}),i}var Ut=/\r\n?|[\n\u2028\u2029]/gu;function Wt(e){let t=[0];for(let n of e.matchAll(Ut))t.push(n.index+n[0].length);return t}function Gt(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 q(e,t){let n=Gt(e,0,e.length,t);return[n,t-e[n]]}function Kt(e,[t,n]){if(t>=e.starts.length-1)return-1;let r=e.starts[t],i=Gt(e.columns,r,e.starts[t+1],n);return i<r?-1:i}function qt(e,t,n,r){let i=Lt(e),a=q(t,n),[o,s]=q(t,r),c=new Map,l=Kt(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 Jt=/\s+/uy,Yt=`
2
- \r\u2028\u2029`,Xt=/[\n\r\u2028\u2029]/gu,Zt=/[\n\r\u2028\u2029]/u,J=/[\w$\u0080-￿]+/uy,Qt=new Set([`return`,`typeof`,`instanceof`,`in`,`of`,`new`,`delete`,`void`,`throw`,`case`,`default`,`extends`,`do`,`else`,`yield`,`await`]),$t=new Set([`if`,`while`,`for`,`with`]),en=new Set([`break`,`continue`,`debugger`]),tn=new Set([`(`,`[`,"${",`,`,`=`,`:`,`?`,`!`,`~`,`+`,`-`,`*`,`/`,`%`,`&`,`|`,`^`,`<`,`>`]);function nn(e,t){return e?.type===`word`?t&&[`return`,`yield`].includes(e.value)?!1:Qt.has(e.value)&&![`do`,`else`].includes(e.value):tn.has(e?.value)}function rn(e){let t=e.at(-1);return t?.type===`word`&&($t.has(t.value)||t.value===`await`&&e.at(-2)?.value===`for`)}function an(e){return e?e.type===`word`?Qt.has(e.value)||en.has(e.value)||e.label===!0:e.value===`)`?e.control:e.value===`}`?!e.object:e.type===`punctuator`&&![`++`,`--`,`]`].includes(e.value):!0}var on=(e,t)=>e.startsWith(`\r
3
- `,t+1)?3:2,sn=/\\(?: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,cn={b:`\b`,f:`\f`,n:`
4
- `,r:`\r`,t:` `,v:`\v`};function ln(e){return e.includes(`\\`)?e.replace(sn,(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)?cn[o]??o:String.fromCodePoint(Math.min(s,1114111))}):e}function un(e,t){let n=e[t],r=t+1;for(;r<e.length&&e[r]!==n&&!Yt.includes(e[r]);)r+=e[r]===`\\`?on(e,r):1;return[e[r]===n?ln(e.slice(t+1,r)):null,r+1]}function dn(e,t){let n=t+1,r=!1;for(;n<e.length&&!Yt.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 fn(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 pn(e){let t=[],n=[],r=[],i=0,a=0;for(;i<e.length;){let o=t.length;if(Jt.lastIndex=i,Jt.test(e)&&(i=Jt.lastIndex),i>=e.length)break;let s=e[i],c=e[i+1];if(J.lastIndex=i,s===`/`&&c===`/`)Xt.lastIndex=i+2,i=Xt.test(e)?Xt.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]=un(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=fn(e,i+1,n),o=s==="`"&&n.length===r&&e[a-1]==="`";t.push({type:`string`,value:o?ln(e.slice(i+1,a-1)):null}),n.length>r&&t.push({type:`punctuator`,value:"${"}),i=a}else if(s===`/`&&an(t.at(-1)))i=dn(e,i),t.push({type:`regex`});else if(J.test(e)){let n=en.has(t.at(-1)?.value)&&!Zt.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(nn(t.at(-1),Zt.test(e.slice(a,i)))?`object`:`block`);let o=s===`}`?n.pop():void 0;s===`(`&&r.push(rn(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 mn=e=>e?.type===`string`&&e.value!==null,hn=new Set([`type`,`typeof`]),gn=(e,t)=>e[t+1]?.type===`word`&&(e[t+1].value!==`as`||e[t+2]?.type!==`word`||e[t+2].value===`as`);function _n(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(!hn.has(e[r].value)||!gn(e,r))return!1;n=!0}return n}function vn(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`&&mn(e[n+1]))return e[n+1].value}return null}function yn(e,t){let[n,r,i]=[e[t].value,e[t+1],e[t+2]],a=n===`import`?`import`:`export-from`;if(n===`import`&&mn(r))return{kind:a,specifier:r.value};if(hn.has(r?.value)&&![`,`,`from`].includes(i?.value)||r?.value===`{`&&_n(e,t+1)||n===`export`&&![`{`,`*`].includes(r?.value)||n===`import`&&r?.type!==`word`&&![`{`,`*`].includes(r?.value))return null;let o=vn(e,t+1);return o===null?null:{kind:a,specifier:o}}function bn(e,t){let[n,r]=[e[t+2],e[t+3]];if(n?.value!==`)`)return mn(n)&&[`)`,`,`].includes(r?.value)?n.value:null}function xn(e,t=new Set){let n=pn(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?bn(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=yn(n,e);t&&r.push(t)}}return r}var Sn=/^[\w$]*__d\(/gmu,Cn=([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 wn(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(!Cn(i))break;n=i,r=r>0?e.lastIndexOf(`},`,r-1):-1}return n}function Tn(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 En(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:Tn(t)}function Dn(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 On(e,t){let n=[...e.matchAll(Sn)].map(e=>e.index);if(n.length===0)return null;let r=Wt(e),i=t=>e.slice(r[t],r[t+1]),a=[];for(let[o,s]of n.entries()){let[c]=q(r,s),[l]=q(r,(n[o+1]??e.length)-1),u=wn(i(l));for(;!u&&l>c;)u=wn(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:qt(t,r,s,d),dependencies:En(u[1],e.slice(s,d))})}Dn(a,t);let o=new Map(a.map(e=>[e.id,e])),{edges:s,link:c}=kt();for(let{file:e,dependencies:t}of a)for(let n of t)c(e,o.get(n)?.file,`dependency`);return s}var kn=e=>e.path!==null&&![`json`,null].includes(ht(e.path)),An=e=>e.path!==null&&ht(e.path)===null;function jn(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 Mn={jsxRuntime:`react/jsx-runtime`,jsxDevRuntime:`react/jsx-dev-runtime`};function Nn(e){let{sources:t,names:n,nameList:r}=Lt(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],jn(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(jn);o.length>0&&i.set(r,o.map(e=>Mn[e]??`@babel/runtime/helpers/${e}`))}return i}function Pn(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,Mt(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:Mt(t,e,r,i)}}var Fn=e=>/(?:^|\/)__prelude__$/u.test(e.source??``),In=e=>e?.package?.name===`metro-runtime`&&e.package.path===`src/polyfills/require.js`;function Ln(e){if(!e.files.some(Fn)&&!In(e.files[0]))return null;if(!e.files.some(e=>e.content!==null&&!Fn(e)&&!In(e)))throw Error("bundleEdges: the Metro map carries no sourcesContent, which its edges are read from; pass the bundle as `code`");let t=Tt(e.files),n=e.files[e.files.findIndex(An)+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&&kn(e)).map(e=>[e,xn(e.content)])),a=Nn(e),o=Pn([...[...i].map(([e,t])=>[e,t.flatMap(({specifier:e})=>e===null?[]:[e])]),...a],t),{edges:s,add:c,link:l}=kt();for(let t of e.files){An(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 Rn=(e,t)=>t==null?Ln(e):On(t,e);function zn(e,t){let n=Rn(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 Bn(e){let t=JSON.parse(e.replace(/^\)\]\}'[^\n]*\n/u,``)),n=Ht(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 Vn(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 Hn(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 Un(e){try{return zn(e)}catch{return{edges:[]}}}var Wn=Object.freeze([]);function Gn(e){return e?.edges?e.edges:e?.map?(e.edges=Hn(e.map,Un),e.edges):Wn}var Kn=new WeakMap,qn=new WeakMap;function Jn(e){let t=Gn(e);if(!Kn.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);Kn.set(t,e)}return Kn.get(t)}function Yn(e){let t=Gn(e);if(!qn.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));qn.set(t,e)}return qn.get(t)}var Xn=new WeakMap,Zn=new WeakMap,Qn=new WeakMap,$n=new WeakMap,Y=new WeakMap,er=new WeakMap;function X(e){if(e?.metadataOnly)return new Map;let t=e?.bundle??e?.json;if(t&&Xn.has(t))return Xn.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`&&(P.isResourceFormat(t?.get(r))||n.set(r,i))}else if(e.kind===`sourcemap`)for(let[t,r]of Vn(e))typeof r==`string`&&n.set(t,r);return t&&Xn.set(t,n),n}function tr(e){let t=1;for(let n=e.indexOf(`
5
- `);n!==-1;n=e.indexOf(`
6
- `,n+1))t++;return t}var nr=new WeakMap;function rr(e){let t=nr.get(e);if(!t){let n=[...e.keys()].toSorted();t={paths:n,numbers:new Map(n.map((e,t)=>[e,t+1]))},nr.set(e,t)}return t}function ir(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 ar(e){let t=e?.bundle??e?.json;if(t&&Zn.has(t))return Zn.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&&Zn.set(t,n),n}var or=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;function sr(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&&or.indexOf(n.at(-1))&(r===2?15:3)?null:Math.floor(n.length*3/4)}function cr(e){return typeof e==`string`?t(e):e?.format===`digest`?e.size:e?.format===`base64`?sr(e.data):null}function Z(e){if(e?.fileSizes)return e.fileSizes;let t=e?.bundle??e?.json;if(t&&Qn.has(t))return Qn.get(t);let n=new Map,r=ar(e),i=e?.kind===`stasis`?e.bundle?.sources.keys():e&&Vn(e).map(([e])=>e);for(let e of i??[])n.set(e,cr(r.get(e)));return t&&Qn.set(t,n),n}function lr(e){if(e?.metadataOnly)return e.unsizedFiles??new Set;let t=Z(e);if(er.has(t))return er.get(t);let n=new Set;for(let r of ar(e).keys())t.get(r)===null&&n.add(r);return er.set(t,n),n}function ur(e){let t=Z(e);if(Y.has(t))return Y.get(t);let n=lr(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,P.isResourceFormat(r?.get(a))||e?.npmBinaries?.has(a)?`resource`:`source`);return Y.set(t,i),i}function dr(e){let t=Z(e),n=e?.kind===`stasis`?e.bundle?.formats:null;if(!n||n.size===0)return t;if($n.has(t))return $n.get(t);let r=new Map;for(let[e,i]of t)P.isResourceFormat(n.get(e))||r.set(e,i);return $n.set(t,r),r}var fr=new WeakMap;function pr(e){if(e?.kind!==`stasis`||!e.bundle?.modules)return null;if(fr.has(e.bundle))return fr.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 fr.set(e.bundle,t),t}function mr(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:pr(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 hr=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`}),gr=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 _r(e){let t=typeof e==`string`?e.slice(e.lastIndexOf(`/`)+1):``,n=t.lastIndexOf(`.`),r=n>0?t.slice(n+1).trim().toLowerCase():``,i=et(e)??gr[r];return i?{key:i,label:hr[i]??i}:r?{key:`extension:${r}`,label:`.${r}`}:{key:`other`,label:`Other`}}function vr(e,t){let n=new Map,r=0,i=0;for(let[a,o]of e){let e=_r(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 yr=6,Q=new WeakMap,br=new Set([`terminal`,`code`,`search`,`compare`]);function xr(e,t=null){return!!t||br.has(e)}var Sr=/^sha512-[A-Za-z0-9+/]{86}==$/u;function Cr(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 wr(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 Tr(e){return e.lineCounts??=new Map([...X(e)].map(([e,t])=>[e,wr(t)]))}function $(e){return e instanceof Map?Object.fromEntries([...e].map(([e,t])=>[e,$(t)])):e}async function Er(e){let n=await Cr(e),r=Z(e),i=Tr(e),a={version:yr,integrity:e.integrity,kind:e.kind,size:e.size,codeStats:vr(i,r),files:[...r].map(([e,t])=>[e,t,n.get(e)??null,i.get(e)??null])},o=lr(e);if(o.size>0&&(a.unsized=[...o]),e.kind===`sourcemap`){let{version:n,file:r,sourceRoot:i,names:o}=e.json,s=Vn(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=Gn(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 Dr(e,t){if(![1,2,3,4,5,yr].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!==yr,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`||!Sr.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=P.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&&!P.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=Or(e.edges,e.files))}if(e.codeStats===void 0)c.codeStats=vr(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 Or(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 kr(e,{integrity:t,kind:n,size:r}){if(n===`stasis`)return{integrity:t,kind:n,size:r,bundle:P.parse(e)};if(n!==`sourcemap`)throw Error(`Unsupported bundle format`);return{integrity:t,kind:n,size:r,...Bn(e)}}export{Ke as a,P as b,et as c,Jn as d,Yn as e,X as f,tr as g,rr as h,ir as i,ar as j,cr as k,Z as l,ur as m,dr as n,pr as o,mr as p,vr as q,xr as r,Cr as s,wr as t,Tr as u,Er as v,Dr as w,kr as x};
@@ -1,36 +0,0 @@
1
- import{b as e,h as t}from"./chunk-2K6UN3PC.js";import{a as n}from"./chunk-WCPJDAYA.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";var re=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}}),ie=e=>e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`),ae=e=>y(e)?e:ie(b(String(e))),k=globalThis.trustedTypes?.createPolicy(`deepview`,{createHTML:ae,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}}),A=e=>k?k.createHTML(e):ae(e),oe=e=>k?k.createScriptURL(String(e)):e,j={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 se({keepViewport:e=!1}={}){j.graphState?._cleanup?j.graphState._cleanup({keepViewport:e}):e||(j.keptViewport=null),j.graphState=null}function M(e){return e.id??String(e._id)}function ce(e){let t=m(e);return t!==``&&t!==`revalidation`}var N=[{value:`confirmed`,label:`Confirmed`,kinds:[`confirmed`,`partial`,`revalidation`]},{value:`unreachable`,label:`Unreachable`,kinds:[`unreachable`]},{value:`refuted`,label:`Refuted`,kinds:[`refuted`]}];function le(e){return N.find(t=>t.value===e)?.kinds??null}var ue=[``,`exclude`,`only`];function de(e,t){let n=le(e);return n?.includes(`partial`)?t===`only`?[`partial`]:t===`exclude`?[`confirmed`]:n:n}function P(e){if(e.confidence!==void 0)return e.confidence;if(e.critical===!0||e._source)return 10}var fe=e=>e.confidence!==void 0||e.critical===!0;function pe(e){return e.every(e=>e.every(e=>P(e)!==void 0))&&e.some(e=>e.some(fe))}function me(e,t,n){return e.some(e=>{let r=[`refuted`,`unreachable`].includes(n(e))?0:P(e);return r===void 0?t===0:r>=t})}function he(e,t){let n=e.map(t).filter(e=>e.length>0);if(!n.some(e=>e.some(e=>P(e)!==void 0)))return 0;let r=e=>n.reduce((t,n)=>t+ +!!n.some(t=>(P(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 ge(e,t){return pe(e)?t:0}function _e(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(M(e));for(let i of e){let e=t(i);if(e.length!==0&&e.some(e=>de(`confirmed`,``).includes(n(e)||(e._source&&!e._sourcePass?`revalidation`:``)))){for(let e of i)if(r.add(M(e)),e.isApp&&Array.isArray(e.revalidateInputs))for(let t of e.revalidateInputs)t&&r.add(t)}}return r}function ve(e,t,n,r){let i=ge(e,t),a=e.filter(e=>me(e,i,r));if(a.length===0)return!1;let o=new Set(de(`confirmed`,``));return e.some(e=>e.some(e=>o.has(r(e))))?a.every(e=>e.every(e=>n.has(M(e)))):!1}function ye(e,{tabs:t,kindOf:n,severityMode:r}){let i=e.map(t).filter(e=>e.length>0),a=_e(e,t,n);if(!ve(i,he(e,t),a,n))return!1;let o=ge(i,6);return i.every(e=>!me(e,o,n)||!e.some(e=>p(e,r)!==`low`)||e.every(e=>a.has(M(e))))}var F=!0;function be(e,t=!1){F=e!==!1&&!t}function xe(){return F}function I(e){return F?m(e):``}function Se(e){return m(e)!==``}function Ce(e){return e.some(e=>(e.groups??[]).some(e=>e.some(ce)))}function we(e){let t=I(e);return t&&t!==`revalidation`?t:null}function Te(e){return I(e)===`revalidation`}var Ee=new Set([`refuted`,`unreachable`]);function De(e){return Ee.has(I(e))}function Oe(e){return Ee.has(I(e))}function ke(e){let t=new Set(e);return N.filter(e=>e.kinds.some(e=>t.has(e)))}function L(e){return RegExp(`(^|/)${e}/`,`u`)}function Ae(e){return RegExp(`^(?:.*/)?${e}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,`u`)}var je=L(`node_modules`),Me=L(`vendor`),R=`node_modules`,Ne=L(R),Pe=Ae(R);function Fe(e){e!==R&&(R=e,Ne=L(e),Pe=Ae(e))}var Ie=null;function Le(t){Ie?.length===t.length&&Ie.every((e,n)=>e===t[n])||(Ie=[...t],Fe(e(t)))}function Re(){return R}function z(e){return Ne.test(e)}var B=new WeakSet;function ze(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=B.has(n);`isUpstream`in n&&!e||(z(n.file)?(n.isUpstream!==!0&&(t=!0),n.isUpstream=!0,B.add(n)):e&&(t=!0,delete n.isUpstream,B.delete(n)))}return t}function Be(e){let t=typeof e==`string`?e:``;return je.test(t)||Me.test(t)||Ne.test(t)}var Ve=/^(.*(?:^|\/)node_modules\/(?:@[^/]+\/[^/]+|[^/]+))(?:\/|$)/u;function He(e){return Ve.exec(typeof e==`string`?e:``)?.[1]??null}function Ue(e){return typeof e!=`number`||!Number.isFinite(e)?null:n(e)}function We(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 Ge(e){return e.match(Pe)?.[1]??e}var V={on:new WeakMap,off:new WeakMap};function Ke(e){let t=F?V.on:V.off,n=t.get(e);if(n===void 0){let r=F?[we(e),e.revalidateVerdict,e.revalidateRecommendation]:[];n=[e.file,e.title,e.description,e.impact,e.reproduction,Ot(e),e.recommendation,e.confidenceReason,...r,e.discoveredIn,e.repo?.github].filter(Boolean).join(`
2
- `).toLowerCase(),t.set(e,n)}return n}function qe(e){V.on.delete(e),V.off.delete(e)}function Je(e){return[typeof e?.category==`string`?e.category.trim():``,h(e,F)].filter(Boolean).join(` · `)}function Ye(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 Xe(e){if(!e)return``;let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}function Ze(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 Qe=/^(?:@[\w.-]+\/)?[\w.-]+@[^/\s@]+$/u;function $e(e){return Qe.test(e||``)}function et(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 tt(e,t,n){if($e(e))return null;let r=et(t);if(r.id)return`https://github.com/${r.id}/blob/HEAD/${r.prefix}${Ge(e)}`;if(z(e))return null;let i=et(n),a=Ze(i.id);return a?`${a}/blob/HEAD/${i.prefix}${e}`:null}function nt(e,t){let n=e?.file??``,r=H(e,t);return r?E`<a href="${rt(r)}" target="_blank" rel="noopener">${n}</a>`:n}function rt(e){return e.replace(/#L\d+(?:-L?\d+)?$/u,``)}function H(e,t){if(!e)return null;if(s(e.location))return e.location;let n=tt(e.file,e.repo,t);if(!n)return null;let r=parseInt(e.line,10);return Number.isFinite(r)?`${n}#L${r}`:n}var it=/^https?:\/\/(?:www\.)?github\.com\/([^/\s]+\/[^/\s]+)\/(?:blob|tree|blame)\/[^/\s]+\/(\S+)$/u,at=/#L(\d+)(?:-L?(\d+))?$/u;function ot(e){let t=typeof e==`string`?it.exec(e):null;if(!t)return``;let n=t[2],r=at.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 st=/^(?:\s+\S|[-*+] |\d+[.)] |>|#{1,6}(?:[ \t]|$)|\||`{3}|~{3})/u;function ct(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=>st.test(e)||W.test(e))?e:t.map(e=>e.trim()).filter(Boolean).join(` `)}).join(``)}function lt(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+ct(i.slice(0,i.length-a.length))+a}function ut(e){if(!e)return e;let t=e.replaceAll(`\r
4
- `,`
5
- `),n=l(t);if(n.length===0)return ct(t);let r=[],i=0;for(let[e,a]of n)e>i&&r.push(lt(t.slice(i,e),i>0,!0)),r.push(t.slice(e,a)),i=a;return i<t.length&&r.push(lt(t.slice(i),!0,!1)),r.join(``)}var dt=/^( *)(`{3,}|~{3,})(.*)$/u,ft=/^[a-z0-9+#._-]{1,20}$/u;function pt(e,t){let n=0;for(;n<t&&e[n]===` `;)n++;return e.slice(n)}function mt(e){let t=e.split(`
6
- `),n=dt.exec(t[0]),r=(n?.[2]??"```").slice(0,3),i=(n?.[3]??``).trim().split(/\s+/u)[0].toLowerCase(),a=!!(t.length>1?dt.exec(t.at(-1)):null)?.[2].startsWith(r),o=n?.[1].length??0,s=t.slice(1,a?-1:void 0);return{lang:ft.test(i)?i:``,code:(o>0?s.map(e=>pt(e,o)):s).join(`
7
- `)}}function ht(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(mt(e.slice(a,o))),r=o;return r<e.length&&i(e.slice(r),!0),n}var U=/^( *)(?:[-*+]|(\d{1,9})[.)]) +(?=\S)/u,W=/^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/u;function gt(e){return/^ */u.exec(e)[0].length}function _t(e){let t=e.length;for(;t>0&&!e[t-1].trim();)t--;return e.slice(0,t).join(`
8
- `)}function vt(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])&&!W.test(r[e])&&U.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=U.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=gt(e),r=W.test(e)?null:U.exec(e);if(r&&(!l||n<l.column)){if(!!r[2]!==t)break;l&&a.push(_t(l.lines)),l={column:r[0].length,lines:[e.slice(r[0].length)]},p=!1,d++;continue}if(n<l.column&&(p||yt.test(e)||W.test(e)))break}l.lines.push(pt(e,l.column)),p=!1,d++}l&&a.push(_t(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 yt=/^ {0,3}(#{1,6})[ \t]+(\S.*?)(?:[ \t]+#+)?[ \t]*$/u,bt=/^ {0,3}-+[ \t]*$/u;function xt(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=yt.exec(e),s=W.test(e)&&(a===r||!t[a-1].trim()||!bt.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 St=/^(\d+)(?:\s*-\s*(\d+))?$/u;function G(e){if(typeof e==`number`)return Number.isFinite(e)&&e>=1?{start:Math.floor(e),end:Math.floor(e)}:null;let t=St.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 Ct(e){return e?e.start===e.end?String(e.start):`${e.start}-${e.end}`:``}function wt(e){if(e&&typeof e==`object`){let t=G(e.start);if(!t)return null;let n=G(e.end)??t;return{start:t.start,end:Math.max(t.start,n.end)}}return G(e)}function Tt(e,t,n=4){let r=typeof e==`string`&&e!==``?e.split(`
13
- `):[];if(r.length===0)return{text:``,startLine:1,lines:[]};let i=wt(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 Et(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?H({file:i,line:e?.line,repo:t.repo},null):null;if(r===0&&i===a)return c();let l=He(i);return l!==null&&l===He(a)?c():Be(i)?null:o&&!Be(a)?c():H({file:i,line:e?.line},n)}function Dt(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 Ot(e){let t=Dt(e);return t?`**Evidence:**
20
- ${t}`:``}function kt(e){let t=/^\[([^\]]+)\]\(([^)\s]+)\)$/u.exec(e);return!t||!s(t[2])?null:{label:d(t[1].trim())||t[2],url:t[2]}}function At(e,t){let n=parseInt(e?.line,10);if(!Number.isFinite(n))return O;let r=H(e,t),i=`line ${n}`;return r?E`<a href="${r}" target="_blank" rel="noopener">${i}</a>`:i}function jt(e,t){return!e||!t?null:`${/^https?:/iu.test(e)?e.replace(/\/$/u,``):`https://github.com/${e}`}/commit/${t}`}var Mt=[[`Impact`,`impact`],[`Reproduction`,`reproduction`],[`Recommendation`,`recommendation`],[`Confidence reason`,`confidenceReason`],[`Revalidation verdict`,`revalidateVerdict`],[`Revalidation recommendation`,`revalidateRecommendation`]];function Nt(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=I(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=Dt(e,{spaced:!0});c&&a.push(`# Evidence
22
-
23
- ${c}`);for(let[t,n]of Mt){if(!F&&n.startsWith(`revalidate`))continue;let r=g(e?.[n],e)?.trim();r&&a.push(`# ${t}
24
-
25
- ${r}`)}return a.join(`
26
-
27
- `)}function Pt(e,{title:t,body:n,labels:r=[]}={}){let i=Ze(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 Ft=/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u,It=/^[a-zA-Z\d._-]+$/u,Lt=/^[1-9]\d{0,9}$/u,Rt=/^[a-fA-F\d]{7,40}$/u,zt=/^#[\w-]+$/u,Bt=/^GHSA(?:-[0-9a-z]{4}){3}$/u;function Vt(e){return e.length<=39&&Ft.test(e)}function Ht(e){return e.length<=100&&e!==`.`&&e!==`..`&&It.test(e)}function Ut(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 Bt.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!Vt(e)||!Ht(t)||!Bt.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(!Vt(r)||!Ht(i))return null;let s;if(a===`issues`||a===`pull`){if(!Lt.test(o))return null;s=`${r}/${i}#${o}`}else if(a===`commit`){if(!Rt.test(o))return null;s=`${r}/${i}@${o.slice(0,7)}`}else return null;return{url:`https://github.com/${r}/${i}/${a}/${o}${zt.test(t.hash)?t.hash:``}`,label:s}}var Wt=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/u;function Gt(e){if(typeof e!=`string`)return null;let t=Kt(e);return t!==e||Wt.test(e)?t.slice(0,8):null}function Kt(e){let t=String(e);return t.startsWith(`https://chatgpt.com/codex/cloud/security/findings/`)?t.slice(50):t}function qt(e,n){let r=t(e,{managed:n});if(!r)return null;let i=Gt(r.id);return{url:n?r.path:`#${r.fragment}`,label:i?`finding ${i}`:`finding`,self:!0}}var Jt=/https?:\/\/[^\s<>"'`(){}[\]|\\^]+/giu,Yt=new Set([`)`,`.`,`,`,`!`,`?`,`;`,`:`,`'`,`"`,`*`,`]`,`}`,`>`]);function Xt(e){let t=e.length;for(;t>0&&Yt.has(e[t-1]);)t--;return t===e.length?e:e.slice(0,t)}function Zt(e,{managed:t=!1}={}){if(typeof e!=`string`||e.length===0)return[];let n=[],r=0;Jt.lastIndex=0;let i;for(;(i=Jt.exec(e))!==null;){let a=Xt(i[0]),o=a?Ut(a)??qt(a,t):null;o&&(i.index>r&&n.push(e.slice(r,i.index)),n.push(o),r=i.index+a.length,Jt.lastIndex=r)}return r<e.length&&n.push(e.slice(r)),n}var Qt={commit:S},$t=8;function en(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 tn({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 K;function nn(){return K||(K=document.createElement(`div`),K.id=`styled-tooltip`,K.setAttribute(`popover`,`manual`),document.body.append(K),K)}function rn(e){typeof e.showPopover==`function`&&(e.matches(`:popover-open`)&&e.hidePopover(),e.showPopover())}var q=null,an=``,J=null,Y=null,on=0,sn=0,cn=!1;function X(){if(!cn){cn=!0,document.addEventListener(`mousemove`,e=>{on=e.clientX,sn=e.clientY},{passive:!0});for(let e of[`pointerdown`,`wheel`,`scroll`])document.addEventListener(e,()=>Q(),{capture:!0,passive:!0});document.addEventListener(`keydown`,e=>{e.key===`Escape`&&Q()}),window.addEventListener(`blur`,()=>Q())}}var ln=100,un=14,dn=8,Z=8;function fn(e,{placement:t=`cursor`}={}){X(),clearTimeout(J),J=null,Y=null,e.prepareTooltip?.(e),t=e.dataset.tooltipPlacement??t;let n=nn(),i=e.dataset.tooltip??``,a=Object.hasOwn(Qt,e.dataset.tooltipIcon??``)?e.dataset.tooltipIcon:``,o=e.dataset.tooltipRepo??``,s=r(e.dataset.tooltipCommit),c=en(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){Q();return}if(q===e&&an===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=A(Qt[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=A(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=A(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,$t)){let n=document.createElement(`span`);n.className=`tooltip-tag`,n.innerHTML=A(ee);let r=document.createElement(`span`);r.textContent=t,n.append(r),e.append(n)}if(c.tags.length>$t){let t=document.createElement(`span`);t.className=`tooltip-tag-more`,t.textContent=`+${(c.tags.length-$t).toLocaleString()} more`,e.append(t)}n.append(e)}}if(c?.details&&n.append(tn(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=A(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)}rn(n),n.style.left=`0px`,n.style.top=`0px`,n.style.transform=`none`,n.classList.add(`visible`);let b=on,C=sn+un;if(t===`right`||t===`right-start`){let n=e.getBoundingClientRect();b=n.right+dn,C=n.top+(t===`right`?n.height/2:0)}let w=window.innerWidth-n.offsetWidth-Z,T=Math.max(Z,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-Z,re=Math.max(Z,Math.min(D,O));n.style.top=`${Math.round(re)}px`,q=e,an=y}function Q(e){e&&!e.contains(q)&&!e.contains(Y)||(clearTimeout(J),J=null,Y=null,K&&(K.classList.remove(`visible`),typeof K.hidePopover==`function`&&K.matches(`:popover-open`)&&K.hidePopover()),q=null)}function pn(e,{gate:t,placement:n}={}){X();let r=()=>e.isConnected!==!1&&(!Object.hasOwn(e.dataset,`tooltipTruncated`)||e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight)&&(!t||t(e));if(!r()){Q();return}e===q||e===Y||(Q(),Y=e,J=setTimeout(()=>{J=null,Y=null,r()&&fn(e,{placement:n})},ln))}var mn=new WeakSet;function hn(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 gn(e,t){!e||mn.has(e)||(mn.add(e),e.ownerDocument&&X(),e.addEventListener(`mouseover`,n=>{if(n.buttons){Q();return}let r=hn(n,e);if(!r){Q();return}r!==q&&pn(r,t)}),e.addEventListener(`mouseout`,t=>{let n=hn(t,e),r=t.relatedTarget?.closest?.(`[data-tooltip]`)??null;n&&n===r||Q()}),e.addEventListener(`scroll`,()=>Q(e),{capture:!0,passive:!0}))}var _n=!1;function vn(){_n||(_n=!0,X(),document.addEventListener(`tooltip-root-connected`,e=>{gn(e.composedPath()[0]?.shadowRoot)}),document.body.addEventListener(`mouseover`,e=>{if(e.target.closest(`[data-tooltip-managed]`))return;if(e.buttons){Q();return}let t=e.target.closest(`[data-tooltip]`);!t||t===q||pn(t)}),document.body.addEventListener(`mouseout`,e=>{e.target.closest(`[data-tooltip-managed]`)||e.relatedTarget?.closest?.(`[data-tooltip-managed]`)||!q&&!J||(q??Y)?.contains(e.relatedTarget)||Q()}))}function yn(e){return`tree-`+e.replaceAll(/[^\w-]+/gu,`_`)}var bn=()=>Object.fromEntries(f.map(e=>[e,0]));function xn(e,t){let n=new Map;for(let r of e)for(let e of r){n.has(e.file)||n.set(e.file,bn());let r=n.get(e.file),i=p(e,t);r[i]!==void 0&&r[i]++}return n}var $={trees:[],merged:null};function Sn(e){let t=e.map(e=>e?.tree??null);return t.length===$.trees.length&&t.every((e,t)=>e===$.trees[t])||($={trees:t,merged:Cn(e)}),$.merged}function Cn(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 wn(e,t){let n=Object.keys(e),r=new Map(n.map((e,t)=>[e,t])),i=n.map(()=>bn()),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 Tn(e,t,n){let r=t.get(e),i=n.get(e);return En(r)>0||En(i)>0}function En(e){if(!e)return 0;let t=0;for(let n of f)t+=e[n]??0;return t}function Dn(e){if(!e)return null;let t=Re(),n=RegExp(`^(?:.*/)?${t}/(@[^/]+/[^/]+|[^/]+)`,`u`),r=e.match(n);return r?r[1]:`__own__`}function On(e){return new Set(e.filter(e=>!z(e)))}var kn=[`#4e9af1`,`#f28e2b`,`#59a14f`,`#e15759`,`#76b7b2`,`#edc948`,`#b07aa1`,`#ff9da7`,`#9c755f`,`#5cd1e5`,`#f1ce63`,`#d37295`,`#a0cbe8`,`#86bcb6`,`#8cd17d`,`#b6992d`,`#499894`,`#e15759`,`#e879c7`,`#d4a6c8`],An=[`#2f8aef`,`#d2691e`,`#2ea043`,`#e63946`,`#2e9a92`,`#b88817`,`#9560e8`,`#d24a9c`,`#8a5d40`,`#0891b2`,`#a07a14`,`#c14e8e`,`#1f7ad0`,`#549b94`,`#3fb95f`,`#a07a14`,`#2a8278`,`#cb2c40`,`#c026d3`,`#965f93`];function jn(){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 Mn=new Map;function Nn(e){let t=jn()?An:kn;return t[e%t.length]}var Pn=()=>jn()?`#8c959f`:`#6e7681`;function Fn(e){let t=jn(),n=t?An:kn,r=e??`__own__`,i=`${t?`l`:`d`}:${r}`;if(Mn.has(i))return Mn.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 Mn.set(i,o),o}var In={package:`@babel/core`,path:/^lib\/config\//u},Ln={package:`@babel/core`,path:/^lib\/config\/files\/(?:module-types|plugins)\.js$/u},Rn=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:In,to:{path:/(?:^|\/)babel\.config\.js$/u}},{id:`babel-typescript-preset`,reason:`Babel configuration loads the TypeScript preset.`,from:In,to:{package:`@babel/preset-typescript`,path:/./u}},{id:`babel-react-native-preset`,reason:`Babel config loaders load the configured React Native preset.`,from:Ln,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:Ln,to:{package:/^(?:@[^/]+\/)?react-native-reanimated$/u,path:/^plugin\/index\.js$/u}},{id:`babel-transform-plugin`,reason:`Babel config loaders load configured transform plugins.`,from:Ln,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 zn(e){return typeof e==`string`&&!e.includes(`\\`)&&!e.includes(`:`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e!==`node_modules`)}function Bn(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 Vn(e,t){if(e?.ownSource!==!0&&zn(e?.path)&&zn(t?.path))return Rn.find(n=>(!n.ownSourceOnly||t.ownSource===!0)&&Bn(n.from,e)&&Bn(n.to,t))}function Hn(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 Un(e,t,n,r){return!Vn(Hn(e,r),Hn(t,n))}function Wn(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&&Un(o.origFile??i,a.origFile??s,e.ownSourceFiles?.has(s),e.ownSourceFiles?.has(i))&&r.get(t(o)).add(t(a))}}return r}var Gn=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 Kn(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 qn(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 Jn(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 Yn(e,t){let n=Jn(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 Xn(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 Gn(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=Jn(e,n);for(let i of[[...r,...a.toReversed()],qn(n),e,e.toReversed()]){let e=Kn(Yn(i,n),t),r=Jn(e,n);r>s&&(o=e,s=r)}return o}function Zn(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=Un(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:_}=Zn(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())Xn(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{re as a,A as b,oe as c,j as d,se as e,M as f,ce as g,N as h,le as i,ue as j,de as k,P as l,pe as m,he as n,_e as o,ve as p,ye as q,be as r,xe as s,I as t,Se as u,Ce as v,we as w,Te as x,De as y,Oe as z,ke as A,Le as B,Re as C,z as D,ze as E,Ue as F,We as G,Ke as H,qe as I,Je as J,Ye as K,Xe as L,nt as M,H as N,ot as O,ut as P,ht as Q,vt as R,xt as S,G as T,Ct as U,Tt as V,Et as W,Ot as X,kt as Y,At as Z,jt as _,Nt as $,Pt as aa,Gt as ba,Kt as ca,Zt as da,fn as ea,Q as fa,pn as ga,gn as ha,vn as ia,yn as ja,xn as ka,Sn as la,wn as ma,Tn as na,En as oa,Dn as pa,On as qa,Nn as ra,Pn as sa,Fn as ta,Xn as ua,Un as va,Wn as wa,Zn as xa,Qn as ya};
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
- */