Compare commits

...
Author SHA1 Message Date
Ken a2a09f074a feat(release): Split gpr and npm release into separate jobs 2026-09-25 13:42:18 +02:00
github-actions[bot] 27abaa3d12 Version Packages (#5298)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-25 11:42:47 +02:00
Ken f6b455a32a fix(releases): Now handles registry correctly after changeset upgrade (#5299) 2026-09-25 11:35:52 +02:00
Ken 1c8f616789 fix(Datepicker): Fallback to initialPlacement when there is no space for Popover (#5297) 2026-09-25 09:45:39 +02:00
Ken 3773e42013 fix(sanity): Synk sanity-schema versions across workspace 2026-09-24 15:17:27 +02:00
Ken bf521fbf4c fix(sanity): Fixed regression where portable-blocks could skip saving input when document closed 2026-09-24 14:50:52 +02:00
Ken 7797c1d6fc fix(release): Solve regression where token key changed name in changeset action #5195 2026-09-24 10:37:32 +02:00
github-actions[bot] 3c61203b20 Version Packages (#5242)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-24 10:09:19 +02:00
Ken a9fd2ac818 test(core): Add test for #3055 2026-09-24 09:45:32 +02:00
Ken fc6a13426d feat(AI): New code-review skill 2026-09-23 20:13:42 +02:00
Ken 83634ae666 feat(AI): New skills and instructions 2026-09-23 20:13:42 +02:00
Ken 4ccee1a666 refactor(AI): Improve skills and agent support for repo 2026-09-23 20:13:41 +02:00
KenandCopilot Autofix powered by AI 7b8e491a6c perf(website): Global search optimization (#5290)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-09-23 20:01:47 +02:00
dependabot[bot] 82233b39e0 ⬆️ Bump @github-ui/storybook-addon-performance-panel from 1.2.0 to 1.3.0 in the storybook group (#5293)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-23 17:45:22 +02:00
dependabot[bot] f76f06f778 ⬆️ Bump typescript-eslint from 8.68.0 to 8.70.0 (#5295)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-23 17:44:51 +02:00
KenandHalvor Haugan b0b04d33d1 perf(website): cache redirect-requests in middleware (#5288)
Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
2026-09-23 17:44:36 +02:00
Ken 3319871fd7 chore(website): Updated examples for Badge component 2026-09-23 15:43:19 +02:00
Halvor Haugan 550b8f8671 docs(website): update Badge example desc 2026-09-23 14:29:10 +02:00
Halvor Haugan 6c6e354206 docs(website): update Popover example desc 2026-09-23 14:25:24 +02:00
Ken eebc2ed0db perf(website): limit hits per article-type to 10 in global-search 2026-09-23 12:37:31 +02:00
Halvor Haugan b1c6ee6013 feat(website): adjust examples of Combobox (#5258) 2026-09-23 11:55:13 +02:00
dependabot[bot] 0c63438edc ⬆️ Bump @next/eslint-plugin-next from 16.3.4 to 16.3.5 (#5287)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-23 10:30:10 +02:00
Ken 87e67b45ec fix: Deduped codemirror packages, resolving #5289 2026-09-23 10:19:30 +02:00
Ken 069867e514 fix(website): Add token to consent tracking 2026-09-22 13:12:22 +02:00
Ken 7e7c7a7555 perf(website): Update proxy (middleware) to use tag-based revalidation for redirects 2026-09-22 12:15:46 +02:00
Halvor Haugan 4fa2fe7519 fix(Combobox2): resize modal to visual viewport (mobile) (#5260) 2026-09-22 09:16:20 +02:00
Ken 348cd318fc chore: Removed unused @fortedigital/nextjs-cache-handler code since cache is now handled by next 2026-09-21 15:17:05 +02:00
Ken 02d038606f fix(website): Added isrFlushToDisk config to fix current cache not updating 2026-09-21 14:53:10 +02:00
Ken 36e519df2d perf(website): re-add compression to requests since nais does not handle this internally 2026-09-21 14:47:50 +02:00
dependabot[bot] 6950dbf4d4 ⬆️ Bump the storybook group across 1 directory with 8 updates (#5282)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-21 14:34:38 +02:00
Ken 195c722a40 perf(website): Temp re-add instrumentation for tracing 2026-09-21 14:25:16 +02:00
KenandCopilot Autofix powered by AI 193bb4686e chore: Kode eksempler for Badge komponent (#5272)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-09-21 14:23:58 +02:00
Ken dc0ee7641b perf(website): Disable initial cache registration 2026-09-21 14:23:12 +02:00
Ken 499d552922 perf(website): Disable custom cache-handler, disable built-in compression 2026-09-21 14:20:35 +02:00
Ken 7c72e4941a design: Updated borders and transitions for ExpansionCard (#5277) 2026-09-21 13:28:23 +02:00
Halvor Haugan 147c3d1152 feat(core): add useSyncExternalStore shim (#5270) 2026-09-21 13:22:52 +02:00
60dc716dbc fix(datepicker): preserve range validation state (#5278)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ken <ken.aleksander@gmail.com>
2026-09-21 12:52:26 +02:00
Anniken GranbergandHalvor Haugan 3b5ff115b8 Mark Alert as deprecated (#5256)
Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
2026-09-21 09:33:23 +02:00
Ken 3610ee6c3a fix(website): Update website memory and cpu requests 2026-09-18 13:19:50 +02:00
Ken ce84c17ed0 fix(website): Attachmentblock now aligns action better 2026-09-17 15:57:29 +02:00
Ken 7426e7cc2d fix: Sync sanity schema versions 2026-09-17 15:32:07 +02:00
Ken a31a3047e7 perf: Change max replicas to 1, move caching responsibility to API from sanityLive 2026-09-17 15:21:25 +02:00
Ken 7e225ffb64 perf: Only published changes to old changelog documents 2026-09-17 15:14:14 +02:00
Ken 724d76f020 fix: Update invalidate-tags logs text 2026-09-17 14:49:30 +02:00
Ken 1c12a3f9e8 chore: Added @actions/core package to devDeps 2026-09-17 14:46:31 +02:00
Ken 77b78babf4 chore: Update datagrid row-click example 2026-09-17 14:32:28 +02:00
Ken 8da48eaf1b feat: Add tag revalidation test with sanity functions for dedicated API route (#5271) 2026-09-17 14:20:19 +02:00
dependabot[bot]andKen e4fe83031d ⬆️ Bump the sanity group across 1 directory with 12 updates (#5266)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ken <ken.aleksander@gmail.com>
2026-09-17 14:19:24 +02:00
dependabot[bot]andKen 530701d060 ⬆️ Bump the npm_and_yarn group across 9 directories with 1 update (#5255)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ken <ken.aleksander@gmail.com>
2026-09-17 14:16:24 +02:00
b723e17e21 [Badge]: New component preview (#5096)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
2026-09-17 12:00:18 +02:00
Ken 55ef52f921 Cplt config for repo (#5269) 2026-09-17 10:34:48 +02:00
Ken 13ff732a0c test(website): add slug to page logs 2026-09-15 16:29:27 +02:00
Ken 291af4e4a0 test(website): Test and validate syncTags for tag validation from webhook 2026-09-15 16:17:39 +02:00
dependabot[bot] db8d271cda ⬆️ Bump undici from 6.28.0 to 6.28.1 (#5261)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-14 11:30:17 +02:00
KenandCopilot Autofix powered by AI b8817f9854 chore(website): Updated to next 16.3 (#5253)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-09-14 11:29:50 +02:00
Halvor Haugan 5d96d26cee fix(core): prevent readOnly Select from being changed with keyboard (#5257) 2026-09-14 11:11:18 +02:00
Halvor Haugan 66bf479240 fix(Combobox): compare by value when removing option in local state (#5259) 2026-09-14 10:35:35 +02:00
dependabot[bot] 9a3e7db6b0 ⬆️ Bump adm-zip from 0.6.0 to 0.6.1 (#5262)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-14 10:03:48 +02:00
dependabot[bot] 48ed63ddd3 ⬆️ Bump js-yaml from 5.4.1 to 5.4.2 (#5263)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-14 08:33:07 +02:00
Halvor Haugan 18a389e9b3 refactor(Alert): remove redundant function 2026-09-11 18:22:58 +02:00
Halvor Haugan 13b505d8cb refactor(core): change from BoxNew to Box in DialogPopupInternal 2026-09-10 21:51:27 +02:00
Halvor Haugan b85448507e feat(Combobox2): fullscreen on mobile 2026-09-08 15:36:49 +02:00
Ken 32e640d016 [Website] Update cache and logger (#5244) 2026-09-08 10:05:52 +02:00
Halvor Haugan 20e38e66f2 feat(Combobox2): uncontrolled, hidden input, stories, extend HTMLAttributes 2026-09-07 17:25:19 +02:00
dependabot[bot] 8752bb0672 ⬆️ Bump lint-staged from 17.0.8 to 17.4.1 (#5248)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-07 13:19:12 +02:00
dependabot[bot] c6cec52411 ⬆️ Bump @testing-library/react from 16.3.2 to 16.3.3 (#5250)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-07 10:56:09 +02:00
Halvor Haugan 46c5c1a98e fix(Combobox2): fix for long labels, refactor id 2026-09-04 18:12:09 +02:00
Halvor Haugan eb90fd8c20 feat(website): improve examples of Chips (#5245) 2026-09-04 14:59:40 +02:00
Halvor Haugan 90ae09d4fe fix(website): fix Storybook example index regex 2026-09-04 14:35:38 +02:00
Halvor Haugan 3a1590ab59 feat(Listbox): support PageUp and PageDown (#5212) 2026-09-04 10:59:34 +02:00
Ken 15fda8725b fix(fuse.js): Lock to 7.4.2 to avoid breaking update in 7.5.0 2026-09-04 09:32:30 +02:00
Halvor Haugan f77534eba7 feat(Combobox2): add props disabled and error 2026-09-03 14:51:45 +02:00
Halvor Haugan 8d0e5a618d feat(Listbox): improved scrolling when using arrow keys and there are groups (#5243) 2026-09-03 14:43:45 +02:00
dependabot[bot]andKen 5e3954f8a3 ⬆️ Bump changesets/action from 1 to 2 in the actions group across 1 directory (#5195)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ken <ken.aleksander@gmail.com>
2026-09-03 11:30:04 +02:00
KenandHalvor Haugan ce47835ccd fix(core): add asChild guard to overridableComponent API (#5238)
Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
2026-09-02 19:29:41 +02:00
Ken d7e4b49478 refactor(core): removed redundant role presentation from icons and svgs (#5240) 2026-09-02 13:51:47 +02:00
Ken 1d0be82745 chore(core): FloatingContentProps JSDoc 2026-09-02 12:23:45 +02:00
Ken 7c3e54a141 refactor(core): rename and move baseprimitve to hook (#5237) 2026-09-02 11:54:34 +02:00
Ken f25cfa621a chore(core): lookup comment on why we use span 2026-09-02 11:38:03 +02:00
Ken 9e634308a8 fix(core): removed bench-files from react-build 2026-09-02 11:32:52 +02:00
Ken c63f485d38 chore(core): Slot comment 2026-09-02 11:26:27 +02:00
dependabot[bot] c89e35f865 ⬆️ Bump js-yaml from 5.4.0 to 5.4.1 (#5239)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-02 11:20:34 +02:00
Halvor Haugan 516fb5ccb1 chore(deps): upgrade yarn and fix playroom (#5235) 2026-09-02 10:39:45 +02:00
Halvor Haugan f846950f1f fix(website): remove data-color="accent" on WebsiteList 2026-09-02 10:25:24 +02:00
dependabot[bot] d4b8ce15dc ⬆️ Bump @github-ui/storybook-addon-performance-panel from 1.1.4 to 1.2.0 in the storybook group (#5227)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-02 10:16:20 +02:00
dependabot[bot] 3135b495b3 ⬆️ Bump js-yaml from 5.3.0 to 5.4.0 (#5230)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-02 10:16:01 +02:00
dependabot[bot] dfb1ab35ac ⬆️ Bump postcss-selector-parser from 7.1.4 to 7.1.5 (#5231)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-02 10:15:27 +02:00
dependabot[bot] 14bb00a27e ⬆️ Bump sharp from 0.35.3 to 0.35.4 (#5234)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-02 10:14:15 +02:00
dependabot[bot] 4196a473f5 ⬆️ Bump body-parser from 2.2.2 to 2.3.0 (#5233)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-02 10:12:55 +02:00
Halvor Haugan 0260104863 perf(core): optimize writeComponentNames() (#5191) 2026-09-02 09:23:03 +02:00
github-actions[bot] e69c3f7ce5 Version Packages (#5224)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-01 13:53:47 +02:00
dependabot[bot] ceeb26b0ac ⬆️ Bump esbuild from 0.28.0 to 0.28.2 (#5216)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-01 13:32:32 +02:00
Ken 09946680dd refactor(apps): Handle links better for bug-reports from website 2026-09-01 12:45:28 +02:00
Ken aeedec4214 fix(apps): Forvalter text now a heading 2026-09-01 12:14:48 +02:00
Ken cb6f48dff5 feat(apps): added endringslogg to TOC 2026-09-01 12:12:21 +02:00
Ken 16125841b2 fix(apps): Reduce gap to endringslogg-table 2026-09-01 10:34:00 +02:00
Ken a48ed55493 fix(apps): reduced gap between title and content for maler and grunnleggende 2026-09-01 10:23:42 +02:00
Ken 2be7137532 chore(apps): removed styled-components from website deps 2026-09-01 10:18:41 +02:00
Halvor Haugan 89c29cf211 chore(deps): remove unused dep babel-plugin-preval (#5222) 2026-09-01 09:51:59 +02:00
Dave HonnefferandKen 72f162e1ab fix(css): browserslist was bringing in old browsers (#5213)
Co-authored-by: Ken <ken.aleksander@gmail.com>
2026-09-01 09:37:02 +02:00
dependabot[bot] 6e5b10a626 ⬆️ Bump colorjs.io from 0.7.0 to 0.7.1 (#5218)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-01 09:23:09 +02:00
Halvor Haugan 7830ccea7e feat(Sanity): limit length of external link tooltip (#5223) 2026-09-01 09:21:26 +02:00
Ken 28dcec668e refactor(website): Renamed react.d.ts file to something more fitting (#5221) 2026-09-01 09:20:26 +02:00
Halvor Haugan 1bd55ba587 fix typo in @navikt/aksel/README.md 2026-08-31 16:11:07 +02:00
dependabot[bot] 4a248c8a84 ⬆️ Bump @modelcontextprotocol/sdk from 1.29.0 to 1.30.0 (#5217)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-31 15:21:32 +02:00
Halvor Haugan 35940055a8 fix(LinkCard): add default value to JSDoc desc of data-color prop (#5220) 2026-08-31 15:05:42 +02:00
dependabot[bot] ec8d50c55b ⬆️ Bump the storybook group with 8 updates (#5214)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-31 15:01:56 +02:00
Halvor Haugan 99b23c087e refactor(i18n): simplify get function (#5181) 2026-08-31 13:01:42 +02:00
251 changed files with 38381 additions and 73471 deletions

No files matched your search

+3 -2
View File
@@ -34,8 +34,9 @@ Alle base-pakkene våre har `fixed versjonering`. Dette betyr at en bump på en
```sh
"@navikt/ds-react",
"@navikt/ds-css",
"@navikt/aksel-icons",
"@navikt/ds-tokens",
"@navikt/ds-tailwind",
"@navikt/ds-codemod"
"@navikt/aksel-icons",
"@navikt/aksel",
"@navikt/aksel-stylelint"
```
+2 -2
View File
@@ -1,5 +1,5 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.2.0/schema.json",
"$schema": "https://unpkg.com/@changesets/config@4.0.0/schema.json",
"changelog": [
"@svitejs/changesets-changelog-github-compact",
{ "repo": "navikt/aksel" }
@@ -30,7 +30,7 @@
"aksel-sanity-studio",
"aksel-icons-figma-plugin",
"aksel-mcp",
"playroom"
"aksel-playroom"
],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
+7
View File
@@ -0,0 +1,7 @@
# https://min-copilot.ansatt.nav.no/cplt
[propose]
allow_docker = true
allow_localhost_any = true
[propose.allow]
localhost = [3000, 6006, 6007]
+43 -40
View File
@@ -9,6 +9,8 @@
## Behavior
- Only respond in same language as the input. Prefer english always.
- Use caveman-skill unless asked not to
- No apologies, no "I think", no change summaries.
- Answer-first. 0-2 sentences max.
- No thinking aloud; do next edit. Explain only when asked or non-obvious.
@@ -18,60 +20,62 @@
## Repo summary
- Yarn 4 workspaces monorepo: public React/CSS/tokens/icons/stylelint/CLI packages + docs site + playroom.
- Stack: TypeScript 6, React 19, Next.js 16, Storybook 10, Vitest 4, ESLint 9, Stylelint 17, Biome 2, Prettier 3.
- Node 22+, Yarn 4.12.0.
- `@navikt/*` must stay React 17 compatible.
- Nav's design system. Yarn 4 workspaces monorepo: published packages under `@navikt/` + docs site `aksel.nav.no/` + `apps/` + `tooling/`.
- Stack: TypeScript 6, React 19 (dev), Next.js 16, Storybook 10, Vitest 4, ESLint 9, Stylelint 17, Biome 2 (lint only), Prettier 3 (formatting). Node 22+, Yarn 4.18.0.
- Published `@navikt/*` packages must stay React 17 compatible (peer `react ^17 || ^18 || ^19`).
## Start and validate
1. `corepack enable`
2. `yarn install`
3. `yarn boot`
2. `corepack yarn install` (needs `NPM_AUTH_TOKEN` with `read:packages`). Without a token: `corepack yarn workspaces focus @navikt/aksel-icons @navikt/ds-tokens @navikt/ds-css @navikt/ds-react @navikt/ds-tailwind @navikt/aksel @navikt/aksel-stylelint`
3. `corepack yarn boot` (builds all public packages; rerun after `corepack yarn clean`)
- `yarn boot` after first install + after `yarn clean`.
- Full install needs `NPM_AUTH_TOKEN` for GitHub Packages.
Public-package-only: `yarn workspaces focus @navikt/aksel-icons @navikt/ds-tokens @navikt/ds-css @navikt/ds-react @navikt/ds-tailwind @navikt/aksel @navikt/aksel-stylelint`
- Run agent commands through `corepack yarn`. Order: existing root/workspace script → Yarn-local binary → add a pinned dependency only when new tooling is required.
- Never use `npx`, `pnpx`, `pnpm dlx`, `yarn dlx`, global binaries or curl-piped installers. Public consumer docs (`npx @navikt/aksel`) are intentional; keep them.
- If Corepack/Yarn fails because of user-level configuration, report the exact error. Never edit user-home config.
- Choosing checks: use the `aksel-local-validation` skill. Changed-file lint first, then the affected workspace, then root suites only when needed.
## Definition of done
- Behavior/visual change: update impl + closest story + test.
- New public export: sync component `index.ts`, `src/index.ts`, `package.json` exports.
- User-facing change: add changeset unless told otherwise.
- Validate with narrowest workspace command first.
- New public export: sync component `index.ts`, `src/index.ts` (or `src/preview.ts`) and `package.json` exports, then `corepack yarn workspace aksel-playroom sync-imports` (root `lint` fails on stale playroom imports).
- User-facing change to a published package: add a changeset (`add-changeset` skill) unless told otherwise.
### Commands
## Commands
- `yarn boot` - build all
- `yarn test` / `yarn lint` - all tests / all linting
- `yarn lint:eslint` / `yarn lint:css` / `yarn lint:biome`
- `yarn storybook` - root `:6006`
- `yarn storybook:aksel` - website examples `:6007`
- `yarn storybook:test` - browser tests (Playwright/Firefox)
- `yarn dev` - website `:3000`
- `yarn clean` - remove build artifacts
- `yarn workspace @navikt/ds-react build|test`
- `yarn workspace website test`
- `yarn workspace playroom sync-imports`
`yarn lint` fails if playroom imports stale → `yarn workspace playroom sync-imports`.
- `corepack yarn eslint --max-warnings=0 --no-warn-ignored <files...>` / `corepack yarn stylelint <files...>` / `corepack yarn biome lint --no-errors-on-unmatched <files...>`
- `corepack yarn tsc --noEmit --incremental false --project <tsconfig>` - targeted type-check
- `corepack yarn workspace <name> <script>` - e.g. `@navikt/ds-react test` (Vitest + tsc), `website test`
- `corepack yarn lint` / `corepack yarn test` / `corepack yarn boot` - root suites (slow; cross-workspace changes only)
- `corepack yarn storybook` (:6006) / `corepack yarn storybook:aksel` (website examples, :6007, no secrets) / `corepack yarn storybook:test` (play tests, Playwright Firefox) / `corepack yarn dev` (website, :3000, needs Sanity token)
## Where to edit
- `@navikt/core/react/src/<component>/` - component source, index, stories
- `@navikt/core/react/src/index.ts` + `package.json` exports - public API surface
- `@navikt/core/css/src/` - component CSS
- `@navikt/core/tokens/src/` - design tokens
- `@navikt/core/tailwind/` - Tailwind preset
- `@navikt/aksel-icons/icons/` - source SVGs (`src/` generated)
- `@navikt/aksel-stylelint/src/` - Stylelint rules
Path-specific rules load automatically from `.github/instructions/` (see each `applyTo`).
- `@navikt/core/react/src/<component>/` - components (`src/index.ts`, `src/preview.ts` + `package.json` exports = public API)
- `@navikt/core/css/src/` - component CSS (`index.css` imports + layers)
- `@navikt/core/tokens/src/` - design tokens · `@navikt/core/tailwind/` - Tailwind preset (generated from tokens)
- `@navikt/aksel-icons/icons/` - source SVG + YML (`src/` generated)
- `@navikt/aksel-stylelint/src/` - Stylelint rules + CSS class deprecations
- `@navikt/aksel/src/` - CLI and codemods
- `aksel.nav.no/website/` - Next.js docs site
- `apps/playroom/` - playroom
- `apps/mcp-server/` - MCP server
- `apps/figma-icon-plugin/` - Figma plugin
- Root: `eslint.config.js`, `stylelint.config.mjs`, `biome.json`, `tsconfig.json`, `.storybook/`
- `aksel.nav.no/website/` - Next.js docs site · `aksel.nav.no/sanity-studio/` - CMS schema
- `apps/playroom/`, `apps/mcp-server/`, `apps/figma-icon-plugin/` - apps · `tooling/` - ESLint plugin, scripts, changelog, analyzer
- `.changeset/` - release notes · Root config: `eslint.config.js`, `stylelint.config.mjs`, `biome.json`, `vitest.config.ts`, `.storybook/`
## Skills and agents
- `aksel-local-validation` - pick and run the right lint/type/test commands
- `code-review` - review a branch, diff or PR for consumer-facing risk
- `add-changeset` - write `.changeset/*.md` (never run interactive `yarn changeset`)
- `ds-component-restructure` - move/rename component files to canonical layout
- `website-example` - add aksel.nav.no examples/templates
## Gotchas
- `.yarnrc.yml`: `enableScripts: false` (dependency install scripts don't run, e.g. Playwright browsers), `npmMinimalAgeGate: 7d` (new package versions under 7 days old are rejected), `defaultSemverRangePrefix: ""` (exact versions).
- Never hand-edit generated output: `esm/`, `cjs/`, `dist/`, `@navikt/aksel-icons/src/`, `@navikt/aksel/src/version.ts`, tokens `token_docs.js`, tailwind `tailwind.config.js`.
- Don't run scripts that write to Sanity/Figma/releases (`update:*`, `backup`, `fetch-new:icons`, `release`, `create-version`) unless asked.
## Coding defaults
@@ -79,6 +83,5 @@ Public-package-only: `yarn workspaces focus @navikt/aksel-icons @navikt/ds-token
- Copy nearest existing pattern before writing new code.
- Stable public APIs. Prefer additive props/exports.
- `node:` imports for Node builtins. Never import from `esm/`/`cjs/` output.
- Import order: `@navikt/*`, `@/*`, relative. (Prettier sorts)
- Preserve JSDoc on public props/components when changing public APIs.
- Reuse helpers: `cl`, `composeEventHandlers`, `useId`, `omit`, `useClientLayoutEffect`, `useEventListener`.
@@ -0,0 +1,21 @@
---
description: "Writing changeset files for versioning public @navikt packages."
applyTo: ".changeset/**"
---
# Changesets
`yarn changeset` is interactive. Agents write `.changeset/<kebab-slug>.md` directly (see the `add-changeset` skill):
```md
---
"@navikt/ds-react": patch
---
Component: Short, user-facing description of the change
```
- Publishable packages (versioned together via `fixed` in `config.json`): `@navikt/ds-react`, `@navikt/ds-css`, `@navikt/ds-tokens`, `@navikt/ds-tailwind`, `@navikt/aksel-icons`, `@navikt/aksel`, `@navikt/aksel-stylelint`. List only the packages actually changed.
- Everything in `config.json` `ignore` (website, playroom, mcp, tooling, sanity) never gets a changeset.
- Summary format: `<Component>: <what changed for consumers>`. It ends up in the public changelog, so write for consumers, not reviewers.
- Don't edit `config.json`, `CHANGELOG.md` files or package versions. The release workflow does that.
@@ -1,42 +0,0 @@
---
description: "Code review instructions used when reviewing pull requests."
applyTo: "**"
excludeAgent: ["coding-agent"]
---
# Code review focus
Review for issues that could block release, surprise users, or create maintenance risk. Prefer high-signal findings over style-only comments.
## What to check
### 1. Public API and behavior
- New or changed APIs should match existing naming, params, defaults, and behavior patterns.
- Watch for breaking changes, regressions, and accidental behavior changes in public components, hooks, CSS, tokens, and CLI output.
- Avoid introducing new patterns unless the change clearly justifies them.
### 2. Documentation and examples
- Public components and exported APIs should have accurate JSDoc, including `@default` where it adds clarity.
- Check whether Storybook stories, website examples, and decision records need updates to match the new behavior.
### 3. Tests
- Flag missing or insufficient tests for changed behavior, edge cases, and regressions.
- Prefer tests that prove the contract users rely on, not just implementation details.
### 4. CSS and styling
- If CSS class names are removed, verify deprecation handling in `@navikt/aksel-stylelint/src/deprecations.ts`.
- If new CSS files or selectors are added, confirm they follow the repo's import and naming conventions.
### 5. Exports and packaging
- New public exports must be wired through the correct `index.ts` files and `package.json` exports when relevant.
- Check that release-facing entry points stay consistent across packages.
### 6. Changesets and migrations
- User-facing changes should include a changeset with a clear summary and impact.
- Breaking changes should also include a codemod when needed.
@@ -1,11 +1,13 @@
---
description: "JS/TS code conventions."
applyTo: "**/*.tsx", "**/*.jsx", "**/*.ts", "**/*.js"
description: "JS/TS conventions not enforced by ESLint/Biome: loops, export style and placement."
applyTo: "**/*.ts,**/*.tsx,**/*.js,**/*.mts,**/*.mjs"
---
# JS/TS instructions
# JS/TS conventions
- Prefer `for...of` over `Array.forEach`.
- Named exports; type exports separate from value exports.
- Group exports at bottom: values first, then types.
- In `*.stories.*`, keep default export at top.
Formatting, import order and `import type` are handled by Prettier and Biome. Don't hand-tune them.
- Use `for...of` instead of `Array.forEach`. It supports `break`/`continue`/`await` and reads top-down.
- Use named exports only. Keep type exports separate from value exports (`export { X }` / `export type { XProps }`).
- Group exports at the bottom of the file, values first, then types. `react-docgen-typescript` (`docgen:meta`) depends on this pattern.
- Exceptions to default exports: `*.stories.tsx` (CSF meta default export, kept at the top), and Next.js pages/website examples that the framework requires.
@@ -0,0 +1,15 @@
---
description: "@navikt/aksel CLI and jscodeshift codemods: transforms, fixtures, migration registry."
applyTo: "@navikt/aksel/**"
---
# @navikt/aksel CLI and codemods
- Transforms live in `src/codemod/transforms/v<major>.0.0/<name>/<name>.ts`. Tests live in the sibling `tests/` folder.
- Every transform is registered in `src/migrations-config.ts` (`value`, `path` without extension, `description`, `ignoredExtensions`). `value` must be unique and is the public CLI name (`v8-accordion-variant`).
- Test with fixtures: `tests/<fixture>.input.js` → `tests/<fixture>.output.js`, run via `check(__dirname, { fixture, migration })` from `src/codemod/utils/check.ts`. Output is compared after Prettier, so whitespace doesn't matter.
- Reuse helpers in `src/codemod/utils/` (imports, props, JSX values, token translation) before writing new AST code.
- Fixtures (`*.input.*`, `*.output.*`) are excluded from ESLint and TypeScript. Don't "fix" them to match lint rules.
- `src/version.ts` is generated by `build`. Don't edit it.
- `tests/migrations.test.ts` checks `dist/`. Run `corepack yarn workspace @navikt/aksel build` before `test`, or new transforms fail with "transform-path" errors.
- Consumer docs (`README.md`, website) show `npx @navikt/aksel ...` on purpose. Keep them.
+15
View File
@@ -0,0 +1,15 @@
---
description: "Editing @navikt/ds-css component styles: file setup, layers, selectors, tokens, deprecations."
applyTo: "@navikt/core/css/src/**"
---
# ds-css
- One file per component in `src/` (`badge.css`). A new file must be `@import`ed in `src/index.css` with the right `layer(...)`, otherwise it isn't bundled. Most components use `aksel.components.modules`; form controls go through `form/index.css`.
- Selectors use the `.aksel-<component>` prefix and BEM-ish `__part` / `--modifier`. State goes through `data-*` / ARIA attribute selectors, not extra modifier classes.
- Use tokens only: public `--ax-*`, component-internal `--__axc-*`. No hardcoded colors, spacing or radii. Stylelint flags unknown custom properties.
- Colors follow `data-color` (see nearby components). Don't add per-variant color selectors.
- Focus uses `:focus-visible` (outline + `outline-offset`). Check `forced-colors`, print and dark theme in Storybook.
- `prefers-reduced-motion` is handled globally in `baseline/baseline.css`. Don't duplicate it per component.
- `baseline/tokens.css` re-exports `@navikt/ds-tokens` build output. Edit tokens in `@navikt/core/tokens/src`, not here.
- Removing or renaming a class is breaking for consumers (for allready published components. Ignore for new components). Add it to `@navikt/aksel-stylelint/src/deprecations.ts`.
@@ -1,17 +1,33 @@
---
description: "ds-react components and component CSS."
applyTo: "@navikt/core/react/src/**", "@navikt/core/css/src/**"
description: "Editing or adding @navikt/ds-react components, hooks and their public exports."
applyTo: "@navikt/core/react/src/**"
---
# ds-react component instructions
# ds-react components
- Read full component folder before editing.
- Preserve `forwardRef`, `className`, `...rest`, `as`/`OverridableComponent` patterns.
- `@navikt/*` must stay React 17 compatible. No React 18/19-only APIs; use internal `useId` etc.
- `@navikt/*` TSX: import React explicitly (classic JSX).
Read the whole component folder (`index.ts`, source, `.meta.ts`, stories, tests) before editing. Moving or renaming files: use the `ds-component-restructure` skill.
## Compatibility (why: peer range is `react ^17 || ^18 || ^19`)
- No React 18/19-only APIs. ESLint `no-restricted-imports` blocks e.g. `React.useId`. Use the internal `useId`, `useClientLayoutEffect`, etc. from `utils-external/`.
- Import React explicitly in TSX (`import React from "react"`). `tsconfig` uses classic `jsx: "react"`.
- Component `index.ts` starts with `"use client"`.
- Use tokens, not hardcoded values. Token names: `--ax-*` (public), `--__axc-*` (internal).
- Follow CSS nesting, `data-*` selectors, `focus-visible`, `forced-colors`, reduced-motion.
- Prettier formats CSS; Biome lint-only.
- Behavior/visual change: update nearest story + test.
- Public component change: sync component `index.ts`, `src/index.ts`, `package.json` exports.
## Component patterns
- Preserve `forwardRef`, `className` merged via `cl("aksel-<name>", className)`, `...rest` spread, and `as`/`OverridableComponent` where they already exist.
- Compound components: `const X = Object.assign(XRoot, { Item: XItem })`. Never cast with `as XComponent`, because `docgen:meta` can't extract props from a cast.
- Colors: `data-color?: AkselColor`, not new `variant` color values.
- User-facing strings come from `useI18n("<Component>")` with keys in `utils/i18n/locales/{nb,nn,en}.ts`. Add the key to all three.
- Public props and components need JSDoc. Component JSDoc sits above the exported value, with `@see 🏷️ {@link XProps}` and an `@example`. Add `@default` when the default isn't obvious.
## Public API surface (breaking = major changeset)
- Stable component: export it from component `index.ts`, add it to `src/index.ts`, and add a `"./<Name>"` entry to `package.json` `exports` (both `import` and `require`).
- Preview/beta component: export from `src/preview.ts` plus `"./PREVIEW/<Name>"` in `package.json` instead of `src/index.ts`.
- Standalone components have `<Component>.meta.ts` (see `accordion/Accordion.meta.ts`). Sub-components don't.
- Changing exports: run `corepack yarn workspace aksel-playroom sync-imports`, or root `lint` fails.
## Validate
`corepack yarn workspace @navikt/ds-react test` (Vitest + `tsc` type-check). Add `build` when exports or types change.
@@ -0,0 +1,14 @@
---
description: "@navikt/aksel-icons: adding/updating SVG icons and metadata; generated React components."
applyTo: "@navikt/aksel-icons/**"
---
# aksel-icons
- Source: `icons/<Name>.svg` + `icons/<Name>.yml`. Every SVG has a matching YML and vice versa (checked by `__tests__/validate-files.test.ts`). Most icons also have a `<Name>Fill` variant.
- YML shape: copy a sibling, e.g. `icons/Airplane.yml` (`name`, `category`, `sub_category`, `keywords` (nb + en), `variant: Stroke|Fill`, `created_at: DD.MM.YYYY`).
- SVG root: `width="24" height="24" viewBox="0 0 24 24" fill="none"`. Shapes use `fill="#202733"` (becomes `currentColor` at build) and `stroke-width` 1.5 if any. `__tests__/validate-svg*.test.ts` enforces this. Copy a sibling SVG.
- `src/` React components, `dist/` and metadata are generated by `build` (SVGR). Never edit `src/` by hand.
- `core-icons/` is only used for the downloadable zip. `fetch-new:icons` pulls from Figma and needs a token. Don't run it unless asked.
- New icon = minor changeset for `@navikt/aksel-icons` (e.g. `Icons: New icons Timeline, TimelineFill`).
- Validate: `corepack yarn workspace @navikt/aksel-icons test`. Run `build` when checking generated output.
+11 -10
View File
@@ -1,14 +1,15 @@
---
description: "Tests and stories."
applyTo: "**/*.test.*", "**/*.stories.tsx"
description: "Writing Vitest unit tests and Storybook stories/play tests."
applyTo: "**/*.test.ts,**/*.test.tsx,**/*.stories.tsx"
---
# Testing and Storybook instructions
# Tests and stories
- Prefer story `play` functions + `yarn storybook:test` for user flows; Vitest for logic/non-browser.
- Prefer focused assertions over snapshots unless nearby tests use them.
- Cover main path + 1-2 meaningful edge cases.
- UI behavior change: update nearest story + test in same change.
- Testing Library: query by role and name.
- Stories use `@storybook/react-vite`, live next to components.
- Prefer `yarn storybook` for component work over `yarn dev`.
- User flows: use a story `play` function in `<Component>.tests.stories.tsx`. Pure logic and hooks: use Vitest `*.test.ts(x)` next to the source file.
- `corepack yarn storybook:test` runs every story that has a `play` function (Storybook auto-tags them `play-fn`, see root `vitest.config.ts`). To opt out, use `tags: ["!play-fn", "skip-test"]` with a reason.
- Play-test files set `parameters: { chromatic: { disable: true } }`. Visual stories feed Chromatic; use `renderStoriesForChromatic` from `utils/` when adding visual variants.
- Import from `@storybook/react-vite` and `storybook/test`, not `@storybook/react` or `@storybook/test`.
- Query by role and accessible name (`getByRole("button", { name })`). Avoid snapshots unless nearby tests already use them.
- Cover the main path plus 1-2 meaningful edge cases. A behavior change updates the nearest story and test in the same change.
- ds-react unit tests run with `TZ=UTC`. Date logic must not depend on the local timezone.
- Browser tests need Playwright Firefox. Yarn has `enableScripts: false`, so if the browser is missing, report it instead of installing globally.
@@ -0,0 +1,13 @@
---
description: "@navikt/ds-tokens and @navikt/ds-tailwind: token sources, generated output, build order."
applyTo: "@navikt/core/tokens/**,@navikt/core/tailwind/**"
---
# Tokens and Tailwind
- Token source of truth: `@navikt/core/tokens/src/tokens/**` (TypeScript), built with Style Dictionary (`src/index.ts`). Generated output: `dist/`, `token_docs.js`, and in tailwind `tailwind.config.js` and `tailwind4.css`. Never edit generated output; they're untracked.
- Public CSS variables are `--ax-*`. Renaming or removing a token is breaking: it needs a major changeset plus a token migration in `@navikt/aksel` (see `src/codemod/v8-tokens/`) when consumers must migrate.
- Light and dark themes are both generated. Check both when changing semantic color tokens.
- Tailwind is built from `@navikt/ds-tokens/js`, so build tokens first: `corepack yarn workspace @navikt/ds-tokens build`, then `corepack yarn workspace @navikt/ds-tailwind build`.
- Tests: `corepack yarn workspace @navikt/ds-tokens test` and `corepack yarn workspace @navikt/ds-tailwind test`.
- `build` also generates the Figma config/plugin (`src/figma`). Changes there affect design tooling. Mention it in the PR.
+10 -8
View File
@@ -1,12 +1,14 @@
---
description: "Website and playroom."
applyTo: "aksel.nav.no/website/**, aksel.nav.no/playroom/**"
description: "aksel.nav.no Next.js website: routers, examples/templates, Sanity data."
applyTo: "aksel.nav.no/website/**"
---
# Website and playroom instructions
# Website (aksel.nav.no)
- Stay in router already used nearby; don't mix `app/`/`pages/`.
- `pages/eksempler/**` and `pages/templates/**`: only import from `@navikt/*` and `react`.
- Reuse nearby utils/patterns before adding abstractions.
- Prefer `yarn storybook:aksel` for examples/templates; `yarn dev` only for app-specific behavior.
- `yarn storybook:aksel` needs no secrets. `yarn dev` needs `SANITY_READ_NO_DRAFTS`.
- Both routers are in use: `app/` (App Router, `cacheComponents: true` in `next.config.ts`) and `pages/` (examples, templates, legacy). Stay in the router already used nearby. Don't move routes between them.
- In `app/`, dynamic data needs Suspense or `"use cache"`, following nearby code. Cache Components errors at build time are real failures.
- `pages/eksempler/**` and `pages/templates/**` are public code snippets. Use the `website-example` skill. ESLint rules `aksel-local/{import-check,comment-check,args-check}` enforce their shape.
- Reuse `@/` utils and components nearby before adding abstractions.
- Examples/templates: `corepack yarn storybook:aksel` (no secrets). `corepack yarn dev` only for app behavior; it needs `SANITY_READ_NO_DRAFTS` and `NPM_AUTH_TOKEN`.
- Never run `update:*`, `backup` or other Sanity-writing scripts unless asked. They write to the CMS.
- Tests: `corepack yarn workspace website test`. Examples: `corepack yarn workspace website validate:eksempler`.
+22
View File
@@ -0,0 +1,22 @@
{
"lspServers": {
"typescript": {
"command": "node",
"args": [
"./node_modules/typescript-language-server/lib/cli.mjs",
"--stdio"
],
"fileExtensions": {
".ts": "typescript",
".tsx": "typescriptreact",
".js": "javascript",
".jsx": "javascriptreact",
".mjs": "javascript",
".cjs": "javascript",
".mts": "typescript",
".cts": "typescript"
},
"rootUri": "."
}
}
}
+56
View File
@@ -0,0 +1,56 @@
---
name: add-changeset
description: >
Create a Changesets entry for a user-facing change to a published Aksel
package without the interactive `yarn changeset` prompt. Use when a change
touches @navikt/ds-react, ds-css, ds-tokens, ds-tailwind, aksel-icons,
@navikt/aksel or aksel-stylelint and needs a version bump or changelog entry,
or when asked to "add a changeset".
argument-hint: "Package(s) and a one-line summary of the change"
---
# Add changeset
`yarn changeset` is interactive and will hang an agent. Write the file directly.
## 1. Decide if a changeset is needed
Needed: any consumer-visible change in a published package: behavior, props, CSS output, tokens, icons, CLI/codemods, types, or bug fixes.
Not needed:
- Changes only in ignored workspaces (`.changeset/config.json` → `ignore`: website, sanity-studio, playroom, mcp, tooling, figma plugin).
- Stories, tests, internal refactors with identical output, docs and repo tooling.
## 2. Pick the bump
| Bump | When |
| ------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `patch` | Bug fix, style fix, internal change with visible effect, new icon keyword |
| `minor` | New component, prop, export, token, icon or codemod; new preview component |
| `major` | Removed/renamed prop, export, CSS class or token, or changed default. Only when explicitly agreed: needs a codemod or migration notes |
The packages in `config.json` `fixed` release together, so one bump moves all of them to the same version. Still list only the packages whose code changed.
## 3. Write the file
Path: `.changeset/<three-random-lowercase-words>.md` (e.g. `brave-owls-sing`). The slug must not already exist.
```md
---
"@navikt/ds-react": minor
"@navikt/ds-css": minor
---
Lookup: New component `Lookup`
```
Rules:
- The summary starts with `<Component or area>:` (e.g. `Button:`, `Tokens:`, `Icons:`, `CLI:`), then what changed **for consumers**. One changeset per logical change.
- Optional gitmoji after the colon is fine (`:tada:` for new components), matching nearby entries.
- Don't edit `CHANGELOG.md`, package versions or `config.json`.
## Done when
The file exists, its frontmatter lists only changed published packages with valid bumps, and Prettier leaves it unchanged (`./node_modules/.bin/prettier --check .changeset/<file>.md`, or `corepack yarn prettier --check ...`).
@@ -0,0 +1,109 @@
---
name: aksel-local-validation
description: >
Select and run deterministic local validation for changes in the Aksel
monorepo. Use when linting, type-checking, testing, building, formatting, or
deciding which Yarn workspace commands cover changed files.
argument-hint: "Changed files or feature area to validate"
---
# Aksel local validation
Validate the smallest relevant surface with repository-pinned tools. Expand only when the result or dependency graph requires it.
## Hard rules
- Run repository commands through `corepack yarn`.
- Prefer an existing root or workspace script. Otherwise use a binary already pinned in the root/workspace dependency graph.
- Never use `npx`, `pnpx`, `pnpm dlx`, `yarn dlx`, a global binary, or a curl-piped installer.
- Do not add a dependency only to run a one-off check. If the task truly needs new tooling, add and lock it explicitly.
- Public consumer docs may intentionally show `npx @navikt/aksel`. Preserve those examples unless the task changes consumer setup.
- If Corepack/Yarn reports a user-level configuration error, stop and report it. Never edit configuration outside the repository.
- Do not claim type safety from ESLint or tests. Run a TypeScript-aware command when TypeScript behavior changed.
## 1. Determine affected projects
Start from changed files, not the whole repository:
```sh
git diff --name-only --diff-filter=ACMR
git diff --cached --name-only --diff-filter=ACMR
git ls-files --others --exclude-standard
```
For each file, read its nearest `package.json`, `tsconfig.json`, test, story, and export surface before choosing commands.
| Path | Workspace | Preferred package checks |
| ------------------------------- | -------------------------- | ---------------------------------------------------------------------------------- |
| `@navikt/core/react/**` | `@navikt/ds-react` | `test` (Vitest + `tsc` type-check); `build` for export/type changes |
| `@navikt/core/css/**` | `@navikt/ds-css` | no `test` script: targeted `stylelint`, then `build` for imports/layers |
| `@navikt/core/tokens/**` | `@navikt/ds-tokens` | `test`, then `build` for generated output |
| `@navikt/core/tailwind/**` | `@navikt/ds-tailwind` | build `@navikt/ds-tokens` first, then `test` and `build` |
| `@navikt/aksel-icons/**` | `@navikt/aksel-icons` | `test`; `build` for generation/export changes |
| `@navikt/aksel-stylelint/**` | `@navikt/aksel-stylelint` | `test` |
| `@navikt/aksel/**` | `@navikt/aksel` | `build` **before** `test` (`migrations.test.ts` reads `dist/`) |
| `aksel.nav.no/website/**` | `website` | `test`; `validate:eksempler` for examples/templates; avoid `build` (needs secrets) |
| `aksel.nav.no/sanity-studio/**` | `aksel-sanity-studio` | `type-check`, then `test` when behavior changes |
| `apps/playroom/**` | `aksel-playroom` | no `test` script: `sync-imports` when ds-react exports change |
| `apps/mcp-server/**` | `aksel-mcp` | `test`, then `build` |
| `apps/figma-icon-plugin/**` | `aksel-icons-figma-plugin` | no `test` script: `build:plugin` |
| `tooling/changelog/**` | `aksel-changelog` | `typecheck` |
| `tooling/analyzer/**` | `aksel-analyzer` | `test` |
Read the current manifest before running a table command. A manifest is source of truth if scripts change.
## 2. Run changed-file lint
Group only matching files:
```sh
corepack yarn eslint --max-warnings=0 --no-warn-ignored <changed .ts/.tsx/.js/.jsx files>
corepack yarn stylelint <changed .css files>
corepack yarn biome lint --no-errors-on-unmatched <changed supported source/config files>
```
Do not pass unsupported file types to make a command appear comprehensive. Documentation-only changes need no code validation unless a documentation check exists.
## 3. Run TypeScript validation
Use nearest applicable project:
```sh
corepack yarn tsc --noEmit --incremental false --project path/to/tsconfig.json
```
`--incremental false` prevents validation from creating `.tsbuildinfo` files. For a composite project, use its workspace build/type-check script instead.
Prefer the workspace's own `type-check`, `typecheck`, or `build` script instead when it generates inputs, uses a build-specific tsconfig, or performs required transforms:
```sh
corepack yarn workspace <workspace> type-check
corepack yarn workspace <workspace> typecheck
corepack yarn workspace <workspace> build
```
If no suitable TypeScript command exists, report the gap. Do not substitute lint as a type-check.
## 4. Run behavior tests
Run the closest test file or workspace test command supported by that package. For visual or interaction changes, include the nearest story and Storybook browser test required by repository instructions.
Examples:
```sh
corepack yarn workspace @navikt/ds-react test
corepack yarn workspace website test
corepack yarn workspace aksel-mcp test
```
## 5. Escalate deliberately
Escalation order:
1. changed-file lint;
2. nearest TypeScript project;
3. focused test or affected workspace script;
4. dependent workspace build/test;
5. root `lint`, `test`, or `boot` only for cross-workspace changes, shared configuration, generated public output, or a failure that requires broader evidence.
Stop when every behavior and type surface touched by the change has a passing check. Report pre-existing or environment failures exactly; do not hide them with a weaker fallback.
+113
View File
@@ -0,0 +1,113 @@
---
name: code-review
description: "Review Aksel changes or pull requests for consumer-breaking API changes, React 17/SSR compatibility, accessibility, export wiring, security, tests and changesets. Use when reviewing a branch, diff or pull request."
argument-hint: "PR number, branch or files to review"
---
# Aksel code review
## Repository context
- Aksel is Nav's design system. The published `@navikt/*` packages are used across Nav on React 17–19, with SSR and CSR, in light and dark themes.
- One bad release breaks many teams at once. Public API, accessibility and compatibility matter most.
- Report findings. Don't edit code unless asked.
## Process
1. **Scope**: get the diff (`gh pr diff <n>` or `git diff origin/main...HEAD`) and the PR description. Note the stated goal.
2. **Read**: for every changed file, read the surrounding code, component `index.ts`, stories, tests and the matching `.github/instructions/*.instructions.md`. Never review from the diff alone.
3. **Check**: run the smallest validation that covers the change (`aksel-local-validation` skill). Tool output replaces style comments.
4. **Analyze** against the checklist below.
5. **Report** in the output format.
## Priorities
- 🔴 **Blocker**: must fix before merge. Breaks consumers, regresses accessibility, security issue or wrong behavior.
- 🟡 **Suggestion**: should fix. Missing test, docs or changeset, maintainability risk, over-editing.
- 💭 **Nit**: optional. Leave it out when in doubt.
Skip anything ESLint, Stylelint, Biome, Prettier or TypeScript already catches. No praise-only or speculative comments. Every finding says **why** it matters and what to do.
## Checklist
### Public API (🔴)
- Removed or renamed prop, export, CSS class, token or CLI command, or a changed default, on something already published → needs a `major` changeset, a deprecation path, or a revert.
- New props and exports follow nearby naming and defaults. Prefer additive changes. Colors go through `data-color`, not new `variant` values.
- Public props and components have JSDoc. `@default` and `@example` match behavior.
### Compatibility (🔴)
- No React 18/19-only APIs in `@navikt/*` (peer `react ^17 || ^18 || ^19`). Use the helpers in `@navikt/core/react/src/utils-external/` (`useId`, `useClientLayoutEffect`).
- SSR-safe: no `window`, `document` or `localStorage` at module top level or during render.
- No new runtime dependency in a published package without a clear reason (bundle size, consumer installs).
### Accessibility (🔴)
- Semantic HTML first. Correct roles, accessible names and states.
- Full keyboard support, logical focus order, focus returned after close, visible `:focus-visible`.
- Works in `forced-colors`, dark theme and at 200% zoom. Motion relies on the global `prefers-reduced-motion` handling.
- User-facing strings use `useI18n`, with keys in `nb`, `nn` and `en` under `@navikt/core/react/src/utils/i18n/locales/`.
### Wiring (🔴 for new public components)
- Stable export: component `index.ts` → `@navikt/core/react/src/index.ts` → `package.json` `exports`. Preview: `@navikt/core/react/src/preview.ts` plus `"./PREVIEW/<Name>"`.
- New CSS file is imported in `@navikt/core/css/src/index.css` with a `layer(...)`.
- Removed published CSS classes are listed in `@navikt/aksel-stylelint/src/deprecations.ts`.
### CSS and tokens (🟡)
- `.aksel-<component>` prefix. State through `data-*` or ARIA selectors, not modifier classes.
- Tokens only (`--ax-*`, internal `--__axc-*`). No hardcoded colors, spacing or radii.
- Renaming or removing a token is breaking (🔴). Semantic color changes are checked in both light and dark.
### Security and performance
- 🔴 No `dangerouslySetInnerHTML` or unsanitized HTML from props. No secrets or `process.env` values leaking into published bundles or website client code.
- 🔴 GitHub Actions: minimal `permissions`, new third-party actions pinned to a commit SHA, no untrusted input (`github.event.*`) interpolated into `run:`.
- 🟡 No top-level side effects in library modules (breaks tree-shaking). No avoidable re-renders: stable context values, no new object or function props per render in hot paths.
### Tests and docs (🟡)
- A behavior change has a story `play` test or Vitest test proving the user-facing contract. Queries use role and accessible name.
- Tests are deterministic: no dependence on timezone, current time or randomness.
- Edge cases that are easy to miss: controlled vs. uncontrolled, `ref`/`className`/`...rest` forwarding, `as` prop, empty and very long content.
- Website examples (`aksel.nav.no/website/pages/eksempler/`) are updated when usage changes.
### Release (🟡, 🔴 if breaking)
- User-facing change to a publishable package has a `.changeset/*.md` with the right bump and a `<Component>: <consumer-facing text>` summary. Website, playroom and tooling changes get none.
- Breaking change that consumers can migrate mechanically has a codemod in `@navikt/aksel/src/codemod/transforms/`, registered in `@navikt/aksel/src/migrations-config.ts`.
### Scope (🟡)
- Over-editing: diff out of proportion to the stated goal (unrelated renames, refactors, reformatting, extra validation). Tests don't catch it, and it makes the diff hard to review.
- No unrelated changes bundled. No skipped tests (`skip`, `!play-fn`) without a stated reason.
- AI-generated code: patterns copied without adapting to Aksel conventions, error handling that looks right but isn't, missing edge cases. Ask the author to explain non-obvious design choices.
## Output format
```md
### Summary
What the change does, overall verdict and key risks (1–3 sentences).
### Findings
| File | Line | Priority | Issue |
| ------------ | ---- | -------- | ------------------------------------------------------- |
| `Button.tsx` | 42 | 🔴 | `React.useId` breaks React 17: use internal `useId` |
| `button.css` | 10 | 🟡 | Hardcoded `#fff`: use `--ax-text-*` token for dark mode |
### Details
For each 🔴: why it matters and a suggested fix (short code snippet if helpful).
```
No findings: say so and list what you checked.
## Boundaries
- **Always**: read the actual code, run checks before reporting, order findings 🔴 → 🟡 → 💭.
- **Ask first**: architectural changes, adding or removing dependencies, reviewing outside this repository.
- **Never**: auto-fix or push, approve code you haven't read, skip the Public API, accessibility or security checks.
@@ -1,34 +0,0 @@
---
name: content-modeling-best-practices
description: Structured content modeling guidance for schema design, content architecture, content reuse, references versus embedded objects, separation of concerns, and taxonomies across Sanity and other headless CMSes. Use this skill when designing or refactoring content types, deciding field shapes, debating reusable versus nested content, planning omnichannel content models, or reviewing whether a schema is too page-shaped or presentation-driven.
---
# Content Modeling Best Practices
Principles for designing structured content that's flexible, reusable, and maintainable. These concepts apply to any headless CMS but include Sanity-specific implementation notes.
## When to Apply
Reference these guidelines when:
- Starting a new project and designing the content model
- Evaluating whether content should be structured or free-form
- Deciding between references and embedded content
- Planning for multi-channel content delivery
- Refactoring existing content structures
## Core Principles
1. **Content is data, not pages** — Structure content for meaning, not presentation
2. **Single source of truth** — Avoid content duplication
3. **Future-proof** — Design for channels that don't exist yet
4. **Editor-centric** — Optimize for the people creating content
## References
Start with the reference that matches the modeling decision in front of you, instead of loading every topic at once. See `references/` for detailed guidance on specific topics:
- `references/separation-of-concerns.md` — Separating content from presentation
- `references/reference-vs-embedding.md` — When to use references vs embedded objects
- `references/content-reuse.md` — Content reuse patterns and the reuse spectrum
- `references/taxonomy-classification.md` — Flat, hierarchical, and faceted classification
@@ -1,127 +0,0 @@
# Content Reuse Patterns
Effective content models maximize reuse while minimizing duplication. Here are patterns for achieving both.
## The Content Reuse Spectrum
```
Full Duplication ←————————————————→ Full Reference
(Copy everything) (Link to one source)
```
Most real-world content sits somewhere in between.
## Pattern 1: Shared Components
Create reusable content blocks that can be embedded anywhere.
**Use case:** Testimonials, FAQs, CTAs that appear on multiple pages.
```typescript
// Standalone testimonial documents
defineType({
name: "testimonial",
type: "document",
fields: [
defineField({ name: "quote", type: "text" }),
defineField({ name: "author", type: "string" }),
defineField({ name: "company", type: "string" }),
],
});
// Reference in page builders
defineField({
name: "pageBuilder",
type: "array",
of: [{ type: "reference", to: [{ type: "testimonial" }] }],
});
```
## Pattern 2: Shared Field Sets
Extract common fields into reusable definitions.
**Use case:** SEO fields, social metadata, common dates.
```typescript
// Shared field definition
export const seoFields = [
defineField({ name: "seoTitle", type: "string" }),
defineField({ name: "seoDescription", type: "text" }),
defineField({ name: "ogImage", type: "image" }),
];
// Spread into multiple types
defineType({
name: "page",
fields: [defineField({ name: "title", type: "string" }), ...seoFields],
});
defineType({
name: "post",
fields: [defineField({ name: "title", type: "string" }), ...seoFields],
});
```
## Pattern 3: Taxonomy References
Centralize classification for consistent tagging.
**Use case:** Categories, tags, topics that span content types.
```typescript
// Central taxonomy
defineType({
name: "category",
type: "document",
fields: [
defineField({ name: "title", type: "string" }),
defineField({ name: "slug", type: "slug" }),
],
});
// Used across content types
defineField({
name: "categories",
type: "array",
of: [{ type: "reference", to: [{ type: "category" }] }],
});
```
## Pattern 4: Content Fragments
Small, reusable pieces that combine into larger content.
**Use case:** Bios, addresses, contact info.
```typescript
// Fragment type
defineType({
name: "contactInfo",
type: "object",
fields: [
defineField({ name: "email", type: "email" }),
defineField({ name: "phone", type: "string" }),
defineField({ name: "address", type: "text" }),
],
});
// Reused across types
defineType({
name: "office",
fields: [
defineField({ name: "name", type: "string" }),
defineField({ name: "contact", type: "contactInfo" }),
],
});
```
## Anti-Pattern: Over-Abstraction
Not everything needs to be reusable. If content is only used in one place, embedding is simpler.
**Signs of over-abstraction:**
- References that are only used once
- Editors navigating multiple documents for one page
- Complex queries joining rarely-shared content
@@ -1,93 +0,0 @@
# Reference vs Embedding Content
When should content be linked (referenced) vs copied (embedded)? This decision affects reusability, query complexity, and editing workflows.
## The Trade-offs
| Aspect | Reference | Embedded Object |
| ---------------- | ----------------------------------- | ------------------------- |
| Reusability | ✅ Shared across documents | ❌ Copied per document |
| Single source | ✅ Update once, reflects everywhere | ❌ Must update each copy |
| Query complexity | Requires joins/expansion | Inline, simpler queries |
| Editing UX | Separate editing interface | All fields in one place |
| Independence | Can exist on its own | Only exists within parent |
## When to Reference
Use references when content:
- **Is reusable** — Same author across many articles
- **Needs central management** — Update product info once
- **Has its own lifecycle** — Published/draft independent of parent
- **Should stay in sync** — Price changes reflect everywhere
**Examples:**
- Author profiles
- Product catalog items
- Shared testimonials
- Category taxonomy
- Reusable CTAs
## When to Embed
Use embedded objects when content:
- **Is unique to this document** — Page-specific hero
- **Doesn't make sense alone** — SEO metadata
- **Should be copied, not linked** — Historical snapshot
- **Simplifies editing** — All fields in one form
**Examples:**
- SEO metadata
- Page-specific sections
- Address information
- Social links
- Configuration options
## Sanity Implementation
```typescript
// Reference: Author is reusable
defineField({
name: "author",
type: "reference",
to: [{ type: "author" }],
});
// Embedded: SEO is page-specific
defineField({
name: "seo",
type: "object",
fields: [
defineField({ name: "title", type: "string" }),
defineField({ name: "description", type: "text" }),
],
});
```
## The Hybrid Approach
Sometimes you want both: a reference for the canonical data, plus embedded overrides.
```typescript
defineField({
name: "featuredProduct",
type: "object",
fields: [
defineField({
name: "product",
type: "reference",
to: [{ type: "product" }],
}),
defineField({
name: "overrideTitle",
type: "string",
description: "Optional: Override the product title for this context",
}),
],
});
```
Query uses `coalesce(overrideTitle, product->title)`.
@@ -1,69 +0,0 @@
# Separation of Content and Presentation
The most important principle in structured content: **separate what content IS from how it LOOKS**.
## The Problem
When content is tied to presentation:
- Redesigns require content migration
- Content can't be reused across channels (web, mobile, voice)
- Editors make design decisions instead of content decisions
- A/B testing requires duplicate content
## The Principle
Model content based on **meaning and purpose**, not visual appearance.
### Bad: Presentation-Focused
```
BigHeroText → What if we want small heroes?
RedButton → What if brand colors change?
ThreeColumnLayout → What if mobile needs one column?
LeftSidebar → Position is a frontend concern
MobileImage → Device-specific content is fragile
```
### Good: Meaning-Focused
```
Headline → The main message (render however)
CallToAction → An action we want users to take
Features → A list of things (columns decided by frontend)
RelatedContent → Content relationships (position by context)
Image → One image with responsive crops
```
## Testing Your Model
Ask: "If we completely redesigned the site, would these field names still make sense?"
- `threeColumnFeatures` → ❌ Fails (what if 2 columns?)
- `features` → ✅ Works (describes the content's purpose: a list of product features)
- `blueHighlightBox` → ❌ Fails (what if we go purple?)
- `callout` → ✅ Works (describes the content's role: an attention-grabbing aside)
## Sanity Implementation
```typescript
// ❌ Avoid presentation-focused names
defineField({ name: "bigHeroText", type: "string" });
defineField({ name: "fontSize", type: "number" });
defineField({ name: "backgroundColor", type: "color" });
// ✅ Use meaning-focused names
defineField({ name: "headline", type: "string" });
defineField({
name: "emphasis",
type: "string",
options: { list: ["standard", "prominent"] },
});
defineField({
name: "tone",
type: "string",
options: { list: ["neutral", "warning", "success"] },
});
```
The frontend translates `tone: 'warning'` to visual styles. Content stays semantic.
@@ -1,150 +0,0 @@
# Taxonomy and Classification
Organizing content with taxonomies enables filtering, navigation, and content relationships. Well-designed taxonomies scale; poorly designed ones become maintenance nightmares.
## Types of Classification
### Flat Taxonomy
Simple list of terms with no hierarchy.
**Use for:** Tags, simple categories
**Example:** Blog tags: "javascript", "react", "tutorial"
```typescript
defineType({
name: "tag",
type: "document",
fields: [
defineField({ name: "title", type: "string" }),
defineField({ name: "slug", type: "slug" }),
],
});
```
### Hierarchical Taxonomy
Terms with parent-child relationships.
**Use for:** Product categories, content sections
**Example:** Electronics > Phones > Smartphones
```typescript
defineType({
name: "category",
type: "document",
fields: [
defineField({ name: "title", type: "string" }),
defineField({ name: "slug", type: "slug" }),
defineField({
name: "parent",
type: "reference",
to: [{ type: "category" }],
description: "Parent category (leave empty for top-level)",
}),
],
});
```
### Faceted Classification
Multiple independent dimensions.
**Use for:** Complex filtering (e-commerce)
**Example:** Filter by color AND size AND price range
```typescript
// Multiple taxonomy types
defineField({ name: "color", type: "reference", to: [{ type: "color" }] });
defineField({ name: "size", type: "reference", to: [{ type: "size" }] });
defineField({
name: "material",
type: "reference",
to: [{ type: "material" }],
});
```
## Design Principles
### 1. Mutual Exclusivity (When Appropriate)
Categories should be distinct. If items frequently belong to multiple categories, consider tags instead.
**Categories:** One primary classification
**Tags:** Many optional classifications
### 2. User-Centric Naming
Use terms your audience uses, not internal jargon.
**Bad:** "Content Assets" (internal term)
**Good:** "Resources" or "Downloads" (user term)
### 3. Balanced Depth
Too shallow: Everything lumped together
Too deep: Users can't find anything
**Rule of thumb:** 3-4 levels max for hierarchies
### 4. Scalable Structure
Design for 10x growth. Will your structure work with 10,000 items?
## Querying Taxonomies
### Get all items in a category
```groq
*[_type == "product" && category._ref == $categoryId]
```
### Get items in category OR children
```groq
// First get all descendant category IDs
*[_type == "product" && category._ref in
*[_type == "category" && (
_id == $categoryId ||
parent._ref == $categoryId ||
parent->parent._ref == $categoryId
)]._id
]
```
### Get category tree
```groq
*[_type == "category" && !defined(parent)]{
title,
slug,
"children": *[_type == "category" && parent._ref == ^._id]{
title,
slug,
"children": *[_type == "category" && parent._ref == ^._id]{
title,
slug
}
}
}
```
## Common Mistakes
### Over-categorization
Creating a category for everything results in mostly-empty categories.
**Fix:** Start minimal, add categories as content grows.
### Inconsistent Granularity
Some categories broad ("Technology"), others narrow ("React 18 Server Components").
**Fix:** Define clear criteria for category creation.
### No Governance
Anyone can create taxonomy terms, leading to duplicates and inconsistency.
**Fix:** Limit who can create/edit taxonomy documents. Use validation.
@@ -157,7 +157,7 @@ export type { <Component>TriggerProps };
Update imports in `<Component>.meta.ts` to reflect new paths. If the meta file imports from the component's `index.ts`, no changes are needed.
If component has no meta file, create one in the component root with the following content based on existing patterns.
If component has no meta file, create `<Component>.meta.ts` in the component root. Copy the shape of `@navikt/core/react/src/accordion/Accordion.meta.ts`: import from `./index`, `name`, a `components` map using dotted keys for sub-components (`"Accordion.Item": AccordionItem`), and `keywords`, then `export { metadata }`.
Note that each standalone component should have a meta file. But a "sub-component" (like `AccordionItem`) does not need a meta file.
### 7. Validate No Breaking Changes
@@ -169,7 +169,7 @@ Note that each standalone component should have a meta file. But a "sub-componen
Concretely: grep for `export` lines in both versions and diff them. All component names and type names must match exactly.
**Build.** Run `yarn workspace @navikt/ds-react build` — must succeed with no TypeScript errors.
**Build.** Run `corepack yarn workspace @navikt/ds-react build` — must succeed with no TypeScript errors.
**Package root.** Verify `@navikt/core/react/src/index.ts` still re-exports the component. No changes needed there unless the component's `index.ts` path changed (it shouldn't).
@@ -282,10 +282,7 @@ dialog/
- **No breaking changes.** Public export names and prop shapes must be identical after restructuring.
- **Named exports only.** No `default` exports; group named exports at the bottom of each file (values first, then types).
- **Compound roots use `Object.assign`.** No `as <Component>Component` cast or `<Component>Component` interface — it breaks `yarn docgen:meta` prop extraction.
- **React 17 compatible.** No React 18/19-only APIs. Import React explicitly in `.tsx` files.
- `index.ts` must start with `"use client"`.
- Use tokens, not hardcoded values.
- Preserve `forwardRef`, `className`, `...rest`, `as`/`OverridableComponent` patterns.
- Component rules (React 17 compatibility, `"use client"`, `forwardRef`/`className`/`...rest`/`as`, tokens) live in `.github/instructions/ds-react-component.instructions.md`. They still apply.
- Keep JSDoc on public props and components. The component-level JSDoc block sits directly above the `Object.assign` call; sub-component `@see` tags go on the keys inside the `Object.assign` object literal.
## Reference Files
@@ -1,234 +0,0 @@
---
name: next-cache-components-adoption
description: >
Turn on Cache Components in a Next.js app and resolve the blocking routes it
surfaces. Use when the user wants to enable, adopt, or migrate to Cache
Components, flip the `cacheComponents` flag, work through a flood of
blocking-prerender / instant validation errors, run the
`cache-components-instant-false` codemod, or decide between opting routes out
with `export const instant = false` and fixing them in place.
---
# next-cache-components-adoption
Enable Cache Components on an app and walk it to a passing build. This skill sequences the work; per-error recipes live in the dev overlay fix cards and the build's terminal output. The [migrating to Cache Components guide](https://nextjs.org/docs/app/guides/migrating-to-cache-components) is the canonical reference for the concepts and per-API recipes this skill applies — consult it whenever the skill steps reference a pattern (`"use cache"`, `cacheLife`, `<Suspense>` placement, etc.) and you want the full explanation.
## requires
- **App Router project.** Cache Components is an App Router feature; `cacheComponents: true` does nothing for `pages/` routes. If the project has a `pages/` or `src/pages/` tree but no `app/` or `src/app/` tree, stop and tell the user — Pages → App migration is its own project, not part of this skill. A hybrid app (both `pages/` and `app/`) is fine: the flag affects the `app/` routes; `pages/` routes are unaffected and don't need opt-outs.
- **Next.js 16.3 or later.** That release is where the pieces this skill relies on land: top-level `cacheComponents`, `export const instant`, the dev-overlay instant-navigation validation warnings, and the `cache-components-instant-false` codemod. If `next --version` reports below 16.3, upgrade first:
- `npx @next/codemod@latest upgrade latest` to apply the version-to-version codemods.
- Read the relevant [version upgrade guide](https://nextjs.org/docs/app/guides/upgrading) (e.g. [Version 16](https://nextjs.org/docs/app/guides/upgrading/version-16)) for what the codemod doesn't cover.
- **No incompatible config keys.** `cacheComponents: true` errors on any file that still exports `dynamic`, `revalidate`, or `fetchCache`. **Translate, don't delete.** Each export encodes behavior the route needs to keep doing; migrate each one to its Cache Components equivalent via the [migration guide's per-key sections](https://nextjs.org/docs/app/guides/migrating-to-cache-components#enable-cache-components). If a value can't be cleanly translated yet, leave a `// TODO: Cache Components adoption — restore revalidate = 3600` comment so the loop picks it up. The `cache-components-instant-false` codemod does not touch these.
- **`experimental.dynamicIO` is fatal.** It was renamed to top-level `cacheComponents` and the old key now aborts before any build can run — remove it (or replace with `cacheComponents: true`) first. `experimental.useCache` is still accepted as a deprecated alias; redundant once `cacheComponents: true` is set, so remove it for clarity.
### notes
- **No passing baseline before the flag.** If the app already uses `"use cache"`, the pre-flag build errors with `please enable the feature flag cacheComponents`. Enabling the flag is the first thing you do (in Incremental, before the codemod; in Direct, before fixing routes) — not a thing to do _after_ getting a passing build. Note this in your starting summary so it doesn't read as a regression.
- **Offline docs.** Guide links have offline copies under `node_modules/next/dist/docs/` (bundled since Next.js 16.2), with the directory layout numbered for ordering (e.g. `node_modules/next/dist/docs/01-app/02-guides/migrating-to-cache-components.md`). If you can't predict the numbered prefix, `find node_modules/next/dist/docs -name '<slug>.md'` resolves it. The `/docs/messages/*` error pages are not bundled.
- **Older versions without bundled docs.** Suggest `npx @next/codemod@latest agents-md` to the user before starting: it downloads a version-matched copy to `.next-docs/` and writes an index into `AGENTS.md` / `CLAUDE.md`. It touches files in their repo, so ask first and run it only if they want it.
## the shape of the work
There's one loop: walk the route tree top-down, one feature at a time, adopting each route against `next dev` + a browser. The build is a final check for each feature, not the working surface.
The choice in step 1 is whether to opt every route out of validation first or fix routes as you go. Either way the loop is the same:
- **With a quiet pre-step (Incremental).** Run the codemod to opt every page and layout out of validation. Once you've also fixed what the codemod can't (sync-IO calls, leftover `revalidate`/`dynamic`/`fetchCache` exports), the build passes; you ship that as its own PR and then start the loop — removing one opt-out at a time and adopting that route. This splits the work into small, reviewable PRs.
- **Without (Direct).** Enable `cacheComponents` and start the loop on whatever the build flags first. Same loop, but every fix sits on one branch until adoption is complete.
In both, the per-route success bar is the same: **dev loop reports no errors AND `next build` passes**. Check in with the user after every feature. Expect to spend most of the time in the loop, not in the pre-step.
## background
`cacheComponents: true` requires every route to be prerenderable. A route that reads request-time data outside `<Suspense>` is "blocking" and fails the build. `export const instant = false` marks a route as allowed to block, which clears it in both dev and build; on a layout it covers the whole subtree during the build, but client navigations still validate each descendant segment on its own. Reads wrapped in a [`"use cache"`](https://nextjs.org/docs/app/api-reference/directives/use-cache) function count as cache boundaries, not blocking reads.
Three classes of blocker come up, usually in this order:
1. **Request-time reads** (`cookies()`, `headers()`, `await params`, `await searchParams`). All four block when awaited at the top of a page or layout. `params` and `searchParams` often get missed because they're not framed as "request data" the way cookies and headers are. The fix is to push the read into a `<Suspense>`-wrapped child — and for `params`/`searchParams`, forward the promise into the child and await it there; don't `await` at the page top.
2. **Sync-IO at module/render time** (`new Date()`, `Date.now()`, `Math.random()`, `crypto.randomUUID()`). These fail the build even with `instant = false` — the opt-out doesn't suppress them. If they're in a shared layout, they block every route under it. The codemod can't fix them; you have to translate each one by hand before the build can pass (see the [incremental pre-step](#incremental)). Grep the whole repo for these calls before running anything else.
3. **`"use cache"` files that read request data.** A file with a top-level `"use cache"` directive can't export `instant`; combining the two errors with `Only async functions are allowed to be exported in a "use cache" file.`, which means the directive was wrong for that route. Remove it before running the codemod.
## working surfaces
### finding blocking routes
Prefer `next dev` over `next build` while you work.
- **`next dev`** — the working surface. Visit a route; its blocking errors surface in the dev overlay with full stack traces and fix cards linking the per-error docs. Work one route at a time — errors don't accumulate in one place. The route itself still returns HTTP 200, so read the overlay (or `.next-dev.log`), not status codes. A cleared overlay is one half of calling a route clean — the other half is browser verification (see [step 2](#step-2-the-inner-loop-remove-opt-outs-one-feature-at-a-time)) and a passing build for that route.
- **`next build`** — detection only. The build is `next dev`'s authoritative check, not its replacement. Use it as the last gate on each feature in the loop (a passing build is part of the per-route success bar) and as the final verification across the whole app. In Incremental, the build also confirms the pre-step (codemod opted every route out, no shared layout still has a sync-IO blocker) before you ship that PR. Don't reach for the build instead of the dev loop while you're working a route — a passing compile doesn't tell you what ended up in the static shell and what streamed. By default the build stops at the first blocking route, so it's also poor for sizing the work. Two flags help when iterating: `--debug-build-paths` builds only the routes you name (comma-separated glob patterns of file paths relative to the project root, e.g. `--debug-build-paths="app/admin/**/page.tsx"` — not URL paths; `--debug-build-paths="app/(marketing)/about/page.tsx"` — not `/about`; `--debug-build-paths="app/admin"` matches nothing and silently builds zero routes), and `--debug-prerender` disables the early exit so the build continues past the first prerender failure, reports every blocking route, and prints a fuller stack trace that names the originating file and line.
Every blocking error has a docs page — open it. Both the dev overlay and the build terminal print a `https://nextjs.org/docs/messages/<slug>` link with each error. That page is the canonical recipe for the fix; the inline message is a summary. Fetch the link for every distinct error you encounter, even if you think you know the pattern — the recipes evolve, and the same error class can have different correct fixes depending on what the route reads. Don't improvise from the inline message alone. (`/docs/messages/*` pages aren't bundled offline; if you have no network, fall back to the per-API guides under `node_modules/next/dist/docs/` and note the limitation when you report back.)
### verifying each fix at runtime
A passing build or a cleared overlay isn't proof the route actually behaves — Cache Components is a runtime concern (a static shell with streamed data). Verify after every fix, not only at the end.
In preference order:
1. **[`next-dev-loop`](https://github.com/vercel/next.js/tree/canary/skills/next-dev-loop) — strongly preferred.** Cross-checks `/_next/mcp` against the live browser via `agent-browser` and surfaces both compile and runtime issues in one pass. The diagnostics (React tree, suspense boundaries, console + network) are richer than poking at `next dev` by hand.
Install it before starting the loop. Don't wait until you hit something `next dev` alone can't explain. Run:
```bash
npx skills add https://github.com/vercel/next.js/tree/canary/skills/next-dev-loop
```
The skill requires `agent-browser >= 0.27.0` and walks you through it.
**Requires Turbopack.** If `package.json`'s `dev` script passes `--webpack`, flag it to the user and ask whether there's a reason to stay on webpack. If not, switch to Turbopack (the Next.js 16.3+ default). If they want to keep webpack, skip this install and use the [build-only loop](#the-loop-build-only-fallback) instead.
You don't need permission to install `next-dev-loop` itself. It's a tool, like installing a dev dependency. If a user is present, briefly tell them you're installing it for verification. In a non-interactive run (CI, dashboard, sandbox), install it without asking — "can't prompt the user" is not a reason to skip. The only legitimate skip is a real technical blocker: no network, no npm, read-only filesystem, a stated no-new-deps policy, or a webpack-only dev script. If you skip, name the specific blocker in your final report.
2. **A browser you can drive yourself.** Playwright, `agent-browser` directly, any browser-automation tool. Use only when `next-dev-loop` is genuinely blocked. You'll miss the framework-side checks (`/_next/mcp`), so DOM assertions alone don't catch every regression — be more cautious about what you call "verified."
3. **Build-only.** If you can't run a dev server at all, the build is your only signal. `○ (Static)` routes with no `<Suspense>` are fully verified by the build (nothing streamed to test). `◐ (Partial Prerender)` routes are only shell-verified — flag them when you report back.
4. **No tooling at all.** Ask the user to run the dev server (or build) and report what they see, or commit the milestone you've reached and hand off.
## step 1: choose a strategy
Ask the user, in terms of the PRs they want, not the size of the job. Never use the internal labels (Incremental, Direct) when talking to the user — those are your own scaffolding. Ask in terms of PRs and features, e.g.: _"Do you want me to first open a PR that turns on Cache Components and opts every route out of validation, then handle the actual route adoptions feature-by-feature in follow-up PRs? Or do everything on one branch?"_ Even on a tiny app, the incremental path still has value (review-sized PR, revertible, the `// TODO: Cache Components adoption` markers double as your work queue for next session). Don't pick on their behalf.
If there's no user to ask, default to **Incremental** and document the choice.
- **Incremental** — quiet pre-step + the loop. Run the codemod to opt every page and layout out of validation, get the build passing, stop and check in with the user (see [end of the pre-step](#end-of-the-pre-step-check-in)), then enter [step 2's loop](#step-2-the-inner-loop-remove-opt-outs-one-feature-at-a-time) and ship each feature as a follow-up PR.
- **Direct** — skip the pre-step. Enable `cacheComponents` and go straight to [step 2's loop](#step-2-the-inner-loop-remove-opt-outs-one-feature-at-a-time); the build's blocking routes are the work queue.
### incremental
Before invoking the codemod, fix the two classes of blocker it can't.
1. **Sync-IO at module/render time.** Grep the whole repo for `new Date()`, `Date.now()`, `Math.random()`, and `crypto.randomUUID()` (not only `app/**/layout.{js,jsx,ts,tsx}` — the read might live in any component imported by a layout). Unblock each match with the `await connection()` + `<Suspense>` fix from its `blocking-prerender-*` error card: it defers the value to request time, exactly as it behaved before the migration, so it needs no product decision. Add this exact comment on the line above the `await connection()`:
```tsx
// TODO: Cache Components adoption. Added to unblock the build: remove this connection() to re-trigger the error and review the fix options.
```
It shares the `TODO: Cache Components adoption` prefix with the comments the codemod writes, so the check-in grep finds both. Removing the `await connection()` makes the error fire again with its fix cards — the same motion as removing an opt-out in the loop.
2. **Incompatible segment configs.** Grep for `^export const (revalidate|dynamic|fetchCache)` across `app/` and translate per the `requires` note above. The codemod does not touch them; leaving them in place fails the build after the codemod.
The codemod refuses to run on a dirty working tree. Commit or stash unrelated work first, or pass `--force` to let its edits land alongside your WIP. Common false positive: if you recently upgraded Next.js, `package.json` and the lockfile will already be dirty — commit those first.
Use the `@canary` channel, not `@latest`. The `cache-components-instant-false` transform isn't in the stable `@next/codemod` release; `@next/codemod@latest` errors with `Invalid transform choice`.
```bash
npx @next/codemod@canary cache-components-instant-false ./app
```
Inserts `export const instant = false` (with a `// TODO: Cache Components adoption` comment) into every `app/**/{page,layout,default}` file, skipping files that already declare `instant` and any module marked `"use client"` or `"use server"`. Then set `cacheComponents: true`. The TODO comments are the work queue for the loop.
If the codemod isn't available (older `@next/codemod`, sandboxed environment, offline run), reproduce it by hand: for every `app/**/{page,layout,default}.{js,jsx,ts,tsx}` that isn't `"use client"` or `"use server"` and doesn't already declare `instant`, insert this after the imports:
```ts
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
export const instant = false;
```
The codemod opts every segment out, not only the root, on purpose. Resolution is top-down, first-explicit-config-wins: the highest `instant = false` decides the whole subtree. With an opt-out on every segment, removing one segment's opt-out validates only that segment; descendants keep their own opt-outs and stay passing. If only the root were opted out, removing it would re-arm validation for the entire app at once.
Because the highest opt-out wins, remove them top-down (root layout first, then descend). Removing a leaf's opt-out does nothing while an ancestor still holds one.
Confirm the pre-step with `next build`. The build is the proof, not the codemod run — a shared layout that calls `new Date()` / `Math.random()` directly still fails regardless of the opt-out (see [background](#background)).
After the build passes, confirm the root layout got an opt-out (`grep -n "export const instant" app/layout.*`). The root layout renders every route, including framework routes like `/_not-found`, so if it was missed, add `export const instant = false` to it by hand.
Synthetic routes like `/_not-found` have no user file — when they block, fix the root layout's opt-out, not the synthetic route. Client Components (`"use client"`) get no opt-out (it's a build error — `E1344` — to export `instant` from them) and rarely block on their own; when a client route blocks, fix the server-side data in its ancestor layout.
### end of the pre-step: check in
Incremental only. Stop here before starting step 2 — the pre-step is the shippable PR. Talk to the user in their language; don't say "Incremental" or other internal labels; talk about adoption, PRs, and what the app does now. Tell them:
- What you did: turned on Cache Components, ran the codemod that opts every page and layout out of the new validation (or did it by hand), fixed any blockers the codemod can't (list them), confirmed the build passes.
- What changed: every page and layout in `app/` now exports `instant = false` with a `// TODO: Cache Components adoption` comment, except client components and any that already had an `instant` export.
- What to sanity-check: the diff is mostly mechanical (new exports + comments). The build passes. Routes still behave exactly as they did before — the opt-outs preserve current behavior; no rendering changes yet.
- The question: "Want to open this as its own PR before we start adopting Cache Components route by route? Or keep going on this branch?" Wait for the answer.
Moving to step 2 without checking in defeats the point of taking the incremental path.
### direct
Set `cacheComponents: true` and move to [step 2](#step-2-the-inner-loop-remove-opt-outs-one-feature-at-a-time). The build's blocking routes are the work queue.
## step 2: the inner loop, remove opt-outs one feature at a time
A "feature" is a single product surface — `app/settings/profile/**`, `app/posts/[slug]/**` — not a whole top-level app like `app/dashboard/**`. Finish one end-to-end before starting the next.
Within a feature, walk top-down (layouts before pages, root layout first). Removing a layout's opt-out before its descendants exposes the layout's own blocking reads. (Direct: there are no opt-outs to remove — fix each failing route; if a hand-written opt-out on an ancestor shadows it, remove that first.)
A passing build mid-walk doesn't mean the layout is clean. Removing a layout's opt-out while its descendant pages still have theirs keeps the build passing — each page shadows the inherited validation. The layout's actual blocking reads only surface once nothing below it shadows them. Don't call a feature done at the layout boundary.
Use the **with-a-browser** loop unless a browser is genuinely unreachable. The [`next-dev-loop`](#verifying-each-fix-at-runtime) skill is the source of truth for what counts as "browser available" and how to install it.
### the loop, with a browser (preferred)
Per route:
- Remove the opt-out (Incremental) or target the failing route (Direct).
- Reload in dev. Overlay clean? Skip to verify. Overlay still red? Fix.
- Fix — fetch the docs page linked from the error (`https://nextjs.org/docs/messages/<slug>`), apply the recipe from there. The inline overlay text is a summary; the docs page is the source of truth.
- Verify in the browser. Confirm the visible content on first paint is what you intended in the shell — not stuck on a fallback, not silently streaming everything out of an empty shell.
- Re-check siblings if the fix touched shared code (a layout, a sidebar component). A shared-shell change can fix the route you're on and break a sibling.
### the loop, build-only (fallback)
Used when there's no way to drive a browser — CI, sandbox, the user has no `next dev` running and you can't start one. Weaker signal: confirms the build passes and the route prerenders, but not what ended up in the static shell vs streamed.
Per route:
- Remove the opt-out (Incremental) or target the failing route (Direct).
- Rebuild with `--debug-build-paths app/<route>/**` (only that route) or `--debug-prerender` (full build, but past the first failure). Route passing? Move on. Still blocking? Fix.
- Fix — fetch the docs page linked from the error (`https://nextjs.org/docs/messages/<slug>`), apply the recipe from there.
- Re-check siblings if the fix touched shared code.
- Flag the route as build-only-verified when you hand the feature off. Each `◐` route still needs a browser pass before the feature is done.
### loop notes
- The [three blocker classes from background](#background) often get missed when fixing in place. Caching a downstream fetch (`getThing(id)`) doesn't clear an `await params` at the top of the page body — push the param promise into the `<Suspense>`-wrapped child.
- Ambiguous calls are user check-ins, not agent judgment. When you're not sure which fix fits, the blocking code looks security-sensitive, or the user might want to keep the route blocking on purpose — read [references/per-page-decisions.md](./references/per-page-decisions.md) before editing. Show the route while you ask: the `next-dev-loop` session runs the browser headed, so drive to the page and leave it on screen so the user is looking at the thing they're deciding about, with a screenshot as the fallback when a headed browser isn't possible. "Should this stay blocking?" is much easier to answer while looking at the page than at a file path.
- Don't narrate the refactor with comments. The only comment the codemod (or you) should leave is `// TODO: Cache Components adoption` on opt-outs, and the user's existing comments. Don't annotate every `<Suspense>` boundary or `"use cache"` call with what it does — the code says that. Drop a comment only when the _why_ isn't clear from the code (e.g. a deliberate Block with a reason).
Keep a todo list of the feature's routes. When every route in the feature is clean, move to step 3.
## step 3: verify the feature
Checklist before checking in with the user:
- `next build` completes without blocking-route errors.
- No bare TODOs in the feature: `grep -rn "TODO: Cache Components adoption"` finds both the codemod's opt-out comments and the sync-IO unblocks from the pre-step. Any `instant = false` left behind is a deliberate, documented Block — comment rewritten to a reason (see [references/per-page-decisions.md](./references/per-page-decisions.md) → "when to leave a Block in place"). Any `await connection()` left behind has been reviewed and kept on purpose, not left over from the pre-step.
- Each route visited in the browser: confirm the static shell renders first and every `<Suspense>` fallback resolves to its real content. Capture both states if you can — the fallback (mid-stream) and the final paint — so you have a streaming-experience demo to show the user. Throttle the network in the browser if streaming is too fast to observe.
Then check in with the user. Same rule as the pre-step: speak their language. Don't say "feature-by-feature loop" or other internal labels; talk about the feature you adopted and what the user will see.
- What you did: which routes you touched, and the user-visible result per route (e.g. "the post page now streams the article body behind a skeleton while the layout stays static").
- What changed: opt-outs removed, fallbacks added, caching boundaries introduced.
- Show, don't tell. The `next-dev-loop` session runs the browser headed, so drive the route live for the user so they see the static shell → fallback → final content sequence in real time. If you can't drive a live browser, attach the before/after screenshots you captured instead.
- Give them the click-through: a short table of the feature's routes — the URL to open and what to look for (what renders instantly, which fallbacks appear, what streams in) — so they can verify each one themselves.
- The question: "Want to open this feature as a PR and move on to the next, or stop here?" Wait for the answer.
**Trivial features can skip the check-in.** If adopting a feature only meant removing its `// TODO: Cache Components adoption` opt-out (no `<Suspense>` added, no `'use cache'` introduced, no render order change), the user sees nothing different. Move on to the next feature without stopping; mention it in passing the next time you do check in.
When the loop has run on every feature — every remaining `instant = false` sits under a reason comment, `grep -rln "TODO: Cache Components adoption" app` returns nothing — point the user at [further reading](#further-reading) if they want to push the experience further, or stop and ship.
### route table glyphs
`ƒ` → `◐` is where adoption usually lands. `◐ (Partial Prerender)` means a static shell prerenders and the request-time content streams in — the goal state for any route that reads `cookies()`, `headers()`, `params`, or `searchParams`. Some routes legitimately stay `ƒ` when they do request-time work through a documented escape hatch (e.g. a layout that uses `await connection()`); the page is no longer _opted out_, it's genuinely dynamic. Don't remove the escape hatch only to chase a `◐`. The inverse holds: `instant = false` does not force a route to be `ƒ`. The glyph reflects what the route does at prerender time, not which validation knobs it exports.
`◐` tells you a shell exists, not what's in it. A `<Suspense>` boundary placed too high (e.g. wrapping the entire page body, or `<Suspense fallback={null}>` around the article content) pushes the visible content out of the static shell into the streamed payload; the build still reports `◐` because _some_ shell prerendered (often only `<html><body>` with framework markup). The route table can't tell you what's in the shell; a browser can. If the shell is empty and everything streams, pull the `<Suspense>` boundary down closer to the actual dynamic read.
## further reading
The work below is optional and lives in the docs — link the user to them and let them decide which to take on next. Don't walk these through inside this skill.
- [Instant navigation](https://nextjs.org/docs/app/guides/instant-navigation) — dev-only validation warnings the overlay raises on client navigation. Same shape as the blocking-prerender errors you cleared in step 2; the guide covers the per-warning details. Recommend it next if the user wants navigations to actually be instant (a passing build doesn't guarantee that — a `<Suspense>` above the shared layout caught the page-load case but doesn't cover client navigation).
- [`next-partial-prefetching-adoption`](https://github.com/vercel/next.js/tree/canary/skills/next-partial-prefetching-adoption) — the follow-up skill that adopts Partial Prefetching: it audits `<Link prefetch={true}>` calls (driven by the dev overlay's `link-prefetch-partial` warning) with the flag off first, then flips the `partialPrefetching` config. It sequences this the same way this skill sequences Cache Components, but the insights are dev-only, so it's a browser click-through, not a build loop. Recommended after instant navigation, since those fixes feed directly into how much of each route the shell can prefetch. Concepts live in the [Adopting Partial Prefetching guide](https://nextjs.org/docs/app/guides/adopting-partial-prefetching).
- [Prefetching](https://nextjs.org/docs/app/guides/prefetching) and [Runtime prefetching](https://nextjs.org/docs/app/guides/runtime-prefetching) — broader prefetching reference. Runtime prefetching extends the static shell with per-session content; reach for it when a route's shell is too thin to be useful and Partial Prefetching alone doesn't cover the gap.
- [Prevent regressions with e2e tests](https://nextjs.org/docs/app/guides/instant-navigation#prevent-regressions-with-e2e-tests) — the `@next/playwright` [`instant()`](https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config/instant#testing-instant-navigation) helper asserts on the UI that's available immediately on navigation, so regressions surface in CI. Recommend it once a route is instant: `next-dev-loop` confirms it _now_; an `instant()` test keeps it that way.
- [`next-cache-components-optimizer`](https://github.com/vercel/next.js/tree/canary/skills/next-cache-components-optimizer) — a separate skill that grows each route's static shell so more of the page prerenders and less streams in. Pure optimization, not part of adoption.
@@ -1,25 +0,0 @@
# per-page decisions: removing `instant = false`
Read this when a route still blocks after you remove its `instant = false` and the dev overlay's fix card isn't enough on its own. Each section here covers a judgment call the agent shouldn't make alone.
## deciding what to do with a blocking read
Read the full linked page behind the fix card — not only the inline snippet — before editing. The card unblocks the build, but the page covers the details that make the route's navigation actually instant (e.g. where to place a `<Suspense>` boundary). Don't improvise.
If you're unsure which fix fits, the right call usually depends on what this part of the page is _for_, which the code doesn't capture. Ask the user about their goal for it rather than guessing. Frame it as a product/UX question: should this content be there instantly on load, or is it fine for it to stream in a moment later? Should everyone see the same thing (cacheable) or is it per-user / per-request? Tie the technical fix to that answer (cache it, wrap it in `<Suspense>`, or keep it request-time), so they're deciding the experience, not the API.
## security gates and other code you can't infer
If the blocking code looks like it's there for a _reason you can't infer_ — a security gate at the page top (`await verifyAccess()`, an auth redirect, a feature-flag check) where moving it inside `<Suspense>` would change what the code guarantees — stop and ask the user before refactoring. The build error wants `<Suspense>`, but wrapping a gate in `<Suspense>` defeats the gate. Only the person who wrote it knows whether to keep the route blocking (`instant = false` as a documented Block), restructure the page so the gate runs differently, or move the check to [Proxy](https://nextjs.org/docs/app/api-reference/file-conventions/proxy).
If _every_ route under a layout is gated this way, a documented Block on the layout is the correct end state. Moving the gate to [Proxy](https://nextjs.org/docs/app/api-reference/file-conventions/proxy) is the architectural fix, not a Cache Components one, and that's a follow-up rather than something to hold the migration on.
For the broader picture, read the [Authentication guide](https://nextjs.org/docs/app/guides/authentication) (where auth checks belong: Proxy for routing, Data Access Layer for data) and the [Data Access Layer section of Data Security](https://nextjs.org/docs/app/guides/data-security#data-access-layer) (centralized auth checks that compose with `'use cache'`).
If you don't know how to make a piece of code Cache Components–correct without changing what it does, ask.
## when to leave a Block in place
If a route is genuinely meant to block — it's inherently per-request with no useful static shell — or the refactor would be large and the user would rather not take it on now, that's a legitimate outcome. Keep `instant = false`, but confirm it with the user first and turn its `// TODO: Cache Components adoption` comment into a reason, e.g. `// instant = false: kept on purpose — fully request-time dashboard` or `// instant = false: deferred, refactor too large for now`.
A documented, deliberate Block is fine to leave after the migration; an undocumented leftover opt-out is not.
@@ -1,453 +0,0 @@
---
name: next-cache-components-optimizer
description: >
Drive a Next.js route to instant navigation by setting up an agentic loop,
under Cache Components / PPR, on initial load (hard navigation) and
client-side navigation (soft navigation). Encode the goal as a failing
@next/playwright instant() e2e and work it to green, one verified route at a
time; the shipped test then guards against regression. Use when asked to make
a route's navigation instant (its static shell commits immediately), fix a
route whose static shell isn't prerendered/served/prefetched, grow a route's
static shell or fix its slow first paint, diagnose which Suspense boundary
keeps a route out of its static shell, or write the instant() e2e guard for
one. Requires Next.js 16.3+ with cacheComponents; directs an upgrade if older.
---
# next-cache-components-optimizer
Set up an agentic optimization loop that drives a Next.js route from "not
instant" to "instant" and keeps it there. The loop is test-driven: encode the
goal as a failing `@next/playwright` `instant()` test, work it to green, and
ship the test as the regression guard. Run it once per target route. Work the
phases P → G in order; each ends in a gate. Fix recipes live in two lazily-read
references — `reference/patterns.md` (before→after for each blocker type) and
`reference/real-app-patterns.md` (parallel routes, auth gates, the empty-shell
and responsive-skeleton failure modes). Read one only when its phase points
there.
## What is invariant, and what is yours
One thing here is fixed. The rest is yours. Read this before treating any
command, platform, or env var below as a requirement.
- **Invariant: the verification loop.** Maximizing the shell is worthless
unless you can prove it. The proof is an automated check: under a lock that
gates dynamic data, the static shell still commits. RED shows the gap, GREEN
shows it closed, the test ships as the regression guard. It must run on a
production-like build and must not be able to pass vacuously. Stand the loop
up once; every later optimization is then verifiable by construction. The
loop is the deliverable, not any one route.
- **The mechanism: `@next/playwright` `instant()`.** This skill locks with
[`instant()`](https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config/instant#testing-instant-navigation):
a ruler, not a stopwatch (phase A). It comes from
`@next/playwright` (installed alongside `@playwright/test`, on the same
release line as `next`), so it isn't tied to any host. Keep it. Timing a
navigation by hand is too flaky to trust, and is the failure mode this skill
exists to prevent.
- **Yours: the rig.** How you build, deploy, authenticate, configure
Playwright, and loop belongs to your stack, not to this skill. A local
`next build && next start`, a CI/staging container, and a per-push preview
deploy are equally valid rigs; the verdict comes from the build, never the
platform. Phase 0 maps the invariant onto your repo. Read every platform
name, env-var spelling, and command below as an example to translate, not a
requirement.
## Two navigations, two loading states
A route reaches the user two ways, and both must be instant:
- **Initial load (hard navigation)** commits the route's prerendered static
shell; deferred parts stream in behind their loading skeletons (Suspense
fallbacks, `loading.tsx`).
- **Client-side navigation (soft navigation)** commits the destination's
prefetched App Shell — the `<Link>` default under Partial Prefetching —
re-rendering only the segments that change.
The fix patterns are identical for both; the test differs only in how the
navigation is driven ("Driving the navigation in tests" below). The two shells
can differ; guard the one you ship, both when both matter
(`reference/real-app-patterns.md`).
## Goal
Maximizing the static shell is the optimization objective: the most meaningful
prerendered content commits immediately, and only genuinely per-request data
streams in afterward. The shipped test deterministically encodes **present ∧
instant**; **non-blank** is the additional bar the workflow enforces by
judgment (D1/D2/E), because an `instant()` pass alone is satisfied by a blank
`fallback={null}` shell (the empty-shell failure mode,
`reference/real-app-patterns.md`).
`instant()` is a ruler, not a stopwatch: assert that the shell appears under
the lock; do not time it. A trustworthy verdict requires a production build
(phase A).
The GREEN under the lock is the deterministic verdict; each gate keeps it
trustworthy.
## Reporting to the user
This loop is meant to run unattended — ideally across many navigations in one
pass — so it doesn't stop to ask after each route. What matters is how you word
and present the results, not how often you interrupt. The mechanics below — the
rig, RED, GREEN, the gates — are your scaffolding; the user never needs to hear
those words.
- **Speak their language.** Describe the gap and the result in terms of what the
user sees: "navigating to the dashboard waited on the charts query before
anything painted; now the layout and skeletons paint instantly and the charts
stream in" — not RED/GREEN, the lock, or the phase letters.
- **Show, don't tell.** When you report a route, drive the browser (or attach
before/after screenshots) so the user watches the shell commit immediately and
the data stream in, rather than reading a claim. Identical before and after
means the fix did nothing — roll it back.
- **Present a run as a list of results,** one line per navigation — which route,
what's now instant, what streams — not a transcript of the loop.
- **Only surface a question for a genuine fork:** a fix that would change
behavior, a security-sensitive read, or a route that's dynamic by design (a
runtime-prefetch candidate, not a shell to grow). A clean instant fix is not a
fork — keep going. With no one to ask (an unattended run), don't block: take
the safe default and note the assumption — for a cache-freshness choice,
defer the read behind `<Suspense>` (always fresh, still instant) rather than
guess a `cacheLife`.
## The workflow
```
- [ ] P PREREQS Next.js 16.3+ with cacheComponents: true; upgrade first → below
- [ ] 0 SETUP once per repo: discover + write instant-nav.rig.md → rig-template.md
- [ ] A RIG production build with the testing API exposed → below
- [ ] B BASELINE unlocked: the marker renders for the test user → test-template.md
- [ ] C RED locked instant(): the shell does not commit → test-template.md
- [ ] C-gate VERIFY-RED: stop until the RED is trustworthy → reference/red-test-robustness.md
- [ ] D FIX push each Suspense boundary down to the data it guards → reference/patterns.md
- [ ] D1 reuse the route's existing loading UI; do not hand-build skeletons
- [ ] D2 the shell matches the real render at every breakpoint → reference/real-app-patterns.md
- [ ] E PARITY the refactor changed only whether the route is instant
- [ ] F DIFFERENTIAL revert only the fix → RED; re-apply → GREEN → reference/red-test-robustness.md
- [ ] G REVIEW PR checklist (below)
```
Phases B and C build the test; only the locked test from C ships.
---
## P. PREREQUISITES: current Next.js with Cache Components
The workflow depends on framework capabilities that ship with current Next.js:
- **Next.js 16.3+ with `cacheComponents: true`** in `next.config.ts`. Without
Cache Components there is no static shell to optimize.
- **`@next/playwright`** on the same release line as the project's `next`; it
provides `instant()`. Verify with `npm ls next @next/playwright` (or the
project's package manager) and align them if they differ. The matching
testing API is in the `next` runtime, gated by the
`experimental.exposeTestingApiInProductionBuild` config flag (phase A).
If the project does not meet these, upgrade first (`npx @next/codemod upgrade`
automates most of it), then enable Cache Components in `next.config.ts`:
```ts
export default { cacheComponents: true };
```
Enabling the flag surfaces the blocking routes to resolve first; the
[`next-cache-components-adoption`](https://github.com/vercel/next.js/tree/canary/skills/next-cache-components-adoption)
skill drives that adoption. Reach for this optimizer once the app builds under
Cache Components.
This gate is deliberate: the skill targets current Next.js, and none of the
verdicts below are meaningful on older versions.
## 0. SETUP: discover this project's rig, once per repo
The principles in this skill are fixed; the infrastructure they run on is
yours. On first use in a repository, discover how the project builds, deploys,
authenticates, and tests (inspect the repository first, and ask the user only
what it cannot answer), then write the answers to a committed
`instant-nav.rig.md`. Every later run reads that file instead of
rediscovering. The six questions (BUILD / EXPOSE / RUN / TEST USER / DRIFT /
LOOP), the file template, and filled examples (local-only, generic CI +
container, preview deploy) are in **`rig-template.md`**.
If the repo has no Playwright e2e harness yet, standing up a minimal one
(`@next/playwright`, a config with `baseURL`, one authenticated path) is part
of this step; the loop does not assume a pre-existing suite.
## A. RIG: a production build with the testing API exposed
Stand up the rig described by `instant-nav.rig.md`. Two invariants hold on
every platform:
1. **Never measure on `next dev`.** It does not prefetch, and its lock is
unreliable for blocking routes, so a dev `instant()` result is not a valid
RED or GREEN.
2. **The measured build must expose the testing API.** Otherwise `instant()`
silently no-ops and the test passes vacuously (see
`reference/red-test-robustness.md`). The lock-engagement proof is the phase-C
RED itself: the unfixed target route is the known-blocking route, and its
RED under the lock shows the lock engages on this build (C-gate); the
self-validating variant in `test-template.md` is the in-band guarantee. Wire
`experimental.exposeTestingApiInProductionBuild` to a condition that is
true for every build you measure and never true in production:
```ts
experimental: {
// Use the condition your platform provides, and record it in the rig file:
// local: an explicit opt-in, as below
// generic CI: process.env.DEPLOY_ENV === 'staging'
// Vercel: process.env.VERCEL_ENV === 'preview'
exposeTestingApiInProductionBuild:
process.env.EXPOSE_TESTING_API === '1',
}
```
The rig is any production-like build that exposes the testing API: a local
`next build && next start`, a CI/staging container, and a preview deploy are
all equally valid; the verdict comes from the build, not the platform. See
`rig-template.md` for filled examples.
For any deployed or remote build, poll the rig's LIVENESS probe to confirm the
artifact contains `HEAD` before trusting a verdict (a stale deploy reads as a
false RED or GREEN); a local `next build && next start` needs none. The probe
mechanism is in `rig-template.md` (question 6).
## B. BASELINE (unlocked): development scaffold, do not ship
Drive the real navigation with no `instant()` lock and assert that the
destination's `SHELL_MARKER` renders **as the test user**: the account the
e2e suite authenticates as (in CI, the CI account; locally, your e2e login
fixture), with its flags, plan, role, and data. This establishes that the
marker is real and reachable: not flag-gated, not redirected away, not a
guessed selector. The suite runs as the test account, not the author's session;
that environment drift (the rig DRIFT list) is a common source of
untrustworthy REDs. Scaffold and run command: **`test-template.md`**.
**Delete this baseline before the PR.**
## C. RED (locked) + the VERIFY-RED gate
Wrap the same navigation in `instant()`; assert the shell commits under the
lock. A RED here is the gap. **This is the test that ships**
(`test-template.md`).
> **C-gate: do not start optimizing until the RED is verified trustworthy.** A
> RED that is red for the wrong reason sends you optimizing a route that was
> never broken.
The question that settles it: **does `SHELL_MARKER` render without the lock,
as the test user?** Answer it by re-running phase B as the test user, not by
adding assertions to the shipped test. The two-branch resolution (No → marker
or environment bug; Yes → genuine gap, proceed to D), the full taxonomy of
untrustworthy REDs, the checklist, and worked cases are in
**`reference/red-test-robustness.md`**. Read it now.
---
## D. FIX: push each boundary down to the data it guards
**The anti-pattern: one coarse boundary.** A single `<Suspense>` high in the
tree with a page-level fallback has three costs:
- The layout UI stays out of the static shell: only a throwaway copy of it is
prerendered.
- The entire subtree is replaced when the boundary resolves, which discards
client state and shifts layout.
- The hand-built fallback drifts out of sync as the UI changes, because it
duplicates structure that also exists in the resolved tree.
**The fix: hoist the static, push the Suspense down.** Render the layout UI
once, synchronously, in the shell, and wrap each await in a boundary scoped to
the single read it guards. Only that leaf streams; the stable ancestors are
reused as-is.
**Rule:** if an element renders in both the fallback and the resolved tree,
hoist it above the boundary.
### The most common blocker: a top-level `await` in a layout on a fallback route
```
app/[locale]/(app)/[tenant]/dashboard/...
│ generateStaticParams ✅ │ no generateStaticParams → fallback route
```
When any dynamic segment in the route lacks `generateStaticParams`, the route
is a fallback route, and **all** params defer to request time, including the
enumerated ones. A top-level `await` in a layout (`await params`, a
request-time session read, an auth gate) then blocks the whole subtree out of
the static shell, even when it reads a statically known param. Minimal shape: a
dynamic-segment route with one segment lacking `generateStaticParams`, plus a
top-level `await` in the layout above it.
### The fix: defer the gate, render children
Render `children` unconditionally; move the top-level `await` into a
`<Suspense fallback={null}>`-wrapped child. Mechanism and before→after:
`reference/real-app-patterns.md`, "Deferring an auth gate".
**Fix the page below the shell too, not only the layout.** A page-level
top-level `await` (commonly `await params`) blocks the same way the layout's
does, so make the page sync and push its dynamic reads into a
`<Suspense>`-wrapped leaf as well. `fallback={null}` is correct only when a gate renders nothing on
success; for data, the fallback must be a real loading skeleton (see D1).
Every other blocker shape — `cookies()`/`headers()`, uncached fetch or database
reads, `searchParams`, metadata, viewport, non-deterministic values (`Date.now()`,
`Math.random()`, `crypto.randomUUID()`) — surfaces its own insight when you hit
it: the build prints a `https://nextjs.org/docs/messages/<slug>` link. The
default build output is often abbreviated and may carry no usable stack trace;
add `--debug-prerender` for the full failing frame and to report every blocker
past the first. Scope the build to the route you're on with
`next build --debug-build-paths "app/<route>/**"` rather than rebuilding the app.
Open that page and apply its recipe; don't improvise from the inline message.
The before→after recipe for each shape is in `reference/patterns.md`, which maps it to the insight
that explains it.
A few things those per-error pages don't stress for the instant-navigation goal:
- **A boundary in the root layout isn't enough for client navigations.** It
passes a page-load check but leaves sibling client navigations blocking; put
the boundary below the lowest layout the source and destination routes share.
- **Keep the LCP element** (usually the main heading) out of any boundary, so it
paints in the shell instead of waiting on a stream.
- **A green check isn't always instant.** `export const instant = false` opts
the segment out of validation while the navigation still blocks, and a
`<Suspense>` above the document `<body>` prerenders an empty shell — neither
makes the route instant.
### D1: reuse the route's existing loading UI; do not hand-build skeletons
Before writing any skeleton, search the repository for the loading UI that
already exists for this route, in order:
1. the route's `loading.tsx`;
2. an exported `*Skeleton` colocated with the component;
3. the fallback already inside the component's own `<Suspense>`.
The **divergence point** is the lowest layout shared by the source and
destination routes: a soft navigation re-renders only the segments below it,
while an initial load re-runs every layout from the root. (Also called the
shared boundary.) A `loading.tsx` above the divergence point fills only
the initial-load shell; it sits above the soft-nav re-render scope. A
`loading.tsx` at the destination segment is itself the in-tree boundary for a
soft navigation into that segment and serves both. Reuse whichever boundary
actually covers the navigation you are shipping; below the divergence point,
`loading.tsx` and colocated skeletons are interchangeable for that purpose.
If a component has no skeleton, extract its loading markup into a colocated
skeleton beside it. Do not author a fresh skeleton that mirrors the page
layout: it duplicates structure, drifts as the page changes, and pulls the
design back toward a single coarse boundary. Reusing the component's own
skeleton also keeps the prefetched shell consistent with the loaded UI.
Exception: if the deferred component renders `null` for some users (for
example, a flag-gated control), `fallback={null}` is correct, since a skeleton
would flash and then collapse.
### D2: the shell must match the real render at every breakpoint
A skeleton frozen to one breakpoint misaligns on the others. Fix it the same
way: one responsive component renders both the live UI and the shell (D1
skeleton in its data slots), so the breakpoint switch happens once. Verify by
re-asserting the shell marker at two widths
(`await page.setViewportSize({ width: 1280, height: 800 })`, then
`{ width: 390, height: 844 }`), or by adding a mobile Playwright project, so
this gate is as machine-checkable as the others. Detail:
`reference/real-app-patterns.md`.
> **D-gate: phase D is complete when the locked test from phase C passes GREEN
> under the lock on the production-build rig**, not when the code compiles. That
> GREEN is the deterministic stop for the fix loop; proceed to E.
**When the read can't be pushed down** (an ID minted per request, an
all-dynamic page, a per-request auth/scope read the whole subtree needs), there
is no shell to grow. Don't force one: opt the route into **runtime prefetching**
so the prefetch runs the dynamic render ahead of the click and the soft nav
commits the real content. See [Runtime Prefetching](https://nextjs.org/docs/app/guides/runtime-prefetching)
for the mechanism (`prefetch = 'allow-runtime'` on the route plus a full
`<Link prefetch={true}>`) and the [dynamic-data-during-prefetching insight](https://nextjs.org/docs/messages/instant-link-prefetch-partial)
for adoption. The `instant()`-specific gotchas the docs don't cover:
- **The full prefetch is mandatory.** An auto/PPR prefetch bails before the
runtime spawn (`subtreeHasSpeculativePrefetch`); only `prefetch={true}` /
`kind: 'full'` reaches it. If you set `prefetch = 'allow-runtime'` and it's
still RED, the link is doing an auto prefetch.
- **All leaf slots must agree.** `allow-runtime` on the content segment but
nothing on a sibling `@header`/`@sidebar` leaf leaves the route's runtime entry
incomplete, so the lock falls back to the shell. Flip every leaf together.
- **Prefetch the canonical URL.** A link whose href 307-redirects can't be
prefetched — the prefetch receives the redirect, not the tree. Point the link
and the prefetch at the final URL.
- **Don't blanket the full prefetch.** It fetches _all_ the target's dynamic
data; issuing it on hover for every link is wasteful. Scope `kind: 'full'` to
the runtime-prefetch targets only.
- **Marker must be a committed node, not RSC bytes.** The content is often a
client component, so its text isn't in the prefetch response. Assert a
`data-testid` that renders when the client subtree commits.
## E. PARITY: the refactor changed only whether the route is instant
The push-down is a mechanical transform, not a redesign. Afterward the route
must render the same tree, data, ordering, empty and error states, redirects,
and interactions as before; the only observable difference is that the shell
now commits instantly. Verify:
- **Same render output.** The moved `await`s compute and return the same
values; after the stream, the route shows the same content as the base
branch for the test user.
- **Side effects still fire.** A deferred `redirect()` or `notFound()` still
happens, at request time rather than during prerender. Confirm an
unauthorized user is still redirected and a missing record still returns 404.
- **Both viewports reach the real UI** after the stream (D2).
- **Client state survives.** Because the layout UI is hoisted into the stable
shell rather than swapped on resolve, open menus, scroll position, focus,
and input state persist across the stream.
If anything other than whether the route is instant changed, reduce the refactor.
## F. DIFFERENTIAL
Revert only the fix → RED; re-apply → GREEN; link both runs
(`reference/red-test-robustness.md`). On a deployed rig, confirm each run is live
(LIVENESS, phase A) before trusting its color.
## G. REVIEW (PR checklist)
A green final state means nothing if the RED was never trustworthy. The
test-trustworthiness items are the robustness checklist
(`reference/red-test-robustness.md`); confirm them, then require these
PR-specific items:
- [ ] **Differential shown**: RED without the fix, GREEN with it, runs linked.
- [ ] **Parity confirmed (E)**: same content, redirects, and state.
- [ ] **Existing loading UI reused (D1)**: no new page-mirroring skeleton.
- [ ] **Shell matches the real render at desktop and mobile widths (D2)**.
**Stop condition for the whole workflow:** the locked test from C is GREEN on
the rig, the differential (F) holds, and every item above is checked. Until all
three hold, you are not done.
## Driving the navigation in tests
- **Soft navigation** → drive a real `<Link>` click. **Initial load** → use
`page.goto()` inside `instant()` with the `baseURL` option. Do not substitute
`goto` for a soft-nav verdict; the two shells can differ
(`test-template.md`, `reference/real-app-patterns.md`).
- With parallel routes, only the slots that change re-render on a soft
navigation; client-rendered navigation UI does not re-render at all. Do not
chase a slot the navigation never touches
(`reference/real-app-patterns.md`).
## Files
- `rig-template.md`: phase 0, the six-question rig discovery, the
`instant-nav.rig.md` template, and filled examples (local-only, generic CI,
preview deploy).
- `test-template.md`: the shipped `instant()` specs for both navigation
types (phase C), and the delete-before-PR baseline scaffold (phase B).
- `reference/red-test-robustness.md`: the C-gate and phase F. The taxonomy of
untrustworthy REDs, the checklist, the differential recipe, the vacuous-pass
failure mode, and worked cases.
- `reference/real-app-patterns.md`: parallel routes, deferring an auth gate,
initial-load vs soft-navigation shells, the empty-shell failure mode, the
responsive-skeleton mismatch, edge cases.
@@ -1,355 +0,0 @@
# Refactor patterns — push dynamic down into the shell
Each pattern is **before → after**: keep as much as possible in the prerendered shell, and wrap only genuinely per-request work in a tight `<Suspense>` (or hoist it into `use cache`). Production shapes — parallel-route slots, deferring an auth gate, client slot-routers — are in `real-app-patterns.md`.
---
## 1. Awaiting at the top → move the await into a Suspense child
The most common blocking shape. Awaiting request-time data at the top of a page/layout makes **everything below it** dynamic.
```tsx
// ❌ before — top-level await of a non-static param + uncached data
export default async function Page(props: PageProps<"/store/[slug]">) {
const { slug } = await props.params;
const product = await db.products.findBySlug(slug);
return (
<article>
<h1>{product.name}</h1>
</article>
);
}
```
```tsx
// ✅ after — pass the params promise down; await inside a Suspense-wrapped child
import { Suspense } from "react";
export default function Page(props: PageProps<"/store/[slug]">) {
return (
<Suspense fallback={<p>Loading product…</p>}>
<Product params={props.params} />
</Suspense>
);
}
async function Product({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params;
const product = await db.products.findBySlug(slug);
return (
<article>
<h1>{product.name}</h1>
</article>
);
}
```
Inline variant when you don't want a separate component — unwrap the promise without awaiting at the top:
```tsx
export default function Page(props: PageProps<"/store/[category]">) {
return (
<Suspense fallback={<Grid.Skeleton />}>
{props.params.then(({ category }) => (
<ProductGrid category={category} />
))}
</Suspense>
);
}
```
**Insight:** [runtime data during prerendering](https://nextjs.org/docs/messages/blocking-prerender-runtime).
---
## 2. `cookies()` / `headers()` in a layout → start, don't await; pass down
A layout that awaits request data blocks the layout **and every page under it**.
```tsx
// ❌ before — whole layout (and all children) becomes dynamic
export default async function Layout({ children }) {
const cookieStore = await cookies();
const theme = cookieStore.get("theme")?.value;
return <body data-theme={theme}>{children}</body>;
}
```
```tsx
// ✅ after — start the read without awaiting, pass the promise to a Suspense child
import { cookies } from "next/headers";
import { Suspense } from "react";
export default function Layout({ children }: { children: React.ReactNode }) {
const cookieStore = cookies(); // not awaited → does not block the shell
return (
<body>
<nav>
<Suspense fallback={<UserMenu.Skeleton />}>
<UserMenu cookiePromise={cookieStore} />
</Suspense>
</nav>
{children}
</body>
);
}
async function UserMenu({
cookiePromise,
}: {
cookiePromise: ReturnType<typeof cookies>;
}) {
const theme = (await cookiePromise).get("theme")?.value;
return <div data-theme={theme}>…</div>;
}
```
`{children}` and `<nav>` stay in the shell; only `<UserMenu>` streams.
**Insight:** [runtime data during prerendering](https://nextjs.org/docs/messages/blocking-prerender-runtime).
---
## 3. Uncached fetch / DB read → choose `use cache` _or_ `<Suspense>`
Decide per data source. Same-for-everyone & rarely-changing → cache it (it joins the shell). Per-request & must-be-fresh → leave it uncached behind a boundary.
```tsx
// ❌ before — both block the shell
const product = await db.products.findBySlug(slug); // rarely changes
const inventory = await db.inventory.findBySlug(slug); // must be fresh
```
```tsx
// ✅ after — cache the stable one (shell), defer the fresh one (streams)
async function getProduct(slug: string) {
"use cache"; // → resolved at prerender, lands in the shell
return db.products.findBySlug(slug);
}
<Suspense fallback={<p>Checking availability…</p>}>
<Inventory params={params} /> {/* uncached read stays here, streams in */}
</Suspense>;
```
> A bare `'use cache'` applies the `default` `cacheLife` profile. Choose freshness explicitly with `cacheLife('<profile>')` (`default` / `seconds` / `minutes` / `hours` / `days` / `weeks` / `max`) rather than shipping the default lifetime by omission.
>
> Serverless note: `use cache` is in-memory and does not persist across instances — use [`use cache: remote`](https://nextjs.org/docs/app/api-reference/directives/use-cache-remote) for a durable shell.
**Insight:** [uncached data during prerendering](https://nextjs.org/docs/messages/blocking-prerender-dynamic).
---
## 4. Dynamic params → `generateStaticParams` (shell) or `<Suspense>` (stream)
If the set of params is enumerable, prerender them so `await params` resolves into the shell. Otherwise treat params as request-time and wrap consumers in `<Suspense>`.
```tsx
// ✅ option A — enumerate → params resolve into the shell, no Suspense needed for params
export function generateStaticParams() {
return [{ slug: "shoes" }, { slug: "hats" }];
}
export default async function Page({ params }: PageProps<"/store/[slug]">) {
const { slug } = await params; // known at build → shell-safe
// ...
}
```
```tsx
// ✅ option B — not enumerable → params is request-time; await it inside a boundary (pattern #1)
```
Root params (the dynamic segments the root layout sits inside, e.g. `app/[lang]/layout.tsx`) are readable from any Server Component via `next/root-params` without prop-drilling — but under Cache Components they must still be enumerated by `generateStaticParams` (at least one value per root param) to land in the shell, the same as any other dynamic param.
**Insight:** [runtime data during prerendering](https://nextjs.org/docs/messages/blocking-prerender-runtime).
---
## 5. `searchParams` → always behind `<Suspense>` (on page load)
Search params are never known at build, so awaiting them (or `useSearchParams()`) suspends on a page load. Keep the rest of the page in the shell by isolating the consumer.
```tsx
// ✅ static content stays in the shell; the search-dependent part streams
export default function Page(props: PageProps<"/search">) {
return (
<>
<h1>Search</h1> {/* shell */}
<Suspense fallback={<Results.Skeleton />}>
<Results searchParams={props.searchParams} />
</Suspense>
</>
);
}
async function Results({
searchParams,
}: {
searchParams: Promise<{ q?: string }>;
}) {
const { q } = await searchParams;
return <ResultList query={q} />;
}
```
On a **client navigation** the router already has the URL, so a `useSearchParams()` consumer resolves synchronously and can appear in the prefetched shell — but you still need the boundary for the page-load path.
**Insight:** [runtime data during prerendering](https://nextjs.org/docs/messages/blocking-prerender-runtime) (or, via `useSearchParams` in a Client Component, [URL data in a Client Component](https://nextjs.org/docs/messages/blocking-prerender-client-hook)).
---
## 6. Non-deterministic values → `connection()` + `<Suspense>`, or cache
`Math.random()`, `Date.now()`, `crypto.randomUUID()` produce different output each run, so Cache Components makes you choose: per-request (defer) or fixed (cache).
```tsx
// ✅ per-request value: gate on connection() and wrap in Suspense
import { connection } from "next/server";
async function RequestId() {
await connection();
return <span>{crypto.randomUUID()}</span>;
}
// <Suspense fallback={null}><RequestId /></Suspense>
```
```tsx
// ✅ same value for everyone: cache it so it joins the shell
async function buildId() {
"use cache";
return Date.now();
}
```
**Insight:** [`Date.now()`](https://nextjs.org/docs/messages/blocking-prerender-current-time), [`Math.random()`](https://nextjs.org/docs/messages/blocking-prerender-random), or [`crypto`](https://nextjs.org/docs/messages/blocking-prerender-crypto) while prerendering.
---
## 7. Dynamic `generateMetadata` → static export, `use cache`, or a dynamic-marker for runtime data
```tsx
// ❌ before — reading request data blocks the route's metadata
export async function generateMetadata() {
const c = await cookies();
return { title: c.get("title")?.value };
}
```
```tsx
// ✅ option A — static
export const metadata = { title: "Store" };
// ✅ option B — cache the metadata (depends on external data, not runtime data)
export async function generateMetadata() {
"use cache";
return { title: await getTitle() };
}
```
```tsx
// ✅ option C — metadata genuinely needs runtime data (cookies/headers):
// keep generateMetadata dynamic, and add a dynamic-marker component to the
// page so the rest of the page still prerenders into the shell.
import { cookies } from "next/headers";
import { connection } from "next/server";
import { Suspense } from "react";
export async function generateMetadata() {
const token = (await cookies()).get("token")?.value;
return { title: token ? "Personalized" : "Store" };
}
async function DynamicMarker() {
await connection(); // signals intentional dynamic content
return null;
}
export default function Page() {
return (
<>
<article>{/* static content — stays in the shell */}</article>
<Suspense>
<DynamicMarker />
</Suspense>
</>
);
}
```
`generateViewport` is the same, except dynamic viewport blocks the **whole page**. Genuine instant fixes: a static `viewport` export, or `use cache`. The other two are dynamic-acceptance opt-outs, not instant fixes — do not treat them as a way to reach GREEN: `export const instant = false` opts the segment out of validation while the navigation still blocks, and a `<Suspense>` above the document `<body>` makes the whole route dynamic.
**Insight:** [runtime data in `generateMetadata()`](https://nextjs.org/docs/messages/blocking-prerender-metadata-runtime).
---
## 8. Keep the LCP element in the shell
Don't bury the main heading (the LCP element) inside a boundary — it can't paint until the boundary resolves.
```tsx
// ✅ LCP outside the boundary → paints in the shell
<h1>{product.name}</h1> {/* shell (cache the name if needed) */}
<Suspense fallback={<Reviews.Skeleton />}>
<Reviews productId={id} /> {/* streams */}
</Suspense>
```
---
## 9. Granularity below shared layouts (client-nav correctness)
A single boundary in the **root** layout passes a page-load check but leaves sibling client navigations blocking. Put a boundary **below the shared layout**.
```tsx
// app/store/layout.tsx — boundary below the /store shared layout covers
// client navs like /store/shoes → /store/hats (the root boundary does not)
export default function StoreLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<section>
<StoreNav /> {/* shell */}
<Suspense fallback={<Page.Skeleton />}>{children}</Suspense>
</section>
);
}
```
Prefer per-component boundaries inside the page (patterns #1–#5) over one big layout boundary — they keep more real content in the shell and stream independently.
**Insight:** the read's own insight surfaces on the client navigation when the boundary is too high — see [where to place the boundary](https://nextjs.org/docs/messages/blocking-prerender-dynamic#choosing-where-to-place-the-boundary).
## 10. Can't push the read down? Runtime-prefetch the whole route
Patterns 1–9 grow a **static shell** by moving dynamic reads behind boundaries. Some routes resist that: an ID minted per request (`createId()`), an auth/scope resolution the whole subtree needs, a page that is _all_ dynamic by nature. The read can't move, so there is no meaningful shell to commit and the soft nav stays RED. The escape hatch is **runtime prefetching** — don't prerender a shell, run the dynamic render _in the prefetch_ so the whole route is warm before the click and the soft nav commits the real content instantly.
It has **two halves — both required**, and route config alone is RED:
```tsx
// 1. The route opts in — on EVERY leaf (page/default) segment, parallel @slots
// included, or instant validation re-triggers on the segments that lack it
// (the same all-or-nothing coupling as an `instant = false` opt-out).
export const prefetch = 'allow-runtime'
// 2. The <Link> asks for a FULL prefetch — that is what spawns the runtime
// request. A default/auto prefetch only warms the static shell.
<Link href={href} prefetch={true}>…</Link>
// <Link prefetch> already issues the full prefetch on hover and on viewport
// entry, so prefer it. An imperative full prefetch via router.prefetch needs
// the non-exported PrefetchKind enum, so it has no clean public form.
```
Under `instant()` the runtime entry is what commits, so the real content (not a skeleton) shows under the lock — that is the GREEN.
Gotchas (each cost real debugging time):
- **The full prefetch is mandatory.** With App Shells enabled an auto/PPR prefetch bails before the runtime spawn (`subtreeHasSpeculativePrefetch`); only `prefetch={true}` / `kind: 'full'` reaches it. If you set `prefetch = 'allow-runtime'` and it's still RED, the link is doing an auto prefetch.
- **All leaf slots must agree.** `allow-runtime` on the content segment but `instant = false` (or nothing) on a sibling `@header`/`@sidebar` leaf leaves the route's runtime entry incomplete, so the lock falls back to the shell. Flip every leaf together.
- **Prefetch the canonical URL.** A link whose href 307-redirects (a `/foo` that canonicalizes to `/`) can't be prefetched — the prefetch receives the redirect, not the tree. Point the link and the prefetch at the final URL.
- **Don't blanket the full prefetch.** It fetches _all_ the target's dynamic data; issuing it on hover for every link (recents that point at whole chats) is wasteful. Scope `kind: 'full'` to the runtime-prefetch targets only.
- **Marker must be a committed node, not RSC bytes.** The content is often a client component, so its text isn't in the prefetch response — assert a `data-testid` that renders when the client subtree commits, not a substring of the stream.
Prefer a static shell (patterns 1–9) whenever the read can move: it's cheaper than a runtime prefetch and also covers hard load. Reach for runtime prefetching when the read genuinely can't move, or for a route that's all-dynamic by design.
**Insight:** [dynamic data during prefetching](https://nextjs.org/docs/messages/instant-link-prefetch-partial).
@@ -1,88 +0,0 @@
# Real-app patterns
The rest of this skill models a single linear `layout → page` tree. Production App Router routes add **parallel routes, shared layout UI, and auth gates**, which is where most of the real static-shell work happens. These patterns bridge that gap. Read the skill's `SKILL.md` first.
## Parallel routes: each slot is its own boundary
Instant validation treats every parallel-route slot below the shared layout as an **independent** navigation boundary. Consequences:
- **Each `@slot` needs its own `<Suspense>`** around its dynamic reads; a boundary in one slot does not cover another.
- **An uncovered dynamic read in any slot blocks the whole navigation.** A perfect `@content` does not help if `@sidebar` awaits a session at the top.
- **A slot that renders `null` (e.g. `default.tsx`) is shell-safe**: it is static and performs no reads. Slots that do not re-render for this navigation cost nothing.
```
[tenant]/layout.tsx (shared: already mounted on a soft navigation; not re-rendered)
├ @content → settings/layout → billing/page ← guard each slot's dynamic reads…
├ @sidebar → side nav ← …here too (independent boundary)
└ @header → default.tsx → null ← free
```
## Client-rendered slot routing is not part of the soft-navigation re-render
A common pattern: a stable shared layout renders `@header`/`@sidebar` through a **client** component that swaps slot content based on `usePathname()`. On a soft navigation, Next.js only re-renders the **server** segments that changed below the shared layout; a client-component subtree is not part of that re-render. So that navigation UI neither blocks the navigation nor needs a server `<Suspense>` for it; only the server segments that actually change (e.g. `@content`) matter. It does participate in an initial load (see the caveat below).
## "Instant" is not "useful shell": the empty-shell failure mode
Validation checks that a dynamic read is **guarded by a boundary**, not that the fallback is non-empty. A `<Suspense>` with no `fallback` (or `fallback={null}`) passes validation and commits instantly, but renders a **blank** shell. If a layout and its page both `await getSession()` (your auth library's request-time read) at the top under one empty-fallback boundary, the whole frame collapses to nothing while the user waits. "Validates as instant" and "good loading experience" are different goals.
> Give every boundary a real loading skeleton, and place it low so the most real content stays in the shell. A `fallback={null}` directly above `<body>` is a deliberate empty-shell opt-out; an empty fallback lower in the tree is almost always a bug.
## The responsive-skeleton mismatch: the shell must match every breakpoint
A loading skeleton that misaligns with the loaded UI is its own bug, and it usually appears on mobile. A hand-built skeleton encodes one layout; the real component is responsive and changes shape at breakpoints, so a desktop-shaped skeleton no longer lines up once the viewport is small.
A concrete shape: a list-detail view renders a list or tree in a side panel on desktop, but collapses that panel into a single dropdown or drawer on mobile (with its own loading state). A row skeleton built for the desktop panel has nothing to align with on mobile.
The fix is the same push-down as everywhere else: **share the real responsive layout between the live render and the shell render.** One responsive component renders both (its data slots show the reused `*Skeleton` in the shell and real data after the stream), so the breakpoint switch happens once, for both renders, and there is no second desktop-only skeleton to drift.
(Same hoist rule, responsive layout included.) Verify the shell at both desktop and mobile widths against the real render at the same width.
## Deferring an auth gate / top-level `await` in a layout
A top-level `await` in a layout blocks everything below it (the most common blocker; see [Runtime data during prerendering](https://nextjs.org/docs/messages/blocking-prerender-runtime)). Auth gates are the most common real instance:
```tsx
// ❌ Before: the await + redirect at the top blocks the whole settings frame
export default async function SettingsLayout({ children }) {
const session = await getSession(); // your auth library's request-time read; suspends during prerender → frame can't build
if (!session?.user) redirect(getLoginUrl());
return <Shell>{children}</Shell>;
}
```
```tsx
// ✅ After: render children unconditionally; move the gate into a Suspense child
import { Suspense } from "react";
export default function SettingsLayout({ children }) {
return (
<Shell>
<Suspense fallback={null}>
<AuthGate />
</Suspense>
{children}
</Shell>
);
}
async function AuthGate() {
const session = await getSession(); // the session read suspends during prerender…
if (!session?.user) redirect(getLoginUrl()); // …so redirect() never runs at build time
return null;
}
```
The shell prerenders as if authorized (the session read suspends before `redirect()` is reached, so the redirect only happens at request time), and `{children}` is now in the shell instead of behind the gate. (`fallback={null}` is correct here: `AuthGate` renders nothing on success.)
## Initial-load shell vs soft-navigation shell
The `test-template.md` specs drive a `<Link>` click for soft navigations and `page.goto()` for initial loads. The two shells can differ for the same route:
> **The initial-load shell can show less than the soft-navigation shell when a layout above the shared boundary awaits un-enumerated `params`/`searchParams`.** An initial load re-runs every layout from the root; if a parent layout does `await props.params` and that segment has no `generateStaticParams`, the param suspends on the initial load and its whole subtree drops out of the shell. A soft navigation does not re-render that parent and already has the params. Symptom: an element present after a `<Link>` click is missing after `goto`.
To assert the soft-navigation shell, drive a real `<Link>` click (through menus if necessary). Use `page.goto()` inside `instant()` to assert the initial-load shell, or when no parent above the shared boundary awaits un-enumerated params, in which case the two coincide.
## Edge cases
- **A `React.cache` (or custom memoization) wrapper around `cookies()`/`headers()` still suspends.** Memoizing the call does not make it shell-safe: the underlying request read still returns a pending promise during prerender. Only the **`use cache`** directive, keyed on static or param inputs, puts data in the shell.
- **Playwright cannot see a `display: contents` or fragment fallback.** Such a fallback reads as hidden, so `instant()` assertions cannot `toBeVisible()` it. Give fallbacks a real wrapper element with a `data-testid`.
@@ -1,139 +0,0 @@
# RED-test robustness: verify the RED before optimizing
The C-gate of the workflow. A RED that is red for the wrong reason sends you optimizing a route that
was never broken: the route becomes instant, the test stays red (or the code is contorted to
satisfy a broken assertion), and the effort lands on the wrong problem. The prevention is cheap:
spend a few minutes verifying the RED is trustworthy first.
## The deciding question
> **Does the marker render WITHOUT the lock, as the test user?**
- **No**: the test is red because the marker or page is not there for that user or environment. A
marker bug, not an instant-navigation bug. Fix the marker. (This is the most common case.)
- **Yes**: the marker exists and is reachable; a red under the lock is a genuine "not instant".
Optimize the route.
Everything below serves answering that question honestly.
## The robustness checklist (all must hold)
1. **Red on baseline**: fails on the unfixed route.
2. **Right reason**: without the lock, the marker is visible on the production-build rig (never
`next dev`), running as the test user, not only in the author's own logged-in session.
3. **Differential**: reverting only the fix → RED; re-applying → GREEN; nothing else moves it.
4. **Non-gameable marker**: a sync element of the static shell, never streamed data.
5. **Deterministic on a production build**: stable across N runs; never `next dev`.
6. **Discriminating both ways**: present under the lock on an instant route, absent under the
lock on a blocking one.
7. **Renders for the test user**: under that user's flags, plan, role, and data.
8. **Conditional redirects accounted for**: assert at the route's real destination for that user.
9. **Real selector**: a `data-testid` on a known static-shell node, not a guessed `role`/`name`.
10. **Visible marker**: not `display:none`, off-screen, or inside a hover overlay; for lists,
target `.filter({ visible: true }).first()`.
11. **Fresh build under test**: the deployment being measured contains the latest commit, not a
build URL still serving the previous deploy.
## Taxonomy: red for the wrong reason
Any of these makes a RED untrustworthy. None of them is "the navigation isn't instant."
| Wrong reason | How it occurs | How to rule it out |
| ---------------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
| **Selector matches nothing** | a guessed `getByRole('button', { name: 'Folder' })` | grep the component for the real accessible name; add a `data-testid` |
| **Conditional redirect** | the route `redirect()`s for the test user (flag/role), so the marker page is never reached | check the page's top-level branches; assert at the real destination, or pin the flag |
| **Flag / plan / role gate** | the author has the flag or plan; the test user does not | run the unlocked baseline as the test user; pin flags via the project's override mechanism |
| **Empty state** | the marker only exists when data does; the CI account is empty | pick a marker present in the empty state (a layout element such as the page header), or seed data |
| **Timeout / flake** | a slow API or transient infrastructure error | re-run; separate infrastructure flake from a real signal |
| **Streamed marker** | the marker is behind `<Suspense>`, so it is never in the shell | choose a sync shell element; verify it sits outside every `<Suspense>` |
| **Auth redirect** | unauthenticated → `/login` | confirm login succeeded before the navigation |
| **Stale deployment** | the test ran against the previous build (the URL under test still serves the prior deploy) | poll the deployment for a marker from the latest commit before trusting any verdict |
| **Hidden / off-screen** | the testid is on a hover-overlay or off-screen list item | put the marker on an always-visible node; `.filter({ visible: true }).first()` for lists |
## Worked cases
These are illustrative failures from real optimization runs; each was red for a wrong reason, and
none was an instant-navigation problem. One app's drift surface might be dominated by feature flags and
plans; another's by auth state, an empty database, or locale. The taxonomy lists every wrong
reason; the rig file's DRIFT list says which rows apply to your app.
- **Guessed selector + empty state**: the marker was a button picked by a guessed accessible name
that no element actually had, on a list page whose CI account had no rows. → checks 7, 9. Fix: a
`data-testid` on a real static-shell node.
- **Hidden marker**: the testid sat first on a `hidden sm:block` hover-overlay link, then on an
off-screen carousel card; Playwright resolved the element but reported it hidden. → check 10.
Fix: an always-visible node; for lists, `.filter({ visible: true }).first()`.
## Differential check (capture in the PR)
The strongest evidence that the RED measured the property:
```
1. on the fixed branch → GREEN
2. revert ONLY the fix (the <Suspense> push-down) → RED
3. re-apply → GREEN
4. confirm no other change moves it
```
Link the two runs (or include the toggle diff and results) in the PR description. A reviewer who
sees the differential knows the test measures the property.
## `instant()` is not a stopwatch
The test does not measure how fast a navigation is. `instant()` gates dynamic data so the content
of the static shell can be asserted; the signal is presence, not speed. Under the lock, an instant
route's shell is present, and a blocking route's content never commits, regardless of wait time.
Therefore:
- The shipped assertion is `await expect(SHELL_MARKER).toBeVisible()` under the lock. Do not add a
custom timeout or a `painted` boolean.
- A custom short timeout (e.g. `3000`) implies a race against a clock that does not exist. It adds
nothing to the verdict and invites false REDs on an instant route whose commit lands a microtask
late.
- Do not use `locator.isVisible({ timeout })` as a soft wait: Playwright deprecated and ignores
that timeout; the call returns immediately.
- "Renders for the test user" (checks 7-9) is established at authoring time with the unlocked
baseline scaffold, not by a timed assertion in the shipped test.
## `instant()` guards need no retries and no prefetch warming
An `instant()` guard is deterministic. Do not configure retries on one, and do not hover-warm to
help a prefetch land in time. Under the lock, the router initiates the route prefetch and awaits it
before committing (even for a `prefetch={false}` link, even for a route already in the prefetch
cache), so the committed shell does not depend on any prior render, hover, or menu-open prefetch.
A flaky guard has a real cause: a marker that is not a sync node of the destination's shell, a
flag/role/empty-state gap for the test user, or a genuinely blocking route. The fix is in the page or
the marker; a retry masks the regression the guard exists to catch. The only legitimate
`.hover()`/menu-open is when the trigger element itself is not in the DOM until hovered or opened.
## Silent no-op: the testing API must be exposed in the measured build
`instant()` works by setting a cookie (`next-instant-navigation-testing`) that lock code inside the
build reads. It does not throw when that lock code is absent; it only throws on nested calls or an
unknown base URL. If the build was produced without the testing API
(`experimental.exposeTestingApiInProductionBuild`), the cookie is ignored, the navigation runs
normally, and the `instant()` test passes vacuously. A green `instant()` test is only meaningful if
the lock engaged.
Two defenses; use both:
1. **Confirm the API is exposed on the target.** Wire the flag to the platform's preview/staging
condition or an explicit environment variable; the rig file records the project's spelling
(SKILL.md phases 0 and A). Do not trust a pass from a build where it is not set.
2. **Make the test self-validating**: for any route with deferred content, also assert that the
deferred content is gated under the lock, not only that the shell is present
(`test-template.md`, self-validating variant). If the lock did not engage, the content is
already present and `toHaveCount(0)` fails.
The gated half holds under the lock for both navigation types regardless of warm state: the
soft-nav client lock gates dynamic-data writes, and on an initial load the server honors the
cookie on the document request and suspends dynamic data. A vacuous pass is only possible with
a build produced WITHOUT the testing API, which defense #1 above covers.
## Determinism and the rig
- Always measure on a production build, never `next dev`; SKILL.md phase A owns this invariant and
its rationale.
- Run the RED several times; an intermittently red gate is not a gate. If it flakes, determine
whether the cause is infrastructure (transient errors) or a real race before trusting either
color.
@@ -1,103 +0,0 @@
# Rig discovery: generate this project's `instant-nav.rig.md`
The skill's principles are environment-independent. Your build, deploy, auth,
and test infrastructure are not. This phase converts the principles into THIS
project's concrete workflow: run discovery once per repo, write the answers to
a committed `instant-nav.rig.md` (repo root, or next to your e2e config), and
every later run reads that file instead of rediscovering.
The skill is deliberately opinionated about **what** the rig must provide, and
deliberately unopinionated about **how** your stack provides it.
## How to discover
Inspect before asking. Most answers are already in the repo:
- `package.json` scripts (`build`, `start`, `test:e2e`)
- the e2e config (`playwright.config.*`: `baseURL`, `webServer`, projects)
- CI config (`.github/workflows/`, `vercel.json`, GitLab/Circle files,
Dockerfiles)
- `next.config.*` (existing `experimental` flags)
- existing e2e auth helpers (grep for `login`, `storageState`, `session`)
Ask the user only what the repo can't answer. Typically that means: which
deploy target counts as "preview", which account the suite runs as in CI, and
whether an agent is allowed to push and wait on CI unattended.
## The six questions (all must have answers), plus two derived fields
The six questions below must all have answers. The rig file template adds two
more fields the discovery feeds rather than asks directly: **LIVENESS** (the
SHA-echoing probe, derived from the LOOP answer) and **WALLS** (project-specific
build/run obstacles, accumulated as you first hit them).
1. **BUILD**: how is a production build of this app produced and served?
A per-push preview deploy, a staging container, or bare
`next build && next start`. Anything but `next dev`.
2. **EXPOSE**: what condition turns on
`experimental.exposeTestingApiInProductionBuild` for every measured build,
and never for real production? Spellings: an explicit
`EXPOSE_TESTING_API=1` for local production builds; `process.env.DEPLOY_ENV
=== 'staging'` for a generic CI/staging env var; `process.env.VERCEL_ENV ===
'preview'` on Vercel.
3. **RUN**: how is the Playwright suite invoked, and against which
`BASE_URL`?
4. **TEST USER**: which account does the suite run as, and how does login
happen (helper, `storageState`, API token)? What flags / plan / role / data
does that account have?
5. **DRIFT**: enumerate everything that can differ between the author's own
session and the test user's environment (feature flags, plans and
entitlements, roles, seeded vs empty data, locale, A/B buckets). Every item
is a way a RED can become untrustworthy; this list feeds the C-gate
(`reference/red-test-robustness.md`).
6. **LOOP**: the unattended iteration for your rig. Push → build → e2e
against the artifact → read the failure → fix → push (CI), or build → start
→ e2e (local). Note anything an agent cannot do alone (deploy approvals,
secrets, protected branches). Include the **liveness probe**: the endpoint
or response header that echoes the deployed commit SHA (e.g. a `/healthz`
route or an `x-deployed-sha` header), so a CI run can confirm the build
under test matches `HEAD` before trusting a verdict (SKILL.md phase A). If
the platform exposes no SHA-echoing endpoint or header, add one: surface a
build-time commit var (`VERCEL_GIT_COMMIT_SHA`, a CI commit variable) on a
`/healthz` route or a response header, or fall back to polling the deploy
platform's API for the deployment whose `commitSha === HEAD`. Record the
chosen mechanism. For a local `build && start` rig the artifact is the one
freshly built, so no probe is needed.
## The file: copy, fill, commit as `instant-nav.rig.md`
```md
# instant-nav rig: <project>
- BUILD: <command / platform that produces the measured production build>
- EXPOSE: <the condition wired to exposeTestingApiInProductionBuild>
- RUN: <e2e command> against <how BASE_URL is obtained>
- TEST USER: <account> via <login mechanism>; flags/plan/role/data: <...>
- DRIFT: <the enumerated drift surface>
- LOOP: <push → CI → e2e, or local build → start → test>; agent limits: <...>
- LIVENESS: <endpoint/header echoing the deployed SHA; n/a for local build && start>
- WALLS: <project-specific build/run obstacles + their workarounds>
```
Real apps rarely build for production cleanly on the first attempt: missing
secrets, server-only imports that fail prerender, ports held by respawning
servers. Record each wall and its workaround the first time you hit it. `WALLS`
accumulates the project-specific build/run obstacles that the other fields
cannot capture.
## Filled examples
**No CI / local-only.** BUILD: `EXPOSE_TESTING_API=1 next build && next
start`. EXPOSE: that env var. RUN: `BASE_URL=http://localhost:3000 playwright
test`. LOOP: build → start → test on one machine; fully agent-drivable, with
nothing to push, no secrets, and no deploy wait.
**Generic CI + container.** BUILD: the pipeline builds an image and deploys it
to a staging namespace. EXPOSE: `process.env.DEPLOY_ENV === 'staging'`. RUN: a
CI job runs Playwright against the staging URL. LOOP: push → pipeline → e2e;
fully agent-drivable once the pipeline is wired.
**Vercel preview deploys.** BUILD: every push builds a preview. EXPOSE:
`process.env.VERCEL_ENV === 'preview'`. RUN: `playwright test` with
`BASE_URL=<preview URL>`. LOOP: push → preview → e2e; fully agent-drivable
once the preview deploy and `VERCEL_ENV` gating are in place.
@@ -1,165 +0,0 @@
# Test template: the instant() guard
Ship one test per navigation type you are guarding: under `instant()`, assert that the
destination's static shell appears. `instant()` gates dynamic data, so a correctly instant route
commits its shell under the lock and a blocking route does not. `instant()` is a ruler, not a
stopwatch: do not add custom timeouts or timing races (see `reference/red-test-robustness.md`).
Whether the marker is the right one (rendering for the test user, not flag-gated, not redirected
away, not guessed) is established at authoring time with the unlocked baseline scaffold below
(phase B, the C-gate), not by additional assertions in the shipped test.
All identifiers in angle brackets (`<b>`, `<Trigger>`) and the `../helpers` import are placeholders;
substitute your project's e2e auth helper, URL helper, and real testids/trigger before running.
## Soft navigation (client-side navigation)
Drive a real `<Link>` click. The committed shell is the destination's prefetched App Shell.
Under the lock the router initiates and awaits the route prefetch itself, so no manual warming is
needed; if the shell is intermittently absent, treat it as a real blocker or marker bug (C-gate),
never as a warming race. Do not add waits or hovers.
```ts
import { instant } from "@next/playwright";
import { expect, test } from "@playwright/test";
// Use the auth/setup helpers your e2e suite already has. Run as the test user
// (defined in SKILL.md phase B).
import { logIntoTestAccount, testUrl } from "../helpers";
// A SYNC element of the destination's static shell (header, action button,
// column header), not data that streams in, and one that renders for the
// test user (not gated by a flag, plan, role, or empty state). Prefer a
// data-testid on a known static node over a guessed role/name.
const SHELL_MARKER = '[data-testid="<b>-shell-marker"]';
test.describe("instant nav: A -> B", () => {
test.beforeEach(async ({ page, browser }) => {
await logIntoTestAccount(page, browser);
});
test("B shell commits under instant()", async ({ page }) => {
await page.goto(testUrl("/"));
const trigger = page.getByRole("link", { name: "<Trigger>", exact: true });
await expect(trigger).toBeVisible({ timeout: 20000 });
await instant(page, async () => {
await trigger.click();
// static shell asserted under the lock; no timeout
await expect(page.locator(SHELL_MARKER)).toBeVisible();
});
});
});
```
The trigger selector follows the same rule as `SHELL_MARKER`: prefer a `data-testid` on the real
`<Link>` (`page.getByTestId('<trigger>-link')`) over a guessed accessible name. `getByRole({ name })`
is shown only for brevity; like the marker, the trigger must reliably resolve for the test user.
## Initial load (hard navigation)
Drive `page.goto()` inside `instant()` with the `baseURL` option. The served document is the
route's prerendered static shell. `baseURL` is required because `page` is still `about:blank` when
`instant()` runs (`resolveURL` falls back to `page.url()` only when no `baseURL` is passed).
Establish the session WITHOUT navigating `page` (inject `storageState`, or log in on a separate
context/page). A login helper that navigates `page` itself defeats the measurement for a different
reason: that navigation completes before `instant()` acquires the lock, so it runs unmeasured. The
session must be pre-established either way; otherwise an authenticated route redirects to login
and the RED is false.
If the project's only login helper navigates `page`, the agent must use a
storageState/separate-context path here instead, a session-injection call that
does NOT call `page.goto`:
```ts
test.describe("instant initial load: B", () => {
test.beforeEach(async ({ page }) => {
await injectTestUserSession(page); // storageState only; must NOT call page.goto
});
test("B shell is served", async ({ page }) => {
const url = testUrl("/<b>");
await instant(
page,
async () => {
await page.goto(url);
await expect(page.locator(SHELL_MARKER)).toBeVisible();
},
{ baseURL: new URL(url).origin },
);
});
});
```
## Self-validating variant (recommended for routes with deferred content)
Also assert that the deferred content is gated under the lock and streams after release. This
makes a vacuous pass impossible: if the lock did not engage (testing API missing from the build),
the content is already present and `toHaveCount(0)` fails (see `reference/red-test-robustness.md`).
`SHELL_MARKER` is the shell node; `[data-testid="<b>-content"]` is the deferred data it guards.
```ts
// soft navigation
await instant(page, async () => {
await trigger.click();
await expect(page.locator(SHELL_MARKER)).toBeVisible(); // shell present
await expect(page.getByTestId("<b>-content")).toHaveCount(0); // deferred data gated
});
await expect(page.getByTestId("<b>-content")).toBeVisible(); // streams after release
```
The two **gated-half** assertions (shell visible, deferred content `toHaveCount(0)`) apply to the
initial-load `page.goto()` form too. The cookie gates the deferred content identically for both:
on a soft navigation the client lock gates dynamic-data writes; on an initial load the server
honors the cookie on the document request (set via `addCookies()` before navigation, scoped by
`baseURL`) and suspends dynamic data, independent of whether the route was previously rendered or
cached. So the initial-load `toHaveCount(0)` gated half is as valid as the soft-nav one; it needs
no fresh browser context and no cache-busting query param.
The **post-release** assertion (`getByTestId('<b>-content').toBeVisible()` after the `instant()`
block) is soft-nav only. On an initial load the document was already emitted under the lock, so
nothing streams in after release; drop that assertion from the initial-load test, or
`page.reload()` first to fetch an unlocked document. The mechanism is in
`reference/red-test-robustness.md`.
## Baseline scaffold: do not ship
Before optimizing, confirm the target exists with an unlocked check (no `instant()`). It
disambiguates "not instant" from "marker absent for this user or environment". Run it as the test
user; mismatch against the rig DRIFT list is what the C-gate catches
(`reference/red-test-robustness.md`). Confirm the marker is real and reachable, then delete the
scaffold before the PR.
**The baseline must mirror the navigation type of the test you are shipping.** Drive a `<Link>`
click when guarding the soft-nav shell; drive `page.goto()` when guarding the initial-load shell.
The two shells can differ (`reference/real-app-patterns.md`): a click-driven baseline run against a
shipped `goto` test would confirm a marker that the `goto` path never shows, which produces exactly
the false RED the C-gate exists to prevent.
```ts
// soft-nav baseline: mirror the soft-nav instant() test
test("dev-only: navigating to <b> renders its shell (no lock)", async ({
page,
}) => {
await page.goto(testUrl("/"));
const trigger = page.getByRole("link", { name: "<Trigger>", exact: true });
await expect(trigger).toBeVisible({ timeout: 20000 });
await trigger.click();
await expect(page).toHaveURL(/\/<b>(\?|$)/); // confirm the real destination (no redirect away)
await expect(page.locator(SHELL_MARKER)).toBeVisible({ timeout: 15000 });
});
```
```ts
// initial-load baseline: mirror the initial-load instant() test (session pre-established)
test("dev-only: <b> shell is served (no lock)", async ({ page }) => {
await page.goto(testUrl("/<b>"));
await expect(page.locator(SHELL_MARKER)).toBeVisible({ timeout: 15000 });
});
```
Notes:
- Pick `SHELL_MARKER` as a sync element of the destination's static shell, never streamed data.
Use a `data-testid` on a known static node rather than a guessed role/name.
- Do not put a custom timeout, a `painted` boolean, or `isVisible({ timeout })` in the shipped
assertion, and do not add retries or hover-warming; see `reference/red-test-robustness.md`.
@@ -1,81 +0,0 @@
---
name: sanity-best-practices
description: Sanity development best practices for schema design, GROQ queries, TypeGen, Visual Editing, images, Portable Text, Studio structure, localization, migrations, Sanity Functions, Blueprints, and framework integrations such as Next.js, Nuxt, Astro, Remix, SvelteKit, Angular, Hydrogen, and the App SDK. Use this skill whenever working with Sanity schemas, defineType or defineField, GROQ or defineQuery, content modeling, Presentation or preview setups, Sanity-powered frontend integrations, Sanity Functions, documentEventHandler, defineDocumentFunction, defineMediaLibraryAssetFunction, @sanity/functions, @sanity/blueprints, sanity.blueprint.ts, event-driven content automation, or when reviewing and fixing a Sanity codebase.
---
# Sanity Best Practices
Comprehensive best practices and integration guides for Sanity development, maintained by Sanity. Use the quick reference below to load only the one or two topic files that match the task.
## When to Apply
Reference these guidelines when:
- Setting up a new Sanity project or onboarding
- Integrating Sanity with a frontend framework (Next.js, Nuxt, Astro, Remix, SvelteKit, Hydrogen)
- Writing GROQ queries or optimizing performance
- Designing content schemas
- Implementing Visual Editing and live preview
- Working with images, Portable Text, or page builders
- Configuring Sanity Studio structure
- Setting up TypeGen for type safety
- Implementing localization
- Migrating content from other systems
- Building custom apps with the Sanity App SDK
- Managing infrastructure with Blueprints
- Automating content workflows with Sanity Functions
## Global Rules
- Let Sanity generate `_id` values for ordinary documents. Do not create deterministic UUIDs, slug-derived IDs, or legacy-system IDs when creating documents.
- Model relationships with `reference` fields, then resolve related documents with GROQ lookups, source-key fields, or returned `_id` values from created documents.
- Use explicit document IDs mainly for singleton documents controlled by Studio Structure, including localized singletons such as `homePage-en`.
## Quick Reference
### Integration Guides
- `get-started` - Interactive onboarding for new Sanity projects
- `nextjs` - Next.js App Router, Live Content API, standalone Studio
- `nuxt` - Nuxt integration with @nuxtjs/sanity
- `angular` - Angular integration with @sanity/client, signals, resource API
- `astro` - Astro integration with @sanity/astro
- `remix` - React Router / Remix integration
- `svelte` - SvelteKit integration with @sanity/svelte-loader
- `hydrogen` - Shopify Hydrogen with Sanity
- `project-structure` - Standalone Studio and monorepo patterns
- `app-sdk` - Custom applications with Sanity App SDK
- `blueprints` - Infrastructure as Code: blueprint files, stacks, plan/deploy workflow, error recovery, CI deploys
- `functions` - Automating content workflows with Sanity Functions
### Topic Guides
- `groq` - GROQ query patterns, type safety, performance optimization
- `schema` - Schema design, field definitions, validation, deprecation patterns
- `visual-editing` - Presentation Tool, Stega, overlays, live preview
- `page-builder` - Page Builder arrays, block components, live editing
- `portable-text` - Rich text rendering and custom components
- `image` - Image schema, URL builder, hotspots, LQIP, Next.js Image
- `studio-structure` - Desk structure, singletons, navigation
- `typegen` - TypeGen configuration, workflow, type utilities
- `seo` - Metadata, sitemaps, Open Graph, JSON-LD
- `localization` - i18n patterns, document vs field-level, locale management
- `migration` - Content import overview (see also `migration-html-import`)
- `migration-html-import` - HTML to Portable Text with @portabletext/block-tools
## How to Use
Start with the single framework or topic guide that best matches the request, then read additional references only when the task crosses concerns. Use these reference files for detailed explanations and code examples:
```
references/groq.md
references/schema.md
references/nextjs.md
```
Each reference file contains:
- Comprehensive topic or integration coverage
- Incorrect and correct code examples
- Decision matrices and workflow guidance
- Framework-specific patterns where applicable
@@ -1,576 +0,0 @@
---
title: Angular & Sanity Integration Rules
description: Integration guide for Angular, including @sanity/client setup, data fetching with signals and resource API, Portable Text rendering, and image optimization.
---
# Angular & Sanity Integration Rules
Jump to the section that matches your Angular version or integration task instead of reading this guide straight through.
## Table of Contents
- Setup and configuration
- Client setup (service pattern)
- Data fetching patterns
- Routing
- Portable Text rendering
- Image optimization
- Modern Angular features
- SSR and prerendering
- Visual Editing
- Error handling
## 1. Setup & Configuration
Use the official template `sanity-template-angular-clean` as a starting point. It provides a monorepo structure:
```
project/
├── angular-app/ # Angular 19+ frontend
└── studio/ # Sanity Studio
```
Install dependencies in the Angular app:
```bash
npm install @sanity/client @sanity/image-url @portabletext/to-html
```
Configure environment files for Sanity credentials:
```typescript
// environments/environment.ts
export const environment = {
production: false,
sanity: {
projectId: "your-project-id",
dataset: "production",
apiVersion: "2025-05-01",
},
};
```
```typescript
// environments/environment.production.ts
export const environment = {
production: true,
sanity: {
projectId: "your-project-id",
dataset: "production",
apiVersion: "2025-05-01",
},
};
```
> There is no Angular-specific Sanity SDK. Use `@sanity/client` directly, wrapped in an Angular service.
### TypeGen in a Monorepo
Sanity TypeGen generates TypeScript types from your schema and GROQ queries. In the Angular monorepo template, TypeGen runs from the Studio side but scans your Angular app's source files. Ensure `studio/sanity.cli.ts` points at the Angular app:
```typescript
// studio/sanity.cli.ts
import { defineCliConfig } from "sanity/cli";
export default defineCliConfig({
typegen: {
enabled: true,
path: "../angular-app/src/**/*.ts",
generates: "../angular-app/sanity.types.ts",
},
});
```
The remaining defaults (`overloadClientMethods: true`, `schema: "schema.json"`) work as-is. Include the generated types file in `angular-app/tsconfig.json` (usually covered by `"include": ["src/**/*.ts", "sanity.types.ts"]`). See `typegen.md` for the full TypeGen workflow, git strategy, and configuration options.
## 2. Client Setup (Service Pattern)
Create an injectable service wrapping `@sanity/client` and `@sanity/image-url`:
```typescript
import { Injectable } from '@angular/core'
import { createClient, type ClientReturn, type QueryParams, type SanityClient } from '@sanity/client'
import imageUrlBuilder, { type ImageUrlBuilder } from '@sanity/image-url'
import type { SanityImageSource } from '@sanity/image-url/lib/types/types'
import { environment } from '../environments/environment'
@Injectable({ providedIn: 'root' })
export class SanityService {
private client: SanityClient
private builder: ImageUrlBuilder
constructor() {
this.client = createClient({
projectId: environment.sanity.projectId,
dataset: environment.sanity.dataset,
apiVersion: environment.sanity.apiVersion,
useCdn: true,
})
this.builder = imageUrlBuilder(this.client)
}
// ClientReturn resolves TypeGen's declaration-merged overloads for defineQuery strings
fetch<Query extends string>(query: Query, params?: QueryParams): Promise<ClientReturn<Query>> {
return this.client.fetch(query, params)
}
getImageUrlBuilder(source: SanityImageSource) {
return this.builder.image(source)
}
}
```
For preview/draft content, create a second client instance with a token and `useCdn: false`. Never expose tokens in client-side bundles — use server-side rendering or a proxy endpoint for authenticated requests.
## 3. Data Fetching Patterns
### A. `resource` API (Angular 19+, Recommended)
The `resource` API works natively with promises and integrates with Angular signals:
```typescript
import { Component, input, resource, inject } from '@angular/core'
import { defineQuery } from 'groq'
import { SanityService } from '../sanity.service'
const POST_QUERY = defineQuery(`*[_type == "post" && slug.current == $slug][0]{
title, body, mainImage, publishedAt
}`)
@Component({
selector: 'app-post',
standalone: true,
template: `
@if (post.value(); as p) {
<h1>{{ p.title }}</h1>
<time>{{ p.publishedAt | date }}</time>
} @else if (post.isLoading()) {
<p>Loading…</p>
} @else if (post.error()) {
<p>Error loading post</p>
}
`,
})
export default class PostComponent {
slug = input.required<string>()
private sanity = inject(SanityService)
post = resource({
params: () => ({ slug: this.slug() }),
loader: ({ params }) => this.sanity.fetch(POST_QUERY, params),
})
}
```
The `resource` automatically re-fetches when `slug` changes and exposes `value()`, `isLoading()`, and `error()` signals.
> **TypeGen:** Wrapping queries in `defineQuery` enables Sanity TypeGen to infer return types automatically — no manual type imports needed. See `typegen.md` for the full workflow.
### B. `rxResource` (Observable-based)
For teams using RxJS patterns or needing operators like `retry` and `debounceTime`:
```typescript
import { Component, input, inject } from '@angular/core'
import { rxResource } from '@angular/core/rxjs-interop'
import { defineQuery } from 'groq'
import { from } from 'rxjs'
import { SanityService } from '../sanity.service'
const POST_QUERY = defineQuery(`*[_type == "post" && slug.current == $slug][0]`)
@Component({ /* ... */ })
export default class PostComponent {
slug = input.required<string>()
private sanity = inject(SanityService)
post = rxResource({
params: () => ({ slug: this.slug() }),
loader: ({ params }) => from(this.sanity.fetch(POST_QUERY, params)),
})
}
```
### C. `toSignal` (Angular 17–18)
For apps not yet on Angular 19, convert observables to signals:
```typescript
import { Component, inject } from '@angular/core'
import { toSignal } from '@angular/core/rxjs-interop'
import { defineQuery } from 'groq'
import { from } from 'rxjs'
import { SanityService } from '../sanity.service'
const POSTS_QUERY = defineQuery(`*[_type == "post"] | order(publishedAt desc)`)
@Component({ /* ... */ })
export class HomeComponent {
private sanity = inject(SanityService)
posts = toSignal(from(this.sanity.fetch(POSTS_QUERY)), { initialValue: [] })
}
```
> **Note:** `toSignal` does not re-fetch on parameter changes. For dynamic queries, use `resource` or `rxResource`.
### Choosing a pattern
| Pattern | Angular Version | Reactivity | Best For |
| ------------ | --------------- | --------------------------- | ----------------------------- |
| `resource` | 19+ | Signal-based, auto re-fetch | New projects, dynamic queries |
| `rxResource` | 19+ | RxJS + signals | Teams using RxJS operators |
| `toSignal` | 17+ | One-shot conversion | Static queries, legacy apps |
## 4. Routing
Use lazy-loaded routes with `withComponentInputBinding()` so route params bind directly to component inputs:
```typescript
// app.config.ts
import { provideRouter, withComponentInputBinding } from "@angular/router";
import { routes } from "./app.routes";
export const appConfig = {
providers: [provideRouter(routes, withComponentInputBinding())],
};
```
```typescript
// app.routes.ts
import { Routes } from "@angular/router";
export const routes: Routes = [
{
path: "",
loadComponent: () => import("./home/home.component"),
pathMatch: "full",
},
{
path: "post/:slug",
loadComponent: () => import("./post/post.component"),
},
];
```
With `withComponentInputBinding()`, the `:slug` route param is automatically bound to `slug = input.required<string>()` on the component — no need to inject `ActivatedRoute`.
## 5. Portable Text Rendering
### A. `@portabletext/to-html` with Angular Pipe (Recommended)
```typescript
import { Pipe, PipeTransform, inject } from '@angular/core'
import { toHTML, type PortableTextComponents } from '@portabletext/to-html'
import type { PortableTextBlock } from '@portabletext/types'
import { SanityService } from '../sanity.service'
@Pipe({ name: 'portableTextToHTML', standalone: true })
export class PortableTextToHTMLPipe implements PipeTransform {
private sanity = inject(SanityService)
private components: PortableTextComponents = {
types: {
image: ({ value }) => {
const url = this.sanity.getImageUrlBuilder(value).width(800).auto('format').url()
return `<img src="${url}" alt="${value.alt || ''}" loading="lazy" />`
},
},
marks: {
link: ({ children, value }) =>
`<a href="${value.href}" rel="noopener noreferrer">${children}</a>`,
},
}
transform(value: PortableTextBlock[] | undefined): string {
if (!value) return ''
return toHTML(value, { components: this.components })
}
}
```
Usage in templates:
```html
<div [innerHTML]="post.body | portableTextToHTML"></div>
```
### B. `@limitless-angular/sanity` (Community, Component-based)
For full Angular component control over each block type, the community library `@limitless-angular/sanity` provides a component-based Portable Text renderer. This is useful when you need Angular-specific interactivity within rich text blocks.
See `portable-text.md` for Portable Text schema design and serialization rules.
## 6. Image Optimization
Create a pipe wrapping `@sanity/image-url`:
```typescript
import { Pipe, PipeTransform, inject } from '@angular/core'
import type { SanityImageSource } from '@sanity/image-url/lib/types/types'
import { SanityService } from '../sanity.service'
@Pipe({ name: 'sanityImage', standalone: true })
export class SanityImagePipe implements PipeTransform {
private sanity = inject(SanityService)
transform(value: SanityImageSource | undefined, width?: number): string | null {
if (!value) return null
const builder = this.sanity.getImageUrlBuilder(value)
if (width) return builder.width(width).auto('format').url()
return builder.auto('format').url()
}
}
```
Combine with Angular's `NgOptimizedImage` for LCP images:
```html
<!-- Priority image with NgOptimizedImage -->
<img
[ngSrc]="post.mainImage | sanityImage: 1200"
width="1200"
height="630"
priority
/>
<!-- Lazy-loaded image -->
<img
[src]="post.mainImage | sanityImage: 600"
[alt]="post.mainImage.alt"
loading="lazy"
/>
```
❌ **Bad:** Fetching full-size images without width constraints.
```html
<img [src]="post.mainImage | sanityImage" />
```
✅ **Good:** Specifying width and using `auto('format')` for WebP/AVIF delivery.
```html
<img [src]="post.mainImage | sanityImage: 800" loading="lazy" />
```
### LQIP with `NgOptimizedImage`
Sanity provides a base64 LQIP (Low Quality Image Placeholder) per image asset — but you must query it explicitly:
```groq
mainImage {
// @sanity/image-url needs these to build URLs with hotspot/crop support
asset,
hotspot,
crop,
alt,
// NgOptimizedImage needs these for placeholder and layout
"lqip": asset->metadata.lqip,
"width": asset->metadata.dimensions.width,
"height": asset->metadata.dimensions.height
}
```
Feed the LQIP directly into `NgOptimizedImage`'s `placeholder` attribute:
```html
<img
[ngSrc]="post.mainImage | sanityImage: 1200"
[width]="post.mainImage.width"
[height]="post.mainImage.height"
[placeholder]="post.mainImage.lqip"
[alt]="post.mainImage.alt"
priority
/>
```
Angular applies a CSS blur to the LQIP and crossfades to the full image on load. No extra libraries needed.
> **Note:** LQIP strings are small (~200 bytes) so they're safe to inline in SSR HTML and `TransferState`. See `image.md` for the full image query patterns.
See `image.md` for image field schema patterns and hotspot/crop configuration.
## 7. Modern Angular Features
When building with Sanity, leverage these Angular 19+ features:
- **Standalone components** — Default in Angular 19. No `NgModule` boilerplate needed.
- **Signals and `resource`** — Preferred over RxJS for data fetching. Simpler, less boilerplate.
- **New control flow** — Use `@if`, `@for`, `@switch` with `@empty` for cleaner templates:
```html
@for (post of posts.value(); track post._id) {
<app-post-card [post]="post" />
} @empty {
<p>No posts found.</p>
}
```
- **`@defer` blocks** — Lazy-load below-fold content:
```html
@defer (on viewport) {
<app-comments [postId]="post._id" />
} @placeholder {
<p>Scroll to see comments…</p>
}
```
- **`inject()` function** — Preferred over constructor injection for cleaner code.
- **Zoneless change detection** — Experimental in Angular 19. Works well with signals-based data fetching since signals automatically notify the framework of changes.
## 8. SSR & Prerendering
Angular 17+ includes built-in SSR support (replacing Angular Universal):
```typescript
// app.config.server.ts
import { provideClientHydration } from "@angular/platform-browser";
import { provideServerRendering } from "@angular/platform-server";
export const serverConfig = {
providers: [provideServerRendering(), provideClientHydration()],
};
```
Key considerations for Sanity + Angular SSR:
| Feature | Details |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| **Hydration** | `provideClientHydration()` preserves server-rendered DOM. The client reuses it instead of re-rendering. |
| **HTTP Transfer Cache** | Only works with Angular's `HttpClient`. Since `@sanity/client` uses its own HTTP transport, use `TransferState` manually (see below). |
| **Prerendering** | Use `getPrerenderParams` in route config to generate static pages at build time. |
### Transfer State for `@sanity/client`
Angular's built-in HTTP Transfer Cache does not cover `@sanity/client` requests. Without manual transfer, the client re-fetches every query during hydration. Add `TransferState` to the service from Section 2:
```typescript
+ async function hashQuery(query: string, params?: QueryParams): Promise<string> {
+ const input = query + JSON.stringify(params ?? {})
+ const buffer = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(input))
+ return Array.from(new Uint8Array(buffer), b => b.toString(16).padStart(2, '0')).join('')
+ }
import { Injectable, inject } from '@angular/core'
+ import { isPlatformBrowser, isPlatformServer } from '@angular/common'
+ import { PLATFORM_ID, makeStateKey, TransferState } from '@angular/core'
import { createClient, type ClientReturn, type QueryParams, type SanityClient } from '@sanity/client'
export class SanityService {
private client: SanityClient
+ private transferState = inject(TransferState)
+ private platformId = inject(PLATFORM_ID)
async fetch<Query extends string>(query: Query, params?: QueryParams): Promise<ClientReturn<Query>> {
+ const key = makeStateKey<ClientReturn<Query>>(await hashQuery(query, params))
+
+ if (isPlatformBrowser(this.platformId)) {
+ const cached = this.transferState.get(key, null)
+ if (cached !== null) {
+ this.transferState.remove(key)
+ return cached
+ }
+ }
+
const result = await this.client.fetch(query, params)
+
+ if (isPlatformServer(this.platformId)) {
+ this.transferState.set(key, result)
+ }
+
return result
}
}
```
The `hashQuery` helper keeps `TransferState` keys short (SHA-256 hex) instead of embedding raw GROQ strings in the serialized HTML.
Prerendering dynamic routes:
```typescript
// app.routes.server.ts
import { RenderMode, ServerRoute } from "@angular/ssr";
export const serverRoutes: ServerRoute[] = [
{
path: "post/:slug",
renderMode: RenderMode.Prerender,
async getPrerenderParams() {
// Fetch all slugs from Sanity at build time
const client = createClient({
projectId: "...",
dataset: "...",
apiVersion: "...",
useCdn: true,
});
const slugs = await client.fetch<string[]>(
`*[_type == "post"].slug.current`,
);
return slugs.map((slug) => ({ slug }));
},
},
{ path: "**", renderMode: RenderMode.Server },
];
```
❌ **Bad:** Using `isPlatformBrowser()` in templates to conditionally render content — causes hydration mismatch.
✅ **Good:** Using `@defer` or `afterNextRender()` for browser-only code.
## 9. Visual Editing
> **Important:** Angular does not have official Sanity Visual Editing support. There is no `@sanity/visual-editing` integration, no Stega encoding, and no click-to-edit overlay for Angular applications. This is unlike Next.js, Nuxt, and SvelteKit which have first-party support.
### Preview Mode (Basic)
For draft content preview, create a separate preview client with an API token:
```typescript
@Injectable({ providedIn: 'root' })
export class SanityService {
private client: SanityClient
private previewClient: SanityClient
constructor() {
this.client = createClient({
projectId: environment.sanity.projectId,
dataset: environment.sanity.dataset,
apiVersion: environment.sanity.apiVersion,
useCdn: true,
})
this.previewClient = this.client.withConfig({
useCdn: false,
token: environment.sanity.previewToken, // Server-side only!
perspective: 'drafts',
})
}
fetch<Query extends string>(query: Query, params?: QueryParams, preview = false): Promise<ClientReturn<Query>> {
const client = preview ? this.previewClient : this.client
return client.fetch(query, params)
}
}
```
> **Security:** Never expose the preview token in client-side bundles. Use this pattern only with SSR where the token stays on the server, or proxy preview requests through a backend API.
### Community Visual Editing
The community library `@limitless-angular/sanity` provides experimental Visual Editing support for Angular, including overlay click-to-edit functionality. Check its documentation for current status and limitations.
## 10. Error Handling
Common errors when integrating Angular with Sanity:
| Error | Cause | Solution |
| ------------------- | --------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `401 Unauthorized` | Invalid or missing API token | Verify token in [Sanity Manage](https://www.sanity.io/manage). Ensure it has correct permissions. |
| `403 Forbidden` | CORS origin not allowed | Add your Angular dev/production URL to CORS origins in [Sanity Manage](https://www.sanity.io/manage). |
| `422 Invalid query` | GROQ syntax error | Test queries in Vision plugin or Sanity's GROQ playground. See `groq.md`. |
| Hydration mismatch | Conditional rendering based on platform | Use `@defer` or `afterNextRender()` instead of `isPlatformBrowser()` checks. |
| Empty response | Missing dataset or wrong `apiVersion` | Verify environment config. Use a date-based `apiVersion` (e.g., `'2025-05-01'`). |
| Images not loading | Missing `@sanity/image-url` setup | Ensure `getImageUrlBuilder` is called with a valid image reference. See `image.md`. |
For GROQ query patterns and best practices, see `groq.md`. For schema design, see `schema.md`.
@@ -1,462 +0,0 @@
---
title: Sanity App SDK
description: Rules for building custom applications with the Sanity App SDK, including React hooks, document handles, real-time patterns, and Suspense best practices.
---
# Sanity App SDK
Build custom React applications that interact with Sanity content in real-time.
## Tech Stack
- **Framework:** React 19+, TypeScript
- **Packages:** `@sanity/sdk`, `@sanity/sdk-react`
- **Optional UI:** `@sanity/ui`, `styled-components`
- **Runtime:** Node.js 20+
## Commands
```bash
# Basic quickstart
npx sanity@latest init --template app-quickstart --organization <your-org-id> --output-path . --typescript --skip-mcp
# With Sanity UI components
npx sanity@latest init --template app-sanity-ui --organization <your-org-id> --output-path . --typescript --skip-mcp
# Start development server
npm run dev
# Deploy to Sanity
npx sanity@latest deploy
# Install Sanity UI
npm install @sanity/ui styled-components
```
## Project Structure
```
my-app/
├── sanity.cli.ts # CLI config (org ID, entry point)
├── src/
│ ├── App.tsx # Root component with SanityApp provider
│ ├── App.css # Global styles
│ └── components/ # Your components
├── package.json
└── tsconfig.json
```
## Boundaries
- **Always:** Wrap data-fetching components in `<Suspense>`, use `documentId` as React `key`, read/write directly to Content Lake (not local state)
- **Always:** Use `useDocuments` for lists, `useDocumentProjection` for display, `useDocument` + `useEditDocument` for editing
- **Ask first:** Before using `useQuery` with raw GROQ (prefer `useDocuments` + `useDocumentProjection`)
- **Ask first:** Before adding multiple data-fetching hooks in a single component
- **Never:** Use `useState` for form values that should sync with Content Lake
- **Never:** Use array index as React `key` for document lists (breaks real-time updates)
- **Never:** Forget the `fallback` prop on `<SanityApp>` and `<Suspense>` boundaries
---
## Configuration
### CLI Config (`sanity.cli.ts`)
```typescript
import { defineCliConfig } from "sanity/cli";
export default defineCliConfig({
app: {
organizationId: "your-org-id",
entry: "./src/App.tsx",
},
});
```
### App Root (`src/App.tsx`)
```typescript
import { SanityApp, type SanityConfig } from '@sanity/sdk-react'
export default function App() {
const config: SanityConfig[] = [
{
projectId: 'your-project-id',
dataset: 'production',
},
]
return (
<SanityApp config={config} fallback={<div>Loading...</div>}>
<YourComponents />
</SanityApp>
)
}
```
### With Sanity UI
```typescript
import { SanityApp, type SanityConfig } from '@sanity/sdk-react'
import { ThemeProvider } from '@sanity/ui'
import { buildTheme } from '@sanity/ui/theme'
const theme = buildTheme()
export default function App() {
const config: SanityConfig[] = [
{ projectId: 'your-project-id', dataset: 'production' },
]
return (
<ThemeProvider theme={theme}>
<SanityApp config={config} fallback={<div>Loading...</div>}>
<YourComponents />
</SanityApp>
</ThemeProvider>
)
}
```
### Environment Variables
Prefix with `SANITY_APP_` for automatic bundling:
```bash
SANITY_APP_PROJECT_ID=abc123
SANITY_APP_DATASET=production
```
Access: `process.env.SANITY_APP_PROJECT_ID`
---
## Document Handles
Lightweight references to documents. Fetch handles first, then load content as needed.
```typescript
interface DocumentHandle {
documentId: string;
documentType: string;
projectId?: string;
dataset?: string;
}
```
### Creating Handles
```typescript
// Best: From useDocuments hook
const { data: handles } = useDocuments({ documentType: 'article' })
// Good: With helper (preserves literal types for TypeGen)
import { createDocumentHandle } from '@sanity/sdk'
const handle = createDocumentHandle({
documentId: 'my-doc-id',
documentType: 'article',
})
// Good: With as const (preserves literal types)
const handle = {
documentId: 'my-doc-id',
documentType: 'article',
} as const
```
---
## Hook Selection
| Hook | Use Case | Returns |
| ----------------------- | ------------------------------------ | ---------------------- |
| `useDocuments` | List of documents (infinite scroll) | Document handles |
| `usePaginatedDocuments` | Paginated lists with page controls | Document handles |
| `useDocument` | Single document, real-time editing | Full document or field |
| `useDocumentProjection` | Specific fields, display only | Projected data |
| `useQuery` | Complex GROQ queries (use sparingly) | Raw query results |
---
## Code Patterns
### Fetching a Document List
```typescript
// Good: Fetch handles, render items with Suspense
import { Suspense } from 'react'
import { useDocuments } from '@sanity/sdk-react'
function ArticleList() {
const { data, hasMore, loadMore, isPending } = useDocuments({
documentType: 'article',
batchSize: 10,
orderings: [{ field: '_updatedAt', direction: 'desc' }],
})
return (
<>
<ul>
{data.map((handle) => (
<Suspense key={handle.documentId} fallback={<li>Loading...</li>}>
<ArticleItem {...handle} />
</Suspense>
))}
</ul>
{hasMore && (
<button onClick={loadMore} disabled={isPending}>
Load More
</button>
)}
</>
)
}
```
```typescript
// Bad: Over-fetching with raw GROQ, no pagination
function BadArticleList() {
const { data } = useQuery(`*[_type == "article"]`)
return data?.map((doc, i) => <li key={i}>{doc.title}</li>)
}
```
### Projecting Content from a Handle
```typescript
// Good: Project only needed fields
import { useDocumentProjection, type DocumentHandle } from '@sanity/sdk-react'
function ArticleItem(handle: DocumentHandle) {
const { data } = useDocumentProjection({
...handle,
projection: `{
title,
"authorName": author->name,
"imageUrl": image.asset->url
}`,
})
if (!data) return null
return (
<li>
<h2>{data.title}</h2>
<p>By {data.authorName}</p>
</li>
)
}
```
### Real-time Editing
```typescript
// Good: Read and write directly to Content Lake
import { useDocument, useEditDocument, type DocumentHandle } from '@sanity/sdk-react'
function TitleInput(handle: DocumentHandle) {
const { data: title } = useDocument({ ...handle, path: 'title' })
const editTitle = useEditDocument({ ...handle, path: 'title' })
return (
<input
type="text"
value={title ?? ''}
onChange={(e) => editTitle(e.currentTarget.value)}
/>
)
}
```
```typescript
// Bad: Local state with submit button - causes stale data
function BadTitleForm(handle: DocumentHandle) {
const [value, setValue] = useState('')
const editTitle = useEditDocument({ ...handle, path: 'title' })
function handleSubmit(e: FormEvent) {
e.preventDefault()
editTitle(value) // Only writes on submit!
}
return (
<form onSubmit={handleSubmit}>
<input value={value} onChange={(e) => setValue(e.target.value)} />
<button type="submit">Save</button>
</form>
)
}
```
### Document Actions
```typescript
import {
useApplyDocumentActions,
publishDocument,
unpublishDocument,
deleteDocument,
} from '@sanity/sdk-react'
function DocumentActions({ handle }: { handle: DocumentHandle }) {
const apply = useApplyDocumentActions()
return (
<div>
<button onClick={() => apply(publishDocument(handle))}>Publish</button>
<button onClick={() => apply(unpublishDocument(handle))}>Unpublish</button>
<button onClick={() => apply(deleteDocument(handle))}>Delete</button>
</div>
)
}
```
---
## Suspense Patterns
The App SDK uses React Suspense. Every data-fetching component must be wrapped.
### One Hook Per Component
```typescript
// Good: Separate fetchers into separate components
function EventsAndVenues() {
return (
<>
<Suspense fallback="Loading events...">
<EventsList />
</Suspense>
<Suspense fallback="Loading venues...">
<VenuesList />
</Suspense>
</>
)
}
function EventsList() {
const { data } = useDocuments({ documentType: 'event' })
return <List items={data} />
}
function VenuesList() {
const { data } = useDocuments({ documentType: 'venue' })
return <List items={data} />
}
```
```typescript
// Bad: Multiple fetchers in one component
function BadComponent() {
const { data: events } = useDocuments({ documentType: "event" });
const { data: venues } = useDocuments({ documentType: "venue" });
// Both trigger Suspense together, causing unnecessary re-renders
}
```
### Prevent Layout Shift
```typescript
// Good: Fallback matches final component dimensions
const BUTTON_TEXT = 'Open in Studio'
export function OpenInStudio({ handle }: { handle: DocumentHandle }) {
return (
<Suspense fallback={<Button text={BUTTON_TEXT} disabled />}>
<OpenInStudioButton handle={handle} />
</Suspense>
)
}
function OpenInStudioButton({ handle }: { handle: DocumentHandle }) {
const { navigateToStudioDocument } = useNavigateToStudioDocument(handle)
return <Button onClick={navigateToStudioDocument} text={BUTTON_TEXT} />
}
```
---
## Event Handling
```typescript
import { DocumentEvent, useDocumentEvent } from "@sanity/sdk-react";
function DocumentWatcher(handle: DocumentHandle) {
useDocumentEvent({
...handle,
onEvent: (event) => {
switch (event.type) {
case "edited":
console.log("Edited:", event.documentId);
break;
case "published":
console.log("Published:", event.documentId);
break;
case "deleted":
console.log("Deleted:", event.documentId);
break;
}
},
});
return null;
}
```
---
## Multi-Project Apps
```typescript
const config: SanityConfig[] = [
{ projectId: "project-1", dataset: "production" },
{ projectId: "project-2", dataset: "staging" },
];
// Handles include project/dataset info
const handle: DocumentHandle = {
documentId: "doc-123",
documentType: "article",
projectId: "project-1",
dataset: "production",
};
```
---
## Lazy Loading with Refs
```typescript
function LazyContent(handle: DocumentHandle) {
const ref = useRef(null)
const { data } = useDocumentProjection({
...handle,
ref, // Only loads when element enters viewport
projection: '{ title, body }',
})
return <div ref={ref}>{data?.title}</div>
}
```
---
## What's NOT Included
The App SDK provides hooks and data stores. You bring:
- UI components (use Sanity UI or your own)
- Router
- Form validation
- Schema validation
---
## Troubleshooting
| Issue | Solution |
| ----------------- | ----------------------------------------------------- |
| Safari dev issues | Use Chrome or Firefox during development |
| Port 3333 in use | `npm run dev -- --port 3334` |
| Auth errors | `npx sanity@latest logout && npx sanity@latest login` |
@@ -1,174 +0,0 @@
---
title: Astro & Sanity Integration Rules
description: Integration guide for Astro, including @sanity/astro, visual editing, and data fetching.
---
# Astro & Sanity Integration Rules
## 1. Setup & Configuration
### Scaffold a new Astro app
```bash
npm create astro@latest my-app -- --template with-tailwindcss --install --git --yes
cd my-app
```
`--yes` accepts defaults non-interactively. `--install` runs `npm install` for you, `--git` initializes a repo.
### Installation
Add the `@sanity/astro` integration and the renderer/helper packages used by the examples below.
```bash
npx astro add @sanity/astro
npm install astro-portabletext @sanity/image-url groq
```
`@sanity/astro` provides the `sanity:client` virtual module. `astro-portabletext` renders Portable Text. `@sanity/image-url` builds image URLs. `groq` exports `defineQuery` for typed queries.
### Configuration (`astro.config.mjs`)
Use the official `@sanity/astro` integration. `astro.config.mjs` runs at config time before Astro's env loading, so `import.meta.env.PUBLIC_*` is not available there — use Vite's `loadEnv` to read the same `PUBLIC_` variables your pages will use.
```javascript
import sanity from "@sanity/astro";
import { defineConfig } from "astro/config";
import { loadEnv } from "vite";
const { PUBLIC_SANITY_PROJECT_ID, PUBLIC_SANITY_DATASET } = loadEnv(
process.env.NODE_ENV ?? "development",
process.cwd(),
"",
);
export default defineConfig({
integrations: [
sanity({
projectId: PUBLIC_SANITY_PROJECT_ID,
dataset: PUBLIC_SANITY_DATASET,
useCdn: false, // False for static builds
studioBasePath: "/admin", // Optional — only if embedding the Studio
}),
],
});
```
Inside `.astro` files and components you can keep using `import.meta.env.PUBLIC_SANITY_*` directly; the `loadEnv` shim above is config-only.
### Client Type Safety
Enable types in `tsconfig.json`.
```json
{
"compilerOptions": {
"types": ["@sanity/astro/module"]
}
}
```
## 2. Data Fetching
### Basic Fetching
Use `sanityClient` from `sanity:client` in the frontmatter of your `.astro` files.
```astro
---
import { sanityClient } from "sanity:client";
import { defineQuery } from "groq";
const POSTS_QUERY = defineQuery(`*[_type == "post"]{title, slug}`);
const posts = await sanityClient.fetch(POSTS_QUERY);
---
<ul>
{posts.map(post => <li>{post.title}</li>)}
</ul>
```
### Helper Functions
It's best practice to abstract queries into a utility file (e.g., `src/utils/sanity.ts`).
```typescript
import { defineQuery } from "groq";
import { sanityClient } from "sanity:client";
const POSTS_QUERY = defineQuery(`*[_type == "post" && defined(slug.current)]`);
export async function getPosts() {
return await sanityClient.fetch(POSTS_QUERY);
}
```
### Dynamic Routes (`[slug].astro`)
Astro hoists `getStaticPaths()` into a separate module context. Module-scope `const` declarations in the frontmatter are NOT accessible inside it — referencing them throws `ReferenceError: <NAME> is not defined` at request time. Define queries used by `getStaticPaths` inside the function, or import them from a utility module.
```astro
---
import { sanityClient } from "sanity:client";
import { defineQuery } from "groq";
import { PortableText } from "astro-portabletext";
// Module-scope queries are fine for module-scope code…
const POST_QUERY = defineQuery(`*[_type == "post" && slug.current == $slug][0]{ title, body }`);
// …but anything used inside getStaticPaths must live inside it.
export async function getStaticPaths() {
const SLUGS_QUERY = defineQuery(
`*[_type == "post" && defined(slug.current)]{ "params": { "slug": slug.current } }`
);
return await sanityClient.fetch(SLUGS_QUERY);
}
const { slug } = Astro.params;
const post = await sanityClient.fetch(POST_QUERY, { slug });
---
<article>
<h1>{post?.title}</h1>
{post?.body && <PortableText value={post.body} />}
</article>
```
## 3. Portable Text
Use `astro-portabletext` for rendering rich text.
```astro
---
import { PortableText } from "astro-portabletext";
const { body } = Astro.props;
---
<div class="prose">
<PortableText value={body} />
</div>
```
## 4. Image Handling
Use `@sanity/image-url` to generate optimized image URLs.
```typescript
import imageUrlBuilder from "@sanity/image-url";
import { sanityClient } from "sanity:client";
const builder = imageUrlBuilder(sanityClient);
export function urlFor(source) {
return builder.image(source);
}
```
## 5. Visual Editing (Live Preview)
Astro handles visual editing slightly differently depending on if you are using Hybrid or Static mode.
### Setup
Ensure `stega` is enabled in your client configuration if you want clickable overlays.
For real-time updates in the presentation tool, you typically need a React component wrapper (since Astro components don't re-render on the client) or use the View Transitions API with a loader.
_Note: The `@sanity/astro` integration is evolving. Check the latest docs for "Visual Editing" support._
@@ -1,280 +0,0 @@
---
title: Sanity Blueprints
description: Rules for Sanity Blueprints, the Infrastructure as Code solution for managing Sanity resources declaratively. Covers blueprint files, stacks and scope, the plan/deploy workflow, deletion policies, error recovery, and CI deployment.
---
# Sanity Blueprints
Sanity's Infrastructure as Code (IaC) solution. Define resources declaratively in `sanity.blueprint.ts`, track the file in version control, preview changes with `plan`, apply them with `deploy`. Blueprints is the only way to deploy Sanity Functions.
The CLI is built for unattended use: every command accepts `--json`, all IDs can be supplied via flags or environment variables, and `--help` on any command is the authoritative reference. Always run via `npx sanity@latest blueprints <command>`.
## Mental Model
```
Blueprint file (code, intent) → Stack (deployed state) → Resources (real infrastructure)
```
| Concept | What it is |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| **Blueprint file** | `sanity.blueprint.ts`, the declarative manifest of desired resources. The source of truth: if it's not in the file, it's not deployed |
| **Resource** | One managed thing (function, CORS origin, webhook, role, robot token, dataset). Identified by a unique `name` |
| **Definer** | Typed helper from `@sanity/blueprints` (e.g. `defineCorsOrigin`) that declares a resource and validates input as you write |
| **Stack** | The deployed counterpart of the file: the live resources on Sanity's side. One file can deploy to many Stacks (e.g. `staging`, `production`) |
| **Config file** | `.sanity/blueprint.config.json`, links the local file to a Stack and records scope. Gitignored by `init` automatically; not secret |
| **Scope** | `project` or `organization`. Determines which resource types a Stack can manage |
### Key behaviors
- Resources are matched **by `name`** between file and Stack. `plan` buckets every resource as create, update, no-op, or destroy.
- **There is no rename.** Changing a resource's `name` destroys the old resource and creates a new one under the new name.
- **Removal is destruction.** Deleting a resource from the file destroys it on the next deploy (subject to its deletion policy). `blueprints destroy` is equivalent to deploying an empty file.
- Deploys apply in dependency order. On partial failure, completed changes are rolled back best-effort in reverse order. Rollback is **not atomic**; some actions may be irreversible.
## Three different "deploy" commands
Do not confuse these:
| Command | What it deploys |
| -------------------------- | --------------------------------------------------------- |
| `sanity blueprints deploy` | Infrastructure resources defined in `sanity.blueprint.ts` |
| `sanity schema deploy` | Studio schema to Content Lake (for MCP and editor access) |
| `sanity deploy` | The Studio application to Sanity hosting |
## The Blueprint File
`sanity.blueprint.ts` default-exports a `defineBlueprint` call. TypeScript is idiomatic (definers validate inline and provide editor help); `.js` and hand-written `.json` also work but new files should use TypeScript.
```typescript
import {
defineBlueprint,
defineCorsOrigin,
defineDocumentFunction,
} from "@sanity/blueprints";
export default defineBlueprint({
values: {
corsOrigin: "https://studio.example.com",
},
resources: [
defineCorsOrigin({
name: "studio-cors",
origin: "$.values.corsOrigin",
}),
defineDocumentFunction({
name: "first-published",
event: {
on: ["create", "update"],
filter: "_type == 'post' && !defined(firstPublished)",
},
}),
],
});
```
- `resources` is an array of definer outputs. Every resource requires a unique `name`.
- `values` holds reusable file-level constants (always strings), referenced as `$.values.<key>`.
- Resource-type-specific fields are documented in the typed reference: https://reference.sanity.io/_sanity/blueprints/
### Discovering available resources
The definers exported by `@sanity/blueprints` are the canonical list of what Blueprints can manage. Discover them by inspecting the package's exports (every `define*` function is a resource definer) and reading their TSDoc for fields, defaults, and examples, or browse the typed reference at https://reference.sanity.io/_sanity/blueprints/. Do not rely on a memorized list; new definers ship additively.
When the Stack is organization-scoped, project-contained resources (CORS origins, webhooks, datasets, functions) must set their `project` field explicitly.
For the semantics of an individual resource type (what a CORS origin, webhook, or role does and which values make sense), consult that feature's own Sanity documentation. This reference covers how Blueprints manages resources, not the resources themselves.
## References and the Resource Graph
Resources reference values and each other with `$` string paths:
| Syntax | Resolves | When |
| ----------------------- | ---------------------------------------------- | ----------------------------------------- |
| `$.values.<key>` | A constant from the `values` block | At file evaluation |
| `$.resources.<name>` | Another resource in the file | At deploy time; creates a dependency edge |
| `$.resources.<name>.id` | The generated ID of that resource, as a string | At deploy time |
Blueprints builds the dependency graph from these references and orders work so dependencies are created first. Unresolved references and cycles fail validation before anything is deployed. To force ordering without a data reference, use `lifecycle: {dependsOn: '$.resources.<name>'}`.
### Referencing an existing project
The recommended pattern is an environment variable surfaced through `values`:
```typescript
import "dotenv/config";
// the CLI does not read .env files itself
export default defineBlueprint({
values: {
projectId: process.env.SANITY_PROJECT_ID ?? "",
},
resources: [
defineCorsOrigin({
name: "app-cors",
project: "$.values.projectId",
origin: "https://www.example.com",
}),
],
});
```
## Deletion Policies
Set `lifecycle.deletionPolicy` on a resource to control what removal means:
| Policy | Removed from file | Stack destroyed | Notes |
| --------- | -------------------- | ----------------------------- | -------------------------------------------- |
| `allow` | Resource destroyed | Resource destroyed | Default for stateless resources |
| `retain` | **Deployment fails** | Resource detached, kept alive | Default for stateful resources like datasets |
| `replace` | Resource destroyed | Resource destroyed | Updates become destroy + recreate |
| `protect` | **Deployment fails** | **Deployment fails** | Resource is never updated or destroyed |
Use `protect` for production-critical stateful resources:
```typescript
defineDataset({
name: "production",
lifecycle: { deletionPolicy: "protect" },
});
```
A deletion-policy violation is a pre-deploy validation failure, not a partial deploy: fix the file (or consciously change the policy) and re-run `plan`.
## Stacks, Environments, and Scope
One blueprint file deploys to many Stacks. The `--stack <name-or-id>` flag (on `deploy`, `plan`, `info`, `logs`) selects the target; without it, the Stack recorded in `.sanity/blueprint.config.json` is used.
- **Only `init` creates Stacks.** `--stack` never creates a Stack on a miss, so CI cannot accidentally provision infrastructure. Re-run `blueprints init .` to add another Stack for the same file.
- Accounts are currently limited to **three Stacks per project scope**.
- For per-environment differences, read an environment variable inside the file (e.g. `process.env.SANITY_ENV`) and deploy with the env var and `--stack` together. `SANITY_ENV` is a convention your file reads, not a CLI feature.
### Project vs organization scope
| | Project scope | Organization scope |
| ------------------------- | ------------- | ---------------------------------------------------------------- |
| Stored in config as | `projectId` | `organizationId` |
| Resources default to | The project | Nothing; each project-contained resource must name its `project` |
| Org-scoped resource types | Not available | Available |
Organization scope is recommended for anything beyond a single-project experiment. Convert an existing Stack with `blueprints promote` (safe, idempotent, additive, but **one-way**; requires `organization-update` admin permission).
## CLI Commands
```bash
npx sanity@latest blueprints <command>
```
| Command | Purpose |
| ------------------- | -------------------------------------------------------------------------------------------- |
| `init [dir]` | Create a blueprint file and provision a remote Stack. The only command that creates Stacks |
| `plan` | Preview the diff against the Stack. Read-only, always safe |
| `deploy` | Apply the file to the Stack (`-m` message, `--no-wait` to queue and return) |
| `info` | Show Stack status and deployed resources. Remote read; works without local files |
| `stacks` | List Stacks (`--include-projects` with `--organization-id` for org-wide audit) |
| `config` | View or edit `.sanity/blueprint.config.json` (`--edit` with ID flags for scripting) |
| `logs` | Deployment logs (`--watch`, `--limit 1-500`, `--since`/`--before` ISO timestamps) |
| `promote` | Convert a Stack from project to organization scope. One-way (`--force` to skip confirmation) |
| `destroy` | Destroy the Stack and its resources (`--force` to skip confirmation). Local files remain |
| `doctor` | Diagnose local/remote configuration issues (`--fix` to resolve interactively) |
| `mint-deploy-token` | Mint a long-lived robot token for CI deploys (`--print` for shell pipelines) |
Running `npx sanity@latest blueprints --help` will show the latest available commands.
Use `npx sanity@latest blueprints <command> --help` to see options and examples for a specific command.
Function scaffolding, local testing, secrets, and function logs live under `npx sanity@latest functions <command>` (`add`, `dev`, `test`, `env add|list|remove`, `logs`). See the `functions` reference.
### Standard workflow
```bash
npx sanity@latest blueprints init . # once: create file + Stack
# edit sanity.blueprint.ts
npx sanity@latest blueprints plan # preview the diff, catch validation errors safely
npx sanity@latest blueprints deploy # apply
npx sanity@latest blueprints info # verify deployed state
```
Always run `plan` before `deploy`. It is read-only and surfaces validation errors, reference problems, scope mismatches, and deletion-policy violations without touching anything.
### Exit codes
`deploy` and `destroy` return: **`0`** succeeded, **`2`** failed, **`75`** accepted but completion could not be confirmed.
**✅ Correct — treat exit 75 as unknown, then verify:**
```bash
npx sanity@latest blueprints deploy || status=$?
if [ "${status:-0}" -eq 75 ]; then
npx sanity@latest blueprints info --json # confirm actual Stack state
fi
```
**❌ Incorrect — treating any nonzero exit as failure and retrying.** Exit 75 means the deployment was accepted; blindly redeploying can queue duplicate operations (deploy also refuses to start while another operation is in progress).
### Scope resolution and environment variables
For `organizationId`, `projectId`, and `stackId`, the first source that resolves wins: CLI flags → environment variables → the blueprint file module → the local config file.
| Variable | Purpose |
| ---------------------------------------------- | ---------------------------------------------------------- |
| `SANITY_AUTH_TOKEN` | Auth token (in CI, the minted deploy token) |
| `SANITY_ORGANIZATION_ID` / `SANITY_PROJECT_ID` | Scope |
| `SANITY_BLUEPRINT_STACK_ID` | Target Stack |
| `SANITY_BLUEPRINT_PATH` | Path to the blueprint file or its directory |
| `SANITY_ASSET_TIMEOUT` | Seconds to wait for resource asset processing (default 60) |
The CLI does not load `.env` files. Export variables in the shell or import `dotenv/config` inside the blueprint file.
## Errors and Recovery
Errors include a name, a human-readable message, and the **resource path**, which maps to a specific resource in your file. Five failure kinds:
| Failure | Caught | What to do |
| --------------------------------------------------------------------------------- | ------------- | ---------------------------------------------------------- |
| Validation error (missing/invalid field, malformed file) | Before deploy | Fix the file at the reported resource path |
| Unresolved reference or dependency cycle | Before deploy | Fix the `$.resources.<name>` reference or break the cycle |
| Scope mismatch (org-scoped resource on project Stack, or no resolvable `project`) | Before deploy | Set the resource's `project` field, or `promote` the Stack |
| Deletion-policy violation (change would remove a `retain`/`protect` resource) | Before deploy | Restore the resource, or deliberately relax its policy |
| Execution failure (underlying service rejected the change) | During deploy | Read `blueprints logs`, fix the cause, redeploy |
Recovery procedure after any failure:
1. Read the error message and resource path (`blueprints logs` re-reads failure output).
2. Fix the blueprint file (or the external condition).
3. Run `blueprints plan` to confirm the corrected diff.
4. Run `blueprints deploy` again.
Retrying without changing anything only makes sense for transient execution failures; the first four failure kinds are deterministic and will fail identically until the file changes. If local and remote state seem inconsistent, run `blueprints doctor` (and `doctor --fix`) before attempting anything destructive. After a partial-deploy rollback, `blueprints info` shows what is actually live; resources owned by other Stacks are never touched by rollback.
## CI/CD
Recommended workflow: `plan` on pull requests, `deploy` on merge to main. Official GitHub Actions: https://github.com/sanity-io/blueprints-actions
```bash
# one-time, by a human with access:
npx sanity@latest blueprints mint-deploy-token --label "ci-deploy" --print
```
The minted robot token has exactly the role needed to plan, deploy, and destroy (`blueprints-deployer` for project scope, `blueprints-deployer-robot` for organization scope) and is revocable under Robots in Sanity Manage. Store it as a CI secret, then in the pipeline:
```bash
export SANITY_AUTH_TOKEN=<the minted token>
export SANITY_ORGANIZATION_ID=<orgId> # or SANITY_PROJECT_ID
export SANITY_BLUEPRINT_STACK_ID=<stackId>
npx sanity@latest blueprints deploy --json --message "CI deploy"
```
**✅ Correct — secrets via server-side function env vars:**
```bash
npx sanity@latest functions env add my-function API_KEY sk-...
```
**❌ Incorrect — secrets in the blueprint file's `env` block, which is committed to git:**
```typescript
defineDocumentFunction({
name: "my-function",
env: { API_KEY: "sk-..." }, // committed to version control!
});
```
@@ -1,663 +0,0 @@
---
title: Sanity Functions
description: Rules for Sanity Functions — serverless event handlers that react to content changes in Sanity's Content Lake. Covers blueprint configuration, handler patterns, testing, deployment, and recursion control.
---
# Sanity Functions
Serverless event handlers hosted on Sanity's infrastructure, configured via **Blueprints** and triggered by document lifecycle events.
> Always use `npx sanity@latest` so CLI and runtime versions stay current.
## When to use
- Set computed/derived fields (timestamps, slugs, summaries)
- Enrich or validate content on publish
- Trigger external services (CDN purge, deploy hooks, notifications)
- Automate workflows (translation, tagging, cross-posting)
- Sync content to external systems
- Invoke Agent Actions in response to content events
## When NOT to use
- Logic needs >900s execution or >200MB bundle — use an external worker
- High-throughput bulk operations that exceed rate limits (200/fn/30s, 4000/project/30s)
- A simple POST to an external URL on publish with no document data shaping — use a webhook
- Client-side or UI-driven logic (validation, conditional fields) — belongs in Studio schema config
## Requirements
| Dependency | Version |
| :------------------- | :--------------------------------------- |
| Node.js | v24.x (matches deployed runtime) |
| Sanity CLI | v4.12.0+ |
| `@sanity/blueprints` | Latest |
| `@sanity/functions` | Latest |
| `@sanity/client` | v7.12.0+ (includes recursion protection) |
## Project Structure
Organize functions alongside your Sanity project, one level above the Studio directory:
```
my-project/
├── studio/
├── next-app/
├── functions/
│ ├── my-function/
│ │ ├── index.ts # Handler code (entry point)
│ │ └── package.json # (optional) function-level dependencies
│ └── another-function/
│ └── index.ts
├── sanity.blueprint.ts # Blueprint configuration
├── package.json # Project-level dependencies
└── node_modules/
```
The function directory name must match the `name` in the blueprint config. Each function exports a `handler` from its `index.ts` (or `index.js`).
---
## Step-by-step: Creating a Function
### 1. Initialize a Blueprint
```bash
npx sanity@latest blueprints init . \
--type ts \
--stack-name production \
--project-id <your-project-id>
```
This creates `sanity.blueprint.ts` and `.sanity/blueprint.config.json` (gitignored automatically; it links your Blueprint to a Stack and is not secret).
### 2. Scaffold a Function
```bash
npx sanity@latest functions add \
--name my-function \
--type document-create --type document-update \
--installer npm
```
`--type` options: `document-create`, `document-update`, `document-delete`, `media-library-asset-create`, `media-library-asset-update`, `media-library-asset-delete`, `scheduled-function`, `sync-tag-invalidate`.
### 3. Configure the Blueprint
```typescript
// sanity.blueprint.ts
import { defineBlueprint, defineDocumentFunction } from "@sanity/blueprints";
export default defineBlueprint({
resources: [
defineDocumentFunction({
name: "my-function",
event: {
on: ["create", "update"],
filter: '_type == "post"',
},
}),
],
});
```
### 4. Write the Handler
```typescript
// functions/my-function/index.ts
import { createClient } from "@sanity/client";
import { documentEventHandler } from "@sanity/functions";
interface PostData {
_id: string;
_type: string;
title: string;
}
export const handler = documentEventHandler<PostData>(
async ({ context, event }) => {
const { data } = event;
const client = createClient({
...context.clientOptions,
apiVersion: "2025-05-08",
});
try {
await client.patch(data._id, {
setIfMissing: { firstPublished: new Date().toISOString() },
});
console.log(`Set firstPublished on ${data._id}`);
} catch (error) {
console.error("Failed to patch document:", error);
}
},
);
```
### 5. Test Locally
```bash
# Visual dev playground
npx sanity@latest functions dev
# CLI testing
npx sanity@latest functions test my-function \
--dataset production \
--with-user-token
# With a specific document
npx sanity@latest functions test my-function \
--document-id abc123 \
--dataset production \
--with-user-token
```
### 6. Deploy
```bash
npx sanity@latest blueprints deploy
```
### 7. View Logs
```bash
npx sanity@latest functions logs my-function
npx sanity@latest functions logs my-function --watch
```
---
## Handler Reference
Every handler receives `{ context, event }`:
### `context`
| Property | Type | Description |
| :------------------------ | :--------------------- | :------------------------------- |
| `clientOptions.apiHost` | `string` | API host URL |
| `clientOptions.projectId` | `string` | Sanity project ID |
| `clientOptions.dataset` | `string` | Dataset name |
| `clientOptions.token` | `string` | Robot token (deployed only) |
| `local` | `boolean \| undefined` | `true` during local testing |
| `eventResourceType` | `string` | `'dataset'` or `'media-library'` |
| `eventResourceId` | `string` | e.g., `'projectId.datasetName'` |
### `event`
```typescript
{
data: {
_id: string;
_type: string;
// ... rest of document (shaped by projection if set)
}
}
```
When testing locally, `context.clientOptions` only has `projectId` and `apiHost`. Use `--dataset` and `--with-user-token` flags to supply the rest.
---
## Blueprint Configuration
### `defineDocumentFunction` Options
| Option | Type | Default | Description |
| :------------ | :----------------------- | :----------------- | :----------------------------------------------- |
| `name` | `string` | required | Must match the directory name under `functions/` |
| `displayName` | `string` | — | Human-readable display name |
| `src` | `string` | `functions/<name>` | Path to function source directory |
| `memory` | `number` | `1` | Memory in GB (max 10) |
| `timeout` | `number` | `10` | Timeout in seconds (max 900) |
| `runtime` | `string` | `'nodejs24.x'` | `'node'`, `'nodejs22.x'`, or `'nodejs24.x'` |
| `project` | `string` | — | Project ID. Required if blueprint is org-scoped. |
| `robotToken` | `string` | — | Custom robot token name for the function |
| `event` | `object` | required | Event configuration (see below) |
| `env` | `Record<string, string>` | — | Environment variables via `process.env` |
### `event` Options
| Option | Type | Default | Description |
| :------------------- | :--------- | :------- | :------------------------------------------------------------------- |
| `on` | `string[]` | required | `'create'`, `'update'`, `'delete'` |
| `filter` | `string` | — | GROQ filter body (no `*[...]` wrapper) |
| `projection` | `string` | — | GROQ projection to shape `event.data`. Wrap in `{}`. |
| `includeDrafts` | `boolean` | `false` | Trigger on draft changes |
| `includeAllVersions` | `boolean` | `false` | Trigger on all document versions |
| `resource` | `object` | — | Scope to dataset: `{ type: 'dataset', id: 'projectId.datasetName' }` |
### `defineMediaLibraryAssetFunction`
For Media Library asset events. Requires `@sanity/blueprints` v0.4.0+ and `@sanity/functions` v1.1.0+.
```typescript
import {
defineBlueprint,
defineMediaLibraryAssetFunction,
} from "@sanity/blueprints";
export default defineBlueprint({
resources: [
defineMediaLibraryAssetFunction({
name: "asset-handler",
event: {
on: ["delete"],
filter: "documents::incomingGlobalDocumentReferenceCount() > 0",
projection: "{_id, versions, title}",
resource: {
type: "media-library",
id: "mlYourLibraryId",
},
},
}),
],
});
```
---
## Event Types
| Event | Description |
| :------- | :--------------------------------------------------------------------------------------- |
| `create` | New document created |
| `update` | Existing document modified (for published docs, fires when a draft/version is published) |
| `delete` | Document deleted |
Often best to use `['create', 'update']` together for published document triggers.
---
## GROQ Filter Tips
- Only the filter body — `_type == 'post'`, not `*[_type == 'post']`
- `delta::changedAny(fieldName)` — trigger only when specific fields change
- `sanity::dataset() == 'production'` — scope to a dataset without `resource` config
- `_id in path('drafts.**')` with `includeDrafts: true` — draft-only triggers
- Combine conditions to prevent recursion: `_type == 'post' && !defined(processedAt)`
---
## Projections
- Shape the data passed to `event.data`
- Limited to the invoking document's scope (plus `→` for references)
- Nested filters in projections (like `*[references(^._id)]`) will fail silently — query inside the function instead
- Wrap in `{}`: `projection: '{title, _id, slug}'`
---
## Environment Variables
Three ways to set them:
1. Blueprint config: `env: { MY_VAR: 'value' }`
2. CLI: `npx sanity@latest functions env add my-function MY_VAR my-value`
3. Local testing: `MY_VAR=value npx sanity functions test my-function`
Access in handler code via `process.env.MY_VAR`.
---
## Critical Rules
### Preventing Recursion
If your function mutates the same document type it listens to, you **will** create an infinite loop.
**✅ Correct — use GROQ filters to exclude processed documents:**
```typescript
defineDocumentFunction({
name: "first-published",
event: {
on: ["create", "update"],
filter: "_type == 'post' && !defined(firstPublished)",
},
});
```
**✅ Correct — use `@sanity/client` v7.12.0+ for automatic lineage headers:**
```typescript
import { createClient } from "@sanity/client";
// Client automatically sets X-Sanity-Lineage header
// Recursive chains are limited to 16 invocations
const client = createClient({
...context.clientOptions,
apiVersion: "2025-05-08",
});
```
**❌ Incorrect — no recursion guard:**
```typescript
defineDocumentFunction({
name: "update-post",
event: {
on: ["create", "update"],
filter: "_type == 'post'", // Will re-trigger on its own writes!
},
});
```
### Local Testing Safety
Use `context.local` to prevent accidental mutations during testing:
```typescript
// Skip mutations entirely in test
if (!context.local) {
await client.createOrReplace(someDoc);
}
// Or use dryRun
await client
.patch(event.data._id, {
set: { processed: true },
})
.commit({ dryRun: context.local });
// Or use noWrite for Agent Actions
await client.agent.action.generate({
schemaId: "your-schema-id",
documentId: event.data._id,
instruction: "Summarize this document",
target: { path: ["summary"] },
noWrite: context.local,
});
```
### Limits
- Max bundle size: 200MB (including dependencies). Prefer slim, platform-agnostic packages.
- Rate limits: 200 invocations/fn/30s, 4000/project/30s
- Max timeout: 900s. Larger functions = slower cold starts.
### Cost
Cost = invocations × (memory GB × duration seconds). Default is 1GB memory. A function averaging 1GB and 40ms duration can run ~500k invocations within 20K GB-seconds. [Monitor usage at the organization level](https://www.sanity.io/manage).
---
## Common Patterns
### Deploy hook / CDN invalidation
**Blueprint:**
```typescript
defineDocumentFunction({
name: "deploy-hook",
event: {
on: ["create", "update"],
filter: '_type == "page"',
},
});
```
**Handler:**
```typescript
export const handler = documentEventHandler(async ({ context, event }) => {
const URL = process.env.DEPLOY_HOOK_URL;
if (!URL) throw new Error("DEPLOY_HOOK_URL is not set");
await fetch(URL);
console.log("Deploy hook triggered");
});
```
Set the env var: `npx sanity@latest functions env add deploy-hook DEPLOY_HOOK_URL https://...`
### Set a timestamp on first publish
Uses the same pattern as the step-by-step example above. The key insight: the `!defined(firstPublished)` GROQ filter prevents re-triggering after the field is set. The `setIfMissing` patch is a redundant safety net.
```typescript
defineDocumentFunction({
name: "first-published",
event: {
on: ["create", "update"],
filter: '_type == "post" && !defined(firstPublished)',
},
});
```
### Auto-translate with Agent Actions
**Blueprint:**
```typescript
defineDocumentFunction({
name: "translate",
event: {
on: ["create", "update"],
filter: "_type == 'post' && language == 'en-US'",
projection: "{_id}",
},
});
```
**Handler:**
```typescript
export const handler = documentEventHandler(async ({ context, event }) => {
const client = createClient({ ...context.clientOptions, apiVersion: "vX" });
await client.agent.action.translate({
schemaId: "your-schema-id",
async: true,
documentId: event.data._id,
languageFieldPath: "language",
targetDocument: {
operation: "create",
},
fromLanguage: { id: "en-US", title: "English" },
toLanguage: { id: "el-GR", title: "Greek" },
});
});
```
The GROQ filter ensures only English documents trigger the function. The translated document gets a different `language` value, preventing recursive triggers.
Let Sanity assign the translated document's `_id` for ordinary localized content. To find or update translations later, query by language, slug, or translation metadata instead of deriving IDs from the source document. Reserve explicit `targetDocument._id` values for singleton-style targets.
### Auto-tag with Agent Actions
**Blueprint:**
```typescript
defineDocumentFunction({
name: "auto-tag",
event: {
on: ["create", "update"],
filter: "_type == 'post'",
projection: "{_id, title, body}",
},
});
```
**Handler:**
```typescript
export const handler = documentEventHandler(async ({ context, event }) => {
const client = createClient({ ...context.clientOptions, apiVersion: "vX" });
await client.agent.action.generate({
schemaId: "your-schema-id",
documentId: event.data._id,
instruction:
"Analyze the content and generate 3 relevant tags. Reuse existing tags when possible.",
target: { path: ["tags"] },
async: true,
});
});
```
### Slack notification on publish
```typescript
export const handler = documentEventHandler(async ({ context, event }) => {
const WEBHOOK_URL = process.env.SLACK_WEBHOOK_URL;
if (!WEBHOOK_URL) throw new Error("SLACK_WEBHOOK_URL not set");
await fetch(WEBHOOK_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
text: `📝 New content published: *${event.data.title || event.data._id}* (${event.data._type})`,
}),
});
});
```
### Scope to a specific dataset
**Option A — `resource` config:**
```typescript
defineDocumentFunction({
name: "production-only",
event: {
on: ["update"],
filter: "_type == 'post'",
resource: { type: "dataset", id: "myProjectId.production" },
},
});
```
**Option B — GROQ filter:**
```typescript
defineDocumentFunction({
name: "production-only",
event: {
on: ["update"],
filter: "_type == 'post' && sanity::dataset() == 'production'",
},
});
```
### React to Media Library asset changes
Requires `@sanity/blueprints` v0.4.0+ and `@sanity/functions` v1.1.0+.
**Blueprint:**
```typescript
import {
defineBlueprint,
defineMediaLibraryAssetFunction,
} from "@sanity/blueprints";
export default defineBlueprint({
resources: [
defineMediaLibraryAssetFunction({
name: "asset-deleted",
event: {
on: ["delete"],
filter: "documents::incomingGlobalDocumentReferenceCount() > 0",
projection: "{_id, versions, title}",
resource: { type: "media-library", id: "mlYourLibraryId" },
},
}),
],
});
```
**Handler:**
```typescript
export const handler = documentEventHandler(async ({ context, event }) => {
const { eventResourceId } = context; // Media Library ID
const client = createClient({
...context.clientOptions,
apiVersion: "2025-05-08",
});
const response = await client.request({
uri: `/media-libraries/${eventResourceId}/query`,
method: "POST",
body: { query: `*[_type == 'sanity.imageAsset']` },
});
console.log("Assets:", response);
});
```
### Recursion control with custom HTTP clients
If not using `@sanity/client`, implement lineage tracking manually:
```typescript
export const handler = documentEventHandler(async ({ context, event }) => {
const lineage = process.env.X_SANITY_LINEAGE;
await fetch(
`https://${context.clientOptions.projectId}.api.sanity.io/v2025-05-08/data/mutate/production`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${context.clientOptions.token}`,
...(lineage ? { "X-Sanity-Lineage": lineage } : {}),
},
body: JSON.stringify({
mutations: [
{ patch: { id: event.data._id, set: { processed: true } } },
],
}),
},
);
});
```
### Multiple functions in one blueprint
```typescript
export default defineBlueprint({
resources: [
defineDocumentFunction({
name: "first-published",
event: {
on: ["create", "update"],
filter: "_type == 'post' && !defined(firstPublished)",
},
}),
defineDocumentFunction({
name: "notify-slack",
event: {
on: ["create", "update"],
filter: "_type == 'post'",
projection: "{title, _id}",
},
}),
defineDocumentFunction({
name: "sync-algolia",
timeout: 30,
event: {
on: ["create", "update", "delete"],
filter: "_type == 'product'",
},
}),
],
});
```
---
## CI/CD Deployment
Use the [Blueprints GitHub Action](https://github.com/sanity-io/blueprints-actions)
```yaml
- uses: sanity-io/blueprints-actions/deploy@deploy-v3
with:
sanity-token: ${{ secrets.SANITY_DEPLOY_TOKEN }}
```
Mint a long-lived deploy token with `npx sanity@latest blueprints mint-deploy-token` (creates a robot token with the role required to plan, deploy, and destroy) and store it as a CI secret. Recommended workflow: `blueprints plan` on pull requests, `blueprints deploy` on merge to main. See the `blueprints` reference for CI environment variables and exit codes.
@@ -1,425 +0,0 @@
---
title: Sanity Getting Started Guide
description: Use these rules when users ask to 'Get started with Sanity' or need help setting up a new Sanity project.
---
# Sanity Getting Started Guide
## Overview
Getting started with Sanity follows three phases:
1. **Studio & Schema** — Set up Sanity Studio and define your content model
2. **Content** — Import existing content or generate placeholder content via MCP
3. **Frontend** — Integrate with your application (framework-specific)
## Communication Style
**Keep responses succinct:**
- Tell the user what you did: "Created post schema with title, body, and slug"
- Ask direct questions: "What kind of content are you building?"
- Avoid verbose explanations of what you're about to do
- Don't explain every step unless the user asks
**Examples:**
- **Good**: "Schema deployed. Ready to add some content?"
- **Bad**: "I'm going to deploy your schema to the Content Lake so that the MCP server can recognize your new document types. This will allow..."
---
## Get Started with Sanity (Interactive Guide)
**TRIGGER PHRASE:** When the user says "Get started with Sanity" or similar, follow these steps.
**Before starting:** Let the user know they can pause and resume anytime by saying "Continue Sanity setup".
**RESUME TRIGGER:** If the user says "Continue Sanity setup", check what's already configured:
- Does `sanity.config.ts` exist (typically in a `studio/` folder)? → Studio is set up
- Are there files in `schemaTypes/`? → Schema exists
- Is there a frontend framework in `package.json`? → May need integration
Resume from where they left off.
---
## Phase 1: Studio & Schema
### Step 1: Check for Existing Studio
**Look for `sanity.config.ts` or `sanity.cli.ts` across the workspace** — in the recommended side-by-side layout the Studio lives in its own folder (`studio/`, or `studio-*` when created by the Sanity onboarding flow) next to the app folder:
**If NO Studio found:**
- Ask: "Want to create a new Sanity Studio?"
- If yes, run from the repo root — **not inside a Next.js app folder**, where the CLI would switch to its embedded flow (not recommended):
```bash
npm create sanity@latest -- --template clean --typescript --output-path studio
```
- This creates a standalone Studio in `studio/`, alongside your app folder (see `project-structure.md`)
**If Studio exists:**
- Read the config to get `projectId` and `dataset`
- Proceed to Step 2
### Step 2: Check for Existing Schema
**Look in `schemaTypes/`, `schemas/`, or `src/sanity/schemaTypes/`:**
**If NO schema found:**
- Ask: "What kind of content are you building? (e.g., Blog, E-commerce, Portfolio)"
- Create appropriate schema types based on their answer
- See `schema.md` for patterns
**If schema exists:**
- Show them what you found
- Ask: "Want to add more content types or modify existing ones?"
**If they want a quick example:**
Create a basic blog schema:
```typescript
// schemaTypes/post.ts
import { defineField, defineType } from "sanity";
export const post = defineType({
name: "post",
title: "Post",
type: "document",
fields: [
defineField({ name: "title", type: "string" }),
defineField({ name: "slug", type: "slug", options: { source: "title" } }),
defineField({ name: "body", type: "array", of: [{ type: "block" }] }),
],
});
```
### Step 3: Deploy Schema
**Required before Phase 2:**
```bash
npx sanity schema deploy
```
This uploads your schema to the Content Lake so MCP tools can work with it.
---
## Phase 2: Content
### Step 1: Check for Existing Content
**Use MCP `query_documents` to check:**
```
*[_type == "post"][0...5]
```
**If content exists:**
- Show them a summary
- Ask: "Want to add more content or move to frontend integration?"
**If NO content:**
- Ask: "Do you want to:
1. Import existing content (from another CMS, markdown, etc.)
2. Generate sample content with AI
3. Skip this and add content manually in the Studio"
### Step 2a: Import Existing Content
If migrating from another CMS or files:
- See `migration.md` and the `sanity-migration` skill for guidance
- Use MCP content tools such as `create_documents` and `patch_documents` after converting content to structured Sanity documents
### Step 2b: Generate Sample Content (MCP)
Ask the agent to draft structured sample content, then create it with the Sanity MCP Server:
```
Tool: create_documents
Documents: [{ type: "post", content: { title: "Getting started with Sanity", body: [] } }]
```
**If MCP content tools cannot see new types or fields:** Remind them to run `npx sanity schema deploy` first.
### MCP Setup (If Not Configured)
**Quick start via Sanity CLI:**
```bash
npx sanity@latest mcp configure
```
**Cursor:** [One-click install →](cursor://anysphere.cursor-deeplink/mcp/install?name=Sanity&config=eyJ1cmwiOiJodHRwczovL21jcC5zYW5pdHkuaW8iLCJ0eXBlIjoiaHR0cCJ9Cg==)
Or add to `.cursor/mcp.json`:
```json
{
"mcpServers": {
"Sanity": {
"type": "http",
"url": "https://mcp.sanity.io"
}
}
}
```
**Claude Code:**
```bash
claude mcp add Sanity -t http https://mcp.sanity.io --scope user
```
**VS Code:** Command Palette → `MCP: Open User Configuration` → add:
```json
{
"servers": {
"Sanity": {
"type": "http",
"url": "https://mcp.sanity.io"
}
}
}
```
---
## Phase 3: Frontend Integration
### Client Bundle Warning (Vite-based frameworks)
React Router, SvelteKit, Astro, and Nuxt all run on Vite. **Any module imported by a client component will be bundled to the browser.** `process.env` doesn't exist there.
For publishable values (`projectId`, `dataset`, `apiVersion`, public studio URL), use the framework's client-safe env mechanism:
- React Router / Remix: `import.meta.env.VITE_*`
- SvelteKit: `$env/static/public`
- Astro: `import.meta.env.PUBLIC_*`
- Nuxt: `useRuntimeConfig().public`
For secrets (read tokens, webhook secrets), read `process.env.*` (or the server equivalent) **only from server-only modules** — `.server.ts`, route handlers, API endpoints. Don't centralize them in a shared `env.ts` that anything else imports.
This trap is invisible at SSR — the page renders fine on first load. It surfaces on client-side route transitions, when a lazy-loaded route chunk pulls a shared client/image module into the browser.
### Step 1: Find the App and Detect Framework
The working directory is often a parent folder with the Studio and the app side by side. Identify the app folder first: a sibling of the Studio folder with its own `package.json` (commonly `web/`). If several candidates exist, ask the user which app to integrate — never assume.
**Check the app's `package.json` dependencies:**
| Dependency | Framework | Rule File |
| ------------------------------------ | -------------------- | ----------- |
| `next` | Next.js | `nextjs.md` |
| `@remix-run/react` or `react-router` | React Router / Remix | `remix.md` |
| `svelte` or `@sveltejs/kit` | SvelteKit | `svelte.md` |
| `nuxt` | Nuxt | `nuxt.md` |
| `astro` | Astro | `astro.md` |
**If NO framework found:**
- Ask: "Which framework are you using, or would you like to create a new app?"
- Guide them to create one or specify their choice
### Step 2: Next.js Integration (Inline)
If Next.js is detected, follow these essential steps:
**Scaffold a new app (if you don't have one yet):**
Run from the repo root so the app sits alongside your `studio/` folder:
```bash
npx create-next-app@latest web --tailwind --ts --app --src-dir --eslint --import-alias "@/*" --turbopack
cd web
```
**Install dependencies:**
```bash
npm install next-sanity @sanity/image-url
```
`next-sanity` is the official Sanity toolkit for Next.js. It bundles `@sanity/client`, `groq` (with `defineQuery`), and `@portabletext/react`, plus dedicated subpath exports for Next.js-specific features:
- `next-sanity` — `createClient`, `defineQuery`, `PortableText`, `SanityDocument`, `stegaClean`
- `next-sanity/live` — `defineLive` for live content with Next.js cache integration
- `next-sanity/draft-mode` — Draft Mode endpoint helpers
- `next-sanity/visual-editing` — `<VisualEditing />` component for click-to-edit overlays
- `next-sanity/image` — Sanity-aware `<Image />` wrapping `next/image`
- `next-sanity/studio` — embed the Sanity Studio at a route (legacy setups only — keep the Studio standalone, see `nextjs.md`)
- `next-sanity/webhook` — webhook signature verification
Don't also install `@sanity/client`, `@portabletext/react`, or `groq` directly — import them from `next-sanity`. `@sanity/image-url` is not bundled (yet), so add it separately.
**Create the client (`src/sanity/client.ts`):**
```typescript
import { createClient } from "next-sanity";
export const client = createClient({
projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID!,
dataset: process.env.NEXT_PUBLIC_SANITY_DATASET!,
apiVersion: "2026-05-15", // Use current date for new projects
useCdn: false, // Use API directly for server-side rendering; set true for client-side reads
});
```
**Fetch content in a Server Component:**
```typescript
// src/app/page.tsx
import { client } from "@/sanity/client";
import { defineQuery, type SanityDocument } from "next-sanity";
const POSTS_QUERY = defineQuery(
`*[_type == "post" && defined(slug.current)] | order(_createdAt desc){ _id, title, slug }`
);
const options = { next: { revalidate: 30 } };
export default async function PostsPage() {
const posts = await client.fetch<SanityDocument[]>(POSTS_QUERY, {}, options);
return (
<ul>
{posts.map((post) => (
<li key={post._id}>
<a href={`/${(post.slug as { current?: string })?.current}`}>{post.title as string}</a>
</li>
))}
</ul>
);
}
```
`{ next: { revalidate: 30 } }` opts the fetch into Next.js' ISR cache with a 30-second revalidation window. Tune to taste; omit `options` to use defaults.
**Render an individual post (`src/app/[slug]/page.tsx`):**
```typescript
import { PortableText, defineQuery, type SanityDocument } from "next-sanity";
import { notFound } from "next/navigation";
import { client } from "@/sanity/client";
const POST_QUERY = defineQuery(
`*[_type == "post" && slug.current == $slug][0]{ _id, title, body }`
);
const options = { next: { revalidate: 30 } };
export default async function PostPage({
params,
}: {
params: Promise<{ slug: string }>;
}) {
const { slug } = await params;
const post = await client.fetch<SanityDocument | null>(POST_QUERY, { slug }, options);
if (!post) return notFound();
return (
<article>
<h1>{post.title as string}</h1>
{Array.isArray(post.body) && <PortableText value={post.body} />}
</article>
);
}
```
**Add environment variables (`.env.local`):**
```
NEXT_PUBLIC_SANITY_PROJECT_ID=your-project-id
NEXT_PUBLIC_SANITY_DATASET=production
```
For advanced patterns (TypeGen, Visual Editing with `next-sanity/visual-editing`, live content with `defineLive` from `next-sanity/live`, standalone Studio architecture), see `nextjs.md`.
### Step 3: Other Frameworks
For non-Next.js frameworks, read the corresponding rule file and follow its integration guide:
- **React Router / Remix:** `remix.md`
- **SvelteKit:** `svelte.md`
- **Nuxt:** `nuxt.md`
- **Astro:** `astro.md`
Each rule file contains framework-specific patterns for data fetching, Portable Text rendering, and Visual Editing.
### Step 4: Smoke Test
Before declaring integration done, exercise both render paths:
1. `npm run dev` (in the app folder)
2. Load the home page (lists posts).
3. **Click through to a detail page** via an in-app `<Link>` / `<a>` — do not paste the URL.
4. Open the browser console. It should be clean. No `ReferenceError: process is not defined`, no hard reload to `/`.
5. For good measure, reload the detail page directly (URL bar) — that exercises SSR.
Server-side rendering passing isn't enough. Client-side route transitions pull lazy chunks that exercise different code paths, and that's where env/bundling traps surface.
---
## What's Next
Once setup is complete, let the user know:
"You're all set! Here are some things I can help with:
- **Visual Editing** — Click-to-edit in the Presentation tool (`visual-editing.md`)
- **TypeGen** — Type-safe queries with generated types (`typegen.md`)
- **Studio Structure** — Customize the Studio sidebar (`studio-structure.md`)
- **SEO** — Metadata, sitemaps, and Open Graph (`seo.md`)
- **i18n** — Multi-language content (`localization.md`)
Just ask about any of these!"
---
## Environment Variables
### Framework-Specific Prefixes
| Framework | Client-Side Prefix | Example |
| -------------------- | ------------------ | ------------------------------- |
| Next.js | `NEXT_PUBLIC_` | `NEXT_PUBLIC_SANITY_PROJECT_ID` |
| React Router / Remix | `VITE_` | `VITE_SANITY_PROJECT_ID` |
| SvelteKit | `PUBLIC_` | `PUBLIC_SANITY_PROJECT_ID` |
| Nuxt | `NUXT_PUBLIC_` | `NUXT_PUBLIC_SANITY_PROJECT_ID` |
| Astro | `PUBLIC_` | `PUBLIC_SANITY_PROJECT_ID` |
**Secrets** (read tokens, webhook secrets) stay **unprefixed** and are read via `process.env` (or the framework's server-only equivalent) from server-only modules — `*.server.ts`, route handlers, API routes. Never re-export a secret from a module that a route component can import.
---
## Common Commands
```bash
npx sanity@latest mcp configure # Configure MCP for your editor
npx sanity dev # Start Studio locally
npx sanity schema deploy # Deploy schema for MCP/editor access
npx sanity deploy # Deploy Studio to Sanity hosting
npx sanity manage # Open project settings
npm run typegen # Generate TypeScript types
```
---
## Important Notes
- **Be succinct** — Guide step-by-step without over-explaining
- **Check context first** — Read existing files before suggesting changes
- **Don't give up** — If something fails, give the user a way to complete manually
- **Deploy schema early** — MCP content tools need deployed schemas to see new types and fields
- **One phase at a time** — Complete each phase before moving to the next
@@ -1,373 +0,0 @@
---
title: GROQ Query Maintenance & Best Practices
description: Guidelines for GROQ queries, type safety, performance optimization, and syntax highlighting.
---
# GROQ Query Maintenance & Best Practices
Use this contents list to jump to the query concern you need to solve.
## Table of Contents
- Query definition and imports
- Query fragments
- Expansion patterns
- Maintenance workflow
- Common patterns
- Performance rules
- API version best practices
## 1. Query Definition & Imports
### The `defineQuery` Function
**ALWAYS** wrap GROQ queries in `defineQuery` for TypeGen support. The import location depends on your framework:
```typescript
// Framework-agnostic (Angular, Remix, SvelteKit, Astro, vanilla)
import { defineQuery } from "groq";
// Next.js (re-exported for convenience)
import { defineQuery } from "next-sanity";
```
### Syntax Highlighting
For VS Code syntax highlighting, either:
1. Use the `groq` tagged template (recommended): `groq\`...\``
2. Or prefix with `/* groq */` comment when using `defineQuery`
```typescript
import { defineQuery } from "groq";
// ✅ Option A: groq tag (provides highlighting automatically)
import groq from "groq";
const QUERY = defineQuery(groq`*[_type == "post"]`);
// ✅ Option B: Comment prefix (for plain template literals)
const QUERY = defineQuery(/* groq */ `*[_type == "post"]`);
// ✅ Also valid: Just defineQuery (TypeGen works, but no editor highlighting)
const QUERY = defineQuery(`*[_type == "post"]`);
```
## 2. Query Fragments
Use string interpolation to reuse query logic and keep queries maintainable.
```typescript
// src/sanity/fragments/image.ts
export const imageFragment = /* groq */ `
asset->{
_id,
url,
metadata { lqip, dimensions }
},
alt
`;
// src/sanity/queries/post.ts
import { defineQuery } from "groq";
import { imageFragment } from "../fragments/image";
export const POST_QUERY = defineQuery(/* groq */ `
*[_type == "post"][0] {
title,
mainImage {
${imageFragment}
}
}
`);
```
## 3. Expansion Patterns (Page Builder)
When building a Page Builder query, expand all potential component types.
**Best Practice:** Use a `pageFields` fragment or similar strategy to keep the main query clean.
```typescript
const pageBuilderExpansion = /* groq */ `
pageBuilder[] {
...,
_type == "hero" => {
...,
cta[] { link, label }
},
_type == "gallery" => {
images[] { ${imageFragment} }
}
}
`;
```
## 4. Maintenance Workflow
When you add a new field or component to the Schema:
1. **Update the Query:** Add the new field/expansion to the relevant GROQ query immediately.
2. **Run TypeGen:** If you have `typegen.enabled: true` in `sanity.cli.ts`, types regenerate automatically during `sanity dev`/`sanity build`. Otherwise, run `npm run typegen` manually.
3. **Verify:** Ensure the new field is available in the generated types.
## 5. Common Patterns
### Ordering
```groq
// Single field
*[_type == "post"] | order(publishedAt desc)
// Multiple fields (tiebreaker)
*[_type == "post"] | order(featured desc, publishedAt desc)
// ⚠️ Order BEFORE slice, not after!
*[_type == "post"] | order(publishedAt desc)[0...10] // ✅ Correct
*[_type == "post"][0...10] | order(publishedAt desc) // ❌ Wrong order
```
### Slice Notation
```groq
*[_type == "post"][0] // Single document (object, not array)
*[_type == "post"][0...5] // First 5 (exclusive) ← Most common
*[_type == "post"][$start...$end] // Pagination with params
```
### Default Values with `coalesce()`
```groq
*[_type == "page"]{
"title": coalesce(seoTitle, title, "Untitled"),
"image": coalesce(ogImage, mainImage, defaultImage)
}
```
### Conditionals with `select()`
```groq
*[_type == "product"]{
title,
"badge": select(
stock == 0 => "Out of Stock",
stock < 5 => "Low Stock",
"In Stock"
)
}
```
### Aggregation with `count()`
```groq
// Total count
count(*[_type == "post" && defined(slug.current)])
// Count per document
*[_type == "category"]{
title,
"postCount": count(*[_type == "post" && references(^._id)])
}
```
### Reverse References
```groq
*[_type == "author"]{
name,
"posts": *[_type == "post" && references(^._id)]{ title, slug }
}
```
### Array Filtering
```groq
*[_type == "movie"]{
title,
"mainCast": castMembers[role == "lead"]->{name}
}
// Check if value exists in array
*[_type == "post" && "tech" in categories[]->slug.current]
```
### Special Variables
```groq
// ^ = parent document (in nested queries)
*[_type == "author"]{
name,
"posts": *[_type == "post" && author._ref == ^._id]
}
// @ = current item (in array operations)
*[_type == "post"]{
"tagCount": count(tags[@ != null])
}
```
## 6. Performance Rules
### Optimizable vs Non-Optimizable Filters
GROQ uses indexes for **optimizable** filters. Non-optimizable filters scan ALL documents.
| Pattern | Optimizable | Example |
| ----------------------- | ----------- | -------------------------------- |
| `_type == "x"` | ✅ Yes | `*[_type == "post"]` |
| `_id == "x"` | ✅ Yes | `*[_id == "abc123"]` |
| `slug.current == $slug` | ✅ Yes | `*[slug.current == "hello"]` |
| `defined(field)` | ✅ Yes | `*[defined(publishedAt)]` |
| `references($id)` | ✅ Yes | `*[references("author-123")]` |
| `field->attr == x` | ❌ No | Resolves reference for every doc |
| `fieldA < fieldB` | ❌ No | Compares two attributes |
**Fix non-optimizable filters by stacking:**
```groq
// Stack optimizable filters FIRST to reduce search space
*[_type == "product" && defined(salePrice) && salePrice < displayPrice]
```
### Avoid Joins in Filters
Reference resolution (`->`) in filters is expensive. Use `_ref` instead:
```groq
// ❌ Slow: Resolves reference for every document
*[_type == "post" && author->name == "Bob Woodward"]
// ✅ Fast: Direct _ref comparison
*[_type == "post" && author._ref == "author-bob-woodward-id"]
```
**When you need dynamic lookups** (don't know the ID upfront):
```groq
// Two-step approach:
// 1. Get the reference ID first
*[_type == "author" && name == "Bob Woodward"][0]._id
// 2. Use that ID in your main query
*[_type == "post" && author._ref == $authorId]
// Or use a subquery (still better than -> in filter):
*[_type == "post" && author._ref in *[_type == "author" && name == "Bob Woodward"]._id]
```
### Merge Repeated Reference Resolutions
Each `->` is a subquery. Don't repeat it:
```groq
// ❌ Slow: Two separate subqueries
*[_type == "category"]{
"parentTitle": parent->title,
"parentSlug": parent->slug.current
}
// ✅ Fast: Single subquery, merged
*[_type == "category"]{
...(parent->{ "parentTitle": title, "parentSlug": slug.current })
}
```
### Cursor-Based Pagination (Not Deep Slicing)
Deep slices are slow because all skipped docs must be sorted first.
```groq
// ❌ Slow: Must sort and skip 10,000 docs
*[_type == "article"] | order(_id)[10000...10020]
// ✅ Fast: Cursor-based, only fetches 20
*[_type == "article" && _id > $lastId] | order(_id)[0...20]
```
**For custom sort orders**, include the sort field in the cursor:
```groq
// Compound cursor: publishedAt + _id for deterministic pagination
*[_type == "article" && (
publishedAt < $lastDate ||
(publishedAt == $lastDate && _id > $lastId)
)] | order(publishedAt desc, _id)[0...20]
```
### Always Project Fields
Always use projections to return only the fields your application needs. Fetching entire documents wastes bandwidth and processing time.
```groq
// ❌ Returns ALL fields including unused ones, metadata, revisions
*[_type == "post"]
// ✅ Only fetch what the component needs
*[_type == "post"]{
_id,
title,
"slug": slug.current,
publishedAt,
excerpt
}
```
Apply projections at every level, including nested references:
```groq
*[_type == "post"]{
title,
author->{ name, "avatar": image.asset->url },
categories[]->{ title, "slug": slug.current }
}
```
Use conditional projections for different contexts:
```groq
*[_type == "post"]{
title,
slug,
// Only include body for single post view
$includeBody == true => { body }
}
```
### Don't Filter/Sort on Projected Values
Computed attributes can't use indexes:
```groq
// ❌ Not optimizable (computed attribute)
*[_type == "person"]{
"fullName": firstName + " " + lastName
} | order(fullName)
// ✅ Optimizable (original attribute)
*[_type == "person"] | order(firstName, lastName)
```
### Quick Checklist
| Rule | Why |
| ----------------------------------- | --------------------------------------------- |
| Always project `{ fields }` | Reduces data returned |
| Use `defined()` checks | Filters use indexes |
| Use `$params` not interpolation | Prevents query manipulation + enables caching |
| Order BEFORE slice | `order()[0...N]` not `[0...N] order()` |
| Use `_ref` not `->field` in filters | Avoids expensive joins |
| Merge repeated `->` calls | Single subquery vs many |
| Cursor pagination for deep pages | Avoids sorting entire dataset |
## 7. API Version Best Practices
Always use dated versions (`YYYY-MM-DD`) for consistent behavior:
```typescript
const client = createClient({
apiVersion: "2026-02-01", // Use current date for new projects
});
```
- **New projects:** Use current date (e.g., `2026-02-01`)
- **Existing projects:** Keep current version unless you need new features
- Dated versions lock behavior; `v1` or `vX` may change unexpectedly
@@ -1,275 +0,0 @@
---
title: "Sanity + Shopify + Hydrogen Rules"
description: Integration guide for Sanity with Shopify using the Hydrogen framework (React Router 7).
---
# Sanity + Shopify + Hydrogen Rules
**Package:** [`hydrogen-sanity`](https://github.com/sanity-io/hydrogen-sanity) — requires `@shopify/hydrogen >= 2025.5.0`
## 1. Architecture Overview
| Component | Purpose |
| ------------------ | ------------------------------------------------------------------- |
| **Shopify** | Product catalog, inventory, checkout (source of truth for commerce) |
| **Sanity Connect** | Syncs Shopify data to Sanity in real-time |
| **Sanity Studio** | Editorial content, rich descriptions, media (enhances Shopify data) |
| **Hydrogen** | React Router 7 front-end optimized for Shopify |
**Project Structure:**
```
./
├── /studio # Sanity Studio
└── /web # Hydrogen front-end
```
## 2. Environment Variables
```bash
# web/.env
PUBLIC_STOREFRONT_API_TOKEN="your-public-storefront-token"
PRIVATE_STOREFRONT_API_TOKEN="your-private-storefront-token"
PUBLIC_STORE_DOMAIN="your-store.myshopify.com"
SESSION_SECRET="your-random-session-secret"
# Sanity
SANITY_PROJECT_ID="your-project-id"
SANITY_DATASET="production"
SANITY_API_VERSION="2026-02-01"
SANITY_PREVIEW_TOKEN="your-sanity-viewer-token" # Viewer token for previews
```
## 3. Sanity Client Setup
### Vite Config
```typescript
// web/vite.config.ts
import { hydrogen } from "@shopify/hydrogen/vite";
import { sanity } from "hydrogen-sanity/vite";
export default defineConfig({
plugins: [hydrogen(), sanity()],
});
```
### Context Setup
```typescript
// web/app/lib/context.ts
import { type SanityContext, createSanityContext } from "hydrogen-sanity";
import { isPreviewEnabled } from "hydrogen-sanity/preview";
import { PreviewSession } from "hydrogen-sanity/preview/session";
const sanity = await createSanityContext({
request,
cache,
waitUntil,
client: {
projectId: env.SANITY_PROJECT_ID,
dataset: env.SANITY_DATASET,
apiVersion: env.SANITY_API_VERSION || "2026-02-01",
useCdn: true,
stega: {
enabled: isPreviewEnabled(env.SANITY_PROJECT_ID, previewSession),
studioUrl: "http://localhost:3333",
},
},
preview: {
token: env.SANITY_PREVIEW_TOKEN,
session: previewSession,
},
});
```
### Provider Setup (entry.server.tsx)
```typescript
const {SanityProvider} = context.sanity
const body = await renderToReadableStream(
<NonceProvider>
<SanityProvider>
<ServerRouter context={reactRouterContext} url={request.url} nonce={nonce} />
</SanityProvider>
</NonceProvider>,
)
```
### Root Layout (root.tsx)
```typescript
import {Sanity} from 'hydrogen-sanity'
export function Layout({children}) {
const nonce = useNonce()
return (
<html>
<body>
{children}
<Sanity nonce={nonce} /> {/* Required for client-side */}
<Scripts nonce={nonce} />
</body>
</html>
)
}
```
## 4. Data Fetching
Fetch from **both** Shopify (GraphQL) and Sanity (GROQ). Use `defineQuery` for TypeGen support.
### Recommended: `query` + `Query` component
```typescript
import {defineQuery} from 'groq'
import {Query} from 'hydrogen-sanity'
const PRODUCT_QUERY = defineQuery(`*[_type == "product" && store.slug.current == $handle][0]{ body }`)
// Loader
export async function loader({params, context: {sanity}}: LoaderFunctionArgs) {
const initial = await context.sanity.query(PRODUCT_QUERY, params)
return {initial}
}
// Component - auto-enables live preview when active
export default function ProductPage({loaderData}) {
return (
<Query query={PRODUCT_QUERY} options={{initial: loaderData.initial}}>
{(data) => <div>{data?.body}</div>}
</Query>
)
}
```
### Alternative methods
| Method | Use Case |
| -------------------------- | ------------------------------- |
| `sanity.query()` + `Query` | Recommended - auto preview mode |
| `sanity.loadQuery()` | Manual loader integration |
| `sanity.fetch()` | No preview needed, lightweight |
| `sanity.client` | Mutations in actions |
### Images
```typescript
import {useImageUrl} from 'hydrogen-sanity'
function Hero({image}) {
const imageUrl = useImageUrl(image)
return <img src={imageUrl.width(1200).height(600).url()} />
}
```
**Key Insight:** Shopify fields synced via Sanity Connect are `readOnly`. Use Sanity for editorial enhancements only.
## 5. Visual Editing Setup
### Root Layout
```typescript
// web/app/root.tsx
import {usePreviewMode} from 'hydrogen-sanity/preview'
import {VisualEditing} from 'hydrogen-sanity/visual-editing'
export function Layout({children}: {children?: React.ReactNode}) {
const previewMode = usePreviewMode()
return (
<html>
<body>
{children}
{previewMode ? <VisualEditing action="/api/preview" /> : null}
</body>
</html>
)
}
```
### Preview Route
```typescript
// web/app/routes/api.preview.ts
export { action, loader } from "hydrogen-sanity/preview/route";
```
### Content Security Policy
```typescript
// web/entry.server.tsx
const { nonce, header, NonceProvider } = createContentSecurityPolicy({
frameAncestors: isPreviewEnabled ? [studioHostname] : [],
connectSrc: [
`https://${projectId}.api.sanity.io`,
`wss://${projectId}.api.sanity.io`,
],
});
```
## 6. Studio: Presentation Tool
```typescript
// studio/sanity.config.ts
import { presentationTool } from "sanity/presentation";
export default defineConfig({
plugins: [
presentationTool({
resolve: {
locations: {
product: defineLocations({
select: { title: "store.title", slug: "store.slug.current" },
resolve: (doc) => ({
locations: [
{
title: doc?.title || "Untitled",
href: `/products/${doc?.slug}`,
},
{ title: "Products", href: `/collections/all` },
],
}),
}),
},
},
previewUrl: {
origin: "http://localhost:3000",
previewMode: { enable: "/api/preview" },
},
}),
],
});
```
## 7. Commands
```bash
# Install dependencies
pnpm add hydrogen-sanity @sanity/client @portabletext/react
# Development (run in separate terminals)
cd studio && pnpm dev # Studio at localhost:3333
cd web && pnpm dev # Hydrogen at localhost:3000
# Sanity Manage (CORS, tokens): https://www.sanity.io/manage
pnpm dlx sanity manage
```
## 8. Boundaries
- Always:
- Query Shopify for commerce data (price, inventory, variants)
- Query Sanity for editorial content (rich text, custom fields)
- Use `hydrogen-sanity` package for Visual Editing
- Add Hydrogen URL to CORS origins in [Sanity Manage](https://www.sanity.io/manage)
- Ask First:
- Before modifying Sanity Connect sync settings
- Before changing CSP configuration
- Never:
- Edit Shopify-synced fields in Sanity (they're `readOnly`)
- Expose `SANITY_API_TOKEN` to client-side code
- Query Sanity for commerce data that should come from Shopify
@@ -1,133 +0,0 @@
---
title: "Sanity Image Rules"
description: "Best practices for handling images in Sanity: Schema, URL generation, and Next.js Image integration."
---
# Sanity Image Rules
## 1. Schema Definition
**Always** enable `hotspot: true`. This allows editors to control cropping and the focal point.
```typescript
defineField({
name: "mainImage",
title: "Main Image",
type: "image",
options: {
hotspot: true, // CRITICAL
},
fields: [
defineField({
name: "alt",
type: "string",
title: "Alternative Text",
validation: (rule) =>
rule.required().warning("Alt text is important for SEO"),
}),
],
});
```
## 2. URL Builder (`urlFor`)
Use the Sanity Image URL Builder to generate optimized URLs (resize, crop, format).
**Setup (`sanity/lib/image.ts`):**
```typescript
import createImageUrlBuilder from "@sanity/image-url";
import { dataset, projectId } from "../env";
const builder = createImageUrlBuilder({ projectId, dataset });
export const urlFor = (source: any) => {
return builder.image(source);
};
```
**Usage:** The URL builder automatically uses hotspot/crop data when available:
```typescript
const imageUrl = urlFor(mainImage)
.width(800)
.height(600)
.fit("crop") // Respects hotspot when cropping
.url();
```
## 3. Next.js Image Component Pattern
Create a reusable `SanityImage` component that handles the `urlFor` logic and `next/image` props.
```typescript
import Image from 'next/image'
import { urlFor } from '@/sanity/lib/image'
interface SanityImageProps {
value: any // SanityImageSource
width?: number
height?: number
className?: string
priority?: boolean
}
export function SanityImage({ value, width = 800, height, className, priority }: SanityImageProps) {
if (!value?.asset) return null
return (
<Image
className={className}
src={urlFor(value)
.width(width)
.height(height || Math.round(width / 1.5)) // Default aspect ratio if no height
.url()}
alt={value.alt || ''}
width={width}
height={height || Math.round(width / 1.5)}
priority={priority}
// Optional: Use LQIP (Low Quality Image Placeholder)
placeholder={value.asset.metadata?.lqip ? 'blur' : 'empty'}
blurDataURL={value.asset.metadata?.lqip}
/>
)
}
```
## 4. Querying Images
**Critical:** LQIP (Low Quality Image Placeholder) is **not automatic**. You must explicitly query it via `asset->{ metadata { lqip } }`.
### Minimal Query (No LQIP)
```groq
mainImage {
asset->{ _id, url },
alt
}
```
### Full Query (With LQIP & Dimensions)
```groq
mainImage {
asset->{
_id,
url,
metadata {
lqip, // Base64 blur placeholder
dimensions { width, height } // For aspect ratio
}
},
alt,
hotspot, // Include if using hotspot cropping
crop // Include if using cropping
}
```
**Why this matters:** Without querying `metadata.lqip`, the `blurDataURL` in your component will be `undefined` and the blur effect won't work.
## 5. Performance Tips
- **Auto Format:** Sanity CDN automatically serves WebP/AVIF if the browser supports it (no need to specify `.format('webp')` manually in most cases, but `next/image` handles this too).
- **Sizing:** Always request the exact size you need using `.width()` and `.height()` in `urlFor`. Don't download a 4000px image for a thumbnail.
@@ -1,458 +0,0 @@
---
title: Sanity Localization Rules
description: Localization patterns for Sanity using official plugins and best practices.
---
# Sanity Localization Rules
Use the contents list to jump directly to the localization pattern you need.
## Table of Contents
- Guiding principles
- Terminology
- Locale content type
- Choosing document-level vs field-level localization
- Document-level localization
- Localized singletons
- Field-level localization
- AI-powered translation
- UI enhancement
- Frontend URL best practices
## 1. Guiding Principles
### Priority: Easy Authoring Experience
The structured nature of Sanity schemas and GROQ make it easy to parse localized content for your frontend. **Never** let frontend architecture dictate your localization approach — prioritize the editor experience.
### Avoid Content Duplication
Don't create nearly identical copies with slight differences (e.g., US vs British English). Use Portable Text marks and custom blocks to swap out words or sections as needed.
## 2. Terminology
| Term | Definition |
| ------------------------------- | --------------------------------------------------------- |
| **Internationalization (i18n)** | Designing your frontend to support multiple languages |
| **Localization** | Adapting content for a specific language/region |
| **Language Tag** | Code like `en`, `en-US`, `zh-Hant-TW` (per IETF RFC 5646) |
| **Locale** | A language tag with region info (e.g., `en-US`) |
## 3. Create a Locale Content Type
**Best Practice:** Store locales in Sanity, not just in code. This allows sharing between Studio and frontend.
```typescript
// schemaTypes/locale.ts
import { TranslateIcon } from "@sanity/icons";
import { defineField, defineType } from "sanity";
export const localeType = defineType({
name: "locale",
icon: TranslateIcon,
type: "document",
fields: [
defineField({
name: "name",
type: "string",
validation: (r) => r.required(),
}),
defineField({
name: "tag",
type: "string",
description: "IANA tag (en, en-US)",
validation: (r) => r.required(),
}),
defineField({
name: "fallback",
type: "reference",
to: [{ type: "locale" }],
}),
defineField({ name: "default", type: "boolean" }),
],
preview: { select: { title: "name", subtitle: "tag" } },
});
```
**Tip:** Restrict locale editing to admins via Structure by filtering `locale` from non-admin users.
## 4. Choose Your Localization Method
| Content Type | Examples | Recommended Method |
| ----------------------- | --------------------------------------- | ------------------ |
| **Structured** (things) | Products, People, Locations, Categories | Field-level |
| **Presentation** (UI) | Pages, Posts, Components | Document-level |
### Decision Questions
1. **Are fields shared across languages?** → Field-level
2. **Should changes be "global" for all locales?** (e.g., reordering components) → Field-level
3. **Is content mostly the same except regional differences?** → Field-level with PT marks
4. **Need to publish language versions independently?** → Document-level
## 5. Document-Level Localization
Use the **@sanity/document-internationalization** plugin.
```bash
npm install @sanity/document-internationalization
```
### Configuration
```typescript
// sanity.config.ts
import { documentInternationalization } from "@sanity/document-internationalization";
export default defineConfig({
plugins: [
documentInternationalization({
// Fetch from Content Lake
supportedLanguages: (client) =>
client.fetch(`*[_type == "locale"]{ "id": tag, "title": name }`),
// Document types to localize
schemaTypes: ["post", "page"],
}),
],
});
```
### Add Language Field to Schema
```typescript
// In each schema type listed in schemaTypes
defineField({
name: "language",
type: "string",
readOnly: true,
hidden: true,
});
```
### Initial Value Templates
Pre-set language when creating documents outside the translation UI:
```typescript
// sanity.config.ts
import { template } from "sanity";
export default defineConfig({
// ...
document: {
newDocumentOptions: (prev, { creationContext }) => {
// Filter to only show base language in "New document" menu
// The plugin handles creating translations from there
return prev.filter(
(item) =>
!["post", "page"].includes(item.templateId) ||
item.parameters?.language === "en",
);
},
},
// Initial value templates for each language
templates: (prev) => [
...prev,
template.initial({
id: "post-en",
title: "Post (English)",
schemaType: "post",
parameters: [{ name: "language", type: "string" }],
value: ({ language }) => ({ language }),
}),
],
});
```
### Querying Translated Documents
```groq
// Get document in specific language
*[_type == "post" && language == $locale && slug.current == $slug][0]
// Get all translations via metadata document
*[_type == "translation.metadata" && references($docId)][0] {
translations[] {
_key,
value-> { title, slug, language }
}
}
```
## 6. Localized Singletons (Homepage per Locale)
For singletons like homepages that need a separate document per locale, combine document-level localization with the singleton pattern.
### Schema Definition
```typescript
// schemaTypes/homePage.ts
import { HomeIcon } from "@sanity/icons";
import { defineField, defineType } from "sanity";
export const homePageType = defineType({
name: "homePage",
title: "Home Page",
type: "document",
icon: HomeIcon,
fields: [
defineField({
name: "language",
type: "string",
readOnly: true,
hidden: true,
}),
defineField({ name: "title", type: "string" }),
defineField({ name: "pageBuilder", type: "pageBuilder" }),
// ... other fields
],
preview: {
select: { language: "language" },
prepare({ language }) {
return {
title: "Home Page",
subtitle: language?.toUpperCase() || "No language",
};
},
},
});
```
### Initial Value Templates
Create templates that pre-set the language for each locale:
```typescript
// sanity.config.ts
import { Template, defineConfig } from "sanity";
// Define your supported locales
const LOCALES = [
{ id: "en", title: "English" },
{ id: "fr", title: "French" },
{ id: "de", title: "German" },
];
export default defineConfig({
// ...
templates: (prev) => {
// Create a template for each locale
const homePageTemplates: Template[] = LOCALES.map((locale) => ({
id: `homePage-${locale.id}`,
title: `Home Page (${locale.title})`,
schemaType: "homePage",
parameters: [{ name: "language", type: "string" }],
value: { language: locale.id },
}));
return [...prev, ...homePageTemplates];
},
});
```
### Structure: Localized Singleton Helper
Create a helper to show one singleton per locale in the Structure:
```typescript
// src/structure/index.ts
import { HomeIcon } from "@sanity/icons";
import { StructureBuilder, StructureResolver } from "sanity/structure";
const LOCALES = ["en", "fr", "de"];
function createLocalizedSingleton(
S: StructureBuilder,
typeName: string,
title: string,
icon?: React.ComponentType,
) {
return S.listItem()
.title(title)
.icon(icon)
.child(
S.list()
.title(title)
.items(
LOCALES.map((locale) =>
S.listItem()
.title(`${title} (${locale.toUpperCase()})`)
.icon(icon)
.child(
S.document()
.schemaType(typeName)
.documentId(`${typeName}-${locale}`) // Fixed ID per locale
.title(`${title} (${locale.toUpperCase()})`),
),
),
),
);
}
export const structure: StructureResolver = (S) =>
S.list()
.title("Content")
.items([
// Localized singletons
createLocalizedSingleton(S, "homePage", "Home Page", HomeIcon),
S.divider(),
// Filter localized singletons from default list
...S.documentTypeListItems().filter(
(item) => !["homePage"].includes(item.getId() as string),
),
]);
```
### Querying Localized Singletons
```groq
// Get homepage for specific locale
*[_type == "homePage" && language == $locale][0]{
title,
pageBuilder[]{...}
}
// Or by fixed document ID
*[_id == "homePage-" + $locale][0]{...}
```
### Key Points
- **Fixed IDs:** Use `${typeName}-${locale}` only for localized singletons; let Sanity generate IDs for ordinary localized content
- **Initial Value Templates:** Essential for the "New document" menu to work correctly
- **Structure:** Group all locale versions under one list item for cleaner navigation
- **See also:** `studio-structure.md` for more singleton patterns
## 7. Field-Level Localization
Use **sanity-plugin-internationalized-array** (NOT localized objects — they hit attribute limits).
```bash
npm install sanity-plugin-internationalized-array
```
### Configuration
```typescript
// sanity.config.ts
import { internationalizedArray } from "sanity-plugin-internationalized-array";
export default defineConfig({
plugins: [
internationalizedArray({
languages: (client) =>
client.fetch(`*[_type == "locale"]{ "id": tag, "title": name }`),
fieldTypes: ["string", "text", "simpleBlockContent"],
}),
],
});
```
### Usage in Schema
```typescript
// The plugin creates types like `internationalizedArrayString`
defineField({
name: "jobTitle",
type: "internationalizedArrayString", // Localized string field
});
```
### Portable Text Localization
Create a reusable block content type, then add it to `fieldTypes`:
```typescript
// schemaTypes/simpleBlockContent.ts
export default defineType({
name: "simpleBlockContent",
type: "array",
of: [
{
type: "block",
styles: [{ title: "Normal", value: "normal" }],
lists: [],
},
],
});
// sanity.config.ts
fieldTypes: ["string", "simpleBlockContent"];
// In your schema
defineField({
name: "bio",
type: "internationalizedArraySimpleBlockContent",
});
```
### Querying Internationalized Arrays
```groq
// Get specific locale value
*[_type == "author"][0] {
"jobTitle": jobTitle[_key == $locale][0].value
}
// With fallback
*[_type == "author"][0] {
"jobTitle": coalesce(
jobTitle[_key == $locale][0].value,
jobTitle[_key == "en"][0].value
)
}
```
## 8. AI-Powered Translation
Use **@sanity/assist** for automated translations.
```bash
npm install @sanity/assist
```
```typescript
// sanity.config.ts
import { assist } from "@sanity/assist";
export default defineConfig({
plugins: [
assist({
translate: {
// For document-level localization
document: {
languageField: "language",
},
// For field-level localization
field: {
languages: (client) =>
client.fetch(`*[_type == "locale"]{ "id": tag, "title": name }`),
documentTypes: ["author", "category"],
},
},
}),
],
});
```
## 9. UI Enhancement
Use **@sanity/language-filter** to let editors show/hide locales:
```bash
npm install @sanity/language-filter
```
## 10. Frontend URL Best Practices
**Always include locale in the URL** for SEO:
- `yoursite.com/en/my-page` → `yoursite.com/fr/my-page`
- `yoursite.com/my-page` → redirects to default locale
**Avoid:** Having the default locale at root without prefix — causes SEO edge cases.
Use Next.js middleware (or framework equivalent) to redirect paths missing a locale prefix to the default locale.
@@ -1,143 +0,0 @@
---
title: Import HTML to Portable Text
description: Use @portabletext/block-tools with JSDOM to convert HTML content
---
## Import HTML to Portable Text
Use `@portabletext/block-tools` with `JSDOM` to convert HTML from legacy CMSs to Portable Text.
### Setup
```bash
npm install @portabletext/block-tools jsdom
```
### Basic Conversion
```typescript
import { htmlToBlocks } from "@portabletext/block-tools";
import { JSDOM } from "jsdom";
// Get block content type from your schema
const blockContentType = schema.get("blockContent");
const blocks = htmlToBlocks(htmlString, blockContentType, {
parseHtml: (html) => new JSDOM(html).window.document,
});
```
### Custom Deserializers
Handle specific HTML patterns:
```javascript
const blocks = htmlToBlocks(htmlString, blockContentType, {
parseHtml: (html) => new JSDOM(html).window.document,
rules: [
{
deserialize(el, next, block) {
// Custom link handling
if (el.tagName.toLowerCase() === "a") {
return {
_type: "link",
href: el.getAttribute("href"),
blank: el.getAttribute("target") === "_blank",
};
}
// Custom image handling
if (el.tagName.toLowerCase() === "img") {
return {
_type: "image",
// Upload image separately, store reference
_sanityAsset: `image@${el.getAttribute("src")}`,
};
}
return undefined; // Fall through to default handling
},
},
],
});
```
### Pre-Processing HTML
Clean HTML before conversion:
```javascript
function cleanHtml(html) {
const dom = new JSDOM(html);
const doc = dom.window.document;
// Remove layout elements
doc
.querySelectorAll("header, footer, nav, .sidebar")
.forEach((el) => el.remove());
// Extract metadata before processing body
const title = doc.querySelector("title")?.textContent;
const description = doc.querySelector('meta[name="description"]')?.content;
return {
body: doc.body.innerHTML,
metadata: { title, description },
};
}
```
### Image Upload
Don't just link external images—upload them:
```javascript
async function uploadImage(client, imageUrl) {
const response = await fetch(imageUrl);
const buffer = await response.arrayBuffer();
const asset = await client.assets.upload("image", Buffer.from(buffer), {
filename: imageUrl.split("/").pop(),
});
return {
_type: "image",
asset: { _type: "reference", _ref: asset._id },
};
}
```
### Using in a Migration
Wrap this in `defineMigration` for controlled imports:
```typescript
// migrations/import-wordpress-posts/index.ts
import { htmlToBlocks } from "@portabletext/block-tools";
import { create, defineMigration } from "sanity/migrate";
export default defineMigration({
title: "Import WordPress posts",
async *migrate(documents, context) {
const posts = await fetchWordPressPosts(); // Your import source
for (const post of posts) {
const blocks = htmlToBlocks(post.content, blockContentType, {
parseHtml: (html) => new JSDOM(html).window.document,
});
yield create({
_type: "post",
title: post.title,
slug: { _type: "slug", current: post.slug },
legacyId: String(post.id),
body: blocks,
});
}
},
});
```
Let Sanity generate document IDs for ordinary imported content. Add schema fields for legacy identifiers or slugs, then use GROQ lookups against those fields when you need to rerun an import, patch existing documents, or create references between imported records. Set `_id` directly only for singleton documents.
Run with: `sanity migration run import-wordpress-posts --no-dry-run`
Reference: [Schema and Content Migrations](https://www.sanity.io/docs/content-lake/schema-and-content-migrations)
@@ -1,59 +0,0 @@
---
title: Sanity Content Migration Rules
description: Best practices for migrating content (HTML, Markdown) into Sanity Portable Text.
---
# Sanity Content Migration Rules
## Document Identity During Import (Critical)
Let Sanity generate `_id` values for imported documents unless you are intentionally creating a singleton. Do not derive deterministic UUIDs or document IDs from slugs, file paths, legacy IDs, or related document IDs.
- Store legacy identifiers in fields such as `legacyId`, `externalId`, or `slug`.
- Make imports idempotent by looking up existing documents with GROQ before creating or patching them.
- Create relationships by querying the target document and using its real `_id` in a `reference`; do not predict `_ref` values from naming conventions.
- Reserve explicit `_id` values for singleton documents such as `settings`, `homePage`, or localized singleton IDs like `homePage-en`.
## 1. HTML Import (Legacy CMS)
Use `@portabletext/block-tools` with `JSDOM` to convert HTML to Portable Text. This covers setup, custom deserializers, pre-processing, image uploads, and wrapping in `defineMigration`.
**See `migration-html-import.md` for the full guide with working examples.**
## 2. Markdown Import (Static Sites)
Use `@portabletext/markdown` for direct, schema-aware Markdown ↔ Portable Text conversion.
**Recommended: Direct Conversion with `@portabletext/markdown`**
```typescript
import { markdownToPortableText } from "@portabletext/markdown";
const blocks = markdownToPortableText(markdownString);
```
This handles headings, lists, bold, italic, code, links, images, and tables. Use `@portabletext/sanity-bridge` to pass your Sanity schema so only valid types are produced.
**Alternative: Markdown → HTML → Portable Text**
For complex Markdown with non-standard extensions, convert to HTML first, then use `htmlToBlocks` (see above).
1. **Parse:** `marked` or `remark` to convert MD to HTML.
2. **Convert:** Use `htmlToBlocks` from `@portabletext/block-tools`.
> **Note:** `@sanity/block-content-to-markdown` and `@sanity/block-tools` are deprecated. Use `@portabletext/markdown` and `@portabletext/block-tools` instead.
## 3. Image Handling (Universal)
Don't just link to external images. Download them and upload to Sanity Asset Pipeline.
1. **Extract:** Find `<img>` tags or Markdown image syntax.
2. **Download:** Fetch the image buffer.
3. **Upload:** `client.assets.upload('image', buffer)`
4. **Replace:** Return a Sanity Image block with the new asset reference.
## 4. Schema Validation
Ensure your destination schema allows the structures you are importing.
- **Tables:** Need a `table` type (HTML `<table>` or GFM tables).
- **Code:** Need a `code` type (HTML `<pre><code>` or MD code fences).
@@ -1,563 +0,0 @@
---
title: Next.js & Sanity Integration Rules
description: Integration guide for Next.js App Router, Live Content API, and a standalone Sanity Studio.
---
# Next.js & Sanity Integration Rules
Jump to the section that matches the task instead of reading this guide end-to-end.
## Table of Contents
- Architecture patterns
- Data fetching (Live Content API)
- Caching and revalidation
- Visual Editing and clean data
- Studio setup (standalone)
- Draft Mode setup
- Error handling
- Presentation queries
- Pagination pattern
## 1. Architecture Patterns
### Option A: Standalone Studio (Recommended)
**Best for:** All new Next.js projects.
The Studio is its own app, living alongside the Next.js app in the same repo:
```
your-project/
├── studio/ # Sanity Studio (standalone)
└── web/ # Next.js frontend
```
Why standalone instead of embedding the Studio in the Next.js app:
- **Faster dev and builds:** `sanity dev` and `sanity build` run on Vite and are dramatically faster (10-30x) than compiling the Studio through `next dev` / `next build`.
- **Auto-updates:** Standalone Studios receive bugfixes and new features automatically, with no dependency bump or redeploy. Embedded Studios can't auto-update (Next.js does not support ESM with import maps), so every update means bump + deploy.
- **TypeGen watch mode:** With `sanity dev`, TypeGen regenerates types as queries change. Embedded Studios can't hook into `next dev`, so you must re-run `sanity typegen generate` manually after every query edit.
- **Content model independence:** A separate Studio keeps the content model from becoming website-centric and makes collaboration easier.
**Setup:**
- Run both apps side by side in separate terminals: `next dev` (localhost:3000) and `sanity dev` (localhost:3333).
- Add your Next.js app URL to **CORS Origins**: `npx sanity cors add http://localhost:3000 --credentials` (repeat for your production URL), or via [Sanity Manage](https://www.sanity.io/manage).
- See `project-structure.md` rule for detailed structure.
### Option B: Embedded Studio (Not Recommended)
The Studio can be mounted inside the Next.js app at `/app/studio/[[...tool]]/page.tsx` via `next-sanity/studio`. Avoid this for new projects: it slows builds, ties every Studio update to an app deploy, and rules out auto-updates and TypeGen watch mode. For maintaining or migrating an existing embedded Studio, see section 5.
## 2. Data Fetching (Live Content API)
We use `defineLive` (next-sanity v11+) to enable real-time content updates and Visual Editing automatically.
### Setup (`src/sanity/lib/live.ts`)
```typescript
import { defineLive } from "next-sanity";
import { client } from "./client";
export const { sanityFetch, SanityLive } = defineLive({
client: client.withConfig({
apiVersion: "2026-02-01",
}),
serverToken: process.env.SANITY_API_READ_TOKEN,
browserToken: process.env.SANITY_API_READ_TOKEN,
});
```
### Rendering (`src/app/layout.tsx`)
You **must** render `<SanityLive />` in the root layout to enable real-time updates.
```typescript
import { SanityLive } from '@/sanity/lib/live'
import { VisualEditing } from 'next-sanity/visual-editing'
import { draftMode } from 'next/headers'
export default async function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
{children}
<SanityLive />
{(await draftMode()).isEnabled && <VisualEditing />}
</body>
</html>
)
}
```
## 3. Caching & Revalidation
### Prefer Live Content API (Default)
**Use `defineLive` by default.** It handles fetching, caching, and invalidation automatically. Only implement manual caching when you need fine-grained control.
### When to Use Manual Caching
| Scenario | Approach |
| ---------------------------------------- | ------------------------------- |
| Real-time updates, Visual Editing | `defineLive` (default) |
| Static marketing pages, rarely updated | Time-based revalidation |
| Blog posts, products with frequent edits | Tag-based revalidation |
| Critical accuracy (stock levels, prices) | Path-based + short revalidation |
### Debugging: Enable Fetch Logging
See every fetch with cache HIT/MISS status:
```typescript
// next.config.ts
const nextConfig: NextConfig = {
logging: {
fetches: {
fullUrl: true,
},
},
};
```
Console output shows cache status:
```text
GET /posts 200 in 39ms
│ GET https://...apicdn.sanity.io/... 200 in 5ms (cache hit)
```
### Sanity CDN vs API
| Setting | Speed | Freshness | Use When |
| --------------- | ------ | -------------------- | -------------------------------- |
| `useCdn: true` | Fast | May have brief delay | Default for all runtime fetches |
| `useCdn: false` | Slower | Guaranteed fresh | `generateStaticParams`, webhooks |
Override per-request:
```typescript
// For static generation, use API directly
export async function generateStaticParams() {
const slugs = await client.withConfig({ useCdn: false }).fetch(SLUGS_QUERY);
return slugs;
}
```
### Manual `sanityFetch` Helper (Advanced)
For manual caching control, create a wrapper:
```typescript
// src/sanity/lib/client.ts
export async function sanityFetch<const QueryString extends string>({
query,
params = {},
revalidate = 60,
tags = [],
}: {
query: QueryString;
params?: QueryParams;
revalidate?: number | false;
tags?: string[];
}) {
return client.fetch(query, params, {
next: {
revalidate: tags.length ? false : revalidate,
tags,
},
});
}
```
### Time-Based Revalidation
Simple and predictable. Good for content that changes infrequently.
```typescript
const posts = await sanityFetch({
query: POSTS_QUERY,
revalidate: 3600, // Revalidate every hour
});
```
**The "Typo Problem":** With time-based only, content authors may wait up to an hour to see changes. Use webhooks for instant updates.
### Path-Based Revalidation
Surgically revalidate specific routes when documents change.
**1. Create API Route:**
```typescript
// src/app/api/revalidate/path/route.ts
import { parseBody } from "next-sanity/webhook";
import { revalidatePath } from "next/cache";
import { type NextRequest, NextResponse } from "next/server";
type WebhookPayload = { path?: string };
export async function POST(req: NextRequest) {
try {
const { isValidSignature, body } = await parseBody<WebhookPayload>(
req,
process.env.SANITY_REVALIDATE_SECRET,
true, // Add delay to allow CDN to update
);
if (!isValidSignature) {
return new Response("Invalid signature", { status: 401 });
}
if (!body?.path) {
return new Response("Missing path", { status: 400 });
}
revalidatePath(body.path);
return NextResponse.json({ revalidated: body.path });
} catch (err) {
return new Response((err as Error).message, { status: 500 });
}
}
```
**2. Create GROQ-Powered Webhook:**
- URL: `https://yoursite.com/api/revalidate/path`
- Filter: `_type in ["post"]`
- Projection: `{ "path": "/posts/" + slug.current }`
- Add `SANITY_REVALIDATE_SECRET` to webhook and `.env.local`
### Tag-Based Revalidation
"Update once, revalidate everywhere" — best for referenced content.
**1. Tag Your Queries:**
```typescript
// Posts index - revalidate when ANY post, author, or category changes
const posts = await sanityFetch({
query: POSTS_QUERY,
tags: ["post", "author", "category"],
});
// Individual post - more granular, includes slug-specific tag
const post = await sanityFetch({
query: POST_QUERY,
params,
tags: [`post:${params.slug}`, "author", "category"],
});
```
**2. Create API Route:**
```typescript
// src/app/api/revalidate/tag/route.ts
import { parseBody } from "next-sanity/webhook";
import { revalidateTag } from "next/cache";
import { type NextRequest, NextResponse } from "next/server";
type WebhookPayload = { tags: string[] };
export async function POST(req: NextRequest) {
try {
const { isValidSignature, body } = await parseBody<WebhookPayload>(
req,
process.env.SANITY_REVALIDATE_SECRET,
true,
);
if (!isValidSignature) {
return new Response("Invalid signature", { status: 401 });
}
if (!Array.isArray(body?.tags) || !body.tags.length) {
return new Response("Missing tags", { status: 400 });
}
body.tags.forEach((tag) => revalidateTag(tag));
return NextResponse.json({ revalidated: body.tags });
} catch (err) {
return new Response((err as Error).message, { status: 500 });
}
}
```
**3. Create GROQ-Powered Webhook:**
- URL: `https://yoursite.com/api/revalidate/tag`
- Filter: `_type in ["post", "author", "category"]`
- Projection: `{ "tags": [_type, _type + ":" + slug.current] }`
### Stale Data After Webhook?
Webhooks fire _before_ Sanity CDN updates. If you see stale data:
1. **Add delay** — Pass `true` as third arg to `parseBody`
2. **Or bypass CDN** — Set `useCdn: false` in client config (use sparingly)
## 4. Visual Editing (Stega) & Clean Data
Visual Editing injects invisible characters into strings to enable click-to-edit.
### A. The Golden Rule of Stega
If a string field controls logic (alignment, colors, IDs), you **must** clean it before comparing.
```typescript
import { stegaClean } from "@sanity/client/stega";
export function Layout({ align }: { align: string }) {
// ❌ Bad: Will fail in Edit Mode due to invisible chars
// if (align === 'center') ...
// ✅ Good: Clean the value first
const cleanAlign = stegaClean(align);
return <div className={cleanAlign === 'center' ? 'mx-auto' : ''} />
}
```
### B. Metadata & SEO (Critical)
**Never** let Stega characters leak into `<head>` tags. Always set `stega: false` for metadata fetching.
```typescript
export async function generateMetadata({ params }) {
const { data } = await sanityFetch({
query: SEO_QUERY,
params: await params,
stega: false, // 👈 Critical for SEO
});
return { title: data?.title };
}
```
### C. Static Params
When generating static params, fetch only published content and disable stega.
```typescript
export async function generateStaticParams() {
const { data } = await sanityFetch({
query: SLUGS_QUERY,
perspective: "published", // 👈 No drafts
stega: false,
});
return data;
}
```
## 5. Setup: Studio (Standalone)
Create the Studio as its own app from the repo root — **not inside the Next.js app folder**, where the CLI would switch to its embedded flow:
```bash
npm create sanity@latest -- --project <projectId> --dataset production --template clean --typescript --output-path studio
```
Run it with `npm run dev` inside `studio/` (defaults to http://localhost:3333). For Visual Editing, point the Presentation Tool's `previewUrl.origin` at the Next.js app (see `visual-editing.md`).
### Migrating an Existing Embedded Studio
Embedded Studios (`<NextStudio />` mounted at a route like `/app/studio/[[...tool]]/page.tsx`) keep working, but migrating to a standalone Studio is recommended:
1. Create a standalone Studio folder as above, reusing your existing `projectId` and dataset.
2. Move `sanity.config.ts`, `sanity.cli.ts`, and your schema types into it.
3. Delete the `/app/studio/[[...tool]]/` route from the Next.js app. Keep `next-sanity` — the app still needs it for fetching, Live Content, and Visual Editing.
4. Add the app's URLs to CORS origins and set the Presentation Tool's `previewUrl.origin` to the app's URL.
## 6. Setup: Draft Mode
Enable Presentation Tool and Visual Editing by setting up a draft mode route.
**`src/app/api/draft-mode/enable/route.ts`:**
```typescript
import { defineEnableDraftMode } from "next-sanity/draft-mode";
import { client } from "@/sanity/lib/client";
import { token } from "@/sanity/lib/token";
// Helper to get token
export const { GET } = defineEnableDraftMode({
client: client.withConfig({ token }),
});
```
## 7. Error Handling
Use `notFound()` for missing documents. Common errors:
| Error | Cause | Solution |
| ------------------ | --------------------- | ---------------------------------- |
| 401 Unauthorized | Invalid/missing token | Check `SANITY_API_READ_TOKEN` |
| 403 Forbidden | CORS not configured | Add URL to CORS origins |
| Query syntax error | Invalid GROQ | Test in Vision plugin first |
| Empty result | Wrong filter/params | Log params, check `_type` spelling |
```typescript
import { notFound } from 'next/navigation'
export default async function PostPage({ params }: Props) {
const { data } = await sanityFetch({ query: POST_QUERY, params: await params })
if (!data) notFound()
return <Post data={data} />
}
```
## 8. Presentation Queries (`usePresentationQuery`)
For faster live editing in the Presentation Tool, use `usePresentationQuery` to fetch only the specific block being edited, rather than re-rendering the entire page.
### Why Use This
- **Without:** Editing a hero title re-fetches the whole page, re-renders all blocks
- **With:** Only the hero block re-fetches and re-renders
This is especially valuable for pages with many Page Builder blocks or complex Portable Text.
### Basic Pattern
```typescript
'use client'
import { usePresentationQuery } from 'next-sanity/hooks'
import { HERO_PRESENTATION_QUERY } from '@/sanity/lib/queries'
type HeroProps = {
_key: string
documentId: string
title: string
subtitle?: string
// ... other initial props from page query
}
export function Hero({ _key, documentId, title, subtitle, ...rest }: HeroProps) {
// Fetch block-specific data for faster updates in Presentation Tool
const { data } = usePresentationQuery({
query: HERO_PRESENTATION_QUERY,
params: { documentId, blockKey: _key },
})
// Use presentation data if available, fallback to initial server props
const blockData = data?.heroBlock || { title, subtitle, ...rest }
return (
<section>
<h1>{blockData.title}</h1>
{blockData.subtitle && <p>{blockData.subtitle}</p>}
</section>
)
}
```
### The Presentation Query
Create a query that targets the specific block by `_key`:
```typescript
// queries.ts
export const HERO_PRESENTATION_QUERY = defineQuery(`
*[_id == $documentId][0]{
_id,
_type,
"heroBlock": pageBuilder[_key == $blockKey && _type == "hero"][0]{
title,
subtitle,
image,
theme,
// Include all fields the component needs
}
}
`);
```
### Passing Document Context
Your PageBuilder component needs to pass `documentId` to each block:
```typescript
export function PageBuilder({ content, documentId }: { content: Block[]; documentId: string }) {
return (
<main>
{content.map((block) => {
switch (block._type) {
case "hero":
return <Hero key={block._key} documentId={documentId} {...block} />
// ... other blocks
}
})}
</main>
)
}
```
### For Portable Text Blocks
The same pattern works for custom blocks inside Portable Text:
```typescript
export const PTE_IMAGE_PRESENTATION_QUERY = defineQuery(`
*[_id == $documentId][0]{
"pteImageBlock": body[_key == $blockKey && _type == "pteImage"][0]{
image,
caption,
alt
}
}
`);
```
**See also:** `visual-editing.md` for the conceptual overview and `page-builder.md` for full Page Builder patterns.
## 9. Pagination Pattern
For listing pages with many entries, use offset-based pagination with a count query.
### Queries
```typescript
// Paginated listing
export const ARTICLES_QUERY = defineQuery(`
*[_type == "article" && defined(slug.current)]
| order(date desc) [$start...$end] {
_id, title, "slug": slug.current, date
}
`);
// Total count for pagination UI
export const ARTICLES_COUNT_QUERY = defineQuery(`
count(*[_type == "article" && defined(slug.current)])
`);
```
### Listing Page
```typescript
const ENTRIES_PER_PAGE = 10;
export default async function BlogPage({
searchParams
}: {
searchParams: Promise<{ page?: string }>
}) {
const { page: pageParam } = await searchParams;
const page = parseInt(pageParam || "1");
const start = (page - 1) * ENTRIES_PER_PAGE;
const end = start + ENTRIES_PER_PAGE;
const [{ data: articles }, { data: total }] = await Promise.all([
sanityFetch({ query: ARTICLES_QUERY, params: { start, end } }),
sanityFetch({ query: ARTICLES_COUNT_QUERY })
]);
const totalPages = Math.ceil(total / ENTRIES_PER_PAGE);
return (
<main>
{articles.map(article => (
<ArticleCard key={article._id} article={article} />
))}
<Pagination current={page} total={totalPages} />
</main>
);
}
```
@@ -1,171 +0,0 @@
---
title: Nuxt & Sanity Integration Rules
description: Integration guide for Nuxt, including @nuxtjs/sanity, visual editing, and data fetching.
---
# Nuxt & Sanity Integration Rules
## 1. Setup & Configuration
### Scaffold a new Nuxt app
```bash
npm create nuxt@latest my-app -- -t ui -M "" --packageManager npm --no-gitInit
cd my-app
```
`-t ui` selects the Nuxt UI starter. `-M ""` skips the interactive module-selection prompt (empty string = no extra modules). `--packageManager npm` and `--no-gitInit` suppress the other two prompts so the scaffold runs end-to-end without input.
### Installation
```bash
npx nuxi@latest module add sanity
```
`nuxi module add sanity` resolves to the official `@nuxtjs/sanity` module and registers it in `nuxt.config.ts` automatically. The module bundles `@sanity/client`, `@sanity/visual-editing`, `@portabletext/vue`, and `groq` as direct dependencies — no separate installs needed.
`groq` and `defineQuery` are also **auto-imported** by the module, so you can use them in `.vue` files without an `import` statement.
For manual image-URL building (an alternative to the auto-registered `<SanityImage>` component), add `@sanity/image-url`:
```bash
npm install @sanity/image-url
```
### What the module auto-imports
**Composables** (use directly in `<script setup>`, no imports needed):
- `useSanity()` — get the client and its config
- `useSanityQuery()` / `useLazySanityQuery()` — reactive query helpers
- `useSanityConfig()` — read the resolved module config
- `useSanityPerspective()`, `useSanityPreviewPerspective()`, `useSanityPreviewEnvironment()` — perspective helpers for drafts/preview
- `useSanityVisualEditingState()`, `useIsSanityLivePreview()`, `useIsSanityPresentationTool()` — visual-editing state helpers
**GROQ helpers** (template tags): `groq`, `defineQuery`
**Components** (use directly in `<template>`):
- `<SanityContent>` — Portable Text renderer (uses `@portabletext/vue` internally; prop is `:value`)
- `<SanityImage>` — image renderer; takes an `assetId` (the image asset's `_ref`); upgrades to `<NuxtImg>` automatically when `@nuxt/image` is installed
- `<SanityFile>` — file renderer
### Configuration (`nuxt.config.ts`)
```typescript
export default defineNuxtConfig({
modules: ["@nuxtjs/sanity"],
sanity: {
projectId: process.env.NUXT_SANITY_PROJECT_ID,
dataset: process.env.NUXT_SANITY_DATASET,
apiVersion: "2026-05-15",
// Live Visual Editing Configuration
visualEditing: {
studioUrl: process.env.NUXT_SANITY_STUDIO_URL,
token: process.env.NUXT_SANITY_API_READ_TOKEN, // Required for fetching drafts
stega: true, // Enable stega for visual editing
mode: "live-visual-editing", // Default: enables live updates
},
},
});
```
**Important:** Don't enable the `minimal` client if you want the full feature set (composables, components, visual editing).
## 2. Data Fetching
### `useSanityQuery`
Use the composable for reactive fetching. It handles preview state automatically when `visualEditing` is configured. `groq` and `defineQuery` are auto-imported — use either.
```vue
<!-- app/pages/posts.vue -->
<script setup lang="ts">
const query = groq`*[_type == "post" && defined(slug.current)]{ _id, title, slug }`
const { data: posts } = await useSanityQuery<Array<{ _id: string; title?: string; slug?: { current?: string } }>>(query)
</script>
<template>
<ul>
<li v-for="post in posts || []" :key="post._id">
<NuxtLink :to="`/${post.slug?.current}`">{{ post.title }}</NuxtLink>
</li>
</ul>
</template>
```
### Dynamic Routes (`[slug].vue`)
Pull the slug off `useRoute()` and pass it as a query parameter. The `<SanityContent>` component renders Portable Text — note the prop is `value`, not `blocks` (renamed in v2).
```vue
<!-- app/pages/[slug].vue -->
<script setup lang="ts">
const route = useRoute()
const query = groq`*[_type == "post" && slug.current == $slug][0]{ _id, title, body }`
const { data: post } = await useSanityQuery<{ _id: string; title?: string; body?: unknown[] }>(
query,
{ slug: route.params.slug }
)
</script>
<template>
<article v-if="post">
<h1>{{ post.title }}</h1>
<SanityContent v-if="post.body" :value="post.body" />
</article>
</template>
```
## 3. Visual Editing (Live Preview)
### Automatic Setup
When `visualEditing` is configured in `nuxt.config.ts`, the module handles:
1. Injecting the Visual Editing overlays.
2. Refreshing data when content changes in the Studio.
3. Enabling Stega encoding.
### Handling Stega in Logic
If you use stega-encoded strings in logic (e.g. `v-if="post.layout === 'full'"`), you must clean them. `stegaClean` is exported from `@sanity/client/stega` (a transitive of `@nuxtjs/sanity`, so no separate install).
```typescript
import { stegaClean } from "@sanity/client/stega";
const layout = computed(() => stegaClean(props.layout));
```
## 4. Components
### Portable Text — `<SanityContent>`
The module auto-registers `<SanityContent>`. Don't install `@portabletext/vue` separately; it's a direct dep of the module.
```vue
<SanityContent :value="post.body" />
```
For custom blocks/marks, pass `:components`:
```vue
<SanityContent :value="post.body" :components="{ block: { h2: MyH2 } }" />
```
### Images — two options
**Option A — `<SanityImage>` (recommended).** Auto-registered. Takes the asset's `_ref` (the `assetId`) and builds the URL via the module's resolved projectId/dataset. If `@nuxt/image` is installed, it transparently upgrades to `<NuxtImg>` for responsive sizing.
```vue
<SanityImage :asset-id="post.mainImage.asset._ref" width="800" />
```
**Option B — `@sanity/image-url` builder.** Install `@sanity/image-url` separately and build URLs manually. Useful when you need fine-grained control (hotspot/crop, format negotiation, srcset).
```typescript
import imageUrlBuilder from "@sanity/image-url";
const builder = imageUrlBuilder(useSanity().client);
// builder.image(source).width(800).url()
```
@@ -1,329 +0,0 @@
---
title: "Sanity Page Builder Patterns"
description: Patterns for Sanity Page Builder arrays, block components, and live editing.
---
# Sanity Page Builder Patterns
This guide covers **Page Builder** patterns—arrays of block objects that allow content teams to compose flexible page layouts. For Portable Text (rich text within documents), see `portable-text.md`.
## 1. What is a Page Builder?
A page builder is an **array of objects** (`pageBuilder[]`) that allows content teams to compose pages from reusable blocks without developer intervention.
**When to use:**
- Flexible layouts needed (marketing pages, landing pages)
- Content can be reordered
- Different components on different pages
**When NOT to use:**
- Rigid, formulaic content (blog posts, product pages)
- Highly structured data that doesn't change layout
- Rich text within a document body—use Portable Text instead
## 2. Schema Organization
### Directory Structure
```
schemaTypes/
├── blocks/ # Page builder blocks (objects)
│ ├── heroType.ts
│ ├── featuresType.ts
│ └── faqsType.ts
├── pageBuilderType.ts # The array definition
└── pageType.ts # Document using the page builder
```
### Objects vs References
| Use **Objects** | Use **References** |
| ------------------------------ | -------------------------------- |
| Content is unique to this page | Content reused across many pages |
| Simpler queries | Needs central management |
| Default choice | FAQs, CTAs, testimonials |
**Rule:** Use references sparingly. Most blocks should be objects.
### Page Builder Array
```typescript
// pageBuilderType.ts
import { defineArrayMember, defineType } from "sanity";
export const pageBuilderType = defineType({
name: "pageBuilder",
type: "array",
of: [
defineArrayMember({ type: "hero" }),
defineArrayMember({ type: "splitImage" }),
defineArrayMember({ type: "features" }),
defineArrayMember({ type: "faqs" }),
],
options: {
insertMenu: {
views: [
// Optional: Show visual thumbnails in the insert menu grid
{
name: "grid",
previewImageUrl: (type) => `/block-previews/${type}.png`,
},
],
},
},
});
```
### Block Preview Pattern
Every block should have consistent previews:
```typescript
import { BlockContentIcon } from "@sanity/icons";
import { defineType } from "sanity";
export const splitImageType = defineType({
name: "splitImage",
type: "object",
icon: BlockContentIcon,
fields: [
/* ... */
],
preview: {
select: { title: "title", media: "image" },
prepare({ title, media }) {
return {
title: title || "Untitled",
subtitle: "Split Image", // Block type name
media: media ?? BlockContentIcon, // Fallback to icon
};
},
},
});
```
## 3. Querying Page Builders
Expand references only for blocks that need them:
```groq
*[_type == "page" && slug.current == $slug][0]{
...,
content[]{
...,
_type == "faqs" => {
...,
faqs[]-> // Expand only FAQ references
}
}
}
```
## 4. Rendering Page Builders
### TypeScript Typing
Use `Extract` to type individual blocks from the query result:
```typescript
import { PAGE_QUERYResult } from "@/sanity/types";
type HeroProps = Extract<
NonNullable<NonNullable<PAGE_QUERYResult>["content"]>[number],
{ _type: "hero" }
>;
export function Hero({ title, image }: HeroProps) {
// Fully typed!
}
```
### Switch-Based Rendering
```typescript
export function PageBuilder({ content }: { content: Block[] }) {
if (!Array.isArray(content)) return null;
return (
<main>
{content.map((block) => {
switch (block._type) {
case "hero":
return <Hero key={block._key} {...block} />;
case "features":
return <Features key={block._key} {...block} />;
case "splitImage":
return <SplitImage key={block._key} {...block} />;
default:
return <div key={block._key}>Unknown: {block._type}</div>;
}
})}
</main>
);
}
```
**Always use `_key` for React keys:**
```typescript
// Breaks Visual Editing and causes hydration issues
{items.map((item, i) => <Component key={i} {...item} />)}
// Always use Sanity's _key
{items.map((item) => <Component key={item._key} {...item} />)}
```
### Cleaning Values for Logic
Use `stegaClean` when block fields control rendering logic:
```typescript
import { stegaClean } from "next-sanity";
function SplitImage({ orientation, title, image }) {
return (
<section data-orientation={stegaClean(orientation) || "imageLeft"}>
{/* ... */}
</section>
);
}
```
## 5. Presentation Queries for Live Editing (Next.js)
For faster live updates in the Presentation Tool, use **presentation queries** that fetch only the specific block being edited, rather than re-fetching the entire page.
> **Note:** This pattern uses `usePresentationQuery` from `next-sanity/hooks`. For other frameworks, check your loader package for equivalent functionality.
### The Pattern
1. **Create a block-specific presentation query:**
```typescript
// queries.ts
export const HERO_PRESENTATION_QUERY = defineQuery(`
*[_id == $documentId][0]{
_id,
_type,
"heroBlock": pageBuilder[_key == $blockKey && _type == "hero"][0]{
title,
subtitle,
image,
// ... all fields the component needs
}
}
`);
```
2. **Use `usePresentationQuery` in your component:**
```typescript
'use client'
import { usePresentationQuery } from 'next-sanity/hooks'
import { HERO_PRESENTATION_QUERY } from '@/sanity/lib/queries'
type HeroProps = {
_key: string
documentId: string
// ... initial props from page query
}
export function Hero({ _key, documentId, ...initialProps }: HeroProps) {
// Fetch block-specific data for faster updates
const { data } = usePresentationQuery({
query: HERO_PRESENTATION_QUERY,
params: { documentId, blockKey: _key },
})
// Use presentation data if available, fallback to initial props
const blockData = data?.heroBlock || initialProps
return (
<section>
<h1>{blockData.title}</h1>
{/* ... */}
</section>
)
}
```
### Why This Is Faster
- **Without:** Editing a field triggers a full page re-render with all blocks
- **With:** Only the specific block re-renders with its targeted query
This pattern is especially valuable for pages with many blocks or complex nested data.
**Note:** See `nextjs.md` for more details on `usePresentationQuery` and `visual-editing.md` for the conceptual overview.
## 6. Page Builder Pitfalls
| Pitfall | Solution |
| ------------------------- | ------------------------------------------------------------ |
| Too many block variations | Split into separate blocks if >2 variants |
| Paradox of choice | Limit blocks per document type |
| Overusing references | Default to objects; references only for truly shared content |
| Unused blocks accumulate | Prune regularly; see deprecation patterns |
| Inconsistent previews | Always set title, subtitle (block name), and media/icon |
## 7. Component Alignment Pattern
Map Sanity "alignment" fields (usually string/select) to CSS classes using utility functions.
**Schema:**
```typescript
defineField({
name: "align",
type: "string",
options: { list: ["left", "center", "right"], layout: "radio" },
});
```
**Implementation (Utility):**
```typescript
import { stegaClean } from "@sanity/client/stega";
export function getTextAlign(align?: string) {
// CLEAN the value before switching!
switch (stegaClean(align)) {
case "left":
return "text-left";
case "right":
return "text-right";
default:
return "text-center";
}
}
```
## 8. Semantic Heading Levels
**Rule:** Do NOT store heading levels (h1, h2) in Sanity schema options. Determine them dynamically in the frontend to ensure accessibility.
**Bad Schema:**
```typescript
// Don't do this
{ name: 'level', type: 'string', options: { list: ['h1', 'h2'] } }
```
**Good Component:**
Pass a `semanticLevel` prop based on the component's context/nesting.
```typescript
type Props = {
block: HeroBlock;
level?: 'h1' | 'h2' | 'h3'; // Default to h2 if undefined
}
export default function Section({ block, level = 'h2' }: Props) {
const Tag = level;
return <Tag>{block.title}</Tag>;
}
```
_Note: For Image patterns, see `image.md`. For Portable Text patterns, see `portable-text.md`._
@@ -1,384 +0,0 @@
---
title: "Sanity Portable Text Rules"
description: Portable Text (Rich Text) rendering and custom component creation for React/Next.js.
---
# Sanity Portable Text Rules
Portable Text is Sanity's rich text format, used for content like article bodies (`body[]`). This guide covers rendering and creating custom PTE components.
**Note:** For page-level layout blocks (`pageBuilder[]`), see `page-builder.md`.
## 1. The Component
Use the `PortableText` component from `next-sanity` (or `@portabletext/react`).
```typescript
import { PortableText } from "next-sanity";
// or import { PortableText } from "@portabletext/react";
export function Content({ value }: { value: any }) {
return <PortableText value={value} components={components} />;
}
```
## 2. Custom Components (`components` prop)
**Always** define a typed components object to handle custom blocks, marks, and list styles.
```typescript
import { PortableTextComponents } from "next-sanity";
const components: PortableTextComponents = {
// 1. Block styles (paragraphs, headings)
block: {
h1: ({ children }) => <h1 className="text-4xl font-bold">{children}</h1>,
h2: ({ children }) => <h2 className="text-3xl font-bold">{children}</h2>,
blockquote: ({ children }) => <blockquote className="border-l-4 pl-4">{children}</blockquote>,
},
// 2. Custom types (non-text blocks like images, videos)
types: {
image: ({ value }) => <SanityImage value={value} />,
callToAction: ({ value }) => <Button href={value.url}>{value.text}</Button>,
},
// 3. Marks (inline decorators and annotations)
marks: {
strong: ({ children }) => <strong className="font-bold">{children}</strong>,
em: ({ children }) => <em className="italic">{children}</em>,
link: ({ children, value }) => {
const rel = !value.href.startsWith("/") ? "noreferrer noopener" : undefined;
return <a href={value.href} rel={rel} className="underline text-blue-600">{children}</a>;
},
},
// 4. Lists
list: {
bullet: ({ children }) => <ul className="list-disc ml-4">{children}</ul>,
number: ({ children }) => <ol className="list-decimal ml-4">{children}</ol>,
},
};
```
## 3. Component Categories
Portable Text has three types of custom components, each with different patterns:
| Type | Examples | Pattern |
| ---------------- | -------------------------- | --------------------------------- |
| **Block styles** | h1, h2, blockquote, normal | Text blocks with `children` prop |
| **Custom types** | image, video, callToAction | Non-text blocks with `value` prop |
| **Marks** | link, strong, productRef | Inline annotations wrapping text |
## 4. Creating Block Style Components
Block styles are text blocks like headings and paragraphs. For simple styling, inline components work fine:
```typescript
block: {
h2: ({ children }) => <h2 className="mt-8 mb-4 text-3xl font-bold">{children}</h2>,
normal: ({ children }) => <p className="mb-4 leading-relaxed">{children}</p>,
}
```
### With Visual Editing Support
For live editing in the Presentation Tool, block style components may need **both** a client and server version:
```typescript
// Heading2.tsx (Server - simple SSR for production)
export function Heading2({ children }: { children: React.ReactNode }) {
return <h2 className="mt-8 mb-4 text-3xl font-bold">{children}</h2>;
}
// Heading2Client.tsx (Client - for visual editing context)
'use client'
export function Heading2Client({ children, value }: { children: React.ReactNode; value: any }) {
// Can access block data via `value` for advanced patterns
return <h2 className="mt-8 mb-4 text-3xl font-bold">{children}</h2>;
}
```
Use `useIsPresentationTool` to conditionally render the client version:
```typescript
import { useIsPresentationTool } from 'next-sanity/hooks'
function Heading2Wrapper(props) {
const isPresentationTool = useIsPresentationTool()
if (isPresentationTool) {
return <Heading2Client {...props} />
}
return <Heading2 {...props} />
}
```
## 5. Creating Custom Type Components
Custom types are non-text blocks like images, videos, or CTAs embedded in rich text.
### Schema Definition
```typescript
// schemaTypes/blocks/pteImageBlock.ts
import { defineField, defineType } from "sanity";
export const pteImageBlock = defineType({
name: "pteImage",
title: "Image",
type: "object",
fields: [
defineField({ name: "image", type: "image", options: { hotspot: true } }),
defineField({ name: "caption", type: "string" }),
defineField({
name: "alt",
type: "string",
validation: (r) => r.required(),
}),
],
preview: {
select: { title: "caption", media: "image" },
},
});
```
### Register in Body Schema
```typescript
defineField({
name: "body",
type: "array",
of: [
{ type: "block" }, // Standard text
{ type: "pteImage" }, // Custom image block
{ type: "pteVideo" }, // Custom video block
],
});
```
### Frontend Component
```typescript
// PteImageComponent.tsx
'use client'
type PteImageProps = {
value: {
_key: string
image: any
caption?: string
alt: string
}
}
export function PteImageComponent({ value }: PteImageProps) {
if (!value.image) return null
return (
<figure className="my-8">
<SanityImage value={value.image} alt={value.alt} />
{value.caption && (
<figcaption className="text-sm text-gray-600 mt-2">{value.caption}</figcaption>
)}
</figure>
)
}
// Register in components
const components: PortableTextComponents = {
types: {
pteImage: PteImageComponent,
},
}
```
## 6. Creating Mark Components
Marks are inline annotations that wrap text—links, highlights, or custom references.
### Schema Definition (Annotation)
```typescript
// In your block configuration
defineField({
name: "body",
type: "array",
of: [
{
type: "block",
marks: {
decorators: [
{ title: "Strong", value: "strong" },
{ title: "Emphasis", value: "em" },
{ title: "Highlight", value: "highlight" },
],
annotations: [
{
name: "link",
type: "object",
title: "Link",
fields: [
{ name: "href", type: "url", title: "URL" },
{
name: "openInNewTab",
type: "boolean",
title: "Open in new tab",
},
],
},
{
name: "productRef",
type: "object",
title: "Product Reference",
fields: [
{ name: "product", type: "reference", to: [{ type: "product" }] },
],
},
],
},
},
],
});
```
### Frontend Component
```typescript
// LinkMark.tsx
type LinkMarkProps = {
children: React.ReactNode
value: {
href: string
openInNewTab?: boolean
}
}
export function LinkMark({ children, value }: LinkMarkProps) {
const { href, openInNewTab } = value
const target = openInNewTab ? '_blank' : undefined
const rel = openInNewTab ? 'noopener noreferrer' : undefined
return (
<a href={href} target={target} rel={rel} className="text-blue-600 underline">
{children}
</a>
)
}
// Register in components
const components: PortableTextComponents = {
marks: {
link: LinkMark,
highlight: ({ children }) => <mark className="bg-yellow-200">{children}</mark>,
},
}
```
## 7. Presentation Queries for PTE Blocks
For faster live editing of custom PTE blocks, use presentation queries that fetch only the specific block:
```typescript
// queries.ts
export const PTE_IMAGE_PRESENTATION_QUERY = defineQuery(`
*[_id == $documentId][0]{
_id,
_type,
"pteImageBlock": body[_key == $blockKey && _type == "pteImage"][0]{
_key,
image,
caption,
alt
}
}
`);
```
Then in your component:
```typescript
"use client";
import { usePresentationQuery } from "next-sanity/hooks";
export function PteImageComponent({
value,
documentId,
}: {
value: any;
documentId?: string;
}) {
const { data } = usePresentationQuery({
query: PTE_IMAGE_PRESENTATION_QUERY,
params: { documentId, blockKey: value._key },
});
const blockData = data?.pteImageBlock || value;
// ... render with blockData
}
```
**Note:** You'll need to pass `documentId` through to your PTE components. See `visual-editing.md` for context patterns.
## 8. GROQ Fragment for PTE
When querying documents with Portable Text, expand custom blocks:
```groq
*[_type == "article" && slug.current == $slug][0]{
...,
body[]{
...,
_type == "pteImage" => {
...,
"imageUrl": image.asset->url
},
_type == "pteVideo" => {
...,
video->{ title, url }
}
}
}
```
## 9. Stega and Visual Editing
When Visual Editing is enabled, text content contains invisible stega characters for click-to-edit functionality.
**For text rendering:** Let stega characters pass through—they enable overlays:
```typescript
// Good - stega preserved for click-to-edit
<h2>{children}</h2>
```
**For logic/comparisons:** Clean the values first:
```typescript
import { stegaClean } from '@sanity/client/stega'
// Clean before using in logic
const cleanedStyle = stegaClean(block.style)
if (cleanedStyle === 'h2') { ... }
```
## 10. Type Safety
When using TypeGen, the Portable Text value usually has a complex generated type. You can often use `any` or `PortableTextBlock[]` for the _prop_, but cast specific blocks if needed.
```typescript
import { PortableTextBlock } from "next-sanity";
type Props = {
value: PortableTextBlock[];
};
```
## 11. Best Practices
- **Tailwind Typography:** For simple blogs, wrap `<PortableText />` in a `<div className="prose">` (from `@tailwindcss/typography`) instead of manually styling every block.
- **Handling Nulls:** Always check if `value` exists and is an array before rendering.
- **Keys:** The `PortableText` component handles React keys automatically using the `_key` from Sanity. Do not add keys manually.
- **Separate from Page Builder:** PTE blocks live in `body[]` (rich text fields), not `pageBuilder[]` (page layout). Keep these patterns separate.
@@ -1,98 +0,0 @@
---
title: Sanity Project Structure
description: Project structure patterns for Sanity projects including standalone Studio and monorepo setups.
---
# Sanity Project Structure
## Standalone Studio
Best for content-only projects, API-first architectures, or when frontend is managed separately.
```
your-project/
├── schemaTypes/
│ ├── index.ts
│ ├── documents/
│ ├── objects/
│ └── blocks/
├── sanity.config.ts
├── sanity.cli.ts
└── package.json
```
**Use cases:**
- Content modeling with MCP/AI tools (no frontend needed)
- Headless CMS with external consumers
- Prototyping and content design
## Monorepo (Recommended with a frontend)
Best for most projects pairing Sanity with a Next.js (or other framework) app. The Studio stays standalone — Vite-based dev/builds, auto-updates, TypeGen watch mode — while living in the same repo as the frontend.
```
your-project/
├── studio/ # Sanity Studio (standalone)
│ ├── schemaTypes/
│ │ ├── index.ts
│ │ ├── documents/
│ │ ├── objects/
│ │ └── blocks/
│ ├── sanity.config.ts
│ ├── sanity.cli.ts # CLI + TypeGen configuration
│ └── package.json
└── web/ # Next.js (or other framework)
├── src/
│ ├── app/
│ └── sanity/
│ ├── client.ts
│ ├── live.ts # defineLive setup
│ └── queries.ts
├── sanity.types.ts # Generated types (from TypeGen)
└── package.json
```
No workspace tooling is required — each app manages its own dependencies. For larger repos, the same shape works under `apps/` with npm or pnpm workspaces.
**Setup:**
1. Add the web app URL to CORS origins: `npx sanity cors add http://localhost:3000 --credentials` (or via [Sanity Manage](https://www.sanity.io/manage))
2. Configure `typegen` in `studio/sanity.cli.ts` to read queries from `../web` and output types to `../web/sanity.types.ts` (see `typegen.md`)
3. Optionally add a root `package.json` with scripts that run both dev servers
## Embedded Studio (Legacy — Not Recommended)
Older Next.js projects may mount the Studio inside the app at `src/app/studio/[[...tool]]/page.tsx`, with `sanity.config.ts` in the app root. This still works but is no longer recommended: it slows builds, ties Studio updates to app deploys, and rules out auto-updates and TypeGen watch mode. See `nextjs.md` for the rationale and migration steps.
## File Naming Conventions
- **kebab-case** for all files: `user-profile.ts`, `hero-block.ts`
- `.ts` for schemas/utilities, `.tsx` for React components
- Each schema exports a named const matching filename
## Schema Directory Structure
```
schemaTypes/
├── index.ts # Exports all types
├── documents/ # Standalone content types
│ ├── post.ts
│ └── author.ts
├── objects/ # Embeddable/reusable types
│ ├── seo.ts
│ └── link.ts
├── blocks/ # Portable Text blocks
│ ├── hero.ts
│ └── callout.ts
└── shared/ # Shared field definitions
└── seoFields.ts
```
## Key Files
| File | Purpose |
| ------------------ | ------------------------------------------------------- |
| `sanity.config.ts` | Studio configuration (plugins, schema, structure) |
| `sanity.cli.ts` | CLI configuration (project ID, dataset, TypeGen config) |
| `structure.ts` | Custom desk structure |
@@ -1,276 +0,0 @@
---
title: React Router (Remix) & Sanity Integration Rules
description: Integration guide for React Router v7 (and Remix v2) with Sanity, including loaders and visual editing.
---
# React Router (Remix) & Sanity Integration Rules
## Version Note
The primary examples below use **React Router v7** (the current shape — Remix v2 was renamed to React Router v7 starting with the v7 release). Import paths and the route-types file (`./+types/<route>`) come from the `react-router` package and the framework's typegen.
If you are on the older **Remix v2** stack, the integration shape is identical; only the import paths differ:
| React Router v7 | Remix v2 |
| ----------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `react-router` | `@remix-run/node` / `@remix-run/react` |
| `import type { Route } from "./+types/<route>"` | `import type { LoaderFunctionArgs } from "@remix-run/node"` + `useLoaderData<typeof loader>()` |
| `react-router.config.ts` | `remix.config.js` |
## 1. Setup & Client Pattern
### Scaffold a new React Router v7 app
```bash
npx create-react-router@latest my-app -y
cd my-app
npm install @sanity/client @sanity/react-loader @sanity/visual-editing @portabletext/react groq
```
`-y` accepts defaults. The Sanity packages cover server loaders (`@sanity/react-loader`, `@sanity/client`), live preview (`@sanity/visual-editing`), Portable Text rendering (`@portabletext/react`), and typed queries (`groq`).
To support both server-side fetching and client-side live previews, use the **Split Loader Pattern**.
### A. Environment Variables
React Router runs on Vite. **Any module reachable from a route component gets bundled into the client** — `process.env` doesn't exist there and will throw `ReferenceError: process is not defined` on client-side route transitions (SSR will still work, which makes this trap easy to miss).
Split publishable values from secrets:
- **Publishable** (`projectId`, `dataset`, `apiVersion`, `studioUrl`): prefix with `VITE_` and read via `import.meta.env`. Safe to import from anywhere.
- **Secrets** (read tokens, webhook secrets): keep unprefixed and read via `process.env` **only inside `*.server.ts` files**. Never re-export them from a shared module.
`.env`:
```
VITE_SANITY_PROJECT_ID=your-project-id
VITE_SANITY_DATASET=production
VITE_SANITY_API_VERSION=2026-02-01
VITE_SANITY_STUDIO_URL=http://localhost:3333
SANITY_API_READ_TOKEN=your-read-token
```
`app/sanity/env.ts` — browser-safe, publishable values only:
```typescript
export const projectId = import.meta.env.VITE_SANITY_PROJECT_ID!;
export const dataset = import.meta.env.VITE_SANITY_DATASET!;
export const apiVersion =
import.meta.env.VITE_SANITY_API_VERSION ?? "2026-02-01";
export const studioUrl = import.meta.env.VITE_SANITY_STUDIO_URL;
```
### B. Shared Loader (`app/sanity/loader.ts`)
Defines the store config (SSR enabled, client deferred).
```typescript
import { createQueryStore } from "@sanity/react-loader";
export const { loadQuery, setServerClient, useQuery, useLiveMode } =
createQueryStore({ client: false, ssr: true });
```
### C. Server Loader (`app/sanity/loader.server.ts`)
Initializes the server client. Read the token directly from `process.env` here — do **not** import it from `env.ts`, or it will leak into the client bundle the moment any client-reachable module touches `env.ts`.
```typescript
import { createClient } from "@sanity/client";
import { apiVersion, dataset, projectId, studioUrl } from "./env";
import { loadQuery, setServerClient } from "./loader";
const client = createClient({
projectId,
dataset,
apiVersion,
useCdn: true,
token: process.env.SANITY_API_READ_TOKEN,
stega: {
// Stega encodes invisible markers into string fields for click-to-edit
// overlays in the Presentation tool. Those markers can leak into copy/paste,
// screen readers, and some downstream renderers, so only enable when actually
// previewing — gate on an env var that's only set in preview environments.
enabled: Boolean(studioUrl),
studioUrl,
},
});
setServerClient(client);
export { loadQuery };
```
### D. Browser-safe Client + Image URL Builder (`app/sanity/client.ts`, `app/sanity/image.ts`)
Anything used by a route component runs in the browser too. Build a separate publishable-only client for things like the image URL builder:
```typescript
// app/sanity/client.ts
import { createClient } from "@sanity/client";
import { apiVersion, dataset, projectId } from "./env";
export const client = createClient({
projectId,
dataset,
apiVersion,
useCdn: true,
});
```
```typescript
// app/sanity/image.ts
import imageUrlBuilder from "@sanity/image-url";
import { client } from "./client";
const builder = imageUrlBuilder(client);
export const urlFor = (source: Parameters<typeof builder.image>[0]) =>
builder.image(source);
```
Install `@sanity/image-url` if you'll render images:
```bash
npm install @sanity/image-url
```
### E. Queries (`app/sanity/queries.ts`)
Keep query definitions in one place so route loaders, components, and TypeGen all read the same source.
```typescript
import { defineQuery } from "groq";
export const POSTS_QUERY = defineQuery(
`*[_type == "post" && defined(slug.current)] | order(_createdAt desc){
_id, title, slug
}`,
);
export const POST_QUERY = defineQuery(
`*[_type == "post" && slug.current == $slug][0]{
_id, title, body, image
}`,
);
```
## 2. Data Fetching (Loaders)
Use `loadQuery` from your **server** file in route loaders. Import the generated `Route` type from `./+types/<route>` — React Router writes one type module per route file.
```typescript
// app/routes/home.tsx
import { loadQuery } from "~/sanity/loader.server";
import { POSTS_QUERY } from "~/sanity/queries";
import type { Route } from "./+types/home";
export async function loader() {
const initial = await loadQuery(POSTS_QUERY, {});
return { initial, query: POSTS_QUERY, params: {} };
}
export default function Home({ loaderData }: Route.ComponentProps) {
const { initial } = loaderData;
// …pass to component
}
```
For Remix v2: replace `Route.ComponentProps` / `Route.LoaderArgs` with `useLoaderData<typeof loader>()` and `LoaderFunctionArgs` from `@remix-run/node`.
## 3. Dynamic Routes (`:slug`)
Register the dynamic route in `app/routes.ts`:
```typescript
import { type RouteConfig, index, route } from "@react-router/dev/routes";
export default [
index("routes/home.tsx"),
route(":slug", "routes/post.tsx"),
] satisfies RouteConfig;
```
Then in `app/routes/post.tsx`:
```typescript
import type { Route } from "./+types/post";
import { PortableText } from "@portabletext/react";
import { loadQuery } from "~/sanity/loader.server";
import { useQuery } from "~/sanity/loader";
import { urlFor } from "~/sanity/image";
import { POST_QUERY } from "~/sanity/queries";
export async function loader({ params }: Route.LoaderArgs) {
const initial = await loadQuery(POST_QUERY, { slug: params.slug });
return { initial, query: POST_QUERY, params: { slug: params.slug } };
}
export default function Post({ loaderData }: Route.ComponentProps) {
const { initial, query, params } = loaderData;
const { data: post } = useQuery(query, params, { initial });
return (
<article>
<h1>{post?.title}</h1>
{post?.image && (
<img src={urlFor(post.image).width(1200).url()} alt={post.title ?? ""} />
)}
{post?.body && <PortableText value={post.body} />}
</article>
);
}
```
This route is the canonical shape that exposes the env trap: `urlFor` → `client.ts` → `env.ts`. If `env.ts` reads `process.env`, the route works under SSR (curl returns HTML) but the client-side `<Link>` navigation will throw `ReferenceError: process is not defined` in the browser console and React Router will hard-reload back to `/`.
## 4. Real-time Preview & Visual Editing
### A. Use `useQuery` in Components
Import `useQuery` from your **shared** loader file.
```typescript
import { useQuery } from "~/sanity/loader";
export default function Page({ loaderData }: Route.ComponentProps) {
const { initial, query, params } = loaderData;
const { data, encodeDataAttribute } = useQuery(query, params, { initial });
return (
<h1 data-sanity={encodeDataAttribute("title")}>
{data?.title}
</h1>
);
}
```
### B. Enable Live Mode (`VisualEditing.tsx`)
Create a component to handle the connection.
```typescript
import { enableVisualEditing } from "@sanity/visual-editing";
// Your browser-safe client
import { useEffect } from "react";
import { client } from "~/sanity/client";
import { useLiveMode } from "~/sanity/loader";
export default function VisualEditing() {
useEffect(() => enableVisualEditing(), []);
useLiveMode({ client });
return null;
}
```
Render this component in `root.tsx` only when valid (e.g., check env vars or user session).
## 5. Stega Cleaning
When using data for logic (routing, classNames), use `stegaClean`.
```typescript
import { stegaClean } from "@sanity/client/stega"
// ...
if (stegaClean(slug) === 'home') { ... }
```
@@ -1,445 +0,0 @@
---
title: Sanity Schema Best Practices
description: Rules for defining Sanity Content Models (Schemas), including field definitions, strict typing, and validation patterns.
---
# Sanity Schema Best Practices
Use this contents list to jump to the schema design decision you are making.
## Table of Contents
- Core philosophy: data over presentation
- Strict definition syntax
- Shared fields pattern
- Field patterns
- References vs nested objects
- Document creation and IDs
- Safe schema updates
- Validation patterns
## 1. Core Philosophy: Data > Presentation
Model **what things are**, not **what they look like**.
- ❌ **Bad:** `bigHeroText`, `redButton`, `threeColumnRow`, `color`, `fontSize`
- ✅ **Good:** `heroStatement`, `callToAction`, `featuresSection`, `status`, `role`
**The test:** "If we redesigned the site, would this field name still make sense?"
- `threeColumnLayout` → ❌ Fails (what if we go to 2 columns?)
- `features` → ✅ Passes (features are features regardless of layout)
## 2. Strict Definition Syntax
Always use the helper functions from `sanity` for type safety and autocompletion.
- **ALWAYS** use `defineType` for the root export.
- **ALWAYS** use `defineField` for fields.
- **ALWAYS** use `defineArrayMember` for items inside arrays.
```typescript
import { TagIcon } from "@sanity/icons";
import { defineArrayMember, defineField, defineType } from "sanity";
export const article = defineType({
name: "article",
title: "Article",
type: "document",
icon: TagIcon,
fields: [
defineField({
name: "title",
type: "string",
validation: (rule) => rule.required(),
}),
defineField({
name: "tags",
type: "array",
of: [
// ALWAYS use defineArrayMember for array items
defineArrayMember({ type: "reference", to: [{ type: "tag" }] }),
],
}),
],
});
```
## 3. Shared Fields Pattern
Export arrays of fields to reuse common patterns (e.g., SEO, standard page headers).
```typescript
// src/schemaTypes/shared/seoFields.ts
export const seoFields = [
defineField({ name: "seoTitle", type: "string", title: "SEO Title" }),
defineField({ name: "seoDesc", type: "text", title: "SEO Description" }),
];
// Usage
defineType({
name: "page",
fields: [
defineField({ name: "title", type: "string" }),
...seoFields, // Spread shared fields
],
});
```
## 4. Field Patterns
### A. Array Keys (`_key`)
Every item in a Sanity array automatically gets a `_key` property. This is **critical** for:
- React reconciliation (use as `key` prop)
- Visual Editing overlays (click-to-edit)
- Portable Text rendering
**Schema:** Sanity auto-generates `_key` for array items. You don't define it.
**Frontend:** Always use `_key` as React's `key`:
```typescript
// ✅ Correct
{items.map((item) => <Component key={item._key} {...item} />)}
// ❌ Wrong - index keys break Visual Editing
{items.map((item, i) => <Component key={i} {...item} />)}
```
**Querying:** Always include `_key` in array projections:
```groq
*[_type == "page"][0]{
pageBuilder[]{
_key, // Always include _key in queries
_type,
...
}
}
```
### B. Icons
Always assign an icon from `@sanity/icons` to documents and objects. This improves the Studio UX significantly. Browse all icons at [icons.sanity.build](https://icons.sanity.build/all).
| Content Type | Icon |
| -------------- | ------------------ |
| Article, Post | `DocumentTextIcon` |
| Author, Person | `UserIcon` |
| Category, Tag | `TagIcon` |
| Settings | `CogIcon` |
| Page | `DocumentIcon` |
| Image block | `ImageIcon` |
| Video block | `PlayIcon` |
| FAQ | `HelpCircleIcon` |
| Link | `LinkIcon` |
### C. Boolean vs. List
Avoid boolean fields for binary states that might expand later.
- **Prefer:** `options.list` with "radio" layout.
```typescript
defineField({
name: "status",
type: "string",
options: {
list: [
{ title: "Draft", value: "draft" },
{ title: "Published", value: "published" },
],
layout: "radio",
},
});
```
### D. The "Toggle" Pattern (Conditional Fields)
Use a radio/boolean field to toggle visibility of other fields (often grouped in fieldsets).
```typescript
(defineField({
name: "linkType",
type: "string",
options: { list: ["internal", "external"], layout: "radio" },
}),
defineField({
name: "internalLink",
type: "reference",
hidden: ({ parent }) => parent?.linkType !== "internal",
}),
defineField({
name: "externalUrl",
type: "url",
hidden: ({ parent }) => parent?.linkType !== "external",
}));
```
## 5. References vs Nested Objects
A **critical modeling decision**: when to use `reference` vs embedding an `object`.
### Use References When:
- Content is **reusable** across documents (authors, categories, products)
- Content needs its **own editing interface** in Studio
- You need to query/filter by the related content independently
- Multiple documents should share the **same instance** (update once, reflect everywhere)
```typescript
// ✅ Author is reusable and independently editable
defineField({
name: "author",
type: "reference",
to: [{ type: "author" }],
});
```
### Use Nested Objects When:
- Content is **specific to this document** (not shared)
- Content doesn't make sense on its own (address, SEO metadata)
- You want **simpler editing** (all fields in one place)
- You need the data to be **copied** not linked
```typescript
// ✅ SEO is document-specific, not shared
defineField({
name: "seo",
type: "object",
fields: [
defineField({ name: "title", type: "string" }),
defineField({ name: "description", type: "text" }),
],
});
```
### Quick Decision Matrix
| Scenario | Use |
| ------------------------- | ------------------------------------- |
| Blog post author | `reference` (reusable) |
| Product category | `reference` (shared taxonomy) |
| Page SEO fields | `object` (page-specific) |
| Hero section content | `object` (page-specific) |
| Team member on About page | `reference` (might be used elsewhere) |
| Call-to-action button | `object` (usually page-specific) |
### Querying Differences
```groq
// Reference requires expansion
*[_type == "post"]{ author->{ name, bio } }
// Object is already inline
*[_type == "post"]{ seo { title, description } }
```
## 6. Document Creation and IDs
Sanity document `_id` values are implementation identifiers, not a content modeling tool.
- **Prefer generated IDs:** Let Sanity assign `_id` values for ordinary content documents. Avoid deterministic UUIDs, slug-derived IDs, and IDs copied from legacy systems.
- **Use relationships, not ID conventions:** Connect documents with `reference` fields and set `_ref` from an actual lookup or from the `_id` returned after creating the related document.
- **Store source identity as content:** For imports, put legacy IDs, external IDs, or stable slugs in explicit fields such as `legacyId`, `externalId`, or `slug`, then query by those fields when you need to find or upsert content.
- **Keep explicit IDs rare:** Directly setting `_id` is mainly useful for singleton documents managed through Studio Structure, such as `settings` or localized singletons like `homePage-en`.
```typescript
// ✅ Correct - relationship comes from a lookup
import { defineQuery } from "groq";
const AUTHOR_BY_EXTERNAL_ID_QUERY = defineQuery(`
*[_type == "author" && externalId == $externalId][0]{_id}
`);
const author = await client.fetch(AUTHOR_BY_EXTERNAL_ID_QUERY, {
externalId: post.authorId,
});
if (!author?._id) throw new Error(`Missing author for ${post.authorId}`);
await client.create({
_type: "post",
title: post.title,
slug: { _type: "slug", current: post.slug },
legacyId: post.id,
author: { _type: "reference", _ref: author._id },
});
// ❌ Wrong - IDs encode relationships and source data
await client.createOrReplace({
_id: `post-${post.id}`,
_type: "post",
author: { _type: "reference", _ref: `author-${post.authorId}` },
});
```
## 7. Safe Schema Updates (The Deprecation Pattern)
**NEVER** delete a field that contains production data. It will cause data loss or Studio crashes. Instead, follow the **ReadOnly -> Hidden -> Deprecated** lifecycle.
### The Pattern
1. **`deprecated`**: Adds a visual warning and reason.
2. **`readOnly: true`**: Prevents new edits but keeps data visible.
3. **`hidden`**: Hides it from _new_ documents (where value is undefined).
4. **`initialValue: undefined`**: Ensures new documents don't get this field.
```typescript
defineField({
name: "oldTitle", // The field you want to remove
title: "Article Title (Deprecated)",
type: "string",
deprecated: {
reason: 'Use the new "seoTitle" field instead. This will be removed in v2.',
},
readOnly: true,
hidden: ({ value }) => value === undefined,
initialValue: undefined,
});
```
### Migration Workflow
**Phase 1: Deprecate** — Apply the deprecation pattern above. Deploy.
**Phase 2: Migrate** — Update frontend to use new fields (with `coalesce()` fallbacks). Create a migration:
```typescript
// migrations/rename-oldTitle-to-newTitle/index.ts
import { at, defineMigration, setIfMissing, unset } from "sanity/migrate";
export default defineMigration({
title: "Rename oldTitle to newTitle",
documentTypes: ["article"],
filter: "defined(oldTitle) && !defined(newTitle)",
migrate: {
document(doc) {
if (!doc.oldTitle || doc.newTitle) return;
return [
at("newTitle", setIfMissing(doc.oldTitle)),
at("oldTitle", unset()),
];
},
},
});
```
```bash
# Dry run first (default)
sanity migration run rename-oldTitle-to-newTitle
# Execute when ready
sanity migration run rename-oldTitle-to-newTitle --no-dry-run
```
**Phase 3: Remove** — Once `oldTitle` is undefined for all documents, delete the field definition.
## 8. Validation Patterns
Beyond `rule.required()`, Sanity offers powerful validation options.
### Common Patterns
```typescript
// Email validation
defineField({
name: "email",
type: "string",
validation: (rule) => rule.email().required(),
});
// URL validation (with custom message)
defineField({
name: "website",
type: "url",
validation: (rule) =>
rule
.uri({
scheme: ["http", "https"],
})
.error("Must be a valid URL starting with http:// or https://"),
});
// Length constraints
defineField({
name: "excerpt",
type: "text",
validation: (rule) =>
rule.max(200).warning("Keep it under 200 characters for best SEO"),
});
// Regex pattern
defineField({
name: "slug",
type: "slug",
validation: (rule) =>
rule.required().custom((slug) => {
if (!slug?.current) return "Required";
if (!/^[a-z0-9-]+$/.test(slug.current)) {
return "Slug must be lowercase with hyphens only";
}
return true;
}),
});
```
### Cross-Field Validation
```typescript
defineField({
name: "endDate",
type: "datetime",
validation: (rule) =>
rule.custom((endDate, context) => {
const startDate = context.document?.startDate;
if (startDate && endDate && new Date(endDate) < new Date(startDate)) {
return "End date must be after start date";
}
return true;
}),
});
```
### Array Validation
```typescript
defineField({
name: "tags",
type: "array",
of: [{ type: "string" }],
validation: (rule) =>
rule
.min(1)
.error("Add at least one tag")
.max(10)
.warning("Too many tags may hurt SEO")
.unique(),
});
```
### Async Validation (Uniqueness Check)
```typescript
defineField({
name: "slug",
type: "slug",
validation: (rule) =>
rule.required().custom(async (slug, context) => {
if (!slug?.current) return true;
const client = context.getClient({ apiVersion: "2026-02-01" });
const id = context.document?._id?.replace(/^drafts\./, "");
const existing = await client.fetch(
`count(*[_type == "post" && slug.current == $slug && _id != $id])`,
{ slug: slug.current, id },
);
return existing === 0 || "Slug already exists";
}),
});
```
@@ -1,340 +0,0 @@
---
title: Sanity SEO Best Practices
description: SEO best practices for Sanity with Next.js, including metadata, Open Graph, sitemaps, redirects, and JSON-LD structured data.
---
# Sanity SEO Best Practices
## 1. Core Philosophy
SEO doesn't require complex configurations. A few core principles, applied consistently:
- **Smart defaults with optional overrides** — Don't require SEO fields; use existing content as fallback
- **Use GROQ for fallback logic** — Move conditional logic into queries, not components
- **Leverage Next.js APIs** — Use `generateMetadata`, `sitemap.ts`, not manual `<meta>` tags
- **Structured content = structured data** — Your content model is already SEO-ready
## 2. SEO Schema Type (Reusable)
Create a reusable SEO object type for consistent metadata across document types.
```typescript
// schemaTypes/seoType.ts
import { defineField, defineType } from "sanity";
export const seoType = defineType({
name: "seo",
title: "SEO",
type: "object",
fields: [
defineField({
name: "title",
description: "Overrides the page title if provided",
type: "string",
}),
defineField({
name: "description",
type: "text",
rows: 3,
}),
defineField({
name: "image",
description: "Image for social sharing (1200x630 recommended)",
type: "image",
options: { hotspot: true },
}),
defineField({
name: "noIndex",
description: "Hide this page from search engines",
type: "boolean",
initialValue: false,
}),
],
});
```
**Usage in document types:**
```typescript
defineField({
name: "seo",
type: "seo",
});
```
## 3. GROQ Queries with Fallbacks
Use `coalesce()` to provide fallback values. This keeps frontend logic clean.
```groq
*[_type == "page" && slug.current == $slug][0]{
...,
"seo": {
// Use SEO field if provided, otherwise fall back to main title
"title": coalesce(seo.title, title, ""),
"description": coalesce(seo.description, ""),
"image": seo.image,
"noIndex": seo.noIndex == true
}
}
```
**Key principle:** `seo.title` will never be `null` — it contains either the SEO override, the page title, or empty string.
## 4. Next.js Metadata (The Right Way)
Use `generateMetadata` — never render `<title>` or `<meta>` tags directly in components.
```typescript
// app/(frontend)/[slug]/page.tsx
import type { Metadata } from "next";
import { urlFor } from "@/sanity/lib/image";
type RouteProps = {
params: Promise<{ slug: string }>;
};
// Extract fetch to reuse in both functions
const getPage = async (params: RouteProps["params"]) =>
sanityFetch({
query: PAGE_QUERY,
params: await params,
stega: false, // Critical for SEO!
});
export async function generateMetadata({
params,
}: RouteProps): Promise<Metadata> {
const { data: page } = await getPage(params);
if (!page) return {};
const metadata: Metadata = {
title: page.seo.title,
description: page.seo.description,
};
// Open Graph image
if (page.seo.image) {
metadata.openGraph = {
images: {
url: urlFor(page.seo.image).width(1200).height(630).url(),
width: 1200,
height: 630,
},
};
}
// noIndex robots directive
if (page.seo.noIndex) {
metadata.robots = "noindex";
}
return metadata;
}
export default async function Page({ params }: RouteProps) {
const { data: page } = await getPage(params);
// ... render page
}
```
**Critical:** Always set `stega: false` when fetching for metadata. Stega characters in `<title>` destroy SEO.
## 5. Dynamic Sitemap
Use Next.js `sitemap.ts` convention to auto-generate from Sanity content.
### GROQ Query
```groq
*[_type in ["page", "post"] && defined(slug.current) && seo.noIndex != true] {
"href": select(
_type == "page" => "/" + slug.current,
_type == "post" => "/posts/" + slug.current,
slug.current
),
_updatedAt
}
```
### Route Implementation
```typescript
// app/sitemap.ts
import { MetadataRoute } from "next";
import { client } from "@/sanity/lib/client";
import { SITEMAP_QUERY } from "@/sanity/lib/queries";
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const baseUrl = process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: "http://localhost:3000";
try {
const paths = await client.fetch(SITEMAP_QUERY);
if (!paths) return [];
return paths.map((path) => ({
url: new URL(path.href!, baseUrl).toString(),
lastModified: new Date(path._updatedAt),
changeFrequency: "weekly",
priority: 1,
}));
} catch (error) {
console.error("Sitemap generation failed:", error);
return [];
}
}
```
**Note:** Sitemap limit is 50,000 URLs per file. For larger sites, use sitemap index.
## 6. Redirects (Managed in Sanity)
Create a redirect document type for content team management.
### Schema
```typescript
// schemaTypes/redirectType.ts
import { LinkIcon } from "@sanity/icons";
import { SanityDocumentLike, defineField, defineType } from "sanity";
function isValidPath(value: string | undefined) {
if (!value) return "Required";
if (!value.startsWith("/")) return "Must start with /";
if (/[^a-zA-Z0-9\-_/:]/.test(value)) return "Invalid characters";
return true;
}
export const redirectType = defineType({
name: "redirect",
title: "Redirect",
type: "document",
icon: LinkIcon,
validation: (Rule) =>
Rule.custom((doc: SanityDocumentLike | undefined) => {
if (doc?.source === doc?.destination) {
return "Source and destination cannot be the same";
}
return true;
}),
fields: [
defineField({
name: "source",
type: "string",
validation: (Rule) => Rule.required().custom(isValidPath),
}),
defineField({
name: "destination",
type: "string",
validation: (Rule) => Rule.required(),
}),
defineField({
name: "permanent",
description: "301 (permanent) or 302 (temporary)",
type: "boolean",
initialValue: true,
}),
defineField({
name: "isEnabled",
type: "boolean",
initialValue: true,
}),
],
});
```
### Next.js Config
```typescript
// next.config.ts
import { fetchRedirects } from "@/sanity/lib/fetchRedirects";
const nextConfig: NextConfig = {
async redirects() {
return await fetchRedirects();
},
};
```
**Limits:** Vercel allows max 1,024 redirects in `next.config`. For more, use middleware.
## 7. Dynamic Open Graph Images
Generate OG images on-the-fly using Next.js Edge Runtime at `/api/og`.
```typescript
// app/api/og/route.tsx
import { ImageResponse } from "next/og";
export const runtime = "edge";
export async function GET(request: Request) {
const id = new URL(request.url).searchParams.get("id");
if (!id) return new Response("Missing id", { status: 400 });
const data = await client.fetch(`*[_id == $id][0]{ title }`, { id });
return new ImageResponse(
<div tw="flex w-full h-full bg-blue-500 text-white p-10">
<h1 tw="text-6xl font-bold">{data?.title || "Untitled"}</h1>
</div>,
{ width: 1200, height: 630 }
);
}
```
Use as fallback in metadata: `url: page.seo.image ? urlFor(page.seo.image).url() : \`/api/og?id=\${page.\_id}\``
## 8. JSON-LD Structured Data
Use `schema-dts` for type-safe structured data.
```bash
npm install schema-dts
```
### FAQ Example
```typescript
import { FAQPage, WithContext } from "schema-dts";
const generateFaqData = (faqs: FAQ[]): WithContext<FAQPage> => ({
"@context": "https://schema.org",
"@type": "FAQPage",
mainEntity: faqs.map((faq) => ({
"@type": "Question",
name: faq.title,
acceptedAnswer: {
"@type": "Answer",
text: faq.text, // Use pt::text() in GROQ to get plain text
},
})),
});
// In component
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(generateFaqData(faqs)) }}
/>
```
### GROQ for Plain Text
```groq
faqs[]->{
_id,
title,
body,
"text": pt::text(body) // Convert Portable Text to plain string
}
```
## 9. Testing Tools
- **Open Graph:** [opengraph.ing](https://opengraph.ing/)
- **Facebook:** [Sharing Debugger](https://developers.facebook.com/tools/debug/)
- **Twitter:** [Card Validator](https://cards-dev.twitter.com/validator)
- **LinkedIn:** [Post Inspector](https://www.linkedin.com/post-inspector/)
- **Sitemap:** [XML Sitemaps Validator](https://www.xml-sitemaps.com/validate-xml-sitemap.html)
@@ -1,146 +0,0 @@
---
title: "Sanity Studio Structure Rules"
description: Rules for customizing the Sanity Studio Structure (S.structure).
---
# Sanity Studio Structure Rules
## 1. Setup
Custom structure is defined in `sanity.config.ts` using the `structureTool`.
```typescript
import { structureTool } from "sanity/structure";
import { structure } from "./src/structure";
export default defineConfig({
// ...
plugins: [structureTool({ structure })],
});
```
## 2. Structure Definition
**Location:** `src/structure/index.ts`
Use a function that receives `S` (StructureBuilder).
```typescript
import type { StructureResolver } from "sanity/structure";
export const structure: StructureResolver = (S) =>
S.list().title("Content").items([
// ... items
]);
```
## 3. Organization Principles
1. **Singletons First:** Place critical site-wide settings (Global Settings, Homepage) at the top.
2. **Dividers:** Use `S.divider()` to visually separate logical groups.
3. **Filtered Lists:** Always exclude Singleton documents from generic `documentTypeList` items to avoid duplication.
## 4. Singleton Pattern (Critical)
**Singletons are enforced via Structure, NOT schema options.** There is no `singleton: true` schema option.
This is the main case where explicit document IDs are appropriate. For ordinary content documents, let Sanity generate `_id` values and use references or GROQ lookups to connect records.
### How Singletons Work
1. Use `S.document().documentId('fixed-id')` to lock the document to a specific ID.
2. Filter the type from generic lists to prevent duplicate entries.
### Singleton Helper Function
```typescript
// Helper to create singleton list items
function createSingleton(
S: StructureBuilder,
typeName: string,
title: string,
icon?: ComponentType,
) {
return S.listItem().title(title).icon(icon).child(
S.document()
.schemaType(typeName)
.documentId(typeName) // Fixed ID = singleton
.title(title),
);
}
// Usage
createSingleton(S, "settings", "Site Settings", CogIcon);
```
### Querying Singletons
```groq
// By fixed ID (most efficient)
*[_id == "settings"][0]
// By type (works but slower)
*[_type == "settings"][0]
```
**For localized singletons** (e.g., homepage per language), see `localization.md` Section 6.
## 5. Implementation Pattern
```typescript
// Define singleton types to exclude from generic lists
const SINGLETONS = ["settings", "homePage"];
export const structure: StructureResolver = (S) =>
S.list()
.title("Website Content")
.items([
// 1. Singletons
S.listItem()
.title("Site Settings")
.icon(CogIcon)
.child(S.document().schemaType("settings").documentId("settings")),
S.divider(),
// 2. Content Verticals
S.listItem()
.title("Blog")
.child(
S.list()
.title("Blog Content")
.items([
S.documentTypeListItem("post").title("Posts"),
S.documentTypeListItem("author").title("Authors"),
]),
),
S.divider(),
// 3. Remaining Documents (Filtered)
...S.documentTypeListItems().filter(
(listItem) => !SINGLETONS.includes(listItem.getId() as string),
),
]);
```
## 6. Views (Split Pane)
Add "Web Preview" or other views to documents.
```typescript
export const defaultDocumentNode: DefaultDocumentNodeResolver = (
S,
{ schemaType },
) => {
switch (schemaType) {
case `post`:
return S.document().views([
S.view.form(), // Default form
S.view.component(PreviewComponent).title("Preview"), // Custom view
]);
default:
return S.document().views([S.view.form()]);
}
};
```
@@ -1,340 +0,0 @@
---
title: "SvelteKit & Sanity Integration Rules"
description: Integration guide for SvelteKit with Sanity using @sanity/sveltekit, including Visual Editing and Preview Mode.
---
# SvelteKit & Sanity Integration Rules
This guide uses the official **`@sanity/sveltekit`** package (Svelte 5 + SvelteKit 2). The older `@sanity/svelte-loader` does not work with Svelte 5 — its `useQuery` store returns empty on the client. Use `@sanity/sveltekit` instead.
## 1. Setup & Configuration
### Scaffold a new SvelteKit app
```bash
npx sv@latest create my-app --template minimal --types ts --no-add-ons --install npm
cd my-app
```
`--template minimal` is the bare app. `--types ts` enables TypeScript. `--no-add-ons` skips the add-on picker. `--install <pm>` chooses the package manager (`npm`, `pnpm`, `yarn`, or `bun`).
### Installation
```bash
npm install @sanity/sveltekit @sanity/image-url @portabletext/svelte
```
`@sanity/sveltekit` is the one-stop integration: it bundles `@sanity/client`, `@sanity/visual-editing`, `@sanity/core-loader`, `groq`, and friends, and re-exports `createClient`, `defineQuery`, `groq`, and `stegaClean`. **Do not** also install `@sanity/client`, `@sanity/visual-editing`, or `groq` directly — import them from `@sanity/sveltekit`. `@sanity/image-url` and `@portabletext/svelte` are not bundled, so add them separately.
### Environment variables (`.env.local`)
```bash
PUBLIC_SANITY_PROJECT_ID=your-project-id
PUBLIC_SANITY_DATASET=production
PUBLIC_SANITY_API_VERSION=2026-05-15
PUBLIC_SANITY_STUDIO_URL=http://localhost:3333
SANITY_API_READ_TOKEN=
```
SvelteKit's `$env/static/public` requires the `PUBLIC_` prefix for any var read on the client. `SANITY_API_READ_TOKEN` must be declared (even empty) if any file imports it from `$env/static/private`, otherwise Vite throws at build time.
## 2. Files
### `src/lib/sanity/api.ts` — env var resolution
```ts
import {
PUBLIC_SANITY_API_VERSION,
PUBLIC_SANITY_DATASET,
PUBLIC_SANITY_PROJECT_ID,
PUBLIC_SANITY_STUDIO_URL,
} from "$env/static/public";
function assertEnvVar<T>(value: T | undefined, name: string): T {
if (value === undefined || value === "") {
throw new Error(`Missing environment variable: ${name}`);
}
return value;
}
export const dataset = assertEnvVar(
PUBLIC_SANITY_DATASET,
"PUBLIC_SANITY_DATASET",
);
export const projectId = assertEnvVar(
PUBLIC_SANITY_PROJECT_ID,
"PUBLIC_SANITY_PROJECT_ID",
);
export const apiVersion = PUBLIC_SANITY_API_VERSION || "2026-05-15";
export const studioUrl = PUBLIC_SANITY_STUDIO_URL || "http://localhost:3333";
```
### `src/lib/sanity/client.ts` — public client
```ts
import { apiVersion, dataset, projectId, studioUrl } from "$lib/sanity/api";
import { createClient } from "@sanity/sveltekit";
export const client = createClient({
projectId,
dataset,
apiVersion,
useCdn: true,
stega: { studioUrl },
});
```
Import `createClient` from `@sanity/sveltekit`, not `@sanity/client`. `useCdn: true` is for production reads; the server (preview) client below overrides to `false`.
### `src/lib/sanity/client.server.ts` — server (preview) client
```ts
import { SANITY_API_READ_TOKEN } from "$env/static/private";
import { client } from "$lib/sanity/client";
export const serverClient = client.withConfig({
token: SANITY_API_READ_TOKEN,
useCdn: false,
stega: true,
});
```
### `src/lib/sanity/queries.ts` — queries + types
```ts
import { groq } from "@sanity/sveltekit";
export const postsQuery = groq`*[_type == "post" && defined(slug.current)] | order(_createdAt desc){
_id, _createdAt, title, slug, excerpt, mainImage, body
}`;
export const postQuery = groq`*[_type == "post" && slug.current == $slug][0]{
_id, _createdAt, title, slug, excerpt, mainImage, body
}`;
export interface Post {
_id: string;
_createdAt: string;
title?: string;
slug: { current: string };
excerpt?: string;
mainImage?: unknown;
body?: unknown[];
}
```
Use `defineQuery` instead of `groq` if you want TypeGen-friendly query definitions; both are re-exported from `@sanity/sveltekit`.
### `src/lib/sanity/image.ts` — image URL builder
```ts
import { createImageUrlBuilder } from "@sanity/image-url";
import { client } from "./client";
const builder = createImageUrlBuilder(client);
export function urlFor(source: unknown) {
return builder.image(source as never);
}
```
Use the named `createImageUrlBuilder` export; the default export logs a deprecation warning at runtime.
## 3. Hooks & Locals
### `src/hooks.server.ts` — wire preview + query loader
```ts
import { serverClient } from "$lib/sanity/client.server";
import {
handlePreviewMode,
handleQueryLoader,
setServerClient,
} from "@sanity/sveltekit";
import { redirect } from "@sveltejs/kit";
import { sequence } from "@sveltejs/kit/hooks";
setServerClient(serverClient);
export const handle = sequence(
handlePreviewMode({
client: serverClient,
preview: { redirect },
}),
handleQueryLoader(),
);
```
`handlePreviewMode` installs `/preview/enable` and `/preview/disable` endpoints, reads the preview cookie, and populates `locals.sanity` with `{client, fetch, loadQuery, previewEnabled, previewPerspective, browserToken}`. `handleQueryLoader` attaches `loadQuery` to `locals.sanity` for use in `+page.server.ts` / `+layout.server.ts`.
### `src/app.d.ts` — typed locals
```ts
import type { SanityLocals } from "@sanity/sveltekit";
declare global {
namespace App {
interface Locals extends SanityLocals {}
}
}
export {};
```
## 4. Layout: Preview + Visual Editing Providers
### `src/routes/+layout.server.ts` — propagate previewEnabled
```ts
import type { LayoutServerLoad } from "./$types";
export const load: LayoutServerLoad = (event) => {
const { previewEnabled } = event.locals.sanity;
return { previewEnabled };
};
```
### `src/routes/+layout.svelte` — wrap children in providers (Svelte 5)
```svelte
<script lang="ts">
import {PreviewMode, QueryLoader, VisualEditing} from '@sanity/sveltekit'
import type {LayoutProps} from './$types'
import {client} from '$lib/sanity/client'
const {children, data}: LayoutProps = $props()
// svelte-ignore state_referenced_locally
const {previewEnabled} = data
</script>
<PreviewMode enabled={previewEnabled}>
<VisualEditing enabled={previewEnabled}>
<QueryLoader enabled={previewEnabled} {client}>
{@render children()}
</QueryLoader>
</VisualEditing>
</PreviewMode>
```
Svelte 5 idioms here are mandatory:
- `const {children, data} = $props()` — not `export let data`.
- `{@render children()}` — not `<slot />`.
- The `svelte-ignore state_referenced_locally` comment silences a warning about destructuring reactive props at module scope.
`<VisualEditing>` dynamically imports its component only when `enabled === true`, so a preview-off app never loads the React-Compiler-runtime chunk.
## 5. Data Fetching (Loaders + `useQuery`)
### Posts list
`src/routes/+page.server.ts`:
```ts
import { type Post, postsQuery as query } from "$lib/sanity/queries";
import type { PageServerLoad } from "./$types";
export const load: PageServerLoad = async ({ locals }) => {
const { loadQuery } = locals.sanity;
const initial = await loadQuery<Post[]>(query);
return { query, options: { initial } };
};
```
The return shape `{query, params?, options: {initial}}` is what `useQuery(data)` on the client expects — don't change the field names.
`src/routes/+page.svelte`:
```svelte
<script lang="ts">
import {useQuery} from '@sanity/sveltekit'
import type {Post} from '$lib/sanity/queries'
import type {PageProps} from './$types'
const {data}: PageProps = $props()
const query = $derived(useQuery<Post[]>(data))
const posts = $derived($query.data)
</script>
<h1>Posts</h1>
{#if posts?.length}
<ul>
{#each posts as post (post._id)}
<li><a href={`/post/${post.slug.current}`}>{post.title}</a></li>
{/each}
</ul>
{:else}
<p>No posts yet.</p>
{/if}
```
Critical Svelte 5 pattern:
- `useQuery` returns a Svelte Readable store. Wrap in `$derived(useQuery(data))` so the store reference stays current across reactive updates.
- Subscribe via `$query` (Svelte's auto-subscription) and read `.data`.
- Works on both SSR and client.
### Post detail (`[slug]`)
`src/routes/post/[slug]/+page.server.ts`:
```ts
import { type Post, postQuery as query } from "$lib/sanity/queries";
import type { PageServerLoad } from "./$types";
export const load: PageServerLoad = async ({ locals, params }) => {
const { loadQuery } = locals.sanity;
const { slug } = params;
const initial = await loadQuery<Post>(query, { slug });
return { query, params: { slug }, options: { initial } };
};
```
`src/routes/post/[slug]/+page.svelte`:
```svelte
<script lang="ts">
import {useQuery} from '@sanity/sveltekit'
import {PortableText} from '@portabletext/svelte'
import {urlFor} from '$lib/sanity/image'
import type {Post} from '$lib/sanity/queries'
import type {PageProps} from './$types'
const {data}: PageProps = $props()
const query = $derived(useQuery<Post>(data))
const post = $derived($query.data)
</script>
{#if post}
<article>
<h1>{post.title}</h1>
{#if post.mainImage}
<img src={urlFor(post.mainImage).width(800).url()} alt={post.title ?? ''} />
{/if}
{#if post.body}
<PortableText value={post.body} />
{/if}
</article>
{:else}
<p>Post not found.</p>
{/if}
```
## 6. Stega Cleaning
When using fetched strings for logic (routing, classNames), strip the stega markers first.
```ts
import { stegaClean } from "@sanity/sveltekit";
// …
if (stegaClean(slug) === "home") {
/* … */
}
```
## 7. Caveats
- **Yarn classic + Visual Editing.** `@sanity/visual-editing` lazy-loads a chunk that imports `react/compiler-runtime`. Yarn classic doesn't auto-install peer deps, so users who flip preview mode on with yarn classic also need `yarn add react react-dom`. (Other package managers handle this automatically.) `<VisualEditing>` only loads this chunk when `enabled === true`, so a default preview-off app is unaffected.
- **No `<slot />`.** Svelte 5 layouts use `{@render children()}`.
- **No `export let`.** Pages and components use `const {data} = $props()`.
- **`@sanity/image-url` default export.** Use the named `createImageUrlBuilder`; the default export still works but logs a runtime deprecation warning.
@@ -1,234 +0,0 @@
---
title: Sanity TypeGen Rules
description: Workflow for generating TypeScript types from Sanity Schema and GROQ queries.
---
# Sanity TypeGen Rules
## 1. The Workflow
Sanity TypeGen generates TypeScript types from your schema and GROQ queries. Types can be generated automatically or manually.
### Automatic (Recommended)
Enable in `sanity.cli.ts` — types regenerate during `sanity dev` and `sanity build`:
```typescript
// sanity.cli.ts
import { defineCliConfig } from "sanity/cli";
export default defineCliConfig({
typegen: {
enabled: true,
},
});
```
### Manual
Run the extract + generate cycle whenever schema or queries change:
1. **Extract:** Converts your Schema (TS/JS) into a static JSON representation.
2. **Generate:** Scans your codebase for GROQ queries and generates TypeScript types.
```bash
npx sanity schema extract && npx sanity typegen generate
```
### Watch Mode (for separate frontends)
If your frontend is in a separate repo from the Studio, use watch mode:
```bash
npx sanity typegen generate --watch
```
## 2. The "Update Types" Pattern
For manual workflows, implement a single script:
**package.json:**
```json
"scripts": {
"typegen": "sanity schema extract && sanity typegen generate"
}
```
### Git Strategy for Generated Files
**Option A: Commit generated types (Recommended for most teams)**
- Types available immediately after `git pull`
- CI/CD doesn't need to run typegen
- Can cause merge conflicts
**Option B: Generate in CI (Recommended for larger teams)**
Add to `.gitignore`:
```gitignore
# Sanity TypeGen (generated)
sanity.types.ts
schema.json
```
Then ensure CI runs typegen before build:
```yaml
# Example GitHub Actions
- run: npm run typegen
- run: npm run build
```
## 3. Configuration (`sanity.cli.ts`)
> **Note:** `sanity-typegen.json` is deprecated. Move your configuration to `sanity.cli.ts`.
```typescript
// sanity.cli.ts
import { defineCliConfig } from "sanity/cli";
export default defineCliConfig({
typegen: {
enabled: true, // Auto-generate during sanity dev/build
path: "./src/**/*.{ts,tsx,js,jsx,astro,svelte,vue}", // Glob to find queries
schema: "schema.json", // Schema file from extract
generates: "./sanity.types.ts", // Output file
overloadClientMethods: true, // Auto-type client.fetch() calls
},
});
```
### Project Structure Examples
**Monorepo (recommended)** (Studio in `studio/`, Frontend in `web/` — same config works under `apps/`):
```typescript
export default defineCliConfig({
typegen: {
path: "../web/src/**/*.{ts,tsx,js,jsx}",
schema: "schema.json",
generates: "../web/sanity.types.ts",
},
});
```
**Single Repo / Embedded Studio (legacy):**
Use defaults — no extra config needed.
**Separate Repos:**
Use `--watch` mode in your frontend: `sanity typegen generate --watch`
## 4. Usage in Code
### Automatic Type Inference (Recommended)
With `overloadClientMethods: true` (default), `client.fetch()` automatically returns typed results when you use `defineQuery`:
```typescript
import { defineQuery } from "groq";
import { createClient } from "@sanity/client";
const client = createClient({...});
const POSTS_QUERY = defineQuery(`*[_type == "post"]{ title, slug }`);
// Return type is automatically inferred — no manual type import needed!
const posts = await client.fetch(POSTS_QUERY);
```
### Manual Type Import (Alternative)
You can also import generated types directly:
```typescript
import { defineQuery } from "groq";
// Next.js re-exports defineQuery for convenience:
// import { defineQuery } from "next-sanity";
const AUTHOR_QUERY = defineQuery(`*[_type == "author" && slug.current == $slug][0]{ name, bio }`);
import type { AUTHOR_QUERYResult } from "@/sanity.types";
export default function Author({ data }: { data: AUTHOR_QUERYResult }) {
return <h1>{data.name}</h1>
}
```
### Required Fields
Use `--enforce-required-fields` during extraction to translate `validation: rule => rule.required()` into non-optional types:
```bash
npx sanity schema extract --enforce-required-fields
npx sanity typegen generate
```
> **Warning:** If you use draft previews, fields may still be `undefined` even with required validation, since drafts can be in an invalid state.
### Type Utilities
TypeGen provides utilities for working with complex types:
```typescript
import type { FilterByType, Get } from "sanity";
import type { Page, PageBuilder } from "./sanity.types";
// Extract deeply nested type (up to 20 levels)
type HeroSection = Get<Page, "sections", number, "hero">;
// Filter specific types from unions using _type discriminator
type HeroBlock = FilterByType<PageBuilder, "hero">;
```
### Unique Query Names
All queries must have unique variable names. Duplicate names across files will cause TypeGen to silently overwrite types. Use descriptive, scoped names:
```typescript
// Unique names
const POSTS_INDEX_QUERY = defineQuery(`*[_type == "post"]{ title }`)
const POST_DETAIL_QUERY = defineQuery(`*[_type == "post" && slug.current == $slug][0]`)
// Duplicate names will conflict
const QUERY = defineQuery(`*[_type == "post"]`) // file-a.ts
const QUERY = defineQuery(`*[_type == "author"]`) // file-b.ts — overwrites!
```
### Supported Query Formats
Queries must be assigned to a variable using `groq` or `defineQuery`:
```typescript
// Works — groq template tag
const query = groq`*[_type == "post"]`
// Works — defineQuery
const query = defineQuery(`*[_type == "post"]`)
// Won't work — inline query
await client.fetch(groq`*[_type == "post"]`)
```
### Supported File Types
TypeGen parses queries from: `.ts`, `.tsx`, `.js`, `.jsx`, `.astro`, `.svelte`, `.vue`
### tsconfig Requirements
Ensure `sanity.types.ts` is included in your `tsconfig.json`'s `include` array. If your config restricts includes (e.g., `["src/**/*"]`) and the types file is at the project root, TypeScript won't pick up the generated types:
```json
{
"include": ["src/**/*", "sanity.types.ts"]
}
```
### Skipping Individual Queries
Add `@sanity-typegen-ignore` in a comment before a query to skip type generation:
```typescript
// @sanity-typegen-ignore
const debugQuery = groq`*[_type == "debug"]`;
```
@@ -1,279 +0,0 @@
---
title: "Sanity Visual Editing Rules"
description: Comprehensive guide for Sanity Visual Editing, including Presentation Tool, Stega (Content Source Maps), and Overlays.
---
# Sanity Visual Editing Rules
## 1. Concepts
### Presentation Tool
The Studio plugin (`sanity/presentation`) that renders your front-end application inside an iframe in the Studio. It enables the "Edit" overlay and bidirectional navigation.
### Content Source Maps (Stega)
Invisible characters embedded in strings that tell the Presentation Tool which field in which document the content comes from.
- **Mechanism:** Sanity encodes document ID, field path, and dataset info into string values.
- **Result:** Click-to-edit functionality in the preview.
### Loaders
Framework-agnostic or specific libraries that handle:
1. Fetching data (production vs. preview).
2. Subscribing to real-time updates (Live Content API).
3. Encoding Stega strings (if not handled by the Content Lake automatically).
## 2. The Golden Rule of Stega (Clean Data)
When Visual Editing is enabled, string fields will contain invisible characters. You **MUST** clean them before using the value for logic.
| Scenario | Clean? | Why |
| ------------------------------------ | ------ | --------------------- |
| Comparing strings (`if (x === 'y')`) | ✅ Yes | Stega breaks equality |
| Using as object keys | ✅ Yes | Keys won't match |
| Using as HTML IDs | ✅ Yes | Invalid characters |
| Passing to third-party libraries | ✅ Yes | May validate input |
| Rendering text (`<h1>{title}</h1>`) | ❌ No | Breaks click-to-edit |
| Passing to `<PortableText />` | ❌ No | Handles internally |
| Passing to image helpers | ❌ No | Handles internally |
```typescript
import { stegaClean } from "@sanity/client/stega";
export function Layout({ align }: { align: string }) {
// Good: Clean before comparison
const cleanAlign = stegaClean(align);
return <div className={cleanAlign === 'center' ? 'mx-auto' : ''} />
}
```
## 3. Token Handling (Security)
Store your read token in a dedicated file that throws if missing:
```typescript
// src/sanity/lib/token.ts
export const token = process.env.SANITY_API_READ_TOKEN;
if (!token) {
throw new Error("Missing SANITY_API_READ_TOKEN");
}
```
**Never** expose tokens in client bundles. Pass to `defineLive` for server/browser use only when Draft Mode is enabled.
## 4. Setup: Presentation Tool
**File:** `sanity.config.ts`
```typescript
import { defineConfig } from "sanity";
import { presentationTool } from "sanity/presentation";
import { resolve } from "@/sanity/presentation/resolve";
export default defineConfig({
// ...
plugins: [
presentationTool({
resolve, // Document locations (see below)
previewUrl: {
// The front-end origin — required when the Studio runs standalone
origin:
process.env.SANITY_STUDIO_PREVIEW_ORIGIN || "http://localhost:3000",
previewMode: {
enable: "/api/draft-mode/enable",
},
},
}),
],
});
```
### Document Locations
Show where documents appear in the front-end — enables quick navigation between Structure and Presentation tools.
```typescript
// src/sanity/presentation/resolve.ts
import {
PresentationPluginOptions,
defineLocations,
} from "sanity/presentation";
export const resolve: PresentationPluginOptions["resolve"] = {
locations: {
post: defineLocations({
select: { title: "title", slug: "slug.current" },
resolve: (doc) => ({
locations: [
{ title: doc?.title || "Untitled", href: `/posts/${doc?.slug}` },
{ title: "Posts index", href: `/posts` },
],
}),
}),
// Add more document types as needed
},
};
```
## 5. Visual Editing Overlays
Render `<VisualEditing />` in Draft Mode for click-to-edit overlays.
**Next.js (App Router):**
```typescript
// layout.tsx
import { VisualEditing } from 'next-sanity/visual-editing'
import { draftMode } from 'next/headers'
import { DisableDraftMode } from '@/components/disable-draft-mode'
export default async function RootLayout({ children }) {
return (
<html>
<body>
{children}
{(await draftMode()).isEnabled && (
<>
<DisableDraftMode />
<VisualEditing />
</>
)}
</body>
</html>
)
}
```
### Disable Draft Mode Button
Useful for content authors to exit preview and see published content:
```typescript
// src/components/disable-draft-mode.tsx
'use client'
import { useDraftModeEnvironment } from 'next-sanity/hooks'
export function DisableDraftMode() {
const environment = useDraftModeEnvironment()
// Only show outside of Presentation Tool
if (environment !== 'live' && environment !== 'unknown') return null
return (
<a href="/api/draft-mode/disable" className="fixed bottom-4 right-4 bg-gray-50 px-4 py-2">
Disable Draft Mode
</a>
)
}
```
**Remix/Svelte:** See framework-specific rules for `useLiveMode` and `enableVisualEditing` patterns.
## 6. SEO & Metadata (Critical)
**NEVER** allow Stega strings in `<head>` tags (Title, Description, Canonical URLs). It destroys SEO rankings and looks broken in search results.
- **Next.js:** Set `stega: false` in `generateMetadata`.
- **General:** Explicitly clean fields used in `<title>` or `<meta>`.
```typescript
// Next.js Example — disable stega at fetch level
export async function generateMetadata({ params }) {
const { data } = await sanityFetch({
query: SEO_QUERY,
stega: false, // Critical
});
return { title: data.title };
}
```
**Alternative:** If you can't disable stega at the fetch level, clean explicitly:
```typescript
import { stegaClean } from "@sanity/client/stega";
export async function generateMetadata({ params }) {
const { data } = await sanityFetch({ query: PAGE_QUERY });
return {
title: stegaClean(data.title),
description: stegaClean(data.description),
openGraph: { url: stegaClean(data.canonicalUrl) },
};
}
```
## 7. Drag-and-Drop Reordering (Advanced)
For arrays (e.g., "Related Posts"), enable drag-and-drop in the preview using `data-sanity` attributes and `useOptimistic`:
```typescript
import { createDataAttribute } from 'next-sanity'
import { useOptimistic } from 'next-sanity/hooks'
// Add data-sanity to array container
<ul data-sanity={createDataAttribute({ id: documentId, type: 'post', path: 'relatedPosts' }).toString()}>
{items.map((item) => (
<li key={item._key} data-sanity={createDataAttribute({
id: documentId, type: 'post', path: `relatedPosts[_key=="${item._key}"]`
}).toString()}>
{item.title}
</li>
))}
</ul>
```
**Key requirements:**
- Query must include `_key` for array items
- Use `useOptimistic` hook for instant UI updates during mutations
## 8. Optimistic Updates for Faster Editing
By default, editing a field in the Presentation Tool triggers a full page re-render. For pages with many components, this can feel sluggish. **Presentation queries** solve this by fetching only the specific block being edited.
### The Concept
Instead of:
1. User edits a field -> Full page query re-runs -> All components re-render
You get:
1. User edits a field -> Block-specific query runs -> Only that component re-renders
### How It Works
1. **Create a targeted query** that fetches just the block data using `_key`:
```groq
*[_id == $documentId][0]{
"heroBlock": pageBuilder[_key == $blockKey && _type == "hero"][0]{
title, subtitle, image
}
}
```
2. **Use a presentation query hook** in your component (e.g., `usePresentationQuery` in Next.js)
3. **Fall back to initial props** when not in presentation mode
This pattern works for both Page Builder blocks (`pageBuilder[]`) and Portable Text blocks (`body[]`).
**See framework-specific rules for implementation:**
- Next.js: `nextjs.md` (Section 9)
- Page Builder: `page-builder.md` (Section 5)
- Portable Text: `portable-text.md` (Section 7)
## 9. Framework Specifics
| Framework | Loader Package | Key Components |
| :---------- | :---------------------- | :----------------------------------------------------------- |
| **Next.js** | `next-sanity` | `<VisualEditing />`, `defineLive`, `usePresentationQuery` |
| **Remix** | `@sanity/react-loader` | `createQueryStore`, `useLiveMode`, `enableVisualEditing` |
| **Svelte** | `@sanity/svelte-loader` | `createRequestHandler`, `useLiveMode`, `enableVisualEditing` |
| **Nuxt** | `@nuxtjs/sanity` | Automatic via module config (`visualEditing: {}`) |
| **Astro** | `@sanity/astro` | `sanity({ useCdn: false, stega: true })` |
+66
View File
@@ -0,0 +1,66 @@
---
name: website-example
description: >
Add or update a code example or template shown on aksel.nav.no
(aksel.nav.no/website/pages/eksempler/** or pages/templates/**). Use when
asked to create a component example, demo, usage snippet or page template
for the documentation site, or when an example fails the aksel-local ESLint
rules or validate:eksempler.
argument-hint: "Component group and example name, e.g. button/loading"
---
# Website example
Examples are public copy-paste snippets. The code above the marker comment is shown verbatim on the site and opened in the sandbox.
## 1. Locate
- Component examples: `aksel.nav.no/website/pages/eksempler/<group>/<example-name>.tsx` (group = lowercase component, e.g. `lookup`).
- Page templates: `aksel.nav.no/website/pages/templates/<name>/...`.
- Read 1-2 sibling examples in the same group first and match their tone. Content is in Norwegian (bokmål).
## 2. Write the file
```tsx
import { Button } from "@navikt/ds-react";
import { withDsExample } from "@/web/examples/withDsExample";
const Example = () => {
return <Button>Lagre</Button>;
};
// EXAMPLES DO NOT INCLUDE CONTENT BELOW THIS LINE
export default withDsExample(Example);
/* Storybook story */
export const Demo = {
render: Example,
};
export const args: ExampleArgsT = {
index: 0,
desc: "Kort hint om når eksemplet brukes.",
};
```
Hard rules (enforced by `tooling/eslint` rules `aksel-local/*`):
- With the sandbox enabled (default), import only from `@navikt/*`, `react`, relative `../__parts*` helpers and exactly `@/web/examples/withDsExample`. Anything else breaks the "open in sandbox" button. Set `sandbox: false` in `args` only if it's unavoidable.
- The demo component must be named `Example` (the sandbox depends on it).
- The marker comment `// EXAMPLES DO NOT INCLUDE CONTENT BELOW THIS LINE` sits directly above `export default`.
- `export const args: ExampleArgsT` with `index` (sort order within the group). Optional: `desc`, `title`, `sandbox: false`.
- `withDsExample(Example, { variant: "static" | ... })`: see its JSDoc for layout options.
## 3. Validate
```sh
corepack yarn eslint --max-warnings=0 --no-warn-ignored <file>
corepack yarn workspace website validate:eksempler
corepack yarn storybook:aksel # visual check at :6007, needs no secrets
```
Never run `update:eksempler`. It writes to the Sanity CMS. Tell the user that a maintainer syncs examples to Sanity and links a new group from the component page.
## Done when
ESLint and `validate:eksempler` pass, and the story renders in `storybook:aksel`.
+90 -32
View File
@@ -12,15 +12,15 @@ on:
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
build:
name: Release packages
version:
name: Create release Pull Request
if: ${{ !contains(github.event.head_commit.message, '[ci skip]') }}
runs-on: ubuntu-latest
permissions:
id-token: "write"
contents: "write"
packages: "write"
pull-requests: "write"
outputs:
has-changesets: ${{ steps.changesets.outputs.has-changesets }}
steps:
- name: Checkout code
uses: actions/checkout@v7
@@ -39,40 +39,60 @@ jobs:
env:
NPM_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- name: Create release Pull Request or publish to NPM
# Without `publish-script` the action only creates/updates the release PR
- name: Create or update release Pull Request
id: changesets
uses: changesets/action@v1
uses: changesets/action@v2
with:
version: yarn create-version
publish: yarn release
createGithubReleases: false
version-script: yarn create-version
env:
# Use OIDC for npm authentication instead of NPM_TOKEN
# https://github.com/changesets/changesets/issues/1152#issuecomment-3190884868
NPM_TOKEN: ""
# Needed for push to main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Create .npmrc for GPR
run: |
cat << EOF > "$HOME/.npmrc"
@navikt:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.GIT_REPO }}
- name: Publish to GPR
if: steps.changesets.outputs.published == 'true'
id: changesets-gpr
uses: changesets/action@v1
# Both publish jobs are idempotent: `changeset publish` only publishes versions missing from the target registry.
# Re-run a failed job to retry that registry without affecting the other.
publish-npm:
name: Publish to npm
needs: version
if: ${{ needs.version.outputs.has-changesets == 'false' }}
runs-on: ubuntu-latest
permissions:
id-token: "write"
contents: "write"
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
publish: yarn changeset publish
createGithubReleases: false
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: lts/*
cache: yarn
cache-dependency-path: "yarn.lock"
- name: Install dependencies
run: yarn
env:
NPM_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
# changeset v3 uses `yarn npm info`, which reads the @navikt scope registry (GPR) from .yarnrc.yml.
# Only changes this job's checkout, after install.
- name: Point @navikt scope to npm
run: yarn config set npmScopes.navikt.npmRegistryServer "https://registry.npmjs.org"
- name: Publish to npm
id: changesets
uses: changesets/action@v2
with:
publish-script: yarn release
create-github-releases: false
env:
# No token: `yarn npm publish` falls back to npm OIDC (trusted publishing)
NPM_TOKEN: ""
# Needed for push to main
GITHUB_TOKEN: ${{ secrets.GIT_REPO }}
# `yarn npm publish` ignores the scope's npmRegistryServer and defaults to registry.yarnpkg.com
YARN_NPM_PUBLISH_REGISTRY: https://registry.npmjs.org
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate icon.zip
if: steps.changesets.outputs.published == 'true'
@@ -89,10 +109,11 @@ jobs:
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
- name: Get @navikt/ds-css version
if: steps.changesets.outputs.published == 'true'
run: |
VERSION=$(yarn css:get-version)
echo "version=$VERSION" >> $GITHUB_ENV
echo "Version of @navikt/ds-css: ${{ env.version }}"
echo "Version of @navikt/ds-css: $VERSION"
- name: Upload CSS to Nav CDN
if: steps.changesets.outputs.published == 'true'
@@ -103,3 +124,40 @@ jobs:
destination: "@navikt/ds-css"
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
publish-gpr:
name: Publish to GitHub Packages
needs: version
if: ${{ needs.version.outputs.has-changesets == 'false' }}
runs-on: ubuntu-latest
permissions:
# Needed for `publishConfig.provenance`
id-token: "write"
contents: "read"
packages: "write"
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: lts/*
cache: yarn
cache-dependency-path: "yarn.lock"
- name: Install dependencies
run: yarn
env:
NPM_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- name: Build packages
run: yarn build:release
# Git tags and GitHub releases are handled by the npm job
- name: Publish to GitHub Packages
run: yarn changeset publish --no-git-tag
env:
NPM_AUTH_TOKEN: ${{ secrets.GIT_REPO }}
# `yarn npm publish` ignores the scope's npmRegistryServer and defaults to registry.yarnpkg.com
YARN_NPM_PUBLISH_REGISTRY: https://npm.pkg.github.com
-942
View File
@@ -1,942 +0,0 @@
#!/usr/bin/env node
/* eslint-disable */
//prettier-ignore
(()=>{var xGe=Object.create;var mU=Object.defineProperty;var kGe=Object.getOwnPropertyDescriptor;var QGe=Object.getOwnPropertyNames;var TGe=Object.getPrototypeOf,RGe=Object.prototype.hasOwnProperty;var Ie=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Xe=(t,e)=>()=>(t&&(e=t(t=0)),e);var _=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Vt=(t,e)=>{for(var r in e)mU(t,r,{get:e[r],enumerable:!0})},FGe=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of QGe(e))!RGe.call(t,a)&&a!==r&&mU(t,a,{get:()=>e[a],enumerable:!(s=kGe(e,a))||s.enumerable});return t};var ut=(t,e,r)=>(r=t!=null?xGe(TGe(t)):{},FGe(e||!t||!t.__esModule?mU(r,"default",{value:t,enumerable:!0}):r,t));var fi={};Vt(fi,{SAFE_TIME:()=>WZ,S_IFDIR:()=>JP,S_IFLNK:()=>KP,S_IFMT:()=>Mf,S_IFREG:()=>N2});var Mf,JP,N2,KP,WZ,YZ=Xe(()=>{Mf=61440,JP=16384,N2=32768,KP=40960,WZ=456789e3});var or={};Vt(or,{EBADF:()=>Mo,EBUSY:()=>NGe,EEXIST:()=>HGe,EINVAL:()=>LGe,EISDIR:()=>_Ge,ENOENT:()=>MGe,ENOSYS:()=>OGe,ENOTDIR:()=>UGe,ENOTEMPTY:()=>GGe,EOPNOTSUPP:()=>qGe,EROFS:()=>jGe,ERR_DIR_CLOSED:()=>yU});function Cc(t,e){return Object.assign(new Error(`${t}: ${e}`),{code:t})}function NGe(t){return Cc("EBUSY",t)}function OGe(t,e){return Cc("ENOSYS",`${t}, ${e}`)}function LGe(t){return Cc("EINVAL",`invalid argument, ${t}`)}function Mo(t){return Cc("EBADF",`bad file descriptor, ${t}`)}function MGe(t){return Cc("ENOENT",`no such file or directory, ${t}`)}function UGe(t){return Cc("ENOTDIR",`not a directory, ${t}`)}function _Ge(t){return Cc("EISDIR",`illegal operation on a directory, ${t}`)}function HGe(t){return Cc("EEXIST",`file already exists, ${t}`)}function jGe(t){return Cc("EROFS",`read-only filesystem, ${t}`)}function GGe(t){return Cc("ENOTEMPTY",`directory not empty, ${t}`)}function qGe(t){return Cc("EOPNOTSUPP",`operation not supported, ${t}`)}function yU(){return Cc("ERR_DIR_CLOSED","Directory handle was closed")}var zP=Xe(()=>{});var $a={};Vt($a,{BigIntStatsEntry:()=>iE,DEFAULT_MODE:()=>CU,DirEntry:()=>EU,StatEntry:()=>nE,areStatsEqual:()=>wU,clearStats:()=>XP,convertToBigIntStats:()=>YGe,makeDefaultStats:()=>VZ,makeEmptyStats:()=>WGe});function VZ(){return new nE}function WGe(){return XP(VZ())}function XP(t){for(let e in t)if(Object.hasOwn(t,e)){let r=t[e];typeof r=="number"?t[e]=0:typeof r=="bigint"?t[e]=BigInt(0):IU.types.isDate(r)&&(t[e]=new Date(0))}return t}function YGe(t){let e=new iE;for(let r in t)if(Object.hasOwn(t,r)){let s=t[r];typeof s=="number"?e[r]=BigInt(s):IU.types.isDate(s)&&(e[r]=new Date(s))}return e.atimeNs=e.atimeMs*BigInt(1e6),e.mtimeNs=e.mtimeMs*BigInt(1e6),e.ctimeNs=e.ctimeMs*BigInt(1e6),e.birthtimeNs=e.birthtimeMs*BigInt(1e6),e}function wU(t,e){if(t.atimeMs!==e.atimeMs||t.birthtimeMs!==e.birthtimeMs||t.blksize!==e.blksize||t.blocks!==e.blocks||t.ctimeMs!==e.ctimeMs||t.dev!==e.dev||t.gid!==e.gid||t.ino!==e.ino||t.isBlockDevice()!==e.isBlockDevice()||t.isCharacterDevice()!==e.isCharacterDevice()||t.isDirectory()!==e.isDirectory()||t.isFIFO()!==e.isFIFO()||t.isFile()!==e.isFile()||t.isSocket()!==e.isSocket()||t.isSymbolicLink()!==e.isSymbolicLink()||t.mode!==e.mode||t.mtimeMs!==e.mtimeMs||t.nlink!==e.nlink||t.rdev!==e.rdev||t.size!==e.size||t.uid!==e.uid)return!1;let r=t,s=e;return!(r.atimeNs!==s.atimeNs||r.mtimeNs!==s.mtimeNs||r.ctimeNs!==s.ctimeNs||r.birthtimeNs!==s.birthtimeNs)}var IU,CU,EU,nE,iE,BU=Xe(()=>{IU=ut(Ie("util")),CU=33188,EU=class{constructor(){this.name="";this.path="";this.mode=0}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&61440)===16384}isFIFO(){return!1}isFile(){return(this.mode&61440)===32768}isSocket(){return!1}isSymbolicLink(){return(this.mode&61440)===40960}},nE=class{constructor(){this.uid=0;this.gid=0;this.size=0;this.blksize=0;this.atimeMs=0;this.mtimeMs=0;this.ctimeMs=0;this.birthtimeMs=0;this.atime=new Date(0);this.mtime=new Date(0);this.ctime=new Date(0);this.birthtime=new Date(0);this.dev=0;this.ino=0;this.mode=CU;this.nlink=1;this.rdev=0;this.blocks=1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&61440)===16384}isFIFO(){return!1}isFile(){return(this.mode&61440)===32768}isSocket(){return!1}isSymbolicLink(){return(this.mode&61440)===40960}},iE=class{constructor(){this.uid=BigInt(0);this.gid=BigInt(0);this.size=BigInt(0);this.blksize=BigInt(0);this.atimeMs=BigInt(0);this.mtimeMs=BigInt(0);this.ctimeMs=BigInt(0);this.birthtimeMs=BigInt(0);this.atimeNs=BigInt(0);this.mtimeNs=BigInt(0);this.ctimeNs=BigInt(0);this.birthtimeNs=BigInt(0);this.atime=new Date(0);this.mtime=new Date(0);this.ctime=new Date(0);this.birthtime=new Date(0);this.dev=BigInt(0);this.ino=BigInt(0);this.mode=BigInt(CU);this.nlink=BigInt(1);this.rdev=BigInt(0);this.blocks=BigInt(1)}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){reLine truncated
`).length,s=e.length-r;return r>s?`\r
`:`
`}function Ed(t,e){return e.replace(/\r?\n/g,s5e(t))}var r$,n$,mp,Uf,Id=Xe(()=>{r$=Ie("crypto"),n$=Ie("os");DU();el();mp=class{constructor(e){this.pathUtils=e}async*genTraversePromise(e,{stableSort:r=!1}={}){let s=[e];for(;s.length>0;){let a=s.shift();if((await this.lstatPromise(a)).isDirectory()){let c=await this.readdirPromise(a);if(r)for(let f of c.sort())s.push(this.pathUtils.join(a,f));else throw new Error("Not supported")}else yield a}}async checksumFilePromise(e,{algorithm:r="sha512"}={}){let s=await this.openPromise(e,"r");try{let n=Buffer.allocUnsafeSlow(65536),c=(0,r$.createHash)(r),f=0;for(;(f=await this.readPromise(s,n,0,65536))!==0;)c.update(f===65536?n:n.slice(0,f));return c.digest("hex")}finally{await this.closePromise(s)}}async removePromise(e,{recursive:r=!0,maxRetries:s=5}={}){let a;try{a=await this.lstatPromise(e)}catch(n){if(n.code==="ENOENT")return;throw n}if(a.isDirectory()){if(r){let n=await this.readdirPromise(e);await Promise.all(n.map(c=>this.removePromise(this.pathUtils.resolve(e,c))))}for(let n=0;n<=s;n++)try{await this.rmdirPromise(e);break}catch(c){if(c.code!=="EBUSY"&&c.code!=="ENOTEMPTY")throw c;n<s&&await new Promise(f=>setTimeout(f,n*100))}}else await this.unlinkPromise(e)}removeSync(e,{recursive:r=!0}={}){let s;try{s=this.lstatSync(e)}catch(a){if(a.code==="ENOENT")return;throw a}if(s.isDirectory()){if(r)for(let a of this.readdirSync(e))this.removeSync(this.pathUtils.resolve(e,a));this.rmdirSync(e)}else this.unlinkSync(e)}async mkdirpPromise(e,{chmod:r,utimes:s}={}){if(e=this.resolve(e),e===this.pathUtils.dirname(e))return;let a=e.split(this.pathUtils.sep),n;for(let c=2;c<=a.length;++c){let f=a.slice(0,c).join(this.pathUtils.sep);if(!this.existsSync(f)){try{await this.mkdirPromise(f)}catch(p){if(p.code==="EEXIST")continue;throw p}if(n??=f,r!=null&&await this.chmodPromise(f,r),s!=null)await this.utimesPromise(f,s[0],s[1]);else{let p=await this.statPromise(this.pathUtils.dirname(f));await this.utimesPromise(f,p.atime,p.mtime)}}}return n}mkdirpSync(e,{chmod:r,utimes:s}={}){if(e=this.resolve(e),e===this.pathUtils.dirname(e))return;let a=e.split(this.pathUtils.sep),n;for(let c=2;c<=a.length;++c){let f=a.slice(0,c).join(this.pathUtils.sep);if(!this.existsSync(f)){try{this.mkdirSync(f)}catch(p){if(p.code==="EEXIST")continue;throw p}if(n??=f,r!=null&&this.chmodSync(f,r),s!=null)this.utimesSync(f,s[0],s[1]);else{let p=this.statSync(this.pathUtils.dirname(f));this.utimesSync(f,p.atime,p.mtime)}}}return n}async copyPromise(e,r,{baseFs:s=this,overwrite:a=!0,stableSort:n=!1,stableTime:c=!1,linkStrategy:f=null}={}){return await zZ(this,e,s,r,{overwrite:a,stableSort:n,stableTime:c,linkStrategy:f})}copySync(e,r,{baseFs:s=this,overwrite:a=!0}={}){let n=s.lstatSync(r),c=this.existsSync(e);if(n.isDirectory()){this.mkdirpSync(e);let p=s.readdirSync(r);for(let h of p)this.copySync(this.pathUtils.join(e,h),s.pathUtils.join(r,h),{baseFs:s,overwrite:a})}else if(n.isFile()){if(!c||a){c&&this.removeSync(e);let p=s.readFileSync(r);this.writeFileSync(e,p)}}else if(n.isSymbolicLink()){if(!c||a){c&&this.removeSync(e);let p=s.readlinkSync(r);this.symlinkSync(ZP(this.pathUtils,p),e)}}else throw new Error(`Unsupported file type (file: ${r}, mode: 0o${n.mode.toString(8).padStart(6,"0")})`);let f=n.mode&511;this.chmodSync(e,f)}async changeFilePromise(e,r,s={}){return Buffer.isBuffer(r)?this.changeFileBufferPromise(e,r,s):this.changeFileTextPromise(e,r,s)}async changeFileBufferPromise(e,r,{mode:s}={}){let a=Buffer.alloc(0);try{a=await this.readFilePromise(e)}catch{}Buffer.compare(a,r)!==0&&await this.writeFilePromise(e,r,{mode:s})}async changeFileTextPromise(e,r,{automaticNewlines:s,mode:a}={}){let n="";try{n=await this.readFilePromise(e,"utf8")}catch{}let c=s?Ed(n,r):r;n!==c&&await this.writeFilePromise(e,c,{mode:a})}changeFileSync(e,r,s={}){return Buffer.isBuffer(r)?this.changeFileBufferSync(e,r,s):this.changeFileTextSync(e,r,s)}changeFileBufferSync(e,r,{mode:s}={}){let a=Buffer.alloc(0);try{a=this.readFileSync(e)}catch{}Buffer.compare(a,r)!==0&&this.writeFileSync(e,r,{mode:s})}changeFileTextSync(e,r,{automaticNewlines:s=!1,mode:a}={}){let n="";try{n=this.readFileSync(e,"utf8")}catch{}let c=s?Ed(n,r):r;n!==c&&this.writeFileSync(e,c,{mode:a})}async movePromise(e,r){try{await this.renamePromise(e,r)}catch(s){if(s.code==="EXDEV")await this.copyPromise(r,e),await this.removePromise(e);else throw s}}moveSync(e,r){try{this.renameSync(e,r)}catch(s){if(s.code==="EXDEV")this.copySync(r,e),this.removeSync(e);else throw s}}async lockPromise(e,r){let s=`${e}.flock`,a=1e3/60,n=Date.now(),c=null,f=async()=>{let p;try{[p]=await this.readJsonPromise(s)}catch{return Date.now()-n<500}try{return process.kill(p,0),!0}catch{return!1}};for(;c===null;)try{c=await this.openPromise(s,"wx")}catch(p){if(p.code==="EEXIST"){if(!await f())try{await this.unlinkPromise(s);continue}catch{}if(Date.now()-n<60*1e3)await new Promise(h=>setTimeout(h,a));else throw new Error(`Couldn't acquire a lock in a reasonable time (via ${s})`)}else throw Line truncated
`)}writeJsonSync(e,r,{compact:s=!1}={}){let a=s?0:2;return this.writeFileSync(e,`${JSON.stringify(r,null,a)}
`)}async preserveTimePromise(e,r){let s=await this.lstatPromise(e),a=await r();typeof a<"u"&&(e=a),await this.lutimesPromise(e,s.atime,s.mtime)}async preserveTimeSync(e,r){let s=this.lstatSync(e),a=r();typeof a<"u"&&(e=a),this.lutimesSync(e,s.atime,s.mtime)}},Uf=class extends mp{constructor(){super(J)}}});var _s,yp=Xe(()=>{Id();_s=class extends mp{getExtractHint(e){return this.baseFs.getExtractHint(e)}resolve(e){return this.mapFromBase(this.baseFs.resolve(this.mapToBase(e)))}getRealPath(){return this.mapFromBase(this.baseFs.getRealPath())}async openPromise(e,r,s){return this.baseFs.openPromise(this.mapToBase(e),r,s)}openSync(e,r,s){return this.baseFs.openSync(this.mapToBase(e),r,s)}async opendirPromise(e,r){return Object.assign(await this.baseFs.opendirPromise(this.mapToBase(e),r),{path:e})}opendirSync(e,r){return Object.assign(this.baseFs.opendirSync(this.mapToBase(e),r),{path:e})}async readPromise(e,r,s,a,n){return await this.baseFs.readPromise(e,r,s,a,n)}readSync(e,r,s,a,n){return this.baseFs.readSync(e,r,s,a,n)}async writePromise(e,r,s,a,n){return typeof r=="string"?await this.baseFs.writePromise(e,r,s):await this.baseFs.writePromise(e,r,s,a,n)}writeSync(e,r,s,a,n){return typeof r=="string"?this.baseFs.writeSync(e,r,s):this.baseFs.writeSync(e,r,s,a,n)}async closePromise(e){return this.baseFs.closePromise(e)}closeSync(e){this.baseFs.closeSync(e)}createReadStream(e,r){return this.baseFs.createReadStream(e!==null?this.mapToBase(e):e,r)}createWriteStream(e,r){return this.baseFs.createWriteStream(e!==null?this.mapToBase(e):e,r)}async realpathPromise(e){return this.mapFromBase(await this.baseFs.realpathPromise(this.mapToBase(e)))}realpathSync(e){return this.mapFromBase(this.baseFs.realpathSync(this.mapToBase(e)))}async existsPromise(e){return this.baseFs.existsPromise(this.mapToBase(e))}existsSync(e){return this.baseFs.existsSync(this.mapToBase(e))}accessSync(e,r){return this.baseFs.accessSync(this.mapToBase(e),r)}async accessPromise(e,r){return this.baseFs.accessPromise(this.mapToBase(e),r)}async statPromise(e,r){return this.baseFs.statPromise(this.mapToBase(e),r)}statSync(e,r){return this.baseFs.statSync(this.mapToBase(e),r)}async fstatPromise(e,r){return this.baseFs.fstatPromise(e,r)}fstatSync(e,r){return this.baseFs.fstatSync(e,r)}lstatPromise(e,r){return this.baseFs.lstatPromise(this.mapToBase(e),r)}lstatSync(e,r){return this.baseFs.lstatSync(this.mapToBase(e),r)}async fchmodPromise(e,r){return this.baseFs.fchmodPromise(e,r)}fchmodSync(e,r){return this.baseFs.fchmodSync(e,r)}async chmodPromise(e,r){return this.baseFs.chmodPromise(this.mapToBase(e),r)}chmodSync(e,r){return this.baseFs.chmodSync(this.mapToBase(e),r)}async fchownPromise(e,r,s){return this.baseFs.fchownPromise(e,r,s)}fchownSync(e,r,s){return this.baseFs.fchownSync(e,r,s)}async chownPromise(e,r,s){return this.baseFs.chownPromise(this.mapToBase(e),r,s)}chownSync(e,r,s){return this.baseFs.chownSync(this.mapToBase(e),r,s)}async renamePromise(e,r){return this.baseFs.renamePromise(this.mapToBase(e),this.mapToBase(r))}renameSync(e,r){return this.baseFs.renameSync(this.mapToBase(e),this.mapToBase(r))}async copyFilePromise(e,r,s=0){return this.baseFs.copyFilePromise(this.mapToBase(e),this.mapToBase(r),s)}copyFileSync(e,r,s=0){return this.baseFs.copyFileSync(this.mapToBase(e),this.mapToBase(r),s)}async appendFilePromise(e,r,s){return this.baseFs.appendFilePromise(this.fsMapToBase(e),r,s)}appendFileSync(e,r,s){return this.baseFs.appendFileSync(this.fsMapToBase(e),r,s)}async writeFilePromise(e,r,s){return this.baseFs.writeFilePromise(this.fsMapToBase(e),r,s)}writeFileSync(e,r,s){return this.baseFs.writeFileSync(this.fsMapToBase(e),r,s)}async unlinkPromise(e){return this.baseFs.unlinkPromise(this.mapToBase(e))}unlinkSync(e){return this.baseFs.unlinkSync(this.mapToBase(e))}async utimesPromise(e,r,s){return this.baseFs.utimesPromise(this.mapToBase(e),r,s)}utimesSync(e,r,s){return this.baseFs.utimesSync(this.mapToBase(e),r,s)}async lutimesPromise(e,r,s){return this.baseFs.lutimesPromise(this.mapToBase(e),r,s)}lutimesSync(e,r,s){return this.baseFs.lutimesSync(this.mapToBase(e),r,s)}async mkdirPromise(e,r){return this.baseFs.mkdirPromise(this.mapToBase(e),r)}mkdirSync(e,r){return this.baseFs.mkdirSync(this.mapToBase(e),r)}async rmdirPromise(e,r){return this.baseFs.rmdirPromise(this.mapToBase(e),r)}rmdirSync(e,r){return this.baseFs.rmdirSync(this.mapToBase(e),r)}async rmPromise(e,r){return this.baseFs.rmPromise(this.mapToBase(e),r)}rmSync(e,r){return this.baseFs.rmSync(this.mapToBase(e),r)}async linkPromise(e,r){return this.baseFs.linkPromise(this.mapToBase(e),this.mapToBase(r))}linkSync(e,r){return this.baseFs.linkSync(this.mapToBase(e),this.mapToBase(r))}async symlinkPromise(e,r,s){let a=this.mapToBase(r);if(this.pathUtils.isAbsolute(e))return this.baseFs.symlinkPromise(this.mapToBase(e),a,s);let n=this.mapToBase(this.pathUtils.join(this.pathUtils.dirname(r),e)),c=this.baseFs.pathUtils.relative(this.baseFs.pathUtils.dirname(a),n);return this.baseFs.symlinkP Line truncated
`,TA=ur(`\\
`,!1),RA=function(){return""},oa="\\",aa=ur("\\",!1),FA=/^[\\$"`]/,gr=zi(["\\","$",'"',"`"],!1,!1),Bo=function(O){return O},Me="\\a",cu=ur("\\a",!1),Cr=function(){return"a"},pf="\\b",NA=ur("\\b",!1),OA=function(){return"\b"},uu=/^[Ee]/,fu=zi(["E","e"],!1,!1),oc=function(){return"\x1B"},ve="\\f",Nt=ur("\\f",!1),ac=function(){return"\f"},Oi="\\n",no=ur("\\n",!1),Rt=function(){return`
`},xn="\\r",la=ur("\\r",!1),Gi=function(){return"\r"},Li="\\t",Na=ur("\\t",!1),dn=function(){return" "},Kn="\\v",Au=ur("\\v",!1),yh=function(){return"\v"},Oa=/^[\\'"?]/,La=zi(["\\","'",'"',"?"],!1,!1),Ma=function(O){return String.fromCharCode(parseInt(O,16))},$e="\\x",Ua=ur("\\x",!1),hf="\\u",lc=ur("\\u",!1),wn="\\U",ca=ur("\\U",!1),LA=function(O){return String.fromCodePoint(parseInt(O,16))},MA=/^[0-7]/,ua=zi([["0","7"]],!1,!1),Bl=/^[0-9a-fA-f]/,Mt=zi([["0","9"],["a","f"],["A","f"]],!1,!1),kn=yf(),fa="{}",Ha=ur("{}",!1),ns=function(){return"{}"},cc="-",pu=ur("-",!1),uc="+",ja=ur("+",!1),Mi=".",Is=ur(".",!1),vl=function(O,K,re){return{type:"number",value:(O==="-"?-1:1)*parseFloat(K.join("")+"."+re.join(""))}},gf=function(O,K){return{type:"number",value:(O==="-"?-1:1)*parseInt(K.join(""))}},fc=function(O){return{type:"variable",...O}},wi=function(O){return{type:"variable",name:O}},Qn=function(O){return O},Ac="*",Ke=ur("*",!1),st="/",St=ur("/",!1),lr=function(O,K,re){return{type:K==="*"?"multiplication":"division",right:re}},te=function(O,K){return K.reduce((re,de)=>({left:re,...de}),O)},Ee=function(O,K,re){return{type:K==="+"?"addition":"subtraction",right:re}},Oe="$((",dt=ur("$((",!1),Et="))",bt=ur("))",!1),tr=function(O){return O},An="$(",li=ur("$(",!1),qi=function(O){return O},Tn="${",Ga=ur("${",!1),my=":-",Z1=ur(":-",!1),vo=function(O,K){return{name:O,defaultValue:K}},yy=":-}",Eh=ur(":-}",!1),$1=function(O){return{name:O,defaultValue:[]}},So=":+",Ih=ur(":+",!1),Ch=function(O,K){return{name:O,alternativeValue:K}},hu=":+}",wh=ur(":+}",!1),Fg=function(O){return{name:O,alternativeValue:[]}},Ng=function(O){return{name:O}},Og="$",Ey=ur("$",!1),df=function(O){return e.isGlobPattern(O)},Do=function(O){return O},Sl=/^[a-zA-Z0-9_]/,Bh=zi([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),Lg=function(){return By()},Dl=/^[$@*?#a-zA-Z0-9_\-]/,bl=zi(["$","@","*","?","#",["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),Iy=/^[()}<>$|&; \t"']/,UA=zi(["(",")","}","<",">","$","|","&",";"," "," ",'"',"'"],!1,!1),Cy=/^[<>&; \t"']/,wy=zi(["<",">","&",";"," "," ",'"',"'"],!1,!1),_A=/^[ \t]/,HA=zi([" "," "],!1,!1),Y=0,xt=0,jA=[{line:1,column:1}],bo=0,mf=[],yt=0,gu;if("startRule"in e){if(!(e.startRule in s))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=s[e.startRule]}function By(){return t.substring(xt,Y)}function Mg(){return Ef(xt,Y)}function e2(O,K){throw K=K!==void 0?K:Ef(xt,Y),GA([Ug(O)],t.substring(xt,Y),K)}function vh(O,K){throw K=K!==void 0?K:Ef(xt,Y),di(O,K)}function ur(O,K){return{type:"literal",text:O,ignoreCase:K}}function zi(O,K,re){return{type:"class",parts:O,inverted:K,ignoreCase:re}}function yf(){return{type:"any"}}function qa(){return{type:"end"}}function Ug(O){return{type:"other",description:O}}function du(O){var K=jA[O],re;if(K)return K;for(re=O-1;!jA[re];)re--;for(K=jA[re],K={line:K.line,column:K.column};re<O;)t.charCodeAt(re)===10?(K.line++,K.column=1):K.column++,re++;return jA[O]=K,K}function Ef(O,K){var re=du(O),de=du(K);return{start:{offset:O,line:re.line,column:re.column},end:{offset:K,line:de.line,column:de.column}}}function wt(O){Y<bo||(Y>bo&&(bo=Y,mf=[]),mf.push(O))}function di(O,K){return new Bd(O,null,null,K)}function GA(O,K,re){return new Bd(Bd.buildMessage(O,K),O,K,re)}function Wa(){var O,K,re;for(O=Y,K=[],re=kt();re!==r;)K.push(re),re=kt();return K!==r?(re=Aa(),re===r&&(re=null),re!==r?(xt=O,K=n(re),O=K):(Y=O,O=r)):(Y=O,O=r),O}function Aa(){var O,K,re,de,Je;if(O=Y,K=Sh(),K!==r){for(re=[],de=kt();de!==r;)re.push(de),de=kt();re!==r?(de=_g(),de!==r?(Je=Ya(),Je===r&&(Je=null),Je!==r?(xt=O,K=c(K,de,Je),O=K):(Y=O,O=r)):(Y=O,O=r)):(Y=O,O=r)}else Y=O,O=r;if(O===r)if(O=Y,K=Sh(),K!==r){for(re=[],de=kt();de!==r;)re.push(de),de=kt();re!==r?(de=_g(),de===r&&(de=null),de!==r?(xt=O,K=f(K,de),O=K):(Y=O,O=r)):(Y=O,O=r)}else Y=O,O=r;return O}function Ya(){var O,K,re,de,Je;for(O=Y,K=[],re=kt();re!==r;)K.push(re),re=kt();if(K!==r)if(re=Aa(),re!==r){for(de=[],Je=kt();Je!==r;)de.push(Je),Je=kt();de!==r?(xt=O,K=p(re),O=K):(Y=O,O=r)}else Y=O,O=r;else Y=O,O=r;return O}function _g(){var O;return t.charCodeAt(Y)===59?(O=h,Y++):(O=r,yt===0&&wt(E)),O===r&&(t.charCodeAt(Y)===38?(O=C,Y++):(O=r,yt===0&&wt(S))),O}function Sh(){var O,K,re;return O=Y,K=qA(),K!==r?(re=Hg(),re===r&&(re=null),re!==r?(xt=O,K=P(K,re),O=K):(Y=O,O=r)):(Y=O,O=r),O}function Hg(){var O,K,re,de,Je,At,dr;for(O=Y,K=[],re=kt();re!==r;)K.push(re),re=kt();if(K!==r)if(re=vy(),re!==r){for(de=[],Je=kt();Je!==r;)de.push(Je),Je=kt();if(de!==r)if(Je=Sh(),Je!==r){for(At=[],dr=kt();dr!==r;)At.push(dr),dr=kt();At!==r?(xt=O,K=I(re,Je),O=K):(Y=O,O=r)}else Y=O,O=r;else Y=O,O=r}else Y=O,O=r;else Y=O,O=r;return O}function vy(){var O;return t.substr(Y,2)===R?(O=R,Y+=2):(O=r,yt===0&&wt(N)),O===r&&(t.substr(Y,2)===U?(O=U,Y+=2):(O=r,yt===0&&wt(W))),O}function qA(){var O,K,re;return O=Y,K=If(),K!==r?(re=jg(),re===r&&(re=null),re!==r?(xt=O,K=ee(K,re),O=K):(Y=O,O=r)):(Y=O,O=r),O}function jg(){var O,K,re,de,Je,At,dr;for(O=Y,K=[],re=kt();re!==r;)K.push(re),re=kt();if(K!==r)Line truncated
`,"\\n"],["\r","\\r"],[" ","\\t"],["\v","\\v"],["\0","\\0"]]),M5e=new Map([["\\","\\\\"],["$","\\$"],['"','\\"'],...Array.from(Iee,([t,e])=>[t,`"$'${e}'"`])]),Cee=t=>Iee.get(t)??`\\x${t.charCodeAt(0).toString(16).padStart(2,"0")}`,U5e=t=>M5e.get(t)??`"$'${Cee(t)}'"`});var vee=_((eQt,Bee)=>{"use strict";function _5e(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function Sd(t,e,r,s){this.message=t,this.expected=e,this.found=r,this.location=s,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Sd)}_5e(Sd,Error);Sd.buildMessage=function(t,e){var r={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var E="",C;for(C=0;C<h.parts.length;C++)E+=h.parts[C]instanceof Array?n(h.parts[C][0])+"-"+n(h.parts[C][1]):n(h.parts[C]);return"["+(h.inverted?"^":"")+E+"]"},any:function(h){return"any character"},end:function(h){return"end of input"},other:function(h){return h.description}};function s(h){return h.charCodeAt(0).toString(16).toUpperCase()}function a(h){return h.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(E){return"\\x0"+s(E)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(E){return"\\x"+s(E)})}function n(h){return h.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(E){return"\\x0"+s(E)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(E){return"\\x"+s(E)})}function c(h){return r[h.type](h)}function f(h){var E=new Array(h.length),C,S;for(C=0;C<h.length;C++)E[C]=c(h[C]);if(E.sort(),E.length>0){for(C=1,S=1;C<E.length;C++)E[C-1]!==E[C]&&(E[S]=E[C],S++);E.length=S}switch(E.length){case 1:return E[0];case 2:return E[0]+" or "+E[1];default:return E.slice(0,-1).join(", ")+", or "+E[E.length-1]}}function p(h){return h?'"'+a(h)+'"':"end of input"}return"Expected "+f(t)+" but "+p(e)+" found."};function H5e(t,e){e=e!==void 0?e:{};var r={},s={resolution:Ne},a=Ne,n="/",c=ye("/",!1),f=function(Ue,x){return{from:Ue,descriptor:x}},p=function(Ue){return{descriptor:Ue}},h="@",E=ye("@",!1),C=function(Ue,x){return{fullName:Ue,description:x}},S=function(Ue){return{fullName:Ue}},P=function(){return Be()},I=/^[^\/@]/,R=Ae(["/","@"],!0,!1),N=/^[^\/]/,U=Ae(["/"],!0,!1),W=0,ee=0,ie=[{line:1,column:1}],ue=0,le=[],me=0,pe;if("startRule"in e){if(!(e.startRule in s))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=s[e.startRule]}function Be(){return t.substring(ee,W)}function Ce(){return mt(ee,W)}function g(Ue,x){throw x=x!==void 0?x:mt(ee,W),Fe([De(Ue)],t.substring(ee,W),x)}function we(Ue,x){throw x=x!==void 0?x:mt(ee,W),rt(Ue,x)}function ye(Ue,x){return{type:"literal",text:Ue,ignoreCase:x}}function Ae(Ue,x,w){return{type:"class",parts:Ue,inverted:x,ignoreCase:w}}function se(){return{type:"any"}}function Z(){return{type:"end"}}function De(Ue){return{type:"other",description:Ue}}function Re(Ue){var x=ie[Ue],w;if(x)return x;for(w=Ue-1;!ie[w];)w--;for(x=ie[w],x={line:x.line,column:x.column};w<Ue;)t.charCodeAt(w)===10?(x.line++,x.column=1):x.column++,w++;return ie[Ue]=x,x}function mt(Ue,x){var w=Re(Ue),b=Re(x);return{start:{offset:Ue,line:w.line,column:w.column},end:{offset:x,line:b.line,column:b.column}}}function j(Ue){W<ue||(W>ue&&(ue=W,le=[]),le.push(Ue))}function rt(Ue,x){return new Sd(Ue,null,null,x)}function Fe(Ue,x,w){return new Sd(Sd.buildMessage(Ue,x),Ue,x,w)}function Ne(){var Ue,x,w,b;return Ue=W,x=Pe(),x!==r?(t.charCodeAt(W)===47?(w=n,W++):(w=r,me===0&&j(c)),w!==r?(b=Pe(),b!==r?(ee=Ue,x=f(x,b),Ue=x):(W=Ue,Ue=r)):(W=Ue,Ue=r)):(W=Ue,Ue=r),Ue===r&&(Ue=W,x=Pe(),x!==r&&(ee=Ue,x=p(x)),Ue=x),Ue}function Pe(){var Ue,x,w,b;return Ue=W,x=Ve(),x!==r?(t.charCodeAt(W)===64?(w=h,W++):(w=r,me===0&&j(E)),w!==r?(b=it(),b!==r?(ee=Ue,x=C(x,b),Ue=x):(W=Ue,Ue=r)):(W=Ue,Ue=r)):(W=Ue,Ue=r),Ue===r&&(Ue=W,x=Ve(),x!==r&&(ee=Ue,x=S(x)),Ue=x),Ue}function Ve(){var Ue,x,w,b,y;return Ue=W,t.charCodeAt(W)===64?(x=h,W++):(x=r,me===0&&j(E)),x!==r?(w=ke(),w!==r?(t.charCodeAt(W)===47?(b=n,W++):(b=r,me===0&&j(c)),b!==r?(y=ke(),y!==r?(ee=Ue,x=P(),Ue=x):(W=Ue,Ue=r)):(W=Ue,Ue=r)):(W=Ue,Ue=r)):(W=Ue,Ue=r),Ue===r&&(Ue=W,x=ke(),x!==r&&(ee=Ue,x=P()),Ue=x),Ue}function ke(){var Ue,x,w;if(Ue=W,x=[],I.test(t.charAt(W))?(w=t.charAt(W),W++):(w=r,me===0&&j(R)),w!==r)for(;w!==r;)x.push(w),I.test(t.charAt(W))?(w=t.charAt(W),W++):(w=r,me===0&&j(R));else x=r;return x!==r&&(ee=Ue,x=P()),Ue=x,Ue}function it(){var Ue,x,w;if(Ue=W,x=[],N.test(t.charAt(W))?(w=t.charAt(W),W++):(w=r,me===0&&j(U)),w!==r)for(;w!==r;)x.push(w),N.test(t.charAt(W))?(w=t.charAt(W),W++):(w=r,me===0&&j(U));else x=r;return x!==r&&(ee=Ue,x=P()),Ue=x,Ue}if(pe=a(),pe!==r&&W===t.length)return pe;throw pe!==r&&W<t.length&&j(Z()),Fe(le,ue<t.length?t.charAt(ue):null,ue<t.length?mt(ue,ue+1):mt(ue,ue))}Bee.exports={SyntaxError:Sd,parse:H5e}});function px(t){let e=t.match(/^\*{1,Line truncated
\x85\u2028\u2029`.indexOf(this.buffer.charAt(a-1))===-1;)if(a-=1,this.position-a>r/2-1){s=" ... ",a+=5;break}for(n="",c=this.position;c<this.buffer.length&&`\0\r
\x85\u2028\u2029`.indexOf(this.buffer.charAt(c))===-1;)if(c+=1,c-this.position>r/2-1){n=" ... ",c-=5;break}return f=this.buffer.slice(a,c),xee.repeat(" ",e)+s+f+n+`
`+xee.repeat(" ",e+this.position-a+s.length)+"^"};YU.prototype.toString=function(e){var r,s="";return this.name&&(s+='in "'+this.name+'" '),s+="at line "+(this.line+1)+", column "+(this.column+1),e||(r=this.getSnippet(),r&&(s+=`:
`+r)),s};kee.exports=YU});var Ss=_((sQt,Ree)=>{"use strict";var Tee=pE(),V5e=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],J5e=["scalar","sequence","mapping"];function K5e(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(s){e[String(s)]=r})}),e}function z5e(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(V5e.indexOf(r)===-1)throw new Tee('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')}),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(r){return r},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=K5e(e.styleAliases||null),J5e.indexOf(this.kind)===-1)throw new Tee('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}Ree.exports=z5e});var Pd=_((oQt,Nee)=>{"use strict";var Fee=bd(),gx=pE(),X5e=Ss();function VU(t,e,r){var s=[];return t.include.forEach(function(a){r=VU(a,e,r)}),t[e].forEach(function(a){r.forEach(function(n,c){n.tag===a.tag&&n.kind===a.kind&&s.push(c)}),r.push(a)}),r.filter(function(a,n){return s.indexOf(n)===-1})}function Z5e(){var t={scalar:{},sequence:{},mapping:{},fallback:{}},e,r;function s(a){t[a.kind][a.tag]=t.fallback[a.tag]=a}for(e=0,r=arguments.length;e<r;e+=1)arguments[e].forEach(s);return t}function hE(t){this.include=t.include||[],this.implicit=t.implicit||[],this.explicit=t.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&e.loadKind!=="scalar")throw new gx("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=VU(this,"implicit",[]),this.compiledExplicit=VU(this,"explicit",[]),this.compiledTypeMap=Z5e(this.compiledImplicit,this.compiledExplicit)}hE.DEFAULT=null;hE.create=function(){var e,r;switch(arguments.length){case 1:e=hE.DEFAULT,r=arguments[0];break;case 2:e=arguments[0],r=arguments[1];break;default:throw new gx("Wrong number of arguments for Schema.create function")}if(e=Fee.toArray(e),r=Fee.toArray(r),!e.every(function(s){return s instanceof hE}))throw new gx("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!r.every(function(s){return s instanceof X5e}))throw new gx("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new hE({include:e,explicit:r})};Nee.exports=hE});var Lee=_((aQt,Oee)=>{"use strict";var $5e=Ss();Oee.exports=new $5e("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}})});var Uee=_((lQt,Mee)=>{"use strict";var eqe=Ss();Mee.exports=new eqe("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}})});var Hee=_((cQt,_ee)=>{"use strict";var tqe=Ss();_ee.exports=new tqe("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}})});var dx=_((uQt,jee)=>{"use strict";var rqe=Pd();jee.exports=new rqe({explicit:[Lee(),Uee(),Hee()]})});var qee=_((fQt,Gee)=>{"use strict";var nqe=Ss();function iqe(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}function sqe(){return null}function oqe(t){return t===null}Gee.exports=new nqe("tag:yaml.org,2002:null",{kind:"scalar",resolve:iqe,construct:sqe,predicate:oqe,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var Yee=_((AQt,Wee)=>{"use strict";var aqe=Ss();function lqe(t){if(t===null)return!1;var e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}function cqe(t){return t==="true"||t==="True"||t==="TRUE"}function uqe(t){return Object.prototype.toString.call(t)==="[object Boolean]"}Wee.exports=new aqe("tag:yaml.org,2002:bool",{kind:"scalar",resolve:lqe,construct:cqe,predicate:uqe,represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"})});var Jee=_((pQt,Vee)=>{"use strict";var fqe=bd(),Aqe=Ss();function pqe(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}function hqe(t){return 48<=t&&t<=55}function gqe(t){return 48<=t&&t<=57}function dqe(t){if(t===null)return!1;var e=t.length,r=0,s=!1,a;if(!e)return!1;if(a=t[r],(a==="-"||a==="+")&&(a=t[++r]),a==="0"){if(r+1===e)return!0;if(a=t[++r],a==="b"){for(r++;r<e;r++)if(a=t[r],a!=="_"){if(a!=="0"&&a!=="1")return!1;s=!0}return s&&a!=="_"}if(a==="x"){for(r++;r<e;r++)if(a=t[r],a!=="_"){if(!pqe(t.charCodeAt(r)))return!1;s=!0}return s&&a!=="_"}for(;r<e;r++)if(a=t[r],a!=="_"){if(!hqe(t.charCodeAt(r)))return!1;s=!0}return s&&a!=="_"}if(a==="_")return!1;for(;r<e;r++)if(a=t[r],a!=="_"){if(a===":")break;if(!gqe(t.charCodeAt(r)))return!1;s=!0}return!s||a==="_"?!1:a!==":"?!0:/^( Line truncated
\r`;function Nqe(t){if(t===null)return!1;var e,r,s=0,a=t.length,n=zU;for(r=0;r<a;r++)if(e=n.indexOf(t.charAt(r)),!(e>64)){if(e<0)return!1;s+=6}return s%8===0}function Oqe(t){var e,r,s=t.replace(/[\r\n=]/g,""),a=s.length,n=zU,c=0,f=[];for(e=0;e<a;e++)e%4===0&&e&&(f.push(c>>16&255),f.push(c>>8&255),f.push(c&255)),c=c<<6|n.indexOf(s.charAt(e));return r=a%4*6,r===0?(f.push(c>>16&255),f.push(c>>8&255),f.push(c&255)):r===18?(f.push(c>>10&255),f.push(c>>2&255)):r===12&&f.push(c>>4&255),xd?xd.from?xd.from(f):new xd(f):f}function Lqe(t){var e="",r=0,s,a,n=t.length,c=zU;for(s=0;s<n;s++)s%3===0&&s&&(e+=c[r>>18&63],e+=c[r>>12&63],e+=c[r>>6&63],e+=c[r&63]),r=(r<<8)+t[s];return a=n%3,a===0?(e+=c[r>>18&63],e+=c[r>>12&63],e+=c[r>>6&63],e+=c[r&63]):a===2?(e+=c[r>>10&63],e+=c[r>>4&63],e+=c[r<<2&63],e+=c[64]):a===1&&(e+=c[r>>2&63],e+=c[r<<4&63],e+=c[64],e+=c[64]),e}function Mqe(t){return xd&&xd.isBuffer(t)}ate.exports=new Fqe("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Nqe,construct:Oqe,predicate:Mqe,represent:Lqe})});var ute=_((CQt,cte)=>{"use strict";var Uqe=Ss(),_qe=Object.prototype.hasOwnProperty,Hqe=Object.prototype.toString;function jqe(t){if(t===null)return!0;var e=[],r,s,a,n,c,f=t;for(r=0,s=f.length;r<s;r+=1){if(a=f[r],c=!1,Hqe.call(a)!=="[object Object]")return!1;for(n in a)if(_qe.call(a,n))if(!c)c=!0;else return!1;if(!c)return!1;if(e.indexOf(n)===-1)e.push(n);else return!1}return!0}function Gqe(t){return t!==null?t:[]}cte.exports=new Uqe("tag:yaml.org,2002:omap",{kind:"sequence",resolve:jqe,construct:Gqe})});var Ate=_((wQt,fte)=>{"use strict";var qqe=Ss(),Wqe=Object.prototype.toString;function Yqe(t){if(t===null)return!0;var e,r,s,a,n,c=t;for(n=new Array(c.length),e=0,r=c.length;e<r;e+=1){if(s=c[e],Wqe.call(s)!=="[object Object]"||(a=Object.keys(s),a.length!==1))return!1;n[e]=[a[0],s[a[0]]]}return!0}function Vqe(t){if(t===null)return[];var e,r,s,a,n,c=t;for(n=new Array(c.length),e=0,r=c.length;e<r;e+=1)s=c[e],a=Object.keys(s),n[e]=[a[0],s[a[0]]];return n}fte.exports=new qqe("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Yqe,construct:Vqe})});var hte=_((BQt,pte)=>{"use strict";var Jqe=Ss(),Kqe=Object.prototype.hasOwnProperty;function zqe(t){if(t===null)return!0;var e,r=t;for(e in r)if(Kqe.call(r,e)&&r[e]!==null)return!1;return!0}function Xqe(t){return t!==null?t:{}}pte.exports=new Jqe("tag:yaml.org,2002:set",{kind:"mapping",resolve:zqe,construct:Xqe})});var gE=_((vQt,gte)=>{"use strict";var Zqe=Pd();gte.exports=new Zqe({include:[KU()],implicit:[nte(),ste()],explicit:[lte(),ute(),Ate(),hte()]})});var mte=_((SQt,dte)=>{"use strict";var $qe=Ss();function e9e(){return!0}function t9e(){}function r9e(){return""}function n9e(t){return typeof t>"u"}dte.exports=new $qe("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:e9e,construct:t9e,predicate:n9e,represent:r9e})});var Ete=_((DQt,yte)=>{"use strict";var i9e=Ss();function s9e(t){if(t===null||t.length===0)return!1;var e=t,r=/\/([gim]*)$/.exec(t),s="";return!(e[0]==="/"&&(r&&(s=r[1]),s.length>3||e[e.length-s.length-1]!=="/"))}function o9e(t){var e=t,r=/\/([gim]*)$/.exec(t),s="";return e[0]==="/"&&(r&&(s=r[1]),e=e.slice(1,e.length-s.length-1)),new RegExp(e,s)}function a9e(t){var e="/"+t.source+"/";return t.global&&(e+="g"),t.multiline&&(e+="m"),t.ignoreCase&&(e+="i"),e}function l9e(t){return Object.prototype.toString.call(t)==="[object RegExp]"}yte.exports=new i9e("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:s9e,construct:o9e,predicate:l9e,represent:a9e})});var wte=_((bQt,Cte)=>{"use strict";var mx;try{Ite=Ie,mx=Ite("esprima")}catch{typeof window<"u"&&(mx=window.esprima)}var Ite,c9e=Ss();function u9e(t){if(t===null)return!1;try{var e="("+t+")",r=mx.parse(e,{range:!0});return!(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")}catch{return!1}}function f9e(t){var e="("+t+")",r=mx.parse(e,{range:!0}),s=[],a;if(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")throw new Error("Failed to resolve function");return r.body[0].expression.params.forEach(function(n){s.push(n.name)}),a=r.body[0].expression.body.range,r.body[0].expression.body.type==="BlockStatement"?new Function(s,e.slice(a[0]+1,a[1]-1)):new Function(s,"return "+e.slice(a[0],a[1]))}function A9e(t){return t.toString()}function p9e(t){return Object.prototype.toString.call(t)==="[object Function]"}Cte.exports=new c9e("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:u9e,construct:f9e,predicate:p9e,represent:A9e})});var G2=_((xQt,vte)=>{"use strict";var Bte=Pd();vte.exports=Bte.DEFAULT=new Bte({include:[gE()],explicit:[mte(),Ete(),wte()]})});var Gte=_((kQt,q2)=>{"use strict";var Ip=bd(),Qte=pE(),h9e=Qee(),Tte=gE(),g9e=G2(),i0=Object.prototype.hasOwnProperty,yx=1,Rte=2,Fte=3,Ex=4,XU=1,d9e=2,Ste=3,m9e=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84 Line truncated
`:t===118?"\v":t===102?"\f":t===114?"\r":t===101?"\x1B":t===32?" ":t===34?'"':t===47?"/":t===92?"\\":t===78?"\x85":t===95?"\xA0":t===76?"\u2028":t===80?"\u2029":""}function B9e(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}var Lte=new Array(256),Mte=new Array(256);for(kd=0;kd<256;kd++)Lte[kd]=bte(kd)?1:0,Mte[kd]=bte(kd);var kd;function v9e(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||g9e,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function Ute(t,e){return new Qte(e,new h9e(t.filename,t.input,t.position,t.line,t.position-t.lineStart))}function Rr(t,e){throw Ute(t,e)}function Ix(t,e){t.onWarning&&t.onWarning.call(null,Ute(t,e))}var Pte={YAML:function(e,r,s){var a,n,c;e.version!==null&&Rr(e,"duplication of %YAML directive"),s.length!==1&&Rr(e,"YAML directive accepts exactly one argument"),a=/^([0-9]+)\.([0-9]+)$/.exec(s[0]),a===null&&Rr(e,"ill-formed argument of the YAML directive"),n=parseInt(a[1],10),c=parseInt(a[2],10),n!==1&&Rr(e,"unacceptable YAML version of the document"),e.version=s[0],e.checkLineBreaks=c<2,c!==1&&c!==2&&Ix(e,"unsupported YAML version of the document")},TAG:function(e,r,s){var a,n;s.length!==2&&Rr(e,"TAG directive accepts exactly two arguments"),a=s[0],n=s[1],Nte.test(a)||Rr(e,"ill-formed tag handle (first argument) of the TAG directive"),i0.call(e.tagMap,a)&&Rr(e,'there is a previously declared suffix for "'+a+'" tag handle'),Ote.test(n)||Rr(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[a]=n}};function n0(t,e,r,s){var a,n,c,f;if(e<r){if(f=t.input.slice(e,r),s)for(a=0,n=f.length;a<n;a+=1)c=f.charCodeAt(a),c===9||32<=c&&c<=1114111||Rr(t,"expected valid JSON character");else m9e.test(f)&&Rr(t,"the stream contains non-printable characters");t.result+=f}}function xte(t,e,r,s){var a,n,c,f;for(Ip.isObject(r)||Rr(t,"cannot merge mappings; the provided source object is unacceptable"),a=Object.keys(r),c=0,f=a.length;c<f;c+=1)n=a[c],i0.call(e,n)||(e[n]=r[n],s[n]=!0)}function mE(t,e,r,s,a,n,c,f){var p,h;if(Array.isArray(a))for(a=Array.prototype.slice.call(a),p=0,h=a.length;p<h;p+=1)Array.isArray(a[p])&&Rr(t,"nested arrays are not supported inside keys"),typeof a=="object"&&Dte(a[p])==="[object Object]"&&(a[p]="[object Object]");if(typeof a=="object"&&Dte(a)==="[object Object]"&&(a="[object Object]"),a=String(a),e===null&&(e={}),s==="tag:yaml.org,2002:merge")if(Array.isArray(n))for(p=0,h=n.length;p<h;p+=1)xte(t,e,n[p],r);else xte(t,e,n,r);else!t.json&&!i0.call(r,a)&&i0.call(e,a)&&(t.line=c||t.line,t.position=f||t.position,Rr(t,"duplicated mapping key")),e[a]=n,delete r[a];return e}function ZU(t){var e;e=t.input.charCodeAt(t.position),e===10?t.position++:e===13?(t.position++,t.input.charCodeAt(t.position)===10&&t.position++):Rr(t,"a line break is expected"),t.line+=1,t.lineStart=t.position}function as(t,e,r){for(var s=0,a=t.input.charCodeAt(t.position);a!==0;){for(;Qd(a);)a=t.input.charCodeAt(++t.position);if(e&&a===35)do a=t.input.charCodeAt(++t.position);while(a!==10&&a!==13&&a!==0);if(jf(a))for(ZU(t),a=t.input.charCodeAt(t.position),s++,t.lineIndent=0;a===32;)t.lineIndent++,a=t.input.charCodeAt(++t.position);else break}return r!==-1&&s!==0&&t.lineIndent<r&&Ix(t,"deficient indentation"),s}function Cx(t){var e=t.position,r;return r=t.input.charCodeAt(e),!!((r===45||r===46)&&r===t.input.charCodeAt(e+1)&&r===t.input.charCodeAt(e+2)&&(e+=3,r=t.input.charCodeAt(e),r===0||rl(r)))}function $U(t,e){e===1?t.result+=" ":e>1&&(t.result+=Ip.repeat(`
`,e-1))}function S9e(t,e,r){var s,a,n,c,f,p,h,E,C=t.kind,S=t.result,P;if(P=t.input.charCodeAt(t.position),rl(P)||dE(P)||P===35||P===38||P===42||P===33||P===124||P===62||P===39||P===34||P===37||P===64||P===96||(P===63||P===45)&&(a=t.input.charCodeAt(t.position+1),rl(a)||r&&dE(a)))return!1;for(t.kind="scalar",t.result="",n=c=t.position,f=!1;P!==0;){if(P===58){if(a=t.input.charCodeAt(t.position+1),rl(a)||r&&dE(a))break}else if(P===35){if(s=t.input.charCodeAt(t.position-1),rl(s))break}else{if(t.position===t.lineStart&&Cx(t)||r&&dE(P))break;if(jf(P))if(p=t.line,h=t.lineStart,E=t.lineIndent,as(t,!1,-1),t.lineIndent>=e){f=!0,P=t.input.charCodeAt(t.position);continue}else{t.position=c,t.line=p,t.lineStart=h,t.lineIndent=E;break}}f&&(n0(t,n,c,!1),$U(t,t.line-p),n=c=t.position,f=!1),Qd(P)||(c=t.position+1),P=t.input.charCodeAt(++t.position)}return n0(t,n,c,!1),t.result?!0:(t.kind=C,t.result=S,!1)}function D9e(t,e){var r,s,a;if(r=t.input.charCodeAt(t.position),r!==39)return!1;for(t.kind="scalar",t.result="",t.position++,s=a=t.position;(r=t.input.charCodeAt(t.position))!==0;)if(r===39)if(n0(t,s,t.position,!0),r=t.input.charCodeAt(++t.position),r===39)s=t.position,t.position++,a=t.position;else return!0;else jf(r)?(n0(t,s,a,!0),$U(t,as(t,!1,e)),s=a=t.position):t.position===t.lineStart&&Cx(t)?Rr(t,"unexpected end of the document within a single quoted scalar"):(t.position++,a=t.position);Rr(t,"unexpected end of the stream within a single quoted scalar")}function b9e(t,e){var r,s,a,n,c,f;if(f=t.input.charCodeAt(t.position),f!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=s=t.position;(f=t.input.charCodeAt(t.position))!==0;){if(f===34)return n0(t,r,t.position,!0),t.position++,!0;if(f===92){if(n0(t,r,t.position,!0),f=t.input.charCodeAt(++t.position),jf(f))as(t,!1,e);else if(f<256&&Lte[f])t.result+=Mte[f],t.position++;else if((c=C9e(f))>0){for(a=c,n=0;a>0;a--)f=t.input.charCodeAt(++t.position),(c=I9e(f))>=0?n=(n<<4)+c:Rr(t,"expected hexadecimal character");t.result+=B9e(n),t.position++}else Rr(t,"unknown escape sequence");r=s=t.position}else jf(f)?(n0(t,r,s,!0),$U(t,as(t,!1,e)),r=s=t.position):t.position===t.lineStart&&Cx(t)?Rr(t,"unexpected end of the document within a double quoted scalar"):(t.position++,s=t.position)}Rr(t,"unexpected end of the stream within a double quoted scalar")}function P9e(t,e){var r=!0,s,a=t.tag,n,c=t.anchor,f,p,h,E,C,S={},P,I,R,N;if(N=t.input.charCodeAt(t.position),N===91)p=93,C=!1,n=[];else if(N===123)p=125,C=!0,n={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=n),N=t.input.charCodeAt(++t.position);N!==0;){if(as(t,!0,e),N=t.input.charCodeAt(t.position),N===p)return t.position++,t.tag=a,t.anchor=c,t.kind=C?"mapping":"sequence",t.result=n,!0;r||Rr(t,"missed comma between flow collection entries"),I=P=R=null,h=E=!1,N===63&&(f=t.input.charCodeAt(t.position+1),rl(f)&&(h=E=!0,t.position++,as(t,!0,e))),s=t.line,yE(t,e,yx,!1,!0),I=t.tag,P=t.result,as(t,!0,e),N=t.input.charCodeAt(t.position),(E||t.line===s)&&N===58&&(h=!0,N=t.input.charCodeAt(++t.position),as(t,!0,e),yE(t,e,yx,!1,!0),R=t.result),C?mE(t,n,S,I,P,R):h?n.push(mE(t,null,S,I,P,R)):n.push(P),as(t,!0,e),N=t.input.charCodeAt(t.position),N===44?(r=!0,N=t.input.charCodeAt(++t.position)):r=!1}Rr(t,"unexpected end of the stream within a flow collection")}function x9e(t,e){var r,s,a=XU,n=!1,c=!1,f=e,p=0,h=!1,E,C;if(C=t.input.charCodeAt(t.position),C===124)s=!1;else if(C===62)s=!0;else return!1;for(t.kind="scalar",t.result="";C!==0;)if(C=t.input.charCodeAt(++t.position),C===43||C===45)XU===a?a=C===43?Ste:d9e:Rr(t,"repeat of a chomping mode identifier");else if((E=w9e(C))>=0)E===0?Rr(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?Rr(t,"repeat of an indentation width identifier"):(f=e+E-1,c=!0);else break;if(Qd(C)){do C=t.input.charCodeAt(++t.position);while(Qd(C));if(C===35)do C=t.input.charCodeAt(++t.position);while(!jf(C)&&C!==0)}for(;C!==0;){for(ZU(t),t.lineIndent=0,C=t.input.charCodeAt(t.position);(!c||t.lineIndent<f)&&C===32;)t.lineIndent++,C=t.input.charCodeAt(++t.position);if(!c&&t.lineIndent>f&&(f=t.lineIndent),jf(C)){p++;continue}if(t.lineIndent<f){a===Ste?t.result+=Ip.repeat(`
`,n?1+p:p):a===XU&&n&&(t.result+=`
`);break}for(s?Qd(C)?(h=!0,t.result+=Ip.repeat(`
`,n?1+p:p)):h?(h=!1,t.result+=Ip.repeat(`
`,p+1)):p===0?n&&(t.result+=" "):t.result+=Ip.repeat(`
`,p):t.result+=Ip.repeat(`
`,n?1+p:p),n=!0,c=!0,p=0,r=t.position;!jf(C)&&C!==0;)C=t.input.charCodeAt(++t.position);n0(t,r,t.position,!1)}return!0}function kte(t,e){var r,s=t.tag,a=t.anchor,n=[],c,f=!1,p;for(t.anchor!==null&&(t.anchorMap[t.anchor]=n),p=t.input.charCodeAt(t.position);p!==0&&!(p!==45||(c=t.input.charCodeAt(t.position+1),!rl(c)));){if(f=!0,t.position++,as(t,!0,-1)&&t.lineIndent<=e){n.push(null),p=t.input.charCodeAt(t.position);continue}if(r=t.line,yE(t,e,Fte,!1,!0),n.push(t.result),as(t,!0,-1),p=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&p!==0)Rr(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return f?(t.tag=s,t.anchor=a,t.kind="sequence",t.result=n,!0):!1}function k9e(t,e,r){var s,a,n,c,f=t.tag,p=t.anchor,h={},E={},C=null,S=null,P=null,I=!1,R=!1,N;for(t.anchor!==null&&(t.anchorMap[t.anchor]=h),N=t.input.charCodeAt(t.position);N!==0;){if(s=t.input.charCodeAt(t.position+1),n=t.line,c=t.position,(N===63||N===58)&&rl(s))N===63?(I&&(mE(t,h,E,C,S,null),C=S=P=null),R=!0,I=!0,a=!0):I?(I=!1,a=!0):Rr(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,N=s;else if(yE(t,r,Rte,!1,!0))if(t.line===n){for(N=t.input.charCodeAt(t.position);Qd(N);)N=t.input.charCodeAt(++t.position);if(N===58)N=t.input.charCodeAt(++t.position),rl(N)||Rr(t,"a whitespace character is expected after the key-value separator within a block mapping"),I&&(mE(t,h,E,C,S,null),C=S=P=null),R=!0,I=!1,a=!1,C=t.tag,S=t.result;else if(R)Rr(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=f,t.anchor=p,!0}else if(R)Rr(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=f,t.anchor=p,!0;else break;if((t.line===n||t.lineIndent>e)&&(yE(t,e,Ex,!0,a)&&(I?S=t.result:P=t.result),I||(mE(t,h,E,C,S,P,n,c),C=S=P=null),as(t,!0,-1),N=t.input.charCodeAt(t.position)),t.lineIndent>e&&N!==0)Rr(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return I&&mE(t,h,E,C,S,null),R&&(t.tag=f,t.anchor=p,t.kind="mapping",t.result=h),R}function Q9e(t){var e,r=!1,s=!1,a,n,c;if(c=t.input.charCodeAt(t.position),c!==33)return!1;if(t.tag!==null&&Rr(t,"duplication of a tag property"),c=t.input.charCodeAt(++t.position),c===60?(r=!0,c=t.input.charCodeAt(++t.position)):c===33?(s=!0,a="!!",c=t.input.charCodeAt(++t.position)):a="!",e=t.position,r){do c=t.input.charCodeAt(++t.position);while(c!==0&&c!==62);t.position<t.length?(n=t.input.slice(e,t.position),c=t.input.charCodeAt(++t.position)):Rr(t,"unexpected end of the stream within a verbatim tag")}else{for(;c!==0&&!rl(c);)c===33&&(s?Rr(t,"tag suffix cannot contain exclamation marks"):(a=t.input.slice(e-1,t.position+1),Nte.test(a)||Rr(t,"named tag handle cannot contain such characters"),s=!0,e=t.position+1)),c=t.input.charCodeAt(++t.position);n=t.input.slice(e,t.position),E9e.test(n)&&Rr(t,"tag suffix cannot contain flow indicator characters")}return n&&!Ote.test(n)&&Rr(t,"tag name cannot contain such characters: "+n),r?t.tag=n:i0.call(t.tagMap,a)?t.tag=t.tagMap[a]+n:a==="!"?t.tag="!"+n:a==="!!"?t.tag="tag:yaml.org,2002:"+n:Rr(t,'undeclared tag handle "'+a+'"'),!0}function T9e(t){var e,r;if(r=t.input.charCodeAt(t.position),r!==38)return!1;for(t.anchor!==null&&Rr(t,"duplication of an anchor property"),r=t.input.charCodeAt(++t.position),e=t.position;r!==0&&!rl(r)&&!dE(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&Rr(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}function R9e(t){var e,r,s;if(s=t.input.charCodeAt(t.position),s!==42)return!1;for(s=t.input.charCodeAt(++t.position),e=t.position;s!==0&&!rl(s)&&!dE(s);)s=t.input.charCodeAt(++t.position);return t.position===e&&Rr(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),i0.call(t.anchorMap,r)||Rr(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],as(t,!0,-1),!0}function yE(t,e,r,s,a){var n,c,f,p=1,h=!1,E=!1,C,S,P,I,R;if(t.listener!==null&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,n=c=f=Ex===r||Fte===r,s&&as(t,!0,-1)&&(h=!0,t.lineIndent>e?p=1:t.lineIndent===e?p=0:t.lineIndent<e&&(p=-1)),p===1)for(;Q9e(t)||T9e(t);)as(t,!0,-1)?(h=!0,f=n,t.lineIndent>e?p=1:t.lineIndent===e?p=0:t.lineIndent<e&&(p=-1)):f=!1;if(f&&(f=h||a),(p===1||Ex===r)&&(yx===r||Rte===r?I=e:I=e+1,R=t.position-t.lineStart,p===1?f&&(kte(t,R)||k9e(t,R,I))||P9e(t,I)?E=!0:(c&&x9e(t,I)||D9e(t,I)||b9e(t,I)?E=!0:R9e(t)?(E=!0,(t.tag!==null||t.anchor!==null)&&Rr(t,"alias node should not have any properties")):S9e(t,I,yx===r)&&(E=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):p===0&&(E=f&&kte(t,R))),t.tag!==null&&t.tag!=="!")if(t.tag==="?"){for(t.result!==null&&t.kind!=="scalar"&&Rr(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),C=0,S=t.implicitTypes.length;C<S;C+=1)if(P=t.implicitTypes[C],P.resolve(t.result)){t.result=P.construct(t.result),t. Line truncated
`),t.charCodeAt(0)===65279&&(t=t.slice(1)));var r=new v9e(t,e),s=t.indexOf("\0");for(s!==-1&&(r.position=s,Rr(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)F9e(r);return r.documents}function Hte(t,e,r){e!==null&&typeof e=="object"&&typeof r>"u"&&(r=e,e=null);var s=_te(t,r);if(typeof e!="function")return s;for(var a=0,n=s.length;a<n;a+=1)e(s[a])}function jte(t,e){var r=_te(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new Qte("expected a single document in the stream, but found more")}}function N9e(t,e,r){return typeof e=="object"&&e!==null&&typeof r>"u"&&(r=e,e=null),Hte(t,e,Ip.extend({schema:Tte},r))}function O9e(t,e){return jte(t,Ip.extend({schema:Tte},e))}q2.exports.loadAll=Hte;q2.exports.load=jte;q2.exports.safeLoadAll=N9e;q2.exports.safeLoad=O9e});var Are=_((QQt,n_)=>{"use strict";var Y2=bd(),V2=pE(),L9e=G2(),M9e=gE(),Xte=Object.prototype.toString,Zte=Object.prototype.hasOwnProperty,U9e=9,W2=10,_9e=13,H9e=32,j9e=33,G9e=34,$te=35,q9e=37,W9e=38,Y9e=39,V9e=42,ere=44,J9e=45,tre=58,K9e=61,z9e=62,X9e=63,Z9e=64,rre=91,nre=93,$9e=96,ire=123,eWe=124,sre=125,_o={};_o[0]="\\0";_o[7]="\\a";_o[8]="\\b";_o[9]="\\t";_o[10]="\\n";_o[11]="\\v";_o[12]="\\f";_o[13]="\\r";_o[27]="\\e";_o[34]='\\"';_o[92]="\\\\";_o[133]="\\N";_o[160]="\\_";_o[8232]="\\L";_o[8233]="\\P";var tWe=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function rWe(t,e){var r,s,a,n,c,f,p;if(e===null)return{};for(r={},s=Object.keys(e),a=0,n=s.length;a<n;a+=1)c=s[a],f=String(e[c]),c.slice(0,2)==="!!"&&(c="tag:yaml.org,2002:"+c.slice(2)),p=t.compiledTypeMap.fallback[c],p&&Zte.call(p.styleAliases,f)&&(f=p.styleAliases[f]),r[c]=f;return r}function qte(t){var e,r,s;if(e=t.toString(16).toUpperCase(),t<=255)r="x",s=2;else if(t<=65535)r="u",s=4;else if(t<=4294967295)r="U",s=8;else throw new V2("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+Y2.repeat("0",s-e.length)+e}function nWe(t){this.schema=t.schema||L9e,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=Y2.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=rWe(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Wte(t,e){for(var r=Y2.repeat(" ",e),s=0,a=-1,n="",c,f=t.length;s<f;)a=t.indexOf(`
`,s),a===-1?(c=t.slice(s),s=f):(c=t.slice(s,a+1),s=a+1),c.length&&c!==`
`&&(n+=r),n+=c;return n}function e_(t,e){return`
`+Y2.repeat(" ",t.indent*e)}function iWe(t,e){var r,s,a;for(r=0,s=t.implicitTypes.length;r<s;r+=1)if(a=t.implicitTypes[r],a.resolve(e))return!0;return!1}function r_(t){return t===H9e||t===U9e}function EE(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==65279||65536<=t&&t<=1114111}function sWe(t){return EE(t)&&!r_(t)&&t!==65279&&t!==_9e&&t!==W2}function Yte(t,e){return EE(t)&&t!==65279&&t!==ere&&t!==rre&&t!==nre&&t!==ire&&t!==sre&&t!==tre&&(t!==$te||e&&sWe(e))}function oWe(t){return EE(t)&&t!==65279&&!r_(t)&&t!==J9e&&t!==X9e&&t!==tre&&t!==ere&&t!==rre&&t!==nre&&t!==ire&&t!==sre&&t!==$te&&t!==W9e&&t!==V9e&&t!==j9e&&t!==eWe&&t!==K9e&&t!==z9e&&t!==Y9e&&t!==G9e&&t!==q9e&&t!==Z9e&&t!==$9e}function ore(t){var e=/^\n* /;return e.test(t)}var are=1,lre=2,cre=3,ure=4,wx=5;function aWe(t,e,r,s,a){var n,c,f,p=!1,h=!1,E=s!==-1,C=-1,S=oWe(t.charCodeAt(0))&&!r_(t.charCodeAt(t.length-1));if(e)for(n=0;n<t.length;n++){if(c=t.charCodeAt(n),!EE(c))return wx;f=n>0?t.charCodeAt(n-1):null,S=S&&Yte(c,f)}else{for(n=0;n<t.length;n++){if(c=t.charCodeAt(n),c===W2)p=!0,E&&(h=h||n-C-1>s&&t[C+1]!==" ",C=n);else if(!EE(c))return wx;f=n>0?t.charCodeAt(n-1):null,S=S&&Yte(c,f)}h=h||E&&n-C-1>s&&t[C+1]!==" "}return!p&&!h?S&&!a(t)?are:lre:r>9&&ore(t)?wx:h?ure:cre}function lWe(t,e,r,s){t.dump=function(){if(e.length===0)return"''";if(!t.noCompatMode&&tWe.indexOf(e)!==-1)return"'"+e+"'";var a=t.indent*Math.max(1,r),n=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-a),c=s||t.flowLevel>-1&&r>=t.flowLevel;function f(p){return iWe(t,p)}switch(aWe(e,c,t.indent,n,f)){case are:return e;case lre:return"'"+e.replace(/'/g,"''")+"'";case cre:return"|"+Vte(e,t.indent)+Jte(Wte(e,a));case ure:return">"+Vte(e,t.indent)+Jte(Wte(cWe(e,n),a));case wx:return'"'+uWe(e,n)+'"';default:throw new V2("impossible error: invalid scalar style")}}()}function Vte(t,e){var r=ore(t)?String(e):"",s=t[t.length-1]===`
`,a=s&&(t[t.length-2]===`
`||t===`
`),n=a?"+":s?"":"-";return r+n+`
`}function Jte(t){return t[t.length-1]===`
`?t.slice(0,-1):t}function cWe(t,e){for(var r=/(\n+)([^\n]*)/g,s=function(){var h=t.indexOf(`
`);return h=h!==-1?h:t.length,r.lastIndex=h,Kte(t.slice(0,h),e)}(),a=t[0]===`
`||t[0]===" ",n,c;c=r.exec(t);){var f=c[1],p=c[2];n=p[0]===" ",s+=f+(!a&&!n&&p!==""?`
`:"")+Kte(p,e),a=n}return s}function Kte(t,e){if(t===""||t[0]===" ")return t;for(var r=/ [^ ]/g,s,a=0,n,c=0,f=0,p="";s=r.exec(t);)f=s.index,f-a>e&&(n=c>a?c:f,p+=`
`+t.slice(a,n),a=n+1),c=f;return p+=`
`,t.length-a>e&&c>a?p+=t.slice(a,c)+`
`+t.slice(c+1):p+=t.slice(a),p.slice(1)}function uWe(t){for(var e="",r,s,a,n=0;n<t.length;n++){if(r=t.charCodeAt(n),r>=55296&&r<=56319&&(s=t.charCodeAt(n+1),s>=56320&&s<=57343)){e+=qte((r-55296)*1024+s-56320+65536),n++;continue}a=_o[r],e+=!a&&EE(r)?t[n]:a||qte(r)}return e}function fWe(t,e,r){var s="",a=t.tag,n,c;for(n=0,c=r.length;n<c;n+=1)Td(t,e,r[n],!1,!1)&&(n!==0&&(s+=","+(t.condenseFlow?"":" ")),s+=t.dump);t.tag=a,t.dump="["+s+"]"}function AWe(t,e,r,s){var a="",n=t.tag,c,f;for(c=0,f=r.length;c<f;c+=1)Td(t,e+1,r[c],!0,!0)&&((!s||c!==0)&&(a+=e_(t,e)),t.dump&&W2===t.dump.charCodeAt(0)?a+="-":a+="- ",a+=t.dump);t.tag=n,t.dump=a||"[]"}function pWe(t,e,r){var s="",a=t.tag,n=Object.keys(r),c,f,p,h,E;for(c=0,f=n.length;c<f;c+=1)E="",c!==0&&(E+=", "),t.condenseFlow&&(E+='"'),p=n[c],h=r[p],Td(t,e,p,!1,!1)&&(t.dump.length>1024&&(E+="? "),E+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Td(t,e,h,!1,!1)&&(E+=t.dump,s+=E));t.tag=a,t.dump="{"+s+"}"}function hWe(t,e,r,s){var a="",n=t.tag,c=Object.keys(r),f,p,h,E,C,S;if(t.sortKeys===!0)c.sort();else if(typeof t.sortKeys=="function")c.sort(t.sortKeys);else if(t.sortKeys)throw new V2("sortKeys must be a boolean or a function");for(f=0,p=c.length;f<p;f+=1)S="",(!s||f!==0)&&(S+=e_(t,e)),h=c[f],E=r[h],Td(t,e+1,h,!0,!0,!0)&&(C=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,C&&(t.dump&&W2===t.dump.charCodeAt(0)?S+="?":S+="? "),S+=t.dump,C&&(S+=e_(t,e)),Td(t,e+1,E,!0,C)&&(t.dump&&W2===t.dump.charCodeAt(0)?S+=":":S+=": ",S+=t.dump,a+=S));t.tag=n,t.dump=a||"{}"}function zte(t,e,r){var s,a,n,c,f,p;for(a=r?t.explicitTypes:t.implicitTypes,n=0,c=a.length;n<c;n+=1)if(f=a[n],(f.instanceOf||f.predicate)&&(!f.instanceOf||typeof e=="object"&&e instanceof f.instanceOf)&&(!f.predicate||f.predicate(e))){if(t.tag=r?f.tag:"?",f.represent){if(p=t.styleMap[f.tag]||f.defaultStyle,Xte.call(f.represent)==="[object Function]")s=f.represent(e,p);else if(Zte.call(f.represent,p))s=f.represent[p](e,p);else throw new V2("!<"+f.tag+'> tag resolver accepts not "'+p+'" style');t.dump=s}return!0}return!1}function Td(t,e,r,s,a,n){t.tag=null,t.dump=r,zte(t,r,!1)||zte(t,r,!0);var c=Xte.call(t.dump);s&&(s=t.flowLevel<0||t.flowLevel>e);var f=c==="[object Object]"||c==="[object Array]",p,h;if(f&&(p=t.duplicates.indexOf(r),h=p!==-1),(t.tag!==null&&t.tag!=="?"||h||t.indent!==2&&e>0)&&(a=!1),h&&t.usedDuplicates[p])t.dump="*ref_"+p;else{if(f&&h&&!t.usedDuplicates[p]&&(t.usedDuplicates[p]=!0),c==="[object Object]")s&&Object.keys(t.dump).length!==0?(hWe(t,e,t.dump,a),h&&(t.dump="&ref_"+p+t.dump)):(pWe(t,e,t.dump),h&&(t.dump="&ref_"+p+" "+t.dump));else if(c==="[object Array]"){var E=t.noArrayIndent&&e>0?e-1:e;s&&t.dump.length!==0?(AWe(t,E,t.dump,a),h&&(t.dump="&ref_"+p+t.dump)):(fWe(t,E,t.dump),h&&(t.dump="&ref_"+p+" "+t.dump))}else if(c==="[object String]")t.tag!=="?"&&lWe(t,t.dump,e,n);else{if(t.skipInvalid)return!1;throw new V2("unacceptable kind of an object to dump "+c)}t.tag!==null&&t.tag!=="?"&&(t.dump="!<"+t.tag+"> "+t.dump)}return!0}function gWe(t,e){var r=[],s=[],a,n;for(t_(t,r,s),a=0,n=s.length;a<n;a+=1)e.duplicates.push(r[s[a]]);e.usedDuplicates=new Array(n)}function t_(t,e,r){var s,a,n;if(t!==null&&typeof t=="object")if(a=e.indexOf(t),a!==-1)r.indexOf(a)===-1&&r.push(a);else if(e.push(t),Array.isArray(t))for(a=0,n=t.length;a<n;a+=1)t_(t[a],e,r);else for(s=Object.keys(t),a=0,n=s.length;a<n;a+=1)t_(t[s[a]],e,r)}function fre(t,e){e=e||{};var r=new nWe(e);return r.noRefs||gWe(t,r),Td(r,0,t,!0,!0)?r.dump+`
`:""}function dWe(t,e){return fre(t,Y2.extend({schema:M9e},e))}n_.exports.dump=fre;n_.exports.safeDump=dWe});var hre=_((TQt,Wi)=>{"use strict";var Bx=Gte(),pre=Are();function vx(t){return function(){throw new Error("Function "+t+" is deprecated and cannot be used.")}}Wi.exports.Type=Ss();Wi.exports.Schema=Pd();Wi.exports.FAILSAFE_SCHEMA=dx();Wi.exports.JSON_SCHEMA=JU();Wi.exports.CORE_SCHEMA=KU();Wi.exports.DEFAULT_SAFE_SCHEMA=gE();Wi.exports.DEFAULT_FULL_SCHEMA=G2();Wi.exports.load=Bx.load;Wi.exports.loadAll=Bx.loadAll;Wi.exports.safeLoad=Bx.safeLoad;Wi.exports.safeLoadAll=Bx.safeLoadAll;Wi.exports.dump=pre.dump;Wi.exports.safeDump=pre.safeDump;Wi.exports.YAMLException=pE();Wi.exports.MINIMAL_SCHEMA=dx();Wi.exports.SAFE_SCHEMA=gE();Wi.exports.DEFAULT_SCHEMA=G2();Wi.exports.scan=vx("scan");Wi.exports.parse=vx("parse");Wi.exports.compose=vx("compose");Wi.exports.addConstructor=vx("addConstructor")});var dre=_((RQt,gre)=>{"use strict";var mWe=hre();gre.exports=mWe});var yre=_((FQt,mre)=>{"use strict";function yWe(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function Rd(t,e,r,s){this.message=t,this.expected=e,this.found=r,this.location=s,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Rd)}yWe(Rd,Error);Rd.buildMessage=function(t,e){var r={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var E="",C;for(C=0;C<h.parts.length;C++)E+=h.parts[C]instanceof Array?n(h.parts[C][0])+"-"+n(h.parts[C][1]):n(h.parts[C]);return"["+(h.inverted?"^":"")+E+"]"},any:function(h){return"any character"},end:function(h){return"end of input"},other:function(h){return h.description}};function s(h){return h.charCodeAt(0).toString(16).toUpperCase()}function a(h){return h.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(E){return"\\x0"+s(E)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(E){return"\\x"+s(E)})}function n(h){return h.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(E){return"\\x0"+s(E)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(E){return"\\x"+s(E)})}function c(h){return r[h.type](h)}function f(h){var E=new Array(h.length),C,S;for(C=0;C<h.length;C++)E[C]=c(h[C]);if(E.sort(),E.length>0){for(C=1,S=1;C<E.length;C++)E[C-1]!==E[C]&&(E[S]=E[C],S++);E.length=S}switch(E.length){case 1:return E[0];case 2:return E[0]+" or "+E[1];default:return E.slice(0,-1).join(", ")+", or "+E[E.length-1]}}function p(h){return h?'"'+a(h)+'"':"end of input"}return"Expected "+f(t)+" but "+p(e)+" found."};function EWe(t,e){e=e!==void 0?e:{};var r={},s={Start:lc},a=lc,n=function(te){return[].concat(...te)},c="-",f=dn("-",!1),p=function(te){return te},h=function(te){return Object.assign({},...te)},E="#",C=dn("#",!1),S=Au(),P=function(){return{}},I=":",R=dn(":",!1),N=function(te,Ee){return{[te]:Ee}},U=",",W=dn(",",!1),ee=function(te,Ee){return Ee},ie=function(te,Ee,Oe){return Object.assign({},...[te].concat(Ee).map(dt=>({[dt]:Oe})))},ue=function(te){return te},le=function(te){return te},me=Oa("correct indentation"),pe=" ",Be=dn(" ",!1),Ce=function(te){return te.length===lr*St},g=function(te){return te.length===(lr+1)*St},we=function(){return lr++,!0},ye=function(){return lr--,!0},Ae=function(){return la()},se=Oa("pseudostring"),Z=/^[^\r\n\t ?:,\][{}#&*!|>'"%@`\-]/,De=Kn(["\r",`
`," "," ","?",":",",","]","[","{","}","#","&","*","!","|",">","'",'"',"%","@","`","-"],!0,!1),Re=/^[^\r\n\t ,\][{}:#"']/,mt=Kn(["\r",`
`," "," ",",","]","[","{","}",":","#",'"',"'"],!0,!1),j=function(){return la().replace(/^ *| *$/g,"")},rt="--",Fe=dn("--",!1),Ne=/^[a-zA-Z\/0-9]/,Pe=Kn([["a","z"],["A","Z"],"/",["0","9"]],!1,!1),Ve=/^[^\r\n\t :,]/,ke=Kn(["\r",`
`," "," ",":",","],!0,!1),it="null",Ue=dn("null",!1),x=function(){return null},w="true",b=dn("true",!1),y=function(){return!0},F="false",z=dn("false",!1),X=function(){return!1},$=Oa("string"),oe='"',xe=dn('"',!1),Te=function(){return""},lt=function(te){return te},Ct=function(te){return te.join("")},qt=/^[^"\\\0-\x1F\x7F]/,ir=Kn(['"',"\\",["\0",""],"\x7F"],!0,!1),Pt='\\"',gn=dn('\\"',!1),Pr=function(){return'"'},Ir="\\\\",Or=dn("\\\\",!1),on=function(){return"\\"},ai="\\/",Io=dn("\\/",!1),rs=function(){return"/"},$s="\\b",Co=dn("\\b",!1),ji=function(){return"\b"},eo="\\f",wo=dn("\\f",!1),QA=function(){return"\f"},Af="\\n",dh=dn("\\n",!1),mh=function(){return`
`},to="\\r",jn=dn("\\r",!1),Ts=function(){return"\r"},ro="\\t",ou=dn("\\t",!1),au=function(){return" "},lu="\\u",TA=dn("\\u",!1),RA=function(te,Ee,Oe,dt){return String.fromCharCode(parseInt(`0x${te}${Ee}${Oe}${dt}`))},oa=/^[0-9a-fA-F]/,aa=Kn([["0","9"],["a","f"],["A","F"]],!1,!1),FA=Oa("blank space"),gr=/^[ \t]/,Bo=Kn([" "," "],!1,!1),Me=Oa("white space"),cu=/^[ \t\n\r]/,Cr=Kn([" "," ",`
`,"\r"],!1,!1),pf=`\r
`,NA=dn(`\r
`,!1),OA=`
`,uu=dn(`
`,!1),fu="\r",oc=dn("\r",!1),ve=0,Nt=0,ac=[{line:1,column:1}],Oi=0,no=[],Rt=0,xn;if("startRule"in e){if(!(e.startRule in s))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=s[e.startRule]}function la(){return t.substring(Nt,ve)}function Gi(){return Ma(Nt,ve)}function Li(te,Ee){throw Ee=Ee!==void 0?Ee:Ma(Nt,ve),hf([Oa(te)],t.substring(Nt,ve),Ee)}function Na(te,Ee){throw Ee=Ee!==void 0?Ee:Ma(Nt,ve),Ua(te,Ee)}function dn(te,Ee){return{type:"literal",text:te,ignoreCase:Ee}}function Kn(te,Ee,Oe){return{type:"class",parts:te,inverted:Ee,ignoreCase:Oe}}function Au(){return{type:"any"}}function yh(){return{type:"end"}}function Oa(te){return{type:"other",description:te}}function La(te){var Ee=ac[te],Oe;if(Ee)return Ee;for(Oe=te-1;!ac[Oe];)Oe--;for(Ee=ac[Oe],Ee={line:Ee.line,column:Ee.column};Oe<te;)t.charCodeAt(Oe)===10?(Ee.line++,Ee.column=1):Ee.column++,Oe++;return ac[te]=Ee,Ee}function Ma(te,Ee){var Oe=La(te),dt=La(Ee);return{start:{offset:te,line:Oe.line,column:Oe.column},end:{offset:Ee,line:dt.line,column:dt.column}}}function $e(te){ve<Oi||(ve>Oi&&(Oi=ve,no=[]),no.push(te))}function Ua(te,Ee){return new Rd(te,null,null,Ee)}function hf(te,Ee,Oe){return new Rd(Rd.buildMessage(te,Ee),te,Ee,Oe)}function lc(){var te;return te=LA(),te}function wn(){var te,Ee,Oe;for(te=ve,Ee=[],Oe=ca();Oe!==r;)Ee.push(Oe),Oe=ca();return Ee!==r&&(Nt=te,Ee=n(Ee)),te=Ee,te}function ca(){var te,Ee,Oe,dt,Et;return te=ve,Ee=Bl(),Ee!==r?(t.charCodeAt(ve)===45?(Oe=c,ve++):(Oe=r,Rt===0&&$e(f)),Oe!==r?(dt=Qn(),dt!==r?(Et=ua(),Et!==r?(Nt=te,Ee=p(Et),te=Ee):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r),te}function LA(){var te,Ee,Oe;for(te=ve,Ee=[],Oe=MA();Oe!==r;)Ee.push(Oe),Oe=MA();return Ee!==r&&(Nt=te,Ee=h(Ee)),te=Ee,te}function MA(){var te,Ee,Oe,dt,Et,bt,tr,An,li;if(te=ve,Ee=Qn(),Ee===r&&(Ee=null),Ee!==r){if(Oe=ve,t.charCodeAt(ve)===35?(dt=E,ve++):(dt=r,Rt===0&&$e(C)),dt!==r){if(Et=[],bt=ve,tr=ve,Rt++,An=st(),Rt--,An===r?tr=void 0:(ve=tr,tr=r),tr!==r?(t.length>ve?(An=t.charAt(ve),ve++):(An=r,Rt===0&&$e(S)),An!==r?(tr=[tr,An],bt=tr):(ve=bt,bt=r)):(ve=bt,bt=r),bt!==r)for(;bt!==r;)Et.push(bt),bt=ve,tr=ve,Rt++,An=st(),Rt--,An===r?tr=void 0:(ve=tr,tr=r),tr!==r?(t.length>ve?(An=t.charAt(ve),ve++):(An=r,Rt===0&&$e(S)),An!==r?(tr=[tr,An],bt=tr):(ve=bt,bt=r)):(ve=bt,bt=r);else Et=r;Et!==r?(dt=[dt,Et],Oe=dt):(ve=Oe,Oe=r)}else ve=Oe,Oe=r;if(Oe===r&&(Oe=null),Oe!==r){if(dt=[],Et=Ke(),Et!==r)for(;Et!==r;)dt.push(Et),Et=Ke();else dt=r;dt!==r?(Nt=te,Ee=P(),te=Ee):(ve=te,te=r)}else ve=te,te=r}else ve=te,te=r;if(te===r&&(te=ve,Ee=Bl(),Ee!==r?(Oe=Ha(),Oe!==r?(dt=Qn(),dt===r&&(dt=null),dt!==r?(t.charCodeAt(ve)===58?(Et=I,ve++):(Et=r,Rt===0&&$e(R)),Et!==r?(bt=Qn(),bt===r&&(bt=null),bt!==r?(tr=ua(),tr!==r?(Nt=te,Ee=N(Oe,tr),te=Ee):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r),te===r&&(te=ve,Ee=Bl(),Ee!==r?(Oe=ns(),Oe!==r?(dt=Qn(),dt===r&&(dt=null),dt!==r?(t.charCodeAt(ve)===58?(Et=I,ve++):(Et=r,Rt===0&&$e(R)),Et!==r?(bt=Qn(),bt===r&&(bt=null),bt!==r?(tr=ua(),tr!==r?(Nt=te,Ee=N(Oe,tr),te=Ee):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r),te===r))){if(te=ve,Ee=Bl(),Ee!==r)if(Oe=ns(),Oe!==r)if(dt=Qn(),dt!==r)if(Et=pu(),Et!==r){if(bt=[],tr=Ke(),tr!==r)for(;tr!==r;)bt.push(tr),tr=Ke();else bt=r;bt!==r?(Nt=te,Ee=N(Oe,Et),te=Ee):(ve=te,te=r)}else ve=te,te=r;else ve=te,te=r;else ve=te,te=r;else ve=te,te=r;if(te===r)if(te=ve,Ee=Bl(),Ee!==r)if(Oe=ns(),Oe!==r){if(dt=[],Et=ve,bt=Qn(),bt===r&&(bt=null),bt!==r?(t.charCodeAt(ve)===44?(tr=U,ve++):(tr=r,Rt===0&&$e(W)),tr!==r?(An=Qn(),An===r&&(An=null),An!==r?(li=ns(),li!==r?(Nt=Et,bt=ee(Oe,li),Et=bt):(ve=Et,Et=r)):(ve=Et,Et=r)):(ve=Et,Et=r)):(ve=Et,Et=r),Et!==r)for(;Et!==r;)dt.push(Et),Et=ve,bt=Qn(),bt===r&&(bt=null),bt!==r?(t.charCodeAt(ve)===44?(tr=U,ve++):(tr=r,Rt===0&&$e(W)),tr!==r?(An=Qn(),An===r&&(An=null),An!==r?(li=ns(),li!==r?(Nt=Et,bt=ee(Oe,li),Et=bt):(ve=Et,Et=r)):(ve=Et,Et=r)):(ve=Et,Et=r)):(ve=Et,Et=r);else dt=r;dt!==r?(Et=Qn(),Et===r&&(Et=null),Et!==r?(t.charCodeAt(ve)===58?(bt=I,ve++):(bt=r,Rt===0&&$e(R)),bt!==r?(tr=Qn(),tr===r&&(tr=null),tr!==r?(An=ua(),An!==r?(Nt=te,Ee=ie(Oe,dt,An),te=Ee):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r)}else ve=te,te=r;else ve=te,te=r}return te}function ua(){var te,Ee,Oe,dt,Et,bt,tr;if(te=ve,Ee=ve,Rt++,Oe=ve,dt=st(),dt!==r?(Et=Mt(),Et!==r?(t.charCodeAt(ve)===45?(bt=c,ve++):(bt=r,Rt===0&&$e(f)),bt!==r?(tr=Qn(),tr!==r?(dt=[dt,Et,bt,tr],Oe=dt):(ve=Oe,Oe=r)):(ve=Oe,Oe=r)):(ve=Oe,Oe=r)):(ve=Oe,Oe=r),Rt--,Oe!==r?(ve=Ee,Ee=void 0):Ee=r,Ee!==r?(Oe=Ke(),Oe!==r?(dt=kn(),dt!==r?(Et=wn(),Et!==r?(bt=fa(),bt!==r?(Nt=te,Ee=ue(Et),te=Ee):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r),te===r&&(te=ve,Ee=st(),Ee!==r?(Oe=kn(),Oe!==r?(dt=LA(),dt!==r?(Et=fa(),Et!==r?(Nt=te,Ee=ue(dt),te=Ee):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r)):(ve=te,te=r),te===r))if(te=ve,Ee=cc(),Ee!==r){if(Oe=[],dt=Ke(),dt!==r)for(;dt!==r;)Oe.push(dt),dt=Ke();else Oe=r;Oe!==r?(Nt=te,EeLine truncated
`;if(typeof t=="number"||typeof t=="boolean")return`${t.toString()}
`;if(typeof t=="string")return`${Ire(t)}
`;if(Array.isArray(t)){if(t.length===0)return`[]
`;let s=" ".repeat(e);return`
${t.map(n=>`${s}- ${i_(n,e+1,!1)}`).join("")}`}if(typeof t=="object"&&t){let[s,a]=t instanceof Sx?[t.data,!1]:[t,!0],n=" ".repeat(e),c=Object.keys(s);a&&c.sort((p,h)=>{let E=Ere.indexOf(p),C=Ere.indexOf(h);return E===-1&&C===-1?p<h?-1:p>h?1:0:E!==-1&&C===-1?-1:E===-1&&C!==-1?1:E-C});let f=c.filter(p=>!wre(s[p])).map((p,h)=>{let E=s[p],C=Ire(p),S=i_(E,e+1,!0),P=h>0||r?n:"",I=C.length>1024?`? ${C}
${P}:`:`${C}:`,R=S.startsWith(`
`)?S:` ${S}`;return`${P}${I}${R}`}).join(e===0?`
`:"")||`
`;return r?`
${f}`:`${f}`}throw new Error(`Unsupported value type (${t})`)}function nl(t){try{let e=i_(t,0,!1);return e!==`
`?e:""}catch(e){throw e.location&&(e.message=e.message.replace(/(\.)?$/,` (line ${e.location.start.line}, column ${e.location.start.column})$1`)),e}}function CWe(t){return t.endsWith(`
`)||(t+=`
`),(0,Cre.parse)(t)}function BWe(t){if(wWe.test(t))return CWe(t);let e=(0,Dx.safeLoad)(t,{schema:Dx.FAILSAFE_SCHEMA,json:!0});if(e==null)return{};if(typeof e!="object")throw new Error(`Expected an indexed object, got a ${typeof e} instead. Does your file follow Yaml's rules?`);if(Array.isArray(e))throw new Error("Expected an indexed object, got an array instead. Does your file follow Yaml's rules?");return e}function ls(t){return BWe(t)}var Dx,Cre,IWe,Ere,Sx,wWe,Bre=Xe(()=>{Dx=ut(dre()),Cre=ut(yre()),IWe=/^(?![-?:,\][{}#&*!|>'"%@` \t\r\n]).([ \t]*(?![,\][{}:# \t\r\n]).)*$/,Ere=["__metadata","version","resolution","dependencies","peerDependencies","dependenciesMeta","peerDependenciesMeta","binaries"],Sx=class{constructor(e){this.data=e}};nl.PreserveOrdering=Sx;wWe=/^(#.*(\r?\n))*?#\s+yarn\s+lockfile\s+v1\r?\n/i});var J2={};Vt(J2,{parseResolution:()=>px,parseShell:()=>ux,parseSyml:()=>ls,stringifyArgument:()=>qU,stringifyArgumentSegment:()=>WU,stringifyArithmeticExpression:()=>Ax,stringifyCommand:()=>GU,stringifyCommandChain:()=>AE,stringifyCommandChainThen:()=>jU,stringifyCommandLine:()=>fx,stringifyCommandLineThen:()=>HU,stringifyEnvSegment:()=>cx,stringifyRedirectArgument:()=>H2,stringifyResolution:()=>hx,stringifyShell:()=>fE,stringifyShellLine:()=>fE,stringifySyml:()=>nl,stringifyValueArgument:()=>vd});var wc=Xe(()=>{wee();Dee();Bre()});var Sre=_((UQt,s_)=>{"use strict";var vWe=t=>{let e=!1,r=!1,s=!1;for(let a=0;a<t.length;a++){let n=t[a];e&&/[a-zA-Z]/.test(n)&&n.toUpperCase()===n?(t=t.slice(0,a)+"-"+t.slice(a),e=!1,s=r,r=!0,a++):r&&s&&/[a-zA-Z]/.test(n)&&n.toLowerCase()===n?(t=t.slice(0,a-1)+"-"+t.slice(a-1),s=r,r=!1,e=!0):(e=n.toLowerCase()===n&&n.toUpperCase()!==n,s=r,r=n.toUpperCase()===n&&n.toLowerCase()!==n)}return t},vre=(t,e)=>{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");e=Object.assign({pascalCase:!1},e);let r=a=>e.pascalCase?a.charAt(0).toUpperCase()+a.slice(1):a;return Array.isArray(t)?t=t.map(a=>a.trim()).filter(a=>a.length).join("-"):t=t.trim(),t.length===0?"":t.length===1?e.pascalCase?t.toUpperCase():t.toLowerCase():(t!==t.toLowerCase()&&(t=vWe(t)),t=t.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(a,n)=>n.toUpperCase()).replace(/\d+(\w|$)/g,a=>a.toUpperCase()),r(t))};s_.exports=vre;s_.exports.default=vre});var Dre=_((_Qt,SWe)=>{SWe.exports=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEH Line truncated
${this.candidates.map(({usage:a})=>`$ ${a}`).join(`
`)}`}else if(this.candidates.length===1){let[{usage:s}]=this.candidates;this.message=`Command not found; did you mean:
$ ${s}
${c_(e)}`}else this.message=`Command not found; did you mean one of:
${this.candidates.map(({usage:s},a)=>`${`${a}.`.padStart(4)} ${s}`).join(`
`)}
${c_(e)}`}},xx=class extends Error{constructor(e,r){super(),this.input=e,this.usages=r,this.clipanion={type:"none"},this.name="AmbiguousSyntaxError",this.message=`Cannot find which to pick amongst the following alternatives:
${this.usages.map((s,a)=>`${`${a}.`.padStart(4)} ${s}`).join(`
`)}
${c_(e)}`}},c_=t=>`While running ${t.filter(e=>e!==ei.EndOfInput&&e!==ei.EndOfPartialInput).map(e=>{let r=JSON.stringify(e);return e.match(/\s/)||e.length===0||r!==`"${e}"`?r:e}).join(" ")}`});function DWe(t){let e=t.split(`
`),r=e.filter(a=>a.match(/\S/)),s=r.length>0?r.reduce((a,n)=>Math.min(a,n.length-n.trimStart().length),Number.MAX_VALUE):0;return e.map(a=>a.slice(s).trimRight()).join(`
`)}function Ho(t,{format:e,paragraphs:r}){return t=t.replace(/\r\n?/g,`
`),t=DWe(t),t=t.replace(/^\n+|\n+$/g,""),t=t.replace(/^(\s*)-([^\n]*?)\n+/gm,`$1-$2
`),t=t.replace(/\n(\n)?\n*/g,(s,a)=>a||" "),r&&(t=t.split(/\n/).map(s=>{let a=s.match(/^\s*[*-][\t ]+(.*)/);if(!a)return s.match(/(.{1,80})(?: |$)/g).join(`
`);let n=s.length-s.trimStart().length;return a[1].match(new RegExp(`(.{1,${78-n}})(?: |$)`,"g")).map((c,f)=>" ".repeat(n)+(f===0?"- ":" ")+c).join(`
`)}).join(`
`)),t=t.replace(/(`+)((?:.|[\n])*?)\1/g,(s,a,n)=>e.code(a+n+a)),t=t.replace(/(\*\*)((?:.|[\n])*?)\1/g,(s,a,n)=>e.bold(a+n+a)),t?`${t}
`:""}var u_,kre,Qre,f_=Xe(()=>{u_=Array(80).fill("\u2501");for(let t=0;t<=24;++t)u_[u_.length-t]=`\x1B[38;5;${232+t}m\u2501`;kre={header:t=>`\x1B[1m\u2501\u2501\u2501 ${t}${t.length<75?` ${u_.slice(t.length+5).join("")}`:":"}\x1B[0m`,bold:t=>`\x1B[1m${t}\x1B[22m`,error:t=>`\x1B[31m\x1B[1m${t}\x1B[22m\x1B[39m`,code:t=>`\x1B[36m${t}\x1B[39m`},Qre={header:t=>t,bold:t=>t,error:t=>t,code:t=>t}});function ya(t){return{...t,[K2]:!0}}function Gf(t,e){return typeof t>"u"?[t,e]:typeof t=="object"&&t!==null&&!Array.isArray(t)?[void 0,t]:[t,e]}function Qx(t,{mergeName:e=!1}={}){let r=t.match(/^([^:]+): (.*)$/m);if(!r)return"validation failed";let[,s,a]=r;return e&&(a=a[0].toLowerCase()+a.slice(1)),a=s!=="."||!e?`${s.replace(/^\.(\[|$)/,"$1")}: ${a}`:`: ${a}`,a}function z2(t,e){return e.length===1?new nt(`${t}${Qx(e[0],{mergeName:!0})}`):new nt(`${t}:
${e.map(r=>`
- ${Qx(r)}`).join("")}`)}function Od(t,e,r){if(typeof r>"u")return e;let s=[],a=[],n=f=>{let p=e;return e=f,n.bind(null,p)};if(!r(e,{errors:s,coercions:a,coercion:n}))throw z2(`Invalid value for ${t}`,s);for(let[,f]of a)f();return e}var K2,Cp=Xe(()=>{kx();K2=Symbol("clipanion/isOption")});var Ea={};Vt(Ea,{KeyRelationship:()=>qf,TypeAssertionError:()=>o0,applyCascade:()=>$2,as:()=>WWe,assert:()=>jWe,assertWithErrors:()=>GWe,cascade:()=>Nx,fn:()=>YWe,hasAtLeastOneKey:()=>y_,hasExactLength:()=>Ore,hasForbiddenKeys:()=>fYe,hasKeyRelationship:()=>tB,hasMaxLength:()=>JWe,hasMinLength:()=>VWe,hasMutuallyExclusiveKeys:()=>AYe,hasRequiredKeys:()=>uYe,hasUniqueItems:()=>KWe,isArray:()=>Tx,isAtLeast:()=>d_,isAtMost:()=>ZWe,isBase64:()=>oYe,isBoolean:()=>FWe,isDate:()=>OWe,isDict:()=>UWe,isEnum:()=>fo,isHexColor:()=>sYe,isISO8601:()=>iYe,isInExclusiveRange:()=>eYe,isInInclusiveRange:()=>$We,isInstanceOf:()=>HWe,isInteger:()=>m_,isJSON:()=>aYe,isLiteral:()=>Rre,isLowerCase:()=>tYe,isMap:()=>MWe,isNegative:()=>zWe,isNullable:()=>cYe,isNumber:()=>h_,isObject:()=>Fre,isOneOf:()=>g_,isOptional:()=>lYe,isPartial:()=>_We,isPayload:()=>NWe,isPositive:()=>XWe,isRecord:()=>Fx,isSet:()=>LWe,isString:()=>wE,isTuple:()=>Rx,isUUID4:()=>nYe,isUnknown:()=>p_,isUpperCase:()=>rYe,makeTrait:()=>Nre,makeValidator:()=>Wr,matchesRegExp:()=>Z2,softAssert:()=>qWe});function ti(t){return t===null?"null":t===void 0?"undefined":t===""?"an empty string":typeof t=="symbol"?`<${t.toString()}>`:Array.isArray(t)?"an array":JSON.stringify(t)}function CE(t,e){if(t.length===0)return"nothing";if(t.length===1)return ti(t[0]);let r=t.slice(0,-1),s=t[t.length-1],a=t.length>2?`, ${e} `:` ${e} `;return`${r.map(n=>ti(n)).join(", ")}${a}${ti(s)}`}function s0(t,e){var r,s,a;return typeof e=="number"?`${(r=t?.p)!==null&&r!==void 0?r:"."}[${e}]`:bWe.test(e)?`${(s=t?.p)!==null&&s!==void 0?s:""}.${e}`:`${(a=t?.p)!==null&&a!==void 0?a:"."}[${JSON.stringify(e)}]`}function A_(t,e,r){return t===1?e:r}function mr({errors:t,p:e}={},r){return t?.push(`${e??"."}: ${r}`),!1}function TWe(t,e){return r=>{t[e]=r}}function Wf(t,e){return r=>{let s=t[e];return t[e]=r,Wf(t,e).bind(null,s)}}function X2(t,e,r){let s=()=>(t(r()),a),a=()=>(t(e),s);return s}function p_(){return Wr({test:(t,e)=>!0})}function Rre(t){return Wr({test:(e,r)=>e!==t?mr(r,`Expected ${ti(t)} (got ${ti(e)})`):!0})}function wE(){return Wr({test:(t,e)=>typeof t!="string"?mr(e,`Expected a string (got ${ti(t)})`):!0})}function fo(t){let e=Array.isArray(t)?t:Object.values(t),r=e.every(a=>typeof a=="string"||typeof a=="number"),s=new Set(e);return s.size===1?Rre([...s][0]):Wr({test:(a,n)=>s.has(a)?!0:r?mr(n,`Expected one of ${CE(e,"or")} (got ${ti(a)})`):mr(n,`Expected a valid enumeration value (got ${ti(a)})`)})}function FWe(){return Wr({test:(t,e)=>{var r;if(typeof t!="boolean"){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return mr(e,"Unbound coercion result");let s=RWe.get(t);if(typeof s<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,s)]),!0}return mr(e,`Expected a boolean (got ${ti(t)})`)}return!0}})}function h_(){return Wr({test:(t,e)=>{var r;if(typeof t!="number"){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return mr(e,"Unbound coercion result");let s;if(typeof t=="string"){let a;try{a=JSON.parse(t)}catch{}if(typeof a=="number")if(JSON.stringify(a)===t)s=a;else return mr(e,`Received a number that can't be safely represented by the runtime (${t})`)}if(typeof s<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,s)]),!0}return mr(e,`Expected a number (got ${ti(t)})`)}return!0}})}function NWe(t){return Wr({test:(e,r)=>{var s;if(typeof r?.coercions>"u")return mr(r,"The isPayload predicate can only be used with coercion enabled");if(typeof r.coercion>"u")return mr(r,"Unbound coercion result");if(typeof e!="string")return mr(r,`Expected a string (got ${ti(e)})`);let a;try{a=JSON.parse(e)}catch{return mr(r,`Expected a JSON string (got ${ti(e)})`)}let n={value:a};return t(a,Object.assign(Object.assign({},r),{coercion:Wf(n,"value")}))?(r.coercions.push([(s=r.p)!==null&&s!==void 0?s:".",r.coercion.bind(null,n.value)]),!0):!1}})}function OWe(){return Wr({test:(t,e)=>{var r;if(!(t instanceof Date)){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return mr(e,"Unbound coercion result");let s;if(typeof t=="string"&&Tre.test(t))s=new Date(t);else{let a;if(typeof t=="string"){let n;try{n=JSON.parse(t)}catch{}typeof n=="number"&&(a=n)}else typeof t=="number"&&(a=t);if(typeof a<"u")if(Number.isSafeInteger(a)||!Number.isSafeInteger(a*1e3))s=new Date(a*1e3);else return mr(e,`Received a timestamp that can't be safely represented by the runtime (${t})`)}if(typeof s<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,s)]),!0}return mr(e,`Expected a date (got ${ti(t)})`)}return!0}})}function Tx(t,{delimiter:e}={}){return Wr({test:(r,s)=>{var a;let n=r;if(typeof r=="string"&&typeof e<"u"&&typeof s?.coercions<"u"){iLine truncated
`;for(let s of e)r+=`
- ${s}`}super(r)}};eB={missing:(t,e)=>t.has(e),undefined:(t,e,r)=>t.has(e)&&typeof r[e]<"u",nil:(t,e,r)=>t.has(e)&&r[e]!=null,falsy:(t,e,r)=>t.has(e)&&!!r[e]};(function(t){t.Forbids="Forbids",t.Requires="Requires"})(qf||(qf={}));pYe={[qf.Forbids]:{expect:!1,message:"forbids using"},[qf.Requires]:{expect:!0,message:"requires using"}}});var ot,a0=Xe(()=>{Cp();ot=class{constructor(){this.help=!1}static Usage(e){return e}async catch(e){throw e}async validateAndExecute(){let r=this.constructor.schema;if(Array.isArray(r)){let{isDict:a,isUnknown:n,applyCascade:c}=await Promise.resolve().then(()=>(Ul(),Ea)),f=c(a(n()),r),p=[],h=[];if(!f(this,{errors:p,coercions:h}))throw z2("Invalid option schema",p);for(let[,C]of h)C()}else if(r!=null)throw new Error("Invalid command schema");let s=await this.execute();return typeof s<"u"?s:0}};ot.isOption=K2;ot.Default=[]});function il(t){l_&&console.log(t)}function Mre(){let t={nodes:[]};for(let e=0;e<En.CustomNode;++e)t.nodes.push(_l());return t}function hYe(t){let e=Mre(),r=[],s=e.nodes.length;for(let a of t){r.push(s);for(let n=0;n<a.nodes.length;++n)_re(n)||e.nodes.push(wYe(a.nodes[n],s));s+=a.nodes.length-En.CustomNode+1}for(let a of r)BE(e,En.InitialNode,a);return e}function Ou(t,e){return t.nodes.push(e),t.nodes.length-1}function gYe(t){let e=new Set,r=s=>{if(e.has(s))return;e.add(s);let a=t.nodes[s];for(let c of Object.values(a.statics))for(let{to:f}of c)r(f);for(let[,{to:c}]of a.dynamics)r(c);for(let{to:c}of a.shortcuts)r(c);let n=new Set(a.shortcuts.map(({to:c})=>c));for(;a.shortcuts.length>0;){let{to:c}=a.shortcuts.shift(),f=t.nodes[c];for(let[p,h]of Object.entries(f.statics)){let E=Object.prototype.hasOwnProperty.call(a.statics,p)?a.statics[p]:a.statics[p]=[];for(let C of h)E.some(({to:S})=>C.to===S)||E.push(C)}for(let[p,h]of f.dynamics)a.dynamics.some(([E,{to:C}])=>p===E&&h.to===C)||a.dynamics.push([p,h]);for(let p of f.shortcuts)n.has(p.to)||(a.shortcuts.push(p),n.add(p.to))}};r(En.InitialNode)}function dYe(t,{prefix:e=""}={}){if(l_){il(`${e}Nodes are:`);for(let r=0;r<t.nodes.length;++r)il(`${e} ${r}: ${JSON.stringify(t.nodes[r])}`)}}function mYe(t,e,r=!1){il(`Running a vm on ${JSON.stringify(e)}`);let s=[{node:En.InitialNode,state:{candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,options:[],path:[],positionals:[],remainder:null,selectedIndex:null,partial:!1,tokens:[]}}];dYe(t,{prefix:" "});let a=[ei.StartOfInput,...e];for(let n=0;n<a.length;++n){let c=a[n],f=c===ei.EndOfInput||c===ei.EndOfPartialInput,p=n-1;il(` Processing ${JSON.stringify(c)}`);let h=[];for(let{node:E,state:C}of s){il(` Current node is ${E}`);let S=t.nodes[E];if(E===En.ErrorNode){h.push({node:E,state:C});continue}console.assert(S.shortcuts.length===0,"Shortcuts should have been eliminated by now");let P=Object.prototype.hasOwnProperty.call(S.statics,c);if(!r||n<a.length-1||P)if(P){let I=S.statics[c];for(let{to:R,reducer:N}of I)h.push({node:R,state:typeof N<"u"?Ox(I_,N,C,c,p):C}),il(` Static transition to ${R} found`)}else il(" No static transition found");else{let I=!1;for(let R of Object.keys(S.statics))if(R.startsWith(c)){if(c===R)for(let{to:N,reducer:U}of S.statics[R])h.push({node:N,state:typeof U<"u"?Ox(I_,U,C,c,p):C}),il(` Static transition to ${N} found`);else for(let{to:N}of S.statics[R])h.push({node:N,state:{...C,remainder:R.slice(c.length)}}),il(` Static transition to ${N} found (partial match)`);I=!0}I||il(" No partial static transition found")}if(!f)for(let[I,{to:R,reducer:N}]of S.dynamics)Ox(BYe,I,C,c,p)&&(h.push({node:R,state:typeof N<"u"?Ox(I_,N,C,c,p):C}),il(` Dynamic transition to ${R} found (via ${I})`))}if(h.length===0&&f&&e.length===1)return[{node:En.InitialNode,state:Lre}];if(h.length===0)throw new IE(e,s.filter(({node:E})=>E!==En.ErrorNode).map(({state:E})=>({usage:E.candidateUsage,reason:null})));if(h.every(({node:E})=>E===En.ErrorNode))throw new IE(e,h.map(({state:E})=>({usage:E.candidateUsage,reason:E.errorMessage})));s=EYe(h)}if(s.length>0){il(" Results:");for(let n of s)il(` - ${n.node} -> ${JSON.stringify(n.state)}`)}else il(" No results");return s}function yYe(t,e,{endToken:r=ei.EndOfInput}={}){let s=mYe(t,[...e,r]);return IYe(e,s.map(({state:a})=>a))}function EYe(t){let e=0;for(let{state:r}of t)r.path.length>e&&(e=r.path.length);return t.filter(({state:r})=>r.path.length===e)}function IYe(t,e){let r=e.filter(S=>S.selectedIndex!==null),s=r.filter(S=>!S.partial);if(s.length>0&&(r=s),r.length===0)throw new Error;let a=r.filter(S=>S.selectedIndex===Nd||S.requiredOptions.every(P=>P.some(I=>S.options.find(R=>R.name===I))));if(a.length===0)throw new IE(t,r.map(S=>({usage:S.candidateUsage,reason:null})));let n=0;for(let S of a)S.path.length>n&&(n=S.path.length);let c=a.filter(S=>S.path.length===n),f=S=>S.positionals.filter(({extra:P})=>!P).length+S.options.length,p=c.map(S=>({state:S,positionalCount:f(S)})),h=0;for(let{positionalCount:S}of p)S>h&&(h=S);let E=p.filter(({positionalCount:S})=>S===h).map(({state:S Line truncated
`),this.context.stdout.write(`
`);let r=0;for(let s of this.commands)this.context.stdout.write(this.cli.usage(this.contexts[s].commandClass,{prefix:`${r++}. `.padStart(5)}));this.context.stdout.write(`
`),this.context.stdout.write(`Run again with -h=<index> to see the longer details of any of those commands.
`)}}}});async function Jre(...t){let{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:s,resolvedContext:a}=zre(t);return Ca.from(r,e).runExit(s,a)}async function Kre(...t){let{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:s,resolvedContext:a}=zre(t);return Ca.from(r,e).run(s,a)}function zre(t){let e,r,s,a;switch(typeof process<"u"&&typeof process.argv<"u"&&(s=process.argv.slice(2)),t.length){case 1:r=t[0];break;case 2:t[0]&&t[0].prototype instanceof ot||Array.isArray(t[0])?(r=t[0],Array.isArray(t[1])?s=t[1]:a=t[1]):(e=t[0],r=t[1]);break;case 3:Array.isArray(t[2])?(e=t[0],r=t[1],s=t[2]):t[0]&&t[0].prototype instanceof ot||Array.isArray(t[0])?(r=t[0],s=t[1],a=t[2]):(e=t[0],r=t[1],a=t[2]);break;default:e=t[0],r=t[1],s=t[2],a=t[3];break}if(typeof s>"u")throw new Error("The argv parameter must be provided when running Clipanion outside of a Node context");return{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:s,resolvedContext:a}}function Vre(t){return t()}var Yre,Ca,Xre=Xe(()=>{Px();Mx();f_();qre();a0();Wre();Yre=Symbol("clipanion/errorCommand");Ca=class t{constructor({binaryLabel:e,binaryName:r="...",binaryVersion:s,enableCapture:a=!1,enableColors:n}={}){this.registrations=new Map,this.builder=new Lx({binaryName:r}),this.binaryLabel=e,this.binaryName=r,this.binaryVersion=s,this.enableCapture=a,this.enableColors=n}static from(e,r={}){let s=new t(r),a=Array.isArray(e)?e:[e];for(let n of a)s.register(n);return s}register(e){var r;let s=new Map,a=new e;for(let p in a){let h=a[p];typeof h=="object"&&h!==null&&h[ot.isOption]&&s.set(p,h)}let n=this.builder.command(),c=n.cliIndex,f=(r=e.paths)!==null&&r!==void 0?r:a.paths;if(typeof f<"u")for(let p of f)n.addPath(p);this.registrations.set(e,{specs:s,builder:n,index:c});for(let[p,{definition:h}]of s.entries())h(n,p);n.setContext({commandClass:e})}process(e,r){let{input:s,context:a,partial:n}=typeof e=="object"&&Array.isArray(e)?{input:e,context:r}:e,{contexts:c,process:f}=this.builder.compile(),p=f(s,{partial:n}),h={...t.defaultContext,...a};switch(p.selectedIndex){case Nd:{let E=_x.from(p,c);return E.context=h,E.tokens=p.tokens,E}default:{let{commandClass:E}=c[p.selectedIndex],C=this.registrations.get(E);if(typeof C>"u")throw new Error("Assertion failed: Expected the command class to have been registered.");let S=new E;S.context=h,S.tokens=p.tokens,S.path=p.path;try{for(let[P,{transformer:I}]of C.specs.entries())S[P]=I(C.builder,P,p,h);return S}catch(P){throw P[Yre]=S,P}}break}}async run(e,r){var s,a;let n,c={...t.defaultContext,...r},f=(s=this.enableColors)!==null&&s!==void 0?s:c.colorDepth>1;if(!Array.isArray(e))n=e;else try{n=this.process(e,c)}catch(E){return c.stdout.write(this.error(E,{colored:f})),1}if(n.help)return c.stdout.write(this.usage(n,{colored:f,detailed:!0})),0;n.context=c,n.cli={binaryLabel:this.binaryLabel,binaryName:this.binaryName,binaryVersion:this.binaryVersion,enableCapture:this.enableCapture,enableColors:this.enableColors,definitions:()=>this.definitions(),definition:E=>this.definition(E),error:(E,C)=>this.error(E,C),format:E=>this.format(E),process:(E,C)=>this.process(E,{...c,...C}),run:(E,C)=>this.run(E,{...c,...C}),usage:(E,C)=>this.usage(E,C)};let p=this.enableCapture&&(a=Gre(c))!==null&&a!==void 0?a:Vre,h;try{h=await p(()=>n.validateAndExecute().catch(E=>n.catch(E).then(()=>0)))}catch(E){return c.stdout.write(this.error(E,{colored:f,command:n})),1}return h}async runExit(e,r){process.exitCode=await this.run(e,r)}definition(e,{colored:r=!1}={}){if(!e.usage)return null;let{usage:s}=this.getUsageByRegistration(e,{detailed:!1}),{usage:a,options:n}=this.getUsageByRegistration(e,{detailed:!0,inlineOptions:!1}),c=typeof e.usage.category<"u"?Ho(e.usage.category,{format:this.format(r),paragraphs:!1}):void 0,f=typeof e.usage.description<"u"?Ho(e.usage.description,{format:this.format(r),paragraphs:!1}):void 0,p=typeof e.usage.details<"u"?Ho(e.usage.details,{format:this.format(r),paragraphs:!0}):void 0,h=typeof e.usage.examples<"u"?e.usage.examples.map(([E,C])=>[Ho(E,{format:this.format(r),paragraphs:!1}),C.replace(/\$0/g,this.binaryName)]):void 0;return{path:s,usage:a,category:c,description:f,details:p,examples:h,options:n}}definitions({colored:e=!1}={}){let r=[];for(let s of this.registrations.keys()){let a=this.definition(s,{colored:e});a&&r.push(a)}return r}usage(e=null,{colored:r,detailed:s=!1,prefix:a="$ "}={}){var n;if(e===null){for(let p of this.registrations.keys()){let h=p.paths,E=typeof p.usage<"u";if(!h||h.length===0||h.length===1&&h[0].length===0||((n=h?.some(P=>P.length===0))!==null&&n!==void 0?n:!1))if(e){e=null;break}else e=p;else if(E){e=null;continue}}e&&(s=!0)}let c=e!==null&&e instanceof ot?e.constructor:e,f="";if(c)if(s){let{description:p="",details:h="",examples:E=[]}=c.usage||{};p!==""&&(f+=Ho(p,{format:this.format(r),paragraphs:!1}).replace(/^./,P=>P.toUpperCase()),f+=`
`),(h!==""||E.length>0)&&(f+=`${this.format(r).header("Usage")}
`,f+=`
`);let{usage:C,options:S}=this.getUsageByRegistration(c,{inlineOptions:!1});if(f+=`${this.format(r).bold(a)}${C}
`,S.length>0){f+=`
`,f+=`${this.format(r).header("Options")}
`;let P=S.reduce((I,R)=>Math.max(I,R.definition.length),0);f+=`
`;for(let{definition:I,description:R}of S)f+=` ${this.format(r).bold(I.padEnd(P))} ${Ho(R,{format:this.format(r),paragraphs:!1})}`}if(h!==""&&(f+=`
`,f+=`${this.format(r).header("Details")}
`,f+=`
`,f+=Ho(h,{format:this.format(r),paragraphs:!0})),E.length>0){f+=`
`,f+=`${this.format(r).header("Examples")}
`;for(let[P,I]of E)f+=`
`,f+=Ho(P,{format:this.format(r),paragraphs:!1}),f+=`${I.replace(/^/m,` ${this.format(r).bold(a)}`).replace(/\$0/g,this.binaryName)}
`}}else{let{usage:p}=this.getUsageByRegistration(c);f+=`${this.format(r).bold(a)}${p}
`}else{let p=new Map;for(let[S,{index:P}]of this.registrations.entries()){if(typeof S.usage>"u")continue;let I=typeof S.usage.category<"u"?Ho(S.usage.category,{format:this.format(r),paragraphs:!1}):null,R=p.get(I);typeof R>"u"&&p.set(I,R=[]);let{usage:N}=this.getUsageByIndex(P);R.push({commandClass:S,usage:N})}let h=Array.from(p.keys()).sort((S,P)=>S===null?-1:P===null?1:S.localeCompare(P,"en",{usage:"sort",caseFirst:"upper"})),E=typeof this.binaryLabel<"u",C=typeof this.binaryVersion<"u";E||C?(E&&C?f+=`${this.format(r).header(`${this.binaryLabel} - ${this.binaryVersion}`)}
`:E?f+=`${this.format(r).header(`${this.binaryLabel}`)}
`:f+=`${this.format(r).header(`${this.binaryVersion}`)}
`,f+=` ${this.format(r).bold(a)}${this.binaryName} <command>
`):f+=`${this.format(r).bold(a)}${this.binaryName} <command>
`;for(let S of h){let P=p.get(S).slice().sort((R,N)=>R.usage.localeCompare(N.usage,"en",{usage:"sort",caseFirst:"upper"})),I=S!==null?S.trim():"General commands";f+=`
`,f+=`${this.format(r).header(`${I}`)}
`;for(let{commandClass:R,usage:N}of P){let U=R.usage.description||"undocumented";f+=`
`,f+=` ${this.format(r).bold(N)}
`,f+=` ${Ho(U,{format:this.format(r),paragraphs:!1})}`}}f+=`
`,f+=Ho("You can also print more details about any of these commands by calling them with the `-h,--help` flag right after the command name.",{format:this.format(r),paragraphs:!0})}return f}error(e,r){var s,{colored:a,command:n=(s=e[Yre])!==null&&s!==void 0?s:null}=r===void 0?{}:r;(!e||typeof e!="object"||!("stack"in e))&&(e=new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(e)})`));let c="",f=e.name.replace(/([a-z])([A-Z])/g,"$1 $2");f==="Error"&&(f="Internal Error"),c+=`${this.format(a).error(f)}: ${e.message}
`;let p=e.clipanion;return typeof p<"u"?p.type==="usage"&&(c+=`
`,c+=this.usage(n)):e.stack&&(c+=`${e.stack.replace(/^.*\n/,"")}
`),c}format(e){var r;return((r=e??this.enableColors)!==null&&r!==void 0?r:t.defaultContext.colorDepth>1)?kre:Qre}getUsageByRegistration(e,r){let s=this.registrations.get(e);if(typeof s>"u")throw new Error("Assertion failed: Unregistered command");return this.getUsageByIndex(s.index,r)}getUsageByIndex(e,r){return this.builder.getBuilderByIndex(e).usage(r)}};Ca.defaultContext={env:process.env,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr,colorDepth:jre()}});var rB,Zre=Xe(()=>{a0();rB=class extends ot{async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.definitions(),null,2)}
`)}};rB.paths=[["--clipanion=definitions"]]});var nB,$re=Xe(()=>{a0();nB=class extends ot{async execute(){this.context.stdout.write(this.cli.usage())}};nB.paths=[["-h"],["--help"]]});function Hx(t={}){return ya({definition(e,r){var s;e.addProxy({name:(s=t.name)!==null&&s!==void 0?s:r,required:t.required})},transformer(e,r,s){return s.positionals.map(({value:a})=>a)}})}var w_=Xe(()=>{Cp()});var iB,ene=Xe(()=>{a0();w_();iB=class extends ot{constructor(){super(...arguments),this.args=Hx()}async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.process(this.args).tokens,null,2)}
`)}};iB.paths=[["--clipanion=tokens"]]});var sB,tne=Xe(()=>{a0();sB=class extends ot{async execute(){var e;this.context.stdout.write(`${(e=this.cli.binaryVersion)!==null&&e!==void 0?e:"<unknown>"}
`)}};sB.paths=[["-v"],["--version"]]});var B_={};Vt(B_,{DefinitionsCommand:()=>rB,HelpCommand:()=>nB,TokensCommand:()=>iB,VersionCommand:()=>sB});var rne=Xe(()=>{Zre();$re();ene();tne()});function nne(t,e,r){let[s,a]=Gf(e,r??{}),{arity:n=1}=a,c=t.split(","),f=new Set(c);return ya({definition(p){p.addOption({names:c,arity:n,hidden:a?.hidden,description:a?.description,required:a.required})},transformer(p,h,E){let C,S=typeof s<"u"?[...s]:void 0;for(let{name:P,value:I}of E.options)f.has(P)&&(C=P,S=S??[],S.push(I));return typeof S<"u"?Od(C??h,S,a.validator):S}})}var ine=Xe(()=>{Cp()});function sne(t,e,r){let[s,a]=Gf(e,r??{}),n=t.split(","),c=new Set(n);return ya({definition(f){f.addOption({names:n,allowBinding:!1,arity:0,hidden:a.hidden,description:a.description,required:a.required})},transformer(f,p,h){let E=s;for(let{name:C,value:S}of h.options)c.has(C)&&(E=S);return E}})}var one=Xe(()=>{Cp()});function ane(t,e,r){let[s,a]=Gf(e,r??{}),n=t.split(","),c=new Set(n);return ya({definition(f){f.addOption({names:n,allowBinding:!1,arity:0,hidden:a.hidden,description:a.description,required:a.required})},transformer(f,p,h){let E=s;for(let{name:C,value:S}of h.options)c.has(C)&&(E??(E=0),S?E+=1:E=0);return E}})}var lne=Xe(()=>{Cp()});function cne(t={}){return ya({definition(e,r){var s;e.addRest({name:(s=t.name)!==null&&s!==void 0?s:r,required:t.required})},transformer(e,r,s){let a=c=>{let f=s.positionals[c];return f.extra===Hl||f.extra===!1&&c<e.arity.leading.length},n=0;for(;n<s.positionals.length&&a(n);)n+=1;return s.positionals.splice(0,n).map(({value:c})=>c)}})}var une=Xe(()=>{Mx();Cp()});function vYe(t,e,r){let[s,a]=Gf(e,r??{}),{arity:n=1}=a,c=t.split(","),f=new Set(c);return ya({definition(p){p.addOption({names:c,arity:a.tolerateBoolean?0:n,hidden:a.hidden,description:a.description,required:a.required})},transformer(p,h,E,C){let S,P=s;typeof a.env<"u"&&C.env[a.env]&&(S=a.env,P=C.env[a.env]);for(let{name:I,value:R}of E.options)f.has(I)&&(S=I,P=R);return typeof P=="string"?Od(S??h,P,a.validator):P}})}function SYe(t={}){let{required:e=!0}=t;return ya({definition(r,s){var a;r.addPositional({name:(a=t.name)!==null&&a!==void 0?a:s,required:t.required})},transformer(r,s,a){var n;for(let c=0;c<a.positionals.length;++c){if(a.positionals[c].extra===Hl||e&&a.positionals[c].extra===!0||!e&&a.positionals[c].extra===!1)continue;let[f]=a.positionals.splice(c,1);return Od((n=t.name)!==null&&n!==void 0?n:s,f.value,t.validator)}}})}function fne(t,...e){return typeof t=="string"?vYe(t,...e):SYe(t)}var Ane=Xe(()=>{Mx();Cp()});var ge={};Vt(ge,{Array:()=>nne,Boolean:()=>sne,Counter:()=>ane,Proxy:()=>Hx,Rest:()=>cne,String:()=>fne,applyValidator:()=>Od,cleanValidationError:()=>Qx,formatError:()=>z2,isOptionSymbol:()=>K2,makeCommandOption:()=>ya,rerouteArguments:()=>Gf});var pne=Xe(()=>{Cp();w_();ine();one();lne();une();Ane()});var oB={};Vt(oB,{Builtins:()=>B_,Cli:()=>Ca,Command:()=>ot,Option:()=>ge,UsageError:()=>nt,formatMarkdownish:()=>Ho,run:()=>Kre,runExit:()=>Jre});var Yt=Xe(()=>{kx();f_();a0();Xre();rne();pne()});var hne=_((VTt,DYe)=>{DYe.exports={name:"dotenv",version:"16.3.1",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard","lint-readme":"standard-markdown",pretest:"npm run lint && npm run dts-check",test:"tap tests/*.js --100 -Rspec",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://github.com/motdotla/dotenv?sponsor=1",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@definitelytyped/dtslint":"^0.0.133","@types/node":"^18.11.3",decache:"^4.6.1",sinon:"^14.0.1",standard:"^17.0.0","standard-markdown":"^7.1.0","standard-version":"^9.5.0",tap:"^16.3.0",tar:"^6.1.11",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var yne=_((JTt,wp)=>{var gne=Ie("fs"),S_=Ie("path"),bYe=Ie("os"),PYe=Ie("crypto"),xYe=hne(),D_=xYe.version,kYe=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function QYe(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,`
`);let s;for(;(s=kYe.exec(r))!=null;){let a=s[1],n=s[2]||"";n=n.trim();let c=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),c==='"'&&(n=n.replace(/\\n/g,`
`),n=n.replace(/\\r/g,"\r")),e[a]=n}return e}function TYe(t){let e=mne(t),r=js.configDotenv({path:e});if(!r.parsed)throw new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);let s=dne(t).split(","),a=s.length,n;for(let c=0;c<a;c++)try{let f=s[c].trim(),p=NYe(r,f);n=js.decrypt(p.ciphertext,p.key);break}catch(f){if(c+1>=a)throw f}return js.parse(n)}function RYe(t){console.log(`[dotenv@${D_}][INFO] ${t}`)}function FYe(t){console.log(`[dotenv@${D_}][WARN] ${t}`)}function v_(t){console.log(`[dotenv@${D_}][DEBUG] ${t}`)}function dne(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function NYe(t,e){let r;try{r=new URL(e)}catch(f){throw f.code==="ERR_INVALID_URL"?new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development"):f}let s=r.password;if(!s)throw new Error("INVALID_DOTENV_KEY: Missing key part");let a=r.searchParams.get("environment");if(!a)throw new Error("INVALID_DOTENV_KEY: Missing environment part");let n=`DOTENV_VAULT_${a.toUpperCase()}`,c=t.parsed[n];if(!c)throw new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${n} in your .env.vault file.`);return{ciphertext:c,key:s}}function mne(t){let e=S_.resolve(process.cwd(),".env");return t&&t.path&&t.path.length>0&&(e=t.path),e.endsWith(".vault")?e:`${e}.vault`}function OYe(t){return t[0]==="~"?S_.join(bYe.homedir(),t.slice(1)):t}function LYe(t){RYe("Loading env from encrypted .env.vault");let e=js._parseVault(t),r=process.env;return t&&t.processEnv!=null&&(r=t.processEnv),js.populate(r,e,t),{parsed:e}}function MYe(t){let e=S_.resolve(process.cwd(),".env"),r="utf8",s=!!(t&&t.debug);t&&(t.path!=null&&(e=OYe(t.path)),t.encoding!=null&&(r=t.encoding));try{let a=js.parse(gne.readFileSync(e,{encoding:r})),n=process.env;return t&&t.processEnv!=null&&(n=t.processEnv),js.populate(n,a,t),{parsed:a}}catch(a){return s&&v_(`Failed to load ${e} ${a.message}`),{error:a}}}function UYe(t){let e=mne(t);return dne(t).length===0?js.configDotenv(t):gne.existsSync(e)?js._configVault(t):(FYe(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),js.configDotenv(t))}function _Ye(t,e){let r=Buffer.from(e.slice(-64),"hex"),s=Buffer.from(t,"base64"),a=s.slice(0,12),n=s.slice(-16);s=s.slice(12,-16);try{let c=PYe.createDecipheriv("aes-256-gcm",r,a);return c.setAuthTag(n),`${c.update(s)}${c.final()}`}catch(c){let f=c instanceof RangeError,p=c.message==="Invalid key length",h=c.message==="Unsupported state or unable to authenticate data";if(f||p){let E="INVALID_DOTENV_KEY: It must be 64 characters long (or more)";throw new Error(E)}else if(h){let E="DECRYPTION_FAILED: Please check your DOTENV_KEY";throw new Error(E)}else throw console.error("Error: ",c.code),console.error("Error: ",c.message),c}}function HYe(t,e,r={}){let s=!!(r&&r.debug),a=!!(r&&r.override);if(typeof e!="object")throw new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");for(let n of Object.keys(e))Object.prototype.hasOwnProperty.call(t,n)?(a===!0&&(t[n]=e[n]),s&&v_(a===!0?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):t[n]=e[n]}var js={configDotenv:MYe,_configVault:LYe,_parseVault:TYe,config:UYe,decrypt:_Ye,parse:QYe,populate:HYe};wp.exports.configDotenv=js.configDotenv;wp.exports._configVault=js._configVault;wp.exports._parseVault=js._parseVault;wp.exports.config=js.config;wp.exports.decrypt=js.decrypt;wp.exports.parse=js.parse;wp.exports.populate=js.populate;wp.exports=js});var Ine=_((KTt,Ene)=>{"use strict";Ene.exports=(t,...e)=>new Promise(r=>{r(t(...e))})});var Ld=_((zTt,b_)=>{"use strict";var jYe=Ine(),Cne=t=>{if(t<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=[],r=0,s=()=>{r--,e.length>0&&e.shift()()},a=(f,p,...h)=>{r++;let E=jYe(f,...h);p(E),E.then(s,s)},n=(f,p,...h)=>{r<t?a(f,p,...h):e.push(a.bind(null,f,p,...h))},c=(f,...p)=>new Promise(h=>n(f,h,...p));return Object.defineProperties(c,{activeCount:{get:()=>r},pendingCount:{get:()=>e.length}}),c};b_.exports=Cne;b_.exports.default=Cne});function Yf(t){return`YN${t.toString(10).padStart(4,"0")}`}function jx(t){let e=Number(t.slice(2));if(typeof Br[e]>"u")throw new Error(`Unknown message name: "${t}"`);return e}var Br,Gx=Xe(()=>{Br=(Me=>(Me[Me.UNNAMED=0]="UNNAMED",Me[Me.EXCEPTION=1]="EXCEPTION",Me[Me.MISSING_PEER_DEPENDENCY=2]="MISSING_PEER_DEPENDENCY",Me[Me.CYCLIC_DEPENDENCIES=3]="CYCLIC_DEPENDENCIES",Me[Me.DISABLED_BUILD_SCRIPTS=4]="DISABLED_BUILD_SCRIPTS",Me[Me.BUILD_DISABLED=5]="BUILD_DISABLED",Me[Me.SOFT_LINK_BUILD=6]="SOFT_LINK_BUILD",Me[Me.MUST_BUILD=7]="MUST_BUILD",Me[Me.MUST_REBUILD=8]="MUST_REBUILD",Me[Me.BUILD_FAILED=9]="BUILD_FAILED",Me[Me.RESOLVER_NOT_FOUND=10]="RESOLVER_NOT_FOUND",Me[Me.FETCHER_NOT_FOUND=11]="FETCHER_NOT_FOUND",Me[Me.LINKER_NOT_FOUND=12]="LINKER_NOT_FO Line truncated
`,"\r","(",")","!","|","&","^"],!0,!1),le=function($){return e.queryPattern.test($)},me=function($){return e.checkFn($)},pe=ke("whitespace"),Be=/^[ \t\n\r]/,Ce=Ne([" "," ",`
`,"\r"],!1,!1),g=0,we=0,ye=[{line:1,column:1}],Ae=0,se=[],Z=0,De;if("startRule"in e){if(!(e.startRule in s))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=s[e.startRule]}function Re(){return t.substring(we,g)}function mt(){return Ue(we,g)}function j($,oe){throw oe=oe!==void 0?oe:Ue(we,g),b([ke($)],t.substring(we,g),oe)}function rt($,oe){throw oe=oe!==void 0?oe:Ue(we,g),w($,oe)}function Fe($,oe){return{type:"literal",text:$,ignoreCase:oe}}function Ne($,oe,xe){return{type:"class",parts:$,inverted:oe,ignoreCase:xe}}function Pe(){return{type:"any"}}function Ve(){return{type:"end"}}function ke($){return{type:"other",description:$}}function it($){var oe=ye[$],xe;if(oe)return oe;for(xe=$-1;!ye[xe];)xe--;for(oe=ye[xe],oe={line:oe.line,column:oe.column};xe<$;)t.charCodeAt(xe)===10?(oe.line++,oe.column=1):oe.column++,xe++;return ye[$]=oe,oe}function Ue($,oe){var xe=it($),Te=it(oe);return{start:{offset:$,line:xe.line,column:xe.column},end:{offset:oe,line:Te.line,column:Te.column}}}function x($){g<Ae||(g>Ae&&(Ae=g,se=[]),se.push($))}function w($,oe){return new jd($,null,null,oe)}function b($,oe,xe){return new jd(jd.buildMessage($,oe),$,oe,xe)}function y(){var $,oe,xe,Te,lt,Ct,qt,ir;if($=g,oe=F(),oe!==r){for(xe=[],Te=g,lt=X(),lt!==r?(t.charCodeAt(g)===124?(Ct=n,g++):(Ct=r,Z===0&&x(c)),Ct===r&&(t.charCodeAt(g)===38?(Ct=f,g++):(Ct=r,Z===0&&x(p)),Ct===r&&(t.charCodeAt(g)===94?(Ct=h,g++):(Ct=r,Z===0&&x(E)))),Ct!==r?(qt=X(),qt!==r?(ir=F(),ir!==r?(lt=[lt,Ct,qt,ir],Te=lt):(g=Te,Te=r)):(g=Te,Te=r)):(g=Te,Te=r)):(g=Te,Te=r);Te!==r;)xe.push(Te),Te=g,lt=X(),lt!==r?(t.charCodeAt(g)===124?(Ct=n,g++):(Ct=r,Z===0&&x(c)),Ct===r&&(t.charCodeAt(g)===38?(Ct=f,g++):(Ct=r,Z===0&&x(p)),Ct===r&&(t.charCodeAt(g)===94?(Ct=h,g++):(Ct=r,Z===0&&x(E)))),Ct!==r?(qt=X(),qt!==r?(ir=F(),ir!==r?(lt=[lt,Ct,qt,ir],Te=lt):(g=Te,Te=r)):(g=Te,Te=r)):(g=Te,Te=r)):(g=Te,Te=r);xe!==r?(we=$,oe=C(oe,xe),$=oe):(g=$,$=r)}else g=$,$=r;return $}function F(){var $,oe,xe,Te,lt,Ct;return $=g,t.charCodeAt(g)===33?(oe=S,g++):(oe=r,Z===0&&x(P)),oe!==r?(xe=F(),xe!==r?(we=$,oe=I(xe),$=oe):(g=$,$=r)):(g=$,$=r),$===r&&($=g,t.charCodeAt(g)===40?(oe=R,g++):(oe=r,Z===0&&x(N)),oe!==r?(xe=X(),xe!==r?(Te=y(),Te!==r?(lt=X(),lt!==r?(t.charCodeAt(g)===41?(Ct=U,g++):(Ct=r,Z===0&&x(W)),Ct!==r?(we=$,oe=ee(Te),$=oe):(g=$,$=r)):(g=$,$=r)):(g=$,$=r)):(g=$,$=r)):(g=$,$=r),$===r&&($=z())),$}function z(){var $,oe,xe,Te,lt;if($=g,oe=X(),oe!==r){if(xe=g,Te=[],ie.test(t.charAt(g))?(lt=t.charAt(g),g++):(lt=r,Z===0&&x(ue)),lt!==r)for(;lt!==r;)Te.push(lt),ie.test(t.charAt(g))?(lt=t.charAt(g),g++):(lt=r,Z===0&&x(ue));else Te=r;Te!==r?xe=t.substring(xe,g):xe=Te,xe!==r?(we=g,Te=le(xe),Te?Te=void 0:Te=r,Te!==r?(we=$,oe=me(xe),$=oe):(g=$,$=r)):(g=$,$=r)}else g=$,$=r;return $}function X(){var $,oe;for(Z++,$=[],Be.test(t.charAt(g))?(oe=t.charAt(g),g++):(oe=r,Z===0&&x(Ce));oe!==r;)$.push(oe),Be.test(t.charAt(g))?(oe=t.charAt(g),g++):(oe=r,Z===0&&x(Ce));return Z--,$===r&&(oe=r,Z===0&&x(pe)),$}if(De=a(),De!==r&&g===t.length)return De;throw De!==r&&g<t.length&&x(Ve()),b(se,Ae<t.length?t.charAt(Ae):null,Ae<t.length?Ue(Ae,Ae+1):Ue(Ae,Ae))}yse.exports={SyntaxError:jd,parse:HJe}});var Ise=_(rk=>{var{parse:jJe}=Ese();rk.makeParser=(t=/[a-z]+/)=>(e,r)=>jJe(e,{queryPattern:t,checkFn:r});rk.parse=rk.makeParser()});var wse=_((YRt,Cse)=>{"use strict";Cse.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightLine truncated
`:`
`)+r,a=s+1,s=t.indexOf(`
`,a)}while(s!==-1);return n+=t.substr(a),n};Use.exports={stringReplaceAll:tKe,stringEncaseCRLFWithFirstIndex:rKe}});var Wse=_((eFt,qse)=>{"use strict";var nKe=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Hse=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,iKe=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,sKe=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,oKe=new Map([["n",`
`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function Gse(t){let e=t[0]==="u",r=t[1]==="{";return e&&!r&&t.length===5||t[0]==="x"&&t.length===3?String.fromCharCode(parseInt(t.slice(1),16)):e&&r?String.fromCodePoint(parseInt(t.slice(2,-1),16)):oKe.get(t)||t}function aKe(t,e){let r=[],s=e.trim().split(/\s*,\s*/g),a;for(let n of s){let c=Number(n);if(!Number.isNaN(c))r.push(c);else if(a=n.match(iKe))r.push(a[2].replace(sKe,(f,p,h)=>p?Gse(p):h));else throw new Error(`Invalid Chalk template style argument: ${n} (in style '${t}')`)}return r}function lKe(t){Hse.lastIndex=0;let e=[],r;for(;(r=Hse.exec(t))!==null;){let s=r[1];if(r[2]){let a=aKe(s,r[2]);e.push([s].concat(a))}else e.push([s])}return e}function jse(t,e){let r={};for(let a of e)for(let n of a.styles)r[n[0]]=a.inverse?null:n.slice(1);let s=t;for(let[a,n]of Object.entries(r))if(Array.isArray(n)){if(!(a in s))throw new Error(`Unknown Chalk style: ${a}`);s=n.length>0?s[a](...n):s[a]}return s}qse.exports=(t,e)=>{let r=[],s=[],a=[];if(e.replace(nKe,(n,c,f,p,h,E)=>{if(c)a.push(Gse(c));else if(p){let C=a.join("");a=[],s.push(r.length===0?C:jse(t,r)(C)),r.push({inverse:f,styles:lKe(p)})}else if(h){if(r.length===0)throw new Error("Found extraneous } in Chalk template literal");s.push(jse(t,r)(a.join(""))),a=[],r.pop()}else a.push(E)}),s.push(a.join("")),r.length>0){let n=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(n)}return s.join("")}});var TE=_((tFt,Xse)=>{"use strict";var mB=sk(),{stdout:t4,stderr:r4}=Mse(),{stringReplaceAll:cKe,stringEncaseCRLFWithFirstIndex:uKe}=_se(),{isArray:ok}=Array,Vse=["ansi","ansi","ansi256","ansi16m"],QE=Object.create(null),fKe=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=t4?t4.level:0;t.level=e.level===void 0?r:e.level},n4=class{constructor(e){return Jse(e)}},Jse=t=>{let e={};return fKe(e,t),e.template=(...r)=>zse(e.template,...r),Object.setPrototypeOf(e,ak.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=n4,e.template};function ak(t){return Jse(t)}for(let[t,e]of Object.entries(mB))QE[t]={get(){let r=lk(this,i4(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,t,{value:r}),r}};QE.visible={get(){let t=lk(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:t}),t}};var Kse=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let t of Kse)QE[t]={get(){let{level:e}=this;return function(...r){let s=i4(mB.color[Vse[e]][t](...r),mB.color.close,this._styler);return lk(this,s,this._isEmpty)}}};for(let t of Kse){let e="bg"+t[0].toUpperCase()+t.slice(1);QE[e]={get(){let{level:r}=this;return function(...s){let a=i4(mB.bgColor[Vse[r]][t](...s),mB.bgColor.close,this._styler);return lk(this,a,this._isEmpty)}}}}var AKe=Object.defineProperties(()=>{},{...QE,level:{enumerable:!0,get(){return this._generator.level},set(t){this._generator.level=t}}}),i4=(t,e,r)=>{let s,a;return r===void 0?(s=t,a=e):(s=r.openAll+t,a=e+r.closeAll),{open:t,close:e,openAll:s,closeAll:a,parent:r}},lk=(t,e,r)=>{let s=(...a)=>ok(a[0])&&ok(a[0].raw)?Yse(s,zse(s,...a)):Yse(s,a.length===1?""+a[0]:a.join(" "));return Object.setPrototypeOf(s,AKe),s._generator=t,s._styler=e,s._isEmpty=r,s},Yse=(t,e)=>{if(t.level<=0||!e)return t._isEmpty?"":e;let r=t._styler;if(r===void 0)return e;let{openAll:s,closeAll:a}=r;if(e.indexOf("\x1B")!==-1)for(;r!==void 0;)e=cKe(e,r.close,r.open),r=r.parent;let n=e.indexOf(`
`);return n!==-1&&(e=uKe(e,a,s,n)),s+e+a},e4,zse=(t,...e)=>{let[r]=e;if(!ok(r)||!ok(r.raw))return e.join(" ");let s=e.slice(1),a=[r.raw[0]];for(let n=1;n<r.length;n++)a.push(String(s[n-1]).replace(/[{}\\]/g,"\\$&"),String(r.raw[n]));return e4===void 0&&(e4=Wse()),e4(t,a.join(""))};Object.defineProperties(ak.prototype,QE);var ck=ak();ck.supportsColor=t4;ck.stderr=ak({level:r4?r4.level:0});ck.stderr.supportsColor=r4;Xse.exports=ck});var uk=_(Dc=>{"use strict";Dc.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Dc.find=(t,e)=>t.nodes.find(r=>r.type===e);Dc.exceedsLimit=(t,e,r=1,s)=>s===!1||!Dc.isInteger(t)||!Dc.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=s;Dc.escapeNode=(t,e=0,r)=>{let s=t.nodes[e];s&&(r&&s.type===r||s.type==="open"||s.type==="close")&&s.escaped!==!0&&(s.value="\\"+s.value,s.escaped=!0)};Dc.encloseBrace=t=>t.type!=="brace"||t.commas>>0+t.ranges>>0?!1:(t.invalid=!0,!0);Dc.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:!(t.commas>>0+t.ranges>>0)||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;Dc.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Dc.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);Dc.flatten=(...t)=>{let e=[],r=s=>{for(let a=0;a<s.length;a++){let n=s[a];Array.isArray(n)?r(n,e):n!==void 0&&e.push(n)}return e};return r(t),e}});var fk=_((nFt,$se)=>{"use strict";var Zse=uk();$se.exports=(t,e={})=>{let r=(s,a={})=>{let n=e.escapeInvalid&&Zse.isInvalidBrace(a),c=s.invalid===!0&&e.escapeInvalid===!0,f="";if(s.value)return(n||c)&&Zse.isOpenOrClose(s)?"\\"+s.value:s.value;if(s.value)return s.value;if(s.nodes)for(let p of s.nodes)f+=r(p);return f};return r(t)}});var toe=_((iFt,eoe)=>{"use strict";eoe.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var uoe=_((sFt,coe)=>{"use strict";var roe=toe(),Gd=(t,e,r)=>{if(roe(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(roe(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let s={relaxZeros:!0,...r};typeof s.strictZeros=="boolean"&&(s.relaxZeros=s.strictZeros===!1);let a=String(s.relaxZeros),n=String(s.shorthand),c=String(s.capture),f=String(s.wrap),p=t+":"+e+"="+a+n+c+f;if(Gd.cache.hasOwnProperty(p))return Gd.cache[p].result;let h=Math.min(t,e),E=Math.max(t,e);if(Math.abs(h-E)===1){let R=t+"|"+e;return s.capture?`(${R})`:s.wrap===!1?R:`(?:${R})`}let C=loe(t)||loe(e),S={min:t,max:e,a:h,b:E},P=[],I=[];if(C&&(S.isPadded=C,S.maxLen=String(S.max).length),h<0){let R=E<0?Math.abs(E):1;I=noe(R,Math.abs(h),S,s),h=S.a=0}return E>=0&&(P=noe(h,E,S,s)),S.negatives=I,S.positives=P,S.result=pKe(I,P,s),s.capture===!0?S.result=`(${S.result})`:s.wrap!==!1&&P.length+I.length>1&&(S.result=`(?:${S.result})`),Gd.cache[p]=S,S.result};function pKe(t,e,r){let s=s4(t,e,"-",!1,r)||[],a=s4(e,t,"",!1,r)||[],n=s4(t,e,"-?",!0,r)||[];return s.concat(n).concat(a).join("|")}function hKe(t,e){let r=1,s=1,a=soe(t,r),n=new Set([e]);for(;t<=a&&a<=e;)n.add(a),r+=1,a=soe(t,r);for(a=ooe(e+1,s)-1;t<a&&a<=e;)n.add(a),s+=1,a=ooe(e+1,s)-1;return n=[...n],n.sort(mKe),n}function gKe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let s=dKe(t,e),a=s.length,n="",c=0;for(let f=0;f<a;f++){let[p,h]=s[f];p===h?n+=p:p!=="0"||h!=="9"?n+=yKe(p,h,r):c++}return c&&(n+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:n,count:[c],digits:a}}function noe(t,e,r,s){let a=hKe(t,e),n=[],c=t,f;for(let p=0;p<a.length;p++){let h=a[p],E=gKe(String(c),String(h),s),C="";if(!r.isPadded&&f&&f.pattern===E.pattern){f.count.length>1&&f.count.pop(),f.count.push(E.count[0]),f.string=f.pattern+aoe(f.count),c=h+1;continue}r.isPadded&&(C=EKe(h,r,s)),E.string=C+E.pattern+aoe(E.count),n.push(E),c=h+1,f=E}return n}function s4(t,e,r,s,a){let n=[];for(let c of t){let{string:f}=c;!s&&!ioe(e,"string",f)&&n.push(r+f),s&&ioe(e,"string",f)&&n.push(r+f)}return n}function dKe(t,e){let r=[];for(let s=0;s<t.length;s++)r.push([t[s],e[s]]);return r}function mKe(t,e){return t>e?1:e>t?-1:0}function ioe(t,e,r){return t.some(s=>s[e]===r)}function soe(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function ooe(t,e){return t-t%Math.pow(10,e)}function aoe(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function yKe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function loe(t){return/^-?(0+)\d/.test(t)}function EKe(t,e,r){if(!e.isPadded)return t;let s=Math.abs(e.maxLen-String(t).length),a=r.relaxZeros!==!1;switch(s){case 0:return"";case 1:return a?"0?":"0";case 2:return a?"0{0,2}":"00";default:return a?`0{0,${s}}`:`0{${s}}`}}Gd.cache={};Gd.clearCache=()=>Gd.cache={};coe.exports=Gd});var l4=_((oFt,yoe)=>{"use strict";var IKe=Ie("util"),poe=uoe(),foe=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),CKe=t=>e=>t===!0?Number(e):String(e),o4=t=>typeof t=="numb Line truncated
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Qoe=_((uFt,koe)=>{"use strict";var TKe=fk(),{MAX_LENGTH:boe,CHAR_BACKSLASH:c4,CHAR_BACKTICK:RKe,CHAR_COMMA:FKe,CHAR_DOT:NKe,CHAR_LEFT_PARENTHESES:OKe,CHAR_RIGHT_PARENTHESES:LKe,CHAR_LEFT_CURLY_BRACE:MKe,CHAR_RIGHT_CURLY_BRACE:UKe,CHAR_LEFT_SQUARE_BRACKET:Poe,CHAR_RIGHT_SQUARE_BRACKET:xoe,CHAR_DOUBLE_QUOTE:_Ke,CHAR_SINGLE_QUOTE:HKe,CHAR_NO_BREAK_SPACE:jKe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:GKe}=Doe(),qKe=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},s=typeof r.maxLength=="number"?Math.min(boe,r.maxLength):boe;if(t.length>s)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${s})`);let a={type:"root",input:t,nodes:[]},n=[a],c=a,f=a,p=0,h=t.length,E=0,C=0,S,P={},I=()=>t[E++],R=N=>{if(N.type==="text"&&f.type==="dot"&&(f.type="text"),f&&f.type==="text"&&N.type==="text"){f.value+=N.value;return}return c.nodes.push(N),N.parent=c,N.prev=f,f=N,N};for(R({type:"bos"});E<h;)if(c=n[n.length-1],S=I(),!(S===GKe||S===jKe)){if(S===c4){R({type:"text",value:(e.keepEscaping?S:"")+I()});continue}if(S===xoe){R({type:"text",value:"\\"+S});continue}if(S===Poe){p++;let N=!0,U;for(;E<h&&(U=I());){if(S+=U,U===Poe){p++;continue}if(U===c4){S+=I();continue}if(U===xoe&&(p--,p===0))break}R({type:"text",value:S});continue}if(S===OKe){c=R({type:"paren",nodes:[]}),n.push(c),R({type:"text",value:S});continue}if(S===LKe){if(c.type!=="paren"){R({type:"text",value:S});continue}c=n.pop(),R({type:"text",value:S}),c=n[n.length-1];continue}if(S===_Ke||S===HKe||S===RKe){let N=S,U;for(e.keepQuotes!==!0&&(S="");E<h&&(U=I());){if(U===c4){S+=U+I();continue}if(U===N){e.keepQuotes===!0&&(S+=U);break}S+=U}R({type:"text",value:S});continue}if(S===MKe){C++;let U={type:"brace",open:!0,close:!1,dollar:f.value&&f.value.slice(-1)==="$"||c.dollar===!0,depth:C,commas:0,ranges:0,nodes:[]};c=R(U),n.push(c),R({type:"open",value:S});continue}if(S===UKe){if(c.type!=="brace"){R({type:"text",value:S});continue}let N="close";c=n.pop(),c.close=!0,R({type:N,value:S}),C--,c=n[n.length-1];continue}if(S===FKe&&C>0){if(c.ranges>0){c.ranges=0;let N=c.nodes.shift();c.nodes=[N,{type:"text",value:TKe(c)}]}R({type:"comma",value:S}),c.commas++;continue}if(S===NKe&&C>0&&c.commas===0){let N=c.nodes;if(C===0||N.length===0){R({type:"text",value:S});continue}if(f.type==="dot"){if(c.range=[],f.value+=S,f.type="range",c.nodes.length!==3&&c.nodes.length!==5){c.invalid=!0,c.ranges=0,f.type="text";continue}c.ranges++,c.args=[];continue}if(f.type==="range"){N.pop();let U=N[N.length-1];U.value+=f.value+S,f=U,c.ranges--;continue}R({type:"dot",value:S});continue}R({type:"text",value:S})}do if(c=n.pop(),c.type!=="root"){c.nodes.forEach(W=>{W.nodes||(W.type==="open"&&(W.isOpen=!0),W.type==="close"&&(W.isClose=!0),W.nodes||(W.type="text"),W.invalid=!0)});let N=n[n.length-1],U=N.nodes.indexOf(c);N.nodes.splice(U,1,...c.nodes)}while(n.length>0);return R({type:"eos"}),a};koe.exports=qKe});var Foe=_((fFt,Roe)=>{"use strict";var Toe=fk(),WKe=Coe(),YKe=voe(),VKe=Qoe(),jl=(t,e={})=>{let r=[];if(Array.isArray(t))for(let s of t){let a=jl.create(s,e);Array.isArray(a)?r.push(...a):r.push(a)}else r=[].concat(jl.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};jl.parse=(t,e={})=>VKe(t,e);jl.stringify=(t,e={})=>Toe(typeof t=="string"?jl.parse(t,e):t,e);jl.compile=(t,e={})=>(typeof t=="string"&&(t=jl.parse(t,e)),WKe(t,e));jl.expand=(t,e={})=>{typeof t=="string"&&(t=jl.parse(t,e));let r=YKe(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};jl.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?jl.compile(t,e):jl.expand(t,e);Roe.exports=jl});var EB=_((AFt,Uoe)=>{"use strict";var JKe=Ie("path"),Vf="\\\\/",Noe=`[^${Vf}]`,Dp="\\.",KKe="\\+",zKe="\\?",pk="\\/",XKe="(?=.)",Ooe="[^/]",u4=`(?:${pk}|$)`,Loe=`(?:^|${pk})`,f4=`${Dp}{1,2}${u4}`,ZKe=`(?!${Dp})`,$Ke=`(?!${Loe}${f4})`,eze=`(?!${Dp}{0,1}${u4})`,tze=`(?!${f4})`,rze=`[^.${pk}]`,nze=`${Ooe}*?`,Moe={DOT_LITERAL:Dp,PLUS_LITERAL:KKe,QMARK_LITERAL:zKe,SLASH_LITERAL:pk,ONE_CHAR:XKe,QMARK:Ooe,END_ANCHOR:u4,DOTS_SLASH:f4,NO_DOT:ZKe,NO_DOTS:$Ke,NO_DOT_SLASH:eze,NO_DOTS_SLASH:tze,QMARK_NO_DOT:rze,STAR:nze,START_ANCHOR:Loe},ize={...Moe,SLASH_LITERAL:`[${Vf}]`,QMARK:Noe,STAR:`${Noe}*?`,DOTS_SLASH:`${Dp}{1,2}(?:[${Vf}]|$)`,NO_DOT:`(?!${Dp})`,NO_DOTS:`(?!(?:^|[${Vf}])${Dp}{1,2}(?:[${Vf}]|$))`,NO_DOT_SLASH:`(?!${Dp}{0,1}(?:[${Vf}]|$))`,NO_DOTS_SLASH:`(?!${Dp}{1,2}(?:[${Vf}]|$))`,QMARK_NO_DOT:`[^.${Vf}]`,START_ANCHOR:`(?:^|[${Vf}])`,END_ANCHOR:`(?:[${Vf}]|$)`},sze={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&' Line truncated
`),f!==-1){let p=a+c.substring(0,f);c=c.substring(f+1),a="",e!==null?this.reportInfo(null,`${e} ${p}`):this.reportInfo(null,p)}while(f!==-1);a+=c}),r.on("end",()=>{let n=s.end();n!==""&&(e!==null?this.reportInfo(null,`${e} ${n}`):this.reportInfo(null,n))}),r}}});var aI,R8=Xe(()=>{Tc();Wo();aI=class{constructor(e){this.fetchers=e}supports(e,r){return!!this.tryFetcher(e,r)}getLocalPath(e,r){return this.getFetcher(e,r).getLocalPath(e,r)}async fetch(e,r){return await this.getFetcher(e,r).fetch(e,r)}tryFetcher(e,r){let s=this.fetchers.find(a=>a.supports(e,r));return s||null}getFetcher(e,r){let s=this.fetchers.find(a=>a.supports(e,r));if(!s)throw new jt(11,`${Yr(r.project.configuration,e)} isn't supported by any available fetcher`);return s}}});var rm,F8=Xe(()=>{Wo();rm=class{constructor(e){this.resolvers=e.filter(r=>r)}supportsDescriptor(e,r){return!!this.tryResolverByDescriptor(e,r)}supportsLocator(e,r){return!!this.tryResolverByLocator(e,r)}shouldPersistResolution(e,r){return this.getResolverByLocator(e,r).shouldPersistResolution(e,r)}bindDescriptor(e,r,s){return this.getResolverByDescriptor(e,s).bindDescriptor(e,r,s)}getResolutionDependencies(e,r){return this.getResolverByDescriptor(e,r).getResolutionDependencies(e,r)}async getCandidates(e,r,s){return await this.getResolverByDescriptor(e,s).getCandidates(e,r,s)}async getSatisfying(e,r,s,a){return this.getResolverByDescriptor(e,a).getSatisfying(e,r,s,a)}async resolve(e,r){return await this.getResolverByLocator(e,r).resolve(e,r)}tryResolverByDescriptor(e,r){let s=this.resolvers.find(a=>a.supportsDescriptor(e,r));return s||null}getResolverByDescriptor(e,r){let s=this.resolvers.find(a=>a.supportsDescriptor(e,r));if(!s)throw new Error(`${ni(r.project.configuration,e)} isn't supported by any available resolver`);return s}tryResolverByLocator(e,r){let s=this.resolvers.find(a=>a.supportsLocator(e,r));return s||null}getResolverByLocator(e,r){let s=this.resolvers.find(a=>a.supportsLocator(e,r));if(!s)throw new Error(`${Yr(r.project.configuration,e)} isn't supported by any available resolver`);return s}}});var lI,N8=Xe(()=>{Dt();Wo();lI=class{supports(e){return!!e.reference.startsWith("virtual:")}getLocalPath(e,r){let s=e.reference.indexOf("#");if(s===-1)throw new Error("Invalid virtual package reference");let a=e.reference.slice(s+1),n=Ws(e,a);return r.fetcher.getLocalPath(n,r)}async fetch(e,r){let s=e.reference.indexOf("#");if(s===-1)throw new Error("Invalid virtual package reference");let a=e.reference.slice(s+1),n=Ws(e,a),c=await r.fetcher.fetch(n,r);return await this.ensureVirtualLink(e,c,r)}getLocatorFilename(e){return nI(e)}async ensureVirtualLink(e,r,s){let a=r.packageFs.getRealPath(),n=s.project.configuration.get("virtualFolder"),c=this.getLocatorFilename(e),f=uo.makeVirtualPath(n,c,a),p=new _f(f,{baseFs:r.packageFs,pathUtils:J});return{...r,packageFs:p}}}});var FQ,gue=Xe(()=>{FQ=class t{static{this.protocol="virtual:"}static isVirtualDescriptor(e){return!!e.range.startsWith(t.protocol)}static isVirtualLocator(e){return!!e.reference.startsWith(t.protocol)}supportsDescriptor(e,r){return t.isVirtualDescriptor(e)}supportsLocator(e,r){return t.isVirtualLocator(e)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,s){throw new Error('Assertion failed: calling "bindDescriptor" on a virtual descriptor is unsupported')}getResolutionDependencies(e,r){throw new Error('Assertion failed: calling "getResolutionDependencies" on a virtual descriptor is unsupported')}async getCandidates(e,r,s){throw new Error('Assertion failed: calling "getCandidates" on a virtual descriptor is unsupported')}async getSatisfying(e,r,s,a){throw new Error('Assertion failed: calling "getSatisfying" on a virtual descriptor is unsupported')}async resolve(e,r){throw new Error('Assertion failed: calling "resolve" on a virtual locator is unsupported')}}});var cI,O8=Xe(()=>{Dt();tm();cI=class{supports(e){return!!e.reference.startsWith(Ei.protocol)}getLocalPath(e,r){return this.getWorkspace(e,r).cwd}async fetch(e,r){let s=this.getWorkspace(e,r).cwd;return{packageFs:new Sn(s),prefixPath:vt.dot,localPath:s}}getWorkspace(e,r){return r.project.getWorkspaceByCwd(e.reference.slice(Ei.protocol.length))}}});function WB(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function due(t){return typeof t>"u"?3:WB(t)?0:Array.isArray(t)?1:2}function U8(t,e){return Object.hasOwn(t,e)}function het(t){return WB(t)&&U8(t,"onConflict")&&typeof t.onConflict=="string"}function get(t){if(typeof t>"u")return{onConflict:"default",value:t};if(!het(t))return{onConflict:"default",value:t};if(U8(t,"value"))return t;let{onConflict:e,...r}=t;return{onConflict:e,value:r}}function mue(t,e){let r=WB(t)&&U8(t,e)?t[e]:void 0;return get(r)}function uI(t,e){return[t,e,yue]}function _8(t){return Array.isArray(t)?t[2]===yue:!1}function L8(t,e){if(WB(t)){let r={};for(let s of Object.keys(t))r[s]=L8(t[s],e);return uI(e,r)}return Array.isArray(t)?uI(e,t.map(r=>L8(r,e))):uI(e,t)}function M8(t,e,r,s,a){let n,c=[],f=a,p=0;for(let E=a-Line truncated
Please report this to https://github.com/szmarczak/http2-wrapper/`);I(R)}return}s[0].resolve(P);return}}if(c in this.queue){if(f in this.queue[c]){this.queue[c][f].listeners.push(...s),this._tryToCreateNewSession(c,f);return}}else this.queue[c]={};let p=()=>{c in this.queue&&this.queue[c][f]===h&&(delete this.queue[c][f],Object.keys(this.queue[c]).length===0&&delete this.queue[c])},h=()=>{let E=`${f}:${c}`,C=!1;try{let S=Rtt.connect(e,{createConnection:this.createConnection,settings:this.settings,session:this.tlsSessionCache.get(E),...r});S[Pa]=0,S[gI]=!1;let P=()=>S[Pa]<S.remoteSettings.maxConcurrentStreams,I=!0;S.socket.once("session",N=>{this.tlsSessionCache.set(E,N)}),S.once("error",N=>{for(let{reject:U}of s)U(N);this.tlsSessionCache.delete(E)}),S.setTimeout(this.timeout,()=>{S.destroy()}),S.once("close",()=>{if(C){I&&this._freeSessionsCount--,this._sessionsCount--;let N=this.sessions[c];N.splice(N.indexOf(S),1),N.length===0&&delete this.sessions[c]}else{let N=new Error("Session closed without receiving a SETTINGS frame");N.code="HTTP2WRAPPER_NOSETTINGS";for(let{reject:U}of s)U(N);p()}this._tryToCreateNewSession(c,f)});let R=()=>{if(!(!(c in this.queue)||!P())){for(let N of S[Rc])if(N in this.queue[c]){let{listeners:U}=this.queue[c][N];for(;U.length!==0&&P();)U.shift().resolve(S);let W=this.queue[c];if(W[N].listeners.length===0&&(delete W[N],Object.keys(W).length===0)){delete this.queue[c];break}if(!P())break}}};S.on("origin",()=>{S[Rc]=S.originSet,P()&&(R(),IH(this.sessions[c],S))}),S.once("remoteSettings",()=>{if(S.ref(),S.unref(),this._sessionsCount++,h.destroyed){let N=new Error("Agent has been destroyed");for(let U of s)U.reject(N);S.destroy();return}S[Rc]=S.originSet;{let N=this.sessions;if(c in N){let U=N[c];U.splice(Ott(U,S,Ltt),0,S)}else N[c]=[S]}this._freeSessionsCount+=1,C=!0,this.emit("session",S),R(),p(),S[Pa]===0&&this._freeSessionsCount>this.maxFreeSessions&&S.close(),s.length!==0&&(this.getSession(f,r,s),s.length=0),S.on("remoteSettings",()=>{R(),IH(this.sessions[c],S)})}),S[Sfe]=S.request,S.request=(N,U)=>{if(S[gI])throw new Error("The session is gracefully closing. No new streams are allowed.");let W=S[Sfe](N,U);return S.ref(),++S[Pa],S[Pa]===S.remoteSettings.maxConcurrentStreams&&this._freeSessionsCount--,W.once("close",()=>{if(I=P(),--S[Pa],!S.destroyed&&!S.closed&&(Mtt(this.sessions[c],S),P()&&!S.closed)){I||(this._freeSessionsCount++,I=!0);let ee=S[Pa]===0;ee&&S.unref(),ee&&(this._freeSessionsCount>this.maxFreeSessions||S[gI])?S.close():(IH(this.sessions[c],S),R())}}),W}}catch(S){for(let P of s)P.reject(S);p()}};h.listeners=s,h.completed=!1,h.destroyed=!1,this.queue[c][f]=h,this._tryToCreateNewSession(c,f)})}request(e,r,s,a){return new Promise((n,c)=>{this.getSession(e,r,[{reject:c,resolve:f=>{try{n(f.request(s,a))}catch(p){c(p)}}}])})}createConnection(e,r){return t.connect(e,r)}static connect(e,r){r.ALPNProtocols=["h2"];let s=e.port||443,a=e.hostname||e.host;return typeof r.servername>"u"&&(r.servername=a),Ttt.connect(s,a,r)}closeFreeSessions(){for(let e of Object.values(this.sessions))for(let r of e)r[Pa]===0&&r.close()}destroy(e){for(let r of Object.values(this.sessions))for(let s of r)s.destroy(e);for(let r of Object.values(this.queue))for(let s of Object.values(r))s.destroyed=!0;this.queue={}}get freeSessions(){return Dfe({agent:this,isFree:!0})}get busySessions(){return Dfe({agent:this,isFree:!1})}};im.kCurrentStreamsCount=Pa;im.kGracefullyClosing=gI;Pfe.exports={Agent:im,globalAgent:new im}});var BH=_((YMt,xfe)=>{"use strict";var{Readable:Utt}=Ie("stream"),wH=class extends Utt{constructor(e,r){super({highWaterMark:r,autoDestroy:!1}),this.statusCode=null,this.statusMessage="",this.httpVersion="2.0",this.httpVersionMajor=2,this.httpVersionMinor=0,this.headers={},this.trailers={},this.req=null,this.aborted=!1,this.complete=!1,this.upgrade=null,this.rawHeaders=[],this.rawTrailers=[],this.socket=e,this.connection=e,this._dumped=!1}_destroy(e){this.req._request.destroy(e)}setTimeout(e,r){return this.req.setTimeout(e,r),this}_dump(){this._dumped||(this._dumped=!0,this.removeAllListeners("data"),this.resume())}_read(){this.req&&this.req._request.resume()}};xfe.exports=wH});var vH=_((VMt,kfe)=>{"use strict";kfe.exports=t=>{let e={protocol:t.protocol,hostname:typeof t.hostname=="string"&&t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,host:t.host,hash:t.hash,search:t.search,pathname:t.pathname,href:t.href,path:`${t.pathname||""}${t.search||""}`};return typeof t.port=="string"&&t.port.length!==0&&(e.port=Number(t.port)),(t.username||t.password)&&(e.auth=`${t.username||""}:${t.password||""}`),e}});var Tfe=_((JMt,Qfe)=>{"use strict";Qfe.exports=(t,e,r)=>{for(let s of r)t.on(s,(...a)=>e.emit(s,...a))}});var Ffe=_((KMt,Rfe)=>{"use strict";Rfe.exports=t=>{switch(t){case":method":case":scheme":case":authority":case":path":return!0;default:return!1}}});var Ofe=_((XMt,Nfe)=>{"use strict";var dI=(t,e,r)=>{Nfe.exports[e]=class extends t{constructor(...a){super(typeof r=="string"?r: Line truncated
`).reverse(),f=r.stack.slice(r.stack.indexOf(r.message)+r.message.length).split(`
`).reverse();for(;f.length!==0&&f[0]===c[0];)c.shift();this.stack=`${this.stack.slice(0,n)}${c.reverse().join(`
`)}${f.reverse().join(`
`)}`}}};Ln.RequestError=fs;var tT=class extends fs{constructor(e){super(`Redirected ${e.options.maxRedirects} times. Aborting.`,{},e),this.name="MaxRedirectsError"}};Ln.MaxRedirectsError=tT;var rT=class extends fs{constructor(e){super(`Response code ${e.statusCode} (${e.statusMessage})`,{},e.request),this.name="HTTPError"}};Ln.HTTPError=rT;var nT=class extends fs{constructor(e,r){super(e.message,e,r),this.name="CacheError"}};Ln.CacheError=nT;var iT=class extends fs{constructor(e,r){super(e.message,e,r),this.name="UploadError"}};Ln.UploadError=iT;var sT=class extends fs{constructor(e,r,s){super(e.message,e,s),this.name="TimeoutError",this.event=e.event,this.timings=r}};Ln.TimeoutError=sT;var tv=class extends fs{constructor(e,r){super(e.message,e,r),this.name="ReadError"}};Ln.ReadError=tv;var oT=class extends fs{constructor(e){super(`Unsupported protocol "${e.url.protocol}"`,{},e),this.name="UnsupportedProtocolError"}};Ln.UnsupportedProtocolError=oT;var Yrt=["socket","connect","continue","information","upgrade","timeout"],aT=class extends yAe.Duplex{constructor(e,r={},s){super({autoDestroy:!1,highWaterMark:0}),this[yI]=0,this[II]=0,this.requestInitialized=!1,this[ZQ]=new Set,this.redirects=[],this[CI]=!1,this[$Q]=!1,this[ev]=[],this.retryCount=0,this._progressCallbacks=[];let a=()=>this._unlockWrite(),n=()=>this._lockWrite();this.on("pipe",h=>{h.prependListener("data",a),h.on("data",n),h.prependListener("end",a),h.on("end",n)}),this.on("unpipe",h=>{h.off("data",a),h.off("data",n),h.off("end",a),h.off("end",n)}),this.on("pipe",h=>{h instanceof JH.IncomingMessage&&(this.options.headers={...h.headers,...this.options.headers})});let{json:c,body:f,form:p}=r;if((c||f||p)&&this._lockWrite(),Ln.kIsNormalizedAlready in r)this.options=r;else try{this.options=this.constructor.normalizeArguments(e,r,s)}catch(h){at.default.nodeStream(r.body)&&r.body.destroy(),this.destroy(h);return}(async()=>{var h;try{this.options.body instanceof Srt.ReadStream&&await Grt(this.options.body);let{url:E}=this.options;if(!E)throw new TypeError("Missing `url` property");if(this.requestUrl=E.toString(),decodeURI(this.requestUrl),await this._finalizeBody(),await this._makeRequest(),this.destroyed){(h=this[po])===null||h===void 0||h.destroy();return}for(let C of this[ev])C();this[ev].length=0,this.requestInitialized=!0}catch(E){if(E instanceof fs){this._beforeError(E);return}this.destroyed||this.destroy(E)}})()}static normalizeArguments(e,r,s){var a,n,c,f,p;let h=r;if(at.default.object(e)&&!at.default.urlInstance(e))r={...s,...e,...r};else{if(e&&r&&r.url!==void 0)throw new TypeError("The `url` option is mutually exclusive with the `input` argument");r={...s,...r},e!==void 0&&(r.url=e),at.default.urlInstance(r.url)&&(r.url=new w0.URL(r.url.toString()))}if(r.cache===!1&&(r.cache=void 0),r.dnsCache===!1&&(r.dnsCache=void 0),at.assert.any([at.default.string,at.default.undefined],r.method),at.assert.any([at.default.object,at.default.undefined],r.headers),at.assert.any([at.default.string,at.default.urlInstance,at.default.undefined],r.prefixUrl),at.assert.any([at.default.object,at.default.undefined],r.cookieJar),at.assert.any([at.default.object,at.default.string,at.default.undefined],r.searchParams),at.assert.any([at.default.object,at.default.string,at.default.undefined],r.cache),at.assert.any([at.default.object,at.default.number,at.default.undefined],r.timeout),at.assert.any([at.default.object,at.default.undefined],r.context),at.assert.any([at.default.object,at.default.undefined],r.hooks),at.assert.any([at.default.boolean,at.default.undefined],r.decompress),at.assert.any([at.default.boolean,at.default.undefined],r.ignoreInvalidCookies),at.assert.any([at.default.boolean,at.default.undefined],r.followRedirect),at.assert.any([at.default.number,at.default.undefined],r.maxRedirects),at.assert.any([at.default.boolean,at.default.undefined],r.throwHttpErrors),at.assert.any([at.default.boolean,at.default.undefined],r.http2),at.assert.any([at.default.boolean,at.default.undefined],r.allowGetBody),at.assert.any([at.default.string,at.default.undefined],r.localAddress),at.assert.any([vAe.isDnsLookupIpVersion,at.default.undefined],r.dnsLookupIpVersion),at.assert.any([at.default.object,at.default.undefined],r.https),at.assert.any([at.default.boolean,at.default.undefined],r.rejectUnauthorized),r.https&&(at.assert.any([at.default.boolean,at.default.undefined],r.https.rejectUnauthorized),at.assert.any([at.default.function_,at.default.undefined],r.https.checkServerIdentity),at.assert.any([at.default.string,at.default.object,at.default.array,at.default.undefined],r.https.certificateAuthority),at.assert.any([at.default.string,at.default.object,at.default.array,at.default.undefined],r.https.key),at.assert.any([at.default.string,at.default.object,at.default.array,at.default.undefined],r.https.certificate),at.assert.any([at.default.string,at.default.undefined],r.https.passphrase),at.assert.any([at.default.string,at.default.buffer,at.default.array,at.default.undefined],r.httpLine truncated
`)[3];return Qnt(e)}function fj(){return typeof hT.default.availableParallelism<"u"?hT.default.availableParallelism():Math.max(1,hT.default.cpus().length)}var hT,vnt,rpe,Snt,Dnt,npe,ipe,xnt,knt,gT=Xe(()=>{Dt();hT=ut(Ie("os"));dT();Pc();vnt=Number(process.versions.node.split(".")[0]),rpe=new Map([["darwin","open"],["linux","xdg-open"],["win32","explorer.exe"]]).get(process.platform),Snt=typeof rpe<"u"?async t=>{try{return await Aj(rpe,[t],{cwd:J.cwd()}),!0}catch{return!1}}:void 0,Dnt="/usr/bin/ldd";xnt=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,knt=/\((\S*)(?::(\d+))(?::(\d+))\)/});function yj(t,e,r,s,a){let n=YB(r);if(s.isArray||s.type==="ANY"&&Array.isArray(n))return Array.isArray(n)?n.map((c,f)=>pj(t,`${e}[${f}]`,c,s,a)):String(n).split(/,/).map(c=>pj(t,e,c,s,a));if(Array.isArray(n))throw new Error(`Non-array configuration settings "${e}" cannot be an array`);return pj(t,e,r,s,a)}function pj(t,e,r,s,a){let n=YB(r);switch(s.type){case"ANY":return NQ(n);case"SHAPE":return Ont(t,e,r,s,a);case"MAP":return Lnt(t,e,r,s,a)}if(n===null&&!s.isNullable&&s.default!==null)throw new Error(`Non-nullable configuration settings "${e}" cannot be set to null`);if("values"in s&&s.values?.includes(n))return n;let f=(()=>{if(s.type==="BOOLEAN"&&typeof n!="string")return kB(n);if(typeof n!="string")throw new Error(`Expected configuration setting "${e}" to be a string, got ${typeof n}`);let p=Vk(n,{env:t.env});switch(s.type){case"ABSOLUTE_PATH":{let h=a,E=H8(r);return E&&E[0]!=="<"&&(h=J.dirname(E)),J.resolve(h,fe.toPortablePath(p))}case"LOCATOR_LOOSE":return Qp(p,!1);case"NUMBER":return parseInt(p);case"LOCATOR":return Qp(p);case"BOOLEAN":return kB(p);case"DURATION":return Jk(p,s.unit);default:return p}})();if("values"in s&&s.values&&!s.values.includes(f))throw new Error(`Invalid value, expected one of ${s.values.join(", ")}`);return f}function Ont(t,e,r,s,a){let n=YB(r);if(typeof n!="object"||Array.isArray(n))throw new nt(`Object configuration settings "${e}" must be an object`);let c=Ej(t,s,{ignoreArrays:!0});if(n===null)return c;for(let[f,p]of Object.entries(n)){let h=`${e}.${f}`;if(!s.properties[f])throw new nt(`Unrecognized configuration settings found: ${e}.${f} - run "yarn config" to see the list of settings supported in Yarn`);c.set(f,yj(t,h,p,s.properties[f],a))}return c}function Lnt(t,e,r,s,a){let n=YB(r),c=new Map;if(typeof n!="object"||Array.isArray(n))throw new nt(`Map configuration settings "${e}" must be an object`);if(n===null)return c;for(let[f,p]of Object.entries(n)){let h=s.normalizeKeys?s.normalizeKeys(f):f,E=`${e}['${h}']`,C=s.valueDefinition;c.set(h,yj(t,E,p,C,a))}return c}function Ej(t,e,{ignoreArrays:r=!1}={}){switch(e.type){case"SHAPE":{if(e.isArray&&!r)return[];let s=new Map;for(let[a,n]of Object.entries(e.properties))s.set(a,Ej(t,n));return s}case"MAP":return e.isArray&&!r?[]:new Map;case"ABSOLUTE_PATH":return e.default===null?null:t.projectCwd===null?Array.isArray(e.default)?e.default.map(s=>J.normalize(s)):J.isAbsolute(e.default)?J.normalize(e.default):e.isNullable?null:void 0:Array.isArray(e.default)?e.default.map(s=>J.resolve(t.projectCwd,s)):J.resolve(t.projectCwd,e.default);case"DURATION":return Jk(e.default,e.unit);default:return e.default}}function yT(t,e,r){if(e.type==="SECRET"&&typeof t=="string"&&r.hideSecrets)return Nnt;if(e.type==="ABSOLUTE_PATH"&&typeof t=="string"&&r.getNativePaths)return fe.fromPortablePath(t);if(e.isArray&&Array.isArray(t)){let s=[];for(let a of t)s.push(yT(a,e,r));return s}if(e.type==="MAP"&&t instanceof Map){if(t.size===0)return;let s=new Map;for(let[a,n]of t.entries()){let c=yT(n,e.valueDefinition,r);typeof c<"u"&&s.set(a,c)}return s}if(e.type==="SHAPE"&&t instanceof Map){if(t.size===0)return;let s=new Map;for(let[a,n]of t.entries()){let c=e.properties[a],f=yT(n,c,r);typeof f<"u"&&s.set(a,f)}return s}return t}function Mnt(){let t={};for(let[e,r]of Object.entries(process.env))e=e.toLowerCase(),e.startsWith(ET)&&(e=(0,ope.default)(e.slice(ET.length)),t[e]=r);return t}function gj(){let t=`${ET}rc_filename`;for(let[e,r]of Object.entries(process.env))if(e.toLowerCase()===t&&typeof r=="string")return r;return dj}async function spe(t){try{return await ce.readFilePromise(t)}catch{return Buffer.of()}}async function Unt(t,e){return Buffer.compare(...await Promise.all([spe(t),spe(e)]))===0}async function _nt(t,e){let[r,s]=await Promise.all([ce.statPromise(t),ce.statPromise(e)]);return r.dev===s.dev&&r.ino===s.ino}async function jnt({configuration:t,selfPath:e}){let r=t.get("yarnPath");return t.get("ignorePath")||r===null||r===e||await Hnt(r,e)?null:r}var ope,Lp,ape,lpe,cpe,hj,Rnt,ov,Fnt,Mp,ET,dj,Nnt,wI,upe,mj,IT,mT,Hnt,ze,av=Xe(()=>{Dt();wc();ope=ut(Sre()),Lp=ut(Fd());Yt();ape=ut(yne()),lpe=Ie("module"),cpe=ut(Ld()),hj=Ie("stream");nue();oI();R8();F8();N8();gue();O8();tm();Iue();LQ();xc();I0();pT();Pc();gT();Rp();Wo();Rnt=function(){if(!Lp.GITHUB_ACTIONS||!process.env.GITHUB_EVE Line truncated
`);return{stdout:n,stderr:c}}makeResolver(){let e=[];for(let r of this.plugins.values())for(let s of r.resolvers||[])e.push(new s);return new rm([new FQ,new Ei,...e])}makeFetcher(){let e=[];for(let r of this.plugins.values())for(let s of r.fetchers||[])e.push(new s);return new aI([new lI,new cI,...e])}getLinkers(){let e=[];for(let r of this.plugins.values())for(let s of r.linkers||[])e.push(new s);return e}getSupportedArchitectures(){let e=sv(),r=this.get("supportedArchitectures"),s=r.get("os");s!==null&&(s=s.map(c=>c==="current"?e.os:c));let a=r.get("cpu");a!==null&&(a=a.map(c=>c==="current"?e.cpu:c));let n=r.get("libc");return n!==null&&(n=Wl(n,c=>c==="current"?e.libc??Wl.skip:c)),{os:s,cpu:a,libc:n}}isInteractive({interactive:e,stdout:r}){return r.isTTY?e??this.get("preferInteractive"):!1}async getPackageExtensions(){if(this.packageExtensions!==null)return this.packageExtensions;this.packageExtensions=new Map;let e=this.packageExtensions,r=(s,a,{userProvided:n=!1}={})=>{if(!cl(s.range))throw new Error("Only semver ranges are allowed as keys for the packageExtensions setting");let c=new Ut;c.load(a,{yamlCompatibilityMode:!0});let f=xB(e,s.identHash),p=[];f.push([s.range,p]);let h={status:"inactive",userProvided:n,parentDescriptor:s};for(let E of c.dependencies.values())p.push({...h,type:"Dependency",descriptor:E});for(let E of c.peerDependencies.values())p.push({...h,type:"PeerDependency",descriptor:E});for(let[E,C]of c.peerDependenciesMeta)for(let[S,P]of Object.entries(C))p.push({...h,type:"PeerDependencyMeta",selector:E,key:S,value:P})};await this.triggerHook(s=>s.registerPackageExtensions,this,r);for(let[s,a]of this.get("packageExtensions"))r(C0(s,!0),Yk(a),{userProvided:!0});return e}normalizeLocator(e){return cl(e.reference)?Ws(e,`${this.get("defaultProtocol")}${e.reference}`):Mp.test(e.reference)?Ws(e,`${this.get("defaultProtocol")}${e.reference}`):e}normalizeDependency(e){return cl(e.range)?On(e,`${this.get("defaultProtocol")}${e.range}`):Mp.test(e.range)?On(e,`${this.get("defaultProtocol")}${e.range}`):e}normalizeDependencyMap(e){return new Map([...e].map(([r,s])=>[r,this.normalizeDependency(s)]))}normalizePackage(e,{packageExtensions:r}){let s=LB(e),a=r.get(e.identHash);if(typeof a<"u"){let c=e.version;if(c!==null){for(let[f,p]of a)if(Zf(c,f))for(let h of p)switch(h.status==="inactive"&&(h.status="redundant"),h.type){case"Dependency":typeof s.dependencies.get(h.descriptor.identHash)>"u"&&(h.status="active",s.dependencies.set(h.descriptor.identHash,this.normalizeDependency(h.descriptor)));break;case"PeerDependency":typeof s.peerDependencies.get(h.descriptor.identHash)>"u"&&(h.status="active",s.peerDependencies.set(h.descriptor.identHash,h.descriptor));break;case"PeerDependencyMeta":{let E=s.peerDependenciesMeta.get(h.selector);(typeof E>"u"||!Object.hasOwn(E,h.key)||E[h.key]!==h.value)&&(h.status="active",Yl(s.peerDependenciesMeta,h.selector,()=>({}))[h.key]=h.value)}break;default:G4(h)}}}let n=c=>c.scope?`${c.scope}__${c.name}`:`${c.name}`;for(let c of s.peerDependenciesMeta.keys()){let f=Sa(c);s.peerDependencies.has(f.identHash)||s.peerDependencies.set(f.identHash,On(f,"*"))}for(let c of s.peerDependencies.values()){if(c.scope==="types")continue;let f=n(c),p=Da("types",f),h=un(p);s.peerDependencies.has(p.identHash)||s.peerDependenciesMeta.has(h)||s.dependencies.has(p.identHash)||(s.peerDependencies.set(p.identHash,On(p,"*")),s.peerDependenciesMeta.set(h,{optional:!0}))}return s.dependencies=new Map(qs(s.dependencies,([,c])=>al(c))),s.peerDependencies=new Map(qs(s.peerDependencies,([,c])=>al(c))),s}getLimit(e){return Yl(this.limits,e,()=>(0,cpe.default)(this.get(e)))}async triggerHook(e,...r){for(let s of this.plugins.values()){let a=s.hooks;if(!a)continue;let n=e(a);n&&await n(...r)}}async triggerMultipleHooks(e,r){for(let s of r)await this.triggerHook(e,...s)}async reduceHook(e,r,...s){let a=r;for(let n of this.plugins.values()){let c=n.hooks;if(!c)continue;let f=e(c);f&&(a=await f(a,...s))}return a}async firstHook(e,...r){for(let s of this.plugins.values()){let a=s.hooks;if(!a)continue;let n=e(a);if(!n)continue;let c=await n(...r);if(typeof c<"u")return c}return null}}});var qr={};Vt(qr,{EndStrategy:()=>Bj,ExecError:()=>CT,PipeError:()=>lv,execvp:()=>Aj,pipevp:()=>Wu});function om(t){return t!==null&&typeof t.fd=="number"}function Ij(){}function Cj(){for(let t of am)t.kill()}async function Wu(t,e,{cwd:r,env:s=process.env,strict:a=!1,stdin:n=null,stdout:c,stderr:f,end:p=2}){let h=["pipe","pipe","pipe"];n===null?h[0]="ignore":om(n)&&(h[0]=n),om(c)&&(h[1]=c),om(f)&&(h[2]=f);let E=(0,wj.default)(t,e,{cwd:fe.fromPortablePath(r),env:{...s,PWD:fe.fromPortablePath(r)},stdio:h});am.add(E),am.size===1&&(process.on("SIGINT",Ij),process.on("SIGTERM",Cj)),!om(n)&&n!==null&&n.pipe(E.stdin),om(c)||E.stdout.pipe(c,{end:!1}),om(f)||E.stderr.pipe(f,{end:!1});let C=()=>{for(let S of new Set([c,f]))om(S)||S.end()};return new Promise((S,P)=>{E.on("error",I=>{am.delete(E),am.size===0&&(process.off("SIGINT",Ij),pro Line truncated
This command will run a command using Yarn's portable shell.
Make sure to escape glob patterns, redirections, and other features that might be expanded by your own shell.
Note: To escape something from Yarn's shell, you might have to escape it twice, the first time from your own shell.
Note: Don't use this command in Yarn scripts, as Yarn's shell is automatically used.
For a list of features, visit: https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-shell/README.md.
`,examples:[["Run a simple command","$0 echo Hello"],["Run a command with a glob pattern","$0 echo '*.js'"],["Run a command with a redirection","$0 echo Hello World '>' hello.txt"],["Run a command with an escaped glob pattern (The double escape is needed in Unix shells)",`$0 echo '"*.js"'`],["Run a command with a variable (Double quotes are needed in Unix shells, to prevent them from expanding the variable)",'$0 "GREETING=Hello echo $GREETING World"']]}}async execute(){let r=this.args.length>0?`${this.commandName} ${this.args.join(" ")}`:this.commandName;return await vI(r,[],{cwd:fe.toPortablePath(this.cwd),stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})}}});var Vl,bpe=Xe(()=>{Vl=class extends Error{constructor(e){super(e),this.name="ShellError"}}});var PT={};Vt(PT,{fastGlobOptions:()=>kpe,isBraceExpansion:()=>Lj,isGlobPattern:()=>Knt,match:()=>znt,micromatchOptions:()=>bT});function Knt(t){if(!DT.default.scan(t,bT).isGlob)return!1;try{DT.default.parse(t,bT)}catch{return!1}return!0}function znt(t,{cwd:e,baseFs:r}){return(0,Ppe.default)(t,{...kpe,cwd:fe.fromPortablePath(e),fs:ax(xpe.default,new t0(r))})}function Lj(t){return DT.default.scan(t,bT).isBrace}var Ppe,xpe,DT,bT,kpe,Qpe=Xe(()=>{Dt();Ppe=ut(BQ()),xpe=ut(Ie("fs")),DT=ut(Go()),bT={strictBrackets:!0},kpe={onlyDirectories:!1,onlyFiles:!1}});function Mj(){}function Uj(){for(let t of cm)t.kill()}function Npe(t,e,r,s){return a=>{let n=a[0]instanceof tA.Transform?"pipe":a[0],c=a[1]instanceof tA.Transform?"pipe":a[1],f=a[2]instanceof tA.Transform?"pipe":a[2],p=(0,Rpe.default)(t,e,{...s,stdio:[n,c,f]});return cm.add(p),cm.size===1&&(process.on("SIGINT",Mj),process.on("SIGTERM",Uj)),a[0]instanceof tA.Transform&&a[0].pipe(p.stdin),a[1]instanceof tA.Transform&&p.stdout.pipe(a[1],{end:!1}),a[2]instanceof tA.Transform&&p.stderr.pipe(a[2],{end:!1}),{stdin:p.stdin,promise:new Promise(h=>{p.on("error",E=>{switch(cm.delete(p),cm.size===0&&(process.off("SIGINT",Mj),process.off("SIGTERM",Uj)),E.code){case"ENOENT":a[2].write(`command not found: ${t}
`),h(127);break;case"EACCES":a[2].write(`permission denied: ${t}
`),h(128);break;default:a[2].write(`uncaught error: ${E.message}
`),h(1);break}}),p.on("close",E=>{cm.delete(p),cm.size===0&&(process.off("SIGINT",Mj),process.off("SIGTERM",Uj)),h(E!==null?E:129)})})}}}function Ope(t){return e=>{let r=e[0]==="pipe"?new tA.PassThrough:e[0];return{stdin:r,promise:Promise.resolve().then(()=>t({stdin:r,stdout:e[1],stderr:e[2]}))}}}function xT(t,e){return Hj.start(t,e)}function Tpe(t,e=null){let r=new tA.PassThrough,s=new Fpe.StringDecoder,a="";return r.on("data",n=>{let c=s.write(n),f;do if(f=c.indexOf(`
`),f!==-1){let p=a+c.substring(0,f);c=c.substring(f+1),a="",t(e!==null?`${e} ${p}`:p)}while(f!==-1);a+=c}),r.on("end",()=>{let n=s.end();n!==""&&t(e!==null?`${e} ${n}`:n)}),r}function Lpe(t,{prefix:e}){return{stdout:Tpe(r=>t.stdout.write(`${r}
`),t.stdout.isTTY?e:null),stderr:Tpe(r=>t.stderr.write(`${r}
`),t.stderr.isTTY?e:null)}}var Rpe,tA,Fpe,cm,Oc,_j,Hj,jj=Xe(()=>{Rpe=ut(_U()),tA=Ie("stream"),Fpe=Ie("string_decoder"),cm=new Set;Oc=class{constructor(e){this.stream=e}close(){}get(){return this.stream}},_j=class{constructor(){this.stream=null}close(){if(this.stream===null)throw new Error("Assertion failed: No stream attached");this.stream.end()}attach(e){this.stream=e}get(){if(this.stream===null)throw new Error("Assertion failed: No stream attached");return this.stream}},Hj=class t{constructor(e,r){this.stdin=null;this.stdout=null;this.stderr=null;this.pipe=null;this.ancestor=e,this.implementation=r}static start(e,{stdin:r,stdout:s,stderr:a}){let n=new t(null,e);return n.stdin=r,n.stdout=s,n.stderr=a,n}pipeTo(e,r=1){let s=new t(this,e),a=new _j;return s.pipe=a,s.stdout=this.stdout,s.stderr=this.stderr,(r&1)===1?this.stdout=a:this.ancestor!==null&&(this.stderr=this.ancestor.stdout),(r&2)===2?this.stderr=a:this.ancestor!==null&&(this.stderr=this.ancestor.stderr),s}async exec(){let e=["ignore","ignore","ignore"];if(this.pipe)e[0]="pipe";else{if(this.stdin===null)throw new Error("Assertion failed: No input stream registered");e[0]=this.stdin.get()}let r;if(this.stdout===null)throw new Error("Assertion failed: No output stream registered");r=this.stdout,e[1]=r.get();let s;if(this.stderr===null)throw new Error("Assertion failed: No error stream registered");s=this.stderr,e[2]=s.get();let a=this.implementation(e);return this.pipe&&this.pipe.attach(a.stdin),await a.promise.then(n=>(r.close(),s.close(),n))}async run(){let e=[];for(let s=this;s;s=s.ancestor)e.push(s.exec());return(await Promise.all(e))[0]}}});var mv={};Vt(mv,{EntryCommand:()=>Av,ShellError:()=>Vl,execute:()=>vI,globUtils:()=>PT});function Mpe(t,e,r){let s=new Jl.PassThrough({autoDestroy:!0});switch(t){case 0:(e&1)===1&&r.stdin.pipe(s,{end:!1}),(e&2)===2&&r.stdin instanceof Jl.Writable&&s.pipe(r.stdin,{end:!1});break;case 1:(e&1)===1&&r.stdout.pipe(s,{end:!1}),(e&2)===2&&s.pipe(r.stdout,{end:!1});break;case 2:(e&1)===1&&r.stderr.pipe(s,{end:!1}),(e&2)===2&&s.pipe(r.stderr,{end:!1});break;default:throw new Vl(`Bad file descriptor: "${t}"`)}return s}function QT(t,e={}){let r={...t,...e};return r.environment={...t.environment,...e.environment},r.variables={...t.variables,...e.variables},r}async function Znt(t,e,r){let s=[],a=new Jl.PassThrough;return a.on("data",n=>s.push(n)),await TT(t,e,QT(r,{stdout:a})),Buffer.concat(s).toString().replace(/[\r\n]+$/,"")}async function Upe(t,e,r){let s=t.map(async n=>{let c=await um(n.args,e,r);return{name:n.name,value:c.join(" ")}});return(await Promise.all(s)).reduce((n,c)=>(n[c.name]=c.value,n),{})}function kT(t){return t.match(/[^ \r\n\t]+/g)||[]}async function Wpe(t,e,r,s,a=s){switch(t.name){case"$":s(String(process.pid));break;case"#":s(String(e.args.length));break;case"@":if(t.quoted)for(let n of e.args)a(n);else for(let n of e.args){let c=kT(n);for(let f=0;f<c.length-1;++f)a(c[f]);s(c[c.length-1])}break;case"*":{let n=e.args.join(" ");if(t.quoted)s(n);else for(let c of kT(n))a(c)}break;case"PPID":s(String(process.ppid));break;case"RANDOM":s(String(Math.floor(Math.random()*32768)));break;default:{let n=parseInt(t.name,10),c,f=Number.isFinite(n);if(f?n>=0&&n<e.args.length&&(c=e.args[n]):Object.hasOwn(r.variables,t.name)?c=r.variables[t.name]:Object.hasOwn(r.environment,t.name)&&(c=r.environment[t.name]),typeof c<"u"&&t.alternativeValue?c=(await um(t.alternativeValue,e,r)).join(" "):typeof c>"u"&&(t.defaultValue?c=(await um(t.defaultValue,e,r)).join(" "):t.alternativeValue&&(c="")),typeof c>"u")throw f?new Vl(`Unbound argument #${n}`):new Vl(`Unbound variable "${t.name}"`);if(t.quoted)s(c);else{let p=kT(c);for(let E=0;E<p.length-1;++E)a(p[E]);let h=p[p.length-1];typeof h<"u"&&s(h)}}break}}async function hv(t,e,r){if(t.type==="number"){if(Number.isInteger(t.value))return t.value;throw new Error(`Invalid number: "${t.value}", only integers are allowed`)}else if(t.type==="variable"){let s=[];await Wpe({...t,quoted:!0},e,r,n=>s.push(n));let a=Number(s.join(" "));return Number.isNaN(a)?hv({type:"variable",name:s.join(" ")},e,r):hv({type:"number",value:a},e,r)}else return $nt[t.type](await hv(t.left,e,r),await hv(t.right,e,r))}async function um(t,e,r){let s=new Map,a=[],n=[],c=E=>{n.push(E)},f=()=>{n.length>0&&a.push(n.join("")),n=[]},p=E=>{c(E),f()},h=(E,C,S)=>{let P=JSON.stringify({type:E,fd:C}),I=s.get(P);typeof I>"u"&&s.set(P,I=[]),I.push(S)};for(let E of t){let C=!1;switch(E.type){case"redirection":{let S=await um(E.args,e,r);for(let P of S)h(E.subtype,E.fd,P)}break;case"argument":for(let S of E.segments)switch(S.type){case"text":c(S.text);break;case"glob":c(S.pattern),C=!0;break;case"shell":{let P=await Znt(S.shell,e,r);if(S.quoted)c(P);else{let I=kT(P);for(let R=0;R<I.length-1;++R)p(I[R]);c(I[I.length-1])}}break;case"variable":await Wpe(S,e,r,c,p);break;case"arithmetic":c(String(await hv(S.arithmetic,e,r)));break}break}if(f(),C){let S=a.pop();if(typeof S>"u")throw new Error("Assertion failed: Expected a glob pa Line truncated
`)).finally(()=>{r.stdout.isTTY&&r.stdout.write(`Job ${p}, '${c(AE(t))}' has ended
`)})),0}return await Hpe(t,e,r)}async function nit(t,e,r,{background:s=!1}={}){let a,n=f=>{a=f,r.variables["?"]=String(f)},c=async f=>{try{return await rit(f.chain,e,r,{background:s&&typeof f.then>"u"})}catch(p){if(!(p instanceof Vl))throw p;return r.stderr.write(`${p.message}
`),1}};for(n(await c(t));t.then;){if(r.exitCode!==null)return r.exitCode;switch(t.then.type){case"&&":a===0&&n(await c(t.then.line));break;case"||":a!==0&&n(await c(t.then.line));break;default:throw new Error(`Assertion failed: Unsupported command type: "${t.then.type}"`)}t=t.then.line}return a}async function TT(t,e,r){let s=r.backgroundJobs;r.backgroundJobs=[];let a=0;for(let{command:n,type:c}of t){if(a=await nit(n,e,r,{background:c==="&"}),r.exitCode!==null)return r.exitCode;r.variables["?"]=String(a)}return await Promise.all(r.backgroundJobs),r.backgroundJobs=s,a}function Ype(t){switch(t.type){case"variable":return t.name==="@"||t.name==="#"||t.name==="*"||Number.isFinite(parseInt(t.name,10))||"defaultValue"in t&&!!t.defaultValue&&t.defaultValue.some(e=>dv(e))||"alternativeValue"in t&&!!t.alternativeValue&&t.alternativeValue.some(e=>dv(e));case"arithmetic":return Gj(t.arithmetic);case"shell":return qj(t.shell);default:return!1}}function dv(t){switch(t.type){case"redirection":return t.args.some(e=>dv(e));case"argument":return t.segments.some(e=>Ype(e));default:throw new Error(`Assertion failed: Unsupported argument type: "${t.type}"`)}}function Gj(t){switch(t.type){case"variable":return Ype(t);case"number":return!1;default:return Gj(t.left)||Gj(t.right)}}function qj(t){return t.some(({command:e})=>{for(;e;){let r=e.chain;for(;r;){let s;switch(r.type){case"subshell":s=qj(r.subshell);break;case"command":s=r.envs.some(a=>a.args.some(n=>dv(n)))||r.args.some(a=>dv(a));break}if(s)return!0;if(!r.then)break;r=r.then.chain}if(!e.then)break;e=e.then.line}return!1})}async function vI(t,e=[],{baseFs:r=new Yn,builtins:s={},cwd:a=fe.toPortablePath(process.cwd()),env:n=process.env,stdin:c=process.stdin,stdout:f=process.stdout,stderr:p=process.stderr,variables:h={},glob:E=PT}={}){let C={};for(let[I,R]of Object.entries(n))typeof R<"u"&&(C[I]=R);let S=new Map(Xnt);for(let[I,R]of Object.entries(s))S.set(I,R);c===null&&(c=new Jl.PassThrough,c.end());let P=ux(t,E);if(!qj(P)&&P.length>0&&e.length>0){let{command:I}=P[P.length-1];for(;I.then;)I=I.then.line;let R=I.chain;for(;R.then;)R=R.then.chain;R.type==="command"&&(R.args=R.args.concat(e.map(N=>({type:"argument",segments:[{type:"text",text:N}]}))))}return await TT(P,{args:e,baseFs:r,builtins:S,initialStdin:c,initialStdout:f,initialStderr:p,glob:E},{cwd:a,environment:C,exitCode:null,procedures:{},stdin:c,stdout:f,stderr:p,variables:Object.assign({},h,{"?":0}),nextBackgroundJobIndex:1,backgroundJobs:[]})}var jpe,Gpe,Jl,qpe,Xnt,$nt,pv=Xe(()=>{Dt();wc();jpe=ut(TE()),Gpe=Ie("os"),Jl=Ie("stream"),qpe=Ie("timers/promises");Dpe();bpe();Qpe();jj();jj();Xnt=new Map([["cd",async([t=(0,Gpe.homedir)(),...e],r,s)=>{let a=J.resolve(s.cwd,fe.toPortablePath(t));if(!(await r.baseFs.statPromise(a).catch(c=>{throw c.code==="ENOENT"?new Vl(`cd: no such file or directory: ${t}`):c})).isDirectory())throw new Vl(`cd: not a directory: ${t}`);return s.cwd=a,0}],["pwd",async(t,e,r)=>(r.stdout.write(`${fe.fromPortablePath(r.cwd)}
`),0)],[":",async(t,e,r)=>0],["true",async(t,e,r)=>0],["false",async(t,e,r)=>1],["exit",async([t,...e],r,s)=>s.exitCode=parseInt(t??s.variables["?"],10)],["echo",async(t,e,r)=>(r.stdout.write(`${t.join(" ")}
`),0)],["sleep",async([t],e,r)=>{if(typeof t>"u")throw new Vl("sleep: missing operand");let s=Number(t);if(Number.isNaN(s))throw new Vl(`sleep: invalid time interval '${t}'`);return await(0,qpe.setTimeout)(1e3*s,0)}],["unset",async(t,e,r)=>{for(let s of t)delete r.environment[s],delete r.variables[s];return 0}],["__ysh_run_procedure",async(t,e,r)=>{let s=r.procedures[t[0]];return await xT(s,{stdin:new Oc(r.stdin),stdout:new Oc(r.stdout),stderr:new Oc(r.stderr)}).run()}],["__ysh_set_redirects",async(t,e,r)=>{let s=r.stdin,a=r.stdout,n=r.stderr,c=[],f=[],p=[],h=0;for(;t[h]!=="--";){let C=t[h++],{type:S,fd:P}=JSON.parse(C),I=W=>{switch(P){case null:case 0:c.push(W);break;default:throw new Error(`Unsupported file descriptor: "${P}"`)}},R=W=>{switch(P){case null:case 1:f.push(W);break;case 2:p.push(W);break;default:throw new Error(`Unsupported file descriptor: "${P}"`)}},N=Number(t[h++]),U=h+N;for(let W=h;W<U;++h,++W)switch(S){case"<":I(()=>e.baseFs.createReadStream(J.resolve(r.cwd,fe.toPortablePath(t[W]))));break;case"<<<":I(()=>{let ee=new Jl.PassThrough;return process.nextTick(()=>{ee.write(`${t[W]}
`),ee.end()}),ee});break;case"<&":I(()=>Mpe(Number(t[W]),1,r));break;case">":case">>":{let ee=J.resolve(r.cwd,fe.toPortablePath(t[W]));R(ee==="/dev/null"?new Jl.Writable({autoDestroy:!0,emitClose:!0,write(ie,ue,le){setImmediate(le)}}):e.baseFs.createWriteStream(ee,S===">>"?{flags:"a"}:void 0))}break;case">&":R(Mpe(Number(t[W]),2,r));break;default:throw new Error(`Assertion failed: Unsupported redirection type: "${S}"`)}}if(c.length>0){let C=new Jl.PassThrough;s=C;let S=P=>{if(P===c.length)C.end();else{let I=c[P]();I.pipe(C,{end:!1}),I.on("end",()=>{S(P+1)})}};S(0)}if(f.length>0){let C=new Jl.PassThrough;a=C;for(let S of f)C.pipe(S)}if(p.length>0){let C=new Jl.PassThrough;n=C;for(let S of p)C.pipe(S)}let E=await xT(gv(t.slice(h+1),e,r),{stdin:new Oc(s),stdout:new Oc(a),stderr:new Oc(n)}).run();return await Promise.all(f.map(C=>new Promise((S,P)=>{C.on("error",I=>{P(I)}),C.on("close",()=>{S()}),C.end()}))),await Promise.all(p.map(C=>new Promise((S,P)=>{C.on("error",I=>{P(I)}),C.on("close",()=>{S()}),C.end()}))),E}]]);$nt={addition:(t,e)=>t+e,subtraction:(t,e)=>t-e,multiplication:(t,e)=>t*e,division:(t,e)=>Math.trunc(t/e)}});var Vpe=_((S4t,RT)=>{function iit(){var t=0,e=1,r=2,s=3,a=4,n=5,c=6,f=7,p=8,h=9,E=10,C=11,S=12,P=13,I=14,R=15,N=16,U=17,W=0,ee=1,ie=2,ue=3,le=4;function me(g,we){return 55296<=g.charCodeAt(we)&&g.charCodeAt(we)<=56319&&56320<=g.charCodeAt(we+1)&&g.charCodeAt(we+1)<=57343}function pe(g,we){we===void 0&&(we=0);var ye=g.charCodeAt(we);if(55296<=ye&&ye<=56319&&we<g.length-1){var Ae=ye,se=g.charCodeAt(we+1);return 56320<=se&&se<=57343?(Ae-55296)*1024+(se-56320)+65536:Ae}if(56320<=ye&&ye<=57343&&we>=1){var Ae=g.charCodeAt(we-1),se=ye;return 55296<=Ae&&Ae<=56319?(Ae-55296)*1024+(se-56320)+65536:se}return ye}function Be(g,we,ye){var Ae=[g].concat(we).concat([ye]),se=Ae[Ae.length-2],Z=ye,De=Ae.lastIndexOf(I);if(De>1&&Ae.slice(1,De).every(function(j){return j==s})&&[s,P,U].indexOf(g)==-1)return ie;var Re=Ae.lastIndexOf(a);if(Re>0&&Ae.slice(1,Re).every(function(j){return j==a})&&[S,a].indexOf(se)==-1)return Ae.filter(function(j){return j==a}).length%2==1?ue:le;if(se==t&&Z==e)return W;if(se==r||se==t||se==e)return Z==I&&we.every(function(j){return j==s})?ie:ee;if(Z==r||Z==t||Z==e)return ee;if(se==c&&(Z==c||Z==f||Z==h||Z==E))return W;if((se==h||se==f)&&(Z==f||Z==p))return W;if((se==E||se==p)&&Z==p)return W;if(Z==s||Z==R)return W;if(Z==n)return W;if(se==S)return W;var mt=Ae.indexOf(s)!=-1?Ae.lastIndexOf(s)-1:Ae.length-2;return[P,U].indexOf(Ae[mt])!=-1&&Ae.slice(mt+1,-1).every(function(j){return j==s})&&Z==I||se==R&&[N,U].indexOf(Z)!=-1?W:we.indexOf(a)!=-1?ie:se==a&&Z==a?W:ee}this.nextBreak=function(g,we){if(we===void 0&&(we=0),we<0)return 0;if(we>=g.length-1)return g.length;for(var ye=Ce(pe(g,we)),Ae=[],se=we+1;se<g.length;se++)if(!me(g,se-1)){var Z=Ce(pe(g,se));if(Be(ye,Ae,Z))return se;Ae.push(Z)}return g.length},this.splitGraphemes=function(g){for(var we=[],ye=0,Ae;(Ae=this.nextBreak(g,ye))<g.length;)we.push(g.slice(ye,Ae)),ye=Ae;return ye<g.length&&we.push(g.slice(ye)),we},this.iterateGraphemes=function(g){var we=0,ye={next:function(){var Ae,se;return(se=this.nextBreak(g,we))<g.length?(Ae=g.slice(we,se),we=se,{value:Ae,done:!1}):we<g.length?(Ae=g.slice(we),we=g.length,{value:Ae,done:!1}):{value:void 0,done:!0}}.bind(this)};return typeof Symbol<"u"&&Symbol.iterator&&(ye[Symbol.iterator]=function(){return ye}),ye},this.countGraphemes=function(g){for(var we=0,ye=0,Ae;(Ae=this.nextBreak(g,ye))<g.length;)ye=Ae,we++;return ye<g.length&&we++,we};function Ce(g){return 1536<=g&&g<=1541||g==1757||g==1807||g==2274||g==3406||g==69821||70082<=g&&g<=70083||g==72250||72326<=g&&g<=72329||g==73030?S:g==13?t:g==10?e:0<=g&&g<=9||11<=g&&g<=12||14<=g&&g<=31||127<=g&&g<=159||g==173||g==1564||g==6158||g==8203||8206<=g&&g<=8207||g==8232||g==8233||8234<=g&&g<=8238||8288<=g&&g<=8292||g==8293||8294<=g&&g<=8303||55296<=g&&g<=57343||g==65279||65520<=g&&g<=65528||65529<=g&&g<=65531||113824<=g&&g<=113827||119155<=g&&g<=119162||g==917504||g==917505||917506<=g&&g<=917535||917632<=g&&g<=917759||918e3<=g&&g<=921599?r:768<=g&&g<=879||1155<=g&&g<=1159||1160<=g&&g<=1161||1425<=g&&g<=1469||g==1471||1473<=g&&g<=1474||1476<=g&&g<=1477||g==1479||1552<=g&&g<=1562||1611<=g&&g<=1631||g==1648||1750<=g&&g<=1756||1759<=g&&g<=1764||1767<=g&&g<=1768||1770<=g&&g<=1773||g==1809||1840<=g&&g<=1866||1958<=g&&g<=1968||2027<=g&&g<=2035||2070<=g&&g<=2073||2075<=g&&g<=2083||2085<=g&&g<=2087||2089<=g&&g<=2093||2137<=g&&g<=2139||2260<=g&&g<=2273||2275<=g&&g<=2306||g==2362||g==2364||2369<=g&&g<=2376||g==2381||2385<=g&&g<=2391||2402<=g&&g<=2403||g==2433||g==2492||g==2494||2497<=g&&g<=2500||g==2509||g==2519||2530<=g&&g<=2531||2561<=g&&g<=2562||g==2620||2625<=g&&g<=2626||2631<=g&&g<=2632||2635<=g&&g<=2637||g==2641||2672<=g&&g<=2673||g==2677||2689<=g&&g<=2690||g==2748||2753<=g&&g<=2757||2759<=g&&g<=2760||g==2765||2786<=g&&g<=2787||2810<=g&&g<=2815||g==2817||g==2876||g==2878||g==2879||2881<=g&&g<=2884||g==2893||g==2902||g==2903||2914<=g&&g<=2915||g==2946||g==3006|| Line truncated
`,end:t=>`::endgroup::
`}:NT.default.TRAVIS?{start:t=>`travis_fold:start:${t}
`,end:t=>`travis_fold:end:${t}
`}:NT.default.GITLAB?{start:t=>`section_start:${Math.floor(Date.now()/1e3)}:${t.toLowerCase().replace(/\W+/g,"_")}[collapsed=true]\r\x1B[0K${t}
`,end:t=>`section_end:${Math.floor(Date.now()/1e3)}:${t.toLowerCase().replace(/\W+/g,"_")}\r\x1B[0K`}:null,ehe=D0!==null,Zpe=new Date,lit=["iTerm.app","Apple_Terminal","WarpTerminal","vscode"].includes(process.env.TERM_PROGRAM)||!!process.env.WT_SESSION,cit=t=>t,OT=cit({patrick:{date:[17,3],chars:["\u{1F340}","\u{1F331}"],size:40},simba:{date:[19,7],chars:["\u{1F981}","\u{1F334}"],size:40},jack:{date:[31,10],chars:["\u{1F383}","\u{1F987}"],size:40},hogsfather:{date:[31,12],chars:["\u{1F389}","\u{1F384}"],size:40},default:{chars:["=","-"],size:80}}),uit=lit&&Object.keys(OT).find(t=>{let e=OT[t];return!(e.date&&(e.date[0]!==Zpe.getDate()||e.date[1]!==Zpe.getMonth()+1))})||"default";Ot=class extends Ao{constructor({configuration:r,stdout:s,json:a=!1,forceSectionAlignment:n=!1,includeNames:c=!0,includePrefix:f=!0,includeFooter:p=!0,includeLogs:h=!a,includeInfos:E=h,includeWarnings:C=h}){super();this.uncommitted=new Set;this.warningCount=0;this.errorCount=0;this.timerFooter=[];this.startTime=Date.now();this.indent=0;this.level=0;this.progress=new Map;this.progressTime=0;this.progressFrame=0;this.progressTimeout=null;this.progressStyle=null;this.progressMaxScaledSize=null;if(RB(this,{configuration:r}),this.configuration=r,this.forceSectionAlignment=n,this.includeNames=c,this.includePrefix=f,this.includeFooter=p,this.includeInfos=E,this.includeWarnings=C,this.json=a,this.stdout=s,r.get("enableProgressBars")&&!a&&s.isTTY&&s.columns>22){let S=r.get("progressBarStyle")||uit;if(!Object.hasOwn(OT,S))throw new Error("Assertion failed: Invalid progress bar style");this.progressStyle=OT[S];let P=Math.min(this.getRecommendedLength(),80);this.progressMaxScaledSize=Math.floor(this.progressStyle.size*P/80)}}static async start(r,s){let a=new this(r),n=process.emitWarning;process.emitWarning=(c,f)=>{if(typeof c!="string"){let h=c;c=h.message,f=f??h.name}let p=typeof f<"u"?`${f}: ${c}`:c;a.reportWarning(0,p)},r.includeVersion&&a.reportInfo(0,zd(r.configuration,`Yarn ${fn}`,2));try{await s(a)}catch(c){a.reportExceptionOnce(c)}finally{await a.finalize(),process.emitWarning=n}return a}hasErrors(){return this.errorCount>0}exitCode(){return this.hasErrors()?1:0}getRecommendedLength(){let s=this.progressStyle!==null?this.stdout.columns-1:super.getRecommendedLength();return Math.max(40,s-12-this.indent*2)}startSectionSync({reportHeader:r,reportFooter:s,skipIfEmpty:a},n){let c={committed:!1,action:()=>{r?.()}};a?this.uncommitted.add(c):(c.action(),c.committed=!0);let f=Date.now();try{return n()}catch(p){throw this.reportExceptionOnce(p),p}finally{let p=Date.now();this.uncommitted.delete(c),c.committed&&s?.(p-f)}}async startSectionPromise({reportHeader:r,reportFooter:s,skipIfEmpty:a},n){let c={committed:!1,action:()=>{r?.()}};a?this.uncommitted.add(c):(c.action(),c.committed=!0);let f=Date.now();try{return await n()}catch(p){throw this.reportExceptionOnce(p),p}finally{let p=Date.now();this.uncommitted.delete(c),c.committed&&s?.(p-f)}}startTimerImpl(r,s,a){return{cb:typeof s=="function"?s:a,reportHeader:()=>{this.level+=1,this.reportInfo(null,`\u250C ${r}`),this.indent+=1,D0!==null&&!this.json&&this.includeInfos&&this.stdout.write(D0.start(r))},reportFooter:f=>{if(this.indent-=1,D0!==null&&!this.json&&this.includeInfos){this.stdout.write(D0.end(r));for(let p of this.timerFooter)p()}this.configuration.get("enableTimers")&&f>200?this.reportInfo(null,`\u2514 Completed in ${Ht(this.configuration,f,ht.DURATION)}`):this.reportInfo(null,"\u2514 Completed"),this.level-=1},skipIfEmpty:(typeof s=="function"?{}:s).skipIfEmpty}}startTimerSync(r,s,a){let{cb:n,...c}=this.startTimerImpl(r,s,a);return this.startSectionSync(c,n)}async startTimerPromise(r,s,a){let{cb:n,...c}=this.startTimerImpl(r,s,a);return this.startSectionPromise(c,n)}reportSeparator(){this.indent===0?this.writeLine(""):this.reportInfo(null,"")}reportInfo(r,s){if(!this.includeInfos)return;this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"",c=`${this.formatPrefix(n,"blueBright")}${s}`;this.json?this.reportJson({type:"info",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:s}):this.writeLine(c)}reportWarning(r,s){if(this.warningCount+=1,!this.includeWarnings)return;this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"";this.json?this.reportJson({type:"warning",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:s}):this.writeLine(`${this.formatPrefix(n,"yellowBright")}${s}`)}reportError(r,s){this.errorCount+=1,this.timerFooter.push(()=>this.reportErrorImpl(r,s)),this.reportErrorImpl(r,s)}reportErrorImpl(r,s){this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"";this.json?this.reportJson({type:"error",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:s}):this.writeLine(`${this.formatPrefix(n,"redBright")}${s}`,{truncate:!1})}reportFold(r,s){if(!D0)return;let a=`${D0.start(r)}${s}${D0.end(r)}`;this.timerFooter.push(()=>this.stdout.write(a))}reportProgress(r){if(this.progressStyle===null)ret Line truncated
`),this.writeProgress()}writeLines(r,{truncate:s}={}){this.clearProgress({delta:r.length});for(let a of r)this.stdout.write(`${this.truncate(a,{truncate:s})}
`);this.writeProgress()}commit(){let r=this.uncommitted;this.uncommitted=new Set;for(let s of r)s.committed=!0,s.action()}clearProgress({delta:r=0,clear:s=!1}){this.progressStyle!==null&&this.progress.size+r>0&&(this.stdout.write(`\x1B[${this.progress.size+r}A`),(r>0||s)&&this.stdout.write("\x1B[0J"))}writeProgress(){if(this.progressStyle===null||(this.progressTimeout!==null&&clearTimeout(this.progressTimeout),this.progressTimeout=null,this.progress.size===0))return;let r=Date.now();r-this.progressTime>Xpe&&(this.progressFrame=(this.progressFrame+1)%zpe.length,this.progressTime=r);let s=zpe[this.progressFrame];for(let a of this.progress.values()){let n="";if(typeof a.lastScaledSize<"u"){let h=this.progressStyle.chars[0].repeat(a.lastScaledSize),E=this.progressStyle.chars[1].repeat(this.progressMaxScaledSize-a.lastScaledSize);n=` ${h}${E}`}let c=this.formatName(null),f=c?`${c}: `:"",p=a.definition.title?` ${a.definition.title}`:"";this.stdout.write(`${Ht(this.configuration,"\u27A4","blueBright")} ${f}${s}${n}${p}
`)}this.progressTimeout=setTimeout(()=>{this.refreshProgress({force:!0})},Xpe)}refreshProgress({delta:r=0,force:s=!1}={}){let a=!1,n=!1;if(s||this.progress.size===0)a=!0;else for(let c of this.progress.values()){let f=typeof c.definition.progress<"u"?Math.trunc(this.progressMaxScaledSize*c.definition.progress):void 0,p=c.lastScaledSize;c.lastScaledSize=f;let h=c.lastTitle;if(c.lastTitle=c.definition.title,f!==p||(n=h!==c.definition.title)){a=!0;break}}a&&(this.clearProgress({delta:r,clear:n}),this.writeProgress())}truncate(r,{truncate:s}={}){return this.progressStyle===null&&(s=!1),typeof s>"u"&&(s=this.configuration.get("preferTruncatedLines")),s&&(r=(0,$pe.default)(r,0,this.stdout.columns-1)),r}formatName(r){return this.includeNames?the(r,{configuration:this.configuration,json:this.json}):""}formatPrefix(r,s){return this.includePrefix?`${Ht(this.configuration,"\u27A4",s)} ${r}${this.formatIndent()}`:""}formatNameWithHyperlink(r){return this.includeNames?Wj(r,{configuration:this.configuration,json:this.json}):""}formatIndent(){return this.level>0||!this.forceSectionAlignment?"\u2502 ".repeat(this.indent):`${ait} `}}});var In={};Vt(In,{PackageManager:()=>nhe,detectPackageManager:()=>ihe,executePackageAccessibleBinary:()=>che,executePackageScript:()=>LT,executePackageShellcode:()=>Yj,executeWorkspaceAccessibleBinary:()=>mit,executeWorkspaceLifecycleScript:()=>ahe,executeWorkspaceScript:()=>ohe,getPackageAccessibleBinaries:()=>MT,getWorkspaceAccessibleBinaries:()=>lhe,hasPackageScript:()=>hit,hasWorkspaceScript:()=>Vj,isNodeScript:()=>Jj,makeScriptEnv:()=>Iv,maybeExecuteWorkspaceLifecycleScript:()=>dit,prepareExternalProject:()=>pit});async function b0(t,e,r,s=[]){if(process.platform==="win32"){let a=`@goto #_undefined_# 2>NUL || @title %COMSPEC% & @setlocal & @"${r}" ${s.map(n=>`"${n.replace('"','""')}"`).join(" ")} %*`;await ce.writeFilePromise(J.format({dir:t,name:e,ext:".cmd"}),a)}await ce.writeFilePromise(J.join(t,e),`#!/bin/sh
exec "${r}" ${s.map(a=>`'${a.replace(/'/g,`'"'"'`)}'`).join(" ")} "$@"
`,{mode:493})}async function ihe(t){let e=await Ut.tryFind(t);if(e?.packageManager){let s=xQ(e.packageManager);if(s?.name){let a=`found ${JSON.stringify({packageManager:e.packageManager})} in manifest`,[n]=s.reference.split(".");switch(s.name){case"yarn":return{packageManagerField:!0,packageManager:Number(n)===1?"Yarn Classic":"Yarn",reason:a};case"npm":return{packageManagerField:!0,packageManager:"npm",reason:a};case"pnpm":return{packageManagerField:!0,packageManager:"pnpm",reason:a}}}}let r;try{r=await ce.readFilePromise(J.join(t,Er.lockfile),"utf8")}catch{}return r!==void 0?r.match(/^__metadata:$/m)?{packageManager:"Yarn",reason:'"__metadata" key found in yarn.lock'}:{packageManager:"Yarn Classic",reason:'"__metadata" key not found in yarn.lock, must be a Yarn classic lockfile'}:ce.existsSync(J.join(t,"package-lock.json"))?{packageManager:"npm",reason:`found npm's "package-lock.json" lockfile`}:ce.existsSync(J.join(t,"pnpm-lock.yaml"))?{packageManager:"pnpm",reason:`found pnpm's "pnpm-lock.yaml" lockfile`}:null}async function Iv({project:t,locator:e,binFolder:r,ignoreCorepack:s,lifecycleScript:a,baseEnv:n=t?.configuration.env??process.env}){let c={};for(let[E,C]of Object.entries(n))typeof C<"u"&&(c[E.toLowerCase()!=="path"?E:"PATH"]=C);let f=fe.fromPortablePath(r);c.BERRY_BIN_FOLDER=fe.fromPortablePath(f);let p=process.env.COREPACK_ROOT&&!s?fe.join(process.env.COREPACK_ROOT,"dist/yarn.js"):process.argv[1];if(await Promise.all([b0(r,"node",process.execPath),...fn!==null?[b0(r,"run",process.execPath,[p,"run"]),b0(r,"yarn",process.execPath,[p]),b0(r,"yarnpkg",process.execPath,[p]),b0(r,"node-gyp",process.execPath,[p,"run","--top-level","node-gyp"])]:[]]),t&&(c.INIT_CWD=fe.fromPortablePath(t.configuration.startingCwd),c.PROJECT_CWD=fe.fromPortablePath(t.cwd)),c.PATH=c.PATH?`${f}${fe.delimiter}${c.PATH}`:`${f}`,c.npm_execpath=`${f}${fe.sep}yarn`,c.npm_node_execpath=`${f}${fe.sep}node`,e){if(!t)throw new Error("Assertion failed: Missing project");let E=t.tryWorkspaceByLocator(e),C=E?E.manifest.version??"":t.storedPackages.get(e.locatorHash).version??"";c.npm_package_name=un(e),c.npm_package_version=C;let S;if(E)S=E.cwd;else{let P=t.storedPackages.get(e.locatorHash);if(!P)throw new Error(`Package for ${Yr(t.configuration,e)} not found in the project`);let I=t.configuration.getLinkers(),R={project:t,report:new Ot({stdout:new P0.PassThrough,configuration:t.configuration})},N=I.find(U=>U.supportsPackage(P,R));if(!N)throw new Error(`The package ${Yr(t.configuration,P)} isn't supported by any of the available linkers`);S=await N.findPackageLocation(P,R)}c.npm_package_json=fe.fromPortablePath(J.join(S,Er.manifest))}let h=fn!==null?`yarn/${fn}`:`yarn/${Pp("@yarnpkg/core").version}-core`;return c.npm_config_user_agent=`${h} npm/? node/${process.version} ${process.platform} ${process.arch}`,a&&(c.npm_lifecycle_event=a),t&&await t.configuration.triggerHook(E=>E.setupScriptEnvironment,t,c,async(E,C,S)=>await b0(r,E,C,S)),c}async function pit(t,e,{configuration:r,report:s,workspace:a=null,locator:n=null}){await Ait(async()=>{await ce.mktempPromise(async c=>{let f=J.join(c,"pack.log"),p=null,{stdout:h,stderr:E}=r.getSubprocessStreams(f,{prefix:fe.fromPortablePath(t),report:s}),C=n&&Gu(n)?rI(n):n,S=C?ll(C):"an external project";h.write(`Packing ${S} from sources
`);let P=await ihe(t),I;P!==null?(h.write(`Using ${P.packageManager} for bootstrap. Reason: ${P.reason}
`),I=P.packageManager):(h.write(`No package manager configuration detected; defaulting to Yarn
`),I="Yarn");let R=I==="Yarn"&&!P?.packageManagerField;await ce.mktempPromise(async N=>{let U=await Iv({binFolder:N,ignoreCorepack:R,baseEnv:{...process.env,COREPACK_ENABLE_AUTO_PIN:"0"}}),ee=new Map([["Yarn Classic",async()=>{let ue=a!==null?["workspace",a]:[],le=J.join(t,Er.manifest),me=await ce.readFilePromise(le),pe=await Wu(process.execPath,[process.argv[1],"set","version","classic","--only-if-needed","--yarn-path"],{cwd:t,env:U,stdin:p,stdout:h,stderr:E,end:1});if(pe.code!==0)return pe.code;await ce.writeFilePromise(le,me),await ce.appendFilePromise(J.join(t,".npmignore"),`/.yarn
`),h.write(`
`),delete U.NODE_ENV;let Be=await Wu("yarn",["install"],{cwd:t,env:U,stdin:p,stdout:h,stderr:E,end:1});if(Be.code!==0)return Be.code;h.write(`
`);let Ce=await Wu("yarn",[...ue,"pack","--filename",fe.fromPortablePath(e)],{cwd:t,env:U,stdin:p,stdout:h,stderr:E});return Ce.code!==0?Ce.code:0}],["Yarn",async()=>{let ue=a!==null?["workspace",a]:[];U.YARN_ENABLE_INLINE_BUILDS="1";let le=J.join(t,Er.lockfile);await ce.existsPromise(le)||await ce.writeFilePromise(le,"");let me=await Wu("yarn",[...ue,"pack","--install-if-needed","--filename",fe.fromPortablePath(e)],{cwd:t,env:U,stdin:p,stdout:h,stderr:E});return me.code!==0?me.code:0}],["npm",async()=>{if(a!==null){let we=new P0.PassThrough,ye=WE(we);we.pipe(h,{end:!1});let Ae=await Wu("npm",["--version"],{cwd:t,env:U,stdin:p,stdout:we,stderr:E,end:0});if(we.end(),Ae.code!==0)return h.end(),E.end(),Ae.code;let se=(await ye).toString().trim();if(!Zf(se,">=7.x")){let Z=Da(null,"npm"),De=On(Z,se),Re=On(Z,">=7.x");throw new Error(`Workspaces aren't supported by ${ni(r,De)}; please upgrade to ${ni(r,Re)} (npm has been detected as the primary package manager for ${Ht(r,t,ht.PATH)})`)}}let ue=a!==null?["--workspace",a]:[];delete U.npm_config_user_agent,delete U.npm_config_production,delete U.NPM_CONFIG_PRODUCTION,delete U.NODE_ENV;let le=await Wu("npm",["install","--legacy-peer-deps"],{cwd:t,env:U,stdin:p,stdout:h,stderr:E,end:1});if(le.code!==0)return le.code;let me=new P0.PassThrough,pe=WE(me);me.pipe(h);let Be=await Wu("npm",["pack","--silent",...ue],{cwd:t,env:U,stdin:p,stdout:me,stderr:E});if(Be.code!==0)return Be.code;let Ce=(await pe).toString().trim().replace(/^.*\n/s,""),g=J.resolve(t,fe.toPortablePath(Ce));return await ce.renamePromise(g,e),0}]]).get(I);if(typeof ee>"u")throw new Error("Assertion failed: Unsupported workflow");let ie=await ee();if(!(ie===0||typeof ie>"u"))throw ce.detachTemp(c),new jt(58,`Packing the package failed (exit code ${ie}, logs can be found here: ${Ht(r,f,ht.PATH)})`)})})})}async function hit(t,e,{project:r}){let s=r.tryWorkspaceByLocator(t);if(s!==null)return Vj(s,e);let a=r.storedPackages.get(t.locatorHash);if(!a)throw new Error(`Package for ${Yr(r.configuration,t)} not found in the project`);return await $f.openPromise(async n=>{let c=r.configuration,f=r.configuration.getLinkers(),p={project:r,report:new Ot({stdout:new P0.PassThrough,configuration:c})},h=f.find(P=>P.supportsPackage(a,p));if(!h)throw new Error(`The package ${Yr(r.configuration,a)} isn't supported by any of the available linkers`);let E=await h.findPackageLocation(a,p),C=new Sn(E,{baseFs:n});return(await Ut.find(vt.dot,{baseFs:C})).scripts.has(e)})}async function LT(t,e,r,{cwd:s,project:a,stdin:n,stdout:c,stderr:f}){return await ce.mktempPromise(async p=>{let{manifest:h,env:E,cwd:C}=await she(t,{project:a,binFolder:p,cwd:s,lifecycleScript:e}),S=h.scripts.get(e);if(typeof S>"u")return 1;let P=async()=>await vI(S,r,{cwd:C,env:E,stdin:n,stdout:c,stderr:f});return await(await a.configuration.reduceHook(R=>R.wrapScriptExecution,P,a,t,e,{script:S,args:r,cwd:C,env:E,stdin:n,stdout:c,stderr:f}))()})}async function Yj(t,e,r,{cwd:s,project:a,stdin:n,stdout:c,stderr:f}){return await ce.mktempPromise(async p=>{let{env:h,cwd:E}=await she(t,{project:a,binFolder:p,cwd:s});return await vI(e,r,{cwd:E,env:h,stdin:n,stdout:c,stderr:f})})}async function git(t,{binFolder:e,cwd:r,lifecycleScript:s}){let a=await Iv({project:t.project,locator:t.anchoredLocator,binFolder:e,lifecycleScript:s});return await Kj(e,await lhe(t)),typeof r>"u"&&(r=J.dirname(await ce.realpathPromise(J.join(t.cwd,"package.json")))),{manifest:t.manifest,binFolder:e,env:a,cwd:r}}async function she(t,{project:e,binFolder:r,cwd:s,lifecycleScript:a}){let n=e.tryWorkspaceByLocator(t);if(n!==null)return git(n,{binFolder:r,cwd:s,lifecycleScript:a});let c=e.storedPackages.get(t.locatorHash);if(!c)throw new Error(`Package for ${Yr(e.configuration,t)} not found in the project`);return await $f.openPromise(async f=>{let p=e.configuration,h=e.configuration.getLinkers(),E={project:e,report:new Ot({stdout:new P0.PassThrough,configuration:p})},C=h.find(N=>N.supportsPackage(c,E));if(!C)throw new Error(`The package ${Yr(e.configuration,c)} isn't supported by any of the available linkers`);let S=await Iv({project:e,locator:t,binFolder:r,lifecycleScript:a});await Kj(r,await MT(t,{project:e}));let P=await C.findPackageLocation(c,E),I=new Sn(P,{baseFs:f}),R=await Ut.find(vt.dot,{baseFs:I});return typeof s>"u"&&(s=P),{manifest:R,binFolder:r,env:S,cwd:s}})}async function ohe(t,e,r,{cwd:s,stdin:a,stdout:n,stderr:c}){return await LT(t.anchoredLocator,e,r,{cwd:s,project:t.project,stdin:a,stdout:n,stderr:c})}function Vj(t,e){return t.manifest.scripts.has(e)}async function ahe(t,e,{cwd:r,report:s}){let{configuration:a}=t.project,n=null;await ce.mktempPromise(async c=>{let f=J.join(c,`${e}.log`),p=`# This file contains the result of Yarn calling the "${e}" lifecycle script inside a workspace ("${fe.fromPortablePath(t.cwd)}")
`,{stdout:h,stderr:E}=a.getSubprocessStreams(f,{report:s,prefix:Yr(a,t.anchoredLocator),header:p});s.reportInfo(36,`Calling the "${e}" lifecycle script`);let C=await ohe(t,e,[],{cwd:r,stdin:n,stdout:h,stderr:E});if(h.end(),E.end(),C!==0)throw ce.detachTemp(c),new jt(36,`${bB(e)} script failed (exit code ${Ht(a,C,ht.NUMBER)}, logs can be found here: ${Ht(a,f,ht.PATH)}); run ${Ht(a,`yarn ${e}`,ht.CODE)} to investigate`)})}async function dit(t,e,r){Vj(t,e)&&await ahe(t,e,r)}function Jj(t){let e=J.extname(t);if(e.match(/\.[cm]?[jt]sx?$/))return!0;if(e===".exe"||e===".bin")return!1;let r=Buffer.alloc(4),s;try{s=ce.openSync(t,"r")}catch{return!0}try{ce.readSync(s,r,0,r.length,0)}finally{ce.closeSync(s)}let a=r.readUint32BE();return!(a===3405691582||a===3489328638||a===2135247942||(a&4294901760)===1297743872)}async function MT(t,{project:e}){let r=e.configuration,s=new Map,a=e.storedPackages.get(t.locatorHash);if(!a)throw new Error(`Package for ${Yr(r,t)} not found in the project`);let n=new P0.Writable,c=r.getLinkers(),f={project:e,report:new Ot({configuration:r,stdout:n})},p=new Set([t.locatorHash]);for(let E of a.dependencies.values()){let C=e.storedResolutions.get(E.descriptorHash);if(!C)throw new Error(`Assertion failed: The resolution (${ni(r,E)}) should have been registered`);p.add(C)}let h=await Promise.all(Array.from(p,async E=>{let C=e.storedPackages.get(E);if(!C)throw new Error(`Assertion failed: The package (${E}) should have been registered`);if(C.bin.size===0)return Wl.skip;let S=c.find(I=>I.supportsPackage(C,f));if(!S)return Wl.skip;let P=null;try{P=await S.findPackageLocation(C,f)}catch(I){if(I.code==="LOCATOR_NOT_INSTALLED")return Wl.skip;throw I}return{dependency:C,packageLocation:P}}));for(let E of h){if(E===Wl.skip)continue;let{dependency:C,packageLocation:S}=E;for(let[P,I]of C.bin){let R=J.resolve(S,I);s.set(P,[C,fe.fromPortablePath(R),Jj(R)])}}return s}async function lhe(t){return await MT(t.anchoredLocator,{project:t.project})}async function Kj(t,e){await Promise.all(Array.from(e,([r,[,s,a]])=>a?b0(t,r,process.execPath,[s]):b0(t,r,s,[])))}async function che(t,e,r,{cwd:s,project:a,stdin:n,stdout:c,stderr:f,nodeArgs:p=[],packageAccessibleBinaries:h}){h??=await MT(t,{project:a});let E=h.get(e);if(!E)throw new Error(`Binary not found (${e}) for ${Yr(a.configuration,t)}`);return await ce.mktempPromise(async C=>{let[,S]=E,P=await Iv({project:a,locator:t,binFolder:C});await Kj(P.BERRY_BIN_FOLDER,h);let I=Jj(fe.toPortablePath(S))?Wu(process.execPath,[...p,S,...r],{cwd:s,env:P,stdin:n,stdout:c,stderr:f}):Wu(S,r,{cwd:s,env:P,stdin:n,stdout:c,stderr:f}),R;try{R=await I}finally{await ce.removePromise(P.BERRY_BIN_FOLDER)}return R.code})}async function mit(t,e,r,{cwd:s,stdin:a,stdout:n,stderr:c,packageAccessibleBinaries:f}){return await che(t.anchoredLocator,e,r,{project:t.project,cwd:s,stdin:a,stdout:n,stderr:c,packageAccessibleBinaries:f})}var rhe,P0,nhe,fit,Ait,zj=Xe(()=>{Dt();Dt();eA();pv();ql();rhe=ut(Ld()),P0=Ie("stream");oI();Tc();Ev();yv();dT();xc();Pc();Rp();Wo();nhe=(a=>(a.Yarn1="Yarn Classic",a.Yarn2="Yarn",a.Npm="npm",a.Pnpm="pnpm",a))(nhe||{});fit=2,Ait=(0,rhe.default)(fit)});var DI=_((J4t,fhe)=>{"use strict";var uhe=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"]]);fhe.exports=t=>t?Object.keys(t).map(e=>[uhe.has(e)?uhe.get(e):e,t[e]]).reduce((e,r)=>(e[r[0]]=r[1],e),Object.create(null)):{}});var PI=_((K4t,Ihe)=>{"use strict";var Ahe=typeof process=="object"&&process?process:{stdout:null,stderr:null},yit=Ie("events"),phe=Ie("stream"),hhe=Ie("string_decoder").StringDecoder,_p=Symbol("EOF"),Hp=Symbol("maybeEmitEnd"),x0=Symbol("emittedEnd"),UT=Symbol("emittingEnd"),Cv=Symbol("emittedError"),_T=Symbol("closed"),ghe=Symbol("read"),HT=Symbol("flush"),dhe=Symbol("flushChunk"),ul=Symbol("encoding"),jp=Symbol("decoder"),jT=Symbol("flowing"),wv=Symbol("paused"),bI=Symbol("resume"),Ys=Symbol("bufferLength"),Xj=Symbol("bufferPush"),Zj=Symbol("bufferShift"),Ko=Symbol("objectMode"),zo=Symbol("destroyed"),$j=Symbol("emitData"),mhe=Symbol("emitEnd"),e6=Symbol("emitEnd2"),Gp=Symbol("async"),Bv=t=>Promise.resolve().then(t),yhe=global._MP_NO_ITERATOR_SYMBOLS_!=="1",Eit=yhe&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),Iit=yhe&&Symbol.iterator||Symbol("iterator not implemented"),Cit=t=>t==="end"||t==="finish"||t==="prefinish",wit=t=>t instanceof ArrayBuffer||typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,Bit=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),GT=class{constructor(e,r,s){this.src=e,this.dest=r,this.opts=s,this.ondrain=()=>e[bI](),r.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ond Line truncated
`,a=Buffer.byteLength(s),n=Math.floor(Math.log(a)/Math.log(10))+1;return a+n>=Math.pow(10,n)&&(n+=1),n+a+s}};Sv.parse=(t,e,r)=>new Sv(Yit(Vit(t),e),r);var Yit=(t,e)=>e?Object.keys(t).reduce((r,s)=>(r[s]=t[s],r),e):t,Vit=t=>t.replace(/\n$/,"").split(`
`).reduce(Jit,Object.create(null)),Jit=(t,e)=>{let r=parseInt(e,10);if(r!==Buffer.byteLength(e)+1)return t;e=e.substr((r+" ").length);let s=e.split("="),a=s.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!a)return t;let n=s.join("=");return t[a]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(a)?new Date(n*1e3):/^[0-9]+$/.test(n)?+n:n,t};Fhe.exports=Sv});var FI=_((a3t,Nhe)=>{Nhe.exports=t=>{let e=t.length-1,r=-1;for(;e>-1&&t.charAt(e)==="/";)r=e,e--;return r===-1?t:t.slice(0,r)}});var zT=_((l3t,Ohe)=>{"use strict";Ohe.exports=t=>class extends t{warn(e,r,s={}){this.file&&(s.file=this.file),this.cwd&&(s.cwd=this.cwd),s.code=r instanceof Error&&r.code||e,s.tarCode=e,!this.strict&&s.recoverable!==!1?(r instanceof Error&&(s=Object.assign(r,s),r=r.message),this.emit("warn",s.tarCode,r,s)):r instanceof Error?this.emit("error",Object.assign(r,s)):this.emit("error",Object.assign(new Error(`${e}: ${r}`),s))}}});var b6=_((u3t,Lhe)=>{"use strict";var XT=["|","<",">","?",":"],D6=XT.map(t=>String.fromCharCode(61440+t.charCodeAt(0))),Kit=new Map(XT.map((t,e)=>[t,D6[e]])),zit=new Map(D6.map((t,e)=>[t,XT[e]]));Lhe.exports={encode:t=>XT.reduce((e,r)=>e.split(r).join(Kit.get(r)),t),decode:t=>D6.reduce((e,r)=>e.split(r).join(zit.get(r)),t)}});var P6=_((f3t,Uhe)=>{var{isAbsolute:Xit,parse:Mhe}=Ie("path").win32;Uhe.exports=t=>{let e="",r=Mhe(t);for(;Xit(t)||r.root;){let s=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":r.root;t=t.substr(s.length),e+=s,r=Mhe(t)}return[e,t]}});var Hhe=_((A3t,_he)=>{"use strict";_he.exports=(t,e,r)=>(t&=4095,r&&(t=(t|384)&-19),e&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t)});var M6=_((g3t,t0e)=>{"use strict";var Jhe=PI(),Khe=KT(),zhe=RI(),nA=Ie("fs"),jhe=Ie("path"),rA=QI(),Zit=FI(),Xhe=(t,e)=>e?(t=rA(t).replace(/^\.(\/|$)/,""),Zit(e)+"/"+t):rA(t),$it=16*1024*1024,Ghe=Symbol("process"),qhe=Symbol("file"),Whe=Symbol("directory"),k6=Symbol("symlink"),Yhe=Symbol("hardlink"),Dv=Symbol("header"),ZT=Symbol("read"),Q6=Symbol("lstat"),$T=Symbol("onlstat"),T6=Symbol("onread"),R6=Symbol("onreadlink"),F6=Symbol("openfile"),N6=Symbol("onopenfile"),R0=Symbol("close"),eR=Symbol("mode"),O6=Symbol("awaitDrain"),x6=Symbol("ondrain"),iA=Symbol("prefix"),Vhe=Symbol("hadError"),Zhe=zT(),est=b6(),$he=P6(),e0e=Hhe(),tR=Zhe(class extends Jhe{constructor(e,r){if(r=r||{},super(r),typeof e!="string")throw new TypeError("path is required");this.path=rA(e),this.portable=!!r.portable,this.myuid=process.getuid&&process.getuid()||0,this.myuser=process.env.USER||"",this.maxReadSize=r.maxReadSize||$it,this.linkCache=r.linkCache||new Map,this.statCache=r.statCache||new Map,this.preservePaths=!!r.preservePaths,this.cwd=rA(r.cwd||process.cwd()),this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.mtime=r.mtime||null,this.prefix=r.prefix?rA(r.prefix):null,this.fd=null,this.blockLen=null,this.blockRemain=null,this.buf=null,this.offset=null,this.length=null,this.pos=null,this.remain=null,typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let s=!1;if(!this.preservePaths){let[a,n]=$he(this.path);a&&(this.path=n,s=a)}this.win32=!!r.win32||process.platform==="win32",this.win32&&(this.path=est.decode(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=rA(r.absolute||jhe.resolve(this.cwd,e)),this.path===""&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path}),this.statCache.has(this.absolute)?this[$T](this.statCache.get(this.absolute)):this[Q6]()}emit(e,...r){return e==="error"&&(this[Vhe]=!0),super.emit(e,...r)}[Q6](){nA.lstat(this.absolute,(e,r)=>{if(e)return this.emit("error",e);this[$T](r)})}[$T](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=rst(e),this.emit("stat",e),this[Ghe]()}[Ghe](){switch(this.type){case"File":return this[qhe]();case"Directory":return this[Whe]();case"SymbolicLink":return this[k6]();default:return this.end()}}[eR](e){return e0e(e,this.type==="Directory",this.portable)}[iA](e){return Xhe(e,this.prefix)}[Dv](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new zhe({path:this[iA](this.path),linkpath:this.type==="Link"?this[iA](this.linkpath):this.linkpath,mode:this[eR](this.stat.mode),uid:this.portable?null:this.stat.uid,gid:this.portable?null:this.stat.gid,size:this.stat.size,mtime:this.noMtime?null:this.mtime||this.stat.mtime,type:this.type,uname:this.portable?null:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?null:this.stat.atime,ctime:this.portable?null:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new Khe({atime:this.portable?null:this.header.atime,ctime:this.portable?null:this.header.ctime,gid:this.portable?null:this.header.gid,mtime:this.noMtime?null:this.mtime||this.header.mtime,path:this[iA](this.path),linkpath:this.type==="Link"?this[iA](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?null:this.header.uid,uname:this.portable?null:this.header.uname,dev:this.portable?null:this.stat.dev,ino:this. Line truncated
`}),f},s})});var xs={};Vt(xs,{emitList:()=>Jot,emitTree:()=>cde,treeNodeToJson:()=>lde,treeNodeToTreeify:()=>ade});function ade(t,{configuration:e}){let r={},s=0,a=(n,c)=>{let f=Array.isArray(n)?n.entries():Object.entries(n);for(let[p,h]of f){if(!h)continue;let{label:E,value:C,children:S}=h,P=[];typeof E<"u"&&P.push(zd(e,E,2)),typeof C<"u"&&P.push(Ht(e,C[0],C[1])),P.length===0&&P.push(zd(e,`${p}`,2));let I=P.join(": ").trim(),R=`\0${s++}\0`,N=c[`${R}${I}`]={};typeof S<"u"&&a(S,N)}};if(typeof t.children>"u")throw new Error("The root node must only contain children");return a(t.children,r),r}function lde(t){let e=r=>{if(typeof r.children>"u"){if(typeof r.value>"u")throw new Error("Assertion failed: Expected a value to be set if the children are missing");return Xd(r.value[0],r.value[1])}let s=Array.isArray(r.children)?r.children.entries():Object.entries(r.children??{}),a=Array.isArray(r.children)?[]:{};for(let[n,c]of s)c&&(a[Kot(n)]=e(c));return typeof r.value>"u"?a:{value:Xd(r.value[0],r.value[1]),children:a}};return e(t)}function Jot(t,{configuration:e,stdout:r,json:s}){let a=t.map(n=>({value:n}));cde({children:a},{configuration:e,stdout:r,json:s})}function cde(t,{configuration:e,stdout:r,json:s,separators:a=0}){if(s){let c=Array.isArray(t.children)?t.children.values():Object.values(t.children??{});for(let f of c)f&&r.write(`${JSON.stringify(lde(f))}
`);return}let n=(0,ode.asTree)(ade(t,{configuration:e}),!1,!1);if(n=n.replace(/\0[0-9]+\0/g,""),a>=1&&(n=n.replace(/^([├└]─)/gm,`\u2502
$1`).replace(/^│\n/,"")),a>=2)for(let c=0;c<2;++c)n=n.replace(/^([│ ].{2}[├│ ].{2}[^\n]+\n)(([│ ]).{2}[├└].{2}[^\n]*\n[│ ].{2}[│ ].{2}[├└]─)/gm,`$1$3 \u2502
$2`).replace(/^│\n/,"");if(a>=3)throw new Error("Only the first two levels are accepted by treeUtils.emitTree");r.write(n)}function Kot(t){return typeof t=="string"?t.replace(/^\0[0-9]+\0/,""):t}var ode,ude=Xe(()=>{ode=ut(sde());xc()});var MR,fde=Xe(()=>{MR=class{constructor(e){this.releaseFunction=e;this.map=new Map}addOrCreate(e,r){let s=this.map.get(e);if(typeof s<"u"){if(s.refCount<=0)throw new Error(`Race condition in RefCountedMap. While adding a new key the refCount is: ${s.refCount} for ${JSON.stringify(e)}`);return s.refCount++,{value:s.value,release:()=>this.release(e)}}else{let a=r();return this.map.set(e,{refCount:1,value:a}),{value:a,release:()=>this.release(e)}}}release(e){let r=this.map.get(e);if(!r)throw new Error(`Unbalanced calls to release. No known instances of: ${JSON.stringify(e)}`);let s=r.refCount;if(s<=0)throw new Error(`Unbalanced calls to release. Too many release vs alloc refcount would become: ${s-1} of ${JSON.stringify(e)}`);s==1?(this.map.delete(e),this.releaseFunction(r.value)):r.refCount--}}});function _v(t){let e=t.match(zot);if(!e?.groups)throw new Error("Assertion failed: Expected the checksum to match the requested pattern");let r=e.groups.cacheVersion?parseInt(e.groups.cacheVersion):null;return{cacheKey:e.groups.cacheKey??null,cacheVersion:r,cacheSpec:e.groups.cacheSpec??null,hash:e.groups.hash}}var Ade,NG,OG,UR,Kr,zot,LG=Xe(()=>{Ge();Dt();Dt();eA();Ade=Ie("crypto"),NG=ut(Ie("fs"));fde();Tc();I0();Pc();Wo();OG=YE(process.env.YARN_CACHE_CHECKPOINT_OVERRIDE??process.env.YARN_CACHE_VERSION_OVERRIDE??9),UR=YE(process.env.YARN_CACHE_VERSION_OVERRIDE??10),Kr=class t{constructor(e,{configuration:r,immutable:s=r.get("enableImmutableCache"),check:a=!1}){this.markedFiles=new Set;this.mutexes=new Map;this.refCountedZipFsCache=new MR(e=>{e.discardAndClose()});this.cacheId=`-${(0,Ade.randomBytes)(8).toString("hex")}.tmp`;this.configuration=r,this.cwd=e,this.immutable=s,this.check=a;let{cacheSpec:n,cacheKey:c}=t.getCacheKey(r);this.cacheSpec=n,this.cacheKey=c}static async find(e,{immutable:r,check:s}={}){let a=new t(e.get("cacheFolder"),{configuration:e,immutable:r,check:s});return await a.setup(),a}static getCacheKey(e){let r=e.get("compressionLevel"),s=r!=="mixed"?`c${r}`:"";return{cacheKey:[UR,s].join(""),cacheSpec:s}}get mirrorCwd(){if(!this.configuration.get("enableMirror"))return null;let e=`${this.configuration.get("globalFolder")}/cache`;return e!==this.cwd?e:null}getVersionFilename(e){return`${nI(e)}-${this.cacheKey}.zip`}getChecksumFilename(e,r){let a=_v(r).hash.slice(0,10);return`${nI(e)}-${a}.zip`}isChecksumCompatible(e){if(e===null)return!1;let{cacheVersion:r,cacheSpec:s}=_v(e);if(r===null||r<OG)return!1;let a=this.configuration.get("cacheMigrationMode");return!(r<UR&&a==="always"||s!==this.cacheSpec&&a!=="required-only")}getLocatorPath(e,r){return this.mirrorCwd===null?J.resolve(this.cwd,this.getVersionFilename(e)):r===null?J.resolve(this.cwd,this.getVersionFilename(e)):J.resolve(this.cwd,this.getChecksumFilename(e,r))}getLocatorMirrorPath(e){let r=this.mirrorCwd;return r!==null?J.resolve(r,this.getVersionFilename(e)):null}async setup(){if(!this.configuration.get("enableGlobalCache"))if(this.immutable){if(!await ce.existsPromise(this.cwd))throw new jt(56,"Cache path does not exist.")}else{await ce.mkdirPromise(this.cwd,{recursive:!0});let e=J.resolve(this.cwd,".gitignore");await ce.changeFilePromise(e,`/.gitignore
*.flock
*.tmp
`)}(this.mirrorCwd||!this.immutable)&&await ce.mkdirPromise(this.mirrorCwd||this.cwd,{recursive:!0})}async fetchPackageFromCache(e,r,{onHit:s,onMiss:a,loader:n,...c}){let f=this.getLocatorMirrorPath(e),p=new Yn,h=()=>{let pe=new As,Be=J.join(vt.root,x8(e));return pe.mkdirSync(Be,{recursive:!0}),pe.writeJsonSync(J.join(Be,Er.manifest),{name:un(e),mocked:!0}),pe},E=async(pe,{isColdHit:Be,controlPath:Ce=null})=>{if(Ce===null&&c.unstablePackages?.has(e.locatorHash))return{isValid:!0,hash:null};let g=r&&!Be?_v(r).cacheKey:this.cacheKey,we=!c.skipIntegrityCheck||!r?`${g}/${await SQ(pe)}`:r;if(Ce!==null){let Ae=!c.skipIntegrityCheck||!r?`${this.cacheKey}/${await SQ(Ce)}`:r;if(we!==Ae)throw new jt(18,"The remote archive doesn't match the local checksum - has the local cache been corrupted?")}let ye=null;switch(r!==null&&we!==r&&(this.check?ye="throw":_v(r).cacheKey!==_v(we).cacheKey?ye="update":ye=this.configuration.get("checksumBehavior")),ye){case null:case"update":return{isValid:!0,hash:we};case"ignore":return{isValid:!0,hash:r};case"reset":return{isValid:!1,hash:r};default:case"throw":throw new jt(18,"The remote archive doesn't match the expected checksum")}},C=async pe=>{if(!n)throw new Error(`Cache check required but no loader configured for ${Yr(this.configuration,e)}`);let Be=await n(),Ce=Be.getRealPath();Be.saveAndClose(),await ce.chmodPromise(Ce,420);let g=await E(pe,{controlPath:Ce,isColdHit:!1});if(!g.isValid)throw new Error("Assertion failed: Expected a valid checksum");return g.hash},S=async()=>{if(f===null||!await ce.existsPromise(f)){let pe=await n(),Be=pe.getRealPath();return pe.saveAndClose(),{source:"loader",path:Be}}return{source:"mirror",path:f}},P=async()=>{if(!n)throw new Error(`Cache entry required but missing for ${Yr(this.configuration,e)}`);if(this.immutable)throw new jt(56,`Cache entry required but missing for ${Yr(this.configuration,e)}`);let{path:pe,source:Be}=await S(),{hash:Ce}=await E(pe,{isColdHit:!0}),g=this.getLocatorPath(e,Ce),we=[];Be!=="mirror"&&f!==null&&we.push(async()=>{let Ae=`${f}${this.cacheId}`;await ce.copyFilePromise(pe,Ae,NG.default.constants.COPYFILE_FICLONE),await ce.chmodPromise(Ae,420),await ce.renamePromise(Ae,f)}),(!c.mirrorWriteOnly||f===null)&&we.push(async()=>{let Ae=`${g}${this.cacheId}`;await ce.copyFilePromise(pe,Ae,NG.default.constants.COPYFILE_FICLONE),await ce.chmodPromise(Ae,420),await ce.renamePromise(Ae,g)});let ye=c.mirrorWriteOnly?f??g:g;return await Promise.all(we.map(Ae=>Ae())),[!1,ye,Ce]},I=async()=>{let Be=(async()=>{let Ce=c.unstablePackages?.has(e.locatorHash),g=Ce||!r||this.isChecksumCompatible(r)?this.getLocatorPath(e,r):null,we=g!==null?this.markedFiles.has(g)||await p.existsPromise(g):!1,ye=!!c.mockedPackages?.has(e.locatorHash)&&(!this.check||!we),Ae=ye||we,se=Ae?s:a;if(se&&se(),Ae){let Z=null,De=g;if(!ye)if(this.check)Z=await C(De);else{let Re=await E(De,{isColdHit:!1});if(Re.isValid)Z=Re.hash;else return P()}return[ye,De,Z]}else{if(this.immutable&&Ce)throw new jt(56,`Cache entry required but missing for ${Yr(this.configuration,e)}; consider defining ${he.pretty(this.configuration,"supportedArchitectures",he.Type.CODE)} to cache packages for multiple systems`);return P()}})();this.mutexes.set(e.locatorHash,Be);try{return await Be}finally{this.mutexes.delete(e.locatorHash)}};for(let pe;pe=this.mutexes.get(e.locatorHash);)await pe;let[R,N,U]=await I();R||this.markedFiles.add(N);let W=()=>this.refCountedZipFsCache.addOrCreate(N,()=>R?h():new As(N,{baseFs:p,readOnly:!0})),ee,ie=new oE(()=>W4(()=>(ee=W(),ee.value),pe=>`Failed to open the cache entry for ${Yr(this.configuration,e)}: ${pe}`),J),ue=new _f(N,{baseFs:ie,pathUtils:J}),le=()=>{ee?.release()},me=c.unstablePackages?.has(e.locatorHash)?null:U;return[ue,le,me]}},zot=/^(?:(?<cacheKey>(?<cacheVersion>[0-9]+)(?<cacheSpec>.*))\/)?(?<hash>.*)$/});var _R,pde=Xe(()=>{_R=(r=>(r[r.SCRIPT=0]="SCRIPT",r[r.SHELLCODE=1]="SHELLCODE",r))(_R||{})});var Xot,KI,MG=Xe(()=>{Dt();wc();Rp();Wo();Xot=[[/^(git(?:\+(?:https|ssh))?:\/\/.*(?:\.git)?)#(.*)$/,(t,e,r,s)=>`${r}#commit=${s}`],[/^https:\/\/((?:[^/]+?)@)?codeload\.github\.com\/([^/]+\/[^/]+)\/tar\.gz\/([0-9a-f]+)$/,(t,e,r="",s,a)=>`https://${r}github.com/${s}.git#commit=${a}`],[/^https:\/\/((?:[^/]+?)@)?github\.com\/([^/]+\/[^/]+?)(?:\.git)?#([0-9a-f]+)$/,(t,e,r="",s,a)=>`https://${r}github.com/${s}.git#commit=${a}`],[/^https?:\/\/[^/]+\/(?:[^/]+\/)*(?:@.+(?:\/|(?:%2f)))?([^/]+)\/(?:-|download)\/\1-[^/]+\.tgz(?:#|$)/,t=>`npm:${t}`],[/^https:\/\/npm\.pkg\.github\.com\/download\/(?:@[^/]+)\/(?:[^/]+)\/(?:[^/]+)\/(?:[0-9a-f]+)(?:#|$)/,t=>`npm:${t}`],[/^https:\/\/npm\.fontawesome\.com\/(?:@[^/]+)\/([^/]+)\/-\/([^/]+)\/\1-\2.tgz(?:#|$)/,t=>`npm:${t}`],[/^https?:\/\/[^/]+\/.*\/(@[^/]+)\/([^/]+)\/-\/\1\/\2-(?:[.\d\w-]+)\.tgz(?:#|$)/,(t,e)=>kQ({protocol:"npm:",source:null,selector:t,params:{__archiveUrl:e}})],[/^[^/]+\.tgz#[0-9a-f]+$/,t=>`npm:${t}`]],KI=class{constructor(e){this.resolver=e;this.resolutions=null}async setup(e,{report:r}){let s=J.join(e.cwd,Er Line truncated
`)}reportProgress(r){return{...Promise.resolve().then(async()=>{for await(let{}of r);}),stop:()=>{}}}reportJson(r){}reportFold(r,s){}async finalize(){this.errorCount>0&&(this.stdout.write(`
`),this.stdout.write(`${Ht(this.configuration,"\u27A4","redBright")} Errors happened when preparing the environment required to run this command.
`),this.suggestInstall&&this.stdout.write(`${Ht(this.configuration,"\u27A4","redBright")} This might be caused by packages being missing from the lockfile, in which case running "yarn install" might help.
`))}formatNameWithHyperlink(r){return Wj(r,{configuration:this.configuration,json:!1})}}});var zI,UG=Xe(()=>{Wo();zI=class{constructor(e){this.resolver=e}supportsDescriptor(e,r){return!!(r.project.storedResolutions.get(e.descriptorHash)||r.project.originalPackages.has(bQ(e).locatorHash))}supportsLocator(e,r){return!!(r.project.originalPackages.has(e.locatorHash)&&!r.project.lockfileNeedsRefresh)}shouldPersistResolution(e,r){throw new Error("The shouldPersistResolution method shouldn't be called on the lockfile resolver, which would always answer yes")}bindDescriptor(e,r,s){return e}getResolutionDependencies(e,r){return this.resolver.getResolutionDependencies(e,r)}async getCandidates(e,r,s){let a=s.project.storedResolutions.get(e.descriptorHash);if(a){let c=s.project.originalPackages.get(a);if(c)return[c]}let n=s.project.originalPackages.get(bQ(e).locatorHash);if(n)return[n];throw new Error("Resolution expected from the lockfile data")}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(c=>c.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){let s=r.project.originalPackages.get(e.locatorHash);if(!s)throw new Error("The lockfile resolver isn't meant to resolve packages - they should already have been stored into a cache");return s}}});function Kp(){}function Zot(t,e,r,s,a){for(var n=0,c=e.length,f=0,p=0;n<c;n++){var h=e[n];if(h.removed){if(h.value=t.join(s.slice(p,p+h.count)),p+=h.count,n&&e[n-1].added){var C=e[n-1];e[n-1]=e[n],e[n]=C}}else{if(!h.added&&a){var E=r.slice(f,f+h.count);E=E.map(function(P,I){var R=s[p+I];return R.length>P.length?R:P}),h.value=t.join(E)}else h.value=t.join(r.slice(f,f+h.count));f+=h.count,h.added||(p+=h.count)}}var S=e[c-1];return c>1&&typeof S.value=="string"&&(S.added||S.removed)&&t.equals("",S.value)&&(e[c-2].value+=S.value,e.pop()),e}function $ot(t){return{newPos:t.newPos,components:t.components.slice(0)}}function eat(t,e){if(typeof t=="function")e.callback=t;else if(t)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function mde(t,e,r){return r=eat(r,{ignoreWhitespace:!0}),qG.diff(t,e,r)}function tat(t,e,r){return WG.diff(t,e,r)}function HR(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?HR=function(e){return typeof e}:HR=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},HR(t)}function _G(t){return iat(t)||sat(t)||oat(t)||aat()}function iat(t){if(Array.isArray(t))return HG(t)}function sat(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function oat(t,e){if(t){if(typeof t=="string")return HG(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return HG(t,e)}}function HG(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,s=new Array(e);r<e;r++)s[r]=t[r];return s}function aat(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jG(t,e,r,s,a){e=e||[],r=r||[],s&&(t=s(a,t));var n;for(n=0;n<e.length;n+=1)if(e[n]===t)return r[n];var c;if(lat.call(t)==="[object Array]"){for(e.push(t),c=new Array(t.length),r.push(c),n=0;n<t.length;n+=1)c[n]=jG(t[n],e,r,s,a);return e.pop(),r.pop(),c}if(t&&t.toJSON&&(t=t.toJSON()),HR(t)==="object"&&t!==null){e.push(t),c={},r.push(c);var f=[],p;for(p in t)t.hasOwnProperty(p)&&f.push(p);for(f.sort(),n=0;n<f.length;n+=1)p=f[n],c[p]=jG(t[p],e,r,s,p);e.pop(),r.pop()}else c=t;return c}function yde(t,e,r,s,a,n,c){c||(c={}),typeof c.context>"u"&&(c.context=4);var f=tat(r,s,c);if(!f)return;f.push({value:"",lines:[]});function p(U){return U.map(function(W){return" "+W})}for(var h=[],E=0,C=0,S=[],P=1,I=1,R=function(W){var ee=f[W],ie=ee.lines||ee.value.replace(/\n$/,"").split(`
`);if(ee.lines=ie,ee.added||ee.removed){var ue;if(!E){var le=f[W-1];E=P,C=I,le&&(S=c.context>0?p(le.lines.slice(-c.context)):[],E-=S.length,C-=S.length)}(ue=S).push.apply(ue,_G(ie.map(function(Ae){return(ee.added?"+":"-")+Ae}))),ee.added?I+=ie.length:P+=ie.length}else{if(E)if(ie.length<=c.context*2&&W<f.length-2){var me;(me=S).push.apply(me,_G(p(ie)))}else{var pe,Be=Math.min(ie.length,c.context);(pe=S).push.apply(pe,_G(p(ie.slice(0,Be))));var Ce={oldStart:E,oldLines:P-E+Be,newStart:C,newLines:I-C+Be,lines:S};if(W>=f.length-2&&ie.length<=c.context){var g=/\n$/.test(r),we=/\n$/.test(s),ye=ie.length==0&&S.length>Ce.oldLines;!g&&ye&&r.length>0&&S.splice(Ce.oldLines,0,"\\ No newline at end of file"),(!g&&!ye||!we)&&S.push("\\ No newline at end of file")}h.push(Ce),E=0,C=0,S=[]}P+=ie.length,I+=ie.length}},N=0;N<f.length;N++)R(N);return{oldFileName:t,newFileName:e,oldHeader:a,newHeader:n,hunks:h}}var y8t,gde,dde,qG,WG,rat,nat,lat,Hv,GG,YG=Xe(()=>{Kp.prototype={diff:function(e,r){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=s.callback;typeof s=="function"&&(a=s,s={}),this.options=s;var n=this;function c(R){return a?(setTimeout(function(){a(void 0,R)},0),!0):R}e=this.castInput(e),r=this.castInput(r),e=this.removeEmpty(this.tokenize(e)),r=this.removeEmpty(this.tokenize(r));var f=r.length,p=e.length,h=1,E=f+p;s.maxEditLength&&(E=Math.min(E,s.maxEditLength));var C=[{newPos:-1,components:[]}],S=this.extractCommon(C[0],r,e,0);if(C[0].newPos+1>=f&&S+1>=p)return c([{value:this.join(r),count:r.length}]);function P(){for(var R=-1*h;R<=h;R+=2){var N=void 0,U=C[R-1],W=C[R+1],ee=(W?W.newPos:0)-R;U&&(C[R-1]=void 0);var ie=U&&U.newPos+1<f,ue=W&&0<=ee&&ee<p;if(!ie&&!ue){C[R]=void 0;continue}if(!ie||ue&&U.newPos<W.newPos?(N=$ot(W),n.pushComponent(N.components,void 0,!0)):(N=U,N.newPos++,n.pushComponent(N.components,!0,void 0)),ee=n.extractCommon(N,r,e,R),N.newPos+1>=f&&ee+1>=p)return c(Zot(n,N.components,r,e,n.useLongestToken));C[R]=N}h++}if(a)(function R(){setTimeout(function(){if(h>E)return a();P()||R()},0)})();else for(;h<=E;){var I=P();if(I)return I}},pushComponent:function(e,r,s){var a=e[e.length-1];a&&a.added===r&&a.removed===s?e[e.length-1]={count:a.count+1,added:r,removed:s}:e.push({count:1,added:r,removed:s})},extractCommon:function(e,r,s,a){for(var n=r.length,c=s.length,f=e.newPos,p=f-a,h=0;f+1<n&&p+1<c&&this.equals(r[f+1],s[p+1]);)f++,p++,h++;return h&&e.components.push({count:h}),e.newPos=f,p},equals:function(e,r){return this.options.comparator?this.options.comparator(e,r):e===r||this.options.ignoreCase&&e.toLowerCase()===r.toLowerCase()},removeEmpty:function(e){for(var r=[],s=0;s<e.length;s++)e[s]&&r.push(e[s]);return r},castInput:function(e){return e},tokenize:function(e){return e.split("")},join:function(e){return e.join("")}};y8t=new Kp;gde=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,dde=/\S/,qG=new Kp;qG.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!dde.test(t)&&!dde.test(e)};qG.tokenize=function(t){for(var e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),r=0;r<e.length-1;r++)!e[r+1]&&e[r+2]&&gde.test(e[r])&&gde.test(e[r+2])&&(e[r]+=e[r+2],e.splice(r+1,2),r--);return e};WG=new Kp;WG.tokenize=function(t){var e=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(var s=0;s<r.length;s++){var a=r[s];s%2&&!this.options.newlineIsToken?e[e.length-1]+=a:(this.options.ignoreWhitespace&&(a=a.trim()),e.push(a))}return e};rat=new Kp;rat.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};nat=new Kp;nat.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};lat=Object.prototype.toString,Hv=new Kp;Hv.useLongestToken=!0;Hv.tokenize=WG.tokenize;Hv.castInput=function(t){var e=this.options,r=e.undefinedReplacement,s=e.stringifyReplacer,a=s===void 0?function(n,c){return typeof c>"u"?r:c}:s;return typeof t=="string"?t:JSON.stringify(jG(t,null,null,a),a," ")};Hv.equals=function(t,e){return Kp.prototype.equals.call(Hv,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};GG=new Kp;GG.tokenize=function(t){return t.slice()};GG.join=GG.removeEmpty=function(t){return t}});var jR,Ede=Xe(()=>{Tc();jR=class{constructor(e){this.resolver=e}supportsDescriptor(e,r){return this.resolver.supportsDescriptor(e,r)}supportsLocator(e,r){return this.resolver.supportsLocator(e,r)}shouldPersistResolution(e,r){return this.resolver.shouldPersistResolution(e,r)}bindDescriptor(e,r,s){return this.resolver.bindDescriptor(e,r,s)}getResolutionDependencies(e,r){return this.resolver.getResolutionDependencies(e,r)}async getCandidates(e,r,s){throw new jt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}async getSatisfying(e,r,s,a){throw new jt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}async resolve(e,r){throw new jt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfLine truncated
`;await ce.changeFilePromise(r,s,{automaticNewlines:!0}),this.manifest.raw=e}}});function hat({project:t,allDescriptors:e,allResolutions:r,allPackages:s,accessibleLocators:a=new Set,optionalBuilds:n=new Set,peerRequirements:c=new Map,peerWarnings:f=[],peerRequirementNodes:p=new Map,volatileDescriptors:h=new Set}){let E=new Map,C=[],S=new Map,P=new Map,I=new Map,R=new Map,N=new Map,U=new Map(t.workspaces.map(le=>{let me=le.anchoredLocator.locatorHash,pe=s.get(me);if(typeof pe>"u")throw new Error("Assertion failed: The workspace should have an associated package");return[me,LB(pe)]})),W=()=>{let le=ce.mktempSync(),me=J.join(le,"stacktrace.log"),pe=String(C.length+1).length,Be=C.map((Ce,g)=>`${`${g+1}.`.padStart(pe," ")} ${ll(Ce)}
`).join("");throw ce.writeFileSync(me,Be),ce.detachTemp(le),new jt(45,`Encountered a stack overflow when resolving peer dependencies; cf ${fe.fromPortablePath(me)}`)},ee=le=>{let me=r.get(le.descriptorHash);if(typeof me>"u")throw new Error("Assertion failed: The resolution should have been registered");let pe=s.get(me);if(!pe)throw new Error("Assertion failed: The package could not be found");return pe},ie=(le,me,pe,{top:Be,optional:Ce})=>{C.length>1e3&&W(),C.push(me);let g=ue(le,me,pe,{top:Be,optional:Ce});return C.pop(),g},ue=(le,me,pe,{top:Be,optional:Ce})=>{if(Ce||n.delete(me.locatorHash),a.has(me.locatorHash))return;a.add(me.locatorHash);let g=s.get(me.locatorHash);if(!g)throw new Error(`Assertion failed: The package (${Yr(t.configuration,me)}) should have been registered`);let we=new Set,ye=new Map,Ae=[],se=[],Z=[],De=[];for(let Re of Array.from(g.dependencies.values())){if(g.peerDependencies.has(Re.identHash)&&g.locatorHash!==Be)continue;if(kp(Re))throw new Error("Assertion failed: Virtual packages shouldn't be encountered when virtualizing a branch");h.delete(Re.descriptorHash);let mt=Ce;if(!mt){let ke=g.dependenciesMeta.get(un(Re));if(typeof ke<"u"){let it=ke.get(null);typeof it<"u"&&it.optional&&(mt=!0)}}let j=r.get(Re.descriptorHash);if(!j)throw new Error(`Assertion failed: The resolution (${ni(t.configuration,Re)}) should have been registered`);let rt=U.get(j)||s.get(j);if(!rt)throw new Error(`Assertion failed: The package (${j}, resolved from ${ni(t.configuration,Re)}) should have been registered`);if(rt.peerDependencies.size===0){ie(Re,rt,new Map,{top:Be,optional:mt});continue}let Fe,Ne,Pe=new Set,Ve=new Map;Ae.push(()=>{Fe=b8(Re,me.locatorHash),Ne=P8(rt,me.locatorHash),g.dependencies.set(Re.identHash,Fe),r.set(Fe.descriptorHash,Ne.locatorHash),e.set(Fe.descriptorHash,Fe),s.set(Ne.locatorHash,Ne),bp(R,Ne.locatorHash).add(Fe.descriptorHash),we.add(Ne.locatorHash)}),se.push(()=>{N.set(Ne.locatorHash,Ve);for(let ke of Ne.peerDependencies.values()){let Ue=Yl(ye,ke.identHash,()=>{let x=pe.get(ke.identHash)??null,w=g.dependencies.get(ke.identHash);return!w&&UB(me,ke)&&(le.identHash===me.identHash?w=le:(w=On(me,le.range),e.set(w.descriptorHash,w),r.set(w.descriptorHash,me.locatorHash),h.delete(w.descriptorHash),x=null)),w||(w=On(ke,"missing:")),{subject:me,ident:ke,provided:w,root:!x,requests:new Map,hash:`p${us(me.locatorHash,ke.identHash).slice(0,6)}`}}).provided;if(Ue.range==="missing:"&&Ne.dependencies.has(ke.identHash)){Ne.peerDependencies.delete(ke.identHash);continue}if(Ve.set(ke.identHash,{requester:Ne,descriptor:ke,meta:Ne.peerDependenciesMeta.get(un(ke)),children:new Map}),Ne.dependencies.set(ke.identHash,Ue),kp(Ue)){let x=r.get(Ue.descriptorHash);bp(I,x).add(Ne.locatorHash)}S.set(Ue.identHash,Ue),Ue.range==="missing:"&&Pe.add(Ue.identHash)}Ne.dependencies=new Map(qs(Ne.dependencies,([ke,it])=>un(it)))}),Z.push(()=>{if(!s.has(Ne.locatorHash))return;let ke=E.get(rt.locatorHash);typeof ke=="number"&&ke>=2&&W();let it=E.get(rt.locatorHash),Ue=typeof it<"u"?it+1:1;E.set(rt.locatorHash,Ue),ie(Fe,Ne,Ve,{top:Be,optional:mt}),E.set(rt.locatorHash,Ue-1)}),De.push(()=>{let ke=r.get(Fe.descriptorHash);if(typeof ke>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");let it=N.get(ke);if(typeof it>"u")throw new Error("Assertion failed: Expected the peer requests to be registered");for(let Ue of ye.values()){let x=it.get(Ue.ident.identHash);x&&(Ue.requests.set(Fe.descriptorHash,x),p.set(Ue.hash,Ue),Ue.root||pe.get(Ue.ident.identHash)?.children.set(Fe.descriptorHash,x))}if(s.has(Ne.locatorHash))for(let Ue of Pe)Ne.dependencies.delete(Ue)})}for(let Re of[...Ae,...se])Re();for(let Re of we){we.delete(Re);let mt=s.get(Re),j=us(rI(mt).locatorHash,...Array.from(mt.dependencies.values(),Pe=>{let Ve=Pe.range!=="missing:"?r.get(Pe.descriptorHash):"missing:";if(typeof Ve>"u")throw new Error(`Assertion failed: Expected the resolution for ${ni(t.configuration,Pe)} to have been registered`);return Ve===Be?`${Ve} (top)`:Ve})),rt=P.get(j);if(typeof rt>"u"){P.set(j,mt);continue}let Fe=bp(R,rt.locatorHash);for(let Pe of R.get(mt.locatorHash)??[])r.set(Pe,rt.locatorHash),Fe.add(Pe);s.delete(mt.locatorHash),a.delete(mt.locatorHash),we.delete(mt.locatorHash);let Ne=I.get(mt.locatorHash);if(Ne!==void 0){let Pe=bp(I,rt.locatorHash);for(let Ve of Ne)Pe.add(Ve),we.add(Ve)}}for(let Re of[...Z,...De])Re()};for(let le of t.workspaces){let me=le.anchoredLocator;h.delete(le.anchoredDescriptor.descriptorHash),ie(le.anchoredDescriptor,me,new Map,{top:me.locatorHash,optional:!1})}for(let le of p.values()){if(!le.root)continue;let me=s.get(le.subject.locatorHash);if(typeof me>"u")continue;for(let Be of le.requests.values()){let Ce=`p${us(le.subject.locatorHash,un(le.ident),Be.requester.locatorHash).slice(0,6)}`;c.set(Ce,{subject:le.subject.locatorHash,requested:le.ident,rootRequester:Be.requester.locatorHash,allRequesters:Array.from(qB(Be),g=>g.requester.locatorHash)})}let pe=[...qB(le)];if(le.provided.rang Line truncated
${[C,S,P].join(`
`)}`)}async setupResolutions(){this.storedResolutions=new Map,this.storedDescriptors=new Map,this.storedPackages=new Map,this.lockFileChecksum=null;let e=J.join(this.cwd,Er.lockfile),r=this.configuration.get("defaultLanguageName");if(ce.existsSync(e)){let s=await ce.readFilePromise(e,"utf8");this.lockFileChecksum=wde(s);let a=ls(s);if(a.__metadata){let n=a.__metadata.version,c=a.__metadata.cacheKey;this.lockfileLastVersion=n,this.lockfileNeedsRefresh=n<WR;for(let f of Object.keys(a)){if(f==="__metadata")continue;let p=a[f];if(typeof p.resolution>"u")throw new Error(`Assertion failed: Expected the lockfile entry to have a resolution field (${f})`);let h=Qp(p.resolution,!0),E=new Ut;E.load(p,{yamlCompatibilityMode:!0});let C=E.version,S=E.languageName||r,P=p.linkType.toUpperCase(),I=p.conditions??null,R=E.dependencies,N=E.peerDependencies,U=E.dependenciesMeta,W=E.peerDependenciesMeta,ee=E.bin;if(p.checksum!=null){let ue=typeof c<"u"&&!p.checksum.includes("/")?`${c}/${p.checksum}`:p.checksum;this.storedChecksums.set(h.locatorHash,ue)}let ie={...h,version:C,languageName:S,linkType:P,conditions:I,dependencies:R,peerDependencies:N,dependenciesMeta:U,peerDependenciesMeta:W,bin:ee};this.originalPackages.set(ie.locatorHash,ie);for(let ue of f.split(uat)){let le=C0(ue);n<=6&&(le=this.configuration.normalizeDependency(le),le=On(le,le.range.replace(/^patch:[^@]+@(?!npm(:|%3A))/,"$1npm%3A"))),this.storedDescriptors.set(le.descriptorHash,le),this.storedResolutions.set(le.descriptorHash,h.locatorHash)}}}else s.includes("yarn lockfile v1")&&(this.lockfileLastVersion=-1)}}async setupWorkspaces(){this.workspaces=[],this.workspacesByCwd=new Map,this.workspacesByIdent=new Map;let e=new Set,r=(0,qR.default)(4),s=async(a,n)=>{if(e.has(n))return a;e.add(n);let c=new XI(n,{project:this});await r(()=>c.setup());let f=a.then(()=>{this.addWorkspace(c)});return Array.from(c.workspacesCwds).reduce(s,f)};await s(Promise.resolve(),this.cwd)}addWorkspace(e){let r=this.workspacesByIdent.get(e.anchoredLocator.identHash);if(typeof r<"u")throw new Error(`Duplicate workspace name ${$i(this.configuration,e.anchoredLocator)}: ${fe.fromPortablePath(e.cwd)} conflicts with ${fe.fromPortablePath(r.cwd)}`);this.workspaces.push(e),this.workspacesByCwd.set(e.cwd,e),this.workspacesByIdent.set(e.anchoredLocator.identHash,e)}get topLevelWorkspace(){return this.getWorkspaceByCwd(this.cwd)}tryWorkspaceByCwd(e){J.isAbsolute(e)||(e=J.resolve(this.cwd,e)),e=J.normalize(e).replace(/\/+$/,"");let r=this.workspacesByCwd.get(e);return r||null}getWorkspaceByCwd(e){let r=this.tryWorkspaceByCwd(e);if(!r)throw new Error(`Workspace not found (${e})`);return r}tryWorkspaceByFilePath(e){let r=null;for(let s of this.workspaces)J.relative(s.cwd,e).startsWith("../")||r&&r.cwd.length>=s.cwd.length||(r=s);return r||null}getWorkspaceByFilePath(e){let r=this.tryWorkspaceByFilePath(e);if(!r)throw new Error(`Workspace not found (${e})`);return r}tryWorkspaceByIdent(e){let r=this.workspacesByIdent.get(e.identHash);return typeof r>"u"?null:r}getWorkspaceByIdent(e){let r=this.tryWorkspaceByIdent(e);if(!r)throw new Error(`Workspace not found (${$i(this.configuration,e)})`);return r}tryWorkspaceByDescriptor(e){if(e.range.startsWith(Ei.protocol)){let s=e.range.slice(Ei.protocol.length);if(s!=="^"&&s!=="~"&&s!=="*"&&!cl(s))return this.tryWorkspaceByCwd(s)}let r=this.tryWorkspaceByIdent(e);return r===null||(kp(e)&&(e=MB(e)),!r.accepts(e.range))?null:r}getWorkspaceByDescriptor(e){let r=this.tryWorkspaceByDescriptor(e);if(r===null)throw new Error(`Workspace not found (${ni(this.configuration,e)})`);return r}tryWorkspaceByLocator(e){let r=this.tryWorkspaceByIdent(e);return r===null||(Gu(e)&&(e=rI(e)),r.anchoredLocator.locatorHash!==e.locatorHash)?null:r}getWorkspaceByLocator(e){let r=this.tryWorkspaceByLocator(e);if(!r)throw new Error(`Workspace not found (${Yr(this.configuration,e)})`);return r}deleteDescriptor(e){this.storedResolutions.delete(e),this.storedDescriptors.delete(e)}deleteLocator(e){this.originalPackages.delete(e),this.storedPackages.delete(e),this.accessibleLocators.delete(e)}forgetResolution(e){if("descriptorHash"in e){let r=this.storedResolutions.get(e.descriptorHash);this.deleteDescriptor(e.descriptorHash);let s=new Set(this.storedResolutions.values());typeof r<"u"&&!s.has(r)&&this.deleteLocator(r)}if("locatorHash"in e){this.deleteLocator(e.locatorHash);for(let[r,s]of this.storedResolutions)s===e.locatorHash&&this.deleteDescriptor(r)}}forgetTransientResolutions(){let e=this.configuration.makeResolver(),r=new Map;for(let[s,a]of this.storedResolutions.entries()){let n=r.get(a);n||r.set(a,n=new Set),n.add(s)}for(let s of this.originalPackages.values()){let a;try{a=e.shouldPersistResolution(s,{project:this,resolver:e})}catch{a=!1}if(!a){this.deleteLocator(s.locatorHash);let n=r.get(s.locatorHash);if(n){r.delete(s.locatorHash);for(let c of n)this.deleteDescriptor(c)}}}}forgetVirtualResolutions(){for(let e of this.storedPackages.values())for(let[r,s]of e.dependencies)kp(s)&&e.dLine truncated
`;switch(rt.type){case 0:Fe+=`# Script name: ${rt.script}
`;break;case 1:Fe+=`# Script code: ${rt.script}
`;break}let Ne=null;if(!await ce.mktempPromise(async Ve=>{let ke=J.join(Ve,"build.log"),{stdout:it,stderr:Ue}=this.configuration.getSubprocessStreams(ke,{header:Fe,prefix:Yr(this.configuration,Z),report:r}),x;try{switch(rt.type){case 0:x=await LT(Z,rt.script,[],{cwd:j,project:this,stdin:Ne,stdout:it,stderr:Ue});break;case 1:x=await Yj(Z,rt.script,[],{cwd:j,project:this,stdin:Ne,stdout:it,stderr:Ue});break}}catch(y){Ue.write(y.stack),x=1}if(it.end(),Ue.end(),x===0)return!0;ce.detachTemp(Ve);let w=`${Yr(this.configuration,Z)} couldn't be built successfully (exit code ${Ht(this.configuration,x,ht.NUMBER)}, logs can be found here: ${Ht(this.configuration,ke,ht.PATH)})`,b=this.optionalBuilds.has(Z.locatorHash);return b?r.reportInfo(9,w):r.reportError(9,w),ehe&&r.reportFold(fe.fromPortablePath(ke),ce.readFileSync(ke,"utf8")),b}))return!1}return!0});Ae.push(...mt,Promise.allSettled(mt).then(j=>{ie.delete(se),j.every(rt=>rt.status==="fulfilled"&&rt.value===!0)&&Ce.set(Z.locatorHash,Re)}))}if(await Uu(Ae),ye===ie.size){let se=Array.from(ie).map(Z=>{let De=this.storedPackages.get(Z);if(!De)throw new Error("Assertion failed: The package should have been registered");return Yr(this.configuration,De)}).join(", ");r.reportError(3,`Some packages have circular dependencies that make their build order unsatisfiable - as a result they won't be built (affected packages are: ${se})`);break}}this.storedBuildState=Ce,this.skippedBuilds=N}async installWithNewReport(e,r){return(await Ot.start({configuration:this.configuration,json:e.json,stdout:e.stdout,forceSectionAlignment:!0,includeLogs:!e.json&&!e.quiet,includeVersion:!0},async a=>{await this.install({...r,report:a})})).exitCode()}async install(e){let r=this.configuration.get("nodeLinker");ze.telemetry?.reportInstall(r);let s=!1;if(await e.report.startTimerPromise("Project validation",{skipIfEmpty:!0},async()=>{this.configuration.get("enableOfflineMode")&&e.report.reportWarning(90,"Offline work is enabled; Yarn won't fetch packages from the remote registry if it can avoid it"),await this.configuration.triggerHook(E=>E.validateProject,this,{reportWarning:(E,C)=>{e.report.reportWarning(E,C)},reportError:(E,C)=>{e.report.reportError(E,C),s=!0}})}),s)return;let a=await this.configuration.getPackageExtensions();for(let E of a.values())for(let[,C]of E)for(let S of C)S.status="inactive";let n=J.join(this.cwd,Er.lockfile),c=null;if(e.immutable)try{c=await ce.readFilePromise(n,"utf8")}catch(E){throw E.code==="ENOENT"?new jt(28,"The lockfile would have been created by this install, which is explicitly forbidden."):E}await e.report.startTimerPromise("Resolution step",async()=>{await this.resolveEverything(e)}),await e.report.startTimerPromise("Post-resolution validation",{skipIfEmpty:!0},async()=>{dat(this,e.report);for(let[,E]of a)for(let[,C]of E)for(let S of C)if(S.userProvided){let P=Ht(this.configuration,S,ht.PACKAGE_EXTENSION);switch(S.status){case"inactive":e.report.reportWarning(68,`${P}: No matching package in the dependency tree; you may not need this rule anymore.`);break;case"redundant":e.report.reportWarning(69,`${P}: This rule seems redundant when applied on the original package; the extension may have been applied upstream.`);break}}if(c!==null){let E=Ed(c,this.generateLockfile());if(E!==c){let C=yde(n,n,c,E,void 0,void 0,{maxEditLength:100});if(C){e.report.reportSeparator();for(let S of C.hunks){e.report.reportInfo(null,`@@ -${S.oldStart},${S.oldLines} +${S.newStart},${S.newLines} @@`);for(let P of S.lines)P.startsWith("+")?e.report.reportError(28,Ht(this.configuration,P,ht.ADDED)):P.startsWith("-")?e.report.reportError(28,Ht(this.configuration,P,ht.REMOVED)):e.report.reportInfo(null,Ht(this.configuration,P,"grey"))}e.report.reportSeparator()}throw new jt(28,"The lockfile would have been modified by this install, which is explicitly forbidden.")}}});for(let E of a.values())for(let[,C]of E)for(let S of C)S.userProvided&&S.status==="active"&&ze.telemetry?.reportPackageExtension(Xd(S,ht.PACKAGE_EXTENSION));await e.report.startTimerPromise("Fetch step",async()=>{await this.fetchEverything(e)});let f=e.immutable?[...new Set(this.configuration.get("immutablePatterns"))].sort():[],p=await Promise.all(f.map(async E=>DQ(E,{cwd:this.cwd})));(typeof e.persistProject>"u"||e.persistProject)&&await this.persist(),await e.report.startTimerPromise("Link step",async()=>{if(e.mode==="update-lockfile"){e.report.reportWarning(73,`Skipped due to ${Ht(this.configuration,"mode=update-lockfile",ht.CODE)}`);return}await this.linkEverything(e);let E=await Promise.all(f.map(async C=>DQ(C,{cwd:this.cwd})));for(let C=0;C<f.length;++C)p[C]!==E[C]&&e.report.reportError(64,`The checksum for ${f[C]} has been modified by this install, which is explicitly forbidden.`)}),await this.persistInstallStateFile();let h=!1;await e.report.startTimerPromise("Post-install validation",{skipIfEmpty:!0},async()=>{await this.configuration.triggerHook(E=>E.validateProjectAfterInstall,this,{reportWarning:(E,C)=>{e.report.r Line truncated
`,`# Manual changes might be lost - proceed with caution!
`].join("")}
`+nl(r)}async persistLockfile(){let e=J.join(this.cwd,Er.lockfile),r="";try{r=await ce.readFilePromise(e,"utf8")}catch{}let s=this.generateLockfile(),a=Ed(r,s);a!==r&&(await ce.writeFilePromise(e,a),this.lockFileChecksum=wde(a),this.lockfileNeedsRefresh=!1)}async persistInstallStateFile(){let e=[];for(let c of Object.values(KG))e.push(...c);let r=Kd(this,e),s=zG.default.serialize(r),a=us(s);if(this.installStateChecksum===a)return;let n=this.configuration.get("installStatePath");await ce.mkdirPromise(J.dirname(n),{recursive:!0}),await ce.writeFilePromise(n,await Aat(s)),this.installStateChecksum=a}async restoreInstallState({restoreLinkersCustomData:e=!0,restoreResolutions:r=!0,restoreBuildState:s=!0}={}){let a=this.configuration.get("installStatePath"),n;try{let c=await pat(await ce.readFilePromise(a));n=zG.default.deserialize(c),this.installStateChecksum=us(c)}catch{r&&await this.applyLightResolution();return}e&&typeof n.linkersCustomData<"u"&&(this.linkersCustomData=n.linkersCustomData),s&&Object.assign(this,Kd(n,KG.restoreBuildState)),r&&(n.lockFileChecksum===this.lockFileChecksum?Object.assign(this,Kd(n,KG.restoreResolutions)):await this.applyLightResolution())}async applyLightResolution(){await this.resolveEverything({lockfileOnly:!0,report:new ki}),await this.persistInstallStateFile()}async persist(){let e=(0,qR.default)(4);await Promise.all([this.persistLockfile(),...this.workspaces.map(r=>e(()=>r.persistManifest()))])}async cacheCleanup({cache:e,report:r}){if(this.configuration.get("enableGlobalCache"))return null;let s=new Set([".gitignore"]);if(!q8(e.cwd,this.cwd)||!await ce.existsPromise(e.cwd))return null;let a=[];for(let c of await ce.readdirPromise(e.cwd)){if(s.has(c))continue;let f=J.resolve(e.cwd,c);e.markedFiles.has(f)||(e.immutable?r.reportError(56,`${Ht(this.configuration,J.basename(f),"magenta")} appears to be unused and would be marked for deletion, but the cache is immutable`):a.push(ce.lstatPromise(f).then(async p=>(await ce.removePromise(f),p.size))))}if(a.length===0)return null;let n=await Promise.all(a);return{count:a.length,size:n.reduce((c,f)=>c+f,0)}}}});function mat(t){let s=Math.floor(t.timeNow/864e5),a=t.updateInterval*864e5,n=t.state.lastUpdate??t.timeNow+a+Math.floor(a*t.randomInitialInterval),c=n+a,f=t.state.lastTips??s*864e5,p=f+864e5+8*36e5-t.timeZone,h=c<=t.timeNow,E=p<=t.timeNow,C=null;return(h||E||!t.state.lastUpdate||!t.state.lastTips)&&(C={},C.lastUpdate=h?t.timeNow:n,C.lastTips=f,C.blocks=h?{}:t.state.blocks,C.displayedTips=t.state.displayedTips),{nextState:C,triggerUpdate:h,triggerTips:E,nextTips:E?s*864e5:f}}var ZI,Sde=Xe(()=>{Dt();yv();I0();pT();Pc();Rp();ZI=class{constructor(e,r){this.values=new Map;this.hits=new Map;this.enumerators=new Map;this.nextTips=0;this.displayedTips=[];this.shouldCommitTips=!1;this.configuration=e;let s=this.getRegistryPath();this.isNew=!ce.existsSync(s),this.shouldShowTips=!1,this.sendReport(r),this.startBuffer()}commitTips(){this.shouldShowTips&&(this.shouldCommitTips=!0)}selectTip(e){let r=new Set(this.displayedTips),s=f=>f&&fn?Zf(fn,f):!1,a=e.map((f,p)=>p).filter(f=>e[f]&&s(e[f]?.selector));if(a.length===0)return null;let n=a.filter(f=>!r.has(f));if(n.length===0){let f=Math.floor(a.length*.2);this.displayedTips=f>0?this.displayedTips.slice(-f):[],n=a.filter(p=>!r.has(p))}let c=n[Math.floor(Math.random()*n.length)];return this.displayedTips.push(c),this.commitTips(),e[c]}reportVersion(e){this.reportValue("version",e.replace(/-git\..*/,"-git"))}reportCommandName(e){this.reportValue("commandName",e||"<none>")}reportPluginName(e){this.reportValue("pluginName",e)}reportProject(e){this.reportEnumerator("projectCount",e)}reportInstall(e){this.reportHit("installCount",e)}reportPackageExtension(e){this.reportValue("packageExtension",e)}reportWorkspaceCount(e){this.reportValue("workspaceCount",String(e))}reportDependencyCount(e){this.reportValue("dependencyCount",String(e))}reportValue(e,r){bp(this.values,e).add(r)}reportEnumerator(e,r){bp(this.enumerators,e).add(us(r))}reportHit(e,r="*"){let s=q4(this.hits,e),a=Yl(s,r,()=>0);s.set(r,a+1)}getRegistryPath(){let e=this.configuration.get("globalFolder");return J.join(e,"telemetry.json")}sendReport(e){let r=this.getRegistryPath(),s;try{s=ce.readJsonSync(r)}catch{s={}}let{nextState:a,triggerUpdate:n,triggerTips:c,nextTips:f}=mat({state:s,timeNow:Date.now(),timeZone:new Date().getTimezoneOffset()*60*1e3,randomInitialInterval:Math.random(),updateInterval:this.configuration.get("telemetryInterval")});if(this.nextTips=f,this.displayedTips=s.displayedTips??[],a!==null)try{ce.mkdirSync(J.dirname(r),{recursive:!0}),ce.writeJsonSync(r,a)}catch{return!1}if(c&&this.configuration.get("enableTips")&&(this.shouldShowTips=!0),n){let p=s.blocks??{};if(Object.keys(p).length===0){let h=`https://browser-http-intake.logs.datadoghq.eu/v1/input/${e}?ddsource=yarn`,E=C=>cj(h,C,{configuration:this.configuration}).catch(()=>{});for(let[C,S]of Object.entries(s.blocks??{})){if(Object.keys(S).length===0)continue;let P=S;P Line truncated
`),h=c.length;for(h>0&&c.includes("unstyle")&&(c=[...new Set(["unstyle",...c])].reverse());h-- >0;)f=r(t.styles[c[h]],f,p);return f},a=(n,c,f)=>{t.styles[n]=e({name:n,codes:c}),(t.keys[f]||(t.keys[f]=[])).push(n),Reflect.defineProperty(t,n,{configurable:!0,enumerable:!0,set(h){t.alias(n,h)},get(){let h=E=>s(E,h.stack);return Reflect.setPrototypeOf(h,t),h.stack=this.stack?this.stack.concat(n):[n],h}})};return a("reset",[0,0],"modifier"),a("bold",[1,22],"modifier"),a("dim",[2,22],"modifier"),a("italic",[3,23],"modifier"),a("underline",[4,24],"modifier"),a("inverse",[7,27],"modifier"),a("hidden",[8,28],"modifier"),a("strikethrough",[9,29],"modifier"),a("black",[30,39],"color"),a("red",[31,39],"color"),a("green",[32,39],"color"),a("yellow",[33,39],"color"),a("blue",[34,39],"color"),a("magenta",[35,39],"color"),a("cyan",[36,39],"color"),a("white",[37,39],"color"),a("gray",[90,39],"color"),a("grey",[90,39],"color"),a("bgBlack",[40,49],"bg"),a("bgRed",[41,49],"bg"),a("bgGreen",[42,49],"bg"),a("bgYellow",[43,49],"bg"),a("bgBlue",[44,49],"bg"),a("bgMagenta",[45,49],"bg"),a("bgCyan",[46,49],"bg"),a("bgWhite",[47,49],"bg"),a("blackBright",[90,39],"bright"),a("redBright",[91,39],"bright"),a("greenBright",[92,39],"bright"),a("yellowBright",[93,39],"bright"),a("blueBright",[94,39],"bright"),a("magentaBright",[95,39],"bright"),a("cyanBright",[96,39],"bright"),a("whiteBright",[97,39],"bright"),a("bgBlackBright",[100,49],"bgBright"),a("bgRedBright",[101,49],"bgBright"),a("bgGreenBright",[102,49],"bgBright"),a("bgYellowBright",[103,49],"bgBright"),a("bgBlueBright",[104,49],"bgBright"),a("bgMagentaBright",[105,49],"bgBright"),a("bgCyanBright",[106,49],"bgBright"),a("bgWhiteBright",[107,49],"bgBright"),t.ansiRegex=wat,t.hasColor=t.hasAnsi=n=>(t.ansiRegex.lastIndex=0,typeof n=="string"&&n!==""&&t.ansiRegex.test(n)),t.alias=(n,c)=>{let f=typeof c=="string"?t[c]:c;if(typeof f!="function")throw new TypeError("Expected alias to be the name of an existing color (string) or a function");f.stack||(Reflect.defineProperty(f,"name",{value:n}),t.styles[n]=f,f.stack=[n]),Reflect.defineProperty(t,n,{configurable:!0,enumerable:!0,set(p){t.alias(n,p)},get(){let p=h=>s(h,p.stack);return Reflect.setPrototypeOf(p,t),p.stack=this.stack?this.stack.concat(f.stack):f.stack,p}})},t.theme=n=>{if(!Cat(n))throw new TypeError("Expected theme to be an object");for(let c of Object.keys(n))t.alias(c,n[c]);return t},t.alias("unstyle",n=>typeof n=="string"&&n!==""?(t.ansiRegex.lastIndex=0,n.replace(t.ansiRegex,"")):""),t.alias("noop",n=>n),t.none=t.clear=t.noop,t.stripColor=t.unstyle,t.symbols=Qde(),t.define=a,t};e5.exports=Tde();e5.exports.create=Tde});var Zo=_(pn=>{"use strict";var Bat=Object.prototype.toString,jc=Ju(),Rde=!1,t5=[],Fde={yellow:"blue",cyan:"red",green:"magenta",black:"white",blue:"yellow",red:"cyan",magenta:"green",white:"black"};pn.longest=(t,e)=>t.reduce((r,s)=>Math.max(r,e?s[e].length:s.length),0);pn.hasColor=t=>!!t&&jc.hasColor(t);var JR=pn.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);pn.nativeType=t=>Bat.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"");pn.isAsyncFn=t=>pn.nativeType(t)==="asyncfunction";pn.isPrimitive=t=>t!=null&&typeof t!="object"&&typeof t!="function";pn.resolve=(t,e,...r)=>typeof e=="function"?e.call(t,...r):e;pn.scrollDown=(t=[])=>[...t.slice(1),t[0]];pn.scrollUp=(t=[])=>[t.pop(),...t];pn.reorder=(t=[])=>{let e=t.slice();return e.sort((r,s)=>r.index>s.index?1:r.index<s.index?-1:0),e};pn.swap=(t,e,r)=>{let s=t.length,a=r===s?0:r<0?s-1:r,n=t[e];t[e]=t[a],t[a]=n};pn.width=(t,e=80)=>{let r=t&&t.columns?t.columns:e;return t&&typeof t.getWindowSize=="function"&&(r=t.getWindowSize()[0]),process.platform==="win32"?r-1:r};pn.height=(t,e=20)=>{let r=t&&t.rows?t.rows:e;return t&&typeof t.getWindowSize=="function"&&(r=t.getWindowSize()[1]),r};pn.wordWrap=(t,e={})=>{if(!t)return t;typeof e=="number"&&(e={width:e});let{indent:r="",newline:s=`
`+r,width:a=80}=e,n=(s+r).match(/[^\S\n]/g)||[];a-=n.length;let c=`.{1,${a}}([\\s\\u200B]+|$)|[^\\s\\u200B]+?([\\s\\u200B]+|$)`,f=t.trim(),p=new RegExp(c,"g"),h=f.match(p)||[];return h=h.map(E=>E.replace(/\n$/,"")),e.padEnd&&(h=h.map(E=>E.padEnd(a," "))),e.padStart&&(h=h.map(E=>E.padStart(a," "))),r+h.join(s)};pn.unmute=t=>{let e=t.stack.find(s=>jc.keys.color.includes(s));return e?jc[e]:t.stack.find(s=>s.slice(2)==="bg")?jc[e.slice(2)]:s=>s};pn.pascal=t=>t?t[0].toUpperCase()+t.slice(1):"";pn.inverse=t=>{if(!t||!t.stack)return t;let e=t.stack.find(s=>jc.keys.color.includes(s));if(e){let s=jc["bg"+pn.pascal(e)];return s?s.black:t}let r=t.stack.find(s=>s.slice(0,2)==="bg");return r?jc[r.slice(2).toLowerCase()]||t:jc.none};pn.complement=t=>{if(!t||!t.stack)return t;let e=t.stack.find(s=>jc.keys.color.includes(s)),r=t.stack.find(s=>s.slice(0,2)==="bg");if(e&&!r)return jc[Fde[e]||e];if(r){let s=r.slice(2).toLowerCase(),a=Fde[s];return a&&jc["bg"+pn.pascal(a)]||t}return jc.none};pn.meridiem=t=>{let e=t.getHours(),r=t.getMinutes(),s=e>=12?"pm":"am";e=e%12;let a=e===0?12:e,n=r<10?"0"+r:r;return a+":"+n+" "+s};pn.set=(t={},e="",r)=>e.split(".").reduce((s,a,n,c)=>{let f=c.length-1>n?s[a]||{}:r;return!pn.isObject(f)&&n<c.length-1&&(f={}),s[a]=f},t);pn.get=(t={},e="",r)=>{let s=t[e]==null?e.split(".").reduce((a,n)=>a&&a[n],t):t[e];return s??r};pn.mixin=(t,e)=>{if(!JR(t))return e;if(!JR(e))return t;for(let r of Object.keys(e)){let s=Object.getOwnPropertyDescriptor(e,r);if(s.hasOwnProperty("value"))if(t.hasOwnProperty(r)&&JR(s.value)){let a=Object.getOwnPropertyDescriptor(t,r);JR(a.value)?t[r]=pn.merge({},t[r],e[r]):Reflect.defineProperty(t,r,s)}else Reflect.defineProperty(t,r,s);else Reflect.defineProperty(t,r,s)}return t};pn.merge=(...t)=>{let e={};for(let r of t)pn.mixin(e,r);return e};pn.mixinEmitter=(t,e)=>{let r=e.constructor.prototype;for(let s of Object.keys(r)){let a=r[s];typeof a=="function"?pn.define(t,s,a.bind(e)):pn.define(t,s,a)}};pn.onExit=t=>{let e=(r,s)=>{Rde||(Rde=!0,t5.forEach(a=>a()),r===!0&&process.exit(128+s))};t5.length===0&&(process.once("SIGTERM",e.bind(null,!0,15)),process.once("SIGINT",e.bind(null,!0,2)),process.once("exit",e)),t5.push(t)};pn.define=(t,e,r)=>{Reflect.defineProperty(t,e,{value:r})};pn.defineExport=(t,e,r)=>{let s;Reflect.defineProperty(t,e,{enumerable:!0,configurable:!0,set(a){s=a},get(){return s?s():r()}})}});var Nde=_(rC=>{"use strict";rC.ctrl={a:"first",b:"backward",c:"cancel",d:"deleteForward",e:"last",f:"forward",g:"reset",i:"tab",k:"cutForward",l:"reset",n:"newItem",m:"cancel",j:"submit",p:"search",r:"remove",s:"save",u:"undo",w:"cutLeft",x:"toggleCursor",v:"paste"};rC.shift={up:"shiftUp",down:"shiftDown",left:"shiftLeft",right:"shiftRight",tab:"prev"};rC.fn={up:"pageUp",down:"pageDown",left:"pageLeft",right:"pageRight",delete:"deleteForward"};rC.option={b:"backward",f:"forward",d:"cutRight",left:"cutLeft",up:"altUp",down:"altDown"};rC.keys={pageup:"pageUp",pagedown:"pageDown",home:"home",end:"end",cancel:"cancel",delete:"deleteForward",backspace:"delete",down:"down",enter:"submit",escape:"cancel",left:"left",space:"space",number:"number",return:"submit",right:"right",tab:"next",up:"up"}});var Mde=_((KHt,Lde)=>{"use strict";var Ode=Ie("readline"),vat=Nde(),Sat=/^(?:\x1b)([a-zA-Z0-9])$/,Dat=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,bat={OP:"f1",OQ:"f2",OR:"f3",OS:"f4","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"};function Pat(t){return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(t)}function xat(t){return["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(t)}var KR=(t="",e={})=>{let r,s={name:e.name,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:t,raw:t,...e};if(Buffer.isBuffer(t)?t[0]>127&&t[1]===void 0?(t[0]-=128,t="\x1B"+String(t)):t=String(t):t!==void 0&&typeof t!="string"?t=String(t):t||(t=s.sequence||""),s.sequence=s.sequence||t||s.name,t==="\r")s.raw=void 0,s.name="return";else if(t===`
`)s.name="enter";else if(t===" ")s.name="tab";else if(t==="\b"||t==="\x7F"||t==="\x1B\x7F"||t==="\x1B\b")s.name="backspace",s.meta=t.charAt(0)==="\x1B";else if(t==="\x1B"||t==="\x1B\x1B")s.name="escape",s.meta=t.length===2;else if(t===" "||t==="\x1B ")s.name="space",s.meta=t.length===2;else if(t<="")s.name=String.fromCharCode(t.charCodeAt(0)+97-1),s.ctrl=!0;else if(t.length===1&&t>="0"&&t<="9")s.name="number";else if(t.length===1&&t>="a"&&t<="z")s.name=t;else if(t.length===1&&t>="A"&&t<="Z")s.name=t.toLowerCase(),s.shift=!0;else if(r=Sat.exec(t))s.meta=!0,s.shift=/^[A-Z]$/.test(r[1]);else if(r=Dat.exec(t)){let a=[...t];a[0]==="\x1B"&&a[1]==="\x1B"&&(s.option=!0);let n=[r[1],r[2],r[4],r[6]].filter(Boolean).join(""),c=(r[3]||r[5]||1)-1;s.ctrl=!!(c&4),s.meta=!!(c&10),s.shift=!!(c&1),s.code=n,s.name=bat[n],s.shift=Pat(n)||s.shift,s.ctrl=xat(n)||s.ctrl}return s};KR.listen=(t={},e)=>{let{stdin:r}=t;if(!r||r!==process.stdin&&!r.isTTY)throw new Error("Invalid stream passed");let s=Ode.createInterface({terminal:!0,input:r});Ode.emitKeypressEvents(r,s);let a=(f,p)=>e(f,KR(f,p),s),n=r.isRaw;return r.isTTY&&r.setRawMode(!0),r.on("keypress",a),s.resume(),()=>{r.isTTY&&r.setRawMode(n),r.removeListener("keypress",a),s.pause(),s.close()}};KR.action=(t,e,r)=>{let s={...vat,...r};return e.ctrl?(e.action=s.ctrl[e.name],e):e.option&&s.option?(e.action=s.option[e.name],e):e.shift?(e.action=s.shift[e.name],e):(e.action=s.keys[e.name],e)};Lde.exports=KR});var _de=_((zHt,Ude)=>{"use strict";Ude.exports=t=>{t.timers=t.timers||{};let e=t.options.timers;if(e)for(let r of Object.keys(e)){let s=e[r];typeof s=="number"&&(s={interval:s}),kat(t,r,s)}};function kat(t,e,r={}){let s=t.timers[e]={name:e,start:Date.now(),ms:0,tick:0},a=r.interval||120;s.frames=r.frames||[],s.loading=!0;let n=setInterval(()=>{s.ms=Date.now()-s.start,s.tick++,t.render()},a);return s.stop=()=>{s.loading=!1,clearInterval(n)},Reflect.defineProperty(s,"interval",{value:n}),t.once("close",()=>s.stop()),s.stop}});var jde=_((XHt,Hde)=>{"use strict";var{define:Qat,width:Tat}=Zo(),r5=class{constructor(e){let r=e.options;Qat(this,"_prompt",e),this.type=e.type,this.name=e.name,this.message="",this.header="",this.footer="",this.error="",this.hint="",this.input="",this.cursor=0,this.index=0,this.lines=0,this.tick=0,this.prompt="",this.buffer="",this.width=Tat(r.stdout||process.stdout),Object.assign(this,r),this.name=this.name||this.message,this.message=this.message||this.name,this.symbols=e.symbols,this.styles=e.styles,this.required=new Set,this.cancelled=!1,this.submitted=!1}clone(){let e={...this};return e.status=this.status,e.buffer=Buffer.from(e.buffer),delete e.clone,e}set color(e){this._color=e}get color(){let e=this.prompt.styles;if(this.cancelled)return e.cancelled;if(this.submitted)return e.submitted;let r=this._color||e[this.status];return typeof r=="function"?r:e.pending}set loading(e){this._loading=e}get loading(){return typeof this._loading=="boolean"?this._loading:this.loadingChoices?"choices":!1}get status(){return this.cancelled?"cancelled":this.submitted?"submitted":"pending"}};Hde.exports=r5});var qde=_((ZHt,Gde)=>{"use strict";var n5=Zo(),ho=Ju(),i5={default:ho.noop,noop:ho.noop,set inverse(t){this._inverse=t},get inverse(){return this._inverse||n5.inverse(this.primary)},set complement(t){this._complement=t},get complement(){return this._complement||n5.complement(this.primary)},primary:ho.cyan,success:ho.green,danger:ho.magenta,strong:ho.bold,warning:ho.yellow,muted:ho.dim,disabled:ho.gray,dark:ho.dim.gray,underline:ho.underline,set info(t){this._info=t},get info(){return this._info||this.primary},set em(t){this._em=t},get em(){return this._em||this.primary.underline},set heading(t){this._heading=t},get heading(){return this._heading||this.muted.underline},set pending(t){this._pending=t},get pending(){return this._pending||this.primary},set submitted(t){this._submitted=t},get submitted(){return this._submitted||this.success},set cancelled(t){this._cancelled=t},get cancelled(){return this._cancelled||this.danger},set typing(t){this._typing=t},get typing(){return this._typing||this.dim},set placeholder(t){this._placeholder=t},get placeholder(){return this._placeholder||this.primary.dim},set highlight(t){this._highlight=t},get highlight(){return this._highlight||this.inverse}};i5.merge=(t={})=>{t.styles&&typeof t.styles.enabled=="boolean"&&(ho.enabled=t.styles.enabled),t.styles&&typeof t.styles.visible=="boolean"&&(ho.visible=t.styles.visible);let e=n5.merge({},i5,t.styles);delete e.merge;for(let r of Object.keys(ho))e.hasOwnProperty(r)||Reflect.defineProperty(e,r,{get:()=>ho[r]});for(let r of Object.keys(ho.styles))e.hasOwnProperty(r)||Reflect.defineProperty(e,r,{get:()=>ho[r]});return e};Gde.exports=i5});var Yde=_(($Ht,Wde)=>{"use strict";var s5=process.platform==="win32",zp=Ju(),Rat=Zo(),o5={...zp.symbols,upDownDoubleArrow:"\u21D5",upDownDoubleArrow2:"\u2B0D",upDownArrow:"\u2195",asterisk:"*",asterism:"\u2042",bulletWhite:"\u25E6",electricArrow:"\u2301", Line truncated
`),h=p[0],E=p[p.length-1],S=(s+(r?" "+r:"")).length,P=S<h.length?h.slice(S+1):"";return{header:c,prompt:h,after:P,rest:p.slice(1),last:E}}async submit(){this.state.submitted=!0,this.state.validating=!0,this.options.onSubmit&&await this.options.onSubmit.call(this,this.name,this.value,this);let e=this.state.error||await this.validate(this.value,this.state);if(e!==!0){let r=`
`+this.symbols.pointer+" ";typeof e=="string"?r+=e.trim():r+="Invalid input",this.state.error=`
`+this.styles.danger(r),this.state.submitted=!1,await this.render(),await this.alert(),this.state.validating=!1,this.state.error=void 0;return}this.state.validating=!1,await this.render(),await this.close(),this.value=await this.result(this.value),this.emit("submit",this.value)}async cancel(e){this.state.cancelled=this.state.submitted=!0,await this.render(),await this.close(),typeof this.options.onCancel=="function"&&await this.options.onCancel.call(this,this.name,this.value,this),this.emit("cancel",await this.error(e))}async close(){this.state.closed=!0;try{let e=this.sections(),r=Math.ceil(e.prompt.length/this.width);e.rest&&this.write(Bm.cursor.down(e.rest.length)),this.write(`
`.repeat(r))}catch{}this.emit("close")}start(){!this.stop&&this.options.show!==!1&&(this.stop=u5.listen(this,this.keypress.bind(this)),this.once("close",this.stop))}async skip(){return this.skipped=this.options.skip===!0,typeof this.options.skip=="function"&&(this.skipped=await this.options.skip.call(this,this.name,this.value)),this.skipped}async initialize(){let{format:e,options:r,result:s}=this;if(this.format=()=>e.call(this,this.value),this.result=()=>s.call(this,this.value),typeof r.initial=="function"&&(this.initial=await r.initial.call(this,this)),typeof r.onRun=="function"&&await r.onRun.call(this,this),typeof r.onSubmit=="function"){let a=r.onSubmit.bind(this),n=this.submit.bind(this);delete this.options.onSubmit,this.submit=async()=>(await a(this.name,this.value,this),n())}await this.start(),await this.render()}render(){throw new Error("expected prompt to have a custom render method")}run(){return new Promise(async(e,r)=>{if(this.once("submit",e),this.once("cancel",r),await this.skip())return this.render=()=>{},this.submit();await this.initialize(),this.emit("run")})}async element(e,r,s){let{options:a,state:n,symbols:c,timers:f}=this,p=f&&f[e];n.timer=p;let h=a[e]||n[e]||c[e],E=r&&r[e]!=null?r[e]:await h;if(E==="")return E;let C=await this.resolve(E,n,r,s);return!C&&r&&r[e]?this.resolve(h,n,r,s):C}async prefix(){let e=await this.element("prefix")||this.symbols,r=this.timers&&this.timers.prefix,s=this.state;return s.timer=r,pl.isObject(e)&&(e=e[s.status]||e.pending),pl.hasColor(e)?e:(this.styles[s.status]||this.styles.pending)(e)}async message(){let e=await this.element("message");return pl.hasColor(e)?e:this.styles.strong(e)}async separator(){let e=await this.element("separator")||this.symbols,r=this.timers&&this.timers.separator,s=this.state;s.timer=r;let a=e[s.status]||e.pending||s.separator,n=await this.resolve(a,s);return pl.isObject(n)&&(n=n[s.status]||n.pending),pl.hasColor(n)?n:this.styles.muted(n)}async pointer(e,r){let s=await this.element("pointer",e,r);if(typeof s=="string"&&pl.hasColor(s))return s;if(s){let a=this.styles,n=this.index===r,c=n?a.primary:h=>h,f=await this.resolve(s[n?"on":"off"]||s,this.state),p=pl.hasColor(f)?f:c(f);return n?p:" ".repeat(f.length)}}async indicator(e,r){let s=await this.element("indicator",e,r);if(typeof s=="string"&&pl.hasColor(s))return s;if(s){let a=this.styles,n=e.enabled===!0,c=n?a.success:a.dark,f=s[n?"on":"off"]||s;return pl.hasColor(f)?f:c(f)}return""}body(){return null}footer(){if(this.state.status==="pending")return this.element("footer")}header(){if(this.state.status==="pending")return this.element("header")}async hint(){if(this.state.status==="pending"&&!this.isValue(this.state.input)){let e=await this.element("hint");return pl.hasColor(e)?e:this.styles.muted(e)}}error(e){return this.state.submitted?"":e||this.state.error}format(e){return e}result(e){return e}validate(e){return this.options.required===!0?this.isValue(e):!0}isValue(e){return e!=null&&e!==""}resolve(e,...r){return pl.resolve(this,e,...r)}get base(){return t.prototype}get style(){return this.styles[this.state.status]}get height(){return this.options.rows||pl.height(this.stdout,25)}get width(){return this.options.columns||pl.width(this.stdout,80)}get size(){return{width:this.width,height:this.height}}set cursor(e){this.state.cursor=e}get cursor(){return this.state.cursor}set input(e){this.state.input=e}get input(){return this.state.input}set value(e){this.state.value=e}get value(){let{input:e,value:r}=this.state,s=[r,e].find(this.isValue.bind(this));return this.isValue(s)?s:this.initial}static get prompt(){return e=>new this(e).run()}};function jat(t){let e=a=>t[a]===void 0||typeof t[a]=="function",r=["actions","choices","initial","margin","roles","styles","symbols","theme","timers","value"],s=["body","footer","error","header","hint","indicator","message","prefix","separator","skip"];for(let a of Object.keys(t.options)){if(r.includes(a)||/^on[A-Z]/.test(a))continue;let n=t.options[a];typeof n=="function"&&e(a)?s.includes(a)||(t[a]=n.bind(t)):typeof t[a]!="function"&&(t[a]=n)}}function Gat(t){typeof t=="number"&&(t=[t,t,t,t]);let e=[].concat(t||[]),r=a=>a%2===0?`
`:" ",s=[];for(let a=0;a<4;a++){let n=r(a);e[a]?s.push(n.repeat(e[a])):s.push("")}return s}tme.exports=f5});var ime=_((rjt,nme)=>{"use strict";var qat=Zo(),rme={default(t,e){return e},checkbox(t,e){throw new Error("checkbox role is not implemented yet")},editable(t,e){throw new Error("editable role is not implemented yet")},expandable(t,e){throw new Error("expandable role is not implemented yet")},heading(t,e){return e.disabled="",e.indicator=[e.indicator," "].find(r=>r!=null),e.message=e.message||"",e},input(t,e){throw new Error("input role is not implemented yet")},option(t,e){return rme.default(t,e)},radio(t,e){throw new Error("radio role is not implemented yet")},separator(t,e){return e.disabled="",e.indicator=[e.indicator," "].find(r=>r!=null),e.message=e.message||t.symbols.line.repeat(5),e},spacer(t,e){return e}};nme.exports=(t,e={})=>{let r=qat.merge({},rme,e.roles);return r[t]||r.default}});var Wv=_((njt,ame)=>{"use strict";var Wat=Ju(),Yat=nC(),Vat=ime(),zR=Zo(),{reorder:A5,scrollUp:Jat,scrollDown:Kat,isObject:sme,swap:zat}=zR,p5=class extends Yat{constructor(e){super(e),this.cursorHide(),this.maxSelected=e.maxSelected||1/0,this.multiple=e.multiple||!1,this.initial=e.initial||0,this.delay=e.delay||0,this.longest=0,this.num=""}async initialize(){typeof this.options.initial=="function"&&(this.initial=await this.options.initial.call(this)),await this.reset(!0),await super.initialize()}async reset(){let{choices:e,initial:r,autofocus:s,suggest:a}=this.options;if(this.state._choices=[],this.state.choices=[],this.choices=await Promise.all(await this.toChoices(e)),this.choices.forEach(n=>n.enabled=!1),typeof a!="function"&&this.selectable.length===0)throw new Error("At least one choice must be selectable");sme(r)&&(r=Object.keys(r)),Array.isArray(r)?(s!=null&&(this.index=this.findIndex(s)),r.forEach(n=>this.enable(this.find(n))),await this.render()):(s!=null&&(r=s),typeof r=="string"&&(r=this.findIndex(r)),typeof r=="number"&&r>-1&&(this.index=Math.max(0,Math.min(r,this.choices.length)),this.enable(this.find(this.index)))),this.isDisabled(this.focused)&&await this.down()}async toChoices(e,r){this.state.loadingChoices=!0;let s=[],a=0,n=async(c,f)=>{typeof c=="function"&&(c=await c.call(this)),c instanceof Promise&&(c=await c);for(let p=0;p<c.length;p++){let h=c[p]=await this.toChoice(c[p],a++,f);s.push(h),h.choices&&await n(h.choices,h)}return s};return n(e,r).then(c=>(this.state.loadingChoices=!1,c))}async toChoice(e,r,s){if(typeof e=="function"&&(e=await e.call(this,this)),e instanceof Promise&&(e=await e),typeof e=="string"&&(e={name:e}),e.normalized)return e;e.normalized=!0;let a=e.value;if(e=Vat(e.role,this.options)(this,e),typeof e.disabled=="string"&&!e.hint&&(e.hint=e.disabled,e.disabled=!0),e.disabled===!0&&e.hint==null&&(e.hint="(disabled)"),e.index!=null)return e;e.name=e.name||e.key||e.title||e.value||e.message,e.message=e.message||e.name||"",e.value=[e.value,e.name].find(this.isValue.bind(this)),e.input="",e.index=r,e.cursor=0,zR.define(e,"parent",s),e.level=s?s.level+1:1,e.indent==null&&(e.indent=s?s.indent+" ":e.indent||""),e.path=s?s.path+"."+e.name:e.name,e.enabled=!!(this.multiple&&!this.isDisabled(e)&&(e.enabled||this.isSelected(e))),this.isDisabled(e)||(this.longest=Math.max(this.longest,Wat.unstyle(e.message).length));let c={...e};return e.reset=(f=c.input,p=c.value)=>{for(let h of Object.keys(c))e[h]=c[h];e.input=f,e.value=p},a==null&&typeof e.initial=="function"&&(e.input=await e.initial.call(this,this.state,e,r)),e}async onChoice(e,r){this.emit("choice",e,r,this),typeof e.onChoice=="function"&&await e.onChoice.call(this,this.state,e,r)}async addChoice(e,r,s){let a=await this.toChoice(e,r,s);return this.choices.push(a),this.index=this.choices.length-1,this.limit=this.choices.length,a}async newItem(e,r,s){let a={name:"New choice name?",editable:!0,newChoice:!0,...e},n=await this.addChoice(a,r,s);return n.updateChoice=()=>{delete n.newChoice,n.name=n.message=n.input,n.input="",n.cursor=0},this.render()}indent(e){return e.indent==null?e.level>1?" ".repeat(e.level-1):"":e.indent}dispatch(e,r){if(this.multiple&&this[r.name])return this[r.name]();this.alert()}focus(e,r){return typeof r!="boolean"&&(r=e.enabled),r&&!e.enabled&&this.selected.length>=this.maxSelected?this.alert():(this.index=e.index,e.enabled=r&&!this.isDisabled(e),e)}space(){return this.multiple?(this.toggle(this.focused),this.render()):this.alert()}a(){if(this.maxSelected<this.choices.length)return this.alert();let e=this.selectable.every(r=>r.enabled);return this.choices.forEach(r=>r.enabled=!e),this.render()}i(){return this.choices.length-this.selected.length>this.maxSelected?this.alert():(this.choices.forEach(e=>e.enabled=!e.enabled),this.render())}g(e=this.focused){return this.choices.some(r=>!!r.parent)?(this.toggle(e.parent&&!e.choices?e.parent:e),this.render()):this.a()}toggle(e,r){if(!e.enabled&&this.selected.length>=this.maxSelected)return this.alert();typeof r!="boolean"&&(r=!e.enabled),e.enabled=r,e.choices&&e. Line truncated
`),a;return this.options.choicesHeader&&(a=await this.resolve(this.options.choicesHeader,this.state)),[a,s].filter(Boolean).join(`
`)}format(){return!this.state.submitted||this.state.cancelled?"":Array.isArray(this.selected)?this.selected.map(e=>this.styles.primary(e.name)).join(", "):this.styles.primary(this.selected.name)}async render(){let{submitted:e,size:r}=this.state,s="",a=await this.header(),n=await this.prefix(),c=await this.separator(),f=await this.message();this.options.promptLine!==!1&&(s=[n,f,c,""].join(" "),this.state.prompt=s);let p=await this.format(),h=await this.error()||await this.hint(),E=await this.renderChoices(),C=await this.footer();p&&(s+=p),h&&!s.includes(h)&&(s+=" "+h),e&&!p&&!E.trim()&&this.multiple&&this.emptyError!=null&&(s+=this.styles.danger(this.emptyError)),this.clear(r),this.write([a,s,E,C].filter(Boolean).join(`
`)),this.write(this.margin[2]),this.restore()}};lme.exports=g5});var ume=_((sjt,cme)=>{"use strict";var Zat=G0(),$at=(t,e)=>{let r=t.toLowerCase();return s=>{let n=s.toLowerCase().indexOf(r),c=e(s.slice(n,n+r.length));return n>=0?s.slice(0,n)+c+s.slice(n+r.length):s}},d5=class extends Zat{constructor(e){super(e),this.cursorShow()}moveCursor(e){this.state.cursor+=e}dispatch(e){return this.append(e)}space(e){return this.options.multiple?super.space(e):this.append(e)}append(e){let{cursor:r,input:s}=this.state;return this.input=s.slice(0,r)+e+s.slice(r),this.moveCursor(1),this.complete()}delete(){let{cursor:e,input:r}=this.state;return r?(this.input=r.slice(0,e-1)+r.slice(e),this.moveCursor(-1),this.complete()):this.alert()}deleteForward(){let{cursor:e,input:r}=this.state;return r[e]===void 0?this.alert():(this.input=`${r}`.slice(0,e)+`${r}`.slice(e+1),this.complete())}number(e){return this.append(e)}async complete(){this.completing=!0,this.choices=await this.suggest(this.input,this.state._choices),this.state.limit=void 0,this.index=Math.min(Math.max(this.visible.length-1,0),this.index),await this.render(),this.completing=!1}suggest(e=this.input,r=this.state._choices){if(typeof this.options.suggest=="function")return this.options.suggest.call(this,e,r);let s=e.toLowerCase();return r.filter(a=>a.message.toLowerCase().includes(s))}pointer(){return""}format(){if(!this.focused)return this.input;if(this.options.multiple&&this.state.submitted)return this.selected.map(e=>this.styles.primary(e.message)).join(", ");if(this.state.submitted){let e=this.value=this.input=this.focused.value;return this.styles.primary(e)}return this.input}async render(){if(this.state.status!=="pending")return super.render();let e=this.options.highlight?this.options.highlight.bind(this):this.styles.placeholder,r=$at(this.input,e),s=this.choices;this.choices=s.map(a=>({...a,message:r(a.message)})),await super.render(),this.choices=s}submit(){return this.options.multiple&&(this.value=this.selected.map(e=>e.name)),super.submit()}};cme.exports=d5});var y5=_((ojt,fme)=>{"use strict";var m5=Zo();fme.exports=(t,e={})=>{t.cursorHide();let{input:r="",initial:s="",pos:a,showCursor:n=!0,color:c}=e,f=c||t.styles.placeholder,p=m5.inverse(t.styles.primary),h=R=>p(t.styles.black(R)),E=r,C=" ",S=h(C);if(t.blink&&t.blink.off===!0&&(h=R=>R,S=""),n&&a===0&&s===""&&r==="")return h(C);if(n&&a===0&&(r===s||r===""))return h(s[0])+f(s.slice(1));s=m5.isPrimitive(s)?`${s}`:"",r=m5.isPrimitive(r)?`${r}`:"";let P=s&&s.startsWith(r)&&s!==r,I=P?h(s[r.length]):S;if(a!==r.length&&n===!0&&(E=r.slice(0,a)+h(r[a])+r.slice(a+1),I=""),n===!1&&(I=""),P){let R=t.styles.unstyle(E+I);return E+I+f(s.slice(R.length))}return E+I}});var XR=_((ajt,Ame)=>{"use strict";var elt=Ju(),tlt=G0(),rlt=y5(),E5=class extends tlt{constructor(e){super({...e,multiple:!0}),this.type="form",this.initial=this.options.initial,this.align=[this.options.align,"right"].find(r=>r!=null),this.emptyError="",this.values={}}async reset(e){return await super.reset(),e===!0&&(this._index=this.index),this.index=this._index,this.values={},this.choices.forEach(r=>r.reset&&r.reset()),this.render()}dispatch(e){return!!e&&this.append(e)}append(e){let r=this.focused;if(!r)return this.alert();let{cursor:s,input:a}=r;return r.value=r.input=a.slice(0,s)+e+a.slice(s),r.cursor++,this.render()}delete(){let e=this.focused;if(!e||e.cursor<=0)return this.alert();let{cursor:r,input:s}=e;return e.value=e.input=s.slice(0,r-1)+s.slice(r),e.cursor--,this.render()}deleteForward(){let e=this.focused;if(!e)return this.alert();let{cursor:r,input:s}=e;if(s[r]===void 0)return this.alert();let a=`${s}`.slice(0,r)+`${s}`.slice(r+1);return e.value=e.input=a,this.render()}right(){let e=this.focused;return e?e.cursor>=e.input.length?this.alert():(e.cursor++,this.render()):this.alert()}left(){let e=this.focused;return e?e.cursor<=0?this.alert():(e.cursor--,this.render()):this.alert()}space(e,r){return this.dispatch(e,r)}number(e,r){return this.dispatch(e,r)}next(){let e=this.focused;if(!e)return this.alert();let{initial:r,input:s}=e;return r&&r.startsWith(s)&&s!==r?(e.value=e.input=r,e.cursor=e.value.length,this.render()):super.next()}prev(){let e=this.focused;return e?e.cursor===0?super.prev():(e.value=e.input="",e.cursor=0,this.render()):this.alert()}separator(){return""}format(e){return this.state.submitted?"":super.format(e)}pointer(){return""}indicator(e){return e.input?"\u29BF":"\u2299"}async choiceSeparator(e,r){let s=await this.resolve(e.separator,this.state,e,r)||":";return s?" "+this.styles.disabled(s):""}async renderChoice(e,r){await this.onChoice(e,r);let{state:s,styles:a}=this,{cursor:n,initial:c="",name:f,hint:p,input:h=""}=e,{muted:E,submitted:C,primary:S,danger:P}=a,I=p,R=this.index===r,N=e.validate||(()=>!0),U=await this.choiceSeparator(e,r),W=e.message;this.align==="right"&&(W=W.padStart(this.longest+1," ")),this.align==="left"&&(W=W.padEnd(this.longest+1," "));let ee=this.values[f]=h||c,ie=h?"success":"dark";await N.call(e,ee,thi Line truncated
`)),this.restore()}set value(e){super.value=e}get value(){return this.cast(super.value)}};yme.exports=C5});var Ime=_((fjt,Eme)=>{"use strict";var ult=ZR(),w5=class extends ult{constructor(e){super(e),this.default=this.options.default||(this.initial?"(Y/n)":"(y/N)")}};Eme.exports=w5});var wme=_((Ajt,Cme)=>{"use strict";var flt=G0(),Alt=XR(),iC=Alt.prototype,B5=class extends flt{constructor(e){super({...e,multiple:!0}),this.align=[this.options.align,"left"].find(r=>r!=null),this.emptyError="",this.values={}}dispatch(e,r){let s=this.focused,a=s.parent||{};return!s.editable&&!a.editable&&(e==="a"||e==="i")?super[e]():iC.dispatch.call(this,e,r)}append(e,r){return iC.append.call(this,e,r)}delete(e,r){return iC.delete.call(this,e,r)}space(e){return this.focused.editable?this.append(e):super.space()}number(e){return this.focused.editable?this.append(e):super.number(e)}next(){return this.focused.editable?iC.next.call(this):super.next()}prev(){return this.focused.editable?iC.prev.call(this):super.prev()}async indicator(e,r){let s=e.indicator||"",a=e.editable?s:super.indicator(e,r);return await this.resolve(a,this.state,e,r)||""}indent(e){return e.role==="heading"?"":e.editable?" ":" "}async renderChoice(e,r){return e.indent="",e.editable?iC.renderChoice.call(this,e,r):super.renderChoice(e,r)}error(){return""}footer(){return this.state.error}async validate(){let e=!0;for(let r of this.choices){if(typeof r.validate!="function"||r.role==="heading")continue;let s=r.parent?this.value[r.parent.name]:this.value;if(r.editable?s=r.value===r.name?r.initial||"":r.value:this.isDisabled(r)||(s=r.enabled===!0),e=await r.validate(s,this.state),e!==!0)break}return e!==!0&&(this.state.error=typeof e=="string"?e:"Invalid Input"),e}submit(){if(this.focused.newChoice===!0)return super.submit();if(this.choices.some(e=>e.newChoice))return this.alert();this.value={};for(let e of this.choices){let r=e.parent?this.value[e.parent.name]:this.value;if(e.role==="heading"){this.value[e.name]={};continue}e.editable?r[e.name]=e.value===e.name?e.initial||"":e.value:this.isDisabled(e)||(r[e.name]=e.enabled===!0)}return this.base.submit.call(this)}};Cme.exports=B5});var vm=_((pjt,Bme)=>{"use strict";var plt=nC(),hlt=y5(),{isPrimitive:glt}=Zo(),v5=class extends plt{constructor(e){super(e),this.initial=glt(this.initial)?String(this.initial):"",this.initial&&this.cursorHide(),this.state.prevCursor=0,this.state.clipboard=[]}async keypress(e,r={}){let s=this.state.prevKeypress;return this.state.prevKeypress=r,this.options.multiline===!0&&r.name==="return"&&(!s||s.name!=="return")?this.append(`
`,r):super.keypress(e,r)}moveCursor(e){this.cursor+=e}reset(){return this.input=this.value="",this.cursor=0,this.render()}dispatch(e,r){if(!e||r.ctrl||r.code)return this.alert();this.append(e)}append(e){let{cursor:r,input:s}=this.state;this.input=`${s}`.slice(0,r)+e+`${s}`.slice(r),this.moveCursor(String(e).length),this.render()}insert(e){this.append(e)}delete(){let{cursor:e,input:r}=this.state;if(e<=0)return this.alert();this.input=`${r}`.slice(0,e-1)+`${r}`.slice(e),this.moveCursor(-1),this.render()}deleteForward(){let{cursor:e,input:r}=this.state;if(r[e]===void 0)return this.alert();this.input=`${r}`.slice(0,e)+`${r}`.slice(e+1),this.render()}cutForward(){let e=this.cursor;if(this.input.length<=e)return this.alert();this.state.clipboard.push(this.input.slice(e)),this.input=this.input.slice(0,e),this.render()}cutLeft(){let e=this.cursor;if(e===0)return this.alert();let r=this.input.slice(0,e),s=this.input.slice(e),a=r.split(" ");this.state.clipboard.push(a.pop()),this.input=a.join(" "),this.cursor=this.input.length,this.input+=s,this.render()}paste(){if(!this.state.clipboard.length)return this.alert();this.insert(this.state.clipboard.pop()),this.render()}toggleCursor(){this.state.prevCursor?(this.cursor=this.state.prevCursor,this.state.prevCursor=0):(this.state.prevCursor=this.cursor,this.cursor=0),this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.input.length-1,this.render()}next(){let e=this.initial!=null?String(this.initial):"";if(!e||!e.startsWith(this.input))return this.alert();this.input=this.initial,this.cursor=this.initial.length,this.render()}prev(){if(!this.input)return this.alert();this.reset()}backward(){return this.left()}forward(){return this.right()}right(){return this.cursor>=this.input.length?this.alert():(this.moveCursor(1),this.render())}left(){return this.cursor<=0?this.alert():(this.moveCursor(-1),this.render())}isValue(e){return!!e}async format(e=this.value){let r=await this.resolve(this.initial,this.state);return this.state.submitted?this.styles.submitted(e||r):hlt(this,{input:e,initial:r,pos:this.cursor})}async render(){let e=this.state.size,r=await this.prefix(),s=await this.separator(),a=await this.message(),n=[r,a,s].filter(Boolean).join(" ");this.state.prompt=n;let c=await this.header(),f=await this.format(),p=await this.error()||await this.hint(),h=await this.footer();p&&!f.includes(p)&&(f+=" "+p),n+=" "+f,this.clear(e),this.write([c,n,h].filter(Boolean).join(`
`)),this.restore()}};Bme.exports=v5});var Sme=_((hjt,vme)=>{"use strict";var dlt=t=>t.filter((e,r)=>t.lastIndexOf(e)===r),$R=t=>dlt(t).filter(Boolean);vme.exports=(t,e={},r="")=>{let{past:s=[],present:a=""}=e,n,c;switch(t){case"prev":case"undo":return n=s.slice(0,s.length-1),c=s[s.length-1]||"",{past:$R([r,...n]),present:c};case"next":case"redo":return n=s.slice(1),c=s[0]||"",{past:$R([...n,r]),present:c};case"save":return{past:$R([...s,r]),present:""};case"remove":return c=$R(s.filter(f=>f!==r)),a="",c.length&&(a=c.pop()),{past:c,present:a};default:throw new Error(`Invalid action: "${t}"`)}}});var D5=_((gjt,bme)=>{"use strict";var mlt=vm(),Dme=Sme(),S5=class extends mlt{constructor(e){super(e);let r=this.options.history;if(r&&r.store){let s=r.values||this.initial;this.autosave=!!r.autosave,this.store=r.store,this.data=this.store.get("values")||{past:[],present:s},this.initial=this.data.present||this.data.past[this.data.past.length-1]}}completion(e){return this.store?(this.data=Dme(e,this.data,this.input),this.data.present?(this.input=this.data.present,this.cursor=this.input.length,this.render()):this.alert()):this.alert()}altUp(){return this.completion("prev")}altDown(){return this.completion("next")}prev(){return this.save(),super.prev()}save(){this.store&&(this.data=Dme("save",this.data,this.input),this.store.set("values",this.data))}submit(){return this.store&&this.autosave===!0&&this.save(),super.submit()}};bme.exports=S5});var xme=_((djt,Pme)=>{"use strict";var ylt=vm(),b5=class extends ylt{format(){return""}};Pme.exports=b5});var Qme=_((mjt,kme)=>{"use strict";var Elt=vm(),P5=class extends Elt{constructor(e={}){super(e),this.sep=this.options.separator||/, */,this.initial=e.initial||""}split(e=this.value){return e?String(e).split(this.sep):[]}format(){let e=this.state.submitted?this.styles.primary:r=>r;return this.list.map(e).join(", ")}async submit(e){let r=this.state.error||await this.validate(this.list,this.state);return r!==!0?(this.state.error=r,super.submit()):(this.value=this.list,super.submit())}get list(){return this.split()}};kme.exports=P5});var Rme=_((yjt,Tme)=>{"use strict";var Ilt=G0(),x5=class extends Ilt{constructor(e){super({...e,multiple:!0})}};Tme.exports=x5});var Q5=_((Ejt,Fme)=>{"use strict";var Clt=vm(),k5=class extends Clt{constructor(e={}){super({style:"number",...e}),this.min=this.isValue(e.min)?this.toNumber(e.min):-1/0,this.max=this.isValue(e.max)?this.toNumber(e.max):1/0,this.delay=e.delay!=null?e.delay:1e3,this.float=e.float!==!1,this.round=e.round===!0||e.float===!1,this.major=e.major||10,this.minor=e.minor||1,this.initial=e.initial!=null?e.initial:"",this.input=String(this.initial),this.cursor=this.input.length,this.cursorShow()}append(e){return!/[-+.]/.test(e)||e==="."&&this.input.includes(".")?this.alert("invalid number"):super.append(e)}number(e){return super.append(e)}next(){return this.input&&this.input!==this.initial?this.alert():this.isValue(this.initial)?(this.input=this.initial,this.cursor=String(this.initial).length,this.render()):this.alert()}up(e){let r=e||this.minor,s=this.toNumber(this.input);return s>this.max+r?this.alert():(this.input=`${s+r}`,this.render())}down(e){let r=e||this.minor,s=this.toNumber(this.input);return s<this.min-r?this.alert():(this.input=`${s-r}`,this.render())}shiftDown(){return this.down(this.major)}shiftUp(){return this.up(this.major)}format(e=this.input){return typeof this.options.format=="function"?this.options.format.call(this,e):this.styles.info(e)}toNumber(e=""){return this.float?+e:Math.round(+e)}isValue(e){return/^[-+]?[0-9]+((\.)|(\.[0-9]+))?$/.test(e)}submit(){let e=[this.input,this.initial].find(r=>this.isValue(r));return this.value=this.toNumber(e||0),super.submit()}};Fme.exports=k5});var Ome=_((Ijt,Nme)=>{Nme.exports=Q5()});var Mme=_((Cjt,Lme)=>{"use strict";var wlt=vm(),T5=class extends wlt{constructor(e){super(e),this.cursorShow()}format(e=this.input){return this.keypressed?(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(e.length)):""}};Lme.exports=T5});var Hme=_((wjt,_me)=>{"use strict";var Blt=Ju(),vlt=Wv(),Ume=Zo(),R5=class extends vlt{constructor(e={}){super(e),this.widths=[].concat(e.messageWidth||50),this.align=[].concat(e.align||"left"),this.linebreak=e.linebreak||!1,this.edgeLength=e.edgeLength||3,this.newline=e.newline||`
`;let r=e.startNumber||1;typeof this.scale=="number"&&(this.scaleKey=!1,this.scale=Array(this.scale).fill(0).map((s,a)=>({name:a+r})))}async reset(){return this.tableized=!1,await super.reset(),this.render()}tableize(){if(this.tableized===!0)return;this.tableized=!0;let e=0;for(let r of this.choices){e=Math.max(e,r.message.length),r.scaleIndex=r.initial||2,r.scale=[];for(let s=0;s<this.scale.length;s++)r.scale.push({index:s})}this.widths[0]=Math.min(this.widths[0],e+3)}async dispatch(e,r){if(this.multiple)return this[r.name]?await this[r.name](e,r):await super.dispatch(e,r);this.alert()}heading(e,r,s){return this.styles.strong(e)}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;return e.scaleIndex>=this.scale.length-1?this.alert():(e.scaleIndex++,this.render())}left(){let e=this.focused;return e.scaleIndex<=0?this.alert():(e.scaleIndex--,this.render())}indent(){return""}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.index)).join(", "):""}pointer(){return""}renderScaleKey(){return this.scaleKey===!1||this.state.submitted?"":["",...this.scale.map(s=>` ${s.name} - ${s.message}`)].map(s=>this.styles.muted(s)).join(`
`)}renderScaleHeading(e){let r=this.scale.map(p=>p.name);typeof this.options.renderScaleHeading=="function"&&(r=this.options.renderScaleHeading.call(this,e));let s=this.scaleLength-r.join("").length,a=Math.round(s/(r.length-1)),c=r.map(p=>this.styles.strong(p)).join(" ".repeat(a)),f=" ".repeat(this.widths[0]);return this.margin[3]+f+this.margin[1]+c}scaleIndicator(e,r,s){if(typeof this.options.scaleIndicator=="function")return this.options.scaleIndicator.call(this,e,r,s);let a=e.scaleIndex===r.index;return r.disabled?this.styles.hint(this.symbols.radio.disabled):a?this.styles.success(this.symbols.radio.on):this.symbols.radio.off}renderScale(e,r){let s=e.scale.map(n=>this.scaleIndicator(e,n,r)),a=this.term==="Hyper"?"":" ";return s.join(a+this.symbols.line.repeat(this.edgeLength))}async renderChoice(e,r){await this.onChoice(e,r);let s=this.index===r,a=await this.pointer(e,r),n=await e.hint;n&&!Ume.hasColor(n)&&(n=this.styles.muted(n));let c=I=>this.margin[3]+I.replace(/\s+$/,"").padEnd(this.widths[0]," "),f=this.newline,p=this.indent(e),h=await this.resolve(e.message,this.state,e,r),E=await this.renderScale(e,r),C=this.margin[1]+this.margin[3];this.scaleLength=Blt.unstyle(E).length,this.widths[0]=Math.min(this.widths[0],this.width-this.scaleLength-C.length);let P=Ume.wordWrap(h,{width:this.widths[0],newline:f}).split(`
`).map(I=>c(I)+this.margin[1]);return s&&(E=this.styles.info(E),P=P.map(I=>this.styles.info(I))),P[0]+=E,this.linebreak&&P.push(""),[p+a,P.join(`
`)].filter(Boolean)}async renderChoices(){if(this.state.submitted)return"";this.tableize();let e=this.visible.map(async(a,n)=>await this.renderChoice(a,n)),r=await Promise.all(e),s=await this.renderScaleHeading();return this.margin[0]+[s,...r.map(a=>a.join(" "))].join(`
`)}async render(){let{submitted:e,size:r}=this.state,s=await this.prefix(),a=await this.separator(),n=await this.message(),c="";this.options.promptLine!==!1&&(c=[s,n,a,""].join(" "),this.state.prompt=c);let f=await this.header(),p=await this.format(),h=await this.renderScaleKey(),E=await this.error()||await this.hint(),C=await this.renderChoices(),S=await this.footer(),P=this.emptyError;p&&(c+=p),E&&!c.includes(E)&&(c+=" "+E),e&&!p&&!C.trim()&&this.multiple&&P!=null&&(c+=this.styles.danger(P)),this.clear(r),this.write([f,c,h,C,S].filter(Boolean).join(`
`)),this.state.submitted||this.write(this.margin[2]),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIndex;return this.base.submit.call(this)}};_me.exports=R5});var qme=_((Bjt,Gme)=>{"use strict";var jme=Ju(),Slt=(t="")=>typeof t=="string"?t.replace(/^['"]|['"]$/g,""):"",N5=class{constructor(e){this.name=e.key,this.field=e.field||{},this.value=Slt(e.initial||this.field.initial||""),this.message=e.message||this.name,this.cursor=0,this.input="",this.lines=[]}},Dlt=async(t={},e={},r=s=>s)=>{let s=new Set,a=t.fields||[],n=t.template,c=[],f=[],p=[],h=1;typeof n=="function"&&(n=await n());let E=-1,C=()=>n[++E],S=()=>n[E+1],P=I=>{I.line=h,c.push(I)};for(P({type:"bos",value:""});E<n.length-1;){let I=C();if(/^[^\S\n ]$/.test(I)){P({type:"text",value:I});continue}if(I===`
`){P({type:"newline",value:I}),h++;continue}if(I==="\\"){I+=C(),P({type:"text",value:I});continue}if((I==="$"||I==="#"||I==="{")&&S()==="{"){let N=C();I+=N;let U={type:"template",open:I,inner:"",close:"",value:I},W;for(;W=C();){if(W==="}"){S()==="}"&&(W+=C()),U.value+=W,U.close=W;break}W===":"?(U.initial="",U.key=U.inner):U.initial!==void 0&&(U.initial+=W),U.value+=W,U.inner+=W}U.template=U.open+(U.initial||U.inner)+U.close,U.key=U.key||U.inner,e.hasOwnProperty(U.key)&&(U.initial=e[U.key]),U=r(U),P(U),p.push(U.key),s.add(U.key);let ee=f.find(ie=>ie.name===U.key);U.field=a.find(ie=>ie.name===U.key),ee||(ee=new N5(U),f.push(ee)),ee.lines.push(U.line-1);continue}let R=c[c.length-1];R.type==="text"&&R.line===h?R.value+=I:P({type:"text",value:I})}return P({type:"eos",value:""}),{input:n,tabstops:c,unique:s,keys:p,items:f}};Gme.exports=async t=>{let e=t.options,r=new Set(e.required===!0?[]:e.required||[]),s={...e.values,...e.initial},{tabstops:a,items:n,keys:c}=await Dlt(e,s),f=F5("result",t,e),p=F5("format",t,e),h=F5("validate",t,e,!0),E=t.isValue.bind(t);return async(C={},S=!1)=>{let P=0;C.required=r,C.items=n,C.keys=c,C.output="";let I=async(W,ee,ie,ue)=>{let le=await h(W,ee,ie,ue);return le===!1?"Invalid field "+ie.name:le};for(let W of a){let ee=W.value,ie=W.key;if(W.type!=="template"){ee&&(C.output+=ee);continue}if(W.type==="template"){let ue=n.find(Ce=>Ce.name===ie);e.required===!0&&C.required.add(ue.name);let le=[ue.input,C.values[ue.value],ue.value,ee].find(E),pe=(ue.field||{}).message||W.inner;if(S){let Ce=await I(C.values[ie],C,ue,P);if(Ce&&typeof Ce=="string"||Ce===!1){C.invalid.set(ie,Ce);continue}C.invalid.delete(ie);let g=await f(C.values[ie],C,ue,P);C.output+=jme.unstyle(g);continue}ue.placeholder=!1;let Be=ee;ee=await p(ee,C,ue,P),le!==ee?(C.values[ie]=le,ee=t.styles.typing(le),C.missing.delete(pe)):(C.values[ie]=void 0,le=`<${pe}>`,ee=t.styles.primary(le),ue.placeholder=!0,C.required.has(ie)&&C.missing.add(pe)),C.missing.has(pe)&&C.validating&&(ee=t.styles.warning(le)),C.invalid.has(ie)&&C.validating&&(ee=t.styles.danger(le)),P===C.index&&(Be!==ee?ee=t.styles.underline(ee):ee=t.styles.heading(jme.unstyle(ee))),P++}ee&&(C.output+=ee)}let R=C.output.split(`
`).map(W=>" "+W),N=n.length,U=0;for(let W of n)C.invalid.has(W.name)&&W.lines.forEach(ee=>{R[ee][0]===" "&&(R[ee]=C.styles.danger(C.symbols.bullet)+R[ee].slice(1))}),t.isValue(C.values[W.name])&&U++;return C.completed=(U/N*100).toFixed(0),C.output=R.join(`
`),C.output}};function F5(t,e,r,s){return(a,n,c,f)=>typeof c.field[t]=="function"?c.field[t].call(e,a,n,c,f):[s,a].find(p=>e.isValue(p))}});var Yme=_((vjt,Wme)=>{"use strict";var blt=Ju(),Plt=qme(),xlt=nC(),O5=class extends xlt{constructor(e){super(e),this.cursorHide(),this.reset(!0)}async initialize(){this.interpolate=await Plt(this),await super.initialize()}async reset(e){this.state.keys=[],this.state.invalid=new Map,this.state.missing=new Set,this.state.completed=0,this.state.values={},e!==!0&&(await this.initialize(),await this.render())}moveCursor(e){let r=this.getItem();this.cursor+=e,r.cursor+=e}dispatch(e,r){if(!r.code&&!r.ctrl&&e!=null&&this.getItem()){this.append(e,r);return}this.alert()}append(e,r){let s=this.getItem(),a=s.input.slice(0,this.cursor),n=s.input.slice(this.cursor);this.input=s.input=`${a}${e}${n}`,this.moveCursor(1),this.render()}delete(){let e=this.getItem();if(this.cursor<=0||!e.input)return this.alert();let r=e.input.slice(this.cursor),s=e.input.slice(0,this.cursor-1);this.input=e.input=`${s}${r}`,this.moveCursor(-1),this.render()}increment(e){return e>=this.state.keys.length-1?0:e+1}decrement(e){return e<=0?this.state.keys.length-1:e-1}first(){this.state.index=0,this.render()}last(){this.state.index=this.state.keys.length-1,this.render()}right(){if(this.cursor>=this.input.length)return this.alert();this.moveCursor(1),this.render()}left(){if(this.cursor<=0)return this.alert();this.moveCursor(-1),this.render()}prev(){this.state.index=this.decrement(this.state.index),this.getItem(),this.render()}next(){this.state.index=this.increment(this.state.index),this.getItem(),this.render()}up(){this.prev()}down(){this.next()}format(e){let r=this.state.completed<100?this.styles.warning:this.styles.success;return this.state.submitted===!0&&this.state.completed!==100&&(r=this.styles.danger),r(`${this.state.completed}% completed`)}async render(){let{index:e,keys:r=[],submitted:s,size:a}=this.state,n=[this.options.newline,`
`].find(W=>W!=null),c=await this.prefix(),f=await this.separator(),p=await this.message(),h=[c,p,f].filter(Boolean).join(" ");this.state.prompt=h;let E=await this.header(),C=await this.error()||"",S=await this.hint()||"",P=s?"":await this.interpolate(this.state),I=this.state.key=r[e]||"",R=await this.format(I),N=await this.footer();R&&(h+=" "+R),S&&!R&&this.state.completed===0&&(h+=" "+S),this.clear(a);let U=[E,h,P,N,C.trim()];this.write(U.filter(Boolean).join(n)),this.restore()}getItem(e){let{items:r,keys:s,index:a}=this.state,n=r.find(c=>c.name===s[a]);return n&&n.input!=null&&(this.input=n.input,this.cursor=n.cursor),n}async submit(){typeof this.interpolate!="function"&&await this.initialize(),await this.interpolate(this.state,!0);let{invalid:e,missing:r,output:s,values:a}=this.state;if(e.size){let f="";for(let[p,h]of e)f+=`Invalid ${p}: ${h}
`;return this.state.error=f,super.submit()}if(r.size)return this.state.error="Required: "+[...r.keys()].join(", "),super.submit();let c=blt.unstyle(s).split(`
`).map(f=>f.slice(1)).join(`
`);return this.value={values:a,result:c},super.submit()}};Wme.exports=O5});var Jme=_((Sjt,Vme)=>{"use strict";var klt="(Use <shift>+<up/down> to sort)",Qlt=G0(),L5=class extends Qlt{constructor(e){super({...e,reorder:!1,sort:!0,multiple:!0}),this.state.hint=[this.options.hint,klt].find(this.isValue.bind(this))}indicator(){return""}async renderChoice(e,r){let s=await super.renderChoice(e,r),a=this.symbols.identicalTo+" ",n=this.index===r&&this.sorting?this.styles.muted(a):" ";return this.options.drag===!1&&(n=""),this.options.numbered===!0?n+`${r+1} - `+s:n+s}get selected(){return this.choices}submit(){return this.value=this.choices.map(e=>e.value),super.submit()}};Vme.exports=L5});var zme=_((Djt,Kme)=>{"use strict";var Tlt=Wv(),M5=class extends Tlt{constructor(e={}){if(super(e),this.emptyError=e.emptyError||"No items were selected",this.term=process.env.TERM_PROGRAM,!this.options.header){let r=["","4 - Strongly Agree","3 - Agree","2 - Neutral","1 - Disagree","0 - Strongly Disagree",""];r=r.map(s=>this.styles.muted(s)),this.state.header=r.join(`
`)}}async toChoices(...e){if(this.createdScales)return!1;this.createdScales=!0;let r=await super.toChoices(...e);for(let s of r)s.scale=Rlt(5,this.options),s.scaleIdx=2;return r}dispatch(){this.alert()}space(){let e=this.focused,r=e.scale[e.scaleIdx],s=r.selected;return e.scale.forEach(a=>a.selected=!1),r.selected=!s,this.render()}indicator(){return""}pointer(){return""}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;return e.scaleIdx>=e.scale.length-1?this.alert():(e.scaleIdx++,this.render())}left(){let e=this.focused;return e.scaleIdx<=0?this.alert():(e.scaleIdx--,this.render())}indent(){return" "}async renderChoice(e,r){await this.onChoice(e,r);let s=this.index===r,a=this.term==="Hyper",n=a?9:8,c=a?"":" ",f=this.symbols.line.repeat(n),p=" ".repeat(n+(a?0:1)),h=ee=>(ee?this.styles.success("\u25C9"):"\u25EF")+c,E=r+1+".",C=s?this.styles.heading:this.styles.noop,S=await this.resolve(e.message,this.state,e,r),P=this.indent(e),I=P+e.scale.map((ee,ie)=>h(ie===e.scaleIdx)).join(f),R=ee=>ee===e.scaleIdx?C(ee):ee,N=P+e.scale.map((ee,ie)=>R(ie)).join(p),U=()=>[E,S].filter(Boolean).join(" "),W=()=>[U(),I,N," "].filter(Boolean).join(`
`);return s&&(I=this.styles.cyan(I),N=this.styles.cyan(N)),W()}async renderChoices(){if(this.state.submitted)return"";let e=this.visible.map(async(s,a)=>await this.renderChoice(s,a)),r=await Promise.all(e);return r.length||r.push(this.styles.danger("No matching choices")),r.join(`
`)}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.scaleIdx)).join(", "):""}async render(){let{submitted:e,size:r}=this.state,s=await this.prefix(),a=await this.separator(),n=await this.message(),c=[s,n,a].filter(Boolean).join(" ");this.state.prompt=c;let f=await this.header(),p=await this.format(),h=await this.error()||await this.hint(),E=await this.renderChoices(),C=await this.footer();(p||!h)&&(c+=" "+p),h&&!c.includes(h)&&(c+=" "+h),e&&!p&&!E&&this.multiple&&this.type!=="form"&&(c+=this.styles.danger(this.emptyError)),this.clear(r),this.write([c,f,E,C].filter(Boolean).join(`
`)),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIdx;return this.base.submit.call(this)}};function Rlt(t,e={}){if(Array.isArray(e.scale))return e.scale.map(s=>({...s}));let r=[];for(let s=1;s<t+1;s++)r.push({i:s,selected:!1});return r}Kme.exports=M5});var Zme=_((bjt,Xme)=>{Xme.exports=D5()});var eye=_((Pjt,$me)=>{"use strict";var Flt=ZR(),U5=class extends Flt{async initialize(){await super.initialize(),this.value=this.initial=!!this.options.initial,this.disabled=this.options.disabled||"no",this.enabled=this.options.enabled||"yes",await this.render()}reset(){this.value=this.initial,this.render()}delete(){this.alert()}toggle(){this.value=!this.value,this.render()}enable(){if(this.value===!0)return this.alert();this.value=!0,this.render()}disable(){if(this.value===!1)return this.alert();this.value=!1,this.render()}up(){this.toggle()}down(){this.toggle()}right(){this.toggle()}left(){this.toggle()}next(){this.toggle()}prev(){this.toggle()}dispatch(e="",r){switch(e.toLowerCase()){case" ":return this.toggle();case"1":case"y":case"t":return this.enable();case"0":case"n":case"f":return this.disable();default:return this.alert()}}format(){let e=s=>this.styles.primary.underline(s);return[this.value?this.disabled:e(this.disabled),this.value?e(this.enabled):this.enabled].join(this.styles.muted(" / "))}async render(){let{size:e}=this.state,r=await this.header(),s=await this.prefix(),a=await this.separator(),n=await this.message(),c=await this.format(),f=await this.error()||await this.hint(),p=await this.footer(),h=[s,n,a,c].join(" ");this.state.prompt=h,f&&!h.includes(f)&&(h+=" "+f),this.clear(e),this.write([r,h,p].filter(Boolean).join(`
`)),this.write(this.margin[2]),this.restore()}};$me.exports=U5});var rye=_((xjt,tye)=>{"use strict";var Nlt=G0(),_5=class extends Nlt{constructor(e){if(super(e),typeof this.options.correctChoice!="number"||this.options.correctChoice<0)throw new Error("Please specify the index of the correct answer from the list of choices")}async toChoices(e,r){let s=await super.toChoices(e,r);if(s.length<2)throw new Error("Please give at least two choices to the user");if(this.options.correctChoice>s.length)throw new Error("Please specify the index of the correct answer from the list of choices");return s}check(e){return e.index===this.options.correctChoice}async result(e){return{selectedAnswer:e,correctAnswer:this.options.choices[this.options.correctChoice].value,correct:await this.check(this.state)}}};tye.exports=_5});var iye=_(H5=>{"use strict";var nye=Zo(),ks=(t,e)=>{nye.defineExport(H5,t,e),nye.defineExport(H5,t.toLowerCase(),e)};ks("AutoComplete",()=>ume());ks("BasicAuth",()=>mme());ks("Confirm",()=>Ime());ks("Editable",()=>wme());ks("Form",()=>XR());ks("Input",()=>D5());ks("Invisible",()=>xme());ks("List",()=>Qme());ks("MultiSelect",()=>Rme());ks("Numeral",()=>Ome());ks("Password",()=>Mme());ks("Scale",()=>Hme());ks("Select",()=>G0());ks("Snippet",()=>Yme());ks("Sort",()=>Jme());ks("Survey",()=>zme());ks("Text",()=>Zme());ks("Toggle",()=>eye());ks("Quiz",()=>rye())});var oye=_((Qjt,sye)=>{sye.exports={ArrayPrompt:Wv(),AuthPrompt:I5(),BooleanPrompt:ZR(),NumberPrompt:Q5(),StringPrompt:vm()}});var Vv=_((Tjt,lye)=>{"use strict";var aye=Ie("assert"),G5=Ie("events"),q0=Zo(),zu=class extends G5{constructor(e,r){super(),this.options=q0.merge({},e),this.answers={...r}}register(e,r){if(q0.isObject(e)){for(let a of Object.keys(e))this.register(a,e[a]);return this}aye.equal(typeof r,"function","expected a function");let s=e.toLowerCase();return r.prototype instanceof this.Prompt?this.prompts[s]=r:this.prompts[s]=r(this.Prompt,this),this}async prompt(e=[]){for(let r of[].concat(e))try{typeof r=="function"&&(r=await r.call(this)),await this.ask(q0.merge({},this.options,r))}catch(s){return Promise.reject(s)}return this.answers}async ask(e){typeof e=="function"&&(e=await e.call(this));let r=q0.merge({},this.options,e),{type:s,name:a}=e,{set:n,get:c}=q0;if(typeof s=="function"&&(s=await s.call(this,e,this.answers)),!s)return this.answers[a];aye(this.prompts[s],`Prompt "${s}" is not registered`);let f=new this.prompts[s](r),p=c(this.answers,a);f.state.answers=this.answers,f.enquirer=this,a&&f.on("submit",E=>{this.emit("answer",a,E,f),n(this.answers,a,E)});let h=f.emit.bind(f);return f.emit=(...E)=>(this.emit.call(this,...E),h(...E)),this.emit("prompt",f,this),r.autofill&&p!=null?(f.value=f.input=p,r.autofill==="show"&&await f.submit()):p=f.value=await f.run(),p}use(e){return e.call(this,this),this}set Prompt(e){this._Prompt=e}get Prompt(){return this._Prompt||this.constructor.Prompt}get prompts(){return this.constructor.prompts}static set Prompt(e){this._Prompt=e}static get Prompt(){return this._Prompt||nC()}static get prompts(){return iye()}static get types(){return oye()}static get prompt(){let e=(r,...s)=>{let a=new this(...s),n=a.emit.bind(a);return a.emit=(...c)=>(e.emit(...c),n(...c)),a.prompt(r)};return q0.mixinEmitter(e,new G5),e}};q0.mixinEmitter(zu,new G5);var j5=zu.prompts;for(let t of Object.keys(j5)){let e=t.toLowerCase(),r=s=>new j5[t](s).run();zu.prompt[e]=r,zu[e]=r,zu[t]||Reflect.defineProperty(zu,t,{get:()=>j5[t]})}var Yv=t=>{q0.defineExport(zu,t,()=>zu.types[t])};Yv("ArrayPrompt");Yv("AuthPrompt");Yv("BooleanPrompt");Yv("NumberPrompt");Yv("StringPrompt");lye.exports=zu});var dye=_((tGt,qlt)=>{qlt.exports={name:"@yarnpkg/cli",version:"4.12.0",license:"BSD-2-Clause",main:"./sources/index.ts",exports:{".":"./sources/index.ts","./polyfills":"./sources/polyfills.ts","./package.json":"./package.json"},dependencies:{"@yarnpkg/core":"workspace:^","@yarnpkg/fslib":"workspace:^","@yarnpkg/libzip":"workspace:^","@yarnpkg/parsers":"workspace:^","@yarnpkg/plugin-catalog":"workspace:^","@yarnpkg/plugin-compat":"workspace:^","@yarnpkg/plugin-constraints":"workspace:^","@yarnpkg/plugin-dlx":"workspace:^","@yarnpkg/plugin-essentials":"workspace:^","@yarnpkg/plugin-exec":"workspace:^","@yarnpkg/plugin-file":"workspace:^","@yarnpkg/plugin-git":"workspace:^","@yarnpkg/plugin-github":"workspace:^","@yarnpkg/plugin-http":"workspace:^","@yarnpkg/plugin-init":"workspace:^","@yarnpkg/plugin-interactive-tools":"workspace:^","@yarnpkg/plugin-jsr":"workspace:^","@yarnpkg/plugin-link":"workspace:^","@yarnpkg/plugin-nm":"workspace:^","@yarnpkg/plugin-npm":"workspace:^","@yarnpkg/plugin-npm-cli":"workspace:^","@yarnpkg/plugin-pack":"workspace:^","@yarnpkg/plugin-patch":"workspace:^","@yarnpkg/plugin-pnp":"workspace:^","@yarnpkg/plugin-pnpm":"workspace:^","@yarnpkg/plugin-stage":"workspace:^","@yarnpkg/plugin-typescript":"workspace:^","@yarnpkg/plugin-version":"workspace:^","@yarnpkg/plugin-workspace-tools":"workspace:^","@yarnpkg/shell":"workspa Line truncated
${W} at ${ee}`:`
${W}`}).join("");h.push({text:`Conflict detected in constraint targeting ${he.pretty(t.configuration,P,he.Type.CODE)}; conflicting values are:${R}`,fixable:!1})}else{let[[R]]=I,N=va(S,P);if(JSON.stringify(N)===JSON.stringify(R))continue;if(!s){let U=typeof N>"u"?`Missing field ${he.pretty(t.configuration,P,he.Type.CODE)}; expected ${he.pretty(t.configuration,R,he.Type.INSPECT)}`:typeof R>"u"?`Extraneous field ${he.pretty(t.configuration,P,he.Type.CODE)} currently set to ${he.pretty(t.configuration,N,he.Type.INSPECT)}`:`Invalid field ${he.pretty(t.configuration,P,he.Type.CODE)}; expected ${he.pretty(t.configuration,R,he.Type.INSPECT)}, found ${he.pretty(t.configuration,N,he.Type.INSPECT)}`;h.push({text:U,fixable:!0});continue}typeof R>"u"?A0(S,P):Jd(S,P,R),E=!0}E&&a.set(C,S)}h.length>0&&n.set(C,h)}return{changedWorkspaces:a,remainingErrors:n}}function rEe(t,{configuration:e}){let r={children:[]};for(let[s,a]of t){let n=[];for(let f of a){let p=f.text.split(/\n/);f.fixable&&(p[0]=`${he.pretty(e,"\u2699","gray")} ${p[0]}`),n.push({value:he.tuple(he.Type.NO_HINT,p[0]),children:p.slice(1).map(h=>({value:he.tuple(he.Type.NO_HINT,h)}))})}let c={value:he.tuple(he.Type.LOCATOR,s.anchoredLocator),children:je.sortMap(n,f=>f.value[1])};r.children.push(c)}return r.children=je.sortMap(r.children,s=>s.value[1]),r}var WC,Uct,_ct,Hct,iS=Xe(()=>{Ge();ql();WC=class{constructor(e){this.indexedFields=e;this.items=[];this.indexes={};this.clear()}clear(){this.items=[];for(let e of this.indexedFields)this.indexes[e]=new Map}insert(e){this.items.push(e);for(let r of this.indexedFields){let s=Object.hasOwn(e,r)?e[r]:void 0;if(typeof s>"u")continue;je.getArrayWithDefault(this.indexes[r],s).push(e)}return e}find(e){if(typeof e>"u")return this.items;let r=Object.entries(e);if(r.length===0)return this.items;let s=[],a;for(let[c,f]of r){let p=c,h=Object.hasOwn(this.indexes,p)?this.indexes[p]:void 0;if(typeof h>"u"){s.push([p,f]);continue}let E=new Set(h.get(f)??[]);if(E.size===0)return[];if(typeof a>"u")a=E;else for(let C of a)E.has(C)||a.delete(C);if(a.size===0)break}let n=[...a??[]];return s.length>0&&(n=n.filter(c=>{for(let[f,p]of s)if(!(typeof p<"u"?Object.hasOwn(c,f)&&c[f]===p:Object.hasOwn(c,f)===!1))return!1;return!0})),n}},Uct=/^[0-9]+$/,_ct=/^[a-zA-Z0-9_]+$/,Hct=new Set(["scripts",...Ut.allDependencies])});var nEe=_((_Yt,vq)=>{var qct;(function(t){var e=function(){return{"append/2":[new t.type.Rule(new t.type.Term("append",[new t.type.Var("X"),new t.type.Var("L")]),new t.type.Term("foldl",[new t.type.Term("append",[]),new t.type.Var("X"),new t.type.Term("[]",[]),new t.type.Var("L")]))],"append/3":[new t.type.Rule(new t.type.Term("append",[new t.type.Term("[]",[]),new t.type.Var("X"),new t.type.Var("X")]),null),new t.type.Rule(new t.type.Term("append",[new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("S")])]),new t.type.Term("append",[new t.type.Var("T"),new t.type.Var("X"),new t.type.Var("S")]))],"member/2":[new t.type.Rule(new t.type.Term("member",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("_")])]),null),new t.type.Rule(new t.type.Term("member",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("_"),new t.type.Var("Xs")])]),new t.type.Term("member",[new t.type.Var("X"),new t.type.Var("Xs")]))],"permutation/2":[new t.type.Rule(new t.type.Term("permutation",[new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("permutation",[new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("permutation",[new t.type.Var("T"),new t.type.Var("P")]),new t.type.Term(",",[new t.type.Term("append",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("P")]),new t.type.Term("append",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("Y")]),new t.type.Var("S")])])]))],"maplist/2":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("X")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("Xs")])]))],"maplist/3":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs")])]))],"maplist/4":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Ter Line truncated
`+p:"")),c.error.method="_execFileSync",c.error.program=a,c.error.args=n,c.error.extMessage=p,c.error.exitCode=+f),si.unlinkSync(h),si.unlinkSync(E),si.unlinkSync(C),si.unlinkSync(S),c}function Jct(t){var e,r={},s,a={env:process.env,encoding:t.encoding};if(Y0||(bm?process.env.PSModulePath?(Y0="powershell.exe",oF=["-ExecutionPolicy","Bypass","-File",__dirname+"\\read.ps1"]):(Y0="cscript.exe",oF=["//nologo",__dirname+"\\read.cs.js"]):(Y0="/bin/sh",oF=[__dirname+"/read.sh"])),bm&&!process.env.PSModulePath&&(a.stdio=[process.stdin]),bq.execFileSync){e=lEe(t),sS&&sS("execFileSync",e);try{r.input=bq.execFileSync(Y0,e,a)}catch(n){s=n.stderr?(n.stderr+"").trim():"",r.error=new Error(oEe+(s?`
`+s:"")),r.error.method="execFileSync",r.error.program=Y0,r.error.args=e,r.error.extMessage=s,r.error.exitCode=n.status,r.error.code=n.code,r.error.signal=n.signal}}else r=Vct(t,a);return r.error||(r.input=r.input.replace(/^\s*'|'\s*$/g,""),t.display=""),r}function kq(t){var e="",r=t.display,s=!t.display&&t.keyIn&&t.hideEchoBack&&!t.mask;function a(){var n=Jct(t);if(n.error)throw n.error;return n.input}return xq&&xq(t),function(){var n,c,f;function p(){return n||(n=process.binding("fs"),c=process.binding("constants")),n}if(typeof Xp=="string")if(Xp=null,bm){if(f=function(h){var E=h.replace(/^\D+/,"").split("."),C=0;return(E[0]=+E[0])&&(C+=E[0]*1e4),(E[1]=+E[1])&&(C+=E[1]*100),(E[2]=+E[2])&&(C+=E[2]),C}(process.version),!(f>=20302&&f<40204||f>=5e4&&f<50100||f>=50600&&f<60200)&&process.stdin.isTTY)process.stdin.pause(),Xp=process.stdin.fd,VC=process.stdin._handle;else try{Xp=p().open("CONIN$",c.O_RDWR,parseInt("0666",8)),VC=new iEe(Xp,!0)}catch{}if(process.stdout.isTTY)Zu=process.stdout.fd;else{try{Zu=si.openSync("\\\\.\\CON","w")}catch{}if(typeof Zu!="number")try{Zu=p().open("CONOUT$",c.O_RDWR,parseInt("0666",8))}catch{}}}else{if(process.stdin.isTTY){process.stdin.pause();try{Xp=si.openSync("/dev/tty","r"),VC=process.stdin._handle}catch{}}else try{Xp=si.openSync("/dev/tty","r"),VC=new iEe(Xp,!1)}catch{}if(process.stdout.isTTY)Zu=process.stdout.fd;else try{Zu=si.openSync("/dev/tty","w")}catch{}}}(),function(){var n,c,f=!t.hideEchoBack&&!t.keyIn,p,h,E,C,S;aF="";function P(I){return I===sEe?!0:VC.setRawMode(I)!==0?!1:(sEe=I,!0)}if(aEe||!VC||typeof Zu!="number"&&(t.display||!f)){e=a();return}if(t.display&&(si.writeSync(Zu,t.display),t.display=""),!t.displayOnly){if(!P(!f)){e=a();return}for(h=t.keyIn?1:t.bufferSize,p=Buffer.allocUnsafe&&Buffer.alloc?Buffer.alloc(h):new Buffer(h),t.keyIn&&t.limit&&(c=new RegExp("[^"+t.limit+"]","g"+(t.caseSensitive?"":"i")));;){E=0;try{E=si.readSync(Xp,p,0,h)}catch(I){if(I.code!=="EOF"){P(!1),e+=a();return}}if(E>0?(C=p.toString(t.encoding,0,E),aF+=C):(C=`
`,aF+="\0"),C&&typeof(S=(C.match(/^(.*?)[\r\n]/)||[])[1])=="string"&&(C=S,n=!0),C&&(C=C.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,"")),C&&c&&(C=C.replace(c,"")),C&&(f||(t.hideEchoBack?t.mask&&si.writeSync(Zu,new Array(C.length+1).join(t.mask)):si.writeSync(Zu,C)),e+=C),!t.keyIn&&n||t.keyIn&&e.length>=h)break}!f&&!s&&si.writeSync(Zu,`
`),P(!1)}}(),t.print&&!s&&t.print(r+(t.displayOnly?"":(t.hideEchoBack?new Array(e.length+1).join(t.mask):e)+`
`),t.encoding),t.displayOnly?"":Rq=t.keepWhitespace||t.keyIn?e:e.trim()}function Kct(t,e){var r=[];function s(a){a!=null&&(Array.isArray(a)?a.forEach(s):(!e||e(a))&&r.push(a))}return s(t),r}function Fq(t){return t.replace(/[\x00-\x7f]/g,function(e){return"\\x"+("00"+e.charCodeAt().toString(16)).substr(-2)})}function Vs(){var t=Array.prototype.slice.call(arguments),e,r;return t.length&&typeof t[0]=="boolean"&&(r=t.shift(),r&&(e=Object.keys(Pq),t.unshift(Pq))),t.reduce(function(s,a){return a==null||(a.hasOwnProperty("noEchoBack")&&!a.hasOwnProperty("hideEchoBack")&&(a.hideEchoBack=a.noEchoBack,delete a.noEchoBack),a.hasOwnProperty("noTrim")&&!a.hasOwnProperty("keepWhitespace")&&(a.keepWhitespace=a.noTrim,delete a.noTrim),r||(e=Object.keys(a)),e.forEach(function(n){var c;if(a.hasOwnProperty(n))switch(c=a[n],n){case"mask":case"limitMessage":case"defaultInput":case"encoding":c=c!=null?c+"":"",c&&n!=="limitMessage"&&(c=c.replace(/[\r\n]/g,"")),s[n]=c;break;case"bufferSize":!isNaN(c=parseInt(c,10))&&typeof c=="number"&&(s[n]=c);break;case"displayOnly":case"keyIn":case"hideEchoBack":case"caseSensitive":case"keepWhitespace":case"history":case"cd":s[n]=!!c;break;case"limit":case"trueValue":case"falseValue":s[n]=Kct(c,function(f){var p=typeof f;return p==="string"||p==="number"||p==="function"||f instanceof RegExp}).map(function(f){return typeof f=="string"?f.replace(/[\r\n]/g,""):f});break;case"print":case"phContent":case"preCheck":s[n]=typeof c=="function"?c:void 0;break;case"prompt":case"display":s[n]=c??"";break}})),s},{})}function Qq(t,e,r){return e.some(function(s){var a=typeof s;return a==="string"?r?t===s:t.toLowerCase()===s.toLowerCase():a==="number"?parseFloat(t)===s:a==="function"?s(t):s instanceof RegExp?s.test(t):!1})}function Nq(t,e){var r=V0.normalize(bm?(process.env.HOMEDRIVE||"")+(process.env.HOMEPATH||""):process.env.HOME||"").replace(/[\/\\]+$/,"");return t=V0.normalize(t),e?t.replace(/^~(?=\/|\\|$)/,r):t.replace(new RegExp("^"+Fq(r)+"(?=\\/|\\\\|$)",bm?"i":""),"~")}function JC(t,e){var r="(?:\\(([\\s\\S]*?)\\))?(\\w+|.-.)(?:\\(([\\s\\S]*?)\\))?",s=new RegExp("(\\$)?(\\$<"+r+">)","g"),a=new RegExp("(\\$)?(\\$\\{"+r+"\\})","g");function n(c,f,p,h,E,C){var S;return f||typeof(S=e(E))!="string"?p:S?(h||"")+S+(C||""):""}return t.replace(s,n).replace(a,n)}function cEe(t,e,r){var s,a=[],n=-1,c=0,f="",p;function h(E,C){return C.length>3?(E.push(C[0]+"..."+C[C.length-1]),p=!0):C.length&&(E=E.concat(C)),E}return s=t.reduce(function(E,C){return E.concat((C+"").split(""))},[]).reduce(function(E,C){var S,P;return e||(C=C.toLowerCase()),S=/^\d$/.test(C)?1:/^[A-Z]$/.test(C)?2:/^[a-z]$/.test(C)?3:0,r&&S===0?f+=C:(P=C.charCodeAt(0),S&&S===n&&P===c+1?a.push(C):(E=h(E,a),a=[C],n=S),c=P),E},[]),s=h(s,a),f&&(s.push(f),p=!0),{values:s,suppressed:p}}function uEe(t,e){return t.join(t.length>2?", ":e?" / ":"/")}function fEe(t,e){var r,s,a={},n;if(e.phContent&&(r=e.phContent(t,e)),typeof r!="string")switch(t){case"hideEchoBack":case"mask":case"defaultInput":case"caseSensitive":case"keepWhitespace":case"encoding":case"bufferSize":case"history":case"cd":r=e.hasOwnProperty(t)?typeof e[t]=="boolean"?e[t]?"on":"off":e[t]+"":"";break;case"limit":case"trueValue":case"falseValue":s=e[e.hasOwnProperty(t+"Src")?t+"Src":t],e.keyIn?(a=cEe(s,e.caseSensitive),s=a.values):s=s.filter(function(c){var f=typeof c;return f==="string"||f==="number"}),r=uEe(s,a.suppressed);break;case"limitCount":case"limitCountNotZero":r=e[e.hasOwnProperty("limitSrc")?"limitSrc":"limit"].length,r=r||t!=="limitCountNotZero"?r+"":"";break;case"lastInput":r=Rq;break;case"cwd":case"CWD":case"cwdHome":r=process.cwd(),t==="CWD"?r=V0.basename(r):t==="cwdHome"&&(r=Nq(r));break;case"date":case"time":case"localeDate":case"localeTime":r=new Date()["to"+t.replace(/^./,function(c){return c.toUpperCase()})+"String"]();break;default:typeof(n=(t.match(/^history_m(\d+)$/)||[])[1])=="string"&&(r=Dm[Dm.length-n]||"")}return r}function AEe(t){var e=/^(.)-(.)$/.exec(t),r="",s,a,n,c;if(!e)return null;for(s=e[1].charCodeAt(0),a=e[2].charCodeAt(0),c=s<a?1:-1,n=s;n!==a+c;n+=c)r+=String.fromCharCode(n);return r}function Tq(t){var e=new RegExp(/(\s*)(?:("|')(.*?)(?:\2|$)|(\S+))/g),r,s="",a=[],n;for(t=t.trim();r=e.exec(t);)n=r[3]||r[4]||"",r[1]&&(a.push(s),s=""),s+=n;return s&&a.push(s),a}function pEe(t,e){return e.trueValue.length&&Qq(t,e.trueValue,e.caseSensitive)?!0:e.falseValue.length&&Qq(t,e.falseValue,e.caseSensitive)?!1:t}function hEe(t){var e,r,s,a,n,c,f;function p(E){return fEe(E,t)}function h(E){t.display+=(/[^\r\n]$/.test(t.display)?`
`:"")+E}for(t.limitSrc=t.limit,t.displaySrc=t.display,t.limit="",t.display=JC(t.display+"",p);;){if(e=kq(t),r=!1,s="",t.defaultInput&&!e&&(e=t.defaultInput),t.history&&((a=/^\s*\!(?:\!|-1)(:p)?\s*$/.exec(e))?(n=Dm[0]||"",a[1]?r=!0:e=n,h(n+`
`),r||(t.displayOnly=!0,kq(t),t.displayOnly=!1)):e&&e!==Dm[Dm.length-1]&&(Dm=[e])),!r&&t.cd&&e)switch(c=Tq(e),c[0].toLowerCase()){case"cd":if(c[1])try{process.chdir(Nq(c[1],!0))}catch(E){h(E+"")}r=!0;break;case"pwd":h(process.cwd()),r=!0;break}if(!r&&t.preCheck&&(f=t.preCheck(e,t),e=f.res,f.forceNext&&(r=!0)),!r){if(!t.limitSrc.length||Qq(e,t.limitSrc,t.caseSensitive))break;t.limitMessage&&(s=JC(t.limitMessage,p))}h((s?s+`
`:"")+JC(t.displaySrc+"",p))}return pEe(e,t)}$r._DBG_set_useExt=function(t){aEe=t};$r._DBG_set_checkOptions=function(t){xq=t};$r._DBG_set_checkMethod=function(t){sS=t};$r._DBG_clearHistory=function(){Rq="",Dm=[]};$r.setDefaultOptions=function(t){return Pq=Vs(!0,t),Vs(!0)};$r.question=function(t,e){return hEe(Vs(Vs(!0,e),{display:t}))};$r.prompt=function(t){var e=Vs(!0,t);return e.display=e.prompt,hEe(e)};$r.keyIn=function(t,e){var r=Vs(Vs(!0,e),{display:t,keyIn:!0,keepWhitespace:!0});return r.limitSrc=r.limit.filter(function(s){var a=typeof s;return a==="string"||a==="number"}).map(function(s){return JC(s+"",AEe)}),r.limit=Fq(r.limitSrc.join("")),["trueValue","falseValue"].forEach(function(s){r[s]=r[s].reduce(function(a,n){var c=typeof n;return c==="string"||c==="number"?a=a.concat((n+"").split("")):a.push(n),a},[])}),r.display=JC(r.display+"",function(s){return fEe(s,r)}),pEe(kq(r),r)};$r.questionEMail=function(t,e){return t==null&&(t="Input e-mail address: "),$r.question(t,Vs({hideEchoBack:!1,limit:/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,limitMessage:"Input valid e-mail address, please.",trueValue:null,falseValue:null},e,{keepWhitespace:!1,cd:!1}))};$r.questionNewPassword=function(t,e){var r,s,a,n=Vs({hideEchoBack:!0,mask:"*",limitMessage:`It can include: $<charlist>
And the length must be: $<length>`,trueValue:null,falseValue:null,caseSensitive:!0},e,{history:!1,cd:!1,phContent:function(P){return P==="charlist"?r.text:P==="length"?s+"..."+a:null}}),c,f,p,h,E,C,S;for(e=e||{},c=JC(e.charlist?e.charlist+"":"$<!-~>",AEe),(isNaN(s=parseInt(e.min,10))||typeof s!="number")&&(s=12),(isNaN(a=parseInt(e.max,10))||typeof a!="number")&&(a=24),h=new RegExp("^["+Fq(c)+"]{"+s+","+a+"}$"),r=cEe([c],n.caseSensitive,!0),r.text=uEe(r.values,r.suppressed),f=e.confirmMessage!=null?e.confirmMessage:"Reinput a same one to confirm it: ",p=e.unmatchMessage!=null?e.unmatchMessage:"It differs from first one. Hit only the Enter key if you want to retry from first one.",t==null&&(t="Input new password: "),E=n.limitMessage;!S;)n.limit=h,n.limitMessage=E,C=$r.question(t,n),n.limit=[C,""],n.limitMessage=p,S=$r.question(f,n);return C};function gEe(t,e,r){var s;function a(n){return s=r(n),!isNaN(s)&&typeof s=="number"}return $r.question(t,Vs({limitMessage:"Input valid number, please."},e,{limit:a,cd:!1})),s}$r.questionInt=function(t,e){return gEe(t,e,function(r){return parseInt(r,10)})};$r.questionFloat=function(t,e){return gEe(t,e,parseFloat)};$r.questionPath=function(t,e){var r,s="",a=Vs({hideEchoBack:!1,limitMessage:`$<error(
)>Input valid path, please.$<( Min:)min>$<( Max:)max>`,history:!0,cd:!0},e,{keepWhitespace:!1,limit:function(n){var c,f,p;n=Nq(n,!0),s="";function h(E){E.split(/\/|\\/).reduce(function(C,S){var P=V0.resolve(C+=S+V0.sep);if(!si.existsSync(P))si.mkdirSync(P);else if(!si.statSync(P).isDirectory())throw new Error("Non directory already exists: "+P);return C},"")}try{if(c=si.existsSync(n),r=c?si.realpathSync(n):V0.resolve(n),!e.hasOwnProperty("exists")&&!c||typeof e.exists=="boolean"&&e.exists!==c)return s=(c?"Already exists":"No such file or directory")+": "+r,!1;if(!c&&e.create&&(e.isDirectory?h(r):(h(V0.dirname(r)),si.closeSync(si.openSync(r,"w"))),r=si.realpathSync(r)),c&&(e.min||e.max||e.isFile||e.isDirectory)){if(f=si.statSync(r),e.isFile&&!f.isFile())return s="Not file: "+r,!1;if(e.isDirectory&&!f.isDirectory())return s="Not directory: "+r,!1;if(e.min&&f.size<+e.min||e.max&&f.size>+e.max)return s="Size "+f.size+" is out of range: "+r,!1}if(typeof e.validate=="function"&&(p=e.validate(r))!==!0)return typeof p=="string"&&(s=p),!1}catch(E){return s=E+"",!1}return!0},phContent:function(n){return n==="error"?s:n!=="min"&&n!=="max"?null:e.hasOwnProperty(n)?e[n]+"":""}});return e=e||{},t==null&&(t='Input path (you can "cd" and "pwd"): '),$r.question(t,a),r};function dEe(t,e){var r={},s={};return typeof t=="object"?(Object.keys(t).forEach(function(a){typeof t[a]=="function"&&(s[e.caseSensitive?a:a.toLowerCase()]=t[a])}),r.preCheck=function(a){var n;return r.args=Tq(a),n=r.args[0]||"",e.caseSensitive||(n=n.toLowerCase()),r.hRes=n!=="_"&&s.hasOwnProperty(n)?s[n].apply(a,r.args.slice(1)):s.hasOwnProperty("_")?s._.apply(a,r.args):null,{res:a,forceNext:!1}},s.hasOwnProperty("_")||(r.limit=function(){var a=r.args[0]||"";return e.caseSensitive||(a=a.toLowerCase()),s.hasOwnProperty(a)})):r.preCheck=function(a){return r.args=Tq(a),r.hRes=typeof t=="function"?t.apply(a,r.args):!0,{res:a,forceNext:!1}},r}$r.promptCL=function(t,e){var r=Vs({hideEchoBack:!1,limitMessage:"Requested command is not available.",caseSensitive:!1,history:!0},e),s=dEe(t,r);return r.limit=s.limit,r.preCheck=s.preCheck,$r.prompt(r),s.args};$r.promptLoop=function(t,e){for(var r=Vs({hideEchoBack:!1,trueValue:null,falseValue:null,caseSensitive:!1,history:!0},e);!t($r.prompt(r)););};$r.promptCLLoop=function(t,e){var r=Vs({hideEchoBack:!1,limitMessage:"Requested command is not available.",caseSensitive:!1,history:!0},e),s=dEe(t,r);for(r.limit=s.limit,r.preCheck=s.preCheck;$r.prompt(r),!s.hRes;);};$r.promptSimShell=function(t){return $r.prompt(Vs({hideEchoBack:!1,history:!0},t,{prompt:function(){return bm?"$<cwd>>":(process.env.USER||"")+(process.env.HOSTNAME?"@"+process.env.HOSTNAME.replace(/\..*$/,""):"")+":$<cwdHome>$ "}()}))};function mEe(t,e,r){var s;return t==null&&(t="Are you sure? "),(!e||e.guide!==!1)&&(t+="")&&(t=t.replace(/\s*:?\s*$/,"")+" [y/n]: "),s=$r.keyIn(t,Vs(e,{hideEchoBack:!1,limit:r,trueValue:"y",falseValue:"n",caseSensitive:!1})),typeof s=="boolean"?s:""}$r.keyInYN=function(t,e){return mEe(t,e)};$r.keyInYNStrict=function(t,e){return mEe(t,e,"yn")};$r.keyInPause=function(t,e){t==null&&(t="Continue..."),(!e||e.guide!==!1)&&(t+="")&&(t=t.replace(/\s+$/,"")+" (Hit any key)"),$r.keyIn(t,Vs({limit:null},e,{hideEchoBack:!0,mask:""}))};$r.keyInSelect=function(t,e,r){var s=Vs({hideEchoBack:!1},r,{trueValue:null,falseValue:null,caseSensitive:!1,phContent:function(p){return p==="itemsCount"?t.length+"":p==="firstItem"?(t[0]+"").trim():p==="lastItem"?(t[t.length-1]+"").trim():null}}),a="",n={},c=49,f=`
`;if(!Array.isArray(t)||!t.length||t.length>35)throw"`items` must be Array (max length: 35).";return t.forEach(function(p,h){var E=String.fromCharCode(c);a+=E,n[E]=h,f+="["+E+"] "+(p+"").trim()+`
`,c=c===57?97:c+1}),(!r||r.cancel!==!1)&&(a+="0",n[0]=-1,f+="[0] "+(r&&r.cancel!=null&&typeof r.cancel!="boolean"?(r.cancel+"").trim():"CANCEL")+`
`),s.limit=a,f+=`
`,e==null&&(e="Choose one from list: "),(e+="")&&((!r||r.guide!==!1)&&(e=e.replace(/\s*:?\s*$/,"")+" [$<limit>]: "),f+=e),n[$r.keyIn(f,s).toLowerCase()]};$r.getRawInput=function(){return aF};function oS(t,e){var r;return e.length&&(r={},r[t]=e[0]),$r.setDefaultOptions(r)[t]}$r.setPrint=function(){return oS("print",arguments)};$r.setPrompt=function(){return oS("prompt",arguments)};$r.setEncoding=function(){return oS("encoding",arguments)};$r.setMask=function(){return oS("mask",arguments)};$r.setBufferSize=function(){return oS("bufferSize",arguments)}});var Oq=_((jYt,ec)=>{(function(){var t={major:0,minor:2,patch:66,status:"beta"};tau_file_system={files:{},open:function(w,b,y){var F=tau_file_system.files[w];if(!F){if(y==="read")return null;F={path:w,text:"",type:b,get:function(z,X){return X===this.text.length||X>this.text.length?"end_of_file":this.text.substring(X,X+z)},put:function(z,X){return X==="end_of_file"?(this.text+=z,!0):X==="past_end_of_file"?null:(this.text=this.text.substring(0,X)+z+this.text.substring(X+z.length),!0)},get_byte:function(z){if(z==="end_of_stream")return-1;var X=Math.floor(z/2);if(this.text.length<=X)return-1;var $=n(this.text[Math.floor(z/2)],0);return z%2===0?$&255:$/256>>>0},put_byte:function(z,X){var $=X==="end_of_stream"?this.text.length:Math.floor(X/2);if(this.text.length<$)return null;var oe=this.text.length===$?-1:n(this.text[Math.floor(X/2)],0);return X%2===0?(oe=oe/256>>>0,oe=(oe&255)<<8|z&255):(oe=oe&255,oe=(z&255)<<8|oe&255),this.text.length===$?this.text+=c(oe):this.text=this.text.substring(0,$)+c(oe)+this.text.substring($+1),!0},flush:function(){return!0},close:function(){var z=tau_file_system.files[this.path];return z?!0:null}},tau_file_system.files[w]=F}return y==="write"&&(F.text=""),F}},tau_user_input={buffer:"",get:function(w,b){for(var y;tau_user_input.buffer.length<w;)y=window.prompt(),y&&(tau_user_input.buffer+=y);return y=tau_user_input.buffer.substr(0,w),tau_user_input.buffer=tau_user_input.buffer.substr(w),y}},tau_user_output={put:function(w,b){return console.log(w),!0},flush:function(){return!0}},nodejs_file_system={open:function(w,b,y){var F=Ie("fs"),z=F.openSync(w,y[0]);return y==="read"&&!F.existsSync(w)?null:{get:function(X,$){var oe=new Buffer(X);return F.readSync(z,oe,0,X,$),oe.toString()},put:function(X,$){var oe=Buffer.from(X);if($==="end_of_file")F.writeSync(z,oe);else{if($==="past_end_of_file")return null;F.writeSync(z,oe,0,oe.length,$)}return!0},get_byte:function(X){return null},put_byte:function(X,$){return null},flush:function(){return!0},close:function(){return F.closeSync(z),!0}}}},nodejs_user_input={buffer:"",get:function(w,b){for(var y,F=yEe();nodejs_user_input.buffer.length<w;)nodejs_user_input.buffer+=F.question();return y=nodejs_user_input.buffer.substr(0,w),nodejs_user_input.buffer=nodejs_user_input.buffer.substr(w),y}},nodejs_user_output={put:function(w,b){return process.stdout.write(w),!0},flush:function(){return!0}};var e;Array.prototype.indexOf?e=function(w,b){return w.indexOf(b)}:e=function(w,b){for(var y=w.length,F=0;F<y;F++)if(b===w[F])return F;return-1};var r=function(w,b){if(w.length!==0){for(var y=w[0],F=w.length,z=1;z<F;z++)y=b(y,w[z]);return y}},s;Array.prototype.map?s=function(w,b){return w.map(b)}:s=function(w,b){for(var y=[],F=w.length,z=0;z<F;z++)y.push(b(w[z]));return y};var a;Array.prototype.filter?a=function(w,b){return w.filter(b)}:a=function(w,b){for(var y=[],F=w.length,z=0;z<F;z++)b(w[z])&&y.push(w[z]);return y};var n;String.prototype.codePointAt?n=function(w,b){return w.codePointAt(b)}:n=function(w,b){return w.charCodeAt(b)};var c;String.fromCodePoint?c=function(){return String.fromCodePoint.apply(null,arguments)}:c=function(){return String.fromCharCode.apply(null,arguments)};var f=0,p=1,h=/(\\a)|(\\b)|(\\f)|(\\n)|(\\r)|(\\t)|(\\v)|\\x([0-9a-fA-F]+)\\|\\([0-7]+)\\|(\\\\)|(\\')|('')|(\\")|(\\`)|(\\.)|(.)/g,E={"\\a":7,"\\b":8,"\\f":12,"\\n":10,"\\r":13,"\\t":9,"\\v":11};function C(w){var b=[],y=!1;return w.replace(h,function(F,z,X,$,oe,xe,Te,lt,Ct,qt,ir,Pt,gn,Pr,Ir,Or,on){switch(!0){case Ct!==void 0:return b.push(parseInt(Ct,16)),"";case qt!==void 0:return b.push(parseInt(qt,8)),"";case ir!==void 0:case Pt!==void 0:case gn!==void 0:case Pr!==void 0:case Ir!==void 0:return b.push(n(F.substr(1),0)),"";case on!==void 0:return b.push(n(on,0)),"";case Or!==void 0:y=!0;default:return b.push(E[F]),""}}),y?null:b}function S(w,b){var y="";if(w.length<2)return w;try{w=w.replace(/\\([0-7]+)\\/g,function($,oe){return c(parseInt(oe,8))}),w=w.replace(/\\x([0-9a-fA-F]+)\\/g,function($,oe){return c(parseInt(oe,16))})}catch{return null}for(var F=0;F<w.length;F++){var z=w.charAt(F),X=w.charAt(F+1);if(z===b&&X===b)F++,y+=b;else if(z==="\\")if(["a","b","f","n","r","t","v","'",'"',"\\","a","\b","\f",`
`,"\r"," ","\v"].indexOf(X)!==-1)switch(F+=1,X){case"a":y+="a";break;case"b":y+="\b";break;case"f":y+="\f";break;case"n":y+=`
`;break;case"r":y+="\r";break;case"t":y+=" ";break;case"v":y+="\v";break;case"'":y+="'";break;case'"':y+='"';break;case"\\":y+="\\";break}else return null;else y+=z}return y}function P(w){for(var b="",y=0;y<w.length;y++)switch(w.charAt(y)){case"'":b+="\\'";break;case"\\":b+="\\\\";break;case"\b":b+="\\b";break;case"\f":b+="\\f";break;case`
`:b+="\\n";break;case"\r":b+="\\r";break;case" ":b+="\\t";break;case"\v":b+="\\v";break;default:b+=w.charAt(y);break}return b}function I(w){var b=w.substr(2);switch(w.substr(0,2).toLowerCase()){case"0x":return parseInt(b,16);case"0b":return parseInt(b,2);case"0o":return parseInt(b,8);case"0'":return C(b)[0];default:return parseFloat(w)}}var R={whitespace:/^\s*(?:(?:%.*)|(?:\/\*(?:\n|\r|.)*?\*\/)|(?:\s+))\s*/,variable:/^(?:[A-Z_][a-zA-Z0-9_]*)/,atom:/^(\!|,|;|[a-z][0-9a-zA-Z_]*|[#\$\&\*\+\-\.\/\:\<\=\>\?\@\^\~\\]+|'(?:[^']*?(?:\\(?:x?\d+)?\\)*(?:'')*(?:\\')*)*')/,number:/^(?:0o[0-7]+|0x[0-9a-fA-F]+|0b[01]+|0'(?:''|\\[abfnrtv\\'"`]|\\x?\d+\\|[^\\])|\d+(?:\.\d+(?:[eE][+-]?\d+)?)?)/,string:/^(?:"([^"]|""|\\")*"|`([^`]|``|\\`)*`)/,l_brace:/^(?:\[)/,r_brace:/^(?:\])/,l_bracket:/^(?:\{)/,r_bracket:/^(?:\})/,bar:/^(?:\|)/,l_paren:/^(?:\()/,r_paren:/^(?:\))/};function N(w,b){return w.get_flag("char_conversion").id==="on"?b.replace(/./g,function(y){return w.get_char_conversion(y)}):b}function U(w){this.thread=w,this.text="",this.tokens=[]}U.prototype.set_last_tokens=function(w){return this.tokens=w},U.prototype.new_text=function(w){this.text=w,this.tokens=[]},U.prototype.get_tokens=function(w){var b,y=0,F=0,z=0,X=[],$=!1;if(w){var oe=this.tokens[w-1];y=oe.len,b=N(this.thread,this.text.substr(oe.len)),F=oe.line,z=oe.start}else b=this.text;if(/^\s*$/.test(b))return null;for(;b!=="";){var xe=[],Te=!1;if(/^\n/.exec(b)!==null){F++,z=0,y++,b=b.replace(/\n/,""),$=!0;continue}for(var lt in R)if(R.hasOwnProperty(lt)){var Ct=R[lt].exec(b);Ct&&xe.push({value:Ct[0],name:lt,matches:Ct})}if(!xe.length)return this.set_last_tokens([{value:b,matches:[],name:"lexical",line:F,start:z}]);var oe=r(xe,function(Pr,Ir){return Pr.value.length>=Ir.value.length?Pr:Ir});switch(oe.start=z,oe.line=F,b=b.replace(oe.value,""),z+=oe.value.length,y+=oe.value.length,oe.name){case"atom":oe.raw=oe.value,oe.value.charAt(0)==="'"&&(oe.value=S(oe.value.substr(1,oe.value.length-2),"'"),oe.value===null&&(oe.name="lexical",oe.value="unknown escape sequence"));break;case"number":oe.float=oe.value.substring(0,2)!=="0x"&&oe.value.match(/[.eE]/)!==null&&oe.value!=="0'.",oe.value=I(oe.value),oe.blank=Te;break;case"string":var qt=oe.value.charAt(0);oe.value=S(oe.value.substr(1,oe.value.length-2),qt),oe.value===null&&(oe.name="lexical",oe.value="unknown escape sequence");break;case"whitespace":var ir=X[X.length-1];ir&&(ir.space=!0),Te=!0;continue;case"r_bracket":X.length>0&&X[X.length-1].name==="l_bracket"&&(oe=X.pop(),oe.name="atom",oe.value="{}",oe.raw="{}",oe.space=!1);break;case"r_brace":X.length>0&&X[X.length-1].name==="l_brace"&&(oe=X.pop(),oe.name="atom",oe.value="[]",oe.raw="[]",oe.space=!1);break}oe.len=y,X.push(oe),Te=!1}var Pt=this.set_last_tokens(X);return Pt.length===0?null:Pt};function W(w,b,y,F,z){if(!b[y])return{type:f,value:x.error.syntax(b[y-1],"expression expected",!0)};var X;if(F==="0"){var $=b[y];switch($.name){case"number":return{type:p,len:y+1,value:new x.type.Num($.value,$.float)};case"variable":return{type:p,len:y+1,value:new x.type.Var($.value)};case"string":var oe;switch(w.get_flag("double_quotes").id){case"atom":oe=new j($.value,[]);break;case"codes":oe=new j("[]",[]);for(var xe=$.value.length-1;xe>=0;xe--)oe=new j(".",[new x.type.Num(n($.value,xe),!1),oe]);break;case"chars":oe=new j("[]",[]);for(var xe=$.value.length-1;xe>=0;xe--)oe=new j(".",[new x.type.Term($.value.charAt(xe),[]),oe]);break}return{type:p,len:y+1,value:oe};case"l_paren":var Pt=W(w,b,y+1,w.__get_max_priority(),!0);return Pt.type!==p?Pt:b[Pt.len]&&b[Pt.len].name==="r_paren"?(Pt.len++,Pt):{type:f,derived:!0,value:x.error.syntax(b[Pt.len]?b[Pt.len]:b[Pt.len-1],") or operator expected",!b[Pt.len])};case"l_bracket":var Pt=W(w,b,y+1,w.__get_max_priority(),!0);return Pt.type!==p?Pt:b[Pt.len]&&b[Pt.len].name==="r_bracket"?(Pt.len++,Pt.value=new j("{}",[Pt.value]),Pt):{type:f,derived:!0,value:x.error.syntax(b[Pt.len]?b[Pt.len]:b[Pt.len-1],"} or operator expected",!b[Pt.len])}}var Te=ee(w,b,y,z);return Te.type===p||Te.derived||(Te=ie(w,b,y),Te.type===p||Te.derived)?Te:{type:f,derived:!1,value:x.error.syntax(b[y],"unexpected token")}}var lt=w.__get_max_priority(),Ct=w.__get_next_priority(F),qt=y;if(b[y].name==="atom"&&b[y+1]&&(b[y].space||b[y+1].name!=="l_paren")){var $=b[y++],ir=w.__lookup_operator_classes(F,$.value);if(ir&&ir.indexOf("fy")>-1){var Pt=W(w,b,y,F,z);if(Pt.type!==f)return $.value==="-"&&!$.space&&x.type.is_number(Pt.value)?{value:new x.type.Num(-Pt.value.value,Pt.value.is_float),len:Pt.len,type:p}:{value:new x.type.Term($.value,[Pt.value]),len:Pt.len,type:p};X=Pt}else if(ir&&ir.indexOf("fx")>-1){var Pt=W(w,b,y,Ct,z);if(Pt.type!==f)return{value:new x.type.Term($.value,[Pt.value]),len:Pt.len,type:p};X=Pt}}y=qt;var Pt=W(w,b,y,Ct,z);if(Pt.type===p){y=Pt.len;var $=b[y];if(b[y]&&(b[y].name==="atom"&&w.__lookup_operator_classes(F,$.value)||b[y].name==="bar"&&w.__lookup_operator_classes(F,"|"))){var gn=Ct,Pr=F,ir=w.__lookup_operator_classes(F,$.value);if(ir.indexOf("xf")>-1Line truncated
`;b+=`
`;for(key in this.rules)for(y=0;y<this.rules[key].length;y++)b+=this.rules[key][y].toString(w),b+=`
`;return b},De.prototype.clone=function(){return new De(this.id)},Re.prototype.clone=function(){return new Re(this.value,this.is_float)},j.prototype.clone=function(){return new j(this.id,s(this.args,function(w){return w.clone()}))},Fe.prototype.clone=function(){return new Stram(this.stream,this.mode,this.alias,this.type,this.reposition,this.eof_action)},Ne.prototype.clone=function(){var w={};for(var b in this.links)this.links.hasOwnProperty(b)&&(w[b]=this.links[b].clone());return new Ne(w)},Pe.prototype.clone=function(){return new Pe(this.goal.clone(),this.substitution.clone(),this.parent)},Ve.prototype.clone=function(){return new Ve(this.head.clone(),this.body!==null?this.body.clone():null)},De.prototype.equals=function(w){return x.type.is_variable(w)&&this.id===w.id},Re.prototype.equals=function(w){return x.type.is_number(w)&&this.value===w.value&&this.is_float===w.is_float},j.prototype.equals=function(w){if(!x.type.is_term(w)||this.indicator!==w.indicator)return!1;for(var b=0;b<this.args.length;b++)if(!this.args[b].equals(w.args[b]))return!1;return!0},Fe.prototype.equals=function(w){return x.type.is_stream(w)&&this.id===w.id},Ne.prototype.equals=function(w){var b;if(!x.type.is_substitution(w))return!1;for(b in this.links)if(this.links.hasOwnProperty(b)&&(!w.links[b]||!this.links[b].equals(w.links[b])))return!1;for(b in w.links)if(w.links.hasOwnProperty(b)&&!this.links[b])return!1;return!0},Pe.prototype.equals=function(w){return x.type.is_state(w)&&this.goal.equals(w.goal)&&this.substitution.equals(w.substitution)&&this.parent===w.parent},Ve.prototype.equals=function(w){return x.type.is_rule(w)&&this.head.equals(w.head)&&(this.body===null&&w.body===null||this.body!==null&&this.body.equals(w.body))},De.prototype.rename=function(w){return w.get_free_variable(this)},Re.prototype.rename=function(w){return this},j.prototype.rename=function(w){return new j(this.id,s(this.args,function(b){return b.rename(w)}))},Fe.prototype.rename=function(w){return this},Ve.prototype.rename=function(w){return new Ve(this.head.rename(w),this.body!==null?this.body.rename(w):null)},De.prototype.variables=function(){return[this.id]},Re.prototype.variables=function(){return[]},j.prototype.variables=function(){return[].concat.apply([],s(this.args,function(w){return w.variables()}))},Fe.prototype.variables=function(){return[]},Ve.prototype.variables=function(){return this.body===null?this.head.variables():this.head.variables().concat(this.body.variables())},De.prototype.apply=function(w){return w.lookup(this.id)?w.lookup(this.id):this},Re.prototype.apply=function(w){return this},j.prototype.apply=function(w){if(this.indicator==="./2"){for(var b=[],y=this;y.indicator==="./2";)b.push(y.args[0].apply(w)),y=y.args[1];for(var F=y.apply(w),z=b.length-1;z>=0;z--)F=new j(".",[b[z],F]);return F}return new j(this.id,s(this.args,function(X){return X.apply(w)}),this.ref)},Fe.prototype.apply=function(w){return this},Ve.prototype.apply=function(w){return new Ve(this.head.apply(w),this.body!==null?this.body.apply(w):null)},Ne.prototype.apply=function(w){var b,y={};for(b in this.links)this.links.hasOwnProperty(b)&&(y[b]=this.links[b].apply(w));return new Ne(y)},j.prototype.select=function(){for(var w=this;w.indicator===",/2";)w=w.args[0];return w},j.prototype.replace=function(w){return this.indicator===",/2"?this.args[0].indicator===",/2"?new j(",",[this.args[0].replace(w),this.args[1]]):w===null?this.args[1]:new j(",",[w,this.args[1]]):w},j.prototype.search=function(w){if(x.type.is_term(w)&&w.ref!==void 0&&this.ref===w.ref)return!0;for(var b=0;b<this.args.length;b++)if(x.type.is_term(this.args[b])&&this.args[b].search(w))return!0;return!1},ke.prototype.get_current_input=function(){return this.current_input},it.prototype.get_current_input=function(){return this.session.get_current_input()},ke.prototype.get_current_output=function(){return this.current_output},it.prototype.get_current_output=function(){return this.session.get_current_output()},ke.prototype.set_current_input=function(w){this.current_input=w},it.prototype.set_current_input=function(w){return this.session.set_current_input(w)},ke.prototype.set_current_output=function(w){this.current_input=w},it.prototype.set_current_output=function(w){return this.session.set_current_output(w)},ke.prototype.get_stream_by_alias=function(w){return this.streams[w]},it.prototype.get_stream_by_alias=function(w){return this.session.get_stream_by_alias(w)},ke.prototype.file_system_open=function(w,b,y){return this.file_system.open(w,b,y)},it.prototype.file_system_open=function(w,b,y){return this.session.file_system_open(w,b,y)},ke.prototype.get_char_conversion=function(w){return this.__char_conversion[w]||w},it.prototype.get_char_conversion=function(w){return this.session.get_char_conversion(w)},ke.prototype.parse=function(w){return this.thread.parse(w)},it.prototype.parse=function(w){var b=new U(this);b.new_text(w);var y=b.get_tokens();if(y===null)return!1;var F=W(this,y,0,this.__get_max_priority(),!1);return F Line truncated
`,[])])])),b.substitution,b)])},"nl/1":function(w,b,y){var F=y.args[0];w.prepend([new Pe(b.goal.replace(new j("put_char",[F,new j(`
`,[])])),b.substitution,b)])},"get_byte/1":function(w,b,y){var F=y.args[0];w.prepend([new Pe(b.goal.replace(new j(",",[new j("current_input",[new De("S")]),new j("get_byte",[new De("S"),F])])),b.substitution,b)])},"get_byte/2":function(w,b,y){var F=y.args[0],z=y.args[1],X=x.type.is_stream(F)?F:w.get_stream_by_alias(F.id);if(x.type.is_variable(F))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(z)&&!x.type.is_byte(z))w.throw_error(x.error.type("in_byte",char,y.indicator));else if(!x.type.is_stream(F)&&!x.type.is_atom(F))w.throw_error(x.error.domain("stream_or_alias",F,y.indicator));else if(!x.type.is_stream(X)||X.stream===null)w.throw_error(x.error.existence("stream",F,y.indicator));else if(X.output)w.throw_error(x.error.permission("input","stream",F,y.indicator));else if(X.type==="text")w.throw_error(x.error.permission("input","text_stream",F,y.indicator));else if(X.position==="past_end_of_stream"&&X.eof_action==="error")w.throw_error(x.error.permission("input","past_end_of_stream",F,y.indicator));else{var $;if(X.position==="end_of_stream")$="end_of_file",X.position="past_end_of_stream";else{if($=X.stream.get_byte(X.position),$===null){w.throw_error(x.error.representation("byte",y.indicator));return}X.position++}w.prepend([new Pe(b.goal.replace(new j("=",[new Re($,!1),z])),b.substitution,b)])}},"peek_byte/1":function(w,b,y){var F=y.args[0];w.prepend([new Pe(b.goal.replace(new j(",",[new j("current_input",[new De("S")]),new j("peek_byte",[new De("S"),F])])),b.substitution,b)])},"peek_byte/2":function(w,b,y){var F=y.args[0],z=y.args[1],X=x.type.is_stream(F)?F:w.get_stream_by_alias(F.id);if(x.type.is_variable(F))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(z)&&!x.type.is_byte(z))w.throw_error(x.error.type("in_byte",char,y.indicator));else if(!x.type.is_stream(F)&&!x.type.is_atom(F))w.throw_error(x.error.domain("stream_or_alias",F,y.indicator));else if(!x.type.is_stream(X)||X.stream===null)w.throw_error(x.error.existence("stream",F,y.indicator));else if(X.output)w.throw_error(x.error.permission("input","stream",F,y.indicator));else if(X.type==="text")w.throw_error(x.error.permission("input","text_stream",F,y.indicator));else if(X.position==="past_end_of_stream"&&X.eof_action==="error")w.throw_error(x.error.permission("input","past_end_of_stream",F,y.indicator));else{var $;if(X.position==="end_of_stream")$="end_of_file",X.position="past_end_of_stream";else if($=X.stream.get_byte(X.position),$===null){w.throw_error(x.error.representation("byte",y.indicator));return}w.prepend([new Pe(b.goal.replace(new j("=",[new Re($,!1),z])),b.substitution,b)])}},"put_byte/1":function(w,b,y){var F=y.args[0];w.prepend([new Pe(b.goal.replace(new j(",",[new j("current_output",[new De("S")]),new j("put_byte",[new De("S"),F])])),b.substitution,b)])},"put_byte/2":function(w,b,y){var F=y.args[0],z=y.args[1],X=x.type.is_stream(F)?F:w.get_stream_by_alias(F.id);x.type.is_variable(F)||x.type.is_variable(z)?w.throw_error(x.error.instantiation(y.indicator)):x.type.is_byte(z)?!x.type.is_variable(F)&&!x.type.is_stream(F)&&!x.type.is_atom(F)?w.throw_error(x.error.domain("stream_or_alias",F,y.indicator)):!x.type.is_stream(X)||X.stream===null?w.throw_error(x.error.existence("stream",F,y.indicator)):X.input?w.throw_error(x.error.permission("output","stream",F,y.indicator)):X.type==="text"?w.throw_error(x.error.permission("output","text_stream",F,y.indicator)):X.stream.put_byte(z.value,X.position)&&(typeof X.position=="number"&&X.position++,w.success(b)):w.throw_error(x.error.type("byte",z,y.indicator))},"read/1":function(w,b,y){var F=y.args[0];w.prepend([new Pe(b.goal.replace(new j(",",[new j("current_input",[new De("S")]),new j("read_term",[new De("S"),F,new j("[]",[])])])),b.substitution,b)])},"read/2":function(w,b,y){var F=y.args[0],z=y.args[1];w.prepend([new Pe(b.goal.replace(new j("read_term",[F,z,new j("[]",[])])),b.substitution,b)])},"read_term/2":function(w,b,y){var F=y.args[0],z=y.args[1];w.prepend([new Pe(b.goal.replace(new j(",",[new j("current_input",[new De("S")]),new j("read_term",[new De("S"),F,z])])),b.substitution,b)])},"read_term/3":function(w,b,y){var F=y.args[0],z=y.args[1],X=y.args[2],$=x.type.is_stream(F)?F:w.get_stream_by_alias(F.id);if(x.type.is_variable(F)||x.type.is_variable(X))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_list(X))w.throw_error(x.error.type("list",X,y.indicator));else if(!x.type.is_stream(F)&&!x.type.is_atom(F))w.throw_error(x.error.domain("stream_or_alias",F,y.indicator));else if(!x.type.is_stream($)||$.stream===null)w.throw_error(x.error.existence("stream",F,y.indicator));else if($.output)w.throw_error(x.error.permission("input","stream",F,y.indicator));else if($.type==="binary")w.throw_error(x.error.permission("input","binary_stream",F,y.indicator));else if($.position==="past_end_of_stream"&&$.eof_action==="error")w.throw_error(x.error.permission("input","past_end_of_stream",F,y.indicator));else{for(var oe={},xe=X,Te; Line truncated
`;for(let r of this.project.workspacesByCwd.values()){let s=r.relativeCwd;e+=`workspace(${K0(s)}).
`,e+=`workspace_ident(${K0(s)}, ${K0(G.stringifyIdent(r.anchoredLocator))}).
`,e+=`workspace_version(${K0(s)}, ${K0(r.manifest.version)}).
`;for(let a of vEe)for(let n of r.manifest[a].values())e+=`workspace_has_dependency(${K0(s)}, ${K0(G.stringifyIdent(n))}, ${K0(n.range)}, ${a}).
`}return e+=`workspace(_) :- false.
`,e+=`workspace_ident(_, _) :- false.
`,e+=`workspace_version(_, _) :- false.
`,e+=`workspace_has_dependency(_, _, _, _) :- false.
`,e}getDeclarations(){let e="";return e+=`gen_enforced_dependency(_, _, _, _) :- false.
`,e+=`gen_enforced_field(_, _, _) :- false.
`,e}get fullSource(){return`${this.getProjectDatabase()}
${this.source}
${this.getDeclarations()}`}createSession(){return new Mq(this.project,this.fullSource)}async processClassic(){let e=this.createSession();return{enforcedDependencies:await this.genEnforcedDependencies(e),enforcedFields:await this.genEnforcedFields(e)}}async process(){let{enforcedDependencies:e,enforcedFields:r}=await this.processClassic(),s=new Map;for(let{workspace:a,dependencyIdent:n,dependencyRange:c,dependencyType:f}of e){let p=nS([f,G.stringifyIdent(n)]),h=je.getMapWithDefault(s,a.cwd);je.getMapWithDefault(h,p).set(c??void 0,new Set)}for(let{workspace:a,fieldPath:n,fieldValue:c}of r){let f=nS(n),p=je.getMapWithDefault(s,a.cwd);je.getMapWithDefault(p,f).set(JSON.parse(c)??void 0,new Set)}return{manifestUpdates:s,reportedErrors:new Map}}async genEnforcedDependencies(e){let r=[];for await(let s of e.makeQuery("workspace(WorkspaceCwd), dependency_type(DependencyType), gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType).")){let a=J.resolve(this.project.cwd,Pm(s.links.WorkspaceCwd)),n=Pm(s.links.DependencyIdent),c=Pm(s.links.DependencyRange),f=Pm(s.links.DependencyType);if(a===null||n===null)throw new Error("Invalid rule");let p=this.project.getWorkspaceByCwd(a),h=G.parseIdent(n);r.push({workspace:p,dependencyIdent:h,dependencyRange:c,dependencyType:f})}return je.sortMap(r,[({dependencyRange:s})=>s!==null?"0":"1",({workspace:s})=>G.stringifyIdent(s.anchoredLocator),({dependencyIdent:s})=>G.stringifyIdent(s)])}async genEnforcedFields(e){let r=[];for await(let s of e.makeQuery("workspace(WorkspaceCwd), gen_enforced_field(WorkspaceCwd, FieldPath, FieldValue).")){let a=J.resolve(this.project.cwd,Pm(s.links.WorkspaceCwd)),n=Pm(s.links.FieldPath),c=$ct(s.links.FieldValue);if(a===null||n===null)throw new Error("Invalid rule");let f=this.project.getWorkspaceByCwd(a);r.push({workspace:f,fieldPath:n,fieldValue:c})}return je.sortMap(r,[({workspace:s})=>G.stringifyIdent(s.anchoredLocator),({fieldPath:s})=>s])}async*query(e){let r=this.createSession();for await(let s of r.makeQuery(e)){let a={};for(let[n,c]of Object.entries(s.links))n!=="_"&&(a[n]=Pm(c));yield a}}}});var OEe=_(fF=>{"use strict";Object.defineProperty(fF,"__esModule",{value:!0});function BS(t){let e=[...t.caches],r=e.shift();return r===void 0?NEe():{get(s,a,n={miss:()=>Promise.resolve()}){return r.get(s,a,n).catch(()=>BS({caches:e}).get(s,a,n))},set(s,a){return r.set(s,a).catch(()=>BS({caches:e}).set(s,a))},delete(s){return r.delete(s).catch(()=>BS({caches:e}).delete(s))},clear(){return r.clear().catch(()=>BS({caches:e}).clear())}}}function NEe(){return{get(t,e,r={miss:()=>Promise.resolve()}){return e().then(a=>Promise.all([a,r.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}fF.createFallbackableCache=BS;fF.createNullCache=NEe});var MEe=_((BJt,LEe)=>{LEe.exports=OEe()});var UEe=_($q=>{"use strict";Object.defineProperty($q,"__esModule",{value:!0});function yut(t={serializable:!0}){let e={};return{get(r,s,a={miss:()=>Promise.resolve()}){let n=JSON.stringify(r);if(n in e)return Promise.resolve(t.serializable?JSON.parse(e[n]):e[n]);let c=s(),f=a&&a.miss||(()=>Promise.resolve());return c.then(p=>f(p)).then(()=>c)},set(r,s){return e[JSON.stringify(r)]=t.serializable?JSON.stringify(s):s,Promise.resolve(s)},delete(r){return delete e[JSON.stringify(r)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}$q.createInMemoryCache=yut});var HEe=_((SJt,_Ee)=>{_Ee.exports=UEe()});var GEe=_($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});function Eut(t,e,r){let s={"x-algolia-api-key":r,"x-algolia-application-id":e};return{headers(){return t===e9.WithinHeaders?s:{}},queryParameters(){return t===e9.WithinQueryParameters?s:{}}}}function Iut(t){let e=0,r=()=>(e++,new Promise(s=>{setTimeout(()=>{s(t(r))},Math.min(100*e,1e3))}));return t(r)}function jEe(t,e=(r,s)=>Promise.resolve()){return Object.assign(t,{wait(r){return jEe(t.then(s=>Promise.all([e(s,r),s])).then(s=>s[1]))}})}function Cut(t){let e=t.length-1;for(e;e>0;e--){let r=Math.floor(Math.random()*(e+1)),s=t[e];t[e]=t[r],t[r]=s}return t}function wut(t,e){return e&&Object.keys(e).forEach(r=>{t[r]=e[r](t)}),t}function But(t,...e){let r=0;return t.replace(/%s/g,()=>encodeURIComponent(e[r++]))}var vut="4.22.1",Sut=t=>()=>t.transporter.requester.destroy(),e9={WithinQueryParameters:0,WithinHeaders:1};$u.AuthMode=e9;$u.addMethods=wut;$u.createAuth=Eut;$u.createRetryablePromise=Iut;$u.createWaitablePromise=jEe;$u.destroy=Sut;$u.encode=But;$u.shuffle=Cut;$u.version=vut});var vS=_((bJt,qEe)=>{qEe.exports=GEe()});var WEe=_(t9=>{"use strict";Object.defineProperty(t9,"__esModule",{value:!0});var Dut={Delete:"DELETE",Get:"GET",Post:"POST",Put:"PUT"};t9.MethodEnum=Dut});var SS=_((xJt,YEe)=>{YEe.exports=WEe()});var aIe=_(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var JEe=SS();function r9(t,e){let r=t||{},s=r.data||{};return Object.keys(r).forEach(a=>{["timeout","head Line truncated
`;f!==s&&(s=f,t.write(iwe.default.eraseLines(r)+f),r=f.split(`
`).length)};return n.clear=()=>{t.write(iwe.default.eraseLines(r)),s="",r=0},n.done=()=>{s="",r=0,e||(swe.default.show(),a=!1)},n};LS.default={create:Ipt}});var lwe=_((mKt,Cpt)=>{Cpt.exports=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY_BUILD_BASE",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}}]});var fwe=_(tc=>{"use strict";var uwe=lwe(),uA=process.env;Object.defineProperty(tc,"_vendors",{value:uwe.map(function(t){return t.constant})});tc.name=null;tc.isPR=null;uwe.forEach(function(t){var e=Array.isArray(t.env)?t.env:[t.env],r=e.every(function(s){return cwe(s)});if(tc[t.constant]=r,r)switch(tc.name=t.name,typeof t.pr){case"string":tc.isPR=!!uA[t.pr];break;case"object":"env"in t.pr?tc.isPR=t.pr.env in uA&&uA[t.pr.env]!==t.pr.ne:"any"in t.pr?tc.isPR=t.pr.any.some(function(s){return!!uA[s]}):tc.isPR=cwe(t.pr);break;default:tc.isPR=null}});tc.isCI=!!(uA.CI||uA.CONTINUOUS_INTEGRATION||uA.BUILD_NUMBER||uA.RUN_ID||tc.name);function cwe(t){return typeof t=="string"?!!uA[t]:Object.keys(t).every(function(e){return uA[e]===t[e]})}});var pwe=_((EKt,Awe)=>{"use strict";Awe.exports=fwe().isCI});var gwe=_((IKt,hwe)=>{"use strict";var wpt=t=>{let e=new Set;do for(let r of Reflect.ownKeys(t))e.add([t,r]);while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e};hwe.exports=(t,{include:e,exclude:r}={})=>{let s=a=>{let n=c=>typeof c=="string"?a===c:c.test(a);return e?e.some(n):r?!r.some(n):!0};for(let[a,n]of wpt(t.constructor.prototype)){if(n==="constructor"||!s(n))continue;let c=Reflect.getOwnPropertyDescriptor(a,n);c&&typeof c.value=="function"&&(t[n]=t[n].bind(t))}return t}});var Cwe=_(Vn=>{"use strict";var mw,_S,QF,H9;typeof performance=="object"&&typeof performance.now=="function"?(dwe=performance,Vn.unstable_now=function(){return dwe.now()}):(N9=Date,mwe=N9.now(),Vn.unstable_now=function(){return N9.now()-mwe});var dwe,N9,mwe;typeof window>"u"||typeof MessageChannel!="function"?(dw=null,O9=null,L9=function(){if(dw!==null)try{var t=Vn.unstable_now();dw(!0,t),dw=null}catch(e){throw setTimeout(L9,0),e}},mw=function(t){dw!==null?setTimeout(mw,0,t):(dw=t,setTimeout(L9,0))},_S=function(t,e){O9=setTimeout(t,e)},QF=function(){clearTimeout(O9)},Vn.unstable_shouldYield=function(){return!1},H9=Vn.unstable_forceFrameRate=function(){}):(ywe=window.setTimeout,Ewe=window.clearTimeout,typeof console<"u"&&(Iwe=window.cancelAnimationFrame,typeof window.requestAnimationFrame!="function"&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),typeof Iwe!="function"&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")),MS=!1,US=null,PF=-1,M9=5,U9=0,Vn.unstable_shouldYield=function(){return Vn.unstable_now()>=U9},H9=function(){},Vn.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M9=0<t?Math Line truncated
`+fu+v}var ve=!1;function Nt(v,D){if(!v||ve)return"";ve=!0;var Q=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(D)if(D=function(){throw Error()},Object.defineProperty(D.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(D,[])}catch(pt){var H=pt}Reflect.construct(v,[],D)}else{try{D.call()}catch(pt){H=pt}v.call(D.prototype)}else{try{throw Error()}catch(pt){H=pt}v()}}catch(pt){if(pt&&H&&typeof pt.stack=="string"){for(var V=pt.stack.split(`
`),ne=H.stack.split(`
`),Se=V.length-1,_e=ne.length-1;1<=Se&&0<=_e&&V[Se]!==ne[_e];)_e--;for(;1<=Se&&0<=_e;Se--,_e--)if(V[Se]!==ne[_e]){if(Se!==1||_e!==1)do if(Se--,_e--,0>_e||V[Se]!==ne[_e])return`
`+V[Se].replace(" at new "," at ");while(1<=Se&&0<=_e);break}}}finally{ve=!1,Error.prepareStackTrace=Q}return(v=v?v.displayName||v.name:"")?oc(v):""}var ac=[],Oi=-1;function no(v){return{current:v}}function Rt(v){0>Oi||(v.current=ac[Oi],ac[Oi]=null,Oi--)}function xn(v,D){Oi++,ac[Oi]=v.current,v.current=D}var la={},Gi=no(la),Li=no(!1),Na=la;function dn(v,D){var Q=v.type.contextTypes;if(!Q)return la;var H=v.stateNode;if(H&&H.__reactInternalMemoizedUnmaskedChildContext===D)return H.__reactInternalMemoizedMaskedChildContext;var V={},ne;for(ne in Q)V[ne]=D[ne];return H&&(v=v.stateNode,v.__reactInternalMemoizedUnmaskedChildContext=D,v.__reactInternalMemoizedMaskedChildContext=V),V}function Kn(v){return v=v.childContextTypes,v!=null}function Au(){Rt(Li),Rt(Gi)}function yh(v,D,Q){if(Gi.current!==la)throw Error(c(168));xn(Gi,D),xn(Li,Q)}function Oa(v,D,Q){var H=v.stateNode;if(v=D.childContextTypes,typeof H.getChildContext!="function")return Q;H=H.getChildContext();for(var V in H)if(!(V in v))throw Error(c(108,g(D)||"Unknown",V));return s({},Q,H)}function La(v){return v=(v=v.stateNode)&&v.__reactInternalMemoizedMergedChildContext||la,Na=Gi.current,xn(Gi,v),xn(Li,Li.current),!0}function Ma(v,D,Q){var H=v.stateNode;if(!H)throw Error(c(169));Q?(v=Oa(v,D,Na),H.__reactInternalMemoizedMergedChildContext=v,Rt(Li),Rt(Gi),xn(Gi,v)):Rt(Li),xn(Li,Q)}var $e=null,Ua=null,hf=n.unstable_now;hf();var lc=0,wn=8;function ca(v){if(1&v)return wn=15,1;if(2&v)return wn=14,2;if(4&v)return wn=13,4;var D=24&v;return D!==0?(wn=12,D):v&32?(wn=11,32):(D=192&v,D!==0?(wn=10,D):v&256?(wn=9,256):(D=3584&v,D!==0?(wn=8,D):v&4096?(wn=7,4096):(D=4186112&v,D!==0?(wn=6,D):(D=62914560&v,D!==0?(wn=5,D):v&67108864?(wn=4,67108864):v&134217728?(wn=3,134217728):(D=805306368&v,D!==0?(wn=2,D):1073741824&v?(wn=1,1073741824):(wn=8,v))))))}function LA(v){switch(v){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}function MA(v){switch(v){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(c(358,v))}}function ua(v,D){var Q=v.pendingLanes;if(Q===0)return wn=0;var H=0,V=0,ne=v.expiredLanes,Se=v.suspendedLanes,_e=v.pingedLanes;if(ne!==0)H=ne,V=wn=15;else if(ne=Q&134217727,ne!==0){var pt=ne&~Se;pt!==0?(H=ca(pt),V=wn):(_e&=ne,_e!==0&&(H=ca(_e),V=wn))}else ne=Q&~Se,ne!==0?(H=ca(ne),V=wn):_e!==0&&(H=ca(_e),V=wn);if(H===0)return 0;if(H=31-ns(H),H=Q&((0>H?0:1<<H)<<1)-1,D!==0&&D!==H&&!(D&Se)){if(ca(D),V<=wn)return D;wn=V}if(D=v.entangledLanes,D!==0)for(v=v.entanglements,D&=H;0<D;)Q=31-ns(D),V=1<<Q,H|=v[Q],D&=~V;return H}function Bl(v){return v=v.pendingLanes&-1073741825,v!==0?v:v&1073741824?1073741824:0}function Mt(v,D){switch(v){case 15:return 1;case 14:return 2;case 12:return v=kn(24&~D),v===0?Mt(10,D):v;case 10:return v=kn(192&~D),v===0?Mt(8,D):v;case 8:return v=kn(3584&~D),v===0&&(v=kn(4186112&~D),v===0&&(v=512)),v;case 2:return D=kn(805306368&~D),D===0&&(D=268435456),D}throw Error(c(358,v))}function kn(v){return v&-v}function fa(v){for(var D=[],Q=0;31>Q;Q++)D.push(v);return D}function Ha(v,D,Q){v.pendingLanes|=D;var H=D-1;v.suspendedLanes&=H,v.pingedLanes&=H,v=v.eventTimes,D=31-ns(D),v[D]=Q}var ns=Math.clz32?Math.clz32:uc,cc=Math.log,pu=Math.LN2;function uc(v){return v===0?32:31-(cc(v)/pu|0)|0}var ja=n.unstable_runWithPriority,Mi=n.unstable_scheduleCallback,Is=n.unstable_cancelCallback,vl=n.unstable_shouldYield,gf=n.unstable_requestPaint,fc=n.unstable_now,wi=n.unstable_getCurrentPriorityLevel,Qn=n.unstable_ImmediatePriority,Ac=n.unstable_UserBlockingPriority,Ke=n.unstable_NormalPriority,st=n.unstable_LowPriority,St=n.unstable_IdlePriority,lr={},te=gf!==void 0?gf:function(){},Ee=null,Oe=null,dt=!1,Et=fc(),bt=1e4>Et?fc:function(){return fc()-Et};function tr(){switch(wi()){case Qn:return 99;case Ac:return 98;case Ke:return 97;case st:return 96;case St:return 95;default:throw Error(c(332))}}function An(v){switch(v){case 99:return Qn;case 98:return Ac;case 97:return Ke;case 96:return st;case 95:return St;default:throw Error(c(332))}}function li(v,D){return v=An(v),ja(v,D)}function qi(v,D,Q){return v=An(v),Mi(v,D,Q)}function Tn(){if(Oe!==null){var v=Oe;Oe=null,Is(v)}Ga()}function Ga(){if(!dt&&Ee!==null){dt=!0;var v=0;try{var D=Ee;li(99,function(){for(;v<D.length;v++){var Q=D[v];do Q=Q(!0);while(Q!==null)}}),Ee=null}catch(Q){throw Ee!==null&&(Ee=Ee.slice(v+1)),Mi(Qn,Tn),Q}finally{dt=!1}}}var my=f.ReactCurrentBatchConfig;function Z1(v,D){return v===D&&(v!==0||1/v===1/D)||v!==v&&D!==D}var vo=typeof Object.is=="function"?Object.is:Z1,yy=Object.prototype.hasOwnProperty;function Eh(v,D){if(vo(v,D))return!0;if(typeof v!="object"||v===null||typeof D!="object"||D===null)return!1;var Q=Object.keys(v),H=Object.keys(D);if(Q.length!==H.length)return!1;for(H=0;H<Q.length;H++)if(!yy.call(D,Q[H])||!vo(v[Q[H]],D[Q[H]]))return!1;return!0}function $1(v){switch(v.tag){case 5:return oc(v.type);case 16:return oc("Lazy" Line truncated
Error generating stack: `+ne.message+`
`+ne.stack}return{value:v,source:D,stack:V}}function Vg(v,D){try{console.error(D.value)}catch(Q){setTimeout(function(){throw Q})}}var WL=typeof WeakMap=="function"?WeakMap:Map;function i2(v,D,Q){Q=Dl(-1,Q),Q.tag=3,Q.payload={element:null};var H=D.value;return Q.callback=function(){_y||(_y=!0,y2=H),Vg(v,D)},Q}function Jg(v,D,Q){Q=Dl(-1,Q),Q.tag=3;var H=v.type.getDerivedStateFromError;if(typeof H=="function"){var V=D.value;Q.payload=function(){return Vg(v,D),H(V)}}var ne=v.stateNode;return ne!==null&&typeof ne.componentDidCatch=="function"&&(Q.callback=function(){typeof H!="function"&&(hc===null?hc=new Set([this]):hc.add(this),Vg(v,D));var Se=D.stack;this.componentDidCatch(D.value,{componentStack:Se!==null?Se:""})}),Q}var YL=typeof WeakSet=="function"?WeakSet:Set;function s2(v){var D=v.ref;if(D!==null)if(typeof D=="function")try{D(null)}catch(Q){xf(v,Q)}else D.current=null}function xy(v,D){switch(D.tag){case 0:case 11:case 15:case 22:return;case 1:if(D.flags&256&&v!==null){var Q=v.memoizedProps,H=v.memoizedState;v=D.stateNode,D=v.getSnapshotBeforeUpdate(D.elementType===D.type?Q:So(D.type,Q),H),v.__reactInternalSnapshotBeforeUpdate=D}return;case 3:F&&D.flags&256&&Ts(D.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(c(163))}function Th(v,D){if(D=D.updateQueue,D=D!==null?D.lastEffect:null,D!==null){var Q=D=D.next;do{if((Q.tag&v)===v){var H=Q.destroy;Q.destroy=void 0,H!==void 0&&H()}Q=Q.next}while(Q!==D)}}function uP(v,D,Q){switch(Q.tag){case 0:case 11:case 15:case 22:if(D=Q.updateQueue,D=D!==null?D.lastEffect:null,D!==null){v=D=D.next;do{if((v.tag&3)===3){var H=v.create;v.destroy=H()}v=v.next}while(v!==D)}if(D=Q.updateQueue,D=D!==null?D.lastEffect:null,D!==null){v=D=D.next;do{var V=v;H=V.next,V=V.tag,V&4&&V&1&&(vP(Q,v),tM(Q,v)),v=H}while(v!==D)}return;case 1:v=Q.stateNode,Q.flags&4&&(D===null?v.componentDidMount():(H=Q.elementType===Q.type?D.memoizedProps:So(Q.type,D.memoizedProps),v.componentDidUpdate(H,D.memoizedState,v.__reactInternalSnapshotBeforeUpdate))),D=Q.updateQueue,D!==null&&Cy(Q,D,v);return;case 3:if(D=Q.updateQueue,D!==null){if(v=null,Q.child!==null)switch(Q.child.tag){case 5:v=Re(Q.child.stateNode);break;case 1:v=Q.child.stateNode}Cy(Q,D,v)}return;case 5:v=Q.stateNode,D===null&&Q.flags&4&&$s(v,Q.type,Q.memoizedProps,Q);return;case 6:return;case 4:return;case 12:return;case 13:X&&Q.memoizedState===null&&(Q=Q.alternate,Q!==null&&(Q=Q.memoizedState,Q!==null&&(Q=Q.dehydrated,Q!==null&&uu(Q))));return;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(c(163))}function fP(v,D){if(F)for(var Q=v;;){if(Q.tag===5){var H=Q.stateNode;D?dh(H):to(Q.stateNode,Q.memoizedProps)}else if(Q.tag===6)H=Q.stateNode,D?mh(H):jn(H,Q.memoizedProps);else if((Q.tag!==23&&Q.tag!==24||Q.memoizedState===null||Q===v)&&Q.child!==null){Q.child.return=Q,Q=Q.child;continue}if(Q===v)break;for(;Q.sibling===null;){if(Q.return===null||Q.return===v)return;Q=Q.return}Q.sibling.return=Q.return,Q=Q.sibling}}function ky(v,D){if(Ua&&typeof Ua.onCommitFiberUnmount=="function")try{Ua.onCommitFiberUnmount($e,D)}catch{}switch(D.tag){case 0:case 11:case 14:case 15:case 22:if(v=D.updateQueue,v!==null&&(v=v.lastEffect,v!==null)){var Q=v=v.next;do{var H=Q,V=H.destroy;if(H=H.tag,V!==void 0)if(H&4)vP(D,Q);else{H=D;try{V()}catch(ne){xf(H,ne)}}Q=Q.next}while(Q!==v)}break;case 1:if(s2(D),v=D.stateNode,typeof v.componentWillUnmount=="function")try{v.props=D.memoizedProps,v.state=D.memoizedState,v.componentWillUnmount()}catch(ne){xf(D,ne)}break;case 5:s2(D);break;case 4:F?gP(v,D):z&&z&&(D=D.stateNode.containerInfo,v=ou(D),TA(D,v))}}function AP(v,D){for(var Q=D;;)if(ky(v,Q),Q.child===null||F&&Q.tag===4){if(Q===D)break;for(;Q.sibling===null;){if(Q.return===null||Q.return===D)return;Q=Q.return}Q.sibling.return=Q.return,Q=Q.sibling}else Q.child.return=Q,Q=Q.child}function Qy(v){v.alternate=null,v.child=null,v.dependencies=null,v.firstEffect=null,v.lastEffect=null,v.memoizedProps=null,v.memoizedState=null,v.pendingProps=null,v.return=null,v.updateQueue=null}function pP(v){return v.tag===5||v.tag===3||v.tag===4}function hP(v){if(F){e:{for(var D=v.return;D!==null;){if(pP(D))break e;D=D.return}throw Error(c(160))}var Q=D;switch(D=Q.stateNode,Q.tag){case 5:var H=!1;break;case 3:D=D.containerInfo,H=!0;break;case 4:D=D.containerInfo,H=!0;break;default:throw Error(c(161))}Q.flags&16&&(Af(D),Q.flags&=-17);e:t:for(Q=v;;){for(;Q.sibling===null;){if(Q.return===null||pP(Q.return)){Q=null;break e}Q=Q.return}for(Q.sibling.return=Q.return,Q=Q.sibling;Q.tag!==5&&Q.tag!==6&&Q.tag!==18;){if(Q.flags&2||Q.child===null||Q.tag===4)continue t;Q.child.return=Q,Q=Q.child}if(!(Q.flags&2)){Q=Q.stateNode;break e}}H?o2(v,Q,D):a2(v,Q,D)}}function o2(v,D,Q){var H=v.tag,V=H===5||H===6;if(V)v=V?v.stateNode:v.stateNode.instance,D?eo(Q,v,D):Io(Q,v);else if(H!==4&&(v=v.child,v!==null))for(o2(v,D,Q),v=v.sibling;v!==null;)o2(v,D,Q),v=v.sibling}function a2(v,D,Q){var H=v.tag,V=H===5||H===6;if(V)v=V?v.stateNode:v.stateNode.instance,D?ji(Q,v,D):ai(Q,v);els Line truncated
Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`)}ws!==5&&(ws=2),pt=Yg(pt,_e),Zt=Se;do{switch(Zt.tag){case 3:ne=pt,Zt.flags|=4096,D&=-D,Zt.lanes|=D;var Zn=i2(Zt,ne,D);Iy(Zt,Zn);break e;case 1:ne=pt;var kr=Zt.type,Rn=Zt.stateNode;if(!(Zt.flags&64)&&(typeof kr.getDerivedStateFromError=="function"||Rn!==null&&typeof Rn.componentDidCatch=="function"&&(hc===null||!hc.has(Rn)))){Zt.flags|=4096,D&=-D,Zt.lanes|=D;var _n=Jg(Zt,ne,D);Iy(Zt,_n);break e}}Zt=Zt.return}while(Zt!==null)}BP(Q)}catch(zr){D=zr,Xi===Q&&Q!==null&&(Xi=Q=Q.return);continue}break}while(!0)}function CP(){var v=My.current;return My.current=kt,v===null?kt:v}function id(v,D){var Q=xr;xr|=16;var H=CP();so===v&&Ns===D||Oh(v,D);do try{XL();break}catch(V){IP(v,V)}while(!0);if(Fg(),xr=Q,My.current=H,Xi!==null)throw Error(c(261));return so=null,Ns=0,ws}function XL(){for(;Xi!==null;)wP(Xi)}function ZL(){for(;Xi!==null&&!vl();)wP(Xi)}function wP(v){var D=bP(v.alternate,v,ZA);v.memoizedProps=v.pendingProps,D===null?BP(v):Xi=D,f2.current=null}function BP(v){var D=v;do{var Q=D.alternate;if(v=D.return,D.flags&2048){if(Q=qL(D),Q!==null){Q.flags&=2047,Xi=Q;return}v!==null&&(v.firstEffect=v.lastEffect=null,v.flags|=2048)}else{if(Q=jL(Q,D,ZA),Q!==null){Xi=Q;return}if(Q=D,Q.tag!==24&&Q.tag!==23||Q.memoizedState===null||ZA&1073741824||!(Q.mode&4)){for(var H=0,V=Q.child;V!==null;)H|=V.lanes|V.childLanes,V=V.sibling;Q.childLanes=H}v!==null&&!(v.flags&2048)&&(v.firstEffect===null&&(v.firstEffect=D.firstEffect),D.lastEffect!==null&&(v.lastEffect!==null&&(v.lastEffect.nextEffect=D.firstEffect),v.lastEffect=D.lastEffect),1<D.flags&&(v.lastEffect!==null?v.lastEffect.nextEffect=D:v.firstEffect=D,v.lastEffect=D))}if(D=D.sibling,D!==null){Xi=D;return}Xi=D=v}while(D!==null);ws===0&&(ws=5)}function $A(v){var D=tr();return li(99,$L.bind(null,v,D)),null}function $L(v,D){do vu();while($g!==null);if(xr&48)throw Error(c(327));var Q=v.finishedWork;if(Q===null)return null;if(v.finishedWork=null,v.finishedLanes=0,Q===v.current)throw Error(c(177));v.callbackNode=null;var H=Q.lanes|Q.childLanes,V=H,ne=v.pendingLanes&~V;v.pendingLanes=V,v.suspendedLanes=0,v.pingedLanes=0,v.expiredLanes&=V,v.mutableReadLanes&=V,v.entangledLanes&=V,V=v.entanglements;for(var Se=v.eventTimes,_e=v.expirationTimes;0<ne;){var pt=31-ns(ne),Wt=1<<pt;V[pt]=0,Se[pt]=-1,_e[pt]=-1,ne&=~Wt}if(wu!==null&&!(H&24)&&wu.has(v)&&wu.delete(v),v===so&&(Xi=so=null,Ns=0),1<Q.flags?Q.lastEffect!==null?(Q.lastEffect.nextEffect=Q,H=Q.firstEffect):H=Q:H=Q.firstEffect,H!==null){V=xr,xr|=32,f2.current=null,rd=rt(v.containerInfo),nd=!1,sr=H;do try{eM()}catch(qe){if(sr===null)throw Error(c(330));xf(sr,qe),sr=sr.nextEffect}while(sr!==null);rd=null,sr=H;do try{for(Se=v;sr!==null;){var Sr=sr.flags;if(Sr&16&&F&&Af(sr.stateNode),Sr&128){var Lr=sr.alternate;if(Lr!==null){var Zt=Lr.ref;Zt!==null&&(typeof Zt=="function"?Zt(null):Zt.current=null)}}switch(Sr&1038){case 2:hP(sr),sr.flags&=-3;break;case 6:hP(sr),sr.flags&=-3,l2(sr.alternate,sr);break;case 1024:sr.flags&=-1025;break;case 1028:sr.flags&=-1025,l2(sr.alternate,sr);break;case 4:l2(sr.alternate,sr);break;case 8:_e=Se,ne=sr,F?gP(_e,ne):AP(_e,ne);var zn=ne.alternate;Qy(ne),zn!==null&&Qy(zn)}sr=sr.nextEffect}}catch(qe){if(sr===null)throw Error(c(330));xf(sr,qe),sr=sr.nextEffect}while(sr!==null);nd&&lt(),Fe(v.containerInfo),v.current=Q,sr=H;do try{for(Sr=v;sr!==null;){var yi=sr.flags;if(yi&36&&uP(Sr,sr.alternate,sr),yi&128){Lr=void 0;var za=sr.ref;if(za!==null){var et=sr.stateNode;switch(sr.tag){case 5:Lr=Re(et);break;default:Lr=et}typeof za=="function"?za(Lr):za.current=Lr}}sr=sr.nextEffect}}catch(qe){if(sr===null)throw Error(c(330));xf(sr,qe),sr=sr.nextEffect}while(sr!==null);sr=null,te(),xr=V}else v.current=Q;if(Pf)Pf=!1,$g=v,ed=D;else for(sr=H;sr!==null;)D=sr.nextEffect,sr.nextEffect=null,sr.flags&8&&(yi=sr,yi.sibling=null,yi.stateNode=null),sr=D;if(H=v.pendingLanes,H===0&&(hc=null),H===1?v===C2?td++:(td=0,C2=v):td=0,Q=Q.stateNode,Ua&&typeof Ua.onCommitFiberRoot=="function")try{Ua.onCommitFiberRoot($e,Q,void 0,(Q.current.flags&64)===64)}catch{}if(ga(v,bt()),_y)throw _y=!1,v=y2,y2=null,v;return xr&8||Tn(),null}function eM(){for(;sr!==null;){var v=sr.alternate;nd||rd===null||(sr.flags&8?De(sr,rd)&&(nd=!0,Te()):sr.tag===13&&VL(v,sr)&&De(sr,rd)&&(nd=!0,Te()));var D=sr.flags;D&256&&xy(v,sr),!(D&512)||Pf||(Pf=!0,qi(97,function(){return vu(),null})),sr=sr.nextEffect}}function vu(){if(ed!==90){var v=97<ed?97:ed;return ed=90,li(v,rM)}return!1}function tM(v,D){E2.push(D,v),Pf||(Pf=!0,qi(97,function(){return vu(),null}))}function vP(v,D){I2.push(D,v),Pf||(Pf=!0,qi(97,function(){return vu(),null}))}function rM(){if($g===null)return!1;var v=$g;if($g=null,xr&48)throw Error(c(331));var D=xr;xr|=32;var Q=I2;I2=[];for(var H=0;H<Q.length;H+=2){var V=Q[H],ne=Q[H+1],Se=V.destroy;if(V.destroy=void 0,typeof Se=="function")try{Se()}catch(pt){if(ne===null)throw Error(c(330));xf(ne,pt)}}for(Q=E2,E2=[],H=0;H<Q.length;H+=2){V=Q[H],ne=Q[H+1];try{va Line truncated
`+(H.join(" > ")+`
No matching component was found for:
`)+v.join(" > ")}return null},r.getPublicRootInstance=function(v){if(v=v.current,!v.child)return null;switch(v.child.tag){case 5:return Re(v.child.stateNode);default:return v.child.stateNode}},r.injectIntoDevTools=function(v){if(v={bundleType:v.bundleType,version:v.version,rendererPackageName:v.rendererPackageName,rendererConfig:v.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:f.ReactCurrentDispatcher,findHostInstanceByFiber:aM,findFiberByHostInstance:v.findFiberByHostInstance||lM,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")v=!1;else{var D=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!D.isDisabled&&D.supportsFiber)try{$e=D.inject(v),Ua=D}catch{}v=!0}return v},r.observeVisibleRects=function(v,D,Q,H){if(!qt)throw Error(c(363));v=u2(v,D);var V=on(v,Q,H).disconnect;return{disconnect:function(){V()}}},r.registerMutableSourceForHydration=function(v,D){var Q=D._getVersion;Q=Q(D._source),v.mutableSourceEagerHydrationData==null?v.mutableSourceEagerHydrationData=[D,Q]:v.mutableSourceEagerHydrationData.push(D,Q)},r.runWithPriority=function(v,D){var Q=lc;try{return lc=v,D()}finally{lc=Q}},r.shouldSuspend=function(){return!1},r.unbatchedUpdates=function(v,D){var Q=xr;xr&=-2,xr|=8;try{return v(D)}finally{xr=Q,xr===0&&(bf(),Tn())}},r.updateContainer=function(v,D,Q,H){var V=D.current,ne=ko(),Se=Bs(V);e:if(Q){Q=Q._reactInternals;t:{if(we(Q)!==Q||Q.tag!==1)throw Error(c(170));var _e=Q;do{switch(_e.tag){case 3:_e=_e.stateNode.context;break t;case 1:if(Kn(_e.type)){_e=_e.stateNode.__reactInternalMemoizedMergedChildContext;break t}}_e=_e.return}while(_e!==null);throw Error(c(171))}if(Q.tag===1){var pt=Q.type;if(Kn(pt)){Q=Oa(Q,pt,_e);break e}}Q=_e}else Q=la;return D.context===null?D.context=Q:D.pendingContext=Q,D=Dl(ne,Se),D.payload={element:v},H=H===void 0?null:H,H!==null&&(D.callback=H),bl(V,D),Tl(V,Se,ne),Se},r}});var Swe=_((vKt,vwe)=>{"use strict";vwe.exports=Bwe()});var bwe=_((SKt,Dwe)=>{"use strict";var Spt={ALIGN_COUNT:8,ALIGN_AUTO:0,ALIGN_FLEX_START:1,ALIGN_CENTER:2,ALIGN_FLEX_END:3,ALIGN_STRETCH:4,ALIGN_BASELINE:5,ALIGN_SPACE_BETWEEN:6,ALIGN_SPACE_AROUND:7,DIMENSION_COUNT:2,DIMENSION_WIDTH:0,DIMENSION_HEIGHT:1,DIRECTION_COUNT:3,DIRECTION_INHERIT:0,DIRECTION_LTR:1,DIRECTION_RTL:2,DISPLAY_COUNT:2,DISPLAY_FLEX:0,DISPLAY_NONE:1,EDGE_COUNT:9,EDGE_LEFT:0,EDGE_TOP:1,EDGE_RIGHT:2,EDGE_BOTTOM:3,EDGE_START:4,EDGE_END:5,EDGE_HORIZONTAL:6,EDGE_VERTICAL:7,EDGE_ALL:8,EXPERIMENTAL_FEATURE_COUNT:1,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:0,FLEX_DIRECTION_COUNT:4,FLEX_DIRECTION_COLUMN:0,FLEX_DIRECTION_COLUMN_REVERSE:1,FLEX_DIRECTION_ROW:2,FLEX_DIRECTION_ROW_REVERSE:3,JUSTIFY_COUNT:6,JUSTIFY_FLEX_START:0,JUSTIFY_CENTER:1,JUSTIFY_FLEX_END:2,JUSTIFY_SPACE_BETWEEN:3,JUSTIFY_SPACE_AROUND:4,JUSTIFY_SPACE_EVENLY:5,LOG_LEVEL_COUNT:6,LOG_LEVEL_ERROR:0,LOG_LEVEL_WARN:1,LOG_LEVEL_INFO:2,LOG_LEVEL_DEBUG:3,LOG_LEVEL_VERBOSE:4,LOG_LEVEL_FATAL:5,MEASURE_MODE_COUNT:3,MEASURE_MODE_UNDEFINED:0,MEASURE_MODE_EXACTLY:1,MEASURE_MODE_AT_MOST:2,NODE_TYPE_COUNT:2,NODE_TYPE_DEFAULT:0,NODE_TYPE_TEXT:1,OVERFLOW_COUNT:3,OVERFLOW_VISIBLE:0,OVERFLOW_HIDDEN:1,OVERFLOW_SCROLL:2,POSITION_TYPE_COUNT:2,POSITION_TYPE_RELATIVE:0,POSITION_TYPE_ABSOLUTE:1,PRINT_OPTIONS_COUNT:3,PRINT_OPTIONS_LAYOUT:1,PRINT_OPTIONS_STYLE:2,PRINT_OPTIONS_CHILDREN:4,UNIT_COUNT:4,UNIT_UNDEFINED:0,UNIT_POINT:1,UNIT_PERCENT:2,UNIT_AUTO:3,WRAP_COUNT:3,WRAP_NO_WRAP:0,WRAP_WRAP:1,WRAP_WRAP_REVERSE:2};Dwe.exports=Spt});var Qwe=_((DKt,kwe)=>{"use strict";var Dpt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},FF=function(){function t(e,r){for(var s=0;s<r.length;s++){var a=r[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,r,s){return r&&t(e.prototype,r),s&&t(e,s),e}}();function V9(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function J9(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var tf=bwe(),bpt=function(){function t(e,r,s,a,n,c){J9(this,t),this.left=e,this.right=r,this.top=s,this.bottom=a,this.width=n,this.height=c}return FF(t,[{key:"fromJS",value:function(r){r(this.left,this.right,this.top,this.bottom,this.width,this.height)}},{key:"toString",value:function(){return"<Layout#"+this.left+":"+this.right+";"+this.top+":"+this.bottom+";"+this.width+":"+this.height+">"}}]),t}(),Pwe=function(){FF(t,null,[{key:"fromJS",value:function(r){var s=r.width,a=r.height;return new t(s,a)}}]);function t(e,r){J9(this,t),this.width=e,this.height=r}return FF(t,[{key:"fromJS",value:function(r){r(this.width,this.height)}},{key:"toStri Line truncated
`+Module.extraStackTrace()),demangleAll(t)}Module.stackTrace=stackTrace;var HEAP,buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module.HEAP8=HEAP8=new Int8Array(buffer),Module.HEAP16=HEAP16=new Int16Array(buffer),Module.HEAP32=HEAP32=new Int32Array(buffer),Module.HEAPU8=HEAPU8=new Uint8Array(buffer),Module.HEAPU16=HEAPU16=new Uint16Array(buffer),Module.HEAPU32=HEAPU32=new Uint32Array(buffer),Module.HEAPF32=HEAPF32=new Float32Array(buffer),Module.HEAPF64=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed,STACK_BASE,STACKTOP,STACK_MAX,DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0,staticSealed=!1;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module.TOTAL_STACK||5242880,TOTAL_MEMORY=Module.TOTAL_MEMORY||134217728;TOTAL_MEMORY<TOTAL_STACK&&Module.printErr("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+TOTAL_MEMORY+"! (TOTAL_STACK="+TOTAL_STACK+")"),Module.buffer?buffer=Module.buffer:buffer=new ArrayBuffer(TOTAL_MEMORY),updateGlobalBufferViews();function getTotalMemory(){return TOTAL_MEMORY}if(HEAP32[0]=1668509029,HEAP16[1]=25459,HEAPU8[2]!==115||HEAPU8[3]!==99)throw"Runtime error: expected the system to be little-endian!";Module.HEAP=HEAP,Module.buffer=buffer,Module.HEAP8=HEAP8,Module.HEAP16=HEAP16,Module.HEAP32=HEAP32,Module.HEAPU8=HEAPU8,Module.HEAPU16=HEAPU16,Module.HEAPU32=HEAPU32,Module.HEAPF32=HEAPF32,Module.HEAPF64=HEAPF64;function callRuntimeCallbacks(t){for(;t.length>0;){var e=t.shift();if(typeof e=="function"){e();continue}var r=e.func;typeof r=="number"?e.arg===void 0?Module.dynCall_v(r):Module.dynCall_vi(r,e.arg):r(e.arg===void 0?null:e.arg)}}var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATEXIT__=[],__ATPOSTRUN__=[],runtimeInitialized=!1,runtimeExited=!1;function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){runtimeInitialized||(runtimeInitialized=!0,callRuntimeCallbacks(__ATINIT__))}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__),runtimeExited=!0}function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(t){__ATPRERUN__.unshift(t)}Module.addOnPreRun=addOnPreRun;function addOnInit(t){__ATINIT__.unshift(t)}Module.addOnInit=addOnInit;function addOnPreMain(t){__ATMAIN__.unshift(t)}Module.addOnPreMain=addOnPreMain;function addOnExit(t){__ATEXIT__.unshift(t)}Module.addOnExit=addOnExit;function addOnPostRun(t){__ATPOSTRUN__.unshift(t)}Module.addOnPostRun=addOnPostRun;function intArrayFromString(t,e,r){var s=r>0?r:lengthBytesUTF8(t)+1,a=new Array(s),n=stringToUTF8Array(t,a,0,a.length);return e&&(a.length=n),a}Module.intArrayFromString=intArrayFromString;function intArrayToString(t){for(var e=[],r=0;r<t.length;r++){var s=t[r];s>255&&(s&=255),e.push(String.fromCharCode(s))}return e.join("")}Module.intArrayToString=intArrayToString;function writeStringToMemory(t,e,r){Runtime.warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");var s,a;r&&(a=e+lengthBytesUTF8(t),s=HEAP8[a]),stringToUTF8(t,e,1/0),r&&(HEAP8[a]=s)}Module.writeStringToMemory=writeStringToMemory;function writeArrayToMemory(t,e){HEAP8.set(t,e)}Module.writeArrayToMemory=writeArrayToMemory;function writeAsciiToMemory(t,e,r){for(var s=0;s<t.length;++s)HEAP8[e++>>0]=t.charCodeAt(s);r||(HEAP8[e>>0]=0)}if(Module.writeAsciiToMemory=writeAsciiToMemory,(!Math.imul||Math.imul(4294967295,5)!==-5)&&(Math.imul=function t(e,r){var s=e>>>16,a=e&65535,n=r>>>16,c=r&65535;return a*c+(s*c+a*n<<16)|0}),Math.imul=Math.imul,!Math.fround){var froundBuffer=new Float32Array(1);Math.fround=function(t){return froundBuffer[0]=t,froundBuffer[0]}}Math.fround=Math.fround,Math.clz32||(Math.clz32=function(t){t=t>>>0;for(var e=0;e<32;e++)if(t&1<<31-e)return e;return 32}),Math.clz32=Math.clz32,Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Math.trunc=Math.trunc;var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.cei Line truncated
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.`,r="abort("+t+") at "+stackTrace()+e;throw abortDecorators&&abortDecorators.forEach(function(s){r=s(r,t)}),r}if(Module.abort=Module.abort=abort,Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var shouldRunNow=!0;Module.noInitialRun&&(shouldRunNow=!1),run()})});var Fm=_((PKt,Rwe)=>{"use strict";var Ppt=Qwe(),xpt=Twe(),K9=!1,z9=null;xpt({},function(t,e){if(!K9){if(K9=!0,t)throw t;z9=e}});if(!K9)throw new Error("Failed to load the yoga module - it needed to be loaded synchronously, but didn't");Rwe.exports=Ppt(z9.bind,z9.lib)});var Z9=_((xKt,X9)=>{"use strict";var Fwe=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);X9.exports=Fwe;X9.exports.default=Fwe});var Owe=_((kKt,Nwe)=>{"use strict";Nwe.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E Line truncated
`))e=Math.max(e,Rpt(r));return e};eW.exports=Mwe;eW.exports.default=Mwe});var Uwe=_(qS=>{"use strict";var Fpt=qS&&qS.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qS,"__esModule",{value:!0});var Npt=Fpt(tW()),rW={};qS.default=t=>{if(t.length===0)return{width:0,height:0};if(rW[t])return rW[t];let e=Npt.default(t),r=t.split(`
`).length;return rW[t]={width:e,height:r},{width:e,height:r}}});var _we=_(WS=>{"use strict";var Opt=WS&&WS.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(WS,"__esModule",{value:!0});var bn=Opt(Fm()),Lpt=(t,e)=>{"position"in e&&t.setPositionType(e.position==="absolute"?bn.default.POSITION_TYPE_ABSOLUTE:bn.default.POSITION_TYPE_RELATIVE)},Mpt=(t,e)=>{"marginLeft"in e&&t.setMargin(bn.default.EDGE_START,e.marginLeft||0),"marginRight"in e&&t.setMargin(bn.default.EDGE_END,e.marginRight||0),"marginTop"in e&&t.setMargin(bn.default.EDGE_TOP,e.marginTop||0),"marginBottom"in e&&t.setMargin(bn.default.EDGE_BOTTOM,e.marginBottom||0)},Upt=(t,e)=>{"paddingLeft"in e&&t.setPadding(bn.default.EDGE_LEFT,e.paddingLeft||0),"paddingRight"in e&&t.setPadding(bn.default.EDGE_RIGHT,e.paddingRight||0),"paddingTop"in e&&t.setPadding(bn.default.EDGE_TOP,e.paddingTop||0),"paddingBottom"in e&&t.setPadding(bn.default.EDGE_BOTTOM,e.paddingBottom||0)},_pt=(t,e)=>{var r;"flexGrow"in e&&t.setFlexGrow((r=e.flexGrow)!==null&&r!==void 0?r:0),"flexShrink"in e&&t.setFlexShrink(typeof e.flexShrink=="number"?e.flexShrink:1),"flexDirection"in e&&(e.flexDirection==="row"&&t.setFlexDirection(bn.default.FLEX_DIRECTION_ROW),e.flexDirection==="row-reverse"&&t.setFlexDirection(bn.default.FLEX_DIRECTION_ROW_REVERSE),e.flexDirection==="column"&&t.setFlexDirection(bn.default.FLEX_DIRECTION_COLUMN),e.flexDirection==="column-reverse"&&t.setFlexDirection(bn.default.FLEX_DIRECTION_COLUMN_REVERSE)),"flexBasis"in e&&(typeof e.flexBasis=="number"?t.setFlexBasis(e.flexBasis):typeof e.flexBasis=="string"?t.setFlexBasisPercent(Number.parseInt(e.flexBasis,10)):t.setFlexBasis(NaN)),"alignItems"in e&&((e.alignItems==="stretch"||!e.alignItems)&&t.setAlignItems(bn.default.ALIGN_STRETCH),e.alignItems==="flex-start"&&t.setAlignItems(bn.default.ALIGN_FLEX_START),e.alignItems==="center"&&t.setAlignItems(bn.default.ALIGN_CENTER),e.alignItems==="flex-end"&&t.setAlignItems(bn.default.ALIGN_FLEX_END)),"alignSelf"in e&&((e.alignSelf==="auto"||!e.alignSelf)&&t.setAlignSelf(bn.default.ALIGN_AUTO),e.alignSelf==="flex-start"&&t.setAlignSelf(bn.default.ALIGN_FLEX_START),e.alignSelf==="center"&&t.setAlignSelf(bn.default.ALIGN_CENTER),e.alignSelf==="flex-end"&&t.setAlignSelf(bn.default.ALIGN_FLEX_END)),"justifyContent"in e&&((e.justifyContent==="flex-start"||!e.justifyContent)&&t.setJustifyContent(bn.default.JUSTIFY_FLEX_START),e.justifyContent==="center"&&t.setJustifyContent(bn.default.JUSTIFY_CENTER),e.justifyContent==="flex-end"&&t.setJustifyContent(bn.default.JUSTIFY_FLEX_END),e.justifyContent==="space-between"&&t.setJustifyContent(bn.default.JUSTIFY_SPACE_BETWEEN),e.justifyContent==="space-around"&&t.setJustifyContent(bn.default.JUSTIFY_SPACE_AROUND))},Hpt=(t,e)=>{var r,s;"width"in e&&(typeof e.width=="number"?t.setWidth(e.width):typeof e.width=="string"?t.setWidthPercent(Number.parseInt(e.width,10)):t.setWidthAuto()),"height"in e&&(typeof e.height=="number"?t.setHeight(e.height):typeof e.height=="string"?t.setHeightPercent(Number.parseInt(e.height,10)):t.setHeightAuto()),"minWidth"in e&&(typeof e.minWidth=="string"?t.setMinWidthPercent(Number.parseInt(e.minWidth,10)):t.setMinWidth((r=e.minWidth)!==null&&r!==void 0?r:0)),"minHeight"in e&&(typeof e.minHeight=="string"?t.setMinHeightPercent(Number.parseInt(e.minHeight,10)):t.setMinHeight((s=e.minHeight)!==null&&s!==void 0?s:0))},jpt=(t,e)=>{"display"in e&&t.setDisplay(e.display==="flex"?bn.default.DISPLAY_FLEX:bn.default.DISPLAY_NONE)},Gpt=(t,e)=>{if("borderStyle"in e){let r=typeof e.borderStyle=="string"?1:0;t.setBorder(bn.default.EDGE_TOP,r),t.setBorder(bn.default.EDGE_BOTTOM,r),t.setBorder(bn.default.EDGE_LEFT,r),t.setBorder(bn.default.EDGE_RIGHT,r)}};WS.default=(t,e={})=>{Lpt(t,e),Mpt(t,e),Upt(t,e),_pt(t,e),Hpt(t,e),jpt(t,e),Gpt(t,e)}});var Gwe=_((NKt,jwe)=>{"use strict";var YS=GS(),qpt=dk(),Wpt=sk(),iW=new Set(["\x1B","\x9B"]),Ypt=39,Hwe=t=>`${iW.values().next().value}[${t}m`,Vpt=t=>t.split(" ").map(e=>YS(e)),nW=(t,e,r)=>{let s=[...e],a=!1,n=YS(qpt(t[t.length-1]));for(let[c,f]of s.entries()){let p=YS(f);if(n+p<=r?t[t.length-1]+=f:(t.push(f),n=0),iW.has(f))a=!0;else if(a&&f==="m"){a=!1;continue}a||(n+=p,n===r&&c<s.length-1&&(t.push(""),n=0))}!n&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},Jpt=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(YS(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Kpt=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let s="",a="",n,c=Vpt(t),f=[""];for(let[p,h]of t.split(" ").entries()){r.trim!==!1&&(f[f.length-1]=f[f.length-1].trimLeft());let E=YS(f[f.length-1]);if(p!==0&&(E>=e&&(r.wordWrap===!1||r.trim===!1)&&(f.push(""),E=0),(E>0||r.trim===!1)&&(f[f.length-1]+=" ",E++)),r.hard&&c[p]>e){let C=e-E,S=1+Math.floor((c[p]-C-1)/e);Math.floor((c[p]-1)/e)<S&&f.push(""),nW(f,h,e);continue}if(E+c[p]>e&&E>0&&c[p]>0){if(r.wordWrap===!1&&E<e){nW(f,h,e);continue}f.push("")}if(E+c[p]>e&&r.wordWrap===!1){nW(f,h,e);continue}f[f. Line truncated
`);for(let[p,h]of[...s].entries()){if(a+=h,iW.has(h)){let C=parseFloat(/\d[^m]*/.exec(s.slice(p,p+4)));n=C===Ypt?null:C}let E=Wpt.codes.get(Number(n));n&&E&&(s[p+1]===`
`?a+=Hwe(E):h===`
`&&(a+=Hwe(n)))}return a};jwe.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
`).split(`
`).map(s=>Kpt(s,e,r)).join(`
`)});var Ywe=_((OKt,Wwe)=>{"use strict";var qwe="[\uD800-\uDBFF][\uDC00-\uDFFF]",zpt=t=>t&&t.exact?new RegExp(`^${qwe}$`):new RegExp(qwe,"g");Wwe.exports=zpt});var sW=_((LKt,zwe)=>{"use strict";var Xpt=Z9(),Zpt=Ywe(),Vwe=sk(),Kwe=["\x1B","\x9B"],NF=t=>`${Kwe[0]}[${t}m`,Jwe=(t,e,r)=>{let s=[];t=[...t];for(let a of t){let n=a;a.match(";")&&(a=a.split(";")[0][0]+"0");let c=Vwe.codes.get(parseInt(a,10));if(c){let f=t.indexOf(c.toString());f>=0?t.splice(f,1):s.push(NF(e?c:n))}else if(e){s.push(NF(0));break}else s.push(NF(n))}if(e&&(s=s.filter((a,n)=>s.indexOf(a)===n),r!==void 0)){let a=NF(Vwe.codes.get(parseInt(r,10)));s=s.reduce((n,c)=>c===a?[c,...n]:[...n,c],[])}return s.join("")};zwe.exports=(t,e,r)=>{let s=[...t.normalize()],a=[];r=typeof r=="number"?r:s.length;let n=!1,c,f=0,p="";for(let[h,E]of s.entries()){let C=!1;if(Kwe.includes(E)){let S=/\d[^m]*/.exec(t.slice(h,h+18));c=S&&S.length>0?S[0]:void 0,f<r&&(n=!0,c!==void 0&&a.push(c))}else n&&E==="m"&&(n=!1,C=!0);if(!n&&!C&&++f,!Zpt({exact:!0}).test(E)&&Xpt(E.codePointAt())&&++f,f>e&&f<=r)p+=E;else if(f===e&&!n&&c!==void 0)p=Jwe(a);else if(f>=r){p+=Jwe(a,!0,c);break}}return p}});var Zwe=_((MKt,Xwe)=>{"use strict";var $0=sW(),$pt=GS();function OF(t,e,r){if(t.charAt(e)===" ")return e;for(let s=1;s<=3;s++)if(r){if(t.charAt(e+s)===" ")return e+s}else if(t.charAt(e-s)===" ")return e-s;return e}Xwe.exports=(t,e,r)=>{r={position:"end",preferTruncationOnSpace:!1,...r};let{position:s,space:a,preferTruncationOnSpace:n}=r,c="\u2026",f=1;if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof e!="number")throw new TypeError(`Expected \`columns\` to be a number, got ${typeof e}`);if(e<1)return"";if(e===1)return c;let p=$pt(t);if(p<=e)return t;if(s==="start"){if(n){let h=OF(t,p-e+1,!0);return c+$0(t,h,p).trim()}return a===!0&&(c+=" ",f=2),c+$0(t,p-e+f,p)}if(s==="middle"){a===!0&&(c=" "+c+" ",f=3);let h=Math.floor(e/2);if(n){let E=OF(t,h),C=OF(t,p-(e-h)+1,!0);return $0(t,0,E)+c+$0(t,C,p).trim()}return $0(t,0,h)+c+$0(t,p-(e-h)+f,p)}if(s==="end"){if(n){let h=OF(t,e-1);return $0(t,0,h)+c}return a===!0&&(c=" "+c,f=2),$0(t,0,e-f)+c}throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${s}`)}});var aW=_(VS=>{"use strict";var $we=VS&&VS.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(VS,"__esModule",{value:!0});var eht=$we(Gwe()),tht=$we(Zwe()),oW={};VS.default=(t,e,r)=>{let s=t+String(e)+String(r);if(oW[s])return oW[s];let a=t;if(r==="wrap"&&(a=eht.default(t,e,{trim:!1,hard:!0})),r.startsWith("truncate")){let n="end";r==="truncate-middle"&&(n="middle"),r==="truncate-start"&&(n="start"),a=tht.default(t,e,{position:n})}return oW[s]=a,a}});var cW=_(lW=>{"use strict";Object.defineProperty(lW,"__esModule",{value:!0});var e1e=t=>{let e="";if(t.childNodes.length>0)for(let r of t.childNodes){let s="";r.nodeName==="#text"?s=r.nodeValue:((r.nodeName==="ink-text"||r.nodeName==="ink-virtual-text")&&(s=e1e(r)),s.length>0&&typeof r.internal_transform=="function"&&(s=r.internal_transform(s))),e+=s}return e};lW.default=e1e});var uW=_(bi=>{"use strict";var JS=bi&&bi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(bi,"__esModule",{value:!0});bi.setTextNodeValue=bi.createTextNode=bi.setStyle=bi.setAttribute=bi.removeChildNode=bi.insertBeforeNode=bi.appendChildNode=bi.createNode=bi.TEXT_NAME=void 0;var rht=JS(Fm()),t1e=JS(Uwe()),nht=JS(_we()),iht=JS(aW()),sht=JS(cW());bi.TEXT_NAME="#text";bi.createNode=t=>{var e;let r={nodeName:t,style:{},attributes:{},childNodes:[],parentNode:null,yogaNode:t==="ink-virtual-text"?void 0:rht.default.Node.create()};return t==="ink-text"&&((e=r.yogaNode)===null||e===void 0||e.setMeasureFunc(oht.bind(null,r))),r};bi.appendChildNode=(t,e)=>{var r;e.parentNode&&bi.removeChildNode(e.parentNode,e),e.parentNode=t,t.childNodes.push(e),e.yogaNode&&((r=t.yogaNode)===null||r===void 0||r.insertChild(e.yogaNode,t.yogaNode.getChildCount())),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&LF(t)};bi.insertBeforeNode=(t,e,r)=>{var s,a;e.parentNode&&bi.removeChildNode(e.parentNode,e),e.parentNode=t;let n=t.childNodes.indexOf(r);if(n>=0){t.childNodes.splice(n,0,e),e.yogaNode&&((s=t.yogaNode)===null||s===void 0||s.insertChild(e.yogaNode,n));return}t.childNodes.push(e),e.yogaNode&&((a=t.yogaNode)===null||a===void 0||a.insertChild(e.yogaNode,t.yogaNode.getChildCount())),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&LF(t)};bi.removeChildNode=(t,e)=>{var r,s;e.yogaNode&&((s=(r=e.parentNode)===null||r===void 0?void 0:r.yogaNode)===null||s===void 0||s.removeChild(e.yogaNode)),e.parentNode=null;let a=t.childNodes.indexOf(e);a>=0&&t.childNodes.splice(a,1),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&LF(t)};bi.setAttribute=(t,e,r)=>{t.attributes[e]=r};bi.setStyle=(t,e)=>{t.style=e,t.yogaNode&&nht.default(t.yogaNode,e)};bi.createTextNode=t=>{let e={nodeName:"#text",nodeValue:t,yogaLine truncated
`).repeat(n-2),E=pW.default(f.bottomLeft+f.horizontal.repeat(a-2)+f.bottomRight,c,"foreground");s.write(t,e,p,{transformers:[]}),s.write(t,e+1,h,{transformers:[]}),s.write(t+a-1,e+1,h,{transformers:[]}),s.write(t,e+n-1,E,{transformers:[]})}}});var m1e=_(eD=>{"use strict";var Nm=eD&&eD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(eD,"__esModule",{value:!0});var hht=Nm(Fm()),ght=Nm(tW()),dht=Nm(c1e()),mht=Nm(aW()),yht=Nm(u1e()),Eht=Nm(cW()),Iht=Nm(g1e()),Cht=(t,e)=>{var r;let s=(r=t.childNodes[0])===null||r===void 0?void 0:r.yogaNode;if(s){let a=s.getComputedLeft(),n=s.getComputedTop();e=`
`.repeat(n)+dht.default(e,a)}return e},d1e=(t,e,r)=>{var s;let{offsetX:a=0,offsetY:n=0,transformers:c=[],skipStaticElements:f}=r;if(f&&t.internal_static)return;let{yogaNode:p}=t;if(p){if(p.getDisplay()===hht.default.DISPLAY_NONE)return;let h=a+p.getComputedLeft(),E=n+p.getComputedTop(),C=c;if(typeof t.internal_transform=="function"&&(C=[t.internal_transform,...c]),t.nodeName==="ink-text"){let S=Eht.default(t);if(S.length>0){let P=ght.default(S),I=yht.default(p);if(P>I){let R=(s=t.style.textWrap)!==null&&s!==void 0?s:"wrap";S=mht.default(S,I,R)}S=Cht(t,S),e.write(h,E,S,{transformers:C})}return}if(t.nodeName==="ink-box"&&Iht.default(h,E,t,e),t.nodeName==="ink-root"||t.nodeName==="ink-box")for(let S of t.childNodes)d1e(S,e,{offsetX:h,offsetY:E,transformers:C,skipStaticElements:f})}};eD.default=d1e});var I1e=_(tD=>{"use strict";var E1e=tD&&tD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(tD,"__esModule",{value:!0});var y1e=E1e(sW()),wht=E1e(GS()),hW=class{constructor(e){this.writes=[];let{width:r,height:s}=e;this.width=r,this.height=s}write(e,r,s,a){let{transformers:n}=a;s&&this.writes.push({x:e,y:r,text:s,transformers:n})}get(){let e=[];for(let s=0;s<this.height;s++)e.push(" ".repeat(this.width));for(let s of this.writes){let{x:a,y:n,text:c,transformers:f}=s,p=c.split(`
`),h=0;for(let E of p){let C=e[n+h];if(!C)continue;let S=wht.default(E);for(let P of f)E=P(E);e[n+h]=y1e.default(C,0,a)+E+y1e.default(C,a+S),h++}}return{output:e.map(s=>s.trimRight()).join(`
`),height:e.length}}};tD.default=hW});var B1e=_(rD=>{"use strict";var gW=rD&&rD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rD,"__esModule",{value:!0});var Bht=gW(Fm()),C1e=gW(m1e()),w1e=gW(I1e());rD.default=(t,e)=>{var r;if(t.yogaNode.setWidth(e),t.yogaNode){t.yogaNode.calculateLayout(void 0,void 0,Bht.default.DIRECTION_LTR);let s=new w1e.default({width:t.yogaNode.getComputedWidth(),height:t.yogaNode.getComputedHeight()});C1e.default(t,s,{skipStaticElements:!0});let a;!((r=t.staticNode)===null||r===void 0)&&r.yogaNode&&(a=new w1e.default({width:t.staticNode.yogaNode.getComputedWidth(),height:t.staticNode.yogaNode.getComputedHeight()}),C1e.default(t.staticNode,a,{skipStaticElements:!1}));let{output:n,height:c}=s.get();return{output:n,outputHeight:c,staticOutput:a?`${a.get().output}
`:""}}return{output:"",outputHeight:0,staticOutput:""}}});var b1e=_((ZKt,D1e)=>{"use strict";var v1e=Ie("stream"),S1e=["assert","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],dW={},vht=t=>{let e=new v1e.PassThrough,r=new v1e.PassThrough;e.write=a=>t("stdout",a),r.write=a=>t("stderr",a);let s=new console.Console(e,r);for(let a of S1e)dW[a]=console[a],console[a]=s[a];return()=>{for(let a of S1e)console[a]=dW[a];dW={}}};D1e.exports=vht});var yW=_(mW=>{"use strict";Object.defineProperty(mW,"__esModule",{value:!0});mW.default=new WeakMap});var IW=_(EW=>{"use strict";Object.defineProperty(EW,"__esModule",{value:!0});var Sht=hn(),P1e=Sht.createContext({exit:()=>{}});P1e.displayName="InternalAppContext";EW.default=P1e});var wW=_(CW=>{"use strict";Object.defineProperty(CW,"__esModule",{value:!0});var Dht=hn(),x1e=Dht.createContext({stdin:void 0,setRawMode:()=>{},isRawModeSupported:!1,internal_exitOnCtrlC:!0});x1e.displayName="InternalStdinContext";CW.default=x1e});var vW=_(BW=>{"use strict";Object.defineProperty(BW,"__esModule",{value:!0});var bht=hn(),k1e=bht.createContext({stdout:void 0,write:()=>{}});k1e.displayName="InternalStdoutContext";BW.default=k1e});var DW=_(SW=>{"use strict";Object.defineProperty(SW,"__esModule",{value:!0});var Pht=hn(),Q1e=Pht.createContext({stderr:void 0,write:()=>{}});Q1e.displayName="InternalStderrContext";SW.default=Q1e});var _F=_(bW=>{"use strict";Object.defineProperty(bW,"__esModule",{value:!0});var xht=hn(),T1e=xht.createContext({activeId:void 0,add:()=>{},remove:()=>{},activate:()=>{},deactivate:()=>{},enableFocus:()=>{},disableFocus:()=>{},focusNext:()=>{},focusPrevious:()=>{},focus:()=>{}});T1e.displayName="InternalFocusContext";bW.default=T1e});var F1e=_((szt,R1e)=>{"use strict";var kht=/[|\\{}()[\]^$+*?.-]/g;R1e.exports=t=>{if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(kht,"\\$&")}});var M1e=_((ozt,L1e)=>{"use strict";var Qht=F1e(),Tht=typeof process=="object"&&process&&typeof process.cwd=="function"?process.cwd():".",O1e=[].concat(Ie("module").builtinModules,"bootstrap_node","node").map(t=>new RegExp(`(?:\\((?:node:)?${t}(?:\\.js)?:\\d+:\\d+\\)$|^\\s*at (?:node:)?${t}(?:\\.js)?:\\d+:\\d+$)`));O1e.push(/\((?:node:)?internal\/[^:]+:\d+:\d+\)$/,/\s*at (?:node:)?internal\/[^:]+:\d+:\d+$/,/\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/);var PW=class t{constructor(e){e={ignoredPackages:[],...e},"internals"in e||(e.internals=t.nodeInternals()),"cwd"in e||(e.cwd=Tht),this._cwd=e.cwd.replace(/\\/g,"/"),this._internals=[].concat(e.internals,Rht(e.ignoredPackages)),this._wrapCallSite=e.wrapCallSite||!1}static nodeInternals(){return[...O1e]}clean(e,r=0){r=" ".repeat(r),Array.isArray(e)||(e=e.split(`
`)),!/^\s*at /.test(e[0])&&/^\s*at /.test(e[1])&&(e=e.slice(1));let s=!1,a=null,n=[];return e.forEach(c=>{if(c=c.replace(/\\/g,"/"),this._internals.some(p=>p.test(c)))return;let f=/^\s*at /.test(c);s?c=c.trimEnd().replace(/^(\s+)at /,"$1"):(c=c.trim(),f&&(c=c.slice(3))),c=c.replace(`${this._cwd}/`,""),c&&(f?(a&&(n.push(a),a=null),n.push(c)):(s=!0,a=c))}),n.map(c=>`${r}${c}
`).join("")}captureString(e,r=this.captureString){typeof e=="function"&&(r=e,e=1/0);let{stackTraceLimit:s}=Error;e&&(Error.stackTraceLimit=e);let a={};Error.captureStackTrace(a,r);let{stack:n}=a;return Error.stackTraceLimit=s,this.clean(n)}capture(e,r=this.capture){typeof e=="function"&&(r=e,e=1/0);let{prepareStackTrace:s,stackTraceLimit:a}=Error;Error.prepareStackTrace=(f,p)=>this._wrapCallSite?p.map(this._wrapCallSite):p,e&&(Error.stackTraceLimit=e);let n={};Error.captureStackTrace(n,r);let{stack:c}=n;return Object.assign(Error,{prepareStackTrace:s,stackTraceLimit:a}),c}at(e=this.at){let[r]=this.capture(1,e);if(!r)return{};let s={line:r.getLineNumber(),column:r.getColumnNumber()};N1e(s,r.getFileName(),this._cwd),r.isConstructor()&&(s.constructor=!0),r.isEval()&&(s.evalOrigin=r.getEvalOrigin()),r.isNative()&&(s.native=!0);let a;try{a=r.getTypeName()}catch{}a&&a!=="Object"&&a!=="[object Object]"&&(s.type=a);let n=r.getFunctionName();n&&(s.function=n);let c=r.getMethodName();return c&&n!==c&&(s.method=c),s}parseLine(e){let r=e&&e.match(Fht);if(!r)return null;let s=r[1]==="new",a=r[2],n=r[3],c=r[4],f=Number(r[5]),p=Number(r[6]),h=r[7],E=r[8],C=r[9],S=r[10]==="native",P=r[11]===")",I,R={};if(E&&(R.line=Number(E)),C&&(R.column=Number(C)),P&&h){let N=0;for(let U=h.length-1;U>0;U--)if(h.charAt(U)===")")N++;else if(h.charAt(U)==="("&&h.charAt(U-1)===" "&&(N--,N===-1&&h.charAt(U-1)===" ")){let W=h.slice(0,U-1);h=h.slice(U+1),a+=` (${W}`;break}}if(a){let N=a.match(Nht);N&&(a=N[1],I=N[2])}return N1e(R,h,this._cwd),s&&(R.constructor=!0),n&&(R.evalOrigin=n,R.evalLine=f,R.evalColumn=p,R.evalFile=c&&c.replace(/\\/g,"/")),S&&(R.native=!0),a&&(R.function=a),I&&a!==I&&(R.method=I),R}};function N1e(t,e,r){e&&(e=e.replace(/\\/g,"/"),e.startsWith(`${r}/`)&&(e=e.slice(r.length+1)),t.file=e)}function Rht(t){if(t.length===0)return[];let e=t.map(r=>Qht(r));return new RegExp(`[/\\\\]node_modules[/\\\\](?:${e.join("|")})[/\\\\][^:]+:\\d+:\\d+`)}var Fht=new RegExp("^(?:\\s*at )?(?:(new) )?(?:(.*?) \\()?(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?(?:(.+?):(\\d+):(\\d+)|(native))(\\)?)$"),Nht=/^(.*?) \[as (.*?)\]$/;L1e.exports=PW});var _1e=_((azt,U1e)=>{"use strict";U1e.exports=(t,e)=>t.replace(/^\t+/gm,r=>" ".repeat(r.length*(e||2)))});var j1e=_((lzt,H1e)=>{"use strict";var Oht=_1e(),Lht=(t,e)=>{let r=[],s=t-e,a=t+e;for(let n=s;n<=a;n++)r.push(n);return r};H1e.exports=(t,e,r)=>{if(typeof t!="string")throw new TypeError("Source code is missing.");if(!e||e<1)throw new TypeError("Line number must start from `1`.");if(t=Oht(t).split(/\r?\n/),!(e>t.length))return r={around:3,...r},Lht(e,r.around).filter(s=>t[s-1]!==void 0).map(s=>({line:s,value:t[s-1]}))}});var HF=_(rf=>{"use strict";var Mht=rf&&rf.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),Uht=rf&&rf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_ht=rf&&rf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&Mht(e,t,r);return Uht(e,t),e},Hht=rf&&rf.__rest||function(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(t);a<s.length;a++)e.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(t,s[a])&&(r[s[a]]=t[s[a]]);return r};Object.defineProperty(rf,"__esModule",{value:!0});var G1e=_ht(hn()),xW=G1e.forwardRef((t,e)=>{var{children:r}=t,s=Hht(t,["children"]);let a=Object.assign(Object.assign({},s),{marginLeft:s.marginLeft||s.marginX||s.margin||0,marginRight:s.marginRight||s.marginX||s.margin||0,marginTop:s.marginTop||s.marginY||s.margin||0,marginBottom:s.marginBottom||s.marginY||s.margin||0,paddingLeft:s.paddingLeft||s.paddingX||s.padding||0,paddingRight:s.paddingRight||s.paddingX||s.padding||0,paddingTop:s.paddingTop||s.paddingY||s.padding||0,paddingBottom:s.paddingBottom||s.paddingY||s.padding||0});return G1e.default.createElement("ink-box",{ref:e,style:a},r)});xW.displayName="Box";xW.defaultProps={flexDirection:"row",flexGrow:0,flexShrink:1};rf.default=xW});var TW=_(nD=>{"use strict";var kW=nD&&nD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(nD,"__esModule",{value:!0});var jht=kW(hn()),yw=kW(TE()),q1e=kW(AW()),QW=({color:t,backgroundColor:e,dimColor:r,bold:s,italic:a,underline:n,strikethrough:c,inverse:f,wrap:p,children:h})=>{if(h==null)return null;let E=C=>(r&&(C=yw.default.dim(C)),t&&(C=q1e.default(C,t,"foreground")),e&&(C=q1e.default(C,e,"background")),s&&(C=yw.default.bold(C)),a&&(C=yw.default.italic(C)),n&&(C=yw.default.underline(C)),c&&(C=yw.default.strikethrough(C)),f&&(C=yw.default.inverse(C)),C);return jht.default.createElement("ink-text",{style:{flexGrow:0,flexSLine truncated
`).slice(1):void 0,r=e?V1e.parseLine(e[0]):void 0,s,a=0;if(r?.file&&r?.line&&W1e.existsSync(r.file)){let n=W1e.readFileSync(r.file,"utf8");if(s=Yht.default(n,r.line),s)for(let{line:c}of s)a=Math.max(a,String(c).length)}return Qs.default.createElement($p.default,{flexDirection:"column",padding:1},Qs.default.createElement($p.default,null,Qs.default.createElement(AA.default,{backgroundColor:"red",color:"white"}," ","ERROR"," "),Qs.default.createElement(AA.default,null," ",t.message)),r&&Qs.default.createElement($p.default,{marginTop:1},Qs.default.createElement(AA.default,{dimColor:!0},r.file,":",r.line,":",r.column)),r&&s&&Qs.default.createElement($p.default,{marginTop:1,flexDirection:"column"},s.map(({line:n,value:c})=>Qs.default.createElement($p.default,{key:n},Qs.default.createElement($p.default,{width:a+1},Qs.default.createElement(AA.default,{dimColor:n!==r.line,backgroundColor:n===r.line?"red":void 0,color:n===r.line?"white":void 0},String(n).padStart(a," "),":")),Qs.default.createElement(AA.default,{key:n,backgroundColor:n===r.line?"red":void 0,color:n===r.line?"white":void 0}," "+c)))),t.stack&&Qs.default.createElement($p.default,{marginTop:1,flexDirection:"column"},t.stack.split(`
`).slice(1).map(n=>{let c=V1e.parseLine(n);return c?Qs.default.createElement($p.default,{key:n},Qs.default.createElement(AA.default,{dimColor:!0},"- "),Qs.default.createElement(AA.default,{dimColor:!0,bold:!0},c.function),Qs.default.createElement(AA.default,{dimColor:!0,color:"gray"}," ","(",c.file,":",c.line,":",c.column,")")):Qs.default.createElement($p.default,{key:n},Qs.default.createElement(AA.default,{dimColor:!0},"- "),Qs.default.createElement(AA.default,{dimColor:!0,bold:!0},n))})))};nf.default=Vht});var z1e=_(sf=>{"use strict";var Jht=sf&&sf.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),Kht=sf&&sf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zht=sf&&sf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&Jht(e,t,r);return Kht(e,t),e},Lm=sf&&sf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(sf,"__esModule",{value:!0});var Om=zht(hn()),K1e=Lm(F9()),Xht=Lm(IW()),Zht=Lm(wW()),$ht=Lm(vW()),e0t=Lm(DW()),t0t=Lm(_F()),r0t=Lm(J1e()),n0t=" ",i0t="\x1B[Z",s0t="\x1B",jF=class extends Om.PureComponent{constructor(){super(...arguments),this.state={isFocusEnabled:!0,activeFocusId:void 0,focusables:[],error:void 0},this.rawModeEnabledCount=0,this.handleSetRawMode=e=>{let{stdin:r}=this.props;if(!this.isRawModeSupported())throw r===process.stdin?new Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`):new Error(`Raw mode is not supported on the stdin provided to Ink.
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(r.setEncoding("utf8"),e){this.rawModeEnabledCount===0&&(r.addListener("data",this.handleInput),r.resume(),r.setRawMode(!0)),this.rawModeEnabledCount++;return}--this.rawModeEnabledCount===0&&(r.setRawMode(!1),r.removeListener("data",this.handleInput),r.pause())},this.handleInput=e=>{e===""&&this.props.exitOnCtrlC&&this.handleExit(),e===s0t&&this.state.activeFocusId&&this.setState({activeFocusId:void 0}),this.state.isFocusEnabled&&this.state.focusables.length>0&&(e===n0t&&this.focusNext(),e===i0t&&this.focusPrevious())},this.handleExit=e=>{this.isRawModeSupported()&&this.handleSetRawMode(!1),this.props.onExit(e)},this.enableFocus=()=>{this.setState({isFocusEnabled:!0})},this.disableFocus=()=>{this.setState({isFocusEnabled:!1})},this.focus=e=>{this.setState(r=>r.focusables.some(a=>a?.id===e)?{activeFocusId:e}:r)},this.focusNext=()=>{this.setState(e=>{var r;let s=(r=e.focusables[0])===null||r===void 0?void 0:r.id;return{activeFocusId:this.findNextFocusable(e)||s}})},this.focusPrevious=()=>{this.setState(e=>{var r;let s=(r=e.focusables[e.focusables.length-1])===null||r===void 0?void 0:r.id;return{activeFocusId:this.findPreviousFocusable(e)||s}})},this.addFocusable=(e,{autoFocus:r})=>{this.setState(s=>{let a=s.activeFocusId;return!a&&r&&(a=e),{activeFocusId:a,focusables:[...s.focusables,{id:e,isActive:!0}]}})},this.removeFocusable=e=>{this.setState(r=>({activeFocusId:r.activeFocusId===e?void 0:r.activeFocusId,focusables:r.focusables.filter(s=>s.id!==e)}))},this.activateFocusable=e=>{this.setState(r=>({focusables:r.focusables.map(s=>s.id!==e?s:{id:e,isActive:!0})}))},this.deactivateFocusable=e=>{this.setState(r=>({activeFocusId:r.activeFocusId===e?void 0:r.activeFocusId,focusables:r.focusables.map(s=>s.id!==e?s:{id:e,isActive:!1})}))},this.findNextFocusable=e=>{var r;let s=e.focusables.findIndex(a=>a.id===e.activeFocusId);for(let a=s+1;a<e.focusables.length;a++)if(!((r=e.focusables[a])===null||r===void 0)&&r.isActive)return e.focusables[a].id},this.findPreviousFocusable=e=>{var r;let s=e.focusables.findIndex(a=>a.id===e.activeFocusId);for(let a=s-1;a>=0;a--)if(!((r=e.focusables[a])===null||r===void 0)&&r.isActive)return e.focusables[a].id}}static getDerivedStateFromError(e){return{error:e}}isRawModeSupported(){return this.props.stdin.isTTY}render(){return Om.default.createElement(Xht.default.Provider,{value:{exit:this.handleExit}},Om.default.createElement(Zht.default.Provider,{value:{stdin:this.props.stdin,setRawMode:this.handleSetRawMode,isRawModeSupported:this.isRawModeSupported(),internal_exitOnCtrlC:this.props.exitOnCtrlC}},Om.default.createElement($ht.default.Provider,{value:{stdout:this.props.stdout,write:this.props.writeToStdout}},Om.default.createElement(e0t.default.Provider,{value:{stderr:this.props.stderr,write:this.props.writeToStderr}},Om.default.createElement(t0t.default.Provider,{value:{activeId:this.state.activeFocusId,add:this.addFocusable,remove:this.removeFocusable,activate:this.activateFocusable,deactivate:this.deactivateFocusable,enableFocus:this.enableFocus,disableFocus:this.disableFocus,focusNext:this.focusNext,focusPrevious:this.focusPrevious,focus:this.focus}},this.state.error?Om.default.createElement(r0t.default,{error:this.state.error}):this.props.children)))))}componentDidMount(){K1e.default.hide(this.props.stdout)}componentWillUnmount(){K1e.default.show(this.props.stdout),this.isRawModeSupported()&&this.handleSetRawMode(!1)}componentDidCatch(e){this.handleExit(e)}};sf.default=jF;jF.displayName="InternalApp"});var $1e=_(of=>{"use strict";var o0t=of&&of.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),a0t=of&&of.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l0t=of&&of.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&o0t(e,t,r);return a0t(e,t),e},af=of&&of.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(of,"__esModule",{value:!0});var c0t=af(hn()),X1e=WCe(),u0t=af(awe()),f0t=af(x9()),A0t=af(pwe()),p0t=af(gwe()),RW=af(a1e()),h0t=af(B1e()),g0t=af(R9()),d0t=af(b1e()),m0t=l0t(uW()),y0t=af(yW()),E0t=af(z1e()),Ew=process.env.CI==="false"?!1:A0t.default,Z1e=()=>{},FW=class{constructor(e){this.resolveExitPromise=()=>{},this.rejectExitPromise=()=>{},this.unsubscribeExit=()=>{},this.onRender=()=>{if(this.isUnmounted)return;let{output:r,outputHeight:s,staticOutput:a}=h0t.default(this.rootNode,this.options.stdout.columns||80),n=a&&a!==`
`;if(this.options.debug){n&&(this.fullStaticOutput+=a),this.options.stdout.write(this.fullStaticOutput+r);return}if(Ew){n&&this.options.stdout.write(a),this.lastOutput=r;return}if(n&&(this.fullStaticOutput+=a),s>=this.options.stdout.rows){this.options.stdout.write(f0t.default.clearTerminal+this.fullStaticOutput+r),this.lastOutput=r;return}n&&(this.log.clear(),this.options.stdout.write(a),this.log(r)),!n&&r!==this.lastOutput&&this.throttledLog(r),this.lastOutput=r},p0t.default(this),this.options=e,this.rootNode=m0t.createNode("ink-root"),this.rootNode.onRender=e.debug?this.onRender:X1e(this.onRender,32,{leading:!0,trailing:!0}),this.rootNode.onImmediateRender=this.onRender,this.log=u0t.default.create(e.stdout),this.throttledLog=e.debug?this.log:X1e(this.log,void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.lastOutput="",this.fullStaticOutput="",this.container=RW.default.createContainer(this.rootNode,0,!1,null),this.unsubscribeExit=g0t.default(this.unmount,{alwaysLast:!1}),e.patchConsole&&this.patchConsole(),Ew||(e.stdout.on("resize",this.onRender),this.unsubscribeResize=()=>{e.stdout.off("resize",this.onRender)})}render(e){let r=c0t.default.createElement(E0t.default,{stdin:this.options.stdin,stdout:this.options.stdout,stderr:this.options.stderr,writeToStdout:this.writeToStdout,writeToStderr:this.writeToStderr,exitOnCtrlC:this.options.exitOnCtrlC,onExit:this.unmount},e);RW.default.updateContainer(r,this.container,null,Z1e)}writeToStdout(e){if(!this.isUnmounted){if(this.options.debug){this.options.stdout.write(e+this.fullStaticOutput+this.lastOutput);return}if(Ew){this.options.stdout.write(e);return}this.log.clear(),this.options.stdout.write(e),this.log(this.lastOutput)}}writeToStderr(e){if(!this.isUnmounted){if(this.options.debug){this.options.stderr.write(e),this.options.stdout.write(this.fullStaticOutput+this.lastOutput);return}if(Ew){this.options.stderr.write(e);return}this.log.clear(),this.options.stderr.write(e),this.log(this.lastOutput)}}unmount(e){this.isUnmounted||(this.onRender(),this.unsubscribeExit(),typeof this.restoreConsole=="function"&&this.restoreConsole(),typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),Ew?this.options.stdout.write(this.lastOutput+`
`):this.options.debug||this.log.done(),this.isUnmounted=!0,RW.default.updateContainer(null,this.container,null,Z1e),y0t.default.delete(this.options.stdout),e instanceof Error?this.rejectExitPromise(e):this.resolveExitPromise())}waitUntilExit(){return this.exitPromise||(this.exitPromise=new Promise((e,r)=>{this.resolveExitPromise=e,this.rejectExitPromise=r})),this.exitPromise}clear(){!Ew&&!this.options.debug&&this.log.clear()}patchConsole(){this.options.debug||(this.restoreConsole=d0t.default((e,r)=>{e==="stdout"&&this.writeToStdout(r),e==="stderr"&&(r.startsWith("The above error occurred")||this.writeToStderr(r))}))}};of.default=FW});var t2e=_(sD=>{"use strict";var e2e=sD&&sD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(sD,"__esModule",{value:!0});var I0t=e2e($1e()),GF=e2e(yW()),C0t=Ie("stream"),w0t=(t,e)=>{let r=Object.assign({stdout:process.stdout,stdin:process.stdin,stderr:process.stderr,debug:!1,exitOnCtrlC:!0,patchConsole:!0},B0t(e)),s=v0t(r.stdout,()=>new I0t.default(r));return s.render(t),{rerender:s.render,unmount:()=>s.unmount(),waitUntilExit:s.waitUntilExit,cleanup:()=>GF.default.delete(r.stdout),clear:s.clear}};sD.default=w0t;var B0t=(t={})=>t instanceof C0t.Stream?{stdout:t,stdin:process.stdin}:t,v0t=(t,e)=>{let r;return GF.default.has(t)?r=GF.default.get(t):(r=e(),GF.default.set(t,r)),r}});var n2e=_(eh=>{"use strict";var S0t=eh&&eh.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),D0t=eh&&eh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b0t=eh&&eh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&S0t(e,t,r);return D0t(e,t),e};Object.defineProperty(eh,"__esModule",{value:!0});var oD=b0t(hn()),r2e=t=>{let{items:e,children:r,style:s}=t,[a,n]=oD.useState(0),c=oD.useMemo(()=>e.slice(a),[e,a]);oD.useLayoutEffect(()=>{n(e.length)},[e.length]);let f=c.map((h,E)=>r(h,a+E)),p=oD.useMemo(()=>Object.assign({position:"absolute",flexDirection:"column"},s),[s]);return oD.default.createElement("ink-box",{internal_static:!0,style:p},f)};r2e.displayName="Static";eh.default=r2e});var s2e=_(aD=>{"use strict";var P0t=aD&&aD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(aD,"__esModule",{value:!0});var x0t=P0t(hn()),i2e=({children:t,transform:e})=>t==null?null:x0t.default.createElement("ink-text",{style:{flexGrow:0,flexShrink:1,flexDirection:"row"},internal_transform:e},t);i2e.displayName="Transform";aD.default=i2e});var a2e=_(lD=>{"use strict";var k0t=lD&&lD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lD,"__esModule",{value:!0});var Q0t=k0t(hn()),o2e=({count:t=1})=>Q0t.default.createElement("ink-text",null,`
`.repeat(t));o2e.displayName="Newline";lD.default=o2e});var u2e=_(cD=>{"use strict";var l2e=cD&&cD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cD,"__esModule",{value:!0});var T0t=l2e(hn()),R0t=l2e(HF()),c2e=()=>T0t.default.createElement(R0t.default,{flexGrow:1});c2e.displayName="Spacer";cD.default=c2e});var qF=_(uD=>{"use strict";var F0t=uD&&uD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(uD,"__esModule",{value:!0});var N0t=hn(),O0t=F0t(wW()),L0t=()=>N0t.useContext(O0t.default);uD.default=L0t});var A2e=_(fD=>{"use strict";var M0t=fD&&fD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(fD,"__esModule",{value:!0});var f2e=hn(),U0t=M0t(qF()),_0t=(t,e={})=>{let{stdin:r,setRawMode:s,internal_exitOnCtrlC:a}=U0t.default();f2e.useEffect(()=>{if(e.isActive!==!1)return s(!0),()=>{s(!1)}},[e.isActive,s]),f2e.useEffect(()=>{if(e.isActive===!1)return;let n=c=>{let f=String(c),p={upArrow:f==="\x1B[A",downArrow:f==="\x1B[B",leftArrow:f==="\x1B[D",rightArrow:f==="\x1B[C",pageDown:f==="\x1B[6~",pageUp:f==="\x1B[5~",return:f==="\r",escape:f==="\x1B",ctrl:!1,shift:!1,tab:f===" "||f==="\x1B[Z",backspace:f==="\b",delete:f==="\x7F"||f==="\x1B[3~",meta:!1};f<=""&&!p.return&&(f=String.fromCharCode(f.charCodeAt(0)+97-1),p.ctrl=!0),f.startsWith("\x1B")&&(f=f.slice(1),p.meta=!0);let h=f>="A"&&f<="Z",E=f>="\u0410"&&f<="\u042F";f.length===1&&(h||E)&&(p.shift=!0),p.tab&&f==="[Z"&&(p.shift=!0),(p.tab||p.backspace||p.delete)&&(f=""),(!(f==="c"&&p.ctrl)||!a)&&t(f,p)};return r?.on("data",n),()=>{r?.off("data",n)}},[e.isActive,r,a,t])};fD.default=_0t});var p2e=_(AD=>{"use strict";var H0t=AD&&AD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(AD,"__esModule",{value:!0});var j0t=hn(),G0t=H0t(IW()),q0t=()=>j0t.useContext(G0t.default);AD.default=q0t});var h2e=_(pD=>{"use strict";var W0t=pD&&pD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pD,"__esModule",{value:!0});var Y0t=hn(),V0t=W0t(vW()),J0t=()=>Y0t.useContext(V0t.default);pD.default=J0t});var g2e=_(hD=>{"use strict";var K0t=hD&&hD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(hD,"__esModule",{value:!0});var z0t=hn(),X0t=K0t(DW()),Z0t=()=>z0t.useContext(X0t.default);hD.default=Z0t});var m2e=_(dD=>{"use strict";var d2e=dD&&dD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(dD,"__esModule",{value:!0});var gD=hn(),$0t=d2e(_F()),egt=d2e(qF()),tgt=({isActive:t=!0,autoFocus:e=!1,id:r}={})=>{let{isRawModeSupported:s,setRawMode:a}=egt.default(),{activeId:n,add:c,remove:f,activate:p,deactivate:h,focus:E}=gD.useContext($0t.default),C=gD.useMemo(()=>r??Math.random().toString().slice(2,7),[r]);return gD.useEffect(()=>(c(C,{autoFocus:e}),()=>{f(C)}),[C,e]),gD.useEffect(()=>{t?p(C):h(C)},[t,C]),gD.useEffect(()=>{if(!(!s||!t))return a(!0),()=>{a(!1)}},[t]),{isFocused:!!C&&n===C,focus:E}};dD.default=tgt});var y2e=_(mD=>{"use strict";var rgt=mD&&mD.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mD,"__esModule",{value:!0});var ngt=hn(),igt=rgt(_F()),sgt=()=>{let t=ngt.useContext(igt.default);return{enableFocus:t.enableFocus,disableFocus:t.disableFocus,focusNext:t.focusNext,focusPrevious:t.focusPrevious,focus:t.focus}};mD.default=sgt});var E2e=_(NW=>{"use strict";Object.defineProperty(NW,"__esModule",{value:!0});NW.default=t=>{var e,r,s,a;return{width:(r=(e=t.yogaNode)===null||e===void 0?void 0:e.getComputedWidth())!==null&&r!==void 0?r:0,height:(a=(s=t.yogaNode)===null||s===void 0?void 0:s.getComputedHeight())!==null&&a!==void 0?a:0}}});var Wc=_(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});var ogt=t2e();Object.defineProperty(mo,"render",{enumerable:!0,get:function(){return ogt.default}});var agt=HF();Object.defineProperty(mo,"Box",{enumerable:!0,get:function(){return agt.default}});var lgt=TW();Object.defineProperty(mo,"Text",{enumerable:!0,get:function(){return lgt.default}});var cgt=n2e();Object.defineProperty(mo,"Static",{enumerable:!0,get:function(){return cgt.default}});var ugt=s2e();Object.defineProperty(mo,"Transform",{enumerable:!0,get:function(){return ugt.default}});var fgt=a2e();Object.defineProperty(mo,"Newline",{enumerable:!0,get:function(){return fgt.default}});var Agt=u2e();Object.defineProperty(mo,"Spacer",{enumerable:!0,get:function(){return Agt.default}});var pgt=A2e();Object.defineProperty(mo,"useInput",{enumerable:!0,get:function(){return pgt.default}});var hgt=p2e();Object.defineProperty(mo,"useApp",{enumerable:!0,get:function(){return hgt.default}});var ggt=qF();Object.defineProperty(mo,"useStdin",{enumerable:!0,get:function(){return ggt.default}});var dgt=h2e();Object.defineProperty(mo,"useStdout",{enumerable:!0,get:function(){return dgt.default}});var mgt=g2e();Object.defineProperty(mo,"useStderr",{enumerable:!0,get:function(){ Line truncated
`:"";return c?C+=`@IF EXIST ${c} (\r
${c} ${p} ${a} ${E}%*\r
) ELSE (\r
@SETLOCAL\r
@SET PATHEXT=%PATHEXT:;.JS;=;%\r
${f} ${p} ${a} ${E}%*\r
)\r
`:C+=`@${f} ${p} ${a} ${E}%*\r
`,C}function Ndt(t,e,r){let s=Vc.relative(Vc.dirname(e),t),a=r.prog&&r.prog.split("\\").join("/"),n;s=s.split("\\").join("/");let c=Vc.isAbsolute(s)?`"${s}"`:`"$basedir/${s}"`,f=r.args||"",p=DY(r.nodePath).posix;a?(n=`"$basedir/${r.prog}"`,s=c):(a=c,f="",s="");let h=r.progArgs?`${r.progArgs.join(" ")} `:"",E=`#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")
case \`uname\` in
*CYGWIN*) basedir=\`cygpath -w "$basedir"\`;;
esac
`,C=r.nodePath?`export NODE_PATH="${p}"
`:"";return n?E+=`${C}if [ -x ${n} ]; then
exec ${n} ${f} ${s} ${h}"$@"
else
exec ${a} ${f} ${s} ${h}"$@"
fi
`:E+=`${C}${a} ${f} ${s} ${h}"$@"
exit $?
`,E}function Odt(t,e,r){let s=Vc.relative(Vc.dirname(e),t),a=r.prog&&r.prog.split("\\").join("/"),n=a&&`"${a}$exe"`,c;s=s.split("\\").join("/");let f=Vc.isAbsolute(s)?`"${s}"`:`"$basedir/${s}"`,p=r.args||"",h=DY(r.nodePath),E=h.win32,C=h.posix;n?(c=`"$basedir/${r.prog}$exe"`,s=f):(n=f,p="",s="");let S=r.progArgs?`${r.progArgs.join(" ")} `:"",P=`#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
${r.nodePath?`$env_node_path=$env:NODE_PATH
$env:NODE_PATH="${E}"
`:""}if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}`;return r.nodePath&&(P+=` else {
$env:NODE_PATH="${C}"
}`),c?P+=`
$ret=0
if (Test-Path ${c}) {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & ${c} ${p} ${s} ${S}$args
} else {
& ${c} ${p} ${s} ${S}$args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & ${n} ${p} ${s} ${S}$args
} else {
& ${n} ${p} ${s} ${S}$args
}
$ret=$LASTEXITCODE
}
${r.nodePath?`$env:NODE_PATH=$env_node_path
`:""}exit $ret
`:P+=`
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & ${n} ${p} ${s} ${S}$args
} else {
& ${n} ${p} ${s} ${S}$args
}
${r.nodePath?`$env:NODE_PATH=$env_node_path
`:""}exit $LASTEXITCODE
`,P}function Ldt(t,e){return e.fs_.chmod(t,493)}function DY(t){if(!t)return{win32:"",posix:""};let e=typeof t=="string"?t.split(Vc.delimiter):Array.from(t),r={};for(let s=0;s<e.length;s++){let a=e[s].split("/").join("\\"),n=RBe()?e[s].split("\\").join("/").replace(/^([^:\\/]*):/,(c,f)=>`/mnt/${f.toLowerCase()}`):e[s];r.win32=r.win32?`${r.win32};${a}`:a,r.posix=r.posix?`${r.posix}:${n}`:n,r[s]={win32:a,posix:n}}return r}NBe.exports=SY});var _Y=_((_tr,tve)=>{tve.exports=Ie("stream")});var sve=_((Htr,ive)=>{"use strict";function rve(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,s)}return r}function mmt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?rve(Object(r),!0).forEach(function(s){ymt(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):rve(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}function ymt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Emt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nve(t,e){for(var r=0;r<e.length;r++){var s=e[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function Imt(t,e,r){return e&&nve(t.prototype,e),r&&nve(t,r),t}var Cmt=Ie("buffer"),pN=Cmt.Buffer,wmt=Ie("util"),HY=wmt.inspect,Bmt=HY&&HY.custom||"inspect";function vmt(t,e,r){pN.prototype.copy.call(t,e,r)}ive.exports=function(){function t(){Emt(this,t),this.head=null,this.tail=null,this.length=0}return Imt(t,[{key:"push",value:function(r){var s={data:r,next:null};this.length>0?this.tail.next=s:this.head=s,this.tail=s,++this.length}},{key:"unshift",value:function(r){var s={data:r,next:this.head};this.length===0&&(this.tail=s),this.head=s,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var s=this.head,a=""+s.data;s=s.next;)a+=r+s.data;return a}},{key:"concat",value:function(r){if(this.length===0)return pN.alloc(0);for(var s=pN.allocUnsafe(r>>>0),a=this.head,n=0;a;)vmt(a.data,s,n),n+=a.data.length,a=a.next;return s}},{key:"consume",value:function(r,s){var a;return r<this.head.data.length?(a=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?a=this.shift():a=s?this._getString(r):this._getBuffer(r),a}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var s=this.head,a=1,n=s.data;for(r-=n.length;s=s.next;){var c=s.data,f=r>c.length?c.length:r;if(f===c.length?n+=c:n+=c.slice(0,r),r-=f,r===0){f===c.length?(++a,s.next?this.head=s.next:this.head=this.tail=null):(this.head=s,s.data=c.slice(f));break}++a}return this.length-=a,n}},{key:"_getBuffer",value:function(r){var s=pN.allocUnsafe(r),a=this.head,n=1;for(a.data.copy(s),r-=a.data.length;a=a.next;){var c=a.data,f=r>c.length?c.length:r;if(c.copy(s,s.length-r,0,f),r-=f,r===0){f===c.length?(++n,a.next?this.head=a.next:this.head=this.tail=null):(this.head=a,a.data=c.slice(f));break}++n}return this.length-=n,s}},{key:Bmt,value:function(r,s){return HY(this,mmt({},s,{depth:0,customInspect:!1}))}}]),t}()});var GY=_((jtr,ave)=>{"use strict";function Smt(t,e){var r=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(jY,this,t)):process.nextTick(jY,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(n){!e&&n?r._writableState?r._writableState.errorEmitted?process.nextTick(hN,r):(r._writableState.errorEmitted=!0,process.nextTick(ove,r,n)):process.nextTick(ove,r,n):e?(process.nextTick(hN,r),e(n)):process.nextTick(hN,r)}),this)}function ove(t,e){jY(t,e),hN(t)}function hN(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function Dmt(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function jY(t,e){t.emit("error",e)}function bmt(t,e){var r=t._readableState,s=t._writableState;r&& Line truncated
`)),t.linkname&&(e+=mV(" linkpath="+t.linkname+`
`));var r=t.pax;if(r)for(var s in r)e+=mV(" "+s+"="+r[s]+`
`);return Buffer.from(e)};Uw.decodePax=function(t){for(var e={};t.length;){for(var r=0;r<t.length&&t[r]!==32;)r++;var s=parseInt(t.slice(0,r).toString(),10);if(!s)return e;var a=t.slice(r+1,s-1).toString(),n=a.indexOf("=");if(n===-1)return e;e[a.slice(0,n)]=a.slice(n+1),t=t.slice(s)}return e};Uw.encode=function(t){var e=EEt(512),r=t.name,s="";if(t.typeflag===5&&r[r.length-1]!=="/"&&(r+="/"),Buffer.byteLength(r)!==r.length)return null;for(;Buffer.byteLength(r)>100;){var a=r.indexOf("/");if(a===-1)return null;s+=s?"/"+r.slice(0,a):r.slice(0,a),r=r.slice(a+1)}return Buffer.byteLength(r)>100||Buffer.byteLength(s)>155||t.linkname&&Buffer.byteLength(t.linkname)>100?null:(e.write(r),e.write(hg(t.mode&SEt,6),100),e.write(hg(t.uid,6),108),e.write(hg(t.gid,6),116),e.write(hg(t.size,11),124),e.write(hg(t.mtime.getTime()/1e3|0,11),136),e[156]=aSe+PEt(t.type),t.linkname&&e.write(t.linkname,157),lSe.copy(e,ab),wEt.copy(e,yV),t.uname&&e.write(t.uname,265),t.gname&&e.write(t.gname,297),e.write(hg(t.devmajor||0,6),329),e.write(hg(t.devminor||0,6),337),s&&e.write(s,345),e.write(hg(uSe(e),6),148),e)};Uw.decode=function(t,e,r){var s=t[156]===0?0:t[156]-aSe,a=Mw(t,0,100,e),n=gg(t,100,8),c=gg(t,108,8),f=gg(t,116,8),p=gg(t,124,12),h=gg(t,136,12),E=bEt(s),C=t[157]===0?null:Mw(t,157,100,e),S=Mw(t,265,32),P=Mw(t,297,32),I=gg(t,329,8),R=gg(t,337,8),N=uSe(t);if(N===8*32)return null;if(N!==gg(t,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(lSe.compare(t,ab,ab+6)===0)t[345]&&(a=Mw(t,345,155,e)+"/"+a);else if(!(BEt.compare(t,ab,ab+6)===0&&vEt.compare(t,yV,yV+2)===0)){if(!r)throw new Error("Invalid tar header: unknown format.")}return s===0&&a&&a[a.length-1]==="/"&&(s=5),{name:a,mode:n,uid:c,gid:f,size:p,mtime:new Date(1e3*h),type:E,linkname:C,uname:S,gname:P,devmajor:I,devminor:R}}});var mSe=_((crr,dSe)=>{var ASe=Ie("util"),kEt=oSe(),lb=EV(),pSe=Lw().Writable,hSe=Lw().PassThrough,gSe=function(){},fSe=function(t){return t&=511,t&&512-t},QEt=function(t,e){var r=new xN(t,e);return r.end(),r},TEt=function(t,e){return e.path&&(t.name=e.path),e.linkpath&&(t.linkname=e.linkpath),e.size&&(t.size=parseInt(e.size,10)),t.pax=e,t},xN=function(t,e){this._parent=t,this.offset=e,hSe.call(this,{autoDestroy:!1})};ASe.inherits(xN,hSe);xN.prototype.destroy=function(t){this._parent.destroy(t)};var ch=function(t){if(!(this instanceof ch))return new ch(t);pSe.call(this,t),t=t||{},this._offset=0,this._buffer=kEt(),this._missing=0,this._partial=!1,this._onparse=gSe,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var e=this,r=e._buffer,s=function(){e._continue()},a=function(S){if(e._locked=!1,S)return e.destroy(S);e._stream||s()},n=function(){e._stream=null;var S=fSe(e._header.size);S?e._parse(S,c):e._parse(512,C),e._locked||s()},c=function(){e._buffer.consume(fSe(e._header.size)),e._parse(512,C),s()},f=function(){var S=e._header.size;e._paxGlobal=lb.decodePax(r.slice(0,S)),r.consume(S),n()},p=function(){var S=e._header.size;e._pax=lb.decodePax(r.slice(0,S)),e._paxGlobal&&(e._pax=Object.assign({},e._paxGlobal,e._pax)),r.consume(S),n()},h=function(){var S=e._header.size;this._gnuLongPath=lb.decodeLongPath(r.slice(0,S),t.filenameEncoding),r.consume(S),n()},E=function(){var S=e._header.size;this._gnuLongLinkPath=lb.decodeLongPath(r.slice(0,S),t.filenameEncoding),r.consume(S),n()},C=function(){var S=e._offset,P;try{P=e._header=lb.decode(r.slice(0,512),t.filenameEncoding,t.allowUnknownFormat)}catch(I){e.emit("error",I)}if(r.consume(512),!P){e._parse(512,C),s();return}if(P.type==="gnu-long-path"){e._parse(P.size,h),s();return}if(P.type==="gnu-long-link-path"){e._parse(P.size,E),s();return}if(P.type==="pax-global-header"){e._parse(P.size,f),s();return}if(P.type==="pax-header"){e._parse(P.size,p),s();return}if(e._gnuLongPath&&(P.name=e._gnuLongPath,e._gnuLongPath=null),e._gnuLongLinkPath&&(P.linkname=e._gnuLongLinkPath,e._gnuLongLinkPath=null),e._pax&&(e._header=P=TEt(P,e._pax),e._pax=null),e._locked=!0,!P.size||P.type==="directory"){e._parse(512,C),e.emit("entry",P,QEt(e,S),a);return}e._stream=new xN(e,S),e.emit("entry",P,e._stream,a),e._parse(P.size,n),s()};this._onheader=C,this._parse(512,C)};ASe.inherits(ch,pSe);ch.prototype.destroy=function(t){this._destroyed||(this._destroyed=!0,t&&this.emit("error",t),this.emit("close"),this._stream&&this._stream.emit("close"))};ch.prototype._parse=function(t,e){this._destroyed||(this._offset+=t,this._missing=t,e===this._onheader&&(this._partial=!1),this._onparse=e)};ch.prototype._continue=function(){if(!this._destroyed){var t=this._cb;this._cb=gSe,this._overflow?this._write(this._overflow,void 0,t):t()}};ch.prototype._write=function(t,e,r){if(!this._destroyed){var s=this._stream,a=this._buffer,n=this._missing;if(t.length&&(this._partial=!0),t.length<n)return this._missing-=t.length,this._overflow=null,s?s.write(t,r):(a.append(t), Line truncated
Wanted: ${this.expectedSize}
Found: ${this.size}`);s.code="EBADSIZE",s.found=this.size,s.expected=this.expectedSize,s.sri=this.sri,this.emit("error",s)}else if(this.sri&&!r){let s=new Error(`${this.sri} integrity checksum failed when using ${this.algorithm}: wanted ${this.digests} but got ${e}. (${this.size} bytes)`);s.code="EINTEGRITY",s.found=e,s.expected=this.digests,s.algorithm=this.algorithm,s.sri=this.sri,this.emit("error",s)}else this.#r=this.size,this.emit("size",this.size),this.#t=e,this.emit("integrity",e),r&&(this.#i=r,this.emit("verified",r))}},Ah=class{get isHash(){return!0}constructor(e,r){let s=r?.strict;this.source=e.trim(),this.digest="",this.algorithm="",this.options=[];let a=this.source.match(s?uIt:cIt);if(!a||s&&!OV.includes(a[1]))return;this.algorithm=a[1],this.digest=a[2];let n=a[3];n&&(this.options=n.slice(1).split("?"))}hexDigest(){return this.digest&&Buffer.from(this.digest,"base64").toString("hex")}toJSON(){return this.toString()}match(e,r){let s=nc(e,r);if(!s)return!1;if(s.isIntegrity){let a=s.pickAlgorithm(r,[this.algorithm]);if(!a)return!1;let n=s[a].find(c=>c.digest===this.digest);return n||!1}return s.digest===this.digest?s:!1}toString(e){return e?.strict&&!(OV.includes(this.algorithm)&&this.digest.match(lIt)&&this.options.every(r=>r.match(fIt)))?"":`${this.algorithm}-${this.digest}${mb(this.options)}`}};function USe(t,e,r,s){let a=t!=="",n=!1,c="",f=s.length-1;for(let h=0;h<f;h++){let E=Ah.prototype.toString.call(s[h],r);E&&(n=!0,c+=E,c+=e)}let p=Ah.prototype.toString.call(s[f],r);return p&&(n=!0,c+=p),a&&n?t+e+c:t+c}var Xm=class{get isIntegrity(){return!0}toJSON(){return this.toString()}isEmpty(){return Object.keys(this).length===0}toString(e){let r=e?.sep||" ",s="";if(e?.strict){r=r.replace(/\S+/g," ");for(let a of OV)this[a]&&(s=USe(s,r,e,this[a]))}else for(let a of Object.keys(this))s=USe(s,r,e,this[a]);return s}concat(e,r){let s=typeof e=="string"?e:gb(e,r);return nc(`${this.toString(r)} ${s}`,r)}hexDigest(){return nc(this,{single:!0}).hexDigest()}merge(e,r){let s=nc(e,r);for(let a in s)if(this[a]){if(!this[a].find(n=>s[a].find(c=>n.digest===c.digest)))throw new Error("hashes do not match, cannot update integrity")}else this[a]=s[a]}match(e,r){let s=nc(e,r);if(!s)return!1;let a=s.pickAlgorithm(r,Object.keys(this));return!!a&&this[a]&&s[a]&&this[a].find(n=>s[a].find(c=>n.digest===c.digest))||!1}pickAlgorithm(e,r){let s=e?.pickAlgorithm||EIt,a=Object.keys(this).filter(n=>r?.length?r.includes(n):!0);return a.length?a.reduce((n,c)=>s(n,c)||n):null}};IA.exports.parse=nc;function nc(t,e){if(!t)return null;if(typeof t=="string")return NV(t,e);if(t.algorithm&&t.digest){let r=new Xm;return r[t.algorithm]=[t],NV(gb(r,e),e)}else return NV(gb(t,e),e)}function NV(t,e){if(e?.single)return new Ah(t,e);let r=t.trim().split(/\s+/).reduce((s,a)=>{let n=new Ah(a,e);if(n.algorithm&&n.digest){let c=n.algorithm;s[c]||(s[c]=[]),s[c].push(n)}return s},new Xm);return r.isEmpty()?null:r}IA.exports.stringify=gb;function gb(t,e){return t.algorithm&&t.digest?Ah.prototype.toString.call(t,e):typeof t=="string"?gb(nc(t,e),e):Xm.prototype.toString.call(t,e)}IA.exports.fromHex=AIt;function AIt(t,e,r){let s=mb(r?.options);return nc(`${e}-${Buffer.from(t,"hex").toString("base64")}${s}`,r)}IA.exports.fromData=pIt;function pIt(t,e){let r=e?.algorithms||[...MV],s=mb(e?.options);return r.reduce((a,n)=>{let c=db.createHash(n).update(t).digest("base64"),f=new Ah(`${n}-${c}${s}`,e);if(f.algorithm&&f.digest){let p=f.algorithm;a[p]||(a[p]=[]),a[p].push(f)}return a},new Xm)}IA.exports.fromStream=hIt;function hIt(t,e){let r=UV(e);return new Promise((s,a)=>{t.pipe(r),t.on("error",a),r.on("error",a);let n;r.on("integrity",c=>{n=c}),r.on("end",()=>s(n)),r.resume()})}IA.exports.checkData=gIt;function gIt(t,e,r){if(e=nc(e,r),!e||!Object.keys(e).length){if(r?.error)throw Object.assign(new Error("No valid integrity hashes to check against"),{code:"EINTEGRITY"});return!1}let s=e.pickAlgorithm(r),a=db.createHash(s).update(t).digest("base64"),n=nc({algorithm:s,digest:a}),c=n.match(e,r);if(r=r||{},c||!r.error)return c;if(typeof r.size=="number"&&t.length!==r.size){let f=new Error(`data size mismatch when checking ${e}.
Wanted: ${r.size}
Found: ${t.length}`);throw f.code="EBADSIZE",f.found=t.length,f.expected=r.size,f.sri=e,f}else{let f=new Error(`Integrity checksum failed when using ${s}: Wanted ${e}, but got ${n}. (${t.length} bytes)`);throw f.code="EINTEGRITY",f.found=n,f.expected=e,f.algorithm=s,f.sri=e,f}}IA.exports.checkStream=dIt;function dIt(t,e,r){if(r=r||Object.create(null),r.integrity=e,e=nc(e,r),!e||!Object.keys(e).length)return Promise.reject(Object.assign(new Error("No valid integrity hashes to check against"),{code:"EINTEGRITY"}));let s=UV(r);return new Promise((a,n)=>{t.pipe(s),t.on("error",n),s.on("error",n);let c;s.on("verified",f=>{c=f}),s.on("end",()=>a(c)),s.resume()})}IA.exports.integrityStream=UV;function UV(t=Object.create(null)){return new LV(t)}IA.exports.create=mIt;function mIt(t){let e=t?.algorithms||[...MV],r=mb(t?.options),s=e.map(db.createHash);return{update:function(a,n){return s.forEach(c=>c.update(a,n)),this},digest:function(){return e.reduce((n,c)=>{let f=s.shift().digest("base64"),p=new Ah(`${c}-${f}${r}`,t);if(p.algorithm&&p.digest){let h=p.algorithm;n[h]||(n[h]=[]),n[h].push(p)}return n},new Xm)}}}var yIt=db.getHashes(),_Se=["md5","whirlpool","sha1","sha224","sha256","sha384","sha512","sha3","sha3-256","sha3-384","sha3-512","sha3_256","sha3_384","sha3_512"].filter(t=>yIt.includes(t));function EIt(t,e){return _Se.indexOf(t.toLowerCase())>=_Se.indexOf(e.toLowerCase())?t:e}});var _V=_(mg=>{"use strict";Object.defineProperty(mg,"__esModule",{value:!0});mg.Signature=mg.Envelope=void 0;mg.Envelope={fromJSON(t){return{payload:GN(t.payload)?Buffer.from(jSe(t.payload)):Buffer.alloc(0),payloadType:GN(t.payloadType)?globalThis.String(t.payloadType):"",signatures:globalThis.Array.isArray(t?.signatures)?t.signatures.map(e=>mg.Signature.fromJSON(e)):[]}},toJSON(t){let e={};return t.payload.length!==0&&(e.payload=GSe(t.payload)),t.payloadType!==""&&(e.payloadType=t.payloadType),t.signatures?.length&&(e.signatures=t.signatures.map(r=>mg.Signature.toJSON(r))),e}};mg.Signature={fromJSON(t){return{sig:GN(t.sig)?Buffer.from(jSe(t.sig)):Buffer.alloc(0),keyid:GN(t.keyid)?globalThis.String(t.keyid):""}},toJSON(t){let e={};return t.sig.length!==0&&(e.sig=GSe(t.sig)),t.keyid!==""&&(e.keyid=t.keyid),e}};function jSe(t){return Uint8Array.from(globalThis.Buffer.from(t,"base64"))}function GSe(t){return globalThis.Buffer.from(t).toString("base64")}function GN(t){return t!=null}});var WSe=_(qN=>{"use strict";Object.defineProperty(qN,"__esModule",{value:!0});qN.Timestamp=void 0;qN.Timestamp={fromJSON(t){return{seconds:qSe(t.seconds)?globalThis.String(t.seconds):"0",nanos:qSe(t.nanos)?globalThis.Number(t.nanos):0}},toJSON(t){let e={};return t.seconds!=="0"&&(e.seconds=t.seconds),t.nanos!==0&&(e.nanos=Math.round(t.nanos)),e}};function qSe(t){return t!=null}});var Ww=_(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.TimeRange=Ur.X509CertificateChain=Ur.SubjectAlternativeName=Ur.X509Certificate=Ur.DistinguishedName=Ur.ObjectIdentifierValuePair=Ur.ObjectIdentifier=Ur.PublicKeyIdentifier=Ur.PublicKey=Ur.RFC3161SignedTimestamp=Ur.LogId=Ur.MessageSignature=Ur.HashOutput=Ur.SubjectAlternativeNameType=Ur.PublicKeyDetails=Ur.HashAlgorithm=void 0;Ur.hashAlgorithmFromJSON=VSe;Ur.hashAlgorithmToJSON=JSe;Ur.publicKeyDetailsFromJSON=KSe;Ur.publicKeyDetailsToJSON=zSe;Ur.subjectAlternativeNameTypeFromJSON=XSe;Ur.subjectAlternativeNameTypeToJSON=ZSe;var IIt=WSe(),yl;(function(t){t[t.HASH_ALGORITHM_UNSPECIFIED=0]="HASH_ALGORITHM_UNSPECIFIED",t[t.SHA2_256=1]="SHA2_256",t[t.SHA2_384=2]="SHA2_384",t[t.SHA2_512=3]="SHA2_512",t[t.SHA3_256=4]="SHA3_256",t[t.SHA3_384=5]="SHA3_384"})(yl||(Ur.HashAlgorithm=yl={}));function VSe(t){switch(t){case 0:case"HASH_ALGORITHM_UNSPECIFIED":return yl.HASH_ALGORITHM_UNSPECIFIED;case 1:case"SHA2_256":return yl.SHA2_256;case 2:case"SHA2_384":return yl.SHA2_384;case 3:case"SHA2_512":return yl.SHA2_512;case 4:case"SHA3_256":return yl.SHA3_256;case 5:case"SHA3_384":return yl.SHA3_384;default:throw new globalThis.Error("Unrecognized enum value "+t+" for enum HashAlgorithm")}}function JSe(t){switch(t){case yl.HASH_ALGORITHM_UNSPECIFIED:return"HASH_ALGORITHM_UNSPECIFIED";case yl.SHA2_256:return"SHA2_256";case yl.SHA2_384:return"SHA2_384";case yl.SHA2_512:return"SHA2_512";case yl.SHA3_256:return"SHA3_256";case yl.SHA3_384:return"SHA3_384";default:throw new globalThis.Error("Unrecognized enum value "+t+" for enum HashAlgorithm")}}var sn;(function(t){t[t.PUBLIC_KEY_DETAILS_UNSPECIFIED=0]="PUBLIC_KEY_DETAILS_UNSPECIFIED",t[t.PKCS1_RSA_PKCS1V5=1]="PKCS1_RSA_PKCS1V5",t[t.PKCS1_RSA_PSS=2]="PKCS1_RSA_PSS",t[t.PKIX_RSA_PKCS1V5=3]="PKIX_RSA_PKCS1V5",t[t.PKIX_RSA_PSS=4]="PKIX_RSA_PSS",t[t.PKIX_RSA_PKCS1V15_2048_SHA256=9]="PKIX_RSA_PKCS1V15_2048_SHA256",t[t.PKIX_RSA_PKCS1V15_3072_SHA256=10]="PKIX_RSA_PKCS1V15_3072_SHA256",t[t.PKIX_RSA_PKCS1V15_4096_SHA256=11]="PKIX_RSA_PKCS1V15_4096_SHA256",t[t.PKIX_RSA_PSS_2048_SHA256=16]="PKIX_RSA_PSS_2048_SHA256",t[t.PKIX_RSA_PSS_3072_SHA256=17]="PKIX_RSA_PSS_3072_SHA256",t[t.PKIX_RS Line truncated
`).forEach(r=>{r.match(ACt)||r.match(pCt)||(e+=r)}),Buffer.from(e,"base64")}function gCt(t,e="CERTIFICATE"){let s=t.toString("base64").match(/.{1,64}/g)||"";return[`-----BEGIN ${e}-----`,...s,`-----END ${e}-----`].join(`
`).concat(`
`)}});var AO=_(zw=>{"use strict";Object.defineProperty(zw,"__esModule",{value:!0});zw.SHA2_HASH_ALGOS=zw.ECDSA_SIGNATURE_ALGOS=void 0;zw.ECDSA_SIGNATURE_ALGOS={"1.2.840.10045.4.3.1":"sha224","1.2.840.10045.4.3.2":"sha256","1.2.840.10045.4.3.3":"sha384","1.2.840.10045.4.3.4":"sha512"};zw.SHA2_HASH_ALGOS={"2.16.840.1.101.3.4.2.1":"sha256","2.16.840.1.101.3.4.2.2":"sha384","2.16.840.1.101.3.4.2.3":"sha512"}});var s7=_(pO=>{"use strict";Object.defineProperty(pO,"__esModule",{value:!0});pO.RFC3161TimestampVerificationError=void 0;var i7=class extends Error{};pO.RFC3161TimestampVerificationError=i7});var PDe=_(vA=>{"use strict";var dCt=vA&&vA.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),mCt=vA&&vA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yCt=vA&&vA.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dCt(e,t,r);return mCt(e,t),e};Object.defineProperty(vA,"__esModule",{value:!0});vA.TSTInfo=void 0;var bDe=yCt(Kw()),ECt=AO(),ICt=s7(),o7=class{constructor(e){this.root=e}get version(){return this.root.subs[0].toInteger()}get genTime(){return this.root.subs[4].toDate()}get messageImprintHashAlgorithm(){let e=this.messageImprintObj.subs[0].subs[0].toOID();return ECt.SHA2_HASH_ALGOS[e]}get messageImprintHashedMessage(){return this.messageImprintObj.subs[1].value}get raw(){return this.root.toDER()}verify(e){let r=bDe.digest(this.messageImprintHashAlgorithm,e);if(!bDe.bufferEqual(r,this.messageImprintHashedMessage))throw new ICt.RFC3161TimestampVerificationError("message imprint does not match artifact")}get messageImprintObj(){return this.root.subs[2]}};vA.TSTInfo=o7});var kDe=_(SA=>{"use strict";var CCt=SA&&SA.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),wCt=SA&&SA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BCt=SA&&SA.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CCt(e,t,r);return wCt(e,t),e};Object.defineProperty(SA,"__esModule",{value:!0});SA.RFC3161Timestamp=void 0;var vCt=cO(),a7=BCt(Kw()),xDe=AO(),Bb=s7(),SCt=PDe(),DCt="1.2.840.113549.1.7.2",bCt="1.2.840.113549.1.9.16.1.4",PCt="1.2.840.113549.1.9.4",l7=class t{constructor(e){this.root=e}static parse(e){let r=vCt.ASN1Obj.parseBuffer(e);return new t(r)}get status(){return this.pkiStatusInfoObj.subs[0].toInteger()}get contentType(){return this.contentTypeObj.toOID()}get eContentType(){return this.eContentTypeObj.toOID()}get signingTime(){return this.tstInfo.genTime}get signerIssuer(){return this.signerSidObj.subs[0].value}get signerSerialNumber(){return this.signerSidObj.subs[1].value}get signerDigestAlgorithm(){let e=this.signerDigestAlgorithmObj.subs[0].toOID();return xDe.SHA2_HASH_ALGOS[e]}get signatureAlgorithm(){let e=this.signatureAlgorithmObj.subs[0].toOID();return xDe.ECDSA_SIGNATURE_ALGOS[e]}get signatureValue(){return this.signatureValueObj.value}get tstInfo(){return new SCt.TSTInfo(this.eContentObj.subs[0].subs[0])}verify(e,r){if(!this.timeStampTokenObj)throw new Bb.RFC3161TimestampVerificationError("timeStampToken is missing");if(this.contentType!==DCt)throw new Bb.RFC3161TimestampVerificationError(`incorrect content type: ${this.contentType}`);if(this.eContentType!==bCt)throw new Bb.RFC3161TimestampVerificationError(`incorrect encapsulated content type: ${this.eContentType}`);this.tstInfo.verify(e),this.verifyMessageDigest(),this.verifySignature(r)}verifyMessageDigest(){let e=a7.digest(this.signerDigestAlgorithm,this.tstInfo.raw),r=this.messageDigestAttributeObj.subs[1].subs[0].value;if(!a7.bufferEqual(e,r))throw new Bb.RFC3161TimestampVerificationError("signed data does not match tstInfo")}verifySignature(e){let r=this.signedAttrsObj.toDER();if(r[0]=49,!a7.verify(r,e,this.signatureValue,this.signatureAlgorithm))throw new Bb.RFC3161TimestampVerificationError("signature verification failed")}get pkiStatusInfoObj(){return this.root.subs[0]}get timeStampTokenObj(){return this.root.subs[1]}get contentTypeObj(){return this.timeStampTokenObj.subs[0]}get signedDataObj(){return this.timeStampTokenObj.subs.find(r=>r.tag.isContextSpecific(0)).subs[0]}get encapContentInfoObj(){return this.signedDataObj.subs[2]}get signerInfosObj(){let e=this.signedDataObj;return e.subs[e.subs.length-1]}get sig Line truncated
globstar while`,e,S,r,P,I),this.matchOne(e.slice(S),r.slice(P),s))return this.debug("globstar found match!",S,p,I),!0;if(I==="."||I===".."||!a.dot&&I.charAt(0)==="."){this.debug("dot detected!",e,S,r,P);break}this.debug("globstar swallow a segment, and continue"),S++}return!!(s&&(this.debug(`
>>> no match, partial?`,e,S,r,P),S===p))}let R;if(typeof E=="string"?(R=C===E,this.debug("string match",E,C,R)):(R=E.test(C),this.debug("pattern match",E,C,R)),!R)return!1}if(c===p&&f===h)return!0;if(c===p)return s;if(f===h)return c===p-1&&e[c]==="";throw new Error("wtf?")}braceExpand(){return(0,pr.braceExpand)(this.pattern,this.options)}parse(e){(0,qO.assertValidPattern)(e);let r=this.options;if(e==="**")return pr.GLOBSTAR;if(e==="")return"";let s,a=null;(s=e.match(V2t))?a=r.dot?K2t:J2t:(s=e.match(L2t))?a=(r.nocase?r.dot?H2t:_2t:r.dot?U2t:M2t)(s[1]):(s=e.match(z2t))?a=(r.nocase?r.dot?Z2t:X2t:r.dot?$2t:eBt)(s):(s=e.match(j2t))?a=r.dot?q2t:G2t:(s=e.match(W2t))&&(a=Y2t);let n=wPe.AST.fromGlob(e,this.options).toMMPattern();return a&&typeof n=="object"&&Reflect.defineProperty(n,"test",{value:a}),n}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,s=r.noglobstar?rBt:r.dot?nBt:iBt,a=new Set(r.nocase?["i"]:[]),n=e.map(p=>{let h=p.map(E=>{if(E instanceof RegExp)for(let C of E.flags.split(""))a.add(C);return typeof E=="string"?uBt(E):E===pr.GLOBSTAR?pr.GLOBSTAR:E._src});return h.forEach((E,C)=>{let S=h[C+1],P=h[C-1];E!==pr.GLOBSTAR||P===pr.GLOBSTAR||(P===void 0?S!==void 0&&S!==pr.GLOBSTAR?h[C+1]="(?:\\/|"+s+"\\/)?"+S:h[C]=s:S===void 0?h[C-1]=P+"(?:\\/|"+s+")?":S!==pr.GLOBSTAR&&(h[C-1]=P+"(?:\\/|\\/"+s+"\\/)"+S,h[C+1]=pr.GLOBSTAR))}),h.filter(E=>E!==pr.GLOBSTAR).join("/")}).join("|"),[c,f]=e.length>1?["(?:",")"]:["",""];n="^"+c+n+f+"$",this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...a].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let s=this.options;this.isWindows&&(e=e.split("\\").join("/"));let a=this.slashSplit(e);this.debug(this.pattern,"split",a);let n=this.set;this.debug(this.pattern,"set",n);let c=a[a.length-1];if(!c)for(let f=a.length-2;!c&&f>=0;f--)c=a[f];for(let f=0;f<n.length;f++){let p=n[f],h=a;if(s.matchBase&&p.length===1&&(h=[c]),this.matchOne(h,p,r))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(e){return pr.minimatch.defaults(e).Minimatch}};pr.Minimatch=ly;var fBt=aJ();Object.defineProperty(pr,"AST",{enumerable:!0,get:function(){return fBt.AST}});var ABt=lJ();Object.defineProperty(pr,"escape",{enumerable:!0,get:function(){return ABt.escape}});var pBt=UO();Object.defineProperty(pr,"unescape",{enumerable:!0,get:function(){return pBt.unescape}});pr.minimatch.AST=wPe.AST;pr.minimatch.Minimatch=ly;pr.minimatch.escape=F2t.escape;pr.minimatch.unescape=N2t.unescape});var fJ=_(ru=>{"use strict";var bPe=ru&&ru.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ru,"__esModule",{value:!0});ru.SuccinctRoles=ru.DelegatedRole=ru.Role=ru.TOP_LEVEL_ROLE_NAMES=void 0;var PPe=bPe(Ie("crypto")),hBt=DPe(),WO=bPe(Ie("util")),YO=PA(),cy=ff();ru.TOP_LEVEL_ROLE_NAMES=["root","targets","snapshot","timestamp"];var Mb=class t{constructor(e){let{keyIDs:r,threshold:s,unrecognizedFields:a}=e;if(gBt(r))throw new YO.ValueError("duplicate key IDs found");if(s<1)throw new YO.ValueError("threshold must be at least 1");this.keyIDs=r,this.threshold=s,this.unrecognizedFields=a||{}}equals(e){return e instanceof t?this.threshold===e.threshold&&WO.default.isDeepStrictEqual(this.keyIDs,e.keyIDs)&&WO.default.isDeepStrictEqual(this.unrecognizedFields,e.unrecognizedFields):!1}toJSON(){return{keyids:this.keyIDs,threshold:this.threshold,...this.unrecognizedFields}}static fromJSON(e){let{keyids:r,threshold:s,...a}=e;if(!cy.guard.isStringArray(r))throw new TypeError("keyids must be an array");if(typeof s!="number")throw new TypeError("threshold must be a number");return new t({keyIDs:r,threshold:s,unrecognizedFields:a})}};ru.Role=Mb;function gBt(t){return new Set(t).size!==t.length}var cJ=class t extends Mb{constructor(e){super(e);let{name:r,terminating:s,paths:a,pathHashPrefixes:n}=e;if(this.name=r,this.terminating=s,e.paths&&e.pathHashPrefixes)throw new YO.ValueError("paths and pathHashPrefixes are mutually exclusive");this.paths=a,this.pathHashPrefixes=n}equals(e){return e instanceof t?super.equals(e)&&this.name===e.name&&this.terminating===e.terminating&&WO.default.isDeepStrictEqual(this.paths,e.paths)&&WO.default.isDeepStrictEqual(this.pathHashPrefixes,e.pathHashPrefixes):!1}isDelegatedPath(e){if(this.paths)return this.paths.some(r=>mBt(e,r));if(this.pathHashPrefixes){let s=PPe.default.createHash("sha256").update(e).digest("hex");return this.pathHashPrefixes.some(a=>s.startsWith(a))}return!1}toJSON(){let e={...super.toJSON(),name:this.name,terminating:this.terminating};return this.paths&&(e.paths=this.paths),this.pathHashPrefixes&&(e.path_hash_prefixes=this.pathHashPrefixes),e}static fro Line truncated
`).join(`
`+n),t.push(a+"m+"+iL.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=Evt()+e+" "+t[0]}function Evt(){return Zs.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Ivt(...t){return process.stderr.write(nL.formatWithOptions(Zs.inspectOpts,...t)+`
`)}function Cvt(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function wvt(){return process.env.DEBUG}function Bvt(t){t.inspectOpts={};let e=Object.keys(Zs.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=Zs.inspectOpts[e[r]]}iL.exports=QJ()(Zs);var{formatters:GPe}=iL.exports;GPe.o=function(t){return this.inspectOpts.colors=this.useColors,nL.inspect(t,this.inspectOpts).split(`
`).map(e=>e.trim()).join(" ")};GPe.O=function(t){return this.inspectOpts.colors=this.useColors,nL.inspect(t,this.inspectOpts)}});var RJ=_((Pir,TJ)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?TJ.exports=jPe():TJ.exports=qPe()});var oL=_(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.DownloadHTTPError=Ki.DownloadLengthMismatchError=Ki.DownloadError=Ki.ExpiredMetadataError=Ki.EqualVersionError=Ki.BadVersionError=Ki.RepositoryError=Ki.PersistError=Ki.RuntimeError=Ki.ValueError=void 0;var FJ=class extends Error{};Ki.ValueError=FJ;var NJ=class extends Error{};Ki.RuntimeError=NJ;var OJ=class extends Error{};Ki.PersistError=OJ;var _b=class extends Error{};Ki.RepositoryError=_b;var sL=class extends _b{};Ki.BadVersionError=sL;var LJ=class extends sL{};Ki.EqualVersionError=LJ;var MJ=class extends _b{};Ki.ExpiredMetadataError=MJ;var Hb=class extends Error{};Ki.DownloadError=Hb;var UJ=class extends Hb{};Ki.DownloadLengthMismatchError=UJ;var _J=class extends Hb{constructor(e,r){super(e),this.statusCode=r}};Ki.DownloadHTTPError=_J});var YPe=_(d1=>{"use strict";var jJ=d1&&d1.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(d1,"__esModule",{value:!0});d1.withTempFile=void 0;var HJ=jJ(Ie("fs/promises")),vvt=jJ(Ie("os")),WPe=jJ(Ie("path")),Svt=async t=>Dvt(async e=>t(WPe.default.join(e,"tempfile")));d1.withTempFile=Svt;var Dvt=async t=>{let e=await HJ.default.realpath(vvt.default.tmpdir()),r=await HJ.default.mkdtemp(e+WPe.default.sep);try{return await t(r)}finally{await HJ.default.rm(r,{force:!0,recursive:!0,maxRetries:3})}}});var qJ=_(kg=>{"use strict";var lL=kg&&kg.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(kg,"__esModule",{value:!0});kg.DefaultFetcher=kg.BaseFetcher=void 0;var bvt=lL(RJ()),VPe=lL(Ie("fs")),Pvt=lL(CO()),xvt=lL(Ie("util")),JPe=oL(),kvt=YPe(),Qvt=(0,bvt.default)("tuf:fetch"),aL=class{async downloadFile(e,r,s){return(0,kvt.withTempFile)(async a=>{let n=await this.fetch(e),c=0,f=VPe.default.createWriteStream(a);try{for await(let p of n){let h=Buffer.from(p);if(c+=h.length,c>r)throw new JPe.DownloadLengthMismatchError("Max length reached");await Tvt(f,h)}}finally{await xvt.default.promisify(f.close).bind(f)()}return s(a)})}async downloadBytes(e,r){return this.downloadFile(e,r,async s=>{let a=VPe.default.createReadStream(s),n=[];for await(let c of a)n.push(c);return Buffer.concat(n)})}};kg.BaseFetcher=aL;var GJ=class extends aL{constructor(e={}){super(),this.timeout=e.timeout,this.retry=e.retry}async fetch(e){Qvt("GET %s",e);let r=await(0,Pvt.default)(e,{timeout:this.timeout,retry:this.retry});if(!r.ok||!r?.body)throw new JPe.DownloadHTTPError("Failed to download",r.status);return r.body}};kg.DefaultFetcher=GJ;var Tvt=async(t,e)=>new Promise((r,s)=>{t.write(e,a=>{a&&s(a),r(!0)})})});var KPe=_(cL=>{"use strict";Object.defineProperty(cL,"__esModule",{value:!0});cL.defaultConfig=void 0;cL.defaultConfig={maxRootRotations:256,maxDelegations:32,rootMaxLength:512e3,timestampMaxLength:16384,snapshotMaxLength:2e6,targetsMaxLength:5e6,prefixTargetsWithHash:!0,fetchTimeout:1e5,fetchRetries:void 0,fetchRetry:2}});var zPe=_(uL=>{"use strict";Object.defineProperty(uL,"__esModule",{value:!0});uL.TrustedMetadataStore=void 0;var Es=eL(),Hi=oL(),WJ=class{constructor(e){this.trustedSet={},this.referenceTime=new Date,this.loadTrustedRoot(e)}get root(){if(!this.trustedSet.root)throw new ReferenceError("No trusted root metadata");return this.trustedSet.root}get timestamp(){return this.trustedSet.timestamp}get snapshot(){return this.trustedSet.snapshot}get targets(){return this.trustedSet.targets}getRole(e){return this.trustedSet[e]}updateRoot(e){let r=JSON.parse(e.toString("utf8")),s=Es.Metadata.fromJSON(Es.MetadataKind.Root,r);if(s.signed.type!=Es.MetadataKind.Root)throw new Hi.RepositoryError(`Expected 'root', got ${s.signed.type}`);if(this.root.verifyDelegate(Es.MetadataKind.Root,s),s.signed.version!=this.root.signed.version+1)throw new Hi.BadVersionError(`Expected version ${this.root.signed.version+1}, got ${s.signed.version}`);return s.verifyDelegate(Es.MetadataKind.Root,s),this.trustedSet.root=s,s}updateTimestamp(e){if(this.snapshot)throw new Hi.RuntimeError("Cannot update timestamp after snapshot");if(this.root.signed.isExpired(this.referenceTime))throw new Hi.ExpiredMetadataError("Final root.json is expired");let r=JSON.parse(e.toString("utf8")),s=Es.Metadata.fromJSON(Es.MetadataKind.Timestamp,r);if(s.signed.type!=Es.MetadataKind.Timestamp)throw new Hi.RepositoryError(`Expected 'timestamp', got ${s.signed.type}`);if(this.root.verifyDelegate(Es.MetadataKind.Timestamp,s),this.timestamp){if(s.signed.version<this.timestamp.signed.version)throw new Hi.BadVersionError(`New timestamp version ${s.signed.version} is less than current version ${this.timestamp.signed.version}`);if(s.signed.version===this.timestamp.signed.version)throw new Hi.EqualVersionError(`New timestamp version ${s.sLine truncated
`,_St=/\u2014 (\S+) (\S+)\n/g;function HSt(t,e){let r=(0,USt.filterTLogAuthorities)(e,{targetDate:new Date(Number(t.integratedTime)*1e3)}),s=t.inclusionProof,a=pK.fromString(s.checkpoint.envelope),n=hK.fromString(a.note);if(!jSt(a,r))throw new I1.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"invalid checkpoint signature"});if(!AK.crypto.bufferEqual(n.logHash,s.rootHash))throw new I1.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"root hash mismatch"})}function jSt(t,e){let r=Buffer.from(t.note,"utf-8");return t.signatures.every(s=>{let a=e.find(n=>AK.crypto.bufferEqual(n.logID.subarray(0,4),s.keyHint));return a?AK.crypto.verify(r,a.publicKey,s.signature):!1})}var pK=class t{constructor(e,r){this.note=e,this.signatures=r}static fromString(e){if(!e.includes(fK))throw new I1.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"missing checkpoint separator"});let r=e.indexOf(fK),s=e.slice(0,r+1),n=e.slice(r+fK.length).matchAll(_St),c=Array.from(n,f=>{let[,p,h]=f,E=Buffer.from(h,"base64");if(E.length<5)throw new I1.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"malformed checkpoint signature"});return{name:p,keyHint:E.subarray(0,4),signature:E.subarray(4)}});if(c.length===0)throw new I1.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"no signatures found in checkpoint"});return new t(s,c)}},hK=class t{constructor(e,r,s,a){this.origin=e,this.logSize=r,this.logHash=s,this.rest=a}static fromString(e){let r=e.trimEnd().split(`
`);if(r.length<3)throw new I1.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"too few lines in checkpoint header"});let s=r[0],a=BigInt(r[1]),n=Buffer.from(r[2],"base64"),c=r.slice(3);return new t(s,a,n,c)}}});var Exe=_(EK=>{"use strict";Object.defineProperty(EK,"__esModule",{value:!0});EK.verifyMerkleInclusion=WSt;var yK=Cl(),dK=Eo(),GSt=Buffer.from([0]),qSt=Buffer.from([1]);function WSt(t){let e=t.inclusionProof,r=BigInt(e.logIndex),s=BigInt(e.treeSize);if(r<0n||r>=s)throw new dK.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:`invalid index: ${r}`});let{inner:a,border:n}=YSt(r,s);if(e.hashes.length!==a+n)throw new dK.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"invalid hash count"});let c=e.hashes.slice(0,a),f=e.hashes.slice(a),p=ZSt(t.canonicalizedBody),h=JSt(VSt(p,c,r),f);if(!yK.crypto.bufferEqual(h,e.rootHash))throw new dK.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"calculated root hash does not match inclusion proof"})}function YSt(t,e){let r=KSt(t,e),s=zSt(t>>BigInt(r));return{inner:r,border:s}}function VSt(t,e,r){return e.reduce((s,a,n)=>r>>BigInt(n)&BigInt(1)?mK(a,s):mK(s,a),t)}function JSt(t,e){return e.reduce((r,s)=>mK(s,r),t)}function KSt(t,e){return XSt(t^e-BigInt(1))}function zSt(t){return t.toString(2).split("1").length-1}function XSt(t){return t===0n?0:t.toString(2).length}function mK(t,e){return yK.crypto.digest("sha256",qSt,t,e)}function ZSt(t){return yK.crypto.digest("sha256",GSt,t)}});var Cxe=_(IK=>{"use strict";Object.defineProperty(IK,"__esModule",{value:!0});IK.verifyTLogSET=tDt;var Ixe=Cl(),$St=Eo(),eDt=py();function tDt(t,e){if(!(0,eDt.filterTLogAuthorities)(e,{logID:t.logId.keyId,targetDate:new Date(Number(t.integratedTime)*1e3)}).some(a=>{let n=rDt(t),c=Buffer.from(Ixe.json.canonicalize(n),"utf8"),f=t.inclusionPromise.signedEntryTimestamp;return Ixe.crypto.verify(c,a.publicKey,f)}))throw new $St.VerificationError({code:"TLOG_INCLUSION_PROMISE_ERROR",message:"inclusion promise could not be verified"})}function rDt(t){let{integratedTime:e,logIndex:r,logId:s,canonicalizedBody:a}=t;return{body:a.toString("base64"),integratedTime:Number(e),logIndex:Number(r),logID:s.keyId.toString("hex")}}});var wxe=_(BK=>{"use strict";Object.defineProperty(BK,"__esModule",{value:!0});BK.verifyRFC3161Timestamp=sDt;var CK=Cl(),wK=Eo(),nDt=cK(),iDt=py();function sDt(t,e,r){let s=t.signingTime;if(r=(0,iDt.filterCertAuthorities)(r,{start:s,end:s}),r=aDt(r,{serialNumber:t.signerSerialNumber,issuer:t.signerIssuer}),!r.some(n=>{try{return oDt(t,e,n),!0}catch{return!1}}))throw new wK.VerificationError({code:"TIMESTAMP_ERROR",message:"timestamp could not be verified"})}function oDt(t,e,r){let[s,...a]=r.certChain,n=CK.crypto.createPublicKey(s.publicKey),c=t.signingTime;try{new nDt.CertificateChainVerifier({untrustedCert:s,trustedCerts:a}).verify()}catch{throw new wK.VerificationError({code:"TIMESTAMP_ERROR",message:"invalid certificate chain"})}if(!r.certChain.every(p=>p.validForDate(c)))throw new wK.VerificationError({code:"TIMESTAMP_ERROR",message:"timestamp was signed with an expired certificate"});t.verify(e,n)}function aDt(t,e){return t.filter(r=>r.certChain.length>0&&CK.crypto.bufferEqual(r.certChain[0].serialNumber,e.serialNumber)&&CK.crypto.bufferEqual(r.certChain[0].issuer,e.issuer))}});var Bxe=_(vL=>{"use strict";Object.defineProperty(vL,"__esModule",{value:!0});vL.verifyTSATimestamp=pDt;vL.verifyTLogTimestamp=hDt;var lDt=Eo(),cDt=yxe(),uDt=Exe(),fDt=Cxe(),ADt=wxe();function pDt(t,e,r){return(0,ADt.verifyRFC3161Timestamp)(t,e,r),{type:"timestamp-authority",logID:t.signerSerialNumber,timestamp:t.signingTime}}function hDt(t,e){let r=!1;if(gDt(t)&&((0,fDt.verifyTLogSET)(t,e),r=!0),dDt(t)&&((0,uDt.verifyMerkleInclusion)(t),(0,cDt.verifyCheckpoint)(t,e),r=!0),!r)throw new lDt.VerificationError({code:"TLOG_MISSING_INCLUSION_ERROR",message:"inclusion could not be verified"});return{type:"transparency-log",logID:t.logId.keyId,timestamp:new Date(Number(t.integratedTime)*1e3)}}function gDt(t){return t.inclusionPromise!==void 0}function dDt(t){return t.inclusionProof!==void 0}});var vxe=_(vK=>{"use strict";Object.defineProperty(vK,"__esModule",{value:!0});vK.verifyDSSETLogBody=mDt;var SL=Eo();function mDt(t,e){switch(t.apiVersion){case"0.0.1":return yDt(t,e);default:throw new SL.VerificationError({code:"TLOG_BODY_ERROR",message:`unsupported dsse version: ${t.apiVersion}`})}}function yDt(t,e){if(t.spec.signatures?.length!==1)throw new SL.VerificationError({code:"TLOG_BODY_ERROR",message:"signature count mismatch"});let r=t.spec.signatures[0].signature;if(!e.compareSignature(Buffer.from(r,"base64")))throw new SL.VerificationError({code:"TLOG_BODY_ERROR",message:"tlog entry signature mismatch"});let s=t.spec.payloadHash?.value||"";if(!e.compareDigest(Buffer.from(s,"hex")))throw new SL.VerificationError({code:"TLOG_BODY_ERROR",message:"DSSE payload hash mismatch"})}});var Sxe=_(DK=>{"use strict";Object.defineProperty(DK,"__esModule",{value:!0});DK.verify Line truncated
Try running the command again with the package name prefixed: ${he.pretty(r,"yarn add",he.Type.CODE)} ${he.pretty(r,G.makeDescriptor(G.makeIdent(null,"my-package"),`${ie[0]}...`),he.Type.DESCRIPTOR)}`);if(!ee)throw new nt(`The ${he.pretty(r,W,he.Type.CODE)} string didn't match the required format (package-name@range). Did you perhaps forget to explicitly reference the package name?`);let ue=Hlt(a,ee,{dev:this.dev,peer:this.peer,preferDev:this.preferDev,optional:this.optional});return await Promise.all(ue.map(async me=>{let pe=await zv(ee,{project:s,workspace:a,cache:n,fixed:c,target:me,modifier:h,strategies:E,maxResults:C});return{request:ee,suggestedDescriptors:pe,target:me}}))})).then(W=>W.flat()),I=await lA.start({configuration:r,stdout:this.context.stdout,suggestInstall:!1},async W=>{for(let{request:ee,suggestedDescriptors:{suggestions:ie,rejections:ue}}of P)if(ie.filter(me=>me.descriptor!==null).length===0){let[me]=ue;if(typeof me>"u")throw new Error("Assertion failed: Expected an error to have been set");s.configuration.get("enableNetwork")?W.reportError(27,`${G.prettyDescriptor(r,ee)} can't be resolved to a satisfying range`):W.reportError(27,`${G.prettyDescriptor(r,ee)} can't be resolved to a satisfying range (note: network resolution has been disabled)`),W.reportSeparator(),W.reportExceptionOnce(me)}});if(I.hasErrors())return I.exitCode();let R=!1,N=[],U=[];for(let{suggestedDescriptors:{suggestions:W},target:ee}of P){let ie,ue=W.filter(Be=>Be.descriptor!==null),le=ue[0].descriptor,me=ue.every(Be=>G.areDescriptorsEqual(Be.descriptor,le));ue.length===1||me?ie=le:(R=!0,{answer:ie}=await(0,hye.prompt)({type:"select",name:"answer",message:"Which range do you want to use?",choices:W.map(({descriptor:Be,name:Ce,reason:g})=>Be?{name:Ce,hint:g,descriptor:Be}:{name:Ce,hint:g,disabled:!0}),onCancel:()=>process.exit(130),result(Be){return this.find(Be,"descriptor")},stdin:this.context.stdin,stdout:this.context.stdout}));let pe=a.manifest[ee].get(ie.identHash);(typeof pe>"u"||pe.descriptorHash!==ie.descriptorHash)&&(a.manifest[ee].set(ie.identHash,ie),this.optional&&(ee==="dependencies"?a.manifest.ensureDependencyMeta({...ie,range:"unknown"}).optional=!0:ee==="peerDependencies"&&(a.manifest.ensurePeerDependencyMeta({...ie,range:"unknown"}).optional=!0)),typeof pe>"u"?N.push([a,ee,ie,E]):U.push([a,ee,pe,ie]))}return await r.triggerMultipleHooks(W=>W.afterWorkspaceDependencyAddition,N),await r.triggerMultipleHooks(W=>W.afterWorkspaceDependencyReplacement,U),R&&this.context.stdout.write(`
`),await s.installWithNewReport({json:this.json,stdout:this.context.stdout,quiet:this.context.quiet},{cache:n,mode:this.mode})}};function Hlt(t,e,{dev:r,peer:s,preferDev:a,optional:n}){let c=t.manifest.dependencies.has(e.identHash),f=t.manifest.devDependencies.has(e.identHash),p=t.manifest.peerDependencies.has(e.identHash);if((r||s)&&c)throw new nt(`Package "${G.prettyIdent(t.project.configuration,e)}" is already listed as a regular dependency - remove the -D,-P flags or remove it from your dependencies first`);if(!r&&!s&&p)throw new nt(`Package "${G.prettyIdent(t.project.configuration,e)}" is already listed as a peer dependency - use either of -D or -P, or remove it from your peer dependencies first`);if(n&&f)throw new nt(`Package "${G.prettyIdent(t.project.configuration,e)}" is already listed as a dev dependency - remove the -O flag or remove it from your dev dependencies first`);if(n&&!s&&p)throw new nt(`Package "${G.prettyIdent(t.project.configuration,e)}" is already listed as a peer dependency - remove the -O flag or add the -P flag or remove it from your peer dependencies first`);if((r||a)&&n)throw new nt(`Package "${G.prettyIdent(t.project.configuration,e)}" cannot simultaneously be a dev dependency and an optional dependency`);let h=[];return s&&h.push("peerDependencies"),(r||a)&&h.push("devDependencies"),n&&h.push("dependencies"),h.length>0?h:f?["devDependencies"]:p?["peerDependencies"]:["dependencies"]}Ge();Ge();Yt();var oC=class extends ft{constructor(){super(...arguments);this.verbose=ge.Boolean("-v,--verbose",!1,{description:"Print both the binary name and the locator of the package that provides the binary"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.name=ge.String({required:!1})}static{this.paths=[["bin"]]}static{this.usage=ot.Usage({description:"get the path to a binary script",details:`
When used without arguments, this command will print the list of all the binaries available in the current workspace. Adding the \`-v,--verbose\` flag will cause the output to contain both the binary name and the locator of the package that provides the binary.
When an argument is specified, this command will just print the path to the binary on the standard output and exit. Note that the reported path may be stored within a zip archive.
`,examples:[["List all the available binaries","$0 bin"],["Print the path to a specific binary","$0 bin eslint"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,locator:a}=await Tt.find(r,this.context.cwd);if(await s.restoreInstallState(),this.name){let f=(await In.getPackageAccessibleBinaries(a,{project:s})).get(this.name);if(!f)throw new nt(`Couldn't find a binary named "${this.name}" for package "${G.prettyLocator(r,a)}"`);let[,p]=f;return this.context.stdout.write(`${p}
`),0}return(await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout},async c=>{let f=await In.getPackageAccessibleBinaries(a,{project:s}),h=Array.from(f.keys()).reduce((E,C)=>Math.max(E,C.length),0);for(let[E,[C,S]]of f)c.reportJson({name:E,source:G.stringifyIdent(C),path:S});if(this.verbose)for(let[E,[C]]of f)c.reportInfo(null,`${E.padEnd(h," ")} ${G.prettyLocator(r,C)}`);else for(let E of f.keys())c.reportInfo(null,E)})).exitCode()}};Ge();Dt();Yt();var aC=class extends ft{constructor(){super(...arguments);this.mirror=ge.Boolean("--mirror",!1,{description:"Remove the global cache files instead of the local cache files"});this.all=ge.Boolean("--all",!1,{description:"Remove both the global cache files and the local cache files of the current project"})}static{this.paths=[["cache","clean"],["cache","clear"]]}static{this.usage=ot.Usage({description:"remove the shared cache files",details:`
This command will remove all the files from the cache.
`,examples:[["Remove all the local archives","$0 cache clean"],["Remove all the archives stored in the ~/.yarn directory","$0 cache clean --mirror"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);if(!r.get("enableCacheClean"))throw new nt("Cache cleaning is currently disabled. To enable it, set `enableCacheClean: true` in your configuration file. Note: Cache cleaning is typically not required and should be avoided when using Zero-Installs.");let s=await Kr.find(r);return(await Ot.start({configuration:r,stdout:this.context.stdout},async()=>{let n=(this.all||this.mirror)&&s.mirrorCwd!==null,c=!this.mirror;n&&(await ce.removePromise(s.mirrorCwd),await r.triggerHook(f=>f.cleanGlobalArtifacts,r)),c&&await ce.removePromise(s.cwd)})).exitCode()}};Ge();Yt();ql();var J5=Ie("util"),lC=class extends ft{constructor(){super(...arguments);this.why=ge.Boolean("--why",!1,{description:"Print the explanation for why a setting has its value"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.unsafe=ge.Boolean("--no-redacted",!1,{description:"Don't redact secrets (such as tokens) from the output"});this.name=ge.String()}static{this.paths=[["config","get"]]}static{this.usage=ot.Usage({description:"read a configuration settings",details:`
This command will print a configuration setting.
Secrets (such as tokens) will be redacted from the output by default. If this behavior isn't desired, set the \`--no-redacted\` to get the untransformed value.
`,examples:[["Print a simple configuration setting","yarn config get yarnPath"],["Print a complex configuration setting","yarn config get packageExtensions"],["Print a nested field from the configuration",`yarn config get 'npmScopes["my-company"].npmRegistryServer'`],["Print a token from the configuration","yarn config get npmAuthToken --no-redacted"],["Print a configuration setting as JSON","yarn config get packageExtensions --json"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s=this.name.replace(/[.[].*$/,""),a=this.name.replace(/^[^.[]*/,"");if(typeof r.settings.get(s)>"u")throw new nt(`Couldn't find a configuration settings named "${s}"`);let c=r.getSpecial(s,{hideSecrets:!this.unsafe,getNativePaths:!0}),f=je.convertMapsToIndexableObjects(c),p=a?va(f,a):f,h=await Ot.start({configuration:r,includeFooter:!1,json:this.json,stdout:this.context.stdout},async E=>{E.reportJson(p)});if(!this.json){if(typeof p=="string")return this.context.stdout.write(`${p}
`),h.exitCode();J5.inspect.styles.name="cyan",this.context.stdout.write(`${(0,J5.inspect)(p,{depth:1/0,colors:r.get("enableColors"),compact:!1})}
`)}return h.exitCode()}};Ge();Yt();ql();var K5=Ie("util"),cC=class extends ft{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Set complex configuration settings to JSON values"});this.home=ge.Boolean("-H,--home",!1,{description:"Update the home configuration instead of the project configuration"});this.name=ge.String();this.value=ge.String()}static{this.paths=[["config","set"]]}static{this.usage=ot.Usage({description:"change a configuration settings",details:`
This command will set a configuration setting.
When used without the \`--json\` flag, it can only set a simple configuration setting (a string, a number, or a boolean).
When used with the \`--json\` flag, it can set both simple and complex configuration settings, including Arrays and Objects.
`,examples:[["Set a simple configuration setting (a string, a number, or a boolean)","yarn config set initScope myScope"],["Set a simple configuration setting (a string, a number, or a boolean) using the `--json` flag",'yarn config set initScope --json \\"myScope\\"'],["Set a complex configuration setting (an Array) using the `--json` flag",`yarn config set unsafeHttpWhitelist --json '["*.example.com", "example.com"]'`],["Set a complex configuration setting (an Object) using the `--json` flag",`yarn config set packageExtensions --json '{ "@babel/parser@*": { "dependencies": { "@babel/types": "*" } } }'`],["Set a nested configuration setting",'yarn config set npmScopes.company.npmRegistryServer "https://npm.example.com"'],["Set a nested configuration setting using indexed access for non-simple keys",`yarn config set 'npmRegistries["//npm.example.com"].npmAuthToken' "ffffffff-ffff-ffff-ffff-ffffffffffff"`]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s=()=>{if(!r.projectCwd)throw new nt("This command must be run from within a project folder");return r.projectCwd},a=this.name.replace(/[.[].*$/,""),n=this.name.replace(/^[^.[]*\.?/,"");if(typeof r.settings.get(a)>"u")throw new nt(`Couldn't find a configuration settings named "${a}"`);if(a==="enableStrictSettings")throw new nt("This setting only affects the file it's in, and thus cannot be set from the CLI");let f=this.json?JSON.parse(this.value):this.value;await(this.home?I=>ze.updateHomeConfiguration(I):I=>ze.updateConfiguration(s(),I))(I=>{if(n){let R=f0(I);return Jd(R,this.name,f),R}else return{...I,[a]:f}});let E=(await ze.find(this.context.cwd,this.context.plugins)).getSpecial(a,{hideSecrets:!0,getNativePaths:!0}),C=je.convertMapsToIndexableObjects(E),S=n?va(C,n):C;return(await Ot.start({configuration:r,includeFooter:!1,stdout:this.context.stdout},async I=>{K5.inspect.styles.name="cyan",I.reportInfo(0,`Successfully set ${this.name} to ${(0,K5.inspect)(S,{depth:1/0,colors:r.get("enableColors"),compact:!1})}`)})).exitCode()}};Ge();Yt();ql();var uC=class extends ft{constructor(){super(...arguments);this.home=ge.Boolean("-H,--home",!1,{description:"Update the home configuration instead of the project configuration"});this.name=ge.String()}static{this.paths=[["config","unset"]]}static{this.usage=ot.Usage({description:"unset a configuration setting",details:`
This command will unset a configuration setting.
`,examples:[["Unset a simple configuration setting","yarn config unset initScope"],["Unset a complex configuration setting","yarn config unset packageExtensions"],["Unset a nested configuration setting","yarn config unset npmScopes.company.npmRegistryServer"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s=()=>{if(!r.projectCwd)throw new nt("This command must be run from within a project folder");return r.projectCwd},a=this.name.replace(/[.[].*$/,""),n=this.name.replace(/^[^.[]*\.?/,"");if(typeof r.settings.get(a)>"u")throw new nt(`Couldn't find a configuration settings named "${a}"`);let f=this.home?h=>ze.updateHomeConfiguration(h):h=>ze.updateConfiguration(s(),h);return(await Ot.start({configuration:r,includeFooter:!1,stdout:this.context.stdout},async h=>{let E=!1;await f(C=>{if(!vB(C,this.name))return h.reportWarning(0,`Configuration doesn't contain setting ${this.name}; there is nothing to unset`),E=!0,C;let S=n?f0(C):{...C};return A0(S,this.name),S}),E||h.reportInfo(0,`Successfully unset ${this.name}`)})).exitCode()}};Ge();Dt();Yt();var tF=Ie("util"),fC=class extends ft{constructor(){super(...arguments);this.noDefaults=ge.Boolean("--no-defaults",!1,{description:"Omit the default values from the display"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.verbose=ge.Boolean("-v,--verbose",{hidden:!0});this.why=ge.Boolean("--why",{hidden:!0});this.names=ge.Rest()}static{this.paths=[["config"]]}static{this.usage=ot.Usage({description:"display the current configuration",details:`
This command prints the current active configuration settings.
`,examples:[["Print the active configuration settings","$0 config"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins,{strict:!1}),s=await SI({configuration:r,stdout:this.context.stdout,forceError:this.json},[{option:this.verbose,message:"The --verbose option is deprecated, the settings' descriptions are now always displayed"},{option:this.why,message:"The --why option is deprecated, the settings' sources are now always displayed"}]);if(s!==null)return s;let a=this.names.length>0?[...new Set(this.names)].sort():[...r.settings.keys()].sort(),n,c=await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async f=>{if(r.invalid.size>0&&!this.json){for(let[p,h]of r.invalid)f.reportError(34,`Invalid configuration key "${p}" in ${h}`);f.reportSeparator()}if(this.json)for(let p of a){if(this.noDefaults&&!r.sources.has(p))continue;let h=r.settings.get(p);typeof h>"u"&&f.reportError(34,`No configuration key named "${p}"`);let E=r.getSpecial(p,{hideSecrets:!0,getNativePaths:!0}),C=r.sources.get(p)??"<default>",S=C&&C[0]!=="<"?fe.fromPortablePath(C):C;f.reportJson({key:p,effective:E,source:S,...h})}else{let p={breakLength:1/0,colors:r.get("enableColors"),maxArrayLength:2},h={},E={children:h};for(let C of a){if(this.noDefaults&&!r.sources.has(C))continue;let S=r.settings.get(C),P=r.sources.get(C)??"<default>",I=r.getSpecial(C,{hideSecrets:!0,getNativePaths:!0}),R={Description:{label:"Description",value:he.tuple(he.Type.MARKDOWN,{text:S.description,format:this.cli.format(),paragraphs:!1})},Source:{label:"Source",value:he.tuple(P[0]==="<"?he.Type.CODE:he.Type.PATH,P)}};h[C]={value:he.tuple(he.Type.CODE,C),children:R};let N=(U,W)=>{for(let[ee,ie]of W)if(ie instanceof Map){let ue={};U[ee]={children:ue},N(ue,ie)}else U[ee]={label:ee,value:he.tuple(he.Type.NO_HINT,(0,tF.inspect)(ie,p))}};I instanceof Map?N(R,I):R.Value={label:"Value",value:he.tuple(he.Type.NO_HINT,(0,tF.inspect)(I,p))}}a.length!==1&&(n=void 0),xs.emitTree(E,{configuration:r,json:this.json,stdout:this.context.stdout,separators:2})}});if(!this.json&&typeof n<"u"){let f=a[0],p=(0,tF.inspect)(r.getSpecial(f,{hideSecrets:!0,getNativePaths:!0}),{colors:r.get("enableColors")});this.context.stdout.write(`
`),this.context.stdout.write(`${p}
`)}return c.exitCode()}};Ge();Yt();Ul();var rF={};Vt(rF,{Strategy:()=>Xv,acceptedStrategies:()=>jlt,dedupe:()=>z5});Ge();Ge();var gye=ut(Go()),Xv=(e=>(e.HIGHEST="highest",e))(Xv||{}),jlt=new Set(Object.values(Xv)),Glt={highest:async(t,e,{resolver:r,fetcher:s,resolveOptions:a,fetchOptions:n})=>{let c=new Map;for(let[p,h]of t.storedResolutions){let E=t.storedDescriptors.get(p);if(typeof E>"u")throw new Error(`Assertion failed: The descriptor (${p}) should have been registered`);je.getSetWithDefault(c,E.identHash).add(h)}let f=new Map(je.mapAndFilter(t.storedDescriptors.values(),p=>G.isVirtualDescriptor(p)?je.mapAndFilter.skip:[p.descriptorHash,je.makeDeferred()]));for(let p of t.storedDescriptors.values()){let h=f.get(p.descriptorHash);if(typeof h>"u")throw new Error(`Assertion failed: The descriptor (${p.descriptorHash}) should have been registered`);let E=t.storedResolutions.get(p.descriptorHash);if(typeof E>"u")throw new Error(`Assertion failed: The resolution (${p.descriptorHash}) should have been registered`);let C=t.originalPackages.get(E);if(typeof C>"u")throw new Error(`Assertion failed: The package (${E}) should have been registered`);Promise.resolve().then(async()=>{let S=r.getResolutionDependencies(p,a),P=Object.fromEntries(await je.allSettledSafe(Object.entries(S).map(async([ee,ie])=>{let ue=f.get(ie.descriptorHash);if(typeof ue>"u")throw new Error(`Assertion failed: The descriptor (${ie.descriptorHash}) should have been registered`);let le=await ue.promise;if(!le)throw new Error("Assertion failed: Expected the dependency to have been through the dedupe process itself");return[ee,le.updatedPackage]})));if(e.length&&!gye.default.isMatch(G.stringifyIdent(p),e)||!r.shouldPersistResolution(C,a))return C;let I=c.get(p.identHash);if(typeof I>"u")throw new Error(`Assertion failed: The resolutions (${p.identHash}) should have been registered`);if(I.size===1)return C;let R=[...I].map(ee=>{let ie=t.originalPackages.get(ee);if(typeof ie>"u")throw new Error(`Assertion failed: The package (${ee}) should have been registered`);return ie}),N=await r.getSatisfying(p,P,R,a),U=N.locators?.[0];if(typeof U>"u"||!N.sorted)return C;let W=t.originalPackages.get(U.locatorHash);if(typeof W>"u")throw new Error(`Assertion failed: The package (${U.locatorHash}) should have been registered`);return W}).then(async S=>{let P=await t.preparePackage(S,{resolver:r,resolveOptions:a});h.resolve({descriptor:p,currentPackage:C,updatedPackage:S,resolvedPackage:P})}).catch(S=>{h.reject(S)})}return[...f.values()].map(p=>p.promise)}};async function z5(t,{strategy:e,patterns:r,cache:s,report:a}){let{configuration:n}=t,c=new ki,f=n.makeResolver(),p=n.makeFetcher(),h={cache:s,checksums:t.storedChecksums,fetcher:p,project:t,report:c,cacheOptions:{skipIntegrityCheck:!0}},E={project:t,resolver:f,report:c,fetchOptions:h};return await a.startTimerPromise("Deduplication step",async()=>{let C=Glt[e],S=await C(t,r,{resolver:f,resolveOptions:E,fetcher:p,fetchOptions:h}),P=Ao.progressViaCounter(S.length);await a.reportProgress(P);let I=0;await Promise.all(S.map(U=>U.then(W=>{if(W===null||W.currentPackage.locatorHash===W.updatedPackage.locatorHash)return;I++;let{descriptor:ee,currentPackage:ie,updatedPackage:ue}=W;a.reportInfo(0,`${G.prettyDescriptor(n,ee)} can be deduped from ${G.prettyLocator(n,ie)} to ${G.prettyLocator(n,ue)}`),a.reportJson({descriptor:G.stringifyDescriptor(ee),currentResolution:G.stringifyLocator(ie),updatedResolution:G.stringifyLocator(ue)}),t.storedResolutions.set(ee.descriptorHash,ue.locatorHash)}).finally(()=>P.tick())));let R;switch(I){case 0:R="No packages";break;case 1:R="One package";break;default:R=`${I} packages`}let N=he.pretty(n,e,he.Type.CODE);return a.reportInfo(0,`${R} can be deduped using the ${N} strategy`),I})}var AC=class extends ft{constructor(){super(...arguments);this.strategy=ge.String("-s,--strategy","highest",{description:"The strategy to use when deduping dependencies",validator:fo(Xv)});this.check=ge.Boolean("-c,--check",!1,{description:"Exit with exit code 1 when duplicates are found, without persisting the dependency tree"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.mode=ge.String("--mode",{description:"Change what artifacts installs generate",validator:fo($l)});this.patterns=ge.Rest()}static{this.paths=[["dedupe"]]}static{this.usage=ot.Usage({description:"deduplicate dependencies with overlapping ranges",details:"\n Duplicates are defined as descriptors with overlapping ranges being resolved and locked to different locators. They are a natural consequence of Yarn's deterministic installs, but they can sometimes pile up and unnecessarily increase the size of your project.\n\n This command dedupes dependencies in the current project using different strategies (only one is implemented at the moment):\n\n - `highest`: Reuses (where possible) the locators with the highest versions. This means that dependencies can only be upgraded, never dow Line truncated
`)}};var hC=class extends ft{static{this.paths=[["help"],["--help"],["-h"]]}async execute(){this.context.stdout.write(this.cli.usage(null))}};Ge();Dt();Yt();var gC=class extends ft{constructor(){super(...arguments);this.leadingArgument=ge.String();this.args=ge.Proxy()}async execute(){if(this.leadingArgument.match(/[\\/]/)&&!G.tryParseIdent(this.leadingArgument)){let r=J.resolve(this.context.cwd,fe.toPortablePath(this.leadingArgument));return await this.cli.run(this.args,{cwd:r})}else return await this.cli.run(["run",this.leadingArgument,...this.args])}};Ge();var dC=class extends ft{static{this.paths=[["-v"],["--version"]]}async execute(){this.context.stdout.write(`${fn||"<unknown>"}
`)}};Ge();Ge();Yt();var mC=class extends ft{constructor(){super(...arguments);this.commandName=ge.String();this.args=ge.Proxy()}static{this.paths=[["exec"]]}static{this.usage=ot.Usage({description:"execute a shell script",details:`
This command simply executes a shell script within the context of the root directory of the active workspace using the portable shell.
It also makes sure to call it in a way that's compatible with the current project (for example, on PnP projects the environment will be setup in such a way that PnP will be correctly injected into the environment).
`,examples:[["Execute a single shell command","$0 exec echo Hello World"],["Execute a shell script",'$0 exec "tsc & babel src --out-dir lib"']]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,locator:a}=await Tt.find(r,this.context.cwd);return await s.restoreInstallState(),await In.executePackageShellcode(a,this.commandName,this.args,{cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,project:s})}};Ge();Yt();Ul();var yC=class extends ft{constructor(){super(...arguments);this.hash=ge.String({required:!1,validator:Nx(wE(),[Z2(/^p[0-9a-f]{6}$/)])})}static{this.paths=[["explain","peer-requirements"]]}static{this.usage=ot.Usage({description:"explain a set of peer requirements",details:`
A peer requirement represents all peer requests that a subject must satisfy when providing a requested package to requesters.
When the hash argument is specified, this command prints a detailed explanation of the peer requirement corresponding to the hash and whether it is satisfied or not.
When used without arguments, this command lists all peer requirements and the corresponding hash that can be used to get detailed information about a given requirement.
**Note:** A hash is a seven-letter code consisting of the letter 'p' followed by six characters that can be obtained from peer dependency warnings or from the list of all peer requirements(\`yarn explain peer-requirements\`).
`,examples:[["Explain the corresponding peer requirement for a hash","$0 explain peer-requirements p1a4ed"],["List all peer requirements","$0 explain peer-requirements"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s}=await Tt.find(r,this.context.cwd);return await s.restoreInstallState({restoreResolutions:!1}),await s.applyLightResolution(),typeof this.hash<"u"?await Wlt(this.hash,s,{stdout:this.context.stdout}):await Ylt(s,{stdout:this.context.stdout})}};async function Wlt(t,e,r){let s=e.peerRequirementNodes.get(t);if(typeof s>"u")throw new Error(`No peerDependency requirements found for hash: "${t}"`);let a=new Set,n=p=>a.has(p.requester.locatorHash)?{value:he.tuple(he.Type.DEPENDENT,{locator:p.requester,descriptor:p.descriptor}),children:p.children.size>0?[{value:he.tuple(he.Type.NO_HINT,"...")}]:[]}:(a.add(p.requester.locatorHash),{value:he.tuple(he.Type.DEPENDENT,{locator:p.requester,descriptor:p.descriptor}),children:Object.fromEntries(Array.from(p.children.values(),h=>[G.stringifyLocator(h.requester),n(h)]))}),c=e.peerWarnings.find(p=>p.hash===t);return(await Ot.start({configuration:e.configuration,stdout:r.stdout,includeFooter:!1,includePrefix:!1},async p=>{let h=he.mark(e.configuration),E=c?h.Cross:h.Check;if(p.reportInfo(0,`Package ${he.pretty(e.configuration,s.subject,he.Type.LOCATOR)} is requested to provide ${he.pretty(e.configuration,s.ident,he.Type.IDENT)} by its descendants`),p.reportSeparator(),p.reportInfo(0,he.pretty(e.configuration,s.subject,he.Type.LOCATOR)),xs.emitTree({children:Object.fromEntries(Array.from(s.requests.values(),C=>[G.stringifyLocator(C.requester),n(C)]))},{configuration:e.configuration,stdout:r.stdout,json:!1}),p.reportSeparator(),s.provided.range==="missing:"){let C=c?"":" , but all peer requests are optional";p.reportInfo(0,`${E} Package ${he.pretty(e.configuration,s.subject,he.Type.LOCATOR)} does not provide ${he.pretty(e.configuration,s.ident,he.Type.IDENT)}${C}.`)}else{let C=e.storedResolutions.get(s.provided.descriptorHash);if(!C)throw new Error("Assertion failed: Expected the descriptor to be registered");let S=e.storedPackages.get(C);if(!S)throw new Error("Assertion failed: Expected the package to be registered");p.reportInfo(0,`${E} Package ${he.pretty(e.configuration,s.subject,he.Type.LOCATOR)} provides ${he.pretty(e.configuration,s.ident,he.Type.IDENT)} with version ${G.prettyReference(e.configuration,S.version??"0.0.0")}, ${c?"which does not satisfy all requests.":"which satisfies all requests"}`),c?.type===3&&(c.range?p.reportInfo(0,` The combined requested range is ${he.pretty(e.configuration,c.range,he.Type.RANGE)}`):p.reportInfo(0," Unfortunately, the requested ranges have no overlap"))}})).exitCode()}async function Ylt(t,e){return(await Ot.start({configuration:t.configuration,stdout:e.stdout,includeFooter:!1,includePrefix:!1},async s=>{let a=he.mark(t.configuration),n=je.sortMap(t.peerRequirementNodes,[([,c])=>G.stringifyLocator(c.subject),([,c])=>G.stringifyIdent(c.ident)]);for(let[,c]of n.values()){if(!c.root)continue;let f=t.peerWarnings.find(E=>E.hash===c.hash),p=[...G.allPeerRequests(c)],h;if(p.length>2?h=` and ${p.length-1} other dependencies`:p.length===2?h=" and 1 other dependency":h="",c.provided.range!=="missing:"){let E=t.storedResolutions.get(c.provided.descriptorHash);if(!E)throw new Error("Assertion failed: Expected the resolution to have been registered");let C=t.storedPackages.get(E);if(!C)throw new Error("Assertion failed: Expected the provided package to have been registered");let S=`${he.pretty(t.configuration,c.hash,he.Type.CODE)} \u2192 ${f?a.Cross:a.Check} ${G.prettyLocator(t.configuration,c.subject)} provides ${G.prettyLocator(t.configuration,C)} to ${G.prettyLocator(t.configuration,p[0].requester)}${h}`;f?s.reportWarning(0,S):s.reportInfo(0,S)}else{let E=`${he.pretty(t.configuration,c.hash,he.Type.CODE)} \u2192 ${f?a.Cross:a.Check} ${G.prettyLocator(t.configuration,c.subject)} doesn't provide ${G.prettyIdent(t.configuration,c.ident)} to ${G.prettyLocator(t.configuration,p[0].requester)}${h}`;f?s.reportWarning(0,E):s.reportInfo(0,E)}}})).exitCode()}Ge();Yt();Ul();Ge();Ge();Dt();Yt();var mye=ut(Ai()),EC=class extends ft{constructor(){super(...arguments);this.useYarnPath=ge.Boolean("--yarn-path",{description:"Set the yarnPath setting even if the version can be accessed by Corepack"});this.onlyIfNeeded=ge.Boolean("--only-if-needed",!1,{description:"Only lock the Yarn version if it isn't already locked"});this.version=ge.String()}static{this.paths=[["set","version"]]}static{this.usage=ot.Usage({description:"lock the Yarn version used by the project",details:"\n This command will set a specific release of Yarn to be used by Corepack: https://nodejs.org/api/corepack.html.\n\n By default it only will set the `packageManager` field at the root of your project, but if the referenced release cannot be represented this way, if you already have `yarnPath` configured, or if you set th Line truncated
${e}`)})}let f=t.projectCwd??t.startingCwd,p=J.resolve(f,".yarn/releases"),h=J.resolve(p,`yarn-${e}.cjs`),E=J.relative(t.startingCwd,h),C=je.isTaggedYarnVersion(e),S=t.get("yarnPath"),P=!C,I=P||!!S||!!a;if(a===!1){if(P)throw new jt(0,"You explicitly opted out of yarnPath usage in your command line, but the version you specified cannot be represented by Corepack");I=!1}else!I&&!process.env.COREPACK_ROOT&&(s.reportWarning(0,`You don't seem to have ${he.applyHyperlink(t,"Corepack","https://nodejs.org/api/corepack.html")} enabled; we'll have to rely on ${he.applyHyperlink(t,"yarnPath","https://yarnpkg.com/configuration/yarnrc#yarnPath")} instead`),I=!0);if(I){let ee=await c();s.reportInfo(0,`Saving the new release in ${he.pretty(t,E,"magenta")}`),await ce.removePromise(J.dirname(h)),await ce.mkdirPromise(J.dirname(h),{recursive:!0}),await ce.writeFilePromise(h,ee,{mode:493}),await ze.updateConfiguration(f,{yarnPath:J.relative(f,h)})}else await ce.removePromise(J.dirname(h)),await ze.updateConfiguration(f,{yarnPath:ze.deleteProperty});let R=await Ut.tryFind(f)||new Ut;R.packageManager=`yarn@${C?e:await Zv(t,"stable")}`;let N={};R.exportTo(N);let U=J.join(f,Ut.fileName),W=`${JSON.stringify(N,null,R.indent)}
`;return await ce.changeFilePromise(U,W,{automaticNewlines:!0}),{bundleVersion:e}}function yye(t){return Br[jx(t)]}var Jlt=/## (?<code>YN[0-9]{4}) - `(?<name>[A-Z_]+)`\n\n(?<details>(?:.(?!##))+)/gs;async function Klt(t){let r=`https://repo.yarnpkg.com/${je.isTaggedYarnVersion(fn)?fn:await Zv(t,"canary")}/packages/docusaurus/docs/advanced/01-general-reference/error-codes.mdx`,s=await nn.get(r,{configuration:t});return new Map(Array.from(s.toString().matchAll(Jlt),({groups:a})=>{if(!a)throw new Error("Assertion failed: Expected the match to have been successful");let n=yye(a.code);if(a.name!==n)throw new Error(`Assertion failed: Invalid error code data: Expected "${a.name}" to be named "${n}"`);return[a.code,a.details]}))}var IC=class extends ft{constructor(){super(...arguments);this.code=ge.String({required:!1,validator:$2(wE(),[Z2(/^YN[0-9]{4}$/)])});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["explain"]]}static{this.usage=ot.Usage({description:"explain an error code",details:`
When the code argument is specified, this command prints its name and its details.
When used without arguments, this command lists all error codes and their names.
`,examples:[["Explain an error code","$0 explain YN0006"],["List all error codes","$0 explain"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);if(typeof this.code<"u"){let s=yye(this.code),a=he.pretty(r,s,he.Type.CODE),n=this.cli.format().header(`${this.code} - ${a}`),f=(await Klt(r)).get(this.code),p=typeof f<"u"?he.jsonOrPretty(this.json,r,he.tuple(he.Type.MARKDOWN,{text:f,format:this.cli.format(),paragraphs:!0})):`This error code does not have a description.
You can help us by editing this page on GitHub \u{1F642}:
${he.jsonOrPretty(this.json,r,he.tuple(he.Type.URL,"https://github.com/yarnpkg/berry/blob/master/packages/docusaurus/docs/advanced/01-general-reference/error-codes.mdx"))}
`;this.json?this.context.stdout.write(`${JSON.stringify({code:this.code,name:s,details:p})}
`):this.context.stdout.write(`${n}
${p}
`)}else{let s={children:je.mapAndFilter(Object.entries(Br),([a,n])=>Number.isNaN(Number(a))?je.mapAndFilter.skip:{label:Yf(Number(a)),value:he.tuple(he.Type.CODE,n)})};xs.emitTree(s,{configuration:r,stdout:this.context.stdout,json:this.json})}}};Ge();Dt();Yt();var Eye=ut(Go()),CC=class extends ft{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Print versions of a package from the whole project"});this.recursive=ge.Boolean("-R,--recursive",!1,{description:"Print information for all packages, including transitive dependencies"});this.extra=ge.Array("-X,--extra",[],{description:"An array of requests of extra data provided by plugins"});this.cache=ge.Boolean("--cache",!1,{description:"Print information about the cache entry of a package (path, size, checksum)"});this.dependents=ge.Boolean("--dependents",!1,{description:"Print all dependents for each matching package"});this.manifest=ge.Boolean("--manifest",!1,{description:"Print data obtained by looking at the package archive (license, homepage, ...)"});this.nameOnly=ge.Boolean("--name-only",!1,{description:"Only print the name for the matching packages"});this.virtuals=ge.Boolean("--virtuals",!1,{description:"Print each instance of the virtual packages"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.patterns=ge.Rest()}static{this.paths=[["info"]]}static{this.usage=ot.Usage({description:"see information related to packages",details:"\n This command prints various information related to the specified packages, accepting glob patterns.\n\n By default, if the locator reference is missing, Yarn will default to print the information about all the matching direct dependencies of the package for the active workspace. To instead print all versions of the package that are direct dependencies of any of your workspaces, use the `-A,--all` flag. Adding the `-R,--recursive` flag will also report transitive dependencies.\n\n Some fields will be hidden by default in order to keep the output readable, but can be selectively displayed by using additional options (`--dependents`, `--manifest`, `--virtuals`, ...) described in the option descriptions.\n\n Note that this command will only print the information directly related to the selected packages - if you wish to know why the package is there in the first place, use `yarn why` which will do just that (it also provides a `-R,--recursive` flag that may be of some help).\n ",examples:[["Show information about Lodash","$0 info lodash"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Kr.find(r);if(!a&&!this.all)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState();let c=new Set(this.extra);this.cache&&c.add("cache"),this.dependents&&c.add("dependents"),this.manifest&&c.add("manifest");let f=(ie,{recursive:ue})=>{let le=ie.anchoredLocator.locatorHash,me=new Map,pe=[le];for(;pe.length>0;){let Be=pe.shift();if(me.has(Be))continue;let Ce=s.storedPackages.get(Be);if(typeof Ce>"u")throw new Error("Assertion failed: Expected the package to be registered");if(me.set(Be,Ce),G.isVirtualLocator(Ce)&&pe.push(G.devirtualizeLocator(Ce).locatorHash),!(!ue&&Be!==le))for(let g of Ce.dependencies.values()){let we=s.storedResolutions.get(g.descriptorHash);if(typeof we>"u")throw new Error("Assertion failed: Expected the resolution to be registered");pe.push(we)}}return me.values()},p=({recursive:ie})=>{let ue=new Map;for(let le of s.workspaces)for(let me of f(le,{recursive:ie}))ue.set(me.locatorHash,me);return ue.values()},h=({all:ie,recursive:ue})=>ie&&ue?s.storedPackages.values():ie?p({recursive:ue}):f(a,{recursive:ue}),E=({all:ie,recursive:ue})=>{let le=h({all:ie,recursive:ue}),me=this.patterns.map(Ce=>{let g=G.parseLocator(Ce),we=Eye.default.makeRe(G.stringifyIdent(g)),ye=G.isVirtualLocator(g),Ae=ye?G.devirtualizeLocator(g):g;return se=>{let Z=G.stringifyIdent(se);if(!we.test(Z))return!1;if(g.reference==="unknown")return!0;let De=G.isVirtualLocator(se),Re=De?G.devirtualizeLocator(se):se;return!(ye&&De&&g.reference!==se.reference||Ae.reference!==Re.reference)}}),pe=je.sortMap([...le],Ce=>G.stringifyLocator(Ce));return{selection:pe.filter(Ce=>me.length===0||me.some(g=>g(Ce))),sortedLookup:pe}},{selection:C,sortedLookup:S}=E({all:this.all,recursive:this.recursive});if(C.length===0)throw new nt("No package matched your request");let P=new Map;if(this.dependents)for(let ie of S)for(let ue of ie.dependencies.values()){let le=s.storedResolutions.get(ue.descriptorHash);if(typeof le>"u")throw new Error("Assertion failed: Expected the resolution to be registered");je.getArrayWithDefault(P,le).push(ie)}let I=new Map;for(let ie of S){if(!G.isVirtualLocator(ie))continue;let ue=G.devirtualizeLocator(ie);je.getArrayWithDefault(I,ue.locatorHash).push(ie)}let R={},N={children:R},U=r.makeFetcher(),W={project:s,fetcher:U,cache:n,checksums:s.storedChecksum Line truncated
This command simply runs Node. It also makes sure to call it in a way that's compatible with the current project (for example, on PnP projects the environment will be setup in such a way that PnP will be correctly injected into the environment).
The Node process will use the exact same version of Node as the one used to run Yarn itself, which might be a good way to ensure that your commands always use a consistent Node version.
`,examples:[["Run a Node script","$0 node ./my-script.js"]]})}async execute(){return this.cli.run(["exec","node",...this.args])}};Ge();Yt();var SC=class extends ft{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["plugin","check"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"find all third-party plugins that differ from their own spec",details:`
Check only the plugins from https.
If this command detects any plugin differences in the CI environment, it will throw an error.
`,examples:[["find all third-party plugins that differ from their own spec","$0 plugin check"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s=await ze.findRcFiles(this.context.cwd);return(await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout},async n=>{for(let c of s)if(c.data?.plugins)for(let f of c.data.plugins){if(!f.checksum||!f.spec.match(/^https?:/))continue;let p=await nn.get(f.spec,{configuration:r}),h=Nn.makeHash(p);if(f.checksum===h)continue;let E=he.pretty(r,f.path,he.Type.PATH),C=he.pretty(r,f.spec,he.Type.URL),S=`${E} is different from the file provided by ${C}`;n.reportJson({...f,newChecksum:h}),n.reportError(0,S)}})).exitCode()}};Ge();Ge();Dt();Yt();var vye=Ie("os");Ge();Dt();Yt();var Iye=Ie("os");Ge();wc();Yt();var ect="https://raw.githubusercontent.com/yarnpkg/berry/master/plugins.yml";async function Sm(t,e){let r=await nn.get(ect,{configuration:t}),s=ls(r.toString());return Object.fromEntries(Object.entries(s).filter(([a,n])=>!e||Fr.satisfiesWithPrereleases(e,n.range??"<4.0.0-rc.1")))}var DC=class extends ft{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["plugin","list"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"list the available official plugins",details:"\n This command prints the plugins available directly from the Yarn repository. Only those plugins can be referenced by name in `yarn plugin import`.\n ",examples:[["List the official plugins","$0 plugin list"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);return(await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout},async a=>{let n=await Sm(r,fn);for(let[c,{experimental:f,...p}]of Object.entries(n)){let h=c;f&&(h+=" [experimental]"),a.reportJson({name:c,experimental:f,...p}),a.reportInfo(null,h)}})).exitCode()}};var tct=/^[0-9]+$/,rct=process.platform==="win32";function Cye(t){return tct.test(t)?`pull/${t}/head`:t}var nct=({repository:t,branch:e},r)=>[["git","init",fe.fromPortablePath(r)],["git","remote","add","origin",t],["git","fetch","origin","--depth=1",Cye(e)],["git","reset","--hard","FETCH_HEAD"]],ict=({branch:t})=>[["git","fetch","origin","--depth=1",Cye(t),"--force"],["git","reset","--hard","FETCH_HEAD"],["git","clean","-dfx","-e","packages/yarnpkg-cli/bundles"]],sct=({plugins:t,noMinify:e},r,s)=>[["yarn","build:cli",...new Array().concat(...t.map(a=>["--plugin",J.resolve(s,a)])),...e?["--no-minify"]:[],"|"],[rct?"move":"mv","packages/yarnpkg-cli/bundles/yarn.js",fe.fromPortablePath(r),"|"]],bC=class extends ft{constructor(){super(...arguments);this.installPath=ge.String("--path",{description:"The path where the repository should be cloned to"});this.repository=ge.String("--repository","https://github.com/yarnpkg/berry.git",{description:"The repository that should be cloned"});this.branch=ge.String("--branch","master",{description:"The branch of the repository that should be cloned"});this.plugins=ge.Array("--plugin",[],{description:"An array of additional plugins that should be included in the bundle"});this.dryRun=ge.Boolean("-n,--dry-run",!1,{description:"If set, the bundle will be built but not added to the project"});this.noMinify=ge.Boolean("--no-minify",!1,{description:"Build a bundle for development (debugging) - non-minified and non-mangled"});this.force=ge.Boolean("-f,--force",!1,{description:"Always clone the repository instead of trying to fetch the latest commits"});this.skipPlugins=ge.Boolean("--skip-plugins",!1,{description:"Skip updating the contrib plugins"})}static{this.paths=[["set","version","from","sources"]]}static{this.usage=ot.Usage({description:"build Yarn from master",details:`
This command will clone the Yarn repository into a temporary folder, then build it. The resulting bundle will then be copied into the local project.
By default, it also updates all contrib plugins to the same commit the bundle is built from. This behavior can be disabled by using the \`--skip-plugins\` flag.
`,examples:[["Build Yarn from master","$0 set version from sources"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s}=await Tt.find(r,this.context.cwd),a=typeof this.installPath<"u"?J.resolve(this.context.cwd,fe.toPortablePath(this.installPath)):J.resolve(fe.toPortablePath((0,Iye.tmpdir)()),"yarnpkg-sources",Nn.makeHash(this.repository).slice(0,6));return(await Ot.start({configuration:r,stdout:this.context.stdout},async c=>{await $5(this,{configuration:r,report:c,target:a}),c.reportSeparator(),c.reportInfo(0,"Building a fresh bundle"),c.reportSeparator();let f=await qr.execvp("git",["rev-parse","--short","HEAD"],{cwd:a,strict:!0}),p=J.join(a,`packages/yarnpkg-cli/bundles/yarn-${f.stdout.trim()}.js`);ce.existsSync(p)||(await $v(sct(this,p,a),{configuration:r,context:this.context,target:a}),c.reportSeparator());let h=await ce.readFilePromise(p);if(!this.dryRun){let{bundleVersion:E}=await X5(r,null,async()=>h,{report:c});this.skipPlugins||await oct(this,E,{project:s,report:c,target:a})}})).exitCode()}};async function $v(t,{configuration:e,context:r,target:s}){for(let[a,...n]of t){let c=n[n.length-1]==="|";if(c&&n.pop(),c)await qr.pipevp(a,n,{cwd:s,stdin:r.stdin,stdout:r.stdout,stderr:r.stderr,strict:!0});else{r.stdout.write(`${he.pretty(e,` $ ${[a,...n].join(" ")}`,"grey")}
`);try{await qr.execvp(a,n,{cwd:s,strict:!0})}catch(f){throw r.stdout.write(f.stdout||f.stack),f}}}}async function $5(t,{configuration:e,report:r,target:s}){let a=!1;if(!t.force&&ce.existsSync(J.join(s,".git"))){r.reportInfo(0,"Fetching the latest commits"),r.reportSeparator();try{await $v(ict(t),{configuration:e,context:t.context,target:s}),a=!0}catch{r.reportSeparator(),r.reportWarning(0,"Repository update failed; we'll try to regenerate it")}}a||(r.reportInfo(0,"Cloning the remote repository"),r.reportSeparator(),await ce.removePromise(s),await ce.mkdirPromise(s,{recursive:!0}),await $v(nct(t,s),{configuration:e,context:t.context,target:s}))}async function oct(t,e,{project:r,report:s,target:a}){let n=await Sm(r.configuration,e),c=new Set(Object.keys(n));for(let f of r.configuration.plugins.keys())c.has(f)&&await eq(f,t,{project:r,report:s,target:a})}Ge();Ge();Dt();Yt();var wye=ut(Ai()),Bye=Ie("vm");var PC=class extends ft{constructor(){super(...arguments);this.name=ge.String();this.checksum=ge.Boolean("--checksum",!0,{description:"Whether to care if this plugin is modified"})}static{this.paths=[["plugin","import"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"download a plugin",details:`
This command downloads the specified plugin from its remote location and updates the configuration to reference it in further CLI invocations.
Three types of plugin references are accepted:
- If the plugin is stored within the Yarn repository, it can be referenced by name.
- Third-party plugins can be referenced directly through their public urls.
- Local plugins can be referenced by their path on the disk.
If the \`--no-checksum\` option is set, Yarn will no longer care if the plugin is modified.
Plugins cannot be downloaded from the npm registry, and aren't allowed to have dependencies (they need to be bundled into a single file, possibly thanks to the \`@yarnpkg/builder\` package).
`,examples:[['Download and activate the "@yarnpkg/plugin-exec" plugin',"$0 plugin import @yarnpkg/plugin-exec"],['Download and activate the "@yarnpkg/plugin-exec" plugin (shorthand)',"$0 plugin import exec"],["Download and activate a community plugin","$0 plugin import https://example.org/path/to/plugin.js"],["Activate a local plugin","$0 plugin import ./path/to/plugin.js"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);return(await Ot.start({configuration:r,stdout:this.context.stdout},async a=>{let{project:n}=await Tt.find(r,this.context.cwd),c,f;if(this.name.match(/^\.{0,2}[\\/]/)||fe.isAbsolute(this.name)){let p=J.resolve(this.context.cwd,fe.toPortablePath(this.name));a.reportInfo(0,`Reading ${he.pretty(r,p,he.Type.PATH)}`),c=J.relative(n.cwd,p),f=await ce.readFilePromise(p)}else{let p;if(this.name.match(/^https?:/)){try{new URL(this.name)}catch{throw new jt(52,`Plugin specifier "${this.name}" is neither a plugin name nor a valid url`)}c=this.name,p=this.name}else{let h=G.parseLocator(this.name.replace(/^((@yarnpkg\/)?plugin-)?/,"@yarnpkg/plugin-"));if(h.reference!=="unknown"&&!wye.default.valid(h.reference))throw new jt(0,"Official plugins only accept strict version references. Use an explicit URL if you wish to download them from another location.");let E=G.stringifyIdent(h),C=await Sm(r,fn);if(!Object.hasOwn(C,E)){let S=`Couldn't find a plugin named ${G.prettyIdent(r,h)} on the remote registry.
`;throw r.plugins.has(E)?S+=`A plugin named ${G.prettyIdent(r,h)} is already installed; possibly attempting to import a built-in plugin.`:S+=`Note that only the plugins referenced on our website (${he.pretty(r,"https://github.com/yarnpkg/berry/blob/master/plugins.yml",he.Type.URL)}) can be referenced by their name; any other plugin will have to be referenced through its public url (for example ${he.pretty(r,"https://github.com/yarnpkg/berry/raw/master/packages/plugin-typescript/bin/%40yarnpkg/plugin-typescript.js",he.Type.URL)}).`,new jt(51,S)}c=E,p=C[E].url,h.reference!=="unknown"?p=p.replace(/\/master\//,`/${E}/${h.reference}/`):fn!==null&&(p=p.replace(/\/master\//,`/@yarnpkg/cli/${fn}/`))}a.reportInfo(0,`Downloading ${he.pretty(r,p,"green")}`),f=await nn.get(p,{configuration:r})}await tq(c,f,{checksum:this.checksum,project:n,report:a})})).exitCode()}};async function tq(t,e,{checksum:r=!0,project:s,report:a}){let{configuration:n}=s,c={},f={exports:c};(0,Bye.runInNewContext)(e.toString(),{module:f,exports:c});let h=`.yarn/plugins/${f.exports.name}.cjs`,E=J.resolve(s.cwd,h);a.reportInfo(0,`Saving the new plugin in ${he.pretty(n,h,"magenta")}`),await ce.mkdirPromise(J.dirname(E),{recursive:!0}),await ce.writeFilePromise(E,e);let C={path:h,spec:t};r&&(C.checksum=Nn.makeHash(e)),await ze.addPlugin(s.cwd,[C])}var act=({pluginName:t,noMinify:e},r)=>[["yarn",`build:${t}`,...e?["--no-minify"]:[],"|"]],xC=class extends ft{constructor(){super(...arguments);this.installPath=ge.String("--path",{description:"The path where the repository should be cloned to"});this.repository=ge.String("--repository","https://github.com/yarnpkg/berry.git",{description:"The repository that should be cloned"});this.branch=ge.String("--branch","master",{description:"The branch of the repository that should be cloned"});this.noMinify=ge.Boolean("--no-minify",!1,{description:"Build a plugin for development (debugging) - non-minified and non-mangled"});this.force=ge.Boolean("-f,--force",!1,{description:"Always clone the repository instead of trying to fetch the latest commits"});this.name=ge.String()}static{this.paths=[["plugin","import","from","sources"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"build a plugin from sources",details:`
This command clones the Yarn repository into a temporary folder, builds the specified contrib plugin and updates the configuration to reference it in further CLI invocations.
The plugins can be referenced by their short name if sourced from the official Yarn repository.
`,examples:[['Build and activate the "@yarnpkg/plugin-exec" plugin',"$0 plugin import from sources @yarnpkg/plugin-exec"],['Build and activate the "@yarnpkg/plugin-exec" plugin (shorthand)',"$0 plugin import from sources exec"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s=typeof this.installPath<"u"?J.resolve(this.context.cwd,fe.toPortablePath(this.installPath)):J.resolve(fe.toPortablePath((0,vye.tmpdir)()),"yarnpkg-sources",Nn.makeHash(this.repository).slice(0,6));return(await Ot.start({configuration:r,stdout:this.context.stdout},async n=>{let{project:c}=await Tt.find(r,this.context.cwd),f=G.parseIdent(this.name.replace(/^((@yarnpkg\/)?plugin-)?/,"@yarnpkg/plugin-")),p=G.stringifyIdent(f),h=await Sm(r,fn);if(!Object.hasOwn(h,p))throw new jt(51,`Couldn't find a plugin named "${p}" on the remote registry. Note that only the plugins referenced on our website (https://github.com/yarnpkg/berry/blob/master/plugins.yml) can be built and imported from sources.`);let E=p;await $5(this,{configuration:r,report:n,target:s}),await eq(E,this,{project:c,report:n,target:s})})).exitCode()}};async function eq(t,{context:e,noMinify:r},{project:s,report:a,target:n}){let c=t.replace(/@yarnpkg\//,""),{configuration:f}=s;a.reportSeparator(),a.reportInfo(0,`Building a fresh ${c}`),a.reportSeparator(),await $v(act({pluginName:c,noMinify:r},n),{configuration:f,context:e,target:n}),a.reportSeparator();let p=J.resolve(n,`packages/${c}/bundles/${t}.js`),h=await ce.readFilePromise(p);await tq(t,h,{project:s,report:a})}Ge();Dt();Yt();var kC=class extends ft{constructor(){super(...arguments);this.name=ge.String()}static{this.paths=[["plugin","remove"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"remove a plugin",details:`
This command deletes the specified plugin from the .yarn/plugins folder and removes it from the configuration.
**Note:** The plugins have to be referenced by their name property, which can be obtained using the \`yarn plugin runtime\` command. Shorthands are not allowed.
`,examples:[["Remove a plugin imported from the Yarn repository","$0 plugin remove @yarnpkg/plugin-typescript"],["Remove a plugin imported from a local file","$0 plugin remove my-local-plugin"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s}=await Tt.find(r,this.context.cwd);return(await Ot.start({configuration:r,stdout:this.context.stdout},async n=>{let c=this.name,f=G.parseIdent(c);if(!r.plugins.has(c))throw new nt(`${G.prettyIdent(r,f)} isn't referenced by the current configuration`);let p=`.yarn/plugins/${c}.cjs`,h=J.resolve(s.cwd,p);ce.existsSync(h)&&(n.reportInfo(0,`Removing ${he.pretty(r,p,he.Type.PATH)}...`),await ce.removePromise(h)),n.reportInfo(0,"Updating the configuration..."),await ze.updateConfiguration(s.cwd,{plugins:E=>{if(!Array.isArray(E))return E;let C=E.filter(S=>S.path!==p);return C.length===0?ze.deleteProperty:C.length===E.length?E:C}})})).exitCode()}};Ge();Yt();var QC=class extends ft{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["plugin","runtime"]]}static{this.usage=ot.Usage({category:"Plugin-related commands",description:"list the active plugins",details:`
This command prints the currently active plugins. Will be displayed both builtin plugins and external plugins.
`,examples:[["List the currently active plugins","$0 plugin runtime"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins);return(await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout},async a=>{for(let n of r.plugins.keys()){let c=this.context.plugins.plugins.has(n),f=n;c&&(f+=" [builtin]"),a.reportJson({name:n,builtin:c}),a.reportInfo(null,`${f}`)}})).exitCode()}};Ge();Ge();Yt();var TC=class extends ft{constructor(){super(...arguments);this.idents=ge.Rest()}static{this.paths=[["rebuild"]]}static{this.usage=ot.Usage({description:"rebuild the project's native packages",details:`
This command will automatically cause Yarn to forget about previous compilations of the given packages and to run them again.
Note that while Yarn forgets the compilation, the previous artifacts aren't erased from the filesystem and may affect the next builds (in good or bad). To avoid this, you may remove the .yarn/unplugged folder, or any other relevant location where packages might have been stored (Yarn may offer a way to do that automatically in the future).
By default all packages will be rebuilt, but you can filter the list by specifying the names of the packages you want to clear from memory.
`,examples:[["Rebuild all packages","$0 rebuild"],["Rebuild fsevents only","$0 rebuild fsevents"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Kr.find(r);if(!a)throw new ar(s.cwd,this.context.cwd);let c=new Set;for(let f of this.idents)c.add(G.parseIdent(f).identHash);if(await s.restoreInstallState({restoreResolutions:!1}),await s.resolveEverything({cache:n,report:new ki}),c.size>0)for(let f of s.storedPackages.values())c.has(f.identHash)&&(s.storedBuildState.delete(f.locatorHash),s.skippedBuilds.delete(f.locatorHash));else s.storedBuildState.clear(),s.skippedBuilds.clear();return await s.installWithNewReport({stdout:this.context.stdout,quiet:this.context.quiet},{cache:n})}};Ge();Ge();Ge();Yt();var rq=ut(Go());Ul();var RC=class extends ft{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Apply the operation to all workspaces from the current project"});this.mode=ge.String("--mode",{description:"Change what artifacts installs generate",validator:fo($l)});this.patterns=ge.Rest()}static{this.paths=[["remove"]]}static{this.usage=ot.Usage({description:"remove dependencies from the project",details:`
This command will remove the packages matching the specified patterns from the current workspace.
If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
- \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.
- \`update-lockfile\` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.
This command accepts glob patterns as arguments (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.
`,examples:[["Remove a dependency from the current project","$0 remove lodash"],["Remove a dependency from all workspaces at once","$0 remove lodash --all"],["Remove all dependencies starting with `eslint-`","$0 remove 'eslint-*'"],["Remove all dependencies with the `@babel` scope","$0 remove '@babel/*'"],["Remove all dependencies matching `react-dom` or `react-helmet`","$0 remove 'react-{dom,helmet}'"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Kr.find(r);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState({restoreResolutions:!1});let c=this.all?s.workspaces:[a],f=["dependencies","devDependencies","peerDependencies"],p=[],h=!1,E=[];for(let I of this.patterns){let R=!1,N=G.parseIdent(I);for(let U of c){let W=[...U.manifest.peerDependenciesMeta.keys()];for(let ee of(0,rq.default)(W,I))U.manifest.peerDependenciesMeta.delete(ee),h=!0,R=!0;for(let ee of f){let ie=U.manifest.getForScope(ee),ue=[...ie.values()].map(le=>G.stringifyIdent(le));for(let le of(0,rq.default)(ue,G.stringifyIdent(N))){let{identHash:me}=G.parseIdent(le),pe=ie.get(me);if(typeof pe>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");U.manifest[ee].delete(me),E.push([U,ee,pe]),h=!0,R=!0}}}R||p.push(I)}let C=p.length>1?"Patterns":"Pattern",S=p.length>1?"don't":"doesn't",P=this.all?"any":"this";if(p.length>0)throw new nt(`${C} ${he.prettyList(r,p,he.Type.CODE)} ${S} match any packages referenced by ${P} workspace`);return h?(await r.triggerMultipleHooks(I=>I.afterWorkspaceDependencyRemoval,E),await s.installWithNewReport({stdout:this.context.stdout},{cache:n,mode:this.mode})):0}};Ge();Ge();Yt();var Sye=Ie("util"),FC=class extends ft{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["run"]]}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);return(await Ot.start({configuration:r,stdout:this.context.stdout,json:this.json},async c=>{let f=a.manifest.scripts,p=je.sortMap(f.keys(),C=>C),h={breakLength:1/0,colors:r.get("enableColors"),maxArrayLength:2},E=p.reduce((C,S)=>Math.max(C,S.length),0);for(let[C,S]of f.entries())c.reportInfo(null,`${C.padEnd(E," ")} ${(0,Sye.inspect)(S,h)}`),c.reportJson({name:C,script:S})})).exitCode()}};Ge();Ge();Yt();var NC=class extends ft{constructor(){super(...arguments);this.inspect=ge.String("--inspect",!1,{tolerateBoolean:!0,description:"Forwarded to the underlying Node process when executing a binary"});this.inspectBrk=ge.String("--inspect-brk",!1,{tolerateBoolean:!0,description:"Forwarded to the underlying Node process when executing a binary"});this.topLevel=ge.Boolean("-T,--top-level",!1,{description:"Check the root workspace for scripts and/or binaries instead of the current one"});this.binariesOnly=ge.Boolean("-B,--binaries-only",!1,{description:"Ignore any user defined scripts and only check for binaries"});this.require=ge.String("--require",{description:"Forwarded to the underlying Node process when executing a binary"});this.silent=ge.Boolean("--silent",{hidden:!0});this.scriptName=ge.String();this.args=ge.Proxy()}static{this.paths=[["run"]]}static{this.usage=ot.Usage({description:"run a script defined in the package.json",details:`
This command will run a tool. The exact tool that will be executed will depend on the current state of your workspace:
- If the \`scripts\` field from your local package.json contains a matching script name, its definition will get executed.
- Otherwise, if one of the local workspace's dependencies exposes a binary with a matching name, this binary will get executed.
- Otherwise, if the specified name contains a colon character and if one of the workspaces in the project contains exactly one script with a matching name, then this script will get executed.
Whatever happens, the cwd of the spawned process will be the workspace that declares the script (which makes it possible to call commands cross-workspaces using the third syntax).
`,examples:[["Run the tests from the local workspace","$0 run test"],['Same thing, but without the "run" keyword',"$0 test"],["Inspect Webpack while running","$0 run --inspect-brk webpack"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a,locator:n}=await Tt.find(r,this.context.cwd);await s.restoreInstallState();let c=this.topLevel?s.topLevelWorkspace.anchoredLocator:n;if(!this.binariesOnly&&await In.hasPackageScript(c,this.scriptName,{project:s}))return await In.executePackageScript(c,this.scriptName,this.args,{project:s,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});let f=await In.getPackageAccessibleBinaries(c,{project:s});if(f.get(this.scriptName)){let h=[];return this.inspect&&(typeof this.inspect=="string"?h.push(`--inspect=${this.inspect}`):h.push("--inspect")),this.inspectBrk&&(typeof this.inspectBrk=="string"?h.push(`--inspect-brk=${this.inspectBrk}`):h.push("--inspect-brk")),this.require&&h.push(`--require=${this.require}`),await In.executePackageAccessibleBinary(c,this.scriptName,this.args,{cwd:this.context.cwd,project:s,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,nodeArgs:h,packageAccessibleBinaries:f})}if(!this.topLevel&&!this.binariesOnly&&a&&this.scriptName.includes(":")){let E=(await Promise.all(s.workspaces.map(async C=>C.manifest.scripts.has(this.scriptName)?C:null))).filter(C=>C!==null);if(E.length===1)return await In.executeWorkspaceScript(E[0],this.scriptName,this.args,{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})}if(this.topLevel)throw this.scriptName==="node-gyp"?new nt(`Couldn't find a script name "${this.scriptName}" in the top-level (used by ${G.prettyLocator(r,n)}). This typically happens because some package depends on "node-gyp" to build itself, but didn't list it in their dependencies. To fix that, please run "yarn add node-gyp" into your top-level workspace. You also can open an issue on the repository of the specified package to suggest them to use an optional peer dependency.`):new nt(`Couldn't find a script name "${this.scriptName}" in the top-level (used by ${G.prettyLocator(r,n)}).`);{if(this.scriptName==="global")throw new nt("The 'yarn global' commands have been removed in 2.x - consider using 'yarn dlx' or a third-party plugin instead");let h=[this.scriptName].concat(this.args);for(let[E,C]of $I)for(let S of C)if(h.length>=S.length&&JSON.stringify(h.slice(0,S.length))===JSON.stringify(S))throw new nt(`Couldn't find a script named "${this.scriptName}", but a matching command can be found in the ${E} plugin. You can install it with "yarn plugin import ${E}".`);throw new nt(`Couldn't find a script named "${this.scriptName}".`)}}};Ge();Ge();Yt();var OC=class extends ft{constructor(){super(...arguments);this.descriptor=ge.String();this.resolution=ge.String()}static{this.paths=[["set","resolution"]]}static{this.usage=ot.Usage({description:"enforce a package resolution",details:'\n This command updates the resolution table so that `descriptor` is resolved by `resolution`.\n\n Note that by default this command only affect the current resolution table - meaning that this "manual override" will disappear if you remove the lockfile, or if the package disappear from the table. If you wish to make the enforced resolution persist whatever happens, edit the `resolutions` field in your top-level manifest.\n\n Note that no attempt is made at validating that `resolution` is a valid resolution entry for `descriptor`.\n ',examples:[["Force all instances of lodash@npm:^1.2.3 to resolve to 1.5.0","$0 set resolution lodash@npm:^1.2.3 npm:1.5.0"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Kr.find(r);if(await s.restoreInstallState({restoreResolutions:!1}),!a)throw new ar(s.cwd,this.context.cwd);let c=G.parseDescriptor(this.descriptor,!0),f=G.makeDescriptor(c,this.resolution);return s.storedDescriptors.set(c.descriptorHash,c),s.storedDescriptors.set(f.descriptorHash,f),s.resolutionAliases.set(c.descriptorHash,f.descriptorHash),await s.installWithNewReport({stdout:this.context.stdout},{cache:n})}};Ge();Dt();Yt();var Dye=ut(Go()),LC=class extends ft{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Unlink all workspaces belonging to the target project from the current one"});this.leadingArguments=ge.Rest()}static{this.paths=[["unlink"]]}static{this.usage=ot.Usage({description:"disconnect the local project from another one",details:`
This command will remove any resolutions in the project-level manifest that would have been added via a yarn link with similar arguments.
`,examples:[["Unregister a remote workspace in the current project","$0 unlink ~/ts-loader"],["Unregister all workspaces from a remote project in the current project","$0 unlink ~/jest --all"],["Unregister all previously linked workspaces","$0 unlink --all"],["Unregister all workspaces matching a glob","$0 unlink '@babel/*' 'pkg-{a,b}'"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Kr.find(r);if(!a)throw new ar(s.cwd,this.context.cwd);let c=s.topLevelWorkspace,f=new Set;if(this.leadingArguments.length===0&&this.all)for(let{pattern:p,reference:h}of c.manifest.resolutions)h.startsWith("portal:")&&f.add(p.descriptor.fullName);if(this.leadingArguments.length>0)for(let p of this.leadingArguments){let h=J.resolve(this.context.cwd,fe.toPortablePath(p));if(je.isPathLike(p)){let E=await ze.find(h,this.context.plugins,{useRc:!1,strict:!1}),{project:C,workspace:S}=await Tt.find(E,h);if(!S)throw new ar(C.cwd,h);if(this.all){for(let P of C.workspaces)P.manifest.name&&f.add(G.stringifyIdent(P.anchoredLocator));if(f.size===0)throw new nt("No workspace found to be unlinked in the target project")}else{if(!S.manifest.name)throw new nt("The target workspace doesn't have a name and thus cannot be unlinked");f.add(G.stringifyIdent(S.anchoredLocator))}}else{let E=[...c.manifest.resolutions.map(({pattern:C})=>C.descriptor.fullName)];for(let C of(0,Dye.default)(E,p))f.add(C)}}return c.manifest.resolutions=c.manifest.resolutions.filter(({pattern:p})=>!f.has(p.descriptor.fullName)),await s.installWithNewReport({stdout:this.context.stdout,quiet:this.context.quiet},{cache:n})}};Ge();Ge();Ge();Yt();var bye=ut(Vv()),nq=ut(Go());Ul();var MC=class extends ft{constructor(){super(...arguments);this.interactive=ge.Boolean("-i,--interactive",{description:"Offer various choices, depending on the detected upgrade paths"});this.fixed=ge.Boolean("-F,--fixed",!1,{description:"Store dependency tags as-is instead of resolving them"});this.exact=ge.Boolean("-E,--exact",!1,{description:"Don't use any semver modifier on the resolved range"});this.tilde=ge.Boolean("-T,--tilde",!1,{description:"Use the `~` semver modifier on the resolved range"});this.caret=ge.Boolean("-C,--caret",!1,{description:"Use the `^` semver modifier on the resolved range"});this.recursive=ge.Boolean("-R,--recursive",!1,{description:"Resolve again ALL resolutions for those packages"});this.mode=ge.String("--mode",{description:"Change what artifacts installs generate",validator:fo($l)});this.patterns=ge.Rest()}static{this.paths=[["up"]]}static{this.usage=ot.Usage({description:"upgrade dependencies across the project",details:"\n This command upgrades the packages matching the list of specified patterns to their latest available version across the whole project (regardless of whether they're part of `dependencies` or `devDependencies` - `peerDependencies` won't be affected). This is a project-wide command: all workspaces will be upgraded in the process.\n\n If `-R,--recursive` is set the command will change behavior and no other switch will be allowed. When operating under this mode `yarn up` will force all ranges matching the selected packages to be resolved again (often to the highest available versions) before being stored in the lockfile. It however won't touch your manifests anymore, so depending on your needs you might want to run both `yarn up` and `yarn up -R` to cover all bases.\n\n If `-i,--interactive` is set (or if the `preferInteractive` settings is toggled on) the command will offer various choices, depending on the detected upgrade paths. Some upgrades require this flag in order to resolve ambiguities.\n\n The, `-C,--caret`, `-E,--exact` and `-T,--tilde` options have the same meaning as in the `add` command (they change the modifier used when the range is missing or a tag, and are ignored when the range is explicitly set).\n\n If the `--mode=<mode>` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n\n Generally you can see `yarn up` as a counterpart to what was `yarn upgrade --latest` in Yarn 1 (ie it ignores the ranges previously listed in your manifests), but unlike `yarn upgrade` which only upgraded dependencies in the current workspace, `yarn up`Line truncated
${le}`):N.reportError(27,`${G.prettyDescriptor(r,U)} can't be resolved to a satisfying range (note: network resolution has been disabled)
${le}`)}else ie.length>1&&!f&&N.reportError(27,`${G.prettyDescriptor(r,U)} has multiple possible upgrade strategies; use -i to disambiguate manually`)}});if(P.hasErrors())return P.exitCode();let I=!1,R=[];for(let[N,U,,{suggestions:W}]of S){let ee,ie=W.filter(pe=>pe.descriptor!==null),ue=ie[0].descriptor,le=ie.every(pe=>G.areDescriptorsEqual(pe.descriptor,ue));ie.length===1||le?ee=ue:(I=!0,{answer:ee}=await(0,bye.prompt)({type:"select",name:"answer",message:`Which range do you want to use in ${G.prettyWorkspace(r,N)} \u276F ${U}?`,choices:W.map(({descriptor:pe,name:Be,reason:Ce})=>pe?{name:Be,hint:Ce,descriptor:pe}:{name:Be,hint:Ce,disabled:!0}),onCancel:()=>process.exit(130),result(pe){return this.find(pe,"descriptor")},stdin:this.context.stdin,stdout:this.context.stdout}));let me=N.manifest[U].get(ee.identHash);if(typeof me>"u")throw new Error("Assertion failed: This descriptor should have a matching entry");if(me.descriptorHash!==ee.descriptorHash)N.manifest[U].set(ee.identHash,ee),R.push([N,U,me,ee]);else{let pe=r.makeResolver(),Be={project:s,resolver:pe},Ce=r.normalizeDependency(me),g=pe.bindDescriptor(Ce,N.anchoredLocator,Be);s.forgetResolution(g)}}return await r.triggerMultipleHooks(N=>N.afterWorkspaceDependencyReplacement,R),I&&this.context.stdout.write(`
`),await s.installWithNewReport({stdout:this.context.stdout},{cache:n,mode:this.mode})}};Ge();Ge();Ge();Yt();var UC=class extends ft{constructor(){super(...arguments);this.recursive=ge.Boolean("-R,--recursive",!1,{description:"List, for each workspace, what are all the paths that lead to the dependency"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.peers=ge.Boolean("--peers",!1,{description:"Also print the peer dependencies that match the specified name"});this.package=ge.String()}static{this.paths=[["why"]]}static{this.usage=ot.Usage({description:"display the reason why a package is needed",details:`
This command prints the exact reasons why a package appears in the dependency tree.
If \`-R,--recursive\` is set, the listing will go in depth and will list, for each workspaces, what are all the paths that lead to the dependency. Note that the display is somewhat optimized in that it will not print the package listing twice for a single package, so if you see a leaf named "Foo" when looking for "Bar", it means that "Foo" already got printed higher in the tree.
`,examples:[["Explain why lodash is used in your project","$0 why lodash"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState();let n=G.parseIdent(this.package).identHash,c=this.recursive?cct(s,n,{configuration:r,peers:this.peers}):lct(s,n,{configuration:r,peers:this.peers});xs.emitTree(c,{configuration:r,stdout:this.context.stdout,json:this.json,separators:1})}};function lct(t,e,{configuration:r,peers:s}){let a=je.sortMap(t.storedPackages.values(),f=>G.stringifyLocator(f)),n={},c={children:n};for(let f of a){let p={};for(let E of f.dependencies.values()){if(!s&&f.peerDependencies.has(E.identHash))continue;let C=t.storedResolutions.get(E.descriptorHash);if(!C)throw new Error("Assertion failed: The resolution should have been registered");let S=t.storedPackages.get(C);if(!S)throw new Error("Assertion failed: The package should have been registered");if(S.identHash!==e)continue;{let I=G.stringifyLocator(f);n[I]={value:[f,he.Type.LOCATOR],children:p}}let P=G.stringifyLocator(S);p[P]={value:[{descriptor:E,locator:S},he.Type.DEPENDENT]}}}return c}function cct(t,e,{configuration:r,peers:s}){let a=je.sortMap(t.workspaces,S=>G.stringifyLocator(S.anchoredLocator)),n=new Set,c=new Set,f=S=>{if(n.has(S.locatorHash))return c.has(S.locatorHash);if(n.add(S.locatorHash),S.identHash===e)return c.add(S.locatorHash),!0;let P=!1;S.identHash===e&&(P=!0);for(let I of S.dependencies.values()){if(!s&&S.peerDependencies.has(I.identHash))continue;let R=t.storedResolutions.get(I.descriptorHash);if(!R)throw new Error("Assertion failed: The resolution should have been registered");let N=t.storedPackages.get(R);if(!N)throw new Error("Assertion failed: The package should have been registered");f(N)&&(P=!0)}return P&&c.add(S.locatorHash),P};for(let S of a)f(S.anchoredPackage);let p=new Set,h={},E={children:h},C=(S,P,I)=>{if(!c.has(S.locatorHash))return;let R=I!==null?he.tuple(he.Type.DEPENDENT,{locator:S,descriptor:I}):he.tuple(he.Type.LOCATOR,S),N={},U={value:R,children:N},W=G.stringifyLocator(S);if(P[W]=U,!(I!==null&&t.tryWorkspaceByLocator(S))&&!p.has(S.locatorHash)){p.add(S.locatorHash);for(let ee of S.dependencies.values()){if(!s&&S.peerDependencies.has(ee.identHash))continue;let ie=t.storedResolutions.get(ee.descriptorHash);if(!ie)throw new Error("Assertion failed: The resolution should have been registered");let ue=t.storedPackages.get(ie);if(!ue)throw new Error("Assertion failed: The package should have been registered");C(ue,N,ee)}}};for(let S of a)C(S.anchoredPackage,h,null);return E}Ge();var pq={};Vt(pq,{GitFetcher:()=>tS,GitResolver:()=>rS,default:()=>kct,gitUtils:()=>ka});Ge();Dt();var ka={};Vt(ka,{TreeishProtocols:()=>eS,clone:()=>Aq,fetchBase:()=>Jye,fetchChangedFiles:()=>Kye,fetchChangedWorkspaces:()=>Pct,fetchRoot:()=>Vye,isGitUrl:()=>jC,lsRemote:()=>Yye,normalizeLocator:()=>bct,normalizeRepoUrl:()=>_C,resolveUrl:()=>fq,splitRepoUrl:()=>W0,validateRepoUrl:()=>uq});Ge();Dt();Yt();ql();var qye=ut(Hye()),HC=ut(Ie("querystring")),lq=ut(Ai());function aq(t,e,r){let s=t.indexOf(r);return t.lastIndexOf(e,s>-1?s:1/0)}function jye(t){try{return new URL(t)}catch{return}}function Sct(t){let e=aq(t,"@","#"),r=aq(t,":","#");return r>e&&(t=`${t.slice(0,r)}/${t.slice(r+1)}`),aq(t,":","#")===-1&&t.indexOf("//")===-1&&(t=`ssh://${t}`),t}function Gye(t){return jye(t)||jye(Sct(t))}function _C(t,{git:e=!1}={}){if(t=t.replace(/^git\+https:/,"https:"),t=t.replace(/^(?:github:|https:\/\/github\.com\/|git:\/\/github\.com\/)?(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)(?:\.git)?(#.*)?$/,"https://github.com/$1/$2.git$3"),t=t.replace(/^https:\/\/github\.com\/(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)\/tarball\/(.+)?$/,"https://github.com/$1/$2.git#$3"),e){let r=Gye(t);r&&(t=r.href),t=t.replace(/^git\+([^:]+):/,"$1:")}return t}function Wye(){return{...process.env,GIT_SSH_COMMAND:process.env.GIT_SSH_COMMAND||`${process.env.GIT_SSH||"ssh"} -o BatchMode=yes`}}var Dct=[/^ssh:/,/^git(?:\+[^:]+)?:/,/^(?:git\+)?https?:[^#]+\/[^#]+(?:\.git)(?:#.*)?$/,/^git@[^#]+\/[^#]+\.git(?:#.*)?$/,/^(?:github:|https:\/\/github\.com\/)?(?!\.{1,2}\/)([a-zA-Z._0-9-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z._0-9-]+?)(?:\.git)?(?:#.*)?$/,/^https:\/\/github\.com\/(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)\/tarball\/(.+)?$/],eS=(a=>(a.Commit="commit",a.Head="head",a.Tag="tag",a.Semver="semver",a))(eS||{});function jC(t){return t?Dct.some(e=>!!t.match(e)):!1}function W0(t){t=_C(t);let e=t.indexOf("#");if(e===-1)return{repo:t,treeish:{protocol:"head",request:"HEAD"},extra:{}};let r=t.slice(0,e),s=t.slice(e+1);if(s.match(/^[a-z]+=/)){let a=HC.default.parse(s);for(let[p,h]of Object.entries(a))if(typeof h!="string")throw new Error(`Assertion failed: The ${p} parameter must be a literal string`);let n=Object.values(eS).find(p=>Object.hasOwn(a,p)),[c,f]=typeof n Line truncated
This command will run a given sub-command on a single workspace.
`,examples:[["Add a package to a single workspace","yarn workspace components add -D react"],["Run build script on a single workspace","yarn workspace components run build"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);let n=s.workspaces,c=new Map(n.map(p=>[G.stringifyIdent(p.anchoredLocator),p])),f=c.get(this.workspaceName);if(f===void 0){let p=Array.from(c.keys()).sort();throw new nt(`Workspace '${this.workspaceName}' not found. Did you mean any of the following:
- ${p.join(`
- `)}?`)}return this.cli.run([this.commandName,...this.args],{cwd:f.cwd})}};var Qct={configuration:{enableImmutableInstalls:{description:"If true (the default on CI), prevents the install command from modifying the lockfile",type:"BOOLEAN",default:zye.isCI},defaultSemverRangePrefix:{description:"The default save prefix: '^', '~' or ''",type:"STRING",values:["^","~",""],default:"^"},preferReuse:{description:"If true, `yarn add` will attempt to reuse the most common dependency range in other workspaces.",type:"BOOLEAN",default:!1}},commands:[aC,lC,cC,uC,OC,bC,EC,GC,pC,hC,gC,dC,sC,oC,fC,AC,mC,yC,IC,CC,wC,BC,LC,vC,SC,xC,PC,kC,DC,QC,TC,RC,FC,NC,MC,UC,qC]},Tct=Qct;var yq={};Vt(yq,{default:()=>Oct});Ge();Ge();var gq="catalog:";var dq=t=>t.startsWith(gq),Rct=t=>t.range.slice(gq.length)||null,Xye=t=>t===null?"default catalog":`catalog "${t}"`,Fct=t=>t.scope?`@${t.scope}/${t.name}`:t.name,mq=(t,e,r,s)=>{let a=Rct(e),n;if(a===null)n=t.configuration.get("catalog");else try{let E=t.configuration.get("catalogs");E&&(n=E.get(a))}catch{n=void 0}if(!n||n.size===0)throw new jt(82,`${G.prettyDescriptor(t.configuration,e)}: ${Xye(a)} not found or empty`);let c=Fct(e),f=n.get(c);if(!f)throw new jt(82,`${G.prettyDescriptor(t.configuration,e)}: entry not found in ${Xye(a)}`);let p=t.configuration.normalizeDependency(G.makeDescriptor(e,f));return r.supportsDescriptor(p,s)?r.bindDescriptor(p,t.topLevelWorkspace.anchoredLocator,s):p};var Nct={configuration:{catalog:{description:"The default catalog of packages",type:"MAP",valueDefinition:{description:"The catalog of packages",type:"STRING"}},catalogs:{description:"Named catalogs of packages",type:"MAP",valueDefinition:{description:"A named catalog",type:"MAP",valueDefinition:{description:"Package version in the catalog",type:"STRING"}}}},hooks:{beforeWorkspacePacking:(t,e)=>{let r=t.project,s=r.configuration.makeResolver(),a={project:r,resolver:s,report:new ki};for(let n of Ut.allDependencies){let c=e[n];if(c)for(let[f,p]of Object.entries(c)){if(typeof p!="string"||!dq(p))continue;let h=G.parseIdent(f),E=G.makeDescriptor(h,p),C=mq(r,E,s,a),{protocol:S,source:P,params:I,selector:R}=G.parseRange(G.convertToManifestRange(C.range));S===t.project.configuration.get("defaultProtocol")&&(S=null),c[f]=G.makeRange({protocol:S,source:P,params:I,selector:R})}}},reduceDependency:async(t,e,r,s,{resolver:a,resolveOptions:n})=>dq(t.range)?mq(e,t,a,n):t}},Oct=Nct;var Bq={};Vt(Bq,{default:()=>Mct});Ge();var Qt={optional:!0},Eq=[["@tailwindcss/aspect-ratio@<0.2.1",{peerDependencies:{tailwindcss:"^2.0.2"}}],["@tailwindcss/line-clamp@<0.2.1",{peerDependencies:{tailwindcss:"^2.0.2"}}],["@fullhuman/postcss-purgecss@3.1.3 || 3.1.3-alpha.0",{peerDependencies:{postcss:"^8.0.0"}}],["@samverschueren/stream-to-observable@<0.3.1",{peerDependenciesMeta:{rxjs:Qt,zenObservable:Qt}}],["any-observable@<0.5.1",{peerDependenciesMeta:{rxjs:Qt,zenObservable:Qt}}],["@pm2/agent@<1.0.4",{dependencies:{debug:"*"}}],["debug@<4.2.0",{peerDependenciesMeta:{"supports-color":Qt}}],["got@<11",{dependencies:{"@types/responselike":"^1.0.0","@types/keyv":"^3.1.1"}}],["cacheable-lookup@<4.1.2",{dependencies:{"@types/keyv":"^3.1.1"}}],["http-link-dataloader@*",{peerDependencies:{graphql:"^0.13.1 || ^14.0.0"}}],["typescript-language-server@*",{dependencies:{"vscode-jsonrpc":"^5.0.1","vscode-languageserver-protocol":"^3.15.0"}}],["postcss-syntax@*",{peerDependenciesMeta:{"postcss-html":Qt,"postcss-jsx":Qt,"postcss-less":Qt,"postcss-markdown":Qt,"postcss-scss":Qt}}],["jss-plugin-rule-value-function@<=10.1.1",{dependencies:{"tiny-warning":"^1.0.2"}}],["ink-select-input@<4.1.0",{peerDependencies:{react:"^16.8.2"}}],["license-webpack-plugin@<2.3.18",{peerDependenciesMeta:{webpack:Qt}}],["snowpack@>=3.3.0",{dependencies:{"node-gyp":"^7.1.0"}}],["promise-inflight@*",{peerDependenciesMeta:{bluebird:Qt}}],["reactcss@*",{peerDependencies:{react:"*"}}],["react-color@<=2.19.0",{peerDependencies:{react:"*"}}],["gatsby-plugin-i18n@*",{dependencies:{ramda:"^0.24.1"}}],["useragent@^2.0.0",{dependencies:{request:"^2.88.0",yamlparser:"0.0.x",semver:"5.5.x"}}],["@apollographql/apollo-tools@<=0.5.2",{peerDependencies:{graphql:"^14.2.1 || ^15.0.0"}}],["material-table@^2.0.0",{dependencies:{"@babel/runtime":"^7.11.2"}}],["@babel/parser@*",{dependencies:{"@babel/types":"^7.8.3"}}],["fork-ts-checker-webpack-plugin@<=6.3.4",{peerDependencies:{eslint:">= 6",typescript:">= 2.7",webpack:">= 4","vue-template-compiler":"*"},peerDependenciesMeta:{eslint:Qt,"vue-template-compiler":Qt}}],["rc-animate@<=3.1.1",{peerDependencies:{react:">=16.9.0","react-dom":">=16.9.0"}}],["react-bootstrap-table2-paginator@*",{dependencies:{classnames:"^2.2.6"}}],["react-draggable@<=4.4.3",{peerDependencies:{react:">= 16.3.0","react-dom":">= 16.3.0"}}],["apollo-upload-client@<14",{peerDependencies:{graphql:"14 - 15"}}],["react-instantsearch-core@<=6.7.0",{peerDependencies:{algoliasearch:">= 3.1 < 5"}}],["react-instantsearch-dom@<=6.7.0",{dependencies:{"react-fast-compare":"^3.0.0"}}],Line truncated
This command will output all matches to the given prolog query.
`,examples:[["List all dependencies throughout the workspace","yarn constraints query 'workspace_has_dependency(_, DependencyName, _, _).'"]]})}async execute(){let{Constraints:r}=await Promise.resolve().then(()=>(lS(),aS)),s=await ze.find(this.context.cwd,this.context.plugins),{project:a}=await Tt.find(s,this.context.cwd),n=await r.find(a),c=this.query;return c.endsWith(".")||(c=`${c}.`),(await Ot.start({configuration:s,json:this.json,stdout:this.context.stdout},async p=>{for await(let h of n.query(c)){let E=Array.from(Object.entries(h)),C=E.length,S=E.reduce((P,[I])=>Math.max(P,I.length),0);for(let P=0;P<C;P++){let[I,R]=E[P];p.reportInfo(null,`${tut(P,C)}${I.padEnd(S," ")} = ${eut(R)}`)}p.reportJson(h)}})).exitCode()}};function eut(t){return typeof t!="string"?`${t}`:t.match(/^[a-zA-Z][a-zA-Z0-9_]+$/)?t:`'${t}'`}function tut(t,e){let r=t===0,s=t===e-1;return r&&s?"":r?"\u250C ":s?"\u2514 ":"\u2502 "}Ge();Yt();var XC=class extends ft{constructor(){super(...arguments);this.verbose=ge.Boolean("-v,--verbose",!1,{description:"Also print the fact database automatically compiled from the workspace manifests"})}static{this.paths=[["constraints","source"]]}static{this.usage=ot.Usage({category:"Constraints-related commands",description:"print the source code for the constraints",details:"\n This command will print the Prolog source code used by the constraints engine. Adding the `-v,--verbose` flag will print the *full* source code, including the fact database automatically compiled from the workspace manifests.\n ",examples:[["Prints the source code","yarn constraints source"],["Print the source code and the fact database","yarn constraints source -v"]]})}async execute(){let{Constraints:r}=await Promise.resolve().then(()=>(lS(),aS)),s=await ze.find(this.context.cwd,this.context.plugins),{project:a}=await Tt.find(s,this.context.cwd),n=await r.find(a);this.context.stdout.write(this.verbose?n.fullSource:n.source)}};Ge();Ge();Yt();iS();var ZC=class extends ft{constructor(){super(...arguments);this.fix=ge.Boolean("--fix",!1,{description:"Attempt to automatically fix unambiguous issues, following a multi-pass process"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["constraints"]]}static{this.usage=ot.Usage({category:"Constraints-related commands",description:"check that the project constraints are met",details:`
This command will run constraints on your project and emit errors for each one that is found but isn't met. If any error is emitted the process will exit with a non-zero exit code.
If the \`--fix\` flag is used, Yarn will attempt to automatically fix the issues the best it can, following a multi-pass process (with a maximum of 10 iterations). Some ambiguous patterns cannot be autofixed, in which case you'll have to manually specify the right resolution.
For more information as to how to write constraints, please consult our dedicated page on our website: https://yarnpkg.com/features/constraints.
`,examples:[["Check that all constraints are satisfied","yarn constraints"],["Autofix all unmet constraints","yarn constraints --fix"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s}=await Tt.find(r,this.context.cwd);await s.restoreInstallState();let a=await s.loadUserConfig(),n;if(a?.constraints)n=new YC(s);else{let{Constraints:h}=await Promise.resolve().then(()=>(lS(),aS));n=await h.find(s)}let c,f=!1,p=!1;for(let h=this.fix?10:1;h>0;--h){let E=await n.process();if(!E)break;let{changedWorkspaces:C,remainingErrors:S}=iF(s,E,{fix:this.fix}),P=[];for(let[I,R]of C){let N=I.manifest.indent;I.manifest=new Ut,I.manifest.indent=N,I.manifest.load(R),P.push(I.persistManifest())}if(await Promise.all(P),!(C.size>0&&h>1)){c=rEe(S,{configuration:r}),f=!1,p=!0;for(let[,I]of S)for(let R of I)R.fixable?f=!0:p=!1}}if(c.children.length===0)return 0;if(f){let h=p?`Those errors can all be fixed by running ${he.pretty(r,"yarn constraints --fix",he.Type.CODE)}`:`Errors prefixed by '\u2699' can be fixed by running ${he.pretty(r,"yarn constraints --fix",he.Type.CODE)}`;await Ot.start({configuration:r,stdout:this.context.stdout,includeNames:!1,includeFooter:!1},async E=>{E.reportInfo(0,h),E.reportSeparator()})}return c.children=je.sortMap(c.children,h=>h.value[1]),xs.emitTree(c,{configuration:r,stdout:this.context.stdout,json:this.json,separators:1}),1}};iS();var rut={configuration:{enableConstraintsChecks:{description:"If true, constraints will run during installs",type:"BOOLEAN",default:!1},constraintsPath:{description:"The path of the constraints file.",type:"ABSOLUTE_PATH",default:"./constraints.pro"}},commands:[zC,XC,ZC],hooks:{async validateProjectAfterInstall(t,{reportError:e}){if(!t.configuration.get("enableConstraintsChecks"))return;let r=await t.loadUserConfig(),s;if(r?.constraints)s=new YC(t);else{let{Constraints:c}=await Promise.resolve().then(()=>(lS(),aS));s=await c.find(t)}let a=await s.process();if(!a)return;let{remainingErrors:n}=iF(t,a);if(n.size!==0)if(t.configuration.isCI)for(let[c,f]of n)for(let p of f)e(84,`${he.pretty(t.configuration,c.anchoredLocator,he.Type.IDENT)}: ${p.text}`);else e(84,`Constraint check failed; run ${he.pretty(t.configuration,"yarn constraints",he.Type.CODE)} for more details`)}}},nut=rut;var Hq={};Vt(Hq,{CreateCommand:()=>$C,DlxCommand:()=>ew,default:()=>sut});Ge();Yt();var $C=class extends ft{constructor(){super(...arguments);this.pkg=ge.String("-p,--package",{description:"The package to run the provided command from"});this.quiet=ge.Boolean("-q,--quiet",!1,{description:"Only report critical errors instead of printing the full install logs"});this.command=ge.String();this.args=ge.Proxy()}static{this.paths=[["create"]]}async execute(){let r=[];this.pkg&&r.push("--package",this.pkg),this.quiet&&r.push("--quiet");let s=this.command.replace(/^(@[^@/]+)(@|$)/,"$1/create$2"),a=G.parseDescriptor(s),n=a.name.match(/^create(-|$)/)?a:a.scope?G.makeIdent(a.scope,`create-${a.name}`):G.makeIdent(null,`create-${a.name}`),c=G.stringifyIdent(n);return a.range!=="unknown"&&(c+=`@${a.range}`),this.cli.run(["dlx",...r,c,...this.args])}};Ge();Ge();Dt();Yt();var ew=class extends ft{constructor(){super(...arguments);this.packages=ge.Array("-p,--package",{description:"The package(s) to install before running the command"});this.quiet=ge.Boolean("-q,--quiet",!1,{description:"Only report critical errors instead of printing the full install logs"});this.command=ge.String();this.args=ge.Proxy()}static{this.paths=[["dlx"]]}static{this.usage=ot.Usage({description:"run a package in a temporary environment",details:"\n This command will install a package within a temporary environment, and run its binary script if it contains any. The binary will run within the current cwd.\n\n By default Yarn will download the package named `command`, but this can be changed through the use of the `-p,--package` flag which will instruct Yarn to still run the same command but from a different package.\n\n Using `yarn dlx` as a replacement of `yarn add` isn't recommended, as it makes your project non-deterministic (Yarn doesn't keep track of the packages installed through `dlx` - neither their name, nor their version).\n ",examples:[["Use create-vite to scaffold a new Vite project","yarn dlx create-vite"],["Install multiple packages for a single command",`yarn dlx -p typescript -p ts-node ts-node --transpile-only -e "console.log('hello!')"`]]})}async execute(){return ze.telemetry=null,await ce.mktempPromise(async r=>{let s=J.join(r,`dlx-${process.pid}`);await ce.mkdirPromise(s),await ce.writeFilePromise(J.join(s,"package.json"),`{}
`),await ce.writeFilePromise(J.join(s,"yarn.lock"),"");let a=J.join(s,".yarnrc.yml"),n=await ze.findProjectCwd(this.context.cwd),f={enableGlobalCache:!(await ze.find(this.context.cwd,null,{strict:!1})).get("enableGlobalCache"),enableTelemetry:!1,logFilters:[{code:Yf(68),level:he.LogLevel.Discard}]},p=n!==null?J.join(n,".yarnrc.yml"):null;p!==null&&ce.existsSync(p)?(await ce.copyFilePromise(p,a),await ze.updateConfiguration(s,N=>{let U=je.toMerged(N,f);return Array.isArray(N.plugins)&&(U.plugins=N.plugins.map(W=>{let ee=typeof W=="string"?W:W.path,ie=fe.isAbsolute(ee)?ee:fe.resolve(fe.fromPortablePath(n),ee);return typeof W=="string"?ie:{path:ie,spec:W.spec}})),U})):await ce.writeJsonPromise(a,f);let h=this.packages??[this.command],E=G.parseDescriptor(this.command).name,C=await this.cli.run(["add","--fixed","--",...h],{cwd:s,quiet:this.quiet});if(C!==0)return C;this.quiet||this.context.stdout.write(`
`);let S=await ze.find(s,this.context.plugins),{project:P,workspace:I}=await Tt.find(S,s);if(I===null)throw new ar(P.cwd,s);await P.restoreInstallState();let R=await In.getWorkspaceAccessibleBinaries(I);return R.has(E)===!1&&R.size===1&&typeof this.packages>"u"&&(E=Array.from(R)[0][0]),await In.executeWorkspaceAccessibleBinary(I,E,this.args,{packageAccessibleBinaries:R,cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})})}};var iut={commands:[$C,ew]},sut=iut;var qq={};Vt(qq,{ExecFetcher:()=>uS,ExecResolver:()=>fS,default:()=>lut,execUtils:()=>lF});Ge();Ge();Dt();var cA="exec:";var lF={};Vt(lF,{loadGeneratorFile:()=>cS,makeLocator:()=>Gq,makeSpec:()=>PEe,parseSpec:()=>jq});Ge();Dt();function jq(t){let{params:e,selector:r}=G.parseRange(t),s=fe.toPortablePath(r);return{parentLocator:e&&typeof e.locator=="string"?G.parseLocator(e.locator):null,path:s}}function PEe({parentLocator:t,path:e,generatorHash:r,protocol:s}){let a=t!==null?{locator:G.stringifyLocator(t)}:{},n=typeof r<"u"?{hash:r}:{};return G.makeRange({protocol:s,source:e,selector:e,params:{...n,...a}})}function Gq(t,{parentLocator:e,path:r,generatorHash:s,protocol:a}){return G.makeLocator(t,PEe({parentLocator:e,path:r,generatorHash:s,protocol:a}))}async function cS(t,e,r){let{parentLocator:s,path:a}=G.parseFileStyleRange(t,{protocol:e}),n=J.isAbsolute(a)?{packageFs:new Sn(vt.root),prefixPath:vt.dot,localPath:vt.root}:await r.fetcher.fetch(s,r),c=n.localPath?{packageFs:new Sn(vt.root),prefixPath:J.relative(vt.root,n.localPath)}:n;n!==c&&n.releaseFs&&n.releaseFs();let f=c.packageFs,p=J.join(c.prefixPath,a);return await f.readFilePromise(p,"utf8")}var uS=class{supports(e,r){return!!e.reference.startsWith(cA)}getLocalPath(e,r){let{parentLocator:s,path:a}=G.parseFileStyleRange(e.reference,{protocol:cA});if(J.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(s,r);return n===null?null:J.resolve(n,a)}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,c]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e),loader:()=>this.fetchFromDisk(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:c}}async fetchFromDisk(e,r){let s=await cS(e.reference,cA,r);return ce.mktempPromise(async a=>{let n=J.join(a,"generator.js");return await ce.writeFilePromise(n,s),ce.mktempPromise(async c=>{if(await this.generatePackage(c,e,n,r),!ce.existsSync(J.join(c,"build")))throw new Error("The script should have generated a build directory");return await ps.makeArchiveFromDirectory(J.join(c,"build"),{prefixPath:G.getIdentVendorPath(e),compressionLevel:r.project.configuration.get("compressionLevel")})})})}async generatePackage(e,r,s,a){return await ce.mktempPromise(async n=>{let c=await In.makeScriptEnv({project:a.project,binFolder:n}),f=J.join(e,"runtime.js");return await ce.mktempPromise(async p=>{let h=J.join(p,"buildfile.log"),E=J.join(e,"generator"),C=J.join(e,"build");await ce.mkdirPromise(E),await ce.mkdirPromise(C);let S={tempDir:fe.fromPortablePath(E),buildDir:fe.fromPortablePath(C),locator:G.stringifyLocator(r)};await ce.writeFilePromise(f,`
// Expose 'Module' as a global variable
Object.defineProperty(global, 'Module', {
get: () => require('module'),
configurable: true,
enumerable: false,
});
// Expose non-hidden built-in modules as global variables
for (const name of Module.builtinModules.filter((name) => name !== 'module' && !name.startsWith('_'))) {
Object.defineProperty(global, name, {
get: () => require(name),
configurable: true,
enumerable: false,
});
}
// Expose the 'execEnv' global variable
Object.defineProperty(global, 'execEnv', {
value: {
...${JSON.stringify(S)},
},
enumerable: true,
});
`);let P=c.NODE_OPTIONS||"",I=/\s*--require\s+\S*\.pnp\.c?js\s*/g;P=P.replace(I," ").trim(),c.NODE_OPTIONS=P;let{stdout:R,stderr:N}=a.project.configuration.getSubprocessStreams(h,{header:`# This file contains the result of Yarn generating a package (${G.stringifyLocator(r)})
`,prefix:G.prettyLocator(a.project.configuration,r),report:a.report}),{code:U}=await qr.pipevp(process.execPath,["--require",fe.fromPortablePath(f),fe.fromPortablePath(s),G.stringifyIdent(r)],{cwd:e,env:c,stdin:null,stdout:R,stderr:N});if(U!==0)throw ce.detachTemp(p),new Error(`Package generation failed (exit code ${U}, logs can be found here: ${he.pretty(a.project.configuration,h,he.Type.PATH)})`)})})}};Ge();Ge();var out=2,fS=class{supportsDescriptor(e,r){return!!e.range.startsWith(cA)}supportsLocator(e,r){return!!e.reference.startsWith(cA)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,s){return G.bindDescriptor(e,{locator:G.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,s){if(!s.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{path:a,parentLocator:n}=jq(e.range);if(n===null)throw new Error("Assertion failed: The descriptor should have been bound");let c=await cS(G.makeRange({protocol:cA,source:a,selector:a,params:{locator:G.stringifyLocator(n)}}),cA,s.fetchOptions),f=Nn.makeHash(`${out}`,c).slice(0,6);return[Gq(e,{parentLocator:n,path:a,generatorHash:f,protocol:cA})]}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(c=>c.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let s=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await je.releaseAfterUseAsync(async()=>await Ut.find(s.prefixPath,{baseFs:s.packageFs}),s.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var aut={fetchers:[uS],resolvers:[fS]},lut=aut;var Yq={};Vt(Yq,{FileFetcher:()=>gS,FileResolver:()=>dS,TarballFileFetcher:()=>mS,TarballFileResolver:()=>yS,default:()=>fut,fileUtils:()=>xm});Ge();Dt();var tw=/^(?:[a-zA-Z]:[\\/]|\.{0,2}\/)/,AS=/^[^?]*\.(?:tar\.gz|tgz)(?:::.*)?$/,es="file:";var xm={};Vt(xm,{fetchArchiveFromLocator:()=>hS,makeArchiveFromLocator:()=>cF,makeBufferFromLocator:()=>Wq,makeLocator:()=>rw,makeSpec:()=>xEe,parseSpec:()=>pS});Ge();Dt();function pS(t){let{params:e,selector:r}=G.parseRange(t),s=fe.toPortablePath(r);return{parentLocator:e&&typeof e.locator=="string"?G.parseLocator(e.locator):null,path:s}}function xEe({parentLocator:t,path:e,hash:r,protocol:s}){let a=t!==null?{locator:G.stringifyLocator(t)}:{},n=typeof r<"u"?{hash:r}:{};return G.makeRange({protocol:s,source:e,selector:e,params:{...n,...a}})}function rw(t,{parentLocator:e,path:r,hash:s,protocol:a}){return G.makeLocator(t,xEe({parentLocator:e,path:r,hash:s,protocol:a}))}async function hS(t,e){let{parentLocator:r,path:s}=G.parseFileStyleRange(t.reference,{protocol:es}),a=J.isAbsolute(s)?{packageFs:new Sn(vt.root),prefixPath:vt.dot,localPath:vt.root}:await e.fetcher.fetch(r,e),n=a.localPath?{packageFs:new Sn(vt.root),prefixPath:J.relative(vt.root,a.localPath)}:a;a!==n&&a.releaseFs&&a.releaseFs();let c=n.packageFs,f=J.join(n.prefixPath,s);return await je.releaseAfterUseAsync(async()=>await c.readFilePromise(f),n.releaseFs)}async function cF(t,{protocol:e,fetchOptions:r,inMemory:s=!1}){let{parentLocator:a,path:n}=G.parseFileStyleRange(t.reference,{protocol:e}),c=J.isAbsolute(n)?{packageFs:new Sn(vt.root),prefixPath:vt.dot,localPath:vt.root}:await r.fetcher.fetch(a,r),f=c.localPath?{packageFs:new Sn(vt.root),prefixPath:J.relative(vt.root,c.localPath)}:c;c!==f&&c.releaseFs&&c.releaseFs();let p=f.packageFs,h=J.join(f.prefixPath,n);return await je.releaseAfterUseAsync(async()=>await ps.makeArchiveFromDirectory(h,{baseFs:p,prefixPath:G.getIdentVendorPath(t),compressionLevel:r.project.configuration.get("compressionLevel"),inMemory:s}),f.releaseFs)}async function Wq(t,{protocol:e,fetchOptions:r}){return(await cF(t,{protocol:e,fetchOptions:r,inMemory:!0})).getBufferAndClose()}var gS=class{supports(e,r){return!!e.reference.startsWith(es)}getLocalPath(e,r){let{parentLocator:s,path:a}=G.parseFileStyleRange(e.reference,{protocol:es});if(J.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(s,r);return n===null?null:J.resolve(n,a)}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,c]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.fetchFromDisk(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:c}}async fetchFromDisk(e,r){return cF(e,{protocol:es,fetchOptions:r})}};Ge();Ge();var cut=2,dS=c Line truncated
`,{automaticNewlines:!0});let h=[p],E=J.join(this.context.cwd,"README.md");if(ce.existsSync(E)||(await ce.writeFilePromise(E,`# ${G.stringifyIdent(n.name)}
`),h.push(E)),!s||s.cwd===this.context.cwd){let C=J.join(this.context.cwd,Er.lockfile);ce.existsSync(C)||(await ce.writeFilePromise(C,""),h.push(C));let P=[".yarn/*","!.yarn/patches","!.yarn/plugins","!.yarn/releases","!.yarn/sdks","!.yarn/versions","","# Whether you use PnP or not, the node_modules folder is often used to store","# build artifacts that should be gitignored","node_modules","","# Swap the comments on the following lines if you wish to use zero-installs","# In that case, don't forget to run `yarn config set enableGlobalCache false`!","# Documentation here: https://yarnpkg.com/features/caching#zero-installs","","#!.yarn/cache",".pnp.*"].map(ue=>`${ue}
`).join(""),I=J.join(this.context.cwd,".gitignore");ce.existsSync(I)||(await ce.writeFilePromise(I,P),h.push(I));let N=["/.yarn/** linguist-vendored","/.yarn/releases/* binary","/.yarn/plugins/**/* binary","/.pnp.* binary linguist-generated"].map(ue=>`${ue}
`).join(""),U=J.join(this.context.cwd,".gitattributes");ce.existsSync(U)||(await ce.writeFilePromise(U,N),h.push(U));let W={"*":{charset:"utf-8",endOfLine:"lf",indentSize:2,indentStyle:"space",insertFinalNewline:!0}};je.mergeIntoTarget(W,r.get("initEditorConfig"));let ee=`root = true
`;for(let[ue,le]of Object.entries(W)){ee+=`
[${ue}]
`;for(let[me,pe]of Object.entries(le)){let Be=me.replace(/[A-Z]/g,Ce=>`_${Ce.toLowerCase()}`);ee+=`${Be} = ${pe}
`}}let ie=J.join(this.context.cwd,".editorconfig");ce.existsSync(ie)||(await ce.writeFilePromise(ie,ee),h.push(ie)),await this.cli.run(["install"],{quiet:!0}),await this.initialize(),ce.existsSync(J.join(this.context.cwd,".git"))||(await qr.execvp("git",["init"],{cwd:this.context.cwd}),await qr.execvp("git",["add","--",...h],{cwd:this.context.cwd}),await qr.execvp("git",["commit","--allow-empty","-m","First commit"],{cwd:this.context.cwd}))}}};var nw=class extends z0{constructor(){super(...arguments);this.initializer=ge.String();this.argv=ge.Proxy()}static{this.paths=[["init"]]}async initialize(){this.context.stdout.write(`
`),await this.cli.run(["dlx",this.initializer,...this.argv],{quiet:!0})}};var dut={configuration:{initScope:{description:"Scope used when creating packages via the init command",type:"STRING",default:null},initFields:{description:"Additional fields to set when creating packages via the init command",type:"MAP",valueDefinition:{description:"",type:"ANY"}},initEditorConfig:{description:"Extra rules to define in the generator editorconfig",type:"MAP",valueDefinition:{description:"",type:"ANY"}}},commands:[z0,nw]},mut=dut;var JW={};Vt(JW,{SearchCommand:()=>Iw,UpgradeInteractiveCommand:()=>Cw,default:()=>Dgt});Ge();var FEe=ut(Ie("os"));function iw({stdout:t}){if(FEe.default.endianness()==="BE")throw new Error("Interactive commands cannot be used on big-endian systems because ink depends on yoga-layout-prebuilt which only supports little-endian architectures");if(!t.isTTY)throw new Error("Interactive commands can only be used inside a TTY environment")}Yt();var YIe=ut(g9()),d9={appId:"OFCNCOG2CU",apiKey:"6fe4476ee5a1832882e326b506d14126",indexName:"npm-search"},hAt=(0,YIe.default)(d9.appId,d9.apiKey).initIndex(d9.indexName),m9=async(t,e=0)=>await hAt.search(t,{analyticsTags:["yarn-plugin-interactive-tools"],attributesToRetrieve:["name","version","owner","repository","humanDownloadsLast30Days"],page:e,hitsPerPage:10});var CD=["regular","dev","peer"],Iw=class extends ft{static{this.paths=[["search"]]}static{this.usage=ot.Usage({category:"Interactive commands",description:"open the search interface",details:`
This command opens a fullscreen terminal interface where you can search for and install packages from the npm registry.
`,examples:[["Open the search window","yarn search"]]})}async execute(){iw(this.context);let{Gem:e}=await Promise.resolve().then(()=>(WF(),LW)),{ScrollableItems:r}=await Promise.resolve().then(()=>(KF(),JF)),{useKeypress:s}=await Promise.resolve().then(()=>(yD(),w2e)),{useMinistore:a}=await Promise.resolve().then(()=>(GW(),jW)),{renderForm:n}=await Promise.resolve().then(()=>($F(),ZF)),{default:c}=await Promise.resolve().then(()=>ut(T2e())),{Box:f,Text:p}=await Promise.resolve().then(()=>ut(Wc())),{default:h,useEffect:E,useState:C}=await Promise.resolve().then(()=>ut(hn())),S=await ze.find(this.context.cwd,this.context.plugins),P=()=>h.createElement(f,{flexDirection:"row"},h.createElement(f,{flexDirection:"column",width:48},h.createElement(f,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"<up>"),"/",h.createElement(p,{bold:!0,color:"cyanBright"},"<down>")," to move between packages.")),h.createElement(f,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"<space>")," to select a package.")),h.createElement(f,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"<space>")," again to change the target."))),h.createElement(f,{flexDirection:"column"},h.createElement(f,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"<enter>")," to install the selected packages.")),h.createElement(f,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"<ctrl+c>")," to abort.")))),I=()=>h.createElement(h.Fragment,null,h.createElement(f,{width:15},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Owner")),h.createElement(f,{width:11},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Version")),h.createElement(f,{width:10},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Downloads"))),R=()=>h.createElement(f,{width:17},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Target")),N=({hit:pe,active:Be})=>{let[Ce,g]=a(pe.name,null);s({active:Be},(Ae,se)=>{if(se.name!=="space")return;if(!Ce){g(CD[0]);return}let Z=CD.indexOf(Ce)+1;Z===CD.length?g(null):g(CD[Z])},[Ce,g]);let we=G.parseIdent(pe.name),ye=G.prettyIdent(S,we);return h.createElement(f,null,h.createElement(f,{width:45},h.createElement(p,{bold:!0,wrap:"wrap"},ye)),h.createElement(f,{width:14,marginLeft:1},h.createElement(p,{bold:!0,wrap:"truncate"},pe.owner.name)),h.createElement(f,{width:10,marginLeft:1},h.createElement(p,{italic:!0,wrap:"truncate"},pe.version)),h.createElement(f,{width:16,marginLeft:1},h.createElement(p,null,pe.humanDownloadsLast30Days)))},U=({name:pe,active:Be})=>{let[Ce]=a(pe,null),g=G.parseIdent(pe);return h.createElement(f,null,h.createElement(f,{width:47},h.createElement(p,{bold:!0}," - ",G.prettyIdent(S,g))),CD.map(we=>h.createElement(f,{key:we,width:14,marginLeft:1},h.createElement(p,null," ",h.createElement(e,{active:Ce===we})," ",h.createElement(p,{bold:!0},we)))))},W=()=>h.createElement(f,{marginTop:1},h.createElement(p,null,"Powered by Algolia.")),ie=await n(({useSubmit:pe})=>{let Be=a();pe(Be);let Ce=Array.from(Be.keys()).filter(j=>Be.get(j)!==null),[g,we]=C(""),[ye,Ae]=C(0),[se,Z]=C([]),De=j=>{j.match(/\t| /)||we(j)},Re=async()=>{Ae(0);let j=await m9(g);j.query===g&&Z(j.hits)},mt=async()=>{let j=await m9(g,ye+1);j.query===g&&j.page-1===ye&&(Ae(j.page),Z([...se,...j.hits]))};return E(()=>{g?Re():Z([])},[g]),h.createElement(f,{flexDirection:"column"},h.createElement(P,null),h.createElement(f,{flexDirection:"row",marginTop:1},h.createElement(p,{bold:!0},"Search: "),h.createElement(f,{width:41},h.createElement(c,{value:g,onChange:De,placeholder:"i.e. babel, webpack, react...",showCursor:!1})),h.createElement(I,null)),se.length?h.createElement(r,{radius:2,loop:!1,children:se.map(j=>h.createElement(N,{key:j.name,hit:j,active:!1})),willReachEnd:mt}):h.createElement(p,{color:"gray"},"Start typing..."),h.createElement(f,{flexDirection:"row",marginTop:1},h.createElement(f,{width:49},h.createElement(p,{bold:!0},"Selected:")),h.createElement(R,null)),Ce.length?Ce.map(j=>h.createElement(U,{key:j,name:j,active:!1})):h.createElement(p,{color:"gray"},"No selected packages..."),h.createElement(W,null))},{},{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});if(typeof ie>"u")return 1;let ue=Array.from(ie.keys()).filter(pe=>ie.get(pe)==="regular"),le=Array.from(ie.keys()).filter(pe=>ie.get(pe)==="dev"),me=Array.from(ie.keys()).filter(pe=>ie.get(pe)==="peer");return ue.length&&await this.cli.run(["add",...ue]),le.length&&await this.cli.run(["add","--dev",...le]),me&&await this.cli.run(["add","--peer",...me]),0}};Ge();Yt();YG();var U2e=ut(Ai()),M2e=/^((?:[\^~]|>=?)?)([0-9]+)(\.[0-9]+)(\.[0-9]+)((?:-\S+)?)$/;function _2e(t,e){return t.length>0?[t.slice(0,e)].concat(_2e(t.slice(e),e)):[]}var Cw=class extends ft{static{this.paths=[["upgrade-interactive"]]}static{this.usage=ot.Usage({category:"Interactive commands",description:"open Line truncated
This command opens a fullscreen terminal interface where you can see any out of date packages used by your application, their status compared to the latest versions available on the remote registry, and select packages to upgrade.
`,examples:[["Open the upgrade window","yarn upgrade-interactive"]]})}async execute(){iw(this.context);let{ItemOptions:e}=await Promise.resolve().then(()=>(L2e(),O2e)),{Pad:r}=await Promise.resolve().then(()=>(VW(),N2e)),{ScrollableItems:s}=await Promise.resolve().then(()=>(KF(),JF)),{useMinistore:a}=await Promise.resolve().then(()=>(GW(),jW)),{renderForm:n}=await Promise.resolve().then(()=>($F(),ZF)),{Box:c,Text:f}=await Promise.resolve().then(()=>ut(Wc())),{default:p,useEffect:h,useRef:E,useState:C}=await Promise.resolve().then(()=>ut(hn())),S=await ze.find(this.context.cwd,this.context.plugins),{project:P,workspace:I}=await Tt.find(S,this.context.cwd),R=await Kr.find(S);if(!I)throw new ar(P.cwd,this.context.cwd);await P.restoreInstallState({restoreResolutions:!1});let N=this.context.stdout.rows-7,U=(we,ye)=>{let Ae=mde(we,ye),se="";for(let Z of Ae)Z.added?se+=he.pretty(S,Z.value,"green"):Z.removed||(se+=Z.value);return se},W=(we,ye)=>{if(we===ye)return ye;let Ae=G.parseRange(we),se=G.parseRange(ye),Z=Ae.selector.match(M2e),De=se.selector.match(M2e);if(!Z||!De)return U(we,ye);let Re=["gray","red","yellow","green","magenta"],mt=null,j="";for(let rt=1;rt<Re.length;++rt)mt!==null||Z[rt]!==De[rt]?(mt===null&&(mt=Re[rt-1]),j+=he.pretty(S,De[rt],mt)):j+=De[rt];return j},ee=async(we,ye,Ae)=>{let se=await Xu.fetchDescriptorFrom(we,Ae,{project:P,cache:R,preserveModifier:ye,workspace:I});return se!==null?se.range:we.range},ie=async we=>{let ye=U2e.default.valid(we.range)?`^${we.range}`:we.range,[Ae,se]=await Promise.all([ee(we,we.range,ye).catch(()=>null),ee(we,we.range,"latest").catch(()=>null)]),Z=[{value:null,label:we.range}];return Ae&&Ae!==we.range?Z.push({value:Ae,label:W(we.range,Ae)}):Z.push({value:null,label:""}),se&&se!==Ae&&se!==we.range?Z.push({value:se,label:W(we.range,se)}):Z.push({value:null,label:""}),Z},ue=()=>p.createElement(c,{flexDirection:"row"},p.createElement(c,{flexDirection:"column",width:49},p.createElement(c,{marginLeft:1},p.createElement(f,null,"Press ",p.createElement(f,{bold:!0,color:"cyanBright"},"<up>"),"/",p.createElement(f,{bold:!0,color:"cyanBright"},"<down>")," to select packages.")),p.createElement(c,{marginLeft:1},p.createElement(f,null,"Press ",p.createElement(f,{bold:!0,color:"cyanBright"},"<left>"),"/",p.createElement(f,{bold:!0,color:"cyanBright"},"<right>")," to select versions."))),p.createElement(c,{flexDirection:"column"},p.createElement(c,{marginLeft:1},p.createElement(f,null,"Press ",p.createElement(f,{bold:!0,color:"cyanBright"},"<enter>")," to install.")),p.createElement(c,{marginLeft:1},p.createElement(f,null,"Press ",p.createElement(f,{bold:!0,color:"cyanBright"},"<ctrl+c>")," to abort.")))),le=()=>p.createElement(c,{flexDirection:"row",paddingTop:1,paddingBottom:1},p.createElement(c,{width:50},p.createElement(f,{bold:!0},p.createElement(f,{color:"greenBright"},"?")," Pick the packages you want to upgrade.")),p.createElement(c,{width:17},p.createElement(f,{bold:!0,underline:!0,color:"gray"},"Current")),p.createElement(c,{width:17},p.createElement(f,{bold:!0,underline:!0,color:"gray"},"Range")),p.createElement(c,{width:17},p.createElement(f,{bold:!0,underline:!0,color:"gray"},"Latest"))),me=({active:we,descriptor:ye,suggestions:Ae})=>{let[se,Z]=a(ye.descriptorHash,null),De=G.stringifyIdent(ye),Re=Math.max(0,45-De.length);return p.createElement(p.Fragment,null,p.createElement(c,null,p.createElement(c,{width:45},p.createElement(f,{bold:!0},G.prettyIdent(S,ye)),p.createElement(r,{active:we,length:Re})),p.createElement(e,{active:we,options:Ae,value:se,skewer:!0,onChange:Z,sizes:[17,17,17]})))},pe=({dependencies:we})=>{let[ye,Ae]=C(we.map(()=>null)),se=E(!0),Z=async De=>{let Re=await ie(De);return Re.filter(mt=>mt.label!=="").length<=1?null:{descriptor:De,suggestions:Re}};return h(()=>()=>{se.current=!1},[]),h(()=>{let De=Math.trunc(N*1.75),Re=we.slice(0,De),mt=we.slice(De),j=_2e(mt,N),rt=Re.map(Z).reduce(async(Fe,Ne)=>{await Fe;let Pe=await Ne;Pe!==null&&se.current&&Ae(Ve=>{let ke=Ve.findIndex(Ue=>Ue===null),it=[...Ve];return it[ke]=Pe,it})},Promise.resolve());j.reduce((Fe,Ne)=>Promise.all(Ne.map(Pe=>Promise.resolve().then(()=>Z(Pe)))).then(async Pe=>{Pe=Pe.filter(Ve=>Ve!==null),await Fe,se.current&&Ae(Ve=>{let ke=Ve.findIndex(it=>it===null);return Ve.slice(0,ke).concat(Pe).concat(Ve.slice(ke+Pe.length))})}),rt).then(()=>{se.current&&Ae(Fe=>Fe.filter(Ne=>Ne!==null))})},[]),ye.length?p.createElement(s,{radius:N>>1,children:ye.map((De,Re)=>De!==null?p.createElement(me,{key:Re,active:!1,descriptor:De.descriptor,suggestions:De.suggestions}):p.createElement(f,{key:Re},"Loading..."))}):p.createElement(f,null,"No upgrades found")},Ce=await n(({useSubmit:we})=>{we(a());let ye=new Map;for(let se of P.workspaces)for(let Z of["dependencies","devDependencies"])for(let De of se.manifest[Z].values())P.tryWorkspaceByDescriptor(De)===null&&(De.range.startsWith("link:")||ye.set(De.descriptorHash,De));let Ae=je.sortMap(ye.values(),se=>G.stringifyDescriptor(se));return p.createEleme Line truncated
${E}, next tree:
${PD(f)}`);let S=q2e(f);if(S)throw new Error(`${S}, after hoisting finished:
${PD(f)}`)}return n.debugLevel>=2&&console.log(PD(f)),_gt(f)},Rgt=t=>{let e=t[t.length-1],r=new Map,s=new Set,a=n=>{if(!s.has(n)){s.add(n);for(let c of n.hoistedDependencies.values())r.set(c.name,c);for(let c of n.dependencies.values())n.peerNames.has(c.name)||a(c)}};return a(e),r},Fgt=t=>{let e=t[t.length-1],r=new Map,s=new Set,a=new Set,n=(c,f)=>{if(s.has(c))return;s.add(c);for(let h of c.hoistedDependencies.values())if(!f.has(h.name)){let E;for(let C of t)E=C.dependencies.get(h.name),E&&r.set(E.name,E)}let p=new Set;for(let h of c.dependencies.values())p.add(h.name);for(let h of c.dependencies.values())c.peerNames.has(h.name)||n(h,p)};return n(e,a),r},j2e=(t,e)=>{if(e.decoupled)return e;let{name:r,references:s,ident:a,locator:n,dependencies:c,originalDependencies:f,hoistedDependencies:p,peerNames:h,reasons:E,isHoistBorder:C,hoistPriority:S,dependencyKind:P,hoistedFrom:I,hoistedTo:R}=e,N={name:r,references:new Set(s),ident:a,locator:n,dependencies:new Map(c),originalDependencies:new Map(f),hoistedDependencies:new Map(p),peerNames:new Set(h),reasons:new Map(E),decoupled:!0,isHoistBorder:C,hoistPriority:S,dependencyKind:P,hoistedFrom:new Map(I),hoistedTo:new Map(R)},U=N.dependencies.get(r);return U&&U.ident==N.ident&&N.dependencies.set(r,N),t.dependencies.set(N.name,N),N},Ngt=(t,e)=>{let r=new Map([[t.name,[t.ident]]]);for(let a of t.dependencies.values())t.peerNames.has(a.name)||r.set(a.name,[a.ident]);let s=Array.from(e.keys());s.sort((a,n)=>{let c=e.get(a),f=e.get(n);if(f.hoistPriority!==c.hoistPriority)return f.hoistPriority-c.hoistPriority;{let p=c.dependents.size+c.peerDependents.size;return f.dependents.size+f.peerDependents.size-p}});for(let a of s){let n=a.substring(0,a.indexOf("@",1)),c=a.substring(n.length+1);if(!t.peerNames.has(n)){let f=r.get(n);f||(f=[],r.set(n,f)),f.indexOf(c)<0&&f.push(c)}}return r},ZW=t=>{let e=new Set,r=(s,a=new Set)=>{if(!a.has(s)){a.add(s);for(let n of s.peerNames)if(!t.peerNames.has(n)){let c=t.dependencies.get(n);c&&!e.has(c)&&r(c,a)}e.add(s)}};for(let s of t.dependencies.values())t.peerNames.has(s.name)||r(s);return e},eY=(t,e,r,s,a,n=new Set)=>{let c=e[e.length-1];if(n.has(c))return{anotherRoundNeeded:!1,isGraphChanged:!1};n.add(c);let f=Hgt(c),p=Ngt(c,f),h=t==c?new Map:a.fastLookupPossible?Rgt(e):Fgt(e),E,C=!1,S=!1,P=new Map(Array.from(p.entries()).map(([R,N])=>[R,N[0]])),I=new Map;do{let R=Mgt(t,e,r,h,P,p,s,I,a);R.isGraphChanged&&(S=!0),R.anotherRoundNeeded&&(C=!0),E=!1;for(let[N,U]of p)U.length>1&&!c.dependencies.has(N)&&(P.delete(N),U.shift(),P.set(N,U[0]),E=!0)}while(E);for(let R of c.dependencies.values())if(!c.peerNames.has(R.name)&&!r.has(R.locator)){r.add(R.locator);let N=eY(t,[...e,R],r,I,a);N.isGraphChanged&&(S=!0),N.anotherRoundNeeded&&(C=!0),r.delete(R.locator)}return{anotherRoundNeeded:C,isGraphChanged:S}},Ogt=t=>{for(let[e,r]of t.dependencies)if(!t.peerNames.has(e)&&r.ident!==t.ident)return!0;return!1},Lgt=(t,e,r,s,a,n,c,f,{outputReason:p,fastLookupPossible:h})=>{let E,C=null,S=new Set;p&&(E=`${Array.from(e).map(N=>yo(N)).join("\u2192")}`);let P=r[r.length-1],R=!(s.ident===P.ident);if(p&&!R&&(C="- self-reference"),R&&(R=s.dependencyKind!==1,p&&!R&&(C="- workspace")),R&&s.dependencyKind===2&&(R=!Ogt(s),p&&!R&&(C="- external soft link with unhoisted dependencies")),R&&(R=!t.peerNames.has(s.name),p&&!R&&(C=`- cannot shadow peer: ${yo(t.originalDependencies.get(s.name).locator)} at ${E}`)),R){let N=!1,U=a.get(s.name);if(N=!U||U.ident===s.ident,p&&!N&&(C=`- filled by: ${yo(U.locator)} at ${E}`),N)for(let W=r.length-1;W>=1;W--){let ie=r[W].dependencies.get(s.name);if(ie&&ie.ident!==s.ident){N=!1;let ue=f.get(P);ue||(ue=new Set,f.set(P,ue)),ue.add(s.name),p&&(C=`- filled by ${yo(ie.locator)} at ${r.slice(0,W).map(le=>yo(le.locator)).join("\u2192")}`);break}}R=N}if(R&&(R=n.get(s.name)===s.ident,p&&!R&&(C=`- filled by: ${yo(c.get(s.name)[0])} at ${E}`)),R){let N=!0,U=new Set(s.peerNames);for(let W=r.length-1;W>=1;W--){let ee=r[W];for(let ie of U){if(ee.peerNames.has(ie)&&ee.originalDependencies.has(ie))continue;let ue=ee.dependencies.get(ie);ue&&t.dependencies.get(ie)!==ue&&(W===r.length-1?S.add(ue):(S=null,N=!1,p&&(C=`- peer dependency ${yo(ue.locator)} from parent ${yo(ee.locator)} was not hoisted to ${E}`))),U.delete(ie)}if(!N)break}R=N}if(R&&!h)for(let N of s.hoistedDependencies.values()){let U=a.get(N.name)||t.dependencies.get(N.name);if(!U||N.ident!==U.ident){R=!1,p&&(C=`- previously hoisted dependency mismatch, needed: ${yo(N.locator)}, available: ${yo(U?.locator)}`);break}}return S!==null&&S.size>0?{isHoistable:2,dependsOn:S,reason:C}:{isHoistable:R?0:1,reason:C}},rN=t=>`${t.name}@${t.locator}`,Mgt=(t,e,r,s,a,n,c,f,p)=>{let h=e[e.length-1],E=new Set,C=!1,S=!1,P=(U,W,ee,ie,ue)=>{if(E.has(ie))return;let le=[...W,rN(ie)],me=[...ee,rN(ie)],pe=new Map,Be=new Map;for(let Ae of ZW(ie)){let se=Lgt(h,r,[h,...U,ie],Ae,s,a,n,f,{outputReason:p.debugLevel>=2,fastLookupPossible:p.fastLookupPossible});if(Be.set(Ae,se),se.isHoistable===2)for(let Z of se.dependsOn){let Line truncated
${PD(t)}`)}let ye=ZW(ie);for(let Ae of ye)if(Ce.has(Ae)){let se=Be.get(Ae);if((a.get(Ae.name)===Ae.ident||!ie.reasons.has(Ae.name))&&se.isHoistable!==0&&ie.reasons.set(Ae.name,se.reason),!Ae.isHoistBorder&&me.indexOf(rN(Ae))<0){E.add(ie);let De=j2e(ie,Ae);P([...U,ie],le,me,De,R),E.delete(ie)}}},I,R=new Set(ZW(h)),N=Array.from(e).map(U=>rN(U));do{I=R,R=new Set;for(let U of I){if(U.locator===h.locator||U.isHoistBorder)continue;let W=j2e(h,U);P([],Array.from(r),N,W,R)}}while(R.size>0);return{anotherRoundNeeded:C,isGraphChanged:S}},q2e=t=>{let e=[],r=new Set,s=new Set,a=(n,c,f)=>{if(r.has(n)||(r.add(n),s.has(n)))return;let p=new Map(c);for(let h of n.dependencies.values())n.peerNames.has(h.name)||p.set(h.name,h);for(let h of n.originalDependencies.values()){let E=p.get(h.name),C=()=>`${Array.from(s).concat([n]).map(S=>yo(S.locator)).join("\u2192")}`;if(n.peerNames.has(h.name)){let S=c.get(h.name);(S!==E||!S||S.ident!==h.ident)&&e.push(`${C()} - broken peer promise: expected ${h.ident} but found ${S&&S.ident}`)}else{let S=f.hoistedFrom.get(n.name),P=n.hoistedTo.get(h.name),I=`${S?` hoisted from ${S.join(", ")}`:""}`,R=`${P?` hoisted to ${P}`:""}`,N=`${C()}${I}`;E?E.ident!==h.ident&&e.push(`${N} - broken require promise for ${h.name}${R}: expected ${h.ident}, but found: ${E.ident}`):e.push(`${N} - broken require promise: no required dependency ${h.name}${R} found`)}}s.add(n);for(let h of n.dependencies.values())n.peerNames.has(h.name)||a(h,p,n);s.delete(n)};return a(t,t.dependencies,t),e.join(`
`)},Ugt=(t,e)=>{let{identName:r,name:s,reference:a,peerNames:n}=t,c={name:s,references:new Set([a]),locator:$W(r,a),ident:H2e(r,a),dependencies:new Map,originalDependencies:new Map,hoistedDependencies:new Map,peerNames:new Set(n),reasons:new Map,decoupled:!0,isHoistBorder:!0,hoistPriority:0,dependencyKind:1,hoistedFrom:new Map,hoistedTo:new Map},f=new Map([[t,c]]),p=(h,E)=>{let C=f.get(h),S=!!C;if(!C){let{name:P,identName:I,reference:R,peerNames:N,hoistPriority:U,dependencyKind:W}=h,ee=e.hoistingLimits.get(E.locator);C={name:P,references:new Set([R]),locator:$W(I,R),ident:H2e(I,R),dependencies:new Map,originalDependencies:new Map,hoistedDependencies:new Map,peerNames:new Set(N),reasons:new Map,decoupled:!0,isHoistBorder:ee?ee.has(P):!1,hoistPriority:U||0,dependencyKind:W||0,hoistedFrom:new Map,hoistedTo:new Map},f.set(h,C)}if(E.dependencies.set(h.name,C),E.originalDependencies.set(h.name,C),S){let P=new Set,I=R=>{if(!P.has(R)){P.add(R),R.decoupled=!1;for(let N of R.dependencies.values())R.peerNames.has(N.name)||I(N)}};I(C)}else for(let P of h.dependencies)p(P,C)};for(let h of t.dependencies)p(h,c);return c},tY=t=>t.substring(0,t.indexOf("@",1)),_gt=t=>{let e={name:t.name,identName:tY(t.locator),references:new Set(t.references),dependencies:new Set},r=new Set([t]),s=(a,n,c)=>{let f=r.has(a),p;if(n===a)p=c;else{let{name:h,references:E,locator:C}=a;p={name:h,identName:tY(C),references:E,dependencies:new Set}}if(c.dependencies.add(p),!f){r.add(a);for(let h of a.dependencies.values())a.peerNames.has(h.name)||s(h,a,p);r.delete(a)}};for(let a of t.dependencies.values())s(a,t,e);return e},Hgt=t=>{let e=new Map,r=new Set([t]),s=c=>`${c.name}@${c.ident}`,a=c=>{let f=s(c),p=e.get(f);return p||(p={dependents:new Set,peerDependents:new Set,hoistPriority:0},e.set(f,p)),p},n=(c,f)=>{let p=!!r.has(f);if(a(f).dependents.add(c.ident),!p){r.add(f);for(let E of f.dependencies.values()){let C=a(E);C.hoistPriority=Math.max(C.hoistPriority,E.hoistPriority),f.peerNames.has(E.name)?C.peerDependents.add(f.ident):n(f,E)}}};for(let c of t.dependencies.values())t.peerNames.has(c.name)||n(t,c);return e},yo=t=>{if(!t)return"none";let e=t.indexOf("@",1),r=t.substring(0,e);r.endsWith("$wsroot$")&&(r=`wh:${r.replace("$wsroot$","")}`);let s=t.substring(e+1);if(s==="workspace:.")return".";if(s){let a=(s.indexOf("#")>0?s.split("#")[1]:s).replace("npm:","");return s.startsWith("virtual")&&(r=`v:${r}`),a.startsWith("workspace")&&(r=`w:${r}`,a=""),`${r}${a?`@${a}`:""}`}else return`${r}`};var PD=t=>{let e=0,r=(a,n,c="")=>{if(e>5e4||n.has(a))return"";e++;let f=Array.from(a.dependencies.values()).sort((h,E)=>h.name===E.name?0:h.name>E.name?1:-1),p="";n.add(a);for(let h=0;h<f.length;h++){let E=f[h];if(!a.peerNames.has(E.name)&&E!==a){let C=a.reasons.get(E.name),S=tY(E.locator);p+=`${c}${h<f.length-1?"\u251C\u2500":"\u2514\u2500"}${(n.has(E)?">":"")+(S!==E.name?`a:${E.name}:`:"")+yo(E.locator)+(C?` ${C}`:"")}
`,p+=r(E,n,`${c}${h<f.length-1?"\u2502 ":" "}`)}}return n.delete(a),p};return r(t,new Set)+(e>5e4?`
Tree is too large, part of the tree has been dunped
`:"")};var xD=(s=>(s.WORKSPACES="workspaces",s.DEPENDENCIES="dependencies",s.NONE="none",s))(xD||{}),W2e="node_modules",rg="$wsroot$";var kD=(t,e)=>{let{packageTree:r,hoistingLimits:s,errors:a,preserveSymlinksRequired:n}=Ggt(t,e),c=null;if(a.length===0){let f=G2e(r,{hoistingLimits:s});c=Wgt(t,f,e)}return{tree:c,errors:a,preserveSymlinksRequired:n}},pA=t=>`${t.name}@${t.reference}`,nY=t=>{let e=new Map;for(let[r,s]of t.entries())if(!s.dirList){let a=e.get(s.locator);a||(a={target:s.target,linkType:s.linkType,locations:[],aliases:s.aliases},e.set(s.locator,a)),a.locations.push(r)}for(let r of e.values())r.locations=r.locations.sort((s,a)=>{let n=s.split(J.delimiter).length,c=a.split(J.delimiter).length;return a===s?0:n!==c?c-n:a>s?1:-1});return e},Y2e=(t,e)=>{let r=G.isVirtualLocator(t)?G.devirtualizeLocator(t):t,s=G.isVirtualLocator(e)?G.devirtualizeLocator(e):e;return G.areLocatorsEqual(r,s)},rY=(t,e,r,s)=>{if(t.linkType!=="SOFT")return!1;let a=fe.toPortablePath(r.resolveVirtual&&e.reference&&e.reference.startsWith("virtual:")?r.resolveVirtual(t.packageLocation):t.packageLocation);return J.contains(s,a)===null},jgt=t=>{let e=t.getPackageInformation(t.topLevel);if(e===null)throw new Error("Assertion failed: Expected the top-level package to have been registered");if(t.findPackageLocator(e.packageLocation)===null)throw new Error("Assertion failed: Expected the top-level package to have a physical locator");let s=fe.toPortablePath(e.packageLocation.slice(0,-1)),a=new Map,n={children:new Map},c=t.getDependencyTreeRoots(),f=new Map,p=new Set,h=(S,P)=>{let I=pA(S);if(p.has(I))return;p.add(I);let R=t.getPackageInformation(S);if(R){let N=P?pA(P):"";if(pA(S)!==N&&R.linkType==="SOFT"&&!S.reference.startsWith("link:")&&!rY(R,S,t,s)){let U=V2e(R,S,t);(!f.get(U)||S.reference.startsWith("workspace:"))&&f.set(U,S)}for(let[U,W]of R.packageDependencies)W!==null&&(R.packagePeers.has(U)||h(t.getLocator(U,W),S))}};for(let S of c)h(S,null);let E=s.split(J.sep);for(let S of f.values()){let P=t.getPackageInformation(S),R=fe.toPortablePath(P.packageLocation.slice(0,-1)).split(J.sep).slice(E.length),N=n;for(let U of R){let W=N.children.get(U);W||(W={children:new Map},N.children.set(U,W)),N=W}N.workspaceLocator=S}let C=(S,P)=>{if(S.workspaceLocator){let I=pA(P),R=a.get(I);R||(R=new Set,a.set(I,R)),R.add(S.workspaceLocator)}for(let I of S.children.values())C(I,S.workspaceLocator||P)};for(let S of n.children.values())C(S,n.workspaceLocator);return a},Ggt=(t,e)=>{let r=[],s=!1,a=new Map,n=jgt(t),c=t.getPackageInformation(t.topLevel);if(c===null)throw new Error("Assertion failed: Expected the top-level package to have been registered");let f=t.findPackageLocator(c.packageLocation);if(f===null)throw new Error("Assertion failed: Expected the top-level package to have a physical locator");let p=fe.toPortablePath(c.packageLocation.slice(0,-1)),h={name:f.name,identName:f.name,reference:f.reference,peerNames:c.packagePeers,dependencies:new Set,dependencyKind:1},E=new Map,C=(P,I)=>`${pA(I)}:${P}`,S=(P,I,R,N,U,W,ee,ie)=>{let ue=C(P,R),le=E.get(ue),me=!!le;!me&&R.name===f.name&&R.reference===f.reference&&(le=h,E.set(ue,h));let pe=rY(I,R,t,p);if(!le){let Ae=0;pe?Ae=2:I.linkType==="SOFT"&&R.name.endsWith(rg)&&(Ae=1),le={name:P,identName:R.name,reference:R.reference,dependencies:new Set,peerNames:Ae===1?new Set:I.packagePeers,dependencyKind:Ae},E.set(ue,le)}let Be;if(pe?Be=2:U.linkType==="SOFT"?Be=1:Be=0,le.hoistPriority=Math.max(le.hoistPriority||0,Be),ie&&!pe){let Ae=pA({name:N.identName,reference:N.reference}),se=a.get(Ae)||new Set;a.set(Ae,se),se.add(le.name)}let Ce=new Map(I.packageDependencies);if(e.project){let Ae=e.project.workspacesByCwd.get(fe.toPortablePath(I.packageLocation.slice(0,-1)));if(Ae){let se=new Set([...Array.from(Ae.manifest.peerDependencies.values(),Z=>G.stringifyIdent(Z)),...Array.from(Ae.manifest.peerDependenciesMeta.keys())]);for(let Z of se)Ce.has(Z)||(Ce.set(Z,W.get(Z)||null),le.peerNames.add(Z))}}let g=pA({name:R.name.replace(rg,""),reference:R.reference}),we=n.get(g);if(we)for(let Ae of we)Ce.set(`${Ae.name}${rg}`,Ae.reference);(I!==U||I.linkType!=="SOFT"||!pe&&(!e.selfReferencesByCwd||e.selfReferencesByCwd.get(ee)))&&N.dependencies.add(le);let ye=R!==f&&I.linkType==="SOFT"&&!R.name.endsWith(rg)&&!pe;if(!me&&!ye){let Ae=new Map;for(let[se,Z]of Ce)if(Z!==null){let De=t.getLocator(se,Z),Re=t.getLocator(se.replace(rg,""),Z),mt=t.getPackageInformation(Re);if(mt===null)throw new Error("Assertion failed: Expected the package to have been registered");let j=rY(mt,De,t,p);if(e.validateExternalSoftLinks&&e.project&&j){mt.packageDependencies.size>0&&(s=!0);for(let[Ve,ke]of mt.packageDependencies)if(ke!==null){let it=G.parseLocator(Array.isArray(ke)?`${ke[0]}@${ke[1]}`:`${Ve}@${ke}`);if(pA(it)!==pA(De)){let Ue=Ce.get(Ve);if(Ue){let x=G.parseLocator(Array.isArray(Ue)?`${Ue[0]}@${Ue[1]}`:`${Ve}@${Ue}`);Y2e(x,it)||r.push({messageName:71,text:`Cannot link ${G.prettyIdent(e.project.configuration,G.parseIdent(De.name))} into ${G.pretLine truncated
`;for(let n=0,c=t.length;n<c;++n)a+=s+nN(String(n),t[n],e,s).replace(/^ +/,""),n+1<c&&(a+=","),a+=`
`;return a+=r,a+="]",a}function Jgt(t,e,r){let s=Object.keys(t),a="";a+="{";for(let n=0,c=s.length,f=0;n<c;++n){let p=s[n],h=t[p];typeof h>"u"||(f!==0&&(a+=", "),a+=JSON.stringify(p),a+=": ",a+=nN(p,h,e,r).replace(/^ +/g,""),f+=1)}return a+="}",a}function Kgt(t,e,r){let s=Object.keys(t),a=`${r} `,n="";n+=r,n+=`{
`;let c=0;for(let f=0,p=s.length;f<p;++f){let h=s[f],E=t[h];typeof E>"u"||(c!==0&&(n+=",",n+=`
`),n+=a,n+=JSON.stringify(h),n+=": ",n+=nN(h,E,e,a).replace(/^ +/g,""),c+=1)}return c!==0&&(n+=`
`),n+=r,n+="}",n}function nN(t,e,r,s){let{next:a}=J2e[r],n=a[t]||a["*"];return K2e(e,n,s)}function K2e(t,e,r){let{collapsed:s}=J2e[e];return Array.isArray(t)?s?Ygt(t,e,r):Vgt(t,e,r):typeof t=="object"&&t!==null?s?Jgt(t,e,r):Kgt(t,e,r):JSON.stringify(t)}function z2e(t){return K2e(t,"TOP_LEVEL","")}function QD(t,e){let r=Array.from(t);Array.isArray(e)||(e=[e]);let s=[];for(let n of e)s.push(r.map(c=>n(c)));let a=r.map((n,c)=>c);return a.sort((n,c)=>{for(let f of s){let p=f[n]<f[c]?-1:f[n]>f[c]?1:0;if(p!==0)return p}return 0}),a.map(n=>r[n])}function zgt(t){let e=new Map,r=QD(t.fallbackExclusionList||[],[({name:s,reference:a})=>s,({name:s,reference:a})=>a]);for(let{name:s,reference:a}of r){let n=e.get(s);typeof n>"u"&&e.set(s,n=new Set),n.add(a)}return Array.from(e).map(([s,a])=>[s,Array.from(a)])}function Xgt(t){return QD(t.fallbackPool||[],([e])=>e)}function Zgt(t){let e=[],r=t.dependencyTreeRoots.find(s=>t.packageRegistry.get(s.name)?.get(s.reference)?.packageLocation==="./");for(let[s,a]of QD(t.packageRegistry,([n])=>n===null?"0":`1${n}`)){if(s===null)continue;let n=[];e.push([s,n]);for(let[c,{packageLocation:f,packageDependencies:p,packagePeers:h,linkType:E,discardFromLookup:C}]of QD(a,([S])=>S===null?"0":`1${S}`)){if(c===null)continue;let S=[];s!==null&&c!==null&&!p.has(s)&&S.push([s,c]);for(let[U,W]of p)S.push([U,W]);let P=QD(S,([U])=>U),I=h&&h.size>0?Array.from(h):void 0,N={packageLocation:f,packageDependencies:P,packagePeers:I,linkType:E,discardFromLookup:C||void 0};n.push([c,N]),r&&s===r.name&&c===r.reference&&e.unshift([null,[[null,N]]])}}return e}function TD(t){return{__info:["This file is automatically generated. Do not touch it, or risk","your modifications being lost."],dependencyTreeRoots:t.dependencyTreeRoots,enableTopLevelFallback:t.enableTopLevelFallback||!1,ignorePatternData:t.ignorePattern||null,pnpZipBackend:t.pnpZipBackend,fallbackExclusionList:zgt(t),fallbackPool:Xgt(t),packageRegistryData:Zgt(t)}}var $2e=ut(Z2e());function eBe(t,e){return[t?`${t}
`:"",`/* eslint-disable */
`,`// @ts-nocheck
`,`"use strict";
`,`
`,e,`
`,(0,$2e.default)()].join("")}function $gt(t){return JSON.stringify(t,null,2)}function edt(t){return`'${t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,`\\
`)}'`}function tdt(t){return[`const RAW_RUNTIME_STATE =
`,`${edt(z2e(t))};
`,`function $$SETUP_STATE(hydrateRuntimeState, basePath) {
`,` return hydrateRuntimeState(JSON.parse(RAW_RUNTIME_STATE), {basePath: basePath || __dirname});
`,`}
`].join("")}function rdt(){return[`function $$SETUP_STATE(hydrateRuntimeState, basePath) {
`,` const fs = require('fs');
`,` const path = require('path');
`,` const pnpDataFilepath = path.resolve(__dirname, ${JSON.stringify(Er.pnpData)});
`,` return hydrateRuntimeState(JSON.parse(fs.readFileSync(pnpDataFilepath, 'utf8')), {basePath: basePath || __dirname});
`,`}
`].join("")}function tBe(t){let e=TD(t),r=tdt(e);return eBe(t.shebang,r)}function rBe(t){let e=TD(t),r=rdt(),s=eBe(t.shebang,r);return{dataFile:$gt(e),loaderFile:s}}Dt();function sY(t,{basePath:e}){let r=fe.toPortablePath(e),s=J.resolve(r),a=t.ignorePatternData!==null?new RegExp(t.ignorePatternData):null,n=new Map,c=new Map(t.packageRegistryData.map(([C,S])=>[C,new Map(S.map(([P,I])=>{if(C===null!=(P===null))throw new Error("Assertion failed: The name and reference should be null, or neither should");let R=I.discardFromLookup??!1,N={name:C,reference:P},U=n.get(I.packageLocation);U?(U.discardFromLookup=U.discardFromLookup&&R,R||(U.locator=N)):n.set(I.packageLocation,{locator:N,discardFromLookup:R});let W=null;return[P,{packageDependencies:new Map(I.packageDependencies),packagePeers:new Set(I.packagePeers),linkType:I.linkType,discardFromLookup:R,get packageLocation(){return W||(W=J.join(s,I.packageLocation))}}]}))])),f=new Map(t.fallbackExclusionList.map(([C,S])=>[C,new Set(S)])),p=new Map(t.fallbackPool),h=t.dependencyTreeRoots,E=t.enableTopLevelFallback;return{basePath:r,dependencyTreeRoots:h,enableTopLevelFallback:E,fallbackExclusionList:f,pnpZipBackend:t.pnpZipBackend,fallbackPool:p,ignorePattern:a,packageLocatorsByLocations:n,packageRegistry:c}}Dt();Dt();var sh=Ie("module"),jm=Ie("url"),gY=Ie("util");var ta=Ie("url");var oBe=ut(Ie("assert"));var oY=Array.isArray,RD=JSON.stringify,FD=Object.getOwnPropertyNames,Hm=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),aY=(t,e)=>RegExp.prototype.exec.call(t,e),lY=(t,...e)=>RegExp.prototype[Symbol.replace].apply(t,e),ng=(t,...e)=>String.prototype.endsWith.apply(t,e),cY=(t,...e)=>String.prototype.includes.apply(t,e),uY=(t,...e)=>String.prototype.lastIndexOf.apply(t,e),ND=(t,...e)=>String.prototype.indexOf.apply(t,e),nBe=(t,...e)=>String.prototype.replace.apply(t,e),ig=(t,...e)=>String.prototype.slice.apply(t,e),hA=(t,...e)=>String.prototype.startsWith.apply(t,e),iBe=Map,sBe=JSON.parse;function OD(t,e,r){return class extends r{constructor(...s){super(e(...s)),this.code=t,this.name=`${r.name} [${t}]`}}}var aBe=OD("ERR_PACKAGE_IMPORT_NOT_DEFINED",(t,e,r)=>`Package import specifier "${t}" is not defined${e?` in package ${e}package.json`:""} imported from ${r}`,TypeError),fY=OD("ERR_INVALID_MODULE_SPECIFIER",(t,e,r=void 0)=>`Invalid module "${t}" ${e}${r?` imported from ${r}`:""}`,TypeError),lBe=OD("ERR_INVALID_PACKAGE_TARGET",(t,e,r,s=!1,a=void 0)=>{let n=typeof r=="string"&&!s&&r.length&&!hA(r,"./");return e==="."?((0,oBe.default)(s===!1),`Invalid "exports" main target ${RD(r)} defined in the package config ${t}package.json${a?` imported from ${a}`:""}${n?'; targets must start with "./"':""}`):`Invalid "${s?"imports":"exports"}" target ${RD(r)} defined for '${e}' in the package config ${t}package.json${a?` imported from ${a}`:""}${n?'; targets must start with "./"':""}`},Error),LD=OD("ERR_INVALID_PACKAGE_CONFIG",(t,e,r)=>`Invalid package config ${t}${e?` while importing ${e}`:""}${r?`. ${r}`:""}`,Error),cBe=OD("ERR_PACKAGE_PATH_NOT_EXPORTED",(t,e,r=void 0)=>e==="."?`No "exports" main defined in ${t}package.json${r?` imported from ${r}`:""}`:`Package subpath '${e}' is not defined by "exports" in ${t}package.json${r?` imported from ${r}`:""}`,Error);var sN=Ie("url");function uBe(t,e){let r=Object.create(null);for(let s=0;s<e.length;s++){let a=e[s];Hm(t,a)&&(r[a]=t[a])}return r}var iN=new iBe;function ndt(t,e,r,s){let a=iN.get(t);if(a!==void 0)return a;let n=s(t);if(n===void 0){let P={pjsonPath:t,exists:!1,main:void 0,name:void 0,type:"none",exports:void 0,imports:void 0};return iN.set(t,P),P}let c;try{c=sBe(n)}catch(P){throw new LD(t,(r?`"${e}" from `:"")+(0,sN.fileURLToPath)(r||e),P.message)}let{imports:f,main:p,name:h,type:E}=uBe(c,["imports","main","name","type"]),C=Hm(c,"exports")?c.exports:void 0;(typeof f!="object"||f===null)&&(f=void 0),typeof p!="string"&&(p=void 0),typeof h!="string"&&(h=void 0),E!=="module"&&E!=="commonjs"&&(E="none");let S={pjsonPath:t,exists:!0,main:p,name:h,type:E,exports:C,imports:f};return iN.set(t,S),S}function fBe(t,e){let r=new URL("./package.json",t);for(;;){let n=r.pathname;if(ng(n,"node_modules/package.json"))break;let c=ndt((0,sN.fileURLToPath)(r),t,void 0,e);if(c.exists)return c;let f=r;if(r=new URL("../package.json",r),r.pathname===f.pathname)break}let s=(0,sN.fileURLToPath)(r),a={pjsonPath:s,exists:!1,main:void 0,name:void 0,type:"none",exports:void 0,imports:void 0};return iN.set(s,a),a}function idt(t,e,r){throw new aBe(t,e&&(0,ta.fileURLToPath)(new URL(".",e)),(0,ta.fileURLToPath)(r))}function sdt(t,e,r,s){let a=`request is not a valid subpath for the "${r?"imports":"exports"}" resolution of ${(0,ta.fileURLToPath)(e)}`;throw new fY(t,a,s&&(0,ta.fileURLToPath)(s))}function MD(t,e,r,s,a){throw typeof e=="object"&&e!==null?e=RD(e,null,""):e=`${e}`,new lBe((0,ta.fileURLToPath)(new URL(".",r)),t,e,s,a&&(0,ta.fileURLToPath)(a))}var ABe=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f Line truncated
`),r;c=t[++n]}else if(c===" "&&!s){a=!0;continue}else if(c==='"'){s=!s;continue}a?(r.push(c),a=!1):r[r.length-1]+=c}return s&&e.push(`invalid value for NODE_OPTIONS (unterminated string)
`),r}Dt();var[ml,ih]=process.versions.node.split(".").map(t=>parseInt(t,10)),BBe=ml>19||ml===19&&ih>=2||ml===18&&ih>=13,UZt=ml===20&&ih<6||ml===19&&ih>=3,_Zt=ml>19||ml===19&&ih>=6,HZt=ml>=21||ml===20&&ih>=10||ml===18&&ih>=19,jZt=ml>=21||ml===20&&ih>=10||ml===18&&ih>=20,GZt=ml>=22;function vBe(t){if(process.env.WATCH_REPORT_DEPENDENCIES&&process.send)if(t=t.map(e=>fe.fromPortablePath(uo.resolveVirtual(fe.toPortablePath(e)))),BBe)process.send({"watch:require":t});else for(let e of t)process.send({"watch:require":e})}function dY(t,e){let r=Number(process.env.PNP_ALWAYS_WARN_ON_FALLBACK)>0,s=Number(process.env.PNP_DEBUG_LEVEL),a=/^(?![a-zA-Z]:[\\/]|\\\\|\.{0,2}(?:\/|$))((?:node:)?(?:@[^/]+\/)?[^/]+)\/*(.*|)$/,n=/^(\/|\.{1,2}(\/|$))/,c=/\/$/,f=/^\.{0,2}\//,p={name:null,reference:null},h=[],E=new Set;if(t.enableTopLevelFallback===!0&&h.push(p),e.compatibilityMode!==!1)for(let Fe of["react-scripts","gatsby"]){let Ne=t.packageRegistry.get(Fe);if(Ne)for(let Pe of Ne.keys()){if(Pe===null)throw new Error("Assertion failed: This reference shouldn't be null");h.push({name:Fe,reference:Pe})}}let{ignorePattern:C,packageRegistry:S,packageLocatorsByLocations:P}=t;function I(Fe,Ne){return{fn:Fe,args:Ne,error:null,result:null}}function R(Fe){let Ne=process.stderr?.hasColors?.()??process.stdout.isTTY,Pe=(it,Ue)=>`\x1B[${it}m${Ue}\x1B[0m`,Ve=Fe.error;console.error(Ve?Pe("31;1",`\u2716 ${Fe.error?.message.replace(/\n.*/s,"")}`):Pe("33;1","\u203C Resolution")),Fe.args.length>0&&console.error();for(let it of Fe.args)console.error(` ${Pe("37;1","In \u2190")} ${(0,gY.inspect)(it,{colors:Ne,compact:!0})}`);Fe.result&&(console.error(),console.error(` ${Pe("37;1","Out \u2192")} ${(0,gY.inspect)(Fe.result,{colors:Ne,compact:!0})}`));let ke=new Error().stack.match(/(?<=^ +)at.*/gm)?.slice(2)??[];if(ke.length>0){console.error();for(let it of ke)console.error(` ${Pe("38;5;244",it)}`)}console.error()}function N(Fe,Ne){if(e.allowDebug===!1)return Ne;if(Number.isFinite(s)){if(s>=2)return(...Pe)=>{let Ve=I(Fe,Pe);try{return Ve.result=Ne(...Pe)}catch(ke){throw Ve.error=ke}finally{R(Ve)}};if(s>=1)return(...Pe)=>{try{return Ne(...Pe)}catch(Ve){let ke=I(Fe,Pe);throw ke.error=Ve,R(ke),Ve}}}return Ne}function U(Fe){let Ne=g(Fe);if(!Ne)throw gs("INTERNAL","Couldn't find a matching entry in the dependency tree for the specified parent (this is probably an internal error)");return Ne}function W(Fe){if(Fe.name===null)return!0;for(let Ne of t.dependencyTreeRoots)if(Ne.name===Fe.name&&Ne.reference===Fe.reference)return!0;return!1}let ee=new Set(["node","require",...wBe("--conditions")]);function ie(Fe,Ne=ee,Pe){let Ve=Ae(J.join(Fe,"internal.js"),{resolveIgnored:!0,includeDiscardFromLookup:!0});if(Ve===null)throw gs("INTERNAL",`The locator that owns the "${Fe}" path can't be found inside the dependency tree (this is probably an internal error)`);let{packageLocation:ke}=U(Ve),it=J.join(ke,Er.manifest);if(!e.fakeFs.existsSync(it))return null;let Ue=JSON.parse(e.fakeFs.readFileSync(it,"utf8"));if(Ue.exports==null)return null;let x=J.contains(ke,Fe);if(x===null)throw gs("INTERNAL","unqualifiedPath doesn't contain the packageLocation (this is probably an internal error)");x!=="."&&!f.test(x)&&(x=`./${x}`);try{let w=dBe({packageJSONUrl:(0,jm.pathToFileURL)(fe.fromPortablePath(it)),packageSubpath:x,exports:Ue.exports,base:Pe?(0,jm.pathToFileURL)(fe.fromPortablePath(Pe)):null,conditions:Ne});return fe.toPortablePath((0,jm.fileURLToPath)(w))}catch(w){throw gs("EXPORTS_RESOLUTION_FAILED",w.message,{unqualifiedPath:lf(Fe),locator:Ve,pkgJson:Ue,subpath:lf(x),conditions:Ne},w.code)}}function ue(Fe,Ne,{extensions:Pe}){let Ve;try{Ne.push(Fe),Ve=e.fakeFs.statSync(Fe)}catch{}if(Ve&&!Ve.isDirectory())return e.fakeFs.realpathSync(Fe);if(Ve&&Ve.isDirectory()){let ke;try{ke=JSON.parse(e.fakeFs.readFileSync(J.join(Fe,Er.manifest),"utf8"))}catch{}let it;if(ke&&ke.main&&(it=J.resolve(Fe,ke.main)),it&&it!==Fe){let Ue=ue(it,Ne,{extensions:Pe});if(Ue!==null)return Ue}}for(let ke=0,it=Pe.length;ke<it;ke++){let Ue=`${Fe}${Pe[ke]}`;if(Ne.push(Ue),e.fakeFs.existsSync(Ue))return Ue}if(Ve&&Ve.isDirectory())for(let ke=0,it=Pe.length;ke<it;ke++){let Ue=J.format({dir:Fe,name:"index",ext:Pe[ke]});if(Ne.push(Ue),e.fakeFs.existsSync(Ue))return Ue}return null}function le(Fe){let Ne=new sh.Module(Fe,null);return Ne.filename=Fe,Ne.paths=sh.Module._nodeModulePaths(Fe),Ne}function me(Fe,Ne){return Ne.endsWith("/")&&(Ne=J.join(Ne,"internal.js")),sh.Module._resolveFilename(fe.fromPortablePath(Fe),le(fe.fromPortablePath(Ne)),!1,{plugnplay:!1})}function pe(Fe){if(C===null)return!1;let Ne=J.contains(t.basePath,Fe);return Ne===null?!1:!!C.test(Ne.replace(/\/$/,""))}let Be={std:3,resolveVirtual:1,getAllLocators:1},Ce=p;function g({name:Fe,reference:Ne}){let Pe=S.get(Fe);if(!Pe)return null;let Ve=Pe.get(Ne);return Ve||null}function we({name:Fe,reference:Ne}){let Pe=[];for(let[Ve,ke]of S)if(Ve!==null)for(let[it,Ue]of ke)it===null||Ue.packageDependencies.get(Fe)!==Ne||Ve===Fe&&it===Ne||Pe.push({name:Ve,reLine truncated
Require request: "${Ve}"
Required by: ${ke}
`,{request:Ve,issuer:ke});return fe.toPortablePath(x)}let it,Ue=Fe.match(a);if(Ue){if(!Ne)throw gs("API_ERROR","The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute",{request:Ve,issuer:ke});let[,x,w]=Ue,b=Ae(Ne);if(!b){let Te=me(Fe,Ne);if(Te===!1)throw gs("BUILTIN_NODE_RESOLUTION_FAILED",`The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer doesn't seem to be part of the Yarn-managed dependency tree).
Require path: "${Ve}"
Required by: ${ke}
`,{request:Ve,issuer:ke});return fe.toPortablePath(Te)}let F=U(b).packageDependencies.get(x),z=null;if(F==null&&b.name!==null){let Te=t.fallbackExclusionList.get(b.name);if(!Te||!Te.has(b.reference)){for(let Ct=0,qt=h.length;Ct<qt;++Ct){let Pt=U(h[Ct]).packageDependencies.get(x);if(Pt!=null){r?z=Pt:F=Pt;break}}if(t.enableTopLevelFallback&&F==null&&z===null){let Ct=t.fallbackPool.get(x);Ct!=null&&(z=Ct)}}}let X=null;if(F===null)if(W(b))X=gs("MISSING_PEER_DEPENDENCY",`Your application tried to access ${x} (a peer dependency); this isn't allowed as there is no ancestor to satisfy the requirement. Use a devDependency if needed.
Required package: ${x}${x!==Ve?` (via "${Ve}")`:""}
Required by: ${ke}
`,{request:Ve,issuer:ke,dependencyName:x});else{let Te=ye(x,b);Te.every(lt=>W(lt))?X=gs("MISSING_PEER_DEPENDENCY",`${b.name} tried to access ${x} (a peer dependency) but it isn't provided by your application; this makes the require call ambiguous and unsound.
Required package: ${x}${x!==Ve?` (via "${Ve}")`:""}
Required by: ${b.name}@${b.reference} (via ${ke})
${Te.map(lt=>`Ancestor breaking the chain: ${lt.name}@${lt.reference}
`).join("")}
`,{request:Ve,issuer:ke,issuerLocator:Object.assign({},b),dependencyName:x,brokenAncestors:Te}):X=gs("MISSING_PEER_DEPENDENCY",`${b.name} tried to access ${x} (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.
Required package: ${x}${x!==Ve?` (via "${Ve}")`:""}
Required by: ${b.name}@${b.reference} (via ${ke})
${Te.map(lt=>`Ancestor breaking the chain: ${lt.name}@${lt.reference}
`).join("")}
`,{request:Ve,issuer:ke,issuerLocator:Object.assign({},b),dependencyName:x,brokenAncestors:Te})}else F===void 0&&(!Pe&&(0,sh.isBuiltin)(Fe)?W(b)?X=gs("UNDECLARED_DEPENDENCY",`Your application tried to access ${x}. While this module is usually interpreted as a Node builtin, your resolver is running inside a non-Node resolution context where such builtins are ignored. Since ${x} isn't otherwise declared in your dependencies, this makes the require call ambiguous and unsound.
Required package: ${x}${x!==Ve?` (via "${Ve}")`:""}
Required by: ${ke}
`,{request:Ve,issuer:ke,dependencyName:x}):X=gs("UNDECLARED_DEPENDENCY",`${b.name} tried to access ${x}. While this module is usually interpreted as a Node builtin, your resolver is running inside a non-Node resolution context where such builtins are ignored. Since ${x} isn't otherwise declared in ${b.name}'s dependencies, this makes the require call ambiguous and unsound.
Required package: ${x}${x!==Ve?` (via "${Ve}")`:""}
Required by: ${ke}
`,{request:Ve,issuer:ke,issuerLocator:Object.assign({},b),dependencyName:x}):W(b)?X=gs("UNDECLARED_DEPENDENCY",`Your application tried to access ${x}, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.
Required package: ${x}${x!==Ve?` (via "${Ve}")`:""}
Required by: ${ke}
`,{request:Ve,issuer:ke,dependencyName:x}):X=gs("UNDECLARED_DEPENDENCY",`${b.name} tried to access ${x}, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: ${x}${x!==Ve?` (via "${Ve}")`:""}
Required by: ${b.name}@${b.reference} (via ${ke})
`,{request:Ve,issuer:ke,issuerLocator:Object.assign({},b),dependencyName:x}));if(F==null){if(z===null||X===null)throw X||new Error("Assertion failed: Expected an error to have been set");F=z;let Te=X.message.replace(/\n.*/g,"");X.message=Te,!E.has(Te)&&s!==0&&(E.add(Te),process.emitWarning(X))}let $=Array.isArray(F)?{name:F[0],reference:F[1]}:{name:x,reference:F},oe=U($);if(!oe.packageLocation)throw gs("MISSING_DEPENDENCY",`A dependency seems valid but didn't get installed for some reason. This might be caused by a partial install, such as dev vs prod.
Required package: ${$.name}@${$.reference}${$.name!==Ve?` (via "${Ve}")`:""}
Required by: ${b.name}@${b.reference} (via ${ke})
`,{request:Ve,issuer:ke,dependencyLocator:Object.assign({},$)});let xe=oe.packageLocation;w?it=J.join(xe,w):it=xe}else if(J.isAbsolute(Fe))it=J.normalize(Fe);else{if(!Ne)throw gs("API_ERROR","The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute",{request:Ve,issuer:ke});let x=J.resolve(Ne);Ne.match(c)?it=J.normalize(J.join(x,Fe)):it=J.normalize(J.join(J.dirname(x),Fe))}return J.normalize(it)}function De(Fe,Ne,Pe=ee,Ve){if(n.test(Fe))return Ne;let ke=ie(Ne,Pe,Ve);return ke?J.normalize(ke):Ne}function Re(Fe,{extensions:Ne=Object.keys(sh.Module._extensions)}={}){let Pe=[],Ve=ue(Fe,Pe,{extensions:Ne});if(Ve)return J.normalize(Ve);{vBe(Pe.map(Ue=>fe.fromPortablePath(Ue)));let ke=lf(Fe),it=Ae(Fe);if(it){let{packageLocation:Ue}=U(it),x=!0;try{e.fakeFs.accessSync(Ue)}catch(w){if(w?.code==="ENOENT")x=!1;else{let b=(w?.message??w??"empty exception thrown").replace(/^[A-Z]/,y=>y.toLowerCase());throw gs("QUALIFIED_PATH_RESOLUTION_FAILED",`Required package exists but could not be accessed (${b}).
Missing package: ${it.name}@${it.reference}
Expected package location: ${lf(Ue)}
`,{unqualifiedPath:ke,extensions:Ne})}}if(!x){let w=Ue.includes("/unplugged/")?"Required unplugged package missing from disk. This may happen when switching branches without running installs (unplugged packages must be fully materialized on disk to work).":"Required package missing from disk. If you keep your packages inside your repository then restarting the Node process may be enough. Otherwise, try to run an install first.";throw gs("QUALIFIED_PATH_RESOLUTION_FAILED",`${w}
Missing package: ${it.name}@${it.reference}
Expected package location: ${lf(Ue)}
`,{unqualifiedPath:ke,extensions:Ne})}}throw gs("QUALIFIED_PATH_RESOLUTION_FAILED",`Qualified path resolution failed: we looked for the following paths, but none could be accessed.
Source path: ${ke}
${Pe.map(Ue=>`Not found: ${lf(Ue)}
`).join("")}`,{unqualifiedPath:ke,extensions:Ne})}}function mt(Fe,Ne,Pe){if(!Ne)throw new Error("Assertion failed: An issuer is required to resolve private import mappings");let Ve=mBe({name:Fe,base:(0,jm.pathToFileURL)(fe.fromPortablePath(Ne)),conditions:Pe.conditions??ee,readFileSyncFn:se});if(Ve instanceof URL)return Re(fe.toPortablePath((0,jm.fileURLToPath)(Ve)),{extensions:Pe.extensions});if(Ve.startsWith("#"))throw new Error("Mapping from one private import to another isn't allowed");return j(Ve,Ne,Pe)}function j(Fe,Ne,Pe={}){try{if(Fe.startsWith("#"))return mt(Fe,Ne,Pe);let{considerBuiltins:Ve,extensions:ke,conditions:it}=Pe,Ue=Z(Fe,Ne,{considerBuiltins:Ve});if(Fe==="pnpapi")return Ue;if(Ue===null)return null;let x=()=>Ne!==null?pe(Ne):!1,w=(!Ve||!(0,sh.isBuiltin)(Fe))&&!x()?De(Fe,Ue,it,Ne):Ue;return Re(w,{extensions:ke})}catch(Ve){throw Object.hasOwn(Ve,"pnpCode")&&Object.assign(Ve.data,{request:lf(Fe),issuer:Ne&&lf(Ne)}),Ve}}function rt(Fe){let Ne=J.normalize(Fe),Pe=uo.resolveVirtual(Ne);return Pe!==Ne?Pe:null}return{VERSIONS:Be,topLevel:Ce,getLocator:(Fe,Ne)=>Array.isArray(Ne)?{name:Ne[0],reference:Ne[1]}:{name:Fe,reference:Ne},getDependencyTreeRoots:()=>[...t.dependencyTreeRoots],getAllLocators(){let Fe=[];for(let[Ne,Pe]of S)for(let Ve of Pe.keys())Ne!==null&&Ve!==null&&Fe.push({name:Ne,reference:Ve});return Fe},getPackageInformation:Fe=>{let Ne=g(Fe);if(Ne===null)return null;let Pe=fe.fromPortablePath(Ne.packageLocation);return{...Ne,packageLocation:Pe}},findPackageLocator:Fe=>Ae(fe.toPortablePath(Fe)),resolveToUnqualified:N("resolveToUnqualified",(Fe,Ne,Pe)=>{let Ve=Ne!==null?fe.toPortablePath(Ne):null,ke=Z(fe.toPortablePath(Fe),Ve,Pe);return ke===null?null:fe.fromPortablePath(ke)}),resolveUnqualified:N("resolveUnqualified",(Fe,Ne)=>fe.fromPortablePath(Re(fe.toPortablePath(Fe),Ne))),resolveRequest:N("resolveRequest",(Fe,Ne,Pe)=>{let Ve=Ne!==null?fe.toPortablePath(Ne):null,ke=j(fe.toPortablePath(Fe),Ve,Pe);return ke===null?null:fe.fromPortablePath(ke)}),resolveVirtual:N("resolveVirtual",Fe=>{let Ne=rt(fe.toPortablePath(Fe));return Ne!==null?fe.fromPortablePath(Ne):null})}}Dt();var SBe=(t,e,r)=>{let s=TD(t),a=sY(s,{basePath:e}),n=fe.join(e,Er.pnpCjs);return dY(a,{fakeFs:r,pnpapiResolution:n})};var yY=ut(bBe());Yt();var gA={};Vt(gA,{checkManifestCompatibility:()=>PBe,extractBuildRequest:()=>oN,getExtractHint:()=>EY,hasBindingGyp:()=>IY});Ge();Dt();function PBe(t){return G.isPackageCompatible(t,Ui.getArchitectureSet())}function oN(t,e,r,{configuration:s}){let a=[];for(let n of["preinstall","install","postinstall"])e.manifest.scripts.has(n)&&a.push({type:0,script:n});return!e.manifest.scripts.has("install")&&e.misc.hasBindingGyp&&a.push({type:1,script:"node-gyp rebuild"}),a.length===0?null:t.linkType!=="HARD"?{skipped:!0,explain:n=>n.reportWarningOnce(6,`${G.prettyLocator(s,t)} lists build scripts, but is referenced through a soft link. Soft links don't support build scripts, so they'll be ignored.`)}:r&&r.built===!1?{skipped:!0,explain:n=>n.reportInfoOnce(5,`${G.prettyLocator(s,t)} lists build scripts, but its build has been explicitly disabled through configuration.`)}:!s.get("enableScripts")&&!r.built?{skipped:!0,explain:n=>n.reportWarningOnce(4,`${G.prettyLocator(s,t)} lists build scripts, but all build scripts have been disabled.`)}:PBe(t)?{skipped:!1,directives:a}:{skipped:!0,explain:n=>n.reportWarningOnce(76,`${G.prettyLocator(s,t)} The ${Ui.getArchitectureName()} architecture is incompatible with this package, build skipped.`)}}var gdt=new Set([".exe",".bin",".h",".hh",".hpp",".c",".cc",".cpp",".java",".jar",".node"]);function EY(t){return t.packageFs.getExtractHint({relevantExtensions:gdt})}function IY(t){let e=J.join(t.prefixPath,"binding.gyp");return t.packageFs.existsSync(e)}var HD={};Vt(HD,{getUnpluggedPath:()=>_D});Ge();Dt();function _D(t,{configuration:e}){return J.resolve(e.get("pnpUnpluggedFolder"),G.slugifyLocator(t))}var ddt=new Set([G.makeIdent(null,"open").identHash,G.makeIdent(null,"opn").identHash]),sg=class{constructor(){this.mode="strict";this.pnpCache=new Map}getCustomDataKey(){return JSON.stringify({name:"PnpLinker",version:2})}supportsPackage(e,r){return this.isEnabled(r)}async findPackageLocation(e,r){if(!this.isEnabled(r))throw new Error("Assertion failed: Expected the PnP linker to be enabled");let s=og(r.project).cjs;if(!ce.existsSync(s))throw new nt(`The project in ${he.pretty(r.project.configuration,`${r.project.cwd}/package.json`,he.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let a=je.getFactoryWithDefault(this.pnpCache,s,()=>je.dynamicRequire(s,{cachingStrategy:je.CachingStrategy.FsTime})),n={name:G.stringifyIdent(e),reference:e.reference},c=a.getPackageInformation(n);if(!c)throw new nt(`Couldn't find ${G.prettyLocator(r.project.configuration,e)} in the currently installed PnP map - running an install might help`);return fe.toPortablePath(c.packageLocation)}async findPackageLocator(e,r){if(!this.isEnabled(r))return nullLine truncated
`,n+=`# cause your node_modules installation to become invalidated.
`,n+=`
`,n+=`__metadata:
`,n+=` version: ${HBe}
`,n+=` nmMode: ${s.value}
`;let c=Array.from(e.keys()).sort(),f=G.stringifyLocator(t.topLevelWorkspace.anchoredLocator);for(let E of c){let C=e.get(E);n+=`
`,n+=`${JSON.stringify(E)}:
`,n+=` locations:
`;for(let S of C.locations){let P=J.contains(t.cwd,S);if(P===null)throw new Error(`Assertion failed: Expected the path to be within the project (${S})`);n+=` - ${JSON.stringify(P)}
`}if(C.aliases.length>0){n+=` aliases:
`;for(let S of C.aliases)n+=` - ${JSON.stringify(S)}
`}if(E===f&&r.size>0){n+=` bin:
`;for(let[S,P]of r){let I=J.contains(t.cwd,S);if(I===null)throw new Error(`Assertion failed: Expected the path to be within the project (${S})`);n+=` ${JSON.stringify(I)}:
`;for(let[R,N]of P){let U=J.relative(J.join(S,Ti),N);n+=` ${JSON.stringify(R)}: ${JSON.stringify(U)}
`}}}}let p=t.cwd,h=J.join(p,Ti,jBe);a&&await ce.removePromise(h),await ce.changeFilePromise(h,n,{automaticNewlines:!0})}async function PY(t,{unrollAliases:e=!1}={}){let r=t.cwd,s=J.join(r,Ti,jBe),a;try{a=await ce.statPromise(s)}catch{}if(!a)return null;let n=ls(await ce.readFilePromise(s,"utf8"));if(n.__metadata.version>HBe)return null;let c=n.__metadata.nmMode||"classic",f=new Map,p=new Map;delete n.__metadata;for(let[h,E]of Object.entries(n)){let C=E.locations.map(P=>J.join(r,P)),S=E.bin;if(S)for(let[P,I]of Object.entries(S)){let R=J.join(r,fe.toPortablePath(P)),N=je.getMapWithDefault(p,R);for(let[U,W]of Object.entries(I))N.set(U,fe.toPortablePath([R,Ti,W].join(J.sep)))}if(f.set(h,{target:vt.dot,linkType:"HARD",locations:C,aliases:E.aliases||[]}),e&&E.aliases)for(let P of E.aliases){let{scope:I,name:R}=G.parseLocator(h),N=G.makeLocator(G.makeIdent(I,R),P),U=G.stringifyLocator(N);f.set(U,{target:vt.dot,linkType:"HARD",locations:C,aliases:[]})}}return{locatorMap:f,binSymlinks:p,locationTree:GBe(f,{skipPrefix:t.cwd}),nmMode:c,mtimeMs:a.mtimeMs}}var bw=async(t,e)=>{if(t.split(J.sep).indexOf(Ti)<0)throw new Error(`Assertion failed: trying to remove dir that doesn't contain node_modules: ${t}`);try{let r;if(!e.innerLoop&&(r=await ce.lstatPromise(t),!r.isDirectory()&&!r.isSymbolicLink()||r.isSymbolicLink()&&!e.isWorkspaceDir)){await ce.unlinkPromise(t);return}let s=await ce.readdirPromise(t,{withFileTypes:!0});for(let n of s){let c=J.join(t,n.name);n.isDirectory()?(n.name!==Ti||e&&e.innerLoop)&&await bw(c,{innerLoop:!0,contentsOnly:!1}):await ce.unlinkPromise(c)}let a=!e.innerLoop&&e.isWorkspaceDir&&r?.isSymbolicLink();!e.contentsOnly&&!a&&await ce.rmdirPromise(t)}catch(r){if(r.code!=="ENOENT"&&r.code!=="ENOTEMPTY")throw r}},LBe=4,lN=(t,{skipPrefix:e})=>{let r=J.contains(e,t);if(r===null)throw new Error(`Assertion failed: Writing attempt prevented to ${t} which is outside project root: ${e}`);let s=r.split(J.sep).filter(p=>p!==""),a=s.indexOf(Ti),n=s.slice(0,a).join(J.sep),c=J.join(e,n),f=s.slice(a);return{locationRoot:c,segments:f}},GBe=(t,{skipPrefix:e})=>{let r=new Map;if(t===null)return r;let s=()=>({children:new Map,linkType:"HARD"});for(let[a,n]of t.entries()){if(n.linkType==="SOFT"&&J.contains(e,n.target)!==null){let f=je.getFactoryWithDefault(r,n.target,s);f.locator=a,f.linkType=n.linkType}for(let c of n.locations){let{locationRoot:f,segments:p}=lN(c,{skipPrefix:e}),h=je.getFactoryWithDefault(r,f,s);for(let E=0;E<p.length;++E){let C=p[E];if(C!=="."){let S=je.getFactoryWithDefault(h.children,C,s);h.children.set(C,S),h=S}E===p.length-1&&(h.locator=a,h.linkType=n.linkType)}}}return r},QY=async(t,e,r)=>{if(process.platform==="win32"&&r==="junctions"){let s;try{s=await ce.lstatPromise(t)}catch{}if(!s||s.isDirectory()){await ce.symlinkPromise(t,e,"junction");return}}await ce.symlinkPromise(J.relative(J.dirname(e),t),e)};async function qBe(t,e,r){let s=J.join(t,`${xY.default.randomBytes(16).toString("hex")}.tmp`);try{await ce.writeFilePromise(s,r);try{await ce.linkPromise(s,e)}catch{}}finally{await ce.unlinkPromise(s)}}async function Hdt({srcPath:t,dstPath:e,entry:r,globalHardlinksStore:s,baseFs:a,nmMode:n}){if(r.kind==="file"){if(n.value==="hardlinks-global"&&s&&r.digest){let f=J.join(s,r.digest.substring(0,2),`${r.digest.substring(2)}.dat`),p;try{let h=await ce.statPromise(f);if(h&&(!r.mtimeMs||h.mtimeMs>r.mtimeMs||h.mtimeMs<r.mtimeMs-Mdt))if(await Nn.checksumFile(f,{baseFs:ce,algorithm:"sha1"})!==r.digest){let C=J.join(s,`${xY.default.randomBytes(16).toString("hex")}.tmp`);await ce.renamePromise(f,C);let S=await a.readFilePromise(t);await ce.writeFilePromise(C,S);try{await ce.linkPromise(C,f),r.mtimeMs=new Date().getTime(),await ce.unlinkPromise(C)}catch{}}else r.mtimeMs||(r.mtimeMs=Math.ceil(h.mtimeMs));await ce.linkPromise(f,e),p=!0}catch{p=!1}if(!p){let h=await a.readFilePromise(t);await qBe(s,f,h),r.mtimeMs=new Date().getTime();try{await ce.linkPromise(f,e)}catch(E){E&&E.code&&E.code=="EXDEV"&&(n.value="hardlinks-local",await a.copyFilePromise(t,e))}}}else await a.copyFilePromise(t,e);let c=r.mode&511;c!==420&&await ce.chmodPromise(e,c)}}var jdt=async(t,e,{baseFs:r,globalHardlinksStore:s,nmMode:a,windowsLinkType:n,packageChecksum:c})=>{await ce.mkdirPromise(t,{recursive:!0});let f=async(E=vt.dot)=>{let C=J.join(e,E),S=await r.readdirPromise(C,{withFileTypes:!0}),P=new Map;for(let I of S){let R=J.join(E,I.name),N,U=J.join(C,I.name);if(I.isFile()){if(N={kind:"file",mode:(await r.lstatPromise(U)).mode},a.value==="hardlinks-global"){let W=await Nn.checksumFile(U,{baseFs:r,algorithm:"sha1"});N.digest=W}}else if(I.isDirectory())N={kind:"directory"};else if(I.isSymbolicLink())N={kind:"symlink",symlinkTo:await r.readlinkPromise(U)};else throw new Error(`Unsupported file type (file: ${U}, mode: 0o${await r.statSync(U).mode.toString(8).padStart(6,"0")})`);if(P.set(R,N),I.isDirectory()&&R!==Ti){let W=await f(R);for(let[ee,ie]of W)P.set(ee,ie)}}return P},p;if(a.value==="hardlinks-global"&&s&&c){let E=J.join(s,c.sub Line truncated
`)),process.env.YARN_IS_TEST_ENV)return process.env.YARN_INJECT_NPM_2FA_TOKEN||"";let{otp:s}=await(0,LY.prompt)({type:"password",name:"otp",message:"One-time password:",required:!0,onCancel:()=>process.exit(130)});return process.stdout.write(`
`),s}function uN(t){if(t.originalError?.name!=="HTTPError")return!1;try{return(t.originalError?.response.headers["www-authenticate"].split(/,\s*/).map(r=>r.toLowerCase())).includes("otp")}catch{return!1}}function kw(t){return{"npm-otp":t}}async function gmt(t,{configuration:e,ident:r}){let s=null;if(process.env.GITLAB_CI)s=process.env.NPM_ID_TOKEN||null;else if(process.env.GITHUB_ACTIONS){if(!(process.env.ACTIONS_ID_TOKEN_REQUEST_URL&&process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN))return null;let a=`npm:${new URL(t).host.replace("registry.yarnpkg.com","registry.npmjs.org").replace("yarn.npmjs.org","registry.npmjs.org")}`,n=new URL(process.env.ACTIONS_ID_TOKEN_REQUEST_URL);n.searchParams.append("audience",a),s=(await nn.get(n.href,{configuration:e,jsonResponse:!0,headers:{Authorization:`Bearer ${process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN}`}})).value}if(!s)return null;try{return(await nn.post(`${t}/-/npm/v1/oidc/token/exchange/package${WD(r)}`,null,{configuration:e,jsonResponse:!0,headers:{Authorization:`Bearer ${s}`}})).token||null}catch{}return null}var VD=class{supports(e,r){if(!e.reference.startsWith(oi))return!1;let{selector:s,params:a}=G.parseRange(e.reference);return!(!$Be.default.valid(s)||a===null||typeof a.__archiveUrl!="string")}getLocalPath(e,r){return null}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,c]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote server`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),checksum:c}}async fetchFromNetwork(e,r){let{params:s}=G.parseRange(e.reference);if(s===null||typeof s.__archiveUrl!="string")throw new Error("Assertion failed: The archiveUrl querystring parameter should have been available");let a=await Wm(s.__archiveUrl,{customErrorMessage:qm,configuration:r.project.configuration,ident:e});return await ps.convertToZip(a,{configuration:r.project.configuration,prefixPath:G.getIdentVendorPath(e),stripComponents:1})}};Ge();var JD=class{supportsDescriptor(e,r){return!(!e.range.startsWith(oi)||!G.tryParseDescriptor(e.range.slice(oi.length),!0))}supportsLocator(e,r){return!1}shouldPersistResolution(e,r){throw new Error("Unreachable")}bindDescriptor(e,r,s){return e}getResolutionDependencies(e,r){let s=r.project.configuration.normalizeDependency(G.parseDescriptor(e.range.slice(oi.length),!0));return r.resolver.getResolutionDependencies(s,r)}async getCandidates(e,r,s){let a=s.project.configuration.normalizeDependency(G.parseDescriptor(e.range.slice(oi.length),!0));return await s.resolver.getCandidates(a,r,s)}async getSatisfying(e,r,s,a){let n=a.project.configuration.normalizeDependency(G.parseDescriptor(e.range.slice(oi.length),!0));return a.resolver.getSatisfying(n,r,s,a)}resolve(e,r){throw new Error("Unreachable")}};Ge();Ge();var eve=ut(Ai());var oh=class t{supports(e,r){if(!e.reference.startsWith(oi))return!1;let s=new URL(e.reference);return!(!eve.default.valid(s.pathname)||s.searchParams.has("__archiveUrl"))}getLocalPath(e,r){return null}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,c]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote registry`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),checksum:c}}async fetchFromNetwork(e,r){let s;try{s=await Wm(t.getLocatorUrl(e),{customErrorMessage:qm,configuration:r.project.configuration,ident:e})}catch{s=await Wm(t.getLocatorUrl(e).replace(/%2f/g,"/"),{customErrorMessage:qm,configuration:r.project.configuration,ident:e})}return await ps.convertToZip(s,{configuration:r.project.configuration,prefixPath:G.getIdentVendorPath(e),stripComponents:1})}static isConventionalTarballUrl(e,r,{configuration:s}){let a=Pw(e.scope,{configuration:s}),n=t.getLocatorUrl(e);return r=r.replace(/^https?:(\/\/(?:[^/]+\.)?npmjs.org(?:$|\/))/,"https:$1"),a=a.replace(/^https:\/\/registry\.npmjs\.org($|\/)/,"https://registry.yarnpkg.com$1"),r=r.replace(/^https:\/\/registry\.npmjs\.org($|\/)/,"https://registry.yarnpkg.com$1"),r===a+n||r===a+n.replace(/%2f/g,"/")}static getLocatorUrl(e){let r=Fr.clean(e.reference.slice(oi.length));if(r===null)throw new jt(10,"The npm semver resolver got selected, but the version isn't semver");return`${WD(e)}/-/${e.name}-${r}.tgz`}};Ge();Ge();Ge();var UY=ut(Ai());var fN=G.makeIdent(null,"node-gyp"),dmt=/\b(node-gyp|prebuild-install)\b/,KD=class{supportsDescriptor(e,r){return e.range.startsWith(oi)?!!Fr.validRange(e.range.slice(oi.length)):!1}supportsLocator(e,r){if(!e.reference.startsWith(oi))return!1;let{selector:s}=G.parseRange(e.reference);return!!UY.default.valid(s)}shouldPersiLine truncated
https://docs.gitlab.com/ee/ci/secrets/id_token_authentication.html`);r={_type:ZDt,subject:t,predicateType:ebt,predicate:{buildType:`${ibt}/${sbt}`,builder:{id:`${Bt.CI_PROJECT_URL}/-/runners/${Bt.CI_RUNNER_ID}`},invocation:{configSource:{uri:`git+${Bt.CI_PROJECT_URL}`,digest:{sha1:Bt.CI_COMMIT_SHA},entryPoint:Bt.CI_JOB_NAME},parameters:{CI:Bt.CI,CI_API_GRAPHQL_URL:Bt.CI_API_GRAPHQL_URL,CI_API_V4_URL:Bt.CI_API_V4_URL,CI_BUILD_BEFORE_SHA:Bt.CI_BUILD_BEFORE_SHA,CI_BUILD_ID:Bt.CI_BUILD_ID,CI_BUILD_NAME:Bt.CI_BUILD_NAME,CI_BUILD_REF:Bt.CI_BUILD_REF,CI_BUILD_REF_NAME:Bt.CI_BUILD_REF_NAME,CI_BUILD_REF_SLUG:Bt.CI_BUILD_REF_SLUG,CI_BUILD_STAGE:Bt.CI_BUILD_STAGE,CI_COMMIT_BEFORE_SHA:Bt.CI_COMMIT_BEFORE_SHA,CI_COMMIT_BRANCH:Bt.CI_COMMIT_BRANCH,CI_COMMIT_REF_NAME:Bt.CI_COMMIT_REF_NAME,CI_COMMIT_REF_PROTECTED:Bt.CI_COMMIT_REF_PROTECTED,CI_COMMIT_REF_SLUG:Bt.CI_COMMIT_REF_SLUG,CI_COMMIT_SHA:Bt.CI_COMMIT_SHA,CI_COMMIT_SHORT_SHA:Bt.CI_COMMIT_SHORT_SHA,CI_COMMIT_TIMESTAMP:Bt.CI_COMMIT_TIMESTAMP,CI_COMMIT_TITLE:Bt.CI_COMMIT_TITLE,CI_CONFIG_PATH:Bt.CI_CONFIG_PATH,CI_DEFAULT_BRANCH:Bt.CI_DEFAULT_BRANCH,CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX:Bt.CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX,CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX:Bt.CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX,CI_DEPENDENCY_PROXY_SERVER:Bt.CI_DEPENDENCY_PROXY_SERVER,CI_DEPENDENCY_PROXY_USER:Bt.CI_DEPENDENCY_PROXY_USER,CI_JOB_ID:Bt.CI_JOB_ID,CI_JOB_NAME:Bt.CI_JOB_NAME,CI_JOB_NAME_SLUG:Bt.CI_JOB_NAME_SLUG,CI_JOB_STAGE:Bt.CI_JOB_STAGE,CI_JOB_STARTED_AT:Bt.CI_JOB_STARTED_AT,CI_JOB_URL:Bt.CI_JOB_URL,CI_NODE_TOTAL:Bt.CI_NODE_TOTAL,CI_PAGES_DOMAIN:Bt.CI_PAGES_DOMAIN,CI_PAGES_URL:Bt.CI_PAGES_URL,CI_PIPELINE_CREATED_AT:Bt.CI_PIPELINE_CREATED_AT,CI_PIPELINE_ID:Bt.CI_PIPELINE_ID,CI_PIPELINE_IID:Bt.CI_PIPELINE_IID,CI_PIPELINE_SOURCE:Bt.CI_PIPELINE_SOURCE,CI_PIPELINE_URL:Bt.CI_PIPELINE_URL,CI_PROJECT_CLASSIFICATION_LABEL:Bt.CI_PROJECT_CLASSIFICATION_LABEL,CI_PROJECT_DESCRIPTION:Bt.CI_PROJECT_DESCRIPTION,CI_PROJECT_ID:Bt.CI_PROJECT_ID,CI_PROJECT_NAME:Bt.CI_PROJECT_NAME,CI_PROJECT_NAMESPACE:Bt.CI_PROJECT_NAMESPACE,CI_PROJECT_NAMESPACE_ID:Bt.CI_PROJECT_NAMESPACE_ID,CI_PROJECT_PATH:Bt.CI_PROJECT_PATH,CI_PROJECT_PATH_SLUG:Bt.CI_PROJECT_PATH_SLUG,CI_PROJECT_REPOSITORY_LANGUAGES:Bt.CI_PROJECT_REPOSITORY_LANGUAGES,CI_PROJECT_ROOT_NAMESPACE:Bt.CI_PROJECT_ROOT_NAMESPACE,CI_PROJECT_TITLE:Bt.CI_PROJECT_TITLE,CI_PROJECT_URL:Bt.CI_PROJECT_URL,CI_PROJECT_VISIBILITY:Bt.CI_PROJECT_VISIBILITY,CI_REGISTRY:Bt.CI_REGISTRY,CI_REGISTRY_IMAGE:Bt.CI_REGISTRY_IMAGE,CI_REGISTRY_USER:Bt.CI_REGISTRY_USER,CI_RUNNER_DESCRIPTION:Bt.CI_RUNNER_DESCRIPTION,CI_RUNNER_ID:Bt.CI_RUNNER_ID,CI_RUNNER_TAGS:Bt.CI_RUNNER_TAGS,CI_SERVER_HOST:Bt.CI_SERVER_HOST,CI_SERVER_NAME:Bt.CI_SERVER_NAME,CI_SERVER_PORT:Bt.CI_SERVER_PORT,CI_SERVER_PROTOCOL:Bt.CI_SERVER_PROTOCOL,CI_SERVER_REVISION:Bt.CI_SERVER_REVISION,CI_SERVER_SHELL_SSH_HOST:Bt.CI_SERVER_SHELL_SSH_HOST,CI_SERVER_SHELL_SSH_PORT:Bt.CI_SERVER_SHELL_SSH_PORT,CI_SERVER_URL:Bt.CI_SERVER_URL,CI_SERVER_VERSION:Bt.CI_SERVER_VERSION,CI_SERVER_VERSION_MAJOR:Bt.CI_SERVER_VERSION_MAJOR,CI_SERVER_VERSION_MINOR:Bt.CI_SERVER_VERSION_MINOR,CI_SERVER_VERSION_PATCH:Bt.CI_SERVER_VERSION_PATCH,CI_TEMPLATE_REGISTRY_HOST:Bt.CI_TEMPLATE_REGISTRY_HOST,GITLAB_CI:Bt.GITLAB_CI,GITLAB_FEATURES:Bt.GITLAB_FEATURES,GITLAB_USER_ID:Bt.GITLAB_USER_ID,GITLAB_USER_LOGIN:Bt.GITLAB_USER_LOGIN,RUNNER_GENERATE_ARTIFACTS_METADATA:Bt.RUNNER_GENERATE_ARTIFACTS_METADATA},environment:{name:Bt.CI_RUNNER_DESCRIPTION,architecture:Bt.CI_RUNNER_EXECUTABLE_ARCH,server:Bt.CI_SERVER_URL,project:Bt.CI_PROJECT_PATH,job:{id:Bt.CI_JOB_ID},pipeline:{id:Bt.CI_PIPELINE_ID,ref:Bt.CI_CONFIG_PATH}}},metadata:{buildInvocationId:`${Bt.CI_JOB_URL}`,completeness:{parameters:!0,environment:!0,materials:!1},reproducible:!1},materials:[{uri:`git+${Bt.CI_PROJECT_URL}`,digest:{sha1:Bt.CI_COMMIT_SHA}}]}}}else throw new jt(91,"Provenance generation is only supported in GitHub Actions and GitLab CI");return Hxe.attest(Buffer.from(JSON.stringify(r)),XDt,e)};async function obt(t,e,{access:r,tag:s,registry:a,gitHead:n,provenance:c}){let f=t.manifest.name,p=t.manifest.version,h=G.stringifyIdent(f),E=Gxe.default.fromData(e,{algorithms:["sha1","sha512"]}),C=r??qxe(t,f),S=await Wxe(t),P=await yA.genPackageManifest(t),I=`${h}-${p}.tgz`,R=new URL(`${Jc(a)}/${h}/-/${I}`),N={[I]:{content_type:"application/octet-stream",data:e.toString("base64"),length:e.length}};if(c){let U={name:`pkg:npm/${h.replace(/^@/,"%40")}@${p}`,digest:{sha512:E.sha512[0].hexDigest()}},W=await jxe([U]),ee=JSON.stringify(W);N[`${h}-${p}.sigstore`]={content_type:W.mediaType,data:ee,length:ee.length}}return{_id:h,_attachments:N,name:h,access:C,"dist-tags":{[s]:p},versions:{[p]:{...P,_id:`${h}@${p}`,name:h,version:p,gitHead:n,dist:{shasum:E.sha1[0].hexDigest(),integrity:E.sha512[0].toString(),tarball:R.toString()}}},readme:S}}async function abt(t){try{let{stdout:e}=await qr.execvp("git",["rev-parse","--revs-only","HEAD"],{cwd:t});return e.trim()===""?void 0:e.trim()}catch{return} Line truncated
`;try{a=await ce.readFilePromise(e,"utf8")}catch(n){if(n.code==="ENOENT")return a;throw n}return a}var RK={npmAlwaysAuth:{description:"URL of the selected npm registry (note: npm enterprise isn't supported)",type:"BOOLEAN",default:!1},npmAuthIdent:{description:"Authentication identity for the npm registry (_auth in npm and yarn v1)",type:"SECRET",default:null},npmAuthToken:{description:"Authentication token for the npm registry (_authToken in npm and yarn v1)",type:"SECRET",default:null}},Yxe={npmAuditRegistry:{description:"Registry to query for audit reports",type:"STRING",default:null},npmPublishRegistry:{description:"Registry to push packages to",type:"STRING",default:null},npmRegistryServer:{description:"URL of the selected npm registry (note: npm enterprise isn't supported)",type:"STRING",default:"https://registry.yarnpkg.com"}},lbt={npmMinimalAgeGate:{description:"Minimum age of a package version according to the publish date on the npm registry to be considered for installation",type:"DURATION",unit:"m",default:"0m"},npmPreapprovedPackages:{description:"Array of package descriptors or package name glob patterns to exclude from the minimum release age check",type:"STRING",isArray:!0,default:[]}},cbt={configuration:{...RK,...Yxe,...lbt,npmScopes:{description:"Settings per package scope",type:"MAP",valueDefinition:{description:"",type:"SHAPE",properties:{...RK,...Yxe}}},npmRegistries:{description:"Settings per registry",type:"MAP",normalizeKeys:Jc,valueDefinition:{description:"",type:"SHAPE",properties:{...RK}}}},fetchers:[VD,oh],resolvers:[JD,KD,zD]},ubt=cbt;var qK={};Vt(qK,{NpmAuditCommand:()=>D1,NpmInfoCommand:()=>b1,NpmLoginCommand:()=>P1,NpmLogoutCommand:()=>k1,NpmPublishCommand:()=>Q1,NpmTagAddCommand:()=>R1,NpmTagListCommand:()=>T1,NpmTagRemoveCommand:()=>F1,NpmWhoamiCommand:()=>N1,default:()=>wbt,npmAuditTypes:()=>zb,npmAuditUtils:()=>kL});Ge();Ge();Yt();var UK=ut(Go());Ul();var zb={};Vt(zb,{Environment:()=>Jb,Severity:()=>Kb});var Jb=(s=>(s.All="all",s.Production="production",s.Development="development",s))(Jb||{}),Kb=(n=>(n.Info="info",n.Low="low",n.Moderate="moderate",n.High="high",n.Critical="critical",n))(Kb||{});var kL={};Vt(kL,{allSeverities:()=>S1,getPackages:()=>MK,getReportTree:()=>OK,getSeverityInclusions:()=>NK,getTopLevelDependencies:()=>LK});Ge();var Vxe=ut(Ai());var S1=["info","low","moderate","high","critical"];function NK(t){if(typeof t>"u")return new Set(S1);let e=S1.indexOf(t),r=S1.slice(e);return new Set(r)}function OK(t){let e={},r={children:e};for(let[s,a]of je.sortMap(Object.entries(t),n=>n[0]))for(let n of je.sortMap(a,c=>`${c.id}`))e[`${s}/${n.id}`]={value:he.tuple(he.Type.IDENT,G.parseIdent(s)),children:{ID:typeof n.id<"u"&&{label:"ID",value:he.tuple(he.Type.ID,n.id)},Issue:{label:"Issue",value:he.tuple(he.Type.NO_HINT,n.title)},URL:typeof n.url<"u"&&{label:"URL",value:he.tuple(he.Type.URL,n.url)},Severity:{label:"Severity",value:he.tuple(he.Type.NO_HINT,n.severity)},"Vulnerable Versions":{label:"Vulnerable Versions",value:he.tuple(he.Type.RANGE,n.vulnerable_versions)},"Tree Versions":{label:"Tree Versions",children:[...n.versions].sort(Vxe.default.compare).map(c=>({value:he.tuple(he.Type.REFERENCE,c)}))},Dependents:{label:"Dependents",children:je.sortMap(n.dependents,c=>G.stringifyLocator(c)).map(c=>({value:he.tuple(he.Type.LOCATOR,c)}))}}};return r}function LK(t,e,{all:r,environment:s}){let a=[],n=r?t.workspaces:[e],c=["all","production"].includes(s),f=["all","development"].includes(s);for(let p of n)for(let h of p.anchoredPackage.dependencies.values())(p.manifest.devDependencies.has(h.identHash)?!f:!c)||a.push({workspace:p,dependency:h});return a}function MK(t,e,{recursive:r}){let s=new Map,a=new Set,n=[],c=(f,p)=>{let h=t.storedResolutions.get(p.descriptorHash);if(typeof h>"u")throw new Error("Assertion failed: The resolution should have been registered");if(!a.has(h))a.add(h);else return;let E=t.storedPackages.get(h);if(typeof E>"u")throw new Error("Assertion failed: The package should have been registered");if(G.ensureDevirtualizedLocator(E).reference.startsWith("npm:")&&E.version!==null){let S=G.stringifyIdent(E),P=je.getMapWithDefault(s,S);je.getArrayWithDefault(P,E.version).push(f)}if(r)for(let S of E.dependencies.values())n.push([E,S])};for(let{workspace:f,dependency:p}of e)n.push([f.anchoredLocator,p]);for(;n.length>0;){let[f,p]=n.shift();c(f,p)}return s}var D1=class extends ft{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Audit dependencies from all workspaces"});this.recursive=ge.Boolean("-R,--recursive",!1,{description:"Audit transitive dependencies as well"});this.environment=ge.String("--environment","all",{description:"Which environments to cover",validator:fo(Jb)});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.noDeprecations=ge.Boolean("--no-deprecations",!1,{description:"Don't warn about deprecated packages"});this.severity=ge.String("--severity","info",{description:"M Line truncated
This command checks for known security reports on the packages you use. The reports are by default extracted from the npm registry, and may or may not be relevant to your actual program (not all vulnerabilities affect all code paths).
For consistency with our other commands the default is to only check the direct dependencies for the active workspace. To extend this search to all workspaces, use \`-A,--all\`. To extend this search to both direct and transitive dependencies, use \`-R,--recursive\`.
Applying the \`--severity\` flag will limit the audit table to vulnerabilities of the corresponding severity and above. Valid values are ${S1.map(r=>`\`${r}\``).join(", ")}.
If the \`--json\` flag is set, Yarn will print the output exactly as received from the registry. Regardless of this flag, the process will exit with a non-zero exit code if a report is found for the selected packages.
If certain packages produce false positives for a particular environment, the \`--exclude\` flag can be used to exclude any number of packages from the audit. This can also be set in the configuration file with the \`npmAuditExcludePackages\` option.
If particular advisories are needed to be ignored, the \`--ignore\` flag can be used with Advisory ID's to ignore any number of advisories in the audit report. This can also be set in the configuration file with the \`npmAuditIgnoreAdvisories\` option.
To understand the dependency tree requiring vulnerable packages, check the raw report with the \`--json\` flag or use \`yarn why package\` to get more information as to who depends on them.
`,examples:[["Checks for known security issues with the installed packages. The output is a list of known issues.","yarn npm audit"],["Audit dependencies in all workspaces","yarn npm audit --all"],["Limit auditing to `dependencies` (excludes `devDependencies`)","yarn npm audit --environment production"],["Show audit report as valid JSON","yarn npm audit --json"],["Audit all direct and transitive dependencies","yarn npm audit --recursive"],["Output moderate (or more severe) vulnerabilities","yarn npm audit --severity moderate"],["Exclude certain packages","yarn npm audit --exclude package1 --exclude package2"],["Ignore specific advisories","yarn npm audit --ignore 1234567 --ignore 7654321"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState();let n=LK(s,a,{all:this.all,environment:this.environment}),c=MK(s,n,{recursive:this.recursive}),f=Array.from(new Set([...r.get("npmAuditExcludePackages"),...this.excludes])),p=Object.create(null);for(let[N,U]of c)f.some(W=>UK.default.isMatch(N,W))||(p[N]=[...U.keys()]);let h=hi.getAuditRegistry({configuration:r}),E,C=await lA.start({configuration:r,stdout:this.context.stdout},async()=>{let N=en.post("/-/npm/v1/security/advisories/bulk",p,{authType:en.AuthType.BEST_EFFORT,configuration:r,jsonResponse:!0,registry:h}),U=this.noDeprecations?[]:await Promise.all(Array.from(Object.entries(p),async([ee,ie])=>{let ue=await en.getPackageMetadata(G.parseIdent(ee),{project:s});return je.mapAndFilter(ie,le=>{let{deprecated:me}=ue.versions[le];return me?[ee,le,me]:je.mapAndFilter.skip})})),W=await N;for(let[ee,ie,ue]of U.flat(1))Object.hasOwn(W,ee)&&W[ee].some(le=>Fr.satisfiesWithPrereleases(ie,le.vulnerable_versions))||(W[ee]??=[],W[ee].push({id:`${ee} (deprecation)`,title:(typeof ue=="string"?ue:"").trim()||"This package has been deprecated.",severity:"moderate",vulnerable_versions:ie}));E=W});if(C.hasErrors())return C.exitCode();let S=NK(this.severity),P=Array.from(new Set([...r.get("npmAuditIgnoreAdvisories"),...this.ignores])),I=Object.create(null);for(let[N,U]of Object.entries(E)){let W=U.filter(ee=>!UK.default.isMatch(`${ee.id}`,P)&&S.has(ee.severity));W.length>0&&(I[N]=W.map(ee=>{let ie=c.get(N);if(typeof ie>"u")throw new Error("Assertion failed: Expected the registry to only return packages that were requested");let ue=[...ie.keys()].filter(me=>Fr.satisfiesWithPrereleases(me,ee.vulnerable_versions)),le=new Map;for(let me of ue)for(let pe of ie.get(me))le.set(pe.locatorHash,pe);return{...ee,versions:ue,dependents:[...le.values()]}}))}let R=Object.keys(I).length>0;return R?(xs.emitTree(OK(I),{configuration:r,json:this.json,stdout:this.context.stdout,separators:2}),1):(await Ot.start({configuration:r,includeFooter:!1,json:this.json,stdout:this.context.stdout},async N=>{N.reportInfo(1,"No audit suggestions")}),R?1:0)}};Ge();Ge();Dt();Yt();var _K=ut(Ai()),HK=Ie("util"),b1=class extends ft{constructor(){super(...arguments);this.fields=ge.String("-f,--fields",{description:"A comma-separated list of manifest fields that should be displayed"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.packages=ge.Rest()}static{this.paths=[["npm","info"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"show information about a package",details:"\n This command fetches information about a package from the npm registry and prints it in a tree format.\n\n The package does not have to be installed locally, but needs to have been published (in particular, local changes will be ignored even for workspaces).\n\n Append `@<range>` to the package argument to provide information specific to the latest version that satisfies the range or to the corresponding tagged version. If the range is invalid or if there is no version satisfying the range, the command will print a warning and fall back to the latest version.\n\n If the `-f,--fields` option is set, it's a comma-separated list of fields which will be used to only display part of the package information.\n\n By default, this command won't return the `dist`, `readme`, and `users` fields, since they are often very long. To explicitly request those fields, explicitly list them with the `--fields` flag or request the output in JSON mode.\n ",examples:[["Show all available information about react (except the `dist`, `readme`, and `users` fields)","yarn npm info react"],["Show all available information about react as valid JSON (including the `dist`, `readme`, and `users` fields)","yarn npm info react --json"],["Show all available information about react@16.12.0","yarn npm info react@16.12.0"],["Show all available information about react@next","yarn npm info react@next"],["Show the description of react","yarn npm info react --fields description"],["Show all available versions of react","yarn npm info react Line truncated
`),this.context.stdout.write(`${(0,HK.inspect)(p,{depth:1/0,colors:!0,compact:!1})}
`);return f.exitCode()}};function jK(t){if(Array.isArray(t)){let e=[];for(let r of t)r=jK(r),r&&e.push(r);return e}else if(typeof t=="object"&&t!==null){let e={};for(let r of Object.keys(t)){if(r.startsWith("_"))continue;let s=jK(t[r]);s&&(e[r]=s)}return e}else return t||null}Ge();Ge();Yt();var GK=ut(Vv()),P1=class extends ft{constructor(){super(...arguments);this.scope=ge.String("-s,--scope",{description:"Login to the registry configured for a given scope"});this.publish=ge.Boolean("--publish",!1,{description:"Login to the publish registry"});this.alwaysAuth=ge.Boolean("--always-auth",{description:"Set the npmAlwaysAuth configuration"});this.webLogin=ge.Boolean("--web-login",{description:"Enable web login"})}static{this.paths=[["npm","login"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"store new login info to access the npm registry",details:"\n This command will ask you for your username, password, and 2FA One-Time-Password (when it applies). It will then modify your local configuration (in your home folder, never in the project itself) to reference the new tokens thus generated.\n\n Adding the `-s,--scope` flag will cause the authentication to be done against whatever registry is configured for the associated scope (see also `npmScopes`).\n\n Adding the `--publish` flag will cause the authentication to be done against the registry used when publishing the package (see also `publishConfig.registry` and `npmPublishRegistry`).\n ",examples:[["Login to the default registry","yarn npm login"],["Login to the registry linked to the @my-scope registry","yarn npm login --scope my-scope"],["Login to the publish registry for the current package","yarn npm login --publish"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s=await QL({configuration:r,cwd:this.context.cwd,publish:this.publish,scope:this.scope});return(await Ot.start({configuration:r,stdout:this.context.stdout,includeFooter:!1},async n=>{let c=await gbt({registry:s,configuration:r,report:n,webLogin:this.webLogin,stdin:this.context.stdin,stdout:this.context.stdout});return await mbt(s,c,{alwaysAuth:this.alwaysAuth,scope:this.scope}),n.reportInfo(0,"Successfully logged in")})).exitCode()}};async function QL({scope:t,publish:e,configuration:r,cwd:s}){return t&&e?hi.getScopeRegistry(t,{configuration:r,type:hi.RegistryType.PUBLISH_REGISTRY}):t?hi.getScopeRegistry(t,{configuration:r}):e?hi.getPublishRegistry((await eC(r,s)).manifest,{configuration:r}):hi.getDefaultRegistry({configuration:r})}async function fbt(t,e){let r;try{r=await en.post("/-/v1/login",null,{configuration:e,registry:t,authType:en.AuthType.NO_AUTH,jsonResponse:!0,headers:{"npm-auth-type":"web"}})}catch{return null}return r}async function Abt(t,e){let r=await nn.request(t,null,{configuration:e,jsonResponse:!0});if(r.statusCode===202){let s=r.headers["retry-after"]??"1";return{type:"waiting",sleep:parseInt(s,10)}}return r.statusCode===200?{type:"success",token:r.body.token}:null}async function pbt({registry:t,configuration:e,report:r}){let s=await fbt(t,e);if(!s)return null;if(Ui.openUrl){r.reportInfo(0,"Starting the web login process..."),r.reportSeparator();let{openNow:a}=await(0,GK.prompt)({type:"confirm",name:"openNow",message:"Do you want to try to open your browser now?",required:!0,initial:!0,onCancel:()=>process.exit(130)});r.reportSeparator(),(!a||!await Ui.openUrl(s.loginUrl))&&(r.reportWarning(0,"We failed to automatically open the url; you'll have to open it yourself in your browser of choice:"),r.reportWarning(0,he.pretty(e,s.loginUrl,he.Type.URL)),r.reportSeparator())}for(;;){let a=await Abt(s.doneUrl,e);if(a===null)return null;if(a.type==="waiting")await new Promise(n=>setTimeout(n,a.sleep*1e3));else return a.token}}var hbt=["https://registry.yarnpkg.com","https://registry.npmjs.org"];async function gbt(t){if(t.webLogin??hbt.includes(t.registry)){let e=await pbt(t);if(e!==null)return e}return await dbt(t)}async function dbt({registry:t,configuration:e,report:r,stdin:s,stdout:a}){let n=await ybt({configuration:e,registry:t,report:r,stdin:s,stdout:a}),c=`/-/user/org.couchdb.user:${encodeURIComponent(n.name)}`,f={_id:`org.couchdb.user:${n.name}`,name:n.name,password:n.password,type:"user",roles:[],date:new Date().toISOString()},p={attemptedAs:n.name,configuration:e,registry:t,jsonResponse:!0,authType:en.AuthType.NO_AUTH};try{return(await en.put(c,f,p)).token}catch(P){if(!(P.originalError?.name==="HTTPError"&&P.originalError?.response.statusCode===409))throw P}let h={...p,authType:en.AuthType.NO_AUTH,headers:{authorization:`Basic ${Buffer.from(`${n.name}:${n.password}`).toString("base64")}`}},E=await en.get(c,h);for(let[P,I]of Object.entries(E))(!f[P]||P==="roles")&&(f[P]=I);let C=`${c}/-rev/${f._rev}`;return(await en.put(C,f,h)).token}async function mbt(t,e,{alwaysAuth:r,scope:s}){let a=c=>f=>{let p=je.isIndexableObject(f)?f:{},h=p[c],E=je.isIndexableObject(h)?h:{};return{...p,[c]:{...E,...r!==void 0?{npLine truncated
This command will list all tags of a package from the npm registry.
If the package is not specified, Yarn will default to the current workspace.
`,examples:[["List all tags of package `my-pkg`","yarn npm tag list my-pkg"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n;if(typeof this.package<"u")n=G.parseIdent(this.package);else{if(!a)throw new ar(s.cwd,this.context.cwd);if(!a.manifest.name)throw new nt(`Missing 'name' field in ${fe.fromPortablePath(J.join(a.cwd,Er.manifest))}`);n=a.manifest.name}let c=await Xb(n,r),p={children:je.sortMap(Object.entries(c),([h])=>h).map(([h,E])=>({value:he.tuple(he.Type.RESOLUTION,{descriptor:G.makeDescriptor(n,h),locator:G.makeLocator(n,E)})}))};return xs.emitTree(p,{configuration:r,json:this.json,stdout:this.context.stdout})}};async function Xb(t,e){let r=`/-/package${en.getIdentUrl(t)}/dist-tags`;return en.get(r,{configuration:e,ident:t,jsonResponse:!0,customErrorMessage:en.customPackageError})}var R1=class extends ft{constructor(){super(...arguments);this.package=ge.String();this.tag=ge.String()}static{this.paths=[["npm","tag","add"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"add a tag for a specific version of a package",details:`
This command will add a tag to the npm registry for a specific version of a package. If the tag already exists, it will be overwritten.
`,examples:[["Add a `beta` tag for version `2.3.4-beta.4` of package `my-pkg`","yarn npm tag add my-pkg@2.3.4-beta.4 beta"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);let n=G.parseDescriptor(this.package,!0),c=n.range;if(!Kxe.default.valid(c))throw new nt(`The range ${he.pretty(r,n.range,he.Type.RANGE)} must be a valid semver version`);let f=hi.getPublishRegistry(a.manifest,{configuration:r}),p=he.pretty(r,n,he.Type.IDENT),h=he.pretty(r,c,he.Type.RANGE),E=he.pretty(r,this.tag,he.Type.CODE);return(await Ot.start({configuration:r,stdout:this.context.stdout},async S=>{let P=await Xb(n,r);Object.hasOwn(P,this.tag)&&P[this.tag]===c&&S.reportWarning(0,`Tag ${E} is already set to version ${h}`);let I=`/-/package${en.getIdentUrl(n)}/dist-tags/${encodeURIComponent(this.tag)}`;await en.put(I,c,{configuration:r,registry:f,ident:n,jsonRequest:!0,jsonResponse:!0}),S.reportInfo(0,`Tag ${E} added to version ${h} of package ${p}`)})).exitCode()}};Ge();Yt();var F1=class extends ft{constructor(){super(...arguments);this.package=ge.String();this.tag=ge.String()}static{this.paths=[["npm","tag","remove"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"remove a tag from a package",details:`
This command will remove a tag from a package from the npm registry.
`,examples:[["Remove the `beta` tag from package `my-pkg`","yarn npm tag remove my-pkg beta"]]})}async execute(){if(this.tag==="latest")throw new nt("The 'latest' tag cannot be removed.");let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);let n=G.parseIdent(this.package),c=hi.getPublishRegistry(a.manifest,{configuration:r}),f=he.pretty(r,this.tag,he.Type.CODE),p=he.pretty(r,n,he.Type.IDENT),h=await Xb(n,r);if(!Object.hasOwn(h,this.tag))throw new nt(`${f} is not a tag of package ${p}`);return(await Ot.start({configuration:r,stdout:this.context.stdout},async C=>{let S=`/-/package${en.getIdentUrl(n)}/dist-tags/${encodeURIComponent(this.tag)}`;await en.del(S,{configuration:r,registry:c,ident:n,jsonResponse:!0}),C.reportInfo(0,`Tag ${f} removed from package ${p}`)})).exitCode()}};Ge();Ge();Yt();var N1=class extends ft{constructor(){super(...arguments);this.scope=ge.String("-s,--scope",{description:"Print username for the registry configured for a given scope"});this.publish=ge.Boolean("--publish",!1,{description:"Print username for the publish registry"})}static{this.paths=[["npm","whoami"]]}static{this.usage=ot.Usage({category:"Npm-related commands",description:"display the name of the authenticated user",details:"\n Print the username associated with the current authentication settings to the standard output.\n\n When using `-s,--scope`, the username printed will be the one that matches the authentication settings of the registry associated with the given scope (those settings can be overriden using the `npmRegistries` map, and the registry associated with the scope is configured via the `npmScopes` map).\n\n When using `--publish`, the registry we'll select will by default be the one used when publishing packages (`publishConfig.registry` or `npmPublishRegistry` if available, otherwise we'll fallback to the regular `npmRegistryServer`).\n ",examples:[["Print username for the default registry","yarn npm whoami"],["Print username for the registry on a given scope","yarn npm whoami --scope company"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),s;return this.scope&&this.publish?s=hi.getScopeRegistry(this.scope,{configuration:r,type:hi.RegistryType.PUBLISH_REGISTRY}):this.scope?s=hi.getScopeRegistry(this.scope,{configuration:r}):this.publish?s=hi.getPublishRegistry((await eC(r,this.context.cwd)).manifest,{configuration:r}):s=hi.getDefaultRegistry({configuration:r}),(await Ot.start({configuration:r,stdout:this.context.stdout},async n=>{let c;try{c=await en.get("/-/whoami",{configuration:r,registry:s,authType:en.AuthType.ALWAYS_AUTH,jsonResponse:!0,ident:this.scope?G.makeIdent(this.scope,""):void 0})}catch(f){if(f.response?.statusCode===401||f.response?.statusCode===403){n.reportError(41,"Authentication failed - your credentials may have expired");return}else throw f}n.reportInfo(0,c.username)})).exitCode()}};var Cbt={configuration:{npmPublishAccess:{description:"Default access of the published packages",type:"STRING",default:null},npmPublishProvenance:{description:"Whether to generate provenance for the published packages",type:"BOOLEAN",default:!1},npmAuditExcludePackages:{description:"Array of glob patterns of packages to exclude from npm audit",type:"STRING",default:[],isArray:!0},npmAuditIgnoreAdvisories:{description:"Array of glob patterns of advisory IDs to exclude from npm audit",type:"STRING",default:[],isArray:!0}},commands:[D1,b1,P1,k1,Q1,R1,T1,F1,N1]},wbt=Cbt;var XK={};Vt(XK,{PatchCommand:()=>H1,PatchCommitCommand:()=>_1,PatchFetcher:()=>rP,PatchResolver:()=>nP,default:()=>_bt,patchUtils:()=>gy});Ge();Ge();Dt();eA();var gy={};Vt(gy,{applyPatchFile:()=>RL,diffFolders:()=>KK,ensureUnpatchedDescriptor:()=>WK,ensureUnpatchedLocator:()=>NL,extractPackageToDisk:()=>JK,extractPatchFlags:()=>rke,isParentRequired:()=>VK,isPatchDescriptor:()=>FL,isPatchLocator:()=>Rg,loadPatchFiles:()=>tP,makeDescriptor:()=>OL,makeLocator:()=>YK,makePatchHash:()=>zK,parseDescriptor:()=>$b,parseLocator:()=>eP,parsePatchFile:()=>Zb,unpatchDescriptor:()=>Lbt,unpatchLocator:()=>Mbt});Ge();Dt();Ge();Dt();var Bbt=/^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@.*/;function O1(t){return J.relative(vt.root,J.resolve(vt.root,fe.toPortablePath(t)))}function vbt(t){let e=t.trim().match(Bbt);if(!e)throw new Error(`Bad header line: '${t}'`);return{original:{start:Math.max(Number(e[1]),1),length:Number(e[3]||1)},patched:{start:Math.max(Number(e[4]),1),length:Number(e[6]||1)}}}var Sbt=420,Dbt=493;var zxe=()=>({semverExclusivity:null,diffLineFromPath:null,diffLineToPath:null,oldMode:null,newMode:null,deletedFileMode:null,newFileMode:null,renameFrom:null,renameTo:null,beforeHash:null,afterHash:null,fromPath:null,toPath:null,hunks:null}),bbt=t=>({header:vbt(t),parts:[]}),Pbt={"@":"header","-":"deletion","+":"insertion"," ":"context","\\":"pragma",undefined:"context"};function xbt(t){let e=[],r=Line truncated
`)+(a.hunk.parts[0].noNewlineAtEndOfFile?"":`
`):"";await e.mkdirpPromise(J.dirname(a.path),{chmod:493,utimes:[fi.SAFE_TIME,fi.SAFE_TIME]}),await e.writeFilePromise(a.path,n,{mode:a.mode}),await e.utimesPromise(a.path,fi.SAFE_TIME,fi.SAFE_TIME)}break;case"patch":await M1(e,a.path,async()=>{await Fbt(a,{baseFs:e,dryRun:r})});break;case"mode change":{let c=(await e.statPromise(a.path)).mode;if(Xxe(a.newMode)!==Xxe(c))continue;await M1(e,a.path,async()=>{await e.chmodPromise(a.path,a.newMode)})}break;default:je.assertNever(a);break}}function Xxe(t){return(t&64)>0}function Zxe(t){return t.replace(/\s+$/,"")}function Rbt(t,e){return Zxe(t)===Zxe(e)}async function Fbt({hunks:t,path:e},{baseFs:r,dryRun:s=!1}){let a=await r.statSync(e).mode,c=(await r.readFileSync(e,"utf8")).split(/\n/),f=[],p=0,h=0;for(let C of t){let S=Math.max(h,C.header.patched.start+p),P=Math.max(0,S-h),I=Math.max(0,c.length-S-C.header.original.length),R=Math.max(P,I),N=0,U=0,W=null;for(;N<=R;){if(N<=P&&(U=S-N,W=$xe(C,c,U),W!==null)){N=-N;break}if(N<=I&&(U=S+N,W=$xe(C,c,U),W!==null))break;N+=1}if(W===null)throw new L1(t.indexOf(C),C);f.push(W),p+=N,h=U+C.header.original.length}if(s)return;let E=0;for(let C of f)for(let S of C)switch(S.type){case"splice":{let P=S.index+E;c.splice(P,S.numToDelete,...S.linesToInsert),E+=S.linesToInsert.length-S.numToDelete}break;case"pop":c.pop();break;case"push":c.push(S.line);break;default:je.assertNever(S);break}await r.writeFilePromise(e,c.join(`
`),{mode:a})}function $xe(t,e,r){let s=[];for(let a of t.parts)switch(a.type){case"context":case"deletion":{for(let n of a.lines){let c=e[r];if(c==null||!Rbt(c,n))return null;r+=1}a.type==="deletion"&&(s.push({type:"splice",index:r-a.lines.length,numToDelete:a.lines.length,linesToInsert:[]}),a.noNewlineAtEndOfFile&&s.push({type:"push",line:""}))}break;case"insertion":s.push({type:"splice",index:r,numToDelete:0,linesToInsert:a.lines}),a.noNewlineAtEndOfFile&&s.push({type:"pop"});break;default:je.assertNever(a.type);break}return s}var Obt=/^builtin<([^>]+)>$/;function U1(t,e){let{protocol:r,source:s,selector:a,params:n}=G.parseRange(t);if(r!=="patch:")throw new Error("Invalid patch range");if(s===null)throw new Error("Patch locators must explicitly define their source");let c=a?a.split(/&/).map(E=>fe.toPortablePath(E)):[],f=n&&typeof n.locator=="string"?G.parseLocator(n.locator):null,p=n&&typeof n.version=="string"?n.version:null,h=e(s);return{parentLocator:f,sourceItem:h,patchPaths:c,sourceVersion:p}}function FL(t){return t.range.startsWith("patch:")}function Rg(t){return t.reference.startsWith("patch:")}function $b(t){let{sourceItem:e,...r}=U1(t.range,G.parseDescriptor);return{...r,sourceDescriptor:e}}function eP(t){let{sourceItem:e,...r}=U1(t.reference,G.parseLocator);return{...r,sourceLocator:e}}function Lbt(t){let{sourceItem:e}=U1(t.range,G.parseDescriptor);return e}function Mbt(t){let{sourceItem:e}=U1(t.reference,G.parseLocator);return e}function WK(t){if(!FL(t))return t;let{sourceItem:e}=U1(t.range,G.parseDescriptor);return e}function NL(t){if(!Rg(t))return t;let{sourceItem:e}=U1(t.reference,G.parseLocator);return e}function eke({parentLocator:t,sourceItem:e,patchPaths:r,sourceVersion:s,patchHash:a},n){let c=t!==null?{locator:G.stringifyLocator(t)}:{},f=typeof s<"u"?{version:s}:{},p=typeof a<"u"?{hash:a}:{};return G.makeRange({protocol:"patch:",source:n(e),selector:r.join("&"),params:{...f,...p,...c}})}function OL(t,{parentLocator:e,sourceDescriptor:r,patchPaths:s}){return G.makeDescriptor(t,eke({parentLocator:e,sourceItem:r,patchPaths:s},G.stringifyDescriptor))}function YK(t,{parentLocator:e,sourcePackage:r,patchPaths:s,patchHash:a}){return G.makeLocator(t,eke({parentLocator:e,sourceItem:r,sourceVersion:r.version,patchPaths:s,patchHash:a},G.stringifyLocator))}function tke({onAbsolute:t,onRelative:e,onProject:r,onBuiltin:s},a){let n=a.lastIndexOf("!");n!==-1&&(a=a.slice(n+1));let c=a.match(Obt);return c!==null?s(c[1]):a.startsWith("~/")?r(a.slice(2)):J.isAbsolute(a)?t(a):e(a)}function rke(t){let e=t.lastIndexOf("!");return{optional:(e!==-1?new Set(t.slice(0,e).split(/!/)):new Set).has("optional")}}function VK(t){return tke({onAbsolute:()=>!1,onRelative:()=>!0,onProject:()=>!1,onBuiltin:()=>!1},t)}async function tP(t,e,r){let s=t!==null?await r.fetcher.fetch(t,r):null,a=s&&s.localPath?{packageFs:new Sn(vt.root),prefixPath:J.relative(vt.root,s.localPath)}:s;s&&s!==a&&s.releaseFs&&s.releaseFs();let n=await je.releaseAfterUseAsync(async()=>await Promise.all(e.map(async c=>{let f=rke(c),p=await tke({onAbsolute:async h=>await ce.readFilePromise(h,"utf8"),onRelative:async h=>{if(a===null)throw new Error("Assertion failed: The parent locator should have been fetched");return await a.packageFs.readFilePromise(J.join(a.prefixPath,h),"utf8")},onProject:async h=>await ce.readFilePromise(J.join(r.project.cwd,h),"utf8"),onBuiltin:async h=>await r.project.configuration.firstHook(E=>E.getBuiltinPatch,r.project,h)},c);return{...f,source:p}})));for(let c of n)typeof c.source=="string"&&(c.source=c.source.replace(/\r\n?/g,`
`));return n}async function JK(t,{cache:e,project:r}){let s=r.storedPackages.get(t.locatorHash);if(typeof s>"u")throw new Error("Assertion failed: Expected the package to be registered");let a=NL(t),n=r.storedChecksums,c=new ki,f=await ce.mktempPromise(),p=J.join(f,"source"),h=J.join(f,"user"),E=J.join(f,".yarn-patch.json"),C=r.configuration.makeFetcher(),S=[];try{let P,I;if(t.locatorHash===a.locatorHash){let R=await C.fetch(t,{cache:e,project:r,fetcher:C,checksums:n,report:c});S.push(()=>R.releaseFs?.()),P=R,I=R}else P=await C.fetch(t,{cache:e,project:r,fetcher:C,checksums:n,report:c}),S.push(()=>P.releaseFs?.()),I=await C.fetch(t,{cache:e,project:r,fetcher:C,checksums:n,report:c}),S.push(()=>I.releaseFs?.());await Promise.all([ce.copyPromise(p,P.prefixPath,{baseFs:P.packageFs}),ce.copyPromise(h,I.prefixPath,{baseFs:I.packageFs}),ce.writeJsonPromise(E,{locator:G.stringifyLocator(t),version:s.version})])}finally{for(let P of S)P()}return ce.detachTemp(f),h}async function KK(t,e){let r=fe.fromPortablePath(t).replace(/\\/g,"/"),s=fe.fromPortablePath(e).replace(/\\/g,"/"),{stdout:a,stderr:n}=await qr.execvp("git",["-c","core.safecrlf=false","diff","--src-prefix=a/","--dst-prefix=b/","--ignore-cr-at-eol","--full-index","--no-index","--no-renames","--text",r,s],{cwd:fe.toPortablePath(process.cwd()),env:{...process.env,GIT_CONFIG_NOSYSTEM:"1",HOME:"",XDG_CONFIG_HOME:"",USERPROFILE:""}});if(n.length>0)throw new Error(`Unable to diff directories. Make sure you have a recent version of 'git' available in PATH.
The following error was reported by 'git':
${n}`);let c=r.startsWith("/")?f=>f.slice(1):f=>f;return a.replace(new RegExp(`(a|b)(${je.escapeRegExp(`/${c(r)}/`)})`,"g"),"$1/").replace(new RegExp(`(a|b)${je.escapeRegExp(`/${c(s)}/`)}`,"g"),"$1/").replace(new RegExp(je.escapeRegExp(`${r}/`),"g"),"").replace(new RegExp(je.escapeRegExp(`${s}/`),"g"),"")}function zK(t,e){let r=[];for(let{source:s}of t){if(s===null)continue;let a=Zb(s);for(let n of a){let{semverExclusivity:c,...f}=n;c!==null&&e!==null&&!Fr.satisfiesWithPrereleases(e,c)||r.push(JSON.stringify(f))}}return Nn.makeHash(`${3}`,...r).slice(0,6)}Ge();function nke(t,{configuration:e,report:r}){for(let s of t.parts)for(let a of s.lines)switch(s.type){case"context":r.reportInfo(null,` ${he.pretty(e,a,"grey")}`);break;case"deletion":r.reportError(28,`- ${he.pretty(e,a,he.Type.REMOVED)}`);break;case"insertion":r.reportError(28,`+ ${he.pretty(e,a,he.Type.ADDED)}`);break;default:je.assertNever(s.type)}}var rP=class{supports(e,r){return!!Rg(e)}getLocalPath(e,r){return null}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,c]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.patchPackage(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:c}}async patchPackage(e,r){let{parentLocator:s,sourceLocator:a,sourceVersion:n,patchPaths:c}=eP(e),f=await tP(s,c,r),p=await ce.mktempPromise(),h=J.join(p,"current.zip"),E=await r.fetcher.fetch(a,r),C=G.getIdentVendorPath(e),S=new As(h,{create:!0,level:r.project.configuration.get("compressionLevel")});await je.releaseAfterUseAsync(async()=>{await S.copyPromise(C,E.prefixPath,{baseFs:E.packageFs,stableSort:!0})},E.releaseFs),S.saveAndClose();for(let{source:P,optional:I}of f){if(P===null)continue;let R=new As(h,{level:r.project.configuration.get("compressionLevel")}),N=new Sn(J.resolve(vt.root,C),{baseFs:R});try{await RL(Zb(P),{baseFs:N,version:n})}catch(U){if(!(U instanceof L1))throw U;let W=r.project.configuration.get("enableInlineHunks"),ee=!W&&!I?" (set enableInlineHunks for details)":"",ie=`${G.prettyLocator(r.project.configuration,e)}: ${U.message}${ee}`,ue=le=>{W&&nke(U.hunk,{configuration:r.project.configuration,report:le})};if(R.discardAndClose(),I){r.report.reportWarningOnce(66,ie,{reportExtra:ue});continue}else throw new jt(66,ie,ue)}R.saveAndClose()}return new As(h,{level:r.project.configuration.get("compressionLevel")})}};Ge();var nP=class{supportsDescriptor(e,r){return!!FL(e)}supportsLocator(e,r){return!!Rg(e)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,s){let{patchPaths:a}=$b(e);return a.every(n=>!VK(n))?e:G.bindDescriptor(e,{locator:G.stringifyLocator(r)})}getResolutionDependencies(e,r){let{sourceDescriptor:s}=$b(e);return{sourceDescriptor:r.project.configuration.normalizeDependency(s)}}async getCandidates(e,r,s){if(!s.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{parentLocator:a,patchPaths:n}=$b(e),c=await tP(a,n,s.fetchOptions),f=r.sourceDescriptor;if(typeof f>"u")throw new Error("Assertion failed: The dependency should have been resolved");let p=zK(c,f.version);return[YK(e,{parentLocator:a,sourcePackage:f,patchPaths:n,patchHash:p})]}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(c=>c.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){let{sourceLocator:s}=eP(e);return{...await r.resolver.resolve(s,r),...e}}};Ge();Dt();Yt();var _1=class extends ft{constructor(){super(...arguments);this.save=ge.Boolean("-s,--save",!1,{description:"Add the patch to your resolution entries"});this.patchFolder=ge.String()}static{this.paths=[["patch-commit"]]}static{this.usage=ot.Usage({description:"generate a patch out of a directory",details:"\n By default, this will print a patchfile on stdout based on the diff between the folder passed in and the original version of the package. Such file is suitable for consumption with the `patch:` protocol.\n\n With the `-s,--save` option set, the patchfile won't be printed on stdout anymore and will instead be stored within a local file (by default kept within `.yarn/patches`, but configurable via the `patchFolder` setting). A `resolutions` entry will also be added to your top-level manifest, referencing the patched package via the `patch:` protocol.\n\n Note that only folders generated by `yarn patch` are accepted as valid input for `yarn patch-commit`.\n "})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState();let n=J.resolve(this.context.cwd,fe.toPortablePath(this.patchFolder)),c=J.join(n,"../source"),f=J.join(n,"../.yarn-patch.json");if(!ce.existsSLine truncated
${f.map(p=>`
- ${G.prettyLocator(r,p)}`).join("")}`);c=f[0]}if(!s.storedPackages.has(c.locatorHash))throw new nt("No package found in the project for the given locator");await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout},async f=>{let p=NL(c),h=await JK(c,{cache:n,project:s});f.reportJson({locator:G.stringifyLocator(p),path:fe.fromPortablePath(h)});let E=this.update?" along with its current modifications":"";f.reportInfo(0,`Package ${G.prettyLocator(r,p)} got extracted with success${E}!`),f.reportInfo(0,`You can now edit the following folder: ${he.pretty(r,fe.fromPortablePath(h),"magenta")}`),f.reportInfo(0,`Once you are done run ${he.pretty(r,`yarn patch-commit -s ${process.platform==="win32"?'"':""}${fe.fromPortablePath(h)}${process.platform==="win32"?'"':""}`,"cyan")} and Yarn will store a patchfile based on your changes.`)})}};var Ubt={configuration:{enableInlineHunks:{description:"If true, the installs will print unmatched patch hunks",type:"BOOLEAN",default:!1},patchFolder:{description:"Folder where the patch files must be written",type:"ABSOLUTE_PATH",default:"./.yarn/patches"}},commands:[_1,H1],fetchers:[rP],resolvers:[nP]},_bt=Ubt;var ez={};Vt(ez,{PnpmLinker:()=>iP,default:()=>Ybt});Ge();Dt();Yt();var iP=class{getCustomDataKey(){return JSON.stringify({name:"PnpmLinker",version:3})}supportsPackage(e,r){return this.isEnabled(r)}async findPackageLocation(e,r){if(!this.isEnabled(r))throw new Error("Assertion failed: Expected the pnpm linker to be enabled");let s=this.getCustomDataKey(),a=r.project.linkersCustomData.get(s);if(!a)throw new nt(`The project in ${he.pretty(r.project.configuration,`${r.project.cwd}/package.json`,he.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let n=a.pathsByLocator.get(e.locatorHash);if(typeof n>"u")throw new nt(`Couldn't find ${G.prettyLocator(r.project.configuration,e)} in the currently installed pnpm map - running an install might help`);return n.packageLocation}async findPackageLocator(e,r){if(!this.isEnabled(r))return null;let s=this.getCustomDataKey(),a=r.project.linkersCustomData.get(s);if(!a)throw new nt(`The project in ${he.pretty(r.project.configuration,`${r.project.cwd}/package.json`,he.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let n=e.match(/(^.*\/node_modules\/(@[^/]*\/)?[^/]+)(\/.*$)/);if(n){let p=a.locatorByPath.get(n[1]);if(p)return p}let c=e,f=e;do{f=c,c=J.dirname(f);let p=a.locatorByPath.get(f);if(p)return p}while(c!==f);return null}makeInstaller(e){return new ZK(e)}isEnabled(e){return e.project.configuration.get("nodeLinker")==="pnpm"}},ZK=class{constructor(e){this.opts=e;this.asyncActions=new je.AsyncActions(10);this.customData={pathsByLocator:new Map,locatorByPath:new Map};this.indexFolderPromise=$P(ce,{indexPath:J.join(e.project.configuration.get("globalFolder"),"index")})}attachCustomData(e){}async installPackage(e,r,s){switch(e.linkType){case"SOFT":return this.installPackageSoft(e,r,s);case"HARD":return this.installPackageHard(e,r,s)}throw new Error("Assertion failed: Unsupported package link type")}async installPackageSoft(e,r,s){let a=J.resolve(r.packageFs.getRealPath(),r.prefixPath),n=this.opts.project.tryWorkspaceByLocator(e)?J.join(a,Er.nodeModules):null;return this.customData.pathsByLocator.set(e.locatorHash,{packageLocation:a,dependenciesLocation:n}),{packageLocation:a,buildRequest:null}}async installPackageHard(e,r,s){let a=jbt(e,{project:this.opts.project}),n=a.packageLocation;this.customData.locatorByPath.set(n,G.stringifyLocator(e)),this.customData.pathsByLocator.set(e.locatorHash,a),s.holdFetchResult(this.asyncActions.set(e.locatorHash,async()=>{await ce.mkdirPromise(n,{recursive:!0}),await ce.copyPromise(n,r.prefixPath,{baseFs:r.packageFs,overwrite:!1,linkStrategy:{type:"HardlinkFromIndex",indexPath:await this.indexFolderPromise,autoRepair:!0}})}));let f=G.isVirtualLocator(e)?G.devirtualizeLocator(e):e,p={manifest:await Ut.tryFind(r.prefixPath,{baseFs:r.packageFs})??new Ut,misc:{hasBindingGyp:gA.hasBindingGyp(r)}},h=this.opts.project.getDependencyMeta(f,e.version),E=gA.extractBuildRequest(e,p,h,{configuration:this.opts.project.configuration});return{packageLocation:n,buildRequest:E}}async attachInternalDependencies(e,r){if(this.opts.project.configuration.get("nodeLinker")!=="pnpm"||!ike(e,{project:this.opts.project}))return;let s=this.customData.pathsByLocator.get(e.locatorHash);if(typeof s>"u")throw new Error(`Assertion failed: Expected the package to have been registered (${G.stringifyLocator(e)})`);let{dependenciesLocation:a}=s;a&&this.asyncActions.reduce(e.locatorHash,async n=>{await ce.mkdirPromise(a,{recursive:!0});let c=await Gbt(a),f=new Map(c),p=[n],h=(C,S)=>{let P=S;ike(S,{project:this.opts.project})||(this.opts.report.reportWarningOnce(0,"The pnpm linker doesn't support providing different versions to workspaces' peer dependencies"),P=G.devirtualizeLocator(S));let I=this.customData.pathsByLocator.get(P.locatorHash);if(typeof I>"Line truncated
${Jbt}
`,"--",...s],{cwd:t,strict:!0})},async makeReset(t,e){let r=e.map(s=>fe.fromPortablePath(s.path));await qr.execvp("git",["reset","HEAD","--",...r],{cwd:t,strict:!0})}};var $bt=[lke],j1=class extends ft{constructor(){super(...arguments);this.commit=ge.Boolean("-c,--commit",!1,{description:"Commit the staged files"});this.reset=ge.Boolean("-r,--reset",!1,{description:"Remove all files from the staging area"});this.dryRun=ge.Boolean("-n,--dry-run",!1,{description:"Print the commit message and the list of modified files without staging / committing"});this.update=ge.Boolean("-u,--update",!1,{hidden:!0})}static{this.paths=[["stage"]]}static{this.usage=ot.Usage({description:"add all yarn files to your vcs",details:"\n This command will add to your staging area the files belonging to Yarn (typically any modified `package.json` and `.yarnrc.yml` files, but also linker-generated files, cache data, etc). It will take your ignore list into account, so the cache files won't be added if the cache is ignored in a `.gitignore` file (assuming you use Git).\n\n Running `--reset` will instead remove them from the staging area (the changes will still be there, but won't be committed until you stage them back).\n\n Since the staging area is a non-existent concept in Mercurial, Yarn will always create a new commit when running this command on Mercurial repositories. You can get this behavior when using Git by using the `--commit` flag which will directly create a commit.\n ",examples:[["Adds all modified project files to the staging area","yarn stage"],["Creates a new commit containing all modified project files","yarn stage --commit"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s}=await Tt.find(r,this.context.cwd),{driver:a,root:n}=await ePt(s.cwd),c=[r.get("cacheFolder"),r.get("globalFolder"),r.get("virtualFolder"),r.get("yarnPath")];await r.triggerHook(C=>C.populateYarnPaths,s,C=>{c.push(C)});let f=new Set;for(let C of c)for(let S of tPt(n,C))f.add(S);let p=new Set([r.get("rcFilename"),Er.lockfile,Er.manifest]),h=await a.filterChanges(n,f,p),E=await a.genCommitMessage(n,h);if(this.dryRun)if(this.commit)this.context.stdout.write(`${E}
`);else for(let C of h)this.context.stdout.write(`${fe.fromPortablePath(C.path)}
`);else if(this.reset){let C=await a.filterChanges(n,f,p,{staged:!0});C.length===0?this.context.stdout.write("No staged changes found!"):await a.makeReset(n,C)}else h.length===0?this.context.stdout.write("No changes found!"):this.commit?await a.makeCommit(n,h,E):(await a.makeStage(n,h),this.context.stdout.write(E))}};async function ePt(t){let e=null,r=null;for(let s of $bt)if((r=await s.findRoot(t))!==null){e=s;break}if(e===null||r===null)throw new nt("No stage driver has been found for your current project");return{driver:e,root:r}}function tPt(t,e){let r=[];if(e===null)return r;for(;;){(e===t||e.startsWith(`${t}/`))&&r.push(e);let s;try{s=ce.statSync(e)}catch{break}if(s.isSymbolicLink())e=J.resolve(J.dirname(e),ce.readlinkSync(e));else break}return r}var rPt={commands:[j1]},nPt=rPt;var lz={};Vt(lz,{default:()=>fPt});Ge();Ge();Dt();var fke=ut(Ai());Ge();var cke=ut(g9()),iPt="e8e1bd300d860104bb8c58453ffa1eb4",sPt="OFCNCOG2CU",uke=async(t,e)=>{let r=G.stringifyIdent(t),a=oPt(e).initIndex("npm-search");try{return(await a.getObject(r,{attributesToRetrieve:["types"]})).types?.ts==="definitely-typed"}catch{return!1}},oPt=t=>(0,cke.default)(sPt,iPt,{requester:{async send(r){try{let s=await nn.request(r.url,r.data||null,{configuration:t,headers:r.headers});return{content:s.body,isTimedOut:!1,status:s.statusCode}}catch(s){return{content:s.response.body,isTimedOut:!1,status:s.response.statusCode}}}}});var Ake=t=>t.scope?`${t.scope}__${t.name}`:`${t.name}`,aPt=async(t,e,r,s)=>{if(r.scope==="types")return;let{project:a}=t,{configuration:n}=a;if(!(n.get("tsEnableAutoTypes")??(ce.existsSync(J.join(t.cwd,"tsconfig.json"))||ce.existsSync(J.join(a.cwd,"tsconfig.json")))))return;let f=n.makeResolver(),p={project:a,resolver:f,report:new ki};if(!await uke(r,n))return;let E=Ake(r),C=G.parseRange(r.range).selector;if(!Fr.validRange(C)){let N=n.normalizeDependency(r),U=await f.getCandidates(N,{},p);C=G.parseRange(U[0].reference).selector}let S=fke.default.coerce(C);if(S===null)return;let P=`${Xu.Modifier.CARET}${S.major}`,I=G.makeDescriptor(G.makeIdent("types",E),P),R=je.mapAndFind(a.workspaces,N=>{let U=N.manifest.dependencies.get(r.identHash)?.descriptorHash,W=N.manifest.devDependencies.get(r.identHash)?.descriptorHash;if(U!==r.descriptorHash&&W!==r.descriptorHash)return je.mapAndFind.skip;let ee=[];for(let ie of Ut.allDependencies){let ue=N.manifest[ie].get(I.identHash);typeof ue>"u"||ee.push([ie,ue])}return ee.length===0?je.mapAndFind.skip:ee});if(typeof R<"u")for(let[N,U]of R)t.manifest[N].set(U.identHash,U);else{try{let N=n.normalizeDependency(I);if((await f.getCandidates(N,{},p)).length===0)return}catch{return}t.manifest[Xu.Target.DEVELOPMENT].set(I.identHash,I)}},lPt=async(t,e,r)=>{if(r.scope==="types")return;let{project:s}=t,{configuration:a}=s;if(!(a.get("tsEnableAutoTypes")??(ce.existsSync(J.join(t.cwd,"tsconfig.json"))||ce.existsSync(J.join(s.cwd,"tsconfig.json")))))return;let c=Ake(r),f=G.makeIdent("types",c);for(let p of Ut.allDependencies)typeof t.manifest[p].get(f.identHash)>"u"||t.manifest[p].delete(f.identHash)},cPt=(t,e)=>{e.publishConfig&&e.publishConfig.typings&&(e.typings=e.publishConfig.typings),e.publishConfig&&e.publishConfig.types&&(e.types=e.publishConfig.types)},uPt={configuration:{tsEnableAutoTypes:{description:"Whether Yarn should auto-install @types/ dependencies on 'yarn add'",type:"BOOLEAN",isNullable:!0,default:null}},hooks:{afterWorkspaceDependencyAddition:aPt,afterWorkspaceDependencyRemoval:lPt,beforeWorkspacePacking:cPt}},fPt=uPt;var pz={};Vt(pz,{VersionApplyCommand:()=>Y1,VersionCheckCommand:()=>V1,VersionCommand:()=>J1,default:()=>dPt,versionUtils:()=>W1});Ge();Ge();Yt();var W1={};Vt(W1,{Decision:()=>G1,applyPrerelease:()=>pke,applyReleases:()=>Az,applyStrategy:()=>sP,clearVersionFiles:()=>cz,getUndecidedDependentWorkspaces:()=>aP,getUndecidedWorkspaces:()=>UL,openVersionFile:()=>q1,requireMoreDecisions:()=>pPt,resolveVersionFiles:()=>oP,suggestStrategy:()=>fz,updateVersionFiles:()=>uz,validateReleaseDecision:()=>dy});Ge();Dt();wc();Yt();ql();var kA=ut(Ai()),APt=/^(>=|[~^]|)(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$/,G1=(h=>(h.UNDECIDED="undecided",h.DECLINE="decline",h.MAJOR="major",h.MINOR="minor",h.PATCH="patch",h.PREMAJOR="premajor",h.PREMINOR="preminor",h.PREPATCH="prepatch",h.PRERELEASE="prerelease",h))(G1||{});function dy(t){let e=kA.default.valid(t);return e||je.validateEnum(O4(G1,"UNDECIDED"),t)}async function oP(t,{prerelease:e=null}={}){let r=new Map,s=t.configuration.get("deferredVersionFolder");if(!ce.existsSync(s))return r;let a=await ce.readdirPromise(s);for(let n of a){if(!n.endsWith(".yml"))continue;let c=J.join(s,n),f=await ce.readFilePromise(c,"utf8"),p=ls(f);for(let[h,E]of Object.entries(p.releases||{})){if(E==="decline")continue;let C=G.parseIdent(h),S=t.tryWorkspaceByIdent(C);if(S===null)throw new Error(`Assertion failed: Expected a release definitioLine truncated
- ${f.map(P=>fe.fromPortablePath(P)).join(`
- `)}`);let p=new Set(je.mapAndFilter(n,P=>{let I=t.tryWorkspaceByFilePath(P);return I===null?je.mapAndFilter.skip:I}));if(f.length===0&&p.size===0&&!e)return null;let h=f.length===1?f[0]:J.join(c,`${Nn.makeHash(Math.random().toString()).slice(0,8)}.yml`),E=ce.existsSync(h)?await ce.readFilePromise(h,"utf8"):"{}",C=ls(E),S=new Map;for(let P of C.declined||[]){let I=G.parseIdent(P),R=t.getWorkspaceByIdent(I);S.set(R,"decline")}for(let[P,I]of Object.entries(C.releases||{})){let R=G.parseIdent(P),N=t.getWorkspaceByIdent(R);S.set(N,dy(I))}return{project:t,root:s,baseHash:a!==null?a.hash:null,baseTitle:a!==null?a.title:null,changedFiles:new Set(n),changedWorkspaces:p,releaseRoots:new Set([...p].filter(P=>P.manifest.version!==null)),releases:S,async saveAll(){let P={},I=[],R=[];for(let N of t.workspaces){if(N.manifest.version===null)continue;let U=G.stringifyIdent(N.anchoredLocator),W=S.get(N);W==="decline"?I.push(U):typeof W<"u"?P[U]=dy(W):p.has(N)&&R.push(U)}await ce.mkdirPromise(J.dirname(h),{recursive:!0}),await ce.changeFilePromise(h,nl(new nl.PreserveOrdering({releases:Object.keys(P).length>0?P:void 0,declined:I.length>0?I:void 0,undecided:R.length>0?R:void 0})))}}}function pPt(t){return UL(t).size>0||aP(t).length>0}function UL(t){let e=new Set;for(let r of t.changedWorkspaces)r.manifest.version!==null&&(t.releases.has(r)||e.add(r));return e}function aP(t,{include:e=new Set}={}){let r=[],s=new Map(je.mapAndFilter([...t.releases],([n,c])=>c==="decline"?je.mapAndFilter.skip:[n.anchoredLocator.locatorHash,n])),a=new Map(je.mapAndFilter([...t.releases],([n,c])=>c!=="decline"?je.mapAndFilter.skip:[n.anchoredLocator.locatorHash,n]));for(let n of t.project.workspaces)if(!(!e.has(n)&&(a.has(n.anchoredLocator.locatorHash)||s.has(n.anchoredLocator.locatorHash)))&&n.manifest.version!==null)for(let c of Ut.hardDependencies)for(let f of n.manifest.getForScope(c).values()){let p=t.project.tryWorkspaceByDescriptor(f);p!==null&&s.has(p.anchoredLocator.locatorHash)&&r.push([n,p])}return r}function fz(t,e){let r=kA.default.clean(e);for(let s of Object.values(G1))if(s!=="undecided"&&s!=="decline"&&kA.default.inc(t,s)===r)return s;return null}function sP(t,e){if(kA.default.valid(e))return e;if(t===null)throw new nt(`Cannot apply the release strategy "${e}" unless the workspace already has a valid version`);if(!kA.default.valid(t))throw new nt(`Cannot apply the release strategy "${e}" on a non-semver version (${t})`);let r=kA.default.inc(t,e);if(r===null)throw new nt(`Cannot apply the release strategy "${e}" on the specified version (${t})`);return r}function Az(t,e,{report:r,exact:s}){let a=new Map;for(let n of t.workspaces)for(let c of Ut.allDependencies)for(let f of n.manifest[c].values()){let p=t.tryWorkspaceByDescriptor(f);if(p===null||!e.has(p))continue;je.getArrayWithDefault(a,p).push([n,c,f.identHash])}for(let[n,c]of e){let f=n.manifest.version;n.manifest.version=c,kA.default.prerelease(c)===null?delete n.manifest.raw.stableVersion:n.manifest.raw.stableVersion||(n.manifest.raw.stableVersion=f);let p=n.manifest.name!==null?G.stringifyIdent(n.manifest.name):null;r.reportInfo(0,`${G.prettyLocator(t.configuration,n.anchoredLocator)}: Bumped to ${c}`),r.reportJson({cwd:fe.fromPortablePath(n.cwd),ident:p,oldVersion:f,newVersion:c});let h=a.get(n);if(!(typeof h>"u"))for(let[E,C,S]of h){let P=E.manifest[C].get(S);if(typeof P>"u")throw new Error("Assertion failed: The dependency should have existed");let I=P.range,R=!1;if(I.startsWith(Ei.protocol)&&(I=I.slice(Ei.protocol.length),R=!0,I===n.relativeCwd))continue;let N=I.match(APt);if(!N){r.reportWarning(0,`Couldn't auto-upgrade range ${I} (in ${G.prettyLocator(t.configuration,E.anchoredLocator)})`);continue}let U=s?`${c}`:`${N[1]}${c}`;R&&(U=`${Ei.protocol}${U}`);let W=G.makeDescriptor(P,U);E.manifest[C].set(S,W)}}}var hPt=new Map([["%n",{extract:t=>t.length>=1?[t[0],t.slice(1)]:null,generate:(t=0)=>`${t+1}`}]]);function pke(t,{current:e,prerelease:r}){let s=new kA.default.SemVer(e),a=s.prerelease.slice(),n=[];s.prerelease=[],s.format()!==t&&(a.length=0);let c=!0,f=r.split(/\./g);for(let p of f){let h=hPt.get(p);if(typeof h>"u")n.push(p),a[0]===p?a.shift():c=!1;else{let E=c?h.extract(a):null;E!==null&&typeof E[0]=="number"?(n.push(h.generate(E[0])),a=E[1]):(n.push(h.generate()),c=!1)}}return s.prerelease&&(s.prerelease=[]),`${t}-${n.join(".")}`}var Y1=class extends ft{constructor(){super(...arguments);this.all=ge.Boolean("--all",!1,{description:"Apply the deferred version changes on all workspaces"});this.dryRun=ge.Boolean("--dry-run",!1,{description:"Print the versions without actually generating the package archive"});this.prerelease=ge.String("--prerelease",{description:"Add a prerelease identifier to new versions",tolerateBoolean:!0});this.exact=ge.Boolean("--exact",!1,{description:"Use the exact version of each package, removes any range. Useful for nightly releases where the range might match another version."});this.recursive=ge.Boolean("-R,--recursive",{description:"ReleLine truncated
This command will apply the deferred version changes and remove their definitions from the repository.
Note that if \`--prerelease\` is set, the given prerelease identifier (by default \`rc.%n\`) will be used on all new versions and the version definitions will be kept as-is.
By default only the current workspace will be bumped, but you can configure this behavior by using one of:
- \`--recursive\` to also apply the version bump on its dependencies
- \`--all\` to apply the version bump on all packages in the repository
Note that this command will also update the \`workspace:\` references across all your local workspaces, thus ensuring that they keep referring to the same workspaces even after the version bump.
`,examples:[["Apply the version change to the local workspace","yarn version apply"],["Apply the version change to all the workspaces in the local workspace","yarn version apply --all"]]})}async execute(){let r=await ze.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Tt.find(r,this.context.cwd),n=await Kr.find(r);if(!a)throw new ar(s.cwd,this.context.cwd);await s.restoreInstallState({restoreResolutions:!1});let c=await Ot.start({configuration:r,json:this.json,stdout:this.context.stdout},async f=>{let p=this.prerelease?typeof this.prerelease!="boolean"?this.prerelease:"rc.%n":null,h=await oP(s,{prerelease:p}),E=new Map;if(this.all)E=h;else{let C=this.recursive?a.getRecursiveWorkspaceDependencies():[a];for(let S of C){let P=h.get(S);typeof P<"u"&&E.set(S,P)}}if(E.size===0){let C=h.size>0?" Did you want to add --all?":"";f.reportWarning(0,`The current workspace doesn't seem to require a version bump.${C}`);return}Az(s,E,{report:f,exact:this.exact}),this.dryRun||(p||(this.all?await cz(s):await uz(s,[...E.keys()])),f.reportSeparator())});return this.dryRun||c.hasErrors()?c.exitCode():await s.installWithNewReport({json:this.json,stdout:this.context.stdout},{cache:n})}};Ge();Dt();Yt();var _L=ut(Ai());var V1=class extends ft{constructor(){super(...arguments);this.interactive=ge.Boolean("-i,--interactive",{description:"Open an interactive interface used to set version bumps"})}static{this.paths=[["version","check"]]}static{this.usage=ot.Usage({category:"Release-related commands",description:"check that all the relevant packages have been bumped",details:"\n **Warning:** This command currently requires Git.\n\n This command will check that all the packages covered by the files listed in argument have been properly bumped or declined to bump.\n\n In the case of a bump, the check will also cover transitive packages - meaning that should `Foo` be bumped, a package `Bar` depending on `Foo` will require a decision as to whether `Bar` will need to be bumped. This check doesn't cross packages that have declined to bump.\n\n In case no arguments are passed to the function, the list of modified files will be generated by comparing the HEAD against `master`.\n ",examples:[["Check whether the modified packages need a bump","yarn version check"]]})}async execute(){return this.interactive?await this.executeInteractive():await this.executeStandard()}async executeInteractive(){iw(this.context);let{Gem:r}=await Promise.resolve().then(()=>(WF(),LW)),{ScrollableItems:s}=await Promise.resolve().then(()=>(KF(),JF)),{FocusRequest:a}=await Promise.resolve().then(()=>(UW(),v2e)),{useListInput:n}=await Promise.resolve().then(()=>(VF(),S2e)),{renderForm:c}=await Promise.resolve().then(()=>($F(),ZF)),{Box:f,Text:p}=await Promise.resolve().then(()=>ut(Wc())),{default:h,useCallback:E,useState:C}=await Promise.resolve().then(()=>ut(hn())),S=await ze.find(this.context.cwd,this.context.plugins),{project:P,workspace:I}=await Tt.find(S,this.context.cwd);if(!I)throw new ar(P.cwd,this.context.cwd);await P.restoreInstallState();let R=await q1(P);if(R===null||R.releaseRoots.size===0)return 0;if(R.root===null)throw new nt("This command can only be run on Git repositories");let N=()=>h.createElement(f,{flexDirection:"row",paddingBottom:1},h.createElement(f,{flexDirection:"column",width:60},h.createElement(f,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"<up>"),"/",h.createElement(p,{bold:!0,color:"cyanBright"},"<down>")," to select workspaces.")),h.createElement(f,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"<left>"),"/",h.createElement(p,{bold:!0,color:"cyanBright"},"<right>")," to select release strategies."))),h.createElement(f,{flexDirection:"column"},h.createElement(f,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"<enter>")," to save.")),h.createElement(f,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"<ctrl+c>")," to abort.")))),U=({workspace:me,active:pe,decision:Be,setDecision:Ce})=>{let g=me.manifest.raw.stableVersion??me.manifest.version;if(g===null)throw new Error(`Assertion failed: The version should have been set (${G.prettyLocator(S,me.anchoredLocator)})`);if(_L.default.prerelease(g)!==null)throw new Error(`Assertion failed: Prerelease identifiers shouldn't be found (${g})`);let we=["undecided","decline","patch","minor","major"];n(Be,we,{active:pe,minus:"left",plus:"right",set:Ce});let ye=Be==="undecided"?h.createElement(p,{color:"yellow"},g):Be==="decline"?h.createElement(p,{color:"green"},g):h.createElement(p,null,h.createElement(p,{color:"magenta"},g)," \u2192 ",h.createElement(p,{color:"green"},_L.default.valid(Be)?Be:_L.default.inc(g,Be)));return h.createElement(f,{flexDirection:"column"},h.createElement(f,null,h.createElement(p,null,G.prettyLocator(S,me.anchoredLocator)," - ",ye)),h.createElement(f,null,we.map(AeLine truncated
`)},p=()=>{let Ce=this.from.map(g=>z1.default.matcher(g));return s.workspaces.filter(g=>{let we=G.stringifyIdent(g.anchoredLocator),ye=g.relativeCwd;return Ce.some(Ae=>Ae(we)||Ae(ye))})},h=[];if(this.since?(f("Option --since is set; selecting the changed workspaces as root for workspace selection"),h=Array.from(await ka.fetchChangedWorkspaces({ref:this.since,project:s}))):this.from?(f("Option --from is set; selecting the specified workspaces"),h=[...p()]):this.worktree?(f("Option --worktree is set; selecting the current workspace"),h=[a]):this.recursive?(f("Option --recursive is set; selecting the current workspace"),h=[a]):this.all&&(f("Option --all is set; selecting all workspaces"),h=[...s.workspaces]),this.dryRun&&!this.all){for(let Ce of h)f(`
- ${Ce.relativeCwd}
${G.prettyLocator(r,Ce.anchoredLocator)}`);h.length>0&&f("")}let E;if(this.recursive?this.since?(f("Option --recursive --since is set; recursively selecting all dependent workspaces"),E=new Set(h.map(Ce=>[...Ce.getRecursiveWorkspaceDependents()]).flat())):(f("Option --recursive is set; recursively selecting all transitive dependencies"),E=new Set(h.map(Ce=>[...Ce.getRecursiveWorkspaceDependencies()]).flat())):this.worktree?(f("Option --worktree is set; recursively selecting all nested workspaces"),E=new Set(h.map(Ce=>[...Ce.getRecursiveWorkspaceChildren()]).flat())):E=null,E!==null&&(h=[...new Set([...h,...E])],this.dryRun))for(let Ce of E)f(`
- ${Ce.relativeCwd}
${G.prettyLocator(r,Ce.anchoredLocator)}`);let C=[],S=!1;if(c?.includes(":")){for(let Ce of s.workspaces)if(Ce.manifest.scripts.has(c)&&(S=!S,S===!1))break}for(let Ce of h){if(c&&!Ce.manifest.scripts.has(c)&&!S&&!(await In.getWorkspaceAccessibleBinaries(Ce)).has(c)){f(`Excluding ${Ce.relativeCwd} because it doesn't have a "${c}" script`);continue}if(!(c===r.env.npm_lifecycle_event&&Ce.cwd===a.cwd)){if(this.include.length>0&&!z1.default.isMatch(G.stringifyIdent(Ce.anchoredLocator),this.include)&&!z1.default.isMatch(Ce.relativeCwd,this.include)){f(`Excluding ${Ce.relativeCwd} because it doesn't match the --include filter`);continue}if(this.exclude.length>0&&(z1.default.isMatch(G.stringifyIdent(Ce.anchoredLocator),this.exclude)||z1.default.isMatch(Ce.relativeCwd,this.exclude))){f(`Excluding ${Ce.relativeCwd} because it matches the --exclude filter`);continue}if(this.publicOnly&&Ce.manifest.private===!0){f(`Excluding ${Ce.relativeCwd} because it's a private workspace and --no-private was set`);continue}C.push(Ce)}}if(this.dryRun)return 0;let P=this.verbose??(this.context.stdout.isTTY?1/0:0),I=P>0,R=P>1,N=this.parallel?this.jobs==="unlimited"?1/0:Number(this.jobs)||Math.ceil(Ui.availableParallelism()/2):1,U=N===1?!1:this.parallel,W=U?this.interlaced:!0,ee=(0,gke.default)(N),ie=new Map,ue=new Set,le=0,me=null,pe=!1,Be=await Ot.start({configuration:r,stdout:this.context.stdout,includePrefix:!1},async Ce=>{let g=async(we,{commandIndex:ye})=>{if(pe)return-1;!U&&R&&ye>1&&Ce.reportSeparator();let Ae=mPt(we,{configuration:r,label:I,commandIndex:ye}),[se,Z]=hke(Ce,{prefix:Ae,interlaced:W}),[De,Re]=hke(Ce,{prefix:Ae,interlaced:W});try{R&&Ce.reportInfo(null,`${Ae?`${Ae} `:""}Process started`);let mt=Date.now(),j=await this.cli.run([this.commandName,...this.args],{cwd:we.cwd,stdout:se,stderr:De})||0;se.end(),De.end(),await Z,await Re;let rt=Date.now();if(R){let Fe=r.get("enableTimers")?`, completed in ${he.pretty(r,rt-mt,he.Type.DURATION)}`:"";Ce.reportInfo(null,`${Ae?`${Ae} `:""}Process exited (exit code ${j})${Fe}`)}return j===130&&(pe=!0,me=j),j}catch(mt){throw se.end(),De.end(),await Z,await Re,mt}};for(let we of C)ie.set(we.anchoredLocator.locatorHash,we);for(;ie.size>0&&!Ce.hasErrors();){let we=[];for(let[Z,De]of ie){if(ue.has(De.anchoredDescriptor.descriptorHash))continue;let Re=!0;if(this.topological||this.topologicalDev){let mt=this.topologicalDev?new Map([...De.manifest.dependencies,...De.manifest.devDependencies]):De.manifest.dependencies;for(let j of mt.values()){let rt=s.tryWorkspaceByDescriptor(j);if(Re=rt===null||!ie.has(rt.anchoredLocator.locatorHash),!Re)break}}if(Re&&(ue.add(De.anchoredDescriptor.descriptorHash),we.push(ee(async()=>{let mt=await g(De,{commandIndex:++le});return ie.delete(Z),ue.delete(De.anchoredDescriptor.descriptorHash),{workspace:De,exitCode:mt}})),!U))break}if(we.length===0){let Z=Array.from(ie.values()).map(De=>G.prettyLocator(r,De.anchoredLocator)).join(", ");Ce.reportError(3,`Dependency cycle detected (${Z})`);return}let ye=await Promise.all(we);ye.forEach(({workspace:Z,exitCode:De})=>{De!==0&&Ce.reportError(0,`The command failed in workspace ${G.prettyLocator(r,Z.anchoredLocator)} with exit code ${De}`)});let se=ye.map(Z=>Z.exitCode).find(Z=>Z!==0);(this.topological||this.topologicalDev)&&typeof se<"u"&&Ce.reportError(0,"The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph")}});return me!==null?me:Be.exitCode()}};function hke(t,{prefix:e,interlaced:r}){let s=t.createStreamReporter(e),a=new je.DefaultStream;a.pipe(s,{end:!1}),a.on("finish",()=>{s.end()});let n=new Promise(f=>{s.on("finish",()=>{f(a.active)})});if(r)return[a,n];let c=new je.BufferStream;return c.pipe(a,{end:!1}),c.on("finish",()=>{a.end()}),[c,n]}function mPt(t,{configuration:e,commandIndex:r,label:s}){if(!s)return null;let n=`[${G.stringifyIdent(t.anchoredLocator)}]:`,c=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],f=c[r%c.length];return he.pretty(e,n,f)}var yPt={commands:[K1,X1]},EPt=yPt;var tC=()=>({modules:new Map([["@yarnpkg/cli",Gv],["@yarnpkg/core",jv],["@yarnpkg/fslib",_2],["@yarnpkg/libzip",fv],["@yarnpkg/parsers",J2],["@yarnpkg/shell",mv],["clipanion",oB],["semver",IPt],["typanion",Ea],["@yarnpkg/plugin-essentials",hq],["@yarnpkg/plugin-catalog",yq],["@yarnpkg/plugin-compat",Bq],["@yarnpkg/plugin-constraints",_q],["@yarnpkg/plugin-dlx",Hq],["@yarnpkg/plugin-exec",qq],["@yarnpkg/plugin-file",Yq],["@yarnpkg/plugin-git",pq],["@yarnpkg/plugin-github",Kq],["@yarnpkg/plugin-http",zq],["@yarnpkg/plugin-init",Xq],["@yarnpkg/plugin-interactive-tools",JW],["@yarnpkg/plugin-jsr",zW],["@yarnpkg/plugin-link",XW],["@yarnpkg/plugin-nm",FY],["@yarnpkg/plugin-npm",FK],["@yarnpkg/plugin-npm-cli",qK],["@yarnpkg/plugin-pack",bV],["@yarnpkg/plugin-patch",XK],["@yarnpkg/plugin-pnp",wY],["@yarnpkg/plugin-pnpm",ez],["@yarnpkg/plugin-stage",az],["@yarnpkg/plugin-typescript",lz],["@yarnpkg/plugin-version",pz],["@yarnpkg/plugin-workspace-tools",hz]]),plugins:new SetLine truncated
Please report this issue at https://github.com/yarnpkg/berry/issues.`)}process.once("beforeExit",n);try{process.exitCode=42,process.exitCode=await SPt(a,t,{selfPath:r,pluginConfiguration:s})}catch(c){Ca.defaultContext.stdout.write(a.error(c)),process.exitCode=1}finally{process.off("beforeExit",n),await ce.rmtempPromise()}}VR(process.argv.slice(2),{cwd:J.cwd(),selfPath:fe.toPortablePath(fe.resolve(process.argv[1])),pluginConfiguration:tC()});})();
/**
@license
Copyright (c) 2015, Rebecca Turner
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
/**
@license
Copyright Node.js contributors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
/**
@license
The MIT License (MIT)
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/**
@license
Copyright Joyent, Inc. and other Node contributors.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*! Bundled license information:
is-number/index.js:
(*!
* is-number <https://github.com/jonschlinkert/is-number>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Released under the MIT License.
*)
to-regex-range/index.js:
(*!
* to-regex-range <https://github.com/micromatch/to-regex-range>
*
* Copyright (c) 2015-present, Jon Schlinkert.
* Released under the MIT License.
*)
fill-range/index.js:
(*!
* fill-range <https://github.com/jonschlinkert/fill-range>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Licensed under the MIT License.
*)
is-extglob/index.js:
(*!
* is-extglob <https://github.com/jonschlinkert/is-extglob>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*)
is-glob/index.js:
(*!
* is-glob <https://github.com/jonschlinkert/is-glob>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*)
queue-microtask/index.js:
(*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
run-parallel/index.js:
(*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
git-url-parse/lib/index.js:
(*!
* buildToken
* Builds OAuth token prefix (helper function)
*
* @name buildToken
* @function
* @param {GitUrl} obj The parsed Git url object.
* @return {String} token prefix
*)
object-assign/index.js:
(*
object-assign
(c) Sindre Sorhus
@license MIT
*)
react/cjs/react.production.min.js:
(** @license React v17.0.2
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
scheduler/cjs/scheduler.production.min.js:
(** @license React v0.20.2
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react-reconciler/cjs/react-reconciler.production.min.js:
(** @license React v0.26.2
* react-reconciler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
is-windows/index.js:
(*!
* is-windows <https://github.com/jonschlinkert/is-windows>
*
* Copyright © 2015-2018, Jon Schlinkert.
* Released under the MIT License.
*)
*/
+1000
View File
@@ -0,0 +1,1000 @@
#!/usr/bin/env node
/* eslint-disable */
//prettier-ignore
(()=>{var QXe=Object.create;var A6=Object.defineProperty;var FXe=Object.getOwnPropertyDescriptor;var NXe=Object.getOwnPropertyNames;var OXe=Object.getPrototypeOf,LXe=Object.prototype.hasOwnProperty;var Ae=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var tt=(t,e)=>()=>(t&&(e=t(t=0)),e);var H=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),lr=(t,e)=>{for(var r in e)A6(t,r,{get:e[r],enumerable:!0})},_Xe=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of NXe(e))!LXe.call(t,a)&&a!==r&&A6(t,a,{get:()=>e[a],enumerable:!(s=FXe(e,a))||s.enumerable});return t};var st=(t,e,r)=>(r=t!=null?QXe(OXe(t)):{},_Xe(e||!t||!t.__esModule?A6(r,"default",{value:t,enumerable:!0}):r,t));var Oi={};lr(Oi,{SAFE_TIME:()=>bae,S_IFDIR:()=>fT,S_IFLNK:()=>hT,S_IFMT:()=>Rh,S_IFREG:()=>nS});var Rh,fT,nS,hT,bae,Dae=tt(()=>{Rh=61440,fT=16384,nS=32768,hT=40960,bae=456789e3});var vr={};lr(vr,{EBADF:()=>ha,EBUSY:()=>MXe,EEXIST:()=>VXe,EINVAL:()=>HXe,EISDIR:()=>qXe,ENOENT:()=>jXe,ENOSYS:()=>UXe,ENOTDIR:()=>GXe,ENOTEMPTY:()=>YXe,EOPNOTSUPP:()=>KXe,EROFS:()=>WXe,ERR_DIR_CLOSED:()=>p6});function ou(t,e){return Object.assign(new Error(`${t}: ${e}`),{code:t})}function MXe(t){return ou("EBUSY",t)}function UXe(t,e){return ou("ENOSYS",`${t}, ${e}`)}function HXe(t){return ou("EINVAL",`invalid argument, ${t}`)}function ha(t){return ou("EBADF",`bad file descriptor, ${t}`)}function jXe(t){return ou("ENOENT",`no such file or directory, ${t}`)}function GXe(t){return ou("ENOTDIR",`not a directory, ${t}`)}function qXe(t){return ou("EISDIR",`illegal operation on a directory, ${t}`)}function VXe(t){return ou("EEXIST",`file already exists, ${t}`)}function WXe(t){return ou("EROFS",`read-only filesystem, ${t}`)}function YXe(t){return ou("ENOTEMPTY",`directory not empty, ${t}`)}function KXe(t){return ou("EOPNOTSUPP",`operation not supported, ${t}`)}function p6(){return ou("ERR_DIR_CLOSED","Directory handle was closed")}var AT=tt(()=>{});var Lc={};lr(Lc,{BigIntStatsEntry:()=>iw,DEFAULT_MODE:()=>m6,DirEntry:()=>d6,StatEntry:()=>nw,areStatsEqual:()=>y6,clearStats:()=>pT,convertToBigIntStats:()=>JXe,makeDefaultStats:()=>Pae,makeEmptyStats:()=>zXe});function Pae(){return new nw}function zXe(){return pT(Pae())}function pT(t){for(let e in t)if(Object.hasOwn(t,e)){let r=t[e];typeof r=="number"?t[e]=0:typeof r=="bigint"?t[e]=BigInt(0):g6.types.isDate(r)&&(t[e]=new Date(0))}return t}function JXe(t){let e=new iw;for(let r in t)if(Object.hasOwn(t,r)){let s=t[r];typeof s=="number"?e[r]=BigInt(Math.floor(s)):g6.types.isDate(s)&&(e[r]=new Date(s))}return e.atimeNs=e.atimeMs*BigInt(1e6)+BigInt(Math.floor(t.atimeMs%1*1e3))*BigInt(1e3),e.mtimeNs=e.mtimeMs*BigInt(1e6)+BigInt(Math.floor(t.mtimeMs%1*1e3))*BigInt(1e3),e.ctimeNs=e.ctimeMs*BigInt(1e6)+BigInt(Math.floor(t.ctimeMs%1*1e3))*BigInt(1e3),e.birthtimeNs=e.birthtimeMs*BigInt(1e6)+BigInt(Math.floor(t.birthtimeMs%1*1e3))*BigInt(1e3),e}function y6(t,e){if(t.atimeMs!==e.atimeMs||t.birthtimeMs!==e.birthtimeMs||t.blksize!==e.blksize||t.blocks!==e.blocks||t.ctimeMs!==e.ctimeMs||t.dev!==e.dev||t.gid!==e.gid||t.ino!==e.ino||t.isBlockDevice()!==e.isBlockDevice()||t.isCharacterDevice()!==e.isCharacterDevice()||t.isDirectory()!==e.isDirectory()||t.isFIFO()!==e.isFIFO()||t.isFile()!==e.isFile()||t.isSocket()!==e.isSocket()||t.isSymbolicLink()!==e.isSymbolicLink()||t.mode!==e.mode||t.mtimeMs!==e.mtimeMs||t.nlink!==e.nlink||t.rdev!==e.rdev||t.size!==e.size||t.uid!==e.uid)return!1;let r=t,s=e;return!(r.atimeNs!==s.atimeNs||r.mtimeNs!==s.mtimeNs||r.ctimeNs!==s.ctimeNs||r.birthtimeNs!==s.birthtimeNs)}var g6,m6,d6,nw,iw,E6=tt(()=>{g6=st(Ae("util")),m6=33188,d6=class{constructor(){this.name="";this.path="";this.mode=0}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&61440)===16384}isFIFO(){return!1}isFile(){return(this.mode&61440)===32768}isSocket(){return!1}isSymbolicLink(){return(this.mode&61440)===40960}},nw=class{constructor(){this.uid=0;this.gid=0;this.size=0;this.blksize=0;this.atimeMs=0;this.mtimeMs=0;this.ctimeMs=0;this.birthtimeMs=0;this.atime=new Date(0);this.mtime=new Date(0);this.ctime=new Date(0);this.birthtime=new Date(0);this.dev=0;this.ino=0;this.mode=m6;this.nlink=1;this.rdev=0;this.blocks=1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&61440)===16384}isFIFO(){return!1}isFile(){return(this.mode&61440)===32768}isSocket(){return!1}isSymbolicLink(){return(this.mode&61440)===40960}},iw=class{constructor(){this.uid=BigInt(0);this.gid=BigInt(0);this.size=BigInt(0);this.blksize=BigInt(0);this.atimeMs=BigInt(0);this.mtimeMs=BigInt(0);this.ctimeMs=BigInt(0);this.birthtimeMs=BigInt(0);this.atimeNs=BigInt(0);this.mtimeNs=BigInt(0);this.ctimeNs=BigInt(0);this.birthtimeNs=BigInt(0);this.atime=new Date(0);this.mtime=new Date(0);this.ctime=new Date(0);thisLine truncated
`).length,s=e.length-r;return r>s?`\r
`:`
`}function ty(t,e){return e.replace(/\r?\n/g,l$e(t))}var Lae,_ae,Sp,Th,ry=tt(()=>{Lae=Ae("crypto"),_ae=Ae("os");C6();_c();Sp=class{constructor(e){this.pathUtils=e}async*genTraversePromise(e,{stableSort:r=!1}={}){let s=[e];for(;s.length>0;){let a=s.shift();if((await this.lstatPromise(a)).isDirectory()){let l=await this.readdirPromise(a);if(r)for(let f of l.sort())s.push(this.pathUtils.join(a,f));else throw new Error("Not supported")}else yield a}}async checksumFilePromise(e,{algorithm:r="sha512"}={}){let s=await this.openPromise(e,"r");try{let n=Buffer.allocUnsafeSlow(65536),l=(0,Lae.createHash)(r),f=0;for(;(f=await this.readPromise(s,n,0,65536))!==0;)l.update(f===65536?n:n.slice(0,f));return l.digest("hex")}finally{await this.closePromise(s)}}async removePromise(e,{recursive:r=!0,maxRetries:s=5}={}){let a;try{a=await this.lstatPromise(e)}catch(n){if(n.code==="ENOENT")return;throw n}if(a.isDirectory()){if(r){let n=await this.readdirPromise(e);await Promise.all(n.map(l=>this.removePromise(this.pathUtils.resolve(e,l))))}for(let n=0;n<=s;n++)try{await this.rmdirPromise(e);break}catch(l){if(l.code!=="EBUSY"&&l.code!=="ENOTEMPTY")throw l;n<s&&await new Promise(f=>setTimeout(f,n*100))}}else await this.unlinkPromise(e)}removeSync(e,{recursive:r=!0}={}){let s;try{s=this.lstatSync(e)}catch(a){if(a.code==="ENOENT")return;throw a}if(s.isDirectory()){if(r)for(let a of this.readdirSync(e))this.removeSync(this.pathUtils.resolve(e,a));this.rmdirSync(e)}else this.unlinkSync(e)}async mkdirpPromise(e,{chmod:r,utimes:s}={}){if(e=this.resolve(e),e===this.pathUtils.dirname(e))return;let a=e.split(this.pathUtils.sep),n;for(let l=2;l<=a.length;++l){let f=a.slice(0,l).join(this.pathUtils.sep);if(!this.existsSync(f)){try{await this.mkdirPromise(f)}catch(h){if(h.code==="EEXIST")continue;throw h}if(n??=f,r!=null&&await this.chmodPromise(f,r),s!=null)await this.utimesPromise(f,s[0],s[1]);else{let h=await this.statPromise(this.pathUtils.dirname(f));await this.utimesPromise(f,h.atime,h.mtime)}}}return n}mkdirpSync(e,{chmod:r,utimes:s}={}){if(e=this.resolve(e),e===this.pathUtils.dirname(e))return;let a=e.split(this.pathUtils.sep),n;for(let l=2;l<=a.length;++l){let f=a.slice(0,l).join(this.pathUtils.sep);if(!this.existsSync(f)){try{this.mkdirSync(f)}catch(h){if(h.code==="EEXIST")continue;throw h}if(n??=f,r!=null&&this.chmodSync(f,r),s!=null)this.utimesSync(f,s[0],s[1]);else{let h=this.statSync(this.pathUtils.dirname(f));this.utimesSync(f,h.atime,h.mtime)}}}return n}async copyPromise(e,r,{baseFs:s=this,overwrite:a=!0,stableSort:n=!1,stableTime:l=!1,linkStrategy:f=null}={}){return await Rae(this,e,s,r,{overwrite:a,stableSort:n,stableTime:l,linkStrategy:f})}copySync(e,r,{baseFs:s=this,overwrite:a=!0}={}){let n=s.lstatSync(r),l=this.existsSync(e);if(n.isDirectory()){this.mkdirpSync(e);let h=s.readdirSync(r);for(let A of h)this.copySync(this.pathUtils.join(e,A),s.pathUtils.join(r,A),{baseFs:s,overwrite:a})}else if(n.isFile()){if(!l||a){l&&this.removeSync(e);let h=s.readFileSync(r);this.writeFileSync(e,h)}}else if(n.isSymbolicLink()){if(!l||a){l&&this.removeSync(e);let h=s.readlinkSync(r);this.symlinkSync(dT(this.pathUtils,h),e)}}else throw new Error(`Unsupported file type (file: ${r}, mode: 0o${n.mode.toString(8).padStart(6,"0")})`);let f=n.mode&511;this.chmodSync(e,f)}async changeFilePromise(e,r,s={}){return Buffer.isBuffer(r)?this.changeFileBufferPromise(e,r,s):this.changeFileTextPromise(e,r,s)}async changeFileBufferPromise(e,r,{mode:s}={}){let a=Buffer.alloc(0);try{a=await this.readFilePromise(e)}catch{}Buffer.compare(a,r)!==0&&await this.writeFilePromise(e,r,{mode:s})}async changeFileTextPromise(e,r,{automaticNewlines:s,mode:a}={}){let n="";try{n=await this.readFilePromise(e,"utf8")}catch{}let l=s?ty(n,r):r;n!==l&&await this.writeFilePromise(e,l,{mode:a})}changeFileSync(e,r,s={}){return Buffer.isBuffer(r)?this.changeFileBufferSync(e,r,s):this.changeFileTextSync(e,r,s)}changeFileBufferSync(e,r,{mode:s}={}){let a=Buffer.alloc(0);try{a=this.readFileSync(e)}catch{}Buffer.compare(a,r)!==0&&this.writeFileSync(e,r,{mode:s})}changeFileTextSync(e,r,{automaticNewlines:s=!1,mode:a}={}){let n="";try{n=this.readFileSync(e,"utf8")}catch{}let l=s?ty(n,r):r;n!==l&&this.writeFileSync(e,l,{mode:a})}async movePromise(e,r){try{await this.renamePromise(e,r)}catch(s){if(s.code==="EXDEV")await this.copyPromise(r,e),await this.removePromise(e);else throw s}}moveSync(e,r){try{this.renameSync(e,r)}catch(s){if(s.code==="EXDEV")this.copySync(r,e),this.removeSync(e);else throw s}}async lockPromise(e,r){let s=`${e}.flock`,a=1e3/60,n=Date.now(),l=null,f=async()=>{let h;try{[h]=await this.readJsonPromise(s)}catch{return Date.now()-n<500}try{return process.kill(h,0),!0}catch{return!1}};for(;l===null;)try{l=await this.openPromise(s,"wx")}catch(h){if(h.code==="EEXIST"){if(!await f())try{await this.unlinkPromise(s);continue}catch{}if(Date.now()-n<60*1e3)await new Promise(A=>setTimeout(A,a));else throw new Error(`Couldn't acquire a lock in a reasonable time (via ${s})`)}else Line truncated
`)}writeJsonSync(e,r,{compact:s=!1}={}){let a=s?0:2;return this.writeFileSync(e,`${JSON.stringify(r,null,a)}
`)}async preserveTimePromise(e,r){let s=await this.lstatPromise(e),a=await r();typeof a<"u"&&(e=a),await this.lutimesPromise(e,s.atime,s.mtime)}async preserveTimeSync(e,r){let s=this.lstatSync(e),a=r();typeof a<"u"&&(e=a),this.lutimesSync(e,s.atime,s.mtime)}},Th=class extends Sp{constructor(){super(Y)}}});var fo,bp=tt(()=>{ry();fo=class extends Sp{getExtractHint(e){return this.baseFs.getExtractHint(e)}resolve(e){return this.mapFromBase(this.baseFs.resolve(this.mapToBase(e)))}getRealPath(){return this.mapFromBase(this.baseFs.getRealPath())}async openPromise(e,r,s){return this.baseFs.openPromise(this.mapToBase(e),r,s)}openSync(e,r,s){return this.baseFs.openSync(this.mapToBase(e),r,s)}async opendirPromise(e,r){return Object.assign(await this.baseFs.opendirPromise(this.mapToBase(e),r),{path:e})}opendirSync(e,r){return Object.assign(this.baseFs.opendirSync(this.mapToBase(e),r),{path:e})}async readPromise(e,r,s,a,n){return await this.baseFs.readPromise(e,r,s,a,n)}readSync(e,r,s,a,n){return this.baseFs.readSync(e,r,s,a,n)}async writePromise(e,r,s,a,n){return typeof r=="string"?await this.baseFs.writePromise(e,r,s):await this.baseFs.writePromise(e,r,s,a,n)}writeSync(e,r,s,a,n){return typeof r=="string"?this.baseFs.writeSync(e,r,s):this.baseFs.writeSync(e,r,s,a,n)}async closePromise(e){return this.baseFs.closePromise(e)}closeSync(e){this.baseFs.closeSync(e)}createReadStream(e,r){return this.baseFs.createReadStream(e!==null?this.mapToBase(e):e,r)}createWriteStream(e,r){return this.baseFs.createWriteStream(e!==null?this.mapToBase(e):e,r)}async realpathPromise(e){return this.mapFromBase(await this.baseFs.realpathPromise(this.mapToBase(e)))}realpathSync(e){return this.mapFromBase(this.baseFs.realpathSync(this.mapToBase(e)))}async existsPromise(e){return this.baseFs.existsPromise(this.mapToBase(e))}existsSync(e){return this.baseFs.existsSync(this.mapToBase(e))}accessSync(e,r){return this.baseFs.accessSync(this.mapToBase(e),r)}async accessPromise(e,r){return this.baseFs.accessPromise(this.mapToBase(e),r)}async statPromise(e,r){return this.baseFs.statPromise(this.mapToBase(e),r)}statSync(e,r){return this.baseFs.statSync(this.mapToBase(e),r)}async fstatPromise(e,r){return this.baseFs.fstatPromise(e,r)}fstatSync(e,r){return this.baseFs.fstatSync(e,r)}lstatPromise(e,r){return this.baseFs.lstatPromise(this.mapToBase(e),r)}lstatSync(e,r){return this.baseFs.lstatSync(this.mapToBase(e),r)}async fchmodPromise(e,r){return this.baseFs.fchmodPromise(e,r)}fchmodSync(e,r){return this.baseFs.fchmodSync(e,r)}async chmodPromise(e,r){return this.baseFs.chmodPromise(this.mapToBase(e),r)}chmodSync(e,r){return this.baseFs.chmodSync(this.mapToBase(e),r)}async fchownPromise(e,r,s){return this.baseFs.fchownPromise(e,r,s)}fchownSync(e,r,s){return this.baseFs.fchownSync(e,r,s)}async chownPromise(e,r,s){return this.baseFs.chownPromise(this.mapToBase(e),r,s)}chownSync(e,r,s){return this.baseFs.chownSync(this.mapToBase(e),r,s)}async renamePromise(e,r){return this.baseFs.renamePromise(this.mapToBase(e),this.mapToBase(r))}renameSync(e,r){return this.baseFs.renameSync(this.mapToBase(e),this.mapToBase(r))}async copyFilePromise(e,r,s=0){return this.baseFs.copyFilePromise(this.mapToBase(e),this.mapToBase(r),s)}copyFileSync(e,r,s=0){return this.baseFs.copyFileSync(this.mapToBase(e),this.mapToBase(r),s)}async appendFilePromise(e,r,s){return this.baseFs.appendFilePromise(this.fsMapToBase(e),r,s)}appendFileSync(e,r,s){return this.baseFs.appendFileSync(this.fsMapToBase(e),r,s)}async writeFilePromise(e,r,s){return this.baseFs.writeFilePromise(this.fsMapToBase(e),r,s)}writeFileSync(e,r,s){return this.baseFs.writeFileSync(this.fsMapToBase(e),r,s)}async unlinkPromise(e){return this.baseFs.unlinkPromise(this.mapToBase(e))}unlinkSync(e){return this.baseFs.unlinkSync(this.mapToBase(e))}async utimesPromise(e,r,s){return this.baseFs.utimesPromise(this.mapToBase(e),r,s)}utimesSync(e,r,s){return this.baseFs.utimesSync(this.mapToBase(e),r,s)}async lutimesPromise(e,r,s){return this.baseFs.lutimesPromise(this.mapToBase(e),r,s)}lutimesSync(e,r,s){return this.baseFs.lutimesSync(this.mapToBase(e),r,s)}async mkdirPromise(e,r){return this.baseFs.mkdirPromise(this.mapToBase(e),r)}mkdirSync(e,r){return this.baseFs.mkdirSync(this.mapToBase(e),r)}async rmdirPromise(e,r){return this.baseFs.rmdirPromise(this.mapToBase(e),r)}rmdirSync(e,r){return this.baseFs.rmdirSync(this.mapToBase(e),r)}async rmPromise(e,r){return this.baseFs.rmPromise(this.mapToBase(e),r)}rmSync(e,r){return this.baseFs.rmSync(this.mapToBase(e),r)}async linkPromise(e,r){return this.baseFs.linkPromise(this.mapToBase(e),this.mapToBase(r))}linkSync(e,r){return this.baseFs.linkSync(this.mapToBase(e),this.mapToBase(r))}async symlinkPromise(e,r,s){let a=this.mapToBase(r);if(this.pathUtils.isAbsolute(e))return this.baseFs.symlinkPromise(this.mapToBase(e),a,s);let n=this.mapToBase(this.pathUtils.join(this.pathUtils.dirname(r),e)),l=this.baseFs.pathUtils.relative(this.baseFs.pathUtils.dirname(a),n);return this.baseFs.symlinkP Line truncated
`,La=Pr(`\\
`,!1),HA=function(){return""},Ma="\\",Ua=Pr("\\",!1),jA=/^[\\$"`]/,Fr=ws(["\\","$",'"',"`"],!1,!1),Zo=function(O){return O},Ec="\\a",Ge=Pr("\\a",!1),Hr=function(){return"a"},oh="\\b",GA=Pr("\\b",!1),qA=function(){return"\b"},Zu=/^[Ee]/,Xu=ws(["E","e"],!1,!1),Vl=function(){return"\x1B"},ve="\\f",Jt=Pr("\\f",!1),Wl=function(){return"\f"},as="\\n",To=Pr("\\n",!1),Vt=function(){return`
`},ei="\\r",Ha=Pr("\\r",!1),As=function(){return"\r"},cs="\\t",Ic=Pr("\\t",!1),Un=function(){return" "},Ei="\\v",$u=Pr("\\v",!1),Ud=function(){return"\v"},wc=/^[\\'"?]/,Cc=ws(["\\","'",'"',"?"],!1,!1),Bc=function(O){return String.fromCharCode(parseInt(O,16))},it="\\x",vc=Pr("\\x",!1),ah="\\u",Yl=Pr("\\u",!1),Yn="\\U",ja=Pr("\\U",!1),VA=function(O){return String.fromCodePoint(parseInt(O,16))},WA=/^[0-7]/,Ga=ws([["0","7"]],!1,!1),ll=/^[0-9a-fA-f]/,rr=ws([["0","9"],["a","f"],["A","f"]],!1,!1),ti=fh(),qa="{}",Sc=Pr("{}",!1),ks=function(){return"{}"},Kl="-",ef=Pr("-",!1),zl="+",bc=Pr("+",!1),ls=".",Ys=Pr(".",!1),ul=function(O,J,se){return{type:"number",value:(O==="-"?-1:1)*parseFloat(J.join("")+"."+se.join(""))}},ch=function(O,J){return{type:"number",value:(O==="-"?-1:1)*parseInt(J.join(""))}},Jl=function(O){return{type:"variable",...O}},zi=function(O){return{type:"variable",name:O}},ri=function(O){return O},Zl="*",et=Pr("*",!1),dt="/",_t=Pr("/",!1),Sr=function(O,J,se){return{type:J==="*"?"multiplication":"division",right:se}},ne=function(O,J){return J.reduce((se,Ie)=>({left:se,...Ie}),O)},Be=function(O,J,se){return{type:J==="+"?"addition":"subtraction",right:se}},_e="$((",bt=Pr("$((",!1),xt="))",jt=Pr("))",!1),Ir=function(O){return O},Nn="$(",Qi=Pr("$(",!1),ps=function(O){return O},ni="${",Dc=Pr("${",!1),mI=":-",Iv=Pr(":-",!1),Xo=function(O,J){return{name:O,defaultValue:J}},yI=":-}",Hd=Pr(":-}",!1),wv=function(O){return{name:O,defaultValue:[]}},$o=":+",jd=Pr(":+",!1),Gd=function(O,J){return{name:O,alternativeValue:J}},tf=":+}",qd=Pr(":+}",!1),gm=function(O){return{name:O,alternativeValue:[]}},mm=function(O){return{name:O}},ym="$",EI=Pr("$",!1),lh=function(O){return e.isGlobPattern(O)},ea=function(O){return O},fl=/^[a-zA-Z0-9_]/,Vd=ws([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),Em=function(){return BI()},hl=/^[$@*?#a-zA-Z0-9_\-]/,Al=ws(["$","@","*","?","#",["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),II=/^[()}<>$|&; \t"']/,YA=ws(["(",")","}","<",">","$","|","&",";"," "," ",'"',"'"],!1,!1),wI=/^[<>&; \t"']/,CI=ws(["<",">","&",";"," "," ",'"',"'"],!1,!1),KA=/^[ \t]/,zA=ws([" "," "],!1,!1),K=0,Gt=0,JA=[{line:1,column:1}],ta=0,uh=[],Dt=0,rf;if("startRule"in e){if(!(e.startRule in s))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=s[e.startRule]}function BI(){return t.substring(Gt,K)}function Im(){return hh(Gt,K)}function Cv(O,J){throw J=J!==void 0?J:hh(Gt,K),ZA([wm(O)],t.substring(Gt,K),J)}function Wd(O,J){throw J=J!==void 0?J:hh(Gt,K),Ui(O,J)}function Pr(O,J){return{type:"literal",text:O,ignoreCase:J}}function ws(O,J,se){return{type:"class",parts:O,inverted:J,ignoreCase:se}}function fh(){return{type:"any"}}function Pc(){return{type:"end"}}function wm(O){return{type:"other",description:O}}function nf(O){var J=JA[O],se;if(J)return J;for(se=O-1;!JA[se];)se--;for(J=JA[se],J={line:J.line,column:J.column};se<O;)t.charCodeAt(se)===10?(J.line++,J.column=1):J.column++,se++;return JA[O]=J,J}function hh(O,J){var se=nf(O),Ie=nf(J);return{start:{offset:O,line:se.line,column:se.column},end:{offset:J,line:Ie.line,column:Ie.column}}}function Qt(O){K<ta||(K>ta&&(ta=K,uh=[]),uh.push(O))}function Ui(O,J){return new sy(O,null,null,J)}function ZA(O,J,se){return new sy(sy.buildMessage(O,J),O,J,se)}function xc(){var O,J,se;for(O=K,J=[],se=qt();se!==r;)J.push(se),se=qt();return J!==r?(se=Va(),se===r&&(se=null),se!==r?(Gt=O,J=n(se),O=J):(K=O,O=r)):(K=O,O=r),O}function Va(){var O,J,se,Ie,Xe;if(O=K,J=Yd(),J!==r){for(se=[],Ie=qt();Ie!==r;)se.push(Ie),Ie=qt();se!==r?(Ie=Cm(),Ie!==r?(Xe=kc(),Xe===r&&(Xe=null),Xe!==r?(Gt=O,J=l(J,Ie,Xe),O=J):(K=O,O=r)):(K=O,O=r)):(K=O,O=r)}else K=O,O=r;if(O===r)if(O=K,J=Yd(),J!==r){for(se=[],Ie=qt();Ie!==r;)se.push(Ie),Ie=qt();se!==r?(Ie=Cm(),Ie===r&&(Ie=null),Ie!==r?(Gt=O,J=f(J,Ie),O=J):(K=O,O=r)):(K=O,O=r)}else K=O,O=r;return O}function kc(){var O,J,se,Ie,Xe;for(O=K,J=[],se=qt();se!==r;)J.push(se),se=qt();if(J!==r)if(se=Va(),se!==r){for(Ie=[],Xe=qt();Xe!==r;)Ie.push(Xe),Xe=qt();Ie!==r?(Gt=O,J=h(se),O=J):(K=O,O=r)}else K=O,O=r;else K=O,O=r;return O}function Cm(){var O;return t.charCodeAt(K)===59?(O=A,K++):(O=r,Dt===0&&Qt(m)),O===r&&(t.charCodeAt(K)===38?(O=w,K++):(O=r,Dt===0&&Qt(v))),O}function Yd(){var O,J,se;return O=K,J=XA(),J!==r?(se=Bm(),se===r&&(se=null),se!==r?(Gt=O,J=D(J,se),O=J):(K=O,O=r)):(K=O,O=r),O}function Bm(){var O,J,se,Ie,Xe,It,Nr;for(O=K,J=[],se=qt();se!==r;)J.push(se),se=qt();if(J!==r)if(se=vI(),se!==r){for(Ie=[],Xe=qt();Xe!==r;)Ie.push(Xe),Xe=qt();if(Ie!==r)if(Xe=Yd(),Xe!==r){for(It=[],Nr=qt();Nr!==r;)It.push(Nr),Nr=qt();It!==r?(Gt=O,J=I(se,Xe),O=J):(K=O,O=r)}else K=O,O=r;else K=O,O=r}else K=O,O=r;else K=O,O=r;return O}function vI(){var O;return t.substr(K,2)===R?(O=R,K+=2):(O=r,Dt===0&&Qt(N)),O===r&&(t.substr(K,2)===U?(O=U,K+=2):(O=r,Dt===0&&Qt(V))),O}function XA(){var O,J,se;return O=K,J=Ah(),J!==r?(se=vm(),se===r&&(se=null),se!==r?(Gt=O,J=ee(J,se),O=J):(K=O,O=r)):(K=O,O=r),O}function vm(){var O,J,se,Ie,Xe,It,Nr;for(O=K,J=[],se=qt();se!==r;)J.push(se),se=qt();if(J!==r)Line truncated
`,"\\n"],["\r","\\r"],[" ","\\t"],["\v","\\v"],["\0","\\0"]]),j$e=new Map([["\\","\\\\"],["$","\\$"],['"','\\"'],...Array.from(tle,([t,e])=>[t,`"$'${e}'"`])]),rle=t=>tle.get(t)??`\\x${t.charCodeAt(0).toString(16).padStart(2,"0")}`,G$e=t=>j$e.get(t)??`"$'${rle(t)}'"`});var sle=H((uqt,ile)=>{"use strict";function q$e(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function ay(t,e,r,s){this.message=t,this.expected=e,this.found=r,this.location=s,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ay)}q$e(ay,Error);ay.buildMessage=function(t,e){var r={literal:function(A){return'"'+a(A.text)+'"'},class:function(A){var m="",w;for(w=0;w<A.parts.length;w++)m+=A.parts[w]instanceof Array?n(A.parts[w][0])+"-"+n(A.parts[w][1]):n(A.parts[w]);return"["+(A.inverted?"^":"")+m+"]"},any:function(A){return"any character"},end:function(A){return"end of input"},other:function(A){return A.description}};function s(A){return A.charCodeAt(0).toString(16).toUpperCase()}function a(A){return A.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(m){return"\\x0"+s(m)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(m){return"\\x"+s(m)})}function n(A){return A.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(m){return"\\x0"+s(m)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(m){return"\\x"+s(m)})}function l(A){return r[A.type](A)}function f(A){var m=new Array(A.length),w,v;for(w=0;w<A.length;w++)m[w]=l(A[w]);if(m.sort(),m.length>0){for(w=1,v=1;w<m.length;w++)m[w-1]!==m[w]&&(m[v]=m[w],v++);m.length=v}switch(m.length){case 1:return m[0];case 2:return m[0]+" or "+m[1];default:return m.slice(0,-1).join(", ")+", or "+m[m.length-1]}}function h(A){return A?'"'+a(A)+'"':"end of input"}return"Expected "+f(t)+" but "+h(e)+" found."};function V$e(t,e){e=e!==void 0?e:{};var r={},s={resolution:Fe},a=Fe,n="/",l=Ce("/",!1),f=function(Me,x){return{from:Me,descriptor:x}},h=function(Me){return{descriptor:Me}},A="@",m=Ce("@",!1),w=function(Me,x){return{fullName:Me,description:x}},v=function(Me){return{fullName:Me}},D=function(){return xe()},I=/^[^\/@]/,R=Ee(["/","@"],!0,!1),N=/^[^\/]/,U=Ee(["/"],!0,!1),V=0,ee=0,te=[{line:1,column:1}],ie=0,ae=[],ge=0,de;if("startRule"in e){if(!(e.startRule in s))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=s[e.startRule]}function xe(){return t.substring(ee,V)}function we(){return ot(ee,V)}function d(Me,x){throw x=x!==void 0?x:ot(ee,V),Ne([De(Me)],t.substring(ee,V),x)}function be(Me,x){throw x=x!==void 0?x:ot(ee,V),rt(Me,x)}function Ce(Me,x){return{type:"literal",text:Me,ignoreCase:x}}function Ee(Me,x,C){return{type:"class",parts:Me,inverted:x,ignoreCase:C}}function he(){return{type:"any"}}function $(){return{type:"end"}}function De(Me){return{type:"other",description:Me}}function Te(Me){var x=te[Me],C;if(x)return x;for(C=Me-1;!te[C];)C--;for(x=te[C],x={line:x.line,column:x.column};C<Me;)t.charCodeAt(C)===10?(x.line++,x.column=1):x.column++,C++;return te[Me]=x,x}function ot(Me,x){var C=Te(Me),P=Te(x);return{start:{offset:Me,line:C.line,column:C.column},end:{offset:x,line:P.line,column:P.column}}}function j(Me){V<ie||(V>ie&&(ie=V,ae=[]),ae.push(Me))}function rt(Me,x){return new ay(Me,null,null,x)}function Ne(Me,x,C){return new ay(ay.buildMessage(Me,x),Me,x,C)}function Fe(){var Me,x,C,P;return Me=V,x=Pe(),x!==r?(t.charCodeAt(V)===47?(C=n,V++):(C=r,ge===0&&j(l)),C!==r?(P=Pe(),P!==r?(ee=Me,x=f(x,P),Me=x):(V=Me,Me=r)):(V=Me,Me=r)):(V=Me,Me=r),Me===r&&(Me=V,x=Pe(),x!==r&&(ee=Me,x=h(x)),Me=x),Me}function Pe(){var Me,x,C,P;return Me=V,x=He(),x!==r?(t.charCodeAt(V)===64?(C=A,V++):(C=r,ge===0&&j(m)),C!==r?(P=ft(),P!==r?(ee=Me,x=w(x,P),Me=x):(V=Me,Me=r)):(V=Me,Me=r)):(V=Me,Me=r),Me===r&&(Me=V,x=He(),x!==r&&(ee=Me,x=v(x)),Me=x),Me}function He(){var Me,x,C,P,E;return Me=V,t.charCodeAt(V)===64?(x=A,V++):(x=r,ge===0&&j(m)),x!==r?(C=Qe(),C!==r?(t.charCodeAt(V)===47?(P=n,V++):(P=r,ge===0&&j(l)),P!==r?(E=Qe(),E!==r?(ee=Me,x=D(),Me=x):(V=Me,Me=r)):(V=Me,Me=r)):(V=Me,Me=r)):(V=Me,Me=r),Me===r&&(Me=V,x=Qe(),x!==r&&(ee=Me,x=D()),Me=x),Me}function Qe(){var Me,x,C;if(Me=V,x=[],I.test(t.charAt(V))?(C=t.charAt(V),V++):(C=r,ge===0&&j(R)),C!==r)for(;C!==r;)x.push(C),I.test(t.charAt(V))?(C=t.charAt(V),V++):(C=r,ge===0&&j(R));else x=r;return x!==r&&(ee=Me,x=D()),Me=x,Me}function ft(){var Me,x,C;if(Me=V,x=[],N.test(t.charAt(V))?(C=t.charAt(V),V++):(C=r,ge===0&&j(U)),C!==r)for(;C!==r;)x.push(C),N.test(t.charAt(V))?(C=t.charAt(V),V++):(C=r,ge===0&&j(U));else x=r;return x!==r&&(ee=Me,x=D()),Me=x,Me}if(de=a(),de!==r&&V===t.length)return de;throw de!==r&&V<t.length&&j($()),Ne(ae,ie<t.length?t.charAt(ie):null,ie<t.length?ot(ie,ie+1):ot(ie,ie))}ile.exports={SyntaxError:ay,parse:V$e}});function kT(t){let e=t.match(/^\*{1,Line truncated
`+r.mark.snippet),n+" "+a):n}function e(r,s){Error.call(this),this.name="YAMLException",this.reason=r,this.mark=s,this.message=t(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(s){return this.name+": "+t(this,s)},j6=e,j6}function Y$e(){if(ule)return G6;ule=1;let t=uS();function e(a,n,l,f,h){let A="",m="",w=Math.floor(h/2)-1;return f-n>w&&(A=" ... ",n=f-w+A.length),l-f>w&&(m=" ...",l=f+w-m.length),{str:A+a.slice(n,l).replace(/\t/g,"\u2192")+m,pos:f-n+A.length}}function r(a,n){return t.repeat(" ",n-a.length)+a}function s(a,n){if(n=Object.create(n||null),!a.buffer)return null;n.maxLength||(n.maxLength=79),typeof n.indent!="number"&&(n.indent=1),typeof n.linesBefore!="number"&&(n.linesBefore=3),typeof n.linesAfter!="number"&&(n.linesAfter=2);let l=/\r?\n|\r|\0/g,f=[0],h=[],A,m=-1;for(;A=l.exec(a.buffer);)h.push(A.index),f.push(A.index+A[0].length),a.position<=A.index&&m<0&&(m=f.length-2);m<0&&(m=f.length-1);let w="",v=Math.min(a.line+n.linesAfter,h.length).toString().length,D=n.maxLength-(n.indent+v+3);for(let R=1;R<=n.linesBefore&&!(m-R<0);R++){let N=e(a.buffer,f[m-R],h[m-R],a.position-(f[m]-f[m-R]),D);w=t.repeat(" ",n.indent)+r((a.line-R+1).toString(),v)+" | "+N.str+`
`+w}let I=e(a.buffer,f[m],h[m],a.position,D);w+=t.repeat(" ",n.indent)+r((a.line+1).toString(),v)+" | "+I.str+`
`,w+=t.repeat("-",n.indent+v+3+I.pos)+`^
`;for(let R=1;R<=n.linesAfter&&!(m+R>=h.length);R++){let N=e(a.buffer,f[m+R],h[m+R],a.position-(f[m]-f[m+R]),D);w+=t.repeat(" ",n.indent)+r((a.line+R+1).toString(),v)+" | "+N.str+`
`}return w.replace(/\n$/,"")}return G6=s,G6}function Za(){if(fle)return q6;fle=1;let t=fS(),e=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],r=["scalar","sequence","mapping"];function s(n){let l={};return n!==null&&Object.keys(n).forEach(function(f){n[f].forEach(function(h){l[String(h)]=f})}),l}function a(n,l){if(l=l||{},Object.keys(l).forEach(function(f){if(e.indexOf(f)===-1)throw new t('Unknown option "'+f+'" is met in definition of "'+n+'" YAML type.')}),this.options=l,this.tag=n,this.kind=l.kind||null,this.resolve=l.resolve||function(){return!0},this.construct=l.construct||function(f){return f},this.instanceOf=l.instanceOf||null,this.predicate=l.predicate||null,this.represent=l.represent||null,this.representName=l.representName||null,this.defaultStyle=l.defaultStyle||null,this.multi=l.multi||!1,this.styleAliases=s(l.styleAliases||null),r.indexOf(this.kind)===-1)throw new t('Unknown kind "'+this.kind+'" is specified for "'+n+'" YAML type.')}return q6=a,q6}function Qle(){if(hle)return V6;hle=1;let t=fS(),e=Za();function r(n,l){let f=[];return n[l].forEach(function(h){let A=f.length;f.forEach(function(m,w){m.tag===h.tag&&m.kind===h.kind&&m.multi===h.multi&&(A=w)}),f[A]=h}),f}function s(){let n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function l(f){f.multi?(n.multi[f.kind].push(f),n.multi.fallback.push(f)):n[f.kind][f.tag]=n.fallback[f.tag]=f}for(let f=0,h=arguments.length;f<h;f+=1)arguments[f].forEach(l);return n}function a(n){return this.extend(n)}return a.prototype.extend=function(l){let f=[],h=[];if(l instanceof e)h.push(l);else if(Array.isArray(l))h=h.concat(l);else if(l&&(Array.isArray(l.implicit)||Array.isArray(l.explicit)))l.implicit&&(f=f.concat(l.implicit)),l.explicit&&(h=h.concat(l.explicit));else throw new t("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");f.forEach(function(m){if(!(m instanceof e))throw new t("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(m.loadKind&&m.loadKind!=="scalar")throw new t("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(m.multi)throw new t("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),h.forEach(function(m){if(!(m instanceof e))throw new t("Specified list of YAML types (or a single Type object) contains a non-Type object.")});let A=Object.create(a.prototype);return A.implicit=(this.implicit||[]).concat(f),A.explicit=(this.explicit||[]).concat(h),A.compiledImplicit=r(A,"implicit"),A.compiledExplicit=r(A,"explicit"),A.compiledTypeMap=s(A.compiledImplicit,A.compiledExplicit),A},V6=a,V6}function Fle(){if(Ale)return W6;Ale=1;let t=Za();return W6=new t("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),W6}function Nle(){if(ple)return Y6;ple=1;let t=Za();return Y6=new t("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Y6}function Ole(){if(dle)return K6;dle=1;let t=Za();return K6=new t("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),K6}function Lle(){if(gle)return z6;gle=1;let t=Qle();return z6=new t({explicit:[Fle(),Nle(),Ole()]}),z6}function _le(){if(mle)return J6;mle=1;let t=Za();function e(a){if(a===null)return!0;let n=a.length;return n===1&&a==="~"||n===4&&(a==="null"||a==="Null"||a==="NULL")}function r(){return null}function s(a){return a===null}return J6=new t("tag:yaml.org,2002:null",{kind:"scalar",resolve:e,construct:r,predicate:s,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),J6}function Mle(){if(yle)return Z6;yle=1;let t=Za();function e(a){if(a===null)return!1;let n=a.length;return n===4&&(a==="true"||a==="True"||a==="TRUE")||n===5&&(a==="false"||a==="False"||a==="FALSE")}function r(a){return a==="true"||a==="True"||a==="TRUE"}function s(a){return Object.prototype.toString.call(a)==="[object Boolean]"}return Z6=new t("tag:yaml.org,2002:bool",{kind:"scalar",resolve:e,construct:r,predicate:s,represent:{lowercase:function(a){return a?"true":"false"},uppercase:function(a){return a?"TRUE":"FALSE"},camelcase:function(a){return a?"True":"False"}},defaultStyle:"lowercase"}),Z6}function Ule(){if(Ele)return X6;Ele=1;let t=uS(),e=Za();function r(A){return A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102}function s(A){return A>=48&&A<=55}function a(A){return A>=48&&A<=57}function n(A){if(A===null)return!1;let m=A.length,w=0,v=!1;if(!m)return!1;let D=A[w];if((D==="-"||D==="+")&&(D=A[++w]),D==="0"){if(w+1===m)return!0;if(D=A[++w],D==="b"){for(w++;w<m;w++){if(D=A[w],D!=="0"&&D!=="1")return!1;v=!0}return v&&isFinite(l(A))}if(D==="x"){for(w++;w<m;w++){if(!r(A.cha Line truncated
\r`;function r(l){if(l===null)return!1;let f=0,h=l.length,A=e;for(let m=0;m<h;m++){let w=A.indexOf(l.charAt(m));if(!(w>64)){if(w<0)return!1;f+=6}}return f%8===0}function s(l){let f=l.replace(/[\r\n=]/g,""),h=f.length,A=e,m=0,w=[];for(let D=0;D<h;D++)D%4===0&&D&&(w.push(m>>16&255),w.push(m>>8&255),w.push(m&255)),m=m<<6|A.indexOf(f.charAt(D));let v=h%4*6;return v===0?(w.push(m>>16&255),w.push(m>>8&255),w.push(m&255)):v===18?(w.push(m>>10&255),w.push(m>>2&255)):v===12&&w.push(m>>4&255),new Uint8Array(w)}function a(l){let f="",h=0,A=l.length,m=e;for(let v=0;v<A;v++)v%3===0&&v&&(f+=m[h>>18&63],f+=m[h>>12&63],f+=m[h>>6&63],f+=m[h&63]),h=(h<<8)+l[v];let w=A%3;return w===0?(f+=m[h>>18&63],f+=m[h>>12&63],f+=m[h>>6&63],f+=m[h&63]):w===2?(f+=m[h>>10&63],f+=m[h>>4&63],f+=m[h<<2&63],f+=m[64]):w===1&&(f+=m[h>>2&63],f+=m[h<<4&63],f+=m[64],f+=m[64]),f}function n(l){return Object.prototype.toString.call(l)==="[object Uint8Array]"}return iH=new t("tag:yaml.org,2002:binary",{kind:"scalar",resolve:r,construct:s,predicate:n,represent:a}),iH}function Yle(){if(ble)return sH;ble=1;let t=Za(),e=Object.prototype.hasOwnProperty,r=Object.prototype.toString;function s(n){if(n===null)return!0;let l=[],f=n;for(let h=0,A=f.length;h<A;h+=1){let m=f[h],w=!1;if(r.call(m)!=="[object Object]")return!1;let v;for(v in m)if(e.call(m,v))if(!w)w=!0;else return!1;if(!w)return!1;if(l.indexOf(v)===-1)l.push(v);else return!1}return!0}function a(n){return n!==null?n:[]}return sH=new t("tag:yaml.org,2002:omap",{kind:"sequence",resolve:s,construct:a}),sH}function Kle(){if(Dle)return oH;Dle=1;let t=Za(),e=Object.prototype.toString;function r(a){if(a===null)return!0;let n=a,l=new Array(n.length);for(let f=0,h=n.length;f<h;f+=1){let A=n[f];if(e.call(A)!=="[object Object]")return!1;let m=Object.keys(A);if(m.length!==1)return!1;l[f]=[m[0],A[m[0]]]}return!0}function s(a){if(a===null)return[];let n=a,l=new Array(n.length);for(let f=0,h=n.length;f<h;f+=1){let A=n[f],m=Object.keys(A);l[f]=[m[0],A[m[0]]]}return l}return oH=new t("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:r,construct:s}),oH}function zle(){if(Ple)return aH;Ple=1;let t=Za(),e=Object.prototype.hasOwnProperty;function r(a){if(a===null)return!0;let n=a;for(let l in n)if(e.call(n,l)&&n[l]!==null)return!1;return!0}function s(a){return a!==null?a:{}}return aH=new t("tag:yaml.org,2002:set",{kind:"mapping",resolve:r,construct:s}),aH}function uH(){return xle||(xle=1,cH=Gle().extend({implicit:[qle(),Vle()],explicit:[Wle(),Yle(),Kle(),zle()]})),cH}function K$e(){if(kle)return TT;kle=1;let t=uS(),e=fS(),r=Y$e(),s=uH(),a=Object.prototype.hasOwnProperty,n=1,l=2,f=3,h=4,A=1,m=2,w=3,v=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,D=/[\x85\u2028\u2029]/,I=/[,\[\]{}]/,R=/^(?:!|!!|![0-9A-Za-z-]+!)$/,N=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function U(_){return Object.prototype.toString.call(_)}function V(_){return _===10||_===13}function ee(_){return _===9||_===32}function te(_){return _===9||_===32||_===10||_===13}function ie(_){return _===44||_===91||_===93||_===123||_===125}function ae(_){if(_>=48&&_<=57)return _-48;let Ue=_|32;return Ue>=97&&Ue<=102?Ue-97+10:-1}function ge(_){return _===120?2:_===117?4:_===85?8:0}function de(_){return _>=48&&_<=57?_-48:-1}function xe(_){switch(_){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function we(_){return _<=65535?String.fromCharCode(_):String.fromCharCode((_-65536>>10)+55296,(_-65536&1023)+56320)}function d(_,Ue,lt){Ue==="__proto__"?Object.defineProperty(_,Ue,{configurable:!0,enumerable:!0,writable:!0,value:lt}):_[Ue]=lt}let be=new Array(256),Ce=new Array(256);for(let _=0;_<256;_++)be[_]=xe(_)?1:0,Ce[_]=xe(_);function Ee(_,Ue){this.input=_,this.filename=Ue.filename||null,this.schema=Ue.schema||s,this.onWarning=Ue.onWarning||null,this.legacy=Ue.legacy||!1,this.json=Ue.json||!1,this.listener=Ue.listener||null,this.maxDepth=typeof Ue.maxDepth=="number"?Ue.maxDepth:100,this.maxTotalMergeKeys=typeof Ue.maxTotalMergeKeys=="number"?Ue.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=_.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function he(_,Ue){let lt={name:_.filename,buffer:_.input.slice(0,-1),position:_.position,line:_.line,column:_.position-_.lineStart};return lt.snippet=r(lt),new e(Ue,lt)}function $(_,Ue){throw he(_,Ue)}function De(_,Ue){_.onWarning&&_.onWarning.call(null,he(_,Ue))}function Te(_,Ue,lt){let Bt=_.anchorMapTransactions;if(Bt.length!==0){let ct=Bt[Bt.length-1];a.call(ct,Ue)||(ct[Ue]={existed:a.call(_.anchorMap,Ue),value:_.anchorMap[Ue]})}_.anchorMap[Ue]=lt}function ot(_){_.anchorMapTransactions.push(Object.create(null))}function j(_){let Ue=_.anchorMapTransactions.pop(),lt=_.anchorMapTransactions;if(lt.length===0)return;let Bt=lt[lt.length-1],ct=Object.keys(Ue);for(let Ft=0,le=ct.length;Ft<le;Ft+=1){let Ze=ct[Ft];a.call(Bt,Ze)||(Bt[Ze]=Ue[Ze])}}function rt(_){let Ue=_.anchorMapTransactions.pop(),lt=Object.keys(Ue);for(let Bt=lt.length-1;Bt>=0;Bt-=1){let ct=Ue[lt[Bt]];ct.existed?_.anchorMap[lt[Bt]]=ct.value:delete _.anchorMap[lt[Bt]]}}function Ne(_){return{position:_.position,line:_.line,lineStart:_.lineStart,lineIndent:_.lineIndent,firstTabInLine:_.firstTabInLine,tag:_.tag,anchor:_.anchor,kind:_.kind,result:_.result}}function Fe(_,Ue){_.position=Ue.position,_.line=Ue.line,_.lineStart=Ue.lineStart,_.lineIndent=Ue.lineIndent,_.firstTabInLine=Ue.firstTabInLine,_.tag=Ue.tag,_.anchor=Ue.anchor,_.kind=Ue.kind,_.result=Ue.result}let Pe={YAML:function(Ue,lt,Bt){Ue.version!==null&&$(Ue,"duplication of %YAML directive"),Bt.length!==1&&$(Ue,"YAML directive accepts exactly one argument");let ct=/^([0-9]+)\.([0-9]+)$/.exec(Bt[0]);ct===null&&$(Ue,"ill-formed argument of the YAML directive");let Ft=parseInt(ct[1],10),le=parseInt(ct[2],10);Ft!==1&&$(Ue,"unacceptable YAML version of the document"),Ue.version=Bt[0],Ue.checkLineBreaks=le<2,le!==1&&le!==2&&De(Ue,"unsupported YAML version of the document")},TAG:function(Ue,lt,Bt){let ct;Bt.length!==2&&$(Ue,"TAG directive accepts exactly two arguments");let Ft=Bt[0];ct=Bt[1],R.test(Ft)||$(Ue,"ill-formed tag handle (first argument) of the TAG directive"),a.call(Ue.tagMap,Ft)&&$(Ue,'there is a previously declared suffix for "'+Ft+'" tag handle'),N.test(ct)||$(Ue,"ill-formed tag prefix (second argument) of the TAG directive");try{ct=decodeURIComponent(ct)}catch{$(Ue,"tag prefix is malformed: "+ct)}Ue.tagMap[Ft]=ct}};function He(_,Ue,lt,Bt){if(Ue<lt){let ct=_.input.slice(Ue,lt);if(Bt)for(let Ft=0,le=ct.length;Ft<le;Ft+=1){let Ze=ct.charCodeAt(Ft);Ze===9||Ze>=32&&Ze<=1114111||$(_,"expected valid JSON character")}else v.test(ct)&&$(_,"the stream contains non-printable characters");_.result+=ct}}function Qe(_,Ue,lt,Bt){t.isObject(lt)||$(_,"cannot merge mappings; the provided source object is unacceptable");let ct=Object.keys(lt);for(let Ft=0,le=ct.length;Ft<le;Ft+=1){let Ze=ct[Ft];_.maxTotalMergeKeys!==-1&&++_.totalMergeKeys>_.maxTotalMergeKeys&&$(_,"merge keys exceeded maxTotalMergeKeys ("+_.maxTotalMergeKeys+")"),a.call(Ue,Ze)||(d(Ue,Ze,lt[Ze]),Bt[Ze]=!0)}}function ft(_,Ue,lt,Bt,ct,Ft,le,Ze,Tt){if(Array.isArray(ct)){ct=Array.prototype.slice.call(ct);for(let Et=0,Pt=ct.length;Et<Pt;Et+=1)Array.isArray(ct[Et])&&$(_,"nested arrays are not supported inside keys"),typeof ct=="object"&&U(ct[Et])==="[object Object]"&&(ct[Et]="[object Object]")}if(typeof ct=="object"&&U(ct)==="[object Object]"&&(ct="[object Object]"),ct=String(ct),Ue===null&&(Ue={}),Bt==="tag:yaml.org,2002:merge")if(Array.isArray(Ft))for(let Et=0,Pt=Ft.length;Et<Pt;Et+=1)Qe(_,Ue,Ft[Et],lt);else Qe(_,Ue,Ft,lt);else!_.json&&!a.call(lt,ct)&&a.call(Ue,ct)&&(_.line=le||_.line,_.lineStart=Ze||_.lineStart,_.position=Tt||_.position,$(_,"duplicated mapping key")),d(Ue,ct,Ft),delete lt[ct];return Ue}function Me(_){let Ue=_.input.charCodeAt(_.position);Ue===10?_.position++:Ue===13?(_.position++,_.input.charCodeAt(_.position)===10&&_.position+ Line truncated
`,Ue-1))}function E(_,Ue,lt){let Bt,ct,Ft,le,Ze,Tt,Et=_.kind,Pt=_.result,Lt=_.input.charCodeAt(_.position);if(te(Lt)||ie(Lt)||Lt===35||Lt===38||Lt===42||Lt===33||Lt===124||Lt===62||Lt===39||Lt===34||Lt===37||Lt===64||Lt===96)return!1;if(Lt===63||Lt===45){let Nt=_.input.charCodeAt(_.position+1);if(te(Nt)||lt&&ie(Nt))return!1}for(_.kind="scalar",_.result="",Bt=ct=_.position,Ft=!1;Lt!==0;){if(Lt===58){let Nt=_.input.charCodeAt(_.position+1);if(te(Nt)||lt&&ie(Nt))break}else if(Lt===35){let Nt=_.input.charCodeAt(_.position-1);if(te(Nt))break}else{if(_.position===_.lineStart&&C(_)||lt&&ie(Lt))break;if(V(Lt))if(le=_.line,Ze=_.lineStart,Tt=_.lineIndent,x(_,!1,-1),_.lineIndent>=Ue){Ft=!0,Lt=_.input.charCodeAt(_.position);continue}else{_.position=ct,_.line=le,_.lineStart=Ze,_.lineIndent=Tt;break}}Ft&&(He(_,Bt,ct,!1),P(_,_.line-le),Bt=ct=_.position,Ft=!1),ee(Lt)||(ct=_.position+1),Lt=_.input.charCodeAt(++_.position)}return He(_,Bt,ct,!1),_.result?!0:(_.kind=Et,_.result=Pt,!1)}function F(_,Ue){let lt,Bt,ct=_.input.charCodeAt(_.position);if(ct!==39)return!1;for(_.kind="scalar",_.result="",_.position++,lt=Bt=_.position;(ct=_.input.charCodeAt(_.position))!==0;)if(ct===39)if(He(_,lt,_.position,!0),ct=_.input.charCodeAt(++_.position),ct===39)lt=_.position,_.position++,Bt=_.position;else return!0;else V(ct)?(He(_,lt,Bt,!0),P(_,x(_,!1,Ue)),lt=Bt=_.position):_.position===_.lineStart&&C(_)?$(_,"unexpected end of the document within a single quoted scalar"):(_.position++,ee(ct)||(Bt=_.position));$(_,"unexpected end of the stream within a single quoted scalar")}function Z(_,Ue){let lt,Bt,ct,Ft=_.input.charCodeAt(_.position);if(Ft!==34)return!1;for(_.kind="scalar",_.result="",_.position++,lt=Bt=_.position;(Ft=_.input.charCodeAt(_.position))!==0;){if(Ft===34)return He(_,lt,_.position,!0),_.position++,!0;if(Ft===92){if(He(_,lt,_.position,!0),Ft=_.input.charCodeAt(++_.position),V(Ft))x(_,!1,Ue);else if(Ft<256&&be[Ft])_.result+=Ce[Ft],_.position++;else if((ct=ge(Ft))>0){let le=ct,Ze=0;for(;le>0;le--)Ft=_.input.charCodeAt(++_.position),(ct=ae(Ft))>=0?Ze=(Ze<<4)+ct:$(_,"expected hexadecimal character");_.result+=we(Ze),_.position++}else $(_,"unknown escape sequence");lt=Bt=_.position}else V(Ft)?(He(_,lt,Bt,!0),P(_,x(_,!1,Ue)),lt=Bt=_.position):_.position===_.lineStart&&C(_)?$(_,"unexpected end of the document within a double quoted scalar"):(_.position++,ee(Ft)||(Bt=_.position))}$(_,"unexpected end of the stream within a double quoted scalar")}function X(_,Ue){let lt=!0,Bt,ct,Ft,le=_.tag,Ze,Tt=_.anchor,Et,Pt,Lt,Nt,hr=Object.create(null),Xt,$t,Er,Yr=_.input.charCodeAt(_.position);if(Yr===91)Et=93,Nt=!1,Ze=[];else if(Yr===123)Et=125,Nt=!0,Ze={};else return!1;for(_.anchor!==null&&Te(_,_.anchor,Ze),Yr=_.input.charCodeAt(++_.position);Yr!==0;){if(x(_,!0,Ue),Yr=_.input.charCodeAt(_.position),Yr===Et)return _.position++,_.tag=le,_.anchor=Tt,_.kind=Nt?"mapping":"sequence",_.result=Ze,!0;if(lt?Yr===44&&$(_,"expected the node content, but found ','"):$(_,"missed comma between flow collection entries"),$t=Xt=Er=null,Pt=Lt=!1,Yr===63){let Tn=_.input.charCodeAt(_.position+1);te(Tn)&&(Pt=Lt=!0,_.position++,x(_,!0,Ue))}Bt=_.line,ct=_.lineStart,Ft=_.position,ur(_,Ue,n,!1,!0),$t=_.tag,Xt=_.result,x(_,!0,Ue),Yr=_.input.charCodeAt(_.position),(Lt||_.line===Bt)&&Yr===58&&(Pt=!0,Yr=_.input.charCodeAt(++_.position),x(_,!0,Ue),ur(_,Ue,n,!1,!0),Er=_.result),Nt?ft(_,Ze,hr,$t,Xt,Er,Bt,ct,Ft):Pt?Ze.push(ft(_,null,hr,$t,Xt,Er,Bt,ct,Ft)):Ze.push(Xt),x(_,!0,Ue),Yr=_.input.charCodeAt(_.position),Yr===44?(lt=!0,Yr=_.input.charCodeAt(++_.position)):lt=!1}$(_,"unexpected end of the stream within a flow collection")}function re(_,Ue){let lt,Bt=A,ct=!1,Ft=!1,le=Ue,Ze=0,Tt=!1,Et,Pt=_.input.charCodeAt(_.position);if(Pt===124)lt=!1;else if(Pt===62)lt=!0;else return!1;for(_.kind="scalar",_.result="";Pt!==0;)if(Pt=_.input.charCodeAt(++_.position),Pt===43||Pt===45)A===Bt?Bt=Pt===43?w:m:$(_,"repeat of a chomping mode identifier");else if((Et=de(Pt))>=0)Et===0?$(_,"bad explicit indentation width of a block scalar; it cannot be less than one"):Ft?$(_,"repeat of an indentation width identifier"):(le=Ue+Et-1,Ft=!0);else break;if(ee(Pt)){do Pt=_.input.charCodeAt(++_.position);while(ee(Pt));if(Pt===35)do Pt=_.input.charCodeAt(++_.position);while(!V(Pt)&&Pt!==0)}for(;Pt!==0;){for(Me(_),_.lineIndent=0,Pt=_.input.charCodeAt(_.position);(!Ft||_.lineIndent<le)&&Pt===32;)_.lineIndent++,Pt=_.input.charCodeAt(++_.position);if(!Ft&&_.lineIndent>le&&(le=_.lineIndent),V(Pt)){Ze++;continue}if(!Ft&&le===0&&$(_,"missing indentation for block scalar"),_.lineIndent<le){Bt===w?_.result+=t.repeat(`
`,ct?1+Ze:Ze):Bt===A&&ct&&(_.result+=`
`);break}lt?ee(Pt)?(Tt=!0,_.result+=t.repeat(`
`,ct?1+Ze:Ze)):Tt?(Tt=!1,_.result+=t.repeat(`
`,Ze+1)):Ze===0?ct&&(_.result+=" "):_.result+=t.repeat(`
`,Ze):_.result+=t.repeat(`
`,ct?1+Ze:Ze),ct=!0,Ft=!0,Ze=0;let Lt=_.position;for(;!V(Pt)&&Pt!==0;)Pt=_.input.charCodeAt(++_.position);He(_,Lt,_.position,!1)}return!0}function ce(_,Ue){let lt=_.tag,Bt=_.anchor,ct=[],Ft=!1;if(_.firstTabInLine!==-1)return!1;_.anchor!==null&&Te(_,_.anchor,ct);let le=_.input.charCodeAt(_.position);for(;le!==0&&(_.firstTabInLine!==-1&&(_.position=_.firstTabInLine,$(_,"tab characters must not be used in indentation")),le===45);){let Ze=_.input.charCodeAt(_.position+1);if(!te(Ze))break;if(Ft=!0,_.position++,x(_,!0,-1)&&_.lineIndent<=Ue){ct.push(null),le=_.input.charCodeAt(_.position);continue}let Tt=_.line;if(ur(_,Ue,f,!1,!0),ct.push(_.result),x(_,!0,-1),le=_.input.charCodeAt(_.position),(_.line===Tt||_.lineIndent>Ue)&&le!==0)$(_,"bad indentation of a sequence entry");else if(_.lineIndent<Ue)break}return Ft?(_.tag=lt,_.anchor=Bt,_.kind="sequence",_.result=ct,!0):!1}function ke(_,Ue,lt){let Bt,ct,Ft,le,Ze=_.tag,Tt=_.anchor,Et={},Pt=Object.create(null),Lt=null,Nt=null,hr=null,Xt=!1,$t=!1;if(_.firstTabInLine!==-1)return!1;_.anchor!==null&&Te(_,_.anchor,Et);let Er=_.input.charCodeAt(_.position);for(;Er!==0;){!Xt&&_.firstTabInLine!==-1&&(_.position=_.firstTabInLine,$(_,"tab characters must not be used in indentation"));let Yr=_.input.charCodeAt(_.position+1),Tn=_.line;if((Er===63||Er===58)&&te(Yr))Er===63?(Xt&&(ft(_,Et,Pt,Lt,Nt,null,ct,Ft,le),Lt=Nt=hr=null),$t=!0,Xt=!0,Bt=!0):Xt?(Xt=!1,Bt=!0):$(_,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),_.position+=1,Er=Yr;else{if(ct=_.line,Ft=_.lineStart,le=_.position,!ur(_,lt,l,!1,!0))break;if(_.line===Tn){for(Er=_.input.charCodeAt(_.position);ee(Er);)Er=_.input.charCodeAt(++_.position);if(Er===58)Er=_.input.charCodeAt(++_.position),te(Er)||$(_,"a whitespace character is expected after the key-value separator within a block mapping"),Xt&&(ft(_,Et,Pt,Lt,Nt,null,ct,Ft,le),Lt=Nt=hr=null),$t=!0,Xt=!1,Bt=!1,Lt=_.tag,Nt=_.result;else if($t)$(_,"can not read an implicit mapping pair; a colon is missed");else return _.tag=Ze,_.anchor=Tt,!0}else if($t)$(_,"can not read a block mapping entry; a multiline key may not be an implicit key");else return _.tag=Ze,_.anchor=Tt,!0}if((_.line===Tn||_.lineIndent>Ue)&&(Xt&&(ct=_.line,Ft=_.lineStart,le=_.position),ur(_,Ue,h,!0,Bt)&&(Xt?Nt=_.result:hr=_.result),Xt||(ft(_,Et,Pt,Lt,Nt,hr,ct,Ft,le),Lt=Nt=hr=null),x(_,!0,-1),Er=_.input.charCodeAt(_.position)),(_.line===Tn||_.lineIndent>Ue)&&Er!==0)$(_,"bad indentation of a mapping entry");else if(_.lineIndent<Ue)break}return Xt&&ft(_,Et,Pt,Lt,Nt,null,ct,Ft,le),$t&&(_.tag=Ze,_.anchor=Tt,_.kind="mapping",_.result=Et),$t}function Le(_){let Ue=!1,lt=!1,Bt,ct,Ft=_.input.charCodeAt(_.position);if(Ft!==33)return!1;_.tag!==null&&$(_,"duplication of a tag property"),Ft=_.input.charCodeAt(++_.position),Ft===60?(Ue=!0,Ft=_.input.charCodeAt(++_.position)):Ft===33?(lt=!0,Bt="!!",Ft=_.input.charCodeAt(++_.position)):Bt="!";let le=_.position;if(Ue){do Ft=_.input.charCodeAt(++_.position);while(Ft!==0&&Ft!==62);_.position<_.length?(ct=_.input.slice(le,_.position),Ft=_.input.charCodeAt(++_.position)):$(_,"unexpected end of the stream within a verbatim tag")}else{for(;Ft!==0&&!te(Ft);)Ft===33&&(lt?$(_,"tag suffix cannot contain exclamation marks"):(Bt=_.input.slice(le-1,_.position+1),R.test(Bt)||$(_,"named tag handle cannot contain such characters"),lt=!0,le=_.position+1)),Ft=_.input.charCodeAt(++_.position);ct=_.input.slice(le,_.position),I.test(ct)&&$(_,"tag suffix cannot contain flow indicator characters")}ct&&!N.test(ct)&&$(_,"tag name cannot contain such characters: "+ct);try{ct=decodeURIComponent(ct)}catch{$(_,"tag name is malformed: "+ct)}return Ue?_.tag=ct:a.call(_.tagMap,Bt)?_.tag=_.tagMap[Bt]+ct:Bt==="!"?_.tag="!"+ct:Bt==="!!"?_.tag="tag:yaml.org,2002:"+ct:$(_,'undeclared tag handle "'+Bt+'"'),!0}function pt(_){let Ue=_.input.charCodeAt(_.position);if(Ue!==38)return!1;_.anchor!==null&&$(_,"duplication of an anchor property"),Ue=_.input.charCodeAt(++_.position);let lt=_.position;for(;Ue!==0&&!te(Ue)&&!ie(Ue);)Ue=_.input.charCodeAt(++_.position);return _.position===lt&&$(_,"name of an anchor node must contain at least one character"),_.anchor=_.input.slice(lt,_.position),!0}function St(_){let Ue=_.input.charCodeAt(_.position);if(Ue!==42)return!1;Ue=_.input.charCodeAt(++_.position);let lt=_.position;for(;Ue!==0&&!te(Ue)&&!ie(Ue);)Ue=_.input.charCodeAt(++_.position);_.position===lt&&$(_,"name of an alias node must contain at least one character");let Bt=_.input.slice(lt,_.position);return a.call(_.anchorMap,Bt)||$(_,'unidentified alias "'+Bt+'"'),_.result=_.anchorMap[Bt],x(_,!0,-1),!0}function er(_,Ue,lt,Bt){let ct=Ne(_);return ot(_),Fe(_,Ue),_.tag=null,_.anchor=null,_.kind=null,_.result=null,ke(_,lt,Bt)&&_.kind==="mapping"?(j(_),!0):(rt(_),Fe(_,ct),!1)}function ur(_,Ue,lt,Bt,ct){let Ft,le,Ze=1,Tt=!1,Et=!1,Pt=null,Lt,Nt,hr;_.depth>=_.maxDepth&&$(_,"nesting exceeded maxDepth ("+_.maxDepth+")"),_.depth+=1,_.listener!==null&&_.listener("open",_),_.tag=null,_.anc Line truncated
`),_.charCodeAt(0)===65279&&(_=_.slice(1)));let lt=new Ee(_,Ue),Bt=_.indexOf("\0");for(Bt!==-1&&(lt.position=Bt,$(lt,"null byte is not allowed in input")),lt.input+="\0";lt.input.charCodeAt(lt.position)===32;)lt.lineIndent+=1,lt.position+=1;for(;lt.position<lt.length-1;)Ht(lt);return lt.documents}function Ur(_,Ue,lt){Ue!==null&&typeof Ue=="object"&&typeof lt>"u"&&(lt=Ue,Ue=null);let Bt=Cn(_,lt);if(typeof Ue!="function")return Bt;for(let ct=0,Ft=Bt.length;ct<Ft;ct+=1)Ue(Bt[ct])}function kr(_,Ue){let lt=Cn(_,Ue);if(lt.length!==0){if(lt.length===1)return lt[0];throw new e("expected a single document in the stream, but found more")}}return TT.loadAll=Ur,TT.load=kr,TT}function z$e(){if(Rle)return lH;Rle=1;let t=uS(),e=fS(),r=uH(),s=Object.prototype.toString,a=Object.prototype.hasOwnProperty,n=65279,l=9,f=10,h=13,A=32,m=33,w=34,v=35,D=37,I=38,R=39,N=42,U=44,V=45,ee=58,te=61,ie=62,ae=63,ge=64,de=91,xe=93,we=96,d=123,be=124,Ce=125,Ee={};Ee[0]="\\0",Ee[7]="\\a",Ee[8]="\\b",Ee[9]="\\t",Ee[10]="\\n",Ee[11]="\\v",Ee[12]="\\f",Ee[13]="\\r",Ee[27]="\\e",Ee[34]='\\"',Ee[92]="\\\\",Ee[133]="\\N",Ee[160]="\\_",Ee[8232]="\\L",Ee[8233]="\\P";let he=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],$=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function De(le,Ze){if(Ze===null)return{};let Tt={},Et=Object.keys(Ze);for(let Pt=0,Lt=Et.length;Pt<Lt;Pt+=1){let Nt=Et[Pt],hr=String(Ze[Nt]);Nt.slice(0,2)==="!!"&&(Nt="tag:yaml.org,2002:"+Nt.slice(2));let Xt=le.compiledTypeMap.fallback[Nt];Xt&&a.call(Xt.styleAliases,hr)&&(hr=Xt.styleAliases[hr]),Tt[Nt]=hr}return Tt}function Te(le){let Ze,Tt,Et=le.toString(16).toUpperCase();if(le<=255)Ze="x",Tt=2;else if(le<=65535)Ze="u",Tt=4;else if(le<=4294967295)Ze="U",Tt=8;else throw new e("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+Ze+t.repeat("0",Tt-Et.length)+Et}let ot=1,j=2;function rt(le){this.schema=le.schema||r,this.indent=Math.max(1,le.indent||2),this.noArrayIndent=le.noArrayIndent||!1,this.skipInvalid=le.skipInvalid||!1,this.flowLevel=t.isNothing(le.flowLevel)?-1:le.flowLevel,this.styleMap=De(this.schema,le.styles||null),this.sortKeys=le.sortKeys||!1,this.lineWidth=le.lineWidth||80,this.noRefs=le.noRefs||!1,this.noCompatMode=le.noCompatMode||!1,this.condenseFlow=le.condenseFlow||!1,this.quotingType=le.quotingType==='"'?j:ot,this.forceQuotes=le.forceQuotes||!1,this.replacer=typeof le.replacer=="function"?le.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Ne(le,Ze){let Tt=t.repeat(" ",Ze),Et=0,Pt="",Lt=le.length;for(;Et<Lt;){let Nt,hr=le.indexOf(`
`,Et);hr===-1?(Nt=le.slice(Et),Et=Lt):(Nt=le.slice(Et,hr+1),Et=hr+1),Nt.length&&Nt!==`
`&&(Pt+=Tt),Pt+=Nt}return Pt}function Fe(le,Ze){return`
`+t.repeat(" ",le.indent*Ze)}function Pe(le,Ze){for(let Tt=0,Et=le.implicitTypes.length;Tt<Et;Tt+=1)if(le.implicitTypes[Tt].resolve(Ze))return!0;return!1}function He(le){return le===A||le===l}function Qe(le){return le>=32&&le<=126||le>=161&&le<=55295&&le!==8232&&le!==8233||le>=57344&&le<=65533&&le!==n||le>=65536&&le<=1114111}function ft(le){return Qe(le)&&le!==n&&le!==h&&le!==f}function Me(le,Ze,Tt){let Et=ft(le),Pt=Et&&!He(le);return(Tt?Et:Et&&le!==U&&le!==de&&le!==xe&&le!==d&&le!==Ce)&&le!==v&&!(Ze===ee&&!Pt)||ft(Ze)&&!He(Ze)&&le===v||Ze===ee&&Pt}function x(le){return Qe(le)&&le!==n&&!He(le)&&le!==V&&le!==ae&&le!==ee&&le!==U&&le!==de&&le!==xe&&le!==d&&le!==Ce&&le!==v&&le!==I&&le!==N&&le!==m&&le!==be&&le!==te&&le!==ie&&le!==R&&le!==w&&le!==D&&le!==ge&&le!==we}function C(le){return!He(le)&&le!==ee}function P(le,Ze){let Tt=le.charCodeAt(Ze),Et;return Tt>=55296&&Tt<=56319&&Ze+1<le.length&&(Et=le.charCodeAt(Ze+1),Et>=56320&&Et<=57343)?(Tt-55296)*1024+Et-56320+65536:Tt}function E(le){return/^\n* /.test(le)}let F=1,Z=2,X=3,re=4,ce=5;function ke(le,Ze,Tt,Et,Pt,Lt,Nt,hr){let Xt,$t=0,Er=null,Yr=!1,Tn=!1,yc=Et!==-1,Ro=-1,La=x(P(le,0))&&C(P(le,le.length-1));if(Ze||Nt)for(Xt=0;Xt<le.length;$t>=65536?Xt+=2:Xt++){if($t=P(le,Xt),!Qe($t))return ce;La=La&&Me($t,Er,hr),Er=$t}else{for(Xt=0;Xt<le.length;$t>=65536?Xt+=2:Xt++){if($t=P(le,Xt),$t===f)Yr=!0,yc&&(Tn=Tn||Xt-Ro-1>Et&&le[Ro+1]!==" ",Ro=Xt);else if(!Qe($t))return ce;La=La&&Me($t,Er,hr),Er=$t}Tn=Tn||yc&&Xt-Ro-1>Et&&le[Ro+1]!==" "}return!Yr&&!Tn?La&&!Nt&&!Pt(le)?F:Lt===j?ce:Z:Tt>9&&E(le)?ce:Nt?Lt===j?ce:Z:Tn?re:X}function Le(le,Ze,Tt,Et,Pt){le.dump=function(){if(Ze.length===0)return le.quotingType===j?'""':"''";if(!le.noCompatMode&&(he.indexOf(Ze)!==-1||$.test(Ze)))return le.quotingType===j?'"'+Ze+'"':"'"+Ze+"'";let Lt=le.indent*Math.max(1,Tt),Nt=le.lineWidth===-1?-1:Math.max(Math.min(le.lineWidth,40),le.lineWidth-Lt),hr=Et||le.flowLevel>-1&&Tt>=le.flowLevel;function Xt($t){return Pe(le,$t)}switch(ke(Ze,hr,le.indent,Nt,Xt,le.quotingType,le.forceQuotes&&!Et,Pt)){case F:return Ze;case Z:return"'"+Ze.replace(/'/g,"''")+"'";case X:return"|"+pt(Ze,le.indent)+St(Ne(Ze,Lt));case re:return">"+pt(Ze,le.indent)+St(Ne(er(Ze,Nt),Lt));case ce:return'"'+Ht(Ze)+'"';default:throw new e("impossible error: invalid scalar style")}}()}function pt(le,Ze){let Tt=E(le)?String(Ze):"",Et=le[le.length-1]===`
`,Lt=Et&&(le[le.length-2]===`
`||le===`
`)?"+":Et?"":"-";return Tt+Lt+`
`}function St(le){return le[le.length-1]===`
`?le.slice(0,-1):le}function er(le,Ze){let Tt=/(\n+)([^\n]*)/g,Et=function(){let hr=le.indexOf(`
`);return hr=hr!==-1?hr:le.length,Tt.lastIndex=hr,ur(le.slice(0,hr),Ze)}(),Pt=le[0]===`
`||le[0]===" ",Lt,Nt;for(;Nt=Tt.exec(le);){let hr=Nt[1],Xt=Nt[2];Lt=Xt[0]===" ",Et+=hr+(!Pt&&!Lt&&Xt!==""?`
`:"")+ur(Xt,Ze),Pt=Lt}return Et}function ur(le,Ze){if(le===""||le[0]===" ")return le;let Tt=/ [^ ]/g,Et,Pt=0,Lt,Nt=0,hr=0,Xt="";for(;Et=Tt.exec(le);)hr=Et.index,hr-Pt>Ze&&(Lt=Nt>Pt?Nt:hr,Xt+=`
`+le.slice(Pt,Lt),Pt=Lt+1),Nt=hr;return Xt+=`
`,le.length-Pt>Ze&&Nt>Pt?Xt+=le.slice(Pt,Nt)+`
`+le.slice(Nt+1):Xt+=le.slice(Pt),Xt.slice(1)}function Ht(le){let Ze="",Tt=0;for(let Et=0;Et<le.length;Tt>=65536?Et+=2:Et++){Tt=P(le,Et);let Pt=Ee[Tt];!Pt&&Qe(Tt)?(Ze+=le[Et],Tt>=65536&&(Ze+=le[Et+1])):Ze+=Pt||Te(Tt)}return Ze}function Cn(le,Ze,Tt){let Et="",Pt=le.tag;for(let Lt=0,Nt=Tt.length;Lt<Nt;Lt+=1){let hr=Tt[Lt];le.replacer&&(hr=le.replacer.call(Tt,String(Lt),hr)),(lt(le,Ze,hr,!1,!1)||typeof hr>"u"&&lt(le,Ze,null,!1,!1))&&(Et!==""&&(Et+=","+(le.condenseFlow?"":" ")),Et+=le.dump)}le.tag=Pt,le.dump="["+Et+"]"}function Ur(le,Ze,Tt,Et){let Pt="",Lt=le.tag;for(let Nt=0,hr=Tt.length;Nt<hr;Nt+=1){let Xt=Tt[Nt];le.replacer&&(Xt=le.replacer.call(Tt,String(Nt),Xt)),(lt(le,Ze+1,Xt,!0,!0,!1,!0)||typeof Xt>"u"&&lt(le,Ze+1,null,!0,!0,!1,!0))&&((!Et||Pt!=="")&&(Pt+=Fe(le,Ze)),le.dump&&f===le.dump.charCodeAt(0)?Pt+="-":Pt+="- ",Pt+=le.dump)}le.tag=Lt,le.dump=Pt||"[]"}function kr(le,Ze,Tt){let Et="",Pt=le.tag,Lt=Object.keys(Tt);for(let Nt=0,hr=Lt.length;Nt<hr;Nt+=1){let Xt="";Et!==""&&(Xt+=", "),le.condenseFlow&&(Xt+='"');let $t=Lt[Nt],Er=Tt[$t];le.replacer&&(Er=le.replacer.call(Tt,$t,Er)),lt(le,Ze,$t,!1,!1)&&(le.dump.length>1024&&(Xt+="? "),Xt+=le.dump+(le.condenseFlow?'"':"")+":"+(le.condenseFlow?"":" "),lt(le,Ze,Er,!1,!1)&&(Xt+=le.dump,Et+=Xt))}le.tag=Pt,le.dump="{"+Et+"}"}function _(le,Ze,Tt,Et){let Pt="",Lt=le.tag,Nt=Object.keys(Tt);if(le.sortKeys===!0)Nt.sort();else if(typeof le.sortKeys=="function")Nt.sort(le.sortKeys);else if(le.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let hr=0,Xt=Nt.length;hr<Xt;hr+=1){let $t="";(!Et||Pt!=="")&&($t+=Fe(le,Ze));let Er=Nt[hr],Yr=Tt[Er];if(le.replacer&&(Yr=le.replacer.call(Tt,Er,Yr)),!lt(le,Ze+1,Er,!0,!0,!0))continue;let Tn=le.tag!==null&&le.tag!=="?"||le.dump&&le.dump.length>1024;Tn&&(le.dump&&f===le.dump.charCodeAt(0)?$t+="?":$t+="? "),$t+=le.dump,Tn&&($t+=Fe(le,Ze)),lt(le,Ze+1,Yr,!0,Tn)&&(le.dump&&f===le.dump.charCodeAt(0)?$t+=":":$t+=": ",$t+=le.dump,Pt+=$t)}le.tag=Lt,le.dump=Pt||"{}"}function Ue(le,Ze,Tt){let Et=Tt?le.explicitTypes:le.implicitTypes;for(let Pt=0,Lt=Et.length;Pt<Lt;Pt+=1){let Nt=Et[Pt];if((Nt.instanceOf||Nt.predicate)&&(!Nt.instanceOf||typeof Ze=="object"&&Ze instanceof Nt.instanceOf)&&(!Nt.predicate||Nt.predicate(Ze))){if(Tt?Nt.multi&&Nt.representName?le.tag=Nt.representName(Ze):le.tag=Nt.tag:le.tag="?",Nt.represent){let hr=le.styleMap[Nt.tag]||Nt.defaultStyle,Xt;if(s.call(Nt.represent)==="[object Function]")Xt=Nt.represent(Ze,hr);else if(a.call(Nt.represent,hr))Xt=Nt.represent[hr](Ze,hr);else throw new e("!<"+Nt.tag+'> tag resolver accepts not "'+hr+'" style');le.dump=Xt}return!0}}return!1}function lt(le,Ze,Tt,Et,Pt,Lt,Nt){le.tag=null,le.dump=Tt,Ue(le,Tt,!1)||Ue(le,Tt,!0);let hr=s.call(le.dump),Xt=Et;Et&&(Et=le.flowLevel<0||le.flowLevel>Ze);let $t=hr==="[object Object]"||hr==="[object Array]",Er,Yr;if($t&&(Er=le.duplicates.indexOf(Tt),Yr=Er!==-1),(le.tag!==null&&le.tag!=="?"||Yr||le.indent!==2&&Ze>0)&&(Pt=!1),Yr&&le.usedDuplicates[Er])le.dump="*ref_"+Er;else{if($t&&Yr&&!le.usedDuplicates[Er]&&(le.usedDuplicates[Er]=!0),hr==="[object Object]")Et&&Object.keys(le.dump).length!==0?(_(le,Ze,le.dump,Pt),Yr&&(le.dump="&ref_"+Er+le.dump)):(kr(le,Ze,le.dump),Yr&&(le.dump="&ref_"+Er+" "+le.dump));else if(hr==="[object Array]")Et&&le.dump.length!==0?(le.noArrayIndent&&!Nt&&Ze>0?Ur(le,Ze-1,le.dump,Pt):Ur(le,Ze,le.dump,Pt),Yr&&(le.dump="&ref_"+Er+le.dump)):(Cn(le,Ze,le.dump),Yr&&(le.dump="&ref_"+Er+" "+le.dump));else if(hr==="[object String]")le.tag!=="?"&&Le(le,le.dump,Ze,Lt,Xt);else{if(hr==="[object Undefined]")return!1;if(le.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+hr)}if(le.tag!==null&&le.tag!=="?"){let Tn=encodeURI(le.tag[0]==="!"?le.tag.slice(1):le.tag).replace(/!/g,"%21");le.tag[0]==="!"?Tn="!"+Tn:Tn.slice(0,18)==="tag:yaml.org,2002:"?Tn="!!"+Tn.slice(18):Tn="!<"+Tn+">",le.dump=Tn+" "+le.dump}}return!0}function Bt(le,Ze){let Tt=[],Et=[];ct(le,Tt,Et);let Pt=Et.length;for(let Lt=0;Lt<Pt;Lt+=1)Ze.duplicates.push(Tt[Et[Lt]]);Ze.usedDuplicates=new Array(Pt)}function ct(le,Ze,Tt){if(le!==null&&typeof le=="object"){let Et=Ze.indexOf(le);if(Et!==-1)Tt.indexOf(Et)===-1&&Tt.push(Et);else if(Ze.push(le),Array.isArray(le))for(let Pt=0,Lt=le.length;Pt<Lt;Pt+=1)ct(le[Pt],Ze,Tt);else{let Pt=Object.keys(le);for(let Lt=0,Nt=Pt.length;Lt<Nt;Lt+=1)ct(le[Pt[Lt]],Ze,Tt)}}}function Ft(le,Ze){Ze=Ze||{};let Tt=new rt(Ze);Tt.noRefs||Bt(le,Tt);let Et=le;return Tt.replacer&&(Et=Tt.replacer.call({"":Et},"",Et)),lt(Tt,0,Et,!0,!0)?Tt.dump+`
`:""}return lH.dump=Ft,lH}function J$e(){if(Tle)return pa;Tle=1;let t=K$e(),e=z$e();function r(s,a){return function(){throw new Error("Function yaml."+s+" is removed in js-yaml 4. Use yaml."+a+" instead, which is now safe by default.")}}return pa.Type=Za(),pa.Schema=Qle(),pa.FAILSAFE_SCHEMA=Lle(),pa.JSON_SCHEMA=jle(),pa.CORE_SCHEMA=Gle(),pa.DEFAULT_SCHEMA=uH(),pa.load=t.load,pa.loadAll=t.loadAll,pa.dump=e.dump,pa.YAMLException=fS(),pa.types={binary:Wle(),float:Hle(),map:Ole(),null:_le(),pairs:Kle(),set:zle(),timestamp:qle(),bool:Mle(),int:Ule(),merge:Vle(),omap:Yle(),seq:Nle(),str:Fle()},pa.safeLoad=r("safeLoad","load"),pa.safeLoadAll=r("safeLoadAll","loadAll"),pa.safeDump=r("safeDump","dump"),pa}var pa,TT,S0,cle,j6,lle,G6,ule,q6,fle,V6,hle,W6,Ale,Y6,ple,K6,dle,z6,gle,J6,mle,Z6,yle,X6,Ele,$6,Ile,eH,wle,tH,Cle,rH,Ble,nH,vle,iH,Sle,sH,ble,oH,Dle,aH,Ple,cH,xle,kle,lH,Rle,Tle,Z$e,X$e,hqt,Aqt,Jle,pqt,dqt,gqt,Zle,mqt,yqt,Eqt,Iqt,wqt,Cqt,Bqt,Xle=tt(()=>{pa={},TT={},S0={};lH={};Z$e=J$e(),X$e=W$e(Z$e),{Type:hqt,Schema:Aqt,FAILSAFE_SCHEMA:Jle,JSON_SCHEMA:pqt,CORE_SCHEMA:dqt,DEFAULT_SCHEMA:gqt,load:Zle,loadAll:mqt,dump:yqt,YAMLException:Eqt,types:Iqt,safeLoad:wqt,safeLoadAll:Cqt,safeDump:Bqt}=X$e});var eue=H((Sqt,$le)=>{"use strict";function $$e(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function cy(t,e,r,s){this.message=t,this.expected=e,this.found=r,this.location=s,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,cy)}$$e(cy,Error);cy.buildMessage=function(t,e){var r={literal:function(A){return'"'+a(A.text)+'"'},class:function(A){var m="",w;for(w=0;w<A.parts.length;w++)m+=A.parts[w]instanceof Array?n(A.parts[w][0])+"-"+n(A.parts[w][1]):n(A.parts[w]);return"["+(A.inverted?"^":"")+m+"]"},any:function(A){return"any character"},end:function(A){return"end of input"},other:function(A){return A.description}};function s(A){return A.charCodeAt(0).toString(16).toUpperCase()}function a(A){return A.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(m){return"\\x0"+s(m)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(m){return"\\x"+s(m)})}function n(A){return A.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(m){return"\\x0"+s(m)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(m){return"\\x"+s(m)})}function l(A){return r[A.type](A)}function f(A){var m=new Array(A.length),w,v;for(w=0;w<A.length;w++)m[w]=l(A[w]);if(m.sort(),m.length>0){for(w=1,v=1;w<m.length;w++)m[w-1]!==m[w]&&(m[v]=m[w],v++);m.length=v}switch(m.length){case 1:return m[0];case 2:return m[0]+" or "+m[1];default:return m.slice(0,-1).join(", ")+", or "+m[m.length-1]}}function h(A){return A?'"'+a(A)+'"':"end of input"}return"Expected "+f(t)+" but "+h(e)+" found."};function eet(t,e){e=e!==void 0?e:{};var r={},s={Start:Yl},a=Yl,n=function(ne){return[].concat(...ne)},l="-",f=Un("-",!1),h=function(ne){return ne},A=function(ne){return Object.assign({},...ne)},m="#",w=Un("#",!1),v=$u(),D=function(){return{}},I=":",R=Un(":",!1),N=function(ne,Be){return{[ne]:Be}},U=",",V=Un(",",!1),ee=function(ne,Be){return Be},te=function(ne,Be,_e){return Object.assign({},...[ne].concat(Be).map(bt=>({[bt]:_e})))},ie=function(ne){return ne},ae=function(ne){return ne},ge=wc("correct indentation"),de=" ",xe=Un(" ",!1),we=function(ne){return ne.length===Sr*_t},d=function(ne){return ne.length===(Sr+1)*_t},be=function(){return Sr++,!0},Ce=function(){return Sr--,!0},Ee=function(){return Ha()},he=wc("pseudostring"),$=/^[^\r\n\t ?:,\][{}#&*!|>'"%@`\-]/,De=Ei(["\r",`
`," "," ","?",":",",","]","[","{","}","#","&","*","!","|",">","'",'"',"%","@","`","-"],!0,!1),Te=/^[^\r\n\t ,\][{}:#"']/,ot=Ei(["\r",`
`," "," ",",","]","[","{","}",":","#",'"',"'"],!0,!1),j=function(){return Ha().replace(/^ *| *$/g,"")},rt="--",Ne=Un("--",!1),Fe=/^[a-zA-Z\/0-9]/,Pe=Ei([["a","z"],["A","Z"],"/",["0","9"]],!1,!1),He=/^[^\r\n\t :,]/,Qe=Ei(["\r",`
`," "," ",":",","],!0,!1),ft="null",Me=Un("null",!1),x=function(){return null},C="true",P=Un("true",!1),E=function(){return!0},F="false",Z=Un("false",!1),X=function(){return!1},re=wc("string"),ce='"',ke=Un('"',!1),Le=function(){return""},pt=function(ne){return ne},St=function(ne){return ne.join("")},er=/^[^"\\\0-\x1F\x7F]/,ur=Ei(['"',"\\",["\0",""],"\x7F"],!0,!1),Ht='\\"',Cn=Un('\\"',!1),Ur=function(){return'"'},kr="\\\\",_=Un("\\\\",!1),Ue=function(){return"\\"},lt="\\/",Bt=Un("\\/",!1),ct=function(){return"/"},Ft="\\b",le=Un("\\b",!1),Ze=function(){return"\b"},Tt="\\f",Et=Un("\\f",!1),Pt=function(){return"\f"},Lt="\\n",Nt=Un("\\n",!1),hr=function(){return`
`},Xt="\\r",$t=Un("\\r",!1),Er=function(){return"\r"},Yr="\\t",Tn=Un("\\t",!1),yc=function(){return" "},Ro="\\u",La=Un("\\u",!1),HA=function(ne,Be,_e,bt){return String.fromCharCode(parseInt(`0x${ne}${Be}${_e}${bt}`))},Ma=/^[0-9a-fA-F]/,Ua=Ei([["0","9"],["a","f"],["A","F"]],!1,!1),jA=wc("blank space"),Fr=/^[ \t]/,Zo=Ei([" "," "],!1,!1),Ec=wc("white space"),Ge=/^[ \t\n\r]/,Hr=Ei([" "," ",`
`,"\r"],!1,!1),oh=`\r
`,GA=Un(`\r
`,!1),qA=`
`,Zu=Un(`
`,!1),Xu="\r",Vl=Un("\r",!1),ve=0,Jt=0,Wl=[{line:1,column:1}],as=0,To=[],Vt=0,ei;if("startRule"in e){if(!(e.startRule in s))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=s[e.startRule]}function Ha(){return t.substring(Jt,ve)}function As(){return Bc(Jt,ve)}function cs(ne,Be){throw Be=Be!==void 0?Be:Bc(Jt,ve),ah([wc(ne)],t.substring(Jt,ve),Be)}function Ic(ne,Be){throw Be=Be!==void 0?Be:Bc(Jt,ve),vc(ne,Be)}function Un(ne,Be){return{type:"literal",text:ne,ignoreCase:Be}}function Ei(ne,Be,_e){return{type:"class",parts:ne,inverted:Be,ignoreCase:_e}}function $u(){return{type:"any"}}function Ud(){return{type:"end"}}function wc(ne){return{type:"other",description:ne}}function Cc(ne){var Be=Wl[ne],_e;if(Be)return Be;for(_e=ne-1;!Wl[_e];)_e--;for(Be=Wl[_e],Be={line:Be.line,column:Be.column};_e<ne;)t.charCodeAt(_e)===10?(Be.line++,Be.column=1):Be.column++,_e++;return Wl[ne]=Be,Be}function Bc(ne,Be){var _e=Cc(ne),bt=Cc(Be);return{start:{offset:ne,line:_e.line,column:_e.column},end:{offset:Be,line:bt.line,column:bt.column}}}function it(ne){ve<as||(ve>as&&(as=ve,To=[]),To.push(ne))}function vc(ne,Be){return new cy(ne,null,null,Be)}function ah(ne,Be,_e){return new cy(cy.buildMessage(ne,Be),ne,Be,_e)}function Yl(){var ne;return ne=VA(),ne}function Yn(){var ne,Be,_e;for(ne=ve,Be=[],_e=ja();_e!==r;)Be.push(_e),_e=ja();return Be!==r&&(Jt=ne,Be=n(Be)),ne=Be,ne}function ja(){var ne,Be,_e,bt,xt;return ne=ve,Be=ll(),Be!==r?(t.charCodeAt(ve)===45?(_e=l,ve++):(_e=r,Vt===0&&it(f)),_e!==r?(bt=ri(),bt!==r?(xt=Ga(),xt!==r?(Jt=ne,Be=h(xt),ne=Be):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r),ne}function VA(){var ne,Be,_e;for(ne=ve,Be=[],_e=WA();_e!==r;)Be.push(_e),_e=WA();return Be!==r&&(Jt=ne,Be=A(Be)),ne=Be,ne}function WA(){var ne,Be,_e,bt,xt,jt,Ir,Nn,Qi;if(ne=ve,Be=ri(),Be===r&&(Be=null),Be!==r){if(_e=ve,t.charCodeAt(ve)===35?(bt=m,ve++):(bt=r,Vt===0&&it(w)),bt!==r){if(xt=[],jt=ve,Ir=ve,Vt++,Nn=dt(),Vt--,Nn===r?Ir=void 0:(ve=Ir,Ir=r),Ir!==r?(t.length>ve?(Nn=t.charAt(ve),ve++):(Nn=r,Vt===0&&it(v)),Nn!==r?(Ir=[Ir,Nn],jt=Ir):(ve=jt,jt=r)):(ve=jt,jt=r),jt!==r)for(;jt!==r;)xt.push(jt),jt=ve,Ir=ve,Vt++,Nn=dt(),Vt--,Nn===r?Ir=void 0:(ve=Ir,Ir=r),Ir!==r?(t.length>ve?(Nn=t.charAt(ve),ve++):(Nn=r,Vt===0&&it(v)),Nn!==r?(Ir=[Ir,Nn],jt=Ir):(ve=jt,jt=r)):(ve=jt,jt=r);else xt=r;xt!==r?(bt=[bt,xt],_e=bt):(ve=_e,_e=r)}else ve=_e,_e=r;if(_e===r&&(_e=null),_e!==r){if(bt=[],xt=et(),xt!==r)for(;xt!==r;)bt.push(xt),xt=et();else bt=r;bt!==r?(Jt=ne,Be=D(),ne=Be):(ve=ne,ne=r)}else ve=ne,ne=r}else ve=ne,ne=r;if(ne===r&&(ne=ve,Be=ll(),Be!==r?(_e=Sc(),_e!==r?(bt=ri(),bt===r&&(bt=null),bt!==r?(t.charCodeAt(ve)===58?(xt=I,ve++):(xt=r,Vt===0&&it(R)),xt!==r?(jt=ri(),jt===r&&(jt=null),jt!==r?(Ir=Ga(),Ir!==r?(Jt=ne,Be=N(_e,Ir),ne=Be):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r),ne===r&&(ne=ve,Be=ll(),Be!==r?(_e=ks(),_e!==r?(bt=ri(),bt===r&&(bt=null),bt!==r?(t.charCodeAt(ve)===58?(xt=I,ve++):(xt=r,Vt===0&&it(R)),xt!==r?(jt=ri(),jt===r&&(jt=null),jt!==r?(Ir=Ga(),Ir!==r?(Jt=ne,Be=N(_e,Ir),ne=Be):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r),ne===r))){if(ne=ve,Be=ll(),Be!==r)if(_e=ks(),_e!==r)if(bt=ri(),bt!==r)if(xt=ef(),xt!==r){if(jt=[],Ir=et(),Ir!==r)for(;Ir!==r;)jt.push(Ir),Ir=et();else jt=r;jt!==r?(Jt=ne,Be=N(_e,xt),ne=Be):(ve=ne,ne=r)}else ve=ne,ne=r;else ve=ne,ne=r;else ve=ne,ne=r;else ve=ne,ne=r;if(ne===r)if(ne=ve,Be=ll(),Be!==r)if(_e=ks(),_e!==r){if(bt=[],xt=ve,jt=ri(),jt===r&&(jt=null),jt!==r?(t.charCodeAt(ve)===44?(Ir=U,ve++):(Ir=r,Vt===0&&it(V)),Ir!==r?(Nn=ri(),Nn===r&&(Nn=null),Nn!==r?(Qi=ks(),Qi!==r?(Jt=xt,jt=ee(_e,Qi),xt=jt):(ve=xt,xt=r)):(ve=xt,xt=r)):(ve=xt,xt=r)):(ve=xt,xt=r),xt!==r)for(;xt!==r;)bt.push(xt),xt=ve,jt=ri(),jt===r&&(jt=null),jt!==r?(t.charCodeAt(ve)===44?(Ir=U,ve++):(Ir=r,Vt===0&&it(V)),Ir!==r?(Nn=ri(),Nn===r&&(Nn=null),Nn!==r?(Qi=ks(),Qi!==r?(Jt=xt,jt=ee(_e,Qi),xt=jt):(ve=xt,xt=r)):(ve=xt,xt=r)):(ve=xt,xt=r)):(ve=xt,xt=r);else bt=r;bt!==r?(xt=ri(),xt===r&&(xt=null),xt!==r?(t.charCodeAt(ve)===58?(jt=I,ve++):(jt=r,Vt===0&&it(R)),jt!==r?(Ir=ri(),Ir===r&&(Ir=null),Ir!==r?(Nn=Ga(),Nn!==r?(Jt=ne,Be=te(_e,bt,Nn),ne=Be):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r)}else ve=ne,ne=r;else ve=ne,ne=r}return ne}function Ga(){var ne,Be,_e,bt,xt,jt,Ir;if(ne=ve,Be=ve,Vt++,_e=ve,bt=dt(),bt!==r?(xt=rr(),xt!==r?(t.charCodeAt(ve)===45?(jt=l,ve++):(jt=r,Vt===0&&it(f)),jt!==r?(Ir=ri(),Ir!==r?(bt=[bt,xt,jt,Ir],_e=bt):(ve=_e,_e=r)):(ve=_e,_e=r)):(ve=_e,_e=r)):(ve=_e,_e=r),Vt--,_e!==r?(ve=Be,Be=void 0):Be=r,Be!==r?(_e=et(),_e!==r?(bt=ti(),bt!==r?(xt=Yn(),xt!==r?(jt=qa(),jt!==r?(Jt=ne,Be=ie(xt),ne=Be):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r),ne===r&&(ne=ve,Be=dt(),Be!==r?(_e=ti(),_e!==r?(bt=VA(),bt!==r?(xt=qa(),xt!==r?(Jt=ne,Be=ie(bt),ne=Be):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r)):(ve=ne,ne=r),ne===r))if(ne=ve,Be=Kl(),Be!==r){if(_e=[],bt=et(),bt!==r)for(;bt!==r;)_e.push(bt),bt=et();else _e=r;_e!==r?(Jt=ne,BeLine truncated
`;if(typeof t=="number"||typeof t=="boolean")return`${t.toString()}
`;if(typeof t=="string")return`${rue(t)}
`;if(Array.isArray(t)){if(t.length===0)return`[]
`;let s=" ".repeat(e);return`
${t.map(n=>`${s}- ${fH(n,e+1,!1)}`).join("")}`}if(typeof t=="object"&&t){let[s,a]=t instanceof QT?[t.data,!1]:[t,!0],n=" ".repeat(e),l=Object.keys(s);a&&l.sort((h,A)=>{let m=tue.indexOf(h),w=tue.indexOf(A);return m===-1&&w===-1?h<A?-1:h>A?1:0:m!==-1&&w===-1?-1:m===-1&&w!==-1?1:m-w});let f=l.filter(h=>!iue(s[h])).map((h,A)=>{let m=s[h],w=rue(h),v=fH(m,e+1,!0),D=A>0||r?n:"",I=w.length>1024?`? ${w}
${D}:`:`${w}:`,R=v.startsWith(`
`)?v:` ${v}`;return`${D}${I}${R}`}).join(e===0?`
`:"")||`
`;return r?`
${f}`:`${f}`}throw new Error(`Unsupported value type (${t})`)}function Uc(t){try{let e=fH(t,0,!1);return e!==`
`?e:""}catch(e){throw e.location&&(e.message=e.message.replace(/(\.)?$/,` (line ${e.location.start.line}, column ${e.location.start.column})$1`)),e}}function ret(t){return t.endsWith(`
`)||(t+=`
`),(0,nue.parse)(t)}function iet(t){if(net.test(t))return ret(t);let e=Zle(t,{schema:Jle,json:!0});if(e==null)return{};if(typeof e!="object")throw new Error(`Expected an indexed object, got a ${typeof e} instead. Does your file follow Yaml's rules?`);if(Array.isArray(e))throw new Error("Expected an indexed object, got an array instead. Does your file follow Yaml's rules?");return e}function Fs(t){return iet(t)}var nue,tet,tue,QT,net,sue=tt(()=>{Xle();nue=st(eue()),tet=/^(?![-?:,\][{}#&*!|>'"%@` \t\r\n]).([ \t]*(?![,\][{}:# \t\r\n]).)*$/,tue=["__metadata","version","resolution","dependencies","peerDependencies","dependenciesMeta","peerDependenciesMeta","binaries"],QT=class{constructor(e){this.data=e}};Uc.PreserveOrdering=QT;net=/^(#.*(\r?\n))*?#\s+yarn\s+lockfile\s+v1\r?\n/i});var hS={};lr(hS,{parseResolution:()=>kT,parseShell:()=>DT,parseSyml:()=>Fs,stringifyArgument:()=>U6,stringifyArgumentSegment:()=>H6,stringifyArithmeticExpression:()=>xT,stringifyCommand:()=>M6,stringifyCommandChain:()=>hw,stringifyCommandChainThen:()=>_6,stringifyCommandLine:()=>PT,stringifyCommandLineThen:()=>L6,stringifyEnvSegment:()=>bT,stringifyRedirectArgument:()=>lS,stringifyResolution:()=>RT,stringifyShell:()=>fw,stringifyShellLine:()=>fw,stringifySyml:()=>Uc,stringifyValueArgument:()=>oy});var au=tt(()=>{nle();ale();sue()});var aue=H((Rqt,hH)=>{"use strict";var set=t=>{let e=!1,r=!1,s=!1;for(let a=0;a<t.length;a++){let n=t[a];e&&/[a-zA-Z]/.test(n)&&n.toUpperCase()===n?(t=t.slice(0,a)+"-"+t.slice(a),e=!1,s=r,r=!0,a++):r&&s&&/[a-zA-Z]/.test(n)&&n.toLowerCase()===n?(t=t.slice(0,a-1)+"-"+t.slice(a-1),s=r,r=!1,e=!0):(e=n.toLowerCase()===n&&n.toUpperCase()!==n,s=r,r=n.toUpperCase()===n&&n.toLowerCase()!==n)}return t},oue=(t,e)=>{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");e=Object.assign({pascalCase:!1},e);let r=a=>e.pascalCase?a.charAt(0).toUpperCase()+a.slice(1):a;return Array.isArray(t)?t=t.map(a=>a.trim()).filter(a=>a.length).join("-"):t=t.trim(),t.length===0?"":t.length===1?e.pascalCase?t.toUpperCase():t.toLowerCase():(t!==t.toLowerCase()&&(t=set(t)),t=t.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(a,n)=>n.toUpperCase()).replace(/\d+(\w|$)/g,a=>a.toUpperCase()),r(t))};hH.exports=oue;hH.exports.default=oue});var cue=H((Tqt,oet)=>{oet.exports=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Re Line truncated
${this.candidates.map(({usage:a})=>`$ ${a}`).join(`
`)}`}else if(this.candidates.length===1){let[{usage:s}]=this.candidates;this.message=`Command not found; did you mean:
$ ${s}
${gH(e)}`}else this.message=`Command not found; did you mean one of:
${this.candidates.map(({usage:s},a)=>`${`${a}.`.padStart(4)} ${s}`).join(`
`)}
${gH(e)}`}},OT=class extends Error{constructor(e,r){super(),this.input=e,this.usages=r,this.clipanion={type:"none"},this.name="AmbiguousSyntaxError",this.message=`Cannot find which to pick amongst the following alternatives:
${this.usages.map((s,a)=>`${`${a}.`.padStart(4)} ${s}`).join(`
`)}
${gH(e)}`}},gH=t=>`While running ${t.filter(e=>e!==Si.EndOfInput&&e!==Si.EndOfPartialInput).map(e=>{let r=JSON.stringify(e);return e.match(/\s/)||e.length===0||r!==`"${e}"`?r:e}).join(" ")}`});function aet(t){let e=t.split(`
`),r=e.filter(a=>a.match(/\S/)),s=r.length>0?r.reduce((a,n)=>Math.min(a,n.length-n.trimStart().length),Number.MAX_VALUE):0;return e.map(a=>a.slice(s).trimRight()).join(`
`)}function da(t,{format:e,paragraphs:r}){return t=t.replace(/\r\n?/g,`
`),t=aet(t),t=t.replace(/^\n+|\n+$/g,""),t=t.replace(/^(\s*)-([^\n]*?)\n+/gm,`$1-$2
`),t=t.replace(/\n(\n)?\n*/g,(s,a)=>a||" "),r&&(t=t.split(/\n/).map(s=>{let a=s.match(/^\s*[*-][\t ]+(.*)/);if(!a)return s.match(/(.{1,80})(?: |$)/g).join(`
`);let n=s.length-s.trimStart().length;return a[1].match(new RegExp(`(.{1,${78-n}})(?: |$)`,"g")).map((l,f)=>" ".repeat(n)+(f===0?"- ":" ")+l).join(`
`)}).join(`
`)),t=t.replace(/(`+)((?:.|[\n])*?)\1/g,(s,a,n)=>e.code(a+n+a)),t=t.replace(/(\*\*)((?:.|[\n])*?)\1/g,(s,a,n)=>e.bold(a+n+a)),t?`${t}
`:""}var mH,hue,Aue,yH=tt(()=>{mH=Array(80).fill("\u2501");for(let t=0;t<=24;++t)mH[mH.length-t]=`\x1B[38;5;${232+t}m\u2501`;hue={header:t=>`\x1B[1m\u2501\u2501\u2501 ${t}${t.length<75?` ${mH.slice(t.length+5).join("")}`:":"}\x1B[0m`,bold:t=>`\x1B[1m${t}\x1B[22m`,error:t=>`\x1B[31m\x1B[1m${t}\x1B[22m\x1B[39m`,code:t=>`\x1B[36m${t}\x1B[39m`},Aue={header:t=>t,bold:t=>t,error:t=>t,code:t=>t}});function Xa(t){return{...t,[AS]:!0}}function Nh(t,e){return typeof t>"u"?[t,e]:typeof t=="object"&&t!==null&&!Array.isArray(t)?[void 0,t]:[t,e]}function _T(t,{mergeName:e=!1}={}){let r=t.match(/^([^:]+): (.*)$/m);if(!r)return"validation failed";let[,s,a]=r;return e&&(a=a[0].toLowerCase()+a.slice(1)),a=s!=="."||!e?`${s.replace(/^\.(\[|$)/,"$1")}: ${a}`:`: ${a}`,a}function pS(t,e){return e.length===1?new ht(`${t}${_T(e[0],{mergeName:!0})}`):new ht(`${t}:
${e.map(r=>`
- ${_T(r)}`).join("")}`)}function fy(t,e,r){if(typeof r>"u")return e;let s=[],a=[],n=f=>{let h=e;return e=f,n.bind(null,h)};if(!r(e,{errors:s,coercions:a,coercion:n}))throw pS(`Invalid value for ${t}`,s);for(let[,f]of a)f();return e}var AS,Pp=tt(()=>{LT();AS=Symbol("clipanion/isOption")});var ho={};lr(ho,{KeyRelationship:()=>Oh,TypeAssertionError:()=>D0,applyCascade:()=>gS,as:()=>Pet,assert:()=>vet,assertWithErrors:()=>bet,cascade:()=>P0,fn:()=>xet,hasAtLeastOneKey:()=>SH,hasExactLength:()=>yue,hasForbiddenKeys:()=>Ket,hasKeyRelationship:()=>yS,hasMaxLength:()=>Ret,hasMinLength:()=>ket,hasMutuallyExclusiveKeys:()=>zet,hasRequiredKeys:()=>Yet,hasUniqueItems:()=>Tet,isArray:()=>MT,isAtLeast:()=>BH,isAtMost:()=>Net,isBase64:()=>Get,isBoolean:()=>get,isDate:()=>yet,isDict:()=>wet,isEnum:()=>$s,isHexColor:()=>jet,isISO8601:()=>Het,isInExclusiveRange:()=>Let,isInInclusiveRange:()=>Oet,isInstanceOf:()=>Bet,isInteger:()=>vH,isJSON:()=>qet,isLiteral:()=>due,isLowerCase:()=>_et,isMap:()=>Iet,isNegative:()=>Qet,isNullable:()=>Wet,isNumber:()=>wH,isObject:()=>gue,isOneOf:()=>CH,isOptional:()=>Vet,isPartial:()=>Cet,isPayload:()=>met,isPositive:()=>Fet,isRecord:()=>HT,isSet:()=>Eet,isString:()=>_h,isTuple:()=>UT,isUUID4:()=>Uet,isUnknown:()=>IH,isUpperCase:()=>Met,makeTrait:()=>mue,makeValidator:()=>fn,matchesRegExp:()=>xp,softAssert:()=>Det});function bi(t){return t===null?"null":t===void 0?"undefined":t===""?"an empty string":typeof t=="symbol"?`<${t.toString()}>`:Array.isArray(t)?"an array":JSON.stringify(t)}function pw(t,e){if(t.length===0)return"nothing";if(t.length===1)return bi(t[0]);let r=t.slice(0,-1),s=t[t.length-1],a=t.length>2?`, ${e} `:` ${e} `;return`${r.map(n=>bi(n)).join(", ")}${a}${bi(s)}`}function b0(t,e){var r,s,a;return typeof e=="number"?`${(r=t?.p)!==null&&r!==void 0?r:"."}[${e}]`:cet.test(e)?`${(s=t?.p)!==null&&s!==void 0?s:""}.${e}`:`${(a=t?.p)!==null&&a!==void 0?a:"."}[${JSON.stringify(e)}]`}function EH(t,e,r){return t===1?e:r}function Lr({errors:t,p:e}={},r){return t?.push(`${e??"."}: ${r}`),!1}function pet(t,e){return r=>{t[e]=r}}function Lh(t,e){return r=>{let s=t[e];return t[e]=r,Lh(t,e).bind(null,s)}}function dS(t,e,r){let s=()=>(t(r()),a),a=()=>(t(e),s);return s}function IH(){return fn({test:(t,e)=>!0})}function due(t){return fn({test:(e,r)=>e!==t?Lr(r,`Expected ${bi(t)} (got ${bi(e)})`):!0})}function _h(){return fn({test:(t,e)=>typeof t!="string"?Lr(e,`Expected a string (got ${bi(t)})`):!0})}function $s(t){let e=Array.isArray(t)?t:Object.values(t),r=e.every(a=>typeof a=="string"||typeof a=="number"),s=new Set(e);return s.size===1?due([...s][0]):fn({test:(a,n)=>s.has(a)?!0:r?Lr(n,`Expected one of ${pw(e,"or")} (got ${bi(a)})`):Lr(n,`Expected a valid enumeration value (got ${bi(a)})`)})}function get(){return fn({test:(t,e)=>{var r;if(typeof t!="boolean"){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return Lr(e,"Unbound coercion result");let s=det.get(t);if(typeof s<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,s)]),!0}return Lr(e,`Expected a boolean (got ${bi(t)})`)}return!0}})}function wH(){return fn({test:(t,e)=>{var r;if(typeof t!="number"){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return Lr(e,"Unbound coercion result");let s;if(typeof t=="string"){let a;try{a=JSON.parse(t)}catch{}if(typeof a=="number")if(JSON.stringify(a)===t)s=a;else return Lr(e,`Received a number that can't be safely represented by the runtime (${t})`)}if(typeof s<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,s)]),!0}return Lr(e,`Expected a number (got ${bi(t)})`)}return!0}})}function met(t){return fn({test:(e,r)=>{var s;if(typeof r?.coercions>"u")return Lr(r,"The isPayload predicate can only be used with coercion enabled");if(typeof r.coercion>"u")return Lr(r,"Unbound coercion result");if(typeof e!="string")return Lr(r,`Expected a string (got ${bi(e)})`);let a;try{a=JSON.parse(e)}catch{return Lr(r,`Expected a JSON string (got ${bi(e)})`)}let n={value:a};return t(a,Object.assign(Object.assign({},r),{coercion:Lh(n,"value")}))?(r.coercions.push([(s=r.p)!==null&&s!==void 0?s:".",r.coercion.bind(null,n.value)]),!0):!1}})}function yet(){return fn({test:(t,e)=>{var r;if(!(t instanceof Date)){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return Lr(e,"Unbound coercion result");let s;if(typeof t=="string"&&pue.test(t))s=new Date(t);else{let a;if(typeof t=="string"){let n;try{n=JSON.parse(t)}catch{}typeof n=="number"&&(a=n)}else typeof t=="number"&&(a=t);if(typeof a<"u")if(Number.isSafeInteger(a)||!Number.isSafeInteger(a*1e3))s=new Date(a*1e3);else return Lr(e,`Received a timestamp that can't be safely represented by the runtime (${t})`)}if(typeof s<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,s)]),!0}return Lr(e,`Expected a date (got ${bi(t)})`)}return!0}})}function MT(t,{delimiter:e}={}){return fn({test:(r,s)=>{var a;let n=r;if(typeof r=="string"&&typeof e<"u"&&typeof s?.coercions<"u"){iLine truncated
`;for(let s of e)r+=`
- ${s}`}super(r)}};mS={missing:(t,e)=>t.has(e),undefined:(t,e,r)=>t.has(e)&&typeof r[e]<"u",nil:(t,e,r)=>t.has(e)&&r[e]!=null,falsy:(t,e,r)=>t.has(e)&&!!r[e]};(function(t){t.Forbids="Forbids",t.Requires="Requires"})(Oh||(Oh={}));Jet={[Oh.Forbids]:{expect:!1,message:"forbids using"},[Oh.Requires]:{expect:!0,message:"requires using"}}});var At,x0=tt(()=>{Pp();At=class{constructor(){this.help=!1}static Usage(e){return e}async catch(e){throw e}async validateAndExecute(){let r=this.constructor.schema;if(Array.isArray(r)){let{isDict:a,isUnknown:n,applyCascade:l}=await Promise.resolve().then(()=>(ga(),ho)),f=l(a(n()),r),h=[],A=[];if(!f(this,{errors:h,coercions:A}))throw pS("Invalid option schema",h);for(let[,w]of A)w()}else if(r!=null)throw new Error("Invalid command schema");let s=await this.execute();return typeof s<"u"?s:0}};At.isOption=AS;At.Default=[]});function Hc(t){dH&&console.log(t)}function Iue(){let t={nodes:[]};for(let e=0;e<Gn.CustomNode;++e)t.nodes.push(Sl());return t}function Zet(t){let e=Iue(),r=[],s=e.nodes.length;for(let a of t){r.push(s);for(let n=0;n<a.nodes.length;++n)Cue(n)||e.nodes.push(stt(a.nodes[n],s));s+=a.nodes.length-Gn.CustomNode+1}for(let a of r)dw(e,Gn.InitialNode,a);return e}function vf(t,e){return t.nodes.push(e),t.nodes.length-1}function Xet(t){let e=new Set,r=s=>{if(e.has(s))return;e.add(s);let a=t.nodes[s];for(let l of Object.values(a.statics))for(let{to:f}of l)r(f);for(let[,{to:l}]of a.dynamics)r(l);for(let{to:l}of a.shortcuts)r(l);let n=new Set(a.shortcuts.map(({to:l})=>l));for(;a.shortcuts.length>0;){let{to:l}=a.shortcuts.shift(),f=t.nodes[l];for(let[h,A]of Object.entries(f.statics)){let m=Object.prototype.hasOwnProperty.call(a.statics,h)?a.statics[h]:a.statics[h]=[];for(let w of A)m.some(({to:v})=>w.to===v)||m.push(w)}for(let[h,A]of f.dynamics)a.dynamics.some(([m,{to:w}])=>h===m&&A.to===w)||a.dynamics.push([h,A]);for(let h of f.shortcuts)n.has(h.to)||(a.shortcuts.push(h),n.add(h.to))}};r(Gn.InitialNode)}function $et(t,{prefix:e=""}={}){if(dH){Hc(`${e}Nodes are:`);for(let r=0;r<t.nodes.length;++r)Hc(`${e} ${r}: ${JSON.stringify(t.nodes[r])}`)}}function ett(t,e,r=!1){Hc(`Running a vm on ${JSON.stringify(e)}`);let s=[{node:Gn.InitialNode,state:{candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,options:[],path:[],positionals:[],remainder:null,selectedIndex:null,partial:!1,tokens:[]}}];$et(t,{prefix:" "});let a=[Si.StartOfInput,...e];for(let n=0;n<a.length;++n){let l=a[n],f=l===Si.EndOfInput||l===Si.EndOfPartialInput,h=n-1;Hc(` Processing ${JSON.stringify(l)}`);let A=[];for(let{node:m,state:w}of s){Hc(` Current node is ${m}`);let v=t.nodes[m];if(m===Gn.ErrorNode){A.push({node:m,state:w});continue}console.assert(v.shortcuts.length===0,"Shortcuts should have been eliminated by now");let D=Object.prototype.hasOwnProperty.call(v.statics,l);if(!r||n<a.length-1||D)if(D){let I=v.statics[l];for(let{to:R,reducer:N}of I)A.push({node:R,state:typeof N<"u"?jT(DH,N,w,l,h):w}),Hc(` Static transition to ${R} found`)}else Hc(" No static transition found");else{let I=!1;for(let R of Object.keys(v.statics))if(R.startsWith(l)){if(l===R)for(let{to:N,reducer:U}of v.statics[R])A.push({node:N,state:typeof U<"u"?jT(DH,U,w,l,h):w}),Hc(` Static transition to ${N} found`);else for(let{to:N}of v.statics[R])A.push({node:N,state:{...w,remainder:R.slice(l.length)}}),Hc(` Static transition to ${N} found (partial match)`);I=!0}I||Hc(" No partial static transition found")}if(!f)for(let[I,{to:R,reducer:N}]of v.dynamics)jT(ott,I,w,l,h)&&(A.push({node:R,state:typeof N<"u"?jT(DH,N,w,l,h):w}),Hc(` Dynamic transition to ${R} found (via ${I})`))}if(A.length===0&&f&&e.length===1)return[{node:Gn.InitialNode,state:Eue}];if(A.length===0)throw new Aw(e,s.filter(({node:m})=>m!==Gn.ErrorNode).map(({state:m})=>({usage:m.candidateUsage,reason:null})));if(A.every(({node:m})=>m===Gn.ErrorNode))throw new Aw(e,A.map(({state:m})=>({usage:m.candidateUsage,reason:m.errorMessage})));s=rtt(A)}if(s.length>0){Hc(" Results:");for(let n of s)Hc(` - ${n.node} -> ${JSON.stringify(n.state)}`)}else Hc(" No results");return s}function ttt(t,e,{endToken:r=Si.EndOfInput}={}){let s=ett(t,[...e,r]);return ntt(e,s.map(({state:a})=>a))}function rtt(t){let e=0;for(let{state:r}of t)r.path.length>e&&(e=r.path.length);return t.filter(({state:r})=>r.path.length===e)}function ntt(t,e){let r=e.filter(v=>v.selectedIndex!==null),s=r.filter(v=>!v.partial);if(s.length>0&&(r=s),r.length===0)throw new Error;let a=r.filter(v=>v.selectedIndex===uy||v.requiredOptions.every(D=>D.some(I=>v.options.find(R=>R.name===I))));if(a.length===0)throw new Aw(t,r.map(v=>({usage:v.candidateUsage,reason:null})));let n=0;for(let v of a)v.path.length>n&&(n=v.path.length);let l=a.filter(v=>v.path.length===n),f=v=>v.positionals.filter(({extra:D})=>!D).length+v.options.length,h=l.map(v=>({state:v,positionalCount:f(v)})),A=0;for(let{positionalCount:v}of h)v>A&&(A=v);let m=h.filter(({positionalCount:v})=>v===A).map(({state:v Line truncated
`),this.context.stdout.write(`
`);let r=0;for(let s of this.commands)this.context.stdout.write(this.cli.usage(this.contexts[s].commandClass,{prefix:`${r++}. `.padStart(5)}));this.context.stdout.write(`
`),this.context.stdout.write(`Run again with -h=<index> to see the longer details of any of those commands.
`)}}}});async function kue(...t){let{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:s,resolvedContext:a}=Tue(t);return ec.from(r,e).runExit(s,a)}async function Rue(...t){let{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:s,resolvedContext:a}=Tue(t);return ec.from(r,e).run(s,a)}function Tue(t){let e,r,s,a;switch(typeof process<"u"&&typeof process.argv<"u"&&(s=process.argv.slice(2)),t.length){case 1:r=t[0];break;case 2:t[0]&&t[0].prototype instanceof At||Array.isArray(t[0])?(r=t[0],Array.isArray(t[1])?s=t[1]:a=t[1]):(e=t[0],r=t[1]);break;case 3:Array.isArray(t[2])?(e=t[0],r=t[1],s=t[2]):t[0]&&t[0].prototype instanceof At||Array.isArray(t[0])?(r=t[0],s=t[1],a=t[2]):(e=t[0],r=t[1],a=t[2]);break;default:e=t[0],r=t[1],s=t[2],a=t[3];break}if(typeof s>"u")throw new Error("The argv parameter must be provided when running Clipanion outside of a Node context");return{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:s,resolvedContext:a}}function xue(t){return t()}var Pue,ec,Que=tt(()=>{NT();qT();yH();bue();x0();Due();Pue=Symbol("clipanion/errorCommand");ec=class t{constructor({binaryLabel:e,binaryName:r="...",binaryVersion:s,enableCapture:a=!1,enableColors:n}={}){this.registrations=new Map,this.builder=new GT({binaryName:r}),this.binaryLabel=e,this.binaryName=r,this.binaryVersion=s,this.enableCapture=a,this.enableColors=n}static from(e,r={}){let s=new t(r),a=Array.isArray(e)?e:[e];for(let n of a)s.register(n);return s}register(e){var r;let s=new Map,a=new e;for(let h in a){let A=a[h];typeof A=="object"&&A!==null&&A[At.isOption]&&s.set(h,A)}let n=this.builder.command(),l=n.cliIndex,f=(r=e.paths)!==null&&r!==void 0?r:a.paths;if(typeof f<"u")for(let h of f)n.addPath(h);this.registrations.set(e,{specs:s,builder:n,index:l});for(let[h,{definition:A}]of s.entries())A(n,h);n.setContext({commandClass:e})}process(e,r){let{input:s,context:a,partial:n}=typeof e=="object"&&Array.isArray(e)?{input:e,context:r}:e,{contexts:l,process:f}=this.builder.compile(),h=f(s,{partial:n}),A={...t.defaultContext,...a};switch(h.selectedIndex){case uy:{let m=WT.from(h,l);return m.context=A,m.tokens=h.tokens,m}default:{let{commandClass:m}=l[h.selectedIndex],w=this.registrations.get(m);if(typeof w>"u")throw new Error("Assertion failed: Expected the command class to have been registered.");let v=new m;v.context=A,v.tokens=h.tokens,v.path=h.path;try{for(let[D,{transformer:I}]of w.specs.entries())v[D]=I(w.builder,D,h,A);return v}catch(D){throw D[Pue]=v,D}}break}}async run(e,r){var s,a;let n,l={...t.defaultContext,...r},f=(s=this.enableColors)!==null&&s!==void 0?s:l.colorDepth>1;if(!Array.isArray(e))n=e;else try{n=this.process(e,l)}catch(m){return l.stdout.write(this.error(m,{colored:f})),1}if(n.help)return l.stdout.write(this.usage(n,{colored:f,detailed:!0})),0;n.context=l,n.cli={binaryLabel:this.binaryLabel,binaryName:this.binaryName,binaryVersion:this.binaryVersion,enableCapture:this.enableCapture,enableColors:this.enableColors,definitions:()=>this.definitions(),definition:m=>this.definition(m),error:(m,w)=>this.error(m,w),format:m=>this.format(m),process:(m,w)=>this.process(m,{...l,...w}),run:(m,w)=>this.run(m,{...l,...w}),usage:(m,w)=>this.usage(m,w)};let h=this.enableCapture&&(a=Sue(l))!==null&&a!==void 0?a:xue,A;try{A=await h(()=>n.validateAndExecute().catch(m=>n.catch(m).then(()=>0)))}catch(m){return l.stdout.write(this.error(m,{colored:f,command:n})),1}return A}async runExit(e,r){process.exitCode=await this.run(e,r)}definition(e,{colored:r=!1}={}){if(!e.usage)return null;let{usage:s}=this.getUsageByRegistration(e,{detailed:!1}),{usage:a,options:n}=this.getUsageByRegistration(e,{detailed:!0,inlineOptions:!1}),l=typeof e.usage.category<"u"?da(e.usage.category,{format:this.format(r),paragraphs:!1}):void 0,f=typeof e.usage.description<"u"?da(e.usage.description,{format:this.format(r),paragraphs:!1}):void 0,h=typeof e.usage.details<"u"?da(e.usage.details,{format:this.format(r),paragraphs:!0}):void 0,A=typeof e.usage.examples<"u"?e.usage.examples.map(([m,w])=>[da(m,{format:this.format(r),paragraphs:!1}),w.replace(/\$0/g,this.binaryName)]):void 0;return{path:s,usage:a,category:l,description:f,details:h,examples:A,options:n}}definitions({colored:e=!1}={}){let r=[];for(let s of this.registrations.keys()){let a=this.definition(s,{colored:e});a&&r.push(a)}return r}usage(e=null,{colored:r,detailed:s=!1,prefix:a="$ "}={}){var n;if(e===null){for(let h of this.registrations.keys()){let A=h.paths,m=typeof h.usage<"u";if(!A||A.length===0||A.length===1&&A[0].length===0||((n=A?.some(D=>D.length===0))!==null&&n!==void 0?n:!1))if(e){e=null;break}else e=h;else if(m){e=null;continue}}e&&(s=!0)}let l=e!==null&&e instanceof At?e.constructor:e,f="";if(l)if(s){let{description:h="",details:A="",examples:m=[]}=l.usage||{};h!==""&&(f+=da(h,{format:this.format(r),paragraphs:!1}).replace(/^./,D=>D.toUpperCase()),f+=`
`),(A!==""||m.length>0)&&(f+=`${this.format(r).header("Usage")}
`,f+=`
`);let{usage:w,options:v}=this.getUsageByRegistration(l,{inlineOptions:!1});if(f+=`${this.format(r).bold(a)}${w}
`,v.length>0){f+=`
`,f+=`${this.format(r).header("Options")}
`;let D=v.reduce((I,R)=>Math.max(I,R.definition.length),0);f+=`
`;for(let{definition:I,description:R}of v)f+=` ${this.format(r).bold(I.padEnd(D))} ${da(R,{format:this.format(r),paragraphs:!1})}`}if(A!==""&&(f+=`
`,f+=`${this.format(r).header("Details")}
`,f+=`
`,f+=da(A,{format:this.format(r),paragraphs:!0})),m.length>0){f+=`
`,f+=`${this.format(r).header("Examples")}
`;for(let[D,I]of m)f+=`
`,f+=da(D,{format:this.format(r),paragraphs:!1}),f+=`${I.replace(/^/m,` ${this.format(r).bold(a)}`).replace(/\$0/g,this.binaryName)}
`}}else{let{usage:h}=this.getUsageByRegistration(l);f+=`${this.format(r).bold(a)}${h}
`}else{let h=new Map;for(let[v,{index:D}]of this.registrations.entries()){if(typeof v.usage>"u")continue;let I=typeof v.usage.category<"u"?da(v.usage.category,{format:this.format(r),paragraphs:!1}):null,R=h.get(I);typeof R>"u"&&h.set(I,R=[]);let{usage:N}=this.getUsageByIndex(D);R.push({commandClass:v,usage:N})}let A=Array.from(h.keys()).sort((v,D)=>v===null?-1:D===null?1:v.localeCompare(D,"en",{usage:"sort",caseFirst:"upper"})),m=typeof this.binaryLabel<"u",w=typeof this.binaryVersion<"u";m||w?(m&&w?f+=`${this.format(r).header(`${this.binaryLabel} - ${this.binaryVersion}`)}
`:m?f+=`${this.format(r).header(`${this.binaryLabel}`)}
`:f+=`${this.format(r).header(`${this.binaryVersion}`)}
`,f+=` ${this.format(r).bold(a)}${this.binaryName} <command>
`):f+=`${this.format(r).bold(a)}${this.binaryName} <command>
`;for(let v of A){let D=h.get(v).slice().sort((R,N)=>R.usage.localeCompare(N.usage,"en",{usage:"sort",caseFirst:"upper"})),I=v!==null?v.trim():"General commands";f+=`
`,f+=`${this.format(r).header(`${I}`)}
`;for(let{commandClass:R,usage:N}of D){let U=R.usage.description||"undocumented";f+=`
`,f+=` ${this.format(r).bold(N)}
`,f+=` ${da(U,{format:this.format(r),paragraphs:!1})}`}}f+=`
`,f+=da("You can also print more details about any of these commands by calling them with the `-h,--help` flag right after the command name.",{format:this.format(r),paragraphs:!0})}return f}error(e,r){var s,{colored:a,command:n=(s=e[Pue])!==null&&s!==void 0?s:null}=r===void 0?{}:r;(!e||typeof e!="object"||!("stack"in e))&&(e=new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(e)})`));let l="",f=e.name.replace(/([a-z])([A-Z])/g,"$1 $2");f==="Error"&&(f="Internal Error"),l+=`${this.format(a).error(f)}: ${e.message}
`;let h=e.clipanion;return typeof h<"u"?h.type==="usage"&&(l+=`
`,l+=this.usage(n)):e.stack&&(l+=`${e.stack.replace(/^.*\n/,"")}
`),l}format(e){var r;return((r=e??this.enableColors)!==null&&r!==void 0?r:t.defaultContext.colorDepth>1)?hue:Aue}getUsageByRegistration(e,r){let s=this.registrations.get(e);if(typeof s>"u")throw new Error("Assertion failed: Unregistered command");return this.getUsageByIndex(s.index,r)}getUsageByIndex(e,r){return this.builder.getBuilderByIndex(e).usage(r)}};ec.defaultContext={env:process.env,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr,colorDepth:vue()}});var ES,Fue=tt(()=>{x0();ES=class extends At{async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.definitions(),null,2)}
`)}};ES.paths=[["--clipanion=definitions"]]});var IS,Nue=tt(()=>{x0();IS=class extends At{async execute(){this.context.stdout.write(this.cli.usage())}};IS.paths=[["-h"],["--help"]]});function YT(t={}){return Xa({definition(e,r){var s;e.addProxy({name:(s=t.name)!==null&&s!==void 0?s:r,required:t.required})},transformer(e,r,s){return s.positionals.map(({value:a})=>a)}})}var xH=tt(()=>{Pp()});var wS,Oue=tt(()=>{x0();xH();wS=class extends At{constructor(){super(...arguments),this.args=YT()}async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.process(this.args).tokens,null,2)}
`)}};wS.paths=[["--clipanion=tokens"]]});var CS,Lue=tt(()=>{x0();CS=class extends At{async execute(){var e;this.context.stdout.write(`${(e=this.cli.binaryVersion)!==null&&e!==void 0?e:"<unknown>"}
`)}};CS.paths=[["-v"],["--version"]]});var kH={};lr(kH,{DefinitionsCommand:()=>ES,HelpCommand:()=>IS,TokensCommand:()=>wS,VersionCommand:()=>CS});var _ue=tt(()=>{Fue();Nue();Oue();Lue()});function Mue(t,e,r){let[s,a]=Nh(e,r??{}),{arity:n=1}=a,l=t.split(","),f=new Set(l);return Xa({definition(h){h.addOption({names:l,arity:n,hidden:a?.hidden,description:a?.description,required:a.required})},transformer(h,A,m){let w,v=typeof s<"u"?[...s]:void 0;for(let{name:D,value:I}of m.options)f.has(D)&&(w=D,v=v??[],v.push(I));return typeof v<"u"?fy(w??A,v,a.validator):v}})}var Uue=tt(()=>{Pp()});function Hue(t,e,r){let[s,a]=Nh(e,r??{}),n=t.split(","),l=new Set(n);return Xa({definition(f){f.addOption({names:n,allowBinding:!1,arity:0,hidden:a.hidden,description:a.description,required:a.required})},transformer(f,h,A){let m=s;for(let{name:w,value:v}of A.options)l.has(w)&&(m=v);return m}})}var jue=tt(()=>{Pp()});function Gue(t,e,r){let[s,a]=Nh(e,r??{}),n=t.split(","),l=new Set(n);return Xa({definition(f){f.addOption({names:n,allowBinding:!1,arity:0,hidden:a.hidden,description:a.description,required:a.required})},transformer(f,h,A){let m=s;for(let{name:w,value:v}of A.options)l.has(w)&&(m??(m=0),v?m+=1:m=0);return m}})}var que=tt(()=>{Pp()});function Vue(t={}){return Xa({definition(e,r){var s;e.addRest({name:(s=t.name)!==null&&s!==void 0?s:r,required:t.required})},transformer(e,r,s){let a=l=>{let f=s.positionals[l];return f.extra===bl||f.extra===!1&&l<e.arity.leading.length},n=0;for(;n<s.positionals.length&&a(n);)n+=1;return s.positionals.splice(0,n).map(({value:l})=>l)}})}var Wue=tt(()=>{qT();Pp()});function att(t,e,r){let[s,a]=Nh(e,r??{}),{arity:n=1}=a,l=t.split(","),f=new Set(l);return Xa({definition(h){h.addOption({names:l,arity:a.tolerateBoolean?0:n,hidden:a.hidden,description:a.description,required:a.required})},transformer(h,A,m,w){let v,D=s;typeof a.env<"u"&&w.env[a.env]&&(v=a.env,D=w.env[a.env]);for(let{name:I,value:R}of m.options)f.has(I)&&(v=I,D=R);return typeof D=="string"?fy(v??A,D,a.validator):D}})}function ctt(t={}){let{required:e=!0}=t;return Xa({definition(r,s){var a;r.addPositional({name:(a=t.name)!==null&&a!==void 0?a:s,required:t.required})},transformer(r,s,a){var n;for(let l=0;l<a.positionals.length;++l){if(a.positionals[l].extra===bl||e&&a.positionals[l].extra===!0||!e&&a.positionals[l].extra===!1)continue;let[f]=a.positionals.splice(l,1);return fy((n=t.name)!==null&&n!==void 0?n:s,f.value,t.validator)}}})}function Yue(t,...e){return typeof t=="string"?att(t,...e):ctt(t)}var Kue=tt(()=>{qT();Pp()});var ye={};lr(ye,{Array:()=>Mue,Boolean:()=>Hue,Counter:()=>Gue,Proxy:()=>YT,Rest:()=>Vue,String:()=>Yue,applyValidator:()=>fy,cleanValidationError:()=>_T,formatError:()=>pS,isOptionSymbol:()=>AS,makeCommandOption:()=>Xa,rerouteArguments:()=>Nh});var zue=tt(()=>{Pp();xH();Uue();jue();que();Wue();Kue()});var BS={};lr(BS,{Builtins:()=>kH,Cli:()=>ec,Command:()=>At,Option:()=>ye,UsageError:()=>ht,formatMarkdownish:()=>da,run:()=>Rue,runExit:()=>kue});var sr=tt(()=>{LT();yH();x0();Que();_ue();zue()});var Jue=H((M7t,ltt)=>{ltt.exports={name:"dotenv",version:"16.3.1",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard","lint-readme":"standard-markdown",pretest:"npm run lint && npm run dts-check",test:"tap tests/*.js --100 -Rspec",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://github.com/motdotla/dotenv?sponsor=1",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@definitelytyped/dtslint":"^0.0.133","@types/node":"^18.11.3",decache:"^4.6.1",sinon:"^14.0.1",standard:"^17.0.0","standard-markdown":"^7.1.0","standard-version":"^9.5.0",tap:"^16.3.0",tar:"^6.1.11",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var efe=H((U7t,kp)=>{var Zue=Ae("fs"),TH=Ae("path"),utt=Ae("os"),ftt=Ae("crypto"),htt=Jue(),QH=htt.version,Att=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function ptt(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,`
`);let s;for(;(s=Att.exec(r))!=null;){let a=s[1],n=s[2]||"";n=n.trim();let l=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),l==='"'&&(n=n.replace(/\\n/g,`
`),n=n.replace(/\\r/g,"\r")),e[a]=n}return e}function dtt(t){let e=$ue(t),r=po.configDotenv({path:e});if(!r.parsed)throw new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);let s=Xue(t).split(","),a=s.length,n;for(let l=0;l<a;l++)try{let f=s[l].trim(),h=ytt(r,f);n=po.decrypt(h.ciphertext,h.key);break}catch(f){if(l+1>=a)throw f}return po.parse(n)}function gtt(t){console.log(`[dotenv@${QH}][INFO] ${t}`)}function mtt(t){console.log(`[dotenv@${QH}][WARN] ${t}`)}function RH(t){console.log(`[dotenv@${QH}][DEBUG] ${t}`)}function Xue(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function ytt(t,e){let r;try{r=new URL(e)}catch(f){throw f.code==="ERR_INVALID_URL"?new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development"):f}let s=r.password;if(!s)throw new Error("INVALID_DOTENV_KEY: Missing key part");let a=r.searchParams.get("environment");if(!a)throw new Error("INVALID_DOTENV_KEY: Missing environment part");let n=`DOTENV_VAULT_${a.toUpperCase()}`,l=t.parsed[n];if(!l)throw new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${n} in your .env.vault file.`);return{ciphertext:l,key:s}}function $ue(t){let e=TH.resolve(process.cwd(),".env");return t&&t.path&&t.path.length>0&&(e=t.path),e.endsWith(".vault")?e:`${e}.vault`}function Ett(t){return t[0]==="~"?TH.join(utt.homedir(),t.slice(1)):t}function Itt(t){gtt("Loading env from encrypted .env.vault");let e=po._parseVault(t),r=process.env;return t&&t.processEnv!=null&&(r=t.processEnv),po.populate(r,e,t),{parsed:e}}function wtt(t){let e=TH.resolve(process.cwd(),".env"),r="utf8",s=!!(t&&t.debug);t&&(t.path!=null&&(e=Ett(t.path)),t.encoding!=null&&(r=t.encoding));try{let a=po.parse(Zue.readFileSync(e,{encoding:r})),n=process.env;return t&&t.processEnv!=null&&(n=t.processEnv),po.populate(n,a,t),{parsed:a}}catch(a){return s&&RH(`Failed to load ${e} ${a.message}`),{error:a}}}function Ctt(t){let e=$ue(t);return Xue(t).length===0?po.configDotenv(t):Zue.existsSync(e)?po._configVault(t):(mtt(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),po.configDotenv(t))}function Btt(t,e){let r=Buffer.from(e.slice(-64),"hex"),s=Buffer.from(t,"base64"),a=s.slice(0,12),n=s.slice(-16);s=s.slice(12,-16);try{let l=ftt.createDecipheriv("aes-256-gcm",r,a);return l.setAuthTag(n),`${l.update(s)}${l.final()}`}catch(l){let f=l instanceof RangeError,h=l.message==="Invalid key length",A=l.message==="Unsupported state or unable to authenticate data";if(f||h){let m="INVALID_DOTENV_KEY: It must be 64 characters long (or more)";throw new Error(m)}else if(A){let m="DECRYPTION_FAILED: Please check your DOTENV_KEY";throw new Error(m)}else throw console.error("Error: ",l.code),console.error("Error: ",l.message),l}}function vtt(t,e,r={}){let s=!!(r&&r.debug),a=!!(r&&r.override);if(typeof e!="object")throw new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");for(let n of Object.keys(e))Object.prototype.hasOwnProperty.call(t,n)?(a===!0&&(t[n]=e[n]),s&&RH(a===!0?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):t[n]=e[n]}var po={configDotenv:wtt,_configVault:Itt,_parseVault:dtt,config:Ctt,decrypt:Btt,parse:ptt,populate:vtt};kp.exports.configDotenv=po.configDotenv;kp.exports._configVault=po._configVault;kp.exports._parseVault=po._parseVault;kp.exports.config=po.config;kp.exports.decrypt=po.decrypt;kp.exports.parse=po.parse;kp.exports.populate=po.populate;kp.exports=po});var rfe=H((H7t,tfe)=>{"use strict";tfe.exports=(t,...e)=>new Promise(r=>{r(t(...e))})});var hy=H((j7t,FH)=>{"use strict";var Stt=rfe(),nfe=t=>{if(t<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=[],r=0,s=()=>{r--,e.length>0&&e.shift()()},a=(f,h,...A)=>{r++;let m=Stt(f,...A);h(m),m.then(s,s)},n=(f,h,...A)=>{r<t?a(f,h,...A):e.push(a.bind(null,f,h,...A))},l=(f,...h)=>new Promise(A=>n(f,A,...h));return Object.defineProperties(l,{activeCount:{get:()=>r},pendingCount:{get:()=>e.length}}),l};FH.exports=nfe;FH.exports.default=nfe});function Mh(t){return`YN${t.toString(10).padStart(4,"0")}`}function KT(t){let e=Number(t.slice(2));if(typeof Tr[e]>"u")throw new Error(`Unknown message name: "${t}"`);return e}var Tr,zT=tt(()=>{Tr=(Ge=>(Ge[Ge.UNNAMED=0]="UNNAMED",Ge[Ge.EXCEPTION=1]="EXCEPTION",Ge[Ge.MISSING_PEER_DEPENDENCY=2]="MISSING_PEER_DEPENDENCY",Ge[Ge.CYCLIC_DEPENDENCIES=3]="CYCLIC_DEPENDENCIES",Ge[Ge.DISABLED_BUILD_SCRIPTS=4]="DISABLED_BUILD_SCRIPTS",Ge[Ge.BUILD_DISABLED=5]="BUILD_DISABLED",Ge[Ge.SOFT_LINK_BUILD=6]="SOFT_LINK_BUILD",Ge[Ge.MUST_BUILD=7]="MUST_BUILD",Ge[Ge.MUST_REBUILD=8]="MUST_REBUILD",Ge[Ge.BUILD_FAILED=9]="BUILD_FAILED",Ge[Ge.RESOLVER_NOT_FOUND=10]="RESOLVER_NOT_FOUND",Ge[Ge.FETCHER_NOT_FOUND=11]="FETCHER_NOT_FOUND",Ge[Ge.LINKER_NOT_FOUND=12]="LINKER_NOT_FO Line truncated
`,"\r","(",")","!","|","&","^"],!0,!1),ae=function(re){return e.queryPattern.test(re)},ge=function(re){return e.checkFn(re)},de=Qe("whitespace"),xe=/^[ \t\n\r]/,we=Fe([" "," ",`
`,"\r"],!1,!1),d=0,be=0,Ce=[{line:1,column:1}],Ee=0,he=[],$=0,De;if("startRule"in e){if(!(e.startRule in s))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=s[e.startRule]}function Te(){return t.substring(be,d)}function ot(){return Me(be,d)}function j(re,ce){throw ce=ce!==void 0?ce:Me(be,d),P([Qe(re)],t.substring(be,d),ce)}function rt(re,ce){throw ce=ce!==void 0?ce:Me(be,d),C(re,ce)}function Ne(re,ce){return{type:"literal",text:re,ignoreCase:ce}}function Fe(re,ce,ke){return{type:"class",parts:re,inverted:ce,ignoreCase:ke}}function Pe(){return{type:"any"}}function He(){return{type:"end"}}function Qe(re){return{type:"other",description:re}}function ft(re){var ce=Ce[re],ke;if(ce)return ce;for(ke=re-1;!Ce[ke];)ke--;for(ce=Ce[ke],ce={line:ce.line,column:ce.column};ke<re;)t.charCodeAt(ke)===10?(ce.line++,ce.column=1):ce.column++,ke++;return Ce[re]=ce,ce}function Me(re,ce){var ke=ft(re),Le=ft(ce);return{start:{offset:re,line:ke.line,column:ke.column},end:{offset:ce,line:Le.line,column:Le.column}}}function x(re){d<Ee||(d>Ee&&(Ee=d,he=[]),he.push(re))}function C(re,ce){return new Ay(re,null,null,ce)}function P(re,ce,ke){return new Ay(Ay.buildMessage(re,ce),re,ce,ke)}function E(){var re,ce,ke,Le,pt,St,er,ur;if(re=d,ce=F(),ce!==r){for(ke=[],Le=d,pt=X(),pt!==r?(t.charCodeAt(d)===124?(St=n,d++):(St=r,$===0&&x(l)),St===r&&(t.charCodeAt(d)===38?(St=f,d++):(St=r,$===0&&x(h)),St===r&&(t.charCodeAt(d)===94?(St=A,d++):(St=r,$===0&&x(m)))),St!==r?(er=X(),er!==r?(ur=F(),ur!==r?(pt=[pt,St,er,ur],Le=pt):(d=Le,Le=r)):(d=Le,Le=r)):(d=Le,Le=r)):(d=Le,Le=r);Le!==r;)ke.push(Le),Le=d,pt=X(),pt!==r?(t.charCodeAt(d)===124?(St=n,d++):(St=r,$===0&&x(l)),St===r&&(t.charCodeAt(d)===38?(St=f,d++):(St=r,$===0&&x(h)),St===r&&(t.charCodeAt(d)===94?(St=A,d++):(St=r,$===0&&x(m)))),St!==r?(er=X(),er!==r?(ur=F(),ur!==r?(pt=[pt,St,er,ur],Le=pt):(d=Le,Le=r)):(d=Le,Le=r)):(d=Le,Le=r)):(d=Le,Le=r);ke!==r?(be=re,ce=w(ce,ke),re=ce):(d=re,re=r)}else d=re,re=r;return re}function F(){var re,ce,ke,Le,pt,St;return re=d,t.charCodeAt(d)===33?(ce=v,d++):(ce=r,$===0&&x(D)),ce!==r?(ke=F(),ke!==r?(be=re,ce=I(ke),re=ce):(d=re,re=r)):(d=re,re=r),re===r&&(re=d,t.charCodeAt(d)===40?(ce=R,d++):(ce=r,$===0&&x(N)),ce!==r?(ke=X(),ke!==r?(Le=E(),Le!==r?(pt=X(),pt!==r?(t.charCodeAt(d)===41?(St=U,d++):(St=r,$===0&&x(V)),St!==r?(be=re,ce=ee(Le),re=ce):(d=re,re=r)):(d=re,re=r)):(d=re,re=r)):(d=re,re=r)):(d=re,re=r),re===r&&(re=Z())),re}function Z(){var re,ce,ke,Le,pt;if(re=d,ce=X(),ce!==r){if(ke=d,Le=[],te.test(t.charAt(d))?(pt=t.charAt(d),d++):(pt=r,$===0&&x(ie)),pt!==r)for(;pt!==r;)Le.push(pt),te.test(t.charAt(d))?(pt=t.charAt(d),d++):(pt=r,$===0&&x(ie));else Le=r;Le!==r?ke=t.substring(ke,d):ke=Le,ke!==r?(be=d,Le=ae(ke),Le?Le=void 0:Le=r,Le!==r?(be=re,ce=ge(ke),re=ce):(d=re,re=r)):(d=re,re=r)}else d=re,re=r;return re}function X(){var re,ce;for($++,re=[],xe.test(t.charAt(d))?(ce=t.charAt(d),d++):(ce=r,$===0&&x(we));ce!==r;)re.push(ce),xe.test(t.charAt(d))?(ce=t.charAt(d),d++):(ce=r,$===0&&x(we));return $--,re===r&&(ce=r,$===0&&x(de)),re}if(De=a(),De!==r&&d===t.length)return De;throw De!==r&&d<t.length&&x(He()),P(he,Ee<t.length?t.charAt(Ee):null,Ee<t.length?Me(Ee,Ee+1):Me(Ee,Ee))}Khe.exports={SyntaxError:Ay,parse:Fit}});var Jhe=H(cQ=>{var{parse:Nit}=zhe();cQ.makeParser=(t=/[a-z]+/)=>(e,r)=>Nit(e,{queryPattern:t,checkFn:r});cQ.parse=cQ.makeParser()});var Xhe=H((LVt,Zhe)=>{"use strict";Zhe.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodLine truncated
`:`
`)+r,a=s+1,s=t.indexOf(`
`,a)}while(s!==-1);return n+=t.substr(a),n};dAe.exports={stringReplaceAll:Kit,stringEncaseCRLFWithFirstIndex:zit}});var wAe=H((VVt,IAe)=>{"use strict";var Jit=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,mAe=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Zit=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Xit=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,$it=new Map([["n",`
`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function EAe(t){let e=t[0]==="u",r=t[1]==="{";return e&&!r&&t.length===5||t[0]==="x"&&t.length===3?String.fromCharCode(parseInt(t.slice(1),16)):e&&r?String.fromCodePoint(parseInt(t.slice(2,-1),16)):$it.get(t)||t}function est(t,e){let r=[],s=e.trim().split(/\s*,\s*/g),a;for(let n of s){let l=Number(n);if(!Number.isNaN(l))r.push(l);else if(a=n.match(Zit))r.push(a[2].replace(Xit,(f,h,A)=>h?EAe(h):A));else throw new Error(`Invalid Chalk template style argument: ${n} (in style '${t}')`)}return r}function tst(t){mAe.lastIndex=0;let e=[],r;for(;(r=mAe.exec(t))!==null;){let s=r[1];if(r[2]){let a=est(s,r[2]);e.push([s].concat(a))}else e.push([s])}return e}function yAe(t,e){let r={};for(let a of e)for(let n of a.styles)r[n[0]]=a.inverse?null:n.slice(1);let s=t;for(let[a,n]of Object.entries(r))if(Array.isArray(n)){if(!(a in s))throw new Error(`Unknown Chalk style: ${a}`);s=n.length>0?s[a](...n):s[a]}return s}IAe.exports=(t,e)=>{let r=[],s=[],a=[];if(e.replace(Jit,(n,l,f,h,A,m)=>{if(l)a.push(EAe(l));else if(h){let w=a.join("");a=[],s.push(r.length===0?w:yAe(t,r)(w)),r.push({inverse:f,styles:tst(h)})}else if(A){if(r.length===0)throw new Error("Found extraneous } in Chalk template literal");s.push(yAe(t,r)(a.join(""))),a=[],r.pop()}else a.push(m)}),s.push(a.join("")),r.length>0){let n=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(n)}return s.join("")}});var Cw=H((WVt,DAe)=>{"use strict";var kS=fQ(),{stdout:a5,stderr:c5}=pAe(),{stringReplaceAll:rst,stringEncaseCRLFWithFirstIndex:nst}=gAe(),{isArray:hQ}=Array,BAe=["ansi","ansi","ansi256","ansi16m"],ww=Object.create(null),ist=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=a5?a5.level:0;t.level=e.level===void 0?r:e.level},l5=class{constructor(e){return vAe(e)}},vAe=t=>{let e={};return ist(e,t),e.template=(...r)=>bAe(e.template,...r),Object.setPrototypeOf(e,AQ.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=l5,e.template};function AQ(t){return vAe(t)}for(let[t,e]of Object.entries(kS))ww[t]={get(){let r=pQ(this,u5(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,t,{value:r}),r}};ww.visible={get(){let t=pQ(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:t}),t}};var SAe=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let t of SAe)ww[t]={get(){let{level:e}=this;return function(...r){let s=u5(kS.color[BAe[e]][t](...r),kS.color.close,this._styler);return pQ(this,s,this._isEmpty)}}};for(let t of SAe){let e="bg"+t[0].toUpperCase()+t.slice(1);ww[e]={get(){let{level:r}=this;return function(...s){let a=u5(kS.bgColor[BAe[r]][t](...s),kS.bgColor.close,this._styler);return pQ(this,a,this._isEmpty)}}}}var sst=Object.defineProperties(()=>{},{...ww,level:{enumerable:!0,get(){return this._generator.level},set(t){this._generator.level=t}}}),u5=(t,e,r)=>{let s,a;return r===void 0?(s=t,a=e):(s=r.openAll+t,a=e+r.closeAll),{open:t,close:e,openAll:s,closeAll:a,parent:r}},pQ=(t,e,r)=>{let s=(...a)=>hQ(a[0])&&hQ(a[0].raw)?CAe(s,bAe(s,...a)):CAe(s,a.length===1?""+a[0]:a.join(" "));return Object.setPrototypeOf(s,sst),s._generator=t,s._styler=e,s._isEmpty=r,s},CAe=(t,e)=>{if(t.level<=0||!e)return t._isEmpty?"":e;let r=t._styler;if(r===void 0)return e;let{openAll:s,closeAll:a}=r;if(e.indexOf("\x1B")!==-1)for(;r!==void 0;)e=rst(e,r.close,r.open),r=r.parent;let n=e.indexOf(`
`);return n!==-1&&(e=nst(e,a,s,n)),s+e+a},o5,bAe=(t,...e)=>{let[r]=e;if(!hQ(r)||!hQ(r.raw))return e.join(" ");let s=e.slice(1),a=[r.raw[0]];for(let n=1;n<r.length;n++)a.push(String(s[n-1]).replace(/[{}\\]/g,"\\$&"),String(r.raw[n]));return o5===void 0&&(o5=wAe()),o5(t,a.join(""))};Object.defineProperties(AQ.prototype,ww);var dQ=AQ();dQ.supportsColor=a5;dQ.stderr=AQ({level:c5?c5.level:0});dQ.stderr.supportsColor=c5;DAe.exports=dQ});var gQ=H(fu=>{"use strict";fu.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;fu.find=(t,e)=>t.nodes.find(r=>r.type===e);fu.exceedsLimit=(t,e,r=1,s)=>s===!1||!fu.isInteger(t)||!fu.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=s;fu.escapeNode=(t,e=0,r)=>{let s=t.nodes[e];s&&(r&&s.type===r||s.type==="open"||s.type==="close")&&s.escaped!==!0&&(s.value="\\"+s.value,s.escaped=!0)};fu.encloseBrace=t=>t.type!=="brace"||t.commas>>0+t.ranges>>0?!1:(t.invalid=!0,!0);fu.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:!(t.commas>>0+t.ranges>>0)||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;fu.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;fu.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);fu.flatten=(...t)=>{let e=[],r=s=>{for(let a=0;a<s.length;a++){let n=s[a];Array.isArray(n)?r(n,e):n!==void 0&&e.push(n)}return e};return r(t),e}});var mQ=H((KVt,xAe)=>{"use strict";var PAe=gQ();xAe.exports=(t,e={})=>{let r=(s,a={})=>{let n=e.escapeInvalid&&PAe.isInvalidBrace(a),l=s.invalid===!0&&e.escapeInvalid===!0,f="";if(s.value)return(n||l)&&PAe.isOpenOrClose(s)?"\\"+s.value:s.value;if(s.value)return s.value;if(s.nodes)for(let h of s.nodes)f+=r(h);return f};return r(t)}});var RAe=H((zVt,kAe)=>{"use strict";kAe.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var UAe=H((JVt,MAe)=>{"use strict";var TAe=RAe(),py=(t,e,r)=>{if(TAe(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(TAe(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let s={relaxZeros:!0,...r};typeof s.strictZeros=="boolean"&&(s.relaxZeros=s.strictZeros===!1);let a=String(s.relaxZeros),n=String(s.shorthand),l=String(s.capture),f=String(s.wrap),h=t+":"+e+"="+a+n+l+f;if(py.cache.hasOwnProperty(h))return py.cache[h].result;let A=Math.min(t,e),m=Math.max(t,e);if(Math.abs(A-m)===1){let R=t+"|"+e;return s.capture?`(${R})`:s.wrap===!1?R:`(?:${R})`}let w=_Ae(t)||_Ae(e),v={min:t,max:e,a:A,b:m},D=[],I=[];if(w&&(v.isPadded=w,v.maxLen=String(v.max).length),A<0){let R=m<0?Math.abs(m):1;I=QAe(R,Math.abs(A),v,s),A=v.a=0}return m>=0&&(D=QAe(A,m,v,s)),v.negatives=I,v.positives=D,v.result=ost(I,D,s),s.capture===!0?v.result=`(${v.result})`:s.wrap!==!1&&D.length+I.length>1&&(v.result=`(?:${v.result})`),py.cache[h]=v,v.result};function ost(t,e,r){let s=f5(t,e,"-",!1,r)||[],a=f5(e,t,"",!1,r)||[],n=f5(t,e,"-?",!0,r)||[];return s.concat(n).concat(a).join("|")}function ast(t,e){let r=1,s=1,a=NAe(t,r),n=new Set([e]);for(;t<=a&&a<=e;)n.add(a),r+=1,a=NAe(t,r);for(a=OAe(e+1,s)-1;t<a&&a<=e;)n.add(a),s+=1,a=OAe(e+1,s)-1;return n=[...n],n.sort(ust),n}function cst(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let s=lst(t,e),a=s.length,n="",l=0;for(let f=0;f<a;f++){let[h,A]=s[f];h===A?n+=h:h!=="0"||A!=="9"?n+=fst(h,A,r):l++}return l&&(n+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:n,count:[l],digits:a}}function QAe(t,e,r,s){let a=ast(t,e),n=[],l=t,f;for(let h=0;h<a.length;h++){let A=a[h],m=cst(String(l),String(A),s),w="";if(!r.isPadded&&f&&f.pattern===m.pattern){f.count.length>1&&f.count.pop(),f.count.push(m.count[0]),f.string=f.pattern+LAe(f.count),l=A+1;continue}r.isPadded&&(w=hst(A,r,s)),m.string=w+m.pattern+LAe(m.count),n.push(m),l=A+1,f=m}return n}function f5(t,e,r,s,a){let n=[];for(let l of t){let{string:f}=l;!s&&!FAe(e,"string",f)&&n.push(r+f),s&&FAe(e,"string",f)&&n.push(r+f)}return n}function lst(t,e){let r=[];for(let s=0;s<t.length;s++)r.push([t[s],e[s]]);return r}function ust(t,e){return t>e?1:e>t?-1:0}function FAe(t,e,r){return t.some(s=>s[e]===r)}function NAe(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function OAe(t,e){return t-t%Math.pow(10,e)}function LAe(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function fst(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function _Ae(t){return/^-?(0+)\d/.test(t)}function hst(t,e,r){if(!e.isPadded)return t;let s=Math.abs(e.maxLen-String(t).length),a=r.relaxZeros!==!1;switch(s){case 0:return"";case 1:return a?"0?":"0";case 2:return a?"0{0,2}":"00";default:return a?`0{0,${s}}`:`0{${s}}`}}py.cache={};py.clearCache=()=>py.cache={};MAe.exports=py});var p5=H((ZVt,KAe)=>{"use strict";var Ast=Ae("util"),GAe=UAe(),HAe=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),pst=t=>e=>t===!0?Number(e):String(e),h5=t=>typeof t=="numb Line truncated
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var ape=H((tWt,ope)=>{"use strict";var Sst=mQ(),{MAX_LENGTH:npe,CHAR_BACKSLASH:d5,CHAR_BACKTICK:bst,CHAR_COMMA:Dst,CHAR_DOT:Pst,CHAR_LEFT_PARENTHESES:xst,CHAR_RIGHT_PARENTHESES:kst,CHAR_LEFT_CURLY_BRACE:Rst,CHAR_RIGHT_CURLY_BRACE:Tst,CHAR_LEFT_SQUARE_BRACKET:ipe,CHAR_RIGHT_SQUARE_BRACKET:spe,CHAR_DOUBLE_QUOTE:Qst,CHAR_SINGLE_QUOTE:Fst,CHAR_NO_BREAK_SPACE:Nst,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Ost}=rpe(),Lst=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},s=typeof r.maxLength=="number"?Math.min(npe,r.maxLength):npe;if(t.length>s)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${s})`);let a={type:"root",input:t,nodes:[]},n=[a],l=a,f=a,h=0,A=t.length,m=0,w=0,v,D={},I=()=>t[m++],R=N=>{if(N.type==="text"&&f.type==="dot"&&(f.type="text"),f&&f.type==="text"&&N.type==="text"){f.value+=N.value;return}return l.nodes.push(N),N.parent=l,N.prev=f,f=N,N};for(R({type:"bos"});m<A;)if(l=n[n.length-1],v=I(),!(v===Ost||v===Nst)){if(v===d5){R({type:"text",value:(e.keepEscaping?v:"")+I()});continue}if(v===spe){R({type:"text",value:"\\"+v});continue}if(v===ipe){h++;let N=!0,U;for(;m<A&&(U=I());){if(v+=U,U===ipe){h++;continue}if(U===d5){v+=I();continue}if(U===spe&&(h--,h===0))break}R({type:"text",value:v});continue}if(v===xst){l=R({type:"paren",nodes:[]}),n.push(l),R({type:"text",value:v});continue}if(v===kst){if(l.type!=="paren"){R({type:"text",value:v});continue}l=n.pop(),R({type:"text",value:v}),l=n[n.length-1];continue}if(v===Qst||v===Fst||v===bst){let N=v,U;for(e.keepQuotes!==!0&&(v="");m<A&&(U=I());){if(U===d5){v+=U+I();continue}if(U===N){e.keepQuotes===!0&&(v+=U);break}v+=U}R({type:"text",value:v});continue}if(v===Rst){w++;let U={type:"brace",open:!0,close:!1,dollar:f.value&&f.value.slice(-1)==="$"||l.dollar===!0,depth:w,commas:0,ranges:0,nodes:[]};l=R(U),n.push(l),R({type:"open",value:v});continue}if(v===Tst){if(l.type!=="brace"){R({type:"text",value:v});continue}let N="close";l=n.pop(),l.close=!0,R({type:N,value:v}),w--,l=n[n.length-1];continue}if(v===Dst&&w>0){if(l.ranges>0){l.ranges=0;let N=l.nodes.shift();l.nodes=[N,{type:"text",value:Sst(l)}]}R({type:"comma",value:v}),l.commas++;continue}if(v===Pst&&w>0&&l.commas===0){let N=l.nodes;if(w===0||N.length===0){R({type:"text",value:v});continue}if(f.type==="dot"){if(l.range=[],f.value+=v,f.type="range",l.nodes.length!==3&&l.nodes.length!==5){l.invalid=!0,l.ranges=0,f.type="text";continue}l.ranges++,l.args=[];continue}if(f.type==="range"){N.pop();let U=N[N.length-1];U.value+=f.value+v,f=U,l.ranges--;continue}R({type:"dot",value:v});continue}R({type:"text",value:v})}do if(l=n.pop(),l.type!=="root"){l.nodes.forEach(V=>{V.nodes||(V.type==="open"&&(V.isOpen=!0),V.type==="close"&&(V.isClose=!0),V.nodes||(V.type="text"),V.invalid=!0)});let N=n[n.length-1],U=N.nodes.indexOf(l);N.nodes.splice(U,1,...l.nodes)}while(n.length>0);return R({type:"eos"}),a};ope.exports=Lst});var upe=H((rWt,lpe)=>{"use strict";var cpe=mQ(),_st=ZAe(),Mst=epe(),Ust=ape(),Dl=(t,e={})=>{let r=[];if(Array.isArray(t))for(let s of t){let a=Dl.create(s,e);Array.isArray(a)?r.push(...a):r.push(a)}else r=[].concat(Dl.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Dl.parse=(t,e={})=>Ust(t,e);Dl.stringify=(t,e={})=>cpe(typeof t=="string"?Dl.parse(t,e):t,e);Dl.compile=(t,e={})=>(typeof t=="string"&&(t=Dl.parse(t,e)),_st(t,e));Dl.expand=(t,e={})=>{typeof t=="string"&&(t=Dl.parse(t,e));let r=Mst(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Dl.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Dl.compile(t,e):Dl.expand(t,e);lpe.exports=Dl});var TS=H((nWt,dpe)=>{"use strict";var Hst=Ae("path"),Hh="\\\\/",fpe=`[^${Hh}]`,Rp="\\.",jst="\\+",Gst="\\?",EQ="\\/",qst="(?=.)",hpe="[^/]",g5=`(?:${EQ}|$)`,Ape=`(?:^|${EQ})`,m5=`${Rp}{1,2}${g5}`,Vst=`(?!${Rp})`,Wst=`(?!${Ape}${m5})`,Yst=`(?!${Rp}{0,1}${g5})`,Kst=`(?!${m5})`,zst=`[^.${EQ}]`,Jst=`${hpe}*?`,ppe={DOT_LITERAL:Rp,PLUS_LITERAL:jst,QMARK_LITERAL:Gst,SLASH_LITERAL:EQ,ONE_CHAR:qst,QMARK:hpe,END_ANCHOR:g5,DOTS_SLASH:m5,NO_DOT:Vst,NO_DOTS:Wst,NO_DOT_SLASH:Yst,NO_DOTS_SLASH:Kst,QMARK_NO_DOT:zst,STAR:Jst,START_ANCHOR:Ape},Zst={...ppe,SLASH_LITERAL:`[${Hh}]`,QMARK:fpe,STAR:`${fpe}*?`,DOTS_SLASH:`${Rp}{1,2}(?:[${Hh}]|$)`,NO_DOT:`(?!${Rp})`,NO_DOTS:`(?!(?:^|[${Hh}])${Rp}{1,2}(?:[${Hh}]|$))`,NO_DOT_SLASH:`(?!${Rp}{0,1}(?:[${Hh}]|$))`,NO_DOTS_SLASH:`(?!${Rp}{1,2}(?:[${Hh}]|$))`,QMARK_NO_DOT:`[^.${Hh}]`,START_ANCHOR:`(?:^|[${Hh}])`,END_ANCHOR:`(?:[${Hh}]|$)`},Xst={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&' Line truncated
`),f!==-1){let h=a+l.substring(0,f);l=l.substring(f+1),a="",e!==null?this.reportInfo(null,`${e} ${h}`):this.reportInfo(null,h)}while(f!==-1);a+=l}),r.on("end",()=>{let n=s.end();n!==""&&(e!==null?this.reportInfo(null,`${e} ${n}`):this.reportInfo(null,n))}),r}}});var Zw,H9=tt(()=>{mu();Ea();Zw=class{constructor(e){this.fetchers=e}supports(e,r){return!!this.tryFetcher(e,r)}getLocalPath(e,r){return this.getFetcher(e,r).getLocalPath(e,r)}async fetch(e,r){return await this.getFetcher(e,r).fetch(e,r)}tryFetcher(e,r){let s=this.fetchers.find(a=>a.supports(e,r));return s||null}getFetcher(e,r){let s=this.fetchers.find(a=>a.supports(e,r));if(!s)throw new Zt(11,`${hn(r.project.configuration,e)} isn't supported by any available fetcher`);return s}}});var Dy,j9=tt(()=>{Ea();Dy=class{constructor(e){this.resolvers=e.filter(r=>r)}supportsDescriptor(e,r){return!!this.tryResolverByDescriptor(e,r)}supportsLocator(e,r){return!!this.tryResolverByLocator(e,r)}shouldPersistResolution(e,r){return this.getResolverByLocator(e,r).shouldPersistResolution(e,r)}bindDescriptor(e,r,s){return this.getResolverByDescriptor(e,s).bindDescriptor(e,r,s)}getResolutionDependencies(e,r){return this.getResolverByDescriptor(e,r).getResolutionDependencies(e,r)}async getCandidates(e,r,s){return await this.getResolverByDescriptor(e,s).getCandidates(e,r,s)}async getSatisfying(e,r,s,a){return this.getResolverByDescriptor(e,a).getSatisfying(e,r,s,a)}async resolve(e,r){return await this.getResolverByLocator(e,r).resolve(e,r)}tryResolverByDescriptor(e,r){let s=this.resolvers.find(a=>a.supportsDescriptor(e,r));return s||null}getResolverByDescriptor(e,r){let s=this.resolvers.find(a=>a.supportsDescriptor(e,r));if(!s)throw new Error(`${xi(r.project.configuration,e)} isn't supported by any available resolver`);return s}tryResolverByLocator(e,r){let s=this.resolvers.find(a=>a.supportsLocator(e,r));return s||null}getResolverByLocator(e,r){let s=this.resolvers.find(a=>a.supportsLocator(e,r));if(!s)throw new Error(`${hn(r.project.configuration,e)} isn't supported by any available resolver`);return s}}});var Xw,G9=tt(()=>{Mt();Ea();Xw=class{supports(e){return!!e.reference.startsWith("virtual:")}getLocalPath(e,r){let s=e.reference.indexOf("#");if(s===-1)throw new Error("Invalid virtual package reference");let a=e.reference.slice(s+1),n=mo(e,a);return r.fetcher.getLocalPath(n,r)}async fetch(e,r){let s=e.reference.indexOf("#");if(s===-1)throw new Error("Invalid virtual package reference");let a=e.reference.slice(s+1),n=mo(e,a),l=await r.fetcher.fetch(n,r);return await this.ensureVirtualLink(e,l,r)}getLocatorFilename(e){return Yw(e)}async ensureVirtualLink(e,r,s){let a=r.packageFs.getRealPath(),n=s.project.configuration.get("virtualFolder"),l=this.getLocatorFilename(e),f=Mo.makeVirtualPath(n,l,a),h=new Qh(f,{baseFs:r.packageFs,pathUtils:Y});return{...r,packageFs:h}}}});var UF,qge=tt(()=>{UF=class t{static{this.protocol="virtual:"}static isVirtualDescriptor(e){return!!e.range.startsWith(t.protocol)}static isVirtualLocator(e){return!!e.reference.startsWith(t.protocol)}supportsDescriptor(e,r){return t.isVirtualDescriptor(e)}supportsLocator(e,r){return t.isVirtualLocator(e)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,s){throw new Error('Assertion failed: calling "bindDescriptor" on a virtual descriptor is unsupported')}getResolutionDependencies(e,r){throw new Error('Assertion failed: calling "getResolutionDependencies" on a virtual descriptor is unsupported')}async getCandidates(e,r,s){throw new Error('Assertion failed: calling "getCandidates" on a virtual descriptor is unsupported')}async getSatisfying(e,r,s,a){throw new Error('Assertion failed: calling "getSatisfying" on a virtual descriptor is unsupported')}async resolve(e,r){throw new Error('Assertion failed: calling "resolve" on a virtual locator is unsupported')}}});var $w,q9=tt(()=>{Mt();by();$w=class{supports(e){return!!e.reference.startsWith(Gi.protocol)}getLocalPath(e,r){return this.getWorkspace(e,r).cwd}async fetch(e,r){let s=this.getWorkspace(e,r).cwd;return{packageFs:new Jn(s),prefixPath:Rt.dot,localPath:s}}getWorkspace(e,r){return r.project.getWorkspaceByCwd(e.reference.slice(Gi.protocol.length))}}});function sb(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Vge(t){return typeof t>"u"?3:sb(t)?0:Array.isArray(t)?1:2}function Y9(t,e){return Object.hasOwn(t,e)}function aut(t){return sb(t)&&Y9(t,"onConflict")&&typeof t.onConflict=="string"}function cut(t){if(typeof t>"u")return{onConflict:"default",value:t};if(!aut(t))return{onConflict:"default",value:t};if(Y9(t,"value"))return t;let{onConflict:e,...r}=t;return{onConflict:e,value:r}}function Wge(t,e){let r=sb(t)&&Y9(t,e)?t[e]:void 0;return cut(r)}function eC(t,e){return[t,e,Yge]}function K9(t){return Array.isArray(t)?t[2]===Yge:!1}function V9(t,e){if(sb(t)){let r={};for(let s of Object.keys(t))r[s]=V9(t[s],e);return eC(e,r)}return Array.isArray(t)?eC(e,t.map(r=>V9(r,e))):eC(e,t)}function W9(t,e,r,s,a){let n,l=[],f=a,h=0;for(let m=a-Line truncated
Please report this to https://github.com/szmarczak/http2-wrapper/`);I(R)}return}s[0].resolve(D);return}}if(l in this.queue){if(f in this.queue[l]){this.queue[l][f].listeners.push(...s),this._tryToCreateNewSession(l,f);return}}else this.queue[l]={};let h=()=>{l in this.queue&&this.queue[l][f]===A&&(delete this.queue[l][f],Object.keys(this.queue[l]).length===0&&delete this.queue[l])},A=()=>{let m=`${f}:${l}`,w=!1;try{let v=Sft.connect(e,{createConnection:this.createConnection,settings:this.settings,session:this.tlsSessionCache.get(m),...r});v[oc]=0,v[sC]=!1;let D=()=>v[oc]<v.remoteSettings.maxConcurrentStreams,I=!0;v.socket.once("session",N=>{this.tlsSessionCache.set(m,N)}),v.once("error",N=>{for(let{reject:U}of s)U(N);this.tlsSessionCache.delete(m)}),v.setTimeout(this.timeout,()=>{v.destroy()}),v.once("close",()=>{if(w){I&&this._freeSessionsCount--,this._sessionsCount--;let N=this.sessions[l];N.splice(N.indexOf(v),1),N.length===0&&delete this.sessions[l]}else{let N=new Error("Session closed without receiving a SETTINGS frame");N.code="HTTP2WRAPPER_NOSETTINGS";for(let{reject:U}of s)U(N);h()}this._tryToCreateNewSession(l,f)});let R=()=>{if(!(!(l in this.queue)||!D())){for(let N of v[yu])if(N in this.queue[l]){let{listeners:U}=this.queue[l][N];for(;U.length!==0&&D();)U.shift().resolve(v);let V=this.queue[l];if(V[N].listeners.length===0&&(delete V[N],Object.keys(V).length===0)){delete this.queue[l];break}if(!D())break}}};v.on("origin",()=>{v[yu]=v.originSet,D()&&(R(),xG(this.sessions[l],v))}),v.once("remoteSettings",()=>{if(v.ref(),v.unref(),this._sessionsCount++,A.destroyed){let N=new Error("Agent has been destroyed");for(let U of s)U.reject(N);v.destroy();return}v[yu]=v.originSet;{let N=this.sessions;if(l in N){let U=N[l];U.splice(Pft(U,v,xft),0,v)}else N[l]=[v]}this._freeSessionsCount+=1,w=!0,this.emit("session",v),R(),h(),v[oc]===0&&this._freeSessionsCount>this.maxFreeSessions&&v.close(),s.length!==0&&(this.getSession(f,r,s),s.length=0),v.on("remoteSettings",()=>{R(),xG(this.sessions[l],v)})}),v[$me]=v.request,v.request=(N,U)=>{if(v[sC])throw new Error("The session is gracefully closing. No new streams are allowed.");let V=v[$me](N,U);return v.ref(),++v[oc],v[oc]===v.remoteSettings.maxConcurrentStreams&&this._freeSessionsCount--,V.once("close",()=>{if(I=D(),--v[oc],!v.destroyed&&!v.closed&&(kft(this.sessions[l],v),D()&&!v.closed)){I||(this._freeSessionsCount++,I=!0);let ee=v[oc]===0;ee&&v.unref(),ee&&(this._freeSessionsCount>this.maxFreeSessions||v[sC])?v.close():(xG(this.sessions[l],v),R())}}),V}}catch(v){for(let D of s)D.reject(v);h()}};A.listeners=s,A.completed=!1,A.destroyed=!1,this.queue[l][f]=A,this._tryToCreateNewSession(l,f)})}request(e,r,s,a){return new Promise((n,l)=>{this.getSession(e,r,[{reject:l,resolve:f=>{try{n(f.request(s,a))}catch(h){l(h)}}}])})}createConnection(e,r){return t.connect(e,r)}static connect(e,r){r.ALPNProtocols=["h2"];let s=e.port||443,a=e.hostname||e.host;return typeof r.servername>"u"&&(r.servername=a),vft.connect(s,a,r)}closeFreeSessions(){for(let e of Object.values(this.sessions))for(let r of e)r[oc]===0&&r.close()}destroy(e){for(let r of Object.values(this.sessions))for(let s of r)s.destroy(e);for(let r of Object.values(this.queue))for(let s of Object.values(r))s.destroyed=!0;this.queue={}}get freeSessions(){return eye({agent:this,isFree:!0})}get busySessions(){return eye({agent:this,isFree:!1})}};xy.kCurrentStreamsCount=oc;xy.kGracefullyClosing=sC;rye.exports={Agent:xy,globalAgent:new xy}});var TG=H((LJt,nye)=>{"use strict";var{Readable:Rft}=Ae("stream"),RG=class extends Rft{constructor(e,r){super({highWaterMark:r,autoDestroy:!1}),this.statusCode=null,this.statusMessage="",this.httpVersion="2.0",this.httpVersionMajor=2,this.httpVersionMinor=0,this.headers={},this.trailers={},this.req=null,this.aborted=!1,this.complete=!1,this.upgrade=null,this.rawHeaders=[],this.rawTrailers=[],this.socket=e,this.connection=e,this._dumped=!1}_destroy(e){this.req._request.destroy(e)}setTimeout(e,r){return this.req.setTimeout(e,r),this}_dump(){this._dumped||(this._dumped=!0,this.removeAllListeners("data"),this.resume())}_read(){this.req&&this.req._request.resume()}};nye.exports=RG});var QG=H((_Jt,iye)=>{"use strict";iye.exports=t=>{let e={protocol:t.protocol,hostname:typeof t.hostname=="string"&&t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,host:t.host,hash:t.hash,search:t.search,pathname:t.pathname,href:t.href,path:`${t.pathname||""}${t.search||""}`};return typeof t.port=="string"&&t.port.length!==0&&(e.port=Number(t.port)),(t.username||t.password)&&(e.auth=`${t.username||""}:${t.password||""}`),e}});var oye=H((MJt,sye)=>{"use strict";sye.exports=(t,e,r)=>{for(let s of r)t.on(s,(...a)=>e.emit(s,...a))}});var cye=H((UJt,aye)=>{"use strict";aye.exports=t=>{switch(t){case":method":case":scheme":case":authority":case":path":return!0;default:return!1}}});var uye=H((jJt,lye)=>{"use strict";var oC=(t,e,r)=>{lye.exports[e]=class extends t{constructor(...a){super(typeof r=="string"?r: Line truncated
`).reverse(),f=r.stack.slice(r.stack.indexOf(r.message)+r.message.length).split(`
`).reverse();for(;f.length!==0&&f[0]===l[0];)l.shift();this.stack=`${this.stack.slice(0,n)}${l.reverse().join(`
`)}${f.reverse().join(`
`)}`}}};ai.RequestError=Ls;var aN=class extends Ls{constructor(e){super(`Redirected ${e.options.maxRedirects} times. Aborting.`,{},e),this.name="MaxRedirectsError"}};ai.MaxRedirectsError=aN;var cN=class extends Ls{constructor(e){super(`Response code ${e.statusCode} (${e.statusMessage})`,{},e.request),this.name="HTTPError"}};ai.HTTPError=cN;var lN=class extends Ls{constructor(e,r){super(e.message,e,r),this.name="CacheError"}};ai.CacheError=lN;var uN=class extends Ls{constructor(e,r){super(e.message,e,r),this.name="UploadError"}};ai.UploadError=uN;var fN=class extends Ls{constructor(e,r,s){super(e.message,e,s),this.name="TimeoutError",this.event=e.event,this.timings=r}};ai.TimeoutError=fN;var gb=class extends Ls{constructor(e,r){super(e.message,e,r),this.name="ReadError"}};ai.ReadError=gb;var hN=class extends Ls{constructor(e){super(`Unsupported protocol "${e.url.protocol}"`,{},e),this.name="UnsupportedProtocolError"}};ai.UnsupportedProtocolError=hN;var _ht=["socket","connect","continue","information","upgrade","timeout"],AN=class extends Wye.Duplex{constructor(e,r={},s){super({autoDestroy:!1,highWaterMark:0}),this[cC]=0,this[uC]=0,this.requestInitialized=!1,this[iN]=new Set,this.redirects=[],this[fC]=!1,this[sN]=!1,this[db]=[],this.retryCount=0,this._progressCallbacks=[];let a=()=>this._unlockWrite(),n=()=>this._lockWrite();this.on("pipe",A=>{A.prependListener("data",a),A.on("data",n),A.prependListener("end",a),A.on("end",n)}),this.on("unpipe",A=>{A.off("data",a),A.off("data",n),A.off("end",a),A.off("end",n)}),this.on("pipe",A=>{A instanceof nq.IncomingMessage&&(this.options.headers={...A.headers,...this.options.headers})});let{json:l,body:f,form:h}=r;if((l||f||h)&&this._lockWrite(),ai.kIsNormalizedAlready in r)this.options=r;else try{this.options=this.constructor.normalizeArguments(e,r,s)}catch(A){gt.default.nodeStream(r.body)&&r.body.destroy(),this.destroy(A);return}(async()=>{var A;try{this.options.body instanceof mht.ReadStream&&await Nht(this.options.body);let{url:m}=this.options;if(!m)throw new TypeError("Missing `url` property");if(this.requestUrl=m.toString(),decodeURI(this.requestUrl),await this._finalizeBody(),await this._makeRequest(),this.destroyed){(A=this[Go])===null||A===void 0||A.destroy();return}for(let w of this[db])w();this[db].length=0,this.requestInitialized=!0}catch(m){if(m instanceof Ls){this._beforeError(m);return}this.destroyed||this.destroy(m)}})()}static normalizeArguments(e,r,s){var a,n,l,f,h;let A=r;if(gt.default.object(e)&&!gt.default.urlInstance(e))r={...s,...e,...r};else{if(e&&r&&r.url!==void 0)throw new TypeError("The `url` option is mutually exclusive with the `input` argument");r={...s,...r},e!==void 0&&(r.url=e),gt.default.urlInstance(r.url)&&(r.url=new V0.URL(r.url.toString()))}if(r.cache===!1&&(r.cache=void 0),r.dnsCache===!1&&(r.dnsCache=void 0),gt.assert.any([gt.default.string,gt.default.undefined],r.method),gt.assert.any([gt.default.object,gt.default.undefined],r.headers),gt.assert.any([gt.default.string,gt.default.urlInstance,gt.default.undefined],r.prefixUrl),gt.assert.any([gt.default.object,gt.default.undefined],r.cookieJar),gt.assert.any([gt.default.object,gt.default.string,gt.default.undefined],r.searchParams),gt.assert.any([gt.default.object,gt.default.string,gt.default.undefined],r.cache),gt.assert.any([gt.default.object,gt.default.number,gt.default.undefined],r.timeout),gt.assert.any([gt.default.object,gt.default.undefined],r.context),gt.assert.any([gt.default.object,gt.default.undefined],r.hooks),gt.assert.any([gt.default.boolean,gt.default.undefined],r.decompress),gt.assert.any([gt.default.boolean,gt.default.undefined],r.ignoreInvalidCookies),gt.assert.any([gt.default.boolean,gt.default.undefined],r.followRedirect),gt.assert.any([gt.default.number,gt.default.undefined],r.maxRedirects),gt.assert.any([gt.default.boolean,gt.default.undefined],r.throwHttpErrors),gt.assert.any([gt.default.boolean,gt.default.undefined],r.http2),gt.assert.any([gt.default.boolean,gt.default.undefined],r.allowGetBody),gt.assert.any([gt.default.string,gt.default.undefined],r.localAddress),gt.assert.any([Xye.isDnsLookupIpVersion,gt.default.undefined],r.dnsLookupIpVersion),gt.assert.any([gt.default.object,gt.default.undefined],r.https),gt.assert.any([gt.default.boolean,gt.default.undefined],r.rejectUnauthorized),r.https&&(gt.assert.any([gt.default.boolean,gt.default.undefined],r.https.rejectUnauthorized),gt.assert.any([gt.default.function_,gt.default.undefined],r.https.checkServerIdentity),gt.assert.any([gt.default.string,gt.default.object,gt.default.array,gt.default.undefined],r.https.certificateAuthority),gt.assert.any([gt.default.string,gt.default.object,gt.default.array,gt.default.undefined],r.https.key),gt.assert.any([gt.default.string,gt.default.object,gt.default.array,gt.default.undefined],r.https.certificate),gt.assert.any([gt.default.string,gt.default.undefined],r.https.passphrase),gt.assert.any([gt.default.string,gt.default.buffer,gt.default.array,gt.default.undefined],r.httpLine truncated
`)[3];return BAt(e)}function Iq(){return typeof IN.default.availableParallelism<"u"?IN.default.availableParallelism():Math.max(1,IN.default.cpus().length)}var IN,gAt,kEe,mAt,yAt,REe,TEe,wAt,CAt,wN=tt(()=>{Mt();IN=st(Ae("os"));CN();Au();gAt=Number(process.versions.node.split(".")[0]),kEe=new Map([["darwin","open"],["linux","xdg-open"],["win32","explorer.exe"]]).get(process.platform),mAt=typeof kEe<"u"?async t=>{try{return await wq(kEe,[t],{cwd:Y.cwd()}),!0}catch{return!1}}:void 0,yAt="/usr/bin/ldd";wAt=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,CAt=/\((\S*)(?::(\d+))(?::(\d+))\)/});function Dq(t,e,r,s,a){let n=ob(r);if(s.isArray||s.type==="ANY"&&Array.isArray(n))return Array.isArray(n)?n.map((l,f)=>Cq(t,`${e}[${f}]`,l,s,a)):String(n).split(/,/).map(l=>Cq(t,e,l,s,a));if(Array.isArray(n))throw new Error(`Non-array configuration settings "${e}" cannot be an array`);return Cq(t,e,r,s,a)}function Cq(t,e,r,s,a){let n=ob(r);switch(s.type){case"ANY":return HF(n);case"SHAPE":return PAt(t,e,r,s,a);case"MAP":return xAt(t,e,r,s,a)}if(n===null&&!s.isNullable&&s.default!==null)throw new Error(`Non-nullable configuration settings "${e}" cannot be set to null`);if("values"in s&&s.values?.includes(n))return n;let f=(()=>{if(s.type==="BOOLEAN"&&typeof n!="string")return qS(n);if(typeof n!="string")throw new Error(`Expected configuration setting "${e}" to be a string, got ${typeof n}`);let h=$Q(n,{env:t.env});switch(s.type){case"ABSOLUTE_PATH":{let A=a,m=z9(r);return m&&m[0]!=="<"&&(A=Y.dirname(m)),Y.resolve(A,me.toPortablePath(h))}case"LOCATOR_LOOSE":return Op(h,!1);case"NUMBER":return parseInt(h);case"LOCATOR":return Op(h);case"BOOLEAN":return qS(h);case"DURATION":return eF(h,s.unit);default:return h}})();if("values"in s&&s.values&&!s.values.includes(f))throw new Error(`Invalid value, expected one of ${s.values.join(", ")}`);return f}function PAt(t,e,r,s,a){let n=ob(r);if(typeof n!="object"||Array.isArray(n))throw new ht(`Object configuration settings "${e}" must be an object`);let l=Pq(t,s,{ignoreArrays:!0});if(n===null)return l;for(let[f,h]of Object.entries(n)){let A=`${e}.${f}`;if(!s.properties[f])throw new ht(`Unrecognized configuration settings found: ${e}.${f} - run "yarn config" to see the list of settings supported in Yarn`);l.set(f,Dq(t,A,h,s.properties[f],a))}return l}function xAt(t,e,r,s,a){let n=ob(r),l=new Map;if(typeof n!="object"||Array.isArray(n))throw new ht(`Map configuration settings "${e}" must be an object`);if(n===null)return l;for(let[f,h]of Object.entries(n)){let A=s.normalizeKeys?s.normalizeKeys(f):f,m=`${e}['${A}']`,w=s.valueDefinition;l.set(A,Dq(t,m,h,w,a))}return l}function Pq(t,e,{ignoreArrays:r=!1}={}){switch(e.type){case"SHAPE":{if(e.isArray&&!r)return[];let s=new Map;for(let[a,n]of Object.entries(e.properties))s.set(a,Pq(t,n));return s}case"MAP":return e.isArray&&!r?[]:new Map;case"ABSOLUTE_PATH":return e.default===null?null:t.projectCwd===null?Array.isArray(e.default)?e.default.map(s=>Y.normalize(s)):Y.isAbsolute(e.default)?Y.normalize(e.default):e.isNullable?null:void 0:Array.isArray(e.default)?e.default.map(s=>Y.resolve(t.projectCwd,s)):Y.resolve(t.projectCwd,e.default);case"DURATION":return eF(e.default,e.unit);default:return e.default}}function vN(t,e,r){if(e.type==="SECRET"&&typeof t=="string"&&r.hideSecrets)return DAt;if(e.type==="ABSOLUTE_PATH"&&typeof t=="string"&&r.getNativePaths)return me.fromPortablePath(t);if(e.isArray&&Array.isArray(t)){let s=[];for(let a of t)s.push(vN(a,e,r));return s}if(e.type==="MAP"&&t instanceof Map){if(t.size===0)return;let s=new Map;for(let[a,n]of t.entries()){let l=vN(n,e.valueDefinition,r);typeof l<"u"&&s.set(a,l)}return s}if(e.type==="SHAPE"&&t instanceof Map){if(t.size===0)return;let s=new Map;for(let[a,n]of t.entries()){let l=e.properties[a],f=vN(n,l,r);typeof f<"u"&&s.set(a,f)}return s}return t}function kAt(){let t={};for(let[e,r]of Object.entries(process.env))e=e.toLowerCase(),e.startsWith(SN)&&(e=(0,FEe.default)(e.slice(SN.length)),t[e]=r);return t}function vq(){let t=`${SN}rc_filename`;for(let[e,r]of Object.entries(process.env))if(e.toLowerCase()===t&&typeof r=="string")return r;return Sq}async function QEe(t){try{return await fe.readFilePromise(t)}catch{return Buffer.of()}}async function RAt(t,e){return Buffer.compare(...await Promise.all([QEe(t),QEe(e)]))===0}async function TAt(t,e){let[r,s]=await Promise.all([fe.statPromise(t),fe.statPromise(e)]);return r.dev===s.dev&&r.ino===s.ino}async function FAt({configuration:t,selfPath:e}){let r=t.get("yarnPath");return t.get("ignorePath")||r===null||r===e||await QAt(r,e)?null:r}var FEe,jp,NEe,OEe,LEe,Bq,SAt,wb,bAt,Gp,SN,Sq,DAt,hC,_Ee,bq,bN,BN,QAt,$e,Cb=tt(()=>{Mt();au();FEe=st(aue()),jp=st(ly());sr();NEe=st(efe()),OEe=Ae("module"),LEe=st(hy()),Bq=Ae("stream");Tge();Jw();H9();j9();G9();qge();q9();by();zge();GF();pu();G0();EN();Au();wN();_p();Ea();SAt=function(){if(!jp.GITHUB_ACTIONS||!process.env.GITHUB_EVE Line truncated
`);return{stdout:n,stderr:l}}makeResolver(){let e=[];for(let r of this.plugins.values())for(let s of r.resolvers||[])e.push(new s);return new Dy([new UF,new Gi,...e])}makeFetcher(){let e=[];for(let r of this.plugins.values())for(let s of r.fetchers||[])e.push(new s);return new Zw([new Xw,new $w,...e])}getLinkers(){let e=[];for(let r of this.plugins.values())for(let s of r.linkers||[])e.push(new s);return e}getSupportedArchitectures(){let e=Ib(),r=this.get("supportedArchitectures"),s=r.get("os");s!==null&&(s=s.map(l=>l==="current"?e.os:l));let a=r.get("cpu");a!==null&&(a=a.map(l=>l==="current"?e.cpu:l));let n=r.get("libc");return n!==null&&(n=kl(n,l=>l==="current"?e.libc??kl.skip:l)),{os:s,cpu:a,libc:n}}isInteractive({interactive:e,stdout:r}){return r.isTTY?e??this.get("preferInteractive"):!1}async getPackageExtensions(){if(this.packageExtensions!==null)return this.packageExtensions;this.packageExtensions=new Map;let e=this.packageExtensions,r=(s,a,{userProvided:n=!1}={})=>{if(!Vc(s.range))throw new Error("Only semver ranges are allowed as keys for the packageExtensions setting");let l=new nr;l.load(a,{yamlCompatibilityMode:!0});let f=GS(e,s.identHash),h=[];f.push([s.range,h]);let A={status:"inactive",userProvided:n,parentDescriptor:s};for(let m of l.dependencies.values())h.push({...A,type:"Dependency",descriptor:m});for(let m of l.peerDependencies.values())h.push({...A,type:"PeerDependency",descriptor:m});for(let[m,w]of l.peerDependenciesMeta)for(let[v,D]of Object.entries(w))h.push({...A,type:"PeerDependencyMeta",selector:m,key:v,value:D})};await this.triggerHook(s=>s.registerPackageExtensions,this,r);for(let[s,a]of this.get("packageExtensions"))r(q0(s,!0),XQ(a),{userProvided:!0});return e}normalizeLocator(e){return Vc(e.reference)?mo(e,`${this.get("defaultProtocol")}${e.reference}`):Gp.test(e.reference)?mo(e,`${this.get("defaultProtocol")}${e.reference}`):e}normalizeDependency(e){return Vc(e.range)?oi(e,`${this.get("defaultProtocol")}${e.range}`):Gp.test(e.range)?oi(e,`${this.get("defaultProtocol")}${e.range}`):e}normalizeDependencyMap(e){return new Map([...e].map(([r,s])=>[r,this.normalizeDependency(s)]))}normalizePackage(e,{packageExtensions:r}){let s=ZS(e),a=r.get(e.identHash);if(typeof a<"u"){let l=e.version;if(l!==null){for(let[f,h]of a)if(Wh(l,f))for(let A of h)switch(A.status==="inactive"&&(A.status="redundant"),A.type){case"Dependency":typeof s.dependencies.get(A.descriptor.identHash)>"u"&&(A.status="active",s.dependencies.set(A.descriptor.identHash,this.normalizeDependency(A.descriptor)));break;case"PeerDependency":typeof s.peerDependencies.get(A.descriptor.identHash)>"u"&&(A.status="active",s.peerDependencies.set(A.descriptor.identHash,A.descriptor));break;case"PeerDependencyMeta":{let m=s.peerDependenciesMeta.get(A.selector);(typeof m>"u"||!Object.hasOwn(m,A.key)||m[A.key]!==A.value)&&(A.status="active",Rl(s.peerDependenciesMeta,A.selector,()=>({}))[A.key]=A.value)}break;default:z5(A)}}}let n=l=>l.scope?`${l.scope}__${l.name}`:`${l.name}`;for(let l of s.peerDependenciesMeta.keys()){let f=nc(l);s.peerDependencies.has(f.identHash)||s.peerDependencies.set(f.identHash,oi(f,"*"))}for(let l of s.peerDependencies.values()){if(l.scope==="types")continue;let f=n(l),h=ic("types",f),A=Qn(h);s.peerDependencies.has(h.identHash)||s.peerDependenciesMeta.has(A)||s.dependencies.has(h.identHash)||(s.peerDependencies.set(h.identHash,oi(h,"*")),s.peerDependenciesMeta.set(A,{optional:!0}))}return s.dependencies=new Map(go(s.dependencies,([,l])=>Gc(l))),s.peerDependencies=new Map(go(s.peerDependencies,([,l])=>Gc(l))),s}getLimit(e){return Rl(this.limits,e,()=>(0,LEe.default)(this.get(e)))}async triggerHook(e,...r){for(let s of this.plugins.values()){let a=s.hooks;if(!a)continue;let n=e(a);n&&await n(...r)}}async triggerMultipleHooks(e,r){for(let s of r)await this.triggerHook(e,...s)}async reduceHook(e,r,...s){let a=r;for(let n of this.plugins.values()){let l=n.hooks;if(!l)continue;let f=e(l);f&&(a=await f(a,...s))}return a}async firstHook(e,...r){for(let s of this.plugins.values()){let a=s.hooks;if(!a)continue;let n=e(a);if(!n)continue;let l=await n(...r);if(typeof l<"u")return l}return null}}});var un={};lr(un,{EndStrategy:()=>Tq,ExecError:()=>DN,PipeError:()=>Bb,execvp:()=>wq,pipevp:()=>Tf});function Ry(t){return t!==null&&typeof t.fd=="number"}function xq(){}function kq(){for(let t of Ty)t.kill()}async function Tf(t,e,{cwd:r,env:s=process.env,strict:a=!1,stdin:n=null,stdout:l,stderr:f,end:h=2}){let A=["pipe","pipe","pipe"];n===null?A[0]="ignore":Ry(n)&&(A[0]=n),Ry(l)&&(A[1]=l),Ry(f)&&(A[2]=f);let m=(0,Rq.default)(t,e,{cwd:me.fromPortablePath(r),env:{...s,PWD:me.fromPortablePath(r)},stdio:A});Ty.add(m),Ty.size===1&&(process.on("SIGINT",xq),process.on("SIGTERM",kq)),!Ry(n)&&n!==null&&n.pipe(m.stdin),Ry(l)||m.stdout.pipe(l,{end:!1}),Ry(f)||m.stderr.pipe(f,{end:!1});let w=()=>{for(let v of new Set([l,f]))Ry(v)||v.end()};return new Promise((v,D)=>{m.on("error",I=>{Ty.delete(m),Ty.size===0&&(process.off("SIGINT",xq),pro Line truncated
This command will run a command using Yarn's portable shell.
Make sure to escape glob patterns, redirections, and other features that might be expanded by your own shell.
Note: To escape something from Yarn's shell, you might have to escape it twice, the first time from your own shell.
Note: Don't use this command in Yarn scripts, as Yarn's shell is automatically used.
For a list of features, visit: https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-shell/README.md.
`,examples:[["Run a simple command","$0 echo Hello"],["Run a command with a glob pattern","$0 echo '*.js'"],["Run a command with a redirection","$0 echo Hello World '>' hello.txt"],["Run a command with an escaped glob pattern (The double escape is needed in Unix shells)",`$0 echo '"*.js"'`],["Run a command with a variable (Double quotes are needed in Unix shells, to prevent them from expanding the variable)",'$0 "GREETING=Hello echo $GREETING World"']]}}async execute(){let r=this.args.length>0?`${this.commandName} ${this.args.join(" ")}`:this.commandName;return await pC(r,[],{cwd:me.toPortablePath(this.cwd),stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})}}});var Tl,tIe=tt(()=>{Tl=class extends Error{constructor(e){super(e),this.name="ShellError"}}});var FN={};lr(FN,{fastGlobOptions:()=>iIe,isBraceExpansion:()=>Wq,isGlobPattern:()=>HAt,match:()=>jAt,micromatchOptions:()=>QN});function HAt(t){if(!TN.default.scan(t,QN).isGlob)return!1;try{TN.default.parse(t,QN)}catch{return!1}return!0}function jAt(t,{cwd:e,baseFs:r}){return(0,rIe.default)(t,{...iIe,cwd:me.fromPortablePath(e),fs:vT(nIe.default,new B0(r))})}function Wq(t){return TN.default.scan(t,QN).isBrace}var rIe,nIe,TN,QN,iIe,sIe=tt(()=>{Mt();rIe=st(xF()),nIe=st(Ae("fs")),TN=st(ma()),QN={strictBrackets:!0},iIe={onlyDirectories:!1,onlyFiles:!1}});function Yq(){}function Kq(){for(let t of Fy)t.kill()}function lIe(t,e,r,s){return a=>{let n=a[0]instanceof zh.Transform?"pipe":a[0],l=a[1]instanceof zh.Transform?"pipe":a[1],f=a[2]instanceof zh.Transform?"pipe":a[2],h=(0,aIe.default)(t,e,{...s,stdio:[n,l,f]});return Fy.add(h),Fy.size===1&&(process.on("SIGINT",Yq),process.on("SIGTERM",Kq)),a[0]instanceof zh.Transform&&a[0].pipe(h.stdin),a[1]instanceof zh.Transform&&h.stdout.pipe(a[1],{end:!1}),a[2]instanceof zh.Transform&&h.stderr.pipe(a[2],{end:!1}),{stdin:h.stdin,promise:new Promise(A=>{h.on("error",m=>{switch(Fy.delete(h),Fy.size===0&&(process.off("SIGINT",Yq),process.off("SIGTERM",Kq)),m.code){case"ENOENT":a[2].write(`command not found: ${t}
`),A(127);break;case"EACCES":a[2].write(`permission denied: ${t}
`),A(128);break;default:a[2].write(`uncaught error: ${m.message}
`),A(1);break}}),h.on("close",m=>{Fy.delete(h),Fy.size===0&&(process.off("SIGINT",Yq),process.off("SIGTERM",Kq)),A(m!==null?m:129)})})}}}function uIe(t){return e=>{let r=e[0]==="pipe"?new zh.PassThrough:e[0];return{stdin:r,promise:Promise.resolve().then(()=>t({stdin:r,stdout:e[1],stderr:e[2]}))}}}function NN(t,e){return Jq.start(t,e)}function oIe(t,e=null){let r=new zh.PassThrough,s=new cIe.StringDecoder,a="";return r.on("data",n=>{let l=s.write(n),f;do if(f=l.indexOf(`
`),f!==-1){let h=a+l.substring(0,f);l=l.substring(f+1),a="",t(e!==null?`${e} ${h}`:h)}while(f!==-1);a+=l}),r.on("end",()=>{let n=s.end();n!==""&&t(e!==null?`${e} ${n}`:n)}),r}function fIe(t,{prefix:e}){return{stdout:oIe(r=>t.stdout.write(`${r}
`),t.stdout.isTTY?e:null),stderr:oIe(r=>t.stderr.write(`${r}
`),t.stderr.isTTY?e:null)}}var aIe,zh,cIe,Fy,wu,zq,Jq,Zq=tt(()=>{aIe=st(O6()),zh=Ae("stream"),cIe=Ae("string_decoder"),Fy=new Set;wu=class{constructor(e){this.stream=e}close(){}get(){return this.stream}},zq=class{constructor(){this.stream=null}close(){if(this.stream===null)throw new Error("Assertion failed: No stream attached");this.stream.end()}attach(e){this.stream=e}get(){if(this.stream===null)throw new Error("Assertion failed: No stream attached");return this.stream}},Jq=class t{constructor(e,r){this.stdin=null;this.stdout=null;this.stderr=null;this.pipe=null;this.ancestor=e,this.implementation=r}static start(e,{stdin:r,stdout:s,stderr:a}){let n=new t(null,e);return n.stdin=r,n.stdout=s,n.stderr=a,n}pipeTo(e,r=1){let s=new t(this,e),a=new zq;return s.pipe=a,s.stdout=this.stdout,s.stderr=this.stderr,(r&1)===1?this.stdout=a:this.ancestor!==null&&(this.stderr=this.ancestor.stdout),(r&2)===2?this.stderr=a:this.ancestor!==null&&(this.stderr=this.ancestor.stderr),s}async exec(){let e=["ignore","ignore","ignore"];if(this.pipe)e[0]="pipe";else{if(this.stdin===null)throw new Error("Assertion failed: No input stream registered");e[0]=this.stdin.get()}let r;if(this.stdout===null)throw new Error("Assertion failed: No output stream registered");r=this.stdout,e[1]=r.get();let s;if(this.stderr===null)throw new Error("Assertion failed: No error stream registered");s=this.stderr,e[2]=s.get();let a=this.implementation(e);return this.pipe&&this.pipe.attach(a.stdin),await a.promise.then(n=>(r.close(),s.close(),n))}async run(){let e=[];for(let s=this;s;s=s.ancestor)e.push(s.exec());return(await Promise.all(e))[0]}}});var Tb={};lr(Tb,{EntryCommand:()=>Db,ShellError:()=>Tl,execute:()=>pC,globUtils:()=>FN});function hIe(t,e,r){let s=new Ql.PassThrough({autoDestroy:!0});switch(t){case 0:(e&1)===1&&r.stdin.pipe(s,{end:!1}),(e&2)===2&&r.stdin instanceof Ql.Writable&&s.pipe(r.stdin,{end:!1});break;case 1:(e&1)===1&&r.stdout.pipe(s,{end:!1}),(e&2)===2&&s.pipe(r.stdout,{end:!1});break;case 2:(e&1)===1&&r.stderr.pipe(s,{end:!1}),(e&2)===2&&s.pipe(r.stderr,{end:!1});break;default:throw new Tl(`Bad file descriptor: "${t}"`)}return s}function LN(t,e={}){let r={...t,...e};return r.environment={...t.environment,...e.environment},r.variables={...t.variables,...e.variables},r}async function qAt(t,e,r){let s=[],a=new Ql.PassThrough;return a.on("data",n=>s.push(n)),await _N(t,e,LN(r,{stdout:a})),Buffer.concat(s).toString().replace(/[\r\n]+$/,"")}async function AIe(t,e,r){let s=t.map(async n=>{let l=await Ny(n.args,e,r);return{name:n.name,value:l.join(" ")}});return(await Promise.all(s)).reduce((n,l)=>(n[l.name]=l.value,n),{})}function ON(t){return t.match(/[^ \r\n\t]+/g)||[]}async function EIe(t,e,r,s,a=s){switch(t.name){case"$":s(String(process.pid));break;case"#":s(String(e.args.length));break;case"@":if(t.quoted)for(let n of e.args)a(n);else for(let n of e.args){let l=ON(n);for(let f=0;f<l.length-1;++f)a(l[f]);s(l[l.length-1])}break;case"*":{let n=e.args.join(" ");if(t.quoted)s(n);else for(let l of ON(n))a(l)}break;case"PPID":s(String(process.ppid));break;case"RANDOM":s(String(Math.floor(Math.random()*32768)));break;default:{let n=parseInt(t.name,10),l,f=Number.isFinite(n);if(f?n>=0&&n<e.args.length&&(l=e.args[n]):Object.hasOwn(r.variables,t.name)?l=r.variables[t.name]:Object.hasOwn(r.environment,t.name)&&(l=r.environment[t.name]),typeof l<"u"&&t.alternativeValue?l=(await Ny(t.alternativeValue,e,r)).join(" "):typeof l>"u"&&(t.defaultValue?l=(await Ny(t.defaultValue,e,r)).join(" "):t.alternativeValue&&(l="")),typeof l>"u")throw f?new Tl(`Unbound argument #${n}`):new Tl(`Unbound variable "${t.name}"`);if(t.quoted)s(l);else{let h=ON(l);for(let m=0;m<h.length-1;++m)a(h[m]);let A=h[h.length-1];typeof A<"u"&&s(A)}}break}}async function xb(t,e,r){if(t.type==="number"){if(Number.isInteger(t.value))return t.value;throw new Error(`Invalid number: "${t.value}", only integers are allowed`)}else if(t.type==="variable"){let s=[];await EIe({...t,quoted:!0},e,r,n=>s.push(n));let a=Number(s.join(" "));return Number.isNaN(a)?xb({type:"variable",name:s.join(" ")},e,r):xb({type:"number",value:a},e,r)}else return VAt[t.type](await xb(t.left,e,r),await xb(t.right,e,r))}async function Ny(t,e,r){let s=new Map,a=[],n=[],l=m=>{n.push(m)},f=()=>{n.length>0&&a.push(n.join("")),n=[]},h=m=>{l(m),f()},A=(m,w,v)=>{let D=JSON.stringify({type:m,fd:w}),I=s.get(D);typeof I>"u"&&s.set(D,I=[]),I.push(v)};for(let m of t){let w=!1;switch(m.type){case"redirection":{let v=await Ny(m.args,e,r);for(let D of v)A(m.subtype,m.fd,D)}break;case"argument":for(let v of m.segments)switch(v.type){case"text":l(v.text);break;case"glob":l(v.pattern),w=!0;break;case"shell":{let D=await qAt(v.shell,e,r);if(v.quoted)l(D);else{let I=ON(D);for(let R=0;R<I.length-1;++R)h(I[R]);l(I[I.length-1])}}break;case"variable":await EIe(v,e,r,l,h);break;case"arithmetic":l(String(await xb(v.arithmetic,e,r)));break}break}if(f(),w){let v=a.pop();if(typeof v>"u")throw new Error("Assertion failed: Expected a glob pa Line truncated
`)).finally(()=>{r.stdout.isTTY&&r.stdout.write(`Job ${h}, '${l(hw(t))}' has ended
`)})),0}return await dIe(t,e,r)}async function zAt(t,e,r,{background:s=!1}={}){let a,n=f=>{a=f,r.variables["?"]=String(f)},l=async f=>{try{return await KAt(f.chain,e,r,{background:s&&typeof f.then>"u"})}catch(h){if(!(h instanceof Tl))throw h;return r.stderr.write(`${h.message}
`),1}};for(n(await l(t));t.then;){if(r.exitCode!==null)return r.exitCode;switch(t.then.type){case"&&":a===0&&n(await l(t.then.line));break;case"||":a!==0&&n(await l(t.then.line));break;default:throw new Error(`Assertion failed: Unsupported command type: "${t.then.type}"`)}t=t.then.line}return a}async function _N(t,e,r){let s=r.backgroundJobs;r.backgroundJobs=[];let a=0;for(let{command:n,type:l}of t){if(a=await zAt(n,e,r,{background:l==="&"}),r.exitCode!==null)return r.exitCode;r.variables["?"]=String(a)}return await Promise.all(r.backgroundJobs),r.backgroundJobs=s,a}function IIe(t){switch(t.type){case"variable":return t.name==="@"||t.name==="#"||t.name==="*"||Number.isFinite(parseInt(t.name,10))||"defaultValue"in t&&!!t.defaultValue&&t.defaultValue.some(e=>Rb(e))||"alternativeValue"in t&&!!t.alternativeValue&&t.alternativeValue.some(e=>Rb(e));case"arithmetic":return Xq(t.arithmetic);case"shell":return $q(t.shell);default:return!1}}function Rb(t){switch(t.type){case"redirection":return t.args.some(e=>Rb(e));case"argument":return t.segments.some(e=>IIe(e));default:throw new Error(`Assertion failed: Unsupported argument type: "${t.type}"`)}}function Xq(t){switch(t.type){case"variable":return IIe(t);case"number":return!1;default:return Xq(t.left)||Xq(t.right)}}function $q(t){return t.some(({command:e})=>{for(;e;){let r=e.chain;for(;r;){let s;switch(r.type){case"subshell":s=$q(r.subshell);break;case"command":s=r.envs.some(a=>a.args.some(n=>Rb(n)))||r.args.some(a=>Rb(a));break}if(s)return!0;if(!r.then)break;r=r.then.chain}if(!e.then)break;e=e.then.line}return!1})}async function pC(t,e=[],{baseFs:r=new pi,builtins:s={},cwd:a=me.toPortablePath(process.cwd()),env:n=process.env,stdin:l=process.stdin,stdout:f=process.stdout,stderr:h=process.stderr,variables:A={},glob:m=FN}={}){let w={};for(let[I,R]of Object.entries(n))typeof R<"u"&&(w[I]=R);let v=new Map(GAt);for(let[I,R]of Object.entries(s))v.set(I,R);l===null&&(l=new Ql.PassThrough,l.end());let D=DT(t,m);if(!$q(D)&&D.length>0&&e.length>0){let{command:I}=D[D.length-1];for(;I.then;)I=I.then.line;let R=I.chain;for(;R.then;)R=R.then.chain;R.type==="command"&&(R.args=R.args.concat(e.map(N=>({type:"argument",segments:[{type:"text",text:N}]}))))}return await _N(D,{args:e,baseFs:r,builtins:v,initialStdin:l,initialStdout:f,initialStderr:h,glob:m},{cwd:a,environment:w,exitCode:null,procedures:{},stdin:l,stdout:f,stderr:h,variables:Object.assign({},A,{"?":0}),nextBackgroundJobIndex:1,backgroundJobs:[]})}var gIe,mIe,Ql,yIe,GAt,VAt,Pb=tt(()=>{Mt();au();gIe=st(Cw()),mIe=Ae("os"),Ql=Ae("stream"),yIe=Ae("timers/promises");eIe();tIe();sIe();Zq();Zq();GAt=new Map([["cd",async([t=(0,mIe.homedir)(),...e],r,s)=>{let a=Y.resolve(s.cwd,me.toPortablePath(t));if(!(await r.baseFs.statPromise(a).catch(l=>{throw l.code==="ENOENT"?new Tl(`cd: no such file or directory: ${t}`):l})).isDirectory())throw new Tl(`cd: not a directory: ${t}`);return s.cwd=a,0}],["pwd",async(t,e,r)=>(r.stdout.write(`${me.fromPortablePath(r.cwd)}
`),0)],[":",async(t,e,r)=>0],["true",async(t,e,r)=>0],["false",async(t,e,r)=>1],["exit",async([t,...e],r,s)=>s.exitCode=parseInt(t??s.variables["?"],10)],["echo",async(t,e,r)=>(r.stdout.write(`${t.join(" ")}
`),0)],["sleep",async([t],e,r)=>{if(typeof t>"u")throw new Tl("sleep: missing operand");let s=Number(t);if(Number.isNaN(s))throw new Tl(`sleep: invalid time interval '${t}'`);return await(0,yIe.setTimeout)(1e3*s,0)}],["unset",async(t,e,r)=>{for(let s of t)delete r.environment[s],delete r.variables[s];return 0}],["__ysh_run_procedure",async(t,e,r)=>{let s=r.procedures[t[0]];return await NN(s,{stdin:new wu(r.stdin),stdout:new wu(r.stdout),stderr:new wu(r.stderr)}).run()}],["__ysh_set_redirects",async(t,e,r)=>{let s=r.stdin,a=r.stdout,n=r.stderr,l=[],f=[],h=[],A=0;for(;t[A]!=="--";){let w=t[A++],{type:v,fd:D}=JSON.parse(w),I=V=>{switch(D){case null:case 0:l.push(V);break;default:throw new Error(`Unsupported file descriptor: "${D}"`)}},R=V=>{switch(D){case null:case 1:f.push(V);break;case 2:h.push(V);break;default:throw new Error(`Unsupported file descriptor: "${D}"`)}},N=Number(t[A++]),U=A+N;for(let V=A;V<U;++A,++V)switch(v){case"<":I(()=>e.baseFs.createReadStream(Y.resolve(r.cwd,me.toPortablePath(t[V]))));break;case"<<<":I(()=>{let ee=new Ql.PassThrough;return process.nextTick(()=>{ee.write(`${t[V]}
`),ee.end()}),ee});break;case"<&":I(()=>hIe(Number(t[V]),1,r));break;case">":case">>":{let ee=Y.resolve(r.cwd,me.toPortablePath(t[V]));R(ee==="/dev/null"?new Ql.Writable({autoDestroy:!0,emitClose:!0,write(te,ie,ae){setImmediate(ae)}}):e.baseFs.createWriteStream(ee,v===">>"?{flags:"a"}:void 0))}break;case">&":R(hIe(Number(t[V]),2,r));break;default:throw new Error(`Assertion failed: Unsupported redirection type: "${v}"`)}}if(l.length>0){let w=new Ql.PassThrough;s=w;let v=D=>{if(D===l.length)w.end();else{let I=l[D]();I.pipe(w,{end:!1}),I.on("end",()=>{v(D+1)})}};v(0)}if(f.length>0){let w=new Ql.PassThrough;a=w;for(let v of f)w.pipe(v)}if(h.length>0){let w=new Ql.PassThrough;n=w;for(let v of h)w.pipe(v)}let m=await NN(kb(t.slice(A+1),e,r),{stdin:new wu(s),stdout:new wu(a),stderr:new wu(n)}).run();return await Promise.all(f.map(w=>new Promise((v,D)=>{w.on("error",I=>{D(I)}),w.on("close",()=>{v()}),w.end()}))),await Promise.all(h.map(w=>new Promise((v,D)=>{w.on("error",I=>{D(I)}),w.on("close",()=>{v()}),w.end()}))),m}]]);VAt={addition:(t,e)=>t+e,subtraction:(t,e)=>t-e,multiplication:(t,e)=>t*e,division:(t,e)=>Math.trunc(t/e)}});var wIe=H((g$t,MN)=>{function JAt(){var t=0,e=1,r=2,s=3,a=4,n=5,l=6,f=7,h=8,A=9,m=10,w=11,v=12,D=13,I=14,R=15,N=16,U=17,V=0,ee=1,te=2,ie=3,ae=4;function ge(d,be){return 55296<=d.charCodeAt(be)&&d.charCodeAt(be)<=56319&&56320<=d.charCodeAt(be+1)&&d.charCodeAt(be+1)<=57343}function de(d,be){be===void 0&&(be=0);var Ce=d.charCodeAt(be);if(55296<=Ce&&Ce<=56319&&be<d.length-1){var Ee=Ce,he=d.charCodeAt(be+1);return 56320<=he&&he<=57343?(Ee-55296)*1024+(he-56320)+65536:Ee}if(56320<=Ce&&Ce<=57343&&be>=1){var Ee=d.charCodeAt(be-1),he=Ce;return 55296<=Ee&&Ee<=56319?(Ee-55296)*1024+(he-56320)+65536:he}return Ce}function xe(d,be,Ce){var Ee=[d].concat(be).concat([Ce]),he=Ee[Ee.length-2],$=Ce,De=Ee.lastIndexOf(I);if(De>1&&Ee.slice(1,De).every(function(j){return j==s})&&[s,D,U].indexOf(d)==-1)return te;var Te=Ee.lastIndexOf(a);if(Te>0&&Ee.slice(1,Te).every(function(j){return j==a})&&[v,a].indexOf(he)==-1)return Ee.filter(function(j){return j==a}).length%2==1?ie:ae;if(he==t&&$==e)return V;if(he==r||he==t||he==e)return $==I&&be.every(function(j){return j==s})?te:ee;if($==r||$==t||$==e)return ee;if(he==l&&($==l||$==f||$==A||$==m))return V;if((he==A||he==f)&&($==f||$==h))return V;if((he==m||he==h)&&$==h)return V;if($==s||$==R)return V;if($==n)return V;if(he==v)return V;var ot=Ee.indexOf(s)!=-1?Ee.lastIndexOf(s)-1:Ee.length-2;return[D,U].indexOf(Ee[ot])!=-1&&Ee.slice(ot+1,-1).every(function(j){return j==s})&&$==I||he==R&&[N,U].indexOf($)!=-1?V:be.indexOf(a)!=-1?te:he==a&&$==a?V:ee}this.nextBreak=function(d,be){if(be===void 0&&(be=0),be<0)return 0;if(be>=d.length-1)return d.length;for(var Ce=we(de(d,be)),Ee=[],he=be+1;he<d.length;he++)if(!ge(d,he-1)){var $=we(de(d,he));if(xe(Ce,Ee,$))return he;Ee.push($)}return d.length},this.splitGraphemes=function(d){for(var be=[],Ce=0,Ee;(Ee=this.nextBreak(d,Ce))<d.length;)be.push(d.slice(Ce,Ee)),Ce=Ee;return Ce<d.length&&be.push(d.slice(Ce)),be},this.iterateGraphemes=function(d){var be=0,Ce={next:function(){var Ee,he;return(he=this.nextBreak(d,be))<d.length?(Ee=d.slice(be,he),be=he,{value:Ee,done:!1}):be<d.length?(Ee=d.slice(be),be=d.length,{value:Ee,done:!1}):{value:void 0,done:!0}}.bind(this)};return typeof Symbol<"u"&&Symbol.iterator&&(Ce[Symbol.iterator]=function(){return Ce}),Ce},this.countGraphemes=function(d){for(var be=0,Ce=0,Ee;(Ee=this.nextBreak(d,Ce))<d.length;)Ce=Ee,be++;return Ce<d.length&&be++,be};function we(d){return 1536<=d&&d<=1541||d==1757||d==1807||d==2274||d==3406||d==69821||70082<=d&&d<=70083||d==72250||72326<=d&&d<=72329||d==73030?v:d==13?t:d==10?e:0<=d&&d<=9||11<=d&&d<=12||14<=d&&d<=31||127<=d&&d<=159||d==173||d==1564||d==6158||d==8203||8206<=d&&d<=8207||d==8232||d==8233||8234<=d&&d<=8238||8288<=d&&d<=8292||d==8293||8294<=d&&d<=8303||55296<=d&&d<=57343||d==65279||65520<=d&&d<=65528||65529<=d&&d<=65531||113824<=d&&d<=113827||119155<=d&&d<=119162||d==917504||d==917505||917506<=d&&d<=917535||917632<=d&&d<=917759||918e3<=d&&d<=921599?r:768<=d&&d<=879||1155<=d&&d<=1159||1160<=d&&d<=1161||1425<=d&&d<=1469||d==1471||1473<=d&&d<=1474||1476<=d&&d<=1477||d==1479||1552<=d&&d<=1562||1611<=d&&d<=1631||d==1648||1750<=d&&d<=1756||1759<=d&&d<=1764||1767<=d&&d<=1768||1770<=d&&d<=1773||d==1809||1840<=d&&d<=1866||1958<=d&&d<=1968||2027<=d&&d<=2035||2070<=d&&d<=2073||2075<=d&&d<=2083||2085<=d&&d<=2087||2089<=d&&d<=2093||2137<=d&&d<=2139||2260<=d&&d<=2273||2275<=d&&d<=2306||d==2362||d==2364||2369<=d&&d<=2376||d==2381||2385<=d&&d<=2391||2402<=d&&d<=2403||d==2433||d==2492||d==2494||2497<=d&&d<=2500||d==2509||d==2519||2530<=d&&d<=2531||2561<=d&&d<=2562||d==2620||2625<=d&&d<=2626||2631<=d&&d<=2632||2635<=d&&d<=2637||d==2641||2672<=d&&d<=2673||d==2677||2689<=d&&d<=2690||d==2748||2753<=d&&d<=2757||2759<=d&&d<=2760||d==2765||2786<=d&&d<=2787||2810<=d&&d<=2815||d==2817||d==2876||d==2878||d==2879||2881<=d&&d<=2884||d==2893||d==2902||d==2903||2914<=d&&d<=2915||d==2946||d==3006|| Line truncated
`,end:t=>`::endgroup::
`}:HN.default.TRAVIS?{start:t=>`travis_fold:start:${t}
`,end:t=>`travis_fold:end:${t}
`}:HN.default.GITLAB?{start:t=>`section_start:${Math.floor(Date.now()/1e3)}:${t.toLowerCase().replace(/\W+/g,"_")}[collapsed=true]\r\x1B[0K${t}
`,end:t=>`section_end:${Math.floor(Date.now()/1e3)}:${t.toLowerCase().replace(/\W+/g,"_")}\r\x1B[0K`}:null,PIe=z0!==null,bIe=new Date,ept=["iTerm.app","Apple_Terminal","WarpTerminal","vscode"].includes(process.env.TERM_PROGRAM)||!!process.env.WT_SESSION,tpt=t=>t,jN=tpt({patrick:{date:[17,3],chars:["\u{1F340}","\u{1F331}"],size:40},simba:{date:[19,7],chars:["\u{1F981}","\u{1F334}"],size:40},jack:{date:[31,10],chars:["\u{1F383}","\u{1F987}"],size:40},hogsfather:{date:[31,12],chars:["\u{1F389}","\u{1F384}"],size:40},default:{chars:["=","-"],size:80}}),rpt=ept&&Object.keys(jN).find(t=>{let e=jN[t];return!(e.date&&(e.date[0]!==bIe.getDate()||e.date[1]!==bIe.getMonth()+1))})||"default";Wt=class extends jo{constructor({configuration:r,stdout:s,json:a=!1,forceSectionAlignment:n=!1,includeNames:l=!0,includePrefix:f=!0,includeFooter:h=!0,includeLogs:A=!a,includeInfos:m=A,includeWarnings:w=A}){super();this.uncommitted=new Set;this.warningCount=0;this.errorCount=0;this.timerFooter=[];this.startTime=Date.now();this.indent=0;this.level=0;this.progress=new Map;this.progressTime=0;this.progressFrame=0;this.progressTimeout=null;this.progressStyle=null;this.progressMaxScaledSize=null;if(YS(this,{configuration:r}),this.configuration=r,this.forceSectionAlignment=n,this.includeNames=l,this.includePrefix=f,this.includeFooter=h,this.includeInfos=m,this.includeWarnings=w,this.json=a,this.stdout=s,r.get("enableProgressBars")&&!a&&s.isTTY&&s.columns>22){let v=r.get("progressBarStyle")||rpt;if(!Object.hasOwn(jN,v))throw new Error("Assertion failed: Invalid progress bar style");this.progressStyle=jN[v];let D=Math.min(this.getRecommendedLength(),80);this.progressMaxScaledSize=Math.floor(this.progressStyle.size*D/80)}}static async start(r,s){let a=new this(r),n=process.emitWarning;process.emitWarning=(l,f)=>{if(typeof l!="string"){let A=l;l=A.message,f=f??A.name}let h=typeof f<"u"?`${f}: ${l}`:l;a.reportWarning(0,h)},r.includeVersion&&a.reportInfo(0,wy(r.configuration,`Yarn ${Fn}`,2));try{await s(a)}catch(l){a.reportExceptionOnce(l)}finally{await a.finalize(),process.emitWarning=n}return a}hasErrors(){return this.errorCount>0}exitCode(){return this.hasErrors()?1:0}getRecommendedLength(){let s=this.progressStyle!==null?this.stdout.columns-1:super.getRecommendedLength();return Math.max(40,s-12-this.indent*2)}startSectionSync({reportHeader:r,reportFooter:s,skipIfEmpty:a},n){let l={committed:!1,action:()=>{r?.()}};a?this.uncommitted.add(l):(l.action(),l.committed=!0);let f=Date.now();try{return n()}catch(h){throw this.reportExceptionOnce(h),h}finally{let h=Date.now();this.uncommitted.delete(l),l.committed&&s?.(h-f)}}async startSectionPromise({reportHeader:r,reportFooter:s,skipIfEmpty:a},n){let l={committed:!1,action:()=>{r?.()}};a?this.uncommitted.add(l):(l.action(),l.committed=!0);let f=Date.now();try{return await n()}catch(h){throw this.reportExceptionOnce(h),h}finally{let h=Date.now();this.uncommitted.delete(l),l.committed&&s?.(h-f)}}startTimerImpl(r,s,a){return{cb:typeof s=="function"?s:a,reportHeader:()=>{this.level+=1,this.reportInfo(null,`\u250C ${r}`),this.indent+=1,z0!==null&&!this.json&&this.includeInfos&&this.stdout.write(z0.start(r))},reportFooter:f=>{if(this.indent-=1,z0!==null&&!this.json&&this.includeInfos){this.stdout.write(z0.end(r));for(let h of this.timerFooter)h()}this.configuration.get("enableTimers")&&f>200?this.reportInfo(null,`\u2514 Completed in ${or(this.configuration,f,Ct.DURATION)}`):this.reportInfo(null,"\u2514 Completed"),this.level-=1},skipIfEmpty:(typeof s=="function"?{}:s).skipIfEmpty}}startTimerSync(r,s,a){let{cb:n,...l}=this.startTimerImpl(r,s,a);return this.startSectionSync(l,n)}async startTimerPromise(r,s,a){let{cb:n,...l}=this.startTimerImpl(r,s,a);return this.startSectionPromise(l,n)}reportSeparator(){this.indent===0?this.writeLine(""):this.reportInfo(null,"")}reportInfo(r,s){if(!this.includeInfos)return;this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"",l=`${this.formatPrefix(n,"blueBright")}${s}`;this.json?this.reportJson({type:"info",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:s}):this.writeLine(l)}reportWarning(r,s){if(this.warningCount+=1,!this.includeWarnings)return;this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"";this.json?this.reportJson({type:"warning",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:s}):this.writeLine(`${this.formatPrefix(n,"yellowBright")}${s}`)}reportError(r,s){this.errorCount+=1,this.timerFooter.push(()=>this.reportErrorImpl(r,s)),this.reportErrorImpl(r,s)}reportErrorImpl(r,s){this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"";this.json?this.reportJson({type:"error",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:s}):this.writeLine(`${this.formatPrefix(n,"redBright")}${s}`,{truncate:!1})}reportFold(r,s){if(!z0)return;let a=`${z0.start(r)}${s}${z0.end(r)}`;this.timerFooter.push(()=>this.stdout.write(a))}reportProgress(r){if(this.progressStyle===null)ret Line truncated
`),this.writeProgress()}writeLines(r,{truncate:s}={}){this.clearProgress({delta:r.length});for(let a of r)this.stdout.write(`${this.truncate(a,{truncate:s})}
`);this.writeProgress()}commit(){let r=this.uncommitted;this.uncommitted=new Set;for(let s of r)s.committed=!0,s.action()}clearProgress({delta:r=0,clear:s=!1}){this.progressStyle!==null&&this.progress.size+r>0&&(this.stdout.write(`\x1B[${this.progress.size+r}A`),(r>0||s)&&this.stdout.write("\x1B[0J"))}writeProgress(){if(this.progressStyle===null||(this.progressTimeout!==null&&clearTimeout(this.progressTimeout),this.progressTimeout=null,this.progress.size===0))return;let r=Date.now();r-this.progressTime>SIe&&(this.progressFrame=(this.progressFrame+1)%vIe.length,this.progressTime=r);let s=vIe[this.progressFrame];for(let a of this.progress.values()){let n="";if(typeof a.lastScaledSize<"u"){let A=this.progressStyle.chars[0].repeat(a.lastScaledSize),m=this.progressStyle.chars[1].repeat(this.progressMaxScaledSize-a.lastScaledSize);n=` ${A}${m}`}let l=this.formatName(null),f=l?`${l}: `:"",h=a.definition.title?` ${a.definition.title}`:"";this.stdout.write(`${or(this.configuration,"\u27A4","blueBright")} ${f}${s}${n}${h}
`)}this.progressTimeout=setTimeout(()=>{this.refreshProgress({force:!0})},SIe)}refreshProgress({delta:r=0,force:s=!1}={}){let a=!1,n=!1;if(s||this.progress.size===0)a=!0;else for(let l of this.progress.values()){let f=typeof l.definition.progress<"u"?Math.trunc(this.progressMaxScaledSize*l.definition.progress):void 0,h=l.lastScaledSize;l.lastScaledSize=f;let A=l.lastTitle;if(l.lastTitle=l.definition.title,f!==h||(n=A!==l.definition.title)){a=!0;break}}a&&(this.clearProgress({delta:r,clear:n}),this.writeProgress())}truncate(r,{truncate:s}={}){return this.progressStyle===null&&(s=!1),typeof s>"u"&&(s=this.configuration.get("preferTruncatedLines")),s&&(r=(0,DIe.default)(r,0,this.stdout.columns-1)),r}formatName(r){return this.includeNames?xIe(r,{configuration:this.configuration,json:this.json}):""}formatPrefix(r,s){return this.includePrefix?`${or(this.configuration,"\u27A4",s)} ${r}${this.formatIndent()}`:""}formatNameWithHyperlink(r){return this.includeNames?e7(r,{configuration:this.configuration,json:this.json}):""}formatIndent(){return this.level>0||!this.forceSectionAlignment?"\u2502 ".repeat(this.indent):`${$At} `}}});var qn={};lr(qn,{PackageManager:()=>RIe,detectPackageManager:()=>TIe,executePackageAccessibleBinary:()=>LIe,executePackageScript:()=>GN,executePackageShellcode:()=>t7,executeWorkspaceAccessibleBinary:()=>lpt,executeWorkspaceLifecycleScript:()=>NIe,executeWorkspaceScript:()=>FIe,getPackageAccessibleBinaries:()=>qN,getWorkspaceAccessibleBinaries:()=>OIe,hasPackageScript:()=>opt,hasWorkspaceScript:()=>r7,isNodeScript:()=>n7,makeScriptEnv:()=>Nb,maybeExecuteWorkspaceLifecycleScript:()=>cpt,prepareExternalProject:()=>spt});async function J0(t,e,r,s=[]){if(process.platform==="win32"){let a=`@goto #_undefined_# 2>NUL || @title %COMSPEC% & @setlocal & @"${r}" ${s.map(n=>`"${n.replace('"','""')}"`).join(" ")} %*`;await fe.writeFilePromise(Y.format({dir:t,name:e,ext:".cmd"}),a)}await fe.writeFilePromise(Y.join(t,e),`#!/bin/sh
exec "${r}" ${s.map(a=>`'${a.replace(/'/g,`'"'"'`)}'`).join(" ")} "$@"
`,{mode:493})}async function TIe(t){let e=await nr.tryFind(t);if(e?.packageManager){let s=NF(e.packageManager);if(s?.name){let a=`found ${JSON.stringify({packageManager:e.packageManager})} in manifest`,[n]=s.reference.split(".");switch(s.name){case"yarn":return{packageManagerField:!0,packageManager:Number(n)===1?"Yarn Classic":"Yarn",reason:a};case"npm":return{packageManagerField:!0,packageManager:"npm",reason:a};case"pnpm":return{packageManagerField:!0,packageManager:"pnpm",reason:a}}}}let r;try{r=await fe.readFilePromise(Y.join(t,Or.lockfile),"utf8")}catch{}return r!==void 0?r.match(/^__metadata:$/m)?{packageManager:"Yarn",reason:'"__metadata" key found in yarn.lock'}:{packageManager:"Yarn Classic",reason:'"__metadata" key not found in yarn.lock, must be a Yarn classic lockfile'}:fe.existsSync(Y.join(t,"package-lock.json"))?{packageManager:"npm",reason:`found npm's "package-lock.json" lockfile`}:fe.existsSync(Y.join(t,"pnpm-lock.yaml"))?{packageManager:"pnpm",reason:`found pnpm's "pnpm-lock.yaml" lockfile`}:null}async function Nb({project:t,locator:e,binFolder:r,ignoreCorepack:s,lifecycleScript:a,baseEnv:n=t?.configuration.env??process.env}){let l={};for(let[m,w]of Object.entries(n))typeof w<"u"&&(l[m.toLowerCase()!=="path"?m:"PATH"]=w);let f=me.fromPortablePath(r);l.BERRY_BIN_FOLDER=me.fromPortablePath(f);let h=process.env.COREPACK_ROOT&&!s?me.join(process.env.COREPACK_ROOT,"dist/yarn.js"):process.argv[1];if(await Promise.all([J0(r,"node",process.execPath),...Fn!==null?[J0(r,"run",process.execPath,[h,"run"]),J0(r,"yarn",process.execPath,[h]),J0(r,"yarnpkg",process.execPath,[h]),J0(r,"node-gyp",process.execPath,[h,"run","--top-level","node-gyp"])]:[]]),t&&(l.INIT_CWD=me.fromPortablePath(t.configuration.startingCwd),l.PROJECT_CWD=me.fromPortablePath(t.cwd)),l.PATH=l.PATH?`${f}${me.delimiter}${l.PATH}`:`${f}`,l.npm_execpath=`${f}${me.sep}yarn`,l.npm_node_execpath=`${f}${me.sep}node`,e){if(!t)throw new Error("Assertion failed: Missing project");let m=t.tryWorkspaceByLocator(e),w=m?m.manifest.version??"":t.storedPackages.get(e.locatorHash).version??"";l.npm_package_name=Qn(e),l.npm_package_version=w;let v;if(m)v=m.cwd;else{let D=t.storedPackages.get(e.locatorHash);if(!D)throw new Error(`Package for ${hn(t.configuration,e)} not found in the project`);let I=t.configuration.getLinkers(),R={project:t,report:new Wt({stdout:new Z0.PassThrough,configuration:t.configuration})},N=I.find(U=>U.supportsPackage(D,R));if(!N)throw new Error(`The package ${hn(t.configuration,D)} isn't supported by any of the available linkers`);v=await N.findPackageLocation(D,R)}l.npm_package_json=me.fromPortablePath(Y.join(v,Or.manifest))}let A=Fn!==null?`yarn/${Fn}`:`yarn/${Qp("@yarnpkg/core").version}-core`;return l.npm_config_user_agent=`${A} npm/? node/${process.version} ${process.platform} ${process.arch}`,a&&(l.npm_lifecycle_event=a),t&&await t.configuration.triggerHook(m=>m.setupScriptEnvironment,t,l,async(m,w,v)=>await J0(r,m,w,v)),l}async function spt(t,e,{configuration:r,report:s,workspace:a=null,locator:n=null}){await ipt(async()=>{await fe.mktempPromise(async l=>{let f=Y.join(l,"pack.log"),h=null,{stdout:A,stderr:m}=r.getSubprocessStreams(f,{prefix:me.fromPortablePath(t),report:s}),w=n&&kf(n)?Ww(n):n,v=w?qc(w):"an external project";A.write(`Packing ${v} from sources
`);let D=await TIe(t),I;D!==null?(A.write(`Using ${D.packageManager} for bootstrap. Reason: ${D.reason}
`),I=D.packageManager):(A.write(`No package manager configuration detected; defaulting to Yarn
`),I="Yarn");let R=I==="Yarn"&&!D?.packageManagerField;await fe.mktempPromise(async N=>{let U=await Nb({binFolder:N,ignoreCorepack:R,baseEnv:{...process.env,COREPACK_ENABLE_AUTO_PIN:"0"}}),ee=new Map([["Yarn Classic",async()=>{let ie=a!==null?["workspace",a]:[],ae=Y.join(t,Or.manifest),ge=await fe.readFilePromise(ae),de=await Tf(process.execPath,[process.argv[1],"set","version","classic","--only-if-needed","--yarn-path"],{cwd:t,env:U,stdin:h,stdout:A,stderr:m,end:1});if(de.code!==0)return de.code;await fe.writeFilePromise(ae,ge),await fe.appendFilePromise(Y.join(t,".npmignore"),`/.yarn
`),A.write(`
`),delete U.NODE_ENV;let xe=await Tf("yarn",["install"],{cwd:t,env:U,stdin:h,stdout:A,stderr:m,end:1});if(xe.code!==0)return xe.code;A.write(`
`);let we=await Tf("yarn",[...ie,"pack","--filename",me.fromPortablePath(e)],{cwd:t,env:U,stdin:h,stdout:A,stderr:m});return we.code!==0?we.code:0}],["Yarn",async()=>{let ie=a!==null?["workspace",a]:[];U.YARN_ENABLE_INLINE_BUILDS="1";let ae=Y.join(t,Or.lockfile);await fe.existsPromise(ae)||await fe.writeFilePromise(ae,"");let ge=await Tf("yarn",[...ie,"pack","--install-if-needed","--filename",me.fromPortablePath(e)],{cwd:t,env:U,stdin:h,stdout:A,stderr:m});return ge.code!==0?ge.code:0}],["npm",async()=>{if(a!==null){let be=new Z0.PassThrough,Ce=Nw(be);be.pipe(A,{end:!1});let Ee=await Tf("npm",["--version"],{cwd:t,env:U,stdin:h,stdout:be,stderr:m,end:0});if(be.end(),Ee.code!==0)return A.end(),m.end(),Ee.code;let he=(await Ce).toString().trim();if(!Wh(he,">=7.x")){let $=ic(null,"npm"),De=oi($,he),Te=oi($,">=7.x");throw new Error(`Workspaces aren't supported by ${xi(r,De)}; please upgrade to ${xi(r,Te)} (npm has been detected as the primary package manager for ${or(r,t,Ct.PATH)})`)}}let ie=a!==null?["--workspace",a]:[];delete U.npm_config_user_agent,delete U.npm_config_production,delete U.NPM_CONFIG_PRODUCTION,delete U.NODE_ENV;let ae=await Tf("npm",["install","--legacy-peer-deps"],{cwd:t,env:U,stdin:h,stdout:A,stderr:m,end:1});if(ae.code!==0)return ae.code;let ge=new Z0.PassThrough,de=Nw(ge);ge.pipe(A);let xe=await Tf("npm",["pack","--silent",...ie],{cwd:t,env:U,stdin:h,stdout:ge,stderr:m});if(xe.code!==0)return xe.code;let we=(await de).toString().trim().replace(/^.*\n/s,""),d=Y.resolve(t,me.toPortablePath(we));return await fe.renamePromise(d,e),0}]]).get(I);if(typeof ee>"u")throw new Error("Assertion failed: Unsupported workflow");let te=await ee();if(!(te===0||typeof te>"u"))throw fe.detachTemp(l),new Zt(58,`Packing the package failed (exit code ${te}, logs can be found here: ${or(r,f,Ct.PATH)})`)})})})}async function opt(t,e,{project:r}){let s=r.tryWorkspaceByLocator(t);if(s!==null)return r7(s,e);let a=r.storedPackages.get(t.locatorHash);if(!a)throw new Error(`Package for ${hn(r.configuration,t)} not found in the project`);return await Yh.openPromise(async n=>{let l=r.configuration,f=r.configuration.getLinkers(),h={project:r,report:new Wt({stdout:new Z0.PassThrough,configuration:l})},A=f.find(D=>D.supportsPackage(a,h));if(!A)throw new Error(`The package ${hn(r.configuration,a)} isn't supported by any of the available linkers`);let m=await A.findPackageLocation(a,h),w=new Jn(m,{baseFs:n});return(await nr.find(Rt.dot,{baseFs:w})).scripts.has(e)})}async function GN(t,e,r,{cwd:s,project:a,stdin:n,stdout:l,stderr:f}){return await fe.mktempPromise(async h=>{let{manifest:A,env:m,cwd:w}=await QIe(t,{project:a,binFolder:h,cwd:s,lifecycleScript:e}),v=A.scripts.get(e);if(typeof v>"u")return 1;let D=async()=>await pC(v,r,{cwd:w,env:m,stdin:n,stdout:l,stderr:f});return await(await a.configuration.reduceHook(R=>R.wrapScriptExecution,D,a,t,e,{script:v,args:r,cwd:w,env:m,stdin:n,stdout:l,stderr:f}))()})}async function t7(t,e,r,{cwd:s,project:a,stdin:n,stdout:l,stderr:f}){return await fe.mktempPromise(async h=>{let{env:A,cwd:m}=await QIe(t,{project:a,binFolder:h,cwd:s});return await pC(e,r,{cwd:m,env:A,stdin:n,stdout:l,stderr:f})})}async function apt(t,{binFolder:e,cwd:r,lifecycleScript:s}){let a=await Nb({project:t.project,locator:t.anchoredLocator,binFolder:e,lifecycleScript:s});return await i7(e,await OIe(t)),typeof r>"u"&&(r=Y.dirname(await fe.realpathPromise(Y.join(t.cwd,"package.json")))),{manifest:t.manifest,binFolder:e,env:a,cwd:r}}async function QIe(t,{project:e,binFolder:r,cwd:s,lifecycleScript:a}){let n=e.tryWorkspaceByLocator(t);if(n!==null)return apt(n,{binFolder:r,cwd:s,lifecycleScript:a});let l=e.storedPackages.get(t.locatorHash);if(!l)throw new Error(`Package for ${hn(e.configuration,t)} not found in the project`);return await Yh.openPromise(async f=>{let h=e.configuration,A=e.configuration.getLinkers(),m={project:e,report:new Wt({stdout:new Z0.PassThrough,configuration:h})},w=A.find(N=>N.supportsPackage(l,m));if(!w)throw new Error(`The package ${hn(e.configuration,l)} isn't supported by any of the available linkers`);let v=await Nb({project:e,locator:t,binFolder:r,lifecycleScript:a});await i7(r,await qN(t,{project:e}));let D=await w.findPackageLocation(l,m),I=new Jn(D,{baseFs:f}),R=await nr.find(Rt.dot,{baseFs:I});return typeof s>"u"&&(s=D),{manifest:R,binFolder:r,env:v,cwd:s}})}async function FIe(t,e,r,{cwd:s,stdin:a,stdout:n,stderr:l}){return await GN(t.anchoredLocator,e,r,{cwd:s,project:t.project,stdin:a,stdout:n,stderr:l})}function r7(t,e){return t.manifest.scripts.has(e)}async function NIe(t,e,{cwd:r,report:s}){let{configuration:a}=t.project,n=null;await fe.mktempPromise(async l=>{let f=Y.join(l,`${e}.log`),h=`# This file contains the result of Yarn calling the "${e}" lifecycle script inside a workspace ("${me.fromPortablePath(t.cwd)}")
`,{stdout:A,stderr:m}=a.getSubprocessStreams(f,{report:s,prefix:hn(a,t.anchoredLocator),header:h});s.reportInfo(36,`Calling the "${e}" lifecycle script`);let w=await FIe(t,e,[],{cwd:r,stdin:n,stdout:A,stderr:m});if(A.end(),m.end(),w!==0)throw fe.detachTemp(l),new Zt(36,`${HS(e)} script failed (exit code ${or(a,w,Ct.NUMBER)}, logs can be found here: ${or(a,f,Ct.PATH)}); run ${or(a,`yarn ${e}`,Ct.CODE)} to investigate`)})}async function cpt(t,e,r){r7(t,e)&&await NIe(t,e,r)}function n7(t){let e=Y.extname(t);if(e.match(/\.[cm]?[jt]sx?$/))return!0;if(e===".exe"||e===".bin")return!1;let r=Buffer.alloc(4),s;try{s=fe.openSync(t,"r")}catch{return!0}try{fe.readSync(s,r,0,r.length,0)}finally{fe.closeSync(s)}let a=r.readUint32BE();return!(a===3405691582||a===3489328638||a===2135247942||(a&4294901760)===1297743872)}async function qN(t,{project:e}){let r=e.configuration,s=new Map,a=e.storedPackages.get(t.locatorHash);if(!a)throw new Error(`Package for ${hn(r,t)} not found in the project`);let n=new Z0.Writable,l=r.getLinkers(),f={project:e,report:new Wt({configuration:r,stdout:n})},h=new Set([t.locatorHash]);for(let m of a.dependencies.values()){let w=e.storedResolutions.get(m.descriptorHash);if(!w)throw new Error(`Assertion failed: The resolution (${xi(r,m)}) should have been registered`);h.add(w)}let A=await Promise.all(Array.from(h,async m=>{let w=e.storedPackages.get(m);if(!w)throw new Error(`Assertion failed: The package (${m}) should have been registered`);if(w.bin.size===0)return kl.skip;let v=l.find(I=>I.supportsPackage(w,f));if(!v)return kl.skip;let D=null;try{D=await v.findPackageLocation(w,f)}catch(I){if(I.code==="LOCATOR_NOT_INSTALLED")return kl.skip;throw I}return{dependency:w,packageLocation:D}}));for(let m of A){if(m===kl.skip)continue;let{dependency:w,packageLocation:v}=m;for(let[D,I]of w.bin){let R=Y.resolve(v,I);s.set(D,[w,me.fromPortablePath(R),n7(R)])}}return s}async function OIe(t){return await qN(t.anchoredLocator,{project:t.project})}async function i7(t,e){await Promise.all(Array.from(e,([r,[,s,a]])=>a?J0(t,r,process.execPath,[s]):J0(t,r,s,[])))}async function LIe(t,e,r,{cwd:s,project:a,stdin:n,stdout:l,stderr:f,nodeArgs:h=[],packageAccessibleBinaries:A}){A??=await qN(t,{project:a});let m=A.get(e);if(!m)throw new Error(`Binary not found (${e}) for ${hn(a.configuration,t)}`);return await fe.mktempPromise(async w=>{let[,v]=m,D=await Nb({project:a,locator:t,binFolder:w});await i7(D.BERRY_BIN_FOLDER,A);let I=n7(me.toPortablePath(v))?Tf(process.execPath,[...h,v,...r],{cwd:s,env:D,stdin:n,stdout:l,stderr:f}):Tf(v,r,{cwd:s,env:D,stdin:n,stdout:l,stderr:f}),R;try{R=await I}finally{await fe.removePromise(D.BERRY_BIN_FOLDER)}return R.code})}async function lpt(t,e,r,{cwd:s,stdin:a,stdout:n,stderr:l,packageAccessibleBinaries:f}){return await LIe(t.anchoredLocator,e,r,{project:t.project,cwd:s,stdin:a,stdout:n,stderr:l,packageAccessibleBinaries:f})}var kIe,Z0,RIe,npt,ipt,s7=tt(()=>{Mt();Mt();Kh();Pb();xl();kIe=st(hy()),Z0=Ae("stream");Jw();mu();Fb();Qb();CN();pu();Au();_p();Ea();RIe=(a=>(a.Yarn1="Yarn Classic",a.Yarn2="Yarn",a.Npm="npm",a.Pnpm="pnpm",a))(RIe||{});npt=2,ipt=(0,kIe.default)(npt)});function Cdt(t,e,r){let s=e,a=e?e.next:t.head,n=new lV(r,s,a,t);return n.next===void 0&&(t.tail=n),n.prev===void 0&&(t.head=n),t.length++,n}function Bdt(t,e){t.tail=new lV(e,t.tail,void 0,t),t.head||(t.head=t.tail),t.length++}function vdt(t,e){t.head=new lV(e,void 0,t.head,t),t.tail||(t.tail=t.head),t.length++}var pwe,lc,IO,tV,dwe,nV,Wy,CO,ywe,gO,og,jIe,Ewe,Vy,Swe,nD,Of,L7,kwe,V7,fV,Owe,hV,Vn,Us,AV,oD,SC,Yc,Hwe,iD,pV,Wc,gV,upt,fpt,_Ie,hpt,Apt,ppt,Vp,Wp,X0,VN,Ob,WN,MIe,YN,UIe,Qf,gC,yo,Lb,IC,Eo,cc,Io,o7,KN,Ba,Ss,a7,c7,HIe,l7,Jh,u7,zN,_b,Oy,Fl,Mb,dpt,gpt,mpt,ypt,gwe,Ept,Ipt,wpt,Zy,Cpt,cg,_f,Ub,di,f7,Jp,h7,Q7,F7,Jb,JN,vC,bC,A7,wC,lg,Lf,rg,Zh,CC,p7,zp,Hb,d7,sO,Ly,oO,Yy,rV,Bpt,wO,mwe,vpt,Spt,bpt,Dpt,Ppt,xpt,kpt,iV,sD,Rpt,eA,Tpt,GIe,Qpt,g7,Ky,ZN,m7,sV,Iwe,Fpt,Npt,wwe,Opt,Lpt,Cwe,_pt,Mpt,Upt,Hpt,jpt,Gpt,qpt,Vpt,Bwe,vwe,Wpt,aO,Ypt,BO,oV,zy,Kpt,_y,y7,zpt,ng,Jpt,Zpt,Xpt,ig,$pt,edt,tdt,E7,rdt,My,mO,ndt,idt,sdt,odt,xn,Dwe,vO,adt,N7,O7,cdt,Cu,Uy,Yp,I7,qIe,Xh,jb,$0,VIe,qi,Kp,eg,w7,Hy,Ms,XN,$N,C7,WIe,YIe,Gb,B7,eO,mC,tg,tO,jy,rO,nO,KIe,ldt,Jy,Zb,udt,Pwe,fdt,hdt,SO,xwe,Adt,zIe,aV,bO,cV,pdt,ddt,JIe,gdt,Rwe,mdt,ZIe,XIe,$Ie,_7,ewe,qb,cO,M7,lO,U7,H7,j7,G7,sg,yO,q7,v7,$h,Twe,ydt,Edt,Idt,wdt,lV,twe,rwe,uO,Vb,Ff,Gy,qy,Wb,S7,Nf,b7,fO,nwe,W7,Y7,hO,AO,iwe,D7,pO,Qwe,P7,DO,uV,Sdt,bdt,Fwe,Nwe,Ddt,Pdt,M$t,xdt,kdt,Rdt,Tdt,Qdt,Lwe,Fdt,Ndt,Odt,_we,K7,EO,Ldt,Mwe,_dt,Uwe,jwe,PO,Mdt,Udt,z7,Gwe,Hdt,jdt,x7,swe,yC,Gdt,qdt,Vdt,Wdt,Ydt,Kdt,owe,J7,awe,Z7,Bu,X7,$7,dO,cwe,lwe,zb,uwe,fwe,k7,ag,wo,iO,hwe,EC,R7,T7,eV,Xb,$b,eD,tD,zdt,rD,Jdt,Zdt,Xdt,Awe,dV,Yb,qwe,$dt,e0t,U$t,t0t,r0t,n0t,i0t,s0t,Kb,H$t,o0t,Vwe=tt(()=>{pwe=st(Ae("events"),1),lc=st(Ae("fs"),1),IO=Ae("node:events"),tV=st(Ae("node:stream"),1),dwe=Ae("node:string_decoder"),nV=st(Ae("node:path"),1),Wy=st(Ae("node:fs"),1),CO=Ae("path"),ywe=Ae("events"),gO=st(Ae("assert"),1),og=Ae("buffer"),jIe=st(Ae("zlib"),1), Line truncated
`,n=Buffer.byteLength(a),l=Math.floor(Math.log(n)/Math.log(10))+1;return n+l>=Math.pow(10,l)&&(l+=1),l+n+a}static parse(e,r,s=!1){return new bwe(ndt(idt(e),r),s)}},ndt=(t,e)=>e?Object.assign({},e,t):t,idt=t=>t.replace(/\n$/,"").split(`
`).reduce(sdt,Object.create(null)),sdt=(t,e)=>{let r=parseInt(e,10);if(r!==Buffer.byteLength(e)+1)return t;e=e.slice((r+" ").length);let s=e.split("="),a=s.shift();if(!a)return t;let n=a.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),l=s.join("=");return t[n]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(n)?new Date(Number(l)*1e3):/^[0-9]+$/.test(l)?+l:l,t},odt=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,xn=odt!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/"),Dwe=class extends Zy{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(t,e,r){switch(super({}),this.pause(),this.extended=e,this.globalExtended=r,this.header=t,this.remain=t.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=t.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!t.path)throw new Error("no path provided for tar.ReadEntry");this.path=xn(t.path),this.mode=t.mode,this.mode&&(this.mode=this.mode&4095),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=this.remain,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath?xn(t.linkpath):void 0,this.uname=t.uname,this.gname=t.gname,e&&this.#e(e),r&&this.#e(r,!0)}write(t){let e=t.length;if(e>this.blockRemain)throw new Error("writing more to entry than is appropriate");let r=this.remain,s=this.blockRemain;return this.remain=Math.max(0,r-e),this.blockRemain=Math.max(0,s-e),this.ignore?!0:r>=e?super.write(t):super.write(t.subarray(0,r))}#e(t,e=!1){t.path&&(t.path=xn(t.path)),t.linkpath&&(t.linkpath=xn(t.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(t).filter(([r,s])=>!(s==null||r==="path"&&e))))}},vO=(t,e,r,s={})=>{t.file&&(s.file=t.file),t.cwd&&(s.cwd=t.cwd),s.code=r instanceof Error&&r.code||e,s.tarCode=e,!t.strict&&s.recoverable!==!1?(r instanceof Error&&(s=Object.assign(r,s),r=r.message),t.emit("warn",e,r,s)):r instanceof Error?t.emit("error",Object.assign(r,s)):t.emit("error",Object.assign(new Error(`${e}: ${r}`),s))},adt=1024*1024,N7=Buffer.from([31,139]),O7=Buffer.from([40,181,47,253]),cdt=Math.max(N7.length,O7.length),Cu=Symbol("state"),Uy=Symbol("writeEntry"),Yp=Symbol("readEntry"),I7=Symbol("nextEntry"),qIe=Symbol("processEntry"),Xh=Symbol("extendedHeader"),jb=Symbol("globalExtendedHeader"),$0=Symbol("meta"),VIe=Symbol("emitMeta"),qi=Symbol("buffer"),Kp=Symbol("queue"),eg=Symbol("ended"),w7=Symbol("emittedEnd"),Hy=Symbol("emit"),Ms=Symbol("unzip"),XN=Symbol("consumeChunk"),$N=Symbol("consumeChunkSub"),C7=Symbol("consumeBody"),WIe=Symbol("consumeMeta"),YIe=Symbol("consumeHeader"),Gb=Symbol("consuming"),B7=Symbol("bufferConcat"),eO=Symbol("maybeEnd"),mC=Symbol("writing"),tg=Symbol("aborted"),tO=Symbol("onDone"),jy=Symbol("sawValidEntry"),rO=Symbol("sawNullBlock"),nO=Symbol("sawEOF"),KIe=Symbol("closeStream"),ldt=()=>!0,Jy=class extends ywe.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[Kp]=[];[qi];[Yp];[Uy];[Cu]="begin";[$0]="";[Xh];[jb];[eg]=!1;[Ms];[tg]=!1;[jy];[rO]=!1;[nO]=!1;[mC]=!1;[Gb]=!1;[w7]=!1;constructor(t={}){super(),this.file=t.file||"",this.on(tO,()=>{(this[Cu]==="begin"||this[jy]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),t.ondone?this.on(tO,t.ondone):this.on(tO,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!t.strict,this.maxMetaEntrySize=t.maxMetaEntrySize||adt,this.filter=typeof t.filter=="function"?t.filter:ldt;let e=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=!(t.gzip||t.zstd)&&t.brotli!==void 0?t.brotli:e?void 0:!1;let r=t.file&&(t.file.endsWith(".tar.zst")||t.file.endsWith(".tzst"));this.zstd=!(t.gzip||t.brotli)&&t.zstd!==void 0?t.zstd:r?!0:void 0,this.on("end",()=>this[KIe]()),typeof t.onwarn=="function"&&this.on("warn",t.onwarn),typeof t.onReadEntry=="function"&&this.on("entry",t.onReadEntry)}warn(t,e,r={}){vO(this,t,e,r)}[YIe](t,e){this[jy]===void 0&&(this[jy]=!1);let r;try{r=new zy(t,e,this[Xh],this[jb])}catch(s){return this.warn("TAR_ENTRY_INVALID",s)}if(r.nullBlock)this[rO]?(this[nO]=!0,this[Cu]==="begin"&&(this[Cu]="header"),this[Hy]("eof")):(this[rO]=!0,this[Hy]("nullBlock"));else if(this[rO]=!1,!r.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:r});else if(!r.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:r});else{let s=r.type;if(/^(Symbolic)?Link$/.test(s)&&!r.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:r});else if(!/^(Symbolic)?Link$/.test(s)&&!/^(Global)?ExtendedHeader$/.test Line truncated
`}),f},s})});var bs={};lr(bs,{emitList:()=>A0t,emitTree:()=>oCe,treeNodeToJson:()=>sCe,treeNodeToTreeify:()=>iCe});function iCe(t,{configuration:e}){let r={},s=0,a=(n,l)=>{let f=Array.isArray(n)?n.entries():Object.entries(n);for(let[h,A]of f){if(!A)continue;let{label:m,value:w,children:v}=A,D=[];typeof m<"u"&&D.push(wy(e,m,2)),typeof w<"u"&&D.push(or(e,w[0],w[1])),D.length===0&&D.push(wy(e,`${h}`,2));let I=D.join(": ").trim(),R=`\0${s++}\0`,N=l[`${R}${I}`]={};typeof v<"u"&&a(v,N)}};if(typeof t.children>"u")throw new Error("The root node must only contain children");return a(t.children,r),r}function sCe(t){let e=r=>{if(typeof r.children>"u"){if(typeof r.value>"u")throw new Error("Assertion failed: Expected a value to be set if the children are missing");return Cy(r.value[0],r.value[1])}let s=Array.isArray(r.children)?r.children.entries():Object.entries(r.children??{}),a=Array.isArray(r.children)?[]:{};for(let[n,l]of s)l&&(a[p0t(n)]=e(l));return typeof r.value>"u"?a:{value:Cy(r.value[0],r.value[1]),children:a}};return e(t)}function A0t(t,{configuration:e,stdout:r,json:s}){let a=t.map(n=>({value:n}));oCe({children:a},{configuration:e,stdout:r,json:s})}function oCe(t,{configuration:e,stdout:r,json:s,separators:a=0}){if(s){let l=Array.isArray(t.children)?t.children.values():Object.values(t.children??{});for(let f of l)f&&r.write(`${JSON.stringify(sCe(f))}
`);return}let n=(0,nCe.asTree)(iCe(t,{configuration:e}),!1,!1);if(n=n.replace(/\0[0-9]+\0/g,""),a>=1&&(n=n.replace(/^([├└]─)/gm,`\u2502
$1`).replace(/^│\n/,"")),a>=2)for(let l=0;l<2;++l)n=n.replace(/^([│ ].{2}[├│ ].{2}[^\n]+\n)(([│ ]).{2}[├└].{2}[^\n]*\n[│ ].{2}[│ ].{2}[├└]─)/gm,`$1$3 \u2502
$2`).replace(/^│\n/,"");if(a>=3)throw new Error("Only the first two levels are accepted by treeUtils.emitTree");r.write(n)}function p0t(t){return typeof t=="string"?t.replace(/^\0[0-9]+\0/,""):t}var nCe,aCe=tt(()=>{nCe=st(rCe());pu()});var xO,cCe=tt(()=>{xO=class{constructor(e){this.releaseFunction=e;this.map=new Map}addOrCreate(e,r){let s=this.map.get(e);if(typeof s<"u"){if(s.refCount<=0)throw new Error(`Race condition in RefCountedMap. While adding a new key the refCount is: ${s.refCount} for ${JSON.stringify(e)}`);return s.refCount++,{value:s.value,release:()=>this.release(e)}}else{let a=r();return this.map.set(e,{refCount:1,value:a}),{value:a,release:()=>this.release(e)}}}release(e){let r=this.map.get(e);if(!r)throw new Error(`Unbalanced calls to release. No known instances of: ${JSON.stringify(e)}`);let s=r.refCount;if(s<=0)throw new Error(`Unbalanced calls to release. Too many release vs alloc refcount would become: ${s-1} of ${JSON.stringify(e)}`);s==1?(this.map.delete(e),this.releaseFunction(r.value)):r.refCount--}}});function lD(t){let e=t.match(d0t);if(!e?.groups)throw new Error("Assertion failed: Expected the checksum to match the requested pattern");let r=e.groups.cacheVersion?parseInt(e.groups.cacheVersion):null;return{cacheKey:e.groups.cacheKey??null,cacheVersion:r,cacheSpec:e.groups.cacheSpec??null,hash:e.groups.hash}}var lCe,BV,vV,kO,gn,d0t,SV=tt(()=>{We();Mt();Mt();Kh();lCe=Ae("crypto"),BV=st(Ae("fs"));cCe();mu();G0();Au();Ea();vV=Ow(process.env.YARN_CACHE_CHECKPOINT_OVERRIDE??process.env.YARN_CACHE_VERSION_OVERRIDE??9),kO=Ow(process.env.YARN_CACHE_VERSION_OVERRIDE??10),gn=class t{constructor(e,{configuration:r,immutable:s=r.get("enableImmutableCache"),check:a=!1}){this.markedFiles=new Set;this.mutexes=new Map;this.refCountedZipFsCache=new xO(e=>{e.discardAndClose()});this.cacheId=`-${(0,lCe.randomBytes)(8).toString("hex")}.tmp`;this.configuration=r,this.cwd=e,this.immutable=s,this.check=a;let{cacheSpec:n,cacheKey:l}=t.getCacheKey(r);this.cacheSpec=n,this.cacheKey=l}static async find(e,{immutable:r,check:s}={}){let a=new t(e.get("cacheFolder"),{configuration:e,immutable:r,check:s});return await a.setup(),a}static getCacheKey(e){let r=e.get("compressionLevel"),s=r!=="mixed"?`c${r}`:"";return{cacheKey:[kO,s].join(""),cacheSpec:s}}get mirrorCwd(){if(!this.configuration.get("enableMirror"))return null;let e=`${this.configuration.get("globalFolder")}/cache`;return e!==this.cwd?e:null}getVersionFilename(e){return`${Yw(e)}-${this.cacheKey}.zip`}getChecksumFilename(e,r){let a=lD(r).hash.slice(0,10);return`${Yw(e)}-${a}.zip`}isChecksumCompatible(e){if(e===null)return!1;let{cacheVersion:r,cacheSpec:s}=lD(e);if(r===null||r<vV)return!1;let a=this.configuration.get("cacheMigrationMode");return!(r<kO&&a==="always"||s!==this.cacheSpec&&a!=="required-only")}getLocatorPath(e,r){return this.mirrorCwd===null?Y.resolve(this.cwd,this.getVersionFilename(e)):r===null?Y.resolve(this.cwd,this.getVersionFilename(e)):Y.resolve(this.cwd,this.getChecksumFilename(e,r))}getLocatorMirrorPath(e){let r=this.mirrorCwd;return r!==null?Y.resolve(r,this.getVersionFilename(e)):null}async setup(){if(!this.configuration.get("enableGlobalCache"))if(this.immutable){if(!await fe.existsPromise(this.cwd))throw new Zt(56,"Cache path does not exist.")}else{await fe.mkdirPromise(this.cwd,{recursive:!0});let e=Y.resolve(this.cwd,".gitignore");await fe.changeFilePromise(e,`/.gitignore
*.flock
*.tmp
`)}(this.mirrorCwd||!this.immutable)&&await fe.mkdirPromise(this.mirrorCwd||this.cwd,{recursive:!0})}async fetchPackageFromCache(e,r,{onHit:s,onMiss:a,loader:n,...l}){let f=this.getLocatorMirrorPath(e),h=new pi,A=()=>{let de=new _s,xe=Y.join(Rt.root,L9(e));return de.mkdirSync(xe,{recursive:!0}),de.writeJsonSync(Y.join(xe,Or.manifest),{name:Qn(e),mocked:!0}),de},m=async(de,{isColdHit:xe,controlPath:we=null})=>{if(we===null&&l.unstablePackages?.has(e.locatorHash))return{isValid:!0,hash:null};let d=r&&!xe?lD(r).cacheKey:this.cacheKey,be=!l.skipIntegrityCheck||!r?`${d}/${await RF(de)}`:r;if(we!==null){let Ee=!l.skipIntegrityCheck||!r?`${this.cacheKey}/${await RF(we)}`:r;if(be!==Ee)throw new Zt(18,"The remote archive doesn't match the local checksum - has the local cache been corrupted?")}let Ce=null;switch(r!==null&&be!==r&&(this.check?Ce="throw":lD(r).cacheKey!==lD(be).cacheKey?Ce="update":Ce=this.configuration.get("checksumBehavior")),Ce){case null:case"update":return{isValid:!0,hash:be};case"ignore":return{isValid:!0,hash:r};case"reset":return{isValid:!1,hash:r};default:case"throw":throw new Zt(18,"The remote archive doesn't match the expected checksum")}},w=async de=>{if(!n)throw new Error(`Cache check required but no loader configured for ${hn(this.configuration,e)}`);let xe=await n(),we=xe.getRealPath();xe.saveAndClose(),await fe.chmodPromise(we,420);let d=await m(de,{controlPath:we,isColdHit:!1});if(!d.isValid)throw new Error("Assertion failed: Expected a valid checksum");return d.hash},v=async()=>{if(f===null||!await fe.existsPromise(f)){let de=await n(),xe=de.getRealPath();return de.saveAndClose(),{source:"loader",path:xe}}return{source:"mirror",path:f}},D=async()=>{if(!n)throw new Error(`Cache entry required but missing for ${hn(this.configuration,e)}`);if(this.immutable)throw new Zt(56,`Cache entry required but missing for ${hn(this.configuration,e)}`);let{path:de,source:xe}=await v(),{hash:we}=await m(de,{isColdHit:!0}),d=this.getLocatorPath(e,we),be=[];xe!=="mirror"&&f!==null&&be.push(async()=>{let Ee=`${f}${this.cacheId}`;await fe.copyFilePromise(de,Ee,BV.default.constants.COPYFILE_FICLONE),await fe.chmodPromise(Ee,420),await fe.renamePromise(Ee,f)}),(!l.mirrorWriteOnly||f===null)&&be.push(async()=>{let Ee=`${d}${this.cacheId}`;await fe.copyFilePromise(de,Ee,BV.default.constants.COPYFILE_FICLONE),await fe.chmodPromise(Ee,420),await fe.renamePromise(Ee,d)});let Ce=l.mirrorWriteOnly?f??d:d;return await Promise.all(be.map(Ee=>Ee())),[!1,Ce,we]},I=async()=>{let xe=(async()=>{let we=l.unstablePackages?.has(e.locatorHash),d=we||!r||this.isChecksumCompatible(r)?this.getLocatorPath(e,r):null,be=d!==null?this.markedFiles.has(d)||await h.existsPromise(d):!1,Ce=!!l.mockedPackages?.has(e.locatorHash)&&(!this.check||!be),Ee=Ce||be,he=Ee?s:a;if(he&&he(),Ee){let $=null,De=d;if(!Ce)if(this.check)$=await w(De);else{let Te=await m(De,{isColdHit:!1});if(Te.isValid)$=Te.hash;else return D()}return[Ce,De,$]}else{if(this.immutable&&we)throw new Zt(56,`Cache entry required but missing for ${hn(this.configuration,e)}; consider defining ${pe.pretty(this.configuration,"supportedArchitectures",pe.Type.CODE)} to cache packages for multiple systems`);return D()}})();this.mutexes.set(e.locatorHash,xe);try{return await xe}finally{this.mutexes.delete(e.locatorHash)}};for(let de;de=this.mutexes.get(e.locatorHash);)await de;let[R,N,U]=await I();R||this.markedFiles.add(N);let V=()=>this.refCountedZipFsCache.addOrCreate(N,()=>R?A():new _s(N,{baseFs:h,readOnly:!0})),ee,te=new ow(()=>Z5(()=>(ee=V(),ee.value),de=>`Failed to open the cache entry for ${hn(this.configuration,e)}: ${de}`),Y),ie=new Qh(N,{baseFs:te,pathUtils:Y}),ae=()=>{ee?.release()},ge=l.unstablePackages?.has(e.locatorHash)?null:U;return[ie,ae,ge]}},d0t=/^(?:(?<cacheKey>(?<cacheVersion>[0-9]+)(?<cacheSpec>.*))\/)?(?<hash>.*)$/});var RO,uCe=tt(()=>{RO=(r=>(r[r.SCRIPT=0]="SCRIPT",r[r.SHELLCODE=1]="SHELLCODE",r))(RO||{})});var g0t,DC,bV=tt(()=>{Mt();au();_p();Ea();g0t=[[/^(git(?:\+(?:https|ssh))?:\/\/.*(?:\.git)?)#(.*)$/,(t,e,r,s)=>`${r}#commit=${s}`],[/^https:\/\/((?:[^/]+?)@)?codeload\.github\.com\/([^/]+\/[^/]+)\/tar\.gz\/([0-9a-f]+)$/,(t,e,r="",s,a)=>`https://${r}github.com/${s}.git#commit=${a}`],[/^https:\/\/((?:[^/]+?)@)?github\.com\/([^/]+\/[^/]+?)(?:\.git)?#([0-9a-f]+)$/,(t,e,r="",s,a)=>`https://${r}github.com/${s}.git#commit=${a}`],[/^https?:\/\/[^/]+\/(?:[^/]+\/)*(?:@.+(?:\/|(?:%2f)))?([^/]+)\/(?:-|download)\/\1-[^/]+\.tgz(?:#|$)/,t=>`npm:${t}`],[/^https:\/\/npm\.pkg\.github\.com\/download\/(?:@[^/]+)\/(?:[^/]+)\/(?:[^/]+)\/(?:[0-9a-f]+)(?:#|$)/,t=>`npm:${t}`],[/^https:\/\/npm\.fontawesome\.com\/(?:@[^/]+)\/([^/]+)\/-\/([^/]+)\/\1-\2.tgz(?:#|$)/,t=>`npm:${t}`],[/^https?:\/\/[^/]+\/.*\/(@[^/]+)\/([^/]+)\/-\/\1\/\2-(?:[.\d\w-]+)\.tgz(?:#|$)/,(t,e)=>OF({protocol:"npm:",source:null,selector:t,params:{__archiveUrl:e}})],[/^[^/]+\.tgz#[0-9a-f]+$/,t=>`npm:${t}`]],DC=class{constructor(e){this.resolver=e;this.resolutions=null}async setup(e,{report:r}){let s=Y.join(e.cwd,Or Line truncated
`)}reportProgress(r){return{...Promise.resolve().then(async()=>{for await(let{}of r);}),stop:()=>{}}}reportJson(r){}reportFold(r,s){}async finalize(){this.errorCount>0&&(this.stdout.write(`
`),this.stdout.write(`${or(this.configuration,"\u27A4","redBright")} Errors happened when preparing the environment required to run this command.
`),this.suggestInstall&&this.stdout.write(`${or(this.configuration,"\u27A4","redBright")} This might be caused by packages being missing from the lockfile, in which case running "yarn install" might help.
`))}formatNameWithHyperlink(r){return e7(r,{configuration:this.configuration,json:!1})}}});var PC,DV=tt(()=>{Ea();PC=class{constructor(e){this.resolver=e}supportsDescriptor(e,r){return!!(r.project.storedResolutions.get(e.descriptorHash)||r.project.originalPackages.has(QF(e).locatorHash))}supportsLocator(e,r){return!!(r.project.originalPackages.has(e.locatorHash)&&!r.project.lockfileNeedsRefresh)}shouldPersistResolution(e,r){throw new Error("The shouldPersistResolution method shouldn't be called on the lockfile resolver, which would always answer yes")}bindDescriptor(e,r,s){return e}getResolutionDependencies(e,r){return this.resolver.getResolutionDependencies(e,r)}async getCandidates(e,r,s){let a=s.project.storedResolutions.get(e.descriptorHash);if(a){let l=s.project.originalPackages.get(a);if(l)return[l]}let n=s.project.originalPackages.get(QF(e).locatorHash);if(n)return[n];throw new Error("Resolution expected from the lockfile data")}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(l=>l.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){let s=r.project.originalPackages.get(e.locatorHash);if(!s)throw new Error("The lockfile resolver isn't meant to resolve packages - they should already have been stored into a cache");return s}}});function Zp(){}function m0t(t,e,r,s,a){for(var n=0,l=e.length,f=0,h=0;n<l;n++){var A=e[n];if(A.removed){if(A.value=t.join(s.slice(h,h+A.count)),h+=A.count,n&&e[n-1].added){var w=e[n-1];e[n-1]=e[n],e[n]=w}}else{if(!A.added&&a){var m=r.slice(f,f+A.count);m=m.map(function(D,I){var R=s[h+I];return R.length>D.length?R:D}),A.value=t.join(m)}else A.value=t.join(r.slice(f,f+A.count));f+=A.count,A.added||(h+=A.count)}}var v=e[l-1];return l>1&&typeof v.value=="string"&&(v.added||v.removed)&&t.equals("",v.value)&&(e[l-2].value+=v.value,e.pop()),e}function y0t(t){return{newPos:t.newPos,components:t.components.slice(0)}}function E0t(t,e){if(typeof t=="function")e.callback=t;else if(t)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function pCe(t,e,r){return r=E0t(r,{ignoreWhitespace:!0}),TV.diff(t,e,r)}function I0t(t,e,r){return QV.diff(t,e,r)}function TO(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?TO=function(e){return typeof e}:TO=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},TO(t)}function PV(t){return B0t(t)||v0t(t)||S0t(t)||b0t()}function B0t(t){if(Array.isArray(t))return xV(t)}function v0t(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function S0t(t,e){if(t){if(typeof t=="string")return xV(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xV(t,e)}}function xV(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,s=new Array(e);r<e;r++)s[r]=t[r];return s}function b0t(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kV(t,e,r,s,a){e=e||[],r=r||[],s&&(t=s(a,t));var n;for(n=0;n<e.length;n+=1)if(e[n]===t)return r[n];var l;if(D0t.call(t)==="[object Array]"){for(e.push(t),l=new Array(t.length),r.push(l),n=0;n<t.length;n+=1)l[n]=kV(t[n],e,r,s,a);return e.pop(),r.pop(),l}if(t&&t.toJSON&&(t=t.toJSON()),TO(t)==="object"&&t!==null){e.push(t),l={},r.push(l);var f=[],h;for(h in t)t.hasOwnProperty(h)&&f.push(h);for(f.sort(),n=0;n<f.length;n+=1)h=f[n],l[h]=kV(t[h],e,r,s,h);e.pop(),r.pop()}else l=t;return l}function dCe(t,e,r,s,a,n,l){l||(l={}),typeof l.context>"u"&&(l.context=4);var f=I0t(r,s,l);if(!f)return;f.push({value:"",lines:[]});function h(U){return U.map(function(V){return" "+V})}for(var A=[],m=0,w=0,v=[],D=1,I=1,R=function(V){var ee=f[V],te=ee.lines||ee.value.replace(/\n$/,"").split(`
`);if(ee.lines=te,ee.added||ee.removed){var ie;if(!m){var ae=f[V-1];m=D,w=I,ae&&(v=l.context>0?h(ae.lines.slice(-l.context)):[],m-=v.length,w-=v.length)}(ie=v).push.apply(ie,PV(te.map(function(Ee){return(ee.added?"+":"-")+Ee}))),ee.added?I+=te.length:D+=te.length}else{if(m)if(te.length<=l.context*2&&V<f.length-2){var ge;(ge=v).push.apply(ge,PV(h(te)))}else{var de,xe=Math.min(te.length,l.context);(de=v).push.apply(de,PV(h(te.slice(0,xe))));var we={oldStart:m,oldLines:D-m+xe,newStart:w,newLines:I-w+xe,lines:v};if(V>=f.length-2&&te.length<=l.context){var d=/\n$/.test(r),be=/\n$/.test(s),Ce=te.length==0&&v.length>we.oldLines;!d&&Ce&&r.length>0&&v.splice(we.oldLines,0,"\\ No newline at end of file"),(!d&&!Ce||!be)&&v.push("\\ No newline at end of file")}A.push(we),m=0,w=0,v=[]}D+=te.length,I+=te.length}},N=0;N<f.length;N++)R(N);return{oldFileName:t,newFileName:e,oldHeader:a,newHeader:n,hunks:A}}var $er,hCe,ACe,TV,QV,w0t,C0t,D0t,uD,RV,FV=tt(()=>{Zp.prototype={diff:function(e,r){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=s.callback;typeof s=="function"&&(a=s,s={}),this.options=s;var n=this;function l(R){return a?(setTimeout(function(){a(void 0,R)},0),!0):R}e=this.castInput(e),r=this.castInput(r),e=this.removeEmpty(this.tokenize(e)),r=this.removeEmpty(this.tokenize(r));var f=r.length,h=e.length,A=1,m=f+h;s.maxEditLength&&(m=Math.min(m,s.maxEditLength));var w=[{newPos:-1,components:[]}],v=this.extractCommon(w[0],r,e,0);if(w[0].newPos+1>=f&&v+1>=h)return l([{value:this.join(r),count:r.length}]);function D(){for(var R=-1*A;R<=A;R+=2){var N=void 0,U=w[R-1],V=w[R+1],ee=(V?V.newPos:0)-R;U&&(w[R-1]=void 0);var te=U&&U.newPos+1<f,ie=V&&0<=ee&&ee<h;if(!te&&!ie){w[R]=void 0;continue}if(!te||ie&&U.newPos<V.newPos?(N=y0t(V),n.pushComponent(N.components,void 0,!0)):(N=U,N.newPos++,n.pushComponent(N.components,!0,void 0)),ee=n.extractCommon(N,r,e,R),N.newPos+1>=f&&ee+1>=h)return l(m0t(n,N.components,r,e,n.useLongestToken));w[R]=N}A++}if(a)(function R(){setTimeout(function(){if(A>m)return a();D()||R()},0)})();else for(;A<=m;){var I=D();if(I)return I}},pushComponent:function(e,r,s){var a=e[e.length-1];a&&a.added===r&&a.removed===s?e[e.length-1]={count:a.count+1,added:r,removed:s}:e.push({count:1,added:r,removed:s})},extractCommon:function(e,r,s,a){for(var n=r.length,l=s.length,f=e.newPos,h=f-a,A=0;f+1<n&&h+1<l&&this.equals(r[f+1],s[h+1]);)f++,h++,A++;return A&&e.components.push({count:A}),e.newPos=f,h},equals:function(e,r){return this.options.comparator?this.options.comparator(e,r):e===r||this.options.ignoreCase&&e.toLowerCase()===r.toLowerCase()},removeEmpty:function(e){for(var r=[],s=0;s<e.length;s++)e[s]&&r.push(e[s]);return r},castInput:function(e){return e},tokenize:function(e){return e.split("")},join:function(e){return e.join("")}};$er=new Zp;hCe=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,ACe=/\S/,TV=new Zp;TV.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!ACe.test(t)&&!ACe.test(e)};TV.tokenize=function(t){for(var e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),r=0;r<e.length-1;r++)!e[r+1]&&e[r+2]&&hCe.test(e[r])&&hCe.test(e[r+2])&&(e[r]+=e[r+2],e.splice(r+1,2),r--);return e};QV=new Zp;QV.tokenize=function(t){var e=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(var s=0;s<r.length;s++){var a=r[s];s%2&&!this.options.newlineIsToken?e[e.length-1]+=a:(this.options.ignoreWhitespace&&(a=a.trim()),e.push(a))}return e};w0t=new Zp;w0t.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};C0t=new Zp;C0t.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};D0t=Object.prototype.toString,uD=new Zp;uD.useLongestToken=!0;uD.tokenize=QV.tokenize;uD.castInput=function(t){var e=this.options,r=e.undefinedReplacement,s=e.stringifyReplacer,a=s===void 0?function(n,l){return typeof l>"u"?r:l}:s;return typeof t=="string"?t:JSON.stringify(kV(t,null,null,a),a," ")};uD.equals=function(t,e){return Zp.prototype.equals.call(uD,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};RV=new Zp;RV.tokenize=function(t){return t.slice()};RV.join=RV.removeEmpty=function(t){return t}});var QO,gCe=tt(()=>{mu();QO=class{constructor(e){this.resolver=e}supportsDescriptor(e,r){return this.resolver.supportsDescriptor(e,r)}supportsLocator(e,r){return this.resolver.supportsLocator(e,r)}shouldPersistResolution(e,r){return this.resolver.shouldPersistResolution(e,r)}bindDescriptor(e,r,s){return this.resolver.bindDescriptor(e,r,s)}getResolutionDependencies(e,r){return this.resolver.getResolutionDependencies(e,r)}async getCandidates(e,r,s){throw new Zt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}async getSatisfying(e,r,s,a){throw new Zt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}async resolve(e,r){throw new Zt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfLine truncated
`;await fe.changeFilePromise(r,s,{automaticNewlines:!0}),this.manifest.raw=e}}});function Q0t({project:t,allDescriptors:e,allResolutions:r,allPackages:s,accessibleLocators:a=new Set,optionalBuilds:n=new Set,peerRequirements:l=new Map,peerWarnings:f=[],peerRequirementNodes:h=new Map,volatileDescriptors:A=new Set}){let m=new Map,w=[],v=new Map,D=new Map,I=new Map,R=new Map,N=new Map,U=new Map(t.workspaces.map(ae=>{let ge=ae.anchoredLocator.locatorHash,de=s.get(ge);if(typeof de>"u")throw new Error("Assertion failed: The workspace should have an associated package");return[ge,ZS(de)]})),V=()=>{let ae=fe.mktempSync(),ge=Y.join(ae,"stacktrace.log"),de=String(w.length+1).length,xe=w.map((we,d)=>`${`${d+1}.`.padStart(de," ")} ${qc(we)}
`).join("");throw fe.writeFileSync(ge,xe),fe.detachTemp(ae),new Zt(45,`Encountered a stack overflow when resolving peer dependencies; cf ${me.fromPortablePath(ge)}`)},ee=ae=>{let ge=r.get(ae.descriptorHash);if(typeof ge>"u")throw new Error("Assertion failed: The resolution should have been registered");let de=s.get(ge);if(!de)throw new Error("Assertion failed: The package could not be found");return de},te=(ae,ge,de,{top:xe,optional:we})=>{w.length>1e3&&V(),w.push(ge);let d=ie(ae,ge,de,{top:xe,optional:we});return w.pop(),d},ie=(ae,ge,de,{top:xe,optional:we})=>{if(we||n.delete(ge.locatorHash),a.has(ge.locatorHash))return;a.add(ge.locatorHash);let d=s.get(ge.locatorHash);if(!d)throw new Error(`Assertion failed: The package (${hn(t.configuration,ge)}) should have been registered`);let be=new Set,Ce=new Map,Ee=[],he=[],$=[],De=[];for(let Te of Array.from(d.dependencies.values())){if(d.peerDependencies.has(Te.identHash)&&d.locatorHash!==xe)continue;if(Np(Te))throw new Error("Assertion failed: Virtual packages shouldn't be encountered when virtualizing a branch");A.delete(Te.descriptorHash);let ot=we;if(!ot){let Qe=d.dependenciesMeta.get(Qn(Te));if(typeof Qe<"u"){let ft=Qe.get(null);typeof ft<"u"&&ft.optional&&(ot=!0)}}let j=r.get(Te.descriptorHash);if(!j)throw new Error(`Assertion failed: The resolution (${xi(t.configuration,Te)}) should have been registered`);let rt=U.get(j)||s.get(j);if(!rt)throw new Error(`Assertion failed: The package (${j}, resolved from ${xi(t.configuration,Te)}) should have been registered`);if(rt.peerDependencies.size===0){te(Te,rt,new Map,{top:xe,optional:ot});continue}let Ne,Fe,Pe=new Set,He=new Map;Ee.push(()=>{Ne=N9(Te,ge.locatorHash),Fe=O9(rt,ge.locatorHash),d.dependencies.set(Te.identHash,Ne),r.set(Ne.descriptorHash,Fe.locatorHash),e.set(Ne.descriptorHash,Ne),s.set(Fe.locatorHash,Fe),Tp(R,Fe.locatorHash).add(Ne.descriptorHash),be.add(Fe.locatorHash)}),he.push(()=>{N.set(Fe.locatorHash,He);for(let Qe of Fe.peerDependencies.values()){let Me=Rl(Ce,Qe.identHash,()=>{let x=de.get(Qe.identHash)??null,C=d.dependencies.get(Qe.identHash);return!C&&$S(ge,Qe)&&(ae.identHash===ge.identHash?C=ae:(C=oi(ge,ae.range),e.set(C.descriptorHash,C),r.set(C.descriptorHash,ge.locatorHash),A.delete(C.descriptorHash),x=null)),C||(C=oi(Qe,"missing:")),{subject:ge,ident:Qe,provided:C,root:!x,requests:new Map,hash:`p${Os(ge.locatorHash,Qe.identHash).slice(0,6)}`}}).provided;if(Me.range==="missing:"&&Fe.dependencies.has(Qe.identHash)){Fe.peerDependencies.delete(Qe.identHash);continue}if(He.set(Qe.identHash,{requester:Fe,descriptor:Qe,meta:Fe.peerDependenciesMeta.get(Qn(Qe)),children:new Map}),Fe.dependencies.set(Qe.identHash,Me),Np(Me)){let x=r.get(Me.descriptorHash);Tp(I,x).add(Fe.locatorHash)}v.set(Me.identHash,Me),Me.range==="missing:"&&Pe.add(Me.identHash)}Fe.dependencies=new Map(go(Fe.dependencies,([Qe,ft])=>Qn(ft)))}),$.push(()=>{if(!s.has(Fe.locatorHash))return;let Qe=m.get(rt.locatorHash);typeof Qe=="number"&&Qe>=2&&V();let ft=m.get(rt.locatorHash),Me=typeof ft<"u"?ft+1:1;m.set(rt.locatorHash,Me),te(Ne,Fe,He,{top:xe,optional:ot}),m.set(rt.locatorHash,Me-1)}),De.push(()=>{let Qe=r.get(Ne.descriptorHash);if(typeof Qe>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");let ft=N.get(Qe);if(typeof ft>"u")throw new Error("Assertion failed: Expected the peer requests to be registered");for(let Me of Ce.values()){let x=ft.get(Me.ident.identHash);x&&(Me.requests.set(Ne.descriptorHash,x),h.set(Me.hash,Me),Me.root||de.get(Me.ident.identHash)?.children.set(Ne.descriptorHash,x))}if(s.has(Fe.locatorHash))for(let Me of Pe)Fe.dependencies.delete(Me)})}for(let Te of[...Ee,...he])Te();for(let Te of be){be.delete(Te);let ot=s.get(Te),j=Os(Ww(ot).locatorHash,...Array.from(ot.dependencies.values(),Pe=>{let He=Pe.range!=="missing:"?r.get(Pe.descriptorHash):"missing:";if(typeof He>"u")throw new Error(`Assertion failed: Expected the resolution for ${xi(t.configuration,Pe)} to have been registered`);return He===xe?`${He} (top)`:He})),rt=D.get(j);if(typeof rt>"u"){D.set(j,ot);continue}let Ne=Tp(R,rt.locatorHash);for(let Pe of R.get(ot.locatorHash)??[])r.set(Pe,rt.locatorHash),Ne.add(Pe);s.delete(ot.locatorHash),a.delete(ot.locatorHash),be.delete(ot.locatorHash);let Fe=I.get(ot.locatorHash);if(Fe!==void 0){let Pe=Tp(I,rt.locatorHash);for(let He of Fe)Pe.add(He),be.add(He)}}for(let Te of[...$,...De])Te()};for(let ae of t.workspaces){let ge=ae.anchoredLocator;A.delete(ae.anchoredDescriptor.descriptorHash),te(ae.anchoredDescriptor,ge,new Map,{top:ge.locatorHash,optional:!1})}for(let ae of h.values()){if(!ae.root)continue;let ge=s.get(ae.subject.locatorHash);if(typeof ge>"u")continue;for(let xe of ae.requests.values()){let we=`p${Os(ae.subject.locatorHash,Qn(ae.ident),xe.requester.locatorHash).slice(0,6)}`;l.set(we,{subject:ae.subject.locatorHash,requested:ae.ident,rootRequester:xe.requester.locatorHash,allRequesters:Array.from(ib(xe),d=>d.requester.locatorHash)})}let de=[...ib(ae)];if(ae.provided.rang Line truncated
${[w,v,D].join(`
`)}`)}async setupResolutions(){this.storedResolutions=new Map,this.storedDescriptors=new Map,this.storedPackages=new Map,this.lockFileChecksum=null;let e=Y.join(this.cwd,Or.lockfile),r=this.configuration.get("defaultLanguageName");if(fe.existsSync(e)){let s=await fe.readFilePromise(e,"utf8");this.lockFileChecksum=ECe(s);let a=Fs(s);if(a.__metadata){let n=a.__metadata.version,l=a.__metadata.cacheKey;this.lockfileLastVersion=n,this.lockfileNeedsRefresh=n<OO;for(let f of Object.keys(a)){if(f==="__metadata")continue;let h=a[f];if(typeof h.resolution>"u")throw new Error(`Assertion failed: Expected the lockfile entry to have a resolution field (${f})`);let A=Op(h.resolution,!0),m=new nr;m.load(h,{yamlCompatibilityMode:!0});let w=m.version,v=m.languageName||r,D=h.linkType.toUpperCase(),I=h.conditions??null,R=m.dependencies,N=m.peerDependencies,U=m.dependenciesMeta,V=m.peerDependenciesMeta,ee=m.bin;if(h.checksum!=null){let ie=typeof l<"u"&&!h.checksum.includes("/")?`${l}/${h.checksum}`:h.checksum;this.storedChecksums.set(A.locatorHash,ie)}let te={...A,version:w,languageName:v,linkType:D,conditions:I,dependencies:R,peerDependencies:N,dependenciesMeta:U,peerDependenciesMeta:V,bin:ee};this.originalPackages.set(te.locatorHash,te);for(let ie of f.split(x0t)){let ae=q0(ie);n<=6&&(ae=this.configuration.normalizeDependency(ae),ae=oi(ae,ae.range.replace(/^patch:[^@]+@(?!npm(:|%3A))/,"$1npm%3A"))),this.storedDescriptors.set(ae.descriptorHash,ae),this.storedResolutions.set(ae.descriptorHash,A.locatorHash)}}}else s.includes("yarn lockfile v1")&&(this.lockfileLastVersion=-1)}}async setupWorkspaces(){this.workspaces=[],this.workspacesByCwd=new Map,this.workspacesByIdent=new Map;let e=new Set,r=(0,NO.default)(4),s=async(a,n)=>{if(e.has(n))return a;e.add(n);let l=new xC(n,{project:this});await r(()=>l.setup());let f=a.then(()=>{this.addWorkspace(l)});return Array.from(l.workspacesCwds).reduce(s,f)};await s(Promise.resolve(),this.cwd)}addWorkspace(e){let r=this.workspacesByIdent.get(e.anchoredLocator.identHash);if(typeof r<"u")throw new Error(`Duplicate workspace name ${vs(this.configuration,e.anchoredLocator)}: ${me.fromPortablePath(e.cwd)} conflicts with ${me.fromPortablePath(r.cwd)}`);this.workspaces.push(e),this.workspacesByCwd.set(e.cwd,e),this.workspacesByIdent.set(e.anchoredLocator.identHash,e)}get topLevelWorkspace(){return this.getWorkspaceByCwd(this.cwd)}tryWorkspaceByCwd(e){Y.isAbsolute(e)||(e=Y.resolve(this.cwd,e)),e=Y.normalize(e).replace(/\/+$/,"")||Rt.root;let r=this.workspacesByCwd.get(e);return r||null}getWorkspaceByCwd(e){let r=this.tryWorkspaceByCwd(e);if(!r)throw new Error(`Workspace not found (${e})`);return r}tryWorkspaceByFilePath(e){let r=null;for(let s of this.workspaces)Y.relative(s.cwd,e).startsWith("../")||r&&r.cwd.length>=s.cwd.length||(r=s);return r||null}getWorkspaceByFilePath(e){let r=this.tryWorkspaceByFilePath(e);if(!r)throw new Error(`Workspace not found (${e})`);return r}tryWorkspaceByIdent(e){let r=this.workspacesByIdent.get(e.identHash);return typeof r>"u"?null:r}getWorkspaceByIdent(e){let r=this.tryWorkspaceByIdent(e);if(!r)throw new Error(`Workspace not found (${vs(this.configuration,e)})`);return r}tryWorkspaceByDescriptor(e){if(e.range.startsWith(Gi.protocol)){let s=e.range.slice(Gi.protocol.length);if(s!=="^"&&s!=="~"&&s!=="*"&&!Vc(s))return this.tryWorkspaceByCwd(s)}let r=this.tryWorkspaceByIdent(e);return r===null||(Np(e)&&(e=XS(e)),!r.accepts(e.range))?null:r}getWorkspaceByDescriptor(e){let r=this.tryWorkspaceByDescriptor(e);if(r===null)throw new Error(`Workspace not found (${xi(this.configuration,e)})`);return r}tryWorkspaceByLocator(e){let r=this.tryWorkspaceByIdent(e);return r===null||(kf(e)&&(e=Ww(e)),r.anchoredLocator.locatorHash!==e.locatorHash)?null:r}getWorkspaceByLocator(e){let r=this.tryWorkspaceByLocator(e);if(!r)throw new Error(`Workspace not found (${hn(this.configuration,e)})`);return r}deleteDescriptor(e){this.storedResolutions.delete(e),this.storedDescriptors.delete(e)}deleteLocator(e){this.originalPackages.delete(e),this.storedPackages.delete(e),this.accessibleLocators.delete(e)}forgetResolution(e){if("descriptorHash"in e){let r=this.storedResolutions.get(e.descriptorHash);this.deleteDescriptor(e.descriptorHash);let s=new Set(this.storedResolutions.values());typeof r<"u"&&!s.has(r)&&this.deleteLocator(r)}if("locatorHash"in e){this.deleteLocator(e.locatorHash);for(let[r,s]of this.storedResolutions)s===e.locatorHash&&this.deleteDescriptor(r)}}forgetTransientResolutions(){let e=this.configuration.makeResolver(),r=new Map;for(let[s,a]of this.storedResolutions.entries()){let n=r.get(a);n||r.set(a,n=new Set),n.add(s)}for(let s of this.originalPackages.values()){let a;try{a=e.shouldPersistResolution(s,{project:this,resolver:e})}catch{a=!1}if(!a){this.deleteLocator(s.locatorHash);let n=r.get(s.locatorHash);if(n){r.delete(s.locatorHash);for(let l of n)this.deleteDescriptor(l)}}}}forgetVirtualResolutions(){for(let e of this.storedPackages.values())for(let[r,s]of e.dependencies)NLine truncated
`;switch(rt.type){case 0:Ne+=`# Script name: ${rt.script}
`;break;case 1:Ne+=`# Script code: ${rt.script}
`;break}let Fe=null;if(!await fe.mktempPromise(async He=>{let Qe=Y.join(He,"build.log"),{stdout:ft,stderr:Me}=this.configuration.getSubprocessStreams(Qe,{header:Ne,prefix:hn(this.configuration,$),report:r}),x;try{switch(rt.type){case 0:x=await GN($,rt.script,[],{cwd:j,project:this,stdin:Fe,stdout:ft,stderr:Me});break;case 1:x=await t7($,rt.script,[],{cwd:j,project:this,stdin:Fe,stdout:ft,stderr:Me});break}}catch(E){Me.write(E.stack),x=1}if(ft.end(),Me.end(),x===0)return!0;fe.detachTemp(He);let C=`${hn(this.configuration,$)} couldn't be built successfully (exit code ${or(this.configuration,x,Ct.NUMBER)}, logs can be found here: ${or(this.configuration,Qe,Ct.PATH)})`,P=this.optionalBuilds.has($.locatorHash);return P?r.reportInfo(9,C):r.reportError(9,C),PIe&&r.reportFold(me.fromPortablePath(Qe),fe.readFileSync(Qe,"utf8")),P}))return!1}return!0});Ee.push(...ot,Promise.allSettled(ot).then(j=>{te.delete(he),j.every(rt=>rt.status==="fulfilled"&&rt.value===!0)&&we.set($.locatorHash,Te)}))}if(await bf(Ee),Ce===te.size){let he=Array.from(te).map($=>{let De=this.storedPackages.get($);if(!De)throw new Error("Assertion failed: The package should have been registered");return hn(this.configuration,De)}).join(", ");r.reportError(3,`Some packages have circular dependencies that make their build order unsatisfiable - as a result they won't be built (affected packages are: ${he})`);break}}this.storedBuildState=we,this.skippedBuilds=N}async installWithNewReport(e,r){return(await Wt.start({configuration:this.configuration,json:e.json,stdout:e.stdout,forceSectionAlignment:!0,includeLogs:!e.json&&!e.quiet,includeVersion:!0},async a=>{await this.install({...r,report:a})})).exitCode()}async install(e){let r=this.configuration.get("nodeLinker");$e.telemetry?.reportInstall(r);let s=!1;if(await e.report.startTimerPromise("Project validation",{skipIfEmpty:!0},async()=>{this.configuration.get("enableOfflineMode")&&e.report.reportWarning(90,"Offline work is enabled; Yarn won't fetch packages from the remote registry if it can avoid it"),await this.configuration.triggerHook(m=>m.validateProject,this,{reportWarning:(m,w)=>{e.report.reportWarning(m,w)},reportError:(m,w)=>{e.report.reportError(m,w),s=!0}})}),s)return;let a=await this.configuration.getPackageExtensions();for(let m of a.values())for(let[,w]of m)for(let v of w)v.status="inactive";let n=Y.join(this.cwd,Or.lockfile),l=null;if(e.immutable)try{l=await fe.readFilePromise(n,"utf8")}catch(m){throw m.code==="ENOENT"?new Zt(28,"The lockfile would have been created by this install, which is explicitly forbidden."):m}await e.report.startTimerPromise("Resolution step",async()=>{await this.resolveEverything(e)}),await e.report.startTimerPromise("Post-resolution validation",{skipIfEmpty:!0},async()=>{N0t(this,e.report);for(let[,m]of a)for(let[,w]of m)for(let v of w)if(v.userProvided){let D=or(this.configuration,v,Ct.PACKAGE_EXTENSION);switch(v.status){case"inactive":e.report.reportWarning(68,`${D}: No matching package in the dependency tree; you may not need this rule anymore.`);break;case"redundant":e.report.reportWarning(69,`${D}: This rule seems redundant when applied on the original package; the extension may have been applied upstream.`);break}}if(l!==null){let m=ty(l,this.generateLockfile());if(m!==l){let w=dCe(n,n,l,m,void 0,void 0,{maxEditLength:100});if(w){e.report.reportSeparator();for(let v of w.hunks){e.report.reportInfo(null,`@@ -${v.oldStart},${v.oldLines} +${v.newStart},${v.newLines} @@`);for(let D of v.lines)D.startsWith("+")?e.report.reportError(28,or(this.configuration,D,Ct.ADDED)):D.startsWith("-")?e.report.reportError(28,or(this.configuration,D,Ct.REMOVED)):e.report.reportInfo(null,or(this.configuration,D,"grey"))}e.report.reportSeparator()}throw new Zt(28,"The lockfile would have been modified by this install, which is explicitly forbidden.")}}});for(let m of a.values())for(let[,w]of m)for(let v of w)v.userProvided&&v.status==="active"&&$e.telemetry?.reportPackageExtension(Cy(v,Ct.PACKAGE_EXTENSION));await e.report.startTimerPromise("Fetch step",async()=>{await this.fetchEverything(e)});let f=e.immutable?[...new Set(this.configuration.get("immutablePatterns"))].sort():[],h=await Promise.all(f.map(async m=>TF(m,{cwd:this.cwd})));(typeof e.persistProject>"u"||e.persistProject)&&await this.persist(),await e.report.startTimerPromise("Link step",async()=>{if(e.mode==="update-lockfile"){e.report.reportWarning(73,`Skipped due to ${or(this.configuration,"mode=update-lockfile",Ct.CODE)}`);return}await this.linkEverything(e);let m=await Promise.all(f.map(async w=>TF(w,{cwd:this.cwd})));for(let w=0;w<f.length;++w)h[w]!==m[w]&&e.report.reportError(64,`The checksum for ${f[w]} has been modified by this install, which is explicitly forbidden.`)}),await this.persistInstallStateFile();let A=!1;await e.report.startTimerPromise("Post-install validation",{skipIfEmpty:!0},async()=>{await this.configuration.triggerHook(m=>m.validateProjectAfterInstall,this,{reportWarning:(m,w)=>{e.report.r Line truncated
`,`# Manual changes might be lost - proceed with caution!
`].join("")}
`+Uc(r)}async persistLockfile(){let e=Y.join(this.cwd,Or.lockfile),r="";try{r=await fe.readFilePromise(e,"utf8")}catch{}let s=this.generateLockfile(),a=ty(r,s);a!==r&&(await fe.writeFilePromise(e,a),this.lockFileChecksum=ECe(a),this.lockfileNeedsRefresh=!1)}async persistInstallStateFile(){let e=[];for(let l of Object.values(LV))e.push(...l);let r=Iy(this,e),s=_V.default.serialize(r),a=Os(s);if(this.installStateChecksum===a)return;let n=this.configuration.get("installStatePath");await fe.mkdirPromise(Y.dirname(n),{recursive:!0}),await fe.writeFilePromise(n,await R0t(s)),this.installStateChecksum=a}async restoreInstallState({restoreLinkersCustomData:e=!0,restoreResolutions:r=!0,restoreBuildState:s=!0}={}){let a=this.configuration.get("installStatePath"),n;try{let l=await T0t(await fe.readFilePromise(a));n=_V.default.deserialize(l),this.installStateChecksum=Os(l)}catch{r&&await this.applyLightResolution();return}e&&typeof n.linkersCustomData<"u"&&(this.linkersCustomData=n.linkersCustomData),s&&Object.assign(this,Iy(n,LV.restoreBuildState)),r&&(n.lockFileChecksum===this.lockFileChecksum?Object.assign(this,Iy(n,LV.restoreResolutions)):await this.applyLightResolution())}async applyLightResolution(){await this.resolveEverything({lockfileOnly:!0,report:new rs}),await this.persistInstallStateFile()}async persist(){let e=(0,NO.default)(4);await Promise.all([this.persistLockfile(),...this.workspaces.map(r=>e(()=>r.persistManifest()))])}async cacheCleanup({cache:e,report:r}){if(this.configuration.get("enableGlobalCache"))return null;let s=new Set([".gitignore"]);if(!X9(e.cwd,this.cwd)||!await fe.existsPromise(e.cwd))return null;let a=[];for(let l of await fe.readdirPromise(e.cwd)){if(s.has(l))continue;let f=Y.resolve(e.cwd,l);e.markedFiles.has(f)||(e.immutable?r.reportError(56,`${or(this.configuration,Y.basename(f),"magenta")} appears to be unused and would be marked for deletion, but the cache is immutable`):a.push(fe.lstatPromise(f).then(async h=>(await fe.removePromise(f),h.size))))}if(a.length===0)return null;let n=await Promise.all(a);return{count:a.length,size:n.reduce((l,f)=>l+f,0)}}}});function O0t(t){let s=Math.floor(t.timeNow/864e5),a=t.updateInterval*864e5,n=t.state.lastUpdate??t.timeNow+a+Math.floor(a*t.randomInitialInterval),l=n+a,f=t.state.lastTips??s*864e5,h=f+864e5+8*36e5-t.timeZone,A=l<=t.timeNow,m=h<=t.timeNow,w=null;return(A||m||!t.state.lastUpdate||!t.state.lastTips)&&(w={},w.lastUpdate=A?t.timeNow:n,w.lastTips=f,w.blocks=A?{}:t.state.blocks,w.displayedTips=t.state.displayedTips),{nextState:w,triggerUpdate:A,triggerTips:m,nextTips:m?s*864e5:f}}var kC,CCe=tt(()=>{Mt();Qb();G0();EN();Au();_p();kC=class{constructor(e,r){this.values=new Map;this.hits=new Map;this.enumerators=new Map;this.nextTips=0;this.displayedTips=[];this.shouldCommitTips=!1;this.configuration=e;let s=this.getRegistryPath();this.isNew=!fe.existsSync(s),this.shouldShowTips=!1,this.sendReport(r),this.startBuffer()}commitTips(){this.shouldShowTips&&(this.shouldCommitTips=!0)}selectTip(e){let r=new Set(this.displayedTips),s=f=>f&&Fn?Wh(Fn,f):!1,a=e.map((f,h)=>h).filter(f=>e[f]&&s(e[f]?.selector));if(a.length===0)return null;let n=a.filter(f=>!r.has(f));if(n.length===0){let f=Math.floor(a.length*.2);this.displayedTips=f>0?this.displayedTips.slice(-f):[],n=a.filter(h=>!r.has(h))}let l=n[Math.floor(Math.random()*n.length)];return this.displayedTips.push(l),this.commitTips(),e[l]}reportVersion(e){this.reportValue("version",e.replace(/-git\..*/,"-git"))}reportCommandName(e){this.reportValue("commandName",e||"<none>")}reportPluginName(e){this.reportValue("pluginName",e)}reportProject(e){this.reportEnumerator("projectCount",e)}reportInstall(e){this.reportHit("installCount",e)}reportPackageExtension(e){this.reportValue("packageExtension",e)}reportWorkspaceCount(e){this.reportValue("workspaceCount",String(e))}reportDependencyCount(e){this.reportValue("dependencyCount",String(e))}reportValue(e,r){Tp(this.values,e).add(r)}reportEnumerator(e,r){Tp(this.enumerators,e).add(Os(r))}reportHit(e,r="*"){let s=J5(this.hits,e),a=Rl(s,r,()=>0);s.set(r,a+1)}getRegistryPath(){let e=this.configuration.get("globalFolder");return Y.join(e,"telemetry.json")}sendReport(e){let r=this.getRegistryPath(),s;try{s=fe.readJsonSync(r)}catch{s={}}let{nextState:a,triggerUpdate:n,triggerTips:l,nextTips:f}=O0t({state:s,timeNow:Date.now(),timeZone:new Date().getTimezoneOffset()*60*1e3,randomInitialInterval:Math.random(),updateInterval:this.configuration.get("telemetryInterval")});if(this.nextTips=f,this.displayedTips=s.displayedTips??[],a!==null)try{fe.mkdirSync(Y.dirname(r),{recursive:!0}),fe.writeJsonSync(r,a)}catch{return!1}if(l&&this.configuration.get("enableTips")&&(this.shouldShowTips=!0),n){let h=s.blocks??{};if(Object.keys(h).length===0){let A=`https://browser-http-intake.logs.datadoghq.eu/v1/input/${e}?ddsource=yarn`,m=w=>yq(A,w,{configuration:this.configuration}).catch(()=>{});for(let[w,v]of Object.entries(s.blocks??{})){if(Object.keys(v).length===0)continue;let D=v;D Line truncated
`),A=l.length;for(A>0&&l.includes("unstyle")&&(l=[...new Set(["unstyle",...l])].reverse());A-- >0;)f=r(t.styles[l[A]],f,h);return f},a=(n,l,f)=>{t.styles[n]=e({name:n,codes:l}),(t.keys[f]||(t.keys[f]=[])).push(n),Reflect.defineProperty(t,n,{configurable:!0,enumerable:!0,set(A){t.alias(n,A)},get(){let A=m=>s(m,A.stack);return Reflect.setPrototypeOf(A,t),A.stack=this.stack?this.stack.concat(n):[n],A}})};return a("reset",[0,0],"modifier"),a("bold",[1,22],"modifier"),a("dim",[2,22],"modifier"),a("italic",[3,23],"modifier"),a("underline",[4,24],"modifier"),a("inverse",[7,27],"modifier"),a("hidden",[8,28],"modifier"),a("strikethrough",[9,29],"modifier"),a("black",[30,39],"color"),a("red",[31,39],"color"),a("green",[32,39],"color"),a("yellow",[33,39],"color"),a("blue",[34,39],"color"),a("magenta",[35,39],"color"),a("cyan",[36,39],"color"),a("white",[37,39],"color"),a("gray",[90,39],"color"),a("grey",[90,39],"color"),a("bgBlack",[40,49],"bg"),a("bgRed",[41,49],"bg"),a("bgGreen",[42,49],"bg"),a("bgYellow",[43,49],"bg"),a("bgBlue",[44,49],"bg"),a("bgMagenta",[45,49],"bg"),a("bgCyan",[46,49],"bg"),a("bgWhite",[47,49],"bg"),a("blackBright",[90,39],"bright"),a("redBright",[91,39],"bright"),a("greenBright",[92,39],"bright"),a("yellowBright",[93,39],"bright"),a("blueBright",[94,39],"bright"),a("magentaBright",[95,39],"bright"),a("cyanBright",[96,39],"bright"),a("whiteBright",[97,39],"bright"),a("bgBlackBright",[100,49],"bgBright"),a("bgRedBright",[101,49],"bgBright"),a("bgGreenBright",[102,49],"bgBright"),a("bgYellowBright",[103,49],"bgBright"),a("bgBlueBright",[104,49],"bgBright"),a("bgMagentaBright",[105,49],"bgBright"),a("bgCyanBright",[106,49],"bgBright"),a("bgWhiteBright",[107,49],"bgBright"),t.ansiRegex=H0t,t.hasColor=t.hasAnsi=n=>(t.ansiRegex.lastIndex=0,typeof n=="string"&&n!==""&&t.ansiRegex.test(n)),t.alias=(n,l)=>{let f=typeof l=="string"?t[l]:l;if(typeof f!="function")throw new TypeError("Expected alias to be the name of an existing color (string) or a function");f.stack||(Reflect.defineProperty(f,"name",{value:n}),t.styles[n]=f,f.stack=[n]),Reflect.defineProperty(t,n,{configurable:!0,enumerable:!0,set(h){t.alias(n,h)},get(){let h=A=>s(A,h.stack);return Reflect.setPrototypeOf(h,t),h.stack=this.stack?this.stack.concat(f.stack):f.stack,h}})},t.theme=n=>{if(!U0t(n))throw new TypeError("Expected theme to be an object");for(let l of Object.keys(n))t.alias(l,n[l]);return t},t.alias("unstyle",n=>typeof n=="string"&&n!==""?(t.ansiRegex.lastIndex=0,n.replace(t.ansiRegex,"")):""),t.alias("noop",n=>n),t.none=t.clear=t.noop,t.stripColor=t.unstyle,t.symbols=PCe(),t.define=a,t};jV.exports=xCe();jV.exports.create=xCe});var va=H(On=>{"use strict";var j0t=Object.prototype.toString,vu=Mf(),kCe=!1,GV=[],RCe={yellow:"blue",cyan:"red",green:"magenta",black:"white",blue:"yellow",red:"cyan",magenta:"green",white:"black"};On.longest=(t,e)=>t.reduce((r,s)=>Math.max(r,e?s[e].length:s.length),0);On.hasColor=t=>!!t&&vu.hasColor(t);var MO=On.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);On.nativeType=t=>j0t.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"");On.isAsyncFn=t=>On.nativeType(t)==="asyncfunction";On.isPrimitive=t=>t!=null&&typeof t!="object"&&typeof t!="function";On.resolve=(t,e,...r)=>typeof e=="function"?e.call(t,...r):e;On.scrollDown=(t=[])=>[...t.slice(1),t[0]];On.scrollUp=(t=[])=>[t.pop(),...t];On.reorder=(t=[])=>{let e=t.slice();return e.sort((r,s)=>r.index>s.index?1:r.index<s.index?-1:0),e};On.swap=(t,e,r)=>{let s=t.length,a=r===s?0:r<0?s-1:r,n=t[e];t[e]=t[a],t[a]=n};On.width=(t,e=80)=>{let r=t&&t.columns?t.columns:e;return t&&typeof t.getWindowSize=="function"&&(r=t.getWindowSize()[0]),process.platform==="win32"?r-1:r};On.height=(t,e=20)=>{let r=t&&t.rows?t.rows:e;return t&&typeof t.getWindowSize=="function"&&(r=t.getWindowSize()[1]),r};On.wordWrap=(t,e={})=>{if(!t)return t;typeof e=="number"&&(e={width:e});let{indent:r="",newline:s=`
`+r,width:a=80}=e,n=(s+r).match(/[^\S\n]/g)||[];a-=n.length;let l=`.{1,${a}}([\\s\\u200B]+|$)|[^\\s\\u200B]+?([\\s\\u200B]+|$)`,f=t.trim(),h=new RegExp(l,"g"),A=f.match(h)||[];return A=A.map(m=>m.replace(/\n$/,"")),e.padEnd&&(A=A.map(m=>m.padEnd(a," "))),e.padStart&&(A=A.map(m=>m.padStart(a," "))),r+A.join(s)};On.unmute=t=>{let e=t.stack.find(s=>vu.keys.color.includes(s));return e?vu[e]:t.stack.find(s=>s.slice(2)==="bg")?vu[e.slice(2)]:s=>s};On.pascal=t=>t?t[0].toUpperCase()+t.slice(1):"";On.inverse=t=>{if(!t||!t.stack)return t;let e=t.stack.find(s=>vu.keys.color.includes(s));if(e){let s=vu["bg"+On.pascal(e)];return s?s.black:t}let r=t.stack.find(s=>s.slice(0,2)==="bg");return r?vu[r.slice(2).toLowerCase()]||t:vu.none};On.complement=t=>{if(!t||!t.stack)return t;let e=t.stack.find(s=>vu.keys.color.includes(s)),r=t.stack.find(s=>s.slice(0,2)==="bg");if(e&&!r)return vu[RCe[e]||e];if(r){let s=r.slice(2).toLowerCase(),a=RCe[s];return a&&vu["bg"+On.pascal(a)]||t}return vu.none};On.meridiem=t=>{let e=t.getHours(),r=t.getMinutes(),s=e>=12?"pm":"am";e=e%12;let a=e===0?12:e,n=r<10?"0"+r:r;return a+":"+n+" "+s};On.set=(t={},e="",r)=>e.split(".").reduce((s,a,n,l)=>{let f=l.length-1>n?s[a]||{}:r;return!On.isObject(f)&&n<l.length-1&&(f={}),s[a]=f},t);On.get=(t={},e="",r)=>{let s=t[e]==null?e.split(".").reduce((a,n)=>a&&a[n],t):t[e];return s??r};On.mixin=(t,e)=>{if(!MO(t))return e;if(!MO(e))return t;for(let r of Object.keys(e)){let s=Object.getOwnPropertyDescriptor(e,r);if(s.hasOwnProperty("value"))if(t.hasOwnProperty(r)&&MO(s.value)){let a=Object.getOwnPropertyDescriptor(t,r);MO(a.value)?t[r]=On.merge({},t[r],e[r]):Reflect.defineProperty(t,r,s)}else Reflect.defineProperty(t,r,s);else Reflect.defineProperty(t,r,s)}return t};On.merge=(...t)=>{let e={};for(let r of t)On.mixin(e,r);return e};On.mixinEmitter=(t,e)=>{let r=e.constructor.prototype;for(let s of Object.keys(r)){let a=r[s];typeof a=="function"?On.define(t,s,a.bind(e)):On.define(t,s,a)}};On.onExit=t=>{let e=(r,s)=>{kCe||(kCe=!0,GV.forEach(a=>a()),r===!0&&process.exit(128+s))};GV.length===0&&(process.once("SIGTERM",e.bind(null,!0,15)),process.once("SIGINT",e.bind(null,!0,2)),process.once("exit",e)),GV.push(t)};On.define=(t,e,r)=>{Reflect.defineProperty(t,e,{value:r})};On.defineExport=(t,e,r)=>{let s;Reflect.defineProperty(t,e,{enumerable:!0,configurable:!0,set(a){s=a},get(){return s?s():r()}})}});var TCe=H(FC=>{"use strict";FC.ctrl={a:"first",b:"backward",c:"cancel",d:"deleteForward",e:"last",f:"forward",g:"reset",i:"tab",k:"cutForward",l:"reset",n:"newItem",m:"cancel",j:"submit",p:"search",r:"remove",s:"save",u:"undo",w:"cutLeft",x:"toggleCursor",v:"paste"};FC.shift={up:"shiftUp",down:"shiftDown",left:"shiftLeft",right:"shiftRight",tab:"prev"};FC.fn={up:"pageUp",down:"pageDown",left:"pageLeft",right:"pageRight",delete:"deleteForward"};FC.option={b:"backward",f:"forward",d:"cutRight",left:"cutLeft",up:"altUp",down:"altDown"};FC.keys={pageup:"pageUp",pagedown:"pageDown",home:"home",end:"end",cancel:"cancel",delete:"deleteForward",backspace:"delete",down:"down",enter:"submit",escape:"cancel",left:"left",space:"space",number:"number",return:"submit",right:"right",tab:"next",up:"up"}});var NCe=H((krr,FCe)=>{"use strict";var QCe=Ae("readline"),G0t=TCe(),q0t=/^(?:\x1b)([a-zA-Z0-9])$/,V0t=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,W0t={OP:"f1",OQ:"f2",OR:"f3",OS:"f4","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"};function Y0t(t){return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(t)}function K0t(t){return["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(t)}var UO=(t="",e={})=>{let r,s={name:e.name,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:t,raw:t,...e};if(Buffer.isBuffer(t)?t[0]>127&&t[1]===void 0?(t[0]-=128,t="\x1B"+String(t)):t=String(t):t!==void 0&&typeof t!="string"?t=String(t):t||(t=s.sequence||""),s.sequence=s.sequence||t||s.name,t==="\r")s.raw=void 0,s.name="return";else if(t===`
`)s.name="enter";else if(t===" ")s.name="tab";else if(t==="\b"||t==="\x7F"||t==="\x1B\x7F"||t==="\x1B\b")s.name="backspace",s.meta=t.charAt(0)==="\x1B";else if(t==="\x1B"||t==="\x1B\x1B")s.name="escape",s.meta=t.length===2;else if(t===" "||t==="\x1B ")s.name="space",s.meta=t.length===2;else if(t<="")s.name=String.fromCharCode(t.charCodeAt(0)+97-1),s.ctrl=!0;else if(t.length===1&&t>="0"&&t<="9")s.name="number";else if(t.length===1&&t>="a"&&t<="z")s.name=t;else if(t.length===1&&t>="A"&&t<="Z")s.name=t.toLowerCase(),s.shift=!0;else if(r=q0t.exec(t))s.meta=!0,s.shift=/^[A-Z]$/.test(r[1]);else if(r=V0t.exec(t)){let a=[...t];a[0]==="\x1B"&&a[1]==="\x1B"&&(s.option=!0);let n=[r[1],r[2],r[4],r[6]].filter(Boolean).join(""),l=(r[3]||r[5]||1)-1;s.ctrl=!!(l&4),s.meta=!!(l&10),s.shift=!!(l&1),s.code=n,s.name=W0t[n],s.shift=Y0t(n)||s.shift,s.ctrl=K0t(n)||s.ctrl}return s};UO.listen=(t={},e)=>{let{stdin:r}=t;if(!r||r!==process.stdin&&!r.isTTY)throw new Error("Invalid stream passed");let s=QCe.createInterface({terminal:!0,input:r});QCe.emitKeypressEvents(r,s);let a=(f,h)=>e(f,UO(f,h),s),n=r.isRaw;return r.isTTY&&r.setRawMode(!0),r.on("keypress",a),s.resume(),()=>{r.isTTY&&r.setRawMode(n),r.removeListener("keypress",a),s.pause(),s.close()}};UO.action=(t,e,r)=>{let s={...G0t,...r};return e.ctrl?(e.action=s.ctrl[e.name],e):e.option&&s.option?(e.action=s.option[e.name],e):e.shift?(e.action=s.shift[e.name],e):(e.action=s.keys[e.name],e)};FCe.exports=UO});var LCe=H((Rrr,OCe)=>{"use strict";OCe.exports=t=>{t.timers=t.timers||{};let e=t.options.timers;if(e)for(let r of Object.keys(e)){let s=e[r];typeof s=="number"&&(s={interval:s}),z0t(t,r,s)}};function z0t(t,e,r={}){let s=t.timers[e]={name:e,start:Date.now(),ms:0,tick:0},a=r.interval||120;s.frames=r.frames||[],s.loading=!0;let n=setInterval(()=>{s.ms=Date.now()-s.start,s.tick++,t.render()},a);return s.stop=()=>{s.loading=!1,clearInterval(n)},Reflect.defineProperty(s,"interval",{value:n}),t.once("close",()=>s.stop()),s.stop}});var MCe=H((Trr,_Ce)=>{"use strict";var{define:J0t,width:Z0t}=va(),qV=class{constructor(e){let r=e.options;J0t(this,"_prompt",e),this.type=e.type,this.name=e.name,this.message="",this.header="",this.footer="",this.error="",this.hint="",this.input="",this.cursor=0,this.index=0,this.lines=0,this.tick=0,this.prompt="",this.buffer="",this.width=Z0t(r.stdout||process.stdout),Object.assign(this,r),this.name=this.name||this.message,this.message=this.message||this.name,this.symbols=e.symbols,this.styles=e.styles,this.required=new Set,this.cancelled=!1,this.submitted=!1}clone(){let e={...this};return e.status=this.status,e.buffer=Buffer.from(e.buffer),delete e.clone,e}set color(e){this._color=e}get color(){let e=this.prompt.styles;if(this.cancelled)return e.cancelled;if(this.submitted)return e.submitted;let r=this._color||e[this.status];return typeof r=="function"?r:e.pending}set loading(e){this._loading=e}get loading(){return typeof this._loading=="boolean"?this._loading:this.loadingChoices?"choices":!1}get status(){return this.cancelled?"cancelled":this.submitted?"submitted":"pending"}};_Ce.exports=qV});var HCe=H((Qrr,UCe)=>{"use strict";var VV=va(),qo=Mf(),WV={default:qo.noop,noop:qo.noop,set inverse(t){this._inverse=t},get inverse(){return this._inverse||VV.inverse(this.primary)},set complement(t){this._complement=t},get complement(){return this._complement||VV.complement(this.primary)},primary:qo.cyan,success:qo.green,danger:qo.magenta,strong:qo.bold,warning:qo.yellow,muted:qo.dim,disabled:qo.gray,dark:qo.dim.gray,underline:qo.underline,set info(t){this._info=t},get info(){return this._info||this.primary},set em(t){this._em=t},get em(){return this._em||this.primary.underline},set heading(t){this._heading=t},get heading(){return this._heading||this.muted.underline},set pending(t){this._pending=t},get pending(){return this._pending||this.primary},set submitted(t){this._submitted=t},get submitted(){return this._submitted||this.success},set cancelled(t){this._cancelled=t},get cancelled(){return this._cancelled||this.danger},set typing(t){this._typing=t},get typing(){return this._typing||this.dim},set placeholder(t){this._placeholder=t},get placeholder(){return this._placeholder||this.primary.dim},set highlight(t){this._highlight=t},get highlight(){return this._highlight||this.inverse}};WV.merge=(t={})=>{t.styles&&typeof t.styles.enabled=="boolean"&&(qo.enabled=t.styles.enabled),t.styles&&typeof t.styles.visible=="boolean"&&(qo.visible=t.styles.visible);let e=VV.merge({},WV,t.styles);delete e.merge;for(let r of Object.keys(qo))e.hasOwnProperty(r)||Reflect.defineProperty(e,r,{get:()=>qo[r]});for(let r of Object.keys(qo.styles))e.hasOwnProperty(r)||Reflect.defineProperty(e,r,{get:()=>qo[r]});return e};UCe.exports=WV});var GCe=H((Frr,jCe)=>{"use strict";var YV=process.platform==="win32",Xp=Mf(),X0t=va(),KV={...Xp.symbols,upDownDoubleArrow:"\u21D5",upDownDoubleArrow2:"\u2B0D",upDownArrow:"\u2195",asterisk:"*",asterism:"\u2042",bulletWhite:"\u25E6",electricArrow:"\u2301", Line truncated
`),A=h[0],m=h[h.length-1],v=(s+(r?" "+r:"")).length,D=v<A.length?A.slice(v+1):"";return{header:l,prompt:A,after:D,rest:h.slice(1),last:m}}async submit(){this.state.submitted=!0,this.state.validating=!0,this.options.onSubmit&&await this.options.onSubmit.call(this,this.name,this.value,this);let e=this.state.error||await this.validate(this.value,this.state);if(e!==!0){let r=`
`+this.symbols.pointer+" ";typeof e=="string"?r+=e.trim():r+="Invalid input",this.state.error=`
`+this.styles.danger(r),this.state.submitted=!1,await this.render(),await this.alert(),this.state.validating=!1,this.state.error=void 0;return}this.state.validating=!1,await this.render(),await this.close(),this.value=await this.result(this.value),this.emit("submit",this.value)}async cancel(e){this.state.cancelled=this.state.submitted=!0,await this.render(),await this.close(),typeof this.options.onCancel=="function"&&await this.options.onCancel.call(this,this.name,this.value,this),this.emit("cancel",await this.error(e))}async close(){this.state.closed=!0;try{let e=this.sections(),r=Math.ceil(e.prompt.length/this.width);e.rest&&this.write($y.cursor.down(e.rest.length)),this.write(`
`.repeat(r))}catch{}this.emit("close")}start(){!this.stop&&this.options.show!==!1&&(this.stop=XV.listen(this,this.keypress.bind(this)),this.once("close",this.stop))}async skip(){return this.skipped=this.options.skip===!0,typeof this.options.skip=="function"&&(this.skipped=await this.options.skip.call(this,this.name,this.value)),this.skipped}async initialize(){let{format:e,options:r,result:s}=this;if(this.format=()=>e.call(this,this.value),this.result=()=>s.call(this,this.value),typeof r.initial=="function"&&(this.initial=await r.initial.call(this,this)),typeof r.onRun=="function"&&await r.onRun.call(this,this),typeof r.onSubmit=="function"){let a=r.onSubmit.bind(this),n=this.submit.bind(this);delete this.options.onSubmit,this.submit=async()=>(await a(this.name,this.value,this),n())}await this.start(),await this.render()}render(){throw new Error("expected prompt to have a custom render method")}run(){return new Promise(async(e,r)=>{if(this.once("submit",e),this.once("cancel",r),await this.skip())return this.render=()=>{},this.submit();await this.initialize(),this.emit("run")})}async element(e,r,s){let{options:a,state:n,symbols:l,timers:f}=this,h=f&&f[e];n.timer=h;let A=a[e]||n[e]||l[e],m=r&&r[e]!=null?r[e]:await A;if(m==="")return m;let w=await this.resolve(m,n,r,s);return!w&&r&&r[e]?this.resolve(A,n,r,s):w}async prefix(){let e=await this.element("prefix")||this.symbols,r=this.timers&&this.timers.prefix,s=this.state;return s.timer=r,Kc.isObject(e)&&(e=e[s.status]||e.pending),Kc.hasColor(e)?e:(this.styles[s.status]||this.styles.pending)(e)}async message(){let e=await this.element("message");return Kc.hasColor(e)?e:this.styles.strong(e)}async separator(){let e=await this.element("separator")||this.symbols,r=this.timers&&this.timers.separator,s=this.state;s.timer=r;let a=e[s.status]||e.pending||s.separator,n=await this.resolve(a,s);return Kc.isObject(n)&&(n=n[s.status]||n.pending),Kc.hasColor(n)?n:this.styles.muted(n)}async pointer(e,r){let s=await this.element("pointer",e,r);if(typeof s=="string"&&Kc.hasColor(s))return s;if(s){let a=this.styles,n=this.index===r,l=n?a.primary:A=>A,f=await this.resolve(s[n?"on":"off"]||s,this.state),h=Kc.hasColor(f)?f:l(f);return n?h:" ".repeat(f.length)}}async indicator(e,r){let s=await this.element("indicator",e,r);if(typeof s=="string"&&Kc.hasColor(s))return s;if(s){let a=this.styles,n=e.enabled===!0,l=n?a.success:a.dark,f=s[n?"on":"off"]||s;return Kc.hasColor(f)?f:l(f)}return""}body(){return null}footer(){if(this.state.status==="pending")return this.element("footer")}header(){if(this.state.status==="pending")return this.element("header")}async hint(){if(this.state.status==="pending"&&!this.isValue(this.state.input)){let e=await this.element("hint");return Kc.hasColor(e)?e:this.styles.muted(e)}}error(e){return this.state.submitted?"":e||this.state.error}format(e){return e}result(e){return e}validate(e){return this.options.required===!0?this.isValue(e):!0}isValue(e){return e!=null&&e!==""}resolve(e,...r){return Kc.resolve(this,e,...r)}get base(){return t.prototype}get style(){return this.styles[this.state.status]}get height(){return this.options.rows||Kc.height(this.stdout,25)}get width(){return this.options.columns||Kc.width(this.stdout,80)}get size(){return{width:this.width,height:this.height}}set cursor(e){this.state.cursor=e}get cursor(){return this.state.cursor}set input(e){this.state.input=e}get input(){return this.state.input}set value(e){this.state.value=e}get value(){let{input:e,value:r}=this.state,s=[r,e].find(this.isValue.bind(this));return this.isValue(s)?s:this.initial}static get prompt(){return e=>new this(e).run()}};function agt(t){let e=a=>t[a]===void 0||typeof t[a]=="function",r=["actions","choices","initial","margin","roles","styles","symbols","theme","timers","value"],s=["body","footer","error","header","hint","indicator","message","prefix","separator","skip"];for(let a of Object.keys(t.options)){if(r.includes(a)||/^on[A-Z]/.test(a))continue;let n=t.options[a];typeof n=="function"&&e(a)?s.includes(a)||(t[a]=n.bind(t)):typeof t[a]!="function"&&(t[a]=n)}}function cgt(t){typeof t=="number"&&(t=[t,t,t,t]);let e=[].concat(t||[]),r=a=>a%2===0?`
`:" ",s=[];for(let a=0;a<4;a++){let n=r(a);e[a]?s.push(n.repeat(e[a])):s.push("")}return s}XCe.exports=$V});var t1e=H((Lrr,e1e)=>{"use strict";var lgt=va(),$Ce={default(t,e){return e},checkbox(t,e){throw new Error("checkbox role is not implemented yet")},editable(t,e){throw new Error("editable role is not implemented yet")},expandable(t,e){throw new Error("expandable role is not implemented yet")},heading(t,e){return e.disabled="",e.indicator=[e.indicator," "].find(r=>r!=null),e.message=e.message||"",e},input(t,e){throw new Error("input role is not implemented yet")},option(t,e){return $Ce.default(t,e)},radio(t,e){throw new Error("radio role is not implemented yet")},separator(t,e){return e.disabled="",e.indicator=[e.indicator," "].find(r=>r!=null),e.message=e.message||t.symbols.line.repeat(5),e},spacer(t,e){return e}};e1e.exports=(t,e={})=>{let r=lgt.merge({},$Ce,e.roles);return r[t]||r.default}});var pD=H((_rr,i1e)=>{"use strict";var ugt=Mf(),fgt=NC(),hgt=t1e(),HO=va(),{reorder:eW,scrollUp:Agt,scrollDown:pgt,isObject:r1e,swap:dgt}=HO,tW=class extends fgt{constructor(e){super(e),this.cursorHide(),this.maxSelected=e.maxSelected||1/0,this.multiple=e.multiple||!1,this.initial=e.initial||0,this.delay=e.delay||0,this.longest=0,this.num=""}async initialize(){typeof this.options.initial=="function"&&(this.initial=await this.options.initial.call(this)),await this.reset(!0),await super.initialize()}async reset(){let{choices:e,initial:r,autofocus:s,suggest:a}=this.options;if(this.state._choices=[],this.state.choices=[],this.choices=await Promise.all(await this.toChoices(e)),this.choices.forEach(n=>n.enabled=!1),typeof a!="function"&&this.selectable.length===0)throw new Error("At least one choice must be selectable");r1e(r)&&(r=Object.keys(r)),Array.isArray(r)?(s!=null&&(this.index=this.findIndex(s)),r.forEach(n=>this.enable(this.find(n))),await this.render()):(s!=null&&(r=s),typeof r=="string"&&(r=this.findIndex(r)),typeof r=="number"&&r>-1&&(this.index=Math.max(0,Math.min(r,this.choices.length)),this.enable(this.find(this.index)))),this.isDisabled(this.focused)&&await this.down()}async toChoices(e,r){this.state.loadingChoices=!0;let s=[],a=0,n=async(l,f)=>{typeof l=="function"&&(l=await l.call(this)),l instanceof Promise&&(l=await l);for(let h=0;h<l.length;h++){let A=l[h]=await this.toChoice(l[h],a++,f);s.push(A),A.choices&&await n(A.choices,A)}return s};return n(e,r).then(l=>(this.state.loadingChoices=!1,l))}async toChoice(e,r,s){if(typeof e=="function"&&(e=await e.call(this,this)),e instanceof Promise&&(e=await e),typeof e=="string"&&(e={name:e}),e.normalized)return e;e.normalized=!0;let a=e.value;if(e=hgt(e.role,this.options)(this,e),typeof e.disabled=="string"&&!e.hint&&(e.hint=e.disabled,e.disabled=!0),e.disabled===!0&&e.hint==null&&(e.hint="(disabled)"),e.index!=null)return e;e.name=e.name||e.key||e.title||e.value||e.message,e.message=e.message||e.name||"",e.value=[e.value,e.name].find(this.isValue.bind(this)),e.input="",e.index=r,e.cursor=0,HO.define(e,"parent",s),e.level=s?s.level+1:1,e.indent==null&&(e.indent=s?s.indent+" ":e.indent||""),e.path=s?s.path+"."+e.name:e.name,e.enabled=!!(this.multiple&&!this.isDisabled(e)&&(e.enabled||this.isSelected(e))),this.isDisabled(e)||(this.longest=Math.max(this.longest,ugt.unstyle(e.message).length));let l={...e};return e.reset=(f=l.input,h=l.value)=>{for(let A of Object.keys(l))e[A]=l[A];e.input=f,e.value=h},a==null&&typeof e.initial=="function"&&(e.input=await e.initial.call(this,this.state,e,r)),e}async onChoice(e,r){this.emit("choice",e,r,this),typeof e.onChoice=="function"&&await e.onChoice.call(this,this.state,e,r)}async addChoice(e,r,s){let a=await this.toChoice(e,r,s);return this.choices.push(a),this.index=this.choices.length-1,this.limit=this.choices.length,a}async newItem(e,r,s){let a={name:"New choice name?",editable:!0,newChoice:!0,...e},n=await this.addChoice(a,r,s);return n.updateChoice=()=>{delete n.newChoice,n.name=n.message=n.input,n.input="",n.cursor=0},this.render()}indent(e){return e.indent==null?e.level>1?" ".repeat(e.level-1):"":e.indent}dispatch(e,r){if(this.multiple&&this[r.name])return this[r.name]();this.alert()}focus(e,r){return typeof r!="boolean"&&(r=e.enabled),r&&!e.enabled&&this.selected.length>=this.maxSelected?this.alert():(this.index=e.index,e.enabled=r&&!this.isDisabled(e),e)}space(){return this.multiple?(this.toggle(this.focused),this.render()):this.alert()}a(){if(this.maxSelected<this.choices.length)return this.alert();let e=this.selectable.every(r=>r.enabled);return this.choices.forEach(r=>r.enabled=!e),this.render()}i(){return this.choices.length-this.selected.length>this.maxSelected?this.alert():(this.choices.forEach(e=>e.enabled=!e.enabled),this.render())}g(e=this.focused){return this.choices.some(r=>!!r.parent)?(this.toggle(e.parent&&!e.choices?e.parent:e),this.render()):this.a()}toggle(e,r){if(!e.enabled&&this.selected.length>=this.maxSelected)return this.alert();typeof r!="boolean"&&(r=!e.enabled),e.enabled=r,e.choices&&e. Line truncated
`),a;return this.options.choicesHeader&&(a=await this.resolve(this.options.choicesHeader,this.state)),[a,s].filter(Boolean).join(`
`)}format(){return!this.state.submitted||this.state.cancelled?"":Array.isArray(this.selected)?this.selected.map(e=>this.styles.primary(e.name)).join(", "):this.styles.primary(this.selected.name)}async render(){let{submitted:e,size:r}=this.state,s="",a=await this.header(),n=await this.prefix(),l=await this.separator(),f=await this.message();this.options.promptLine!==!1&&(s=[n,f,l,""].join(" "),this.state.prompt=s);let h=await this.format(),A=await this.error()||await this.hint(),m=await this.renderChoices(),w=await this.footer();h&&(s+=h),A&&!s.includes(A)&&(s+=" "+A),e&&!h&&!m.trim()&&this.multiple&&this.emptyError!=null&&(s+=this.styles.danger(this.emptyError)),this.clear(r),this.write([a,s,m,w].filter(Boolean).join(`
`)),this.write(this.margin[2]),this.restore()}};s1e.exports=nW});var a1e=H((Urr,o1e)=>{"use strict";var mgt=hg(),ygt=(t,e)=>{let r=t.toLowerCase();return s=>{let n=s.toLowerCase().indexOf(r),l=e(s.slice(n,n+r.length));return n>=0?s.slice(0,n)+l+s.slice(n+r.length):s}},iW=class extends mgt{constructor(e){super(e),this.cursorShow()}moveCursor(e){this.state.cursor+=e}dispatch(e){return this.append(e)}space(e){return this.options.multiple?super.space(e):this.append(e)}append(e){let{cursor:r,input:s}=this.state;return this.input=s.slice(0,r)+e+s.slice(r),this.moveCursor(1),this.complete()}delete(){let{cursor:e,input:r}=this.state;return r?(this.input=r.slice(0,e-1)+r.slice(e),this.moveCursor(-1),this.complete()):this.alert()}deleteForward(){let{cursor:e,input:r}=this.state;return r[e]===void 0?this.alert():(this.input=`${r}`.slice(0,e)+`${r}`.slice(e+1),this.complete())}number(e){return this.append(e)}async complete(){this.completing=!0,this.choices=await this.suggest(this.input,this.state._choices),this.state.limit=void 0,this.index=Math.min(Math.max(this.visible.length-1,0),this.index),await this.render(),this.completing=!1}suggest(e=this.input,r=this.state._choices){if(typeof this.options.suggest=="function")return this.options.suggest.call(this,e,r);let s=e.toLowerCase();return r.filter(a=>a.message.toLowerCase().includes(s))}pointer(){return""}format(){if(!this.focused)return this.input;if(this.options.multiple&&this.state.submitted)return this.selected.map(e=>this.styles.primary(e.message)).join(", ");if(this.state.submitted){let e=this.value=this.input=this.focused.value;return this.styles.primary(e)}return this.input}async render(){if(this.state.status!=="pending")return super.render();let e=this.options.highlight?this.options.highlight.bind(this):this.styles.placeholder,r=ygt(this.input,e),s=this.choices;this.choices=s.map(a=>({...a,message:r(a.message)})),await super.render(),this.choices=s}submit(){return this.options.multiple&&(this.value=this.selected.map(e=>e.name)),super.submit()}};o1e.exports=iW});var oW=H((Hrr,c1e)=>{"use strict";var sW=va();c1e.exports=(t,e={})=>{t.cursorHide();let{input:r="",initial:s="",pos:a,showCursor:n=!0,color:l}=e,f=l||t.styles.placeholder,h=sW.inverse(t.styles.primary),A=R=>h(t.styles.black(R)),m=r,w=" ",v=A(w);if(t.blink&&t.blink.off===!0&&(A=R=>R,v=""),n&&a===0&&s===""&&r==="")return A(w);if(n&&a===0&&(r===s||r===""))return A(s[0])+f(s.slice(1));s=sW.isPrimitive(s)?`${s}`:"",r=sW.isPrimitive(r)?`${r}`:"";let D=s&&s.startsWith(r)&&s!==r,I=D?A(s[r.length]):v;if(a!==r.length&&n===!0&&(m=r.slice(0,a)+A(r[a])+r.slice(a+1),I=""),n===!1&&(I=""),D){let R=t.styles.unstyle(m+I);return m+I+f(s.slice(R.length))}return m+I}});var jO=H((jrr,l1e)=>{"use strict";var Egt=Mf(),Igt=hg(),wgt=oW(),aW=class extends Igt{constructor(e){super({...e,multiple:!0}),this.type="form",this.initial=this.options.initial,this.align=[this.options.align,"right"].find(r=>r!=null),this.emptyError="",this.values={}}async reset(e){return await super.reset(),e===!0&&(this._index=this.index),this.index=this._index,this.values={},this.choices.forEach(r=>r.reset&&r.reset()),this.render()}dispatch(e){return!!e&&this.append(e)}append(e){let r=this.focused;if(!r)return this.alert();let{cursor:s,input:a}=r;return r.value=r.input=a.slice(0,s)+e+a.slice(s),r.cursor++,this.render()}delete(){let e=this.focused;if(!e||e.cursor<=0)return this.alert();let{cursor:r,input:s}=e;return e.value=e.input=s.slice(0,r-1)+s.slice(r),e.cursor--,this.render()}deleteForward(){let e=this.focused;if(!e)return this.alert();let{cursor:r,input:s}=e;if(s[r]===void 0)return this.alert();let a=`${s}`.slice(0,r)+`${s}`.slice(r+1);return e.value=e.input=a,this.render()}right(){let e=this.focused;return e?e.cursor>=e.input.length?this.alert():(e.cursor++,this.render()):this.alert()}left(){let e=this.focused;return e?e.cursor<=0?this.alert():(e.cursor--,this.render()):this.alert()}space(e,r){return this.dispatch(e,r)}number(e,r){return this.dispatch(e,r)}next(){let e=this.focused;if(!e)return this.alert();let{initial:r,input:s}=e;return r&&r.startsWith(s)&&s!==r?(e.value=e.input=r,e.cursor=e.value.length,this.render()):super.next()}prev(){let e=this.focused;return e?e.cursor===0?super.prev():(e.value=e.input="",e.cursor=0,this.render()):this.alert()}separator(){return""}format(e){return this.state.submitted?"":super.format(e)}pointer(){return""}indicator(e){return e.input?"\u29BF":"\u2299"}async choiceSeparator(e,r){let s=await this.resolve(e.separator,this.state,e,r)||":";return s?" "+this.styles.disabled(s):""}async renderChoice(e,r){await this.onChoice(e,r);let{state:s,styles:a}=this,{cursor:n,initial:l="",name:f,hint:h,input:A=""}=e,{muted:m,submitted:w,primary:v,danger:D}=a,I=h,R=this.index===r,N=e.validate||(()=>!0),U=await this.choiceSeparator(e,r),V=e.message;this.align==="right"&&(V=V.padStart(this.longest+1," ")),this.align==="left"&&(V=V.padEnd(this.longest+1," "));let ee=this.values[f]=A||l,te=A?"success":"dark";await N.call(e,ee,thi Line truncated
`)),this.restore()}set value(e){super.value=e}get value(){return this.cast(super.value)}};d1e.exports=lW});var m1e=H((Wrr,g1e)=>{"use strict";var xgt=GO(),uW=class extends xgt{constructor(e){super(e),this.default=this.options.default||(this.initial?"(Y/n)":"(y/N)")}};g1e.exports=uW});var E1e=H((Yrr,y1e)=>{"use strict";var kgt=hg(),Rgt=jO(),OC=Rgt.prototype,fW=class extends kgt{constructor(e){super({...e,multiple:!0}),this.align=[this.options.align,"left"].find(r=>r!=null),this.emptyError="",this.values={}}dispatch(e,r){let s=this.focused,a=s.parent||{};return!s.editable&&!a.editable&&(e==="a"||e==="i")?super[e]():OC.dispatch.call(this,e,r)}append(e,r){return OC.append.call(this,e,r)}delete(e,r){return OC.delete.call(this,e,r)}space(e){return this.focused.editable?this.append(e):super.space()}number(e){return this.focused.editable?this.append(e):super.number(e)}next(){return this.focused.editable?OC.next.call(this):super.next()}prev(){return this.focused.editable?OC.prev.call(this):super.prev()}async indicator(e,r){let s=e.indicator||"",a=e.editable?s:super.indicator(e,r);return await this.resolve(a,this.state,e,r)||""}indent(e){return e.role==="heading"?"":e.editable?" ":" "}async renderChoice(e,r){return e.indent="",e.editable?OC.renderChoice.call(this,e,r):super.renderChoice(e,r)}error(){return""}footer(){return this.state.error}async validate(){let e=!0;for(let r of this.choices){if(typeof r.validate!="function"||r.role==="heading")continue;let s=r.parent?this.value[r.parent.name]:this.value;if(r.editable?s=r.value===r.name?r.initial||"":r.value:this.isDisabled(r)||(s=r.enabled===!0),e=await r.validate(s,this.state),e!==!0)break}return e!==!0&&(this.state.error=typeof e=="string"?e:"Invalid Input"),e}submit(){if(this.focused.newChoice===!0)return super.submit();if(this.choices.some(e=>e.newChoice))return this.alert();this.value={};for(let e of this.choices){let r=e.parent?this.value[e.parent.name]:this.value;if(e.role==="heading"){this.value[e.name]={};continue}e.editable?r[e.name]=e.value===e.name?e.initial||"":e.value:this.isDisabled(e)||(r[e.name]=e.enabled===!0)}return this.base.submit.call(this)}};y1e.exports=fW});var eE=H((Krr,I1e)=>{"use strict";var Tgt=NC(),Qgt=oW(),{isPrimitive:Fgt}=va(),hW=class extends Tgt{constructor(e){super(e),this.initial=Fgt(this.initial)?String(this.initial):"",this.initial&&this.cursorHide(),this.state.prevCursor=0,this.state.clipboard=[]}async keypress(e,r={}){let s=this.state.prevKeypress;return this.state.prevKeypress=r,this.options.multiline===!0&&r.name==="return"&&(!s||s.name!=="return")?this.append(`
`,r):super.keypress(e,r)}moveCursor(e){this.cursor+=e}reset(){return this.input=this.value="",this.cursor=0,this.render()}dispatch(e,r){if(!e||r.ctrl||r.code)return this.alert();this.append(e)}append(e){let{cursor:r,input:s}=this.state;this.input=`${s}`.slice(0,r)+e+`${s}`.slice(r),this.moveCursor(String(e).length),this.render()}insert(e){this.append(e)}delete(){let{cursor:e,input:r}=this.state;if(e<=0)return this.alert();this.input=`${r}`.slice(0,e-1)+`${r}`.slice(e),this.moveCursor(-1),this.render()}deleteForward(){let{cursor:e,input:r}=this.state;if(r[e]===void 0)return this.alert();this.input=`${r}`.slice(0,e)+`${r}`.slice(e+1),this.render()}cutForward(){let e=this.cursor;if(this.input.length<=e)return this.alert();this.state.clipboard.push(this.input.slice(e)),this.input=this.input.slice(0,e),this.render()}cutLeft(){let e=this.cursor;if(e===0)return this.alert();let r=this.input.slice(0,e),s=this.input.slice(e),a=r.split(" ");this.state.clipboard.push(a.pop()),this.input=a.join(" "),this.cursor=this.input.length,this.input+=s,this.render()}paste(){if(!this.state.clipboard.length)return this.alert();this.insert(this.state.clipboard.pop()),this.render()}toggleCursor(){this.state.prevCursor?(this.cursor=this.state.prevCursor,this.state.prevCursor=0):(this.state.prevCursor=this.cursor,this.cursor=0),this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.input.length-1,this.render()}next(){let e=this.initial!=null?String(this.initial):"";if(!e||!e.startsWith(this.input))return this.alert();this.input=this.initial,this.cursor=this.initial.length,this.render()}prev(){if(!this.input)return this.alert();this.reset()}backward(){return this.left()}forward(){return this.right()}right(){return this.cursor>=this.input.length?this.alert():(this.moveCursor(1),this.render())}left(){return this.cursor<=0?this.alert():(this.moveCursor(-1),this.render())}isValue(e){return!!e}async format(e=this.value){let r=await this.resolve(this.initial,this.state);return this.state.submitted?this.styles.submitted(e||r):Qgt(this,{input:e,initial:r,pos:this.cursor})}async render(){let e=this.state.size,r=await this.prefix(),s=await this.separator(),a=await this.message(),n=[r,a,s].filter(Boolean).join(" ");this.state.prompt=n;let l=await this.header(),f=await this.format(),h=await this.error()||await this.hint(),A=await this.footer();h&&!f.includes(h)&&(f+=" "+h),n+=" "+f,this.clear(e),this.write([l,n,A].filter(Boolean).join(`
`)),this.restore()}};I1e.exports=hW});var C1e=H((zrr,w1e)=>{"use strict";var Ngt=t=>t.filter((e,r)=>t.lastIndexOf(e)===r),qO=t=>Ngt(t).filter(Boolean);w1e.exports=(t,e={},r="")=>{let{past:s=[],present:a=""}=e,n,l;switch(t){case"prev":case"undo":return n=s.slice(0,s.length-1),l=s[s.length-1]||"",{past:qO([r,...n]),present:l};case"next":case"redo":return n=s.slice(1),l=s[0]||"",{past:qO([...n,r]),present:l};case"save":return{past:qO([...s,r]),present:""};case"remove":return l=qO(s.filter(f=>f!==r)),a="",l.length&&(a=l.pop()),{past:l,present:a};default:throw new Error(`Invalid action: "${t}"`)}}});var pW=H((Jrr,v1e)=>{"use strict";var Ogt=eE(),B1e=C1e(),AW=class extends Ogt{constructor(e){super(e);let r=this.options.history;if(r&&r.store){let s=r.values||this.initial;this.autosave=!!r.autosave,this.store=r.store,this.data=this.store.get("values")||{past:[],present:s},this.initial=this.data.present||this.data.past[this.data.past.length-1]}}completion(e){return this.store?(this.data=B1e(e,this.data,this.input),this.data.present?(this.input=this.data.present,this.cursor=this.input.length,this.render()):this.alert()):this.alert()}altUp(){return this.completion("prev")}altDown(){return this.completion("next")}prev(){return this.save(),super.prev()}save(){this.store&&(this.data=B1e("save",this.data,this.input),this.store.set("values",this.data))}submit(){return this.store&&this.autosave===!0&&this.save(),super.submit()}};v1e.exports=AW});var b1e=H((Zrr,S1e)=>{"use strict";var Lgt=eE(),dW=class extends Lgt{format(){return""}};S1e.exports=dW});var P1e=H((Xrr,D1e)=>{"use strict";var _gt=eE(),gW=class extends _gt{constructor(e={}){super(e),this.sep=this.options.separator||/, */,this.initial=e.initial||""}split(e=this.value){return e?String(e).split(this.sep):[]}format(){let e=this.state.submitted?this.styles.primary:r=>r;return this.list.map(e).join(", ")}async submit(e){let r=this.state.error||await this.validate(this.list,this.state);return r!==!0?(this.state.error=r,super.submit()):(this.value=this.list,super.submit())}get list(){return this.split()}};D1e.exports=gW});var k1e=H(($rr,x1e)=>{"use strict";var Mgt=hg(),mW=class extends Mgt{constructor(e){super({...e,multiple:!0})}};x1e.exports=mW});var EW=H((enr,R1e)=>{"use strict";var Ugt=eE(),yW=class extends Ugt{constructor(e={}){super({style:"number",...e}),this.min=this.isValue(e.min)?this.toNumber(e.min):-1/0,this.max=this.isValue(e.max)?this.toNumber(e.max):1/0,this.delay=e.delay!=null?e.delay:1e3,this.float=e.float!==!1,this.round=e.round===!0||e.float===!1,this.major=e.major||10,this.minor=e.minor||1,this.initial=e.initial!=null?e.initial:"",this.input=String(this.initial),this.cursor=this.input.length,this.cursorShow()}append(e){return!/[-+.]/.test(e)||e==="."&&this.input.includes(".")?this.alert("invalid number"):super.append(e)}number(e){return super.append(e)}next(){return this.input&&this.input!==this.initial?this.alert():this.isValue(this.initial)?(this.input=this.initial,this.cursor=String(this.initial).length,this.render()):this.alert()}up(e){let r=e||this.minor,s=this.toNumber(this.input);return s>this.max+r?this.alert():(this.input=`${s+r}`,this.render())}down(e){let r=e||this.minor,s=this.toNumber(this.input);return s<this.min-r?this.alert():(this.input=`${s-r}`,this.render())}shiftDown(){return this.down(this.major)}shiftUp(){return this.up(this.major)}format(e=this.input){return typeof this.options.format=="function"?this.options.format.call(this,e):this.styles.info(e)}toNumber(e=""){return this.float?+e:Math.round(+e)}isValue(e){return/^[-+]?[0-9]+((\.)|(\.[0-9]+))?$/.test(e)}submit(){let e=[this.input,this.initial].find(r=>this.isValue(r));return this.value=this.toNumber(e||0),super.submit()}};R1e.exports=yW});var Q1e=H((tnr,T1e)=>{T1e.exports=EW()});var N1e=H((rnr,F1e)=>{"use strict";var Hgt=eE(),IW=class extends Hgt{constructor(e){super(e),this.cursorShow()}format(e=this.input){return this.keypressed?(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(e.length)):""}};F1e.exports=IW});var _1e=H((nnr,L1e)=>{"use strict";var jgt=Mf(),Ggt=pD(),O1e=va(),wW=class extends Ggt{constructor(e={}){super(e),this.widths=[].concat(e.messageWidth||50),this.align=[].concat(e.align||"left"),this.linebreak=e.linebreak||!1,this.edgeLength=e.edgeLength||3,this.newline=e.newline||`
`;let r=e.startNumber||1;typeof this.scale=="number"&&(this.scaleKey=!1,this.scale=Array(this.scale).fill(0).map((s,a)=>({name:a+r})))}async reset(){return this.tableized=!1,await super.reset(),this.render()}tableize(){if(this.tableized===!0)return;this.tableized=!0;let e=0;for(let r of this.choices){e=Math.max(e,r.message.length),r.scaleIndex=r.initial||2,r.scale=[];for(let s=0;s<this.scale.length;s++)r.scale.push({index:s})}this.widths[0]=Math.min(this.widths[0],e+3)}async dispatch(e,r){if(this.multiple)return this[r.name]?await this[r.name](e,r):await super.dispatch(e,r);this.alert()}heading(e,r,s){return this.styles.strong(e)}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;return e.scaleIndex>=this.scale.length-1?this.alert():(e.scaleIndex++,this.render())}left(){let e=this.focused;return e.scaleIndex<=0?this.alert():(e.scaleIndex--,this.render())}indent(){return""}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.index)).join(", "):""}pointer(){return""}renderScaleKey(){return this.scaleKey===!1||this.state.submitted?"":["",...this.scale.map(s=>` ${s.name} - ${s.message}`)].map(s=>this.styles.muted(s)).join(`
`)}renderScaleHeading(e){let r=this.scale.map(h=>h.name);typeof this.options.renderScaleHeading=="function"&&(r=this.options.renderScaleHeading.call(this,e));let s=this.scaleLength-r.join("").length,a=Math.round(s/(r.length-1)),l=r.map(h=>this.styles.strong(h)).join(" ".repeat(a)),f=" ".repeat(this.widths[0]);return this.margin[3]+f+this.margin[1]+l}scaleIndicator(e,r,s){if(typeof this.options.scaleIndicator=="function")return this.options.scaleIndicator.call(this,e,r,s);let a=e.scaleIndex===r.index;return r.disabled?this.styles.hint(this.symbols.radio.disabled):a?this.styles.success(this.symbols.radio.on):this.symbols.radio.off}renderScale(e,r){let s=e.scale.map(n=>this.scaleIndicator(e,n,r)),a=this.term==="Hyper"?"":" ";return s.join(a+this.symbols.line.repeat(this.edgeLength))}async renderChoice(e,r){await this.onChoice(e,r);let s=this.index===r,a=await this.pointer(e,r),n=await e.hint;n&&!O1e.hasColor(n)&&(n=this.styles.muted(n));let l=I=>this.margin[3]+I.replace(/\s+$/,"").padEnd(this.widths[0]," "),f=this.newline,h=this.indent(e),A=await this.resolve(e.message,this.state,e,r),m=await this.renderScale(e,r),w=this.margin[1]+this.margin[3];this.scaleLength=jgt.unstyle(m).length,this.widths[0]=Math.min(this.widths[0],this.width-this.scaleLength-w.length);let D=O1e.wordWrap(A,{width:this.widths[0],newline:f}).split(`
`).map(I=>l(I)+this.margin[1]);return s&&(m=this.styles.info(m),D=D.map(I=>this.styles.info(I))),D[0]+=m,this.linebreak&&D.push(""),[h+a,D.join(`
`)].filter(Boolean)}async renderChoices(){if(this.state.submitted)return"";this.tableize();let e=this.visible.map(async(a,n)=>await this.renderChoice(a,n)),r=await Promise.all(e),s=await this.renderScaleHeading();return this.margin[0]+[s,...r.map(a=>a.join(" "))].join(`
`)}async render(){let{submitted:e,size:r}=this.state,s=await this.prefix(),a=await this.separator(),n=await this.message(),l="";this.options.promptLine!==!1&&(l=[s,n,a,""].join(" "),this.state.prompt=l);let f=await this.header(),h=await this.format(),A=await this.renderScaleKey(),m=await this.error()||await this.hint(),w=await this.renderChoices(),v=await this.footer(),D=this.emptyError;h&&(l+=h),m&&!l.includes(m)&&(l+=" "+m),e&&!h&&!w.trim()&&this.multiple&&D!=null&&(l+=this.styles.danger(D)),this.clear(r),this.write([f,l,A,w,v].filter(Boolean).join(`
`)),this.state.submitted||this.write(this.margin[2]),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIndex;return this.base.submit.call(this)}};L1e.exports=wW});var H1e=H((inr,U1e)=>{"use strict";var M1e=Mf(),qgt=(t="")=>typeof t=="string"?t.replace(/^['"]|['"]$/g,""):"",BW=class{constructor(e){this.name=e.key,this.field=e.field||{},this.value=qgt(e.initial||this.field.initial||""),this.message=e.message||this.name,this.cursor=0,this.input="",this.lines=[]}},Vgt=async(t={},e={},r=s=>s)=>{let s=new Set,a=t.fields||[],n=t.template,l=[],f=[],h=[],A=1;typeof n=="function"&&(n=await n());let m=-1,w=()=>n[++m],v=()=>n[m+1],D=I=>{I.line=A,l.push(I)};for(D({type:"bos",value:""});m<n.length-1;){let I=w();if(/^[^\S\n ]$/.test(I)){D({type:"text",value:I});continue}if(I===`
`){D({type:"newline",value:I}),A++;continue}if(I==="\\"){I+=w(),D({type:"text",value:I});continue}if((I==="$"||I==="#"||I==="{")&&v()==="{"){let N=w();I+=N;let U={type:"template",open:I,inner:"",close:"",value:I},V;for(;V=w();){if(V==="}"){v()==="}"&&(V+=w()),U.value+=V,U.close=V;break}V===":"?(U.initial="",U.key=U.inner):U.initial!==void 0&&(U.initial+=V),U.value+=V,U.inner+=V}U.template=U.open+(U.initial||U.inner)+U.close,U.key=U.key||U.inner,e.hasOwnProperty(U.key)&&(U.initial=e[U.key]),U=r(U),D(U),h.push(U.key),s.add(U.key);let ee=f.find(te=>te.name===U.key);U.field=a.find(te=>te.name===U.key),ee||(ee=new BW(U),f.push(ee)),ee.lines.push(U.line-1);continue}let R=l[l.length-1];R.type==="text"&&R.line===A?R.value+=I:D({type:"text",value:I})}return D({type:"eos",value:""}),{input:n,tabstops:l,unique:s,keys:h,items:f}};U1e.exports=async t=>{let e=t.options,r=new Set(e.required===!0?[]:e.required||[]),s={...e.values,...e.initial},{tabstops:a,items:n,keys:l}=await Vgt(e,s),f=CW("result",t,e),h=CW("format",t,e),A=CW("validate",t,e,!0),m=t.isValue.bind(t);return async(w={},v=!1)=>{let D=0;w.required=r,w.items=n,w.keys=l,w.output="";let I=async(V,ee,te,ie)=>{let ae=await A(V,ee,te,ie);return ae===!1?"Invalid field "+te.name:ae};for(let V of a){let ee=V.value,te=V.key;if(V.type!=="template"){ee&&(w.output+=ee);continue}if(V.type==="template"){let ie=n.find(we=>we.name===te);e.required===!0&&w.required.add(ie.name);let ae=[ie.input,w.values[ie.value],ie.value,ee].find(m),de=(ie.field||{}).message||V.inner;if(v){let we=await I(w.values[te],w,ie,D);if(we&&typeof we=="string"||we===!1){w.invalid.set(te,we);continue}w.invalid.delete(te);let d=await f(w.values[te],w,ie,D);w.output+=M1e.unstyle(d);continue}ie.placeholder=!1;let xe=ee;ee=await h(ee,w,ie,D),ae!==ee?(w.values[te]=ae,ee=t.styles.typing(ae),w.missing.delete(de)):(w.values[te]=void 0,ae=`<${de}>`,ee=t.styles.primary(ae),ie.placeholder=!0,w.required.has(te)&&w.missing.add(de)),w.missing.has(de)&&w.validating&&(ee=t.styles.warning(ae)),w.invalid.has(te)&&w.validating&&(ee=t.styles.danger(ae)),D===w.index&&(xe!==ee?ee=t.styles.underline(ee):ee=t.styles.heading(M1e.unstyle(ee))),D++}ee&&(w.output+=ee)}let R=w.output.split(`
`).map(V=>" "+V),N=n.length,U=0;for(let V of n)w.invalid.has(V.name)&&V.lines.forEach(ee=>{R[ee][0]===" "&&(R[ee]=w.styles.danger(w.symbols.bullet)+R[ee].slice(1))}),t.isValue(w.values[V.name])&&U++;return w.completed=(U/N*100).toFixed(0),w.output=R.join(`
`),w.output}};function CW(t,e,r,s){return(a,n,l,f)=>typeof l.field[t]=="function"?l.field[t].call(e,a,n,l,f):[s,a].find(h=>e.isValue(h))}});var G1e=H((snr,j1e)=>{"use strict";var Wgt=Mf(),Ygt=H1e(),Kgt=NC(),vW=class extends Kgt{constructor(e){super(e),this.cursorHide(),this.reset(!0)}async initialize(){this.interpolate=await Ygt(this),await super.initialize()}async reset(e){this.state.keys=[],this.state.invalid=new Map,this.state.missing=new Set,this.state.completed=0,this.state.values={},e!==!0&&(await this.initialize(),await this.render())}moveCursor(e){let r=this.getItem();this.cursor+=e,r.cursor+=e}dispatch(e,r){if(!r.code&&!r.ctrl&&e!=null&&this.getItem()){this.append(e,r);return}this.alert()}append(e,r){let s=this.getItem(),a=s.input.slice(0,this.cursor),n=s.input.slice(this.cursor);this.input=s.input=`${a}${e}${n}`,this.moveCursor(1),this.render()}delete(){let e=this.getItem();if(this.cursor<=0||!e.input)return this.alert();let r=e.input.slice(this.cursor),s=e.input.slice(0,this.cursor-1);this.input=e.input=`${s}${r}`,this.moveCursor(-1),this.render()}increment(e){return e>=this.state.keys.length-1?0:e+1}decrement(e){return e<=0?this.state.keys.length-1:e-1}first(){this.state.index=0,this.render()}last(){this.state.index=this.state.keys.length-1,this.render()}right(){if(this.cursor>=this.input.length)return this.alert();this.moveCursor(1),this.render()}left(){if(this.cursor<=0)return this.alert();this.moveCursor(-1),this.render()}prev(){this.state.index=this.decrement(this.state.index),this.getItem(),this.render()}next(){this.state.index=this.increment(this.state.index),this.getItem(),this.render()}up(){this.prev()}down(){this.next()}format(e){let r=this.state.completed<100?this.styles.warning:this.styles.success;return this.state.submitted===!0&&this.state.completed!==100&&(r=this.styles.danger),r(`${this.state.completed}% completed`)}async render(){let{index:e,keys:r=[],submitted:s,size:a}=this.state,n=[this.options.newline,`
`].find(V=>V!=null),l=await this.prefix(),f=await this.separator(),h=await this.message(),A=[l,h,f].filter(Boolean).join(" ");this.state.prompt=A;let m=await this.header(),w=await this.error()||"",v=await this.hint()||"",D=s?"":await this.interpolate(this.state),I=this.state.key=r[e]||"",R=await this.format(I),N=await this.footer();R&&(A+=" "+R),v&&!R&&this.state.completed===0&&(A+=" "+v),this.clear(a);let U=[m,A,D,N,w.trim()];this.write(U.filter(Boolean).join(n)),this.restore()}getItem(e){let{items:r,keys:s,index:a}=this.state,n=r.find(l=>l.name===s[a]);return n&&n.input!=null&&(this.input=n.input,this.cursor=n.cursor),n}async submit(){typeof this.interpolate!="function"&&await this.initialize(),await this.interpolate(this.state,!0);let{invalid:e,missing:r,output:s,values:a}=this.state;if(e.size){let f="";for(let[h,A]of e)f+=`Invalid ${h}: ${A}
`;return this.state.error=f,super.submit()}if(r.size)return this.state.error="Required: "+[...r.keys()].join(", "),super.submit();let l=Wgt.unstyle(s).split(`
`).map(f=>f.slice(1)).join(`
`);return this.value={values:a,result:l},super.submit()}};j1e.exports=vW});var V1e=H((onr,q1e)=>{"use strict";var zgt="(Use <shift>+<up/down> to sort)",Jgt=hg(),SW=class extends Jgt{constructor(e){super({...e,reorder:!1,sort:!0,multiple:!0}),this.state.hint=[this.options.hint,zgt].find(this.isValue.bind(this))}indicator(){return""}async renderChoice(e,r){let s=await super.renderChoice(e,r),a=this.symbols.identicalTo+" ",n=this.index===r&&this.sorting?this.styles.muted(a):" ";return this.options.drag===!1&&(n=""),this.options.numbered===!0?n+`${r+1} - `+s:n+s}get selected(){return this.choices}submit(){return this.value=this.choices.map(e=>e.value),super.submit()}};q1e.exports=SW});var Y1e=H((anr,W1e)=>{"use strict";var Zgt=pD(),bW=class extends Zgt{constructor(e={}){if(super(e),this.emptyError=e.emptyError||"No items were selected",this.term=process.env.TERM_PROGRAM,!this.options.header){let r=["","4 - Strongly Agree","3 - Agree","2 - Neutral","1 - Disagree","0 - Strongly Disagree",""];r=r.map(s=>this.styles.muted(s)),this.state.header=r.join(`
`)}}async toChoices(...e){if(this.createdScales)return!1;this.createdScales=!0;let r=await super.toChoices(...e);for(let s of r)s.scale=Xgt(5,this.options),s.scaleIdx=2;return r}dispatch(){this.alert()}space(){let e=this.focused,r=e.scale[e.scaleIdx],s=r.selected;return e.scale.forEach(a=>a.selected=!1),r.selected=!s,this.render()}indicator(){return""}pointer(){return""}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;return e.scaleIdx>=e.scale.length-1?this.alert():(e.scaleIdx++,this.render())}left(){let e=this.focused;return e.scaleIdx<=0?this.alert():(e.scaleIdx--,this.render())}indent(){return" "}async renderChoice(e,r){await this.onChoice(e,r);let s=this.index===r,a=this.term==="Hyper",n=a?9:8,l=a?"":" ",f=this.symbols.line.repeat(n),h=" ".repeat(n+(a?0:1)),A=ee=>(ee?this.styles.success("\u25C9"):"\u25EF")+l,m=r+1+".",w=s?this.styles.heading:this.styles.noop,v=await this.resolve(e.message,this.state,e,r),D=this.indent(e),I=D+e.scale.map((ee,te)=>A(te===e.scaleIdx)).join(f),R=ee=>ee===e.scaleIdx?w(ee):ee,N=D+e.scale.map((ee,te)=>R(te)).join(h),U=()=>[m,v].filter(Boolean).join(" "),V=()=>[U(),I,N," "].filter(Boolean).join(`
`);return s&&(I=this.styles.cyan(I),N=this.styles.cyan(N)),V()}async renderChoices(){if(this.state.submitted)return"";let e=this.visible.map(async(s,a)=>await this.renderChoice(s,a)),r=await Promise.all(e);return r.length||r.push(this.styles.danger("No matching choices")),r.join(`
`)}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.scaleIdx)).join(", "):""}async render(){let{submitted:e,size:r}=this.state,s=await this.prefix(),a=await this.separator(),n=await this.message(),l=[s,n,a].filter(Boolean).join(" ");this.state.prompt=l;let f=await this.header(),h=await this.format(),A=await this.error()||await this.hint(),m=await this.renderChoices(),w=await this.footer();(h||!A)&&(l+=" "+h),A&&!l.includes(A)&&(l+=" "+A),e&&!h&&!m&&this.multiple&&this.type!=="form"&&(l+=this.styles.danger(this.emptyError)),this.clear(r),this.write([l,f,m,w].filter(Boolean).join(`
`)),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIdx;return this.base.submit.call(this)}};function Xgt(t,e={}){if(Array.isArray(e.scale))return e.scale.map(s=>({...s}));let r=[];for(let s=1;s<t+1;s++)r.push({i:s,selected:!1});return r}W1e.exports=bW});var z1e=H((cnr,K1e)=>{K1e.exports=pW()});var Z1e=H((lnr,J1e)=>{"use strict";var $gt=GO(),DW=class extends $gt{async initialize(){await super.initialize(),this.value=this.initial=!!this.options.initial,this.disabled=this.options.disabled||"no",this.enabled=this.options.enabled||"yes",await this.render()}reset(){this.value=this.initial,this.render()}delete(){this.alert()}toggle(){this.value=!this.value,this.render()}enable(){if(this.value===!0)return this.alert();this.value=!0,this.render()}disable(){if(this.value===!1)return this.alert();this.value=!1,this.render()}up(){this.toggle()}down(){this.toggle()}right(){this.toggle()}left(){this.toggle()}next(){this.toggle()}prev(){this.toggle()}dispatch(e="",r){switch(e.toLowerCase()){case" ":return this.toggle();case"1":case"y":case"t":return this.enable();case"0":case"n":case"f":return this.disable();default:return this.alert()}}format(){let e=s=>this.styles.primary.underline(s);return[this.value?this.disabled:e(this.disabled),this.value?e(this.enabled):this.enabled].join(this.styles.muted(" / "))}async render(){let{size:e}=this.state,r=await this.header(),s=await this.prefix(),a=await this.separator(),n=await this.message(),l=await this.format(),f=await this.error()||await this.hint(),h=await this.footer(),A=[s,n,a,l].join(" ");this.state.prompt=A,f&&!A.includes(f)&&(A+=" "+f),this.clear(e),this.write([r,A,h].filter(Boolean).join(`
`)),this.write(this.margin[2]),this.restore()}};J1e.exports=DW});var $1e=H((unr,X1e)=>{"use strict";var emt=hg(),PW=class extends emt{constructor(e){if(super(e),typeof this.options.correctChoice!="number"||this.options.correctChoice<0)throw new Error("Please specify the index of the correct answer from the list of choices")}async toChoices(e,r){let s=await super.toChoices(e,r);if(s.length<2)throw new Error("Please give at least two choices to the user");if(this.options.correctChoice>s.length)throw new Error("Please specify the index of the correct answer from the list of choices");return s}check(e){return e.index===this.options.correctChoice}async result(e){return{selectedAnswer:e,correctAnswer:this.options.choices[this.options.correctChoice].value,correct:await this.check(this.state)}}};X1e.exports=PW});var t2e=H(xW=>{"use strict";var e2e=va(),ro=(t,e)=>{e2e.defineExport(xW,t,e),e2e.defineExport(xW,t.toLowerCase(),e)};ro("AutoComplete",()=>a1e());ro("BasicAuth",()=>p1e());ro("Confirm",()=>m1e());ro("Editable",()=>E1e());ro("Form",()=>jO());ro("Input",()=>pW());ro("Invisible",()=>b1e());ro("List",()=>P1e());ro("MultiSelect",()=>k1e());ro("Numeral",()=>Q1e());ro("Password",()=>N1e());ro("Scale",()=>_1e());ro("Select",()=>hg());ro("Snippet",()=>G1e());ro("Sort",()=>V1e());ro("Survey",()=>Y1e());ro("Text",()=>z1e());ro("Toggle",()=>Z1e());ro("Quiz",()=>$1e())});var n2e=H((hnr,r2e)=>{r2e.exports={ArrayPrompt:pD(),AuthPrompt:cW(),BooleanPrompt:GO(),NumberPrompt:EW(),StringPrompt:eE()}});var gD=H((Anr,s2e)=>{"use strict";var i2e=Ae("assert"),RW=Ae("events"),Ag=va(),Hf=class extends RW{constructor(e,r){super(),this.options=Ag.merge({},e),this.answers={...r}}register(e,r){if(Ag.isObject(e)){for(let a of Object.keys(e))this.register(a,e[a]);return this}i2e.equal(typeof r,"function","expected a function");let s=e.toLowerCase();return r.prototype instanceof this.Prompt?this.prompts[s]=r:this.prompts[s]=r(this.Prompt,this),this}async prompt(e=[]){for(let r of[].concat(e))try{typeof r=="function"&&(r=await r.call(this)),await this.ask(Ag.merge({},this.options,r))}catch(s){return Promise.reject(s)}return this.answers}async ask(e){typeof e=="function"&&(e=await e.call(this));let r=Ag.merge({},this.options,e),{type:s,name:a}=e,{set:n,get:l}=Ag;if(typeof s=="function"&&(s=await s.call(this,e,this.answers)),!s)return this.answers[a];i2e(this.prompts[s],`Prompt "${s}" is not registered`);let f=new this.prompts[s](r),h=l(this.answers,a);f.state.answers=this.answers,f.enquirer=this,a&&f.on("submit",m=>{this.emit("answer",a,m,f),n(this.answers,a,m)});let A=f.emit.bind(f);return f.emit=(...m)=>(this.emit.call(this,...m),A(...m)),this.emit("prompt",f,this),r.autofill&&h!=null?(f.value=f.input=h,r.autofill==="show"&&await f.submit()):h=f.value=await f.run(),h}use(e){return e.call(this,this),this}set Prompt(e){this._Prompt=e}get Prompt(){return this._Prompt||this.constructor.Prompt}get prompts(){return this.constructor.prompts}static set Prompt(e){this._Prompt=e}static get Prompt(){return this._Prompt||NC()}static get prompts(){return t2e()}static get types(){return n2e()}static get prompt(){let e=(r,...s)=>{let a=new this(...s),n=a.emit.bind(a);return a.emit=(...l)=>(e.emit(...l),n(...l)),a.prompt(r)};return Ag.mixinEmitter(e,new RW),e}};Ag.mixinEmitter(Hf,new RW);var kW=Hf.prompts;for(let t of Object.keys(kW)){let e=t.toLowerCase(),r=s=>new kW[t](s).run();Hf.prompt[e]=r,Hf[e]=r,Hf[t]||Reflect.defineProperty(Hf,t,{get:()=>kW[t]})}var dD=t=>{Ag.defineExport(Hf,t,()=>Hf.types[t])};dD("ArrayPrompt");dD("AuthPrompt");dD("BooleanPrompt");dD("NumberPrompt");dD("StringPrompt");s2e.exports=Hf});var A2e=H((Oir,lmt)=>{lmt.exports={name:"@yarnpkg/cli",version:"4.18.0",license:"BSD-2-Clause",main:"./sources/index.ts",exports:{".":"./sources/index.ts","./polyfills":"./sources/polyfills.ts","./package.json":"./package.json"},dependencies:{"@yarnpkg/core":"workspace:^","@yarnpkg/fslib":"workspace:^","@yarnpkg/libzip":"workspace:^","@yarnpkg/parsers":"workspace:^","@yarnpkg/plugin-catalog":"workspace:^","@yarnpkg/plugin-compat":"workspace:^","@yarnpkg/plugin-constraints":"workspace:^","@yarnpkg/plugin-dlx":"workspace:^","@yarnpkg/plugin-essentials":"workspace:^","@yarnpkg/plugin-exec":"workspace:^","@yarnpkg/plugin-file":"workspace:^","@yarnpkg/plugin-git":"workspace:^","@yarnpkg/plugin-github":"workspace:^","@yarnpkg/plugin-http":"workspace:^","@yarnpkg/plugin-init":"workspace:^","@yarnpkg/plugin-interactive-tools":"workspace:^","@yarnpkg/plugin-jsr":"workspace:^","@yarnpkg/plugin-link":"workspace:^","@yarnpkg/plugin-nm":"workspace:^","@yarnpkg/plugin-npm":"workspace:^","@yarnpkg/plugin-npm-cli":"workspace:^","@yarnpkg/plugin-pack":"workspace:^","@yarnpkg/plugin-patch":"workspace:^","@yarnpkg/plugin-pnp":"workspace:^","@yarnpkg/plugin-pnpm":"workspace:^","@yarnpkg/plugin-stage":"workspace:^","@yarnpkg/plugin-typescript":"workspace:^","@yarnpkg/plugin-version":"workspace:^","@yarnpkg/plugin-workspace-tools":"workspace:^","@yarnpkg/shell":"workspa Line truncated
${V} at ${ee}`:`
${V}`}).join("");A.push({text:`Conflict detected in constraint targeting ${pe.pretty(t.configuration,D,pe.Type.CODE)}; conflicting values are:${R}`,fixable:!1})}else{let[[R]]=I,N=rc(v,D);if(JSON.stringify(N)===JSON.stringify(R))continue;if(!s){let U=typeof N>"u"?`Missing field ${pe.pretty(t.configuration,D,pe.Type.CODE)}; expected ${pe.pretty(t.configuration,R,pe.Type.INSPECT)}`:typeof R>"u"?`Extraneous field ${pe.pretty(t.configuration,D,pe.Type.CODE)} currently set to ${pe.pretty(t.configuration,N,pe.Type.INSPECT)}`:`Invalid field ${pe.pretty(t.configuration,D,pe.Type.CODE)}; expected ${pe.pretty(t.configuration,R,pe.Type.INSPECT)}, found ${pe.pretty(t.configuration,N,pe.Type.INSPECT)}`;A.push({text:U,fixable:!0});continue}typeof R>"u"?N0(v,D):Ey(v,D,R),m=!0}m&&a.set(w,v)}A.length>0&&n.set(w,A)}return{changedWorkspaces:a,remainingErrors:n}}function $2e(t,{configuration:e}){let r={children:[]};for(let[s,a]of t){let n=[];for(let f of a){let h=f.text.split(/\n/);f.fixable&&(h[0]=`${pe.pretty(e,"\u2699","gray")} ${h[0]}`),n.push({value:pe.tuple(pe.Type.NO_HINT,h[0]),children:h.slice(1).map(A=>({value:pe.tuple(pe.Type.NO_HINT,A)}))})}let l={value:pe.tuple(pe.Type.LOCATOR,s.anchoredLocator),children:Ye.sortMap(n,f=>f.value[1])};r.children.push(l)}return r.children=Ye.sortMap(r.children,s=>s.value[1]),r}var v1,iyt,syt,oyt,DD=tt(()=>{We();xl();v1=class{constructor(e){this.indexedFields=e;this.items=[];this.indexes={};this.clear()}clear(){this.items=[];for(let e of this.indexedFields)this.indexes[e]=new Map}insert(e){this.items.push(e);for(let r of this.indexedFields){let s=Object.hasOwn(e,r)?e[r]:void 0;if(typeof s>"u")continue;Ye.getArrayWithDefault(this.indexes[r],s).push(e)}return e}find(e){if(typeof e>"u")return this.items;let r=Object.entries(e);if(r.length===0)return this.items;let s=[],a;for(let[l,f]of r){let h=l,A=Object.hasOwn(this.indexes,h)?this.indexes[h]:void 0;if(typeof A>"u"){s.push([h,f]);continue}let m=new Set(A.get(f)??[]);if(m.size===0)return[];if(typeof a>"u")a=m;else for(let w of a)m.has(w)||a.delete(w);if(a.size===0)break}let n=[...a??[]];return s.length>0&&(n=n.filter(l=>{for(let[f,h]of s)if(!(typeof h<"u"?Object.hasOwn(l,f)&&l[f]===h:Object.hasOwn(l,f)===!1))return!1;return!0})),n}},iyt=/^[0-9]+$/,syt=/^[a-zA-Z0-9_]+$/,oyt=new Set(["scripts",...nr.allDependencies])});var eBe=H((wur,AY)=>{var lyt;(function(t){var e=function(){return{"append/2":[new t.type.Rule(new t.type.Term("append",[new t.type.Var("X"),new t.type.Var("L")]),new t.type.Term("foldl",[new t.type.Term("append",[]),new t.type.Var("X"),new t.type.Term("[]",[]),new t.type.Var("L")]))],"append/3":[new t.type.Rule(new t.type.Term("append",[new t.type.Term("[]",[]),new t.type.Var("X"),new t.type.Var("X")]),null),new t.type.Rule(new t.type.Term("append",[new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("S")])]),new t.type.Term("append",[new t.type.Var("T"),new t.type.Var("X"),new t.type.Var("S")]))],"member/2":[new t.type.Rule(new t.type.Term("member",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("_")])]),null),new t.type.Rule(new t.type.Term("member",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("_"),new t.type.Var("Xs")])]),new t.type.Term("member",[new t.type.Var("X"),new t.type.Var("Xs")]))],"permutation/2":[new t.type.Rule(new t.type.Term("permutation",[new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("permutation",[new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("permutation",[new t.type.Var("T"),new t.type.Var("P")]),new t.type.Term(",",[new t.type.Term("append",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("P")]),new t.type.Term("append",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("Y")]),new t.type.Var("S")])])]))],"maplist/2":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("X")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("Xs")])]))],"maplist/3":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs")])]))],"maplist/4":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Ter Line truncated
`+h:"")),l.error.method="_execFileSync",l.error.program=a,l.error.args=n,l.error.extMessage=h,l.error.exitCode=+f),ki.unlinkSync(A),ki.unlinkSync(m),ki.unlinkSync(w),ki.unlinkSync(v),l}function Ayt(t){var e,r={},s,a={env:process.env,encoding:t.encoding};if(pg||(nE?process.env.PSModulePath?(pg="powershell.exe",ZO=["-ExecutionPolicy","Bypass","-File",__dirname+"\\read.ps1"]):(pg="cscript.exe",ZO=["//nologo",__dirname+"\\read.cs.js"]):(pg="/bin/sh",ZO=[__dirname+"/read.sh"])),nE&&!process.env.PSModulePath&&(a.stdio=[process.stdin]),gY.execFileSync){e=sBe(t),PD&&PD("execFileSync",e);try{r.input=gY.execFileSync(pg,e,a)}catch(n){s=n.stderr?(n.stderr+"").trim():"",r.error=new Error(nBe+(s?`
`+s:"")),r.error.method="execFileSync",r.error.program=pg,r.error.args=e,r.error.extMessage=s,r.error.exitCode=n.status,r.error.code=n.code,r.error.signal=n.signal}}else r=hyt(t,a);return r.error||(r.input=r.input.replace(/^\s*'|'\s*$/g,""),t.display=""),r}function EY(t){var e="",r=t.display,s=!t.display&&t.keyIn&&t.hideEchoBack&&!t.mask;function a(){var n=Ayt(t);if(n.error)throw n.error;return n.input}return yY&&yY(t),function(){var n,l,f;function h(){return n||(n=process.binding("fs"),l=process.binding("constants")),n}if(typeof ed=="string")if(ed=null,nE){if(f=function(A){var m=A.replace(/^\D+/,"").split("."),w=0;return(m[0]=+m[0])&&(w+=m[0]*1e4),(m[1]=+m[1])&&(w+=m[1]*100),(m[2]=+m[2])&&(w+=m[2]),w}(process.version),!(f>=20302&&f<40204||f>=5e4&&f<50100||f>=50600&&f<60200)&&process.stdin.isTTY)process.stdin.pause(),ed=process.stdin.fd,b1=process.stdin._handle;else try{ed=h().open("CONIN$",l.O_RDWR,parseInt("0666",8)),b1=new tBe(ed,!0)}catch{}if(process.stdout.isTTY)Gf=process.stdout.fd;else{try{Gf=ki.openSync("\\\\.\\CON","w")}catch{}if(typeof Gf!="number")try{Gf=h().open("CONOUT$",l.O_RDWR,parseInt("0666",8))}catch{}}}else{if(process.stdin.isTTY){process.stdin.pause();try{ed=ki.openSync("/dev/tty","r"),b1=process.stdin._handle}catch{}}else try{ed=ki.openSync("/dev/tty","r"),b1=new tBe(ed,!1)}catch{}if(process.stdout.isTTY)Gf=process.stdout.fd;else try{Gf=ki.openSync("/dev/tty","w")}catch{}}}(),function(){var n,l,f=!t.hideEchoBack&&!t.keyIn,h,A,m,w,v;XO="";function D(I){return I===rBe?!0:b1.setRawMode(I)!==0?!1:(rBe=I,!0)}if(iBe||!b1||typeof Gf!="number"&&(t.display||!f)){e=a();return}if(t.display&&(ki.writeSync(Gf,t.display),t.display=""),!t.displayOnly){if(!D(!f)){e=a();return}for(A=t.keyIn?1:t.bufferSize,h=Buffer.allocUnsafe&&Buffer.alloc?Buffer.alloc(A):new Buffer(A),t.keyIn&&t.limit&&(l=new RegExp("[^"+t.limit+"]","g"+(t.caseSensitive?"":"i")));;){m=0;try{m=ki.readSync(ed,h,0,A)}catch(I){if(I.code!=="EOF"){D(!1),e+=a();return}}if(m>0?(w=h.toString(t.encoding,0,m),XO+=w):(w=`
`,XO+="\0"),w&&typeof(v=(w.match(/^(.*?)[\r\n]/)||[])[1])=="string"&&(w=v,n=!0),w&&(w=w.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,"")),w&&l&&(w=w.replace(l,"")),w&&(f||(t.hideEchoBack?t.mask&&ki.writeSync(Gf,new Array(w.length+1).join(t.mask)):ki.writeSync(Gf,w)),e+=w),!t.keyIn&&n||t.keyIn&&e.length>=A)break}!f&&!s&&ki.writeSync(Gf,`
`),D(!1)}}(),t.print&&!s&&t.print(r+(t.displayOnly?"":(t.hideEchoBack?new Array(e.length+1).join(t.mask):e)+`
`),t.encoding),t.displayOnly?"":CY=t.keepWhitespace||t.keyIn?e:e.trim()}function pyt(t,e){var r=[];function s(a){a!=null&&(Array.isArray(a)?a.forEach(s):(!e||e(a))&&r.push(a))}return s(t),r}function BY(t){return t.replace(/[\x00-\x7f]/g,function(e){return"\\x"+("00"+e.charCodeAt().toString(16)).substr(-2)})}function Co(){var t=Array.prototype.slice.call(arguments),e,r;return t.length&&typeof t[0]=="boolean"&&(r=t.shift(),r&&(e=Object.keys(mY),t.unshift(mY))),t.reduce(function(s,a){return a==null||(a.hasOwnProperty("noEchoBack")&&!a.hasOwnProperty("hideEchoBack")&&(a.hideEchoBack=a.noEchoBack,delete a.noEchoBack),a.hasOwnProperty("noTrim")&&!a.hasOwnProperty("keepWhitespace")&&(a.keepWhitespace=a.noTrim,delete a.noTrim),r||(e=Object.keys(a)),e.forEach(function(n){var l;if(a.hasOwnProperty(n))switch(l=a[n],n){case"mask":case"limitMessage":case"defaultInput":case"encoding":l=l!=null?l+"":"",l&&n!=="limitMessage"&&(l=l.replace(/[\r\n]/g,"")),s[n]=l;break;case"bufferSize":!isNaN(l=parseInt(l,10))&&typeof l=="number"&&(s[n]=l);break;case"displayOnly":case"keyIn":case"hideEchoBack":case"caseSensitive":case"keepWhitespace":case"history":case"cd":s[n]=!!l;break;case"limit":case"trueValue":case"falseValue":s[n]=pyt(l,function(f){var h=typeof f;return h==="string"||h==="number"||h==="function"||f instanceof RegExp}).map(function(f){return typeof f=="string"?f.replace(/[\r\n]/g,""):f});break;case"print":case"phContent":case"preCheck":s[n]=typeof l=="function"?l:void 0;break;case"prompt":case"display":s[n]=l??"";break}})),s},{})}function IY(t,e,r){return e.some(function(s){var a=typeof s;return a==="string"?r?t===s:t.toLowerCase()===s.toLowerCase():a==="number"?parseFloat(t)===s:a==="function"?s(t):s instanceof RegExp?s.test(t):!1})}function vY(t,e){var r=dg.normalize(nE?(process.env.HOMEDRIVE||"")+(process.env.HOMEPATH||""):process.env.HOME||"").replace(/[\/\\]+$/,"");return t=dg.normalize(t),e?t.replace(/^~(?=\/|\\|$)/,r):t.replace(new RegExp("^"+BY(r)+"(?=\\/|\\\\|$)",nE?"i":""),"~")}function D1(t,e){var r="(?:\\(([\\s\\S]*?)\\))?(\\w+|.-.)(?:\\(([\\s\\S]*?)\\))?",s=new RegExp("(\\$)?(\\$<"+r+">)","g"),a=new RegExp("(\\$)?(\\$\\{"+r+"\\})","g");function n(l,f,h,A,m,w){var v;return f||typeof(v=e(m))!="string"?h:v?(A||"")+v+(w||""):""}return t.replace(s,n).replace(a,n)}function oBe(t,e,r){var s,a=[],n=-1,l=0,f="",h;function A(m,w){return w.length>3?(m.push(w[0]+"..."+w[w.length-1]),h=!0):w.length&&(m=m.concat(w)),m}return s=t.reduce(function(m,w){return m.concat((w+"").split(""))},[]).reduce(function(m,w){var v,D;return e||(w=w.toLowerCase()),v=/^\d$/.test(w)?1:/^[A-Z]$/.test(w)?2:/^[a-z]$/.test(w)?3:0,r&&v===0?f+=w:(D=w.charCodeAt(0),v&&v===n&&D===l+1?a.push(w):(m=A(m,a),a=[w],n=v),l=D),m},[]),s=A(s,a),f&&(s.push(f),h=!0),{values:s,suppressed:h}}function aBe(t,e){return t.join(t.length>2?", ":e?" / ":"/")}function cBe(t,e){var r,s,a={},n;if(e.phContent&&(r=e.phContent(t,e)),typeof r!="string")switch(t){case"hideEchoBack":case"mask":case"defaultInput":case"caseSensitive":case"keepWhitespace":case"encoding":case"bufferSize":case"history":case"cd":r=e.hasOwnProperty(t)?typeof e[t]=="boolean"?e[t]?"on":"off":e[t]+"":"";break;case"limit":case"trueValue":case"falseValue":s=e[e.hasOwnProperty(t+"Src")?t+"Src":t],e.keyIn?(a=oBe(s,e.caseSensitive),s=a.values):s=s.filter(function(l){var f=typeof l;return f==="string"||f==="number"}),r=aBe(s,a.suppressed);break;case"limitCount":case"limitCountNotZero":r=e[e.hasOwnProperty("limitSrc")?"limitSrc":"limit"].length,r=r||t!=="limitCountNotZero"?r+"":"";break;case"lastInput":r=CY;break;case"cwd":case"CWD":case"cwdHome":r=process.cwd(),t==="CWD"?r=dg.basename(r):t==="cwdHome"&&(r=vY(r));break;case"date":case"time":case"localeDate":case"localeTime":r=new Date()["to"+t.replace(/^./,function(l){return l.toUpperCase()})+"String"]();break;default:typeof(n=(t.match(/^history_m(\d+)$/)||[])[1])=="string"&&(r=rE[rE.length-n]||"")}return r}function lBe(t){var e=/^(.)-(.)$/.exec(t),r="",s,a,n,l;if(!e)return null;for(s=e[1].charCodeAt(0),a=e[2].charCodeAt(0),l=s<a?1:-1,n=s;n!==a+l;n+=l)r+=String.fromCharCode(n);return r}function wY(t){var e=new RegExp(/(\s*)(?:("|')(.*?)(?:\2|$)|(\S+))/g),r,s="",a=[],n;for(t=t.trim();r=e.exec(t);)n=r[3]||r[4]||"",r[1]&&(a.push(s),s=""),s+=n;return s&&a.push(s),a}function uBe(t,e){return e.trueValue.length&&IY(t,e.trueValue,e.caseSensitive)?!0:e.falseValue.length&&IY(t,e.falseValue,e.caseSensitive)?!1:t}function fBe(t){var e,r,s,a,n,l,f;function h(m){return cBe(m,t)}function A(m){t.display+=(/[^\r\n]$/.test(t.display)?`
`:"")+m}for(t.limitSrc=t.limit,t.displaySrc=t.display,t.limit="",t.display=D1(t.display+"",h);;){if(e=EY(t),r=!1,s="",t.defaultInput&&!e&&(e=t.defaultInput),t.history&&((a=/^\s*\!(?:\!|-1)(:p)?\s*$/.exec(e))?(n=rE[0]||"",a[1]?r=!0:e=n,A(n+`
`),r||(t.displayOnly=!0,EY(t),t.displayOnly=!1)):e&&e!==rE[rE.length-1]&&(rE=[e])),!r&&t.cd&&e)switch(l=wY(e),l[0].toLowerCase()){case"cd":if(l[1])try{process.chdir(vY(l[1],!0))}catch(m){A(m+"")}r=!0;break;case"pwd":A(process.cwd()),r=!0;break}if(!r&&t.preCheck&&(f=t.preCheck(e,t),e=f.res,f.forceNext&&(r=!0)),!r){if(!t.limitSrc.length||IY(e,t.limitSrc,t.caseSensitive))break;t.limitMessage&&(s=D1(t.limitMessage,h))}A((s?s+`
`:"")+D1(t.displaySrc+"",h))}return uBe(e,t)}wn._DBG_set_useExt=function(t){iBe=t};wn._DBG_set_checkOptions=function(t){yY=t};wn._DBG_set_checkMethod=function(t){PD=t};wn._DBG_clearHistory=function(){CY="",rE=[]};wn.setDefaultOptions=function(t){return mY=Co(!0,t),Co(!0)};wn.question=function(t,e){return fBe(Co(Co(!0,e),{display:t}))};wn.prompt=function(t){var e=Co(!0,t);return e.display=e.prompt,fBe(e)};wn.keyIn=function(t,e){var r=Co(Co(!0,e),{display:t,keyIn:!0,keepWhitespace:!0});return r.limitSrc=r.limit.filter(function(s){var a=typeof s;return a==="string"||a==="number"}).map(function(s){return D1(s+"",lBe)}),r.limit=BY(r.limitSrc.join("")),["trueValue","falseValue"].forEach(function(s){r[s]=r[s].reduce(function(a,n){var l=typeof n;return l==="string"||l==="number"?a=a.concat((n+"").split("")):a.push(n),a},[])}),r.display=D1(r.display+"",function(s){return cBe(s,r)}),uBe(EY(r),r)};wn.questionEMail=function(t,e){return t==null&&(t="Input e-mail address: "),wn.question(t,Co({hideEchoBack:!1,limit:/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,limitMessage:"Input valid e-mail address, please.",trueValue:null,falseValue:null},e,{keepWhitespace:!1,cd:!1}))};wn.questionNewPassword=function(t,e){var r,s,a,n=Co({hideEchoBack:!0,mask:"*",limitMessage:`It can include: $<charlist>
And the length must be: $<length>`,trueValue:null,falseValue:null,caseSensitive:!0},e,{history:!1,cd:!1,phContent:function(D){return D==="charlist"?r.text:D==="length"?s+"..."+a:null}}),l,f,h,A,m,w,v;for(e=e||{},l=D1(e.charlist?e.charlist+"":"$<!-~>",lBe),(isNaN(s=parseInt(e.min,10))||typeof s!="number")&&(s=12),(isNaN(a=parseInt(e.max,10))||typeof a!="number")&&(a=24),A=new RegExp("^["+BY(l)+"]{"+s+","+a+"}$"),r=oBe([l],n.caseSensitive,!0),r.text=aBe(r.values,r.suppressed),f=e.confirmMessage!=null?e.confirmMessage:"Reinput a same one to confirm it: ",h=e.unmatchMessage!=null?e.unmatchMessage:"It differs from first one. Hit only the Enter key if you want to retry from first one.",t==null&&(t="Input new password: "),m=n.limitMessage;!v;)n.limit=A,n.limitMessage=m,w=wn.question(t,n),n.limit=[w,""],n.limitMessage=h,v=wn.question(f,n);return w};function hBe(t,e,r){var s;function a(n){return s=r(n),!isNaN(s)&&typeof s=="number"}return wn.question(t,Co({limitMessage:"Input valid number, please."},e,{limit:a,cd:!1})),s}wn.questionInt=function(t,e){return hBe(t,e,function(r){return parseInt(r,10)})};wn.questionFloat=function(t,e){return hBe(t,e,parseFloat)};wn.questionPath=function(t,e){var r,s="",a=Co({hideEchoBack:!1,limitMessage:`$<error(
)>Input valid path, please.$<( Min:)min>$<( Max:)max>`,history:!0,cd:!0},e,{keepWhitespace:!1,limit:function(n){var l,f,h;n=vY(n,!0),s="";function A(m){m.split(/\/|\\/).reduce(function(w,v){var D=dg.resolve(w+=v+dg.sep);if(!ki.existsSync(D))ki.mkdirSync(D);else if(!ki.statSync(D).isDirectory())throw new Error("Non directory already exists: "+D);return w},"")}try{if(l=ki.existsSync(n),r=l?ki.realpathSync(n):dg.resolve(n),!e.hasOwnProperty("exists")&&!l||typeof e.exists=="boolean"&&e.exists!==l)return s=(l?"Already exists":"No such file or directory")+": "+r,!1;if(!l&&e.create&&(e.isDirectory?A(r):(A(dg.dirname(r)),ki.closeSync(ki.openSync(r,"w"))),r=ki.realpathSync(r)),l&&(e.min||e.max||e.isFile||e.isDirectory)){if(f=ki.statSync(r),e.isFile&&!f.isFile())return s="Not file: "+r,!1;if(e.isDirectory&&!f.isDirectory())return s="Not directory: "+r,!1;if(e.min&&f.size<+e.min||e.max&&f.size>+e.max)return s="Size "+f.size+" is out of range: "+r,!1}if(typeof e.validate=="function"&&(h=e.validate(r))!==!0)return typeof h=="string"&&(s=h),!1}catch(m){return s=m+"",!1}return!0},phContent:function(n){return n==="error"?s:n!=="min"&&n!=="max"?null:e.hasOwnProperty(n)?e[n]+"":""}});return e=e||{},t==null&&(t='Input path (you can "cd" and "pwd"): '),wn.question(t,a),r};function ABe(t,e){var r={},s={};return typeof t=="object"?(Object.keys(t).forEach(function(a){typeof t[a]=="function"&&(s[e.caseSensitive?a:a.toLowerCase()]=t[a])}),r.preCheck=function(a){var n;return r.args=wY(a),n=r.args[0]||"",e.caseSensitive||(n=n.toLowerCase()),r.hRes=n!=="_"&&s.hasOwnProperty(n)?s[n].apply(a,r.args.slice(1)):s.hasOwnProperty("_")?s._.apply(a,r.args):null,{res:a,forceNext:!1}},s.hasOwnProperty("_")||(r.limit=function(){var a=r.args[0]||"";return e.caseSensitive||(a=a.toLowerCase()),s.hasOwnProperty(a)})):r.preCheck=function(a){return r.args=wY(a),r.hRes=typeof t=="function"?t.apply(a,r.args):!0,{res:a,forceNext:!1}},r}wn.promptCL=function(t,e){var r=Co({hideEchoBack:!1,limitMessage:"Requested command is not available.",caseSensitive:!1,history:!0},e),s=ABe(t,r);return r.limit=s.limit,r.preCheck=s.preCheck,wn.prompt(r),s.args};wn.promptLoop=function(t,e){for(var r=Co({hideEchoBack:!1,trueValue:null,falseValue:null,caseSensitive:!1,history:!0},e);!t(wn.prompt(r)););};wn.promptCLLoop=function(t,e){var r=Co({hideEchoBack:!1,limitMessage:"Requested command is not available.",caseSensitive:!1,history:!0},e),s=ABe(t,r);for(r.limit=s.limit,r.preCheck=s.preCheck;wn.prompt(r),!s.hRes;);};wn.promptSimShell=function(t){return wn.prompt(Co({hideEchoBack:!1,history:!0},t,{prompt:function(){return nE?"$<cwd>>":(process.env.USER||"")+(process.env.HOSTNAME?"@"+process.env.HOSTNAME.replace(/\..*$/,""):"")+":$<cwdHome>$ "}()}))};function pBe(t,e,r){var s;return t==null&&(t="Are you sure? "),(!e||e.guide!==!1)&&(t+="")&&(t=t.replace(/\s*:?\s*$/,"")+" [y/n]: "),s=wn.keyIn(t,Co(e,{hideEchoBack:!1,limit:r,trueValue:"y",falseValue:"n",caseSensitive:!1})),typeof s=="boolean"?s:""}wn.keyInYN=function(t,e){return pBe(t,e)};wn.keyInYNStrict=function(t,e){return pBe(t,e,"yn")};wn.keyInPause=function(t,e){t==null&&(t="Continue..."),(!e||e.guide!==!1)&&(t+="")&&(t=t.replace(/\s+$/,"")+" (Hit any key)"),wn.keyIn(t,Co({limit:null},e,{hideEchoBack:!0,mask:""}))};wn.keyInSelect=function(t,e,r){var s=Co({hideEchoBack:!1},r,{trueValue:null,falseValue:null,caseSensitive:!1,phContent:function(h){return h==="itemsCount"?t.length+"":h==="firstItem"?(t[0]+"").trim():h==="lastItem"?(t[t.length-1]+"").trim():null}}),a="",n={},l=49,f=`
`;if(!Array.isArray(t)||!t.length||t.length>35)throw"`items` must be Array (max length: 35).";return t.forEach(function(h,A){var m=String.fromCharCode(l);a+=m,n[m]=A,f+="["+m+"] "+(h+"").trim()+`
`,l=l===57?97:l+1}),(!r||r.cancel!==!1)&&(a+="0",n[0]=-1,f+="[0] "+(r&&r.cancel!=null&&typeof r.cancel!="boolean"?(r.cancel+"").trim():"CANCEL")+`
`),s.limit=a,f+=`
`,e==null&&(e="Choose one from list: "),(e+="")&&((!r||r.guide!==!1)&&(e=e.replace(/\s*:?\s*$/,"")+" [$<limit>]: "),f+=e),n[wn.keyIn(f,s).toLowerCase()]};wn.getRawInput=function(){return XO};function xD(t,e){var r;return e.length&&(r={},r[t]=e[0]),wn.setDefaultOptions(r)[t]}wn.setPrint=function(){return xD("print",arguments)};wn.setPrompt=function(){return xD("prompt",arguments)};wn.setEncoding=function(){return xD("encoding",arguments)};wn.setMask=function(){return xD("mask",arguments)};wn.setBufferSize=function(){return xD("bufferSize",arguments)}});var SY=H((Bur,Nl)=>{(function(){var t={major:0,minor:2,patch:66,status:"beta"};tau_file_system={files:{},open:function(C,P,E){var F=tau_file_system.files[C];if(!F){if(E==="read")return null;F={path:C,text:"",type:P,get:function(Z,X){return X===this.text.length||X>this.text.length?"end_of_file":this.text.substring(X,X+Z)},put:function(Z,X){return X==="end_of_file"?(this.text+=Z,!0):X==="past_end_of_file"?null:(this.text=this.text.substring(0,X)+Z+this.text.substring(X+Z.length),!0)},get_byte:function(Z){if(Z==="end_of_stream")return-1;var X=Math.floor(Z/2);if(this.text.length<=X)return-1;var re=n(this.text[Math.floor(Z/2)],0);return Z%2===0?re&255:re/256>>>0},put_byte:function(Z,X){var re=X==="end_of_stream"?this.text.length:Math.floor(X/2);if(this.text.length<re)return null;var ce=this.text.length===re?-1:n(this.text[Math.floor(X/2)],0);return X%2===0?(ce=ce/256>>>0,ce=(ce&255)<<8|Z&255):(ce=ce&255,ce=(Z&255)<<8|ce&255),this.text.length===re?this.text+=l(ce):this.text=this.text.substring(0,re)+l(ce)+this.text.substring(re+1),!0},flush:function(){return!0},close:function(){var Z=tau_file_system.files[this.path];return Z?!0:null}},tau_file_system.files[C]=F}return E==="write"&&(F.text=""),F}},tau_user_input={buffer:"",get:function(C,P){for(var E;tau_user_input.buffer.length<C;)E=window.prompt(),E&&(tau_user_input.buffer+=E);return E=tau_user_input.buffer.substr(0,C),tau_user_input.buffer=tau_user_input.buffer.substr(C),E}},tau_user_output={put:function(C,P){return console.log(C),!0},flush:function(){return!0}},nodejs_file_system={open:function(C,P,E){var F=Ae("fs"),Z=F.openSync(C,E[0]);return E==="read"&&!F.existsSync(C)?null:{get:function(X,re){var ce=new Buffer(X);return F.readSync(Z,ce,0,X,re),ce.toString()},put:function(X,re){var ce=Buffer.from(X);if(re==="end_of_file")F.writeSync(Z,ce);else{if(re==="past_end_of_file")return null;F.writeSync(Z,ce,0,ce.length,re)}return!0},get_byte:function(X){return null},put_byte:function(X,re){return null},flush:function(){return!0},close:function(){return F.closeSync(Z),!0}}}},nodejs_user_input={buffer:"",get:function(C,P){for(var E,F=dBe();nodejs_user_input.buffer.length<C;)nodejs_user_input.buffer+=F.question();return E=nodejs_user_input.buffer.substr(0,C),nodejs_user_input.buffer=nodejs_user_input.buffer.substr(C),E}},nodejs_user_output={put:function(C,P){return process.stdout.write(C),!0},flush:function(){return!0}};var e;Array.prototype.indexOf?e=function(C,P){return C.indexOf(P)}:e=function(C,P){for(var E=C.length,F=0;F<E;F++)if(P===C[F])return F;return-1};var r=function(C,P){if(C.length!==0){for(var E=C[0],F=C.length,Z=1;Z<F;Z++)E=P(E,C[Z]);return E}},s;Array.prototype.map?s=function(C,P){return C.map(P)}:s=function(C,P){for(var E=[],F=C.length,Z=0;Z<F;Z++)E.push(P(C[Z]));return E};var a;Array.prototype.filter?a=function(C,P){return C.filter(P)}:a=function(C,P){for(var E=[],F=C.length,Z=0;Z<F;Z++)P(C[Z])&&E.push(C[Z]);return E};var n;String.prototype.codePointAt?n=function(C,P){return C.codePointAt(P)}:n=function(C,P){return C.charCodeAt(P)};var l;String.fromCodePoint?l=function(){return String.fromCodePoint.apply(null,arguments)}:l=function(){return String.fromCharCode.apply(null,arguments)};var f=0,h=1,A=/(\\a)|(\\b)|(\\f)|(\\n)|(\\r)|(\\t)|(\\v)|\\x([0-9a-fA-F]+)\\|\\([0-7]+)\\|(\\\\)|(\\')|('')|(\\")|(\\`)|(\\.)|(.)/g,m={"\\a":7,"\\b":8,"\\f":12,"\\n":10,"\\r":13,"\\t":9,"\\v":11};function w(C){var P=[],E=!1;return C.replace(A,function(F,Z,X,re,ce,ke,Le,pt,St,er,ur,Ht,Cn,Ur,kr,_,Ue){switch(!0){case St!==void 0:return P.push(parseInt(St,16)),"";case er!==void 0:return P.push(parseInt(er,8)),"";case ur!==void 0:case Ht!==void 0:case Cn!==void 0:case Ur!==void 0:case kr!==void 0:return P.push(n(F.substr(1),0)),"";case Ue!==void 0:return P.push(n(Ue,0)),"";case _!==void 0:E=!0;default:return P.push(m[F]),""}}),E?null:P}function v(C,P){var E="";if(C.length<2)return C;try{C=C.replace(/\\([0-7]+)\\/g,function(re,ce){return l(parseInt(ce,8))}),C=C.replace(/\\x([0-9a-fA-F]+)\\/g,function(re,ce){return l(parseInt(ce,16))})}catch{return null}for(var F=0;F<C.length;F++){var Z=C.charAt(F),X=C.charAt(F+1);if(Z===P&&X===P)F++,E+=P;else if(Z==="\\")if(["a","b","f","n","r","t","v","'",'"',"\\","a","\b","\f",`
`,"\r"," ","\v"].indexOf(X)!==-1)switch(F+=1,X){case"a":E+="a";break;case"b":E+="\b";break;case"f":E+="\f";break;case"n":E+=`
`;break;case"r":E+="\r";break;case"t":E+=" ";break;case"v":E+="\v";break;case"'":E+="'";break;case'"':E+='"';break;case"\\":E+="\\";break}else return null;else E+=Z}return E}function D(C){for(var P="",E=0;E<C.length;E++)switch(C.charAt(E)){case"'":P+="\\'";break;case"\\":P+="\\\\";break;case"\b":P+="\\b";break;case"\f":P+="\\f";break;case`
`:P+="\\n";break;case"\r":P+="\\r";break;case" ":P+="\\t";break;case"\v":P+="\\v";break;default:P+=C.charAt(E);break}return P}function I(C){var P=C.substr(2);switch(C.substr(0,2).toLowerCase()){case"0x":return parseInt(P,16);case"0b":return parseInt(P,2);case"0o":return parseInt(P,8);case"0'":return w(P)[0];default:return parseFloat(C)}}var R={whitespace:/^\s*(?:(?:%.*)|(?:\/\*(?:\n|\r|.)*?\*\/)|(?:\s+))\s*/,variable:/^(?:[A-Z_][a-zA-Z0-9_]*)/,atom:/^(\!|,|;|[a-z][0-9a-zA-Z_]*|[#\$\&\*\+\-\.\/\:\<\=\>\?\@\^\~\\]+|'(?:[^']*?(?:\\(?:x?\d+)?\\)*(?:'')*(?:\\')*)*')/,number:/^(?:0o[0-7]+|0x[0-9a-fA-F]+|0b[01]+|0'(?:''|\\[abfnrtv\\'"`]|\\x?\d+\\|[^\\])|\d+(?:\.\d+(?:[eE][+-]?\d+)?)?)/,string:/^(?:"([^"]|""|\\")*"|`([^`]|``|\\`)*`)/,l_brace:/^(?:\[)/,r_brace:/^(?:\])/,l_bracket:/^(?:\{)/,r_bracket:/^(?:\})/,bar:/^(?:\|)/,l_paren:/^(?:\()/,r_paren:/^(?:\))/};function N(C,P){return C.get_flag("char_conversion").id==="on"?P.replace(/./g,function(E){return C.get_char_conversion(E)}):P}function U(C){this.thread=C,this.text="",this.tokens=[]}U.prototype.set_last_tokens=function(C){return this.tokens=C},U.prototype.new_text=function(C){this.text=C,this.tokens=[]},U.prototype.get_tokens=function(C){var P,E=0,F=0,Z=0,X=[],re=!1;if(C){var ce=this.tokens[C-1];E=ce.len,P=N(this.thread,this.text.substr(ce.len)),F=ce.line,Z=ce.start}else P=this.text;if(/^\s*$/.test(P))return null;for(;P!=="";){var ke=[],Le=!1;if(/^\n/.exec(P)!==null){F++,Z=0,E++,P=P.replace(/\n/,""),re=!0;continue}for(var pt in R)if(R.hasOwnProperty(pt)){var St=R[pt].exec(P);St&&ke.push({value:St[0],name:pt,matches:St})}if(!ke.length)return this.set_last_tokens([{value:P,matches:[],name:"lexical",line:F,start:Z}]);var ce=r(ke,function(Ur,kr){return Ur.value.length>=kr.value.length?Ur:kr});switch(ce.start=Z,ce.line=F,P=P.replace(ce.value,""),Z+=ce.value.length,E+=ce.value.length,ce.name){case"atom":ce.raw=ce.value,ce.value.charAt(0)==="'"&&(ce.value=v(ce.value.substr(1,ce.value.length-2),"'"),ce.value===null&&(ce.name="lexical",ce.value="unknown escape sequence"));break;case"number":ce.float=ce.value.substring(0,2)!=="0x"&&ce.value.match(/[.eE]/)!==null&&ce.value!=="0'.",ce.value=I(ce.value),ce.blank=Le;break;case"string":var er=ce.value.charAt(0);ce.value=v(ce.value.substr(1,ce.value.length-2),er),ce.value===null&&(ce.name="lexical",ce.value="unknown escape sequence");break;case"whitespace":var ur=X[X.length-1];ur&&(ur.space=!0),Le=!0;continue;case"r_bracket":X.length>0&&X[X.length-1].name==="l_bracket"&&(ce=X.pop(),ce.name="atom",ce.value="{}",ce.raw="{}",ce.space=!1);break;case"r_brace":X.length>0&&X[X.length-1].name==="l_brace"&&(ce=X.pop(),ce.name="atom",ce.value="[]",ce.raw="[]",ce.space=!1);break}ce.len=E,X.push(ce),Le=!1}var Ht=this.set_last_tokens(X);return Ht.length===0?null:Ht};function V(C,P,E,F,Z){if(!P[E])return{type:f,value:x.error.syntax(P[E-1],"expression expected",!0)};var X;if(F==="0"){var re=P[E];switch(re.name){case"number":return{type:h,len:E+1,value:new x.type.Num(re.value,re.float)};case"variable":return{type:h,len:E+1,value:new x.type.Var(re.value)};case"string":var ce;switch(C.get_flag("double_quotes").id){case"atom":ce=new j(re.value,[]);break;case"codes":ce=new j("[]",[]);for(var ke=re.value.length-1;ke>=0;ke--)ce=new j(".",[new x.type.Num(n(re.value,ke),!1),ce]);break;case"chars":ce=new j("[]",[]);for(var ke=re.value.length-1;ke>=0;ke--)ce=new j(".",[new x.type.Term(re.value.charAt(ke),[]),ce]);break}return{type:h,len:E+1,value:ce};case"l_paren":var Ht=V(C,P,E+1,C.__get_max_priority(),!0);return Ht.type!==h?Ht:P[Ht.len]&&P[Ht.len].name==="r_paren"?(Ht.len++,Ht):{type:f,derived:!0,value:x.error.syntax(P[Ht.len]?P[Ht.len]:P[Ht.len-1],") or operator expected",!P[Ht.len])};case"l_bracket":var Ht=V(C,P,E+1,C.__get_max_priority(),!0);return Ht.type!==h?Ht:P[Ht.len]&&P[Ht.len].name==="r_bracket"?(Ht.len++,Ht.value=new j("{}",[Ht.value]),Ht):{type:f,derived:!0,value:x.error.syntax(P[Ht.len]?P[Ht.len]:P[Ht.len-1],"} or operator expected",!P[Ht.len])}}var Le=ee(C,P,E,Z);return Le.type===h||Le.derived||(Le=te(C,P,E),Le.type===h||Le.derived)?Le:{type:f,derived:!1,value:x.error.syntax(P[E],"unexpected token")}}var pt=C.__get_max_priority(),St=C.__get_next_priority(F),er=E;if(P[E].name==="atom"&&P[E+1]&&(P[E].space||P[E+1].name!=="l_paren")){var re=P[E++],ur=C.__lookup_operator_classes(F,re.value);if(ur&&ur.indexOf("fy")>-1){var Ht=V(C,P,E,F,Z);if(Ht.type!==f)return re.value==="-"&&!re.space&&x.type.is_number(Ht.value)?{value:new x.type.Num(-Ht.value.value,Ht.value.is_float),len:Ht.len,type:h}:{value:new x.type.Term(re.value,[Ht.value]),len:Ht.len,type:h};X=Ht}else if(ur&&ur.indexOf("fx")>-1){var Ht=V(C,P,E,St,Z);if(Ht.type!==f)return{value:new x.type.Term(re.value,[Ht.value]),len:Ht.len,type:h};X=Ht}}E=er;var Ht=V(C,P,E,St,Z);if(Ht.type===h){E=Ht.len;var re=P[E];if(P[E]&&(P[E].name==="atom"&&C.__lookup_operator_classes(F,re.value)||P[E].name==="bar"&&C.__lookup_operator_classes(F,"|"))){var Cn=St,Ur=F,ur=C.__lookup_operator_classes(F,re.value);iLine truncated
`;P+=`
`;for(key in this.rules)for(E=0;E<this.rules[key].length;E++)P+=this.rules[key][E].toString(C),P+=`
`;return P},De.prototype.clone=function(){return new De(this.id)},Te.prototype.clone=function(){return new Te(this.value,this.is_float)},j.prototype.clone=function(){return new j(this.id,s(this.args,function(C){return C.clone()}))},Ne.prototype.clone=function(){return new Stram(this.stream,this.mode,this.alias,this.type,this.reposition,this.eof_action)},Fe.prototype.clone=function(){var C={};for(var P in this.links)this.links.hasOwnProperty(P)&&(C[P]=this.links[P].clone());return new Fe(C)},Pe.prototype.clone=function(){return new Pe(this.goal.clone(),this.substitution.clone(),this.parent)},He.prototype.clone=function(){return new He(this.head.clone(),this.body!==null?this.body.clone():null)},De.prototype.equals=function(C){return x.type.is_variable(C)&&this.id===C.id},Te.prototype.equals=function(C){return x.type.is_number(C)&&this.value===C.value&&this.is_float===C.is_float},j.prototype.equals=function(C){if(!x.type.is_term(C)||this.indicator!==C.indicator)return!1;for(var P=0;P<this.args.length;P++)if(!this.args[P].equals(C.args[P]))return!1;return!0},Ne.prototype.equals=function(C){return x.type.is_stream(C)&&this.id===C.id},Fe.prototype.equals=function(C){var P;if(!x.type.is_substitution(C))return!1;for(P in this.links)if(this.links.hasOwnProperty(P)&&(!C.links[P]||!this.links[P].equals(C.links[P])))return!1;for(P in C.links)if(C.links.hasOwnProperty(P)&&!this.links[P])return!1;return!0},Pe.prototype.equals=function(C){return x.type.is_state(C)&&this.goal.equals(C.goal)&&this.substitution.equals(C.substitution)&&this.parent===C.parent},He.prototype.equals=function(C){return x.type.is_rule(C)&&this.head.equals(C.head)&&(this.body===null&&C.body===null||this.body!==null&&this.body.equals(C.body))},De.prototype.rename=function(C){return C.get_free_variable(this)},Te.prototype.rename=function(C){return this},j.prototype.rename=function(C){return new j(this.id,s(this.args,function(P){return P.rename(C)}))},Ne.prototype.rename=function(C){return this},He.prototype.rename=function(C){return new He(this.head.rename(C),this.body!==null?this.body.rename(C):null)},De.prototype.variables=function(){return[this.id]},Te.prototype.variables=function(){return[]},j.prototype.variables=function(){return[].concat.apply([],s(this.args,function(C){return C.variables()}))},Ne.prototype.variables=function(){return[]},He.prototype.variables=function(){return this.body===null?this.head.variables():this.head.variables().concat(this.body.variables())},De.prototype.apply=function(C){return C.lookup(this.id)?C.lookup(this.id):this},Te.prototype.apply=function(C){return this},j.prototype.apply=function(C){if(this.indicator==="./2"){for(var P=[],E=this;E.indicator==="./2";)P.push(E.args[0].apply(C)),E=E.args[1];for(var F=E.apply(C),Z=P.length-1;Z>=0;Z--)F=new j(".",[P[Z],F]);return F}return new j(this.id,s(this.args,function(X){return X.apply(C)}),this.ref)},Ne.prototype.apply=function(C){return this},He.prototype.apply=function(C){return new He(this.head.apply(C),this.body!==null?this.body.apply(C):null)},Fe.prototype.apply=function(C){var P,E={};for(P in this.links)this.links.hasOwnProperty(P)&&(E[P]=this.links[P].apply(C));return new Fe(E)},j.prototype.select=function(){for(var C=this;C.indicator===",/2";)C=C.args[0];return C},j.prototype.replace=function(C){return this.indicator===",/2"?this.args[0].indicator===",/2"?new j(",",[this.args[0].replace(C),this.args[1]]):C===null?this.args[1]:new j(",",[C,this.args[1]]):C},j.prototype.search=function(C){if(x.type.is_term(C)&&C.ref!==void 0&&this.ref===C.ref)return!0;for(var P=0;P<this.args.length;P++)if(x.type.is_term(this.args[P])&&this.args[P].search(C))return!0;return!1},Qe.prototype.get_current_input=function(){return this.current_input},ft.prototype.get_current_input=function(){return this.session.get_current_input()},Qe.prototype.get_current_output=function(){return this.current_output},ft.prototype.get_current_output=function(){return this.session.get_current_output()},Qe.prototype.set_current_input=function(C){this.current_input=C},ft.prototype.set_current_input=function(C){return this.session.set_current_input(C)},Qe.prototype.set_current_output=function(C){this.current_input=C},ft.prototype.set_current_output=function(C){return this.session.set_current_output(C)},Qe.prototype.get_stream_by_alias=function(C){return this.streams[C]},ft.prototype.get_stream_by_alias=function(C){return this.session.get_stream_by_alias(C)},Qe.prototype.file_system_open=function(C,P,E){return this.file_system.open(C,P,E)},ft.prototype.file_system_open=function(C,P,E){return this.session.file_system_open(C,P,E)},Qe.prototype.get_char_conversion=function(C){return this.__char_conversion[C]||C},ft.prototype.get_char_conversion=function(C){return this.session.get_char_conversion(C)},Qe.prototype.parse=function(C){return this.thread.parse(C)},ft.prototype.parse=function(C){var P=new U(this);P.new_text(C);var E=P.get_tokens();if(E===null)return!1;var F=V(this,E,0,this.__get_max_priority(),!1);return F Line truncated
`,[])])])),P.substitution,P)])},"nl/1":function(C,P,E){var F=E.args[0];C.prepend([new Pe(P.goal.replace(new j("put_char",[F,new j(`
`,[])])),P.substitution,P)])},"get_byte/1":function(C,P,E){var F=E.args[0];C.prepend([new Pe(P.goal.replace(new j(",",[new j("current_input",[new De("S")]),new j("get_byte",[new De("S"),F])])),P.substitution,P)])},"get_byte/2":function(C,P,E){var F=E.args[0],Z=E.args[1],X=x.type.is_stream(F)?F:C.get_stream_by_alias(F.id);if(x.type.is_variable(F))C.throw_error(x.error.instantiation(E.indicator));else if(!x.type.is_variable(Z)&&!x.type.is_byte(Z))C.throw_error(x.error.type("in_byte",char,E.indicator));else if(!x.type.is_stream(F)&&!x.type.is_atom(F))C.throw_error(x.error.domain("stream_or_alias",F,E.indicator));else if(!x.type.is_stream(X)||X.stream===null)C.throw_error(x.error.existence("stream",F,E.indicator));else if(X.output)C.throw_error(x.error.permission("input","stream",F,E.indicator));else if(X.type==="text")C.throw_error(x.error.permission("input","text_stream",F,E.indicator));else if(X.position==="past_end_of_stream"&&X.eof_action==="error")C.throw_error(x.error.permission("input","past_end_of_stream",F,E.indicator));else{var re;if(X.position==="end_of_stream")re="end_of_file",X.position="past_end_of_stream";else{if(re=X.stream.get_byte(X.position),re===null){C.throw_error(x.error.representation("byte",E.indicator));return}X.position++}C.prepend([new Pe(P.goal.replace(new j("=",[new Te(re,!1),Z])),P.substitution,P)])}},"peek_byte/1":function(C,P,E){var F=E.args[0];C.prepend([new Pe(P.goal.replace(new j(",",[new j("current_input",[new De("S")]),new j("peek_byte",[new De("S"),F])])),P.substitution,P)])},"peek_byte/2":function(C,P,E){var F=E.args[0],Z=E.args[1],X=x.type.is_stream(F)?F:C.get_stream_by_alias(F.id);if(x.type.is_variable(F))C.throw_error(x.error.instantiation(E.indicator));else if(!x.type.is_variable(Z)&&!x.type.is_byte(Z))C.throw_error(x.error.type("in_byte",char,E.indicator));else if(!x.type.is_stream(F)&&!x.type.is_atom(F))C.throw_error(x.error.domain("stream_or_alias",F,E.indicator));else if(!x.type.is_stream(X)||X.stream===null)C.throw_error(x.error.existence("stream",F,E.indicator));else if(X.output)C.throw_error(x.error.permission("input","stream",F,E.indicator));else if(X.type==="text")C.throw_error(x.error.permission("input","text_stream",F,E.indicator));else if(X.position==="past_end_of_stream"&&X.eof_action==="error")C.throw_error(x.error.permission("input","past_end_of_stream",F,E.indicator));else{var re;if(X.position==="end_of_stream")re="end_of_file",X.position="past_end_of_stream";else if(re=X.stream.get_byte(X.position),re===null){C.throw_error(x.error.representation("byte",E.indicator));return}C.prepend([new Pe(P.goal.replace(new j("=",[new Te(re,!1),Z])),P.substitution,P)])}},"put_byte/1":function(C,P,E){var F=E.args[0];C.prepend([new Pe(P.goal.replace(new j(",",[new j("current_output",[new De("S")]),new j("put_byte",[new De("S"),F])])),P.substitution,P)])},"put_byte/2":function(C,P,E){var F=E.args[0],Z=E.args[1],X=x.type.is_stream(F)?F:C.get_stream_by_alias(F.id);x.type.is_variable(F)||x.type.is_variable(Z)?C.throw_error(x.error.instantiation(E.indicator)):x.type.is_byte(Z)?!x.type.is_variable(F)&&!x.type.is_stream(F)&&!x.type.is_atom(F)?C.throw_error(x.error.domain("stream_or_alias",F,E.indicator)):!x.type.is_stream(X)||X.stream===null?C.throw_error(x.error.existence("stream",F,E.indicator)):X.input?C.throw_error(x.error.permission("output","stream",F,E.indicator)):X.type==="text"?C.throw_error(x.error.permission("output","text_stream",F,E.indicator)):X.stream.put_byte(Z.value,X.position)&&(typeof X.position=="number"&&X.position++,C.success(P)):C.throw_error(x.error.type("byte",Z,E.indicator))},"read/1":function(C,P,E){var F=E.args[0];C.prepend([new Pe(P.goal.replace(new j(",",[new j("current_input",[new De("S")]),new j("read_term",[new De("S"),F,new j("[]",[])])])),P.substitution,P)])},"read/2":function(C,P,E){var F=E.args[0],Z=E.args[1];C.prepend([new Pe(P.goal.replace(new j("read_term",[F,Z,new j("[]",[])])),P.substitution,P)])},"read_term/2":function(C,P,E){var F=E.args[0],Z=E.args[1];C.prepend([new Pe(P.goal.replace(new j(",",[new j("current_input",[new De("S")]),new j("read_term",[new De("S"),F,Z])])),P.substitution,P)])},"read_term/3":function(C,P,E){var F=E.args[0],Z=E.args[1],X=E.args[2],re=x.type.is_stream(F)?F:C.get_stream_by_alias(F.id);if(x.type.is_variable(F)||x.type.is_variable(X))C.throw_error(x.error.instantiation(E.indicator));else if(!x.type.is_list(X))C.throw_error(x.error.type("list",X,E.indicator));else if(!x.type.is_stream(F)&&!x.type.is_atom(F))C.throw_error(x.error.domain("stream_or_alias",F,E.indicator));else if(!x.type.is_stream(re)||re.stream===null)C.throw_error(x.error.existence("stream",F,E.indicator));else if(re.output)C.throw_error(x.error.permission("input","stream",F,E.indicator));else if(re.type==="binary")C.throw_error(x.error.permission("input","binary_stream",F,E.indicator));else if(re.position==="past_end_of_stream"&&re.eof_action==="error")C.throw_error(x.error.permission("input","past_end_of_stream",F,E.indicator));else{for(v Line truncated
`;for(let r of this.project.workspacesByCwd.values()){let s=r.relativeCwd;e+=`workspace(${mg(s)}).
`,e+=`workspace_ident(${mg(s)}, ${mg(G.stringifyIdent(r.anchoredLocator))}).
`,e+=`workspace_version(${mg(s)}, ${mg(r.manifest.version)}).
`;for(let a of wBe)for(let n of r.manifest[a].values())e+=`workspace_has_dependency(${mg(s)}, ${mg(G.stringifyIdent(n))}, ${mg(n.range)}, ${a}).
`}return e+=`workspace(_) :- false.
`,e+=`workspace_ident(_, _) :- false.
`,e+=`workspace_version(_, _) :- false.
`,e+=`workspace_has_dependency(_, _, _, _) :- false.
`,e}getDeclarations(){let e="";return e+=`gen_enforced_dependency(_, _, _, _) :- false.
`,e+=`gen_enforced_field(_, _, _) :- false.
`,e}get fullSource(){return`${this.getProjectDatabase()}
${this.source}
${this.getDeclarations()}`}createSession(){return new DY(this.project,this.fullSource)}async processClassic(){let e=this.createSession();return{enforcedDependencies:await this.genEnforcedDependencies(e),enforcedFields:await this.genEnforcedFields(e)}}async process(){let{enforcedDependencies:e,enforcedFields:r}=await this.processClassic(),s=new Map;for(let{workspace:a,dependencyIdent:n,dependencyRange:l,dependencyType:f}of e){let h=bD([f,G.stringifyIdent(n)]),A=Ye.getMapWithDefault(s,a.cwd);Ye.getMapWithDefault(A,h).set(l??void 0,new Set)}for(let{workspace:a,fieldPath:n,fieldValue:l}of r){let f=bD(n),h=Ye.getMapWithDefault(s,a.cwd);Ye.getMapWithDefault(h,f).set(JSON.parse(l)??void 0,new Set)}return{manifestUpdates:s,reportedErrors:new Map}}async genEnforcedDependencies(e){let r=[];for await(let s of e.makeQuery("workspace(WorkspaceCwd), dependency_type(DependencyType), gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType).")){let a=Y.resolve(this.project.cwd,iE(s.links.WorkspaceCwd)),n=iE(s.links.DependencyIdent),l=iE(s.links.DependencyRange),f=iE(s.links.DependencyType);if(a===null||n===null)throw new Error("Invalid rule");let h=this.project.getWorkspaceByCwd(a),A=G.parseIdent(n);r.push({workspace:h,dependencyIdent:A,dependencyRange:l,dependencyType:f})}return Ye.sortMap(r,[({dependencyRange:s})=>s!==null?"0":"1",({workspace:s})=>G.stringifyIdent(s.anchoredLocator),({dependencyIdent:s})=>G.stringifyIdent(s)])}async genEnforcedFields(e){let r=[];for await(let s of e.makeQuery("workspace(WorkspaceCwd), gen_enforced_field(WorkspaceCwd, FieldPath, FieldValue).")){let a=Y.resolve(this.project.cwd,iE(s.links.WorkspaceCwd)),n=iE(s.links.FieldPath),l=yyt(s.links.FieldValue);if(a===null||n===null)throw new Error("Invalid rule");let f=this.project.getWorkspaceByCwd(a);r.push({workspace:f,fieldPath:n,fieldValue:l})}return Ye.sortMap(r,[({workspace:s})=>G.stringifyIdent(s.anchoredLocator),({fieldPath:s})=>s])}async*query(e){let r=this.createSession();for await(let s of r.makeQuery(e)){let a={};for(let[n,l]of Object.entries(s.links))n!=="_"&&(a[n]=iE(l));yield a}}}});var QBe=H(rL=>{"use strict";Object.defineProperty(rL,"__esModule",{value:!0});function WD(t){let e=[...t.caches],r=e.shift();return r===void 0?TBe():{get(s,a,n={miss:()=>Promise.resolve()}){return r.get(s,a,n).catch(()=>WD({caches:e}).get(s,a,n))},set(s,a){return r.set(s,a).catch(()=>WD({caches:e}).set(s,a))},delete(s){return r.delete(s).catch(()=>WD({caches:e}).delete(s))},clear(){return r.clear().catch(()=>WD({caches:e}).clear())}}}function TBe(){return{get(t,e,r={miss:()=>Promise.resolve()}){return e().then(a=>Promise.all([a,r.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}rL.createFallbackableCache=WD;rL.createNullCache=TBe});var NBe=H((oAr,FBe)=>{FBe.exports=QBe()});var OBe=H(jY=>{"use strict";Object.defineProperty(jY,"__esModule",{value:!0});function Lyt(t={serializable:!0}){let e={};return{get(r,s,a={miss:()=>Promise.resolve()}){let n=JSON.stringify(r);if(n in e)return Promise.resolve(t.serializable?JSON.parse(e[n]):e[n]);let l=s(),f=a&&a.miss||(()=>Promise.resolve());return l.then(h=>f(h)).then(()=>l)},set(r,s){return e[JSON.stringify(r)]=t.serializable?JSON.stringify(s):s,Promise.resolve(s)},delete(r){return delete e[JSON.stringify(r)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}jY.createInMemoryCache=Lyt});var _Be=H((cAr,LBe)=>{LBe.exports=OBe()});var UBe=H(qf=>{"use strict";Object.defineProperty(qf,"__esModule",{value:!0});function _yt(t,e,r){let s={"x-algolia-api-key":r,"x-algolia-application-id":e};return{headers(){return t===GY.WithinHeaders?s:{}},queryParameters(){return t===GY.WithinQueryParameters?s:{}}}}function Myt(t){let e=0,r=()=>(e++,new Promise(s=>{setTimeout(()=>{s(t(r))},Math.min(100*e,1e3))}));return t(r)}function MBe(t,e=(r,s)=>Promise.resolve()){return Object.assign(t,{wait(r){return MBe(t.then(s=>Promise.all([e(s,r),s])).then(s=>s[1]))}})}function Uyt(t){let e=t.length-1;for(e;e>0;e--){let r=Math.floor(Math.random()*(e+1)),s=t[e];t[e]=t[r],t[r]=s}return t}function Hyt(t,e){return e&&Object.keys(e).forEach(r=>{t[r]=e[r](t)}),t}function jyt(t,...e){let r=0;return t.replace(/%s/g,()=>encodeURIComponent(e[r++]))}var Gyt="4.22.1",qyt=t=>()=>t.transporter.requester.destroy(),GY={WithinQueryParameters:0,WithinHeaders:1};qf.AuthMode=GY;qf.addMethods=Hyt;qf.createAuth=_yt;qf.createRetryablePromise=Myt;qf.createWaitablePromise=MBe;qf.destroy=qyt;qf.encode=jyt;qf.shuffle=Uyt;qf.version=Gyt});var YD=H((uAr,HBe)=>{HBe.exports=UBe()});var jBe=H(qY=>{"use strict";Object.defineProperty(qY,"__esModule",{value:!0});var Vyt={Delete:"DELETE",Get:"GET",Post:"POST",Put:"PUT"};qY.MethodEnum=Vyt});var KD=H((hAr,GBe)=>{GBe.exports=jBe()});var ive=H(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});var VBe=KD();function VY(t,e){let r=t||{},s=r.data||{};return Object.keys(r).forEach(a=>{["timeout","head Line truncated
`;f!==s&&(s=f,t.write(tbe.default.eraseLines(r)+f),r=f.split(`
`).length)};return n.clear=()=>{t.write(tbe.default.eraseLines(r)),s="",r=0},n.done=()=>{s="",r=0,e||(rbe.default.show(),a=!1)},n};sP.default={create:Mwt}});var sbe=H((epr,Uwt)=>{Uwt.exports=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY_BUILD_BASE",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}}]});var cbe=H(Ol=>{"use strict";var abe=sbe(),nA=process.env;Object.defineProperty(Ol,"_vendors",{value:abe.map(function(t){return t.constant})});Ol.name=null;Ol.isPR=null;abe.forEach(function(t){var e=Array.isArray(t.env)?t.env:[t.env],r=e.every(function(s){return obe(s)});if(Ol[t.constant]=r,r)switch(Ol.name=t.name,typeof t.pr){case"string":Ol.isPR=!!nA[t.pr];break;case"object":"env"in t.pr?Ol.isPR=t.pr.env in nA&&nA[t.pr.env]!==t.pr.ne:"any"in t.pr?Ol.isPR=t.pr.any.some(function(s){return!!nA[s]}):Ol.isPR=obe(t.pr);break;default:Ol.isPR=null}});Ol.isCI=!!(nA.CI||nA.CONTINUOUS_INTEGRATION||nA.BUILD_NUMBER||nA.RUN_ID||Ol.name);function obe(t){return typeof t=="string"?!!nA[t]:Object.keys(t).every(function(e){return nA[e]===t[e]})}});var ube=H((rpr,lbe)=>{"use strict";lbe.exports=cbe().isCI});var hbe=H((npr,fbe)=>{"use strict";var Hwt=t=>{let e=new Set;do for(let r of Reflect.ownKeys(t))e.add([t,r]);while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e};fbe.exports=(t,{include:e,exclude:r}={})=>{let s=a=>{let n=l=>typeof l=="string"?a===l:l.test(a);return e?e.some(n):r?!r.some(n):!0};for(let[a,n]of Hwt(t.constructor.prototype)){if(n==="constructor"||!s(n))continue;let l=Reflect.getOwnPropertyDescriptor(a,n);l&&typeof l.value=="function"&&(t[n]=t[n].bind(t))}return t}});var ybe=H(gi=>{"use strict";var J1,cP,CL,kK;typeof performance=="object"&&typeof performance.now=="function"?(Abe=performance,gi.unstable_now=function(){return Abe.now()}):(vK=Date,pbe=vK.now(),gi.unstable_now=function(){return vK.now()-pbe});var Abe,vK,pbe;typeof window>"u"||typeof MessageChannel!="function"?(z1=null,SK=null,bK=function(){if(z1!==null)try{var t=gi.unstable_now();z1(!0,t),z1=null}catch(e){throw setTimeout(bK,0),e}},J1=function(t){z1!==null?setTimeout(J1,0,t):(z1=t,setTimeout(bK,0))},cP=function(t,e){SK=setTimeout(t,e)},CL=function(){clearTimeout(SK)},gi.unstable_shouldYield=function(){return!1},kK=gi.unstable_forceFrameRate=function(){}):(dbe=window.setTimeout,gbe=window.clearTimeout,typeof console<"u"&&(mbe=window.cancelAnimationFrame,typeof window.requestAnimationFrame!="function"&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),typeof mbe!="function"&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")),oP=!1,aP=null,EL=-1,DK=5,PK=0,gi.unstable_shouldYield=function(){return gi.unstable_now()>=PK},kK=function(){},gi.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):DK=0<t?Math Line truncated
`+Xu+S}var ve=!1;function Jt(S,b){if(!S||ve)return"";ve=!0;var T=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(b)if(b=function(){throw Error()},Object.defineProperty(b.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(b,[])}catch(wt){var q=wt}Reflect.construct(S,[],b)}else{try{b.call()}catch(wt){q=wt}S.call(b.prototype)}else{try{throw Error()}catch(wt){q=wt}S()}}catch(wt){if(wt&&q&&typeof wt.stack=="string"){for(var z=wt.stack.split(`
`),oe=q.stack.split(`
`),Se=z.length-1,qe=oe.length-1;1<=Se&&0<=qe&&z[Se]!==oe[qe];)qe--;for(;1<=Se&&0<=qe;Se--,qe--)if(z[Se]!==oe[qe]){if(Se!==1||qe!==1)do if(Se--,qe--,0>qe||z[Se]!==oe[qe])return`
`+z[Se].replace(" at new "," at ");while(1<=Se&&0<=qe);break}}}finally{ve=!1,Error.prepareStackTrace=T}return(S=S?S.displayName||S.name:"")?Vl(S):""}var Wl=[],as=-1;function To(S){return{current:S}}function Vt(S){0>as||(S.current=Wl[as],Wl[as]=null,as--)}function ei(S,b){as++,Wl[as]=S.current,S.current=b}var Ha={},As=To(Ha),cs=To(!1),Ic=Ha;function Un(S,b){var T=S.type.contextTypes;if(!T)return Ha;var q=S.stateNode;if(q&&q.__reactInternalMemoizedUnmaskedChildContext===b)return q.__reactInternalMemoizedMaskedChildContext;var z={},oe;for(oe in T)z[oe]=b[oe];return q&&(S=S.stateNode,S.__reactInternalMemoizedUnmaskedChildContext=b,S.__reactInternalMemoizedMaskedChildContext=z),z}function Ei(S){return S=S.childContextTypes,S!=null}function $u(){Vt(cs),Vt(As)}function Ud(S,b,T){if(As.current!==Ha)throw Error(l(168));ei(As,b),ei(cs,T)}function wc(S,b,T){var q=S.stateNode;if(S=b.childContextTypes,typeof q.getChildContext!="function")return T;q=q.getChildContext();for(var z in q)if(!(z in S))throw Error(l(108,d(b)||"Unknown",z));return s({},T,q)}function Cc(S){return S=(S=S.stateNode)&&S.__reactInternalMemoizedMergedChildContext||Ha,Ic=As.current,ei(As,S),ei(cs,cs.current),!0}function Bc(S,b,T){var q=S.stateNode;if(!q)throw Error(l(169));T?(S=wc(S,b,Ic),q.__reactInternalMemoizedMergedChildContext=S,Vt(cs),Vt(As),ei(As,S)):Vt(cs),ei(cs,T)}var it=null,vc=null,ah=n.unstable_now;ah();var Yl=0,Yn=8;function ja(S){if(1&S)return Yn=15,1;if(2&S)return Yn=14,2;if(4&S)return Yn=13,4;var b=24&S;return b!==0?(Yn=12,b):S&32?(Yn=11,32):(b=192&S,b!==0?(Yn=10,b):S&256?(Yn=9,256):(b=3584&S,b!==0?(Yn=8,b):S&4096?(Yn=7,4096):(b=4186112&S,b!==0?(Yn=6,b):(b=62914560&S,b!==0?(Yn=5,b):S&67108864?(Yn=4,67108864):S&134217728?(Yn=3,134217728):(b=805306368&S,b!==0?(Yn=2,b):1073741824&S?(Yn=1,1073741824):(Yn=8,S))))))}function VA(S){switch(S){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}function WA(S){switch(S){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(l(358,S))}}function Ga(S,b){var T=S.pendingLanes;if(T===0)return Yn=0;var q=0,z=0,oe=S.expiredLanes,Se=S.suspendedLanes,qe=S.pingedLanes;if(oe!==0)q=oe,z=Yn=15;else if(oe=T&134217727,oe!==0){var wt=oe&~Se;wt!==0?(q=ja(wt),z=Yn):(qe&=oe,qe!==0&&(q=ja(qe),z=Yn))}else oe=T&~Se,oe!==0?(q=ja(oe),z=Yn):qe!==0&&(q=ja(qe),z=Yn);if(q===0)return 0;if(q=31-ks(q),q=T&((0>q?0:1<<q)<<1)-1,b!==0&&b!==q&&!(b&Se)){if(ja(b),z<=Yn)return b;Yn=z}if(b=S.entangledLanes,b!==0)for(S=S.entanglements,b&=q;0<b;)T=31-ks(b),z=1<<T,q|=S[T],b&=~z;return q}function ll(S){return S=S.pendingLanes&-1073741825,S!==0?S:S&1073741824?1073741824:0}function rr(S,b){switch(S){case 15:return 1;case 14:return 2;case 12:return S=ti(24&~b),S===0?rr(10,b):S;case 10:return S=ti(192&~b),S===0?rr(8,b):S;case 8:return S=ti(3584&~b),S===0&&(S=ti(4186112&~b),S===0&&(S=512)),S;case 2:return b=ti(805306368&~b),b===0&&(b=268435456),b}throw Error(l(358,S))}function ti(S){return S&-S}function qa(S){for(var b=[],T=0;31>T;T++)b.push(S);return b}function Sc(S,b,T){S.pendingLanes|=b;var q=b-1;S.suspendedLanes&=q,S.pingedLanes&=q,S=S.eventTimes,b=31-ks(b),S[b]=T}var ks=Math.clz32?Math.clz32:zl,Kl=Math.log,ef=Math.LN2;function zl(S){return S===0?32:31-(Kl(S)/ef|0)|0}var bc=n.unstable_runWithPriority,ls=n.unstable_scheduleCallback,Ys=n.unstable_cancelCallback,ul=n.unstable_shouldYield,ch=n.unstable_requestPaint,Jl=n.unstable_now,zi=n.unstable_getCurrentPriorityLevel,ri=n.unstable_ImmediatePriority,Zl=n.unstable_UserBlockingPriority,et=n.unstable_NormalPriority,dt=n.unstable_LowPriority,_t=n.unstable_IdlePriority,Sr={},ne=ch!==void 0?ch:function(){},Be=null,_e=null,bt=!1,xt=Jl(),jt=1e4>xt?Jl:function(){return Jl()-xt};function Ir(){switch(zi()){case ri:return 99;case Zl:return 98;case et:return 97;case dt:return 96;case _t:return 95;default:throw Error(l(332))}}function Nn(S){switch(S){case 99:return ri;case 98:return Zl;case 97:return et;case 96:return dt;case 95:return _t;default:throw Error(l(332))}}function Qi(S,b){return S=Nn(S),bc(S,b)}function ps(S,b,T){return S=Nn(S),ls(S,b,T)}function ni(){if(_e!==null){var S=_e;_e=null,Ys(S)}Dc()}function Dc(){if(!bt&&Be!==null){bt=!0;var S=0;try{var b=Be;Qi(99,function(){for(;S<b.length;S++){var T=b[S];do T=T(!0);while(T!==null)}}),Be=null}catch(T){throw Be!==null&&(Be=Be.slice(S+1)),ls(ri,ni),T}finally{bt=!1}}}var mI=f.ReactCurrentBatchConfig;function Iv(S,b){return S===b&&(S!==0||1/S===1/b)||S!==S&&b!==b}var Xo=typeof Object.is=="function"?Object.is:Iv,yI=Object.prototype.hasOwnProperty;function Hd(S,b){if(Xo(S,b))return!0;if(typeof S!="object"||S===null||typeof b!="object"||b===null)return!1;var T=Object.keys(S),q=Object.keys(b);if(T.length!==q.length)return!1;for(q=0;q<T.length;q++)if(!yI.call(b,T[q])||!Xo(S[T[q]],b[T[q]]))return!1;return!0}function wv(S){switch(S.tag){case 5:return Vl(S.type);case 16:return Vl("Lazy" Line truncated
Error generating stack: `+oe.message+`
`+oe.stack}return{value:S,source:b,stack:z}}function xm(S,b){try{console.error(b.value)}catch(T){setTimeout(function(){throw T})}}var H8=typeof WeakMap=="function"?WeakMap:Map;function bv(S,b,T){T=hl(-1,T),T.tag=3,T.payload={element:null};var q=b.value;return T.callback=function(){UI||(UI=!0,Uv=q),xm(S,b)},T}function km(S,b,T){T=hl(-1,T),T.tag=3;var q=S.type.getDerivedStateFromError;if(typeof q=="function"){var z=b.value;T.payload=function(){return xm(S,b),q(z)}}var oe=S.stateNode;return oe!==null&&typeof oe.componentDidCatch=="function"&&(T.callback=function(){typeof q!="function"&&($l===null?$l=new Set([this]):$l.add(this),xm(S,b));var Se=b.stack;this.componentDidCatch(b.value,{componentStack:Se!==null?Se:""})}),T}var j8=typeof WeakSet=="function"?WeakSet:Set;function Dv(S){var b=S.ref;if(b!==null)if(typeof b=="function")try{b(null)}catch(T){Ch(S,T)}else b.current=null}function xI(S,b){switch(b.tag){case 0:case 11:case 15:case 22:return;case 1:if(b.flags&256&&S!==null){var T=S.memoizedProps,q=S.memoizedState;S=b.stateNode,b=S.getSnapshotBeforeUpdate(b.elementType===b.type?T:$o(b.type,T),q),S.__reactInternalSnapshotBeforeUpdate=b}return;case 3:F&&b.flags&256&&Er(b.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(l(163))}function e0(S,b){if(b=b.updateQueue,b=b!==null?b.lastEffect:null,b!==null){var T=b=b.next;do{if((T.tag&S)===S){var q=T.destroy;T.destroy=void 0,q!==void 0&&q()}T=T.next}while(T!==b)}}function DR(S,b,T){switch(T.tag){case 0:case 11:case 15:case 22:if(b=T.updateQueue,b=b!==null?b.lastEffect:null,b!==null){S=b=b.next;do{if((S.tag&3)===3){var q=S.create;S.destroy=q()}S=S.next}while(S!==b)}if(b=T.updateQueue,b=b!==null?b.lastEffect:null,b!==null){S=b=b.next;do{var z=S;q=z.next,z=z.tag,z&4&&z&1&&(HR(T,S),Z8(T,S)),S=q}while(S!==b)}return;case 1:S=T.stateNode,T.flags&4&&(b===null?S.componentDidMount():(q=T.elementType===T.type?b.memoizedProps:$o(T.type,b.memoizedProps),S.componentDidUpdate(q,b.memoizedState,S.__reactInternalSnapshotBeforeUpdate))),b=T.updateQueue,b!==null&&wI(T,b,S);return;case 3:if(b=T.updateQueue,b!==null){if(S=null,T.child!==null)switch(T.child.tag){case 5:S=Te(T.child.stateNode);break;case 1:S=T.child.stateNode}wI(T,b,S)}return;case 5:S=T.stateNode,b===null&&T.flags&4&&Ft(S,T.type,T.memoizedProps,T);return;case 6:return;case 4:return;case 12:return;case 13:X&&T.memoizedState===null&&(T=T.alternate,T!==null&&(T=T.memoizedState,T!==null&&(T=T.dehydrated,T!==null&&Zu(T))));return;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(l(163))}function PR(S,b){if(F)for(var T=S;;){if(T.tag===5){var q=T.stateNode;b?Nt(q):Xt(T.stateNode,T.memoizedProps)}else if(T.tag===6)q=T.stateNode,b?hr(q):$t(q,T.memoizedProps);else if((T.tag!==23&&T.tag!==24||T.memoizedState===null||T===S)&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===S)break;for(;T.sibling===null;){if(T.return===null||T.return===S)return;T=T.return}T.sibling.return=T.return,T=T.sibling}}function kI(S,b){if(vc&&typeof vc.onCommitFiberUnmount=="function")try{vc.onCommitFiberUnmount(it,b)}catch{}switch(b.tag){case 0:case 11:case 14:case 15:case 22:if(S=b.updateQueue,S!==null&&(S=S.lastEffect,S!==null)){var T=S=S.next;do{var q=T,z=q.destroy;if(q=q.tag,z!==void 0)if(q&4)HR(b,T);else{q=b;try{z()}catch(oe){Ch(q,oe)}}T=T.next}while(T!==S)}break;case 1:if(Dv(b),S=b.stateNode,typeof S.componentWillUnmount=="function")try{S.props=b.memoizedProps,S.state=b.memoizedState,S.componentWillUnmount()}catch(oe){Ch(b,oe)}break;case 5:Dv(b);break;case 4:F?TR(S,b):Z&&Z&&(b=b.stateNode.containerInfo,S=Tn(b),La(b,S))}}function xR(S,b){for(var T=b;;)if(kI(S,T),T.child===null||F&&T.tag===4){if(T===b)break;for(;T.sibling===null;){if(T.return===null||T.return===b)return;T=T.return}T.sibling.return=T.return,T=T.sibling}else T.child.return=T,T=T.child}function RI(S){S.alternate=null,S.child=null,S.dependencies=null,S.firstEffect=null,S.lastEffect=null,S.memoizedProps=null,S.memoizedState=null,S.pendingProps=null,S.return=null,S.updateQueue=null}function kR(S){return S.tag===5||S.tag===3||S.tag===4}function RR(S){if(F){e:{for(var b=S.return;b!==null;){if(kR(b))break e;b=b.return}throw Error(l(160))}var T=b;switch(b=T.stateNode,T.tag){case 5:var q=!1;break;case 3:b=b.containerInfo,q=!0;break;case 4:b=b.containerInfo,q=!0;break;default:throw Error(l(161))}T.flags&16&&(Lt(b),T.flags&=-17);e:t:for(T=S;;){for(;T.sibling===null;){if(T.return===null||kR(T.return)){T=null;break e}T=T.return}for(T.sibling.return=T.return,T=T.sibling;T.tag!==5&&T.tag!==6&&T.tag!==18;){if(T.flags&2||T.child===null||T.tag===4)continue t;T.child.return=T,T=T.child}if(!(T.flags&2)){T=T.stateNode;break e}}q?Pv(S,T,b):xv(S,T,b)}}function Pv(S,b,T){var q=S.tag,z=q===5||q===6;if(z)S=z?S.stateNode:S.stateNode.instance,b?Tt(T,S,b):Bt(T,S);else if(q!==4&&(S=S.child,S!==null))for(Pv(S,b,T),S=S.sibling;S!==null;)Pv(S,b,T),S=S.sibling}function xv(S,b,T){var q=S.tag,z=q===5||q===6;if(z)S=z?S.stateNode:S.stateNode.instance,b?Ze(T,S,b):lt(T,S);els Line truncated
Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`)}zs!==5&&(zs=2),wt=Pm(wt,qe),gr=Se;do{switch(gr.tag){case 3:oe=wt,gr.flags|=4096,b&=-b,gr.lanes|=b;var Bi=bv(gr,oe,b);II(gr,Bi);break e;case 1:oe=wt;var Zr=gr.type,ii=gr.stateNode;if(!(gr.flags&64)&&(typeof Zr.getDerivedStateFromError=="function"||ii!==null&&typeof ii.componentDidCatch=="function"&&($l===null||!$l.has(ii)))){gr.flags|=4096,b&=-b,gr.lanes|=b;var li=km(gr,oe,b);II(gr,li);break e}}gr=gr.return}while(gr!==null)}UR(T)}catch(yn){b=yn,Cs===T&&T!==null&&(Cs=T=T.return);continue}break}while(!0)}function _R(){var S=_I.current;return _I.current=qt,S===null?qt:S}function Um(S,b){var T=Kr;Kr|=16;var q=_R();Fo===S&&oo===b||i0(S,b);do try{Y8();break}catch(z){LR(S,z)}while(!0);if(gm(),Kr=T,_I.current=q,Cs!==null)throw Error(l(261));return Fo=null,oo=0,zs}function Y8(){for(;Cs!==null;)MR(Cs)}function K8(){for(;Cs!==null&&!ul();)MR(Cs)}function MR(S){var b=qR(S.alternate,S,op);S.memoizedProps=S.pendingProps,b===null?UR(S):Cs=b,Qv.current=null}function UR(S){var b=S;do{var T=b.alternate;if(S=b.return,b.flags&2048){if(T=U8(b),T!==null){T.flags&=2047,Cs=T;return}S!==null&&(S.firstEffect=S.lastEffect=null,S.flags|=2048)}else{if(T=M8(T,b,op),T!==null){Cs=T;return}if(T=b,T.tag!==24&&T.tag!==23||T.memoizedState===null||op&1073741824||!(T.mode&4)){for(var q=0,z=T.child;z!==null;)q|=z.lanes|z.childLanes,z=z.sibling;T.childLanes=q}S!==null&&!(S.flags&2048)&&(S.firstEffect===null&&(S.firstEffect=b.firstEffect),b.lastEffect!==null&&(S.lastEffect!==null&&(S.lastEffect.nextEffect=b.firstEffect),S.lastEffect=b.lastEffect),1<b.flags&&(S.lastEffect!==null?S.lastEffect.nextEffect=b:S.firstEffect=b,S.lastEffect=b))}if(b=b.sibling,b!==null){Cs=b;return}Cs=b=S}while(b!==null);zs===0&&(zs=5)}function ap(S){var b=Ir();return Qi(99,z8.bind(null,S,b)),null}function z8(S,b){do hf();while(Nm!==null);if(Kr&48)throw Error(l(327));var T=S.finishedWork;if(T===null)return null;if(S.finishedWork=null,S.finishedLanes=0,T===S.current)throw Error(l(177));S.callbackNode=null;var q=T.lanes|T.childLanes,z=q,oe=S.pendingLanes&~z;S.pendingLanes=z,S.suspendedLanes=0,S.pingedLanes=0,S.expiredLanes&=z,S.mutableReadLanes&=z,S.entangledLanes&=z,z=S.entanglements;for(var Se=S.eventTimes,qe=S.expirationTimes;0<oe;){var wt=31-ks(oe),cr=1<<wt;z[wt]=0,Se[wt]=-1,qe[wt]=-1,oe&=~cr}if(uf!==null&&!(q&24)&&uf.has(S)&&uf.delete(S),S===Fo&&(Cs=Fo=null,oo=0),1<T.flags?T.lastEffect!==null?(T.lastEffect.nextEffect=T,q=T.firstEffect):q=T:q=T.firstEffect,q!==null){z=Kr,Kr|=32,Qv.current=null,_m=rt(S.containerInfo),Mm=!1,Br=q;do try{J8()}catch(Ke){if(Br===null)throw Error(l(330));Ch(Br,Ke),Br=Br.nextEffect}while(Br!==null);_m=null,Br=q;do try{for(Se=S;Br!==null;){var qr=Br.flags;if(qr&16&&F&&Lt(Br.stateNode),qr&128){var rn=Br.alternate;if(rn!==null){var gr=rn.ref;gr!==null&&(typeof gr=="function"?gr(null):gr.current=null)}}switch(qr&1038){case 2:RR(Br),Br.flags&=-3;break;case 6:RR(Br),Br.flags&=-3,kv(Br.alternate,Br);break;case 1024:Br.flags&=-1025;break;case 1028:Br.flags&=-1025,kv(Br.alternate,Br);break;case 4:kv(Br.alternate,Br);break;case 8:qe=Se,oe=Br,F?TR(qe,oe):xR(qe,oe);var Ii=oe.alternate;RI(oe),Ii!==null&&RI(Ii)}Br=Br.nextEffect}}catch(Ke){if(Br===null)throw Error(l(330));Ch(Br,Ke),Br=Br.nextEffect}while(Br!==null);Mm&&pt(),Ne(S.containerInfo),S.current=T,Br=q;do try{for(qr=S;Br!==null;){var ji=Br.flags;if(ji&36&&DR(qr,Br.alternate,Br),ji&128){rn=void 0;var Fc=Br.ref;if(Fc!==null){var at=Br.stateNode;switch(Br.tag){case 5:rn=Te(at);break;default:rn=at}typeof Fc=="function"?Fc(rn):Fc.current=rn}}Br=Br.nextEffect}}catch(Ke){if(Br===null)throw Error(l(330));Ch(Br,Ke),Br=Br.nextEffect}while(Br!==null);Br=null,ne(),Kr=z}else S.current=T;if(wh)wh=!1,Nm=S,Om=b;else for(Br=q;Br!==null;)b=Br.nextEffect,Br.nextEffect=null,Br.flags&8&&(ji=Br,ji.sibling=null,ji.stateNode=null),Br=b;if(q=S.pendingLanes,q===0&&($l=null),q===1?S===Gv?Lm++:(Lm=0,Gv=S):Lm=0,T=T.stateNode,vc&&typeof vc.onCommitFiberRoot=="function")try{vc.onCommitFiberRoot(it,T,void 0,(T.current.flags&64)===64)}catch{}if(Ka(S,jt()),UI)throw UI=!1,S=Uv,Uv=null,S;return Kr&8||ni(),null}function J8(){for(;Br!==null;){var S=Br.alternate;Mm||_m===null||(Br.flags&8?De(Br,_m)&&(Mm=!0,Le()):Br.tag===13&&G8(S,Br)&&De(Br,_m)&&(Mm=!0,Le()));var b=Br.flags;b&256&&xI(S,Br),!(b&512)||wh||(wh=!0,ps(97,function(){return hf(),null})),Br=Br.nextEffect}}function hf(){if(Om!==90){var S=97<Om?97:Om;return Om=90,Qi(S,X8)}return!1}function Z8(S,b){Hv.push(b,S),wh||(wh=!0,ps(97,function(){return hf(),null}))}function HR(S,b){jv.push(b,S),wh||(wh=!0,ps(97,function(){return hf(),null}))}function X8(){if(Nm===null)return!1;var S=Nm;if(Nm=null,Kr&48)throw Error(l(331));var b=Kr;Kr|=32;var T=jv;jv=[];for(var q=0;q<T.length;q+=2){var z=T[q],oe=T[q+1],Se=z.destroy;if(z.destroy=void 0,typeof Se=="function")try{Se()}catch(wt){if(oe===null)throw Error(l(330));Ch(oe,wt)}}for(T=Hv,Hv=[],q=0;q<T.length;q+=2){z=T[q],oe=T[q+1];try{va Line truncated
`+(q.join(" > ")+`
No matching component was found for:
`)+S.join(" > ")}return null},r.getPublicRootInstance=function(S){if(S=S.current,!S.child)return null;switch(S.child.tag){case 5:return Te(S.child.stateNode);default:return S.child.stateNode}},r.injectIntoDevTools=function(S){if(S={bundleType:S.bundleType,version:S.version,rendererPackageName:S.rendererPackageName,rendererConfig:S.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:f.ReactCurrentDispatcher,findHostInstanceByFiber:n3,findFiberByHostInstance:S.findFiberByHostInstance||i3,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")S=!1;else{var b=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!b.isDisabled&&b.supportsFiber)try{it=b.inject(S),vc=b}catch{}S=!0}return S},r.observeVisibleRects=function(S,b,T,q){if(!er)throw Error(l(363));S=Tv(S,b);var z=Ue(S,T,q).disconnect;return{disconnect:function(){z()}}},r.registerMutableSourceForHydration=function(S,b){var T=b._getVersion;T=T(b._source),S.mutableSourceEagerHydrationData==null?S.mutableSourceEagerHydrationData=[b,T]:S.mutableSourceEagerHydrationData.push(b,T)},r.runWithPriority=function(S,b){var T=Yl;try{return Yl=S,b()}finally{Yl=T}},r.shouldSuspend=function(){return!1},r.unbatchedUpdates=function(S,b){var T=Kr;Kr&=-2,Kr|=8;try{return S(b)}finally{Kr=T,Kr===0&&(Ih(),ni())}},r.updateContainer=function(S,b,T,q){var z=b.current,oe=ia(),Se=Js(z);e:if(T){T=T._reactInternals;t:{if(be(T)!==T||T.tag!==1)throw Error(l(170));var qe=T;do{switch(qe.tag){case 3:qe=qe.stateNode.context;break t;case 1:if(Ei(qe.type)){qe=qe.stateNode.__reactInternalMemoizedMergedChildContext;break t}}qe=qe.return}while(qe!==null);throw Error(l(171))}if(T.tag===1){var wt=T.type;if(Ei(wt)){T=wc(T,wt,qe);break e}}T=qe}else T=Ha;return b.context===null?b.context=T:b.pendingContext=T,b=hl(oe,Se),b.payload={element:S},q=q===void 0?null:q,q!==null&&(b.callback=q),Al(z,b),yl(z,Se,oe),Se},r}});var Cbe=H((apr,wbe)=>{"use strict";wbe.exports=Ibe()});var vbe=H((cpr,Bbe)=>{"use strict";var qwt={ALIGN_COUNT:8,ALIGN_AUTO:0,ALIGN_FLEX_START:1,ALIGN_CENTER:2,ALIGN_FLEX_END:3,ALIGN_STRETCH:4,ALIGN_BASELINE:5,ALIGN_SPACE_BETWEEN:6,ALIGN_SPACE_AROUND:7,DIMENSION_COUNT:2,DIMENSION_WIDTH:0,DIMENSION_HEIGHT:1,DIRECTION_COUNT:3,DIRECTION_INHERIT:0,DIRECTION_LTR:1,DIRECTION_RTL:2,DISPLAY_COUNT:2,DISPLAY_FLEX:0,DISPLAY_NONE:1,EDGE_COUNT:9,EDGE_LEFT:0,EDGE_TOP:1,EDGE_RIGHT:2,EDGE_BOTTOM:3,EDGE_START:4,EDGE_END:5,EDGE_HORIZONTAL:6,EDGE_VERTICAL:7,EDGE_ALL:8,EXPERIMENTAL_FEATURE_COUNT:1,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:0,FLEX_DIRECTION_COUNT:4,FLEX_DIRECTION_COLUMN:0,FLEX_DIRECTION_COLUMN_REVERSE:1,FLEX_DIRECTION_ROW:2,FLEX_DIRECTION_ROW_REVERSE:3,JUSTIFY_COUNT:6,JUSTIFY_FLEX_START:0,JUSTIFY_CENTER:1,JUSTIFY_FLEX_END:2,JUSTIFY_SPACE_BETWEEN:3,JUSTIFY_SPACE_AROUND:4,JUSTIFY_SPACE_EVENLY:5,LOG_LEVEL_COUNT:6,LOG_LEVEL_ERROR:0,LOG_LEVEL_WARN:1,LOG_LEVEL_INFO:2,LOG_LEVEL_DEBUG:3,LOG_LEVEL_VERBOSE:4,LOG_LEVEL_FATAL:5,MEASURE_MODE_COUNT:3,MEASURE_MODE_UNDEFINED:0,MEASURE_MODE_EXACTLY:1,MEASURE_MODE_AT_MOST:2,NODE_TYPE_COUNT:2,NODE_TYPE_DEFAULT:0,NODE_TYPE_TEXT:1,OVERFLOW_COUNT:3,OVERFLOW_VISIBLE:0,OVERFLOW_HIDDEN:1,OVERFLOW_SCROLL:2,POSITION_TYPE_COUNT:2,POSITION_TYPE_RELATIVE:0,POSITION_TYPE_ABSOLUTE:1,PRINT_OPTIONS_COUNT:3,PRINT_OPTIONS_LAYOUT:1,PRINT_OPTIONS_STYLE:2,PRINT_OPTIONS_CHILDREN:4,UNIT_COUNT:4,UNIT_UNDEFINED:0,UNIT_POINT:1,UNIT_PERCENT:2,UNIT_AUTO:3,WRAP_COUNT:3,WRAP_NO_WRAP:0,WRAP_WRAP:1,WRAP_WRAP_REVERSE:2};Bbe.exports=qwt});var Pbe=H((lpr,Dbe)=>{"use strict";var Vwt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},SL=function(){function t(e,r){for(var s=0;s<r.length;s++){var a=r[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,r,s){return r&&t(e.prototype,r),s&&t(e,s),e}}();function OK(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function LK(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Wf=vbe(),Wwt=function(){function t(e,r,s,a,n,l){LK(this,t),this.left=e,this.right=r,this.top=s,this.bottom=a,this.width=n,this.height=l}return SL(t,[{key:"fromJS",value:function(r){r(this.left,this.right,this.top,this.bottom,this.width,this.height)}},{key:"toString",value:function(){return"<Layout#"+this.left+":"+this.right+";"+this.top+":"+this.bottom+";"+this.width+":"+this.height+">"}}]),t}(),Sbe=function(){SL(t,null,[{key:"fromJS",value:function(r){var s=r.width,a=r.height;return new t(s,a)}}]);function t(e,r){LK(this,t),this.width=e,this.height=r}return SL(t,[{key:"fromJS",value:function(r){r(this.width,this.height)}},{key:"toStri Line truncated
`+Module.extraStackTrace()),demangleAll(t)}Module.stackTrace=stackTrace;var HEAP,buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module.HEAP8=HEAP8=new Int8Array(buffer),Module.HEAP16=HEAP16=new Int16Array(buffer),Module.HEAP32=HEAP32=new Int32Array(buffer),Module.HEAPU8=HEAPU8=new Uint8Array(buffer),Module.HEAPU16=HEAPU16=new Uint16Array(buffer),Module.HEAPU32=HEAPU32=new Uint32Array(buffer),Module.HEAPF32=HEAPF32=new Float32Array(buffer),Module.HEAPF64=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed,STACK_BASE,STACKTOP,STACK_MAX,DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0,staticSealed=!1;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module.TOTAL_STACK||5242880,TOTAL_MEMORY=Module.TOTAL_MEMORY||134217728;TOTAL_MEMORY<TOTAL_STACK&&Module.printErr("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+TOTAL_MEMORY+"! (TOTAL_STACK="+TOTAL_STACK+")"),Module.buffer?buffer=Module.buffer:buffer=new ArrayBuffer(TOTAL_MEMORY),updateGlobalBufferViews();function getTotalMemory(){return TOTAL_MEMORY}if(HEAP32[0]=1668509029,HEAP16[1]=25459,HEAPU8[2]!==115||HEAPU8[3]!==99)throw"Runtime error: expected the system to be little-endian!";Module.HEAP=HEAP,Module.buffer=buffer,Module.HEAP8=HEAP8,Module.HEAP16=HEAP16,Module.HEAP32=HEAP32,Module.HEAPU8=HEAPU8,Module.HEAPU16=HEAPU16,Module.HEAPU32=HEAPU32,Module.HEAPF32=HEAPF32,Module.HEAPF64=HEAPF64;function callRuntimeCallbacks(t){for(;t.length>0;){var e=t.shift();if(typeof e=="function"){e();continue}var r=e.func;typeof r=="number"?e.arg===void 0?Module.dynCall_v(r):Module.dynCall_vi(r,e.arg):r(e.arg===void 0?null:e.arg)}}var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATEXIT__=[],__ATPOSTRUN__=[],runtimeInitialized=!1,runtimeExited=!1;function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){runtimeInitialized||(runtimeInitialized=!0,callRuntimeCallbacks(__ATINIT__))}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__),runtimeExited=!0}function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(t){__ATPRERUN__.unshift(t)}Module.addOnPreRun=addOnPreRun;function addOnInit(t){__ATINIT__.unshift(t)}Module.addOnInit=addOnInit;function addOnPreMain(t){__ATMAIN__.unshift(t)}Module.addOnPreMain=addOnPreMain;function addOnExit(t){__ATEXIT__.unshift(t)}Module.addOnExit=addOnExit;function addOnPostRun(t){__ATPOSTRUN__.unshift(t)}Module.addOnPostRun=addOnPostRun;function intArrayFromString(t,e,r){var s=r>0?r:lengthBytesUTF8(t)+1,a=new Array(s),n=stringToUTF8Array(t,a,0,a.length);return e&&(a.length=n),a}Module.intArrayFromString=intArrayFromString;function intArrayToString(t){for(var e=[],r=0;r<t.length;r++){var s=t[r];s>255&&(s&=255),e.push(String.fromCharCode(s))}return e.join("")}Module.intArrayToString=intArrayToString;function writeStringToMemory(t,e,r){Runtime.warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");var s,a;r&&(a=e+lengthBytesUTF8(t),s=HEAP8[a]),stringToUTF8(t,e,1/0),r&&(HEAP8[a]=s)}Module.writeStringToMemory=writeStringToMemory;function writeArrayToMemory(t,e){HEAP8.set(t,e)}Module.writeArrayToMemory=writeArrayToMemory;function writeAsciiToMemory(t,e,r){for(var s=0;s<t.length;++s)HEAP8[e++>>0]=t.charCodeAt(s);r||(HEAP8[e>>0]=0)}if(Module.writeAsciiToMemory=writeAsciiToMemory,(!Math.imul||Math.imul(4294967295,5)!==-5)&&(Math.imul=function t(e,r){var s=e>>>16,a=e&65535,n=r>>>16,l=r&65535;return a*l+(s*l+a*n<<16)|0}),Math.imul=Math.imul,!Math.fround){var froundBuffer=new Float32Array(1);Math.fround=function(t){return froundBuffer[0]=t,froundBuffer[0]}}Math.fround=Math.fround,Math.clz32||(Math.clz32=function(t){t=t>>>0;for(var e=0;e<32;e++)if(t&1<<31-e)return e;return 32}),Math.clz32=Math.clz32,Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Math.trunc=Math.trunc;var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.cei Line truncated
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.`,r="abort("+t+") at "+stackTrace()+e;throw abortDecorators&&abortDecorators.forEach(function(s){r=s(r,t)}),r}if(Module.abort=Module.abort=abort,Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var shouldRunNow=!0;Module.noInitialRun&&(shouldRunNow=!1),run()})});var uE=H((fpr,kbe)=>{"use strict";var Ywt=Pbe(),Kwt=xbe(),_K=!1,MK=null;Kwt({},function(t,e){if(!_K){if(_K=!0,t)throw t;MK=e}});if(!_K)throw new Error("Failed to load the yoga module - it needed to be loaded synchronously, but didn't");kbe.exports=Ywt(MK.bind,MK.lib)});var HK=H((hpr,UK)=>{"use strict";var Rbe=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);UK.exports=Rbe;UK.exports.default=Rbe});var Qbe=H((Apr,Tbe)=>{"use strict";Tbe.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E Line truncated
`))e=Math.max(e,Xwt(r));return e};GK.exports=Nbe;GK.exports.default=Nbe});var Obe=H(hP=>{"use strict";var $wt=hP&&hP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(hP,"__esModule",{value:!0});var eCt=$wt(qK()),VK={};hP.default=t=>{if(t.length===0)return{width:0,height:0};if(VK[t])return VK[t];let e=eCt.default(t),r=t.split(`
`).length;return VK[t]={width:e,height:r},{width:e,height:r}}});var Lbe=H(AP=>{"use strict";var tCt=AP&&AP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(AP,"__esModule",{value:!0});var Xn=tCt(uE()),rCt=(t,e)=>{"position"in e&&t.setPositionType(e.position==="absolute"?Xn.default.POSITION_TYPE_ABSOLUTE:Xn.default.POSITION_TYPE_RELATIVE)},nCt=(t,e)=>{"marginLeft"in e&&t.setMargin(Xn.default.EDGE_START,e.marginLeft||0),"marginRight"in e&&t.setMargin(Xn.default.EDGE_END,e.marginRight||0),"marginTop"in e&&t.setMargin(Xn.default.EDGE_TOP,e.marginTop||0),"marginBottom"in e&&t.setMargin(Xn.default.EDGE_BOTTOM,e.marginBottom||0)},iCt=(t,e)=>{"paddingLeft"in e&&t.setPadding(Xn.default.EDGE_LEFT,e.paddingLeft||0),"paddingRight"in e&&t.setPadding(Xn.default.EDGE_RIGHT,e.paddingRight||0),"paddingTop"in e&&t.setPadding(Xn.default.EDGE_TOP,e.paddingTop||0),"paddingBottom"in e&&t.setPadding(Xn.default.EDGE_BOTTOM,e.paddingBottom||0)},sCt=(t,e)=>{var r;"flexGrow"in e&&t.setFlexGrow((r=e.flexGrow)!==null&&r!==void 0?r:0),"flexShrink"in e&&t.setFlexShrink(typeof e.flexShrink=="number"?e.flexShrink:1),"flexDirection"in e&&(e.flexDirection==="row"&&t.setFlexDirection(Xn.default.FLEX_DIRECTION_ROW),e.flexDirection==="row-reverse"&&t.setFlexDirection(Xn.default.FLEX_DIRECTION_ROW_REVERSE),e.flexDirection==="column"&&t.setFlexDirection(Xn.default.FLEX_DIRECTION_COLUMN),e.flexDirection==="column-reverse"&&t.setFlexDirection(Xn.default.FLEX_DIRECTION_COLUMN_REVERSE)),"flexBasis"in e&&(typeof e.flexBasis=="number"?t.setFlexBasis(e.flexBasis):typeof e.flexBasis=="string"?t.setFlexBasisPercent(Number.parseInt(e.flexBasis,10)):t.setFlexBasis(NaN)),"alignItems"in e&&((e.alignItems==="stretch"||!e.alignItems)&&t.setAlignItems(Xn.default.ALIGN_STRETCH),e.alignItems==="flex-start"&&t.setAlignItems(Xn.default.ALIGN_FLEX_START),e.alignItems==="center"&&t.setAlignItems(Xn.default.ALIGN_CENTER),e.alignItems==="flex-end"&&t.setAlignItems(Xn.default.ALIGN_FLEX_END)),"alignSelf"in e&&((e.alignSelf==="auto"||!e.alignSelf)&&t.setAlignSelf(Xn.default.ALIGN_AUTO),e.alignSelf==="flex-start"&&t.setAlignSelf(Xn.default.ALIGN_FLEX_START),e.alignSelf==="center"&&t.setAlignSelf(Xn.default.ALIGN_CENTER),e.alignSelf==="flex-end"&&t.setAlignSelf(Xn.default.ALIGN_FLEX_END)),"justifyContent"in e&&((e.justifyContent==="flex-start"||!e.justifyContent)&&t.setJustifyContent(Xn.default.JUSTIFY_FLEX_START),e.justifyContent==="center"&&t.setJustifyContent(Xn.default.JUSTIFY_CENTER),e.justifyContent==="flex-end"&&t.setJustifyContent(Xn.default.JUSTIFY_FLEX_END),e.justifyContent==="space-between"&&t.setJustifyContent(Xn.default.JUSTIFY_SPACE_BETWEEN),e.justifyContent==="space-around"&&t.setJustifyContent(Xn.default.JUSTIFY_SPACE_AROUND))},oCt=(t,e)=>{var r,s;"width"in e&&(typeof e.width=="number"?t.setWidth(e.width):typeof e.width=="string"?t.setWidthPercent(Number.parseInt(e.width,10)):t.setWidthAuto()),"height"in e&&(typeof e.height=="number"?t.setHeight(e.height):typeof e.height=="string"?t.setHeightPercent(Number.parseInt(e.height,10)):t.setHeightAuto()),"minWidth"in e&&(typeof e.minWidth=="string"?t.setMinWidthPercent(Number.parseInt(e.minWidth,10)):t.setMinWidth((r=e.minWidth)!==null&&r!==void 0?r:0)),"minHeight"in e&&(typeof e.minHeight=="string"?t.setMinHeightPercent(Number.parseInt(e.minHeight,10)):t.setMinHeight((s=e.minHeight)!==null&&s!==void 0?s:0))},aCt=(t,e)=>{"display"in e&&t.setDisplay(e.display==="flex"?Xn.default.DISPLAY_FLEX:Xn.default.DISPLAY_NONE)},cCt=(t,e)=>{if("borderStyle"in e){let r=typeof e.borderStyle=="string"?1:0;t.setBorder(Xn.default.EDGE_TOP,r),t.setBorder(Xn.default.EDGE_BOTTOM,r),t.setBorder(Xn.default.EDGE_LEFT,r),t.setBorder(Xn.default.EDGE_RIGHT,r)}};AP.default=(t,e={})=>{rCt(t,e),nCt(t,e),iCt(t,e),sCt(t,e),oCt(t,e),aCt(t,e),cCt(t,e)}});var Ube=H((ypr,Mbe)=>{"use strict";var pP=fP(),lCt=CQ(),uCt=fQ(),YK=new Set(["\x1B","\x9B"]),fCt=39,_be=t=>`${YK.values().next().value}[${t}m`,hCt=t=>t.split(" ").map(e=>pP(e)),WK=(t,e,r)=>{let s=[...e],a=!1,n=pP(lCt(t[t.length-1]));for(let[l,f]of s.entries()){let h=pP(f);if(n+h<=r?t[t.length-1]+=f:(t.push(f),n=0),YK.has(f))a=!0;else if(a&&f==="m"){a=!1;continue}a||(n+=h,n===r&&l<s.length-1&&(t.push(""),n=0))}!n&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},ACt=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(pP(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},pCt=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let s="",a="",n,l=hCt(t),f=[""];for(let[h,A]of t.split(" ").entries()){r.trim!==!1&&(f[f.length-1]=f[f.length-1].trimLeft());let m=pP(f[f.length-1]);if(h!==0&&(m>=e&&(r.wordWrap===!1||r.trim===!1)&&(f.push(""),m=0),(m>0||r.trim===!1)&&(f[f.length-1]+=" ",m++)),r.hard&&l[h]>e){let w=e-m,v=1+Math.floor((l[h]-w-1)/e);Math.floor((l[h]-1)/e)<v&&f.push(""),WK(f,A,e);continue}if(m+l[h]>e&&m>0&&l[h]>0){if(r.wordWrap===!1&&m<e){WK(f,A,e);continue}f.push("")}if(m+l[h]>e&&r.wordWrap===!1){WK(f,A,e);continue}f[f. Line truncated
`);for(let[h,A]of[...s].entries()){if(a+=A,YK.has(A)){let w=parseFloat(/\d[^m]*/.exec(s.slice(h,h+4)));n=w===fCt?null:w}let m=uCt.codes.get(Number(n));n&&m&&(s[h+1]===`
`?a+=_be(m):A===`
`&&(a+=_be(n)))}return a};Mbe.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
`).split(`
`).map(s=>pCt(s,e,r)).join(`
`)});var Gbe=H((Epr,jbe)=>{"use strict";var Hbe="[\uD800-\uDBFF][\uDC00-\uDFFF]",dCt=t=>t&&t.exact?new RegExp(`^${Hbe}$`):new RegExp(Hbe,"g");jbe.exports=dCt});var KK=H((Ipr,Ybe)=>{"use strict";var gCt=HK(),mCt=Gbe(),qbe=fQ(),Wbe=["\x1B","\x9B"],bL=t=>`${Wbe[0]}[${t}m`,Vbe=(t,e,r)=>{let s=[];t=[...t];for(let a of t){let n=a;a.match(";")&&(a=a.split(";")[0][0]+"0");let l=qbe.codes.get(parseInt(a,10));if(l){let f=t.indexOf(l.toString());f>=0?t.splice(f,1):s.push(bL(e?l:n))}else if(e){s.push(bL(0));break}else s.push(bL(n))}if(e&&(s=s.filter((a,n)=>s.indexOf(a)===n),r!==void 0)){let a=bL(qbe.codes.get(parseInt(r,10)));s=s.reduce((n,l)=>l===a?[l,...n]:[...n,l],[])}return s.join("")};Ybe.exports=(t,e,r)=>{let s=[...t.normalize()],a=[];r=typeof r=="number"?r:s.length;let n=!1,l,f=0,h="";for(let[A,m]of s.entries()){let w=!1;if(Wbe.includes(m)){let v=/\d[^m]*/.exec(t.slice(A,A+18));l=v&&v.length>0?v[0]:void 0,f<r&&(n=!0,l!==void 0&&a.push(l))}else n&&m==="m"&&(n=!1,w=!0);if(!n&&!w&&++f,!mCt({exact:!0}).test(m)&&gCt(m.codePointAt())&&++f,f>e&&f<=r)h+=m;else if(f===e&&!n&&l!==void 0)h=Vbe(a);else if(f>=r){h+=Vbe(a,!0,l);break}}return h}});var zbe=H((wpr,Kbe)=>{"use strict";var wg=KK(),yCt=fP();function DL(t,e,r){if(t.charAt(e)===" ")return e;for(let s=1;s<=3;s++)if(r){if(t.charAt(e+s)===" ")return e+s}else if(t.charAt(e-s)===" ")return e-s;return e}Kbe.exports=(t,e,r)=>{r={position:"end",preferTruncationOnSpace:!1,...r};let{position:s,space:a,preferTruncationOnSpace:n}=r,l="\u2026",f=1;if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof e!="number")throw new TypeError(`Expected \`columns\` to be a number, got ${typeof e}`);if(e<1)return"";if(e===1)return l;let h=yCt(t);if(h<=e)return t;if(s==="start"){if(n){let A=DL(t,h-e+1,!0);return l+wg(t,A,h).trim()}return a===!0&&(l+=" ",f=2),l+wg(t,h-e+f,h)}if(s==="middle"){a===!0&&(l=" "+l+" ",f=3);let A=Math.floor(e/2);if(n){let m=DL(t,A),w=DL(t,h-(e-A)+1,!0);return wg(t,0,m)+l+wg(t,w,h).trim()}return wg(t,0,A)+l+wg(t,h-(e-A)+f,h)}if(s==="end"){if(n){let A=DL(t,e-1);return wg(t,0,A)+l}return a===!0&&(l=" "+l,f=2),wg(t,0,e-f)+l}throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${s}`)}});var JK=H(dP=>{"use strict";var Jbe=dP&&dP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(dP,"__esModule",{value:!0});var ECt=Jbe(Ube()),ICt=Jbe(zbe()),zK={};dP.default=(t,e,r)=>{let s=t+String(e)+String(r);if(zK[s])return zK[s];let a=t;if(r==="wrap"&&(a=ECt.default(t,e,{trim:!1,hard:!0})),r.startsWith("truncate")){let n="end";r==="truncate-middle"&&(n="middle"),r==="truncate-start"&&(n="start"),a=ICt.default(t,e,{position:n})}return zK[s]=a,a}});var XK=H(ZK=>{"use strict";Object.defineProperty(ZK,"__esModule",{value:!0});var Zbe=t=>{let e="";if(t.childNodes.length>0)for(let r of t.childNodes){let s="";r.nodeName==="#text"?s=r.nodeValue:((r.nodeName==="ink-text"||r.nodeName==="ink-virtual-text")&&(s=Zbe(r)),s.length>0&&typeof r.internal_transform=="function"&&(s=r.internal_transform(s))),e+=s}return e};ZK.default=Zbe});var $K=H($i=>{"use strict";var gP=$i&&$i.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty($i,"__esModule",{value:!0});$i.setTextNodeValue=$i.createTextNode=$i.setStyle=$i.setAttribute=$i.removeChildNode=$i.insertBeforeNode=$i.appendChildNode=$i.createNode=$i.TEXT_NAME=void 0;var wCt=gP(uE()),Xbe=gP(Obe()),CCt=gP(Lbe()),BCt=gP(JK()),vCt=gP(XK());$i.TEXT_NAME="#text";$i.createNode=t=>{var e;let r={nodeName:t,style:{},attributes:{},childNodes:[],parentNode:null,yogaNode:t==="ink-virtual-text"?void 0:wCt.default.Node.create()};return t==="ink-text"&&((e=r.yogaNode)===null||e===void 0||e.setMeasureFunc(SCt.bind(null,r))),r};$i.appendChildNode=(t,e)=>{var r;e.parentNode&&$i.removeChildNode(e.parentNode,e),e.parentNode=t,t.childNodes.push(e),e.yogaNode&&((r=t.yogaNode)===null||r===void 0||r.insertChild(e.yogaNode,t.yogaNode.getChildCount())),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&PL(t)};$i.insertBeforeNode=(t,e,r)=>{var s,a;e.parentNode&&$i.removeChildNode(e.parentNode,e),e.parentNode=t;let n=t.childNodes.indexOf(r);if(n>=0){t.childNodes.splice(n,0,e),e.yogaNode&&((s=t.yogaNode)===null||s===void 0||s.insertChild(e.yogaNode,n));return}t.childNodes.push(e),e.yogaNode&&((a=t.yogaNode)===null||a===void 0||a.insertChild(e.yogaNode,t.yogaNode.getChildCount())),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&PL(t)};$i.removeChildNode=(t,e)=>{var r,s;e.yogaNode&&((s=(r=e.parentNode)===null||r===void 0?void 0:r.yogaNode)===null||s===void 0||s.removeChild(e.yogaNode)),e.parentNode=null;let a=t.childNodes.indexOf(e);a>=0&&t.childNodes.splice(a,1),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&PL(t)};$i.setAttribute=(t,e,r)=>{t.attributes[e]=r};$i.setStyle=(t,e)=>{t.style=e,t.yogaNode&&CCt.default(t.yogaNode,e)};$i.createTextNode=t=>{let e={nodeName:"#text",nodeValue:t,yogaLine truncated
`).repeat(n-2),m=rz.default(f.bottomLeft+f.horizontal.repeat(a-2)+f.bottomRight,l,"foreground");s.write(t,e,h,{transformers:[]}),s.write(t,e+1,A,{transformers:[]}),s.write(t+a-1,e+1,A,{transformers:[]}),s.write(t,e+n-1,m,{transformers:[]})}}});var pDe=H(CP=>{"use strict";var fE=CP&&CP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(CP,"__esModule",{value:!0});var QCt=fE(uE()),FCt=fE(qK()),NCt=fE(oDe()),OCt=fE(JK()),LCt=fE(aDe()),_Ct=fE(XK()),MCt=fE(hDe()),UCt=(t,e)=>{var r;let s=(r=t.childNodes[0])===null||r===void 0?void 0:r.yogaNode;if(s){let a=s.getComputedLeft(),n=s.getComputedTop();e=`
`.repeat(n)+NCt.default(e,a)}return e},ADe=(t,e,r)=>{var s;let{offsetX:a=0,offsetY:n=0,transformers:l=[],skipStaticElements:f}=r;if(f&&t.internal_static)return;let{yogaNode:h}=t;if(h){if(h.getDisplay()===QCt.default.DISPLAY_NONE)return;let A=a+h.getComputedLeft(),m=n+h.getComputedTop(),w=l;if(typeof t.internal_transform=="function"&&(w=[t.internal_transform,...l]),t.nodeName==="ink-text"){let v=_Ct.default(t);if(v.length>0){let D=FCt.default(v),I=LCt.default(h);if(D>I){let R=(s=t.style.textWrap)!==null&&s!==void 0?s:"wrap";v=OCt.default(v,I,R)}v=UCt(t,v),e.write(A,m,v,{transformers:w})}return}if(t.nodeName==="ink-box"&&MCt.default(A,m,t,e),t.nodeName==="ink-root"||t.nodeName==="ink-box")for(let v of t.childNodes)ADe(v,e,{offsetX:A,offsetY:m,transformers:w,skipStaticElements:f})}};CP.default=ADe});var mDe=H(BP=>{"use strict";var gDe=BP&&BP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(BP,"__esModule",{value:!0});var dDe=gDe(KK()),HCt=gDe(fP()),nz=class{constructor(e){this.writes=[];let{width:r,height:s}=e;this.width=r,this.height=s}write(e,r,s,a){let{transformers:n}=a;s&&this.writes.push({x:e,y:r,text:s,transformers:n})}get(){let e=[];for(let s=0;s<this.height;s++)e.push(" ".repeat(this.width));for(let s of this.writes){let{x:a,y:n,text:l,transformers:f}=s,h=l.split(`
`),A=0;for(let m of h){let w=e[n+A];if(!w)continue;let v=HCt.default(m);for(let D of f)m=D(m);e[n+A]=dDe.default(w,0,a)+m+dDe.default(w,a+v),A++}}return{output:e.map(s=>s.trimRight()).join(`
`),height:e.length}}};BP.default=nz});var IDe=H(vP=>{"use strict";var iz=vP&&vP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vP,"__esModule",{value:!0});var jCt=iz(uE()),yDe=iz(pDe()),EDe=iz(mDe());vP.default=(t,e)=>{var r;if(t.yogaNode.setWidth(e),t.yogaNode){t.yogaNode.calculateLayout(void 0,void 0,jCt.default.DIRECTION_LTR);let s=new EDe.default({width:t.yogaNode.getComputedWidth(),height:t.yogaNode.getComputedHeight()});yDe.default(t,s,{skipStaticElements:!0});let a;!((r=t.staticNode)===null||r===void 0)&&r.yogaNode&&(a=new EDe.default({width:t.staticNode.yogaNode.getComputedWidth(),height:t.staticNode.yogaNode.getComputedHeight()}),yDe.default(t.staticNode,a,{skipStaticElements:!1}));let{output:n,height:l}=s.get();return{output:n,outputHeight:l,staticOutput:a?`${a.get().output}
`:""}}return{output:"",outputHeight:0,staticOutput:""}}});var vDe=H((Npr,BDe)=>{"use strict";var wDe=Ae("stream"),CDe=["assert","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],sz={},GCt=t=>{let e=new wDe.PassThrough,r=new wDe.PassThrough;e.write=a=>t("stdout",a),r.write=a=>t("stderr",a);let s=new console.Console(e,r);for(let a of CDe)sz[a]=console[a],console[a]=s[a];return()=>{for(let a of CDe)console[a]=sz[a];sz={}}};BDe.exports=GCt});var az=H(oz=>{"use strict";Object.defineProperty(oz,"__esModule",{value:!0});oz.default=new WeakMap});var lz=H(cz=>{"use strict";Object.defineProperty(cz,"__esModule",{value:!0});var qCt=Ln(),SDe=qCt.createContext({exit:()=>{}});SDe.displayName="InternalAppContext";cz.default=SDe});var fz=H(uz=>{"use strict";Object.defineProperty(uz,"__esModule",{value:!0});var VCt=Ln(),bDe=VCt.createContext({stdin:void 0,setRawMode:()=>{},isRawModeSupported:!1,internal_exitOnCtrlC:!0});bDe.displayName="InternalStdinContext";uz.default=bDe});var Az=H(hz=>{"use strict";Object.defineProperty(hz,"__esModule",{value:!0});var WCt=Ln(),DDe=WCt.createContext({stdout:void 0,write:()=>{}});DDe.displayName="InternalStdoutContext";hz.default=DDe});var dz=H(pz=>{"use strict";Object.defineProperty(pz,"__esModule",{value:!0});var YCt=Ln(),PDe=YCt.createContext({stderr:void 0,write:()=>{}});PDe.displayName="InternalStderrContext";pz.default=PDe});var RL=H(gz=>{"use strict";Object.defineProperty(gz,"__esModule",{value:!0});var KCt=Ln(),xDe=KCt.createContext({activeId:void 0,add:()=>{},remove:()=>{},activate:()=>{},deactivate:()=>{},enableFocus:()=>{},disableFocus:()=>{},focusNext:()=>{},focusPrevious:()=>{},focus:()=>{}});xDe.displayName="InternalFocusContext";gz.default=xDe});var RDe=H((jpr,kDe)=>{"use strict";var zCt=/[|\\{}()[\]^$+*?.-]/g;kDe.exports=t=>{if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(zCt,"\\$&")}});var NDe=H((Gpr,FDe)=>{"use strict";var JCt=RDe(),ZCt=typeof process=="object"&&process&&typeof process.cwd=="function"?process.cwd():".",QDe=[].concat(Ae("module").builtinModules,"bootstrap_node","node").map(t=>new RegExp(`(?:\\((?:node:)?${t}(?:\\.js)?:\\d+:\\d+\\)$|^\\s*at (?:node:)?${t}(?:\\.js)?:\\d+:\\d+$)`));QDe.push(/\((?:node:)?internal\/[^:]+:\d+:\d+\)$/,/\s*at (?:node:)?internal\/[^:]+:\d+:\d+$/,/\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/);var mz=class t{constructor(e){e={ignoredPackages:[],...e},"internals"in e||(e.internals=t.nodeInternals()),"cwd"in e||(e.cwd=ZCt),this._cwd=e.cwd.replace(/\\/g,"/"),this._internals=[].concat(e.internals,XCt(e.ignoredPackages)),this._wrapCallSite=e.wrapCallSite||!1}static nodeInternals(){return[...QDe]}clean(e,r=0){r=" ".repeat(r),Array.isArray(e)||(e=e.split(`
`)),!/^\s*at /.test(e[0])&&/^\s*at /.test(e[1])&&(e=e.slice(1));let s=!1,a=null,n=[];return e.forEach(l=>{if(l=l.replace(/\\/g,"/"),this._internals.some(h=>h.test(l)))return;let f=/^\s*at /.test(l);s?l=l.trimEnd().replace(/^(\s+)at /,"$1"):(l=l.trim(),f&&(l=l.slice(3))),l=l.replace(`${this._cwd}/`,""),l&&(f?(a&&(n.push(a),a=null),n.push(l)):(s=!0,a=l))}),n.map(l=>`${r}${l}
`).join("")}captureString(e,r=this.captureString){typeof e=="function"&&(r=e,e=1/0);let{stackTraceLimit:s}=Error;e&&(Error.stackTraceLimit=e);let a={};Error.captureStackTrace(a,r);let{stack:n}=a;return Error.stackTraceLimit=s,this.clean(n)}capture(e,r=this.capture){typeof e=="function"&&(r=e,e=1/0);let{prepareStackTrace:s,stackTraceLimit:a}=Error;Error.prepareStackTrace=(f,h)=>this._wrapCallSite?h.map(this._wrapCallSite):h,e&&(Error.stackTraceLimit=e);let n={};Error.captureStackTrace(n,r);let{stack:l}=n;return Object.assign(Error,{prepareStackTrace:s,stackTraceLimit:a}),l}at(e=this.at){let[r]=this.capture(1,e);if(!r)return{};let s={line:r.getLineNumber(),column:r.getColumnNumber()};TDe(s,r.getFileName(),this._cwd),r.isConstructor()&&(s.constructor=!0),r.isEval()&&(s.evalOrigin=r.getEvalOrigin()),r.isNative()&&(s.native=!0);let a;try{a=r.getTypeName()}catch{}a&&a!=="Object"&&a!=="[object Object]"&&(s.type=a);let n=r.getFunctionName();n&&(s.function=n);let l=r.getMethodName();return l&&n!==l&&(s.method=l),s}parseLine(e){let r=e&&e.match($Ct);if(!r)return null;let s=r[1]==="new",a=r[2],n=r[3],l=r[4],f=Number(r[5]),h=Number(r[6]),A=r[7],m=r[8],w=r[9],v=r[10]==="native",D=r[11]===")",I,R={};if(m&&(R.line=Number(m)),w&&(R.column=Number(w)),D&&A){let N=0;for(let U=A.length-1;U>0;U--)if(A.charAt(U)===")")N++;else if(A.charAt(U)==="("&&A.charAt(U-1)===" "&&(N--,N===-1&&A.charAt(U-1)===" ")){let V=A.slice(0,U-1);A=A.slice(U+1),a+=` (${V}`;break}}if(a){let N=a.match(e1t);N&&(a=N[1],I=N[2])}return TDe(R,A,this._cwd),s&&(R.constructor=!0),n&&(R.evalOrigin=n,R.evalLine=f,R.evalColumn=h,R.evalFile=l&&l.replace(/\\/g,"/")),v&&(R.native=!0),a&&(R.function=a),I&&a!==I&&(R.method=I),R}};function TDe(t,e,r){e&&(e=e.replace(/\\/g,"/"),e.startsWith(`${r}/`)&&(e=e.slice(r.length+1)),t.file=e)}function XCt(t){if(t.length===0)return[];let e=t.map(r=>JCt(r));return new RegExp(`[/\\\\]node_modules[/\\\\](?:${e.join("|")})[/\\\\][^:]+:\\d+:\\d+`)}var $Ct=new RegExp("^(?:\\s*at )?(?:(new) )?(?:(.*?) \\()?(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?(?:(.+?):(\\d+):(\\d+)|(native))(\\)?)$"),e1t=/^(.*?) \[as (.*?)\]$/;FDe.exports=mz});var LDe=H((qpr,ODe)=>{"use strict";ODe.exports=(t,e)=>t.replace(/^\t+/gm,r=>" ".repeat(r.length*(e||2)))});var MDe=H((Vpr,_De)=>{"use strict";var t1t=LDe(),r1t=(t,e)=>{let r=[],s=t-e,a=t+e;for(let n=s;n<=a;n++)r.push(n);return r};_De.exports=(t,e,r)=>{if(typeof t!="string")throw new TypeError("Source code is missing.");if(!e||e<1)throw new TypeError("Line number must start from `1`.");if(t=t1t(t).split(/\r?\n/),!(e>t.length))return r={around:3,...r},r1t(e,r.around).filter(s=>t[s-1]!==void 0).map(s=>({line:s,value:t[s-1]}))}});var TL=H(Yf=>{"use strict";var n1t=Yf&&Yf.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),i1t=Yf&&Yf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s1t=Yf&&Yf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&n1t(e,t,r);return i1t(e,t),e},o1t=Yf&&Yf.__rest||function(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(t);a<s.length;a++)e.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(t,s[a])&&(r[s[a]]=t[s[a]]);return r};Object.defineProperty(Yf,"__esModule",{value:!0});var UDe=s1t(Ln()),yz=UDe.forwardRef((t,e)=>{var{children:r}=t,s=o1t(t,["children"]);let a=Object.assign(Object.assign({},s),{marginLeft:s.marginLeft||s.marginX||s.margin||0,marginRight:s.marginRight||s.marginX||s.margin||0,marginTop:s.marginTop||s.marginY||s.margin||0,marginBottom:s.marginBottom||s.marginY||s.margin||0,paddingLeft:s.paddingLeft||s.paddingX||s.padding||0,paddingRight:s.paddingRight||s.paddingX||s.padding||0,paddingTop:s.paddingTop||s.paddingY||s.padding||0,paddingBottom:s.paddingBottom||s.paddingY||s.padding||0});return UDe.default.createElement("ink-box",{ref:e,style:a},r)});yz.displayName="Box";yz.defaultProps={flexDirection:"row",flexGrow:0,flexShrink:1};Yf.default=yz});var wz=H(SP=>{"use strict";var Ez=SP&&SP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(SP,"__esModule",{value:!0});var a1t=Ez(Ln()),Z1=Ez(Cw()),HDe=Ez(tz()),Iz=({color:t,backgroundColor:e,dimColor:r,bold:s,italic:a,underline:n,strikethrough:l,inverse:f,wrap:h,children:A})=>{if(A==null)return null;let m=w=>(r&&(w=Z1.default.dim(w)),t&&(w=HDe.default(w,t,"foreground")),e&&(w=HDe.default(w,e,"background")),s&&(w=Z1.default.bold(w)),a&&(w=Z1.default.italic(w)),n&&(w=Z1.default.underline(w)),l&&(w=Z1.default.strikethrough(w)),f&&(w=Z1.default.inverse(w)),w);return a1t.default.createElement("ink-text",{style:{flexGrow:0,flexSLine truncated
`).slice(1):void 0,r=e?qDe.parseLine(e[0]):void 0,s,a=0;if(r?.file&&r?.line&&jDe.existsSync(r.file)){let n=jDe.readFileSync(r.file,"utf8");if(s=f1t.default(n,r.line),s)for(let{line:l}of s)a=Math.max(a,String(l).length)}return no.default.createElement(rd.default,{flexDirection:"column",padding:1},no.default.createElement(rd.default,null,no.default.createElement(sA.default,{backgroundColor:"red",color:"white"}," ","ERROR"," "),no.default.createElement(sA.default,null," ",t.message)),r&&no.default.createElement(rd.default,{marginTop:1},no.default.createElement(sA.default,{dimColor:!0},r.file,":",r.line,":",r.column)),r&&s&&no.default.createElement(rd.default,{marginTop:1,flexDirection:"column"},s.map(({line:n,value:l})=>no.default.createElement(rd.default,{key:n},no.default.createElement(rd.default,{width:a+1},no.default.createElement(sA.default,{dimColor:n!==r.line,backgroundColor:n===r.line?"red":void 0,color:n===r.line?"white":void 0},String(n).padStart(a," "),":")),no.default.createElement(sA.default,{key:n,backgroundColor:n===r.line?"red":void 0,color:n===r.line?"white":void 0}," "+l)))),t.stack&&no.default.createElement(rd.default,{marginTop:1,flexDirection:"column"},t.stack.split(`
`).slice(1).map(n=>{let l=qDe.parseLine(n);return l?no.default.createElement(rd.default,{key:n},no.default.createElement(sA.default,{dimColor:!0},"- "),no.default.createElement(sA.default,{dimColor:!0,bold:!0},l.function),no.default.createElement(sA.default,{dimColor:!0,color:"gray"}," ","(",l.file,":",l.line,":",l.column,")")):no.default.createElement(rd.default,{key:n},no.default.createElement(sA.default,{dimColor:!0},"- "),no.default.createElement(sA.default,{dimColor:!0,bold:!0},n))})))};Kf.default=h1t});var YDe=H(zf=>{"use strict";var A1t=zf&&zf.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),p1t=zf&&zf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d1t=zf&&zf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&A1t(e,t,r);return p1t(e,t),e},AE=zf&&zf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zf,"__esModule",{value:!0});var hE=d1t(Ln()),WDe=AE(BK()),g1t=AE(lz()),m1t=AE(fz()),y1t=AE(Az()),E1t=AE(dz()),I1t=AE(RL()),w1t=AE(VDe()),C1t=" ",B1t="\x1B[Z",v1t="\x1B",QL=class extends hE.PureComponent{constructor(){super(...arguments),this.state={isFocusEnabled:!0,activeFocusId:void 0,focusables:[],error:void 0},this.rawModeEnabledCount=0,this.handleSetRawMode=e=>{let{stdin:r}=this.props;if(!this.isRawModeSupported())throw r===process.stdin?new Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`):new Error(`Raw mode is not supported on the stdin provided to Ink.
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(r.setEncoding("utf8"),e){this.rawModeEnabledCount===0&&(r.addListener("data",this.handleInput),r.resume(),r.setRawMode(!0)),this.rawModeEnabledCount++;return}--this.rawModeEnabledCount===0&&(r.setRawMode(!1),r.removeListener("data",this.handleInput),r.pause())},this.handleInput=e=>{e===""&&this.props.exitOnCtrlC&&this.handleExit(),e===v1t&&this.state.activeFocusId&&this.setState({activeFocusId:void 0}),this.state.isFocusEnabled&&this.state.focusables.length>0&&(e===C1t&&this.focusNext(),e===B1t&&this.focusPrevious())},this.handleExit=e=>{this.isRawModeSupported()&&this.handleSetRawMode(!1),this.props.onExit(e)},this.enableFocus=()=>{this.setState({isFocusEnabled:!0})},this.disableFocus=()=>{this.setState({isFocusEnabled:!1})},this.focus=e=>{this.setState(r=>r.focusables.some(a=>a?.id===e)?{activeFocusId:e}:r)},this.focusNext=()=>{this.setState(e=>{var r;let s=(r=e.focusables[0])===null||r===void 0?void 0:r.id;return{activeFocusId:this.findNextFocusable(e)||s}})},this.focusPrevious=()=>{this.setState(e=>{var r;let s=(r=e.focusables[e.focusables.length-1])===null||r===void 0?void 0:r.id;return{activeFocusId:this.findPreviousFocusable(e)||s}})},this.addFocusable=(e,{autoFocus:r})=>{this.setState(s=>{let a=s.activeFocusId;return!a&&r&&(a=e),{activeFocusId:a,focusables:[...s.focusables,{id:e,isActive:!0}]}})},this.removeFocusable=e=>{this.setState(r=>({activeFocusId:r.activeFocusId===e?void 0:r.activeFocusId,focusables:r.focusables.filter(s=>s.id!==e)}))},this.activateFocusable=e=>{this.setState(r=>({focusables:r.focusables.map(s=>s.id!==e?s:{id:e,isActive:!0})}))},this.deactivateFocusable=e=>{this.setState(r=>({activeFocusId:r.activeFocusId===e?void 0:r.activeFocusId,focusables:r.focusables.map(s=>s.id!==e?s:{id:e,isActive:!1})}))},this.findNextFocusable=e=>{var r;let s=e.focusables.findIndex(a=>a.id===e.activeFocusId);for(let a=s+1;a<e.focusables.length;a++)if(!((r=e.focusables[a])===null||r===void 0)&&r.isActive)return e.focusables[a].id},this.findPreviousFocusable=e=>{var r;let s=e.focusables.findIndex(a=>a.id===e.activeFocusId);for(let a=s-1;a>=0;a--)if(!((r=e.focusables[a])===null||r===void 0)&&r.isActive)return e.focusables[a].id}}static getDerivedStateFromError(e){return{error:e}}isRawModeSupported(){return this.props.stdin.isTTY}render(){return hE.default.createElement(g1t.default.Provider,{value:{exit:this.handleExit}},hE.default.createElement(m1t.default.Provider,{value:{stdin:this.props.stdin,setRawMode:this.handleSetRawMode,isRawModeSupported:this.isRawModeSupported(),internal_exitOnCtrlC:this.props.exitOnCtrlC}},hE.default.createElement(y1t.default.Provider,{value:{stdout:this.props.stdout,write:this.props.writeToStdout}},hE.default.createElement(E1t.default.Provider,{value:{stderr:this.props.stderr,write:this.props.writeToStderr}},hE.default.createElement(I1t.default.Provider,{value:{activeId:this.state.activeFocusId,add:this.addFocusable,remove:this.removeFocusable,activate:this.activateFocusable,deactivate:this.deactivateFocusable,enableFocus:this.enableFocus,disableFocus:this.disableFocus,focusNext:this.focusNext,focusPrevious:this.focusPrevious,focus:this.focus}},this.state.error?hE.default.createElement(w1t.default,{error:this.state.error}):this.props.children)))))}componentDidMount(){WDe.default.hide(this.props.stdout)}componentWillUnmount(){WDe.default.show(this.props.stdout),this.isRawModeSupported()&&this.handleSetRawMode(!1)}componentDidCatch(e){this.handleExit(e)}};zf.default=QL;QL.displayName="InternalApp"});var JDe=H(Jf=>{"use strict";var S1t=Jf&&Jf.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),b1t=Jf&&Jf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D1t=Jf&&Jf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&S1t(e,t,r);return b1t(e,t),e},Zf=Jf&&Jf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Jf,"__esModule",{value:!0});var P1t=Zf(Ln()),KDe=jSe(),x1t=Zf(ibe()),k1t=Zf(yK()),R1t=Zf(ube()),T1t=Zf(hbe()),Cz=Zf(iDe()),Q1t=Zf(IDe()),F1t=Zf(CK()),N1t=Zf(vDe()),O1t=D1t($K()),L1t=Zf(az()),_1t=Zf(YDe()),X1=process.env.CI==="false"?!1:R1t.default,zDe=()=>{},Bz=class{constructor(e){this.resolveExitPromise=()=>{},this.rejectExitPromise=()=>{},this.unsubscribeExit=()=>{},this.onRender=()=>{if(this.isUnmounted)return;let{output:r,outputHeight:s,staticOutput:a}=Q1t.default(this.rootNode,this.options.stdout.columns||80),n=a&&a!==`
`;if(this.options.debug){n&&(this.fullStaticOutput+=a),this.options.stdout.write(this.fullStaticOutput+r);return}if(X1){n&&this.options.stdout.write(a),this.lastOutput=r;return}if(n&&(this.fullStaticOutput+=a),s>=this.options.stdout.rows){this.options.stdout.write(k1t.default.clearTerminal+this.fullStaticOutput+r),this.lastOutput=r;return}n&&(this.log.clear(),this.options.stdout.write(a),this.log(r)),!n&&r!==this.lastOutput&&this.throttledLog(r),this.lastOutput=r},T1t.default(this),this.options=e,this.rootNode=O1t.createNode("ink-root"),this.rootNode.onRender=e.debug?this.onRender:KDe(this.onRender,32,{leading:!0,trailing:!0}),this.rootNode.onImmediateRender=this.onRender,this.log=x1t.default.create(e.stdout),this.throttledLog=e.debug?this.log:KDe(this.log,void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.lastOutput="",this.fullStaticOutput="",this.container=Cz.default.createContainer(this.rootNode,0,!1,null),this.unsubscribeExit=F1t.default(this.unmount,{alwaysLast:!1}),e.patchConsole&&this.patchConsole(),X1||(e.stdout.on("resize",this.onRender),this.unsubscribeResize=()=>{e.stdout.off("resize",this.onRender)})}render(e){let r=P1t.default.createElement(_1t.default,{stdin:this.options.stdin,stdout:this.options.stdout,stderr:this.options.stderr,writeToStdout:this.writeToStdout,writeToStderr:this.writeToStderr,exitOnCtrlC:this.options.exitOnCtrlC,onExit:this.unmount},e);Cz.default.updateContainer(r,this.container,null,zDe)}writeToStdout(e){if(!this.isUnmounted){if(this.options.debug){this.options.stdout.write(e+this.fullStaticOutput+this.lastOutput);return}if(X1){this.options.stdout.write(e);return}this.log.clear(),this.options.stdout.write(e),this.log(this.lastOutput)}}writeToStderr(e){if(!this.isUnmounted){if(this.options.debug){this.options.stderr.write(e),this.options.stdout.write(this.fullStaticOutput+this.lastOutput);return}if(X1){this.options.stderr.write(e);return}this.log.clear(),this.options.stderr.write(e),this.log(this.lastOutput)}}unmount(e){this.isUnmounted||(this.onRender(),this.unsubscribeExit(),typeof this.restoreConsole=="function"&&this.restoreConsole(),typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),X1?this.options.stdout.write(this.lastOutput+`
`):this.options.debug||this.log.done(),this.isUnmounted=!0,Cz.default.updateContainer(null,this.container,null,zDe),L1t.default.delete(this.options.stdout),e instanceof Error?this.rejectExitPromise(e):this.resolveExitPromise())}waitUntilExit(){return this.exitPromise||(this.exitPromise=new Promise((e,r)=>{this.resolveExitPromise=e,this.rejectExitPromise=r})),this.exitPromise}clear(){!X1&&!this.options.debug&&this.log.clear()}patchConsole(){this.options.debug||(this.restoreConsole=N1t.default((e,r)=>{e==="stdout"&&this.writeToStdout(r),e==="stderr"&&(r.startsWith("The above error occurred")||this.writeToStderr(r))}))}};Jf.default=Bz});var XDe=H(DP=>{"use strict";var ZDe=DP&&DP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(DP,"__esModule",{value:!0});var M1t=ZDe(JDe()),FL=ZDe(az()),U1t=Ae("stream"),H1t=(t,e)=>{let r=Object.assign({stdout:process.stdout,stdin:process.stdin,stderr:process.stderr,debug:!1,exitOnCtrlC:!0,patchConsole:!0},j1t(e)),s=G1t(r.stdout,()=>new M1t.default(r));return s.render(t),{rerender:s.render,unmount:()=>s.unmount(),waitUntilExit:s.waitUntilExit,cleanup:()=>FL.default.delete(r.stdout),clear:s.clear}};DP.default=H1t;var j1t=(t={})=>t instanceof U1t.Stream?{stdout:t,stdin:process.stdin}:t,G1t=(t,e)=>{let r;return FL.default.has(t)?r=FL.default.get(t):(r=e(),FL.default.set(t,r)),r}});var ePe=H(nd=>{"use strict";var q1t=nd&&nd.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),V1t=nd&&nd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W1t=nd&&nd.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&q1t(e,t,r);return V1t(e,t),e};Object.defineProperty(nd,"__esModule",{value:!0});var PP=W1t(Ln()),$De=t=>{let{items:e,children:r,style:s}=t,[a,n]=PP.useState(0),l=PP.useMemo(()=>e.slice(a),[e,a]);PP.useLayoutEffect(()=>{n(e.length)},[e.length]);let f=l.map((A,m)=>r(A,a+m)),h=PP.useMemo(()=>Object.assign({position:"absolute",flexDirection:"column"},s),[s]);return PP.default.createElement("ink-box",{internal_static:!0,style:h},f)};$De.displayName="Static";nd.default=$De});var rPe=H(xP=>{"use strict";var Y1t=xP&&xP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xP,"__esModule",{value:!0});var K1t=Y1t(Ln()),tPe=({children:t,transform:e})=>t==null?null:K1t.default.createElement("ink-text",{style:{flexGrow:0,flexShrink:1,flexDirection:"row"},internal_transform:e},t);tPe.displayName="Transform";xP.default=tPe});var iPe=H(kP=>{"use strict";var z1t=kP&&kP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(kP,"__esModule",{value:!0});var J1t=z1t(Ln()),nPe=({count:t=1})=>J1t.default.createElement("ink-text",null,`
`.repeat(t));nPe.displayName="Newline";kP.default=nPe});var aPe=H(RP=>{"use strict";var sPe=RP&&RP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(RP,"__esModule",{value:!0});var Z1t=sPe(Ln()),X1t=sPe(TL()),oPe=()=>Z1t.default.createElement(X1t.default,{flexGrow:1});oPe.displayName="Spacer";RP.default=oPe});var NL=H(TP=>{"use strict";var $1t=TP&&TP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(TP,"__esModule",{value:!0});var e2t=Ln(),t2t=$1t(fz()),r2t=()=>e2t.useContext(t2t.default);TP.default=r2t});var lPe=H(QP=>{"use strict";var n2t=QP&&QP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(QP,"__esModule",{value:!0});var cPe=Ln(),i2t=n2t(NL()),s2t=(t,e={})=>{let{stdin:r,setRawMode:s,internal_exitOnCtrlC:a}=i2t.default();cPe.useEffect(()=>{if(e.isActive!==!1)return s(!0),()=>{s(!1)}},[e.isActive,s]),cPe.useEffect(()=>{if(e.isActive===!1)return;let n=l=>{let f=String(l),h={upArrow:f==="\x1B[A",downArrow:f==="\x1B[B",leftArrow:f==="\x1B[D",rightArrow:f==="\x1B[C",pageDown:f==="\x1B[6~",pageUp:f==="\x1B[5~",return:f==="\r",escape:f==="\x1B",ctrl:!1,shift:!1,tab:f===" "||f==="\x1B[Z",backspace:f==="\b",delete:f==="\x7F"||f==="\x1B[3~",meta:!1};f<=""&&!h.return&&(f=String.fromCharCode(f.charCodeAt(0)+97-1),h.ctrl=!0),f.startsWith("\x1B")&&(f=f.slice(1),h.meta=!0);let A=f>="A"&&f<="Z",m=f>="\u0410"&&f<="\u042F";f.length===1&&(A||m)&&(h.shift=!0),h.tab&&f==="[Z"&&(h.shift=!0),(h.tab||h.backspace||h.delete)&&(f=""),(!(f==="c"&&h.ctrl)||!a)&&t(f,h)};return r?.on("data",n),()=>{r?.off("data",n)}},[e.isActive,r,a,t])};QP.default=s2t});var uPe=H(FP=>{"use strict";var o2t=FP&&FP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(FP,"__esModule",{value:!0});var a2t=Ln(),c2t=o2t(lz()),l2t=()=>a2t.useContext(c2t.default);FP.default=l2t});var fPe=H(NP=>{"use strict";var u2t=NP&&NP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(NP,"__esModule",{value:!0});var f2t=Ln(),h2t=u2t(Az()),A2t=()=>f2t.useContext(h2t.default);NP.default=A2t});var hPe=H(OP=>{"use strict";var p2t=OP&&OP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(OP,"__esModule",{value:!0});var d2t=Ln(),g2t=p2t(dz()),m2t=()=>d2t.useContext(g2t.default);OP.default=m2t});var pPe=H(_P=>{"use strict";var APe=_P&&_P.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_P,"__esModule",{value:!0});var LP=Ln(),y2t=APe(RL()),E2t=APe(NL()),I2t=({isActive:t=!0,autoFocus:e=!1,id:r}={})=>{let{isRawModeSupported:s,setRawMode:a}=E2t.default(),{activeId:n,add:l,remove:f,activate:h,deactivate:A,focus:m}=LP.useContext(y2t.default),w=LP.useMemo(()=>r??Math.random().toString().slice(2,7),[r]);return LP.useEffect(()=>(l(w,{autoFocus:e}),()=>{f(w)}),[w,e]),LP.useEffect(()=>{t?h(w):A(w)},[t,w]),LP.useEffect(()=>{if(!(!s||!t))return a(!0),()=>{a(!1)}},[t]),{isFocused:!!w&&n===w,focus:m}};_P.default=I2t});var dPe=H(MP=>{"use strict";var w2t=MP&&MP.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(MP,"__esModule",{value:!0});var C2t=Ln(),B2t=w2t(RL()),v2t=()=>{let t=C2t.useContext(B2t.default);return{enableFocus:t.enableFocus,disableFocus:t.disableFocus,focusNext:t.focusNext,focusPrevious:t.focusPrevious,focus:t.focus}};MP.default=v2t});var gPe=H(vz=>{"use strict";Object.defineProperty(vz,"__esModule",{value:!0});vz.default=t=>{var e,r,s,a;return{width:(r=(e=t.yogaNode)===null||e===void 0?void 0:e.getComputedWidth())!==null&&r!==void 0?r:0,height:(a=(s=t.yogaNode)===null||s===void 0?void 0:s.getComputedHeight())!==null&&a!==void 0?a:0}}});var Du=H(Wo=>{"use strict";Object.defineProperty(Wo,"__esModule",{value:!0});var S2t=XDe();Object.defineProperty(Wo,"render",{enumerable:!0,get:function(){return S2t.default}});var b2t=TL();Object.defineProperty(Wo,"Box",{enumerable:!0,get:function(){return b2t.default}});var D2t=wz();Object.defineProperty(Wo,"Text",{enumerable:!0,get:function(){return D2t.default}});var P2t=ePe();Object.defineProperty(Wo,"Static",{enumerable:!0,get:function(){return P2t.default}});var x2t=rPe();Object.defineProperty(Wo,"Transform",{enumerable:!0,get:function(){return x2t.default}});var k2t=iPe();Object.defineProperty(Wo,"Newline",{enumerable:!0,get:function(){return k2t.default}});var R2t=aPe();Object.defineProperty(Wo,"Spacer",{enumerable:!0,get:function(){return R2t.default}});var T2t=lPe();Object.defineProperty(Wo,"useInput",{enumerable:!0,get:function(){return T2t.default}});var Q2t=uPe();Object.defineProperty(Wo,"useApp",{enumerable:!0,get:function(){return Q2t.default}});var F2t=NL();Object.defineProperty(Wo,"useStdin",{enumerable:!0,get:function(){return F2t.default}});var N2t=fPe();Object.defineProperty(Wo,"useStdout",{enumerable:!0,get:function(){return N2t.default}});var O2t=hPe();Object.defineProperty(Wo,"useStderr",{enumerable:!0,get:function(){ Line truncated
`:"";return l?w+=`@IF EXIST ${l} (\r
${l} ${h} ${a} ${m}%*\r
) ELSE (\r
@SETLOCAL\r
@SET PATHEXT=%PATHEXT:;.JS;=;%\r
${f} ${h} ${a} ${m}%*\r
)\r
`:w+=`@${f} ${h} ${a} ${m}%*\r
`,w}function uvt(t,e,r){let s=xu.relative(xu.dirname(e),t),a=r.prog&&r.prog.split("\\").join("/"),n;s=s.split("\\").join("/");let l=xu.isAbsolute(s)?`"${s}"`:`"$basedir/${s}"`,f=r.args||"",h=EJ(r.nodePath).posix;a?(n=`"$basedir/${r.prog}"`,s=l):(a=l,f="",s="");let A=r.progArgs?`${r.progArgs.join(" ")} `:"",m=`#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")
case \`uname\` in
*CYGWIN*) basedir=\`cygpath -w "$basedir"\`;;
esac
`,w=r.nodePath?`export NODE_PATH="${h}"
`:"";return n?m+=`${w}if [ -x ${n} ]; then
exec ${n} ${f} ${s} ${A}"$@"
else
exec ${a} ${f} ${s} ${A}"$@"
fi
`:m+=`${w}${a} ${f} ${s} ${A}"$@"
exit $?
`,m}function fvt(t,e,r){let s=xu.relative(xu.dirname(e),t),a=r.prog&&r.prog.split("\\").join("/"),n=a&&`"${a}$exe"`,l;s=s.split("\\").join("/");let f=xu.isAbsolute(s)?`"${s}"`:`"$basedir/${s}"`,h=r.args||"",A=EJ(r.nodePath),m=A.win32,w=A.posix;n?(l=`"$basedir/${r.prog}$exe"`,s=f):(n=f,h="",s="");let v=r.progArgs?`${r.progArgs.join(" ")} `:"",D=`#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
${r.nodePath?`$env_node_path=$env:NODE_PATH
$env:NODE_PATH="${m}"
`:""}if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}`;return r.nodePath&&(D+=` else {
$env:NODE_PATH="${w}"
}`),l?D+=`
$ret=0
if (Test-Path ${l}) {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & ${l} ${h} ${s} ${v}$args
} else {
& ${l} ${h} ${s} ${v}$args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & ${n} ${h} ${s} ${v}$args
} else {
& ${n} ${h} ${s} ${v}$args
}
$ret=$LASTEXITCODE
}
${r.nodePath?`$env:NODE_PATH=$env_node_path
`:""}exit $ret
`:D+=`
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & ${n} ${h} ${s} ${v}$args
} else {
& ${n} ${h} ${s} ${v}$args
}
${r.nodePath?`$env:NODE_PATH=$env_node_path
`:""}exit $LASTEXITCODE
`,D}function hvt(t,e){return e.fs_.chmod(t,493)}function EJ(t){if(!t)return{win32:"",posix:""};let e=typeof t=="string"?t.split(xu.delimiter):Array.from(t),r={};for(let s=0;s<e.length;s++){let a=e[s].split("/").join("\\"),n=kxe()?e[s].split("\\").join("/").replace(/^([^:\\/]*):/,(l,f)=>`/mnt/${f.toLowerCase()}`):e[s];r.win32=r.win32?`${r.win32};${a}`:a,r.posix=r.posix?`${r.posix}:${n}`:n,r[s]={win32:a,posix:n}}return r}Txe.exports=yJ});var TJ=H((DEr,eke)=>{eke.exports=Ae("stream")});var ike=H((PEr,nke)=>{"use strict";function tke(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,s)}return r}function zvt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?tke(Object(r),!0).forEach(function(s){Jvt(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):tke(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}function Jvt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zvt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rke(t,e){for(var r=0;r<e.length;r++){var s=e[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function Xvt(t,e,r){return e&&rke(t.prototype,e),r&&rke(t,r),t}var $vt=Ae("buffer"),l_=$vt.Buffer,eSt=Ae("util"),QJ=eSt.inspect,tSt=QJ&&QJ.custom||"inspect";function rSt(t,e,r){l_.prototype.copy.call(t,e,r)}nke.exports=function(){function t(){Zvt(this,t),this.head=null,this.tail=null,this.length=0}return Xvt(t,[{key:"push",value:function(r){var s={data:r,next:null};this.length>0?this.tail.next=s:this.head=s,this.tail=s,++this.length}},{key:"unshift",value:function(r){var s={data:r,next:this.head};this.length===0&&(this.tail=s),this.head=s,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var s=this.head,a=""+s.data;s=s.next;)a+=r+s.data;return a}},{key:"concat",value:function(r){if(this.length===0)return l_.alloc(0);for(var s=l_.allocUnsafe(r>>>0),a=this.head,n=0;a;)rSt(a.data,s,n),n+=a.data.length,a=a.next;return s}},{key:"consume",value:function(r,s){var a;return r<this.head.data.length?(a=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?a=this.shift():a=s?this._getString(r):this._getBuffer(r),a}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var s=this.head,a=1,n=s.data;for(r-=n.length;s=s.next;){var l=s.data,f=r>l.length?l.length:r;if(f===l.length?n+=l:n+=l.slice(0,r),r-=f,r===0){f===l.length?(++a,s.next?this.head=s.next:this.head=this.tail=null):(this.head=s,s.data=l.slice(f));break}++a}return this.length-=a,n}},{key:"_getBuffer",value:function(r){var s=l_.allocUnsafe(r),a=this.head,n=1;for(a.data.copy(s),r-=a.data.length;a=a.next;){var l=a.data,f=r>l.length?l.length:r;if(l.copy(s,s.length-r,0,f),r-=f,r===0){f===l.length?(++n,a.next?this.head=a.next:this.head=this.tail=null):(this.head=a,a.data=l.slice(f));break}++n}return this.length-=n,s}},{key:tSt,value:function(r,s){return QJ(this,zvt({},s,{depth:0,customInspect:!1}))}}]),t}()});var NJ=H((xEr,oke)=>{"use strict";function nSt(t,e){var r=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(FJ,this,t)):process.nextTick(FJ,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(n){!e&&n?r._writableState?r._writableState.errorEmitted?process.nextTick(u_,r):(r._writableState.errorEmitted=!0,process.nextTick(ske,r,n)):process.nextTick(ske,r,n):e?(process.nextTick(u_,r),e(n)):process.nextTick(u_,r)}),this)}function ske(t,e){FJ(t,e),u_(t)}function u_(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function iSt(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function FJ(t,e){t.emit("error",e)}function sSt(t,e){var r=t._readableState,s=t._writableState;r&& Line truncated
`)),t.linkname&&(e+=lZ(" linkpath="+t.linkname+`
`));var r=t.pax;if(r)for(var s in r)e+=lZ(" "+s+"="+r[s]+`
`);return Buffer.from(e)};E2.decodePax=function(t){for(var e={};t.length;){for(var r=0;r<t.length&&t[r]!==32;)r++;var s=parseInt(t.slice(0,r).toString(),10);if(!s)return e;var a=t.slice(r+1,s-1).toString(),n=a.indexOf("=");if(n===-1)return e;e[a.slice(0,n)]=a.slice(n+1),t=t.slice(s)}return e};E2.encode=function(t){var e=Zbt(512),r=t.name,s="";if(t.typeflag===5&&r[r.length-1]!=="/"&&(r+="/"),Buffer.byteLength(r)!==r.length)return null;for(;Buffer.byteLength(r)>100;){var a=r.indexOf("/");if(a===-1)return null;s+=s?"/"+r.slice(0,a):r.slice(0,a),r=r.slice(a+1)}return Buffer.byteLength(r)>100||Buffer.byteLength(s)>155||t.linkname&&Buffer.byteLength(t.linkname)>100?null:(e.write(r),e.write(Og(t.mode&nDt,6),100),e.write(Og(t.uid,6),108),e.write(Og(t.gid,6),116),e.write(Og(t.size,11),124),e.write(Og(t.mtime.getTime()/1e3|0,11),136),e[156]=oRe+oDt(t.type),t.linkname&&e.write(t.linkname,157),aRe.copy(e,xx),eDt.copy(e,uZ),t.uname&&e.write(t.uname,265),t.gname&&e.write(t.gname,297),e.write(Og(t.devmajor||0,6),329),e.write(Og(t.devminor||0,6),337),s&&e.write(s,345),e.write(Og(lRe(e),6),148),e)};E2.decode=function(t,e,r){var s=t[156]===0?0:t[156]-oRe,a=y2(t,0,100,e),n=Lg(t,100,8),l=Lg(t,108,8),f=Lg(t,116,8),h=Lg(t,124,12),A=Lg(t,136,12),m=sDt(s),w=t[157]===0?null:y2(t,157,100,e),v=y2(t,265,32),D=y2(t,297,32),I=Lg(t,329,8),R=Lg(t,337,8),N=lRe(t);if(N===8*32)return null;if(N!==Lg(t,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(aRe.compare(t,xx,xx+6)===0)t[345]&&(a=y2(t,345,155,e)+"/"+a);else if(!(tDt.compare(t,xx,xx+6)===0&&rDt.compare(t,uZ,uZ+2)===0)){if(!r)throw new Error("Invalid tar header: unknown format.")}return s===0&&a&&a[a.length-1]==="/"&&(s=5),{name:a,mode:n,uid:l,gid:f,size:h,mtime:new Date(1e3*A),type:m,linkname:w,uname:v,gname:D,devmajor:I,devminor:R}}});var gRe=H((zEr,dRe)=>{var fRe=Ae("util"),cDt=sRe(),kx=fZ(),hRe=m2().Writable,ARe=m2().PassThrough,pRe=function(){},uRe=function(t){return t&=511,t&&512-t},lDt=function(t,e){var r=new S_(t,e);return r.end(),r},uDt=function(t,e){return e.path&&(t.name=e.path),e.linkpath&&(t.linkname=e.linkpath),e.size&&(t.size=parseInt(e.size,10)),t.pax=e,t},S_=function(t,e){this._parent=t,this.offset=e,ARe.call(this,{autoDestroy:!1})};fRe.inherits(S_,ARe);S_.prototype.destroy=function(t){this._parent.destroy(t)};var fd=function(t){if(!(this instanceof fd))return new fd(t);hRe.call(this,t),t=t||{},this._offset=0,this._buffer=cDt(),this._missing=0,this._partial=!1,this._onparse=pRe,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var e=this,r=e._buffer,s=function(){e._continue()},a=function(v){if(e._locked=!1,v)return e.destroy(v);e._stream||s()},n=function(){e._stream=null;var v=uRe(e._header.size);v?e._parse(v,l):e._parse(512,w),e._locked||s()},l=function(){e._buffer.consume(uRe(e._header.size)),e._parse(512,w),s()},f=function(){var v=e._header.size;e._paxGlobal=kx.decodePax(r.slice(0,v)),r.consume(v),n()},h=function(){var v=e._header.size;e._pax=kx.decodePax(r.slice(0,v)),e._paxGlobal&&(e._pax=Object.assign({},e._paxGlobal,e._pax)),r.consume(v),n()},A=function(){var v=e._header.size;this._gnuLongPath=kx.decodeLongPath(r.slice(0,v),t.filenameEncoding),r.consume(v),n()},m=function(){var v=e._header.size;this._gnuLongLinkPath=kx.decodeLongPath(r.slice(0,v),t.filenameEncoding),r.consume(v),n()},w=function(){var v=e._offset,D;try{D=e._header=kx.decode(r.slice(0,512),t.filenameEncoding,t.allowUnknownFormat)}catch(I){e.emit("error",I)}if(r.consume(512),!D){e._parse(512,w),s();return}if(D.type==="gnu-long-path"){e._parse(D.size,A),s();return}if(D.type==="gnu-long-link-path"){e._parse(D.size,m),s();return}if(D.type==="pax-global-header"){e._parse(D.size,f),s();return}if(D.type==="pax-header"){e._parse(D.size,h),s();return}if(e._gnuLongPath&&(D.name=e._gnuLongPath,e._gnuLongPath=null),e._gnuLongLinkPath&&(D.linkname=e._gnuLongLinkPath,e._gnuLongLinkPath=null),e._pax&&(e._header=D=uDt(D,e._pax),e._pax=null),e._locked=!0,!D.size||D.type==="directory"){e._parse(512,w),e.emit("entry",D,lDt(e,v),a);return}e._stream=new S_(e,v),e.emit("entry",D,e._stream,a),e._parse(D.size,n),s()};this._onheader=w,this._parse(512,w)};fRe.inherits(fd,hRe);fd.prototype.destroy=function(t){this._destroyed||(this._destroyed=!0,t&&this.emit("error",t),this.emit("close"),this._stream&&this._stream.emit("close"))};fd.prototype._parse=function(t,e){this._destroyed||(this._offset+=t,this._missing=t,e===this._onheader&&(this._partial=!1),this._onparse=e)};fd.prototype._continue=function(){if(!this._destroyed){var t=this._cb;this._cb=pRe,this._overflow?this._write(this._overflow,void 0,t):t()}};fd.prototype._write=function(t,e,r){if(!this._destroyed){var s=this._stream,a=this._buffer,n=this._missing;if(t.length&&(this._partial=!0),t.length<n)return this._missing-=t.length,this._overflow=null,s?s.write(t,r):(a.append(t), Line truncated
Wanted: ${this.expectedSize}
Found: ${this.size}`);s.code="EBADSIZE",s.found=this.size,s.expected=this.expectedSize,s.sri=this.sri,this.emit("error",s)}else if(this.sri&&!r){let s=new Error(`${this.sri} integrity checksum failed when using ${this.algorithm}: wanted ${this.digests} but got ${e}. (${this.size} bytes)`);s.code="EINTEGRITY",s.found=e,s.expected=this.digests,s.algorithm=this.algorithm,s.sri=this.sri,this.emit("error",s)}else this.#t=this.size,this.emit("size",this.size),this.#e=e,this.emit("integrity",e),r&&(this.#r=r,this.emit("verified",r))}},pd=class{get isHash(){return!0}constructor(e,r){let s=r?.strict;this.source=e.trim(),this.digest="",this.algorithm="",this.options=[];let a=this.source.match(s?jDt:HDt);if(!a||s&&!PZ.includes(a[1]))return;this.algorithm=a[1],this.digest=a[2];let n=a[3];n&&(this.options=n.slice(1).split("?"))}hexDigest(){return this.digest&&Buffer.from(this.digest,"base64").toString("hex")}toJSON(){return this.toString()}match(e,r){let s=_l(e,r);if(!s)return!1;if(s.isIntegrity){let a=s.pickAlgorithm(r,[this.algorithm]);if(!a)return!1;let n=s[a].find(l=>l.digest===this.digest);return n||!1}return s.digest===this.digest?s:!1}toString(e){return e?.strict&&!(PZ.includes(this.algorithm)&&this.digest.match(UDt)&&this.options.every(r=>r.match(GDt)))?"":`${this.algorithm}-${this.digest}${_x(this.options)}`}};function LRe(t,e,r,s){let a=t!=="",n=!1,l="",f=s.length-1;for(let A=0;A<f;A++){let m=pd.prototype.toString.call(s[A],r);m&&(n=!0,l+=m,l+=e)}let h=pd.prototype.toString.call(s[f],r);return h&&(n=!0,l+=h),a&&n?t+e+l:t+l}var DE=class{get isIntegrity(){return!0}toJSON(){return this.toString()}isEmpty(){return Object.keys(this).length===0}toString(e){let r=e?.sep||" ",s="";if(e?.strict){r=r.replace(/\S+/g," ");for(let a of PZ)this[a]&&(s=LRe(s,r,e,this[a]))}else for(let a of Object.keys(this))s=LRe(s,r,e,this[a]);return s}concat(e,r){let s=typeof e=="string"?e:Ox(e,r);return _l(`${this.toString(r)} ${s}`,r)}hexDigest(){return _l(this,{single:!0}).hexDigest()}merge(e,r){let s=_l(e,r);for(let a in s)if(this[a]){if(!this[a].find(n=>s[a].find(l=>n.digest===l.digest)))throw new Error("hashes do not match, cannot update integrity")}else this[a]=s[a]}match(e,r){let s=_l(e,r);if(!s)return!1;let a=s.pickAlgorithm(r,Object.keys(this));return!!a&&this[a]&&s[a]&&this[a].find(n=>s[a].find(l=>n.digest===l.digest))||!1}pickAlgorithm(e,r){let s=e?.pickAlgorithm||ZDt,a=Object.keys(this).filter(n=>r?.length?r.includes(n):!0);return a.length?a.reduce((n,l)=>s(n,l)||n):null}};AA.exports.parse=_l;function _l(t,e){if(!t)return null;if(typeof t=="string")return DZ(t,e);if(t.algorithm&&t.digest){let r=new DE;return r[t.algorithm]=[t],DZ(Ox(r,e),e)}else return DZ(Ox(t,e),e)}function DZ(t,e){if(e?.single)return new pd(t,e);let r=t.trim().split(/\s+/).reduce((s,a)=>{let n=new pd(a,e);if(n.algorithm&&n.digest){let l=n.algorithm;s[l]||(s[l]=[]),s[l].push(n)}return s},new DE);return r.isEmpty()?null:r}AA.exports.stringify=Ox;function Ox(t,e){return t.algorithm&&t.digest?pd.prototype.toString.call(t,e):typeof t=="string"?Ox(_l(t,e),e):DE.prototype.toString.call(t,e)}AA.exports.fromHex=qDt;function qDt(t,e,r){let s=_x(r?.options);return _l(`${e}-${Buffer.from(t,"hex").toString("base64")}${s}`,r)}AA.exports.fromData=VDt;function VDt(t,e){let r=e?.algorithms||[...kZ],s=_x(e?.options);return r.reduce((a,n)=>{let l=Lx.createHash(n).update(t).digest("base64"),f=new pd(`${n}-${l}${s}`,e);if(f.algorithm&&f.digest){let h=f.algorithm;a[h]||(a[h]=[]),a[h].push(f)}return a},new DE)}AA.exports.fromStream=WDt;function WDt(t,e){let r=RZ(e);return new Promise((s,a)=>{t.pipe(r),t.on("error",a),r.on("error",a);let n;r.on("integrity",l=>{n=l}),r.on("end",()=>s(n)),r.resume()})}AA.exports.checkData=YDt;function YDt(t,e,r){if(e=_l(e,r),!e||!Object.keys(e).length){if(r?.error)throw Object.assign(new Error("No valid integrity hashes to check against"),{code:"EINTEGRITY"});return!1}let s=e.pickAlgorithm(r),a=Lx.createHash(s).update(t).digest("base64"),n=_l({algorithm:s,digest:a}),l=n.match(e,r);if(r=r||{},l||!r.error)return l;if(typeof r.size=="number"&&t.length!==r.size){let f=new Error(`data size mismatch when checking ${e}.
Wanted: ${r.size}
Found: ${t.length}`);throw f.code="EBADSIZE",f.found=t.length,f.expected=r.size,f.sri=e,f}else{let f=new Error(`Integrity checksum failed when using ${s}: Wanted ${e}, but got ${n}. (${t.length} bytes)`);throw f.code="EINTEGRITY",f.found=n,f.expected=e,f.algorithm=s,f.sri=e,f}}AA.exports.checkStream=KDt;function KDt(t,e,r){if(r=r||Object.create(null),r.integrity=e,e=_l(e,r),!e||!Object.keys(e).length)return Promise.reject(Object.assign(new Error("No valid integrity hashes to check against"),{code:"EINTEGRITY"}));let s=RZ(r);return new Promise((a,n)=>{t.pipe(s),t.on("error",n),s.on("error",n);let l;s.on("verified",f=>{l=f}),s.on("end",()=>a(l)),s.resume()})}AA.exports.integrityStream=RZ;function RZ(t=Object.create(null)){return new xZ(t)}AA.exports.create=zDt;function zDt(t){let e=t?.algorithms||[...kZ],r=_x(t?.options),s=e.map(Lx.createHash);return{update:function(a,n){return s.forEach(l=>l.update(a,n)),this},digest:function(){return e.reduce((n,l)=>{let f=s.shift().digest("base64"),h=new pd(`${l}-${f}${r}`,t);if(h.algorithm&&h.digest){let A=h.algorithm;n[A]||(n[A]=[]),n[A].push(h)}return n},new DE)}}}var JDt=Lx.getHashes(),_Re=["md5","whirlpool","sha1","sha224","sha256","sha384","sha512","sha3","sha3-256","sha3-384","sha3-512","sha3_256","sha3_384","sha3_512"].filter(t=>JDt.includes(t));function ZDt(t,e){return _Re.indexOf(t.toLowerCase())>=_Re.indexOf(e.toLowerCase())?t:e}});var U_=H(Mg=>{"use strict";Object.defineProperty(Mg,"__esModule",{value:!0});Mg.Signature=Mg.Envelope=void 0;Mg.Envelope={fromJSON(t){return{payload:M_(t.payload)?Buffer.from(URe(t.payload)):Buffer.alloc(0),payloadType:M_(t.payloadType)?globalThis.String(t.payloadType):"",signatures:globalThis.Array.isArray(t?.signatures)?t.signatures.map(e=>Mg.Signature.fromJSON(e)):[]}},toJSON(t){let e={};return t.payload.length!==0&&(e.payload=HRe(t.payload)),t.payloadType!==""&&(e.payloadType=t.payloadType),t.signatures?.length&&(e.signatures=t.signatures.map(r=>Mg.Signature.toJSON(r))),e}};Mg.Signature={fromJSON(t){return{sig:M_(t.sig)?Buffer.from(URe(t.sig)):Buffer.alloc(0),keyid:M_(t.keyid)?globalThis.String(t.keyid):""}},toJSON(t){let e={};return t.sig.length!==0&&(e.sig=HRe(t.sig)),t.keyid!==""&&(e.keyid=t.keyid),e}};function URe(t){return Uint8Array.from(globalThis.Buffer.from(t,"base64"))}function HRe(t){return globalThis.Buffer.from(t).toString("base64")}function M_(t){return t!=null}});var GRe=H(H_=>{"use strict";Object.defineProperty(H_,"__esModule",{value:!0});H_.Timestamp=void 0;H_.Timestamp={fromJSON(t){return{seconds:jRe(t.seconds)?globalThis.String(t.seconds):"0",nanos:jRe(t.nanos)?globalThis.Number(t.nanos):0}},toJSON(t){let e={};return t.seconds!=="0"&&(e.seconds=t.seconds),t.nanos!==0&&(e.nanos=Math.round(t.nanos)),e}};function jRe(t){return t!=null}});var dd=H(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.TimeRange=sn.X509CertificateChain=sn.SubjectAlternativeName=sn.X509Certificate=sn.DistinguishedName=sn.ObjectIdentifierValuePair=sn.ObjectIdentifier=sn.PublicKeyIdentifier=sn.PublicKey=sn.RFC3161SignedTimestamp=sn.LogId=sn.MessageSignature=sn.HashOutput=sn.SubjectAlternativeNameType=sn.PublicKeyDetails=sn.HashAlgorithm=void 0;sn.hashAlgorithmFromJSON=VRe;sn.hashAlgorithmToJSON=WRe;sn.publicKeyDetailsFromJSON=YRe;sn.publicKeyDetailsToJSON=KRe;sn.subjectAlternativeNameTypeFromJSON=zRe;sn.subjectAlternativeNameTypeToJSON=JRe;var XDt=GRe(),$c;(function(t){t[t.HASH_ALGORITHM_UNSPECIFIED=0]="HASH_ALGORITHM_UNSPECIFIED",t[t.SHA2_256=1]="SHA2_256",t[t.SHA2_384=2]="SHA2_384",t[t.SHA2_512=3]="SHA2_512",t[t.SHA3_256=4]="SHA3_256",t[t.SHA3_384=5]="SHA3_384"})($c||(sn.HashAlgorithm=$c={}));function VRe(t){switch(t){case 0:case"HASH_ALGORITHM_UNSPECIFIED":return $c.HASH_ALGORITHM_UNSPECIFIED;case 1:case"SHA2_256":return $c.SHA2_256;case 2:case"SHA2_384":return $c.SHA2_384;case 3:case"SHA2_512":return $c.SHA2_512;case 4:case"SHA3_256":return $c.SHA3_256;case 5:case"SHA3_384":return $c.SHA3_384;default:throw new globalThis.Error("Unrecognized enum value "+t+" for enum HashAlgorithm")}}function WRe(t){switch(t){case $c.HASH_ALGORITHM_UNSPECIFIED:return"HASH_ALGORITHM_UNSPECIFIED";case $c.SHA2_256:return"SHA2_256";case $c.SHA2_384:return"SHA2_384";case $c.SHA2_512:return"SHA2_512";case $c.SHA3_256:return"SHA3_256";case $c.SHA3_384:return"SHA3_384";default:throw new globalThis.Error("Unrecognized enum value "+t+" for enum HashAlgorithm")}}var tn;(function(t){t[t.PUBLIC_KEY_DETAILS_UNSPECIFIED=0]="PUBLIC_KEY_DETAILS_UNSPECIFIED",t[t.PKCS1_RSA_PKCS1V5=1]="PKCS1_RSA_PKCS1V5",t[t.PKCS1_RSA_PSS=2]="PKCS1_RSA_PSS",t[t.PKIX_RSA_PKCS1V5=3]="PKIX_RSA_PKCS1V5",t[t.PKIX_RSA_PSS=4]="PKIX_RSA_PSS",t[t.PKIX_RSA_PKCS1V15_2048_SHA256=9]="PKIX_RSA_PKCS1V15_2048_SHA256",t[t.PKIX_RSA_PKCS1V15_3072_SHA256=10]="PKIX_RSA_PKCS1V15_3072_SHA256",t[t.PKIX_RSA_PKCS1V15_4096_SHA256=11]="PKIX_RSA_PKCS1V15_4096_SHA256",t[t.PKIX_RSA_PSS_2048_SHA256=16]="PKIX_RSA_PSS_2048_SHA256",t[t.PKIX_RSA_PSS_3072_SHA256=17]="PKIX_RSA_PSS_3072_SHA256",t[t.PKIX_RS Line truncated
`).forEach(r=>{r.match(qPt)||r.match(VPt)||(e+=r)}),Buffer.from(e,"base64")}function YPt(t,e="CERTIFICATE"){let s=t.toString("base64").match(/.{1,64}/g)||"";return[`-----BEGIN ${e}-----`,...s,`-----END ${e}-----`].join(`
`).concat(`
`)}});var cM=H(Vg=>{"use strict";Object.defineProperty(Vg,"__esModule",{value:!0});Vg.SHA2_HASH_ALGOS=Vg.RSA_SIGNATURE_ALGOS=Vg.ECDSA_SIGNATURE_ALGOS=void 0;Vg.ECDSA_SIGNATURE_ALGOS={"1.2.840.10045.4.3.1":"sha224","1.2.840.10045.4.3.2":"sha256","1.2.840.10045.4.3.3":"sha384","1.2.840.10045.4.3.4":"sha512"};Vg.RSA_SIGNATURE_ALGOS={"1.2.840.113549.1.1.14":"sha224","1.2.840.113549.1.1.11":"sha256","1.2.840.113549.1.1.12":"sha384","1.2.840.113549.1.1.13":"sha512"};Vg.SHA2_HASH_ALGOS={"2.16.840.1.101.3.4.2.1":"sha256","2.16.840.1.101.3.4.2.2":"sha384","2.16.840.1.101.3.4.2.3":"sha512"}});var ZZ=H(lM=>{"use strict";Object.defineProperty(lM,"__esModule",{value:!0});lM.RFC3161TimestampVerificationError=void 0;var JZ=class extends Error{};lM.RFC3161TimestampVerificationError=JZ});var PTe=H(yA=>{"use strict";var KPt=yA&&yA.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),zPt=yA&&yA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JPt=yA&&yA.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var s=[];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[s.length]=a);return s},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var s=t(e),a=0;a<s.length;a++)s[a]!=="default"&&KPt(r,e,s[a]);return zPt(r,e),r}}();Object.defineProperty(yA,"__esModule",{value:!0});yA.TSTInfo=void 0;var DTe=JPt(x2()),ZPt=cM(),XPt=ZZ(),XZ=class{root;constructor(e){this.root=e}get version(){return this.root.subs[0].toInteger()}get genTime(){return this.root.subs[4].toDate()}get messageImprintHashAlgorithm(){let e=this.messageImprintObj.subs[0].subs[0].toOID();return ZPt.SHA2_HASH_ALGOS[e]}get messageImprintHashedMessage(){return this.messageImprintObj.subs[1].value}get raw(){return this.root.toDER()}verify(e){let r=DTe.digest(this.messageImprintHashAlgorithm,e);if(!DTe.bufferEqual(r,this.messageImprintHashedMessage))throw new XPt.RFC3161TimestampVerificationError("message imprint does not match artifact")}get messageImprintObj(){return this.root.subs[2]}};yA.TSTInfo=XZ});var kTe=H(EA=>{"use strict";var $Pt=EA&&EA.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),ext=EA&&EA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),txt=EA&&EA.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var s=[];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[s.length]=a);return s},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var s=t(e),a=0;a<s.length;a++)s[a]!=="default"&&$Pt(r,e,s[a]);return ext(r,e),r}}();Object.defineProperty(EA,"__esModule",{value:!0});EA.RFC3161Timestamp=void 0;var rxt=sM(),$Z=txt(x2()),xTe=cM(),jx=ZZ(),nxt=PTe(),ixt="1.2.840.113549.1.7.2",sxt="1.2.840.113549.1.9.16.1.4",oxt="1.2.840.113549.1.9.4",eX=class t{root;constructor(e){this.root=e}static parse(e){let r=rxt.ASN1Obj.parseBuffer(e);return new t(r)}get status(){return this.pkiStatusInfoObj.subs[0].toInteger()}get contentType(){return this.contentTypeObj.toOID()}get eContentType(){return this.eContentTypeObj.toOID()}get signingTime(){return this.tstInfo.genTime}get signerIssuer(){return this.signerSidObj.subs[0].value}get signerSerialNumber(){return this.signerSidObj.subs[1].value}get signerDigestAlgorithm(){let e=this.signerDigestAlgorithmObj.subs[0].toOID();return xTe.SHA2_HASH_ALGOS[e]}get signatureAlgorithm(){let e=this.signatureAlgorithmObj.subs[0].toOID();return xTe.ECDSA_SIGNATURE_ALGOS[e]}get signatureValue(){return this.signatureValueObj.value}get tstInfo(){return new nxt.TSTInfo(this.eContentObj.subs[0].subs[0])}verify(e,r){if(!this.timeStampTokenObj)throw new jx.RFC3161TimestampVerificationError("timeStampToken is missing");if(this.contentType!==ixt)throw new jx.RFC3161TimestampVerificationError(`incorrect content type: ${this.contentType}`);if(this.eContentType!==sxt)throw new jx.RFC3161TimestampVerificationError(`incorrect encapsulated content type: ${this.eContentType}`);this.tstInfo.verify(e),this.verifyMessageDigest(),this.verifySignature(r)}verifyMessageDigest(){let e=$Z.digest(this.signerDigestAlgorithm,this.tstInfo.raw),r=this.messageDigestAttributeObj.subs[1].subs[0].value;if(!$Z.bufferEqual(e,r))throw new jx.RFC3161TimestampVerificationError("signed data does not match tstInfo")}verifySignature(e){let r=this.signedAttrsObj.toDER();if(r[0]=49,!$Z.verify( Line truncated
\v\f\r\x1B !"#$\u066A&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~\x7F\xB0\xB7\u2219\u221A\u2592\u2500\u2502\u253C\u2524\u252C\u251C\u2534\u2510\u250C\u2514\u2518\u03B2\u221E\u03C6\xB1\xBD\xBC\u2248\xAB\xBB\uFEF7\uFEF8\uFFFD\uFFFD\uFEFB\uFEFC\uFFFD\xA0\xAD\uFE82\xA3\xA4\uFE84\uFFFD\uFFFD\uFE8E\uFE8F\uFE95\uFE99\u060C\uFE9D\uFEA1\uFEA5\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\uFED1\u061B\uFEB1\uFEB5\uFEB9\u061F\xA2\uFE80\uFE81\uFE83\uFE85\uFECA\uFE8B\uFE8D\uFE91\uFE93\uFE97\uFE9B\uFE9F\uFEA3\uFEA7\uFEA9\uFEAB\uFEAD\uFEAF\uFEB3\uFEB7\uFEBB\uFEBF\uFEC1\uFEC5\uFECB\uFECF\xA6\xAC\xF7\xD7\uFEC9\u0640\uFED3\uFED7\uFEDB\uFEDF\uFEE3\uFEE7\uFEEB\uFEED\uFEEF\uFEF3\uFEBD\uFECC\uFECE\uFECD\uFEE1\uFE7D\u0651\uFEE5\uFEE9\uFEEC\uFEF0\uFEF2\uFED0\uFED5\uFEF5\uFEF6\uFEDD\uFED9\uFEF1\u25A0\uFFFD`},ibm864:"cp864",csibm864:"cp864",cp865:{type:"_sbcs",chars:"\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xF8\xA3\xD8\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xA4\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"},ibm865:"cp865",csibm865:"cp865",cp866:{type:"_sbcs",chars:"\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u0401\u0451\u0404\u0454\u0407\u0457\u040E\u045E\xB0\u2219\xB7\u221A\u2116\xA4\u25A0\xA0"},ibm866:"cp866",csibm866:"cp866",cp869:{type:"_sbcs",chars:"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0386\uFFFD\xB7\xAC\xA6\u2018\u2019\u0388\u2015\u0389\u038A\u03AA\u038C\uFFFD\uFFFD\u038E\u03AB\xA9\u038F\xB2\xB3\u03AC\xA3\u03AD\u03AE\u03AF\u03CA\u0390\u03CC\u03CD\u0391\u0392\u0393\u0394\u0395\u0396\u0397\xBD\u0398\u0399\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u039A\u039B\u039C\u039D\u2563\u2551\u2557\u255D\u039E\u039F\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u03A0\u03A1\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03B1\u03B2\u03B3\u2518\u250C\u2588\u2584\u03B4\u03B5\u2580\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3\u03C2\u03C4\u0384\xAD\xB1\u03C5\u03C6\u03C7\xA7\u03C8\u0385\xB0\xA8\u03C9\u03CB\u03B0\u03CE\u25A0\xA0"},ibm869:"cp869",csibm869:"cp869",cp922:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\u203E\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\u0160\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\u017D\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\u0161\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\u017E\xFF"},ibm922:"cp922",csibm922:"cp922",cp1046:{type:"_sbcs",chars:"\uFE88\xD7\xF7\uF8F6\uF8F5\uF8F4\uF8F7\uFE71\x88\u25A0\u2502\u2500\u2510\u250C\u2514\u2518\uFE79\uFE7B\uFE7D\uFE7F\uFE77\uFE8A\uFEF0\uFEF3\uFEF2\uFECE\uFECF\uFED0\uFEF6\uFEF8\uFEFA\uFEFC\xA0\uF8FA\uF8F9\uF8F8\xA4\uF8FB\uFE8B\uFE91\uFE97\uFE9B\uFE9F\uFEA3\u060C\xAD\uFEA7\uFEB3\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\uFEB7\u061B\uFEBB\uFEBF\uFECA\u061F\uFECB\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\uFEC7\u0639\u063A\uFECC\uFE82\uFE84\uFE8E\uFED3\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u064B\u064C\u064D\u064E\u064F\u0650\u0651\u0652\uFED7\uFEDB\uFEDF\uF8FC\uFEF5\uFEF7\uFEF9\uFEFB\uFEE3\uFEE7\uFEEC\uFEE9\uFFFD"},ibm1046:"cp1046",csibm1046:"cp1046",cp1124:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0401\u0402\u0490\u0404\u0405\u0406\u0407\u0408\u0409\u040A\u040B\u040C\xAD\u040E\u040F\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041FLine truncated
\v\f\r\u1EE8\u1EF0\u1EF2\u1EF6\u1EF8\xDD\u1EF4\x1B !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~\x7F\xC0\u1EA2\xC3\xC1\u1EA0\u1EB6\u1EAC\xC8\u1EBA\u1EBC\xC9\u1EB8\u1EC6\xCC\u1EC8\u0128\xCD\u1ECA\xD2\u1ECE\xD5\xD3\u1ECC\u1ED8\u1EDC\u1EDE\u1EE0\u1EDA\u1EE2\xD9\u1EE6\u0168\xA0\u0102\xC2\xCA\xD4\u01A0\u01AF\u0110\u0103\xE2\xEA\xF4\u01A1\u01B0\u0111\u1EB0\u0300\u0309\u0303\u0301\u0323\xE0\u1EA3\xE3\xE1\u1EA1\u1EB2\u1EB1\u1EB3\u1EB5\u1EAF\u1EB4\u1EAE\u1EA6\u1EA8\u1EAA\u1EA4\u1EC0\u1EB7\u1EA7\u1EA9\u1EAB\u1EA5\u1EAD\xE8\u1EC2\u1EBB\u1EBD\xE9\u1EB9\u1EC1\u1EC3\u1EC5\u1EBF\u1EC7\xEC\u1EC9\u1EC4\u1EBE\u1ED2\u0129\xED\u1ECB\xF2\u1ED4\u1ECF\xF5\xF3\u1ECD\u1ED3\u1ED5\u1ED7\u1ED1\u1ED9\u1EDD\u1EDF\u1EE1\u1EDB\u1EE3\xF9\u1ED6\u1EE7\u0169\xFA\u1EE5\u1EEB\u1EED\u1EEF\u1EE9\u1EF1\u1EF3\u1EF7\u1EF9\xFD\u1EF5\u1ED0`},georgianacademy:{type:"_sbcs",chars:"\x80\x81\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u0160\u2039\u0152\x8D\x8E\x8F\x90\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u0161\u203A\u0153\x9D\x9E\u0178\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\u10D0\u10D1\u10D2\u10D3\u10D4\u10D5\u10D6\u10D7\u10D8\u10D9\u10DA\u10DB\u10DC\u10DD\u10DE\u10DF\u10E0\u10E1\u10E2\u10E3\u10E4\u10E5\u10E6\u10E7\u10E8\u10E9\u10EA\u10EB\u10EC\u10ED\u10EE\u10EF\u10F0\u10F1\u10F2\u10F3\u10F4\u10F5\u10F6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"},georgianps:{type:"_sbcs",chars:"\x80\x81\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u0160\u2039\u0152\x8D\x8E\x8F\x90\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u0161\u203A\u0153\x9D\x9E\u0178\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\u10D0\u10D1\u10D2\u10D3\u10D4\u10D5\u10D6\u10F1\u10D7\u10D8\u10D9\u10DA\u10DB\u10DC\u10F2\u10DD\u10DE\u10DF\u10E0\u10E1\u10E2\u10F3\u10E3\u10E4\u10E5\u10E6\u10E7\u10E8\u10E9\u10EA\u10EB\u10EC\u10ED\u10EE\u10F4\u10EF\u10F0\u10F5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"},pt154:{type:"_sbcs",chars:"\u0496\u0492\u04EE\u0493\u201E\u2026\u04B6\u04AE\u04B2\u04AF\u04A0\u04E2\u04A2\u049A\u04BA\u04B8\u0497\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u04B3\u04B7\u04A1\u04E3\u04A3\u049B\u04BB\u04B9\xA0\u040E\u045E\u0408\u04E8\u0498\u04B0\xA7\u0401\xA9\u04D8\xAB\xAC\u04EF\xAE\u049C\xB0\u04B1\u0406\u0456\u0499\u04E9\xB6\xB7\u0451\u2116\u04D9\xBB\u0458\u04AA\u04AB\u049D\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F"},viscii:{type:"_sbcs",chars:`\0\u1EB2\u1EB4\u1EAA\x07\b
\v\f\r\u1EF6\u1EF8\x1B\u1EF4 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~\x7F\u1EA0\u1EAE\u1EB0\u1EB6\u1EA4\u1EA6\u1EA8\u1EAC\u1EBC\u1EB8\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EE2\u1EDA\u1EDC\u1EDE\u1ECA\u1ECE\u1ECC\u1EC8\u1EE6\u0168\u1EE4\u1EF2\xD5\u1EAF\u1EB1\u1EB7\u1EA5\u1EA7\u1EA9\u1EAD\u1EBD\u1EB9\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1ED1\u1ED3\u1ED5\u1ED7\u1EE0\u01A0\u1ED9\u1EDD\u1EDF\u1ECB\u1EF0\u1EE8\u1EEA\u1EEC\u01A1\u1EDB\u01AF\xC0\xC1\xC2\xC3\u1EA2\u0102\u1EB3\u1EB5\xC8\xC9\xCA\u1EBA\xCC\xCD\u0128\u1EF3\u0110\u1EE9\xD2\xD3\xD4\u1EA1\u1EF7\u1EEB\u1EED\xD9\xDA\u1EF9\u1EF5\xDD\u1EE1\u01B0\xE0\xE1\xE2\xE3\u1EA3\u0103\u1EEF\u1EAB\xE8\xE9\xEA\u1EBB\xEC\xED\u0129\u1EC9\u0111\u1EF1\xF2\xF3\xF4\xF5\u1ECF\u1ECD\u1EE5\xF9\xFA\u0169\u1EE7\xFD\u1EE3\u1EEE`},iso646cn:{type:"_sbcs",chars:`\0\x07\b
\v\f\r\x1B !"#\xA5%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}\u203E\x7F\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD`},iso646jp:{type:"_sbcs",chars:`\0\x07\b
\v\f\r\x1B !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\xA5]^_\`abcdefghijklmnopqrstuvwxyz{|}\u203E\x7F\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD`},hproman8:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xC0\xC2\xC8\xCA\xCB\xCE\xCF\xB4\u02CB\u02C6\xA8\u02DC\xD9\xDB\u20A4\xAF\xDD\xFD\xB0\xC7\xE7\xD1\xF1\xA1\xBF\xA4\xA3\xA5\xA7\u0192\xA2\xE2\xEA\xF4\xFB\xE1\xE9\xF3\xFA\xE0\xE8\xF2\xF9\xE4\xEB\xF6\xFC\xC5\xEE\xD8\xC6\xE5\xED\xF8\xE6\xC4\xEC\xD6\xDC\xC9\xEF\xDF\xD4\xC1\xC3\xE3\xD0\xF0\xCD\xCC\xD3\xD2\xD5\xF5\u0160\u0161\xDA\u0178\xFF\xDE\xFE\xB7\xB5\xB6\xBE\u2014\xBC\xBD\xAA\xBA\xAB\u25A0\xBB\xB1\uFFFD"},macintosh:{type:"_sbcs",chars:"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u2126\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\xA4\u2039\u203A\uFB01\uFB02\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uFFFD\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7"},ascii:{type:"_sbcs",chars:"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"},tis620:{type:"_sbcs",chars:"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37\u0E38\u0E39\u0E3A\uFFFD\uFFFD\uFFFD\uFFFD\u0E3F\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\u0E5A\u0E5B\uFFFD\uFFFD\uFFFD\uFFFD"}}});var NQe=H(FQe=>{"use strict";var v$=Bd().Buffer;FQe._dbcs=vd;var zo=-1,QQe=-2,Lu=-10,dc=-1e3,L2=new Array(256),Xx=-1;for(FM=0;FM<256;FM++)L2[FM]=zo;var FM;function vd(t,e){if(this.encodingName=t.encodingName,!t)throw new Error("DBCS codec is called without the data.");if(!t.table)throw new Error("Encoding '"+this.encodingName+"' has no data.");var r=t.table();this.decodeTables=[],this.decodeTables[0]=L2.slice(0),this.decodeTableSeq=[];for(var s=0;s<r.length;s++)this._addDecodeChunk(r[s]);if(typeof t.gb18030=="function"){this.gb18030=t.gb18030();var a=this.decodeTables.length;this.decodeTables.push(L2.slice(0));var n=this.decodeTables.length;this.decodeTables.push(L2.slice(0));for(var l=this.decodeTables[0],s=129;s<=254;s++)for(var f=this.decodeTables[dc-l[s]],h=48;h<=57;h++){if(f[h]===zo)f[h]=dc-a;else if(f[h]>dc)throw new Error("gb18030 decode tables conflict at byte 2");for(var A=this.decodeTables[dc-f[h]],m=129;m<=254;m++){if(A[m]===zo)A[m]=dc-n;else{if(A[m]===dc-n)continue;if(A[m]>dc)throw new Error("gb18030 decode tables conflict at byte 3")}for(var w=this.decodeTables[dc-A[m]],v=48;v<=57;v++)w[v]===zo&&(w[v]=QQe)}}}this.defaultCharUnicode=e.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var D={};if(t.encodeSkipVals)for(var s=0;s<t.encodeSkipValsLine truncated
Wanted: ${this.expectedSize}
Found: ${this.size}`);s.code="EBADSIZE",s.found=this.size,s.expected=this.expectedSize,s.sri=this.sri,this.emit("error",s)}else if(this.sri&&!r){let s=new Error(`${this.sri} integrity checksum failed when using ${this.algorithm}: wanted ${this.digests} but got ${e}. (${this.size} bytes)`);s.code="EINTEGRITY",s.found=e,s.expected=this.digests,s.algorithm=this.algorithm,s.sri=this.sri,this.emit("error",s)}else this.#t=this.size,this.emit("size",this.size),this.#e=e,this.emit("integrity",e),r&&(this.#r=r,this.emit("verified",r))}},Pd=class{get isHash(){return!0}constructor(e,r){let s=r?.strict;this.source=e.trim(),this.digest="",this.algorithm="",this.options=[];let a=this.source.match(s?FRt:QRt);if(!a||s&&!V$.includes(a[1]))return;this.algorithm=a[1],this.digest=a[2];let n=a[3];n&&(this.options=n.slice(1).split("?"))}hexDigest(){return this.digest&&Buffer.from(this.digest,"base64").toString("hex")}toJSON(){return this.toString()}match(e,r){let s=Ul(e,r);if(!s)return!1;if(s.isIntegrity){let a=s.pickAlgorithm(r,[this.algorithm]);if(!a)return!1;let n=s[a].find(l=>l.digest===this.digest);return n||!1}return s.digest===this.digest?s:!1}toString(e){return e?.strict&&!(V$.includes(this.algorithm)&&this.digest.match(TRt)&&this.options.every(r=>r.match(NRt)))?"":`${this.algorithm}-${this.digest}${ak(this.options)}`}};function GFe(t,e,r,s){let a=t!=="",n=!1,l="",f=s.length-1;for(let A=0;A<f;A++){let m=Pd.prototype.toString.call(s[A],r);m&&(n=!0,l+=m,l+=e)}let h=Pd.prototype.toString.call(s[f],r);return h&&(n=!0,l+=h),a&&n?t+e+l:t+l}var jE=class{get isIntegrity(){return!0}toJSON(){return this.toString()}isEmpty(){return Object.keys(this).length===0}toString(e){let r=e?.sep||" ",s="";if(e?.strict){r=r.replace(/\S+/g," ");for(let a of V$)this[a]&&(s=GFe(s,r,e,this[a]))}else for(let a of Object.keys(this))s=GFe(s,r,e,this[a]);return s}concat(e,r){let s=typeof e=="string"?e:sk(e,r);return Ul(`${this.toString(r)} ${s}`,r)}hexDigest(){return Ul(this,{single:!0}).hexDigest()}merge(e,r){let s=Ul(e,r);for(let a in s)if(this[a]){if(!this[a].find(n=>s[a].find(l=>n.digest===l.digest)))throw new Error("hashes do not match, cannot update integrity")}else this[a]=s[a]}match(e,r){let s=Ul(e,r);if(!s)return!1;let a=s.pickAlgorithm(r,Object.keys(this));return!!a&&this[a]&&s[a]&&this[a].find(n=>s[a].find(l=>n.digest===l.digest))||!1}pickAlgorithm(e,r){let s=e?.pickAlgorithm||GRt,a=Object.keys(this).filter(n=>r?.length?r.includes(n):!0);return a.length?a.reduce((n,l)=>s(n,l)||n):null}};bA.exports.parse=Ul;function Ul(t,e){if(!t)return null;if(typeof t=="string")return q$(t,e);if(t.algorithm&&t.digest){let r=new jE;return r[t.algorithm]=[t],q$(sk(r,e),e)}else return q$(sk(t,e),e)}function q$(t,e){if(e?.single)return new Pd(t,e);let r=t.trim().split(/\s+/).reduce((s,a)=>{let n=new Pd(a,e);if(n.algorithm&&n.digest){let l=n.algorithm;s[l]||(s[l]=[]),s[l].push(n)}return s},new jE);return r.isEmpty()?null:r}bA.exports.stringify=sk;function sk(t,e){return t.algorithm&&t.digest?Pd.prototype.toString.call(t,e):typeof t=="string"?sk(Ul(t,e),e):jE.prototype.toString.call(t,e)}bA.exports.fromHex=ORt;function ORt(t,e,r){let s=ak(r?.options);return Ul(`${e}-${Buffer.from(t,"hex").toString("base64")}${s}`,r)}bA.exports.fromData=LRt;function LRt(t,e){let r=e?.algorithms||[...Y$],s=ak(e?.options);return r.reduce((a,n)=>{let l=ok.createHash(n).update(t).digest("base64"),f=new Pd(`${n}-${l}${s}`,e);if(f.algorithm&&f.digest){let h=f.algorithm;a[h]||(a[h]=[]),a[h].push(f)}return a},new jE)}bA.exports.fromStream=_Rt;function _Rt(t,e){let r=K$(e);return new Promise((s,a)=>{t.pipe(r),t.on("error",a),r.on("error",a);let n;r.on("integrity",l=>{n=l}),r.on("end",()=>s(n)),r.resume()})}bA.exports.checkData=MRt;function MRt(t,e,r){if(e=Ul(e,r),!e||!Object.keys(e).length){if(r?.error)throw Object.assign(new Error("No valid integrity hashes to check against"),{code:"EINTEGRITY"});return!1}let s=e.pickAlgorithm(r),a=ok.createHash(s).update(t).digest("base64"),n=Ul({algorithm:s,digest:a}),l=n.match(e,r);if(r=r||{},l||!r.error)return l;if(typeof r.size=="number"&&t.length!==r.size){let f=new Error(`data size mismatch when checking ${e}.
Wanted: ${r.size}
Found: ${t.length}`);throw f.code="EBADSIZE",f.found=t.length,f.expected=r.size,f.sri=e,f}else{let f=new Error(`Integrity checksum failed when using ${s}: Wanted ${e}, but got ${n}. (${t.length} bytes)`);throw f.code="EINTEGRITY",f.found=n,f.expected=e,f.algorithm=s,f.sri=e,f}}bA.exports.checkStream=URt;function URt(t,e,r){if(r=r||Object.create(null),r.integrity=e,e=Ul(e,r),!e||!Object.keys(e).length)return Promise.reject(Object.assign(new Error("No valid integrity hashes to check against"),{code:"EINTEGRITY"}));let s=K$(r);return new Promise((a,n)=>{t.pipe(s),t.on("error",n),s.on("error",n);let l;s.on("verified",f=>{l=f}),s.on("end",()=>a(l)),s.resume()})}bA.exports.integrityStream=K$;function K$(t=Object.create(null)){return new W$(t)}bA.exports.create=HRt;function HRt(t){let e=t?.algorithms||[...Y$],r=ak(t?.options),s=e.map(ok.createHash);return{update:function(a,n){return s.forEach(l=>l.update(a,n)),this},digest:function(){return e.reduce((n,l)=>{let f=s.shift().digest("base64"),h=new Pd(`${l}-${f}${r}`,t);if(h.algorithm&&h.digest){let A=h.algorithm;n[A]||(n[A]=[]),n[A].push(h)}return n},new jE)}}}var jRt=ok.getHashes(),qFe=["md5","whirlpool","sha1","sha224","sha256","sha384","sha512","sha3","sha3-256","sha3-384","sha3-512","sha3_256","sha3_384","sha3_512"].filter(t=>jRt.includes(t));function GRt(t,e){return qFe.indexOf(t.toLowerCase())>=qFe.indexOf(e.toLowerCase())?t:e}});var J$=H((rCr,zFe)=>{var VFe=IG(),WFe=jFe(),qRt=Zg(),YFe={shared:!1,ignoreCargoCult:!0},VRt={status:200,headers:{}},H2=t=>{let e={method:t.method,url:t.url,headers:{},compress:t.compress};return t.headers.forEach((r,s)=>{e.headers[s]=r}),e},KFe=t=>{let e={status:t.status,headers:{}};return t.headers.forEach((r,s)=>{e.headers[s]=r}),e},z$=class{constructor({entry:e,request:r,response:s,options:a}){this.entry=e,this.request=H2(r),this.response=KFe(s),this.options=a,this.policy=new VFe(this.request,this.response,YFe),this.entry&&(this.policy._responseTime=this.entry.metadata.time)}static storable(e,r){return!r.cachePath||r.cache==="no-store"||!["GET","HEAD"].includes(e.method)?!1:new VFe(H2(e),VRt,YFe).storable()}satisfies(e){let r=H2(e);if(this.request.headers.host!==r.headers.host||this.request.compress!==r.compress)return!1;let s=new WFe(this.request),a=new WFe(r);return JSON.stringify(s.mediaTypes())!==JSON.stringify(a.mediaTypes())||JSON.stringify(s.languages())!==JSON.stringify(a.languages())||JSON.stringify(s.encodings())!==JSON.stringify(a.encodings())?!1:this.options.integrity?qRt.parse(this.options.integrity).match(this.entry.integrity):!0}storable(){return this.policy.storable()}get mustRevalidate(){return!!this.policy._rescc["must-revalidate"]}needsRevalidation(e){let r=H2(e);return r.method="GET",!this.policy.satisfiesWithoutRevalidation(r)}responseHeaders(){return this.policy.responseHeaders()}revalidationHeaders(e){let r=H2(e);return this.policy.revalidationHeaders(r)}revalidated(e,r){let s=H2(e),a=KFe(r);return!this.policy.revalidatedPolicy(s,a).modified}};zFe.exports=z$});var ZFe=H((nCr,JFe)=>{var Z$=class extends Error{constructor(e){super(`request to ${e} failed: cache mode is 'only-if-cached' but no cached response is available.`),this.code="ENOTCACHED"}};JFe.exports={NotCachedError:Z$}});var KM=H((iCr,tNe)=>{var WRt=vM(),XFe=Symbol("_flush"),$Fe=Symbol("_flushed"),eNe=Symbol("_flushing"),X$=class extends WRt{constructor(e={}){if(typeof e=="function"&&(e={flush:e}),super(e),typeof e.flush!="function"&&typeof this.flush!="function")throw new TypeError("must provide flush function in options");this[XFe]=e.flush||this.flush}emit(e,...r){if(e!=="end"&&e!=="finish"||this[$Fe])return super.emit(e,...r);if(this[eNe])return;this[eNe]=!0;let s=n=>{this[$Fe]=!0,n?super.emit("error",n):super.emit("end")},a=this[XFe](s);a&&a.then&&a.then(()=>s(),n=>s(n))}};tNe.exports=X$});var ree=H((sCr,tee)=>{var{Minipass:rNe}=Ko(),j2=Symbol("_data"),G2=Symbol("_length"),$$=class extends rNe{constructor(e){super(e),this[j2]=[],this[G2]=0}write(e,r,s){typeof r=="function"&&(s=r,r="utf8"),r||(r="utf8");let a=Buffer.isBuffer(e)?e:Buffer.from(e,r);return this[j2].push(a),this[G2]+=a.length,s&&s(),!0}end(e,r,s){typeof e=="function"&&(s=e,e=null),typeof r=="function"&&(s=r,r="utf8"),e&&this.write(e,r);let a=Buffer.concat(this[j2],this[G2]);return super.write(a),super.end(s)}};tee.exports=$$;var eee=class extends rNe{constructor(e){super(e),this[j2]=[],this[G2]=0}write(e,r,s){typeof r=="function"&&(s=r,r="utf8"),r||(r="utf8");let a=Buffer.isBuffer(e)?e:Buffer.from(e,r);return this[j2].push(a),this[G2]+=a.length,super.write(e,r,s)}end(e,r,s){typeof e=="function"&&(s=e,e=null),typeof r=="function"&&(s=r,r="utf8"),e&&this.write(e,r);let a=Buffer.concat(this[j2],this[G2]);return this.emit("collect",a),super.end(s)}};tee.exports.PassThrough=eee});var q2=H((oCr,oNe)=>{var YRt=vM(),KRt=Ae("events"),zRt=t=>t&&t instanceof KRt&&(typeof t.pipe=="function"||typeof t.write=="function"&&typeof t.end=="function"),GE=Symbol("_head"),Hl=Symbol("_tail"),nee=Symbol( Line truncated
`+l.map(v=>{let D=JSON.stringify(v);return`${n4(D)} ${D}`}).join(`
`),h=async()=>{let v=EQt(PA.join(t,"tmp"),s.tmpPrefix);return await Iee(PA.dirname(v),{recursive:!0}),{target:v,moved:!1}},A=async v=>{if(!v.moved)return $Ne(v.target,{recursive:!0,force:!0})},m=async v=>{await gQt(v.target,f,{flag:"wx"}),await Iee(PA.dirname(a),{recursive:!0}),await BQt(v.target,a),v.moved=!0},w=await h();try{await m(w)}finally{await A(w)}return l.reverse().map(v=>i4(t,v,!0))}jl.exports.insert=eOe;async function eOe(t,e,r,s={}){let{metadata:a,size:n,time:l}=s,f=fk(t,e),h={key:e,integrity:r&&yQt.stringify(r),time:l||Date.now(),size:n,metadata:a};try{await Iee(PA.dirname(f),{recursive:!0});let A=JSON.stringify(h);await AQt(f,`
${n4(A)} ${A}`)}catch(A){if(A.code==="ENOENT")return;throw A}return i4(t,h)}jl.exports.find=SQt;async function SQt(t,e){let r=fk(t,e);try{return(await r4(r)).reduce((a,n)=>n&&n.key===e?i4(t,n):a,null)}catch(s){if(s.code==="ENOENT")return null;throw s}}jl.exports.delete=bQt;function bQt(t,e,r={}){if(!r.removeFully)return eOe(t,e,null,r);let s=fk(t,e);return $Ne(s,{recursive:!0,force:!0})}jl.exports.lsStream=tOe;function tOe(t){let e=wee(t),r=new mQt({objectMode:!0});return Promise.resolve().then(async()=>{let{default:s}=await Promise.resolve().then(()=>(t4(),e4)),a=await Eee(e);return await s(a,async n=>{let l=PA.join(e,n),f=await Eee(l);await s(f,async h=>{let A=PA.join(l,h),m=await Eee(A);await s(m,async w=>{let v=PA.join(A,w);try{let I=(await r4(v)).reduce((R,N)=>(R.set(N.key,N),R),new Map);for(let R of I.values()){let N=i4(t,R);N&&r.write(N)}}catch(D){if(D.code==="ENOENT")return;throw D}},{concurrency:yee})},{concurrency:yee})},{concurrency:yee}),r.end(),r}).catch(s=>r.emit("error",s)),r}jl.exports.ls=DQt;async function DQt(t){return(await tOe(t).collect()).reduce((r,s)=>(r[s.key]=s,r),{})}jl.exports.bucketEntries=r4;async function r4(t,e){let r=await pQt(t,"utf8");return PQt(r,e)}function PQt(t){let e=[];return t.split(`
`).forEach(r=>{if(!r)return;let s=r.split(" ");if(!s[1]||n4(s[1])!==s[0])return;let a;try{a=JSON.parse(s[1])}catch{}a&&e.push(a)}),e}jl.exports.bucketDir=wee;function wee(t){return PA.join(t,`index-v${CQt}`)}jl.exports.bucketPath=fk;function fk(t,e){let r=rOe(e);return PA.join.apply(PA,[wee(t)].concat(wQt(r)))}jl.exports.hashKey=rOe;function rOe(t){return nOe(t,"sha256")}jl.exports.hashEntry=n4;function n4(t){return nOe(t,"sha1")}function nOe(t,e){return hQt.createHash(e).update(t).digest("hex")}function i4(t,e,r){return!e.integrity&&!r?null:{key:e.key,integrity:e.integrity,path:e.integrity?IQt(t,e.integrity):void 0,size:e.size,time:e.time,metadata:e.metadata}}function Eee(t){return dQt(t).catch(e=>{if(e.code==="ENOENT"||e.code==="ENOTDIR")return[];throw e})}});var z2=H(o4=>{"use strict";Object.defineProperty(o4,"__esModule",{value:!0});o4.LRUCache=void 0;var xQt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,sOe=new Set,Cee=typeof process=="object"&&process?process:{},oOe=(t,e,r,s)=>{typeof Cee.emitWarning=="function"?Cee.emitWarning(t,e,r,s):console.error(`[${r}] ${e}: ${t}`)},s4=globalThis.AbortController,iOe=globalThis.AbortSignal;if(typeof s4>"u"){iOe=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,a){this._onabort.push(a)}},s4=class{constructor(){e()}signal=new iOe;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let a of this.signal._onabort)a(s);this.signal.onabort?.(s)}}};let t=Cee.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,oOe("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var kQt=t=>!sOe.has(t),PCr=Symbol("type"),Xg=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),aOe=t=>Xg(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?K2:null:null,K2=class extends Array{constructor(e){super(e),this.fill(0)}},Bee=class t{heap;length;static#e=!1;static create(e){let r=aOe(e);if(!r)return[];t.#e=!0;let s=new t(e,r);return t.#e=!1,s}constructor(e,r){if(!t.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},vee=class t{#e;#t;#r;#n;#s;#i;#l;#u;get perf(){return this.#u}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#A;#p;#f;#a;#d;#w;#I;#g;#P;#m;#v;#S;#y;#E;#C;#b;#o;#F;static unsafeExposeInternals(e){return{starts:e.#S,ttls:e.#y,autopurgeTimers:e.#E,sizes:e.#v,keyMap:e.#p,keyList:e.#f,valList:e.#a,next:e.#d,prev:e.#w,get head(){return e.#I},get tail(){return e.#g},free:e.#P,isBackgroundFetch:r=>e.#h(r),backgroundFetch:(r,s,a,n)=>e.#j(r,s,a,n),moveToTail:r=>e.#O(r),indexes:r=>e.#k(r),rindexes:r=>e.#R(r),isStale:r=>e.#B(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#A}get size(){return this.#c}get fetchMethod(){return this.#i}get memoMethod(){return this.#l}get dispose(){return this.#r}get onInsert(){return this.#n}get disposeAfter(){return this.#s}constructor(e){let{max:r=0,ttl:s,ttlResolution:a=1,ttlAutopurge:n,updateAgeOnGet:l,updateAgeOnHas:f,allowStale:h,dispose:A,onInsert:m,disposeAfter:w,noDisposeOnSet:v,noUpdateTTL:D,maxSize:I=0,maxEntrySize:R=0,sizeCalculation:N,fetchMethod:U,memoMethod:V,noDeleteOnFetchRejection:ee,noDeleteOnStaleGet:te,allowStaleOnFetchRejection:ie,allowStaleOnFetchAbort:ae,ignoreFetchAbort:ge,perf:de}=e;if(de!==void 0&&typeof de?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#u=de??xQt,r!==0&&!Xg(r))throw new TypeError("max option must be a nonnegative integer");let xe=r?aOe(r):Array;if(!xe)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=I,this.maxEntrySize=R||this.#t,this.sizeCalculation=N,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(V!==void 0&&typeof V!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#l=V,U!==void 0&&typeof U!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#i=U,this.#b=!!U,this.#p=new Map,this.#f=new Array(r).fill(void 0),this.#a=new Array(r).fill(void 0),this.#d=new xe(r),this.#w=new xe(r),this.#I=0,this.#g=0 Line truncated
Wanted: ${t}
Found: ${e}`);return r.code="EINTEGRITY",r.expected=t,r.found=e,r}});var xOe=H((NCr,_ee)=>{"use strict";var SOe=Y2(),bOe=hk(),DOe=vOe(),hFt=KM(),{PassThrough:AFt}=ree(),pFt=q2(),POe=t=>({algorithms:["sha512"],...t});_ee.exports=dFt;async function dFt(t,e,r,s={}){let{memoize:a}=s;s=POe(s);let n=await DOe(t,r,s),l=await SOe.insert(t,e,n.integrity,{...s,size:n.size});return a&&bOe.put(t,l,r,s),n.integrity}_ee.exports.stream=gFt;function gFt(t,e,r={}){let{memoize:s}=r;r=POe(r);let a,n,l,f,h=new pFt;if(s){let m=new AFt().on("collect",w=>{f=w});h.push(m)}let A=DOe.stream(t,r).on("integrity",m=>{a=m}).on("size",m=>{n=m}).on("error",m=>{l=m});return h.push(A),h.push(new hFt({async flush(){if(!l){let m=await SOe.insert(t,e,a,{...r,size:n});s&&f&&bOe.put(t,m,f,r),h.emit("integrity",a),h.emit("size",n)}}})),h}});var ROe=H(KE=>{"use strict";Object.defineProperty(KE,"__esModule",{value:!0});KE.range=KE.balanced=void 0;var mFt=(t,e,r)=>{let s=t instanceof RegExp?kOe(t,r):t,a=e instanceof RegExp?kOe(e,r):e,n=s!==null&&a!=null&&(0,KE.range)(s,a,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+s.length,n[1]),post:r.slice(n[1]+a.length)}};KE.balanced=mFt;var kOe=(t,e)=>{let r=e.match(t);return r?r[0]:null},yFt=(t,e,r)=>{let s,a,n,l,f,h=r.indexOf(t),A=r.indexOf(e,h+1),m=h;if(h>=0&&A>0){if(t===e)return[h,A];for(s=[],n=r.length;m>=0&&!f;){if(m===h)s.push(m),h=r.indexOf(t,m+1);else if(s.length===1){let w=s.pop();w!==void 0&&(f=[w,A])}else a=s.pop(),a!==void 0&&a<n&&(n=a,l=A),A=r.indexOf(e,m+1);m=h<A&&h>=0?h:A}s.length&&l!==void 0&&(f=[n,l])}return f};KE.range=yFt});var _Oe=H(Hee=>{"use strict";Object.defineProperty(Hee,"__esModule",{value:!0});Hee.expand=RFt;var TOe=ROe(),QOe="\0SLASH"+Math.random()+"\0",FOe="\0OPEN"+Math.random()+"\0",Uee="\0CLOSE"+Math.random()+"\0",NOe="\0COMMA"+Math.random()+"\0",OOe="\0PERIOD"+Math.random()+"\0",EFt=new RegExp(QOe,"g"),IFt=new RegExp(FOe,"g"),wFt=new RegExp(Uee,"g"),CFt=new RegExp(NOe,"g"),BFt=new RegExp(OOe,"g"),vFt=/\\\\/g,SFt=/\\{/g,bFt=/\\}/g,DFt=/\\,/g,PFt=/\\./g;function Mee(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function xFt(t){return t.replace(vFt,QOe).replace(SFt,FOe).replace(bFt,Uee).replace(DFt,NOe).replace(PFt,OOe)}function kFt(t){return t.replace(EFt,"\\").replace(IFt,"{").replace(wFt,"}").replace(CFt,",").replace(BFt,".")}function LOe(t){if(!t)return[""];let e=[],r=(0,TOe.balanced)("{","}",t);if(!r)return t.split(",");let{pre:s,body:a,post:n}=r,l=s.split(",");l[l.length-1]+="{"+a+"}";let f=LOe(n);return n.length&&(l[l.length-1]+=f.shift(),l.push.apply(l,f)),e.push.apply(e,l),e}function RFt(t){return t?(t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),Ek(xFt(t),!0).map(kFt)):[]}function TFt(t){return"{"+t+"}"}function QFt(t){return/^-?0\d/.test(t)}function FFt(t,e){return t<=e}function NFt(t,e){return t>=e}function Ek(t,e){let r=[],s=(0,TOe.balanced)("{","}",t);if(!s)return[t];let a=s.pre,n=s.post.length?Ek(s.post,!1):[""];if(/\$$/.test(s.pre))for(let l=0;l<n.length;l++){let f=a+"{"+s.body+"}"+n[l];r.push(f)}else{let l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),f=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),h=l||f,A=s.body.indexOf(",")>=0;if(!h&&!A)return s.post.match(/,(?!,).*\}/)?(t=s.pre+"{"+s.body+Uee+s.post,Ek(t)):[t];let m;if(h)m=s.body.split(/\.\./);else if(m=LOe(s.body),m.length===1&&m[0]!==void 0&&(m=Ek(m[0],!1).map(TFt),m.length===1))return n.map(v=>s.pre+m[0]+v);let w;if(h&&m[0]!==void 0&&m[1]!==void 0){let v=Mee(m[0]),D=Mee(m[1]),I=Math.max(m[0].length,m[1].length),R=m.length===3&&m[2]!==void 0?Math.abs(Mee(m[2])):1,N=FFt;D<v&&(R*=-1,N=NFt);let V=m.some(QFt);w=[];for(let ee=v;N(ee,D);ee+=R){let te;if(f)te=String.fromCharCode(ee),te==="\\"&&(te="");else if(te=String(ee),V){let ie=I-te.length;if(ie>0){let ae=new Array(ie+1).join("0");ee<0?te="-"+ae+te.slice(1):te=ae+te}}w.push(te)}}else{w=[];for(let v=0;v<m.length;v++)w.push.apply(w,Ek(m[v],!1))}for(let v=0;v<w.length;v++)for(let D=0;D<n.length;D++){let I=a+w[v]+n[D];(!e||h||I)&&r.push(I)}}return r}});var MOe=H(m4=>{"use strict";Object.defineProperty(m4,"__esModule",{value:!0});m4.assertValidPattern=void 0;var OFt=1024*64,LFt=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>OFt)throw new TypeError("pattern is too long")};m4.assertValidPattern=LFt});var HOe=H(y4=>{"use strict";Object.defineProperty(y4,"__esModule",{value:!0});y4.parseClass=void 0;var _Ft={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Ik=t=>t.replace(/[[\]\\-]/g,"\\$&"),MFt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),UOe=t=>t.join(""),UFt=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Line truncated
globstar while`,e,v,r,D,I),this.matchOne(e.slice(v),r.slice(D),s))return this.debug("globstar found match!",v,h,I),!0;if(I==="."||I===".."||!a.dot&&I.charAt(0)==="."){this.debug("dot detected!",e,v,r,D);break}this.debug("globstar swallow a segment, and continue"),v++}return!!(s&&(this.debug(`
>>> no match, partial?`,e,v,r,D),v===h))}let R;if(typeof m=="string"?(R=w===m,this.debug("string match",m,w,R)):(R=m.test(w),this.debug("pattern match",m,w,R)),!R)return!1}if(l===h&&f===A)return!0;if(l===h)return s;if(f===A)return l===h-1&&e[l]==="";throw new Error("wtf?")}braceExpand(){return(0,_r.braceExpand)(this.pattern,this.options)}parse(e){(0,S4.assertValidPattern)(e);let r=this.options;if(e==="**")return _r.GLOBSTAR;if(e==="")return"";let s,a=null;(s=e.match(uNt))?a=r.dot?hNt:fNt:(s=e.match(eNt))?a=(r.nocase?r.dot?iNt:nNt:r.dot?rNt:tNt)(s[1]):(s=e.match(ANt))?a=(r.nocase?r.dot?dNt:pNt:r.dot?gNt:mNt)(s):(s=e.match(sNt))?a=r.dot?aNt:oNt:(s=e.match(cNt))&&(a=lNt);let n=YOe.AST.fromGlob(e,this.options).toMMPattern();return a&&typeof n=="object"&&Reflect.defineProperty(n,"test",{value:a}),n}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,s=r.noglobstar?ENt:r.dot?INt:wNt,a=new Set(r.nocase?["i"]:[]),n=e.map(h=>{let A=h.map(w=>{if(w instanceof RegExp)for(let v of w.flags.split(""))a.add(v);return typeof w=="string"?DNt(w):w===_r.GLOBSTAR?_r.GLOBSTAR:w._src});A.forEach((w,v)=>{let D=A[v+1],I=A[v-1];w!==_r.GLOBSTAR||I===_r.GLOBSTAR||(I===void 0?D!==void 0&&D!==_r.GLOBSTAR?A[v+1]="(?:\\/|"+s+"\\/)?"+D:A[v]=s:D===void 0?A[v-1]=I+"(?:\\/|\\/"+s+")?":D!==_r.GLOBSTAR&&(A[v-1]=I+"(?:\\/|\\/"+s+"\\/)"+D,A[v+1]=_r.GLOBSTAR))});let m=A.filter(w=>w!==_r.GLOBSTAR);if(this.partial&&m.length>=1){let w=[];for(let v=1;v<=m.length;v++)w.push(m.slice(0,v).join("/"));return"(?:"+w.join("|")+")"}return m.join("/")}).join("|"),[l,f]=e.length>1?["(?:",")"]:["",""];n="^"+l+n+f+"$",this.partial&&(n="^(?:\\/|"+l+n.slice(1,-1)+f+")$"),this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...a].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let s=this.options;this.isWindows&&(e=e.split("\\").join("/"));let a=this.slashSplit(e);this.debug(this.pattern,"split",a);let n=this.set;this.debug(this.pattern,"set",n);let l=a[a.length-1];if(!l)for(let f=a.length-2;!l&&f>=0;f--)l=a[f];for(let f=0;f<n.length;f++){let h=n[f],A=a;if(s.matchBase&&h.length===1&&(A=[l]),this.matchOne(A,h,r))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(e){return _r.minimatch.defaults(e).Minimatch}};_r.Minimatch=zE;var PNt=qee();Object.defineProperty(_r,"AST",{enumerable:!0,get:function(){return PNt.AST}});var xNt=Vee();Object.defineProperty(_r,"escape",{enumerable:!0,get:function(){return xNt.escape}});var kNt=I4();Object.defineProperty(_r,"unescape",{enumerable:!0,get:function(){return kNt.unescape}});_r.minimatch.AST=YOe.AST;_r.minimatch.Minimatch=zE;_r.minimatch.escape=ZFt.escape;_r.minimatch.unescape=XFt.unescape});var uLe=H(yi=>{"use strict";var RNt=yi&&yi.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),TNt=yi&&yi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QNt=yi&&yi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RNt(e,t,r);return TNt(e,t),e};Object.defineProperty(yi,"__esModule",{value:!0});yi.PathScurry=yi.Path=yi.PathScurryDarwin=yi.PathScurryPosix=yi.PathScurryWin32=yi.PathScurryBase=yi.PathPosix=yi.PathWin32=yi.PathBase=yi.ChildrenCache=yi.ResolveCache=void 0;var Q4=z2(),k4=Ae("node:path"),FNt=Ae("node:url"),Ck=Ae("fs"),NNt=QNt(Ae("node:fs")),ONt=Ck.realpathSync.native,b4=Ae("node:fs/promises"),ZOe=Ko(),Bk={lstatSync:Ck.lstatSync,readdir:Ck.readdir,readdirSync:Ck.readdirSync,readlinkSync:Ck.readlinkSync,realpathSync:ONt,promises:{lstat:b4.lstat,readdir:b4.readdir,readlink:b4.readlink,realpath:b4.realpath}},rLe=t=>!t||t===Bk||t===NNt?Bk:{...Bk,...t,promises:{...Bk.promises,...t.promises||{}}},nLe=/^\\\\\?\\([a-z]:)\\?$/i,LNt=t=>t.replace(/\//g,"\\").replace(nLe,"$1\\"),_Nt=/[\\\/]/,Uu=0,iLe=1,sLe=2,kA=4,oLe=6,aLe=8,JE=10,cLe=12,Mu=15,wk=~Mu,Wee=16,XOe=32,vk=64,nh=128,D4=256,x4=512,$Oe=vk|nh|x4,MNt=1023,Yee=t=>t.isFile()?aLe:t.isDirectory()?kA:t.isSymbolicLink()?JE:t.isCharacterDevice()?sLe:t.isBlockDevice()?oLe:t.isSocket()?cLe:t.isFIFO()?iLe:Uu,eLe=new Q4.LRUCache({max:2**12}),Sk=t=>{let e=eLe.get(t);if(e)return e;let r=t.normalize("NFKD");return eLe.set(t,r),r},tLe=new Q4.LRUCache({max:2**12}),P4=t=>{let e=tLe.get(t);if(e)return e;let r=Sk(t.toLowerCase());return tLe.set(t,r),r},bk=class extends Q4.LRUCache{ Line truncated
`).join(`
`+n),t.push(a+"m+"+Z4.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=NLt()+e+" "+t[0]}function NLt(){return xo.inspectOpts.hideDate?"":new Date().toISOString()+" "}function OLt(...t){return process.stderr.write(J4.formatWithOptions(xo.inspectOpts,...t)+`
`)}function LLt(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function _Lt(){return process.env.DEBUG}function MLt(t){t.inspectOpts={};let e=Object.keys(xo.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=xo.inspectOpts[e[r]]}Z4.exports=Ste()(xo);var{formatters:i_e}=Z4.exports;i_e.o=function(t){return this.inspectOpts.colors=this.useColors,J4.inspect(t,this.inspectOpts).split(`
`).map(e=>e.trim()).join(" ")};i_e.O=function(t){return this.inspectOpts.colors=this.useColors,J4.inspect(t,this.inspectOpts)}});var $E=H((g1r,bte)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?bte.exports=n_e():bte.exports=s_e()});var c_e=H(sl=>{"use strict";var ULt=sl&&sl.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),HLt=sl&&sl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o_e=sl&&sl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ULt(e,t,r);return HLt(e,t),e};Object.defineProperty(sl,"__esModule",{value:!0});sl.req=sl.json=sl.toBuffer=void 0;var jLt=o_e(Ae("http")),GLt=o_e(Ae("https"));async function a_e(t){let e=0,r=[];for await(let s of t)e+=s.length,r.push(s);return Buffer.concat(r,e)}sl.toBuffer=a_e;async function qLt(t){let r=(await a_e(t)).toString("utf8");try{return JSON.parse(r)}catch(s){let a=s;throw a.message+=` (input: ${r})`,a}}sl.json=qLt;function VLt(t,e={}){let s=((typeof t=="string"?t:t.href).startsWith("https:")?GLt:jLt).request(t,e),a=new Promise((n,l)=>{s.once("response",n).once("error",l).end()});return s.then=a.then.bind(a),s}sl.req=VLt});var Ok=H(Gl=>{"use strict";var u_e=Gl&&Gl.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),WLt=Gl&&Gl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f_e=Gl&&Gl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&u_e(e,t,r);return WLt(e,t),e},YLt=Gl&&Gl.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&u_e(e,t,r)};Object.defineProperty(Gl,"__esModule",{value:!0});Gl.Agent=void 0;var KLt=f_e(Ae("net")),l_e=f_e(Ae("http")),zLt=Ae("https");YLt(c_e(),Gl);var TA=Symbol("AgentBaseInternalState"),Dte=class extends l_e.Agent{constructor(e){super(e),this[TA]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint=="boolean")return e.secureEndpoint;if(typeof e.protocol=="string")return e.protocol==="https:"}let{stack:r}=new Error;return typeof r!="string"?!1:r.split(`
`).some(s=>s.indexOf("(https.js:")!==-1||s.indexOf("node:https:")!==-1)}incrementSockets(e){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[e]||(this.sockets[e]=[]);let r=new KLt.Socket({writable:!1});return this.sockets[e].push(r),this.totalSocketCount++,r}decrementSockets(e,r){if(!this.sockets[e]||r===null)return;let s=this.sockets[e],a=s.indexOf(r);a!==-1&&(s.splice(a,1),this.totalSocketCount--,s.length===0&&delete this.sockets[e])}getName(e){return this.isSecureEndpoint(e)?zLt.Agent.prototype.getName.call(this,e):super.getName(e)}createSocket(e,r,s){let a={...r,secureEndpoint:this.isSecureEndpoint(r)},n=this.getName(a),l=this.incrementSockets(n);Promise.resolve().then(()=>this.connect(e,a)).then(f=>{if(this.decrementSockets(n,l),f instanceof l_e.Agent)try{return f.addRequest(e,a)}catch(h){return s(h)}this[TA].currentSocket=f,super.createSocket(e,r,s)},f=>{this.decrementSockets(n,l),s(f)})}createConnection(){let e=this[TA].currentSocket;if(this[TA].currentSocket=void 0,!e)throw new Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[TA].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){this[TA]&&(this[TA].defaultPort=e)}get protocol(){return this[TA].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){this[TA]&&(this[TA].protocol=e)}};Gl.Agent=Dte});var p_e=H(Hu=>{"use strict";var JLt=Hu&&Hu.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),ZLt=Hu&&Hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A_e=Hu&&Hu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JLt(e,t,r);return ZLt(e,t),e},XLt=Hu&&Hu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Hu,"__esModule",{value:!0});Hu.HttpProxyAgent=void 0;var $Lt=A_e(Ae("net")),e_t=A_e(Ae("tls")),t_t=XLt($E()),r_t=Ae("events"),n_t=Ok(),h_e=Ae("url"),uB=(0,t_t.default)("http-proxy-agent"),X4=class extends n_t.Agent{constructor(e,r){super(r),this.proxy=typeof e=="string"?new h_e.URL(e):e,this.proxyHeaders=r?.headers??{},uB("Creating new HttpProxyAgent instance: %o",this.proxy.href);let s=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),a=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={...r?i_t(r,"headers"):null,host:s,port:a}}addRequest(e,r){e._header=null,this.setRequestProps(e,r),super.addRequest(e,r)}setRequestProps(e,r){let{proxy:s}=this,a=r.secureEndpoint?"https:":"http:",n=e.getHeader("host")||"localhost",l=`${a}//${n}`,f=new h_e.URL(e.path,l);r.port!==80&&(f.port=String(r.port)),e.path=String(f);let h=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders};if(s.username||s.password){let A=`${decodeURIComponent(s.username)}:${decodeURIComponent(s.password)}`;h["Proxy-Authorization"]=`Basic ${Buffer.from(A).toString("base64")}`}h["Proxy-Connection"]||(h["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let A of Object.keys(h)){let m=h[A];m&&e.setHeader(A,m)}}async connect(e,r){e._header=null,e.path.includes("://")||this.setRequestProps(e,r);let s,a;uB("Regenerating stored HTTP header string for request"),e._implicitHeader(),e.outputData&&e.outputData.length>0&&(uB("Patching connection write() output buffer with updated header"),s=e.outputData[0].data,a=s.indexOf(`\r
\r
`)+4,e.outputData[0].data=e._header+s.substring(a),uB("Output buffer: %o",e.outputData[0].data));let n;return this.proxy.protocol==="https:"?(uB("Creating `tls.Socket`: %o",this.connectOpts),n=e_t.connect(this.connectOpts)):(uB("Creating `net.Socket`: %o",this.connectOpts),n=$Lt.connect(this.connectOpts)),await(0,r_t.once)(n,"connect"),n}};X4.protocols=["http","https"];Hu.HttpProxyAgent=X4;function i_t(t,...e){let r={},s;for(s in t)e.includes(s)||(r[s]=t[s]);return r}});var d_e=H(fB=>{"use strict";var s_t=fB&&fB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(fB,"__esModule",{value:!0});fB.parseProxyResponse=void 0;var o_t=s_t($E()),$4=(0,o_t.default)("https-proxy-agent:parse-proxy-response");function a_t(t){return new Promise((e,r)=>{let s=0,a=[];function n(){let m=t.read();m?A(m):t.once("readable",n)}function l(){t.removeListener("end",f),t.removeListener("error",h),t.removeListener("readable",n)}function f(){l(),$4("onend"),r(new Error("Proxy connection ended before receiving CONNECT response"))}function h(m){l(),$4("onerror %o",m),r(m)}function A(m){a.push(m),s+=m.length;let w=Buffer.concat(a,s),v=w.indexOf(`\r
\r
`);if(v===-1){$4("have not received end of HTTP headers yet..."),n();return}let D=w.slice(0,v).toString("ascii").split(`\r
`),I=D.shift();if(!I)return t.destroy(),r(new Error("No header received from proxy CONNECT response"));let R=I.split(" "),N=+R[1],U=R.slice(2).join(" "),V={};for(let ee of D){if(!ee)continue;let te=ee.indexOf(":");if(te===-1)return t.destroy(),r(new Error(`Invalid header from proxy CONNECT response: "${ee}"`));let ie=ee.slice(0,te).toLowerCase(),ae=ee.slice(te+1).trimStart(),ge=V[ie];typeof ge=="string"?V[ie]=[ge,ae]:Array.isArray(ge)?ge.push(ae):V[ie]=ae}$4("got proxy server response: %o %o",I,V),l(),e({connect:{statusCode:N,statusText:U,headers:V},buffered:w})}t.on("error",h),t.on("end",f),n()})}fB.parseProxyResponse=a_t});var w_e=H(ju=>{"use strict";var c_t=ju&&ju.__createBinding||(Object.create?function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}:function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),l_t=ju&&ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E_e=ju&&ju.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&c_t(e,t,r);return l_t(e,t),e},I_e=ju&&ju.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ju,"__esModule",{value:!0});ju.HttpsProxyAgent=void 0;var eU=E_e(Ae("net")),g_e=E_e(Ae("tls")),u_t=I_e(Ae("assert")),f_t=I_e($E()),h_t=Ok(),A_t=Ae("url"),p_t=d_e(),Lk=(0,f_t.default)("https-proxy-agent"),m_e=t=>t.servername===void 0&&t.host&&!eU.isIP(t.host)?{...t,servername:t.host}:t,tU=class extends h_t.Agent{constructor(e,r){super(r),this.options={path:void 0},this.proxy=typeof e=="string"?new A_t.URL(e):e,this.proxyHeaders=r?.headers??{},Lk("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let s=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),a=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...r?y_e(r,"headers"):null,host:s,port:a}}async connect(e,r){let{proxy:s}=this;if(!r.host)throw new TypeError('No "host" provided');let a;s.protocol==="https:"?(Lk("Creating `tls.Socket`: %o",this.connectOpts),a=g_e.connect(m_e(this.connectOpts))):(Lk("Creating `net.Socket`: %o",this.connectOpts),a=eU.connect(this.connectOpts));let n=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},l=eU.isIPv6(r.host)?`[${r.host}]`:r.host,f=`CONNECT ${l}:${r.port} HTTP/1.1\r
`;if(s.username||s.password){let v=`${decodeURIComponent(s.username)}:${decodeURIComponent(s.password)}`;n["Proxy-Authorization"]=`Basic ${Buffer.from(v).toString("base64")}`}n.Host=`${l}:${r.port}`,n["Proxy-Connection"]||(n["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let v of Object.keys(n))f+=`${v}: ${n[v]}\r
`;let h=(0,p_t.parseProxyResponse)(a);a.write(`${f}\r
`);let{connect:A,buffered:m}=await h;if(e.emit("proxyConnect",A),this.emit("proxyConnect",A,e),A.statusCode===200)return e.once("socket",d_t),r.secureEndpoint?(Lk("Upgrading socket connection to TLS"),g_e.connect({...y_e(m_e(r),"host","path","port"),socket:a})):a;a.destroy();let w=new eU.Socket({writable:!1});return w.readable=!0,e.once("socket",v=>{Lk("Replaying proxy buffer for failed request"),(0,u_t.default)(v.listenerCount("data")>0),v.push(m),v.push(null)}),w}};tU.protocols=["http","https"];ju.HttpsProxyAgent=tU;function d_t(t){t.resume()}function y_e(t,...e){let r={},s;for(s in t)e.includes(s)||(r[s]=t[s]);return r}});var S_e=H(Nd=>{"use strict";Object.defineProperty(Nd,"__esModule",{value:!0});var C_e=Ae("buffer"),eI={INVALID_ENCODING:"Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.",INVALID_SMARTBUFFER_SIZE:"Invalid size provided. Size must be a valid integer greater than zero.",INVALID_SMARTBUFFER_BUFFER:"Invalid Buffer provided in SmartBufferOptions.",INVALID_SMARTBUFFER_OBJECT:"Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.",INVALID_OFFSET:"An invalid offset value was provided.",INVALID_OFFSET_NON_NUMBER:"An invalid offset value was provided. A numeric value is required.",INVALID_LENGTH:"An invalid length value was provided.",INVALID_LENGTH_NON_NUMBER:"An invalid length value was provived. A numeric value is required.",INVALID_TARGET_OFFSET:"Target offset is beyond the bounds of the internal SmartBuffer data.",INVALID_TARGET_LENGTH:"Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.",INVALID_READ_BEYOND_BOUNDS:"Attempted to read beyond the bounds of the managed data.",INVALID_WRITE_BEYOND_BOUNDS:"Attempted to write beyond the bounds of the managed data."};Nd.ERRORS=eI;function g_t(t){if(!C_e.Buffer.isEncoding(t))throw new Error(eI.INVALID_ENCODING)}Nd.checkEncoding=g_t;function B_e(t){return typeof t=="number"&&isFinite(t)&&I_t(t)}Nd.isFiniteInteger=B_e;function v_e(t,e){if(typeof t=="number"){if(!B_e(t)||t<0)throw new Error(e?eI.INVALID_OFFSET:eI.INVALID_LENGTH)}else throw new Error(e?eI.INVALID_OFFSET_NON_NUMBER:eI.INVALID_LENGTH_NON_NUMBER)}function m_t(t){v_e(t,!1)}Nd.checkLengthValue=m_t;function y_t(t){v_e(t,!0)}Nd.checkOffsetValue=y_t;function E_t(t,e){if(t<0||t>e.length)throw new Error(eI.INVALID_TARGET_OFFSET)}Nd.checkTargetOffset=E_t;function I_t(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}function w_t(t){if(typeof BigInt>"u")throw new Error("Platform does not support JS BigInt type.");if(typeof C_e.Buffer.prototype[t]>"u")throw new Error(`Platform does not support Buffer.prototype.${t}.`)}Nd.bigIntAndBufferInt64Check=w_t});var D_e=H(xte=>{"use strict";Object.defineProperty(xte,"__esModule",{value:!0});var bn=S_e(),b_e=4096,C_t="utf8",Pte=class t{constructor(e){if(this.length=0,this._encoding=C_t,this._writeOffset=0,this._readOffset=0,t.isSmartBufferOptions(e))if(e.encoding&&(bn.checkEncoding(e.encoding),this._encoding=e.encoding),e.size)if(bn.isFiniteInteger(e.size)&&e.size>0)this._buff=Buffer.allocUnsafe(e.size);else throw new Error(bn.ERRORS.INVALID_SMARTBUFFER_SIZE);else if(e.buff)if(Buffer.isBuffer(e.buff))this._buff=e.buff,this.length=e.buff.length;else throw new Error(bn.ERRORS.INVALID_SMARTBUFFER_BUFFER);else this._buff=Buffer.allocUnsafe(b_e);else{if(typeof e<"u")throw new Error(bn.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=Buffer.allocUnsafe(b_e)}}static fromSize(e,r){return new this({size:e,encoding:r})}static fromBuffer(e,r){return new this({buff:e,encoding:r})}static fromOptions(e){return new this(e)}static isSmartBufferOptions(e){let r=e;return r&&(r.encoding!==void 0||r.size!==void 0||r.buff!==void 0)}readInt8(e){return this._readNumberValue(Buffer.prototype.readInt8,1,e)}readInt16BE(e){return this._readNumberValue(Buffer.prototype.readInt16BE,2,e)}readInt16LE(e){return this._readNumberValue(Buffer.prototype.readInt16LE,2,e)}readInt32BE(e){return this._readNumberValue(Buffer.prototype.readInt32BE,4,e)}readInt32LE(e){return this._readNumberValue(Buffer.prototype.readInt32LE,4,e)}readBigInt64BE(e){return bn.bigIntAndBufferInt64Check("readBigInt64BE"),this._readNumberValue(Buffer.prototype.readBigInt64BE,8,e)}readBigInt64LE(e){return bn.bigIntAndBufferInt64Check("readBigInt64LE"),this._readNumberValue(Buffer.prototype.readBigInt64LE,8,e)}writeInt8(e,r){return this._writeNumberValue(Buffer.prototype.writeInt8,1,e,r),this}insertInt8(e,r){return this._insertNumberValue(Buffer.prototype.writeInt8,1,e,r)}writeInt16BE(e,r){return this._writeNumberValue(Buffer.prototype.writeInt16BE,2,e,r)}insertInt16BE(e,r){return this._insertNumberValue(Buffer.prototype.writeInt16BE,2,e,r)}writeInt16LE(e,r){return this._writeNumberValue(Buffer.prototype.writeInt16LE,2,e,r)}insertInt16LE(e,r){return this._insertNumberValue(Buffer.prototype.writeInt16LE,2,e,r)}writeInt32BE(e,r){return this._writeNumberValue(Buffer.prototype.writeInt32BE,4,e,r)}insert Line truncated
`,lHt=/\u2014 (\S+) (\S+)\n/g;function uHt(t,e){let r=t.inclusionProof,s=$ne.fromString(r.checkpoint.envelope),a=C8.fromString(s.note);if(!fHt(s,e))throw new lR.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"invalid checkpoint signature"});return a}function fHt(t,e){let r=Buffer.from(t.note,"utf-8");return t.signatures.some(s=>{let a=e.find(n=>CUe.crypto.bufferEqual(n.logID.subarray(0,4),s.keyHint)&&n.baseURL.match(s.name));return a?CUe.crypto.verify(r,a.publicKey,s.signature):!1})}var $ne=class t{note;signatures;constructor(e,r){this.note=e,this.signatures=r}static fromString(e){if(!e.includes(Xne))throw new lR.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"missing checkpoint separator"});let r=e.indexOf(Xne),s=e.slice(0,r+1),n=e.slice(r+Xne.length).matchAll(lHt),l=Array.from(n,f=>{let[,h,A]=f,m=Buffer.from(A,"base64");if(m.length<5)throw new lR.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"malformed checkpoint signature"});return{name:h,keyHint:m.subarray(0,4),signature:m.subarray(4)}});if(l.length===0)throw new lR.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"no signatures found in checkpoint"});return new t(s,l)}},C8=class t{origin;logSize;logHash;rest;constructor(e,r,s,a){this.origin=e,this.logSize=r,this.logHash=s,this.rest=a}static fromString(e){let r=e.trimEnd().split(`
`);if(r.length<3)throw new lR.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"too few lines in checkpoint header"});let s=r[0],a=BigInt(r[1]),n=Buffer.from(r[2],"base64"),l=r.slice(3);return new t(s,a,n,l)}};uR.LogCheckpoint=C8});var vUe=H(nie=>{"use strict";Object.defineProperty(nie,"__esModule",{value:!0});nie.verifyMerkleInclusion=pHt;var rie=tl(),eie=Na(),hHt=Buffer.from([0]),AHt=Buffer.from([1]);function pHt(t,e){let r=t.inclusionProof,s=BigInt(r.logIndex),a=BigInt(e.logSize);if(s<0n||s>=a)throw new eie.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:`invalid index: ${s}`});let{inner:n,border:l}=dHt(s,a);if(r.hashes.length!==n+l)throw new eie.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"invalid hash count"});let f=r.hashes.slice(0,n),h=r.hashes.slice(n),A=wHt(t.canonicalizedBody),m=mHt(gHt(A,f,s),h);if(!rie.crypto.bufferEqual(m,e.logHash))throw new eie.VerificationError({code:"TLOG_INCLUSION_PROOF_ERROR",message:"calculated root hash does not match inclusion proof"})}function dHt(t,e){let r=yHt(t,e),s=EHt(t>>BigInt(r));return{inner:r,border:s}}function gHt(t,e,r){return e.reduce((s,a,n)=>r>>BigInt(n)&BigInt(1)?tie(a,s):tie(s,a),t)}function mHt(t,e){return e.reduce((r,s)=>tie(s,r),t)}function yHt(t,e){return IHt(t^e-BigInt(1))}function EHt(t){return t.toString(2).split("1").length-1}function IHt(t){return t===0n?0:t.toString(2).length}function tie(t,e){return rie.crypto.digest("sha256",AHt,t,e)}function wHt(t){return rie.crypto.digest("sha256",hHt,t)}});var bUe=H(iie=>{"use strict";Object.defineProperty(iie,"__esModule",{value:!0});iie.verifyTLogSET=vHt;var SUe=tl(),CHt=Na(),BHt=MB();function vHt(t,e){if(!(0,BHt.filterTLogAuthorities)(e,{logID:t.logId.keyId,targetDate:new Date(Number(t.integratedTime)*1e3)}).some(a=>{let n=SHt(t),l=Buffer.from(SUe.json.canonicalize(n),"utf8"),f=t.inclusionPromise.signedEntryTimestamp;return SUe.crypto.verify(l,a.publicKey,f)}))throw new CHt.VerificationError({code:"TLOG_INCLUSION_PROMISE_ERROR",message:"inclusion promise could not be verified"})}function SHt(t){let{integratedTime:e,logIndex:r,logId:s,canonicalizedBody:a}=t;return{body:a.toString("base64"),integratedTime:Number(e),logIndex:Number(r),logID:s.keyId.toString("hex")}}});var PUe=H(B8=>{"use strict";Object.defineProperty(B8,"__esModule",{value:!0});B8.verifyTLogBody=kHt;B8.verifyTLogInclusion=RHt;var DUe=Ere(),aie=Na(),sie=EUe(),oie=IUe(),bHt=wUe(),DHt=BUe(),PHt=vUe(),xHt=bUe();function kHt(t,e){let{kind:r,version:s}=t.kindVersion,a=JSON.parse(t.canonicalizedBody.toString("utf8"));if(r!==a.kind||s!==a.apiVersion)throw new aie.VerificationError({code:"TLOG_BODY_ERROR",message:`kind/version mismatch - expected: ${r}/${s}, received: ${a.kind}/${a.apiVersion}`});switch(r){case"dsse":if(s==sie.DSSE_API_VERSION_V1)return(0,sie.verifyDSSETLogBody)(a,e);{let n=DUe.Entry.fromJSON(a);return(0,sie.verifyDSSETLogBodyV2)(n,e)}case"intoto":return(0,bHt.verifyIntotoTLogBody)(a,e);case"hashedrekord":if(s==oie.HASHEDREKORD_API_VERSION_V1)return(0,oie.verifyHashedRekordTLogBody)(a,e);{let n=DUe.Entry.fromJSON(a);return(0,oie.verifyHashedRekordTLogBodyV2)(n,e)}default:throw new aie.VerificationError({code:"TLOG_BODY_ERROR",message:`unsupported kind: ${r}`})}}function RHt(t,e){let r=!1;if(THt(t)&&((0,xHt.verifyTLogSET)(t,e),r=!0),QHt(t)){let s=(0,DHt.verifyCheckpoint)(t,e);(0,PHt.verifyMerkleInclusion)(t,s),r=!0}if(!r)throw new aie.VerificationError({code:"TLOG_MISSING_INCLUSION_ERROR",message:"inclusion could not be verified"})}function THt(t){return t.inclusionPromise!==void 0}function QHt(t){return t.inclusionProof!==void 0}});var QUe=H(v8=>{"use strict";Object.defineProperty(v8,"__esModule",{value:!0});v8.Verifier=void 0;var FHt=Ae("util"),UB=Na(),xUe=pUe(),cie=dUe(),kUe=yUe(),RUe=PUe(),lie=class{trustMaterial;options;constructor(e,r={}){this.trustMaterial=e,this.options={ctlogThreshold:r.ctlogThreshold??1,tlogThreshold:r.tlogThreshold??1,timestampThreshold:r.timestampThreshold??r.tsaThreshold??1,tsaThreshold:0}}verify(e,r){let s=this.verifyTimestamps(e),a=this.verifySigningKey(e,s);return this.verifyTLogs(e),this.verifySignature(e,a),r&&this.verifyPolicy(r,a.identity||{}),a}verifyTimestamps(e){let r=[];for(let s of e.timestamps)switch(s.$case){case"timestamp-authority":r.push((0,kUe.getTSATimestamp)(s.timestamp,e.signature.signature,this.trustMaterial.timestampAuthorities));break;case"transparency-log":{let a=(0,kUe.getTLogTimestamp)(s.tlogEntry);a&&r.push(a);break}}if(TUe(r))throw new UB.VerificationError({code:"TIMESTAMP_ERROR",message:"duplicate timestamp"});if(r.length<this.options.timestampThreshold)throw new UB.VerificationError({code:"TIMESTAMP_ERROR",message:`expected ${this.options.timestampThreshold} timestamps, got ${r.length}`});return r.map(s=>s.timestamp)}verifySigningKey({key:e},r){switch(e.$case){case"public-key":return(0,xUe.verifyPublicKey)(e.hint,r,this.trustMaterial);case"certificate":{let s=(0,xUe.verifyCertificate)(e.certificate,r,this.trustMaterial);if(TUe(s Line truncated
Try running the command again with the package name prefixed: ${pe.pretty(r,"yarn add",pe.Type.CODE)} ${pe.pretty(r,G.makeDescriptor(G.makeIdent(null,"my-package"),`${te[0]}...`),pe.Type.DESCRIPTOR)}`);if(!ee)throw new ht(`The ${pe.pretty(r,V,pe.Type.CODE)} string didn't match the required format (package-name@range). Did you perhaps forget to explicitly reference the package name?`);let ie=omt(a,ee,{dev:this.dev,peer:this.peer,preferDev:this.preferDev,optional:this.optional});return await Promise.all(ie.map(async ge=>{let de=await ED(ee,{project:s,workspace:a,cache:n,fixed:l,target:ge,modifier:A,strategies:m,maxResults:w});return{request:ee,suggestedDescriptors:de,target:ge}}))})).then(V=>V.flat()),I=await tA.start({configuration:r,stdout:this.context.stdout,suggestInstall:!1},async V=>{for(let{request:ee,suggestedDescriptors:{suggestions:te,rejections:ie}}of D)if(te.filter(ge=>ge.descriptor!==null).length===0){let[ge]=ie;if(typeof ge>"u")throw new Error("Assertion failed: Expected an error to have been set");s.configuration.get("enableNetwork")?V.reportError(27,`${G.prettyDescriptor(r,ee)} can't be resolved to a satisfying range`):V.reportError(27,`${G.prettyDescriptor(r,ee)} can't be resolved to a satisfying range (note: network resolution has been disabled)`),V.reportSeparator(),V.reportExceptionOnce(ge)}});if(I.hasErrors())return I.exitCode();let R=!1,N=[],U=[];for(let{suggestedDescriptors:{suggestions:V},target:ee}of D){let te,ie=V.filter(xe=>xe.descriptor!==null),ae=ie[0].descriptor,ge=ie.every(xe=>G.areDescriptorsEqual(xe.descriptor,ae));ie.length===1||ge?te=ae:(R=!0,{answer:te}=await(0,f2e.prompt)({type:"select",name:"answer",message:"Which range do you want to use?",choices:V.map(({descriptor:xe,name:we,reason:d})=>xe?{name:we,hint:d,descriptor:xe}:{name:we,hint:d,disabled:!0}),onCancel:()=>process.exit(130),result(xe){return this.find(xe,"descriptor")},stdin:this.context.stdin,stdout:this.context.stdout}));let de=a.manifest[ee].get(te.identHash);(typeof de>"u"||de.descriptorHash!==te.descriptorHash)&&(a.manifest[ee].set(te.identHash,te),this.optional&&(ee==="dependencies"?a.manifest.ensureDependencyMeta({...te,range:"unknown"}).optional=!0:ee==="peerDependencies"&&(a.manifest.ensurePeerDependencyMeta({...te,range:"unknown"}).optional=!0)),typeof de>"u"?N.push([a,ee,te,m]):U.push([a,ee,de,te]))}return await r.triggerMultipleHooks(V=>V.afterWorkspaceDependencyAddition,N),await r.triggerMultipleHooks(V=>V.afterWorkspaceDependencyReplacement,U),R&&this.context.stdout.write(`
`),await s.installWithNewReport({json:this.json,stdout:this.context.stdout,quiet:this.context.quiet},{cache:n,mode:this.mode})}};function omt(t,e,{dev:r,peer:s,preferDev:a,optional:n}){let l=t.manifest.dependencies.has(e.identHash),f=t.manifest.devDependencies.has(e.identHash),h=t.manifest.peerDependencies.has(e.identHash);if((r||s)&&l)throw new ht(`Package "${G.prettyIdent(t.project.configuration,e)}" is already listed as a regular dependency - remove the -D,-P flags or remove it from your dependencies first`);if(!r&&!s&&h)throw new ht(`Package "${G.prettyIdent(t.project.configuration,e)}" is already listed as a peer dependency - use either of -D or -P, or remove it from your peer dependencies first`);if(n&&f)throw new ht(`Package "${G.prettyIdent(t.project.configuration,e)}" is already listed as a dev dependency - remove the -O flag or remove it from your dev dependencies first`);if(n&&!s&&h)throw new ht(`Package "${G.prettyIdent(t.project.configuration,e)}" is already listed as a peer dependency - remove the -O flag or add the -P flag or remove it from your peer dependencies first`);if((r||a)&&n)throw new ht(`Package "${G.prettyIdent(t.project.configuration,e)}" cannot simultaneously be a dev dependency and an optional dependency`);let A=[];return s&&A.push("peerDependencies"),(r||a)&&A.push("devDependencies"),n&&A.push("dependencies"),A.length>0?A:f?["devDependencies"]:h?["peerDependencies"]:["dependencies"]}We();We();sr();var MC=class extends mt{constructor(){super(...arguments);this.verbose=ye.Boolean("-v,--verbose",!1,{description:"Print both the binary name and the locator of the package that provides the binary"});this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.name=ye.String({required:!1})}static{this.paths=[["bin"]]}static{this.usage=At.Usage({description:"get the path to a binary script",details:`
When used without arguments, this command will print the list of all the binaries available in the current workspace. Adding the \`-v,--verbose\` flag will cause the output to contain both the binary name and the locator of the package that provides the binary.
When an argument is specified, this command will just print the path to the binary on the standard output and exit. Note that the reported path may be stored within a zip archive.
`,examples:[["List all the available binaries","$0 bin"],["Print the path to a specific binary","$0 bin eslint"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,locator:a}=await Yt.find(r,this.context.cwd);if(await s.restoreInstallState(),this.name){let f=(await qn.getPackageAccessibleBinaries(a,{project:s})).get(this.name);if(!f)throw new ht(`Couldn't find a binary named "${this.name}" for package "${G.prettyLocator(r,a)}"`);let[,h]=f;return this.context.stdout.write(`${h}
`),0}return(await Wt.start({configuration:r,json:this.json,stdout:this.context.stdout},async l=>{let f=await qn.getPackageAccessibleBinaries(a,{project:s}),A=Array.from(f.keys()).reduce((m,w)=>Math.max(m,w.length),0);for(let[m,[w,v]]of f)l.reportJson({name:m,source:G.stringifyIdent(w),path:v});if(this.verbose)for(let[m,[w]]of f)l.reportInfo(null,`${m.padEnd(A," ")} ${G.prettyLocator(r,w)}`);else for(let m of f.keys())l.reportInfo(null,m)})).exitCode()}};We();Mt();sr();var UC=class extends mt{constructor(){super(...arguments);this.mirror=ye.Boolean("--mirror",!1,{description:"Remove the global cache files instead of the local cache files"});this.all=ye.Boolean("--all",!1,{description:"Remove both the global cache files and the local cache files of the current project"})}static{this.paths=[["cache","clean"],["cache","clear"]]}static{this.usage=At.Usage({description:"remove the shared cache files",details:`
This command will remove all the files from the cache.
`,examples:[["Remove all the local archives","$0 cache clean"],["Remove all the archives stored in the ~/.yarn directory","$0 cache clean --mirror"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins);if(!r.get("enableCacheClean"))throw new ht("Cache cleaning is currently disabled. To enable it, set `enableCacheClean: true` in your configuration file. Note: Cache cleaning is typically not required and should be avoided when using Zero-Installs.");let s=await gn.find(r);return(await Wt.start({configuration:r,stdout:this.context.stdout},async()=>{let n=(this.all||this.mirror)&&s.mirrorCwd!==null,l=!this.mirror;n&&(await fe.removePromise(s.mirrorCwd),await r.triggerHook(f=>f.cleanGlobalArtifacts,r)),l&&await fe.removePromise(s.cwd)})).exitCode()}};We();sr();xl();var OW=Ae("util"),HC=class extends mt{constructor(){super(...arguments);this.why=ye.Boolean("--why",!1,{description:"Print the explanation for why a setting has its value"});this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.unsafe=ye.Boolean("--no-redacted",!1,{description:"Don't redact secrets (such as tokens) from the output"});this.name=ye.String()}static{this.paths=[["config","get"]]}static{this.usage=At.Usage({description:"read a configuration settings",details:`
This command will print a configuration setting.
Secrets (such as tokens) will be redacted from the output by default. If this behavior isn't desired, set the \`--no-redacted\` to get the untransformed value.
`,examples:[["Print a simple configuration setting","yarn config get yarnPath"],["Print a complex configuration setting","yarn config get packageExtensions"],["Print a nested field from the configuration",`yarn config get 'npmScopes["my-company"].npmRegistryServer'`],["Print a token from the configuration","yarn config get npmAuthToken --no-redacted"],["Print a configuration setting as JSON","yarn config get packageExtensions --json"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),s=this.name.replace(/[.[].*$/,""),a=this.name.replace(/^[^.[]*/,"");if(typeof r.settings.get(s)>"u")throw new ht(`Couldn't find a configuration settings named "${s}"`);let l=r.getSpecial(s,{hideSecrets:!this.unsafe,getNativePaths:!0}),f=Ye.convertMapsToIndexableObjects(l),h=a?rc(f,a):f,A=await Wt.start({configuration:r,includeFooter:!1,json:this.json,stdout:this.context.stdout},async m=>{m.reportJson(h)});if(!this.json){if(typeof h=="string")return this.context.stdout.write(`${h}
`),A.exitCode();OW.inspect.styles.name="cyan",this.context.stdout.write(`${(0,OW.inspect)(h,{depth:1/0,colors:r.get("enableColors"),compact:!1})}
`)}return A.exitCode()}};We();sr();xl();var LW=Ae("util"),jC=class extends mt{constructor(){super(...arguments);this.json=ye.Boolean("--json",!1,{description:"Set complex configuration settings to JSON values"});this.home=ye.Boolean("-H,--home",!1,{description:"Update the home configuration instead of the project configuration"});this.name=ye.String();this.value=ye.String()}static{this.paths=[["config","set"]]}static{this.usage=At.Usage({description:"change a configuration settings",details:`
This command will set a configuration setting.
When used without the \`--json\` flag, it can only set a simple configuration setting (a string, a number, or a boolean).
When used with the \`--json\` flag, it can set both simple and complex configuration settings, including Arrays and Objects.
`,examples:[["Set a simple configuration setting (a string, a number, or a boolean)","yarn config set initScope myScope"],["Set a simple configuration setting (a string, a number, or a boolean) using the `--json` flag",'yarn config set initScope --json \\"myScope\\"'],["Set a complex configuration setting (an Array) using the `--json` flag",`yarn config set unsafeHttpWhitelist --json '["*.example.com", "example.com"]'`],["Set a complex configuration setting (an Object) using the `--json` flag",`yarn config set packageExtensions --json '{ "@babel/parser@*": { "dependencies": { "@babel/types": "*" } } }'`],["Set a nested configuration setting",'yarn config set npmScopes.company.npmRegistryServer "https://npm.example.com"'],["Set a nested configuration setting using indexed access for non-simple keys",`yarn config set 'npmRegistries["//npm.example.com"].npmAuthToken' "ffffffff-ffff-ffff-ffff-ffffffffffff"`]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),s=()=>{if(!r.projectCwd)throw new ht("This command must be run from within a project folder");return r.projectCwd},a=this.name.replace(/[.[].*$/,""),n=this.name.replace(/^[^.[]*\.?/,"");if(typeof r.settings.get(a)>"u")throw new ht(`Couldn't find a configuration settings named "${a}"`);if(a==="enableStrictSettings")throw new ht("This setting only affects the file it's in, and thus cannot be set from the CLI");let f=this.json?JSON.parse(this.value):this.value;await(this.home?I=>$e.updateHomeConfiguration(I):I=>$e.updateConfiguration(s(),I))(I=>{if(n){let R=F0(I);return Ey(R,this.name,f),R}else return{...I,[a]:f}});let m=(await $e.find(this.context.cwd,this.context.plugins)).getSpecial(a,{hideSecrets:!0,getNativePaths:!0}),w=Ye.convertMapsToIndexableObjects(m),v=n?rc(w,n):w;return(await Wt.start({configuration:r,includeFooter:!1,stdout:this.context.stdout},async I=>{LW.inspect.styles.name="cyan",I.reportInfo(0,`Successfully set ${this.name} to ${(0,LW.inspect)(v,{depth:1/0,colors:r.get("enableColors"),compact:!1})}`)})).exitCode()}};We();sr();xl();var GC=class extends mt{constructor(){super(...arguments);this.home=ye.Boolean("-H,--home",!1,{description:"Update the home configuration instead of the project configuration"});this.name=ye.String()}static{this.paths=[["config","unset"]]}static{this.usage=At.Usage({description:"unset a configuration setting",details:`
This command will unset a configuration setting.
`,examples:[["Unset a simple configuration setting","yarn config unset initScope"],["Unset a complex configuration setting","yarn config unset packageExtensions"],["Unset a nested configuration setting","yarn config unset npmScopes.company.npmRegistryServer"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),s=()=>{if(!r.projectCwd)throw new ht("This command must be run from within a project folder");return r.projectCwd},a=this.name.replace(/[.[].*$/,""),n=this.name.replace(/^[^.[]*\.?/,"");if(typeof r.settings.get(a)>"u")throw new ht(`Couldn't find a configuration settings named "${a}"`);let f=this.home?A=>$e.updateHomeConfiguration(A):A=>$e.updateConfiguration(s(),A);return(await Wt.start({configuration:r,includeFooter:!1,stdout:this.context.stdout},async A=>{let m=!1;await f(w=>{if(!_S(w,this.name))return A.reportWarning(0,`Configuration doesn't contain setting ${this.name}; there is nothing to unset`),m=!0,w;let v=n?F0(w):{...w};return N0(v,this.name),v}),m||A.reportInfo(0,`Successfully unset ${this.name}`)})).exitCode()}};We();Mt();sr();var WO=Ae("util"),qC=class extends mt{constructor(){super(...arguments);this.noDefaults=ye.Boolean("--no-defaults",!1,{description:"Omit the default values from the display"});this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.verbose=ye.Boolean("-v,--verbose",{hidden:!0});this.why=ye.Boolean("--why",{hidden:!0});this.names=ye.Rest()}static{this.paths=[["config"]]}static{this.usage=At.Usage({description:"display the current configuration",details:`
This command prints the current active configuration settings.
`,examples:[["Print the active configuration settings","$0 config"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins,{strict:!1}),s=await dC({configuration:r,stdout:this.context.stdout,forceError:this.json},[{option:this.verbose,message:"The --verbose option is deprecated, the settings' descriptions are now always displayed"},{option:this.why,message:"The --why option is deprecated, the settings' sources are now always displayed"}]);if(s!==null)return s;let a=this.names.length>0?[...new Set(this.names)].sort():[...r.settings.keys()].sort(),n,l=await Wt.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async f=>{if(r.invalid.size>0&&!this.json){for(let[h,A]of r.invalid)f.reportError(34,`Invalid configuration key "${h}" in ${A}`);f.reportSeparator()}if(this.json)for(let h of a){if(this.noDefaults&&!r.sources.has(h))continue;let A=r.settings.get(h);typeof A>"u"&&f.reportError(34,`No configuration key named "${h}"`);let m=r.getSpecial(h,{hideSecrets:!0,getNativePaths:!0}),w=r.sources.get(h)??"<default>",v=w&&w[0]!=="<"?me.fromPortablePath(w):w;f.reportJson({key:h,effective:m,source:v,...A})}else{let h={breakLength:1/0,colors:r.get("enableColors"),maxArrayLength:2},A={},m={children:A};for(let w of a){if(this.noDefaults&&!r.sources.has(w))continue;let v=r.settings.get(w),D=r.sources.get(w)??"<default>",I=r.getSpecial(w,{hideSecrets:!0,getNativePaths:!0}),R={Description:{label:"Description",value:pe.tuple(pe.Type.MARKDOWN,{text:v.description,format:this.cli.format(),paragraphs:!1})},Source:{label:"Source",value:pe.tuple(D[0]==="<"?pe.Type.CODE:pe.Type.PATH,D)}};A[w]={value:pe.tuple(pe.Type.CODE,w),children:R};let N=(U,V)=>{for(let[ee,te]of V)if(te instanceof Map){let ie={};U[ee]={children:ie},N(ie,te)}else U[ee]={label:ee,value:pe.tuple(pe.Type.NO_HINT,(0,WO.inspect)(te,h))}};I instanceof Map?N(R,I):R.Value={label:"Value",value:pe.tuple(pe.Type.NO_HINT,(0,WO.inspect)(I,h))}}a.length!==1&&(n=void 0),bs.emitTree(m,{configuration:r,json:this.json,stdout:this.context.stdout,separators:2})}});if(!this.json&&typeof n<"u"){let f=a[0],h=(0,WO.inspect)(r.getSpecial(f,{hideSecrets:!0,getNativePaths:!0}),{colors:r.get("enableColors")});this.context.stdout.write(`
`),this.context.stdout.write(`${h}
`)}return l.exitCode()}};We();sr();ga();var YO={};lr(YO,{Strategy:()=>ID,acceptedStrategies:()=>amt,dedupe:()=>_W});We();We();var h2e=st(ma()),ID=(e=>(e.HIGHEST="highest",e))(ID||{}),amt=new Set(Object.values(ID)),cmt={highest:async(t,e,{resolver:r,fetcher:s,resolveOptions:a,fetchOptions:n})=>{let l=new Map;for(let[h,A]of t.storedResolutions){let m=t.storedDescriptors.get(h);if(typeof m>"u")throw new Error(`Assertion failed: The descriptor (${h}) should have been registered`);Ye.getSetWithDefault(l,m.identHash).add(A)}let f=new Map(Ye.mapAndFilter(t.storedDescriptors.values(),h=>G.isVirtualDescriptor(h)?Ye.mapAndFilter.skip:[h.descriptorHash,Ye.makeDeferred()]));for(let h of t.storedDescriptors.values()){let A=f.get(h.descriptorHash);if(typeof A>"u")throw new Error(`Assertion failed: The descriptor (${h.descriptorHash}) should have been registered`);let m=t.storedResolutions.get(h.descriptorHash);if(typeof m>"u")throw new Error(`Assertion failed: The resolution (${h.descriptorHash}) should have been registered`);let w=t.originalPackages.get(m);if(typeof w>"u")throw new Error(`Assertion failed: The package (${m}) should have been registered`);Promise.resolve().then(async()=>{let v=r.getResolutionDependencies(h,a),D=Object.fromEntries(await Ye.allSettledSafe(Object.entries(v).map(async([ee,te])=>{let ie=f.get(te.descriptorHash);if(typeof ie>"u")throw new Error(`Assertion failed: The descriptor (${te.descriptorHash}) should have been registered`);let ae=await ie.promise;if(!ae)throw new Error("Assertion failed: Expected the dependency to have been through the dedupe process itself");return[ee,ae.updatedPackage]})));if(e.length&&!h2e.default.isMatch(G.stringifyIdent(h),e)||!r.shouldPersistResolution(w,a))return w;let I=l.get(h.identHash);if(typeof I>"u")throw new Error(`Assertion failed: The resolutions (${h.identHash}) should have been registered`);if(I.size===1)return w;let R=[...I].map(ee=>{let te=t.originalPackages.get(ee);if(typeof te>"u")throw new Error(`Assertion failed: The package (${ee}) should have been registered`);return te}),N=await r.getSatisfying(h,D,R,a),U=N.locators?.[0];if(typeof U>"u"||!N.sorted)return w;let V=t.originalPackages.get(U.locatorHash);if(typeof V>"u")throw new Error(`Assertion failed: The package (${U.locatorHash}) should have been registered`);return V}).then(async v=>{let D=await t.preparePackage(v,{resolver:r,resolveOptions:a});A.resolve({descriptor:h,currentPackage:w,updatedPackage:v,resolvedPackage:D})}).catch(v=>{A.reject(v)})}return[...f.values()].map(h=>h.promise)}};async function _W(t,{strategy:e,patterns:r,cache:s,report:a}){let{configuration:n}=t,l=new rs,f=n.makeResolver(),h=n.makeFetcher(),A={cache:s,checksums:t.storedChecksums,fetcher:h,project:t,report:l,cacheOptions:{skipIntegrityCheck:!0}},m={project:t,resolver:f,report:l,fetchOptions:A};return await a.startTimerPromise("Deduplication step",async()=>{let w=cmt[e],v=await w(t,r,{resolver:f,resolveOptions:m,fetcher:h,fetchOptions:A}),D=jo.progressViaCounter(v.length);await a.reportProgress(D);let I=0;await Promise.all(v.map(U=>U.then(V=>{if(V===null||V.currentPackage.locatorHash===V.updatedPackage.locatorHash)return;I++;let{descriptor:ee,currentPackage:te,updatedPackage:ie}=V;a.reportInfo(0,`${G.prettyDescriptor(n,ee)} can be deduped from ${G.prettyLocator(n,te)} to ${G.prettyLocator(n,ie)}`),a.reportJson({descriptor:G.stringifyDescriptor(ee),currentResolution:G.stringifyLocator(te),updatedResolution:G.stringifyLocator(ie)}),t.storedResolutions.set(ee.descriptorHash,ie.locatorHash)}).finally(()=>D.tick())));let R;switch(I){case 0:R="No packages";break;case 1:R="One package";break;default:R=`${I} packages`}let N=pe.pretty(n,e,pe.Type.CODE);return a.reportInfo(0,`${R} can be deduped using the ${N} strategy`),I})}var VC=class extends mt{constructor(){super(...arguments);this.strategy=ye.String("-s,--strategy","highest",{description:"The strategy to use when deduping dependencies",validator:$s(ID)});this.check=ye.Boolean("-c,--check",!1,{description:"Exit with exit code 1 when duplicates are found, without persisting the dependency tree"});this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.mode=ye.String("--mode",{description:"Change what artifacts installs generate",validator:$s(uc)});this.patterns=ye.Rest()}static{this.paths=[["dedupe"]]}static{this.usage=At.Usage({description:"deduplicate dependencies with overlapping ranges",details:"\n Duplicates are defined as descriptors with overlapping ranges being resolved and locked to different locators. They are a natural consequence of Yarn's deterministic installs, but they can sometimes pile up and unnecessarily increase the size of your project.\n\n This command dedupes dependencies in the current project using different strategies (only one is implemented at the moment):\n\n - `highest`: Reuses (where possible) the locators with the highest versions. This means that dependencies can only be upgraded, never dow Line truncated
`)}};var YC=class extends mt{static{this.paths=[["help"],["--help"],["-h"]]}async execute(){this.context.stdout.write(this.cli.usage(null))}};We();Mt();sr();var KC=class extends mt{constructor(){super(...arguments);this.leadingArgument=ye.String();this.args=ye.Proxy()}async execute(){if(this.leadingArgument.match(/[\\/]/)&&!G.tryParseIdent(this.leadingArgument)){let r=Y.resolve(this.context.cwd,me.toPortablePath(this.leadingArgument));return await this.cli.run(this.args,{cwd:r})}else return await this.cli.run(["run",this.leadingArgument,...this.args])}};We();var zC=class extends mt{static{this.paths=[["-v"],["--version"]]}async execute(){this.context.stdout.write(`${Fn||"<unknown>"}
`)}};We();We();sr();var JC=class extends mt{constructor(){super(...arguments);this.commandName=ye.String();this.args=ye.Proxy()}static{this.paths=[["exec"]]}static{this.usage=At.Usage({description:"execute a shell script",details:`
This command simply executes a shell script within the context of the root directory of the active workspace using the portable shell.
It also makes sure to call it in a way that's compatible with the current project (for example, on PnP projects the environment will be setup in such a way that PnP will be correctly injected into the environment).
`,examples:[["Execute a single shell command","$0 exec echo Hello World"],["Execute a shell script",'$0 exec "tsc & babel src --out-dir lib"']]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,locator:a}=await Yt.find(r,this.context.cwd);return await s.restoreInstallState(),await qn.executePackageShellcode(a,this.commandName,this.args,{cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,project:s})}};We();sr();ga();var ZC=class extends mt{constructor(){super(...arguments);this.hash=ye.String({required:!1,validator:P0(_h(),[xp(/^p[0-9a-f]{6}$/)])})}static{this.paths=[["explain","peer-requirements"]]}static{this.usage=At.Usage({description:"explain a set of peer requirements",details:`
A peer requirement represents all peer requests that a subject must satisfy when providing a requested package to requesters.
When the hash argument is specified, this command prints a detailed explanation of the peer requirement corresponding to the hash and whether it is satisfied or not.
When used without arguments, this command lists all peer requirements and the corresponding hash that can be used to get detailed information about a given requirement.
**Note:** A hash is a seven-letter code consisting of the letter 'p' followed by six characters that can be obtained from peer dependency warnings or from the list of all peer requirements(\`yarn explain peer-requirements\`).
`,examples:[["Explain the corresponding peer requirement for a hash","$0 explain peer-requirements p1a4ed"],["List all peer requirements","$0 explain peer-requirements"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s}=await Yt.find(r,this.context.cwd);return await s.restoreInstallState({restoreResolutions:!1}),await s.applyLightResolution(),typeof this.hash<"u"?await umt(this.hash,s,{stdout:this.context.stdout}):await fmt(s,{stdout:this.context.stdout})}};async function umt(t,e,r){let s=e.peerRequirementNodes.get(t);if(typeof s>"u")throw new Error(`No peerDependency requirements found for hash: "${t}"`);let a=new Set,n=h=>a.has(h.requester.locatorHash)?{value:pe.tuple(pe.Type.DEPENDENT,{locator:h.requester,descriptor:h.descriptor}),children:h.children.size>0?[{value:pe.tuple(pe.Type.NO_HINT,"...")}]:[]}:(a.add(h.requester.locatorHash),{value:pe.tuple(pe.Type.DEPENDENT,{locator:h.requester,descriptor:h.descriptor}),children:Object.fromEntries(Array.from(h.children.values(),A=>[G.stringifyLocator(A.requester),n(A)]))}),l=e.peerWarnings.find(h=>h.hash===t);return(await Wt.start({configuration:e.configuration,stdout:r.stdout,includeFooter:!1,includePrefix:!1},async h=>{let A=pe.mark(e.configuration),m=l?A.Cross:A.Check;if(h.reportInfo(0,`Package ${pe.pretty(e.configuration,s.subject,pe.Type.LOCATOR)} is requested to provide ${pe.pretty(e.configuration,s.ident,pe.Type.IDENT)} by its descendants`),h.reportSeparator(),h.reportInfo(0,pe.pretty(e.configuration,s.subject,pe.Type.LOCATOR)),bs.emitTree({children:Object.fromEntries(Array.from(s.requests.values(),w=>[G.stringifyLocator(w.requester),n(w)]))},{configuration:e.configuration,stdout:r.stdout,json:!1}),h.reportSeparator(),s.provided.range==="missing:"){let w=l?"":" , but all peer requests are optional";h.reportInfo(0,`${m} Package ${pe.pretty(e.configuration,s.subject,pe.Type.LOCATOR)} does not provide ${pe.pretty(e.configuration,s.ident,pe.Type.IDENT)}${w}.`)}else{let w=e.storedResolutions.get(s.provided.descriptorHash);if(!w)throw new Error("Assertion failed: Expected the descriptor to be registered");let v=e.storedPackages.get(w);if(!v)throw new Error("Assertion failed: Expected the package to be registered");h.reportInfo(0,`${m} Package ${pe.pretty(e.configuration,s.subject,pe.Type.LOCATOR)} provides ${pe.pretty(e.configuration,s.ident,pe.Type.IDENT)} with version ${G.prettyReference(e.configuration,v.version??"0.0.0")}, ${l?"which does not satisfy all requests.":"which satisfies all requests"}`),l?.type===3&&(l.range?h.reportInfo(0,` The combined requested range is ${pe.pretty(e.configuration,l.range,pe.Type.RANGE)}`):h.reportInfo(0," Unfortunately, the requested ranges have no overlap"))}})).exitCode()}async function fmt(t,e){return(await Wt.start({configuration:t.configuration,stdout:e.stdout,includeFooter:!1,includePrefix:!1},async s=>{let a=pe.mark(t.configuration),n=Ye.sortMap(t.peerRequirementNodes,[([,l])=>G.stringifyLocator(l.subject),([,l])=>G.stringifyIdent(l.ident)]);for(let[,l]of n.values()){if(!l.root)continue;let f=t.peerWarnings.find(m=>m.hash===l.hash),h=[...G.allPeerRequests(l)],A;if(h.length>2?A=` and ${h.length-1} other dependencies`:h.length===2?A=" and 1 other dependency":A="",l.provided.range!=="missing:"){let m=t.storedResolutions.get(l.provided.descriptorHash);if(!m)throw new Error("Assertion failed: Expected the resolution to have been registered");let w=t.storedPackages.get(m);if(!w)throw new Error("Assertion failed: Expected the provided package to have been registered");let v=`${pe.pretty(t.configuration,l.hash,pe.Type.CODE)} \u2192 ${f?a.Cross:a.Check} ${G.prettyLocator(t.configuration,l.subject)} provides ${G.prettyLocator(t.configuration,w)} to ${G.prettyLocator(t.configuration,h[0].requester)}${A}`;f?s.reportWarning(0,v):s.reportInfo(0,v)}else{let m=`${pe.pretty(t.configuration,l.hash,pe.Type.CODE)} \u2192 ${f?a.Cross:a.Check} ${G.prettyLocator(t.configuration,l.subject)} doesn't provide ${G.prettyIdent(t.configuration,l.ident)} to ${G.prettyLocator(t.configuration,h[0].requester)}${A}`;f?s.reportWarning(0,m):s.reportInfo(0,m)}}})).exitCode()}We();sr();ga();We();We();Mt();sr();var p2e=st(Di()),XC=class extends mt{constructor(){super(...arguments);this.useYarnPath=ye.Boolean("--yarn-path",{description:"Set the yarnPath setting even if the version can be accessed by Corepack"});this.onlyIfNeeded=ye.Boolean("--only-if-needed",!1,{description:"Only lock the Yarn version if it isn't already locked"});this.version=ye.String()}static{this.paths=[["set","version"]]}static{this.usage=At.Usage({description:"lock the Yarn version used by the project",details:"\n This command will set a specific release of Yarn to be used by Corepack: https://nodejs.org/api/corepack.html.\n\n By default it only will set the `packageManager` field at the root of your project, but if the referenced release cannot be represented this way, if you already have `yarnPath` configured, or if you set th Line truncated
${e}`)})}let f=t.projectCwd??t.startingCwd,h=Y.resolve(f,".yarn/releases"),A=Y.resolve(h,`yarn-${e}.cjs`),m=Y.relative(t.startingCwd,A),w=Ye.isTaggedYarnVersion(e),v=t.get("yarnPath"),D=!w,I=D||!!v||!!a;if(a===!1){if(D)throw new Zt(0,"You explicitly opted out of yarnPath usage in your command line, but the version you specified cannot be represented by Corepack");I=!1}else!I&&!process.env.COREPACK_ROOT&&(s.reportWarning(0,`You don't seem to have ${pe.applyHyperlink(t,"Corepack","https://nodejs.org/api/corepack.html")} enabled; we'll have to rely on ${pe.applyHyperlink(t,"yarnPath","https://yarnpkg.com/configuration/yarnrc#yarnPath")} instead`),I=!0);if(I){let ee=await l();s.reportInfo(0,`Saving the new release in ${pe.pretty(t,m,"magenta")}`),await fe.removePromise(Y.dirname(A)),await fe.mkdirPromise(Y.dirname(A),{recursive:!0}),await fe.writeFilePromise(A,ee,{mode:493}),await $e.updateConfiguration(f,{yarnPath:Y.relative(f,A)})}else await fe.removePromise(Y.dirname(A)),await $e.updateConfiguration(f,{yarnPath:$e.deleteProperty});let R=await nr.tryFind(f)||new nr;R.packageManager=`yarn@${w?e:await wD(t,"stable")}`;let N={};R.exportTo(N);let U=Y.join(f,nr.fileName),V=`${JSON.stringify(N,null,R.indent)}
`;return await fe.changeFilePromise(U,V,{automaticNewlines:!0}),{bundleVersion:e}}function d2e(t){return Tr[KT(t)]}var Amt=/## (?<code>YN[0-9]{4}) - `(?<name>[A-Z_]+)`\n\n(?<details>(?:.(?!##))+)/gs;async function pmt(t){let r=`https://repo.yarnpkg.com/${Ye.isTaggedYarnVersion(Fn)?Fn:await wD(t,"canary")}/packages/docusaurus/docs/advanced/01-general-reference/error-codes.mdx`,s=await Sn.get(r,{configuration:t});return new Map(Array.from(s.toString().matchAll(Amt),({groups:a})=>{if(!a)throw new Error("Assertion failed: Expected the match to have been successful");let n=d2e(a.code);if(a.name!==n)throw new Error(`Assertion failed: Invalid error code data: Expected "${a.name}" to be named "${n}"`);return[a.code,a.details]}))}var $C=class extends mt{constructor(){super(...arguments);this.code=ye.String({required:!1,validator:gS(_h(),[xp(/^YN[0-9]{4}$/)])});this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["explain"]]}static{this.usage=At.Usage({description:"explain an error code",details:`
When the code argument is specified, this command prints its name and its details.
When used without arguments, this command lists all error codes and their names.
`,examples:[["Explain an error code","$0 explain YN0006"],["List all error codes","$0 explain"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins);if(typeof this.code<"u"){let s=d2e(this.code),a=pe.pretty(r,s,pe.Type.CODE),n=this.cli.format().header(`${this.code} - ${a}`),f=(await pmt(r)).get(this.code),h=typeof f<"u"?pe.jsonOrPretty(this.json,r,pe.tuple(pe.Type.MARKDOWN,{text:f,format:this.cli.format(),paragraphs:!0})):`This error code does not have a description.
You can help us by editing this page on GitHub \u{1F642}:
${pe.jsonOrPretty(this.json,r,pe.tuple(pe.Type.URL,"https://github.com/yarnpkg/berry/blob/master/packages/docusaurus/docs/advanced/01-general-reference/error-codes.mdx"))}
`;this.json?this.context.stdout.write(`${JSON.stringify({code:this.code,name:s,details:h})}
`):this.context.stdout.write(`${n}
${h}
`)}else{let s={children:Ye.mapAndFilter(Object.entries(Tr),([a,n])=>Number.isNaN(Number(a))?Ye.mapAndFilter.skip:{label:Mh(Number(a)),value:pe.tuple(pe.Type.CODE,n)})};bs.emitTree(s,{configuration:r,stdout:this.context.stdout,json:this.json})}}};We();Mt();sr();var g2e=st(ma()),e1=class extends mt{constructor(){super(...arguments);this.all=ye.Boolean("-A,--all",!1,{description:"Print versions of a package from the whole project"});this.recursive=ye.Boolean("-R,--recursive",!1,{description:"Print information for all packages, including transitive dependencies"});this.extra=ye.Array("-X,--extra",[],{description:"An array of requests of extra data provided by plugins"});this.cache=ye.Boolean("--cache",!1,{description:"Print information about the cache entry of a package (path, size, checksum)"});this.dependents=ye.Boolean("--dependents",!1,{description:"Print all dependents for each matching package"});this.manifest=ye.Boolean("--manifest",!1,{description:"Print data obtained by looking at the package archive (license, homepage, ...)"});this.nameOnly=ye.Boolean("--name-only",!1,{description:"Only print the name for the matching packages"});this.virtuals=ye.Boolean("--virtuals",!1,{description:"Print each instance of the virtual packages"});this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.patterns=ye.Rest()}static{this.paths=[["info"]]}static{this.usage=At.Usage({description:"see information related to packages",details:"\n This command prints various information related to the specified packages, accepting glob patterns.\n\n By default, if the locator reference is missing, Yarn will default to print the information about all the matching direct dependencies of the package for the active workspace. To instead print all versions of the package that are direct dependencies of any of your workspaces, use the `-A,--all` flag. Adding the `-R,--recursive` flag will also report transitive dependencies.\n\n Some fields will be hidden by default in order to keep the output readable, but can be selectively displayed by using additional options (`--dependents`, `--manifest`, `--virtuals`, ...) described in the option descriptions.\n\n Note that this command will only print the information directly related to the selected packages - if you wish to know why the package is there in the first place, use `yarn why` which will do just that (it also provides a `-R,--recursive` flag that may be of some help).\n ",examples:[["Show information about Lodash","$0 info lodash"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Yt.find(r,this.context.cwd),n=await gn.find(r);if(!a&&!this.all)throw new Dr(s.cwd,this.context.cwd);await s.restoreInstallState();let l=new Set(this.extra);this.cache&&l.add("cache"),this.dependents&&l.add("dependents"),this.manifest&&l.add("manifest");let f=(te,{recursive:ie})=>{let ae=te.anchoredLocator.locatorHash,ge=new Map,de=[ae];for(;de.length>0;){let xe=de.shift();if(ge.has(xe))continue;let we=s.storedPackages.get(xe);if(typeof we>"u")throw new Error("Assertion failed: Expected the package to be registered");if(ge.set(xe,we),G.isVirtualLocator(we)&&de.push(G.devirtualizeLocator(we).locatorHash),!(!ie&&xe!==ae))for(let d of we.dependencies.values()){let be=s.storedResolutions.get(d.descriptorHash);if(typeof be>"u")throw new Error("Assertion failed: Expected the resolution to be registered");de.push(be)}}return ge.values()},h=({recursive:te})=>{let ie=new Map;for(let ae of s.workspaces)for(let ge of f(ae,{recursive:te}))ie.set(ge.locatorHash,ge);return ie.values()},A=({all:te,recursive:ie})=>te&&ie?s.storedPackages.values():te?h({recursive:ie}):f(a,{recursive:ie}),m=({all:te,recursive:ie})=>{let ae=A({all:te,recursive:ie}),ge=this.patterns.map(we=>{let d=G.parseLocator(we),be=g2e.default.makeRe(G.stringifyIdent(d)),Ce=G.isVirtualLocator(d),Ee=Ce?G.devirtualizeLocator(d):d;return he=>{let $=G.stringifyIdent(he);if(!be.test($))return!1;if(d.reference==="unknown")return!0;let De=G.isVirtualLocator(he),Te=De?G.devirtualizeLocator(he):he;return!(Ce&&De&&d.reference!==he.reference||Ee.reference!==Te.reference)}}),de=Ye.sortMap([...ae],we=>G.stringifyLocator(we));return{selection:de.filter(we=>ge.length===0||ge.some(d=>d(we))),sortedLookup:de}},{selection:w,sortedLookup:v}=m({all:this.all,recursive:this.recursive});if(w.length===0)throw new ht("No package matched your request");let D=new Map;if(this.dependents)for(let te of v)for(let ie of te.dependencies.values()){let ae=s.storedResolutions.get(ie.descriptorHash);if(typeof ae>"u")throw new Error("Assertion failed: Expected the resolution to be registered");Ye.getArrayWithDefault(D,ae).push(te)}let I=new Map;for(let te of v){if(!G.isVirtualLocator(te))continue;let ie=G.devirtualizeLocator(te);Ye.getArrayWithDefault(I,ie.locatorHash).push(te)}let R={},N={children:R},U=r.makeFetcher(),V={project:s,fetcher:U,cache:n,checksums:s.storedChecksum Line truncated
This command simply runs Node. It also makes sure to call it in a way that's compatible with the current project (for example, on PnP projects the environment will be setup in such a way that PnP will be correctly injected into the environment).
The Node process will use the exact same version of Node as the one used to run Yarn itself, which might be a good way to ensure that your commands always use a consistent Node version.
`,examples:[["Run a Node script","$0 node ./my-script.js"]]})}async execute(){return this.cli.run(["exec","node",...this.args])}};We();sr();var i1=class extends mt{constructor(){super(...arguments);this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["plugin","check"]]}static{this.usage=At.Usage({category:"Plugin-related commands",description:"find all third-party plugins that differ from their own spec",details:`
Check only the plugins from https.
If this command detects any plugin differences in the CI environment, it will throw an error.
`,examples:[["find all third-party plugins that differ from their own spec","$0 plugin check"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),s=await $e.findRcFiles(this.context.cwd);return(await Wt.start({configuration:r,json:this.json,stdout:this.context.stdout},async n=>{for(let l of s)if(l.data?.plugins)for(let f of l.data.plugins){if(!f.checksum||!f.spec.match(/^https?:/))continue;let h=await Sn.get(f.spec,{configuration:r}),A=si.makeHash(h);if(f.checksum===A)continue;let m=pe.pretty(r,f.path,pe.Type.PATH),w=pe.pretty(r,f.spec,pe.Type.URL),v=`${m} is different from the file provided by ${w}`;n.reportJson({...f,newChecksum:A}),n.reportError(0,v)}})).exitCode()}};We();We();Mt();sr();var w2e=Ae("os");We();Mt();sr();var m2e=Ae("os");We();au();sr();var Emt="https://raw.githubusercontent.com/yarnpkg/berry/master/plugins.yml";async function tE(t,e){let r=await Sn.get(Emt,{configuration:t}),s=Fs(r.toString());return Object.fromEntries(Object.entries(s).filter(([a,n])=>!e||zr.satisfiesWithPrereleases(e,n.range??"<4.0.0-rc.1")))}var s1=class extends mt{constructor(){super(...arguments);this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["plugin","list"]]}static{this.usage=At.Usage({category:"Plugin-related commands",description:"list the available official plugins",details:"\n This command prints the plugins available directly from the Yarn repository. Only those plugins can be referenced by name in `yarn plugin import`.\n ",examples:[["List the official plugins","$0 plugin list"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins);return(await Wt.start({configuration:r,json:this.json,stdout:this.context.stdout},async a=>{let n=await tE(r,Fn);for(let[l,{experimental:f,...h}]of Object.entries(n)){let A=l;f&&(A+=" [experimental]"),a.reportJson({name:l,experimental:f,...h}),a.reportInfo(null,A)}})).exitCode()}};var Imt=/^[0-9]+$/,wmt=process.platform==="win32";function y2e(t){return Imt.test(t)?`pull/${t}/head`:t}var Cmt=({repository:t,branch:e},r)=>[["git","init",me.fromPortablePath(r)],["git","remote","add","origin",t],["git","fetch","origin","--depth=1",y2e(e)],["git","reset","--hard","FETCH_HEAD"]],Bmt=({branch:t})=>[["git","fetch","origin","--depth=1",y2e(t),"--force"],["git","reset","--hard","FETCH_HEAD"],["git","clean","-dfx","-e","packages/yarnpkg-cli/bundles"]],vmt=({plugins:t,noMinify:e},r,s)=>[["yarn","build:cli",...new Array().concat(...t.map(a=>["--plugin",Y.resolve(s,a)])),...e?["--no-minify"]:[],"|"],[wmt?"move":"mv","packages/yarnpkg-cli/bundles/yarn.js",me.fromPortablePath(r),"|"]],o1=class extends mt{constructor(){super(...arguments);this.installPath=ye.String("--path",{description:"The path where the repository should be cloned to"});this.repository=ye.String("--repository","https://github.com/yarnpkg/berry.git",{description:"The repository that should be cloned"});this.branch=ye.String("--branch","master",{description:"The branch of the repository that should be cloned"});this.plugins=ye.Array("--plugin",[],{description:"An array of additional plugins that should be included in the bundle"});this.dryRun=ye.Boolean("-n,--dry-run",!1,{description:"If set, the bundle will be built but not added to the project"});this.noMinify=ye.Boolean("--no-minify",!1,{description:"Build a bundle for development (debugging) - non-minified and non-mangled"});this.force=ye.Boolean("-f,--force",!1,{description:"Always clone the repository instead of trying to fetch the latest commits"});this.skipPlugins=ye.Boolean("--skip-plugins",!1,{description:"Skip updating the contrib plugins"})}static{this.paths=[["set","version","from","sources"]]}static{this.usage=At.Usage({description:"build Yarn from master",details:`
This command will clone the Yarn repository into a temporary folder, then build it. The resulting bundle will then be copied into the local project.
By default, it also updates all contrib plugins to the same commit the bundle is built from. This behavior can be disabled by using the \`--skip-plugins\` flag.
`,examples:[["Build Yarn from master","$0 set version from sources"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s}=await Yt.find(r,this.context.cwd),a=typeof this.installPath<"u"?Y.resolve(this.context.cwd,me.toPortablePath(this.installPath)):Y.resolve(me.toPortablePath((0,m2e.tmpdir)()),"yarnpkg-sources",si.makeHash(this.repository).slice(0,6));return(await Wt.start({configuration:r,stdout:this.context.stdout},async l=>{await HW(this,{configuration:r,report:l,target:a}),l.reportSeparator(),l.reportInfo(0,"Building a fresh bundle"),l.reportSeparator();let f=await un.execvp("git",["rev-parse","--short","HEAD"],{cwd:a,strict:!0}),h=Y.join(a,`packages/yarnpkg-cli/bundles/yarn-${f.stdout.trim()}.js`);fe.existsSync(h)||(await CD(vmt(this,h,a),{configuration:r,context:this.context,target:a}),l.reportSeparator());let A=await fe.readFilePromise(h);if(!this.dryRun){let{bundleVersion:m}=await MW(r,null,async()=>A,{report:l});this.skipPlugins||await Smt(this,m,{project:s,report:l,target:a})}})).exitCode()}};async function CD(t,{configuration:e,context:r,target:s}){for(let[a,...n]of t){let l=n[n.length-1]==="|";if(l&&n.pop(),l)await un.pipevp(a,n,{cwd:s,stdin:r.stdin,stdout:r.stdout,stderr:r.stderr,strict:!0});else{r.stdout.write(`${pe.pretty(e,` $ ${[a,...n].join(" ")}`,"grey")}
`);try{await un.execvp(a,n,{cwd:s,strict:!0})}catch(f){throw r.stdout.write(f.stdout||f.stack),f}}}}async function HW(t,{configuration:e,report:r,target:s}){let a=!1;if(!t.force&&fe.existsSync(Y.join(s,".git"))){r.reportInfo(0,"Fetching the latest commits"),r.reportSeparator();try{await CD(Bmt(t),{configuration:e,context:t.context,target:s}),a=!0}catch{r.reportSeparator(),r.reportWarning(0,"Repository update failed; we'll try to regenerate it")}}a||(r.reportInfo(0,"Cloning the remote repository"),r.reportSeparator(),await fe.removePromise(s),await fe.mkdirPromise(s,{recursive:!0}),await CD(Cmt(t,s),{configuration:e,context:t.context,target:s}))}async function Smt(t,e,{project:r,report:s,target:a}){let n=await tE(r.configuration,e),l=new Set(Object.keys(n));for(let f of r.configuration.plugins.keys())l.has(f)&&await jW(f,t,{project:r,report:s,target:a})}We();We();Mt();sr();var E2e=st(Di()),I2e=Ae("vm");var a1=class extends mt{constructor(){super(...arguments);this.name=ye.String();this.checksum=ye.Boolean("--checksum",!0,{description:"Whether to care if this plugin is modified"})}static{this.paths=[["plugin","import"]]}static{this.usage=At.Usage({category:"Plugin-related commands",description:"download a plugin",details:`
This command downloads the specified plugin from its remote location and updates the configuration to reference it in further CLI invocations.
Three types of plugin references are accepted:
- If the plugin is stored within the Yarn repository, it can be referenced by name.
- Third-party plugins can be referenced directly through their public urls.
- Local plugins can be referenced by their path on the disk.
If the \`--no-checksum\` option is set, Yarn will no longer care if the plugin is modified.
Plugins cannot be downloaded from the npm registry, and aren't allowed to have dependencies (they need to be bundled into a single file, possibly thanks to the \`@yarnpkg/builder\` package).
`,examples:[['Download and activate the "@yarnpkg/plugin-exec" plugin',"$0 plugin import @yarnpkg/plugin-exec"],['Download and activate the "@yarnpkg/plugin-exec" plugin (shorthand)',"$0 plugin import exec"],["Download and activate a community plugin","$0 plugin import https://example.org/path/to/plugin.js"],["Activate a local plugin","$0 plugin import ./path/to/plugin.js"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins);return(await Wt.start({configuration:r,stdout:this.context.stdout},async a=>{let{project:n}=await Yt.find(r,this.context.cwd),l,f;if(this.name.match(/^\.{0,2}[\\/]/)||me.isAbsolute(this.name)){let h=Y.resolve(this.context.cwd,me.toPortablePath(this.name));a.reportInfo(0,`Reading ${pe.pretty(r,h,pe.Type.PATH)}`),l=Y.relative(n.cwd,h),f=await fe.readFilePromise(h)}else{let h;if(this.name.match(/^https?:/)){try{new URL(this.name)}catch{throw new Zt(52,`Plugin specifier "${this.name}" is neither a plugin name nor a valid url`)}l=this.name,h=this.name}else{let A=G.parseLocator(this.name.replace(/^((@yarnpkg\/)?plugin-)?/,"@yarnpkg/plugin-"));if(A.reference!=="unknown"&&!E2e.default.valid(A.reference))throw new Zt(0,"Official plugins only accept strict version references. Use an explicit URL if you wish to download them from another location.");let m=G.stringifyIdent(A),w=await tE(r,Fn);if(!Object.hasOwn(w,m)){let v=`Couldn't find a plugin named ${G.prettyIdent(r,A)} on the remote registry.
`;throw r.plugins.has(m)?v+=`A plugin named ${G.prettyIdent(r,A)} is already installed; possibly attempting to import a built-in plugin.`:v+=`Note that only the plugins referenced on our website (${pe.pretty(r,"https://github.com/yarnpkg/berry/blob/master/plugins.yml",pe.Type.URL)}) can be referenced by their name; any other plugin will have to be referenced through its public url (for example ${pe.pretty(r,"https://github.com/yarnpkg/berry/raw/master/packages/plugin-typescript/bin/%40yarnpkg/plugin-typescript.js",pe.Type.URL)}).`,new Zt(51,v)}l=m,h=w[m].url,A.reference!=="unknown"?h=h.replace(/\/master\//,`/${m}/${A.reference}/`):Fn!==null&&(h=h.replace(/\/master\//,`/@yarnpkg/cli/${Fn}/`))}a.reportInfo(0,`Downloading ${pe.pretty(r,h,"green")}`),f=await Sn.get(h,{configuration:r})}await GW(l,f,{checksum:this.checksum,project:n,report:a})})).exitCode()}};async function GW(t,e,{checksum:r=!0,project:s,report:a}){let{configuration:n}=s,l={},f={exports:l};(0,I2e.runInNewContext)(e.toString(),{module:f,exports:l});let A=`.yarn/plugins/${f.exports.name}.cjs`,m=Y.resolve(s.cwd,A);a.reportInfo(0,`Saving the new plugin in ${pe.pretty(n,A,"magenta")}`),await fe.mkdirPromise(Y.dirname(m),{recursive:!0}),await fe.writeFilePromise(m,e);let w={path:A,spec:t};r&&(w.checksum=si.makeHash(e)),await $e.addPlugin(s.cwd,[w])}var bmt=({pluginName:t,noMinify:e},r)=>[["yarn",`build:${t}`,...e?["--no-minify"]:[],"|"]],c1=class extends mt{constructor(){super(...arguments);this.installPath=ye.String("--path",{description:"The path where the repository should be cloned to"});this.repository=ye.String("--repository","https://github.com/yarnpkg/berry.git",{description:"The repository that should be cloned"});this.branch=ye.String("--branch","master",{description:"The branch of the repository that should be cloned"});this.noMinify=ye.Boolean("--no-minify",!1,{description:"Build a plugin for development (debugging) - non-minified and non-mangled"});this.force=ye.Boolean("-f,--force",!1,{description:"Always clone the repository instead of trying to fetch the latest commits"});this.name=ye.String()}static{this.paths=[["plugin","import","from","sources"]]}static{this.usage=At.Usage({category:"Plugin-related commands",description:"build a plugin from sources",details:`
This command clones the Yarn repository into a temporary folder, builds the specified contrib plugin and updates the configuration to reference it in further CLI invocations.
The plugins can be referenced by their short name if sourced from the official Yarn repository.
`,examples:[['Build and activate the "@yarnpkg/plugin-exec" plugin',"$0 plugin import from sources @yarnpkg/plugin-exec"],['Build and activate the "@yarnpkg/plugin-exec" plugin (shorthand)',"$0 plugin import from sources exec"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),s=typeof this.installPath<"u"?Y.resolve(this.context.cwd,me.toPortablePath(this.installPath)):Y.resolve(me.toPortablePath((0,w2e.tmpdir)()),"yarnpkg-sources",si.makeHash(this.repository).slice(0,6));return(await Wt.start({configuration:r,stdout:this.context.stdout},async n=>{let{project:l}=await Yt.find(r,this.context.cwd),f=G.parseIdent(this.name.replace(/^((@yarnpkg\/)?plugin-)?/,"@yarnpkg/plugin-")),h=G.stringifyIdent(f),A=await tE(r,Fn);if(!Object.hasOwn(A,h))throw new Zt(51,`Couldn't find a plugin named "${h}" on the remote registry. Note that only the plugins referenced on our website (https://github.com/yarnpkg/berry/blob/master/plugins.yml) can be built and imported from sources.`);let m=h;await HW(this,{configuration:r,report:n,target:s}),await jW(m,this,{project:l,report:n,target:s})})).exitCode()}};async function jW(t,{context:e,noMinify:r},{project:s,report:a,target:n}){let l=t.replace(/@yarnpkg\//,""),{configuration:f}=s;a.reportSeparator(),a.reportInfo(0,`Building a fresh ${l}`),a.reportSeparator(),await CD(bmt({pluginName:l,noMinify:r},n),{configuration:f,context:e,target:n}),a.reportSeparator();let h=Y.resolve(n,`packages/${l}/bundles/${t}.js`),A=await fe.readFilePromise(h);await GW(t,A,{project:s,report:a})}We();Mt();sr();var l1=class extends mt{constructor(){super(...arguments);this.name=ye.String()}static{this.paths=[["plugin","remove"]]}static{this.usage=At.Usage({category:"Plugin-related commands",description:"remove a plugin",details:`
This command deletes the specified plugin from the .yarn/plugins folder and removes it from the configuration.
**Note:** The plugins have to be referenced by their name property, which can be obtained using the \`yarn plugin runtime\` command. Shorthands are not allowed.
`,examples:[["Remove a plugin imported from the Yarn repository","$0 plugin remove @yarnpkg/plugin-typescript"],["Remove a plugin imported from a local file","$0 plugin remove my-local-plugin"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s}=await Yt.find(r,this.context.cwd);return(await Wt.start({configuration:r,stdout:this.context.stdout},async n=>{let l=this.name,f=G.parseIdent(l);if(!r.plugins.has(l))throw new ht(`${G.prettyIdent(r,f)} isn't referenced by the current configuration`);let h=`.yarn/plugins/${l}.cjs`,A=Y.resolve(s.cwd,h);fe.existsSync(A)&&(n.reportInfo(0,`Removing ${pe.pretty(r,h,pe.Type.PATH)}...`),await fe.removePromise(A)),n.reportInfo(0,"Updating the configuration..."),await $e.updateConfiguration(s.cwd,{plugins:m=>{if(!Array.isArray(m))return m;let w=m.filter(v=>v.path!==h);return w.length===0?$e.deleteProperty:w.length===m.length?m:w}})})).exitCode()}};We();sr();var u1=class extends mt{constructor(){super(...arguments);this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["plugin","runtime"]]}static{this.usage=At.Usage({category:"Plugin-related commands",description:"list the active plugins",details:`
This command prints the currently active plugins. Will be displayed both builtin plugins and external plugins.
`,examples:[["List the currently active plugins","$0 plugin runtime"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins);return(await Wt.start({configuration:r,json:this.json,stdout:this.context.stdout},async a=>{for(let n of r.plugins.keys()){let l=this.context.plugins.plugins.has(n),f=n;l&&(f+=" [builtin]"),a.reportJson({name:n,builtin:l}),a.reportInfo(null,`${f}`)}})).exitCode()}};We();We();sr();var f1=class extends mt{constructor(){super(...arguments);this.idents=ye.Rest()}static{this.paths=[["rebuild"]]}static{this.usage=At.Usage({description:"rebuild the project's native packages",details:`
This command will automatically cause Yarn to forget about previous compilations of the given packages and to run them again.
Note that while Yarn forgets the compilation, the previous artifacts aren't erased from the filesystem and may affect the next builds (in good or bad). To avoid this, you may remove the .yarn/unplugged folder, or any other relevant location where packages might have been stored (Yarn may offer a way to do that automatically in the future).
By default all packages will be rebuilt, but you can filter the list by specifying the names of the packages you want to clear from memory.
`,examples:[["Rebuild all packages","$0 rebuild"],["Rebuild fsevents only","$0 rebuild fsevents"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Yt.find(r,this.context.cwd),n=await gn.find(r);if(!a)throw new Dr(s.cwd,this.context.cwd);let l=new Set;for(let f of this.idents)l.add(G.parseIdent(f).identHash);if(await s.restoreInstallState({restoreResolutions:!1}),await s.resolveEverything({cache:n,report:new rs}),l.size>0)for(let f of s.storedPackages.values())l.has(f.identHash)&&(s.storedBuildState.delete(f.locatorHash),s.skippedBuilds.delete(f.locatorHash));else s.storedBuildState.clear(),s.skippedBuilds.clear();return await s.installWithNewReport({stdout:this.context.stdout,quiet:this.context.quiet},{cache:n})}};We();We();We();sr();var qW=st(ma());ga();var h1=class extends mt{constructor(){super(...arguments);this.all=ye.Boolean("-A,--all",!1,{description:"Apply the operation to all workspaces from the current project"});this.mode=ye.String("--mode",{description:"Change what artifacts installs generate",validator:$s(uc)});this.patterns=ye.Rest()}static{this.paths=[["remove"]]}static{this.usage=At.Usage({description:"remove dependencies from the project",details:`
This command will remove the packages matching the specified patterns from the current workspace.
If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
- \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.
- \`update-lockfile\` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.
This command accepts glob patterns as arguments (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.
`,examples:[["Remove a dependency from the current project","$0 remove lodash"],["Remove a dependency from all workspaces at once","$0 remove lodash --all"],["Remove all dependencies starting with `eslint-`","$0 remove 'eslint-*'"],["Remove all dependencies with the `@babel` scope","$0 remove '@babel/*'"],["Remove all dependencies matching `react-dom` or `react-helmet`","$0 remove 'react-{dom,helmet}'"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Yt.find(r,this.context.cwd),n=await gn.find(r);if(!a)throw new Dr(s.cwd,this.context.cwd);await s.restoreInstallState({restoreResolutions:!1});let l=this.all?s.workspaces:[a],f=["dependencies","devDependencies","peerDependencies"],h=[],A=!1,m=[];for(let I of this.patterns){let R=!1,N=G.parseIdent(I);for(let U of l){let V=[...U.manifest.peerDependenciesMeta.keys()];for(let ee of(0,qW.default)(V,I))U.manifest.peerDependenciesMeta.delete(ee),A=!0,R=!0;for(let ee of f){let te=U.manifest.getForScope(ee),ie=[...te.values()].map(ae=>G.stringifyIdent(ae));for(let ae of(0,qW.default)(ie,G.stringifyIdent(N))){let{identHash:ge}=G.parseIdent(ae),de=te.get(ge);if(typeof de>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");U.manifest[ee].delete(ge),m.push([U,ee,de]),A=!0,R=!0}}}R||h.push(I)}let w=h.length>1?"Patterns":"Pattern",v=h.length>1?"don't":"doesn't",D=this.all?"any":"this";if(h.length>0)throw new ht(`${w} ${pe.prettyList(r,h,pe.Type.CODE)} ${v} match any packages referenced by ${D} workspace`);return A?(await r.triggerMultipleHooks(I=>I.afterWorkspaceDependencyRemoval,m),await s.installWithNewReport({stdout:this.context.stdout},{cache:n,mode:this.mode})):0}};We();We();sr();var C2e=Ae("util"),A1=class extends mt{constructor(){super(...arguments);this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["run"]]}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Yt.find(r,this.context.cwd);if(!a)throw new Dr(s.cwd,this.context.cwd);return(await Wt.start({configuration:r,stdout:this.context.stdout,json:this.json},async l=>{let f=a.manifest.scripts,h=Ye.sortMap(f.keys(),w=>w),A={breakLength:1/0,colors:r.get("enableColors"),maxArrayLength:2},m=h.reduce((w,v)=>Math.max(w,v.length),0);for(let[w,v]of f.entries())l.reportInfo(null,`${w.padEnd(m," ")} ${(0,C2e.inspect)(v,A)}`),l.reportJson({name:w,script:v})})).exitCode()}};We();We();sr();var p1=class extends mt{constructor(){super(...arguments);this.inspect=ye.String("--inspect",!1,{tolerateBoolean:!0,description:"Forwarded to the underlying Node process when executing a binary"});this.inspectBrk=ye.String("--inspect-brk",!1,{tolerateBoolean:!0,description:"Forwarded to the underlying Node process when executing a binary"});this.topLevel=ye.Boolean("-T,--top-level",!1,{description:"Check the root workspace for scripts and/or binaries instead of the current one"});this.binariesOnly=ye.Boolean("-B,--binaries-only",!1,{description:"Ignore any user defined scripts and only check for binaries"});this.require=ye.String("--require",{description:"Forwarded to the underlying Node process when executing a binary"});this.silent=ye.Boolean("--silent",{hidden:!0});this.scriptName=ye.String();this.args=ye.Proxy()}static{this.paths=[["run"]]}static{this.usage=At.Usage({description:"run a script defined in the package.json",details:`
This command will run a tool. The exact tool that will be executed will depend on the current state of your workspace:
- If the \`scripts\` field from your local package.json contains a matching script name, its definition will get executed.
- Otherwise, if one of the local workspace's dependencies exposes a binary with a matching name, this binary will get executed.
- Otherwise, if the specified name contains a colon character and if one of the workspaces in the project contains exactly one script with a matching name, then this script will get executed.
Whatever happens, the cwd of the spawned process will be the workspace that declares the script (which makes it possible to call commands cross-workspaces using the third syntax).
`,examples:[["Run the tests from the local workspace","$0 run test"],['Same thing, but without the "run" keyword',"$0 test"],["Inspect Webpack while running","$0 run --inspect-brk webpack"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,workspace:a,locator:n}=await Yt.find(r,this.context.cwd);await s.restoreInstallState();let l=this.topLevel?s.topLevelWorkspace.anchoredLocator:n;if(!this.binariesOnly&&await qn.hasPackageScript(l,this.scriptName,{project:s}))return await qn.executePackageScript(l,this.scriptName,this.args,{project:s,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});let f=await qn.getPackageAccessibleBinaries(l,{project:s});if(f.get(this.scriptName)){let A=[];return this.inspect&&(typeof this.inspect=="string"?A.push(`--inspect=${this.inspect}`):A.push("--inspect")),this.inspectBrk&&(typeof this.inspectBrk=="string"?A.push(`--inspect-brk=${this.inspectBrk}`):A.push("--inspect-brk")),this.require&&A.push(`--require=${this.require}`),await qn.executePackageAccessibleBinary(l,this.scriptName,this.args,{cwd:this.context.cwd,project:s,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,nodeArgs:A,packageAccessibleBinaries:f})}if(!this.topLevel&&!this.binariesOnly&&a&&this.scriptName.includes(":")){let m=(await Promise.all(s.workspaces.map(async w=>w.manifest.scripts.has(this.scriptName)?w:null))).filter(w=>w!==null);if(m.length===1)return await qn.executeWorkspaceScript(m[0],this.scriptName,this.args,{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})}if(this.topLevel)throw this.scriptName==="node-gyp"?new ht(`Couldn't find a script name "${this.scriptName}" in the top-level (used by ${G.prettyLocator(r,n)}). This typically happens because some package depends on "node-gyp" to build itself, but didn't list it in their dependencies. To fix that, please run "yarn add node-gyp" into your top-level workspace. You also can open an issue on the repository of the specified package to suggest them to use an optional peer dependency.`):new ht(`Couldn't find a script name "${this.scriptName}" in the top-level (used by ${G.prettyLocator(r,n)}).`);{if(this.scriptName==="global")throw new ht("The 'yarn global' commands have been removed in 2.x - consider using 'yarn dlx' or a third-party plugin instead");let A=[this.scriptName].concat(this.args);for(let[m,w]of RC)for(let v of w)if(A.length>=v.length&&JSON.stringify(A.slice(0,v.length))===JSON.stringify(v))throw new ht(`Couldn't find a script named "${this.scriptName}", but a matching command can be found in the ${m} plugin. You can install it with "yarn plugin import ${m}".`);throw new ht(`Couldn't find a script named "${this.scriptName}".`)}}};We();We();sr();var d1=class extends mt{constructor(){super(...arguments);this.descriptor=ye.String();this.resolution=ye.String()}static{this.paths=[["set","resolution"]]}static{this.usage=At.Usage({description:"enforce a package resolution",details:'\n This command updates the resolution table so that `descriptor` is resolved by `resolution`.\n\n Note that by default this command only affect the current resolution table - meaning that this "manual override" will disappear if you remove the lockfile, or if the package disappear from the table. If you wish to make the enforced resolution persist whatever happens, edit the `resolutions` field in your top-level manifest.\n\n Note that no attempt is made at validating that `resolution` is a valid resolution entry for `descriptor`.\n ',examples:[["Force all instances of lodash@npm:^1.2.3 to resolve to 1.5.0","$0 set resolution lodash@npm:^1.2.3 npm:1.5.0"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Yt.find(r,this.context.cwd),n=await gn.find(r);if(await s.restoreInstallState({restoreResolutions:!1}),!a)throw new Dr(s.cwd,this.context.cwd);let l=G.parseDescriptor(this.descriptor,!0),f=G.makeDescriptor(l,this.resolution);return s.storedDescriptors.set(l.descriptorHash,l),s.storedDescriptors.set(f.descriptorHash,f),s.resolutionAliases.set(l.descriptorHash,f.descriptorHash),await s.installWithNewReport({stdout:this.context.stdout},{cache:n})}};We();Mt();sr();var B2e=st(ma()),g1=class extends mt{constructor(){super(...arguments);this.all=ye.Boolean("-A,--all",!1,{description:"Unlink all workspaces belonging to the target project from the current one"});this.leadingArguments=ye.Rest()}static{this.paths=[["unlink"]]}static{this.usage=At.Usage({description:"disconnect the local project from another one",details:`
This command will remove any resolutions in the project-level manifest that would have been added via a yarn link with similar arguments.
`,examples:[["Unregister a remote workspace in the current project","$0 unlink ~/ts-loader"],["Unregister all workspaces from a remote project in the current project","$0 unlink ~/jest --all"],["Unregister all previously linked workspaces","$0 unlink --all"],["Unregister all workspaces matching a glob","$0 unlink '@babel/*' 'pkg-{a,b}'"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Yt.find(r,this.context.cwd),n=await gn.find(r);if(!a)throw new Dr(s.cwd,this.context.cwd);let l=s.topLevelWorkspace,f=new Set;if(this.leadingArguments.length===0&&this.all)for(let{pattern:h,reference:A}of l.manifest.resolutions)A.startsWith("portal:")&&f.add(h.descriptor.fullName);if(this.leadingArguments.length>0)for(let h of this.leadingArguments){let A=Y.resolve(this.context.cwd,me.toPortablePath(h));if(Ye.isPathLike(h)){let m=await $e.find(A,this.context.plugins,{useRc:!1,strict:!1}),{project:w,workspace:v}=await Yt.find(m,A);if(!v)throw new Dr(w.cwd,A);if(this.all){for(let D of w.workspaces)D.manifest.name&&f.add(G.stringifyIdent(D.anchoredLocator));if(f.size===0)throw new ht("No workspace found to be unlinked in the target project")}else{if(!v.manifest.name)throw new ht("The target workspace doesn't have a name and thus cannot be unlinked");f.add(G.stringifyIdent(v.anchoredLocator))}}else{let m=[...l.manifest.resolutions.map(({pattern:w})=>w.descriptor.fullName)];for(let w of(0,B2e.default)(m,h))f.add(w)}}return l.manifest.resolutions=l.manifest.resolutions.filter(({pattern:h})=>!f.has(h.descriptor.fullName)),await s.installWithNewReport({stdout:this.context.stdout,quiet:this.context.quiet},{cache:n})}};We();We();We();sr();var v2e=st(gD()),VW=st(ma());ga();var m1=class extends mt{constructor(){super(...arguments);this.interactive=ye.Boolean("-i,--interactive",{description:"Offer various choices, depending on the detected upgrade paths"});this.fixed=ye.Boolean("-F,--fixed",!1,{description:"Store dependency tags as-is instead of resolving them"});this.exact=ye.Boolean("-E,--exact",!1,{description:"Don't use any semver modifier on the resolved range"});this.tilde=ye.Boolean("-T,--tilde",!1,{description:"Use the `~` semver modifier on the resolved range"});this.caret=ye.Boolean("-C,--caret",!1,{description:"Use the `^` semver modifier on the resolved range"});this.recursive=ye.Boolean("-R,--recursive",!1,{description:"Resolve again ALL resolutions for those packages"});this.noTimeGate=ye.Boolean("--no-time-gate",!1,{description:"Disable the minimum release age check for this command"});this.mode=ye.String("--mode",{description:"Change what artifacts installs generate",validator:$s(uc)});this.patterns=ye.Rest()}static{this.paths=[["up"]]}static{this.usage=At.Usage({description:"upgrade dependencies across the project",details:"\n This command upgrades the packages matching the list of specified patterns to their latest available version across the whole project (regardless of whether they're part of `dependencies` or `devDependencies` - `peerDependencies` won't be affected). This is a project-wide command: all workspaces will be upgraded in the process.\n\n If `-R,--recursive` is set the command will change behavior and no other switch will be allowed. When operating under this mode `yarn up` will force all ranges matching the selected packages to be resolved again (often to the highest available versions) before being stored in the lockfile. It however won't touch your manifests anymore, so depending on your needs you might want to run both `yarn up` and `yarn up -R` to cover all bases.\n\n If `-i,--interactive` is set (or if the `preferInteractive` settings is toggled on) the command will offer various choices, depending on the detected upgrade paths. Some upgrades require this flag in order to resolve ambiguities.\n\n The, `-C,--caret`, `-E,--exact` and `-T,--tilde` options have the same meaning as in the `add` command (they change the modifier used when the range is missing or a tag, and are ignored when the range is explicitly set).\n\n If the `--mode=<mode>` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n\n Generally you can see `yarn up` as a counterpart to what was `yarn upgrade --latest` in Yarn 1 (ie it ignores the ranges previously li Line truncated
${ae}`):N.reportError(27,`${G.prettyDescriptor(r,U)} can't be resolved to a satisfying range (note: network resolution has been disabled)
${ae}`)}else te.length>1&&!f&&N.reportError(27,`${G.prettyDescriptor(r,U)} has multiple possible upgrade strategies; use -i to disambiguate manually`)}});if(D.hasErrors())return D.exitCode();let I=!1,R=[];for(let[N,U,,{suggestions:V}]of v){let ee,te=V.filter(de=>de.descriptor!==null),ie=te[0].descriptor,ae=te.every(de=>G.areDescriptorsEqual(de.descriptor,ie));te.length===1||ae?ee=ie:(I=!0,{answer:ee}=await(0,v2e.prompt)({type:"select",name:"answer",message:`Which range do you want to use in ${G.prettyWorkspace(r,N)} \u276F ${U}?`,choices:V.map(({descriptor:de,name:xe,reason:we})=>de?{name:xe,hint:we,descriptor:de}:{name:xe,hint:we,disabled:!0}),onCancel:()=>process.exit(130),result(de){return this.find(de,"descriptor")},stdin:this.context.stdin,stdout:this.context.stdout}));let ge=N.manifest[U].get(ee.identHash);if(typeof ge>"u")throw new Error("Assertion failed: This descriptor should have a matching entry");if(ge.descriptorHash!==ee.descriptorHash)N.manifest[U].set(ee.identHash,ee),R.push([N,U,ge,ee]);else{let de=r.makeResolver(),xe={project:s,resolver:de},we=r.normalizeDependency(ge),d=de.bindDescriptor(we,N.anchoredLocator,xe);s.forgetResolution(d)}}return await r.triggerMultipleHooks(N=>N.afterWorkspaceDependencyReplacement,R),I&&this.context.stdout.write(`
`),await s.installWithNewReport({stdout:this.context.stdout},{cache:n,mode:this.mode})}};We();We();sr();var y1=class extends mt{constructor(){super(...arguments);this.recursive=ye.Boolean("-R,--recursive",!1,{description:"List, for each workspace, what are all the paths that lead to the dependency"});this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.peers=ye.Boolean("--peers",!1,{description:"Also print the peer dependencies that match the specified name"});this.package=ye.String()}static{this.paths=[["why"]]}static{this.usage=At.Usage({description:"display the reason why a package is needed",details:`
This command prints the exact reasons why a package appears in the dependency tree. Specify a version or range to determine why the dependency tree contains a specific version of a package. This is particularly useful when trying to find out why your project depends on lower versions.
If \`-R,--recursive\` is set, the listing will go in depth and will list, for each workspaces, what are all the paths that lead to the dependency. Note that the display is somewhat optimized in that it will not print the package listing twice for a single package, so if you see a leaf named "Foo" when looking for "Bar", it means that "Foo" already got printed higher in the tree.
`,examples:[["Explain why lodash is used in your project","$0 why lodash"],["Explain why version 3.3.1 of lodash is in your project","$0 why lodash@3.3.1"],["Explain why version 3.X of lodash is in your project","$0 why lodash@^3"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Yt.find(r,this.context.cwd);if(!a)throw new Dr(s.cwd,this.context.cwd);await s.restoreInstallState();let n=G.parseDescriptor(this.package,!1);if(n.range!=="unknown"&&zr.validRange(n.range)===null)throw new ht(`Expected a valid semver range, got ${n.range}`);let l=this.recursive?Pmt(s,n,{configuration:r,peers:this.peers}):Dmt(s,n,{configuration:r,peers:this.peers});bs.emitTree(l,{configuration:r,stdout:this.context.stdout,json:this.json,separators:1})}};function Dmt(t,e,{configuration:r,peers:s}){let a=Ye.sortMap(t.storedPackages.values(),f=>G.stringifyLocator(f)),n={},l={children:n};for(let f of a){let h={};for(let m of f.dependencies.values()){if(!s&&WW(f,m))continue;let w=t.storedResolutions.get(m.descriptorHash);if(!w)throw new Error("Assertion failed: The resolution should have been registered");let v=t.storedPackages.get(w);if(!v)throw new Error("Assertion failed: The package should have been registered");if(!G.areIdentsEqual(v,e)||!G.isPackageInRange(v,e.range))continue;{let I=G.stringifyLocator(f);n[I]={value:[f,pe.Type.LOCATOR],children:h}}let D=G.stringifyLocator(v);h[D]={value:[{descriptor:m,locator:v},pe.Type.DEPENDENT]}}}return l}function Pmt(t,e,{configuration:r,peers:s}){let a=Ye.sortMap(t.workspaces,v=>G.stringifyLocator(v.anchoredLocator)),n=new Set,l=new Set,f=v=>{if(n.has(v.locatorHash))return l.has(v.locatorHash);if(n.add(v.locatorHash),G.areIdentsEqual(v,e)&&G.isPackageInRange(v,e.range))return l.add(v.locatorHash),!0;let D=!1;for(let I of v.dependencies.values()){if(!s&&WW(v,I))continue;let R=t.storedResolutions.get(I.descriptorHash);if(!R)throw new Error("Assertion failed: The resolution should have been registered");let N=t.storedPackages.get(R);if(!N)throw new Error("Assertion failed: The package should have been registered");f(N)&&(D=!0)}return D&&l.add(v.locatorHash),D};for(let v of a)f(v.anchoredPackage);let h=new Set,A={},m={children:A},w=(v,D,I)=>{if(!l.has(v.locatorHash))return;let R=I!==null?pe.tuple(pe.Type.DEPENDENT,{locator:v,descriptor:I}):pe.tuple(pe.Type.LOCATOR,v),N={},U={value:R,children:N},V=G.stringifyLocator(v);if(D[V]=U,!(I!==null&&t.tryWorkspaceByLocator(v))&&!h.has(v.locatorHash)){h.add(v.locatorHash);for(let ee of v.dependencies.values()){if(!s&&WW(v,ee))continue;let te=t.storedResolutions.get(ee.descriptorHash);if(!te)throw new Error("Assertion failed: The resolution should have been registered");let ie=t.storedPackages.get(te);if(!ie)throw new Error("Assertion failed: The package should have been registered");w(ie,N,ee)}}};for(let v of a)w(v.anchoredPackage,A,null);return m}function WW(t,e){return G.isVirtualLocator(t)&&t.peerDependencies.has(e.identHash)}We();var rY={};lr(rY,{GitFetcher:()=>vD,GitResolver:()=>SD,default:()=>zmt,gitUtils:()=>fc});We();Mt();var fc={};lr(fc,{TreeishProtocols:()=>BD,clone:()=>tY,fetchBase:()=>V2e,fetchChangedFiles:()=>W2e,fetchChangedWorkspaces:()=>Ymt,fetchRoot:()=>q2e,isGitUrl:()=>w1,lsRemote:()=>G2e,normalizeLocator:()=>Wmt,normalizeRepoUrl:()=>E1,resolveUrl:()=>eY,splitRepoUrl:()=>$p,validateRepoUrl:()=>$W});We();Mt();sr();xl();var H2e=st(_2e()),I1=st(Ae("querystring")),ZW=st(Di());function JW(t,e,r){let s=t.indexOf(r);return t.lastIndexOf(e,s>-1?s:1/0)}function M2e(t){try{return new URL(t)}catch{return}}function qmt(t){let e=JW(t,"@","#"),r=JW(t,":","#");return r>e&&(t=`${t.slice(0,r)}/${t.slice(r+1)}`),JW(t,":","#")===-1&&t.indexOf("//")===-1&&(t=`ssh://${t}`),t}function U2e(t){return M2e(t)||M2e(qmt(t))}function E1(t,{git:e=!1}={}){if(t=t.replace(/^git\+https:/,"https:"),t=t.replace(/^(?:github:|https:\/\/github\.com\/|git:\/\/github\.com\/)?(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)(?:\.git)?(#.*)?$/,"https://github.com/$1/$2.git$3"),t=t.replace(/^https:\/\/github\.com\/(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)\/tarball\/(.+)?$/,"https://github.com/$1/$2.git#$3"),e){let r=U2e(t);r&&(t=r.href),t=t.replace(/^git\+([^:]+):/,"$1:")}return t}function j2e(){return{...process.env,GIT_SSH_COMMAND:process.env.GIT_SSH_COMMAND||`${process.env.GIT_SSH||"ssh"} -o BatchMode=yes`}}var Vmt=[/^ssh:/,/^git(?:\+[^:]+)?:/,/^(?:git\+)?https?:[^#]+\/[^#]+(?:\.git)(?:#.*)?$/,/^git@[^#]+\/[^#]+\.git(?:#.*)?$/,/^(?:github:|https:\/\/github\.com\/)?(?!\.{1,2}\/)([a-zA-Z._0-9-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z._0-9-]+?)(?:\.git)?(?:#.*)?$/,/^https:\/\/github\.com\/(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)\/tarball\/(.+)?$/],BD=(a=>(a.Commit="commit",a.Head="head",a.Tag="tag",a.Semver="semver",a))(BD||{});function w1(t){return t?Vmt.some(e=>!!t.match(e)):!1}function $p(t){t=E1(t);let e=t.indexOf("#");if(e===-1)return{repo:t,treeish:{pr Line truncated
This command will run a given sub-command on a single workspace.
`,examples:[["Add a package to a single workspace","yarn workspace components add -D react"],["Run build script on a single workspace","yarn workspace components run build"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Yt.find(r,this.context.cwd);if(!a)throw new Dr(s.cwd,this.context.cwd);let n=s.workspaces,l=new Map(n.map(h=>[G.stringifyIdent(h.anchoredLocator),h])),f=l.get(this.workspaceName);if(f===void 0){let h=Array.from(l.keys()).sort();throw new ht(`Workspace '${this.workspaceName}' not found. Did you mean any of the following:
- ${h.join(`
- `)}?`)}return this.cli.run([this.commandName,...this.args],{cwd:f.cwd})}};var Jmt={configuration:{enableImmutableInstalls:{description:"If true (the default on CI), prevents the install command from modifying the lockfile",type:"BOOLEAN",default:Y2e.isCI},defaultSemverRangePrefix:{description:"The default save prefix: '^', '~' or ''",type:"STRING",values:["^","~",""],default:"^"},preferReuse:{description:"If true, `yarn add` will attempt to reuse the most common dependency range in other workspaces.",type:"BOOLEAN",default:!1}},commands:[UC,HC,jC,GC,d1,o1,XC,C1,WC,YC,KC,zC,_C,MC,qC,VC,JC,ZC,$C,e1,t1,r1,g1,n1,i1,c1,a1,l1,s1,u1,f1,h1,A1,p1,m1,y1,B1]},Zmt=Jmt;var aY={};lr(aY,{default:()=>tyt});We();We();var iY="catalog:";var sY=t=>t.startsWith(iY),Xmt=t=>t.range.slice(iY.length)||null,K2e=t=>t===null?"default catalog":`catalog "${t}"`,$mt=t=>t.scope?`@${t.scope}/${t.name}`:t.name,oY=(t,e,r,s)=>{let a=Xmt(e),n;if(a===null)n=t.configuration.get("catalog");else try{let m=t.configuration.get("catalogs");m&&(n=m.get(a))}catch{n=void 0}if(!n||n.size===0)throw new Zt(82,`${G.prettyDescriptor(t.configuration,e)}: ${K2e(a)} not found or empty`);let l=$mt(e),f=n.get(l);if(!f)throw new Zt(82,`${G.prettyDescriptor(t.configuration,e)}: entry not found in ${K2e(a)}`);let h=t.configuration.normalizeDependency(G.makeDescriptor(e,f));return r.supportsDescriptor(h,s)?r.bindDescriptor(h,t.topLevelWorkspace.anchoredLocator,s):h};var eyt={configuration:{catalog:{description:"The default catalog of packages",type:"MAP",valueDefinition:{description:"The catalog of packages",type:"STRING"}},catalogs:{description:"Named catalogs of packages",type:"MAP",valueDefinition:{description:"A named catalog",type:"MAP",valueDefinition:{description:"Package version in the catalog",type:"STRING"}}}},hooks:{beforeWorkspacePacking:(t,e)=>{let r=t.project,s=r.configuration.makeResolver(),a={project:r,resolver:s,report:new rs};for(let n of nr.allDependencies){let l=e[n];if(l)for(let[f,h]of Object.entries(l)){if(typeof h!="string"||!sY(h))continue;let A=G.parseIdent(f),m=G.makeDescriptor(A,h),w=oY(r,m,s,a),{protocol:v,source:D,params:I,selector:R}=G.parseRange(G.convertToManifestRange(w.range));v===t.project.configuration.get("defaultProtocol")&&(v=null),l[f]=G.makeRange({protocol:v,source:D,params:I,selector:R})}}},reduceDependency:async(t,e,r,s,{resolver:a,resolveOptions:n})=>sY(t.range)?oY(e,t,a,n):t}},tyt=eyt;var hY={};lr(hY,{default:()=>nyt});We();var Ut={optional:!0},cY=[["@tailwindcss/aspect-ratio@<0.2.1",{peerDependencies:{tailwindcss:"^2.0.2"}}],["@tailwindcss/line-clamp@<0.2.1",{peerDependencies:{tailwindcss:"^2.0.2"}}],["@fullhuman/postcss-purgecss@3.1.3 || 3.1.3-alpha.0",{peerDependencies:{postcss:"^8.0.0"}}],["@samverschueren/stream-to-observable@<0.3.1",{peerDependenciesMeta:{rxjs:Ut,zenObservable:Ut}}],["any-observable@<0.5.1",{peerDependenciesMeta:{rxjs:Ut,zenObservable:Ut}}],["@pm2/agent@<1.0.4",{dependencies:{debug:"*"}}],["debug@<4.2.0",{peerDependenciesMeta:{"supports-color":Ut}}],["got@<11",{dependencies:{"@types/responselike":"^1.0.0","@types/keyv":"^3.1.1"}}],["cacheable-lookup@<4.1.2",{dependencies:{"@types/keyv":"^3.1.1"}}],["http-link-dataloader@*",{peerDependencies:{graphql:"^0.13.1 || ^14.0.0"}}],["typescript-language-server@*",{dependencies:{"vscode-jsonrpc":"^5.0.1","vscode-languageserver-protocol":"^3.15.0"}}],["postcss-syntax@*",{peerDependenciesMeta:{"postcss-html":Ut,"postcss-jsx":Ut,"postcss-less":Ut,"postcss-markdown":Ut,"postcss-scss":Ut}}],["jss-plugin-rule-value-function@<=10.1.1",{dependencies:{"tiny-warning":"^1.0.2"}}],["ink-select-input@<4.1.0",{peerDependencies:{react:"^16.8.2"}}],["license-webpack-plugin@<2.3.18",{peerDependenciesMeta:{webpack:Ut}}],["snowpack@>=3.3.0",{dependencies:{"node-gyp":"^7.1.0"}}],["promise-inflight@*",{peerDependenciesMeta:{bluebird:Ut}}],["reactcss@*",{peerDependencies:{react:"*"}}],["react-color@<=2.19.0",{peerDependencies:{react:"*"}}],["gatsby-plugin-i18n@*",{dependencies:{ramda:"^0.24.1"}}],["useragent@^2.0.0",{dependencies:{request:"^2.88.0",yamlparser:"0.0.x",semver:"5.5.x"}}],["@apollographql/apollo-tools@<=0.5.2",{peerDependencies:{graphql:"^14.2.1 || ^15.0.0"}}],["material-table@^2.0.0",{dependencies:{"@babel/runtime":"^7.11.2"}}],["@babel/parser@*",{dependencies:{"@babel/types":"^7.8.3"}}],["fork-ts-checker-webpack-plugin@<=6.3.4",{peerDependencies:{eslint:">= 6",typescript:">= 2.7",webpack:">= 4","vue-template-compiler":"*"},peerDependenciesMeta:{eslint:Ut,"vue-template-compiler":Ut}}],["rc-animate@<=3.1.1",{peerDependencies:{react:">=16.9.0","react-dom":">=16.9.0"}}],["react-bootstrap-table2-paginator@*",{dependencies:{classnames:"^2.2.6"}}],["react-draggable@<=4.4.3",{peerDependencies:{react:">= 16.3.0","react-dom":">= 16.3.0"}}],["apollo-upload-client@<14",{peerDependencies:{graphql:"14 - 15"}}],["react-instantsearch-core@<=6.7.0",{peerDependencies:{algoliasearch:">= 3.1 < 5"}}],["react-instantsearch-dom@<=6.7.0",{dependencies:{"react-fast-compare":"^3.0.0"}}],Line truncated
This command will output all matches to the given prolog query.
`,examples:[["List all dependencies throughout the workspace","yarn constraints query 'workspace_has_dependency(_, DependencyName, _, _).'"]]})}async execute(){let{Constraints:r}=await Promise.resolve().then(()=>(RD(),kD)),s=await $e.find(this.context.cwd,this.context.plugins),{project:a}=await Yt.find(s,this.context.cwd),n=await r.find(a),l=this.query;return l.endsWith(".")||(l=`${l}.`),(await Wt.start({configuration:s,json:this.json,stdout:this.context.stdout},async h=>{for await(let A of n.query(l)){let m=Array.from(Object.entries(A)),w=m.length,v=m.reduce((D,[I])=>Math.max(D,I.length),0);for(let D=0;D<w;D++){let[I,R]=m[D];h.reportInfo(null,`${Iyt(D,w)}${I.padEnd(v," ")} = ${Eyt(R)}`)}h.reportJson(A)}})).exitCode()}};function Eyt(t){return typeof t!="string"?`${t}`:t.match(/^[a-zA-Z][a-zA-Z0-9_]+$/)?t:`'${t}'`}function Iyt(t,e){let r=t===0,s=t===e-1;return r&&s?"":r?"\u250C ":s?"\u2514 ":"\u2502 "}We();sr();var k1=class extends mt{constructor(){super(...arguments);this.verbose=ye.Boolean("-v,--verbose",!1,{description:"Also print the fact database automatically compiled from the workspace manifests"})}static{this.paths=[["constraints","source"]]}static{this.usage=At.Usage({category:"Constraints-related commands",description:"print the source code for the constraints",details:"\n This command will print the Prolog source code used by the constraints engine. Adding the `-v,--verbose` flag will print the *full* source code, including the fact database automatically compiled from the workspace manifests.\n ",examples:[["Prints the source code","yarn constraints source"],["Print the source code and the fact database","yarn constraints source -v"]]})}async execute(){let{Constraints:r}=await Promise.resolve().then(()=>(RD(),kD)),s=await $e.find(this.context.cwd,this.context.plugins),{project:a}=await Yt.find(s,this.context.cwd),n=await r.find(a);this.context.stdout.write(this.verbose?n.fullSource:n.source)}};We();We();sr();DD();var R1=class extends mt{constructor(){super(...arguments);this.fix=ye.Boolean("--fix",!1,{description:"Attempt to automatically fix unambiguous issues, following a multi-pass process"});this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["constraints"]]}static{this.usage=At.Usage({category:"Constraints-related commands",description:"check that the project constraints are met",details:`
This command will run constraints on your project and emit errors for each one that is found but isn't met. If any error is emitted the process will exit with a non-zero exit code.
If the \`--fix\` flag is used, Yarn will attempt to automatically fix the issues the best it can, following a multi-pass process (with a maximum of 10 iterations). Some ambiguous patterns cannot be autofixed, in which case you'll have to manually specify the right resolution.
For more information as to how to write constraints, please consult our dedicated page on our website: https://yarnpkg.com/features/constraints.
`,examples:[["Check that all constraints are satisfied","yarn constraints"],["Autofix all unmet constraints","yarn constraints --fix"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s}=await Yt.find(r,this.context.cwd);await s.restoreInstallState();let a=await s.loadUserConfig(),n;if(a?.constraints)n=new S1(s);else{let{Constraints:A}=await Promise.resolve().then(()=>(RD(),kD));n=await A.find(s)}let l,f=!1,h=!1;for(let A=this.fix?10:1;A>0;--A){let m=await n.process();if(!m)break;let{changedWorkspaces:w,remainingErrors:v}=zO(s,m,{fix:this.fix}),D=[];for(let[I,R]of w){let N=I.manifest.indent;I.manifest=new nr,I.manifest.indent=N,I.manifest.load(R),D.push(I.persistManifest())}if(await Promise.all(D),!(w.size>0&&A>1)){l=$2e(v,{configuration:r}),f=!1,h=!0;for(let[,I]of v)for(let R of I)R.fixable?f=!0:h=!1}}if(l.children.length===0)return 0;if(f){let A=h?`Those errors can all be fixed by running ${pe.pretty(r,"yarn constraints --fix",pe.Type.CODE)}`:`Errors prefixed by '\u2699' can be fixed by running ${pe.pretty(r,"yarn constraints --fix",pe.Type.CODE)}`;await Wt.start({configuration:r,stdout:this.context.stdout,includeNames:!1,includeFooter:!1},async m=>{m.reportInfo(0,A),m.reportSeparator()})}return l.children=Ye.sortMap(l.children,A=>A.value[1]),bs.emitTree(l,{configuration:r,stdout:this.context.stdout,json:this.json,separators:1}),1}};DD();var wyt={configuration:{enableConstraintsChecks:{description:"If true, constraints will run during installs",type:"BOOLEAN",default:!1},constraintsPath:{description:"The path of the constraints file.",type:"ABSOLUTE_PATH",default:"./constraints.pro"}},commands:[x1,k1,R1],hooks:{async validateProjectAfterInstall(t,{reportError:e}){if(!t.configuration.get("enableConstraintsChecks"))return;let r=await t.loadUserConfig(),s;if(r?.constraints)s=new S1(t);else{let{Constraints:l}=await Promise.resolve().then(()=>(RD(),kD));s=await l.find(t)}let a=await s.process();if(!a)return;let{remainingErrors:n}=zO(t,a);if(n.size!==0)if(t.configuration.isCI)for(let[l,f]of n)for(let h of f)e(84,`${pe.pretty(t.configuration,l.anchoredLocator,pe.Type.IDENT)}: ${h.text}`);else e(84,`Constraint check failed; run ${pe.pretty(t.configuration,"yarn constraints",pe.Type.CODE)} for more details`)}}},Cyt=wyt;var kY={};lr(kY,{CreateCommand:()=>T1,DlxCommand:()=>Q1,default:()=>vyt});We();sr();var T1=class extends mt{constructor(){super(...arguments);this.pkg=ye.String("-p,--package",{description:"The package to run the provided command from"});this.quiet=ye.Boolean("-q,--quiet",!1,{description:"Only report critical errors instead of printing the full install logs"});this.command=ye.String();this.args=ye.Proxy()}static{this.paths=[["create"]]}async execute(){let r=[];this.pkg&&r.push("--package",this.pkg),this.quiet&&r.push("--quiet");let s=this.command.replace(/^(@[^@/]+)(@|$)/,"$1/create$2"),a=G.parseDescriptor(s),n=a.name.match(/^create(-|$)/)?a:a.scope?G.makeIdent(a.scope,`create-${a.name}`):G.makeIdent(null,`create-${a.name}`),l=G.stringifyIdent(n);return a.range!=="unknown"&&(l+=`@${a.range}`),this.cli.run(["dlx",...r,l,...this.args])}};We();We();Mt();sr();var Q1=class extends mt{constructor(){super(...arguments);this.packages=ye.Array("-p,--package",{description:"The package(s) to install before running the command"});this.quiet=ye.Boolean("-q,--quiet",!1,{description:"Only report critical errors instead of printing the full install logs"});this.command=ye.String();this.args=ye.Proxy()}static{this.paths=[["dlx"]]}static{this.usage=At.Usage({description:"run a package in a temporary environment",details:"\n This command will install a package within a temporary environment, and run its binary script if it contains any. The binary will run within the current cwd.\n\n By default Yarn will download the package named `command`, but this can be changed through the use of the `-p,--package` flag which will instruct Yarn to still run the same command but from a different package.\n\n Using `yarn dlx` as a replacement of `yarn add` isn't recommended, as it makes your project non-deterministic (Yarn doesn't keep track of the packages installed through `dlx` - neither their name, nor their version).\n ",examples:[["Use create-vite to scaffold a new Vite project","yarn dlx create-vite"],["Install multiple packages for a single command",`yarn dlx -p typescript -p ts-node ts-node --transpile-only -e "console.log('hello!')"`]]})}async execute(){return $e.telemetry=null,await fe.mktempPromise(async r=>{let s=Y.join(r,`dlx-${process.pid}`);await fe.mkdirPromise(s),await fe.writeFilePromise(Y.join(s,"package.json"),`{}
`),await fe.writeFilePromise(Y.join(s,"yarn.lock"),"");let a=Y.join(s,".yarnrc.yml"),n=await $e.findProjectCwd(this.context.cwd),f={enableGlobalCache:!(await $e.find(this.context.cwd,null,{strict:!1})).get("enableGlobalCache"),enableTelemetry:!1,logFilters:[{code:Mh(68),level:pe.LogLevel.Discard}]},h=n!==null?Y.join(n,".yarnrc.yml"):null;h!==null&&fe.existsSync(h)?(await fe.copyFilePromise(h,a),await $e.updateConfiguration(s,N=>{let U=Ye.toMerged(N,f);return Array.isArray(N.plugins)&&(U.plugins=N.plugins.map(V=>{let ee=typeof V=="string"?V:V.path,te=me.isAbsolute(ee)?ee:me.resolve(me.fromPortablePath(n),ee);return typeof V=="string"?te:{path:te,spec:V.spec}})),U})):await fe.writeJsonPromise(a,f);let A=this.packages??[this.command],m=G.parseDescriptor(this.command).name,w=await this.cli.run(["add","--fixed","--",...A],{cwd:s,quiet:this.quiet});if(w!==0)return w;this.quiet||this.context.stdout.write(`
`);let v=await $e.find(s,this.context.plugins),{project:D,workspace:I}=await Yt.find(v,s);if(I===null)throw new Dr(D.cwd,s);await D.restoreInstallState();let R=await qn.getWorkspaceAccessibleBinaries(I);return R.has(m)===!1&&R.size===1&&typeof this.packages>"u"&&(m=Array.from(R)[0][0]),await qn.executeWorkspaceAccessibleBinary(I,m,this.args,{packageAccessibleBinaries:R,cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})})}};var Byt={commands:[T1,Q1]},vyt=Byt;var QY={};lr(QY,{ExecFetcher:()=>QD,ExecResolver:()=>FD,default:()=>Dyt,execUtils:()=>$O});We();We();We();Mt();var rA="exec:";var $O={};lr($O,{loadGeneratorFile:()=>TD,makeLocator:()=>TY,makeSpec:()=>SBe,parseSpec:()=>RY});We();Mt();function RY(t){let{params:e,selector:r}=G.parseRange(t),s=me.toPortablePath(r);return{parentLocator:e&&typeof e.locator=="string"?G.parseLocator(e.locator):null,path:s}}function SBe({parentLocator:t,path:e,generatorHash:r,protocol:s}){let a=t!==null?{locator:G.stringifyLocator(t)}:{},n=typeof r<"u"?{hash:r}:{};return G.makeRange({protocol:s,source:e,selector:e,params:{...n,...a}})}function TY(t,{parentLocator:e,path:r,generatorHash:s,protocol:a}){return G.makeLocator(t,SBe({parentLocator:e,path:r,generatorHash:s,protocol:a}))}async function TD(t,e,r){let{parentLocator:s,path:a}=G.parseFileStyleRange(t,{protocol:e}),n=Y.isAbsolute(a)?{packageFs:new Jn(Rt.root),prefixPath:Rt.dot,localPath:Rt.root}:await r.fetcher.fetch(s,r),l=n.localPath?{packageFs:new Jn(Rt.root),prefixPath:Y.relative(Rt.root,n.localPath)}:n;n!==l&&n.releaseFs&&n.releaseFs();let f=l.packageFs,h=Y.join(l.prefixPath,a);return await f.readFilePromise(h,"utf8")}var QD=class{supports(e,r){return!!e.reference.startsWith(rA)}getLocalPath(e,r){let{parentLocator:s,path:a}=G.parseFileStyleRange(e.reference,{protocol:rA});if(Y.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(s,r);return n===null?null:Y.resolve(n,a)}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,l]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e),loader:()=>this.fetchFromDisk(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:l}}async fetchFromDisk(e,r){let s=r.project.getDependencyMeta(e,null);if(!r.project.configuration.get("enableScripts")&&!s.built)throw new Zt(4,`${G.prettyLocator(r.project.configuration,e)} can't be built with the exec: protocol because all scripts have been disabled.`);let a=await TD(e.reference,rA,r);return fe.mktempPromise(async n=>{let l=Y.join(n,"generator.js");return await fe.writeFilePromise(l,a),fe.mktempPromise(async f=>{if(await this.generatePackage(f,e,l,r),!fe.existsSync(Y.join(f,"build")))throw new Error("The script should have generated a build directory");return await Hs.makeArchiveFromDirectory(Y.join(f,"build"),{prefixPath:G.getIdentVendorPath(e),compressionLevel:r.project.configuration.get("compressionLevel")})})})}async generatePackage(e,r,s,a){return await fe.mktempPromise(async n=>{let l=await qn.makeScriptEnv({project:a.project,binFolder:n}),f=Y.join(e,"runtime.js");return await fe.mktempPromise(async h=>{let A=Y.join(h,"buildfile.log"),m=Y.join(e,"generator"),w=Y.join(e,"build");await fe.mkdirPromise(m),await fe.mkdirPromise(w);let v={tempDir:me.fromPortablePath(m),buildDir:me.fromPortablePath(w),locator:G.stringifyLocator(r)};await fe.writeFilePromise(f,`
// Expose 'Module' as a global variable
Object.defineProperty(global, 'Module', {
get: () => require('module'),
configurable: true,
enumerable: false,
});
// Expose non-hidden built-in modules as global variables
for (const name of Module.builtinModules.filter((name) => name !== 'module' && !name.startsWith('_'))) {
Object.defineProperty(global, name, {
get: () => require(name),
configurable: true,
enumerable: false,
});
}
// Expose the 'execEnv' global variable
Object.defineProperty(global, 'execEnv', {
value: {
...${JSON.stringify(v)},
},
enumerable: true,
});
`);let D=l.NODE_OPTIONS||"",I=/\s*--require\s+\S*\.pnp\.c?js\s*/g;D=D.replace(I," ").trim(),l.NODE_OPTIONS=D;let{stdout:R,stderr:N}=a.project.configuration.getSubprocessStreams(A,{header:`# This file contains the result of Yarn generating a package (${G.stringifyLocator(r)})
`,prefix:G.prettyLocator(a.project.configuration,r),report:a.report}),{code:U}=await un.pipevp(process.execPath,["--require",me.fromPortablePath(f),me.fromPortablePath(s),G.stringifyIdent(r)],{cwd:e,env:l,stdin:null,stdout:R,stderr:N});if(U!==0)throw fe.detachTemp(h),new Error(`Package generation failed (exit code ${U}, logs can be found here: ${pe.pretty(a.project.configuration,A,pe.Type.PATH)})`)})})}};We();We();We();var Syt=2,FD=class{supportsDescriptor(e,r){return!!e.range.startsWith(rA)}supportsLocator(e,r){return!!e.reference.startsWith(rA)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,s){if(s.project.tryWorkspaceByLocator(r)===null)throw new Zt(57,`${G.prettyLocator(s.project.configuration,r)} lists ${G.prettyDescriptor(s.project.configuration,e)} as dependency, but only workspaces can depend on exec: packages.`);return G.bindDescriptor(e,{locator:G.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,s){if(!s.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{path:a,parentLocator:n}=RY(e.range);if(n===null)throw new Error("Assertion failed: The descriptor should have been bound");let l=await TD(G.makeRange({protocol:rA,source:a,selector:a,params:{locator:G.stringifyLocator(n)}}),rA,s.fetchOptions),f=si.makeHash(`${Syt}`,l).slice(0,6);return[TY(e,{parentLocator:n,path:a,generatorHash:f,protocol:rA})]}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(l=>l.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let s=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await Ye.releaseAfterUseAsync(async()=>await nr.find(s.prefixPath,{baseFs:s.packageFs}),s.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var byt={fetchers:[QD],resolvers:[FD]},Dyt=byt;var NY={};lr(NY,{FileFetcher:()=>_D,FileResolver:()=>MD,TarballFileFetcher:()=>UD,TarballFileResolver:()=>HD,default:()=>kyt,fileUtils:()=>sE});We();Mt();var F1=/^(?:[a-zA-Z]:[\\/]|\.{0,2}\/)/,ND=/^[^?]*\.(?:tar\.gz|tgz)(?:::.*)?$/,Ds="file:";var sE={};lr(sE,{fetchArchiveFromLocator:()=>LD,makeArchiveFromLocator:()=>eL,makeBufferFromLocator:()=>FY,makeLocator:()=>N1,makeSpec:()=>bBe,parseSpec:()=>OD});We();Mt();function OD(t){let{params:e,selector:r}=G.parseRange(t),s=me.toPortablePath(r);return{parentLocator:e&&typeof e.locator=="string"?G.parseLocator(e.locator):null,path:s}}function bBe({parentLocator:t,path:e,hash:r,protocol:s}){let a=t!==null?{locator:G.stringifyLocator(t)}:{},n=typeof r<"u"?{hash:r}:{};return G.makeRange({protocol:s,source:e,selector:e,params:{...n,...a}})}function N1(t,{parentLocator:e,path:r,hash:s,protocol:a}){return G.makeLocator(t,bBe({parentLocator:e,path:r,hash:s,protocol:a}))}async function LD(t,e){let{parentLocator:r,path:s}=G.parseFileStyleRange(t.reference,{protocol:Ds}),a=Y.isAbsolute(s)?{packageFs:new Jn(Rt.root),prefixPath:Rt.dot,localPath:Rt.root}:await e.fetcher.fetch(r,e),n=a.localPath?{packageFs:new Jn(Rt.root),prefixPath:Y.relative(Rt.root,a.localPath)}:a;a!==n&&a.releaseFs&&a.releaseFs();let l=n.packageFs,f=Y.join(n.prefixPath,s);return await Ye.releaseAfterUseAsync(async()=>await l.readFilePromise(f),n.releaseFs)}async function eL(t,{protocol:e,fetchOptions:r,inMemory:s=!1}){let{parentLocator:a,path:n}=G.parseFileStyleRange(t.reference,{protocol:e}),l=Y.isAbsolute(n)?{packageFs:new Jn(Rt.root),prefixPath:Rt.dot,localPath:Rt.root}:await r.fetcher.fetch(a,r),f=l.localPath?{packageFs:new Jn(Rt.root),prefixPath:Y.relative(Rt.root,l.localPath)}:l;l!==f&&l.releaseFs&&l.releaseFs();let h=f.packageFs,A=Y.join(f.prefixPath,n);return await Ye.releaseAfterUseAsync(async()=>await Hs.makeArchiveFromDirectory(A,{baseFs:h,prefixPath:G.getIdentVendorPath(t),compressionLevel:r.project.configuration.get("compressionLevel"),inMemory:s}),f.releaseFs)}async function FY(t,{protocol:e,fetchOptions:r}){return(await eL(t,{protocol:e,fetchOptions:r,inMemory:!0})).getBufferAndClose()}var _D=class{supports(e,r){return!!e.reference.startsWith(Ds)}getLocalPath(e,r){let{parentLocator:s,path:a}=G.parseFileStyleRange(e.reference,{protocol:Ds});if(Y.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(s,r);return n===null?null:Y.resolve(n,a)}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,l]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.fetchFro Line truncated
`,{automaticNewlines:!0});let A=[h],m=Y.join(this.context.cwd,"README.md");if(fe.existsSync(m)||(await fe.writeFilePromise(m,`# ${G.stringifyIdent(n.name)}
`),A.push(m)),!s||s.cwd===this.context.cwd){let w=Y.join(this.context.cwd,Or.lockfile);fe.existsSync(w)||(await fe.writeFilePromise(w,""),A.push(w));let D=[".yarn/*","!.yarn/patches","!.yarn/plugins","!.yarn/releases","!.yarn/sdks","!.yarn/versions","","# Whether you use PnP or not, the node_modules folder is often used to store","# build artifacts that should be gitignored","node_modules","","# Swap the comments on the following lines if you wish to use zero-installs","# In that case, don't forget to run `yarn config set enableGlobalCache false`!","# Documentation here: https://yarnpkg.com/features/caching#zero-installs","","#!.yarn/cache",".pnp.*"].map(ie=>`${ie}
`).join(""),I=Y.join(this.context.cwd,".gitignore");fe.existsSync(I)||(await fe.writeFilePromise(I,D),A.push(I));let N=["/.yarn/** linguist-vendored","/.yarn/releases/* binary","/.yarn/plugins/**/* binary","/.pnp.* binary linguist-generated"].map(ie=>`${ie}
`).join(""),U=Y.join(this.context.cwd,".gitattributes");fe.existsSync(U)||(await fe.writeFilePromise(U,N),A.push(U));let V={"*":{charset:"utf-8",endOfLine:"lf",indentSize:2,indentStyle:"space",insertFinalNewline:!0}};Ye.mergeIntoTarget(V,r.get("initEditorConfig"));let ee=`root = true
`;for(let[ie,ae]of Object.entries(V)){ee+=`
[${ie}]
`;for(let[ge,de]of Object.entries(ae)){let xe=ge.replace(/[A-Z]/g,we=>`_${we.toLowerCase()}`);ee+=`${xe} = ${de}
`}}let te=Y.join(this.context.cwd,".editorconfig");fe.existsSync(te)||(await fe.writeFilePromise(te,ee),A.push(te)),await this.cli.run(["install"],{quiet:!0}),await this.initialize(),fe.existsSync(Y.join(this.context.cwd,".git"))||(await un.execvp("git",["init"],{cwd:this.context.cwd}),await un.execvp("git",["add","--",...A],{cwd:this.context.cwd}),await un.execvp("git",["commit","--allow-empty","-m","First commit"],{cwd:this.context.cwd}))}}};var O1=class extends yg{constructor(){super(...arguments);this.initializer=ye.String();this.argv=ye.Proxy()}static{this.paths=[["init"]]}async initialize(){this.context.stdout.write(`
`),await this.cli.run(["dlx",this.initializer,...this.argv],{quiet:!0})}};var Nyt={configuration:{initScope:{description:"Scope used when creating packages via the init command",type:"STRING",default:null},initFields:{description:"Additional fields to set when creating packages via the init command",type:"MAP",valueDefinition:{description:"",type:"ANY"}},initEditorConfig:{description:"Extra rules to define in the generator editorconfig",type:"MAP",valueDefinition:{description:"",type:"ANY"}}},commands:[yg,O1]},Oyt=Nyt;var Lz={};lr(Lz,{SearchCommand:()=>e2,UpgradeInteractiveCommand:()=>t2,default:()=>W2t});We();var RBe=st(Ae("os"));function L1({stdout:t}){if(RBe.default.endianness()==="BE")throw new Error("Interactive commands cannot be used on big-endian systems because ink depends on yoga-layout-prebuilt which only supports little-endian architectures");if(!t.isTTY)throw new Error("Interactive commands can only be used inside a TTY environment")}sr();var Gve=st(iK()),sK={appId:"OFCNCOG2CU",apiKey:"6fe4476ee5a1832882e326b506d14126",indexName:"npm-search"},QIt=(0,Gve.default)(sK.appId,sK.apiKey).initIndex(sK.indexName),oK=async(t,e=0)=>await QIt.search(t,{analyticsTags:["yarn-plugin-interactive-tools"],attributesToRetrieve:["name","version","owner","repository","humanDownloadsLast30Days"],page:e,hitsPerPage:10});var GP=["regular","dev","peer"],e2=class extends mt{static{this.paths=[["search"]]}static{this.usage=At.Usage({category:"Interactive commands",description:"open the search interface",details:`
This command opens a fullscreen terminal interface where you can search for and install packages from the npm registry.
`,examples:[["Open the search window","yarn search"]]})}async execute(){L1(this.context);let{Gem:e}=await Promise.resolve().then(()=>(OL(),bz)),{ScrollableItems:r}=await Promise.resolve().then(()=>(UL(),ML)),{useKeypress:s}=await Promise.resolve().then(()=>($1(),Dz)),{useMinistore:a}=await Promise.resolve().then(()=>(Tz(),Rz)),{renderForm:n}=await Promise.resolve().then(()=>(VL(),qL)),{default:l}=await Promise.resolve().then(()=>st(PPe())),{Box:f,Text:h}=await Promise.resolve().then(()=>st(Du())),{default:A,useEffect:m,useState:w}=await Promise.resolve().then(()=>st(Ln())),v=await $e.find(this.context.cwd,this.context.plugins),D=()=>A.createElement(f,{flexDirection:"row"},A.createElement(f,{flexDirection:"column",width:48},A.createElement(f,null,A.createElement(h,null,"Press ",A.createElement(h,{bold:!0,color:"cyanBright"},"<up>"),"/",A.createElement(h,{bold:!0,color:"cyanBright"},"<down>")," to move between packages.")),A.createElement(f,null,A.createElement(h,null,"Press ",A.createElement(h,{bold:!0,color:"cyanBright"},"<space>")," to select a package.")),A.createElement(f,null,A.createElement(h,null,"Press ",A.createElement(h,{bold:!0,color:"cyanBright"},"<space>")," again to change the target."))),A.createElement(f,{flexDirection:"column"},A.createElement(f,{marginLeft:1},A.createElement(h,null,"Press ",A.createElement(h,{bold:!0,color:"cyanBright"},"<enter>")," to install the selected packages.")),A.createElement(f,{marginLeft:1},A.createElement(h,null,"Press ",A.createElement(h,{bold:!0,color:"cyanBright"},"<ctrl+c>")," to abort.")))),I=()=>A.createElement(A.Fragment,null,A.createElement(f,{width:15},A.createElement(h,{bold:!0,underline:!0,color:"gray"},"Owner")),A.createElement(f,{width:11},A.createElement(h,{bold:!0,underline:!0,color:"gray"},"Version")),A.createElement(f,{width:10},A.createElement(h,{bold:!0,underline:!0,color:"gray"},"Downloads"))),R=()=>A.createElement(f,{width:17},A.createElement(h,{bold:!0,underline:!0,color:"gray"},"Target")),N=({hit:de,active:xe})=>{let[we,d]=a(de.name,null);s({active:xe},(Ee,he)=>{if(he.name!=="space")return;if(!we){d(GP[0]);return}let $=GP.indexOf(we)+1;$===GP.length?d(null):d(GP[$])},[we,d]);let be=G.parseIdent(de.name),Ce=G.prettyIdent(v,be);return A.createElement(f,null,A.createElement(f,{width:45},A.createElement(h,{bold:!0,wrap:"wrap"},Ce)),A.createElement(f,{width:14,marginLeft:1},A.createElement(h,{bold:!0,wrap:"truncate"},de.owner.name)),A.createElement(f,{width:10,marginLeft:1},A.createElement(h,{italic:!0,wrap:"truncate"},de.version)),A.createElement(f,{width:16,marginLeft:1},A.createElement(h,null,de.humanDownloadsLast30Days)))},U=({name:de,active:xe})=>{let[we]=a(de,null),d=G.parseIdent(de);return A.createElement(f,null,A.createElement(f,{width:47},A.createElement(h,{bold:!0}," - ",G.prettyIdent(v,d))),GP.map(be=>A.createElement(f,{key:be,width:14,marginLeft:1},A.createElement(h,null," ",A.createElement(e,{active:we===be})," ",A.createElement(h,{bold:!0},be)))))},V=()=>A.createElement(f,{marginTop:1},A.createElement(h,null,"Powered by Algolia.")),te=await n(({useSubmit:de})=>{let xe=a();de(xe);let we=Array.from(xe.keys()).filter(j=>xe.get(j)!==null),[d,be]=w(""),[Ce,Ee]=w(0),[he,$]=w([]),De=j=>{j.match(/\t| /)||be(j)},Te=async()=>{Ee(0);let j=await oK(d);j.query===d&&$(j.hits)},ot=async()=>{let j=await oK(d,Ce+1);j.query===d&&j.page-1===Ce&&(Ee(j.page),$([...he,...j.hits]))};return m(()=>{d?Te():$([])},[d]),A.createElement(f,{flexDirection:"column"},A.createElement(D,null),A.createElement(f,{flexDirection:"row",marginTop:1},A.createElement(h,{bold:!0},"Search: "),A.createElement(f,{width:41},A.createElement(l,{value:d,onChange:De,placeholder:"i.e. babel, webpack, react...",showCursor:!1})),A.createElement(I,null)),he.length?A.createElement(r,{radius:2,loop:!1,children:he.map(j=>A.createElement(N,{key:j.name,hit:j,active:!1})),willReachEnd:ot}):A.createElement(h,{color:"gray"},"Start typing..."),A.createElement(f,{flexDirection:"row",marginTop:1},A.createElement(f,{width:49},A.createElement(h,{bold:!0},"Selected:")),A.createElement(R,null)),we.length?we.map(j=>A.createElement(U,{key:j,name:j,active:!1})):A.createElement(h,{color:"gray"},"No selected packages..."),A.createElement(V,null))},{},{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});if(typeof te>"u")return 1;let ie=Array.from(te.keys()).filter(de=>te.get(de)==="regular"),ae=Array.from(te.keys()).filter(de=>te.get(de)==="dev"),ge=Array.from(te.keys()).filter(de=>te.get(de)==="peer");return ie.length&&await this.cli.run(["add",...ie]),ae.length&&await this.cli.run(["add","--dev",...ae]),ge&&await this.cli.run(["add","--peer",...ge]),0}};We();sr();FV();var NPe=st(Di());ga();var FPe=/^((?:[\^~]|>=?)?)([0-9]+)(\.[0-9]+)(\.[0-9]+)((?:-\S+)?)$/;function OPe(t,e){return t.length>0?[t.slice(0,e)].concat(OPe(t.slice(e),e)):[]}var t2=class extends mt{constructor(){super(...arguments);this.mode=ye.String("--mode",{description:"Change what artifacts installs genera Line truncated
${m}, next tree:
${JP(f)}`);let v=UPe(f);if(v)throw new Error(`${v}, after hoisting finished:
${JP(f)}`)}return n.debugLevel>=2&&console.log(JP(f)),oBt(f)},$2t=t=>{let e=t[t.length-1],r=new Map,s=new Set,a=n=>{if(!s.has(n)){s.add(n);for(let l of n.hoistedDependencies.values())r.set(l.name,l);for(let l of n.dependencies.values())n.peerNames.has(l.name)||a(l)}};return a(e),r},eBt=t=>{let e=t[t.length-1],r=new Map,s=new Set,a=new Set,n=(l,f)=>{if(s.has(l))return;s.add(l);for(let A of l.hoistedDependencies.values())if(!f.has(A.name)){let m;for(let w of t)m=w.dependencies.get(A.name),m&&r.set(m.name,m)}let h=new Set;for(let A of l.dependencies.values())h.add(A.name);for(let A of l.dependencies.values())l.peerNames.has(A.name)||n(A,h)};return n(e,a),r},_Pe=(t,e)=>{if(e.decoupled)return e;let{name:r,references:s,ident:a,locator:n,dependencies:l,originalDependencies:f,hoistedDependencies:h,peerNames:A,reasons:m,isHoistBorder:w,hoistPriority:v,dependencyKind:D,hoistedFrom:I,hoistedTo:R}=e,N={name:r,references:new Set(s),ident:a,locator:n,dependencies:new Map(l),originalDependencies:new Map(f),hoistedDependencies:new Map(h),peerNames:new Set(A),reasons:new Map(m),decoupled:!0,isHoistBorder:w,hoistPriority:v,dependencyKind:D,hoistedFrom:new Map(I),hoistedTo:new Map(R)},U=N.dependencies.get(r);return U&&U.ident==N.ident&&N.dependencies.set(r,N),t.dependencies.set(N.name,N),N},tBt=(t,e)=>{let r=new Map([[t.name,[t.ident]]]);for(let a of t.dependencies.values())t.peerNames.has(a.name)||r.set(a.name,[a.ident]);let s=Array.from(e.keys());s.sort((a,n)=>{let l=e.get(a),f=e.get(n);if(f.hoistPriority!==l.hoistPriority)return f.hoistPriority-l.hoistPriority;{let h=l.dependents.size+l.peerDependents.size;return f.dependents.size+f.peerDependents.size-h}});for(let a of s){let n=a.substring(0,a.indexOf("@",1)),l=a.substring(n.length+1);if(!t.peerNames.has(n)){let f=r.get(n);f||(f=[],r.set(n,f)),f.indexOf(l)<0&&f.push(l)}}return r},Hz=t=>{let e=new Set,r=(s,a=new Set)=>{if(!a.has(s)){a.add(s);for(let n of s.peerNames)if(!t.peerNames.has(n)){let l=t.dependencies.get(n);l&&!e.has(l)&&r(l,a)}e.add(s)}};for(let s of t.dependencies.values())t.peerNames.has(s.name)||r(s);return e},Gz=(t,e,r,s,a,n=new Set)=>{let l=e[e.length-1];if(n.has(l))return{anotherRoundNeeded:!1,isGraphChanged:!1};n.add(l);let f=aBt(l),h=tBt(l,f),A=t==l?new Map:a.fastLookupPossible?$2t(e):eBt(e),m,w=!1,v=!1,D=new Map(Array.from(h.entries()).map(([R,N])=>[R,N[0]])),I=new Map;do{let R=iBt(t,e,r,A,D,h,s,I,a);R.isGraphChanged&&(v=!0),R.anotherRoundNeeded&&(w=!0),m=!1;for(let[N,U]of h)U.length>1&&!l.dependencies.has(N)&&(D.delete(N),U.shift(),D.set(N,U[0]),m=!0)}while(m);for(let R of l.dependencies.values())if(!l.peerNames.has(R.name)&&!r.has(R.locator)){r.add(R.locator);let N=Gz(t,[...e,R],r,I,a);N.isGraphChanged&&(v=!0),N.anotherRoundNeeded&&(w=!0),r.delete(R.locator)}return{anotherRoundNeeded:w,isGraphChanged:v}},rBt=t=>{for(let[e,r]of t.dependencies)if(!t.peerNames.has(e)&&r.ident!==t.ident)return!0;return!1},nBt=(t,e,r,s,a,n,l,f,{outputReason:h,fastLookupPossible:A})=>{let m,w=null,v=new Set;h&&(m=`${Array.from(e).map(N=>Yo(N)).join("\u2192")}`);let D=r[r.length-1],R=!(s.ident===D.ident);if(h&&!R&&(w="- self-reference"),R&&(R=s.dependencyKind!==1,h&&!R&&(w="- workspace")),R&&s.dependencyKind===2&&(R=!rBt(s),h&&!R&&(w="- external soft link with unhoisted dependencies")),R&&(R=!t.peerNames.has(s.name),h&&!R&&(w=`- cannot shadow peer: ${Yo(t.originalDependencies.get(s.name).locator)} at ${m}`)),R){let N=!1,U=a.get(s.name);if(N=!U||U.ident===s.ident,h&&!N&&(w=`- filled by: ${Yo(U.locator)} at ${m}`),N)for(let V=r.length-1;V>=1;V--){let te=r[V].dependencies.get(s.name);if(te&&te.ident!==s.ident){N=!1;let ie=f.get(D);ie||(ie=new Set,f.set(D,ie)),ie.add(s.name),h&&(w=`- filled by ${Yo(te.locator)} at ${r.slice(0,V).map(ae=>Yo(ae.locator)).join("\u2192")}`);break}}R=N}if(R&&(R=n.get(s.name)===s.ident,h&&!R&&(w=`- filled by: ${Yo(l.get(s.name)[0])} at ${m}`)),R){let N=!0,U=new Set(s.peerNames);for(let V=r.length-1;V>=1;V--){let ee=r[V];for(let te of U){if(ee.peerNames.has(te)&&ee.originalDependencies.has(te))continue;let ie=ee.dependencies.get(te);ie&&t.dependencies.get(te)!==ie&&(V===r.length-1?v.add(ie):(v=null,N=!1,h&&(w=`- peer dependency ${Yo(ie.locator)} from parent ${Yo(ee.locator)} was not hoisted to ${m}`))),U.delete(te)}if(!N)break}R=N}if(R&&!A)for(let N of s.hoistedDependencies.values()){let U=a.get(N.name)||t.dependencies.get(N.name);if(!U||N.ident!==U.ident){R=!1,h&&(w=`- previously hoisted dependency mismatch, needed: ${Yo(N.locator)}, available: ${Yo(U?.locator)}`);break}}return v!==null&&v.size>0?{isHoistable:2,dependsOn:v,reason:w}:{isHoistable:R?0:1,reason:w}},KL=t=>`${t.name}@${t.locator}`,iBt=(t,e,r,s,a,n,l,f,h)=>{let A=e[e.length-1],m=new Set,w=!1,v=!1,D=(U,V,ee,te,ie)=>{if(m.has(te))return;let ae=[...V,KL(te)],ge=[...ee,KL(te)],de=new Map,xe=new Map;for(let Ee of Hz(te)){let he=nBt(A,r,[A,...U,te],Ee,s,a,n,f,{outputReason:h.debugLevel>=2,fastLookupPossible:h.fastLookupPossible});if(xe.set(Ee,he),he.isHoistable===2)for(let $ of he.dependsOn){let Line truncated
${JP(t)}`)}let Ce=Hz(te);for(let Ee of Ce)if(we.has(Ee)){let he=xe.get(Ee);if((a.get(Ee.name)===Ee.ident||!te.reasons.has(Ee.name))&&he.isHoistable!==0&&te.reasons.set(Ee.name,he.reason),!Ee.isHoistBorder&&ge.indexOf(KL(Ee))<0){m.add(te);let De=_Pe(te,Ee);D([...U,te],ae,ge,De,R),m.delete(te)}}},I,R=new Set(Hz(A)),N=Array.from(e).map(U=>KL(U));do{I=R,R=new Set;for(let U of I){if(U.locator===A.locator||U.isHoistBorder)continue;let V=_Pe(A,U);D([],Array.from(r),N,V,R)}}while(R.size>0);return{anotherRoundNeeded:w,isGraphChanged:v}},UPe=t=>{let e=[],r=new Set,s=new Set,a=(n,l,f)=>{if(r.has(n)||(r.add(n),s.has(n)))return;let h=new Map(l);for(let A of n.dependencies.values())n.peerNames.has(A.name)||h.set(A.name,A);for(let A of n.originalDependencies.values()){let m=h.get(A.name),w=()=>`${Array.from(s).concat([n]).map(v=>Yo(v.locator)).join("\u2192")}`;if(n.peerNames.has(A.name)){let v=l.get(A.name);(v!==m||!v||v.ident!==A.ident)&&e.push(`${w()} - broken peer promise: expected ${A.ident} but found ${v&&v.ident}`)}else{let v=f.hoistedFrom.get(n.name),D=n.hoistedTo.get(A.name),I=`${v?` hoisted from ${v.join(", ")}`:""}`,R=`${D?` hoisted to ${D}`:""}`,N=`${w()}${I}`;m?m.ident!==A.ident&&e.push(`${N} - broken require promise for ${A.name}${R}: expected ${A.ident}, but found: ${m.ident}`):e.push(`${N} - broken require promise: no required dependency ${A.name}${R} found`)}}s.add(n);for(let A of n.dependencies.values())n.peerNames.has(A.name)||a(A,h,n);s.delete(n)};return a(t,t.dependencies,t),e.join(`
`)},sBt=(t,e)=>{let{identName:r,name:s,reference:a,peerNames:n}=t,l={name:s,references:new Set([a]),locator:jz(r,a),ident:LPe(r,a),dependencies:new Map,originalDependencies:new Map,hoistedDependencies:new Map,peerNames:new Set(n),reasons:new Map,decoupled:!0,isHoistBorder:!0,hoistPriority:0,dependencyKind:1,hoistedFrom:new Map,hoistedTo:new Map},f=new Map([[t,l]]),h=(A,m)=>{let w=f.get(A),v=!!w;if(!w){let{name:D,identName:I,reference:R,peerNames:N,hoistPriority:U,dependencyKind:V}=A;w={name:D,references:new Set([R]),locator:jz(I,R),ident:LPe(I,R),dependencies:new Map,originalDependencies:new Map,hoistedDependencies:new Map,peerNames:new Set(N),reasons:new Map,decoupled:!0,isHoistBorder:!1,hoistPriority:U||0,dependencyKind:V||0,hoistedFrom:new Map,hoistedTo:new Map},f.set(A,w)}if(!w.isHoistBorder&&e.hoistingLimits.get(m.locator)?.has(A.name)&&(w.isHoistBorder=!0),m.dependencies.set(A.name,w),m.originalDependencies.set(A.name,w),v){let D=new Set,I=R=>{if(!D.has(R)){D.add(R),R.decoupled=!1;for(let N of R.dependencies.values())R.peerNames.has(N.name)||I(N)}};I(w)}else for(let D of A.dependencies)h(D,w)};for(let A of t.dependencies)h(A,l);return l},qz=t=>t.substring(0,t.indexOf("@",1)),oBt=t=>{let e={name:t.name,identName:qz(t.locator),references:new Set(t.references),dependencies:new Set},r=new Set([t]),s=(a,n,l)=>{let f=r.has(a),h;if(n===a)h=l;else{let{name:A,references:m,locator:w}=a;h={name:A,identName:qz(w),references:m,dependencies:new Set}}if(l.dependencies.add(h),!f){r.add(a);for(let A of a.dependencies.values())a.peerNames.has(A.name)||s(A,a,h);r.delete(a)}};for(let a of t.dependencies.values())s(a,t,e);return e},aBt=t=>{let e=new Map,r=new Set([t]),s=l=>`${l.name}@${l.ident}`,a=l=>{let f=s(l),h=e.get(f);return h||(h={dependents:new Set,peerDependents:new Set,hoistPriority:0},e.set(f,h)),h},n=(l,f)=>{let h=!!r.has(f);if(a(f).dependents.add(l.ident),!h){r.add(f);for(let m of f.dependencies.values()){let w=a(m);w.hoistPriority=Math.max(w.hoistPriority,m.hoistPriority),f.peerNames.has(m.name)?w.peerDependents.add(f.ident):n(f,m)}}};for(let l of t.dependencies.values())t.peerNames.has(l.name)||n(t,l);return e},Yo=t=>{if(!t)return"none";let e=t.indexOf("@",1),r=t.substring(0,e);r.endsWith("$wsroot$")&&(r=`wh:${r.replace("$wsroot$","")}`);let s=t.substring(e+1);if(s==="workspace:.")return".";if(s){let a=(s.indexOf("#")>0?s.split("#")[1]:s).replace("npm:","");return s.startsWith("virtual")&&(r=`v:${r}`),a.startsWith("workspace")&&(r=`w:${r}`,a=""),`${r}${a?`@${a}`:""}`}else return`${r}`};var JP=t=>{let e=0,r=(a,n,l="")=>{if(e>5e4||n.has(a))return"";e++;let f=Array.from(a.dependencies.values()).sort((A,m)=>A.name===m.name?0:A.name>m.name?1:-1),h="";n.add(a);for(let A=0;A<f.length;A++){let m=f[A];if(!a.peerNames.has(m.name)&&m!==a){let w=a.reasons.get(m.name),v=qz(m.locator);h+=`${l}${A<f.length-1?"\u251C\u2500":"\u2514\u2500"}${(n.has(m)?">":"")+(v!==m.name?`a:${m.name}:`:"")+Yo(m.locator)+(w?` ${w}`:"")}
`,h+=r(m,n,`${l}${A<f.length-1?"\u2502 ":" "}`)}}return n.delete(a),h};return r(t,new Set)+(e>5e4?`
Tree is too large, part of the tree has been dunped
`:"")};var ZP=(s=>(s.WORKSPACES="workspaces",s.DEPENDENCIES="dependencies",s.NONE="none",s))(ZP||{}),HPe="node_modules",vg="$wsroot$";var XP=(t,e)=>{let{packageTree:r,hoistingLimits:s,errors:a,preserveSymlinksRequired:n}=lBt(t,e),l=null;if(a.length===0){let f=MPe(r,{hoistingLimits:s});l=fBt(t,f,e)}return{tree:l,errors:a,preserveSymlinksRequired:n}},oA=t=>`${t.name}@${t.reference}`,Wz=t=>{let e=new Map;for(let[r,s]of t.entries())if(!s.dirList){let a=e.get(s.locator);a||(a={target:s.target,linkType:s.linkType,locations:[],aliases:s.aliases},e.set(s.locator,a)),a.locations.push(r)}for(let r of e.values())r.locations=r.locations.sort((s,a)=>{let n=s.split(Y.delimiter).length,l=a.split(Y.delimiter).length;return a===s?0:n!==l?l-n:a>s?1:-1});return e},jPe=(t,e)=>{let r=G.isVirtualLocator(t)?G.devirtualizeLocator(t):t,s=G.isVirtualLocator(e)?G.devirtualizeLocator(e):e;return G.areLocatorsEqual(r,s)},Vz=(t,e,r,s)=>{if(t.linkType!=="SOFT")return!1;let a=me.toPortablePath(r.resolveVirtual&&e.reference&&e.reference.startsWith("virtual:")?r.resolveVirtual(t.packageLocation):t.packageLocation);return Y.contains(s,a)===null},cBt=t=>{let e=t.getPackageInformation(t.topLevel);if(e===null)throw new Error("Assertion failed: Expected the top-level package to have been registered");if(t.findPackageLocator(e.packageLocation)===null)throw new Error("Assertion failed: Expected the top-level package to have a physical locator");let s=me.toPortablePath(e.packageLocation.slice(0,-1)),a=new Map,n={children:new Map},l=t.getDependencyTreeRoots(),f=new Map,h=new Set,A=(v,D)=>{let I=oA(v);if(h.has(I))return;h.add(I);let R=t.getPackageInformation(v);if(R){let N=D?oA(D):"";if(oA(v)!==N&&R.linkType==="SOFT"&&!v.reference.startsWith("link:")&&!Vz(R,v,t,s)){let U=GPe(R,v,t);(!f.get(U)||v.reference.startsWith("workspace:"))&&f.set(U,v)}for(let[U,V]of R.packageDependencies)V!==null&&(R.packagePeers.has(U)||A(t.getLocator(U,V),v))}};for(let v of l)A(v,null);let m=s.split(Y.sep);for(let v of f.values()){let D=t.getPackageInformation(v),R=me.toPortablePath(D.packageLocation.slice(0,-1)).split(Y.sep).slice(m.length),N=n;for(let U of R){let V=N.children.get(U);V||(V={children:new Map},N.children.set(U,V)),N=V}N.workspaceLocator=v}let w=(v,D)=>{if(v.workspaceLocator){let I=oA(D),R=a.get(I);R||(R=new Set,a.set(I,R)),R.add(v.workspaceLocator)}for(let I of v.children.values())w(I,v.workspaceLocator||D)};for(let v of n.children.values())w(v,n.workspaceLocator);return a},lBt=(t,e)=>{let r=[],s=!1,a=new Map,n=cBt(t),l=t.getPackageInformation(t.topLevel);if(l===null)throw new Error("Assertion failed: Expected the top-level package to have been registered");let f=t.findPackageLocator(l.packageLocation);if(f===null)throw new Error("Assertion failed: Expected the top-level package to have a physical locator");let h=me.toPortablePath(l.packageLocation.slice(0,-1)),A={name:f.name,identName:f.name,reference:f.reference,peerNames:l.packagePeers,dependencies:new Set,dependencyKind:1},m=new Map,w=(D,I)=>`${oA(I)}:${D}`,v=(D,I,R,N,U,V,ee,te)=>{let ie=w(D,R),ae=m.get(ie),ge=!!ae;!ge&&R.name===f.name&&R.reference===f.reference&&(ae=A,m.set(ie,A));let de=Vz(I,R,t,h);if(!ae){let Ee=0;de?Ee=2:I.linkType==="SOFT"&&R.name.endsWith(vg)&&(Ee=1),ae={name:D,identName:R.name,reference:R.reference,dependencies:new Set,peerNames:Ee===1?new Set:I.packagePeers,dependencyKind:Ee},m.set(ie,ae)}let xe;if(de?xe=2:U.linkType==="SOFT"?xe=1:xe=0,ae.hoistPriority=Math.max(ae.hoistPriority||0,xe),te&&!de){let Ee=oA({name:N.identName,reference:N.reference}),he=a.get(Ee)||new Set;a.set(Ee,he),he.add(ae.name)}let we=new Map(I.packageDependencies);if(e.project){let Ee=e.project.workspacesByCwd.get(me.toPortablePath(I.packageLocation.slice(0,-1)));if(Ee){let he=new Set([...Array.from(Ee.manifest.peerDependencies.values(),$=>G.stringifyIdent($)),...Array.from(Ee.manifest.peerDependenciesMeta.keys())]);for(let $ of he)we.has($)||(we.set($,V.get($)||null),ae.peerNames.add($))}}let d=oA({name:R.name.replace(vg,""),reference:R.reference}),be=n.get(d);if(be)for(let Ee of be)we.set(`${Ee.name}${vg}`,Ee.reference);(I!==U||I.linkType!=="SOFT"||!de&&(!e.selfReferencesByCwd||e.selfReferencesByCwd.get(ee)))&&N.dependencies.add(ae);let Ce=R!==f&&I.linkType==="SOFT"&&!R.name.endsWith(vg)&&!de;if(!ge&&!Ce){let Ee=new Map;for(let[he,$]of we)if($!==null){let De=t.getLocator(he,$),Te=t.getLocator(he.replace(vg,""),$),ot=t.getPackageInformation(Te);if(ot===null)throw new Error("Assertion failed: Expected the package to have been registered");let j=Vz(ot,De,t,h);if(e.validateExternalSoftLinks&&e.project&&j){ot.packageDependencies.size>0&&(s=!0);for(let[He,Qe]of ot.packageDependencies)if(Qe!==null){let ft=G.parseLocator(Array.isArray(Qe)?`${Qe[0]}@${Qe[1]}`:`${He}@${Qe}`);if(oA(ft)!==oA(De)){let Me=we.get(He);if(Me){let x=G.parseLocator(Array.isArray(Me)?`${Me[0]}@${Me[1]}`:`${He}@${Me}`);jPe(x,ft)||r.push({messageName:71,text:`Cannot link ${G.prettyIdent(e.project.configuration,G.parseIdent(De.name))} into ${G.pretLine truncated
`;for(let n=0,l=t.length;n<l;++n)a+=s+zL(String(n),t[n],e,s).replace(/^ +/,""),n+1<l&&(a+=","),a+=`
`;return a+=r,a+="]",a}function CBt(t,e,r){let s=Object.keys(t),a="";a+="{";for(let n=0,l=s.length,f=0;n<l;++n){let h=s[n],A=t[h];typeof A>"u"||(f!==0&&(a+=", "),a+=JSON.stringify(h),a+=": ",a+=zL(h,A,e,r).replace(/^ +/g,""),f+=1)}return a+="}",a}function BBt(t,e,r){let s=Object.keys(t),a=`${r} `,n="";n+=r,n+=`{
`;let l=0;for(let f=0,h=s.length;f<h;++f){let A=s[f],m=t[A];typeof m>"u"||(l!==0&&(n+=",",n+=`
`),n+=a,n+=JSON.stringify(A),n+=": ",n+=zL(A,m,e,a).replace(/^ +/g,""),l+=1)}return l!==0&&(n+=`
`),n+=r,n+="}",n}function zL(t,e,r,s){let{next:a}=WPe[r],n=a[t]||a["*"];return YPe(e,n,s)}function YPe(t,e,r){let{collapsed:s}=WPe[e];return Array.isArray(t)?s?IBt(t,e,r):wBt(t,e,r):typeof t=="object"&&t!==null?s?CBt(t,e,r):BBt(t,e,r):JSON.stringify(t)}function KPe(t){return YPe(t,"TOP_LEVEL","")}function $P(t,e){let r=Array.from(t);Array.isArray(e)||(e=[e]);let s=[];for(let n of e)s.push(r.map(l=>n(l)));let a=r.map((n,l)=>l);return a.sort((n,l)=>{for(let f of s){let h=f[n]<f[l]?-1:f[n]>f[l]?1:0;if(h!==0)return h}return 0}),a.map(n=>r[n])}function vBt(t){let e=new Map,r=$P(t.fallbackExclusionList||[],[({name:s,reference:a})=>s,({name:s,reference:a})=>a]);for(let{name:s,reference:a}of r){let n=e.get(s);typeof n>"u"&&e.set(s,n=new Set),n.add(a)}return Array.from(e).map(([s,a])=>[s,Array.from(a)])}function SBt(t){return $P(t.fallbackPool||[],([e])=>e)}function bBt(t){let e=[],r=t.dependencyTreeRoots.find(s=>t.packageRegistry.get(s.name)?.get(s.reference)?.packageLocation==="./");for(let[s,a]of $P(t.packageRegistry,([n])=>n===null?"0":`1${n}`)){if(s===null)continue;let n=[];e.push([s,n]);for(let[l,{packageLocation:f,packageDependencies:h,packagePeers:A,linkType:m,discardFromLookup:w}]of $P(a,([v])=>v===null?"0":`1${v}`)){if(l===null)continue;let v=[];s!==null&&l!==null&&!h.has(s)&&v.push([s,l]);for(let[U,V]of h)v.push([U,V]);let D=$P(v,([U])=>U),I=A&&A.size>0?Array.from(A):void 0,N={packageLocation:f,packageDependencies:D,packagePeers:I,linkType:m,discardFromLookup:w||void 0};n.push([l,N]),r&&s===r.name&&l===r.reference&&e.unshift([null,[[null,N]]])}}return e}function ex(t){return{__info:["This file is automatically generated. Do not touch it, or risk","your modifications being lost."],dependencyTreeRoots:t.dependencyTreeRoots,enableTopLevelFallback:t.enableTopLevelFallback||!1,ignorePatternData:t.ignorePattern||null,pnpZipBackend:t.pnpZipBackend,fallbackExclusionList:vBt(t),fallbackPool:SBt(t),packageRegistryData:bBt(t)}}var ZPe=st(JPe());function XPe(t,e){return[t?`${t}
`:"",`/* eslint-disable */
`,`// @ts-nocheck
`,`"use strict";
`,`
`,e,`
`,(0,ZPe.default)()].join("")}function DBt(t){return JSON.stringify(t,null,2)}function PBt(t){return`'${t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,`\\
`)}'`}function xBt(t){return[`const RAW_RUNTIME_STATE =
`,`${PBt(KPe(t))};
`,`function $$SETUP_STATE(hydrateRuntimeState, basePath) {
`,` return hydrateRuntimeState(JSON.parse(RAW_RUNTIME_STATE), {basePath: basePath || __dirname});
`,`}
`].join("")}function kBt(){return[`function $$SETUP_STATE(hydrateRuntimeState, basePath) {
`,` const fs = require('fs');
`,` const path = require('path');
`,` const pnpDataFilepath = path.resolve(__dirname, ${JSON.stringify(Or.pnpData)});
`,` return hydrateRuntimeState(JSON.parse(fs.readFileSync(pnpDataFilepath, 'utf8')), {basePath: basePath || __dirname});
`,`}
`].join("")}function $Pe(t){let e=ex(t),r=xBt(e);return XPe(t.shebang,r)}function exe(t){let e=ex(t),r=kBt(),s=XPe(t.shebang,r);return{dataFile:DBt(e),loaderFile:s}}Mt();function Jz(t,{basePath:e}){let r=me.toPortablePath(e),s=Y.resolve(r),a=t.ignorePatternData!==null?new RegExp(t.ignorePatternData):null,n=new Map,l=new Map(t.packageRegistryData.map(([w,v])=>[w,new Map(v.map(([D,I])=>{if(w===null!=(D===null))throw new Error("Assertion failed: The name and reference should be null, or neither should");let R=I.discardFromLookup??!1,N={name:w,reference:D},U=n.get(I.packageLocation);U?(U.discardFromLookup=U.discardFromLookup&&R,R||(U.locator=N)):n.set(I.packageLocation,{locator:N,discardFromLookup:R});let V=null;return[D,{packageDependencies:new Map(I.packageDependencies),packagePeers:new Set(I.packagePeers),linkType:I.linkType,discardFromLookup:R,get packageLocation(){return V||(V=Y.join(s,I.packageLocation))}}]}))])),f=new Map(t.fallbackExclusionList.map(([w,v])=>[w,new Set(v)])),h=new Map(t.fallbackPool),A=t.dependencyTreeRoots,m=t.enableTopLevelFallback;return{basePath:r,dependencyTreeRoots:A,enableTopLevelFallback:m,fallbackExclusionList:f,pnpZipBackend:t.pnpZipBackend,fallbackPool:h,ignorePattern:a,packageLocatorsByLocations:n,packageRegistry:l}}Mt();Mt();var ad=Ae("module"),yE=Ae("url"),aJ=Ae("util");var Da=Ae("url");var ixe=st(Ae("assert"));var Zz=Array.isArray,tx=JSON.stringify,rx=Object.getOwnPropertyNames,mE=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Xz=(t,e)=>RegExp.prototype.exec.call(t,e),$z=(t,...e)=>RegExp.prototype[Symbol.replace].apply(t,e),Sg=(t,...e)=>String.prototype.endsWith.apply(t,e),eJ=(t,...e)=>String.prototype.includes.apply(t,e),tJ=(t,...e)=>String.prototype.lastIndexOf.apply(t,e),nx=(t,...e)=>String.prototype.indexOf.apply(t,e),txe=(t,...e)=>String.prototype.replace.apply(t,e),bg=(t,...e)=>String.prototype.slice.apply(t,e),aA=(t,...e)=>String.prototype.startsWith.apply(t,e),rxe=Map,nxe=JSON.parse;function ix(t,e,r){return class extends r{constructor(...s){super(e(...s)),this.code=t,this.name=`${r.name} [${t}]`}}}var sxe=ix("ERR_PACKAGE_IMPORT_NOT_DEFINED",(t,e,r)=>`Package import specifier "${t}" is not defined${e?` in package ${e}package.json`:""} imported from ${r}`,TypeError),rJ=ix("ERR_INVALID_MODULE_SPECIFIER",(t,e,r=void 0)=>`Invalid module "${t}" ${e}${r?` imported from ${r}`:""}`,TypeError),oxe=ix("ERR_INVALID_PACKAGE_TARGET",(t,e,r,s=!1,a=void 0)=>{let n=typeof r=="string"&&!s&&r.length&&!aA(r,"./");return e==="."?((0,ixe.default)(s===!1),`Invalid "exports" main target ${tx(r)} defined in the package config ${t}package.json${a?` imported from ${a}`:""}${n?'; targets must start with "./"':""}`):`Invalid "${s?"imports":"exports"}" target ${tx(r)} defined for '${e}' in the package config ${t}package.json${a?` imported from ${a}`:""}${n?'; targets must start with "./"':""}`},Error),sx=ix("ERR_INVALID_PACKAGE_CONFIG",(t,e,r)=>`Invalid package config ${t}${e?` while importing ${e}`:""}${r?`. ${r}`:""}`,Error),axe=ix("ERR_PACKAGE_PATH_NOT_EXPORTED",(t,e,r=void 0)=>e==="."?`No "exports" main defined in ${t}package.json${r?` imported from ${r}`:""}`:`Package subpath '${e}' is not defined by "exports" in ${t}package.json${r?` imported from ${r}`:""}`,Error);var ZL=Ae("url");function cxe(t,e){let r=Object.create(null);for(let s=0;s<e.length;s++){let a=e[s];mE(t,a)&&(r[a]=t[a])}return r}var JL=new rxe;function RBt(t,e,r,s){let a=JL.get(t);if(a!==void 0)return a;let n=s(t);if(n===void 0){let D={pjsonPath:t,exists:!1,main:void 0,name:void 0,type:"none",exports:void 0,imports:void 0};return JL.set(t,D),D}let l;try{l=nxe(n)}catch(D){throw new sx(t,(r?`"${e}" from `:"")+(0,ZL.fileURLToPath)(r||e),D.message)}let{imports:f,main:h,name:A,type:m}=cxe(l,["imports","main","name","type"]),w=mE(l,"exports")?l.exports:void 0;(typeof f!="object"||f===null)&&(f=void 0),typeof h!="string"&&(h=void 0),typeof A!="string"&&(A=void 0),m!=="module"&&m!=="commonjs"&&(m="none");let v={pjsonPath:t,exists:!0,main:h,name:A,type:m,exports:w,imports:f};return JL.set(t,v),v}function lxe(t,e){let r=new URL("./package.json",t);for(;;){let n=r.pathname;if(Sg(n,"node_modules/package.json"))break;let l=RBt((0,ZL.fileURLToPath)(r),t,void 0,e);if(l.exists)return l;let f=r;if(r=new URL("../package.json",r),r.pathname===f.pathname)break}let s=(0,ZL.fileURLToPath)(r),a={pjsonPath:s,exists:!1,main:void 0,name:void 0,type:"none",exports:void 0,imports:void 0};return JL.set(s,a),a}function TBt(t,e,r){throw new sxe(t,e&&(0,Da.fileURLToPath)(new URL(".",e)),(0,Da.fileURLToPath)(r))}function QBt(t,e,r,s){let a=`request is not a valid subpath for the "${r?"imports":"exports"}" resolution of ${(0,Da.fileURLToPath)(e)}`;throw new rJ(t,a,s&&(0,Da.fileURLToPath)(s))}function ox(t,e,r,s,a){throw typeof e=="object"&&e!==null?e=tx(e,null,""):e=`${e}`,new oxe((0,Da.fileURLToPath)(new URL(".",r)),t,e,s,a&&(0,Da.fileURLToPath)(a))}var uxe=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f Line truncated
`),r;l=t[++n]}else if(l===" "&&!s){a=!0;continue}else if(l==='"'){s=!s;continue}a?(r.push(l),a=!1):r[r.length-1]+=l}return s&&e.push(`invalid value for NODE_OPTIONS (unterminated string)
`),r}Mt();var[vo,Xc,jBt]=process.versions.node.split(".").map(t=>parseInt(t,10)),wxe=vo>19||vo===19&&Xc>=2||vo===18&&Xc>=13,Dgr=vo===20&&Xc<6||vo===19&&Xc>=3,Pgr=vo>19||vo===19&&Xc>=6,xgr=vo>=21||vo===20&&Xc>=10||vo===18&&Xc>=19,kgr=vo>=21||vo===20&&Xc>=10||vo===18&&Xc>=20,Rgr=vo>=22,Tgr=vo===26&&Xc<1||vo===25&&Xc>=7||vo===24&&Xc===15||vo===22&&(Xc>22||Xc===22&&jBt>=3);function oJ(t){if(process.env.WATCH_REPORT_DEPENDENCIES&&process.send){let e=t.map(r=>me.fromPortablePath(Mo.resolveVirtual(r)));if(wxe)process.send({"watch:require":e});else for(let r of e)process.send({"watch:require":r})}}function cJ(t,e){let r=Number(process.env.PNP_ALWAYS_WARN_ON_FALLBACK)>0,s=Number(process.env.PNP_DEBUG_LEVEL),a=/^(?![a-zA-Z]:[\\/]|\\\\|\.{0,2}(?:\/|$))((?:node:)?(?:@[^/]+\/)?[^/]+)\/*(.*|)$/,n=/^(\/|\.{1,2}(\/|$))/,l=/\/$/,f=/^\.{0,2}\//,h={name:null,reference:null},A=[],m=new Set;if(t.enableTopLevelFallback===!0&&A.push(h),e.compatibilityMode!==!1)for(let Ne of["react-scripts","gatsby"]){let Fe=t.packageRegistry.get(Ne);if(Fe)for(let Pe of Fe.keys()){if(Pe===null)throw new Error("Assertion failed: This reference shouldn't be null");A.push({name:Ne,reference:Pe})}}let{ignorePattern:w,packageRegistry:v,packageLocatorsByLocations:D}=t;function I(Ne,Fe){return{fn:Ne,args:Fe,error:null,result:null}}function R(Ne){let Fe=process.stderr?.hasColors?.()??process.stdout.isTTY,Pe=(ft,Me)=>`\x1B[${ft}m${Me}\x1B[0m`,He=Ne.error;console.error(He?Pe("31;1",`\u2716 ${Ne.error?.message.replace(/\n.*/s,"")}`):Pe("33;1","\u203C Resolution")),Ne.args.length>0&&console.error();for(let ft of Ne.args)console.error(` ${Pe("37;1","In \u2190")} ${(0,aJ.inspect)(ft,{colors:Fe,compact:!0})}`);Ne.result&&(console.error(),console.error(` ${Pe("37;1","Out \u2192")} ${(0,aJ.inspect)(Ne.result,{colors:Fe,compact:!0})}`));let Qe=new Error().stack.match(/(?<=^ +)at.*/gm)?.slice(2)??[];if(Qe.length>0){console.error();for(let ft of Qe)console.error(` ${Pe("38;5;244",ft)}`)}console.error()}function N(Ne,Fe){if(e.allowDebug===!1)return Fe;if(Number.isFinite(s)){if(s>=2)return(...Pe)=>{let He=I(Ne,Pe);try{return He.result=Fe(...Pe)}catch(Qe){throw He.error=Qe}finally{R(He)}};if(s>=1)return(...Pe)=>{try{return Fe(...Pe)}catch(He){let Qe=I(Ne,Pe);throw Qe.error=He,R(Qe),He}}}return Fe}function U(Ne){let Fe=d(Ne);if(!Fe)throw Gs("INTERNAL","Couldn't find a matching entry in the dependency tree for the specified parent (this is probably an internal error)");return Fe}function V(Ne){if(Ne.name===null)return!0;for(let Fe of t.dependencyTreeRoots)if(Fe.name===Ne.name&&Fe.reference===Ne.reference)return!0;return!1}let ee=new Set(["node","require",...Ixe("--conditions")]);function te(Ne,Fe=ee,Pe){let He=Ee(Y.join(Ne,"internal.js"),{resolveIgnored:!0,includeDiscardFromLookup:!0});if(He===null)throw Gs("INTERNAL",`The locator that owns the "${Ne}" path can't be found inside the dependency tree (this is probably an internal error)`);let{packageLocation:Qe}=U(He),ft=Y.join(Qe,Or.manifest);if(!e.fakeFs.existsSync(ft))return null;let Me=JSON.parse(e.fakeFs.readFileSync(ft,"utf8"));if(Me.exports==null)return null;let x=Y.contains(Qe,Ne);if(x===null)throw Gs("INTERNAL","unqualifiedPath doesn't contain the packageLocation (this is probably an internal error)");x!=="."&&!f.test(x)&&(x=`./${x}`);try{let C=pxe({packageJSONUrl:(0,yE.pathToFileURL)(me.fromPortablePath(ft)),packageSubpath:x,exports:Me.exports,base:Pe?(0,yE.pathToFileURL)(me.fromPortablePath(Pe)):null,conditions:Fe});return me.toPortablePath((0,yE.fileURLToPath)(C))}catch(C){throw Gs("EXPORTS_RESOLUTION_FAILED",C.message,{unqualifiedPath:Xf(Ne),locator:He,pkgJson:Me,subpath:Xf(x),conditions:Fe},C.code)}}function ie(Ne,Fe,{extensions:Pe}){let He;try{Fe.push(Ne),He=e.fakeFs.statSync(Ne)}catch{}if(He&&!He.isDirectory())return e.fakeFs.realpathSync(Ne);if(He&&He.isDirectory()){let Qe;try{Qe=JSON.parse(e.fakeFs.readFileSync(Y.join(Ne,Or.manifest),"utf8"))}catch{}let ft;if(Qe&&Qe.main&&(ft=Y.resolve(Ne,Qe.main)),ft&&ft!==Ne){let Me=ie(ft,Fe,{extensions:Pe});if(Me!==null)return Me}}for(let Qe=0,ft=Pe.length;Qe<ft;Qe++){let Me=`${Ne}${Pe[Qe]}`;if(Fe.push(Me),e.fakeFs.existsSync(Me))return Me}if(He&&He.isDirectory())for(let Qe=0,ft=Pe.length;Qe<ft;Qe++){let Me=Y.format({dir:Ne,name:"index",ext:Pe[Qe]});if(Fe.push(Me),e.fakeFs.existsSync(Me))return Me}return null}function ae(Ne){let Fe=new ad.Module(Ne,null);return Fe.filename=Ne,Fe.paths=ad.Module._nodeModulePaths(Ne),Fe}function ge(Ne,Fe){return Fe.endsWith("/")&&(Fe=Y.join(Fe,"internal.js")),ad.Module._resolveFilename(me.fromPortablePath(Ne),ae(me.fromPortablePath(Fe)),!1,{plugnplay:!1})}function de(Ne){if(w===null)return!1;let Fe=Y.contains(t.basePath,Ne);return Fe===null?!1:!!w.test(Fe.replace(/\/$/,""))}let xe={std:3,resolveVirtual:1,getAllLocators:1},we=h;function d({name:Ne,reference:Fe}){let Pe=v.get(Ne);if(!Pe)return null;let He=Pe.get(Fe);return He||null}function be({name:Ne,reference:Fe}){let Pe=[];for(let[He,Qe]of v)if(He!==null)for(let[ft,Me]of Qe)ft===nulLine truncated
Require request: "${He}"
Required by: ${Qe}
`,{request:He,issuer:Qe});return me.toPortablePath(x)}let ft,Me=Ne.match(a);if(Me){if(!Fe)throw Gs("API_ERROR","The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute",{request:He,issuer:Qe});let[,x,C]=Me,P=Ee(Fe);if(!P){let Le=ge(Ne,Fe);if(Le===!1)throw Gs("BUILTIN_NODE_RESOLUTION_FAILED",`The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer doesn't seem to be part of the Yarn-managed dependency tree).
Require path: "${He}"
Required by: ${Qe}
`,{request:He,issuer:Qe});return me.toPortablePath(Le)}let F=U(P).packageDependencies.get(x),Z=null;if(F==null&&P.name!==null){let Le=t.fallbackExclusionList.get(P.name);if(!Le||!Le.has(P.reference)){for(let St=0,er=A.length;St<er;++St){let Ht=U(A[St]).packageDependencies.get(x);if(Ht!=null){r?Z=Ht:F=Ht;break}}if(t.enableTopLevelFallback&&F==null&&Z===null){let St=t.fallbackPool.get(x);St!=null&&(Z=St)}}}let X=null;if(F===null)if(V(P))X=Gs("MISSING_PEER_DEPENDENCY",`Your application tried to access ${x} (a peer dependency); this isn't allowed as there is no ancestor to satisfy the requirement. Use a devDependency if needed.
Required package: ${x}${x!==He?` (via "${He}")`:""}
Required by: ${Qe}
`,{request:He,issuer:Qe,dependencyName:x});else{let Le=Ce(x,P);Le.every(pt=>V(pt))?X=Gs("MISSING_PEER_DEPENDENCY",`${P.name} tried to access ${x} (a peer dependency) but it isn't provided by your application; this makes the require call ambiguous and unsound.
Required package: ${x}${x!==He?` (via "${He}")`:""}
Required by: ${P.name}@${P.reference} (via ${Qe})
${Le.map(pt=>`Ancestor breaking the chain: ${pt.name}@${pt.reference}
`).join("")}
`,{request:He,issuer:Qe,issuerLocator:Object.assign({},P),dependencyName:x,brokenAncestors:Le}):X=Gs("MISSING_PEER_DEPENDENCY",`${P.name} tried to access ${x} (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.
Required package: ${x}${x!==He?` (via "${He}")`:""}
Required by: ${P.name}@${P.reference} (via ${Qe})
${Le.map(pt=>`Ancestor breaking the chain: ${pt.name}@${pt.reference}
`).join("")}
`,{request:He,issuer:Qe,issuerLocator:Object.assign({},P),dependencyName:x,brokenAncestors:Le})}else F===void 0&&(!Pe&&(0,ad.isBuiltin)(Ne)?V(P)?X=Gs("UNDECLARED_DEPENDENCY",`Your application tried to access ${x}. While this module is usually interpreted as a Node builtin, your resolver is running inside a non-Node resolution context where such builtins are ignored. Since ${x} isn't otherwise declared in your dependencies, this makes the require call ambiguous and unsound.
Required package: ${x}${x!==He?` (via "${He}")`:""}
Required by: ${Qe}
`,{request:He,issuer:Qe,dependencyName:x}):X=Gs("UNDECLARED_DEPENDENCY",`${P.name} tried to access ${x}. While this module is usually interpreted as a Node builtin, your resolver is running inside a non-Node resolution context where such builtins are ignored. Since ${x} isn't otherwise declared in ${P.name}'s dependencies, this makes the require call ambiguous and unsound.
Required package: ${x}${x!==He?` (via "${He}")`:""}
Required by: ${Qe}
`,{request:He,issuer:Qe,issuerLocator:Object.assign({},P),dependencyName:x}):V(P)?X=Gs("UNDECLARED_DEPENDENCY",`Your application tried to access ${x}, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.
Required package: ${x}${x!==He?` (via "${He}")`:""}
Required by: ${Qe}
`,{request:He,issuer:Qe,dependencyName:x}):X=Gs("UNDECLARED_DEPENDENCY",`${P.name} tried to access ${x}, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: ${x}${x!==He?` (via "${He}")`:""}
Required by: ${P.name}@${P.reference} (via ${Qe})
`,{request:He,issuer:Qe,issuerLocator:Object.assign({},P),dependencyName:x}));if(F==null){if(Z===null||X===null)throw X||new Error("Assertion failed: Expected an error to have been set");F=Z;let Le=X.message.replace(/\n.*/g,"");X.message=Le,!m.has(Le)&&s!==0&&(m.add(Le),process.emitWarning(X))}let re=Array.isArray(F)?{name:F[0],reference:F[1]}:{name:x,reference:F},ce=U(re);if(!ce.packageLocation)throw Gs("MISSING_DEPENDENCY",`A dependency seems valid but didn't get installed for some reason. This might be caused by a partial install, such as dev vs prod.
Required package: ${re.name}@${re.reference}${re.name!==He?` (via "${He}")`:""}
Required by: ${P.name}@${P.reference} (via ${Qe})
`,{request:He,issuer:Qe,dependencyLocator:Object.assign({},re)});let ke=ce.packageLocation;C?ft=Y.join(ke,C):ft=ke}else if(Y.isAbsolute(Ne))ft=Y.normalize(Ne);else{if(!Fe)throw Gs("API_ERROR","The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute",{request:He,issuer:Qe});let x=Y.resolve(Fe);Fe.match(l)?ft=Y.normalize(Y.join(x,Ne)):ft=Y.normalize(Y.join(Y.dirname(x),Ne))}return Y.normalize(ft)}function De(Ne,Fe,Pe=ee,He){if(n.test(Ne))return Fe;let Qe=te(Fe,Pe,He);return Qe?Y.normalize(Qe):Fe}function Te(Ne,{extensions:Fe=Object.keys(ad.Module._extensions)}={}){let Pe=[],He=ie(Ne,Pe,{extensions:Fe});if(He)return oJ([He]),Y.normalize(He);{oJ(Pe);let Qe=Xf(Ne),ft=Ee(Ne);if(ft){let{packageLocation:Me}=U(ft),x=!0;try{e.fakeFs.accessSync(Me)}catch(C){if(C?.code==="ENOENT")x=!1;else{let P=(C?.message??C??"empty exception thrown").replace(/^[A-Z]/,E=>E.toLowerCase());throw Gs("QUALIFIED_PATH_RESOLUTION_FAILED",`Required package exists but could not be accessed (${P}).
Missing package: ${ft.name}@${ft.reference}
Expected package location: ${Xf(Me)}
`,{unqualifiedPath:Qe,extensions:Fe})}}if(!x){let C=Me.includes("/unplugged/")?"Required unplugged package missing from disk. This may happen when switching branches without running installs (unplugged packages must be fully materialized on disk to work).":"Required package missing from disk. If you keep your packages inside your repository then restarting the Node process may be enough. Otherwise, try to run an install first.";throw Gs("QUALIFIED_PATH_RESOLUTION_FAILED",`${C}
Missing package: ${ft.name}@${ft.reference}
Expected package location: ${Xf(Me)}
`,{unqualifiedPath:Qe,extensions:Fe})}}throw Gs("QUALIFIED_PATH_RESOLUTION_FAILED",`Qualified path resolution failed: we looked for the following paths, but none could be accessed.
Source path: ${Qe}
${Pe.map(Me=>`Not found: ${Xf(Me)}
`).join("")}`,{unqualifiedPath:Qe,extensions:Fe})}}function ot(Ne,Fe,Pe){if(!Fe)throw new Error("Assertion failed: An issuer is required to resolve private import mappings");let He=dxe({name:Ne,base:(0,yE.pathToFileURL)(me.fromPortablePath(Fe)),conditions:Pe.conditions??ee,readFileSyncFn:he});if(He instanceof URL)return Te(me.toPortablePath((0,yE.fileURLToPath)(He)),{extensions:Pe.extensions});if(He.startsWith("#"))throw new Error("Mapping from one private import to another isn't allowed");return j(He,Fe,Pe)}function j(Ne,Fe,Pe={}){try{if(Ne.startsWith("#"))return ot(Ne,Fe,Pe);let{considerBuiltins:He,extensions:Qe,conditions:ft}=Pe,Me=$(Ne,Fe,{considerBuiltins:He});if(Ne==="pnpapi")return Me;if(Me===null)return null;let x=()=>Fe!==null?de(Fe):!1,C=(!He||!(0,ad.isBuiltin)(Ne))&&!x()?De(Ne,Me,ft,Fe):Me;return Te(C,{extensions:Qe})}catch(He){throw Object.hasOwn(He,"pnpCode")&&Object.assign(He.data,{request:Xf(Ne),issuer:Fe&&Xf(Fe)}),He}}function rt(Ne){let Fe=Y.normalize(Ne),Pe=Mo.resolveVirtual(Fe);return Pe!==Fe?Pe:null}return{VERSIONS:xe,topLevel:we,getLocator:(Ne,Fe)=>Array.isArray(Fe)?{name:Fe[0],reference:Fe[1]}:{name:Ne,reference:Fe},getDependencyTreeRoots:()=>[...t.dependencyTreeRoots],getAllLocators(){let Ne=[];for(let[Fe,Pe]of v)for(let He of Pe.keys())Fe!==null&&He!==null&&Ne.push({name:Fe,reference:He});return Ne},getPackageInformation:Ne=>{let Fe=d(Ne);if(Fe===null)return null;let Pe=me.fromPortablePath(Fe.packageLocation);return{...Fe,packageLocation:Pe}},findPackageLocator:Ne=>Ee(me.toPortablePath(Ne)),resolveToUnqualified:N("resolveToUnqualified",(Ne,Fe,Pe)=>{let He=Fe!==null?me.toPortablePath(Fe):null,Qe=$(me.toPortablePath(Ne),He,Pe);return Qe===null?null:me.fromPortablePath(Qe)}),resolveUnqualified:N("resolveUnqualified",(Ne,Fe)=>me.fromPortablePath(Te(me.toPortablePath(Ne),Fe))),resolveRequest:N("resolveRequest",(Ne,Fe,Pe)=>{let He=Fe!==null?me.toPortablePath(Fe):null,Qe=j(me.toPortablePath(Ne),He,Pe);return Qe===null?null:me.fromPortablePath(Qe)}),resolveVirtual:N("resolveVirtual",Ne=>{let Fe=rt(me.toPortablePath(Ne));return Fe!==null?me.fromPortablePath(Fe):null})}}Mt();var Cxe=(t,e,r)=>{let s=ex(t),a=Jz(s,{basePath:e}),n=me.join(e,Or.pnpCjs);return cJ(a,{fakeFs:r,pnpapiResolution:n})};var uJ=st(vxe());sr();var cA={};lr(cA,{checkManifestCompatibility:()=>Sxe,extractBuildRequest:()=>XL,getExtractHint:()=>fJ,hasBindingGyp:()=>hJ});We();Mt();function Sxe(t){return G.isPackageCompatible(t,us.getArchitectureSet())}function XL(t,e,r,{configuration:s}){let a=[];for(let n of["preinstall","install","postinstall"])e.manifest.scripts.has(n)&&a.push({type:0,script:n});return!e.manifest.scripts.has("install")&&e.misc.hasBindingGyp&&a.push({type:1,script:"node-gyp rebuild"}),a.length===0?null:t.linkType!=="HARD"?{skipped:!0,explain:n=>n.reportWarningOnce(6,`${G.prettyLocator(s,t)} lists build scripts, but is referenced through a soft link. Soft links don't support build scripts, so they'll be ignored.`)}:r&&r.built===!1?{skipped:!0,explain:n=>n.reportInfoOnce(5,`${G.prettyLocator(s,t)} lists build scripts, but its build has been explicitly disabled through configuration.`)}:!s.get("enableScripts")&&!r.built?{skipped:!0,explain:n=>n.reportWarningOnce(4,`${G.prettyLocator(s,t)} lists build scripts, but all build scripts have been disabled.`)}:Sxe(t)?{skipped:!1,directives:a}:{skipped:!0,explain:n=>n.reportWarningOnce(76,`${G.prettyLocator(s,t)} The ${us.getArchitectureName()} architecture is incompatible with this package, build skipped.`)}}var qBt=new Set([".exe",".bin",".h",".hh",".hpp",".c",".cc",".cpp",".java",".jar",".node"]);function fJ(t){return t.packageFs.getExtractHint({relevantExtensions:qBt})}function hJ(t){let e=Y.join(t.prefixPath,"binding.gyp");return t.packageFs.existsSync(e)}var lx={};lr(lx,{getUnpluggedPath:()=>cx});We();Mt();function cx(t,{configuration:e}){return Y.resolve(e.get("pnpUnpluggedFolder"),G.slugifyLocator(t))}var VBt=new Set([G.makeIdent(null,"open").identHash,G.makeIdent(null,"opn").identHash]),Dg=class{constructor(){this.mode="strict";this.pnpCache=new Map}getCustomDataKey(){return JSON.stringify({name:"PnpLinker",version:2})}supportsPackage(e,r){return this.isEnabled(r)}async findPackageLocation(e,r){if(!this.isEnabled(r))throw new Error("Assertion failed: Expected the PnP linker to be enabled");let s=Pg(r.project).cjs;if(!fe.existsSync(s))throw new ht(`The project in ${pe.pretty(r.project.configuration,`${r.project.cwd}/package.json`,pe.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let a=Ye.getFactoryWithDefault(this.pnpCache,s,()=>Ye.dynamicRequire(s,{cachingStrategy:Ye.CachingStrategy.FsTime})),n={name:G.stringifyIdent(e),reference:e.reference},l=a.getPackageInformation(n);if(!l)throw new ht(`Couldn't find ${G.prettyLocator(r.project.configuration,e)} in the currently installed PnP map - running an install might help`);return me.toPortablePath(l.packageLocation)}async findPackageLocator(e,r){if(!this.isEnabled(r))return nullLine truncated
`,n+=`# cause your node_modules installation to become invalidated.
`,n+=`
`,n+=`__metadata:
`,n+=` version: ${_xe}
`,n+=` nmMode: ${s.value}
`;let l=Array.from(e.keys()).sort(),f=G.stringifyLocator(t.topLevelWorkspace.anchoredLocator);for(let m of l){let w=e.get(m);n+=`
`,n+=`${JSON.stringify(m)}:
`,n+=` locations:
`;for(let v of w.locations){let D=Y.contains(t.cwd,v);if(D===null)throw new Error(`Assertion failed: Expected the path to be within the project (${v})`);n+=` - ${JSON.stringify(D)}
`}if(w.aliases.length>0){n+=` aliases:
`;for(let v of w.aliases)n+=` - ${JSON.stringify(v)}
`}if(m===f&&r.size>0){n+=` bin:
`;for(let[v,D]of r){let I=Y.contains(t.cwd,v);if(I===null)throw new Error(`Assertion failed: Expected the path to be within the project (${v})`);n+=` ${JSON.stringify(I)}:
`;for(let[R,N]of D){let U=Y.relative(Y.join(v,Vi),N);n+=` ${JSON.stringify(R)}: ${JSON.stringify(U)}
`}}}}let h=t.cwd,A=Y.join(h,Vi,BJ);try{a&&await fe.removePromise(A),await fe.changeFilePromise(A,n,{automaticNewlines:!0})}finally{dvt(t)}}async function yvt(t){let e=t.cwd,r=Y.join(e,Vi,BJ);try{let s=await fe.statPromise(r);return`${s.mtimeMs}:${s.size}`}catch{return null}}async function Mxe(t,{unrollAliases:e=!1}={}){let r=t.cwd,s=Y.join(r,Vi,BJ),a;try{a=await fe.statPromise(s)}catch{}if(!a)return null;let n=Fs(await fe.readFilePromise(s,"utf8"));if(n.__metadata.version>_xe)return null;let l=n.__metadata.nmMode||"classic",f=new Map,h=new Map;delete n.__metadata;for(let[A,m]of Object.entries(n)){let w=m.locations.map(D=>Y.join(r,D)),v=m.bin;if(v)for(let[D,I]of Object.entries(v)){let R=Y.join(r,me.toPortablePath(D)),N=Ye.getMapWithDefault(h,R);for(let[U,V]of Object.entries(I))N.set(U,me.toPortablePath([R,Vi,V].join(Y.sep)))}if(f.set(A,{target:Rt.dot,linkType:"HARD",locations:w,aliases:m.aliases||[]}),e&&m.aliases)for(let D of m.aliases){let{scope:I,name:R}=G.parseLocator(A),N=G.makeLocator(G.makeIdent(I,R),D),U=G.stringifyLocator(N);f.set(U,{target:Rt.dot,linkType:"HARD",locations:w,aliases:[]})}}return{locatorMap:f,binSymlinks:h,locationTree:Uxe(f,{skipPrefix:t.cwd}),nmMode:l,mtimeMs:a.mtimeMs}}var a2=async(t,e)=>{if(t.split(Y.sep).indexOf(Vi)<0)throw new Error(`Assertion failed: trying to remove dir that doesn't contain node_modules: ${t}`);try{let r;if(!e.innerLoop&&(r=await fe.lstatPromise(t),!r.isDirectory()&&!r.isSymbolicLink()||r.isSymbolicLink()&&!e.isWorkspaceDir)){await fe.unlinkPromise(t);return}let s=await fe.readdirPromise(t,{withFileTypes:!0});for(let n of s){let l=Y.join(t,n.name);n.isDirectory()?(n.name!==Vi||e&&e.innerLoop)&&await a2(l,{innerLoop:!0,contentsOnly:!1}):await fe.unlinkPromise(l)}let a=!e.innerLoop&&e.isWorkspaceDir&&r?.isSymbolicLink();!e.contentsOnly&&!a&&await fe.rmdirPromise(t)}catch(r){if(r.code!=="ENOENT"&&r.code!=="ENOTEMPTY")throw r}},Fxe=4,r_=(t,{skipPrefix:e})=>{let r=Y.contains(e,t);if(r===null)throw new Error(`Assertion failed: Writing attempt prevented to ${t} which is outside project root: ${e}`);let s=r.split(Y.sep).filter(h=>h!==""),a=s.indexOf(Vi),n=s.slice(0,a).join(Y.sep),l=Y.join(e,n),f=s.slice(a);return{locationRoot:l,segments:f}},Uxe=(t,{skipPrefix:e})=>{let r=new Map;if(t===null)return r;let s=()=>({children:new Map,linkType:"HARD"});for(let[a,n]of t.entries()){if(n.linkType==="SOFT"&&Y.contains(e,n.target)!==null){let f=Ye.getFactoryWithDefault(r,n.target,s);f.locator=a,f.linkType=n.linkType}for(let l of n.locations){let{locationRoot:f,segments:h}=r_(l,{skipPrefix:e}),A=Ye.getFactoryWithDefault(r,f,s);for(let m=0;m<h.length;++m){let w=h[m];if(w!=="."){let v=Ye.getFactoryWithDefault(A.children,w,s);A.children.set(w,v),A=v}m===h.length-1&&(A.locator=a,A.linkType=n.linkType)}}}return r},SJ=async(t,e,r)=>{if(process.platform==="win32"&&r==="junctions"){let s;try{s=await fe.lstatPromise(t)}catch{}if(!s||s.isDirectory()){await fe.symlinkPromise(t,e,"junction");return}}await fe.symlinkPromise(Y.relative(Y.dirname(e),t),e)};async function Hxe(t,e,r){let s=Y.join(t,`${CJ.default.randomBytes(16).toString("hex")}.tmp`);try{await fe.writeFilePromise(s,r);try{await fe.linkPromise(s,e)}catch{}}finally{await fe.unlinkPromise(s)}}async function Evt({srcPath:t,dstPath:e,entry:r,globalHardlinksStore:s,baseFs:a,nmMode:n}){if(r.kind==="file"){if(n.value==="hardlinks-global"&&s&&r.digest){let f=Y.join(s,r.digest.substring(0,2),`${r.digest.substring(2)}.dat`),h;try{let A=await fe.statPromise(f);if(A&&(!r.mtimeMs||A.mtimeMs>r.mtimeMs||A.mtimeMs<r.mtimeMs-pvt))if(await si.checksumFile(f,{baseFs:fe,algorithm:"sha1"})!==r.digest){let w=Y.join(s,`${CJ.default.randomBytes(16).toString("hex")}.tmp`);await fe.renamePromise(f,w);let v=await a.readFilePromise(t);await fe.writeFilePromise(w,v);try{await fe.linkPromise(w,f),r.mtimeMs=new Date().getTime(),await fe.unlinkPromise(w)}catch{}}else r.mtimeMs||(r.mtimeMs=Math.ceil(A.mtimeMs));await fe.linkPromise(f,e),h=!0}catch{h=!1}if(!h){let A=await a.readFilePromise(t);await Hxe(s,f,A),r.mtimeMs=new Date().getTime();try{await fe.linkPromise(f,e)}catch(m){m&&m.code&&m.code=="EXDEV"&&(n.value="hardlinks-local",await a.copyFilePromise(t,e))}}}else await a.copyFilePromise(t,e);let l=r.mode&511;l!==420&&await fe.chmodPromise(e,l)}}var Ivt=async(t,e,{baseFs:r,globalHardlinksStore:s,nmMode:a,windowsLinkType:n,packageChecksum:l})=>{await fe.mkdirPromise(t,{recursive:!0});let f=async(m=Rt.dot)=>{let w=Y.join(e,m),v=await r.readdirPromise(w,{withFileTypes:!0}),D=new Map;for(let I of v){let R=Y.join(m,I.name),N,U=Y.join(w,I.name);if(I.isFile()){if(N={kind:"file",mode:(await r.lstatPromise(U)).mode},a.value==="hardlinks-global"){let V=await si.checksumFile(U,{baseFs:r,algorithm:"sha1"});N.digest=V}}else if(I.isDirectory())N={kind:"directory"};else if(I.isSymbolicLink())N={kind:"symlink",symlinkTo:await r.readlinkPromise(U)};else throw new Error(`Unsupported file type (file: ${U}, mode: 0o${await r.statSync(U).mode.toString(8).padStart(6,"0")})`);if(D. Line truncated
`)),process.env.YARN_IS_TEST_ENV)return process.env.YARN_INJECT_NPM_2FA_TOKEN||"";if(!process.stdin.isTTY)throw new Zt(33,"The registry requires additional authentication, but Yarn is not running in an interactive terminal");let{otp:s}=await(0,kJ.prompt)({type:"password",name:"otp",message:"One-time password:",required:!0,onCancel:()=>process.exit(130)});return process.stdout.write(`
`),s}function s_(t){if(t.originalError?.name!=="HTTPError")return!1;try{return(t.originalError?.response.headers["www-authenticate"].split(/,\s*/).map(r=>r.toLowerCase())).includes("otp")}catch{return!1}}function u2(t){return{"npm-otp":t}}async function Yvt(t,{configuration:e,ident:r}){let s=null;if(process.env.GITLAB_CI)s=process.env.NPM_ID_TOKEN||null;else if(process.env.CIRCLECI)s=process.env.NPM_ID_TOKEN||null;else if(process.env.GITHUB_ACTIONS){if(!(process.env.ACTIONS_ID_TOKEN_REQUEST_URL&&process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN))return null;let a=`npm:${new URL(t).host.replace("registry.yarnpkg.com","registry.npmjs.org").replace("yarn.npmjs.org","registry.npmjs.org")}`,n=new URL(process.env.ACTIONS_ID_TOKEN_REQUEST_URL);n.searchParams.append("audience",a),s=(await Sn.get(n.href,{configuration:e,jsonResponse:!0,headers:{Authorization:`Bearer ${process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN}`}})).value}if(!s)return null;try{return(await Sn.post(`${t}/-/npm/v1/oidc/token/exchange/package${Ax(r)}`,null,{configuration:e,jsonResponse:!0,headers:{Authorization:`Bearer ${s}`}})).token||null}catch{}return null}var dx=class{supports(e,r){if(!e.reference.startsWith(Ci))return!1;let{selector:s,params:a}=G.parseRange(e.reference);return!(!Zxe.default.valid(s)||a===null||typeof a.__archiveUrl!="string")}getLocalPath(e,r){return null}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,l]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote server`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),checksum:l}}async fetchFromNetwork(e,r){let{params:s}=G.parseRange(e.reference);if(s===null||typeof s.__archiveUrl!="string")throw new Error("Assertion failed: The archiveUrl querystring parameter should have been available");let a=await wE(s.__archiveUrl,{customErrorMessage:IE,configuration:r.project.configuration,ident:e});return await Hs.convertToZip(a,{configuration:r.project.configuration,prefixPath:G.getIdentVendorPath(e),stripComponents:1})}};We();var gx=class{supportsDescriptor(e,r){return!(!e.range.startsWith(Ci)||!G.tryParseDescriptor(e.range.slice(Ci.length),!0))}supportsLocator(e,r){return!1}shouldPersistResolution(e,r){throw new Error("Unreachable")}bindDescriptor(e,r,s){return e}getResolutionDependencies(e,r){let s=r.project.configuration.normalizeDependency(G.parseDescriptor(e.range.slice(Ci.length),!0));return r.resolver.getResolutionDependencies(s,r)}async getCandidates(e,r,s){let a=s.project.configuration.normalizeDependency(G.parseDescriptor(e.range.slice(Ci.length),!0));return await s.resolver.getCandidates(a,r,s)}async getSatisfying(e,r,s,a){let n=a.project.configuration.normalizeDependency(G.parseDescriptor(e.range.slice(Ci.length),!0));return a.resolver.getSatisfying(n,r,s,a)}resolve(e,r){throw new Error("Unreachable")}};We();We();var Xxe=st(Di());var cd=class t{supports(e,r){if(!e.reference.startsWith(Ci))return!1;let s=new URL(e.reference);return!(!Xxe.default.valid(s.pathname)||s.searchParams.has("__archiveUrl"))}getLocalPath(e,r){return null}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,l]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote registry`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),checksum:l}}async fetchFromNetwork(e,r){let s;try{s=await wE(t.getLocatorUrl(e),{customErrorMessage:IE,configuration:r.project.configuration,ident:e})}catch{s=await wE(t.getLocatorUrl(e).replace(/%2f/g,"/"),{customErrorMessage:IE,configuration:r.project.configuration,ident:e})}return await Hs.convertToZip(s,{configuration:r.project.configuration,prefixPath:G.getIdentVendorPath(e),stripComponents:1})}static isConventionalTarballUrl(e,r,{configuration:s}){let a=c2(e.scope,{configuration:s}),n=t.getLocatorUrl(e);return r=r.replace(/^https?:(\/\/(?:[^/]+\.)?npmjs.org(?:$|\/))/,"https:$1"),a=a.replace(/^https:\/\/registry\.npmjs\.org($|\/)/,"https://registry.yarnpkg.com$1"),r=r.replace(/^https:\/\/registry\.npmjs\.org($|\/)/,"https://registry.yarnpkg.com$1"),r===a+n||r===a+n.replace(/%2f/g,"/")}static getLocatorUrl(e){let r=zr.clean(e.reference.slice(Ci.length));if(r===null)throw new Zt(10,"The npm semver resolver got selected, but the version isn't semver");let s=encodeURIComponent(e.name),a=encodeURIComponent(r);return`${Ax(e)}/-/${s}-${a}.tgz`}};We();We();We();var a_=st(Di());var o_=G.makeIdent(null,"node-gyp"),Kvt=/\b(node-gyp|prebuild-install)\b/;function $xe(t,e){let r=a=>Ye.mapAndFilter(e,n=>{try{let l=new zr.SemVer(n);if(a.test(l))return l}catch{}return Ye.mapAndFilter.skip}),sLine truncated
https://docs.gitlab.com/ee/ci/secrets/id_token_authentication.html`);r={_type:n5t,subject:t,predicateType:s5t,predicate:{buildType:`${l5t}/${u5t}`,builder:{id:`${Ot.CI_PROJECT_URL}/-/runners/${Ot.CI_RUNNER_ID}`},invocation:{configSource:{uri:`git+${Ot.CI_PROJECT_URL}`,digest:{sha1:Ot.CI_COMMIT_SHA},entryPoint:Ot.CI_JOB_NAME},parameters:{CI:Ot.CI,CI_API_GRAPHQL_URL:Ot.CI_API_GRAPHQL_URL,CI_API_V4_URL:Ot.CI_API_V4_URL,CI_BUILD_BEFORE_SHA:Ot.CI_BUILD_BEFORE_SHA,CI_BUILD_ID:Ot.CI_BUILD_ID,CI_BUILD_NAME:Ot.CI_BUILD_NAME,CI_BUILD_REF:Ot.CI_BUILD_REF,CI_BUILD_REF_NAME:Ot.CI_BUILD_REF_NAME,CI_BUILD_REF_SLUG:Ot.CI_BUILD_REF_SLUG,CI_BUILD_STAGE:Ot.CI_BUILD_STAGE,CI_COMMIT_BEFORE_SHA:Ot.CI_COMMIT_BEFORE_SHA,CI_COMMIT_BRANCH:Ot.CI_COMMIT_BRANCH,CI_COMMIT_REF_NAME:Ot.CI_COMMIT_REF_NAME,CI_COMMIT_REF_PROTECTED:Ot.CI_COMMIT_REF_PROTECTED,CI_COMMIT_REF_SLUG:Ot.CI_COMMIT_REF_SLUG,CI_COMMIT_SHA:Ot.CI_COMMIT_SHA,CI_COMMIT_SHORT_SHA:Ot.CI_COMMIT_SHORT_SHA,CI_COMMIT_TIMESTAMP:Ot.CI_COMMIT_TIMESTAMP,CI_COMMIT_TITLE:Ot.CI_COMMIT_TITLE,CI_CONFIG_PATH:Ot.CI_CONFIG_PATH,CI_DEFAULT_BRANCH:Ot.CI_DEFAULT_BRANCH,CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX:Ot.CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX,CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX:Ot.CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX,CI_DEPENDENCY_PROXY_SERVER:Ot.CI_DEPENDENCY_PROXY_SERVER,CI_DEPENDENCY_PROXY_USER:Ot.CI_DEPENDENCY_PROXY_USER,CI_JOB_ID:Ot.CI_JOB_ID,CI_JOB_NAME:Ot.CI_JOB_NAME,CI_JOB_NAME_SLUG:Ot.CI_JOB_NAME_SLUG,CI_JOB_STAGE:Ot.CI_JOB_STAGE,CI_JOB_STARTED_AT:Ot.CI_JOB_STARTED_AT,CI_JOB_URL:Ot.CI_JOB_URL,CI_NODE_TOTAL:Ot.CI_NODE_TOTAL,CI_PAGES_DOMAIN:Ot.CI_PAGES_DOMAIN,CI_PAGES_URL:Ot.CI_PAGES_URL,CI_PIPELINE_CREATED_AT:Ot.CI_PIPELINE_CREATED_AT,CI_PIPELINE_ID:Ot.CI_PIPELINE_ID,CI_PIPELINE_IID:Ot.CI_PIPELINE_IID,CI_PIPELINE_SOURCE:Ot.CI_PIPELINE_SOURCE,CI_PIPELINE_URL:Ot.CI_PIPELINE_URL,CI_PROJECT_CLASSIFICATION_LABEL:Ot.CI_PROJECT_CLASSIFICATION_LABEL,CI_PROJECT_DESCRIPTION:Ot.CI_PROJECT_DESCRIPTION,CI_PROJECT_ID:Ot.CI_PROJECT_ID,CI_PROJECT_NAME:Ot.CI_PROJECT_NAME,CI_PROJECT_NAMESPACE:Ot.CI_PROJECT_NAMESPACE,CI_PROJECT_NAMESPACE_ID:Ot.CI_PROJECT_NAMESPACE_ID,CI_PROJECT_PATH:Ot.CI_PROJECT_PATH,CI_PROJECT_PATH_SLUG:Ot.CI_PROJECT_PATH_SLUG,CI_PROJECT_REPOSITORY_LANGUAGES:Ot.CI_PROJECT_REPOSITORY_LANGUAGES,CI_PROJECT_ROOT_NAMESPACE:Ot.CI_PROJECT_ROOT_NAMESPACE,CI_PROJECT_TITLE:Ot.CI_PROJECT_TITLE,CI_PROJECT_URL:Ot.CI_PROJECT_URL,CI_PROJECT_VISIBILITY:Ot.CI_PROJECT_VISIBILITY,CI_REGISTRY:Ot.CI_REGISTRY,CI_REGISTRY_IMAGE:Ot.CI_REGISTRY_IMAGE,CI_REGISTRY_USER:Ot.CI_REGISTRY_USER,CI_RUNNER_DESCRIPTION:Ot.CI_RUNNER_DESCRIPTION,CI_RUNNER_ID:Ot.CI_RUNNER_ID,CI_RUNNER_TAGS:Ot.CI_RUNNER_TAGS,CI_SERVER_HOST:Ot.CI_SERVER_HOST,CI_SERVER_NAME:Ot.CI_SERVER_NAME,CI_SERVER_PORT:Ot.CI_SERVER_PORT,CI_SERVER_PROTOCOL:Ot.CI_SERVER_PROTOCOL,CI_SERVER_REVISION:Ot.CI_SERVER_REVISION,CI_SERVER_SHELL_SSH_HOST:Ot.CI_SERVER_SHELL_SSH_HOST,CI_SERVER_SHELL_SSH_PORT:Ot.CI_SERVER_SHELL_SSH_PORT,CI_SERVER_URL:Ot.CI_SERVER_URL,CI_SERVER_VERSION:Ot.CI_SERVER_VERSION,CI_SERVER_VERSION_MAJOR:Ot.CI_SERVER_VERSION_MAJOR,CI_SERVER_VERSION_MINOR:Ot.CI_SERVER_VERSION_MINOR,CI_SERVER_VERSION_PATCH:Ot.CI_SERVER_VERSION_PATCH,CI_TEMPLATE_REGISTRY_HOST:Ot.CI_TEMPLATE_REGISTRY_HOST,GITLAB_CI:Ot.GITLAB_CI,GITLAB_FEATURES:Ot.GITLAB_FEATURES,GITLAB_USER_ID:Ot.GITLAB_USER_ID,GITLAB_USER_LOGIN:Ot.GITLAB_USER_LOGIN,RUNNER_GENERATE_ARTIFACTS_METADATA:Ot.RUNNER_GENERATE_ARTIFACTS_METADATA},environment:{name:Ot.CI_RUNNER_DESCRIPTION,architecture:Ot.CI_RUNNER_EXECUTABLE_ARCH,server:Ot.CI_SERVER_URL,project:Ot.CI_PROJECT_PATH,job:{id:Ot.CI_JOB_ID},pipeline:{id:Ot.CI_PIPELINE_ID,ref:Ot.CI_CONFIG_PATH}}},metadata:{buildInvocationId:`${Ot.CI_JOB_URL}`,completeness:{parameters:!0,environment:!0,materials:!1},reproducible:!1},materials:[{uri:`git+${Ot.CI_PROJECT_URL}`,digest:{sha1:Ot.CI_COMMIT_SHA}}]}}}else throw new Zt(91,"Provenance generation is only supported in GitHub Actions and GitLab CI");return HUe.attest(Buffer.from(JSON.stringify(r)),r5t,e)};async function f5t(t,e,{access:r,tag:s,registry:a,gitHead:n,provenance:l}){let f=t.manifest.name,h=t.manifest.version,A=G.stringifyIdent(f),m=GUe.default.fromData(e,{algorithms:["sha1","sha512"]}),w=r??qUe(t,f),v=await VUe(t),D=await fA.genPackageManifest(t),I=`${A}-${h}.tgz`,R=new URL(`${ku(a)}/${A}/-/${I}`),N={[I]:{content_type:"application/octet-stream",data:e.toString("base64"),length:e.length}};if(l){let U={name:`pkg:npm/${A.replace(/^@/,"%40")}@${h}`,digest:{sha512:m.sha512[0].hexDigest()}},V=await jUe([U]),ee=JSON.stringify(V);N[`${A}-${h}.sigstore`]={content_type:V.mediaType,data:ee,length:ee.length}}return{_id:A,_attachments:N,name:A,access:w,"dist-tags":{[s]:h},versions:{[h]:{...D,_id:`${A}@${h}`,name:A,version:h,gitHead:n,dist:{shasum:m.sha1[0].hexDigest(),integrity:m.sha512[0].toString(),tarball:R.toString()}}},readme:v}}async function h5t(t){try{let{stdout:e}=await un.execvp("git",["rev-parse","--revs-only","HEAD"],{cwd:t});return e.trim()===""?void 0:e.trim()}catch{return} Line truncated
`;try{a=await fe.readFilePromise(e,"utf8")}catch(n){if(n.code==="ENOENT")return a;throw n}return a}var Aie={npmAlwaysAuth:{description:"URL of the selected npm registry (note: npm enterprise isn't supported)",type:"BOOLEAN",default:!1},npmAuthIdent:{description:"Authentication identity for the npm registry (_auth in npm and yarn v1)",type:"SECRET",default:null},npmAuthToken:{description:"Authentication token for the npm registry (_authToken in npm and yarn v1)",type:"SECRET",default:null}},WUe={npmAuditRegistry:{description:"Registry to query for audit reports",type:"STRING",default:null},npmPublishRegistry:{description:"Registry to push packages to",type:"STRING",default:null},npmRegistryServer:{description:"URL of the selected npm registry (note: npm enterprise isn't supported)",type:"STRING",default:"https://registry.yarnpkg.com"}},YUe={npmMinimalAgeGate:{description:"Minimum age of a package version according to the publish date on the npm registry to be considered for installation",type:"DURATION",unit:"m",default:"1d"}},A5t={npmPreapprovedPackages:{description:"Array of package descriptors or package name glob patterns to exclude from the minimum release age check",type:"STRING",isArray:!0,default:[]}},p5t={configuration:{...Aie,...WUe,...YUe,...A5t,npmScopes:{description:"Settings per package scope",type:"MAP",valueDefinition:{description:"",type:"SHAPE",properties:{...Aie,...WUe,...YUe}}},npmRegistries:{description:"Settings per registry",type:"MAP",normalizeKeys:ku,valueDefinition:{description:"",type:"SHAPE",properties:{...Aie}}}},fetchers:[dx,cd],resolvers:[gx,mx,yx]},d5t=p5t;var vie={};lr(vie,{NpmAuditCommand:()=>VB,NpmInfoCommand:()=>WB,NpmLoginCommand:()=>YB,NpmLogoutCommand:()=>zB,NpmPublishCommand:()=>JB,NpmStageApproveCommand:()=>ZB,NpmStageListCommand:()=>XB,NpmStageRejectCommand:()=>$B,NpmTagAddCommand:()=>tv,NpmTagListCommand:()=>ev,NpmTagRemoveCommand:()=>rv,NpmWhoamiCommand:()=>nv,default:()=>P5t,npmAuditTypes:()=>AR,npmAuditUtils:()=>D8});We();We();sr();var Eie=st(ma());ga();var AR={};lr(AR,{Environment:()=>fR,Severity:()=>hR});var fR=(s=>(s.All="all",s.Production="production",s.Development="development",s))(fR||{}),hR=(n=>(n.Info="info",n.Low="low",n.Moderate="moderate",n.High="high",n.Critical="critical",n))(hR||{});var D8={};lr(D8,{allSeverities:()=>qB,getPackages:()=>yie,getReportTree:()=>gie,getSeverityInclusions:()=>die,getTopLevelDependencies:()=>mie});We();var KUe=st(Di());var qB=["info","low","moderate","high","critical"];function die(t){if(typeof t>"u")return new Set(qB);let e=qB.indexOf(t),r=qB.slice(e);return new Set(r)}function gie(t){let e={},r={children:e};for(let[s,a]of Ye.sortMap(Object.entries(t),n=>n[0]))for(let n of Ye.sortMap(a,l=>`${l.id}`))e[`${s}/${n.id}`]={value:pe.tuple(pe.Type.IDENT,G.parseIdent(s)),children:{ID:typeof n.id<"u"&&{label:"ID",value:pe.tuple(pe.Type.ID,n.id)},Issue:{label:"Issue",value:pe.tuple(pe.Type.NO_HINT,n.title)},URL:typeof n.url<"u"&&{label:"URL",value:pe.tuple(pe.Type.URL,n.url)},Severity:{label:"Severity",value:pe.tuple(pe.Type.NO_HINT,n.severity)},"Vulnerable Versions":{label:"Vulnerable Versions",value:pe.tuple(pe.Type.RANGE,n.vulnerable_versions)},"Tree Versions":{label:"Tree Versions",children:[...n.versions].sort(KUe.default.compare).map(l=>({value:pe.tuple(pe.Type.REFERENCE,l)}))},Dependents:{label:"Dependents",children:Ye.sortMap(n.dependents,l=>G.stringifyLocator(l)).map(l=>({value:pe.tuple(pe.Type.LOCATOR,l)}))}}};return r}function mie(t,e,{all:r,environment:s}){let a=[],n=r?t.workspaces:[e],l=["all","production"].includes(s),f=["all","development"].includes(s);for(let h of n)for(let A of h.anchoredPackage.dependencies.values())(h.manifest.devDependencies.has(A.identHash)?!f:!l)||a.push({workspace:h,dependency:A});return a}function yie(t,e,{recursive:r}){let s=new Map,a=new Set,n=[],l=t.configuration.makeResolver(),f={project:t,resolver:l},h=(A,m)=>{let w=t.storedResolutions.get(m.descriptorHash);if(typeof w>"u")throw new Error("Assertion failed: The resolution should have been registered");if(!a.has(w))a.add(w);else return;let v=t.storedPackages.get(w);if(typeof v>"u")throw new Error("Assertion failed: The package should have been registered");let D=G.ensureDevirtualizedDescriptor(m);if(l.supportsDescriptor(D,f)){let R=l.getResolutionDependencies(D,f);if(Object.keys(R).length>0)for(let N of Object.values(R))h(A,N)}if(G.ensureDevirtualizedLocator(v).reference.startsWith("npm:")&&v.version!==null){let R=G.stringifyIdent(v),N=Ye.getMapWithDefault(s,R);Ye.getArrayWithDefault(N,v.version).push(A)}if(r)for(let R of v.dependencies.values())n.push([v,R])};for(let{workspace:A,dependency:m}of e)n.push([A.anchoredLocator,m]);for(;n.length>0;){let[A,m]=n.shift();h(A,m)}return s}var VB=class extends mt{constructor(){super(...arguments);this.all=ye.Boolean("-A,--all",!1,{description:"Audit dependencies from all workspaces"});this.recursive=ye.Boolean("-R,--recursive",!1,{description:"Audit transitive dependencies as well"});this.environm Line truncated
This command checks for known security reports on the packages you use. The reports are by default extracted from the npm registry, and may or may not be relevant to your actual program (not all vulnerabilities affect all code paths).
For consistency with our other commands the default is to only check the direct dependencies for the active workspace. To extend this search to all workspaces, use \`-A,--all\`. To extend this search to both direct and transitive dependencies, use \`-R,--recursive\`.
Applying the \`--severity\` flag will limit the audit table to vulnerabilities of the corresponding severity and above. Valid values are ${qB.map(r=>`\`${r}\``).join(", ")}.
If the \`--json\` flag is set, Yarn will print the output exactly as received from the registry. Regardless of this flag, the process will exit with a non-zero exit code if a report is found for the selected packages.
If certain packages produce false positives for a particular environment, the \`--exclude\` flag can be used to exclude any number of packages from the audit. This can also be set in the configuration file with the \`npmAuditExcludePackages\` option.
If particular advisories are needed to be ignored, the \`--ignore\` flag can be used with Advisory ID's to ignore any number of advisories in the audit report. This can also be set in the configuration file with the \`npmAuditIgnoreAdvisories\` option.
To understand the dependency tree requiring vulnerable packages, check the raw report with the \`--json\` flag or use \`yarn why package\` to get more information as to who depends on them.
`,examples:[["Checks for known security issues with the installed packages. The output is a list of known issues.","yarn npm audit"],["Audit dependencies in all workspaces","yarn npm audit --all"],["Limit auditing to `dependencies` (excludes `devDependencies`)","yarn npm audit --environment production"],["Show audit report as valid JSON","yarn npm audit --json"],["Audit all direct and transitive dependencies","yarn npm audit --recursive"],["Output moderate (or more severe) vulnerabilities","yarn npm audit --severity moderate"],["Exclude certain packages","yarn npm audit --exclude package1 --exclude package2"],["Ignore specific advisories","yarn npm audit --ignore 1234567 --ignore 7654321"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Yt.find(r,this.context.cwd);if(!a)throw new Dr(s.cwd,this.context.cwd);await s.restoreInstallState();let n=mie(s,a,{all:this.all,environment:this.environment}),l=yie(s,n,{recursive:this.recursive}),f=Array.from(new Set([...r.get("npmAuditExcludePackages"),...this.excludes])),h=Object.create(null);for(let[N,U]of l)f.some(V=>Eie.default.isMatch(N,V))||(h[N]=[...U.keys()]);let A=_n.getAuditRegistry({configuration:r}),m,w=await tA.start({configuration:r,stdout:this.context.stdout},async()=>{let N=Jr.post("/-/npm/v1/security/advisories/bulk",h,{authType:Jr.AuthType.BEST_EFFORT,configuration:r,jsonResponse:!0,registry:A}),U=this.noDeprecations?[]:await Promise.all(Array.from(Object.entries(h),async([ee,te])=>{let ie=await Jr.getPackageMetadata(G.parseIdent(ee),{project:s});return Ye.mapAndFilter(te,ae=>{let{deprecated:ge}=ie.versions[ae];return ge?[ee,ae,ge]:Ye.mapAndFilter.skip})})),V=await N;for(let[ee,te,ie]of U.flat(1))Object.hasOwn(V,ee)&&V[ee].some(ae=>zr.satisfiesWithPrereleases(te,ae.vulnerable_versions))||(V[ee]??=[],V[ee].push({id:`${ee} (deprecation)`,title:(typeof ie=="string"?ie:"").trim()||"This package has been deprecated.",severity:"moderate",vulnerable_versions:te}));m=V});if(w.hasErrors())return w.exitCode();let v=die(this.severity),D=Array.from(new Set([...r.get("npmAuditIgnoreAdvisories"),...this.ignores])),I=Object.create(null);for(let[N,U]of Object.entries(m)){let V=U.filter(ee=>!Eie.default.isMatch(`${ee.id}`,D)&&v.has(ee.severity));V.length>0&&(I[N]=V.map(ee=>{let te=l.get(N);if(typeof te>"u")throw new Error("Assertion failed: Expected the registry to only return packages that were requested");let ie=[...te.keys()].filter(ge=>zr.satisfiesWithPrereleases(ge,ee.vulnerable_versions)),ae=new Map;for(let ge of ie)for(let de of te.get(ge))ae.set(de.locatorHash,de);return{...ee,versions:ie,dependents:[...ae.values()]}}))}let R=Object.keys(I).length>0;return R?(bs.emitTree(gie(I),{configuration:r,json:this.json,stdout:this.context.stdout,separators:2}),1):(await Wt.start({configuration:r,includeFooter:!1,json:this.json,stdout:this.context.stdout},async N=>{N.reportInfo(1,"No audit suggestions")}),R?1:0)}};We();We();Mt();sr();var Iie=st(Di()),wie=Ae("util"),WB=class extends mt{constructor(){super(...arguments);this.fields=ye.String("-f,--fields",{description:"A comma-separated list of manifest fields that should be displayed"});this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.packages=ye.Rest()}static{this.paths=[["npm","info"]]}static{this.usage=At.Usage({category:"Npm-related commands",description:"show information about a package",details:"\n This command fetches information about a package from the npm registry and prints it in a tree format.\n\n The package does not have to be installed locally, but needs to have been published (in particular, local changes will be ignored even for workspaces).\n\n Append `@<range>` to the package argument to provide information specific to the latest version that satisfies the range or to the corresponding tagged version. If the range is invalid or if there is no version satisfying the range, the command will print a warning and fall back to the latest version.\n\n If the `-f,--fields` option is set, it's a comma-separated list of fields which will be used to only display part of the package information.\n\n By default, this command won't return the `dist`, `readme`, and `users` fields, since they are often very long. To explicitly request those fields, explicitly list them with the `--fields` flag or request the output in JSON mode.\n ",examples:[["Show all available information about react (except the `dist`, `readme`, and `users` fields)","yarn npm info react"],["Show all available information about react as valid JSON (including the `dist`, `readme`, and `users` fields)","yarn npm info react --json"],["Show all available information about react@16.12.0","yarn npm info react@16.12.0"],["Show all available information about react@next","yarn npm info react@next"],["Show the description of react","yarn npm info react --fields description"],["Show all available versions of react","yarn npm in Line truncated
`),this.context.stdout.write(`${(0,wie.inspect)(h,{depth:1/0,colors:!0,compact:!1})}
`);return f.exitCode()}};function Cie(t){if(Array.isArray(t)){let e=[];for(let r of t)r=Cie(r),r&&e.push(r);return e}else if(typeof t=="object"&&t!==null){let e={};for(let r of Object.keys(t)){if(r.startsWith("_"))continue;let s=Cie(t[r]);s&&(e[r]=s)}return e}else return t||null}We();We();sr();var Bie=st(gD()),YB=class extends mt{constructor(){super(...arguments);this.scope=ye.String("-s,--scope",{description:"Login to the registry configured for a given scope"});this.publish=ye.Boolean("--publish",!1,{description:"Login to the publish registry"});this.alwaysAuth=ye.Boolean("--always-auth",{description:"Set the npmAlwaysAuth configuration"});this.webLogin=ye.Boolean("--web-login",{description:"Enable web login"})}static{this.paths=[["npm","login"]]}static{this.usage=At.Usage({category:"Npm-related commands",description:"store new login info to access the npm registry",details:"\n This command will ask you for your username, password, and 2FA One-Time-Password (when it applies). It will then modify your local configuration (in your home folder, never in the project itself) to reference the new tokens thus generated.\n\n Adding the `-s,--scope` flag will cause the authentication to be done against whatever registry is configured for the associated scope (see also `npmScopes`).\n\n Adding the `--publish` flag will cause the authentication to be done against the registry used when publishing the package (see also `publishConfig.registry` and `npmPublishRegistry`).\n ",examples:[["Login to the default registry","yarn npm login"],["Login to the registry linked to the @my-scope registry","yarn npm login --scope my-scope"],["Login to the publish registry for the current package","yarn npm login --publish"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),s=await P8({configuration:r,cwd:this.context.cwd,publish:this.publish,scope:this.scope});return(await Wt.start({configuration:r,stdout:this.context.stdout,includeFooter:!1},async n=>{let l=await I5t({registry:s,configuration:r,report:n,webLogin:this.webLogin,stdin:this.context.stdin,stdout:this.context.stdout});return await C5t(s,l,{alwaysAuth:this.alwaysAuth,scope:this.scope}),n.reportInfo(0,"Successfully logged in")})).exitCode()}};async function P8({scope:t,publish:e,configuration:r,cwd:s}){return t&&e?_n.getScopeRegistry(t,{configuration:r,type:_n.RegistryType.PUBLISH_REGISTRY}):t?_n.getScopeRegistry(t,{configuration:r}):e?_n.getPublishRegistry((await TC(r,s)).manifest,{configuration:r}):_n.getDefaultRegistry({configuration:r})}async function g5t(t,e){let r;try{r=await Jr.post("/-/v1/login",null,{configuration:e,registry:t,authType:Jr.AuthType.NO_AUTH,jsonResponse:!0,headers:{"npm-auth-type":"web"}})}catch{return null}return r}async function m5t(t,e){let r=await Sn.request(t,null,{configuration:e,jsonResponse:!0});if(r.statusCode===202){let s=r.headers["retry-after"]??"1";return{type:"waiting",sleep:parseInt(s,10)}}return r.statusCode===200?{type:"success",token:r.body.token}:null}async function y5t({registry:t,configuration:e,report:r}){let s=await g5t(t,e);if(!s)return null;if(us.openUrl){r.reportInfo(0,"Starting the web login process..."),r.reportSeparator();let{openNow:a}=await(0,Bie.prompt)({type:"confirm",name:"openNow",message:"Do you want to try to open your browser now?",required:!0,initial:!0,onCancel:()=>process.exit(130)});r.reportSeparator(),(!a||!await us.openUrl(s.loginUrl))&&(r.reportWarning(0,"We failed to automatically open the url; you'll have to open it yourself in your browser of choice:"),r.reportWarning(0,pe.pretty(e,s.loginUrl,pe.Type.URL)),r.reportSeparator())}for(;;){let a=await m5t(s.doneUrl,e);if(a===null)return null;if(a.type==="waiting")await new Promise(n=>setTimeout(n,a.sleep*1e3));else return a.token}}var E5t=["https://registry.yarnpkg.com","https://registry.npmjs.org"];async function I5t(t){if(t.webLogin??E5t.includes(t.registry)){let e=await y5t(t);if(e!==null)return e}return await w5t(t)}async function w5t({registry:t,configuration:e,report:r,stdin:s,stdout:a}){let n=await B5t({configuration:e,registry:t,report:r,stdin:s,stdout:a}),l=`/-/user/org.couchdb.user:${encodeURIComponent(n.name)}`,f={_id:`org.couchdb.user:${n.name}`,name:n.name,password:n.password,type:"user",roles:[],date:new Date().toISOString()},h={attemptedAs:n.name,configuration:e,registry:t,jsonResponse:!0,authType:Jr.AuthType.NO_AUTH};try{return(await Jr.put(l,f,h)).token}catch(D){if(!(D.originalError?.name==="HTTPError"&&D.originalError?.response.statusCode===409))throw D}let A={...h,authType:Jr.AuthType.NO_AUTH,headers:{authorization:`Basic ${Buffer.from(`${n.name}:${n.password}`).toString("base64")}`}},m=await Jr.get(l,A);for(let[D,I]of Object.entries(m))(!f[D]||D==="roles")&&(f[D]=I);let w=`${l}/-rev/${f._rev}`;return(await Jr.put(w,f,A)).token}async function C5t(t,e,{alwaysAuth:r,scope:s}){let a=l=>f=>{let h=Ye.isIndexableObject(f)?f:{},A=h[l],m=Ye.isIndexableObject(A)?A:{};return{...h,[l]:{...m,...r!==void Line truncated
This command will list all staged package versions awaiting approval on the npm registry.
If a package name is provided, only staged versions of that package will be listed.
`,examples:[["List all staged packages","yarn npm stage list"],["List staged versions of a specific package","yarn npm stage list my-pkg"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),s=_n.getDefaultRegistry({configuration:r,type:_n.RegistryType.PUBLISH_REGISTRY}),a=await b5t(r,s,this.package??void 0);if(await Wt.start({configuration:r,stdout:this.context.stdout,json:this.json,includeFooter:!1,includePrefix:!1},async l=>{a.length>0?(l.reportInfo(0,`The following packages are awaiting approval. Use ${pe.pretty(r,"yarn npm stage approve <stageId>",pe.Type.CODE)} to approve them.`),l.reportSeparator()):this.package?l.reportInfo(0,`No staged versions found for package ${this.package}`):l.reportInfo(0,"No staged packages found")}),a.length===0)return;let n={children:a.map(l=>{let f=G.parseIdent(l.packageName);return{value:pe.tuple(pe.Type.RESOLUTION,{descriptor:G.makeDescriptor(f,l.tag),locator:G.makeLocator(f,l.version)}),children:{ID:{label:"ID",value:pe.tuple(pe.Type.CODE,l.id)},Staged:{label:"Staged on",value:pe.tuple(pe.Type.NO_HINT,l.createdAt)}}}})};bs.emitTree(n,{configuration:r,json:this.json,stdout:this.context.stdout,separators:1})}};async function b5t(t,e,r){let s=[],a=0,n=100;for(;;){let l={page:String(a),perPage:String(n)};r&&(l.package=r);let f=new URLSearchParams(l).toString(),h=await Jr.get(`/-/stage?${f}`,{configuration:t,registry:e,jsonResponse:!0,authType:Jr.AuthType.ALWAYS_AUTH});if(s.push(...h.items),s.length>=h.total||h.items.length<n)break;a++}return s}We();sr();ga();var $B=class extends mt{constructor(){super(...arguments);this.stageId=ye.String({validator:P0(_h(),[xp(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)])});this.otp=ye.String("--otp",{description:"The OTP token to use with the command"})}static{this.paths=[["npm","stage","reject"]]}static{this.usage=At.Usage({category:"Npm-related commands",description:"reject a staged package version",details:"\n This command will reject a staged package version, permanently removing it from the registry staging area. This operation requires 2FA and will prompt for an OTP token if one is not provided via the `--otp` flag.\n ",examples:[["Reject a staged package","yarn npm stage reject 1de6f3db-2ed9-4d72-b3dd-8f0e2b474a2f"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),s=_n.getDefaultRegistry({configuration:r,type:_n.RegistryType.PUBLISH_REGISTRY});return(await Wt.start({configuration:r,stdout:this.context.stdout},async n=>{let l=pe.pretty(r,this.stageId,pe.Type.CODE);n.reportInfo(0,`Rejecting staged package ${pe.pretty(r,l,pe.Type.CODE)}...`),n.reportSeparator(),await Jr.del(`/-/stage/${this.stageId}`,{configuration:r,registry:s,otp:this.otp,authType:Jr.AuthType.ALWAYS_AUTH}),n.reportInfo(0,`Staged package ${pe.pretty(r,l,pe.Type.CODE)} has been rejected.`)})).exitCode()}};We();sr();var JUe=st(Di());We();Mt();sr();var ev=class extends mt{constructor(){super(...arguments);this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.package=ye.String({required:!1})}static{this.paths=[["npm","tag","list"]]}static{this.usage=At.Usage({category:"Npm-related commands",description:"list all dist-tags of a package",details:`
This command will list all tags of a package from the npm registry.
If the package is not specified, Yarn will default to the current workspace.
`,examples:[["List all tags of package `my-pkg`","yarn npm tag list my-pkg"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Yt.find(r,this.context.cwd),n;if(typeof this.package<"u")n=G.parseIdent(this.package);else{if(!a)throw new Dr(s.cwd,this.context.cwd);if(!a.manifest.name)throw new ht(`Missing 'name' field in ${me.fromPortablePath(Y.join(a.cwd,Or.manifest))}`);n=a.manifest.name}let l=await pR(n,r),h={children:Ye.sortMap(Object.entries(l),([A])=>A).map(([A,m])=>({value:pe.tuple(pe.Type.RESOLUTION,{descriptor:G.makeDescriptor(n,A),locator:G.makeLocator(n,m)})}))};return bs.emitTree(h,{configuration:r,json:this.json,stdout:this.context.stdout})}};async function pR(t,e){let r=`/-/package${Jr.getIdentUrl(t)}/dist-tags`;return Jr.get(r,{configuration:e,ident:t,jsonResponse:!0,customErrorMessage:Jr.customPackageError})}var tv=class extends mt{constructor(){super(...arguments);this.package=ye.String();this.tag=ye.String()}static{this.paths=[["npm","tag","add"]]}static{this.usage=At.Usage({category:"Npm-related commands",description:"add a tag for a specific version of a package",details:`
This command will add a tag to the npm registry for a specific version of a package. If the tag already exists, it will be overwritten.
`,examples:[["Add a `beta` tag for version `2.3.4-beta.4` of package `my-pkg`","yarn npm tag add my-pkg@2.3.4-beta.4 beta"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Yt.find(r,this.context.cwd);if(!a)throw new Dr(s.cwd,this.context.cwd);let n=G.parseDescriptor(this.package,!0),l=n.range;if(!JUe.default.valid(l))throw new ht(`The range ${pe.pretty(r,n.range,pe.Type.RANGE)} must be a valid semver version`);let f=_n.getPublishRegistry(a.manifest,{configuration:r}),h=pe.pretty(r,n,pe.Type.IDENT),A=pe.pretty(r,l,pe.Type.RANGE),m=pe.pretty(r,this.tag,pe.Type.CODE);return(await Wt.start({configuration:r,stdout:this.context.stdout},async v=>{let D=await pR(n,r);Object.hasOwn(D,this.tag)&&D[this.tag]===l&&v.reportWarning(0,`Tag ${m} is already set to version ${A}`);let I=`/-/package${Jr.getIdentUrl(n)}/dist-tags/${encodeURIComponent(this.tag)}`;await Jr.put(I,l,{configuration:r,registry:f,ident:n,jsonRequest:!0,jsonResponse:!0}),v.reportInfo(0,`Tag ${m} added to version ${A} of package ${h}`)})).exitCode()}};We();sr();var rv=class extends mt{constructor(){super(...arguments);this.package=ye.String();this.tag=ye.String()}static{this.paths=[["npm","tag","remove"]]}static{this.usage=At.Usage({category:"Npm-related commands",description:"remove a tag from a package",details:`
This command will remove a tag from a package from the npm registry.
`,examples:[["Remove the `beta` tag from package `my-pkg`","yarn npm tag remove my-pkg beta"]]})}async execute(){if(this.tag==="latest")throw new ht("The 'latest' tag cannot be removed.");let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Yt.find(r,this.context.cwd);if(!a)throw new Dr(s.cwd,this.context.cwd);let n=G.parseIdent(this.package),l=_n.getPublishRegistry(a.manifest,{configuration:r}),f=pe.pretty(r,this.tag,pe.Type.CODE),h=pe.pretty(r,n,pe.Type.IDENT),A=await pR(n,r);if(!Object.hasOwn(A,this.tag))throw new ht(`${f} is not a tag of package ${h}`);return(await Wt.start({configuration:r,stdout:this.context.stdout},async w=>{let v=`/-/package${Jr.getIdentUrl(n)}/dist-tags/${encodeURIComponent(this.tag)}`;await Jr.del(v,{configuration:r,registry:l,ident:n,jsonResponse:!0}),w.reportInfo(0,`Tag ${f} removed from package ${h}`)})).exitCode()}};We();We();sr();var nv=class extends mt{constructor(){super(...arguments);this.scope=ye.String("-s,--scope",{description:"Print username for the registry configured for a given scope"});this.publish=ye.Boolean("--publish",!1,{description:"Print username for the publish registry"})}static{this.paths=[["npm","whoami"]]}static{this.usage=At.Usage({category:"Npm-related commands",description:"display the name of the authenticated user",details:"\n Print the username associated with the current authentication settings to the standard output.\n\n When using `-s,--scope`, the username printed will be the one that matches the authentication settings of the registry associated with the given scope (those settings can be overriden using the `npmRegistries` map, and the registry associated with the scope is configured via the `npmScopes` map).\n\n When using `--publish`, the registry we'll select will by default be the one used when publishing packages (`publishConfig.registry` or `npmPublishRegistry` if available, otherwise we'll fallback to the regular `npmRegistryServer`).\n ",examples:[["Print username for the default registry","yarn npm whoami"],["Print username for the registry on a given scope","yarn npm whoami --scope company"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),s;return this.scope&&this.publish?s=_n.getScopeRegistry(this.scope,{configuration:r,type:_n.RegistryType.PUBLISH_REGISTRY}):this.scope?s=_n.getScopeRegistry(this.scope,{configuration:r}):this.publish?s=_n.getPublishRegistry((await TC(r,this.context.cwd)).manifest,{configuration:r}):s=_n.getDefaultRegistry({configuration:r}),(await Wt.start({configuration:r,stdout:this.context.stdout},async n=>{let l;try{l=await Jr.get("/-/whoami",{configuration:r,registry:s,authType:Jr.AuthType.ALWAYS_AUTH,jsonResponse:!0,ident:this.scope?G.makeIdent(this.scope,""):void 0})}catch(f){if(f.response?.statusCode===401||f.response?.statusCode===403){n.reportError(41,"Authentication failed - your credentials may have expired");return}else throw f}n.reportInfo(0,l.username)})).exitCode()}};var D5t={configuration:{npmPublishAccess:{description:"Default access of the published packages",type:"STRING",default:null},npmPublishProvenance:{description:"Whether to generate provenance for the published packages",type:"BOOLEAN",default:!1},npmAuditExcludePackages:{description:"Array of glob patterns of packages to exclude from npm audit",type:"STRING",default:[],isArray:!0},npmAuditIgnoreAdvisories:{description:"Array of glob patterns of advisory IDs to exclude from npm audit",type:"STRING",default:[],isArray:!0}},commands:[VB,WB,YB,zB,JB,ZB,XB,$B,tv,ev,rv,nv]},P5t=D5t;var Rie={};lr(Rie,{PatchCommand:()=>lv,PatchCommitCommand:()=>cv,PatchFetcher:()=>ER,PatchResolver:()=>IR,default:()=>Y5t,patchUtils:()=>dI});We();We();Mt();Kh();var dI={};lr(dI,{applyPatchFile:()=>k8,diffFolders:()=>xie,ensureUnpatchedDescriptor:()=>Sie,ensureUnpatchedLocator:()=>T8,extractPackageToDisk:()=>Pie,extractPatchFlags:()=>n8e,isParentRequired:()=>Die,isPatchDescriptor:()=>R8,isPatchLocator:()=>dm,loadPatchFiles:()=>yR,makeDescriptor:()=>Q8,makeLocator:()=>bie,makePatchHash:()=>kie,parseDescriptor:()=>gR,parseLocator:()=>mR,parsePatchFile:()=>dR,unpatchDescriptor:()=>G5t,unpatchLocator:()=>q5t});We();Mt();We();Mt();var x5t=/^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@.*/;function iv(t){return Y.relative(Rt.root,Y.resolve(Rt.root,me.toPortablePath(t)))}function k5t(t){let e=t.trim().match(x5t);if(!e)throw new Error(`Bad header line: '${t}'`);return{original:{start:Math.max(Number(e[1]),1),length:Number(e[3]||1)},patched:{start:Math.max(Number(e[4]),1),length:Number(e[6]||1)}}}var R5t=420,T5t=493;var ZUe=()=>({semverExclusivity:null,diffLineFromPath:null,diffLineToPath:null,oldMode:null,newMode:null,deletedFileMode:null,newFileMode:null,renameFrom:null,renameTo:null,beforeHash:null,afterHash:null,fromPath:null,toPath:null,hunks:null}),Q5t=t=>({header:k5t(t),parts:[]}),F5t={"@":"header","-":"deletion","+":"insertion"," ":"context","\\":"pragma",undefined:"context"};function NLine truncated
`)+(a.hunk.parts[0].noNewlineAtEndOfFile?"":`
`):"";await e.mkdirpPromise(Y.dirname(a.path),{chmod:493,utimes:[Oi.SAFE_TIME,Oi.SAFE_TIME]}),await e.writeFilePromise(a.path,n,{mode:a.mode}),await e.utimesPromise(a.path,Oi.SAFE_TIME,Oi.SAFE_TIME)}break;case"patch":await ov(e,a.path,async()=>{await U5t(a,{baseFs:e,dryRun:r})});break;case"mode change":{let l=(await e.statPromise(a.path)).mode;if(XUe(a.newMode)!==XUe(l))continue;await ov(e,a.path,async()=>{await e.chmodPromise(a.path,a.newMode)})}break;default:Ye.assertNever(a);break}}function XUe(t){return(t&64)>0}function $Ue(t){return t.replace(/\s+$/,"")}function M5t(t,e){return $Ue(t)===$Ue(e)}async function U5t({hunks:t,path:e},{baseFs:r,dryRun:s=!1}){let a=await r.statSync(e).mode,l=(await r.readFileSync(e,"utf8")).split(/\n/),f=[],h=0,A=0;for(let w of t){let v=Math.max(A,w.header.patched.start+h),D=Math.max(0,v-A),I=Math.max(0,l.length-v-w.header.original.length),R=Math.max(D,I),N=0,U=0,V=null;for(;N<=R;){if(N<=D&&(U=v-N,V=e8e(w,l,U),V!==null)){N=-N;break}if(N<=I&&(U=v+N,V=e8e(w,l,U),V!==null))break;N+=1}if(V===null)throw new sv(t.indexOf(w),w);f.push(V),h+=N,A=U+w.header.original.length}if(s)return;let m=0;for(let w of f)for(let v of w)switch(v.type){case"splice":{let D=v.index+m;l.splice(D,v.numToDelete,...v.linesToInsert),m+=v.linesToInsert.length-v.numToDelete}break;case"pop":l.pop();break;case"push":l.push(v.line);break;default:Ye.assertNever(v);break}await r.writeFilePromise(e,l.join(`
`),{mode:a})}function e8e(t,e,r){let s=[];for(let a of t.parts)switch(a.type){case"context":case"deletion":{for(let n of a.lines){let l=e[r];if(l==null||!M5t(l,n))return null;r+=1}a.type==="deletion"&&(s.push({type:"splice",index:r-a.lines.length,numToDelete:a.lines.length,linesToInsert:[]}),a.noNewlineAtEndOfFile&&s.push({type:"push",line:""}))}break;case"insertion":s.push({type:"splice",index:r,numToDelete:0,linesToInsert:a.lines}),a.noNewlineAtEndOfFile&&s.push({type:"pop"});break;default:Ye.assertNever(a.type);break}return s}var j5t=/^builtin<([^>]+)>$/;function av(t,e){let{protocol:r,source:s,selector:a,params:n}=G.parseRange(t);if(r!=="patch:")throw new Error("Invalid patch range");if(s===null)throw new Error("Patch locators must explicitly define their source");let l=a?a.split(/&/).map(m=>me.toPortablePath(m)):[],f=n&&typeof n.locator=="string"?G.parseLocator(n.locator):null,h=n&&typeof n.version=="string"?n.version:null,A=e(s);return{parentLocator:f,sourceItem:A,patchPaths:l,sourceVersion:h}}function R8(t){return t.range.startsWith("patch:")}function dm(t){return t.reference.startsWith("patch:")}function gR(t){let{sourceItem:e,...r}=av(t.range,G.parseDescriptor);return{...r,sourceDescriptor:e}}function mR(t){let{sourceItem:e,...r}=av(t.reference,G.parseLocator);return{...r,sourceLocator:e}}function G5t(t){let{sourceItem:e}=av(t.range,G.parseDescriptor);return e}function q5t(t){let{sourceItem:e}=av(t.reference,G.parseLocator);return e}function Sie(t){if(!R8(t))return t;let{sourceItem:e}=av(t.range,G.parseDescriptor);return e}function T8(t){if(!dm(t))return t;let{sourceItem:e}=av(t.reference,G.parseLocator);return e}function t8e({parentLocator:t,sourceItem:e,patchPaths:r,sourceVersion:s,patchHash:a},n){let l=t!==null?{locator:G.stringifyLocator(t)}:{},f=typeof s<"u"?{version:s}:{},h=typeof a<"u"?{hash:a}:{};return G.makeRange({protocol:"patch:",source:n(e),selector:r.join("&"),params:{...f,...h,...l}})}function Q8(t,{parentLocator:e,sourceDescriptor:r,patchPaths:s}){return G.makeDescriptor(t,t8e({parentLocator:e,sourceItem:r,patchPaths:s},G.stringifyDescriptor))}function bie(t,{parentLocator:e,sourcePackage:r,patchPaths:s,patchHash:a}){return G.makeLocator(t,t8e({parentLocator:e,sourceItem:r,sourceVersion:r.version,patchPaths:s,patchHash:a},G.stringifyLocator))}function r8e({onAbsolute:t,onRelative:e,onProject:r,onBuiltin:s},a){let n=a.lastIndexOf("!");n!==-1&&(a=a.slice(n+1));let l=a.match(j5t);return l!==null?s(l[1]):a.startsWith("~/")?r(a.slice(2)):Y.isAbsolute(a)?t(a):e(a)}function n8e(t){let e=t.lastIndexOf("!");return{optional:(e!==-1?new Set(t.slice(0,e).split(/!/)):new Set).has("optional")}}function Die(t){return r8e({onAbsolute:()=>!1,onRelative:()=>!0,onProject:()=>!1,onBuiltin:()=>!1},t)}async function yR(t,e,r){let s=t!==null?await r.fetcher.fetch(t,r):null,a=s&&s.localPath?{packageFs:new Jn(Rt.root),prefixPath:Y.relative(Rt.root,s.localPath)}:s;s&&s!==a&&s.releaseFs&&s.releaseFs();let n=await Ye.releaseAfterUseAsync(async()=>await Promise.all(e.map(async l=>{let f=n8e(l),h=await r8e({onAbsolute:async A=>await fe.readFilePromise(A,"utf8"),onRelative:async A=>{if(a===null)throw new Error("Assertion failed: The parent locator should have been fetched");return await a.packageFs.readFilePromise(Y.join(a.prefixPath,A),"utf8")},onProject:async A=>await fe.readFilePromise(Y.join(r.project.cwd,A),"utf8"),onBuiltin:async A=>await r.project.configuration.firstHook(m=>m.getBuiltinPatch,r.project,A)},l);return{...f,source:h}})));for(let l of n)typeof l.source=="string"&&(l.source=l.source.replace(/\r\n?/g,`
`));return n}async function Pie(t,{cache:e,project:r}){let s=r.storedPackages.get(t.locatorHash);if(typeof s>"u")throw new Error("Assertion failed: Expected the package to be registered");let a=T8(t),n=r.storedChecksums,l=new rs,f=await fe.mktempPromise(),h=Y.join(f,"source"),A=Y.join(f,"user"),m=Y.join(f,".yarn-patch.json"),w=r.configuration.makeFetcher(),v=[];try{let D,I;if(t.locatorHash===a.locatorHash){let R=await w.fetch(t,{cache:e,project:r,fetcher:w,checksums:n,report:l});v.push(()=>R.releaseFs?.()),D=R,I=R}else D=await w.fetch(t,{cache:e,project:r,fetcher:w,checksums:n,report:l}),v.push(()=>D.releaseFs?.()),I=await w.fetch(t,{cache:e,project:r,fetcher:w,checksums:n,report:l}),v.push(()=>I.releaseFs?.());await Promise.all([fe.copyPromise(h,D.prefixPath,{baseFs:D.packageFs}),fe.copyPromise(A,I.prefixPath,{baseFs:I.packageFs}),fe.writeJsonPromise(m,{locator:G.stringifyLocator(t),version:s.version})])}finally{for(let D of v)D()}return fe.detachTemp(f),A}async function xie(t,e){let r=me.fromPortablePath(t).replace(/\\/g,"/"),s=me.fromPortablePath(e).replace(/\\/g,"/"),{stdout:a,stderr:n}=await un.execvp("git",["-c","core.safecrlf=false","-c","core.quotePath=false","diff","--src-prefix=a/","--dst-prefix=b/","--ignore-cr-at-eol","--full-index","--no-index","--no-renames","--text",r,s],{cwd:me.toPortablePath(process.cwd()),env:{...process.env,GIT_CONFIG_NOSYSTEM:"1",HOME:"",XDG_CONFIG_HOME:"",USERPROFILE:""}});if(n.length>0)throw new Error(`Unable to diff directories. Make sure you have a recent version of 'git' available in PATH.
The following error was reported by 'git':
${n}`);let l=r.startsWith("/")?f=>f.slice(1):f=>f;return a.replace(new RegExp(`(a|b)(${Ye.escapeRegExp(`/${l(r)}/`)})`,"g"),"$1/").replace(new RegExp(`(a|b)${Ye.escapeRegExp(`/${l(s)}/`)}`,"g"),"$1/").replace(new RegExp(Ye.escapeRegExp(`${r}/`),"g"),"").replace(new RegExp(Ye.escapeRegExp(`${s}/`),"g"),"")}function kie(t,e){let r=[];for(let{source:s}of t){if(s===null)continue;let a=dR(s);for(let n of a){let{semverExclusivity:l,...f}=n;l!==null&&e!==null&&!zr.satisfiesWithPrereleases(e,l)||r.push(JSON.stringify(f))}}return si.makeHash(`${3}`,...r).slice(0,6)}We();function i8e(t,{configuration:e,report:r}){for(let s of t.parts)for(let a of s.lines)switch(s.type){case"context":r.reportInfo(null,` ${pe.pretty(e,a,"grey")}`);break;case"deletion":r.reportError(28,`- ${pe.pretty(e,a,pe.Type.REMOVED)}`);break;case"insertion":r.reportError(28,`+ ${pe.pretty(e,a,pe.Type.ADDED)}`);break;default:Ye.assertNever(s.type)}}function V5t(t){return t instanceof Error&&"code"in t&&t.code==="ENOENT"}var ER=class{supports(e,r){return!!dm(e)}getLocalPath(e,r){return null}async fetch(e,r){let s=r.checksums.get(e.locatorHash)||null,[a,n,l]=await r.cache.fetchPackageFromCache(e,s,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${G.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.patchPackage(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:G.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:l}}async patchPackage(e,r){let{parentLocator:s,sourceLocator:a,sourceVersion:n,patchPaths:l}=mR(e),f=await yR(s,l,r),h=await fe.mktempPromise(),A=Y.join(h,"current.zip"),m=await r.fetcher.fetch(a,r),w=G.getIdentVendorPath(e),v=new _s(A,{create:!0,level:r.project.configuration.get("compressionLevel")});await Ye.releaseAfterUseAsync(async()=>{await v.copyPromise(w,m.prefixPath,{baseFs:m.packageFs,stableSort:!0})},m.releaseFs),v.saveAndClose();for(let{source:D,optional:I}of f){if(D===null)continue;let R=new _s(A,{level:r.project.configuration.get("compressionLevel")}),N=new Jn(Y.resolve(Rt.root,w),{baseFs:R});try{await k8(dR(D),{baseFs:N,version:n})}catch(U){let V=U instanceof sv?U:null;if(!(V!==null||I&&V5t(U)))throw U;let te=r.project.configuration.get("enableInlineHunks"),ie=V!==null&&!te&&!I?" (set enableInlineHunks for details)":"",ae=`${G.prettyLocator(r.project.configuration,e)}: ${U.message}${ie}`,ge=de=>{V===null||!te||i8e(V.hunk,{configuration:r.project.configuration,report:de})};if(R.discardAndClose(),I){r.report.reportWarningOnce(66,ae,{reportExtra:ge});continue}else throw new Zt(66,ae,ge)}R.saveAndClose()}return new _s(A,{level:r.project.configuration.get("compressionLevel")})}};We();var IR=class{supportsDescriptor(e,r){return!!R8(e)}supportsLocator(e,r){return!!dm(e)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,s){let{patchPaths:a}=gR(e);return a.every(n=>!Die(n))?e:G.bindDescriptor(e,{locator:G.stringifyLocator(r)})}getResolutionDependencies(e,r){let{sourceDescriptor:s}=gR(e);return{sourceDescriptor:r.project.configuration.normalizeDependency(s)}}async getCandidates(e,r,s){if(!s.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{parentLocator:a,patchPaths:n}=gR(e),l=await yR(a,n,s.fetchOptions),f=r.sourceDescriptor;if(typeof f>"u")throw new Error("Assertion failed: The dependency should have been resolved");let h=kie(l,f.version);return[bie(e,{parentLocator:a,sourcePackage:f,patchPaths:n,patchHash:h})]}async getSatisfying(e,r,s,a){let[n]=await this.getCandidates(e,r,a);return{locators:s.filter(l=>l.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){let{sourceLocator:s}=mR(e);return{...await r.resolver.resolve(s,r),...e}}};We();Mt();sr();var cv=class extends mt{constructor(){super(...arguments);this.save=ye.Boolean("-s,--save",!1,{description:"Add the patch to your resolution entries"});this.patchFolder=ye.String()}static{this.paths=[["patch-commit"]]}static{this.usage=At.Usage({description:"generate a patch out of a directory",details:"\n By default, this will print a patchfile on stdout based on the diff between the folder passed in and the original version of the package. Such file is suitable for consumption with the `patch:` protocol.\n\n With the `-s,--save` option set, the patchfile won't be printed on stdout anymore and will instead be stored within a local file (by default kept within `.yarn/patches`, but configurable via the `patchFolder` setting). A `resolutions` entry will also be added to your top-level manifest, referencing the patched package via the `patch:` protocol.\n\n Note that only folders generated by `yarn patch` are accepted as valid input for `yarn patch-commit`.\n "})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s,workspace:a}=await Yt.find(r,this.context.cwd);if(!a)throw new Dr(s.cwd,this.context.cwd);await s.restoreInstallState();let n=Y.Line truncated
${f.map(h=>`
- ${G.prettyLocator(r,h)}`).join("")}`);l=f[0]}if(!s.storedPackages.has(l.locatorHash))throw new ht("No package found in the project for the given locator");await Wt.start({configuration:r,json:this.json,stdout:this.context.stdout},async f=>{let h=T8(l),A=await Pie(l,{cache:n,project:s});f.reportJson({locator:G.stringifyLocator(h),path:me.fromPortablePath(A)});let m=this.update?" along with its current modifications":"";f.reportInfo(0,`Package ${G.prettyLocator(r,h)} got extracted with success${m}!`),f.reportInfo(0,`You can now edit the following folder: ${pe.pretty(r,me.fromPortablePath(A),"magenta")}`),f.reportInfo(0,`Once you are done run ${pe.pretty(r,`yarn patch-commit -s ${process.platform==="win32"?'"':""}${me.fromPortablePath(A)}${process.platform==="win32"?'"':""}`,"cyan")} and Yarn will store a patchfile based on your changes.`)})}};var W5t={configuration:{enableInlineHunks:{description:"If true, the installs will print unmatched patch hunks",type:"BOOLEAN",default:!1},patchFolder:{description:"Folder where the patch files must be written",type:"ABSOLUTE_PATH",default:"./.yarn/patches"}},commands:[cv,lv],fetchers:[ER],resolvers:[IR]},Y5t=W5t;var Fie={};lr(Fie,{PnpmLinker:()=>CR,default:()=>ejt});We();Mt();sr();var s8e=".package-map.json",CR=class{getCustomDataKey(){return JSON.stringify({name:"PnpmLinker",version:3})}supportsPackage(e,r){return this.isEnabled(r)}async findPackageLocation(e,r){if(!this.isEnabled(r))throw new Error("Assertion failed: Expected the pnpm linker to be enabled");let s=this.getCustomDataKey(),a=r.project.linkersCustomData.get(s);if(!a)throw new ht(`The project in ${pe.pretty(r.project.configuration,`${r.project.cwd}/package.json`,pe.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let n=a.pathsByLocator.get(e.locatorHash);if(typeof n>"u")throw new ht(`Couldn't find ${G.prettyLocator(r.project.configuration,e)} in the currently installed pnpm map - running an install might help`);return n.packageLocation}async findPackageLocator(e,r){if(!this.isEnabled(r))return null;let s=this.getCustomDataKey(),a=r.project.linkersCustomData.get(s);if(!a)throw new ht(`The project in ${pe.pretty(r.project.configuration,`${r.project.cwd}/package.json`,pe.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let n=e.match(/(^.*\/node_modules\/(@[^/]*\/)?[^/]+)(\/.*$)/);if(n){let h=a.locatorByPath.get(n[1]);if(h)return h}let l=e,f=e;do{f=l,l=Y.dirname(f);let h=a.locatorByPath.get(f);if(h)return h}while(l!==f);return null}makeInstaller(e){return new Tie(e)}isEnabled(e){return e.project.configuration.get("nodeLinker")==="pnpm"}},Tie=class{constructor(e){this.opts=e;this.customData={pathsByLocator:new Map,locatorByPath:new Map};this.packageMapNodesByLocator=new Map;this.asyncActions=new Ye.AsyncActions(e.project.configuration.get("pnpmInstallConcurrency")),this.indexFolderPromise=gT(fe,{indexPath:Y.join(e.project.configuration.get("globalFolder"),"index")})}attachCustomData(e){}registerPackageMapNode(e,{packageLocation:r}){let s=l8e(r);this.packageMapNodesByLocator.has(e)||this.packageMapNodesByLocator.set(e,{packageLocation:s,dependencies:new Map})}registerPackageMapDependency(e,r,s){if(!this.packageMapNodesByLocator.has(s.locatorHash))throw new Error(`Assertion failed: Expected the package to have been registered (${G.stringifyLocator(s)})`);e.dependencies.set(r,s.locatorHash)}async installPackage(e,r,s){switch(e.linkType){case"SOFT":return this.installPackageSoft(e,r,s);case"HARD":return this.installPackageHard(e,r,s)}throw new Error("Assertion failed: Unsupported package link type")}async installPackageSoft(e,r,s){let a=Y.resolve(r.packageFs.getRealPath(),r.prefixPath),n=this.opts.project.tryWorkspaceByLocator(e)?Y.join(a,Or.nodeModules):null,l={packageLocation:a,dependenciesLocation:n};return this.customData.pathsByLocator.set(e.locatorHash,l),this.registerPackageMapNode(e.locatorHash,l),{packageLocation:a,buildRequest:null}}async installPackageHard(e,r,s){let a=K5t(e,{project:this.opts.project}),n=a.packageLocation;this.customData.locatorByPath.set(n,G.stringifyLocator(e)),this.customData.pathsByLocator.set(e.locatorHash,a),this.registerPackageMapNode(e.locatorHash,a),s.holdFetchResult(this.asyncActions.set(e.locatorHash,async()=>{await fe.mkdirPromise(n,{recursive:!0}),await fe.copyPromise(n,r.prefixPath,{baseFs:r.packageFs,overwrite:!1,linkStrategy:{type:"HardlinkFromIndex",indexPath:await this.indexFolderPromise,autoRepair:!0}})}));let f=G.isVirtualLocator(e)?G.devirtualizeLocator(e):e,h={manifest:await nr.tryFind(r.prefixPath,{baseFs:r.packageFs})??new nr,misc:{hasBindingGyp:cA.hasBindingGyp(r)}},A=this.opts.project.getDependencyMeta(f,e.version),m=cA.extractBuildRequest(e,h,A,{configuration:this.opts.project.configuration});return{packageLocation:n,buildRequest:m}}async attachInternalDependencies(e,r){if(this.opts.project.configuration.get("nodeLinker")!=="pnpm"||!a8e(e,{project:this.opts.project}))return;let s=Line truncated
${rjt}
`,"--",...s],{cwd:t,strict:!0})},async makeReset(t,e){let r=e.map(s=>me.fromPortablePath(s.path));await un.execvp("git",["reset","HEAD","--",...r],{cwd:t,strict:!0})}};var ajt=[h8e],uv=class extends mt{constructor(){super(...arguments);this.commit=ye.Boolean("-c,--commit",!1,{description:"Commit the staged files"});this.reset=ye.Boolean("-r,--reset",!1,{description:"Remove all files from the staging area"});this.dryRun=ye.Boolean("-n,--dry-run",!1,{description:"Print the commit message and the list of modified files without staging / committing"});this.update=ye.Boolean("-u,--update",!1,{hidden:!0})}static{this.paths=[["stage"]]}static{this.usage=At.Usage({description:"add all yarn files to your vcs",details:"\n This command will add to your staging area the files belonging to Yarn (typically any modified `package.json` and `.yarnrc.yml` files, but also linker-generated files, cache data, etc). It will take your ignore list into account, so the cache files won't be added if the cache is ignored in a `.gitignore` file (assuming you use Git).\n\n Running `--reset` will instead remove them from the staging area (the changes will still be there, but won't be committed until you stage them back).\n\n Since the staging area is a non-existent concept in Mercurial, Yarn will always create a new commit when running this command on Mercurial repositories. You can get this behavior when using Git by using the `--commit` flag which will directly create a commit.\n ",examples:[["Adds all modified project files to the staging area","yarn stage"],["Creates a new commit containing all modified project files","yarn stage --commit"]]})}async execute(){let r=await $e.find(this.context.cwd,this.context.plugins),{project:s}=await Yt.find(r,this.context.cwd),{driver:a,root:n}=await cjt(s.cwd),l=[r.get("cacheFolder"),r.get("globalFolder"),r.get("virtualFolder"),r.get("yarnPath")];await r.triggerHook(w=>w.populateYarnPaths,s,w=>{l.push(w)});let f=new Set;for(let w of l)for(let v of ljt(n,w))f.add(v);let h=new Set([r.get("rcFilename"),Or.lockfile,Or.manifest]),A=await a.filterChanges(n,f,h),m=await a.genCommitMessage(n,A);if(this.dryRun)if(this.commit)this.context.stdout.write(`${m}
`);else for(let w of A)this.context.stdout.write(`${me.fromPortablePath(w.path)}
`);else if(this.reset){let w=await a.filterChanges(n,f,h,{staged:!0});w.length===0?this.context.stdout.write("No staged changes found!"):await a.makeReset(n,w)}else A.length===0?this.context.stdout.write("No changes found!"):this.commit?await a.makeCommit(n,A,m):(await a.makeStage(n,A),this.context.stdout.write(m))}};async function cjt(t){let e=null,r=null;for(let s of ajt)if((r=await s.findRoot(t))!==null){e=s;break}if(e===null||r===null)throw new ht("No stage driver has been found for your current project");return{driver:e,root:r}}function ljt(t,e){let r=[];if(e===null)return r;for(;;){(e===t||e.startsWith(`${t}/`))&&r.push(e);let s;try{s=fe.statSync(e)}catch{break}if(s.isSymbolicLink())e=Y.resolve(Y.dirname(e),fe.readlinkSync(e));else break}return r}var ujt={commands:[uv]},fjt=ujt;var jie={};lr(jie,{default:()=>Ejt});We();We();Mt();var d8e=st(Di());We();var A8e=st(iK()),hjt="e8e1bd300d860104bb8c58453ffa1eb4",Ajt="OFCNCOG2CU",p8e=async(t,e)=>{let r=G.stringifyIdent(t),a=pjt(e).initIndex("npm-search");try{return(await a.getObject(r,{attributesToRetrieve:["types"]})).types?.ts==="definitely-typed"}catch{return!1}},pjt=t=>(0,A8e.default)(Ajt,hjt,{requester:{async send(r){try{let s=await Sn.request(r.url,r.data||null,{configuration:t,headers:r.headers});return{content:s.body,isTimedOut:!1,status:s.statusCode}}catch(s){return{content:s.response.body,isTimedOut:!1,status:s.response.statusCode}}}}});var g8e=t=>t.scope?`${t.scope}__${t.name}`:`${t.name}`,djt=async(t,e,r,s)=>{if(r.scope==="types")return;let{project:a}=t,{configuration:n}=a;if(!(n.get("tsEnableAutoTypes")??(fe.existsSync(Y.join(t.cwd,"tsconfig.json"))||fe.existsSync(Y.join(a.cwd,"tsconfig.json")))))return;let f=n.makeResolver(),h={project:a,resolver:f,report:new rs};if(!await p8e(r,n))return;let m=g8e(r),w=G.parseRange(r.range).selector;if(!zr.validRange(w)){let N=n.normalizeDependency(r),U=await f.getCandidates(N,{},h);w=G.parseRange(U[0].reference).selector}let v=d8e.default.coerce(w);if(v===null)return;let D=`${jf.Modifier.CARET}${v.major}`,I=G.makeDescriptor(G.makeIdent("types",m),D),R=Ye.mapAndFind(a.workspaces,N=>{let U=N.manifest.dependencies.get(r.identHash)?.descriptorHash,V=N.manifest.devDependencies.get(r.identHash)?.descriptorHash;if(U!==r.descriptorHash&&V!==r.descriptorHash)return Ye.mapAndFind.skip;let ee=[];for(let te of nr.allDependencies){let ie=N.manifest[te].get(I.identHash);typeof ie>"u"||ee.push([te,ie])}return ee.length===0?Ye.mapAndFind.skip:ee});if(typeof R<"u")for(let[N,U]of R)t.manifest[N].set(U.identHash,U);else{try{let N=n.normalizeDependency(I);if((await f.getCandidates(N,{},h)).length===0)return}catch{return}t.manifest[jf.Target.DEVELOPMENT].set(I.identHash,I)}},gjt=async(t,e,r)=>{if(r.scope==="types")return;let{project:s}=t,{configuration:a}=s;if(!(a.get("tsEnableAutoTypes")??(fe.existsSync(Y.join(t.cwd,"tsconfig.json"))||fe.existsSync(Y.join(s.cwd,"tsconfig.json")))))return;let l=g8e(r),f=G.makeIdent("types",l);for(let h of nr.allDependencies)typeof t.manifest[h].get(f.identHash)>"u"||t.manifest[h].delete(f.identHash)},mjt=(t,e)=>{e.publishConfig&&e.publishConfig.typings&&(e.typings=e.publishConfig.typings),e.publishConfig&&e.publishConfig.types&&(e.types=e.publishConfig.types)},yjt={configuration:{tsEnableAutoTypes:{description:"Whether Yarn should auto-install @types/ dependencies on 'yarn add'",type:"BOOLEAN",isNullable:!0,default:null}},hooks:{afterWorkspaceDependencyAddition:djt,afterWorkspaceDependencyRemoval:gjt,beforeWorkspacePacking:mjt}},Ejt=yjt;var Kie={};lr(Kie,{VersionApplyCommand:()=>fv,VersionCheckCommand:()=>dv,VersionCommand:()=>gv,default:()=>bjt,versionUtils:()=>vR});sr();var fv=class extends mt{constructor(){super(...arguments);this.all=ye.Boolean("--all",!1,{description:"Bump the version of all workspaces"});this.recursive=ye.Boolean("-R,--recursive",{description:"Bump the version of dependent workspaces as well"});this.exact=ye.Boolean("--exact",!1,{description:"When updating parent workspaces' dependencies, use exact versions of bumped workspaces, removing any range."});this.prerelease=ye.String("--prerelease",{description:"Specify a prerelease pattern to use when working with prerelease versions",tolerateBoolean:!0});this.dryRun=ye.Boolean("--dry-run",!1,{description:"Print version(s)/record(s) without actually bumping versions or recording deferred releases"});this.force=ye.Boolean("--force",!1,{description:"Bypass check for bumping to a lower version than the current/deferred one"});this.json=ye.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}static{this.paths=[["version","apply"]]}static{this.usage=At.Usage({category:"Release-related commands",description:"apply deferred records to workspaces",details:`
This command will apply the deferred version changes to workspaces. The applied records are removed from the project.
For more information on the options, see the \`yarn version\` command. For more information on the deferred versioning workflow, see our documentation (https://yarnpkg.com/features/release-workflow#deferred-versioning).
`,examples:[["Apply deferred records of current workspace","yarn version apply"],["Apply deferred records of all the workspaces in the local workspace","yarn version apply --all"]]})}async execute(){let r=["version","decline","--immediate"];return this.all&&r.push("--all"),this.recursive&&r.push("--recursive"),this.exact&&r.push("--exact"),this.prerelease===!0?r.push("--prerelease"):typeof this.prerelease=="string"&&r.push(`--prerelease=${this.prerelease}`),this.dryRun&&r.push("--dry-run"),this.force&&r.push("--force"),this.json&&r.push("--json"),await this.cli.run(r)}};We();Mt();sr();var Yie=st(Di());var vR={};lr(vR,{Decision:()=>Av,applyPrerelease:()=>m8e,applyReleases:()=>Wie,applyStrategy:()=>_8,clearVersionFiles:()=>qie,getUndecidedDependentWorkspaces:()=>BR,getUndecidedWorkspaces:()=>L8,openVersionFile:()=>pv,requireMoreDecisions:()=>Cjt,resolveVersionFiles:()=>Gie,suggestStrategy:()=>Bjt,updateVersionFiles:()=>Vie,validateReleaseDecision:()=>hv});We();Mt();au();sr();xl();var Oa=st(Di()),Ijt=/^(>=|[~^]|)(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$/,Av=(A=>(A.UNDECIDED="undecided",A.DECLINE="decline",A.MAJOR="major",A.MINOR="minor",A.PATCH="patch",A.PREMAJOR="premajor",A.PREMINOR="preminor",A.PREPATCH="prepatch",A.PRERELEASE="prerelease",A))(Av||{});function hv(t){let e=Oa.default.valid(t);if(e)return e;let r=Object.values(j5(Av,"UNDECIDED"));if(r.includes(t))return t;let s=Oa.default.valid(t,{loose:!0})?` Did you mean to use "${Oa.default.valid(t,{loose:!0})}"?`:"";throw new ht(`Invalid strategy: "${t}". Expected a valid semver or one of ${r.map(a=>JSON.stringify(a)).join(", ")}.${s}`)}function wjt(t){return t==="premajor"||t==="preminor"||t==="prepatch"||t==="prerelease"}async function Gie(t,{prerelease:e=null}={}){let r=new Map,s=t.configuration.get("deferredVersionFolder");if(!fe.existsSync(s))return r;let a=await fe.readdirPromise(s);for(let n of a){if(!n.endsWith(".yml"))continue;let l=Y.join(s,n),f=await fe.readFilePromise(l,"utf8"),h=Fs(f);for(let[A,m]of Object.entries(h.releases||{})){if(m==="decline")continue;let w=G.parseIdent(A),v=t.tryWorkspaceByIdent(w);if(v===null)throw new Error(`Assertion failed: Expected a release definition file to only reference existing workspaces (${Y.basename(l)} references ${A})`);if(v.manifest.version===null)throw new Error(`Assertion failed: Expected the workspace to have a version (${G.prettyLocator(t.configuration,v.anchoredLocator)})`);let D=r.get(v),I=_8(v.manifest.version,hv(m),e);if(I===null)throw new Error(`Assertion failed: Expected ${v.manifest.version} to support being bumped via strategy ${m}`);let R=typeof D<"u"?Oa.default.gt(I,D)?I:D:I;r.set(v,R)}}return r}async function qie(t){let e=t.configuration.get("deferredVersionFolder");fe.existsSync(e)&&await fe.removePromise(e)}async function Vie(t,e){let r=new Set(e),s=t.configuration.get("deferredVersionFolder");if(!fe.existsSync(s))return;let a=await fe.readdirPromise(s);for(let n of a){if(!n.endsWith(".yml"))continue;let l=Y.join(s,n),f=await fe.readFilePromise(l,"utf8"),h=Fs(f),A=h?.releases;if(A){for(let m of Object.keys(A)){let w=G.parseIdent(m),v=t.tryWorkspaceByIdent(w);(v===null||r.has(v))&&delete h.releases[m]}Object.keys(h.releases).length>0?await fe.changeFilePromise(l,Uc(new Uc.PreserveOrdering(h))):await fe.unlinkPromise(l)}}}async function pv(t,{allowEmpty:e=!1}={}){let r=t.configuration;if(r.projectCwd===null)throw new ht("This command can only be run from within a Yarn project");let s=await fc.fetchRoot(r.projectCwd),a=s!==null?await fc.fetchBase(s,{baseRefs:r.get("changesetBaseRefs")}):null,n=s!==null?await fc.fetchChangedFiles(s,{base:a.hash,project:t}):[],l=r.get("deferredVersionFolder"),f=n.filter(D=>Y.contains(l,D)!==null);if(f.length>1)throw new ht(`Your current branch contains multiple versioning files; this isn't supported:
- ${f.map(D=>me.fromPortablePath(D)).join(`
- `)}`);let h=new Set(Ye.mapAndFilter(n,D=>{let I=t.tryWorkspaceByFilePath(D);return I===null?Ye.mapAndFilter.skip:I}));if(f.length===0&&h.size===0&&!e)return null;let A=f.length===1?f[0]:Y.join(l,`${si.makeHash(Math.random().toString()).slice(0,8)}.yml`),m=fe.existsSync(A)?await fe.readFilePromise(A,"utf8"):"{}",w=Fs(m),v=new Map;for(let D of w.declined||[]){let I=G.parseIdent(D),R=t.getWorkspaceByIdent(I);v.set(R,"decline")}for(let[D,I]of Object.entries(w.releases||{})){let R=G.parseIdent(D),N=t.getWorkspaceByIdent(R);v.set(N,hv(I))}return{project:t,root:s,baseHash:a!==null?a.hash:null,baseTitle:a!==null?a.title:null,changedFiles:new Set(n),changedWorkspaces:h,releaseRoots:new Set([...h].filter(D=>D.manifest.version!==null)),releases:v,async saveAll(){let D={},I=[],R=[];for(let N of t.workspaces){if(N.manifest.version===null)continue;let U=G.stringifyIdent(N.anchoredLocator),V=v.get(N);V==="decline"?I.push(U):typeof V<"u"?D[U]=hv(V):h.has(N)&&R.push(U)}await fe.mkdirPromise(Y.dirname(A),{recursive:!0}),await fe.changeFilePromise(A,Uc(new Uc.PreserveOrdering({releases:Object.keys(D).length>0?D:void 0,declined:I.length>0?I:void 0,undecided:R.length>0?R:void 0})))}}}function Cjt(t){return L8(t).size>0||BR(t).length>0}function L8(t){let e=new Set;for(let r of t.changedWorkspaces)r.manifest.version!==null&&(t.releases.has(r)||e.add(r));return e}function BR(t,{include:e=new Set}={}){let r=[],s=new Map(Ye.mapAndFilter([...t.releases],([n,l])=>l==="decline"?Ye.mapAndFilter.skip:[n.anchoredLocator.locatorHash,n])),a=new Map(Ye.mapAndFilter([...t.releases],([n,l])=>l!=="decline"?Ye.mapAndFilter.skip:[n.anchoredLocator.locatorHash,n]));for(let n of t.project.workspaces)if(!(!e.has(n)&&(a.has(n.anchoredLocator.locatorHash)||s.has(n.anchoredLocator.locatorHash)))&&n.manifest.version!==null)for(let l of nr.hardDependencies)for(let f of n.manifest.getForScope(l).values()){let h=t.project.tryWorkspaceByDescriptor(f);h!==null&&s.has(h.anchoredLocator.locatorHash)&&r.push([n,h])}return r}function Bjt(t,e){let r=Oa.default.clean(e);for(let s of Object.values(Av))if(s!=="undecided"&&s!=="decline"&&Oa.default.inc(t,s)===r)return s;return null}function _8(t,e,r=null){if(Oa.default.valid(e))return e;if(t===null)throw new ht(`Cannot apply the release strategy "${e}" unless the workspace already has a valid version`);if(!Oa.default.valid(t))throw new ht(`Cannot apply the release strategy "${e}" on a non-semver version (${t})`);if(wjt(e)){let a=Oa.default.inc(t,e==="prerelease"?"patch":e.slice(3));if(a===null)throw new ht(`Cannot apply the release strategy "${e.slice(3)}" on the specified version (${t}) while trying to determine the base of the prerelease bump`);return r?m8e(a,{current:t,prerelease:r}):a===Oa.default.truncate(t,"patch")?Oa.default.inc(t,"prerelease"):`${a}-0`}let s=Oa.default.inc(t,e);if(s===null)throw new ht(`Cannot apply the release strategy "${e}" on the specified version (${t})`);return s}function Wie(t,e,{report:r,exact:s}){let a=new Map;for(let n of t.workspaces)for(let l of nr.allDependencies)for(let f of n.manifest[l].values()){let h=t.tryWorkspaceByDescriptor(f);if(h===null||!e.has(h))continue;Ye.getArrayWithDefault(a,h).push([n,l,f.identHash])}for(let[n,l]of e){let f=n.manifest.version;n.manifest.version=l,delete n.manifest.raw.stableVersion;let h=n.manifest.name!==null?G.stringifyIdent(n.manifest.name):null;r.reportInfo(0,`${G.prettyLocator(t.configuration,n.anchoredLocator)}: Bumped to ${l}`),r.reportJson({cwd:me.fromPortablePath(n.cwd),ident:h,deferred:!1,oldVersion:f,newVersion:l});let A=a.get(n);if(!(typeof A>"u"))for(let[m,w,v]of A){let D=m.manifest[w].get(v);if(typeof D>"u")throw new Error("Assertion failed: The dependency should have existed");let I=D.range,R=!1;if(I.startsWith(Gi.protocol)&&(I=I.slice(Gi.protocol.length),R=!0,I===n.relativeCwd))continue;let N=I.match(Ijt);if(!N){r.reportWarning(0,`Couldn't auto-upgrade range ${I} (in ${G.prettyLocator(t.configuration,m.anchoredLocator)})`);continue}let U=s?`${l}`:`${N[1]}${l}`;R&&(U=`${Gi.protocol}${U}`);let V=G.makeDescriptor(D,U);m.manifest[w].set(v,V)}}}var vjt=new Map([["%n",t=>t.length>0&&typeof t[0]=="number"?{increment:t.shift()+1,reset:1}:{increment:null,reset:1}]]);function m8e(t,{current:e,prerelease:r}){let s=new Oa.default.SemVer(e),a=Oa.default.truncate(t,"patch");if(a===null)throw new Error(`Assertion failed: Expected the version to be a valid semver version (${t})`);let n=s.prerelease.slice(),l=Oa.default.truncate(s,"patch")===a,f=[];for(let A of r.split(/\./g)){let m=vjt.get(A);if(typeof m>"u")f.push(A),n[0]===A?n.shift():l=!1;else{let w=m(n);l&&w.increment!==null?f.push(w):(f.push(w.reset),l=!1)}}l&&=n.length===0;let h=f.map(A=>typeof A=="object"?l?A.increment:A.reset:A);return`${a}-${h.join(".")}`}var dv=class extends mt{constructor(){super(...arguments);this.interactive=ye.Boolean("-i,--interactive",{description:"Open an interactive interface used to set version bumps"})}static{this.paths=[["version","check"]]}static{this.usaLine truncated
`)},h=()=>{let we=this.from.map(d=>yv.default.matcher(d));return s.workspaces.filter(d=>{let be=G.stringifyIdent(d.anchoredLocator),Ce=d.relativeCwd;return we.some(Ee=>Ee(be)||Ee(Ce))})},A=[];if(this.since?(f("Option --since is set; selecting the changed workspaces as root for workspace selection"),A=Array.from(await fc.fetchChangedWorkspaces({ref:this.since,project:s}))):this.from?(f("Option --from is set; selecting the specified workspaces"),A=[...h()]):this.worktree?(f("Option --worktree is set; selecting the current workspace"),A=[a]):this.recursive?(f("Option --recursive is set; selecting the current workspace"),A=[a]):this.all&&(f("Option --all is set; selecting all workspaces"),A=[...s.workspaces]),this.dryRun&&!this.all){for(let we of A)f(`
- ${we.relativeCwd}
${G.prettyLocator(r,we.anchoredLocator)}`);A.length>0&&f("")}let m;if(this.recursive?this.since?(f("Option --recursive --since is set; recursively selecting all dependent workspaces"),m=new Set(A.map(we=>[...we.getRecursiveWorkspaceDependents()]).flat())):(f("Option --recursive is set; recursively selecting all transitive dependencies"),m=new Set(A.map(we=>[...we.getRecursiveWorkspaceDependencies()]).flat())):this.worktree?(f("Option --worktree is set; recursively selecting all nested workspaces"),m=new Set(A.map(we=>[...we.getRecursiveWorkspaceChildren()]).flat())):m=null,m!==null&&(A=[...new Set([...A,...m])],this.dryRun))for(let we of m)f(`
- ${we.relativeCwd}
${G.prettyLocator(r,we.anchoredLocator)}`);let w=[],v=!1;if(l?.includes(":")){for(let we of s.workspaces)if(we.manifest.scripts.has(l)&&(v=!v,v===!1))break}for(let we of A){if(l&&!we.manifest.scripts.has(l)&&!v&&!(await qn.getWorkspaceAccessibleBinaries(we)).has(l)){f(`Excluding ${we.relativeCwd} because it doesn't have a "${l}" script`);continue}if(!(l===r.env.npm_lifecycle_event&&we.cwd===a.cwd)){if(this.include.length>0&&!yv.default.isMatch(G.stringifyIdent(we.anchoredLocator),this.include)&&!yv.default.isMatch(we.relativeCwd,this.include)){f(`Excluding ${we.relativeCwd} because it doesn't match the --include filter`);continue}if(this.exclude.length>0&&(yv.default.isMatch(G.stringifyIdent(we.anchoredLocator),this.exclude)||yv.default.isMatch(we.relativeCwd,this.exclude))){f(`Excluding ${we.relativeCwd} because it matches the --exclude filter`);continue}if(this.publicOnly&&we.manifest.private===!0){f(`Excluding ${we.relativeCwd} because it's a private workspace and --no-private was set`);continue}w.push(we)}}if(w.sort((we,d)=>G.stringifyIdent(we.anchoredLocator).localeCompare(G.stringifyIdent(d.anchoredLocator))),this.dryRun)return 0;let D=this.verbose??(this.context.stdout.isTTY?1/0:0),I=D>0,R=D>1,N=this.parallel?this.jobs==="unlimited"?1/0:Number(this.jobs)||Math.ceil(us.availableParallelism()/2):1,U=N===1?!1:this.parallel,V=U?this.interlaced:!0,ee=(0,E8e.default)(N),te=new Map,ie=new Set,ae=0,ge=null,de=!1,xe=await Wt.start({configuration:r,stdout:this.context.stdout,includePrefix:!1},async we=>{let d=async(be,{commandIndex:Ce})=>{if(de)return-1;!U&&R&&Ce>1&&we.reportSeparator();let Ee=Djt(be,{configuration:r,label:I,commandIndex:Ce}),[he,$]=y8e(we,{prefix:Ee,interlaced:V}),[De,Te]=y8e(we,{prefix:Ee,interlaced:V});try{R&&we.reportInfo(null,`${Ee?`${Ee} `:""}Process started`);let ot=Date.now(),j=await this.cli.run([this.commandName,...this.args],{cwd:be.cwd,stdout:he,stderr:De})||0;he.end(),De.end(),await $,await Te;let rt=Date.now();if(R){let Ne=r.get("enableTimers")?`, completed in ${pe.pretty(r,rt-ot,pe.Type.DURATION)}`:"";we.reportInfo(null,`${Ee?`${Ee} `:""}Process exited (exit code ${j})${Ne}`)}return j===130&&(de=!0,ge=j),j}catch(ot){throw he.end(),De.end(),await $,await Te,ot}};for(let be of w)te.set(be.anchoredLocator.locatorHash,be);for(;te.size>0&&!we.hasErrors();){let be=[];for(let[$,De]of te){if(ie.has(De.anchoredDescriptor.descriptorHash))continue;let Te=!0;if(this.topological||this.topologicalDev){let ot=this.topologicalDev?new Map([...De.manifest.dependencies,...De.manifest.devDependencies]):De.manifest.dependencies;for(let j of ot.values()){let rt=s.tryWorkspaceByDescriptor(j);if(Te=rt===null||!te.has(rt.anchoredLocator.locatorHash),!Te)break}}if(Te&&(ie.add(De.anchoredDescriptor.descriptorHash),be.push(ee(async()=>{let ot=await d(De,{commandIndex:++ae});return te.delete($),ie.delete(De.anchoredDescriptor.descriptorHash),{workspace:De,exitCode:ot}})),!U))break}if(be.length===0){let $=Array.from(te.values()).map(De=>G.prettyLocator(r,De.anchoredLocator)).join(", ");we.reportError(3,`Dependency cycle detected (${$})`);return}let Ce=await Promise.all(be);Ce.forEach(({workspace:$,exitCode:De})=>{De!==0&&we.reportError(0,`The command failed in workspace ${G.prettyLocator(r,$.anchoredLocator)} with exit code ${De}`)});let he=Ce.map($=>$.exitCode).find($=>$!==0);(this.topological||this.topologicalDev)&&typeof he<"u"&&we.reportError(0,"The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph")}});return ge!==null?ge:xe.exitCode()}};function y8e(t,{prefix:e,interlaced:r}){let s=t.createStreamReporter(e),a=new Ye.DefaultStream;a.pipe(s,{end:!1}),a.on("finish",()=>{s.end()});let n=new Promise(f=>{s.on("finish",()=>{f(a.active)})});if(r)return[a,n];let l=new Ye.BufferStream;return l.pipe(a,{end:!1}),l.on("finish",()=>{a.end()}),[l,n]}function Djt(t,{configuration:e,commandIndex:r,label:s}){if(!s)return null;let n=`[${G.stringifyIdent(t.anchoredLocator)}]:`,l=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],f=l[r%l.length];return pe.pretty(e,n,f)}var Pjt={commands:[mv,Ev]},xjt=Pjt;var QC=()=>({modules:new Map([["@yarnpkg/cli",hD],["@yarnpkg/core",fD],["@yarnpkg/fslib",cS],["@yarnpkg/libzip",bb],["@yarnpkg/parsers",hS],["@yarnpkg/shell",Tb],["clipanion",BS],["semver",kjt],["typanion",ho],["@yarnpkg/plugin-essentials",nY],["@yarnpkg/plugin-catalog",aY],["@yarnpkg/plugin-compat",hY],["@yarnpkg/plugin-constraints",xY],["@yarnpkg/plugin-dlx",kY],["@yarnpkg/plugin-exec",QY],["@yarnpkg/plugin-file",NY],["@yarnpkg/plugin-git",rY],["@yarnpkg/plugin-github",_Y],["@yarnpkg/plugin-http",MY],["@yarnpkg/plugin-init",UY],["@yarnpkg/plugin-interactive-tools",Lz],["@yarnpkg/plugin-jsr",Mz],["@yarnpkg/plugin-link",Uz],["@yarnpkg/plugin-nm",PJ],["@yarnpkg/plugin-npm",pie],["@yarnpkg/plugin-npm-cli",vie],["@yarnpkg/plugin-pack",EZ],["@yarnpkg/plugin-patch",Rie],["@yarnpkg/plugin-pnp",dJ],["@yarnpkg/plugin-pnpm",Fie],["@yarnpkg/plugin-stage",Hie],["@yarnpkg/pLine truncated
Please report this issue at https://github.com/yarnpkg/berry/issues.`)}process.once("beforeExit",n);try{process.exitCode=42,process.exitCode=await Njt(a,t,{selfPath:r,pluginConfiguration:s})}catch(l){ec.defaultContext.stdout.write(a.error(l)),process.exitCode=1}finally{process.off("beforeExit",n),await fe.rmtempPromise()}}_O(process.argv.slice(2),{cwd:Y.cwd(),selfPath:me.toPortablePath(me.resolve(process.argv[1])),pluginConfiguration:QC()});})();
/**
@license
Copyright (c) 2015, Rebecca Turner
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
/**
@license
Copyright Node.js contributors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
/**
@license
The MIT License (MIT)
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/**
@license
Copyright Joyent, Inc. and other Node contributors.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*! Bundled license information:
is-number/index.js:
(*!
* is-number <https://github.com/jonschlinkert/is-number>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Released under the MIT License.
*)
to-regex-range/index.js:
(*!
* to-regex-range <https://github.com/micromatch/to-regex-range>
*
* Copyright (c) 2015-present, Jon Schlinkert.
* Released under the MIT License.
*)
fill-range/index.js:
(*!
* fill-range <https://github.com/jonschlinkert/fill-range>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Licensed under the MIT License.
*)
is-extglob/index.js:
(*!
* is-extglob <https://github.com/jonschlinkert/is-extglob>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*)
is-glob/index.js:
(*!
* is-glob <https://github.com/jonschlinkert/is-glob>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*)
queue-microtask/index.js:
(*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
run-parallel/index.js:
(*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
git-url-parse/lib/index.js:
(*!
* buildToken
* Builds OAuth token prefix (helper function)
*
* @name buildToken
* @function
* @param {GitUrl} obj The parsed Git url object.
* @return {String} token prefix
*)
object-assign/index.js:
(*
object-assign
(c) Sindre Sorhus
@license MIT
*)
react/cjs/react.production.min.js:
(** @license React v17.0.2
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
scheduler/cjs/scheduler.production.min.js:
(** @license React v0.20.2
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react-reconciler/cjs/react-reconciler.production.min.js:
(** @license React v0.26.2
* react-reconciler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
is-windows/index.js:
(*!
* is-windows <https://github.com/jonschlinkert/is-windows>
*
* Copyright © 2015-2018, Jon Schlinkert.
* Released under the MIT License.
*)
negotiator/index.js:
(*!
* negotiator
* Copyright(c) 2012 Federico Romero
* Copyright(c) 2012-2014 Isaac Z. Schlueter
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*)
imurmurhash/imurmurhash.js:
(**
* @preserve
* JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013)
*
* @author <a href="mailto:jensyt@gmail.com">Jens Taylor</a>
* @see http://github.com/homebrewing/brauhaus-diff
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
* @see http://github.com/garycourt/murmurhash-js
* @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
* @see http://sites.google.com/site/murmurhash/
*)
make-fetch-happen/lib/fetch.js:
(**
* @license
* Copyright (c) 2010-2012 Mikeal Rogers
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS
* IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*)
*/
+4 -3
View File
@@ -14,8 +14,9 @@ npmScopes:
enableScripts: false
defaultSemverRangePrefix: ""
npmMinimalAgeGate: "7d"
npmPreapprovedPackages: ["@navikt/*"]
npmMinimalAgeGate: 7d
npmPreapprovedPackages:
- "@navikt/*"
enableTelemetry: false
yarnPath: .yarn/releases/yarn-4.12.0.cjs
yarnPath: .yarn/releases/yarn-4.18.0.cjs
+6
View File
@@ -1,5 +1,11 @@
# @navikt/aksel-icons
## 8.17.1
## 8.17.0
## 8.16.2
## 8.16.1
## 8.16.0
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel-icons",
"version": "8.16.1",
"version": "8.17.1",
"author": "Aksel | Nav",
"homepage": "https://aksel.nav.no/ikoner",
"repository": {
@@ -76,12 +76,12 @@
"@svgr/cli": "8.1.0",
"@types/js-yaml": "^4.0.9",
"@types/react": "19.2.14",
"adm-zip": "^0.6.0",
"adm-zip": "^0.6.1",
"concurrently": "10.0.4",
"copyfiles": "^2.4.1",
"fast-glob": "3.3.3",
"hast-util-select": "6.0.4",
"js-yaml": "^5.3.0",
"js-yaml": "^5.4.2",
"lodash": "4.18.1",
"prettier": "3.9.6",
"react": "19.2.8",
@@ -90,6 +90,6 @@
"tsx": "^4.23.1",
"typescript": "6.0.3",
"unified": "11.0.5",
"vitest": "4.1.10"
"vitest": "4.1.11"
}
}
+6
View File
@@ -1,5 +1,11 @@
# @navikt/aksel-stylelint
## 8.17.1
## 8.17.0
## 8.16.2
## 8.16.1
## 8.16.0
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel-stylelint",
"version": "8.16.1",
"version": "8.17.1",
"type": "module",
"engines": {
"node": ">=18.12.0"
@@ -43,10 +43,10 @@
"dev": "yarn watch:lint"
},
"devDependencies": {
"@navikt/ds-css": "^8.16.1",
"@navikt/ds-tokens": "^8.16.1",
"@navikt/ds-css": "^8.17.1",
"@navikt/ds-tokens": "^8.17.1",
"concurrently": "10.0.4",
"postcss-selector-parser": "^7.1.4",
"postcss-selector-parser": "^7.1.5",
"postcss-value-parser": "^4.2.0",
"stylelint": "^17.14.1",
"stylelint-test-rule-node": "^1.2.0",
+6
View File
@@ -1,5 +1,11 @@
# @navikt/aksel
## 8.17.1
## 8.17.0
## 8.16.2
## 8.16.1
### Patch Changes
+1 -1
View File
@@ -158,7 +158,7 @@ Remember to remove `@navikt/ds-css-internal` as a dependency after migration + r
+ .navds-timeline
```
Note: This is a "dumb" codemod that uses a simple regex to find and replace. This can lead to unknown sideeffects, so its reccomended to scope the codemod to spesific files.
Note: This is a "dumb" codemod that uses a simple regex to find and replace. This can lead to unknown sideeffects, so its recommended to scope the codemod to spesific files.
```bash
`npx @navikt/aksel codemod v4-internal-css **/*.css`
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel",
"version": "8.16.1",
"version": "8.17.1",
"description": "Aksel command line interface. Codemods and other utilities for Aksel users.",
"author": "Aksel | Nav designsystem team",
"license": "MIT",
@@ -57,7 +57,7 @@
"@types/jscodeshift": "17.3.0",
"rimraf": "6.1.3",
"typescript": "6.0.3",
"vitest": "4.1.10"
"vitest": "4.1.11"
},
"sideEffects": false,
"engines": {
+18
View File
@@ -1,5 +1,23 @@
# @navikt/ds-css
## 8.17.1
## 8.17.0
### Minor Changes
- New component: Badge, a small badge that communicates updates, presence or a count. ([#5096](https://github.com/navikt/aksel/pull/5096))
### Patch Changes
- ExpansionCard: Updated borders and transitions ([#5277](https://github.com/navikt/aksel/pull/5277))
## 8.16.2
### Patch Changes
- Browserlist: Updated browser-support. ([#5213](https://github.com/navikt/aksel/pull/5213))
## 8.16.1
## 8.16.0
+2 -3
View File
@@ -55,9 +55,8 @@ async function bundle() {
drafts: {
customMedia: false,
},
targets: browserslistToTargets(
browserslist(">= 0.5% in NO, safari >= 15.4, iOS >= 15.4, not dead"),
),
/* Uses the "browserslist" field in package.json as the single source of truth. */
targets: browserslistToTargets(browserslist(packageJSON.browserslist)),
resolver: {
read(filePath) {
const file = fs.readFileSync(filePath, "utf8");
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-css",
"version": "8.16.1",
"version": "8.17.1",
"description": "CSS for Nav Designsystem",
"author": "Aksel | Nav designsystem team",
"keywords": [
@@ -32,18 +32,18 @@
"css:get-version": "node config/get-version.js"
},
"devDependencies": {
"@navikt/ds-tokens": "^8.16.1",
"@navikt/ds-tokens": "^8.17.1",
"browserslist": "^4.28.7",
"esbuild": "^0.28.0",
"esbuild": "^0.28.2",
"fast-glob": "3.3.3",
"lightningcss": "^1.33.0",
"tsx": "^4.23.1"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
">= 0.2% in NO",
"not safari < 15.4",
"not ios_saf < 15.4",
"not dead"
],
"main": "./dist/index.css",
"exports": {
+48
View File
@@ -0,0 +1,48 @@
.aksel-badge__anchor {
position: relative;
display: inline-flex;
flex-shrink: 0;
width: fit-content;
}
.aksel-badge {
--__axc-badge-size: 1.25rem;
box-sizing: border-box;
position: relative;
z-index: 0;
display: inline-flex;
align-items: center;
justify-content: center;
min-width: var(--__axc-badge-size);
height: var(--__axc-badge-size);
padding: var(--ax-space-4);
border-radius: var(--ax-radius-16);
background: var(--ax-bg-strong);
color: var(--ax-text-contrast);
white-space: nowrap;
line-height: 1;
@media (forced-colors: active) {
forced-color-adjust: none;
background: canvastext;
color: canvas;
}
}
.aksel-badge__anchor > .aksel-badge {
position: absolute;
z-index: 1;
pointer-events: none;
inset-block-start: 0;
inset-inline-end: 0;
/* 5px offset */
transform: translate(0.3125rem, -0.3125rem);
}
.aksel-badge[data-dot] {
--__axc-badge-size: 0.75rem;
padding-inline: 0;
}
@@ -30,7 +30,6 @@
max-width: min(95vw, 640px);
animation-duration: 160ms;
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
overflow: auto;
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
max-height: calc(var(--__axc-floating-available-height) - 4px);
}
+9 -3
View File
@@ -6,15 +6,18 @@
border-radius: var(--ax-radius-12);
background-color: var(--ax-bg-softA);
height: fit-content;
border: 1px solid var(--ax-border-default);
border: 1px solid var(--ax-border-subtleA);
transition-property: border-color, box-shadow;
transition-duration: 300ms;
transition-timing-function: cubic-bezier(0, 0, 0, 1);
&[data-color="neutral"] {
background-color: var(--ax-bg-raised);
}
&:has(.aksel-expansioncard__header:hover) {
box-shadow: 0 0 0 1px var(--ax-border-strong);
border-color: var(--ax-border-strong);
box-shadow: 0 0 0 1px var(--ax-border-default);
border-color: var(--ax-border-default);
}
}
@@ -47,6 +50,7 @@
background-color: transparent;
position: relative;
justify-content: space-between;
transition: background-color 300ms cubic-bezier(0, 0, 0, 1);
&:hover {
background-color: var(--ax-bg-moderate-hoverA);
@@ -66,6 +70,7 @@
width: calc(100% - 2 * var(--__axc-expansioncard-padding-inline));
position: absolute;
opacity: 1;
transition: opacity 150ms cubic-bezier(0, 0, 0, 1);
}
&:hover::after {
@@ -100,6 +105,7 @@
min-width: 3rem;
font-size: 1.5rem;
align-self: flex-start;
transition: background-color 100ms cubic-bezier(0, 0, 0, 1);
&:focus-visible {
outline: 3px solid var(--ax-border-focus);
+121 -46
View File
@@ -1,5 +1,10 @@
.aksel-combobox2[data-disabled="true"] {
opacity: var(--ax-opacity-disabled);
pointer-events: none;
}
/************************************************
* Label & description *
* Label & description & error *
************************************************/
.aksel-combobox2__label {
@@ -11,6 +16,10 @@
margin-bottom: var(--ax-space-8);
}
.aksel-combobox2__error {
margin-top: var(--ax-space-8);
}
/************************************************
* Field *
************************************************/
@@ -32,6 +41,9 @@
padding-right: var(--ax-space-40);
scroll-margin-block-start: 4rem;
text-align: left;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
&:hover {
border-color: var(--ax-border-strong);
@@ -60,6 +72,11 @@
border-color: var(--ax-border-neutral-subtleA);
cursor: default;
}
&[data-error="true"] {
box-shadow: 0 0 0 1px var(--ax-border-danger-strong);
border-color: var(--ax-border-danger-strong);
}
}
.aksel-combobox2__field-chevron {
@@ -79,26 +96,57 @@
}
}
/************************************************
* Overlay *
************************************************/
.aksel-combobox2__modal {
/**
* We set the height of the content to the visible viewport, but the virtual
* keyboard will still compensate for it's precence by adding some empty space
* at the bottom. We use overscroll-behavior and touch-action to prevent scrolling
* to this area. They overlap some, but both are needed to make it work everywhere.
* See also "List" section below and ComboboxOverlay.tsx.
*
* On iOS, overscroll-behavior has no effect on scroll containers that have
* no scrollable overflow, but it works well in Chrome on Android.
*
* touch-action works on iOS, but (on Chrome on Android at least) it's still
* possible to scroll by dragging from just bellow the list.
*/
overscroll-behavior-y: contain;
touch-action: pinch-zoom pan-x;
}
.aksel-combobox2__modal-inner {
display: flex;
flex-direction: column;
overflow: hidden;
}
/************************************************
* Popup *
************************************************/
.aksel-combobox2__popup {
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
width: max(280px, var(--__axc-floating-anchor-width));
min-width: var(--__axc-floating-anchor-width);
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
max-height: calc(var(--__axc-floating-available-height) - 4px);
background-color: var(--ax-bg-raised);
outline: 1px solid var(--ax-border-neutral-subtleA);
outline-offset: -1px;
padding: 1px;
border-radius: var(--ax-radius-8);
box-shadow: var(--ax-shadow-dialog);
/* This is needed to get overflow:auto to work on child */
display: flex;
flex-direction: column;
overflow: hidden;
.aksel-combobox2:has(:not(.aksel-combobox2__modal)) & {
outline: 1px solid var(--ax-border-neutral-subtleA);
outline-offset: -1px;
border-radius: var(--ax-radius-8);
box-shadow: var(--ax-shadow-dialog);
}
}
/************************************************
@@ -107,39 +155,45 @@
.aksel-combobox2__filter {
margin: -1px;
margin-bottom: var(--ax-space-12);
}
& .aksel-search__wrapper {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
.aksel-combobox2__filter .aksel-search__wrapper {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
&:has(.aksel-search__input:focus-visible) {
outline: none;
position: relative;
&:has(.aksel-search__input:focus-visible) {
outline: none;
position: relative;
&::after {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
border: 2px solid var(--ax-border-focus);
border-top-left-radius: var(--ax-radius-8);
border-top-right-radius: var(--ax-radius-8);
}
&::after {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
border: 2px solid var(--ax-border-focus);
}
.aksel-combobox2:has(:not(.aksel-combobox2__modal)) &::after {
border-top-left-radius: var(--ax-radius-8);
border-top-right-radius: var(--ax-radius-8);
}
}
}
& .aksel-search__input {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
.aksel-combobox2__filter .aksel-search__input {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
.aksel-listbox[data-size="medium"] & {
min-height: 0;
}
&:not(:hover) {
border-color: var(--ax-border-neutral-subtleA);
}
&:not(:hover) {
border-color: var(--ax-border-neutral-subtleA);
}
.aksel-combobox2[data-size="medium"] & {
min-height: 0;
}
.aksel-combobox2__modal & {
border-radius: 0;
}
}
@@ -148,7 +202,17 @@
************************************************/
.aksel-combobox2__list {
overflow: auto;
padding-block: var(--ax-space-12);
.aksel-combobox2__modal & {
padding-inline: var(--ax-space-16);
/* Prevents scrolling to area taken up by virtual keyboard.
Needed for iOS since it doesn't work to set it on the entire modal.
NB: Doesn't work if the list doesn't overflow.
See also "Overlay" section above and ComboboxOverlay.tsx. */
overscroll-behavior-y: contain;
}
}
.aksel-combobox2__no-results {
@@ -156,23 +220,22 @@
text-align: center;
}
/************************************************
* Group *
************************************************/
.aksel-combobox2__group-label {
padding: var(--ax-space-8) var(--ax-space-8);
font-weight: bold;
}
/************************************************
* Option *
************************************************/
.aksel-combobox2__option {
& > div {
display: flex;
gap: var(--ax-space-2);
& > div:last-child {
flex-grow: 1;
}
}
&:is([aria-selected="true"], [aria-selected="true"][data-virtual-focus="true"]) > div {
background-color: var(--ax-bg-moderate-pressedA);
}
.aksel-combobox2__option:is([aria-selected="true"], [aria-selected="true"][data-virtual-focus="true"])
.aksel-listbox__option-inner {
background-color: var(--ax-bg-moderate-pressedA);
}
.aksel-combobox2__option-checkmark {
@@ -180,7 +243,8 @@
width: var(--__axc-combobox2-option-checkmark-size);
height: var(--__axc-combobox2-option-checkmark-size);
margin-top: 0.1875rem;
margin-top: var(--ax-space-2);
float: left;
.aksel-combobox2[data-size="small"] & {
--__axc-combobox2-option-checkmark-size: 1rem;
@@ -190,3 +254,14 @@
font-size: var(--__axc-combobox2-option-checkmark-size);
}
}
.aksel-combobox2__option-label {
padding-left: var(--ax-space-24);
/* &[data-nowrap="true"] {
padding-left: var(--ax-space-2);
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
} */
}
+1
View File
@@ -48,6 +48,7 @@
@import "./pagination.css" layer(aksel.components.modules);
@import "./popover.css" layer(aksel.components.modules);
@import "./lookup.css" layer(aksel.components.modules);
@import "./badge.css" layer(aksel.components.modules);
@import "./tag.css" layer(aksel.components.modules);
@import "./timeline.css" layer(aksel.components.modules);
@import "./tooltip.css" layer(aksel.components.modules);
+12 -1
View File
@@ -1,3 +1,7 @@
.aksel-listbox__options {
overflow: auto;
}
.aksel-listbox__group-label {
background: var(--ax-bg-neutral-softA);
padding: var(--ax-space-2) var(--ax-space-8);
@@ -17,9 +21,16 @@
}
.aksel-listbox__options > &:last-child,
.aksel-listbox__group:last-child > &:last-child {
.aksel-listbox__group:last-child &:last-child {
margin-bottom: var(--ax-space-2);
}
.aksel-listbox__group:first-child &:nth-child(1 of &) {
/* When we scroll to the first option, and that option is in a group,
scroll to the very top so that the group label is visible as well.
We exaggerate the value to take into account custom content. */
scroll-margin-top: 60px;
}
}
.aksel-listbox__option-inner {
+38
View File
@@ -1,5 +1,43 @@
# @navikt/ds-react
## 8.17.1
### Patch Changes
- Popover: Keep `bottom` placement when there is not enough space above or below the anchor, so the content stays reachable by scrolling. Fixes DatePicker being cut off above the viewport. ([#5297](https://github.com/navikt/aksel/pull/5297))
- Updated dependencies []:
- @navikt/aksel-icons@8.17.1
- @navikt/ds-tokens@8.17.1
## 8.17.0
### Minor Changes
- New component: Badge, a small badge that communicates updates, presence or a count. ([#5096](https://github.com/navikt/aksel/pull/5096))
### Patch Changes
- Alert: Component is now marked as deprecated. Use GlobalAlert, LocalAlert, InfoCard or InlineMessage instead. ([#5256](https://github.com/navikt/aksel/pull/5256))
- Combobox: Fix issue deselecting options when uncontrolled ([#5259](https://github.com/navikt/aksel/pull/5259))
- Select: Prevent from being changed with keyboard when readOnly ([#5257](https://github.com/navikt/aksel/pull/5257))
- DatePicker: Fix validation-bug in `useRangeDatePicker` where initial validation could incorrectly assume `isValidDate` to be false ([#5278](https://github.com/navikt/aksel/pull/5278))
- OverridableComponent: Add built-in guard against using `as` and `asChild` at the same time ([#5238](https://github.com/navikt/aksel/pull/5238))
- Updated dependencies []:
- @navikt/aksel-icons@8.17.0
- @navikt/ds-tokens@8.17.0
## 8.16.2
### Patch Changes
- Updated dependencies []:
- @navikt/ds-tokens@8.16.2
- @navikt/aksel-icons@8.16.2
## 8.16.1
### Patch Changes
+15 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-react",
"version": "8.16.1",
"version": "8.17.1",
"description": "React components from the Norwegian Labour and Welfare Administration.",
"author": "Aksel, a team part of the Norwegian Labour and Welfare Administration.",
"license": "MIT",
@@ -76,6 +76,16 @@
"default": "./cjs/lookup/index.js"
}
},
"./PREVIEW/Badge": {
"import": {
"types": "./esm/badge/index.d.ts",
"default": "./esm/badge/index.js"
},
"require": {
"types": "./cjs/badge/index.d.ts",
"default": "./cjs/badge/index.js"
}
},
"./types/theme": {
"types": "./esm/types/theme.d.ts"
},
@@ -738,15 +748,15 @@
"dependencies": {
"@floating-ui/react": "0.27.20",
"@floating-ui/react-dom": "^2.1.9",
"@navikt/aksel-icons": "^8.16.1",
"@navikt/ds-tokens": "^8.16.1",
"@navikt/aksel-icons": "^8.17.1",
"@navikt/ds-tokens": "^8.17.1",
"date-fns": "^4.0.0",
"react-day-picker": "10.0.1"
},
"devDependencies": {
"@testing-library/dom": "10.4.1",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@testing-library/react": "^16.3.3",
"@testing-library/user-event": "^14.5.2",
"@types/jscodeshift": "17.3.0",
"@types/node": "^24.10.9",
@@ -765,7 +775,7 @@
"tsc-alias": "1.9.1",
"tsx": "^4.23.1",
"typescript": "6.0.3",
"vitest": "4.1.10"
"vitest": "4.1.11"
},
"peerDependencies": {
"@types/react": "^17.0.30 || ^18 || ^19",
@@ -1,12 +1,32 @@
import fg from "fast-glob";
import { readFileSync, writeFileSync } from "node:fs";
import { readFileSync, statSync, writeFileSync } from "node:fs";
import { pathToFileURL } from "node:url";
import type { ComponentMetadata } from "../../src/utils/types/metadata";
import { META_GLOB, generatedComponentNamesPath, packageRoot } from "./paths";
/** True when meta files changed/were deleted after componentNames was written */
function metaFilesChanged(files: string[]): boolean {
let componentNames: string;
let componentNamesMtime: number;
try {
const stat = statSync(generatedComponentNamesPath);
componentNamesMtime = stat.mtimeMs;
componentNames = readFileSync(generatedComponentNamesPath, "utf-8");
} catch {
return true;
}
// A deletion leaves no newer mtime, so compare counts to catch it.
const generatedCount = (componentNames.match(/^\s*\| "/gm) ?? []).length;
if (generatedCount !== files.length) {
return true;
}
return files.some((file) => statSync(file).mtimeMs > componentNamesMtime);
}
/** Extracts "name"-key from metadata export in each *.meta.ts file */
async function readMetaNames(): Promise<string[]> {
const files = fg.sync(META_GLOB, { cwd: packageRoot, absolute: true });
async function readMetaNames(files: string[]): Promise<string[]> {
const names = await Promise.all(
files.map(async (file) => {
// @ts-expect-error Benchmark helper: dynamic import in this script target.
@@ -21,12 +41,16 @@ async function readMetaNames(): Promise<string[]> {
}
/**
* Writes the generated `ComponentName` union, only touching the file when its
* contents change. Returns `true` when the file was rewritten.
* Writes the generated `ComponentName` union.
* @returns whether the file was changed.
*/
async function writeComponentNames(names?: string[]): Promise<boolean> {
if (!names) {
names = await readMetaNames();
const files = fg.sync(META_GLOB, { cwd: packageRoot, absolute: true });
if (!metaFilesChanged(files)) {
return false;
}
names = await readMetaNames(files);
}
/** Builds the contents of the generated `ComponentName` union module. */
@@ -49,10 +73,8 @@ ${body};
existing = undefined;
}
writeFileSync(generatedComponentNamesPath, content);
const changed = existing !== content;
if (changed) {
writeFileSync(generatedComponentNamesPath, content);
}
return changed;
}
@@ -52,7 +52,6 @@ const ActionMenuCheckboxItem = forwardRef<
xmlns="http://www.w3.org/2000/svg"
className="aksel-action-menu__indicator-icon"
aria-hidden
role="presentation"
>
<g className="aksel-action-menu__indicator-icon--unchecked">
<rect
@@ -39,7 +39,6 @@ const ActionMenuRadioItem = forwardRef<
xmlns="http://www.w3.org/2000/svg"
className="aksel-action-menu__indicator-icon"
aria-hidden
role="presentation"
>
<g className="aksel-action-menu__indicator-icon--unchecked">
<rect
@@ -0,0 +1,21 @@
import type { ComponentMetadata } from "../utils/types/metadata";
import { Badge } from "./index";
const metadata: ComponentMetadata = {
name: "Badge",
components: {
Badge,
},
keywords: [
"status",
"badge",
"dot",
"count",
"notification",
"indicator",
"presence",
"status",
],
};
export { metadata };
@@ -0,0 +1,105 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import React from "react";
import { InboxIcon } from "@navikt/aksel-icons";
import { Badge } from ".";
import { Button } from "../button";
import { HStack } from "../primitives/stack";
import type { AkselColor } from "../types/theme";
import { renderStoriesForChromatic } from "../utils/renderStoriesForChromatic";
const meta: Meta<typeof Badge> = {
title: "ds-react/Badge",
component: Badge,
parameters: {
chromatic: { disable: true },
},
};
export default meta;
type Story = StoryObj<typeof Badge>;
const statuses: { color: AkselColor; label: string }[] = [
{ color: "danger", label: "Avslått" },
{ color: "success", label: "Innvilget" },
{ color: "info", label: "Under behandling" },
{ color: "warning", label: "Mangler dokumentasjon" },
{ color: "neutral", label: "Ikke startet" },
];
export const Default: Story = {
args: {
count: 42,
"data-color": "danger",
},
};
export const Dot: Story = {
render: () => (
<HStack gap="space-16" align="center">
{statuses.map(({ color, label }) => (
<Badge key={color} data-color={color} aria-label={label} />
))}
</HStack>
),
};
export const Count: Story = {
render: () => (
<HStack gap="space-16" align="center">
<Badge data-color="danger" count={1} />
<Badge data-color="danger" count={42} />
<Badge data-color="danger" count={42} maxCount={42} />
<Badge data-color="accent" count={199} />
</HStack>
),
};
export const Anchored: Story = {
render: () => (
<HStack gap="space-32" align="center">
<Badge data-color="danger" count={42}>
<Button
icon={<InboxIcon aria-hidden />}
aria-label="Innboks, 42 nye meldinger"
/>
</Badge>
<Badge data-color="danger" aria-label="Nytt varsel">
<Button icon={<InboxIcon aria-hidden />} aria-label="Innboks" />
</Badge>
</HStack>
),
};
export const DynamicCount: Story = {
render: () => {
const [count, setCount] = React.useState(2);
return (
<HStack gap="space-16" align="center">
<Badge data-color="danger" count={count}>
<Button
icon={<InboxIcon aria-hidden />}
aria-label={`Innboks, ${count} nye meldinger`}
/>
</Badge>
<Button
size="small"
variant="secondary"
onClick={() => setCount((prev) => prev + 1)}
>
Ny melding
</Button>
<span role="status" className="aksel-sr-only">
{`${count} nye meldinger`}
</span>
</HStack>
);
},
};
export const Chromatic = renderStoriesForChromatic({
Count,
Dot,
Anchored,
});
+129
View File
@@ -0,0 +1,129 @@
import React, { type HTMLAttributes, forwardRef } from "react";
import type { AkselColor } from "../types";
import { BodyShort } from "../typography";
import { cl } from "../utils/helpers";
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
/**
* Element the badge is anchored to.
* Leave empty to render the badge standalone.
*/
children?: React.ReactNode;
/**
* Badge color.
* @default "danger"
* @see 🏷️ {@link AkselColor}
* @see [📝 Documentation](https://aksel.nav.no/grunnleggende/styling/farger-tokens)
*/
"data-color"?: AkselColor;
/**
* Optional count to display inside the badge, normalized to a non-negative integer.
* Omit to render a dot.
*/
count?: number;
/**
* The maximum count to display inside the badge, normalized to a non-negative integer.
* Numbers above are displayed as `maxCount+`.
* @default 99
*/
maxCount?: number;
}
/**
* A small badge that communicates updates or count.
*
* Use standalone for inline indicators/counts, or pass the element you want to
* anchor it to as `children` to pin the badge to one of its corners.
*
* Accessibility: A badge with no label is treated as decorative when it is a
* dot or anchored to another element. When anchoring to an interactive element,
* fold the state into that element's accessible name
* (e.g. `aria-label="Inbox, 42 new messages"`).
*
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/badge)
* @see 🏷️ {@link BadgeProps}
*
* @example
* ```jsx
* // Standalone
* <Badge data-color="success" aria-label="Active" />
* <Badge data-color="danger" count={42} />
*
* // Anchored to an element
* <Badge data-color="danger" count={42}>
* <Button icon={<InboxIcon />} aria-label="Inbox, 42 new messages" />
* </Badge>
* ```
*/
const Badge = forwardRef<HTMLSpanElement, BadgeProps>(
(
{
children,
className,
"data-color": color = "danger",
"aria-label": ariaLabel,
"aria-labelledby": ariaLabelledby,
role,
"aria-hidden": ariaHidden,
count,
maxCount = 99,
...rest
},
ref,
) => {
const normalizedCount =
count == null ? undefined : normalizeCount(count, 0);
const normalizedMaxCount = normalizeCount(maxCount, 99);
const isDot = normalizedCount == null;
const hasLabel =
Boolean(ariaLabel?.trim()) || Boolean(ariaLabelledby?.trim());
const isDecorative =
role == null && !hasLabel && (isDot || children != null);
const badge = (
<BodyShort
{...rest}
ref={ref}
as="span"
size="small"
weight="semibold"
data-color={color}
data-dot={isDot || undefined}
aria-label={ariaLabel}
aria-labelledby={ariaLabelledby}
role={role}
aria-hidden={ariaHidden ?? (isDecorative || undefined)}
className={cl("aksel-badge", className)}
>
{isDot
? null
: normalizedCount > normalizedMaxCount
? `${normalizedMaxCount}+`
: normalizedCount}
</BodyShort>
);
if (children == null) {
return badge;
}
return (
<span className="aksel-badge__anchor">
{children}
{badge}
</span>
);
},
);
function normalizeCount(value: number, fallback: number) {
return Number.isFinite(value) ? Math.max(0, Math.floor(value)) : fallback;
}
// eslint-disable-next-line @typescript-eslint/no-namespace, import/export
export namespace Badge {
export type Props = BadgeProps;
}
// eslint-disable-next-line import/export
export { Badge };
+2
View File
@@ -0,0 +1,2 @@
"use client";
export { Badge } from "./Badge";
+1 -6
View File
@@ -250,12 +250,7 @@ export const ColorRole: Story = {
function Illustration() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 54 93"
aria-hidden
role="presentation"
>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54 93" aria-hidden>
<path
fill="#e7e5e2"
d="M14 50.7C15 52.3 17.9 81 26.5 81S39 51.8 39 50.3c-13.2-7.6-25 .4-25 .4z"
@@ -64,7 +64,6 @@ export const ChipsToggle: OverridableComponent<
fill="none"
xmlns="http://www.w3.org/2000/svg"
focusable={false}
role="presentation"
>
{selected ? (
<path
@@ -182,46 +182,43 @@ const AutoSuggestPopup = forwardRef<HTMLDivElement, AutoSuggestPopupProps>(
sideOffset={8}
className="aksel-property-filter__popup"
>
<div className="aksel-property-filter__popup-inner">
<Listbox.Options
id={id}
aria-multiselectable={options.some((group) =>
group.options.some((item) => item.multiSelect),
)}
/* Options are only virtually focused, so real focus must stay on the input */
onMouseDown={(event) => event.preventDefault()}
>
{options.map((group) => {
/* Property- and value-groups can share a label, so include an option to keep keys unique */
const groupKey = `${group.label}-${group.options[0]?.value ?? ""}`;
<Listbox.Options
id={id}
className="aksel-property-filter__popup-inner"
aria-multiselectable={options.some((group) =>
group.options.some((item) => item.multiSelect),
)}
/* Options are only virtually focused, so real focus must stay on the input */
onMouseDown={(event) => event.preventDefault()}
>
{options.map((group) => {
/* Property- and value-groups can share a label, so include an option to keep keys unique */
const groupKey = `${group.label}-${group.options[0]?.value ?? ""}`;
const groupOptions = group.options.map((item) => (
<AutoSuggestOption
key={item.value}
item={item}
onSelect={onSelect}
hasVirtualFocus={focusedValue === item.value}
autoSuggestValue={autoSuggestValue}
/>
));
/* Groups without a label are rendered as plain options */
if (!group.label) {
return (
<React.Fragment key={groupKey}>
{groupOptions}
</React.Fragment>
);
}
const groupOptions = group.options.map((item) => (
<AutoSuggestOption
key={item.value}
item={item}
onSelect={onSelect}
hasVirtualFocus={focusedValue === item.value}
autoSuggestValue={autoSuggestValue}
/>
));
/* Groups without a label are rendered as plain options */
if (!group.label) {
return (
<Listbox.Group key={groupKey} label={group.label}>
{groupOptions}
</Listbox.Group>
<React.Fragment key={groupKey}>{groupOptions}</React.Fragment>
);
})}
</Listbox.Options>
</div>
}
return (
<Listbox.Group key={groupKey} label={group.label}>
{groupOptions}
</Listbox.Group>
);
})}
</Listbox.Options>
</Floating.Content>
</DismissableLayer>
);
@@ -117,15 +117,16 @@ const fromValidation = (day: Date, opt?: UseRangeDatepickerOptions) => {
opt?.fromDate && day && differenceInCalendarDays(opt?.fromDate, day) > 0;
const isAfter =
opt?.toDate && day && differenceInCalendarDays(day, opt?.toDate) > 0;
const isDayValidDate = isValidDate(day);
if (
isValidDate(day) &&
isDayValidDate &&
!(opt?.disableWeekends && isWeekend(day)) &&
!(opt?.disabled && dateMatchModifiers(day, opt.disabled))
) {
return {
isValidDate: false,
isInvalid: !isValidDate(day),
isValidDate: isDayValidDate,
isInvalid: !isDayValidDate,
isWeekend: opt?.disableWeekends && isWeekend(day),
isDisabled: opt?.disabled && dateMatchModifiers(day, opt.disabled),
isBefore,
@@ -134,7 +135,7 @@ const fromValidation = (day: Date, opt?: UseRangeDatepickerOptions) => {
}
if (isBefore || isAfter) {
return {
isValidDate: false,
isValidDate: isDayValidDate,
isBefore,
isAfter,
};
@@ -153,15 +154,16 @@ const toValidation = (
const isBeforeFrom =
(from && differenceInCalendarDays(from, day) > 0) ?? false;
const isDayValidDate = isValidDate(day);
if (
isValidDate(day) &&
isDayValidDate &&
!(opt?.disableWeekends && isWeekend(day)) &&
!(opt?.disabled && dateMatchModifiers(day, opt.disabled))
) {
return {
isValidDate: false,
isInvalid: !isValidDate(day),
isValidDate: isDayValidDate,
isInvalid: !isDayValidDate,
isWeekend: opt?.disableWeekends && isWeekend(day),
isDisabled: opt?.disabled && dateMatchModifiers(day, opt.disabled),
isBefore,
@@ -171,7 +173,7 @@ const toValidation = (
}
if (isBefore || isAfter || isBeforeFrom) {
return {
isValidDate: false,
isValidDate: isDayValidDate,
isBefore,
isAfter,
isBeforeFrom,
@@ -1,5 +1,5 @@
import React, { forwardRef } from "react";
import { BoxNew, type BoxNewProps } from "../../primitives/box";
import { Box, type BoxProps } from "../../primitives/box";
import { DismissableLayer } from "../../utils/components/dismissablelayer/DismissableLayer";
import { FocusBoundary } from "../../utils/components/focus-boundary/FocusBoundary";
import { FocusGuards } from "../../utils/components/focus-guards/FocusGuards";
@@ -203,7 +203,7 @@ const DialogPopupInternal = forwardRef<
!closeOnOutsideClick && event.preventDefault();
}}
>
<BoxNew
<Box
aria-labelledby={ariaLabelledbyProp ?? titleId}
id={id ?? popupId}
{...restProps}
@@ -233,7 +233,7 @@ const DialogPopupInternal = forwardRef<
function translateWidth(
width: DialogPopupInternalProps["width"],
position: DialogPosition,
): BoxNewProps["width"] {
): BoxProps["width"] {
if (position === "fullscreen") {
return undefined;
}
@@ -253,7 +253,7 @@ function translateWidth(
function translateHeight(
height: DialogPopupInternalProps["height"],
position: DialogPosition,
): BoxNewProps["height"] {
): BoxProps["height"] {
if (
position === "fullscreen" ||
position === "left" ||
@@ -52,7 +52,6 @@ const CheckboxInput = forwardRef<HTMLInputElement, CheckboxInputProps>(
fill="none"
focusable={false}
aria-hidden
role="presentation"
className="aksel-checkbox__icon"
>
<path
@@ -96,7 +96,7 @@ const SelectedOptionsProvider = ({
} else {
setSelectedOptions((oldSelectedOptions) =>
oldSelectedOptions.filter(
(selectedOption) => selectedOption !== option,
(selectedOption) => selectedOption.value !== option.value,
),
);
}
@@ -1,4 +1,4 @@
import { render, screen } from "@testing-library/react";
import { act, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import React from "react";
import { describe, expect, test, vi } from "vitest";
@@ -305,5 +305,33 @@ describe("Render combobox", () => {
await pressKey("PageUp");
hasVirtualFocus("apple");
});
test("should focus previously selected option when reopening with ArrowDown", async () => {
render(
<>
<App options={options} />
<button type="button">Outside</button>
</>,
);
const combobox = screen.getByRole("combobox", {
name: "Hva er dine favorittfrukter?",
});
await userEvent.click(combobox);
await userEvent.click(screen.getByRole("option", { name: "pear" }));
for (let i = 0; i < 3; i++) {
await userEvent.click(screen.getByRole("button", { name: "Outside" }));
act(() => combobox.focus());
expect(combobox).toHaveFocus();
await userEvent.keyboard("{ArrowDown}");
expect(combobox.getAttribute("aria-activedescendant")).toBe(
screen.getByRole("option", { name: "pear", selected: true }).id,
);
await userEvent.keyboard("{Escape}");
}
});
});
});
@@ -1,8 +1,9 @@
import React from "react";
import { BodyShort } from "../../typography";
import { omit } from "../../utils-external";
import { Dialog } from "../../dialog";
import { BodyShort, ErrorMessage } from "../../typography";
import { cl } from "../../utils/helpers";
import { useFormField } from "../useFormField";
import { useControllableState } from "../../utils/hooks";
import { type FormFieldProps, useFormField } from "../useFormField";
import { ComboboxField } from "./field/ComboboxField";
import { ComboboxFilter } from "./filter/ComboboxFilter";
import { ComboboxLabel } from "./label/ComboboxLabel";
@@ -19,52 +20,100 @@ import { ComboboxTrigger } from "./trigger/ComboboxTrigger";
interface ComboboxProps<
T extends ComboboxOptionData | ComboboxGroupData<ComboboxOptionData>,
> extends Omit<ComboboxRootProps<T>, "children"> {
>
extends
Omit<
ComboboxRootProps<T>,
"children" | "selectedOptions" | "onToggleOption"
>,
Partial<Pick<ComboboxRootProps<T>, "selectedOptions" | "onToggleOption">>,
Omit<FormFieldProps, "size"> {
label: string;
description?: string;
hideLabel?: boolean;
readOnly?: boolean;
//name?: string; // TODO: rendre hidden input med valgt(e) verdi(er) hvis satt.
} // TODO: trolig extend FormFieldProps
// TODO: extend React.HTMLAttributes<HTMLDivElement>
name?: string;
defaultSelectedOptions?: ComboboxRootProps<T>["selectedOptions"];
onSelectedOptionsChange?: (
newSelectedOptions: ComboboxRootProps<T>["selectedOptions"],
) => void;
}
function Combobox<
T extends ComboboxOptionData | ComboboxGroupData<ComboboxOptionData>,
>({
label,
hideLabel,
description,
name,
defaultSelectedOptions,
onSelectedOptionsChange,
size: sizeProp,
error,
errorId: errorIdProp,
disabled: disabledProp,
description,
id,
readOnly: readOnlyProp,
multiselect = false, // Default value should be synced with ComboboxRoot
selectedOptions: selectedOptionsProp,
onToggleOption: onToggleOptionProp,
...rest
}: ComboboxProps<T>) {
const {
inputProps,
//errorId,
//showErrorMsg,
//hasError,
errorId,
showErrorMsg,
hasError,
size,
inputDescriptionId,
readOnly,
} = useFormField(
{
description,
//disabled,
//error,
//errorId,
//id: rest.triggerId,
disabled: disabledProp,
error,
errorId: errorIdProp,
id,
readOnly: readOnlyProp,
size: sizeProp,
},
"combobox",
);
// TODO: Kunne være ukontrollert?
// TODO: Vurder å koble opp label her, slik at vi slipper å ha triggerId prop i ComboboxRoot.
const [selectedOptions, setSelectedOptions] = useControllableState({
defaultValue: defaultSelectedOptions || [],
value: selectedOptionsProp,
onChange: onSelectedOptionsChange,
});
const onToggleOption: ComboboxRootProps<T>["onToggleOption"] = (
option,
isSelected,
) => {
onToggleOptionProp?.(option, isSelected);
setSelectedOptions((prevSelectedOptions) => {
if (!multiselect) {
return [option.value];
}
if (isSelected) {
return [...prevSelectedOptions, option.value];
}
return prevSelectedOptions.filter((value) => value !== option.value);
});
};
return (
<ComboboxRoot size={size} triggerId={inputProps.id} {...rest}>
<ComboboxLabel hide={hideLabel} readOnly={readOnly}>
<ComboboxRoot
size={size}
disabled={inputProps.disabled}
multiselect={multiselect}
selectedOptions={selectedOptions}
onToggleOption={onToggleOption}
{...rest}
>
<ComboboxLabel
htmlFor={inputProps.id}
hide={hideLabel}
readOnly={readOnly}
>
{label}
</ComboboxLabel>
{!!description && (
@@ -80,10 +129,37 @@ function Combobox<
{description}
</BodyShort>
)}
<ComboboxTrigger readOnly={readOnly} {...omit(inputProps, ["id"])}>
<ComboboxField />
<ComboboxTrigger readOnly={readOnly} {...inputProps}>
<ComboboxField hasError={hasError} />
</ComboboxTrigger>
<ComboboxOverlay>
<div
className="aksel-form-field__error aksel-combobox2__error"
id={errorId}
aria-relevant="additions removals"
aria-live="polite"
>
{showErrorMsg && (
<ErrorMessage size={size} showIcon>
{error}
</ErrorMessage>
)}
</div>
{name &&
selectedOptions.map((value) => (
<input key={value} type="hidden" name={name} value={value} />
))}
<ComboboxOverlay
mobileHeader={
<Dialog.Header>
<Dialog.Title>{label}</Dialog.Title>
{!!description && (
<Dialog.Description>{description}</Dialog.Description>
)}
</Dialog.Header>
}
>
<ComboboxPopup>
<ComboboxFilter />
<ComboboxList />
@@ -1,6 +1,7 @@
import type { Meta, StoryFn } from "@storybook/react-vite";
import React, { useMemo, useState } from "react";
import { Button } from "../../button";
import { Dialog } from "../../dialog";
import { HStack, VStack } from "../../primitives/stack";
import { Select } from "../select";
import { Combobox, type ComboboxProps } from "./Combobox";
@@ -32,18 +33,28 @@ type MyOption = {
metadata?: string;
};
const countries: MyOption[] = [
const nordicCountries: MyOption[] = [
{ label: "Norge", value: "opt-1", metadata: "foo1" },
{ label: "Finland", value: "opt-2" },
{ label: "Sverige", value: "opt-3", metadata: "foo3" },
{ label: "Danmark", value: "opt-4" },
{ label: "Island", value: "opt-5" },
{ label: "Færøyene", value: "opt-6" },
{ label: "Åland", value: "opt-7" },
{ label: "Estland", value: "opt-8" },
{ label: "Latvia", value: "opt-9" },
{ label: "Litauen", value: "opt-10" },
{ label: "Grønland", value: "opt-6" },
{ label: "Færøyene", value: "opt-7" },
{ label: "Åland", value: "opt-8" },
];
const centralEuropeanCountries: MyOption[] = [
{ label: "Tyskland", value: "opt-9" },
{ label: "Østerrike", value: "opt-10" },
{ label: "Sveits", value: "opt-11" },
{ label: "Liechtenstein", value: "opt-12" },
{ label: "Polen", value: "opt-13" },
{ label: "Tsjekkia", value: "opt-14" },
{ label: "Slovakia", value: "opt-15" },
{ label: "Ungarn", value: "opt-16" },
{ label: "Slovenia", value: "opt-17" },
];
const countries: MyOption[] = [...nordicCountries, ...centralEuropeanCountries];
type MyGroup = {
label: string;
@@ -53,14 +64,14 @@ type MyGroup = {
const groupedCountries: (MyGroup | MyOption)[] = [
{
label: "Nordiske land",
label: "Norden",
id: "group-1",
options: countries.slice(0, 6),
options: nordicCountries,
},
{
label: "Baltiske land",
label: "Sentral-Europa",
id: "group-2",
options: countries.slice(6),
options: centralEuropeanCountries,
},
{ label: "Annet (ikke gruppert)", value: "opt-01" } satisfies MyOption,
];
@@ -73,111 +84,149 @@ type DefaultProps = Pick<
| "size"
| "defaultOpen"
| "multiselect"
| "triggerId"
| "id"
| "readOnly"
| "disabled"
| "error"
>;
export const Default: StoryFn<DefaultProps> = (props) => {
const [selectedOptions, setSelectedOptions] = useState<MyOption["value"][]>([
"opt-1",
]);
return (
<Combobox
defaultOpen
options={countries}
selectedOptions={selectedOptions}
onToggleOption={(option, newSelected) => {
setSelectedOptions((prev) =>
newSelected
? [...prev, option.value]
: prev.filter((v) => v !== option.value),
);
}}
{...props}
/>
);
return <Combobox defaultOpen options={countries} {...props} />;
};
Default.args = {
label: "Velg land",
description: "Landet hvor du er født.",
hideLabel: false,
defaultOpen: false,
//multiselect: true,
multiselect: false,
readOnly: false,
disabled: false,
error: "",
};
Default.argTypes = {
size: {
control: { type: "select" },
options: ["small", "medium"],
},
triggerId: {
id: {
control: { type: "text" },
},
};
function BaseCombobox<
function BasicCombobox<
T extends ComboboxOptionData | ComboboxGroupData<ComboboxOptionData> =
MyOption,
>(props: Partial<ComboboxProps<T>>) {
const [selectedOptions, setSelectedOptions] = useState(["opt-1"]);
return (
<Combobox
options={countries as T[]}
selectedOptions={selectedOptions}
onToggleOption={(option, newSelected) => {
setSelectedOptions((prev) =>
newSelected
? [...prev, option.value]
: prev.filter((v) => v !== option.value),
);
}}
defaultSelectedOptions={["opt-1"]}
label="Velg land"
description="Landet hvor du er født."
multiselect={false}
{...props}
/>
);
}
export const HideLabel = () => <BaseCombobox hideLabel />;
export const Small = () => <BasicCombobox size="small" error="Error" />;
export const ReadOnly = () => <BaseCombobox readOnly />;
export const Hidelabel = () => <BasicCombobox hideLabel />;
export const Readonly = () => <BasicCombobox readOnly />;
export const Disabled = () => <BasicCombobox disabled />;
export const ErrorStory = () => <BasicCombobox error="Du må velge et land." />;
ErrorStory.storyName = "Error";
export const DefaultOpen = () => <BasicCombobox defaultOpen />;
DefaultOpen.storyName = "DefaultOpen";
export const DefaultSelectedOptions = () => (
<BasicCombobox defaultSelectedOptions={["opt-1"]} />
);
DefaultSelectedOptions.storyName = "DefaultSelectedOptions";
export const Name = () => (
<form
onSubmit={(event) => {
event.preventDefault();
const formData = new FormData(event.target);
const land = formData.getAll("land");
console.log(land);
}}
>
<BasicCombobox name="land" />
<br />
<button type="submit">Submit</button>
</form>
);
export const Controlled = () => {
const [selectedOptions, setSelectedOptions] = useState<MyOption["value"][]>([
"opt-1",
]);
export const SingleSelect = () => {
const [selectedOption, setSelectedOption] = useState<MyOption>(countries[0]);
return (
<BaseCombobox
selectedOptions={[selectedOption.value]}
onToggleOption={(option) => setSelectedOption(option)}
multiselect={false}
/>
<VStack gap="space-8" minWidth="250px">
<Combobox
options={countries}
selectedOptions={selectedOptions}
onToggleOption={(option, newSelected) => {
setSelectedOptions((prev) =>
newSelected
? [...prev, option.value]
: prev.filter((v) => v !== option.value),
);
}}
label="Velg land"
/>
Selected: {selectedOptions.join(", ")}
<div>
<button type="button" onClick={() => setSelectedOptions([])}>
Clear
</button>
</div>
</VStack>
);
};
export const Groups = () => {
return (
<HStack gap="space-56" minHeight="300px">
<BaseCombobox
options={groupedCountries}
description="Landene du har statsborgerskap."
/>
export const Controlled2 = () => {
const [selectedOptions, setSelectedOptions] = useState<MyOption["value"][]>([
"opt-1",
]);
<BaseCombobox
options={groupedCountries}
description="Landene du har statsborgerskap."
size="small"
return (
<VStack gap="space-8" minWidth="250px">
<Combobox
options={countries}
selectedOptions={selectedOptions}
onSelectedOptionsChange={setSelectedOptions}
label="Velg land"
/>
</HStack>
Selected: {selectedOptions.join(", ")}
<div>
<button type="button" onClick={() => setSelectedOptions([])}>
Clear
</button>
</div>
</VStack>
);
};
export const Groups = () => (
<HStack gap="space-56" minHeight="300px">
<BasicCombobox options={groupedCountries} />
<BasicCombobox options={groupedCountries} size="small" />
</HStack>
);
type ManyOptionsProps = {
count: number;
};
export const ManyOptions: StoryFn<ManyOptionsProps> = ({ count }) => {
const [selectedOptions, setSelectedOptions] = useState(["opt-1"]);
const manyOptions = useMemo(
() =>
Array.from({ length: count }, (_, i) => ({
@@ -189,18 +238,7 @@ export const ManyOptions: StoryFn<ManyOptionsProps> = ({ count }) => {
return (
<div style={{ minHeight: "400px", width: "250px" }}>
<Combobox
options={manyOptions}
selectedOptions={selectedOptions}
onToggleOption={(option) => {
setSelectedOptions((prev) =>
prev.includes(option.value)
? prev.filter((v) => v !== option.value)
: [...prev, option.value],
);
}}
label="Test"
/>
<Combobox options={manyOptions} label="Test" />
</div>
);
};
@@ -212,6 +250,40 @@ ManyOptions.parameters = {
docs: { disable: true },
};
export const LongLabels = () => (
<div style={{ maxWidth: "300px" }}>
<ComboboxRoot
defaultOpen
options={[
{
id: "group-1",
label:
"Dette er en veldig lang label for å teste hvordan lange labels håndteres",
options: [
{
label:
"Dette er en veldig lang label for å teste hvordan dette håndteres",
value: "opt-1",
},
{
label:
"Dette er en veldig lang label for å teste hvordan dette håndteres",
value: "opt-2",
},
],
},
]}
selectedOptions={["opt-1"]}
onToggleOption={() => {}}
>
<ComboboxField />
<ComboboxPopup>
<ComboboxList />
</ComboboxPopup>
</ComboboxRoot>
</div>
);
export const Composition = () => {
const [selectedOptions, setSelectedOptions] = useState<MyOption["value"][]>([
"opt-1",
@@ -274,8 +346,8 @@ export const Composition = () => {
<VStack>
<ComboboxRoot {...rootProps}>
<ComboboxLabel>Velg land</ComboboxLabel>
<ComboboxTrigger>
<ComboboxLabel htmlFor="demo">Velg land</ComboboxLabel>
<ComboboxTrigger id="demo">
<Button>Med input og label</Button>
</ComboboxTrigger>
<ComboboxOverlay>
@@ -293,8 +365,8 @@ export const Composition = () => {
onToggleOption={setSelectedOption}
multiselect={false}
>
<ComboboxLabel>Velg land (single select)</ComboboxLabel>
<ComboboxTrigger>
<ComboboxLabel htmlFor="demo2">Velg land (single select)</ComboboxLabel>
<ComboboxTrigger id="demo2">
<ComboboxField />
</ComboboxTrigger>
<ComboboxOverlay>
@@ -306,8 +378,8 @@ export const Composition = () => {
</ComboboxRoot>
<ComboboxRoot {...rootProps}>
<ComboboxLabel>Velg land (multiselect)</ComboboxLabel>
<ComboboxTrigger>
<ComboboxLabel htmlFor="demo3">Velg land (multiselect)</ComboboxLabel>
<ComboboxTrigger id="demo3">
<ComboboxField />
</ComboboxTrigger>
<ComboboxOverlay>
@@ -322,9 +394,31 @@ export const Composition = () => {
};
Composition.parameters = { layout: "padded" };
export const Testing = () => {
const [selectedOption, setSelectedOption] = useState<MyOption>();
export const InDialog = () => {
return (
<Dialog defaultOpen>
<Dialog.Trigger>
<Button>Open dialog</Button>
</Dialog.Trigger>
<Dialog.Popup width="small">
<Dialog.Header>
<Dialog.Title>Dialog title</Dialog.Title>
<Dialog.Description>Dialog description</Dialog.Description>
</Dialog.Header>
<Dialog.Body>
<BasicCombobox />
</Dialog.Body>
<Dialog.Footer>
<Dialog.CloseTrigger>
<Button>Close dialog</Button>
</Dialog.CloseTrigger>
</Dialog.Footer>
</Dialog.Popup>
</Dialog>
);
};
export const Testing = () => {
return (
<VStack gap="space-32" width="300px">
<button type="button" onClick={() => console.log("Knapp før")}>
@@ -333,8 +427,6 @@ export const Testing = () => {
<Combobox
options={countries}
selectedOptions={selectedOption ? [selectedOption.value] : []}
onToggleOption={setSelectedOption}
multiselect={false}
label="Velg land (Combobox)"
description="Beskrivelse"
@@ -357,25 +449,37 @@ export const Testing = () => {
<option value="latvia">Latvia</option>
<option value="lithuania">Lithuania</option>
</Select>
<Select label="Mange alternativer (vanlig select)">
{Array.from({ length: 100 }, (_, i) => (
// biome-ignore lint/suspicious/noArrayIndexKey: Don't care
<option key={i} value={`opt-${i + 1}`}>
{`Option ${String(i + 1).padStart(4, "0")}`}
</option>
))}
</Select>
</VStack>
);
};
/* TODO:
- Fullskjerm på mobil
- Mobil: Vurder å ikke fokusere søkefelt automatisk.
- Mobil: Vurder å ikke ha virtuelt fokus i det hele tatt hvis man ikke har tastatur
Kan kanskje bruke media query, ev. ikke gi noe fokus før man begynner å trykke (som dagens CB. Sjekk hvordan SR takler at ingenting har virtuelt fokus.)
Sjekk om det er mulig å flytte virtuelt fokus uten tastatur (typ med skjermleser).
- Vurder om fokus skal låses til søkefelt (mest aktuelt ved multiselect).
- Åpne på pil ned (og ev. opp)?
- Vurder funksjoner fra gamle CB (ikke brukt: dropp, brukt lite: muliggjør med komposisjon, brukt mye: bygg inn støtte)
- allowNewValues (er dette ofte egentlig Autocomplete?)
- isLoading
- maxSelected
- Skal den hete noe annet enn Combobox?
- Vurder om Label og Description (og error?) skal være sub-komponenter eller ikke.
- Følge Combobox-pattern (mer)? Kan ikke følge det slavisk uansett.
Pil opp og ned velger
Ikke loop
- Skal den hete noe annet enn Combobox? Er jo på en måte ikke det...
- Vurder om fokus skal låses til søkefelt (mest aktuelt ved multiselect).
- Åpne på pil ned (og ev. opp)?
- PageUp/Down
- Error, disabled (?), readonly osv.
- Vurder hvilke funksjoner i gamle CB vi skal ta med (maks valg, legg til osv.)
- Tester
- A11y-sjekk
- A11y-sjekk (skjermleser, zoom, høykontrast...)
- Beslutningsloggen?
- Ikke wrappe options
Utfordringer med komposisjon:
@@ -387,9 +491,4 @@ Forslag: Tilby enkeltkomponent for de vanligste tilfellene, men også subkompone
Kan ev. ha slot/render-props for enkelte ting.
Kan ev. bruke children for å kunne bytte ut/skreddersy innholdet i popup.
Ressurser:
- https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
- https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/combobox_role
- https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/listbox_role
*/
@@ -20,31 +20,41 @@ const meta: Meta<typeof ComboboxRoot> = {
};
export default meta;
const countries = [
{ label: "Norge", value: "option-1" },
{ label: "Finland", value: "option-2" },
{ label: "Sverige", value: "option-3" },
{ label: "Danmark", value: "option-4" },
{ label: "Island", value: "option-5" },
{ label: "Færøyene", value: "option-6" },
{ label: "Åland", value: "option-7" },
{ label: "Estland", value: "option-8" },
{ label: "Latvia", value: "option-9" },
{ label: "Litauenm", value: "option-10" },
const nordicCountries = [
{ label: "Norge", value: "opt-1" },
{ label: "Finland", value: "opt-2" },
{ label: "Sverige", value: "opt-3" },
{ label: "Danmark", value: "opt-4" },
{ label: "Island", value: "opt-5" },
{ label: "Grønland", value: "opt-6" },
{ label: "Færøyene", value: "opt-7" },
{ label: "Åland", value: "opt-8" },
];
const centralEuropeanCountries = [
{ label: "Tyskland", value: "opt-9" },
{ label: "Østerrike", value: "opt-10" },
{ label: "Sveits", value: "opt-11" },
{ label: "Liechtenstein", value: "opt-12" },
{ label: "Polen", value: "opt-13" },
{ label: "Tsjekkia", value: "opt-14" },
{ label: "Slovakia", value: "opt-15" },
{ label: "Ungarn", value: "opt-16" },
{ label: "Slovenia", value: "opt-17" },
];
const countries = [...nordicCountries, ...centralEuropeanCountries];
const groupedOptions = [
{
label: "Nordiske land",
label: "Norden",
id: "group-1",
options: countries.slice(0, 6),
options: nordicCountries,
},
{
label: "Baltiske land",
label: "Sentral-Europa",
id: "group-2",
options: countries.slice(6),
options: centralEuropeanCountries,
},
{ label: "Ikke gruppert", value: "option-01" },
{ label: "Annet (ikke gruppert)", value: "opt-01" },
];
function BaseCombobox<
@@ -138,7 +148,7 @@ OptionMemoization.play = async ({ canvasElement }) => {
expect(Number(countElm.textContent)).toBe(expectedCount);
// Filtering should not re-render any options
// TODO: For this to work we must omit the filterString prop on ComboboxOption
// TODO: For this to work we must omit the highlightText prop on ComboboxOption
/*await userEvent.type(combobox, "nor", { delay: 200 });
expect(Number(countElm.textContent)).toBe(expectedCount);
expect(canvas.getAllByRole("option").length).toBe(1);*/
@@ -8,10 +8,11 @@ import {
interface ComboboxFieldProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
children?: React.ReactNode;
hasError?: boolean;
}
const ComboboxField = forwardRef<HTMLButtonElement, ComboboxFieldProps>(
({ children, ...rest }, ref) => {
({ children, hasError, ...rest }, ref) => {
const { options, selectedOptions, size } = useComboboxRootContext();
const labels = getLabels(selectedOptions, options);
@@ -21,6 +22,7 @@ const ComboboxField = forwardRef<HTMLButtonElement, ComboboxFieldProps>(
<button
type="button"
ref={ref}
data-error={hasError}
className={cl(
"aksel-combobox2__field-btn",
"aksel-body-short",
@@ -30,6 +30,7 @@ export const ComboboxFilter = (props: ComboboxFilterProps) => {
}
}}
aria-autocomplete="list"
inputMode="text"
/>
</Listbox.InputSlot>
</div>
Loaded 100 of 251 files, more files were not shown because too many files have changed in this diff. Show more