@preventive/triage 1.0.0-alpha.8 → 1.0.0-alpha.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (442) hide show
  1. package/LICENSE-APACHE +202 -0
  2. package/README.md +16 -0
  3. package/api/reap.ts +16 -78
  4. package/cli.js +6 -0
  5. package/client/dependency-paths.d.ts +3 -0
  6. package/client/dependency-paths.js +36 -0
  7. package/client/finding-link.js +305 -0
  8. package/client/linked-findings.d.ts +1 -0
  9. package/client/linked-findings.js +115 -0
  10. package/common/bundle-commit.d.ts +1 -0
  11. package/common/bundle-commit.js +4 -0
  12. package/common/bundle-compare-diff.d.ts +6 -0
  13. package/common/bundle-compare-diff.js +377 -0
  14. package/common/bundle-compare-inputs.d.ts +3 -0
  15. package/common/bundle-compare-inputs.js +141 -0
  16. package/common/bundle-compare-versions.js +172 -0
  17. package/common/bundle-comparison.d.ts +8 -0
  18. package/common/bundle-comparison.js +69 -0
  19. package/common/bundle-imports.js +20 -0
  20. package/common/bundle-metadata.d.ts +15 -0
  21. package/common/bundle-metadata.js +226 -0
  22. package/common/bundle-pkg-of.d.ts +1 -0
  23. package/common/bundle-pkg-of.js +90 -0
  24. package/common/bundle-reasons.d.ts +6 -0
  25. package/common/bundle-reasons.js +58 -0
  26. package/common/bundle-source-links.d.ts +6 -0
  27. package/common/bundle-source-links.js +216 -0
  28. package/common/bundle-sourcemap.d.ts +10 -0
  29. package/common/bundle-sourcemap.js +100 -0
  30. package/common/bundle-sources.d.ts +10 -0
  31. package/common/bundle-sources.js +374 -0
  32. package/common/bundle-stats.js +41 -0
  33. package/common/bundle-tabs.js +1 -0
  34. package/common/code-language.js +66 -0
  35. package/common/default-scan-models.ts +36 -0
  36. package/common/dependency-reviews.d.ts +18 -0
  37. package/common/dependency-reviews.js +64 -0
  38. package/common/finding-duplicates.js +63 -0
  39. package/common/finding-filters.js +313 -0
  40. package/common/finding-id.js +47 -0
  41. package/common/finding-repo.d.ts +5 -0
  42. package/common/finding-repo.js +67 -0
  43. package/common/github-issue-labels.d.ts +1 -0
  44. package/common/github-issue-labels.js +11 -0
  45. package/common/github-pr.ts +56 -0
  46. package/common/gzip.js +59 -0
  47. package/common/line-diff.d.ts +14 -0
  48. package/common/line-diff.js +181 -0
  49. package/common/linked-workspace-groups.js +63 -0
  50. package/common/managed/agent-tasks.ts +292 -0
  51. package/common/managed/comments.ts +43 -0
  52. package/common/managed/dependency-routes.js +25 -0
  53. package/common/managed/directory-packages.ts +28 -0
  54. package/common/managed/finding-detail.d.ts +5 -0
  55. package/common/managed/finding-detail.js +75 -0
  56. package/common/managed/finding-values.d.ts +2 -0
  57. package/common/managed/finding-values.js +138 -0
  58. package/common/managed/github-agents.ts +114 -0
  59. package/common/managed/github-logins.ts +49 -0
  60. package/common/managed/lite-name.d.ts +2 -0
  61. package/common/managed/lite-name.js +20 -0
  62. package/common/managed/npm-packages.d.ts +9 -0
  63. package/common/managed/npm-packages.js +63 -0
  64. package/common/managed/permissions.ts +31 -0
  65. package/common/managed/report-content.ts +72 -0
  66. package/common/managed/report-filter.ts +120 -0
  67. package/common/managed/repository-alias.ts +65 -0
  68. package/common/managed/review-view-routes.js +23 -0
  69. package/common/managed/risk-routes.js +30 -0
  70. package/common/managed/roles.ts +41 -0
  71. package/common/managed/routes.d.ts +2 -0
  72. package/common/managed/routes.js +385 -0
  73. package/common/managed/scan-models.ts +6 -0
  74. package/common/managed/stasis-config.ts +7 -0
  75. package/common/managed/team-app.d.ts +19 -0
  76. package/common/managed/team-app.js +129 -0
  77. package/common/managed/team-filters.js +26 -0
  78. package/common/managed/triage.ts +83 -0
  79. package/common/managed/upload-seal.ts +126 -0
  80. package/common/pretty-json.js +98 -0
  81. package/common/pretty-kinds.js +20 -0
  82. package/common/pretty-print.d.ts +6 -0
  83. package/common/pretty-print.js +36 -0
  84. package/common/pretty-sourcemap.js +70 -0
  85. package/common/repo-commit.d.ts +4 -0
  86. package/common/repo-commit.js +30 -0
  87. package/common/revalidation-conflicts.js +48 -0
  88. package/common/revalidation-input-groups.js +56 -0
  89. package/common/save-error-reason.ts +20 -7
  90. package/common/scan-server.ts +13 -0
  91. package/common/security-links.d.ts +5 -0
  92. package/common/security-links.js +33 -0
  93. package/common/server-info.ts +46 -0
  94. package/common/sourcemap-listing.js +78 -0
  95. package/common/sourcemap-mappings.js +136 -0
  96. package/common/sourcemap-unlist.js +85 -0
  97. package/common/stasis-files.d.ts +5 -0
  98. package/common/stasis-files.js +20 -0
  99. package/common/stasis-tgz.d.ts +6 -0
  100. package/common/stasis-tgz.js +27 -0
  101. package/common/utf8.d.ts +3 -0
  102. package/common/utf8.js +45 -0
  103. package/common/whitespace-insensitive.js +19 -0
  104. package/common/workspace-app.js +91 -0
  105. package/common/workspace-groups.js +176 -0
  106. package/out/activity.js +2 -0
  107. package/out/brotli-fallback.js +3 -3
  108. package/out/chunk-2XUEZHIP.js +28 -0
  109. package/out/chunk-55YIWY3H.js +5 -0
  110. package/out/chunk-563V5VVT.js +266 -0
  111. package/out/chunk-5AVGKFMR.js +1 -0
  112. package/out/chunk-5EAVJAD2.js +3 -0
  113. package/out/chunk-5M2X3QPK.js +6 -0
  114. package/out/chunk-5QWPKTCE.js +40 -0
  115. package/out/chunk-5UJHJWFU.js +4 -0
  116. package/out/chunk-6CCSTJWB.js +1 -0
  117. package/out/chunk-6VOB5WXX.js +2 -0
  118. package/out/chunk-6WMQVUT2.js +3 -0
  119. package/out/chunk-6Y6PZ2BU.js +9 -0
  120. package/out/chunk-74JZTGTO.js +11 -0
  121. package/out/chunk-7BKKYVWR.js +7 -0
  122. package/out/chunk-7C7DWL7I.js +1 -0
  123. package/out/chunk-7HP2VYIC.js +2 -0
  124. package/out/chunk-7YFJUT2P.js +1 -0
  125. package/out/chunk-7YO4QV5P.js +1 -0
  126. package/out/chunk-A4BBBHQU.js +1 -0
  127. package/out/chunk-B64CTMVU.js +4 -0
  128. package/out/chunk-BEKYZCPX.js +14 -0
  129. package/out/chunk-C4Z6ZBXV.js +10 -0
  130. package/out/chunk-CU3FPB3P.js +1 -0
  131. package/out/chunk-DEVAORP2.js +1 -0
  132. package/out/chunk-DOYTKRIR.js +53 -0
  133. package/out/chunk-DUASGS2O.js +8 -0
  134. package/out/chunk-EEJA7JBI.js +13 -0
  135. package/out/chunk-FSU2PLJL.js +1 -0
  136. package/out/chunk-GO7FT4OD.js +1 -0
  137. package/out/chunk-GX5UXWT4.js +1 -0
  138. package/out/chunk-H4FEC57K.js +1 -0
  139. package/out/chunk-ITUKKCCK.js +10 -0
  140. package/out/chunk-IYPY47MC.js +1 -0
  141. package/out/chunk-K4XJHM2T.js +1 -0
  142. package/out/chunk-LBD3M3J6.js +1 -0
  143. package/out/chunk-LVSLM7HB.js +1 -0
  144. package/out/chunk-LVW7WWV4.js +1 -0
  145. package/out/chunk-N57OWFKY.js +15 -0
  146. package/out/chunk-NRPC74AM.js +1 -0
  147. package/out/chunk-OAWQNDAO.js +3 -0
  148. package/out/chunk-OOJM4CTU.js +1 -0
  149. package/out/chunk-PEE47ANR.js +1 -0
  150. package/out/chunk-PKLVXUEI.js +11 -0
  151. package/out/chunk-PLGH63UC.js +2 -0
  152. package/out/chunk-PNHBZGDD.js +1 -0
  153. package/out/chunk-PTFYDJUP.js +1 -0
  154. package/out/chunk-PWFUOLZK.js +17 -0
  155. package/out/chunk-PXK7EU4V.js +1 -0
  156. package/out/chunk-QD3IBSF4.js +7 -0
  157. package/out/chunk-QI66YA4F.js +1 -0
  158. package/out/chunk-QRKFPLA4.js +80 -0
  159. package/out/chunk-R3NZFXVR.js +1 -0
  160. package/out/chunk-R5O6FAW4.js +2 -0
  161. package/out/chunk-RPNO56H2.js +1 -0
  162. package/out/chunk-SSPDMA6D.js +1 -0
  163. package/out/chunk-SZWPYLPC.js +1 -0
  164. package/out/chunk-TUII34K2.js +1 -0
  165. package/out/chunk-UJP4PQJA.js +1 -0
  166. package/out/chunk-UJSJMXEG.js +1 -0
  167. package/out/chunk-UR4WYMIP.js +1 -0
  168. package/out/chunk-VHEXSGGP.js +1 -0
  169. package/out/chunk-VYYUMYVW.js +9 -0
  170. package/out/chunk-WCDYSIKG.js +1 -0
  171. package/out/chunk-WFBVS4QI.js +1 -0
  172. package/out/chunk-XM4RLC4A.js +2 -0
  173. package/out/chunk-ZQHLECTI.js +1 -0
  174. package/out/client-managed-import.js +4 -0
  175. package/out/client-managed.js +37 -0
  176. package/out/client-sync.js +11 -17
  177. package/out/compare.js +26 -0
  178. package/out/dialogs.js +40 -0
  179. package/out/github-issue-authorized.html +3 -0
  180. package/out/github-issue-authorized.js +1 -0
  181. package/out/graph.js +19 -4
  182. package/out/index.html +104 -24
  183. package/out/prism.js +14 -10
  184. package/out/scan.js +2 -0
  185. package/out/stasis.svg +20 -0
  186. package/out/terminal.js +367 -39
  187. package/out/view.css +1 -1
  188. package/out/view.js +19 -147
  189. package/package.json +409 -64
  190. package/risk/actions/findings.js +161 -0
  191. package/risk/actions/resolve.js +287 -0
  192. package/risk/actions/scripts/commands.js +182 -0
  193. package/risk/actions/scripts/grade.js +113 -0
  194. package/risk/actions/scripts/packages.js +123 -0
  195. package/risk/actions/scripts/shell.js +169 -0
  196. package/risk/actions/uses.js +94 -0
  197. package/risk/actions/workflow.js +183 -0
  198. package/risk/files/characters.js +354 -0
  199. package/risk/files/hosts.js +206 -0
  200. package/risk/files/readability.js +185 -0
  201. package/risk/files/runs-code.js +568 -0
  202. package/risk/files/script.js +410 -0
  203. package/risk/files/source-map-link.js +43 -0
  204. package/risk/files/stamps.js +47 -0
  205. package/risk/index.d.ts +294 -0
  206. package/risk/index.js +12 -0
  207. package/risk/npm/assess.js +285 -0
  208. package/risk/npm/combined.js +68 -0
  209. package/risk/npm/compare.js +236 -0
  210. package/risk/npm/dependencies.js +172 -0
  211. package/risk/npm/diff.js +79 -0
  212. package/risk/npm/downloads.js +84 -0
  213. package/risk/npm/files.js +445 -0
  214. package/risk/npm/held.js +67 -0
  215. package/risk/npm/install-scripts.js +34 -0
  216. package/risk/npm/malware.js +38 -0
  217. package/risk/npm/manifest.js +65 -0
  218. package/risk/npm/new-dependency.js +60 -0
  219. package/risk/npm/old-version.js +108 -0
  220. package/risk/npm/registry.js +393 -0
  221. package/risk/npm/release.js +85 -0
  222. package/risk/npm/score.js +59 -0
  223. package/risk/npm/specs.js +124 -0
  224. package/risk/npm/tarball.js +169 -0
  225. package/server-common/database-config.ts +16 -0
  226. package/server-common/initialize.ts +18 -0
  227. package/server-common/npm-advisories.ts +101 -0
  228. package/{server → server-common}/origin.ts +5 -5
  229. package/server-common/reap.ts +48 -0
  230. package/server-common/scan-config.ts +19 -0
  231. package/server-common/standalone.ts +29 -0
  232. package/server-common/storage-crypto.ts +182 -0
  233. package/server-common/storage-log.ts +38 -0
  234. package/server-common/vercel-blob.ts +103 -0
  235. package/server-e2e/app.ts +487 -0
  236. package/{server → server-e2e}/bus-receiver.ts +2 -1
  237. package/{server → server-e2e}/cli.js +9 -4
  238. package/{server → server-e2e}/config.ts +50 -42
  239. package/{server → server-e2e}/db-neon.ts +2 -2
  240. package/{server → server-e2e}/db-revision-sql.ts +1 -1
  241. package/{server → server-e2e}/db-stmt.ts +2 -2
  242. package/{server → server-e2e}/db.ts +7 -7
  243. package/{server → server-e2e}/http.ts +44 -13
  244. package/{server → server-e2e}/hub.ts +40 -9
  245. package/server-e2e/index.ts +17 -0
  246. package/server-e2e/lifecycle.ts +95 -0
  247. package/{server → server-e2e}/neon-driver.ts +2 -2
  248. package/{server → server-e2e}/npm-proxy.ts +12 -145
  249. package/{server → server-e2e}/objstore/blob-vercel.ts +10 -114
  250. package/{server → server-e2e}/objstore/blob.ts +1 -1
  251. package/{server → server-e2e}/objstore/fetch-mint-guard.ts +2 -2
  252. package/{server → server-e2e}/objstore/handlers.ts +9 -8
  253. package/{server → server-e2e}/objstore/init.ts +19 -27
  254. package/{server → server-e2e}/objstore/reaper.ts +1 -1
  255. package/{server → server-e2e}/objstore/rest-deny.ts +1 -1
  256. package/{server → server-e2e}/objstore/rest-mint.ts +3 -3
  257. package/{server → server-e2e}/objstore/rest.ts +3 -3
  258. package/{server → server-e2e}/objstore/store-neon.ts +6 -10
  259. package/{server → server-e2e}/objstore/store.ts +7 -7
  260. package/{server → server-e2e}/objstore/tokens.ts +2 -2
  261. package/{server → server-e2e}/pubsub.ts +12 -9
  262. package/{server → server-e2e}/sign.ts +4 -4
  263. package/{server → server-e2e}/sse-server.ts +60 -33
  264. package/{server → server-e2e}/static.ts +18 -17
  265. package/{server → server-e2e}/sync-handlers.ts +64 -30
  266. package/{server → server-e2e}/ws-server.ts +20 -9
  267. package/server-managed/activity.ts +269 -0
  268. package/server-managed/agent-merges.ts +109 -0
  269. package/server-managed/app-agents.ts +23 -0
  270. package/server-managed/avatar-store.ts +13 -0
  271. package/server-managed/blob-store.ts +26 -0
  272. package/server-managed/brotli.ts +10 -0
  273. package/server-managed/bundle-advisories.ts +79 -0
  274. package/server-managed/bundle-advisory-inventory.ts +85 -0
  275. package/server-managed/bundle-build-diagnostics.d.ts +10 -0
  276. package/server-managed/bundle-build-diagnostics.js +23 -0
  277. package/server-managed/bundle-build-leases.ts +41 -0
  278. package/server-managed/bundle-build-worker.js +380 -0
  279. package/server-managed/bundle-build.ts +326 -0
  280. package/server-managed/bundle-cache.ts +261 -0
  281. package/server-managed/bundle-catalog.ts +29 -0
  282. package/server-managed/bundle-commits.ts +133 -0
  283. package/server-managed/bundle-dependency-reviews.ts +91 -0
  284. package/server-managed/bundle-store.ts +24 -0
  285. package/server-managed/bundle-summary-cache.ts +139 -0
  286. package/server-managed/bundle-validation.ts +33 -0
  287. package/server-managed/bundle.ts +151 -0
  288. package/server-managed/cache-storage.ts +20 -0
  289. package/server-managed/cli.js +21 -0
  290. package/server-managed/combined.ts +43 -0
  291. package/server-managed/comments.ts +138 -0
  292. package/server-managed/commit-coauthors.ts +105 -0
  293. package/server-managed/commit-lockfiles.ts +78 -0
  294. package/server-managed/comparison.ts +51 -0
  295. package/server-managed/config.ts +163 -0
  296. package/server-managed/content-access.ts +15 -0
  297. package/server-managed/crypto.ts +25 -0
  298. package/server-managed/db-methods.ts +1915 -0
  299. package/server-managed/db-neon.ts +398 -0
  300. package/server-managed/db-schema.ts +263 -0
  301. package/server-managed/db-table-names.ts +22 -0
  302. package/server-managed/db.ts +149 -0
  303. package/server-managed/dependabot-access.ts +61 -0
  304. package/server-managed/dependabot-alerts.ts +180 -0
  305. package/server-managed/dependency-review-comments.ts +158 -0
  306. package/server-managed/dependency-reviews.ts +369 -0
  307. package/server-managed/github-accounts.ts +59 -0
  308. package/server-managed/github-actions.ts +71 -0
  309. package/server-managed/github-app.ts +347 -0
  310. package/server-managed/github-errors.ts +92 -0
  311. package/server-managed/github-graphql.ts +42 -0
  312. package/server-managed/github-issue-links.ts +264 -0
  313. package/server-managed/github-issue-oauth.ts +30 -0
  314. package/server-managed/github-issues.ts +157 -0
  315. package/server-managed/github-link-oauth.ts +56 -0
  316. package/server-managed/github-links.ts +204 -0
  317. package/server-managed/github-metadata.ts +213 -0
  318. package/server-managed/github-oauth.ts +264 -0
  319. package/server-managed/github-pulls.ts +257 -0
  320. package/server-managed/github-requests.ts +181 -0
  321. package/server-managed/github-users.ts +30 -0
  322. package/server-managed/github-values.ts +26 -0
  323. package/server-managed/history-windows.ts +172 -0
  324. package/server-managed/http-response.ts +76 -0
  325. package/server-managed/http.ts +6327 -0
  326. package/server-managed/import-triage.ts +51 -0
  327. package/server-managed/index.ts +204 -0
  328. package/server-managed/kept-briefly.ts +37 -0
  329. package/server-managed/kept.ts +28 -0
  330. package/server-managed/link-reports.ts +149 -0
  331. package/server-managed/listed-activity.ts +39 -0
  332. package/server-managed/locked-packages.ts +234 -0
  333. package/server-managed/lockfile-scope.ts +58 -0
  334. package/server-managed/lru.ts +30 -0
  335. package/server-managed/managed-issues.ts +92 -0
  336. package/server-managed/management-catalog.ts +45 -0
  337. package/server-managed/management.ts +116 -0
  338. package/server-managed/npm-delta-worker.js +142 -0
  339. package/server-managed/npm-delta.ts +277 -0
  340. package/server-managed/npm-insights.ts +455 -0
  341. package/server-managed/npm-kept.ts +265 -0
  342. package/server-managed/npm-loads.ts +259 -0
  343. package/server-managed/npm-manifest.ts +117 -0
  344. package/server-managed/npm-packages.ts +469 -0
  345. package/server-managed/npm-patch-paths.ts +86 -0
  346. package/server-managed/npm-patch.ts +455 -0
  347. package/server-managed/npm-provenance.ts +127 -0
  348. package/server-managed/npm-risk.ts +287 -0
  349. package/server-managed/object-storage-disk.ts +147 -0
  350. package/server-managed/object-storage-vercel.ts +71 -0
  351. package/server-managed/object-storage.ts +82 -0
  352. package/server-managed/package-entry-points.ts +127 -0
  353. package/server-managed/pretty-copies.ts +22 -0
  354. package/server-managed/pretty-format.d.ts +3 -0
  355. package/server-managed/pretty-format.js +13 -0
  356. package/server-managed/pretty-print.ts +442 -0
  357. package/server-managed/public-workspace.ts +243 -0
  358. package/server-managed/pull-comment-reviews.ts +161 -0
  359. package/server-managed/pull-dependencies.ts +370 -0
  360. package/server-managed/pull-dependency-reviews.ts +407 -0
  361. package/server-managed/pull-reviews.ts +202 -0
  362. package/server-managed/queue.ts +54 -0
  363. package/server-managed/release-commits.ts +85 -0
  364. package/server-managed/rename-diff-worker.js +30 -0
  365. package/server-managed/rename-diff.ts +237 -0
  366. package/server-managed/repo-path.ts +21 -0
  367. package/server-managed/report-migration.ts +32 -0
  368. package/server-managed/report-opening.ts +77 -0
  369. package/server-managed/report-query.ts +10 -0
  370. package/server-managed/report-response.ts +16 -0
  371. package/server-managed/report-sources.ts +185 -0
  372. package/server-managed/report-store.ts +77 -0
  373. package/server-managed/repository-actions.ts +220 -0
  374. package/server-managed/repository-agents.ts +422 -0
  375. package/server-managed/repository-aliases.ts +119 -0
  376. package/server-managed/repository-browser.ts +361 -0
  377. package/server-managed/repository-changes.ts +280 -0
  378. package/server-managed/repository-code.ts +222 -0
  379. package/server-managed/repository-dependency-reviews.ts +182 -0
  380. package/server-managed/repository-discovery.ts +83 -0
  381. package/server-managed/repository-history.ts +428 -0
  382. package/server-managed/repository-issues.ts +293 -0
  383. package/server-managed/repository-policy.ts +27 -0
  384. package/server-managed/repository-pulls.ts +207 -0
  385. package/server-managed/repository-pulse.ts +477 -0
  386. package/server-managed/repository-risk-assess.ts +108 -0
  387. package/server-managed/repository-risk-audit.ts +78 -0
  388. package/server-managed/repository-risk-caches.ts +37 -0
  389. package/server-managed/repository-risk-read.ts +260 -0
  390. package/server-managed/repository-risk-stasis.ts +61 -0
  391. package/server-managed/repository-risk-turn.ts +97 -0
  392. package/server-managed/repository-risk.ts +516 -0
  393. package/server-managed/repository-squashes.ts +160 -0
  394. package/server-managed/repository-stamp.ts +41 -0
  395. package/server-managed/request-timing.ts +63 -0
  396. package/server-managed/reviewed-dependencies.ts +170 -0
  397. package/server-managed/revisions.ts +35 -0
  398. package/server-managed/scan-downloads.ts +121 -0
  399. package/server-managed/session.ts +132 -0
  400. package/server-managed/slugs.ts +38 -0
  401. package/server-managed/solidity-entry-points.ts +71 -0
  402. package/server-managed/sql-postgres.ts +34 -0
  403. package/server-managed/sql.ts +107 -0
  404. package/server-managed/stasis-config.ts +147 -0
  405. package/server-managed/stasis-dependencies.ts +221 -0
  406. package/server-managed/static.ts +28 -0
  407. package/server-managed/storage-command.ts +16 -0
  408. package/server-managed/storage-db.ts +183 -0
  409. package/server-managed/storage-encryption.ts +288 -0
  410. package/server-managed/storage-maintenance.ts +259 -0
  411. package/server-managed/storage-payload.ts +121 -0
  412. package/server-managed/storage-stores.ts +91 -0
  413. package/server-managed/storage.ts +82 -0
  414. package/server-managed/team-app-summaries.ts +56 -0
  415. package/server-managed/team-app.ts +156 -0
  416. package/server-managed/team-catalog.ts +7 -0
  417. package/server-managed/team-feed.ts +180 -0
  418. package/server-managed/team-npm-scopes.ts +103 -0
  419. package/server-managed/team-reports.ts +368 -0
  420. package/server-managed/triage-response.ts +16 -0
  421. package/server-managed/type-only-proof.js +161 -0
  422. package/server-managed/type-only-worker.js +31 -0
  423. package/server-managed/type-only.ts +135 -0
  424. package/server-managed/uploads.ts +106 -0
  425. package/server-managed/upstream-cache.ts +256 -0
  426. package/server-managed/view-as.ts +58 -0
  427. package/server-managed/worker-turns.ts +76 -0
  428. package/server-managed/workspace-shares.ts +170 -0
  429. package/server.ts +70 -0
  430. package/strip-types-loader.js +13 -10
  431. package/server/index.ts +0 -480
  432. package/server/lifecycle.ts +0 -208
  433. /package/{LICENSE → LICENSE-MIT} +0 -0
  434. /package/{server → server-e2e}/auth.ts +0 -0
  435. /package/{server → server-e2e}/config.example.json +0 -0
  436. /package/{server → server-e2e}/objstore/blob-fs.ts +0 -0
  437. /package/{server → server-e2e}/objstore/fs.ts +0 -0
  438. /package/{server → server-e2e}/objstore/sign.ts +0 -0
  439. /package/{server → server-e2e}/peer.ts +0 -0
  440. /package/{server → server-e2e}/sse-session.ts +0 -0
  441. /package/{server → server-e2e}/util.ts +0 -0
  442. /package/{server → server-e2e}/validation.ts +0 -0
@@ -0,0 +1 @@
1
+ var e=2n**64n-1n,t=`0|[1-9]\\d*`,n=`\\d*[A-Za-z-][\\dA-Za-z-]*|${t}`,r=`(?:${n})(?:\\.(?:${n}))*`,i=`[\\dA-Za-z-]+(?:\\.[\\dA-Za-z-]+)*`,a=`[*Xx]`,o=RegExp(`^(${t})\\.(${t})\\.(${t})(?:-(${r}))?(?:\\+(${i}))?$`,`u`),s=RegExp(`^(?:${r})?$`,`u`),c=RegExp(`^(?:${i})?$`,`u`),l=RegExp(`^ *${a} *$`,`u`),u=RegExp(`^ *(?:(>=|<=|=|>|<|~|\\^) *)?(${t})(?:\\.(?:(${a})(?:\\.${a})?|(${t})(?:\\.(?:(${a})|(${t})(?:-(${r}))?(?:\\+${i})?))?))? *$`,`u`);function d(t){if(t===void 0)return;if(t.length>20)return null;let n=BigInt(t);return n>e?null:n}var f=t=>typeof t==`bigint`&&t>=0n&&t<=e;function p(e){if(typeof e!=`string`)throw TypeError(`expected a string`);return e}function m(e){let t=o.exec(p(e));if(t===null)return;let[n,r,i]=t.slice(1,4).map(d);if(![n,r,i].includes(null))return{major:n,minor:r,patch:i,pre:t[4]??``,build:t[5]??``}}function h(e){let t=u.exec(e);if(t===null)return;let[,n,r,i,a,o,s,c=``]=t,[l,f,p]=[r,a,s].map(d);if(![l,f,p].includes(null))return{op:n??(i||o?`*`:`^`),major:l,minor:f,patch:p,pre:c}}var g=32;function _(e){if(l.test(p(e)))return[];let t=e.split(`,`,g+1);if(t.length>g)return;let n=t.map(h);return n.includes(void 0)?void 0:n}var v=(e,t)=>e===t?0:e<t?-1:1;function y(e,t){if(e===t)return 0;if(e===``)return 1;if(t===``)return-1;let[n,r]=[e.split(`.`),t.split(`.`)];for(let[e,t]of n.entries()){let n=r[e];if(n===void 0)return 1;let[i,a]=[/^\d+$/u.test(t),/^\d+$/u.test(n)];if(i!==a)return i?-1:1;let o=i&&v(t.length,n.length)||v(t,n);if(o!==0)return o}return n.length===r.length?0:-1}function b(e,t){for(let n of[`major`,`minor`,`patch`]){if(e[n]===void 0)return t.pre===e.pre?0:NaN;if(t[n]!==e[n])return v(t[n],e[n])}return y(t.pre,e.pre)}var x=(e,t)=>t.major===e.major&&(e.minor===void 0||t.minor===e.minor)&&b(e,t)>=0;function S(e,t){return t.major===e.major?e.minor===void 0?!0:e.patch===void 0?e.major>0n?t.minor>=e.minor:t.minor===e.minor:(e.major>0n||t.minor===e.minor&&(e.minor>0n||t.patch===e.patch))&&b(e,t)>=0:!1}var C=new Map([[`=`,(e,t)=>b(e,t)===0],[`*`,(e,t)=>b(e,t)===0],[`>`,(e,t)=>b(e,t)>0],[`>=`,(e,t)=>b(e,t)>=0],[`<`,(e,t)=>b(e,t)<0],[`<=`,(e,t)=>b(e,t)<=0],[`~`,x],[`^`,S]]);function w(e){let{major:t,minor:n,patch:r,pre:i,build:a}=e??{};return f(t)&&f(n)&&f(r)&&typeof i==`string`&&s.test(i)&&typeof a==`string`&&c.test(a)?{major:t,minor:n,patch:r,pre:i,build:a}:void 0}function T(e){let{op:t,major:n,minor:r,patch:i,pre:a}=e??{};return C.has(t)&&f(n)&&(r===void 0||f(r))&&(i===void 0||r!==void 0&&t!==`*`&&f(i))&&typeof a==`string`&&s.test(a)&&(a===``||i!==void 0)?{op:t,major:n,minor:r,patch:i,pre:a}:void 0}function E(e){if(!Array.isArray(e))return;let{length:t}=e;if(t>g)return;let n=Array.from({length:t},(t,n)=>T(e[n]));return n.includes(void 0)?void 0:n}function D(e,t){let n=E(e);if(n===void 0)throw TypeError(`expected comparators, as parseVersionReq makes`);let r=w(t);if(r===void 0)throw TypeError(`expected a version, as parseVersion makes`);return n.every(e=>C.get(e.op)(e,r))?r.pre===``||n.some(e=>e.major===r.major&&e.minor===r.minor&&e.patch===r.patch&&e.pre!==``):!1}export{p as a,m as b,_ as c,D as d};
@@ -0,0 +1 @@
1
+ import{j as e}from"./chunk-QRKFPLA4.js";var t=new Set([`overview`,`graph`,`treemap`,`compare`,`advisories`,`issues`,`code`,`search`,`terminal`]),n=/^\d+$/u;function r(e){for(let t=0;t<e.length;t++){let n=e.codePointAt(t);if(n<32||n===127)return!0}return!1}var i=512;function a(e){return typeof e==`string`&&e.length>0&&e.length<=i&&!r(e)}function o(e){return a(e)&&!n.test(e)}function s(e){return e===`completed`||e===`not_planned`||e===`duplicate`?e:`unknown`}function c(e){let[t,n,r]=e.split(`/`);return r===void 0&&t!==void 0&&n!==void 0&&t.length<=39&&/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u.test(t)&&n.length<=100&&n!==`.`&&n!==`..`&&/^[a-zA-Z\d._-]+$/u.test(n)}function l(e,t){if(typeof e!=`string`||e.length>2048)return null;let n;try{n=new URL(e)}catch{return null}if(n.href!==e||n.origin!==`https://github.com`||n.username||n.password)return null;let r=t.exec(n.pathname);if(!r)return null;let i=`${r[1]}/${r[2]}`,a=Number(r[3]);return!c(i)||!Number.isSafeInteger(a)||a<=0?null:{repo:i,number:a}}function u(e){return l(e,/^\/([^/]+)\/([^/]+)\/pull\/(\d+)(?:\/(?:files|commits|checks))?\/?$/u)}function d(e){return l(e,/^\/([^/]+)\/([^/]+)\/issues\/(\d+)\/?$/u)}function f(e){let t=u(e);if(t)return{...t,kind:`pull`};let n=d(e);return n?{...n,kind:`issue`}:null}function p(e){return`${e.repo.toLowerCase()}#${e.kind}:${e.number}`}var m=/^(?=.{1,214}$)(?:@[\w.-]+\/[\w-]|[\dA-Za-z])[\w.-]*$/u,h=/^(?=.{1,256}$)[\dA-Za-z][\w.+-]*$/u,ee=/^@[\da-z~-][\w.~-]*$/u,te=/^[\da-f]{64}$/u;function g(e){return typeof e==`string`&&m.test(e)}function _(e){return typeof e==`string`&&h.test(e)}function v(e){return typeof e==`string`&&te.test(e)}function y(e){return typeof e==`string`&&e.length>0&&e.length<=1024&&!/[\p{Cc}\\]/u.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}function ne(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase(),n=t.startsWith(`@`)?t:`@${t}`;return n.length<=214&&ee.test(n)?n:null}function re(e,t){if(t?.reviewedBases)return e.base??null;let n=e.patch&&e.was?.includes(e.version)?e.version:e.was?.find(t=>t!==e.version);return n?{name:e.name,version:n}:null}var b=new Set([`pulls`,`versions`,`branch`,`reviews`]),x=e=>[e?.repoId,e?.number].every(e=>Number.isSafeInteger(e)&&e>0);function S(e){return e.view===`workspace-dependencies`?x(e.pullReview)?{pullReview:{repoId:e.pullReview.repoId,number:e.pullReview.number}}:e.dependencyTab==null?{}:{dependencyTab:e.dependencyTab}:{}}function C(e,t){let{dependencyTab:n=`pulls`,pullReview:r}=S(t);return b.has(n)?r?`/team/${e}/dependencies/review/${r.repoId}/${r.number}`:`/team/${e}/dependencies${n===`pulls`?``:`/${n}`}`:null}function w(e){let t=/^\/team\/([A-Za-z0-9_-]+)\/dependencies\/(?:([a-z]+)|review\/([1-9]\d{0,14})\/([1-9]\d{0,14}))$/u.exec(e);if(t)return t[3]?{view:`workspace-dependencies`,teamSlug:t[1],pullReview:{repoId:Number(t[3]),number:Number(t[4])}}:b.has(t[2])?{view:`workspace-dependencies`,teamSlug:t[1],dependencyTab:t[2]}:null}var T=Object.freeze({all:`all`,team:`team`,repo:`repository`}),E=(e,t)=>e===`team`?typeof t==`string`&&/^[A-Za-z0-9_-]+$/u.test(t):e===`repo`&&Number.isSafeInteger(t)&&t>0;function ie(e){let t=e.riskScope??`team`,n=e.riskTarget??null;return!Object.hasOwn(T,t)||n!=null&&!E(t,n)?null:`/manage/risk/${T[t]}${n==null?``:`/${n}`}`}function ae(e){if(e===`/manage/risk/team`||e===`/manage/repositories/risk`)return{view:`manage-repo-risk`};if(!e.startsWith(`/manage/risk/`))return;let t=/^\/manage\/risk\/(?:(all)|(team)\/([A-Za-z0-9_-]+)|repository(?:\/([1-9]\d*))?)$/u.exec(e);if(!t)return null;if(t[1])return{view:`manage-repo-risk`,riskScope:`all`};let[n,r]=t[2]?[`team`,t[3]]:[`repo`,t[4]==null?null:Number(t[4])];return r!=null&&!E(n,r)?null:{view:`manage-repo-risk`,riskScope:n,...r==null?{}:{riskTarget:r}}}var D=[[`whitespace`,`hideWhitespace`],[`type-only`,`hideTypes`]],O=[[`on`,`indented`],[`folded`,`folded`]];function k(e){let t=D.filter(([,t])=>e[t]===!0).map(([e])=>e),n=O.find(([,t])=>t===e.pretty)?.[0];return[...t.length>0?[`hide=${t.join(`,`)}`]:[],...n?[`pretty=${n}`]:[]]}function A(e){let t=new Set(e.getAll(`hide`).flatMap(e=>e.split(`,`))),n=O.find(([t])=>t===e.get(`pretty`))?.[1];return{...Object.fromEntries(D.filter(([e])=>t.has(e)).map(([,e])=>[e,!0])),...n?{pretty:n}:{}}}var j=e=>typeof e==`string`&&e.length>0&&e.length<=256&&!/[\p{Cc}]/u.test(e);function M(t){let n=t.get(`repo`),r=new Set((t.get(`severity`)??``).split(`,`)),i=e.filter(e=>r.has(e)),a={...j(n)?{repo:n}:{},...i.length>0?{severities:i}:{}};return Object.keys(a).length>0?{filters:a}:{}}function oe(t){let n=e.filter(e=>t?.severities?.includes(e)),r=[...j(t?.repo)?[`repo=${encodeURIComponent(t.repo).replaceAll(`%2F`,`/`)}`]:[],...n.length>0?[`severity=${n.join(`,`)}`]:[]];return r.length>0?`?${r.join(`&`)}`:``}var N=new Set([`code`,`diff`]),se=e=>N.has(e)?`code`:`overview`,P=e=>N.has(e)?{compareMode:`code`}:{},F=e=>N.has(e)?`/code`:``,I=Object.freeze({manage:`/manage`,"manage-bundles":`/manage/bundle`,"manage-scans":`/manage/scans`,"manage-reports":`/manage/report`,"manage-repos":`/manage/repositories`,"manage-repo-risk":`/manage/risk`,"admin-users":`/manage/users`,"manage-teams":`/manage/team`,"manage-import":`/manage/import`,"manage-links":`/manage/links`,"manage-deduplication":`/manage/deduplication`,"manage-history":`/manage/history`}),L=new Set([`workspace-reports`,`workspace-bundles`,`workspace-repositories`,`workspace-dependencies`,`workspace-risk`]);function R(e){if(!o(e)||e===`.`||e===`..`)return null;try{return`/finding/${encodeURIComponent(e)}`}catch{return null}}function z(e){if(!e)return null;if(e.view===`home`)return`/`;if(e.view===`reviews`)return`/my/reviews`;if(e.view===`profile`)return`/my/profile`;if(e.view===`npm`)return H(e);if(e.view===`repository-code`)return ue(e);if(L.has(e.view))return/^[A-Za-z0-9_-]+$/u.test(e.teamSlug??``)?e.view===`workspace-dependencies`?C(e.teamSlug,e):`/team/${e.teamSlug}/${e.view.slice(10)}`:null;if(e.view===`bundles`){if(!/^[A-Za-z0-9_-]+$/u.test(e.bundleSlug??``)||[e.teamSlug,e.compareSlug].some(e=>e!=null&&!/^[A-Za-z0-9_-]+$/u.test(e)))return null;let n=e.bundleTab??`overview`;if(!t.has(n))return null;let r=e.teamSlug?`/team/${e.teamSlug}`:`/manage`,i=n===`code`&&Z(e.file)?`/${e.file}`:``,a=i&&Z(e.line)?`#L${e.line}${Z(e.endLine)&&e.endLine>e.line?`-L${e.endLine}`:``}`:``,o=n===`compare`&&e.compareSlug!=null?`/${e.compareSlug}${F(e.compareMode)}`:``;return`${r}/bundle/${e.bundleSlug}${n===`overview`?``:`/${n}`}${i}${o}${a}`}if(e.view===`manage-repo-risk`)return ie(e);if(Object.hasOwn(I,e.view)){let t=I[e.view];return e.view===`manage-deduplication`&&e.linkId?`${t}?report=${encodeURIComponent(e.linkId)}`:e.view===`manage-bundles`&&Number.isSafeInteger(e.createRepoId)&&e.createRepoId>0?`${t}?createRepo=${e.createRepoId}`:e.view===`manage-scans`&&e.scanMode===`link`?`${t}?mode=link`:e.view===`manage-scans`&&e.bundleId?`${t}?bundle=${encodeURIComponent(e.bundleId)}${e.scanMode===`dependencies`?`&mode=dependencies`:``}`:e.view===`manage-history`&&e.actor?`${t}?actor=${encodeURIComponent(e.actor)}`:t}if(![`findings`,`files`].includes(e.view)||!e.teamSlug||[e.teamSlug,e.reportSlug].some(e=>e!=null&&!/^[A-Za-z0-9_-]+$/u.test(e)))return null;let n=`/team/${encodeURIComponent(e.teamSlug)}`,r=e.reportSlug?`/report/${encodeURIComponent(e.reportSlug)}`:``;if(e.finding){let t=R(e.finding.id);return e.view===`findings`&&t?`${n}${r}${t}`:null}return e.view===`files`?`${n}${r}/files`:`${n}${r}${r?``:oe(e.filters)}`}var B=new Set([`overview`,`code`,`search`,`compare`,`review`,`treemap`]),V=e=>v(e?.hash)&&(e.repoId==null?e.commit==null&&e.path==null:(Y(e.repoId)||typeof e.repoId==`string`&&c(e.repoId))&&q.test(e.commit??``)&&(e.path==null||y(e.path)));function H(e){if(e.packageName==null)return`/npm`;let t=e.bundleTab??`overview`;if(!g(e.packageName)||e.packageSpec!=null&&!_(e.packageSpec)||!B.has(t)||e.compareSpec!=null&&!_(e.compareSpec))return null;if(t===`review`){if(e.reviewPackage!=null&&!g(e.reviewPackage)||e.reviewSpec!=null&&!_(e.reviewSpec)||e.patch!=null&&!V(e.patch)||e.basePatch!=null&&(!v(e.basePatch)||e.reviewPackage==null))return null;let t=e.reviewPackage==null?``:`/${e.reviewPackage}${e.reviewSpec==null?``:`@${e.reviewSpec}`}`,{patch:n}=e,r=[...n==null?[]:[`patch=${n.hash}`],...n?.repoId==null?[]:[`repo=${n.repoId}&commit=${n.commit}`],...n?.path==null?[]:[`path=${n.path.split(`/`).map(encodeURIComponent).join(`/`)}`],...e.basePatch==null?[]:[`basePatch=${e.basePatch}`],...k(e)].join(`&`);return`/npm/${e.packageName}${e.packageSpec==null?``:`@${e.packageSpec}`}/review${t}${r?`?${r}`:``}`}let n=t===`code`&&Z(e.file)?`/${e.file}`:``,r=n&&Z(e.line)?`#L${e.line}${Z(e.endLine)&&e.endLine>e.line?`-L${e.endLine}`:``}`:``,i=t===`compare`&&e.compareSpec!=null?`/${e.compareSpec}${F(e.compareMode)}`:``;return`/npm/${e.packageName}${e.packageSpec==null?``:`@${e.packageSpec}`}${t===`overview`?``:`/${t}`}${n}${i}${r}`}function U(e,t,n){let r=/^\/npm\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?\/review(?:\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?)?$/u.exec(e);if(r){if(!g(r[1])||r[2]!=null&&!_(r[2])||r[3]!=null&&!g(r[3])||r[4]!=null&&!_(r[4]))return null;let e=r[3]&&/^\d+\.\d+\.\d+(?:[-+].*)?$/u.test(r[3])&&r[4]==null,t=[`repo`,`commit`,`path`].some(e=>n.has(e))?{repoId:/^[1-9]\d*$/u.test(n.get(`repo`)??``)?Number(n.get(`repo`)):n.get(`repo`),commit:n.get(`commit`)}:{},i=n.has(`patch`)?{hash:n.get(`patch`),...t,...n.has(`path`)?{path:n.get(`path`)}:{}}:null,a=n.get(`basePatch`);return i&&!V(i)||a!==null&&(!v(a)||!r[3])?null:{view:`npm`,packageName:r[1],packageSpec:r[2]??null,bundleTab:`review`,...r[3]?{reviewPackage:e?r[1]:r[3],reviewSpec:e?r[3]:r[4]??null}:{},...i?{patch:i}:{},...a?{basePatch:a}:{},...A(n)}}let i=/^\/npm(?:\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?(?:\/(code|search|compare|treemap)(?:\/([^/]+)(?:\/([a-z]+))?)?)?)?$/u.exec(e);if(!i)return;if(i[1]==null)return{view:`npm`};if(!g(i[1])||i[2]!=null&&!_(i[2]))return null;let a={view:`npm`,packageName:i[1],packageSpec:i[2]??null,bundleTab:i[3]??`overview`};if(i[4]==null)return a;if(a.bundleTab===`compare`)return _(i[4])&&(i[5]==null||N.has(i[5]))?{...a,compareSpec:i[4],...P(i[5])}:null;if(a.bundleTab!==`code`)return null;let o=Number(i[4]);return!i[5]&&/^[1-9]\d*$/u.test(i[4])&&Number.isSafeInteger(o)?{...a,file:o,...Q(t)}:null}var W=new Set([`code`,`search`,`treemap`,`compare`,`commits`,`issues`,`pulls`,`agents`,`pulse`,`replay`]),G=new Set([`commits`,`issues`,`pulls`,`agents`,`pulse`,`replay`]),ce=new Map([[`issues`,new Set([`closed`])],[`pulls`,new Set([`closed`])],[`pulse`,new Set([`week`,`quarter`,`year`])],[`replay`,new Set([`100`,`1000`])]]),le=/^[a-z][a-z\d-]{0,31}$/u,K=(e,t)=>e===`agents`?typeof t==`string`&&le.test(t)&&t!==`all`:ce.get(e)?.has(t)===!0,q=/^[a-f\d]{40}$/u,J=500,Y=e=>Number.isSafeInteger(e)&&e>0;function X(e){return typeof e==`string`&&(e===``||e.length<=J&&!/[\p{Cc}\\]/u.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e===e.trim()))}function ue(e){let t=e.bundleTab??`code`,n=e.path??``;if(!Y(e.repoId)||e.commit!=null&&!q.test(e.commit)||!X(n)||!W.has(t)||e.compareCommit!=null&&!q.test(e.compareCommit))return null;let r=n?`?path=${n.split(`/`).map(encodeURIComponent).join(`/`)}`:``;if(e.commit==null)return`/repo/${e.repoId}${r}`;let i=t===`code`&&Z(e.file)?`/code/${e.file}`:t===`code`?``:`/${t}`,a=t===`compare`&&e.compareCommit!=null?`/${e.compareCommit}${F(e.compareMode)}`:``,o=K(t,e.subtab)?`/${e.subtab}`:``,s=t===`code`&&Z(e.file)&&Z(e.line)?`#L${e.line}${Z(e.endLine)&&e.endLine>e.line?`-L${e.endLine}`:``}`:``;return`/repo/${e.repoId}/${e.commit}${i}${a}${o}${r}${s}`}function de(e){let t=/^\/(?:repo|manage\/code)\/([1-9]\d*)(?:\/([a-f\d]{40})(?:\/(code|search|treemap|compare|commits|history|issues|pulls|agents|pulse|replay)(?:\/([^/]+)(?:\/([a-z]+))?)?)?)?$/u.exec(e.pathname.replace(/\/$/u,``));if(!t)return;let n=Number(t[1]),r=e.searchParams.get(`path`)??``,i=t[3]===`history`?`commits`:t[3]??`code`;if(!Y(n)||!X(r))return null;let a={view:`repository-code`,repoId:n,commit:t[2]??null,path:r,bundleTab:i};if(t[4]==null)return a;if(i===`compare`)return q.test(t[4])&&(t[5]==null||N.has(t[5]))?{...a,compareCommit:t[4],...P(t[5])}:null;if(G.has(i))return t[5]==null&&K(i,t[4])?{...a,subtab:t[4]}:null;let o=Number(t[4]);return i===`code`&&t[5]==null&&/^[1-9]\d*$/u.test(t[4])&&Number.isSafeInteger(o)?{...a,file:o,...Q(e.hash)}:null}function Z(e){return Number.isSafeInteger(e)&&e>0}function Q(e){let t=/^#L([1-9]\d*)(?:-L([1-9]\d*))?$/u.exec(e),[n,r]=t?[Number(t[1]),Number(t[2]??t[1])]:[];return!Z(n)||!Z(r)?{}:n===r?{line:n}:{line:Math.min(n,r),endLine:Math.max(n,r)}}function fe(e){let n=e.pathname.replace(/\/$/u,``)||`/`;if(n===`/`||n===`/index.html`)return{view:`home`};if(n===`/my/reviews`)return{view:`reviews`};if(n===`/my/profile`){let t=e.searchParams.get(`link-error`);return{view:`profile`,...t&&/^[a-z-]{1,64}$/u.test(t)?{linkError:t}:{}}}let r=Object.keys(I).find(e=>I[e]===n);if(r){let t=Number(e.searchParams.get(`createRepo`));return{view:r,...r===`manage-deduplication`&&e.searchParams.get(`report`)?{linkId:e.searchParams.get(`report`)}:{},...r===`manage-bundles`&&Number.isSafeInteger(t)&&t>0?{createRepoId:t}:{},...r===`manage-history`&&e.searchParams.get(`actor`)?{actor:e.searchParams.get(`actor`)}:{},...r===`manage-scans`?e.searchParams.get(`mode`)===`link`?{scanMode:`link`}:e.searchParams.get(`bundle`)?{bundleId:e.searchParams.get(`bundle`),...e.searchParams.get(`mode`)===`dependencies`?{scanMode:`dependencies`}:{}}:{}:{}}}let a=/^(?:\/team\/([A-Za-z0-9_-]+)|\/manage)\/bundle\/([A-Za-z0-9_-]+)(?:\/([a-z]+)(?:\/([A-Za-z0-9_-]+)(?:\/([a-z]+))?)?)?$/u.exec(n);if(a){let n=a[3]??`overview`;if(!t.has(n))return null;let r={view:`bundles`,teamSlug:a[1]??null,bundleSlug:a[2],bundleTab:n};if(a[4]==null)return r;if(n===`compare`)return a[5]==null||N.has(a[5])?{...r,compareSlug:a[4],...P(a[5])}:null;let i=Number(a[4]);return n!==`code`||a[5]||!/^[1-9]\d*$/u.test(a[4])||!Number.isSafeInteger(i)?null:{...r,file:i,...Q(e.hash)}}let o=U(n,e.hash,e.searchParams);if(o!==void 0)return o;let s=de(e);if(s!==void 0)return s;let c=/^\/team\/([A-Za-z0-9_-]+)\/(reports|bundles|repositories|dependencies|risk)$/u.exec(n);if(c)return{view:`workspace-${c[2]}`,teamSlug:c[1]};let l=w(n);if(l!==void 0)return l;let u=/^\/team\/([^/]+)(?:\/report\/([^/]+))?(?:\/(files)|\/finding\/([^/]+))?$/u.exec(n);if(!u)return ae(n)??null;try{let t=decodeURIComponent(u[1]),n=u[2]?decodeURIComponent(u[2]):null;if([t,n].some(e=>e!=null&&!/^[A-Za-z0-9_-]+$/u.test(e))||u[4]?.length>i*9)return null;let r=u[4]?decodeURIComponent(u[4]):null;return r!=null&&!R(r)?null:u[3]?{view:`files`,teamSlug:t,reportSlug:n}:r==null?{view:`findings`,teamSlug:t,reportSlug:n,...n==null?M(e.searchParams):{}}:{view:`findings`,teamSlug:t,reportSlug:n,finding:{id:r}}}catch{return null}}function $(e,t,n=[]){if(L.has(e.view)){let n=t.filter(t=>t.slug===e.teamSlug);return n.length===1?{view:e.view,teamId:n[0].id,...S(e)}:null}if(e.view===`bundles`){let{teamSlug:r,bundleSlug:i,compareSlug:a,compareMode:o,...s}=e,c=r==null?[]:t.filter(e=>e.slug===r);if(r!=null&&c.length!==1)return null;let l=c[0],u=r==null?n:t.flatMap(e=>e.bundles??[]),d=e=>new Set(u.filter(t=>t.slug===e).map(e=>e.id)),f=d(i),p=(l?.bundles??n).find(e=>e.slug===i);if(!i||!p||f.size!==1)return null;let m=a==null?null:d(a),h=m?.size===1?{compareId:[...m][0],...P(o)}:{};return{...s,teamId:l?.id??null,bundleId:p.id,...h}}if(![`findings`,`files`].includes(e.view))return e;let{teamSlug:r,reportSlug:i,...a}=e,o=t.filter(e=>e.slug===r),s=r&&o.length===1?o[0]:null,c=new Set(t.flatMap(e=>e.reports??[]).filter(e=>e.slug===i).map(e=>e.id)),l=i!=null&&c.size===1?[...c][0]:null;return a.finding?{...a,teamId:s?.id??null,reportId:l,teamOnly:i==null}:s?i==null?{...a,teamId:s.id,reportId:null}:(s.reports??[]).some(e=>e.id===l)?{...a,teamId:s.id,reportId:l}:null:null}function pe(e,t,n=[]){if(L.has(e.view)){let n=t.find(t=>t.id===e.teamId),r={view:e.view,teamSlug:n?.slug,...S(e)};return n?.slug&&$(r,t)?r:null}if(e.view===`bundles`){let{teamId:r,bundleId:i,compareId:a,compareMode:o,...s}=e,c=t.find(e=>e.id===r);if(r!=null&&!c?.slug)return null;let l=(c?.bundles??n).find(e=>e.id===i);if(!l?.slug)return null;let u=a==null?null:(r==null?n:t.flatMap(e=>e.bundles??[])).find(e=>e.id===a),d={...s,teamSlug:c?.slug??null,bundleSlug:l.slug,...u?.slug?{compareSlug:u.slug,...P(o)}:{}},f=$(d,t,n);if(!f)return null;if(d.compareSlug!=null&&f.compareId!==a){let{compareSlug:e,compareMode:t,...n}=d;return n}return d}if(![`findings`,`files`].includes(e.view))return e;let{teamId:r,reportId:i,...a}=e,o=t.find(e=>e.id===r),s=i==null?null:o?.reports?.find(e=>e.id===i);if(!o?.slug||i!=null&&!s?.slug)return null;let c={...a,teamSlug:o.slug,reportSlug:s?.slug??null},l=$(c,t);return l?.teamId===o.id&&l.reportId===(s?.id??null)?c:null}export{t as a,i as b,o as c,s as d,u as e,d as f,f as g,p as h,g as i,_ as j,v as k,y as l,ne as m,re as n,b as o,se as p,P as q,I as r,z as s,B as t,W as u,G as v,K as w,fe as x,$ as y,pe as z};
@@ -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-CU3FPB3P.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-GX5UXWT4.js";import{H as T,M as E,m as D}from"./chunk-LVW7WWV4.js";import"./chunk-ZQHLECTI.js";import{a as O,b as k,d as ee,e as A,g as j}from"./chunk-VYYUMYVW.js";import{d as M,h as N,i as P}from"./chunk-7HP2VYIC.js";import"./chunk-PXK7EU4V.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{e}from"./chunk-ZQHLECTI.js";import{d as t,f as n,h as r,i}from"./chunk-7HP2VYIC.js";var a=Object.freeze(Object.create(null));function o(e){return e===void 0?`nothing`:e===null?`null`:Array.isArray(e)?`a sequence`:typeof e==`object`?`a mapping`:typeof e==`string`?`the string ${r(e)}`:`the ${typeof e} ${String(e)}`}function s(e,n,a,o,s){let c=(n,r,i)=>new t(`expected ${n}, found ${e(r)}`,i),l=(e,t)=>(n,r)=>{if(!e(n))throw c(t,n,r);return n},u=(e,s,l,u={})=>{if(!n(e))throw c(a,e,s);for(let n of l===void 0?[]:Object.keys(e)){if(Object.hasOwn(u,n))throw new t(u[n],i(s??``,n));if(!l.includes(n))throw new t(`unsupported ${o} ${r(n)}`,s)}return e};return{refuse:c,record:u,entries:(e,t)=>Object.entries(u(e,t)).map(([e,n])=>[e,n,i(t,e)]),sequence:l(Array.isArray,s),string:l(e=>typeof e==`string`,`a string`),boolean:l(e=>typeof e==`boolean`,`true or false`),count:l(e=>Number.isSafeInteger(e)&&e>=0,`a non-negative integer`)}}var c=e=>typeof e==`object`&&!!e&&!Array.isArray(e),{refuse:l,record:u,entries:d,sequence:f,string:p,boolean:m,count:h}=s(o,c,`a mapping`,`field`,`a sequence`),g=e=>e===void 0?a:e,ee=e=>(t,n)=>t===void 0?void 0:e(t,n),_=(e,t,n,r)=>e[t]===void 0?void 0:r(e[t],i(n,t));function v(e,n){if(p(e,n)===``)throw new t(`expected a non-empty string`,n);return e}function y(e,t,n=e=>e){return f(e,t).map((e,r)=>n(v(e,`${t}[${r}]`),`${t}[${r}]`))}function b(e,t,n,r=d){let i=Object.create(null);for(let[a,o,s]of r(e,t))i[a]=n(o,s,a);return i}var x=(e,t,n=()=>{})=>b(e,t,(e,t,r)=>(n(r,t),p(e,t)));function S(e,t){if(e!==void 0&&e!==!0)throw l(`true`,e,t);return e===!0}var C=e=>(n,i)=>(a,o)=>{let s=e(a,o);if(!n(s))throw new t(`${r(s)} is not ${i}`,o);return s};function w(e,t=e=>e){let n=new Set;return e.find(e=>n.size===n.add(t(e)).size)}function T(e,t){if(!c(e))throw TypeError(`expected an options object`);let n=Object.keys(e).find(e=>!t.includes(e));if(n!==void 0)throw TypeError(`unknown option ${r(n)}, of ${t.join(`, `)}`);return e}function te({checkVersions:e=!0,semver:t},n){if(typeof e!=`boolean`)throw TypeError(`checkVersions: expected a boolean`);if(t!==void 0&&!n.every(e=>typeof t?.[e]==`function`))throw TypeError(`semver: expected the semver package, with ${n.join(`, `)}`);if(e&&t===void 0)throw TypeError(`checkVersions needs semver: pass it as semver, or set checkVersions to false`);return e}var E=C(v),ne=/^(?:@[\dA-Za-z~-][\w.~-]*\/)?[\dA-Za-z~-][\w.~-]*$/u,D=e=>e.length<=214&&ne.test(e);function O(e,n){if(!D(e))throw new t(`${r(e)} is not a package name`,n);return e}var k=`(0|[1-9]\\d*)`,A=`(?:0|[1-9]\\d*|\\d*[A-Za-z-][\\dA-Za-z-]*)`,j=RegExp(`^${k}\\.${k}\\.${k}(?:-${A}(?:\\.${A})*)?(?:\\+[\\dA-Za-z-]+(?:\\.[\\dA-Za-z-]+)*)?$`,`u`);function M(e){if(e.length>256)return!1;let t=j.exec(e);return t!==null&&t.slice(1,4).every(e=>Number(e)<=2**53-1)}var N=E(M,`a version`),P=/[\p{Cc}\p{Zl}\p{Zp}\p{Bidi_Control}\\]/u,F=e=>e!==``&&e!==`.`&&e!==`..`&&!P.test(e),I=e=>!/^[A-Za-z]:/u.test(e)&&e.split(`/`).every(F);function L(e,n){let i=v(e,n);if(i===`.`)return i;let a=!0;for(let e of i.split(`/`))if(!(e===`..`&&a)&&(a=!1,!F(e)))throw new t(`${r(i)} is not a relative path in normal form`,n);if(/^[A-Za-z]:/u.test(i))throw new t(`${r(i)} starts with a drive letter`,n);return i}function R(e,n){let i=L(e,n);if(i===`..`||i.startsWith(`../`))throw new t(`${r(i)} climbs out of the directory it is in`,n);return i}function z(e,t){let n=e===`.`?[]:e.split(`/`);for(let e of t===`.`?[]:t.split(`/`))e===`..`&&n.length>0&&n.at(-1)!==`..`?n.pop():n.push(e);return n.length===0?`.`:n.join(`/`)}var B=(e,t)=>z(e,t.split(`/`).filter(e=>e!==``&&e!==`.`).join(`/`)||`.`);function V(e,t){let n=e===`.`?[]:e.split(`/`),r=t===`.`?[]:t.split(`/`),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return[...n.slice(i).map(()=>`..`),...r.slice(i)].join(`/`)||`.`}var H=e=>/^(?:[\da-f]{40}|[\da-f]{64})$/u.test(e),re=e=>/^[\da-f]{64}$/u.test(e),U=e=>/^[\da-f]{40}$/u.test(e),W=/^$|^@$|^-|[\p{Cc}\p{Zl}\p{Zp}\p{Bidi_Control} ~^:?*[\\]|\.\.|@\{|^\/|\/$|\/\/|(?:^|\/)\.|\.lock(?:\/|$)|\.$/u,G=E(e=>!W.test(e),`a branch or tag name git takes`),K=/^(?:[^/:]*:\/\/)?(?:[^/@]*@)?-/u,q=/^[\dA-Za-z][\d+.A-Za-z-]*::/u,J=e=>e.replace(/%([\dA-Fa-f]{2})/gu,(e,t)=>String.fromCodePoint(Number.parseInt(t,16)));function Y(e,n){let i=v(e,n);if(K.test(i)||K.test(J(i)))throw new t(`${r(i)} has a "-" where git or ssh would read an option`,n);if(q.test(i))throw new t(`${r(i)} names a remote helper of git's, which is not supported`,n);return i}function X(e,n){if(/[\s\p{Cc}]/u.test(v(e,n)))throw new t(`${r(e)} is not a repository URL`,n);return Y(e,n)}var ie={__proto__:null,sha1:20,sha256:32,sha384:48,sha512:64},ae=t=>n(()=>e(t,{padding:!0}).length,()=>{});function Z(e,n){let i=v(e,n),a=i.indexOf(`-`),o=a===-1?void 0:ie[i.slice(0,a)];if(o===void 0||ae(i.slice(a+1))!==o)throw new t(`${r(e)} is not a sha1, sha256, sha384 or sha512 integrity`,n);return e}function oe(e,n){let r=new Map;for(let i of v(e,n).split(` `)){let e=Z(i,n).slice(0,i.indexOf(`-`));if(r.has(e))throw new t(`two ${e} integrities`,n);r.set(e,i)}return r}var se=/^(?:https?|ssh|git|git\+ssh|ssh\+git):\/\/[^/]/u,Q=/^(?:[^@/:\\]+@)?(?:\[[^\]/\\]+\]|[^@/:\\[\]]+):(?!:|\/\/)/u;function ce(e,n,i){if(/^[^[]:(?!:)/u.test(e))throw new t(`${r(e)} is a path on a drive to ${i} on Windows, and a host's to git elsewhere`,n);if(se.test(e)?!URL.canParse(e):!Q.test(e)||e.includes(`\\`))throw new t(`${r(e)} is not a URL of a host that git fetches from: http(s), ssh, git, or user@host:path`,n);return e}var $=e=>/^https?:\/\//u.test(e)&&!/[\s\p{Cc}]/u.test(e)&&URL.canParse(e),le=e=>$(e.replace(/^https?:/iu,e=>e.toLowerCase())),ue=new Set([`registry.npmjs.org`,`registry.npmjs.com`,`registry.yarnpkg.com`]);function de(e,n,i,a){let o=new URL(e),s=o.hostname.replace(/(?<!\.)\.+$/u,``);if(ue.has(s)&&o.pathname.replace(/^(\/@[^/]+)%2f/iu,`$1/`)!==`/${n}/-/${n.slice(n.indexOf(`/`)+1)}-${i}.tgz`)throw new t(`${r(e)} is not the registry's tarball of ${n}@${i}`,a)}export{o as a,s as b,c,l as d,u as e,d as f,f as g,p as h,m as i,h as j,g as k,ee as l,_ as m,v as n,y as o,b as p,x as q,S as r,C as s,w as t,T as u,te as v,D as w,O as x,M as y,N as z,F as A,I as B,L as C,R as D,z as E,B as F,V as G,H,re as I,U as J,G as K,Y as L,X as M,Z as N,oe as O,ce as P,$ as Q,le as R,de as S};
@@ -0,0 +1,15 @@
1
+ var e=/[ \t\n\v\f\r]+/gu,t=/(?<![ \t\n\v\f\r])[ \t\n\v\f\r]+$/u,n=e=>e.replace(/[A-Z]/gu,e=>e.toLowerCase());function r({ignoreCase:r=!1,whitespace:i=`none`}={}){let a=null;return i===`all`?a=t=>t.replace(e,``):i===`change`?a=n=>n.replace(t,``).replace(e,` `):i===`trailing`&&(a=e=>e.replace(t,``)),r?a?e=>n(a(e)):n:a}var i=e=>e.match(/[^\n]*\n|[^\n]+/gu)??[];function a(e){let t=[];for(let n=0;;){let r=n;for(;n<e.length&&e[n];)n++;if(t.push(n>r),n===e.length)return t;n++}}function o(e,t,n){let r=t.length,i=a(n),o=0,s=0,c=0,l=()=>{if(o===r||e[c]!==e[o])return!1;for(t[c++]=0,t[o++]=1,s++;o<r&&t[o];)o++;return!0},u=()=>{if(c===0||e[c-1]!==e[o-1])return!1;for(t[--c]=1,t[--o]=0,s--;c>0&&t[c-1];)c--;return!0};for(let e=0;e<r;e++){if(!t[e]){s++;continue}for(c=e,o=e;o<r&&t[o];o++);let n=-1;for(let e=-1;e!==o-c;){for(e=o-c;u(););for(n=i[s]?o:-1;l();)i[s]&&(n=o)}if(n!==-1)for(let e=o-n;e>0;e--)u();e=o-1}}function s(e){let t=1;for(let n=e;n!==0;n>>=2)t<<=1;return Math.max(256,t)}function c(e,t,{ignoreCase:n=!1,whitespace:i=`none`,minimal:a=!1,discard:s=!0,slide:c=!0,horizon:d=1/0}={}){let f=r({ignoreCase:n,whitespace:i});if(f===null&&h(e,t))return[];let{A:m,B:v,classes:y}=g(e,t,f),S=new Uint8Array(m.length),C=new Uint8Array(v.length),w=l(e,t,d),[T,E]=a||!s?[null,null]:u(m,v,y,w),D=p(w.lo,w.hiA,T,S),O=p(w.lo,w.hiB,E,C);if(_(D.map(e=>m[e]),O.map(e=>v[e]),D,O,S,C,a),c){let{lo:e,hiA:t,hiB:n}=w;o(m.subarray(e,t),S.subarray(e,t),C.subarray(e,n)),o(v.subarray(e,n),C.subarray(e,n),S.subarray(e,t))}let k=b(S,C);return x(e,t,k,f),k}function l(e,t,n){let r=Math.min(e.length,t.length),i=0;for(;i<r&&e[i]===t[i];)i++;let a=Math.max(0,i-n),o=0;for(;o<r-a&&e[e.length-1-o]===t[t.length-1-o];)o++;let s=Math.max(0,o-n);return{lo:a,hiA:e.length-s,hiB:t.length-s}}function u(e,t,n,{lo:r,hiA:i,hiB:a}){let o=new Int32Array(n),s=new Int32Array(n);for(let t=r;t<i;t++)o[e[t]]++;for(let e=r;e<a;e++)s[t[e]]++;return[d(e.subarray(r,i),s),d(t.subarray(r,a),o)]}function d(e,t){let n=e.length,r=new Uint8Array(n),i=5;for(let e=Math.floor(n/64)>>2;e>0;e>>=2)i*=2;for(let a=0;a<n;a++){let n=t[e[a]];n===0?r[a]=1:n>i&&(r[a]=2)}for(let e=0;e<n;e++){if(r[e]===2){r[e]=0;continue}if(r[e]===0)continue;let t=e,i=0;for(;t<n&&r[t]!==0;t++)r[t]===2&&i++;for(;t>e&&r[t-1]===2;)r[--t]=0,i--;let a=t-e;if(i*4>a){for(;t>e;)r[--t]===2&&(r[t]=0);continue}let o=1;for(let e=a>>4;e>0;e>>=2)o<<=1;o++;for(let t=0,n=0;n<a;n++)r[e+n]===2?o===++t?n-=t:o<t&&(r[e+n]=0):t=0;f(r,e,1,a),f(r,e+a-1,-1,a),e+=a-1}return r}function f(e,t,n,r){for(let i=0,a=0;a<r;a++){let r=t+a*n;if(a>=8&&e[r]===1||(e[r]===2?(i=0,e[r]=0):e[r]===0?i=0:i++,i===3))break}}function p(e,t,n,r){let i=[];for(let a=e;a<t;a++)n!==null&&n[a-e]!==0?r[a]=1:i.push(a);return Int32Array.from(i)}var m=e=>e?(t,n)=>e(t)===e(n):(e,t)=>e===t;function h(e,t,n=null){if(e.length!==t.length)return!1;let r=m(n);for(let n=0;n<e.length;n++)if(!r(e[n],t[n]))return!1;return!0}function g(e,t,n){let r=new Map,i=e=>{let t=n?n(e):e,i=r.get(t);return i===void 0&&(i=r.size,r.set(t,i)),i};return{A:Int32Array.from(e,i),B:Int32Array.from(t,i),classes:r.size}}function _(e,t,n,r,i,a,o){let c=e.length+t.length+3,l={A:e,B:t,fd:new Int32Array(c),bd:new Int32Array(c),base:t.length+1,limit:s(e.length+t.length)},u=[{xoff:0,xlim:e.length,yoff:0,ylim:t.length,minimal:o}];for(;u.length;){let{xoff:o,xlim:s,yoff:c,ylim:d,minimal:f}=u.pop();for(;o<s&&c<d&&e[o]===t[c];)o++,c++;for(;o<s&&c<d&&e[s-1]===t[d-1];)s--,d--;if(o===s){for(;c<d;c++)a[r[c]]=1;continue}if(c===d){for(;o<s;o++)i[n[o]]=1;continue}let{xmid:p,ymid:m,loMinimal:h,hiMinimal:g}=v(l,o,s,c,d,f);u.push({xoff:p,xlim:s,yoff:m,ylim:d,minimal:g}),u.push({xoff:o,xlim:p,yoff:c,ylim:m,minimal:h})}}function v(e,t,n,r,i,a){let{A:o,B:s,fd:c,bd:l,base:u,limit:d}=e,f=n-r,p=t-i,m=n-i,h=t-r,g=m,_=m,v=h,b=h,x=!!(h-m&1);c[u+h]=t,l[u+m]=n;for(let m=1;;m++){b>p?c[u+--b-1]=-1:++b,v<f?c[u+ ++v+1]=-1:--v;for(let e=v;e>=b;e-=2){let t=c[u+e+1],r=c[u+e-1],a=r<t?t:r+1,d=a-e;for(;a<n&&d<i&&o[a]===s[d];)a++,d++;if(c[u+e]=a,x&&_<=e&&e<=g&&l[u+e]<=a)return{xmid:a,ymid:d,loMinimal:!0,hiMinimal:!0}}_>p?l[u+--_-1]=0x7fffffff:++_,g<f?l[u+ ++g+1]=0x7fffffff:--g;for(let e=g;e>=_;e-=2){let n=l[u+e+1],i=l[u+e-1],a=i<n?i:n-1,d=a-e;for(;t<a&&r<d&&o[a-1]===s[d-1];)a--,d--;if(l[u+e]=a,!x&&b<=e&&e<=v&&a<=c[u+e])return{xmid:a,ymid:d,loMinimal:!0,hiMinimal:!0}}if(!a&&m>=d)return y(e,{xoff:t,xlim:n,yoff:r,ylim:i,fmin:b,fmax:v,bmin:_,bmax:g})}}function y(e,t){let{fd:n,bd:r,base:i}=e,{xoff:a,xlim:o,yoff:s,ylim:c,fmin:l,fmax:u,bmin:d,bmax:f}=t,p=0,m=-1;for(let e=u;e>=l;e-=2){let t=Math.min(n[i+e],o),r=t-e;c<r&&(t=c+e,r=c),m<t+r&&(m=t+r,p=t)}let h=0,g=0x7fffffff;for(let e=f;e>=d;e-=2){let t=Math.max(a,r[i+e]),n=t-e;n<s&&(t=s+e,n=s),t+n<g&&(g=t+n,h=t)}return o+c-g<m-(a+s)?{xmid:p,ymid:m-p,loMinimal:!0,hiMinimal:!1}:{xmid:h,ymid:g-h,loMinimal:!1,hiMinimal:!0}}function b(e,t){let n=[],r=t.length,i=e.length,a=0,o=0;for(;a<i||o<r;){if(a<i&&o<r&&!e[a]&&!t[o]){a++,o++;continue}let s=a,c=o;for(;a<i&&e[a];)a++;for(;o<r&&t[o];)o++;if(s===a&&c===o)throw new S(`a kept line has no counterpart`);n.push({a0:s,a1:a,b0:c,b1:o})}return n}function x(e,t,n,r=null){let i=m(r),a=0,o=0;for(let{a0:r,a1:s,b0:c,b1:l}of n){if(r<a||c<o||s<r||l<c||s>e.length||l>t.length)throw new S(`a block is out of order or out of range`);if(r===s&&c===l)throw new S(`a block changes nothing`);if(r-a!==c-o)throw new S(`the kept lines before a block differ in count`);for(;a<r;a++,o++)if(!i(e[a],t[o]))throw new S(`kept line ${a+1} does not match`);a=s,o=l}if(e.length-a!==t.length-o)throw new S(`the kept lines after the last block differ in count`);for(;a<e.length;a++,o++)if(!i(e[a],t[o]))throw new S(`kept line ${a+1} does not match`)}var S=class extends Error{constructor(e){super(`the computed change set does not reconstruct the second file (${e})`),this.name=`DiffError`}},C=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: ?(.*?))?\n?$/u,w=/^\*{15,}(?: (.*?))?\n?$/u,T=/^\*{3} (\d+)(?:,(\d+))? \*{4}\n?$/u,E=/^--- (\d+)(?:,(\d+))? ----\n?$/u,D=/^(\d+)(?:,(\d+))?([acd])(\d+)(?:,(\d+))?[ \t]*\r?\n?$/u,O=class extends Error{constructor(e,t){super(t===void 0?e:`${e} at line ${t+1}`),this.name=`PatchError`,this.line=t}},k=(e,t)=>t===0?Number(e):Number(e)-1,A=e=>e?.startsWith(`\\`),j=e=>e.replace(/\n$/u,``);function M(e){let t=i(e),n=[],r={old:null,new:null},a=!1;for(let e=0;e<t.length;){let i=t[e],o=N(i,a);if(a=!i.startsWith(`***************`)&&i.startsWith(`*** `),o){r=o.names??{...r,[o.slot]:o.name},e++;continue}let s=C.test(i)?`unified`:w.test(i)?`context`:D.test(i)?`normal`:null;if(s===null){e++;continue}let c=[],l=z[s];for(let n=l(t,e);n!==null&&(c.push(n.hunk),e=n.next,!(e>=t.length||N(t[e],!1)));n=l(t,e));n.push({old:r.old,new:r.new,format:s,hunks:c,blocks:P(c)}),r={old:null,new:null}}return n}function N(e,t){let n=/^diff --git (\S+) (\S+)\n?$/u.exec(e);if(n)return{names:{old:n[1],new:n[2]}};if(T.test(e)||E.test(e))return null;let r=/^(\*\*\* |--- |\+\+\+ )(.*?)(?:\t.*)?\n?$/u.exec(e);return r?{slot:r[1]===`*** `||r[1]===`--- `&&!t?`old`:`new`,name:r[2]}:null}function P(e){let t=[];for(let n of e){let e=n.oldStart,r=n.newStart,i=null,a=()=>{i&&=(t.push(i),e=i.a1,r=i.b1,null)};for(let{tag:t,text:o}of n.lines)t===` `?(a(),e++,r++):(t===`-`&&i?.insert.length&&a(),i??={a0:e,a1:e,b0:r,b1:r,remove:[],insert:[]},t===`-`?(i.a1++,i.remove.push(o)):(i.b1++,i.insert.push(o)));a()}return t}function ee(e,t){let n=C.exec(e[t]??``);if(!n)return null;let r=Number(n[2]??1),i=Number(n[4]??1),a={oldStart:k(n[1],r),newStart:k(n[3],i),label:n[5]||null,lines:[]},o=0,s=t+1,c=0;for(;c<r||o<i;s++){let t=e[s];if(t===void 0)throw new O(`the patch ends inside a hunk`,s);let n=t===`
2
+ `?` `:t[0];if(n!==` `&&n!==`-`&&n!==`+`)throw new O(`a hunk line begins with ${JSON.stringify(n)}`,s);let l=t===`
3
+ `?t:t.slice(1);if(A(e[s+1])&&(l=j(l),s++),n!==`+`&&c++,n!==`-`&&o++,c>r||o>i)throw new O(`a hunk has more lines than its header says`,s);a.lines.push({tag:n,text:l})}return{hunk:a,next:s}}function F(e,t){let n=D.exec(e[t]??``);if(!n)return null;let[,r,i,a,o,s]=n,c=a===`a`?0:Number(i??r)-Number(r)+1,l=a===`d`?0:Number(s??o)-Number(o)+1;if(c<0||l<0)throw new O(`a change command counts backwards`,t);let u={oldStart:a===`a`?Number(r):Number(r)-1,newStart:a===`d`?Number(o):Number(o)-1,label:null,lines:[]},d=t+1,f=(t,n,r)=>{for(let i=0;i<t;i++,d++){let t=e[d];if(t===void 0)throw new O(`the patch ends inside a hunk`,d);if(t[0]!==n)throw new O(`${JSON.stringify(n)} expected`,d);let i=t.slice(2);A(e[d+1])&&(i=j(i),d++),u.lines.push({tag:r,text:i})}};if(f(c,`<`,`-`),a===`c`){if(e[d]!==`---
4
+ `)throw new O(`'---' expected`,d);d++}return f(l,`>`,`+`),{hunk:u,next:d}}function I(e,t){let n=w.exec(e[t]??``);if(!n)return null;let r=T.exec(e[t+1]??``);if(!r)throw new O(`'*** ' range expected`,t+1);let i=L(e,t+2,`-`),a=E.exec(e[i.next]??``);if(!a)throw new O(`'--- ' range expected`,i.next);let o=L(e,i.next+1,`+`),s=i.lines.length===0?o.lines.filter(e=>e.tag===` `):i.lines,c=o.lines.length===0?i.lines.filter(e=>e.tag===` `):o.lines;return{hunk:{oldStart:k(r[1],s.length),newStart:k(a[1],c.length),label:n[1]||null,lines:R(s,c)},next:o.next}}function L(e,t,n){let r=[],i=t;for(;i<e.length;i++){let t=e[i];if(w.test(t)||T.test(t)||E.test(t))break;if(A(t)){if(r.length===0)throw new O(`a no-newline marker follows no line`,i);r.at(-1).text=j(r.at(-1).text);continue}let a=t===`
5
+ `?` `:t[0];if(a!==` `&&a!==`!`&&a!==`-`&&a!==`+`)break;r.push({tag:a===` `?` `:n,text:t===`
6
+ `?t:t.slice(2)})}return{lines:r,next:i}}function R(e,t){let n=[],r=0,i=0;for(;r<e.length||i<t.length;)if(e[r]?.tag===` `&&t[i]?.tag===` `)n.push(e[r++]),i++;else{for(;r<e.length&&e[r].tag!==` `;)n.push(e[r++]);for(;i<t.length&&t[i].tag!==` `;)n.push(t[i++]);e[r]?.tag===` `&&t[i]===void 0?n.push(e[r++]):t[i]?.tag===` `&&e[r]===void 0&&n.push(t[i++])}return n}var z={unified:ee,context:I,normal:F},B=class extends Error{constructor(e){super(`the rendered diff does not say what the change set says (${e})`),this.name=`FormatError`}},V={" ":`kept`,"-":`removed`,"+":`added`};function H(e,t,n,r){if(n.length===0&&r===``)return;let i;try{i=M(r)}catch(e){throw new B(`it does not read back (${e.message})`)}if(i.length!==1)throw new B(`${i.length} files read back, not one`);let[{format:a,hunks:o,blocks:s}]=i;if(s.length!==n.length)throw new B(`${s.length} blocks read back, not ${n.length}`);for(let[e,t]of s.entries()){let r=n[e];if(t.a0!==r.a0||t.a1!==r.a1||t.b0!==r.b0||t.b1!==r.b1)throw new B(`block ${e+1} reads back somewhere else`)}for(let n of o){let r=a===`context`&&!n.lines.some(({tag:e})=>e===`-`),i=n.oldStart,o=n.newStart;for(let{tag:a,text:s}of n.lines){if(s!==(a===`+`||a===` `&&r?t[o]:e[i]))throw new B(`a ${V[a]} line is not the line it stands for`);a!==`+`&&i++,a!==`-`&&o++}}}function U(e,t,n,r){let i=[];for(let a=0;a<e.length;){let o=a;for(;o+1<e.length&&e[o+1].a0-e[o].a1<=2*t;)o++;let s=e[a],c=e[o];i.push({blocks:e.slice(a,o+1),a0:Math.max(0,s.a0-t),a1:Math.min(n,c.a1+t),b0:Math.max(0,s.b0-t),b1:Math.min(r,c.b1+t)}),a=o+1}return i}var W=e=>(t,n,r,{context:i,label:a=null})=>{let o=``;for(let s of U(r,i,t.length,n.length))o+=e(t,n,s,a?a(s.a0):null);return H(t,n,r,o),o},G=`
7
+ \
8
+ `,K=(e,t)=>e+t+(t.endsWith(`
9
+ `)?``:G),q=(e,t)=>`${e}${t===null?``:` ${t}`}
10
+ `,J=(e,t)=>t>e+1?`${e+1},${t}`:`${t>e?e+1:e}`,Y=(e,t)=>t<=e?`${e},0`:t===e+1?`${e+1}`:`${e+1},${t-e}`;function te(e,t,n){let r=``;for(let{a0:i,a1:a,b0:o,b1:s}of n){let n=i===a?`a`:o===s?`d`:`c`;r+=`${J(i,a)}${n}${J(o,s)}
11
+ `;for(let t=i;t<a;t++)r+=K(`< `,e[t]);n===`c`&&(r+=`---
12
+ `);for(let e=o;e<s;e++)r+=K(`> `,t[e])}return H(e,t,n,r),r}var ne=W((e,t,n,r)=>{let i=q(`@@ -${Y(n.a0,n.a1)} +${Y(n.b0,n.b1)} @@`,r),a=n.a0,o=n.b0;for(let{a0:r,a1:s,b1:c}of n.blocks){for(;a<r;a++,o++)i+=K(` `,e[a]);for(;a<s;a++)i+=K(`-`,e[a]);for(;o<c;o++)i+=K(`+`,t[o])}for(;a<n.a1;a++,o++)i+=K(` `,e[a]);return i}),re=W((e,t,{a0:n,a1:r,b0:i,b1:a,blocks:o},s)=>[q(`***************`,s),`*** ${J(n,r)} ****
13
+ `,X(e,n,r,o.map(e=>[e.a0,e.a1,e.b0<e.b1]),`- `),`--- ${J(i,a)} ----
14
+ `,X(t,i,a,o.map(e=>[e.b0,e.b1,e.a0<e.a1]),`+ `)].join(``));function X(e,t,n,r,i){if(!r.some(([e,t])=>e<t))return``;let a=``,o=t;for(let[t,n,s]of r){for(;o<t;o++)a+=K(` `,e[o]);for(;o<n;o++)a+=K(s?`! `:i,e[o])}for(;o<n;o++)a+=K(` `,e[o]);return a}var Z={unified:ne,context:re,normal:te};function Q(e){if(!Object.hasOwn(Z,e))throw RangeError(`a change set prints as unified, context or normal, not ${e}`);return Z[e]}function $(e,t){if(!(Number.isInteger(e)&&e>=0)&&e!==1/0)throw RangeError(`${t} is a number of lines, not ${e}`);return e}function ie(e,t,n){if(e===t)return``;let a=r(n);return a===null||!h(i(e),i(t),a)?`Files differ
15
+ `:``}function ae(e,t,{format:n=`unified`,context:r=3,label:a=null,horizon:o=0,...s}={}){if(n===`brief`)return ie(e,t,s);let l=Q(n),u=i(e),d=i(t),f=n===`normal`?$(o,`horizon`):Math.max($(o,`horizon`),$(r,`context`));return l(u,d,c(u,d,{...s,horizon:f}),{context:r,label:a})}function oe(e,t,{horizon:n=3,...r}={}){let a=i(e),o=i(t);return c(a,o,{...r,horizon:$(n,`horizon`)}).map(({a0:e,a1:t,b0:n,b1:r})=>({a0:e,a1:t,b0:n,b1:r,remove:a.slice(e,t),insert:o.slice(n,r)}))}function se(e,t,n,{format:a=`unified`,context:o=3,label:s=null,...c}={}){let l=Q(a),u=i(e),d=i(t);return x(u,d,n,r(c)),l(u,d,n,{context:o,label:s})}export{S as a,C as b,w as c,D as d,B as e,ae as f,oe as g,se as h};
@@ -0,0 +1 @@
1
+ function e(e,t){return!e||t===e||t.startsWith(`${e}/`)}function t(t,n){if(e(t.oldPath,n)){let e=n.slice(t.oldPath.length).replace(/^\//u,``);return{directory:[t.newPath,e].filter(Boolean).join(`/`),filePrefix:``}}if(!e(n,t.oldPath))return null;let r=t.oldPath.slice(n.length).replace(/^\//u,``);return t.newPath===r?{directory:``,filePrefix:r}:t.newPath.endsWith(`/${r}`)?{directory:t.newPath.slice(0,-r.length-1),filePrefix:r}:null}function n(n,r,i,a=``){let o=null,s=-1;for(let c of i){if(c.oldRepo.toLowerCase()!==n.toLowerCase())continue;let i=t(c,r);!i||!e(i.filePrefix,a)||c.oldPath.length<=s||(o={repoId:c.repoId,directory:i.directory},s=c.oldPath.length)}return o}function r(e){let t;for(let n of e){let e=n.split(`/`);if(e.some(e=>!e||e===`.`||e===`..`)||n.includes(`\\`))return``;if(e.pop(),t===void 0)t=e;else{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;t.length=n}if(t.length===0)return``}return t?.join(`/`)??``}export{n as a,r as b};
@@ -0,0 +1,3 @@
1
+ import{a as e}from"./chunk-6CCSTJWB.js";import{d as t,e as n,g as r,h as i,i as a}from"./chunk-DOYTKRIR.js";import{r as o}from"./chunk-LBD3M3J6.js";import{J as s}from"./chunk-QRKFPLA4.js";import{a as c}from"./chunk-TUII34K2.js";var l=[`dependencies`,`security`],u={dependencies:`Dependencies`,security:`Security`},d=e(),f=Object.freeze(d.models),p=d.defaultModel,m=`x-upload-encryption`,h=1,g=1,_={name:`X25519`},v=34,y=1048576,b=65536,ee=`deepview-managed-upload.v1.content-key`;function x(e,t){let n=new Uint8Array(12);return new DataView(n.buffer).setUint32(7,e),n[11]=+!!t,n}async function S(e,t,n){let r=await crypto.subtle.importKey(`raw`,e,`HKDF`,!1,[`deriveKey`]);return await crypto.subtle.deriveKey({name:`HKDF`,hash:`SHA-256`,salt:t,info:c(ee)},r,{name:`AES-GCM`,length:256},!1,[n])}async function C(e){let t=new Uint8Array(await e.slice(0,b).arrayBuffer());if(t.includes(0))return!1;try{return new TextDecoder(`utf-8`,{fatal:!0}).decode(t,{stream:!0}),!0}catch{return!1}}async function w(e,t,n){let r=await C(e),[i,a]=await Promise.all([crypto.subtle.importKey(`raw`,t,_,!1,[]),crypto.subtle.generateKey(_,!1,[`deriveBits`])]),o=new Uint8Array(v);o[0]=h,o[1]=r?g:0,o.set(new Uint8Array(await crypto.subtle.exportKey(`raw`,a.publicKey)),2);let s=await S(await crypto.subtle.deriveBits({name:`X25519`,public:i},a.privateKey,256),o,`encrypt`),c=[new Blob([o])],l=new Uint8Array(y),u=0,d=0,f=async e=>{c.push(new Blob([await crypto.subtle.encrypt({name:`AES-GCM`,iv:x(d++,e)},s,l.subarray(0,u))])),u=0},p=(r?e.stream().pipeThrough(new CompressionStream(`gzip`)):e.stream()).getReader();try{for(let e=await p.read();!e.done;e=await p.read()){n?.throwIfAborted();for(let t=0;t<e.value.length;){u===y&&await f(!1);let n=Math.min(y-u,e.value.length-t);l.set(e.value.subarray(t,t+n),u),u+=n,t+=n}}}catch(e){throw await p.cancel(e).catch(()=>{}),e}return await f(!0),new Blob(c)}var T=null,E=0;function D(){return T?.user.role??null}function O(e){if(e!==null&&!i(e))throw TypeError(`Unknown managed preview role: ${e}. Expected ${r.join(`, `)}.`);E++,T=e===null?null:{user:{id:`preview:${e}`,login:e,name:e[0].toUpperCase()+e.slice(1),role:e,avatarUrl:null,lastSeenAt:Date.now(),lastActivityAt:null},csrfToken:null}}function k(e,t){let n=new URL(e,`http://managed-preview.invalid`).pathname,r=(t?.method??`GET`).toUpperCase();if(r===`POST`&&n===`/api/auth/logout`)return Response.json({ok:!0});if(r!==`GET`)throw Error(`Changes are not saved in the managed UI preview`);if(n===`/api/auth/session`)return Response.json(T);if(n===`/api/teams`)return Response.json({teams:[]});if(n.startsWith(`/api/admin/`)&&!a(T.user.role,`manage`)||[`/api/admin/users`,`/api/admin/teams`,`/api/admin/repositories`,`/api/admin/repositories/aliases`,`/api/admin/repositories/risk`].includes(n)&&T.user.role!==`admin`)return Response.json({error:`forbidden`},{status:403});if(n===`/api/admin/repositories/risk`)return new Response(`{"type":"repos","repos":[]}
2
+ {"type":"done"}
3
+ `,{headers:{"content-type":`application/x-ndjson`}});let i={"/api/admin/users":{users:[T.user]},"/api/admin/teams":{teams:[],users:[T.user],repos:[],permissions:l},"/api/admin/links":{shares:[]},"/api/admin/repositories":{repositories:[],total:0,connectedCount:0,installUrl:null,tokenMissing:!1},"/api/admin/repositories/aliases":{aliases:[],repos:[]},"/api/admin/repositories/resolve":{location:null},"/api/admin/reports":{reports:[],repos:[],maxBytes:26214400},"/api/admin/bundles":{bundles:[],repos:[],maxBytes:0xc800000},"/api/admin/history":{history:[],total:0,page:1,limit:100,filters:{repos:[],users:[]}},"/api/admin/scan/models":{models:f,defaultModel:p},"/api/admin/scan-results":{bundles:[],results:[]},"/api/auth/profile":{profile:{login:T.user.login,name:T.user.name,githubName:T.user.name,nameAccount:null,avatarAccount:null,accounts:[]}}};return Object.hasOwn(i,n)?Response.json(i[n]):Response.json({error:`not-found`},{status:404})}var A=3145728,te=new Set([`/api/admin/reports`,`/api/admin/bundles`,`/api/admin/deduplication`]);async function ne(e,t){let n=await t(`/api/admin/uploads/key`,{credentials:`same-origin`,signal:e.signal});if(n.status===404||n.status===405)return e;if(!n.ok)return n;let r=(await n.json())?.key;if(typeof r!=`string`)throw TypeError(`The server sent an invalid upload key`);let i=new Headers(e.headers);return i.set(m,`1`),{...e,headers:i,body:await w(e.body,Uint8Array.fromBase64(r,{alphabet:`base64url`}),e.signal)}}async function re(e,t,n){let r=null;if(e!==`/api/admin/deduplication`&&t.body.size>A){let i=await n(`/api/config`,{credentials:`same-origin`,signal:t.signal});if(!i.ok)return i;let a=(await i.json()).managed,o=a?.uploadMaxBytes?.[e.endsWith(`/reports`)?`reports`:`bundles`];if(Number.isSafeInteger(o)&&o>0&&t.body.size>o)return Response.json({error:`too-large`},{status:413});let s=a?.uploadChunkBytes;Number.isSafeInteger(s)&&s>0&&s<=A&&(r=s)}let i=await ne(t,n);return i instanceof Response?i:r==null||i.body.size<=A?await n(e,i):await j(e,i,n,r)}var ie=3;async function j(e,t,n,r){let i=t.body,a=crypto.randomUUID(),o=e.endsWith(`/reports`)?`reports`:`bundles`,s=Math.ceil(i.size/r),c=new Headers(t.headers);c.set(`content-type`,`application/octet-stream`);let l=0,u=!1;try{let d=null,f=!1,p=(await Promise.allSettled(Array.from({length:Math.min(ie,s)},async()=>{for(;!f&&l<s;){let e=l++;try{let s=await n(`/api/admin/uploads/${o}/${a}/${e}`,{...t,headers:c,body:i.slice(e*r,(e+1)*r)});s.ok||(d??=s,f=!0)}catch(e){throw f=!0,e}}}))).find(e=>e.status===`rejected`);if(p)throw p.reason;if(d)return d;let m=new Headers(t.headers);m.set(`x-upload-id`,a),m.set(`x-upload-parts`,String(s)),m.set(`x-upload-size`,String(i.size));let h=await n(e,{...t,headers:m,body:``});return u=h.ok,h}finally{if(!u&&l>0){let e=new Headers(t.headers);e.set(`x-upload-parts`,String(l)),await n(`/api/admin/uploads/${o}/${a}`,{...t,method:`DELETE`,headers:e,body:void 0,signal:AbortSignal.timeout(1e4)}).catch(()=>{})}}}async function M(e){await e.json().then(e=>e?.error,()=>null)===`view-only`&&globalThis.document?.dispatchEvent(new CustomEvent(`managed-view-only`))}async function N(e,n){if(n?.signal?.throwIfAborted(),T)return k(e,n);let r=E;async function i(e,n){if(r!==E)throw new DOMException(`Managed session changed`,`AbortError`);let i=t();if(i){if(new URL(e,globalThis.location.origin).origin!==globalThis.location.origin)throw Error(`Public workspace requests must be same-origin`);let t=new Headers(n?.headers);t.set(`x-deepview-share`,i.token),n={...n,headers:t,credentials:`omit`,redirect:`error`}}let a=await fetch(e,{...n,cache:`no-store`});if(r!==E)throw new DOMException(`Managed session changed`,`AbortError`);return a.status===403&&![`GET`,`HEAD`].includes((n?.method??`GET`).toUpperCase())&&M(a.clone()),a}return n?.method===`POST`&&te.has(e)&&n.body instanceof Blob?await re(e,n,i):await i(e,n)}var P=(e,t)=>[...new Set([...e?.keys()??[],...t.keys()])].filter(n=>e?.get(n)!==t.get(n)),F=e=>new Map([...Map.groupBy(e,([e])=>e)].map(([e,t])=>[e,JSON.stringify(t.map(([,e])=>e).toSorted())])),I=new class{constructor(e=()=>{}){this.resources=new Map,this.session=null,this.teamCatalog=null,this.reportCatalog=null,this.bundleCatalog=null,this.generation=0,this.sessionController=new AbortController,this.notify=e}setSession(e){(this.session?.id!==e?.id||this.session?.role!==e?.role)&&this.reset(),this.session=e}reset(){this.generation++,this.sessionController.abort(),this.sessionController=new AbortController,this.invalidate(),this.session=null,this.teamCatalog=null,this.reportCatalog=null,this.bundleCatalog=null}setReportCatalog(e){let t=new Map(e.map(e=>[e.id,JSON.stringify([e.cacheKey??null,e.reports.map(e=>[e.id,e.cacheKey??null,e.visible!==!1]).toSorted(),(e.bundles??[]).map(e=>[e.id,e.filename,e.repoFullName,e.repoDirectory??``]).toSorted()])])),n=new Set(P(this.teamCatalog,t).map(e=>`team:${e}`));for(let e of this.resources.keys())if(e.startsWith(`reports:content:team:`)){let[n]=e.slice(21).split(`:`);t.has(n)&&this.teamCatalog?.get(n)===t.get(n)||this.invalidate([e])}this.teamCatalog=t;let r=F(e.flatMap(e=>e.reports.map(t=>[t.id,JSON.stringify([e.id,t.cacheKey??null])]))),i=new Set([...n,...P(this.reportCatalog,r)]);this.reportCatalog=r;for(let e of this.resources.keys()){if(!e.startsWith(`reports:content:`)||e.startsWith(`reports:content:team:`))continue;let t=e.slice(16);(!r.has(t)||i.has(t))&&(this.invalidate([e]),i.add(t))}let a=F(e.flatMap(e=>(e.bundles??[]).map(t=>[t.id,JSON.stringify([e.id,e.cacheKey??null,t.filename,t.repoFullName,t.repoDirectory??``])]))),o=P(this.bundleCatalog,a);for(let e of o)i.add(`bundle:${e}`),this.invalidate([`bundle-metadata:${e}`]);let s=o.length>0;this.bundleCatalog=a;for(let e of this.resources.keys()){if(!e.startsWith(`report-sources:`)&&!e.startsWith(`finding-history:`))continue;let[,t,r]=e.split(`:`);(t?n.has(`team:${t}`):s||i.has(r))&&this.invalidate([e])}return i}read(e){return this.resources.get(e)?.data}invalidate(e){for(let[t,n]of this.resources)e&&!e.some(e=>t===e||t.startsWith(`${e}:`))||(n.controller?.abort(),this.resources.delete(t))}async mutate(e,t){let n=this.generation,r;try{r=await e()}catch(e){throw n===this.generation&&e?.name!==`AbortError`&&this.notify(`Couldn't save changes: ${e?.message??e}`),e}if(n!==this.generation)throw new DOMException(`Managed session changed`,`AbortError`);return this.invalidate(t),r}async load(e,t,n,{signal:r,apply:i=()=>{},retryInvalidated:a=!1}={}){let o=this.generation;for(;;){r?.throwIfAborted();let s=this.resources.get(e);if(s||(s={},this.resources.set(e,s)),s.data!==void 0&&i(s.data),!s.pending){let e=s.controller=new AbortController;s.pending=(async()=>{try{let t=await n(e.signal);return e.signal.throwIfAborted(),s.data=t,t}catch(n){throw!e.signal.aborted&&n?.name!==`AbortError`&&this.notify(`Couldn't refresh ${t}: ${n?.message??n}`),n}})().finally(()=>{s.pending=null})}try{let t=await s.pending;if(r?.throwIfAborted(),this.resources.get(e)!==s)throw new DOMException(`Managed data changed`,`AbortError`);return i(t),t}catch(t){if(!a||t?.name!==`AbortError`||r?.aborted||o!==this.generation||this.resources.get(e)===s)throw t}}}}(e=>{document.dispatchEvent(new CustomEvent(`managed-notice`,{detail:{message:e}}))});function L(e){I.setSession(e)}function R(e){return I.setReportCatalog(e)}function z(){I.reset()}var B=new Set([`findings`,`groups`,`links`]),V=-1,H=e=>typeof e==`object`&&!!e&&!Array.isArray(e),U=e=>Array.isArray(e?.findings)?`findings`:Array.isArray(e?.groups)?`groups`:null;function W(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0,configurable:!0}):e[t]=n}function G(e,{values:t=null,keys:n=null}={}){if(!H(e))return e;let r=new Map(H(t)?Object.entries(t).filter(([,e])=>Array.isArray(e)):[]),i=Array.isArray(n),a=!0,o=(e,t)=>Number.isInteger(t)&&r.has(e)?r.get(e)[t]:t,s=e=>{for(let[t,n]of r)Number.isInteger(e[t])&&W(e,t,n[e[t]]);return e},c=e=>{let t=n[e[0]];if(!Array.isArray(t)||t.length!==e.length-1)return a=!1,null;let r={};for(let[n,i]of t.entries())W(r,i,o(i,e[n+1]));return r},l=e=>i&&Array.isArray(e)&&Number.isInteger(e[0]),u=e=>l(e)?e[0]===V?e[1]:c(e):H(e)?s(e):e,d=e=>Array.isArray(e)&&!l(e)?e.map(u):u(e);if(e.repo!=null&&(e.repo=o(`repo`,e.repo)),!H(e.data))return e;for(let t in e.data)!B.has(t)&&r.has(t)&&W(e.data,t,o(t,e.data[t]));let f=U(e.data);return f&&(e.data[f]=e.data[f].map(d)),a?e:null}async function K(e,t=null,n={}){let r;try{r=await N(e,{credentials:`same-origin`,headers:{accept:`application/json`},...n})}catch{return t}if(r.status===401||r.status===403)return null;if(!r.ok)return t;try{return await r.json()}catch{return t}}async function q({fallback:e=null,sent:r}={}){let i=t()||D()!==null?void 0:await r;if(i===null)return null;let a=J(i);if(a!==void 0)return a;let o;try{let r=t(),i=await N(r?n(r):`/api/auth/session`,{credentials:`same-origin`,headers:{accept:`application/json`}});if(i.status===401||i.status===403)return null;if(!i.ok)return e;o=await i.json()}catch{return e}let s=J(o);return s===void 0?e:s}function J(e){let n=e?.user;if(n===null)return null;if(n!==void 0&&typeof n.login==`string`)return{id:n.id,login:n.login,name:typeof n.name==`string`?n.name:null,avatarUrl:typeof n.avatarUrl==`string`?n.avatarUrl:null,role:typeof n.role==`string`?n.role:`none`,csrfToken:typeof e.csrfToken==`string`?e.csrfToken:null,...t()?{publicShare:!0}:{},...typeof e.viewer?.login==`string`?{viewer:{id:e.viewer.id,login:e.viewer.login,name:typeof e.viewer.name==`string`?e.viewer.name:null}}:{},...!t()&&e.dependencyReview===!0?{dependencyReview:!0}:{}}}function Y(e){let t=t=>Number.isSafeInteger(e?.[t])&&e[t]>=0;return e?.appMode===!1?{appMode:!1,...t(`appReports`)&&{appReports:e.appReports},...t(`findings`)&&{findings:e.findings}}:e?.appMode===!0&&t(`appFindings`)?{appMode:!0,appFindings:e.appFindings}:null}function ae(e){if(typeof e?.sha!=`string`||typeof e.github!=`string`||!Array.isArray(e.tags))return null;let t=e.details,n=e=>typeof e==`string`?e:null,r=e=>Number.isSafeInteger(e)?e:null;return{sha:e.sha,github:e.github,tags:e.tags.filter(e=>typeof e==`string`),details:typeof t?.subject==`string`?{subject:t.subject,authorName:n(t.authorName),authorLogin:n(t.authorLogin),authoredAt:r(t.authoredAt),committedAt:r(t.committedAt)}:null}}async function oe({fallback:e=[],signal:r,onRevision:i}={}){let a=t(),o=a?await K(n(a),null,{signal:r}):null,s=a?{teams:o?.team?[o.team]:[]}:await K(`/api/teams`,{teams:e},{signal:r}),c=s?.teams;return Array.isArray(c)?(i?.(typeof s.revision==`string`?s.revision:null),c.filter(e=>e!=null&&typeof e.id==`string`&&typeof e.name==`string`).map(e=>({id:e.id,slug:e.slug,name:e.name,...!a&&e.dependencyReview===!0?{dependencyReview:!0}:{},...e.permissions?{permissions:{dependencies:e.permissions.dependencies===!0,security:e.permissions.security===!0}}:{},...typeof e.cacheKey==`string`?{cacheKey:e.cacheKey}:{},...Y(e.app)?{app:Y(e.app)}:{},repos:Array.isArray(e.repos)?e.repos.filter(e=>Number.isSafeInteger(e?.repoId)&&e.repoId>0&&typeof e.fullName==`string`).map(e=>({repoId:e.repoId,fullName:e.fullName,path:typeof e.path==`string`&&e.path?e.path:null})):[],reports:Array.isArray(e.reports)?e.reports.filter(e=>e!=null&&typeof e.id==`string`&&typeof e.filename==`string`).map(e=>({id:e.id,slug:e.slug,filename:e.filename,visible:e.visible!==!1,...e.analyzer===null||typeof e.analyzer==`string`?{analyzer:e.analyzer}:{},repoFullName:typeof e.repoFullName==`string`?e.repoFullName:``,repoDirectory:typeof e.repoDirectory==`string`?e.repoDirectory:``,...typeof e.cacheKey==`string`?{cacheKey:e.cacheKey}:{}})):[],bundles:Array.isArray(e.bundles)?e.bundles.filter(e=>e!=null&&typeof e.id==`string`&&typeof e.filename==`string`).map(e=>({id:e.id,slug:e.slug,integrity:e.integrity,byteSize:e.byteSize,repoId:e.repoId,filename:e.filename,kind:e.kind,visible:e.visible!==!1,summary:e.summary??null,summaryRetryAt:Number.isSafeInteger(e.summaryRetryAt)&&e.summaryRetryAt>0?e.summaryRetryAt:null,repoDirectory:typeof e.repoDirectory==`string`?e.repoDirectory:``,repoFullName:typeof e.repoFullName==`string`?e.repoFullName:``,commitInfo:ae(e.commitInfo)})):[]}))):s==null?[]:e}function X(e){return e?.links===void 0?[]:Array.isArray(e.links)&&e.links.every(e=>Array.isArray(e)&&e.length>=2&&e.every(e=>typeof e==`string`))?e.links:null}function Z(e){return s(e?.data)===null||typeof e.repo?.directory!=`string`||e.repo.github!==null&&typeof e.repo.github!=`string`||X(e)===null?null:{data:e.data,repo:e.repo,...e.links?{links:e.links}:{}}}async function se(e,{signal:t}={}){return Z(await K(`/api/reports/${encodeURIComponent(e)}`,null,{signal:t}))}async function ce(e,{signal:t}={}){let n=[...new Set(e)];if(n.length===0)return[];let r=await K(`/api/reports/query`,null,{method:`POST`,signal:t,headers:{accept:`application/json`,"content-type":`application/json`},body:JSON.stringify({ids:n})});if(!Array.isArray(r?.reports)||r.reports.length!==n.length)return null;let i=new Map;for(let e of r.reports){let t=Z(e);if(!t||!n.includes(e.id)||i.has(e.id))return null;i.set(e.id,t)}let a=X(r);return a===null?null:e.map(e=>({...i.get(e),...a.length>0?{links:a}:{}}))}async function le(e,{signal:t,reportId:n=null,lite:r=!1}={}){let i=new URLSearchParams(n===null?{}:{reportId:n});r&&i.set(`lite`,`1`);let a=await K(`/api/teams/${encodeURIComponent(e)}/reports${i.size>0?`?${i}`:``}`,null,{signal:t});if(!Array.isArray(a?.reports))return null;let o=[],s=new Set;for(let e of a.reports){let t=Z(G(e,a));if(!t||typeof e.id!=`string`||typeof e.filename!=`string`||s.has(e.id))return null;s.add(e.id),o.push({id:e.id,filename:e.filename,...t,...e.opensAsApp===!0?{opensAsApp:!0}:{}})}let c=X(a);return c===null?null:(Object.defineProperties(o,{links:{value:c},...[`rows`,`app`].includes(a.folded)?{folded:{value:a.folded},lens:{value:a.lens??null}}:{}}),o)}function Q(e){return e?`?team=${encodeURIComponent(e)}`:``}async function ue(e,{reportId:t,...n}={}){let r=t==null?``:`?reportId=${encodeURIComponent(t)}`,i=await K(`/api/teams/${encodeURIComponent(e)}/annotations${r}`,null,n),{reports:a,entries:o,comments:s,issues:c={}}=i??{};if(!a||typeof a!=`object`||Array.isArray(a)||!o||typeof o!=`object`||Array.isArray(o)||!Array.isArray(s)||!c||typeof c!=`object`||Array.isArray(c)||Object.values(a).some(e=>!Array.isArray(e)||e.some(e=>typeof e!=`string`))||s.some(e=>!e||typeof e.findingId!=`string`))return null;let l=new Map;for(let[e,t]of s.entries()){let n=t.findingId,r=l.get(n)??[];r.push(e),l.set(n,r)}let u=new Map,d=new Map,f=typeof i.revision==`string`?i.revision:null;return Object.assign(e=>{if(!Object.hasOwn(a,e))return null;if(d.has(e))return d.get(e);let t=JSON.stringify(a[e]),n=u.get(t);if(!n){let r=[...new Set(a[e])],i=r.flatMap(e=>l.get(e)??[]);n={entries:Object.fromEntries(r.filter(e=>Object.hasOwn(o,e)).map(e=>[e,o[e]])),comments:i.toSorted((e,t)=>e-t).map(e=>s[e]),issues:Object.fromEntries(r.filter(e=>Object.hasOwn(c,e)).map(e=>[e,c[e]]))},u.set(t,n)}return d.set(e,n),n},{revision:f})}async function de(e,t,n){let r=(await K(`/api/reports/${encodeURIComponent(e)}/triage${Q(t)}`,null,n))?.entries;return typeof r==`object`&&r&&!Array.isArray(r)?r:null}async function fe(e,n,r=null){if(t())return[];let i=r===null?``:`?reportId=${encodeURIComponent(r)}`,a=await K(`/api/teams/${encodeURIComponent(e)}/fixes${i}`,null,{signal:n});return Array.isArray(a?.fixes)?a.fixes:null}async function pe(e,t,n){let r=await K(`/api/reports/${encodeURIComponent(e)}/comments${Q(t)}`,null,n);return Array.isArray(r?.comments)?r.comments:null}async function $(e,{findingId:t,body:n,commentId:r=null,version:i},a,o){let s=r==null?``:`/${encodeURIComponent(r)}`;try{let c=await N(`/api/reports/${encodeURIComponent(e)}/comments${s}${Q(o)}`,{method:r==null?`POST`:`PATCH`,credentials:`same-origin`,headers:{"content-type":`application/json`,...a?{"x-csrf-token":a}:{}},body:JSON.stringify(r==null?{findingId:t,body:n}:{body:n,version:i})});return{status:c.status,comment:c.ok?(await c.json()).comment:null}}catch{return{status:0,comment:null}}}async function me(e,t,n,r,i){try{return(await N(`/api/reports/${encodeURIComponent(e)}/comments/${encodeURIComponent(t)}${Q(i)}`,{method:`DELETE`,credentials:`same-origin`,headers:{"content-type":`application/json`,...r?{"x-csrf-token":r}:{}},body:JSON.stringify({version:n})})).status}catch{return 0}}async function he(e,t,n,r){try{return(await N(`/api/reports/${encodeURIComponent(e)}/triage${Q(r)}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`,...n?{"x-csrf-token":n}:{}},body:JSON.stringify({entries:t})})).status}catch{return 0}}function ge(e){e&&(location.href=e)}async function _e(e){if(t())location.href=`/`;else{try{await N(`/api/auth/logout`,{method:`POST`,credentials:`same-origin`,headers:e?{"x-csrf-token":e}:{}})}catch{}location.reload()}}async function ve(e,t){let n=await N(`/api/auth/view-as`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`,...t?{"x-csrf-token":t}:{}},body:JSON.stringify({userId:e})});if(!n.ok)throw Error(`HTTP ${n.status}`);location.assign(`/`)}async function ye(e){try{await N(`/api/auth/view-as`,{method:`DELETE`,credentials:`same-origin`,headers:e?{"x-csrf-token":e}:{}})}catch{}location.assign(o[`admin-users`])}async function be(e){let t=await N(`/api/teams/${encodeURIComponent(e)}/share`,{credentials:`same-origin`});if(!t.ok)throw Error(`Could not load public links (${t.status})`);return(await t.json()).shares}async function xe(e,t,{id:n,revoke:r=!1,dependencies:i=!1,security:a=!1}={}){let o=n?`/${encodeURIComponent(n)}`:``,s=await N(`/api/teams/${encodeURIComponent(e)}/share${o}`,{method:r?`DELETE`:n?`PATCH`:`POST`,credentials:`same-origin`,headers:{"x-csrf-token":t,"content-type":`application/json`},...r?{}:{body:JSON.stringify({dependencies:i,security:a})}});if(!s.ok)throw Error(`Could not ${r?`revoke`:n?`update`:`create`} public link (${s.status})`);return s.json()}async function Se(e,t){let n=await N(`/api/bundles/${encodeURIComponent(e)}/download`,{credentials:`same-origin`});if(!n.ok)throw Error(`Could not download bundle (${n.status})`);let r=URL.createObjectURL(await n.blob()),i=document.createElement(`a`);i.href=r,i.download=t,i.click(),setTimeout(()=>URL.revokeObjectURL(r),6e4)}export{u as a,D as b,O as c,N as d,I as e,L as f,R as g,z as h,q as i,oe as j,se as k,ce as l,le as m,Q as n,ue as o,de as p,fe as q,pe as r,$ as s,me as t,he as u,ge as v,_e as w,ve as x,ye as y,be as z,xe as A,Se as B};
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}},s=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(let c of r(i))!a.call(e,c)&&c!==o&&t(e,c,{get:()=>i[c],enumerable:!(s=n(i,c))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));export{o as a,s as b,l as c};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-GO7FT4OD.js";import{b as t,c as n,d as r,e as i}from"./chunk-PTFYDJUP.js";import{c as a,d as o,e as s,f as c,h as l,k as u,l as d,m as f,o as p,q as m}from"./chunk-6WMQVUT2.js";import"./chunk-N57OWFKY.js";import{a as h}from"./chunk-7YFJUT2P.js";import"./chunk-PXK7EU4V.js";import{m as g,q as _,s as v,w as y}from"./chunk-5M2X3QPK.js";import"./chunk-DUASGS2O.js";import{b}from"./chunk-IYPY47MC.js";import"./chunk-QRKFPLA4.js";import"./chunk-TUII34K2.js";import"./chunk-OOJM4CTU.js";function x(e){if(e instanceof Uint8Array)return{proven:!1,reason:`unsupported`,at:null};if(typeof e!=`string`)throw TypeError(`a text must be a string or its UTF-8 bytes, not ${typeof e}`);if(!e.isWellFormed())throw TypeError(`a text must be a well-formed string`);return{proven:!1,reason:`unsupported`,at:null}}var S=e=>e.subarray(0,8e3).includes(0),C=(e,t)=>(e+Math.imul(t,97)>>>0)%107927,w=e=>Uint8Array.from({length:256},(t,n)=>Number(n===10||e.includes(String.fromCodePoint(n)))),T=w(``),E=w(`,;={}`);function D(e,t=T){let n=!S(e),r=new Map,i=(e,t)=>r.set(e,(r.get(e)??0)+t),a=0,o=0,s=0;for(let r=0;r<e.length;r++){let c=e[r];if(n&&c===13&&e[r+1]===10)continue;let l=a;a=(a<<7^o>>>25)+c>>>0,o=(o<<7^l>>>25)>>>0,!(++s<64&&t[c]===0)&&(i(C(a,o),s),s=0,a=0,o=0)}s>0&&i(C(a,o),s);let c=Uint32Array.from(r.keys()).sort();return{hashes:c,bytes:Float64Array.from(c,e=>r.get(e)),total:r.values().reduce((e,t)=>e+t,0)}}function ee(e,t){let n=0;for(let r=0,i=0;r<e.hashes.length&&i<t.hashes.length;)e.hashes[r]<t.hashes[i]?r++:e.hashes[r]>t.hashes[i]?i++:n+=Math.min(e.bytes[r++],t.bytes[i++]);return n}function te(e,t,n){let r=0,i=e.total,a=t.total;for(let o=0,s=0;o<e.hashes.length&&s<t.hashes.length;)if(e.hashes[o]<t.hashes[s]?i-=e.bytes[o++]:(e.hashes[o]>t.hashes[s]||(r+=Math.min(e.bytes[o],t.bytes[s]),i-=e.bytes[o++]),a-=t.bytes[s++]),(r+Math.min(i,a))*6e4<n)return 0;return r}function O(e,t,n,r,i=!1){if(e===null||t===null||t.length===0)return 0;let a=Math.abs(e.length-t.length),o=Math.max(e.length,t.length);if(o*(6e4-n)<a*6e4)return 0;let s=r(e),c=r(t),l=i?te(s,c,n*o):ee(s,c);return Math.trunc(l*6e4/o)}var k=/^[\w-]{6,}$/u,A=/[\dA-Z]/u,ne=/^(?:\.[\w-]+)+$/u,re=/^[\w-]{8,32}$/u;function j(e){let t=[];for(let n=e.length-1;n>0;n--){if(e[n]!==`-`&&e[n]!==`.`)continue;let r=e.indexOf(`.`,n+1),i=e.slice(r),a=e.slice(n+1,r);r!==-1&&re.test(a)&&ne.test(i)&&/[A-Za-z]/u.test(a)&&A.test(a)&&t.push([e.slice(0,n),a,i])}return t}var ie=e=>e.replaceAll(/\d/gu,`0`).replaceAll(/[a-z]/gu,`a`).replaceAll(/[A-Z]/gu,`A`);function ae(e,t){let n=j(t);for(let[t,r,i]of j(e)){let e=n.find(e=>e[2]===i);if(e&&e[1]!==r)return e[0]===t&&ie(e[1])!==ie(r)}return!1}function oe(e){let t=e.lastIndexOf(`/`),n=e.slice(t+1),r=n.lastIndexOf(`.`),i=r>0?n.slice(r):``;return{name:n,key:`${e.slice(0,t+1)}\0${i}\0${n.length}`}}function se(e,t){let n=e.length,r=0;for(;r<e.length&&e[r]===t[r];)r++;for(;n>r&&e[n-1]===t[n-1];)n--;for(;r>0&&!`-._`.includes(e[r-1]);)r--;for(;n<e.length&&e[n]!==`.`;)n++;let i=e.slice(r,n),a=t.slice(r,n);return r>0&&k.test(i)&&k.test(a)&&(A.test(i)||A.test(a))}function ce({sources:e,dests:t,pairs:n,used:r,record:i,punctuatedScoreOf:a},{remaining:o,open:s},c,l){let u=(e,t)=>new Map(t.filter(t=>e[t].type===`file`).map(t=>[t,oe(e[t].path)])),d=u(t,s),f=u(e,o),p=Map.groupBy(f.keys(),e=>f.get(e).key),m=Map.groupBy(d.keys(),e=>d.get(e).key),h=[];for(let[e,t]of m){let n=p.get(e)??[];for(let e of t)for(let t of n)se(f.get(t).name,d.get(e).name)&&h.push({s:t,d:e})}let g=Map.groupBy(h,({d:e})=>e),_=Map.groupBy(h,({s:e})=>e),v=[];for(let{s:e,d:t}of h){let n=_.get(e).length===1&&g.get(t).length===1&&ae(f.get(e).name,d.get(t).name),r=a(e,t,n?0:c);(n||r>=c)&&v.push({s:e,d:t,score:r})}let y=[],b=new Set,x=new Set;for(let e of v.sort((e,t)=>t.score-e.score))n.has(e.d)||r.has(e.s)||(x.has(e.s)||b.has(e.d)||l(e)?(y.push(e),x.add(e.s),b.add(e.d)):i(e.d,e.s,e.score));return y}function le(e,t){let n=e.length;if(n!==t.length)return!1;let r=0;if(n>=32&&(e.byteOffset&3)==(t.byteOffset&3)){for(let n=4-(e.byteOffset&3)&3;r<n;r++)if(e[r]!==t[r])return!1;let i=n-r>>>2,a=new Int32Array(e.buffer,e.byteOffset+r,i),o=new Int32Array(t.buffer,t.byteOffset+r,i);for(let e=0;e<i;e++)if(a[e]!==o[e])return!1;r+=i*4}for(;r<n;r++)if(e[r]!==t[r])return!1;return!0}var M=class extends Error{constructor(e,t,n){let r=n===void 0?``:` in the ${n} tree`;super(t===void 0?e:`${e}: ${JSON.stringify(t)}${r}`),this.name=`CompareError`,this.path=t,this.tree=n}},ue=new Set([`file`,`contiguous-file`]),de=new Set([`fifo`,`character-device`,`block-device`]),fe=/(?:^|\/)\.{0,2}(?:\/|$)/u;function pe(e){if(!Number.isInteger(e)||e<0||e>4095)throw RangeError(`a mode must be an integer from 0 to 0o7777, not ${e}`)}function me(e,t,n,r){if(typeof e!=`string`)throw TypeError(`an entry's name must be a string, not ${typeof e}`);if(e!==`.`||t!==`directory`){if(r?e===``:fe.test(e))throw new M(r?`a name must not be empty`:"a name must be a relative path with no empty, `.` or `..` segment",e,n);if(!e.isWellFormed())throw new M(`a name must be well-formed Unicode`,e,n)}}function he(e,t,n){if(typeof e!=`string`||e===``)throw new M(`a link must name its target`,t,n);if(!e.isWellFormed())throw new M(`a link target must be well-formed Unicode`,t,n);return e}function ge(e){if(e===void 0)return new Uint8Array;if(e instanceof Uint8Array)return e;if(typeof e!=`string`)throw TypeError(`a file's data must be a string or a Uint8Array, not ${typeof e}`);if(!e.isWellFormed())throw TypeError(`a file's text must be well-formed Unicode`);return e}var N=e=>typeof e==`string`?h(e):e;function _e(e,t,n){if(typeof e!=`object`||!e)throw TypeError(`an entry must be an object, not ${e===null?`null`:typeof e}`);let{name:r,type:i=`file`,mode:a,linkname:o,data:s}=e;if(me(r,i,t,n),a!==void 0&&pe(a),ue.has(i))return{path:r,type:`file`,mode:a??420,data:ge(s)};if(i===`symlink`||i===`hardlink`)return{path:r,type:i,target:he(o,r,t)};if(i===`directory`)return{path:r,type:i};throw de.has(i)?new M(`a ${i} is neither a file nor a link`,r,t):TypeError(`${JSON.stringify(i)} is not an entry type`)}function P(e,t){return e.type===t.type?e.type===`symlink`?e.target===t.target:e.data===t.data?!0:typeof e.data==`string`&&typeof t.data==`string`?!1:le(N(e.data),N(t.data)):!1}function ve(e,t,n){let r=new Set([e.path]),i=t.get(e.target);for(;i?.type===`hardlink`;){if(r.has(i.path))throw new M(`a hard link leads back to itself`,e.path,n);r.add(i.path),i=t.get(i.target)}if(i===void 0||i.type===`directory`)throw new M(`a hard link must name a file or a link in the tree`,e.path,n);return{...i,path:e.path}}function F(e,t,n){let r=new Map;for(let i of e){let e=_e(i,t,n);if(e.type!==`directory`||e.path!==`.`){if(r.has(e.path))throw new M(`a name is given twice`,e.path,t);r.set(e.path,e)}}let i=new Map;for(let[e,a]of r){for(let i=n?-1:e.lastIndexOf(`/`);i>0;i=e.lastIndexOf(`/`,i-1)){let n=r.get(e.slice(0,i));if(n!==void 0&&n.type!==`directory`)throw new M(`a path lies under a ${n.type===`symlink`?`link`:`file`}`,e,t)}a.type===`hardlink`?i.set(e,ve(a,r,t)):a.type!==`directory`&&i.set(e,a)}return i}var ye=100,be=4,I=e=>e.slice(e.lastIndexOf(`/`)+1);function L(t,n){if(t.type===`symlink`)return`l${t.target}`;let r=n(t);return`f${r.length}:${e(r)}`}function xe({sources:e,dests:t,sourceNames:n,destNames:r,used:i,record:a,bytes:o}){let s=Map.groupBy(e.keys(),t=>L(e[t],o));for(let c=0;c<t.length;c++){let l=-1,u=ye;for(let a of s.get(L(t[c],o))??[])if(!i.has(a)&&P(e[a],t[c])&&((l===-1||n[a]===r[c])&&(l=a),n[a]===r[c]||--u===0))break;l!==-1&&a(c,l,6e4)}}var Se=new Map([[`.ts`,`.js`],[`.mts`,`.mjs`],[`.cts`,`.cjs`],[`.tsx`,`.jsx`]]),Ce=new Map([...[`.js`,`.mjs`,`.cjs`,`.jsx`,`.ts`,`.mts`,`.cts`,`.tsx`].map(e=>[e,`script`]),...[`.css`,`.scss`,`.sass`,`.less`].map(e=>[e,`style`])]);function R(e){let t=e.split(`/`),n=t.pop(),r=n.lastIndexOf(`.`);return r>0?{dirs:t,stem:n.slice(0,r),extension:n.slice(r)}:{dirs:t,stem:n,extension:``}}function z(e){let{dirs:t,stem:n,extension:r}=R(e);return JSON.stringify([t.map(e=>e===`lib`||e===`src`?null:e),n,Se.get(r)??r])}function we(e){let{dirs:t,stem:n,extension:r}=R(e),i=[n,Ce.get(r)??r],a=t.lastIndexOf(`node_modules`),o=a===-1?0:a+(t[a+1]?.startsWith(`@`)?3:2),s=[JSON.stringify([...i,t])];for(let e=o;e<t.length;e++)s.push(JSON.stringify([...i,t.toSpliced(e,1,null)]));return s}var B=(e,t)=>Math.max(t,e+Math.trunc((6e4-e)/2));function V({pairs:e,used:t,scoreOf:n},{remaining:r,open:i},{s:a,d:o,score:s},c){let l=B(s,c);return i.some(t=>t!==o&&!e.has(t)&&n(a,t,l)>=l)||r.some(e=>e!==a&&!t.has(e)&&n(e,o,l)>=l)}function Te(e,t,n,r){let{sources:i,dests:a,pairs:o,used:s,record:c,scoreOf:l}=e,u=Map.groupBy(t.remaining.filter(e=>i[e].type===`file`),e=>z(i[e].path)),d=t.open.filter(e=>a[e].type===`file`).flatMap(e=>(u.get(z(a[e].path))??[]).map(t=>({s:t,d:e,score:l(t,e,0)})));for(let i of d.sort((e,t)=>t.score-e.score))o.has(i.d)||s.has(i.s)||n&&V(e,t,i,r)||c(i.d,i.s,i.score)}function Ee(e,t,n,r){let{sources:i,dests:a,pairs:o,used:s,record:c,scoreOf:l}=e,u=new Map,d=(e,t,n)=>new Map(t.filter(t=>e[t].type===`file`).map(t=>{let r=we(e[t].path);for(let e of r)(u.get(e)??u.set(e,{sources:[],dests:[]}).get(e))[n].push(t);return[t,r]})),f=d(a,t.open.filter(e=>!o.has(e)),`dests`),p=d(i,t.remaining.filter(e=>!s.has(e)),`sources`),m=(e,t)=>{let n=new Set(e.flatMap(e=>u.get(e)[t]));return n.size===1?[...n][0]:-1};for(let[i,a]of p){let o=m(a,`dests`);if(o===-1||m(f.get(o),`sources`)!==i)continue;let s={s:i,d:o,score:l(i,o,0)};n&&V(e,t,s,r)||c(o,i,s.score)}}function De(e,t,n){let r=W(e),i=t<6e4&&r.remaining.length*r.open.length<=n*n;Te(e,r,i,t),Ee(e,r,i,t)}function H(e,t){let n=new Map;for(let r of t)n.set(e[r],n.has(e[r])?-1:r);return n}function Oe({sourceNames:e,destNames:t,record:n,scoreOf:r},{remaining:i,open:a},o){let s=H(t,a),c=H(e,i);for(let t of i){let i=s.get(e[t]);if(i===void 0||i===-1||c.get(e[t])===-1)continue;let a=r(t,i,o);a>=o&&n(i,t,a)}}var U=(e,t)=>t.score-e.score||t.nameScore-e.nameScore;function ke(e,t){if(e.length<be){e.push(t);return}let n=0;for(let t=1;t<e.length;t++)U(e[t],e[n])>0&&(n=t);U(e[n],t)>0&&(e[n]=t)}function Ae({sourceNames:e,destNames:t,pairs:n,used:r,record:i,scoreOf:a},{remaining:o,open:s},c,l){let u=[];for(let n of s){let r=[];for(let i of o)ke(r,{score:a(i,n,c),nameScore:+(e[i]===t[n]),dst:n,src:i});u.push(...r)}let d=0,f=e=>{for(;d<l.length&&B(l[d].score,c)>e;d++){let{s:e,d:t,score:a}=l[d];!n.has(t)&&!r.has(e)&&i(t,e,a)}};for(let{dst:e,src:t,score:a}of u.sort(U)){if(a<c)break;f(a),!n.has(e)&&!r.has(t)&&i(e,t,a)}f(-1/0)}var W=({sources:e,dests:t,pairs:n,used:r})=>({remaining:e.keys().filter(e=>!r.has(e)).toArray(),open:t.keys().filter(e=>!n.has(e)).toArray()}),G=e=>B(e,e);function K(e,t,{minimum:n,limit:r,byPath:i}){let a=new Map,o=new Set;if(e.length===0||t.length===0)return a;let s=new Map,c=new Map,l=new Map,u=e=>e.type===`file`?c.get(e)??c.set(e,N(e.data)).get(e):null,d=e=>s.get(e)??s.set(e,D(e)).get(e),f=e=>l.get(e)??l.set(e,D(e,E)).get(e),p={sources:e,dests:t,pairs:a,used:o,sourceNames:e.map(e=>I(e.path)),destNames:t.map(e=>I(e.path)),record(e,t,n){a.set(e,{source:t,score:n}),o.add(t)},bytes:u,scoreOf:(n,r,i)=>O(u(e[n]),u(t[r]),i,d),punctuatedScoreOf:(n,r,i)=>O(u(e[n]),u(t[r]),i,f,!0)};if(xe(p),i&&De(p,n,r),n>=6e4)return a;Oe(p,W(p),G(n));let m=W(p);if(m.remaining.length*m.open.length>r*r)return a;let h=i?ce(p,m,G(n),e=>V(p,m,e,n)):[];return Ae(p,W(p),n,h),a}var je=50,Me=1e3;function q(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return e.codePointAt(r)-t.codePointAt(r);return e.length-t.length}function Ne(e){if(e===!1)return null;let t=e===!0?je:e;if(typeof t!=`number`)throw TypeError(`renames must be a boolean or a percentage, not ${typeof e}`);if(!(t>0&&t<=100))throw RangeError(`renames must be a percentage above 0 and at most 100, not ${e}`);return Math.max(1,Math.trunc(6e4*t/100))}function Pe({renamesByPath:e,renameLimit:t,renameGroup:n,paths:r,lines:i}){if(o(`renamesByPath`,e),s(`renameLimit`,t),n!==null&&typeof n!=`function`)throw TypeError(`renameGroup must be a function, not ${typeof n}`);if(r!==`tree`&&r!==`keys`)throw RangeError(`paths must be 'tree' or 'keys', not ${r}`);o(`lines`,i)}var Fe=(e,t)=>P(e,t)&&(e.type!==`file`||e.mode===t.mode),J=(e,t,n,r=null)=>({status:e,old:t,new:n,similarity:r}),Ie=/\.d\.(?:[^./]+\.)?[cm]?ts$/u,Le=e=>e.endsWith(`.mts`)?`module`:e.endsWith(`.cts`)?`commonjs`:null,Re=/^export\s*\{\s*\}\s*;?$/u;function ze(e){if(e===null)return{proven:!0,runtime:``,loads:!1};try{return a(e)===void 0?{proven:!1}:x(e.data)}catch{return{proven:!1}}}function Be(e){if(![e.old,e.new].filter(e=>e!==null).every(e=>e.type===`file`&&Ie.test(e.path))||e.old&&e.new&&e.old.mode!==e.new.mode)return e;let t=ze(e.new),n=ze(e.old);return!n.proven||!t.proven||n.runtime!==t.runtime&&!(e.old===null&&Re.test(t.runtime))||n.loads&&e.old&&e.new&&e.old.path!==e.new.path&&Le(e.old.path)!==Le(e.new.path)?e:{...e,typeOnly:!0}}function Ve(e,t){let n=[],r=[],i=[];for(let[n,a]of e){let e=t.get(n);e===void 0?i.push(a):e.type===a.type?Fe(a,e)||r.push(J(`modified`,a,e)):r.push(J(`type-changed`,a,e))}for(let[r,i]of t)e.has(r)||n.push(i);return i.sort((e,t)=>q(e.path,t.path)),n.sort((e,t)=>q(e.path,t.path)),{changes:r,deleted:i,added:n}}function He(e,t,{group:n,...r}){if(n===null)return K(e,t,r);let i=new Map,a=e=>Map.groupBy(e.keys(),t=>n(e[t].path)),o=a(e);for(let[n,s]of a(t)){let a=o.get(n);if(a!==void 0)for(let[n,{source:o,score:c}]of K(a.map(t=>e[t]),s.map(e=>t[e]),r))i.set(s[n],{source:a[o],score:c})}return i}function Ue(e,t,{renames:n=!0,renamesByPath:r=!0,renameLimit:i=Me,renameGroup:a=null,paths:o=`tree`,lines:s=!0,horizon:u,whitespace:d,ignoreCase:f,shortest:p}={}){let m=Ne(n);Pe({renamesByPath:r,renameLimit:i,renameGroup:a,paths:o,lines:s});let h=c({horizon:u,whitespace:d,ignoreCase:f,shortest:p}),g=o===`keys`,{changes:_,deleted:v,added:y}=Ve(F(e,`old`,g),F(t,`new`,g)),b=m===null?new Map:He(v,y,{minimum:m,limit:i,byPath:r,group:a});for(let[e,t]of y.entries()){let n=b.get(e);_.push(n===void 0?J(`added`,null,t):J(`renamed`,v[n.source],t,Math.trunc(n.score*100/6e4)))}let x=new Set(b.values().map(({source:e})=>e));for(let[e,t]of v.entries())x.has(e)||_.push(J(`deleted`,t,null));return _.sort((e,t)=>q((e.new??e.old).path,(t.new??t.old).path)),(s?_.map(e=>({...e,...l(e.old,e.new,h)})):_).map(Be)}function Y(e,t,n){let r=new Map,i=new Set,a=0;for(let o of e){let e=u(n,o);e===null||!t.has(e)||(r.set(o,e),i.add(e),e!==o&&a++)}for(let n of e)r.has(n)||!t.has(n)||i.has(n)||(r.set(n,n),i.add(n));let o=r.size;for(let a of e){if(r.has(a))continue;let e=u(n,a)??d(n,a);for(;t.has(e)||i.has(e);)e=`../${e}`;r.set(a,e),i.add(e)}return{paths:r,paired:o,moved:a}}function We(e,t){let n=new Set(e),r=new Set(t),i=(e,t)=>{let n=new Map;for(let r of e)for(let e=r.indexOf(`/`);e!==-1;e=r.indexOf(`/`,e+1)){let i=r.slice(0,e+1);t.has(r.slice(e+1))&&n.set(i,(n.get(i)??0)+1)}let r=null,i=!1;for(let[e,t]of n)t>(n.get(r)??0)?[r,i]=[e,!1]:t===n.get(r)&&(i=!0);return i?null:r},a=Y(n,r,null).paired,o=[[{base:``,other:i(r,n)},n],[{base:i(n,r),other:``},r]].filter(([e])=>e.base!==null&&e.other!==null).map(([e,t])=>({root:e,side:t,...Y(n,r,e)})).filter(({side:e,paired:t,moved:n})=>t>a&&n*2>=e.size);return o.length===2&&o[0].paired===o[1].paired?null:o.toSorted((e,t)=>t.paired-e.paired)[0]?.root??null}function X(e,t){let n=[...e],r=new Set(t),i=We(n,r);return{root:i,paths:Y(n,r,i).paths}}function Ge(e,t,n){if(!e&&!t)return null;let r=[...e??[]],i=Map.groupBy(r,([,e])=>e),a=new Map(i.entries().map(([e,t])=>[e,f(n,e,t.map(([t])=>t.slice(e.length+1)))]));return new Map([...r.map(([e,t])=>[n.paths.get(e)??e,a.get(t)]),...t??[]])}function Ke(e,t,n=new Map,i=new Map,a=null,o=()=>!1){let s=e=>{let t=n.get(e)??i.get(e);return t===void 0?[...new Set([e,$e(a,e)??e])]:[t]},c=[],l=[],u=[],d=new Set;for(let n of e.values()){let e=s(n.parent).map(e=>t.get(r(e,n.specifier,n.conditions,n.platform))).find(Boolean),a=i.get(n.target)??n.target;if(e){if(d.add(e.key),!s(n.target).includes(e.target)){let{target:t,...n}=e;c.push({...n,baseTarget:a,otherTarget:t})}continue}let u=s(n.parent).find(o);if(u===void 0)continue;let{specifier:f,conditions:p,platform:m}=n;l.push({key:r(u,f,p,m),parent:u,specifier:f,conditions:p,platform:m,baseTarget:a,otherTarget:null})}for(let e of t.values()){if(d.has(e.key)||!o(e.parent))continue;let{target:t,...n}=e;u.push({...n,baseTarget:null,otherTarget:t})}for(let e of[c,l,u])e.sort((e,t)=>e.key.localeCompare(t.key));return{changed:c,onlyBase:l,onlyOther:u,totalChanges:c.length+l.length+u.length}}function Z(e){return g(e)??0}function qe(e,t){return e===t||e?.format===`base64`&&t?.format===`base64`&&e.data===t.data||e?.format===`digest`&&t?.format===`digest`&&e.digest===t.digest}function Je(e){if(e?.npmExecutable instanceof Set)return t=>({executable:e.npmExecutable.has(t)});if(e?.kind!==`stasis`||!e.bundle)return null;let{formats:t,executable:n,entries:r}=e.bundle;return e=>({format:t?.get(e),executable:n?.has(e)??!1,entry:r?.has(e)??!1})}function Ye(e,t){return!e||!t?[]:[`format`,`executable`,`entry`].filter(n=>e[n]!==t[n]).map(n=>({field:n,from:e[n],to:t[n]}))}function Q(e){return(t,n)=>Math.abs(n.delta)-Math.abs(t.delta)||t[e].localeCompare(n[e])}function $(e){return(t,n)=>n.bytes-t.bytes||t[e].localeCompare(n[e])}function Xe(e,t){return typeof e==`string`?`\0text\0${e.toWellFormed()}`:e?.format===`base64`?`\0base64\0${e.data}`:e?.format===`digest`?`\0digest\0${e.digest}`:`\0none\0${t}`}var Ze=250;function Qe(e,t,n,r,i){let a=(e,t,n)=>e.filter(({path:e})=>e!==``&&e.isWellFormed()).map(({path:e},r)=>({name:e,data:Xe(t.get(e),`${n}${r}`)})),o={paths:`keys`,renameGroup:i,renameLimit:Ze,lines:!1},s=Ue(a(e,n,`a`),a(t,r,`b`),o);return new Map(s.filter(({status:e})=>e===`renamed`).map(e=>[e.old.path,e.new.path]))}function $e(e,t){return e?e.base===``?`${e.other}${t}`:t.startsWith(e.base)?t.slice(e.base.length):null:t}function et(){return{baseBytes:0,otherBytes:0,onlyBaseFiles:0,onlyOtherFiles:0,changedFiles:0}}function tt(e,t,n,r=X(e.keys(),t.keys()),i=[]){let{root:a,paths:o}=r,s=new Map([...o].map(([e,t])=>[t,e]));e=new Map([...e].map(([e,t])=>[o.get(e),t]));let c=e=>s.get(e)===e?{}:{basePath:s.get(e)},l=(e,t)=>{let n=Ye(i[0]?.(e),i[1]?.(t));return n.length>0?{meta:n}:{}},u=[],d=[],f=[],p=0,m=0,h=0,g=0,_=0,v=0,y=new Map,b=e=>{let t=n(e),r=y.get(t);return r||(r=et(),y.set(t,r)),r},x=new Set([...e.keys(),...t.keys()]);for(let n of x){let r=e.has(n),i=t.has(n),a=b(n);if(r&&i){let r=e.get(n),i=t.get(n),o=qe(r,i),u=l(s.get(n),n),d=Z(r),h=o?d:Z(i);if(p+=d,m+=h,a.baseBytes+=d,a.otherBytes+=h,o&&!u.meta)v++;else{let e=h-d;f.push({path:n,...c(n),baseBytes:d,otherBytes:h,delta:e,...u,...o?{modified:!1}:{}}),_+=e,a.changedFiles++}}else if(r){let t=Z(e.get(n));p+=t,h+=t,a.baseBytes+=t,a.onlyBaseFiles++,u.push({path:n,...c(n),bytes:t})}else{let e=Z(t.get(n));m+=e,g+=e,a.otherBytes+=e,a.onlyOtherFiles++,d.push({path:n,bytes:e})}}let S=Qe(u,d,e,t,n);if(S.size>0){let n=new Set(S.values());for(let[n,r]of S){let i=e.get(n),a=t.get(r),o=qe(i,a),c=Z(i),u=o?c:Z(a);h-=c,g-=u,f.push({path:r,renamedFrom:n,basePath:s.get(n),baseBytes:c,otherBytes:u,delta:u-c,modified:!o,...l(s.get(n),r)}),_+=u-c;let d=b(n);d.onlyBaseFiles--,d.onlyOtherFiles--,d.changedFiles++}u.splice(0,u.length,...u.filter(e=>!S.has(e.path))),d.splice(0,d.length,...d.filter(e=>!n.has(e.path)))}let C=[],w=[],T=[],E=[];for(let[e,t]of y){let n=t.baseBytes>0||t.onlyBaseFiles>0||t.changedFiles>0,r=t.otherBytes>0||t.onlyOtherFiles>0||t.changedFiles>0,i=t.onlyBaseFiles+t.onlyOtherFiles+t.changedFiles;n&&!r?C.push({pkg:e,bytes:t.baseBytes}):r&&!n?w.push({pkg:e,bytes:t.otherBytes}):i>0||t.baseBytes!==t.otherBytes?T.push({pkg:e,baseBytes:t.baseBytes,otherBytes:t.otherBytes,delta:t.otherBytes-t.baseBytes}):E.push({pkg:e,bytes:t.baseBytes})}return u.sort($(`path`)),d.sort($(`path`)),f.sort(Q(`path`)),C.sort($(`pkg`)),w.sort($(`pkg`)),T.sort(Q(`pkg`)),{totals:{baseFiles:e.size,baseBytes:p,otherFiles:t.size,otherBytes:m,onlyBaseFiles:u.length,onlyBaseBytes:h,onlyOtherFiles:d.length,onlyOtherBytes:g,changedFiles:f.length,renamedFiles:S.size,changedDelta:_,unchangedFiles:v,fileDelta:t.size-e.size,byteDelta:m-p,identical:u.length===0&&d.length===0&&f.length===0},files:{onlyBase:u,onlyOther:d,changed:f,root:a,basePaths:o},packages:{onlyBase:C,onlyOther:w,changed:T,unchanged:E}}}function nt(e,r,a=null){let[o,s]=[e,r],[c,l]=t(o,s,a),u=n(o,c),d=n(s,l),f=X(u.keys(),d.keys()),h=Ge(_(o),_(s),f),g=tt(u,d,e=>b(e,{packageDir:h?.get(e)}),f,[Je(o),Je(s)]),x=y(o),S=y(s),C=(e,t)=>{let n=0;for(let r of t)n+=e.get(r)??0;return n};Object.assign(g.totals,{baseLines:C(x,u.keys()),otherLines:C(S,d.keys())});for(let e of g.files.onlyBase)e.lines=x.get(e.basePath??e.path)??0;for(let e of g.files.onlyOther)e.lines=S.get(e.path)??0;for(let e of g.files.changed)Object.assign(e,{baseLines:x.get(e.basePath??e.path)??0,otherLines:S.get(e.path)??0});let w=new Set([...g.files.onlyOther,...g.files.changed.filter(e=>e.modified!==!1)].map(e=>e.path));g.resolutions=Ke(i(o,c),i(s,l),new Map(g.files.changed.filter(e=>e.renamedFrom!=null).map(e=>[e.basePath,e.path])),g.files.basePaths,g.files.root,e=>d.has(e)&&!w.has(e));let T=e=>b(``,{packageDir:e}),E=v(o,c?u.keys():null,T),D=v(s,l?d.keys():null,T);return g.versionUpdates=m(E,D),g.packageRows=p(g.packages,E,D),g.scope=a??``,g}export{nt as prepareComparison};
@@ -0,0 +1,11 @@
1
+ import{a as e,b as t,c as n,d as r}from"./chunk-UJP4PQJA.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 C,r as w,u as ee,x as T,y as E,z as te}from"./chunk-LVW7WWV4.js";import{a as ne}from"./chunk-SZWPYLPC.js";import{b as D}from"./chunk-DEVAORP2.js";import"./chunk-ZQHLECTI.js";import{a as re,b as O,c as ie,d as k,f as ae,h as A,i as j,k as oe,n as M,q as se}from"./chunk-7HP2VYIC.js";import"./chunk-PXK7EU4V.js";import"./chunk-OOJM4CTU.js";var N=class extends ie{},ce=e=>RegExp(`(?:[^ ?:,[\\]{}#&*!|>'"%@\`-]|[-?:](?=[^${e}]))(?:[^:${e}]|:(?=[^${e}])| +(?=[^#:${e}]|:[^${e}]))*`,`uy`),le={block:ce(` `),flow:ce(` ,[\\]{}`)},ue=/'((?:[^']|'')*)'/uy,de=/"((?:[^"\\]|\\.)*)"/uy,fe={__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`},pe=/\\(?:x([\dA-Fa-f]{2})|u([\dA-Fa-f]{4})|U([\dA-Fa-f]{8})|(.))/gu;function me(e,t){return e.replace(pe,(e,n,r,i,a)=>{if(a!==void 0){if(!(a in fe))throw new N(`unknown escape \\${a}`,t.line);return fe[a]}let o=Number.parseInt(n??r??i,16);if(o>1114111||o>=55296&&o<=57343)throw new N(`${e} is not a Unicode scalar value`,t.line);return String.fromCodePoint(o)})}var he={__proto__:null,true:!0,false:!1,null:null},ge=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[Ee][+-]?\d+)?$/u,_e=/^(?:~|null|true|false|\.nan|[+-]?(?:\.inf|0[box][\d_a-f]+|(?:\d[\d_]*(?:\.[\d_]*)?|\.[\d_]+)(?:e[+-]?\d+)?))$/iu,ve=/^\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 ye(e,t){if(e in he)return he[e];if(ge.test(e)&&e!==`-0`){let n=Number(e);if(Math.abs(n)>2**53-1)throw new N(`number out of range ${O(e)}`,t.line);return n}if(_e.test(e)||ve.test(e))throw new N(`ambiguous scalar ${O(e)}, quote it`,t.line);return e}var P=e=>e.pos<e.text.length?O(e.text.slice(e.pos)):`the end of the line`,be=(e,t)=>me(e,{line:t});function xe(e,t){let n=M(e,ue);return n===null?(n=M(e,de),n===null?(n=M(e,le[t]),n===null?void 0:ye(n[0],e)):me(n[1],e)):n[1].replaceAll(`''`,`'`)}function Se(e,t){let n=xe(e,t);if(n===void 0)throw new N(`expected a scalar, found ${P(e)}`,e.line);return n}function F(e,t,n,r){if(typeof t!=`string`)throw new N(`keys must be strings`,r);if(t===`<<`)throw new N(`merge keys are not supported`,r);if(t in e)throw new N(`duplicate key ${O(t)}`,r);e[t]=n}var Ce=/ */uy,we=/, */uy,Te=/: +/uy,Ee=/:(?: +(?:#.*)?|$)/uy,De=/(?: +#.*| *)$/uy,Oe=64;function ke(e,t){let n=t===`]`?[]:Object.create(null);if(e.workflow&&++e.depth>Oe)throw new N(`nested too deep`,e.line);if(e.pos++,M(e,Ce),e.text[e.pos]!==t)do{if(e.workflow&&e.text[e.pos]===t)break;if(e.workflow)Me(e,n,t);else{let r=I(e);if(t===`]`)n.push(r);else{if(M(e,Te)===null)throw new N(`expected ": " after the key, found ${P(e)}`,e.line);F(n,r,I(e),e.line)}}M(e,Ce)}while(M(e,we)!==null);if(e.text[e.pos]!==t)throw new N(`expected "," or "${t}", found ${P(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===`{`)?ke(e,t===`[`?`]`:`}`):Se(e,`flow`)}var Ae=/ *:(?=[ ,\]}]|$)/uy,je=/ *:/uy;function Me(e,t,n){let r=e.text[e.pos]===`"`||e.text[e.pos]===`'`,i=I(e),a=M(e,r?je:Ae)!==null;if(n===`]`&&!a){t.push(i);return}M(e,Ce);let o=a&&e.text[e.pos]!==`,`&&e.text[e.pos]!==n?I(e):null;if(n===`}`){F(t,i,o,e.line);return}let s=Object.create(null);F(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(`{`)?ke(r,`}`):e.startsWith(`[`)?ke(r,`]`):Se(r,`block`);if(M(r,De)===null)throw new N(`unexpected ${P(r)} after the value`,t);return i}function R(e,t){let n={text:e,pos:0,line:t},r=xe(n,`block`),i=n.pos;if(r===void 0||M(n,Ee)===null)return null;if(i>1024)throw new N(`a key longer than 1024 characters is written after "? "`,t);return{key:r,rest:e.slice(n.pos)}}var Ne=2**20,z=128;function B(e){if(e.text.includes(` `))throw new N(`U+0009 is not allowed outside a block scalar`,e.number)}function V(e,t){if(!e.startsWith(`&`))return{anchor:null,rest:e};let n=/^&([^ ,[\]{}]+)(?: +|$)/u.exec(e);if(n===null)throw new N(`expected an anchor's name, found ${O(e)}`,t);let r=e.slice(n[0].length);if(r.startsWith(`*`))throw new N(`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 N(`an alias as a key is not supported`,n);let r=/^\*([^ ,[\]{}]+)(?: +#.*| *)$/u.exec(t);if(r===null)throw new N(`unexpected ${O(t)} after an alias`,n);if(!e.anchors.has(r[1]))throw new N(`unknown alias ${O(`*${r[1]}`)}`,n);return e.aliased=!0,e.anchors.get(r[1])}function H(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 Fe(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 Ie(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 N(`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}:Fe(l,t);a+=u.text,r=0,i=u.escaped}return a}function Le(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 N(`a quoted scalar that does not close`,n.number);B(s),o.push(s.number);let c=H(`${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 N(`unexpected ${O(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=Ie(a,i,n.number);return i?r(l,n.number):l.replaceAll(`''`,`'`)}}function Re(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++;else{if(t.indent<=n||t.text.startsWith(`#`)||e.isMarker(t))break;if(B(t),i+=`${r>0?`
4
+ `.repeat(r):` `}${t.text.replace(/ +$/u,``)}`,r=0,/ #/u.test(t.text)){e.advance();break}}return i}function ze(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=H(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 Be(e,t,n,r){let i=0,a=!1,o=null,s=!1,c=ze(t,0,null),l=null,u=``;for(let t=n;;){if(c.open===-1)throw new N(`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 N(`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 N(`a key over more than one line is not supported`,t.number);if(e&&l!==null&&B(l),e&&t.indent<=r)throw new N(`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 N(`unexpected ${O(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 N(`a flow collection that does not close`,n.number);let f=/^[\t ]*$/u.test(t.text);!f&&!t.text.startsWith(`#`)?B(t):f&&s&&!a&&t.text.includes(` `)&&(l??=t),i++,c=ze(f?``:t.text,c.open,s&&!a?`plain`:null)}}function Ve(e){let t=new Map,n=(e,r)=>{if(typeof e!=`object`||!e)return{size:1,height:0};if(r>z)throw new N(`aliases nest the document past ${z} 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 N(`aliases expand the document past ${Ne} nodes`)}t.set(e,i)}if(r+i.height>z)throw new N(`aliases nest the document past ${z} levels`);return i};n(e,0)}var He=64,Ue=RegExp(`(?! )${oe.source}`,`u`);function We(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 Ge=e=>e.indent===0&&/^(?:---|\.\.\.)(?: |$)/u.test(e.text);function Ke(e,t={}){if(typeof e!=`string`)throw TypeError(`expected a string`);let n={text:e,pos:0,number:-1,line:void 0,...We(t),anchors:null,aliased:!1};n.workflow&&Object.assign(n,{advance:()=>U(n),isMarker:Ge}),U(n);let r=[];qe(n);do r.push(Je(n));while(qe(n));return r}function qe(e){return W(e)!==void 0||e.line===void 0?!1:(U(e),!0)}function Je(e){let t=W(e);if(t===void 0)throw new N(`empty document`,e.line?.number);if(t.indent!==0)throw new N(`the document does not start at column 0`,t.number);e.workflow&&Object.assign(e,{anchors:new Map,aliased:!1});let n=q(e,0,0);if(e.aliased&&Ve(n),W(e)!==void 0)throw new N(`unexpected content after the document`,e.line.number);if(typeof n!=`object`||!n)throw new N(`the document is a lone scalar, not a mapping or a sequence`,t.number);return n}function U(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>se)throw new N(`line longer than ${se} characters`,i);let a=n;for(;t[a]===` `;)a++;let o=t.slice(a,r),s=(e.workflow?Ue:oe).exec(o)?.[0];if(s!==void 0)throw new N(`${re(s)} is not allowed`,i);return e.line={indent:a-n,text:o,number:i},e.line}function W(e){let t=e.line;for(;t!==void 0&&(t.text===``||t.text[0]===`#`||e.workflow&&/^[\t ]*$/u.test(t.text));)t=U(e);if(t!==void 0&&e.workflow&&B(t),t?.indent!==0||!/^(?:---|\.\.\.(?: |$)|%)/u.test(t.text))return t;if(!/^--- *$/u.test(t.text))throw new N(t.text.startsWith(`---`)?`content on the document marker line`:`document end markers and directives are not supported`,t.number)}var G=e=>/^-(?: |$)/u.test(e.text),K=e=>/^[|>]/u.test(e);function q(e,t,n){let r=W(e);if(n>He)throw new N(`nested too deep`,r.number);if(G(r))return Ze(e,t,n);let i=r.text.startsWith(`? `)?void 0:Y(e,r);return i===null?(U(e),e.workflow?J(e,r.text,r.indent-1,n,r):L(r.text,r.number)):Xe(e,t,n,i)}function Ye(e,t,n,r){let i;for(i=W(e);i?.indent===t;i=W(e)){if(r?.(i))return;n(i)}if(i?.indent>t)throw new N(`bad indentation`,i.number)}function Xe(e,t,n,r){let i=Object.create(null),a=e.lines&&new Map;e.lines?.set(i,a);let o=r;return Ye(e,t,r=>{if(!r.text.startsWith(`? `)){let s=o??Y(e,r);if(o=void 0,s===null)throw new N(`expected a mapping key, found ${O(r.text)}`,r.number);U(e),s.anchor&&e.anchors.set(s.anchor,s.key),F(i,s.key,Qe(e,s.rest,t,n,r),r.number),a?.set(s.key,r.number);return}U(e);let s=L(r.text.slice(2),r.number),c=W(e);if(c?.indent!==t||!/^:(?: |$)/u.test(c.text))throw new N(`expected ": " below the explicit key`,(c??r).number);F(i,s,$e(e,c,t,n),r.number),a?.set(s,r.number)}),i}function Ze(e,t,n,r=!1){let i=[],a=e.lines&&[];return e.lines?.set(i,a),Ye(e,t,r=>{if(!G(r))throw new N(`expected "- ", found ${O(r.text)}`,r.number);a?.push(r.number),i.push($e(e,r,t,n))},r?e=>!G(e):void 0),i}function Qe(e,t,n,r,i){if(e.workflow)return J(e,t,n,r,i);if(K(t))return et(e,t,n,i);if(t!==``)return L(t,i.number);let a=W(e);if(a?.indent===n&&G(a)&&!G(i))throw new N(`a sequence under a key must be indented`,a.number);if(a===void 0||a.indent<=n)throw new N(`missing value`,i.number);return q(e,a.indent,r+1)}function $e(e,t,n,r){let i=/^[-:] *(?:#.*)?/u.exec(t.text)[0].length;if(e.workflow)return it(e,t,n,r,i);let a=t.text.slice(i);return a===``||K(a)?(U(e),Qe(e,a,n,r,t)):(e.line={...t,indent:t.indent+i,text:a},q(e,t.indent+i,r+1))}function et(e,t,n,r){let{folded:i,digit:a,chomp:o}=tt(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=U(e)){if(c||(s=Math.max(s,t.indent)),c||=t.text!==``,t.text!==``&&t.indent<s)throw new N(`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?nt(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 tt(e,t,n){let r=e.workflow?/^([|>])(?:([1-9])([+-]?)|([+-])([1-9]?))?(?: +#.*| *)$/u.exec(t):/^\|([1-9]?)([+-]?)$/u.exec(t);if(r===null)throw new N(`unsupported block scalar ${O(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 nt=(e,t,n)=>t===null||t||n?`
10
+ `.repeat(e):e===1?` `:`
11
+ `.repeat(e-1);function J(e,t,n,r,i){let{anchor:a,rest:o}=V(t,i.number),s=rt(e,o.startsWith(`#`)?``:o,n,r,i);return a!==null&&e.anchors.set(a,s),s}function rt(e,t,n,r,i){if(t.startsWith(`*`))return Pe(e,t,i.number);if(K(t))return et(e,t,n,i);if(t.startsWith(`[`)||t.startsWith(`{`))return L(Be(e,t,i,n),i.number,!0);let a=t.startsWith(`'`)||t.startsWith(`"`);if(a&&H(t)===-1)return Le(e,t,i,be);if(t!==``)return L(a?t:Re(e,t,n),i.number,!0);let o=W(e);return o?.indent===n&&G(o)&&!G(i)?Ze(e,n,r+1,!0):o===void 0||o.indent<=n?null:!G(o)&&!o.text.startsWith(`? `)&&Y(e,o)===null?(U(e),J(e,o.text,n,r+1,o)):q(e,o.indent,r+1)}function it(e,t,n,r,i){let a=t.text.slice(i),{anchor:o,rest:s}=V(a,t.number),c=t.indent+i;if(s!==``&&!s.startsWith(`#`)&&(G({text:s})||s.startsWith(`? `))){if(o!==null)throw new N(`an anchor before a block on its own line is not supported`,t.number);return e.line={...t,indent:c,text:s},q(e,c,r+1)}return s!==``&&!s.startsWith(`#`)&&R(s,t.number)!==null?(e.line={...t,indent:c,text:a},q(e,c,r+1)):(U(e),J(e,a,n,r,t))}function Y(e,t){if(!e.workflow||!t.text.startsWith(`&`))return R(t.text,t.number);let{anchor:n,rest:r}=V(t.text,t.number),i=R(r,t.number);return i&&{...i,anchor:n}}var at=`(patch_hash=`;function ot(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(at,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 X(e){if(typeof e!=`string`)throw TypeError(`expected a string`);return e.slice(0,ot(e).start)}function st(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(at,o)))throw new k(`${A(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 ct(e,t){let{start:n,peers:r}=ot(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 k(`${A(a)} is not a patch hash`,t)}return{base:e.slice(0,n),patchHash:i,peers:st(e.slice(r),e,t)}}var lt=e=>ne(e,{padding:!1}),Z=(e,t,n)=>ae(()=>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 k(`${A(e)} is not a key of the form name@version`,t);if(X(e)!==e)throw new k(`${A(e)} carries a peer or patch suffix, which only a snapshot key does`,t);return{name:T(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 k(`${A(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 k(`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:w(e.gitHosted,j(t,`gitHosted`))}}function gt(e,t){p(e,t,[`type`,`repo`,`commit`,`path`]);let n=b(e.commit,j(t,`commit`));if(!s(n))throw new k(`${A(n)} is not a full commit hash`,j(t,`commit`));return{type:`git`,repo:c(e.repo,j(t,`repo`)),commit:n,path:mt(e,t)}}function _t(e,t){return p(e,t,[`type`,`directory`]),{type:`directory`,directory:pt(e.directory,j(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 k(`unsupported resolution type, ${f(n.type)}`,j(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(E(t)){if(a!==`tarball`||r.integrity===void 0||s||r.gitHosted||r.path!==void 0)throw new k(`expected a registry tarball with an integrity, for the version ${A(t)}`,j(i,`resolution`));if(n.version!==void 0&&n.version!==t)throw new k(`expected the version in the key, ${A(t)}`,j(i,`version`));return o!==void 0&&d(o,e,t,j(j(i,`resolution`),`tarball`)),t}let c=/^([A-Za-z][\w+.-]*):/u.exec(t)?.[1];if(c===void 0)throw new k(`${A(t)} is neither a version nor a source`,i);if(c===`runtime`||!St.has(c)&&E(t.slice(c.length+1)))throw new k(`${A(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 k(`${A(t)} is not where the resolution says the package comes from`,j(i,`resolution`));if(a===`directory`){if(n.version!==void 0)throw new k(`a directory has no version in the lockfile`,j(i,`version`))}else{if(n.version===void 0)throw new k(`expected a version, for a package not from the registry`,i);return te(n.version,j(i,`version`))}}var wt=(e,t)=>x(e,t,T);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 k(`expected the name in the key, ${A(r)}`,j(n,`name`));let a=yt(t.resolution,j(n,`resolution`)),o=t.bundledDependencies;return{name:r,version:Ct(r,i,t,a,n),resolution:a,engines:C(v(t.engines),j(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:w(t.hasBin,j(n,`hasBin`)),bundledDependencies:o===void 0||o===!0?o:wt(o,j(n,`bundledDependencies`)),peerDependencies:C(v(t.peerDependencies),j(n,`peerDependencies`),T),peerDependenciesMeta:Dt(t.peerDependenciesMeta,j(n,`peerDependenciesMeta`))}}var Et=(e,t)=>(n,r)=>S(v(n),r,(n,r,i)=>(p(n,r,e),T(i,r),t(n,r))),Dt=Et([`optional`],(e,t)=>({optional:w(e.optional,j(t,`optional`))}));function Ot(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 k(`${A(e)} leads to ${A(a)}, which is not in snapshots`,i);return a}var kt=(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 k(`${A(i)} leads into the package that asks for it, which is not supported`,t);return Ot(i,T(r,t),`.`,n,t)});function At(e,n,r){return p(e,n,xt),{...t(e,n,(e,t)=>kt(e,t,r)),optional:w(e.optional,j(n,`optional`)),transitivePeerDependencies:y(e,`transitivePeerDependencies`,n,wt)??[]}}var jt=e=>Z(e,16,lt)||Z(e,16,D);function Mt(e){let t=e.indexOf(`@`,1);return t===-1?``:e.slice(0,t)}function Q(e){let t=ae(()=>ct(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&&jt(t.peers[0]))return{unpeered:n,peers:void 0};let r=new Map(t.peers.map(e=>[Mt(e),e]));return r.size===t.peers.length?{unpeered:n,peers:r}:void 0}var Nt=32;function Pt(e,t,n,r=0){if(e===t)return!0;let[i,a]=[Q(e),Q(t)];if(r>Nt||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:`)&&Pt(t,i,n,r+1)})}function Ft(e,t,n,r,i,a,o,s){if(e.length===0||e.length===1&&jt(e[0]))return;let c={...t.dependencies,...t.optionalDependencies},l=new Set,u=new Set;for(let[e,t]of Object.entries(c)){if(t.startsWith(`link:`)){u.add(e);continue}l.add(t);let n=r.get(X(t));n!==void 0&&(n.version===void 0?u.add(n.name):l.add(`${n.name}@${n.version}`))}let d=t.transitivePeerDependencies,f=(e,t)=>s&&!Object.hasOwn(c,t)&&!i().has(e)&&(Object.hasOwn(n.peerDependencies,t)&&n.peerDependenciesMeta[t]?.optional===!0||d.includes(t));for(let n of e){let e=Mt(n);if(e===``)throw new k(`${A(n)} is not a peer, as pnpm writes one in a key`,o);let r=!n.includes(`(`);if(l.has(n)||r&&u.has(e))continue;let s=r&&d.includes(e)&&!E(n.slice(e.length+1));if(!(d.length>0&&(i().has(n)||s))&&!(r&&f(n,e))){if(r)throw It(n,o);a.push({group:n,snapshot:t,where:o,leftOut:f(n,e)})}}}var It=(e,t)=>new k(`the peer ${A(e)} is not one of its dependencies, nor a peer of theirs it resolves`,t);function Lt(e,t){let n;for(let{group:r,snapshot:i,where:a,leftOut:o}of e){let e=Object.values({...i.dependencies,...i.optionalDependencies}).filter(e=>!e.startsWith(`link:`)),s=Q(r)?.unpeered;if(i.transitivePeerDependencies.includes(Mt(r))&&s!==void 0&&(n??=Map.groupBy(Object.keys(t),e=>Q(e)?.unpeered),e.push(...n.get(s)??[])),!e.some(e=>Pt(r,e,t))&&!o)throw It(r,a)}}function Rt(e,t,n){if(e.version===void 0&&t.keys().some(t=>t.startsWith(`${e.name}@`)))throw new k(`a package of no version in the lockfile, which a patch of a version of ${A(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 zt(e,t,n,r){let i=new Map,a=new Map,o=j(t,`packages`);for(let[t,n,r]of m(v(e.packages),o)){let e=Tt(t,n,r);i.set(t,e),n.version!==void 0&&t===`${e.name}@${e.version}`&&a.set(t,j(r,`version`))}let s=j(t,`snapshots`),c=p(v(e.snapshots),s),l,u=()=>l??=new Set([...Object.keys(c),...i.keys(),...i.values().map(e=>`${e.name}@${e.version}`)]),d=new Set,f=new Set,h=[],g=S(c,s,(e,t,o)=>{let{base:s,patchHash:l,peers:p}=ct(o,t),m=i.get(s);if(m===void 0)throw new k(`${A(s)} is not in packages`,t);let g=Rt(m,n,t);g!==void 0&&f.add(g);let _=g===void 0?void 0:n.get(g).hash;if(_!==l){let e=g===void 0?`none, as patchedDependencies patches no such package`:`${A(_)}, of patchedDependencies[${A(g)}]`;throw new k(`expected the patch hash ${e}, found ${l===void 0?`none`:A(l)}`,t)}d.add(s),o.includes(`:`)&&a.delete(s);let v=At(e,t,c);return Ft(p,v,m,i,u,h,t,r),{...m,patchHash:l,...v}});Lt(h,g);let _=i.keys().find(e=>!d.has(e));if(_!==void 0)throw new k(`no snapshot is of this package`,j(o,_));let y=n.keys().find(e=>!f.has(e));if(y!==void 0)throw new k(`patches no package in the lockfile, which pnpm refuses to install with`,j(j(t,`patchedDependencies`),y));let[b]=a.values();if(b!==void 0)throw new k(`a registry package has its version in its key, except where a snapshot of it has a source in its peers`,b);return{packages:g,snapshots:c}}var Bt=[...e,`dependenciesMeta`,`publishDirectory`,`linkDirectory`],$=[`configDependencies`,`packageManagerDependencies`];function Vt(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]),j(r,c),(e,t,r)=>{if(T(r,t),p(e,t,[`specifier`,`version`]),r in a)throw new k(`listed under ${s[r]} too`,t);a[r]=h(e.specifier,j(t,`specifier`)),s[r]=c;let o=j(t,`version`);return Ot(b(e.version,o),r,n,i,o)});return o}var Ht=Et([`injected`,`node`],(e,t)=>({injected:y(e,`injected`,t,g)??!1,node:y(e,`node`,t,b)}));function Ut(t,n,r,a){if(p(t,r,Bt),t.linkDirectory!==void 0&&t.linkDirectory!==!1)throw new k(`expected false, the only value pnpm writes`,j(r,`linkDirectory`));return{...Vt(t,e,n,r,a),dependenciesMeta:Ht(t.dependenciesMeta,j(r,`dependenciesMeta`)),publishDirectory:y(t,`publishDirectory`,r,i),linkDirectory:t.linkDirectory!==!1}}function Wt(e,t,n,r){let a=S(e,t,(e,t,a)=>{if(i(a,t),!r)return Ut(e,a,t,n);if(a!==`.`)throw new k(`the env document has no importer but "."`,t);return p(e,t,$),Vt(e,$,a,t,n)});if(r&&!(`.`in a))throw new k(`expected the "." importer`,t);return a}var Gt=[`lockfileVersion`,`settings`,`catalogs`,`overrides`,`patchedDependencies`,`packageExtensionsChecksum`,`pnpmfileChecksum`,`ignoredOptionalDependencies`,`time`,`importers`,`packages`,`snapshots`],Kt=[`lockfileVersion`,`importers`,`packages`,`snapshots`],qt=[`current`],Jt={__proto__:null,autoInstallPeers:g,dedupePeers:g,excludeLinksFromLockfile:g,injectWorkspacePackages:g,peersSuffixMaxLength:_},Yt=(e,t)=>S(p(v(e),t,Object.keys(Jt)),t,(e,t,n)=>Jt[n](e,t)),Xt=(e,t)=>S(v(e),t,(e,t,n)=>(b(n,t),Et([`specifier`,`version`],(e,t)=>({specifier:h(e.specifier,j(t,`specifier`)),version:b(e.version,j(t,`version`))}))(e,t)));function Zt(e,t){if(e.indexOf(`@`,1)===-1)return T(e,t);if(!E(ut(e,t).ref))throw new k(`${A(e)} is not a name and a version, or a name alone, which is not supported`,t)}var Qt=(e,t)=>S(v(e),t,(e,t,n)=>{let r=typeof e!=`string`;r&&p(e,t,[`hash`,`path`]);let a=r?j(t,`hash`):t,o=b(r?e.hash:e,a);if(!Z(o,32,D)&&!Z(o,16,lt))throw new k(`${A(o)} is not a patch hash`,a);return Zt(n,t),{hash:o,path:r?i(e.path,j(t,`path`)):void 0}});function $t(e,t){let n=b(e,t);if(Z(n,16,D)||Z(n,16,lt))return n;if(!n.startsWith(`sha256-`))throw new k(`${A(n)} is not a checksum`,t);return l(n,t)}var en=/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d+)?Z$/u,tn=(e,t,n)=>S(v(e),t,(e,t,r)=>{if(!(r in n))throw new k(`${A(r)} is not in packages`,t);let i=b(e,t),a=en.test(i)?Date.parse(i):NaN;if(Number.isNaN(a)||new Date(a).toISOString().slice(0,19)!==i.slice(0,19))throw new k(`${A(i)} is not a UTC timestamp`,t);return i});function nn(e,t,r,i){let a=n(Object.values(e).flatMap(e=>i.map(t=>e[t])),t);if(a!==void 0)throw new k(`no importer depends on it, directly or not`,j(j(r,`snapshots`),a))}function rn(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 an(t,n,r,i){let a=n===``?void 0:n,o=p(t,a).lockfileVersion;if(o!==`9.0`)throw new k(`unsupported version: expected "9.0", found ${f(o)}`,j(n,`lockfileVersion`));p(t,a,r?Kt:Gt);let s=Qt(t.patchedDependencies,j(n,`patchedDependencies`)),{packages:c,snapshots:l}=zt(t,n,new Map(Object.entries(s)),i),u=Wt(t.importers,j(n,`importers`),l,r);return nn(u,c,n,r?$:e),rn(u,c,r),r?{lockfileVersion:o,importers:u,packages:c}:{lockfileVersion:o,settings:Yt(t.settings,j(n,`settings`)),catalogs:Xt(t.catalogs,j(n,`catalogs`)),overrides:C(v(t.overrides),j(n,`overrides`),b),patchedDependencies:s,packageExtensionsChecksum:y(t,`packageExtensionsChecksum`,n,$t),pnpmfileChecksum:y(t,`pnpmfileChecksum`,n,$t),ignoredOptionalDependencies:y(t,`ignoredOptionalDependencies`,n,x)??[],time:tn(t.time,j(n,`time`),v(t.packages)),importers:u,packages:c}}function on(e,t={}){if(typeof e!=`string`)throw TypeError(`expected a string`);let{current:n=!1}=ee(t,qt);if(typeof n!=`boolean`)throw TypeError(`current: expected a boolean`);let r=/^---\r?\n/u.exec(e)?.[0];if(r===void 0){let t=Ke(e);if(t.length!==1)throw new k(`expected one document, found ${t.length}`);return{lockfile:an(t[0],``,!1,n),env:void 0}}let i=/\n---\r?\n/gu;i.lastIndex=r.length;let a=i.exec(e);if(a===null)throw new k(`expected the env document the first "---" starts to end at a line of "---"`);let o=/^(?: *\r?\n)* *$/u.test(e.slice(i.lastIndex)),s=Ke(o?e.slice(0,a.index+1):e);if(s.length!==(o?1:2))throw new k(`expected the env document${o?``:` and the lockfile`} between lines of "---" alone, found ${s.length} documents`);return{lockfile:o?void 0:an(s[1],``,!1,n),env:an(s[0],`env`,!0,!1)}}export{k as LockfileError,N as YamlError,X as packageKeyOf,on as parsePnpmLockfile};
@@ -0,0 +1,2 @@
1
+ import{a as e,c as t}from"./chunk-7YFJUT2P.js";var n=new Uint8Array,r=e=>e.every(e=>e<128),i=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]);function a(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}var o=class extends Error{constructor(e,t,{limited:n=!1}={}){super(t===void 0?e:`${e} at byte ${t}`),this.name=`ArchiveError`,this.offset=t,this.limited=n}};function s(e,t){try{return e()}catch(e){throw!(e instanceof o)||e.offset!==void 0?e:new o(e.message,t,{limited:e.limited})}}var c=class extends o{constructor(e,{bytes:t,limited:n=!1,cause:r}){super(e,void 0,{limited:n}),this.name=`CompressionError`,this.bytes=t,this.cause=r}};function l(e){try{return[CompressionStream,DecompressionStream].every(t=>new t(e))}catch{return!1}}function u(e){if(!(e instanceof Uint8Array))throw new o(`the data is not a Uint8Array`)}async function d(e,t,n,r,i,o){let s=new t(n),l=s.writable.getWriter();l.write(e).catch(()=>{}),l.close().catch(()=>{});let u=s.readable.getReader(),d=[],f=0,p=()=>o?o.subarray(0,f):d.length===1?d[0]:a(d);try{for(let e=await u.read();!e.done;e=await u.read()){let t=e.value;if(!(f+t.length<=r))throw RangeError(`output past ${r} bytes`);o&&f+t.length>o.length&&(d.push(o.subarray(0,f)),o=void 0),o?o.set(t,f):d.push(t),f+=t.length}}catch(e){u.cancel().catch(()=>{});let t=e instanceof RangeError;throw new c(t?`the data ${i}es past ${r} bytes`:`the data does not ${i}`,{bytes:p(),limited:t,cause:e})}return p()}async function f(e,t,{limit:n=1/0}={}){return u(e),await d(e,CompressionStream,t,n,`compress`)}var p=16;function m(e,t){if(e.length<18)return 0;let n=new DataView(e.buffer,e.byteOffset+e.length-4,4).getUint32(0,!0);return n<=t&&n<=e.length*p?n:0}var h=(e,t,n,r=0)=>d(e,DecompressionStream,t,n,`decompress`,r?new Uint8Array(r):void 0);async function g(e,t,{limit:n=1/0}={}){u(e);let r=t===`gzip`;try{return await h(e,t,n,r?m(e,n):0)}catch(i){if(!r||!(i instanceof c)||i.limited||e.at(-1)!==0)throw i;let a=e.findLastIndex(e=>e!==0);for(let r=a+1;r<=Math.min(a+10,e.length-1);r++)try{return await h(e.subarray(0,r),t,n)}catch(e){if(!(e instanceof c)||e.limited)throw e}throw i}}var _=(e,t,n)=>d(e,DecompressionStream,t,n.length,`decompress`,n);function v(e){return e.length<=200?JSON.stringify(e):JSON.stringify(`${e.slice(0,e.codePointAt(199)>65535?199:200)}\u2026`)}var ee=/[\p{Cc}\p{Zl}\p{Zp}\p{Bidi_Control}]/u,y=(e,t)=>ee.test(e)||t&&e.includes(`\\`);function b(e,t){if(typeof e!=`string`)throw new o(`${t} is not a string`);if(!e.isWellFormed())throw new o(`${t} is not well-formed Unicode`)}var x=(t,n)=>t.length>n||t.length*3>n&&e(t).length>n;function S(e,n,r){try{return t(e)}catch{throw new o(`${n} is not valid UTF-8`,r)}}var te={file:420,directory:493,symlink:511},ne=e=>e===`file`||e===`contiguous-file`,re=e=>e.type===`directory`?`${e.name}/`:e.name;function C(e,t){if(typeof e!=`object`||!e)throw new o(`an entry is not an object`);let r=e.type??`file`;if(typeof r!=`string`)throw new o(`entry type is not a string`);if(!Object.hasOwn(t,r))throw new o(`entry type ${v(r)} is not one this package writes`);let{name:i}=e;b(i,`entry name`);let a=e.data??n;if(!(a instanceof Uint8Array))throw new o(`data of ${v(i)} is not a Uint8Array`);if(a.length!==0&&!ne(r))throw new o(`a ${r} cannot carry data (${v(i)})`);let s=e.linkname??``;if(b(s,`link target of ${v(i)}`),s!==``&&r!==`hardlink`&&r!==`symlink`)throw new o(`a ${r} cannot have a link target (${v(i)})`);return{name:i,type:r,data:a,linkname:s}}var w=4096,ie=255;function ae(e,t){if(b(e,t),e===``)throw new o(`${t} is empty`);if(y(e,!0))throw new o(`${t} ${v(e)} holds a control or formatting character, or a backslash`);if(e.startsWith(`/`))throw new o(`${t} ${v(e)} is absolute`);let n=e.split(`/`);if(/^[a-zA-Z]:/u.test(n.find(e=>e!==`.`)??``))throw new o(`${t} ${v(e)} starts with a drive letter`);if(x(e,w))throw new o(`${t} ${v(e)} is longer than ${w} bytes`);if(n.some(e=>x(e,ie)))throw new o(`${t} ${v(e)} has a segment longer than ${ie} bytes`);return n}function oe(e,t,n=!1){let r=ae(e,t);if(r.at(-1)===``){if(!n)throw new o(`${t} ${v(e)} ends in a slash but is not a directory`);r.pop()}let i=r.filter(e=>e!==`.`),a=i.find(e=>e===``||e===`..`);if(a!==void 0)throw new o(`${t} ${v(e)} has ${a?`a .. segment`:`an empty segment`}`);if(i.length===0){if(!n)throw new o(`${t} ${v(e)} names the archive root but is not a directory`);return`.`}let s=i.join(`/`);if(x(s,w-+!!n))throw new o(`${t} ${v(e)} is longer than ${w} bytes`);return s}function se(e=0){if(!(Number.isSafeInteger(e)&&e>=0))throw new o(`symlinksAbove ${String(e)} is not a whole number of levels`);return e}function ce(e,t,n=0){let r=ae(t,`symlink target of ${v(e)}`).filter(e=>e!==``&&e!==`.`),i=e.split(`/`).length-1;for(let a of r)if(i+=a===`..`?-1:1,i<-n){let r=n===0?`outside the archive`:`more than ${n} level${n===1?``:`s`} above the archive`;throw new o(`symlink ${v(e)} points ${r}, to ${v(t)}`)}return r}function T(e,t,n,r=0){let i=oe(e,`entry name`,t===`directory`);return t===`symlink`&&ce(i,n,r),{name:i,linkname:t===`hardlink`?oe(n,`hard link target of ${v(i)}`):n}}var E=()=>({kind:void 0,entry:void 0,symlink:void 0,first:void 0,firstNode:void 0,rest:void 0});function D(e,t,n=!0){if(e.first===t)return e.firstNode;let r=e.rest?.get(t);return r!==void 0||!n||(r=E(),e.first===void 0?Object.assign(e,{first:t,firstNode:r}):(e.rest??=new Map).set(t,r)),r}var le=[`type`,`mode`,`uid`,`gid`,`mtime`,`uname`,`gname`,`linkname`,`devmajor`,`devminor`],O=40,ue=Symbol(`resolving`),de=e=>e.split(`/`).filter(e=>e!==``&&e!==`.`),k=class{#e=E();#t;#n;#r;#i=new Map;#a=0;constructor(e=!1,t=0,n=!1){this.#t=e,this.#n=se(t),this.#r=n?[]:null}get above(){return this.#n}add(e){let{name:t,type:n}=e,r=n===`symlink`?e.linkname:void 0;if(n===`hardlink`){let n=this.#d(e.linkname);if(n?.kind!==`entry`)throw new o(`hard link ${v(t)} targets ${v(e.linkname)}, which is not an earlier non-directory entry`);r=n.symlink,r!==void 0&&this.#o(t,r,`hard link ${v(t)} to symlink ${v(e.linkname)}`)}let a=t.split(`/`),s=this.#u(a),c=s.at(-1);if(c.kind!==void 0&&c.kind!==`implied`){let n=le.find(t=>c.entry[t]!==e[t]);if(n!==void 0)throw new o(`duplicate entry ${v(t)} differs in ${n}`);if(c.entry.data===void 0)throw new o(`duplicate entry ${v(t)}, which only the in-memory call can compare with the earlier one`);if(!i(c.entry.data,e.data))throw new o(`duplicate entry ${v(t)} differs in data`);return}let l=n===`directory`?`directory`:`entry`;if(c.kind!==void 0&&l!==`directory`)throw new o(`${v(t)} is already a directory, so it cannot be a ${n}`);for(let e=1;e<a.length;e++)this.#l(s[e],()=>`${v(t)} is inside ${v(a.slice(0,e).join(`/`))}, which is not a directory`);c.kind=l,c.symlink=r,c.entry=this.#t?e:Object.fromEntries(le.map(t=>[t,e[t]])),n===`symlink`&&this.#o(t,e.linkname,`symlink ${v(t)}`)}#o(e,t,n){let r=ce(e,t,this.#n);if(this.#r!==null){this.#r.push({at:e,what:n});return}let i=e.split(`/`).slice(0,-1),a=this.#u(i);for(let[e,t]of r.entries()){if(t===`..`){if(i.length===0)return;i.pop(),a.pop()}else i.push(t),a.push(D(a.at(-1),t));e<r.length-1&&i.length&&this.#l(a.at(-1),()=>`the target of ${n} passes through ${v(i.join(`/`))}, which is not a directory`)}}settle(){for(let{at:e,what:t}of this.#r??[]){let n=e.split(`/`),r=this.#u(n);this.#s(r.pop(),{nodes:r,names:n.slice(0,-1)},t)}}#s(e,t,n){let r=this.#i.get(e);if(r===ue)throw new o(`${n} leads through a loop of symlinks`);if(r!==void 0)return r;if(this.#a>O)throw new o(`${n} leads through more than ${O} symlinks`);this.#i.set(e,ue),this.#a++;try{let r=this.#c(t,de(e.symlink),n);return this.#i.set(e,r),r}finally{this.#a--}}#c(e,t,n){let r=[...e.nodes],i=[...e.names],a=i.length,s=!1,c=0;for(let[e,l]of t.entries()){if(l===`..`){if(--a,a<-this.#n)throw new o(`${n} leads ${this.#n===0?`outside the archive`:`more than ${this.#n} level${this.#n===1?``:`s`} above the archive`} through the symlinks it passes`);s||a<0?s=!0:(r.pop(),i.pop());continue}if(a+=1,s)continue;let u=D(r.at(-1),l,!1);if(u?.symlink!==void 0){let d=this.#s(u,{nodes:r,names:i},n);if(c+=d.hops+1,c>O)throw new o(`${n} leads through more than ${O} symlinks`);if(!d.outside&&d.nodes.at(-1).kind===`entry`&&e<t.length-1)throw new o(`the target of ${n} passes through ${v([...i,l].join(`/`))}, which leads to ${v(d.names.join(`/`))}, not a directory`);a=d.depth,s=d.outside,r=[...d.nodes],i=[...d.names]}else{if(u?.kind===`entry`&&e<t.length-1)throw new o(`the target of ${n} passes through ${v([...i,l].join(`/`))}, which is not a directory`);r.push(u??E()),i.push(l)}}return{nodes:r,names:i,depth:a,outside:s,hops:c}}#l(e,t){if(e.kind===`entry`)throw new o(t());e.kind??=`implied`}#u(e){let t=[this.#e];for(let n of e)t.push(D(t.at(-1),n));return t}#d(e){return e.split(`/`).reduce((e,t)=>e&&D(e,t,!1),this.#e)}},A=512,j=e=>e===`character-device`||e===`block-device`,M={file:48,hardlink:49,symlink:50,"character-device":51,"block-device":52,directory:53,fifo:54,"contiguous-file":55},N={pax:120,global:103,longname:76,longlink:75},P=100,F=155,I=32,fe=0,L=[[`mode`,100,8],[`uid`,108,8],[`gid`,116,8],[`size`,124,12],[`mtime`,136,12]],R=148,z=156,B=157,V=257,pe=265,H=297,U=329,W=337,me=345,he=386,ge=495,_e=`ustar\x0000`,ve=`ustar \0`,G=e=>Uint8Array.from(e,e=>e.codePointAt(0)),K=e=>String.fromCodePoint(...e),q=(e,t,n,r)=>e.subarray(t,t+n).set(r),J=(e,t,n)=>xe(e.subarray(t,t+n)),ye=e=>8**(e-1)-1,be=(e,t)=>e>=0&&e<=ye(t);function Y(e,t,n,r,i){if(be(r,n)){q(e,t,n,G(r.toString(8).padStart(n-1,`0`)));return}if(!i)throw new o(`${r} does not fit an octal field of ${n-1} digits`);e[t]=r<0?255:128;let a=BigInt.asUintN((n-1)*8,BigInt(r));for(let r=t+n-1;r>t;r--)e[r]=Number(a&255n),a>>=8n}function X(e,t,n,r,i,a=!1){let s=e[t];if(s===128||s===255){let c=0n;for(let r=t+1;r<t+n;r++)c=c<<8n|BigInt(e[r]);if(s===255&&(c=BigInt.asIntN((n-1)*8,c)),c<0n&&!a)throw new o(`the ${r} field is negative`,i);if(!Number.isSafeInteger(Number(c)))throw new o(`the ${r} field is too large`,i);return Number(c)}let c=/^ *([0-7]*) *$/u.exec(K(J(e,t,n)));if(!c)throw new o(`the ${r} field is not an octal number`,i);return c[1]===``?0:Number.parseInt(c[1],8)}function xe(e){let t=e.indexOf(0);return t===-1?e:e.subarray(0,t)}function Se(e){let t=256;for(let n=0;n<R;n++)t+=e[n];for(let n=R+8;n<A;n++)t+=e[n];return t}var Z=e=>e.every(e=>e===0);function Ce(e){let t=new Uint8Array(A);q(t,fe,P,e.name);for(let[n,r,i]of L)Y(t,r,i,e[n],e.gnu);return t[z]=e.typeflag,q(t,B,P,e.linkname),q(t,V,8,G(e.gnu?ve:_e)),q(t,pe,I-1,e.uname),q(t,H,I-1,e.gname),e.devmajor!==null&&Y(t,U,8,e.devmajor,e.gnu),e.devminor!==null&&Y(t,W,8,e.devminor,e.gnu),q(t,me,F,e.prefix),q(t,R,8,G(`${Se(t).toString(8).padStart(6,`0`)}\0 `)),t}var we=(e,t,n)=>/^ *[0-7]+ *$/u.test(K(J(e,t,n)));function Te(e,t){if(Se(e)!==X(e,R,8,`checksum`,t))throw new o(`header checksum does not match`,t);let r=K(e.subarray(V,V+8)),i=r===ve;if(!i&&r!==_e)throw new o(`header is not in the ustar, pax or gnu format`,t);if(i&&!Z(e.subarray(he,ge)))throw new o(`header carries an old GNU sparse map or real size`,t);let a=e[z],s=a===M[`character-device`]||a===M[`block-device`],c=[[`checksum`,R,8],...L,...s?[[`devmajor`,U,8],[`devminor`,W,8]]:[]];return{gnu:i,typeflag:a,name:J(e,fe,P),prefix:i?n:J(e,me,F),linkname:J(e,B,P),uname:J(e,pe,I),gname:J(e,H,I),...Object.fromEntries(L.map(([n,r,i])=>[n,X(e,r,i,n,t,n===`mtime`)])),devmajor:s?X(e,U,8,`devmajor`,t):0,devminor:s?X(e,W,8,`devminor`,t):0,octal:c.every(([,t,n])=>we(e,t,n))}}function Ee(t,n){let r=e(` ${t}=${n}
2
+ `),i=r.length+1;for(;r.length+String(i).length!==i;)i++;return a([e(String(i)),r])}var De=e=>a(e.map(([e,t])=>Ee(e,t))),Q=`pax records cannot be changed`,Oe=class extends Map{set(){throw TypeError(Q)}delete(){throw TypeError(Q)}clear(){throw TypeError(Q)}};function ke(e,t){let n=new Oe;for(let r=0;r<e.length;){let i=r,a=0;for(;i<e.length&&e[i]>=48&&e[i]<=57;i++)a=a*10+(e[i]-48);if(i===r||e[r]===48||e[i]!==32)throw new o(`a pax record does not begin with its length`,t);let s=r+a;if(s>e.length||e[s-1]!==10)throw new o(`a pax record is not as long as it says`,t);let c=e.indexOf(61,i+1);if(c===-1||c>=s-1)throw new o(`a pax record has no keyword=value`,t);let l=S(e.subarray(i+1,c),`a pax record`,t);if(l===``||y(l,!1)||l.includes(` `))throw new o(`pax keyword ${v(l)} is malformed`,t);if(n.has(l))throw new o(`pax keyword ${l} repeats`,t);Map.prototype.set.call(n,l,S(e.subarray(c+1,s-1),`a pax record`,t)),r=s}return n}var Ae=e=>Object.entries(e).map(([e,t])=>[t,e]),je=new Map([...Ae(M),[0,`file`]]),Me=new Map(Ae(N)),Ne=1<<20,Pe=new Oe,Fe=Object.freeze([]),Ie=e=>e.gnu?`gnu`:`ustar`,Le=e=>Math.ceil(e/A)*A,Re=new Set([`SCHILY.realsize`,`SUN.holesdata`]);function ze(e,t){if(e.some(e=>e.startsWith(`GNU.sparse.`)||Re.has(e)))throw new o(`sparse entries are not supported`,t)}function Be(e,t,n){if(!/^(?:0|[1-9][0-9]*)$/u.test(e)||!Number.isSafeInteger(Number(e)))throw new o(`pax ${t}=${v(e)} is not a whole number this package can hold`,n);return Number(e)}function Ve(e,t,n){let r=/^(-?)([0-9]+)(?:\.([0-9]+))?$/u.exec(e);if(!r)throw new o(`pax ${t}=${v(e)} is not a time`,n);let[,i,a,s=``]=r,c=Number(i+a)-(i&&/[1-9]/u.test(s)?1:0);if(!Number.isSafeInteger(c))throw new o(`pax ${t}=${v(e)} is out of range`,n);return c}function He(e,t){let n=S(e.name,`entry name`,t);return e.prefix.length?`${S(e.prefix,`name prefix`,t)}/${n}`:n}var Ue=class{#e=[];#t=0;#n=0;#r=0;#i;#a={pax:null,longname:null,longlink:null};#o=[];#s=null;#c=null;#l=0;#u=!1;#d=0;#f;#p;constructor(e,{symlinksAbove:t,maxEntries:n=1/0,trailingGlobal:r=!1}={}){if(n!==1/0&&!(Number.isSafeInteger(n)&&n>=0))throw new o(`maxEntries ${String(n)} is not a whole number of entries`);if(typeof r!=`boolean`)throw new o(`trailingGlobal ${String(r)} is not a boolean`);this.#i=new k(e,t),this.#f=n,this.#p=r}*push(e){if(!(e instanceof Uint8Array))throw new o(`a chunk is not a Uint8Array`);for(e.length&&(this.#e.push(e),this.#n+=e.length);!this.#u;){let e=this.#m(this.#c?Le(this.#c.size):A);if(e===null)return;let t=this.#c?this.#g(e):this.#h(e);t&&(yield t)}let t=this.#r;if(!Z(this.#m(this.#n)))throw new o(`data after the end of the archive`,t)}end(){if(!this.#u)throw this.#r===0&&this.#n===0?new o(`the archive is empty`):this.#c===null&&this.#n===0?new o(this.#l?`the archive ends with a lone zero block`:`the archive has no end marker`,this.#r):new o(`the archive is truncated`,this.#r)}#m(e){if(this.#n<e)return null;if(e===0)return n;let t,r=this.#t+e;if(r<=this.#e[0].length)t=this.#e[0].subarray(this.#t,r);else{let e=0;for(;r>this.#e[e].length;)r-=this.#e[e++].length;t=a([this.#e[0].subarray(this.#t),...this.#e.slice(1,e),this.#e[e].subarray(0,r)]),this.#e.splice(0,e)}return this.#t=r,r===this.#e[0].length&&(this.#e.shift(),this.#t=0),this.#n-=e,this.#r+=e,t}#h(e){let t=this.#r-A;if(Z(e)){if(this.#o.some(({kind:e})=>e!==`global`||!this.#p))throw new o(`an extended header is not followed by an entry`,t);this.#u=++this.#l===2;return}if(this.#l)throw new o(`a lone zero block where a header should be`,t);let n=Te(e,t),r=Me.get(n.typeflag);if(r===void 0){if(++this.#d>this.#f)throw new o(`the archive holds more than ${this.#f} entries`,t,{limited:!0});this.#c={at:t,...this.#_(n,t)}}else{if(n.size>Ne)throw new o(`a ${r} header of ${n.size} bytes is longer than any tar writes`,t);this.#c={at:t,size:n.size,extended:Object.freeze({kind:r,magic:Ie(n),octal:n.octal})}}}#g(e){let{at:t,size:n,entry:r,extended:i}=this.#c;if(this.#c=null,!Z(e.subarray(n)))throw new o(`the padding after an entry is not zero`,t);let a=e.subarray(0,n);if(r)return r.data=a,s(()=>this.#i.add(r),t),r;let{kind:c}=i;if(c===`global`){this.#s=ke(a,t);let e=[`path`,`linkpath`,`size`].find(e=>this.#s.has(e));if(e!==void 0)throw new o(`a global header sets ${e}`,t);ze(this.#s.keys(),t)}else{if(this.#a[c]!==null)throw new o(`two ${c} headers ahead of one entry`,t);this.#a[c]=c===`pax`?ke(a,t):S(xe(a),`a ${c} header`,t)}this.#o.push(i)}#_(e,t){let r=je.get(e.typeflag);if(r===void 0)throw new o(`entry type ${v(String.fromCodePoint(e.typeflag))} is not one this package reads`,t);let{pax:i,longname:a,longlink:c}=this.#a;this.#a={pax:null,longname:null,longlink:null};let l=e=>i?.get(e)??this.#s?.get(e);if(i!==null&&ze(i.keys(),t),a!==null&&l(`path`)!==void 0)throw new o(`both a long name header and a pax path name one entry`,t);if(c!==null&&l(`linkpath`)!==void 0)throw new o(`both a long link header and a pax linkpath name one entry`,t);let u=a??l(`path`)??He(e,t),d=c??l(`linkpath`)??S(e.linkname,`link target`,t),{name:f,linkname:p}=s(()=>T(u,r,d,this.#i.above),t),m=(n,r=Be)=>{let i=l(n);return i===void 0?e[n]:r(i,n,t)},h=m(`size`);if(h!==0&&!ne(r))throw new o(`a ${r} entry has a size`,t);if(p!==``&&r!==`hardlink`&&r!==`symlink`)throw new o(`a ${r} entry has a link target`,t);let g=n=>{let r=l(n)??S(e[n],n,t);if(y(r,!1))throw new o(`${n} ${v(r)} holds a control or formatting character`,t);return r},_=j(r),ee={name:f,type:r,mode:e.mode&4095,uid:m(`uid`),gid:m(`gid`),mtime:m(`mtime`,Ve),uname:g(`uname`),gname:g(`gname`),linkname:p,devmajor:_?m(`devmajor`):0,devminor:_?m(`devminor`):0,data:n,storedName:u,storedLinkname:d,pax:i??Pe,globalPax:this.#s??Pe,extended:this.#o.length?Object.freeze(this.#o):Fe,magic:Ie(e),typeflag:String.fromCodePoint(e.typeflag),storedMode:e.mode,octal:e.octal};return this.#o=[],{entry:ee,size:h}}};function We(e,t){let n=new Ue(!0,t),r=[...n.push(e)];return n.end(),r}var Ge=new Set([`gnu`,`ustar`,`pax`]),Ke=47;function $(e,t,n=!1){if(!Number.isSafeInteger(e)||!n&&e<0)throw new o(`${t} ${String(e)} is not ${n?`an integer`:`a non-negative integer`}`);return e}function qe(e,t){if(b(e,t),y(e,!1))throw new o(`${t} ${v(e)} holds a control or formatting character`);return e}function Je(e,t){let n=C(e,M),{name:r,type:i,linkname:a}=n,s=$(e.devmajor??0,`devmajor`),c=$(e.devminor??0,`devminor`);if((s!==0||c!==0)&&!j(i))throw new o(`a ${i} cannot have device numbers (${v(r)})`);let l=$(e.mode??te[i]??420,`mode`);if(l>4095)throw new o(`mode ${l.toString(8)} has bits beyond the permission bits`);return{...n,mode:l,uid:$(e.uid??0,`uid`),gid:$(e.gid??0,`gid`),mtime:$(e.mtime??0,`mtime`,!0),uname:qe(e.uname??``,`uname`),gname:qe(e.gname??``,`gname`),devmajor:s,devminor:c,...T(r,i,a,t)}}function Ye(e,t=e.length){let n=new Uint8Array(Math.ceil(t/A)*A);return n.set(e),n}var Xe=(t,r,i,a,o)=>Ce({gnu:o,name:e(t).subarray(0,P),prefix:n,linkname:n,uname:n,gname:n,typeflag:a,mode:420,uid:0,gid:0,size:r,mtime:i,devmajor:null,devminor:null}),Ze=(e,t)=>[Xe(`././@LongLink`,e.length+1,0,t,!0),Ye(e,e.length+1)];function Qe(e,t){let n=De(t),r=e.name.lastIndexOf(`/`);return[Xe(r===-1?`./PaxHeaders/${e.name}`:`${e.name.slice(0,r)}/PaxHeaders/${e.name.slice(r+1)}`,n.length,Math.max(0,Math.min(e.mtime,ye(12))),N.pax,!1),Ye(n)]}function $e(e,t){let{length:n}=e;if(n>F+P+1)throw new o(`name ${v(t)} is longer than 256 bytes, which ustar cannot hold`);let r=n>F+1?F+1:e[n-1]===Ke?n-1:n,i=e.lastIndexOf(Ke,r-1),a=n-i-1;if(i<=0||a>P||a===0)throw new o(`name ${v(t)} cannot be split into ustar's prefix and name fields`);return{prefix:e.subarray(0,i),name:e.subarray(i+1)}}function et(t,i){let a=i===`gnu`,s=[],c=[],l=re(t),u=e(l),d=n,f=e(t.linkname);if(f.length>P){if(a)c.push(...Ze(f,N.longlink));else if(i===`pax`)s.push([`linkpath`,t.linkname]);else throw new o(`link target of ${v(t.name)} is longer than 100 bytes, which ustar cannot hold`);f=f.subarray(0,P)}i===`pax`&&(u.length>P||!r(u))&&s.push([`path`,l]),u.length>P&&(a?c.push(...Ze(u,N.longname)):i===`ustar`&&({prefix:d,name:u}=$e(u,t.name)),u.length>P&&(u=u.subarray(0,P)));let p=(e,n,r)=>{if(a||be(n,r))return n;if(i!==`pax`)throw new o(`${e} ${n} of ${v(t.name)} does not fit the ustar format`);return s.push([e,String(n)]),0},m=(n,a)=>{let c=e(a);if(c.length<I&&(i!==`pax`||r(c)))return c;if(i!==`pax`)throw new o(`${n} of ${v(t.name)} is longer than 31 bytes, which the ${i} format cannot hold`);return s.push([n,a]),c.subarray(0,I-1)},h=j(t.type),g={gnu:a,name:u,prefix:d,linkname:f,typeflag:M[t.type],mode:t.mode,uid:p(`uid`,t.uid,8),gid:p(`gid`,t.gid,8),size:p(`size`,t.data.length,12),mtime:p(`mtime`,t.mtime,12),devmajor:h?p(`devmajor`,t.devmajor,8):null,devminor:h?p(`devminor`,t.devminor,8):null,uname:m(`uname`,t.uname),gname:m(`gname`,t.gname)};return s.length&&c.push(...Qe(t,s)),c.push(Ce(g)),t.data.length&&c.push(t.data),t.data.length%A&&c.push(new Uint8Array(A-t.data.length%A)),c}function tt({format:e=`gnu`,blocking:t=20,symlinksAbove:n}={},r=!1){if(!Ge.has(e))throw new o(`format ${v(String(e))} is not gnu, ustar or pax`);if(!Number.isSafeInteger(t)||t<1)throw new o(`blocking is not a positive integer`);let i=new k(r,n),a=0;return{add(t){let n=Je(t,i.above);i.add(n);let r=et(n,e);for(let e of r)a+=e.length;return r},end(){let e=t*A;return[new Uint8Array(Math.ceil((a+2*A)/e)*e-a)]}}}function nt(e,t){let n=tt(t,!0),r=[];for(let t of e)r.push(...n.add(t));return a([...r,...n.end()])}export{n as a,r as b,i as c,a as d,o as e,s as f,c as g,l as h,f as i,g as j,_ as k,v as l,S as m,te as n,re as o,C as p,T as q,k as r,nt as s,We as t};
@@ -0,0 +1 @@
1
+ import{a as e,c as t}from"./chunk-TUII34K2.js";async function n(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream(`gzip`));return new Uint8Array(await new Response(t).arrayBuffer())}async function r(e,{maxBytes:t}={}){let n=new Blob([e]).stream().pipeThrough(new DecompressionStream(`gzip`));if(t==null)return new Uint8Array(await new Response(n).arrayBuffer());let r=n.getReader(),i=[],a=0;for(;;){let{value:e,done:n}=await r.read();if(n)break;if(a+=e.length,a>t){try{await r.cancel()}catch{}throw RangeError(`gunzipBytes: decompressed size exceeds ${t}-byte cap`)}i.push(e)}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return o}async function i(t){return await n(e(t))}async function a(e){return t(await r(e))}export{n as a,r as b,i as c,a as d};
@@ -0,0 +1 @@
1
+ import{l as e}from"./chunk-5M2X3QPK.js";function t(t){let n=e(t),r=new Map;for(let[e,i]of Object.entries(t?.bundle?.reason??{})){let t=new Set(Array.isArray(i)?i.filter(e=>n.has(e)):[]);t.size>0&&r.set(e,t)}return{stasis:t?.kind===`stasis`,files:n,trees:r}}var n=[[`extra`,`add`],[`metro`,`bundle:metro`]];function r(e){if(e.length!==2)return e;let t=(t,n)=>e.find((r,i)=>r.trees.has(n)&&!r.trees.has(t)&&e[1-i].trees.has(t)&&!e[1-i].trees.has(n)),r=e.map(()=>new Map);for(let[i,a]of n){let n=t(i,a);n&&r[e.indexOf(n)].set(a,i)}let i=t(`metro`,`bundle:metro`);return i&&t(`run`,`bundle`)===i&&r[e.indexOf(i)].set(`bundle`,`run`),e.map((e,t)=>r[t].size===0?e:{...e,trees:new Map([...e.trees].map(([e,n])=>[r[t].get(e)??e,n])),actual:new Map([...r[t]].map(([e,t])=>[t,e]))})}function i(e,t){if(!e.stasis||e.trees.size!==1)return null;let[[n,r]]=e.trees;return r.size===e.files.size&&!t.some(t=>t!==e&&t.trees.has(n))?n:null}var a=e=>e.trees.size===0||e.trees.size===1&&[...e.trees.values()][0].size===e.files.size,o=`reasons:`,s=(e,t)=>`${o}${JSON.stringify([e,t].toSorted())}`;function c(e){if(!e.startsWith(o))return null;try{let t=JSON.parse(e.slice(o.length));return Array.isArray(t)&&t.length===2&&t.every(e=>typeof e==`string`)?t:null}catch{return null}}function l(...e){let n=r(e.map(t));if(n.length===2&&!n.some(a)){let[e,t]=n.map(e=>[...e.trees.keys()].toSorted()),r=e.filter(e=>t.includes(e)),[i,a]=[e,t].map(e=>e.filter(e=>!r.includes(e)));if(i.length>0&&a.length>0)return[...r.map(e=>({id:`reason:${e}`,label:e})),...i.flatMap(e=>a.map(t=>({id:s(e,t),label:`${e} \u2192 ${t}`})))]}let o=n.filter(e=>i(e,n)===null),c=new Set(o.flatMap(e=>[...e.trees.keys()])),l=e=>o.some(t=>t.stasis&&(t.trees.get(e)?.size??0)<t.files.size);return[...c].some(l)?[...c].toSorted().map(e=>({id:`reason:${e}`,label:e})):[]}function u(e,n,a=``){if(!a)return[``,``];let o=c(a),s=r([e,n].map(t)),l=a.startsWith(`reason:`)?a.slice(7):null;return s.map(e=>{let t=o?o.find(t=>e.trees.has(t)):i(e,s)??l;return t==null?a:`reason:${e.actual?.get(t)??t}`})}function d(t,n=``){let r=e(t);if(!n||t?.kind!==`stasis`)return r;let i=t?.bundle?.reason?.[n.replace(/^reason:/u,``)],a=new Set(Array.isArray(i)?i:[]);return new Map([...r].filter(([e])=>a.has(e)))}function f(e,t,n,r){return JSON.stringify([e,t,n,r])}function p(t,n=``){let r=new Map;if(t?.kind!==`stasis`||!t.bundle)return r;let i=n?e(t):null,a=n?d(t,n):null;for(let[e,n]of t.bundle.imports)for(let[t,o]of n)for(let[n,s]of o){let o=typeof s==`string`?[[null,s]]:s;for(let[s,c]of o){if(a&&!a.has(t)&&(i.has(t)||!a.has(c)))continue;let o=f(t,n,e,s);r.set(o,{key:o,parent:t,specifier:n,conditions:e,platform:s,target:c})}}return r}export{l as a,u as b,d as c,f as d,p as e};
@@ -0,0 +1,17 @@
1
+ import{a as e,b as t,c as n}from"./chunk-C4Z6ZBXV.js";import{f as r,h as i}from"./chunk-2XUEZHIP.js";var a=`!important`,o=t(class extends n{constructor(t){if(super(t),t.type!==e.ATTRIBUTE||t.name!==`style`||t.strings?.length>2||t.strings?.some(e=>e!==``))throw Error("`styleMap` must be the whole of a `style` attribute.");this.shown=new Set}render(){return r}update(e,[t]){let{style:n}=e.element;for(let e of this.shown)t[e]??(this.shown.delete(e),e.includes(`-`)?n.removeProperty(e):n[e]=null);for(let[e,r]of Object.entries(t)){if(r==null)continue;this.shown.add(e);let t=typeof r==`string`&&r.endsWith(a);e.includes(`-`)||t?n.setProperty(e,t?r.slice(0,-a.length):r,t?`important`:``):n[e]=r}return r}}),{I:s}=i,c=e=>e,l=e=>e.strings===void 0,u=()=>document.createComment(``),d=(e,t,n)=>{let r=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0)n=new s(r.insertBefore(u(),i),r.insertBefore(u(),i),e,e.options);else{let t=n._$AB.nextSibling,a=n._$AM,o=a!==e;if(o){let t;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(t=e._$AU)!==a._$AU&&n._$AP(t)}if(t!==i||o){let e=n._$AA;for(;e!==t;){let t=c(e).nextSibling;c(r).insertBefore(e,i),e=t}}}return n},f=(e,t,n=e)=>(e._$AI(t,n),e),p={},m=(e,t=p)=>e._$AH=t,h=e=>e._$AH,g=e=>{e._$AR(),e._$AA.remove()},_=(e,t,n)=>{let r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},v=t(class extends n{constructor(t){if(super(t),t.type!==e.CHILD)throw Error(`repeat() can only be used in text expressions`)}dt(e,t,n){let r;n===void 0?n=t:t!==void 0&&(r=t);let i=[],a=[],o=0;for(let t of e)i[o]=r?r(t,o):o,a[o]=n(t,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,i]){let a=h(e),{values:o,keys:s}=this.dt(t,n,i);if(!Array.isArray(a))return this.ut=s,o;let c=this.ut??=[],l=[],u,p,v=0,y=a.length-1,b=0,x=o.length-1;for(;v<=y&&b<=x;)if(a[v]===null)v++;else if(a[y]===null)y--;else if(c[v]===s[b])l[b]=f(a[v],o[b]),v++,b++;else if(c[y]===s[x])l[x]=f(a[y],o[x]),y--,x--;else if(c[v]===s[x])l[x]=f(a[v],o[x]),d(e,l[x+1],a[v]),v++,x--;else if(c[y]===s[b])l[b]=f(a[y],o[b]),d(e,a[v],a[y]),y--,b++;else if(u===void 0&&(u=_(s,b,x),p=_(c,v,y)),u.has(c[v])){if(u.has(c[y])){let t=p.get(s[b]),n=t===void 0?null:a[t];if(n===null){let t=d(e,a[v]);f(t,o[b]),l[b]=t}else l[b]=f(n,o[b]),d(e,a[v],n),a[t]=null;b++}else g(a[y]),y--}else g(a[v]),v++;for(;b<=x;){let t=d(e,l[x+1]);f(t,o[b]),l[b++]=t}for(;v<=y;){let e=a[v++];e!==null&&g(e)}return this.ut=s,m(e,l),r}});export{o as a,l as b,m as c,v as d};
2
+ /*! Bundled license information:
3
+
4
+ lit-html/directive-helpers.js:
5
+ (**
6
+ * @license
7
+ * Copyright 2020 Google LLC
8
+ * SPDX-License-Identifier: BSD-3-Clause
9
+ *)
10
+
11
+ lit-html/directives/repeat.js:
12
+ (**
13
+ * @license
14
+ * Copyright 2017 Google LLC
15
+ * SPDX-License-Identifier: BSD-3-Clause
16
+ *)
17
+ */
@@ -0,0 +1 @@
1
+ var{Buffer:e}=globalThis,t=e&&!e.TYPED_ARRAY_SUPPORT,n=new Uint8Array(Uint16Array.of(258).buffer)[0]===2,r=e=>e&&(t||`${e}`.includes(`[native code]`));!t&&r(()=>{})&&(r=()=>!1);function i(e,t,n,r){let i=``,a=t;for(let t=n-3;a<t;a+=4){let t=e[a],n=e[a+1],o=e[a+2],s=e[a+3];i+=r[t],i+=r[n],i+=r[o],i+=r[s]}for(;a<n;)i+=r[e[a++]];return i}function a(e,t){let n=e.length;for(let r=0;r<n;r++)t[r]=e.charCodeAt(r);return t}var o=null,s=!1,c=!1,l=new TextEncoder,u=new TextDecoder(`utf-8`,{ignoreBOM:!0}),d=new TextDecoder(`latin1`,{ignoreBOM:!0});function f(e,t,n,r){if(n-t>3e4){let a=[];for(let o=t;o<n;){let t=o+500,s=t>n?n:t;a.push(i(e,o,s,r)),o=s}let o=a.join(``);return a.length=0,o}return i(e,t,n,r)}var p=globalThis.Buffer;function m(e){if(!(e&&e instanceof Uint8Array))throw TypeError(`Expected an Uint8Array`)}var h=`Input is not a string`,g=`Input is not well-formed Unicode`;function _(e,t){switch(t){case`uint8`:if(e.constructor!==Uint8Array)throw Error(`Unexpected`);return e;case`arraybuffer`:if(e.byteLength!==e.buffer.byteLength)throw Error(`Unexpected`);return e.buffer;case`buffer`:return e.length<=64?p.from(e):p.from(e.buffer,e.byteOffset,e.byteLength)}throw TypeError(`Unexpected format`)}function v(e,t){switch(t){case`uint8`:return e.length<=64||e.byteOffset!==0||e.byteLength!==e.buffer.byteLength?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);case`arraybuffer`:return e.buffer.byteLength===e.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);case`buffer`:if(e.constructor!==p)throw Error(`Unexpected`);return e}throw TypeError(`Unexpected format`)}export{n as a,a as b,o as c,s as d,c as e,l as f,u as g,d as h,f as i,m as j,h as k,g as l,_ as m,v as n};
@@ -0,0 +1,7 @@
1
+ import{a as e}from"./chunk-QI66YA4F.js";import{C as t,H as n,J as r,K as i,L as a,R as o,a as s,c,d as l,e as u,g as d,h as f,i as p,m,p as h,u as ee}from"./chunk-LVW7WWV4.js";import"./chunk-ZQHLECTI.js";import{d as g,f as te,h as _,i as v,j as ne,m as re,n as ie}from"./chunk-7HP2VYIC.js";import"./chunk-PXK7EU4V.js";import"./chunk-OOJM4CTU.js";var y=e=>e.replace(/^[ \t\n\r\0\v]+|[ \t\n\r\0\v]+$/gu,``),b=e=>e.replace(/[A-Z]+/gu,e=>e.toLowerCase()),x=e=>e===void 0||e===``||e===`0`,S=e=>e!==void 0&&e>=`0`&&e<=`9`,ae=e=>S(e)||/^[A-Za-z]$/u.test(e??``);function oe(e){let t=e[0];for(let n=1;n<e.length;n++){let r=e[n],i=e[n-1],a=t.at(-1)===`.`?``:`.`;r===`-`||r===`_`||r===`+`?t+=a:!S(i)&&i!==`.`&&S(r)||S(i)&&!S(r)&&r!==`.`?t+=`${a}${r}`:ae(r)?t+=r:t+=a}return t.endsWith(`.`)?t.slice(0,-1):t}var se=[[`dev`,0],[`alpha`,1],[`a`,1],[`beta`,2],[`b`,2],[`RC`,3],[`rc`,3],[`#`,4],[`pl`,5],[`p`,5]],C=e=>se.find(([t])=>e.startsWith(t))?.[1]??-1,w=e=>e>0?1:e<0?-1:0,T=2n**63n-1n,ce=e=>e<=T&&e>=-T-1n,le=e=>{let t=BigInt(/^\d+/u.exec(e)[0]);return t>T?T:t};function ue(e,t){return S(e[0])&&S(t[0])?w(Number(le(e)-le(t))):!S(e[0])&&!S(t[0])?w(C(e)-C(t)):S(e[0])?w(C(`#N#`)-C(t)):w(C(e)-C(`#N#`))}var de=new TextEncoder,fe=e=>/^[\0-\u007F]*$/u.test(e)?e:String.fromCodePoint(...de.encode(e));function pe(e,t){if(e===``||t===``)return e===t?0:e===``?-1:1;let n=e[0]===`#`?e:oe(e),r=t[0]===`#`?t:oe(t),[i,a,o,s,c]=[0,0,0,0,0];for(;i<n.length&&a<r.length&&o!==-1&&s!==-1&&(o=n.indexOf(`.`,i),s=r.indexOf(`.`,a),c=ue(n.slice(i,o===-1?void 0:o),r.slice(a,s===-1?void 0:s)),c===0);)o!==-1&&(i=o+1),s!==-1&&(a=s+1);return c===0?o===-1?s===-1?0:S(r[a])?-1:pe(`#N#`,r.slice(a)):S(n[i])?1:pe(n.slice(i),`#N#`):c}var me=(e,t)=>pe(fe(e),fe(t)),he={"==":e=>e===0,"!=":e=>e!==0,"<":e=>e<0,"<=":e=>e<=0,">":e=>e>0,">=":e=>e>=0},ge=(e,t,n)=>he[n](me(e,t)),E=(t,n)=>w(e(t,n)),_e=/^[ \t\n\r\v\f]*[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[ \t\n\r\v\f]*$/u;function ve(e){if(!_e.test(e))return;let t=e.trim();if(!/[.eE]/u.test(t)){let e=BigInt(t);return ce(e)?{long:e}:{double:Number(t),overflow:e>0n?1:-1}}return{double:Number(t),overflow:0}}function ye(e,t){let n=ve(e),r=ve(t);return n===void 0||r===void 0||n.overflow!==void 0&&n.overflow!==0&&n.overflow===r.overflow&&n.double-r.double===0?E(e,t):n.double!==void 0||r.double!==void 0?n.double===void 0?r.overflow===0?w(Number(n.long)-r.double):-r.overflow:r.double===void 0?n.overflow===0?w(n.double-Number(r.long)):n.overflow:n.double===r.double&&!Number.isFinite(n.double)?E(e,t):w(n.double-r.double):w(Number(n.long-r.long))}var be=/^(?:0|-?[1-9]\d*)$/u;function xe(e){if(!be.test(e))return e;let t=BigInt(e);return ce(t)?t:e}function Se(e,t){let n=xe(e),r=xe(t);if(typeof n==`bigint`&&typeof r==`bigint`)return n>r?1:-1;if(typeof n==`string`&&typeof r==`string`)return ye(n,r);let[i,a,o]=typeof n==`bigint`?[n,r,1]:[r,n,-1],s=ve(a);return s?.long===void 0?s?.double===void 0?o*E(String(i),a):o*w(Number(i)-s.double):o*w(Number(i-s.long))}var D=511,Ce=new WeakMap,O=e=>Ce.get(e)??Object.keys(e),we=e=>c(e)&&O(e).length===0,Te=e=>e.every((e,t)=>e===String(t)),k=(e,t)=>{let n=1;for(let r=e.indexOf(`
2
+ `);r!==-1&&r<t;r=e.indexOf(`
3
+ `,r+1))n++;return n},A=(e,t,n=e.pos)=>ne(t,k(e.text,n)-1);function j(e){let{text:t,pos:n}=e;if(n>=t.length)return`the end of the file`;if(t[n]===`
4
+ `)return`an LF line end`;if(t.startsWith(`\r
5
+ `,n))return`a CRLF line end`;let r=t.indexOf(`
6
+ `,n);return _(t.slice(n,r===-1?t.length:t[r-1]===`\r`?r-1:r))}function Ee(e,t,n){if(!e.text.startsWith(t,e.pos))throw A(e,`expected ${n()}, as Composer writes it, found ${j(e)}`);e.pos+=t.length}function M(e,t){e.lines[t]??=`${e.eol}${e.indent.repeat(t)}`,Ee(e,e.lines[t],()=>t===0?`a line end`:`a line end and ${t===1?``:`${t} times `}${_(e.indent)} of indentation`)}var De=e=>JSON.stringify(e).replaceAll(`\u2028`,`\\u2028`).replaceAll(`\u2029`,`\\u2029`);function Oe(e){let{text:t,pos:n}=e;if(t[n]!==`"`)throw A(e,`expected a string, found ${j(e)}`);let r=n+1;for(;r<t.length&&t[r]!==`"`&&t[r]!==`
7
+ `;)r+=t[r]===`\\`?2:1;if(t[r]!==`"`)throw A(e,`a string with no closing quote`);let i=t.slice(n,r+1);if(e.pos=r+1,!ke.test(i))return i.slice(1,-1);let a=te(()=>JSON.parse(i),()=>{throw A(e,`${_(i)} is not a string as JSON writes it`,n)});if(!a.isWellFormed())throw A(e,`${_(i)} escapes a lone surrogate, which PHP does not read`,n);if(De(a)!==i)throw A(e,`${_(i)} is not written as Composer writes it, ${_(De(a))}`,n);return a}var ke=/[\\\p{Cc}\u2028\u2029\p{Cs}]/u;function Ae(e){if(e===0)return Object.is(e,-0)?`-0`:`0`;let t=e<0?`-`:``,[n,r]=Math.abs(e).toExponential().split(`e`),i=n.replace(`.`,``),a=Number(r)+1;return a<-3||a>17?`${t}${i[0]}.${i.slice(1)||`0`}e${a>0?`+`:`-`}${Math.abs(a-1)}`:a<=0?`${t}0.${`0`.repeat(-a)}${i}`:i.length<=a?`${t}${i}${`0`.repeat(a-i.length)}`:`${t}${i.slice(0,a)}.${i.slice(a)}`}var je=/-?(?:0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/uy,Me=([e,t,n])=>t===void 0&&n===void 0&&ce(BigInt(e));function Ne(e){let t=ie(e,je);if(t===null)throw A(e,`expected a value, found ${j(e)}`);let[n]=t,r=Me(t),i=Number(n);if(!Number.isFinite(i))throw A(e,`${n} is past what PHP reads as a number`);let a=r?BigInt(n).toString():Ae(i);if(a!==n)throw A(e,`${n} is not written as Composer writes it, ${a}`);return r&&!Number.isSafeInteger(i)?BigInt(n):i}var Pe=[[`true`,!0],[`false`,!1],[`null`,null]];function Fe(e){let t=Pe.find(([t])=>e.text.startsWith(t,e.pos));return t!==void 0&&(e.pos+=t[0].length),t}function Ie(e,t){let n=e.text[e.pos];if(n===`{`)return Re(e,t);if(n===`[`)return ze(e,t);if(n===`"`)return Oe(e);let r=Fe(e);return r===void 0?Ne(e):r[1]}function Le(e,t){if(t===D)throw A(e,`nested more than ${D} deep, which PHP does not read`);e.pos++}function Re(e,t){let n=e.pos;Le(e,t);let r=Object.create(null);if(e.text[e.pos]===`}`){if(t!==1)throw A(e,`an empty object, which Composer writes as "[]"`,n);return e.pos++,r}let i=new Map;for(let n=!0;n;){M(e,t+1);let a=e.pos,o=Oe(e);if(i.has(o))throw A(e,`${_(o)} is a key at line ${k(e.text,i.get(o))} too`,a);i.set(o,a),Ee(e,`: `,()=>`": " after ${_(o)}`),r[o]=Ie(e,t+1),n=e.text[e.pos]===`,`,n&&e.pos++}M(e,t),Ee(e,`}`,()=>`"}"`);let a=[...i.keys()];if(Te(a))throw A(e,`an object of the keys 0 to ${a.length-1}, which Composer writes as a list`,n);return Ce.set(r,a),r}function ze(e,t){Le(e,t);let n=[];if(e.text[e.pos]===`]`)return e.pos++,n;for(let r=!0;r;)M(e,t+1),n.push(Ie(e,t+1)),r=e.text[e.pos]===`,`,r&&e.pos++;return M(e,t),Ee(e,`]`,()=>`"]"`),n}var Be=/^<<<<<<< /mu;function Ve(e){let t=Be.exec(e);if(t!==null)throw new g(`a merge conflict at line ${k(e,t.index)}, which Composer reads as a lockfile of no content-hash where its sides differ in that alone`);let[n,r]=re(e,`Composer`),i={text:e,pos:0,eol:n,indent:r,lines:[]},a=Re(i,0);if(M(i,0),i.pos!==e.length)throw A(i,`expected the end of the file after the last "}", found ${j(i)}`);return a}var He=/[ \t\n\r]*/uy,N=e=>ie(e,He),P=(e,t)=>new g(`not JSON as PHP reads it: ${t} at line ${k(e.text,e.pos)}`,e.where);function Ue(e){let{text:t,pos:n}=e,r=n+1;for(;r<t.length&&t[r]!==`"`;)r+=t[r]===`\\`?2:1;if(r>=t.length)throw P(e,`a string with no closing quote`);let i=te(()=>JSON.parse(t.slice(n,r+1)),()=>{throw P(e,`${_(t.slice(n,r+1))} is not a string`)});if(!i.isWellFormed())throw P(e,`a lone surrogate, which is not UTF-8`);return e.pos=r+1,i}function We(e,t){N(e);let n=e.text[e.pos];if(n===`{`||n===`[`){if(t===D)throw P(e,`nested more than ${D} deep`);let r=n===`{`,i=r?`}`:`]`,a=r?new Map:[];if(e.pos++,N(e),e.text[e.pos]===i)return e.pos++,a;for(;;){if(r){if(N(e),e.text[e.pos]!==`"`)throw P(e,`expected a key, found ${j(e)}`);let n=Ue(e);if(N(e),e.text[e.pos]!==`:`)throw P(e,`expected ":", found ${j(e)}`);e.pos++,a.set(n,We(e,t+1))}else a.push(We(e,t+1));N(e);let n=e.text[e.pos];if(n!==i&&n!==`,`)throw P(e,`expected "," or ${_(i)}, found ${j(e)}`);if(e.pos++,n===i)return a}}if(n===`"`)return Ue(e);let r=Fe(e);if(r!==void 0)return r[1];let i=ie(e,je);if(i===null)throw P(e,`expected a value, found ${j(e)}`);return Me(i)?BigInt(i[0]):Number(i[0])}function Ge(e,t){if(typeof e==`number`)return Number.isFinite(e)?void 0:t;if(e instanceof Map||Array.isArray(e))for(let[n,r]of e.entries()){let i=Ge(r,Array.isArray(e)?`${t}[${n}]`:v(t,n));if(i!==void 0)return i}}function Ke(e,t){let n={text:e,pos:0,where:t},r=We(n,0);if(N(n),n.pos!==e.length)throw P(n,`expected the end of the file, found ${j(n)}`);let i=Ge(r,t);if(i!==void 0)throw new g(`a number past what a double holds, which Composer refuses of the file`,i);return r}var qe=e=>`\\u${e.toString(16).padStart(4,`0`)}`;function Je(e){let t=``;for(let n of e){let e=n.codePointAt(0);t+=e<128?n:e<65536?qe(e):qe(55296+(e-65536>>10))+qe(56320+(e-65536&1023))}return t}function F(e){if(e===null||typeof e==`boolean`)return String(e);if(typeof e==`bigint`)return e.toString();if(typeof e==`number`)return Ae(e);if(typeof e==`string`)return Je(JSON.stringify(e).replaceAll(`/`,`\\/`));if(Array.isArray(e))return`[${e.map(F).join(`,`)}]`;let t=[...e.keys()];return Te(t)?`[${[...e.values()].map(F).join(`,`)}]`:`{${t.map(t=>`${F(t)}:${F(e.get(t))}`).join(`,`)}}`}var I=`[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\\d+)*)?)?([.-]?dev)?`,Ye=`stable|RC|beta|alpha|dev`,Xe=`[\\t\\n\\v\\f\\r ]`,Ze=`[^\\t\\n\\v\\f\\r ]`,Qe=`[^,\\t\\n\\v\\f\\r ]`,$e=`9999999-dev`,L=(e,t=``)=>new RegExp(e,t||`u`),et=L(`^(${Qe}+) +as +(${Qe}+)$`),tt=L(`@(?:${Ye})$`,`i`),nt=L(`^([^,\\t\\n\\v\\f\\r +]+)\\+${Ze}+$`),rt=L(`^v?(\\d{1,5})(\\.\\d+)?(\\.\\d+)?(\\.\\d+)?${I}$`,`i`),it=L(`^v?(\\d{4}(?:[.:-]?\\d{2}){1,6}(?:[.:-]?\\d{1,3}){0,2})${I}$`,`i`),at=/^([^\n]*?)[.-]?dev$/iu,ot=/^v?(\d+)(\.(?:\d+|[xX*]))?(\.(?:\d+|[xX*]))?(\.(?:\d+|[xX*]))?$/iu,st=/^((?:\d+\.)*\d+)(?:\.x)?-dev$/iu,ct=L(`${I}(?:\\+[^\\n]*)?$`,`i`);function lt(e){let t=b(e);return{a:`alpha`,b:`beta`,p:`patch`,pl:`patch`,rc:`RC`}[t]??t}function ut(e){let t=e.replace(/#[^\n]+$/u,``);if(t.startsWith(`dev-`)||t.endsWith(`-dev`))return`dev`;let n=ct.exec(b(t));return x(n[3])?{beta:`beta`,b:`beta`,alpha:`alpha`,a:`alpha`,rc:`RC`}[n[1]]??`stable`:`dev`}function dt(e){let t=y(e),n=ot.exec(t);if(n===null)return`dev-${t}`;let r=``;for(let e=1;e<5;e++)r+=n[e]===void 0?`.x`:n[e].replaceAll(`*`,`x`).replaceAll(`X`,`x`);return`${r.replaceAll(`x`,`9999999`)}-dev`}function ft(e){let t=st.exec(e);return t===null?void 0:`${t[1]}.`}function R(e){let t=y(e),n=et.exec(t);if(n!==null&&(t=n[1]),n=tt.exec(t),n!==null&&(t=t.slice(0,t.length-n[0].length)),(t===`master`||t===`trunk`||t==="default")&&(t=`dev-${t}`),/^dev-/iu.test(t))return`dev-${t.slice(4)}`;n=nt.exec(t),n!==null&&(t=n[1]);let r;if((n=rt.exec(t))===null?(n=it.exec(t))!==null&&(t=n[1].replaceAll(/\D/gu,`.`),r=2):(t=`${n[1]}${x(n[2])?`.0`:n[2]}${x(n[3])?`.0`:n[3]}${x(n[4])?`.0`:n[4]}`,r=5),r!==void 0){if(!x(n[r])){if(n[r]===`stable`)return t;let e=n[r+1];t+=`-${lt(n[r])}${(e??``).replace(/^[.-]+/u,``)}`}return x(n[r+2])||(t+=`-dev`),t}if(n=at.exec(t),n!==null){let e=dt(n[1]);if(!e.includes(`dev-`))return e}}var pt={"=":`==`,"==":`==`,"<":`<`,"<=":`<=`,">":`>`,">=":`>=`,"<>":`!=`,"!=":`!=`},z=(e,t)=>({operator:pt[e],version:t}),mt=Object.freeze({all:!0}),ht=e=>e.all?`*`:e.multi===void 0?`${e.operator} ${e.version}`:`[${e.multi.map(ht).join(e.conjunctive?` `:` || `)}]`;function gt(e,t,n=0){let r=[...e];for(let e=4;e>0;e--)if(e>t)r[e]=`0`;else if(e===t&&n!==0){let t=BigInt(r[e])+BigInt(n);if(t>T)return;r[e]=String(t)}return`${r[1]??``}.${r[2]??``}.${r[3]??``}.${r[4]??``}`}var _t=`v?(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?(?:\\.(\\d+))?(?:${I}|\\.([xX*][.-]?dev))(?:\\+${Ze}+)?`,vt=L(`^(${Qe}*?)@(${Ye})$`,`i`),yt=/^(dev-[^,\t\n\v\f\r @]+?|[^,\t\n\v\f\r @]+?\.x-dev)#[^\n]+$/iu,bt=/^(v)?[xX*](\.[xX*])*$/iu,xt=L(`^~>?${_t}$`,`i`),St=L(`^\\^${_t}($)`,`i`),Ct=/^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:\.[xX*])+$/u,wt=L(`^(${_t}) +- +(${_t})($)`,`i`),Tt=L(`^(<>|!=|>=?|<=?|==?)?${Xe}*([^\\n]*)`),Et=L(`-${I}$`,`i`),B=e=>e!==void 0&&e!==``;function Dt(e,t,n){let r=R(`${e}${x(t[5])&&x(t[7])&&x(t[8])?`-dev`:``}`.slice(1)),i=gt(t,n,1);return r===void 0||i===void 0?void 0:[z(`>=`,r),z(`<`,`${i}-dev`)]}function Ot(e){let t=e,n=et.exec(t);n!==null&&(t=n[1]);let r;if(n=vt.exec(t),n!==null&&(t=n[1]===``?`*`:n[1],n[2]!==`stable`&&(r=n[2])),n=yt.exec(t),n!==null&&(t=n[1]),n=bt.exec(t),n!==null)return!x(n[1])||!x(n[2])?[z(`>=`,`0.0.0.0-dev`)]:[mt];if((n=xt.exec(t))!==null){if(t.startsWith(`~>`))return;let e=B(n[4])?4:B(n[3])?3:B(n[2])?2:1;return x(n[8])||e++,Dt(t,n,Math.max(1,e-1))}if((n=St.exec(t))!==null)return Dt(t,n,n[1]!==`0`||!B(n[2])?1:n[2]!==`0`||!B(n[3])?2:3);if((n=Ct.exec(t))!==null){let e=B(n[3])?3:B(n[2])?2:1,t=`${gt(n,e)}-dev`,r=gt(n,e,1);return r===void 0?void 0:t===`0.0.0.0-dev`?[z(`<`,`${r}-dev`)]:[z(`>=`,t),z(`<`,`${r}-dev`)]}if((n=wt.exec(t))!==null){let e=x(n[6])&&x(n[8])&&x(n[9])?`-dev`:``,t=R(n[1]),r=R(n[10]);if(t===void 0||r===void 0)return;let i=z(`>=`,`${t}${e}`);if(B(n[12])&&B(n[13])||!x(n[15])||!x(n[17])||!x(n[18]))return[i,z(`<=`,r)];let a=gt([``,n[11],n[12],n[13],n[14]],B(n[12])?2:1,1);return a===void 0?void 0:[i,z(`<`,`${a}-dev`)]}n=Tt.exec(t);let i=R(n[2]);if(i===void 0&&n[2].endsWith(`-dev`)&&/^[0-9a-zA-Z\-./]+$/u.test(n[2])&&(i=R(`dev-${n[2].slice(0,-4)}`)),i===void 0)return;let a=n[1]||`=`;return a!==`==`&&a!==`=`&&!x(r)&&ut(i)===`stable`?i+=`-${r}`:a!==`<`&&a!==`>=`||Et.test(n[2])||n[2].startsWith(`dev-`)||(i+=`-dev`),[z(a,i)]}var kt=L(`${Xe}*\\|\\|?${Xe}*`),At=/(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)/u;function jt(e){let t=e[0],n=[],r=!1,i=e=>e.multi!==void 0&&e.conjunctive&&e.multi.length===2;for(let a of e.slice(1)){let[e,o,s,c]=i(t)&&i(a)?[...t.multi,...a.multi].map(ht):[];e?.startsWith(`>=`)&&o.startsWith(`<`)&&s.startsWith(`>=`)&&c.startsWith(`<`)&&o.slice(2)===s.slice(3)?(r=!0,t={multi:[t.multi[0],a.multi[1]],conjunctive:!0}):(n.push(t),t=a)}if(r)return n.push(t),n}function Mt(e){if(e.length===1)return e[0];let t=jt(e);return t?.length===1?t[0]:{multi:t??e,conjunctive:!1}}function Nt(e){let t=y(e).split(kt).map(e=>e.split(At).map(Ot));if(!t.some(e=>e.includes(void 0)))return Mt(t.map(e=>e.flat()).map(e=>e.length===1?e[0]:{multi:e,conjunctive:!0}))}function Pt(e,t,n){let r=e.startsWith(`dev-`),i=t.startsWith(`dev-`);return n===`!=`&&(r||i)?e!==t:r&&i?n===`==`&&e===t:r||i?!1:ge(e,t,n)}var Ft=e=>e.replaceAll(`=`,``);function It(e,t){let n=e.operator===`==`,r=e.operator===`!=`,i=t.operator===`==`,a=t.operator===`!=`;if(r||a)return r&&!a&&!i&&t.version.startsWith(`dev-`)||a&&!r&&!n&&e.version.startsWith(`dev-`)?!1:!n&&!i||Pt(t.version,e.version,`!=`);if(e.operator!==`==`&&Ft(e.operator)===Ft(t.operator))return!(e.version.startsWith(`dev-`)||t.version.startsWith(`dev-`));let[o,s,c]=n?[e.version,t.version,t.operator]:[t.version,e.version,e.operator];return Pt(o,s,c)?t.operator!==Ft(t.operator)||e.operator===Ft(e.operator)||me(t.version,e.version)!==0:!1}function V(e,t){return e.all||t.all?!0:e.multi===void 0?t.multi===void 0?It(e,t):V(t,e):e.conjunctive?t.multi!==void 0&&!t.conjunctive?V(t,e):e.multi.every(e=>V(t,e)):e.multi.some(e=>V(t,e))}var Lt=e=>z(`==`,e),H=(e,t)=>O(e).map(n=>[n,e[n],v(t,n)]);function U(e,t,n,r={}){u(e,t);let i=e=>t===void 0?e:v(t,e),a=-1;for(let o of O(e)){if(Object.hasOwn(r,o))throw new g(r[o],i(o));let e=n.indexOf(o);if(e===-1)throw new g(`unsupported field ${_(o)}`,t);if(e<a)throw new g(`out of the order Composer writes, before ${_(n[a])}`,i(o));a=e}return e}function W(e,t){if(x(f(e,t)))throw new g(`${_(e)}, which Composer reads as no value and does not write`,t);return e}var Rt=/[\p{Cc}]/u;function G(e,t){if(Rt.test(f(e,t)))throw new g(`${_(e)} has a control character in it`,t);return e}var zt=(e,t)=>{if(Array.isArray(e)?e.length===0:!c(e))throw l(`a non-empty mapping or sequence`,e,t);return e},Bt=(e,t)=>{if(d(e,t).length===0)throw new g(`an empty sequence, which Composer does not write`,t);return e},K=(e,t,n=f)=>Bt(e,t).map((e,r)=>n(e,`${t}[${r}]`));function Vt(e,t,n=`Composer sorts the keys in`){let r=O(e);for(let e=1;e<r.length;e++)if(Se(r[e-1],r[e])>0)throw new g(`out of the order ${n}, after ${_(r[e-1])}`,v(t,r[e]));return r}function Ht(e,t){let n=G(e,t),r=/\s|@(?:stable|rc|beta|alpha|dev)$/u.test(b(n))||n===`0`?void 0:R(n);if(r===void 0)throw new g(`${_(n)} is not a version Composer locks a package at`,t);return r}function Ut(e,t){let n=R(G(e,t));if(n===void 0)throw new g(`${_(e)} is not a version Composer reads`,t);return n}function Wt(e,t,n){let r=G(e,t)===`self.version`,i=Nt(r?n:e);if(i!==void 0)return i;throw new g(r?`"self.version", which is ${_(n)}, and not a version constraint Composer reads`:`${_(e)} is not a version constraint Composer reads`,t)}var Gt=/^[a-z0-9](?:[_.-]?[a-z0-9]+)*\/[a-z0-9](?:(?:[_.]|-{1,2})?[a-z0-9]+)*$/u,Kt=new Set([`nul`,`con`,`prn`,`aux`,...[`com`,`lpt`].flatMap(e=>Array.from({length:9},(t,n)=>`${e}${n+1}`))]);function qt(e,t){let n=f(e,t);if(!Gt.test(b(n)))throw new g(`${_(n)} is not a package name, a vendor and a package as Composer takes them`,t);if(b(n).split(`/`).some(e=>Kt.has(e)))throw new g(`${_(n)} has a name Windows reserves in it, which Composer refuses`,t);if(n.endsWith(`.json`))throw new g(`${_(n)} ends in .json, which Composer refuses`,t);return n}var Jt=/^[a-z0-9_./-]+$/u,Yt=/^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer(?:-(?:plugin|runtime)-api)?)$/u,q=e=>Yt.test(b(e));function Xt(e,t,n){let r=Object.create(null);return Vt(u(e,t),t),{written:r,links:H(e,t).map(([e,t,i])=>{if(!Jt.test(e))throw new g(`${_(e)} is not a package name in lowercase, as Composer writes a link's`,i);let a=Wt(t,i,n);return r[e]=t,{target:e,pretty:t,constraint:a}})}}function Zt(e,n){let r=G(e,n);if(r.startsWith(`/`)||/^[A-Za-z]:/u.test(r))throw new g(`${_(r)} is an absolute path, of the machine the lockfile was written on`,n);let i=/^[A-Za-z][\d+.A-Za-z-]*:/u.exec(r);if(i!==null)throw new g(`${_(r)} is a URL, of ${i[0]}, and not a path`,n);return t(r.startsWith(`./`)?r.slice(2):r,n),r}function Qt(e,t){if(/^\s*-/u.test(G(e,t)))throw new g(`${_(e)} starts with "-", which a tool would read as an option and Composer refuses`,t);if(e===``)throw new g(`an empty string, of which Composer fetches nothing`,t);return e}var $t={git:[`https:`,`http:`,`ssh:`,`git:`,`git+ssh:`],hg:[`https:`,`http:`,`ssh:`],svn:[`https:`,`http:`,`svn:`,`svn+ssh:`],fossil:[`https:`,`http:`,`ssh:`]},en=/^(?:(?:tcp|ssl)(?:4|6|46|64)?:)?(?:\[[0-9a-f:.]+\]|[a-z0-9._][a-z0-9._-]*)(?::[a-z0-9._][a-z0-9._-]*)?$/u,tn=/^([\w.-]+@)?([\w.-]+):[^\s]/u;function nn(e,t,n){let r=Qt(e,t);if(n===`perforce`){let e=b(r);if(!en.test(e)||/^\s*(?:rsh|jsh)\s*:/u.test(e))throw new g(`${_(r)} is not a Perforce port, [tcp|ssl:][host:]port, as Composer takes one`,t);return r}a(r,t);let i=n===`git`&&!r.includes(`://`)&&!/^[A-Za-z]:/u.test(r)?tn.exec(r):null;if(i!==null){if(i[1]===void 0&&/^(?:file|https?|ssh|git|ftps?)$/u.test(b(i[2])))throw new g(`${_(r)} is of the host ${i[2]} to git, and a URL of ${b(i[2])}: to a URL parser`,t);return r}if(/^[A-Za-z][\d+.A-Za-z-]*:/u.test(r)){let e=URL.parse(r);if(e===null||!$t[n].includes(e.protocol)||/\s/u.test(r))throw new g(`${_(r)} is not a URL ${n} fetches from, ${$t[n].join(` `)}`,t);return r}return Zt(r,t)}function rn(e,t,r){let a=Qt(e,t);return r===`git`&&!n(a)&&i(a,t),a}function an(e,t,n){return Bt(e,t).map((e,r)=>{let i=`${t}[${r}]`;U(e,i,[`url`,`preferred`]);let a=p(e.preferred,v(i,`preferred`));return{url:n(e.url,v(i,`url`)),preferred:a}})}var on=[`git`,`hg`,`svn`,`fossil`,`perforce`];function sn(e,t){U(e,t,[`type`,`url`,`reference`,`mirrors`]);let n=f(e.type,v(t,`type`));if(!on.includes(n))throw new g(`expected one of ${on.join(`, `)}, which Composer clones from`,v(t,`type`));if(e.reference===void 0)throw new g(`expected a reference, without which Composer does not read a source`,t);let r=(e,t)=>nn(e,t,n);return{type:n,url:r(e.url,v(t,`url`)),reference:rn(e.reference,v(t,`reference`),n),mirrors:m(e,`mirrors`,t,(e,t)=>an(e,t,r))??[]}}var cn=[`zip`,`tar`,`gzip`,`xz`,`rar`,`phar`,`file`];function ln(e,t,n){let r=Qt(e,t);return n!==`path`&&o(r)||Zt(r,t),r}function un(e,t){U(e,t,[`type`,`url`,`reference`,`shasum`,`mirrors`]);let n=f(e.type,v(t,`type`));if(n!==`path`&&!cn.includes(n))throw new g(`expected path or one of ${cn.join(`, `)}, which Composer installs from`,v(t,`type`));let i=(e,t)=>ln(e,t,n),a=m(e,`shasum`,t,f);if(a!==void 0&&a!==``&&!r(a))throw new g(`${_(a)} is not a sha1 in lowercase hex, which Composer compares the download's with`,v(t,`shasum`));return{type:n,url:i(e.url,v(t,`url`)),reference:m(e,`reference`,t,Qt),shasum:a||void 0,mirrors:m(e,`mirrors`,t,(e,t)=>an(e,t,i))??[]}}function dn(e,t){let n=G(e,t);if(n===``||/^(?:[\\/]|[A-Za-z]:)/u.test(n)||/(?:^|[\\/])\.\.(?:[\\/]|$)/u.test(n))throw new g(`${_(n)} is not a path in the package, as Composer installs a bin from`,t);return n}var fn=e=>e.replace(/(?:^|[\\/]+)\.\.?(?:[\\/]+|$)(?:\.\.?(?:[\\/]+|$))*/gu,`/`).replace(/^\/+/u,``);function pn(e,t){let n=G(e,t);if(fn(n)!==n)throw new g(`${_(n)} is not written as Composer writes a target-dir, ${_(fn(n))}`,t);if(n.startsWith(`\\`))throw new g(`${_(n)} is of the drive's root on Windows, and not under the package's directory`,t);return n!==``&&Zt(n.replaceAll(`\\`,`/`),t),n}function mn(e,t){return Vt(u(e,t),t),h(e,t,(e,t)=>{if(y(f(e,t))===`self.version`)throw new g(`"self.version", which Composer writes as the package's version`,t);return e},H)}var hn=(e,t)=>h(u(e,t),t,(e,t)=>{if(!Array.isArray(e))throw l(`a sequence, as Composer writes even one listener`,e,t);return e.map((e,n)=>f(e,`${t}[${n}]`))},H);function gn(e,t){let n=K(e,t);for(let e=1;e<n.length;e++)if(ye(n[e-1],n[e])>0)throw new g(`out of the order Composer sorts keywords in, after ${_(n[e-1])}`,`${t}[${e}]`);return n}function _n(e,t){return U(e,t,[`name`,`exclude`]),{name:m(e,`name`,t,W),exclude:m(e,`exclude`,t,K)??[]}}function vn(e,t){if(e===!0)return!0;if(typeof e!=`string`)throw l(`true or the name of a replacement`,e,t);return W(e,t)}var yn=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})[+-](\d{2}):(\d{2})$/u;function bn(e,t){let n=yn.exec(f(e,t)),[r,i,a,o,s,c,l,u]=n===null?[]:n.slice(1).map(Number),d=new Date(Date.UTC(2e3,i,0)).getUTCDate()-+(i===2&&(r%4!=0||r%100==0&&r%400!=0));if(n===null||i<1||i>12||a<1||a>d||o>23||s>59||c>59||u>59||l>24)throw new g(`${_(e)} is not a time as Composer writes one, as 2026-10-02T00:00:00+00:00`,t);return e}var xn={require:`require`,conflict:`conflict`,provide:`provide`,replace:`replace`,requireDev:`require-dev`},Sn=`name.version.target-dir.source.dist.require.conflict.provide.replace.require-dev.suggest.default-branch.bin.type.extra.autoload.autoload-dev.notification-url.include-path.php-ext.archive.scripts.license.authors.description.homepage.keywords.support.funding.abandoned.transport-options.time`.split(`.`),Cn={version_normalized:"`version_normalized`, which Composer leaves out of a lockfile","installation-source":"`installation-source`, which Composer leaves out of a lockfile",repositories:"`repositories`, which Composer reads of the project's composer.json alone","minimum-stability":"`minimum-stability`, which Composer reads of the project's composer.json alone"};function wn(e,t,n){if(U(e,t,Sn,Cn),e.name===void 0)throw new g(`expected a name`,t);if(e.version===void 0)throw new g(`expected a version`,t);let r=qt(e.name,v(t,`name`)),i=Ht(e.version,v(t,`version`));if(e.type===void 0)throw new g(`expected a type, which Composer always writes`,t);let a=W(G(e.type,v(t,`type`)),v(t,`type`));if(b(a)!==a)throw new g(`${_(a)}, which Composer writes in lowercase`,v(t,`type`));if(e[`default-branch`]!==void 0&&e[`default-branch`]!==!0)throw l(`true, as Composer writes it of the default branch alone`,e[`default-branch`],v(t,`default-branch`));let s=Object.create(null),c={};for(let[n,r]of Object.entries(xn)){let i=m(e,r,t,(t,n)=>Xt(t,n,e.version));s[n]=i?.written??Object.create(null),c[n]=i?.links??[]}let u=n=>m(e,n,t,zt);return{pkg:{name:r,version:e.version,normalized:i,stability:ut(i),dev:n,source:m(e,`source`,t,sn),dist:m(e,`dist`,t,un),...s,suggest:m(e,`suggest`,t,mn)??Object.create(null),defaultBranch:e[`default-branch`]===!0,bin:m(e,`bin`,t,(e,t)=>K(e,t,dn))??[],type:a,targetDir:m(e,`target-dir`,t,pn),extra:u(`extra`),autoload:u(`autoload`),autoloadDev:u(`autoload-dev`),notificationUrl:m(e,`notification-url`,t,(e,t)=>{if(!o(f(e,t)))throw new g(`${_(e)} is not an http(s) URL, which Composer posts installs to`,t);return e}),includePath:m(e,`include-path`,t,K)??[],phpExt:u(`php-ext`),archive:m(e,`archive`,t,_n)??{name:void 0,exclude:[]},scripts:m(e,`scripts`,t,hn)??Object.create(null),license:m(e,`license`,t,K)??[],authors:u(`authors`),description:m(e,`description`,t,W),homepage:m(e,`homepage`,t,W),keywords:m(e,`keywords`,t,gn)??[],support:u(`support`),funding:u(`funding`),abandoned:m(e,`abandoned`,t,vn),transportOptions:u(`transport-options`),time:m(e,`time`,t,bn)},links:c}}var Tn=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21],En=Array.from({length:64},(e,t)=>Math.floor(Math.abs(Math.sin(t+1))*2**32)>>>0);function Dn(e){let t=e.length,n=Math.ceil((t+9)/64),r=new Uint8Array(n*64);for(let n=0;n<t;n++)r[n]=e.codePointAt(n);r[t]=128;let i=new DataView(r.buffer);return i.setUint32(r.length-8,t*8>>>0,!0),i.setUint32(r.length-4,Math.floor(t*8/2**32),!0),Array.from({length:r.length/4},(e,t)=>i.getUint32(t*4,!0))}var On=(e,t)=>(e<<t|e>>>32-t)>>>0;function kn(e){if(/[^\0-\u007F]/u.test(e))throw TypeError(`expected ASCII`);let t=[0x67452301,0xefcdab89,0x98badcfe,271733878],n=Dn(e);for(let e=0;e<n.length;e+=16){let[r,i,a,o]=t;for(let t=0;t<64;t++){let s=t>>4,c=[i&a|~i&o,o&i|~o&a,i^a^o,a^(i|~o)][s],l=[t,5*t+1,3*t+5,7*t][s]%16,u=i+On(r+c+En[t]+n[e+l]>>>0,Tn[s*4+t%4])>>>0;[r,i,a,o]=[o,u,i,a]}for(let[e,n]of[r,i,a,o].entries())t[e]=t[e]+n>>>0}return t.map(e=>[0,8,16,24].map(t=>(e>>>t&255).toString(16).padStart(2,`0`)).join(``)).join(``)}var An={string:[e=>typeof e==`string`,`a string`],boolean:[e=>typeof e==`boolean`,`true or false`],object:[e=>e instanceof Map,`a mapping`],array:[Array.isArray,`a sequence`],null:[e=>e===null,`null`]};function J(e,t,n){let r=[t.type].flat();if(!r.some(t=>An[t][0](e)))throw l(r.map(e=>An[e][1]).join(` or `),e,n);if(t.enum!==void 0&&!t.enum.includes(e))throw l(`one of ${t.enum.map(_).join(`, `)}`,e,n);if(t.pattern!==void 0&&!t.pattern.test(e))throw new g(`${_(e)} is not as Composer's schema has it`,n);if(e instanceof Map){for(let r of t.required??[])if(!e.has(r))throw new g(`no ${_(r)}, which Composer's schema requires`,n);for(let[r,i]of e){let e=Object.hasOwn(t.properties??{},r)?t.properties[r]:t.additionalProperties;e!==void 0&&J(i,e,v(n,r))}}Array.isArray(e)&&t.items!==void 0&&e.forEach((e,r)=>J(e,t.items,`${n}[${r}]`))}var Y={type:`string`},X={type:`boolean`},jn={type:`array`,items:Y},Mn={type:[`string`,`boolean`]},Nn={type:`object`,required:[`name`,`version`],properties:{name:Y,version:Y}},Pn={name:Y,canonical:X,only:jn,exclude:jn},Fn={url:Y,"no-api":X,"secure-http":X,"svn-cache-credentials":X,"trunk-path":Mn,"branches-path":Mn,"tags-path":Mn,"package-path":Y,depot:Y,branch:Y,unique_perforce_client_name:Y,p4user:Y,p4password:Y},In={composer:{url:Y,options:{type:`object`},allow_ssl_downgrade:X,"force-lazy-providers":X,filter:{type:[`boolean`,`object`],additionalProperties:X}},...Object.fromEntries([`vcs`,`github`,`git`,`gitlab`,`bitbucket`,`git-bitbucket`,`hg`,`fossil`,`perforce`,`svn`,`forgejo`].map(e=>[e,Fn])),path:{url:Y,options:{type:`object`,properties:{reference:{type:`string`,enum:[`none`,`config`,`auto`]},symlink:{type:[`boolean`,`null`]},relative:X,versions:{type:`object`,additionalProperties:Y}}}},artifact:{url:Y},pear:{url:Y,"vendor-alias":Y},package:{package:{...Nn,type:[`object`,`array`],items:Nn}}};function Ln(e,t,n){J(e,{type:`object`},t);let r=e.get(`type`);if(typeof r!=`string`||!Object.hasOwn(In,r))throw l(`a type of repository Composer knows`,r,v(t,`type`));if(J(e,{type:`object`,required:[r===`package`?`package`:`url`],properties:{...Pn,...In[r]}},t),n&&e.has(`name`))throw new g(`a name, where the key names a repository, which Composer's schema refuses`,v(t,`name`))}function Rn(e,t){if(J(e,{type:[`object`,`array`]},t),Array.isArray(e))e.forEach((e,n)=>{e instanceof Map&&e.size===1&&[...e.values()][0]===!1||Ln(e,`${t}[${n}]`,!1)});else for(let[n,r]of e)r!==!1&&Ln(r,v(t,n),!0)}var zn={version:{type:`string`,pattern:/^[vV]?\d+(?:[.-]\d+){0,3}[._-]?(?:(?:[sS][tT][aA][bB][lL][eE]|[bB][eE][tT][aA]|[bB]|[rR][cC]|[aA][lL][pP][hH][aA]|[aA]|[pP][aA][tT][cC][hH]|[pP][lL]|[pP])(?:[.-]?\d+)*)?(?:[.-]?[dD][eE][vV]|\.x-dev)?(?:\+.*)?$|^dev-.*$/su},"minimum-stability":{type:`string`,enum:[`dev`,`alpha`,`beta`,`rc`,`RC`,`stable`]},"prefer-stable":X,extra:{type:[`object`,`array`]},config:{type:`object`,properties:{platform:{type:`object`,additionalProperties:Mn}}}};function Bn(e,t){for(let[n,r]of Object.entries(zn))e.has(n)&&J(e.get(n),r,v(t,n));e.has(`repositories`)&&Rn(e.get(`repositories`),v(t,`repositories`))}var Z=`composerJson`,Vn=[`name`,`version`,`require`,`require-dev`,`conflict`,`replace`,`provide`,`minimum-stability`,`prefer-stable`,`repositories`,`extra`];function Hn(e){let t=new Map(Vn.filter(t=>e.has(t)).map(t=>[t,e.get(t)])),n=e.get(`config`),r=n instanceof Map?n.get(`platform`):void 0;return r!=null&&t.set(`config`,new Map([[`platform`,r]])),kn(F(new Map([...t].sort(([e],[t])=>Se(e,t)))))}function Un(e,t){let n=qt(e,t);if(/[A-Z]/u.test(n))throw new g(`${_(n)} has capitals, which Composer refuses in composer.json`,t);return n}var Wn=/(?:^|\| *|, *)([^,\t\n\v\f\r #|]+)(?:#[^ ]+)? +as +([^,\t\n\v\f\r |]+)(?:$| *\|| *,)/u;function Gn(e,t,n,r){let i=e.get(t);if(i===void 0)return[];if(!(i instanceof Map))throw l(`a mapping`,i,v(Z,t));let a=new Map;for(let[e,o]of i){let i=b(e),s=v(v(Z,t),e);q(e)||Un(e,s),G(f(o,s),s);let c=o===`self.version`?r===void 0?{all:!0}:Nt(r.pretty):Nt(o);if(c===void 0)throw new g(`${_(o)} is not a version constraint Composer reads`,s);if(t===`require`||t===`require-dev`){let e=Wn.exec(o);if(e===null?o.includes(` as `):R(e[1])===void 0||R(e[2])===void 0)throw new g(`${_(o)} is not an alias of one version as another, which Composer refuses`,s);if(i===n)throw new g(`the root itself, which Composer refuses`,s)}a.set(i,{target:i,pretty:o,constraint:c})}return[...a.values()]}function Kn(e){if(typeof e!=`string`)throw TypeError(`composerJson: expected the text of composer.json`);let t=Ke(e,Z);if(!(t instanceof Map))throw new g(`expected an object`,Z);return t}function qn(e){let t=Kn(e);Bn(t,Z);let n=t.has(`name`)?Un(t.get(`name`),v(Z,`name`)):`__root__`,r=t.get(`version`),i=r===void 0?void 0:{pretty:r,normalized:Ut(r,v(Z,`version`))},a=Object.create(null);for(let[e,r]of Object.entries(xn))a[e]=Gn(t,r,n,i);return{contentHash:Hn(t),name:n,version:i?.normalized,links:a}}var Q={stable:0,RC:5,beta:10,alpha:15,dev:20};function Jn(e,t,n,r){let i=Object.create(null),a=e=>e.pretty===`self.version`,o=e=>({...e,constraint:Lt(t)});for(let t of Object.keys(xn))i[t]=t===`conflict`||t===`provide`||t===`replace`?[...e.links[t],...e.links[t].filter(a).map(o)]:e.links[t].map(e=>a(e)?o(e):e);let s=e.links.require.some(a);return{name:e.name,version:t,exact:Lt(t),pretty:n,stability:ut(t),links:i,alias:r?`root`:`branch`,base:e,selfVersionRequires:s,where:e.where}}function Yn(e,t){let{version:n}=e;if(!n.startsWith(`dev-`)&&!n.endsWith(`-dev`))return;let r=e.extra?.[`branch-alias`];if(typeof r==`object`&&r)for(let e of O(r)){let i=r[e];if(typeof i!=`string`)throw new g(`expected a string, as Composer reads a branch alias of a dev version`,v(v(v(t,`extra`),`branch-alias`),e));if(!i.endsWith(`-dev`))continue;let a=i===$e?i:dt(i.slice(0,-4));if(!a.endsWith(`-dev`)||b(n)!==b(e))continue;let o=ft(e),s=ft(i);if(o===void 0||s===void 0||b(s).startsWith(b(o)))return a}if(e.defaultBranch&&ft(n.replace(/^v/u,``))===void 0)return $e}function Xn(e,t){let n=new Set([e.name]);if(t)for(let t of e.links.provide)n.add(t.target);for(let t of e.links.replace)n.add(t.target);return n}function Zn(e,t,n){if(e.name===t)return e.exact===void 0||V(n,e.exact);let r=e=>e.target===t&&V(n,e.constraint);return e.links.provide.some(r)||e.links.replace.some(r)}function Qn(e){let t=new Map;for(let n of e)for(let e of Xn(n,!0))(t.get(e)??t.set(e,[]).get(e)).push(n);return{entries:e,byName:t,provided:new Map}}var $n=(e,t)=>e.byName.get(t)??[];function $(e,t){return e.provided.has(t)||e.provided.set(t,$n(e,t.target).filter(e=>Zn(e,t.target,t.constraint))),e.provided.get(t)}function er(e){return e.root?`the root`:`${e.base?.pkg.name??e.pkg.name} ${e.alias===void 0?e.pkg.version:`${e.pretty}, an alias of ${e.base.pkg.version}`}`}function tr(e,t,n){let r=Q[e.stability];return[...Xn(e,!0)].some(e=>r<=Q[Object.hasOwn(n,e)?n[e]:t])}function nr(e){let t=new Map;for(let n of e)for(let e of Xn(n,!1)){let r=t.get(e);if(r!==void 0){let t=r.root?`the root`:r.where,i=e===n.name&&e===r.name?`listed twice, first as ${t}`:`${_(e)} is ${e===r.name?`the name`:`replaced by`} of ${t}, and ${e===n.name?`its name`:`replaced by it`} too, which Composer installs neither of`;throw new g(i,n.where)}t.set(e,n)}}function rr(e,t,n,r){for(let i of e)if(i.alias===void 0||i.selfVersionRequires)for(let e of i.links.require){if(q(e.target)||$(t,e).length>0)continue;let a=$n(r,e.target).filter(e=>!e.root),o=i.alias===void 0?``:`, as its alias ${i.pretty} asks for ${e.target} at it`,s=a.length===0?``:`, of ${a.map(er).join(`, `)}, which the lockfile has`;throw new g(`nothing ${n} meets it${o}${s}`,v(v(i.where,`require`),e.target))}}function ir(e){let t=new Set(e.entries.filter(e=>e.alias===void 0).flatMap(e=>[...Xn(e,!1)]));for(let n of e.entries)for(let r of n.links.conflict){if(q(r.target)||!t.has(r.target))continue;let i=$(e,r).find(e=>e!==n&&(e.alias===void 0||e.name===r.target));if(i!==void 0)throw new g(`conflicts with ${er(i)}, which ${i.root?`composer.json is`:`the lockfile has`}`,v(v(n.where,`conflict`),r.target))}}function ar(e,t,n){for(let r of e.links[n])if(!(q(r.target)||r.pretty===`self.version`||$(t,r).length>0))throw new g(`nothing in the lockfile${n===`requireDev`?``:` that composer install --no-dev installs`} meets it, which composer install refuses`,v(v(e.where,xn[n]),r.target))}function or(e,t){let n=Object.create(null);for(let r of e.links.require){let e=[...new Set($(t,r).filter(e=>!e.root).map(e=>(e.base??e).name))];n[r.target]={constraint:r.pretty,platform:q(r.target),targets:e}}return n}function sr(e,t,n,r,i){let a=e.map(({pkg:e,links:t,where:n})=>({name:b(e.name),version:e.normalized,exact:Lt(e.normalized),stability:e.stability,links:t,pkg:e,where:n})),o=i===void 0?[]:[{...i,exact:i.version===void 0?void 0:Lt(i.version),where:Z,root:!0}];nr([...o,...a]);let s=new Map(a.map(e=>[e.name,e])),c=[],l=new Map(a.map(e=>[e,[]])),u=e=>{c.push(e),l.get(e.base).push(e)};for(let e of a){c.push(e);let t=Yn(e.pkg,e.where);t!==void 0&&u(Jn(e,t,t.replaceAll(/(?:\.9{7})+/gu,`.x`),!1))}for(let e of t)u(Jn(s.get(e.package),e.aliasNormalized,e.alias,!0));for(let e of c)if(!tr(e,n,r)){let t=e.alias===void 0?``:`its alias ${e.pretty}, `;throw new g(`${t}of stability ${e.stability}, which minimum-stability, ${n}, and stability-flags do not take, and Composer installs nothing against`,e.where)}let d=e=>(e.base??e).pkg.dev,f=c.filter(e=>!d(e)),p=Qn([...o,...f]),m=Qn([...o,...c]);return ir(m),i!==void 0&&(rr(f,p,`that composer install --no-dev installs`,m),rr(c.filter(d),m,`in the lockfile`,m),ar(o[0],p,`require`),ar(o[0],m,`requireDev`)),new Map(a.map(e=>[e,{require:or(e,d(e)?m:p),aliases:l.get(e).map(e=>({version:e.pretty,normalized:e.version,root:e.alias===`root`}))}]))}var cr=[`_readme`,`content-hash`,`packages`,`packages-dev`,`aliases`,`minimum-stability`,`stability-flags`,`prefer-stable`,`prefer-lowest`,`platform`,`platform-dev`,`platform-overrides`,`plugin-api-version`],lr={hash:"`hash`, the md5 of composer.json that Composer 1.2 and older wrote, which is not read here"},ur=cr.filter(e=>e!==`platform-overrides`),dr=[`This file locks the dependencies of your project to a known state`,`Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies`,`This file is @generated automatically`],fr=[`2.0.0`,`2.1.0`,`2.2.0`,`2.3.0`,`2.6.0`,`2.9.0`],pr=[`stability-flags`,`platform`,`platform-dev`];function mr(e){let t=`plugin-api-version`;if(e===void 0)throw new g(`no plugin-api-version: a lockfile of Composer 1.9 or older, which is not read here`);if(typeof e==`string`&&e.startsWith(`1.`))throw new g(`${_(e)} is Composer 1's, which is not read here`,t);if(!fr.includes(e))throw new g(`unsupported plugin-api-version: expected one of ${fr.join(`, `)}, found ${s(e)}`,t);return e}function hr(e){U(e,void 0,cr,lr);let t=mr(e[`plugin-api-version`]),n=ur.find(t=>e[t]===void 0);if(n!==void 0)throw new g(`expected ${_(n)}, which Composer always writes`,n);let r=e._readme;if(!Array.isArray(r)||r.length!==dr.length||r.some((e,t)=>e!==dr[t]))throw new g(`expected the three lines Composer writes`,`_readme`);let i=f(e[`content-hash`],`content-hash`);if(!/^[\da-f]{32}$/u.test(i))throw new g(`${_(i)} is not an md5 in lowercase hex`,`content-hash`);for(let t of[`prefer-stable`,`prefer-lowest`])p(e[t],t);let a=e[`minimum-stability`];if(typeof a!=`string`||!Object.hasOwn(Q,a))throw l(`one of ${Object.keys(Q).join(`, `)}`,a,`minimum-stability`);return{contentHash:i,pluginApiVersion:t,minimumStability:a}}function gr(e,t){let n=pr.find(t=>we(e[t])),r=pr.find(t=>Array.isArray(e[t])&&e[t].length===0),i=t===`2.9.0`?`{}`:t===`2.6.0`?void 0:`[]`,a=i===`{}`?r:i===`[]`?n:void 0;if(a!==void 0)throw new g(`"${i===`{}`?`[]`:`{}`}", which Composer of plugin-api-version ${t} writes as "${i}"`,a);if(n!==void 0&&r!==void 0)throw new g(`"[]", where ${_(n)} is "{}", as no Composer writes them both`,r);return n!==void 0||t===`2.9.0`}var _r=(e,t)=>Array.isArray(e)&&e.length===0?Object.create(null):u(e,t);function vr(e,t){let n=`stability-flags`,r=_r(e,n);t&&Vt(r,n,`Composer 2.8 and later sort it in`);let i=Object.entries(Q);return h(r,n,(e,t,n)=>{if(b(n)!==n)throw new g(`${_(n)}, which Composer writes in lowercase`,t);let r=i.find(([,t])=>t===e);if(r===void 0)throw l(`one of ${Object.values(Q).join(`, `)}`,e,t);return r[0]},H)}var yr=(e,t)=>h(_r(e,t),t,(e,t,n)=>{if(!q(n)||b(n)!==n)throw new g(`${_(n)} is not a platform package's name in lowercase, as Composer writes one`,t);return Wt(e,t,`1.0.0`),e},H);function br(e){let t=`platform-overrides`;if(e===void 0)return Object.create(null);if(!c(e)||we(e))throw l(`a non-empty mapping, as Composer writes it where there are any`,e,t);let n=new Map;return h(e,t,(e,t,r)=>{if(!q(r))throw new g(`${_(r)} is not a platform package's name`,t);let i=b(r),a=n.get(i);if(a!==void 0)throw new g(`${_(a)} too, of which Composer takes the last, as it takes a name in any case`,t);if(n.set(i,r),e!==!1&&(typeof e!=`string`||R(G(e,t))===void 0))throw l(`a version, or false`,e,t);if(i===`php`&&e===!1)throw new g(`false, which Composer refuses of php, as it cannot be missing`,t);return e},H)}function xr(e,t){let n=e[t];if(t===`packages-dev`&&n===null)throw new g(`null, as Composer 1 writes it after update --no-dev, which Composer 2 does not install from`,t);return d(n,t)}function Sr(e){for(let t=1;t<e.length;t++){let n=e[t-1].pkg,r=e[t].pkg;if(n.dev===r.dev&&(E(n.name,r.name)||E(n.version,r.version))>0)throw new g(`out of the order Composer sorts packages in, by name then version, after ${_(n.name)}`,e[t].where)}}var Cr=[`package`,`version`,`alias`,`alias_normalized`];function wr(e,t){let n=`aliases`;return d(e,n).map((r,i)=>{let a=`${n}[${i}]`;U(r,a,Cr);for(let e of Cr)if(r[e]===void 0)throw new g(`expected ${e}`,a);let o=f(r.package,v(a,`package`));if(!t.has(o))throw new g(`${_(o)} is not a package in the lockfile, by its name in lowercase`,v(a,`package`));if(i>0&&E(e[i-1].package,o)>0)throw new g(`out of the order Composer sorts aliases in, by package, after ${_(e[i-1].package)}`,a);let s=f(r.version,v(a,`version`));if(Ut(s,v(a,`version`))!==s)throw new g(`${_(s)} is not a version normalized, as Composer writes it`,v(a,`version`));if([`dev-master`,`dev-trunk`,`dev-default`].includes(s))throw new g(`${_(s)}, which Composer writes as ${$e}`,v(a,`version`));let c=f(r.alias,v(a,`alias`));if(/\s/u.test(c))throw new g(`${_(c)} has a space, which Composer's alias of a requirement cannot`,v(a,`alias`));let l=Ut(c,v(a,`alias`));if(r.alias_normalized!==l)throw new g(`expected ${_(l)}, the alias normalized`,v(a,`alias_normalized`));return{package:o,version:s,alias:c,aliasNormalized:l}})}function Tr(e,t={}){if(typeof e!=`string`)throw TypeError(`expected a string`);let{composerJson:n}=ee(t,[`composerJson`]),r=n===void 0?void 0:qn(n),i=Ve(e),{contentHash:a,pluginApiVersion:o,minimumStability:s}=hr(i),c=gr(i,o),l=vr(i[`stability-flags`],c),u=[];for(let[e,t]of[[`packages`,!1],[`packages-dev`,!0]])for(let[n,r]of xr(i,e).entries()){let i=`${e}[${n}]`;u.push({...wn(r,i,t),where:i})}Sr(u);let d=new Map(u.map(({pkg:e})=>[b(e.name),e])),f=wr(i.aliases,d),p=sr(u,f,s,l,r),m=Object.create(null);for(let[{pkg:e},{require:t,aliases:n}]of p)m[b(e.name)]={...e,require:t,aliases:n};return{contentHash:a,fresh:r===void 0?void 0:r.contentHash===a,pluginApiVersion:o,minimumStability:s,stabilityFlags:l,preferStable:i[`prefer-stable`],preferLowest:i[`prefer-lowest`],platform:yr(i.platform,`platform`),platformDev:yr(i[`platform-dev`],`platform-dev`),platformOverrides:br(i[`platform-overrides`]),aliases:f,packages:m}}export{g as LockfileError,Tr as parseComposerLock};
@@ -0,0 +1 @@
1
+ function e(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return e.codePointAt(r)-t.codePointAt(r);return e.length-t.length}export{e as a};