@preventive/triage 1.0.0-alpha.74 → 1.0.0-alpha.75

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 (49) hide show
  1. package/common/finding-duplicates.js +4 -4
  2. package/common/finding-filters.js +11 -13
  3. package/common/managed/roles.ts +6 -0
  4. package/common/managed/routes.js +4 -3
  5. package/common/managed/team-app.d.ts +2 -0
  6. package/common/managed/team-app.js +31 -14
  7. package/out/activity.js +1 -1
  8. package/out/{chunk-VRAJCPV5.js → chunk-EYTPAODY.js} +2 -2
  9. package/out/chunk-ITUKKCCK.js +10 -0
  10. package/out/{chunk-BLPHP4U3.js → chunk-IVDE66N5.js} +1 -1
  11. package/out/{chunk-VS7RV24Z.js → chunk-NMC7P5AA.js} +2 -2
  12. package/out/chunk-O6FA2R5G.js +53 -0
  13. package/out/{chunk-YI4D6XVX.js → chunk-RHOQDAU4.js} +1 -1
  14. package/out/{chunk-GV5U7OLP.js → chunk-SZHJZVBL.js} +1 -1
  15. package/out/{chunk-2IHCVA3Y.js → chunk-T6EXDRB7.js} +1 -1
  16. package/out/chunk-VOJBPNPL.js +255 -0
  17. package/out/{chunk-C6OPCPCA.js → chunk-VSVFMSGI.js} +1 -1
  18. package/out/chunk-WGQ7D5DB.js +1 -0
  19. package/out/client-managed-import.js +1 -1
  20. package/out/client-managed.js +30 -30
  21. package/out/compare.js +4 -4
  22. package/out/dialogs.js +1 -1
  23. package/out/graph.js +1 -1
  24. package/out/index.html +8 -8
  25. package/out/prism.js +1 -1
  26. package/out/scan.js +1 -1
  27. package/out/view.css +1 -1
  28. package/out/view.js +4 -4
  29. package/package.json +1 -1
  30. package/risk/files/characters.js +142 -8
  31. package/risk/files/hosts.js +4 -3
  32. package/risk/files/readability.js +18 -13
  33. package/risk/files/runs-code.js +41 -80
  34. package/risk/files/script.js +210 -48
  35. package/risk/index.d.ts +4 -2
  36. package/risk/npm/assess.js +1 -1
  37. package/risk/npm/tarball.js +35 -19
  38. package/server-managed/http.ts +64 -23
  39. package/server-managed/locked-packages.ts +62 -5
  40. package/server-managed/npm-packages.ts +7 -5
  41. package/server-managed/repository-code.ts +3 -2
  42. package/server-managed/repository-risk-read.ts +19 -13
  43. package/server-managed/team-app-summaries.ts +3 -1
  44. package/server-managed/team-app.ts +4 -2
  45. package/server-managed/team-reports.ts +8 -3
  46. package/out/chunk-5YP7P5KA.js +0 -1
  47. package/out/chunk-74AEKRES.js +0 -10
  48. package/out/chunk-DQJEVHRE.js +0 -52
  49. package/out/chunk-ESJZZF2Y.js +0 -255
@@ -64,7 +64,7 @@ interface ReadPackage { name: string; version: string | undefined; resolution: R
64
64
  // patched one of pnpm's with its patch's file where the lockfile names it,
65
65
  // but one pnpm 9 names by an md5, which reviews don't read (isPatchHash).
66
66
  // Versions go unchecked against ranges, as only what is locked is asked for.
67
- function packagesOf(format: LockfileFormat, text: string): ReadPackage[] {
67
+ function packagesOf(format: LockfileFormat, text: string, manifests?: YarnManifests | null): ReadPackage[] {
68
68
  if (format === 'npm') return Object.values(parseNpmLockfile(text, { checkVersions: false }).packages)
69
69
  if (format === 'pnpm') {
70
70
  const { lockfile, env } = parsePnpmLockfile(text)
@@ -76,8 +76,17 @@ function packagesOf(format: LockfileFormat, text: string): ReadPackage[] {
76
76
  // Yarn 2 and later write another format, which only the text tells apart.
77
77
  if (/^__metadata:/mu.test(text)) throw new LockfileError('a yarn.lock of Yarn 2 or later, which is not read')
78
78
  // Yarn 1 names an alias, `my-q@npm:q@^1.5.1`, by its own name, and
79
- // resolves none of a directory (`file:` or `link:`).
80
- return Object.values(parseYarn1Lockfile(text, { checkVersions: false }).packages)
79
+ // resolves none of a directory (`file:` or `link:`). What only
80
+ // devDependencies need its manifests alone say: read with them, else, of
81
+ // ones its reader refuses (a workspace of no version, say), without, none
82
+ // told so.
83
+ const read = (withManifests: boolean) => parseYarn1Lockfile(text, { checkVersions: false, ...withManifests && manifests && { manifests } }).packages
84
+ let packages
85
+ try { packages = read(true) } catch (error) {
86
+ if (!manifests || !(error instanceof LockfileError)) throw error
87
+ packages = read(false)
88
+ }
89
+ return Object.values(packages)
81
90
  .map(pkg => ({ ...pkg, name: /@npm:((?:@[^/@]+\/)?[^/@]+)/u.exec(pkg.patterns[0] ?? '')?.[1] ?? pkg.name, resolution: pkg.resolution ?? { type: 'directory' as const } }))
82
91
  }
83
92
 
@@ -128,9 +137,9 @@ function locked(pkg: ReadPackage, format: LockfileFormat, review: boolean): Lock
128
137
  // reviews hold it to (LockedPackage `integrity`, `shasum`, `patchHash`),
129
138
  // each patch of it apart. Throws the reader's LockfileError or YamlError for
130
139
  // one it refuses.
131
- export function lockedPackages(format: LockfileFormat, text: string, { review = false } = {}): LockedPackage[] {
140
+ export function lockedPackages(format: LockfileFormat, text: string, { review = false, manifests = null as YarnManifests | null } = {}): LockedPackage[] {
132
141
  const found = new Map<string, LockedPackage>()
133
- for (const pkg of packagesOf(format, text)) {
142
+ for (const pkg of packagesOf(format, text, manifests)) {
134
143
  const one = locked(pkg, format, review)
135
144
  if (!one) continue
136
145
  if (pkg.dev === true) one.dev = true
@@ -142,6 +151,54 @@ export function lockedPackages(format: LockfileFormat, text: string, { review =
142
151
  return [...found.values()]
143
152
  }
144
153
 
154
+ // A yarn.lock's package.json files (`manifests`, yarn1.js), by directory
155
+ // from it, `.` its own: Yarn 1's lockfile says nothing of what only
156
+ // devDependencies need, which they alone do.
157
+ export type YarnManifests = Record<string, object>
158
+ // How many workspaces' are read at most; past it, none are, nor told dev.
159
+ const MAX_YARN_WORKSPACES = 200
160
+
161
+ // Whether a directory, from the root's, is one a glob of its `workspaces`
162
+ // finds, as yarn 1's minimatch reads one (@preventive/lockfile's glob.js): a
163
+ // segment at a time, `**` any of them, `*` and `?` within one, none of
164
+ // these taking a segment that starts with `.`.
165
+ function workspaceGlob(glob: string) {
166
+ const globs = glob.replace(/^(?:\.\/)+/u, '').replace(/\/+$/u, '').split('/')
167
+ const segment = (pattern: string) => new RegExp(`^${pattern.replaceAll(/[.+^${}()|[\]\\]/gu, '\\$&').replaceAll('*', '[^/]*').replaceAll('?', '[^/]')}$`, 'u')
168
+ const tests = globs.map(each => each === '**' ? null : { test: segment(each), wild: /[*?]/u.test(each) && !each.startsWith('.') })
169
+ const matches = (at: number, parts: string[], from: number): boolean => {
170
+ if (at === tests.length) return from === parts.length
171
+ const test = tests[at]!
172
+ if (test === null) return matches(at + 1, parts, from) || (from < parts.length && !parts[from]!.startsWith('.') && matches(at, parts, from + 1))
173
+ return from < parts.length && !(test.wild && parts[from]!.startsWith('.')) && test.test.test(parts[from]!) && matches(at + 1, parts, from + 1)
174
+ }
175
+ return (dir: string) => matches(0, dir.split('/'), 0)
176
+ }
177
+
178
+ // The package.json files a yarn.lock at `path` is read with (YarnManifests):
179
+ // the one beside it, and where it names `workspaces`, each of `files` (the
180
+ // repository's) its globs find, outside node_modules, MAX_YARN_WORKSPACES at
181
+ // most, read by `file`. Null where there is none beside it, one isn't JSON,
182
+ // or one couldn't be read.
183
+ export async function yarnManifests(path: string, file: (path: string) => Promise<string>, files?: () => Promise<string[]>): Promise<YarnManifests | null> {
184
+ const dir = path.slice(0, Math.max(path.lastIndexOf('/'), 0)), from = (at: string) => dir ? `${dir}/${at}` : at
185
+ const json = (text: string) => { try { const value: unknown = JSON.parse(text); return value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : null } catch { return null } }
186
+ try {
187
+ const root = json(await file(from('package.json')))
188
+ if (!root) return null
189
+ const listed = Array.isArray(root['workspaces']) ? root['workspaces'] : (root['workspaces'] as { packages?: unknown } | undefined)?.packages
190
+ const globs = Array.isArray(listed) ? listed.filter(each => typeof each === 'string').map(workspaceGlob) : []
191
+ if (globs.length === 0 || !files) return { '.': root }
192
+ const workspaces = (await files()).flatMap(each => {
193
+ const at = each.endsWith('/package.json') && (dir === '' || each.startsWith(`${dir}/`)) ? each.slice(dir ? dir.length + 1 : 0, -'/package.json'.length) : null
194
+ return at && !at.split('/').includes('node_modules') && globs.some(matches => matches(at)) ? [at] : []
195
+ })
196
+ if (workspaces.length > MAX_YARN_WORKSPACES) return null
197
+ const read = await Promise.all(workspaces.map(async at => [at, json(await file(from(`${at}/package.json`)))] as const))
198
+ return read.every(([, manifest]) => manifest) ? Object.fromEntries([['.', root], ...read]) as YarnManifests : null
199
+ } catch { return null }
200
+ }
201
+
145
202
  // `path`, from directory `dir` ('' the repository's root), from the root;
146
203
  // null where it leads outside the repository, or names nothing.
147
204
  export function pathFrom(dir: string, path: string): string | null {
@@ -392,8 +392,9 @@ export const npmExecutablePaths = (files: NpmPackageFile[]) => files.flatMap(fil
392
392
  export const pathOrder = (a: string, b: string) => a < b ? -1 : a > b ? 1 : 0
393
393
 
394
394
  // How a tar stream is read (readNpmTar): how far its symlinks may climb above
395
- // it, and the entries, files and bytes it may hold, a package's unless given.
396
- export interface TarReading { symlinksAbove?: number; maxEntries?: number; maxFiles?: number; maxBytes?: number }
395
+ // it, and the entries, files and bytes it may hold, a package's unless given;
396
+ // and whether two paths one on macOS or Windows conflict (`foldPaths`), as they do unless given.
397
+ export interface TarReading { symlinksAbove?: number; maxEntries?: number; maxFiles?: number; maxBytes?: number; foldPaths?: boolean }
397
398
 
398
399
  // The regular files of a tar stream, by package path, as npm and pnpm install
399
400
  // them (risk's npmTarLayout): each name as stored past its first component,
@@ -406,18 +407,19 @@ export interface TarReading { symlinksAbove?: number; maxEntries?: number; maxFi
406
407
  // or not an installer installs it, a hard link as its target's bytes, a
407
408
  // symlink for where it points. Where
408
409
  // the files conflict (two that differ at one path, as under two top
409
- // directories, a file within another), it is refused as `tarball-conflict`,
410
+ // directories, or at two paths one on macOS or Windows unless `foldPaths` is
411
+ // false, a file within another), it is refused as `tarball-conflict`,
410
412
  // never read as one installer does. Directories and devices hold no file
411
413
  // content and are skipped.
412
414
  export function readNpmTar(tar: Uint8Array, { symlinksAbove = NPM_SYMLINKS_ABOVE, maxEntries = MAX_NPM_TAR_ENTRIES, maxFiles = MAX_NPM_PACKAGE_FILES,
413
- maxBytes = MAX_NPM_PACKAGE_BYTES }: TarReading = {}): NpmPackageFile[] {
415
+ maxBytes = MAX_NPM_PACKAGE_BYTES, foldPaths = true }: TarReading = {}): NpmPackageFile[] {
414
416
  let entries: Entry[]
415
417
  try { entries = unpack(tar, { maxEntries, symlinksAbove }) }
416
418
  catch (err) {
417
419
  if (err instanceof ArchiveError) throw err.limited ? new NpmPackageError(413, 'package-too-large') : new NpmPackageError(422, 'bad-tarball')
418
420
  throw err
419
421
  }
420
- const files = npmTarLayout(entries, { maxFiles, maxBytes }, (code) => { throw new NpmPackageError(code === 'package-too-large' ? 413 : 422, code) })
422
+ const files = npmTarLayout(entries, { maxFiles, maxBytes, foldPaths }, (code) => { throw new NpmPackageError(code === 'package-too-large' ? 413 : 422, code) })
421
423
  return [...files].map(([path, file]) => ({ path, ...file })).toSorted((a, b) => pathOrder(a.path, b.path))
422
424
  }
423
425
 
@@ -22,8 +22,9 @@ export const MAX_REPOSITORY_CODE_FILES = 80_000
22
22
  export const MAX_REPOSITORY_CODE_BYTES = 256 * 1024 * 1024
23
23
  // The tarball they come in, bounded in proportion as a package's is: its tar
24
24
  // stream, headers and padding included, and its entries, as many again as
25
- // files, as GitHub's has one for each directory too.
26
- const REPOSITORY_TAR = { maxFiles: MAX_REPOSITORY_CODE_FILES, maxBytes: MAX_REPOSITORY_CODE_BYTES, maxEntries: 2 * MAX_REPOSITORY_CODE_FILES, maxTarBytes: 384 * 1024 * 1024 }
25
+ // files, as GitHub's has one for each directory too. Its paths are compared
26
+ // as git holds them, which may differ only in case.
27
+ const REPOSITORY_TAR = { maxFiles: MAX_REPOSITORY_CODE_FILES, maxBytes: MAX_REPOSITORY_CODE_BYTES, maxEntries: 2 * MAX_REPOSITORY_CODE_FILES, maxTarBytes: 384 * 1024 * 1024, foldPaths: false }
27
28
  // What the files may take as the viewer's JSON, written as one string: short
28
29
  // of the longest V8 holds (2^29 - 24 characters).
29
30
  const MAX_REPOSITORY_CODE_JSON_LENGTH = 384 * 1024 * 1024
@@ -12,10 +12,11 @@
12
12
  // instance's memory, and the source's `listings`, `actionFiles` and
13
13
  // `lockfiles` for SCAN_READ_KEPT_MS, so that only opening a repository and
14
14
  // checking access to it again ask GitHub where all else is kept.
15
+ import { createHash } from 'node:crypto'
15
16
  import type { LockfileFormat, RepoLockfile } from '@preventive/upstream/github.js'
16
17
  import type { AlertsRead } from './dependabot-access.ts'
17
18
  import type { DependabotAlert } from './dependabot-alerts.ts'
18
- import { type LockedPackage, isTestFixture, lockedPackages } from './locked-packages.ts'
19
+ import { type LockedPackage, isTestFixture, lockedPackages, yarnManifests } from './locked-packages.ts'
19
20
  import type { Lru } from './lru.ts'
20
21
  import type { KeptStore } from './npm-kept.ts'
21
22
  import { inTurns } from './queue.ts'
@@ -106,8 +107,9 @@ export interface RepositoryRead {
106
107
  recheck(): Promise<void>
107
108
  }
108
109
 
109
- // Whether a lockfile at `path` is of `paths` (RepositoryRiskRepo).
110
- function lockfileOf(path: string, paths: readonly string[] | undefined) {
110
+ // Whether a lockfile at `path` is of `paths` (RepositoryRiskRepo), as a
111
+ // stasis.config.json is.
112
+ export function lockfileOf(path: string, paths: readonly string[] | undefined) {
111
113
  const dir = path.slice(0, Math.max(path.lastIndexOf('/'), 0))
112
114
  return !paths || paths.some(scope => dir === '' || dir === scope || dir.startsWith(`${scope}/`) || scope.startsWith(`${dir}/`))
113
115
  }
@@ -127,19 +129,23 @@ async function keptRead<T>(memory: Lru<T>, store: KeptStore<T> | undefined, key:
127
129
  }
128
130
 
129
131
  // A lockfile's line, its packages or why they couldn't be had: as kept by its
130
- // blob, else read from GitHub and kept.
132
+ // blob, else read from GitHub and kept; with the `sha` it is kept by, a
133
+ // yarn.lock's with its package.json files' (yarnManifests), which alone say
134
+ // what only devDependencies need, and change while it may not.
131
135
  async function readLockfile({ source, caches }: RepositoryReading<RepositoryRiskRepo>, repo: number, opened: OpenedRepository,
132
- { path, format, sha }: ListedLockfile): Promise<LockfileLine> {
136
+ { path, format, sha }: ListedLockfile): Promise<{ sha: string; line: LockfileLine }> {
133
137
  const at = { type: 'lockfile', repo, path, format } as const
134
- if (!READ_FORMATS.has(format)) return { ...at, error: 'unsupported-format' }
138
+ if (!READ_FORMATS.has(format)) return { sha, line: { ...at, error: 'unsupported-format' } }
135
139
  try {
136
- return { ...at, ...await keptRead(caches.lockfiles, source.lockfiles, `${format}\0${sha}`, async (): Promise<LockfileRead> => {
140
+ const manifests = format === 'yarn' ? await yarnManifests(path, file => opened.file(file), opened.files) : null
141
+ const kept = manifests ? `${sha}+${createHash('sha256').update(JSON.stringify(manifests)).digest('hex').slice(0, 16)}` : sha
142
+ return { sha: kept, line: { ...at, ...await keptRead(caches.lockfiles, source.lockfiles, `${format}\0${kept}`, async (): Promise<LockfileRead> => {
137
143
  const text = await opened.file(path)
138
- try { return { packages: lockedPackages(format, text) } } catch (error) {
144
+ try { return { packages: lockedPackages(format, text, { manifests }) } } catch (error) {
139
145
  return { error: 'lockfile-unreadable', ...error instanceof Error ? { detail: error.message.slice(0, 500) } : {} }
140
146
  }
141
- }) }
142
- } catch (error) { return { ...at, ...failureOf(error) } }
147
+ }) } }
148
+ } catch (error) { return { sha, line: { ...at, ...failureOf(error) } } }
143
149
  }
144
150
 
145
151
  // A repository opened and its lockfiles of npm's ecosystem listed, as kept
@@ -226,9 +232,9 @@ export async function readRepository<R extends RepositoryRiskRepo>(reading: Repo
226
232
  const inTurn = inTurns(LOCKFILES_AT_ONCE)
227
233
  const lines = await Promise.all(listed.lockfiles.map(lockfile => inTurn(() => (reading.signal.aborted ? Promise.resolve(null) : readLockfile(reading, repo.repoId, opened, lockfile)))))
228
234
  const lockfiles: RepositoryRead['lockfiles'] = []
229
- for (const [at, line] of lines.entries()) {
230
- if (!line) return null
231
- if (!('error' in line && line.error === 'lockfile-unreadable' && isTestFixture(line.path))) lockfiles.push({ sha: listed.lockfiles[at]!.sha, line })
235
+ for (const read of lines) {
236
+ if (!read) return null
237
+ if (!('error' in read.line && read.line.error === 'lockfile-unreadable' && isTestFixture(read.line.path))) lockfiles.push(read)
232
238
  }
233
239
  const dependabot = await alerting
234
240
  const actions = await acting
@@ -28,7 +28,9 @@ export interface TeamAppSummaryStore {
28
28
  // How a summary is worked out (common/workspace-app.js, team-app.js), which a
29
29
  // deployment may change: one stored by another deployment, or before this
30
30
  // is raised, is worked out again.
31
- const SUMMARY_VERSION = 1
31
+ // 2: a report that opens as an App view on its own holds its team off it with
32
+ // none of its findings (common/managed/team-app.js).
33
+ const SUMMARY_VERSION = 2
32
34
  const DEPLOYMENT = process.env['VERCEL_DEPLOYMENT_ID'] ?? null
33
35
 
34
36
  export const teamAppSummaryKey = (key: string): string => createHash('sha256').update(JSON.stringify([SUMMARY_VERSION, DEPLOYMENT, key])).digest('base64url')
@@ -13,8 +13,10 @@
13
13
  // on their own, and its findings for the badge it collapses to. None is as
14
14
  // uniform as an App team, and collapses like one. A team mixing App and non-App
15
15
  // reports stays expanded, and so does one whose reports each open as App but
16
- // whose combined workspace does not (contradicting verdicts, say): it has App
17
- // findings, and only expanded does it show that they fail to combine.
16
+ // whose combined workspace does not (contradicting verdicts): it has App
17
+ // findings, and only expanded does it show that they fail to combine. A report
18
+ // that opens as App alone holds its team off with none of its findings
19
+ // (common/managed/team-app.js), so nothing else keeps such reports apart.
18
20
  import type { TeamAppMetadata } from '../common/managed/team-app.js'
19
21
  import type { BlobStore } from './blob-store.ts'
20
22
  import type { ManagedDb, TeamReportAccessSnapshot, UserTeam } from './db.ts'
@@ -20,9 +20,12 @@ import { MAX_REPORT_QUERY_BYTES, MAX_REPORT_QUERY_COUNT } from './report-query.t
20
20
  import { ourRepoSlugs } from '../common/finding-repo.js'
21
21
 
22
22
  type Finding = Record<string, unknown>
23
- // `confirmedDefault` where a manager switched the report to open on Confirmed
24
- // (common/finding-filters.js confirmedCoverage), left out otherwise.
25
- type TeamReport = { id: string; filename: string; data: unknown; repo: { github: string | null; directory: string }; confirmedDefault?: true }
23
+ // `confirmedDefault` where a manager switched the report to open on Confirmed,
24
+ // and `opensAsApp` where it opens as an App view on its own, so switched or by
25
+ // its rows (common/managed/team-app.js), which its team's view counts as
26
+ // holding it off Confirmed none of its findings (common/finding-filters.js
27
+ // confirmedCoverage); each left out otherwise.
28
+ type TeamReport = { id: string; filename: string; data: unknown; repo: { github: string | null; directory: string }; confirmedDefault?: true; opensAsApp?: true }
26
29
  type ReportVisibility = { ids: Set<string>; sourcePaths: Set<string> }
27
30
  type Visibility = Map<string, ReportVisibility>
28
31
  const VISIBILITY_CACHE_MAX_ITEMS = 250_000
@@ -214,6 +217,8 @@ async function buildTeamWorkspace(db: ManagedDb, store: BlobStore, snapshot: Tea
214
217
  // their detail, and in App mode its rows as the App view shows them
215
218
  // (common/managed/finding-detail.js).
216
219
  const view = managedTeamView(Object.assign(reports.map(({ filename, data, confirmedDefault }) => ({ filename, data, confirmedDefault })), { links }))
220
+ // As the reader's own grants leave each report, which they would open alone.
221
+ view.opensAsApp.forEach((opens, index) => { if (opens) reports[index]!.opensAsApp = true })
217
222
  const lite = liteWorkspace(reports, links, view)
218
223
  const restricted = snapshot.reports.some(report => !report.permissions.dependencies || !report.permissions.security)
219
224
  const encoded = {
@@ -1 +0,0 @@
1
- import{j as e}from"./chunk-QRKFPLA4.js";var t=new Set([`overview`,`graph`,`treemap`,`compare`,`advisories`,`issues`,`code`,`search`,`terminal`]),n=/^\d+$/u;function r(e){for(let t=0;t<e.length;t++){let n=e.codePointAt(t);if(n<32||n===127)return!0}return!1}var i=512;function a(e){return typeof e==`string`&&e.length>0&&e.length<=i&&!r(e)}function o(e){return a(e)&&!n.test(e)}function s(e){return e===`completed`||e===`not_planned`||e===`duplicate`?e:`unknown`}function c(e){let[t,n,r]=e.split(`/`);return r===void 0&&t!==void 0&&n!==void 0&&t.length<=39&&/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u.test(t)&&n.length<=100&&n!==`.`&&n!==`..`&&/^[a-zA-Z\d._-]+$/u.test(n)}function l(e,t){if(typeof e!=`string`||e.length>2048)return null;let n;try{n=new URL(e)}catch{return null}if(n.href!==e||n.origin!==`https://github.com`||n.username||n.password)return null;let r=t.exec(n.pathname);if(!r)return null;let i=`${r[1]}/${r[2]}`,a=Number(r[3]);return!c(i)||!Number.isSafeInteger(a)||a<=0?null:{repo:i,number:a}}function u(e){return l(e,/^\/([^/]+)\/([^/]+)\/pull\/(\d+)(?:\/(?:files|commits|checks))?\/?$/u)}function d(e){return l(e,/^\/([^/]+)\/([^/]+)\/issues\/(\d+)\/?$/u)}function f(e){let t=u(e);if(t)return{...t,kind:`pull`};let n=d(e);return n?{...n,kind:`issue`}:null}function p(e){return`${e.repo.toLowerCase()}#${e.kind}:${e.number}`}var m=/^(?=.{1,214}$)(?:@[\w.-]+\/[\w-]|[\dA-Za-z])[\w.-]*$/u,h=/^(?=.{1,256}$)[\dA-Za-z][\w.+-]*$/u,ee=/^@[\da-z~-][\w.~-]*$/u,g=/^[\da-f]{64}$/u;function _(e){return typeof e==`string`&&m.test(e)}function v(e){return typeof e==`string`&&h.test(e)}function y(e){return typeof e==`string`&&g.test(e)}function b(e){return typeof e==`string`&&e.length>0&&e.length<=1024&&!/[\p{Cc}\\]/u.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}function te(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase(),n=t.startsWith(`@`)?t:`@${t}`;return n.length<=214&&ee.test(n)?n:null}var x=Object.freeze({all:`all`,team:`team`,repo:`repository`}),S=(e,t)=>e===`team`?typeof t==`string`&&/^[A-Za-z0-9_-]+$/u.test(t):e===`repo`&&Number.isSafeInteger(t)&&t>0;function ne(e){let t=e.riskScope??`team`,n=e.riskTarget??null;return!Object.hasOwn(x,t)||n!=null&&!S(t,n)?null:`/manage/risk/${x[t]}${n==null?``:`/${n}`}`}function C(e){if(e===`/manage/risk/team`||e===`/manage/repositories/risk`)return{view:`manage-repo-risk`};if(!e.startsWith(`/manage/risk/`))return;let t=/^\/manage\/risk\/(?:(all)|(team)\/([A-Za-z0-9_-]+)|repository(?:\/([1-9]\d*))?)$/u.exec(e);if(!t)return null;if(t[1])return{view:`manage-repo-risk`,riskScope:`all`};let[n,r]=t[2]?[`team`,t[3]]:[`repo`,t[4]==null?null:Number(t[4])];return r!=null&&!S(n,r)?null:{view:`manage-repo-risk`,riskScope:n,...r==null?{}:{riskTarget:r}}}var w=[[`whitespace`,`hideWhitespace`],[`type-only`,`hideTypes`]],T=[[`on`,`indented`],[`folded`,`folded`]];function E(e){let t=w.filter(([,t])=>e[t]===!0).map(([e])=>e),n=T.find(([,t])=>t===e.pretty)?.[0];return[...t.length>0?[`hide=${t.join(`,`)}`]:[],...n?[`pretty=${n}`]:[]]}function D(e){let t=new Set(e.getAll(`hide`).flatMap(e=>e.split(`,`))),n=T.find(([t])=>t===e.get(`pretty`))?.[1];return{...Object.fromEntries(w.filter(([e])=>t.has(e)).map(([,e])=>[e,!0])),...n?{pretty:n}:{}}}var O=e=>typeof e==`string`&&e.length>0&&e.length<=256&&!/[\p{Cc}]/u.test(e);function re(t){let n=t.get(`repo`),r=new Set((t.get(`severity`)??``).split(`,`)),i=e.filter(e=>r.has(e)),a={...O(n)?{repo:n}:{},...i.length>0?{severities:i}:{}};return Object.keys(a).length>0?{filters:a}:{}}function ie(t){let n=e.filter(e=>t?.severities?.includes(e)),r=[...O(t?.repo)?[`repo=${encodeURIComponent(t.repo).replaceAll(`%2F`,`/`)}`]:[],...n.length>0?[`severity=${n.join(`,`)}`]:[]];return r.length>0?`?${r.join(`&`)}`:``}var k=new Set([`code`,`diff`]),A=e=>k.has(e)?`code`:`overview`,j=e=>k.has(e)?{compareMode:`code`}:{},M=e=>k.has(e)?`/code`:``,N=Object.freeze({manage:`/manage`,"manage-bundles":`/manage/bundle`,"manage-scans":`/manage/scans`,"manage-reports":`/manage/report`,"manage-repos":`/manage/repositories`,"manage-repo-risk":`/manage/risk`,"admin-users":`/manage/users`,"manage-teams":`/manage/team`,"manage-import":`/manage/import`,"manage-links":`/manage/links`,"manage-deduplication":`/manage/deduplication`,"manage-history":`/manage/history`}),P=new Set([`workspace-reports`,`workspace-bundles`,`workspace-repositories`,`workspace-dependencies`]),F=new Set([`pulls`,`versions`,`branch`,`reviews`]),I=e=>e.view===`workspace-dependencies`&&e.dependencyTab!=null?{dependencyTab:e.dependencyTab}:{};function L(e){if(!o(e)||e===`.`||e===`..`)return null;try{return`/finding/${encodeURIComponent(e)}`}catch{return null}}function ae(e){if(!e)return null;if(e.view===`home`)return`/`;if(e.view===`reviews`)return`/my/reviews`;if(e.view===`profile`)return`/my/profile`;if(e.view===`npm`)return B(e);if(e.view===`repository-code`)return se(e);if(P.has(e.view)){let t=I(e).dependencyTab??`pulls`;return!/^[A-Za-z0-9_-]+$/u.test(e.teamSlug??``)||!F.has(t)?null:`/team/${e.teamSlug}/${e.view.slice(10)}${t===`pulls`?``:`/${t}`}`}if(e.view===`bundles`){if(!/^[A-Za-z0-9_-]+$/u.test(e.bundleSlug??``)||[e.teamSlug,e.compareSlug].some(e=>e!=null&&!/^[A-Za-z0-9_-]+$/u.test(e)))return null;let n=e.bundleTab??`overview`;if(!t.has(n))return null;let r=e.teamSlug?`/team/${e.teamSlug}`:`/manage`,i=n===`code`&&Z(e.file)?`/${e.file}`:``,a=i&&Z(e.line)?`#L${e.line}${Z(e.endLine)&&e.endLine>e.line?`-L${e.endLine}`:``}`:``,o=n===`compare`&&e.compareSlug!=null?`/${e.compareSlug}${M(e.compareMode)}`:``;return`${r}/bundle/${e.bundleSlug}${n===`overview`?``:`/${n}`}${i}${o}${a}`}if(e.view===`manage-repo-risk`)return ne(e);if(Object.hasOwn(N,e.view)){let t=N[e.view];return e.view===`manage-deduplication`&&e.linkId?`${t}?report=${encodeURIComponent(e.linkId)}`:e.view===`manage-bundles`&&Number.isSafeInteger(e.createRepoId)&&e.createRepoId>0?`${t}?createRepo=${e.createRepoId}`:e.view===`manage-scans`&&e.scanMode===`link`?`${t}?mode=link`:e.view===`manage-scans`&&e.bundleId?`${t}?bundle=${encodeURIComponent(e.bundleId)}${e.scanMode===`dependencies`?`&mode=dependencies`:``}`:e.view===`manage-history`&&e.actor?`${t}?actor=${encodeURIComponent(e.actor)}`:t}if(![`findings`,`files`].includes(e.view)||!e.teamSlug||[e.teamSlug,e.reportSlug].some(e=>e!=null&&!/^[A-Za-z0-9_-]+$/u.test(e)))return null;let n=`/team/${encodeURIComponent(e.teamSlug)}`,r=e.reportSlug?`/report/${encodeURIComponent(e.reportSlug)}`:``;if(e.finding){let t=L(e.finding.id);return e.view===`findings`&&t?`${n}${r}${t}`:null}return e.view===`files`?`${n}${r}/files`:`${n}${r}${r?``:ie(e.filters)}`}var R=new Set([`overview`,`code`,`search`,`compare`,`review`,`treemap`]),z=e=>y(e?.hash)&&(e.repoId==null?e.commit==null&&e.path==null:(J(e.repoId)||typeof e.repoId==`string`&&c(e.repoId))&&q.test(e.commit??``)&&(e.path==null||b(e.path)));function B(e){if(e.packageName==null)return`/npm`;let t=e.bundleTab??`overview`;if(!_(e.packageName)||e.packageSpec!=null&&!v(e.packageSpec)||!R.has(t)||e.compareSpec!=null&&!v(e.compareSpec))return null;if(t===`review`){if(e.reviewPackage!=null&&!_(e.reviewPackage)||e.reviewSpec!=null&&!v(e.reviewSpec)||e.patch!=null&&!z(e.patch)||e.basePatch!=null&&(!y(e.basePatch)||e.reviewPackage==null))return null;let t=e.reviewPackage==null?``:`/${e.reviewPackage}${e.reviewSpec==null?``:`@${e.reviewSpec}`}`,{patch:n}=e,r=[...n==null?[]:[`patch=${n.hash}`],...n?.repoId==null?[]:[`repo=${n.repoId}&commit=${n.commit}`],...n?.path==null?[]:[`path=${n.path.split(`/`).map(encodeURIComponent).join(`/`)}`],...e.basePatch==null?[]:[`basePatch=${e.basePatch}`],...E(e)].join(`&`);return`/npm/${e.packageName}${e.packageSpec==null?``:`@${e.packageSpec}`}/review${t}${r?`?${r}`:``}`}let n=t===`code`&&Z(e.file)?`/${e.file}`:``,r=n&&Z(e.line)?`#L${e.line}${Z(e.endLine)&&e.endLine>e.line?`-L${e.endLine}`:``}`:``,i=t===`compare`&&e.compareSpec!=null?`/${e.compareSpec}${M(e.compareMode)}`:``;return`/npm/${e.packageName}${e.packageSpec==null?``:`@${e.packageSpec}`}${t===`overview`?``:`/${t}`}${n}${i}${r}`}function V(e,t,n){let r=/^\/npm\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?\/review(?:\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?)?$/u.exec(e);if(r){if(!_(r[1])||r[2]!=null&&!v(r[2])||r[3]!=null&&!_(r[3])||r[4]!=null&&!v(r[4]))return null;let e=r[3]&&/^\d+\.\d+\.\d+(?:[-+].*)?$/u.test(r[3])&&r[4]==null,t=[`repo`,`commit`,`path`].some(e=>n.has(e))?{repoId:/^[1-9]\d*$/u.test(n.get(`repo`)??``)?Number(n.get(`repo`)):n.get(`repo`),commit:n.get(`commit`)}:{},i=n.has(`patch`)?{hash:n.get(`patch`),...t,...n.has(`path`)?{path:n.get(`path`)}:{}}:null,a=n.get(`basePatch`);return i&&!z(i)||a!==null&&(!y(a)||!r[3])?null:{view:`npm`,packageName:r[1],packageSpec:r[2]??null,bundleTab:`review`,...r[3]?{reviewPackage:e?r[1]:r[3],reviewSpec:e?r[3]:r[4]??null}:{},...i?{patch:i}:{},...a?{basePatch:a}:{},...D(n)}}let i=/^\/npm(?:\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?(?:\/(code|search|compare|treemap)(?:\/([^/]+)(?:\/([a-z]+))?)?)?)?$/u.exec(e);if(!i)return;if(i[1]==null)return{view:`npm`};if(!_(i[1])||i[2]!=null&&!v(i[2]))return null;let a={view:`npm`,packageName:i[1],packageSpec:i[2]??null,bundleTab:i[3]??`overview`};if(i[4]==null)return a;if(a.bundleTab===`compare`)return v(i[4])&&(i[5]==null||k.has(i[5]))?{...a,compareSpec:i[4],...j(i[5])}:null;if(a.bundleTab!==`code`)return null;let o=Number(i[4]);return!i[5]&&/^[1-9]\d*$/u.test(i[4])&&Number.isSafeInteger(o)?{...a,file:o,...Q(t)}:null}var H=new Set([`code`,`search`,`treemap`,`compare`,`commits`,`issues`,`pulls`,`agents`,`pulse`,`replay`]),U=new Set([`commits`,`issues`,`pulls`,`agents`,`pulse`,`replay`]),W=new Map([[`issues`,new Set([`closed`])],[`pulls`,new Set([`closed`])],[`pulse`,new Set([`week`,`quarter`,`year`])],[`replay`,new Set([`100`,`1000`])]]),G=/^[a-z][a-z\d-]{0,31}$/u,K=(e,t)=>e===`agents`?typeof t==`string`&&G.test(t)&&t!==`all`:W.get(e)?.has(t)===!0,q=/^[a-f\d]{40}$/u,oe=500,J=e=>Number.isSafeInteger(e)&&e>0;function Y(e){return typeof e==`string`&&(e===``||e.length<=oe&&!/[\p{Cc}\\]/u.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e===e.trim()))}function se(e){let t=e.bundleTab??`code`,n=e.path??``;if(!J(e.repoId)||e.commit!=null&&!q.test(e.commit)||!Y(n)||!H.has(t)||e.compareCommit!=null&&!q.test(e.compareCommit))return null;let r=n?`?path=${n.split(`/`).map(encodeURIComponent).join(`/`)}`:``;if(e.commit==null)return`/repo/${e.repoId}${r}`;let i=t===`code`&&Z(e.file)?`/code/${e.file}`:t===`code`?``:`/${t}`,a=t===`compare`&&e.compareCommit!=null?`/${e.compareCommit}${M(e.compareMode)}`:``,o=K(t,e.subtab)?`/${e.subtab}`:``,s=t===`code`&&Z(e.file)&&Z(e.line)?`#L${e.line}${Z(e.endLine)&&e.endLine>e.line?`-L${e.endLine}`:``}`:``;return`/repo/${e.repoId}/${e.commit}${i}${a}${o}${r}${s}`}function X(e){let t=/^\/(?:repo|manage\/code)\/([1-9]\d*)(?:\/([a-f\d]{40})(?:\/(code|search|treemap|compare|commits|history|issues|pulls|agents|pulse|replay)(?:\/([^/]+)(?:\/([a-z]+))?)?)?)?$/u.exec(e.pathname.replace(/\/$/u,``));if(!t)return;let n=Number(t[1]),r=e.searchParams.get(`path`)??``,i=t[3]===`history`?`commits`:t[3]??`code`;if(!J(n)||!Y(r))return null;let a={view:`repository-code`,repoId:n,commit:t[2]??null,path:r,bundleTab:i};if(t[4]==null)return a;if(i===`compare`)return q.test(t[4])&&(t[5]==null||k.has(t[5]))?{...a,compareCommit:t[4],...j(t[5])}:null;if(U.has(i))return t[5]==null&&K(i,t[4])?{...a,subtab:t[4]}:null;let o=Number(t[4]);return i===`code`&&t[5]==null&&/^[1-9]\d*$/u.test(t[4])&&Number.isSafeInteger(o)?{...a,file:o,...Q(e.hash)}:null}function Z(e){return Number.isSafeInteger(e)&&e>0}function Q(e){let t=/^#L([1-9]\d*)(?:-L([1-9]\d*))?$/u.exec(e),[n,r]=t?[Number(t[1]),Number(t[2]??t[1])]:[];return!Z(n)||!Z(r)?{}:n===r?{line:n}:{line:Math.min(n,r),endLine:Math.max(n,r)}}function ce(e){let n=e.pathname.replace(/\/$/u,``)||`/`;if(n===`/`||n===`/index.html`)return{view:`home`};if(n===`/my/reviews`)return{view:`reviews`};if(n===`/my/profile`){let t=e.searchParams.get(`link-error`);return{view:`profile`,...t&&/^[a-z-]{1,64}$/u.test(t)?{linkError:t}:{}}}let r=Object.keys(N).find(e=>N[e]===n);if(r){let t=Number(e.searchParams.get(`createRepo`));return{view:r,...r===`manage-deduplication`&&e.searchParams.get(`report`)?{linkId:e.searchParams.get(`report`)}:{},...r===`manage-bundles`&&Number.isSafeInteger(t)&&t>0?{createRepoId:t}:{},...r===`manage-history`&&e.searchParams.get(`actor`)?{actor:e.searchParams.get(`actor`)}:{},...r===`manage-scans`?e.searchParams.get(`mode`)===`link`?{scanMode:`link`}:e.searchParams.get(`bundle`)?{bundleId:e.searchParams.get(`bundle`),...e.searchParams.get(`mode`)===`dependencies`?{scanMode:`dependencies`}:{}}:{}:{}}}let a=/^(?:\/team\/([A-Za-z0-9_-]+)|\/manage)\/bundle\/([A-Za-z0-9_-]+)(?:\/([a-z]+)(?:\/([A-Za-z0-9_-]+)(?:\/([a-z]+))?)?)?$/u.exec(n);if(a){let n=a[3]??`overview`;if(!t.has(n))return null;let r={view:`bundles`,teamSlug:a[1]??null,bundleSlug:a[2],bundleTab:n};if(a[4]==null)return r;if(n===`compare`)return a[5]==null||k.has(a[5])?{...r,compareSlug:a[4],...j(a[5])}:null;let i=Number(a[4]);return n!==`code`||a[5]||!/^[1-9]\d*$/u.test(a[4])||!Number.isSafeInteger(i)?null:{...r,file:i,...Q(e.hash)}}let o=V(n,e.hash,e.searchParams);if(o!==void 0)return o;let s=X(e);if(s!==void 0)return s;let c=/^\/team\/([A-Za-z0-9_-]+)\/(reports|bundles|repositories|dependencies)$/u.exec(n);if(c)return{view:`workspace-${c[2]}`,teamSlug:c[1]};let l=/^\/team\/([A-Za-z0-9_-]+)\/dependencies\/([a-z]+)$/u.exec(n);if(l)return F.has(l[2])?{view:`workspace-dependencies`,teamSlug:l[1],dependencyTab:l[2]}:null;let u=/^\/team\/([^/]+)(?:\/report\/([^/]+))?(?:\/(files)|\/finding\/([^/]+))?$/u.exec(n);if(!u)return C(n)??null;try{let t=decodeURIComponent(u[1]),n=u[2]?decodeURIComponent(u[2]):null;if([t,n].some(e=>e!=null&&!/^[A-Za-z0-9_-]+$/u.test(e))||u[4]?.length>i*9)return null;let r=u[4]?decodeURIComponent(u[4]):null;return r!=null&&!L(r)?null:u[3]?{view:`files`,teamSlug:t,reportSlug:n}:r==null?{view:`findings`,teamSlug:t,reportSlug:n,...n==null?re(e.searchParams):{}}:{view:`findings`,teamSlug:t,reportSlug:n,finding:{id:r}}}catch{return null}}function $(e,t,n=[]){if(P.has(e.view)){let n=t.filter(t=>t.slug===e.teamSlug);return n.length===1?{view:e.view,teamId:n[0].id,...I(e)}:null}if(e.view===`bundles`){let{teamSlug:r,bundleSlug:i,compareSlug:a,compareMode:o,...s}=e,c=r==null?[]:t.filter(e=>e.slug===r);if(r!=null&&c.length!==1)return null;let l=c[0],u=r==null?n:t.flatMap(e=>e.bundles??[]),d=e=>new Set(u.filter(t=>t.slug===e).map(e=>e.id)),f=d(i),p=(l?.bundles??n).find(e=>e.slug===i);if(!i||!p||f.size!==1)return null;let m=a==null?null:d(a),h=m?.size===1?{compareId:[...m][0],...j(o)}:{};return{...s,teamId:l?.id??null,bundleId:p.id,...h}}if(![`findings`,`files`].includes(e.view))return e;let{teamSlug:r,reportSlug:i,...a}=e,o=t.filter(e=>e.slug===r),s=r&&o.length===1?o[0]:null,c=new Set(t.flatMap(e=>e.reports??[]).filter(e=>e.slug===i).map(e=>e.id)),l=i!=null&&c.size===1?[...c][0]:null;return a.finding?{...a,teamId:s?.id??null,reportId:l,teamOnly:i==null}:s?i==null?{...a,teamId:s.id,reportId:null}:(s.reports??[]).some(e=>e.id===l)?{...a,teamId:s.id,reportId:l}:null:null}function le(e,t,n=[]){if(P.has(e.view)){let n=t.find(t=>t.id===e.teamId),r={view:e.view,teamSlug:n?.slug,...I(e)};return n?.slug&&$(r,t)?r:null}if(e.view===`bundles`){let{teamId:r,bundleId:i,compareId:a,compareMode:o,...s}=e,c=t.find(e=>e.id===r);if(r!=null&&!c?.slug)return null;let l=(c?.bundles??n).find(e=>e.id===i);if(!l?.slug)return null;let u=a==null?null:(r==null?n:t.flatMap(e=>e.bundles??[])).find(e=>e.id===a),d={...s,teamSlug:c?.slug??null,bundleSlug:l.slug,...u?.slug?{compareSlug:u.slug,...j(o)}:{}},f=$(d,t,n);if(!f)return null;if(d.compareSlug!=null&&f.compareId!==a){let{compareSlug:e,compareMode:t,...n}=d;return n}return d}if(![`findings`,`files`].includes(e.view))return e;let{teamId:r,reportId:i,...a}=e,o=t.find(e=>e.id===r),s=i==null?null:o?.reports?.find(e=>e.id===i);if(!o?.slug||i!=null&&!s?.slug)return null;let c={...a,teamSlug:o.slug,reportSlug:s?.slug??null},l=$(c,t);return l?.teamId===o.id&&l.reportId===(s?.id??null)?c:null}export{t as a,i as b,o as c,s as d,u as e,d as f,f as g,p as h,_ as i,v as j,y as k,b as l,te as m,A as n,j as o,N as p,F as q,ae as r,R as s,H as t,U as u,K as v,ce as w,$ as x,le as y};
@@ -1,10 +0,0 @@
1
- import{a as e,b as t,c as n}from"./chunk-C4Z6ZBXV.js";import{f as r,g as i}from"./chunk-2XUEZHIP.js";var a=class extends n{constructor(t){if(super(t),this.it=i,t.type!==e.CHILD)throw Error(this.constructor.directiveName+`() can only be used in child bindings`)}render(e){if(e===i||e==null)return this._t=void 0,this.it=e;if(e===r)return e;if(typeof e!=`string`)throw Error(this.constructor.directiveName+`() called with a non-string value`);if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};a.directiveName=`unsafeHTML`,a.resultType=1;var o=t(a),s=/^/u,c=/^true$/u,l=/^[\w .,#%()-]*$/u,u=Object.fromEntries([`fill`,`fill-opacity`,`fill-rule`,`clip-rule`,`stroke`,`stroke-width`,`stroke-linecap`,`stroke-linejoin`,`stroke-opacity`,`stroke-dasharray`,`opacity`,`transform`].map(e=>[e,l])),d=(...e)=>({...u,...Object.fromEntries(e.map(e=>[e,l]))}),f=new Set;function p(e){for(let t of e)f.add(t)}var m=e=>{let[t,...n]=e.split(` `);return t===`token`&&n.every(e=>f.has(e)||/^language-[\w-]+$/u.test(e))},h={__proto__:null,span:{class:{test:e=>m(e)||/^(?:code-control|evd-lineno|report-logo brand-[\w-]+)$/u.test(e)},title:s,"data-tooltip":s,"aria-hidden":c},mark:{class:/^diff-word$/u},code:{class:/^evd-line$/u},button:{type:/^button$/u,class:/^bundle-source-link$/u,"data-bundle-source-link":s},a:{class:/^source-node-doc$/u,href:/^https:\/\/nodejs\.org\/api\/[\w/-]+\.html(?:#[\w-]*)?$/u,target:/^_blank$/u,rel:/^noopener noreferrer$/u,"aria-label":s},svg:{...d(`viewBox`,`width`,`height`),class:/^file-icon(?: brand-[\w-]+)?$/u,"aria-hidden":c},g:u,path:{...d(`d`),class:/^(?:bg|fg)$/u},rect:d(`x`,`y`,`width`,`height`,`rx`,`ry`),circle:d(`cx`,`cy`,`r`),ellipse:d(`cx`,`cy`,`rx`,`ry`),line:d(`x1`,`y1`,`x2`,`y2`),polyline:d(`points`),polygon:d(`points`)},g=/<(?:([a-z]+)((?:[\t\n\f\r ]+[a-zA-Z][\w-]*="[^"]*")*)[\t\n\f\r ]*\/?|\/([a-z]+)[\t\n\f\r ]*)>/uy,_=/([a-zA-Z][\w-]*)="([^"]*)"/gu;function v(e){if(typeof e!=`string`)return!1;for(let t=e.indexOf(`<`);t!==-1;t=e.indexOf(`<`,g.lastIndex)){g.lastIndex=t;let[,n,r,i]=g.exec(e)??[],a=h[n??i];if(!a)return!1;for(let[,e,t]of r?.matchAll(_)??[])if(!Object.hasOwn(a,e)||!a[e].test(t))return!1}return!0}function y(e){return console.error(`Not markup this app writes, shown as text instead:`,e.length>300?`${e.slice(0,300)}\u2026`:e),e}var b=new Set;function x(e){return e==null||e===i?e:b.has(e)?o(e):v(e)?(b.size>=256&&b.clear(),b.add(e),o(e)):y(String(e))}var S=`m5.875 10.154 1.376-.772.023-.067-.023-.037h-.067l-.23-.015-.787-.02-.681-.03-.661-.035-.166-.035-.156-.205.016-.103.14-.094.2.018.442.03.665.046.481.028.714.075h.113l.016-.047-.039-.028-.03-.028-.687-.466-.744-.492-.39-.284-.21-.143-.106-.135-.046-.294.19-.21.258.017.065.018.26.2.557.43.726.535.106.089.042-.03.006-.022-.048-.08-.395-.713-.422-.726-.187-.301-.05-.18a1 1 0 0 1-.03-.213l.218-.296.12-.039.29.039.123.106.18.413.293.65.453.884.133.262.07.242.027.075h.046v-.043l.038-.497.069-.611.067-.787.023-.221.11-.266.218-.143.17.081.14.2-.02.13-.083.54-.163.846-.106.567h.062l.07-.07.287-.382.482-.602.213-.239.248-.264.159-.125h.301l.221.329-.099.34-.31.393-.256.333-.369.496-.23.397.021.032.055-.006.832-.177.45-.081.537-.092.243.113.026.115-.096.236-.573.141-.673.135-1.003.237-.012.01.014.017.452.042.193.01h.473l.88.066.23.153.138.186-.023.141-.354.181-.478-.113-1.116-.266-.383-.096h-.053v.032l.32.312.584.528.731.68.037.168-.094.133-.099-.014-.643-.484-.248-.218-.561-.472H9.08v.05l.129.189.684 1.027.035.315-.05.103-.177.062-.194-.036-.4-.561-.413-.632-.333-.567-.041.023-.197 2.116-.092.108-.212.082-.177-.135-.094-.218.094-.43.113-.561.092-.447.083-.554.05-.184-.004-.013-.04.006-.418.574-.636.858-.503.539-.12.048-.21-.108.02-.193.117-.172.696-.886.42-.549.27-.317-.001-.046h-.016l-1.85 1.201-.328.042-.142-.132.018-.218.067-.071.556-.383Z`,C=`M11.04 8.364a1.72 1.72 0 0 0-.152-1.432 1.8 1.8 0 0 0-1.925-.846 1.8 1.8 0 0 0-.778-.498 1.8 1.8 0 0 0-.927-.05 1.8 1.8 0 0 0-.827.414 1.77 1.77 0 0 0-.507.767 1.8 1.8 0 0 0-.683.297 1.75 1.75 0 0 0-.499.549 1.75 1.75 0 0 0 .22 2.07 1.72 1.72 0 0 0 .151 1.432 1.8 1.8 0 0 0 1.926.846 1.77 1.77 0 0 0 1.333.587c.78 0 1.47-.496 1.707-1.227a1.8 1.8 0 0 0 .684-.298 1.75 1.75 0 0 0 .499-.548 1.75 1.75 0 0 0-.222-2.063m-2.667 3.678a1.33 1.33 0 0 1-.851-.304l.042-.024 1.413-.804a.23.23 0 0 0 .116-.199V8.747l.597.34q.01.005.011.015v1.629a1.323 1.323 0 0 1-1.328 1.31m-2.857-1.203a1.3 1.3 0 0 1-.158-.879l.042.025 1.414.805a.23.23 0 0 0 .23 0l1.729-.982v.68a.02.02 0 0 1-.01.018l-1.431.814a1.34 1.34 0 0 1-1.816-.48m-.372-3.037a1.32 1.32 0 0 1 .7-.574v1.656a.22.22 0 0 0 .114.197l1.72.979-.598.34a.02.02 0 0 1-.021 0L5.63 9.587a1.304 1.304 0 0 1-.487-1.791zm4.907 1.125L8.327 7.94l.596-.34a.02.02 0 0 1 .02 0l1.43.814a1.3 1.3 0 0 1 .512.528 1.3 1.3 0 0 1-.118 1.4 1.33 1.33 0 0 1-.595.436V9.122a.23.23 0 0 0-.12-.195m.594-.881-.042-.025-1.411-.812a.23.23 0 0 0-.232 0l-1.727.983v-.68a.02.02 0 0 1 .008-.018l1.429-.813a1.34 1.34 0 0 1 1.425.061 1.3 1.3 0 0 1 .55 1.298zM6.908 9.252l-.597-.34a.02.02 0 0 1-.012-.016V7.271c0-.249.073-.493.209-.703s.329-.378.557-.483a1.35 1.35 0 0 1 1.415.18l-.042.023-1.413.804a.23.23 0 0 0-.116.2zm.324-.69.77-.438.77.438v.875l-.768.437-.77-.437z`,w=`M23.922 16.997C23.061 18.492 18.063 22.02 12 22.02 5.937 22.02.939 18.492.078 16.997A.641.641 0 0 1 0 16.741v-2.869a.883.883 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.098 10.098 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952C7.255 2.937 9.248 1.98 11.978 1.98c2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.841.841 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256Zm-11.75-5.992h-.344a4.359 4.359 0 0 1-.355.508c-.77.947-1.918 1.492-3.508 1.492-1.725 0-2.989-.359-3.782-1.259a2.137 2.137 0 0 1-.085-.104L4 11.746v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.359 4.359 0 0 1-.355-.508Zm2.328 3.25c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm-5 0c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm3.313-6.185c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z`,T=`M11.998 24c-.321 0-.641-.084-.922-.247l-2.936-1.737c-.438-.245-.224-.332-.08-.383c.585-.203.703-.25 1.328-.604c.065-.037.151-.023.218.017l2.256 1.339c.082.045.197.045.272 0l8.795-5.076c.082-.047.134-.141.134-.238V6.921c0-.099-.053-.192-.137-.242l-8.791-5.072c-.081-.047-.189-.047-.271 0L3.075 6.68C2.99 6.729 2.936 6.825 2.936 6.921v10.15c0 .097.054.189.139.235l2.409 1.392c1.307.654 2.108-.116 2.108-.89V7.787c0-.142.114-.253.256-.253h1.115c.139 0 .255.112.255.253v10.021c0 1.745-.95 2.745-2.604 2.745c-.508 0-.909 0-2.026-.551L2.28 18.675c-.57-.329-.922-.945-.922-1.604V6.921c0-.659.353-1.275.922-1.603l8.795-5.082c.557-.315 1.296-.315 1.848 0l8.794 5.082c.57.329.924.944.924 1.603v10.15c0 .659-.354 1.273-.924 1.604l-8.794 5.078C12.643 23.916 12.324 24 11.998 24zM19.099 13.993c0-1.9-1.284-2.406-3.987-2.763c-2.731-.361-3.009-.548-3.009-1.187c0-.528.235-1.233 2.258-1.233c1.807 0 2.473.389 2.747 1.607c.024.115.129.199.247.199h1.141c.071 0 .138-.031.186-.081c.048-.054.074-.123.067-.196c-.177-2.098-1.571-3.076-4.388-3.076c-2.508 0-4.004 1.058-4.004 2.833c0 1.925 1.488 2.457 3.895 2.695c2.88.282 3.103.703 3.103 1.269c0 .983-.789 1.402-2.642 1.402c-2.327 0-2.839-.584-3.011-1.742c-.02-.124-.126-.215-.253-.215h-1.137c-.141 0-.254.112-.254.253c0 1.482.806 3.248 4.655 3.248C17.501 17.007 19.099 15.91 19.099 13.993z`,E=`<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2 2 5v6l6 3 6-3V5L8 2Z"/><path d="M2 5l6 3 6-3"/><path d="M8 8v6"/></svg>`,D=`<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M1 1h14v14H1Zm3 3v8h4V6h2v6h2V4Z"/></svg>`,O=`<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="4" width="11" height="9" rx="1.2"/><path d="M6 4V3h4v1"/></svg>`,k=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" aria-hidden="true"><path d="m4.5 4.5 7 2-5 5z"/><circle cx="4.5" cy="4.5" r="2" fill="currentColor"/><circle cx="11.5" cy="6.5" r="2" fill="currentColor"/><circle cx="6.5" cy="11.5" r="2" fill="currentColor"/></svg>`,A=`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1" y="1.5" width="14" height="3" rx=".5"/><rect x="1" y="6.5" width="8" height="3" rx=".5"/><rect x="11" y="6.5" width="4" height="3" rx=".5"/><rect x="1" y="11.5" width="4" height="3" rx=".5"/><rect x="7" y="11.5" width="8" height="3" rx=".5"/></svg>`,j=`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M1 1h4v4H1zm5 5h4v4H6zm5 5h4v4h-4z"/><path d="M6 1h4v4H6zm5 0h4v4h-4zM1 6h4v4H1zm10 0h4v4h-4zM1 11h4v4H1zm5 0h4v4H6z" opacity=".35"/></svg>`,M=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round" aria-hidden="true"><rect x="1" y="1" width="14" height="2.5" rx=".5" fill="currentColor" stroke="none"/><rect x="1" y="12" width="3.5" height="3" rx=".5" fill="currentColor" stroke="none"/><rect x="6.25" y="12" width="3.5" height="3" rx=".5" fill="currentColor" stroke="none"/><rect x="11.5" y="12" width="3.5" height="3" rx=".5" fill="currentColor" stroke="none"/><path d="M4 3.5c0 4.5-1.25 4-1.25 8.5M8 3.5v8.5M12 3.5c0 4.5 1.25 4 1.25 8.5"/></svg>`,N=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="2.5" r="1.5" fill="currentColor"/><circle cx="3" cy="13" r="1.5" fill="currentColor"/><circle cx="8" cy="13" r="1.5" fill="currentColor"/><circle cx="13" cy="13" r="1.5" fill="currentColor"/><path d="M8 4v3M8 7H3m5 0h5M3 7v4M8 7v4M13 7v4"/></svg>`,P=`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>`,F=`<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6.67 8.67a3.33 3.33 0 0 0 5.03.36l2-2a3.33 3.33 0 0 0-4.71-4.71l-1.15 1.14"/><path d="M9.33 7.33a3.33 3.33 0 0 0-5.03-.36l-2 2a3.33 3.33 0 0 0 4.71 4.71l1.14-1.14"/></svg>`,I=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 1.5H2.5a1 1 0 0 0-1 1V5m9.5-3.5h2.5a1 1 0 0 1 1 1V5M1.5 11v2.5a1 1 0 0 0 1 1H5m6 0h2.5a1 1 0 0 0 1-1V11"/><circle cx="7.25" cy="7.25" r="2.75"/><path d="m9.25 9.25 2.25 2.25"/></svg>`,L=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 1.5H4a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V5.5L9 1.5ZM9 1.5v4h4M5.5 8h5m-5 3h3.5"/></svg>`,R=`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20V2H6.5A2.5 2.5 0 0 0 4 4.5zM4 19.5A2.5 2.5 0 0 0 6.5 22H20v-5"/></svg>`,z=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m4.5 4.5-3 3.5 3 3.5m7-7 3 3.5-3 3.5M9.5 2l-3 12"/></svg>`,B=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6.5 3.5 1.6 3.9L12 9l-3.9 1.6-1.6 3.9-1.6-3.9L1 9l3.9-1.6 1.6-3.9ZM12 1.5v4m-2-2h4"/></svg>`,V=`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/></svg>`,H=`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 1.5v2"/><rect x="2" y="3.5" width="12" height="10" rx="2.5"/><path d="M6 7.5v2m4-2v2"/></svg>`,U=`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" aria-hidden="true"><path d="M1 8h3.5m7 0H15"/><circle cx="8" cy="8" r="3.5"/></svg>`,W=`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="4" cy="3.5" r="1.5"/><circle cx="4" cy="12.5" r="1.5"/><circle cx="12" cy="12.5" r="1.5"/><path d="M4 5v6M12 11V6a2 2 0 0 0-2-2H7m1.5-1.5L7 4l1.5 1.5"/></svg>`,G=`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round" aria-hidden="true"><path d="M2 2h5.5l6.5 6.5-5.5 5.5L2 7.5Z"/><circle cx="5" cy="5" r="1"/></svg>`,K=`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m10 2 4 4-8 8H2v-4l8-8Zm-1 1 4 4"/></svg>`,q=`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 4h12M6 4V2h4v2M4 4l.6 10h6.8L12 4M6.5 7v4m3-4v4"/></svg>`;export{p as a,v as b,y as c,x as d,S as e,C as f,w as g,T as h,E as i,D as j,O as k,k as l,A as m,j as n,M as o,N as p,P as q,F as r,I as s,L as t,R as u,z as v,B as w,V as x,H as y,U as z,W as A,G as B,K as C,q as D};
2
- /*! Bundled license information:
3
-
4
- lit-html/directives/unsafe-html.js:
5
- (**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- *)
10
- */