@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,80 @@
1
+ var e=new TextEncoder;function t(t){if(typeof t!=`string`)throw TypeError(`encodeUtf8 expects a string, got ${typeof t}`);if(!t.isWellFormed())throw TypeError(`encodeUtf8: input contains lone surrogates`);return e.encode(t)}async function n(e){let n=typeof e==`string`?t(e):e,r=new Uint8Array(await crypto.subtle.digest(`SHA-512`,n));return`sha512-${btoa(String.fromCodePoint(...r))}`}async function r(e){let n=t(JSON.stringify(e)),r=await crypto.subtle.digest(`SHA-256`,n),i=new Uint8Array(r,0,16);i[6]=i[6]&15|64,i[8]=i[8]&63|128;let a=Array.from(i,e=>e.toString(16).padStart(2,`0`)).join(``);return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20,32)}`}async function i(e){if(typeof crypto?.subtle?.digest!=`function`)return null;let t=a(e);try{return await r(t)}catch{return null}}function a(e){if(e._idBasis)return e._idBasis;let{severity:t,description:n}=e;return e.fileHash?{severity:t,description:n,fileHash:e.fileHash}:e.location?{severity:t,description:n,location:e.location}:{severity:t,description:n,file:e.file,line:e.line}}var o=new Map([[`CRITICAL`,`critical`],[`HIGH`,`high`],[`MEDIUM`,`medium`],[`LOW`,`low`],[`INFO`,`informational`],[`INFORMATIONAL`,`informational`],[`INFORMATIVE`,`informative`]]);function s(e){return typeof e==`string`&&e.trim().toLowerCase()===`informative`?`informational`:e}function c(e,t=e.severity){let n=s(e.severity);return n!==e.severity&&(!e.id&&!e._idBasis&&(e._idBasis=a({...e,severity:t})),e.severity=n),e.correctedSeverity!==void 0&&(e.correctedSeverity=s(e.correctedSeverity)),e}var l={critical:`Critical`,high:`High`,medium:`Medium`,low:`Low`,high_bug:`High bug`,bug:`Bug`,informational:`Informational`},u={inprogress:`In progress`,fixed:`Fixed`,invalid:`Invalid`,deleted:`Deleted`,ignored:`Ignored`},d={red:`Red`,blue:`Blue`,green:`Green`,gray:`Gray`,none:`Unmarked`},f={"claude-security":`Claude Security`,"codex-security":`Codex Security`,deepsec:`DeepSec`,piolium:`Piolium`,"markdown-generic":`Markdown (generic)`};function p(e){return l[s(e)]??String(e??``)}var m=/^( *)(`{3,}|~{3,})(.*)$/u,h=/^ {0,3}(?:#{1,6}(?:[ \t]|$)|>|([-*_])(?:[ \t]*\1){2,}[ \t]*$)/u,g=/^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/u,_=/^ {0,3}(?:=+|-+)[ \t]*$/u,v=/^( *)(?:[-*+]|\d{1,9}[.)]) +(?=\S)/u,ee=/^ *(?:[-*+]|\d{1,9}[.)])[ \t]*$/u,y=/^\s*$/u,te=[[/^<(script|pre|textarea|style)(?:\s|>|$)/iu,/<\/(?:script|pre|textarea|style)>/iu,e=>`</${e[1].toLowerCase()}>`],[/^<!--/u,/-->/u,`-->`],[/^<\?/u,/\?>/u,`?>`],[/^<![A-Za-z]/u,/>/u,`<!-- -->`],[/^<!\[CDATA\[/u,/\]\]>/u,`]]>`],[/^<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|search|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/iu,y,null]],ne=/^(?:<[A-Za-z][\dA-Za-z-]*(?:\s+[:A-Z_a-z][\w.:-]*(?:\s*=\s*(?:[^\s"'<=>`]+|'[^']*'|"[^"]*"))?)*\s*\/?>|<\/[A-Za-z][\dA-Za-z-]*\s*>)\s*$/u;function b(e,t,n=t){let r=/^ */u.exec(e)[0].length;if(r>3)return null;if(t&&n&&_.test(e))return!0;let i=m.exec(e);if(i&&!(i[2][0]==="`"&&i[3].includes("`")))return{fence:i[2]};let a=e.slice(r);for(let[e,t,n]of te){let r=e.exec(a);if(r)return{html:t,close:typeof n==`function`?n(r):n}}if(!t&&ne.test(a))return{html:y,close:null};let o=g.test(e)?null:v.exec(e);if(o&&!(t&&n&&/^ *(?:\d*[02-9]|\d+\d)[.)]/u.test(o[0]))){let e=/ +$/u.exec(o[0])[0].length;return{item:e>4?o[0].length-e+1:o[0].length}}let s=g.test(e)||t&&n?null:ee.exec(e);return s?{item:s[0].trimEnd().length+1}:h.test(e)||null}function x(e){return ie(e).ranges}function re(e,t){let n=e.replace(/^(?: {0,3}> ?)+/u,``),r=b(n,t);for(;r?.item;)n=n.slice(r.item),r=b(n,!1);return n.trim()!==``&&!r&&/^ */u.exec(n)[0].length<4}function ie(e){let t=[],n=-1,r=``,i=null,a=0,o=[],s=!1,c=!1,l=!1,u=0;for(let d of e.split(`
2
+ `)){let e=u;u+=d.length+1;let f=/^ */u.exec(d)[0].length;if(n!==-1||i){let o=a>0&&d.trim()!==``&&f<a,s=!o&&(i?i.ends.test(d):f<=a+3&&ae(r,d));if((o||s)&&(n!==-1&&t.push([n,o?e-1:e+d.length]),n=-1,i=null),!o)continue}if(!d.trim()){l&&o.pop(),l=!1,s=!1;continue}let p=o.length;for(;p>0&&f<o[p-1];)p--;let m=p>0?o[p-1]:0,h=d.slice(m),g=b(h,s,p===o.length&&!c);if(s&&!g)continue;for(o.length=p;g?.item;)m+=g.item,h=h.slice(g.item),o.push(m),g=b(h,!1);l=h.trim()===``,g?.fence?[n,r,a]=[e,g.fence,m]:g?.html&&([i,a]=[g.html.test(h)?null:{ends:g.html,close:g.close},m]);let _=s&&c;c=/^ {0,3}>/u.test(h),s=c?re(h,_):!g&&!l&&/^ */u.exec(h)[0].length<4}n!==-1&&t.push([n,e.length]);let d=n===-1?i?.close:r;return{ranges:t,closer:d?` `.repeat(a)+d:null}}function ae(e,t){let n=m.exec(t);return n!==null&&n[2][0]===e[0]&&n[2].length>=e.length&&!n[3].trim()}function S(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i][1]<=t?n=i+1:r=i}return n<e.length&&t>=e[n][0]}function C(e){return String(e??``).replaceAll(/\r\n?/gu,`
3
+ `)}var oe=/^## +(.*)$/gmu,se=/^### +(.*)$/gmu,w=/^#### +(.*)$/gmu,ce=/^##### +(.*)$/gmu,le=/^(.+):(\d+(?:-\d+)?)$/u;function T(e){return/^[0-9a-f]{7,64}$/iu.test(e)}function ue(e,t){let n=x(e);return[...e.matchAll(t)].filter(e=>!S(n,e.index))}function de(e,t){let n=ue(e,t);return[e.slice(0,n[0]?.index),...n.map((t,r)=>e.slice(t.index+t[0].length,n[r+1]?.index))]}function E(e,t){let n=ue(e,t);return{head:e.slice(0,n[0]?.index),subs:n.map((t,r)=>({heading:t[1],body:e.slice(t.index+t[0].length+1,n[r+1]?.index)}))}}function D(e,t){return E(e,t).subs}function O(e){let t=e.indexOf(`
4
+ `);return t===-1?{title:e.trim(),body:``}:{title:e.slice(0,t).trim(),body:e.slice(t+1)}}function fe(e){let t=e.split(`
5
+ `).map(e=>e.trim()).filter(e=>e.startsWith(`|`)&&!(/^[\s:|-]+$/u.test(e)&&e.includes(`-`))).map(e=>e.replace(/^\|/u,``).replace(/\|$/u,``).split(`|`).map(e=>e.trim()));if(t.length<2)return[];let n=t[0].map(e=>e.toLowerCase());return t.slice(1).filter(e=>e.length!==n.length||e.some((e,t)=>e.toLowerCase()!==n[t])).map(e=>Object.fromEntries(n.flatMap((t,n)=>t?[[t,e[n]??``]]:[])))}function pe(e){let t=Object.create(null),n=Object.create(null),r=[],i=null,a=``,o=[],s=``,c=(e,r,i)=>{!e||e in t||(t[e]=i.trim(),n[e]=r)},l=()=>{i&&c(i,a,o.join(`
6
+ `)),i=null,a=``,o=[]},u=e=>{(i?o:r).push(e)};for(let t of e.split(`
7
+ `)){let e=/^ {0,3}(```|~~~)/u.exec(t),n=e!==null&&(!s||e[1]===s);if(n&&(s=s?``:e[1]),n||s){u(t);continue}if(!t.trim()){i?l():r.push(t);continue}let d=/^\s*(?:[-*] +)?\*\*([^:*]+):\*\*\s*(.*)$/u.exec(t);if(d){l();let e=d[1].trim(),t=d[2],n;for(;(n=/\s+[\u00B7\u2022]\s+\*\*([^:*]+):\*\*\s*/u.exec(t))!==null;)c(e.toLowerCase(),e,t.slice(0,n.index)),e=n[1].trim(),t=t.slice(n.index+n[0].length);i=e.toLowerCase(),a=e,o=[t]}else/^\s*(?:#{1,6} |\||[-=*_]{3,}\s*$)/u.test(t)?l():u(t)}return l(),{fields:t,labels:n,prose:r.join(`
8
+ `).trim()}}function me(e){let t=(e||``).trim(),n=``,r=k(t);r&&(t=r.label.trim(),n=r.url.trim());let i=/#L(\d+)/u.exec(n)?.[1]??``,a=[...t.matchAll(/`([^`]+)`/gu)].map(e=>e[1].trim()).find(e=>!e.includes(`(`)&&(e.includes(`/`)||/\.\w/u.test(e)))??(t.replaceAll("`",``).trim().split(/[\s,]+/u).find(Boolean)||``),o=/^(.*?)#L(\d+)(?:-L?\d+)?$/u.exec(a);o&&(a=o[1],i||=o[2]);let s=le.exec(a);return s?(i||=s[2],{file:s[1],line:i,locationLink:n}):{file:a,line:i||`?`,locationLink:n}}function he(e){return e.replaceAll(`**`,``)}function k(e){let t=String(e??``),n=ge(t,_e(t)),r=ve(t),i=t.indexOf(`]`);for(let e=t.indexOf(`[`);e!==-1;e=t.indexOf(`[`,e+1)){for(;i!==-1&&i<=e;)i=t.indexOf(`]`,i+1);for(let a of[i,n.get(e)??-1]){if(a===-1||a===e+1||t[a+1]!==`(`)continue;let n=ye(t,a+1,r);if(n!==null)return{label:t.slice(e+1,a),url:n,index:e}}}return null}function ge(e,t){let n=new Map,r=[];for(let i=0;i<e.length;i++){let a=e[i];Ce(e,i)?i++:a==="`"?i=t.get(i)??i:a===`[`?r.push(i):a===`]`&&r.length>0&&n.set(r.pop(),i)}return n}function _e(e){let t=[];for(let n=e.indexOf("`");n!==-1;n=e.indexOf("`",n)){let r=1;for(;e[n+r]==="`";)r++;t.push([n,r]),n+=r}let n=new Map,r=new Map;for(let e=t.length-1;e>=0;e--){let[i,a]=t[e],o=r.get(a);o!==void 0&&n.set(i,o+a-1),r.set(a,i)}return n}function ve(e){let t=e.length,n=new Int32Array(t+1).fill(-1),r=new Int32Array(t+1).fill(-1),i=new Int32Array(t+1).fill(-1),a=new Int32Array(t+1).fill(-1);for(let o=t-1;o>=0;o--)n[o]=e[o]===`)`?o:n[o+1],r[o]=/\s/u.test(e[o])?o:r[o+1],i[o]=e[o]===`>`?o:i[o+1],a[o]=e[o]===`
9
+ `?o:a[o+1];let o=new Map,s=[];for(let n=0;n<t;n++){let t=e[n];Ce(e,n)?n++:r[n]===n?s.length=0:t===`(`?s.push(n):t===`)`&&s.length>0&&o.set(s.pop(),n)}return{balanced:o,nextClose:n,nextSpace:r,nextAngle:i,nextLine:a}}function ye(e,t,n){let r=be(e,t,n);if(r)return r;let i=n.balanced.get(t);if(i!==void 0)return i>t+1?e.slice(t+1,i):null;let a=n.nextClose[t+1],o=n.nextSpace[t+1];return a===-1||a===t+1||o!==-1&&o<a?null:e.slice(t+1,a)}function be(e,t,n){if(e[t+1]!==`<`)return``;let r=n.nextAngle[t+2],i=n.nextLine[t+2];return r===-1||i!==-1&&i<r||e[r+1]!==`)`?``:e.slice(t+2,r)}var xe=/\\([!-/:-@[-`{-~])/gu,Se=/[!-/:-@[-`{-~]/u;function Ce(e,t){return e[t]===`\\`&&Se.test(e[t+1]??``)}function we(e){return typeof e==`string`?e.replace(xe,`$1`):e}function Te(e){let t=/^\[(.+)\]$/u.exec(e.trim());return t?t[1].trim():e.trim()}function A(e){let t=(e||``).trim();return/^[-\u2013\u2014]+$/u.test(t)?``:t}var Ee={critical:6,high:5,medium:4,low:3,high_bug:2,bug:1,informational:0},j=[`critical`,`high`,`medium`,`low`,`high_bug`,`bug`,`informational`];function De(e){return e=s(e),e!=null&&e in Ee?e:null}function Oe(e){return De(e?.correctedSeverity)??s(e?.severity)}function ke(e){let t=De(e?.correctedSeverity);return t!=null&&t!==s(e?.severity)}function Ae(e,t){return t===`original`?s(e?.severity):Oe(e)}function je(e){let t=e?._correctedByReport;return t&&new Set(Object.values(t).map(e=>s(e?.severity))).size>1?t:null}var Me=[`revalidation`,`refuted`,`unreachable`,`confirmed`,`partial`,`unknown`],Ne=new Set(Me);function M(e){return Ne.has(e?.revalidate)?e.revalidate:``}function Pe(e,t=e?.source){return Object.hasOwn(f,t)||M(e)===`revalidation`}function Fe(e,t=e?._source??e?.source){let n=typeof t==`string`&&t!==``&&t!==`deepview`,r=n?t:e?.analyzer??e?.type??e?._analyzer;return e?.security===!0||(r===`security`||r===`dependencies`)&&e?.security!==!1||n&&[`critical`,`high`,`medium`,`low`].includes(e?.severity)}function Ie(e){return e&&e.replace(/^[^/]+\//u,``).replace(/^claude-/u,``).replaceAll(`-`,` `)}function Le(e,t=!0){let n=t&&M(e)===`revalidation`?`revalidate`:``;return[e?.type,n,Ie(e?.model),e?.effort,e?.exportsMode].filter(Boolean).join(` · `)}function N(e,t){if(!e)return e;let n=e;t?.exportsMode===`isolate`&&(n=n.replace(/^\((?:[^()]|\([^()]*\))*\): \[export:\s*\w+\] /u,``),n=n.replace(/^\[export:\s*\w+\] /u,``));let r=[t?.exportName,t?.methodName].filter(Boolean).map(e=>e.replaceAll(/[.*+?^${}()|[\]\\]/gu,`\\$&`));for(let e of r)n=n.replaceAll(RegExp(`\\[export:\\s*${e}\\]\\s*`,`gu`),``);for(let e of r)n=n.replace(RegExp(`^\\(\`?${e}\`?\\): `,`u`),``);return n}function Re(e){let t=e?.exportName,n=e?.methodName;return t&&n&&t!==n?`${t}.${n}`:t||n||``}function P(e){return e?e.split(`
10
+ `).find(e=>e.trim())?.trim()??``:``}function ze(e){return typeof e?.title==`string`?e.title.trim():``}function F(e){return ze(e)||P(N(e?.description,e))}function Be(e){let t=N(e?.description,e)||``,n=ze(e);if(n){let e=t.trim(),r=O(e);return{title:n,body:r.title===n?r.body.replace(/^\s+/u,``):e}}let r=t.indexOf(`
11
+ `);if(r<0||x(t.slice(0,r))[0]?.[0]===0)return{title:``,body:t};let i=t.slice(r+1).replace(/^\s+/u,``);return i?{title:t.slice(0,r).trim(),body:i}:{title:``,body:t}}function Ve(e){let t=ze(e);if(!t)return N(e?.description,e)||``;let{body:n}=Be(e);return n?`${t}
12
+
13
+ ${n}`:t}var He=/^\*\*([^*\n]+):\*\*[ \t]*/u;function Ue(e){let t=[];for(let n of de(e||``,/\n{2,}/gu)){if(!n.trim())continue;let e=He.exec(n);if(e){t.push({label:e[1].trim(),body:n.slice(e[0].length).trim()});continue}let r=t.at(-1);r&&r.label===null?r.body+=`
14
+
15
+ ${n}`:t.push({label:null,body:n})}return t}function I(e){return Number.isFinite(parseInt(e?.line,10))?`${e.file}:${e.line}`:e?.file??``}function We(e){let t=e=>typeof e==`string`?e:``;return`${t(e?.observation)}
16
+ ${t(e?.text)}`.trim()}function L(e){if(typeof e!=`string`||e.length===0)return!1;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function Ge(e){return String(e??``).replaceAll(/\s*\n\s*/gu,` `).replaceAll(`|`,`\\|`).trim()}function R(e){let t=String(e??``);if(t===``)return``;let n=Math.max(0,...[...t.matchAll(/`+/gu)].map(e=>e[0].length)),r="`".repeat(n+1),i=t.startsWith("`")||t.endsWith("`")?` `:``;return`${r}${i}${t}${i}${r}`}function Ke(e){return String(e??``).replaceAll(/[[\]]/gu,`\\$&`)}function z(e,t){return`[${e}](${/[\s()<>]/u.test(t)?`<${t.replaceAll(`>`,`%3E`)}>`:t})`}function qe(e){return L(e)?`<${e}>`:String(e??``)}function Je(e,t){let n=String(e??``).toLowerCase().replaceAll(/[^\p{L}\p{N}\p{M}\s_-]/gu,``).replaceAll(/\s/gu,`-`),r=n;for(let e=1;t.has(r);e++)r=`${n}-${e}`;return t.add(r),r}function B(e,t){return`${`#`.repeat(Math.min(6,Math.max(1,e)))} ${t}`}function Ye(e,t,n=[]){return[e,e.map((e,t)=>n[t]===`right`?`---:`:`---`),...t].map(e=>`| ${e.join(` | `)} |`).join(`
17
+ `)}function Xe(e){let t=e instanceof Date?e:new Date(e);if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return`${t.getUTCFullYear()}-${n(t.getUTCMonth()+1)}-${n(t.getUTCDate())} ${n(t.getUTCHours())}:${n(t.getUTCMinutes())} UTC`}function V(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function Ze(e){return e.filter(e=>typeof e==`string`&&e.trim()).map(e=>e.replace(/\s+$/u,``)).join(`
18
+
19
+ `)}var Qe=/^( {0,3})(\\*#)/u;function H(e){let t=C(e).trim();if(!t)return``;let n=$e(t,e=>e.replace(Qe,`$1\\$2`)),{closer:r}=ie(n);return r===null?n:`${n}
20
+ ${r}`}function $e(e,t){let n=x(e),r=0;return e.split(`
21
+ `).map(e=>{let i=r;return r+=e.length+1,S(n,i)?e:t(e)}).join(`
22
+ `)}function U(e){return $e(String(e??``),e=>e.replace(/^( {0,3})\\(\\*#)/u,`$1$2`))}function et(e,t){let n=` `.repeat(e.length);return t.split(`
23
+ `).map(e=>e?n+e:``).join(`
24
+ `)}var tt=[`type`,`model`,`think`,`effort`,`exportsMode`];function nt(e,t){if(!t.source)for(let n of tt)e[n]==null&&t[n]!=null&&(e[n]=t[n])}var rt=/^(?:https?:\/\/)?(?:www\.)?github\.com\/([^/?#]+)\/([^/?#]+?)(?:\.git)?(?:[/?#].*)?$/iu,it=/^[\w.-]+\/[\w.-]+$/u;function at(e){return it.test(e)}function ot(e){let t=e?.repo?.github;if(typeof t!=`string`)return null;let n=t.trim().replace(/\/+$/u,``);if(!n)return null;let r=rt.exec(n),i=(r?`${r[1]}/${r[2]}`:n).replace(/\.git$/u,``);return at(i)?i:null}function st(e){let t=(typeof e?.directory==`string`?e.directory.trim():``).replace(/^(?:\.\/)+/u,``).replaceAll(/^\/+|\/+$/gu,``).replaceAll(/\/{2,}/gu,`/`);return!t||t===`.`||/[?#]/u.test(t)||t.split(`/`).includes(`..`)?``:t}var ct=[`finding_url`,`repository`,`title`,`description`,`severity`,`configured_scan_id`,`relevant_paths`];function lt(e){let t=[],n=[],r=``,i=!1;for(let a=0;a<e.length;a++){let o=e[a];i?o===`"`?e[a+1]===`"`?(r+=`"`,a++):i=!1:r+=o:o===`"`?i=!0:o===`,`?(n.push(r),r=``):o===`
25
+ `||o===`\r`?(n.push(r),t.push(n),n=[],r=``,o===`\r`&&e[a+1]===`
26
+ `&&a++):r+=o}for((r!==``||n.length>0)&&(n.push(r),t.push(n));t.length>0&&t.at(-1).length===1&&t.at(-1)[0]===``;)t.pop();return t}function ut(e,t){return t.map(t=>{let n=Object.create(null);return e.forEach((e,r)=>{n[e]=t[r]??``}),n})}function dt(e){let t=lt(e);if(t.length<2)throw Error(`Codex CSV: empty or missing header row`);let[n,...r]=t;for(let e of ct)if(!n.includes(e))throw Error(`Codex CSV: missing required column "${e}"`);let i=Map.groupBy(ut(n,r).filter(e=>e.configured_scan_id),e=>e.configured_scan_id);if(i.size===0)throw Error(`Codex CSV: no rows with a configured_scan_id`);let a=[];for(let[e,t]of i){let n=new Set(t.map(e=>e.repository).filter(Boolean));if(n.size>1)throw Error(`Codex CSV: scan ${e} contains multiple repositories: ${[...n].join(`, `)}`);let r=`${[...n][0]||`unknown-repo`}:${e.replace(/^[^:]+:/u,``)}`;a.push({displayName:r,data:{type:`security`,source:`codex-security`,findings:t.map(ft)}})}return a}function ft(e){let t=e.relevant_paths.split(` | `).map(e=>e.trim()).find(Boolean)||`unknown`,n=[e.title,e.description].filter(Boolean).join(`
27
+
28
+ `),r={id:e.finding_url,file:t,line:`?`,severity:(e.severity||`medium`).toLowerCase(),description:n,repo:{github:e.repository}};return e.commit_hash&&(r.commitHash=e.commit_hash),e.detected_at&&(r.detectedAt=e.detected_at),e.committed_at&&(r.committedAt=e.committed_at),c(r)}function pt(){let e=[],t=new Map,n=n=>{if(!t.has(n)){let r={security:!1};r.parent=r,t.set(n,r),typeof n==`string`&&e.push(n)}return t.get(n)},r=e=>{let t=e;for(;t.parent!==t;)t=t.parent;for(;e.parent!==e;){let n=e.parent;e.parent=t,e=n}return t};return{nodeFor:n,root:r,join:(e,t)=>{e=r(e),t=r(t),e!==t&&(t.parent=e,e.security||=t.security)},ids:e}}function mt(e,{source:t,linkedIds:n=()=>[],knownRows:r=()=>[]}={}){let{nodeFor:i,root:a,join:o,ids:s}=pt(),c=[],l=(e,n=!1)=>{let r;for(let s of e){if(!s||typeof s!=`object`)continue;let e=i(s.id||s);a(e).security||=n?s.isSecurity===!0:Fe(s,s._source??s.source??t),r?o(r,e):r=e,n||c.push([s,e])}};for(let t of e)l(t);let u=new Set;for(let e=0;e<s.length;e++){let t=s[e],a=i(t);for(let e of n(t))o(a,i(e));for(let e of r([t]))u.has(e)||(u.add(e),l(e.members,!0))}let d=!1;for(let[e,t]of c){let n=a(t).security;e.isSecurity!==n&&(e.isSecurity=n,d=!0)}return d}var ht=/^## ([A-Z][A-Z_]*)\s*\(\d+\)\s*\n/mu,gt=new Map([...o,[`HIGH_BUG`,`high_bug`],[`BUG`,`bug`]]),_t=e=>String(e??``).toLowerCase().replaceAll(/[^a-z]+/gu,``),vt=new Map([[`high`,8],[`medium`,6],[`low`,4]]);function yt(e){if(e!==void 0)return vt.get(_t(e))??vt.get(`medium`)}var bt=new Map([[`confirmed`,`confirmed`],[`falsepositive`,`refuted`],[`uncertain`,`unknown`]]);function xt(e){let t=C(e).trim().split(ht);if(t.length===1)return null;let n=[];for(let e=1;e<t.length;e+=2){let r=gt.get(t[e].toUpperCase())??`medium`;for(let i of de(t[e+1],/^### /gmu).slice(1)){let e=St(i,r);if(!e)continue;let t=i.indexOf(`
29
+ ### `);t!==-1&&(e._idBasis=a(St(i.slice(0,t+1),r))),n.push(e)}}return n.length===0?null:{type:`security`,source:`deepsec`,findings:n}}function St(e,t){let{title:n,body:r}=O(e);if(!n)return null;let i=r.replace(/\n---\s*$/u,``).trim(),a=Object.fromEntries([...i.matchAll(/^- \*\*([^:*]+):\*\*\s*(.+)$/gmu)].map(e=>[e[1].trim().toLowerCase(),e[2].trim()])),o=/^\*\*Recommendation:\*\*\s*/mu.exec(i),s=o?i.slice(0,o.index):i,l=o?i.slice(o.index+o[0].length).trim():``,u=[n,s.split(`
30
+ `).filter(e=>!/^\s*- \*\*/u.test(e)).join(`
31
+ `).replaceAll(`**`,``).trim()].filter(Boolean).join(`
32
+
33
+ `),d={file:(a.file||`unknown`).replace(/^`(.*)`$/u,`$1`),line:(a.lines||``).split(`,`).map(e=>e.trim()).find(Boolean)||`?`,severity:t,description:u};l&&(d.recommendation=l.replaceAll(`**`,``));let f=yt(a.confidence);f!==void 0&&(d.confidence=f);let p=bt.get(_t(a.revalidation));return p&&(d.revalidate=p,d.revalidateSource=`deepsec`,a.reasoning&&(d.revalidateVerdict=a.reasoning.replaceAll(`**`,``))),a.slug&&(d.slug=a.slug),c(d,t===`informative`?`medium`:t)}var W=120;function Ct(e){let t=F(e)||I(e)||`Untitled finding`;return t.length>W?`${t.slice(0,W-1).trimEnd()}\u2026`:t}function wt(e){let t=String(e??``).trim();return L(t)?qe(t):at(t)?z(t,`https://github.com/${t}`):t}function Tt(e,t,n){return t?f[t]??String(t):Le(e,n)}var Et=[[`Impact`,`impact`,!1],[`Reproduction`,`reproduction`,!1],[`Recommendation`,`recommendation`,!1],[`Confidence reasoning`,`confidenceReason`,!1],[`Revalidation verdict`,`revalidateVerdict`,!0],[`Revalidation recommendation`,`revalidateRecommendation`,!0]],Dt=[[`Status`,`status`],[`Branch`,`branch`],[`Date created`,`dateCreated`],[`Detected at`,`detectedAt`],[`Committed at`,`committedAt`],[`PoC status`,`pocStatus`],[`Variant of`,`parent`],[`Slug`,`slug`],[`Priority`,`priority`]],Ot=[[`Detailed report`,`reportPath`],[`Commit audited`,`auditedCommit`],[`ID`,`id`]];function G(e){return typeof e==`number`?Number.isFinite(e)?String(e):``:typeof e==`string`?e.replaceAll(/\s*\n\s*/gu,` `).trim():``}function kt(e){return typeof e==`string`?e.trim():``}function At(e,t){let n=t.severityMode===`original`,r=p(Ae(e,t.severityMode));ke(e)&&(r+=n?` \u2014 corrected to ${p(Oe(e))}`:` \u2014 corrected from ${p(e.severity)}`);let i=je(e);if(i){let e=Object.entries(i).map(([e,t])=>`${e||`this report`}: ${p(t?.severity)}`);r+=` (varies across reports \u2014 ${e.join(`; `)})`}return e.critical===!0&&(r+=` · flagged critical by the analyzer`),r}function jt(e,t){let n=I(e);if(!n)return``;let r=t.hooks.location(e),i=L(r)?z(R(n),r):R(n),a=Re(e);return a?`${i} \xB7 ${R(a)}`:i}function Mt(e){if(!e)return``;let t=[],n=u[e.triage]??(e.ignored?u.ignored:``);return n&&t.push(n),e.color&&t.push(`${d[e.color]??e.color} mark`),e.flagged===!0&&t.push(`Flagged`),t.join(` · `)}function Nt(e,t){let n=G(e.commitHash);if(!n)return``;let r=t.hooks.commit(e);return L(r)?z(R(n.slice(0,7)),r):R(n)}function Pt(e,t,n){let r=[],i=(e,t)=>{t&&r.push(`- **${e}:** ${t}`)};i(`Location`,jt(e,t)),i(`Severity`,At(e,t)),e.confidence!==void 0&&e.confidence!==null&&i(`Confidence`,`${e.confidence}/10`),t.showAnalyzer&&i(`Analyzer`,t.analyzerOf(e)),i(`Category`,G(e.category));let a=t.revalidation?M(e):``;a&&i(`Revalidation`,a===`revalidation`?`the revalidation pass itself`:a);let o=G(e.revalidateSource);a&&i(`Revalidated by`,f[o]??o),i(`Triage`,Mt(n)),n?.fix&&i(`Fix`,qe(String(n.fix).trim())),t.showReport&&i(`Report`,R(t.hooks.report(e)??``));let s=G(e.repo?.github);s&&s!==t.repo&&i(`Repository`,wt(s)),i(`Introduced in`,Nt(e,t));let c=G(e.discoveredIn);c&&c!==String(e.file??``).trim()&&i(`Found while analyzing`,R(c));let l=e.package?.npm,u=G(l?.name);u&&i(`Package`,R(G(l.version)?`${u}@${G(l.version)}`:u));for(let[t,n]of Dt)i(t,G(e[n]));for(let[t,n]of Ot)i(t,R(G(e[n])));return r.join(`
34
+ `)}function K(e,t,n){let r=H(n);return r?`${B(e,t)}
35
+
36
+ ${r}`:B(e,t)}function Ft(e,t){return(Array.isArray(e.evidence)?e.evidence:[]).map((n,r)=>{let i=`${r+1}. `,a=I(n),o=t.hooks.evidence(n,e,r),s=``;a?s=L(o)?z(R(a),o):R(a):L(o)&&(s=qe(o));let c=H(We(n)),l=i+(s||`(no reference)`);return c?`${l}
37
+
38
+ ${et(i,c)}`:l}).join(`
39
+
40
+ `)}function It(e,t,n){let r=Be(e),i=C(r.body),a=F(e),o=a.length>W,s=!o&&!r.title&&i.trim()===a,c=o&&P(i)!==a?`${a}
41
+
42
+ ${i}`:i,l=Ue(s?``:c),u=l.findIndex(e=>e.label!==null),d=u===-1?l:l.slice(0,u),f=u===-1?[]:l.slice(u),p=d.map(e=>H(e.body)),m=Ft(e,t);m&&p.push(`${B(n,`Evidence`)}
43
+
44
+ ${m}`);for(let e of f)p.push(e.label===null?H(e.body):K(n,e.label,e.body));return p}function Lt(e,t,n){let r=t.hooks.annotation(e),i=[Pt(e,t,r),...It(e,t,n)];for(let[r,a,o]of Et){if(o&&!t.revalidation)continue;let s=e[a],c=typeof s==`string`?N(s,e):``;c.trim()&&i.push(K(n,r,c))}ke(e)&&kt(e.correctedSeverityReason)&&i.push(K(n,`Severity correction`,e.correctedSeverityReason));let a=kt(r?.comment);return a&&i.push(K(n,`Comment`,a)),i}function Rt(e,t,{headingText:n,depth:r}){let i=[B(r,n)];if(e.length===1)return Ze([...i,...Lt(e[0],t,r+1)]);let a=[...new Set(e.map(e=>t.hooks.report(e)).filter(Boolean))],o=a.length>1?` \u2014 reported in ${a.map(e=>R(e)).join(`, `)}`:``;i.push(`${V(e.length,`case`)} of this finding${o}.`);let s=F(e[0]);return e.forEach((n,a)=>{let o=I(n);i.push(B(r+1,`Case ${a+1} of ${e.length}${o?` \u2014 ${R(o)}`:``}`));let c=F(n);c&&c!==s&&i.push(H(c)),i.push(...Lt(n,t,r+2))}),Ze(i)}var zt=new Map(Object.entries(l).map(([e,t])=>[t.toLowerCase(),e])),Bt=new Map(Object.entries(f).map(([e,t])=>[t.toLowerCase(),e]));function q(e){let t=/(`+)(.+?)\1(?!`)/u.exec(String(e??``));if(!t)return null;let n=t[2];if(n.length>2&&n.startsWith(` `)&&n.endsWith(` `)){let e=n.slice(1,-1);if(e.startsWith("`")||e.endsWith("`"))return e}return n}function J(e){let t=k(String(e??``));return t?.index===0?{label:t.label,url:t.url}:null}function Vt(e){let t=/^<(https?:[^>\s]*)>$/u.exec(e.trim());return t?t[1]:null}function Ht(e){let t=le.exec(e);return t?{file:t[1],line:t[2]}:{file:e,line:`?`}}function Ut(e){let t=e.indexOf(`.`);return t>0?{exportName:e.slice(0,t),methodName:e.slice(t+1)}:{exportName:e}}function Wt(e){let t=String(e??``).trim();return zt.get(t.toLowerCase())??t}function Gt(e){let t={},n=e.trim(),r=/ \u00B7 (`+)(.+?)\1$/u.exec(n);r&&(Object.assign(t,Ut(q(r[0]))),n=n.slice(0,r.index));let i=J(n),a=q(i?i.label:n);return a!==null&&Object.assign(t,Ht(a)),i&&L(i.url)&&(t.location=i.url),t}var Kt=` · flagged critical by the analyzer`,qt=` (varies across reports — `;function Jt(e){let t={},n=e.trim();n.endsWith(Kt)&&(t.critical=!0,n=n.slice(0,-Kt.length));let r=n.indexOf(qt);r!==-1&&(n=n.slice(0,r));let i=/^(.*?) \u2014 corrected (from|to) (.*)$/u.exec(n);return i?[t.severity,t.correctedSeverity]=(i[2]===`from`?[i[3],i[1]]:[i[1],i[3]]).map(Wt):t.severity=Wt(n),t}var Yt=new Set([`max`,`xhigh`,`high`,`medium`,`low`,`minimal`]),Xt=new Set([`list`,`isolate`]);function Zt(e){return/\d/u.test(e)||/^(?:opus|sonnet|haiku|gpt|gemini|fable|mythos|llama|mistral)\b/iu.test(e)}function Qt(e){let t=e.trim(),n=Bt.get(t.toLowerCase());if(n)return{source:n};let r={},i=[];for(let e of t.split(` · `).map(e=>e.trim()).filter(Boolean))e===`revalidate`&&!r.revalidate?r.revalidate=`revalidation`:Xt.has(e)&&!r.exportsMode?r.exportsMode=e:Yt.has(e)&&!r.effort?r.effort=e:i.push(e);return i.length>1?[r.type,r.model]=i:i.length===1&&(r[Zt(i[0])?`model`:`type`]=i[0]),{run:r}}function $t(e){let t=e.trim(),n=J(t);return n?n.label.trim():Vt(t)??t}function en(e){let t=J(e.trim());if(t){let e=t.url.split(`/`).at(-1)??``;return T(e)?e:q(t.label)??e}return q(e)??e.trim()}function tn(e){let t=q(e)??e.trim(),n=t.lastIndexOf(`@`);return{npm:n>0?{name:t.slice(0,n),version:t.slice(n+1)}:{name:t}}}function nn(e){let t=e.trim().toLowerCase();return t===`the revalidation pass itself`?`revalidation`:Me.includes(t)?t:void 0}var rn=new Map([...[[`Category`,`category`],...Dt].map(([e,t])=>[e.toLowerCase(),(e,n)=>{e[t]=n}]),...[...Ot,[`Found while analyzing`,`discoveredIn`]].map(([e,t])=>[e.toLowerCase(),(e,n)=>{e[t]=q(n)??n}]),[`location`,(e,t)=>Object.assign(e,Gt(t))],[`severity`,(e,t)=>Object.assign(e,Jt(t))],[`confidence`,(e,t)=>{let n=/^(\d+(?:\.\d+)?)\/10$/u.exec(t);n&&(e.confidence=Number(n[1]))}],[`revalidation`,(e,t)=>{let n=nn(t);n&&(e.revalidate=n)}],[`revalidated by`,(e,t)=>{let n=t.trim();n&&(e.revalidateSource=Bt.get(n.toLowerCase())??n)}],[`repository`,(e,t)=>{e.repo={github:$t(t)}}],[`introduced in`,(e,t)=>{e.commitHash=en(t)}],[`package`,(e,t)=>{e.package=tn(t)}],[`priority`,(e,t)=>{e.priority=/^-?\d+(?:\.\d+)?$/u.test(t)?Number(t):t}]]);function an(e,t,n){let r=rn.get(t.trim().toLowerCase());r&&r(e,n.trim())}var on=/^- \*\*([^*\n]+?):\*\* ?(.*)$/u;function sn(e){let t=e.split(`
45
+ `),n=0,r=()=>{for(;n<t.length&&!t[n].trim();)n++},i=()=>{let e=[];for(let r;(r=on.exec(t[n]??``))!==null;n++)e.push([r[1].trim(),r[2].trim()]);return e};r();let a=i();if(a.length>0)return{title:``,facts:a,rest:t.slice(n).join(`
46
+ `)};let o=[];for(;n<t.length&&t[n].trim();)o.push(t[n++]);return r(),a=i(),a.length===0?{title:``,facts:a,rest:e}:{title:U(o.join(`
47
+ `).trim()),facts:a,rest:t.slice(n).join(`
48
+ `)}}var cn=/^(\d+)\. (.*)$/u;function ln(e){let t=[],n=x(e),r=0;for(let i of e.split(`
49
+ `)){let e=S(n,r)?null:cn.exec(i);r+=i.length+1,e?t.push({ref:e[2].trim(),indent:e[1].length+2,note:[]}):t.length>0&&t.at(-1).note.push(i)}return t.map(e=>un(e))}function un({ref:e,indent:t,note:n}){let r={},i=J(e),a=Vt(e),o=a===null?q(i?i.label:e):null;o!==null&&Object.assign(r,Ht(o));let s=i?i.url:a;L(s)&&(r.url=s);let c=U(n.map(e=>e.slice(Math.min(t,/^ */u.exec(e)[0].length))).join(`
50
+ `).trim());return c&&(r.text=c),r}var dn=new Map(Et.map(([e,t])=>[e.toLowerCase(),t])),fn=[...dn.keys()];function pn(e){let t=e.length,n=1/0;for(let r=e.length-1;r>=0;r--){let i=fn.indexOf(e[r].label.toLowerCase());if(i===-1||i>=n)break;n=i,t=r}return{paragraphs:e.slice(0,t),fields:e.slice(t).map(e=>[dn.get(e.label.toLowerCase()),e.body])}}function mn(e,t,n){let r=[],i=P(t),a=e.endsWith(`…`)?e.slice(0,-1).trimEnd():``;!e||i===e||a&&i.startsWith(a)?r.push(t):r.push(e,t);for(let{label:e,body:t}of n)r.push(t?`**${e}:** ${t}`:`**${e}:**`);return r.filter(Boolean).join(`
51
+
52
+ `)}var hn=/^<!--\s*DeepView findings export\b[^>]*-->/u,gn=/^Case \d+ of \d+(?:\s|$)/u,_n=/^- \*\*([^*\n]+?):\*\* ?(.*)$/gmu,vn=new Set([`evidence`,`severity correction`,`comment`]);function yn(e){let t=C(e).trim();if(!hn.test(t))return null;let{head:n,subs:r}=E(t,oe),i=[];for(let{heading:e,body:t}of r){if(e.trim().toLowerCase()===`summary`)continue;let n=bn(e);for(let e of D(t,se))i.push(Sn(e,n))}return Tn(xn(n),i)}function bn(e){let t=/^(.*?)\s*\(\d+\)\s*$/u.exec(e.trim());return Wt(t?t[1]:e)}function xn(e){let t=new Map;for(let n of e.matchAll(_n)){let e=n[1].trim().toLowerCase();t.has(e)||t.set(e,n[2].trim())}return{sources:(t.get(`source`)??``).split(`,`).map(e=>Qt(e).source).filter(Boolean),analyzers:(t.get(`analyzer`)??t.get(`analyzers`)??``).split(`;`).map(e=>e.trim()).filter(Boolean),repo:t.has(`repository`)?$t(t.get(`repository`)):``}}function Sn({heading:e,body:t},n){let r=e.trim().replace(/^\d+\.\s+/u,``),i=D(t,w).filter(e=>gn.test(e.heading.trim()));return i.length===0?[Cn(t,w,r,n)]:i.map(e=>Cn(e.body,ce,r,n))}function Cn(e,t,n,r){let{title:i,facts:a,rest:o}=sn(e),{head:s,subs:l}=E(o,t),u=l.map(e=>({label:e.heading.trim(),body:e.body.trim()})),d={file:`unknown`,line:`?`},f=null;for(let[e,t]of a)e.trim().toLowerCase()===`analyzer`?f=Qt(t):an(d,e,t);d.severity||=r||`medium`;let p=i||n,m=p!==`Untitled finding`&&p!==I(d),{paragraphs:h,fields:g}=pn(u.filter(e=>!vn.has(e.label.toLowerCase())).map(e=>({label:e.label,body:U(e.body)})));d.description=mn(m?p:``,U(s.trim()),h);let _=u.filter(e=>e.label.toLowerCase()===`evidence`).flatMap(e=>ln(e.body));_.length>0&&(d.evidence=_);for(let[e,t]of g)d[e]=t;let v=u.find(e=>e.label.toLowerCase()===`severity correction`);return v?.body&&(d.correctedSeverityReason=U(v.body)),{finding:c(d),analyzer:f}}function wn(e,t){let n={source:null,run:{}};if(t.some(e=>e.analyzer!==null)){let e=new Set(t.map(e=>e.analyzer?.source??null));e.size===1&&!e.has(null)&&([n.source]=e);for(let e of t)e.analyzer?.run?Object.assign(e.finding,e.analyzer.run):e.analyzer?.source&&!n.source&&(e.finding.source=e.analyzer.source);return n}let r=e.analyzers.length===1?Qt(e.analyzers[0]):null;return r?.source?n.source=r.source:r?.run?n.run=r.run:e.analyzers.length===0&&e.sources.length===1&&([n.source]=e.sources),n}function Tn(e,t){let n=t.flat(),{source:r,run:i}=wn(e,n),a={},o=new Set(n.map(e=>e.finding.type).filter(Boolean)),s=i.type??(o.size===1?[...o][0]:null)??(r?`security`:null);s&&(a.type=s),r&&(a.source=r);for(let e of[`model`,`effort`,`exportsMode`])i[e]&&(a[e]=i[e]);e.repo&&(a.repo={github:e.repo});let c=t.map(e=>e.map(e=>e.finding));return c.every(e=>e.length===1)?a.findings=c.flat():a.groups=c,a}var En=`markdown-generic`,Dn=[`#`,`id`,`product`,`priority`,`vulnerability`],On=[`title`,`description`,`root cause`,`code references`,`attack scenario`,`steps to reproduce`,`impact`,`patch`],kn=/^(?:#{3,6}[ \t]+)?(?:\*\*)?(Title|Description|Root Cause|Code references|Attack Scenario|Steps to Reproduce(?:[ \t]+.*?)?|Impact|Patch):?(?:\*\*)?(?:[ \t]+#+)?[ \t]*$/gimu,An={P0:`critical`,P1:`high`,P2:`medium`,P3:`low`,P4:`informational`},Y=e=>e.trim().slice(1,-1).split(`|`).map(e=>e.trim());function X(e,t){if(!e)throw Error(`Markdown (generic): unsupported ${t}`)}function jn(e){return[...new Set(e.split(`
53
+ `).map(e=>e.trim()).filter(Boolean))].map(e=>{X(/^https?:\/\/[^\s()[\]{}"'<>`\\]+$/iu.test(e)&&!/[.,;!?]$/u.test(e),`link syntax; use bare URLs on separate lines`);let t;try{t=new URL(e)}catch{X(!1,`URL`)}let[n,r,i,a,...o]=t.pathname.slice(1).split(`/`);X([`github.com`,`www.github.com`].includes(t.hostname)&&!t.username&&!t.password&&!t.port&&[n,r].every(e=>e&&/^[\w-][\w.-]*$/u.test(e)),`repository URL`),X(o.every(Boolean),`repository path; empty components`);let s=`${n}/${r.replace(/\.git$/iu,``)}`.toLowerCase(),c=/^#L(\d+)(?:-L?(\d+))?$/u.exec(t.hash),l=i===`blob`?o.slice(0,-1):i===`tree`?o:[];try{l=l.map(decodeURIComponent)}catch{X(!1,`repository directory encoding`)}return X(l.every(e=>e===e.trim()&&!/[\\/:?#\p{Cc}]/u.test(e)),`repository directory`),{repo:s,ref:a,directory:l,...i===`blob`&&o.length&&{evidence:{file:o.join(`/`),line:c?c.slice(1).filter(Boolean).join(`-`):`?`,url:e}}}})}function Mn(e,t,n,r){let i=jn(n),a=i[0]?.repo;X(a&&i.every(e=>e.repo===a),`repository set for finding ${e.id}; expected exactly one repository`),X(!e.group.github||e.group.github===a,`repository set for product ${e.product}; expected exactly one repository`);let o=r.get(a);X(o===void 0||o===e.prefix,`repository ID prefixes for ${a}; expected ${o}, got ${e.prefix} (${e.id})`),r.set(a,e.prefix),e.group.github=a,e.group.directories.push(...i.map(e=>e.directory));let s=i.flatMap(e=>e.evidence??[]);if(s.length){Object.assign(t,{file:s[0].file,line:s[0].line,location:s[0].url,evidence:s});let e=i.filter(e=>e.evidence).map(e=>e.ref.toLowerCase()),n=e.reduce((e,t)=>t.length>e.length?t:e);e.every(e=>T(e)&&n.startsWith(e))&&(t.auditedCommit=n)}}function Nn(e){let t=e[0];for(let n of e.slice(1)){let e=0;for(;e<t.length&&t[e]===n[e];)e++;t=t.slice(0,e)}return t.join(`/`)}function Pn(e){let t=C(e).trim(),n=[...t.matchAll(/^## +(.*)$/gmu)];if(!n.some(e=>/^\d+\.\s+\S+/u.test(e[1]))&&(n.length||t.startsWith(`# `)))return null;let r=[...t.matchAll(/^\|[^\n]*\|$/gmu)].find(([e])=>Y(e).map(e=>e.toLowerCase()).join()===Dn.join());if(!r)return null;let i=t.slice(0,r.index).trim();X(!i||/^# [^\n]+$/u.test(i),`summary preamble`),X(r.index<(n[0]?.index??t.length),`summary position`);let a=t.slice(r.index,n[0]?.index).trim().split(`
54
+ `),o=new Set(Y(a[0]).map(e=>e.toLowerCase()));X(a[1]&&Y(a[1]).length===5&&Y(a[1]).every(e=>/^:?-{3,}:?$/u.test(e)),`summary separator`);let s=new Map,c=new Map,l=new Map;for(let e of a.slice(2).filter(e=>e.trim())){X(/^\|.*\|$/u.test(e)&&Y(e).length===5,`summary row`);let[t,n,r,i]=Y(e),a=/^(.+-)\d+$/u.exec(n)?.[1];X(/^\d+$/u.test(t)&&a&&r&&Object.hasOwn(An,i)&&!l.has(n),`summary values for ${n}`);let o=s.get(r)??{directories:[],rows:[]},c={raw:e,id:n,prefix:a,product:r,priority:i,group:o};l.set(n,c),o.rows.push(c),s.set(r,o)}X(l.size,`empty summary`);for(let[e,r]of n.entries()){let i=/^\d+\.\s+(\S+)\s*$/u.exec(r[1])?.[1],a=l.get(i);X(a&&!a.finding,`finding section ${r[1]}`);let s=t.slice(r.index,n[e+1]?.index),u=s.slice(r[0].length+1),d=new Map,f=[...u.matchAll(kn)];for(let[e,t]of f.entries()){let n=t[1],r=n.toLowerCase().replace(/^steps to reproduce\b.*$/u,`steps to reproduce`);X(!d.has(r),`duplicate section ${n}`),d.set(r,{heading:n,body:u.slice(t.index+t[0].length,f[e+1]?.index).trim()})}X(On.every(e=>d.has(e)),`missing required headers for ${i}`),X(!u.slice(0,f[0].index).trim(),`text before field headers for ${i}`);let p=d.get(`title`)?.body;X(p,`missing Title for ${i}`);let m={sourceId:i,_idBasis:{source:En,row:a.raw.trim(),section:s.trim()},product:a.product,priority:a.priority,severity:An[a.priority],file:`unknown`,line:`?`};o.has(`vulnerability`)&&(m.security=!0);let h=[p];for(let[e,t]of d)e===`title`||e===`code references`||(e===`steps to reproduce`?m.reproduction=t.body:e===`patch`?m.recommendation=t.body:h.push(e===`description`?t.body:`**${t.heading}:**
55
+ ${t.body}`));m.description=h.join(`
56
+
57
+ `),Mn(a,m,d.get(`code references`).body,c),a.finding=m}return X([...l.values()].every(e=>e.finding),`missing finding sections`),[...s].map(([e,t])=>({displayName:e,data:{type:`security`,source:En,product:e,repo:{github:t.github,directory:Nn(t.directories)},findings:t.rows.map(({finding:e})=>({...e,repo:{github:t.github}}))}}))}function Fn(e){let t=Pn(e);return t===null?null:t.length===1?t[0].data:{type:`security`,source:En,findings:t.flatMap(({data:e})=>e.findings)}}var In=new Set([`critical`,`high`,`medium`,`low`,`high_bug`,`bug`,`informational`]);function Ln(e){let t=Rn(e);if(!t)return null;let{severity:n,description:r,location:i,file:a,line:o}=t;return i?{severity:n,description:r,location:i}:{severity:n,description:r,file:a,line:o}}function Rn(e){let t=e.indexOf(`
58
+ `),n=(t===-1?e:e.slice(0,t)).trim();if(!n)return null;let{sectionsText:r,metaText:i}=zn(t===-1?``:e.slice(t+1)),a=Bn(r),o=Vn(i),{file:s,line:c,locationLink:l}=Hn(a.location||``),u=(o.severity||``).toLowerCase();return{severity:In.has(u)?u:`medium`,description:Un(n,a),location:l,file:s||`unknown`,line:c}}function zn(e){let t=/^---\s*$/mu,n=t.exec(e);if(!n)return{sectionsText:e,metaText:``};let r=e.slice(0,n.index).trim(),i=e.slice(n.index+n[0].length).replace(/^\n/u,``),a=t.exec(i);return{sectionsText:r,metaText:a?i.slice(0,a.index):i}}function Bn(e){let t={},n=e.split(/^## /mu);for(let e=1;e<n.length;e++){let r=n[e],i=r.indexOf(`
59
+ `),a=(i===-1?r:r.slice(0,i)).trim().toLowerCase(),o=(i===-1?``:r.slice(i+1)).trim();a&&(t[a]=o)}return t}function Vn(e){let t={};for(let n of e.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))t[n[1].trim().toLowerCase()]=n[2].trim();return t}function Hn(e){let t=``,n=`?`,r=``,i=e.match(/\[([^\]]+)\]\(([^)]+)\)/u);if(i){t=i[1].trim(),r=i[2];let e=i[2].match(/#L(\d+)/u);e&&(n=e[1])}else t=e.trim(),r=e.trim();let a=t.match(/^(.+):(\d+)$/u);return a&&(t=a[1],n===`?`&&(n=a[2])),{file:t,line:n,locationLink:r}}function Un(e,t){let n=[e];return t.details&&n.push(t.details),t.impact&&n.push(`Impact: ${t.impact}`),t[`reproduction steps`]&&n.push(`Reproduction: ${t[`reproduction steps`]}`),Wn(n.join(`
60
+
61
+ `))}function Wn(e){return e.replaceAll(`**`,``)}var Gn=new Set([...j,`informative`]);function Kn(e){let t=C(e).trim();if(!t.startsWith(`# `))return null;let n=de(t,/^# /gmu).slice(1).filter(e=>e.trim().length>0).map(e=>qn(e)).filter(Boolean);return n.length===0?null:{type:`security`,source:`claude-security`,findings:n}}function qn(e){let{title:t,body:n}=O(e);if(!t)return null;let{sectionsText:r,metaText:i}=Jn(n),a=Yn(r),o=Object.fromEntries([...i.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu)].map(e=>[e[1].trim().toLowerCase(),e[2].trim()])),s=nr(a.evidence||``),{file:l,line:u,locationLink:d}=Xn(a.location||s[0]?.ref||``),f=(o.severity||``).toLowerCase(),p=Gn.has(f)?f:`medium`,m=ir(t,a,s.length>0),h={file:l||`unknown`,line:u,severity:p,description:m};d&&(h.location=d),s.length>0&&(h.evidence=s.map(rr)),a[`reproduction steps`]&&(h.reproduction=Zn(a[`reproduction steps`])),a[`recommended fix`]&&(h.recommendation=a[`recommended fix`]),o.repository&&(h.repo={github:o.repository}),o.branch&&(h.branch=o.branch),o[`date created`]&&(h.dateCreated=o[`date created`]),o.status&&(h.status=o.status),o.category&&(h.category=o.category);let g=e.indexOf(`
62
+ # `),_=Ln(g===-1?e:e.slice(0,g+1));return _&&(h._idBasis=_),c(h)}function Jn(e){let t=/^---\s*$/mu,n=t.exec(e);if(!n)return{sectionsText:e,metaText:``};let r=e.slice(0,n.index).trim(),i=e.slice(n.index+n[0].length).replace(/^\n/u,``),a=t.exec(i);return{sectionsText:r,metaText:a?i.slice(0,a.index):i}}function Yn(e){let t=e.split(/^## /mu).slice(1).map(e=>O(e));return Object.fromEntries(t.filter(e=>e.title).map(e=>[e.title.toLowerCase(),e.body.trim()]))}function Xn(e){let t=``,n=`?`,r=``,i=k(e);if(i){t=i.label.trim(),r=i.url.trim();let e=r.match(/#L(\d+)(?:-L?(\d+))?/u);e&&(n=e[2]?`${e[1]}-${e[2]}`:e[1])}else t=e.trim(),r=e.trim();t=we(t.replaceAll("`",``)).trim();let a=t.match(/^(.+):(\d+)(?:\s*[-\u2013\u2014]\s*L?(\d+))?$/u);return a&&(t=a[1],n===`?`&&(n=a[3]?`${a[2]}-${a[3]}`:a[2])),{file:t,line:n,locationLink:r,linked:i!==null}}function Zn(e){let t=e.split(`
63
+ `),n=t.findIndex(e=>e.trim());if(n===-1||!v.test(t[n])||t.some((e,t)=>t!==n&&v.test(e)))return e;let r=t[n].replace(/^ */u,``),i=r.replace(v,``);if(!i.trim())return e;let a=er(i)??er(r);if(a===null&&(v.test(i)||$n.test(r)))return e;let o=a===null?[i]:a.length===1?[a[0].step]:a.map(({number:e,step:t})=>`${e}. ${t}`);return t.splice(n,1,...o),t.join(`
64
+ `)}var Qn=/(?:^|[ \t])(\d{1,9})\)(?=[ \t]|$)/gu,$n=/^\d{1,9}\)(?=[ \t]|$)/u;function er(e){let t=[...e.matchAll(Qn)];if(t.length===0||t[0].index!==0)return null;let n=[];for(let[r,i]of t.entries()){let a=Number(i[1]);if(r>0&&a<=n[r-1].number)return null;let o=e.slice(i.index+i[0].length,t[r+1]?.index).trim();if(!o)return null;n.push({number:a,step:o})}return n}var tr=/^[ \t]*(?:\d+[.)]|[-*+])\s+/u;function nr(e){let t=[];for(let n of e.split(`
65
+ `))tr.test(n)?t.push({ref:n.replace(tr,``).trim(),note:[]}):t.length>0&&n.trim()&&t.at(-1).note.push(n.trim());if(t.length===0){let n=e.split(`
66
+ `).map(e=>e.trim()).filter(Boolean),r=n.findIndex(e=>k(e)!==null);if(r===-1&&n.length!==1)return[];let i=r===-1?0:r;t.push({ref:n[i],note:n.filter((e,t)=>t!==i)})}return t.filter(e=>e.ref)}function rr({ref:e,note:t}){let{file:n,line:r,locationLink:i,linked:a}=Xn(e),o={file:n||`unknown`,line:r};i&&a&&(o.url=i);let s=t.join(`
67
+ `);return s&&(o.text=s),o}function ir(e,t,n){let r=[e];return t.details&&r.push(t.details),t.evidence&&!n&&r.push(`**Evidence:**
68
+ ${t.evidence}`),t.impact&&r.push(`**Impact:** ${t.impact}`),r.join(`
69
+
70
+ `)}function ar(e){let t=(e||``).trim(),n=``,r=/\[([^\]]+)\]\(([^)]+)\)/u.exec(t);r&&(t=r[1].trim(),n=r[2].trim());let i=``,a=/#L(\d+)/u.exec(n);a&&(i=a[1]);let o=[...t.matchAll(/`([^`]+)`/gu)].map(e=>e[1].trim()).find(e=>!e.includes(`(`)&&(e.includes(`/`)||/\.\w/u.test(e)))??(t.replaceAll("`",``).trim().split(/[\s,]+/u).find(Boolean)||``),s=/^(.*?)#L(\d+)(?:-L?\d+)?$/u.exec(o);s&&(o=s[1],i||=s[2]);let c=/^(.+):(\d+(?:-\d+)?)$/u.exec(o);return c?(i||=c[2],{file:c[1],line:i,locationLink:n}):{file:o,line:i||`?`,locationLink:n}}function or({severity:e,description:t,ref:n,lineBullet:r=``,id:i=``}){let a=ar(n),o=a.file||`unknown`,s=a.line===`?`&&r?r:a.line,c=a.locationLink||(o===`unknown`&&i?`piolium:${i}`:``);return c?{severity:e,description:t,location:c}:{severity:e,description:t,file:o,line:s}}function Z(e){let t=((e||``).trim().split(/\s+/u)[0]||``).replaceAll(/[`*]+/gu,``);return o.get(t.toUpperCase())??``}function sr(...e){return{severity:e.find(Boolean)||`medium`,identitySeverity:e.find(e=>e&&e!==`informative`)||`medium`}}function cr(e){let t=/^([CHML])-?\d+$/iu.exec((e||``).trim());return t?{C:`critical`,H:`high`,M:`medium`,L:`low`}[t[1].toUpperCase()]:``}function lr(e){return Z(/^(critical|high|medium|low|informational|informative|info)(?:[ -](?:severity|risk))?(?:[ -]findings?)?(?:\s*\(\d+\))?$/iu.exec((e||``).trim())?.[1])}function ur(e){return Z(/^(critical|high|medium|low|informational|informative|info)\b/iu.exec((e||``).trim())?.[1])}function dr(e){return/^variants?\s*(?:\(\d+\))?\s*:?$/iu.test((e||``).trim())}function fr(e){let t=/^([CHML]-?\d{1,4}|(?:p|q|b|r|m|l|x|diff)\d{0,4}-\d{2,4})(?:-([A-Za-z0-9][\w-]*))?$/iu.exec(e||``);return t?{id:t[1].toUpperCase(),slug:t[2]||``}:null}function pr(e){return(e||``).replaceAll(`-`,` `)}function mr(e){let t=(e||``).trim(),n=/^\[([^\]]+)\]\([^)]*\)$/u.exec(t);return Te(n?n[1]:t).toUpperCase()}function hr(e){let t=/^\[([^\]]+)\]\(([^)]+)\)\s*[:\u2014\u2013-]*\s*(.*)$/u.exec(e);return t?{text:t[3]?`${t[1].trim()} ${t[3].trim()}`:t[1].trim(),link:t[2].trim()}:null}function gr(e){let t=e.search(/\s/u),n=fr((t===-1?e:e.slice(0,t)).replace(/[:.,\u2014\u2013-]+$/u,``));if(!n)return null;let r=(t===-1?``:e.slice(t+1)).replace(/^[:\u2014\u2013-]+\s*/u,``).trim();return{id:n.id,slug:n.slug,rest:r}}function _r(e){let{text:t,link:n}=hr(e)??{text:e,link:``},r=/^\[([^\]]+)\] *(.*)$/u.exec(t);if(r){let e=fr(r[1].trim());return e?{id:e.id,title:r[2].trim()||pr(e.slug)||e.id,link:n}:{id:r[1].trim().toUpperCase(),title:r[2].trim(),link:n}}let i=gr(t);return i?{id:i.id,title:i.rest||pr(i.slug)||i.id,link:n}:{id:``,title:t.trim(),link:n}}function vr(e){let t={},n=t=>{let n=t.exec(e||``)?.[1];return n===void 0?``:(/`([^`]+)`/u.exec(n)?.[1]??n.split(/\s+/u)[0]??``).trim()},r=n(/^\s*(?:[-*] +)?\*\*Target:?\*\*\s*(.*)$/imu);at(r)&&(t.repo=r);let i=n(/^\s*(?:[-*] +)?\*\*Commit[^:*]*:?\*\*\s*(.*)$/imu);return T(i)&&(t.commitHash=i),t}var yr=[`key code reference`,`key code`,`code reference`,`location`,`affected file`,`file`,`path`];function br(e){return{id:mr(e.id||``),title:A(e.title),severity:A(e.severity),pocStatus:A(e[`poc status`]||e.poc),status:A(e.status),parent:mr(A(e.parent||``)),location:A(e.location)}}function xr(e,t=``){let{severity:n,identitySeverity:r}=sr(Z(e.severity),t,cr(e.id)),i=Sr({ref:e.location||``,id:e.id,severity:n,identitySeverity:r,description:he(e.title||e.id)});for(let t of[`pocStatus`,`status`,`parent`])e[t]&&(i[t]=e[t]);return c(i)}function Sr({ref:e,lineBullet:t=``,id:n,severity:r,identitySeverity:i,description:a}){let{file:o,line:s,locationLink:c}=me(e),l={file:o||`unknown`,line:s===`?`&&t?t:s,severity:r,description:a};return c?l.location=c:l.file===`unknown`&&n&&(l.location=`piolium:${n}`),l._idBasis=or({severity:i,description:a,ref:e,lineBullet:t,id:n}),l}function Cr(e,t,n){let r=[];for(let i of e.split(`
71
+ `)){let e=/^\s{0,3}(?:[-*+]|\d{1,3}[.)])\s+(.+)$/u.exec(i);if(!e)continue;let a=e[1].trim();if(/^\*\*[^:*]+:\*\*/u.test(a))continue;let o=hr(a),s=o?.link??``;if(o)a=o.text;else{let e=/^\*\*([^*]+)\*\*\s*[:\u2014\u2013-]*\s*(.*)$/u.exec(a);e&&(a=e[2]?`${e[1].trim()} ${e[2].trim()}`:e[1].trim())}if(/^(?:none\b|no |n\/a\b)/iu.test(a))continue;let l=gr(a),u=l?.id??``,d=a;if(l){let e=pr(l.slug);d=e&&l.rest?`${e}
72
+
73
+ ${l.rest}`:l.rest||e||l.id}let f=n.get(u),{severity:p,identitySeverity:m}=sr(Z(f?.severity),t,cr(u)),h={file:`unknown`,line:`?`,severity:p,description:he(d)};u?h.location=`piolium:${u}`:s&&(h.location=s),s.endsWith(`report.md`)&&(h.reportPath=s);for(let e of[`pocStatus`,`status`,`parent`])f?.[e]&&(h[e]=f[e]);r.push({id:u,finding:c(h,m)})}return r}function wr(e,t,n,r=``){let i=[];for(let a of fe(e)){let e=br(a);!e.id&&!e.title||(!e.parent&&n&&(e.parent=n),e.id&&!t.has(e.id)&&t.set(e.id,e),i.push({id:e.id,finding:xr(e,r)}))}if(i.length>0)return i;let a=Cr(e,r,t);for(let e of a)n&&!e.finding.parent&&(e.finding.parent=n);return a}var Tr=new Set([`technical findings detail`,`technical findings`,`detailed findings`,`findings detail`,`findings`]),Er=/^(?:summary of findings\b|deferred|methodolog|executive|conclusion|attack surface|coverage|discoveries|scope\b|table of contents|contents\b|appendix|recommendation|remediation)/u;function Dr(e){let{id:t}=_r(e);return!!(t&&fr(t))}function Or(e){let t=D(e,se);return(t.length>0?t:D(e,w)).some(({heading:e})=>Dr(e))}function kr(e){let t=C(e).trim();if(!/^# +Security Audit Report\b/mu.test(t)&&!/^## +Technical Findings Detail\s*$/imu.test(t)&&!/^## +Findings by Severity\b/imu.test(t))return null;let{head:n,subs:r}=E(t,oe),i=Ir(r),a=new Map(fe(i[`summary of findings`]||``).map(br).filter(e=>e.id).map(e=>[e.id,e])),o=vr(n),s=[],c=new Set,l=[],u=({id:e,finding:t})=>{s.push(t),e&&c.add(e)},d=e=>{for(let t of e)u(t)};for(let[e,t]of Object.entries(i)){let n=lr(e);n||Tr.has(e)||e.startsWith(`findings by severity`)?d(Pr(t,n,a,l)):!Er.test(e)&&Or(t)&&d(Pr(t,ur(e),a,l))}for(let e of l)e.id&&c.has(e.id)||u(e);for(let e of a.values())c.has(e.id)||u({id:e.id,finding:xr(e)});if(s.length===0)return null;for(let e of s)o.repo&&(e.repo={github:o.repo}),o.commitHash&&!e.auditedCommit&&(e.auditedCommit=o.commitHash);return{type:`security`,source:`piolium`,findings:s}}function Ar(e,t,n,r){let i=[],a=``;for(let{heading:o,body:s}of e){let e=lr(o);if(e)i.push(...Pr(s,e,t,n)),a=``;else if(dr(o))i.push(...Mr(s,t,a,n,r));else{let e=jr(o,s,t,n,r);i.push(...e),a=e[0]?.id||a}}return i}function jr(e,t,n,r,i){let{head:a,subs:o}=E(t,w),s=Fr(e,a,n,i),c=s!==null&&!s.id&&o.some(e=>!dr(e.heading)&&Dr(e.heading)),l=s&&!c?[s]:[];return l.push(...Nr(o,n,r,i,s?.id||``)),l}function Mr(e,t,n,r,i){let{head:a,subs:o}=E(e,w);return r.push(...wr(a,t,n,i)),Nr(o,t,r,i,``)}function Nr(e,t,n,r,i){let a=[],o=``;for(let{heading:s,body:c}of e){if(dr(s)){n.push(...wr(c,t,i??o,r));continue}let e=Fr(s,c,t,r);e&&(a.push(e),o=e.id||o)}return a}function Pr(e,t,n,r){let i=D(e,se);if(i.length>0)return Ar(i,n,r,t);let a=Nr(D(e,w),n,r,t,null);if(a.length>0)return a;let o=fe(e).map(br).filter(e=>e.id||e.title);for(let e of o)!e.severity&&t&&(e.severity=t),e.id&&!n.has(e.id)?n.set(e.id,e):e.id||r.push({id:``,finding:xr(e,t)});return o.length===0&&r.push(...Cr(e,t,n)),[]}function Fr(e,t,n,r=``){let i=e.trim();if(!i)return null;let{id:a,title:o,link:s}=_r(i),l=n.get(a);if(!a&&o){let e=o.toLowerCase();l=[...n.values()].find(t=>t.title.toLowerCase()===e),a=l?.id??``}let{fields:u,labels:d,prose:f}=pe(t),{severity:p,identitySeverity:m}=sr(Z(u.severity),Z(l?.severity),r,cr(a)),h=/\d+/u.exec(u.line||u.lines||``)?.[0]??``,g=/\*\*Variant of:?\*\*\s*\[?([^\]\s)]+)/iu.exec(t),_=f.split(`
74
+ `).filter(e=>!/^\s*<a\s[^>]*>\s*<\/a>\s*$/iu.test(e)&&!/\*\*Variant of:?\*\*/iu.test(e)).join(`
75
+ `).trim(),v=Sr({ref:yr.map(e=>u[e]).find(Boolean)??``,lineBullet:h,id:a,severity:p,identitySeverity:m,description:Rr(o||a,u,d,_)}),ee=u[`poc status`]||u.poc||l?.pocStatus;ee&&(v.pocStatus=ee);let y=u[`detailed report`]||(s.endsWith(`report.md`)?s:``);y&&(v.reportPath=y),l?.status&&(v.status=l.status);let te=l?.parent||(g?mr(g[1]):``);return te&&(v.parent=te),{id:a,finding:c(v)}}function Ir(e){let t=Object.create(null);for(let{heading:n,body:r}of e){let e=n.trim().toLowerCase();e&&(t[e]=e in t?`${t[e]}
76
+ ${r}`:r)}return t}var Lr=new Set([...yr,`severity`,`summary`,`files`,`poc`,`poc status`,`line`,`lines`,`detailed report`,`proof of concept`,`evidence`,`variant of`,`pattern`,`status`,`id`,`title`]);function Rr(e,t,n,r){let i=[e];t.summary&&i.push(t.summary),r&&i.push(r);for(let[e,r]of Object.entries(t))!r||Lr.has(e)||i.push(`**${n[e]||e}:** ${r}`);return i.filter(Boolean).join(`
77
+
78
+ `)}var zr=`<!-- DeepView findings export -->`,Br={annotation:()=>null,location:e=>typeof e?.location==`string`?e.location:null,evidence:e=>typeof e?.url==`string`?e.url:null,commit:()=>null,report:()=>null};function Vr(e,t){let n=e=>typeof e?.source==`string`&&e.source?e.source:null;if(e.length===1)return t=>n(t)??e[0].source??null;let r=new Map(e.map(e=>[e.name,e.source??null]));return e=>n(e)??r.get(t.report(e))??null}function Hr(e,t,n){let r=e.view?.revalidation!==!1,i=(Array.isArray(e.reports)?e.reports:[]).filter(e=>e&&typeof e==`object`),a=Vr(i,t),o=e=>Tt(e,a(e),r),s=new Set(n.map(o)),c=new Set(n.map(e=>t.report(e)).filter(Boolean));return{hooks:t,analyzerOf:o,severityMode:e.view?.severityMode===`original`?`original`:`corrected`,revalidation:r,showAnalyzer:s.size>1,showReport:c.size>1||i.length>1,repo:typeof e.repo==`string`&&e.repo?e.repo:null}}function Ur(e){if(!e)return``;let t=[e.bucket?`${e.bucket} findings`:`Live findings`];return e.severityMode===`original`?t.push(`original analyzer severities`):e.severityMode===`corrected`&&t.push(`corrected severities`),e.revalidation===!1?t.push(`code view — the revalidation pass is not applied`):e.revalidation===!0&&(e.revalidationDetail===!0?t.push(`detailed app view — the revalidation pass is applied, with the rows it re-rated`):e.revalidationDetail===!1?t.push(`app view — the revalidation pass is applied, standing in for the rows it re-rated`):t.push(`app view — the revalidation pass is applied`)),t.join(` · `)}function Wr(e){if(!e)return``;let t=Number(e.included)||0,n=Number(e.total)||0;return n===0?`no findings`:t>=n?`all ${V(n,`finding`)}`:`${t} of ${V(n,`finding`)} (${n-t} filtered out)`}function Gr(e,t,n){let r=[],i=(e,t)=>{t&&r.push(`- **${e}:** ${t}`)},a=Array.isArray(e.reports)?e.reports:[],o=[...new Set(a.map(e=>f[e?.source]??``).filter(Boolean))];i(`Source`,o.join(`, `));let s=a.map(e=>e?.name).filter(Boolean);i(s.length===1?`Report`:`Reports`,s.map(e=>R(e)).join(`, `)),i(`Workspace`,typeof e.workspace==`string`?e.workspace.trim():``),t.repo&&i(`Repository`,wt(t.repo));let c=[...new Set(n.map(t.analyzerOf).filter(Boolean))],l=c.length===o.length&&c.every(e=>o.includes(e));return c.length>0&&!l&&i(c.length===1?`Analyzer`:`Analyzers`,c.join(`; `)),e.generatedAt&&i(`Exported`,Xe(e.generatedAt)),i(`View`,Ur(e.view)),Array.isArray(e.filters)&&i(`Filters`,e.filters.length>0?e.filters.map(e=>`${e.label}: ${e.value}`).join(` · `):`none`),i(`Included`,Wr(e.counts)),r.join(`
79
+ `)}function Kr(e,t){let n=Map.groupBy(e,e=>Ae(e[0],t.severityMode)??`informational`),r=[...j,...[...n.keys()].filter(e=>!j.includes(e))],i=new Set,a=[];for(let e of r)for(let t of n.get(e)??[]){let n=a.length+1,r=Ct(t[0]),o=`${n}. ${r}`;a.push({group:t,number:n,severity:e,title:r,headingText:o,slug:Je(o,i)})}return a}function qr(e){let t=new Map;for(let n of e)t.set(n.severity,(t.get(n.severity)??0)+1);return t}var Jr=[[`flagged`,e=>e.flagged===!0],[`colour-marked`,e=>e.color],[`commented`,e=>e.comment],[`with a fix link`,e=>e.fix]];function Yr(e,t){let n=e.flatMap(({group:e})=>e.map(e=>t.hooks.annotation(e))).filter(Boolean),r=Jr.map(([e,t])=>[n.filter(t).length,e]).filter(([e])=>e>0).map(([e,t])=>`${e} ${t}`);return r.length>0?`Annotations: ${r.join(`, `)}.`:``}function Xr(e){let t=e.some(({group:e})=>e.some(e=>e.confidence!==void 0&&e.confidence!==null)),n=[`#`,`Severity`,`Finding`,`Location`];return t&&n.push(`Confidence`),Ye(n,e.map(e=>{let n=e.group[0],r=e.group.length>1?` (${V(e.group.length,`case`)})`:``,i=I(n),a=[String(e.number),p(e.severity),z(Ge(Ke(e.title)),`#${e.slug}`)+r,i?Ge(R(i)):``];return t&&a.push(n.confidence===void 0||n.confidence===null?``:`${n.confidence}/10`),a}),[`right`])}function Zr(e,t){let n=[B(2,`Summary`)];if(e.length===0)return[...n,`No findings are included.`];let r=[...qr(e)].map(([e,t])=>[p(e),String(t)]);r.push([`**Total**`,`**${e.length}**`]),n.push(Ye([`Severity`,`Findings`],r,[`left`,`right`]));let i=Yr(e,t);return i&&n.push(i),n.push(Xr(e)),n}function Qr(e,t){let n=qr(e),r=[],i=null;for(let a of e)a.severity!==i&&(i=a.severity,r.push(B(2,`${p(i)} (${n.get(i)})`))),r.push(Rt(a.group,t,{headingText:a.headingText,depth:3}));return r}function $r(e={},t={}){let n=Object.fromEntries(Object.entries(Br).map(([e,n])=>[e,typeof t?.[e]==`function`?t[e]:n])),r=(Array.isArray(e.groups)?e.groups:[]).map(e=>Array.isArray(e)?e:[e]).map(e=>e.filter(e=>e&&typeof e==`object`)).filter(e=>e.length>0),i=r.flat(),a=Hr(e,n,i),o=Kr(r,a);return`${Ze([zr,B(1,typeof e.title==`string`&&e.title.trim()?e.title.trim():`Findings`),Gr(e,a,i),...Zr(o,a),...Qr(o,a)])}
80
+ `}var ei=[[`deepview-md`,yn],[`markdown-generic`,Fn],[`deepsec`,xt],[`piolium`,kr],[`claude-security`,Kn]];function Q(e){return Array.isArray(e?.findings)?e.findings:Array.isArray(e?.groups)?e.groups:null}function ti(e,t){return typeof t==`string`&&/\.csv$/iu.test(t)?`codex`:$(e).format}function $(e){let t;try{let t=JSON.parse(e);if(Q(t)){for(let e of ri(Q(t)))c(e);return{data:t,format:`json`,reason:null}}return{data:null,format:null,reason:`JSON, but not a report: no findings array`}}catch(e){t=e}for(let[t,n]of ei)try{let r=n(e);if(r)return{data:r,format:t,reason:null}}catch(e){if(t!==`markdown-generic`)throw e;return{data:null,format:t,reason:e.message}}return{data:null,format:null,reason:`Not JSON, and not a recognized markdown format. (JSON error: ${t.message})`}}function ni(e){let{data:t}=$(e);return t?{count:Q(t).length,source:t.source,recognized:!0}:{count:0,recognized:!1}}function ri(e){return e.flat().filter(e=>e&&typeof e==`object`)}async function ii(e){for(let t of e)c(t);let t=e.filter(e=>!e.id);if(t.length===0)return;let n=await Promise.all(t.map(i));t.forEach((e,t)=>{n[t]&&(e.id=n[t])})}async function ai(e){let{data:t,format:n}=$(e);if(!t)return null;let r=ri(Q(t));return await ii(r),{format:n,data:t,findings:r}}export{n as a,x as b,S as c,we as d,l as e,u as f,d as g,f as h,Ee as i,j,Oe as k,ke as l,Ae as m,je as n,Me as o,M as p,Pe as q,Ie as r,Le as s,N as t,Re as u,F as v,Be as w,Ve as x,Ue as y,I as z,We as A,L as B,nt as C,ot as D,st as E,Pn as F,dt as G,mt as H,$r as I,Q as J,ti as K,$ as L,ni as M,ii as N,ai as O};
@@ -0,0 +1 @@
1
+ var e={view:`.bundle-code-view`,pane:`.bundle-code-rail`,property:`--bundle-code-rail-width`,axis:`x`,grow:1,keys:{ArrowLeft:-16,ArrowRight:16},initial:()=>320,bounds:e=>({min:Math.min(180,e*.4),max:e*.6}),preferred:null},t={view:`.bundle-code-main`,pane:`.bundle-code-terminal`,property:`--bundle-code-terminal-height`,axis:`y`,grow:-1,keys:{ArrowUp:16,ArrowDown:-16},initial:e=>e*.4,bounds:e=>({min:Math.min(96,e*.4),max:e*.85}),preferred:null},n=class extends HTMLElement{static split=e;constructor(){super(),this._split=this.constructor.split,this._drag=null,this.addEventListener(`pointerdown`,e=>this._startDrag(e)),this.addEventListener(`pointermove`,e=>{this._drag?.id===e.pointerId&&(this._split.preferred=this._apply(this._drag.size+this._split.grow*(this._client(e)-this._drag.at)))});for(let e of[`pointerup`,`pointercancel`,`lostpointercapture`])this.addEventListener(e,e=>{this._drag?.id===e.pointerId&&this._endDrag()});this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.addEventListener(`dblclick`,()=>{this._split.preferred=null,this._apply(this._preferred())})}connectedCallback(){this._view=this.closest(this._split.view),this._view&&(this._observer=new ResizeObserver(()=>this._apply(this._preferred())),this._observer.observe(this._view),this._apply(this._preferred()))}disconnectedCallback(){this._observer?.disconnect(),this._endDrag(),this._view=null}_client(e){return this._split.axis===`x`?e.clientX:e.clientY}_measure(e){let t=e.getBoundingClientRect();return this._split.axis===`x`?t.width:t.height}_preferred(){return this._split.preferred??this._split.initial(this._view?this._measure(this._view):0)}_bounds(){return this._split.bounds(this._measure(this._view))}_apply(e){if(!this._view)return e;let{min:t,max:n}=this._bounds();if(n===0)return e;let r=Math.max(t,Math.min(n,e));return this._view.style.setProperty(this._split.property,`${r}px`),this.setAttribute(`aria-valuemin`,String(Math.round(t))),this.setAttribute(`aria-valuemax`,String(Math.round(n))),this.setAttribute(`aria-valuenow`,String(Math.round(r))),this.setAttribute(`aria-valuetext`,`${Math.round(r)} pixels`),r}_paneSize(){return this._measure(this._view.querySelector(this._split.pane))}_startDrag(e){e.button!==0||!e.isPrimary||this._drag||!this._view||(e.preventDefault(),this._drag={id:e.pointerId,at:this._client(e),size:this._paneSize(),view:this.closest(`.bundle-code-view`)},this.setPointerCapture(e.pointerId),this.classList.add(`dragging`),this._drag.view?.classList.add(`splitting`))}_endDrag(){if(!this._drag)return;let{id:e,view:t}=this._drag;this._drag=null,this.classList.remove(`dragging`),t?.classList.remove(`splitting`),this.hasPointerCapture(e)&&this.releasePointerCapture(e)}_onKeyDown(e){if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||!this._view)return;let{min:t,max:n}=this._bounds(),r=this._split.keys[e.key],i=r===void 0?{Home:t,End:n}[e.key]:this._paneSize()+r;i!==void 0&&(e.preventDefault(),e.stopPropagation(),this._split.preferred=this._apply(i))}};customElements.define(`bundle-code-splitter`,n),customElements.define(`bundle-code-terminal-splitter`,class extends n{static split=t});
@@ -0,0 +1,2 @@
1
+ var e=`.detail-action{width:22px;height:22px;display:grid;place-items:center;padding:0;background:transparent;border:0;border-radius:var(--ui-radius, 4px);color:var(--muted);font:500 16px/1 ui-monospace,monospace;cursor:default;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}
2
+ `;export{e as a};
@@ -0,0 +1 @@
1
+ import{a as e,b as t,c as n,d as r}from"./chunk-K4XJHM2T.js";import{a as i,b as a,c as o,d as s,e as c,f as l,g as u,j as d,l as f,m as p,n as m,p as h}from"./chunk-GX5UXWT4.js";import{A as ee,B as te,H as ne,I as g,M as _,c as re,k as v,l as y,m as b,t as ie,u as ae}from"./chunk-LVW7WWV4.js";import"./chunk-ZQHLECTI.js";import{a as oe,e as x,g as S}from"./chunk-VYYUMYVW.js";import{d as C,e as w,f as se,h as T,i as E}from"./chunk-7HP2VYIC.js";import"./chunk-PXK7EU4V.js";import"./chunk-OOJM4CTU.js";var D=d(e=>/^[A-Z_a-z][\w-]*$/u.test(e),`a package name`),O=d(e=>t(e)!==void 0,`a version`),ce=d(e=>/^\w[\w+.-]*$/u.test(e),`a feature name`),le=[`branch`,`tag`,`rev`];function k(e){let t=e.hostname===`github.com`,n=new URL(t?`https:${e.href.slice(e.protocol.length)}`:e.href),r=n.pathname.replace(/\/$/u,``);return n.pathname=(t?r.toLowerCase():r).replace(/\.git$/u,``),n.href}var ue=e=>e.href.startsWith(`/`,e.protocol.length);function de(e){let t=URL.parse(e);return t!==null&&t.href===e&&ue(t)?t:void 0}var A=(e,t,n=[])=>JSON.stringify([e,k(t),...n]);function j(e,t,n){let r=n=>w(`${T(e)} is not a source: ${n}`,t),[,i,a]=/^(registry|sparse|git)\+(.*)$/su.exec(e)??r(`expected registry+, sparse+ or git+ and a URL`);if(i!==`git`){i===`registry`&&_(a,t);let n=de(i===`sparse`?e:a);return(n===void 0||n.search!==``||n.hash!==``)&&r(`expected a URL in normal form, without a query or a fragment`),{scheme:i,identity:A(i,n)}}let[,o,s,c]=/^([^#?]*)(?:\?([^#]*))?(?:#(.*))?$/su.exec(a);(n?c!==void 0:!ne(c??``))&&r(n?`a dependency names no commit`:`expected "#" and the commit it resolved to`),_(o,t);let l=de(o)??r(`expected a URL in normal form`),u=[...new URLSearchParams(s??``)];return(u.length>1||u.length===1&&!le.includes(u[0][0]))&&r(`expected at most one of branch=, tag= or rev=`),{scheme:i,identity:A(i,l,u[0])}}var M=new URL(`https://github.com/rust-lang/crates.io-index`),fe=e=>e.registry===void 0||e.registry===`crates-io`,N=`any registry`;function P(e,t){if(e.type===`path`)return t;if(e.type===`git`){let t=le.flatMap(t=>e[t]===void 0?[]:[t,e[t]]);return A(`git`,new URL(e.url),t)}return e.index===void 0?fe(e)?A(`registry`,M):N:A(e.index.startsWith(`sparse+`)?`sparse`:`registry`,new URL(e.index))}var pe=e=>e===`crates-io`?M:URL.parse(e);function F(e){let t=pe(e);return t===null?`registry ${e}`:k(t)}function me(e){return pe(e)?.href??`registry ${e}`}function I(e){if(e.type!==`path`)return e.type===`git`?k(new URL(e.url)):e.index===void 0?fe(e)?k(M):`registry ${e.registry}`:k(new URL(e.index))}var he=[`version`,`package`,`patch`],ge=[`name`,`version`,`source`,`checksum`,`dependencies`],_e=[`name`,`version`,`source`,`checksum`],ve={root:`a [root] table is lockfile version 1, which is not read here`,metadata:`a [metadata] table holds checksums in lockfile version 1 and nothing cargo writes after`},ye={replace:`[replace] is not supported`};function be(e,t){if(e===3||e===4)return e;throw e===void 0?new C("no `version`: this is lockfile version 1 or 2, which is not read here, where 3 and 4 are",t):e===5?new C(`lockfile version 5 is only read by a nightly cargo, with -Znext-lockfile-bump`,t):new C(`unsupported version: expected 3 or 4, found ${i(e)}`,t)}var L=(e,t,n)=>n===void 0?`${e} ${t}`:`${e} ${t} (${n})`;function xe(e,t,n=ge){o(e,t,n,ye);let r=D(e.name,E(t,`name`)),i=O(e.version,E(t,`version`)),a=b(e,`source`,t,l),s=a===void 0?void 0:j(a,E(t,`source`),!1),c=b(e,`checksum`,t,l);if(c!==void 0&&(s===void 0||s.scheme===`git`))throw new C(`a ${s===void 0?`path`:`git`} package has no checksum`,E(t,`checksum`));if(c!==void 0&&!g(c))throw new C(`${T(c)} is not a sha256 checksum`,E(t,`checksum`));if(c===void 0&&s!==void 0&&s.scheme!==`git`&&n===ge)throw new C(`expected a checksum, which cargo checks a registry's package with, and refuses the lockfile without`,t);let u=b(e,`dependencies`,t,p)??[];return{key:L(r,i,a),name:r,version:i,source:a,checksum:c,identity:s?.identity,edges:u}}function Se(e,t,n){let r=n=>w(`${T(e)} ${n}`,t),[,i,a,o]=/^([^ ]+)(?: ([^ ]+)(?: \((.+)\))?)?$/su.exec(e)??r("is not `name`, `name version` or `name version (source)`"),s=n.get(i)??r(`names no package in the lockfile`),c=a===void 0?[...new Set(s.map(e=>e.version))]:[a];c.length>1&&r(`could be any of ${c.length} versions`);let l=s.filter(e=>e.version===c[0]);if(l.length===0&&r(`names a version the lockfile does not hold`),o!==void 0){let e=j(o,t,!0).identity,n=l.filter(t=>t.identity===e);return n.length!==1&&r(`names a source the lockfile does not hold`),n[0]}let u=l.filter(e=>e.source===void 0);return u.length>0||l.length===1?u[0]??l[0]:r(`could be any of ${l.length} sources`)}function Ce(e,t){let n=new Set(e.filter(e=>e.source===void 0));for(let e of n)for(let t of e.resolved)n.add(t);let r=e.find(e=>!n.has(e));if(r!==void 0)throw new C(`nothing in the workspace depends on ${T(r.key)}, directly or not`,t)}function we(e){let t=o(S(e),void 0,he,ve),n=be(t.version,`version`),r=c(t.package??[],`package`).map((e,t)=>xe(e,`package[${t}]`));h(r,e=>`${e.name} ${e.version} ${e.identity}`,e=>e.key);let i=Map.groupBy(r,e=>e.name);for(let[e,t]of r.entries()){let n=E(`package[${e}]`,`dependencies`);t.resolved=t.edges.map((e,t)=>Se(e,`${n}[${t}]`,i));let r=ie(t.resolved);if(r!==void 0)throw new C(`${T(r.key)} is listed twice`,n)}Ce(r,`package`);let a=Object.create(null);for(let e of r)a[e.key]={...R(e),dependencies:e.resolved.map(e=>e.key)};return{version:n,packages:a,unusedPatches:Te(t.patch)}}function Te(e){return e===void 0?[]:(o(e,`patch`,[`unused`]),c(e.unused,`patch.unused`).map((e,t)=>R(xe(e,`patch.unused[${t}]`,_e))))}var R=({name:e,version:t,source:n,checksum:r})=>({name:e,version:t,source:n,checksum:r}),Ee=/[\\/]/u;function z(e,t){let n=t?e.indexOf(`\\`):e.search(Ee);return n===-1?[e,``]:[e.slice(0,n),e.slice(n+1)]}function De(e){let t=e.slice(0,8).replaceAll(`/`,`\\`);if(!t.startsWith(`\\\\`))return/^[A-Za-z]:/u.test(e)?{length:2,verbatim:!1}:void 0;if(t.startsWith(`?\\`,2)&&!e.slice(0,4).includes(`/`)){if(t.startsWith(`UNC\\`,4)){let[t,n]=z(e.slice(8),!0),[r]=z(n,!0);return{length:8+t.length+(r===``?0:1+r.length),verbatim:!0}}return/^[A-Za-z]:(?:[\\/]|$)/u.test(e.slice(4))?{length:6,verbatim:!0}:{length:4+z(e.slice(4),!0)[0].length,verbatim:!0}}if(t.startsWith(`.\\`,2))return{length:4+z(e.slice(4),!1)[0].length,verbatim:!1};let[n,r]=z(e.slice(2),!1),[i]=z(r,!1);return n!==``&&i!==``?{length:3+n.length+i.length,verbatim:!1}:void 0}function Oe(e,t){let n=t?De(e):void 0,r=n?.verbatim===!0,i=e.slice(n?.length??0).replace(t?/^[\\/]/u:/^\//u,``).split(r?`\\`:t?Ee:`/`).findLast(e=>e!==``&&(r||e!==`.`));return i===`..`||i===`.`?void 0:i}var ke=/ *(?:([(),=])|"([^"]*)"|(r#)?([A-Z_a-z]\w*)|(.|$))/gsuy,Ae=64,je=class extends Error{},B=()=>{throw new je};function Me(e){let t=[];for(let[,n,r,i,a,o]of e.matchAll(ke)){if(o===``)break;o!==void 0&&B(),t.push(a===void 0?{punct:n,string:r}:{ident:a,raw:i!==void 0})}return t}function Ne(e){let t=Me(e),n=0,r=()=>t[n],i=e=>{r()?.punct!==e&&B(),n++},a=()=>{let e=t[n++];if(e?.ident===void 0&&B(),r()?.punct!==`=`)return{name:e.ident,key:e.ident};n++;let i=t[n++]?.string;return i===void 0&&B(),{name:e.ident,value:i,key:`${e.ident}="${i}"`}},o=(e=0)=>{let t=r();if(t?.raw===!1&&[`all`,`any`,`not`].includes(t.ident)){e>=Ae&&B(),n++,i(`(`);let a=[];for(;r()?.punct!==`)`&&(a.push(o(e+1)),t.ident!==`not`&&r()?.punct===`,`);)n++;return t.ident===`not`&&a.length===0&&B(),i(`)`),{op:t.ident,list:a}}let{name:s,value:c,key:l}=a();return c===void 0&&(s===`true`||s===`false`)?{op:s,list:[]}:{op:`cfg`,name:s,key:l}};return{expr:o,cfg:a,done:()=>r()===void 0}}function Pe(e,t){try{let n=Ne(e),r=t(n);return n.done()?r:void 0}catch(e){if(e instanceof je)return;throw e}}function V(t){let n=/^cfg\((.*)\)$/su.exec(e(t))?.[1];return n===void 0?/^[\w.-]+$/u.test(t)?{name:t,expr:void 0}:void 0:Pe(n,e=>({name:void 0,expr:e.expr()}))}function Fe(t){return Pe(e(t),e=>e.cfg().key)}var Ie={__proto__:null,all:(e,t)=>Le(e.list,t,!1),any:(e,t)=>Le(e.list,t,!0),not:(e,t)=>{let n=H(e.list[0],t);return n===void 0?void 0:!n},true:()=>!0,false:()=>!1,cfg:(e,t)=>t(e)};function H(e,t){return Ie[e.op](e,t)}function Le(e,t,n){let r=!1;for(let i of e){let e=H(i,t);if(e===n)return n;e===void 0&&(r=!0)}return r?void 0:!n}function Re(e,t){if(e.expr===void 0)return t.name===void 0?void 0:e.name===t.name;let n=e=>t.decides===void 0||t.decides.has(e);return H(e.expr,e=>t.cfg.has(e.key)?!0:!n(e.name)&&void 0)}function ze(e){let t=/^[\\/]{2}([^\\/?.][^\\/]*)[\\/]+([^\\/]+)/u.exec(e);if(t!==null)return{prefix:`//${t[1]}/${t[2]}`.toLowerCase(),rest:`/${e.slice(t[0].length)}`};let n=/^([A-Za-z]):(?=[\\/])/u.exec(e);return n===null?/^(?:[\\/]{2}|[A-Za-z]:)/u.test(e)?void 0:{prefix:void 0,rest:e}:{prefix:n[1].toUpperCase(),rest:e.slice(2)}}function Be(e,t){let n=t?ze(e):{prefix:void 0,rest:e};if(n===void 0)return;let r=[],i=0;for(let e of n.rest.split(t?/[\\/]/u:`/`))e===`..`&&r.length>0?r.pop():e===`..`?i++:e!==``&&e!==`.`&&r.push(e);return{prefix:n.prefix,absolute:t?/^[\\/]/u.test(n.rest):n.rest.startsWith(`/`),up:i,parts:r}}function Ve(e,t){if(e.type!==`path`){let t=P(e,`path`);return{key:t===N?`${t} ${e.registry}`:t}}return{key:`path`,readings:[!1,!0].map(t=>Be(e.path,t)),inherited:t}}var U=(e,t)=>t.length<=e.length&&t.every((n,r)=>n===e[e.length-t.length+r]);function He(e,t,n){if(e.absolute&&t.absolute)return e.prefix!==void 0&&t.prefix!==void 0&&e.prefix!==t.prefix||e.parts.join(`/`)!==t.parts.join(`/`);if(e.absolute||t.absolute)return!U((e.absolute?e:t).parts,(e.absolute?t:e).parts);if(n)return!U(e.parts,t.parts)&&!U(t.parts,e.parts);let[r,i]=e.up>=t.up?[e,t]:[t,e],a=r.parts.length-i.parts.length;return a<0||a>r.up-i.up||!U(r.parts,i.parts)}function Ue(e,t){return e.key!==`path`||t.key!==`path`?e.key!==t.key:e.readings.every((n,r)=>{let i=t.readings[r];return n!==void 0&&i!==void 0&&He(n,i,e.inherited!==t.inherited)})}var W=`which only a nightly cargo reads, is not supported`;function G(e,t){let r=n(e);if(r===void 0)throw new C(`${T(e)} is not a version requirement`,t);return r}var We=[`version`,`registry`,`registry-index`,`path`,`git`,`branch`,`tag`,`rev`,`features`,`optional`,`default-features`,`default_features`,`package`,`public`],Ge={base:`a path base, ${W}`,artifact:`an artifact dependency, ${W}`,lib:`an artifact dependency, ${W}`,target:`an artifact dependency, ${W}`},Ke=[`workspace`,`features`,`default-features`,`default_features`,`optional`,`public`],qe=[[`dependencies`,`normal`],[`dev-dependencies`,`dev`],[`build-dependencies`,`build`]];function K(e,t,n,r){let i=n.replaceAll(`-`,`_`);if(i===n||e[i]===void 0)return e[n];let a=E(t??``,i);if(r===`2024`)throw new C(`not supported in the 2024 edition: use ${T(n)}`,a);if(e[n]!==void 0)throw new C(`given beside ${T(n)}`,a);return e[i]}function Je(e,t){let n=URL.parse(l(e,t));if(n===null)throw new C(`${T(e)} is not a URL`,t);if(!ue(n))throw new C(`${T(e)} is a URL with no path, which cargo refuses`,t);return n}function Ye(e,t,n){let r=b(e,`features`,t,p)??[];for(let[e,n]of r.entries()){let r=`${E(t,`features`)}[${e}]`;if(n.includes(`/`))throw new C(`${T(n)}: a dependency's feature cannot name another's`,r);if(n.startsWith(`dep:`))throw new C(`${T(n)}: a dependency's feature cannot be \`dep:\``,r)}return b(e,`public`,t,u),{features:r,defaultFeatures:y(u)(K(e,t,`default-features`,n),E(t,`default-features`))}}function q(e,t,n,r){if(typeof e==`string`)return G(e,t),{package:n,version:e,source:{type:`registry`,registry:void 0,index:void 0},optional:!1,defaultFeatures:!0,features:[]};o(e,t,We,Ge);let i=(n,r)=>b(e,n,t,r),a=i(`version`,l);a!==void 0&&G(a,E(t,`version`));let s=i(`registry`,D),c=i(`registry-index`,l);c!==void 0&&Je(c,E(t,`registry-index`));let d=i(`path`,l),f=i(`git`,l),p=[`branch`,`tag`,`rev`].filter(t=>e[t]!==void 0),m=[f!==void 0&&(s!==void 0||c!==void 0)&&"`git` or a registry",s!==void 0&&c!==void 0&&"`registry` or `registry-index`",f!==void 0&&d!==void 0&&"`git` or `path`",p.length>1&&"`branch`, `tag` or `rev`"].find(Boolean);if(m)throw new C(`ambiguous: only one of ${m} is taken`,t);if(f===void 0&&p.length>0)throw new C(`\`${p[0]}\` is only for a git dependency`,E(t,p[0]));if(a===void 0&&d===void 0&&f===void 0)throw new C(`names no version, path or git repository`,t);let h={type:`registry`,registry:s,index:c};if(d!==void 0&&(h={type:`path`,path:d}),f!==void 0){let e=Je(_(f,E(t,`git`)),E(t,`git`));if(e.search!==``||e.hash!==``)throw new C(`${T(f)} has a query or a fragment, which cargo drops or misreads`,E(t,`git`));h={type:`git`,url:f,branch:i(`branch`,l),tag:i(`tag`,l),rev:i(`rev`,l)}}let{features:ee,defaultFeatures:te=!0}=Ye(e,t,r);return{package:i(`package`,D)??n,version:a,source:h,optional:i(`optional`,u)??!1,defaultFeatures:te,features:ee}}function Xe(e,t,n,r){if(o(e,t,n),e.workspace!==!0)throw a(`true`,e.workspace,E(t,`workspace`));if(r===void 0)throw new C(`inherits from a workspace, and no workspace root is given`,t)}function Ze(e,t,n,r){Xe(e,t,Ke,r.workspace);let i=r.workspace.dependencies[n];if(i===void 0)throw new C(`${T(n)} is not in [workspace.dependencies]`,t);let{features:a,defaultFeatures:o}=Ye(e,t,r.edition);if(o===!1&&i.defaultFeatures&&r.edition===`2024`)throw new C("`default-features = false` cannot turn off the workspace's default features",t);return{...i,features:[...i.features,...a],defaultFeatures:o===!0||i.defaultFeatures,optional:b(e,`optional`,t,u)??!1,inherited:!0}}function Qe(e,t,n,r,i){for(let[a,o,c]of s(e,t)){D(a,c);let e=x(o)&&`workspace`in o?Ze(o,c,a,i):{...q(o,c,a,i.edition),inherited:!1};if(e.optional&&n===`dev`)throw new C(`a dev-dependency cannot be optional`,c);let t=Ve(e.source,e.inherited),s=i.sources.get(a)??[];if(s.some(e=>Ue(e,t)))throw new C(`${T(a)} is given another source elsewhere, which cargo refuses`,c);i.sources.set(a,[...s,t]),i.list.push({name:a,kind:n,target:r,...e})}}function $e(e,t,n){let r={workspace:t,edition:n,list:[],sources:new Map},i=(e,t,n)=>{for(let[i,a]of qe){let o=K(e,t,i,r.edition);o!==void 0&&Qe(o,E(t??``,i),a,n,r)}};i(e,void 0,void 0);for(let[t,n,r]of s(v(e.target),`target`)){if(V(t)===void 0)throw new C(`${T(t)} is neither a target's name nor a cfg(\u2026) cargo reads`,r);o(n,r,qe.flatMap(([e])=>[e,e.replaceAll(`-`,`_`)])),i(n,r,t)}return r.list}function J(e){let t=e.indexOf(`/`);if(t!==-1){let n=e[t-1]===`?`;return{dep:e.slice(0,n?t-1:t),feature:e.slice(t+1),weak:n}}return e.startsWith(`dep:`)?{dep:e.slice(4),feature:void 0,weak:!1}:{dep:void 0,feature:e,weak:!1}}function et(e,t,n){let r=m(e,t,ce,f()),i=new Set(Object.values(r).flat().map(J).filter(e=>e.feature===void 0).map(e=>e.dep)),a=Object.assign(Object.create(null),r),o=new Map;for(let e of n)o.set(e.name,o.get(e.name)||e.optional),e.optional&&!(e.name in r)&&!i.has(e.name)&&(a[e.name]=[`dep:${e.name}`]);let s=new Set;for(let[e,n]of Object.entries(a))for(let i of n){let n=n=>w(`${T(i)} ${n}`,E(t,e)),{dep:c,feature:l,weak:u}=J(i);if(c===void 0){if(l in r)continue;o.has(l)||n(`is neither a feature nor a dependency`),o.get(l)||n(`is a dependency, but not an optional one`),l in a||n(`is an optional dependency with no feature of its name: use "dep:${l}"`)}else s.add(c),l?.includes(`/`)&&n(`has more than one "/"`),c.startsWith(`dep:`)&&n(`has both "dep:" and "/"`),o.has(c)||n(`names ${T(c)}, which is not a dependency`),(l===void 0||u)&&!o.get(c)&&n(`names ${T(c)}, which is not an optional dependency`)}let c=[...o].find(([e,t])=>t&&!s.has(e));if(c!==void 0)throw new C(`optional dependency ${T(c[0])} is in no feature: add "dep:${c[0]}" to one`,t);return a}var tt=[`badges`,`features`,`lib`,`bin`,`example`,`test`,`bench`,`dependencies`,`dev-dependencies`,`dev_dependencies`,`build-dependencies`,`build_dependencies`,`target`,`lints`,`hints`],nt=[...tt,`package`,`project`,`workspace`,`profile`,`patch`],rt={"cargo-features":`cargo-features, ${W}`,replace:`[replace] is not supported`},it={metabuild:`metabuild, ${W}`,"default-target":`a per-package target, ${W}`,"forced-target":`a per-package target, ${W}`,"im-a-teapot":`im-a-teapot, ${W}`,"cargo-features":`cargo-features belong at the top of the manifest, and are not supported`},at=[`members`,`exclude`,`default-members`,`resolver`,`metadata`,`package`,`dependencies`,`lints`],ot=[`2015`,`2018`,`2021`,`2024`],Y={__proto__:null,2018:`1.31.0`,2021:`1.56.0`,2024:`1.85.0`},st={__proto__:null,1:1,2:2,3:3},ct=d(e=>ot.includes(e),`an edition: expected one of ${ot.join(`, `)}`),lt=d(e=>e in st,`a resolver: expected "1", "2" or "3"`),ut=(e,t)=>st[lt(e,t)];function dt(e){let r=t(e);if(r!==void 0)return r.pre===``&&r.build===``?r:void 0;let i=n(e);if(i?.length!==1||i[0].op!==`^`||i[0].pre!==``||e.startsWith(`^`))return;let{major:a,minor:o,patch:s}=i[0];return t(`${a}.${o??0}.${s??0}`)}var ft=d(e=>dt(e)!==void 0,`a Rust version`);function pt(e,t){if(typeof e!=`boolean`&&typeof e!=`string`)throw a(`true, false or a path`,e,t);return e}var mt=e=>[!1,!0].every(t=>Oe(e,t)!==void 0);function ht(e,t){if(Array.isArray(e))throw new C(`several build scripts, ${W}`,t);let n=pt(e,t);if(typeof n==`string`&&!mt(n))throw new C(`${T(n)} names no file, which cargo crashes on`,t);return n}function gt(e,t){let n=l(e,t);if(/^\p{White_Space}*$/u.test(n))throw new C(`a library's name cannot be empty, which cargo refuses`,t);if(n.includes(`-`))throw new C(`${T(n)}: a library's name cannot have a "-", which cargo refuses`,t);return n}function _t(e,t){let n=v(e.lib);return{name:b(n,`name`,`lib`,gt)??t.replaceAll(`-`,`_`),path:b(n,`path`,`lib`,l)}}function vt(e,t){if(typeof e==`boolean`)return e;if(!Array.isArray(e))throw a(`true, false or registry names`,e,t);return p(e,t)}var X={authors:p,categories:p,description:l,documentation:l,edition:ct,exclude:p,homepage:l,include:p,keywords:p,license:l,"license-file":l,publish:vt,readme:pt,repository:l,"rust-version":ft,version:O},yt={...X,name:D,build:ht,links:l,workspace:l,autolib:u,autobins:u,autoexamples:u,autotests:u,autobenches:u,"default-run":l,resolver:ut,metadata:e=>e};function bt(e,t){for(let[,n,r]of s(e,t))for(let[,e,t]of s(n,r))l(e,t);return e}function xt(e,t,n,r){o(e,t);let i=y(u)(K(e,t,`proc-macro`,n),E(t,`proc-macro`)),a=y(p)(K(e,t,`crate-type`,n),E(t,`crate-type`));if(r&&a?.includes(`proc-macro`)&&a.length>1)throw new C(`a proc-macro crate type is taken alone`,E(t,`crate-type`));return i??a?.includes(`proc-macro`)??!1}function St(e,t){let n=e.lib!==void 0&&xt(e.lib,`lib`,t,!0),r=[`example`,`test`,`bench`].flatMap(n=>c(e[n]??[],n).map((e,r)=>xt(e,`${n}[${r}]`,t,!1)));return{procMacro:n,procMacroTarget:n||r.includes(!0)}}function Ct(e){o(e,`workspace`,at);let t=(t,n)=>b(e,t,`workspace`,n),n=t(`package`,(e,t)=>o(e,t,[...Object.keys(X),`badges`]))??Object.create(null);for(let[e,t,r]of s(n,`workspace.package`))(e===`badges`?bt:X[e])(t,r);let r=m(e.dependencies,`workspace.dependencies`,D,(e,t,n)=>{let r=q(e,t,n);if(r.optional)throw new C(`a workspace dependency cannot be optional`,t);if(x(e)&&e.public!==void 0)throw new C(`a workspace dependency cannot be public`,t);return r});return{members:t(`members`,p)??[],exclude:t(`exclude`,p)??[],defaultMembers:t(`default-members`,p),resolver:t(`resolver`,ut),package:n,dependencies:r}}var wt=e=>m(e,`patch`,e=>e,(e,t)=>m(e,t,D,q));function Tt(e,t,n){if(x(e)&&x(t)){let r=Object.assign(Object.create(null),t);for(let[i,a]of Object.entries(e))r[i]=Object.hasOwn(t,i)?Tt(a,t[i],E(n,i)):a;return r}if(Array.isArray(e)&&Array.isArray(t))return[...t,...e];if([e,t].some(e=>x(e)||Array.isArray(e)))throw new C(`${i(e)} in one config and ${i(t)} in one under it, which cargo does not merge`,n);return e}function Et(e){if(!Array.isArray(e)||!e.every(e=>typeof e==`string`))throw TypeError(`expected the texts of the config files`);let t;for(let[n,r]of e.entries()){let e=se(()=>S(r),e=>{throw e instanceof oe&&(e.message=`texts[${n}]: ${e.message}`),e});e.patch!==void 0&&(t=t===void 0?e.patch:Tt(t,e.patch,`patch`))}return{patch:wt(t)}}function Dt(e,t,n,r){if(!x(e))return e;if(Xe(e,t,[`workspace`],r),r.package[n]===void 0)throw new C(`workspace.package.${n} is not given`,t);return r.package[n]}function Ot(e,t){if(e.package!==void 0&&e.project!==void 0)throw new C(`[project] beside [package]`,`project`);let i=e.package===void 0?`project`:`package`,a=o(e[i],i,Object.keys(yt),it),s=Object.create(null);for(let[e,n]of Object.entries(yt)){let r=E(i,e);s[e]=y(n)(e in X?Dt(a[e],r,e,t):a[e],r)}if(a.workspace!==void 0&&e.workspace!==void 0)throw new C(`a workspace root names no other root`,E(i,`workspace`));let c=s.edition??`2015`;if(i===`project`&&c===`2024`)throw new C(`not supported in the 2024 edition: use [package]`,i);let l=s[`rust-version`];if(l!==void 0&&c in Y&&!r(n(`^${Y[c]}`),dt(l)))throw new C(`rust-version ${T(l)} is incompatible with ${Y[c]}, which the ${c} edition requires`,E(i,`rust-version`));let{version:u,publish:d,resolver:f,links:p}=s;if(u===void 0&&d!==void 0&&d!==!1&&!(Array.isArray(d)&&d.length===0))throw new C("`publish` needs a `version`",E(i,`publish`));if(f!==void 0&&e.workspace?.resolver!==void 0)throw new C("`resolver` is given in [workspace] too",E(i,`resolver`));if(p!==void 0&&s.build===!1)throw new C(`links to ${T(p)} with no build script, which cargo refuses`,E(i,`links`));let m=s.build===!0?`build.rs`:s.build;return{name:D(a.name,E(i,`name`)),version:u??`0.0.0`,edition:c,resolver:f,links:p,build:m}}function kt(e,t){let n=o(S(e),void 0,nt,rt),r=n.workspace===void 0?void 0:Ct(n.workspace);if(r!==void 0&&t!==void 0)throw new C(`a workspace root inherits from its own [workspace], not another`,`workspace`);if(t!==void 0&&t.workspace===void 0)throw TypeError(`expected the manifest of a workspace root`);let i=r??t?.workspace,a=wt(n.patch);if(n.package===void 0&&n.project===void 0){if(r===void 0)throw new C(`neither [package] nor [workspace]`);let e=tt.find(e=>n[e]!==void 0);if(e!==void 0)throw new C(`a virtual manifest has no package for it`,e);return{package:void 0,workspace:r,patch:a}}let s=Ot(n,i),c=$e(n,i,s.edition),l=St(n,s.edition);return{package:{...s,features:et(n.features,`features`,c),dependencies:c,lib:_t(n,s.name),...l},workspace:r,patch:a}}function At(e,t){let n=o(S(e),t),r=E(t,n.package===void 0?`project`:`package`),i=o(n.package??n.project,r),a=D(i.name,E(r,`name`));if(x(i.version))throw new C(`a vendored package inherits nothing from a workspace`,E(r,`version`));return{name:a,version:b(i,`version`,r,O)??`0.0.0`}}function jt(e){let t=0;for(let n of e.matchAll(/"(?:[^"\\]|\\.)*"(\s*:)?/gsu))n[1]!==void 0&&t++;return t}function Mt(e,t){let n=se(()=>JSON.parse(e),e=>w(`not JSON: ${e.message}`,t));if(!re(n))throw new C(`expected an object`,t);if(n.$comment!==void 0&&typeof n.$comment!=`string`)throw new C(`expected "$comment" to be a string`,t);if(Object.keys(n).filter(e=>e!==`$comment`).sort().join()!==`files,package`)throw new C(`expected "files" and "package", and nothing else`,t);if(n.package!==null&&!g(n.package))throw new C(`expected "package" to be a sha256 or null`,t);if(!re(n.files))throw new C(`expected "files" to be an object`,t);let r=Object.create(null);for(let[e,i]of Object.entries(n.files)){if(!te(e))throw new C(`${T(e)} is not a path within the package`,t);if(typeof i!=`string`||!g(i))throw new C(`expected a sha256 for ${T(e)}`,t);r[e]=i}if(jt(e)!==Object.keys(n).length+Object.keys(r).length)throw new C(`a key is given twice`,t);return{checksum:n.package??void 0,files:r}}function Nt(e){if(typeof e!=`string`)throw TypeError(`expected the text of a .cargo-checksum.json`);return Mt(e,void 0)}function Pt(e,t){if(typeof t!=`object`||!t)throw TypeError(`expected the vendor directory, by directory`);let n=new Map;for(let[e,r]of Object.entries(t)){if(!ee(e)||e.startsWith(`.`))throw new C(`${T(e)} is not a directory a directory source reads`,e);if(typeof r?.manifest!=`string`||typeof r.checksum!=`string`)throw TypeError(`expected the manifest and checksum texts of ${T(e)}`);let{name:t,version:i}=At(r.manifest,E(e,`Cargo.toml`)),a=`${t} ${i}`;if(n.has(a))throw new C(`${T(n.get(a).directory)} holds ${T(a)} too, and cargo would read either`,e);n.set(a,{directory:e,...Mt(r.checksum,E(e,`.cargo-checksum.json`))})}let r=Object.create(null);for(let[t,i]of Object.entries(e.packages)){if(i.source===void 0)continue;let e=n.get(`${i.name} ${i.version}`);if(e===void 0)throw new C(`no directory holds ${T(`${i.name} ${i.version}`)}`,t);if(e.checksum!==i.checksum)throw new C(`${T(e.directory)} holds it with checksum ${e.checksum??`none`}, where the lockfile has ${i.checksum??`none`}`,t);r[t]={directory:e.directory,files:e.files}}return r}var Z=(e,t)=>e.get(t)??e.set(t,new Set).get(t),Ft=(e,t,n)=>new C(`${T(e)} is asked of ${T(t)}, which has no such feature`,n),It=(e,t)=>new C(`feature ${T(e)} enables itself, which cargo refuses`,t);function Q(e,t){return t.defaultFeatures&&`default`in e[t.resolved].manifest.features?[...t.features,`default`]:t.features}var Lt=()=>({features:new Set,enabled:new Set,asked:new Map}),Rt=class{constructor(e,t){this.packages=e,this.why=t,this.requests=new Map,this.active=new Set,this.dirty=new Set}requestOf(e){return this.requests.has(e)||(this.requests.set(e,Lt()),this.dirty.add(e)),this.requests.get(e)}require(e,t,n,r){let i=this.packages[e].manifest.features;if(!(n in i))throw Ft(n,e,r);if(!t.features.has(n)){if(t.features.add(n),this.dirty.add(e),i[n].includes(n))throw It(n,e);for(let r of i[n])this.requireValue(e,t,J(r),e)}}requireValue(e,t,n,r){if(n.dep===void 0)return this.require(e,t,n.feature,r);let{features:i,dependencies:a}=this.packages[e].manifest,o=a.some(e=>e.name===n.dep&&e.optional);n.feature!==void 0&&!n.weak&&o&&n.dep in i&&this.require(e,t,n.dep,r),t.enabled.add(n.dep),n.feature!==void 0&&Z(t.asked,n.dep).add(n.feature),this.dirty.add(e)}ask(e,t,n){if(e.resolved===void 0)throw new C(this.why(e,n),n);this.active.add(e);let r=this.requestOf(e.resolved);for(let i of[...Q(this.packages,e),...t])this.require(e.resolved,r,i,n)}run(e){for(let[t,n]of e){let[e,r]=[Lt(),this.requestOf(t)];for(let i of n)this.requireValue(t,e,i,`features`),this.requireValue(t,r,i,`features`);for(let n of this.packages[t].dependencies)n.kind===`dev`&&this.ask(n,e.asked.get(n.name)??[],t)}for(;this.dirty.size>0;){let e=this.dirty.values().next().value;this.dirty.delete(e);let t=this.requestOf(e);for(let n of this.packages[e].dependencies)n.kind===`dev`||n.optional&&!t.enabled.has(n.name)||this.ask(n,t.asked.get(n.name)??[],e)}return this.active}};function zt(e,t,n){return new Rt(e,n).run(t)}var Bt=`path`,Vt={__proto__:null,registry:{registry:!1,index:!1},git:{url:!0,branch:!1,tag:!1,rev:!1},path:{path:!0}};function Ht(e){let t=Vt[e?.type];if(!(t!==void 0&&Object.entries(t).every(([t,n])=>typeof e[t]==`string`||!n&&e[t]===void 0)))throw TypeError(`expected a source, as parseCargoManifest gives one`)}function Ut(e,t){if(typeof e!=`string`)throw TypeError(`expected the key of a [patch] table`);return Ht(t),I(t)===F(e)}var Wt=(e,n)=>e===void 0||r(e,t(n)),Gt=(e,t)=>t.identity===e||e===N&&t.source!==void 0&&!t.source.startsWith(`git+`),Kt=(e,t)=>t.name===e.package&&Gt(e.identity,t)&&Wt(e.requirement,t.version),qt=(e,t)=>({...e,key:L(e.name,e.version,e.source),identity:e.source===void 0?Bt:j(e.source,t,!1).identity});function Jt(e,t,n){let r=new Map;for(let i of Object.keys(e).toSorted()){let a=E(t,i),o=Object.entries(e[i]).map(([e,t])=>({key:i,name:e,spec:t,where:E(a,e)}));r.set(me(i),{key:i,where:a,label:`${n}[patch.${i}]`,entries:o})}return r}function Yt(e,t){let n=Jt(v(t?.patch),E(`config`,`patch`),`the config's `);for(let[t,r]of Jt(e.patch,`patch`,``)){let e=n.get(t);e===void 0?n.set(t,r):e.entries.push(...r.entries.filter(t=>!e.entries.some(e=>e.name===t.name)))}let r=new Map;for(let{key:e,where:t,label:i}of n.values()){let n=F(e),a=r.get(n);if(a!==void 0)throw new C(`patches the source ${a} does by another URL, and cargo would take either table`,t);r.set(n,i)}return[...n.values()].flatMap(e=>e.entries)}function Xt(e,t){return Yt(e,t).map(({key:e,spec:t,where:n})=>{let r=F(e);if(I(t.source)===r)throw new C(`patches its source with itself, which cargo refuses`,n);let i=y(G)(t.version,n);return{table:r,target:`${r} ${t.package}`,package:t.package,identity:P(t.source,Bt),requirement:i,where:n}})}function Zt(e,t,n){let r=t.map(()=>{}),i=(e,a)=>t.some((t,o)=>a.has(o)||!n(e,t)||(a.add(o),r[o]!==void 0&&!i(r[o],a))?!1:(r[o]=e,!0));return e.find(e=>!i(e,new Set))}function Qt(e,t,n,r){let i=t.map(e=>qt(e,`patch.unused`)),a=i.find(t=>t.source!==void 0&&e.has(t.key));if(a!==void 0)throw new C(`the lockfile lists ${T(a.key)} unused, and among its packages: is it out of date?`,`patch.unused`);let o=new Map;for(let t of n)for(let n of e.values())Kt(t,n)&&o.set(`${t.table} ${n.key}`,{...n,table:t.table});let s=(e,t)=>(t.table===void 0||t.table===e.table)&&Kt(e,t),c=Zt(n,[...o.values(),...i],s);if(c!==void 0)throw new C(`the lockfile has no package of its own this patch offers, used or unused: is it out of date?`,c.where);let l=Zt([...[...r].map(e=>o.get(e)),...i],n,(e,t)=>s(t,e));if(l?.table!==void 0)throw new C(`a dependency resolves to it by a [patch], and no patch is left that offers it: is the lockfile out of date?`,l.key);if(l!==void 0)throw new C(`the lockfile lists ${T(`${l.name} ${l.version}`)} unused where no [patch] does: is it out of date?`,`patch.unused`)}function $t(e){let t=e.package?.edition;return e.workspace?.resolver??e.package?.resolver??(t===`2024`?3:t===`2021`?2:1)}function en(e,t){let n=new Map;for(let r of t){if(!(r in e.packages)||e.packages[r].source!==void 0)throw new C(`${T(r)} is not a path package in the lockfile`,`members`);let{name:t}=e.packages[r];if(n.has(t)&&n.get(t)!==r)throw new C(`${T(n.get(t))} and ${T(r)} are two members of one name, which cargo refuses`,`members`);n.set(t,r)}}function tn(e){let t=new Map;for(let[n,{manifest:r}]of Object.entries(e))if(r.links!==void 0){if(t.has(r.links))throw new C(`links the native library ${T(r.links)}, as ${T(t.get(r.links))} does, which cargo refuses`,n);t.set(r.links,n)}}function nn(e,t,n,r){let i=Object.create(null),a=new Map,o=new Map;for(let[s,c]of Object.entries(e.packages)){let e=t[s]?.package;if(e===void 0)throw new C(`no manifest of this package is given`,s);if(e.name!==c.name||e.version!==c.version)throw new C(`the manifest given is of ${T(`${e.name} ${e.version}`)}`,s);let l=n.includes(s),u=e.dependencies.map((e,t)=>{let n=l||e.kind!==`dev`?on(e,s,r,E(E(s,`dependencies`),String(t))):[],i={...e,resolved:n.length===1?n[0].key:void 0,active:!1};return n.length>1&&a.set(i,n.map(e=>e.key)),n.length===1&&n[0].slot!==void 0&&o.set(i,n[0].slot),i});i[s]={...R(c),manifest:e,dependencies:u}}return{packages:i,ambiguous:a,patched:o}}function rn(e,t,n){let r=new Set(n);for(let e of Object.values(t))for(let t of e.dependencies)t.active&&r.add(t.resolved);let i=Object.keys(t).find(e=>!r.has(e));if(i!==void 0)throw new C(`no member depends on it, directly or not: is the lockfile out of date?`,i);for(let[n,r]of Object.entries(t)){let t=new Set(r.dependencies.filter(e=>e.active).map(e=>e.resolved)),i=e.packages[n].dependencies.find(e=>!t.has(e));if(i!==void 0)throw new C(`the lockfile's edge to ${T(i)} is no dependency the members' features turn on: is it out of date?`,n)}}function an(e,t,n){let{workspace:r,members:i,config:a}=ae(n,[`workspace`,`members`,`config`]);if(r?.patch===void 0||r.workspace===void 0&&r.package===void 0)throw TypeError(`expected the manifest of the workspace root`);if(!Array.isArray(i))throw TypeError(`expected the members of the workspace`);if(a!==void 0&&a?.patch===void 0)throw TypeError(`expected the config, as parseCargoConfig gives it`);en(e,i);let o=r.package===void 0?void 0:L(r.package.name,r.package.version);if(o!==void 0&&!i.includes(o))throw new C(`the root package ${T(o)} is not among the members`,`members`);let s=new Map(Object.entries(e.packages).map(([e,t])=>[e,qt(t,e)])),c=Xt(r,a),{packages:l,ambiguous:u,patched:d}=nn(e,t,i,{locked:s,patches:Map.groupBy(c,e=>e.target)}),f=new Map(i.map(e=>[e,Object.keys(l[e].manifest.features).map(J)])),p=(t,n)=>{if(u.has(t))return`${T(t.name)} could be any of ${u.get(t).map(T).join(`, `)}`;let r=e.packages[n].dependencies.filter(n=>e.packages[n].name===t.package);return r.length===0?`the lockfile resolves no ${T(t.name)}, which the members' features turn on: is it out of date?`:`the lockfile resolves ${T(t.name)} to none but ${r.map(T).join(`, `)}, of another source or version: is it out of date, or [patch]ed by a config not given?`};for(let e of zt(l,f,p))e.active=!0;return rn(e,l,i),tn(l),Qt(s,e.unusedPatches,c,new Set(d.entries().filter(([e])=>e.active).map(([,e])=>e))),{resolver:$t(r),root:o,members:[...i],packages:l}}function on(e,t,{locked:n,patches:r},i){let a=y(G)(e.version,i),o=P(e.source,n.get(t).identity),s=I(e.source),c=r.get(`${s} ${e.package}`)??[];return n.get(t).dependencies.flatMap(t=>{let r=n.get(t);return r.name!==e.package||!Wt(a,r.version)?[]:Gt(o,r)?[{key:t,slot:void 0}]:c.some(e=>Kt(e,r))?[{key:t,slot:`${s} ${t}`}]:[]})}var sn=/^[A-Z_a-z]\w*$/u;function $(e,t){if(typeof e!=`object`||!e||!Array.isArray(e.cfg)||e.name!==void 0&&typeof e.name!=`string`)throw TypeError(`expected ${t} as { name, cfg }`);if(e.decides!==void 0&&!(Array.isArray(e.decides)&&e.decides.every(e=>typeof e==`string`)))throw TypeError(`expected ${t}.decides as the names of cfgs`);let n=e.cfg.map(e=>Fe(e)??w(`${T(e)} is not a line of \`rustc --print cfg\``,t)),r=e.decides?.map(e=>sn.test(e)?e:w(`${T(e)} is not the name of a cfg`,E(t,`decides`)));return{name:e.name,cfg:new Set(n),decides:r===void 0?void 0:new Set(r)}}var cn=e=>e.name===void 0||e.decides!==void 0;function ln(e){let t=$(e,`platform`),n=new Map;return e=>{if(typeof e!=`string`)throw TypeError(`expected a platform as a [target] table names it`);return n.has(e)||n.set(e,V(e)),Re(n.get(e)??w(`${T(e)} is neither a target's name nor a cfg(\u2026) cargo reads`),t)}}function un(e){if(!Array.isArray(e)||!e.every(e=>typeof e==`string`))throw TypeError(`expected the features as strings`);return[...new Set(e.flatMap(e=>e.split(/[\p{White_Space},]+/u)).filter(Boolean))].map(e=>{let t=J(e);if(t.feature===void 0)throw new C(`${T(e)}: \`dep:\` is not taken on the command line`,`features`);if(t.dep!==void 0&&t.feature.includes(`/`))throw new C(`${T(e)} has more than one "/"`,`features`);return{text:e,...t}})}function dn(e){let t=e=>(e.target===void 0?[`normal`,`dev`,`build`]:[`normal`,`build`,`dev`]).indexOf(e.kind),n=e.dependencies.toSorted((e,n)=>{let[r,i]=[e.target??``,n.target??``];return r===i?t(e)-t(n):r<i?-1:1});return new Map(n.map(e=>[e.name,e]))}function fn(e,t,n){let r=dn(e),i=t=>t in e.features||r.get(t)?.optional===!0,a=t=>t.dep===void 0?i(t.feature)?t:void 0:r.has(t.dep)?t:t.dep===e.name&&i(t.feature)?J(t.feature):void 0;return t.flatMap(e=>{let t=a(e);return t===void 0?[]:(n.add(e.text),[t])})}function pn(e,t,n,r){let i=new Map;if(e.root===void 0||e.resolver>=2){let a=new Set;for(let o of n)i.set(o,[fn(e.packages[o].manifest,t,a),!r.noDefaultFeatures]);let o=t.filter(e=>!a.has(e.text));if(o.length>0)throw new C(`no package selected has ${o.map(e=>T(e.text)).join(`, `)}`,`features`);return i}let a=r.current??e.root;if(!e.members.includes(a))throw new C(`${T(a)} is not a member of the workspace`,`current`);let o=t=>e.packages[t].name,s=t=>t.dep!==void 0&&e.members.some(e=>e!==a&&o(e)===t.dep)&&n.some(e=>o(e)===t.dep),c=Map.groupBy(t.filter(s),e=>e.dep);for(let l of e.members)l===a?i.set(l,[t.filter(e=>!s(e)),!r.noDefaultFeatures]):n.includes(l)&&i.set(l,[(c.get(o(l))??[]).map(e=>J(e.feature)),!0]);return i}function mn(e,t){let{packages:n}=t;if(!Array.isArray(n)||n.length===0)throw TypeError(`expected the packages built, as keys of members`);for(let t of n)if(!e.members.includes(t))throw new C(`${T(t)} is not a member of the workspace`,`packages`);let r=e.members.filter(e=>n.includes(e)),i=new Map;for(let[n,[a,o]]of pn(e,un(t.features??[]),r,t)){let{features:r,dependencies:s}=e.packages[n].manifest,c=a.find(e=>e.dep!==void 0&&!s.some(t=>t.name===e.dep));if(c!==void 0)throw new C(`${T(n)} has no dependency ${T(c.dep)}`,`features`);let l=[...o&&`default`in r?[`default`]:[],...t.allFeatures?Object.keys(r):[]];i.set(n,[...a,...l.map(J)])}return i}function hn(e,t){let{undecided:n}=e;if(n===void 0){if(t.some(cn))throw TypeError("expected `undecided`, 'on' or 'off', as a platform leaves cfgs undecided");return!1}if(n!==`on`&&n!==`off`)throw TypeError("expected `undecided` to be 'on' or 'off'");if(e.targets===`all`)throw TypeError("expected no `undecided` with targets 'all', which reads every platform");return n===`on`}var gn=class{constructor(e,t,n){this.graph=e,this.targeted=t;let r=n.targets===`all`;this.host=r?void 0:$(n.host,`host`),this.targets=r?[]:(n.targets?.length>0?n.targets:[n.host]).map((e,t)=>$(e,`targets[${t}]`)),this.undecided=hn(n,r?[]:[this.host,...this.targets]),this.dev=n.dev===!0,this.decoupleHost=e.resolver>=2,this.decoupleDev=e.resolver>=2&&!this.dev,this.ignoreInactive=e.resolver>=2&&!r,this.trackForHost=this.decoupleHost||this.ignoreInactive,this.platforms=new Map,this.depsOf=new Map,this.activated=new Map,this.activatedDeps=new Map,this.processed=new Set,this.deferred=new Map}saved(e){return this.decoupleHost?e:`normal`}enabled(e,t){return Z(this.activated,`${this.saved(t)} ${e}`)}features(e){return this.graph.packages[e].manifest.features}deps(e,t){let n=`${t} ${e}`;return this.depsOf.has(n)||this.depsOf.set(n,this.graph.packages[e].dependencies.filter(e=>this.targeted.has(e)&&!(e.kind===`dev`&&this.decoupleDev)&&(e.target===void 0||!this.ignoreInactive||this.activeFor(e,t))).map(e=>({dep:e,depFk:this.trackForHost&&this.forHost(e)?`host`:t}))),this.depsOf.get(n)}forHost(e){return e.kind===`build`||this.graph.packages[e.resolved].manifest.procMacro}activeFor(e,t){this.platforms.has(e.target)||this.platforms.set(e.target,V(e.target));let n=this.platforms.get(e.target),r=e=>Re(n,e)??this.undecided;return e.kind===`build`||t===`host`?r(this.host):this.targets.some(r)}request(e,t,n,r){if(!(n in this.features(e)))throw Ft(n,e,r);this.activateRec(e,t,n)}activatePkg(e,t,n,r){for(let i of n)this.request(e,t,i,r);if(!this.processed.has(`${t} ${e}`)){this.processed.add(`${t} ${e}`);for(let{dep:n,depFk:r}of this.deps(e,t))n.optional||this.activatePkg(n.resolved,r,Q(this.graph.packages,n),e)}}activateValue(e,t,n){n.dep===void 0?this.activateRec(e,t,n.feature):n.feature===void 0?this.activateDependency(e,t,n.dep):this.activateDepFeature(e,t,n.dep,n.feature,n.weak)}activateRec(e,t,n){let r=this.enabled(e,t);if(r.has(n))return;r.add(n);let i=this.features(e)[n]??[];if(i.includes(n))throw It(n,e);for(let n of i)this.activateValue(e,t,J(n))}activateDependency(e,t,n){Z(this.activatedDeps,`${this.saved(t)} ${e}`).add(n);let r=this.deferred.get(`${t} ${e} ${n}`)??[];this.deferred.delete(`${t} ${e} ${n}`);for(let{dep:i,depFk:a}of this.deps(e,t).filter(e=>e.dep.name===n)){for(let t of r)this.request(i.resolved,a,t,e);this.activatePkg(i.resolved,a,Q(this.graph.packages,i),e)}}activateDepFeature(e,t,n,r,i){for(let{dep:a,depFk:o}of this.deps(e,t).filter(e=>e.dep.name===n)){if(a.optional){if(i&&!this.activatedDeps.get(`${this.saved(t)} ${e}`)?.has(n)){Z(this.deferred,`${t} ${e} ${n}`).add(r);continue}this.activateDependency(e,t,n),!i&&n in this.features(e)&&this.activateRec(e,t,n)}this.request(a.resolved,o,r,e)}}builtKinds(e){let{procMacro:t,procMacroTarget:n}=this.graph.packages[e].manifest;return t||n&&this.dev?[`normal`,`host`]:[`normal`]}resolveRoot(e,t){for(let n of this.trackForHost&&this.graph.packages[e].manifest.procMacroTarget?[`normal`,`host`]:[`normal`]){for(let r of t)this.activateValue(e,n,r);this.activatePkg(e,n,[],`roots`)}}reach(e,t){let n=new Map,r=(e,t)=>{n.has(`${t} ${e}`)||n.set(`${t} ${e}`,[e,t])};for(let[t,n]of e)r(t,n);let i=new Set(n.keys());for(let[e,a]of n.values()){let n=this.activatedDeps.get(`${this.saved(a)} ${e}`);for(let o of this.graph.packages[e].dependencies)!this.targeted.has(o)||o.optional&&!n?.has(o.name)||o.kind===`dev`&&!(this.dev&&i.has(`${a} ${e}`))||o.target!==void 0&&this.host!==void 0&&!this.activeFor(o,a)||t(e,o)&&r(o.resolved,a===`host`||this.forHost(o)?`host`:`normal`)}return n}result(e){let t=e.map(e=>[e,this.graph.packages[e].manifest.procMacro?`host`:`normal`]);this.reach(t,(e,t)=>this.checkNamed(e,t));let n=this.reach(e.flatMap(e=>this.builtKinds(e).map(t=>[e,t])),()=>!0),r=Object.create(null);for(let e of Object.keys(this.graph.packages)){let[t,i]=[`normal`,`host`].map(t=>n.has(`${t} ${e}`)?[...this.enabled(e,t)].sort():void 0);(t!==void 0||i!==void 0)&&(r[e]={normal:t,host:i})}return r}checkNamed(e,t){let n=e=>e.name.replaceAll(`-`,`_`),r=this.graph.packages[e].dependencies.find(e=>this.targeted.has(e)&&e.resolved===t.resolved&&n(e)!==n(t));if(r!==void 0)throw new C(`depends on ${T(t.resolved)} as both ${T(t.name)} and ${T(r.name)}, which cargo refuses to build`,e);return!0}};function _n(e,t){ae(t,[`packages`,`features`,`allFeatures`,`noDefaultFeatures`,`current`,`dev`,`host`,`targets`,`undecided`]);let n=mn(e,t),r=new gn(e,zt(e.packages,n,e=>`the build turns on ${T(e.name)}, which the lockfile does not resolve to one package, and cargo would anew`),t);for(let[e,t]of n)r.resolveRoot(e,t);return r.result(t.packages)}export{C as LockfileError,oe as TomlError,an as linkCargo,ln as matchCargoPlatform,Nt as parseCargoChecksum,Et as parseCargoConfig,we as parseCargoLock,kt as parseCargoManifest,Ut as patchesCargoSource,Pt as readCargoVendor,_n as resolveCargoFeatures};
@@ -0,0 +1 @@
1
+ export{a as lockfileWhy,b as routesTo}from"./chunk-A4BBBHQU.js";import"./chunk-OOJM4CTU.js";
@@ -0,0 +1 @@
1
+ import{a as e,b as t,c as n}from"./chunk-ZQHLECTI.js";import{d as r,f as i,g as a,j as o,k as s,m as c}from"./chunk-PXK7EU4V.js";var l=[{},{},{}],u=[[...`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`],[...`0123456789ABCDEFGHIJKLMNOPQRSTUV`],[...`0123456789ABCDEFGHJKMNPQRSTVWXYZ`]],d=`Invalid character in base32 input`,f=`Invalid base32 padding`,p=`Invalid base32 length`,m=`Invalid last chunk`,h=r;function g(e,n,r){o(e);let i=Math.floor(e.length/5),s=i*5,c=``,d=0,f=u[n],p=l[n];if(!p.pairs){if(p.pairs=[],a){p.codepairs=new Uint16Array(1024);let e=p.codepairs,t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e<32;e++){let n=f[e].charCodeAt(0);for(let r=0;r<32;r++)t[e<<6|r<<1]=t[r<<6|(e<<1)+1]=n}}else{let e=p.pairs;for(let t=0;t<32;t++)for(let n=0;n<32;n++)e.push(`${f[t]}${f[n]}`)}}let{pairs:m,codepairs:g}=p;if(a){let n=new Uint16Array(i*4);for(let t=0;d<s;d+=5){let r=e[d],i=e[d+1],a=e[d+2],o=e[d+3],s=e[d+4],c=r<<2|i>>6,l=(i&63)<<4|a>>4,u=(a&15)<<6|o>>2,f=(o&3)<<8|s;n[t]=g[c],n[t+1]=g[l],n[t+2]=g[u],n[t+3]=g[f],t+=4}c=t(n)}else if(h)for(;d<s;d+=5){let t=e[d],n=e[d+1],r=e[d+2],i=e[d+3],a=e[d+4],o=t<<2|n>>6,s=(n&63)<<4|r>>4,l=(r&15)<<6|i>>2,u=(i&3)<<8|a;c+=`${m[o]}${m[s]}${m[l]}${m[u]}`}else for(;d<s;d+=5){let t=e[d],n=e[d+1],r=e[d+2],i=e[d+3],a=e[d+4],o=t<<2|n>>6,s=(n&63)<<4|r>>4,l=(r&15)<<6|i>>2,u=(i&3)<<8|a;c+=m[o],c+=m[s],c+=m[l],c+=m[u]}let _=0,v=3;for(;d<e.length;d++){let t=e[d];c+=f[_|t>>v],v>=5&&(v-=5,c+=f[t>>v&31]),_=t<<5-v&31,v+=3}return v!==3&&(c+=f[_]),r&&(c+=[``,`======`,`====`,`===`,`=`][e.length-s]),c}var _=i?128:65536;function v(e,t){let r=e.length;for(;e[r-1]===`=`;)r--;let a=e.length-r,o=r%8,s=r-o;if(![0,2,4,5,7].includes(o))throw SyntaxError(p);if(a>7||a!==0&&e.length%8!=0)throw SyntaxError(f);let c=u[t],h=l[t];if(!h.fromMap){h.fromMap=new Int8Array(_).fill(-1);let e=h.fromMap;c.forEach((t,n)=>{e[t.charCodeAt(0)]=e[t.toLowerCase().charCodeAt(0)]=n}),t===2&&(e[73]=e[76]=e[105]=e[108]=e[49],e[79]=e[111]=e[48])}let g=h.fromMap,v=new Uint8Array(Math.floor(r*5/8)),y=0,b=0;if(i){let t=n(e,d);for(;b<s;b+=8){let e=t[b],n=t[b+1],r=t[b+2],i=t[b+3],a=t[b+4],o=t[b+5],s=t[b+6],c=t[b+7],l=g[e]<<15|g[n]<<10|g[r]<<5|g[i],u=g[a]<<15|g[o]<<10|g[s]<<5|g[c];if(l<0||u<0)throw SyntaxError(d);v[y]=l>>12,v[y+1]=l>>4&255,v[y+2]=l<<4&255|u>>16,v[y+3]=u>>8&255,v[y+4]=u&255,y+=5}}else for(;b<s;b+=8){let t=e.charCodeAt(b),n=e.charCodeAt(b+1),r=e.charCodeAt(b+2),i=e.charCodeAt(b+3),a=e.charCodeAt(b+4),o=e.charCodeAt(b+5),s=e.charCodeAt(b+6),c=e.charCodeAt(b+7),l=g[t]<<15|g[n]<<10|g[r]<<5|g[i],u=g[a]<<15|g[o]<<10|g[s]<<5|g[c];if(l<0||u<0)throw SyntaxError(d);v[y]=l>>12,v[y+1]=l>>4&255,v[y+2]=l<<4&255|u>>16,v[y+3]=u>>8&255,v[y+4]=u&255,y+=5}if(o<2)return v;let x=g[e.charCodeAt(b++)]<<5|g[e.charCodeAt(b++)];if(x<0)throw SyntaxError(d);if(v[y++]=x>>2,o<4){if(x&3)throw SyntaxError(m);return v}let S=g[e.charCodeAt(b++)]<<5|g[e.charCodeAt(b++)];if(S<0)throw SyntaxError(d);if(v[y++]=x<<6&255|S>>4,o<5){if(S&15)throw SyntaxError(m);return v}let C=g[e.charCodeAt(b++)];if(C<0)throw SyntaxError(d);if(v[y++]=S<<4&255|C>>1,o<7){if(C&1)throw SyntaxError(m);return v}let w=g[e.charCodeAt(b++)]<<5|g[e.charCodeAt(b++)];if(w<0)throw SyntaxError(d);if(v[y++]=C<<7&255|w>>3,w&7)throw SyntaxError(m);return v}function y(t,n,r,i,a){if(typeof t!=`string`)throw TypeError(s);if(a!==null&&e(a),r===!0){if(t.length%8!=0)throw SyntaxError(f)}else if(r===!1){if(t.endsWith(`=`))throw SyntaxError(`Did not expect padding in base32 input`)}else if(r!==`both`)throw TypeError(`Invalid padding option`);return c(v(t,n),i)}var b=(e=>(t,n)=>{if(!n)return y(t,e,`both`,`uint8`,null);let{format:r=`uint8`,padding:i=`both`,...a}=n;return y(t,e,i,r,a)})(0),x=(e,{padding:t=!1}={})=>g(e,0,t);export{b as a,x as b};
@@ -0,0 +1 @@
1
+ var e=new TextEncoder,t=new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});function n(t){if(typeof t!=`string`)throw TypeError(`encodeUtf8 expects a string, got ${typeof t}`);if(!t.isWellFormed())throw TypeError(`encodeUtf8: input contains lone surrogates`);return e.encode(t)}var r=2;function i(t){if(typeof t!=`string`)throw TypeError(`utf8ByteLength expects a string, got ${typeof t}`);if(/[\u0100-\uFFFF]/.test(t))return e.encode(t).byteLength;let n=/[\u0080-\u00FF]/gu,i=t.length;for(;n.test(t);){let e=n.lastIndex-1;for(let n=0;e<t.length&&n<r;e++)t.codePointAt(e)>127?(i++,n=0):n++;n.lastIndex=e}return i}function a(e){if(!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer))throw TypeError(`decodeUtf8 expects a BufferSource, got ${e===null?`null`:typeof e}`);return t.decode(e)}export{n as a,i as b,a as c};
@@ -0,0 +1 @@
1
+ import{d as e,i as t}from"./chunk-7HP2VYIC.js";var n=[`dependencies`,`devDependencies`,`optionalDependencies`];function r(n,r,i){let[a,o]=[`dependencies`,`optionalDependencies`].map(e=>i(n[e],t(r,e))),s=Object.keys(o).find(e=>e in a);if(s!==void 0)throw new e(`listed under dependencies too`,t(t(r,`optionalDependencies`),s));return{dependencies:a,optionalDependencies:o}}function i(e,t){let n=new Set,r=e=>{for(let t of Object.values(e))t.startsWith(`link:`)||n.add(t)};for(let t of e)r(t);for(let e of n)r(t[e].dependencies),r(t[e].optionalDependencies);return Object.keys(t).find(e=>!n.has(e))}function a(e,t,{required:n=[`dependencies`],dev:r=[`devDependencies`],optional:i=[`optionalDependencies`]}={}){let a=(n,r)=>{let i=new Set,a=t=>{for(let n of Object.values(t))n.startsWith(`link:`)||i.add(e[n])};for(let e of Object.values(t))for(let t of n)a(e[t]);for(let e of i)for(let t of r)a(e[t]);return i},o=a([...n,...i],[`dependencies`,`optionalDependencies`]),s=a([...n,...r],[`dependencies`]),c=a(n,[`dependencies`]);return e=>({dev:!o.has(e),optional:!s.has(e),devOptional:!c.has(e)})}export{n as a,r as b,i as c,a as d};
@@ -0,0 +1 @@
1
+ import{d as e,h as t}from"./chunk-7HP2VYIC.js";function n(e,t){let[n,r,i,a]=[0,0,-1,0];for(;r<t.length;)if(e[n]===`*`)i=n++,a=r;else if(e[n]===`?`||e[n]===t[r])n++,r++;else{if(i===-1)return!1;n=i+1,r=++a}for(;e[n]===`*`;)n++;return n===e.length}function r(r,i){let a=r.split(`/`);if(a.length>30||a.some(e=>e===``||/[[\]{}()!+#\\]/u.test(e)))throw new e(`${t(r)} is a glob not read here`,i);return a.map(e=>{if(e===`**`)return null;let t=!e.startsWith(`.`)&&/[*?]/u.test(e),r=[...e];return e=>!(t&&e.startsWith(`.`))&&n(r,[...e])})}function i(e,t){let n=t;for(let t=0;t<e.length;t++)n&1<<t&&e[t]===null&&(n|=1<<t+1);return n}function a(e,t,n){let r=0;for(let i=0;i<e.length;i++)t&1<<i&&(e[i]===null?r|=n.startsWith(`.`)?0:1<<i:e[i](n)&&(r|=1<<i+1));return i(e,r)}var o=(e,t)=>!!(t&1<<e.length),s=(e,t)=>o(e,t.split(`/`).reduce((t,n)=>a(e,t,n),i(e,1)));export{r as a,i as b,a as c,o as d,s as e};
@@ -0,0 +1 @@
1
+ import"./chunk-OOJM4CTU.js";var e=(e,t)=>Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)])),t=(...e)=>e.flatMap(e=>Object.values(e)),n=e=>[...new Set(e)];function r(e){let t=Object.keys(e),n=t=>e[t].dependencies.filter(n=>n!==t&&Object.hasOwn(e,n)),r=[],i=new Set;for(let e of t){if(i.has(e))continue;i.add(e);let t=[[e,n(e).values()]];for(;t.length>0;){let[e,a]=t.at(-1),o=a.next();o.done?(r.push(e),t.pop()):i.has(o.value)||(i.add(o.value),t.push([o.value,n(o.value).values()]))}}let a=new Map(t.map(e=>[e,[]]));for(let e of t)for(let t of n(e))a.get(t).push(e);let o=new Map;for(let e of r.toReversed())if(!o.has(e)){o.set(e,e);for(let t=[e];t.length>0;)for(let n of a.get(t.pop()))o.has(n)||(o.set(n,e),t.push(n))}let s=new Set;for(let e of t)for(let t of n(e))o.get(t)!==o.get(e)&&s.add(o.get(t));return{".":{dependencies:t.filter(e=>!s.has(o.get(e)))}}}function i(e,t){let r=new Map(e.map(e=>[e,new Set]));for(let n=!0;n;){n=!1;for(let i of e)for(let{to:e,extras:a}of t(i,r.get(i)))for(let t of e)for(let e of a){let i=r.get(t);i&&!i.has(e)&&(i.add(e),n=!0)}}return new Map(e.map(e=>[e,n(t(e,r.get(e)).flatMap(e=>e.to)).filter(t=>t!==e)]))}function a(e){let t=new Set;return e.map((e,n)=>{let r=e.version===void 0?e.name:`${e.name}==${e.version}`,i=t.has(r)?`${r} (${n})`:r;return t.add(i),i})}var o=e=>e.toLowerCase().replaceAll(/[-_.]+/gu,`-`);function s(e){if(typeof e!=`string`)return null;try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)&&t.workspaces===void 0?t:null}catch{return null}}function c(e,t){if(typeof e!=`string`)return null;try{let r=JSON.parse(e);return n([r?.require,r?.[`require-dev`]].flatMap(e=>e&&typeof e==`object`&&!Array.isArray(e)?Object.keys(e):[]).flatMap(e=>t(e.toLowerCase())))}catch{return null}}var l={async npm(t){let{parseNpmLockfile:n}=await import(`./chunk-55YIWY3H.js`),r=e=>Object.values(e.edges).map(e=>e.target).filter(e=>e!==void 0),{importers:i,packages:a}=n(t,{checkVersions:!1});return{importers:e(i,e=>({version:e.version,dependencies:r(e)})),packages:e(a,e=>({name:e.name,version:e.version,dependencies:r(e)}))}},async pnpm(n,r,{env:i=!1}={}){let{parsePnpmLockfile:a}=await import(`./chunk-PKLVXUEI.js`),{lockfile:o,env:s}=a(n),c={importers:e(o?.importers??{},e=>({dependencies:t(e.dependencies,e.devDependencies,e.optionalDependencies)})),packages:e(o?.packages??{},e=>({name:e.name,version:e.version,dependencies:t(e.dependencies,e.optionalDependencies)}))};if(!i||!s)return c;let l=e=>`env:${e}`,u=s.importers?.[`.`]??{};c.importers[`.`]={...c.importers[`.`],dependencies:[...c.importers[`.`]?.dependencies??[],...t(u.configDependencies??{},u.packageManagerDependencies??{}).map(l)]};for(let[e,n]of Object.entries(s.packages??{}))c.packages[l(e)]={name:n.name,version:n.version,dependencies:t(n.dependencies??{},n.optionalDependencies??{}).map(l)};return c},async yarn(n,r){if(/^__metadata:/mu.test(n))throw Error(`a yarn.lock of Yarn 2 or later, which is not read`);let{parseYarn1Lockfile:i}=await import(`./chunk-B64CTMVU.js`),a=s(r),{importers:o,packages:c}=i(n,{checkVersions:!1,...a&&{manifests:{".":a}}}),l=new Map;for(let[e,t]of Object.entries(c))l.has(t)||l.set(t,e);let u=e=>e.startsWith(`link:`)?e:l.get(c[e]);return{importers:e(o??{},e=>({version:a.version,dependencies:t(e.dependencies,e.devDependencies,e.optionalDependencies).map(u)})),packages:Object.fromEntries([...l].map(([e,n])=>[n,{name:/@npm:((?:@[^/@]+\/)?[^/@]+)/u.exec(e.patterns[0]??``)?.[1]??e.name,version:e.version,dependencies:t(e.dependencies,e.optionalDependencies).map(u)}]))}},async bundler(t){let{parseGemfileLock:n}=await import(`./chunk-XM4RLC4A.js`),{specs:r,gems:i,dependencies:a}=n(t),o=e=>Object.hasOwn(i,e)?i[e]:[];return{importers:{".":{dependencies:Object.keys(a).flatMap(o)}},packages:e(r,e=>({name:e.name,version:e.platform===`ruby`?e.version:`${e.version}-${e.platform}`,dependencies:Object.keys(e.dependencies).flatMap(o)}))}},async cargo(e){let{parseCargoLock:t}=await import(`./chunk-RPNO56H2.js`),n=Object.entries(t(e).packages),r=n.filter(([,e])=>e.source===void 0),i=new Map;for(let[,e]of r)i.set(e.name,(i.get(e.name)??0)+1);let a=new Map(r.map(([e,t])=>[e,i.get(t.name)>1?e:t.name])),o=e=>a.has(e)?`link:${a.get(e)}`:e;return{importers:Object.fromEntries(r.map(([e,t])=>[a.get(e),{version:t.version,dependencies:t.dependencies.map(o)}])),packages:Object.fromEntries(n.filter(([e])=>!a.has(e)).map(([e,t])=>[e,{name:t.name,version:t.version,dependencies:t.dependencies.map(o)}]))}},async cocoapods(t){let{parsePodfileLock:r}=await import(`./chunk-BEKYZCPX.js`),{pods:i,dependencies:a}=await r(t),o=({name:e})=>Object.hasOwn(i,e)?[e]:[];return{importers:{".":{dependencies:n(a.flatMap(o))}},packages:e(i,e=>({name:e.root,version:e.version,dependencies:n(e.dependencies.flatMap(o))}))}},async composer(t,i){let{parseComposerLock:a}=await import(`./chunk-QD3IBSF4.js`),o=a(t).packages,s=e(o,e=>({name:e.name,version:e.version,dependencies:n(Object.values(e.require).flatMap(e=>e.targets))})),l=new Map;for(let[e,t]of Object.entries(o))for(let n of[...Object.keys(t.provide),...Object.keys(t.replace)])l.set(n,[...l.get(n)??[],e]);let u=c(i,e=>Object.hasOwn(s,e)?[e]:l.get(e)??[]);return{importers:u?{".":{dependencies:u}}:r(s),packages:s}},async poetry(e){let{parsePoetryLock:t}=await import(`./chunk-VHEXSGGP.js`),s=t(e).packages,c=a(s),l=Map.groupBy(c,(e,t)=>o(s[t].name)),u=new Map(c.map((e,t)=>[e,s[t]])),d=i(c,(e,t)=>{let r=u.get(e),i=new Set([...t].flatMap(e=>(r.extras[e]??[]).map(e=>o(/^[\w.-]+/u.exec(e)?.[0]??``))));return Object.entries(r.dependencies).filter(([e,t])=>t.some(e=>!e.optional)||i.has(o(e))).map(([e,t])=>({to:l.get(o(e))??[],extras:n(t.flatMap(e=>e.extras))}))}),f=Object.fromEntries(c.map((e,t)=>[e,{name:s[t].name,version:s[t].version,dependencies:d.get(e)}]));return{importers:r(f),packages:f}},async uv(e){let{parseUvLock:t}=await import(`./chunk-FSU2PLJL.js`),{packages:n,members:a}=t(e),o=new Map(a.map(e=>[e,n[e].source.path??e])),s=Object.keys(n),c=i(s,(e,t)=>{let r=n[e],i=o.has(e)?[...Object.values(r.optionalDependencies),...Object.values(r.devDependencies)].flat():[...t].flatMap(e=>r.optionalDependencies[e]??[]);return[...r.dependencies,...i].map(e=>({to:[e.package],extras:e.extras}))}),l=e=>o.has(e)?`link:${o.get(e)}`:e,u=Object.fromEntries(s.filter(e=>!o.has(e)).map(e=>[e,{name:n[e].name,version:n[e].version,dependencies:c.get(e).map(l)}])),d=Object.fromEntries(a.map(e=>[o.get(e),{version:n[e].version,dependencies:c.get(e).map(l)}]));return{importers:a.length>0?d:r(u),packages:u}},async pylock(e){let{parsePylock:t}=await import(`./chunk-LVSLM7HB.js`),i=t(e).packages,o=a(i),s=Object.fromEntries(o.map((e,t)=>[e,{name:i[t].name,version:i[t].version,dependencies:n(i[t].dependencies.map(e=>o[e]))}]));return{importers:r(s),packages:s}},async soldeer(e){let{parseSoldeerLockfile:t}=await import(`./chunk-6Y6PZ2BU.js`),n=Object.fromEntries(Object.values(t(e).dependencies).map(e=>[`${e.name}@${e.version}`,{name:e.name,version:e.version,dependencies:[]}]));return{importers:{".":{dependencies:Object.keys(n)}},packages:n}},async foundry(e){let{parseFoundryLockfile:t}=await import(`./chunk-EEJA7JBI.js`),n=Object.fromEntries(Object.entries(t(e).dependencies).map(([e,t])=>[e,{name:e.slice(e.lastIndexOf(`/`)+1),version:t.type===`tag`?t.name:t.type===`branch`?`${t.name}@${t.rev.slice(0,7)}`:t.rev.slice(0,12),dependencies:[]}]));return{importers:{".":{dependencies:Object.keys(n)}},packages:n}}};async function u(e,t,{manifest:n,env:r=!1}={}){if(!Object.hasOwn(l,e))throw TypeError(`readLockfile: ${e} lockfiles are not read`);return await l[e](t,n,{env:r})}export{u as readLockfile};
@@ -0,0 +1 @@
1
+ import{b as e,c as t,f as n,g as r,h as i,i as a,j as o,m as s,o as c,p as l,q as u,r as d}from"./chunk-CU3FPB3P.js";import{a as f,c as p,d as m,e as h,f as g,g as _,i as v,j as y,k as b,l as x,m as S,n as C,o as w,p as T}from"./chunk-GX5UXWT4.js";import{B as E,H as D,I as O,M as k,m as A,t as j}from"./chunk-LVW7WWV4.js";import"./chunk-ZQHLECTI.js";import{a as M,e as ee,g as N}from"./chunk-VYYUMYVW.js";import{d as P,h as F,i as I}from"./chunk-7HP2VYIC.js";import"./chunk-PXK7EU4V.js";import"./chunk-OOJM4CTU.js";var L=Object.fromEntries([`md5`,`sha1`,`sha224`,`sha256`,`sha384`,`sha512`].map(e=>[e,s[e]]));function R(e,t){let n=URL.parse(k(v(e,t),t));if(!/^[\w.-]+@[\w.-]+:./u.test(e)&&(n===null||![`https:`,`http:`,`ssh:`,`git:`,`file:`].includes(n.protocol)))throw new P(`${F(e)} is not a repository URL`,t);return e}var z={version:[`version`],path:[`path`,`develop`],url:[`url`],git:[`git`,`branch`,`tag`,`rev`,`subdirectory`]},B=Object.keys(z),V=new Set([`extras`,`optional`,`markers`]),H=[...new Set(Object.values(z).flat()),...V];function U(e,t,n){let r=I(n,e);if(e===`version`)return{version:v(t.version,r)};if(e===`path`)return{path:u(t.path,r),develop:A(t,`develop`,n,_)??!1};if(e===`url`)return{url:l(t.url,r)};let i=[`branch`,`tag`,`rev`].filter(e=>t[e]!==void 0);if(i.length>1)throw new P(`${i.join(` and `)}, of which Poetry writes one`,n);return{git:R(t.git,r),reference:i.length===0?void 0:{kind:i[0],name:v(t[i[0]],I(n,i[0]))},subdirectory:A(t,`subdirectory`,n,d)}}function W(e,t){if(typeof e==`string`)return{type:`version`,version:v(e,t),extras:[],optional:!1,markers:void 0};p(e,t,H);let n=w(e,B,t),r=H.find(t=>e[t]!==void 0&&!z[n].includes(t)&&!V.has(t));if(r!==void 0)throw new P(`a field Poetry does not write for a ${n} dependency`,I(t,r));return{type:n,...U(n,e,t),extras:A(e,`extras`,t,x(i))??[],optional:A(e,`optional`,t,_)??!1,markers:A(e,`markers`,t,a)}}function G(e,t){let i=Object.create(null);if(e===void 0)return i;let a=new Map;for(let[o,s,c]of m(e,t)){let e=n(r(o,c));if(a.has(e))throw new P(`${F(o)} and ${F(a.get(e))} are one name`,c);if(a.set(e,o),Array.isArray(s)&&s.length===0)throw new P(`an empty array, where Poetry writes a constraint`,c);i[o]=Array.isArray(s)?b(W)(s,c):[W(s,c)]}return i}function K(e,t){let n=new Set;return b((e,t)=>{p(e,t,[`file`,`hash`]);let r=v(e.file,I(t,`file`));if(!E(r)||r.includes(`/`))throw new P(`${F(r)} is not a file's name`,I(t,`file`));if(n.has(r))throw new P(`${F(r)} is listed twice`,t);return n.add(r),{file:r,hash:c(e.hash,I(t,`hash`),L)}})(e,t)}var q=(e,t)=>C(e,t,i,x(o)),J={legacy:[`url`,`reference`],git:[`url`,`reference`,`resolved_reference`,`subdirectory`],url:[`url`,`subdirectory`],file:[`url`],directory:[`url`]},Y=y(D,`a full commit hash, as Poetry writes`);function X(e,t){let n=g(p(e,t).type,I(t,`type`));if(!Object.hasOwn(J,n))throw new P(`expected one of ${Object.keys(J).join(`, `)}`,I(t,`type`));p(e,t,[`type`,...J[n]]);let r=I(t,`url`),i=A(e,`subdirectory`,t,d);return n===`legacy`?{type:n,url:l(e.url,r),name:v(e.reference,I(t,`reference`))}:n===`url`?{type:n,url:l(e.url,r),subdirectory:i}:n===`file`||n===`directory`?{type:n,path:u(e.url,r)}:{type:n,url:R(e.url,r),reference:A(e,`reference`,t,v),commit:Y(e.resolved_reference,I(t,`resolved_reference`)),subdirectory:i}}var Z=[`package`,`extras`,`metadata`],Q=[`name`,`version`,`description`,`optional`,`python-versions`,`files`,`dependencies`,`extras`,`source`,`develop`],te=[...Q,`groups`,`markers`],ne={category:"`category` is lock-version 1, which Poetry 1.4 and older write and is not read here"};function $(e,t){if(e===`2.0`||e===`2.1`)return e;throw typeof e==`string`&&/^1\.\d+$/u.test(e)?new P(`lock-version ${e} is Poetry 1.4's or older, which is not read here`,t):new P(`unsupported lock-version: expected "2.0" or "2.1", found ${f(e)}`,t)}function re(e){p(e,`metadata`,[`lock-version`,`python-versions`,`content-hash`],{files:`metadata.files is lock-version 1, which is not read here`,hashes:`metadata.hashes is lock-version 1, which is not read here`});let t=e=>I(`metadata`,e),n=y(O,`a hex sha256`)(e[`content-hash`],t(`content-hash`));return{lockVersion:$(e[`lock-version`],t(`lock-version`)),pythonVersions:v(e[`python-versions`],t(`python-versions`)),contentHash:n}}function ie(e,t,n){let r=typeof e==`string`?a(e,n):void 0,i=Object.create(null);for(let e of t)i[e]=r;if(e===void 0||r!==void 0)return i;for(let[t,r,o]of m(e,n)){if(!Object.hasOwn(i,t))throw new P(`${F(t)} is not one of the package's groups`,o);i[t]=a(r,o)}return i}function ae(e,t){let n=S(e,t,i);if(n.length===0)throw new P(`expected a group at least`,t);let r=j(n);if(r!==void 0)throw new P(`${F(r)} is listed twice`,t);return n}function oe(e,n,i){p(e,n,i===`2.1`?te:Q,ne);let a=A(e,`source`,n,X),o=a?.type===`directory`||a?.type===`git`;if(o&&e.develop===void 0)throw new P(`expected develop, which Poetry writes of a directory or a git source`,n);if(!o&&e.develop!==void 0)throw new P(`develop, which Poetry writes of a directory or a git source alone`,I(n,`develop`));let s=i===`2.1`?ae(e.groups,I(n,`groups`)):void 0;return{name:r(e.name,I(n,`name`)),version:t(e.version,I(n,`version`)),description:A(e,`description`,n,g)??``,optional:_(e.optional,I(n,`optional`)),pythonVersions:v(e[`python-versions`],I(n,`python-versions`)),groups:s,markers:s===void 0?void 0:ie(e.markers,s,I(n,`markers`)),files:K(e.files,I(n,`files`)),dependencies:G(e.dependencies,I(n,`dependencies`)),extras:q(e.extras,I(n,`extras`)),source:a,develop:A(e,`develop`,n,_)}}function se(e,t){return C(e,`extras`,i,x((e,i)=>{if(!t.has(n(r(e,i))))throw new P(`${F(e)} names no package in the lockfile`,i);return e}))}var ce=t=>JSON.stringify([n(t.name),e(t.version),t.source??null]);function le(e){let t=p(N(e),void 0,Z);if(!ee(t.metadata))throw new P(`expected a [metadata] table, which Poetry requires`,`metadata`);let{lockVersion:r,pythonVersions:i,contentHash:a}=re(t.metadata),o=h(t.package??[],`package`).map((e,t)=>oe(e,`package[${t}]`,r));return T(o,ce,e=>`${e.name} ${e.version}`),{lockVersion:r,pythonVersions:i,contentHash:a,extras:se(t.extras,new Set(o.map(e=>n(e.name)))),packages:o}}export{P as LockfileError,M as TomlError,le as parsePoetryLock};
@@ -0,0 +1,9 @@
1
+ import{a as e,b as t,c as n,n as r}from"./chunk-7HP2VYIC.js";var i=class extends n{};function a(e,t,n){if(!e)throw new i(typeof n==`function`?n():n,t.line)}var o=/^(\d{4})-(\d\d)-(\d\d)([Tt])(\d\d):(\d\d):(\d\d)(\.\d+)?(?:([Zz])|([+-])(\d\d):(\d\d))$/u,s=/^(?:\d{4}-\d\d-\d\d(?:[Tt]\d\d:\d\d:\d\d(?:\.\d+)?)?|\d\d:\d\d:\d\d(?:\.\d+)?)$/u,c=/^(?:\d{4}-\d\d-\d\d[Tt])?\d\d:\d\d(?:[Zz]|[+-]\d\d:\d\d)?$/u,l=[31,28,31,30,31,30,31,31,30,31,30,31];function u(e){let t=o.exec(e);if(t===null)return;let[n,r,i,a,s,c]=[t[1],t[2],t[3],t[5],t[6],t[7]].map(Number),u=n%4==0&&n%100!=0||n%400==0;if(r<1||r>12||i<1||i>(r===2&&u?29:l[r-1])||a>23||s>59||c>60||t[10]!==void 0&&(Number(t[11])>23||Number(t[12])>59))return;let d=[];(t[4]===`t`||t[9]===`z`)&&d.push(`a date-time with a lower-case "t" or "z" is not supported`),n===0&&d.push(`the year 0000 is not supported`),c===60&&d.push(`a leap second is not supported`);let f=t[10]===void 0?0:(t[10]===`-`?-1:1)*(Number(t[11])*60+Number(t[12]));return{year:n,month:r,day:i,hour:a,minute:s,second:c,fraction:t[8]?.slice(1)??``,offset:f,unsupported:d}}var d=class{constructor(e){if(typeof e!=`string`||u(e)?.unsupported.length!==0)throw TypeError(`expected an RFC 3339 offset date-time`);this.text=e,Object.freeze(this)}toString(){return this.text}toJSON(){return this.text}toDate(){let{year:e,month:t,day:n,hour:r,minute:i,second:a,fraction:o,offset:s}=u(this.text),c=new Date(0);return c.setUTCFullYear(e,t-1,n),c.setUTCHours(r,i-s,a,Number(o.padEnd(3,`0`).slice(0,3))),c}},f=e=>u(e)?.unsupported.length===0;function ee(e,n){if(!/^(?:\d{4}-\d\d-\d\d|\d\d:\d\d)/u.test(e))return;let r=u(e);if(r?.unsupported.length===0)return new d(e);throw a(!(/^\d{4}-\d\d-\d\d$/u.test(e)&&/^ \d\d:/u.test(n.text.slice(n.pos,n.pos+4))),n,`a date-time with a space in place of "T" is not supported`),a(!s.test(e),n,()=>`local dates and times are not supported: ${t(e)}`),a(!c.test(e),n,()=>`a date-time or a time without seconds is not supported: ${t(e)}`),a(r?.unsupported.length!==1,n,()=>`${r.unsupported[0]}: ${t(e)}`),new i(`${t(e)} is not a date-time of the form YYYY-MM-DDTHH:MM:SS[.fraction](Z|\xB1HH:MM)`,n.line)}var p=/^[+-]?(?:0|[1-9](?:_?\d)*)$/u,m=/^0(?:x[\dA-Fa-f](?:_?[\dA-Fa-f])*|o[0-7](?:_?[0-7])*|b[01](?:_?[01])*)$/u,h=/^[+-]?(?:inf|nan|(?:0|[1-9](?:_?\d)*)(?:\.\d(?:_?\d)*(?:[Ee][+-]?\d(?:_?\d)*)?|[Ee][+-]?\d(?:_?\d)*))$/u,g=2n**63n,_=BigInt(2**53-1),te={__proto__:null,x:16,o:21,b:63};function v(e,n){let r=p.test(e);if(!r&&!m.test(e))return;let i=e.replaceAll(`_`,``),o=r?i.replace(/^[+-]/u,``):i.slice(2).replace(/^0+/u,``),s=o.length<=(r?19:te[i[1]])?BigInt(r?i:`${i.slice(0,2)}${o||`0`}`):void 0;return a(s!==void 0&&s>=-g&&s<g,n,()=>`integer out of range ${t(e)}`),s>=-_&&s<=_?Number(s):s}var y={__proto__:null,inf:1/0,"+inf":1/0,"-inf":-1/0,nan:NaN,"+nan":NaN,"-nan":NaN};function b(e){if(typeof e!=`string`||!h.test(e))return;if(e in y)return y[e];let t=Number(e.replaceAll(`_`,``)),n=!/[1-9]/u.test(e.split(/[Ee]/u)[0]);return Number.isFinite(t)&&(t!==0||n)?t:null}var x=class{constructor(e){let t=b(e);if(t==null)throw TypeError(`expected a TOML float that a double can hold`);this.text=e,this.value=t,Object.freeze(this)}valueOf(){return this.value}toString(){return this.text}toJSON(){return this.value}};function S(e,n){let r=b(e);if(r!==void 0)return a(r!==null,n,()=>`float out of range ${t(e)}`),new x(e)}var C=64;function w(e){for(;e.text[e.pos]===` `||e.text[e.pos]===` `;)e.pos++}function T(e){if(e.pos>=e.text.length)return`the end of the text`;let n=/^[^\n]*/u.exec(e.text.slice(e.pos,e.pos+64+1))[0].replace(/\r$/u,``);return n===``?`the end of the line`:t(n)}var E=`a carriage return must be followed by a line feed`;function D(t,n,r){throw new i(n===`\r`?E:`${e(n)} is not allowed in ${r}`,t.line)}var O=e=>e.pos>=e.text.length||e.text[e.pos]===`
2
+ `||e.text.startsWith(`\r
3
+ `,e.pos),k=/#[^[\p{Cc}--[\t\u0080-\u009F]]]*/vy;function A(e){e.text[e.pos]===`#`&&(r(e,k),O(e)||D(e,e.text[e.pos],`a comment`))}function j(e){if(e.text[e.pos]===`
4
+ `)e.pos+=1;else if(e.text.startsWith(`\r
5
+ `,e.pos))e.pos+=2;else return!1;return e.line++,!0}function M(e){do w(e),A(e);while(j(e))}var N={__proto__:null,b:`\b`,t:` `,n:`
6
+ `,f:`\f`,r:`\r`,'"':`"`,"\\":`\\`},ne={__proto__:null,'"':/[^"\\[\p{Cc}--[\t\u0080-\u009F]]]*/vy,"'":/[^'[\p{Cc}--[\t\u0080-\u009F]]]*/vy},re=/u([\dA-Fa-f]{4})|U([\dA-Fa-f]{8})/uy;function P(e){let n=e.text[e.pos];if(n in N)return N[e.text[e.pos++]];let i=r(e,re);a(i!==null,e,()=>`unsupported escape ${t(`\\${n??``}`)}`);let o=Number.parseInt(i[1]??i[2],16);return a(o<=1114111&&(o<55296||o>57343),e,()=>`\\${i[0]} is not a Unicode scalar value`),String.fromCodePoint(o)}var ie=/[\t ]*\r?\n(?:[\t ]|\r?\n)*/uy;function ae(e){let t=r(e,ie);return t===null?P(e):(e.line+=t[0].split(`
7
+ `).length-1,``)}var F=(e,t)=>e.text[e.pos+1]===t&&e.text[e.pos+2]===t,I={__proto__:null,'"':/"/uy,"'":/'/uy,'"""':/"{3,5}/uy,"'''":/'{3,5}/uy};function L(e,t){let n=F(e,t),i=I[n?t.repeat(3):t];e.pos+=n?3:1,n&&j(e);let o=``;for(;;){if(o+=r(e,ne[t])[0],n&&j(e)){o+=`
8
+ `;continue}a(!O(e),e,`unterminated string`);let s=r(e,i);if(s!==null)return o+s[0].slice(3);let c=e.text[e.pos++];c===t?o+=c:c===`\\`?o+=n?ae(e):P(e):D(e,c,`a string`)}}var R=/[\w-]+/uy;function z(e){let t=e.text[e.pos];if(t===`"`||t===`'`)return a(!F(e,t),e,`a multi-line string cannot be a key`),L(e,t);let n=r(e,R);return a(n!==null,e,()=>`expected a key, found ${T(e)}`),n[0]}function B(e){let t=[z(e)];for(;;){if(w(e),e.text[e.pos]!==`.`)return t;e.pos++,w(e),t.push(z(e)),a(t.length<=C,e,`a key with too many parts`)}}var V=/[\w+.:-]+/uy;function H(e){let n=r(e,V);a(n!==null,e,()=>`expected a value, found ${T(e)}`);let i=n[0];if(i===`true`)return!0;if(i===`false`)return!1;let o=v(i,e)??S(i,e)??ee(i,e);return a(o!==void 0,e,()=>`expected a value, found ${t(i)}`),o}function U(e,n,r,i){a(n[r]===void 0,e,()=>`duplicate key ${t(r)}`),n[r]=i}function W(e,t){let n=B(e);return a(e.text[e.pos]===`=`,e,()=>`expected "=" after the key, found ${T(e)}`),e.pos++,w(e),{header:!1,keys:n,value:X(e,t)}}function G(e,t){e.pos++;let n=[];for(M(e);e.text[e.pos]!==`]`&&(n.push(X(e,t+1)),M(e),e.text[e.pos]!==`]`);M(e))a(e.text[e.pos]===`,`,e,()=>`expected "," or "]", found ${T(e)}`),e.pos++;return e.pos++,n}var K=e=>typeof e==`object`&&!!e&&Object.getPrototypeOf(e)===null,q=new WeakSet,oe=e=>q.has(e);function J(e,t,n,r,i,o){let s=t;for(let t of r.slice(0,-1)){t in s||n.add(s[t]=Object.create(null));let r=s[t];a(n.has(r),e,()=>o(t,r)),s=r}U(e,s,r.at(-1),i)}var se=e=>Array.isArray(e)?`an array`:K(e)?`an inline table`:`a value`,ce=(e,n)=>`${t(e)} is ${se(n)}, which a dotted key cannot add to`;function Y(e){w(e),a(!O(e)&&e.text[e.pos]!==`#`,e,`an inline table across lines is not supported`)}function le(e,t){e.pos++;let n=Object.create(null);q.add(n);let r=new Set;if(Y(e),e.text[e.pos]===`}`)e.pos++;else do{Y(e),a(e.text[e.pos]!==`}`,e,`a trailing comma in an inline table is not supported`);let{keys:i,value:o}=W(e,t+1);J(e,n,r,i,o,ce),Y(e);let s=e.text[e.pos];a(s===`,`||s===`}`,e,()=>`expected "," or "}" on the inline table's line, found ${T(e)}`)}while(e.text[e.pos++]===`,`);return n}function X(e,t){a(t<=C,e,`nested too deep`);let n=e.text[e.pos];return n===`"`||n===`'`?L(e,n):n===`[`?G(e,t):n===`{`?le(e,t):H(e)}function ue(e){let t=e.text.startsWith(`[[`,e.pos);e.pos+=t?2:1,w(e);let n=B(e),r=t?`]]`:`]`;return a(e.text.startsWith(r,e.pos),e,()=>`expected "${r}", found ${T(e)}`),e.pos+=r.length,{header:!0,keys:n,array:t}}function de(e){w(e);let t=e.text[e.pos];if(t===`[`)return ue(e);if(!(t===`#`||t===`\r`||O(e)))return W(e,0)}function fe(e){if(w(e),A(e),!(j(e)||e.pos===e.text.length))throw a(e.text[e.pos]!==`\r`,e,E),new i(`expected the end of the line, found ${T(e)}`,e.line)}function Z(e,t){return e.arrays.has(t)?`an array of tables`:Array.isArray(t)?`an array`:K(t)?e.fixed.has(t)?`an inline table`:`a table`:`a value`}var Q=e=>t(e.join(`.`));function pe(e,n,r){let i=e.root;for(let o of r){o in i||e.implicit.add(i[o]=Object.create(null));let r=e.arrays.has(i[o])?i[o].at(-1):i[o];a(K(r)&&!e.fixed.has(r),n,()=>`${t(o)} is ${Z(e,r)}, which a header cannot add to`),i=r}return i}function $(e,t,n,r){e.pending.clear();let i=pe(e,t,n.slice(0,-1)),o=n.at(-1);r?(o in i||e.arrays.add(i[o]=[]),a(e.arrays.has(i[o]),t,()=>`${Q(n)} is ${Z(e,i[o])}, not an array of tables`),i[o].push(e.current=Object.create(null))):(o in i?a(e.implicit.delete(i[o]),t,()=>`${Q(n)} is ${Z(e,i[o])} already`):i[o]=Object.create(null),e.current=i[o])}function me(e,n,r){return!K(r)||e.fixed.has(r)?`${t(n)} is ${Z(e,r)}, which a dotted key cannot add to`:e.implicit.has(r)?`a dotted key through ${t(n)}, a table a header made on its way, is not supported`:`${t(n)} is a table declared elsewhere, which a dotted key cannot add to`}function he(e,t,n,r){J(t,e.current,e.pending,n,r,(t,n)=>me(e,t,n)),K(r)&&e.fixed.add(r)}var ge={__proto__:null,"":`a byte order mark is not read`,"�":`U+FFFD is not supported: a decoder puts it where bytes are not UTF-8`};function _e(e){if(typeof e!=`string`)throw TypeError(`expected a string`);let t=/\p{Cs}|^\uFEFF|\uFFFD/u.exec(e);if(t===null)return;let n=e.slice(0,t.index).split(`
9
+ `).length-1;throw new i(ge[t[0]]??`a lone surrogate is not well-formed Unicode`,n)}function ve(e){_e(e);let t=Object.create(null),n={text:e,pos:0,line:0},r={root:t,current:t,implicit:new Set,pending:new Set,arrays:new Set,fixed:new Set};for(;n.pos<e.length;){let e=de(n);e?.header===!0?$(r,n,e.keys,e.array):e!==void 0&&he(r,n,e.keys,e.value),fe(n)}return t}export{i as a,d as b,f as c,x as d,K as e,oe as f,ve as g};
@@ -0,0 +1 @@
1
+ var e=/^\d+(?:\.[\dA-Za-z]+)*$/u,t=t=>e.test(t),n=e=>/[A-Za-z]/u.test(e),r=e=>(e.match(/\d+|[A-Za-z]+/gu)??[]).map(e=>/^\d/u.test(e)?BigInt(e):e),i=e=>Array.from(e.matchAll(/[.0]+/gu),e=>[e.index,e.index+e[0].length]);function a(e,[t,n],r){for(let i=t;i<n;i++)if(r(e[i-1]))return i}function o(e){let t=e.length;for(;e[t-1]===`.`||e[t-1]===`0`;)t--;let o=t<e.length?a(e,[t,e.length],e=>e!==void 0&&/[A-Za-z.]/u.test(e)):void 0,s=e.slice(0,o);if(!n(e))return r(s);for(let e of i(s)){let t=/[A-Za-z]/u.test(s[e[1]]??``)?a(s,e,e=>e===void 0||e===`.`):void 0;if(t!==void 0)return r(`${s.slice(0,t)}${s.slice(e[1])}`)}return r(s)}var s=(e,t)=>e<t?-1:+(e>t);function c(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let[r,i]=[e[n]??0n,t[n]??0n];if(r!==i)return typeof r==typeof i?s(r,i):typeof r==`string`?-1:1}return 0}var l=(e,t)=>e===t?0:c(o(e),o(t));function u(e){let t=r(e),n=t.findIndex(e=>typeof e==`string`);return n===-1?t:t.slice(0,n)}var d=e=>n(e)?u(e).join(`.`):e;function f(e){let t=u(e);return t.length>1&&t.pop(),t[t.length-1]+=1n,t.join(`.`)}var p={__proto__:null,"=":e=>e===0,"!=":e=>e!==0,">":e=>e>0,"<":e=>e<0,">=":e=>e>=0,"<=":e=>e<=0},m=/^(=|!=|>|<|>=|<=|~>) (\S+)$/u;function h(e,n=t){let r=m.exec(e);return r===null||!n(r[2])?void 0:[r[1],r[2]]}function g(e,[t,n]){return t===`~>`?l(e,n)>=0&&l(d(e),f(n))<0:p[t](l(e,n))}function _(e){let t=e.map(o),r=e.map((e,r)=>n(e)?o(d(e)):t[r]);return{sorted:t.sort(c),release:r.sort(c).at(-1),keys:void 0}}function v(e,[t,n]){let r=o(n);if(t===`!=`)return!(e.keys??=new Set(e.sorted.map(e=>e.join(`.`)))).has(r.join(`.`));let i=c(e.sorted[0],r);return t===`~>`?i>=0&&c(e.release,o(f(n)))<0:p[t](i)&&p[t](c(e.sorted.at(-1),r))}export{t as a,l as b,h as c,g as d,_ as e,v as f};
@@ -0,0 +1 @@
1
+ import{Va as e,Xa as t}from"./chunk-DOYTKRIR.js";import{n,q as r,w as i}from"./chunk-5M2X3QPK.js";import{a}from"./chunk-74JZTGTO.js";import{b as o}from"./chunk-IYPY47MC.js";import{D as s,J as c,L as l,q as u}from"./chunk-QRKFPLA4.js";function d(e){let{data:t}=l(e);return t&&f(t)>0?t:null}function f(e){return(c(e)??[]).filter(t=>(Array.isArray(t)?t:[t]).some(t=>t&&typeof t==`object`&&u(t,t.source??e.source))).length}function p(e,t){let n=[],r=new Map;for(let{name:t,content:i,fallbackRepo:a}of e){if(typeof i!=`string`)continue;let e=d(i);if(!e)continue;let o=c(e),l=s(e)??s({repo:{github:a}}),u=new Set(l?[l]:[]);if(!l)for(let e of o.flat()){if(/(?:^|\/)(?:node_modules|dependencies)\//u.test(e?.file??``))continue;let t=s(e);t&&u.add(t)}for(let e of u)r.set(e,{id:e,label:e});n.push({id:t,filename:t,repoIds:[...u],analyzer:e.source,appFindings:f(e)})}let i=new Set(n.map(e=>e.id));return{merge:{bundles:[],results:[]},link:{reports:n,repositories:[...r.values()],workspaces:t.map(e=>({id:e.id,label:e.name,reports:e.reports.filter(e=>i.has(e))})).filter(e=>e.reports.length>0)}}}function m(e,t){let n=(e.reports??[]).filter(e=>e.visible&&e.repoId!=null).flatMap(e=>{let t=d(e.content??``);return t?[{id:e.id,filename:e.filename,repoIds:[e.repoId],repo:e.repoFullName,directory:e.repoDirectory,analyzer:e.analyzer,appFindings:f(t)}]:[]}),r=new Map((e.repos??[]).map(e=>[e.repoId,{id:e.repoId,label:e.fullName}]));for(let e of n)r.has(e.repoIds[0])||r.set(e.repoIds[0],{id:e.repoIds[0],label:e.repo??String(e.repoIds[0])});let i=t.results??[],o=new Set(i.map(e=>e.bundleId));return{merge:{bundles:(t.bundles??[]).filter(e=>o.has(e.id)).map(e=>({...e,size:a(e.byteSize)})),results:i},link:{repositories:[...r.values()].filter(e=>n.some(t=>t.repoIds.includes(e.id))),reports:n}}}var h=new Map([[`openai/gpt-6-astra`,`GPT-6 Astra`],[`openai/gpt-6-astra-pro`,`GPT-6 Astra Pro`],[`openai/gpt-5.6-sol`,`GPT-5.6 Sol`],[`openai/gpt-5.6-terra`,`GPT-5.6 Terra`],[`openai/gpt-5.6-luna`,`GPT-5.6 Luna`],[`anthropic/claude-fable-5.1`,`Claude Fable 5.1`],[`anthropic/claude-opus-5`,`Claude Opus 5`],[`anthropic/claude-sonnet-5`,`Claude Sonnet 5`],[`moonshotai/kimi-k3`,`Kimi K3`],[`z-ai/glm-5.3`,`GLM 5.3`],[`qwen/qwen3.8-max`,`Qwen3.8 Max`],[`qwen/qwen4-max`,`Qwen4 Max`],[`deepseek/deepseek-v4.1-flash`,`DeepSeek V4.1 Flash`],[`deepseek/deepseek-v4-pro`,`DeepSeek V4 Pro`]]),g=new Map([[`openai`,`OpenAI`],[`anthropic`,`Anthropic`],[`moonshotai`,`Moonshot AI`],[`google`,`Google`],[`nvidia`,`NVIDIA`],[`qwen`,`Qwen`],[`deepseek`,`DeepSeek`],[`x-ai`,`xAI`],[`z-ai`,`Z.ai`],[`mistralai`,`Mistral AI`],[`meta`,`Meta`],[`unbiased`,`Unbiased`]]),_=new Map([[`meta-llama`,`meta`]]),v=new Map([[`gpt`,`GPT`],[`gptoss`,`GPT OSS`],[`oss`,`OSS`],[`o`,`O`],[`ai`,`AI`],[`api`,`API`],[`4o`,`4o`],[`k3`,`K3`],[`k4`,`K4`],[`qwen`,`Qwen`],[`kimi`,`Kimi`],[`mimo`,`MiMo`],[`gemini`,`Gemini`],[`claude`,`Claude`],[`fable`,`Fable`],[`opus`,`Opus`],[`sonnet`,`Sonnet`],[`astra`,`Astra`],[`terra`,`Terra`],[`luna`,`Luna`],[`codex`,`Codex`],[`deepseek`,`DeepSeek`],[`nemotron`,`Nemotron`],[`gemma`,`Gemma`]]);function y(e){let t=e.replace(/:free$/u,``).replaceAll(`_`,`-`).split(`-`).filter(Boolean),n=[];for(let e=0;e<t.length;e++){let r=t[e],i=t[e+1];if(/^\d+$/u.test(r)&&/^\d+$/u.test(i??``)){n.push(`${r}.${i}`),e++;continue}let a=v.get(r.toLowerCase());n.push(a??(/^(?:[a-z]+\d+|\d+[a-z]+)$/iu.test(r)?r.toUpperCase():r[0]?.toUpperCase()+r.slice(1)))}return n.join(` `).replace(/^GPT (\d)/u,`GPT-$1`)}function b(e){return h.get(e)??y(e.includes(`/`)?e.slice(e.indexOf(`/`)+1):e)}function x(e){let t=e.includes(`/`)?e.split(`/`)[0].replace(/^~/u,``):`other`,n=_.get(t)??t;return{key:n,name:g.get(n)??(n===`other`?`Other`:y(n))}}function S(e){return e===`xhigh`?`Extra high`:e?e[0].toUpperCase()+e.slice(1):`Unavailable`}function C(e){return e.efforts.includes(`max`)?`max`:e.efforts.at(-1)??null}async function w(e,t=fetch){let n=await t(`/api/admin/scan/models`,{credentials:`same-origin`,headers:{accept:`application/json`},signal:e});if(!n.ok)throw Error(`HTTP ${n.status}`);return T(await n.json())}function T(e){if(!Array.isArray(e?.models))throw Error(`No model catalogue returned`);let t=e.models.filter(e=>typeof e?.id==`string`&&e.id.length>0).map(e=>({id:e.id,efforts:Array.isArray(e.efforts)?[...new Set(e.efforts.filter(e=>typeof e==`string`&&e.length>0))]:[]}));if(t.length===0)throw Error(`No models available`);return{models:t,defaultModel:t.find(t=>t.id===e.defaultModel)?.id??t[0].id}}function E(e,t=[]){let n=new Map,r=e.flatMap(e=>{let r=t.filter(t=>t.bundles?.includes(e.integrity));return(r.length>0?r.map(e=>({id:e.id,label:e.name})):[{id:`unattached`,label:`Unattached`}]).map(t=>(n.set(t.id,t),{id:e.integrity,integrity:e.integrity,filename:e.name,repoId:t.id,repo:t.label,files:null,reasons:[],size:`—`}))});return{repositories:[...n.values()],bundles:r,reports:[],scans:[]}}function D(s,c){if(c.error)throw Error(c.error);let l=r(c),u=c.kind===`stasis`?c.bundle?.formats:null,d=i(c),f=[...n(c)].filter(([,e])=>e!=null).map(([e,t])=>({path:e,format:u?.get(e)??null,bytes:t,lines:d.get(e)??0,size:a(t),module:o(e,{packageDir:l?.get(e)})})),p=e(c,f.map(e=>e.path)),m=[{id:`all`,label:`All`,filePaths:null},...t(p).map(e=>{let t;return{...e,get filePaths(){return t??=[...p.files(e.id)]}}})];return{...s,files:f,reasons:m,size:a(c.size)}}export{E as a,D as b,p as c,m as d,b as e,x as f,S as g,C as h,w as i,T as j};
@@ -0,0 +1,2 @@
1
+ import{a as e,b as t,c as n,d as r,e as i,f as a}from"./chunk-WCDYSIKG.js";import{a as o}from"./chunk-QI66YA4F.js";import{C as s,H as c,K as l,L as u,Q as d,m as f}from"./chunk-LVW7WWV4.js";import"./chunk-ZQHLECTI.js";import{d as p,h as m,i as h,j as g,k as ee,p as te,r as ne,s as _}from"./chunk-7HP2VYIC.js";import"./chunk-PXK7EU4V.js";import"./chunk-OOJM4CTU.js";var re=e=>/^[A-Za-z\d][\w.-]*$/u.test(e)&&/[A-Za-z]/u.test(e);function ie(e){let t=e.split(`-`);for(;t.at(-1)===``;)t.pop();return t}var v=()=>{},ae={3:[[/aix(\d+)?/u,`aix`],[/cygwin/u,`cygwin`,v],[/darwin(\d+)?/u,`darwin`],[/^macruby$/u,`macruby`,v],[/freebsd(\d+)?/u,`freebsd`],[/^(?:java|jruby)$/u,`java`,v],[/^java([\d.]*)/u,`java`],[/^dalvik(\d+)?$/u,`dalvik`],[/^dotnet$/u,`dotnet`,v],[/^dotnet([\d.]*)/u,`dotnet`],[/linux-?(\w+)?/u,`linux`],[/mingw32/u,`mingw32`,v],[/mingw-?(\w+)?/u,`mingw`],[/(mswin\d+)(_(\d+))?/u,void 0,e=>e[3]],[/netbsdelf/u,`netbsdelf`,v],[/openbsd(\d+\.\d+)?/u,`openbsd`],[/solaris(\d+\.\d+)?/u,`solaris`],[/wasi/u,`wasi`,v],[/^(\w+_platform)(\d+)?/u,void 0,e=>e[2]]],4:[[/aix-?(\d+)?/u,`aix`],[/cygwin/u,`cygwin`,v],[/darwin-?(\d+)?/u,`darwin`],[/^macruby$/u,`macruby`,v],[/^macruby-?(\d+(?:\.\d+)*)?/u,`macruby`],[/freebsd-?(\d+)?/u,`freebsd`],[/^(?:java|jruby)$/u,`java`,v],[/^java-?(\d+(?:\.\d+)*)?/u,`java`],[/^dalvik-?(\d+)?$/u,`dalvik`],[/^dotnet$/u,`dotnet`,v],[/^dotnet-?(\d+(?:\.\d+)*)?/u,`dotnet`],[/linux-?(\w+)?/u,`linux`],[/mingw32/u,`mingw32`,v],[/mingw-?(\w+)?/u,`mingw`],[/(mswin\d+)(?:[_-](\d+))?/u,void 0,e=>e[2]],[/netbsdelf/u,`netbsdelf`,v],[/openbsd-?(\d+\.\d+)?/u,`openbsd`],[/solaris-?(\d+\.\d+)?/u,`solaris`],[/wasi/u,`wasi`,v],[/^(\w+_platform)-?(\d+)?/u,void 0,e=>e[2]]]};function oe(e,t){if(e===void 0)return[`unknown`,void 0,void 0];for(let[n,r,i=e=>e[1]]of ae[t]){let t=n.exec(e);if(t===null)continue;let a=r??t[1];return[a,i(t),/^mswin\d*32$/u.test(a)?`x86`:void 0]}return[`unknown`,void 0,void 0]}function y(e){let t=ie(e);if(t.length>2&&!/\d$/u.test(t.at(-1))){let e=t.pop();t[t.length-1]+=`-${e}`}let n=t.shift();return t.length===2&&/^\d+(?:\.\d+)?$/u.test(t[1])?{cpu:n,os:t[0],version:t[1]}:{cpu:n,os:t[0]}}function b(e){let t=e.length;for(;e[t-1]===`-`;)t--;let n=e.slice(0,t),r=n.indexOf(`-`);return r===-1?{cpu:n||void 0}:{cpu:n.slice(0,r),os:n.slice(r+1)}}function x(e,t){let{cpu:n,os:r,version:i}=t===3?y(e):b(e),a=n!==void 0&&/i\d86/u.test(n)?`x86`:n;if(i!==void 0)return[a,r,i];let[o,s,c]=oe(r??n,t);return[r===void 0?c:a,o,s]}function S(e,t){let n=x(e,t);return n.filter(e=>e!==void 0).join(t===4&&n[0]===void 0?``:`-`)}var C=e=>e!==`ruby`&&e!==`current`&&/^[\w.-]+$/u.test(e)&&S(e,3)===e&&S(e,4)===e;function w(e){let t=e?.replace(/^gnu/u,``).replace(/eabi(?:hf)?$/u,``);return t===``?void 0:t}var T=Symbol(`all`),E=Symbol(`arm`);function se(e){let t=new Map;for(let n of e){if(n===`ruby`)continue;let[e,r,i]=x(n,3),a=t.get(r)??t.set(r,new Map).get(r);for(let t of[e,T,...e?.startsWith(`arm`)?[E]:[]]){let e=a.get(t)??a.set(t,{versions:new Set,libcs:new Set}).get(t);e.versions.add(i),e.libcs.add(w(i))}}return t}function ce(e,t,n){return e===void 0?!1:n===void 0||e.versions.has(void 0)||e.versions.has(n)?!0:t===`linux`&&(e.libcs.has(w(n))||[`musl`,`musleabi`,`musleabihf`].some(t=>e.versions.has(`${t}${n}`)))}function le(e,t){if(t===`java`||t===`mswin64`)return[void 0,t];if(t===`mswin32`&&e===`x86`)return[e,t];if(t===`mingw32`)return[e===`universal`||e===`x64`?e:e===`x86_64`?`x64`:`x86`,t]}function D(e,t,n,r){let i=e.get(n),a=t===void 0||t===`universal`?[T]:[t,void 0,`universal`,...t===`arm`?[E]:[]];return i!==void 0&&a.some(e=>ce(i.get(e),n,r))?!0:n.startsWith(`mingw`)&&[`mingw`,`mingw32`].some(n=>e.get(n)?.has(t===`universal`?T:`universal`))}function ue(e,t){let[n,r,i]=x(t,3),a=le(n,r);return D(e,n,r,i)||a!==void 0&&D(e,...a,void 0)}var de={GIT:{order:[`remote`,`revision`,`ref`,`branch`,`tag`,`submodules`,`glob`],required:2},PATH:{order:[`remote`,`glob`],required:1},GEM:{order:[`remote`],required:0}},fe=`{,*,*/*}.gemspec`;function pe({type:e,number:t,options:n}){let{order:r,required:i}=de[e],a=Object.create(null),o=0;for(let{key:t,value:i,number:s}of n){let n=r.indexOf(t);if(n===-1)throw g(`${m(t)} is not an option Bundler writes for a ${e} source`,s);if(t in a)throw g(e===`GEM`?`a second remote: Bundler fetches each gem of the source from either, and the lockfile does not say which`:`a second ${t}`,s);if(n<o)throw g(`${t} after ${r[o-1]}, where Bundler writes it before`,s);if(i.trim()!==i)throw g(`${m(i)} has a space at an end, which no ${t} Bundler writes has`,s);o=n+1,a[t]=i}let s=r.slice(0,i).find(e=>!(e in a));if(s!==void 0)throw g(`a ${e} source without its ${s}`,t);return a}var O=/\\|(?:^|[/{,])\.\.(?=$|[/},])|(?:^|[{,])(?:\/|[A-Za-z]:)/u;function k(e,t){if(e===fe)throw new p(`${m(e)}, which Bundler reads by where none is written, and does not write`,t);if(e!==void 0&&O.test(e))throw new p(`${m(e)} reaches out of the source, which Bundler globs its gemspecs from`,t);return e}function A(e,t){let{remote:n}=e;if(n.endsWith(`/`))throw new p(`${m(n)} ends in "/", which Bundler 2.4 and later drop as they read it, and 2.2 and 2.3 keep`,h(t,`remote`));u(n,h(t,`remote`));let{revision:r,ref:i}=e;if(!c(r))throw new p(`${m(r)} is not a full commit hash`,h(t,`revision`));if(i!==void 0&&/\s/u.test(i))throw new p(`${m(i)} is not a reference git reads`,h(t,`ref`));if(i?.startsWith(`-`))throw new p(`${m(i)} starts with "-", which git reads as an option`,h(t,`ref`));if(i!==void 0&&c(i)&&i!==r)throw new p(`the commit ${i}, and the revision another`,h(t,`ref`));if(e.submodules!==void 0&&e.submodules!==`true`)throw new p(`expected "true", found ${m(e.submodules)}`,h(t,`submodules`));return{type:`git`,remote:n,revision:r,ref:i,branch:f(e,`branch`,t,l),tag:f(e,`tag`,t,l),submodules:e.submodules===`true`,glob:k(e.glob,h(t,`glob`))}}function j(e,t){let n=h(t,`path`);if(e.remote.startsWith(`/`))throw new p(`${m(e.remote)} is an absolute path, which is the path on one machine alone`,n);if(e.remote.startsWith(`~`))throw new p(`${m(e.remote)} is a path from a home directory, which Bundler writes from the lockfile's`,n);return{type:`path`,path:s(e.remote,n),glob:k(e.glob,h(t,`glob`))}}function M(e){let t=URL.parse(e);return t!==null&&t.href===e&&(t.protocol===`file:`?t.host===``:t.protocol===`s3:`&&t.host!==``)}function N(e,t){let{remote:n}=e;if(n===void 0)return{type:`gem`,remote:n};if(!d(n)&&!M(n))throw new p(`${m(n)} is not an http(s) URL, or a file: or s3: URL in normal form`,h(t,`remote`));if(!n.endsWith(`/`))throw new p(`${m(n)} does not end in "/", as Bundler writes a source`,h(t,`remote`));return{type:`gem`,remote:n}}var P={GIT:A,PATH:j,GEM:N};function F(e){if(e.type===`gem`)return;if(e.type===`path`)return`source at \`${e.path}\``;let t=/^([A-Za-z][\w+.-]*):\/\/([^/]*)/u.exec(e.remote);return t!==null&&(/[A-Z]/u.test(t[1])||t[2].includes(`@`))?void 0:`${e.remote} (`}var I=e=>`the ${e.type} source ${m(e.remote??e.path)}`;function L(e,t){let n;for(let[r,i]of e.entries()){let e=F(i);if(e!==void 0){if(n!==void 0&&o(e,n.key)<0)throw g(`${I(i)} after ${I(n.source)}, where Bundler sorts them the other way`,t[r].number);n={key:e,source:i}}}}function R(e,t){let n=e.findIndex(e=>e.type===`gem`);if(n===-1)throw new p(`no GEM source, which Bundler always writes`);let r=e[n].remote===void 0,i=e.findIndex((e,t)=>t>n&&e.type===`gem`&&e.remote===void 0);if(i!==-1)throw g(r?`a second GEM source of no remote, where Bundler writes one, the Gemfile's own`:`a GEM source of no remote after one of a remote, where Bundler writes it first`,t[i].number);return r?n:-1}function z(e){let t=e.map((e,t)=>P[e.type](pe(e),`sources[${t}]`));return L(t,e),{sources:t,local:R(t,e)}}var B=/<<<<<<<|=======|>>>>>>>|\|{7}/u,me=new Set([`GIT`,`PATH`,`GEM`]),V={PLATFORMS:[2],DEPENDENCIES:[2],CHECKSUMS:[2],"RUBY VERSION":[2,3],"BUNDLED WITH":[2,3]},H=Object.keys(V);function U(e,t,n){let r=te(e);if(!t.includes(r))throw g(`expected ${t.join(` or `)} spaces of indentation, found ${r}`,n);return e.slice(r)}var he=/^([^\s()]+) \(([^\s()]+)\)(?: (\S+))?$/u;function W(e,t,n){let r=he.exec(e);if(r===null||!n&&r[3]!==void 0)throw g(`expected a gem as "name (version)", found ${m(e)}`,t);let[,i,a,o]=r,s=a.indexOf(`-`);return{name:i,version:s===-1?a:a.slice(0,s),platform:s===-1?void 0:a.slice(s+1),checksum:o,number:t}}var ge=/^([^\s()!]+)(?: \(([^()]+)\))?(!)?$/u;function G(e,t,n){let r=ge.exec(e);if(r===null||!n&&r[3]!==void 0)throw g(`expected a dependency as "name" or "name (requirement)", found ${m(e)}`,t);return{name:r[1],requirements:r[2]?.split(`, `)??[],pinned:r[3]!==void 0}}var _e=/^ {2}([a-z]+): (.+)$/u;function ve(e){let{line:t,number:n}=e,r=[];for(_(e);;_(e)){let t=_e.exec(e.line??``);if(t===null)break;r.push({key:t[1],value:t[2],number:e.number})}if(e.line!==` specs:`)throw g(`expected an option, "key: value", or "specs:", two spaces in, found ${e.line===void 0?`the end of the file`:m(e.line)}`,e.number);let i=[];for(_(e);e.line?.startsWith(` `);_(e)){let t=U(e.line,[4,6],e.number);if(e.line.length-t.length===4)i.push({...W(t,e.number,!1),dependencies:[]});else{if(i.length===0)throw g(`a dependency before any spec`,e.number);i.at(-1).dependencies.push(G(t,e.number,!1))}}return{type:t,number:n,options:r,specs:i}}function ye(e,t){let n=[];for(_(e);e.line?.startsWith(` `);_(e)){let r=U(e.line,t,e.number);n.push({text:r,indent:e.line.length-r.length,number:e.number})}return n}function be(e){let[t,n]=[`RUBY VERSION`,`BUNDLED WITH`].map(t=>e.get(t)?.lines[0]);if(t!==void 0&&n!==void 0&&t.indent!==n.indent)throw g(`${t.indent} spaces of indentation, and ${n.indent} under BUNDLED WITH`,t.number)}function xe(e){let t=B.exec(e)?.[0];if(t!==void 0)throw new p(`${m(t)}, which Bundler reads as a merge conflict`);if(e===``)throw new p(`an empty lockfile, which Bundler reads as none`);if(!e.endsWith(`
2
+ `))throw new p(`no line end after the last line, where Bundler ends every line`);let n=ne(e,ee),r=[],i=new Map,a;for(_(n);n.line!==void 0;){let{line:e,number:t}=n;if(e===``||e.startsWith(` `))throw g(e===``?`a blank line, where Bundler writes one between sections alone`:`expected a section, at column 0`,t);if(e===`PLUGIN SOURCE`)throw g(`a plugin source, which only its plugin can read, and which is not read here`,t);if(me.has(e)){if(a!==void 0)throw g(`a ${e} source after ${a}, where Bundler writes the sources first`,t);if(e!==`GEM`&&r.at(-1)?.type===`GEM`)throw g(`a ${e} source after a GEM one, where Bundler writes the GEM sources last`,t);r.push(ve(n))}else{let r=H.indexOf(e);if(r===-1)throw g(`${m(e)} is not a section Bundler writes`,t);if(i.has(e))throw g(`a second ${e}`,t);if(r<H.indexOf(a))throw g(`${e} after ${a}, where Bundler writes it before`,t);a=e,i.set(e,{number:t,lines:ye(n,V[e])})}if(n.line===void 0)break;if(n.line!==``)throw g(`expected a blank line before ${m(n.line)}`,n.number);if(_(n),n.line===void 0)throw g(`a blank line at the end, where Bundler writes none`,n.number)}return be(i),{sources:r,sections:i}}function K(e,t){if(!re(e))throw new p(`${m(e)} is not a gem name`,t);return e}var q=({name:e,version:t,platform:n=`ruby`})=>n===`ruby`?`${e}-${t}`:`${e}-${t}-${n}`;function J({name:t,version:n,platform:r},i){if(K(t,i),!e(n))throw new p(`${m(n)} is not a version as RubyGems writes one`,i);if(r===`ruby`)throw new p(`the platform ruby, which Bundler leaves out of a gem of no platform`,i);if(r!==void 0&&!C(r))throw new p(`${m(r)} is not a platform as RubyGems writes one`,i);return{name:t,version:n,platform:r??`ruby`}}function Se(e,r){for(let[t,i]of e.entries()){if(n(i)===void 0)throw new p(`${m(i)} is not a requirement as Bundler writes one, "op version"`,r);if(t>0&&i>e[t-1])throw new p(`${m(i)} after ${m(e[t-1])}, where Bundler sorts them backwards`,r)}let[i]=e;if(e.length===1&&i.startsWith(`>= `)&&t(i.slice(3),`0`)===0)throw new p(`${m(i)}, which Bundler leaves out, as any version`,r);return e}function Y(e,t,n,r=e=>e){let i=Object.create(null),a;for(let o of e){let e=h(t,o.name);if(K(o.name,e),a!==void 0&&o.name<=a)throw new p(`${o.name===a?`listed twice`:`after ${m(a)}`}, where Bundler sorts ${n} by name`,e);a=o.name,i[o.name]=r(Se(o.requirements,e),o)}return i}function Ce(e,t){let n=Object.create(null);for(let[r,{specs:i}]of e.entries()){let e;for(let a of i){let i=q(a),o=h(`specs`,i),{name:s,version:c,platform:l}=J(a,o);if(s===`bundler`)throw new p(`Bundler itself, which Bundler leaves out of the sources`,o);if(i in n)throw new p(`listed twice, of which Bundler keeps the last alone, at line ${a.number+1}`,o);if(e!==void 0&&i<e)throw new p(`after ${m(e)}, where Bundler sorts a source's gems by full name`,o);if(e=i,r===t)throw new p(`from sources[${r}], which has no remote: Bundler takes it from the gems installed where it runs`,o);n[i]={name:s,version:c,platform:l,source:r,dependencies:Y(a.dependencies,h(o,`dependencies`),`a gem's dependencies`),checksum:void 0}}}return n}var we=/^sha256=[\da-f]{64}$/u;function X(e,t){if(!we.test(e))throw new p(`${m(e)} is not a checksum as Bundler writes one, "sha256=" and the hex digest`,t);return e}function Te(e,t,n){let r,i,a=new Set;for(let{text:o,number:s}of e){if(i!==void 0&&o<=i)throw g(`${m(o)} after ${m(i)}, where Bundler sorts the checksums, each once`,s);i=o;let e=W(o,s,!0);if(e.name===`bundler`&&e.platform===void 0&&r===void 0){let{version:t}=J(e,`bundlerChecksum`);if(e.checksum===void 0)throw g(`Bundler itself, without the checksum Bundler writes it with`,s);r={version:t,checksum:X(e.checksum,h(`bundlerChecksum`,`checksum`))};continue}let c=q(e),l=m(o.split(` `,2).join(` `));if(!(c in t))throw g(`${l} is no gem of the sources`,s);if(a.has(c))throw g(`${l} a second time, where Bundler lists each gem once`,s);a.add(c);let u=t[c];if(e.checksum===void 0)continue;let d=h(h(`specs`,c),`checksum`);if(n[u.source].type!==`gem`)throw new p(`a checksum of a gem from a ${n[u.source].type} source, which has no .gem to check`,d);u.checksum=X(e.checksum,d)}let o=Object.keys(t).find(e=>!a.has(e));if(o!==void 0)throw new p(`not in CHECKSUMS, where Bundler lists every gem`,h(`specs`,o));return r}function Z(e,t){let n=e.get(t);if(n===void 0)throw new p(`no ${t}, which Bundler always writes`);return n}function Ee(e){let t=e.lines.map(({text:e})=>e);if(t.length===0)throw g(`no platform under PLATFORMS`,e.number);for(let[e,n]of t.entries()){let r=`platforms[${e}]`;if(n!==`ruby`&&!C(n))throw new p(`${m(n)} is not a platform as RubyGems writes one`,r);if(e>0&&n<=t[e-1])throw new p(`${m(n)} after ${m(t[e-1])}, where Bundler sorts the platforms, each once`,r)}return t}function De(e,t){let n=se(t);for(let[t,{platform:r}]of Object.entries(e))if(r!==`ruby`&&!ue(n,r))throw new p(`of the platform ${m(r)}, which no platform of PLATFORMS takes, where Bundler locks a gem for one`,h(`specs`,t))}function Oe(e){return Y(e.lines.map(({text:e,number:t})=>G(e,t,!0)),`dependencies`,`the dependencies`,(e,{pinned:t})=>({requirements:e,pinned:t}))}var ke=/^ruby \d+\.\d+\.\d+(?:\.[\dA-Za-z]+)*(?:p(?:-1|0|[1-9]\d*))?(?: \((?!ruby )[\w.-]+ [\w.-]+\))?$/u;function Ae(e,t){if(e.lines.length!==1)throw g(`expected one line under ${t}, found ${e.lines.length}`,e.number);return e.lines[0].text}var je=/^(?:2\.[2-7]|4\.0)\./u;function Q(t){let[n,r]=[`RUBY VERSION`,`BUNDLED WITH`].map(e=>t.has(e)?Ae(t.get(e),e):void 0);if(n!==void 0&&!ke.test(n))throw new p(`${m(n)} is not a Ruby as Bundler writes one, "ruby 3.3.6p108"`,`rubyVersion`);if(r!==void 0&&!e(r))throw new p(`${m(r)} is not a version as RubyGems writes one`,`bundledWith`);if(r!==void 0&&!je.test(r))throw new p(`${m(r)} is not a version of Bundler from 2.2 to 4.0, which this reader reads`,`bundledWith`);return{rubyVersion:n,bundledWith:r}}function Me(e){let t=Object.create(null),n=new Map;for(let[r,i]of Object.entries(e)){let a=t[i.name]??=[],[o]=a;if(o!==void 0&&e[o].source!==i.source)throw new p(`from sources[${i.source}], and ${m(o)} from sources[${e[o].source}], where Bundler takes a gem from one source`,h(`specs`,r));let s=n.get(`${i.name} ${i.platform}`);if(s!==void 0)throw new p(`for the platform of ${m(s)}, where Bundler locks one version of a gem for each`,h(`specs`,r));n.set(`${i.name} ${i.platform}`,r),a.push(r)}return t}function Ne({specs:e,gems:t,dependencies:n,sources:r,local:i}){let a;for(let[o,{pinned:s}]of Object.entries(n)){if(s||t[o]===void 0)continue;let n=h(`dependencies`,o),c=e[t[o][0]].source,{type:l}=r[c];if(l===`git`)throw new p(`from a git source, without the "!" Bundler writes of it`,n);if(l===`gem`&&i!==-1)throw new p(`from sources[${c}], where Bundler takes what the Gemfile names no source of from its default, sources[${i}], of no remote`,n);if(a??={name:o,index:c},c!==a.index)throw new p(`from sources[${c}], and ${m(a.name)} from sources[${a.index}], where Bundler takes what the Gemfile names no source of from its default alone`,n)}}function $(e,t,{specs:i,gems:o,versions:s},c){let l=s.get(e);if(!(l===void 0||t.every(e=>a(l,n(e)))))for(let a of o[e]){let e=t.find(e=>!r(i[a].version,n(e)));if(e!==void 0)throw new p(`${m(e)} is not met by ${m(a)}`,c)}}function Pe({specs:e,gems:t,dependencies:n}){let r={specs:e,gems:t,versions:new Map(Object.entries(t).map(([t,n])=>[t,i(n.map(t=>e[t].version))]))},a=new Set,o=[],s=e=>{e in t&&!a.has(e)&&o.push(e),a.add(e)};for(let[e,{requirements:t}]of Object.entries(n))$(e,t,r,h(`dependencies`,e)),s(e);for(;o.length>0;)for(let n of t[o.pop()]){let i=h(h(`specs`,n),`dependencies`);for(let[a,o]of Object.entries(e[n].dependencies)){let e=h(i,a);if(a!==`bundler`&&!(a in t))throw new p(`names no gem of the sources`,e);$(a,o,r,e),s(a)}}let c=Object.keys(t).find(e=>!a.has(e));if(c!==void 0)throw new p(`nothing depends on it, and Bundler locks what it resolves alone`,h(`specs`,t[c][0]))}function Fe(e){if(typeof e!=`string`)throw TypeError(`expected a string`);let{sources:t,sections:n}=xe(e),{sources:r,local:i}=z(t),a=Ce(t,i),o=Ee(Z(n,`PLATFORMS`));De(a,o);let s=Oe(Z(n,`DEPENDENCIES`)),c=Me(a);Ne({sources:r,local:i,specs:a,gems:c,dependencies:s}),Pe({specs:a,gems:c,dependencies:s});let l=n.get(`CHECKSUMS`),u=l===void 0?void 0:Te(l.lines,a,r);return{sources:r,specs:a,gems:c,platforms:o,dependencies:s,checksums:l!==void 0,bundlerChecksum:u,...Q(n)}}export{p as LockfileError,Fe as parseGemfileLock};
@@ -0,0 +1 @@
1
+ import{b as e,c as t,d as n,e as r,f as i,g as a,h as o,j as s,k as c,m as l,n as u}from"./chunk-PXK7EU4V.js";import{b as d}from"./chunk-OOJM4CTU.js";function f(e){if(Object.keys(e).length>0)throw TypeError(`Unexpected extra options`)}Object.getPrototypeOf(Uint8Array);var p=globalThis.atob,m=Uint8Array.prototype.toBase64,h=8192,g=m&&p;function _(e,t=0,n=e.length){t|=0,n|=0;let r=n-t;if(r===0)return``;if(g&&r>=256&&r<1e8&&e.toBase64===m&&e.BYTES_PER_ELEMENT===1)return p((t===0&&n===e.length?e:e.subarray(t,n)).toBase64());if(r>h){let r=``;for(let i=t;i<n;){let t=Math.min(n,i+h);r+=String.fromCharCode.apply(String,e.subarray(i,t)),i=t}return r}let i=t===0&&n===e.length?e:e.subarray(t,n);return String.fromCharCode.apply(String,i)}var v=t?e=>e.byteLength>=768&&!r?t.from(e.buffer,e.byteOffset,e.byteLength).latin1Slice(0,e.byteLength):a.decode(e):o?e=>o.decode(e):e=>_(e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),y=t=>e(t,new Uint8Array(t.length)),b=n&&i?.encodeInto?(e,t)=>{let n=new Uint8Array(e.length+4),r=i.encodeInto(e,n);if(r.read!==e.length||r.written!==e.length)throw SyntaxError(t);return n.subarray(0,e.length)}:t?(e,n)=>{let r=t.from(e,`utf8`);if(r.length!==e.length)throw SyntaxError(n);return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}:(e,t)=>{let n=i.encode(e);if(n.length!==e.length)throw SyntaxError(t);return n},x={};d(x,{E_CHAR:()=>E,E_LAST:()=>k,E_LENGTH:()=>O,E_PADDING:()=>D,fromBase64:()=>M,toBase64:()=>A});var S=[...`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`],C=[...`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`],w={},T={},E=`Invalid character in base64 input`,D=`Invalid base64 padding`,O=`Invalid base64 length`,k=`Invalid last chunk`;function A(e,t,n){let r=e.length/3|0,i=r*3,o=``,s=0,c=t?C:S,l=t?T:w;if(!l.pairs){if(l.pairs=[],a){l.codepairs=new Uint16Array(4096);let e=l.codepairs,t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e<64;e++){let n=c[e].charCodeAt(0);for(let r=0;r<64;r++)t[e<<7|r<<1]=t[r<<7|(e<<1)+1]=n}}else{let e=l.pairs;for(let t=0;t<64;t++)for(let n=0;n<64;n++)e.push(`${c[t]}${c[n]}`)}}let{pairs:u,codepairs:d}=l;if(a){let t=new Uint16Array(r*2),n=0;for(let r=e.length-11;s<r;s+=12,n+=8){let r=e[s],i=e[s+1],a=e[s+2],o=e[s+3],c=e[s+4],l=e[s+5],u=e[s+6],f=e[s+7],p=e[s+8],m=e[s+9],h=e[s+10],g=e[s+11];t[n]=d[r<<4|i>>4],t[n+1]=d[(i&15)<<8|a],t[n+2]=d[o<<4|c>>4],t[n+3]=d[(c&15)<<8|l],t[n+4]=d[u<<4|f>>4],t[n+5]=d[(f&15)<<8|p],t[n+6]=d[m<<4|h>>4],t[n+7]=d[(h&15)<<8|g]}for(let r=e.length-2;s<r;s+=3,n+=2){let r=e[s],i=e[s+1],a=e[s+2];t[n]=d[r<<4|i>>4],t[n+1]=d[(i&15)<<8|a]}o=v(t)}else for(;s<i;s+=3){let t=e[s],n=e[s+1],r=e[s+2];o+=u[t<<4|n>>4],o+=u[(n&15)<<8|r]}let f=0,p=2,m=e.length;for(;s<m;s++){let t=e[s];o+=c[f|t>>p],p===6&&(p=0,o+=c[t&63]),f=t<<6-p&63,p+=2}return p!==2&&(o+=c[f]),n&&(o+=[``,`==`,`=`][m-i]),o}var j=i?128:65536;function M(e,t){let n=e.length;for(;e[n-1]===`=`;)n--;let r=e.length-n,a=n%4,o=n-a;if(a===1)throw SyntaxError(O);if(r>3||r!==0&&e.length%4!=0)throw SyntaxError(D);let s=t?C:S,c=t?T:w;c.fromMap||(c.fromMap=new Int8Array(j).fill(-1),s.forEach((e,t)=>c.fromMap[e.charCodeAt(0)]=t));let l=c.fromMap,u=new Uint8Array(Math.floor(n*3/4)),d=0,f=0;if(i){let t=b(e,E);for(;f<o;f+=4){let e=t[f],n=t[f+1],r=t[f+2],i=t[f+3],a=l[e]<<18|l[n]<<12|l[r]<<6|l[i];if(a<0)throw SyntaxError(E);u[d]=a>>16,u[d+1]=a>>8&255,u[d+2]=a&255,d+=3}}else for(;f<o;f+=4){let t=e.charCodeAt(f),n=e.charCodeAt(f+1),r=e.charCodeAt(f+2),i=e.charCodeAt(f+3),a=l[t]<<18|l[n]<<12|l[r]<<6|l[i];if(a<0)throw SyntaxError(E);u[d]=a>>16,u[d+1]=a>>8&255,u[d+2]=a&255,d+=3}if(a<2)return u;let p=l[e.charCodeAt(f++)]<<6|l[e.charCodeAt(f++)];if(p<0)throw SyntaxError(E);if(u[d++]=p>>4,a<3){if(p&15)throw SyntaxError(k);return u}let m=l[e.charCodeAt(f++)];if(m<0)throw SyntaxError(E);if(u[d++]=p<<4&255|m>>2,m&3)throw SyntaxError(k);return u}var{Buffer:N,atob:P,btoa:F}=globalThis,I=N&&!N.TYPED_ARRAY_SUPPORT,{toBase64:L}=Uint8Array.prototype,{E_CHAR:R,E_PADDING:z,E_LENGTH:B,E_LAST:V}=x,H=F&&n,U=P&&n,W=e=>e.constructor===N&&N.isBuffer(e),G=e=>W(e)?e:N.from(e.buffer,e.byteOffset,e.byteLength);function K(e,t){if(t)return e;let n=e.indexOf(`=`,e.length-3);return n===-1?e:e.slice(0,n)}function q(e,t){return t&&e.length%4!=0?e+`=`.repeat(4-e.length%4):e}var J=e=>L&&e.toBase64===L;function Y(e,{padding:t=!0}={}){return s(e),J(e)?t?e.toBase64():e.toBase64({omitPadding:!t}):I?K(G(e).base64Slice(0,e.byteLength),t):H?K(F(_(e)),t):A(e,!1,t)}function X(e,t){if(typeof t==`string`&&(t={format:t}),!t)return Z(e,!1,`both`,`uint8`,null);let{format:n=`uint8`,padding:r=`both`,...i}=t;return Z(e,!1,r,n,i)}function Z(e,t,n,r,i){if(typeof e!=`string`)throw TypeError(c);i!==null&&f(i);let a=n===`both`?e.endsWith(`=`):void 0;if(n===!0||a===!0){if(e.length%4!=0||e[e.length-3]===`=`)throw SyntaxError(z)}else if(n===!1||a===!1){if(e.length%4==1)throw SyntaxError(B);if(n===!1&&e.endsWith(`=`))throw SyntaxError(`Did not expect padding in base64 input`)}else throw TypeError(`Invalid padding option`);return ee(e,t,n,r)}var Q=/[\t\n\f\r ]/;function $(e,t){let n=e.indexOf(`=`,e.length-3),r=n>=0?e.length-n:0,i=e.length-r,a=i%4,o=t.length-(i-a)/4*3;return a===0&&o===0||a===2&&o===1||a===3&&o===2}var ee=Uint8Array.fromBase64?(e,t,n,r)=>{let i=t?`base64url`:`base64`,a;if(n===!0)a=Uint8Array.fromBase64(e,{alphabet:i,lastChunkHandling:`strict`});else try{let t=e.length%4>0?`${e}${`=`.repeat(4-e.length%4)}`:e;a=Uint8Array.fromBase64(t,{alphabet:i,lastChunkHandling:`strict`})}catch(t){throw Q.test(e)?SyntaxError(R):t}if(!$(e,a))throw SyntaxError(R);return l(a,r)}:I?(e,t,n,r)=>{let i=N.byteLength(e,`base64`),a=N.allocUnsafeSlow(i);if(a.base64Write(e)!==i)throw SyntaxError(z);let o=t?a.base64urlSlice(0,a.length):a.base64Slice(0,a.length);if(e!==o&&(n===!t||q(e,!0)!==q(o,t)))throw SyntaxError(z);return u(a,r)}:U?(e,t,n,r)=>{let i;if(t){if(/[\t\n\f\r +/]/.test(e))throw SyntaxError(R);e=e.replaceAll(`-`,`+`).replaceAll(`_`,`/`)}try{i=y(P(e))}catch{throw SyntaxError(R)}if(!t&&!$(e,i))throw SyntaxError(R);if(i.length%3!=0&&Y(i.subarray(-(i.length%3)))!==(e.length%4==0?e.slice(-4):e.slice(-(e.length%4)).padEnd(4,`=`)))throw SyntaxError(V);return l(i,r)}:(e,t,n,r)=>l(M(e,t),r);export{f as a,v as b,b as c,Y as d,X as e};