@preventive/triage 1.0.0-alpha.5 → 1.0.0-alpha.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-APACHE +202 -0
- package/README.md +16 -0
- package/api/reap.ts +17 -0
- package/cli.js +6 -0
- package/client/dependency-paths.d.ts +3 -0
- package/client/dependency-paths.js +36 -0
- package/client/finding-link.js +305 -0
- package/client/linked-findings.d.ts +1 -0
- package/client/linked-findings.js +115 -0
- package/common/bundle-commit.d.ts +1 -0
- package/common/bundle-commit.js +4 -0
- package/common/bundle-compare-diff.d.ts +3 -0
- package/common/bundle-compare-diff.js +357 -0
- package/common/bundle-compare-inputs.d.ts +2 -0
- package/common/bundle-compare-inputs.js +65 -0
- package/common/bundle-compare-versions.js +172 -0
- package/common/bundle-comparison.d.ts +8 -0
- package/common/bundle-comparison.js +62 -0
- package/common/bundle-metadata.d.ts +15 -0
- package/common/bundle-metadata.js +226 -0
- package/common/bundle-pkg-of.d.ts +1 -0
- package/common/bundle-pkg-of.js +90 -0
- package/common/bundle-reasons.d.ts +2 -0
- package/common/bundle-reasons.js +21 -0
- package/common/bundle-source-links.d.ts +6 -0
- package/common/bundle-source-links.js +216 -0
- package/common/bundle-sourcemap.d.ts +10 -0
- package/common/bundle-sourcemap.js +100 -0
- package/common/bundle-sources.d.ts +7 -0
- package/common/bundle-sources.js +333 -0
- package/common/bundle-stats.js +41 -0
- package/common/bundle-tabs.js +1 -0
- package/common/code-language.js +65 -0
- package/common/default-scan-models.ts +31 -0
- package/common/dependency-reviews.d.ts +18 -0
- package/common/dependency-reviews.js +64 -0
- package/common/finding-duplicates.js +58 -0
- package/common/finding-filters.js +274 -0
- package/common/finding-id.js +47 -0
- package/common/github-issue-labels.d.ts +1 -0
- package/common/github-issue-labels.js +11 -0
- package/common/github-pr.ts +56 -0
- package/common/gzip.js +59 -0
- package/common/line-diff.d.ts +8 -0
- package/common/line-diff.js +57 -0
- package/common/linked-workspace-groups.js +63 -0
- package/common/managed/agent-tasks.ts +292 -0
- package/common/managed/comments.ts +34 -0
- package/common/managed/finding-detail.d.ts +2 -0
- package/common/managed/finding-detail.js +32 -0
- package/common/managed/github-agents.ts +114 -0
- package/common/managed/github-logins.ts +49 -0
- package/common/managed/npm-packages.d.ts +5 -0
- package/common/managed/npm-packages.js +34 -0
- package/common/managed/permissions.ts +31 -0
- package/common/managed/report-content.ts +72 -0
- package/common/managed/report-filter.ts +109 -0
- package/common/managed/repository-alias.ts +65 -0
- package/common/managed/roles.ts +35 -0
- package/common/managed/routes.d.ts +2 -0
- package/common/managed/routes.js +347 -0
- package/common/managed/scan-models.ts +6 -0
- package/common/managed/team-app.d.ts +5 -0
- package/common/managed/team-app.js +31 -0
- package/common/managed/triage.ts +83 -0
- package/common/managed/upload-seal.ts +126 -0
- package/common/pretty-print.d.ts +5 -0
- package/common/pretty-print.js +24 -0
- package/common/revalidation-conflicts.js +48 -0
- package/common/revalidation-input-groups.js +56 -0
- package/common/save-error-reason.ts +20 -7
- package/common/scan-server.ts +13 -0
- package/common/security-links.d.ts +5 -0
- package/common/security-links.js +33 -0
- package/common/server-info.ts +46 -0
- package/common/utf8.d.ts +3 -0
- package/common/utf8.js +45 -0
- package/common/workspace-app.js +39 -0
- package/common/workspace-groups.js +176 -0
- package/out/activity.js +4 -0
- package/out/brotli-fallback.js +3 -3
- package/out/chunk-2WDZPXVL.js +3 -0
- package/out/chunk-2XUEZHIP.js +28 -0
- package/out/chunk-2ZDZWLFY.js +1 -0
- package/out/chunk-4HI2MSAV.js +17 -0
- package/out/chunk-4XMP7YVH.js +36 -0
- package/out/chunk-6LNQTKAV.js +52 -0
- package/out/chunk-6S2U2UYG.js +232 -0
- package/out/chunk-75YLHBCM.js +3 -0
- package/out/chunk-7BKKYVWR.js +7 -0
- package/out/chunk-7C7DWL7I.js +1 -0
- package/out/chunk-7VAWINQF.js +6 -0
- package/out/chunk-C4Z6ZBXV.js +10 -0
- package/out/chunk-FC65TPUB.js +1 -0
- package/out/chunk-FKBXNUW4.js +1 -0
- package/out/chunk-GDPCLSOS.js +2 -0
- package/out/chunk-GO7FT4OD.js +1 -0
- package/out/chunk-HTBYHSPG.js +1 -0
- package/out/chunk-IYPY47MC.js +1 -0
- package/out/chunk-IZ7POWI3.js +18 -0
- package/out/chunk-JCIIBLKR.js +1 -0
- package/out/chunk-NRPC74AM.js +1 -0
- package/out/chunk-OOJM4CTU.js +1 -0
- package/out/chunk-PBZPYIG7.js +1 -0
- package/out/chunk-PNHBZGDD.js +1 -0
- package/out/chunk-PWFUOLZK.js +17 -0
- package/out/chunk-PXK7EU4V.js +1 -0
- package/out/chunk-QB4CBOX2.js +1 -0
- package/out/chunk-R3NZFXVR.js +1 -0
- package/out/chunk-R5O6FAW4.js +2 -0
- package/out/chunk-SXV2T5C4.js +80 -0
- package/out/chunk-TQJDYHVE.js +2 -0
- package/out/chunk-TUII34K2.js +1 -0
- package/out/chunk-UK7RGJT6.js +3 -0
- package/out/chunk-VFWMQ3LG.js +2 -0
- package/out/chunk-VH4XMZIW.js +2 -0
- package/out/chunk-WCPJDAYA.js +10 -0
- package/out/chunk-WFYLMF6Z.js +10 -0
- package/out/chunk-WYLQWYLA.js +1 -0
- package/out/client-managed-import.js +4 -0
- package/out/client-managed.js +33 -0
- package/out/client-sync.js +11 -17
- package/out/compare.js +35 -0
- package/out/dialogs.js +55 -0
- package/out/github-issue-authorized.html +3 -0
- package/out/github-issue-authorized.js +1 -0
- package/out/graph.js +17 -4
- package/out/index.html +90 -8
- package/out/prism.js +14 -10
- package/out/scan.js +2 -0
- package/out/stasis.svg +20 -0
- package/out/terminal.js +366 -39
- package/out/view.css +1 -1
- package/out/view.js +19 -144
- package/package.json +362 -59
- package/risk/actions/findings.js +161 -0
- package/risk/actions/resolve.js +219 -0
- package/risk/actions/scripts/commands.js +182 -0
- package/risk/actions/scripts/grade.js +113 -0
- package/risk/actions/scripts/packages.js +123 -0
- package/risk/actions/scripts/shell.js +169 -0
- package/risk/actions/uses.js +76 -0
- package/risk/actions/workflow.js +110 -0
- package/risk/files/characters.js +196 -0
- package/risk/files/hosts.js +205 -0
- package/risk/files/readability.js +177 -0
- package/risk/files/runs-code.js +615 -0
- package/risk/files/script.js +118 -0
- package/risk/files/stamps.js +47 -0
- package/risk/index.d.ts +254 -0
- package/risk/index.js +11 -0
- package/risk/npm/assess.js +285 -0
- package/risk/npm/combined.js +68 -0
- package/risk/npm/compare.js +257 -0
- package/risk/npm/dependencies.js +172 -0
- package/risk/npm/diff.js +79 -0
- package/risk/npm/downloads.js +84 -0
- package/risk/npm/files.js +445 -0
- package/risk/npm/held.js +63 -0
- package/risk/npm/install-scripts.js +34 -0
- package/risk/npm/malware.js +36 -0
- package/risk/npm/manifest.js +65 -0
- package/risk/npm/new-dependency.js +60 -0
- package/risk/npm/old-version.js +108 -0
- package/risk/npm/registry.js +388 -0
- package/risk/npm/release.js +85 -0
- package/risk/npm/score.js +59 -0
- package/risk/npm/specs.js +124 -0
- package/risk/npm/tarball.js +96 -0
- package/server-common/database-config.ts +16 -0
- package/server-common/initialize.ts +18 -0
- package/server-common/npm-advisories.ts +101 -0
- package/{server → server-common}/origin.ts +5 -5
- package/server-common/reap.ts +48 -0
- package/server-common/scan-config.ts +19 -0
- package/server-common/standalone.ts +29 -0
- package/server-common/storage-crypto.ts +182 -0
- package/server-common/storage-log.ts +38 -0
- package/server-common/vercel-blob.ts +103 -0
- package/server-e2e/app.ts +487 -0
- package/{server → server-e2e}/bus-receiver.ts +2 -1
- package/{server → server-e2e}/cli.js +9 -4
- package/{server → server-e2e}/config.ts +50 -42
- package/{server → server-e2e}/db-neon.ts +2 -2
- package/{server → server-e2e}/db-revision-sql.ts +1 -1
- package/{server → server-e2e}/db-stmt.ts +2 -2
- package/{server → server-e2e}/db.ts +7 -7
- package/{server → server-e2e}/http.ts +44 -13
- package/{server → server-e2e}/hub.ts +40 -9
- package/server-e2e/index.ts +17 -0
- package/server-e2e/lifecycle.ts +95 -0
- package/{server → server-e2e}/neon-driver.ts +2 -2
- package/{server → server-e2e}/npm-proxy.ts +12 -145
- package/{server → server-e2e}/objstore/blob-vercel.ts +10 -114
- package/{server → server-e2e}/objstore/blob.ts +1 -1
- package/server-e2e/objstore/fetch-mint-guard.ts +74 -0
- package/{server → server-e2e}/objstore/handlers.ts +9 -8
- package/{server → server-e2e}/objstore/init.ts +19 -27
- package/{server → server-e2e}/objstore/reaper.ts +1 -1
- package/server-e2e/objstore/rest-deny.ts +28 -0
- package/server-e2e/objstore/rest-mint.ts +224 -0
- package/{server → server-e2e}/objstore/rest.ts +3 -3
- package/{server → server-e2e}/objstore/store-neon.ts +6 -10
- package/{server → server-e2e}/objstore/store.ts +7 -7
- package/{server → server-e2e}/objstore/tokens.ts +2 -2
- package/{server → server-e2e}/pubsub.ts +12 -9
- package/{server → server-e2e}/sign.ts +4 -4
- package/{server → server-e2e}/sse-server.ts +60 -33
- package/{server → server-e2e}/static.ts +31 -21
- package/{server → server-e2e}/sync-handlers.ts +64 -30
- package/{server → server-e2e}/ws-server.ts +20 -9
- package/server-managed/activity.ts +258 -0
- package/server-managed/agent-merges.ts +109 -0
- package/server-managed/app-agents.ts +21 -0
- package/server-managed/avatar-store.ts +13 -0
- package/server-managed/blob-store.ts +17 -0
- package/server-managed/brotli.ts +10 -0
- package/server-managed/bundle-advisories.ts +120 -0
- package/server-managed/bundle-advisory-inventory.ts +77 -0
- package/server-managed/bundle-build-diagnostics.d.ts +10 -0
- package/server-managed/bundle-build-diagnostics.js +23 -0
- package/server-managed/bundle-build-leases.ts +41 -0
- package/server-managed/bundle-build-worker.js +115 -0
- package/server-managed/bundle-build.ts +200 -0
- package/server-managed/bundle-cache.ts +211 -0
- package/server-managed/bundle-catalog.ts +29 -0
- package/server-managed/bundle-commits.ts +140 -0
- package/server-managed/bundle-store.ts +24 -0
- package/server-managed/bundle-summary-cache.ts +130 -0
- package/server-managed/bundle.ts +119 -0
- package/server-managed/cache-storage.ts +20 -0
- package/server-managed/cli.js +21 -0
- package/server-managed/combined.ts +47 -0
- package/server-managed/comments.ts +151 -0
- package/server-managed/commit-coauthors.ts +106 -0
- package/server-managed/commit-lockfiles.ts +73 -0
- package/server-managed/comparison.ts +41 -0
- package/server-managed/config.ts +164 -0
- package/server-managed/content-access.ts +15 -0
- package/server-managed/crypto.ts +25 -0
- package/server-managed/db-methods.ts +1923 -0
- package/server-managed/db-neon.ts +458 -0
- package/server-managed/db-schema.ts +238 -0
- package/server-managed/db-table-names.ts +22 -0
- package/server-managed/db.ts +142 -0
- package/server-managed/dependabot-access.ts +60 -0
- package/server-managed/dependabot-alerts.ts +185 -0
- package/server-managed/dependency-review-comments.ts +100 -0
- package/server-managed/dependency-reviews.ts +346 -0
- package/server-managed/github-accounts.ts +60 -0
- package/server-managed/github-actions.ts +71 -0
- package/server-managed/github-app.ts +415 -0
- package/server-managed/github-errors.ts +70 -0
- package/server-managed/github-graphql.ts +39 -0
- package/server-managed/github-issue-links.ts +140 -0
- package/server-managed/github-issue-oauth.ts +47 -0
- package/server-managed/github-issues.ts +152 -0
- package/server-managed/github-link-oauth.ts +69 -0
- package/server-managed/github-links.ts +204 -0
- package/server-managed/github-metadata.ts +213 -0
- package/server-managed/github-oauth.ts +238 -0
- package/server-managed/github-pulls.ts +227 -0
- package/server-managed/github-requests.ts +39 -0
- package/server-managed/github-users.ts +30 -0
- package/server-managed/http-response.ts +76 -0
- package/server-managed/http.ts +5329 -0
- package/server-managed/import-triage.ts +51 -0
- package/server-managed/index.ts +192 -0
- package/server-managed/kept-briefly.ts +37 -0
- package/server-managed/kept.ts +28 -0
- package/server-managed/link-reports.ts +162 -0
- package/server-managed/locked-packages.ts +129 -0
- package/server-managed/lockfile-scope.ts +49 -0
- package/server-managed/lru.ts +30 -0
- package/server-managed/managed-issues.ts +78 -0
- package/server-managed/management-catalog.ts +45 -0
- package/server-managed/management.ts +99 -0
- package/server-managed/npm-delta-worker.js +23 -0
- package/server-managed/npm-delta.ts +194 -0
- package/server-managed/npm-insights.ts +449 -0
- package/server-managed/npm-kept.ts +215 -0
- package/server-managed/npm-loads.ts +264 -0
- package/server-managed/npm-manifest.ts +115 -0
- package/server-managed/npm-packages.ts +454 -0
- package/server-managed/npm-provenance.ts +123 -0
- package/server-managed/npm-risk.ts +285 -0
- package/server-managed/object-storage-disk.ts +148 -0
- package/server-managed/object-storage-vercel.ts +67 -0
- package/server-managed/object-storage.ts +75 -0
- package/server-managed/package-entry-points.ts +51 -0
- package/server-managed/pretty-print.ts +434 -0
- package/server-managed/public-workspace.ts +238 -0
- package/server-managed/pull-comment-reviews.ts +161 -0
- package/server-managed/pull-dependencies.ts +348 -0
- package/server-managed/pull-dependency-reviews.ts +328 -0
- package/server-managed/pull-reviews.ts +205 -0
- package/server-managed/queue.ts +39 -0
- package/server-managed/release-commits.ts +84 -0
- package/server-managed/rename-diff-worker.js +26 -0
- package/server-managed/rename-diff.ts +279 -0
- package/server-managed/repo-path.ts +21 -0
- package/server-managed/report-migration.ts +35 -0
- package/server-managed/report-query.ts +10 -0
- package/server-managed/report-response.ts +16 -0
- package/server-managed/report-sources.ts +178 -0
- package/server-managed/report-store.ts +85 -0
- package/server-managed/repository-actions.ts +218 -0
- package/server-managed/repository-agents.ts +355 -0
- package/server-managed/repository-aliases.ts +91 -0
- package/server-managed/repository-browser.ts +294 -0
- package/server-managed/repository-changes.ts +284 -0
- package/server-managed/repository-code.ts +215 -0
- package/server-managed/repository-dependency-reviews.ts +165 -0
- package/server-managed/repository-discovery.ts +82 -0
- package/server-managed/repository-history.ts +432 -0
- package/server-managed/repository-issues.ts +195 -0
- package/server-managed/repository-policy.ts +27 -0
- package/server-managed/repository-pulls.ts +156 -0
- package/server-managed/repository-pulse.ts +460 -0
- package/server-managed/repository-risk-assess.ts +105 -0
- package/server-managed/repository-risk-audit.ts +79 -0
- package/server-managed/repository-risk-read.ts +170 -0
- package/server-managed/repository-risk.ts +491 -0
- package/server-managed/repository-squashes.ts +168 -0
- package/server-managed/request-timing.ts +63 -0
- package/server-managed/reviewed-dependencies.ts +150 -0
- package/server-managed/revisions.ts +35 -0
- package/server-managed/scan-downloads.ts +87 -0
- package/server-managed/session.ts +132 -0
- package/server-managed/slugs.ts +38 -0
- package/server-managed/solidity-entry-points.ts +71 -0
- package/server-managed/sql-postgres.ts +34 -0
- package/server-managed/sql.ts +88 -0
- package/server-managed/static.ts +28 -0
- package/server-managed/storage-command.ts +16 -0
- package/server-managed/storage-db.ts +183 -0
- package/server-managed/storage-encryption.ts +290 -0
- package/server-managed/storage-maintenance.ts +259 -0
- package/server-managed/storage-payload.ts +121 -0
- package/server-managed/storage-stores.ts +91 -0
- package/server-managed/storage.ts +82 -0
- package/server-managed/team-app.ts +134 -0
- package/server-managed/team-catalog.ts +7 -0
- package/server-managed/team-feed.ts +180 -0
- package/server-managed/team-npm-scopes.ts +106 -0
- package/server-managed/team-reports.ts +307 -0
- package/server-managed/triage-response.ts +16 -0
- package/server-managed/type-only-worker.js +19 -0
- package/server-managed/type-only.ts +105 -0
- package/server-managed/uploads.ts +106 -0
- package/server-managed/upstream-cache.ts +243 -0
- package/server-managed/view-as.ts +58 -0
- package/server-managed/workspace-shares.ts +169 -0
- package/server.ts +70 -0
- package/server/index.ts +0 -480
- package/server/lifecycle.ts +0 -208
- /package/{LICENSE → LICENSE-MIT} +0 -0
- /package/{server → server-e2e}/auth.ts +0 -0
- /package/{server → server-e2e}/config.example.json +0 -0
- /package/{server → server-e2e}/objstore/blob-fs.ts +0 -0
- /package/{server → server-e2e}/objstore/fs.ts +0 -0
- /package/{server → server-e2e}/objstore/sign.ts +0 -0
- /package/{server → server-e2e}/peer.ts +0 -0
- /package/{server → server-e2e}/sse-session.ts +0 -0
- /package/{server → server-e2e}/util.ts +0 -0
- /package/{server → server-e2e}/validation.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var{Buffer:e}=globalThis,t=e&&!e.TYPED_ARRAY_SUPPORT,n=new Uint8Array(Uint16Array.of(258).buffer)[0]===2,r=e=>e&&(t||`${e}`.includes(`[native code]`));!t&&r(()=>{})&&(r=()=>!1);function i(e,t,n,r){let i=``,a=t;for(let t=n-3;a<t;a+=4){let t=e[a],n=e[a+1],o=e[a+2],s=e[a+3];i+=r[t],i+=r[n],i+=r[o],i+=r[s]}for(;a<n;)i+=r[e[a++]];return i}function a(e,t){let n=e.length;for(let r=0;r<n;r++)t[r]=e.charCodeAt(r);return t}var o=null,s=!1,c=!1,l=new TextEncoder,u=new TextDecoder(`utf-8`,{ignoreBOM:!0}),d=new TextDecoder(`latin1`,{ignoreBOM:!0});function f(e,t,n,r){if(n-t>3e4){let a=[];for(let o=t;o<n;){let t=o+500,s=t>n?n:t;a.push(i(e,o,s,r)),o=s}let o=a.join(``);return a.length=0,o}return i(e,t,n,r)}var p=globalThis.Buffer;function m(e){if(!(e&&e instanceof Uint8Array))throw TypeError(`Expected an Uint8Array`)}var h=`Input is not a string`,g=`Input is not well-formed Unicode`;function _(e,t){switch(t){case`uint8`:if(e.constructor!==Uint8Array)throw Error(`Unexpected`);return e;case`arraybuffer`:if(e.byteLength!==e.buffer.byteLength)throw Error(`Unexpected`);return e.buffer;case`buffer`:return e.length<=64?p.from(e):p.from(e.buffer,e.byteOffset,e.byteLength)}throw TypeError(`Unexpected format`)}function v(e,t){switch(t){case`uint8`:return e.length<=64||e.byteOffset!==0||e.byteLength!==e.buffer.byteLength?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);case`arraybuffer`:return e.buffer.byteLength===e.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);case`buffer`:if(e.constructor!==p)throw Error(`Unexpected`);return e}throw TypeError(`Unexpected format`)}export{n as a,a as b,o as c,s as d,c as e,l as f,u as g,d as h,f as i,m as j,h as k,g as l,_ as m,v as n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e=null){let t=[`anthropic/claude-opus-5.5`,`anthropic/claude-fable-5.1`,`anthropic/claude-sonnet-5.5`,`anthropic/claude-haiku-5.5`,`openai/gpt-6-astra`,`openai/gpt-6-astra-pro`,`openai/gpt-6.1-sol`,`openai/gpt-6.1-sol-pro`,`openai/gpt-6-luna`,`openai/gpt-6-luna-pro`,`moonshotai/kimi-k3`,`google/gemini-4-argon`,`google/gemma-4-31b-it`,`x-ai/grok-4.7`,`z-ai/glm-5.3`,`qwen/qwen3.8-max`,`deepseek/deepseek-v4.1-flash`,`deepseek/deepseek-v4-pro`,`mistralai/mistral-large-4-0`],n=e===`moonshot`?`moonshotai`:e,r=t.filter(t=>![`anthropic`,`openai`,`moonshot`].includes(e??``)||t.startsWith(`${n}/`)).map(e=>({id:e,efforts:[`low`,`medium`,`high`,`xhigh`,`max`]}));return{models:r,defaultModel:r[0].id}}export{e as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={view:`.bundle-code-view`,pane:`.bundle-code-rail`,property:`--bundle-code-rail-width`,axis:`x`,grow:1,keys:{ArrowLeft:-16,ArrowRight:16},initial:()=>320,bounds:e=>({min:Math.min(180,e*.4),max:e*.6}),preferred:null},t={view:`.bundle-code-main`,pane:`.bundle-code-terminal`,property:`--bundle-code-terminal-height`,axis:`y`,grow:-1,keys:{ArrowUp:16,ArrowDown:-16},initial:e=>e*.4,bounds:e=>({min:Math.min(96,e*.4),max:e*.85}),preferred:null},n=class extends HTMLElement{static split=e;constructor(){super(),this._split=this.constructor.split,this._drag=null,this.addEventListener(`pointerdown`,e=>this._startDrag(e)),this.addEventListener(`pointermove`,e=>{this._drag?.id===e.pointerId&&(this._split.preferred=this._apply(this._drag.size+this._split.grow*(this._client(e)-this._drag.at)))});for(let e of[`pointerup`,`pointercancel`,`lostpointercapture`])this.addEventListener(e,e=>{this._drag?.id===e.pointerId&&this._endDrag()});this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.addEventListener(`dblclick`,()=>{this._split.preferred=null,this._apply(this._preferred())})}connectedCallback(){this._view=this.closest(this._split.view),this._view&&(this._observer=new ResizeObserver(()=>this._apply(this._preferred())),this._observer.observe(this._view),this._apply(this._preferred()))}disconnectedCallback(){this._observer?.disconnect(),this._endDrag(),this._view=null}_client(e){return this._split.axis===`x`?e.clientX:e.clientY}_measure(e){let t=e.getBoundingClientRect();return this._split.axis===`x`?t.width:t.height}_preferred(){return this._split.preferred??this._split.initial(this._view?this._measure(this._view):0)}_bounds(){return this._split.bounds(this._measure(this._view))}_apply(e){if(!this._view)return e;let{min:t,max:n}=this._bounds();if(n===0)return e;let r=Math.max(t,Math.min(n,e));return this._view.style.setProperty(this._split.property,`${r}px`),this.setAttribute(`aria-valuemin`,String(Math.round(t))),this.setAttribute(`aria-valuemax`,String(Math.round(n))),this.setAttribute(`aria-valuenow`,String(Math.round(r))),this.setAttribute(`aria-valuetext`,`${Math.round(r)} pixels`),r}_paneSize(){return this._measure(this._view.querySelector(this._split.pane))}_startDrag(e){e.button!==0||!e.isPrimary||this._drag||!this._view||(e.preventDefault(),this._drag={id:e.pointerId,at:this._client(e),size:this._paneSize(),view:this.closest(`.bundle-code-view`)},this.setPointerCapture(e.pointerId),this.classList.add(`dragging`),this._drag.view?.classList.add(`splitting`))}_endDrag(){if(!this._drag)return;let{id:e,view:t}=this._drag;this._drag=null,this.classList.remove(`dragging`),t?.classList.remove(`splitting`),this.hasPointerCapture(e)&&this.releasePointerCapture(e)}_onKeyDown(e){if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||!this._view)return;let{min:t,max:n}=this._bounds(),r=this._split.keys[e.key],i=r===void 0?{Home:t,End:n}[e.key]:this._paneSize()+r;i!==void 0&&(e.preventDefault(),e.stopPropagation(),this._split.preferred=this._apply(i))}};customElements.define(`bundle-code-splitter`,n),customElements.define(`bundle-code-terminal-splitter`,class extends n{static split=t});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=`.detail-action{width:22px;height:22px;display:grid;place-items:center;padding:0;background:transparent;border:0;border-radius:var(--ui-radius, 4px);color:var(--muted);font:500 16px/1 ui-monospace,monospace;cursor:default;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}
|
|
2
|
+
`;export{e as a};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var e=new TextEncoder;function t(t){if(typeof t!=`string`)throw TypeError(`encodeUtf8 expects a string, got ${typeof t}`);if(!t.isWellFormed())throw TypeError(`encodeUtf8: input contains lone surrogates`);return e.encode(t)}async function n(e){let n=typeof e==`string`?t(e):e,r=new Uint8Array(await crypto.subtle.digest(`SHA-512`,n));return`sha512-${btoa(String.fromCodePoint(...r))}`}async function r(e){let n=t(JSON.stringify(e)),r=await crypto.subtle.digest(`SHA-256`,n),i=new Uint8Array(r,0,16);i[6]=i[6]&15|64,i[8]=i[8]&63|128;let a=Array.from(i,e=>e.toString(16).padStart(2,`0`)).join(``);return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20,32)}`}async function i(e){if(typeof crypto?.subtle?.digest!=`function`)return null;let t=a(e);try{return await r(t)}catch{return null}}function a(e){if(e._idBasis)return e._idBasis;let{severity:t,description:n}=e;return e.fileHash?{severity:t,description:n,fileHash:e.fileHash}:e.location?{severity:t,description:n,location:e.location}:{severity:t,description:n,file:e.file,line:e.line}}var o=new Map([[`CRITICAL`,`critical`],[`HIGH`,`high`],[`MEDIUM`,`medium`],[`LOW`,`low`],[`INFO`,`informational`],[`INFORMATIONAL`,`informational`],[`INFORMATIVE`,`informative`]]);function s(e){return typeof e==`string`&&e.trim().toLowerCase()===`informative`?`informational`:e}function c(e,t=e.severity){let n=s(e.severity);return n!==e.severity&&(!e.id&&!e._idBasis&&(e._idBasis=a({...e,severity:t})),e.severity=n),e.correctedSeverity!==void 0&&(e.correctedSeverity=s(e.correctedSeverity)),e}var l={critical:`Critical`,high:`High`,medium:`Medium`,low:`Low`,high_bug:`High bug`,bug:`Bug`,informational:`Informational`},u={inprogress:`In progress`,fixed:`Fixed`,invalid:`Invalid`,deleted:`Deleted`,ignored:`Ignored`},d={red:`Red`,blue:`Blue`,green:`Green`,gray:`Gray`,none:`Unmarked`},f={"claude-security":`Claude Security`,"codex-security":`Codex Security`,deepsec:`DeepSec`,piolium:`Piolium`,"markdown-generic":`Markdown (generic)`};function p(e){return l[s(e)]??String(e??``)}var m=/^( *)(`{3,}|~{3,})(.*)$/u,h=/^ {0,3}(?:#{1,6}(?:[ \t]|$)|>|([-*_])(?:[ \t]*\1){2,}[ \t]*$)/u,g=/^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/u,_=/^ {0,3}(?:=+|-+)[ \t]*$/u,v=/^( *)(?:[-*+]|\d{1,9}[.)]) +(?=\S)/u,ee=/^ *(?:[-*+]|\d{1,9}[.)])[ \t]*$/u,y=/^\s*$/u,te=[[/^<(script|pre|textarea|style)(?:\s|>|$)/iu,/<\/(?:script|pre|textarea|style)>/iu,e=>`</${e[1].toLowerCase()}>`],[/^<!--/u,/-->/u,`-->`],[/^<\?/u,/\?>/u,`?>`],[/^<![A-Za-z]/u,/>/u,`<!-- -->`],[/^<!\[CDATA\[/u,/\]\]>/u,`]]>`],[/^<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|search|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/iu,y,null]],ne=/^(?:<[A-Za-z][\dA-Za-z-]*(?:\s+[:A-Z_a-z][\w.:-]*(?:\s*=\s*(?:[^\s"'<=>`]+|'[^']*'|"[^"]*"))?)*\s*\/?>|<\/[A-Za-z][\dA-Za-z-]*\s*>)\s*$/u;function b(e,t,n=t){let r=/^ */u.exec(e)[0].length;if(r>3)return null;if(t&&n&&_.test(e))return!0;let i=m.exec(e);if(i&&!(i[2][0]==="`"&&i[3].includes("`")))return{fence:i[2]};let a=e.slice(r);for(let[e,t,n]of te){let r=e.exec(a);if(r)return{html:t,close:typeof n==`function`?n(r):n}}if(!t&&ne.test(a))return{html:y,close:null};let o=g.test(e)?null:v.exec(e);if(o&&!(t&&n&&/^ *(?:\d*[02-9]|\d+\d)[.)]/u.test(o[0]))){let e=/ +$/u.exec(o[0])[0].length;return{item:e>4?o[0].length-e+1:o[0].length}}let s=g.test(e)||t&&n?null:ee.exec(e);return s?{item:s[0].trimEnd().length+1}:h.test(e)||null}function x(e){return ie(e).ranges}function re(e,t){let n=e.replace(/^(?: {0,3}> ?)+/u,``),r=b(n,t);for(;r?.item;)n=n.slice(r.item),r=b(n,!1);return n.trim()!==``&&!r&&/^ */u.exec(n)[0].length<4}function ie(e){let t=[],n=-1,r=``,i=null,a=0,o=[],s=!1,c=!1,l=!1,u=0;for(let d of e.split(`
|
|
2
|
+
`)){let e=u;u+=d.length+1;let f=/^ */u.exec(d)[0].length;if(n!==-1||i){let o=a>0&&d.trim()!==``&&f<a,s=!o&&(i?i.ends.test(d):f<=a+3&&ae(r,d));if((o||s)&&(n!==-1&&t.push([n,o?e-1:e+d.length]),n=-1,i=null),!o)continue}if(!d.trim()){l&&o.pop(),l=!1,s=!1;continue}let p=o.length;for(;p>0&&f<o[p-1];)p--;let m=p>0?o[p-1]:0,h=d.slice(m),g=b(h,s,p===o.length&&!c);if(s&&!g)continue;for(o.length=p;g?.item;)m+=g.item,h=h.slice(g.item),o.push(m),g=b(h,!1);l=h.trim()===``,g?.fence?[n,r,a]=[e,g.fence,m]:g?.html&&([i,a]=[g.html.test(h)?null:{ends:g.html,close:g.close},m]);let _=s&&c;c=/^ {0,3}>/u.test(h),s=c?re(h,_):!g&&!l&&/^ */u.exec(h)[0].length<4}n!==-1&&t.push([n,e.length]);let d=n===-1?i?.close:r;return{ranges:t,closer:d?` `.repeat(a)+d:null}}function ae(e,t){let n=m.exec(t);return n!==null&&n[2][0]===e[0]&&n[2].length>=e.length&&!n[3].trim()}function S(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i][1]<=t?n=i+1:r=i}return n<e.length&&t>=e[n][0]}function C(e){return String(e??``).replaceAll(/\r\n?/gu,`
|
|
3
|
+
`)}var oe=/^## +(.*)$/gmu,se=/^### +(.*)$/gmu,w=/^#### +(.*)$/gmu,ce=/^##### +(.*)$/gmu,le=/^(.+):(\d+(?:-\d+)?)$/u;function T(e){return/^[0-9a-f]{7,64}$/iu.test(e)}function ue(e,t){let n=x(e);return[...e.matchAll(t)].filter(e=>!S(n,e.index))}function de(e,t){let n=ue(e,t);return[e.slice(0,n[0]?.index),...n.map((t,r)=>e.slice(t.index+t[0].length,n[r+1]?.index))]}function E(e,t){let n=ue(e,t);return{head:e.slice(0,n[0]?.index),subs:n.map((t,r)=>({heading:t[1],body:e.slice(t.index+t[0].length+1,n[r+1]?.index)}))}}function D(e,t){return E(e,t).subs}function O(e){let t=e.indexOf(`
|
|
4
|
+
`);return t===-1?{title:e.trim(),body:``}:{title:e.slice(0,t).trim(),body:e.slice(t+1)}}function fe(e){let t=e.split(`
|
|
5
|
+
`).map(e=>e.trim()).filter(e=>e.startsWith(`|`)&&!(/^[\s:|-]+$/u.test(e)&&e.includes(`-`))).map(e=>e.replace(/^\|/u,``).replace(/\|$/u,``).split(`|`).map(e=>e.trim()));if(t.length<2)return[];let n=t[0].map(e=>e.toLowerCase());return t.slice(1).filter(e=>e.length!==n.length||e.some((e,t)=>e.toLowerCase()!==n[t])).map(e=>Object.fromEntries(n.flatMap((t,n)=>t?[[t,e[n]??``]]:[])))}function pe(e){let t=Object.create(null),n=Object.create(null),r=[],i=null,a=``,o=[],s=``,c=(e,r,i)=>{!e||e in t||(t[e]=i.trim(),n[e]=r)},l=()=>{i&&c(i,a,o.join(`
|
|
6
|
+
`)),i=null,a=``,o=[]},u=e=>{(i?o:r).push(e)};for(let t of e.split(`
|
|
7
|
+
`)){let e=/^ {0,3}(```|~~~)/u.exec(t),n=e!==null&&(!s||e[1]===s);if(n&&(s=s?``:e[1]),n||s){u(t);continue}if(!t.trim()){i?l():r.push(t);continue}let d=/^\s*(?:[-*] +)?\*\*([^:*]+):\*\*\s*(.*)$/u.exec(t);if(d){l();let e=d[1].trim(),t=d[2],n;for(;(n=/\s+[\u00B7\u2022]\s+\*\*([^:*]+):\*\*\s*/u.exec(t))!==null;)c(e.toLowerCase(),e,t.slice(0,n.index)),e=n[1].trim(),t=t.slice(n.index+n[0].length);i=e.toLowerCase(),a=e,o=[t];continue}if(/^\s*(?:#{1,6} |\||[-=*_]{3,}\s*$)/u.test(t)){l();continue}u(t)}return l(),{fields:t,labels:n,prose:r.join(`
|
|
8
|
+
`).trim()}}function me(e){let t=(e||``).trim(),n=``,r=k(t);r&&(t=r.label.trim(),n=r.url.trim());let i=/#L(\d+)/u.exec(n)?.[1]??``,a=[...t.matchAll(/`([^`]+)`/gu)].map(e=>e[1].trim()).find(e=>!e.includes(`(`)&&(e.includes(`/`)||/\.\w/u.test(e)))??(t.replaceAll("`",``).trim().split(/[\s,]+/u).find(Boolean)||``),o=/^(.*?)#L(\d+)(?:-L?\d+)?$/u.exec(a);o&&(a=o[1],i||=o[2]);let s=le.exec(a);return s?(i||=s[2],{file:s[1],line:i,locationLink:n}):{file:a,line:i||`?`,locationLink:n}}function he(e){return e.replaceAll(`**`,``)}function k(e){let t=String(e??``),n=ge(t,_e(t)),r=ve(t),i=t.indexOf(`]`);for(let e=t.indexOf(`[`);e!==-1;e=t.indexOf(`[`,e+1)){for(;i!==-1&&i<=e;)i=t.indexOf(`]`,i+1);for(let a of[i,n.get(e)??-1]){if(a===-1||a===e+1||t[a+1]!==`(`)continue;let n=ye(t,a+1,r);if(n!==null)return{label:t.slice(e+1,a),url:n,index:e}}}return null}function ge(e,t){let n=new Map,r=[];for(let i=0;i<e.length;i++){let a=e[i];Ce(e,i)?i++:a==="`"?i=t.get(i)??i:a===`[`?r.push(i):a===`]`&&r.length>0&&n.set(r.pop(),i)}return n}function _e(e){let t=[];for(let n=e.indexOf("`");n!==-1;n=e.indexOf("`",n)){let r=1;for(;e[n+r]==="`";)r++;t.push([n,r]),n+=r}let n=new Map,r=new Map;for(let e=t.length-1;e>=0;e--){let[i,a]=t[e],o=r.get(a);o!==void 0&&n.set(i,o+a-1),r.set(a,i)}return n}function ve(e){let t=e.length,n=new Int32Array(t+1).fill(-1),r=new Int32Array(t+1).fill(-1),i=new Int32Array(t+1).fill(-1),a=new Int32Array(t+1).fill(-1);for(let o=t-1;o>=0;o--)n[o]=e[o]===`)`?o:n[o+1],r[o]=/\s/u.test(e[o])?o:r[o+1],i[o]=e[o]===`>`?o:i[o+1],a[o]=e[o]===`
|
|
9
|
+
`?o:a[o+1];let o=new Map,s=[];for(let n=0;n<t;n++){let t=e[n];Ce(e,n)?n++:r[n]===n?s.length=0:t===`(`?s.push(n):t===`)`&&s.length>0&&o.set(s.pop(),n)}return{balanced:o,nextClose:n,nextSpace:r,nextAngle:i,nextLine:a}}function ye(e,t,n){let r=be(e,t,n);if(r)return r;let i=n.balanced.get(t);if(i!==void 0)return i>t+1?e.slice(t+1,i):null;let a=n.nextClose[t+1],o=n.nextSpace[t+1];return a===-1||a===t+1||o!==-1&&o<a?null:e.slice(t+1,a)}function be(e,t,n){if(e[t+1]!==`<`)return``;let r=n.nextAngle[t+2],i=n.nextLine[t+2];return r===-1||i!==-1&&i<r||e[r+1]!==`)`?``:e.slice(t+2,r)}var xe=/\\([!-/:-@[-`{-~])/gu,Se=/[!-/:-@[-`{-~]/u;function Ce(e,t){return e[t]===`\\`&&Se.test(e[t+1]??``)}function we(e){return typeof e==`string`?e.replace(xe,`$1`):e}function Te(e){let t=/^\[(.+)\]$/u.exec(e.trim());return t?t[1].trim():e.trim()}function A(e){let t=(e||``).trim();return/^[-\u2013\u2014]+$/u.test(t)?``:t}var Ee={critical:6,high:5,medium:4,low:3,high_bug:2,bug:1,informational:0},j=[`critical`,`high`,`medium`,`low`,`high_bug`,`bug`,`informational`];function De(e){return e=s(e),e!=null&&e in Ee?e:null}function Oe(e){return De(e?.correctedSeverity)??s(e?.severity)}function ke(e){let t=De(e?.correctedSeverity);return t!=null&&t!==s(e?.severity)}function Ae(e,t){return t===`original`?s(e?.severity):Oe(e)}function je(e){let t=e?._correctedByReport;return t&&new Set(Object.values(t).map(e=>s(e?.severity))).size>1?t:null}var Me=[`revalidation`,`refuted`,`unreachable`,`confirmed`,`partial`,`unknown`],Ne=new Set(Me);function M(e){return Ne.has(e?.revalidate)?e.revalidate:``}function Pe(e,t=e?.source){return Object.hasOwn(f,t)||M(e)===`revalidation`}function Fe(e,t=e?._source??e?.source){let n=typeof t==`string`&&t!==``&&t!==`deepview`,r=n?t:e?.analyzer??e?.type??e?._analyzer;return e?.security===!0||(r===`security`||r===`dependencies`)&&e?.security!==!1||n&&[`critical`,`high`,`medium`,`low`].includes(e?.severity)}function Ie(e){return e&&e.replace(/^[^/]+\//u,``).replace(/^claude-/u,``).replaceAll(`-`,` `)}function Le(e,t=!0){let n=t&&M(e)===`revalidation`?`revalidate`:``;return[e?.type,n,Ie(e?.model),e?.effort,e?.exportsMode].filter(Boolean).join(` · `)}function N(e,t){if(!e)return e;let n=e;t?.exportsMode===`isolate`&&(n=n.replace(/^\((?:[^()]|\([^()]*\))*\): \[export:\s*\w+\] /u,``),n=n.replace(/^\[export:\s*\w+\] /u,``));let r=[t?.exportName,t?.methodName].filter(Boolean).map(e=>e.replaceAll(/[.*+?^${}()|[\]\\]/gu,`\\$&`));for(let e of r)n=n.replaceAll(RegExp(`\\[export:\\s*${e}\\]\\s*`,`gu`),``);for(let e of r)n=n.replace(RegExp(`^\\(\`?${e}\`?\\): `,`u`),``);return n}function Re(e){let t=e?.exportName,n=e?.methodName;return t&&n&&t!==n?`${t}.${n}`:t||n||``}function P(e){return e?e.split(`
|
|
10
|
+
`).find(e=>e.trim())?.trim()??``:``}function ze(e){return typeof e?.title==`string`?e.title.trim():``}function F(e){return ze(e)||P(N(e?.description,e))}function Be(e){let t=N(e?.description,e)||``,n=ze(e);if(n){let e=t.trim(),r=O(e);return{title:n,body:r.title===n?r.body.replace(/^\s+/u,``):e}}let r=t.indexOf(`
|
|
11
|
+
`);if(r<0||x(t.slice(0,r))[0]?.[0]===0)return{title:``,body:t};let i=t.slice(r+1).replace(/^\s+/u,``);return i?{title:t.slice(0,r).trim(),body:i}:{title:``,body:t}}function Ve(e){let t=ze(e);if(!t)return N(e?.description,e)||``;let{body:n}=Be(e);return n?`${t}
|
|
12
|
+
|
|
13
|
+
${n}`:t}var He=/^\*\*([^*\n]+):\*\*[ \t]*/u;function Ue(e){let t=[];for(let n of de(e||``,/\n{2,}/gu)){if(!n.trim())continue;let e=He.exec(n);if(e){t.push({label:e[1].trim(),body:n.slice(e[0].length).trim()});continue}let r=t.at(-1);r&&r.label===null?r.body+=`
|
|
14
|
+
|
|
15
|
+
${n}`:t.push({label:null,body:n})}return t}function I(e){return Number.isFinite(parseInt(e?.line,10))?`${e.file}:${e.line}`:e?.file??``}function We(e){let t=e=>typeof e==`string`?e:``;return`${t(e?.observation)}
|
|
16
|
+
${t(e?.text)}`.trim()}function L(e){if(typeof e!=`string`||e.length===0)return!1;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function Ge(e){return String(e??``).replaceAll(/\s*\n\s*/gu,` `).replaceAll(`|`,`\\|`).trim()}function R(e){let t=String(e??``);if(t===``)return``;let n=Math.max(0,...[...t.matchAll(/`+/gu)].map(e=>e[0].length)),r="`".repeat(n+1),i=t.startsWith("`")||t.endsWith("`")?` `:``;return`${r}${i}${t}${i}${r}`}function Ke(e){return String(e??``).replaceAll(/[[\]]/gu,`\\$&`)}function z(e,t){return`[${e}](${/[\s()<>]/u.test(t)?`<${t.replaceAll(`>`,`%3E`)}>`:t})`}function qe(e){return L(e)?`<${e}>`:String(e??``)}function Je(e,t){let n=String(e??``).toLowerCase().replaceAll(/[^\p{L}\p{N}\p{M}\s_-]/gu,``).replaceAll(/\s/gu,`-`),r=n;for(let e=1;t.has(r);e++)r=`${n}-${e}`;return t.add(r),r}function B(e,t){return`${`#`.repeat(Math.min(6,Math.max(1,e)))} ${t}`}function Ye(e,t,n=[]){return[e,e.map((e,t)=>n[t]===`right`?`---:`:`---`),...t].map(e=>`| ${e.join(` | `)} |`).join(`
|
|
17
|
+
`)}function Xe(e){let t=e instanceof Date?e:new Date(e);if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return`${t.getUTCFullYear()}-${n(t.getUTCMonth()+1)}-${n(t.getUTCDate())} ${n(t.getUTCHours())}:${n(t.getUTCMinutes())} UTC`}function V(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function Ze(e){return e.filter(e=>typeof e==`string`&&e.trim()).map(e=>e.replace(/\s+$/u,``)).join(`
|
|
18
|
+
|
|
19
|
+
`)}var Qe=/^( {0,3})(\\*#)/u;function H(e){let t=C(e).trim();if(!t)return``;let n=$e(t,e=>e.replace(Qe,`$1\\$2`)),{closer:r}=ie(n);return r===null?n:`${n}
|
|
20
|
+
${r}`}function $e(e,t){let n=x(e),r=0;return e.split(`
|
|
21
|
+
`).map(e=>{let i=r;return r+=e.length+1,S(n,i)?e:t(e)}).join(`
|
|
22
|
+
`)}function U(e){return $e(String(e??``),e=>e.replace(/^( {0,3})\\(\\*#)/u,`$1$2`))}function et(e,t){let n=` `.repeat(e.length);return t.split(`
|
|
23
|
+
`).map(e=>e?n+e:``).join(`
|
|
24
|
+
`)}var tt=[`type`,`model`,`think`,`effort`,`exportsMode`];function nt(e,t){if(!t.source)for(let n of tt)e[n]==null&&t[n]!=null&&(e[n]=t[n])}var rt=/^(?:https?:\/\/)?(?:www\.)?github\.com\/([^/?#]+)\/([^/?#]+?)(?:\.git)?(?:[/?#].*)?$/iu,it=/^[\w.-]+\/[\w.-]+$/u;function at(e){return it.test(e)}function ot(e){let t=e?.repo?.github;if(typeof t!=`string`)return null;let n=t.trim().replace(/\/+$/u,``);if(!n)return null;let r=rt.exec(n),i=(r?`${r[1]}/${r[2]}`:n).replace(/\.git$/u,``);return at(i)?i:null}function st(e){let t=(typeof e?.directory==`string`?e.directory.trim():``).replace(/^(?:\.\/)+/u,``).replaceAll(/^\/+|\/+$/gu,``).replaceAll(/\/{2,}/gu,`/`);return!t||t===`.`||/[?#]/u.test(t)||t.split(`/`).includes(`..`)?``:t}var ct=[`finding_url`,`repository`,`title`,`description`,`severity`,`configured_scan_id`,`relevant_paths`];function lt(e){let t=[],n=[],r=``,i=!1;for(let a=0;a<e.length;a++){let o=e[a];i?o===`"`?e[a+1]===`"`?(r+=`"`,a++):i=!1:r+=o:o===`"`?i=!0:o===`,`?(n.push(r),r=``):o===`
|
|
25
|
+
`||o===`\r`?(n.push(r),t.push(n),n=[],r=``,o===`\r`&&e[a+1]===`
|
|
26
|
+
`&&a++):r+=o}for((r!==``||n.length>0)&&(n.push(r),t.push(n));t.length>0&&t.at(-1).length===1&&t.at(-1)[0]===``;)t.pop();return t}function ut(e,t){return t.map(t=>{let n=Object.create(null);return e.forEach((e,r)=>{n[e]=t[r]??``}),n})}function dt(e){let t=lt(e);if(t.length<2)throw Error(`Codex CSV: empty or missing header row`);let[n,...r]=t;for(let e of ct)if(!n.includes(e))throw Error(`Codex CSV: missing required column "${e}"`);let i=Map.groupBy(ut(n,r).filter(e=>e.configured_scan_id),e=>e.configured_scan_id);if(i.size===0)throw Error(`Codex CSV: no rows with a configured_scan_id`);let a=[];for(let[e,t]of i){let n=new Set(t.map(e=>e.repository).filter(Boolean));if(n.size>1)throw Error(`Codex CSV: scan ${e} contains multiple repositories: ${[...n].join(`, `)}`);let r=`${[...n][0]||`unknown-repo`}:${e.replace(/^[^:]+:/u,``)}`;a.push({displayName:r,data:{type:`security`,source:`codex-security`,findings:t.map(ft)}})}return a}function ft(e){let t=e.relevant_paths.split(` | `).map(e=>e.trim()).find(Boolean)||`unknown`,n=[e.title,e.description].filter(Boolean).join(`
|
|
27
|
+
|
|
28
|
+
`),r={id:e.finding_url,file:t,line:`?`,severity:(e.severity||`medium`).toLowerCase(),description:n,repo:{github:e.repository}};return e.commit_hash&&(r.commitHash=e.commit_hash),e.detected_at&&(r.detectedAt=e.detected_at),e.committed_at&&(r.committedAt=e.committed_at),c(r)}function pt(){let e=[],t=new Map,n=n=>{if(!t.has(n)){let r={security:!1};r.parent=r,t.set(n,r),typeof n==`string`&&e.push(n)}return t.get(n)},r=e=>{let t=e;for(;t.parent!==t;)t=t.parent;for(;e.parent!==e;){let n=e.parent;e.parent=t,e=n}return t};return{nodeFor:n,root:r,join:(e,t)=>{e=r(e),t=r(t),e!==t&&(t.parent=e,e.security||=t.security)},ids:e}}function mt(e,{source:t,linkedIds:n=()=>[],knownRows:r=()=>[]}={}){let{nodeFor:i,root:a,join:o,ids:s}=pt(),c=[],l=(e,n=!1)=>{let r;for(let s of e){if(!s||typeof s!=`object`)continue;let e=i(s.id||s);a(e).security||=n?s.isSecurity===!0:Fe(s,s._source??s.source??t),r?o(r,e):r=e,n||c.push([s,e])}};for(let t of e)l(t);let u=new Set;for(let e=0;e<s.length;e++){let t=s[e],a=i(t);for(let e of n(t))o(a,i(e));for(let e of r([t]))u.has(e)||(u.add(e),l(e.members,!0))}let d=!1;for(let[e,t]of c){let n=a(t).security;e.isSecurity!==n&&(e.isSecurity=n,d=!0)}return d}var ht=/^## ([A-Z][A-Z_]*)\s*\(\d+\)\s*\n/mu,gt=new Map([...o,[`HIGH_BUG`,`high_bug`],[`BUG`,`bug`]]),_t=e=>String(e??``).toLowerCase().replaceAll(/[^a-z]+/gu,``),vt=new Map([[`high`,8],[`medium`,6],[`low`,4]]);function yt(e){if(e!==void 0)return vt.get(_t(e))??vt.get(`medium`)}var bt=new Map([[`confirmed`,`confirmed`],[`falsepositive`,`refuted`],[`uncertain`,`unknown`]]);function xt(e){let t=C(e).trim().split(ht);if(t.length===1)return null;let n=[];for(let e=1;e<t.length;e+=2){let r=gt.get(t[e].toUpperCase())??`medium`;for(let i of de(t[e+1],/^### /gmu).slice(1)){let e=St(i,r);if(!e)continue;let t=i.indexOf(`
|
|
29
|
+
### `);t!==-1&&(e._idBasis=a(St(i.slice(0,t+1),r))),n.push(e)}}return n.length===0?null:{type:`security`,source:`deepsec`,findings:n}}function St(e,t){let{title:n,body:r}=O(e);if(!n)return null;let i=r.replace(/\n---\s*$/u,``).trim(),a=Object.fromEntries([...i.matchAll(/^- \*\*([^:*]+):\*\*\s*(.+)$/gmu)].map(e=>[e[1].trim().toLowerCase(),e[2].trim()])),o=/^\*\*Recommendation:\*\*\s*/mu.exec(i),s=o?i.slice(0,o.index):i,l=o?i.slice(o.index+o[0].length).trim():``,u=[n,s.split(`
|
|
30
|
+
`).filter(e=>!/^\s*- \*\*/u.test(e)).join(`
|
|
31
|
+
`).replaceAll(`**`,``).trim()].filter(Boolean).join(`
|
|
32
|
+
|
|
33
|
+
`),d={file:(a.file||`unknown`).replace(/^`(.*)`$/u,`$1`),line:(a.lines||``).split(`,`).map(e=>e.trim()).find(Boolean)||`?`,severity:t,description:u};l&&(d.recommendation=l.replaceAll(`**`,``));let f=yt(a.confidence);f!==void 0&&(d.confidence=f);let p=bt.get(_t(a.revalidation));return p&&(d.revalidate=p,d.revalidateSource=`deepsec`,a.reasoning&&(d.revalidateVerdict=a.reasoning.replaceAll(`**`,``))),a.slug&&(d.slug=a.slug),c(d,t===`informative`?`medium`:t)}var W=120;function Ct(e){let t=F(e)||I(e)||`Untitled finding`;return t.length>W?`${t.slice(0,W-1).trimEnd()}\u2026`:t}function wt(e){let t=String(e??``).trim();return L(t)?qe(t):at(t)?z(t,`https://github.com/${t}`):t}function Tt(e,t,n){return t?f[t]??String(t):Le(e,n)}var Et=[[`Impact`,`impact`,!1],[`Reproduction`,`reproduction`,!1],[`Recommendation`,`recommendation`,!1],[`Confidence reasoning`,`confidenceReason`,!1],[`Revalidation verdict`,`revalidateVerdict`,!0],[`Revalidation recommendation`,`revalidateRecommendation`,!0]],Dt=[[`Status`,`status`],[`Branch`,`branch`],[`Date created`,`dateCreated`],[`Detected at`,`detectedAt`],[`Committed at`,`committedAt`],[`PoC status`,`pocStatus`],[`Variant of`,`parent`],[`Slug`,`slug`],[`Priority`,`priority`]],Ot=[[`Detailed report`,`reportPath`],[`Commit audited`,`auditedCommit`],[`ID`,`id`]];function G(e){return typeof e==`number`?Number.isFinite(e)?String(e):``:typeof e==`string`?e.replaceAll(/\s*\n\s*/gu,` `).trim():``}function kt(e){return typeof e==`string`?e.trim():``}function At(e,t){let n=t.severityMode===`original`,r=p(Ae(e,t.severityMode));ke(e)&&(r+=n?` \u2014 corrected to ${p(Oe(e))}`:` \u2014 corrected from ${p(e.severity)}`);let i=je(e);if(i){let e=Object.entries(i).map(([e,t])=>`${e||`this report`}: ${p(t?.severity)}`);r+=` (varies across reports \u2014 ${e.join(`; `)})`}return e.critical===!0&&(r+=` · flagged critical by the analyzer`),r}function jt(e,t){let n=I(e);if(!n)return``;let r=t.hooks.location(e),i=L(r)?z(R(n),r):R(n),a=Re(e);return a?`${i} \xB7 ${R(a)}`:i}function Mt(e){if(!e)return``;let t=[],n=u[e.triage]??(e.ignored?u.ignored:``);return n&&t.push(n),e.color&&t.push(`${d[e.color]??e.color} mark`),e.flagged===!0&&t.push(`Flagged`),t.join(` · `)}function Nt(e,t){let n=G(e.commitHash);if(!n)return``;let r=t.hooks.commit(e);return L(r)?z(R(n.slice(0,7)),r):R(n)}function Pt(e,t,n){let r=[],i=(e,t)=>{t&&r.push(`- **${e}:** ${t}`)};i(`Location`,jt(e,t)),i(`Severity`,At(e,t)),e.confidence!==void 0&&e.confidence!==null&&i(`Confidence`,`${e.confidence}/10`),t.showAnalyzer&&i(`Analyzer`,t.analyzerOf(e)),i(`Category`,G(e.category));let a=t.revalidation?M(e):``;a&&i(`Revalidation`,a===`revalidation`?`the revalidation pass itself`:a);let o=G(e.revalidateSource);a&&i(`Revalidated by`,f[o]??o),i(`Triage`,Mt(n)),n?.fix&&i(`Fix`,qe(String(n.fix).trim())),t.showReport&&i(`Report`,R(t.hooks.report(e)??``));let s=G(e.repo?.github);s&&s!==t.repo&&i(`Repository`,wt(s)),i(`Introduced in`,Nt(e,t));let c=G(e.discoveredIn);c&&c!==String(e.file??``).trim()&&i(`Found while analyzing`,R(c));let l=e.package?.npm,u=G(l?.name);u&&i(`Package`,R(G(l.version)?`${u}@${G(l.version)}`:u));for(let[t,n]of Dt)i(t,G(e[n]));for(let[t,n]of Ot)i(t,R(G(e[n])));return r.join(`
|
|
34
|
+
`)}function K(e,t,n){let r=H(n);return r?`${B(e,t)}
|
|
35
|
+
|
|
36
|
+
${r}`:B(e,t)}function Ft(e,t){return(Array.isArray(e.evidence)?e.evidence:[]).map((n,r)=>{let i=`${r+1}. `,a=I(n),o=t.hooks.evidence(n,e,r),s=``;a?s=L(o)?z(R(a),o):R(a):L(o)&&(s=qe(o));let c=H(We(n)),l=i+(s||`(no reference)`);return c?`${l}
|
|
37
|
+
|
|
38
|
+
${et(i,c)}`:l}).join(`
|
|
39
|
+
|
|
40
|
+
`)}function It(e,t,n){let r=Be(e),i=C(r.body),a=F(e),o=a.length>W,s=!o&&!r.title&&i.trim()===a,c=o&&P(i)!==a?`${a}
|
|
41
|
+
|
|
42
|
+
${i}`:i,l=Ue(s?``:c),u=l.findIndex(e=>e.label!==null),d=u===-1?l:l.slice(0,u),f=u===-1?[]:l.slice(u),p=d.map(e=>H(e.body)),m=Ft(e,t);m&&p.push(`${B(n,`Evidence`)}
|
|
43
|
+
|
|
44
|
+
${m}`);for(let e of f)p.push(e.label===null?H(e.body):K(n,e.label,e.body));return p}function Lt(e,t,n){let r=t.hooks.annotation(e),i=[Pt(e,t,r),...It(e,t,n)];for(let[r,a,o]of Et){if(o&&!t.revalidation)continue;let s=e[a],c=typeof s==`string`?N(s,e):``;c.trim()&&i.push(K(n,r,c))}ke(e)&&kt(e.correctedSeverityReason)&&i.push(K(n,`Severity correction`,e.correctedSeverityReason));let a=kt(r?.comment);return a&&i.push(K(n,`Comment`,a)),i}function Rt(e,t,{headingText:n,depth:r}){let i=[B(r,n)];if(e.length===1)return Ze([...i,...Lt(e[0],t,r+1)]);let a=[...new Set(e.map(e=>t.hooks.report(e)).filter(Boolean))],o=a.length>1?` \u2014 reported in ${a.map(e=>R(e)).join(`, `)}`:``;i.push(`${V(e.length,`case`)} of this finding${o}.`);let s=F(e[0]);return e.forEach((n,a)=>{let o=I(n);i.push(B(r+1,`Case ${a+1} of ${e.length}${o?` \u2014 ${R(o)}`:``}`));let c=F(n);c&&c!==s&&i.push(H(c)),i.push(...Lt(n,t,r+2))}),Ze(i)}var zt=new Map(Object.entries(l).map(([e,t])=>[t.toLowerCase(),e])),Bt=new Map(Object.entries(f).map(([e,t])=>[t.toLowerCase(),e]));function q(e){let t=/(`+)(.+?)\1(?!`)/u.exec(String(e??``));if(!t)return null;let n=t[2];if(n.length>2&&n.startsWith(` `)&&n.endsWith(` `)){let e=n.slice(1,-1);if(e.startsWith("`")||e.endsWith("`"))return e}return n}function J(e){let t=k(String(e??``));return t?.index===0?{label:t.label,url:t.url}:null}function Vt(e){let t=/^<(https?:[^>\s]*)>$/u.exec(e.trim());return t?t[1]:null}function Ht(e){let t=le.exec(e);return t?{file:t[1],line:t[2]}:{file:e,line:`?`}}function Ut(e){let t=e.indexOf(`.`);return t>0?{exportName:e.slice(0,t),methodName:e.slice(t+1)}:{exportName:e}}function Wt(e){let t=String(e??``).trim();return zt.get(t.toLowerCase())??t}function Gt(e){let t={},n=e.trim(),r=/ \u00B7 (`+)(.+?)\1$/u.exec(n);r&&(Object.assign(t,Ut(q(r[0]))),n=n.slice(0,r.index));let i=J(n),a=q(i?i.label:n);return a!==null&&Object.assign(t,Ht(a)),i&&L(i.url)&&(t.location=i.url),t}var Kt=` · flagged critical by the analyzer`,qt=` (varies across reports — `;function Jt(e){let t={},n=e.trim();n.endsWith(Kt)&&(t.critical=!0,n=n.slice(0,-Kt.length));let r=n.indexOf(qt);r!==-1&&(n=n.slice(0,r));let i=/^(.*?) \u2014 corrected (from|to) (.*)$/u.exec(n);return i?[t.severity,t.correctedSeverity]=(i[2]===`from`?[i[3],i[1]]:[i[1],i[3]]).map(Wt):t.severity=Wt(n),t}var Yt=new Set([`max`,`xhigh`,`high`,`medium`,`low`,`minimal`]),Xt=new Set([`list`,`isolate`]);function Zt(e){return/\d/u.test(e)||/^(?:opus|sonnet|haiku|gpt|gemini|fable|mythos|llama|mistral)\b/iu.test(e)}function Qt(e){let t=e.trim(),n=Bt.get(t.toLowerCase());if(n)return{source:n};let r={},i=[];for(let e of t.split(` · `).map(e=>e.trim()).filter(Boolean))e===`revalidate`&&!r.revalidate?r.revalidate=`revalidation`:Xt.has(e)&&!r.exportsMode?r.exportsMode=e:Yt.has(e)&&!r.effort?r.effort=e:i.push(e);return i.length>1?[r.type,r.model]=i:i.length===1&&(r[Zt(i[0])?`model`:`type`]=i[0]),{run:r}}function $t(e){let t=e.trim(),n=J(t);return n?n.label.trim():Vt(t)??t}function en(e){let t=J(e.trim());if(t){let e=t.url.split(`/`).at(-1)??``;return T(e)?e:q(t.label)??e}return q(e)??e.trim()}function tn(e){let t=q(e)??e.trim(),n=t.lastIndexOf(`@`);return{npm:n>0?{name:t.slice(0,n),version:t.slice(n+1)}:{name:t}}}function nn(e){let t=e.trim().toLowerCase();return t===`the revalidation pass itself`?`revalidation`:Me.includes(t)?t:void 0}var rn=new Map([...[[`Category`,`category`],...Dt].map(([e,t])=>[e.toLowerCase(),(e,n)=>{e[t]=n}]),...[...Ot,[`Found while analyzing`,`discoveredIn`]].map(([e,t])=>[e.toLowerCase(),(e,n)=>{e[t]=q(n)??n}]),[`location`,(e,t)=>Object.assign(e,Gt(t))],[`severity`,(e,t)=>Object.assign(e,Jt(t))],[`confidence`,(e,t)=>{let n=/^(\d+(?:\.\d+)?)\/10$/u.exec(t);n&&(e.confidence=Number(n[1]))}],[`revalidation`,(e,t)=>{let n=nn(t);n&&(e.revalidate=n)}],[`revalidated by`,(e,t)=>{let n=t.trim();n&&(e.revalidateSource=Bt.get(n.toLowerCase())??n)}],[`repository`,(e,t)=>{e.repo={github:$t(t)}}],[`introduced in`,(e,t)=>{e.commitHash=en(t)}],[`package`,(e,t)=>{e.package=tn(t)}],[`priority`,(e,t)=>{e.priority=/^-?\d+(?:\.\d+)?$/u.test(t)?Number(t):t}]]);function an(e,t,n){let r=rn.get(t.trim().toLowerCase());r&&r(e,n.trim())}var on=/^- \*\*([^*\n]+?):\*\* ?(.*)$/u;function sn(e){let t=e.split(`
|
|
45
|
+
`),n=0,r=()=>{for(;n<t.length&&!t[n].trim();)n++},i=()=>{let e=[];for(let r;(r=on.exec(t[n]??``))!==null;n++)e.push([r[1].trim(),r[2].trim()]);return e};r();let a=i();if(a.length>0)return{title:``,facts:a,rest:t.slice(n).join(`
|
|
46
|
+
`)};let o=[];for(;n<t.length&&t[n].trim();)o.push(t[n++]);return r(),a=i(),a.length===0?{title:``,facts:a,rest:e}:{title:U(o.join(`
|
|
47
|
+
`).trim()),facts:a,rest:t.slice(n).join(`
|
|
48
|
+
`)}}var cn=/^(\d+)\. (.*)$/u;function ln(e){let t=[],n=x(e),r=0;for(let i of e.split(`
|
|
49
|
+
`)){let e=S(n,r)?null:cn.exec(i);r+=i.length+1,e?t.push({ref:e[2].trim(),indent:e[1].length+2,note:[]}):t.length>0&&t.at(-1).note.push(i)}return t.map(e=>un(e))}function un({ref:e,indent:t,note:n}){let r={},i=J(e),a=Vt(e),o=a===null?q(i?i.label:e):null;o!==null&&Object.assign(r,Ht(o));let s=i?i.url:a;L(s)&&(r.url=s);let c=U(n.map(e=>e.slice(Math.min(t,/^ */u.exec(e)[0].length))).join(`
|
|
50
|
+
`).trim());return c&&(r.text=c),r}var dn=new Map(Et.map(([e,t])=>[e.toLowerCase(),t])),fn=[...dn.keys()];function pn(e){let t=e.length,n=1/0;for(let r=e.length-1;r>=0;r--){let i=fn.indexOf(e[r].label.toLowerCase());if(i===-1||i>=n)break;n=i,t=r}return{paragraphs:e.slice(0,t),fields:e.slice(t).map(e=>[dn.get(e.label.toLowerCase()),e.body])}}function mn(e,t,n){let r=[],i=P(t),a=e.endsWith(`…`)?e.slice(0,-1).trimEnd():``;!e||i===e||a&&i.startsWith(a)?r.push(t):r.push(e,t);for(let{label:e,body:t}of n)r.push(t?`**${e}:** ${t}`:`**${e}:**`);return r.filter(Boolean).join(`
|
|
51
|
+
|
|
52
|
+
`)}var hn=/^<!--\s*DeepView findings export\b[^>]*-->/u,gn=/^Case \d+ of \d+(?:\s|$)/u,_n=/^- \*\*([^*\n]+?):\*\* ?(.*)$/gmu,vn=new Set([`evidence`,`severity correction`,`comment`]);function yn(e){let t=C(e).trim();if(!hn.test(t))return null;let{head:n,subs:r}=E(t,oe),i=[];for(let{heading:e,body:t}of r){if(e.trim().toLowerCase()===`summary`)continue;let n=bn(e);for(let e of D(t,se))i.push(Sn(e,n))}return Tn(xn(n),i)}function bn(e){let t=/^(.*?)\s*\(\d+\)\s*$/u.exec(e.trim());return Wt(t?t[1]:e)}function xn(e){let t=new Map;for(let n of e.matchAll(_n)){let e=n[1].trim().toLowerCase();t.has(e)||t.set(e,n[2].trim())}return{sources:(t.get(`source`)??``).split(`,`).map(e=>Qt(e).source).filter(Boolean),analyzers:(t.get(`analyzer`)??t.get(`analyzers`)??``).split(`;`).map(e=>e.trim()).filter(Boolean),repo:t.has(`repository`)?$t(t.get(`repository`)):``}}function Sn({heading:e,body:t},n){let r=e.trim().replace(/^\d+\.\s+/u,``),i=D(t,w).filter(e=>gn.test(e.heading.trim()));return i.length===0?[Cn(t,w,r,n)]:i.map(e=>Cn(e.body,ce,r,n))}function Cn(e,t,n,r){let{title:i,facts:a,rest:o}=sn(e),{head:s,subs:l}=E(o,t),u=l.map(e=>({label:e.heading.trim(),body:e.body.trim()})),d={file:`unknown`,line:`?`},f=null;for(let[e,t]of a)e.trim().toLowerCase()===`analyzer`?f=Qt(t):an(d,e,t);d.severity||=r||`medium`;let p=i||n,m=p!==`Untitled finding`&&p!==I(d),{paragraphs:h,fields:g}=pn(u.filter(e=>!vn.has(e.label.toLowerCase())).map(e=>({label:e.label,body:U(e.body)})));d.description=mn(m?p:``,U(s.trim()),h);let _=u.filter(e=>e.label.toLowerCase()===`evidence`).flatMap(e=>ln(e.body));_.length>0&&(d.evidence=_);for(let[e,t]of g)d[e]=t;let v=u.find(e=>e.label.toLowerCase()===`severity correction`);return v?.body&&(d.correctedSeverityReason=U(v.body)),{finding:c(d),analyzer:f}}function wn(e,t){let n={source:null,run:{}};if(t.some(e=>e.analyzer!==null)){let e=new Set(t.map(e=>e.analyzer?.source??null));e.size===1&&!e.has(null)&&([n.source]=e);for(let e of t)e.analyzer?.run?Object.assign(e.finding,e.analyzer.run):e.analyzer?.source&&!n.source&&(e.finding.source=e.analyzer.source);return n}let r=e.analyzers.length===1?Qt(e.analyzers[0]):null;return r?.source?n.source=r.source:r?.run?n.run=r.run:e.analyzers.length===0&&e.sources.length===1&&([n.source]=e.sources),n}function Tn(e,t){let n=t.flat(),{source:r,run:i}=wn(e,n),a={},o=new Set(n.map(e=>e.finding.type).filter(Boolean)),s=i.type??(o.size===1?[...o][0]:null)??(r?`security`:null);s&&(a.type=s),r&&(a.source=r);for(let e of[`model`,`effort`,`exportsMode`])i[e]&&(a[e]=i[e]);e.repo&&(a.repo={github:e.repo});let c=t.map(e=>e.map(e=>e.finding));return c.every(e=>e.length===1)?a.findings=c.flat():a.groups=c,a}var En=`markdown-generic`,Dn=[`#`,`id`,`product`,`priority`,`vulnerability`],On=[`title`,`description`,`root cause`,`code references`,`attack scenario`,`steps to reproduce`,`impact`,`patch`],kn=/^(?:#{3,6}[ \t]+)?(?:\*\*)?(Title|Description|Root Cause|Code references|Attack Scenario|Steps to Reproduce(?:[ \t]+.*?)?|Impact|Patch):?(?:\*\*)?(?:[ \t]+#+)?[ \t]*$/gimu,An={P0:`critical`,P1:`high`,P2:`medium`,P3:`low`,P4:`informational`},Y=e=>e.trim().slice(1,-1).split(`|`).map(e=>e.trim());function X(e,t){if(!e)throw Error(`Markdown (generic): unsupported ${t}`)}function jn(e){return[...new Set(e.split(`
|
|
53
|
+
`).map(e=>e.trim()).filter(Boolean))].map(e=>{X(/^https?:\/\/[^\s()[\]{}"'<>`\\]+$/iu.test(e)&&!/[.,;!?]$/u.test(e),`link syntax; use bare URLs on separate lines`);let t;try{t=new URL(e)}catch{X(!1,`URL`)}let[n,r,i,a,...o]=t.pathname.slice(1).split(`/`);X([`github.com`,`www.github.com`].includes(t.hostname)&&!t.username&&!t.password&&!t.port&&[n,r].every(e=>e&&/^[\w-][\w.-]*$/u.test(e)),`repository URL`),X(o.every(Boolean),`repository path; empty components`);let s=`${n}/${r.replace(/\.git$/iu,``)}`.toLowerCase(),c=/^#L(\d+)(?:-L?(\d+))?$/u.exec(t.hash),l=i===`blob`?o.slice(0,-1):i===`tree`?o:[];try{l=l.map(decodeURIComponent)}catch{X(!1,`repository directory encoding`)}return X(l.every(e=>e===e.trim()&&!/[\\/:?#\p{Cc}]/u.test(e)),`repository directory`),{repo:s,ref:a,directory:l,...i===`blob`&&o.length&&{evidence:{file:o.join(`/`),line:c?c.slice(1).filter(Boolean).join(`-`):`?`,url:e}}}})}function Mn(e,t,n,r){let i=jn(n),a=i[0]?.repo;X(a&&i.every(e=>e.repo===a),`repository set for finding ${e.id}; expected exactly one repository`),X(!e.group.github||e.group.github===a,`repository set for product ${e.product}; expected exactly one repository`);let o=r.get(a);X(o===void 0||o===e.prefix,`repository ID prefixes for ${a}; expected ${o}, got ${e.prefix} (${e.id})`),r.set(a,e.prefix),e.group.github=a,e.group.directories.push(...i.map(e=>e.directory));let s=i.flatMap(e=>e.evidence??[]);if(s.length){Object.assign(t,{file:s[0].file,line:s[0].line,location:s[0].url,evidence:s});let e=i.find(e=>e.evidence).ref;T(e)&&(t.commitHash=e)}}function Nn(e){let t=e[0];for(let n of e.slice(1)){let e=0;for(;e<t.length&&t[e]===n[e];)e++;t=t.slice(0,e)}return t.join(`/`)}function Pn(e){let t=C(e).trim(),n=[...t.matchAll(/^## +(.*)$/gmu)];if(!n.some(e=>/^\d+\.\s+\S+/u.test(e[1]))&&(n.length||t.startsWith(`# `)))return null;let r=[...t.matchAll(/^\|[^\n]*\|$/gmu)].find(([e])=>Y(e).map(e=>e.toLowerCase()).join()===Dn.join());if(!r)return null;let i=t.slice(0,r.index).trim();X(!i||/^# [^\n]+$/u.test(i),`summary preamble`),X(r.index<(n[0]?.index??t.length),`summary position`);let a=t.slice(r.index,n[0]?.index).trim().split(`
|
|
54
|
+
`),o=new Set(Y(a[0]).map(e=>e.toLowerCase()));X(a[1]&&Y(a[1]).length===5&&Y(a[1]).every(e=>/^:?-{3,}:?$/u.test(e)),`summary separator`);let s=new Map,c=new Map,l=new Map;for(let e of a.slice(2).filter(e=>e.trim())){X(/^\|.*\|$/u.test(e)&&Y(e).length===5,`summary row`);let[t,n,r,i]=Y(e),a=/^(.+-)\d+$/u.exec(n)?.[1];X(/^\d+$/u.test(t)&&a&&r&&Object.hasOwn(An,i)&&!l.has(n),`summary values for ${n}`);let o=s.get(r)??{directories:[],rows:[]},c={raw:e,id:n,prefix:a,product:r,priority:i,group:o};l.set(n,c),o.rows.push(c),s.set(r,o)}X(l.size,`empty summary`);for(let[e,r]of n.entries()){let i=/^\d+\.\s+(\S+)\s*$/u.exec(r[1])?.[1],a=l.get(i);X(a&&!a.finding,`finding section ${r[1]}`);let s=t.slice(r.index,n[e+1]?.index),u=s.slice(r[0].length+1),d=new Map,f=[...u.matchAll(kn)];for(let[e,t]of f.entries()){let n=t[1],r=n.toLowerCase().replace(/^steps to reproduce\b.*$/u,`steps to reproduce`);X(!d.has(r),`duplicate section ${n}`),d.set(r,{heading:n,body:u.slice(t.index+t[0].length,f[e+1]?.index).trim()})}X(On.every(e=>d.has(e)),`missing required headers for ${i}`),X(!u.slice(0,f[0].index).trim(),`text before field headers for ${i}`);let p=d.get(`title`)?.body;X(p,`missing Title for ${i}`);let m={sourceId:i,_idBasis:{source:En,row:a.raw.trim(),section:s.trim()},product:a.product,priority:a.priority,severity:An[a.priority],file:`unknown`,line:`?`};o.has(`vulnerability`)&&(m.security=!0);let h=[p];for(let[e,t]of d)e===`title`||e===`code references`||(e===`steps to reproduce`?m.reproduction=t.body:e===`patch`?m.recommendation=t.body:h.push(e===`description`?t.body:`**${t.heading}:**
|
|
55
|
+
${t.body}`));m.description=h.join(`
|
|
56
|
+
|
|
57
|
+
`),Mn(a,m,d.get(`code references`).body,c),a.finding=m}return X([...l.values()].every(e=>e.finding),`missing finding sections`),[...s].map(([e,t])=>({displayName:e,data:{type:`security`,source:En,product:e,repo:{github:t.github,directory:Nn(t.directories)},findings:t.rows.map(({finding:e})=>({...e,repo:{github:t.github}}))}}))}function Fn(e){let t=Pn(e);return t===null?null:t.length===1?t[0].data:{type:`security`,source:En,findings:t.flatMap(({data:e})=>e.findings)}}var In=new Set([`critical`,`high`,`medium`,`low`,`high_bug`,`bug`,`informational`]);function Ln(e){let t=Rn(e);if(!t)return null;let{severity:n,description:r,location:i,file:a,line:o}=t;return i?{severity:n,description:r,location:i}:{severity:n,description:r,file:a,line:o}}function Rn(e){let t=e.indexOf(`
|
|
58
|
+
`),n=(t===-1?e:e.slice(0,t)).trim();if(!n)return null;let{sectionsText:r,metaText:i}=zn(t===-1?``:e.slice(t+1)),a=Bn(r),o=Vn(i),{file:s,line:c,locationLink:l}=Hn(a.location||``),u=(o.severity||``).toLowerCase();return{severity:In.has(u)?u:`medium`,description:Un(n,a),location:l,file:s||`unknown`,line:c}}function zn(e){let t=/^---\s*$/mu,n=t.exec(e);if(!n)return{sectionsText:e,metaText:``};let r=e.slice(0,n.index).trim(),i=e.slice(n.index+n[0].length).replace(/^\n/u,``),a=t.exec(i);return{sectionsText:r,metaText:a?i.slice(0,a.index):i}}function Bn(e){let t={},n=e.split(/^## /mu);for(let e=1;e<n.length;e++){let r=n[e],i=r.indexOf(`
|
|
59
|
+
`),a=(i===-1?r:r.slice(0,i)).trim().toLowerCase(),o=(i===-1?``:r.slice(i+1)).trim();a&&(t[a]=o)}return t}function Vn(e){let t={};for(let n of e.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))t[n[1].trim().toLowerCase()]=n[2].trim();return t}function Hn(e){let t=``,n=`?`,r=``,i=e.match(/\[([^\]]+)\]\(([^)]+)\)/u);if(i){t=i[1].trim(),r=i[2];let e=i[2].match(/#L(\d+)/u);e&&(n=e[1])}else t=e.trim(),r=e.trim();let a=t.match(/^(.+):(\d+)$/u);return a&&(t=a[1],n===`?`&&(n=a[2])),{file:t,line:n,locationLink:r}}function Un(e,t){let n=[e];return t.details&&n.push(t.details),t.impact&&n.push(`Impact: ${t.impact}`),t[`reproduction steps`]&&n.push(`Reproduction: ${t[`reproduction steps`]}`),Wn(n.join(`
|
|
60
|
+
|
|
61
|
+
`))}function Wn(e){return e.replaceAll(`**`,``)}var Gn=new Set([...j,`informative`]);function Kn(e){let t=C(e).trim();if(!t.startsWith(`# `))return null;let n=de(t,/^# /gmu).slice(1).filter(e=>e.trim().length>0).map(e=>qn(e)).filter(Boolean);return n.length===0?null:{type:`security`,source:`claude-security`,findings:n}}function qn(e){let{title:t,body:n}=O(e);if(!t)return null;let{sectionsText:r,metaText:i}=Jn(n),a=Yn(r),o=Object.fromEntries([...i.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu)].map(e=>[e[1].trim().toLowerCase(),e[2].trim()])),s=nr(a.evidence||``),{file:l,line:u,locationLink:d}=Xn(a.location||s[0]?.ref||``),f=(o.severity||``).toLowerCase(),p=Gn.has(f)?f:`medium`,m=ir(t,a,s.length>0),h={file:l||`unknown`,line:u,severity:p,description:m};d&&(h.location=d),s.length>0&&(h.evidence=s.map(rr)),a[`reproduction steps`]&&(h.reproduction=Zn(a[`reproduction steps`])),a[`recommended fix`]&&(h.recommendation=a[`recommended fix`]),o.repository&&(h.repo={github:o.repository}),o.branch&&(h.branch=o.branch),o[`date created`]&&(h.dateCreated=o[`date created`]),o.status&&(h.status=o.status),o.category&&(h.category=o.category);let g=e.indexOf(`
|
|
62
|
+
# `),_=Ln(g===-1?e:e.slice(0,g+1));return _&&(h._idBasis=_),c(h)}function Jn(e){let t=/^---\s*$/mu,n=t.exec(e);if(!n)return{sectionsText:e,metaText:``};let r=e.slice(0,n.index).trim(),i=e.slice(n.index+n[0].length).replace(/^\n/u,``),a=t.exec(i);return{sectionsText:r,metaText:a?i.slice(0,a.index):i}}function Yn(e){let t=e.split(/^## /mu).slice(1).map(e=>O(e));return Object.fromEntries(t.filter(e=>e.title).map(e=>[e.title.toLowerCase(),e.body.trim()]))}function Xn(e){let t=``,n=`?`,r=``,i=k(e);if(i){t=i.label.trim(),r=i.url.trim();let e=r.match(/#L(\d+)(?:-L?(\d+))?/u);e&&(n=e[2]?`${e[1]}-${e[2]}`:e[1])}else t=e.trim(),r=e.trim();t=we(t.replaceAll("`",``)).trim();let a=t.match(/^(.+):(\d+)(?:\s*[-\u2013\u2014]\s*L?(\d+))?$/u);return a&&(t=a[1],n===`?`&&(n=a[3]?`${a[2]}-${a[3]}`:a[2])),{file:t,line:n,locationLink:r,linked:i!==null}}function Zn(e){let t=e.split(`
|
|
63
|
+
`),n=t.findIndex(e=>e.trim());if(n===-1||!v.test(t[n])||t.some((e,t)=>t!==n&&v.test(e)))return e;let r=t[n].replace(/^ */u,``),i=r.replace(v,``);if(!i.trim())return e;let a=er(i)??er(r);if(a===null&&(v.test(i)||$n.test(r)))return e;let o=a===null?[i]:a.length===1?[a[0].step]:a.map(({number:e,step:t})=>`${e}. ${t}`);return t.splice(n,1,...o),t.join(`
|
|
64
|
+
`)}var Qn=/(?:^|[ \t])(\d{1,9})\)(?=[ \t]|$)/gu,$n=/^\d{1,9}\)(?=[ \t]|$)/u;function er(e){let t=[...e.matchAll(Qn)];if(t.length===0||t[0].index!==0)return null;let n=[];for(let[r,i]of t.entries()){let a=Number(i[1]);if(r>0&&a<=n[r-1].number)return null;let o=e.slice(i.index+i[0].length,t[r+1]?.index).trim();if(!o)return null;n.push({number:a,step:o})}return n}var tr=/^[ \t]*(?:\d+[.)]|[-*+])\s+/u;function nr(e){let t=[];for(let n of e.split(`
|
|
65
|
+
`))tr.test(n)?t.push({ref:n.replace(tr,``).trim(),note:[]}):t.length>0&&n.trim()&&t.at(-1).note.push(n.trim());if(t.length===0){let n=e.split(`
|
|
66
|
+
`).map(e=>e.trim()).filter(Boolean),r=n.findIndex(e=>k(e)!==null);if(r===-1&&n.length!==1)return[];let i=r===-1?0:r;t.push({ref:n[i],note:n.filter((e,t)=>t!==i)})}return t.filter(e=>e.ref)}function rr({ref:e,note:t}){let{file:n,line:r,locationLink:i,linked:a}=Xn(e),o={file:n||`unknown`,line:r};i&&a&&(o.url=i);let s=t.join(`
|
|
67
|
+
`);return s&&(o.text=s),o}function ir(e,t,n){let r=[e];return t.details&&r.push(t.details),t.evidence&&!n&&r.push(`**Evidence:**
|
|
68
|
+
${t.evidence}`),t.impact&&r.push(`**Impact:** ${t.impact}`),r.join(`
|
|
69
|
+
|
|
70
|
+
`)}function ar(e){let t=(e||``).trim(),n=``,r=/\[([^\]]+)\]\(([^)]+)\)/u.exec(t);r&&(t=r[1].trim(),n=r[2].trim());let i=``,a=/#L(\d+)/u.exec(n);a&&(i=a[1]);let o=[...t.matchAll(/`([^`]+)`/gu)].map(e=>e[1].trim()).find(e=>!e.includes(`(`)&&(e.includes(`/`)||/\.\w/u.test(e)))??(t.replaceAll("`",``).trim().split(/[\s,]+/u).find(Boolean)||``),s=/^(.*?)#L(\d+)(?:-L?\d+)?$/u.exec(o);s&&(o=s[1],i||=s[2]);let c=/^(.+):(\d+(?:-\d+)?)$/u.exec(o);return c?(i||=c[2],{file:c[1],line:i,locationLink:n}):{file:o,line:i||`?`,locationLink:n}}function or({severity:e,description:t,ref:n,lineBullet:r=``,id:i=``}){let a=ar(n),o=a.file||`unknown`,s=a.line===`?`&&r?r:a.line,c=a.locationLink||(o===`unknown`&&i?`piolium:${i}`:``);return c?{severity:e,description:t,location:c}:{severity:e,description:t,file:o,line:s}}function Z(e){let t=((e||``).trim().split(/\s+/u)[0]||``).replaceAll(/[`*]+/gu,``);return o.get(t.toUpperCase())??``}function sr(...e){return{severity:e.find(Boolean)||`medium`,identitySeverity:e.find(e=>e&&e!==`informative`)||`medium`}}function cr(e){let t=/^([CHML])-?\d+$/iu.exec((e||``).trim());return t?{C:`critical`,H:`high`,M:`medium`,L:`low`}[t[1].toUpperCase()]:``}function lr(e){return Z(/^(critical|high|medium|low|informational|informative|info)(?:[ -](?:severity|risk))?(?:[ -]findings?)?(?:\s*\(\d+\))?$/iu.exec((e||``).trim())?.[1])}function ur(e){return Z(/^(critical|high|medium|low|informational|informative|info)\b/iu.exec((e||``).trim())?.[1])}function dr(e){return/^variants?\s*(?:\(\d+\))?\s*:?$/iu.test((e||``).trim())}function fr(e){let t=/^([CHML]-?\d{1,4}|(?:p|q|b|r|m|l|x|diff)\d{0,4}-\d{2,4})(?:-([A-Za-z0-9][\w-]*))?$/iu.exec(e||``);return t?{id:t[1].toUpperCase(),slug:t[2]||``}:null}function pr(e){return(e||``).replaceAll(`-`,` `)}function mr(e){let t=(e||``).trim(),n=/^\[([^\]]+)\]\([^)]*\)$/u.exec(t);return Te(n?n[1]:t).toUpperCase()}function hr(e){let t=/^\[([^\]]+)\]\(([^)]+)\)\s*[:\u2014\u2013-]*\s*(.*)$/u.exec(e);return t?{text:t[3]?`${t[1].trim()} ${t[3].trim()}`:t[1].trim(),link:t[2].trim()}:null}function gr(e){let t=e.search(/\s/u),n=fr((t===-1?e:e.slice(0,t)).replace(/[:.,\u2014\u2013-]+$/u,``));if(!n)return null;let r=(t===-1?``:e.slice(t+1)).replace(/^[:\u2014\u2013-]+\s*/u,``).trim();return{id:n.id,slug:n.slug,rest:r}}function _r(e){let{text:t,link:n}=hr(e)??{text:e,link:``},r=/^\[([^\]]+)\] *(.*)$/u.exec(t);if(r){let e=fr(r[1].trim());return e?{id:e.id,title:r[2].trim()||pr(e.slug)||e.id,link:n}:{id:r[1].trim().toUpperCase(),title:r[2].trim(),link:n}}let i=gr(t);return i?{id:i.id,title:i.rest||pr(i.slug)||i.id,link:n}:{id:``,title:t.trim(),link:n}}function vr(e){let t={},n=t=>{let n=t.exec(e||``)?.[1];return n===void 0?``:(/`([^`]+)`/u.exec(n)?.[1]??n.split(/\s+/u)[0]??``).trim()},r=n(/^\s*(?:[-*] +)?\*\*Target:?\*\*\s*(.*)$/imu);at(r)&&(t.repo=r);let i=n(/^\s*(?:[-*] +)?\*\*Commit[^:*]*:?\*\*\s*(.*)$/imu);return T(i)&&(t.commitHash=i),t}var yr=[`key code reference`,`key code`,`code reference`,`location`,`affected file`,`file`,`path`];function br(e){return{id:mr(e.id||``),title:A(e.title),severity:A(e.severity),pocStatus:A(e[`poc status`]||e.poc),status:A(e.status),parent:mr(A(e.parent||``)),location:A(e.location)}}function xr(e,t=``){let{severity:n,identitySeverity:r}=sr(Z(e.severity),t,cr(e.id)),i=Sr({ref:e.location||``,id:e.id,severity:n,identitySeverity:r,description:he(e.title||e.id)});for(let t of[`pocStatus`,`status`,`parent`])e[t]&&(i[t]=e[t]);return c(i)}function Sr({ref:e,lineBullet:t=``,id:n,severity:r,identitySeverity:i,description:a}){let{file:o,line:s,locationLink:c}=me(e),l={file:o||`unknown`,line:s===`?`&&t?t:s,severity:r,description:a};return c?l.location=c:l.file===`unknown`&&n&&(l.location=`piolium:${n}`),l._idBasis=or({severity:i,description:a,ref:e,lineBullet:t,id:n}),l}function Cr(e,t,n){let r=[];for(let i of e.split(`
|
|
71
|
+
`)){let e=/^\s{0,3}(?:[-*+]|\d{1,3}[.)])\s+(.+)$/u.exec(i);if(!e)continue;let a=e[1].trim();if(/^\*\*[^:*]+:\*\*/u.test(a))continue;let o=hr(a),s=o?.link??``;if(o)a=o.text;else{let e=/^\*\*([^*]+)\*\*\s*[:\u2014\u2013-]*\s*(.*)$/u.exec(a);e&&(a=e[2]?`${e[1].trim()} ${e[2].trim()}`:e[1].trim())}if(/^(?:none\b|no |n\/a\b)/iu.test(a))continue;let l=gr(a),u=l?.id??``,d=a;if(l){let e=pr(l.slug);d=e&&l.rest?`${e}
|
|
72
|
+
|
|
73
|
+
${l.rest}`:l.rest||e||l.id}let f=n.get(u),{severity:p,identitySeverity:m}=sr(Z(f?.severity),t,cr(u)),h={file:`unknown`,line:`?`,severity:p,description:he(d)};u?h.location=`piolium:${u}`:s&&(h.location=s),s.endsWith(`report.md`)&&(h.reportPath=s);for(let e of[`pocStatus`,`status`,`parent`])f?.[e]&&(h[e]=f[e]);r.push({id:u,finding:c(h,m)})}return r}function wr(e,t,n,r=``){let i=[];for(let a of fe(e)){let e=br(a);!e.id&&!e.title||(!e.parent&&n&&(e.parent=n),e.id&&!t.has(e.id)&&t.set(e.id,e),i.push({id:e.id,finding:xr(e,r)}))}if(i.length>0)return i;let a=Cr(e,r,t);for(let e of a)n&&!e.finding.parent&&(e.finding.parent=n);return a}var Tr=new Set([`technical findings detail`,`technical findings`,`detailed findings`,`findings detail`,`findings`]),Er=/^(?:summary of findings\b|deferred|methodolog|executive|conclusion|attack surface|coverage|discoveries|scope\b|table of contents|contents\b|appendix|recommendation|remediation)/u;function Dr(e){let{id:t}=_r(e);return!!(t&&fr(t))}function Or(e){let t=D(e,se);return(t.length>0?t:D(e,w)).some(({heading:e})=>Dr(e))}function kr(e){let t=C(e).trim();if(!/^# +Security Audit Report\b/mu.test(t)&&!/^## +Technical Findings Detail\s*$/imu.test(t)&&!/^## +Findings by Severity\b/imu.test(t))return null;let{head:n,subs:r}=E(t,oe),i=Ir(r),a=new Map(fe(i[`summary of findings`]||``).map(br).filter(e=>e.id).map(e=>[e.id,e])),o=vr(n),s=[],c=new Set,l=[],u=({id:e,finding:t})=>{s.push(t),e&&c.add(e)},d=e=>{for(let t of e)u(t)};for(let[e,t]of Object.entries(i)){let n=lr(e);n||Tr.has(e)||e.startsWith(`findings by severity`)?d(Pr(t,n,a,l)):!Er.test(e)&&Or(t)&&d(Pr(t,ur(e),a,l))}for(let e of l)(!e.id||!c.has(e.id))&&u(e);for(let e of a.values())c.has(e.id)||u({id:e.id,finding:xr(e)});if(s.length===0)return null;for(let e of s)o.repo&&(e.repo={github:o.repo}),o.commitHash&&!e.auditedCommit&&(e.auditedCommit=o.commitHash);return{type:`security`,source:`piolium`,findings:s}}function Ar(e,t,n,r){let i=[],a=``;for(let{heading:o,body:s}of e){let e=lr(o);if(e)i.push(...Pr(s,e,t,n)),a=``;else if(dr(o))i.push(...Mr(s,t,a,n,r));else{let e=jr(o,s,t,n,r);i.push(...e),a=e[0]?.id||a}}return i}function jr(e,t,n,r,i){let{head:a,subs:o}=E(t,w),s=Fr(e,a,n,i),c=s!==null&&!s.id&&o.some(e=>!dr(e.heading)&&Dr(e.heading)),l=s&&!c?[s]:[];return l.push(...Nr(o,n,r,i,s?.id||``)),l}function Mr(e,t,n,r,i){let{head:a,subs:o}=E(e,w);return r.push(...wr(a,t,n,i)),Nr(o,t,r,i,``)}function Nr(e,t,n,r,i){let a=[],o=``;for(let{heading:s,body:c}of e){if(dr(s)){n.push(...wr(c,t,i??o,r));continue}let e=Fr(s,c,t,r);e&&(a.push(e),o=e.id||o)}return a}function Pr(e,t,n,r){let i=D(e,se);if(i.length>0)return Ar(i,n,r,t);let a=Nr(D(e,w),n,r,t,null);if(a.length>0)return a;let o=fe(e).map(br).filter(e=>e.id||e.title);for(let e of o)!e.severity&&t&&(e.severity=t),e.id&&!n.has(e.id)?n.set(e.id,e):e.id||r.push({id:``,finding:xr(e,t)});return o.length===0&&r.push(...Cr(e,t,n)),[]}function Fr(e,t,n,r=``){let i=e.trim();if(!i)return null;let{id:a,title:o,link:s}=_r(i),l=n.get(a);if(!a&&o){let e=o.toLowerCase();l=[...n.values()].find(t=>t.title.toLowerCase()===e),a=l?.id??``}let{fields:u,labels:d,prose:f}=pe(t),{severity:p,identitySeverity:m}=sr(Z(u.severity),Z(l?.severity),r,cr(a)),h=/\d+/u.exec(u.line||u.lines||``)?.[0]??``,g=/\*\*Variant of:?\*\*\s*\[?([^\]\s)]+)/iu.exec(t),_=f.split(`
|
|
74
|
+
`).filter(e=>!/^\s*<a\s[^>]*>\s*<\/a>\s*$/iu.test(e)&&!/\*\*Variant of:?\*\*/iu.test(e)).join(`
|
|
75
|
+
`).trim(),v=Sr({ref:yr.map(e=>u[e]).find(Boolean)??``,lineBullet:h,id:a,severity:p,identitySeverity:m,description:Rr(o||a,u,d,_)}),ee=u[`poc status`]||u.poc||l?.pocStatus;ee&&(v.pocStatus=ee);let y=u[`detailed report`]||(s.endsWith(`report.md`)?s:``);y&&(v.reportPath=y),l?.status&&(v.status=l.status);let te=l?.parent||(g?mr(g[1]):``);return te&&(v.parent=te),{id:a,finding:c(v)}}function Ir(e){let t=Object.create(null);for(let{heading:n,body:r}of e){let e=n.trim().toLowerCase();e&&(t[e]=e in t?`${t[e]}
|
|
76
|
+
${r}`:r)}return t}var Lr=new Set([...yr,`severity`,`summary`,`files`,`poc`,`poc status`,`line`,`lines`,`detailed report`,`proof of concept`,`evidence`,`variant of`,`pattern`,`status`,`id`,`title`]);function Rr(e,t,n,r){let i=[e];t.summary&&i.push(t.summary),r&&i.push(r);for(let[e,r]of Object.entries(t))!r||Lr.has(e)||i.push(`**${n[e]||e}:** ${r}`);return i.filter(Boolean).join(`
|
|
77
|
+
|
|
78
|
+
`)}var zr=`<!-- DeepView findings export -->`,Br={annotation:()=>null,location:e=>typeof e?.location==`string`?e.location:null,evidence:e=>typeof e?.url==`string`?e.url:null,commit:()=>null,report:()=>null};function Vr(e,t){let n=e=>typeof e?.source==`string`&&e.source?e.source:null;if(e.length===1)return t=>n(t)??e[0].source??null;let r=new Map(e.map(e=>[e.name,e.source??null]));return e=>n(e)??r.get(t.report(e))??null}function Hr(e,t,n){let r=e.view?.revalidation!==!1,i=(Array.isArray(e.reports)?e.reports:[]).filter(e=>e&&typeof e==`object`),a=Vr(i,t),o=e=>Tt(e,a(e),r),s=new Set(n.map(o)),c=new Set(n.map(e=>t.report(e)).filter(Boolean));return{hooks:t,analyzerOf:o,severityMode:e.view?.severityMode===`original`?`original`:`corrected`,revalidation:r,showAnalyzer:s.size>1,showReport:c.size>1||i.length>1,repo:typeof e.repo==`string`&&e.repo?e.repo:null}}function Ur(e){if(!e)return``;let t=[e.bucket?`${e.bucket} findings`:`Live findings`];return e.severityMode===`original`?t.push(`original analyzer severities`):e.severityMode===`corrected`&&t.push(`corrected severities`),e.revalidation===!1?t.push(`code view — the revalidation pass is not applied`):e.revalidation===!0&&(e.revalidationDetail===!0?t.push(`detailed app view — the revalidation pass is applied, with the rows it re-rated`):e.revalidationDetail===!1?t.push(`app view — the revalidation pass is applied, standing in for the rows it re-rated`):t.push(`app view — the revalidation pass is applied`)),t.join(` · `)}function Wr(e){if(!e)return``;let t=Number(e.included)||0,n=Number(e.total)||0;return n===0?`no findings`:t>=n?`all ${V(n,`finding`)}`:`${t} of ${V(n,`finding`)} (${n-t} filtered out)`}function Gr(e,t,n){let r=[],i=(e,t)=>{t&&r.push(`- **${e}:** ${t}`)},a=Array.isArray(e.reports)?e.reports:[],o=[...new Set(a.map(e=>f[e?.source]??``).filter(Boolean))];i(`Source`,o.join(`, `));let s=a.map(e=>e?.name).filter(Boolean);i(s.length===1?`Report`:`Reports`,s.map(e=>R(e)).join(`, `)),i(`Workspace`,typeof e.workspace==`string`?e.workspace.trim():``),t.repo&&i(`Repository`,wt(t.repo));let c=[...new Set(n.map(t.analyzerOf).filter(Boolean))],l=c.length===o.length&&c.every(e=>o.includes(e));return c.length>0&&!l&&i(c.length===1?`Analyzer`:`Analyzers`,c.join(`; `)),e.generatedAt&&i(`Exported`,Xe(e.generatedAt)),i(`View`,Ur(e.view)),Array.isArray(e.filters)&&i(`Filters`,e.filters.length>0?e.filters.map(e=>`${e.label}: ${e.value}`).join(` · `):`none`),i(`Included`,Wr(e.counts)),r.join(`
|
|
79
|
+
`)}function Kr(e,t){let n=Map.groupBy(e,e=>Ae(e[0],t.severityMode)??`informational`),r=[...j,...[...n.keys()].filter(e=>!j.includes(e))],i=new Set,a=[];for(let e of r)for(let t of n.get(e)??[]){let n=a.length+1,r=Ct(t[0]),o=`${n}. ${r}`;a.push({group:t,number:n,severity:e,title:r,headingText:o,slug:Je(o,i)})}return a}function qr(e){let t=new Map;for(let n of e)t.set(n.severity,(t.get(n.severity)??0)+1);return t}var Jr=[[`flagged`,e=>e.flagged===!0],[`colour-marked`,e=>e.color],[`commented`,e=>e.comment],[`with a fix link`,e=>e.fix]];function Yr(e,t){let n=e.flatMap(({group:e})=>e.map(e=>t.hooks.annotation(e))).filter(Boolean),r=Jr.map(([e,t])=>[n.filter(t).length,e]).filter(([e])=>e>0).map(([e,t])=>`${e} ${t}`);return r.length>0?`Annotations: ${r.join(`, `)}.`:``}function Xr(e){let t=e.some(({group:e})=>e.some(e=>e.confidence!==void 0&&e.confidence!==null)),n=[`#`,`Severity`,`Finding`,`Location`];return t&&n.push(`Confidence`),Ye(n,e.map(e=>{let n=e.group[0],r=e.group.length>1?` (${V(e.group.length,`case`)})`:``,i=I(n),a=[String(e.number),p(e.severity),z(Ge(Ke(e.title)),`#${e.slug}`)+r,i?Ge(R(i)):``];return t&&a.push(n.confidence===void 0||n.confidence===null?``:`${n.confidence}/10`),a}),[`right`])}function Zr(e,t){let n=[B(2,`Summary`)];if(e.length===0)return[...n,`No findings are included.`];let r=[...qr(e)].map(([e,t])=>[p(e),String(t)]);r.push([`**Total**`,`**${e.length}**`]),n.push(Ye([`Severity`,`Findings`],r,[`left`,`right`]));let i=Yr(e,t);return i&&n.push(i),n.push(Xr(e)),n}function Qr(e,t){let n=qr(e),r=[],i=null;for(let a of e)a.severity!==i&&(i=a.severity,r.push(B(2,`${p(i)} (${n.get(i)})`))),r.push(Rt(a.group,t,{headingText:a.headingText,depth:3}));return r}function $r(e={},t={}){let n=Object.fromEntries(Object.entries(Br).map(([e,n])=>[e,typeof t?.[e]==`function`?t[e]:n])),r=(Array.isArray(e.groups)?e.groups:[]).map(e=>Array.isArray(e)?e:[e]).map(e=>e.filter(e=>e&&typeof e==`object`)).filter(e=>e.length>0),i=r.flat(),a=Hr(e,n,i),o=Kr(r,a);return`${Ze([zr,B(1,typeof e.title==`string`&&e.title.trim()?e.title.trim():`Findings`),Gr(e,a,i),...Zr(o,a),...Qr(o,a)])}
|
|
80
|
+
`}var ei=[[`deepview-md`,yn],[`markdown-generic`,Fn],[`deepsec`,xt],[`piolium`,kr],[`claude-security`,Kn]];function Q(e){return Array.isArray(e?.findings)?e.findings:Array.isArray(e?.groups)?e.groups:null}function ti(e,t){return typeof t==`string`&&/\.csv$/iu.test(t)?`codex`:$(e).format}function $(e){let t;try{let t=JSON.parse(e);if(Q(t)){for(let e of ri(Q(t)))c(e);return{data:t,format:`json`,reason:null}}return{data:null,format:null,reason:`JSON, but not a report: no findings array`}}catch(e){t=e}for(let[t,n]of ei)try{let r=n(e);if(r)return{data:r,format:t,reason:null}}catch(e){if(t!==`markdown-generic`)throw e;return{data:null,format:t,reason:e.message}}return{data:null,format:null,reason:`Not JSON, and not a recognized markdown format. (JSON error: ${t.message})`}}function ni(e){let{data:t}=$(e);return t?{count:Q(t).length,source:t.source,recognized:!0}:{count:0,recognized:!1}}function ri(e){return e.flat().filter(e=>e&&typeof e==`object`)}async function ii(e){for(let t of e)c(t);let t=e.filter(e=>!e.id);if(t.length===0)return;let n=await Promise.all(t.map(i));t.forEach((e,t)=>{n[t]&&(e.id=n[t])})}async function ai(e){let{data:t,format:n}=$(e);if(!t)return null;let r=ri(Q(t));return await ii(r),{format:n,data:t,findings:r}}export{n as a,x as b,S as c,we as d,l as e,u as f,d as g,f as h,Ee as i,j,Oe as k,ke as l,Ae as m,je as n,Me as o,M as p,Pe as q,Ie as r,Le as s,N as t,Re as u,F as v,Be as w,Ve as x,Ue as y,I as z,We as A,L as B,nt as C,ot as D,st as E,Pn as F,dt as G,mt as H,$r as I,Q as J,ti as K,$ as L,ni as M,ii as N,ai as O};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e,f as t,g as n,k as r}from"./chunk-4HI2MSAV.js";import{j as i}from"./chunk-7VAWINQF.js";function a(e,t){return e?e.base===``?`${e.other}${t}`:t.startsWith(e.base)?t.slice(e.base.length):null:t}var o=(e,t)=>`${`../`.repeat(e.base.split(`/`).length-1)}${t}`;function s({root:e,paths:t},n,r){if(!e||n===`.`)return n;for(let e of r){let r=t.get(`${n}/${e}`);if(r?.endsWith(`/${e}`))return r.slice(0,-e.length-1)}let i=a(e,`${n}/`);return i===null?o(e,n):i.slice(0,-1)||`.`}function c(e,t){if(!e)return{prefix:t,from:null,to:null};let n=t.startsWith(e.other)?t:``;return{prefix:n,from:`./${e.base}${n.slice(e.other.length)}`,to:`./${n||e.other}`}}function l(...e){let t=new Set;for(let n of e){let e=i(n);for(let[r,i]of Object.entries(n?.bundle?.reason??{}))Array.isArray(i)&&i.some(t=>e.has(t))&&t.add(r)}let n=t=>e.some(e=>{if(e?.kind!==`stasis`)return!1;let n=i(e),r=e?.bundle?.reason?.[t];return new Set(Array.isArray(r)?r.filter(e=>n.has(e)):[]).size<n.size});return[...t].some(n)?[...t].toSorted().map(e=>({id:`reason:${e}`,label:e})):[]}function u(e,t=``){let n=i(e);if(!t||e?.kind!==`stasis`)return n;let r=e?.bundle?.reason?.[t.replace(/^reason:/u,``)],a=new Set(Array.isArray(r)?r:[]);return new Map([...n].filter(([e])=>a.has(e)))}function d(e,t,n,r){return JSON.stringify([e,t,n,r])}function f(e,t=``){let n=new Map;if(e?.kind!==`stasis`||!e.bundle)return n;let r=t?i(e):null,a=t?u(e,t):null;for(let[t,i]of e.bundle.imports)for(let[e,o]of i)for(let[i,s]of o){let o=typeof s==`string`?[[null,s]]:s;for(let[s,c]of o){if(a&&!a.has(e)&&(r.has(e)||!a.has(c)))continue;let o=d(e,i,t,s);n.set(o,{key:o,parent:e,specifier:i,conditions:t,platform:s,target:c})}}return n}var p=(e,{lo:t,start:n},r)=>e[n+(r-t)/2];function m(e,t,{low:n,high:r},i,a){return e===-t||e-1<n||e!==t&&e+1<=r&&p(i,a,e-1)<p(i,a,e+1)?e+1:e-1}function h(e,t,n,{first:r,n:i,m:a,d:o,...s}){e.a.fill(1,0,r).fill(1,i),e.b.fill(1,0,r).fill(1,a);let c=i,l=a;for(let r=o;r>0;r--){let i=c-l,a=m(i,r,s,t,n[r]),o=p(t,n[r],a);for(let t=a>i?o:o+1;t<c;t++)e.a[t]=e.b[t-i]=1;c=o,l=c-a}for(let t=r;t<c;t++)e.a[t]=e.b[t]=1}function g(e,t,n){let r=0,i=t.length,a=e.length,o=2*(a+i);for(;r<a&&r<i&&e[r]===t[r];)r++;for(;a>r&&i>r&&e[a-1]===t[i-1];)a--,i--;let s={high:a-r,low:r-i},c=[r],l=[{lo:1,start:0}];for(let u=0;u<=s.high-s.low;u++){let d=l[u],f=Math.min(u,s.high),g=Math.max(-u,s.low+(s.low+u&1));l.push({lo:g,start:c.length});for(let _=g;_<=f;_+=2){let f=m(_,u,s,c,d),g=p(c,d,f),v=f>_?g:g+1,y=v;for(;v<a&&v-_<i&&e[v]===t[v-_];)v++;if(o+=2+v-y,c.push(v),v>=a&&v-_>=i)return h(n,c,l,{first:r,n:a,m:i,d:u,...s}),o}}throw Error(`no edit script between two lines`)}var _=/[\p{L}\p{N}_$]+|\s+|[^\p{L}\p{N}_$\s]/gu,v=2e3,y=800,b=.6;function x(e,t){if(e.length>v)return null;let n=e.match(_)??[];return n.length>y?null:{line:e,tokens:n,words:n.map(e=>(t.has(e)||t.set(e,t.size),t.get(e)))}}function S({tokens:e,line:t},n){let r=[];for(let i=0,a=0;a<e.length;i+=e[a++].length){if(n[a])continue;let o=r.at(-1);o&&/^\s*$/u.test(t.slice(o[1],i))?o[1]=i+e[a].length:r.push([i,i+e[a].length])}return r}var C=(e,t)=>e.reduce((e,[t,n])=>e+n-t,0)/Math.max(1,t.length);function w(e,t){let n={a:e.words.map(()=>0),b:t.words.map(()=>0)},r=g(e.words,t.words,n),i={a:S(e,n.a),b:S(t,n.b)};return{ranges:i,share:n.a.includes(1)?Math.min(C(i.a,e.line),C(i.b,t.line)):1,steps:r}}function T(e,t){if(e===t)return{a:[],b:[]};let n=new Map,r=x(e,n),i=x(t,n);if(r===null||i===null)return null;let{ranges:a,share:o}=w(r,i);return o<=b?a:null}var E=200,D=5e6,O=6,k=60,A=3;function j(e){let t=new Map;for(let n of e?.tokens??[])t.set(n,(t.get(n)??0)+1);return t}function M(e,t){let n=new Map,r=[e,t].map(e=>e.map(e=>x(e,n))),i=r.map(e=>e.map(j)),a=0,o=(e,t,n)=>{let r=0;for(let[i,o]of e)if(a+=A,(r+=i.length*Math.max(0,o-(t.get(i)??0)))>b*n.length)return 1/0;return r/Math.max(1,n.length)},s=(n,a)=>r[0][n]===null||r[1][a]===null?1/0:Math.min(o(i[0][n],i[1][a],e[n]),o(i[1][a],i[0][n],t[a])),c=(e,t)=>{if(a+=k,s(e,t)===1/0)return 1/0;let{share:n,steps:i}=w(r[0][e],r[1][t]);return a+=i,n<=b?n:1/0},l=new Float64Array(e.length*t.length).fill(NaN);return{share:(n,r)=>{let i=n*t.length+r;return Number.isNaN(l[i])&&(l[i]=e[n]===t[r]?0:c(n,r)),l[i]},floor:s,spent:()=>a}}function N(e,t,{share:n,spent:r}){let i=Array.from({length:e+1},()=>new Float64Array(t+1)),a=(e,t)=>n(e,t)===1/0?-1/0:1e3-n(e,t)+i[e][t];for(let n=0;n<e;n++)for(let e=0;e<t;e++)if(i[n+1][e+1]=Math.max(i[n][e+1],i[n+1][e],a(n,e)),r()>D)return null;let o=[];for(let n=e,r=t;n>0&&r>0;)i[n][r]===i[n][r-1]?r--:i[n][r]===i[n-1][r]?n--:o.push([--n,--r]);return o.toReversed()}function P(e,t,{share:n,floor:r}){let i=[];for(let a=0,o=0;a<e&&o<t;a++){let e=null,s=1/0,c=Array.from({length:Math.min(t,o+O)-o},(e,t)=>[o+t,r(a,o+t)]);for(let[t,r]of c.toSorted((e,t)=>e[1]-t[1]||e[0]-t[0])){if(r>s)break;(n(a,t)<s||n(a,t)===s&&t<e)&&([e,s]=[t,n(a,t)])}e!==null&&(i.push([a,e]),o=e+1)}return i}function F(e,t){if(e.length>E||t.length>E)return[];let n=M(e,t);return N(e.length,t.length,n)??P(e.length,t.length,n)}var I=(e,n,r)=>t(e,n,{...r,discard:!1});function L(e){if(e===null)return``;let t=e.type===`symlink`?e.target:e.data;if(typeof t==`string`)return t.includes(`\0`)?void 0:t;if(!t.includes(0))try{return r(t)}catch{return}}var R=new Set([`none`,`all`,`change`,`trailing`]);function z({horizon:e=1/0,whitespace:t=`none`,ignoreCase:n=!1}={}){if(e!==1/0&&!(Number.isSafeInteger(e)&&e>=0))throw RangeError(`horizon must be a whole number or Infinity, not ${e}`);if(!R.has(t))throw RangeError(`whitespace must be 'none', 'all', 'change' or 'trailing', not ${t}`);if(typeof n!=`boolean`)throw TypeError(`ignoreCase must be a boolean, not ${typeof n}`);return{horizon:e,whitespace:t,ignoreCase:n}}var B=e=>e.reduce((e,{a0:t,a1:n,b0:r,b1:i})=>e+n-t+i-r,0),V=e=>e===``?[]:e.split(/(?<=\n)/u),H=e=>({...e,ignoreCase:!1,whitespace:`none`}),U=e=>(e.whitespace??`none`)!==`none`||!!e.ignoreCase;function W(t,r,i,a,o){let s=V(t),c=V(r),l=(e,t,n,r)=>({a0:e,a1:t,b0:n,b1:r,remove:s.slice(e,t),insert:c.slice(n,r)}),u=o.flatMap(({a0:e,a1:t,b0:n,b1:r})=>e===t||n===r?[l(e,t,n,r)]:I(s.slice(e,t).join(``),c.slice(n,r).join(``),i).map(t=>l(e+t.a0,e+t.a1,n+t.b0,n+t.b1))),d=B(u)<B(a)&&(a=>{try{return n(t,r,a,{format:`normal`,ignoreCase:i.ignoreCase,whitespace:i.whitespace}),!0}catch(t){if(t instanceof e)return!1;throw t}})(u)?u:a;return B(d)<B(o)?d:o}function G(e,t,n){let r=I(e,t,n);return U(n)?W(e,t,n,r,I(e,t,H(n))):r}function K(e,t,n){let r=L(e),i=L(t);if(r===void 0||i===void 0)return{binary:!0,blocks:[],insertions:null,deletions:null};let a=r===i?[]:G(r,i,n),o=(e,t)=>a.reduce((n,r)=>n+r[t]-r[e],0);return{binary:!1,blocks:a,insertions:o(`b0`,`b1`),deletions:o(`a0`,`a1`)}}function q(t,r,i,a){let{whitespace:o,ignoreCase:s}=z(a);try{return n(t,r,i,{format:`normal`,whitespace:o,ignoreCase:s}),!0}catch(t){if(t instanceof e)return!1;throw t}}var J=/[ \t\n\v\f\r]/u,Y=e=>{let t=e.split(`
|
|
2
|
+
`);return t.at(-1)===``&&t.pop(),t};function X(e,t){for(let n=0,r=0;;n++,r++){let i=``,a=``;for(;n<e.length&&J.test(e[n]);)i+=e[n++];for(;r<t.length&&J.test(t[r]);)a+=t[r++];if(i!==a&&new Set(i+a).size>1)return!0;if(n>=e.length||r>=t.length)return!1}}function Z(e,t,n){try{if(!q(e,t,n,{whitespace:`all`}))return!0}catch{return!0}let r=Y(e),i=Y(t),a=0,o=0;for(let e=0;e<=n.length;e++){let t=e<n.length?n[e].a0:r.length;for(;a<t;a++,o++)if(r[a]!==i[o]&&X(r[a],i[o]))return!0;e<n.length&&({a1:a,b1:o}=n[e])}return!1}function Q(e,t,{extension:n=!0}={}){let r=e.split(`/`),i=t.split(`/`),a=0;for(;a<r.length-1&&a<i.length-1&&r[a]===i[a];)a++;let o=0;for(;o<r.length-a-1&&o<i.length-a-1&&r.at(-1-o)===i.at(-1-o);)o++;let s={head:a?`${r.slice(0,a).join(`/`)}/`:``,from:r.slice(a,r.length-o).join(`/`),to:i.slice(a,i.length-o).join(`/`),tail:o?`/${r.slice(-o).join(`/`)}`:``},c=s.from.lastIndexOf(`.`);return n&&!s.from.includes(`/`)&&!s.to.includes(`/`)&&c>0&&s.to.lastIndexOf(`.`)===c&&s.from.slice(0,c)===s.to.slice(0,c)?{...s,head:s.head+s.from.slice(0,c),from:s.from.slice(c),to:s.to.slice(c)}:s}export{T as a,F as b,L as c,z as d,K as e,Z as f,Q as g,a as h,o as i,s as j,c as k,l,u as m,d as n,f as o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=new TextEncoder,t=new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});function n(t){if(typeof t!=`string`)throw TypeError(`encodeUtf8 expects a string, got ${typeof t}`);if(!t.isWellFormed())throw TypeError(`encodeUtf8: input contains lone surrogates`);return e.encode(t)}var r=2;function i(t){if(typeof t!=`string`)throw TypeError(`utf8ByteLength expects a string, got ${typeof t}`);if(/[\u0100-\uFFFF]/.test(t))return e.encode(t).byteLength;let n=/[\u0080-\u00FF]/gu,i=t.length;for(;n.test(t);){let e=n.lastIndex-1;for(let n=0;e<t.length&&n<r;e++)t.codePointAt(e)>127?(i++,n=0):n++;n.lastIndex=e}return i}function a(e){if(!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer))throw TypeError(`decodeUtf8 expects a BufferSource, got ${e===null?`null`:typeof e}`);return t.decode(e)}export{n as a,i as b,a as c};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e}from"./chunk-QB4CBOX2.js";import{b as t,c as n,e as r,f as i,g as a}from"./chunk-6LNQTKAV.js";import{i as o}from"./chunk-FC65TPUB.js";import{J as s}from"./chunk-SXV2T5C4.js";import{a as c}from"./chunk-TUII34K2.js";var l=[`dependencies`,`security`],u={dependencies:`Dependencies`,security:`Security`},d=e(),f=Object.freeze(d.models),p=d.defaultModel,m=`x-upload-encryption`,h=1,g=1,_={name:`X25519`},v=34,y=1048576,b=65536,x=`deepview-managed-upload.v1.content-key`;function S(e,t){let n=new Uint8Array(12);return new DataView(n.buffer).setUint32(7,e),n[11]=+!!t,n}async function C(e,t,n){let r=await crypto.subtle.importKey(`raw`,e,`HKDF`,!1,[`deriveKey`]);return await crypto.subtle.deriveKey({name:`HKDF`,hash:`SHA-256`,salt:t,info:c(x)},r,{name:`AES-GCM`,length:256},!1,[n])}async function w(e){let t=new Uint8Array(await e.slice(0,b).arrayBuffer());if(t.includes(0))return!1;try{return new TextDecoder(`utf-8`,{fatal:!0}).decode(t,{stream:!0}),!0}catch{return!1}}async function T(e,t,n){let r=await w(e),[i,a]=await Promise.all([crypto.subtle.importKey(`raw`,t,_,!1,[]),crypto.subtle.generateKey(_,!1,[`deriveBits`])]),o=new Uint8Array(v);o[0]=h,o[1]=r?g:0,o.set(new Uint8Array(await crypto.subtle.exportKey(`raw`,a.publicKey)),2);let s=await C(await crypto.subtle.deriveBits({name:`X25519`,public:i},a.privateKey,256),o,`encrypt`),c=[new Blob([o])],l=new Uint8Array(y),u=0,d=0,f=async e=>{c.push(new Blob([await crypto.subtle.encrypt({name:`AES-GCM`,iv:S(d++,e)},s,l.subarray(0,u))])),u=0},p=(r?e.stream().pipeThrough(new CompressionStream(`gzip`)):e.stream()).getReader();try{for(let e=await p.read();!e.done;e=await p.read()){n?.throwIfAborted();for(let t=0;t<e.value.length;){u===y&&await f(!1);let n=Math.min(y-u,e.value.length-t);l.set(e.value.subarray(t,t+n),u),u+=n,t+=n}}}catch(e){throw await p.cancel(e).catch(()=>{}),e}return await f(!0),new Blob(c)}var E=null,D=0;function O(){return E?.user.role??null}function k(e){if(e!==null&&!i(e))throw TypeError(`Unknown managed preview role: ${e}. Expected ${r.join(`, `)}.`);D++,E=e===null?null:{user:{id:`preview:${e}`,login:e,name:e[0].toUpperCase()+e.slice(1),role:e,avatarUrl:null,lastSeenAt:Date.now(),lastActivityAt:null},csrfToken:null}}function ee(e,t){let n=new URL(e,`http://managed-preview.invalid`).pathname,r=(t?.method??`GET`).toUpperCase();if(r===`POST`&&n===`/api/auth/logout`)return Response.json({ok:!0});if(r!==`GET`)throw Error(`Changes are not saved in the managed UI preview`);if(n===`/api/auth/session`)return Response.json(E);if(n===`/api/teams`)return Response.json({teams:[]});if(n.startsWith(`/api/admin/`)&&!a(E.user.role,`manage`)||[`/api/admin/users`,`/api/admin/teams`,`/api/admin/repositories`,`/api/admin/repositories/aliases`,`/api/admin/repositories/risk`].includes(n)&&E.user.role!==`admin`)return Response.json({error:`forbidden`},{status:403});if(n===`/api/admin/repositories/risk`)return new Response(`{"type":"repos","repos":[]}
|
|
2
|
+
{"type":"done"}
|
|
3
|
+
`,{headers:{"content-type":`application/x-ndjson`}});let i={"/api/admin/users":{users:[E.user]},"/api/admin/teams":{teams:[],users:[E.user],repos:[],permissions:l},"/api/admin/links":{shares:[]},"/api/admin/repositories":{repositories:[],total:0,connectedCount:0,installUrl:null,tokenMissing:!1},"/api/admin/repositories/aliases":{aliases:[],repos:[]},"/api/admin/repositories/resolve":{location:null},"/api/admin/reports":{reports:[],repos:[],maxBytes:26214400},"/api/admin/bundles":{bundles:[],repos:[],maxBytes:209715200},"/api/admin/history":{history:[],total:0,page:1,limit:100,filters:{repos:[],users:[]}},"/api/admin/scan/models":{models:f,defaultModel:p},"/api/admin/scan-results":{bundles:[],results:[]},"/api/auth/profile":{profile:{login:E.user.login,name:E.user.name,githubName:E.user.name,nameAccount:null,avatarAccount:null,accounts:[]}}};return Object.hasOwn(i,n)?Response.json(i[n]):Response.json({error:`not-found`},{status:404})}var A=3145728,j=new Set([`/api/admin/reports`,`/api/admin/bundles`,`/api/admin/deduplication`]);async function M(e,t){let n=await t(`/api/admin/uploads/key`,{credentials:`same-origin`,signal:e.signal});if(n.status===404||n.status===405)return e;if(!n.ok)return n;let r=(await n.json())?.key;if(typeof r!=`string`)throw Error(`The server sent an invalid upload key`);let i=new Headers(e.headers);return i.set(m,`1`),{...e,headers:i,body:await T(e.body,Uint8Array.fromBase64(r,{alphabet:`base64url`}),e.signal)}}async function N(e,t,n){let r=null;if(e!==`/api/admin/deduplication`&&t.body.size>A){let i=await n(`/api/config`,{credentials:`same-origin`,signal:t.signal});if(!i.ok)return i;let a=(await i.json()).managed,o=a?.uploadMaxBytes?.[e.endsWith(`/reports`)?`reports`:`bundles`];if(Number.isSafeInteger(o)&&o>0&&t.body.size>o)return Response.json({error:`too-large`},{status:413});let s=a?.uploadChunkBytes;Number.isSafeInteger(s)&&s>0&&s<=A&&(r=s)}let i=await M(t,n);return i instanceof Response?i:r==null||i.body.size<=A?await n(e,i):await F(e,i,n,r)}var P=3;async function F(e,t,n,r){let i=t.body,a=crypto.randomUUID(),o=e.endsWith(`/reports`)?`reports`:`bundles`,s=Math.ceil(i.size/r),c=new Headers(t.headers);c.set(`content-type`,`application/octet-stream`);let l=0,u=!1;try{let d=null,f=!1,p=(await Promise.allSettled(Array.from({length:Math.min(P,s)},async()=>{for(;!f&&l<s;){let e=l++;try{let s=await n(`/api/admin/uploads/${o}/${a}/${e}`,{...t,headers:c,body:i.slice(e*r,(e+1)*r)});s.ok||(d??=s,f=!0)}catch(e){throw f=!0,e}}}))).find(e=>e.status===`rejected`);if(p)throw p.reason;if(d)return d;let m=new Headers(t.headers);m.set(`x-upload-id`,a),m.set(`x-upload-parts`,String(s)),m.set(`x-upload-size`,String(i.size));let h=await n(e,{...t,headers:m,body:``});return u=h.ok,h}finally{if(!u&&l>0){let e=new Headers(t.headers);e.set(`x-upload-parts`,String(l)),await n(`/api/admin/uploads/${o}/${a}`,{...t,method:`DELETE`,headers:e,body:void 0,signal:AbortSignal.timeout(1e4)}).catch(()=>{})}}}async function I(e){await e.json().then(e=>e?.error,()=>null)===`view-only`&&globalThis.document?.dispatchEvent(new CustomEvent(`managed-view-only`))}async function L(e,n){if(n?.signal?.throwIfAborted(),E)return ee(e,n);let r=D;async function i(e,n){if(r!==D)throw new DOMException(`Managed session changed`,`AbortError`);let i=t();if(i){if(new URL(e,globalThis.location.origin).origin!==globalThis.location.origin)throw Error(`Public workspace requests must be same-origin`);let t=new Headers(n?.headers);t.set(`x-deepview-share`,i.token),n={...n,headers:t,credentials:`omit`,redirect:`error`}}let a=await fetch(e,{...n,cache:`no-store`});if(r!==D)throw new DOMException(`Managed session changed`,`AbortError`);return a.status===403&&![`GET`,`HEAD`].includes((n?.method??`GET`).toUpperCase())&&I(a.clone()),a}return n?.method===`POST`&&j.has(e)&&n.body instanceof Blob?await N(e,n,i):await i(e,n)}var R=new class{constructor(e=()=>{}){this.resources=new Map,this.session=null,this.teamCatalog=null,this.reportCatalog=null,this.bundleCatalog=null,this.generation=0,this.sessionController=new AbortController,this.notify=e}setSession(e){(this.session?.id!==e?.id||this.session?.role!==e?.role)&&this.reset(),this.session=e}reset(){this.generation++,this.sessionController.abort(),this.sessionController=new AbortController,this.invalidate(),this.session=null,this.teamCatalog=null,this.reportCatalog=null,this.bundleCatalog=null}setReportCatalog(e){let t=new Set,n=new Map(e.map(e=>[e.id,JSON.stringify([e.cacheKey??null,e.reports.map(e=>[e.id,e.cacheKey??null,e.visible!==!1]).toSorted(),(e.bundles??[]).map(e=>[e.id,e.filename,e.repoFullName,e.repoDirectory??``]).toSorted()])]));for(let e of new Set([...this.teamCatalog?.keys()??[],...n.keys()]))this.teamCatalog?.get(e)!==n.get(e)&&t.add(`team:${e}`);for(let e of this.resources.keys())if(e.startsWith(`reports:content:team:`)){let[t]=e.slice(21).split(`:`);(!n.has(t)||this.teamCatalog?.get(t)!==n.get(t))&&this.invalidate([e])}this.teamCatalog=n;let r=new Map;for(let t of e)for(let e of t.reports){let n=r.get(e.id)??[];n.push(JSON.stringify([t.id,e.cacheKey??null])),r.set(e.id,n)}let i=new Map([...r].map(([e,t])=>[e,JSON.stringify(t.toSorted())])),a=this.reportCatalog;this.reportCatalog=i;let o=new Set(t);for(let e of new Set([...a?.keys()??[],...i.keys()]))a?.get(e)!==i.get(e)&&o.add(e);for(let e of this.resources.keys()){if(!e.startsWith(`reports:content:`)||e.startsWith(`reports:content:team:`))continue;let t=e.slice(16);(!i.has(t)||o.has(t))&&(this.invalidate([e]),o.add(t))}let s=new Map;for(let t of e)for(let e of t.bundles??[]){let n=s.get(e.id)??[];n.push(JSON.stringify([t.id,t.cacheKey??null,e.filename,e.repoFullName,e.repoDirectory??``])),s.set(e.id,n)}let c=!1,l=new Map([...s].map(([e,t])=>[e,JSON.stringify(t.toSorted())]));for(let e of new Set([...this.bundleCatalog?.keys()??[],...l.keys()]))this.bundleCatalog?.get(e)!==l.get(e)&&(c=!0,o.add(`bundle:${e}`),this.invalidate([`bundle-metadata:${e}`]));this.bundleCatalog=l;for(let e of this.resources.keys()){if(!e.startsWith(`report-sources:`)&&!e.startsWith(`finding-history:`))continue;let[,n,r]=e.split(`:`);(n?t.has(`team:${n}`):c||o.has(r))&&this.invalidate([e])}return o}read(e){return this.resources.get(e)?.data}invalidate(e){for(let[t,n]of this.resources)e&&!e.some(e=>t===e||t.startsWith(`${e}:`))||(n.controller?.abort(),this.resources.delete(t))}async mutate(e,t){let n=this.generation,r;try{r=await e()}catch(e){throw n===this.generation&&e?.name!==`AbortError`&&this.notify(`Couldn't save changes: ${e?.message??e}`),e}if(n!==this.generation)throw new DOMException(`Managed session changed`,`AbortError`);return this.invalidate(t),r}async load(e,t,n,{signal:r,apply:i=()=>{},retryInvalidated:a=!1}={}){let o=this.generation;for(;;){r?.throwIfAborted();let s=this.resources.get(e);if(s||(s={},this.resources.set(e,s)),s.data!==void 0&&i(s.data),!s.pending){let e=s.controller=new AbortController;s.pending=(async()=>{try{let t=await n(e.signal);return e.signal.throwIfAborted(),s.data=t,t}catch(n){throw!e.signal.aborted&&n?.name!==`AbortError`&&this.notify(`Couldn't refresh ${t}: ${n?.message??n}`),n}})().finally(()=>{s.pending=null})}try{let t=await s.pending;if(r?.throwIfAborted(),this.resources.get(e)!==s)throw new DOMException(`Managed data changed`,`AbortError`);return i(t),t}catch(t){if(!a||t?.name!==`AbortError`||r?.aborted||o!==this.generation||this.resources.get(e)===s)throw t}}}}(e=>{document.dispatchEvent(new CustomEvent(`managed-notice`,{detail:{message:e}}))});function z(e){R.setSession(e)}function B(e){return R.setReportCatalog(e)}function V(){R.reset()}async function H(e,t=null,n={}){let r;try{r=await L(e,{credentials:`same-origin`,headers:{accept:`application/json`},...n})}catch{return t}if(r.status===401||r.status===403)return null;if(!r.ok)return t;try{return await r.json()}catch{return t}}async function U({fallback:e=null,sent:r}={}){let i=t()||O()!==null?void 0:await r;if(i===null)return null;let a=W(i);if(a!==void 0)return a;let o;try{let r=t(),i=await L(r?n(r):`/api/auth/session`,{credentials:`same-origin`,headers:{accept:`application/json`}});if(i.status===401||i.status===403)return null;if(!i.ok)return e;o=await i.json()}catch{return e}let s=W(o);return s===void 0?e:s}function W(e){let n=e?.user;if(n===null)return null;if(n!==void 0&&typeof n.login==`string`)return{id:n.id,login:n.login,name:typeof n.name==`string`?n.name:null,avatarUrl:typeof n.avatarUrl==`string`?n.avatarUrl:null,role:typeof n.role==`string`?n.role:`none`,csrfToken:typeof e.csrfToken==`string`?e.csrfToken:null,...t()?{publicShare:!0}:{},...typeof e.viewer?.login==`string`?{viewer:{id:e.viewer.id,login:e.viewer.login,name:typeof e.viewer.name==`string`?e.viewer.name:null}}:{},...!t()&&e.dependencyReview===!0?{dependencyReview:!0}:{}}}function G(e){let t=t=>Number.isSafeInteger(e?.[t])&&e[t]>=0;return e?.appMode===!1?{appMode:!1,...t(`appReports`)&&{appReports:e.appReports},...t(`findings`)&&{findings:e.findings}}:e?.appMode===!0&&t(`appFindings`)?{appMode:!0,appFindings:e.appFindings}:null}function te(e){if(typeof e?.sha!=`string`||typeof e.github!=`string`||!Array.isArray(e.tags))return null;let t=e.details,n=e=>typeof e==`string`?e:null,r=e=>Number.isSafeInteger(e)?e:null;return{sha:e.sha,github:e.github,tags:e.tags.filter(e=>typeof e==`string`),details:typeof t?.subject==`string`?{subject:t.subject,authorName:n(t.authorName),authorLogin:n(t.authorLogin),authoredAt:r(t.authoredAt),committedAt:r(t.committedAt)}:null}}async function K({fallback:e=[],signal:r,onRevision:i}={}){let a=t(),o=a?await H(n(a),null,{signal:r}):null,s=a?{teams:o?.team?[o.team]:[]}:await H(`/api/teams`,{teams:e},{signal:r}),c=s?.teams;return Array.isArray(c)?(i?.(typeof s.revision==`string`?s.revision:null),c.filter(e=>e!=null&&typeof e.id==`string`&&typeof e.name==`string`).map(e=>({id:e.id,slug:e.slug,name:e.name,...!a&&e.dependencyReview===!0?{dependencyReview:!0}:{},...e.permissions?{permissions:{dependencies:e.permissions.dependencies===!0,security:e.permissions.security===!0}}:{},...typeof e.cacheKey==`string`?{cacheKey:e.cacheKey}:{},...G(e.app)?{app:G(e.app)}:{},repos:Array.isArray(e.repos)?e.repos.filter(e=>Number.isSafeInteger(e?.repoId)&&e.repoId>0&&typeof e.fullName==`string`).map(e=>({repoId:e.repoId,fullName:e.fullName,path:typeof e.path==`string`&&e.path?e.path:null})):[],reports:Array.isArray(e.reports)?e.reports.filter(e=>e!=null&&typeof e.id==`string`&&typeof e.filename==`string`).map(e=>({id:e.id,slug:e.slug,filename:e.filename,visible:e.visible!==!1,...e.analyzer===null||typeof e.analyzer==`string`?{analyzer:e.analyzer}:{},repoFullName:typeof e.repoFullName==`string`?e.repoFullName:``,repoDirectory:typeof e.repoDirectory==`string`?e.repoDirectory:``,...typeof e.cacheKey==`string`?{cacheKey:e.cacheKey}:{}})):[],bundles:Array.isArray(e.bundles)?e.bundles.filter(e=>e!=null&&typeof e.id==`string`&&typeof e.filename==`string`).map(e=>({id:e.id,slug:e.slug,integrity:e.integrity,byteSize:e.byteSize,repoId:e.repoId,filename:e.filename,kind:e.kind,visible:e.visible!==!1,summary:e.summary??null,summaryRetryAt:Number.isSafeInteger(e.summaryRetryAt)&&e.summaryRetryAt>0?e.summaryRetryAt:null,repoDirectory:typeof e.repoDirectory==`string`?e.repoDirectory:``,repoFullName:typeof e.repoFullName==`string`?e.repoFullName:``,commitInfo:te(e.commitInfo)})):[]}))):s==null?[]:e}function q(e){return e?.links===void 0?[]:Array.isArray(e.links)&&e.links.every(e=>Array.isArray(e)&&e.length>=2&&e.every(e=>typeof e==`string`))?e.links:null}function J(e){return s(e?.data)===null||typeof e.repo?.directory!=`string`||e.repo.github!==null&&typeof e.repo.github!=`string`||q(e)===null?null:{data:e.data,repo:e.repo,...e.links?{links:e.links}:{}}}async function Y(e,{signal:t}={}){return J(await H(`/api/reports/${encodeURIComponent(e)}`,null,{signal:t}))}async function X(e,{signal:t}={}){let n=[...new Set(e)];if(n.length===0)return[];let r=await H(`/api/reports/query`,null,{method:`POST`,signal:t,headers:{accept:`application/json`,"content-type":`application/json`},body:JSON.stringify({ids:n})});if(!Array.isArray(r?.reports)||r.reports.length!==n.length)return null;let i=new Map;for(let e of r.reports){let t=J(e);if(!t||!n.includes(e.id)||i.has(e.id))return null;i.set(e.id,t)}let a=q(r);return a===null?null:e.map(e=>({...i.get(e),...a.length>0?{links:a}:{}}))}async function Z(e,{signal:t,reportId:n=null,lite:r=!1}={}){let i=new URLSearchParams(n===null?{}:{reportId:n});r&&i.set(`lite`,`1`);let a=await H(`/api/teams/${encodeURIComponent(e)}/reports${i.size>0?`?${i}`:``}`,null,{signal:t});if(!Array.isArray(a?.reports))return null;let o=[],s=new Set;for(let e of a.reports){let t=J(e);if(!t||typeof e.id!=`string`||typeof e.filename!=`string`||s.has(e.id))return null;s.add(e.id),o.push({id:e.id,filename:e.filename,...t})}let c=q(a);return c===null?null:(Object.defineProperty(o,"links",{value:c}),o)}function Q(e){return e?`?team=${encodeURIComponent(e)}`:``}async function ne(e,{reportId:t,...n}={}){let r=t==null?``:`?reportId=${encodeURIComponent(t)}`,i=await H(`/api/teams/${encodeURIComponent(e)}/annotations${r}`,null,n),{reports:a,entries:o,comments:s,issues:c={}}=i??{};if(!a||typeof a!=`object`||Array.isArray(a)||!o||typeof o!=`object`||Array.isArray(o)||!Array.isArray(s)||!c||typeof c!=`object`||Array.isArray(c)||Object.values(a).some(e=>!Array.isArray(e)||e.some(e=>typeof e!=`string`))||s.some(e=>!e||typeof e.findingId!=`string`))return null;let l=new Map;for(let[e,t]of s.entries()){let n=t.findingId,r=l.get(n)??[];r.push(e),l.set(n,r)}let u=new Map,d=new Map,f=typeof i.revision==`string`?i.revision:null;return Object.assign(e=>{if(!Object.hasOwn(a,e))return null;if(d.has(e))return d.get(e);let t=JSON.stringify(a[e]),n=u.get(t);if(!n){let r=[...new Set(a[e])],i=r.flatMap(e=>l.get(e)??[]);n={entries:Object.fromEntries(r.filter(e=>Object.hasOwn(o,e)).map(e=>[e,o[e]])),comments:i.toSorted((e,t)=>e-t).map(e=>s[e]),issues:Object.fromEntries(r.filter(e=>Object.hasOwn(c,e)).map(e=>[e,c[e]]))},u.set(t,n)}return d.set(e,n),n},{revision:f})}async function re(e,t,n){let r=(await H(`/api/reports/${encodeURIComponent(e)}/triage${Q(t)}`,null,n))?.entries;return typeof r==`object`&&r&&!Array.isArray(r)?r:null}async function ie(e,n,r=null){if(t())return[];let i=r===null?``:`?reportId=${encodeURIComponent(r)}`,a=await H(`/api/teams/${encodeURIComponent(e)}/fixes${i}`,null,{signal:n});return Array.isArray(a?.fixes)?a.fixes:null}async function ae(e,t,n){let r=await H(`/api/reports/${encodeURIComponent(e)}/comments${Q(t)}`,null,n);return Array.isArray(r?.comments)?r.comments:null}async function oe(e,{findingId:t,body:n,commentId:r=null,version:i},a,o){let s=r==null?``:`/${encodeURIComponent(r)}`;try{let c=await L(`/api/reports/${encodeURIComponent(e)}/comments${s}${Q(o)}`,{method:r==null?`POST`:`PATCH`,credentials:`same-origin`,headers:{"content-type":`application/json`,...a?{"x-csrf-token":a}:{}},body:JSON.stringify(r==null?{findingId:t,body:n}:{body:n,version:i})});return{status:c.status,comment:c.ok?(await c.json()).comment:null}}catch{return{status:0,comment:null}}}async function $(e,t,n,r,i){try{return(await L(`/api/reports/${encodeURIComponent(e)}/comments/${encodeURIComponent(t)}${Q(i)}`,{method:`DELETE`,credentials:`same-origin`,headers:{"content-type":`application/json`,...r?{"x-csrf-token":r}:{}},body:JSON.stringify({version:n})})).status}catch{return 0}}async function se(e,t,n,r){try{return(await L(`/api/reports/${encodeURIComponent(e)}/triage${Q(r)}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`,...n?{"x-csrf-token":n}:{}},body:JSON.stringify({entries:t})})).status}catch{return 0}}function ce(e){e&&(location.href=e)}async function le(e){if(t()){location.href=`/`;return}try{await L(`/api/auth/logout`,{method:`POST`,credentials:`same-origin`,headers:e?{"x-csrf-token":e}:{}})}catch{}location.reload()}async function ue(e,t){let n=await L(`/api/auth/view-as`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`,...t?{"x-csrf-token":t}:{}},body:JSON.stringify({userId:e})});if(!n.ok)throw Error(`HTTP ${n.status}`);location.assign(`/`)}async function de(e){try{await L(`/api/auth/view-as`,{method:`DELETE`,credentials:`same-origin`,headers:e?{"x-csrf-token":e}:{}})}catch{}location.assign(o[`admin-users`])}async function fe(e){let t=await L(`/api/teams/${encodeURIComponent(e)}/share`,{credentials:`same-origin`});if(!t.ok)throw Error(`Could not load public links (${t.status})`);return(await t.json()).shares}async function pe(e,t,{id:n,revoke:r=!1,dependencies:i=!1,security:a=!1}={}){let o=n?`/${encodeURIComponent(n)}`:``,s=await L(`/api/teams/${encodeURIComponent(e)}/share${o}`,{method:r?`DELETE`:n?`PATCH`:`POST`,credentials:`same-origin`,headers:{"x-csrf-token":t,"content-type":`application/json`},...r?{}:{body:JSON.stringify({dependencies:i,security:a})}});if(!s.ok)throw Error(`Could not ${r?`revoke`:n?`update`:`create`} public link (${s.status})`);return s.json()}async function me(e,t){let n=await L(`/api/bundles/${encodeURIComponent(e)}/download`,{credentials:`same-origin`});if(!n.ok)throw Error(`Could not download bundle (${n.status})`);let r=URL.createObjectURL(await n.blob()),i=document.createElement(`a`);i.href=r,i.download=t,i.click(),setTimeout(()=>URL.revokeObjectURL(r),6e4)}export{u as a,O as b,k as c,L as d,R as e,z as f,B as g,V as h,U as i,K as j,Y as k,X as l,Z as m,Q as n,ne as o,re as p,ie as q,ae as r,oe as s,$ as t,se as u,ce as v,le as w,ue as x,de as y,fe as z,pe as A,me as B};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,c as t,j as n}from"./chunk-2XUEZHIP.js";var r=`:host{display:inline-flex;flex-shrink:0;vertical-align:middle;--switch-track-width: 26px;--switch-track-height: 14px}button,.checkbox-mode{align-items:center;gap:8px;box-sizing:border-box;height:30px;margin:0;padding:0 .6rem;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:transparent;color:var(--muted);font:inherit;font-size:.78rem;font-weight:500;line-height:1;white-space:nowrap;cursor:default}button{display:var(--switch-button-display, inline-flex);&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .04)}&[aria-pressed=true]{color:var(--text)}&:disabled{opacity:.4}&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}.checkbox-mode{display:var(--switch-checkbox-display, none);border:0;color:var(--text);&:has(:disabled){opacity:.4}& input{width:.85rem;height:.85rem;margin:0;accent-color:var(--accent)}}.track{position:relative;flex-shrink:0;width:var(--switch-track-width);height:var(--switch-track-height);background:var(--border);border-radius:var(--ui-radius, 8px);transition:background .15s;&:after{content:"";position:absolute;top:2px;left:2px;width:calc(var(--switch-track-height) - 4px);height:calc(var(--switch-track-height) - 4px);border-radius:50%;background:var(--muted);transition:transform .15s,background .15s}}button[aria-pressed=true] .track{background:color-mix(in oklch,var(--accent) 22%,transparent);&:after{transform:translate(calc(var(--switch-track-width) - var(--switch-track-height)));background:var(--accent)}}:host([borderless]) :is(button,.checkbox-mode){height:100%;border:0;border-radius:0}:host([compact]){--switch-track-width: 22px;--switch-track-height: 12px}:host([compact]) :is(button,.checkbox-mode){height:auto;gap:7px;padding:2px 8px;border-radius:var(--ui-radius, 6px);font-size:.68rem;line-height:1.2}:host-context(body.theme-w95){.checkbox-mode{padding:0 4px;color:#000;font-size:11px;font-weight:400}.checkbox-mode input{appearance:none;width:13px;height:13px;background:#fff;box-shadow:var(--w95-sunken);&:checked{background:var(--w95-check),#fff}}}
|
|
2
|
+
`,i=class extends n{static properties={checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},label:{type:String},accessibleLabel:{type:String,attribute:`accessible-label`}};static styles=e(r);constructor(){super(),this.checked=!1,this.disabled=!1,this.label=``,this.accessibleLabel=``}_checkboxClick(e){(this.disabled||e.target.tagName!==`INPUT`)&&e.stopPropagation()}render(){return t`<button type="button" part="button" aria-pressed="${String(this.checked)}" aria-label="${this.accessibleLabel||this.label}" ?disabled="${this.disabled}"><span>${this.label}</span><span class="track" part="track" aria-hidden="true"></span></button> <label class="checkbox-mode" @click="${this._checkboxClick}"><input type="checkbox" part="checkbox" .checked="${this.checked}" ?disabled="${this.disabled}" aria-label="${this.accessibleLabel||this.label}"> <span>${this.label}</span></label>`}};customElements.get(`mode-switch`)||customElements.define(`mode-switch`,i);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=/[\p{Cc}\p{Zl}\p{Zp}\p{Bidi_Control}]/gu,t=(e,t)=>e.length>t?e.slice(0,e.codePointAt(t-1)>65535?t-1:t):e,n=e=>`U+${e.codePointAt(0).toString(16).toUpperCase().padStart(4,`0`)}`,r=t=>JSON.stringify(t).replaceAll(e,e=>`\\u${e.codePointAt(0).toString(16).padStart(4,`0`)}`);function i(e){let n=t(e,64);return n===e?r(e):`${r(n)}...`}var a=class extends Error{constructor(e,t){super(t===void 0?e:`${e} at line ${t+1}`),this.name=new.target.name,this.line=t}},o=class extends Error{constructor(e,t){super(t===void 0?e:`${t}: ${e}`),this.name=`LockfileError`,this.where=t}},s=(e,t)=>{throw new o(e,t)};function c(e,t){try{return e()}catch(e){return t(e)}}function l(e){let n=t(e,200);return r(n===e?e:`${n}\u2026`)}var u=/^[A-Za-z_$][\w$]*$/u;function d(e,t){return u.test(t)?e===``?t:`${e}.${t}`:`${e}[${l(t)}]`}var f=(e,t)=>new o(`${e} at line ${Math.max(t,0)+1}`),p=/[\p{Cc}\p{Cs}\uFEFF\uFFFE\uFFFF\u2028\u2029]/u,m=[`<<<<<<<`,`=======`,`>>>>>>>`];function h(e,t){if(m.every(t=>e.includes(t)))throw new o(`${t} reads a file with ${m.map(e=>l(e)).join(`, `)} in it as a merge conflict`)}function g(e,t){let n=/^\{(\r?\n)([\t ]+)"/u.exec(e);if(n===null)throw f(`expected "{" alone on the first line and an indented key on the next, as ${t} writes the file`,0);return n.slice(1)}function _(e,t){t.lastIndex=e.pos;let n=t.exec(e.text);return n!==null&&(e.pos=t.lastIndex),n}var v=(e,t)=>t<e.length?l(e.slice(t)):`the end of the line`,y=e=>/^ */u.exec(e)[0].length,b=2**20,x=(e,t)=>({text:e,forbidden:t,pos:0,number:-1,line:void 0,crlf:void 0});function S(e){let{text:t,pos:r}=e;if(e.line=void 0,r>=t.length)return;let i=t.indexOf(`
|
|
2
|
+
`,r);i===-1&&(i=t.length),e.pos=i+1,e.number++;let a=i<t.length&&t[i-1]===`\r`,o=t.slice(r,a?i-1:i);if(o.length>b)throw f(`a line longer than ${b} characters`,e.number);let s=e.forbidden.exec(o)?.[0];if(s!==void 0)throw f(`${n(s)} is not allowed`,e.number);if(i<t.length&&a!==(e.crlf??=a))throw f(`a ${a?`CRLF`:`LF`} line end, after ${e.crlf?`CRLF`:`LF`} ones`,e.number);e.line=o}function C(e,t,n){let r=t+1;for(;r<e.length&&e[r]!==`"`;)r+=e[r]===`\\`?2:1;if(r>=e.length)throw f(`a string with no closing quote`,n);let i=e.slice(t,++r);if(!i.includes(`\\`))return[i.slice(1,-1),r];let a=c(()=>JSON.parse(i),()=>{throw f(`${l(i)} is not a string as JSON writes it`,n)});if(JSON.stringify(a)!==i)throw f(`${l(i)} is not written as JSON writes ${l(a)}`,n);return[a,r]}export{n as a,i as b,a as c,o as d,s as e,c as f,l as g,d as h,f as i,p as j,h as k,g as l,_ as m,v as n,y as o,b as p,x as q,S as r,C as s};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{c as e}from"./chunk-PWFUOLZK.js";import{b as t,c as n}from"./chunk-C4Z6ZBXV.js";import{g as r}from"./chunk-2XUEZHIP.js";function i(e){return!Number.isFinite(e)||e<0?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KiB`:e<1073741824?`${(e/1048576).toFixed(1)} MiB`:`${(e/1073741824).toFixed(1)} GiB`}function a(e){return Array.isArray(e)?e.reduce((e,t)=>({bytes:e.bytes!=null&&Number.isFinite(t.bytes)?e.bytes+t.bytes:null,lines:e.lines!=null&&Number.isFinite(t.lines)?e.lines+t.lines:null}),{bytes:0,lines:0}):{bytes:null,lines:null}}function o(e,t,n){if(Array.isArray(e?.files))return{files:t.length,lines:a(t).lines,packages:new Set(t.map(e=>e.module)).size};let r=e=>Number.isSafeInteger(e)&&e>=0?e:null,i=e?.summary;return{files:r(i?.[n===`code`?`codeFiles`:`files`]),lines:r(i?.lines),packages:null}}function s(e){return(e??[]).filter(e=>![`resource:base64`,`directory`].includes(e.format))}var c=t(class extends n{constructor(){super(...arguments),this.key=r}render(e,t){return this.key=e,t}update(t,[n,r]){return n!==this.key&&(e(t),this.key=n),r}});export{i as a,a as b,o as c,s as d,c as e};
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
lit-html/directives/keyed.js:
|
|
5
|
+
(**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2021 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*)
|
|
10
|
+
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
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" 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>`,N=`<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>`,P=`<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>`,F=`<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>`,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="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>`,L=`<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>`,R=`<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>`,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="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>`,B=`<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>`,V=`<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>`,H=`<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>`,U=`<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>`,W=`<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>`,G=`<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>`,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="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};
|
|
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
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./chunk-GO7FT4OD.js";import{c as t,d as n,e as r,h as i,i as a,j as o,m as s,n as c,o as l}from"./chunk-TQJDYHVE.js";import{i as u}from"./chunk-4HI2MSAV.js";import"./chunk-PXK7EU4V.js";import{a as d,c as f}from"./chunk-JCIIBLKR.js";import{k as p,o as m,p as h,u as g}from"./chunk-7VAWINQF.js";import{b as _}from"./chunk-IYPY47MC.js";import"./chunk-SXV2T5C4.js";import"./chunk-TUII34K2.js";import"./chunk-OOJM4CTU.js";function v(e){if(typeof e!=`string`)throw TypeError(`a text must be a string, not ${typeof e}`);if(!e.isWellFormed())throw TypeError(`a text must be a well-formed string`);return{proven:!1,reason:`unsupported`,at:null}}var y=e=>e.subarray(0,8e3).includes(0),b=(e,t)=>(e+Math.imul(t,97)>>>0)%107927,x=e=>Uint8Array.from({length:256},(t,n)=>Number(n===10||e.includes(String.fromCodePoint(n)))),S=x(``),C=x(`,;={}`);function w(e,t=S){let n=!y(e),r=new Map,i=(e,t)=>r.set(e,(r.get(e)??0)+t),a=0,o=0,s=0;for(let r=0;r<e.length;r++){let c=e[r];if(n&&c===13&&e[r+1]===10)continue;let l=a;a=(a<<7^o>>>25)+c>>>0,o=(o<<7^l>>>25)>>>0,!(++s<64&&t[c]===0)&&(i(b(a,o),s),s=0,a=0,o=0)}s>0&&i(b(a,o),s);let c=Uint32Array.from(r.keys()).sort();return{hashes:c,bytes:Float64Array.from(c,e=>r.get(e)),total:r.values().reduce((e,t)=>e+t,0)}}function T(e,t){let n=0;for(let r=0,i=0;r<e.hashes.length&&i<t.hashes.length;)e.hashes[r]<t.hashes[i]?r++:e.hashes[r]>t.hashes[i]?i++:n+=Math.min(e.bytes[r++],t.bytes[i++]);return n}function E(e,t,n){let r=0,i=e.total,a=t.total;for(let o=0,s=0;o<e.hashes.length&&s<t.hashes.length;)if(e.hashes[o]<t.hashes[s]?i-=e.bytes[o++]:(e.hashes[o]>t.hashes[s]||(r+=Math.min(e.bytes[o],t.bytes[s]),i-=e.bytes[o++]),a-=t.bytes[s++]),(r+Math.min(i,a))*6e4<n)return 0;return r}function ee(e,t,n,r,i=!1){if(e===null||t===null||t.length===0)return 0;let a=Math.abs(e.length-t.length),o=Math.max(e.length,t.length);if(o*(6e4-n)<a*6e4)return 0;let s=r(e),c=r(t),l=i?E(s,c,n*o):T(s,c);return Math.trunc(l*6e4/o)}var D=/^[\w-]{6,}$/u,O=/[\dA-Z]/u,te=/^(?:\.[\w-]+)+$/u,ne=/^[\w-]{8,32}$/u;function k(e){let t=[];for(let n=e.length-1;n>0;n--){if(e[n]!==`-`&&e[n]!==`.`)continue;let r=e.indexOf(`.`,n+1),i=e.slice(r),a=e.slice(n+1,r);r!==-1&&ne.test(a)&&te.test(i)&&/[A-Za-z]/u.test(a)&&O.test(a)&&t.push([e.slice(0,n),a,i])}return t}var re=e=>e.replaceAll(/\d/gu,`0`).replaceAll(/[a-z]/gu,`a`).replaceAll(/[A-Z]/gu,`A`);function ie(e,t){let n=k(t);for(let[t,r,i]of k(e)){let e=n.find(e=>e[2]===i);if(e&&e[1]!==r)return e[0]===t&&re(e[1])!==re(r)}return!1}function ae(e){let t=e.lastIndexOf(`/`),n=e.slice(t+1),r=n.lastIndexOf(`.`),i=r>0?n.slice(r):``;return{name:n,key:`${e.slice(0,t+1)}\0${i}\0${n.length}`}}function oe(e,t){let n=e.length,r=0;for(;r<e.length&&e[r]===t[r];)r++;for(;n>r&&e[n-1]===t[n-1];)n--;for(;r>0&&!`-._`.includes(e[r-1]);)r--;for(;n<e.length&&e[n]!==`.`;)n++;let i=e.slice(r,n),a=t.slice(r,n);return r>0&&D.test(i)&&D.test(a)&&(O.test(i)||O.test(a))}function se({sources:e,dests:t,pairs:n,used:r,record:i,punctuatedScoreOf:a},{remaining:o,open:s},c,l){let u=(e,t)=>new Map(t.filter(t=>e[t].type===`file`).map(t=>[t,ae(e[t].path)])),d=u(t,s),f=u(e,o),p=Map.groupBy(f.keys(),e=>f.get(e).key),m=Map.groupBy(d.keys(),e=>d.get(e).key),h=[];for(let[e,t]of m){let n=p.get(e)??[];for(let e of t)for(let t of n)oe(f.get(t).name,d.get(e).name)&&h.push({s:t,d:e})}let g=Map.groupBy(h,({d:e})=>e),_=Map.groupBy(h,({s:e})=>e),v=[];for(let{s:e,d:t}of h){let n=_.get(e).length===1&&g.get(t).length===1&&ie(f.get(e).name,d.get(t).name),r=a(e,t,n?0:c);(n||r>=c)&&v.push({s:e,d:t,score:r})}let y=[],b=new Set,x=new Set;for(let e of v.sort((e,t)=>t.score-e.score))n.has(e.d)||r.has(e.s)||(x.has(e.s)||b.has(e.d)||l(e)?(y.push(e),x.add(e.s),b.add(e.d)):i(e.d,e.s,e.score));return y}function ce(e,t){let n=e.length;if(n!==t.length)return!1;let r=0;if(n>=32&&(e.byteOffset&3)==(t.byteOffset&3)){for(let n=4-(e.byteOffset&3)&3;r<n;r++)if(e[r]!==t[r])return!1;let i=n-r>>>2,a=new Int32Array(e.buffer,e.byteOffset+r,i),o=new Int32Array(t.buffer,t.byteOffset+r,i);for(let e=0;e<i;e++)if(a[e]!==o[e])return!1;r+=i*4}for(;r<n;r++)if(e[r]!==t[r])return!1;return!0}var A=class extends Error{constructor(e,t,n){let r=n===void 0?``:` in the ${n} tree`;super(t===void 0?e:`${e}: ${JSON.stringify(t)}${r}`),this.name=`CompareError`,this.path=t,this.tree=n}},le=new Set([`file`,`contiguous-file`]),ue=new Set([`fifo`,`character-device`,`block-device`]),de=/(?:^|\/)\.{0,2}(?:\/|$)/u;function fe(e){if(!Number.isInteger(e)||e<0||e>4095)throw RangeError(`a mode must be an integer from 0 to 0o7777, not ${e}`)}function pe(e,t,n,r){if(typeof e!=`string`)throw TypeError(`an entry's name must be a string, not ${typeof e}`);if(e!==`.`||t!==`directory`){if(r?e===``:de.test(e))throw new A(r?`a name must not be empty`:"a name must be a relative path with no empty, `.` or `..` segment",e,n);if(!e.isWellFormed())throw new A(`a name must be well-formed Unicode`,e,n)}}function me(e,t,n){if(typeof e!=`string`||e===``)throw new A(`a link must name its target`,t,n);if(!e.isWellFormed())throw new A(`a link target must be well-formed Unicode`,t,n);return e}function he(e){if(e===void 0)return new Uint8Array;if(e instanceof Uint8Array)return e;if(typeof e!=`string`)throw TypeError(`a file's data must be a string or a Uint8Array, not ${typeof e}`);if(!e.isWellFormed())throw TypeError(`a file's text must be well-formed Unicode`);return e}var j=e=>typeof e==`string`?u(e):e;function ge(e,t,n){if(typeof e!=`object`||!e)throw TypeError(`an entry must be an object, not ${e===null?`null`:typeof e}`);let{name:r,type:i=`file`,mode:a,linkname:o,data:s}=e;if(pe(r,i,t,n),a!==void 0&&fe(a),le.has(i))return{path:r,type:`file`,mode:a??420,data:he(s)};if(i===`symlink`||i===`hardlink`)return{path:r,type:i,target:me(o,r,t)};if(i===`directory`)return{path:r,type:i};throw ue.has(i)?new A(`a ${i} is neither a file nor a link`,r,t):TypeError(`${JSON.stringify(i)} is not an entry type`)}function M(e,t){return e.type===t.type?e.type===`symlink`?e.target===t.target:e.data===t.data?!0:typeof e.data==`string`&&typeof t.data==`string`?!1:ce(j(e.data),j(t.data)):!1}function _e(e,t,n){let r=new Set([e.path]),i=t.get(e.target);for(;i?.type===`hardlink`;){if(r.has(i.path))throw new A(`a hard link leads back to itself`,e.path,n);r.add(i.path),i=t.get(i.target)}if(i===void 0||i.type===`directory`)throw new A(`a hard link must name a file or a link in the tree`,e.path,n);return{...i,path:e.path}}function N(e,t,n){let r=new Map;for(let i of e){let e=ge(i,t,n);if(e.type!==`directory`||e.path!==`.`){if(r.has(e.path))throw new A(`a name is given twice`,e.path,t);r.set(e.path,e)}}let i=new Map;for(let[e,a]of r){for(let i=n?-1:e.lastIndexOf(`/`);i>0;i=e.lastIndexOf(`/`,i-1)){let n=r.get(e.slice(0,i));if(n!==void 0&&n.type!==`directory`)throw new A(`a path lies under a ${n.type===`symlink`?`link`:`file`}`,e,t)}a.type===`hardlink`?i.set(e,_e(a,r,t)):a.type!==`directory`&&i.set(e,a)}return i}var ve=100,ye=4,P=e=>e.slice(e.lastIndexOf(`/`)+1);function F(t,n){if(t.type===`symlink`)return`l${t.target}`;let r=n(t);return`f${r.length}:${e(r)}`}function be({sources:e,dests:t,sourceNames:n,destNames:r,used:i,record:a,bytes:o}){let s=Map.groupBy(e.keys(),t=>F(e[t],o));for(let c=0;c<t.length;c++){let l=-1,u=ve;for(let a of s.get(F(t[c],o))??[])if(!i.has(a)&&M(e[a],t[c])&&((l===-1||n[a]===r[c])&&(l=a),n[a]===r[c]||--u===0))break;l!==-1&&a(c,l,6e4)}}var xe=new Map([[`.ts`,`.js`],[`.mts`,`.mjs`],[`.cts`,`.cjs`],[`.tsx`,`.jsx`]]),Se=new Map([...[`.js`,`.mjs`,`.cjs`,`.jsx`,`.ts`,`.mts`,`.cts`,`.tsx`].map(e=>[e,`script`]),...[`.css`,`.scss`,`.sass`,`.less`].map(e=>[e,`style`])]);function I(e){let t=e.split(`/`),n=t.pop(),r=n.lastIndexOf(`.`);return r>0?{dirs:t,stem:n.slice(0,r),extension:n.slice(r)}:{dirs:t,stem:n,extension:``}}function L(e){let{dirs:t,stem:n,extension:r}=I(e);return JSON.stringify([t.map(e=>e===`lib`||e===`src`?null:e),n,xe.get(r)??r])}function Ce(e){let{dirs:t,stem:n,extension:r}=I(e),i=[n,Se.get(r)??r],a=t.lastIndexOf(`node_modules`),o=a===-1?0:a+(t[a+1]?.startsWith(`@`)?3:2),s=[JSON.stringify([...i,t])];for(let e=o;e<t.length;e++)s.push(JSON.stringify([...i,t.toSpliced(e,1,null)]));return s}var R=(e,t)=>Math.max(t,e+Math.trunc((6e4-e)/2));function z({pairs:e,used:t,scoreOf:n},{remaining:r,open:i},{s:a,d:o,score:s},c){let l=R(s,c);return i.some(t=>t!==o&&!e.has(t)&&n(a,t,l)>=l)||r.some(e=>e!==a&&!t.has(e)&&n(e,o,l)>=l)}function we(e,t,n,r){let{sources:i,dests:a,pairs:o,used:s,record:c,scoreOf:l}=e,u=Map.groupBy(t.remaining.filter(e=>i[e].type===`file`),e=>L(i[e].path)),d=t.open.filter(e=>a[e].type===`file`).flatMap(e=>(u.get(L(a[e].path))??[]).map(t=>({s:t,d:e,score:l(t,e,0)})));for(let i of d.sort((e,t)=>t.score-e.score))!o.has(i.d)&&!s.has(i.s)&&!(n&&z(e,t,i,r))&&c(i.d,i.s,i.score)}function Te(e,t,n,r){let{sources:i,dests:a,pairs:o,used:s,record:c,scoreOf:l}=e,u=new Map,d=(e,t,n)=>new Map(t.filter(t=>e[t].type===`file`).map(t=>{let r=Ce(e[t].path);for(let e of r)(u.get(e)??u.set(e,{sources:[],dests:[]}).get(e))[n].push(t);return[t,r]})),f=d(a,t.open.filter(e=>!o.has(e)),`dests`),p=d(i,t.remaining.filter(e=>!s.has(e)),`sources`),m=(e,t)=>{let n=new Set(e.flatMap(e=>u.get(e)[t]));return n.size===1?[...n][0]:-1};for(let[i,a]of p){let o=m(a,`dests`);if(o===-1||m(f.get(o),`sources`)!==i)continue;let s={s:i,d:o,score:l(i,o,0)};n&&z(e,t,s,r)||c(o,i,s.score)}}function Ee(e,t,n){let r=H(e),i=t<6e4&&r.remaining.length*r.open.length<=n*n;we(e,r,i,t),Te(e,r,i,t)}function B(e,t){let n=new Map;for(let r of t)n.set(e[r],n.has(e[r])?-1:r);return n}function De({sourceNames:e,destNames:t,record:n,scoreOf:r},{remaining:i,open:a},o){let s=B(t,a),c=B(e,i);for(let t of i){let i=s.get(e[t]);if(i===void 0||i===-1||c.get(e[t])===-1)continue;let a=r(t,i,o);a>=o&&n(i,t,a)}}var V=(e,t)=>t.score-e.score||t.nameScore-e.nameScore;function Oe(e,t){if(e.length<ye){e.push(t);return}let n=0;for(let t=1;t<e.length;t++)V(e[t],e[n])>0&&(n=t);V(e[n],t)>0&&(e[n]=t)}function ke({sourceNames:e,destNames:t,pairs:n,used:r,record:i,scoreOf:a},{remaining:o,open:s},c,l){let u=[];for(let n of s){let r=[];for(let i of o)Oe(r,{score:a(i,n,c),nameScore:+(e[i]===t[n]),dst:n,src:i});u.push(...r)}let d=0,f=e=>{for(;d<l.length&&R(l[d].score,c)>e;d++){let{s:e,d:t,score:a}=l[d];!n.has(t)&&!r.has(e)&&i(t,e,a)}};for(let{dst:e,src:t,score:a}of u.sort(V)){if(a<c)break;f(a),!n.has(e)&&!r.has(t)&&i(e,t,a)}f(-1/0)}var H=({sources:e,dests:t,pairs:n,used:r})=>({remaining:e.keys().filter(e=>!r.has(e)).toArray(),open:t.keys().filter(e=>!n.has(e)).toArray()}),U=e=>e+Math.trunc(.5*(6e4-e));function W(e,t,{minimum:n,limit:r,byPath:i}){let a=new Map,o=new Set;if(e.length===0||t.length===0)return a;let s=new Map,c=new Map,l=new Map,u=e=>e.type===`file`?c.get(e)??c.set(e,j(e.data)).get(e):null,d=e=>s.get(e)??s.set(e,w(e)).get(e),f=e=>l.get(e)??l.set(e,w(e,C)).get(e),p={sources:e,dests:t,pairs:a,used:o,sourceNames:e.map(e=>P(e.path)),destNames:t.map(e=>P(e.path)),record(e,t,n){a.set(e,{source:t,score:n}),o.add(t)},bytes:u,scoreOf:(n,r,i)=>ee(u(e[n]),u(t[r]),i,d),punctuatedScoreOf:(n,r,i)=>ee(u(e[n]),u(t[r]),i,f,!0)};if(be(p),i&&Ee(p,n,r),n>=6e4)return a;De(p,H(p),U(n));let m=H(p);if(m.remaining.length*m.open.length>r*r)return a;let h=i?se(p,m,U(n),e=>z(p,m,e,n)):[];return ke(p,H(p),n,h),a}var Ae=50,je=1e3;function G(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return e.codePointAt(r)-t.codePointAt(r);return e.length-t.length}function Me(e){if(e===!1)return null;let t=e===!0?Ae:e;if(typeof t!=`number`)throw TypeError(`renames must be a boolean or a percentage, not ${typeof e}`);if(!(t>0&&t<=100))throw RangeError(`renames must be a percentage above 0 and at most 100, not ${e}`);return Math.max(1,Math.trunc(6e4*t/100))}function Ne({renamesByPath:e,renameLimit:t,renameGroup:n,paths:r,lines:i}){if(typeof e!=`boolean`)throw TypeError(`renamesByPath must be a boolean, not ${typeof e}`);if(t!==1/0&&!(Number.isSafeInteger(t)&&t>=0))throw RangeError(`renameLimit must be a whole number or Infinity, not ${t}`);if(n!==null&&typeof n!=`function`)throw TypeError(`renameGroup must be a function, not ${typeof n}`);if(r!==`tree`&&r!==`keys`)throw RangeError(`paths must be 'tree' or 'keys', not ${r}`);if(typeof i!=`boolean`)throw TypeError(`lines must be a boolean, not ${typeof i}`)}var Pe=(e,t)=>M(e,t)&&(e.type!==`file`||e.mode===t.mode),K=(e,t,n,r=null)=>({status:e,old:t,new:n,similarity:r}),Fe=/\.d\.(?:[^./]+\.)?[cm]?ts$/u,q=e=>e.endsWith(`.mts`)?`module`:e.endsWith(`.cts`)?`commonjs`:null,Ie=/^export\s*\{\s*\}\s*;?$/u;function J(e){if(e===null)return{proven:!0,runtime:``,loads:!1};let n=t(e);try{return n===void 0?{proven:!1}:v(n)}catch{return{proven:!1}}}function Le(e){if(![e.old,e.new].filter(e=>e!==null).every(e=>e.type===`file`&&Fe.test(e.path))||e.old&&e.new&&e.old.mode!==e.new.mode)return e;let t=J(e.new),n=J(e.old);return!n.proven||!t.proven||n.runtime!==t.runtime&&!(e.old===null&&Ie.test(t.runtime))||n.loads&&e.old&&e.new&&e.old.path!==e.new.path&&q(e.old.path)!==q(e.new.path)?e:{...e,typeOnly:!0}}function Re(e,t){let n=[],r=[],i=[];for(let[n,a]of e){let e=t.get(n);e===void 0?i.push(a):e.type===a.type?Pe(a,e)||r.push(K(`modified`,a,e)):r.push(K(`type-changed`,a,e))}for(let[r,i]of t)e.has(r)||n.push(i);return i.sort((e,t)=>G(e.path,t.path)),n.sort((e,t)=>G(e.path,t.path)),{changes:r,deleted:i,added:n}}function ze(e,t,{group:n,...r}){if(n===null)return W(e,t,r);let i=new Map,a=e=>Map.groupBy(e.keys(),t=>n(e[t].path)),o=a(e);for(let[n,s]of a(t)){let a=o.get(n);if(a!==void 0)for(let[n,{source:o,score:c}]of W(a.map(t=>e[t]),s.map(e=>t[e]),r))i.set(s[n],{source:a[o],score:c})}return i}function Be(e,t,{renames:i=!0,renamesByPath:a=!0,renameLimit:o=je,renameGroup:s=null,paths:c=`tree`,lines:l=!0,horizon:u,whitespace:d,ignoreCase:f}={}){let p=Me(i);Ne({renamesByPath:a,renameLimit:o,renameGroup:s,paths:c,lines:l});let m=n({horizon:u,whitespace:d,ignoreCase:f}),h=c===`keys`,{changes:g,deleted:_,added:v}=Re(N(e,`old`,h),N(t,`new`,h)),y=p===null?new Map:ze(_,v,{minimum:p,limit:o,byPath:a,group:s});for(let[e,t]of v.entries()){let n=y.get(e);g.push(n===void 0?K(`added`,null,t):K(`renamed`,_[n.source],t,Math.trunc(n.score*100/6e4)))}let b=new Set(y.values().map(({source:e})=>e));for(let[e,t]of _.entries())b.has(e)||g.push(K(`deleted`,t,null));return g.sort((e,t)=>G((e.new??e.old).path,(t.new??t.old).path)),(l?g.map(e=>({...e,...r(e.old,e.new,m)})):g).map(Le)}function Y(e,t,n){let r=new Map,o=new Set,s=0;for(let a of e){let e=i(n,a);e===null||!t.has(e)||(r.set(a,e),o.add(e),e!==a&&s++)}for(let n of e)r.has(n)||!t.has(n)||o.has(n)||(r.set(n,n),o.add(n));let c=r.size;for(let s of e){if(r.has(s))continue;let e=i(n,s)??a(n,s);for(;t.has(e)||o.has(e);)e=`../${e}`;r.set(s,e),o.add(e)}return{paths:r,paired:c,moved:s}}function Ve(e,t){let n=new Set(e),r=new Set(t),i=(e,t)=>{let n=new Map;for(let r of e)for(let e=r.indexOf(`/`);e!==-1;e=r.indexOf(`/`,e+1))t.has(r.slice(e+1))&&n.set(r.slice(0,e+1),(n.get(r.slice(0,e+1))??0)+1);let r=null,i=!1;for(let[e,t]of n)t>(n.get(r)??0)?[r,i]=[e,!1]:t===n.get(r)&&(i=!0);return i?null:r},a=Y(n,r,null).paired,o=[[{base:``,other:i(r,n)},n],[{base:i(n,r),other:``},r]].filter(([e])=>e.base!==null&&e.other!==null).map(([e,t])=>({root:e,side:t,...Y(n,r,e)})).filter(({side:e,paired:t,moved:n})=>t>a&&n*2>=e.size);return o.length===2&&o[0].paired===o[1].paired?null:o.toSorted((e,t)=>t.paired-e.paired)[0]?.root??null}function X(e,t){let n=[...e],r=new Set(t),i=Ve(n,r);return{root:i,paths:Y(n,r,i).paths}}function He(e,t,n){if(!e&&!t)return null;let r=Map.groupBy([...e??[]],([,e])=>e),i=new Map([...r].map(([e,t])=>[e,o(n,e,t.map(([t])=>t.slice(e.length+1)))]));return new Map([...[...e??[]].map(([e,t])=>[n.paths.get(e)??e,i.get(t)]),...t??[]])}function Ue(e,t,n=new Map,r=new Map,i=null){let a=e=>{let t=n.get(e)??r.get(e);return t===void 0?[...new Set([e,Xe(i,e)??e])]:[t]},o=[];for(let n of e.values()){let e=a(n.parent).map(e=>t.get(c(e,n.specifier,n.conditions,n.platform))).find(Boolean);if(e&&!a(n.target).includes(e.target)){let{target:t,...i}=e;o.push({...i,baseTarget:r.get(n.target)??n.target,otherTarget:t})}}return o.sort((e,t)=>e.key.localeCompare(t.key)),{changed:o,totalChanges:o.length}}function Z(e){return p(e)??0}function Q(e,t){return e===t||e?.format===`base64`&&t?.format===`base64`&&e.data===t.data||e?.format===`digest`&&t?.format===`digest`&&e.digest===t.digest}function We(e){if(e?.kind!==`stasis`||!e.bundle)return null;let{formats:t,executable:n,entries:r}=e.bundle;return e=>({format:t?.get(e),executable:n?.has(e)??!1,entry:r?.has(e)??!1})}function Ge(e,t){return!e||!t?[]:[`format`,`executable`,`entry`].filter(n=>e[n]!==t[n]).map(n=>({field:n,from:e[n],to:t[n]}))}function Ke(e){return(t,n)=>Math.abs(n.delta)-Math.abs(t.delta)||t[e].localeCompare(n[e])}function $(e){return(t,n)=>n.bytes-t.bytes||t[e].localeCompare(n[e])}function qe(e,t){return typeof e==`string`?`\0text\0${e.toWellFormed()}`:e?.format===`base64`?`\0base64\0${e.data}`:e?.format===`digest`?`\0digest\0${e.digest}`:`\0none\0${t}`}var Je=250;function Ye(e,t,n,r,i){let a=(e,t,n)=>e.filter(({path:e})=>e!==``&&e.isWellFormed()).map(({path:e},r)=>({name:e,data:qe(t.get(e),`${n}${r}`)})),o={paths:`keys`,renameGroup:i,renameLimit:Je,lines:!1},s=Be(a(e,n,`a`),a(t,r,`b`),o);return new Map(s.filter(({status:e})=>e===`renamed`).map(e=>[e.old.path,e.new.path]))}function Xe(e,t){return e?e.base===``?`${e.other}${t}`:t.startsWith(e.base)?t.slice(e.base.length):null:t}function Ze(){return{baseBytes:0,otherBytes:0,onlyBaseFiles:0,onlyOtherFiles:0,changedFiles:0}}function Qe(e,t,n,r=X(e.keys(),t.keys()),i=[]){let{root:a,paths:o}=r,s=new Map([...o].map(([e,t])=>[t,e]));e=new Map([...e].map(([e,t])=>[o.get(e),t]));let c=e=>s.get(e)===e?{}:{basePath:s.get(e)},l=(e,t)=>{let n=Ge(i[0]?.(e),i[1]?.(t));return n.length>0?{meta:n}:{}},u=[],d=[],f=[],p=0,m=0,h=0,g=0,_=0,v=0,y=new Map,b=e=>{let t=n(e),r=y.get(t);return r||(r=Ze(),y.set(t,r)),r},x=new Set([...e.keys(),...t.keys()]);for(let n of x){let r=e.has(n),i=t.has(n),a=b(n);if(r&&i){let r=e.get(n),i=t.get(n),o=Q(r,i),u=l(s.get(n),n),d=Z(r),h=o?d:Z(i);if(p+=d,m+=h,a.baseBytes+=d,a.otherBytes+=h,o&&!u.meta)v++;else{let e=h-d;f.push({path:n,...c(n),baseBytes:d,otherBytes:h,delta:e,...u,...o?{modified:!1}:{}}),_+=e,a.changedFiles++}}else if(r){let t=Z(e.get(n));p+=t,h+=t,a.baseBytes+=t,a.onlyBaseFiles++,u.push({path:n,...c(n),bytes:t})}else{let e=Z(t.get(n));m+=e,g+=e,a.otherBytes+=e,a.onlyOtherFiles++,d.push({path:n,bytes:e})}}let S=Ye(u,d,e,t,n);if(S.size>0){let n=new Set(S.values());for(let[n,r]of S){let i=e.get(n),a=t.get(r),o=Q(i,a),c=Z(i),u=o?c:Z(a);h-=c,g-=u,f.push({path:r,renamedFrom:n,basePath:s.get(n),baseBytes:c,otherBytes:u,delta:u-c,modified:!o,...l(s.get(n),r)}),_+=u-c;let d=b(n);d.onlyBaseFiles--,d.onlyOtherFiles--,d.changedFiles++}u.splice(0,u.length,...u.filter(e=>!S.has(e.path))),d.splice(0,d.length,...d.filter(e=>!n.has(e.path)))}let C=[],w=[],T=[],E=[];for(let[e,t]of y){let n=t.baseBytes>0||t.onlyBaseFiles>0||t.changedFiles>0,r=t.otherBytes>0||t.onlyOtherFiles>0||t.changedFiles>0,i=t.onlyBaseFiles+t.onlyOtherFiles+t.changedFiles;n&&!r?C.push({pkg:e,bytes:t.baseBytes}):r&&!n?w.push({pkg:e,bytes:t.otherBytes}):i>0||t.baseBytes!==t.otherBytes?T.push({pkg:e,baseBytes:t.baseBytes,otherBytes:t.otherBytes,delta:t.otherBytes-t.baseBytes}):E.push({pkg:e,bytes:t.baseBytes})}return u.sort($(`path`)),d.sort($(`path`)),f.sort(Ke(`path`)),C.sort($(`pkg`)),w.sort($(`pkg`)),T.sort(Ke(`pkg`)),{totals:{baseFiles:e.size,baseBytes:p,otherFiles:t.size,otherBytes:m,onlyBaseFiles:u.length,onlyBaseBytes:h,onlyOtherFiles:d.length,onlyOtherBytes:g,changedFiles:f.length,renamedFiles:S.size,changedDelta:_,unchangedFiles:v,fileDelta:t.size-e.size,byteDelta:m-p,identical:u.length===0&&d.length===0&&f.length===0},files:{onlyBase:u,onlyOther:d,changed:f,root:a,basePaths:o},packages:{onlyBase:C,onlyOther:w,changed:T,unchanged:E}}}function $e(e,t,n=null){let[r,i]=[e,t],a=s(r,n),o=s(i,n),c=X(a.keys(),o.keys()),u=He(m(r),m(i),c),p=Qe(a,o,e=>_(e,{packageDir:u?.get(e)}),c,[We(r),We(i)]),v=g(r),y=g(i),b=(e,t)=>{let n=0;for(let r of t)n+=e.get(r)??0;return n};Object.assign(p.totals,{baseLines:b(v,a.keys()),otherLines:b(y,o.keys())});for(let e of p.files.onlyBase)e.lines=v.get(e.basePath??e.path)??0;for(let e of p.files.onlyOther)e.lines=y.get(e.path)??0;for(let e of p.files.changed)Object.assign(e,{baseLines:v.get(e.basePath??e.path)??0,otherLines:y.get(e.path)??0});p.resolutions=Ue(l(r,n),l(i,n),new Map(p.files.changed.filter(e=>e.renamedFrom!=null).map(e=>[e.basePath,e.path])),p.files.basePaths,p.files.root);let x=e=>_(``,{packageDir:e}),S=h(r,n?a.keys():null,x),C=h(i,n?o.keys():null,x);return p.versionUpdates=f(S,C),p.packageRows=d(p.packages,S,C),p.scope=n??``,p}export{$e as prepareComparison};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,c as t}from"./chunk-GDPCLSOS.js";import{g as n,n as r,r as i,s as a,t as o,u as s,v as c,w as l,x as u}from"./chunk-FKBXNUW4.js";import{a as d}from"./chunk-NRPC74AM.js";import{e as f,i as p}from"./chunk-7C7DWL7I.js";import"./chunk-PNHBZGDD.js";import"./chunk-75YLHBCM.js";import"./chunk-FC65TPUB.js";import{D as m}from"./chunk-SXV2T5C4.js";import"./chunk-WFYLMF6Z.js";import"./chunk-C4Z6ZBXV.js";import{a as h,c as g,g as _}from"./chunk-2XUEZHIP.js";import"./chunk-TUII34K2.js";import"./chunk-OOJM4CTU.js";var v=`h1{font-size:1.35rem;margin-bottom:.5rem}h2{font-size:1.1rem;margin-bottom:.5rem}.triage-import{display:flex;gap:1rem;align-items:center;margin:1.5rem 0 2rem}.triage-import .btn{flex-shrink:0}.triage-import p{margin:0}.workspace-drop{display:grid;gap:.8rem;padding:2rem;margin:1.5rem 0;border:1px dashed var(--border);border-radius:var(--ui-radius, 8px)}.workspace-drop.dragging{border-color:var(--accent);background:rgb(from var(--accent) r g b / .08)}.workspace-drop span,p,li span{color:var(--muted);line-height:1.5}.actions,.local-choice{display:flex;gap:.8rem;flex-wrap:wrap;align-items:center}.local-choice{margin-bottom:1.5rem}.import-preview{display:grid;gap:.8rem}input:not([type=radio]),select{padding:.55rem;border:1px solid var(--border);border-radius:var(--ui-radius, 5px);color:var(--text);background:var(--bg);font:inherit}.import-preview input:not([type=radio]),.import-preview select{width:100%;box-sizing:border-box}fieldset{display:grid;gap:.8rem;padding:1rem;border:1px solid var(--border);border-radius:var(--ui-radius, 5px)}fieldset label{display:flex;gap:.5rem;align-items:center}li{padding:.4rem 0;overflow-wrap:anywhere}li span{display:block;font-size:.8rem}ul{padding-left:1.2rem}.primary{justify-self:start;color:var(--accent)}.error{color:var(--critical)}button:disabled{opacity:.5}input:focus-visible,select:focus-visible,button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
|
|
2
|
+
`;async function y(e,{session:t,confirmImport:n,...r}){if(t?.role!==`admin`||!t.csrfToken)throw Error(`An administrator session is required.`);if(e!=null&&(typeof e!=`object`||Array.isArray(e)))throw Error(`Invalid local triage.`);let i=Object.create(null);for(let[t,n]of Object.entries(e??{})){let{ignoredReports:e,scopedIgnoredReports:r,...a}=f(n)??{};Object.keys(a).length!==0&&(i[t]=a)}let a=Object.keys(i).length,o=new Set,s=[],c;if(a>0)do{r.signal?.throwIfAborted();let e=`/api/admin/reports/finding-ids`+(c?`?after=${encodeURIComponent(c)}`:``),{reports:t,nextCursor:n}=await r.api.send(e);r.signal?.throwIfAborted();for(let e of t){let t=e.findingIds.filter(e=>Object.hasOwn(i,e)&&!o.has(e));t.length>0&&s.push({id:e.id,ids:t});for(let e of t)o.add(e)}c=n}while(c);for(let e of o){if(!e||e.length>100)throw Error(`Triage finding IDs must be between 1 and 100 characters.`);if(u(i[e])===`invalid`)throw Error(`Triage for ${e} exceeds the managed server limits.`)}if(r.signal?.throwIfAborted(),n){let e=await n({matched:o.size,available:a});if(r.signal?.throwIfAborted(),!e)return null}let l=r.importedIds??new Set;for(let e of s)await C(i,{...r,importedIds:l,ids:e.ids,path:`/api/admin/reports/${encodeURIComponent(e.id)}/import-triage`});return o.size}function b(e,t){let n=[],r=Object.create(null);for(let[i,a]of Object.entries(e)){let e=t[i];if(!e)throw Error(`The server did not return the requested triage snapshot.`);let o=e.entry??{},s=r[i]={...o};delete s.comment;for(let[t,r]of Object.entries(a))if(t===`comment`){if(e.comments.some(e=>e.body===r))continue;e.comments.length>0?n.push({id:i,property:t,local:e.comments.map(e=>e.body).join(`
|
|
3
|
+
|
|
4
|
+
`),imported:r}):s.comment=r}else if(o[t]!==void 0&&o[t]!==r){let e=e=>t===`flagged`?e?`flagged`:`not flagged`:e;n.push({id:i,property:t,local:e(o[t]),imported:e(r)})}else s[t]=r}return{entries:r,conflicts:n}}async function x(e,t,n,r,i){i?.throwIfAborted();let{entries:a,conflicts:o}=b(e,t);if(o.length===0)return a;let s=await r(o,n,{title:`Triage conflicts on import`,intro:`disagree with stored triage on`,trailingNote:`Imported comments are added alongside existing comments. Other choices apply to these finding IDs across all teams.`,importedSideLabel:`Apply imported`});if(i?.throwIfAborted(),!s)throw Object.assign(Error(`Triage conflict resolution was cancelled.`),{cancelled:!0});for(let t of o){let n=s[`${t.id}:${t.property}`];if(![`local`,`imported`].includes(n))throw Error(`Resolve every triage conflict before importing.`);n===`imported`&&(a[t.id][t.property]=e[t.id][t.property])}return a}function S(e,t){let n=[],r={entries:{},expected:{}};for(let[i,a]of Object.entries(e)){let e={entries:{...r.entries,[i]:a},expected:{...r.expected,[i]:t[i].version}};if(new TextEncoder().encode(JSON.stringify(e)).length<=262144){r=e;continue}if(Object.keys(r.entries).length===0)throw Error(`This triage entry is too large to import.`);n.push(r),r={entries:{[i]:a},expected:{[i]:t[i].version}}}return Object.keys(r.entries).length>0&&n.push(r),n}async function C(e,{api:t,path:n,ids:r=Object.keys(e),importedIds:i=new Set,lookup:a=new Map,resolveConflicts:o,signal:s}){r=r.filter(t=>Object.hasOwn(e,t)&&!i.has(t));for(let c=0;c<r.length;c+=200){let l=r.slice(c,c+200);for(let r=0;r<5&&l.length>0;r++){s?.throwIfAborted();let{snapshots:r}=await t.send(n,{findingIds:l}),c=await x(Object.fromEntries(l.map(t=>[t,e[t]])),r,a,o,s);for(let e of S(c,r)){if(s?.throwIfAborted(),(await t.send(n,e)).conflict)break;Object.keys(e.entries).forEach(e=>i.add(e))}l=l.filter(e=>!i.has(e))}if(l.length>0)throw Error(`Stored triage keeps changing. Retry to resolve it against the latest values.`)}}var w=`You can retry the remaining steps.`;function T(e){return String(e?.detail??e?.message??e).replace(/\.$/u,``)}function E(e,t){return t?.aborted===!0||e?.name===`AbortError`||e?.cancelled===!0}function D(e){if(typeof e!=`string`)return{ok:!0,path:null};if(/\p{Cc}/u.test(e)||e.includes(`\\`)||e!==e.trim())return{ok:!1};let t=[];for(let n of e.split(`/`))if(n!==``&&n!==`.`){if(n===`..`||n!==n.trim())return{ok:!1};t.push(n)}let n=t.join(`/`);return n.length>500?{ok:!1}:{ok:!0,path:n===``?null:n}}async function O(e,t){let n=new Uint8Array(await e.arrayBuffer());return r(n)?t({tryPassword:e=>i(n,e)}):n[0]===31&&n[1]===139?i(n):a(new TextDecoder(`utf-8`,{fatal:!0}).decode(n))}function k(e,t,n,r,i=``){let a=e?d(e,t,r,i):null,o=n.find(t=>a?t.repoId===a.repoId:t.fullName.toLowerCase()===e?.toLowerCase());return{repoId:o?.repoId??null,directory:a?.directory??t,github:o?.fullName??e}}async function A(e,t,r=[]){let i=new Map,a=[];for(let n of e.reports){if(typeof n?.name!=`string`||!n.name||typeof n.content!=`string`)throw Error(`Every report must have a name and content.`);let u=o(n.content,n.name);if(!u.data)throw Error(`${n.name}: ${u.reason??`Unsupported report`}`);let d=m(u.data),f=d??m(n)??m({repo:{github:e.repoUrls?.[n.name]}})??c(u.data),p=d?``:l(u.data),h=D(u.data.repo?.directory);if(!h.ok)throw Error(`${n.name}: invalid repository directory`);let g=u.format===`links`?[]:(await s(n.content,n.name))?.findings??[];for(let e of g)e.id&&i.set(e.id,e);let _=h.path??``;a.push({...n,links:u.format===`links`,...k(f,_,t,r,p),declaredGithub:f,declaredDirectory:_,filePrefix:p,embedded:d,ids:[...new Set(g.map(e=>e.id).filter(Boolean))],uploaded:null})}let u=Object.create(null);if(e.triage!=null&&(typeof e.triage!=`object`||Array.isArray(e.triage)))throw Error(`Invalid workspace triage.`);let d=await n(e.triage,t=>e.reports.find(e=>e.name===t)?.content);for(let[e,t]of Object.entries(d.entries)){if(!i.has(e))continue;let n=f(t);if(!n)continue;let{ignoredReports:r,scopedIgnoredReports:a,...o}=n;Object.keys(o).length!==0&&(u[e]=o)}let p=[];for(let t of e.bundleBlobs??[]){let e=Uint8Array.fromBase64(t.data),n=`sha512-${new Uint8Array(await crypto.subtle.digest(`SHA-512`,e)).toBase64()}`;if(n!==t.integrity)throw Error(`${t.name}: bundle integrity mismatch`);p.push({name:t.name,integrity:n,bytes:e,uploaded:null})}return{name:e.workspace.name.slice(0,100),reports:a,bundles:p,triage:u,lookup:i,references:e.bundles??[],team:null,completed:new Set,importedIds:new Set}}function j(e,t,n){async function r(r,i,a={}){n?.throwIfAborted();let o=await e(r,{credentials:`same-origin`,signal:n,...i===void 0?{}:{method:`POST`,body:i instanceof File?i:JSON.stringify(i)},headers:{...i instanceof File?{}:{"content-type":`application/json`},"x-csrf-token":t.csrfToken,...a}});if(n?.throwIfAborted(),o.status===409)return{conflict:!0};if(!o.ok){let e=await o.json().then(e=>typeof e?.error==`string`?e.error:``,()=>``);n?.throwIfAborted();let t=`Import request failed (HTTP ${o.status}${e?`: ${e}`:``}).`;throw Object.assign(Error(`${t} ${w}`),{detail:t})}let s=await o.json();return n?.throwIfAborted(),s}return{send:r}}async function M(e,t,n,r,i,a){if(e.bundles.length===0&&e.references.length===0)return;let o=i??(await n.send(`/api/admin/bundles`)).bundles,s=new Set(e.bundles.map(e=>e.uploaded.id));if([...s].some(e=>!o.some(t=>t.id===e)))throw Error(`Could not verify the uploaded source bundles. Retry the import.`);let c=new Set(e.references);for(let i of o){if(!s.has(i.id)&&!c.has(i.integrity))continue;let o=!a.has(i.repoId),l=o?t:i.repoId;o&&await r(`bundle-repo:${i.id}:${l}`,()=>n.send(`/api/admin/bundles/set-repo`,{bundleId:i.id,repoId:l}));let u=o?``:i.repoDirectory??``;await r(`repo:${l}:${u}`,()=>n.send(`/api/admin/teams/set-repo`,{teamId:e.team.id,repoId:l,path:u}))}}async function N(e,t){e.uploaded||=await t.send(`/api/admin/deduplication`,new File([e.content],e.name),{"x-report-filename":encodeURIComponent(e.name)})}async function P(e,t){let n=(await t.send(`/api/admin/repositories/browsable`)).repos,r=e.reports.filter(e=>!e.links&&e.declaredGithub&&!e.uploaded);if(r.length>0){let{aliases:e=[]}=await t.send(`/api/admin/repositories/aliases`);for(let t of r)Object.assign(t,k(t.declaredGithub,t.declaredDirectory,n,e,t.filePrefix))}return new Set(n.map(e=>e.repoId))}async function F(e,{plan:t,api:n,step:r,activeRepos:i,defaultRepo:a,includeTriage:o,resolveConflicts:s,signal:c}){if(e.links){await N(e,n);return}let l=i.has(e.repoId)?e.repoId:a;if(!e.uploaded){let t=await n.send(`/api/admin/reports`,new File([e.content],e.name),{"x-report-filename":encodeURIComponent(e.name),"x-repo-id":String(l),"x-repo-directory":encodeURIComponent(e.directory)});if(t.conflict)throw Error(`Could not reuse the stored report ${e.name}. Retry the import.`);e.uploaded=t}let u=e.uploaded;i.has(u.repoId)||await r(`report-repo:${u.id}:${l}:${e.directory}`,async()=>{if((await n.send(`/api/admin/reports/set-repo`,{reportId:u.id,repoId:l,directory:e.directory})).conflict)throw Error(`Could not assign the stored report ${e.name} to its repository.`);u.repoId=l,u.repoDirectory=e.directory});let d=u.repoDirectory??``;await r(`repo:${u.repoId}:${d}`,()=>n.send(`/api/admin/teams/set-repo`,{teamId:t.team.id,repoId:u.repoId,path:d})),o&&await C(t.triage,{api:n,resolveConflicts:s,signal:c,ids:e.ids,importedIds:t.importedIds,lookup:t.lookup,path:`/api/admin/reports/${encodeURIComponent(e.uploaded.id)}/import-triage`}),await r(`publish:${e.uploaded.id}`,()=>n.send(`/api/admin/reports/set-visible`,{reportId:e.uploaded.id,visible:!0}))}async function I(e,{api:t,session:n,defaultRepo:r,includeTriage:i,resolveConflicts:a,signal:o,progress:s=()=>{}}){if(n?.role!==`admin`||!n.csrfToken)throw Error(`An administrator session is required.`);if(!e.name.trim()||e.name.trim().length>100)throw Error(`Enter a team name of up to 100 characters.`);if(i)for(let[t,n]of Object.entries(e.triage)){if(!t||t.length>100)throw Error(`Triage finding IDs must be between 1 and 100 characters. Choose Skip triage to import the files without it.`);if(u(n)===`invalid`)throw Error(`Triage for ${t} exceeds the managed server limits. Choose Skip triage to import the files without it.`)}o?.throwIfAborted();let c=null;if(e.bundles.length===0){let n=new Set(e.references);c=n.size>0?(await t.send(`/api/admin/bundles`)).bundles.filter(e=>n.has(e.integrity)):[]}if(e.reports.length===0&&e.bundles.length===0&&c.length===0)throw Error(e.references.length>0?`None of the referenced source bundles are available on the server. Export with bundle bytes included and try again.`:`This workspace contains no report or bundle files.`);let l=await P(e,t);for(let t of e.reports.filter(e=>!e.links)){if(t.embedded&&!l.has(t.repoId))throw Error(`Connect ${t.embedded} in Repositories before importing ${t.name}.`);if(!l.has(t.repoId)&&!l.has(r))throw Error(`Choose an active repository for ${t.name}.`)}if((e.bundles.length>0||c.some(e=>!l.has(e.repoId)))&&!l.has(r))throw Error(`Choose an active repository for the source bundles.`);let d=()=>o?.throwIfAborted(),f=async(t,n)=>{d(),e.completed.has(t)||(await n(),e.completed.add(t))};if(d(),!e.team){let n=await t.send(`/api/admin/teams`,{name:e.name.trim()});if(n.conflict)throw Error(`A team already has this name. Choose another name.`);e.team=n}await f(`member`,()=>t.send(`/api/admin/teams/set-member`,{teamId:e.team.id,userId:n.id,security:!0,dependencies:!0}));for(let n of e.bundles)d(),s(`Importing ${n.name}\u2026`),n.uploaded||=await t.send(`/api/admin/bundles`,new File([n.bytes],n.name),{"x-bundle-filename":encodeURIComponent(n.name)});await M(e,r,t,f,c,l);let p=[];for(let n of e.reports){d(),s(`Importing ${n.name}\u2026`);try{await F(n,{plan:e,api:t,step:f,activeRepos:l,defaultRepo:r,includeTriage:i,resolveConflicts:a,signal:o})}catch(e){if(E(e,o))throw e;p.push(`${n.name}: ${T(e)}`)}}if(p.length>0)throw Error(`Could not import ${p.length} of ${e.reports.length} files: ${p.join(`; `)}. ${w}`);return e.team}function L(e){let t=()=>e.isEncryptionEnabled()&&!e.isUnlocked();return{get locked(){return t()},unlock:t=>e.unlockEncryption(t),async read({signal:n}={}){let r=!1,i=e.onVaultStateChange(()=>{r=!0}),a=()=>{if(n?.throwIfAborted(),t()||r)throw Error(`Local data was locked or changed. Unlock it and import triage again.`)};try{a();let t=await e.readTriageBlob();return a(),t}finally{i()}}}}function R(e){let t=()=>e.isEncryptionEnabled()&&!e.isUnlocked();async function n(){let t=JSON.parse(await e.hydrateKey(`deepview.workspaces`)||`[]`);return(Array.isArray(t)?t:t.workspaces??[]).filter(e=>typeof e.id==`string`&&typeof e.name==`string`)}async function r(n,r){let i=!1,a=[e.onVaultStateChange,e.onFileMutated,e.onBundleMutated].map(e=>e(()=>{i=!0})),o=()=>{if(r?.throwIfAborted(),t()||i)throw Error(`Local data was locked or changed. Unlock it and select the workspace again.`)};try{o();let e=await n(o);return o(),e}finally{a.forEach(e=>e())}}return{get locked(){return t()},unlock:t=>e.unlockEncryption(t),list:({signal:e}={})=>r(async()=>(await n()).map(e=>({id:e.id,name:e.name})),e),read:(t,{signal:i}={})=>r(async r=>{let i=(await n()).find(e=>e.id===t);if(!i)throw Error(`This local workspace no longer exists.`);let a=JSON.stringify(i),o=JSON.parse(await e.hydrateKey(`deepview.repoUrls`)||`{}`),s=[];for(let t of i.reports??[]){r();let n=await e.withStoredItem(`report`,t,()=>e.readFile(t));r(),s.push({name:t,content:n,...o[t]?{repo:{github:o[t]}}:{}})}let c=await e.listBundles(),l=[];for(let t of i.bundles??[]){r();let n=c.find(e=>e.integrity===t);if(!n)continue;let i=await e.withStoredItem(`bundle`,t,()=>e.readBundle(t));r(),l.push({integrity:t,name:n.name,data:i.toBase64()})}let u=await e.readTriageBlob()??{};if(JSON.stringify((await n()).find(e=>e.id===t))!==a)throw Error(`The local workspace changed. Select it again.`);return{version:1,workspace:{id:t,name:i.name,privateKey:``},reports:s,bundles:i.bundles??[],bundleBlobs:l,triage:u,repoUrls:o}},i)}}var z=e=>e===`bundle`?`bundles`:`reports`,B=(e,t)=>JSON.stringify([e,t||``]),V=(e,t)=>new Set(t.map(t=>e===`bundle`?t.integrity:B(t.sha256,t.analyzer)));async function H(e){let t=new Uint8Array(await e.arrayBuffer()),n=o(new TextDecoder().decode(t),e.name);if(!n.data)throw Error(n.reason??`Not a recognized report`);let r=new Uint8Array(await crypto.subtle.digest(`SHA-256`,t)).toBase64({alphabet:`base64url`,omitPadding:!0});return{hash:r,key:B(r,typeof n.data.source==`string`?n.data.source:null)}}async function U(e,{source:t,deps:n,api:r,signal:i}){let a=JSON.parse(await n.hydrateKey(`deepview.workspaces`)||`[]`),o=(Array.isArray(a)?a:a.workspaces??[]).filter(e=>typeof e.id==`string`&&typeof e.name==`string`);i.throwIfAborted();let s=await t.list(e),c=V(e,(await r.send(`/api/admin/${z(e)}`))[z(e)]),l=o.map(e=>({id:e.id,name:e.name,items:[]})),u={id:null,name:`Not in a workspace`,items:[]},d=[];for(let r of s){i.throwIfAborted();let a={value:r.value,name:r.label,key:r.value,synced:!1,present:!1,error:``};if(e===`report`)try{Object.assign(a,await t.importItem(e,a.value,H,{signal:i})),a.syncHash=await n.reportSyncHash(a.value)}catch(e){i.throwIfAborted(),a.error=String(e?.message??e)}i.throwIfAborted(),a.present=c.has(a.key);let s=!1;o.forEach((t,r)=>{if(!t[z(e)]?.includes(a.value))return;let i=n.localContentSyncStatus(t.id,e,a.value,a.syncHash);a.synced||=i.synced,l[r].items.push({item:a,...i}),s=!0}),s||u.items.push({item:a,synced:!1,cached:!1}),d.push(a)}return{kind:e,items:d,groups:[...l,u].filter(e=>e.items.length>0)}}async function W(e,t,{source:n,api:r,signal:i,progress:a=()=>{},imported:o=new Set}){let{kind:s}=e,c=V(s,(await r.send(`/api/admin/${z(s)}`))[z(s)]),l=new Set(t),u=[],d=0;for(let t of e.items)if(i.throwIfAborted(),!(!l.has(t.value)||t.error||t.present)){if(c.has(t.key)){t.present=!0;continue}a(`Importing ${t.name}\u2026`),d++;try{await n.importItem(s,t.value,async e=>{let n=s===`report`?(await H(e)).key:await p(new Uint8Array(await e.arrayBuffer()));if(i.throwIfAborted(),n!==t.key)throw Error(`${t.name} changed. Choose files again before importing.`);if((await r.send(`/api/admin/${z(s)}`,e,{[`x-${s}-filename`]:encodeURIComponent(e.name)})).conflict)throw Error(`Could not import ${t.name}. Try again.`)},{signal:i})}catch(e){if(E(e,i))throw e;u.push(`${t.name}: ${T(e)}`);continue}c.add(t.key),t.present=!0,o.add(t.value)}if(u.length>0)throw Error(`Imported ${d-u.length} of ${d} ${s}s. Could not import ${u.join(`; `)}. Import again to retry them.`);return o.size}var G=(e,t)=>e===void 0?`managed-only`:t===void 0?`local-only`:`mismatch`;function K(e,t){let n=t.slice(),r=e.map(e=>{let t=n.indexOf(e);return t!==-1&&n.splice(t,1),{text:e,different:t===-1}}),i=e.slice(),a=t.map(e=>{let t=i.indexOf(e);return t!==-1&&i.splice(t,1),{text:e,different:t===-1}});return!r.some(e=>e.different)&&!a.some(e=>e.different)?null:{property:`comment`,local:r,managed:a,kind:r.some(e=>e.different)?a.some(e=>e.different)?`mismatch`:`local-only`:`managed-only`}}function q(e,t){let n=f(e)??{},r=f(t.entry)??{},i=[];for(let e of[`triage`,`color`,`fix`,`flagged`])n[e]!==r[e]&&i.push({property:e,local:n[e],managed:r[e],kind:G(n[e],r[e])});let a=K(n.comment?[n.comment]:[],t.comments.map(e=>e.body));return a&&i.push(a),n.ignoredReports?.length&&i.push({property:`ignoredReports`,local:[...new Set(n.ignoredReports)],managed:void 0,kind:`local-only`}),i}async function J(e,{lookup:t,triage:n,matched:r,findings:i,api:a,signal:o}){let s=[...new Set(e.findingIds)].filter(e=>t.has(e)&&!r.has(e));for(let c=0;c<s.length;c+=200){let l=s.slice(c,c+200);if(l.some(e=>e.length>100))throw Error(`A shared finding ID exceeds the managed triage limit.`);o.throwIfAborted();let{snapshots:u}=await a.send(`/api/admin/reports/${encodeURIComponent(e.id)}/import-triage`,{findingIds:l});o.throwIfAborted();for(let e of l){if(!u?.[e])throw Error(`The server did not return the requested triage snapshot.`);let a=q(n[e],u[e]);a.length>0&&i.push({id:e,finding:t.get(e),differences:a}),r.add(e)}}}async function Y({source:e,readTriage:t,api:n,signal:r,progress:i=()=>{}}){let a=new Map,c=[];for(let t of await e.list(`report`)){r.throwIfAborted(),i(`Reading ${t.label}\u2026`);try{let n=await e.importItem(`report`,t.value,async e=>{let t=await e.text(),n=o(t,e.name);if(!n.data)throw Error(n.reason??`Not a recognized report`);return n.format===`links`?[]:(await s(t,e.name))?.findings??[]},{signal:r});r.throwIfAborted();for(let e of n)typeof e.id!=`string`||!e.id||(a.has(e.id)||a.set(e.id,{...e,reports:[]}),a.get(e.id).reports.push(t.label))}catch(e){r.throwIfAborted(),c.push({name:t.label,reason:String(e?.message??e)})}}let l=await t()??{};if(r.throwIfAborted(),typeof l!=`object`||Array.isArray(l))throw Error(`Invalid local triage.`);let u=[],d=new Set;if(a.size===0)return{matched:0,localFindings:0,findings:u,skipped:c};let f;do{r.throwIfAborted(),i(`Comparing local and managed triage…`);let e=await n.send(`/api/admin/reports/finding-ids`+(f?`?after=${encodeURIComponent(f)}`:``));r.throwIfAborted();for(let t of e.reports)await J(t,{lookup:a,triage:l,matched:d,findings:u,api:n,signal:r});f=e.nextCursor}while(f);return r.throwIfAborted(),{matched:d.size,localFindings:a.size,findings:u,skipped:c}}function X(n,r){if(customElements.get(`managed-admin-import`))return;class i extends n{static styles=[h(t),h(v)];static properties={localDeps:{attribute:!1},_busy:{state:!0},_error:{state:!0},_message:{state:!0},_plan:{state:!0},_catalog:{state:!0},_localOpen:{state:!0},_workspaces:{state:!0},_localId:{state:!0},_triage:{state:!0},_repo:{state:!0},_drag:{state:!0}};constructor(){super(),this._busy=!1,this._error=``,this._message=``,this._plan=null,this._catalog=null,this._workspaces=[],this._localOpen=!1,this._localId=``,this._triage=``,this._repo=null,this._files=[],this._drag=!1,this._local=!1,this._over=e=>{e.dataTransfer?.types?.includes(`Files`)&&(e.preventDefault(),this._drag=!0)},this._drop=e=>{e.dataTransfer?.types?.includes(`Files`)&&(e.preventDefault(),e.stopPropagation(),this._drag=!1,this._busy||(this._files.push(...e.dataTransfer.files),this._nextFile()))},this._localChanged=()=>{this._workspaces=[],this._localId=``,!this._unlocking&&(this._local&&(this._plan=null),(this._local||this._importingTriage||this._importingContent||this._comparingTriage)&&(this._operation?.abort(),this._message=``,this._error=this._comparingTriage?`Local data changed or was locked. Compare triage again to continue.`:this._importingContent?`Local data changed or was locked. Choose files again to continue.`:this._importingTriage?`Local data changed or was locked. Import triage again to continue.`:`Local data changed or was locked. Choose the workspace again.`))},this._blur=()=>{this._readingLocal&&this._localChanged()}}connectedCallback(){super.connectedCallback(),this.addEventListener(`dragover`,this._over),this.addEventListener(`drop`,this._drop),globalThis.addEventListener(`blur`,this._blur),globalThis.addEventListener(`storage`,this._localChanged),this._offVault=this.localDeps?.onVaultStateChange(this._localChanged),this._loadCatalog()}disconnectedCallback(){this._operation?.abort(),this._offVault?.(),this._plan=null,this._files=[],this.removeEventListener(`dragover`,this._over),this.removeEventListener(`drop`,this._drop),globalThis.removeEventListener(`blur`,this._blur),globalThis.removeEventListener(`storage`,this._localChanged),super.disconnectedCallback()}updated(e){e.has(`session`)&&(this._role!==`admin`||e.get(`session`)?.id!==this.session?.id)&&(this._operation?.abort(),this._plan=null,this._files=[])}async _action(e){if(this._busy||this._role!==`admin`)return;let t=this._operation=new AbortController,n=AbortSignal.any([t.signal,this.appState.sessionController.signal]);this._busy=!0,this._error=``;try{await e(n),n.throwIfAborted()}catch(e){n.aborted||(this._error=String(e?.message??e))}finally{this._operation===t&&(this._busy=!1)}}async _loadCatalog(){if(this._role===`admin`)try{await this._loadCollection(`workspace-import:catalog`,`import options`,async e=>{let t=j(r,this.session,e),[n,i,a,o]=await Promise.all([t.send(`/api/admin/reports`),t.send(`/api/admin/teams`),t.send(`/api/admin/bundles`),t.send(`/api/admin/repositories/aliases`)]);return{repos:n.repos,teams:i.teams,bundles:a.bundles,aliases:o.aliases}},e=>{this._catalog=e})}catch(e){this._error=String(e?.message??e)}}_browse(){let e=document.createElement(`input`);e.type=`file`,e.multiple=!0,e.accept=`.enc,.gz,.json`,e.addEventListener(`change`,()=>{this._files.push(...e.files),this._nextFile()},{once:!0}),e.click()}async _prepare(e,t){if(!e)return;if(this._catalog||await this._loadCatalog(),t.throwIfAborted(),!this._catalog)throw Error(`Could not load repositories. Try again.`);let n=await A(e,this._catalog.repos,this._catalog.aliases);t.throwIfAborted();let r=new Set(this._catalog.teams.map(e=>e.name)),i=n.name||`Imported workspace`,a=2;for(;r.has(n.name);){let e=` (${a++})`;n.name=i.slice(0,100-e.length)+e}let o=new Set(n.reports.map(e=>e.repoId).filter(e=>e!=null));this._repo=o.size===1?[...o][0]:null,this._triage=Object.keys(n.triage).length>0?``:`skip`,this._plan=n,this._message=``}async _nextFile(){if(this._files.length===0||this._busy)return;let e=this._files.shift();this._local=!1,this._plan=null,await this._action(async t=>{let n=await O(e,this.promptPassword);t.throwIfAborted(),await this._prepare(n,t)})}async _unlock(e,t){this._unlocking=!0;try{return!e.locked||await e.unlock({signal:t})}finally{this._unlocking=!1}}async _chooseLocal(){this._localOpen=!0,await this._action(async e=>{let t=R(this.localDeps);await this._unlock(t,e)&&(e.throwIfAborted(),this._workspaces=await t.list({signal:e}))})}async _readLocal(){if(!this._localId)return;let e=this._localId;this._local=!0,this._plan=null,await this._action(async t=>{let n=R(this.localDeps);if(await this._unlock(n,t)){this._readingLocal=!0;try{await this._prepare(await n.read(e,{signal:t}),t)}finally{this._readingLocal=!1}}})}async _import(){!this._plan||!this._triage||!this._csrf||(await this._action(async e=>{if(this._local&&R(this.localDeps).locked)throw Error(`Unlock local data and choose the workspace again.`);let t=this._plan,n=[`teams`,`reports`,`bundles`,`history`,`workspace-import`,`scan-sources`,`repo-impact`];try{let i=await this.appState.mutate(()=>I(t,{api:j(r,this.session,e),session:this.session,defaultRepo:this._repo,includeTriage:this._triage===`include`,resolveConflicts:this.resolveConflicts,signal:e,progress:e=>{this._message=e}}),n);this._catalog.teams.push(i),this._message=`Imported into ${i.name}.`,this._plan=null}finally{this.appState.invalidate(n),t.team&&this.dispatchEvent(new CustomEvent(`managed-import-complete`,{bubbles:!0,composed:!0}))}}),!this._plan&&!this._error&&await this._nextFile())}async _importLocalTriage(){this._csrf&&await this._action(async e=>{this._importingTriage=!0,this._message=``;let t=new Set,n=[`reports`,`history`];try{let n=L(this.localDeps);if(!await this._unlock(n,e))return;this._readingLocal=!0;let i;try{i=await n.read({signal:e})}finally{this._readingLocal=!1}let a=await y(i,{api:j(r,this.session,e),session:this.session,resolveConflicts:this.resolveConflicts,signal:e,importedIds:t,confirmImport:async t=>(await this.confirmTriageImport({...t,signal:e}))?.confirmed===!0});if(e.throwIfAborted(),a===null)return;this._message=a?`Imported triage for ${a} finding${a===1?``:`s`}.`:`No local triage matches findings in managed reports.`}finally{this._importingTriage=!1,this.appState.invalidate(n),t.size>0&&this.dispatchEvent(new CustomEvent(`managed-import-complete`,{bubbles:!0,composed:!0}))}})}async _compareLocalTriage(){this._csrf&&await this._action(async e=>{this._comparingTriage=!0,this._message=``;let t=this.localImportSource,n=t.subscribe(this._localChanged);try{if(!await this._unlock(t,e))return;e.throwIfAborted(),this._readingLocal=!0;let n=L(this.localDeps),i=await Y({source:t,signal:e,readTriage:()=>n.read({signal:e}),api:j(r,this.session,e),progress:e=>{this._message=e}});e.throwIfAborted(),this._message=``,await this.showTriageComparison({comparison:i,signal:e})}finally{n(),this._readingLocal=!1,this._comparingTriage=!1,this._message=``}})}async _importLocalContent(e){this._csrf&&await this._action(async t=>{this._importingContent=!0,this._message=``;let n=this.localImportSource,i=[`reports`,`bundles`,`bundle-metadata`,`history`,`workspace-import`,`scan-sources`,`repo-impact`],a=new Set,o=n.subscribe(this._localChanged);try{if(!await this._unlock(n,t))return;t.throwIfAborted(),this._readingLocal=!0;let i=j(r,this.session,t),o=await U(e,{source:n,deps:this.localDeps,api:i,signal:t}),s=await this.confirmContentImport({plan:o,signal:t});if(t.throwIfAborted(),!s?.confirmed)return;let c=await W(o,s.selected,{source:n,api:i,signal:t,imported:a,progress:e=>{this._message=e}});this._message=`Imported ${c} ${e}${c===1?``:`s`}.`}finally{o(),this._readingLocal=!1,this._importingContent=!1,this.appState.invalidate(i),a.size>0&&this.dispatchEvent(new CustomEvent(`managed-import-complete`,{bubbles:!0,composed:!0}))}})}render(){if(this._role!==`admin`)return _;let t=this._plan,n=t?Object.keys(t.triage).length:0,r=new Set([...t?.references??[],...t?.bundles.map(e=>e.integrity)??[]]),i=(this._catalog?.bundles??[]).filter(e=>r.has(e.integrity)),a=t?.references.filter(e=>!t.bundles.some(t=>t.integrity===e)).length??0;return g`<div class="wrap" @dragleave="${()=>{this._drag=!1}}">${e(`manage-import`,this._role,this.allowShare)}<h1>Import</h1><section class="triage-import" aria-label="Import local files"><div class="actions"><button type="button" class="btn" ?disabled="${this._busy||!this._csrf}" @click="${()=>this._importLocalContent(`bundle`)}">Import bundles</button> <button type="button" class="btn" ?disabled="${this._busy||!this._csrf}" @click="${()=>this._importLocalContent(`report`)}">Import reports</button></div><p>Choose files from this browser, grouped by workspace. Import files without teams or triage.</p></section><section class="triage-import" aria-label="Local triage"><div class="actions"><button type="button" class="btn" ?disabled="${this._busy||!this._csrf}" @click="${()=>this._importLocalTriage()}">Import triage</button> <button type="button" class="btn" ?disabled="${this._busy||!this._csrf}" @click="${()=>this._compareLocalTriage()}">Compare triage</button></div><p>Import saved triage and comments for findings already in managed reports.<br>Unmatched data stays in this browser.<br>Conflicting values prompt for resolution; per-report ignores are skipped.</p></section><h2>Import workspace</h2><p class="intro ui-hint">Create a new team from a workspace export or a workspace stored in this browser.</p><section class="${`workspace-drop ${this._drag?`dragging`:``}`}" aria-label="Workspace files"><strong>Drop workspace files here</strong><span>Encrypted exports, JSON, or compressed JSON. Encrypted files prompt for a password.</span><div class="actions"><button type="button" class="btn" ?disabled="${this._busy||!this._catalog}" @click="${()=>this._browse()}">Choose files</button> <button type="button" class="btn" ?disabled="${this._busy}" @click="${()=>this._chooseLocal()}">Choose local workspace</button></div></section>${this._localOpen?g`<section class="local-choice"><label for="local-workspace">Local workspace</label> <select id="local-workspace" .value="${this._localId}" ?disabled="${this._busy}" @change="${e=>{this._localId=e.target.value}}"><option value="">Choose a workspace…</option>${this._workspaces.map(e=>g`<option value="${e.id}">${e.name}</option>`)}</select> <button type="button" class="btn" ?disabled="${this._busy||!this._localId}" @click="${()=>this._readLocal()}">Select workspace</button> ${!this._busy&&this._workspaces.length===0?g`<p class="ui-hint">No unlocked local workspaces. Choose local workspace to unlock or refresh.</p>`:_}</section>`:_} ${t?g`<section class="import-preview" aria-label="Import options">${t.team?g`<p>Team ${t.team.name} has been created. Retry continues its remaining import steps.</p>`:_} <label for="import-team">New team name</label><input id="import-team" maxlength="100" .value="${t.name}" ?disabled="${this._busy||!!t.team}" @input="${e=>{t.name=e.target.value,this.requestUpdate()}}"><p>${t.reports.length} reports / links · ${r.size} source bundles · ${n} triaged findings</p><label for="import-repo">Repository for files and source bundles without an active repository</label> <select id="import-repo" .value="${String(this._repo??``)}" ?disabled="${this._busy||!!t.team}" @change="${e=>{this._repo=e.target.value?Number(e.target.value):null}}"><option value="" ?selected="${this._repo==null}">Choose a repository…</option>${(this._catalog?.repos??[]).map(e=>g`<option value="${String(e.repoId)}" ?selected="${this._repo===e.repoId}">${e.fullName}</option>`)}</select><p>Declared report repositories and directories are preserved. Stored reports without an active repository use the selected repository. The new team receives those repository paths; other published reports in the same paths are also visible to that team.</p><ul>${t.reports.map(e=>g`<li>${e.name}<span>${e.links?`Global deduplication — enabled for all teams`:e.github??`Uses selected repository`}${e.links||e.github==null||e.repoId!=null?``:e.embedded?` — connect this repository first`:` — not connected; uses selected repository`}</span></li>`)}</ul>${i.length>0?g`<p>Existing source bundles in active repositories keep their locations. The new team also receives access to those directories. Unassigned bundles and bundles in inactive repositories use the selected repository.</p><ul>${i.map(e=>g`<li>${e.filename}<span>${e.repoFullName?`${e.repoFullName}${e.repoDirectory?`/${e.repoDirectory}`:``}`:`Uses selected repository`}</span></li>`)}</ul>`:_} ${a?g`<p>${a} referenced source bundles have no bytes in this export. Reports can use matching bundles already on the server.</p>`:_} ${n?g`<fieldset ?disabled="${this._busy||!!t.team}"><legend>Import triage?</legend><label><input type="radio" name="import-triage" value="include" ?checked="${this._triage===`include`}" @change="${()=>{this._triage=`include`}}"> Include triage and comments</label> <label><input type="radio" name="import-triage" value="skip" ?checked="${this._triage===`skip`}" @change="${()=>{this._triage=`skip`}}"> Skip triage</label><p>Conflicting values prompt for resolution. Triage stays shared by finding ID across teams. Per-report local ignores are not imported.</p></fieldset>`:_} <button type="button" class="btn primary" ?disabled="${this._busy||!this._triage||!this._csrf}" @click="${()=>this._import()}">${this._busy?`Importing…`:t.team?`Retry remaining import`:`Import workspace`}</button></section>`:_} ${this._message?g`<p role="status">${this._message}</p>`:_} ${this._error?g`<p class="error" role="alert">${this._error}${this._catalog?_:g`<button class="btn" @click="${()=>this._loadCatalog()}">Retry</button>`}</p>`:_} ${this._files.length>0&&!this._busy?g`<button class="btn" @click="${()=>this._nextFile()}">Next workspace file (${this._files.length} waiting)</button>`:_}</div>`}}customElements.define(`managed-admin-import`,i)}export{X as registerWorkspaceImport};
|