@preventive/triage 1.0.0-alpha.6 → 1.0.0-alpha.61
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 +376 -0
- package/common/bundle-compare-inputs.d.ts +3 -0
- package/common/bundle-compare-inputs.js +141 -0
- package/common/bundle-compare-versions.js +172 -0
- package/common/bundle-comparison.d.ts +8 -0
- package/common/bundle-comparison.js +69 -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 +36 -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/finding-repo.d.ts +5 -0
- package/common/finding-repo.js +67 -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 +43 -0
- package/common/managed/finding-detail.d.ts +5 -0
- package/common/managed/finding-detail.js +75 -0
- package/common/managed/finding-values.d.ts +2 -0
- package/common/managed/finding-values.js +44 -0
- package/common/managed/github-agents.ts +114 -0
- package/common/managed/github-logins.ts +49 -0
- package/common/managed/lite-name.d.ts +2 -0
- package/common/managed/lite-name.js +20 -0
- package/common/managed/npm-packages.d.ts +7 -0
- package/common/managed/npm-packages.js +51 -0
- package/common/managed/permissions.ts +31 -0
- package/common/managed/report-content.ts +72 -0
- package/common/managed/report-filter.ts +120 -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 +363 -0
- package/common/managed/scan-models.ts +6 -0
- package/common/managed/team-app.d.ts +15 -0
- package/common/managed/team-app.js +100 -0
- package/common/managed/team-filters.js +26 -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/repo-commit.d.ts +4 -0
- package/common/repo-commit.js +30 -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 +71 -0
- package/common/workspace-groups.js +176 -0
- package/out/activity.js +4 -0
- package/out/brotli-fallback.js +3 -3
- package/out/chunk-2XUEZHIP.js +28 -0
- package/out/chunk-4EMM6UCD.js +1 -0
- package/out/chunk-4ISO5F7Y.js +7 -0
- package/out/chunk-4XIH7YTX.js +1 -0
- package/out/chunk-6CCSTJWB.js +1 -0
- package/out/chunk-74AEKRES.js +10 -0
- package/out/chunk-7BKKYVWR.js +7 -0
- package/out/chunk-7C7DWL7I.js +1 -0
- package/out/chunk-B3FNMHOE.js +1 -0
- package/out/chunk-BNH52UHC.js +2 -0
- package/out/chunk-BRO77PQY.js +42 -0
- package/out/chunk-C4Z6ZBXV.js +10 -0
- package/out/chunk-DEVAORP2.js +1 -0
- package/out/chunk-E3LFSUDJ.js +9 -0
- package/out/chunk-G3LY2FV4.js +1 -0
- package/out/chunk-GO7FT4OD.js +1 -0
- package/out/chunk-GRGIZOTP.js +4 -0
- package/out/chunk-HAZKDK4M.js +4 -0
- package/out/chunk-HOB3YPS5.js +1 -0
- package/out/chunk-IYPY47MC.js +1 -0
- package/out/chunk-IZ6MYRYB.js +3 -0
- package/out/chunk-J2FWBXFV.js +1 -0
- package/out/chunk-JCIIBLKR.js +1 -0
- package/out/chunk-JFL7WLRV.js +1 -0
- package/out/chunk-JJK5OZG2.js +15 -0
- package/out/chunk-JMG5DXII.js +2 -0
- package/out/chunk-JOXLZXMI.js +1 -0
- package/out/chunk-M37X4LCF.js +14 -0
- package/out/chunk-M3Y6SLC4.js +1 -0
- package/out/chunk-NRPC74AM.js +1 -0
- package/out/chunk-NXATZJQ2.js +1 -0
- package/out/chunk-OFZYEWBH.js +244 -0
- package/out/chunk-OIERSXON.js +1 -0
- package/out/chunk-OOJM4CTU.js +1 -0
- package/out/chunk-PAD2JHZT.js +1 -0
- package/out/chunk-PNHBZGDD.js +1 -0
- package/out/chunk-PTFQKLKO.js +1 -0
- package/out/chunk-PWFUOLZK.js +17 -0
- package/out/chunk-PXK7EU4V.js +1 -0
- package/out/chunk-QCOGVL37.js +52 -0
- package/out/chunk-QMVOEBWC.js +13 -0
- package/out/chunk-QRKFPLA4.js +80 -0
- package/out/chunk-R3NZFXVR.js +1 -0
- package/out/chunk-R5O6FAW4.js +2 -0
- package/out/chunk-RRBIJL2B.js +1 -0
- package/out/chunk-SYXT3SFP.js +2 -0
- package/out/chunk-TOXMUOIW.js +5 -0
- package/out/chunk-TUII34K2.js +1 -0
- package/out/chunk-UCP3JRE2.js +1 -0
- package/out/chunk-VFWMQ3LG.js +2 -0
- package/out/chunk-VRX2APNA.js +9 -0
- package/out/chunk-W3QFV4SP.js +3 -0
- package/out/chunk-W6VOKW2N.js +12 -0
- package/out/chunk-WCPJDAYA.js +10 -0
- package/out/chunk-WMFDQS2L.js +11 -0
- package/out/chunk-WREU7JAG.js +1 -0
- package/out/chunk-Y5ZHFNBD.js +2 -0
- package/out/chunk-YF4M5OCI.js +1 -0
- package/out/chunk-Z667U2UJ.js +1 -0
- package/out/chunk-ZQHLECTI.js +1 -0
- package/out/chunk-ZQNEWVGG.js +1 -0
- package/out/client-managed-import.js +4 -0
- package/out/client-managed.js +34 -0
- package/out/client-sync.js +11 -17
- package/out/compare.js +40 -0
- package/out/dialogs.js +40 -0
- package/out/github-issue-authorized.html +3 -0
- package/out/github-issue-authorized.js +1 -0
- package/out/graph.js +19 -4
- package/out/index.html +106 -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 +383 -63
- package/risk/actions/findings.js +161 -0
- package/risk/actions/resolve.js +250 -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 +272 -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 +38 -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 +390 -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 → server-e2e}/objstore/fetch-mint-guard.ts +2 -2
- 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 → server-e2e}/objstore/rest-deny.ts +1 -1
- package/{server → server-e2e}/objstore/rest-mint.ts +3 -3
- 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 +238 -0
- package/server-managed/agent-merges.ts +109 -0
- package/server-managed/app-agents.ts +23 -0
- package/server-managed/avatar-store.ts +13 -0
- package/server-managed/blob-store.ts +26 -0
- package/server-managed/brotli.ts +10 -0
- package/server-managed/bundle-advisories.ts +103 -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 +238 -0
- package/server-managed/bundle-build.ts +240 -0
- package/server-managed/bundle-cache.ts +199 -0
- package/server-managed/bundle-catalog.ts +29 -0
- package/server-managed/bundle-commits.ts +133 -0
- package/server-managed/bundle-dependency-reviews.ts +68 -0
- package/server-managed/bundle-store.ts +24 -0
- package/server-managed/bundle-summary-cache.ts +139 -0
- package/server-managed/bundle-validation.ts +33 -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 +43 -0
- package/server-managed/comments.ts +138 -0
- package/server-managed/commit-coauthors.ts +105 -0
- package/server-managed/commit-lockfiles.ts +77 -0
- package/server-managed/comparison.ts +50 -0
- package/server-managed/config.ts +163 -0
- package/server-managed/content-access.ts +15 -0
- package/server-managed/crypto.ts +25 -0
- package/server-managed/db-methods.ts +1877 -0
- package/server-managed/db-neon.ts +388 -0
- package/server-managed/db-schema.ts +253 -0
- package/server-managed/db-table-names.ts +22 -0
- package/server-managed/db.ts +146 -0
- package/server-managed/dependabot-access.ts +61 -0
- package/server-managed/dependabot-alerts.ts +180 -0
- package/server-managed/dependency-review-comments.ts +92 -0
- package/server-managed/dependency-reviews.ts +363 -0
- package/server-managed/github-accounts.ts +59 -0
- package/server-managed/github-actions.ts +71 -0
- package/server-managed/github-app.ts +347 -0
- package/server-managed/github-errors.ts +70 -0
- package/server-managed/github-graphql.ts +42 -0
- package/server-managed/github-issue-links.ts +264 -0
- package/server-managed/github-issue-oauth.ts +30 -0
- package/server-managed/github-issues.ts +157 -0
- package/server-managed/github-link-oauth.ts +56 -0
- package/server-managed/github-links.ts +204 -0
- package/server-managed/github-metadata.ts +213 -0
- package/server-managed/github-oauth.ts +264 -0
- package/server-managed/github-pulls.ts +257 -0
- package/server-managed/github-requests.ts +179 -0
- package/server-managed/github-users.ts +30 -0
- package/server-managed/github-values.ts +26 -0
- package/server-managed/history-windows.ts +172 -0
- package/server-managed/http-response.ts +76 -0
- package/server-managed/http.ts +5796 -0
- package/server-managed/import-triage.ts +51 -0
- package/server-managed/index.ts +204 -0
- package/server-managed/kept-briefly.ts +37 -0
- package/server-managed/kept.ts +28 -0
- package/server-managed/link-reports.ts +149 -0
- package/server-managed/listed-activity.ts +39 -0
- package/server-managed/locked-packages.ts +152 -0
- package/server-managed/lockfile-scope.ts +49 -0
- package/server-managed/lru.ts +30 -0
- package/server-managed/managed-issues.ts +92 -0
- package/server-managed/management-catalog.ts +45 -0
- package/server-managed/management.ts +110 -0
- package/server-managed/npm-delta-worker.js +23 -0
- package/server-managed/npm-delta.ts +159 -0
- package/server-managed/npm-insights.ts +455 -0
- package/server-managed/npm-kept.ts +234 -0
- package/server-managed/npm-loads.ts +259 -0
- package/server-managed/npm-manifest.ts +117 -0
- package/server-managed/npm-packages.ts +462 -0
- package/server-managed/npm-patch.ts +317 -0
- package/server-managed/npm-provenance.ts +127 -0
- package/server-managed/npm-risk.ts +287 -0
- package/server-managed/object-storage-disk.ts +147 -0
- package/server-managed/object-storage-vercel.ts +71 -0
- package/server-managed/object-storage.ts +82 -0
- package/server-managed/package-entry-points.ts +79 -0
- package/server-managed/pretty-print.ts +425 -0
- package/server-managed/public-workspace.ts +242 -0
- package/server-managed/pull-comment-reviews.ts +161 -0
- package/server-managed/pull-dependencies.ts +340 -0
- package/server-managed/pull-dependency-reviews.ts +327 -0
- package/server-managed/pull-reviews.ts +202 -0
- package/server-managed/queue.ts +53 -0
- package/server-managed/release-commits.ts +85 -0
- package/server-managed/rename-diff-worker.js +26 -0
- package/server-managed/rename-diff.ts +236 -0
- package/server-managed/repo-path.ts +21 -0
- package/server-managed/report-migration.ts +32 -0
- package/server-managed/report-query.ts +10 -0
- package/server-managed/report-response.ts +16 -0
- package/server-managed/report-sources.ts +181 -0
- package/server-managed/report-store.ts +77 -0
- package/server-managed/repository-actions.ts +220 -0
- package/server-managed/repository-agents.ts +422 -0
- package/server-managed/repository-aliases.ts +85 -0
- package/server-managed/repository-browser.ts +303 -0
- package/server-managed/repository-changes.ts +280 -0
- package/server-managed/repository-code.ts +215 -0
- package/server-managed/repository-dependency-reviews.ts +159 -0
- package/server-managed/repository-discovery.ts +83 -0
- package/server-managed/repository-history.ts +428 -0
- package/server-managed/repository-issues.ts +224 -0
- package/server-managed/repository-policy.ts +27 -0
- package/server-managed/repository-pulls.ts +207 -0
- package/server-managed/repository-pulse.ts +477 -0
- package/server-managed/repository-risk-assess.ts +108 -0
- package/server-managed/repository-risk-audit.ts +78 -0
- package/server-managed/repository-risk-read.ts +170 -0
- package/server-managed/repository-risk.ts +483 -0
- package/server-managed/repository-squashes.ts +160 -0
- package/server-managed/repository-stamp.ts +41 -0
- package/server-managed/request-timing.ts +63 -0
- package/server-managed/reviewed-dependencies.ts +149 -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 +107 -0
- package/server-managed/stasis-config.ts +55 -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 +288 -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-summaries.ts +54 -0
- package/server-managed/team-app.ts +154 -0
- package/server-managed/team-catalog.ts +7 -0
- package/server-managed/team-feed.ts +180 -0
- package/server-managed/team-npm-scopes.ts +103 -0
- package/server-managed/team-reports.ts +351 -0
- package/server-managed/triage-response.ts +16 -0
- package/server-managed/type-only-proof.js +108 -0
- package/server-managed/type-only-worker.js +31 -0
- package/server-managed/type-only.ts +115 -0
- package/server-managed/uploads.ts +106 -0
- package/server-managed/upstream-cache.ts +250 -0
- package/server-managed/view-as.ts +58 -0
- package/server-managed/worker-turns.ts +76 -0
- package/server-managed/workspace-shares.ts +170 -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,12 @@
|
|
|
1
|
+
import{a as e}from"./chunk-QRKFPLA4.js";import{b as t}from"./chunk-TUII34K2.js";var n=new Set([`module`,`commonjs`,`json`,`module-typescript`,`commonjs-typescript`]),r=new Set([`solidity`,`php`,`shell`,`rust`,`teal`]),i=new Set([`java`,`kotlin`,`gradle`,`objc`,`objcpp`,`swift`,`c`,`cpp`,`c-header`,`cpp-header`,`ruby`,`python`,`cmake`,`podspec`,`podfile`,`podfile-lock`,`gemfile`,`gemfile-lock`,`template`,`xml`,`env`,`fastlane`,`pbxproj`]),a=new Set([`generic-javascript`,`generic-typescript`]),o=new Set([`resource`,`resource:base64`]),s=new Set([`stat:file`,`stat:directory`]),c=new Set([...n,...r,...i,...a,...o,`patch`,`directory`,...s]),l=e=>s.has(e),u=e=>e===`directory`||e===`stat:directory`?`directory`:`file`,d=new Set([`module`,`commonjs`,`module-typescript`,`commonjs-typescript`]),f=(e,t)=>a.has(e)&&d.has(t);function p(e,t,n){if(e===t)return e;if(f(e,t))return t;if(f(t,e))return e;let r=l(e);if(r!==l(t)&&u(e)===u(t))return r?t:e;throw Error(`format conflict for '${n}' ('${t}' vs '${e}')`)}var m=(e,t)=>t===``?e:e===`.`?t:`${e}/${t}`,h=/^(?=[A-Za-z0-9-]{1,39}\/)[A-Za-z0-9](?:-?[A-Za-z0-9])*\/(?!\.\.?$)[\w.-]{1,100}$/u,ee=/^(?!\.\.?(?:\/|$))[\w.~@+-]+(?:\/(?!\.\.?(?:\/|$))[\w.~@+-]+)*$/u,te=/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u,g={github:e=>typeof e==`string`&&h.test(e),directory:e=>typeof e==`string`&&e.length<=1024&&(e===``||ee.test(e)),commit:e=>typeof e==`string`&&te.test(e)},ne=(e,t)=>e?.toLowerCase()===t?.toLowerCase(),_=(e,t,n)=>{if(e===void 0)return;E(e)||C(!1,`${n} must be an object`);for(let r of Object.keys(e))Object.hasOwn(t,r)||C(!1,`unknown ${n} key '${r}'`);let r=Object.entries(t).map(([t,r])=>typeof r==`object`?[t,_(e[t],r,`${n}.${t}`)]:(e[t]!==void 0&&!r(e[t])&&C(!1,`invalid ${n}.${t}: ${JSON.stringify(e[t])}`),[t,e[t]])).filter(([,e])=>e!==void 0);return r.length===0?void 0:Object.freeze(D(r))},re=(e,t=`bundle repo`)=>_(e,g,t),v=(e,t)=>t??(M(e)?`npm`:void 0),ie=(e,t,n,r,i)=>(a,{ecosystem:o,[e]:s},c)=>{if(s===void 0)return;r(a,o)||C(!1,`${c}: '${a}' is no ${i} bucket, and carries no ${e}`);let l=_(s,t,`${c} module '${a}' ${e}`);return l?.[n]===void 0&&C(!1,`${c} module '${a}' ${e} has no ${n}`),l},ae=ie(`repo`,g,`github`,(e,t)=>v(e,t)!==void 0,`dependency's`),oe={sha1:/^sha1-[A-Za-z\d+/]{27}=$/u,sha256:/^sha256-[A-Za-z\d+/]{43}=$/u,sha512:/^sha512-[A-Za-z\d+/]{86}==$/u},se=/^(?:\.\.\/)*(?!\.\.?(?:\/|$))[^/\\\p{Cc}]+(?:\/(?!\.\.?(?:\/|$))[^/\\\p{Cc}]+)*$/u,ce={integrity:e=>typeof e==`string`&&oe.sha256.test(e),file:e=>typeof e==`string`&&e.length<=4096&&se.test(e)},le=(e,t)=>M(e)&&v(e,t)===`npm`,ue={npm:`sha512`,cargo:`sha256`,composer:`sha1`,soldeer:`sha256`},de=(e,{ecosystem:t,integrity:n},r)=>{if(n===void 0)return;let i=v(e,t);return(!Object.hasOwn(ue,i)||i===`npm`&&!M(e))&&C(!1,`${r}: '${e}' is no npm, cargo, composer or soldeer dependency's bucket, and carries no integrity`),(typeof n!=`string`||!oe[ue[i]].test(n))&&C(!1,`invalid ${r} module '${e}' integrity: ${JSON.stringify(n)}`),n},fe=ie(`patch`,ce,`integrity`,le,`npm dependency's`),pe=e=>typeof e==`string`&&/^[\w.+@/~'!()*-]+$/u.test(e),y={name:pe,version:pe},me=e=>typeof e==`string`&&e!==``&&!e.includes(`\\`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e!==`node_modules`),he=(e,t,n)=>typeof e==`string`&&me(n)&&e===`${t}/${n}`,ge={vendored:()=>!0,subpackages:(e,t,n)=>he(e.name,t,n)},_e=(e,t)=>{for(let n=t.lastIndexOf(`/`);n>0;n=t.lastIndexOf(`/`,n-1))if(Object.hasOwn(e,t.slice(0,n)))return t.slice(0,n)};function ve(e,t){if(e===void 0)return;let n=new Set(Object.keys(t).map(t=>_e(e,t)).filter(e=>e!==void 0));return n.size===0?void 0:Object.freeze(D(w(n).map(t=>[t,e[t]])))}var ye=(e,t,{name:n,ecosystem:r,files:i,[e]:a},o)=>{if(a===void 0)return;v(t,r)===void 0&&C(!1,`${o}: '${t}' is no dependency's bucket, and carries no ${e}`),E(a)||C(!1,`${o} module '${t}' ${e} must be an object`);let s=D(Object.entries(a).map(([r,i])=>{me(r)||C(!1,`${o} module '${t}' ${e}: invalid directory ${JSON.stringify(r)}`);let a=_(i,y,`${o} module '${t}' ${e} '${r}'`);return a?.name===void 0&&C(!1,`${o} module '${t}' ${e} '${r}' has no name`),ge[e](a,n,r)||C(!1,`${o} module '${t}' ${e} '${r}' is named '${a.name}', not '${n}/${r}'`),[r,a]})),c=ve(s,i),l=Object.keys(s).find(e=>!Object.hasOwn(c??{},e));return l!==void 0&&C(!1,`${o} module '${t}' ${e} '${l}' holds none of its files`),c},be={integrity:de,patch:fe,repo:ae},b=Object.keys(ge),x=[...Object.keys(be),...b],xe=[`ecosystem`,...x],S=e=>{let t={name:e.name,version:e.version};for(let n of xe)e[n]!==void 0&&(t[n]=e[n]);return t.files=e.files,t},Se={integrity:(e,t)=>e===t,patch:(e,t)=>e?.integrity===t?.integrity&&(e?.file===void 0||t?.file===void 0||e.file===t.file)},Ce=Object.keys(Se),we=(e,t,n)=>Se[e](t,n),Te=(e,t)=>e[t]??(t===`patch`&&e.integrity!==void 0?null:void 0),Ee=(e,t,n,r)=>{if(we(e,t[e],n[e]))return;let[i,a]=[t[e],n[e]].map(e=>JSON.stringify(e)??`none`);C(!1,`${r} ${e} mismatch (${i} vs ${a})`)},De=(e,t,n)=>{let[r,i]=[t[e],n[e]];if([r,i].every(e=>typeof e==`object`&&!!e))return Object.keys(i).some(e=>r[e]===void 0)?Object.freeze({...i,...r}):void 0};function Oe(e,t,n=`module`){let r;for(let i of Object.keys(be))if(Ce.includes(i)&&Te(e,i)!==void 0&&Te(t,i)!==void 0){Ee(i,e,t,n);let a=De(i,e,t);a&&((r??={})[i]=a)}else e[i]===void 0&&t[i]!==void 0&&((r??={})[i]=t[i]);for(let n of b)t[n]===void 0||Object.keys(t[n]).every(t=>Object.hasOwn(e[n]??{},t))||((r??={})[n]=Object.freeze(D([...Object.entries(t[n]),...Object.entries(e[n]??{})])));return r===void 0?e:S({...e,...r})}function ke(e,t,n,r,i){let a={};for(let[i,o]of Object.entries(be))a[i]=r.includes(i)?o(e,t,n):void 0;for(let o of b)a[o]=r.includes(o)?ye(o,e,{...t,[o]:i(o)},n):void 0;return a}function Ae(e,t,n,r=x){let{name:i,version:a,ecosystem:o}=e;C(o===void 0||typeof o==`string`),E(e.files)||C(!1,`${n}: module '${t}' files must be an object`);let s=D(Object.entries(e.files));return S({name:i,version:a??void 0,ecosystem:o,...ke(t,{...e,files:s},n,r,t=>e[t]),files:s})}function je(e,{scope:t=`full`}={}){let n=new Set;for(let[r,{files:i}]of e)if(t===`full`||M(r))for(let e of Object.keys(i))n.add(m(r,e));return n}function Me(e,{what:t,files:n,formats:r,scope:i}){if(e.includes(`\\`))return`holds a '\\'`;if(k(e))return`escapes the root`;if(i!==`full`&&!M(e))return`is outside node_modules, which a '${i}'-scope ${t} does not record`;if(!n.has(e))return`names no file the ${t} records`;let a=r.get(e);return a===`directory`?`is a directory capture, not a file`:l(a)?`is a payload-free '${a}' record, not a file`:null}function Ne(e,{what:t,files:n,formats:r,scope:i}){for(let a of e){let e=Me(a,{what:t,files:n,formats:r,scope:i});C(e===null,`${t}: executable entry '${a}' ${e}`)}}function Pe(e,t,n,r){C(Array.isArray(e),`${t} must be an array of file paths`);let i=new Set;for(let t of e)r(t),C(!i.has(t),`${n} '${t}' is listed twice`),i.add(t);return i}function Fe(e,{what:t,files:n,formats:r,scope:i=`full`}){if(e===void 0)return new Set;let a=`${t}: executable entry`,o=Pe(e,`${t}: executable`,a,e=>C(typeof e==`string`&&e!==``,`${a} must be a non-empty string`));return Ne(o,{what:t,files:n,formats:r,scope:i}),o}function Ie(e,{what:t,modules:n,formats:r,scope:i}){if(e.size!==0)return Ne(e,{what:t,files:je(n,{scope:i}),formats:r,scope:i}),O(e)}function C(e,t){if(!e)throw Error(t)}var Le=`stasis.lock.json`,Re=new Set([`node_modules`,`full`]),ze=(e,t)=>C(Re.has(e),`${t} scope must be node_modules or full, got ${JSON.stringify(e)}`),Be=e=>{let t=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();return t===Le||t.endsWith(`.${Le}`)},Ve=/(?:^|\/)(?:\.git(?:\/|$)|(?:\.npm-extension\.[cm]?[jt]s|\.?pnpmfile\.[cm]?[jt]s|\.npmrc|\.yarnrc(?:\.yml)?|\.?bunfig\.toml|\.pnp\.(?:c?js|loader\.mjs|data\.json))$)/iu,He=/(?:^|\/)node_modules\/(?:[^/]*\/)*(?:pnpm-workspace\.yaml|\.env\.[^/]*|[^/]*\.env)$/iu,Ue=e=>Be(e)||Ve.test(e)||He.test(e);function We(e,t){let n=0;for(;n<e.length&&e[n]===t[n];)n++;let r=e.length-n,i=t.length-n;if(r===0&&i===0)return 0;if(r<2)return i<2&&(e[n]??``)>(t[n]??``)?1:-1;if(i<2)return 1;if(e[n]===`*`)return-1;if(t[n]===`*`||e[n]===`node_modules`)return 1;if(t[n]===`node_modules`)return-1;let a=e.slice(n).join(`\0`),o=t.slice(n).join(`\0`);if(a<o)return-1;if(a>o)return 1;throw Error(`Unreachable`)}var w=(e,t=e=>e)=>Array.from(e,e=>({item:e,segments:t(e).split(`/`)})).toSorted((e,t)=>We(e.segments,t.segments)).map(({item:e})=>e),T=([e])=>e;function E(e){if(!e)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}var D=e=>Object.setPrototypeOf(Object.fromEntries(e),null),O=e=>w(e),Ge=(e,{sorted:t=!0}={})=>D((t?w(e,T):[...e]).map(([e,n])=>[e,n instanceof Map?Ge(n,{sorted:t}):n]));function Ke(e,t,n){let r=e.get(t);return r===void 0&&e.set(t,r=n()),r}var qe=(e,t)=>Ke(e,t,()=>new Map),Je=e=>new Map(Object.entries(e).map(([e,t])=>[e,E(t)?Je(t):t]));function k(e){if(e.startsWith(`/`))return!0;if(!e.includes(`..`))return!1;let t=0;for(let n of e.split(`/`))if(n!==`.`&&n!==``){if(n!==`..`)t++;else if(--t<0)return!0}return!1}var Ye=e=>e.includes(`\\`)||k(e),A=(e,t)=>C(!Ye(e),`${t}: path '${e}' escapes the root or holds a '\\'`),Xe=e=>typeof e==`string`&&e!==``&&!Ye(e),Ze=(e,t)=>C(Xe(e),`${t}: invalid entry ${JSON.stringify(e)}`),Qe=(e,t)=>Pe(e,`${t}: entries`,`${t}: entry`,e=>Ze(e,t));function $e(e,t){for(let n of e)Ze(n,t);return O(e)}function et(e,t){A(e,`formats`),C(c.has(t),`unknown format '${t}' for ${e}`)}function tt(e){C(E(e));let t=new Map;for(let[n,r]of Object.entries(e)){et(n,r);let e=n===``?`.`:n;C(!t.has(e),`duplicate format key '${e}'`),t.set(e,r)}return t}function nt(e,t,n){for(let[r,i]of e)l(i)&&t.has(r)&&C(!1,`${n}: '${r}' is a payload-free '${i}' record, yet carries content`)}function rt(e){for(let[t,n]of e)et(t,n);return Ge(e)}function it(e){for(let[,t]of e){C(t instanceof Map);for(let[e,n]of t){A(e,`imports`),C(n instanceof Map);for(let[,e]of n){if(typeof e==`string`){A(e,`imports`);continue}C(e instanceof Map&&e.size>0,`import target must be a file or a non-empty {platform: file} map`);for(let[t,n]of e)C(typeof t==`string`&&t.length>0&&!t.includes(`/`),`invalid platform key '${t}'`),C(typeof n==`string`),A(n,`imports`)}}}}function at(e){C(E(e));let t=Je(e);return it(t),t}function ot(e){return it(e),Ge(e)}function st(e,{skipEmpty:t=!1,metadata:n=!0,what:r}={}){let i=n===!0?x:n===!1?[]:n,a={modules:[],sources:[]};for(let[n,o]of e){if(t&&Object.keys(o.files).length===0)continue;let e=M(n);e&&C(o.name&&o.version&&o.files);let s=D(w(Object.entries(o.files),T));a[e?`modules`:`sources`].push([n,S({...o,...ke(n,{...o,files:s},r,i,e=>ve(o[e],s)),files:s})])}return{modules:D(w(a.modules,T)),sources:D(w(a.sources,T))}}function ct(e,t,n){let r=new Map;for(let i of e.config.scope===`full`?[`modules`,`sources`]:[`modules`]){if(i===`modules`&&e.modules===void 0)continue;C(E(e[i]),`${t}: ${i} must be an object`);let a=i===`modules`;for(let[o,s]of Object.entries(e[i]))C(M(o)===a),A(o,t),C(s?.name&&(s.version||!a)&&s.files),r.set(o,Ae(s,o,t,n))}return r}function lt({config:{scope:e},entries:t,modules:n,formats:r,imports:i,executable:a},o,s){let c=e===`full`,l=st(n,{...s,what:o});return{entries:c?$e(t,o):void 0,sources:c?l.sources:void 0,modules:l.modules,formats:r===null?void 0:rt(r),imports:i===null?void 0:ot(i),executable:Ie(a,{what:o,modules:n,formats:r??new Map,scope:e})}}function ut(e,t){return!(e instanceof Map)||!(t instanceof Map)?e===t:e.size===t.size&&e.entries().every(([e,n])=>t.get(e)===n)}var dt=e=>e instanceof Map?`{${[...e].map(([e,t])=>`${e}: ${t}`).join(`, `)}}`:e;function ft(e,t,n){let r=new Map;for(let i of[e,t])for(let[e,t]of i){let i=qe(r,e);for(let[e,r]of t){let t=qe(i,e);for(let[i,a]of r)t.has(i)?C(ut(t.get(i),a),`${n}: import '${i}' from '${e}' resolves differently ('${dt(t.get(i))}' vs '${dt(a)}')`):t.set(i,a instanceof Map?new Map(a):a)}}return r}function pt(e,t,n){let r=e.get(t);e.set(t,r===void 0?n:p(n,r,t))}function mt(e,t,n){let r=new Map;try{for(let n of[e,t])for(let[e,t]of n)pt(r,e,t)}catch(e){throw Error(`${n}: ${e.message}`,{cause:e})}return r}var ht=(e,t,n,r)=>e.size===0?new Set(t):new Set(t).union(e.difference(je(n,{scope:r}))),gt=/(?:^|\/)\.{0,2}(?:\/|$)/u;function j(e,t,n){let r=m(e,t);return(r!==`.`||t!==``)&>.test(r)&&C(!1,`${n}: non-canonical file key ${JSON.stringify(r)}`),r.includes(`\\`)&&C(!1,`${n}: file key '${r}' holds a '\\', which no path may`),r}function _t(e,t,n){let r=new Map;for(let[i,{files:a}]of e){typeof i!=`string`&&C(!1,`${t}: bucket dir ${String(i)} is not a string`),A(i,t);for(let e of Object.keys(a)){let a=j(i,e,t),o=r.get(a);o!==void 0&&n(a,o,i),r.set(a,i)}}return r}var vt=(e,t)=>n=>C(!1,`duplicate file key '${n}' across ${e} buckets -- module bucketing changed between writes (a workspace package without a version now owns its own bucket); regenerate the ${t}`);function yt(e,t,n,{held:r=!1}={}){let i=new Map;for(let a of[e,t])for(let[e,t]of a){let a=i.get(e);if(a===void 0){i.set(e,S({...t,files:Object.assign(Object.create(null),t.files)}));continue}C(a.name===t.name,`${n}: module '${e}' name mismatch ('${a.name}' vs '${t.name}')`),C(a.version===t.version,`${n}: module '${e}' version mismatch ('${a.version}' vs '${t.version}')`+(a.version==null==(t.version==null)?``:` -- an artifact from an older stasis may record a placeholder version for a workspace package without one; regenerate it (bundle=replace / lock=replace)`)),C(a.ecosystem===t.ecosystem,`${n}: module '${e}' ecosystem mismatch ('${a.ecosystem??`(none)`}' vs '${t.ecosystem??`(none)`}')`),i.set(e,Oe(a,t,`${n}: module '${e}'`));for(let i of Ce){if(a[i]===void 0==(t[i]===void 0)||r&&a[i]===void 0)continue;let[o,s]=a[i]===void 0?[t,a]:[a,t],c=Object.keys(s.files).find(e=>!Object.hasOwn(o.files,e));c!==void 0&&C(!1,`${n}: module '${e}' ${i} is recorded of one side's files, not of '${m(e,c)}' the other adds`)}for(let[r,i]of Object.entries(t.files))Object.hasOwn(a.files,r)?C(a.files[r]===i,`${n}: content mismatch for '${m(e,r)}'`):a.files[r]=i}return _t(i,n,(e,t,r)=>C(!1,`${n}: file '${e}' is bucketed under both '${t}' and '${r}' -- module bucketing changed between the artifacts (a workspace package without a version now owns its own bucket); regenerate the artifact (bundle=replace / lock=replace)`)),i}var M=e=>e===`node_modules`||e.startsWith(`node_modules/`)||e.endsWith(`/node_modules`)||e.includes(`/node_modules/`),bt=`node_modules/`;function xt(e){let t=e.length;for(;(t=e.lastIndexOf(bt,t-1))!==-1;)if(t===0||e[t-1]===`/`)return t;return-1}function St(e){let t=xt(e);if(t===-1)return null;let n=t+bt.length,r=e.slice(n).split(`/`),i=r[0].startsWith(`@`)?2:1,a=r.slice(0,i);if(r.length<=i||a.includes(``))return null;let o=a.join(`/`);return{dir:e.slice(0,n)+o,rel:r.slice(i).join(`/`),name:o}}var N=1,Ct=0,wt=vt(`bundle`,`artifact (bundle=replace)`),Tt=(e,t)=>{let n=_t(e,`bundle`,wt);for(let e of n.keys())C(!Ue(e),`bundle: ${e} is a file no bundle may carry`);return nt(t,n,`bundle`),n},Et=e=>St(e)??{dir:`.`,rel:e===`.`?``:e,name:null};function Dt(e){C(E(e),`bundle: sources must be an object`);let t=new Map;for(let[n,r]of Object.entries(e)){A(n,`bundle`);let{dir:e,rel:i,name:a}=Et(n);C(!k(e)&&!k(i));let{files:o}=Ke(t,e,()=>({name:a,version:null,files:Object.create(null)}));C(!Object.hasOwn(o,i),`bundle: duplicate file key '.' (v0 '' and '.')`),o[i]=r}return t}function Ot(){throw Error(`bundle: file contents are not retained by this contents-free Bundle`)}var kt=(e,{files:t,...n})=>{let r=Object.create(null);for(let[n,i]of Object.entries(t))typeof i!=`symbol`&&C(!1,`bundle: file '${m(e,n)}' is not a placeholder`),Object.defineProperty(r,n,{get:Ot,enumerable:!0});return{...n,files:Object.freeze(r)}},P=(e,t)=>{if(e===void 0&&t===void 0)return;let n=new Map;for(let r of[e,t])for(let[e,t]of Object.entries(r??{}))Array.isArray(t)&&n.set(e,new Set([...n.get(e)??[],...t]));return D([...n.keys()].toSorted().map(e=>[e,O(n.get(e))]))},At=(e,t)=>Object.hasOwn(g,e)&&g[e](t),jt=(e,t)=>e?.github===void 0||!ne(e.github,t?.github)?void 0:D(Object.keys(g).filter(n=>e[n]!==void 0&&(n===`github`||e[n]===t[n])).map(t=>[t,e[t]])),Mt=e=>{if(!E(e)||e.root!==!0||Object.hasOwn(e,`directory`))return e;let{root:t,...n}=e;return n},Nt={npm:y,composer:y,cargo:y},Pt=(e,t)=>D(Object.keys(Nt).map(n=>{let[r,i]=[e?.[n],t?.[n]];return[n,r?.name!==void 0&&r.name===i?.name?D(Object.entries(r).filter(([e,t])=>t===i[e])):void 0]})),F=class e{static VERSION=N;#e;get repo(){return this.#e}set repo(e){this.#e=re(e)}#t;get package(){return this.#t}set package(e){this.#t=_(e,Nt,`bundle package`)}constructor({config:e={scope:`full`},entries:t,modules:n,formats:r,imports:i,executable:a,reason:o,repo:s,package:c,version:l=N}={}){C([Ct,N].includes(l)),ze(e.scope,`bundle`),this.version=l,this.config=e,this.entries=t??new Set,this.modules=n??new Map,this.formats=r??new Map,this.imports=i??new Map,this.executable=a??new Set,this.reason=o,this.repo=s,this.package=c}get sources(){let e=new Map;for(let[t,{files:n}]of this.modules)for(let[r,i]of Object.entries(n))e.set(m(t,r),i);return e}static isResourceFormat(e){return o.has(e)||e===`directory`}get hasCode(){return this.modules.entries().some(([t,{files:n}])=>Object.keys(n).some(n=>!e.isResourceFormat(this.formats.get(m(t,n)))))}static parse(t){return e.fromJSON(JSON.parse(t))}static fileKeyAt(e){let[t,n,r,i]=e;if(typeof n==`string`){if(e.length===2&&t===`sources`){let e=Et(n);return j(e.dir,e.rel,`bundle`)}if(e.length===4&&(t===`sources`||t===`modules`)&&r===`files`&&typeof i==`string`)return j(n,i,`bundle`)}}static fromJSON(t,{contents:n=!0}={}){C(t.version===N||t.version===Ct),ze(t.config?.scope,`bundle`);let r=tt(t.formats),i=t.version===N;i&&t.config.scope!==`full`&&C(t.entries===void 0&&t.sources===void 0);let a=i?ct(t,`bundle`):Dt(t.sources),o=Tt(a,r),s=at(t.imports);if(!n)for(let[e,t]of a)a.set(e,kt(e,t));return new e({version:t.version,config:t.config,entries:i&&t.entries!==void 0?Qe(t.entries,`bundle`):new Set,modules:a,formats:r,imports:s,executable:i?Fe(t.executable,{what:`bundle`,files:o,formats:r,scope:t.config.scope}):new Set,reason:E(t.reason)?t.reason:void 0,repo:Mt(t.repo),package:t.package})}serialize(){return JSON.stringify(this.#n(),void 0,2)}serializedBytes(){let e=this.#n(),t=Object.keys(e.modules);if(t.length===0)return Buffer.from(JSON.stringify(e,void 0,2));let{modules:n,...r}=e,i=JSON.stringify(r,void 0,2);C(i.endsWith(`
|
|
2
|
+
}`));let a=[],o=e=>a.push(Buffer.from(e));o(i.slice(0,-2)),o(`,
|
|
3
|
+
"modules": {
|
|
4
|
+
`);for(let[e,r]of t.entries())e>0&&o(`,
|
|
5
|
+
`),o(JSON.stringify({indent:{[r]:n[r]}},void 0,2).slice(16,-6));return o(`
|
|
6
|
+
}
|
|
7
|
+
}`),Buffer.concat(a)}#n(){Tt(this.modules,this.formats);let{entries:e,sources:t,modules:n,formats:r,imports:i,executable:a}=lt(this,`bundle`,{skipEmpty:!0});return{version:N,config:this.config,repo:this.repo,package:this.package,entries:e,formats:r,imports:i,executable:a,reason:P(this.reason,void 0),sources:t,modules:n}}withReason(t,n=[...this.sources.keys()]){let{version:r,config:i,entries:a,modules:o,formats:s,imports:c,executable:l,repo:u,package:d}=this,f=P(this.reason,{[t]:n});return new e({version:r,config:i,entries:a,modules:o,formats:s,imports:c,executable:l,reason:f,repo:u,package:d})}merge(t){return C(this.config.scope===t.config.scope,`bundle merge: scope mismatch ('${this.config.scope}' vs '${t.config.scope}')`),new e({config:{scope:this.config.scope},entries:new Set([...this.entries,...t.entries]),modules:yt(this.modules,t.modules,`bundle merge`),formats:mt(this.formats,t.formats,`bundle merge`),imports:ft(this.imports,t.imports,`bundle merge`),executable:ht(this.executable,t.executable,t.modules,this.config.scope),reason:P(this.reason,t.reason),repo:jt(this.repo,t.repo),package:Pt(this.package,t.package)})}},Ft={__proto__:null,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`jsx`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsx:`tsx`,json:`json`,css:`css`,html:`markup`,htm:`markup`,xml:`markup`,svg:`markup`,yml:`yaml`,yaml:`yaml`,sh:`bash`,bash:`bash`,md:`markdown`,markdown:`markdown`,sol:`solidity`,php:`php`,phtml:`php`,rs:`rust`,rb:`ruby`,py:`python`,pyw:`python`,pyi:`python`,java:`java`,cpp:`cpp`,cc:`cpp`,cxx:`cpp`,"c++":`cpp`,hpp:`cpp`,hh:`cpp`,hxx:`cpp`,"h++":`cpp`,h:`cpp`,c:`c`,m:`objectivec`,mm:`objectivec`},It={__proto__:null,module:`javascript`,commonjs:`javascript`,"module-typescript":`typescript`,"commonjs-typescript":`typescript`,json:`json`,solidity:`solidity`,php:`php`,shell:`bash`,rust:`rust`,java:`java`,objc:`objectivec`,objcpp:`objectivec`,c:`c`,"c-header":`c`,cpp:`cpp`,"cpp-header":`cpp`,ruby:`ruby`,podspec:`ruby`,podfile:`ruby`,fastlane:`ruby`,"podfile-lock":`yaml`,xml:`markup`};function Lt(e){if(typeof e!=`string`)return!1;let t=e.length-1,n=0;for(;n<t&&/\s/u.test(e[n]);)n++;for(;t>n&&/\s/u.test(e[t]);)t--;return n<t&&e[n]===`{`&&e[t]===`}`}function Rt(e,t,n){if(typeof t==`string`&&It[t])return It[t];if(typeof e!=`string`)return null;let r=e.slice(e.lastIndexOf(`/`)+1),i=r.lastIndexOf(`.`);if(i<=0)return null;let a=r.slice(i+1).toLowerCase();return a===`map`?Lt(n)?`json`:null:Ft[a]??null}var zt=/^webpack(?:-internal)?:\/\/[^/]*\//u,Bt=/^[a-z][\d+.a-z-]*:/iu,Vt=/^file:/iu,Ht=/^(?:file|ftp|https?|wss?):/iu,Ut=/^(?:[a-z][\d+.a-z-]*:\/\/[^/]*\/?|\/\/[^/]+\/|[a-z]:\/|\/)?/iu,I=e=>Ut.exec(e)[0],L=e=>I(e).includes(`://`),R=e=>e.replace(L(e)?/[#?].*$/su:/\?.*$/su,``),Wt=e=>e.slice(e.lastIndexOf(`/`)+1),z=(e,t)=>URL.parse(e,t)?.href??null;function B(e){let t=I(e),n=t.includes(`://`)&&z(e);if(n)return n;let r=[];for(let n of e.slice(t.length).split(`/`))n===``||n===`.`||(n===`..`?r.length>0&&r.at(-1)!==`..`?r.pop():t||r.push(`..`):r.push(n));let i=/^[a-z]:\/$/iu.test(t)?t.toUpperCase():t.startsWith(`//`)?t.toLowerCase():t;return i?i.replace(/\/?$/u,`/`)+r.join(`/`):r.join(`/`)||`.`}function Gt(e,t){let n=I(t);return L(e)&&!n.includes(`:`)?z(t,e)??B(`${e}/../${t}`):B(n===`/`?I(e).replace(/\/?$/u,``)+t:n?t:`${e}/../${t}`)}function Kt(e){try{return decodeURIComponent(e)}catch{return e}}function V(e,t){let n=e.replaceAll(`\\`,`/`);if(zt.test(n))return B(n.replace(zt,``));let r=Ht.test(n)?z(n)??n:n,i=/^file:\/\/([^/#]*)([^#]*)/isu.exec(r);if(i){let[,e,t]=i;return B(Kt(e&&e.toLowerCase()!==`localhost`?`//${e}${t}`:t).replace(/^\/(?=[a-z]:\/)/iu,``))}if(Bt.test(r)&&!I(r).includes(`:`))return r;if(t===void 0)return B(r);if(Vt.test(t)&&!I(r))return V(z(r,t)??r);let a=V(t);return I(r)&&!L(a)?B(r):Gt(a,r)}var qt=/^(?:@[\dA-Za-z~-][\w.~-]*\/)?[\dA-Za-z~-][\w.~-]*$/u;function Jt(e){let t=e.split(`/`).slice(0,e.startsWith(`@`)?2:1).join(`/`);return qt.test(t)?t:null}var Yt=new Set([`.pnpm`,`.bun`,`.deno`]),Xt=/^\d+\.\d+\.\d+(?:-[\d.a-z-]+)?(?:\+[\d.a-z-]+)?$/iu;function Zt(e,t){let n=`${t.replace(`/`,`+`)}@`,r=e.startsWith(n)?e.slice(n.length).split(/[(_]/u)[0]:null;return Xt.test(r)?r:null}function Qt(e){let t=R(e).split(`/`),n=t.lastIndexOf(`node_modules`),r=n<0?null:Jt(t.slice(n+1).join(`/`));if(r===null)return null;let i=n+1+r.split(`/`).length;if(i>=t.length||t.slice(i).includes(``))return null;let a=t.slice(0,i).join(`/`);return{name:r,version:Yt.has(t[n-2])?Zt(t[n-1],r):null,root:a,path:e.slice(a.length+1)}}var $t=new Map([[`js`,`jsx`],[`mjs`,`jsx`],[`cjs`,`jsx`],[`jsx`,`jsx`],[`es`,`jsx`],[`es6`,`jsx`],[`ts`,`ts`],[`mts`,`ts`],[`cts`,`ts`],[`tsx`,`tsx`],[`json`,`json`]]);function en(e){let t=Wt(R(e));return/^[\w-]+$/u.test(t)?`jsx`:$t.get(/\.([\da-z]+)$/iu.exec(t)?.[1].toLowerCase())??null}var tn=[`.js`,`.mjs`,`.cjs`,`.jsx`,`.ts`,`.tsx`,`.mts`,`.cts`,`.json`],nn=[`.ios`,`.android`,`.web`];function rn(e){let t=e.map(e=>/\.[a-z]+(?=\.\w+$)/u.exec(Wt(R(e.path??``)))?.[0]),[[n,r],[,i]]=nn.map(e=>[e,t.filter(t=>t===e).length]).toSorted((e,t)=>t[1]-e[1]);return[...r===i?[]:[n],`.native`,``,`.browser`,`.node`]}var an=new Map([[`.js`,[`.ts`,`.tsx`]],[`.jsx`,[`.tsx`]],[`.mjs`,[`.mts`]],[`.cjs`,[`.cts`]]]),on=[`index`,`main`,`browser`,`node`],sn=[``,`src/`,`lib/`,`dist/`,`build/`],cn=new Set([`lib`,`dist`,`build`,`out`,`esm`,`cjs`]);function*ln(e,t){yield e;let n=/\.[^./]+$/u.exec(e)?.[0];for(let t of an.get(n)??[])yield e.slice(0,-n.length)+t;for(let n of e.endsWith(`/`)?[`${e}index`]:[e,`${e}/index`])for(let e of tn)for(let r of t)yield n+r+e;if(n)for(let r of t.filter(Boolean))yield e.slice(0,-n.length)+r+n}function*un(e){let t=e;for(;;){t.startsWith(`src/`)||(yield`src/${t}`),t!==e&&(yield t);let n=t.indexOf(`/`);if(n<0||!cn.has(t.slice(0,n)))return;t=t.slice(n+1)}}function dn(e){let t=new Map,n=new Map,r=new Map;for(let i of e)i.path!==null&&t.set(i.path,i),i.package&&(n.set(i.package.name,(n.get(i.package.name)??new Set).add(i.package.root)),(r.get(i.package.root)??r.set(i.package.root,[]).get(i.package.root)).push(i));return{byPath:t,roots:n,byRoot:r,platforms:rn(e),found:new Map}}function H(e,t){if(!e.found.has(t)){let n=R(t),r=ln(n,e.platforms).map(e=>e+t.slice(n.length));e.found.set(t,e.byPath.get(r.find(t=>e.byPath.has(t)))??null)}return e.found.get(t)}function fn(e,t,n){let r=e.roots.get(n);if(!r)return null;let i=t.path.split(`/`);for(let e=i.length-1;e>=0;e--){let t=[...i.slice(0,e),`node_modules`,n].join(`/`);if(r.has(t))return t}return r.size===1?[...r][0]:null}var pn=new Set(`assert.async_hooks.buffer.child_process.cluster.console.constants.crypto.dgram.diagnostics_channel.dns.domain.events.fs.http.http2.https.inspector.module.net.os.path.perf_hooks.process.punycode.querystring.readline.repl.stream.string_decoder.sys.timers.tls.trace_events.tty.url.util.v8.vm.wasi.worker_threads.zlib._http_agent._http_client._http_common._http_incoming._http_outgoing._http_server._stream_duplex._stream_passthrough._stream_readable._stream_transform._stream_wrap._stream_writable._tls_common._tls_wrap.assert/strict.dns/promises.fs/promises.inspector/promises.path/posix.path/win32.readline/promises.stream/consumers.stream/promises.stream/web.timers/promises.util/types`.split(`.`));function mn(e){if(e.startsWith(`node:`)||pn.has(e))return{builtin:!0};let t=Jt(R(e));return t===null?{}:{package:t}}function hn(){let e=[],t=new Map,n=(n,r,i)=>{let a=t.get(n)??t.set(n,new Set).get(n);a.has(r)||(a.add(r),e.push(i))};return{edges:e,add:n,link:(e,t,r)=>{e&&t&&t!==e&&n(e,t,{from:e,to:t,kind:r})}}}function gn(e,t){for(let n of on)for(let r of sn){let i=H(e,`${t}/${r}${n}`);if(i)return i}let n=e.byRoot.get(t);return n?.length===1?n[0]:null}function _n(e,t,n,r){return/^\/[^?]/u.test(n)?H(e,t+n)??un(n.slice(1)).map(n=>H(e,`${t}/${n}`)).find(Boolean):H(e,t+n)??r(e,t)}function vn(e,t,n,r=gn){let i=/^(?:\.{1,2}|[a-z]:)?\\/iu.test(n)?n.replaceAll(`\\`,`/`):n,a=Ht.test(i);if(a||/^(?:\.{1,2}(?:\/|$)|\/|[a-z]:\/)/iu.test(i)||L(i)){let n=a?V(i):Gt(t.path,i),r=H(e,n);return r?{to:r}:{to:null,path:n}}if(Bt.test(i)&&e.byPath.has(i))return{to:e.byPath.get(i)};let o=Jt(R(n)),s=o===null?null:fn(e,t,o);if(s===null)return{to:null,...mn(n)};let c=_n(e,s,n.slice(o.length),r);return c?{to:c}:{to:null,package:o}}var U=class extends Error{name=`SourceMapError`},yn=new Uint8Array(128).fill(255);for(let[e,t]of[...`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/,;`].entries())yn[t.codePointAt(0)]=e;function bn(e){let t=new Int32Array(e.length*2);return t.set(e),t}function xn(e){let{starts:t,columns:n,sources:r,names:i}=e;for(let e=0;e+1<t.length;e++){let[a,o]=[t[e],t[e+1]],s=a+1;for(;s<o&&n[s-1]<=n[s];)s++;if(s>=o)continue;let c=Array.from(n.subarray(a,o),(e,t)=>[e,r[a+t],i[a+t]]).sort((e,t)=>e[0]-t[0]);for(let[e,[t,o,s]]of c.entries())[n[a+e],r[a+e],i[a+e]]=[t,o,s]}return e}function Sn(e){let t=[0],n=new Int32Array(1024),r=new Int32Array(1024),i=new Int32Array(1024),a=0;for(let{mappings:o,files:s,line:c,column:l,names:u,nameCount:d}of e){if(typeof o!=`string`)throw new U(`mappings is not a string`);for(;t.length<=c;)t.push(a);let e=[0,0,0,0,0],f=0,p=0,m=1,h=l;for(let c=0;c<=o.length;c++){let l=c<o.length?yn[o.codePointAt(c)]??255:64;if(l<32){if(p+=l*m,f===5)throw new U(`mappings: a segment of more than 5 fields at ${c}`);e[f++]+=p%2?(1-p)/2:p/2,p=0,m=1;continue}if(l<64){if(p+=(l-32)*m,m*=32,m>2**30)throw new U(`mappings: a value at ${c} runs past 32 bits`);continue}if(l===255)throw new U(`mappings: ${JSON.stringify(o[c])} at ${c} is not a base64 digit`);if(m!==1)throw new U(`mappings: the value before ${c} is cut off`);if(f>0){if(f===2||f===3)throw new U(`mappings: a segment of ${f} fields before ${c}`);let t=f===1?-1:s[e[1]];if(t===void 0)throw new U(`mappings: source ${e[1]} before ${c} is not in sources`);if(e[0]<0)throw new U(`mappings: a negative generated column before ${c}`);a===n.length&&([n,r,i]=[bn(n),bn(r),bn(i)]),n[a]=e[0]+h,r[a]=t,i[a++]=f===5&&e[4]>=0&&e[4]<d?u+e[4]:-1,f=0}l===65&&(t.push(a),e[0]=0,h=0)}}return t.push(a),xn({starts:Int32Array.from(t),columns:n.slice(0,a),sources:r.slice(0,a),names:i.slice(0,a)})}var Cn=new WeakMap,wn=e=>Cn.get(e),W=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function G(e,t){if(!e)throw new U(t)}function Tn(e,t){if(e===void 0)return[];G(Array.isArray(e),`${t} is not an array`);for(let n of e)G(typeof n==`string`||n===null,`${t} holds ${JSON.stringify(n)}`);return e}function En(e,t,n,r){let i=e.bySource.get(t);if(i!==void 0)return e.files[i].content??=n,e.files[i].ignored||=r,i;let a=t===null?null:V(t,e.mapPath);return e.files.push({source:t,path:a,package:a===null?null:Qt(a),content:n,ignored:r}),t!==null&&e.bySource.set(t,e.files.length-1),e.files.length-1}function Dn(e,t,n,r){G(e.version===3,`version ${JSON.stringify(e.version)} is not 3`),G(e.sourceRoot===void 0||typeof e.sourceRoot==`string`,`sourceRoot is not a string`);let i=Tn(e.sources,`sources`),a=Tn(e.sourcesContent,`sourcesContent`),o=e.ignoreList??e.x_google_ignoreList??[];G(Array.isArray(o)&&o.every(e=>Number.isInteger(e)&&e>=0&&e<i.length),`ignoreList is not a list of indices into sources`);let s=new Set(o),c=e.sourceRoot?e.sourceRoot.replace(/\/?$/u,`/`):``,l=i.map((e,n)=>En(t,e===null?null:c+e,a[n]??null,s.has(n))),u=Array.isArray(e.names)?e.names:[];t.parts.push({mappings:e.mappings,files:l,line:n,column:r,names:t.names.length,nameCount:u.length}),t.names.push(...u)}function On(e,t){G(e.version===3,`version ${JSON.stringify(e.version)} is not 3`),G(Array.isArray(e.sections),`sections is not an array`);for(let[n,r]of e.sections.entries()){let{offset:i,map:a}=W(r)?r:{};G(W(i)&&[i.line,i.column].every(e=>Number.isInteger(e)&&e>=0),`sections[${n}].offset is not a line and a column`),G(W(a)&&a.sections===void 0,`sections[${n}].map is not a plain source map`);let o=e.sections[n-1]?.offset;G(!o||o.line<i.line||o.line===i.line&&o.column<=i.column,`sections[${n}] starts before sections[${n-1}]`),Dn(a,t,i.line,i.column)}}function kn(e,t={}){if(!W(t))throw TypeError(`readSourceMap: options is not an object`);if(t.path!==void 0&&typeof t.path!=`string`)throw TypeError(`readSourceMap: options.path is not a string`);let n=e;if(typeof e==`string`||e instanceof Uint8Array)try{let t=typeof e==`string`?e:new TextDecoder(`utf-8`,{fatal:!0}).decode(e);n=JSON.parse(t.replace(/^\)\]\}'[^\n]*\n/u,``))}catch(e){throw new U(`not JSON: ${e.message}`,{cause:e})}G(W(n),`not a JSON object`);let r={files:[],bySource:new Map,mapPath:t.path,parts:[],names:[]};n.sections===void 0?Dn(n,r,0,0):On(n,r);let i={files:r.files};return Cn.set(i,{...Sn(r.parts),nameList:r.names}),i}var An=/\r\n?|[\n\u2028\u2029]/gu;function jn(e){let t=[0];for(let n of e.matchAll(An))t.push(n.index+n[0].length);return t}function Mn(e,t,n,r){let[i,a]=[t,n];for(;i<a;){let t=i+a>>1;e[t]<=r?i=t+1:a=t}return i-1}function K(e,t){let n=Mn(e,0,e.length,t);return[n,t-e[n]]}function Nn(e,[t,n]){if(t>=e.starts.length-1)return-1;let r=e.starts[t],i=Mn(e.columns,r,e.starts[t+1],n);return i<r?-1:i}function Pn(e,t,n,r){let i=wn(e),a=K(t,n),[o,s]=K(t,r),c=new Map,l=Nn(i,a);for(let e=a[0];e<=o&&e<i.starts.length-1;e++){let t=e===a[0]&&l>=0?l:i.starts[e];for(let n=t;n<i.starts[e+1];n++){let t=i.sources[n];if(e===o&&i.columns[n]>=s)break;t>=0&&c.set(t,(c.get(t)??0)+1)}}let[u]=[...c].reduce((e,t)=>t[1]>e[1]?t:e,[-1,0]);return u<0?null:e.files[u]}var q=/\s+/uy,Fn=`
|
|
8
|
+
\r\u2028\u2029`,J=/[\n\r\u2028\u2029]/gu,In=/[\n\r\u2028\u2029]/u,Y=/[\w$\u0080-]+/uy,Ln=new Set([`return`,`typeof`,`instanceof`,`in`,`of`,`new`,`delete`,`void`,`throw`,`case`,`default`,`extends`,`do`,`else`,`yield`,`await`]),Rn=new Set([`if`,`while`,`for`,`with`]),zn=new Set([`break`,`continue`,`debugger`]),Bn=new Set([`(`,`[`,"${",`,`,`=`,`:`,`?`,`!`,`~`,`+`,`-`,`*`,`/`,`%`,`&`,`|`,`^`,`<`,`>`]);function Vn(e,t){return e?.type===`word`?t&&[`return`,`yield`].includes(e.value)?!1:Ln.has(e.value)&&![`do`,`else`].includes(e.value):Bn.has(e?.value)}function Hn(e){let t=e.at(-1);return t?.type===`word`&&(Rn.has(t.value)||t.value===`await`&&e.at(-2)?.value===`for`)}function Un(e){return e?e.type===`word`?Ln.has(e.value)||zn.has(e.value)||e.label===!0:e.value===`)`?e.control:e.value===`}`?!e.object:e.type===`punctuator`&&![`++`,`--`,`]`].includes(e.value):!0}var Wn=(e,t)=>e.startsWith(`\r
|
|
9
|
+
`,t+1)?3:2,Gn=/\\(?:u\{([\da-f]+)\}|u([\da-f]{4})|x([\da-f]{2})|([0-3][0-7]{0,2}|[4-7][0-7]?)|(\r\n|[\n\r\u2028\u2029])|(.))/giu,Kn={b:`\b`,f:`\f`,n:`
|
|
10
|
+
`,r:`\r`,t:` `,v:`\v`};function qn(e){return e.includes(`\\`)?e.replace(Gn,(e,t,n,r,i,a,o)=>{if(a!==void 0)return``;if(i!==void 0)return String.fromCodePoint(Number.parseInt(i,8));let s=Number.parseInt(t??n??r,16);return Number.isNaN(s)?Kn[o]??o:String.fromCodePoint(Math.min(s,1114111))}):e}function Jn(e,t){let n=e[t],r=t+1;for(;r<e.length&&e[r]!==n&&!Fn.includes(e[r]);)r+=e[r]===`\\`?Wn(e,r):1;return[e[r]===n?qn(e.slice(t+1,r)):null,r+1]}function Yn(e,t){let n=t+1,r=!1;for(;n<e.length&&!Fn.includes(e[n])&&(r||e[n]!==`/`);)e[n]===`\\`?n++:e[n]===`[`?r=!0:e[n]===`]`&&(r=!1),n++;return Y.lastIndex=n+1,Y.test(e)?Y.lastIndex:n+1}function Xn(e,t,n){for(let r=t;r<e.length;r++)if(e[r]===`\\`)r++;else{if(e[r]==="`")return r+1;if(e[r]===`$`&&e[r+1]===`{`)return n.push(`template`),r+2}return e.length}function Zn(e){let t=[],n=[],r=[],i=0,a=0;for(;i<e.length;){let o=t.length;if(q.lastIndex=i,q.test(e)&&(i=q.lastIndex),i>=e.length)break;let s=e[i],c=e[i+1];if(Y.lastIndex=i,s===`/`&&c===`/`)J.lastIndex=i+2,i=J.test(e)?J.lastIndex-1:e.length;else if(s===`/`&&c===`*`){let t=e.indexOf(`*/`,i+2);i=t<0?e.length:t+2}else if(s===`"`||s===`'`){let[n,r]=Jn(e,i);t.push({type:`string`,value:n}),i=r}else if(s==="`"||s===`}`&&n.at(-1)===`template`){s===`}`&&n.pop();let r=n.length,a=Xn(e,i+1,n),o=s==="`"&&n.length===r&&e[a-1]==="`";t.push({type:`string`,value:o?qn(e.slice(i+1,a-1)):null}),n.length>r&&t.push({type:`punctuator`,value:"${"}),i=a}else if(s===`/`&&Un(t.at(-1)))i=Yn(e,i),t.push({type:`regex`});else if(Y.test(e)){let n=zn.has(t.at(-1)?.value)&&!In.test(e.slice(a,i));t.push({type:`word`,value:e.slice(i,Y.lastIndex),...n&&{label:n}}),i=Y.lastIndex}else{s===`{`&&n.push(Vn(t.at(-1),In.test(e.slice(a,i)))?`object`:`block`);let o=s===`}`?n.pop():void 0;s===`(`&&r.push(Hn(t));let l=(s===`+`||s===`-`)&&c===s||s===`=`&&c===`>`?s+c:s;t.push({type:`punctuator`,value:l,...s===`)`&&{control:r.pop()===!0},...s===`}`&&{object:o===`object`}}),i+=l.length}t.length>o&&(a=i)}return t}var Qn=e=>e?.type===`string`&&e.value!==null,$n=new Set([`type`,`typeof`]),er=(e,t)=>e[t+1]?.type===`word`&&(e[t+1].value!==`as`||e[t+2]?.type!==`word`||e[t+2].value===`as`);function tr(e,t){let n=!1;for(let r=t+1;r<e.length&&e[r].value!==`}`;r++)if(!(r>t+1&&e[r-1].value!==`,`)){if(!$n.has(e[r].value)||!er(e,r))return!1;n=!0}return n}function nr(e,t){for(let n=t;n<e.length;n++){let{value:r}=e[n];if(r===`;`||n>t&&(r===`import`||r===`export`))return null;if(r===`from`&&Qn(e[n+1]))return e[n+1].value}return null}function rr(e,t){let[n,r,i]=[e[t].value,e[t+1],e[t+2]],a=n===`import`?`import`:`export-from`;if(n===`import`&&Qn(r))return{kind:a,specifier:r.value};if($n.has(r?.value)&&![`,`,`from`].includes(i?.value)||r?.value===`{`&&tr(e,t+1)||n===`export`&&![`{`,`*`].includes(r?.value)||n===`import`&&r?.type!==`word`&&![`{`,`*`].includes(r?.value))return null;let o=nr(e,t+1);return o===null?null:{kind:a,specifier:o}}function ir(e,t){let[n,r]=[e[t+2],e[t+3]];if(n?.value!==`)`)return Qn(n)&&[`)`,`,`].includes(r?.value)?n.value:null}function ar(e,t=new Set){let n=Zn(e),r=[];for(let[e,i]of n.entries()){if(i.type!==`word`||[`.`,`#`,`function`].includes(n[e-1]?.value)||n[e-1]?.value===`=`&&n[e-3]?.value===`type`&&n[e-4]?.value===`import`)continue;let a=n[e+1]?.value===`(`,o=a?ir(n,e):void 0;if((i.value===`require`||t.has(i.value))&&o!==void 0)r.push({kind:`require`,specifier:o,...i.value!==`require`&&{callee:i.value}});else if(i.value===`import`&&a)o!==void 0&&r.push({kind:`dynamic-import`,specifier:o});else if(i.value===`import`||i.value===`export`){let t=rr(n,e);t&&r.push(t)}}return r}var or=/^[\w$]*__d\(/gmu,sr=([e,t,n,...r])=>(typeof e==`number`||typeof e==`string`)&&(t===void 0||typeof t==`object`)&&(n===void 0||typeof n==`string`)&&r.length===0;function cr(e){let t=/\);?\s*$/u.exec(e)?.index,n=null,r=t===void 0?-1:e.lastIndexOf(`},`,t);for(;r>=0&&/[\d"]/u.test(e[r+2]);){let i;try{i=JSON.parse(`[${e.slice(r+2,t)}]`)}catch{break}if(!sr(i))break;n=i,r=r>0?e.lastIndexOf(`},`,r-1):-1}return n}function lr(e){let t=/^[^(]*\(\s*(?:function\s*[\w$]*\s*)?\(([^)]*)\)/u.exec(e)?.[1].split(`,`).slice(1,4).map(e=>e.trim().replaceAll(`$`,`\\$`));if(!t?.length)return[];let n=e.matchAll(RegExp(`(?<=[^\\w$.#]|\\.\\.\\.)(?:${t.join(`|`)})\\((\\d+|"(?:[^"\\\\]|\\\\.)*")[,)]`,`gu`));return[...new Set([...n].map(e=>JSON.parse(e[1])))]}function ur(e,t){if(Array.isArray(e))return e;let n=Object.entries(e??{}).filter(([e])=>/^\d+$/u.test(e)).map(([,e])=>e);return n.length>0?n:lr(t)}function dr(e,t){let n=new Map(t.files.map((e,t)=>[e,t])),r=e.flatMap((e,t)=>e.file?[{k:t,at:n.get(e.file)}]:[]);for(let n=0;n<(r[0]?.k??0);n++)e[n].file=t.files[r[0].at-r[0].k+n]??null;for(let[n,{k:i,at:a}]of r.entries()){let o=r[n+1];if(!(o&&o.at-a!==o.k-i))for(let n=i+1;n<(o?.k??e.length);n++)e[n].file=t.files[a+n-i]??null}}function fr(e,t){let n=[...e.matchAll(or)].map(e=>e.index);if(n.length===0)return null;let r=jn(e),i=t=>e.slice(r[t],r[t+1]),a=[];for(let[o,s]of n.entries()){let[c]=K(r,s),[l]=K(r,(n[o+1]??e.length)-1),u=cr(i(l));for(;!u&&l>c;)u=cr(i(--l));if(!u)throw Error(`bundleEdges: the Metro module at line ${c+1} ends in no define params`);let d=r[l+1]??e.length;a.push({id:u[0],file:Pn(t,r,s,d),dependencies:ur(u[1],e.slice(s,d))})}dr(a,t);let o=new Map(a.map(e=>[e.id,e])),{edges:s,link:c}=hn();for(let{file:e,dependencies:t}of a)for(let n of t)c(e,o.get(n)?.file,`dependency`);return s}var pr=e=>e.path!==null&&![`json`,null].includes(en(e.path)),mr=e=>e.path!==null&&en(e.path)===null;function hr(e){let t=/^_([A-Za-z]+)\d+$/u.exec(e)?.[1];if(t)return[t,`interopRequireDefault`];let n=/^_(interopRequire(?:Default|Wildcard)|jsx(?:Dev)?Runtime|callSuper)$/u.exec(e)?.[1];return n===`callSuper`?[`getPrototypeOf`,`possibleConstructorReturn`,`interopRequireDefault`]:n?[n]:[]}var gr={jsxRuntime:`react/jsx-runtime`,jsxDevRuntime:`react/jsx-dev-runtime`};function _r(e){let{sources:t,names:n,nameList:r}=wn(e),i=new Map,a=new Map,o=e.files.map(()=>new Set);for(let e=0;e<n.length;e++)n[e]<0||t[e]<0||(a.has(n[e])||a.set(n[e],hr(r[n[e]]).length>0),a.get(n[e])&&o[t[e]].add(r[n[e]]));for(let[t,n]of o.entries()){if(n.size===0)continue;let r=e.files[t],a=new Set(Array.from((r.content??``).matchAll(/(?:function|var|let|const)\s+(_[A-Za-z]+\d*)\b/gu),e=>e[1])),o=[...n].filter(e=>!a.has(e)&&!a.has(e.replace(/\d+$/u,``))).flatMap(hr);o.length>0&&i.set(r,o.map(e=>gr[e]??`@babel/runtime/helpers/${e}`))}return i}function vr(e,t){let n=new Map;for(let[r,i]of e){let e=n.get(r)??n.set(r,new Map).get(r);for(let n of i)e.set(n,vn(t,r,n,()=>null))}let r=new Set([...n.values()].flatMap(e=>[...e.values()].map(e=>e.to))),i=(e,n)=>t.byRoot.get(n).find(e=>!r.has(e))??t.byRoot.get(n)[0];return(e,r)=>{let a=n.get(e)?.get(r);return a?.to?a:vn(t,e,r,i)}}var yr=e=>/(?:^|\/)__prelude__$/u.test(e.source??``),br=e=>e?.package?.name===`metro-runtime`&&e.package.path===`src/polyfills/require.js`;function xr(e){if(!e.files.some(yr)&&!br(e.files[0]))return null;if(!e.files.some(e=>e.content!==null&&!yr(e)&&!br(e)))throw Error("bundleEdges: the Metro map carries no sourcesContent, which its edges are read from; pass the bundle as `code`");let t=dn(e.files),n=e.files[e.files.findIndex(mr)+1],r=e.files.find(e=>e.package?.name===`metro-runtime`&&e.package.path===`src/modules/asyncRequire.js`),i=new Map(e.files.filter(e=>e.content!==null&&pr(e)).map(e=>[e,ar(e.content)])),a=_r(e),o=vr([...[...i].map(([e,t])=>[e,t.flatMap(({specifier:e})=>e===null?[]:[e])]),...a],t),{edges:s,add:c,link:l}=hn();for(let t of e.files){mr(t)&&l(t,n,`dependency`);for(let{kind:e,specifier:n}of i.get(t)??[]){let i=n===null?{to:null}:o(t,n);i.to!==t&&c(t,`${e}\0${JSON.stringify(n)}`,{from:t,kind:e,specifier:n,...i}),e===`dynamic-import`&&l(t,r,`dependency`)}for(let e of a.get(t)??[])l(t,o(t,e).to,`dependency`)}return s}var Sr=(e,t)=>t==null?xr(e):fr(t,e);function Cr(e,t){let n=Sr(e,t);if(!n)throw Error(`bundleEdges: not a Metro ${t==null?`map`:`bundle`}; edges-lite.js reads only those, edges.js reads others`);return{edges:n}}function wr(e){let t=JSON.parse(e.replace(/^\)\]\}'[^\n]*\n/u,``)),n=kn(t),r=t.sections?t.sections.reduce((e,t)=>e+(t.map.names?.length??0),0):t.names?.length??null;return{json:{version:t.version,file:t.file,sourceRoot:t.sourceRoot},map:n,namesCount:r}}function Tr(e){if(e.map)return e.map.files.flatMap(e=>e.source===null?[]:[[e.source,e.content]]);let t=e.json?.sourcesContent??[];return(e.json?.sources??[]).map((e,n)=>[e,t[n]??null])}function Er(e,t){let n=new Map;for(let{from:r,to:i,specifier:a}of t(e).edges){if(r.source===null||i?.source==null||i.source===r.source)continue;let e=typeof a==`string`?[r.source,i.source,a]:[r.source,i.source];n.set(e.join(`\0`),e)}return[...n.values()]}function Dr(e){try{return Cr(e)}catch{return{edges:[]}}}var Or=Object.freeze([]);function X(e){return e?.edges?e.edges:e?.map?(e.edges=Er(e.map,Dr),e.edges):Or}var kr=new WeakMap,Ar=new WeakMap;function jr(e){let t=X(e);if(!kr.has(t)){let e=new Map;for(let[n,r]of t)e.has(n)||e.set(n,new Set),e.get(n).add(r);kr.set(t,e)}return kr.get(t)}function Mr(e){let t=X(e);if(!Ar.has(t)){let e=new Map;for(let[n,r,i]of t)i!==void 0&&(e.has(n)||e.set(n,new Map),e.get(n).set(i,r));Ar.set(t,e)}return Ar.get(t)}var Nr=new WeakMap,Pr=new WeakMap,Fr=new WeakMap,Ir=new WeakMap,Lr=new WeakMap,Rr=new WeakMap;function Z(e){if(e?.metadataOnly)return new Map;let t=e?.bundle??e?.json;if(t&&Nr.has(t))return Nr.get(t);let n=new Map;if(!e)return n;if(e.kind===`stasis`){if(!e.bundle)return n;let t=e.bundle.formats;for(let[r,i]of e.bundle.sources)typeof i==`string`&&(F.isResourceFormat(t?.get(r))||n.set(r,i))}else if(e.kind===`sourcemap`)for(let[t,r]of Tr(e))typeof r==`string`&&n.set(t,r);return t&&Nr.set(t,n),n}function zr(e){let t=1;for(let n=e.indexOf(`
|
|
11
|
+
`);n!==-1;n=e.indexOf(`
|
|
12
|
+
`,n+1))t++;return t}var Br=new WeakMap;function Vr(e){let t=Br.get(e);if(!t){let n=[...e.keys()].toSorted();t={paths:n,numbers:new Map(n.map((e,t)=>[e,t+1]))},Br.set(e,t)}return t}function Hr(e,t){let n=Array.isArray(t)?t:[];return{integrity:e.integrity,kind:`sourcemap`,size:e.size,json:{version:3,sources:n.map(([e])=>e),sourcesContent:n.map(([,,e])=>typeof e==`string`?e:null)},fileSizes:new Map(n.map(([e,t])=>[e,t])),npmBinaries:new Map(n.filter(([,,e,t])=>typeof e!=`string`&&typeof t==`string`).map(([e,t,,n])=>[e,{size:t,digest:n}]))}}function Ur(e){let t=e?.bundle??e?.json;if(t&&Pr.has(t))return Pr.get(t);let n=new Map(Z(e));for(let[t,r]of e?.npmBinaries??[])n.set(t,{format:`digest`,...r});if(e?.kind===`stasis`&&e.bundle){let t=e.bundle.formats;for(let[r,i]of e.bundle.sources){if(typeof i!=`string`)continue;let e=t?.get(r);e===`resource`?n.set(r,i):e===`resource:base64`&&n.set(r,{format:`base64`,data:i})}}return t&&Pr.set(t,n),n}var Wr=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;function Gr(e){let t=e.endsWith(`=`);if(t?e.length%4!=0||e.at(-3)===`=`:e.length%4==1)return null;let n=t?e.slice(0,e.endsWith(`==`)?-2:-1):e;if(/[^A-Za-z0-9+/]/u.test(n))return null;let r=n.length%4;return r>1&&Wr.indexOf(n.at(-1))&(r===2?15:3)?null:Math.floor(n.length*3/4)}function Kr(e){return typeof e==`string`?t(e):e?.format===`digest`?e.size:e?.format===`base64`?Gr(e.data):null}function Q(e){if(e?.fileSizes)return e.fileSizes;let t=e?.bundle??e?.json;if(t&&Fr.has(t))return Fr.get(t);let n=new Map,r=Ur(e),i=e?.kind===`stasis`?e.bundle?.sources.keys():e&&Tr(e).map(([e])=>e);for(let e of i??[])n.set(e,Kr(r.get(e)));return t&&Fr.set(t,n),n}function qr(e){if(e?.metadataOnly)return e.unsizedFiles??new Set;let t=Q(e);if(Rr.has(t))return Rr.get(t);let n=new Set;for(let r of Ur(e).keys())t.get(r)===null&&n.add(r);return Rr.set(t,n),n}function Jr(e){let t=Q(e);if(Lr.has(t))return Lr.get(t);let n=qr(e),r=e?.kind===`stasis`?e.bundle?.formats:null,i=new Map;for(let[a,o]of t)o===null&&!n.has(a)||i.set(a,F.isResourceFormat(r?.get(a))||e?.npmBinaries?.has(a)?`resource`:`source`);return Lr.set(t,i),i}function Yr(e){let t=Q(e),n=e?.kind===`stasis`?e.bundle?.formats:null;if(!n||n.size===0)return t;if(Ir.has(t))return Ir.get(t);let r=new Map;for(let[e,i]of t)F.isResourceFormat(n.get(e))||r.set(e,i);return Ir.set(t,r),r}var Xr=new WeakMap;function Zr(e){if(e?.kind!==`stasis`||!e.bundle?.modules)return null;if(Xr.has(e.bundle))return Xr.get(e.bundle);let t=new Map;for(let[n,r]of e.bundle.modules)for(let e of Object.keys(r.files))t.set(n===`.`?e:`${n}/${e}`,n);return Xr.set(e.bundle,t),t}function Qr(e,t=null,n=(e,t)=>t.name){let r=new Map;if(e?.kind!==`stasis`||!e.bundle?.modules)return r;let i=t===null?null:Zr(e),a=t===null?null:new Set([...t].map(e=>i?.get(e)));for(let[t,i]of e.bundle.modules){if(a&&!a.has(t)||!t.includes(`node_modules`)||!i?.name||typeof i.version!=`string`||!i.version)continue;let e=n(t,i),o=r.get(e);o||(o=new Set,r.set(e,o)),o.add(i.version)}return r}var $r=Object.freeze({javascript:`JavaScript`,jsx:`JSX`,typescript:`TypeScript`,tsx:`TSX`,json:`JSON`,css:`CSS`,markup:`HTML`,yaml:`YAML`,bash:`Shell`,markdown:`Markdown`,solidity:`Solidity`,php:`PHP`,rust:`Rust`,ruby:`Ruby`,java:`Java`,cpp:`C++`,c:`C`,objectivec:`Objective-C`,python:`Python`,go:`Go`,kotlin:`Kotlin`,swift:`Swift`,dart:`Dart`,sql:`SQL`,lua:`Lua`,csharp:`C#`,scala:`Scala`,vue:`Vue`,svelte:`Svelte`}),ei=Object.freeze({py:`python`,pyw:`python`,go:`go`,kt:`kotlin`,kts:`kotlin`,swift:`swift`,dart:`dart`,sql:`sql`,lua:`lua`,cs:`csharp`,scala:`scala`,sc:`scala`,vue:`vue`,svelte:`svelte`});function ti(e){let t=typeof e==`string`?e.slice(e.lastIndexOf(`/`)+1):``,n=t.lastIndexOf(`.`),r=n>0?t.slice(n+1).trim().toLowerCase():``,i=Rt(e)??ei[r];return i?{key:i,label:$r[i]??i}:r?{key:`extension:${r}`,label:`.${r}`}:{key:`other`,label:`Other`}}function ni(e,t){let n=new Map,r=0,i=0;for(let[a,o]of e){let e=ti(a),s=n.get(e.key)??{...e,files:0,lines:0,bytes:0};s.files++,s.lines+=o,s.bytes+=t.get(a)??0,n.set(e.key,s),i+=o,r+=t.get(a)??0}return{files:e.size,lines:i,bytes:r,languages:[...n.values()].toSorted((e,t)=>t.lines-e.lines||e.label.localeCompare(t.label))}}var ri=6,$=new WeakMap,ii=new Set([`terminal`,`code`,`search`,`compare`]);function ai(e,t=null){return!!t||ii.has(e)}var oi=/^sha512-[A-Za-z0-9+/]{86}==$/u;function si(t){if(t.fileHashes)return Promise.resolve(t.fileHashes);if($.has(t))return $.get(t);let n=(async()=>{let n=[...Z(t)],r=new Map;for(let t=0;t<n.length;t+=32){let i=await Promise.all(n.slice(t,t+32).map(async([t,n])=>[t,await e(n)]));for(let[e,t]of i)r.set(e,t)}return t.fileHashes=r,r})();return $.set(t,n),n.catch(()=>$.delete(t)),n}function ci(e){if(typeof e!=`string`)return 0;let t=/\S/gu,n=/[\r\n]/gu,r=0;for(;t.test(e)&&(r++,n.lastIndex=t.lastIndex,n.test(e));)t.lastIndex=n.lastIndex;return r}function li(e){return e.lineCounts??=new Map([...Z(e)].map(([e,t])=>[e,ci(t)]))}function ui(e){return e instanceof Map?Object.fromEntries([...e].map(([e,t])=>[e,ui(t)])):e}async function di(e){let n=await si(e),r=Q(e),i=li(e),a={version:ri,integrity:e.integrity,kind:e.kind,size:e.size,codeStats:ni(i,r),files:[...r].map(([e,t])=>[e,t,n.get(e)??null,i.get(e)??null])},o=qr(e);if(o.size>0&&(a.unsized=[...o]),e.kind===`sourcemap`){let{version:n,file:r,sourceRoot:i,names:o}=e.json,s=Tr(e);a.json={version:n,file:r,sourceRoot:i,sources:s.map(([e])=>e)},a.sourceSizes=s.map(([,e])=>typeof e==`string`?t(e):null),a.namesCount=e.namesCount??o?.length??null;let c=new Map(a.files.map(([e],t)=>[e,t]));a.edges=X(e).map(([e,t,...n])=>[c.get(e),c.get(t),...n])}else{let t=e.bundle,n={version:t.version,config:t.config,repo:t.repo,package:t.package,formats:ui(t.formats),imports:ui(t.imports),reason:t.reason,executable:[...t.executable]};if(t.version===0)n.sources=Object.fromEntries([...r.keys()].map(e=>[e,null]));else{let e={},r={};for(let[n,i]of t.modules){let t=n.split(`/`).includes(`node_modules`)?e:r;Object.defineProperty(t,n,{enumerable:!0,value:{name:i.name,version:i.version,ecosystem:i.ecosystem,repo:i.repo,files:Object.fromEntries(Object.keys(i.files).map(e=>[e,null]))}})}n.modules=e,t.config.scope===`full`&&(n.sources=r,n.entries=[...t.entries])}a.bundle=n}return a}function fi(e,t){if(![1,2,3,4,5,ri].includes(e?.version)||e.integrity!==t||![`stasis`,`sourcemap`].includes(e.kind)||!Number.isSafeInteger(e.size)||e.size<0||!Array.isArray(e.files))throw Error(`Invalid bundle metadata`);let n=e.version!==ri,r=e.version===1,i=new Map,a=new Map,o=new Map;for(let t of e.files){if(!Array.isArray(t)||t.length!==4&&!(r&&t.length===3))throw Error(`Invalid bundle metadata file`);let[e,n,s,c]=t;if(typeof e!=`string`||a.has(e)||n!==null&&(!Number.isSafeInteger(n)||n<0)||s!==null&&(typeof s!=`string`||!oi.test(s))||n===null&&s!==null||r&&n!==null&&s===null||c!=null&&(!Number.isSafeInteger(c)||c<0))throw Error(`Invalid bundle metadata file`);a.set(e,n),s!==null&&i.set(e,s),c!=null&&o.set(e,c)}let s=new Set(e.unsized??[]);if(e.unsized!==void 0&&(r||!Array.isArray(e.unsized)||s.size!==e.unsized.length)||[...s].some(e=>typeof e!=`string`||!a.has(e)||a.get(e)!==null))throw Error(`Invalid bundle metadata`);let c={integrity:t,kind:e.kind,size:e.size,metadataOnly:!0,fileSizes:a,fileHashes:i,lineCounts:o,unsizedFiles:s,stale:n};if(e.kind===`stasis`){c.bundle=F.fromJSON(e.bundle);let t=c.bundle.sources;if(t.size!==a.size||[...t.keys()].some(e=>!a.has(e)))throw Error(`Invalid bundle metadata inventory`);let n=c.bundle.formats;if(!r&&[...a].some(([e,t])=>i.has(e)!==(t!==null&&!F.isResourceFormat(n.get(e))))||[...s].some(e=>n.get(e)!==`resource:base64`))throw Error(`Invalid bundle metadata inventory`)}else{if(!e.json||typeof e.json!=`object`||![null,void 0].includes(e.namesCount)&&(!Number.isSafeInteger(e.namesCount)||e.namesCount<0))throw Error(`Invalid sourcemap metadata`);if(!Array.isArray(e.json.sources)||e.json.sources.some(e=>!a.has(e))||!Array.isArray(e.sourceSizes)||e.sourceSizes.length!==e.json.sources.length||e.sourceSizes.some(e=>e!==null&&(!Number.isSafeInteger(e)||e<0))||[...a].some(([e,t])=>i.has(e)!==(t!==null))||s.size>0)throw Error(`Invalid sourcemap inventory`);c.json=e.json,c.sourceSizes=e.sourceSizes,c.namesCount=e.namesCount,e.edges!==void 0&&(c.edges=pi(e.edges,e.files))}if(e.codeStats===void 0)c.codeStats=ni(o,a);else{let t=e.codeStats,n=e=>Number.isSafeInteger(e)&&e>=0;if(!t||![t.files,t.lines,t.bytes].every(n)||!Array.isArray(t.languages)||t.languages.some(e=>!e||typeof e.key!=`string`||typeof e.label!=`string`||![e.files,e.lines,e.bytes].every(n)))throw Error(`Invalid bundle code stats`);c.codeStats=t}return c}function pi(e,t){if(!Array.isArray(e))throw Error(`Invalid sourcemap edges`);return e.map(e=>{if(!Array.isArray(e)||![2,3].includes(e.length)||e[0]===e[1]||e.length===3&&typeof e[2]!=`string`||e.slice(0,2).some(e=>!Number.isSafeInteger(e)||e<0||e>=t.length))throw Error(`Invalid sourcemap edges`);return[t[e[0]][0],t[e[1]][0],...e.slice(2)]})}function mi(e,{integrity:t,kind:n,size:r}){if(n===`stasis`)return{integrity:t,kind:n,size:r,bundle:F.parse(e)};if(n!==`sourcemap`)throw Error(`Unsupported bundle format`);return{integrity:t,kind:n,size:r,...wr(e)}}export{At as a,F as b,Rt as c,X as d,jr as e,Mr as f,Z as g,zr as h,Vr as i,Hr as j,Ur as k,Kr as l,Q as m,Jr as n,Yr as o,Zr as p,Qr as q,ni as r,ai as s,si as t,ci as u,li as v,di as w,fi as x,mi as y};
|
|
@@ -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,11 @@
|
|
|
1
|
+
import{a as e,b as t,c as n,d as r}from"./chunk-M3Y6SLC4.js";import{C as i,D as a,E as o,H as s,M as c,N as l,Q as u,S as d,a as f,e as p,f as m,h,i as g,j as _,k as v,m as y,n as b,o as x,p as S,q as ee,r as C,x as w,y as T,z as te}from"./chunk-UCP3JRE2.js";import{a as ne}from"./chunk-Z667U2UJ.js";import{b as re}from"./chunk-DEVAORP2.js";import"./chunk-ZQHLECTI.js";import"./chunk-PXK7EU4V.js";import{a as ie,b as E,c as ae,d as D,f as oe,h as O,i as k,k as se,n as A,q as ce}from"./chunk-JMG5DXII.js";import"./chunk-OOJM4CTU.js";var j=class extends ae{},le=e=>RegExp(`(?:[^ ?:,[\\]{}#&*!|>'"%@\`-]|[-?:](?=[^${e}]))(?:[^:${e}]|:(?=[^${e}])| +(?=[^#:${e}]|:[^${e}]))*`,`uy`),ue={block:le(` `),flow:le(` ,[\\]{}`)},de=/'((?:[^']|'')*)'/uy,fe=/"((?:[^"\\]|\\.)*)"/uy,pe={__proto__:null,0:`\0`,a:`\x07`,b:`\b`,t:` `,n:`
|
|
2
|
+
`,v:`\v`,f:`\f`,r:`\r`,e:`\x1B`," ":` `,'"':`"`,"/":`/`,"\\":`\\`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`},me=/\\(?:x([\dA-Fa-f]{2})|u([\dA-Fa-f]{4})|U([\dA-Fa-f]{8})|(.))/gu;function he(e,t){return e.replace(me,(e,n,r,i,a)=>{if(a!==void 0){if(!(a in pe))throw new j(`unknown escape \\${a}`,t.line);return pe[a]}let o=Number.parseInt(n??r??i,16);if(o>1114111||o>=55296&&o<=57343)throw new j(`${e} is not a Unicode scalar value`,t.line);return String.fromCodePoint(o)})}var ge={__proto__:null,true:!0,false:!1,null:null},_e=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[Ee][+-]?\d+)?$/u,ve=/^(?:~|null|true|false|\.nan|[+-]?(?:\.inf|0[box][\d_a-f]+|(?:\d[\d_]*(?:\.[\d_]*)?|\.[\d_]+)(?:e[+-]?\d+)?))$/iu,ye=/^\d{4}-(?:\d\d-\d\d|\d\d?-\d\d?(?:[Tt]| +)\d\d?:\d\d:\d\d(?:\.\d*)?(?: *(?:Z|[+-]\d\d?(?::\d\d)?))?)$/u;function be(e,t){if(e in ge)return ge[e];if(_e.test(e)&&e!==`-0`){let n=Number(e);if(Math.abs(n)>2**53-1)throw new j(`number out of range ${E(e)}`,t.line);return n}if(ve.test(e)||ye.test(e))throw new j(`ambiguous scalar ${E(e)}, quote it`,t.line);return e}var M=e=>e.pos<e.text.length?E(e.text.slice(e.pos)):`the end of the line`,xe=(e,t)=>he(e,{line:t});function Se(e,t){let n=A(e,de);return n===null?(n=A(e,fe),n===null?(n=A(e,ue[t]),n===null?void 0:be(n[0],e)):he(n[1],e)):n[1].replaceAll(`''`,`'`)}function Ce(e,t){let n=Se(e,t);if(n===void 0)throw new j(`expected a scalar, found ${M(e)}`,e.line);return n}function N(e,t,n,r){if(typeof t!=`string`)throw new j(`keys must be strings`,r);if(t===`<<`)throw new j(`merge keys are not supported`,r);if(t in e)throw new j(`duplicate key ${E(t)}`,r);e[t]=n}var P=/ */uy,we=/, */uy,Te=/: +/uy,Ee=/:(?: +(?:#.*)?|$)/uy,De=/(?: +#.*| *)$/uy,Oe=64;function F(e,t){let n=t===`]`?[]:Object.create(null);if(e.workflow&&++e.depth>Oe)throw new j(`nested too deep`,e.line);if(e.pos++,A(e,P),e.text[e.pos]!==t)do{if(e.workflow&&e.text[e.pos]===t)break;if(e.workflow)je(e,n,t);else{let r=I(e);if(t===`]`)n.push(r);else{if(A(e,Te)===null)throw new j(`expected ": " after the key, found ${M(e)}`,e.line);N(n,r,I(e),e.line)}}A(e,P)}while(A(e,we)!==null);if(e.text[e.pos]!==t)throw new j(`expected "," or "${t}", found ${M(e)}`,e.line);return e.pos++,e.workflow&&e.depth--,n}function I(e){let t=e.text[e.pos];return e.workflow&&(t===`[`||t===`{`)?F(e,t===`[`?`]`:`}`):Ce(e,`flow`)}var ke=/ *:(?=[ ,\]}]|$)/uy,Ae=/ *:/uy;function je(e,t,n){let r=e.text[e.pos]===`"`||e.text[e.pos]===`'`,i=I(e),a=A(e,r?Ae:ke)!==null;if(n===`]`&&!a){t.push(i);return}A(e,P);let o=a&&e.text[e.pos]!==`,`&&e.text[e.pos]!==n?I(e):null;if(n===`}`){N(t,i,o,e.line);return}let s=Object.create(null);N(s,i,o,e.line),t.push(s)}function L(e,t,n=!1){let r={text:e,pos:0,line:t,workflow:n,depth:0},i=e.startsWith(`{`)?F(r,`}`):e.startsWith(`[`)?F(r,`]`):Ce(r,`block`);if(A(r,De)===null)throw new j(`unexpected ${M(r)} after the value`,t);return i}function Me(e,t){let n={text:e,pos:0,line:t},r=Se(n,`block`),i=n.pos;if(r===void 0||A(n,Ee)===null)return null;if(i>1024)throw new j(`a key longer than 1024 characters is written after "? "`,t);return{key:r,rest:e.slice(n.pos)}}var Ne=2**20,R=128;function z(e){if(e.text.includes(` `))throw new j(`U+0009 is not allowed outside a block scalar`,e.number)}function B(e,t){if(!e.startsWith(`&`))return{anchor:null,rest:e};let n=/^&([^ ,[\]{}]+)(?: +|$)/u.exec(e);if(n===null)throw new j(`expected an anchor's name, found ${E(e)}`,t);let r=e.slice(n[0].length);if(r.startsWith(`*`))throw new j(`an alias with an anchor is not supported`,t);return{anchor:n[1],rest:r}}function Pe(e,t,n){if(/^\*[^ ,[\]{}]+ *:(?: |$)/u.test(t))throw new j(`an alias as a key is not supported`,n);let r=/^\*([^ ,[\]{}]+)(?: +#.*| *)$/u.exec(t);if(r===null)throw new j(`unexpected ${E(t)} after an alias`,n);if(!e.anchors.has(r[1]))throw new j(`unknown alias ${E(`*${r[1]}`)}`,n);return e.aliased=!0,e.anchors.get(r[1])}function Fe(e,t=1){let n=e[0];for(let r=t;r<e.length;r++)if(n===`"`&&e[r]===`\\`)r++;else if(e[r]===n){if(n===`'`&&e[r+1]===`'`)r++;else return r}return-1}function Ie(e,t){let n=/ *$/u.exec(e).index,r=/\\*$/u.exec(e.slice(0,n))[0].length;return t&&r%2==1?n===e.length?{text:e.slice(0,-1),escaped:!0}:{text:e.slice(0,n+1),escaped:!1}:{text:e.slice(0,n),escaped:!1}}function Le(e,t,n){let r=0,i=!1,a=``;for(let[o,s]of e.entries()){let c=o===e.length-1,l=o===0?s:s.replace(/^ +/u,``);if(o>0&&!c&&l===``){r++;continue}if(i&&r>0)throw new j(`an empty line after an escaped line break is not supported`,n);o>0&&(a+=r>0?`
|
|
3
|
+
`.repeat(r):i?``:` `);let u=c?{text:l,escaped:!1}:Ie(l,t);a+=u.text,r=0,i=u.escaped}return a}function Re(e,t,n,r){let i=t[0]===`"`,a=[t.slice(1)],o=[n.number];for(let s=e.line;;s=e.advance()){if(s===void 0||e.isMarker(s))throw new j(`a quoted scalar that does not close`,n.number);z(s),o.push(s.number);let c=Fe(`${t[0]}${s.text}`);if(c===-1){a.push(s.text);continue}if(a.push(s.text.slice(0,c-1)),!/^(?: +#.*| *)$/u.test(s.text.slice(c)))throw new j(`unexpected ${E(s.text.slice(c))} after the value`,s.number);if(e.advance(),i)for(let[e,t]of a.entries())r(t,o[e]);let l=Le(a,i,n.number);return i?r(l,n.number):l.replaceAll(`''`,`'`)}}function ze(e,t,n){if(/(?:^| )#/u.test(t))return t;let r=0,i=t.replace(/ +$/u,``);for(let t=e.line;t!==void 0;t=e.advance()){if(t.text===``){r++;continue}if(t.indent<=n||t.text.startsWith(`#`)||e.isMarker(t))break;if(z(t),i+=`${r>0?`
|
|
4
|
+
`.repeat(r):` `}${t.text.replace(/ +$/u,``)}`,r=0,/ #/u.test(t.text)){e.advance();break}}return i}function Be(e,t,n){let r=n===`plain`;for(let i=0;i<e.length;i++){let a=e[i];if(a!==` `){if((a===`"`||a===`'`)&&n!==`plain`){let t=Fe(e.slice(i));if(t===-1)return{open:-1,kept:e,last:n,comment:!1};i+=t,n=`quoted`}else{if(a===`#`&&(i===0||e[i-1]===` `))return{open:t,kept:e.slice(0,i),last:n,comment:!0};if(a===`[`||a===`{`)t++,n=`open`;else if(a===`]`||a===`}`){if(n=`close`,--t===0)return{open:t,kept:e.slice(0,i+1),after:e.slice(i+1),last:n,comment:!1}}else if(a===`,`||a===`:`&&/^(?:[ ,[\]{}]|$)/u.test(e[i+1]??``)){if(a===`:`&&r)return{open:t,kept:e,last:n,comment:!1,keyed:!0};n=`indicator`}else n=`plain`}r&&=n===`plain`}}return{open:t,kept:e,last:n,comment:!1}}function Ve(e,t,n,r){let i=0,a=!1,o=null,s=!1,c=Be(t,0,null),l=null,u=``;for(let t=n;;){if(c.open===-1)throw new j(`a quoted scalar in a flow collection does not close on its line`,t.number);let d=c.kept.replace(/ +$/u,``);if(d!==``){let e=s&&!/^(?:[,\]}]|:(?:[ ,[\]{}]|$))/u.test(d);if(e&&a)throw new j(`a plain scalar in a flow collection goes on past a comment`,t.number);if(c.keyed||d.startsWith(`:`)&&!e&&(o===`plain`||o===`quoted`))throw new j(`a key over more than one line is not supported`,t.number);if(e&&l!==null&&z(l),e&&t.indent<=r)throw new j(`bad indentation of a plain scalar in a flow collection`,t.number);u!==``&&(u+=e&&i>1?`
|
|
5
|
+
`.repeat(i-1):` `),u+=d,i=0,o=c.last,s=o===`plain`,a=!1,l=null}if(a||=s&&c.comment,c.after!==void 0){if(!/^(?: +#.*| *)$/u.test(c.after))throw new j(`unexpected ${E(c.after)} after the value`,t.number);return t!==n&&e.advance(),u}if(t=t===n?e.line:e.advance(),t===void 0||e.isMarker(t))throw new j(`a flow collection that does not close`,n.number);let f=/^[\t ]*$/u.test(t.text);!f&&!t.text.startsWith(`#`)?z(t):f&&s&&!a&&t.text.includes(` `)&&(l??=t),i++,c=Be(f?``:t.text,c.open,s&&!a?`plain`:null)}}function He(e){let t=new Map,n=(e,r)=>{if(typeof e!=`object`||!e)return{size:1,height:0};if(r>R)throw new j(`aliases nest the document past ${R} levels`);let i=t.get(e);if(i===void 0){i={size:1,height:0};for(let t of Object.values(e)){let e=n(t,r+1);if(i.size+=e.size,i.height=Math.max(i.height,e.height+1),i.size>Ne)throw new j(`aliases expand the document past ${Ne} nodes`)}t.set(e,i)}if(r+i.height>R)throw new j(`aliases nest the document past ${R} levels`);return i};n(e,0)}var Ue=64,We=RegExp(`(?! )${se.source}`,`u`);function Ge(e){if(typeof e!=`object`||!e)throw TypeError(`expected an options object`);let t=Object.keys(e).find(e=>e!==`workflow`&&e!==`lines`);if(t!==void 0)throw TypeError(`unknown option ${t}`);let{workflow:n=!1,lines:r}=e;if(typeof n!=`boolean`)throw TypeError(`expected workflow to be a boolean`);if(r!==void 0&&!(r instanceof WeakMap))throw TypeError(`expected lines to be a WeakMap`);return{workflow:n,lines:r}}var Ke=e=>e.indent===0&&/^(?:---|\.\.\.)(?: |$)/u.test(e.text);function qe(e,t={}){if(typeof e!=`string`)throw TypeError(`expected a string`);let n={text:e,pos:0,number:-1,line:void 0,...Ge(t),anchors:null,aliased:!1};n.workflow&&Object.assign(n,{advance:()=>V(n),isMarker:Ke}),V(n);let r=[];Je(n);do r.push(Ye(n));while(Je(n));return r}function Je(e){return H(e)!==void 0||e.line===void 0?!1:(V(e),!0)}function Ye(e){let t=H(e);if(t===void 0)throw new j(`empty document`,e.line?.number);if(t.indent!==0)throw new j(`the document does not start at column 0`,t.number);e.workflow&&Object.assign(e,{anchors:new Map,aliased:!1});let n=G(e,0,0);if(e.aliased&&He(n),H(e)!==void 0)throw new j(`unexpected content after the document`,e.line.number);if(typeof n!=`object`||!n)throw new j(`the document is a lone scalar, not a mapping or a sequence`,t.number);return n}function V(e){let{text:t,pos:n}=e;if(e.line=void 0,n>=t.length)return;let r=t.indexOf(`
|
|
6
|
+
`,n);r===-1&&(r=t.length),e.pos=r+1;let i=++e.number;if(t[r-1]===`\r`&&r--,r-n>ce)throw new j(`line longer than ${ce} characters`,i);let a=n;for(;t[a]===` `;)a++;let o=t.slice(a,r),s=(e.workflow?We:se).exec(o)?.[0];if(s!==void 0)throw new j(`${ie(s)} is not allowed`,i);return e.line={indent:a-n,text:o,number:i},e.line}function H(e){let t=e.line;for(;t!==void 0&&(t.text===``||t.text[0]===`#`||e.workflow&&/^[\t ]*$/u.test(t.text));)t=V(e);if(t!==void 0&&e.workflow&&z(t),t?.indent!==0||!/^(?:---|\.\.\.(?: |$)|%)/u.test(t.text))return t;if(!/^--- *$/u.test(t.text))throw new j(t.text.startsWith(`---`)?`content on the document marker line`:`document end markers and directives are not supported`,t.number)}var U=e=>/^-(?: |$)/u.test(e.text),W=e=>/^[|>]/u.test(e);function G(e,t,n){let r=H(e);if(n>Ue)throw new j(`nested too deep`,r.number);if(U(r))return Qe(e,t,n);let i=r.text.startsWith(`? `)?void 0:q(e,r);return i===null?(V(e),e.workflow?K(e,r.text,r.indent-1,n,r):L(r.text,r.number)):Ze(e,t,n,i)}function Xe(e,t,n,r){let i;for(i=H(e);i?.indent===t;i=H(e)){if(r?.(i))return;n(i)}if(i?.indent>t)throw new j(`bad indentation`,i.number)}function Ze(e,t,n,r){let i=Object.create(null),a=e.lines&&new Map;e.lines?.set(i,a);let o=r;return Xe(e,t,r=>{if(!r.text.startsWith(`? `)){let s=o??q(e,r);if(o=void 0,s===null)throw new j(`expected a mapping key, found ${E(r.text)}`,r.number);V(e),s.anchor&&e.anchors.set(s.anchor,s.key),N(i,s.key,$e(e,s.rest,t,n,r),r.number),a?.set(s.key,r.number);return}V(e);let s=L(r.text.slice(2),r.number),c=H(e);if(c?.indent!==t||!/^:(?: |$)/u.test(c.text))throw new j(`expected ": " below the explicit key`,(c??r).number);N(i,s,et(e,c,t,n),r.number),a?.set(s,r.number)}),i}function Qe(e,t,n,r=!1){let i=[],a=e.lines&&[];return e.lines?.set(i,a),Xe(e,t,r=>{if(!U(r))throw new j(`expected "- ", found ${E(r.text)}`,r.number);a?.push(r.number),i.push(et(e,r,t,n))},r?e=>!U(e):void 0),i}function $e(e,t,n,r,i){if(e.workflow)return K(e,t,n,r,i);if(W(t))return tt(e,t,n,i);if(t!==``)return L(t,i.number);let a=H(e);if(a?.indent===n&&U(a)&&!U(i))throw new j(`a sequence under a key must be indented`,a.number);if(a===void 0||a.indent<=n)throw new j(`missing value`,i.number);return G(e,a.indent,r+1)}function et(e,t,n,r){let i=/^[-:] *(?:#.*)?/u.exec(t.text)[0].length;if(e.workflow)return at(e,t,n,r,i);let a=t.text.slice(i);return a===``||W(a)?(V(e),$e(e,a,n,r,t)):(e.line={...t,indent:t.indent+i,text:a},G(e,t.indent+i,r+1))}function tt(e,t,n,r){let{folded:i,digit:a,chomp:o}=nt(e,t,r),s=n+Number(a),c=a!==``,l=0,u=``,d=null;for(let t=e.line;t!==void 0&&(t.text===``||t.indent>n);t=V(e)){if(c||(s=Math.max(s,t.indent)),c||=t.text!==``,t.text!==``&&t.indent<s)throw new j(`bad indentation in the block scalar`,t.number);let e=`${` `.repeat(Math.max(t.indent-s,0))}${t.text}`;if(e!==``){let t=/^[\t ]/u.test(e);u+=i?rt(l,d,t):`
|
|
7
|
+
`.repeat(l),u+=e,d=t}l=e===``?l+1:1}return o===`+`?u+`
|
|
8
|
+
`.repeat(l):o===`-`?u:u&&`${u}
|
|
9
|
+
`}function nt(e,t,n){let r=e.workflow?/^([|>])(?:([1-9])([+-]?)|([+-])([1-9]?))?(?: +#.*| *)$/u.exec(t):/^\|([1-9]?)([+-]?)$/u.exec(t);if(r===null)throw new j(`unsupported block scalar ${E(t)}`,n.number);return e.workflow?{folded:r[1]===`>`,digit:r[2]??r[5]??``,chomp:r[3]||r[4]||``}:{folded:!1,digit:r[1],chomp:r[2]}}var rt=(e,t,n)=>t===null||t||n?`
|
|
10
|
+
`.repeat(e):e===1?` `:`
|
|
11
|
+
`.repeat(e-1);function K(e,t,n,r,i){let{anchor:a,rest:o}=B(t,i.number),s=it(e,o.startsWith(`#`)?``:o,n,r,i);return a!==null&&e.anchors.set(a,s),s}function it(e,t,n,r,i){if(t.startsWith(`*`))return Pe(e,t,i.number);if(W(t))return tt(e,t,n,i);if(t.startsWith(`[`)||t.startsWith(`{`))return L(Ve(e,t,i,n),i.number,!0);let a=t.startsWith(`'`)||t.startsWith(`"`);if(a&&Fe(t)===-1)return Re(e,t,i,xe);if(t!==``)return L(a?t:ze(e,t,n),i.number,!0);let o=H(e);return o?.indent===n&&U(o)&&!U(i)?Qe(e,n,r+1,!0):o===void 0||o.indent<=n?null:!U(o)&&!o.text.startsWith(`? `)&&q(e,o)===null?(V(e),K(e,o.text,n,r+1,o)):G(e,o.indent,r+1)}function at(e,t,n,r,i){let a=t.text.slice(i),{anchor:o,rest:s}=B(a,t.number),c=t.indent+i;if(s!==``&&!s.startsWith(`#`)&&(U({text:s})||s.startsWith(`? `))){if(o!==null)throw new j(`an anchor before a block on its own line is not supported`,t.number);return e.line={...t,indent:c,text:s},G(e,c,r+1)}return s!==``&&!s.startsWith(`#`)&&Me(s,t.number)!==null?(e.line={...t,indent:c,text:a},G(e,c,r+1)):(V(e),K(e,a,n,r,t))}function q(e,t){if(!e.workflow||!t.text.startsWith(`&`))return Me(t.text,t.number);let{anchor:n,rest:r}=B(t.text,t.number),i=Me(r,t.number);return i&&{...i,anchor:n}}var ot=`(patch_hash=`;function st(e){let t={start:e.length,peers:e.length};if(!e.endsWith(`)`))return t;let n=1;for(let t=e.length-2;t>=0;t--)if(e[t]===`(`)n--;else if(e[t]===`)`)n++;else if(n===0){if(!e.startsWith(ot,t+1))return{start:t+1,peers:t+1};let n=e.indexOf(`(`,t+2);return{start:t+1,peers:n===-1?e.length:n}}return t}function J(e){if(typeof e!=`string`)throw TypeError(`expected a string`);return e.slice(0,st(e).start)}function ct(e,t,n){let r=[],[i,a]=[0,0];for(let o=0;o<e.length;o++){if(i===0&&(e[o]!==`(`||e[o+1]===`)`||e.startsWith(ot,o)))throw new D(`${O(t)} does not end in peers in parentheses`,n);e[o]===`(`&&i++===0?a=o+1:e[o]===`)`&&--i===0&&r.push(e.slice(a,o))}return r}function lt(e,t){let{start:n,peers:r}=st(e),i;if(n<r){let a=e.slice(n,r);if(i=/^\(patch_hash=([\da-z]+)\)$/u.exec(a)?.[1],i===void 0)throw new D(`${O(a)} is not a patch hash`,t)}return{base:e.slice(0,n),patchHash:i,peers:ct(e.slice(r),e,t)}}var Y=e=>ne(e,{padding:!1}),X=(e,t,n)=>oe(()=>e===e.toLowerCase()&&n(e).length===t,()=>!1);function ut(e,t){let n=e.indexOf(`@`,1);if(n===-1||n===e.length-1)throw new D(`${O(e)} is not a key of the form name@version`,t);if(J(e)!==e)throw new D(`${O(e)} carries a peer or patch suffix, which only a snapshot key does`,t);return{name:w(e.slice(0,n),t),ref:e.slice(n+1)}}var dt=(e,t)=>/^[^:(]*@/u.test(e)?e:`${t}@${e}`;function ft(e,t){let n=b(e,t);if(n.startsWith(`file:`))i(n.slice(5),t);else if(!u(n))throw new D(`${O(n)} is not an http(s) URL or a file: path`,t);return n}var pt=(e,t)=>e===``?`.`:i(e,t),mt=(e,t)=>y(e,`path`,t,(e,t)=>(a(b(e,t).replace(/^\//u,``),t),e));function ht(e,t){p(e,t,[`integrity`,`tarball`,`path`,`gitHosted`]);let{integrity:n,tarball:r}=e;if(n===void 0&&r===void 0)throw new D(`expected an integrity or a tarball`,t);return{type:`tarball`,integrity:y(e,`integrity`,t,l),tarball:y(e,`tarball`,t,ft),path:mt(e,t),gitHosted:C(e.gitHosted,k(t,`gitHosted`))}}function gt(e,t){p(e,t,[`type`,`repo`,`commit`,`path`]);let n=b(e.commit,k(t,`commit`));if(!s(n))throw new D(`${O(n)} is not a full commit hash`,k(t,`commit`));return{type:`git`,repo:c(e.repo,k(t,`repo`)),commit:n,path:mt(e,t)}}function _t(e,t){return p(e,t,[`type`,`directory`]),{type:`directory`,directory:pt(e.directory,k(t,`directory`))}}var vt=new Map([[void 0,ht],[`git`,gt],[`directory`,_t]]);function yt(e,t){let n=p(e,t),r=vt.get(n.type);if(r===void 0)throw new D(`unsupported resolution type, ${f(n.type)}`,k(t,`type`));return r(n,t)}var bt=[`resolution`,`version`,`name`,`engines`,`cpu`,`os`,`libc`,`deprecated`,`hasBin`,`bundledDependencies`,`peerDependencies`,`peerDependenciesMeta`],xt=[`dependencies`,`optionalDependencies`,`optional`,`transitivePeerDependencies`],St=new Set([`bitbucket`,`catalog`,`custom`,`file`,`git`,`github`,`gitlab`,`http`,`https`,`jsr`,`link`,`npm`,`ssh`,`workspace`]);function Ct(e,t,n,r,i){let{type:a,tarball:o}=r,s=o?.startsWith(`file:`);if(T(t)){if(a!==`tarball`||r.integrity===void 0||s||r.gitHosted||r.path!==void 0)throw new D(`expected a registry tarball with an integrity, for the version ${O(t)}`,k(i,`resolution`));if(n.version!==void 0&&n.version!==t)throw new D(`expected the version in the key, ${O(t)}`,k(i,`version`));return o!==void 0&&d(o,e,t,k(k(i,`resolution`),`tarball`)),t}let c=/^([A-Za-z][\w+.-]*):/u.exec(t)?.[1];if(c===void 0)throw new D(`${O(t)} is neither a version nor a source`,i);if(c===`runtime`||!St.has(c)&&T(t.slice(c.length+1)))throw new D(`${O(t)} is from a runtime or a named registry, which is not supported`,i);if(!(c===`file`?t===(a===`directory`?`file:${n.resolution.directory}`:o):a===`git`||a===`tarball`&&o!==void 0&&!s))throw new D(`${O(t)} is not where the resolution says the package comes from`,k(i,`resolution`));if(a===`directory`){if(n.version!==void 0)throw new D(`a directory has no version in the lockfile`,k(i,`version`));return}if(n.version===void 0)throw new D(`expected a version, for a package not from the registry`,i);return te(n.version,k(i,`version`))}var wt=(e,t)=>x(e,t,w);function Tt(e,t,n){p(t,n,bt);let{name:r,ref:i}=ut(e,n);if(t.name!==void 0&&t.name!==r)throw new D(`expected the name in the key, ${O(r)}`,k(n,`name`));let a=yt(t.resolution,k(n,`resolution`)),o=t.bundledDependencies;return{name:r,version:Ct(r,i,t,a,n),resolution:a,engines:ee(v(t.engines),k(n,`engines`)),os:y(t,`os`,n,x),cpu:y(t,`cpu`,n,x),libc:y(t,`libc`,n,x),deprecated:y(t,`deprecated`,n,b),hasBin:C(t.hasBin,k(n,`hasBin`)),bundledDependencies:o===void 0||o===!0?o:wt(o,k(n,`bundledDependencies`)),peerDependencies:ee(v(t.peerDependencies),k(n,`peerDependencies`),w),peerDependenciesMeta:Et(t.peerDependenciesMeta,k(n,`peerDependenciesMeta`))}}var Z=(e,t)=>(n,r)=>S(v(n),r,(n,r,i)=>(p(n,r,e),w(i,r),t(n,r))),Et=Z([`optional`],(e,t)=>({optional:C(e.optional,k(t,`optional`))}));function Dt(e,t,n,r,i){if(e.startsWith(`link:`))return`link:${o(n,pt(e.slice(5),i))}`;let a=dt(e,t);if(!(a in r))throw new D(`${O(e)} leads to ${O(a)}, which is not in snapshots`,i);return a}var Ot=(e,t,n)=>S(v(e),t,(e,t,r)=>{let i=b(e,t);if(i===`link:<root>`||i.startsWith(`link:<root>/`))throw new D(`${O(i)} leads into the package that asks for it, which is not supported`,t);return Dt(i,w(r,t),`.`,n,t)});function kt(e,n,r){return p(e,n,xt),{...t(e,n,(e,t)=>Ot(e,t,r)),optional:C(e.optional,k(n,`optional`)),transitivePeerDependencies:y(e,`transitivePeerDependencies`,n,wt)??[]}}var At=e=>X(e,16,Y)||X(e,16,re);function jt(e){let t=e.indexOf(`@`,1);return t===-1?``:e.slice(0,t)}function Q(e){let t=oe(()=>lt(e),()=>{});if(t===void 0)return;let n=t.patchHash===void 0?t.base:`${t.base}(patch_hash=${t.patchHash})`;if(t.peers.length===1&&At(t.peers[0]))return{unpeered:n,peers:void 0};let r=new Map(t.peers.map(e=>[jt(e),e]));return r.size===t.peers.length?{unpeered:n,peers:r}:void 0}var Mt=32;function Nt(e,t,n,r=0){if(e===t)return!0;let[i,a]=[Q(e),Q(t)];if(r>Mt||i===void 0||a===void 0||i.unpeered!==a.unpeered)return!1;if(i.peers===void 0||a.peers===void 0)return!0;let{dependencies:o,optionalDependencies:s}=n[t];return i.peers.entries().every(([e,t])=>{if(!a.peers.has(e))return!1;let i=o[e]??s[e];return i===void 0?t===a.peers.get(e):!i.startsWith(`link:`)&&Nt(t,i,n,r+1)})}function Pt(e,t,n,r,i,a){if(e.length===0||e.length===1&&At(e[0]))return;let o=new Set,s=new Set;for(let[e,r]of Object.entries({...t.dependencies,...t.optionalDependencies})){if(r.startsWith(`link:`)){s.add(e);continue}o.add(r);let t=n.get(J(r));t!==void 0&&(t.version===void 0?s.add(t.name):o.add(`${t.name}@${t.version}`))}let c=t.transitivePeerDependencies;for(let n of e){let e=jt(n);if(e===``)throw new D(`${O(n)} is not a peer, as pnpm writes one in a key`,a);let l=!n.includes(`(`);if(o.has(n)||l&&s.has(e))continue;let u=l&&c.includes(e)&&!T(n.slice(e.length+1));if(!(c.length>0&&(r().has(n)||u))){if(l)throw Ft(n,a);i.push({group:n,snapshot:t,where:a})}}}var Ft=(e,t)=>new D(`the peer ${O(e)} is not one of its dependencies, nor a peer of theirs it resolves`,t);function It(e,t){let n;for(let{group:r,snapshot:i,where:a}of e){let e=Object.values({...i.dependencies,...i.optionalDependencies}).filter(e=>!e.startsWith(`link:`)),o=Q(r)?.unpeered;if(i.transitivePeerDependencies.includes(jt(r))&&o!==void 0&&(n??=Map.groupBy(Object.keys(t),e=>Q(e)?.unpeered),e.push(...n.get(o)??[])),!e.some(e=>Nt(r,e,t)))throw Ft(r,a)}}function Lt(e,t,n){if(e.version===void 0&&t.keys().some(t=>t.startsWith(`${e.name}@`)))throw new D(`a package of no version in the lockfile, which a patch of a version of ${O(e.name)} may be of`,n);let r=`${e.name}@${e.version}`;return e.version!==void 0&&t.has(r)?r:t.has(e.name)?e.name:void 0}function Rt(e,t,n){let r=new Map,i=new Map,a=k(t,`packages`);for(let[t,n,o]of m(v(e.packages),a)){let e=Tt(t,n,o);r.set(t,e),n.version!==void 0&&t===`${e.name}@${e.version}`&&i.set(t,k(o,`version`))}let o=k(t,`snapshots`),s=p(v(e.snapshots),o),c,l=()=>c??=new Set([...Object.keys(s),...r.keys(),...r.values().map(e=>`${e.name}@${e.version}`)]),u=new Set,d=new Set,f=[],h=S(s,o,(e,t,a)=>{let{base:o,patchHash:c,peers:p}=lt(a,t),m=r.get(o);if(m===void 0)throw new D(`${O(o)} is not in packages`,t);let h=Lt(m,n,t);h!==void 0&&d.add(h);let g=h===void 0?void 0:n.get(h).hash;if(g!==c){let e=h===void 0?`none, as patchedDependencies patches no such package`:`${O(g)}, of patchedDependencies[${O(h)}]`;throw new D(`expected the patch hash ${e}, found ${c===void 0?`none`:O(c)}`,t)}u.add(o),a.includes(`:`)&&i.delete(o);let _=kt(e,t,s);return Pt(p,_,r,l,f,t),{...m,patchHash:c,..._}});It(f,h);let g=r.keys().find(e=>!u.has(e));if(g!==void 0)throw new D(`no snapshot is of this package`,k(a,g));let _=n.keys().find(e=>!d.has(e));if(_!==void 0)throw new D(`patches no package in the lockfile, which pnpm refuses to install with`,k(k(t,`patchedDependencies`),_));let[y]=i.values();if(y!==void 0)throw new D(`a registry package has its version in its key, except where a snapshot of it has a source in its peers`,y);return{packages:h,snapshots:s}}var zt=[...e,`dependenciesMeta`,`publishDirectory`,`linkDirectory`],$=[`configDependencies`,`packageManagerDependencies`];function Bt(e,t,n,r,i){let a=Object.create(null),o={specifiers:a},s=Object.create(null);for(let c of t)o[c]=S(v(e[c]),k(r,c),(e,t,r)=>{if(w(r,t),p(e,t,[`specifier`,`version`]),r in a)throw new D(`listed under ${s[r]} too`,t);a[r]=h(e.specifier,k(t,`specifier`)),s[r]=c;let o=k(t,`version`);return Dt(b(e.version,o),r,n,i,o)});return o}var Vt=Z([`injected`,`node`],(e,t)=>({injected:y(e,`injected`,t,g)??!1,node:y(e,`node`,t,b)}));function Ht(t,n,r,a){if(p(t,r,zt),t.linkDirectory!==void 0&&t.linkDirectory!==!1)throw new D(`expected false, the only value pnpm writes`,k(r,`linkDirectory`));return{...Bt(t,e,n,r,a),dependenciesMeta:Vt(t.dependenciesMeta,k(r,`dependenciesMeta`)),publishDirectory:y(t,`publishDirectory`,r,i),linkDirectory:t.linkDirectory!==!1}}function Ut(e,t,n,r){let a=S(e,t,(e,t,a)=>{if(i(a,t),!r)return Ht(e,a,t,n);if(a!==`.`)throw new D(`the env document has no importer but "."`,t);return p(e,t,$),Bt(e,$,a,t,n)});if(r&&!(`.`in a))throw new D(`expected the "." importer`,t);return a}var Wt=[`lockfileVersion`,`settings`,`catalogs`,`overrides`,`patchedDependencies`,`packageExtensionsChecksum`,`pnpmfileChecksum`,`ignoredOptionalDependencies`,`time`,`importers`,`packages`,`snapshots`],Gt=[`lockfileVersion`,`importers`,`packages`,`snapshots`],Kt={__proto__:null,autoInstallPeers:g,dedupePeers:g,excludeLinksFromLockfile:g,injectWorkspacePackages:g,peersSuffixMaxLength:_},qt=(e,t)=>S(p(v(e),t,Object.keys(Kt)),t,(e,t,n)=>Kt[n](e,t)),Jt=(e,t)=>S(v(e),t,(e,t,n)=>(b(n,t),Z([`specifier`,`version`],(e,t)=>({specifier:h(e.specifier,k(t,`specifier`)),version:b(e.version,k(t,`version`))}))(e,t)));function Yt(e,t){if(e.indexOf(`@`,1)===-1)return w(e,t);if(!T(ut(e,t).ref))throw new D(`${O(e)} is not a name and a version, or a name alone, which is not supported`,t)}var Xt=(e,t)=>S(v(e),t,(e,t,n)=>{let r=typeof e!=`string`;r&&p(e,t,[`hash`,`path`]);let a=r?k(t,`hash`):t,o=b(r?e.hash:e,a);if(!X(o,32,re)&&!X(o,16,Y))throw new D(`${O(o)} is not a patch hash`,a);return Yt(n,t),{hash:o,path:r?i(e.path,k(t,`path`)):void 0}});function Zt(e,t){let n=b(e,t);if(X(n,16,re)||X(n,16,Y))return n;if(!n.startsWith(`sha256-`))throw new D(`${O(n)} is not a checksum`,t);return l(n,t)}var Qt=/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d+)?Z$/u,$t=(e,t,n)=>S(v(e),t,(e,t,r)=>{if(!(r in n))throw new D(`${O(r)} is not in packages`,t);let i=b(e,t),a=Qt.test(i)?Date.parse(i):NaN;if(Number.isNaN(a)||new Date(a).toISOString().slice(0,19)!==i.slice(0,19))throw new D(`${O(i)} is not a UTC timestamp`,t);return i});function en(e,t,r,i){let a=n(Object.values(e).flatMap(e=>i.map(t=>e[t])),t);if(a!==void 0)throw new D(`no importer depends on it, directly or not`,k(k(r,`snapshots`),a))}function tn(e,t,n){let i=r(t,e,n?{required:$,dev:[],optional:[]}:void 0);for(let e of Object.values(t)){let{dev:t,devOptional:n}=i(e);Object.assign(e,{dev:t,devOptional:n})}}function nn(t,n,r){let i=n===``?void 0:n,a=p(t,i).lockfileVersion;if(a!==`9.0`)throw new D(`unsupported version: expected "9.0", found ${f(a)}`,k(n,`lockfileVersion`));p(t,i,r?Gt:Wt);let o=Xt(t.patchedDependencies,k(n,`patchedDependencies`)),{packages:s,snapshots:c}=Rt(t,n,new Map(Object.entries(o))),l=Ut(t.importers,k(n,`importers`),c,r);return en(l,s,n,r?$:e),tn(l,s,r),r?{lockfileVersion:a,importers:l,packages:s}:{lockfileVersion:a,settings:qt(t.settings,k(n,`settings`)),catalogs:Jt(t.catalogs,k(n,`catalogs`)),overrides:ee(v(t.overrides),k(n,`overrides`),b),patchedDependencies:o,packageExtensionsChecksum:y(t,`packageExtensionsChecksum`,n,Zt),pnpmfileChecksum:y(t,`pnpmfileChecksum`,n,Zt),ignoredOptionalDependencies:y(t,`ignoredOptionalDependencies`,n,x)??[],time:$t(t.time,k(n,`time`),v(t.packages)),importers:l,packages:s}}function rn(e){if(typeof e!=`string`)throw TypeError(`expected a string`);let t=/^---\r?\n/u.exec(e)?.[0];if(t===void 0){let t=qe(e);if(t.length!==1)throw new D(`expected one document, found ${t.length}`);return{lockfile:nn(t[0],``,!1),env:void 0}}let n=/\n---\r?\n/gu;n.lastIndex=t.length;let r=n.exec(e);if(r===null)throw new D(`expected the env document the first "---" starts to end at a line of "---"`);let i=/^(?: *\r?\n)* *$/u.test(e.slice(n.lastIndex)),a=qe(i?e.slice(0,r.index+1):e);if(a.length!==(i?1:2))throw new D(`expected the env document${i?``:` and the lockfile`} between lines of "---" alone, found ${a.length} documents`);return{lockfile:i?void 0:nn(a[1],``,!1),env:nn(a[0],`env`,!0)}}export{D as LockfileError,j as YamlError,J as packageKeyOf,rn as parsePnpmLockfile};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-OOJM4CTU.js";var e=(e,t)=>Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)])),t=(...e)=>e.flatMap(e=>Object.values(e)),n=e=>[...new Set(e)];function r(e){let t=Object.keys(e),n=t=>e[t].dependencies.filter(n=>n!==t&&Object.hasOwn(e,n)),r=[],i=new Set;for(let e of t){if(i.has(e))continue;i.add(e);let t=[[e,n(e).values()]];for(;t.length>0;){let[e,a]=t.at(-1),o=a.next();o.done?(r.push(e),t.pop()):i.has(o.value)||(i.add(o.value),t.push([o.value,n(o.value).values()]))}}let a=new Map(t.map(e=>[e,[]]));for(let e of t)for(let t of n(e))a.get(t).push(e);let o=new Map;for(let e of r.toReversed())if(!o.has(e)){o.set(e,e);for(let t=[e];t.length>0;)for(let n of a.get(t.pop()))o.has(n)||(o.set(n,e),t.push(n))}let s=new Set;for(let e of t)for(let t of n(e))o.get(t)!==o.get(e)&&s.add(o.get(t));return{".":{dependencies:t.filter(e=>!s.has(o.get(e)))}}}function i(e,t){let r=new Map(e.map(e=>[e,new Set]));for(let n=!0;n;){n=!1;for(let i of e)for(let{to:e,extras:a}of t(i,r.get(i)))for(let t of e)for(let e of a){let i=r.get(t);i&&!i.has(e)&&(i.add(e),n=!0)}}return new Map(e.map(e=>[e,n(t(e,r.get(e)).flatMap(e=>e.to)).filter(t=>t!==e)]))}function a(e){let t=new Set;return e.map((e,n)=>{let r=e.version===void 0?e.name:`${e.name}==${e.version}`,i=t.has(r)?`${r} (${n})`:r;return t.add(i),i})}var o=e=>e.toLowerCase().replaceAll(/[-_.]+/gu,`-`);function s(e){if(typeof e!=`string`)return null;try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)&&t.workspaces===void 0?t:null}catch{return null}}function c(e,t){if(typeof e!=`string`)return null;try{let r=JSON.parse(e);return n([r?.require,r?.[`require-dev`]].flatMap(e=>e&&typeof e==`object`&&!Array.isArray(e)?Object.keys(e):[]).flatMap(e=>t(e.toLowerCase())))}catch{return null}}var l={async npm(t){let{parseNpmLockfile:n}=await import(`./chunk-TOXMUOIW.js`),r=e=>Object.values(e.edges).map(e=>e.target).filter(e=>e!==void 0),{importers:i,packages:a}=n(t,{checkVersions:!1});return{importers:e(i,e=>({version:e.version,dependencies:r(e)})),packages:e(a,e=>({name:e.name,version:e.version,dependencies:r(e)}))}},async pnpm(n){let{parsePnpmLockfile:r}=await import(`./chunk-WMFDQS2L.js`),{lockfile:i}=r(n);return{importers:e(i?.importers??{},e=>({dependencies:t(e.dependencies,e.devDependencies,e.optionalDependencies)})),packages:e(i?.packages??{},e=>({name:e.name,version:e.version,dependencies:t(e.dependencies,e.optionalDependencies)}))}},async yarn(n,r){if(/^__metadata:/mu.test(n))throw Error(`a yarn.lock of Yarn 2 or later, which is not read`);let{parseYarn1Lockfile:i}=await import(`./chunk-HAZKDK4M.js`),a=s(r),{importers:o,packages:c}=i(n,{checkVersions:!1,...a&&{manifests:{".":a}}}),l=new Map;for(let[e,t]of Object.entries(c))l.has(t)||l.set(t,e);let u=e=>e.startsWith(`link:`)?e:l.get(c[e]);return{importers:e(o??{},e=>({version:a.version,dependencies:t(e.dependencies,e.devDependencies,e.optionalDependencies).map(u)})),packages:Object.fromEntries([...l].map(([e,n])=>[n,{name:/@npm:((?:@[^/@]+\/)?[^/@]+)/u.exec(e.patterns[0]??``)?.[1]??e.name,version:e.version,dependencies:t(e.dependencies,e.optionalDependencies).map(u)}]))}},async bundler(t){let{parseGemfileLock:n}=await import(`./chunk-Y5ZHFNBD.js`),{specs:r,gems:i,dependencies:a}=n(t),o=e=>Object.hasOwn(i,e)?i[e]:[];return{importers:{".":{dependencies:Object.keys(a).flatMap(o)}},packages:e(r,e=>({name:e.name,version:e.platform===`ruby`?e.version:`${e.version}-${e.platform}`,dependencies:Object.keys(e.dependencies).flatMap(o)}))}},async cargo(e){let{parseCargoLock:t}=await import(`./chunk-NXATZJQ2.js`),n=Object.entries(t(e).packages),r=n.filter(([,e])=>e.source===void 0),i=new Map;for(let[,e]of r)i.set(e.name,(i.get(e.name)??0)+1);let a=new Map(r.map(([e,t])=>[e,i.get(t.name)>1?e:t.name])),o=e=>a.has(e)?`link:${a.get(e)}`:e;return{importers:Object.fromEntries(r.map(([e,t])=>[a.get(e),{version:t.version,dependencies:t.dependencies.map(o)}])),packages:Object.fromEntries(n.filter(([e])=>!a.has(e)).map(([e,t])=>[e,{name:t.name,version:t.version,dependencies:t.dependencies.map(o)}]))}},async cocoapods(t){let{parsePodfileLock:r}=await import(`./chunk-M37X4LCF.js`),{pods:i,dependencies:a}=await r(t),o=({name:e})=>Object.hasOwn(i,e)?[e]:[];return{importers:{".":{dependencies:n(a.flatMap(o))}},packages:e(i,e=>({name:e.root,version:e.version,dependencies:n(e.dependencies.flatMap(o))}))}},async composer(t,i){let{parseComposerLock:a}=await import(`./chunk-4ISO5F7Y.js`),o=a(t).packages,s=e(o,e=>({name:e.name,version:e.version,dependencies:n(Object.values(e.require).flatMap(e=>e.targets))})),l=new Map;for(let[e,t]of Object.entries(o))for(let n of[...Object.keys(t.provide),...Object.keys(t.replace)])l.set(n,[...l.get(n)??[],e]);let u=c(i,e=>Object.hasOwn(s,e)?[e]:l.get(e)??[]);return{importers:u?{".":{dependencies:u}}:r(s),packages:s}},async poetry(e){let{parsePoetryLock:t}=await import(`./chunk-4XIH7YTX.js`),s=t(e).packages,c=a(s),l=Map.groupBy(c,(e,t)=>o(s[t].name)),u=new Map(c.map((e,t)=>[e,s[t]])),d=i(c,(e,t)=>{let r=u.get(e),i=new Set([...t].flatMap(e=>(r.extras[e]??[]).map(e=>o(/^[\w.-]+/u.exec(e)?.[0]??``))));return Object.entries(r.dependencies).filter(([e,t])=>t.some(e=>!e.optional)||i.has(o(e))).map(([e,t])=>({to:l.get(o(e))??[],extras:n(t.flatMap(e=>e.extras))}))}),f=Object.fromEntries(c.map((e,t)=>[e,{name:s[t].name,version:s[t].version,dependencies:d.get(e)}]));return{importers:r(f),packages:f}},async uv(e){let{parseUvLock:t}=await import(`./chunk-RRBIJL2B.js`),{packages:n,members:a}=t(e),o=new Map(a.map(e=>[e,n[e].source.path??e])),s=Object.keys(n),c=i(s,(e,t)=>{let r=n[e],i=o.has(e)?[...Object.values(r.optionalDependencies),...Object.values(r.devDependencies)].flat():[...t].flatMap(e=>r.optionalDependencies[e]??[]);return[...r.dependencies,...i].map(e=>({to:[e.package],extras:e.extras}))}),l=e=>o.has(e)?`link:${o.get(e)}`:e,u=Object.fromEntries(s.filter(e=>!o.has(e)).map(e=>[e,{name:n[e].name,version:n[e].version,dependencies:c.get(e).map(l)}])),d=Object.fromEntries(a.map(e=>[o.get(e),{version:n[e].version,dependencies:c.get(e).map(l)}]));return{importers:a.length>0?d:r(u),packages:u}},async pylock(e){let{parsePylock:t}=await import(`./chunk-YF4M5OCI.js`),i=t(e).packages,o=a(i),s=Object.fromEntries(o.map((e,t)=>[e,{name:i[t].name,version:i[t].version,dependencies:n(i[t].dependencies.map(e=>o[e]))}]));return{importers:r(s),packages:s}},async soldeer(e){let{parseSoldeerLockfile:t}=await import(`./chunk-VRX2APNA.js`),n=Object.fromEntries(Object.values(t(e).dependencies).map(e=>[`${e.name}@${e.version}`,{name:e.name,version:e.version,dependencies:[]}]));return{importers:{".":{dependencies:Object.keys(n)}},packages:n}},async foundry(e){let{parseFoundryLockfile:t}=await import(`./chunk-QMVOEBWC.js`),n=Object.fromEntries(Object.entries(t(e).dependencies).map(([e,t])=>[e,{name:e.slice(e.lastIndexOf(`/`)+1),version:t.type===`tag`?t.name:t.type===`branch`?`${t.name}@${t.rev.slice(0,7)}`:t.rev.slice(0,12),dependencies:[]}]));return{importers:{".":{dependencies:Object.keys(n)}},packages:n}}};async function u(e,t,{manifest:n}={}){if(!Object.hasOwn(l,e))throw TypeError(`readLockfile: ${e} lockfiles are not read`);return await l[e](t,n)}export{u as readLockfile};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,b as t,c as n,d as r,e as i,f as a}from"./chunk-G3LY2FV4.js";import{a as o}from"./chunk-4EMM6UCD.js";import{C as s,H as c,K as l,L as u,Q as d,m as f}from"./chunk-UCP3JRE2.js";import"./chunk-ZQHLECTI.js";import"./chunk-PXK7EU4V.js";import{d as p,h as m,i as h,j as g,k as ee,p as te,r as ne,s as _}from"./chunk-JMG5DXII.js";import"./chunk-OOJM4CTU.js";var re=e=>/^[A-Za-z\d][\w.-]*$/u.test(e)&&/[A-Za-z]/u.test(e);function ie(e){let t=e.split(`-`);for(;t.at(-1)===``;)t.pop();return t}var v=()=>{},ae={3:[[/aix(\d+)?/u,`aix`],[/cygwin/u,`cygwin`,v],[/darwin(\d+)?/u,`darwin`],[/^macruby$/u,`macruby`,v],[/freebsd(\d+)?/u,`freebsd`],[/^(?:java|jruby)$/u,`java`,v],[/^java([\d.]*)/u,`java`],[/^dalvik(\d+)?$/u,`dalvik`],[/^dotnet$/u,`dotnet`,v],[/^dotnet([\d.]*)/u,`dotnet`],[/linux-?(\w+)?/u,`linux`],[/mingw32/u,`mingw32`,v],[/mingw-?(\w+)?/u,`mingw`],[/(mswin\d+)(_(\d+))?/u,void 0,e=>e[3]],[/netbsdelf/u,`netbsdelf`,v],[/openbsd(\d+\.\d+)?/u,`openbsd`],[/solaris(\d+\.\d+)?/u,`solaris`],[/wasi/u,`wasi`,v],[/^(\w+_platform)(\d+)?/u,void 0,e=>e[2]]],4:[[/aix-?(\d+)?/u,`aix`],[/cygwin/u,`cygwin`,v],[/darwin-?(\d+)?/u,`darwin`],[/^macruby$/u,`macruby`,v],[/^macruby-?(\d+(?:\.\d+)*)?/u,`macruby`],[/freebsd-?(\d+)?/u,`freebsd`],[/^(?:java|jruby)$/u,`java`,v],[/^java-?(\d+(?:\.\d+)*)?/u,`java`],[/^dalvik-?(\d+)?$/u,`dalvik`],[/^dotnet$/u,`dotnet`,v],[/^dotnet-?(\d+(?:\.\d+)*)?/u,`dotnet`],[/linux-?(\w+)?/u,`linux`],[/mingw32/u,`mingw32`,v],[/mingw-?(\w+)?/u,`mingw`],[/(mswin\d+)(?:[_-](\d+))?/u,void 0,e=>e[2]],[/netbsdelf/u,`netbsdelf`,v],[/openbsd-?(\d+\.\d+)?/u,`openbsd`],[/solaris-?(\d+\.\d+)?/u,`solaris`],[/wasi/u,`wasi`,v],[/^(\w+_platform)-?(\d+)?/u,void 0,e=>e[2]]]};function oe(e,t){if(e===void 0)return[`unknown`,void 0,void 0];for(let[n,r,i=e=>e[1]]of ae[t]){let t=n.exec(e);if(t===null)continue;let a=r??t[1];return[a,i(t),/^mswin\d*32$/u.test(a)?`x86`:void 0]}return[`unknown`,void 0,void 0]}function y(e){let t=ie(e);if(t.length>2&&!/\d$/u.test(t.at(-1))){let e=t.pop();t[t.length-1]+=`-${e}`}let n=t.shift();return t.length===2&&/^\d+(?:\.\d+)?$/u.test(t[1])?{cpu:n,os:t[0],version:t[1]}:{cpu:n,os:t[0]}}function b(e){let t=e.length;for(;e[t-1]===`-`;)t--;let n=e.slice(0,t),r=n.indexOf(`-`);return r===-1?{cpu:n||void 0}:{cpu:n.slice(0,r),os:n.slice(r+1)}}function x(e,t){let{cpu:n,os:r,version:i}=t===3?y(e):b(e),a=n!==void 0&&/i\d86/u.test(n)?`x86`:n;if(i!==void 0)return[a,r,i];let[o,s,c]=oe(r??n,t);return[r===void 0?c:a,o,s]}function S(e,t){let n=x(e,t);return n.filter(e=>e!==void 0).join(t===4&&n[0]===void 0?``:`-`)}var C=e=>e!==`ruby`&&e!==`current`&&/^[\w.-]+$/u.test(e)&&S(e,3)===e&&S(e,4)===e;function w(e){let t=e?.replace(/^gnu/u,``).replace(/eabi(?:hf)?$/u,``);return t===``?void 0:t}var T=Symbol(`all`),E=Symbol(`arm`);function se(e){let t=new Map;for(let n of e){if(n===`ruby`)continue;let[e,r,i]=x(n,3),a=t.get(r)??t.set(r,new Map).get(r);for(let t of[e,T,...e?.startsWith(`arm`)?[E]:[]]){let e=a.get(t)??a.set(t,{versions:new Set,libcs:new Set}).get(t);e.versions.add(i),e.libcs.add(w(i))}}return t}function ce(e,t,n){return e===void 0?!1:n===void 0||e.versions.has(void 0)||e.versions.has(n)?!0:t===`linux`&&(e.libcs.has(w(n))||[`musl`,`musleabi`,`musleabihf`].some(t=>e.versions.has(`${t}${n}`)))}function le(e,t){if(t===`java`||t===`mswin64`)return[void 0,t];if(t===`mswin32`&&e===`x86`)return[e,t];if(t===`mingw32`)return[e===`universal`||e===`x64`?e:e===`x86_64`?`x64`:`x86`,t]}function D(e,t,n,r){let i=e.get(n),a=t===void 0||t===`universal`?[T]:[t,void 0,`universal`,...t===`arm`?[E]:[]];return i!==void 0&&a.some(e=>ce(i.get(e),n,r))?!0:n.startsWith(`mingw`)&&[`mingw`,`mingw32`].some(n=>e.get(n)?.has(t===`universal`?T:`universal`))}function ue(e,t){let[n,r,i]=x(t,3),a=le(n,r);return D(e,n,r,i)||a!==void 0&&D(e,...a,void 0)}var de={GIT:{order:[`remote`,`revision`,`ref`,`branch`,`tag`,`submodules`,`glob`],required:2},PATH:{order:[`remote`,`glob`],required:1},GEM:{order:[`remote`],required:0}},fe=`{,*,*/*}.gemspec`;function pe({type:e,number:t,options:n}){let{order:r,required:i}=de[e],a=Object.create(null),o=0;for(let{key:t,value:i,number:s}of n){let n=r.indexOf(t);if(n===-1)throw g(`${m(t)} is not an option Bundler writes for a ${e} source`,s);if(t in a)throw g(e===`GEM`?`a second remote: Bundler fetches each gem of the source from either, and the lockfile does not say which`:`a second ${t}`,s);if(n<o)throw g(`${t} after ${r[o-1]}, where Bundler writes it before`,s);if(i.trim()!==i)throw g(`${m(i)} has a space at an end, which no ${t} Bundler writes has`,s);o=n+1,a[t]=i}let s=r.slice(0,i).find(e=>!(e in a));if(s!==void 0)throw g(`a ${e} source without its ${s}`,t);return a}var O=/\\|(?:^|[/{,])\.\.(?=$|[/},])|(?:^|[{,])(?:\/|[A-Za-z]:)/u;function k(e,t){if(e===fe)throw new p(`${m(e)}, which Bundler reads by where none is written, and does not write`,t);if(e!==void 0&&O.test(e))throw new p(`${m(e)} reaches out of the source, which Bundler globs its gemspecs from`,t);return e}function A(e,t){let{remote:n}=e;if(n.endsWith(`/`))throw new p(`${m(n)} ends in "/", which Bundler 2.4 and later drop as they read it, and 2.2 and 2.3 keep`,h(t,`remote`));u(n,h(t,`remote`));let{revision:r,ref:i}=e;if(!c(r))throw new p(`${m(r)} is not a full commit hash`,h(t,`revision`));if(i!==void 0&&/\s/u.test(i))throw new p(`${m(i)} is not a reference git reads`,h(t,`ref`));if(i?.startsWith(`-`))throw new p(`${m(i)} starts with "-", which git reads as an option`,h(t,`ref`));if(i!==void 0&&c(i)&&i!==r)throw new p(`the commit ${i}, and the revision another`,h(t,`ref`));if(e.submodules!==void 0&&e.submodules!==`true`)throw new p(`expected "true", found ${m(e.submodules)}`,h(t,`submodules`));return{type:`git`,remote:n,revision:r,ref:i,branch:f(e,`branch`,t,l),tag:f(e,`tag`,t,l),submodules:e.submodules===`true`,glob:k(e.glob,h(t,`glob`))}}function j(e,t){let n=h(t,`path`);if(e.remote.startsWith(`/`))throw new p(`${m(e.remote)} is an absolute path, which is the path on one machine alone`,n);if(e.remote.startsWith(`~`))throw new p(`${m(e.remote)} is a path from a home directory, which Bundler writes from the lockfile's`,n);return{type:`path`,path:s(e.remote,n),glob:k(e.glob,h(t,`glob`))}}function M(e){let t=URL.parse(e);return t!==null&&t.href===e&&(t.protocol===`file:`?t.host===``:t.protocol===`s3:`&&t.host!==``)}function N(e,t){let{remote:n}=e;if(n===void 0)return{type:`gem`,remote:n};if(!d(n)&&!M(n))throw new p(`${m(n)} is not an http(s) URL, or a file: or s3: URL in normal form`,h(t,`remote`));if(!n.endsWith(`/`))throw new p(`${m(n)} does not end in "/", as Bundler writes a source`,h(t,`remote`));return{type:`gem`,remote:n}}var P={GIT:A,PATH:j,GEM:N};function F(e){if(e.type===`gem`)return;if(e.type===`path`)return`source at \`${e.path}\``;let t=/^([A-Za-z][\w+.-]*):\/\/([^/]*)/u.exec(e.remote);return t!==null&&(/[A-Z]/u.test(t[1])||t[2].includes(`@`))?void 0:`${e.remote} (`}var I=e=>`the ${e.type} source ${m(e.remote??e.path)}`;function L(e,t){let n;for(let[r,i]of e.entries()){let e=F(i);if(e!==void 0){if(n!==void 0&&o(e,n.key)<0)throw g(`${I(i)} after ${I(n.source)}, where Bundler sorts them the other way`,t[r].number);n={key:e,source:i}}}}function R(e,t){let n=e.findIndex(e=>e.type===`gem`);if(n===-1)throw new p(`no GEM source, which Bundler always writes`);let r=e[n].remote===void 0,i=e.findIndex((e,t)=>t>n&&e.type===`gem`&&e.remote===void 0);if(i!==-1)throw g(r?`a second GEM source of no remote, where Bundler writes one, the Gemfile's own`:`a GEM source of no remote after one of a remote, where Bundler writes it first`,t[i].number);return r?n:-1}function z(e){let t=e.map((e,t)=>P[e.type](pe(e),`sources[${t}]`));return L(t,e),{sources:t,local:R(t,e)}}var B=/<<<<<<<|=======|>>>>>>>|\|{7}/u,me=new Set([`GIT`,`PATH`,`GEM`]),V={PLATFORMS:[2],DEPENDENCIES:[2],CHECKSUMS:[2],"RUBY VERSION":[2,3],"BUNDLED WITH":[2,3]},H=Object.keys(V);function U(e,t,n){let r=te(e);if(!t.includes(r))throw g(`expected ${t.join(` or `)} spaces of indentation, found ${r}`,n);return e.slice(r)}var he=/^([^\s()]+) \(([^\s()]+)\)(?: (\S+))?$/u;function W(e,t,n){let r=he.exec(e);if(r===null||!n&&r[3]!==void 0)throw g(`expected a gem as "name (version)", found ${m(e)}`,t);let[,i,a,o]=r,s=a.indexOf(`-`);return{name:i,version:s===-1?a:a.slice(0,s),platform:s===-1?void 0:a.slice(s+1),checksum:o,number:t}}var ge=/^([^\s()!]+)(?: \(([^()]+)\))?(!)?$/u;function G(e,t,n){let r=ge.exec(e);if(r===null||!n&&r[3]!==void 0)throw g(`expected a dependency as "name" or "name (requirement)", found ${m(e)}`,t);return{name:r[1],requirements:r[2]?.split(`, `)??[],pinned:r[3]!==void 0}}var _e=/^ {2}([a-z]+): (.+)$/u;function ve(e){let{line:t,number:n}=e,r=[];for(_(e);;_(e)){let t=_e.exec(e.line??``);if(t===null)break;r.push({key:t[1],value:t[2],number:e.number})}if(e.line!==` specs:`)throw g(`expected an option, "key: value", or "specs:", two spaces in, found ${e.line===void 0?`the end of the file`:m(e.line)}`,e.number);let i=[];for(_(e);e.line?.startsWith(` `);_(e)){let t=U(e.line,[4,6],e.number);if(e.line.length-t.length===4){i.push({...W(t,e.number,!1),dependencies:[]});continue}if(i.length===0)throw g(`a dependency before any spec`,e.number);i.at(-1).dependencies.push(G(t,e.number,!1))}return{type:t,number:n,options:r,specs:i}}function ye(e,t){let n=[];for(_(e);e.line?.startsWith(` `);_(e)){let r=U(e.line,t,e.number);n.push({text:r,indent:e.line.length-r.length,number:e.number})}return n}function be(e){let[t,n]=[`RUBY VERSION`,`BUNDLED WITH`].map(t=>e.get(t)?.lines[0]);if(t!==void 0&&n!==void 0&&t.indent!==n.indent)throw g(`${t.indent} spaces of indentation, and ${n.indent} under BUNDLED WITH`,t.number)}function xe(e){let t=B.exec(e)?.[0];if(t!==void 0)throw new p(`${m(t)}, which Bundler reads as a merge conflict`);if(e===``)throw new p(`an empty lockfile, which Bundler reads as none`);if(!e.endsWith(`
|
|
2
|
+
`))throw new p(`no line end after the last line, where Bundler ends every line`);let n=ne(e,ee),r=[],i=new Map,a;for(_(n);n.line!==void 0;){let{line:e,number:t}=n;if(e===``||e.startsWith(` `))throw g(e===``?`a blank line, where Bundler writes one between sections alone`:`expected a section, at column 0`,t);if(e===`PLUGIN SOURCE`)throw g(`a plugin source, which only its plugin can read, and which is not read here`,t);if(me.has(e)){if(a!==void 0)throw g(`a ${e} source after ${a}, where Bundler writes the sources first`,t);if(e!==`GEM`&&r.at(-1)?.type===`GEM`)throw g(`a ${e} source after a GEM one, where Bundler writes the GEM sources last`,t);r.push(ve(n))}else{let r=H.indexOf(e);if(r===-1)throw g(`${m(e)} is not a section Bundler writes`,t);if(i.has(e))throw g(`a second ${e}`,t);if(r<H.indexOf(a))throw g(`${e} after ${a}, where Bundler writes it before`,t);a=e,i.set(e,{number:t,lines:ye(n,V[e])})}if(n.line===void 0)break;if(n.line!==``)throw g(`expected a blank line before ${m(n.line)}`,n.number);if(_(n),n.line===void 0)throw g(`a blank line at the end, where Bundler writes none`,n.number)}return be(i),{sources:r,sections:i}}function K(e,t){if(!re(e))throw new p(`${m(e)} is not a gem name`,t);return e}var q=({name:e,version:t,platform:n=`ruby`})=>n===`ruby`?`${e}-${t}`:`${e}-${t}-${n}`;function J({name:t,version:n,platform:r},i){if(K(t,i),!e(n))throw new p(`${m(n)} is not a version as RubyGems writes one`,i);if(r===`ruby`)throw new p(`the platform ruby, which Bundler leaves out of a gem of no platform`,i);if(r!==void 0&&!C(r))throw new p(`${m(r)} is not a platform as RubyGems writes one`,i);return{name:t,version:n,platform:r??`ruby`}}function Se(e,r){for(let[t,i]of e.entries()){if(n(i)===void 0)throw new p(`${m(i)} is not a requirement as Bundler writes one, "op version"`,r);if(t>0&&i>e[t-1])throw new p(`${m(i)} after ${m(e[t-1])}, where Bundler sorts them backwards`,r)}let[i]=e;if(e.length===1&&i.startsWith(`>= `)&&t(i.slice(3),`0`)===0)throw new p(`${m(i)}, which Bundler leaves out, as any version`,r);return e}function Y(e,t,n,r=e=>e){let i=Object.create(null),a;for(let o of e){let e=h(t,o.name);if(K(o.name,e),a!==void 0&&o.name<=a)throw new p(`${o.name===a?`listed twice`:`after ${m(a)}`}, where Bundler sorts ${n} by name`,e);a=o.name,i[o.name]=r(Se(o.requirements,e),o)}return i}function Ce(e,t){let n=Object.create(null);for(let[r,{specs:i}]of e.entries()){let e;for(let a of i){let i=q(a),o=h(`specs`,i),{name:s,version:c,platform:l}=J(a,o);if(s===`bundler`)throw new p(`Bundler itself, which Bundler leaves out of the sources`,o);if(i in n)throw new p(`listed twice, of which Bundler keeps the last alone, at line ${a.number+1}`,o);if(e!==void 0&&i<e)throw new p(`after ${m(e)}, where Bundler sorts a source's gems by full name`,o);if(e=i,r===t)throw new p(`from sources[${r}], which has no remote: Bundler takes it from the gems installed where it runs`,o);n[i]={name:s,version:c,platform:l,source:r,dependencies:Y(a.dependencies,h(o,`dependencies`),`a gem's dependencies`),checksum:void 0}}}return n}var we=/^sha256=[\da-f]{64}$/u;function X(e,t){if(!we.test(e))throw new p(`${m(e)} is not a checksum as Bundler writes one, "sha256=" and the hex digest`,t);return e}function Te(e,t,n){let r,i,a=new Set;for(let{text:o,number:s}of e){if(i!==void 0&&o<=i)throw g(`${m(o)} after ${m(i)}, where Bundler sorts the checksums, each once`,s);i=o;let e=W(o,s,!0);if(e.name===`bundler`&&e.platform===void 0&&r===void 0){let{version:t}=J(e,`bundlerChecksum`);if(e.checksum===void 0)throw g(`Bundler itself, without the checksum Bundler writes it with`,s);r={version:t,checksum:X(e.checksum,h(`bundlerChecksum`,`checksum`))};continue}let c=q(e),l=m(o.split(` `,2).join(` `));if(!(c in t))throw g(`${l} is no gem of the sources`,s);if(a.has(c))throw g(`${l} a second time, where Bundler lists each gem once`,s);a.add(c);let u=t[c];if(e.checksum===void 0)continue;let d=h(h(`specs`,c),`checksum`);if(n[u.source].type!==`gem`)throw new p(`a checksum of a gem from a ${n[u.source].type} source, which has no .gem to check`,d);u.checksum=X(e.checksum,d)}let o=Object.keys(t).find(e=>!a.has(e));if(o!==void 0)throw new p(`not in CHECKSUMS, where Bundler lists every gem`,h(`specs`,o));return r}function Z(e,t){let n=e.get(t);if(n===void 0)throw new p(`no ${t}, which Bundler always writes`);return n}function Ee(e){let t=e.lines.map(({text:e})=>e);if(t.length===0)throw g(`no platform under PLATFORMS`,e.number);for(let[e,n]of t.entries()){let r=`platforms[${e}]`;if(n!==`ruby`&&!C(n))throw new p(`${m(n)} is not a platform as RubyGems writes one`,r);if(e>0&&n<=t[e-1])throw new p(`${m(n)} after ${m(t[e-1])}, where Bundler sorts the platforms, each once`,r)}return t}function De(e,t){let n=se(t);for(let[t,{platform:r}]of Object.entries(e))if(r!==`ruby`&&!ue(n,r))throw new p(`of the platform ${m(r)}, which no platform of PLATFORMS takes, where Bundler locks a gem for one`,h(`specs`,t))}function Oe(e){return Y(e.lines.map(({text:e,number:t})=>G(e,t,!0)),`dependencies`,`the dependencies`,(e,{pinned:t})=>({requirements:e,pinned:t}))}var ke=/^ruby \d+\.\d+\.\d+(?:\.[\dA-Za-z]+)*(?:p(?:-1|0|[1-9]\d*))?(?: \((?!ruby )[\w.-]+ [\w.-]+\))?$/u;function Ae(e,t){if(e.lines.length!==1)throw g(`expected one line under ${t}, found ${e.lines.length}`,e.number);return e.lines[0].text}var je=/^(?:2\.[2-7]|4\.0)\./u;function Q(t){let[n,r]=[`RUBY VERSION`,`BUNDLED WITH`].map(e=>t.has(e)?Ae(t.get(e),e):void 0);if(n!==void 0&&!ke.test(n))throw new p(`${m(n)} is not a Ruby as Bundler writes one, "ruby 3.3.6p108"`,`rubyVersion`);if(r!==void 0&&!e(r))throw new p(`${m(r)} is not a version as RubyGems writes one`,`bundledWith`);if(r!==void 0&&!je.test(r))throw new p(`${m(r)} is not a version of Bundler from 2.2 to 4.0, which this reader reads`,`bundledWith`);return{rubyVersion:n,bundledWith:r}}function Me(e){let t=Object.create(null),n=new Map;for(let[r,i]of Object.entries(e)){let a=t[i.name]??=[],[o]=a;if(o!==void 0&&e[o].source!==i.source)throw new p(`from sources[${i.source}], and ${m(o)} from sources[${e[o].source}], where Bundler takes a gem from one source`,h(`specs`,r));let s=n.get(`${i.name} ${i.platform}`);if(s!==void 0)throw new p(`for the platform of ${m(s)}, where Bundler locks one version of a gem for each`,h(`specs`,r));n.set(`${i.name} ${i.platform}`,r),a.push(r)}return t}function Ne({specs:e,gems:t,dependencies:n,sources:r,local:i}){let a;for(let[o,{pinned:s}]of Object.entries(n)){if(s||t[o]===void 0)continue;let n=h(`dependencies`,o),c=e[t[o][0]].source,{type:l}=r[c];if(l===`git`)throw new p(`from a git source, without the "!" Bundler writes of it`,n);if(l===`gem`&&i!==-1)throw new p(`from sources[${c}], where Bundler takes what the Gemfile names no source of from its default, sources[${i}], of no remote`,n);if(a??={name:o,index:c},c!==a.index)throw new p(`from sources[${c}], and ${m(a.name)} from sources[${a.index}], where Bundler takes what the Gemfile names no source of from its default alone`,n)}}function $(e,t,{specs:i,gems:o,versions:s},c){let l=s.get(e);if(!(l===void 0||t.every(e=>a(l,n(e)))))for(let a of o[e]){let e=t.find(e=>!r(i[a].version,n(e)));if(e!==void 0)throw new p(`${m(e)} is not met by ${m(a)}`,c)}}function Pe({specs:e,gems:t,dependencies:n}){let r={specs:e,gems:t,versions:new Map(Object.entries(t).map(([t,n])=>[t,i(n.map(t=>e[t].version))]))},a=new Set,o=[],s=e=>{e in t&&!a.has(e)&&o.push(e),a.add(e)};for(let[e,{requirements:t}]of Object.entries(n))$(e,t,r,h(`dependencies`,e)),s(e);for(;o.length>0;)for(let n of t[o.pop()]){let i=h(h(`specs`,n),`dependencies`);for(let[a,o]of Object.entries(e[n].dependencies)){let e=h(i,a);if(a!==`bundler`&&!(a in t))throw new p(`names no gem of the sources`,e);$(a,o,r,e),s(a)}}let c=Object.keys(t).find(e=>!a.has(e));if(c!==void 0)throw new p(`nothing depends on it, and Bundler locks what it resolves alone`,h(`specs`,t[c][0]))}function Fe(e){if(typeof e!=`string`)throw TypeError(`expected a string`);let{sources:t,sections:n}=xe(e),{sources:r,local:i}=z(t),a=Ce(t,i),o=Ee(Z(n,`PLATFORMS`));De(a,o);let s=Oe(Z(n,`DEPENDENCIES`)),c=Me(a);Ne({sources:r,local:i,specs:a,gems:c,dependencies:s}),Pe({specs:a,gems:c,dependencies:s});let l=n.get(`CHECKSUMS`),u=l===void 0?void 0:Te(l.lines,a,r);return{sources:r,specs:a,gems:c,platforms:o,dependencies:s,checksums:l!==void 0,bundlerChecksum:u,...Q(n)}}export{p as LockfileError,Fe as parseGemfileLock};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,b as t,c as n,e as r,g as i,h as a,i as o,k as s,l as c,m as l,n as u,p as d,q as f,r as p,s as m}from"./chunk-JFL7WLRV.js";import{b as h,c as g,d as _,e as v,f as y,g as b,h as x,i as S,k as C,l as w}from"./chunk-JOXLZXMI.js";import{H as T,M as E,m as D}from"./chunk-UCP3JRE2.js";import"./chunk-ZQHLECTI.js";import"./chunk-PXK7EU4V.js";import{a as O,b as k,d as ee,e as A,g as j}from"./chunk-E3LFSUDJ.js";import{d as M,h as N,i as P}from"./chunk-JMG5DXII.js";import"./chunk-OOJM4CTU.js";var F=[`https:`,`http:`,`file:`];function I(e,t,n=F){let r=URL.parse(S(e,t));if(r===null||n!==null&&!n.includes(r.protocol))throw new M(`${N(e)} is not a URL${n===null?``:` of ${n.map(e=>e.slice(0,-1)).join(`, `)}`}`,t);return r}function L(e,t){let n=Object.create(null);for(let[r,i,a]of _(e,t)){if(!(r in l))throw new M(`${N(r)} is not a hash algorithm of hashlib's this reader knows`,a);n[r]=u(r,y(i,a),l[r],a)}if(Object.keys(n).length===0)throw new M(`expected a hash at least`,t);return n}function R(e,t){if(!(e instanceof k))throw h(`a date-time`,e,t);if(!/(?:Z|[+-]00:00)$/u.test(e.text))throw new M(`${e.text} is not in UTC`,t);return e.text}function z(e,t,n){if(g(e,t,[`url`,`path`,`size`,`upload-time`,`hashes`,...n]),e.url===void 0&&e.path===void 0)throw new M(`expected a url or a path`,t);let r=D(e,`url`,t,I);return{file:{url:e.url,path:D(e,`path`,t,f),size:D(e,`size`,t,x),uploadTime:D(e,`upload-time`,t,R),hashes:L(e.hashes,P(t,`hashes`))},pathname:r?.pathname}}function B(t,n,r,i){let a=D(t,`name`,n,S),{file:o,pathname:l}=z(t,n,[`name`]),u=m({name:a,path:o.path,pathname:l});if(u===void 0)throw new M(`${N(o.url)} names no file`,n);let d=i?s(u):c(u);if(d===void 0)throw new M(`${N(u)} is not the name of ${i?`a wheel`:`an sdist, .tar.gz or .zip`}`,n);if(d.name!==r.name)throw new M(`${N(u)} is not a file of ${N(r.name)}`,n);if(r.versionKey!==void 0&&e(d.version)!==r.versionKey)throw new M(`${N(u)} is not of version ${N(r.version)}`,n);return{name:u,...o}}var V=(e,t,n)=>e===void 0?void 0:B(e,t,n,!1);function H(e,t,n){if(e===void 0)return[];let r=new Set;return C((e,t)=>{let i=B(e,t,n,!0);if(r.has(i.name))throw new M(`${N(i.name)} is listed twice`,t);return r.add(i.name),i})(e,t)}var U=(e,t)=>({...z(e,t,[`subdirectory`]).file,subdirectory:D(e,`subdirectory`,t,p)});function W(e,t){return g(e,t,[`path`,`editable`,`subdirectory`]),{path:f(e.path,P(t,`path`)),editable:D(e,`editable`,t,b)??!1,subdirectory:D(e,`subdirectory`,t,p)}}var G=new Set([`git`,`hg`,`bzr`,`svn`]);function K(e,t){g(e,t,[`type`,`url`,`path`,`requested-revision`,`commit-id`,`subdirectory`]);let n=S(e.type,P(t,`type`));if(!G.has(n))throw new M(`expected one of ${[...G].join(`, `)}`,P(t,`type`));if(e.url===void 0&&e.path===void 0)throw new M(`expected a url or a path`,t);let r=S(e[`commit-id`],P(t,`commit-id`));if((n===`git`||n===`hg`)&&!T(r))throw new M(`${N(r)} is not a full commit hash, which the spec requires`,P(t,`commit-id`));return{type:n,url:D(e,`url`,t,(e,t)=>I(e,t,null)&&E(e,t)),path:D(e,`path`,t,f),requestedRevision:D(e,`requested-revision`,t,S),commitId:r,subdirectory:D(e,`subdirectory`,t,p)}}var q=C((e,t)=>(S(g(e,t).kind,P(t,`kind`)),e)),J=[`lock-version`,`environments`,`requires-python`,`extras`,`dependency-groups`,`default-groups`,`created-by`,`packages`,`tool`],Y=[`name`,`version`,`marker`,`requires-python`,`dependencies`,`vcs`,`directory`,`archive`,`index`,`sdist`,`wheels`,`attestation-identities`,`tool`];function X(e,t){if(!/^1\.\d+$/u.test(y(e,t)))throw new M(`unsupported lock-version: expected "1.0", found ${N(e)}`,t);return e}function Z(e,t,n){let r=[`vcs`,`directory`,`archive`].filter(t=>e[t]!==void 0),i=V(e.sdist,P(t,`sdist`),n),a=H(e.wheels,P(t,`wheels`),n),o=i!==void 0||a.length>0;if(o&&r.length>0)throw new M(`${r.join(` and `)} beside an sdist or wheels, which the spec forbids`,t);if(!o&&r.length!==1)throw new M(`expected one of vcs, directory and archive, or an sdist or wheels, found ${r.length===0?`none`:r.join(` and `)}`,t);return{vcs:D(e,`vcs`,t,K),directory:D(e,`directory`,t,W),archive:D(e,`archive`,t,U),index:D(e,`index`,t,d),sdist:i,wheels:a}}function Q(e,i){g(e,i,Y);let s=a(e.name,P(i,`name`)),c=D(e,`version`,i,n);return{name:s,version:c,marker:D(e,`marker`,i,o),requiresPython:D(e,`requires-python`,i,r),dependencies:[],...Z(e,i,{name:s,version:c,versionKey:c===void 0?void 0:t(c)}),attestationIdentities:D(e,`attestation-identities`,i,q)??[],tool:D(e,`tool`,i,g)}}function $(e,t){return e instanceof k||e instanceof ee?t instanceof e.constructor&&e.text===t.text:Array.isArray(e)?Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>$(e,t[n])):A(e)?A(t)&&Object.keys(e).length===Object.keys(t).length&&Object.entries(e).every(([e,n])=>$(n,t[e])):e===t}function te(e,t,n,r){return e===void 0?[]:C((e,t)=>{if(g(e,t).name===void 0)throw new M(`expected a name`,t);let i=Object.entries(e),a=(r.get(e.name)??[]).filter(e=>i.every(([t,r])=>$(r,n[e][t])));if(a.length!==1)throw new M(a.length===0?`names no entry of packages`:`could be any of ${a.length} entries of packages`,t);return a[0]})(e,t)}function ne(e){let t=new Map;for(let[n,r]of e.entries())if(r.marker===void 0){if(t.has(r.name))throw new M(`${N(r.name)} is listed with no marker, as packages[${t.get(r.name)}] is, and both would be installed`,`packages[${n}]`);t.set(r.name,n)}}function re(e){let t=g(j(e),void 0,J),n=X(t[`lock-version`],`lock-version`),s=v(t.packages,`packages`),c=s.map((e,t)=>Q(e,`packages[${t}]`));ne(c);let l=Map.groupBy(c.keys(),e=>c[e].name);for(let[e,t]of c.entries())t.dependencies=te(s[e].dependencies,`packages[${e}].dependencies`,s,l);return{lockVersion:n,environments:D(t,`environments`,``,w(o)),requiresPython:D(t,`requires-python`,``,r),extras:D(t,`extras`,``,w(a))??[],dependencyGroups:D(t,`dependency-groups`,``,w(i))??[],defaultGroups:D(t,`default-groups`,``,w(i))??[],createdBy:S(t[`created-by`],`created-by`),packages:c,tool:D(t,`tool`,``,g)}}export{M as LockfileError,O as TomlError,re as parsePylock};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,b as t,c as n}from"./chunk-ZQHLECTI.js";import{d as r,f as i,g as a,j as o,k as s,m as c}from"./chunk-PXK7EU4V.js";var l=[{},{},{}],u=[[...`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`],[...`0123456789ABCDEFGHIJKLMNOPQRSTUV`],[...`0123456789ABCDEFGHJKMNPQRSTVWXYZ`]],d=`Invalid character in base32 input`,f=`Invalid base32 padding`,p=`Invalid base32 length`,m=`Invalid last chunk`,h=r;function g(e,n,r){o(e);let i=Math.floor(e.length/5),s=i*5,c=``,d=0,f=u[n],p=l[n];if(!p.pairs){if(p.pairs=[],a){p.codepairs=new Uint16Array(1024);let e=p.codepairs,t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e<32;e++){let n=f[e].charCodeAt(0);for(let r=0;r<32;r++)t[e<<6|r<<1]=t[r<<6|(e<<1)+1]=n}}else{let e=p.pairs;for(let t=0;t<32;t++)for(let n=0;n<32;n++)e.push(`${f[t]}${f[n]}`)}}let{pairs:m,codepairs:g}=p;if(a){let n=new Uint16Array(i*4);for(let t=0;d<s;d+=5){let r=e[d],i=e[d+1],a=e[d+2],o=e[d+3],s=e[d+4],c=r<<2|i>>6,l=(i&63)<<4|a>>4,u=(a&15)<<6|o>>2,f=(o&3)<<8|s;n[t]=g[c],n[t+1]=g[l],n[t+2]=g[u],n[t+3]=g[f],t+=4}c=t(n)}else if(h)for(;d<s;d+=5){let t=e[d],n=e[d+1],r=e[d+2],i=e[d+3],a=e[d+4],o=t<<2|n>>6,s=(n&63)<<4|r>>4,l=(r&15)<<6|i>>2,u=(i&3)<<8|a;c+=`${m[o]}${m[s]}${m[l]}${m[u]}`}else for(;d<s;d+=5){let t=e[d],n=e[d+1],r=e[d+2],i=e[d+3],a=e[d+4],o=t<<2|n>>6,s=(n&63)<<4|r>>4,l=(r&15)<<6|i>>2,u=(i&3)<<8|a;c+=m[o],c+=m[s],c+=m[l],c+=m[u]}let _=0,v=3;for(;d<e.length;d++){let t=e[d];c+=f[_|t>>v],v>=5&&(v-=5,c+=f[t>>v&31]),_=t<<5-v&31,v+=3}return v!==3&&(c+=f[_]),r&&(c+=[``,`======`,`====`,`===`,`=`][e.length-s]),c}var _=i?128:65536;function v(e,t){let r=e.length;for(;e[r-1]===`=`;)r--;let a=e.length-r,o=r%8,s=r-o;if(![0,2,4,5,7].includes(o))throw SyntaxError(p);if(a>7||a!==0&&e.length%8!=0)throw SyntaxError(f);let c=u[t],h=l[t];if(!h.fromMap){h.fromMap=new Int8Array(_).fill(-1);let e=h.fromMap;c.forEach((t,n)=>{e[t.charCodeAt(0)]=e[t.toLowerCase().charCodeAt(0)]=n}),t===2&&(e[73]=e[76]=e[105]=e[108]=e[49],e[79]=e[111]=e[48])}let g=h.fromMap,v=new Uint8Array(Math.floor(r*5/8)),y=0,b=0;if(i){let t=n(e,d);for(;b<s;b+=8){let e=t[b],n=t[b+1],r=t[b+2],i=t[b+3],a=t[b+4],o=t[b+5],s=t[b+6],c=t[b+7],l=g[e]<<15|g[n]<<10|g[r]<<5|g[i],u=g[a]<<15|g[o]<<10|g[s]<<5|g[c];if(l<0||u<0)throw SyntaxError(d);v[y]=l>>12,v[y+1]=l>>4&255,v[y+2]=l<<4&255|u>>16,v[y+3]=u>>8&255,v[y+4]=u&255,y+=5}}else for(;b<s;b+=8){let t=e.charCodeAt(b),n=e.charCodeAt(b+1),r=e.charCodeAt(b+2),i=e.charCodeAt(b+3),a=e.charCodeAt(b+4),o=e.charCodeAt(b+5),s=e.charCodeAt(b+6),c=e.charCodeAt(b+7),l=g[t]<<15|g[n]<<10|g[r]<<5|g[i],u=g[a]<<15|g[o]<<10|g[s]<<5|g[c];if(l<0||u<0)throw SyntaxError(d);v[y]=l>>12,v[y+1]=l>>4&255,v[y+2]=l<<4&255|u>>16,v[y+3]=u>>8&255,v[y+4]=u&255,y+=5}if(o<2)return v;let x=g[e.charCodeAt(b++)]<<5|g[e.charCodeAt(b++)];if(x<0)throw SyntaxError(d);if(v[y++]=x>>2,o<4){if(x&3)throw SyntaxError(m);return v}let S=g[e.charCodeAt(b++)]<<5|g[e.charCodeAt(b++)];if(S<0)throw SyntaxError(d);if(v[y++]=x<<6&255|S>>4,o<5){if(S&15)throw SyntaxError(m);return v}let C=g[e.charCodeAt(b++)];if(C<0)throw SyntaxError(d);if(v[y++]=S<<4&255|C>>1,o<7){if(C&1)throw SyntaxError(m);return v}let w=g[e.charCodeAt(b++)]<<5|g[e.charCodeAt(b++)];if(w<0)throw SyntaxError(d);if(v[y++]=C<<7&255|w>>3,w&7)throw SyntaxError(m);return v}function y(t,n,r,i,a){if(typeof t!=`string`)throw TypeError(s);if(a!==null&&e(a),r===!0){if(t.length%8!=0)throw SyntaxError(f)}else if(r===!1){if(t.endsWith(`=`))throw SyntaxError(`Did not expect padding in base32 input`)}else if(r!==`both`)throw TypeError(`Invalid padding option`);return c(v(t,n),i)}var b=(e=>(t,n)=>{if(!n)return y(t,e,`both`,`uint8`,null);let{format:r=`uint8`,padding:i=`both`,...a}=n;return y(t,e,i,r,a)})(0),x=(e,{padding:t=!1}={})=>g(e,0,t);export{b as a,x as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as e,c as t,d as n,e as r,f as i,g as a,h as o,j as s,k as c,m as l,n as u}from"./chunk-PXK7EU4V.js";import{b as d}from"./chunk-OOJM4CTU.js";function f(e){if(Object.keys(e).length>0)throw TypeError(`Unexpected extra options`)}Object.getPrototypeOf(Uint8Array);var p=globalThis.atob,m=Uint8Array.prototype.toBase64,h=8192,g=m&&p;function _(e,t=0,n=e.length){t|=0,n|=0;let r=n-t;if(r===0)return``;if(g&&r>=256&&r<1e8&&e.toBase64===m&&e.BYTES_PER_ELEMENT===1)return p((t===0&&n===e.length?e:e.subarray(t,n)).toBase64());if(r>h){let r=``;for(let i=t;i<n;){let t=Math.min(n,i+h);r+=String.fromCharCode.apply(String,e.subarray(i,t)),i=t}return r}let i=t===0&&n===e.length?e:e.subarray(t,n);return String.fromCharCode.apply(String,i)}var v=t?e=>e.byteLength>=768&&!r?t.from(e.buffer,e.byteOffset,e.byteLength).latin1Slice(0,e.byteLength):a.decode(e):o?e=>o.decode(e):e=>_(e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),y=t=>e(t,new Uint8Array(t.length)),b=n&&i?.encodeInto?(e,t)=>{let n=new Uint8Array(e.length+4),r=i.encodeInto(e,n);if(r.read!==e.length||r.written!==e.length)throw SyntaxError(t);return n.subarray(0,e.length)}:t?(e,n)=>{let r=t.from(e,`utf8`);if(r.length!==e.length)throw SyntaxError(n);return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}:(e,t)=>{let n=i.encode(e);if(n.length!==e.length)throw SyntaxError(t);return n},x={};d(x,{E_CHAR:()=>E,E_LAST:()=>k,E_LENGTH:()=>O,E_PADDING:()=>D,fromBase64:()=>M,toBase64:()=>A});var S=[...`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`],C=[...`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`],w={},T={},E=`Invalid character in base64 input`,D=`Invalid base64 padding`,O=`Invalid base64 length`,k=`Invalid last chunk`;function A(e,t,n){let r=e.length/3|0,i=r*3,o=``,s=0,c=t?C:S,l=t?T:w;if(!l.pairs){if(l.pairs=[],a){l.codepairs=new Uint16Array(4096);let e=l.codepairs,t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e<64;e++){let n=c[e].charCodeAt(0);for(let r=0;r<64;r++)t[e<<7|r<<1]=t[r<<7|(e<<1)+1]=n}}else{let e=l.pairs;for(let t=0;t<64;t++)for(let n=0;n<64;n++)e.push(`${c[t]}${c[n]}`)}}let{pairs:u,codepairs:d}=l;if(a){let t=new Uint16Array(r*2),n=0;for(let r=e.length-11;s<r;s+=12,n+=8){let r=e[s],i=e[s+1],a=e[s+2],o=e[s+3],c=e[s+4],l=e[s+5],u=e[s+6],f=e[s+7],p=e[s+8],m=e[s+9],h=e[s+10],g=e[s+11];t[n]=d[r<<4|i>>4],t[n+1]=d[(i&15)<<8|a],t[n+2]=d[o<<4|c>>4],t[n+3]=d[(c&15)<<8|l],t[n+4]=d[u<<4|f>>4],t[n+5]=d[(f&15)<<8|p],t[n+6]=d[m<<4|h>>4],t[n+7]=d[(h&15)<<8|g]}for(let r=e.length-2;s<r;s+=3,n+=2){let r=e[s],i=e[s+1],a=e[s+2];t[n]=d[r<<4|i>>4],t[n+1]=d[(i&15)<<8|a]}o=v(t)}else for(;s<i;s+=3){let t=e[s],n=e[s+1],r=e[s+2];o+=u[t<<4|n>>4],o+=u[(n&15)<<8|r]}let f=0,p=2,m=e.length;for(;s<m;s++){let t=e[s];o+=c[f|t>>p],p===6&&(p=0,o+=c[t&63]),f=t<<6-p&63,p+=2}return p!==2&&(o+=c[f]),n&&(o+=[``,`==`,`=`][m-i]),o}var j=i?128:65536;function M(e,t){let n=e.length;for(;e[n-1]===`=`;)n--;let r=e.length-n,a=n%4,o=n-a;if(a===1)throw SyntaxError(O);if(r>3||r!==0&&e.length%4!=0)throw SyntaxError(D);let s=t?C:S,c=t?T:w;c.fromMap||(c.fromMap=new Int8Array(j).fill(-1),s.forEach((e,t)=>c.fromMap[e.charCodeAt(0)]=t));let l=c.fromMap,u=new Uint8Array(Math.floor(n*3/4)),d=0,f=0;if(i){let t=b(e,E);for(;f<o;f+=4){let e=t[f],n=t[f+1],r=t[f+2],i=t[f+3],a=l[e]<<18|l[n]<<12|l[r]<<6|l[i];if(a<0)throw SyntaxError(E);u[d]=a>>16,u[d+1]=a>>8&255,u[d+2]=a&255,d+=3}}else for(;f<o;f+=4){let t=e.charCodeAt(f),n=e.charCodeAt(f+1),r=e.charCodeAt(f+2),i=e.charCodeAt(f+3),a=l[t]<<18|l[n]<<12|l[r]<<6|l[i];if(a<0)throw SyntaxError(E);u[d]=a>>16,u[d+1]=a>>8&255,u[d+2]=a&255,d+=3}if(a<2)return u;let p=l[e.charCodeAt(f++)]<<6|l[e.charCodeAt(f++)];if(p<0)throw SyntaxError(E);if(u[d++]=p>>4,a<3){if(p&15)throw SyntaxError(k);return u}let m=l[e.charCodeAt(f++)];if(m<0)throw SyntaxError(E);if(u[d++]=p<<4&255|m>>2,m&3)throw SyntaxError(k);return u}var{Buffer:N,atob:P,btoa:F}=globalThis,I=N&&!N.TYPED_ARRAY_SUPPORT,{toBase64:L}=Uint8Array.prototype,{E_CHAR:R,E_PADDING:z,E_LENGTH:B,E_LAST:V}=x,H=F&&n,U=P&&n,W=e=>e.constructor===N&&N.isBuffer(e),G=e=>W(e)?e:N.from(e.buffer,e.byteOffset,e.byteLength);function K(e,t){if(t)return e;let n=e.indexOf(`=`,e.length-3);return n===-1?e:e.slice(0,n)}function q(e,t){return t&&e.length%4!=0?e+`=`.repeat(4-e.length%4):e}var J=e=>L&&e.toBase64===L;function Y(e,{padding:t=!0}={}){return s(e),J(e)?t?e.toBase64():e.toBase64({omitPadding:!t}):I?K(G(e).base64Slice(0,e.byteLength),t):H?K(F(_(e)),t):A(e,!1,t)}function X(e,t){if(typeof t==`string`&&(t={format:t}),!t)return Z(e,!1,`both`,`uint8`,null);let{format:n=`uint8`,padding:r=`both`,...i}=t;return Z(e,!1,r,n,i)}function Z(e,t,n,r,i){if(typeof e!=`string`)throw TypeError(c);i!==null&&f(i);let a=n===`both`?e.endsWith(`=`):void 0;if(n===!0||a===!0){if(e.length%4!=0||e[e.length-3]===`=`)throw SyntaxError(z)}else if(n===!1||a===!1){if(e.length%4==1)throw SyntaxError(B);if(n===!1&&e.endsWith(`=`))throw SyntaxError(`Did not expect padding in base64 input`)}else throw TypeError(`Invalid padding option`);return ee(e,t,n,r)}var Q=/[\t\n\f\r ]/;function $(e,t){let n=e.indexOf(`=`,e.length-3),r=n>=0?e.length-n:0,i=e.length-r,a=i%4,o=t.length-(i-a)/4*3;return a===0&&o===0||a===2&&o===1||a===3&&o===2}var ee=Uint8Array.fromBase64?(e,t,n,r)=>{let i=t?`base64url`:`base64`,a;if(n===!0)a=Uint8Array.fromBase64(e,{alphabet:i,lastChunkHandling:`strict`});else try{let t=e.length%4>0?`${e}${`=`.repeat(4-e.length%4)}`:e;a=Uint8Array.fromBase64(t,{alphabet:i,lastChunkHandling:`strict`})}catch(t){throw Q.test(e)?SyntaxError(R):t}if(!$(e,a))throw SyntaxError(R);return l(a,r)}:I?(e,t,n,r)=>{let i=N.byteLength(e,`base64`),a=N.allocUnsafeSlow(i);if(a.base64Write(e)!==i)throw SyntaxError(z);let o=t?a.base64urlSlice(0,a.length):a.base64Slice(0,a.length);if(e!==o&&(n===!t||q(e,!0)!==q(o,t)))throw SyntaxError(z);return u(a,r)}:U?(e,t,n,r)=>{let i;if(t){if(/[\t\n\f\r +/]/.test(e))throw SyntaxError(R);e=e.replaceAll(`-`,`+`).replaceAll(`_`,`/`)}try{i=y(P(e))}catch{throw SyntaxError(R)}if(!t&&!$(e,i))throw SyntaxError(R);if(i.length%3!=0&&Y(i.subarray(-(i.length%3)))!==(e.length%4==0?e.slice(-4):e.slice(-(e.length%4)).padEnd(4,`=`)))throw SyntaxError(V);return l(i,r)}:(e,t,n,r)=>l(M(e,t),r);export{f as a,v as b,b as c,Y as d,X as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ka as e}from"./chunk-QCOGVL37.js";import{m as t,p as n,v as r}from"./chunk-W6VOKW2N.js";import{a as i}from"./chunk-WCPJDAYA.js";import{b as a}from"./chunk-IYPY47MC.js";import{D as o,J as s,L as c,q as l}from"./chunk-QRKFPLA4.js";function u(e){let{data:t}=c(e);return t&&d(t)>0?t:null}function d(e){return(s(e)??[]).filter(t=>(Array.isArray(t)?t:[t]).some(t=>t&&typeof t==`object`&&l(t,t.source??e.source))).length}function f(e,t){let n=[],r=new Map;for(let{name:t,content:i,fallbackRepo:a}of e){if(typeof i!=`string`)continue;let e=u(i);if(!e)continue;let c=s(e),l=o(e)??o({repo:{github:a}}),f=new Set(l?[l]:[]);if(!l)for(let e of c.flat()){if(/(?:^|\/)(?:node_modules|dependencies)\//u.test(e?.file??``))continue;let t=o(e);t&&f.add(t)}for(let e of f)r.set(e,{id:e,label:e});n.push({id:t,filename:t,repoIds:[...f],analyzer:e.source,appFindings:d(e)})}let i=new Set(n.map(e=>e.id));return{merge:{bundles:[],results:[]},link:{reports:n,repositories:[...r.values()],workspaces:t.map(e=>({id:e.id,label:e.name,reports:e.reports.filter(e=>i.has(e))})).filter(e=>e.reports.length>0)}}}function p(e,t){let n=(e.reports??[]).filter(e=>e.visible&&e.repoId!=null).flatMap(e=>{let t=u(e.content??``);return t?[{id:e.id,filename:e.filename,repoIds:[e.repoId],repo:e.repoFullName,directory:e.repoDirectory,analyzer:e.analyzer,appFindings:d(t)}]:[]}),r=new Map((e.repos??[]).map(e=>[e.repoId,{id:e.repoId,label:e.fullName}]));for(let e of n)r.has(e.repoIds[0])||r.set(e.repoIds[0],{id:e.repoIds[0],label:e.repo??String(e.repoIds[0])});let a=t.results??[],o=new Set(a.map(e=>e.bundleId));return{merge:{bundles:(t.bundles??[]).filter(e=>o.has(e.id)).map(e=>({...e,size:i(e.byteSize)})),results:a},link:{repositories:[...r.values()].filter(e=>n.some(t=>t.repoIds.includes(e.id))),reports:n}}}var m=new Map([[`openai/gpt-6-astra`,`GPT-6 Astra`],[`openai/gpt-6-astra-pro`,`GPT-6 Astra Pro`],[`openai/gpt-5.6-sol`,`GPT-5.6 Sol`],[`openai/gpt-5.6-terra`,`GPT-5.6 Terra`],[`openai/gpt-5.6-luna`,`GPT-5.6 Luna`],[`anthropic/claude-fable-5.1`,`Claude Fable 5.1`],[`anthropic/claude-opus-5`,`Claude Opus 5`],[`anthropic/claude-sonnet-5`,`Claude Sonnet 5`],[`moonshotai/kimi-k3`,`Kimi K3`],[`z-ai/glm-5.3`,`GLM 5.3`],[`qwen/qwen3.8-max`,`Qwen3.8 Max`],[`qwen/qwen4-max`,`Qwen4 Max`],[`deepseek/deepseek-v4.1-flash`,`DeepSeek V4.1 Flash`],[`deepseek/deepseek-v4-pro`,`DeepSeek V4 Pro`]]),h=new Map([[`openai`,`OpenAI`],[`anthropic`,`Anthropic`],[`moonshotai`,`Moonshot AI`],[`google`,`Google`],[`nvidia`,`NVIDIA`],[`qwen`,`Qwen`],[`deepseek`,`DeepSeek`],[`x-ai`,`xAI`],[`z-ai`,`Z.ai`],[`mistralai`,`Mistral AI`],[`meta`,`Meta`],[`unbiased`,`Unbiased`]]),g=new Map([[`meta-llama`,`meta`]]),_=new Map([[`gpt`,`GPT`],[`gptoss`,`GPT OSS`],[`oss`,`OSS`],[`o`,`O`],[`ai`,`AI`],[`api`,`API`],[`4o`,`4o`],[`k3`,`K3`],[`k4`,`K4`],[`qwen`,`Qwen`],[`kimi`,`Kimi`],[`mimo`,`MiMo`],[`gemini`,`Gemini`],[`claude`,`Claude`],[`fable`,`Fable`],[`opus`,`Opus`],[`sonnet`,`Sonnet`],[`astra`,`Astra`],[`terra`,`Terra`],[`luna`,`Luna`],[`codex`,`Codex`],[`deepseek`,`DeepSeek`],[`nemotron`,`Nemotron`],[`gemma`,`Gemma`]]);function v(e){let t=e.replace(/:free$/u,``).replaceAll(`_`,`-`).split(`-`).filter(Boolean),n=[];for(let e=0;e<t.length;e++){let r=t[e],i=t[e+1];if(/^\d+$/u.test(r)&&/^\d+$/u.test(i??``)){n.push(`${r}.${i}`),e++;continue}let a=_.get(r.toLowerCase());n.push(a??(/^(?:[a-z]+\d+|\d+[a-z]+)$/iu.test(r)?r.toUpperCase():r[0]?.toUpperCase()+r.slice(1)))}return n.join(` `).replace(/^GPT (\d)/u,`GPT-$1`)}function y(e){return m.get(e)??v(e.includes(`/`)?e.slice(e.indexOf(`/`)+1):e)}function b(e){let t=e.includes(`/`)?e.split(`/`)[0].replace(/^~/u,``):`other`,n=g.get(t)??t;return{key:n,name:h.get(n)??(n===`other`?`Other`:v(n))}}function x(e){return e===`xhigh`?`Extra high`:e?e[0].toUpperCase()+e.slice(1):`Unavailable`}function S(e){return e.efforts.includes(`max`)?`max`:e.efforts.at(-1)??null}async function C(e,t=fetch){let n=await t(`/api/admin/scan/models`,{credentials:`same-origin`,headers:{accept:`application/json`},signal:e});if(!n.ok)throw Error(`HTTP ${n.status}`);return w(await n.json())}function w(e){if(!Array.isArray(e?.models))throw Error(`No model catalogue returned`);let t=e.models.filter(e=>typeof e?.id==`string`&&e.id.length>0).map(e=>({id:e.id,efforts:Array.isArray(e.efforts)?[...new Set(e.efforts.filter(e=>typeof e==`string`&&e.length>0))]:[]}));if(t.length===0)throw Error(`No models available`);return{models:t,defaultModel:t.find(t=>t.id===e.defaultModel)?.id??t[0].id}}function T(e,t=[]){let n=new Map,r=e.flatMap(e=>{let r=t.filter(t=>t.bundles?.includes(e.integrity));return(r.length>0?r.map(e=>({id:e.id,label:e.name})):[{id:`unattached`,label:`Unattached`}]).map(t=>(n.set(t.id,t),{id:e.integrity,integrity:e.integrity,filename:e.name,repoId:t.id,repo:t.label,files:null,reasons:[],size:`—`}))});return{repositories:[...n.values()],bundles:r,reports:[],scans:[]}}function E(o,s){if(s.error)throw Error(s.error);let c=n(s),l=s.kind===`stasis`?s.bundle?.formats:null,u=r(s),d=[...t(s)].filter(([,e])=>e!=null).map(([e,t])=>({path:e,format:l?.get(e)??null,bytes:t,lines:u.get(e)??0,size:i(t),module:a(e,{packageDir:c?.get(e)})})),f=[{id:`all`,label:`All`,filePaths:null},...[...e(s,d.map(e=>e.path))].map(([e,t])=>({id:`reason:${e}`,label:e,filePaths:[...t]}))];return{...o,files:d,reasons:f,size:i(s.size)}}export{T as a,E as b,f as c,p as d,y as e,b as f,x as g,S as h,C as i,w as j};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,c as t}from"./chunk-SYXT3SFP.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-J2FWBXFV.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-IZ6MYRYB.js";import"./chunk-PTFQKLKO.js";import{D as m}from"./chunk-QRKFPLA4.js";import"./chunk-74AEKRES.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};
|