Merge pull request #9583 from prettier/next

This commit is contained in:
fisker Cheung authored and GitHub committed 2023-03-27 15:37:33 +08:00
commit 3b82a34366
2637 files changed
+73866 -61972

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
comment: off
comment: false
coverage:
status:
+4 -2
View File
@@ -7,9 +7,11 @@
/test*.*
/scripts/release/node_modules
/coverage/
/dist/
/dist*/
**/node_modules/**
/website/build/
/website/static/playground.js
/website/static/lib/
/vendors/
/scripts/benchmark/*/
**/.yarn/**
**/.pnp.*
+144 -42
View File
@@ -1,4 +1,5 @@
"use strict";
const path = require("node:path");
const { isCI } = require("ci-info");
module.exports = {
@@ -9,26 +10,26 @@ module.exports = {
},
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
reportUnusedDisableDirectives: true,
extends: ["eslint:recommended", "prettier"],
plugins: [
"prettier-internal-rules",
"import",
"n",
"regexp",
"unicorn",
"@typescript-eslint",
],
settings: {
"import/internal-regex": "^linguist-languages/",
},
rules: {
"@typescript-eslint/prefer-ts-expect-error": "error",
"arrow-body-style": ["error", "as-needed"],
curly: "error",
"dot-notation": "error",
eqeqeq: "error",
"logical-assignment-operators": "error",
"no-console": isCI ? "error" : "warn",
"no-constant-binary-expression": "error",
"no-duplicate-imports": "error",
"no-else-return": [
"error",
{
@@ -37,6 +38,7 @@ module.exports = {
],
"no-implicit-coercion": "error",
"no-inner-declarations": "error",
"no-lonely-if": "error",
"no-restricted-syntax": [
"error",
// `!foo === bar` and `!foo !== bar`
@@ -45,6 +47,13 @@ module.exports = {
"no-return-await": "error",
"no-unneeded-ternary": "error",
"no-useless-return": "error",
"no-unused-expressions": [
"error",
{
allowShortCircuit: true,
allowTernary: true,
},
],
"no-unused-vars": [
"error",
{
@@ -52,7 +61,13 @@ module.exports = {
},
],
"no-var": "error",
"object-shorthand": "error",
"object-shorthand": [
"error",
"always",
{
avoidExplicitReturnArrows: true,
},
],
"one-var": ["error", "never"],
"prefer-arrow-callback": "error",
"prefer-const": [
@@ -77,11 +92,10 @@ module.exports = {
enforceForRenamedProperties: false,
},
],
"prefer-object-has-own": "error",
"prefer-object-spread": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prettier-internal-rules/jsx-identifier-case": "error",
"prettier-internal-rules/no-identifier-n": "error",
quotes: [
"error",
"double",
@@ -90,7 +104,6 @@ module.exports = {
},
],
"require-await": "error",
strict: "error",
"symbol-description": "error",
yoda: [
"error",
@@ -100,23 +113,58 @@ module.exports = {
},
],
// Internal rules
"prettier-internal-rules/jsx-identifier-case": "error",
"prettier-internal-rules/no-identifier-n": "error",
"prettier-internal-rules/prefer-fs-promises-submodule": "error",
// @typescript-eslint/eslint-plugin
"@typescript-eslint/prefer-ts-expect-error": "error",
// eslint-plugin-import
"import/extensions": ["error", "ignorePackages"],
"import/no-extraneous-dependencies": [
"error",
{
devDependencies: ["tests*/**", "scripts/**"],
devDependencies: [
"jest.config.mjs",
"tests/**",
"scripts/**",
"website/**/*",
],
},
],
"import/order": "error",
"import/no-anonymous-default-export": "error",
"import/no-anonymous-default-export": [
"error",
{
allowArray: true,
allowArrowFunction: true,
allowAnonymousClass: false,
allowAnonymousFunction: false,
allowCallExpression: true,
// Unreleased
// allowNew: true,
allowLiteral: true,
allowObject: true,
},
],
// eslint-plugin-n
"n/no-path-concat": "error",
// eslint-plugin-regexp
"regexp/match-any": [
"error",
{
allows: ["dotAll"],
},
],
/* cspell:disable-next-line */
"regexp/no-extra-lookaround-assertions": "error",
"regexp/no-missing-g-flag": "error",
"regexp/no-unused-capturing-group": "error",
"regexp/no-useless-assertions": "error",
"regexp/no-useless-flag": [
"error",
{
@@ -124,14 +172,25 @@ module.exports = {
},
],
"regexp/no-useless-lazy": "error",
"regexp/no-useless-non-capturing-group": "error",
/* cspell:disable-next-line */
"regexp/prefer-lookaround": [
"error",
{
strictTypes: false,
},
],
// eslint-plugin-unicorn
"unicorn/better-regex": "error",
"unicorn/explicit-length-check": "error",
"unicorn/filename-case": "error",
"unicorn/new-for-builtins": "error",
"unicorn/no-array-for-each": "error",
"unicorn/no-array-push-push": "error",
"unicorn/no-lonely-if": "error",
"unicorn/no-new-array": "error",
"unicorn/no-typeof-undefined": "error",
"unicorn/no-unreadable-iife": "error",
"unicorn/no-useless-length-check": "error",
"unicorn/no-useless-promise-resolve-reject": "error",
@@ -144,28 +203,58 @@ module.exports = {
],
"unicorn/prefer-array-flat-map": "error",
"unicorn/prefer-array-some": "error",
"unicorn/prefer-at": [
"error",
{
getLastElementFunctions: ["getLast"],
},
],
"unicorn/prefer-export-from": [
"error",
{
ignoreUsedVariables: true,
},
],
"unicorn/prefer-includes": "error",
"unicorn/prefer-json-parse-buffer": "error",
"unicorn/prefer-logical-operator-over-ternary": "error",
"unicorn/prefer-module": "error",
"unicorn/prefer-native-coercion-functions": "error",
"unicorn/prefer-node-protocol": "error",
"unicorn/prefer-number-properties": "error",
"unicorn/prefer-optional-catch-binding": "error",
"unicorn/prefer-regexp-test": "error",
"unicorn/prefer-set-has": "error",
"unicorn/prefer-set-size": "error",
"unicorn/prefer-spread": "error",
"unicorn/prefer-string-replace-all": "error",
"unicorn/prefer-string-slice": "error",
"unicorn/prefer-string-starts-ends-with": "error",
"unicorn/prefer-switch": "error",
"unicorn/prefer-type-error": "error",
"unicorn/switch-case-braces": ["error", "avoid"],
"unicorn/template-indent": "error",
"unicorn/text-encoding-identifier-case": "error",
},
overrides: [
// CommonJS modules
{
files: [
"scripts/**/*.js",
"scripts/**/*.mjs",
"tests/config/install-prettier.js",
"**/*.cjs",
"scripts/tools/eslint-plugin-prettier-internal-rules/**/*.js",
"website/**/*.js",
],
parserOptions: {
sourceType: "script",
},
rules: {
strict: "error",
"unicorn/prefer-module": "off",
"unicorn/prefer-node-protocol": "off",
},
},
{
files: ["scripts/**/*", "tests/config/install-prettier.js"],
rules: {
"no-console": "off",
},
@@ -178,23 +267,11 @@ module.exports = {
},
{
files: [
"**/*.mjs",
"scripts/release/**/*.js",
"scripts/tools/bundle-test/**/*.js",
],
parserOptions: {
sourceType: "module",
},
rules: {
"unicorn/prefer-module": "error",
"unicorn/prefer-node-protocol": "error",
},
},
{
files: [
"tests/format/**/jsfmt.spec.js",
"tests/config/**/*.js",
"tests/format/**/jsfmt.spec.js",
"tests/integration/**/*.js",
"tests/unit/**/*.js",
"tests/dts/unit/**/*.js",
"scripts/release/__tests__/**/*.spec.js",
],
env: {
@@ -211,6 +288,12 @@ module.exports = {
"jest/prefer-to-be": "error",
},
},
{
files: ["tests/format/**/*.js"],
rules: {
"prettier-internal-rules/no-legacy-format-test-fixtures": "error",
},
},
{
files: ["tests/integration/**/*.js"],
rules: {
@@ -220,22 +303,33 @@ module.exports = {
{
files: ["tests/**/*.js"],
rules: {
strict: "off",
// TODO: Enable this when we drop support for Node.js v14
"logical-assignment-operators": "off",
"unicorn/prefer-array-flat": "off",
"unicorn/prefer-array-flat-map": "off",
"unicorn/prefer-string-replace-all": "off",
},
globals: {
run_spec: false,
run_spec: "readonly",
runPrettier: "readonly",
},
},
{
files: ["src/cli/*.js"],
files: ["src/cli/**/*.js"],
rules: {
"no-restricted-modules": [
"n/no-restricted-import": [
"error",
{
patterns: ["../"],
},
[
{
name: [
path.resolve(__dirname, "src/**"),
`!${path.resolve(__dirname, "src/cli/**")}`,
`!${path.resolve(__dirname, "src/index.js")}`,
`!${path.resolve(__dirname, "src/common/third-party.js")}`,
],
message: "Don't use code from other directory.",
},
],
],
},
},
@@ -260,15 +354,15 @@ module.exports = {
{
files: "src/**/*.js",
rules: {
"prettier-internal-rules/consistent-negative-index-access": "error",
"prettier-internal-rules/flat-ast-path-call": "error",
"prettier-internal-rules/no-conflicting-comment-check-flags": "error",
"prettier-internal-rules/no-doc-builder-concat": "error",
"prettier-internal-rules/no-doc-public-import": "error",
"prettier-internal-rules/no-empty-flat-contents-for-if-break": "error",
"prettier-internal-rules/no-unnecessary-ast-path-call": "error",
"prettier-internal-rules/prefer-ast-path-each": "error",
"prettier-internal-rules/prefer-indent-if-break": "error",
"prettier-internal-rules/prefer-is-non-empty-array": "error",
"prettier-internal-rules/prefer-ast-path-getters": "error",
},
},
{
@@ -279,6 +373,7 @@ module.exports = {
},
{
files: ["src/language-js/**/*.js"],
excludedFiles: ["src/language-js/parse/postprocess/*.js"],
rules: {
"prettier-internal-rules/no-node-comments": [
"error",
@@ -287,11 +382,18 @@ module.exports = {
functions: ["hasComment", "getComments"],
},
"src/language-js/pragma.js",
"src/language-js/parse/postprocess/*.js",
"src/language-js/parse/babel.js",
"src/language-js/parse/meriyah.js",
"src/language-js/parse/json.js",
"src/language-js/parse/acorn.js",
"src/language-js/parse/utils/wrap-babel-expression.js",
],
"prettier-internal-rules/prefer-create-type-check-function": [
"error",
{
ignoreSingleType: true,
onlyTopLevelFunctions: true,
},
],
},
},
@@ -304,11 +406,10 @@ module.exports = {
extends: ["plugin:react/recommended"],
settings: {
react: {
version: "17",
version: "18",
},
},
rules: {
"import/no-extraneous-dependencies": "off",
"react/display-name": "off",
"react/no-deprecated": "off",
"react/prop-types": "off",
@@ -322,12 +423,13 @@ module.exports = {
},
},
{
files: ["bin/prettier.js"],
files: ["bin/prettier.cjs"],
parserOptions: {
ecmaVersion: 5,
},
rules: {
"no-var": "off",
"prefer-arrow-callback": "off",
},
},
],
+4
View File
@@ -76,3 +76,7 @@ b585bd6fa4d750a98e277303c428edfc48fea3f4
f8c5b1fd1da4d67bc09d12bc3411b70d0fa4f4a1
b6225788966a4a6b49e652044337436642dcd627
7ad515111e79a3f304d5480d6586314222052333
# Reverted changes to the printer (#13210 #13104)
cdb149417068f3de364fd8db5e9baaf9d2ff4f8c
8dae4abf41e1ccec3515e8acea159505bbd55f33
+3
View File
@@ -0,0 +1,3 @@
name: "CodeQL config"
paths-ignore:
- tests/format
+33
View File
@@ -0,0 +1,33 @@
name: Build
on:
workflow_call:
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.5.0
- name: Setup Node.js
uses: actions/setup-node@v3.6.0
with:
cache: "yarn"
- name: Install Dependencies
run: yarn install --immutable
- name: Build Package
run: yarn build --clean
- name: Upload Artifact
uses: actions/upload-artifact@v3.1.2
with:
name: dist
path: dist
if-no-files-found: error
+19 -28
View File
@@ -10,55 +10,46 @@ on:
# This workflow file
- ".github/workflows/bundler-friendly.yml"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
if: github.event_name != 'schedule' || github.repository == 'prettier/prettier'
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: "yarn"
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Build Package
run: yarn build
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
uses: ./.github/workflows/_build.yml
webpack:
if: github.event_name != 'schedule' || github.repository == 'prettier/prettier'
name: Bundle Prettier with webpack
runs-on: ubuntu-latest
needs: [build]
defaults:
run:
working-directory: scripts/tools/bundle-test
steps:
- name: Checkout
uses: actions/checkout@v2.4.0
uses: actions/checkout@v3.5.0
- name: Setup Node.js
uses: actions/setup-node@v2.5.1
uses: actions/setup-node@v3.6.0
with:
cache: "yarn"
- name: Install Dependencies
run: yarn install --immutable
- name: Download Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v3.0.2
with:
name: dist
path: dist
- name: Install Dependencies
run: yarn install --frozen-lockfile
run: yarn install --immutable
working-directory: scripts/tools/bundle-test
- name: Test
run: yarn test
working-directory: scripts/tools/bundle-test
+11 -4
View File
@@ -3,24 +3,31 @@ name: Check Sizes
on:
pull_request:
permissions:
contents: read
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-sizes:
name: Check Sizes
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v3.5.0
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v3.6.0
with:
cache: "yarn"
# This step calls `git reset`
# It should be the last step
- name: Check Sizes
uses: preactjs/compressed-size-action@2.5.0
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
pattern: "./dist/**/*"
compression: none
build-script: "build --clean"
+40
View File
@@ -0,0 +1,40 @@
name: CodeQL
on:
push:
branches:
- main
- patch-release
- next
- "!renovate/**"
pull_request:
branches:
- main
- patch-release
- next
- "!renovate/**"
permissions:
actions: read
contents: read
security-events: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.5.0
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
config-file: ./.github/codeql/codeql-config.yml
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
+14 -6
View File
@@ -12,6 +12,13 @@ on:
- ".github/workflows/dev-package-test.yml"
- "tests/config/install-prettier.js"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
if: github.event_name != 'schedule' || github.repository == 'prettier/prettier'
@@ -23,10 +30,11 @@ jobs:
- "ubuntu-latest"
node:
# Run tests on minimal version we support
- "14"
- "16"
NPM_CLIENT:
- "yarn"
- "npm"
# Disabled temporarily #13151
# - "npm"
- "pnpm"
env:
INSTALL_PACKAGE: true
@@ -35,20 +43,20 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v3.5.0
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ matrix.node }}
cache: "yarn"
- name: Install Dependencies
run: yarn install --frozen-lockfile
run: yarn install --immutable
- name: Install Client Package
if: ${{ matrix.NPM_CLIENT == 'pnpm' }}
run: npm install --global pnpm
- name: Run Tests
run: yarn test:dev-package --maxWorkers=2
run: yarn test:dev-package
+21 -24
View File
@@ -5,8 +5,16 @@ on:
branches:
- main
- patch-release
- next
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
timeout-minutes: 60
@@ -18,9 +26,9 @@ jobs:
- "macos-latest"
- "windows-latest"
node:
- "19"
- "18"
- "16"
- "14"
include:
# only enable coverage on the fastest job
- os: "ubuntu-latest"
@@ -30,9 +38,9 @@ jobs:
CHECK_TEST_PARSERS: true
exclude:
- os: "macos-latest"
node: "16"
node: "19"
- os: "windows-latest"
node: "16"
node: "19"
env:
ENABLE_CODE_COVERAGE: ${{ matrix.ENABLE_CODE_COVERAGE }}
FULL_TEST: ${{ matrix.FULL_TEST }}
@@ -41,7 +49,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v3.5.0
- name: Setup Node.js
uses: actions/setup-node@v3
@@ -50,30 +58,19 @@ jobs:
cache: "yarn"
- name: Install Dependencies
run: yarn install --frozen-lockfile
run: yarn install --immutable
- name: Run Tests (macOS)
if: ${{ matrix.os == 'macos-latest' }}
run: yarn test --maxWorkers=4
- name: Run Tests
if: ${{ !matrix.ENABLE_CODE_COVERAGE }}
run: yarn test
- name: Run Tests (Linux and Windows)
if: ${{ matrix.os != 'macos-latest' }}
run: yarn test --maxWorkers=2
- name: Run Tests (coverage)
if: ${{ matrix.ENABLE_CODE_COVERAGE }}
run: yarn c8 yarn test
- name: Upload Coverage
uses: codecov/codecov-action@v3.1.0
if: ${{ matrix.ENABLE_CODE_COVERAGE }}
with:
fail_ci_if_error: true
# #8073 test
- name: Run Tests (PRETTIER_FALLBACK_RESOLVE)
run: yarn test "tests/integration/__tests__/(config|plugin)"
env:
PRETTIER_FALLBACK_RESOLVE: true
- name: Upload Coverage (PRETTIER_FALLBACK_RESOLVE)
uses: codecov/codecov-action@v3.1.0
uses: codecov/codecov-action@v3.1.1
if: ${{ matrix.ENABLE_CODE_COVERAGE }}
with:
fail_ci_if_error: true
files: coverage/lcov.info
+14 -3
View File
@@ -2,6 +2,10 @@ name: Internal_ESLint_Rules_Test
on:
push:
branches:
- main
- patch-release
- next
paths:
- "scripts/tools/eslint-plugin-prettier-internal-rules/**"
# This workflow file
@@ -12,21 +16,28 @@ on:
# This workflow file
- ".github/workflows/eslint-rules.yml"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v3.5.0
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v3.6.0
with:
cache: "yarn"
- name: Install Dependencies
run: yarn install --frozen-lockfile
run: yarn install --immutable
- name: Test
run: cd scripts/tools/eslint-plugin-prettier-internal-rules && yarn test-coverage
+53 -6
View File
@@ -5,23 +5,31 @@ on:
branches:
- main
- patch-release
- next
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v3.5.0
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v3.6.0
with:
cache: "yarn"
- name: Install Dependencies
run: yarn install --frozen-lockfile
run: yarn install --immutable
- name: Check Dependencies
run: yarn lint:deps
@@ -41,11 +49,50 @@ jobs:
- name: Lint Changelog
run: yarn lint:changelog
- name: Lint docs code block
# TODO: Lint files in `website/versioned_docs/version-stable` too
run: yarn "docs/**/*.md"
env:
# Make Prettier throws on embeded format
PRETTIER_DEBUG: true
- name: Lint workflow files
run: yarn lint:actionlint
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color
shell: bash
- name: Validate renovate config
run: npx --package renovate -c renovate-config-validator
- name: Check Lock File Changes
run: yarn && echo "Listing changed files:" && git diff --name-only --exit-code && echo "No files changed during lint."
- name: Run yarn (/)
run: |
yarn
yarn dedupe --check
- name: Run yarn (/website)
run: |
yarn
yarn dedupe --check
working-directory: website
- name: Run yarn (/scripts/release)
run: |
yarn
yarn dedupe --check
working-directory: scripts/release
- name: Run yarn (/scripts/tools/bundle-test)
run: |
yarn
yarn dedupe --check
working-directory: scripts/tools/bundle-test
- name: Run yarn (/scripts/tools/eslint-plugin-prettier-internal-rules)
run: |
yarn
yarn dedupe --check
working-directory: scripts/tools/eslint-plugin-prettier-internal-rules
- name: Check File Changes
run: echo "Listing changed files:" && git diff --name-only --exit-code && echo "No files changed during lint."
+4 -1
View File
@@ -5,12 +5,15 @@ on:
# “At 00:00.” https://crontab.guru/#0_0_*_*_*
- cron: "0 0 * * *"
permissions:
issues: write
jobs:
lock:
if: github.event_name != 'schedule' || github.repository == 'prettier/prettier'
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v3
- uses: dessant/lock-threads@v4
with:
# https://github.com/dessant/lock-threads
github-token: ${{ github.token }}
+4 -1
View File
@@ -5,12 +5,15 @@ on:
types:
- created
permissions:
issues: write
jobs:
mark-duplicate:
runs-on: ubuntu-latest
if: ${{ !github.event.issue.pull_request && startsWith(github.event.comment.body, 'Duplicate of ') }}
steps:
- uses: actions-cool/issues-helper@v3
- uses: actions-cool/issues-helper@v3.4.0
with:
actions: "mark-duplicate"
token: ${{ secrets.GITHUB_TOKEN }}
+9 -2
View File
@@ -5,13 +5,20 @@ on:
paths:
- "website/data/users.yml"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
prevent-add-users:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3.5.0
- name: Prevent file change
uses: xalvarez/prevent-file-change-action@v1
uses: xalvarez/prevent-file-change-action@v1.3.1
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
pattern: website/data/users.yml
+30 -68
View File
@@ -5,32 +5,20 @@ on:
branches:
- main
- patch-release
- next
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: "yarn"
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Build Package
run: yarn build
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
uses: ./.github/workflows/_build.yml
lint:
name: Lint
@@ -38,18 +26,18 @@ jobs:
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v3.5.0
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v3.6.0
with:
cache: "yarn"
- name: Install Dependencies
run: yarn install --frozen-lockfile
run: yarn install --immutable
- name: Download Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v3.0.2
with:
name: dist
path: dist
@@ -67,28 +55,23 @@ jobs:
- "macos-latest"
- "windows-latest"
node:
- "19"
- "18"
- "16"
- "14"
- "12"
- "10"
include:
- os: "ubuntu-latest"
node: "18"
FULL_TEST: true
exclude:
- os: "macos-latest"
node: "16"
- os: "macos-latest"
node: "14"
- os: "macos-latest"
node: "12"
node: "19"
- os: "windows-latest"
node: "19"
- os: "macos-latest"
node: "16"
- os: "windows-latest"
node: "14"
- os: "windows-latest"
node: "12"
node: "16"
env:
FULL_TEST: ${{ matrix.FULL_TEST }}
name: Node.js ${{ matrix.node }} on ${{ matrix.os }}
@@ -96,49 +79,28 @@ jobs:
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v3.5.0
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ matrix.node }}
cache: "yarn"
- name: Config `ignore-engines=true` (Node.js < 14)
if: ${{ matrix.node == '10' || matrix.node == '12' }}
run: yarn config set ignore-engines true
- name: Install Dependencies
run: yarn install --frozen-lockfile
run: yarn install --immutable
- name: Download Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v3.0.2
with:
name: dist
path: dist
- name: Run Tests (macOS)
if: ${{ matrix.os == 'macos-latest' }}
run: yarn test:dist --maxWorkers=4
- name: Run Tests
run: yarn test:dist
- name: Run Tests (Linux and Windows)
if: ${{ matrix.os != 'macos-latest' }}
run: yarn test:dist --maxWorkers=2
- name: Run Tests (standalone) (macOS)
if: ${{ matrix.os == 'macos-latest' }}
run: yarn test:dist-standalone --maxWorkers=4
- name: Run Tests (standalone) (Linux and Windows)
if: ${{ matrix.os != 'macos-latest' }}
run: yarn test:dist-standalone --maxWorkers=2
# #8073 test
- name: Run Tests (PRETTIER_FALLBACK_RESOLVE)
run: yarn test "tests/integration/__tests__/(config|plugin)"
env:
NODE_ENV: production
PRETTIER_FALLBACK_RESOLVE: true
- name: Run Format Tests (standalone)
run: yarn test:dist-standalone
cli:
name: CLI
@@ -146,15 +108,15 @@ jobs:
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v2.4.0
uses: actions/checkout@v3.5.0
- name: Setup Node.js
uses: actions/setup-node@v2.5.1
uses: actions/setup-node@v3.6.0
with:
node-version: "0.10.48"
- name: Download Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v3.0.2
with:
name: dist
path: dist
@@ -163,4 +125,4 @@ jobs:
run: node -v | grep "v0.10.48" || exit 1
- name: Run CLI on Node.js v0.10.48
run: node dist/bin-prettier --version 2>&1 >/dev/null | grep "prettier requires at least version 10.13.0 of Node, please upgrade" || exit 1
run: node dist/bin/prettier.cjs --version 2>&1 >/dev/null | grep "prettier requires at least version 14 of Node, please upgrade" || exit 1
+15 -3
View File
@@ -4,8 +4,19 @@ defaults:
run:
working-directory: scripts/release
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
- patch-release
- next
paths:
- "scripts/release/**"
- ".github/workflows/release-script-test.yml"
@@ -20,15 +31,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v3.5.0
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v3.6.0
with:
node-version: "18"
cache: "yarn"
- name: Install Dependencies
run: yarn install --frozen-lockfile
run: yarn install --immutable
- name: Test
run: yarn test
+4 -1
View File
@@ -4,11 +4,14 @@ on:
issues:
types: [labeled, unlabeled, reopened]
permissions:
issues: write
jobs:
support:
runs-on: ubuntu-latest
steps:
- uses: dessant/support-requests@v2
- uses: dessant/support-requests@v3.0.0
with:
github-token: ${{ github.token }}
support-label: "type:question"
-31
View File
@@ -1,31 +0,0 @@
name: Validate_Vendors
on:
push:
branches:
- main
- patch-release
paths:
- "package.json"
pull_request:
paths:
- "package.json"
jobs:
validate-vendor-versions:
name: Validate Vendor Versions
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: "yarn"
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Validate Vendors
run: yarn run vendors:bundle && echo "Listing changed files:" && git diff --name-only --exit-code && echo "No files changed."
+6 -2
View File
@@ -11,7 +11,7 @@
/errors
/test*.*
/.vscode
/dist
/dist*
/website/build
/website/i18n
/website/static/playground.js
@@ -25,9 +25,13 @@ package-lock.json
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
**/.pnp.*
.nyc_output
.devcontainer
.node-version
# When installing software on gitpod.io, `core.*` files are generated
/core.*
# Temporarily ignore these files to avoid conflicts between next and main branch
/vendors
/scripts/vendors
+20 -4
View File
@@ -1,14 +1,30 @@
.tmp
dist/
.cache/
coverage/
.nyc_output/
**/.yarn/**
**/.pnp.*
/dist*/
node_modules/
/tests/format/**/*.*
!/tests/format/**/jsfmt.spec.js
/tests/integration/cli/
/tests/integration/plugins/
/tests/integration/plugins/**/*.*
!/tests/integration/plugins/automatic/node_modules/@prettier/plugin-foo/index.js
!/tests/integration/plugins/automatic/node_modules/@user/prettier-plugin-foobar/index.js
!/tests/integration/plugins/automatic/node_modules/prettier-plugin-bar/index.js
!/tests/integration/plugins/automatic/package.json
!/tests/integration/plugins/automatic/prettier-plugin-bar.js
!/tests/integration/plugins/bespoke/node_modules/@company/prettier-plugin-bespoke/main.js
!/tests/integration/plugins/defaultOptions/plugin.cjs
!/tests/integration/plugins/extensions/plugin.cjs
!/tests/integration/plugins/flushLineSuffix/plugin.cjs
!/tests/integration/plugins/options-string/plugin.cjs
!/tests/integration/plugins/options/plugin.cjs
!/tests/integration/plugins/preprocess/plugin.cjs
/tests/integration/custom-parsers/
/website/build/
/website/static/lib/
/website/static/playground.js
.nyc_output
/vendors/
+873
View File
@@ -0,0 +1,873 @@
#!/usr/bin/env node
/* eslint-disable */
//prettier-ignore
(()=>{var Qge=Object.create;var AS=Object.defineProperty;var bge=Object.getOwnPropertyDescriptor;var Sge=Object.getOwnPropertyNames;var vge=Object.getPrototypeOf,xge=Object.prototype.hasOwnProperty;var J=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var Pge=(r,e)=>()=>(r&&(e=r(r=0)),e);var w=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ut=(r,e)=>{for(var t in e)AS(r,t,{get:e[t],enumerable:!0})},Dge=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Sge(e))!xge.call(r,n)&&n!==t&&AS(r,n,{get:()=>e[n],enumerable:!(i=bge(e,n))||i.enumerable});return r};var Pe=(r,e,t)=>(t=r!=null?Qge(vge(r)):{},Dge(e||!r||!r.__esModule?AS(t,"default",{value:r,enumerable:!0}):t,r));var QK=w((GXe,BK)=>{BK.exports=wK;wK.sync=Zge;var IK=J("fs");function Xge(r,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var i=0;i<t.length;i++){var n=t[i].toLowerCase();if(n&&r.substr(-n.length).toLowerCase()===n)return!0}return!1}function yK(r,e,t){return!r.isSymbolicLink()&&!r.isFile()?!1:Xge(e,t)}function wK(r,e,t){IK.stat(r,function(i,n){t(i,i?!1:yK(n,r,e))})}function Zge(r,e){return yK(IK.statSync(r),r,e)}});var PK=w((YXe,xK)=>{xK.exports=SK;SK.sync=_ge;var bK=J("fs");function SK(r,e,t){bK.stat(r,function(i,n){t(i,i?!1:vK(n,e))})}function _ge(r,e){return vK(bK.statSync(r),e)}function vK(r,e){return r.isFile()&&$ge(r,e)}function $ge(r,e){var t=r.mode,i=r.uid,n=r.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),l=parseInt("010",8),c=parseInt("001",8),u=a|l,g=t&c||t&l&&n===o||t&a&&i===s||t&u&&s===0;return g}});var kK=w((qXe,DK)=>{var jXe=J("fs"),sI;process.platform==="win32"||global.TESTING_WINDOWS?sI=QK():sI=PK();DK.exports=SS;SS.sync=efe;function SS(r,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){SS(r,e||{},function(s,o){s?n(s):i(o)})})}sI(r,e||{},function(i,n){i&&(i.code==="EACCES"||e&&e.ignoreErrors)&&(i=null,n=!1),t(i,n)})}function efe(r,e){try{return sI.sync(r,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var MK=w((JXe,OK)=>{var vg=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",RK=J("path"),tfe=vg?";":":",FK=kK(),NK=r=>Object.assign(new Error(`not found: ${r}`),{code:"ENOENT"}),LK=(r,e)=>{let t=e.colon||tfe,i=r.match(/\//)||vg&&r.match(/\\/)?[""]:[...vg?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],n=vg?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=vg?n.split(t):[""];return vg&&r.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:i,pathExt:s,pathExtExe:n}},TK=(r,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:i,pathExt:n,pathExtExe:s}=LK(r,e),o=[],a=c=>new Promise((u,g)=>{if(c===i.length)return e.all&&o.length?u(o):g(NK(r));let f=i[c],h=/^".*"$/.test(f)?f.slice(1,-1):f,p=RK.join(h,r),C=!h&&/^\.[\\\/]/.test(r)?r.slice(0,2)+p:p;u(l(C,c,0))}),l=(c,u,g)=>new Promise((f,h)=>{if(g===n.length)return f(a(u+1));let p=n[g];FK(c+p,{pathExt:s},(C,y)=>{if(!C&&y)if(e.all)o.push(c+p);else return f(c+p);return f(l(c,u,g+1))})});return t?a(0).then(c=>t(null,c),t):a(0)},rfe=(r,e)=>{e=e||{};let{pathEnv:t,pathExt:i,pathExtExe:n}=LK(r,e),s=[];for(let o=0;o<t.length;o++){let a=t[o],l=/^".*"$/.test(a)?a.slice(1,-1):a,c=RK.join(l,r),u=!l&&/^\.[\\\/]/.test(r)?r.slice(0,2)+c:c;for(let g=0;g<i.length;g++){let f=u+i[g];try{if(FK.sync(f,{pathExt:n}))if(e.all)s.push(f);else return f}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw NK(r)};OK.exports=TK;TK.sync=rfe});var UK=w((WXe,vS)=>{"use strict";var KK=(r={})=>{let e=r.env||process.env;return(r.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};vS.exports=KK;vS.exports.default=KK});var jK=w((zXe,YK)=>{"use strict";var HK=J("path"),ife=MK(),nfe=UK();function GK(r,e){let t=r.options.env||process.env,i=process.cwd(),n=r.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(r.options.cwd)}catch{}let o;try{o=ife.sync(r.command,{path:t[nfe({env:t})],pathExt:e?HK.delimiter:void 0})}catch{}finally{s&&process.chdir(i)}return o&&(o=HK.resolve(n?r.options.cwd:"",o)),o}function sfe(r){return GK(r)||GK(r,!0)}YK.exports=sfe});var qK=w((VXe,PS)=>{"use strict";var xS=/([()\][%!^"`<>&|;, *?])/g;function ofe(r){return r=r.replace(xS,"^$1"),r}function afe(r,e){return r=`${r}`,r=r.replace(/(\\*)"/g,'$1$1\\"'),r=r.replace(/(\\*)$/,"$1$1"),r=`"${r}"`,r=r.replace(xS,"^$1"),e&&(r=r.replace(xS,"^$1")),r}PS.exports.command=ofe;PS.exports.argument=afe});var WK=w((XXe,JK)=>{"use strict";JK.exports=/^#!(.*)/});var VK=w((ZXe,zK)=Line truncated
`,Rn=me(`\\
`,!1),rs=function(){return""},is="\\",gt=me("\\",!1),wo=/^[\\$"`]/,At=Je(["\\","$",'"',"`"],!1,!1),an=function(m){return m},S="\\a",Tt=me("\\a",!1),ug=function(){return"a"},Fl="\\b",Qp=me("\\b",!1),bp=function(){return"\b"},Sp=/^[Ee]/,vp=Je(["E","e"],!1,!1),xp=function(){return"\x1B"},G="\\f",yt=me("\\f",!1),EA=function(){return"\f"},Ji="\\n",Nl=me("\\n",!1),Xe=function(){return`
`},fa="\\r",gg=me("\\r",!1),FE=function(){return"\r"},Pp="\\t",NE=me("\\t",!1),ar=function(){return" "},Fn="\\v",Ll=me("\\v",!1),Dp=function(){return"\v"},Ms=/^[\\'"?]/,ha=Je(["\\","'",'"',"?"],!1,!1),An=function(m){return String.fromCharCode(parseInt(m,16))},Te="\\x",fg=me("\\x",!1),Tl="\\u",Ks=me("\\u",!1),Ol="\\U",IA=me("\\U",!1),hg=function(m){return String.fromCodePoint(parseInt(m,16))},pg=/^[0-7]/,pa=Je([["0","7"]],!1,!1),da=/^[0-9a-fA-f]/,rt=Je([["0","9"],["a","f"],["A","f"]],!1,!1),Bo=nt(),yA="-",Ml=me("-",!1),Us="+",Kl=me("+",!1),LE=".",kp=me(".",!1),dg=function(m,b,N){return{type:"number",value:(m==="-"?-1:1)*parseFloat(b.join("")+"."+N.join(""))}},Rp=function(m,b){return{type:"number",value:(m==="-"?-1:1)*parseInt(b.join(""))}},TE=function(m){return{type:"variable",...m}},Ul=function(m){return{type:"variable",name:m}},OE=function(m){return m},Cg="*",wA=me("*",!1),Rr="/",ME=me("/",!1),Hs=function(m,b,N){return{type:b==="*"?"multiplication":"division",right:N}},Gs=function(m,b){return b.reduce((N,U)=>({left:N,...U}),m)},mg=function(m,b,N){return{type:b==="+"?"addition":"subtraction",right:N}},BA="$((",R=me("$((",!1),q="))",Ce=me("))",!1),Ke=function(m){return m},Re="$(",ze=me("$(",!1),dt=function(m){return m},Ft="${",Nn=me("${",!1),qb=":-",S1=me(":-",!1),v1=function(m,b){return{name:m,defaultValue:b}},Jb=":-}",x1=me(":-}",!1),P1=function(m){return{name:m,defaultValue:[]}},Wb=":+",D1=me(":+",!1),k1=function(m,b){return{name:m,alternativeValue:b}},zb=":+}",R1=me(":+}",!1),F1=function(m){return{name:m,alternativeValue:[]}},Vb=function(m){return{name:m}},N1="$",L1=me("$",!1),T1=function(m){return e.isGlobPattern(m)},O1=function(m){return m},Xb=/^[a-zA-Z0-9_]/,Zb=Je([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),_b=function(){return T()},$b=/^[$@*?#a-zA-Z0-9_\-]/,eS=Je(["$","@","*","?","#",["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),M1=/^[(){}<>$|&; \t"']/,Eg=Je(["(",")","{","}","<",">","$","|","&",";"," "," ",'"',"'"],!1,!1),tS=/^[<>&; \t"']/,rS=Je(["<",">","&",";"," "," ",'"',"'"],!1,!1),KE=/^[ \t]/,UE=Je([" "," "],!1,!1),Q=0,Me=0,QA=[{line:1,column:1}],d=0,E=[],I=0,k;if("startRule"in e){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');n=i[e.startRule]}function T(){return r.substring(Me,Q)}function Z(){return Et(Me,Q)}function te(m,b){throw b=b!==void 0?b:Et(Me,Q),Ri([lt(m)],r.substring(Me,Q),b)}function Be(m,b){throw b=b!==void 0?b:Et(Me,Q),Ln(m,b)}function me(m,b){return{type:"literal",text:m,ignoreCase:b}}function Je(m,b,N){return{type:"class",parts:m,inverted:b,ignoreCase:N}}function nt(){return{type:"any"}}function wt(){return{type:"end"}}function lt(m){return{type:"other",description:m}}function it(m){var b=QA[m],N;if(b)return b;for(N=m-1;!QA[N];)N--;for(b=QA[N],b={line:b.line,column:b.column};N<m;)r.charCodeAt(N)===10?(b.line++,b.column=1):b.column++,N++;return QA[m]=b,b}function Et(m,b){var N=it(m),U=it(b);return{start:{offset:m,line:N.line,column:N.column},end:{offset:b,line:U.line,column:U.column}}}function Qe(m){Q<d||(Q>d&&(d=Q,E=[]),E.push(m))}function Ln(m,b){return new Wl(m,null,null,b)}function Ri(m,b,N){return new Wl(Wl.buildMessage(m,b),m,b,N)}function bA(){var m,b;return m=Q,b=Mr(),b===t&&(b=null),b!==t&&(Me=m,b=s(b)),m=b,m}function Mr(){var m,b,N,U,ce;if(m=Q,b=Kr(),b!==t){for(N=[],U=He();U!==t;)N.push(U),U=He();N!==t?(U=Ca(),U!==t?(ce=ns(),ce===t&&(ce=null),ce!==t?(Me=m,b=o(b,U,ce),m=b):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t)}else Q=m,m=t;if(m===t)if(m=Q,b=Kr(),b!==t){for(N=[],U=He();U!==t;)N.push(U),U=He();N!==t?(U=Ca(),U===t&&(U=null),U!==t?(Me=m,b=a(b,U),m=b):(Q=m,m=t)):(Q=m,m=t)}else Q=m,m=t;return m}function ns(){var m,b,N,U,ce;for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();if(b!==t)if(N=Mr(),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();U!==t?(Me=m,b=l(N),m=b):(Q=m,m=t)}else Q=m,m=t;else Q=m,m=t;return m}function Ca(){var m;return r.charCodeAt(Q)===59?(m=c,Q++):(m=t,I===0&&Qe(u)),m===t&&(r.charCodeAt(Q)===38?(m=g,Q++):(m=t,I===0&&Qe(f))),m}function Kr(){var m,b,N;return m=Q,b=K1(),b!==t?(N=age(),N===t&&(N=null),N!==t?(Me=m,b=h(b,N),m=b):(Q=m,m=t)):(Q=m,m=t),m}function age(){var m,b,N,U,ce,Se,ht;for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();if(b!==t)if(N=Age(),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();if(U!==t)if(ce=Kr(),ce!==t){for(Se=[],ht=He();ht!==t;)Se.push(ht),ht=He();Se!==t?(Me=m,b=p(N,ce),m=b):(Q=m,m=t)}else Q=m,m=t;else Q=m,m=t}else Q=m,m=t;else Q=m,m=t;return m}function Age(){var m;return r.substr(Q,2)===C?(m=C,Q+=2):(m=t,I===0&&Qe(y)),m===t&&(r.substr(Q,2)===B?(m=B,Q+=2):(m=t,I===0&&Qe(v))),m}function K1(){var m,b,N;return m=Q,b=uge(),b!==t?(N=lge(),N===t&&(N=null),N!==t?(Me=m,b=D(b,N),m=b):(Q=m,m=t)):(Q=m,m=t),m}function lge(){var m,b,N,U,ce,Se,ht;for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();if(b!==t)if(N=cge(),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();if(U!==t)if(ce=K1(),ce!==t){for(Se=[],ht=He();ht!==t;)Se.push(ht),ht=He();Se!==t?(Me=m,b=L(N,ce),m=b):(Q=m,m=t)}else Q=m,m=t;else Q=m,m=t}else Q=m,m=t;else Q=m,m=t;retLine truncated
\x85\u2028\u2029`.indexOf(this.buffer.charAt(n-1))===-1;)if(n-=1,this.position-n>t/2-1){i=" ... ",n+=5;break}for(s="",o=this.position;o<this.buffer.length&&`\0\r
\x85\u2028\u2029`.indexOf(this.buffer.charAt(o))===-1;)if(o+=1,o-this.position>t/2-1){s=" ... ",o-=5;break}return a=this.buffer.slice(n,o),pU.repeat(" ",e)+i+a+s+`
`+pU.repeat(" ",e+this.position-n+i.length)+"^"};HS.prototype.toString=function(e){var t,i="";return this.name&&(i+='in "'+this.name+'" '),i+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet(),t&&(i+=`:
`+t)),i};dU.exports=HS});var si=w((yZe,EU)=>{"use strict";var mU=kg(),kfe=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],Rfe=["scalar","sequence","mapping"];function Ffe(r){var e={};return r!==null&&Object.keys(r).forEach(function(t){r[t].forEach(function(i){e[String(i)]=t})}),e}function Nfe(r,e){if(e=e||{},Object.keys(e).forEach(function(t){if(kfe.indexOf(t)===-1)throw new mU('Unknown option "'+t+'" is met in definition of "'+r+'" YAML type.')}),this.tag=r,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=Ffe(e.styleAliases||null),Rfe.indexOf(this.kind)===-1)throw new mU('Unknown kind "'+this.kind+'" is specified for "'+r+'" YAML type.')}EU.exports=Nfe});var _l=w((wZe,yU)=>{"use strict";var IU=Zl(),gI=kg(),Lfe=si();function GS(r,e,t){var i=[];return r.include.forEach(function(n){t=GS(n,e,t)}),r[e].forEach(function(n){t.forEach(function(s,o){s.tag===n.tag&&s.kind===n.kind&&i.push(o)}),t.push(n)}),t.filter(function(n,s){return i.indexOf(s)===-1})}function Tfe(){var r={scalar:{},sequence:{},mapping:{},fallback:{}},e,t;function i(n){r[n.kind][n.tag]=r.fallback[n.tag]=n}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(i);return r}function Rg(r){this.include=r.include||[],this.implicit=r.implicit||[],this.explicit=r.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&e.loadKind!=="scalar")throw new gI("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=GS(this,"implicit",[]),this.compiledExplicit=GS(this,"explicit",[]),this.compiledTypeMap=Tfe(this.compiledImplicit,this.compiledExplicit)}Rg.DEFAULT=null;Rg.create=function(){var e,t;switch(arguments.length){case 1:e=Rg.DEFAULT,t=arguments[0];break;case 2:e=arguments[0],t=arguments[1];break;default:throw new gI("Wrong number of arguments for Schema.create function")}if(e=IU.toArray(e),t=IU.toArray(t),!e.every(function(i){return i instanceof Rg}))throw new gI("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!t.every(function(i){return i instanceof Lfe}))throw new gI("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new Rg({include:e,explicit:t})};yU.exports=Rg});var BU=w((BZe,wU)=>{"use strict";var Ofe=si();wU.exports=new Ofe("tag:yaml.org,2002:str",{kind:"scalar",construct:function(r){return r!==null?r:""}})});var bU=w((QZe,QU)=>{"use strict";var Mfe=si();QU.exports=new Mfe("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(r){return r!==null?r:[]}})});var vU=w((bZe,SU)=>{"use strict";var Kfe=si();SU.exports=new Kfe("tag:yaml.org,2002:map",{kind:"mapping",construct:function(r){return r!==null?r:{}}})});var fI=w((SZe,xU)=>{"use strict";var Ufe=_l();xU.exports=new Ufe({explicit:[BU(),bU(),vU()]})});var DU=w((vZe,PU)=>{"use strict";var Hfe=si();function Gfe(r){if(r===null)return!0;var e=r.length;return e===1&&r==="~"||e===4&&(r==="null"||r==="Null"||r==="NULL")}function Yfe(){return null}function jfe(r){return r===null}PU.exports=new Hfe("tag:yaml.org,2002:null",{kind:"scalar",resolve:Gfe,construct:Yfe,predicate:jfe,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var RU=w((xZe,kU)=>{"use strict";var qfe=si();function Jfe(r){if(r===null)return!1;var e=r.length;return e===4&&(r==="true"||r==="True"||r==="TRUE")||e===5&&(r==="false"||r==="False"||r==="FALSE")}function Wfe(r){return r==="true"||r==="True"||r==="TRUE"}function zfe(r){return Object.prototype.toString.call(r)==="[object Boolean]"}kU.exports=new qfe("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Jfe,construct:Wfe,predicate:zfe,represent:{lowercase:function(r){return r?"true":"false"},uppercase:function(r){return r?"TRUE":"FALSE"},camelcase:function(r){return r?"True":"False"}},defaultStyle:"lowercase"})});var NU=w((PZe,FU)=>{"use strict";var Vfe=Zl(),Xfe=si();function Zfe(r){return 48<=r&&r<=57||65<=r&&r<=70||97<=r&&r<=102}function _fe(r){return 48<=r&&r<=55}function $fe(r){return 48<=r&&r<=57}function ehe(r){if(r===null)return!1;var e=r.length,t=0,i=!1,n;if(!e)return!1;if(n=r[t],(n==="-"||n==="+")&&(n=r[++t]),n==="0"){if(t+1===e)return!0;if(n=r[++t],n==="b"){for(t++;t<e;t++)if(n=r[t],n!=="_"){if(n!=="0"&&n!=="1")return!1;i=!0}return i&&n!=="_"}if(n==="x"){for(t++;t<e;t++)if(n=r[t],n!=="_"){if(!Zfe(r.charCodeAt(t)))return!1;i=!0}return i&&n!=="_"}for(;t<e;t++)if(n=r[t],n!=="_"){if(!_fe(r.charCodeAt(t)))return!1;i=!0}return i&&n!=="_"}if(n==="_")return!1;for(;t<e;t++)if(n=r[t],n!=="_"){if(n===":")break;if(!$fe(r.charCodeAt(t)))return!1;i=!0}return!i||n==="_"?!1:n!==":"?!0:/^(:[0-5]?[0-9])+$/.test(r.slice(t)) Line truncated
\r`;function Ehe(r){if(r===null)return!1;var e,t,i=0,n=r.length,s=qS;for(t=0;t<n;t++)if(e=s.indexOf(r.charAt(t)),!(e>64)){if(e<0)return!1;i+=6}return i%8===0}function Ihe(r){var e,t,i=r.replace(/[\r\n=]/g,""),n=i.length,s=qS,o=0,a=[];for(e=0;e<n;e++)e%4===0&&e&&(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(i.charAt(e));return t=n%4*6,t===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):t===18?(a.push(o>>10&255),a.push(o>>2&255)):t===12&&a.push(o>>4&255),$l?$l.from?$l.from(a):new $l(a):a}function yhe(r){var e="",t=0,i,n,s=r.length,o=qS;for(i=0;i<s;i++)i%3===0&&i&&(e+=o[t>>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]),t=(t<<8)+r[i];return n=s%3,n===0?(e+=o[t>>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]):n===2?(e+=o[t>>10&63],e+=o[t>>4&63],e+=o[t<<2&63],e+=o[64]):n===1&&(e+=o[t>>2&63],e+=o[t<<4&63],e+=o[64],e+=o[64]),e}function whe(r){return $l&&$l.isBuffer(r)}WU.exports=new mhe("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Ehe,construct:Ihe,predicate:whe,represent:yhe})});var XU=w((TZe,VU)=>{"use strict";var Bhe=si(),Qhe=Object.prototype.hasOwnProperty,bhe=Object.prototype.toString;function She(r){if(r===null)return!0;var e=[],t,i,n,s,o,a=r;for(t=0,i=a.length;t<i;t+=1){if(n=a[t],o=!1,bhe.call(n)!=="[object Object]")return!1;for(s in n)if(Qhe.call(n,s))if(!o)o=!0;else return!1;if(!o)return!1;if(e.indexOf(s)===-1)e.push(s);else return!1}return!0}function vhe(r){return r!==null?r:[]}VU.exports=new Bhe("tag:yaml.org,2002:omap",{kind:"sequence",resolve:She,construct:vhe})});var _U=w((OZe,ZU)=>{"use strict";var xhe=si(),Phe=Object.prototype.toString;function Dhe(r){if(r===null)return!0;var e,t,i,n,s,o=r;for(s=new Array(o.length),e=0,t=o.length;e<t;e+=1){if(i=o[e],Phe.call(i)!=="[object Object]"||(n=Object.keys(i),n.length!==1))return!1;s[e]=[n[0],i[n[0]]]}return!0}function khe(r){if(r===null)return[];var e,t,i,n,s,o=r;for(s=new Array(o.length),e=0,t=o.length;e<t;e+=1)i=o[e],n=Object.keys(i),s[e]=[n[0],i[n[0]]];return s}ZU.exports=new xhe("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Dhe,construct:khe})});var e2=w((MZe,$U)=>{"use strict";var Rhe=si(),Fhe=Object.prototype.hasOwnProperty;function Nhe(r){if(r===null)return!0;var e,t=r;for(e in t)if(Fhe.call(t,e)&&t[e]!==null)return!1;return!0}function Lhe(r){return r!==null?r:{}}$U.exports=new Rhe("tag:yaml.org,2002:set",{kind:"mapping",resolve:Nhe,construct:Lhe})});var Fg=w((KZe,t2)=>{"use strict";var The=_l();t2.exports=new The({include:[jS()],implicit:[YU(),qU()],explicit:[zU(),XU(),_U(),e2()]})});var i2=w((UZe,r2)=>{"use strict";var Ohe=si();function Mhe(){return!0}function Khe(){}function Uhe(){return""}function Hhe(r){return typeof r>"u"}r2.exports=new Ohe("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:Mhe,construct:Khe,predicate:Hhe,represent:Uhe})});var s2=w((HZe,n2)=>{"use strict";var Ghe=si();function Yhe(r){if(r===null||r.length===0)return!1;var e=r,t=/\/([gim]*)$/.exec(r),i="";return!(e[0]==="/"&&(t&&(i=t[1]),i.length>3||e[e.length-i.length-1]!=="/"))}function jhe(r){var e=r,t=/\/([gim]*)$/.exec(r),i="";return e[0]==="/"&&(t&&(i=t[1]),e=e.slice(1,e.length-i.length-1)),new RegExp(e,i)}function qhe(r){var e="/"+r.source+"/";return r.global&&(e+="g"),r.multiline&&(e+="m"),r.ignoreCase&&(e+="i"),e}function Jhe(r){return Object.prototype.toString.call(r)==="[object RegExp]"}n2.exports=new Ghe("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:Yhe,construct:jhe,predicate:Jhe,represent:qhe})});var A2=w((GZe,a2)=>{"use strict";var hI;try{o2=J,hI=o2("esprima")}catch{typeof window<"u"&&(hI=window.esprima)}var o2,Whe=si();function zhe(r){if(r===null)return!1;try{var e="("+r+")",t=hI.parse(e,{range:!0});return!(t.type!=="Program"||t.body.length!==1||t.body[0].type!=="ExpressionStatement"||t.body[0].expression.type!=="ArrowFunctionExpression"&&t.body[0].expression.type!=="FunctionExpression")}catch{return!1}}function Vhe(r){var e="("+r+")",t=hI.parse(e,{range:!0}),i=[],n;if(t.type!=="Program"||t.body.length!==1||t.body[0].type!=="ExpressionStatement"||t.body[0].expression.type!=="ArrowFunctionExpression"&&t.body[0].expression.type!=="FunctionExpression")throw new Error("Failed to resolve function");return t.body[0].expression.params.forEach(function(s){i.push(s.name)}),n=t.body[0].expression.body.range,t.body[0].expression.body.type==="BlockStatement"?new Function(i,e.slice(n[0]+1,n[1]-1)):new Function(i,"return "+e.slice(n[0],n[1]))}function Xhe(r){return r.toString()}function Zhe(r){return Object.prototype.toString.call(r)==="[object Function]"}a2.exports=new Whe("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:zhe,construct:Vhe,predicate:Zhe,represent:Xhe})});var zp=w((YZe,c2)=>{"use strict";var l2=_l();c2.exports=l2.DEFAULT=new l2({include:[Fg()],explicit:[i2(),s2(),A2()]})});var P2=w((jZe,Vp)=>{"use strict";var ya=Zl(),C2=kg(),_he=CU(),m2=Fg(),$he=zp(),DA=Object.prototype.hasOwnProperty,pI=1,E2=2,I2=3,dI=4,JS=1,epe=2,u2=3,tpe=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC Line truncated
`:r===118?"\v":r===102?"\f":r===114?"\r":r===101?"\x1B":r===32?" ":r===34?'"':r===47?"/":r===92?"\\":r===78?"\x85":r===95?"\xA0":r===76?"\u2028":r===80?"\u2029":""}function ape(r){return r<=65535?String.fromCharCode(r):String.fromCharCode((r-65536>>10)+55296,(r-65536&1023)+56320)}var B2=new Array(256),Q2=new Array(256);for(ec=0;ec<256;ec++)B2[ec]=f2(ec)?1:0,Q2[ec]=f2(ec);var ec;function Ape(r,e){this.input=r,this.filename=e.filename||null,this.schema=e.schema||$he,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=r.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function b2(r,e){return new C2(e,new _he(r.filename,r.input,r.position,r.line,r.position-r.lineStart))}function ft(r,e){throw b2(r,e)}function CI(r,e){r.onWarning&&r.onWarning.call(null,b2(r,e))}var h2={YAML:function(e,t,i){var n,s,o;e.version!==null&&ft(e,"duplication of %YAML directive"),i.length!==1&&ft(e,"YAML directive accepts exactly one argument"),n=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),n===null&&ft(e,"ill-formed argument of the YAML directive"),s=parseInt(n[1],10),o=parseInt(n[2],10),s!==1&&ft(e,"unacceptable YAML version of the document"),e.version=i[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&CI(e,"unsupported YAML version of the document")},TAG:function(e,t,i){var n,s;i.length!==2&&ft(e,"TAG directive accepts exactly two arguments"),n=i[0],s=i[1],y2.test(n)||ft(e,"ill-formed tag handle (first argument) of the TAG directive"),DA.call(e.tagMap,n)&&ft(e,'there is a previously declared suffix for "'+n+'" tag handle'),w2.test(s)||ft(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[n]=s}};function PA(r,e,t,i){var n,s,o,a;if(e<t){if(a=r.input.slice(e,t),i)for(n=0,s=a.length;n<s;n+=1)o=a.charCodeAt(n),o===9||32<=o&&o<=1114111||ft(r,"expected valid JSON character");else tpe.test(a)&&ft(r,"the stream contains non-printable characters");r.result+=a}}function p2(r,e,t,i){var n,s,o,a;for(ya.isObject(t)||ft(r,"cannot merge mappings; the provided source object is unacceptable"),n=Object.keys(t),o=0,a=n.length;o<a;o+=1)s=n[o],DA.call(e,s)||(e[s]=t[s],i[s]=!0)}function Lg(r,e,t,i,n,s,o,a){var l,c;if(Array.isArray(n))for(n=Array.prototype.slice.call(n),l=0,c=n.length;l<c;l+=1)Array.isArray(n[l])&&ft(r,"nested arrays are not supported inside keys"),typeof n=="object"&&g2(n[l])==="[object Object]"&&(n[l]="[object Object]");if(typeof n=="object"&&g2(n)==="[object Object]"&&(n="[object Object]"),n=String(n),e===null&&(e={}),i==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(l=0,c=s.length;l<c;l+=1)p2(r,e,s[l],t);else p2(r,e,s,t);else!r.json&&!DA.call(t,n)&&DA.call(e,n)&&(r.line=o||r.line,r.position=a||r.position,ft(r,"duplicated mapping key")),e[n]=s,delete t[n];return e}function WS(r){var e;e=r.input.charCodeAt(r.position),e===10?r.position++:e===13?(r.position++,r.input.charCodeAt(r.position)===10&&r.position++):ft(r,"a line break is expected"),r.line+=1,r.lineStart=r.position}function zr(r,e,t){for(var i=0,n=r.input.charCodeAt(r.position);n!==0;){for(;tc(n);)n=r.input.charCodeAt(++r.position);if(e&&n===35)do n=r.input.charCodeAt(++r.position);while(n!==10&&n!==13&&n!==0);if(vo(n))for(WS(r),n=r.input.charCodeAt(r.position),i++,r.lineIndent=0;n===32;)r.lineIndent++,n=r.input.charCodeAt(++r.position);else break}return t!==-1&&i!==0&&r.lineIndent<t&&CI(r,"deficient indentation"),i}function mI(r){var e=r.position,t;return t=r.input.charCodeAt(e),!!((t===45||t===46)&&t===r.input.charCodeAt(e+1)&&t===r.input.charCodeAt(e+2)&&(e+=3,t=r.input.charCodeAt(e),t===0||un(t)))}function zS(r,e){e===1?r.result+=" ":e>1&&(r.result+=ya.repeat(`
`,e-1))}function lpe(r,e,t){var i,n,s,o,a,l,c,u,g=r.kind,f=r.result,h;if(h=r.input.charCodeAt(r.position),un(h)||Ng(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(n=r.input.charCodeAt(r.position+1),un(n)||t&&Ng(n)))return!1;for(r.kind="scalar",r.result="",s=o=r.position,a=!1;h!==0;){if(h===58){if(n=r.input.charCodeAt(r.position+1),un(n)||t&&Ng(n))break}else if(h===35){if(i=r.input.charCodeAt(r.position-1),un(i))break}else{if(r.position===r.lineStart&&mI(r)||t&&Ng(h))break;if(vo(h))if(l=r.line,c=r.lineStart,u=r.lineIndent,zr(r,!1,-1),r.lineIndent>=e){a=!0,h=r.input.charCodeAt(r.position);continue}else{r.position=o,r.line=l,r.lineStart=c,r.lineIndent=u;break}}a&&(PA(r,s,o,!1),zS(r,r.line-l),s=o=r.position,a=!1),tc(h)||(o=r.position+1),h=r.input.charCodeAt(++r.position)}return PA(r,s,o,!1),r.result?!0:(r.kind=g,r.result=f,!1)}function cpe(r,e){var t,i,n;if(t=r.input.charCodeAt(r.position),t!==39)return!1;for(r.kind="scalar",r.result="",r.position++,i=n=r.position;(t=r.input.charCodeAt(r.position))!==0;)if(t===39)if(PA(r,i,r.position,!0),t=r.input.charCodeAt(++r.position),t===39)i=r.position,r.position++,n=r.position;else return!0;else vo(t)?(PA(r,i,n,!0),zS(r,zr(r,!1,e)),i=n=r.position):r.position===r.lineStart&&mI(r)?ft(r,"unexpected end of the document within a single quoted scalar"):(r.position++,n=r.position);ft(r,"unexpected end of the stream within a single quoted scalar")}function upe(r,e){var t,i,n,s,o,a;if(a=r.input.charCodeAt(r.position),a!==34)return!1;for(r.kind="scalar",r.result="",r.position++,t=i=r.position;(a=r.input.charCodeAt(r.position))!==0;){if(a===34)return PA(r,t,r.position,!0),r.position++,!0;if(a===92){if(PA(r,t,r.position,!0),a=r.input.charCodeAt(++r.position),vo(a))zr(r,!1,e);else if(a<256&&B2[a])r.result+=Q2[a],r.position++;else if((o=spe(a))>0){for(n=o,s=0;n>0;n--)a=r.input.charCodeAt(++r.position),(o=npe(a))>=0?s=(s<<4)+o:ft(r,"expected hexadecimal character");r.result+=ape(s),r.position++}else ft(r,"unknown escape sequence");t=i=r.position}else vo(a)?(PA(r,t,i,!0),zS(r,zr(r,!1,e)),t=i=r.position):r.position===r.lineStart&&mI(r)?ft(r,"unexpected end of the document within a double quoted scalar"):(r.position++,i=r.position)}ft(r,"unexpected end of the stream within a double quoted scalar")}function gpe(r,e){var t=!0,i,n=r.tag,s,o=r.anchor,a,l,c,u,g,f={},h,p,C,y;if(y=r.input.charCodeAt(r.position),y===91)l=93,g=!1,s=[];else if(y===123)l=125,g=!0,s={};else return!1;for(r.anchor!==null&&(r.anchorMap[r.anchor]=s),y=r.input.charCodeAt(++r.position);y!==0;){if(zr(r,!0,e),y=r.input.charCodeAt(r.position),y===l)return r.position++,r.tag=n,r.anchor=o,r.kind=g?"mapping":"sequence",r.result=s,!0;t||ft(r,"missed comma between flow collection entries"),p=h=C=null,c=u=!1,y===63&&(a=r.input.charCodeAt(r.position+1),un(a)&&(c=u=!0,r.position++,zr(r,!0,e))),i=r.line,Tg(r,e,pI,!1,!0),p=r.tag,h=r.result,zr(r,!0,e),y=r.input.charCodeAt(r.position),(u||r.line===i)&&y===58&&(c=!0,y=r.input.charCodeAt(++r.position),zr(r,!0,e),Tg(r,e,pI,!1,!0),C=r.result),g?Lg(r,s,f,p,h,C):c?s.push(Lg(r,null,f,p,h,C)):s.push(h),zr(r,!0,e),y=r.input.charCodeAt(r.position),y===44?(t=!0,y=r.input.charCodeAt(++r.position)):t=!1}ft(r,"unexpected end of the stream within a flow collection")}function fpe(r,e){var t,i,n=JS,s=!1,o=!1,a=e,l=0,c=!1,u,g;if(g=r.input.charCodeAt(r.position),g===124)i=!1;else if(g===62)i=!0;else return!1;for(r.kind="scalar",r.result="";g!==0;)if(g=r.input.charCodeAt(++r.position),g===43||g===45)JS===n?n=g===43?u2:epe:ft(r,"repeat of a chomping mode identifier");else if((u=ope(g))>=0)u===0?ft(r,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?ft(r,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(tc(g)){do g=r.input.charCodeAt(++r.position);while(tc(g));if(g===35)do g=r.input.charCodeAt(++r.position);while(!vo(g)&&g!==0)}for(;g!==0;){for(WS(r),r.lineIndent=0,g=r.input.charCodeAt(r.position);(!o||r.lineIndent<a)&&g===32;)r.lineIndent++,g=r.input.charCodeAt(++r.position);if(!o&&r.lineIndent>a&&(a=r.lineIndent),vo(g)){l++;continue}if(r.lineIndent<a){n===u2?r.result+=ya.repeat(`
`,s?1+l:l):n===JS&&s&&(r.result+=`
`);break}for(i?tc(g)?(c=!0,r.result+=ya.repeat(`
`,s?1+l:l)):c?(c=!1,r.result+=ya.repeat(`
`,l+1)):l===0?s&&(r.result+=" "):r.result+=ya.repeat(`
`,l):r.result+=ya.repeat(`
`,s?1+l:l),s=!0,o=!0,l=0,t=r.position;!vo(g)&&g!==0;)g=r.input.charCodeAt(++r.position);PA(r,t,r.position,!1)}return!0}function d2(r,e){var t,i=r.tag,n=r.anchor,s=[],o,a=!1,l;for(r.anchor!==null&&(r.anchorMap[r.anchor]=s),l=r.input.charCodeAt(r.position);l!==0&&!(l!==45||(o=r.input.charCodeAt(r.position+1),!un(o)));){if(a=!0,r.position++,zr(r,!0,-1)&&r.lineIndent<=e){s.push(null),l=r.input.charCodeAt(r.position);continue}if(t=r.line,Tg(r,e,I2,!1,!0),s.push(r.result),zr(r,!0,-1),l=r.input.charCodeAt(r.position),(r.line===t||r.lineIndent>e)&&l!==0)ft(r,"bad indentation of a sequence entry");else if(r.lineIndent<e)break}return a?(r.tag=i,r.anchor=n,r.kind="sequence",r.result=s,!0):!1}function hpe(r,e,t){var i,n,s,o,a=r.tag,l=r.anchor,c={},u={},g=null,f=null,h=null,p=!1,C=!1,y;for(r.anchor!==null&&(r.anchorMap[r.anchor]=c),y=r.input.charCodeAt(r.position);y!==0;){if(i=r.input.charCodeAt(r.position+1),s=r.line,o=r.position,(y===63||y===58)&&un(i))y===63?(p&&(Lg(r,c,u,g,f,null),g=f=h=null),C=!0,p=!0,n=!0):p?(p=!1,n=!0):ft(r,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),r.position+=1,y=i;else if(Tg(r,t,E2,!1,!0))if(r.line===s){for(y=r.input.charCodeAt(r.position);tc(y);)y=r.input.charCodeAt(++r.position);if(y===58)y=r.input.charCodeAt(++r.position),un(y)||ft(r,"a whitespace character is expected after the key-value separator within a block mapping"),p&&(Lg(r,c,u,g,f,null),g=f=h=null),C=!0,p=!1,n=!1,g=r.tag,f=r.result;else if(C)ft(r,"can not read an implicit mapping pair; a colon is missed");else return r.tag=a,r.anchor=l,!0}else if(C)ft(r,"can not read a block mapping entry; a multiline key may not be an implicit key");else return r.tag=a,r.anchor=l,!0;else break;if((r.line===s||r.lineIndent>e)&&(Tg(r,e,dI,!0,n)&&(p?f=r.result:h=r.result),p||(Lg(r,c,u,g,f,h,s,o),g=f=h=null),zr(r,!0,-1),y=r.input.charCodeAt(r.position)),r.lineIndent>e&&y!==0)ft(r,"bad indentation of a mapping entry");else if(r.lineIndent<e)break}return p&&Lg(r,c,u,g,f,null),C&&(r.tag=a,r.anchor=l,r.kind="mapping",r.result=c),C}function ppe(r){var e,t=!1,i=!1,n,s,o;if(o=r.input.charCodeAt(r.position),o!==33)return!1;if(r.tag!==null&&ft(r,"duplication of a tag property"),o=r.input.charCodeAt(++r.position),o===60?(t=!0,o=r.input.charCodeAt(++r.position)):o===33?(i=!0,n="!!",o=r.input.charCodeAt(++r.position)):n="!",e=r.position,t){do o=r.input.charCodeAt(++r.position);while(o!==0&&o!==62);r.position<r.length?(s=r.input.slice(e,r.position),o=r.input.charCodeAt(++r.position)):ft(r,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!un(o);)o===33&&(i?ft(r,"tag suffix cannot contain exclamation marks"):(n=r.input.slice(e-1,r.position+1),y2.test(n)||ft(r,"named tag handle cannot contain such characters"),i=!0,e=r.position+1)),o=r.input.charCodeAt(++r.position);s=r.input.slice(e,r.position),ipe.test(s)&&ft(r,"tag suffix cannot contain flow indicator characters")}return s&&!w2.test(s)&&ft(r,"tag name cannot contain such characters: "+s),t?r.tag=s:DA.call(r.tagMap,n)?r.tag=r.tagMap[n]+s:n==="!"?r.tag="!"+s:n==="!!"?r.tag="tag:yaml.org,2002:"+s:ft(r,'undeclared tag handle "'+n+'"'),!0}function dpe(r){var e,t;if(t=r.input.charCodeAt(r.position),t!==38)return!1;for(r.anchor!==null&&ft(r,"duplication of an anchor property"),t=r.input.charCodeAt(++r.position),e=r.position;t!==0&&!un(t)&&!Ng(t);)t=r.input.charCodeAt(++r.position);return r.position===e&&ft(r,"name of an anchor node must contain at least one character"),r.anchor=r.input.slice(e,r.position),!0}function Cpe(r){var e,t,i;if(i=r.input.charCodeAt(r.position),i!==42)return!1;for(i=r.input.charCodeAt(++r.position),e=r.position;i!==0&&!un(i)&&!Ng(i);)i=r.input.charCodeAt(++r.position);return r.position===e&&ft(r,"name of an alias node must contain at least one character"),t=r.input.slice(e,r.position),DA.call(r.anchorMap,t)||ft(r,'unidentified alias "'+t+'"'),r.result=r.anchorMap[t],zr(r,!0,-1),!0}function Tg(r,e,t,i,n){var s,o,a,l=1,c=!1,u=!1,g,f,h,p,C;if(r.listener!==null&&r.listener("open",r),r.tag=null,r.anchor=null,r.kind=null,r.result=null,s=o=a=dI===t||I2===t,i&&zr(r,!0,-1)&&(c=!0,r.lineIndent>e?l=1:r.lineIndent===e?l=0:r.lineIndent<e&&(l=-1)),l===1)for(;ppe(r)||dpe(r);)zr(r,!0,-1)?(c=!0,a=s,r.lineIndent>e?l=1:r.lineIndent===e?l=0:r.lineIndent<e&&(l=-1)):a=!1;if(a&&(a=c||n),(l===1||dI===t)&&(pI===t||E2===t?p=e:p=e+1,C=r.position-r.lineStart,l===1?a&&(d2(r,C)||hpe(r,C,p))||gpe(r,p)?u=!0:(o&&fpe(r,p)||cpe(r,p)||upe(r,p)?u=!0:Cpe(r)?(u=!0,(r.tag!==null||r.anchor!==null)&&ft(r,"alias node should not have any properties")):lpe(r,p,pI===t)&&(u=!0,r.tag===null&&(r.tag="?")),r.anchor!==null&&(r.anchorMap[r.anchor]=r.result)):l===0&&(u=a&&d2(r,C))),r.tag!==null&&r.tag!=="!")if(r.tag==="?"){for(r.result!==null&&r.kind!=="scalar"&&ft(r,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+r.kind+'"'),g=0,f=r.implicitTypes.length;g<f;g+=1)if(h=r.implicitTypes[g],h.resolve(r.result)){r.result=h.construct(r.result),r.tag=h.tag Line truncated
`),r.charCodeAt(0)===65279&&(r=r.slice(1)));var t=new Ape(r,e),i=r.indexOf("\0");for(i!==-1&&(t.position=i,ft(t,"null byte is not allowed in input")),t.input+="\0";t.input.charCodeAt(t.position)===32;)t.lineIndent+=1,t.position+=1;for(;t.position<t.length-1;)mpe(t);return t.documents}function v2(r,e,t){e!==null&&typeof e=="object"&&typeof t>"u"&&(t=e,e=null);var i=S2(r,t);if(typeof e!="function")return i;for(var n=0,s=i.length;n<s;n+=1)e(i[n])}function x2(r,e){var t=S2(r,e);if(t.length!==0){if(t.length===1)return t[0];throw new C2("expected a single document in the stream, but found more")}}function Epe(r,e,t){return typeof e=="object"&&e!==null&&typeof t>"u"&&(t=e,e=null),v2(r,e,ya.extend({schema:m2},t))}function Ipe(r,e){return x2(r,ya.extend({schema:m2},e))}Vp.exports.loadAll=v2;Vp.exports.load=x2;Vp.exports.safeLoadAll=Epe;Vp.exports.safeLoad=Ipe});var _2=w((qZe,_S)=>{"use strict";var Zp=Zl(),_p=kg(),ype=zp(),wpe=Fg(),O2=Object.prototype.toString,M2=Object.prototype.hasOwnProperty,Bpe=9,Xp=10,Qpe=13,bpe=32,Spe=33,vpe=34,K2=35,xpe=37,Ppe=38,Dpe=39,kpe=42,U2=44,Rpe=45,H2=58,Fpe=61,Npe=62,Lpe=63,Tpe=64,G2=91,Y2=93,Ope=96,j2=123,Mpe=124,q2=125,Ni={};Ni[0]="\\0";Ni[7]="\\a";Ni[8]="\\b";Ni[9]="\\t";Ni[10]="\\n";Ni[11]="\\v";Ni[12]="\\f";Ni[13]="\\r";Ni[27]="\\e";Ni[34]='\\"';Ni[92]="\\\\";Ni[133]="\\N";Ni[160]="\\_";Ni[8232]="\\L";Ni[8233]="\\P";var Kpe=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function Upe(r,e){var t,i,n,s,o,a,l;if(e===null)return{};for(t={},i=Object.keys(e),n=0,s=i.length;n<s;n+=1)o=i[n],a=String(e[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),l=r.compiledTypeMap.fallback[o],l&&M2.call(l.styleAliases,a)&&(a=l.styleAliases[a]),t[o]=a;return t}function D2(r){var e,t,i;if(e=r.toString(16).toUpperCase(),r<=255)t="x",i=2;else if(r<=65535)t="u",i=4;else if(r<=4294967295)t="U",i=8;else throw new _p("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+Zp.repeat("0",i-e.length)+e}function Hpe(r){this.schema=r.schema||ype,this.indent=Math.max(1,r.indent||2),this.noArrayIndent=r.noArrayIndent||!1,this.skipInvalid=r.skipInvalid||!1,this.flowLevel=Zp.isNothing(r.flowLevel)?-1:r.flowLevel,this.styleMap=Upe(this.schema,r.styles||null),this.sortKeys=r.sortKeys||!1,this.lineWidth=r.lineWidth||80,this.noRefs=r.noRefs||!1,this.noCompatMode=r.noCompatMode||!1,this.condenseFlow=r.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function k2(r,e){for(var t=Zp.repeat(" ",e),i=0,n=-1,s="",o,a=r.length;i<a;)n=r.indexOf(`
`,i),n===-1?(o=r.slice(i),i=a):(o=r.slice(i,n+1),i=n+1),o.length&&o!==`
`&&(s+=t),s+=o;return s}function VS(r,e){return`
`+Zp.repeat(" ",r.indent*e)}function Gpe(r,e){var t,i,n;for(t=0,i=r.implicitTypes.length;t<i;t+=1)if(n=r.implicitTypes[t],n.resolve(e))return!0;return!1}function ZS(r){return r===bpe||r===Bpe}function Og(r){return 32<=r&&r<=126||161<=r&&r<=55295&&r!==8232&&r!==8233||57344<=r&&r<=65533&&r!==65279||65536<=r&&r<=1114111}function Ype(r){return Og(r)&&!ZS(r)&&r!==65279&&r!==Qpe&&r!==Xp}function R2(r,e){return Og(r)&&r!==65279&&r!==U2&&r!==G2&&r!==Y2&&r!==j2&&r!==q2&&r!==H2&&(r!==K2||e&&Ype(e))}function jpe(r){return Og(r)&&r!==65279&&!ZS(r)&&r!==Rpe&&r!==Lpe&&r!==H2&&r!==U2&&r!==G2&&r!==Y2&&r!==j2&&r!==q2&&r!==K2&&r!==Ppe&&r!==kpe&&r!==Spe&&r!==Mpe&&r!==Fpe&&r!==Npe&&r!==Dpe&&r!==vpe&&r!==xpe&&r!==Tpe&&r!==Ope}function J2(r){var e=/^\n* /;return e.test(r)}var W2=1,z2=2,V2=3,X2=4,EI=5;function qpe(r,e,t,i,n){var s,o,a,l=!1,c=!1,u=i!==-1,g=-1,f=jpe(r.charCodeAt(0))&&!ZS(r.charCodeAt(r.length-1));if(e)for(s=0;s<r.length;s++){if(o=r.charCodeAt(s),!Og(o))return EI;a=s>0?r.charCodeAt(s-1):null,f=f&&R2(o,a)}else{for(s=0;s<r.length;s++){if(o=r.charCodeAt(s),o===Xp)l=!0,u&&(c=c||s-g-1>i&&r[g+1]!==" ",g=s);else if(!Og(o))return EI;a=s>0?r.charCodeAt(s-1):null,f=f&&R2(o,a)}c=c||u&&s-g-1>i&&r[g+1]!==" "}return!l&&!c?f&&!n(r)?W2:z2:t>9&&J2(r)?EI:c?X2:V2}function Jpe(r,e,t,i){r.dump=function(){if(e.length===0)return"''";if(!r.noCompatMode&&Kpe.indexOf(e)!==-1)return"'"+e+"'";var n=r.indent*Math.max(1,t),s=r.lineWidth===-1?-1:Math.max(Math.min(r.lineWidth,40),r.lineWidth-n),o=i||r.flowLevel>-1&&t>=r.flowLevel;function a(l){return Gpe(r,l)}switch(qpe(e,o,r.indent,s,a)){case W2:return e;case z2:return"'"+e.replace(/'/g,"''")+"'";case V2:return"|"+F2(e,r.indent)+N2(k2(e,n));case X2:return">"+F2(e,r.indent)+N2(k2(Wpe(e,s),n));case EI:return'"'+zpe(e,s)+'"';default:throw new _p("impossible error: invalid scalar style")}}()}function F2(r,e){var t=J2(r)?String(e):"",i=r[r.length-1]===`
`,n=i&&(r[r.length-2]===`
`||r===`
`),s=n?"+":i?"":"-";return t+s+`
`}function N2(r){return r[r.length-1]===`
`?r.slice(0,-1):r}function Wpe(r,e){for(var t=/(\n+)([^\n]*)/g,i=function(){var c=r.indexOf(`
`);return c=c!==-1?c:r.length,t.lastIndex=c,L2(r.slice(0,c),e)}(),n=r[0]===`
`||r[0]===" ",s,o;o=t.exec(r);){var a=o[1],l=o[2];s=l[0]===" ",i+=a+(!n&&!s&&l!==""?`
`:"")+L2(l,e),n=s}return i}function L2(r,e){if(r===""||r[0]===" ")return r;for(var t=/ [^ ]/g,i,n=0,s,o=0,a=0,l="";i=t.exec(r);)a=i.index,a-n>e&&(s=o>n?o:a,l+=`
`+r.slice(n,s),n=s+1),o=a;return l+=`
`,r.length-n>e&&o>n?l+=r.slice(n,o)+`
`+r.slice(o+1):l+=r.slice(n),l.slice(1)}function zpe(r){for(var e="",t,i,n,s=0;s<r.length;s++){if(t=r.charCodeAt(s),t>=55296&&t<=56319&&(i=r.charCodeAt(s+1),i>=56320&&i<=57343)){e+=D2((t-55296)*1024+i-56320+65536),s++;continue}n=Ni[t],e+=!n&&Og(t)?r[s]:n||D2(t)}return e}function Vpe(r,e,t){var i="",n=r.tag,s,o;for(s=0,o=t.length;s<o;s+=1)rc(r,e,t[s],!1,!1)&&(s!==0&&(i+=","+(r.condenseFlow?"":" ")),i+=r.dump);r.tag=n,r.dump="["+i+"]"}function Xpe(r,e,t,i){var n="",s=r.tag,o,a;for(o=0,a=t.length;o<a;o+=1)rc(r,e+1,t[o],!0,!0)&&((!i||o!==0)&&(n+=VS(r,e)),r.dump&&Xp===r.dump.charCodeAt(0)?n+="-":n+="- ",n+=r.dump);r.tag=s,r.dump=n||"[]"}function Zpe(r,e,t){var i="",n=r.tag,s=Object.keys(t),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",o!==0&&(u+=", "),r.condenseFlow&&(u+='"'),l=s[o],c=t[l],rc(r,e,l,!1,!1)&&(r.dump.length>1024&&(u+="? "),u+=r.dump+(r.condenseFlow?'"':"")+":"+(r.condenseFlow?"":" "),rc(r,e,c,!1,!1)&&(u+=r.dump,i+=u));r.tag=n,r.dump="{"+i+"}"}function _pe(r,e,t,i){var n="",s=r.tag,o=Object.keys(t),a,l,c,u,g,f;if(r.sortKeys===!0)o.sort();else if(typeof r.sortKeys=="function")o.sort(r.sortKeys);else if(r.sortKeys)throw new _p("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!i||a!==0)&&(f+=VS(r,e)),c=o[a],u=t[c],rc(r,e+1,c,!0,!0,!0)&&(g=r.tag!==null&&r.tag!=="?"||r.dump&&r.dump.length>1024,g&&(r.dump&&Xp===r.dump.charCodeAt(0)?f+="?":f+="? "),f+=r.dump,g&&(f+=VS(r,e)),rc(r,e+1,u,!0,g)&&(r.dump&&Xp===r.dump.charCodeAt(0)?f+=":":f+=": ",f+=r.dump,n+=f));r.tag=s,r.dump=n||"{}"}function T2(r,e,t){var i,n,s,o,a,l;for(n=t?r.explicitTypes:r.implicitTypes,s=0,o=n.length;s<o;s+=1)if(a=n[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(r.tag=t?a.tag:"?",a.represent){if(l=r.styleMap[a.tag]||a.defaultStyle,O2.call(a.represent)==="[object Function]")i=a.represent(e,l);else if(M2.call(a.represent,l))i=a.represent[l](e,l);else throw new _p("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');r.dump=i}return!0}return!1}function rc(r,e,t,i,n,s){r.tag=null,r.dump=t,T2(r,t,!1)||T2(r,t,!0);var o=O2.call(r.dump);i&&(i=r.flowLevel<0||r.flowLevel>e);var a=o==="[object Object]"||o==="[object Array]",l,c;if(a&&(l=r.duplicates.indexOf(t),c=l!==-1),(r.tag!==null&&r.tag!=="?"||c||r.indent!==2&&e>0)&&(n=!1),c&&r.usedDuplicates[l])r.dump="*ref_"+l;else{if(a&&c&&!r.usedDuplicates[l]&&(r.usedDuplicates[l]=!0),o==="[object Object]")i&&Object.keys(r.dump).length!==0?(_pe(r,e,r.dump,n),c&&(r.dump="&ref_"+l+r.dump)):(Zpe(r,e,r.dump),c&&(r.dump="&ref_"+l+" "+r.dump));else if(o==="[object Array]"){var u=r.noArrayIndent&&e>0?e-1:e;i&&r.dump.length!==0?(Xpe(r,u,r.dump,n),c&&(r.dump="&ref_"+l+r.dump)):(Vpe(r,u,r.dump),c&&(r.dump="&ref_"+l+" "+r.dump))}else if(o==="[object String]")r.tag!=="?"&&Jpe(r,r.dump,e,s);else{if(r.skipInvalid)return!1;throw new _p("unacceptable kind of an object to dump "+o)}r.tag!==null&&r.tag!=="?"&&(r.dump="!<"+r.tag+"> "+r.dump)}return!0}function $pe(r,e){var t=[],i=[],n,s;for(XS(r,t,i),n=0,s=i.length;n<s;n+=1)e.duplicates.push(t[i[n]]);e.usedDuplicates=new Array(s)}function XS(r,e,t){var i,n,s;if(r!==null&&typeof r=="object")if(n=e.indexOf(r),n!==-1)t.indexOf(n)===-1&&t.push(n);else if(e.push(r),Array.isArray(r))for(n=0,s=r.length;n<s;n+=1)XS(r[n],e,t);else for(i=Object.keys(r),n=0,s=i.length;n<s;n+=1)XS(r[i[n]],e,t)}function Z2(r,e){e=e||{};var t=new Hpe(e);return t.noRefs||$pe(r,t),rc(t,0,r,!0,!0)?t.dump+`
`:""}function ede(r,e){return Z2(r,Zp.extend({schema:wpe},e))}_S.exports.dump=Z2;_S.exports.safeDump=ede});var eH=w((JZe,Fr)=>{"use strict";var II=P2(),$2=_2();function yI(r){return function(){throw new Error("Function "+r+" is deprecated and cannot be used.")}}Fr.exports.Type=si();Fr.exports.Schema=_l();Fr.exports.FAILSAFE_SCHEMA=fI();Fr.exports.JSON_SCHEMA=YS();Fr.exports.CORE_SCHEMA=jS();Fr.exports.DEFAULT_SAFE_SCHEMA=Fg();Fr.exports.DEFAULT_FULL_SCHEMA=zp();Fr.exports.load=II.load;Fr.exports.loadAll=II.loadAll;Fr.exports.safeLoad=II.safeLoad;Fr.exports.safeLoadAll=II.safeLoadAll;Fr.exports.dump=$2.dump;Fr.exports.safeDump=$2.safeDump;Fr.exports.YAMLException=kg();Fr.exports.MINIMAL_SCHEMA=fI();Fr.exports.SAFE_SCHEMA=Fg();Fr.exports.DEFAULT_SCHEMA=zp();Fr.exports.scan=yI("scan");Fr.exports.parse=yI("parse");Fr.exports.compose=yI("compose");Fr.exports.addConstructor=yI("addConstructor")});var rH=w((WZe,tH)=>{"use strict";var tde=eH();tH.exports=tde});var nH=w((zZe,iH)=>{"use strict";function rde(r,e){function t(){this.constructor=r}t.prototype=e.prototype,r.prototype=new t}function ic(r,e,t,i){this.message=r,this.expected=e,this.found=t,this.location=i,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ic)}rde(ic,Error);ic.buildMessage=function(r,e){var t={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var u="",g;for(g=0;g<c.parts.length;g++)u+=c.parts[g]instanceof Array?s(c.parts[g][0])+"-"+s(c.parts[g][1]):s(c.parts[g]);return"["+(c.inverted?"^":"")+u+"]"},any:function(c){return"any character"},end:function(c){return"end of input"},other:function(c){return c.description}};function i(c){return c.charCodeAt(0).toString(16).toUpperCase()}function n(c){return c.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(u){return"\\x0"+i(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+i(u)})}function s(c){return c.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(u){return"\\x0"+i(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+i(u)})}function o(c){return t[c.type](c)}function a(c){var u=new Array(c.length),g,f;for(g=0;g<c.length;g++)u[g]=o(c[g]);if(u.sort(),u.length>0){for(g=1,f=1;g<u.length;g++)u[g-1]!==u[g]&&(u[f]=u[g],f++);u.length=f}switch(u.length){case 1:return u[0];case 2:return u[0]+" or "+u[1];default:return u.slice(0,-1).join(", ")+", or "+u[u.length-1]}}function l(c){return c?'"'+n(c)+'"':"end of input"}return"Expected "+a(r)+" but "+l(e)+" found."};function ide(r,e){e=e!==void 0?e:{};var t={},i={Start:Ks},n=Ks,s=function(R){return[].concat(...R)},o="-",a=ar("-",!1),l=function(R){return R},c=function(R){return Object.assign({},...R)},u="#",g=ar("#",!1),f=Ll(),h=function(){return{}},p=":",C=ar(":",!1),y=function(R,q){return{[R]:q}},B=",",v=ar(",",!1),D=function(R,q){return q},L=function(R,q,Ce){return Object.assign({},...[R].concat(q).map(Ke=>({[Ke]:Ce})))},H=function(R){return R},j=function(R){return R},$=Ms("correct indentation"),V=" ",W=ar(" ",!1),_=function(R){return R.length===BA*mg},A=function(R){return R.length===(BA+1)*mg},ae=function(){return BA++,!0},ge=function(){return BA--,!0},re=function(){return gg()},O=Ms("pseudostring"),F=/^[^\r\n\t ?:,\][{}#&*!|>'"%@`\-]/,ue=Fn(["\r",`
`," "," ","?",":",",","]","[","{","}","#","&","*","!","|",">","'",'"',"%","@","`","-"],!0,!1),he=/^[^\r\n\t ,\][{}:#"']/,ke=Fn(["\r",`
`," "," ",",","]","[","{","}",":","#",'"',"'"],!0,!1),Fe=function(){return gg().replace(/^ *| *$/g,"")},Ne="--",oe=ar("--",!1),le=/^[a-zA-Z\/0-9]/,we=Fn([["a","z"],["A","Z"],"/",["0","9"]],!1,!1),fe=/^[^\r\n\t :,]/,Ae=Fn(["\r",`
`," "," ",":",","],!0,!1),qe="null",ne=ar("null",!1),Y=function(){return null},pe="true",ie=ar("true",!1),de=function(){return!0},_e="false",Pt=ar("false",!1),It=function(){return!1},Or=Ms("string"),ii='"',gi=ar('"',!1),hr=function(){return""},fi=function(R){return R},ni=function(R){return R.join("")},Os=/^[^"\\\0-\x1F\x7F]/,pr=Fn(['"',"\\",["\0",""],"\x7F"],!0,!1),Ii='\\"',es=ar('\\"',!1),ua=function(){return'"'},pA="\\\\",ag=ar("\\\\",!1),ts=function(){return"\\"},dA="\\/",ga=ar("\\/",!1),yp=function(){return"/"},CA="\\b",mA=ar("\\b",!1),wr=function(){return"\b"},kl="\\f",Ag=ar("\\f",!1),Io=function(){return"\f"},lg="\\n",wp=ar("\\n",!1),Bp=function(){return`
`},vr="\\r",se=ar("\\r",!1),yo=function(){return"\r"},kn="\\t",cg=ar("\\t",!1),Qt=function(){return" "},Rl="\\u",Rn=ar("\\u",!1),rs=function(R,q,Ce,Ke){return String.fromCharCode(parseInt(`0x${R}${q}${Ce}${Ke}`))},is=/^[0-9a-fA-F]/,gt=Fn([["0","9"],["a","f"],["A","F"]],!1,!1),wo=Ms("blank space"),At=/^[ \t]/,an=Fn([" "," "],!1,!1),S=Ms("white space"),Tt=/^[ \t\n\r]/,ug=Fn([" "," ",`
`,"\r"],!1,!1),Fl=`\r
`,Qp=ar(`\r
`,!1),bp=`
`,Sp=ar(`
`,!1),vp="\r",xp=ar("\r",!1),G=0,yt=0,EA=[{line:1,column:1}],Ji=0,Nl=[],Xe=0,fa;if("startRule"in e){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');n=i[e.startRule]}function gg(){return r.substring(yt,G)}function FE(){return An(yt,G)}function Pp(R,q){throw q=q!==void 0?q:An(yt,G),Tl([Ms(R)],r.substring(yt,G),q)}function NE(R,q){throw q=q!==void 0?q:An(yt,G),fg(R,q)}function ar(R,q){return{type:"literal",text:R,ignoreCase:q}}function Fn(R,q,Ce){return{type:"class",parts:R,inverted:q,ignoreCase:Ce}}function Ll(){return{type:"any"}}function Dp(){return{type:"end"}}function Ms(R){return{type:"other",description:R}}function ha(R){var q=EA[R],Ce;if(q)return q;for(Ce=R-1;!EA[Ce];)Ce--;for(q=EA[Ce],q={line:q.line,column:q.column};Ce<R;)r.charCodeAt(Ce)===10?(q.line++,q.column=1):q.column++,Ce++;return EA[R]=q,q}function An(R,q){var Ce=ha(R),Ke=ha(q);return{start:{offset:R,line:Ce.line,column:Ce.column},end:{offset:q,line:Ke.line,column:Ke.column}}}function Te(R){G<Ji||(G>Ji&&(Ji=G,Nl=[]),Nl.push(R))}function fg(R,q){return new ic(R,null,null,q)}function Tl(R,q,Ce){return new ic(ic.buildMessage(R,q),R,q,Ce)}function Ks(){var R;return R=hg(),R}function Ol(){var R,q,Ce;for(R=G,q=[],Ce=IA();Ce!==t;)q.push(Ce),Ce=IA();return q!==t&&(yt=R,q=s(q)),R=q,R}function IA(){var R,q,Ce,Ke,Re;return R=G,q=da(),q!==t?(r.charCodeAt(G)===45?(Ce=o,G++):(Ce=t,Xe===0&&Te(a)),Ce!==t?(Ke=Rr(),Ke!==t?(Re=pa(),Re!==t?(yt=R,q=l(Re),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R}function hg(){var R,q,Ce;for(R=G,q=[],Ce=pg();Ce!==t;)q.push(Ce),Ce=pg();return q!==t&&(yt=R,q=c(q)),R=q,R}function pg(){var R,q,Ce,Ke,Re,ze,dt,Ft,Nn;if(R=G,q=Rr(),q===t&&(q=null),q!==t){if(Ce=G,r.charCodeAt(G)===35?(Ke=u,G++):(Ke=t,Xe===0&&Te(g)),Ke!==t){if(Re=[],ze=G,dt=G,Xe++,Ft=Gs(),Xe--,Ft===t?dt=void 0:(G=dt,dt=t),dt!==t?(r.length>G?(Ft=r.charAt(G),G++):(Ft=t,Xe===0&&Te(f)),Ft!==t?(dt=[dt,Ft],ze=dt):(G=ze,ze=t)):(G=ze,ze=t),ze!==t)for(;ze!==t;)Re.push(ze),ze=G,dt=G,Xe++,Ft=Gs(),Xe--,Ft===t?dt=void 0:(G=dt,dt=t),dt!==t?(r.length>G?(Ft=r.charAt(G),G++):(Ft=t,Xe===0&&Te(f)),Ft!==t?(dt=[dt,Ft],ze=dt):(G=ze,ze=t)):(G=ze,ze=t);else Re=t;Re!==t?(Ke=[Ke,Re],Ce=Ke):(G=Ce,Ce=t)}else G=Ce,Ce=t;if(Ce===t&&(Ce=null),Ce!==t){if(Ke=[],Re=Hs(),Re!==t)for(;Re!==t;)Ke.push(Re),Re=Hs();else Ke=t;Ke!==t?(yt=R,q=h(),R=q):(G=R,R=t)}else G=R,R=t}else G=R,R=t;if(R===t&&(R=G,q=da(),q!==t?(Ce=Ml(),Ce!==t?(Ke=Rr(),Ke===t&&(Ke=null),Ke!==t?(r.charCodeAt(G)===58?(Re=p,G++):(Re=t,Xe===0&&Te(C)),Re!==t?(ze=Rr(),ze===t&&(ze=null),ze!==t?(dt=pa(),dt!==t?(yt=R,q=y(Ce,dt),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R===t&&(R=G,q=da(),q!==t?(Ce=Us(),Ce!==t?(Ke=Rr(),Ke===t&&(Ke=null),Ke!==t?(r.charCodeAt(G)===58?(Re=p,G++):(Re=t,Xe===0&&Te(C)),Re!==t?(ze=Rr(),ze===t&&(ze=null),ze!==t?(dt=pa(),dt!==t?(yt=R,q=y(Ce,dt),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R===t))){if(R=G,q=da(),q!==t)if(Ce=Us(),Ce!==t)if(Ke=Rr(),Ke!==t)if(Re=LE(),Re!==t){if(ze=[],dt=Hs(),dt!==t)for(;dt!==t;)ze.push(dt),dt=Hs();else ze=t;ze!==t?(yt=R,q=y(Ce,Re),R=q):(G=R,R=t)}else G=R,R=t;else G=R,R=t;else G=R,R=t;else G=R,R=t;if(R===t)if(R=G,q=da(),q!==t)if(Ce=Us(),Ce!==t){if(Ke=[],Re=G,ze=Rr(),ze===t&&(ze=null),ze!==t?(r.charCodeAt(G)===44?(dt=B,G++):(dt=t,Xe===0&&Te(v)),dt!==t?(Ft=Rr(),Ft===t&&(Ft=null),Ft!==t?(Nn=Us(),Nn!==t?(yt=Re,ze=D(Ce,Nn),Re=ze):(G=Re,Re=t)):(G=Re,Re=t)):(G=Re,Re=t)):(G=Re,Re=t),Re!==t)for(;Re!==t;)Ke.push(Re),Re=G,ze=Rr(),ze===t&&(ze=null),ze!==t?(r.charCodeAt(G)===44?(dt=B,G++):(dt=t,Xe===0&&Te(v)),dt!==t?(Ft=Rr(),Ft===t&&(Ft=null),Ft!==t?(Nn=Us(),Nn!==t?(yt=Re,ze=D(Ce,Nn),Re=ze):(G=Re,Re=t)):(G=Re,Re=t)):(G=Re,Re=t)):(G=Re,Re=t);else Ke=t;Ke!==t?(Re=Rr(),Re===t&&(Re=null),Re!==t?(r.charCodeAt(G)===58?(ze=p,G++):(ze=t,Xe===0&&Te(C)),ze!==t?(dt=Rr(),dt===t&&(dt=null),dt!==t?(Ft=pa(),Ft!==t?(yt=R,q=L(Ce,Ke,Ft),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)}else G=R,R=t;else G=R,R=t}return R}function pa(){var R,q,Ce,Ke,Re,ze,dt;if(R=G,q=G,Xe++,Ce=G,Ke=Gs(),Ke!==t?(Re=rt(),Re!==t?(r.charCodeAt(G)===45?(ze=o,G++):(ze=t,Xe===0&&Te(a)),ze!==t?(dt=Rr(),dt!==t?(Ke=[Ke,Re,ze,dt],Ce=Ke):(G=Ce,Ce=t)):(G=Ce,Ce=t)):(G=Ce,Ce=t)):(G=Ce,Ce=t),Xe--,Ce!==t?(G=q,q=void 0):q=t,q!==t?(Ce=Hs(),Ce!==t?(Ke=Bo(),Ke!==t?(Re=Ol(),Re!==t?(ze=yA(),ze!==t?(yt=R,q=H(Re),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R===t&&(R=G,q=Gs(),q!==t?(Ce=Bo(),Ce!==t?(Ke=hg(),Ke!==t?(Re=yA(),Re!==t?(yt=R,q=H(Ke),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R===t))if(R=G,q=Kl(),q!==t){if(Ce=[],Ke=Hs(),Ke!==t)for(;Ke!==t;)Ce.push(Ke),Ke=Hs();else Ce=t;Ce!==t?(yt=R,q=j(q),R=q):(G=R,R=t)}else G=R,R=t;return R}function da(){var R,q,Ce;for(Xe++,R=G,q=[],r.charCodeAt(G)===32?(Ce=V,G++):(Ce=t,Xe===0&&Te(W));Ce!==t;)q.push(Ce),r.charCodeAt(G)===32?(Ce=V,G++):(Ce=t,Xe===0&&Te(W));return q!==t?(yt=G,Ce=_(q),Ce?Ce=void 0:Ce=t,Ce!==t?(q=[q,Ce],R=q):(G=R,R=t)):(G=R,R=t),Xe--,R===t&&(q=t,Xe===0&&Te($)),R}function rt(){var R,q,Ce;for(RLine truncated
`),n("\r"),n("\u2028"),n("\u2029")]}},r.prototype.atomEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},r.prototype.decimalEscapeAtom=function(){var p=this.positiveInteger();return{type:"GroupBackReference",value:p}},r.prototype.characterClassEscape=function(){var p,C=!1;switch(this.popChar()){case"d":p=u;break;case"D":p=u,C=!0;break;case"s":p=f;break;case"S":p=f,C=!0;break;case"w":p=g;break;case"W":p=g,C=!0;break}return a(p),{type:"Set",value:p,complement:C}},r.prototype.controlEscapeAtom=function(){var p;switch(this.popChar()){case"f":p=n("\f");break;case"n":p=n(`
`);break;case"r":p=n("\r");break;case"t":p=n(" ");break;case"v":p=n("\v");break}return a(p),{type:"Character",value:p}},r.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var p=this.popChar();if(/[a-zA-Z]/.test(p)===!1)throw Error("Invalid ");var C=p.toUpperCase().charCodeAt(0)-64;return{type:"Character",value:C}},r.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:n("\0")}},r.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar("x"),this.parseHexDigits(2)},r.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar("u"),this.parseHexDigits(4)},r.prototype.identityEscapeAtom=function(){var p=this.popChar();return{type:"Character",value:n(p)}},r.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case`
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:var p=this.popChar();return{type:"Character",value:n(p)}}},r.prototype.characterClass=function(){var p=[],C=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),C=!0);this.isClassAtom();){var y=this.classAtom(),B=y.type==="Character";if(B&&this.isRangeDash()){this.consumeChar("-");var v=this.classAtom(),D=v.type==="Character";if(D){if(v.value<y.value)throw Error("Range out of order in character class");p.push({from:y.value,to:v.value})}else s(y.value,p),p.push(n("-")),s(v.value,p)}else s(y.value,p)}return this.consumeChar("]"),{type:"Set",complement:C,value:p}},r.prototype.classAtom=function(){switch(this.peekChar()){case"]":case`
`:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}},r.prototype.classEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:n("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},r.prototype.group=function(){var p=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),p=!1;break;default:this.groupIdx++;break}var C=this.disjunction();this.consumeChar(")");var y={type:"Group",capturing:p,value:C};return p&&(y.idx=this.groupIdx),y},r.prototype.positiveInteger=function(){var p=this.popChar();if(i.test(p)===!1)throw Error("Expecting a positive integer");for(;t.test(this.peekChar(0));)p+=this.popChar();return parseInt(p,10)},r.prototype.integerIncludingZero=function(){var p=this.popChar();if(t.test(p)===!1)throw Error("Expecting an integer");for(;t.test(this.peekChar(0));)p+=this.popChar();return parseInt(p,10)},r.prototype.patternCharacter=function(){var p=this.popChar();switch(p){case`
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:n(p)}}},r.prototype.isRegExpFlag=function(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}},r.prototype.isRangeDash=function(){return this.peekChar()==="-"&&this.isClassAtom(1)},r.prototype.isDigit=function(){return t.test(this.peekChar(0))},r.prototype.isClassAtom=function(p){switch(p===void 0&&(p=0),this.peekChar(p)){case"]":case`
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},r.prototype.isTerm=function(){return this.isAtom()||this.isAssertion()},r.prototype.isAtom=function(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}},r.prototype.isAssertion=function(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!");default:return!1}},r.prototype.isQuantifier=function(){var p=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(p)}},r.prototype.isPatternCharacter=function(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},r.prototype.parseHexDigits=function(p){for(var C="",y=0;y<p;y++){var B=this.popChar();if(e.test(B)===!1)throw Error("Expecting a HexDecimal digits");C+=B}var v=parseInt(C,16);return{type:"Character",value:v}},r.prototype.peekChar=function(p){return p===void 0&&(p=0),this.input[this.idx+p]},r.prototype.popChar=function(){var p=this.peekChar(0);return this.consumeChar(),p},r.prototype.consumeChar=function(p){if(p!==void 0&&this.input[this.idx]!==p)throw Error("Expected: '"+p+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++},r.prototype.loc=function(p){return{begin:p,end:this.idx}};var e=/[0-9a-fA-F]/,t=/[0-9]/,i=/[1-9]/;function n(p){return p.charCodeAt(0)}function s(p,C){p.length!==void 0?p.forEach(function(y){C.push(y)}):C.push(p)}function o(p,C){if(p[C]===!0)throw"duplicate flag "+C;p[C]=!0}function a(p){if(p===void 0)throw Error("Internal Error - Should never get here!")}function l(){throw Error("Internal Error - Should never get here!")}var c,u=[];for(c=n("0");c<=n("9");c++)u.push(c);var g=[n("_")].concat(u);for(c=n("a");c<=n("z");c++)g.push(c);for(c=n("A");c<=n("Z");c++)g.push(c);var f=[n(" "),n("\f"),n(`
`),n("\r"),n(" "),n("\v"),n(" "),n("\xA0"),n("\u1680"),n("\u2000"),n("\u2001"),n("\u2002"),n("\u2003"),n("\u2004"),n("\u2005"),n("\u2006"),n("\u2007"),n("\u2008"),n("\u2009"),n("\u200A"),n("\u2028"),n("\u2029"),n("\u202F"),n("\u205F"),n("\u3000"),n("\uFEFF")];function h(){}return h.prototype.visitChildren=function(p){for(var C in p){var y=p[C];p.hasOwnProperty(C)&&(y.type!==void 0?this.visit(y):Array.isArray(y)&&y.forEach(function(B){this.visit(B)},this))}},h.prototype.visit=function(p){switch(p.type){case"Pattern":this.visitPattern(p);break;case"Flags":this.visitFlags(p);break;case"Disjunction":this.visitDisjunction(p);break;case"Alternative":this.visitAlternative(p);break;case"StartAnchor":this.visitStartAnchor(p);break;case"EndAnchor":this.visitEndAnchor(p);break;case"WordBoundary":this.visitWordBoundary(p);break;case"NonWordBoundary":this.visitNonWordBoundary(p);break;case"Lookahead":this.visitLookahead(p);break;case"NegativeLookahead":this.visitNegativeLookahead(p);break;case"Character":this.visitCharacter(p);break;case"Set":this.visitSet(p);break;case"Group":this.visitGroup(p);break;case"GroupBackReference":this.visitGroupBackReference(p);break;case"Quantifier":this.visitQuantifier(p);break}this.visitChildren(p)},h.prototype.visitPattern=function(p){},h.prototype.visitFlags=function(p){},h.prototype.visitDisjunction=function(p){},h.prototype.visitAlternative=function(p){},h.prototype.visitStartAnchor=function(p){},h.prototype.visitEndAnchor=function(p){},h.prototype.visitWordBoundary=function(p){},h.prototype.visitNonWordBoundary=function(p){},h.prototype.visitLookahead=function(p){},h.prototype.visitNegativeLookahead=function(p){},h.prototype.visitCharacter=function(p){},h.prototype.visitSet=function(p){},h.prototype.visitGroup=function(p){},h.prototype.visitGroupBackReference=function(p){},h.prototype.visitQuantifier=function(p){},{RegExpParser:r,BaseRegExpVisitor:h,VERSION:"0.5.0"}})});var ZI=w(Wg=>{"use strict";Object.defineProperty(Wg,"__esModule",{value:!0});Wg.clearRegExpParserCache=Wg.getRegExpAst=void 0;var hEe=VI(),XI={},pEe=new hEe.RegExpParser;function dEe(r){var e=r.toString();if(XI.hasOwnProperty(e))return XI[e];var t=pEe.pattern(e);return XI[e]=t,t}Wg.getRegExpAst=dEe;function CEe(){XI={}}Wg.clearRegExpParserCache=CEe});var UY=w(pn=>{"use strict";var mEe=pn&&pn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(pn,"__esModule",{value:!0});pn.canMatchCharCode=pn.firstCharOptimizedIndices=pn.getOptimizedStartCodesIndices=pn.failedOptimizationPrefixMsg=void 0;var OY=VI(),cs=Gt(),MY=ZI(),Sa=Rv(),KY="Complement Sets are not supported for first char optimization";pn.failedOptimizationPrefixMsg=`Unable to use "first char" lexer optimizations:
`;function EEe(r,e){e===void 0&&(e=!1);try{var t=(0,MY.getRegExpAst)(r),i=$I(t.value,{},t.flags.ignoreCase);return i}catch(s){if(s.message===KY)e&&(0,cs.PRINT_WARNING)(""+pn.failedOptimizationPrefixMsg+(" Unable to optimize: < "+r.toString()+` >
`)+` Complement Sets cannot be automatically optimized.
This will disable the lexer's first char optimizations.
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{var n="";e&&(n=`
This will disable the lexer's first char optimizations.
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),(0,cs.PRINT_ERROR)(pn.failedOptimizationPrefixMsg+`
`+(" Failed parsing: < "+r.toString()+` >
`)+(" Using the regexp-to-ast library version: "+OY.VERSION+`
`)+" Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+n)}}return[]}pn.getOptimizedStartCodesIndices=EEe;function $I(r,e,t){switch(r.type){case"Disjunction":for(var i=0;i<r.value.length;i++)$I(r.value[i],e,t);break;case"Alternative":for(var n=r.value,i=0;i<n.length;i++){var s=n[i];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}var o=s;switch(o.type){case"Character":_I(o.value,e,t);break;case"Set":if(o.complement===!0)throw Error(KY);(0,cs.forEach)(o.value,function(c){if(typeof c=="number")_I(c,e,t);else{var u=c;if(t===!0)for(var g=u.from;g<=u.to;g++)_I(g,e,t);else{for(var g=u.from;g<=u.to&&g<Sa.minOptimizationVal;g++)_I(g,e,t);if(u.to>=Sa.minOptimizationVal)for(var f=u.from>=Sa.minOptimizationVal?u.from:Sa.minOptimizationVal,h=u.to,p=(0,Sa.charCodeToOptimizedIndex)(f),C=(0,Sa.charCodeToOptimizedIndex)(h),y=p;y<=C;y++)e[y]=y}}});break;case"Group":$I(o.value,e,t);break;default:throw Error("Non Exhaustive Match")}var a=o.quantifier!==void 0&&o.quantifier.atLeast===0;if(o.type==="Group"&&kv(o)===!1||o.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return(0,cs.values)(e)}pn.firstCharOptimizedIndices=$I;function _I(r,e,t){var i=(0,Sa.charCodeToOptimizedIndex)(r);e[i]=i,t===!0&&IEe(r,e)}function IEe(r,e){var t=String.fromCharCode(r),i=t.toUpperCase();if(i!==t){var n=(0,Sa.charCodeToOptimizedIndex)(i.charCodeAt(0));e[n]=n}else{var s=t.toLowerCase();if(s!==t){var n=(0,Sa.charCodeToOptimizedIndex)(s.charCodeAt(0));e[n]=n}}}function TY(r,e){return(0,cs.find)(r.value,function(t){if(typeof t=="number")return(0,cs.contains)(e,t);var i=t;return(0,cs.find)(e,function(n){return i.from<=n&&n<=i.to})!==void 0})}function kv(r){return r.quantifier&&r.quantifier.atLeast===0?!0:r.value?(0,cs.isArray)(r.value)?(0,cs.every)(r.value,kv):kv(r.value):!1}var yEe=function(r){mEe(e,r);function e(t){var i=r.call(this)||this;return i.targetCharCodes=t,i.found=!1,i}return e.prototype.visitChildren=function(t){if(this.found!==!0){switch(t.type){case"Lookahead":this.visitLookahead(t);return;case"NegativeLookahead":this.visitNegativeLookahead(t);return}r.prototype.visitChildren.call(this,t)}},e.prototype.visitCharacter=function(t){(0,cs.contains)(this.targetCharCodes,t.value)&&(this.found=!0)},e.prototype.visitSet=function(t){t.complement?TY(t,this.targetCharCodes)===void 0&&(this.found=!0):TY(t,this.targetCharCodes)!==void 0&&(this.found=!0)},e}(OY.BaseRegExpVisitor);function wEe(r,e){if(e instanceof RegExp){var t=(0,MY.getRegExpAst)(e),i=new yEe(r);return i.visit(t),i.found}else return(0,cs.find)(e,function(n){return(0,cs.contains)(r,n.charCodeAt(0))})!==void 0}pn.canMatchCharCode=wEe});var Rv=w(Ve=>{"use strict";var HY=Ve&&Ve.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.charCodeToOptimizedIndex=Ve.minOptimizationVal=Ve.buildLineBreakIssueMessage=Ve.LineTerminatorOptimizedTester=Ve.isShortPattern=Ve.isCustomPattern=Ve.cloneEmptyGroups=Ve.performWarningRuntimeChecks=Ve.performRuntimeChecks=Ve.addStickyFlag=Ve.addStartOfInput=Ve.findUnreachablePatterns=Ve.findModesThatDoNotExist=Ve.findInvalidGroupType=Ve.findDuplicatePatterns=Ve.findUnsupportedFlags=Ve.findStartOfInputAnchor=Ve.findEmptyMatchRegExps=Ve.findEndOfInputAnchor=Ve.findInvalidPatterns=Ve.findMissingPatterns=Ve.validatePatterns=Ve.analyzeTokenTypes=Ve.enableSticky=Ve.disableSticky=Ve.SUPPORT_STICKY=Ve.MODES=Ve.DEFAULT_MODE=void 0;var GY=VI(),ir=yd(),xe=Gt(),zg=UY(),YY=ZI(),Do="PATTERN";Ve.DEFAULT_MODE="defaultMode";Ve.MODES="modes";Ve.SUPPORT_STICKY=typeof new RegExp("(?:)").sticky=="boolean";function BEe(){Ve.SUPPORT_STICKY=!1}Ve.disableSticky=BEe;function QEe(){Ve.SUPPORT_STICKY=!0}Ve.enableSticky=QEe;function bEe(r,e){e=(0,xe.defaults)(e,{useSticky:Ve.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
`],tracer:function(v,D){return D()}});var t=e.tracer;t("initCharCodeToOptimizedIndexMap",function(){LEe()});var i;t("Reject Lexer.NA",function(){i=(0,xe.reject)(r,function(v){return v[Do]===ir.Lexer.NA})});var n=!1,s;t("Transform Patterns",function(){n=!1,s=(0,xe.map)(i,function(v){var D=v[Do];if((0,xe.isRegExp)(D)){var L=D.source;return L.length===1&&L!=="^"&&L!=="$"&&L!=="."&&!D.ignoreCase?L:L.length===2&&L[0]==="\\"&&!(0,xe.contains)(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],L[1])?L[1]:e.useSticky?Lv(D):Nv(D)}else{if((0,xe.isFunction)(D))return n=!0,{exec:D};if((0,xe.has)(D,"exec"))return n=!0,D;if(typeof D=="string"){if(D.length===1)return D;var H=D.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),j=new RegExp(H);return e.useSticky?Lv(j):Nv(j)}else throw Error("non exhaustive match")}})});var o,a,l,c,u;t("misc mapping",function(){o=(0,xe.map)(i,function(v){return v.tokenTypeIdx}),a=(0,xe.map)(i,function(v){var D=v.GROUP;if(D!==ir.Lexer.SKIPPED){if((0,xe.isString)(D))return D;if((0,xe.isUndefined)(D))return!1;throw Error("non exhaustive match")}}),l=(0,xe.map)(i,function(v){var D=v.LONGER_ALT;if(D){var L=(0,xe.isArray)(D)?(0,xe.map)(D,function(H){return(0,xe.indexOf)(i,H)}):[(0,xe.indexOf)(i,D)];return L}}),c=(0,xe.map)(i,function(v){return v.PUSH_MODE}),u=(0,xe.map)(i,function(v){return(0,xe.has)(v,"POP_MODE")})});var g;t("Line Terminator Handling",function(){var v=ij(e.lineTerminatorCharacters);g=(0,xe.map)(i,function(D){return!1}),e.positionTracking!=="onlyOffset"&&(g=(0,xe.map)(i,function(D){if((0,xe.has)(D,"LINE_BREAKS"))return D.LINE_BREAKS;if(tj(D,v)===!1)return(0,zg.canMatchCharCode)(v,D.PATTERN)}))});var f,h,p,C;t("Misc Mapping #2",function(){f=(0,xe.map)(i,Ov),h=(0,xe.map)(s,ej),p=(0,xe.reduce)(i,function(v,D){var L=D.GROUP;return(0,xe.isString)(L)&&L!==ir.Lexer.SKIPPED&&(v[L]=[]),v},{}),C=(0,xe.map)(s,function(v,D){return{pattern:s[D],longerAlt:l[D],canLineTerminator:g[D],isCustom:f[D],short:h[D],group:a[D],push:c[D],pop:u[D],tokenTypeIdx:o[D],tokenType:i[D]}})});var y=!0,B=[];return e.safeMode||t("First Char Optimization",function(){B=(0,xe.reduce)(i,function(v,D,L){if(typeof D.PATTERN=="string"){var H=D.PATTERN.charCodeAt(0),j=Tv(H);Fv(v,j,C[L])}else if((0,xe.isArray)(D.START_CHARS_HINT)){var $;(0,xe.forEach)(D.START_CHARS_HINT,function(W){var _=typeof W=="string"?W.charCodeAt(0):W,A=Tv(_);$!==A&&($=A,Fv(v,A,C[L]))})}else if((0,xe.isRegExp)(D.PATTERN))if(D.PATTERN.unicode)y=!1,e.ensureOptimizations&&(0,xe.PRINT_ERROR)(""+zg.failedOptimizationPrefixMsg+(" Unable to analyze < "+D.PATTERN.toString()+` > pattern.
`)+` The regexp unicode flag is not currently supported by the regexp-to-ast library.
This will disable the lexer's first char optimizations.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{var V=(0,zg.getOptimizedStartCodesIndices)(D.PATTERN,e.ensureOptimizations);(0,xe.isEmpty)(V)&&(y=!1),(0,xe.forEach)(V,function(W){Fv(v,W,C[L])})}else e.ensureOptimizations&&(0,xe.PRINT_ERROR)(""+zg.failedOptimizationPrefixMsg+(" TokenType: <"+D.name+`> is using a custom token pattern without providing <start_chars_hint> parameter.
`)+` This will disable the lexer's first char optimizations.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),y=!1;return v},[])}),t("ArrayPacking",function(){B=(0,xe.packArray)(B)}),{emptyGroups:p,patternIdxToConfig:C,charCodeToPatternIdxToConfig:B,hasCustom:n,canBeOptimized:y}}Ve.analyzeTokenTypes=bEe;function SEe(r,e){var t=[],i=jY(r);t=t.concat(i.errors);var n=qY(i.valid),s=n.valid;return t=t.concat(n.errors),t=t.concat(vEe(s)),t=t.concat(ZY(s)),t=t.concat(_Y(s,e)),t=t.concat($Y(s)),t}Ve.validatePatterns=SEe;function vEe(r){var e=[],t=(0,xe.filter)(r,function(i){return(0,xe.isRegExp)(i[Do])});return e=e.concat(JY(t)),e=e.concat(zY(t)),e=e.concat(VY(t)),e=e.concat(XY(t)),e=e.concat(WY(t)),e}function jY(r){var e=(0,xe.filter)(r,function(n){return!(0,xe.has)(n,Do)}),t=(0,xe.map)(e,function(n){return{message:"Token Type: ->"+n.name+"<- missing static 'PATTERN' property",type:ir.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[n]}}),i=(0,xe.difference)(r,e);return{errors:t,valid:i}}Ve.findMissingPatterns=jY;function qY(r){var e=(0,xe.filter)(r,function(n){var s=n[Do];return!(0,xe.isRegExp)(s)&&!(0,xe.isFunction)(s)&&!(0,xe.has)(s,"exec")&&!(0,xe.isString)(s)}),t=(0,xe.map)(e,function(n){return{message:"Token Type: ->"+n.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:ir.LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[n]}}),i=(0,xe.difference)(r,e);return{errors:t,valid:i}}Ve.findInvalidPatterns=qY;var xEe=/[^\\][\$]/;function JY(r){var e=function(n){HY(s,n);function s(){var o=n!==null&&n.apply(this,arguments)||this;return o.found=!1,o}return s.prototype.visitEndAnchor=function(o){this.found=!0},s}(GY.BaseRegExpVisitor),t=(0,xe.filter)(r,function(n){var s=n[Do];try{var o=(0,YY.getRegExpAst)(s),a=new e;return a.visit(o),a.found}catch{return xEe.test(s.source)}}),i=(0,xe.map)(t,function(n){return{message:`Unexpected RegExp Anchor Error:
Token Type: ->`+n.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:ir.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[n]}});return i}Ve.findEndOfInputAnchor=JY;function WY(r){var e=(0,xe.filter)(r,function(i){var n=i[Do];return n.test("")}),t=(0,xe.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- static 'PATTERN' must not match an empty string",type:ir.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[i]}});return t}Ve.findEmptyMatchRegExps=WY;var PEe=/[^\\[][\^]|^\^/;function zY(r){var e=function(n){HY(s,n);function s(){var o=n!==null&&n.apply(this,arguments)||this;return o.found=!1,o}return s.prototype.visitStartAnchor=function(o){this.found=!0},s}(GY.BaseRegExpVisitor),t=(0,xe.filter)(r,function(n){var s=n[Do];try{var o=(0,YY.getRegExpAst)(s),a=new e;return a.visit(o),a.found}catch{return PEe.test(s.source)}}),i=(0,xe.map)(t,function(n){return{message:`Unexpected RegExp Anchor Error:
Token Type: ->`+n.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:ir.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[n]}});return i}Ve.findStartOfInputAnchor=zY;function VY(r){var e=(0,xe.filter)(r,function(i){var n=i[Do];return n instanceof RegExp&&(n.multiline||n.global)}),t=(0,xe.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:ir.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[i]}});return t}Ve.findUnsupportedFlags=VY;function XY(r){var e=[],t=(0,xe.map)(r,function(s){return(0,xe.reduce)(r,function(o,a){return s.PATTERN.source===a.PATTERN.source&&!(0,xe.contains)(e,a)&&a.PATTERN!==ir.Lexer.NA&&(e.push(a),o.push(a)),o},[])});t=(0,xe.compact)(t);var i=(0,xe.filter)(t,function(s){return s.length>1}),n=(0,xe.map)(i,function(s){var o=(0,xe.map)(s,function(l){return l.name}),a=(0,xe.first)(s).PATTERN;return{message:"The same RegExp pattern ->"+a+"<-"+("has been used in all of the following Token Types: "+o.join(", ")+" <-"),type:ir.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}});return n}Ve.findDuplicatePatterns=XY;function ZY(r){var e=(0,xe.filter)(r,function(i){if(!(0,xe.has)(i,"GROUP"))return!1;var n=i.GROUP;return n!==ir.Lexer.SKIPPED&&n!==ir.Lexer.NA&&!(0,xe.isString)(n)}),t=(0,xe.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:ir.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[i]}});return t}Ve.findInvalidGroupType=ZY;function _Y(r,e){var t=(0,xe.filter)(r,function(n){return n.PUSH_MODE!==void 0&&!(0,xe.contains)(e,n.PUSH_MODE)}),i=(0,xe.map)(t,function(n){var s="Token Type: ->"+n.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+n.PUSH_MODE+"<-which does not exist";return{message:s,type:ir.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[n]}});return i}Ve.findModesThatDoNotExist=_Y;function $Y(r){var e=[],t=(0,xe.reduce)(r,function(i,n,s){var o=n.PATTERN;return o===ir.Lexer.NA||((0,xe.isString)(o)?i.push({str:o,idx:s,tokenType:n}):(0,xe.isRegExp)(o)&&kEe(o)&&i.push({str:o.source,idx:s,tokenType:n})),i},[]);return(0,xe.forEach)(r,function(i,n){(0,xe.forEach)(t,function(s){var o=s.str,a=s.idx,l=s.tokenType;if(n<a&&DEe(o,i.PATTERN)){var c="Token: ->"+l.name+`<- can never be matched.
`+("Because it appears AFTER the Token Type ->"+i.name+"<-")+`in the lexer's definition.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:ir.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[i,l]})}})}),e}Ve.findUnreachablePatterns=$Y;function DEe(r,e){if((0,xe.isRegExp)(e)){var t=e.exec(r);return t!==null&&t.index===0}else{if((0,xe.isFunction)(e))return e(r,0,[],{});if((0,xe.has)(e,"exec"))return e.exec(r,0,[],{});if(typeof e=="string")return e===r;throw Error("non exhaustive match")}}function kEe(r){var e=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return(0,xe.find)(e,function(t){return r.source.indexOf(t)!==-1})===void 0}function Nv(r){var e=r.ignoreCase?"i":"";return new RegExp("^(?:"+r.source+")",e)}Ve.addStartOfInput=Nv;function Lv(r){var e=r.ignoreCase?"iy":"y";return new RegExp(""+r.source,e)}Ve.addStickyFlag=Lv;function REe(r,e,t){var i=[];return(0,xe.has)(r,Ve.DEFAULT_MODE)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+Ve.DEFAULT_MODE+`> property in its definition
`,type:ir.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),(0,xe.has)(r,Ve.MODES)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+Ve.MODES+`> property in its definition
`,type:ir.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),(0,xe.has)(r,Ve.MODES)&&(0,xe.has)(r,Ve.DEFAULT_MODE)&&!(0,xe.has)(r.modes,r.defaultMode)&&i.push({message:"A MultiMode Lexer cannot be initialized with a "+Ve.DEFAULT_MODE+": <"+r.defaultMode+`>which does not exist
`,type:ir.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),(0,xe.has)(r,Ve.MODES)&&(0,xe.forEach)(r.modes,function(n,s){(0,xe.forEach)(n,function(o,a){(0,xe.isUndefined)(o)&&i.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:"+("<"+s+"> at index: <"+a+`>
`),type:ir.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})})}),i}Ve.performRuntimeChecks=REe;function FEe(r,e,t){var i=[],n=!1,s=(0,xe.compact)((0,xe.flatten)((0,xe.mapValues)(r.modes,function(l){return l}))),o=(0,xe.reject)(s,function(l){return l[Do]===ir.Lexer.NA}),a=ij(t);return e&&(0,xe.forEach)(o,function(l){var c=tj(l,a);if(c!==!1){var u=rj(l,c),g={message:u,type:c.issue,tokenType:l};i.push(g)}else(0,xe.has)(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(n=!0):(0,zg.canMatchCharCode)(a,l.PATTERN)&&(n=!0)}),e&&!n&&i.push({message:`Warning: No LINE_BREAKS Found.
This Lexer has been defined to track line and column information,
But none of the Token Types can be identified as matching a line terminator.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
for details.`,type:ir.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),i}Ve.performWarningRuntimeChecks=FEe;function NEe(r){var e={},t=(0,xe.keys)(r);return(0,xe.forEach)(t,function(i){var n=r[i];if((0,xe.isArray)(n))e[i]=[];else throw Error("non exhaustive match")}),e}Ve.cloneEmptyGroups=NEe;function Ov(r){var e=r.PATTERN;if((0,xe.isRegExp)(e))return!1;if((0,xe.isFunction)(e))return!0;if((0,xe.has)(e,"exec"))return!0;if((0,xe.isString)(e))return!1;throw Error("non exhaustive match")}Ve.isCustomPattern=Ov;function ej(r){return(0,xe.isString)(r)&&r.length===1?r.charCodeAt(0):!1}Ve.isShortPattern=ej;Ve.LineTerminatorOptimizedTester={test:function(r){for(var e=r.length,t=this.lastIndex;t<e;t++){var i=r.charCodeAt(t);if(i===10)return this.lastIndex=t+1,!0;if(i===13)return r.charCodeAt(t+1)===10?this.lastIndex=t+2:this.lastIndex=t+1,!0}return!1},lastIndex:0};function tj(r,e){if((0,xe.has)(r,"LINE_BREAKS"))return!1;if((0,xe.isRegExp)(r.PATTERN)){try{(0,zg.canMatchCharCode)(e,r.PATTERN)}catch(t){return{issue:ir.LexerDefinitionErrorType.IDENTIFY_TERMINATOR,errMsg:t.message}}return!1}else{if((0,xe.isString)(r.PATTERN))return!1;if(Ov(r))return{issue:ir.LexerDefinitionErrorType.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function rj(r,e){if(e.issue===ir.LexerDefinitionErrorType.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
`+(" The problem is in the <"+r.name+`> Token Type
`)+(" Root cause: "+e.errMsg+`.
`)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(e.issue===ir.LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
`+(" The problem is in the <"+r.name+`> Token Type
`)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}Ve.buildLineBreakIssueMessage=rj;function ij(r){var e=(0,xe.map)(r,function(t){return(0,xe.isString)(t)&&t.length>0?t.charCodeAt(0):t});return e}function Fv(r,e,t){r[e]===void 0?r[e]=[t]:r[e].push(t)}Ve.minOptimizationVal=256;var ey=[];function Tv(r){return r<Ve.minOptimizationVal?r:ey[r]}Ve.charCodeToOptimizedIndex=Tv;function LEe(){if((0,xe.isEmpty)(ey)){ey=new Array(65536);for(var r=0;r<65536;r++)ey[r]=r>255?255+~~(r/255):r}}});var Vg=w(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.isTokenType=Nt.hasExtendingTokensTypesMapProperty=Nt.hasExtendingTokensTypesProperty=Nt.hasCategoriesProperty=Nt.hasShortKeyProperty=Nt.singleAssignCategoriesToksMap=Nt.assignCategoriesMapProp=Nt.assignCategoriesTokensProp=Nt.assignTokenDefaultProps=Nt.expandCategories=Nt.augmentTokenTypes=Nt.tokenIdxToClass=Nt.tokenShortNameIdx=Nt.tokenStructuredMatcherNoCategories=Nt.tokenStructuredMatcher=void 0;var Zr=Gt();function TEe(r,e){var t=r.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}Nt.tokenStructuredMatcher=TEe;function OEe(r,e){return r.tokenTypeIdx===e.tokenTypeIdx}Nt.tokenStructuredMatcherNoCategories=OEe;Nt.tokenShortNameIdx=1;Nt.tokenIdxToClass={};function MEe(r){var e=nj(r);sj(e),aj(e),oj(e),(0,Zr.forEach)(e,function(t){t.isParent=t.categoryMatches.length>0})}Nt.augmentTokenTypes=MEe;function nj(r){for(var e=(0,Zr.cloneArr)(r),t=r,i=!0;i;){t=(0,Zr.compact)((0,Zr.flatten)((0,Zr.map)(t,function(s){return s.CATEGORIES})));var n=(0,Zr.difference)(t,e);e=e.concat(n),(0,Zr.isEmpty)(n)?i=!1:t=n}return e}Nt.expandCategories=nj;function sj(r){(0,Zr.forEach)(r,function(e){Aj(e)||(Nt.tokenIdxToClass[Nt.tokenShortNameIdx]=e,e.tokenTypeIdx=Nt.tokenShortNameIdx++),Mv(e)&&!(0,Zr.isArray)(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Mv(e)||(e.CATEGORIES=[]),lj(e)||(e.categoryMatches=[]),cj(e)||(e.categoryMatchesMap={})})}Nt.assignTokenDefaultProps=sj;function oj(r){(0,Zr.forEach)(r,function(e){e.categoryMatches=[],(0,Zr.forEach)(e.categoryMatchesMap,function(t,i){e.categoryMatches.push(Nt.tokenIdxToClass[i].tokenTypeIdx)})})}Nt.assignCategoriesTokensProp=oj;function aj(r){(0,Zr.forEach)(r,function(e){Kv([],e)})}Nt.assignCategoriesMapProp=aj;function Kv(r,e){(0,Zr.forEach)(r,function(t){e.categoryMatchesMap[t.tokenTypeIdx]=!0}),(0,Zr.forEach)(e.CATEGORIES,function(t){var i=r.concat(e);(0,Zr.contains)(i,t)||Kv(i,t)})}Nt.singleAssignCategoriesToksMap=Kv;function Aj(r){return(0,Zr.has)(r,"tokenTypeIdx")}Nt.hasShortKeyProperty=Aj;function Mv(r){return(0,Zr.has)(r,"CATEGORIES")}Nt.hasCategoriesProperty=Mv;function lj(r){return(0,Zr.has)(r,"categoryMatches")}Nt.hasExtendingTokensTypesProperty=lj;function cj(r){return(0,Zr.has)(r,"categoryMatchesMap")}Nt.hasExtendingTokensTypesMapProperty=cj;function KEe(r){return(0,Zr.has)(r,"tokenTypeIdx")}Nt.isTokenType=KEe});var Uv=w(ty=>{"use strict";Object.defineProperty(ty,"__esModule",{value:!0});ty.defaultLexerErrorProvider=void 0;ty.defaultLexerErrorProvider={buildUnableToPopLexerModeMessage:function(r){return"Unable to pop Lexer Mode after encountering Token ->"+r.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(r,e,t,i,n){return"unexpected character: ->"+r.charAt(e)+"<- at offset: "+e+","+(" skipped "+t+" characters.")}}});var yd=w(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.Lexer=fc.LexerDefinitionErrorType=void 0;var Xs=Rv(),nr=Gt(),UEe=Vg(),HEe=Uv(),GEe=ZI(),YEe;(function(r){r[r.MISSING_PATTERN=0]="MISSING_PATTERN",r[r.INVALID_PATTERN=1]="INVALID_PATTERN",r[r.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",r[r.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",r[r.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",r[r.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",r[r.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",r[r.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",r[r.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",r[r.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",r[r.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",r[r.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",r[r.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",r[r.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",r[r.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",r[r.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",r[r.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK"})(YEe=fc.LexerDefinitionErrorType||(fc.LexerDefinitionErrorType={}));var wd={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:HEe.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1};Object.freeze(wd);var jEe=function(){function r(e,t){var i=this;if(t===void 0&&(t=wd),this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.config=void 0,this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},typeof t=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
a boolean 2nd argument is no longer supported`);this.config=(0,nr.merge)(wd,t);var n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n=="number"&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",function(){var s,o=!0;i.TRACE_INIT("Lexer Config handling",function(){if(i.config.lineTerminatorsPattern===wd.lineTerminatorsPattern)i.config.lineTerminatorsPattern=Xs.LineTerminatorOptimizedTester;else if(i.config.lineTerminatorCharacters===wd.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');i.trackStartLines=/full|onlyStart/i.test(i.config.positionTracking),i.trackEndLines=/full/i.test(i.config.positionTracking),(0,nr.isArray)(e)?(s={modes:{}},s.modes[Xs.DEFAULT_MODE]=(0,nr.cloneArr)(e),s[Xs.DEFAULT_MODE]=Xs.DEFAULT_MODE):(o=!1,s=(0,nr.cloneObj)(e))}),i.config.skipValidations===!1&&(i.TRACE_INIT("performRuntimeChecks",function(){i.lexerDefinitionErrors=i.lexerDefinitionErrors.concat((0,Xs.performRuntimeChecks)(s,i.trackStartLines,i.config.lineTerminatorCharacters))}),i.TRACE_INIT("performWarningRuntimeChecks",function(){i.lexerDefinitionWarning=i.lexerDefinitionWarning.concat((0,Xs.performWarningRuntimeChecks)(s,i.trackStartLines,i.config.lineTerminatorCharacters))})),s.modes=s.modes?s.modes:{},(0,nr.forEach)(s.modes,function(u,g){s.modes[g]=(0,nr.reject)(u,function(f){return(0,nr.isUndefined)(f)})});var a=(0,nr.keys)(s.modes);if((0,nr.forEach)(s.modes,function(u,g){i.TRACE_INIT("Mode: <"+g+"> processing",function(){if(i.modes.push(g),i.config.skipValidations===!1&&i.TRACE_INIT("validatePatterns",function(){i.lexerDefinitionErrors=i.lexerDefinitionErrors.concat((0,Xs.validatePatterns)(u,a))}),(0,nr.isEmpty)(i.lexerDefinitionErrors)){(0,UEe.augmentTokenTypes)(u);var f;i.TRACE_INIT("analyzeTokenTypes",function(){f=(0,Xs.analyzeTokenTypes)(u,{lineTerminatorCharacters:i.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:i.TRACE_INIT.bind(i)})}),i.patternIdxToConfig[g]=f.patternIdxToConfig,i.charCodeToPatternIdxToConfig[g]=f.charCodeToPatternIdxToConfig,i.emptyGroups=(0,nr.merge)(i.emptyGroups,f.emptyGroups),i.hasCustom=f.hasCustom||i.hasCustom,i.canModeBeOptimized[g]=f.canBeOptimized}})}),i.defaultMode=s.defaultMode,!(0,nr.isEmpty)(i.lexerDefinitionErrors)&&!i.config.deferDefinitionErrorsHandling){var l=(0,nr.map)(i.lexerDefinitionErrors,function(u){return u.message}),c=l.join(`-----------------------
`);throw new Error(`Errors detected in definition of Lexer:
`+c)}(0,nr.forEach)(i.lexerDefinitionWarning,function(u){(0,nr.PRINT_WARNING)(u.message)}),i.TRACE_INIT("Choosing sub-methods implementations",function(){if(Xs.SUPPORT_STICKY?(i.chopInput=nr.IDENTITY,i.match=i.matchWithTest):(i.updateLastIndex=nr.NOOP,i.match=i.matchWithExec),o&&(i.handleModes=nr.NOOP),i.trackStartLines===!1&&(i.computeNewColumn=nr.IDENTITY),i.trackEndLines===!1&&(i.updateTokenEndLineColumnLocation=nr.NOOP),/full/i.test(i.config.positionTracking))i.createTokenInstance=i.createFullToken;else if(/onlyStart/i.test(i.config.positionTracking))i.createTokenInstance=i.createStartOnlyToken;else if(/onlyOffset/i.test(i.config.positionTracking))i.createTokenInstance=i.createOffsetOnlyToken;else throw Error('Invalid <positionTracking> config option: "'+i.config.positionTracking+'"');i.hasCustom?(i.addToken=i.addTokenUsingPush,i.handlePayload=i.handlePayloadWithCustom):(i.addToken=i.addTokenUsingMemberAccess,i.handlePayload=i.handlePayloadNoCustom)}),i.TRACE_INIT("Failed Optimization Warnings",function(){var u=(0,nr.reduce)(i.canModeBeOptimized,function(g,f,h){return f===!1&&g.push(h),g},[]);if(t.ensureOptimizations&&!(0,nr.isEmpty)(u))throw Error("Lexer Modes: < "+u.join(", ")+` > cannot be optimized.
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
Or inspect the console log for details on how to resolve these issues.`)}),i.TRACE_INIT("clearRegExpParserCache",function(){(0,GEe.clearRegExpParserCache)()}),i.TRACE_INIT("toFastProperties",function(){(0,nr.toFastProperties)(i)})})}return r.prototype.tokenize=function(e,t){if(t===void 0&&(t=this.defaultMode),!(0,nr.isEmpty)(this.lexerDefinitionErrors)){var i=(0,nr.map)(this.lexerDefinitionErrors,function(o){return o.message}),n=i.join(`-----------------------
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
`+n)}var s=this.tokenizeInternal(e,t);return s},r.prototype.tokenizeInternal=function(e,t){var i=this,n,s,o,a,l,c,u,g,f,h,p,C,y,B,v,D,L=e,H=L.length,j=0,$=0,V=this.hasCustom?0:Math.floor(e.length/10),W=new Array(V),_=[],A=this.trackStartLines?1:void 0,ae=this.trackStartLines?1:void 0,ge=(0,Xs.cloneEmptyGroups)(this.emptyGroups),re=this.trackStartLines,O=this.config.lineTerminatorsPattern,F=0,ue=[],he=[],ke=[],Fe=[];Object.freeze(Fe);var Ne=void 0;function oe(){return ue}function le(pr){var Ii=(0,Xs.charCodeToOptimizedIndex)(pr),es=he[Ii];return es===void 0?Fe:es}var we=function(pr){if(ke.length===1&&pr.tokenType.PUSH_MODE===void 0){var Ii=i.config.errorMessageProvider.buildUnableToPopLexerModeMessage(pr);_.push({offset:pr.startOffset,line:pr.startLine!==void 0?pr.startLine:void 0,column:pr.startColumn!==void 0?pr.startColumn:void 0,length:pr.image.length,message:Ii})}else{ke.pop();var es=(0,nr.last)(ke);ue=i.patternIdxToConfig[es],he=i.charCodeToPatternIdxToConfig[es],F=ue.length;var ua=i.canModeBeOptimized[es]&&i.config.safeMode===!1;he&&ua?Ne=le:Ne=oe}};function fe(pr){ke.push(pr),he=this.charCodeToPatternIdxToConfig[pr],ue=this.patternIdxToConfig[pr],F=ue.length,F=ue.length;var Ii=this.canModeBeOptimized[pr]&&this.config.safeMode===!1;he&&Ii?Ne=le:Ne=oe}fe.call(this,t);for(var Ae;j<H;){c=null;var qe=L.charCodeAt(j),ne=Ne(qe),Y=ne.length;for(n=0;n<Y;n++){Ae=ne[n];var pe=Ae.pattern;u=null;var ie=Ae.short;if(ie!==!1?qe===ie&&(c=pe):Ae.isCustom===!0?(D=pe.exec(L,j,W,ge),D!==null?(c=D[0],D.payload!==void 0&&(u=D.payload)):c=null):(this.updateLastIndex(pe,j),c=this.match(pe,e,j)),c!==null){if(l=Ae.longerAlt,l!==void 0){var de=l.length;for(o=0;o<de;o++){var _e=ue[l[o]],Pt=_e.pattern;if(g=null,_e.isCustom===!0?(D=Pt.exec(L,j,W,ge),D!==null?(a=D[0],D.payload!==void 0&&(g=D.payload)):a=null):(this.updateLastIndex(Pt,j),a=this.match(Pt,e,j)),a&&a.length>c.length){c=a,u=g,Ae=_e;break}}}break}}if(c!==null){if(f=c.length,h=Ae.group,h!==void 0&&(p=Ae.tokenTypeIdx,C=this.createTokenInstance(c,j,p,Ae.tokenType,A,ae,f),this.handlePayload(C,u),h===!1?$=this.addToken(W,$,C):ge[h].push(C)),e=this.chopInput(e,f),j=j+f,ae=this.computeNewColumn(ae,f),re===!0&&Ae.canLineTerminator===!0){var It=0,Or=void 0,ii=void 0;O.lastIndex=0;do Or=O.test(c),Or===!0&&(ii=O.lastIndex-1,It++);while(Or===!0);It!==0&&(A=A+It,ae=f-ii,this.updateTokenEndLineColumnLocation(C,h,ii,It,A,ae,f))}this.handleModes(Ae,we,fe,C)}else{for(var gi=j,hr=A,fi=ae,ni=!1;!ni&&j<H;)for(B=L.charCodeAt(j),e=this.chopInput(e,1),j++,s=0;s<F;s++){var Os=ue[s],pe=Os.pattern,ie=Os.short;if(ie!==!1?L.charCodeAt(j)===ie&&(ni=!0):Os.isCustom===!0?ni=pe.exec(L,j,W,ge)!==null:(this.updateLastIndex(pe,j),ni=pe.exec(e)!==null),ni===!0)break}y=j-gi,v=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(L,gi,y,hr,fi),_.push({offset:gi,line:hr,column:fi,length:y,message:v})}}return this.hasCustom||(W.length=$),{tokens:W,groups:ge,errors:_}},r.prototype.handleModes=function(e,t,i,n){if(e.pop===!0){var s=e.push;t(n),s!==void 0&&i.call(this,s)}else e.push!==void 0&&i.call(this,e.push)},r.prototype.chopInput=function(e,t){return e.substring(t)},r.prototype.updateLastIndex=function(e,t){e.lastIndex=t},r.prototype.updateTokenEndLineColumnLocation=function(e,t,i,n,s,o,a){var l,c;t!==void 0&&(l=i===a-1,c=l?-1:0,n===1&&l===!0||(e.endLine=s+c,e.endColumn=o-1+-c))},r.prototype.computeNewColumn=function(e,t){return e+t},r.prototype.createTokenInstance=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return null},r.prototype.createOffsetOnlyToken=function(e,t,i,n){return{image:e,startOffset:t,tokenTypeIdx:i,tokenType:n}},r.prototype.createStartOnlyToken=function(e,t,i,n,s,o){return{image:e,startOffset:t,startLine:s,startColumn:o,tokenTypeIdx:i,tokenType:n}},r.prototype.createFullToken=function(e,t,i,n,s,o,a){return{image:e,startOffset:t,endOffset:t+a-1,startLine:s,endLine:s,startColumn:o,endColumn:o+a-1,tokenTypeIdx:i,tokenType:n}},r.prototype.addToken=function(e,t,i){return 666},r.prototype.addTokenUsingPush=function(e,t,i){return e.push(i),t},r.prototype.addTokenUsingMemberAccess=function(e,t,i){return e[t]=i,t++,t},r.prototype.handlePayload=function(e,t){},r.prototype.handlePayloadNoCustom=function(e,t){},r.prototype.handlePayloadWithCustom=function(e,t){t!==null&&(e.payload=t)},r.prototype.match=function(e,t,i){return null},r.prototype.matchWithTest=function(e,t,i){var n=e.test(t);return n===!0?t.substring(i,e.lastIndex):null},r.prototype.matchWithExec=function(e,t){var i=e.exec(t);return i!==null?i[0]:i},r.prototype.TRACE_INIT=function(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;var i=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(i+"--> <"+e+">");var n=(0,nr.timer)(t),s=n.time,o=n.value,a=s>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(i+"<-- <"+e+"> time: "+s+"ms"),this.traceInitIndent--,o}else return t()},r.SKIPPED="This marks a skipped Token pattern, thi Line truncated
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return(0,Zs.has)(r,uj)&&(t.CATEGORIES=r[uj]),(0,Hv.augmentTokenTypes)([t]),(0,Zs.has)(r,gj)&&(t.LABEL=r[gj]),(0,Zs.has)(r,fj)&&(t.GROUP=r[fj]),(0,Zs.has)(r,pj)&&(t.POP_MODE=r[pj]),(0,Zs.has)(r,hj)&&(t.PUSH_MODE=r[hj]),(0,Zs.has)(r,dj)&&(t.LONGER_ALT=r[dj]),(0,Zs.has)(r,Cj)&&(t.LINE_BREAKS=r[Cj]),(0,Zs.has)(r,mj)&&(t.START_CHARS_HINT=r[mj]),t}bi.EOF=Ij({name:"EOF",pattern:qEe.Lexer.NA});(0,Hv.augmentTokenTypes)([bi.EOF]);function XEe(r,e,t,i,n,s,o,a){return{image:e,startOffset:t,endOffset:i,startLine:n,endLine:s,startColumn:o,endColumn:a,tokenTypeIdx:r.tokenTypeIdx,tokenType:r}}bi.createTokenInstance=XEe;function ZEe(r,e){return(0,Hv.tokenStructuredMatcher)(r,e)}bi.tokenMatcher=ZEe});var dn=w(zt=>{"use strict";var va=zt&&zt.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(zt,"__esModule",{value:!0});zt.serializeProduction=zt.serializeGrammar=zt.Terminal=zt.Alternation=zt.RepetitionWithSeparator=zt.Repetition=zt.RepetitionMandatoryWithSeparator=zt.RepetitionMandatory=zt.Option=zt.Alternative=zt.Rule=zt.NonTerminal=zt.AbstractProduction=void 0;var Ar=Gt(),_Ee=NA(),ko=function(){function r(e){this._definition=e}return Object.defineProperty(r.prototype,"definition",{get:function(){return this._definition},set:function(e){this._definition=e},enumerable:!1,configurable:!0}),r.prototype.accept=function(e){e.visit(this),(0,Ar.forEach)(this.definition,function(t){t.accept(e)})},r}();zt.AbstractProduction=ko;var yj=function(r){va(e,r);function e(t){var i=r.call(this,[])||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return Object.defineProperty(e.prototype,"definition",{get:function(){return this.referencedRule!==void 0?this.referencedRule.definition:[]},set:function(t){},enumerable:!1,configurable:!0}),e.prototype.accept=function(t){t.visit(this)},e}(ko);zt.NonTerminal=yj;var wj=function(r){va(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.orgText="",(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(ko);zt.Rule=wj;var Bj=function(r){va(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.ignoreAmbiguities=!1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(ko);zt.Alternative=Bj;var Qj=function(r){va(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(ko);zt.Option=Qj;var bj=function(r){va(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(ko);zt.RepetitionMandatory=bj;var Sj=function(r){va(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(ko);zt.RepetitionMandatoryWithSeparator=Sj;var vj=function(r){va(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(ko);zt.Repetition=vj;var xj=function(r){va(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(ko);zt.RepetitionWithSeparator=xj;var Pj=function(r){va(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,i.ignoreAmbiguities=!1,i.hasPredicates=!1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return Object.defineProperty(e.prototype,"definition",{get:function(){return this._definition},set:function(t){this._definition=t},enumerable:!1,configurable:!0}),e}(ko);zt.Alternation=Pj;var ry=function(){function r(e){this.idx=1,(0,Ar.assign)(this,(0,Ar.pick)(e,function(t){return t!==void 0}))}return r.prototype.accept=function(e){e.visit(this)},r}();zt.Terminal=ry;function $Ee(r){return(0,Ar.map)(r,Bd)}zt.serializeGrammar=$Ee;function Bd(r){function e(s){return(0,Ar.map)(s,Bd)}if(r instanceof yj){var t={type:"NonTerminal",name:r.nonTerminalName,idx:r.idx};return(0,Ar.isString)(r.label)&&(t.label=r.label),t}else{if(r instanceof Bj)return{type:"Alternative",definition:e(r.definition)};if(r instanceof Qj)return{type:"Option",idx:r.idx,definition:e(r.definition)};if(r instanceof bj)return{type:"RepetitionMandatory",idx:r.idx,definition:e(r.definition)};if(r instanceof Sj)return{type:"RepetitionMandatoryWithSeparator",idx:r.idx,separator:Bd(new ry({terminalType:r.separator})),definition:e(r.definition)};if(r instanceo Line truncated
but found: '`+a+"'";if(n)return o+n+l;var c=(0,_s.reduce)(e,function(h,p){return h.concat(p)},[]),u=(0,_s.map)(c,function(h){return"["+(0,_s.map)(h,function(p){return(0,Zg.tokenLabel)(p)}).join(", ")+"]"}),g=(0,_s.map)(u,function(h,p){return" "+(p+1)+". "+h}),f=`one of these possible Token sequences:
`+g.join(`
`);return o+f+l},buildEarlyExitMessage:function(r){var e=r.expectedIterationPaths,t=r.actual,i=r.customUserDescription,n=r.ruleName,s="Expecting: ",o=(0,_s.first)(t).image,a=`
but found: '`+o+"'";if(i)return s+i+a;var l=(0,_s.map)(e,function(u){return"["+(0,_s.map)(u,function(g){return(0,Zg.tokenLabel)(g)}).join(",")+"]"}),c=`expecting at least one iteration which starts with one of these possible Token sequences::
`+("<"+l.join(" ,")+">");return s+c+a}};Object.freeze(xa.defaultParserErrorProvider);xa.defaultGrammarResolverErrorProvider={buildRuleNotFoundError:function(r,e){var t="Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
inside top level rule: ->`+r.name+"<-";return t}};xa.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(r,e){function t(u){return u instanceof Wv.Terminal?u.terminalType.name:u instanceof Wv.NonTerminal?u.nonTerminalName:""}var i=r.name,n=(0,_s.first)(e),s=n.idx,o=(0,Hj.getProductionDslName)(n),a=t(n),l=s>0,c="->"+o+(l?s:"")+"<- "+(a?"with argument: ->"+a+"<-":"")+`
appears more than once (`+e.length+" times) in the top level rule: ->"+i+`<-.
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
`;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,`
`),c},buildNamespaceConflictError:function(r){var e=`Namespace conflict found in grammar.
`+("The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <"+r.name+`>.
`)+`To resolve this make sure each Terminal and Non-Terminal names are unique
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
and Non-Terminal names start with a lower case letter.`;return e},buildAlternationPrefixAmbiguityError:function(r){var e=(0,_s.map)(r.prefixPath,function(n){return(0,Zg.tokenLabel)(n)}).join(", "),t=r.alternation.idx===0?"":r.alternation.idx,i="Ambiguous alternatives: <"+r.ambiguityIndices.join(" ,")+`> due to common lookahead prefix
`+("in <OR"+t+"> inside <"+r.topLevelRule.name+`> Rule,
`)+("<"+e+`> may appears as a prefix path in all these alternatives.
`)+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
For Further details.`;return i},buildAlternationAmbiguityError:function(r){var e=(0,_s.map)(r.prefixPath,function(n){return(0,Zg.tokenLabel)(n)}).join(", "),t=r.alternation.idx===0?"":r.alternation.idx,i="Ambiguous Alternatives Detected: <"+r.ambiguityIndices.join(" ,")+"> in <OR"+t+">"+(" inside <"+r.topLevelRule.name+`> Rule,
`)+("<"+e+`> may appears as a prefix path in all these alternatives.
`);return i=i+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`,i},buildEmptyRepetitionError:function(r){var e=(0,Hj.getProductionDslName)(r.repetition);r.repetition.idx!==0&&(e+=r.repetition.idx);var t="The repetition <"+e+"> within Rule <"+r.topLevelRule.name+`> can never consume any tokens.
This could lead to an infinite loop.`;return t},buildTokenNameError:function(r){return"deprecated"},buildEmptyAlternationError:function(r){var e="Ambiguous empty alternative: <"+(r.emptyChoiceIdx+1)+">"+(" in <OR"+r.alternation.idx+"> inside <"+r.topLevelRule.name+`> Rule.
`)+"Only the last alternative may be an empty alternative.";return e},buildTooManyAlternativesError:function(r){var e=`An Alternation cannot have more than 256 alternatives:
`+("<OR"+r.alternation.idx+"> inside <"+r.topLevelRule.name+`> Rule.
has `+(r.alternation.definition.length+1)+" alternatives.");return e},buildLeftRecursionError:function(r){var e=r.topLevelRule.name,t=hIe.map(r.leftRecursionPath,function(s){return s.name}),i=e+" --> "+t.concat([e]).join(" --> "),n=`Left Recursion found in grammar.
`+("rule: <"+e+`> can be invoked from itself (directly or indirectly)
`)+(`without consuming any Tokens. The grammar path that causes this is:
`+i+`
`)+` To fix this refactor your grammar to remove the left recursion.
see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.`;return n},buildInvalidRuleNameError:function(r){return"deprecated"},buildDuplicateRuleNameError:function(r){var e;r.topLevelRule instanceof Wv.Rule?e=r.topLevelRule.name:e=r.topLevelRule;var t="Duplicate definition, rule: ->"+e+"<- is already defined in the grammar: ->"+r.grammarName+"<-";return t}}});var jj=w(LA=>{"use strict";var pIe=LA&&LA.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(LA,"__esModule",{value:!0});LA.GastRefResolverVisitor=LA.resolveGrammar=void 0;var dIe=Gn(),Gj=Gt(),CIe=Xg();function mIe(r,e){var t=new Yj(r,e);return t.resolveRefs(),t.errors}LA.resolveGrammar=mIe;var Yj=function(r){pIe(e,r);function e(t,i){var n=r.call(this)||this;return n.nameToTopRule=t,n.errMsgProvider=i,n.errors=[],n}return e.prototype.resolveRefs=function(){var t=this;(0,Gj.forEach)((0,Gj.values)(this.nameToTopRule),function(i){t.currTopLevel=i,i.accept(t)})},e.prototype.visitNonTerminal=function(t){var i=this.nameToTopRule[t.nonTerminalName];if(i)t.referencedRule=i;else{var n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,t);this.errors.push({message:n,type:dIe.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:t.nonTerminalName})}},e}(CIe.GAstVisitor);LA.GastRefResolverVisitor=Yj});var xd=w(Nr=>{"use strict";var hc=Nr&&Nr.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Nr,"__esModule",{value:!0});Nr.nextPossibleTokensAfter=Nr.possiblePathsFrom=Nr.NextTerminalAfterAtLeastOneSepWalker=Nr.NextTerminalAfterAtLeastOneWalker=Nr.NextTerminalAfterManySepWalker=Nr.NextTerminalAfterManyWalker=Nr.AbstractNextTerminalAfterProductionWalker=Nr.NextAfterTokenWalker=Nr.AbstractNextPossibleTokensWalker=void 0;var qj=ny(),Kt=Gt(),EIe=qv(),kt=dn(),Jj=function(r){hc(e,r);function e(t,i){var n=r.call(this)||this;return n.topProd=t,n.path=i,n.possibleTokTypes=[],n.nextProductionName="",n.nextProductionOccurrence=0,n.found=!1,n.isAtEndOfPath=!1,n}return e.prototype.startWalking=function(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=(0,Kt.cloneArr)(this.path.ruleStack).reverse(),this.occurrenceStack=(0,Kt.cloneArr)(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},e.prototype.walk=function(t,i){i===void 0&&(i=[]),this.found||r.prototype.walk.call(this,t,i)},e.prototype.walkProdRef=function(t,i,n){if(t.referencedRule.name===this.nextProductionName&&t.idx===this.nextProductionOccurrence){var s=i.concat(n);this.updateExpectedNext(),this.walk(t.referencedRule,s)}},e.prototype.updateExpectedNext=function(){(0,Kt.isEmpty)(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},e}(qj.RestWalker);Nr.AbstractNextPossibleTokensWalker=Jj;var IIe=function(r){hc(e,r);function e(t,i){var n=r.call(this,t,i)||this;return n.path=i,n.nextTerminalName="",n.nextTerminalOccurrence=0,n.nextTerminalName=n.path.lastTok.name,n.nextTerminalOccurrence=n.path.lastTokOccurrence,n}return e.prototype.walkTerminal=function(t,i,n){if(this.isAtEndOfPath&&t.terminalType.name===this.nextTerminalName&&t.idx===this.nextTerminalOccurrence&&!this.found){var s=i.concat(n),o=new kt.Alternative({definition:s});this.possibleTokTypes=(0,EIe.first)(o),this.found=!0}},e}(Jj);Nr.NextAfterTokenWalker=IIe;var vd=function(r){hc(e,r);function e(t,i){var n=r.call(this)||this;return n.topRule=t,n.occurrence=i,n.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},n}return e.prototype.startWalking=function(){return this.walk(this.topRule),this.result},e}(qj.RestWalker);Nr.AbstractNextTerminalAfterProductionWalker=vd;var yIe=function(r){hc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkMany=function(t,i,n){if(t.idx===this.occurrence){var s=(0,Kt.first)(i.concat(n));this.r Line truncated
`+(""+s.join(`
`).replace(/\n/g,`
`)))}}};return t.prototype=i,t.prototype.constructor=t,t._RULE_NAMES=e,t}Si.createBaseSemanticVisitorConstructor=gye;function fye(r,e,t){var i=function(){};(0,Rd.defineNameProp)(i,r+"BaseSemanticsWithDefaults");var n=Object.create(t.prototype);return(0,fs.forEach)(e,function(s){n[s]=Qq}),i.prototype=n,i.prototype.constructor=i,i}Si.createBaseVisitorConstructorWithDefaults=fye;var ax;(function(r){r[r.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",r[r.MISSING_METHOD=1]="MISSING_METHOD"})(ax=Si.CstVisitorDefinitionError||(Si.CstVisitorDefinitionError={}));function bq(r,e){var t=Sq(r,e),i=vq(r,e);return t.concat(i)}Si.validateVisitor=bq;function Sq(r,e){var t=(0,fs.map)(e,function(i){if(!(0,fs.isFunction)(r[i]))return{msg:"Missing visitor method: <"+i+"> on "+(0,Rd.functionName)(r.constructor)+" CST Visitor.",type:ax.MISSING_METHOD,methodName:i}});return(0,fs.compact)(t)}Si.validateMissingCstMethods=Sq;var hye=["constructor","visit","validateVisitor"];function vq(r,e){var t=[];for(var i in r)(0,fs.isFunction)(r[i])&&!(0,fs.contains)(hye,i)&&!(0,fs.contains)(e,i)&&t.push({msg:"Redundant visitor method: <"+i+"> on "+(0,Rd.functionName)(r.constructor)+` CST Visitor
There is no Grammar Rule corresponding to this method's name.
`,type:ax.REDUNDANT_METHOD,methodName:i});return t}Si.validateRedundantMethods=vq});var Dq=w(py=>{"use strict";Object.defineProperty(py,"__esModule",{value:!0});py.TreeBuilder=void 0;var tf=yq(),_r=Gt(),Pq=xq(),pye=Gn(),dye=function(){function r(){}return r.prototype.initTreeBuilder=function(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=(0,_r.has)(e,"nodeLocationTracking")?e.nodeLocationTracking:pye.DEFAULT_PARSER_CONFIG.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=_r.NOOP,this.cstFinallyStateUpdate=_r.NOOP,this.cstPostTerminal=_r.NOOP,this.cstPostNonTerminal=_r.NOOP,this.cstPostRule=_r.NOOP;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=tf.setNodeLocationFull,this.setNodeLocationFromNode=tf.setNodeLocationFull,this.cstPostRule=_r.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=_r.NOOP,this.setNodeLocationFromNode=_r.NOOP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=tf.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=tf.setNodeLocationOnlyOffset,this.cstPostRule=_r.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=_r.NOOP,this.setNodeLocationFromNode=_r.NOOP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=_r.NOOP,this.setNodeLocationFromNode=_r.NOOP,this.cstPostRule=_r.NOOP,this.setInitialNodeLocation=_r.NOOP;else throw Error('Invalid <nodeLocationTracking> config option: "'+e.nodeLocationTracking+'"')},r.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(e){e.location={startOffset:NaN,endOffset:NaN}},r.prototype.setInitialNodeLocationOnlyOffsetRegular=function(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},r.prototype.setInitialNodeLocationFullRecovery=function(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},r.prototype.setInitialNodeLocationFullRegular=function(e){var t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},r.prototype.cstInvocationStateUpdate=function(e,t){var i={name:e,children:{}};this.setInitialNodeLocation(i),this.CST_STACK.push(i)},r.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},r.prototype.cstPostRuleFull=function(e){var t=this.LA(0),i=e.location;i.startOffset<=t.startOffset?(i.endOffset=t.endOffset,i.endLine=t.endLine,i.endColumn=t.endColumn):(i.startOffset=NaN,i.startLine=NaN,i.startColumn=NaN)},r.prototype.cstPostRuleOnlyOffset=function(e){var t=this.LA(0),i=e.location;i.startOffset<=t.startOffset?i.endOffset=t.endOffset:i.startOffset=NaN},r.prototype.cstPostTerminal=function(e,t){var i=this.CST_STACK[this.CST_STACK.length-1];(0,tf.addTerminalToCst)(i,t,e),this.setNodeLocationFromToken(i.location,t)},r.prototype.cstPostNonTerminal=function(e,t){var i=this.CST_STACK[this.CST_STACK.length-1];(0,tf.addNoneTerminalToCst)(i,t,e),this.setNodeLocationFromNode(i.location,e.location)},r.prototype.getBaseCstVisitorConstructor=function(){if((0,_r.isUndefined)(this.baseCstVisitorConstructor)){var e=(0,Pq.createBaseSemanticVisitorConstructor)(this.className,(0,_r.keys)(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor},r.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if((0,_r.isUndefined)(this.baseCstVisitorWithDefaultsConstructor)){var e=(0,Pq.createBaseVisitorConstructorWithDefaults)(this.className,(0,_r.keys)(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor},r.prototype.getLastExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-1]},r.prototype.getPreviousExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-2]},r.prototype.getLastExplicitRuleOccurrenceIndex=function(){var e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]},r}();py.TreeBuilder=dye});var Rq=w(dy=>{"use strict";Object.defineProperty(dy,"__esModule",{value:!0});dy.LexerAdapter=void 0;var kq=Gn(),Cye=function(){function r(){}return r.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(r.prototype,"input",{get:function(){return this.tokVector},set:function(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length},enumerable:!1,configurable:!0}),r.prototype.SKIP_TOKEN=function(){return this Line truncated
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
For Further details.`);if((0,Pr.isArray)(e)){if((0,Pr.isEmpty)(e))throw Error(`A Token Vocabulary cannot be empty.
Note that the first argument for the parser constructor
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
For Further details.`)}if((0,Pr.isArray)(e))this.tokensMap=(0,Pr.reduce)(e,function(o,a){return o[a.name]=a,o},{});else if((0,Pr.has)(e,"modes")&&(0,Pr.every)((0,Pr.flatten)((0,Pr.values)(e.modes)),Fd.isTokenType)){var i=(0,Pr.flatten)((0,Pr.values)(e.modes)),n=(0,Pr.uniq)(i);this.tokensMap=(0,Pr.reduce)(n,function(o,a){return o[a.name]=a,o},{})}else if((0,Pr.isObject)(e))this.tokensMap=(0,Pr.cloneObj)(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=Oq.EOF;var s=(0,Pr.every)((0,Pr.values)(e),function(o){return(0,Pr.isEmpty)(o.categoryMatches)});this.tokenMatcher=s?Fd.tokenStructuredMatcherNoCategories:Fd.tokenStructuredMatcher,(0,Fd.augmentTokenTypes)((0,Pr.values)(this.tokensMap))},r.prototype.defineRule=function(e,t,i){if(this.selfAnalysisDone)throw Error("Grammar rule <"+e+`> may not be defined after the 'performSelfAnalysis' method has been called'
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var n=(0,Pr.has)(i,"resyncEnabled")?i.resyncEnabled:Tq.DEFAULT_RULE_CONFIG.resyncEnabled,s=(0,Pr.has)(i,"recoveryValueFunc")?i.recoveryValueFunc:Tq.DEFAULT_RULE_CONFIG.recoveryValueFunc,o=this.ruleShortNameIdx<<Yn.BITS_FOR_METHOD_TYPE+Yn.BITS_FOR_OCCURRENCE_IDX;this.ruleShortNameIdx++,this.shortRuleNameToFull[o]=e,this.fullRuleNameToShort[e]=o;function a(u){try{if(this.outputCst===!0){t.apply(this,u);var g=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(g),g}else return t.apply(this,u)}catch(f){return this.invokeRuleCatch(f,n,s)}finally{this.ruleFinallyStateUpdate()}}var l=function(u,g){return u===void 0&&(u=0),this.ruleInvocationStateUpdate(o,e,u),a.call(this,g)},c="ruleName";return l[c]=e,l.originalGrammarAction=t,l},r.prototype.invokeRuleCatch=function(e,t,i){var n=this.RULE_STACK.length===1,s=t&&!this.isBackTracking()&&this.recoveryEnabled;if((0,my.isRecognitionException)(e)){var o=e;if(s){var a=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(a))if(o.resyncedTokens=this.reSyncTo(a),this.outputCst){var l=this.CST_STACK[this.CST_STACK.length-1];return l.recoveredNode=!0,l}else return i();else{if(this.outputCst){var l=this.CST_STACK[this.CST_STACK.length-1];l.recoveredNode=!0,o.partialCstResult=l}throw o}}else{if(n)return this.moveToTerminatedState(),i();throw o}}else throw e},r.prototype.optionInternal=function(e,t){var i=this.getKeyForAutomaticLookahead(Yn.OPTION_IDX,t);return this.optionInternalLogic(e,t,i)},r.prototype.optionInternalLogic=function(e,t,i){var n=this,s=this.getLaFuncFromCache(i),o,a;if(e.DEF!==void 0){if(o=e.DEF,a=e.GATE,a!==void 0){var l=s;s=function(){return a.call(n)&&l.call(n)}}}else o=e;if(s.call(this)===!0)return o.call(this)},r.prototype.atLeastOneInternal=function(e,t){var i=this.getKeyForAutomaticLookahead(Yn.AT_LEAST_ONE_IDX,e);return this.atLeastOneInternalLogic(e,t,i)},r.prototype.atLeastOneInternalLogic=function(e,t,i){var n=this,s=this.getLaFuncFromCache(i),o,a;if(t.DEF!==void 0){if(o=t.DEF,a=t.GATE,a!==void 0){var l=s;s=function(){return a.call(n)&&l.call(n)}}}else o=t;if(s.call(this)===!0)for(var c=this.doSingleRepetition(o);s.call(this)===!0&&c===!0;)c=this.doSingleRepetition(o);else throw this.raiseEarlyExitException(e,Lq.PROD_TYPE.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],s,Yn.AT_LEAST_ONE_IDX,e,rf.NextTerminalAfterAtLeastOneWalker)},r.prototype.atLeastOneSepFirstInternal=function(e,t){var i=this.getKeyForAutomaticLookahead(Yn.AT_LEAST_ONE_SEP_IDX,e);this.atLeastOneSepFirstInternalLogic(e,t,i)},r.prototype.atLeastOneSepFirstInternalLogic=function(e,t,i){var n=this,s=t.DEF,o=t.SEP,a=this.getLaFuncFromCache(i);if(a.call(this)===!0){s.call(this);for(var l=function(){return n.tokenMatcher(n.LA(1),o)};this.tokenMatcher(this.LA(1),o)===!0;)this.CONSUME(o),s.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,o,l,s,rf.NextTerminalAfterAtLeastOneSepWalker],l,Yn.AT_LEAST_ONE_SEP_IDX,e,rf.NextTerminalAfterAtLeastOneSepWalker)}else throw this.raiseEarlyExitException(e,Lq.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)},r.prototype.manyInternal=function(e,t){var i=this.getKeyForAutomaticLookahead(Yn.MANY_IDX,e);return this.manyInternalLogic(e,t,i)},r.prototype.manyInternalLogic=function(e,t,i){var n=this,s=this.getLaFuncFromCache(i),o,a;if(t.DEF!==void 0){if(o=t.DEF,a=t.GATE,a!==void 0){var l=s;s=function(){return a.call(n)&&l.call(n)}}}else o=t;for(var c=!0;s.call(this)===!0&&c===!0;)c=this.doSingleRepetition(o);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],s,Yn.MANY_IDX,e,rf.NextTerminalAfterManyWalker,c)},r.prototype.manySepFirstInternal=function(e,t){var i=this.getKeyForAutomaticLookahead(Yn.MANY_SEP_IDX,e);this.manySepFirstInternalLogic(e,t,i)},r.prototype.manySepFirstInternalLogic=function(e,t,i){var n=this,s=t.DEF,o=t.SEP,a=this.getLaFuncFromCache(i);if(a.call(this)===!0){s.call(this);for(var l=function(){return n.tokenMatcher(n.LA(1),o)};this.tokenMatcher(this.LA(1),o)===!0;)this.CONSUME(o),s.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,o,l,s,rf.NextTerminalAfterManySepWalker],l,Yn.MANY_SEP_IDX,e,rf.NextTerminalAfterManySepWalker)}},r.prototype.repetitionSepSecondInternal=function(e,t,i,n,s){for(;i();)this.CONSUME(t),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,i,n,s],i,Yn.AT_LEAST_ONE_SEP_IDX,e,s)},r.prototype.doSingleRepetition=function(e){var t=this.getLexerPosition();e.call(this);var i=this.getLexerPosition();return i>t},r.prototype.orInternal=function(e,t){var i=this.getKeyForAutomaticLookahead(Yn.OR_IDX,t),n=(0,Pr.isArray)(e)?e:e.DEF,s=this.getLaFuncFromCache(i),o=s.call(this,n);if(o!==void 0){var a=n[o];return a.ALT.call(this)}this.raiseNoAltException(t,e.ERR_MSG)},r.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this. Line truncated
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Xq);var Rye={name:`This CSTNode indicates the Parser is in Recording Phase
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},Fye=function(){function r(){}return r.prototype.initGastRecorder=function(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1},r.prototype.enableRecording=function(){var e=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",function(){for(var t=function(n){var s=n>0?n:"";e["CONSUME"+s]=function(o,a){return this.consumeInternalRecord(o,n,a)},e["SUBRULE"+s]=function(o,a){return this.subruleInternalRecord(o,n,a)},e["OPTION"+s]=function(o){return this.optionInternalRecord(o,n)},e["OR"+s]=function(o){return this.orInternalRecord(o,n)},e["MANY"+s]=function(o){this.manyInternalRecord(n,o)},e["MANY_SEP"+s]=function(o){this.manySepFirstInternalRecord(n,o)},e["AT_LEAST_ONE"+s]=function(o){this.atLeastOneInternalRecord(n,o)},e["AT_LEAST_ONE_SEP"+s]=function(o){this.atLeastOneSepFirstInternalRecord(n,o)}},i=0;i<10;i++)t(i);e.consume=function(n,s,o){return this.consumeInternalRecord(s,n,o)},e.subrule=function(n,s,o){return this.subruleInternalRecord(s,n,o)},e.option=function(n,s){return this.optionInternalRecord(s,n)},e.or=function(n,s){return this.orInternalRecord(s,n)},e.many=function(n,s){this.manyInternalRecord(n,s)},e.atLeastOne=function(n,s){this.atLeastOneInternalRecord(n,s)},e.ACTION=e.ACTION_RECORD,e.BACKTRACK=e.BACKTRACK_RECORD,e.LA=e.LA_RECORD})},r.prototype.disableRecording=function(){var e=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",function(){for(var t=0;t<10;t++){var i=t>0?t:"";delete e["CONSUME"+i],delete e["SUBRULE"+i],delete e["OPTION"+i],delete e["OR"+i],delete e["MANY"+i],delete e["MANY_SEP"+i],delete e["AT_LEAST_ONE"+i],delete e["AT_LEAST_ONE_SEP"+i]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})},r.prototype.ACTION_RECORD=function(e){},r.prototype.BACKTRACK_RECORD=function(e,t){return function(){return!0}},r.prototype.LA_RECORD=function(e){return Dye.END_OF_FILE},r.prototype.topLevelRuleRecord=function(e,t){try{var i=new To.Rule({definition:[],name:e});return i.name=e,this.recordingProdStack.push(i),t.call(this),this.recordingProdStack.pop(),i}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.message+`
This error was thrown during the "grammar recording phase" For more info see:
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}},r.prototype.optionInternalRecord=function(e,t){return Nd.call(this,To.Option,e,t)},r.prototype.atLeastOneInternalRecord=function(e,t){Nd.call(this,To.RepetitionMandatory,t,e)},r.prototype.atLeastOneSepFirstInternalRecord=function(e,t){Nd.call(this,To.RepetitionMandatoryWithSeparator,t,e,jq)},r.prototype.manyInternalRecord=function(e,t){Nd.call(this,To.Repetition,t,e)},r.prototype.manySepFirstInternalRecord=function(e,t){Nd.call(this,To.RepetitionWithSeparator,t,e,jq)},r.prototype.orInternalRecord=function(e,t){return Nye.call(this,e,t)},r.prototype.subruleInternalRecord=function(e,t,i){if(wy(t),!e||(0,En.has)(e,"ruleName")===!1){var n=new Error("<SUBRULE"+Jq(t)+"> argument is invalid"+(" expecting a Parser method reference but got: <"+JSON.stringify(e)+">")+(`
inside top level rule: <`+this.recordingProdStack[0].name+">"));throw n.KNOWN_RECORDER_ERROR=!0,n}var s=(0,En.peek)(this.recordingProdStack),o=e.ruleName,a=new To.NonTerminal({idx:t,nonTerminalName:o,label:i==null?void 0:i.LABEL,referencedRule:void 0});return s.definition.push(a),this.outputCst?Rye:By},r.prototype.consumeInternalRecord=function(e,t,i){if(wy(t),!(0,Wq.hasShortKeyProperty)(e)){var n=new Error("<CONSUME"+Jq(t)+"> argument is invalid"+(" expecting a TokenType reference but got: <"+JSON.stringify(e)+">")+(`
inside top level rule: <`+this.recordingProdStack[0].name+">"));throw n.KNOWN_RECORDER_ERROR=!0,n}var s=(0,En.peek)(this.recordingProdStack),o=new To.Terminal({idx:t,terminalType:e,label:i==null?void 0:i.LABEL});return s.definition.push(o),Xq},r}();Qy.GastRecorder=Fye;function Nd(r,e,t,i){i===void 0&&(i=!1),wy(t);var n=(0,En.peek)(this.recordingProdStack),s=(0,En.isFunction)(e)?e:e.DEF,o=new r({definition:[],idx:t});return i&&(o.separator=e.SEP),(0,En.has)(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(o),s.call(this),n.definition.push(o),this.recordingProdStack.pop(),By}function Nye(r,e){var t=this;wy(e);var i=(0,En.peek)(this.recordingProdStack),n=(0,En.isArray)(r)===!1,s=n===!1?r:r.DEF,o=new To.Alternation({definition:[],idx:e,ignoreAmbiguities:n&&r.IGNORE_AMBIGUITIES===!0});(0,En.has)(r,"MAX_LOOKAHEAD")&&(o.maxLookahead=r.MAX_LOOKAHEAD);var a=(0,En.some)(s,function(l){return(0,En.isFunction)(l.GATE)});return o.hasPredicates=a,i.definition.push(o),(0,En.forEach)(s,function(l){var c=new To.Alternative({definition:[]});o.definition.push(c),(0,En.has)(l,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=l.IGNORE_AMBIGUITIES:(0,En.has)(l,"GATE")&&(c.ignoreAmbiguities=!0),t.recordingProdStack.push(c),l.ALT.call(t),t.recordingProdStack.pop()}),By}function Jq(r){return r===0?"":""+r}function wy(r){if(r<0||r>qq){var e=new Error("Invalid DSL Method idx value: <"+r+`>
`+("Idx value must be a none negative value smaller than "+(qq+1)));throw e.KNOWN_RECORDER_ERROR=!0,e}}});var $q=w(by=>{"use strict";Object.defineProperty(by,"__esModule",{value:!0});by.PerformanceTracer=void 0;var _q=Gt(),Lye=Gn(),Tye=function(){function r(){}return r.prototype.initPerformanceTracer=function(e){if((0,_q.has)(e,"traceInitPerf")){var t=e.traceInitPerf,i=typeof t=="number";this.traceInitMaxIdent=i?t:1/0,this.traceInitPerf=i?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=Lye.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},r.prototype.TRACE_INIT=function(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;var i=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(i+"--> <"+e+">");var n=(0,_q.timer)(t),s=n.time,o=n.value,a=s>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(i+"<-- <"+e+"> time: "+s+"ms"),this.traceInitIndent--,o}else return t()},r}();by.PerformanceTracer=Tye});var eJ=w(Sy=>{"use strict";Object.defineProperty(Sy,"__esModule",{value:!0});Sy.applyMixins=void 0;function Oye(r,e){e.forEach(function(t){var i=t.prototype;Object.getOwnPropertyNames(i).forEach(function(n){if(n!=="constructor"){var s=Object.getOwnPropertyDescriptor(i,n);s&&(s.get||s.set)?Object.defineProperty(r.prototype,n,s):r.prototype[n]=t.prototype[n]}})})}Sy.applyMixins=Oye});var Gn=w(dr=>{"use strict";var iJ=dr&&dr.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(dr,"__esModule",{value:!0});dr.EmbeddedActionsParser=dr.CstParser=dr.Parser=dr.EMPTY_ALT=dr.ParserDefinitionErrorType=dr.DEFAULT_RULE_CONFIG=dr.DEFAULT_PARSER_CONFIG=dr.END_OF_FILE=void 0;var _i=Gt(),Mye=Uj(),tJ=NA(),nJ=Sd(),rJ=gq(),Kye=sx(),Uye=Iq(),Hye=Dq(),Gye=Rq(),Yye=Nq(),jye=Mq(),qye=Uq(),Jye=Yq(),Wye=Zq(),zye=$q(),Vye=eJ();dr.END_OF_FILE=(0,tJ.createTokenInstance)(tJ.EOF,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(dr.END_OF_FILE);dr.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:nJ.defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1});dr.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0});var Xye;(function(r){r[r.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",r[r.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",r[r.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",r[r.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",r[r.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",r[r.LEFT_RECURSION=5]="LEFT_RECURSION",r[r.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",r[r.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",r[r.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",r[r.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",r[r.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",r[r.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",r[r.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"})(Xye=dr.ParserDefinitionErrorType||(dr.ParserDefinitionErrorType={}));function Zye(r){return r===void 0&&(r=void 0),function(){return r}}dr.EMPTY_ALT=Zye;var vy=function(){function r(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;var i=this;if(i.initErrorHandler(t),i.initLexerAdapter(),i.initLooksAhead(t),i.initRecognizerEngine(e,t),i.initRecoverable(t),i.initTreeBuilder(t),i.initContentAssist(),i.initGastRecorder(t),i.initPerformanceTracer(t),(0,_i.has)(t,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
For further details.`);this.skipValidations=(0,_i.has)(t,"skipValidations")?t.skipValidations:dr.DEFAULT_PARSER_CONFIG.skipValidations}return r.performSelfAnalysis=function(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")},r.prototype.performSelfAnalysis=function(){var e=this;this.TRACE_INIT("performSelfAnalysis",function(){var t;e.selfAnalysisDone=!0;var i=e.className;e.TRACE_INIT("toFastProps",function(){(0,_i.toFastProperties)(e)}),e.TRACE_INIT("Grammar Recording",function(){try{e.enableRecording(),(0,_i.forEach)(e.definedRulesNames,function(s){var o=e[s],a=o.originalGrammarAction,l=void 0;e.TRACE_INIT(s+" Rule",function(){l=e.topLevelRuleRecord(s,a)}),e.gastProductionsCache[s]=l})}finally{e.disableRecording()}});var n=[];if(e.TRACE_INIT("Grammar Resolving",function(){n=(0,rJ.resolveGrammar)({rules:(0,_i.values)(e.gastProductionsCache)}),e.definitionErrors=e.definitionErrors.concat(n)}),e.TRACE_INIT("Grammar Validations",function(){if((0,_i.isEmpty)(n)&&e.skipValidations===!1){var s=(0,rJ.validateGrammar)({rules:(0,_i.values)(e.gastProductionsCache),maxLookahead:e.maxLookahead,tokenTypes:(0,_i.values)(e.tokensMap),errMsgProvider:nJ.defaultGrammarValidatorErrorProvider,grammarName:i});e.definitionErrors=e.definitionErrors.concat(s)}}),(0,_i.isEmpty)(e.definitionErrors)&&(e.recoveryEnabled&&e.TRACE_INIT("computeAllProdsFollows",function(){var s=(0,Mye.computeAllProdsFollows)((0,_i.values)(e.gastProductionsCache));e.resyncFollows=s}),e.TRACE_INIT("ComputeLookaheadFunctions",function(){e.preComputeLookaheadFunctions((0,_i.values)(e.gastProductionsCache))})),!r.DEFER_DEFINITION_ERRORS_HANDLING&&!(0,_i.isEmpty)(e.definitionErrors))throw t=(0,_i.map)(e.definitionErrors,function(s){return s.message}),new Error(`Parser Definition Errors detected:
`+t.join(`
-------------------------------
`))})},r.DEFER_DEFINITION_ERRORS_HANDLING=!1,r}();dr.Parser=vy;(0,Vye.applyMixins)(vy,[Kye.Recoverable,Uye.LooksAhead,Hye.TreeBuilder,Gye.LexerAdapter,jye.RecognizerEngine,Yye.RecognizerApi,qye.ErrorHandler,Jye.ContentAssist,Wye.GastRecorder,zye.PerformanceTracer]);var _ye=function(r){iJ(e,r);function e(t,i){i===void 0&&(i=dr.DEFAULT_PARSER_CONFIG);var n=this,s=(0,_i.cloneObj)(i);return s.outputCst=!0,n=r.call(this,t,s)||this,n}return e}(vy);dr.CstParser=_ye;var $ye=function(r){iJ(e,r);function e(t,i){i===void 0&&(i=dr.DEFAULT_PARSER_CONFIG);var n=this,s=(0,_i.cloneObj)(i);return s.outputCst=!1,n=r.call(this,t,s)||this,n}return e}(vy);dr.EmbeddedActionsParser=$ye});var oJ=w(xy=>{"use strict";Object.defineProperty(xy,"__esModule",{value:!0});xy.createSyntaxDiagramsCode=void 0;var sJ=Dv();function ewe(r,e){var t=e===void 0?{}:e,i=t.resourceBase,n=i===void 0?"https://unpkg.com/chevrotain@"+sJ.VERSION+"/diagrams/":i,s=t.css,o=s===void 0?"https://unpkg.com/chevrotain@"+sJ.VERSION+"/diagrams/diagrams.css":s,a=`
<!-- This is a generated file -->
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background-color: hsl(30, 20%, 95%)
}
</style>
`,l=`
<link rel='stylesheet' href='`+o+`'>
`,c=`
<script src='`+n+`vendor/railroad-diagrams.js'><\/script>
<script src='`+n+`src/diagrams_builder.js'><\/script>
<script src='`+n+`src/diagrams_behavior.js'><\/script>
<script src='`+n+`src/main.js'><\/script>
`,u=`
<div id="diagrams" align="center"></div>
`,g=`
<script>
window.serializedGrammar = `+JSON.stringify(r,null," ")+`;
<\/script>
`,f=`
<script>
var diagramsDiv = document.getElementById("diagrams");
main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);
<\/script>
`;return a+l+c+u+g+f}xy.createSyntaxDiagramsCode=ewe});var lJ=w(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.Parser=We.createSyntaxDiagramsCode=We.clearCache=We.GAstVisitor=We.serializeProduction=We.serializeGrammar=We.Terminal=We.Rule=We.RepetitionWithSeparator=We.RepetitionMandatoryWithSeparator=We.RepetitionMandatory=We.Repetition=We.Option=We.NonTerminal=We.Alternative=We.Alternation=We.defaultLexerErrorProvider=We.NoViableAltException=We.NotAllInputParsedException=We.MismatchedTokenException=We.isRecognitionException=We.EarlyExitException=We.defaultParserErrorProvider=We.tokenName=We.tokenMatcher=We.tokenLabel=We.EOF=We.createTokenInstance=We.createToken=We.LexerDefinitionErrorType=We.Lexer=We.EMPTY_ALT=We.ParserDefinitionErrorType=We.EmbeddedActionsParser=We.CstParser=We.VERSION=void 0;var twe=Dv();Object.defineProperty(We,"VERSION",{enumerable:!0,get:function(){return twe.VERSION}});var Py=Gn();Object.defineProperty(We,"CstParser",{enumerable:!0,get:function(){return Py.CstParser}});Object.defineProperty(We,"EmbeddedActionsParser",{enumerable:!0,get:function(){return Py.EmbeddedActionsParser}});Object.defineProperty(We,"ParserDefinitionErrorType",{enumerable:!0,get:function(){return Py.ParserDefinitionErrorType}});Object.defineProperty(We,"EMPTY_ALT",{enumerable:!0,get:function(){return Py.EMPTY_ALT}});var aJ=yd();Object.defineProperty(We,"Lexer",{enumerable:!0,get:function(){return aJ.Lexer}});Object.defineProperty(We,"LexerDefinitionErrorType",{enumerable:!0,get:function(){return aJ.LexerDefinitionErrorType}});var nf=NA();Object.defineProperty(We,"createToken",{enumerable:!0,get:function(){return nf.createToken}});Object.defineProperty(We,"createTokenInstance",{enumerable:!0,get:function(){return nf.createTokenInstance}});Object.defineProperty(We,"EOF",{enumerable:!0,get:function(){return nf.EOF}});Object.defineProperty(We,"tokenLabel",{enumerable:!0,get:function(){return nf.tokenLabel}});Object.defineProperty(We,"tokenMatcher",{enumerable:!0,get:function(){return nf.tokenMatcher}});Object.defineProperty(We,"tokenName",{enumerable:!0,get:function(){return nf.tokenName}});var rwe=Sd();Object.defineProperty(We,"defaultParserErrorProvider",{enumerable:!0,get:function(){return rwe.defaultParserErrorProvider}});var Ld=ef();Object.defineProperty(We,"EarlyExitException",{enumerable:!0,get:function(){return Ld.EarlyExitException}});Object.defineProperty(We,"isRecognitionException",{enumerable:!0,get:function(){return Ld.isRecognitionException}});Object.defineProperty(We,"MismatchedTokenException",{enumerable:!0,get:function(){return Ld.MismatchedTokenException}});Object.defineProperty(We,"NotAllInputParsedException",{enumerable:!0,get:function(){return Ld.NotAllInputParsedException}});Object.defineProperty(We,"NoViableAltException",{enumerable:!0,get:function(){return Ld.NoViableAltException}});var iwe=Uv();Object.defineProperty(We,"defaultLexerErrorProvider",{enumerable:!0,get:function(){return iwe.defaultLexerErrorProvider}});var Oo=dn();Object.defineProperty(We,"Alternation",{enumerable:!0,get:function(){return Oo.Alternation}});Object.defineProperty(We,"Alternative",{enumerable:!0,get:function(){return Oo.Alternative}});Object.defineProperty(We,"NonTerminal",{enumerable:!0,get:function(){return Oo.NonTerminal}});Object.defineProperty(We,"Option",{enumerable:!0,get:function(){return Oo.Option}});Object.defineProperty(We,"Repetition",{enumerable:!0,get:function(){return Oo.Repetition}});Object.defineProperty(We,"RepetitionMandatory",{enumerable:!0,get:function(){return Oo.RepetitionMandatory}});Object.defineProperty(We,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return Oo.RepetitionMandatoryWithSeparator}});Object.defineProperty(We,"RepetitionWithSeparator",{enumerable:!0,get:function(){return Oo.RepetitionWithSeparator}});Object.defineProperty(We,"Rule",{enumerable:!0,get:function(){return Oo.Rule}});Object.defineProperty(We,"Terminal",{enumerable:!0,get:function(){return Oo.Terminal}});var AJ=dn();Object.defineProperty(We,"serializeGrammar",{enumerable:!0,get:function(){return AJ.serializeGrammar}});Object.defineProperty(We,"serializeProduction",{enumerable:!0,get:function(){return AJ.serializeProduction}});var nwe=Xg();Object.defineProperty(We,"GAstVisitor",{enumerable:!0,get:function(){return nwe.GAstVisitor}});function swe(){console.warn(`The clearCache function was 'soft' removed from the Chevrotain API.
It performs no action other than printing this message.
Please avoid using it as it will be completely removed in the future`)}We.clearCache=swe;var owe=oJ();Object.defineProperty(We,"createSyntaxDiagramsCode",{enumerable:!0,get:function(){return owe.createSyntaxDiagramsCode}});var awe=function(){function r(){throw new Error(`The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return r}();We.Parser=awe});var gJ=w((Met,uJ)=>{var Dy=lJ(),ka=Dy.createToken,cJ=Dy.tokenMatcher,ux=Dy.Lexer,Awe=Dy.EmbeddedActionsParser;uJ.exports=r=>{let e=ka({name:"LogicalOperator",pattern:ux.NA}),t=ka({name:"Or",pattern:/\|/,categories:e}),i=ka({name:"Xor",pattern:/\^/,categories:e}),n=ka({name:"And",pattern:/&/,categories:e}),s=ka({name:"Not",pattern:/!/}),o=ka({name:"LParen",pattern:/\(/}),a=ka({name:"RParen",pattern:/\)/}),l=ka({name:"Query",pattern:r}),u=[ka({name:"WhiteSpace",pattern:/\s+/,group:ux.SKIPPED}),t,i,n,o,a,s,e,l],g=new ux(u);class f extends Awe{constructor(p){super(u),this.RULE("expression",()=>this.SUBRULE(this.logicalExpression)),this.RULE("logicalExpression",()=>{let y=this.SUBRULE(this.atomicExpression);return this.MANY(()=>{let B=y,v=this.CONSUME(e),D=this.SUBRULE2(this.atomicExpression);cJ(v,t)?y=L=>B(L)||D(L):cJ(v,i)?y=L=>!!(B(L)^D(L)):y=L=>B(L)&&D(L)}),y}),this.RULE("atomicExpression",()=>this.OR([{ALT:()=>this.SUBRULE(this.parenthesisExpression)},{ALT:()=>{let{image:C}=this.CONSUME(l);return y=>y(C)}},{ALT:()=>{this.CONSUME(s);let C=this.SUBRULE(this.atomicExpression);return y=>!C(y)}}])),this.RULE("parenthesisExpression",()=>{let C;return this.CONSUME(o),C=this.SUBRULE(this.expression),this.CONSUME(a),C}),this.performSelfAnalysis()}}return{TinylogicLexer:g,TinylogicParser:f}}});var fJ=w(ky=>{var lwe=gJ();ky.makeParser=(r=/[a-z]+/)=>{let{TinylogicLexer:e,TinylogicParser:t}=lwe(r),i=new t;return(n,s)=>{let o=e.tokenize(n);return i.input=o.tokens,i.expression()(s)}};ky.parse=ky.makeParser()});var pJ=w((Uet,hJ)=>{"use strict";hJ.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],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke Line truncated
`:`
`)+t,n=i+1,i=r.indexOf(`
`,n)}while(i!==-1);return s+=r.substr(n),s};FJ.exports={stringReplaceAll:wwe,stringEncaseCRLFWithFirstIndex:Bwe}});var KJ=w((zet,MJ)=>{"use strict";var Qwe=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,LJ=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,bwe=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Swe=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,vwe=new Map([["n",`
`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function OJ(r){let e=r[0]==="u",t=r[1]==="{";return e&&!t&&r.length===5||r[0]==="x"&&r.length===3?String.fromCharCode(parseInt(r.slice(1),16)):e&&t?String.fromCodePoint(parseInt(r.slice(2,-1),16)):vwe.get(r)||r}function xwe(r,e){let t=[],i=e.trim().split(/\s*,\s*/g),n;for(let s of i){let o=Number(s);if(!Number.isNaN(o))t.push(o);else if(n=s.match(bwe))t.push(n[2].replace(Swe,(a,l,c)=>l?OJ(l):c));else throw new Error(`Invalid Chalk template style argument: ${s} (in style '${r}')`)}return t}function Pwe(r){LJ.lastIndex=0;let e=[],t;for(;(t=LJ.exec(r))!==null;){let i=t[1];if(t[2]){let n=xwe(i,t[2]);e.push([i].concat(n))}else e.push([i])}return e}function TJ(r,e){let t={};for(let n of e)for(let s of n.styles)t[s[0]]=n.inverse?null:s.slice(1);let i=r;for(let[n,s]of Object.entries(t))if(!!Array.isArray(s)){if(!(n in i))throw new Error(`Unknown Chalk style: ${n}`);i=s.length>0?i[n](...s):i[n]}return i}MJ.exports=(r,e)=>{let t=[],i=[],n=[];if(e.replace(Qwe,(s,o,a,l,c,u)=>{if(o)n.push(OJ(o));else if(l){let g=n.join("");n=[],i.push(t.length===0?g:TJ(r,t)(g)),t.push({inverse:a,styles:Pwe(l)})}else if(c){if(t.length===0)throw new Error("Found extraneous } in Chalk template literal");i.push(TJ(r,t)(n.join(""))),n=[],t.pop()}else n.push(u)}),i.push(n.join("")),t.length>0){let s=`Chalk template literal is missing ${t.length} closing bracket${t.length===1?"":"s"} (\`}\`)`;throw new Error(s)}return i.join("")}});var wx=w((Vet,YJ)=>{"use strict";var Od=vJ(),{stdout:mx,stderr:Ex}=RJ(),{stringReplaceAll:Dwe,stringEncaseCRLFWithFirstIndex:kwe}=NJ(),UJ=["ansi","ansi","ansi256","ansi16m"],Af=Object.create(null),Rwe=(r,e={})=>{if(e.level>3||e.level<0)throw new Error("The `level` option should be an integer from 0 to 3");let t=mx?mx.level:0;r.level=e.level===void 0?t:e.level},Ix=class{constructor(e){return HJ(e)}},HJ=r=>{let e={};return Rwe(e,r),e.template=(...t)=>Lwe(e.template,...t),Object.setPrototypeOf(e,Ny.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=Ix,e.template};function Ny(r){return HJ(r)}for(let[r,e]of Object.entries(Od))Af[r]={get(){let t=Ly(this,yx(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,r,{value:t}),t}};Af.visible={get(){let r=Ly(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:r}),r}};var GJ=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let r of GJ)Af[r]={get(){let{level:e}=this;return function(...t){let i=yx(Od.color[UJ[e]][r](...t),Od.color.close,this._styler);return Ly(this,i,this._isEmpty)}}};for(let r of GJ){let e="bg"+r[0].toUpperCase()+r.slice(1);Af[e]={get(){let{level:t}=this;return function(...i){let n=yx(Od.bgColor[UJ[t]][r](...i),Od.bgColor.close,this._styler);return Ly(this,n,this._isEmpty)}}}}var Fwe=Object.defineProperties(()=>{},{...Af,level:{enumerable:!0,get(){return this._generator.level},set(r){this._generator.level=r}}}),yx=(r,e,t)=>{let i,n;return t===void 0?(i=r,n=e):(i=t.openAll+r,n=e+t.closeAll),{open:r,close:e,openAll:i,closeAll:n,parent:t}},Ly=(r,e,t)=>{let i=(...n)=>Nwe(i,n.length===1?""+n[0]:n.join(" "));return i.__proto__=Fwe,i._generator=r,i._styler=e,i._isEmpty=t,i},Nwe=(r,e)=>{if(r.level<=0||!e)return r._isEmpty?"":e;let t=r._styler;if(t===void 0)return e;let{openAll:i,closeAll:n}=t;if(e.indexOf("\x1B")!==-1)for(;t!==void 0;)e=Dwe(e,t.close,t.open),t=t.parent;let s=e.indexOf(`
`);return s!==-1&&(e=kwe(e,n,i,s)),i+e+n},Cx,Lwe=(r,...e)=>{let[t]=e;if(!Array.isArray(t))return e.join(" ");let i=e.slice(1),n=[t.raw[0]];for(let s=1;s<t.length;s++)n.push(String(i[s-1]).replace(/[{}\\]/g,"\\$&"),String(t.raw[s]));return Cx===void 0&&(Cx=KJ()),Cx(r,n.join(""))};Object.defineProperties(Ny.prototype,Af);var Md=Ny();Md.supportsColor=mx;Md.stderr=Ny({level:Ex?Ex.level:0});Md.stderr.supportsColor=Ex;Md.Level={None:0,Basic:1,Ansi256:2,TrueColor:3,0:"None",1:"Basic",2:"Ansi256",3:"TrueColor"};YJ.exports=Md});var Ty=w(ps=>{"use strict";ps.isInteger=r=>typeof r=="number"?Number.isInteger(r):typeof r=="string"&&r.trim()!==""?Number.isInteger(Number(r)):!1;ps.find=(r,e)=>r.nodes.find(t=>t.type===e);ps.exceedsLimit=(r,e,t=1,i)=>i===!1||!ps.isInteger(r)||!ps.isInteger(e)?!1:(Number(e)-Number(r))/Number(t)>=i;ps.escapeNode=(r,e=0,t)=>{let i=r.nodes[e];!i||(t&&i.type===t||i.type==="open"||i.type==="close")&&i.escaped!==!0&&(i.value="\\"+i.value,i.escaped=!0)};ps.encloseBrace=r=>r.type!=="brace"?!1:r.commas>>0+r.ranges>>0===0?(r.invalid=!0,!0):!1;ps.isInvalidBrace=r=>r.type!=="brace"?!1:r.invalid===!0||r.dollar?!0:r.commas>>0+r.ranges>>0===0||r.open!==!0||r.close!==!0?(r.invalid=!0,!0):!1;ps.isOpenOrClose=r=>r.type==="open"||r.type==="close"?!0:r.open===!0||r.close===!0;ps.reduce=r=>r.reduce((e,t)=>(t.type==="text"&&e.push(t.value),t.type==="range"&&(t.type="text"),e),[]);ps.flatten=(...r)=>{let e=[],t=i=>{for(let n=0;n<i.length;n++){let s=i[n];Array.isArray(s)?t(s,e):s!==void 0&&e.push(s)}return e};return t(r),e}});var Oy=w((Zet,qJ)=>{"use strict";var jJ=Ty();qJ.exports=(r,e={})=>{let t=(i,n={})=>{let s=e.escapeInvalid&&jJ.isInvalidBrace(n),o=i.invalid===!0&&e.escapeInvalid===!0,a="";if(i.value)return(s||o)&&jJ.isOpenOrClose(i)?"\\"+i.value:i.value;if(i.value)return i.value;if(i.nodes)for(let l of i.nodes)a+=t(l);return a};return t(r)}});var WJ=w((_et,JJ)=>{"use strict";JJ.exports=function(r){return typeof r=="number"?r-r===0:typeof r=="string"&&r.trim()!==""?Number.isFinite?Number.isFinite(+r):isFinite(+r):!1}});var rW=w(($et,tW)=>{"use strict";var zJ=WJ(),dc=(r,e,t)=>{if(zJ(r)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||r===e)return String(r);if(zJ(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let i={relaxZeros:!0,...t};typeof i.strictZeros=="boolean"&&(i.relaxZeros=i.strictZeros===!1);let n=String(i.relaxZeros),s=String(i.shorthand),o=String(i.capture),a=String(i.wrap),l=r+":"+e+"="+n+s+o+a;if(dc.cache.hasOwnProperty(l))return dc.cache[l].result;let c=Math.min(r,e),u=Math.max(r,e);if(Math.abs(c-u)===1){let C=r+"|"+e;return i.capture?`(${C})`:i.wrap===!1?C:`(?:${C})`}let g=eW(r)||eW(e),f={min:r,max:e,a:c,b:u},h=[],p=[];if(g&&(f.isPadded=g,f.maxLen=String(f.max).length),c<0){let C=u<0?Math.abs(u):1;p=VJ(C,Math.abs(c),f,i),c=f.a=0}return u>=0&&(h=VJ(c,u,f,i)),f.negatives=p,f.positives=h,f.result=Twe(p,h,i),i.capture===!0?f.result=`(${f.result})`:i.wrap!==!1&&h.length+p.length>1&&(f.result=`(?:${f.result})`),dc.cache[l]=f,f.result};function Twe(r,e,t){let i=Bx(r,e,"-",!1,t)||[],n=Bx(e,r,"",!1,t)||[],s=Bx(r,e,"-?",!0,t)||[];return i.concat(s).concat(n).join("|")}function Owe(r,e){let t=1,i=1,n=ZJ(r,t),s=new Set([e]);for(;r<=n&&n<=e;)s.add(n),t+=1,n=ZJ(r,t);for(n=_J(e+1,i)-1;r<n&&n<=e;)s.add(n),i+=1,n=_J(e+1,i)-1;return s=[...s],s.sort(Uwe),s}function Mwe(r,e,t){if(r===e)return{pattern:r,count:[],digits:0};let i=Kwe(r,e),n=i.length,s="",o=0;for(let a=0;a<n;a++){let[l,c]=i[a];l===c?s+=l:l!=="0"||c!=="9"?s+=Hwe(l,c,t):o++}return o&&(s+=t.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[o],digits:n}}function VJ(r,e,t,i){let n=Owe(r,e),s=[],o=r,a;for(let l=0;l<n.length;l++){let c=n[l],u=Mwe(String(o),String(c),i),g="";if(!t.isPadded&&a&&a.pattern===u.pattern){a.count.length>1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+$J(a.count),o=c+1;continue}t.isPadded&&(g=Gwe(c,t,i)),u.string=g+u.pattern+$J(u.count),s.push(u),o=c+1,a=u}return s}function Bx(r,e,t,i,n){let s=[];for(let o of r){let{string:a}=o;!i&&!XJ(e,"string",a)&&s.push(t+a),i&&XJ(e,"string",a)&&s.push(t+a)}return s}function Kwe(r,e){let t=[];for(let i=0;i<r.length;i++)t.push([r[i],e[i]]);return t}function Uwe(r,e){return r>e?1:e>r?-1:0}function XJ(r,e,t){return r.some(i=>i[e]===t)}function ZJ(r,e){return Number(String(r).slice(0,-e)+"9".repeat(e))}function _J(r,e){return r-r%Math.pow(10,e)}function $J(r){let[e=0,t=""]=r;return t||e>1?`{${e+(t?","+t:"")}}`:""}function Hwe(r,e,t){return`[${r}${e-r===1?"":"-"}${e}]`}function eW(r){return/^-?(0+)\d/.test(r)}function Gwe(r,e,t){if(!e.isPadded)return r;let i=Math.abs(e.maxLen-String(r).length),n=t.relaxZeros!==!1;switch(i){case 0:return"";case 1:return n?"0?":"0";case 2:return n?"0{0,2}":"00";default:return n?`0{0,${i}}`:`0{${i}}`}}dc.cache={};dc.clearCache=()=>dc.cache={};tW.exports=dc});var Sx=w((ett,cW)=>{"use strict";var Ywe=J("util"),sW=rW(),iW=r=>r!==null&&typeof r=="object"&&!Array.isArray(r 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 BW=w((ntt,wW)=>{"use strict";var tBe=Oy(),{MAX_LENGTH:EW,CHAR_BACKSLASH:vx,CHAR_BACKTICK:rBe,CHAR_COMMA:iBe,CHAR_DOT:nBe,CHAR_LEFT_PARENTHESES:sBe,CHAR_RIGHT_PARENTHESES:oBe,CHAR_LEFT_CURLY_BRACE:aBe,CHAR_RIGHT_CURLY_BRACE:ABe,CHAR_LEFT_SQUARE_BRACKET:IW,CHAR_RIGHT_SQUARE_BRACKET:yW,CHAR_DOUBLE_QUOTE:lBe,CHAR_SINGLE_QUOTE:cBe,CHAR_NO_BREAK_SPACE:uBe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:gBe}=mW(),fBe=(r,e={})=>{if(typeof r!="string")throw new TypeError("Expected a string");let t=e||{},i=typeof t.maxLength=="number"?Math.min(EW,t.maxLength):EW;if(r.length>i)throw new SyntaxError(`Input length (${r.length}), exceeds max characters (${i})`);let n={type:"root",input:r,nodes:[]},s=[n],o=n,a=n,l=0,c=r.length,u=0,g=0,f,h={},p=()=>r[u++],C=y=>{if(y.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&y.type==="text"){a.value+=y.value;return}return o.nodes.push(y),y.parent=o,y.prev=a,a=y,y};for(C({type:"bos"});u<c;)if(o=s[s.length-1],f=p(),!(f===gBe||f===uBe)){if(f===vx){C({type:"text",value:(e.keepEscaping?f:"")+p()});continue}if(f===yW){C({type:"text",value:"\\"+f});continue}if(f===IW){l++;let y=!0,B;for(;u<c&&(B=p());){if(f+=B,B===IW){l++;continue}if(B===vx){f+=p();continue}if(B===yW&&(l--,l===0))break}C({type:"text",value:f});continue}if(f===sBe){o=C({type:"paren",nodes:[]}),s.push(o),C({type:"text",value:f});continue}if(f===oBe){if(o.type!=="paren"){C({type:"text",value:f});continue}o=s.pop(),C({type:"text",value:f}),o=s[s.length-1];continue}if(f===lBe||f===cBe||f===rBe){let y=f,B;for(e.keepQuotes!==!0&&(f="");u<c&&(B=p());){if(B===vx){f+=B+p();continue}if(B===y){e.keepQuotes===!0&&(f+=B);break}f+=B}C({type:"text",value:f});continue}if(f===aBe){g++;let y=a.value&&a.value.slice(-1)==="$"||o.dollar===!0;o=C({type:"brace",open:!0,close:!1,dollar:y,depth:g,commas:0,ranges:0,nodes:[]}),s.push(o),C({type:"open",value:f});continue}if(f===ABe){if(o.type!=="brace"){C({type:"text",value:f});continue}let y="close";o=s.pop(),o.close=!0,C({type:y,value:f}),g--,o=s[s.length-1];continue}if(f===iBe&&g>0){if(o.ranges>0){o.ranges=0;let y=o.nodes.shift();o.nodes=[y,{type:"text",value:tBe(o)}]}C({type:"comma",value:f}),o.commas++;continue}if(f===nBe&&g>0&&o.commas===0){let y=o.nodes;if(g===0||y.length===0){C({type:"text",value:f});continue}if(a.type==="dot"){if(o.range=[],a.value+=f,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){y.pop();let B=y[y.length-1];B.value+=a.value+f,a=B,o.ranges--;continue}C({type:"dot",value:f});continue}C({type:"text",value:f})}do if(o=s.pop(),o.type!=="root"){o.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 y=s[s.length-1],B=y.nodes.indexOf(o);y.nodes.splice(B,1,...o.nodes)}while(s.length>0);return C({type:"eos"}),n};wW.exports=fBe});var SW=w((stt,bW)=>{"use strict";var QW=Oy(),hBe=fW(),pBe=dW(),dBe=BW(),jn=(r,e={})=>{let t=[];if(Array.isArray(r))for(let i of r){let n=jn.create(i,e);Array.isArray(n)?t.push(...n):t.push(n)}else t=[].concat(jn.create(r,e));return e&&e.expand===!0&&e.nodupes===!0&&(t=[...new Set(t)]),t};jn.parse=(r,e={})=>dBe(r,e);jn.stringify=(r,e={})=>QW(typeof r=="string"?jn.parse(r,e):r,e);jn.compile=(r,e={})=>(typeof r=="string"&&(r=jn.parse(r,e)),hBe(r,e));jn.expand=(r,e={})=>{typeof r=="string"&&(r=jn.parse(r,e));let t=pBe(r,e);return e.noempty===!0&&(t=t.filter(Boolean)),e.nodupes===!0&&(t=[...new Set(t)]),t};jn.create=(r,e={})=>r===""||r.length<3?[r]:e.expand!==!0?jn.compile(r,e):jn.expand(r,e);bW.exports=jn});var Ud=w((ott,kW)=>{"use strict";var CBe=J("path"),Mo="\\\\/",vW=`[^${Mo}]`,Ra="\\.",mBe="\\+",EBe="\\?",Ky="\\/",IBe="(?=.)",xW="[^/]",xx=`(?:${Ky}|$)`,PW=`(?:^|${Ky})`,Px=`${Ra}{1,2}${xx}`,yBe=`(?!${Ra})`,wBe=`(?!${PW}${Px})`,BBe=`(?!${Ra}{0,1}${xx})`,QBe=`(?!${Px})`,bBe=`[^.${Ky}]`,SBe=`${xW}*?`,DW={DOT_LITERAL:Ra,PLUS_LITERAL:mBe,QMARK_LITERAL:EBe,SLASH_LITERAL:Ky,ONE_CHAR:IBe,QMARK:xW,END_ANCHOR:xx,DOTS_SLASH:Px,NO_DOT:yBe,NO_DOTS:wBe,NO_DOT_SLASH:BBe,NO_DOTS_SLASH:QBe,QMARK_NO_DOT:bBe,STAR:SBe,START_ANCHOR:PW},vBe={...DW,SLASH_LITERAL:`[${Mo}]`,QMARK:vW,STAR:`${vW}*?`,DOTS_SLASH:`${Ra}{1,2}(?:[${Mo}]|$)`,NO_DOT:`(?!${Ra})`,NO_DOTS:`(?!(?:^|[${Mo}])${Ra}{1,2}(?:[${Mo}]|$))`,NO_DOT_SLASH:`(?!${Ra}{0,1}(?:[${Mo}]|$))`,NO_DOTS_SLASH:`(?!${Ra}{1,2}(?:[${Mo}]|$))`,QMARK_NO_DOT:`[^.${Mo}]`,START_ANCHOR:`(?:^|[${Mo}])`,END_ANCHOR:`(?:[${Mo}]|$)`},xBe={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:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",spaceLine truncated
Please report this to https://github.com/szmarczak/http2-wrapper/`);p(C)}return}i[0].resolve(h);return}}if(o in this.queue){if(a in this.queue[o]){this.queue[o][a].listeners.push(...i),this._tryToCreateNewSession(o,a);return}}else this.queue[o]={};let l=()=>{o in this.queue&&this.queue[o][a]===c&&(delete this.queue[o][a],Object.keys(this.queue[o]).length===0&&delete this.queue[o])},c=()=>{let u=`${a}:${o}`,g=!1;try{let f=tPe.connect(e,{createConnection:this.createConnection,settings:this.settings,session:this.tlsSessionCache.get(u),...t});f[nn]=0,f[Of]=!1;let h=()=>f[nn]<f.remoteSettings.maxConcurrentStreams,p=!0;f.socket.once("session",y=>{this.tlsSessionCache.set(u,y)}),f.once("error",y=>{for(let{reject:B}of i)B(y);this.tlsSessionCache.delete(u)}),f.setTimeout(this.timeout,()=>{f.destroy()}),f.once("close",()=>{if(g){p&&this._freeSessionsCount--,this._sessionsCount--;let y=this.sessions[o];y.splice(y.indexOf(f),1),y.length===0&&delete this.sessions[o]}else{let y=new Error("Session closed without receiving a SETTINGS frame");y.code="HTTP2WRAPPER_NOSETTINGS";for(let{reject:B}of i)B(y);l()}this._tryToCreateNewSession(o,a)});let C=()=>{if(!(!(o in this.queue)||!h())){for(let y of f[ys])if(y in this.queue[o]){let{listeners:B}=this.queue[o][y];for(;B.length!==0&&h();)B.shift().resolve(f);let v=this.queue[o];if(v[y].listeners.length===0&&(delete v[y],Object.keys(v).length===0)){delete this.queue[o];break}if(!h())break}}};f.on("origin",()=>{f[ys]=f.originSet,h()&&(C(),Uk(this.sessions[o],f))}),f.once("remoteSettings",()=>{if(f.ref(),f.unref(),this._sessionsCount++,c.destroyed){let y=new Error("Agent has been destroyed");for(let B of i)B.reject(y);f.destroy();return}f[ys]=f.originSet;{let y=this.sessions;if(o in y){let B=y[o];B.splice(nPe(B,f,sPe),0,f)}else y[o]=[f]}this._freeSessionsCount+=1,g=!0,this.emit("session",f),C(),l(),f[nn]===0&&this._freeSessionsCount>this.maxFreeSessions&&f.close(),i.length!==0&&(this.getSession(a,t,i),i.length=0),f.on("remoteSettings",()=>{C(),Uk(this.sessions[o],f)})}),f[g5]=f.request,f.request=(y,B)=>{if(f[Of])throw new Error("The session is gracefully closing. No new streams are allowed.");let v=f[g5](y,B);return f.ref(),++f[nn],f[nn]===f.remoteSettings.maxConcurrentStreams&&this._freeSessionsCount--,v.once("close",()=>{if(p=h(),--f[nn],!f.destroyed&&!f.closed&&(oPe(this.sessions[o],f),h()&&!f.closed)){p||(this._freeSessionsCount++,p=!0);let D=f[nn]===0;D&&f.unref(),D&&(this._freeSessionsCount>this.maxFreeSessions||f[Of])?f.close():(Uk(this.sessions[o],f),C())}}),v}}catch(f){for(let h of i)h.reject(f);l()}};c.listeners=i,c.completed=!1,c.destroyed=!1,this.queue[o][a]=c,this._tryToCreateNewSession(o,a)})}request(e,t,i,n){return new Promise((s,o)=>{this.getSession(e,t,[{reject:o,resolve:a=>{try{s(a.request(i,n))}catch(l){o(l)}}}])})}createConnection(e,t){return zo.connect(e,t)}static connect(e,t){t.ALPNProtocols=["h2"];let i=e.port||443,n=e.hostname||e.host;return typeof t.servername>"u"&&(t.servername=n),ePe.connect(i,n,t)}closeFreeSessions(){for(let e of Object.values(this.sessions))for(let t of e)t[nn]===0&&t.close()}destroy(e){for(let t of Object.values(this.sessions))for(let i of t)i.destroy(e);for(let t of Object.values(this.queue))for(let i of Object.values(t))i.destroyed=!0;this.queue={}}get freeSessions(){return f5({agent:this,isFree:!0})}get busySessions(){return f5({agent:this,isFree:!1})}};zo.kCurrentStreamsCount=nn;zo.kGracefullyClosing=Of;p5.exports={Agent:zo,globalAgent:new zo}});var Yk=w((mnt,d5)=>{"use strict";var{Readable:aPe}=J("stream"),Gk=class extends aPe{constructor(e,t){super({highWaterMark:t,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,t){return this.req.setTimeout(e,t),this}_dump(){this._dumped||(this._dumped=!0,this.removeAllListeners("data"),this.resume())}_read(){this.req&&this.req._request.resume()}};d5.exports=Gk});var jk=w((Ent,C5)=>{"use strict";C5.exports=r=>{let e={protocol:r.protocol,hostname:typeof r.hostname=="string"&&r.hostname.startsWith("[")?r.hostname.slice(1,-1):r.hostname,host:r.host,hash:r.hash,search:r.search,pathname:r.pathname,href:r.href,path:`${r.pathname||""}${r.search||""}`};return typeof r.port=="string"&&r.port.length!==0&&(e.port=Number(r.port)),(r.username||r.password)&&(e.auth=`${r.username||""}:${r.password||""}`),e}});var E5=w((Int,m5)=>{"use strict";m5.exports=(r,e,t)=>{for(let i of t)r.on(i,(...n)=>e.emit(i,...n))}});var y5=w((ynt,I5)=>{"use strict";I5.exports=r=>{switch(r){case":method":case":scheme":case":authority":case":path":return!0;default:return!1}}});var B5=w((Bnt,w5)=>{"use strict";var Mf=(r,e,t)=>{w5.exports[e]=class extends r{constructor(...n){super(typeof t=="string"?t:t(n)),this.name=`${su Line truncated
`).reverse(),a=t.stack.slice(t.stack.indexOf(t.message)+t.message.length).split(`
`).reverse();for(;a.length!==0&&a[0]===o[0];)o.shift();this.stack=`${this.stack.slice(0,s)}${o.reverse().join(`
`)}${a.reverse().join(`
`)}`}}};Yt.RequestError=ei;var rB=class extends ei{constructor(e){super(`Redirected ${e.options.maxRedirects} times. Aborting.`,{},e),this.name="MaxRedirectsError"}};Yt.MaxRedirectsError=rB;var iB=class extends ei{constructor(e){super(`Response code ${e.statusCode} (${e.statusMessage})`,{},e.request),this.name="HTTPError"}};Yt.HTTPError=iB;var nB=class extends ei{constructor(e,t){super(e.message,e,t),this.name="CacheError"}};Yt.CacheError=nB;var sB=class extends ei{constructor(e,t){super(e.message,e,t),this.name="UploadError"}};Yt.UploadError=sB;var oB=class extends ei{constructor(e,t,i){super(e.message,e,i),this.name="TimeoutError",this.event=e.event,this.timings=t}};Yt.TimeoutError=oB;var wC=class extends ei{constructor(e,t){super(e.message,e,t),this.name="ReadError"}};Yt.ReadError=wC;var aB=class extends ei{constructor(e){super(`Unsupported protocol "${e.url.protocol}"`,{},e),this.name="UnsupportedProtocolError"}};Yt.UnsupportedProtocolError=aB;var hDe=["socket","connect","continue","information","upgrade","timeout"],AB=class extends s6.Duplex{constructor(e,t={},i){super({autoDestroy:!1,highWaterMark:0}),this[Uf]=0,this[Gf]=0,this.requestInitialized=!1,this[$w]=new Set,this.redirects=[],this[Yf]=!1,this[eB]=!1,this[yC]=[],this.retryCount=0,this._progressCallbacks=[];let n=()=>this._unlockWrite(),s=()=>this._lockWrite();this.on("pipe",c=>{c.prependListener("data",n),c.on("data",s),c.prependListener("end",n),c.on("end",s)}),this.on("unpipe",c=>{c.off("data",n),c.off("data",s),c.off("end",n),c.off("end",s)}),this.on("pipe",c=>{c instanceof hR.IncomingMessage&&(this.options.headers={...c.headers,...this.options.headers})});let{json:o,body:a,form:l}=t;if((o||a||l)&&this._lockWrite(),Yt.kIsNormalizedAlready in t)this.options=t;else try{this.options=this.constructor.normalizeArguments(e,t,i)}catch(c){Ee.default.nodeStream(t.body)&&t.body.destroy(),this.destroy(c);return}(async()=>{var c;try{this.options.body instanceof WPe.ReadStream&&await uDe(this.options.body);let{url:u}=this.options;if(!u)throw new TypeError("Missing `url` property");if(this.requestUrl=u.toString(),decodeURI(this.requestUrl),await this._finalizeBody(),await this._makeRequest(),this.destroyed){(c=this[Pi])===null||c===void 0||c.destroy();return}for(let g of this[yC])g();this[yC].length=0,this.requestInitialized=!0}catch(u){if(u instanceof ei){this._beforeError(u);return}this.destroyed||this.destroy(u)}})()}static normalizeArguments(e,t,i){var n,s,o,a,l;let c=t;if(Ee.default.object(e)&&!Ee.default.urlInstance(e))t={...i,...e,...t};else{if(e&&t&&t.url!==void 0)throw new TypeError("The `url` option is mutually exclusive with the `input` argument");t={...i,...t},e!==void 0&&(t.url=e),Ee.default.urlInstance(t.url)&&(t.url=new zA.URL(t.url.toString()))}if(t.cache===!1&&(t.cache=void 0),t.dnsCache===!1&&(t.dnsCache=void 0),Ee.assert.any([Ee.default.string,Ee.default.undefined],t.method),Ee.assert.any([Ee.default.object,Ee.default.undefined],t.headers),Ee.assert.any([Ee.default.string,Ee.default.urlInstance,Ee.default.undefined],t.prefixUrl),Ee.assert.any([Ee.default.object,Ee.default.undefined],t.cookieJar),Ee.assert.any([Ee.default.object,Ee.default.string,Ee.default.undefined],t.searchParams),Ee.assert.any([Ee.default.object,Ee.default.string,Ee.default.undefined],t.cache),Ee.assert.any([Ee.default.object,Ee.default.number,Ee.default.undefined],t.timeout),Ee.assert.any([Ee.default.object,Ee.default.undefined],t.context),Ee.assert.any([Ee.default.object,Ee.default.undefined],t.hooks),Ee.assert.any([Ee.default.boolean,Ee.default.undefined],t.decompress),Ee.assert.any([Ee.default.boolean,Ee.default.undefined],t.ignoreInvalidCookies),Ee.assert.any([Ee.default.boolean,Ee.default.undefined],t.followRedirect),Ee.assert.any([Ee.default.number,Ee.default.undefined],t.maxRedirects),Ee.assert.any([Ee.default.boolean,Ee.default.undefined],t.throwHttpErrors),Ee.assert.any([Ee.default.boolean,Ee.default.undefined],t.http2),Ee.assert.any([Ee.default.boolean,Ee.default.undefined],t.allowGetBody),Ee.assert.any([Ee.default.string,Ee.default.undefined],t.localAddress),Ee.assert.any([u6.isDnsLookupIpVersion,Ee.default.undefined],t.dnsLookupIpVersion),Ee.assert.any([Ee.default.object,Ee.default.undefined],t.https),Ee.assert.any([Ee.default.boolean,Ee.default.undefined],t.rejectUnauthorized),t.https&&(Ee.assert.any([Ee.default.boolean,Ee.default.undefined],t.https.rejectUnauthorized),Ee.assert.any([Ee.default.function_,Ee.default.undefined],t.https.checkServerIdentity),Ee.assert.any([Ee.default.string,Ee.default.object,Ee.default.array,Ee.default.undefined],t.https.certificateAuthority),Ee.assert.any([Ee.default.string,Ee.default.object,Ee.default.array,Ee.default.undefined],t.https.key),Ee.assert.any([Ee.default.string,Ee.default.object,Ee.default.array,Ee.default.undefined],t.https.certificate),Ee.assert.any([Ee.default.string,Ee.default.undefined],t.https.passphrase),Ee.assert.any([Ee.default.string,Ee.default.buffer,Ee.default.array,Ee.default.undefined],t.https.Line truncated
`,g.message,g.stack);var f=new Error("tunneling socket could not be established, cause="+g.message);f.code="ECONNRESET",e.request.emit("error",f),i.removeSocket(n)}};Ya.prototype.removeSocket=function(e){var t=this.sockets.indexOf(e);if(t!==-1){this.sockets.splice(t,1);var i=this.requests.shift();i&&this.createSocket(i,function(n){i.request.onSocket(n)})}};function O6(r,e){var t=this;Ya.prototype.createSocket.call(t,r,function(i){var n=r.request.getHeader("host"),s=vR({},t.options,{socket:i,servername:n?n.replace(/:.*$/,""):r.host}),o=UDe.connect(0,s);t.sockets[t.sockets.indexOf(i)]=o,e(o)})}function M6(r,e,t){return typeof r=="string"?{host:r,port:e,localAddress:t}:r}function vR(r){for(var e=1,t=arguments.length;e<t;++e){var i=arguments[e];if(typeof i=="object")for(var n=Object.keys(i),s=0,o=n.length;s<o;++s){var a=n[s];i[a]!==void 0&&(r[a]=i[a])}}return r}var _A;process.env.NODE_DEBUG&&/\btunnel\b/.test(process.env.NODE_DEBUG)?_A=function(){var r=Array.prototype.slice.call(arguments);typeof r[0]=="string"?r[0]="TUNNEL: "+r[0]:r.unshift("TUNNEL:"),console.error.apply(console,r)}:_A=function(){};jf.debug=_A});var H6=w((est,U6)=>{U6.exports=K6()});var _6=w((dB,FR)=>{var Z6=Object.assign({},J("fs")),RR=function(){var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(r=r||__filename),function(e){e=e||{};var t=typeof e<"u"?e:{},i,n;t.ready=new Promise(function(d,E){i=d,n=E});var s={},o;for(o in t)t.hasOwnProperty(o)&&(s[o]=t[o]);var a=[],l="./this.program",c=function(d,E){throw E},u=!1,g=!0,f="";function h(d){return t.locateFile?t.locateFile(d,f):f+d}var p,C,y,B;g&&(u?f=J("path").dirname(f)+"/":f=__dirname+"/",p=function(E,I){var k=pa(E);return k?I?k:k.toString():(y||(y=Z6),B||(B=J("path")),E=B.normalize(E),y.readFileSync(E,I?null:"utf8"))},C=function(E){var I=p(E,!0);return I.buffer||(I=new Uint8Array(I)),re(I.buffer),I},process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),a=process.argv.slice(2),c=function(d){process.exit(d)},t.inspect=function(){return"[Emscripten Module object]"});var v=t.print||console.log.bind(console),D=t.printErr||console.warn.bind(console);for(o in s)s.hasOwnProperty(o)&&(t[o]=s[o]);s=null,t.arguments&&(a=t.arguments),t.thisProgram&&(l=t.thisProgram),t.quit&&(c=t.quit);var L=16;function H(d,E){return E||(E=L),Math.ceil(d/E)*E}var j=0,$=function(d){j=d},V;t.wasmBinary&&(V=t.wasmBinary);var W=t.noExitRuntime||!0;typeof WebAssembly!="object"&&wr("no native wasm support detected");function _(d,E,I){switch(E=E||"i8",E.charAt(E.length-1)==="*"&&(E="i32"),E){case"i1":return ne[d>>0];case"i8":return ne[d>>0];case"i16":return pe[d>>1];case"i32":return de[d>>2];case"i64":return de[d>>2];case"float":return Pt[d>>2];case"double":return It[d>>3];default:wr("invalid type for getValue: "+E)}return null}var A,ae=!1,ge;function re(d,E){d||wr("Assertion failed: "+E)}function O(d){var E=t["_"+d];return re(E,"Cannot call unknown function "+d+", make sure it is exported"),E}function F(d,E,I,k,T){var Z={string:function(it){var Et=0;if(it!=null&&it!==0){var Qe=(it.length<<2)+1;Et=Q(Qe),oe(it,Et,Qe)}return Et},array:function(it){var Et=Q(it.length);return fe(it,Et),Et}};function te(it){return E==="string"?Fe(it):E==="boolean"?Boolean(it):it}var Be=O(d),me=[],Je=0;if(k)for(var nt=0;nt<k.length;nt++){var wt=Z[I[nt]];wt?(Je===0&&(Je=KE()),me[nt]=wt(k[nt])):me[nt]=k[nt]}var lt=Be.apply(null,me);return lt=te(lt),Je!==0&&UE(Je),lt}function ue(d,E,I,k){I=I||[];var T=I.every(function(te){return te==="number"}),Z=E!=="string";return Z&&T&&!k?O(d):function(){return F(d,E,I,arguments,k)}}var he=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function ke(d,E,I){for(var k=E+I,T=E;d[T]&&!(T>=k);)++T;if(T-E>16&&d.subarray&&he)return he.decode(d.subarray(E,T));for(var Z="";E<T;){var te=d[E++];if(!(te&128)){Z+=String.fromCharCode(te);continue}var Be=d[E++]&63;if((te&224)==192){Z+=String.fromCharCode((te&31)<<6|Be);continue}var me=d[E++]&63;if((te&240)==224?te=(te&15)<<12|Be<<6|me:te=(te&7)<<18|Be<<12|me<<6|d[E++]&63,te<65536)Z+=String.fromCharCode(te);else{var Je=te-65536;Z+=String.fromCharCode(55296|Je>>10,56320|Je&1023)}}return Z}function Fe(d,E){return d?ke(Y,d,E):""}function Ne(d,E,I,k){if(!(k>0))return 0;for(var T=I,Z=I+k-1,te=0;te<d.length;++te){var Be=d.charCodeAt(te);if(Be>=55296&&Be<=57343){var me=d.charCodeAt(++te);Be=65536+((Be&1023)<<10)|me&1023}if(Be<=127){if(I>=Z)break;E[I++]=Be}else if(Be<=2047){if(I+1>=Z)break;E[I++]=192|Be>>6,E[I++]=128|Be&63}else if(Be<=65535){if(I+2>=Z)break;E[I++]=224|Be>>12,E[I++]=128|Be>>6&63,E[I++]=128|Be&63}else{if(I+3>=Z)break;E[I++]=240|Be>>18,E[I++]=128|Be>>12&63,E[I++]=128|Be>>6&63,E[I++]=128|Be&63}}return E[I]=0,I-T}function oe(d,E,I){return Ne(d,Y,E,I)}function le(d){for(var E=0,I=0;I<d.length;++I){var k=d.charCodeAt(I);k>=55296&&k<=57343&&(k=65536+((k&1023)<<10)|d.charCodeAt(++I)&1023),k<=127?++E:k<=2047?E+=2:k<=65535?E+=3:E+=4}return E}function we(d){var E=le(d)+1,I=dt(E);return I&&Ne(d,ne,I,E),I}funct Line truncated
`)):typeof readline=="function"&&(E=readline(),E!==null&&(E+=`
`));if(!E)return null;d.input=IA(E,!0)}return d.input.shift()},put_char:function(d,E){E===null||E===10?(v(ke(d.output,0)),d.output=[]):E!=0&&d.output.push(E)},flush:function(d){d.output&&d.output.length>0&&(v(ke(d.output,0)),d.output=[])}},default_tty1_ops:{put_char:function(d,E){E===null||E===10?(D(ke(d.output,0)),d.output=[]):E!=0&&d.output.push(E)},flush:function(d){d.output&&d.output.length>0&&(D(ke(d.output,0)),d.output=[])}}};function is(d){for(var E=H(d,65536),I=dt(E);d<E;)ne[I+d++]=0;return I}var gt={ops_table:null,mount:function(d){return gt.createNode(null,"/",16895,0)},createNode:function(d,E,I,k){if(S.isBlkdev(I)||S.isFIFO(I))throw new S.ErrnoError(63);gt.ops_table||(gt.ops_table={dir:{node:{getattr:gt.node_ops.getattr,setattr:gt.node_ops.setattr,lookup:gt.node_ops.lookup,mknod:gt.node_ops.mknod,rename:gt.node_ops.rename,unlink:gt.node_ops.unlink,rmdir:gt.node_ops.rmdir,readdir:gt.node_ops.readdir,symlink:gt.node_ops.symlink},stream:{llseek:gt.stream_ops.llseek}},file:{node:{getattr:gt.node_ops.getattr,setattr:gt.node_ops.setattr},stream:{llseek:gt.stream_ops.llseek,read:gt.stream_ops.read,write:gt.stream_ops.write,allocate:gt.stream_ops.allocate,mmap:gt.stream_ops.mmap,msync:gt.stream_ops.msync}},link:{node:{getattr:gt.node_ops.getattr,setattr:gt.node_ops.setattr,readlink:gt.node_ops.readlink},stream:{}},chrdev:{node:{getattr:gt.node_ops.getattr,setattr:gt.node_ops.setattr},stream:S.chrdev_stream_ops}});var T=S.createNode(d,E,I,k);return S.isDir(T.mode)?(T.node_ops=gt.ops_table.dir.node,T.stream_ops=gt.ops_table.dir.stream,T.contents={}):S.isFile(T.mode)?(T.node_ops=gt.ops_table.file.node,T.stream_ops=gt.ops_table.file.stream,T.usedBytes=0,T.contents=null):S.isLink(T.mode)?(T.node_ops=gt.ops_table.link.node,T.stream_ops=gt.ops_table.link.stream):S.isChrdev(T.mode)&&(T.node_ops=gt.ops_table.chrdev.node,T.stream_ops=gt.ops_table.chrdev.stream),T.timestamp=Date.now(),d&&(d.contents[E]=T,d.timestamp=T.timestamp),T},getFileDataAsTypedArray:function(d){return d.contents?d.contents.subarray?d.contents.subarray(0,d.usedBytes):new Uint8Array(d.contents):new Uint8Array(0)},expandFileStorage:function(d,E){var I=d.contents?d.contents.length:0;if(!(I>=E)){var k=1024*1024;E=Math.max(E,I*(I<k?2:1.125)>>>0),I!=0&&(E=Math.max(E,256));var T=d.contents;d.contents=new Uint8Array(E),d.usedBytes>0&&d.contents.set(T.subarray(0,d.usedBytes),0)}},resizeFileStorage:function(d,E){if(d.usedBytes!=E)if(E==0)d.contents=null,d.usedBytes=0;else{var I=d.contents;d.contents=new Uint8Array(E),I&&d.contents.set(I.subarray(0,Math.min(E,d.usedBytes))),d.usedBytes=E}},node_ops:{getattr:function(d){var E={};return E.dev=S.isChrdev(d.mode)?d.id:1,E.ino=d.id,E.mode=d.mode,E.nlink=1,E.uid=0,E.gid=0,E.rdev=d.rdev,S.isDir(d.mode)?E.size=4096:S.isFile(d.mode)?E.size=d.usedBytes:S.isLink(d.mode)?E.size=d.link.length:E.size=0,E.atime=new Date(d.timestamp),E.mtime=new Date(d.timestamp),E.ctime=new Date(d.timestamp),E.blksize=4096,E.blocks=Math.ceil(E.size/E.blksize),E},setattr:function(d,E){E.mode!==void 0&&(d.mode=E.mode),E.timestamp!==void 0&&(d.timestamp=E.timestamp),E.size!==void 0&&gt.resizeFileStorage(d,E.size)},lookup:function(d,E){throw S.genericErrors[44]},mknod:function(d,E,I,k){return gt.createNode(d,E,I,k)},rename:function(d,E,I){if(S.isDir(d.mode)){var k;try{k=S.lookupNode(E,I)}catch{}if(k)for(var T in k.contents)throw new S.ErrnoError(55)}delete d.parent.contents[d.name],d.parent.timestamp=Date.now(),d.name=I,E.contents[I]=d,E.timestamp=d.parent.timestamp,d.parent=E},unlink:function(d,E){delete d.contents[E],d.timestamp=Date.now()},rmdir:function(d,E){var I=S.lookupNode(d,E);for(var k in I.contents)throw new S.ErrnoError(55);delete d.contents[E],d.timestamp=Date.now()},readdir:function(d){var E=[".",".."];for(var I in d.contents)!d.contents.hasOwnProperty(I)||E.push(I);return E},symlink:function(d,E,I){var k=gt.createNode(d,E,41471,0);return k.link=I,k},readlink:function(d){if(!S.isLink(d.mode))throw new S.ErrnoError(28);return d.link}},stream_ops:{read:function(d,E,I,k,T){var Z=d.node.contents;if(T>=d.node.usedBytes)return 0;var te=Math.min(d.node.usedBytes-T,k);if(te>8&&Z.subarray)E.set(Z.subarray(T,T+te),I);else for(var Be=0;Be<te;Be++)E[I+Be]=Z[T+Be];return te},write:function(d,E,I,k,T,Z){if(E.buffer===ne.buffer&&(Z=!1),!k)return 0;var te=d.node;if(te.timestamp=Date.now(),E.subarray&&(!te.contents||te.contents.subarray)){if(Z)return te.contents=E.subarray(I,I+k),te.usedBytes=k,k;if(te.usedBytes===0&&T===0)return te.contents=E.slice(I,I+k),te.usedBytes=k,k;if(T+k<=te.usedBytes)return te.contents.set(E.subarray(I,I+k),T),k}if(gt.expandFileStorage(te,T+k),te.contents.subarray&&E.subarray)te.contents.set(E.subarray(I,I+k),T);else for(var Be=0;Be<k;Be++)te.contents[T+Be]=E[I+Be];return te.usedBytes=Math.max(te.usedBytes,T+k),k},llseek:function(d,E,I){var k=E;if(I===1?k+=d.position:I===2&&S.isFile(d.node.mode)&&(k+=d.node.usedBytes),k<0)throw new S.ErrnoError(28);return k},allocate:function(d,E,I){gt.expandFileStorage(d.node,E+I) Line truncated
`,n=Buffer.byteLength(i),s=Math.floor(Math.log(n)/Math.log(10))+1;return n+s>=Math.pow(10,s)&&(s+=1),s+n+i}};TC.parse=(r,e,t)=>new TC(WRe(zRe(r),e),t);var WRe=(r,e)=>e?Object.keys(r).reduce((t,i)=>(t[i]=r[i],t),e):r,zRe=r=>r.replace(/\n$/,"").split(`
`).reduce(VRe,Object.create(null)),VRe=(r,e)=>{let t=parseInt(e,10);if(t!==Buffer.byteLength(e)+1)return r;e=e.substr((t+" ").length);let i=e.split("="),n=i.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!n)return r;let s=i.join("=");return r[n]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(n)?new Date(s*1e3):/^[0-9]+$/.test(s)?+s:s,r};K7.exports=TC});var th=w((xot,U7)=>{U7.exports=r=>{let e=r.length-1,t=-1;for(;e>-1&&r.charAt(e)==="/";)t=e,e--;return t===-1?r:r.slice(0,t)}});var jB=w((Pot,H7)=>{"use strict";H7.exports=r=>class extends r{warn(e,t,i={}){this.file&&(i.file=this.file),this.cwd&&(i.cwd=this.cwd),i.code=t instanceof Error&&t.code||e,i.tarCode=e,!this.strict&&i.recoverable!==!1?(t instanceof Error&&(i=Object.assign(t,i),t=t.message),this.emit("warn",i.tarCode,t,i)):t instanceof Error?this.emit("error",Object.assign(t,i)):this.emit("error",Object.assign(new Error(`${e}: ${t}`),i))}}});var QF=w((kot,G7)=>{"use strict";var qB=["|","<",">","?",":"],BF=qB.map(r=>String.fromCharCode(61440+r.charCodeAt(0))),XRe=new Map(qB.map((r,e)=>[r,BF[e]])),ZRe=new Map(BF.map((r,e)=>[r,qB[e]]));G7.exports={encode:r=>qB.reduce((e,t)=>e.split(t).join(XRe.get(t)),r),decode:r=>BF.reduce((e,t)=>e.split(t).join(ZRe.get(t)),r)}});var bF=w((Rot,j7)=>{var{isAbsolute:_Re,parse:Y7}=J("path").win32;j7.exports=r=>{let e="",t=Y7(r);for(;_Re(r)||t.root;){let i=r.charAt(0)==="/"&&r.slice(0,4)!=="//?/"?"/":t.root;r=r.substr(i.length),e+=i,t=Y7(r)}return[e,r]}});var J7=w((Fot,q7)=>{"use strict";q7.exports=(r,e,t)=>(r&=4095,t&&(r=(r|384)&-19),e&&(r&256&&(r|=64),r&32&&(r|=8),r&4&&(r|=1)),r)});var LF=w((Tot,o9)=>{"use strict";var $7=Vf(),e9=YB(),t9=eh(),Zo=J("fs"),W7=J("path"),Xo=_f(),$Re=th(),r9=(r,e)=>e?(r=Xo(r).replace(/^\.(\/|$)/,""),$Re(e)+"/"+r):Xo(r),eFe=16*1024*1024,z7=Symbol("process"),V7=Symbol("file"),X7=Symbol("directory"),vF=Symbol("symlink"),Z7=Symbol("hardlink"),OC=Symbol("header"),JB=Symbol("read"),xF=Symbol("lstat"),WB=Symbol("onlstat"),PF=Symbol("onread"),DF=Symbol("onreadlink"),kF=Symbol("openfile"),RF=Symbol("onopenfile"),nl=Symbol("close"),zB=Symbol("mode"),FF=Symbol("awaitDrain"),SF=Symbol("ondrain"),_o=Symbol("prefix"),_7=Symbol("hadError"),i9=jB(),tFe=QF(),n9=bF(),s9=J7(),VB=i9(class extends $7{constructor(e,t){if(t=t||{},super(t),typeof e!="string")throw new TypeError("path is required");this.path=Xo(e),this.portable=!!t.portable,this.myuid=process.getuid&&process.getuid()||0,this.myuser=process.env.USER||"",this.maxReadSize=t.maxReadSize||eFe,this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.preservePaths=!!t.preservePaths,this.cwd=Xo(t.cwd||process.cwd()),this.strict=!!t.strict,this.noPax=!!t.noPax,this.noMtime=!!t.noMtime,this.mtime=t.mtime||null,this.prefix=t.prefix?Xo(t.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 t.onwarn=="function"&&this.on("warn",t.onwarn);let i=!1;if(!this.preservePaths){let[n,s]=n9(this.path);n&&(this.path=s,i=n)}this.win32=!!t.win32||process.platform==="win32",this.win32&&(this.path=tFe.decode(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=Xo(t.absolute||W7.resolve(this.cwd,e)),this.path===""&&(this.path="./"),i&&this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute path`,{entry:this,path:i+this.path}),this.statCache.has(this.absolute)?this[WB](this.statCache.get(this.absolute)):this[xF]()}emit(e,...t){return e==="error"&&(this[_7]=!0),super.emit(e,...t)}[xF](){Zo.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[WB](t)})}[WB](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=iFe(e),this.emit("stat",e),this[z7]()}[z7](){switch(this.type){case"File":return this[V7]();case"Directory":return this[X7]();case"SymbolicLink":return this[vF]();default:return this.end()}}[zB](e){return s9(e,this.type==="Directory",this.portable)}[_o](e){return r9(e,this.prefix)}[OC](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new t9({path:this[_o](this.path),linkpath:this.type==="Link"?this[_o](this.linkpath):this.linkpath,mode:this[zB](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 e9({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[_o](this.path),linkpath:this.type==="Link"?this[_o](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.portable?null:this.stat.ino,nlink:this.portabl Line truncated
`}),a},i})});var L0=w((kat,mZ)=>{var aLe=bs(),ALe=cC(),lLe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,cLe=/^\w*$/;function uLe(r,e){if(aLe(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||ALe(r)?!0:cLe.test(r)||!lLe.test(r)||e!=null&&r in Object(e)}mZ.exports=uLe});var T0=w((Rat,EZ)=>{var gLe=Pc(),fLe=bn(),hLe="[object AsyncFunction]",pLe="[object Function]",dLe="[object GeneratorFunction]",CLe="[object Proxy]";function mLe(r){if(!fLe(r))return!1;var e=gLe(r);return e==pLe||e==dLe||e==hLe||e==CLe}EZ.exports=mLe});var yZ=w((Fat,IZ)=>{var ELe=Es(),ILe=ELe["__core-js_shared__"];IZ.exports=ILe});var QZ=w((Nat,BZ)=>{var LN=yZ(),wZ=function(){var r=/[^.]+$/.exec(LN&&LN.keys&&LN.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function yLe(r){return!!wZ&&wZ in r}BZ.exports=yLe});var TN=w((Lat,bZ)=>{var wLe=Function.prototype,BLe=wLe.toString;function QLe(r){if(r!=null){try{return BLe.call(r)}catch{}try{return r+""}catch{}}return""}bZ.exports=QLe});var vZ=w((Tat,SZ)=>{var bLe=T0(),SLe=QZ(),vLe=bn(),xLe=TN(),PLe=/[\\^$.*+?()[\]{}|]/g,DLe=/^\[object .+?Constructor\]$/,kLe=Function.prototype,RLe=Object.prototype,FLe=kLe.toString,NLe=RLe.hasOwnProperty,LLe=RegExp("^"+FLe.call(NLe).replace(PLe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function TLe(r){if(!vLe(r)||SLe(r))return!1;var e=bLe(r)?LLe:DLe;return e.test(xLe(r))}SZ.exports=TLe});var PZ=w((Oat,xZ)=>{function OLe(r,e){return r==null?void 0:r[e]}xZ.exports=OLe});var fl=w((Mat,DZ)=>{var MLe=vZ(),KLe=PZ();function ULe(r,e){var t=KLe(r,e);return MLe(t)?t:void 0}DZ.exports=ULe});var XC=w((Kat,kZ)=>{var HLe=fl(),GLe=HLe(Object,"create");kZ.exports=GLe});var NZ=w((Uat,FZ)=>{var RZ=XC();function YLe(){this.__data__=RZ?RZ(null):{},this.size=0}FZ.exports=YLe});var TZ=w((Hat,LZ)=>{function jLe(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}LZ.exports=jLe});var MZ=w((Gat,OZ)=>{var qLe=XC(),JLe="__lodash_hash_undefined__",WLe=Object.prototype,zLe=WLe.hasOwnProperty;function VLe(r){var e=this.__data__;if(qLe){var t=e[r];return t===JLe?void 0:t}return zLe.call(e,r)?e[r]:void 0}OZ.exports=VLe});var UZ=w((Yat,KZ)=>{var XLe=XC(),ZLe=Object.prototype,_Le=ZLe.hasOwnProperty;function $Le(r){var e=this.__data__;return XLe?e[r]!==void 0:_Le.call(e,r)}KZ.exports=$Le});var GZ=w((jat,HZ)=>{var eTe=XC(),tTe="__lodash_hash_undefined__";function rTe(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=eTe&&e===void 0?tTe:e,this}HZ.exports=rTe});var jZ=w((qat,YZ)=>{var iTe=NZ(),nTe=TZ(),sTe=MZ(),oTe=UZ(),aTe=GZ();function dh(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}dh.prototype.clear=iTe;dh.prototype.delete=nTe;dh.prototype.get=sTe;dh.prototype.has=oTe;dh.prototype.set=aTe;YZ.exports=dh});var JZ=w((Jat,qZ)=>{function ATe(){this.__data__=[],this.size=0}qZ.exports=ATe});var Ch=w((Wat,WZ)=>{function lTe(r,e){return r===e||r!==r&&e!==e}WZ.exports=lTe});var ZC=w((zat,zZ)=>{var cTe=Ch();function uTe(r,e){for(var t=r.length;t--;)if(cTe(r[t][0],e))return t;return-1}zZ.exports=uTe});var XZ=w((Vat,VZ)=>{var gTe=ZC(),fTe=Array.prototype,hTe=fTe.splice;function pTe(r){var e=this.__data__,t=gTe(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():hTe.call(e,t,1),--this.size,!0}VZ.exports=pTe});var _Z=w((Xat,ZZ)=>{var dTe=ZC();function CTe(r){var e=this.__data__,t=dTe(e,r);return t<0?void 0:e[t][1]}ZZ.exports=CTe});var e_=w((Zat,$Z)=>{var mTe=ZC();function ETe(r){return mTe(this.__data__,r)>-1}$Z.exports=ETe});var r_=w((_at,t_)=>{var ITe=ZC();function yTe(r,e){var t=this.__data__,i=ITe(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}t_.exports=yTe});var _C=w(($at,i_)=>{var wTe=JZ(),BTe=XZ(),QTe=_Z(),bTe=e_(),STe=r_();function mh(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}mh.prototype.clear=wTe;mh.prototype.delete=BTe;mh.prototype.get=QTe;mh.prototype.has=bTe;mh.prototype.set=STe;i_.exports=mh});var O0=w((eAt,n_)=>{var vTe=fl(),xTe=Es(),PTe=vTe(xTe,"Map");n_.exports=PTe});var a_=w((tAt,o_)=>{var s_=jZ(),DTe=_C(),kTe=O0();function RTe(){this.size=0,this.__data__={hash:new s_,map:new(kTe||DTe),string:new s_}}o_.exports=RTe});var l_=w((rAt,A_)=>{function FTe(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}A_.exports=FTe});var $C=w((iAt,c_)=>{var NTe=l_();function LTe(r,e){var t=r.__data__;return NTe(e)?t[typeof e=="string"?"string":"hash"]:t.map}c_.exports=LTe});var g_=w((nAt,u_)=>{var TTe=$C();function OTe(r){var e=TTe(this,r).delete(r);return this.size-=e?1:0,e}u_.exports=OTe});var h_=w((sAt,f_)=>{var MTe=$C();function KTe(r){return MTe(this,r).get(r)}f_.exports=KTe});var d_=w((oAt,p_)=>{var UTe=$C();function HTe(r){return UTe(this,r).has(r)}p_.exports=HTe});var m_=w((aAt,C_)=>{var GTe=$C();function YTe(r,e){var t=GTe(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}C_.exports=YTe});var M0=w((AAt,E_)=>{va Line truncated
attempted value: ${s}
`+(o!==s?`result of cast: ${o}`:""))}return n}_cast(e,t){let i=e===void 0?e:this.transforms.reduce((n,s)=>s.call(this,n,e,this),e);return i===void 0&&(i=this.getDefault()),i}_validate(e,t={},i){let{sync:n,path:s,from:o=[],originalValue:a=e,strict:l=this.spec.strict,abortEarly:c=this.spec.abortEarly}=t,u=e;l||(u=this._cast(u,ks({assert:!1},t)));let g={value:u,path:s,options:t,originalValue:a,schema:this,label:this.spec.label,sync:n,from:o},f=[];this._typeError&&f.push(this._typeError),this._whitelistError&&f.push(this._whitelistError),this._blacklistError&&f.push(this._blacklistError),(0,fre.default)({args:g,value:u,path:s,sync:n,tests:f,endEarly:c},h=>{if(h)return void i(h,u);(0,fre.default)({tests:this.tests,args:g,path:s,sync:n,value:u,endEarly:c},i)})}validate(e,t,i){let n=this.resolve(ks({},t,{value:e}));return typeof i=="function"?n._validate(e,t,i):new Promise((s,o)=>n._validate(e,t,(a,l)=>{a?o(a):s(l)}))}validateSync(e,t){let i=this.resolve(ks({},t,{value:e})),n;return i._validate(e,ks({},t,{sync:!0}),(s,o)=>{if(s)throw s;n=o}),n}isValid(e,t){return this.validate(e,t).then(()=>!0,i=>{if(pre.default.isError(i))return!1;throw i})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(i){if(pre.default.isError(i))return!1;throw i}}_getDefault(){let e=this.spec.default;return e==null?e:typeof e=="function"?e.call(this):(0,gre.default)(e)}getDefault(e){return this.resolve(e||{})._getDefault()}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){var t=this.clone();return t.spec.strict=e,t}_isPresent(e){return e!=null}defined(e=Rh.mixed.defined){return this.test({message:e,name:"defined",exclusive:!0,test(t){return t!==void 0}})}required(e=Rh.mixed.required){return this.clone({presence:"required"}).withMutation(t=>t.test({message:e,name:"required",exclusive:!0,test(i){return this.schema._isPresent(i)}}))}notRequired(){var e=this.clone({presence:"optional"});return e.tests=e.tests.filter(t=>t.OPTIONS.name!=="required"),e}nullable(e=!0){var t=this.clone({nullable:e!==!1});return t}transform(e){var t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(e.length===1?typeof e[0]=="function"?t={test:e[0]}:t=e[0]:e.length===2?t={name:e[0],test:e[1]}:t={name:e[0],message:e[1],test:e[2]},t.message===void 0&&(t.message=Rh.mixed.default),typeof t.test!="function")throw new TypeError("`test` is a required parameters");let i=this.clone(),n=(0,uQ.default)(t),s=t.exclusive||t.name&&i.exclusiveTests[t.name]===!0;if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(i.exclusiveTests[t.name]=!!t.exclusive),i.tests=i.tests.filter(o=>!(o.OPTIONS.name===t.name&&(s||o.OPTIONS.test===n.OPTIONS.test))),i.tests.push(n),i}when(e,t){!Array.isArray(e)&&typeof e!="string"&&(t=e,e=".");let i=this.clone(),n=(0,LHe.default)(e).map(s=>new FHe.default(s));return n.forEach(s=>{s.isSibling&&i.deps.push(s.key)}),i.conditions.push(new RHe.default(n,t)),i}typeError(e){var t=this.clone();return t._typeError=(0,uQ.default)({message:e,name:"typeError",test(i){return i!==void 0&&!this.schema.isType(i)?this.createError({params:{type:this.schema._type}}):!0}}),t}oneOf(e,t=Rh.mixed.oneOf){var i=this.clone();return e.forEach(n=>{i._whitelist.add(n),i._blacklist.delete(n)}),i._whitelistError=(0,uQ.default)({message:t,name:"oneOf",test(n){if(n===void 0)return!0;let s=this.schema._whitelist;return s.has(n,this.resolve)?!0:this.createError({params:{values:s.toArray().join(", ")}})}}),i}notOneOf(e,t=Rh.mixed.notOneOf){var i=this.clone();return e.forEach(n=>{i._blacklist.add(n),i._whitelist.delete(n)}),i._blacklistError=(0,uQ.default)({message:t,name:"notOneOf",test(n){let s=this.schema._blacklist;return s.has(n,this.resolve)?this.createError({params:{values:s.toArray().join(", ")}}):!0}}),i}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(){let e=this.clone(),{label:t,meta:i}=e.spec;return{meta:i,label:t,type:e.type,oneOf:e._whitelist.describe(),notOneOf:e._blacklist.describe(),tests:e.tests.map(s=>({name:s.OPTIONS.name,params:s.OPTIONS.params})).filter((s,o,a)=>a.findIndex(l=>l.name===s.name)===o)}}};gQ.default=Ao;Ao.prototype.__isYupSchema__=!0;for(let r of["validate","validateSync"])Ao.prototype[`${r}At`]=function(e,t,i={}){let{parent:n,parentPath:s,schema:o}=(0,NHe.getIn)(this,e,t,i.context);return o[r](n&&n[s],ks({},i,{parent:n,path:e}))};for(let r of["equals","is"])Ao.prototype[r]=Ao.prototype.oneOf;for(let r of["not","nope"])Ao.prototype[r]=Ao.prototype.notOneOf;Ao.prototype.optional=Ao.prototype.notRequired});var mre=w(mm=>{"use strict";Object.defineProperty(mm,"__esModule",{value:!0});mm.create=Cre;mm.default=void 0;var THe=OHe(nA());function OHe(r){return r&&r.__esModule?r:{default:r}}var NL=THe.default,MHe=NL;mm.default=MHe;function Cre(){return new NL}Cre.prototype=NL.prototype});var Fh=w(fQ=>{"use strict";Object.defineProperty(fQ,"__esModule",{value:!0});fQ.default=void 0;var KHe=r=>r==null;fQ.defaul Line truncated
`),c=o.length;for(c>0&&o.includes("unstyle")&&(o=[...new Set(["unstyle",...o])].reverse());c-- >0;)a=t(r.styles[o[c]],a,l);return a},n=(s,o,a)=>{r.styles[s]=e({name:s,codes:o}),(r.keys[a]||(r.keys[a]=[])).push(s),Reflect.defineProperty(r,s,{configurable:!0,enumerable:!0,set(c){r.alias(s,c)},get(){let c=u=>i(u,c.stack);return Reflect.setPrototypeOf(c,r),c.stack=this.stack?this.stack.concat(s):[s],c}})};return n("reset",[0,0],"modifier"),n("bold",[1,22],"modifier"),n("dim",[2,22],"modifier"),n("italic",[3,23],"modifier"),n("underline",[4,24],"modifier"),n("inverse",[7,27],"modifier"),n("hidden",[8,28],"modifier"),n("strikethrough",[9,29],"modifier"),n("black",[30,39],"color"),n("red",[31,39],"color"),n("green",[32,39],"color"),n("yellow",[33,39],"color"),n("blue",[34,39],"color"),n("magenta",[35,39],"color"),n("cyan",[36,39],"color"),n("white",[37,39],"color"),n("gray",[90,39],"color"),n("grey",[90,39],"color"),n("bgBlack",[40,49],"bg"),n("bgRed",[41,49],"bg"),n("bgGreen",[42,49],"bg"),n("bgYellow",[43,49],"bg"),n("bgBlue",[44,49],"bg"),n("bgMagenta",[45,49],"bg"),n("bgCyan",[46,49],"bg"),n("bgWhite",[47,49],"bg"),n("blackBright",[90,39],"bright"),n("redBright",[91,39],"bright"),n("greenBright",[92,39],"bright"),n("yellowBright",[93,39],"bright"),n("blueBright",[94,39],"bright"),n("magentaBright",[95,39],"bright"),n("cyanBright",[96,39],"bright"),n("whiteBright",[97,39],"bright"),n("bgBlackBright",[100,49],"bgBright"),n("bgRedBright",[101,49],"bgBright"),n("bgGreenBright",[102,49],"bgBright"),n("bgYellowBright",[103,49],"bgBright"),n("bgBlueBright",[104,49],"bgBright"),n("bgMagentaBright",[105,49],"bgBright"),n("bgCyanBright",[106,49],"bgBright"),n("bgWhiteBright",[107,49],"bgBright"),r.ansiRegex=_Ye,r.hasColor=r.hasAnsi=s=>(r.ansiRegex.lastIndex=0,typeof s=="string"&&s!==""&&r.ansiRegex.test(s)),r.alias=(s,o)=>{let a=typeof o=="string"?r[o]:o;if(typeof a!="function")throw new TypeError("Expected alias to be the name of an existing color (string) or a function");a.stack||(Reflect.defineProperty(a,"name",{value:s}),r.styles[s]=a,a.stack=[s]),Reflect.defineProperty(r,s,{configurable:!0,enumerable:!0,set(l){r.alias(s,l)},get(){let l=c=>i(c,l.stack);return Reflect.setPrototypeOf(l,r),l.stack=this.stack?this.stack.concat(a.stack):a.stack,l}})},r.theme=s=>{if(!ZYe(s))throw new TypeError("Expected theme to be an object");for(let o of Object.keys(s))r.alias(o,s[o]);return r},r.alias("unstyle",s=>typeof s=="string"&&s!==""?(r.ansiRegex.lastIndex=0,s.replace(r.ansiRegex,"")):""),r.alias("noop",s=>s),r.none=r.clear=r.noop,r.stripColor=r.unstyle,r.symbols=zie(),r.define=n,r};VL.exports=Vie();VL.exports.create=Vie});var ji=w(Lt=>{"use strict";var $Ye=Object.prototype.toString,Rs=lo(),Xie=!1,XL=[],Zie={yellow:"blue",cyan:"red",green:"magenta",black:"white",blue:"yellow",red:"cyan",magenta:"green",white:"black"};Lt.longest=(r,e)=>r.reduce((t,i)=>Math.max(t,e?i[e].length:i.length),0);Lt.hasColor=r=>!!r&&Rs.hasColor(r);var EQ=Lt.isObject=r=>r!==null&&typeof r=="object"&&!Array.isArray(r);Lt.nativeType=r=>$Ye.call(r).slice(8,-1).toLowerCase().replace(/\s/g,"");Lt.isAsyncFn=r=>Lt.nativeType(r)==="asyncfunction";Lt.isPrimitive=r=>r!=null&&typeof r!="object"&&typeof r!="function";Lt.resolve=(r,e,...t)=>typeof e=="function"?e.call(r,...t):e;Lt.scrollDown=(r=[])=>[...r.slice(1),r[0]];Lt.scrollUp=(r=[])=>[r.pop(),...r];Lt.reorder=(r=[])=>{let e=r.slice();return e.sort((t,i)=>t.index>i.index?1:t.index<i.index?-1:0),e};Lt.swap=(r,e,t)=>{let i=r.length,n=t===i?0:t<0?i-1:t,s=r[e];r[e]=r[n],r[n]=s};Lt.width=(r,e=80)=>{let t=r&&r.columns?r.columns:e;return r&&typeof r.getWindowSize=="function"&&(t=r.getWindowSize()[0]),process.platform==="win32"?t-1:t};Lt.height=(r,e=20)=>{let t=r&&r.rows?r.rows:e;return r&&typeof r.getWindowSize=="function"&&(t=r.getWindowSize()[1]),t};Lt.wordWrap=(r,e={})=>{if(!r)return r;typeof e=="number"&&(e={width:e});let{indent:t="",newline:i=`
`+t,width:n=80}=e;n-=((i+t).match(/[^\S\n]/g)||[]).length;let o=`.{1,${n}}([\\s\\u200B]+|$)|[^\\s\\u200B]+?([\\s\\u200B]+|$)`,a=r.trim(),l=new RegExp(o,"g"),c=a.match(l)||[];return c=c.map(u=>u.replace(/\n$/,"")),e.padEnd&&(c=c.map(u=>u.padEnd(n," "))),e.padStart&&(c=c.map(u=>u.padStart(n," "))),t+c.join(i)};Lt.unmute=r=>{let e=r.stack.find(i=>Rs.keys.color.includes(i));return e?Rs[e]:r.stack.find(i=>i.slice(2)==="bg")?Rs[e.slice(2)]:i=>i};Lt.pascal=r=>r?r[0].toUpperCase()+r.slice(1):"";Lt.inverse=r=>{if(!r||!r.stack)return r;let e=r.stack.find(i=>Rs.keys.color.includes(i));if(e){let i=Rs["bg"+Lt.pascal(e)];return i?i.black:r}let t=r.stack.find(i=>i.slice(0,2)==="bg");return t?Rs[t.slice(2).toLowerCase()]||r:Rs.none};Lt.complement=r=>{if(!r||!r.stack)return r;let e=r.stack.find(i=>Rs.keys.color.includes(i)),t=r.stack.find(i=>i.slice(0,2)==="bg");if(e&&!t)return Rs[Zie[e]||e];if(t){let i=t.slice(2).toLowerCase(),n=Zie[i];return n&&Rs["bg"+Lt.pascal(n)]||r}return Rs.none};Lt.meridiem=r=>{let e=r.getHours(),t=r.getMinutes(),i=e>=12?"pm":"am";e=e%12;let n=e===0?12:e,s=t<10?"0"+t:t;return n+":"+s+" "+i};Lt.set=(r={},e="",t)=>e.split(".").reduce((i,n,s,o)=>{let a=o.length-1>s?i[n]||{}:t;return!Lt.isObject(a)&&s<o.length-1&&(a={}),i[n]=a},r);Lt.get=(r={},e="",t)=>{let i=r[e]==null?e.split(".").reduce((n,s)=>n&&n[s],r):r[e];return i==null?t:i};Lt.mixin=(r,e)=>{if(!EQ(r))return e;if(!EQ(e))return r;for(let t of Object.keys(e)){let i=Object.getOwnPropertyDescriptor(e,t);if(i.hasOwnProperty("value"))if(r.hasOwnProperty(t)&&EQ(i.value)){let n=Object.getOwnPropertyDescriptor(r,t);EQ(n.value)?r[t]=Lt.merge({},r[t],e[t]):Reflect.defineProperty(r,t,i)}else Reflect.defineProperty(r,t,i);else Reflect.defineProperty(r,t,i)}return r};Lt.merge=(...r)=>{let e={};for(let t of r)Lt.mixin(e,t);return e};Lt.mixinEmitter=(r,e)=>{let t=e.constructor.prototype;for(let i of Object.keys(t)){let n=t[i];typeof n=="function"?Lt.define(r,i,n.bind(e)):Lt.define(r,i,n)}};Lt.onExit=r=>{let e=(t,i)=>{Xie||(Xie=!0,XL.forEach(n=>n()),t===!0&&process.exit(128+i))};XL.length===0&&(process.once("SIGTERM",e.bind(null,!0,15)),process.once("SIGINT",e.bind(null,!0,2)),process.once("exit",e)),XL.push(r)};Lt.define=(r,e,t)=>{Reflect.defineProperty(r,e,{value:t})};Lt.defineExport=(r,e,t)=>{let i;Reflect.defineProperty(r,e,{enumerable:!0,configurable:!0,set(n){i=n},get(){return i?i():t()}})}});var _ie=w(Kh=>{"use strict";Kh.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"};Kh.shift={up:"shiftUp",down:"shiftDown",left:"shiftLeft",right:"shiftRight",tab:"prev"};Kh.fn={up:"pageUp",down:"pageDown",left:"pageLeft",right:"pageRight",delete:"deleteForward"};Kh.option={b:"backward",f:"forward",d:"cutRight",left:"cutLeft",up:"altUp",down:"altDown"};Kh.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 tne=w((dgt,ene)=>{"use strict";var $ie=J("readline"),eje=_ie(),tje=/^(?:\x1b)([a-zA-Z0-9])$/,rje=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,ije={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 nje(r){return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(r)}function sje(r){return["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(r)}var IQ=(r="",e={})=>{let t,i={name:e.name,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:r,raw:r,...e};if(Buffer.isBuffer(r)?r[0]>127&&r[1]===void 0?(r[0]-=128,r="\x1B"+String(r)):r=String(r):r!==void 0&&typeof r!="string"?r=String(r):r||(r=i.sequence||""),i.sequence=i.sequence||r||i.name,r==="\r")i.raw=void 0,i.name="return";else if(r===`
`)i.name="enter";else if(r===" ")i.name="tab";else if(r==="\b"||r==="\x7F"||r==="\x1B\x7F"||r==="\x1B\b")i.name="backspace",i.meta=r.charAt(0)==="\x1B";else if(r==="\x1B"||r==="\x1B\x1B")i.name="escape",i.meta=r.length===2;else if(r===" "||r==="\x1B ")i.name="space",i.meta=r.length===2;else if(r<="")i.name=String.fromCharCode(r.charCodeAt(0)+"a".charCodeAt(0)-1),i.ctrl=!0;else if(r.length===1&&r>="0"&&r<="9")i.name="number";else if(r.length===1&&r>="a"&&r<="z")i.name=r;else if(r.length===1&&r>="A"&&r<="Z")i.name=r.toLowerCase(),i.shift=!0;else if(t=tje.exec(r))i.meta=!0,i.shift=/^[A-Z]$/.test(t[1]);else if(t=rje.exec(r)){let n=[...r];n[0]==="\x1B"&&n[1]==="\x1B"&&(i.option=!0);let s=[t[1],t[2],t[4],t[6]].filter(Boolean).join(""),o=(t[3]||t[5]||1)-1;i.ctrl=!!(o&4),i.meta=!!(o&10),i.shift=!!(o&1),i.code=s,i.name=ije[s],i.shift=nje(s)||i.shift,i.ctrl=sje(s)||i.ctrl}return i};IQ.listen=(r={},e)=>{let{stdin:t}=r;if(!t||t!==process.stdin&&!t.isTTY)throw new Error("Invalid stream passed");let i=$ie.createInterface({terminal:!0,input:t});$ie.emitKeypressEvents(t,i);let n=(a,l)=>e(a,IQ(a,l),i),s=t.isRaw;return t.isTTY&&t.setRawMode(!0),t.on("keypress",n),i.resume(),()=>{t.isTTY&&t.setRawMode(s),t.removeListener("keypress",n),i.pause(),i.close()}};IQ.action=(r,e,t)=>{let i={...eje,...t};return e.ctrl?(e.action=i.ctrl[e.name],e):e.option&&i.option?(e.action=i.option[e.name],e):e.shift?(e.action=i.shift[e.name],e):(e.action=i.keys[e.name],e)};ene.exports=IQ});var ine=w((Cgt,rne)=>{"use strict";rne.exports=r=>{r.timers=r.timers||{};let e=r.options.timers;if(!!e)for(let t of Object.keys(e)){let i=e[t];typeof i=="number"&&(i={interval:i}),oje(r,t,i)}};function oje(r,e,t={}){let i=r.timers[e]={name:e,start:Date.now(),ms:0,tick:0},n=t.interval||120;i.frames=t.frames||[],i.loading=!0;let s=setInterval(()=>{i.ms=Date.now()-i.start,i.tick++,r.render()},n);return i.stop=()=>{i.loading=!1,clearInterval(s)},Reflect.defineProperty(i,"interval",{value:s}),r.once("close",()=>i.stop()),i.stop}});var sne=w((mgt,nne)=>{"use strict";var{define:aje,width:Aje}=ji(),ZL=class{constructor(e){let t=e.options;aje(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=Aje(t.stdout||process.stdout),Object.assign(this,t),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 t=this._color||e[this.status];return typeof t=="function"?t: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"}};nne.exports=ZL});var ane=w((Egt,one)=>{"use strict";var _L=ji(),Di=lo(),$L={default:Di.noop,noop:Di.noop,set inverse(r){this._inverse=r},get inverse(){return this._inverse||_L.inverse(this.primary)},set complement(r){this._complement=r},get complement(){return this._complement||_L.complement(this.primary)},primary:Di.cyan,success:Di.green,danger:Di.magenta,strong:Di.bold,warning:Di.yellow,muted:Di.dim,disabled:Di.gray,dark:Di.dim.gray,underline:Di.underline,set info(r){this._info=r},get info(){return this._info||this.primary},set em(r){this._em=r},get em(){return this._em||this.primary.underline},set heading(r){this._heading=r},get heading(){return this._heading||this.muted.underline},set pending(r){this._pending=r},get pending(){return this._pending||this.primary},set submitted(r){this._submitted=r},get submitted(){return this._submitted||this.success},set cancelled(r){this._cancelled=r},get cancelled(){return this._cancelled||this.danger},set typing(r){this._typing=r},get typing(){return this._typing||this.dim},set placeholder(r){this._placeholder=r},get placeholder(){return this._placeholder||this.primary.dim},set highlight(r){this._highlight=r},get highlight(){return this._highlight||this.inverse}};$L.merge=(r={})=>{r.styles&&typeof r.styles.enabled=="boolean"&&(Di.enabled=r.styles.enabled),r.styles&&typeof r.styles.visible=="boolean"&&(Di.visible=r.styles.visible);let e=_L.merge({},$L,r.styles);delete e.merge;for(let t of Object.keys(Di))e.hasOwnProperty(t)||Reflect.defineProperty(e,t,{get:()=>Di[t]});for(let t of Object.keys(Di.styles))e.hasOwnProperty(t)||Reflect.defineProperty(e,t,{get:()=>Di[t]});return e};one.exports=$L});var lne=w((Igt,Ane)=>{"use strict";var eT=process.platform==="win32",oA=lo(),lje=ji(),tT={...oA.symbols,upDownDoubleArrow:"\u21D5",upDownDoubleArrow2:"\u2B0D",upDownArrow:"\u2195",asterisk:"*",asterism:"\u2042",bulletWhite:"\u25E6",electr Line truncated
`),c=l[0],u=l[l.length-1],f=(i+(t?" "+t:"")).length,h=f<c.length?c.slice(f+1):"";return{header:o,prompt:c,after:h,rest:l.slice(1),last:u}}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 t=`
`+this.symbols.pointer+" ";typeof e=="string"?t+=e.trim():t+="Invalid input",this.state.error=`
`+this.styles.danger(t),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(),t=Math.ceil(e.prompt.length/this.width);e.rest&&this.write(ru.cursor.down(e.rest.length)),this.write(`
`.repeat(t))}catch{}this.emit("close")}start(){!this.stop&&this.options.show!==!1&&(this.stop=sT.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:t,result:i}=this;if(this.format=()=>e.call(this,this.value),this.result=()=>i.call(this,this.value),typeof t.initial=="function"&&(this.initial=await t.initial.call(this,this)),typeof t.onRun=="function"&&await t.onRun.call(this,this),typeof t.onSubmit=="function"){let n=t.onSubmit.bind(this),s=this.submit.bind(this);delete this.options.onSubmit,this.submit=async()=>(await n(this.name,this.value,this),s())}await this.start(),await this.render()}render(){throw new Error("expected prompt to have a custom render method")}run(){return new Promise(async(e,t)=>{if(this.once("submit",e),this.once("cancel",t),await this.skip())return this.render=()=>{},this.submit();await this.initialize(),this.emit("run")})}async element(e,t,i){let{options:n,state:s,symbols:o,timers:a}=this,l=a&&a[e];s.timer=l;let c=n[e]||s[e]||o[e],u=t&&t[e]!=null?t[e]:await c;if(u==="")return u;let g=await this.resolve(u,s,t,i);return!g&&t&&t[e]?this.resolve(c,s,t,i):g}async prefix(){let e=await this.element("prefix")||this.symbols,t=this.timers&&this.timers.prefix,i=this.state;return i.timer=t,Pn.isObject(e)&&(e=e[i.status]||e.pending),Pn.hasColor(e)?e:(this.styles[i.status]||this.styles.pending)(e)}async message(){let e=await this.element("message");return Pn.hasColor(e)?e:this.styles.strong(e)}async separator(){let e=await this.element("separator")||this.symbols,t=this.timers&&this.timers.separator,i=this.state;i.timer=t;let n=e[i.status]||e.pending||i.separator,s=await this.resolve(n,i);return Pn.isObject(s)&&(s=s[i.status]||s.pending),Pn.hasColor(s)?s:this.styles.muted(s)}async pointer(e,t){let i=await this.element("pointer",e,t);if(typeof i=="string"&&Pn.hasColor(i))return i;if(i){let n=this.styles,s=this.index===t,o=s?n.primary:c=>c,a=await this.resolve(i[s?"on":"off"]||i,this.state),l=Pn.hasColor(a)?a:o(a);return s?l:" ".repeat(a.length)}}async indicator(e,t){let i=await this.element("indicator",e,t);if(typeof i=="string"&&Pn.hasColor(i))return i;if(i){let n=this.styles,s=e.enabled===!0,o=s?n.success:n.dark,a=i[s?"on":"off"]||i;return Pn.hasColor(a)?a:o(a)}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 Pn.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,...t){return Pn.resolve(this,e,...t)}get base(){return Nm.prototype}get style(){return this.styles[this.state.status]}get height(){return this.options.rows||Pn.height(this.stdout,25)}get width(){return this.options.columns||Pn.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:t}=this.state,i=[t,e].find(this.isValue.bind(this));return this.isValue(i)?i:this.initial}static get prompt(){return e=>new this(e).run()}};function mje(r){let e=n=>r[n]===void 0||typeof r[n]=="function",t=["actions","choices","initial","margin","roles","styles","symbols","theme","timers","value"],i=["body","footer","error","header","hint","indicator","message","prefix","separator","skip"];for(let n of Object.keys(r.options)){if(t.includes(n)||/^on[A-Z]/.test(n))continue;let s=r.options[n];typeof s=="function"&&e(n)?i.includes(n)||(r[n]=s.bind(r)):typeof r[n]!="function"&&(r[n]=s)}}function Eje(r){typeof r=="number"&&(r=[r,r,r,r]);let e=[].concat(r||[]),t=n=>n%2===0?`
`:" ",i=[];for(let n=0;n<4;n++){let s=t(n);e[n]?i.push(s.repeat(e[n])):i.push("")}return i}mne.exports=Nm});var yne=w((Bgt,Ine)=>{"use strict";var Ije=ji(),Ene={default(r,e){return e},checkbox(r,e){throw new Error("checkbox role is not implemented yet")},editable(r,e){throw new Error("editable role is not implemented yet")},expandable(r,e){throw new Error("expandable role is not implemented yet")},heading(r,e){return e.disabled="",e.indicator=[e.indicator," "].find(t=>t!=null),e.message=e.message||"",e},input(r,e){throw new Error("input role is not implemented yet")},option(r,e){return Ene.default(r,e)},radio(r,e){throw new Error("radio role is not implemented yet")},separator(r,e){return e.disabled="",e.indicator=[e.indicator," "].find(t=>t!=null),e.message=e.message||r.symbols.line.repeat(5),e},spacer(r,e){return e}};Ine.exports=(r,e={})=>{let t=Ije.merge({},Ene,e.roles);return t[r]||t.default}});var Lm=w((Qgt,Qne)=>{"use strict";var yje=lo(),wje=Uh(),Bje=yne(),yQ=ji(),{reorder:oT,scrollUp:Qje,scrollDown:bje,isObject:wne,swap:Sje}=yQ,aT=class extends wje{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:t,autofocus:i,suggest:n}=this.options;if(this.state._choices=[],this.state.choices=[],this.choices=await Promise.all(await this.toChoices(e)),this.choices.forEach(s=>s.enabled=!1),typeof n!="function"&&this.selectable.length===0)throw new Error("At least one choice must be selectable");wne(t)&&(t=Object.keys(t)),Array.isArray(t)?(i!=null&&(this.index=this.findIndex(i)),t.forEach(s=>this.enable(this.find(s))),await this.render()):(i!=null&&(t=i),typeof t=="string"&&(t=this.findIndex(t)),typeof t=="number"&&t>-1&&(this.index=Math.max(0,Math.min(t,this.choices.length)),this.enable(this.find(this.index)))),this.isDisabled(this.focused)&&await this.down()}async toChoices(e,t){this.state.loadingChoices=!0;let i=[],n=0,s=async(o,a)=>{typeof o=="function"&&(o=await o.call(this)),o instanceof Promise&&(o=await o);for(let l=0;l<o.length;l++){let c=o[l]=await this.toChoice(o[l],n++,a);i.push(c),c.choices&&await s(c.choices,c)}return i};return s(e,t).then(o=>(this.state.loadingChoices=!1,o))}async toChoice(e,t,i){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 n=e.value;if(e=Bje(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=t,e.cursor=0,yQ.define(e,"parent",i),e.level=i?i.level+1:1,e.indent==null&&(e.indent=i?i.indent+" ":e.indent||""),e.path=i?i.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,yje.unstyle(e.message).length));let o={...e};return e.reset=(a=o.input,l=o.value)=>{for(let c of Object.keys(o))e[c]=o[c];e.input=a,e.value=l},n==null&&typeof e.initial=="function"&&(e.input=await e.initial.call(this,this.state,e,t)),e}async onChoice(e,t){this.emit("choice",e,t,this),typeof e.onChoice=="function"&&await e.onChoice.call(this,this.state,e,t)}async addChoice(e,t,i){let n=await this.toChoice(e,t,i);return this.choices.push(n),this.index=this.choices.length-1,this.limit=this.choices.length,n}async newItem(e,t,i){let n={name:"New choice name?",editable:!0,newChoice:!0,...e},s=await this.addChoice(n,t,i);return s.updateChoice=()=>{delete s.newChoice,s.name=s.message=s.input,s.input="",s.cursor=0},this.render()}indent(e){return e.indent==null?e.level>1?" ".repeat(e.level-1):"":e.indent}dispatch(e,t){if(this.multiple&&this[t.name])return this[t.name]();this.alert()}focus(e,t){return typeof t!="boolean"&&(t=e.enabled),t&&!e.enabled&&this.selected.length>=this.maxSelected?this.alert():(this.index=e.index,e.enabled=t&&!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(t=>t.enabled);return this.choices.forEach(t=>t.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(t=>!!t.parent)?(this.toggle(e.parent&&!e.choices?e.parent:e),this.render()):this.a()}toggle(e,t){if(!e.enabled&&this.selected.length>=this.maxSelected)return this.alert();typeof t!="boolean"&&(t=!e.enabled),e.enabled=t,e.choices&&e. Line truncated
`),n;return this.options.choicesHeader&&(n=await this.resolve(this.options.choicesHeader,this.state)),[n,i].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:t}=this.state,i="",n=await this.header(),s=await this.prefix(),o=await this.separator(),a=await this.message();this.options.promptLine!==!1&&(i=[s,a,o,""].join(" "),this.state.prompt=i);let l=await this.format(),c=await this.error()||await this.hint(),u=await this.renderChoices(),g=await this.footer();l&&(i+=l),c&&!i.includes(c)&&(i+=" "+c),e&&!l&&!u.trim()&&this.multiple&&this.emptyError!=null&&(i+=this.styles.danger(this.emptyError)),this.clear(t),this.write([n,i,u,g].filter(Boolean).join(`
`)),this.write(this.margin[2]),this.restore()}};bne.exports=lT});var vne=w((Sgt,Sne)=>{"use strict";var xje=pl(),Pje=(r,e)=>{let t=r.toLowerCase();return i=>{let s=i.toLowerCase().indexOf(t),o=e(i.slice(s,s+t.length));return s>=0?i.slice(0,s)+o+i.slice(s+t.length):i}},cT=class extends xje{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:t,input:i}=this.state;return this.input=i.slice(0,t)+e+i.slice(t),this.moveCursor(1),this.complete()}delete(){let{cursor:e,input:t}=this.state;return t?(this.input=t.slice(0,e-1)+t.slice(e),this.moveCursor(-1),this.complete()):this.alert()}deleteForward(){let{cursor:e,input:t}=this.state;return t[e]===void 0?this.alert():(this.input=`${t}`.slice(0,e)+`${t}`.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,t=this.state._choices){if(typeof this.options.suggest=="function")return this.options.suggest.call(this,e,t);let i=e.toLowerCase();return t.filter(n=>n.message.toLowerCase().includes(i))}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,t=Pje(this.input,e),i=this.choices;this.choices=i.map(n=>({...n,message:t(n.message)})),await super.render(),this.choices=i}submit(){return this.options.multiple&&(this.value=this.selected.map(e=>e.name)),super.submit()}};Sne.exports=cT});var gT=w((vgt,xne)=>{"use strict";var uT=ji();xne.exports=(r,e={})=>{r.cursorHide();let{input:t="",initial:i="",pos:n,showCursor:s=!0,color:o}=e,a=o||r.styles.placeholder,l=uT.inverse(r.styles.primary),c=C=>l(r.styles.black(C)),u=t,g=" ",f=c(g);if(r.blink&&r.blink.off===!0&&(c=C=>C,f=""),s&&n===0&&i===""&&t==="")return c(g);if(s&&n===0&&(t===i||t===""))return c(i[0])+a(i.slice(1));i=uT.isPrimitive(i)?`${i}`:"",t=uT.isPrimitive(t)?`${t}`:"";let h=i&&i.startsWith(t)&&i!==t,p=h?c(i[t.length]):f;if(n!==t.length&&s===!0&&(u=t.slice(0,n)+c(t[n])+t.slice(n+1),p=""),s===!1&&(p=""),h){let C=r.styles.unstyle(u+p);return u+p+a(i.slice(C.length))}return u+p}});var wQ=w((xgt,Pne)=>{"use strict";var Dje=lo(),kje=pl(),Rje=gT(),fT=class extends kje{constructor(e){super({...e,multiple:!0}),this.type="form",this.initial=this.options.initial,this.align=[this.options.align,"right"].find(t=>t!=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(t=>t.reset&&t.reset()),this.render()}dispatch(e){return!!e&&this.append(e)}append(e){let t=this.focused;if(!t)return this.alert();let{cursor:i,input:n}=t;return t.value=t.input=n.slice(0,i)+e+n.slice(i),t.cursor++,this.render()}delete(){let e=this.focused;if(!e||e.cursor<=0)return this.alert();let{cursor:t,input:i}=e;return e.value=e.input=i.slice(0,t-1)+i.slice(t),e.cursor--,this.render()}deleteForward(){let e=this.focused;if(!e)return this.alert();let{cursor:t,input:i}=e;if(i[t]===void 0)return this.alert();let n=`${i}`.slice(0,t)+`${i}`.slice(t+1);return e.value=e.input=n,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,t){return this.dispatch(e,t)}number(e,t){return this.dispatch(e,t)}next(){let e=this.focused;if(!e)return this.alert();let{initial:t,input:i}=e;return t&&t.startsWith(i)&&i!==t?(e.value=e.input=t,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,t){let i=await this.resolve(e.separator,this.state,e,t)||":";return i?" "+this.styles.disabled(i):""}async renderChoice(e,t){await this.onChoice(e,t);let{state:i,styles:n}=this,{cursor:s,initial:o="",name:a,hint:l,input:c=""}=e,{muted:u,submitted:g,primary:f,danger:h}=n,p=l,C=this.index===t,y=e.validate||(()=>!0),B=await this.choiceSeparator(e,t),v=e.message;this.align==="right"&&(v=v.padStart(this.longest+1," ")),this.align==="left"&&(v=v.padEnd(this.longest+1," "));let D=this.values[a]=c||o,L=c?"success":"dark";await y.call(e,D,this.s Line truncated
`)),this.restore()}set value(e){super.value=e}get value(){return this.cast(super.value)}};Lne.exports=pT});var One=w((Rgt,Tne)=>{"use strict";var Uje=BQ(),dT=class extends Uje{constructor(e){super(e),this.default=this.options.default||(this.initial?"(Y/n)":"(y/N)")}};Tne.exports=dT});var Kne=w((Fgt,Mne)=>{"use strict";var Hje=pl(),Gje=wQ(),Hh=Gje.prototype,CT=class extends Hje{constructor(e){super({...e,multiple:!0}),this.align=[this.options.align,"left"].find(t=>t!=null),this.emptyError="",this.values={}}dispatch(e,t){let i=this.focused,n=i.parent||{};return!i.editable&&!n.editable&&(e==="a"||e==="i")?super[e]():Hh.dispatch.call(this,e,t)}append(e,t){return Hh.append.call(this,e,t)}delete(e,t){return Hh.delete.call(this,e,t)}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?Hh.next.call(this):super.next()}prev(){return this.focused.editable?Hh.prev.call(this):super.prev()}async indicator(e,t){let i=e.indicator||"",n=e.editable?i:super.indicator(e,t);return await this.resolve(n,this.state,e,t)||""}indent(e){return e.role==="heading"?"":e.editable?" ":" "}async renderChoice(e,t){return e.indent="",e.editable?Hh.renderChoice.call(this,e,t):super.renderChoice(e,t)}error(){return""}footer(){return this.state.error}async validate(){let e=!0;for(let t of this.choices){if(typeof t.validate!="function"||t.role==="heading")continue;let i=t.parent?this.value[t.parent.name]:this.value;if(t.editable?i=t.value===t.name?t.initial||"":t.value:this.isDisabled(t)||(i=t.enabled===!0),e=await t.validate(i,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 t=e.parent?this.value[e.parent.name]:this.value;if(e.role==="heading"){this.value[e.name]={};continue}e.editable?t[e.name]=e.value===e.name?e.initial||"":e.value:this.isDisabled(e)||(t[e.name]=e.enabled===!0)}return this.base.submit.call(this)}};Mne.exports=CT});var iu=w((Ngt,Une)=>{"use strict";var Yje=Uh(),jje=gT(),{isPrimitive:qje}=ji(),mT=class extends Yje{constructor(e){super(e),this.initial=qje(this.initial)?String(this.initial):"",this.initial&&this.cursorHide(),this.state.prevCursor=0,this.state.clipboard=[]}async keypress(e,t={}){let i=this.state.prevKeypress;return this.state.prevKeypress=t,this.options.multiline===!0&&t.name==="return"&&(!i||i.name!=="return")?this.append(`
`,t):super.keypress(e,t)}moveCursor(e){this.cursor+=e}reset(){return this.input=this.value="",this.cursor=0,this.render()}dispatch(e,t){if(!e||t.ctrl||t.code)return this.alert();this.append(e)}append(e){let{cursor:t,input:i}=this.state;this.input=`${i}`.slice(0,t)+e+`${i}`.slice(t),this.moveCursor(String(e).length),this.render()}insert(e){this.append(e)}delete(){let{cursor:e,input:t}=this.state;if(e<=0)return this.alert();this.input=`${t}`.slice(0,e-1)+`${t}`.slice(e),this.moveCursor(-1),this.render()}deleteForward(){let{cursor:e,input:t}=this.state;if(t[e]===void 0)return this.alert();this.input=`${t}`.slice(0,e)+`${t}`.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 t=this.input.slice(0,e),i=this.input.slice(e),n=t.split(" ");this.state.clipboard.push(n.pop()),this.input=n.join(" "),this.cursor=this.input.length,this.input+=i,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 t=await this.resolve(this.initial,this.state);return this.state.submitted?this.styles.submitted(e||t):jje(this,{input:e,initial:t,pos:this.cursor})}async render(){let e=this.state.size,t=await this.prefix(),i=await this.separator(),n=await this.message(),s=[t,n,i].filter(Boolean).join(" ");this.state.prompt=s;let o=await this.header(),a=await this.format(),l=await this.error()||await this.hint(),c=await this.footer();l&&!a.includes(l)&&(a+=" "+l),s+=" "+a,this.clear(e),this.write([o,s,c].filter(Boolean).join(`
`)),this.restore()}};Une.exports=mT});var Gne=w((Lgt,Hne)=>{"use strict";var Jje=r=>r.filter((e,t)=>r.lastIndexOf(e)===t),QQ=r=>Jje(r).filter(Boolean);Hne.exports=(r,e={},t="")=>{let{past:i=[],present:n=""}=e,s,o;switch(r){case"prev":case"undo":return s=i.slice(0,i.length-1),o=i[i.length-1]||"",{past:QQ([t,...s]),present:o};case"next":case"redo":return s=i.slice(1),o=i[0]||"",{past:QQ([...s,t]),present:o};case"save":return{past:QQ([...i,t]),present:""};case"remove":return o=QQ(i.filter(a=>a!==t)),n="",o.length&&(n=o.pop()),{past:o,present:n};default:throw new Error(`Invalid action: "${r}"`)}}});var IT=w((Tgt,jne)=>{"use strict";var Wje=iu(),Yne=Gne(),ET=class extends Wje{constructor(e){super(e);let t=this.options.history;if(t&&t.store){let i=t.values||this.initial;this.autosave=!!t.autosave,this.store=t.store,this.data=this.store.get("values")||{past:[],present:i},this.initial=this.data.present||this.data.past[this.data.past.length-1]}}completion(e){return this.store?(this.data=Yne(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=Yne("save",this.data,this.input),this.store.set("values",this.data))}submit(){return this.store&&this.autosave===!0&&this.save(),super.submit()}};jne.exports=ET});var Jne=w((Ogt,qne)=>{"use strict";var zje=iu(),yT=class extends zje{format(){return""}};qne.exports=yT});var zne=w((Mgt,Wne)=>{"use strict";var Vje=iu(),wT=class extends Vje{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:t=>t;return this.list.map(e).join(", ")}async submit(e){let t=this.state.error||await this.validate(this.list,this.state);return t!==!0?(this.state.error=t,super.submit()):(this.value=this.list,super.submit())}get list(){return this.split()}};Wne.exports=wT});var Xne=w((Kgt,Vne)=>{"use strict";var Xje=pl(),BT=class extends Xje{constructor(e){super({...e,multiple:!0})}};Vne.exports=BT});var bT=w((Ugt,Zne)=>{"use strict";var Zje=iu(),QT=class extends Zje{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 t=e||this.minor,i=this.toNumber(this.input);return i>this.max+t?this.alert():(this.input=`${i+t}`,this.render())}down(e){let t=e||this.minor,i=this.toNumber(this.input);return i<this.min-t?this.alert():(this.input=`${i-t}`,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(t=>this.isValue(t));return this.value=this.toNumber(e||0),super.submit()}};Zne.exports=QT});var $ne=w((Hgt,_ne)=>{_ne.exports=bT()});var tse=w((Ggt,ese)=>{"use strict";var _je=iu(),ST=class extends _je{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)):""}};ese.exports=ST});var nse=w((Ygt,ise)=>{"use strict";var $je=lo(),eqe=Lm(),rse=ji(),vT=class extends eqe{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 t=e.startNumber||1;typeof this.scale=="number"&&(this.scaleKey=!1,this.scale=Array(this.scale).fill(0).map((i,n)=>({name:n+t})))}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 t of this.choices){e=Math.max(e,t.message.length),t.scaleIndex=t.initial||2,t.scale=[];for(let i=0;i<this.scale.length;i++)t.scale.push({index:i})}this.widths[0]=Math.min(this.widths[0],e+3)}async dispatch(e,t){if(this.multiple)return this[t.name]?await this[t.name](e,t):await super.dispatch(e,t);this.alert()}heading(e,t,i){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(t=>this.styles.info(t.index)).join(", "):""}pointer(){return""}renderScaleKey(){if(this.scaleKey===!1||this.state.submitted)return"";let e=this.scale.map(i=>` ${i.name} - ${i.message}`);return["",...e].map(i=>this.styles.muted(i)).join(`
`)}renderScaleHeading(e){let t=this.scale.map(l=>l.name);typeof this.options.renderScaleHeading=="function"&&(t=this.options.renderScaleHeading.call(this,e));let i=this.scaleLength-t.join("").length,n=Math.round(i/(t.length-1)),o=t.map(l=>this.styles.strong(l)).join(" ".repeat(n)),a=" ".repeat(this.widths[0]);return this.margin[3]+a+this.margin[1]+o}scaleIndicator(e,t,i){if(typeof this.options.scaleIndicator=="function")return this.options.scaleIndicator.call(this,e,t,i);let n=e.scaleIndex===t.index;return t.disabled?this.styles.hint(this.symbols.radio.disabled):n?this.styles.success(this.symbols.radio.on):this.symbols.radio.off}renderScale(e,t){let i=e.scale.map(s=>this.scaleIndicator(e,s,t)),n=this.term==="Hyper"?"":" ";return i.join(n+this.symbols.line.repeat(this.edgeLength))}async renderChoice(e,t){await this.onChoice(e,t);let i=this.index===t,n=await this.pointer(e,t),s=await e.hint;s&&!rse.hasColor(s)&&(s=this.styles.muted(s));let o=p=>this.margin[3]+p.replace(/\s+$/,"").padEnd(this.widths[0]," "),a=this.newline,l=this.indent(e),c=await this.resolve(e.message,this.state,e,t),u=await this.renderScale(e,t),g=this.margin[1]+this.margin[3];this.scaleLength=$je.unstyle(u).length,this.widths[0]=Math.min(this.widths[0],this.width-this.scaleLength-g.length);let h=rse.wordWrap(c,{width:this.widths[0],newline:a}).split(`
`).map(p=>o(p)+this.margin[1]);return i&&(u=this.styles.info(u),h=h.map(p=>this.styles.info(p))),h[0]+=u,this.linebreak&&h.push(""),[l+n,h.join(`
`)].filter(Boolean)}async renderChoices(){if(this.state.submitted)return"";this.tableize();let e=this.visible.map(async(n,s)=>await this.renderChoice(n,s)),t=await Promise.all(e),i=await this.renderScaleHeading();return this.margin[0]+[i,...t.map(n=>n.join(" "))].join(`
`)}async render(){let{submitted:e,size:t}=this.state,i=await this.prefix(),n=await this.separator(),s=await this.message(),o="";this.options.promptLine!==!1&&(o=[i,s,n,""].join(" "),this.state.prompt=o);let a=await this.header(),l=await this.format(),c=await this.renderScaleKey(),u=await this.error()||await this.hint(),g=await this.renderChoices(),f=await this.footer(),h=this.emptyError;l&&(o+=l),u&&!o.includes(u)&&(o+=" "+u),e&&!l&&!g.trim()&&this.multiple&&h!=null&&(o+=this.styles.danger(h)),this.clear(t),this.write([a,o,c,g,f].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)}};ise.exports=vT});var ase=w((jgt,ose)=>{"use strict";var sse=lo(),tqe=(r="")=>typeof r=="string"?r.replace(/^['"]|['"]$/g,""):"",PT=class{constructor(e){this.name=e.key,this.field=e.field||{},this.value=tqe(e.initial||this.field.initial||""),this.message=e.message||this.name,this.cursor=0,this.input="",this.lines=[]}},rqe=async(r={},e={},t=i=>i)=>{let i=new Set,n=r.fields||[],s=r.template,o=[],a=[],l=[],c=1;typeof s=="function"&&(s=await s());let u=-1,g=()=>s[++u],f=()=>s[u+1],h=p=>{p.line=c,o.push(p)};for(h({type:"bos",value:""});u<s.length-1;){let p=g();if(/^[^\S\n ]$/.test(p)){h({type:"text",value:p});continue}if(p===`
`){h({type:"newline",value:p}),c++;continue}if(p==="\\"){p+=g(),h({type:"text",value:p});continue}if((p==="$"||p==="#"||p==="{")&&f()==="{"){p+=g();let B={type:"template",open:p,inner:"",close:"",value:p},v;for(;v=g();){if(v==="}"){f()==="}"&&(v+=g()),B.value+=v,B.close=v;break}v===":"?(B.initial="",B.key=B.inner):B.initial!==void 0&&(B.initial+=v),B.value+=v,B.inner+=v}B.template=B.open+(B.initial||B.inner)+B.close,B.key=B.key||B.inner,e.hasOwnProperty(B.key)&&(B.initial=e[B.key]),B=t(B),h(B),l.push(B.key),i.add(B.key);let D=a.find(L=>L.name===B.key);B.field=n.find(L=>L.name===B.key),D||(D=new PT(B),a.push(D)),D.lines.push(B.line-1);continue}let C=o[o.length-1];C.type==="text"&&C.line===c?C.value+=p:h({type:"text",value:p})}return h({type:"eos",value:""}),{input:s,tabstops:o,unique:i,keys:l,items:a}};ose.exports=async r=>{let e=r.options,t=new Set(e.required===!0?[]:e.required||[]),i={...e.values,...e.initial},{tabstops:n,items:s,keys:o}=await rqe(e,i),a=xT("result",r,e),l=xT("format",r,e),c=xT("validate",r,e,!0),u=r.isValue.bind(r);return async(g={},f=!1)=>{let h=0;g.required=t,g.items=s,g.keys=o,g.output="";let p=async(v,D,L,H)=>{let j=await c(v,D,L,H);return j===!1?"Invalid field "+L.name:j};for(let v of n){let D=v.value,L=v.key;if(v.type!=="template"){D&&(g.output+=D);continue}if(v.type==="template"){let H=s.find(_=>_.name===L);e.required===!0&&g.required.add(H.name);let j=[H.input,g.values[H.value],H.value,D].find(u),V=(H.field||{}).message||v.inner;if(f){let _=await p(g.values[L],g,H,h);if(_&&typeof _=="string"||_===!1){g.invalid.set(L,_);continue}g.invalid.delete(L);let A=await a(g.values[L],g,H,h);g.output+=sse.unstyle(A);continue}H.placeholder=!1;let W=D;D=await l(D,g,H,h),j!==D?(g.values[L]=j,D=r.styles.typing(j),g.missing.delete(V)):(g.values[L]=void 0,j=`<${V}>`,D=r.styles.primary(j),H.placeholder=!0,g.required.has(L)&&g.missing.add(V)),g.missing.has(V)&&g.validating&&(D=r.styles.warning(j)),g.invalid.has(L)&&g.validating&&(D=r.styles.danger(j)),h===g.index&&(W!==D?D=r.styles.underline(D):D=r.styles.heading(sse.unstyle(D))),h++}D&&(g.output+=D)}let C=g.output.split(`
`).map(v=>" "+v),y=s.length,B=0;for(let v of s)g.invalid.has(v.name)&&v.lines.forEach(D=>{C[D][0]===" "&&(C[D]=g.styles.danger(g.symbols.bullet)+C[D].slice(1))}),r.isValue(g.values[v.name])&&B++;return g.completed=(B/y*100).toFixed(0),g.output=C.join(`
`),g.output}};function xT(r,e,t,i){return(n,s,o,a)=>typeof o.field[r]=="function"?o.field[r].call(e,n,s,o,a):[i,n].find(l=>e.isValue(l))}});var lse=w((qgt,Ase)=>{"use strict";var iqe=lo(),nqe=ase(),sqe=Uh(),DT=class extends sqe{constructor(e){super(e),this.cursorHide(),this.reset(!0)}async initialize(){this.interpolate=await nqe(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 t=this.getItem();this.cursor+=e,t.cursor+=e}dispatch(e,t){if(!t.code&&!t.ctrl&&e!=null&&this.getItem()){this.append(e,t);return}this.alert()}append(e,t){let i=this.getItem(),n=i.input.slice(0,this.cursor),s=i.input.slice(this.cursor);this.input=i.input=`${n}${e}${s}`,this.moveCursor(1),this.render()}delete(){let e=this.getItem();if(this.cursor<=0||!e.input)return this.alert();let t=e.input.slice(this.cursor),i=e.input.slice(0,this.cursor-1);this.input=e.input=`${i}${t}`,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 t=this.state.completed<100?this.styles.warning:this.styles.success;return this.state.submitted===!0&&this.state.completed!==100&&(t=this.styles.danger),t(`${this.state.completed}% completed`)}async render(){let{index:e,keys:t=[],submitted:i,size:n}=this.state,s=[this.options.newline,`
`].find(v=>v!=null),o=await this.prefix(),a=await this.separator(),l=await this.message(),c=[o,l,a].filter(Boolean).join(" ");this.state.prompt=c;let u=await this.header(),g=await this.error()||"",f=await this.hint()||"",h=i?"":await this.interpolate(this.state),p=this.state.key=t[e]||"",C=await this.format(p),y=await this.footer();C&&(c+=" "+C),f&&!C&&this.state.completed===0&&(c+=" "+f),this.clear(n);let B=[u,c,h,y,g.trim()];this.write(B.filter(Boolean).join(s)),this.restore()}getItem(e){let{items:t,keys:i,index:n}=this.state,s=t.find(o=>o.name===i[n]);return s&&s.input!=null&&(this.input=s.input,this.cursor=s.cursor),s}async submit(){typeof this.interpolate!="function"&&await this.initialize(),await this.interpolate(this.state,!0);let{invalid:e,missing:t,output:i,values:n}=this.state;if(e.size){let a="";for(let[l,c]of e)a+=`Invalid ${l}: ${c}
`;return this.state.error=a,super.submit()}if(t.size)return this.state.error="Required: "+[...t.keys()].join(", "),super.submit();let o=iqe.unstyle(i).split(`
`).map(a=>a.slice(1)).join(`
`);return this.value={values:n,result:o},super.submit()}};Ase.exports=DT});var use=w((Jgt,cse)=>{"use strict";var oqe="(Use <shift>+<up/down> to sort)",aqe=pl(),kT=class extends aqe{constructor(e){super({...e,reorder:!1,sort:!0,multiple:!0}),this.state.hint=[this.options.hint,oqe].find(this.isValue.bind(this))}indicator(){return""}async renderChoice(e,t){let i=await super.renderChoice(e,t),n=this.symbols.identicalTo+" ",s=this.index===t&&this.sorting?this.styles.muted(n):" ";return this.options.drag===!1&&(s=""),this.options.numbered===!0?s+`${t+1} - `+i:s+i}get selected(){return this.choices}submit(){return this.value=this.choices.map(e=>e.value),super.submit()}};cse.exports=kT});var fse=w((Wgt,gse)=>{"use strict";var Aqe=Lm(),RT=class extends Aqe{constructor(e={}){if(super(e),this.emptyError=e.emptyError||"No items were selected",this.term=process.env.TERM_PROGRAM,!this.options.header){let t=["","4 - Strongly Agree","3 - Agree","2 - Neutral","1 - Disagree","0 - Strongly Disagree",""];t=t.map(i=>this.styles.muted(i)),this.state.header=t.join(`
`)}}async toChoices(...e){if(this.createdScales)return!1;this.createdScales=!0;let t=await super.toChoices(...e);for(let i of t)i.scale=lqe(5,this.options),i.scaleIdx=2;return t}dispatch(){this.alert()}space(){let e=this.focused,t=e.scale[e.scaleIdx],i=t.selected;return e.scale.forEach(n=>n.selected=!1),t.selected=!i,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,t){await this.onChoice(e,t);let i=this.index===t,n=this.term==="Hyper",s=n?9:8,o=n?"":" ",a=this.symbols.line.repeat(s),l=" ".repeat(s+(n?0:1)),c=D=>(D?this.styles.success("\u25C9"):"\u25EF")+o,u=t+1+".",g=i?this.styles.heading:this.styles.noop,f=await this.resolve(e.message,this.state,e,t),h=this.indent(e),p=h+e.scale.map((D,L)=>c(L===e.scaleIdx)).join(a),C=D=>D===e.scaleIdx?g(D):D,y=h+e.scale.map((D,L)=>C(L)).join(l),B=()=>[u,f].filter(Boolean).join(" "),v=()=>[B(),p,y," "].filter(Boolean).join(`
`);return i&&(p=this.styles.cyan(p),y=this.styles.cyan(y)),v()}async renderChoices(){if(this.state.submitted)return"";let e=this.visible.map(async(i,n)=>await this.renderChoice(i,n)),t=await Promise.all(e);return t.length||t.push(this.styles.danger("No matching choices")),t.join(`
`)}format(){return this.state.submitted?this.choices.map(t=>this.styles.info(t.scaleIdx)).join(", "):""}async render(){let{submitted:e,size:t}=this.state,i=await this.prefix(),n=await this.separator(),s=await this.message(),o=[i,s,n].filter(Boolean).join(" ");this.state.prompt=o;let a=await this.header(),l=await this.format(),c=await this.error()||await this.hint(),u=await this.renderChoices(),g=await this.footer();(l||!c)&&(o+=" "+l),c&&!o.includes(c)&&(o+=" "+c),e&&!l&&!u&&this.multiple&&this.type!=="form"&&(o+=this.styles.danger(this.emptyError)),this.clear(t),this.write([o,a,u,g].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 lqe(r,e={}){if(Array.isArray(e.scale))return e.scale.map(i=>({...i}));let t=[];for(let i=1;i<r+1;i++)t.push({i,selected:!1});return t}gse.exports=RT});var pse=w((zgt,hse)=>{hse.exports=IT()});var Cse=w((Vgt,dse)=>{"use strict";var cqe=BQ(),FT=class extends cqe{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="",t){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=i=>this.styles.primary.underline(i);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,t=await this.header(),i=await this.prefix(),n=await this.separator(),s=await this.message(),o=await this.format(),a=await this.error()||await this.hint(),l=await this.footer(),c=[i,s,n,o].join(" ");this.state.prompt=c,a&&!c.includes(a)&&(c+=" "+a),this.clear(e),this.write([t,c,l].filter(Boolean).join(`
`)),this.write(this.margin[2]),this.restore()}};dse.exports=FT});var Ese=w((Xgt,mse)=>{"use strict";var uqe=pl(),NT=class extends uqe{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,t){let i=await super.toChoices(e,t);if(i.length<2)throw new Error("Please give at least two choices to the user");if(this.options.correctChoice>i.length)throw new Error("Please specify the index of the correct answer from the list of choices");return i}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)}}};mse.exports=NT});var yse=w(LT=>{"use strict";var Ise=ji(),ui=(r,e)=>{Ise.defineExport(LT,r,e),Ise.defineExport(LT,r.toLowerCase(),e)};ui("AutoComplete",()=>vne());ui("BasicAuth",()=>Nne());ui("Confirm",()=>One());ui("Editable",()=>Kne());ui("Form",()=>wQ());ui("Input",()=>IT());ui("Invisible",()=>Jne());ui("List",()=>zne());ui("MultiSelect",()=>Xne());ui("Numeral",()=>$ne());ui("Password",()=>tse());ui("Scale",()=>nse());ui("Select",()=>pl());ui("Snippet",()=>lse());ui("Sort",()=>use());ui("Survey",()=>fse());ui("Text",()=>pse());ui("Toggle",()=>Cse());ui("Quiz",()=>Ese())});var Bse=w((_gt,wse)=>{wse.exports={ArrayPrompt:Lm(),AuthPrompt:hT(),BooleanPrompt:BQ(),NumberPrompt:bT(),StringPrompt:iu()}});var Om=w(($gt,bse)=>{"use strict";var Qse=J("assert"),OT=J("events"),dl=ji(),uo=class extends OT{constructor(e,t){super(),this.options=dl.merge({},e),this.answers={...t}}register(e,t){if(dl.isObject(e)){for(let n of Object.keys(e))this.register(n,e[n]);return this}Qse.equal(typeof t,"function","expected a function");let i=e.toLowerCase();return t.prototype instanceof this.Prompt?this.prompts[i]=t:this.prompts[i]=t(this.Prompt,this),this}async prompt(e=[]){for(let t of[].concat(e))try{typeof t=="function"&&(t=await t.call(this)),await this.ask(dl.merge({},this.options,t))}catch(i){return Promise.reject(i)}return this.answers}async ask(e){typeof e=="function"&&(e=await e.call(this));let t=dl.merge({},this.options,e),{type:i,name:n}=e,{set:s,get:o}=dl;if(typeof i=="function"&&(i=await i.call(this,e,this.answers)),!i)return this.answers[n];Qse(this.prompts[i],`Prompt "${i}" is not registered`);let a=new this.prompts[i](t),l=o(this.answers,n);a.state.answers=this.answers,a.enquirer=this,n&&a.on("submit",u=>{this.emit("answer",n,u,a),s(this.answers,n,u)});let c=a.emit.bind(a);return a.emit=(...u)=>(this.emit.call(this,...u),c(...u)),this.emit("prompt",a,this),t.autofill&&l!=null?(a.value=a.input=l,t.autofill==="show"&&await a.submit()):l=a.value=await a.run(),l}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||Uh()}static get prompts(){return yse()}static get types(){return Bse()}static get prompt(){let e=(t,...i)=>{let n=new this(...i),s=n.emit.bind(n);return n.emit=(...o)=>(e.emit(...o),s(...o)),n.prompt(t)};return dl.mixinEmitter(e,new OT),e}};dl.mixinEmitter(uo,new OT);var TT=uo.prompts;for(let r of Object.keys(TT)){let e=r.toLowerCase(),t=i=>new TT[r](i).run();uo.prompt[e]=t,uo[e]=t,uo[r]||Reflect.defineProperty(uo,r,{get:()=>TT[r]})}var Tm=r=>{dl.defineExport(uo,r,()=>uo.types[r])};Tm("ArrayPrompt");Tm("AuthPrompt");Tm("BooleanPrompt");Tm("NumberPrompt");Tm("StringPrompt");bse.exports=uo});var Lse=w((Uft,Nse)=>{function dqe(r,e){for(var t=-1,i=r==null?0:r.length;++t<i&&e(r[t],t,r)!==!1;);return r}Nse.exports=dqe});var Yh=w((Hft,Tse)=>{var Cqe=K0(),mqe=yh();function Eqe(r,e,t,i){var n=!t;t||(t={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=i?i(t[a],r[a],a,t,r):void 0;l===void 0&&(l=r[a]),n?mqe(t,a,l):Cqe(t,a,l)}return t}Tse.exports=Eqe});var Mse=w((Gft,Ose)=>{var Iqe=Yh(),yqe=Ph();function wqe(r,e){return r&&Iqe(e,yqe(e),r)}Ose.exports=wqe});var Use=w((Yft,Kse)=>{function Bqe(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}Kse.exports=Bqe});var Gse=w((jft,Hse)=>{var Qqe=bn(),bqe=rQ(),Sqe=Use(),vqe=Object.prototype,xqe=vqe.hasOwnProperty;function Pqe(r){if(!Qqe(r))return Sqe(r);var e=bqe(r),t=[];for(var i in r)i=="constructor"&&(e||!xqe.call(r,i))||t.push(i);return t}Hse.exports=Pqe});var jh=w((qft,Yse)=>{var Dqe=aL(),kqe=Gse(),Rqe=cm();function Fqe(r){return Rqe(r)?Dqe(r,!0):kqe(r)}Yse.exports=Fqe});var qse=w((Jft,jse)=>{var Nqe=Yh(),Lqe=jh();function Tqe(r,e){return r&&Nqe(e,Lqe(e),r)}jse.exports=Tqe});var YT=w((Hm,qh)=>{var Oqe=Es(),Vse=typeof Hm=="object"&&Hm&&!Hm.nodeType&&Hm,Jse=Vse&&typeof qh=="object"&&qh&&!qh.nodeType&&qh,Mqe=Jse&&Jse.exports===Vse,Wse=Mqe?Oqe.Buffer:void 0,zse=Wse?Wse.allocUnsafe:void 0;function Kqe(r,e){if(e)return r.slice();var t=r.length,i=zse?zse(t):new r.constructor(t);return r.copy(i),i Line truncated
`:"";return o?g+=`@IF EXIST ${o} (\r
${o} ${l} ${n} ${u}%*\r
) ELSE (\r
@SETLOCAL\r
@SET PATHEXT=%PATHEXT:;.JS;=;%\r
${a} ${l} ${n} ${u}%*\r
)\r
`:g+=`@${a} ${l} ${n} ${u}%*\r
`,g}function Sze(r,e,t){let i=Fs.relative(Fs.dirname(e),r),n=t.prog&&t.prog.split("\\").join("/"),s;i=i.split("\\").join("/");let o=Fs.isAbsolute(i)?`"${i}"`:`"$basedir/${i}"`,a=t.args||"",l=nM(t.nodePath).posix;n?(s=`"$basedir/${t.prog}"`,i=o):(n=o,a="",i="");let c=t.progArgs?`${t.progArgs.join(" ")} `:"",u=`#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")
case \`uname\` in
*CYGWIN*) basedir=\`cygpath -w "$basedir"\`;;
esac
`,g=t.nodePath?`export NODE_PATH="${l}"
`:"";return s?u+=`${g}if [ -x ${s} ]; then
exec ${s} ${a} ${i} ${c}"$@"
else
exec ${n} ${a} ${i} ${c}"$@"
fi
`:u+=`${g}${n} ${a} ${i} ${c}"$@"
exit $?
`,u}function vze(r,e,t){let i=Fs.relative(Fs.dirname(e),r),n=t.prog&&t.prog.split("\\").join("/"),s=n&&`"${n}$exe"`,o;i=i.split("\\").join("/");let a=Fs.isAbsolute(i)?`"${i}"`:`"$basedir/${i}"`,l=t.args||"",c=nM(t.nodePath),u=c.win32,g=c.posix;s?(o=`"$basedir/${t.prog}$exe"`,i=a):(s=a,l="",i="");let f=t.progArgs?`${t.progArgs.join(" ")} `:"",h=`#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
${t.nodePath?`$env_node_path=$env:NODE_PATH
$env:NODE_PATH="${u}"
`:""}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 t.nodePath&&(h+=` else {
$env:NODE_PATH="${g}"
}`),o?h+=`
$ret=0
if (Test-Path ${o}) {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & ${o} ${l} ${i} ${f}$args
} else {
& ${o} ${l} ${i} ${f}$args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & ${s} ${l} ${i} ${f}$args
} else {
& ${s} ${l} ${i} ${f}$args
}
$ret=$LASTEXITCODE
}
${t.nodePath?`$env:NODE_PATH=$env_node_path
`:""}exit $ret
`:h+=`
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & ${s} ${l} ${i} ${f}$args
} else {
& ${s} ${l} ${i} ${f}$args
}
${t.nodePath?`$env:NODE_PATH=$env_node_path
`:""}exit $LASTEXITCODE
`,h}function xze(r,e){return e.fs_.chmod(r,493)}function nM(r){if(!r)return{win32:"",posix:""};let e=typeof r=="string"?r.split(Fs.delimiter):Array.from(r),t={};for(let i=0;i<e.length;i++){let n=e[i].split("/").join("\\"),s=Qle()?e[i].split("\\").join("/").replace(/^([^:\\/]*):/,(o,a)=>`/mnt/${a.toLowerCase()}`):e[i];t.win32=t.win32?`${t.win32};${n}`:n,t.posix=t.posix?`${t.posix}:${s}`:s,t[i]={win32:n,posix:s}}return t}Sle.exports=iM});var dM=w((jQt,Wle)=>{Wle.exports=J("stream")});var Zle=w((qQt,Xle)=>{"use strict";function zle(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),t.push.apply(t,i)}return t}function zze(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zle(Object(t),!0).forEach(function(i){Vze(r,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):zle(Object(t)).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i))})}return r}function Vze(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Xze(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Vle(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function Zze(r,e,t){return e&&Vle(r.prototype,e),t&&Vle(r,t),r}var _ze=J("buffer"),hb=_ze.Buffer,$ze=J("util"),CM=$ze.inspect,e5e=CM&&CM.custom||"inspect";function t5e(r,e,t){hb.prototype.copy.call(r,e,t)}Xle.exports=function(){function r(){Xze(this,r),this.head=null,this.tail=null,this.length=0}return Zze(r,[{key:"push",value:function(t){var i={data:t,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}},{key:"unshift",value:function(t){var i={data:t,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length}},{key:"shift",value:function(){if(this.length!==0){var t=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(this.length===0)return"";for(var i=this.head,n=""+i.data;i=i.next;)n+=t+i.data;return n}},{key:"concat",value:function(t){if(this.length===0)return hb.alloc(0);for(var i=hb.allocUnsafe(t>>>0),n=this.head,s=0;n;)t5e(n.data,i,s),s+=n.data.length,n=n.next;return i}},{key:"consume",value:function(t,i){var n;return t<this.head.data.length?(n=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):t===this.head.data.length?n=this.shift():n=i?this._getString(t):this._getBuffer(t),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var i=this.head,n=1,s=i.data;for(t-=s.length;i=i.next;){var o=i.data,a=t>o.length?o.length:t;if(a===o.length?s+=o:s+=o.slice(0,t),t-=a,t===0){a===o.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(a));break}++n}return this.length-=n,s}},{key:"_getBuffer",value:function(t){var i=hb.allocUnsafe(t),n=this.head,s=1;for(n.data.copy(i),t-=n.data.length;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(o.copy(i,i.length-t,0,a),t-=a,t===0){a===o.length?(++s,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++s}return this.length-=s,i}},{key:e5e,value:function(t,i){return CM(this,zze({},i,{depth:0,customInspect:!1}))}}]),r}()});var EM=w((JQt,$le)=>{"use strict";function r5e(r,e){var t=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(mM,this,r)):process.nextTick(mM,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(s){!e&&s?t._writableState?t._writableState.errorEmitted?process.nextTick(pb,t):(t._writableState.errorEmitted=!0,process.nextTick(_le,t,s)):process.nextTick(_le,t,s):e?(process.nextTick(pb,t),e(s)):process.nextTick(pb,t)}),this)}function _le(r,e){mM(r,e),pb(r)}function pb(r){r._writableState&&!r._writableState.emitClose||r._readableState&&!r._readableState.emitClose||r.emit("close")}function i5e(){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 mM(r,e){r.emit("error",e)}function n5e(r,e){var t=r._readableState,i=r._writableState;t&&t.a Line truncated
`)),r.linkname&&(e+=WM(" linkpath="+r.linkname+`
`));var t=r.pax;if(t)for(var i in t)e+=WM(" "+i+"="+t[i]+`
`);return Buffer.from(e)};fp.decodePax=function(r){for(var e={};r.length;){for(var t=0;t<r.length&&r[t]!==32;)t++;var i=parseInt(r.slice(0,t).toString(),10);if(!i)return e;var n=r.slice(t+1,i-1).toString(),s=n.indexOf("=");if(s===-1)return e;e[n.slice(0,s)]=n.slice(s+1),r=r.slice(i)}return e};fp.encode=function(r){var e=X6e(512),t=r.name,i="";if(r.typeflag===5&&t[t.length-1]!=="/"&&(t+="/"),Buffer.byteLength(t)!==t.length)return null;for(;Buffer.byteLength(t)>100;){var n=t.indexOf("/");if(n===-1)return null;i+=i?"/"+t.slice(0,n):t.slice(0,n),t=t.slice(n+1)}return Buffer.byteLength(t)>100||Buffer.byteLength(i)>155||r.linkname&&Buffer.byteLength(r.linkname)>100?null:(e.write(t),e.write(xl(r.mode&rVe,6),100),e.write(xl(r.uid,6),108),e.write(xl(r.gid,6),116),e.write(xl(r.size,11),124),e.write(xl(r.mtime.getTime()/1e3|0,11),136),e[156]=$ce+sVe(r.type),r.linkname&&e.write(r.linkname,157),eue.copy(e,yE),$6e.copy(e,zM),r.uname&&e.write(r.uname,265),r.gname&&e.write(r.gname,297),e.write(xl(r.devmajor||0,6),329),e.write(xl(r.devminor||0,6),337),i&&e.write(i,345),e.write(xl(rue(e),6),148),e)};fp.decode=function(r,e,t){var i=r[156]===0?0:r[156]-$ce,n=gp(r,0,100,e),s=Pl(r,100,8),o=Pl(r,108,8),a=Pl(r,116,8),l=Pl(r,124,12),c=Pl(r,136,12),u=nVe(i),g=r[157]===0?null:gp(r,157,100,e),f=gp(r,265,32),h=gp(r,297,32),p=Pl(r,329,8),C=Pl(r,337,8),y=rue(r);if(y===8*32)return null;if(y!==Pl(r,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(eue.compare(r,yE,yE+6)===0)r[345]&&(n=gp(r,345,155,e)+"/"+n);else if(!(eVe.compare(r,yE,yE+6)===0&&tVe.compare(r,zM,zM+2)===0)){if(!t)throw new Error("Invalid tar header: unknown format.")}return i===0&&n&&n[n.length-1]==="/"&&(i=5),{name:n,mode:s,uid:o,gid:a,size:l,mtime:new Date(1e3*c),type:u,linkname:g,uname:f,gname:h,devmajor:p,devminor:C}}});var lue=w((gbt,Aue)=>{var nue=J("util"),aVe=_ce(),wE=VM(),sue=up().Writable,oue=up().PassThrough,aue=function(){},iue=function(r){return r&=511,r&&512-r},AVe=function(r,e){var t=new Db(r,e);return t.end(),t},lVe=function(r,e){return e.path&&(r.name=e.path),e.linkpath&&(r.linkname=e.linkpath),e.size&&(r.size=parseInt(e.size,10)),r.pax=e,r},Db=function(r,e){this._parent=r,this.offset=e,oue.call(this,{autoDestroy:!1})};nue.inherits(Db,oue);Db.prototype.destroy=function(r){this._parent.destroy(r)};var hA=function(r){if(!(this instanceof hA))return new hA(r);sue.call(this,r),r=r||{},this._offset=0,this._buffer=aVe(),this._missing=0,this._partial=!1,this._onparse=aue,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,t=e._buffer,i=function(){e._continue()},n=function(f){if(e._locked=!1,f)return e.destroy(f);e._stream||i()},s=function(){e._stream=null;var f=iue(e._header.size);f?e._parse(f,o):e._parse(512,g),e._locked||i()},o=function(){e._buffer.consume(iue(e._header.size)),e._parse(512,g),i()},a=function(){var f=e._header.size;e._paxGlobal=wE.decodePax(t.slice(0,f)),t.consume(f),s()},l=function(){var f=e._header.size;e._pax=wE.decodePax(t.slice(0,f)),e._paxGlobal&&(e._pax=Object.assign({},e._paxGlobal,e._pax)),t.consume(f),s()},c=function(){var f=e._header.size;this._gnuLongPath=wE.decodeLongPath(t.slice(0,f),r.filenameEncoding),t.consume(f),s()},u=function(){var f=e._header.size;this._gnuLongLinkPath=wE.decodeLongPath(t.slice(0,f),r.filenameEncoding),t.consume(f),s()},g=function(){var f=e._offset,h;try{h=e._header=wE.decode(t.slice(0,512),r.filenameEncoding,r.allowUnknownFormat)}catch(p){e.emit("error",p)}if(t.consume(512),!h){e._parse(512,g),i();return}if(h.type==="gnu-long-path"){e._parse(h.size,c),i();return}if(h.type==="gnu-long-link-path"){e._parse(h.size,u),i();return}if(h.type==="pax-global-header"){e._parse(h.size,a),i();return}if(h.type==="pax-header"){e._parse(h.size,l),i();return}if(e._gnuLongPath&&(h.name=e._gnuLongPath,e._gnuLongPath=null),e._gnuLongLinkPath&&(h.linkname=e._gnuLongLinkPath,e._gnuLongLinkPath=null),e._pax&&(e._header=h=lVe(h,e._pax),e._pax=null),e._locked=!0,!h.size||h.type==="directory"){e._parse(512,g),e.emit("entry",h,AVe(e,f),n);return}e._stream=new Db(e,f),e.emit("entry",h,e._stream,n),e._parse(h.size,s),i()};this._onheader=g,this._parse(512,g)};nue.inherits(hA,sue);hA.prototype.destroy=function(r){this._destroyed||(this._destroyed=!0,r&&this.emit("error",r),this.emit("close"),this._stream&&this._stream.emit("close"))};hA.prototype._parse=function(r,e){this._destroyed||(this._offset+=r,this._missing=r,e===this._onheader&&(this._partial=!1),this._onparse=e)};hA.prototype._continue=function(){if(!this._destroyed){var r=this._cb;this._cb=aue,this._overflow?this._write(this._overflow,void 0,r):r()}};hA.prototype._write=function(r,e,t){if(!this._destroyed){var i=this._stream,n=this._buffer,s=this._missing;if(r.length&&(this._partial=!0),r.length<s)return this._missing-=r.length,this._overflow=null,i?i.write(r,t):(n.append(r),t Line truncated
Wanted: ${t.size}
Found: ${r.length}`);throw a.code="EBADSIZE",a.found=r.length,a.expected=t.size,a.sri=e,a}else{let a=new Error(`Integrity checksum failed when using ${i}: Wanted ${e}, but got ${s}. (${r.length} bytes)`);throw a.code="EINTEGRITY",a.found=s,a.expected=e,a.algorithm=i,a.sri=e,a}}ca.exports.checkStream=UVe;function UVe(r,e,t){t=on(t);let i=t.Promise||Promise,n=o1(t.concat({integrity:e}));return new i((s,o)=>{r.pipe(n),r.on("error",o),n.on("error",o);let a;n.on("verified",l=>{a=l}),n.on("end",()=>s(a)),n.on("data",()=>{})})}ca.exports.integrityStream=o1;function o1(r){r=on(r);let e=r.integrity&&la(r.integrity,r),t=e&&Object.keys(e).length,i=t&&e.pickAlgorithm(r),n=t&&e[i],s=Array.from(new Set(r.algorithms.concat(i?[i]:[]))),o=s.map(bE.createHash),a=0,l=new kVe({transform(c,u,g){a+=c.length,o.forEach(f=>f.update(c,u)),g(null,c,u)}}).on("end",()=>{let c=r.options&&r.options.length?`?${r.options.join("?")}`:"",u=la(o.map((f,h)=>`${s[h]}-${f.digest("base64")}${c}`).join(" "),r),g=t&&u.match(e,r);if(typeof r.size=="number"&&a!==r.size){let f=new Error(`stream size mismatch when checking ${e}.
Wanted: ${r.size}
Found: ${a}`);f.code="EBADSIZE",f.found=a,f.expected=r.size,f.sri=e,l.emit("error",f)}else if(r.integrity&&!g){let f=new Error(`${e} integrity checksum failed when using ${i}: wanted ${n} but got ${u}. (${a} bytes)`);f.code="EINTEGRITY",f.found=u,f.expected=n,f.algorithm=i,f.sri=e,l.emit("error",f)}else l.emit("size",a),l.emit("integrity",u),g&&l.emit("verified",g)});return l}ca.exports.create=HVe;function HVe(r){r=on(r);let e=r.algorithms,t=r.options.length?`?${r.options.join("?")}`:"",i=e.map(bE.createHash);return{update:function(n,s){return i.forEach(o=>o.update(n,s)),this},digest:function(n){return e.reduce((o,a)=>{let l=i.shift().digest("base64"),c=new Dl(`${a}-${l}${t}`,r);if(c.algorithm&&c.digest){let u=c.algorithm;o[u]||(o[u]=[]),o[u].push(c)}return o},new zu)}}}var GVe=new Set(bE.getHashes()),kue=["md5","whirlpool","sha1","sha224","sha256","sha384","sha512","sha3","sha3-256","sha3-384","sha3-512","sha3_256","sha3_384","sha3_512"].filter(r=>GVe.has(r));function YVe(r,e){return kue.indexOf(r.toLowerCase())>=kue.indexOf(e.toLowerCase())?r:e}});var im={};ut(im,{BuildType:()=>F0,Cache:()=>Rt,Configuration:()=>ye,DEFAULT_LOCK_FILENAME:()=>ok,DEFAULT_RC_FILENAME:()=>sk,FormatType:()=>xi,InstallMode:()=>$n,LightReport:()=>ra,LinkType:()=>df,Manifest:()=>ot,MessageName:()=>Ct,MultiFetcher:()=>vf,PackageExtensionStatus:()=>Xx,PackageExtensionType:()=>Vx,Project:()=>je,ProjectLookup:()=>ck,Report:()=>vi,ReportError:()=>at,SettingsType:()=>ak,StreamReport:()=>Ge,TAG_REGEXP:()=>Pf,TelemetryManager:()=>Bh,ThrowReport:()=>ti,VirtualFetcher:()=>Df,Workspace:()=>wh,WorkspaceFetcher:()=>Rf,WorkspaceResolver:()=>jr,YarnVersion:()=>Lr,execUtils:()=>Cr,folderUtils:()=>kw,formatUtils:()=>ee,hashUtils:()=>li,httpUtils:()=>Xt,miscUtils:()=>Ie,nodeUtils:()=>Is,parseMessageName:()=>RI,scriptUtils:()=>Wt,semverUtils:()=>vt,stringifyMessageName:()=>RA,structUtils:()=>P,tgzUtils:()=>mi,treeUtils:()=>_n});var Cr={};ut(Cr,{EndStrategy:()=>hk,ExecError:()=>Kw,PipeError:()=>hC,execvp:()=>tk,pipevp:()=>Wo});var qp={};ut(qp,{AliasFS:()=>bo,CwdFS:()=>qt,DEFAULT_COMPRESSION_LEVEL:()=>Jl,FakeFS:()=>Ea,Filename:()=>xt,JailFS:()=>So,LazyFS:()=>Bg,LinkStrategy:()=>dS,NoFS:()=>Gp,NodeFS:()=>$t,PortablePath:()=>Oe,PosixFS:()=>Qg,ProxiedFS:()=>pi,VirtualFS:()=>Br,ZipFS:()=>Wr,ZipOpenFS:()=>On,constants:()=>xr,extendFs:()=>nI,normalizeLineEndings:()=>ql,npath:()=>K,opendir:()=>ZE,patchFs:()=>QS,ppath:()=>x,statUtils:()=>Tp,toFilename:()=>Ur,xfs:()=>M});var xr={};ut(xr,{SAFE_TIME:()=>eK,S_IFDIR:()=>Gl,S_IFLNK:()=>jl,S_IFMT:()=>Ys,S_IFREG:()=>Yl});var Ys=61440,Gl=16384,Yl=32768,jl=40960,eK=456789e3;var Tp={};ut(Tp,{BigIntStatsEntry:()=>Ig,DEFAULT_MODE:()=>Np,DirEntry:()=>lS,StatEntry:()=>ma,areStatsEqual:()=>uS,clearStats:()=>YE,convertToBigIntStats:()=>jE,makeDefaultStats:()=>Lp,makeEmptyStats:()=>kge});var cS=Pe(J("util"));var Np=33188,lS=class{constructor(){this.name="";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}},ma=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=Np;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}},Ig=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(Np);this.nlink=BigInt(1);this.rdev=BigInt(0);this.blocks=BigInt(1)}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&BigInt(61440))===BigInt(16384)}isFIFO(){return!1}isFile(){return(this.mode&BigInt(61440))===BigInt(32768)}isSocket(){return!1}isSymbolicLink(){return(this.mode&BigInt(61440))===BigInt(40960)}};function Lp(){return new ma}function kge(){return YE(Lp())}function YE(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e)){let t=r[e];typeof t=="number"?r[e]=0:typeof t=="bigint"?r[e]=BigInt(0):cS.types.isDate(t)&&(r[e]=new Date(0))}return r}function jE(r){let e=new Ig;for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)){let i=r[t];typeof i=="number"?e[t]=BigInt(i):cS.types.isDate(i)&&(e[t]=new Date(i))}return e.atimeNs=e.atimeMs*BigInt(1e6),e.mtimeNs=e.mtimeMs*BigInt(1e6),e.ctimeNs=e.ctimeMs*BigInt(1e6),e.birthti Line truncated
`)}writeJsonSync(e,t){return this.writeFileSync(e,`${JSON.stringify(t,null,2)}
`)}async preserveTimePromise(e,t){let i=await this.lstatPromise(e),n=await t();typeof n<"u"&&(e=n),this.lutimesPromise?await this.lutimesPromise(e,i.atime,i.mtime):i.isSymbolicLink()||await this.utimesPromise(e,i.atime,i.mtime)}async preserveTimeSync(e,t){let i=this.lstatSync(e),n=t();typeof n<"u"&&(e=n),this.lutimesSync?this.lutimesSync(e,i.atime,i.mtime):i.isSymbolicLink()||this.utimesSync(e,i.atime,i.mtime)}},vA=class extends Ea{constructor(){super(x)}};function Hge(r){let e=r.match(/\r?\n/g);if(e===null)return aK.EOL;let t=e.filter(n=>n===`\r
`).length,i=e.length-t;return t>i?`\r
`:`
`}function ql(r,e){return e.replace(/\r?\n/g,Hge(r))}var wg=J("fs"),IS=J("stream"),uK=J("util"),yS=Pe(J("zlib"));var AK=Pe(J("fs"));var $t=class extends vA{constructor(t=AK.default){super();this.realFs=t,typeof this.realFs.lutimes<"u"&&(this.lutimesPromise=this.lutimesPromiseImpl,this.lutimesSync=this.lutimesSyncImpl)}getExtractHint(){return!1}getRealPath(){return Oe.root}resolve(t){return x.resolve(t)}async openPromise(t,i,n){return await new Promise((s,o)=>{this.realFs.open(K.fromPortablePath(t),i,n,this.makeCallback(s,o))})}openSync(t,i,n){return this.realFs.openSync(K.fromPortablePath(t),i,n)}async opendirPromise(t,i){return await new Promise((n,s)=>{typeof i<"u"?this.realFs.opendir(K.fromPortablePath(t),i,this.makeCallback(n,s)):this.realFs.opendir(K.fromPortablePath(t),this.makeCallback(n,s))}).then(n=>Object.defineProperty(n,"path",{value:t,configurable:!0,writable:!0}))}opendirSync(t,i){let n=typeof i<"u"?this.realFs.opendirSync(K.fromPortablePath(t),i):this.realFs.opendirSync(K.fromPortablePath(t));return Object.defineProperty(n,"path",{value:t,configurable:!0,writable:!0})}async readPromise(t,i,n=0,s=0,o=-1){return await new Promise((a,l)=>{this.realFs.read(t,i,n,s,o,(c,u)=>{c?l(c):a(u)})})}readSync(t,i,n,s,o){return this.realFs.readSync(t,i,n,s,o)}async writePromise(t,i,n,s,o){return await new Promise((a,l)=>typeof i=="string"?this.realFs.write(t,i,n,this.makeCallback(a,l)):this.realFs.write(t,i,n,s,o,this.makeCallback(a,l)))}writeSync(t,i,n,s,o){return typeof i=="string"?this.realFs.writeSync(t,i,n):this.realFs.writeSync(t,i,n,s,o)}async closePromise(t){await new Promise((i,n)=>{this.realFs.close(t,this.makeCallback(i,n))})}closeSync(t){this.realFs.closeSync(t)}createReadStream(t,i){let n=t!==null?K.fromPortablePath(t):t;return this.realFs.createReadStream(n,i)}createWriteStream(t,i){let n=t!==null?K.fromPortablePath(t):t;return this.realFs.createWriteStream(n,i)}async realpathPromise(t){return await new Promise((i,n)=>{this.realFs.realpath(K.fromPortablePath(t),{},this.makeCallback(i,n))}).then(i=>K.toPortablePath(i))}realpathSync(t){return K.toPortablePath(this.realFs.realpathSync(K.fromPortablePath(t),{}))}async existsPromise(t){return await new Promise(i=>{this.realFs.exists(K.fromPortablePath(t),i)})}accessSync(t,i){return this.realFs.accessSync(K.fromPortablePath(t),i)}async accessPromise(t,i){return await new Promise((n,s)=>{this.realFs.access(K.fromPortablePath(t),i,this.makeCallback(n,s))})}existsSync(t){return this.realFs.existsSync(K.fromPortablePath(t))}async statPromise(t,i){return await new Promise((n,s)=>{i?this.realFs.stat(K.fromPortablePath(t),i,this.makeCallback(n,s)):this.realFs.stat(K.fromPortablePath(t),this.makeCallback(n,s))})}statSync(t,i){return i?this.realFs.statSync(K.fromPortablePath(t),i):this.realFs.statSync(K.fromPortablePath(t))}async fstatPromise(t,i){return await new Promise((n,s)=>{i?this.realFs.fstat(t,i,this.makeCallback(n,s)):this.realFs.fstat(t,this.makeCallback(n,s))})}fstatSync(t,i){return i?this.realFs.fstatSync(t,i):this.realFs.fstatSync(t)}async lstatPromise(t,i){return await new Promise((n,s)=>{i?this.realFs.lstat(K.fromPortablePath(t),i,this.makeCallback(n,s)):this.realFs.lstat(K.fromPortablePath(t),this.makeCallback(n,s))})}lstatSync(t,i){return i?this.realFs.lstatSync(K.fromPortablePath(t),i):this.realFs.lstatSync(K.fromPortablePath(t))}async fchmodPromise(t,i){return await new Promise((n,s)=>{this.realFs.fchmod(t,i,this.makeCallback(n,s))})}fchmodSync(t,i){return this.realFs.fchmodSync(t,i)}async chmodPromise(t,i){return await new Promise((n,s)=>{this.realFs.chmod(K.fromPortablePath(t),i,this.makeCallback(n,s))})}chmodSync(t,i){return this.realFs.chmodSync(K.fromPortablePath(t),i)}async fchownPromise(t,i,n){return await new Promise((s,o)=>{this.realFs.fchown(t,i,n,this.makeCallback(s,o))})}fchownSync(t,i,n){return this.realFs.fchownSync(t,i,n)}async chownPromise(t,i,n){return await new Promise((s,o)=>{this.realFs.chown(K.fromPortablePath(t),i,n,this.makeCallback(s,o))})}chownSync(t,i,n){return this.realFs.chownSync(K.fromPortablePath(t),i,n)}async renamePromise(t,i){return await new Promise((n,s)=>{this.realFs.rename(K.fromPortablePath(t),K.fromPortablePath(i),this.makeCallback(n,s))})}renameSync(t,i){return this.realFs.renameSync(K.fromPortablePath(t),K.fromPortablePath(i))}async copyFilePromise(t,i,n=0){return await new Promise((s,o)=>{this.realFs.copyFile(K.fromPortablePath(t),K.fromPortablePath(i),n,this.makeCallback(s,o))})}copyFileSync(t,i,n=0){return this.realFs.copyFileSync(K.fromPortablePath(t),K.fromPortablePath(i),n)}async appendFilePromise(t,i,n){return await new Promise((s,o)=>{let a=typeof t=="string"?K.fromPortablePath(t):t;n?this.realFs.appendFile(a,i,n,this.makeCallback(s,o)):this.realFs.appendFile(a,i,this.makeCallback(s,o))})}appendFileSync(t,i,n){let s=typeof t=="string"?K.fromPortablePath(t):t;n?this.realFs.appendFileSync(s,i,n):this.realFs.appendFileSync(s,i)}async writeFilePromise(t,i,n){return await new Promise((s,o)=>{let Line truncated
`;if(typeof r=="number"||typeof r=="boolean")return`${r.toString()}
`;if(typeof r=="string")return`${oH(r)}
`;if(Array.isArray(r)){if(r.length===0)return`[]
`;let i=" ".repeat(e);return`
${r.map(s=>`${i}- ${$S(s,e+1,!1)}`).join("")}`}if(typeof r=="object"&&r){let i,n;r instanceof wI?(i=r.data,n=!1):(i=r,n=!0);let s=" ".repeat(e),o=Object.keys(i);n&&o.sort((l,c)=>{let u=sH.indexOf(l),g=sH.indexOf(c);return u===-1&&g===-1?l<c?-1:l>c?1:0:u!==-1&&g===-1?-1:u===-1&&g!==-1?1:u-g});let a=o.filter(l=>!AH(i[l])).map((l,c)=>{let u=i[l],g=oH(l),f=$S(u,e+1,!0),h=c>0||t?s:"",p=g.length>1024?`? ${g}
${h}:`:`${g}:`,C=f.startsWith(`
`)?f:` ${f}`;return`${h}${p}${C}`}).join(e===0?`
`:"")||`
`;return t?`
${a}`:`${a}`}throw new Error(`Unsupported value type (${r})`)}function wa(r){try{let e=$S(r,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}}wa.PreserveOrdering=wI;function sde(r){return r.endsWith(`
`)||(r+=`
`),(0,aH.parse)(r)}var ode=/^(#.*(\r?\n))*?#\s+yarn\s+lockfile\s+v1\r?\n/i;function ade(r){if(ode.test(r))return sde(r);let e=(0,BI.safeLoad)(r,{schema:BI.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 yi(r){return ade(r)}var fz=Pe(cH()),Lw=Pe(nc());var ld={};ut(ld,{Builtins:()=>hv,Cli:()=>Un,Command:()=>ve,Option:()=>z,UsageError:()=>be,formatMarkdownish:()=>Li});var tv="",wi="\0";var rv=/^(-h|--help)(?:=([0-9]+))?$/,QI=/^(--[a-z]+(?:-[a-z]+)*|-[a-zA-Z]+)$/,hH=/^-[a-zA-Z]{2,}$/,iv=/^([^=]+)=([\s\S]*)$/,nv=process.env.DEBUG_CLI==="1";var be=class extends Error{constructor(e){super(e),this.clipanion={type:"usage"},this.name="UsageError"}},Mg=class extends Error{constructor(e,t){if(super(),this.input=e,this.candidates=t,this.clipanion={type:"none"},this.name="UnknownSyntaxError",this.candidates.length===0)this.message="Command not found, but we're not sure what's the alternative.";else if(this.candidates.every(i=>i.reason!==null&&i.reason===t[0].reason)){let[{reason:i}]=this.candidates;this.message=`${i}
${this.candidates.map(({usage:n})=>`$ ${n}`).join(`
`)}`}else if(this.candidates.length===1){let[{usage:i}]=this.candidates;this.message=`Command not found; did you mean:
$ ${i}
${sv(e)}`}else this.message=`Command not found; did you mean one of:
${this.candidates.map(({usage:i},n)=>`${`${n}.`.padStart(4)} ${i}`).join(`
`)}
${sv(e)}`}},bI=class extends Error{constructor(e,t){super(),this.input=e,this.usages=t,this.clipanion={type:"none"},this.name="AmbiguousSyntaxError",this.message=`Cannot find which to pick amongst the following alternatives:
${this.usages.map((i,n)=>`${`${n}.`.padStart(4)} ${i}`).join(`
`)}
${sv(e)}`}},sv=r=>`While running ${r.filter(e=>e!==wi).map(e=>{let t=JSON.stringify(e);return e.match(/\s/)||e.length===0||t!==`"${e}"`?t:e}).join(" ")}`;var ed=Symbol("clipanion/isOption");function zi(r){return{...r,[ed]:!0}}function Po(r,e){return typeof r>"u"?[r,e]:typeof r=="object"&&r!==null&&!Array.isArray(r)?[void 0,r]:[r,e]}function SI(r,e=!1){let t=r.replace(/^\.: /,"");return e&&(t=t[0].toLowerCase()+t.slice(1)),t}function td(r,e){return e.length===1?new be(`${r}: ${SI(e[0],!0)}`):new be(`${r}:
${e.map(t=>`
- ${SI(t)}`).join("")}`)}function rd(r,e,t){if(typeof t>"u")return e;let i=[],n=[],s=a=>{let l=e;return e=a,s.bind(null,l)};if(!t(e,{errors:i,coercions:n,coercion:s}))throw td(`Invalid value for ${r}`,i);for(let[,a]of n)a();return e}var ve=class{constructor(){this.help=!1}static Usage(e){return e}async catch(e){throw e}async validateAndExecute(){let t=this.constructor.schema;if(Array.isArray(t)){let{isDict:n,isUnknown:s,applyCascade:o}=await Promise.resolve().then(()=>(as(),gn)),a=o(n(s()),t),l=[],c=[];if(!a(this,{errors:l,coercions:c}))throw td("Invalid option schema",l);for(let[,g]of c)g()}else if(t!=null)throw new Error("Invalid command schema");let i=await this.execute();return typeof i<"u"?i:0}};ve.isOption=ed;ve.Default=[];var Av=Array(80).fill("\u2501");for(let r=0;r<=24;++r)Av[Av.length-r]=`\x1B[38;5;${232+r}m\u2501`;var lv={header:r=>`\x1B[1m\u2501\u2501\u2501 ${r}${r.length<80-5?` ${Av.slice(r.length+5).join("")}`:":"}\x1B[0m`,bold:r=>`\x1B[1m${r}\x1B[22m`,error:r=>`\x1B[31m\x1B[1m${r}\x1B[22m\x1B[39m`,code:r=>`\x1B[36m${r}\x1B[39m`},QH={header:r=>r,bold:r=>r,error:r=>r,code:r=>r};function jde(r){let e=r.split(`
`),t=e.filter(n=>n.match(/\S/)),i=t.length>0?t.reduce((n,s)=>Math.min(n,s.length-s.trimStart().length),Number.MAX_VALUE):0;return e.map(n=>n.slice(i).trimRight()).join(`
`)}function Li(r,{format:e,paragraphs:t}){return r=r.replace(/\r\n?/g,`
`),r=jde(r),r=r.replace(/^\n+|\n+$/g,""),r=r.replace(/^(\s*)-([^\n]*?)\n+/gm,`$1-$2
`),r=r.replace(/\n(\n)?\n*/g,"$1"),t&&(r=r.split(/\n/).map(i=>{let n=i.match(/^\s*[*-][\t ]+(.*)/);if(!n)return i.match(/(.{1,80})(?: |$)/g).join(`
`);let s=i.length-i.trimStart().length;return n[1].match(new RegExp(`(.{1,${78-s}})(?: |$)`,"g")).map((o,a)=>" ".repeat(s)+(a===0?"- ":" ")+o).join(`
`)}).join(`
`)),r=r.replace(/(`+)((?:.|[\n])*?)\1/g,(i,n,s)=>e.code(n+s+n)),r=r.replace(/(\*\*)((?:.|[\n])*?)\1/g,(i,n,s)=>e.bold(n+s+n)),r?`${r}
`:""}var fv=Pe(J("tty"),1);function fn(r){nv&&console.log(r)}var bH={candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,path:[],positionals:[],options:[],remainder:null,selectedIndex:-1};function SH(){return{nodes:[Xi(),Xi(),Xi()]}}function qde(r){let e=SH(),t=[],i=e.nodes.length;for(let n of r){t.push(i);for(let s=0;s<n.nodes.length;++s)PH(s)||e.nodes.push(eCe(n.nodes[s],i));i+=n.nodes.length-2}for(let n of t)Kg(e,0,n);return e}function zs(r,e){return r.nodes.push(e),r.nodes.length-1}function Jde(r){let e=new Set,t=i=>{if(e.has(i))return;e.add(i);let n=r.nodes[i];for(let o of Object.values(n.statics))for(let{to:a}of o)t(a);for(let[,{to:o}]of n.dynamics)t(o);for(let{to:o}of n.shortcuts)t(o);let s=new Set(n.shortcuts.map(({to:o})=>o));for(;n.shortcuts.length>0;){let{to:o}=n.shortcuts.shift(),a=r.nodes[o];for(let[l,c]of Object.entries(a.statics)){let u=Object.prototype.hasOwnProperty.call(n.statics,l)?n.statics[l]:n.statics[l]=[];for(let g of c)u.some(({to:f})=>g.to===f)||u.push(g)}for(let[l,c]of a.dynamics)n.dynamics.some(([u,{to:g}])=>l===u&&c.to===g)||n.dynamics.push([l,c]);for(let l of a.shortcuts)s.has(l.to)||(n.shortcuts.push(l),s.add(l.to))}};t(0)}function Wde(r,{prefix:e=""}={}){if(nv){fn(`${e}Nodes are:`);for(let t=0;t<r.nodes.length;++t)fn(`${e} ${t}: ${JSON.stringify(r.nodes[t])}`)}}function vH(r,e,t=!1){fn(`Running a vm on ${JSON.stringify(e)}`);let i=[{node:0,state:{candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,options:[],path:[],positionals:[],remainder:null,selectedIndex:null}}];Wde(r,{prefix:" "});let n=[tv,...e];for(let s=0;s<n.length;++s){let o=n[s];fn(` Processing ${JSON.stringify(o)}`);let a=[];for(let{node:l,state:c}of i){fn(` Current node is ${l}`);let u=r.nodes[l];if(l===2){a.push({node:l,state:c});continue}console.assert(u.shortcuts.length===0,"Shortcuts should have been eliminated by now");let g=Object.prototype.hasOwnProperty.call(u.statics,o);if(!t||s<n.length-1||g)if(g){let f=u.statics[o];for(let{to:h,reducer:p}of f)a.push({node:h,state:typeof p<"u"?xI(uv,p,c,o):c}),fn(` Static transition to ${h} found`)}else fn(" No static transition found");else{let f=!1;for(let h of Object.keys(u.statics))if(!!h.startsWith(o)){if(o===h)for(let{to:p,reducer:C}of u.statics[h])a.push({node:p,state:typeof C<"u"?xI(uv,C,c,o):c}),fn(` Static transition to ${p} found`);else for(let{to:p}of u.statics[h])a.push({node:p,state:{...c,remainder:h.slice(o.length)}}),fn(` Static transition to ${p} found (partial match)`);f=!0}f||fn(" No partial static transition found")}if(o!==wi)for(let[f,{to:h,reducer:p}]of u.dynamics)xI(DI,f,c,o)&&(a.push({node:h,state:typeof p<"u"?xI(uv,p,c,o):c}),fn(` Dynamic transition to ${h} found (via ${f})`))}if(a.length===0&&o===wi&&e.length===1)return[{node:0,state:bH}];if(a.length===0)throw new Mg(e,i.filter(({node:l})=>l!==2).map(({state:l})=>({usage:l.candidateUsage,reason:null})));if(a.every(({node:l})=>l===2))throw new Mg(e,a.map(({state:l})=>({usage:l.candidateUsage,reason:l.errorMessage})));i=Zde(a)}if(i.length>0){fn(" Results:");for(let s of i)fn(` - ${s.node} -> ${JSON.stringify(s.state)}`)}else fn(" No results");return i}function zde(r,e){if(e.selectedIndex!==null)return!0;if(Object.prototype.hasOwnProperty.call(r.statics,wi)){for(let{to:t}of r.statics[wi])if(t===1)return!0}return!1}function Vde(r,e,t){let i=t&&e.length>0?[""]:[],n=vH(r,e,t),s=[],o=new Set,a=(l,c,u=!0)=>{let g=[c];for(;g.length>0;){let h=g;g=[];for(let p of h){let C=r.nodes[p],y=Object.keys(C.statics);for(let B of Object.keys(C.statics)){let v=y[0];for(let{to:D,reducer:L}of C.statics[v])L==="pushPath"&&(u||l.push(v),g.push(D))}}u=!1}let f=JSON.stringify(l);o.has(f)||(s.push(l),o.add(f))};for(let{node:l,state:c}of n){if(c.remainder!==null){a([c.remainder],l);continue}let u=r.nodes[l],g=zde(u,c);for(let[f,h]of Object.entries(u.statics))(g&&f!==wi||!f.startsWith("-")&&h.some(({reducer:p})=>p==="pushPath"))&&a([...i,f],l);if(!!g)for(let[f,{to:h}]of u.dynamics){if(h===2)continue;let p=tCe(f,c);if(p!==null)for(let C of p)a([...i,C],l)}}return[...s].sort()}function Xde(r,e){let t=vH(r,[...e,wi]);return _de(e,t.map(({state:i})=>i))}function Zde(r){let e=0;for(let{state:t}of r)t.path.length>e&&(e=t.path.length);return r.filter(({state:t})=>t.path.length===e)}function _de(r,e){let t=e.filter(g=>g.selectedIndex!==null);if(t.length===0)throw new Error;let i=t.filter(g=>g.requiredOptions.every(f=>f.some(h=>g.options.find(p=>p.name===h))));if(i.length===0)throw new Mg(r,t.map(g=>({usage:g.candidateUsage,reason:null})));let n=0;for(let g of i)g.path.length>n&&(n=g.path.length);let s=i.filter(g=>g.path.length===n),o=g=>g.positionals.filter(({extra:f})=>!f).length+g.options.length,a=s.map(g=>({state:g,positionalCount:o(g)})),l=0;for(let{positionalCount:g}of a)g>l&&(l=g);let c=a.filter(({positionalCount:g})=>g===l).map(({state:g})=>g),u=$de(c);if(u.length>1)throw new bI(r,u.map(g=>g.candidateUsage));return u[0]}function $de(r){let Line truncated
`),this.context.stdout.write(`
`);let t=0;for(let i of this.commands)this.context.stdout.write(this.cli.usage(this.contexts[i].commandClass,{prefix:`${t++}. `.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.
`)}}};var DH=Symbol("clipanion/errorCommand");function rCe(){return process.env.FORCE_COLOR==="0"?1:process.env.FORCE_COLOR==="1"||typeof process.stdout<"u"&&process.stdout.isTTY?8:1}var Un=class{constructor({binaryLabel:e,binaryName:t="...",binaryVersion:i,enableCapture:n=!1,enableColors:s}={}){this.registrations=new Map,this.builder=new Hg({binaryName:t}),this.binaryLabel=e,this.binaryName=t,this.binaryVersion=i,this.enableCapture=n,this.enableColors=s}static from(e,t={}){let i=new Un(t);for(let n of e)i.register(n);return i}register(e){var t;let i=new Map,n=new e;for(let l in n){let c=n[l];typeof c=="object"&&c!==null&&c[ve.isOption]&&i.set(l,c)}let s=this.builder.command(),o=s.cliIndex,a=(t=e.paths)!==null&&t!==void 0?t:n.paths;if(typeof a<"u")for(let l of a)s.addPath(l);this.registrations.set(e,{specs:i,builder:s,index:o});for(let[l,{definition:c}]of i.entries())c(s,l);s.setContext({commandClass:e})}process(e){let{contexts:t,process:i}=this.builder.compile(),n=i(e);switch(n.selectedIndex){case-1:return Gg.from(n,t);default:{let{commandClass:s}=t[n.selectedIndex],o=this.registrations.get(s);if(typeof o>"u")throw new Error("Assertion failed: Expected the command class to have been registered.");let a=new s;a.path=n.path;try{for(let[l,{transformer:c}]of o.specs.entries())a[l]=c(o.builder,l,n);return a}catch(l){throw l[DH]=a,l}}break}}async run(e,t){var i;let n,s={...Un.defaultContext,...t},o=(i=this.enableColors)!==null&&i!==void 0?i:s.colorDepth>1;if(!Array.isArray(e))n=e;else try{n=this.process(e)}catch(c){return s.stdout.write(this.error(c,{colored:o})),1}if(n.help)return s.stdout.write(this.usage(n,{colored:o,detailed:!0})),0;n.context=s,n.cli={binaryLabel:this.binaryLabel,binaryName:this.binaryName,binaryVersion:this.binaryVersion,enableCapture:this.enableCapture,enableColors:this.enableColors,definitions:()=>this.definitions(),error:(c,u)=>this.error(c,u),format:c=>this.format(c),process:c=>this.process(c),run:(c,u)=>this.run(c,{...s,...u}),usage:(c,u)=>this.usage(c,u)};let a=this.enableCapture?iCe(s):RH,l;try{l=await a(()=>n.validateAndExecute().catch(c=>n.catch(c).then(()=>0)))}catch(c){return s.stdout.write(this.error(c,{colored:o,command:n})),1}return l}async runExit(e,t){process.exitCode=await this.run(e,t)}suggest(e,t){let{suggest:i}=this.builder.compile();return i(e,t)}definitions({colored:e=!1}={}){let t=[];for(let[i,{index:n}]of this.registrations){if(typeof i.usage>"u")continue;let{usage:s}=this.getUsageByIndex(n,{detailed:!1}),{usage:o,options:a}=this.getUsageByIndex(n,{detailed:!0,inlineOptions:!1}),l=typeof i.usage.category<"u"?Li(i.usage.category,{format:this.format(e),paragraphs:!1}):void 0,c=typeof i.usage.description<"u"?Li(i.usage.description,{format:this.format(e),paragraphs:!1}):void 0,u=typeof i.usage.details<"u"?Li(i.usage.details,{format:this.format(e),paragraphs:!0}):void 0,g=typeof i.usage.examples<"u"?i.usage.examples.map(([f,h])=>[Li(f,{format:this.format(e),paragraphs:!1}),h.replace(/\$0/g,this.binaryName)]):void 0;t.push({path:s,usage:o,category:l,description:c,details:u,examples:g,options:a})}return t}usage(e=null,{colored:t,detailed:i=!1,prefix:n="$ "}={}){var s;if(e===null){for(let l of this.registrations.keys()){let c=l.paths,u=typeof l.usage<"u";if(!c||c.length===0||c.length===1&&c[0].length===0||((s=c==null?void 0:c.some(h=>h.length===0))!==null&&s!==void 0?s:!1))if(e){e=null;break}else e=l;else if(u){e=null;continue}}e&&(i=!0)}let o=e!==null&&e instanceof ve?e.constructor:e,a="";if(o)if(i){let{description:l="",details:c="",examples:u=[]}=o.usage||{};l!==""&&(a+=Li(l,{format:this.format(t),paragraphs:!1}).replace(/^./,h=>h.toUpperCase()),a+=`
`),(c!==""||u.length>0)&&(a+=`${this.format(t).header("Usage")}
`,a+=`
`);let{usage:g,options:f}=this.getUsageByRegistration(o,{inlineOptions:!1});if(a+=`${this.format(t).bold(n)}${g}
`,f.length>0){a+=`
`,a+=`${lv.header("Options")}
`;let h=f.reduce((p,C)=>Math.max(p,C.definition.length),0);a+=`
`;for(let{definition:p,description:C}of f)a+=` ${this.format(t).bold(p.padEnd(h))} ${Li(C,{format:this.format(t),paragraphs:!1})}`}if(c!==""&&(a+=`
`,a+=`${this.format(t).header("Details")}
`,a+=`
`,a+=Li(c,{format:this.format(t),paragraphs:!0})),u.length>0){a+=`
`,a+=`${this.format(t).header("Examples")}
`;for(let[h,p]of u)a+=`
`,a+=Li(h,{format:this.format(t),paragraphs:!1}),a+=`${p.replace(/^/m,` ${this.format(t).bold(n)}`).replace(/\$0/g,this.binaryName)}
`}}else{let{usage:l}=this.getUsageByRegistration(o);a+=`${this.format(t).bold(n)}${l}
`}else{let l=new Map;for(let[f,{index:h}]of this.registrations.entries()){if(typeof f.usage>"u")continue;let p=typeof f.usage.category<"u"?Li(f.usage.category,{format:this.format(t),paragraphs:!1}):null,C=l.get(p);typeof C>"u"&&l.set(p,C=[]);let{usage:y}=this.getUsageByIndex(h);C.push({commandClass:f,usage:y})}let c=Array.from(l.keys()).sort((f,h)=>f===null?-1:h===null?1:f.localeCompare(h,"en",{usage:"sort",caseFirst:"upper"})),u=typeof this.binaryLabel<"u",g=typeof this.binaryVersion<"u";u||g?(u&&g?a+=`${this.format(t).header(`${this.binaryLabel} - ${this.binaryVersion}`)}
`:u?a+=`${this.format(t).header(`${this.binaryLabel}`)}
`:a+=`${this.format(t).header(`${this.binaryVersion}`)}
`,a+=` ${this.format(t).bold(n)}${this.binaryName} <command>
`):a+=`${this.format(t).bold(n)}${this.binaryName} <command>
`;for(let f of c){let h=l.get(f).slice().sort((C,y)=>C.usage.localeCompare(y.usage,"en",{usage:"sort",caseFirst:"upper"})),p=f!==null?f.trim():"General commands";a+=`
`,a+=`${this.format(t).header(`${p}`)}
`;for(let{commandClass:C,usage:y}of h){let B=C.usage.description||"undocumented";a+=`
`,a+=` ${this.format(t).bold(y)}
`,a+=` ${Li(B,{format:this.format(t),paragraphs:!1})}`}}a+=`
`,a+=Li("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(t),paragraphs:!0})}return a}error(e,t){var i,{colored:n,command:s=(i=e[DH])!==null&&i!==void 0?i:null}=t===void 0?{}:t;e instanceof Error||(e=new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(e)})`));let o="",a=e.name.replace(/([a-z])([A-Z])/g,"$1 $2");a==="Error"&&(a="Internal Error"),o+=`${this.format(n).error(a)}: ${e.message}
`;let l=e.clipanion;return typeof l<"u"?l.type==="usage"&&(o+=`
`,o+=this.usage(s)):e.stack&&(o+=`${e.stack.replace(/^.*\n/,"")}
`),o}format(e){var t;return((t=e!=null?e:this.enableColors)!==null&&t!==void 0?t:Un.defaultContext.colorDepth>1)?lv:QH}getUsageByRegistration(e,t){let i=this.registrations.get(e);if(typeof i>"u")throw new Error("Assertion failed: Unregistered command");return this.getUsageByIndex(i.index,t)}getUsageByIndex(e,t){return this.builder.getBuilderByIndex(e).usage(t)}};Un.defaultContext={stdin:process.stdin,stdout:process.stdout,stderr:process.stderr,colorDepth:"getColorDepth"in fv.default.WriteStream.prototype?fv.default.WriteStream.prototype.getColorDepth():rCe()};var kH;function iCe(r){let e=kH;if(typeof e>"u"){if(r.stdout===process.stdout&&r.stderr===process.stderr)return RH;let{AsyncLocalStorage:t}=J("async_hooks");e=kH=new t;let i=process.stdout._write;process.stdout._write=function(s,o,a){let l=e.getStore();return typeof l>"u"?i.call(this,s,o,a):l.stdout.write(s,o,a)};let n=process.stderr._write;process.stderr._write=function(s,o,a){let l=e.getStore();return typeof l>"u"?n.call(this,s,o,a):l.stderr.write(s,o,a)}}return t=>e.run(r,t)}function RH(r){return r()}var hv={};ut(hv,{DefinitionsCommand:()=>od,HelpCommand:()=>ad,VersionCommand:()=>Ad});var od=class extends ve{async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.definitions(),null,2)}
`)}};od.paths=[["--clipanion=definitions"]];var ad=class extends ve{async execute(){this.context.stdout.write(this.cli.usage())}};ad.paths=[["-h"],["--help"]];var Ad=class extends ve{async execute(){var e;this.context.stdout.write(`${(e=this.cli.binaryVersion)!==null&&e!==void 0?e:"<unknown>"}
`)}};Ad.paths=[["-v"],["--version"]];var z={};ut(z,{Array:()=>FH,Boolean:()=>NH,Counter:()=>LH,Proxy:()=>TH,Rest:()=>OH,String:()=>MH,applyValidator:()=>rd,cleanValidationError:()=>SI,formatError:()=>td,isOptionSymbol:()=>ed,makeCommandOption:()=>zi,rerouteArguments:()=>Po});function FH(r,e,t){let[i,n]=Po(e,t!=null?t:{}),{arity:s=1}=n,o=r.split(","),a=new Set(o);return zi({definition(l){l.addOption({names:o,arity:s,hidden:n==null?void 0:n.hidden,description:n==null?void 0:n.description,required:n.required})},transformer(l,c,u){let g=typeof i<"u"?[...i]:void 0;for(let{name:f,value:h}of u.options)!a.has(f)||(g=g!=null?g:[],g.push(h));return g}})}function NH(r,e,t){let[i,n]=Po(e,t!=null?t:{}),s=r.split(","),o=new Set(s);return zi({definition(a){a.addOption({names:s,allowBinding:!1,arity:0,hidden:n.hidden,description:n.description,required:n.required})},transformer(a,l,c){let u=i;for(let{name:g,value:f}of c.options)!o.has(g)||(u=f);return u}})}function LH(r,e,t){let[i,n]=Po(e,t!=null?t:{}),s=r.split(","),o=new Set(s);return zi({definition(a){a.addOption({names:s,allowBinding:!1,arity:0,hidden:n.hidden,description:n.description,required:n.required})},transformer(a,l,c){let u=i;for(let{name:g,value:f}of c.options)!o.has(g)||(u!=null||(u=0),f?u+=1:u=0);return u}})}function TH(r={}){return zi({definition(e,t){var i;e.addProxy({name:(i=r.name)!==null&&i!==void 0?i:t,required:r.required})},transformer(e,t,i){return i.positionals.map(({value:n})=>n)}})}function OH(r={}){return zi({definition(e,t){var i;e.addRest({name:(i=r.name)!==null&&i!==void 0?i:t,required:r.required})},transformer(e,t,i){let n=o=>{let a=i.positionals[o];return a.extra===Kn||a.extra===!1&&o<e.arity.leading.length},s=0;for(;s<i.positionals.length&&n(s);)s+=1;return i.positionals.splice(0,s).map(({value:o})=>o)}})}function nCe(r,e,t){let[i,n]=Po(e,t!=null?t:{}),{arity:s=1}=n,o=r.split(","),a=new Set(o);return zi({definition(l){l.addOption({names:o,arity:n.tolerateBoolean?0:s,hidden:n.hidden,description:n.description,required:n.required})},transformer(l,c,u){let g,f=i;for(let{name:h,value:p}of u.options)!a.has(h)||(g=h,f=p);return typeof f=="string"?rd(g!=null?g:c,f,n.validator):f}})}function sCe(r={}){let{required:e=!0}=r;return zi({definition(t,i){var n;t.addPositional({name:(n=r.name)!==null&&n!==void 0?n:i,required:r.required})},transformer(t,i,n){var s;for(let o=0;o<n.positionals.length;++o){if(n.positionals[o].extra===Kn||e&&n.positionals[o].extra===!0||!e&&n.positionals[o].extra===!1)continue;let[a]=n.positionals.splice(o,1);return rd((s=r.name)!==null&&s!==void 0?s:i,a.value,r.validator)}}})}function MH(r,...e){return typeof r=="string"?nCe(r,...e):sCe(r)}var hz=Pe(Yg()),nk=J("stream");var Ct=(se=>(se[se.UNNAMED=0]="UNNAMED",se[se.EXCEPTION=1]="EXCEPTION",se[se.MISSING_PEER_DEPENDENCY=2]="MISSING_PEER_DEPENDENCY",se[se.CYCLIC_DEPENDENCIES=3]="CYCLIC_DEPENDENCIES",se[se.DISABLED_BUILD_SCRIPTS=4]="DISABLED_BUILD_SCRIPTS",se[se.BUILD_DISABLED=5]="BUILD_DISABLED",se[se.SOFT_LINK_BUILD=6]="SOFT_LINK_BUILD",se[se.MUST_BUILD=7]="MUST_BUILD",se[se.MUST_REBUILD=8]="MUST_REBUILD",se[se.BUILD_FAILED=9]="BUILD_FAILED",se[se.RESOLVER_NOT_FOUND=10]="RESOLVER_NOT_FOUND",se[se.FETCHER_NOT_FOUND=11]="FETCHER_NOT_FOUND",se[se.LINKER_NOT_FOUND=12]="LINKER_NOT_FOUND",se[se.FETCH_NOT_CACHED=13]="FETCH_NOT_CACHED",se[se.YARN_IMPORT_FAILED=14]="YARN_IMPORT_FAILED",se[se.REMOTE_INVALID=15]="REMOTE_INVALID",se[se.REMOTE_NOT_FOUND=16]="REMOTE_NOT_FOUND",se[se.RESOLUTION_PACK=17]="RESOLUTION_PACK",se[se.CACHE_CHECKSUM_MISMATCH=18]="CACHE_CHECKSUM_MISMATCH",se[se.UNUSED_CACHE_ENTRY=19]="UNUSED_CACHE_ENTRY",se[se.MISSING_LOCKFILE_ENTRY=20]="MISSING_LOCKFILE_ENTRY",se[se.WORKSPACE_NOT_FOUND=21]="WORKSPACE_NOT_FOUND",se[se.TOO_MANY_MATCHING_WORKSPACES=22]="TOO_MANY_MATCHING_WORKSPACES",se[se.CONSTRAINTS_MISSING_DEPENDENCY=23]="CONSTRAINTS_MISSING_DEPENDENCY",se[se.CONSTRAINTS_INCOMPATIBLE_DEPENDENCY=24]="CONSTRAINTS_INCOMPATIBLE_DEPENDENCY",se[se.CONSTRAINTS_EXTRANEOUS_DEPENDENCY=25]="CONSTRAINTS_EXTRANEOUS_DEPENDENCY",se[se.CONSTRAINTS_INVALID_DEPENDENCY=26]="CONSTRAINTS_INVALID_DEPENDENCY",se[se.CANT_SUGGEST_RESOLUTIONS=27]="CANT_SUGGEST_RESOLUTIONS",se[se.FROZEN_LOCKFILE_EXCEPTION=28]="FROZEN_LOCKFILE_EXCEPTION",se[se.CROSS_DRIVE_VIRTUAL_LOCAL=29]="CROSS_DRIVE_VIRTUAL_LOCAL",se[se.FETCH_FAILED=30]="FETCH_FAILED",se[se.DANGEROUS_NODE_MODULES=31]="DANGEROUS_NODE_MODULES",se[se.NODE_GYP_INJECTED=32]="NODE_GYP_INJECTED",se[se.AUTHENTICATION_NOT_FOUND=33]="AUTHENTICATION_NOT_FOUND",se[se.INVALID_CONFIGURATION_KEY=34]="INVALID_CONFIGURATION_KEY",se[se.NETWORK_ERROR=35]="NETWORK_ERROR",se[se.LIFECYCLE_SCRIPT=36]="LIFECYCLE_SCRIPT",se[se.CONSTRAINTS_MISSING_FIELD=37]="CONSTRAINTS_MISSING_FIELD",se[se.CONSTRAINTS_INCOMPATIBLE_FIELD=38]="CONSTRAINTS_INCOMPATIBLE_FIELD",se[se.CONSTRAINTS_EXTRANEOUS_FIELD=39]="CONSTRAINTS_EXTRANEOUS_FIELD",se[se.CONSTRAINTS_INVALID_FIELD=40]="CONSTRAINTS_INVALID_FIELD",se[se.AUTHENTICATION_INVALID=41]="AUTHENTICATION_INVALID",se[se.PROLOG_UNKNOWN_ Line truncated
`),a!==-1){let l=n+o.substring(0,a);o=o.substring(a+1),n="",e!==null?this.reportInfo(null,`${e} ${l}`):this.reportInfo(null,l)}while(a!==-1);n+=o}),t.on("end",()=>{let s=i.end();s!==""&&(e!==null?this.reportInfo(null,`${e} ${s}`):this.reportInfo(null,s))}),t}};var vf=class{constructor(e){this.fetchers=e}supports(e,t){return!!this.tryFetcher(e,t)}getLocalPath(e,t){return this.getFetcher(e,t).getLocalPath(e,t)}async fetch(e,t){return await this.getFetcher(e,t).fetch(e,t)}tryFetcher(e,t){let i=this.fetchers.find(n=>n.supports(e,t));return i||null}getFetcher(e,t){let i=this.fetchers.find(n=>n.supports(e,t));if(!i)throw new at(11,`${mt(t.project.configuration,e)} isn't supported by any available fetcher`);return i}};var xf=class{constructor(e){this.resolvers=e.filter(t=>t)}supportsDescriptor(e,t){return!!this.tryResolverByDescriptor(e,t)}supportsLocator(e,t){return!!this.tryResolverByLocator(e,t)}shouldPersistResolution(e,t){return this.getResolverByLocator(e,t).shouldPersistResolution(e,t)}bindDescriptor(e,t,i){return this.getResolverByDescriptor(e,i).bindDescriptor(e,t,i)}getResolutionDependencies(e,t){return this.getResolverByDescriptor(e,t).getResolutionDependencies(e,t)}async getCandidates(e,t,i){return await this.getResolverByDescriptor(e,i).getCandidates(e,t,i)}async getSatisfying(e,t,i){return this.getResolverByDescriptor(e,i).getSatisfying(e,t,i)}async resolve(e,t){return await this.getResolverByLocator(e,t).resolve(e,t)}tryResolverByDescriptor(e,t){let i=this.resolvers.find(n=>n.supportsDescriptor(e,t));return i||null}getResolverByDescriptor(e,t){let i=this.resolvers.find(n=>n.supportsDescriptor(e,t));if(!i)throw new Error(`${tr(t.project.configuration,e)} isn't supported by any available resolver`);return i}tryResolverByLocator(e,t){let i=this.resolvers.find(n=>n.supportsLocator(e,t));return i||null}getResolverByLocator(e,t){let i=this.resolvers.find(n=>n.supportsLocator(e,t));if(!i)throw new Error(`${mt(t.project.configuration,e)} isn't supported by any available resolver`);return i}};var cz=Pe(Xr());var Pf=/^(?!v)[a-z0-9._-]+$/i,Dw=class{supportsDescriptor(e,t){return!!(io(e.range)||Pf.test(e.range))}supportsLocator(e,t){return!!(cz.default.valid(e.reference)||Pf.test(e.reference))}shouldPersistResolution(e,t){return t.resolver.shouldPersistResolution(this.forwardLocator(e,t),t)}bindDescriptor(e,t,i){return i.resolver.bindDescriptor(this.forwardDescriptor(e,i),t,i)}getResolutionDependencies(e,t){return t.resolver.getResolutionDependencies(this.forwardDescriptor(e,t),t)}async getCandidates(e,t,i){return await i.resolver.getCandidates(this.forwardDescriptor(e,i),t,i)}async getSatisfying(e,t,i){return await i.resolver.getSatisfying(this.forwardDescriptor(e,i),t,i)}async resolve(e,t){let i=await t.resolver.resolve(this.forwardLocator(e,t),t);return $d(i,e)}forwardDescriptor(e,t){return _t(e,`${t.project.configuration.get("defaultProtocol")}${e.range}`)}forwardLocator(e,t){return tn(e,`${t.project.configuration.get("defaultProtocol")}${e.reference}`)}};var Df=class{supports(e){return!!e.reference.startsWith("virtual:")}getLocalPath(e,t){let i=e.reference.indexOf("#");if(i===-1)throw new Error("Invalid virtual package reference");let n=e.reference.slice(i+1),s=tn(e,n);return t.fetcher.getLocalPath(s,t)}async fetch(e,t){let i=e.reference.indexOf("#");if(i===-1)throw new Error("Invalid virtual package reference");let n=e.reference.slice(i+1),s=tn(e,n),o=await t.fetcher.fetch(s,t);return await this.ensureVirtualLink(e,o,t)}getLocatorFilename(e){return bf(e)}async ensureVirtualLink(e,t,i){let n=t.packageFs.getRealPath(),s=i.project.configuration.get("virtualFolder"),o=this.getLocatorFilename(e),a=Br.makeVirtualPath(s,o,n),l=new bo(a,{baseFs:t.packageFs,pathUtils:x});return{...t,packageFs:l}}};var kf=class{static isVirtualDescriptor(e){return!!e.range.startsWith(kf.protocol)}static isVirtualLocator(e){return!!e.reference.startsWith(kf.protocol)}supportsDescriptor(e,t){return kf.isVirtualDescriptor(e)}supportsLocator(e,t){return kf.isVirtualLocator(e)}shouldPersistResolution(e,t){return!1}bindDescriptor(e,t,i){throw new Error('Assertion failed: calling "bindDescriptor" on a virtual descriptor is unsupported')}getResolutionDependencies(e,t){throw new Error('Assertion failed: calling "getResolutionDependencies" on a virtual descriptor is unsupported')}async getCandidates(e,t,i){throw new Error('Assertion failed: calling "getCandidates" on a virtual descriptor is unsupported')}async getSatisfying(e,t,i){throw new Error('Assertion failed: calling "getSatisfying" on a virtual descriptor is unsupported')}async resolve(e,t){throw new Error('Assertion failed: calling "resolve" on a virtual locator is unsupported')}},uC=kf;uC.protocol="virtual:";var Rf=class{supports(e){return!!e.reference.startsWith(jr.protocol)}getLocalPath(e,t){return this.getWorkspace(e,t).cwd}async fetch(e,t){let i=this.getWorkspace(e,t).cwd;return{packageFs:new qt(i),prefixPath:Oe.dot,localPath:i}}getWorkspace(e,t){return t.project.getWorkspaceByLine truncated
`);return{stdout:s,stderr:o}}makeResolver(){let e=[];for(let t of this.plugins.values())for(let i of t.resolvers||[])e.push(new i);return new xf([new uC,new jr,new Dw,...e])}makeFetcher(){let e=[];for(let t of this.plugins.values())for(let i of t.fetchers||[])e.push(new i);return new vf([new Df,new Rf,...e])}getLinkers(){let e=[];for(let t of this.plugins.values())for(let i of t.linkers||[])e.push(new i);return e}getSupportedArchitectures(){let e=fC(),t=this.get("supportedArchitectures"),i=t.get("os");i!==null&&(i=i.map(o=>o==="current"?e.os:o));let n=t.get("cpu");n!==null&&(n=n.map(o=>o==="current"?e.cpu:o));let s=t.get("libc");return s!==null&&(s=Uo(s,o=>{var a;return o==="current"?(a=e.libc)!=null?a:Uo.skip:o})),{os:i,cpu:n,libc:s}}async refreshPackageExtensions(){this.packageExtensions=new Map;let e=this.packageExtensions,t=(i,n,{userProvided:s=!1}={})=>{if(!io(i.range))throw new Error("Only semver ranges are allowed as keys for the packageExtensions setting");let o=new ot;o.load(n,{yamlCompatibilityMode:!0});let a=uf(e,i.identHash),l=[];a.push([i.range,l]);let c={status:"inactive",userProvided:s,parentDescriptor:i};for(let u of o.dependencies.values())l.push({...c,type:"Dependency",descriptor:u});for(let u of o.peerDependencies.values())l.push({...c,type:"PeerDependency",descriptor:u});for(let[u,g]of o.peerDependenciesMeta)for(let[f,h]of Object.entries(g))l.push({...c,type:"PeerDependencyMeta",selector:u,key:f,value:h})};await this.triggerHook(i=>i.registerPackageExtensions,this,t);for(let[i,n]of this.get("packageExtensions"))t(JA(i,!0),Gy(n),{userProvided:!0})}normalizePackage(e){let t=eC(e);if(this.packageExtensions==null)throw new Error("refreshPackageExtensions has to be called before normalizing packages");let i=this.packageExtensions.get(e.identHash);if(typeof i<"u"){let s=e.version;if(s!==null){for(let[o,a]of i)if(!!vc(s,o))for(let l of a)switch(l.status==="inactive"&&(l.status="redundant"),l.type){case"Dependency":typeof t.dependencies.get(l.descriptor.identHash)>"u"&&(l.status="active",t.dependencies.set(l.descriptor.identHash,l.descriptor));break;case"PeerDependency":typeof t.peerDependencies.get(l.descriptor.identHash)>"u"&&(l.status="active",t.peerDependencies.set(l.descriptor.identHash,l.descriptor));break;case"PeerDependencyMeta":{let c=t.peerDependenciesMeta.get(l.selector);(typeof c>"u"||!Object.prototype.hasOwnProperty.call(c,l.key)||c[l.key]!==l.value)&&(l.status="active",Fa(t.peerDependenciesMeta,l.selector,()=>({}))[l.key]=l.value)}break;default:qx(l);break}}}let n=s=>s.scope?`${s.scope}__${s.name}`:`${s.name}`;for(let s of t.peerDependenciesMeta.keys()){let o=$i(s);t.peerDependencies.has(o.identHash)||t.peerDependencies.set(o.identHash,_t(o,"*"))}for(let s of t.peerDependencies.values()){if(s.scope==="types")continue;let o=n(s),a=qo("types",o),l=Ot(a);t.peerDependencies.has(a.identHash)||t.peerDependenciesMeta.has(l)||(t.peerDependencies.set(a.identHash,_t(a,"*")),t.peerDependenciesMeta.set(l,{optional:!0}))}return t.dependencies=new Map(wn(t.dependencies,([,s])=>Qn(s))),t.peerDependencies=new Map(wn(t.peerDependencies,([,s])=>Qn(s))),t}getLimit(e){return Fa(this.limits,e,()=>(0,hz.default)(this.get(e)))}async triggerHook(e,...t){for(let i of this.plugins.values()){let n=i.hooks;if(!n)continue;let s=e(n);!s||await s(...t)}}async triggerMultipleHooks(e,t){for(let i of t)await this.triggerHook(e,...i)}async reduceHook(e,t,...i){let n=t;for(let s of this.plugins.values()){let o=s.hooks;if(!o)continue;let a=e(o);!a||(n=await a(n,...i))}return n}async firstHook(e,...t){for(let i of this.plugins.values()){let n=i.hooks;if(!n)continue;let s=e(n);if(!s)continue;let o=await s(...t);if(typeof o<"u")return o}return null}},ye=Ka;ye.telemetry=null;var hk=(i=>(i[i.Never=0]="Never",i[i.ErrorCode=1]="ErrorCode",i[i.Always=2]="Always",i))(hk||{}),hC=class extends at{constructor({fileName:t,code:i,signal:n}){let s=ye.create(x.cwd()),o=$e(s,t,Ue.PATH);super(1,`Child ${o} reported an error`,a=>{Kve(i,n,{configuration:s,report:a})});this.code=pk(i,n)}},Kw=class extends hC{constructor({fileName:t,code:i,signal:n,stdout:s,stderr:o}){super({fileName:t,code:i,signal:n});this.stdout=s,this.stderr=o}};function Dc(r){return r!==null&&typeof r.fd=="number"}var kc=new Set;function uk(){}function gk(){for(let r of kc)r.kill()}async function Wo(r,e,{cwd:t,env:i=process.env,strict:n=!1,stdin:s=null,stdout:o,stderr:a,end:l=2}){let c=["pipe","pipe","pipe"];s===null?c[0]="ignore":Dc(s)&&(c[0]=s),Dc(o)&&(c[1]=o),Dc(a)&&(c[2]=a);let u=(0,fk.default)(r,e,{cwd:K.fromPortablePath(t),env:{...i,PWD:K.fromPortablePath(t)},stdio:c});kc.add(u),kc.size===1&&(process.on("SIGINT",uk),process.on("SIGTERM",gk)),!Dc(s)&&s!==null&&s.pipe(u.stdin),Dc(o)||u.stdout.pipe(o,{end:!1}),Dc(a)||u.stderr.pipe(a,{end:!1});let g=()=>{for(let f of new Set([o,a]))Dc(f)||f.end()};return new Promise((f,h)=>{u.on("error",p=>{kc.delete(u),kc.size===0&&(process.off("SIGINT",uk),process.off("SIGTERM",gk)),(l===2||l===1)&&g(),h(p)}),u.on("close",(p,C)=> Line truncated
`),c(127);break;case"EACCES":n[2].write(`permission denied: ${r}
`),c(128);break;default:n[2].write(`uncaught error: ${u.message}
`),c(1);break}}),l.on("close",u=>{Nc.delete(l),Nc.size===0&&(process.off("SIGINT",TR),process.off("SIGTERM",OR)),c(u!==null?u:129)})})}}}function cV(r){return e=>{let t=e[0]==="pipe"?new Vo.PassThrough:e[0];return{stdin:t,promise:Promise.resolve().then(()=>r({stdin:t,stdout:e[1],stderr:e[2]}))}}}var Qs=class{constructor(e){this.stream=e}close(){}get(){return this.stream}},MR=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}},qf=class{constructor(e,t){this.stdin=null;this.stdout=null;this.stderr=null;this.pipe=null;this.ancestor=e,this.implementation=t}static start(e,{stdin:t,stdout:i,stderr:n}){let s=new qf(null,e);return s.stdin=t,s.stdout=i,s.stderr=n,s}pipeTo(e,t=1){let i=new qf(this,e),n=new MR;return i.pipe=n,i.stdout=this.stdout,i.stderr=this.stderr,(t&1)===1?this.stdout=n:this.ancestor!==null&&(this.stderr=this.ancestor.stdout),(t&2)===2?this.stderr=n:this.ancestor!==null&&(this.stderr=this.ancestor.stderr),i}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 t;if(this.stdout===null)throw new Error("Assertion failed: No output stream registered");t=this.stdout,e[1]=t.get();let i;if(this.stderr===null)throw new Error("Assertion failed: No error stream registered");i=this.stderr,e[2]=i.get();let n=this.implementation(e);return this.pipe&&this.pipe.attach(n.stdin),await n.promise.then(s=>(t.close(),i.close(),s))}async run(){let e=[];for(let i=this;i;i=i.ancestor)e.push(i.exec());return(await Promise.all(e))[0]}};function IB(r,e){return qf.start(r,e)}function oV(r,e=null){let t=new Vo.PassThrough,i=new AV.StringDecoder,n="";return t.on("data",s=>{let o=i.write(s),a;do if(a=o.indexOf(`
`),a!==-1){let l=n+o.substring(0,a);o=o.substring(a+1),n="",r(e!==null?`${e} ${l}`:l)}while(a!==-1);n+=o}),t.on("end",()=>{let s=i.end();s!==""&&r(e!==null?`${e} ${s}`:s)}),t}function uV(r,{prefix:e}){return{stdout:oV(t=>r.stdout.write(`${t}
`),r.stdout.isTTY?e:null),stderr:oV(t=>r.stderr.write(`${t}
`),r.stderr.isTTY?e:null)}}var rke=(0,mV.promisify)(setTimeout);function gV(r,e,t){let i=new Wn.PassThrough({autoDestroy:!0});switch(r){case 0:(e&1)===1&&t.stdin.pipe(i,{end:!1}),(e&2)===2&&t.stdin instanceof Wn.Writable&&i.pipe(t.stdin,{end:!1});break;case 1:(e&1)===1&&t.stdout.pipe(i,{end:!1}),(e&2)===2&&i.pipe(t.stdout,{end:!1});break;case 2:(e&1)===1&&t.stderr.pipe(i,{end:!1}),(e&2)===2&&i.pipe(t.stderr,{end:!1});break;default:throw new Jn(`Bad file descriptor: "${r}"`)}return i}function wB(r,e={}){let t={...r,...e};return t.environment={...r.environment,...e.environment},t.variables={...r.variables,...e.variables},t}var ike=new Map([["cd",async([r=(0,CV.homedir)(),...e],t,i)=>{let n=x.resolve(i.cwd,K.toPortablePath(r));if(!(await t.baseFs.statPromise(n).catch(o=>{throw o.code==="ENOENT"?new Jn(`cd: no such file or directory: ${r}`):o})).isDirectory())throw new Jn(`cd: not a directory: ${r}`);return i.cwd=n,0}],["pwd",async(r,e,t)=>(t.stdout.write(`${K.fromPortablePath(t.cwd)}
`),0)],[":",async(r,e,t)=>0],["true",async(r,e,t)=>0],["false",async(r,e,t)=>1],["exit",async([r,...e],t,i)=>i.exitCode=parseInt(r!=null?r:i.variables["?"],10)],["echo",async(r,e,t)=>(t.stdout.write(`${r.join(" ")}
`),0)],["sleep",async([r],e,t)=>{if(typeof r>"u")throw new Jn("sleep: missing operand");let i=Number(r);if(Number.isNaN(i))throw new Jn(`sleep: invalid time interval '${r}'`);return await rke(1e3*i,0)}],["__ysh_run_procedure",async(r,e,t)=>{let i=t.procedures[r[0]];return await IB(i,{stdin:new Qs(t.stdin),stdout:new Qs(t.stdout),stderr:new Qs(t.stderr)}).run()}],["__ysh_set_redirects",async(r,e,t)=>{let i=t.stdin,n=t.stdout,s=t.stderr,o=[],a=[],l=[],c=0;for(;r[c]!=="--";){let g=r[c++],{type:f,fd:h}=JSON.parse(g),p=v=>{switch(h){case null:case 0:o.push(v);break;default:throw new Error(`Unsupported file descriptor: "${h}"`)}},C=v=>{switch(h){case null:case 1:a.push(v);break;case 2:l.push(v);break;default:throw new Error(`Unsupported file descriptor: "${h}"`)}},y=Number(r[c++]),B=c+y;for(let v=c;v<B;++c,++v)switch(f){case"<":p(()=>e.baseFs.createReadStream(x.resolve(t.cwd,K.toPortablePath(r[v]))));break;case"<<<":p(()=>{let D=new Wn.PassThrough;return process.nextTick(()=>{D.write(`${r[v]}
`),D.end()}),D});break;case"<&":p(()=>gV(Number(r[v]),1,t));break;case">":case">>":{let D=x.resolve(t.cwd,K.toPortablePath(r[v]));C(D==="/dev/null"?new Wn.Writable({autoDestroy:!0,emitClose:!0,write(L,H,j){setImmediate(j)}}):e.baseFs.createWriteStream(D,f===">>"?{flags:"a"}:void 0))}break;case">&":C(gV(Number(r[v]),2,t));break;default:throw new Error(`Assertion failed: Unsupported redirection type: "${f}"`)}}if(o.length>0){let g=new Wn.PassThrough;i=g;let f=h=>{if(h===o.length)g.end();else{let p=o[h]();p.pipe(g,{end:!1}),p.on("end",()=>{f(h+1)})}};f(0)}if(a.length>0){let g=new Wn.PassThrough;n=g;for(let f of a)g.pipe(f)}if(l.length>0){let g=new Wn.PassThrough;s=g;for(let f of l)g.pipe(f)}let u=await IB(xC(r.slice(c+1),e,t),{stdin:new Qs(i),stdout:new Qs(n),stderr:new Qs(s)}).run();return await Promise.all(a.map(g=>new Promise((f,h)=>{g.on("error",p=>{h(p)}),g.on("close",()=>{f()}),g.end()}))),await Promise.all(l.map(g=>new Promise((f,h)=>{g.on("error",p=>{h(p)}),g.on("close",()=>{f()}),g.end()}))),u}]]);async function nke(r,e,t){let i=[],n=new Wn.PassThrough;return n.on("data",s=>i.push(s)),await BB(r,e,wB(t,{stdout:n})),Buffer.concat(i).toString().replace(/[\r\n]+$/,"")}async function fV(r,e,t){let i=r.map(async s=>{let o=await Lc(s.args,e,t);return{name:s.name,value:o.join(" ")}});return(await Promise.all(i)).reduce((s,o)=>(s[o.name]=o.value,s),{})}function yB(r){return r.match(/[^ \r\n\t]+/g)||[]}async function EV(r,e,t,i,n=i){switch(r.name){case"$":i(String(process.pid));break;case"#":i(String(e.args.length));break;case"@":if(r.quoted)for(let s of e.args)n(s);else for(let s of e.args){let o=yB(s);for(let a=0;a<o.length-1;++a)n(o[a]);i(o[o.length-1])}break;case"*":{let s=e.args.join(" ");if(r.quoted)i(s);else for(let o of yB(s))n(o)}break;case"PPID":i(String(process.ppid));break;case"RANDOM":i(String(Math.floor(Math.random()*32768)));break;default:{let s=parseInt(r.name,10),o,a=Number.isFinite(s);if(a?s>=0&&s<e.args.length&&(o=e.args[s]):Object.prototype.hasOwnProperty.call(t.variables,r.name)?o=t.variables[r.name]:Object.prototype.hasOwnProperty.call(t.environment,r.name)&&(o=t.environment[r.name]),typeof o<"u"&&r.alternativeValue?o=(await Lc(r.alternativeValue,e,t)).join(" "):typeof o>"u"&&(r.defaultValue?o=(await Lc(r.defaultValue,e,t)).join(" "):r.alternativeValue&&(o="")),typeof o>"u")throw a?new Jn(`Unbound argument #${s}`):new Jn(`Unbound variable "${r.name}"`);if(r.quoted)i(o);else{let l=yB(o);for(let u=0;u<l.length-1;++u)n(l[u]);let c=l[l.length-1];typeof c<"u"&&i(c)}}break}}var ske={addition:(r,e)=>r+e,subtraction:(r,e)=>r-e,multiplication:(r,e)=>r*e,division:(r,e)=>Math.trunc(r/e)};async function vC(r,e,t){if(r.type==="number"){if(Number.isInteger(r.value))return r.value;throw new Error(`Invalid number: "${r.value}", only integers are allowed`)}else if(r.type==="variable"){let i=[];await EV({...r,quoted:!0},e,t,s=>i.push(s));let n=Number(i.join(" "));return Number.isNaN(n)?vC({type:"variable",name:i.join(" ")},e,t):vC({type:"number",value:n},e,t)}else return ske[r.type](await vC(r.left,e,t),await vC(r.right,e,t))}async function Lc(r,e,t){let i=new Map,n=[],s=[],o=u=>{s.push(u)},a=()=>{s.length>0&&n.push(s.join("")),s=[]},l=u=>{o(u),a()},c=(u,g,f)=>{let h=JSON.stringify({type:u,fd:g}),p=i.get(h);typeof p>"u"&&i.set(h,p=[]),p.push(f)};for(let u of r){let g=!1;switch(u.type){case"redirection":{let f=await Lc(u.args,e,t);for(let h of f)c(u.subtype,u.fd,h)}break;case"argument":for(let f of u.segments)switch(f.type){case"text":o(f.text);break;case"glob":o(f.pattern),g=!0;break;case"shell":{let h=await nke(f.shell,e,t);if(f.quoted)o(h);else{let p=yB(h);for(let C=0;C<p.length-1;++C)l(p[C]);o(p[p.length-1])}}break;case"variable":await EV(f,e,t,o,l);break;case"arithmetic":o(String(await vC(f.arithmetic,e,t)));break}break}if(a(),g){let f=n.pop();if(typeof f>"u")throw new Error("Assertion failed: Expected a glob pattern to have been set");let h=await e.glob.match(f,{cwd:t.cwd,baseFs:e.baseFs});if(h.length===0){let p=LR(f)?". Note: Brace expansion of arbitrary strings isn't currently supported. For more details, please read this issue: https://github.com/yarnpkg/berry/issues/22":"";throw new Jn(`No matches found: "${f}"${p}`)}for(let p of h.sort())l(p)}}if(i.size>0){let u=[];for(let[g,f]of i.entries())u.splice(u.length,0,g,String(f.length),...f);n.splice(0,0,"__ysh_set_redirects",...u,"--")}return n}function xC(r,e,t){e.builtins.has(r[0])||(r=["command",...r]);let i=K.fromPortablePath(t.cwd),n=t.environment;typeof n.PWD<"u"&&(n={...n,PWD:i});let[s,...o]=r;if(s==="command")return lV(o[0],o.slice(1),e,{cwd:i,env:n});let a=e.builtins.get(s);if(typeof a>"u")throw new Error(`Assertion failed: A builtin should exist for "${s}"`);return cV(async({stdin:l,stdout:c,stderr:u})=>{let{stdin:g,stdout:f,stderr:h}=t;t.stdin=l,t.stdout=c,t.stderr=u;try{return await a(o,e,t)}finally{t.stdin=g,t.stdout=f,t.stderr=h}})}function oke(r,e,t){return i=>{let n=new Wn.PassThrough,s=BB(r,e,wB(t,{stdin:n}));return{stdin:n,promise:s Line truncated
`)).finally(()=>{t.stdout.isTTY&&t.stdout.write(`Job ${l}, '${o(Dg(r))}' has ended
`)})),0}return await pV(r,e,t)}async function lke(r,e,t,{background:i=!1}={}){let n,s=a=>{n=a,t.variables["?"]=String(a)},o=async a=>{try{return await Ake(a.chain,e,t,{background:i&&typeof a.then>"u"})}catch(l){if(!(l instanceof Jn))throw l;return t.stderr.write(`${l.message}
`),1}};for(s(await o(r));r.then;){if(t.exitCode!==null)return t.exitCode;switch(r.then.type){case"&&":n===0&&s(await o(r.then.line));break;case"||":n!==0&&s(await o(r.then.line));break;default:throw new Error(`Assertion failed: Unsupported command type: "${r.then.type}"`)}r=r.then.line}return n}async function BB(r,e,t){let i=t.backgroundJobs;t.backgroundJobs=[];let n=0;for(let{command:s,type:o}of r){if(n=await lke(s,e,t,{background:o==="&"}),t.exitCode!==null)return t.exitCode;t.variables["?"]=String(n)}return await Promise.all(t.backgroundJobs),t.backgroundJobs=i,n}function IV(r){switch(r.type){case"variable":return r.name==="@"||r.name==="#"||r.name==="*"||Number.isFinite(parseInt(r.name,10))||"defaultValue"in r&&!!r.defaultValue&&r.defaultValue.some(e=>PC(e))||"alternativeValue"in r&&!!r.alternativeValue&&r.alternativeValue.some(e=>PC(e));case"arithmetic":return KR(r.arithmetic);case"shell":return UR(r.shell);default:return!1}}function PC(r){switch(r.type){case"redirection":return r.args.some(e=>PC(e));case"argument":return r.segments.some(e=>IV(e));default:throw new Error(`Assertion failed: Unsupported argument type: "${r.type}"`)}}function KR(r){switch(r.type){case"variable":return IV(r);case"number":return!1;default:return KR(r.left)||KR(r.right)}}function UR(r){return r.some(({command:e})=>{for(;e;){let t=e.chain;for(;t;){let i;switch(t.type){case"subshell":i=UR(t.subshell);break;case"command":i=t.envs.some(n=>n.args.some(s=>PC(s)))||t.args.some(n=>PC(n));break}if(i)return!0;if(!t.then)break;t=t.then.chain}if(!e.then)break;e=e.then.line}return!1})}async function QB(r,e=[],{baseFs:t=new $t,builtins:i={},cwd:n=K.toPortablePath(process.cwd()),env:s=process.env,stdin:o=process.stdin,stdout:a=process.stdout,stderr:l=process.stderr,variables:c={},glob:u=EB}={}){let g={};for(let[p,C]of Object.entries(s))typeof C<"u"&&(g[p]=C);let f=new Map(ike);for(let[p,C]of Object.entries(i))f.set(p,C);o===null&&(o=new Wn.PassThrough,o.end());let h=aI(r,u);if(!UR(h)&&h.length>0&&e.length>0){let{command:p}=h[h.length-1];for(;p.then;)p=p.then.line;let C=p.chain;for(;C.then;)C=C.then.chain;C.type==="command"&&(C.args=C.args.concat(e.map(y=>({type:"argument",segments:[{type:"text",text:y}]}))))}return await BB(h,{args:e,baseFs:t,builtins:f,initialStdin:o,initialStdout:a,initialStderr:l,glob:u},{cwd:n,environment:g,exitCode:null,procedures:{},stdin:o,stdout:a,stderr:l,variables:Object.assign({},c,{["?"]:0}),nextBackgroundJobIndex:1,backgroundJobs:[]})}var o7=Pe(bB()),a7=Pe(Yg()),$A=J("stream");var n7=Pe(e7()),PB=Pe(nc());var t7=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],r7=80,aRe=new Set([13,19]),ARe=5,xB=PB.default.GITHUB_ACTIONS?{start:r=>`::group::${r}
`,end:r=>`::endgroup::
`}:PB.default.TRAVIS?{start:r=>`travis_fold:start:${r}
`,end:r=>`travis_fold:end:${r}
`}:PB.default.GITLAB?{start:r=>`section_start:${Math.floor(Date.now()/1e3)}:${r.toLowerCase().replace(/\W+/g,"_")}[collapsed=true]\r\x1B[0K${r}
`,end:r=>`section_end:${Math.floor(Date.now()/1e3)}:${r.toLowerCase().replace(/\W+/g,"_")}\r\x1B[0K`}:null,i7=new Date,lRe=["iTerm.app","Apple_Terminal","WarpTerminal","vscode"].includes(process.env.TERM_PROGRAM)||!!process.env.WT_SESSION,cRe=r=>r,DB=cRe({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}}),uRe=lRe&&Object.keys(DB).find(r=>{let e=DB[r];return!(e.date&&(e.date[0]!==i7.getDate()||e.date[1]!==i7.getMonth()+1))})||"default";function s7(r,{configuration:e,json:t}){if(!e.get("enableMessageNames"))return"";let n=RA(r===null?0:r);return!t&&r===null?$e(e,n,"grey"):n}function qR(r,{configuration:e,json:t}){let i=s7(r,{configuration:e,json:t});if(!i||r===null||r===0)return i;let n=Ct[r],s=`https://yarnpkg.com/advanced/error-codes#${i}---${n}`.toLowerCase();return Cf(e,i,s)}var Ge=class extends vi{constructor({configuration:t,stdout:i,json:n=!1,includePrefix:s=!0,includeFooter:o=!0,includeLogs:a=!n,includeInfos:l=a,includeWarnings:c=a,forgettableBufferSize:u=ARe,forgettableNames:g=new Set}){super();this.uncommitted=new Set;this.cacheHitCount=0;this.cacheMissCount=0;this.lastCacheMiss=null;this.warningCount=0;this.errorCount=0;this.startTime=Date.now();this.indent=0;this.progress=new Map;this.progressTime=0;this.progressFrame=0;this.progressTimeout=null;this.progressStyle=null;this.progressMaxScaledSize=null;this.forgettableLines=[];if(zd(this,{configuration:t}),this.configuration=t,this.forgettableBufferSize=u,this.forgettableNames=new Set([...g,...aRe]),this.includePrefix=s,this.includeFooter=o,this.includeInfos=l,this.includeWarnings=c,this.json=n,this.stdout=i,t.get("enableProgressBars")&&!n&&i.isTTY&&i.columns>22){let f=t.get("progressBarStyle")||uRe;if(!Object.prototype.hasOwnProperty.call(DB,f))throw new Error("Assertion failed: Invalid progress bar style");this.progressStyle=DB[f];let h=12,p=Math.max(0,Math.min(i.columns-h,80));this.progressMaxScaledSize=Math.floor(this.progressStyle.size*p/80)}}static async start(t,i){let n=new this(t),s=process.emitWarning;process.emitWarning=(o,a)=>{if(typeof o!="string"){let c=o;o=c.message,a=a!=null?a:c.name}let l=typeof a<"u"?`${a}: ${o}`:o;n.reportWarning(0,l)};try{await i(n)}catch(o){n.reportExceptionOnce(o)}finally{await n.finalize(),process.emitWarning=s}return n}hasErrors(){return this.errorCount>0}exitCode(){return this.hasErrors()?1:0}reportCacheHit(t){this.cacheHitCount+=1}reportCacheMiss(t,i){this.lastCacheMiss=t,this.cacheMissCount+=1,typeof i<"u"&&!this.configuration.get("preferAggregateCacheInfo")&&this.reportInfo(13,i)}startSectionSync({reportHeader:t,reportFooter:i,skipIfEmpty:n},s){let o={committed:!1,action:()=>{t==null||t()}};n?this.uncommitted.add(o):(o.action(),o.committed=!0);let a=Date.now();try{return s()}catch(l){throw this.reportExceptionOnce(l),l}finally{let l=Date.now();this.uncommitted.delete(o),o.committed&&(i==null||i(l-a))}}async startSectionPromise({reportHeader:t,reportFooter:i,skipIfEmpty:n},s){let o={committed:!1,action:()=>{t==null||t()}};n?this.uncommitted.add(o):(o.action(),o.committed=!0);let a=Date.now();try{return await s()}catch(l){throw this.reportExceptionOnce(l),l}finally{let l=Date.now();this.uncommitted.delete(o),o.committed&&(i==null||i(l-a))}}startTimerImpl(t,i,n){return{cb:typeof i=="function"?i:n,reportHeader:()=>{this.reportInfo(null,`\u250C ${t}`),this.indent+=1,xB!==null&&!this.json&&this.includeInfos&&this.stdout.write(xB.start(t))},reportFooter:a=>{this.indent-=1,xB!==null&&!this.json&&this.includeInfos&&this.stdout.write(xB.end(t)),this.configuration.get("enableTimers")&&a>200?this.reportInfo(null,`\u2514 Completed in ${$e(this.configuration,a,Ue.DURATION)}`):this.reportInfo(null,"\u2514 Completed")},skipIfEmpty:(typeof i=="function"?{}:i).skipIfEmpty}}startTimerSync(t,i,n){let{cb:s,...o}=this.startTimerImpl(t,i,n);return this.startSectionSync(o,s)}async startTimerPromise(t,i,n){let{cb:s,...o}=this.startTimerImpl(t,i,n);return this.startSectionPromise(o,s)}async startCacheReport(t){let i=this.configuration.get("preferAggregateCacheInfo")?{cacheHitCount:this.cacheHitCount,cacheMissCount:this.cacheMissCount}:null;try{return await t()}catch(n){throw this.reportExceptionOnce(n),n}finally{i!==null&&this.reportCacheChanges(i)}}reportSeparator(){this.indent===0?this.writeLineWithForgettableReset(""):this.reportInfo(null,"")}reportInfo(t,i){if(!this.includeInfos)return;this.commit();let n=this.formatNameWithHyperlink(t),s=n?`${n}: `:"",o=`${this.formatPrefix(s,"blueBright")}${i}`;if(this.json)this.reportJson({type:"info",name:t,displayName:this.formatName(t),indent:this.formatIndent(),data:i});else if(this.forgettableNames.has(t))if(this.forgettableLines.push(o),this.forgettableLines.length>this.forgettableBufferSize){for(;this.forgettableLines.length>this.forgettableBufferSize;)th Line truncated
`),this.writeProgress()}writeLineWithForgettableReset(t,{truncate:i}={}){this.forgettableLines=[],this.writeLine(t,{truncate:i})}writeLines(t,{truncate:i}={}){this.clearProgress({delta:t.length});for(let n of t)this.stdout.write(`${this.truncate(n,{truncate:i})}
`);this.writeProgress()}reportCacheChanges({cacheHitCount:t,cacheMissCount:i}){let n=this.cacheHitCount-t,s=this.cacheMissCount-i;if(n===0&&s===0)return;let o="";this.cacheHitCount>1?o+=`${this.cacheHitCount} packages were already cached`:this.cacheHitCount===1?o+=" - one package was already cached":o+="No packages were cached",this.cacheHitCount>0?this.cacheMissCount>1?o+=`, ${this.cacheMissCount} had to be fetched`:this.cacheMissCount===1&&(o+=`, one had to be fetched (${mt(this.configuration,this.lastCacheMiss)})`):this.cacheMissCount>1?o+=` - ${this.cacheMissCount} packages had to be fetched`:this.cacheMissCount===1&&(o+=` - one package had to be fetched (${mt(this.configuration,this.lastCacheMiss)})`),this.reportInfo(13,o)}commit(){let t=this.uncommitted;this.uncommitted=new Set;for(let i of t)i.committed=!0,i.action()}clearProgress({delta:t=0,clear:i=!1}){this.progressStyle!==null&&this.progress.size+t>0&&(this.stdout.write(`\x1B[${this.progress.size+t}A`),(t>0||i)&&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 t=Date.now();t-this.progressTime>r7&&(this.progressFrame=(this.progressFrame+1)%t7.length,this.progressTime=t);let i=t7[this.progressFrame];for(let n of this.progress.values()){let s="";if(typeof n.lastScaledSize<"u"){let c=this.progressStyle.chars[0].repeat(n.lastScaledSize),u=this.progressStyle.chars[1].repeat(this.progressMaxScaledSize-n.lastScaledSize);s=` ${c}${u}`}let o=this.formatName(null),a=o?`${o}: `:"",l=n.definition.title?` ${n.definition.title}`:"";this.stdout.write(`${$e(this.configuration,"\u27A4","blueBright")} ${a}${i}${s}${l}
`)}this.progressTimeout=setTimeout(()=>{this.refreshProgress({force:!0})},r7)}refreshProgress({delta:t=0,force:i=!1}={}){let n=!1,s=!1;if(i||this.progress.size===0)n=!0;else for(let o of this.progress.values()){let a=typeof o.definition.progress<"u"?Math.trunc(this.progressMaxScaledSize*o.definition.progress):void 0,l=o.lastScaledSize;o.lastScaledSize=a;let c=o.lastTitle;if(o.lastTitle=o.definition.title,a!==l||(s=c!==o.definition.title)){n=!0;break}}n&&(this.clearProgress({delta:t,clear:s}),this.writeProgress())}truncate(t,{truncate:i}={}){return this.progressStyle===null&&(i=!1),typeof i>"u"&&(i=this.configuration.get("preferTruncatedLines")),i&&(t=(0,n7.default)(t,0,this.stdout.columns-1)),t}formatName(t){return s7(t,{configuration:this.configuration,json:this.json})}formatPrefix(t,i){return this.includePrefix?`${$e(this.configuration,"\u27A4",i)} ${t}${this.formatIndent()}`:""}formatNameWithHyperlink(t){return qR(t,{configuration:this.configuration,json:this.json})}formatIndent(){return"\u2502 ".repeat(this.indent)}};var Lr="3.5.0";var A7=(n=>(n.Yarn1="Yarn Classic",n.Yarn2="Yarn",n.Npm="npm",n.Pnpm="pnpm",n))(A7||{});async function qa(r,e,t,i=[]){if(process.platform==="win32"){let n=`@goto #_undefined_# 2>NUL || @title %COMSPEC% & @setlocal & @"${t}" ${i.map(s=>`"${s.replace('"','""')}"`).join(" ")} %*`;await M.writeFilePromise(x.format({dir:r,name:e,ext:".cmd"}),n)}await M.writeFilePromise(x.join(r,e),`#!/bin/sh
exec "${t}" ${i.map(n=>`'${n.replace(/'/g,`'"'"'`)}'`).join(" ")} "$@"
`,{mode:493})}async function l7(r){let e=await ot.tryFind(r);if(e!=null&&e.packageManager){let i=Bw(e.packageManager);if(i!=null&&i.name){let n=`found ${JSON.stringify({packageManager:e.packageManager})} in manifest`,[s]=i.reference.split(".");switch(i.name){case"yarn":{let o=Number(s)===1?"Yarn Classic":"Yarn";return{packageManagerField:!0,packageManager:o,reason:n}}break;case"npm":return{packageManagerField:!0,packageManager:"npm",reason:n};case"pnpm":return{packageManagerField:!0,packageManager:"pnpm",reason:n}}}}let t;try{t=await M.readFilePromise(x.join(r,xt.lockfile),"utf8")}catch{}return t!==void 0?t.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'}:M.existsSync(x.join(r,"package-lock.json"))?{packageManager:"npm",reason:`found npm's "package-lock.json" lockfile`}:M.existsSync(x.join(r,"pnpm-lock.yaml"))?{packageManager:"pnpm",reason:`found pnpm's "pnpm-lock.yaml" lockfile`}:null}async function kC({project:r,locator:e,binFolder:t,ignoreCorepack:i,lifecycleScript:n}){var c,u;let s={};for(let[g,f]of Object.entries(process.env))typeof f<"u"&&(s[g.toLowerCase()!=="path"?g:"PATH"]=f);let o=K.fromPortablePath(t);s.BERRY_BIN_FOLDER=K.fromPortablePath(o);let a=process.env.COREPACK_ROOT&&!i?K.join(process.env.COREPACK_ROOT,"dist/yarn.js"):process.argv[1];if(await Promise.all([qa(t,"node",process.execPath),...Lr!==null?[qa(t,"run",process.execPath,[a,"run"]),qa(t,"yarn",process.execPath,[a]),qa(t,"yarnpkg",process.execPath,[a]),qa(t,"node-gyp",process.execPath,[a,"run","--top-level","node-gyp"])]:[]]),r&&(s.INIT_CWD=K.fromPortablePath(r.configuration.startingCwd),s.PROJECT_CWD=K.fromPortablePath(r.cwd)),s.PATH=s.PATH?`${o}${K.delimiter}${s.PATH}`:`${o}`,s.npm_execpath=`${o}${K.sep}yarn`,s.npm_node_execpath=`${o}${K.sep}node`,e){if(!r)throw new Error("Assertion failed: Missing project");let g=r.tryWorkspaceByLocator(e),f=g?(c=g.manifest.version)!=null?c:"":(u=r.storedPackages.get(e.locatorHash).version)!=null?u:"";s.npm_package_name=Ot(e),s.npm_package_version=f;let h;if(g)h=g.cwd;else{let p=r.storedPackages.get(e.locatorHash);if(!p)throw new Error(`Package for ${mt(r.configuration,e)} not found in the project`);let C=r.configuration.getLinkers(),y={project:r,report:new Ge({stdout:new $A.PassThrough,configuration:r.configuration})},B=C.find(v=>v.supportsPackage(p,y));if(!B)throw new Error(`The package ${mt(r.configuration,p)} isn't supported by any of the available linkers`);h=await B.findPackageLocation(p,y)}s.npm_package_json=K.fromPortablePath(x.join(h,xt.manifest))}let l=Lr!==null?`yarn/${Lr}`:`yarn/${pf("@yarnpkg/core").version}-core`;return s.npm_config_user_agent=`${l} npm/? node/${process.version} ${process.platform} ${process.arch}`,n&&(s.npm_lifecycle_event=n),r&&await r.configuration.triggerHook(g=>g.setupScriptEnvironment,r,s,async(g,f,h)=>await qa(t,Ur(g),f,h)),s}var gRe=2,fRe=(0,a7.default)(gRe);async function hRe(r,e,{configuration:t,report:i,workspace:n=null,locator:s=null}){await fRe(async()=>{await M.mktempPromise(async o=>{let a=x.join(o,"pack.log"),l=null,{stdout:c,stderr:u}=t.getSubprocessStreams(a,{prefix:K.fromPortablePath(r),report:i}),g=s&&jo(s)?rC(s):s,f=g?Cs(g):"an external project";c.write(`Packing ${f} from sources
`);let h=await l7(r),p;h!==null?(c.write(`Using ${h.packageManager} for bootstrap. Reason: ${h.reason}
`),p=h.packageManager):(c.write(`No package manager configuration detected; defaulting to Yarn
`),p="Yarn");let C=p==="Yarn"&&!(h!=null&&h.packageManagerField);await M.mktempPromise(async y=>{let B=await kC({binFolder:y,ignoreCorepack:C}),D=new Map([["Yarn Classic",async()=>{let H=n!==null?["workspace",n]:[],j=x.join(r,xt.manifest),$=await M.readFilePromise(j),V=await Wo(process.execPath,[process.argv[1],"set","version","classic","--only-if-needed"],{cwd:r,env:B,stdin:l,stdout:c,stderr:u,end:1});if(V.code!==0)return V.code;await M.writeFilePromise(j,$),await M.appendFilePromise(x.join(r,".npmignore"),`/.yarn
`),c.write(`
`),delete B.NODE_ENV;let W=await Wo("yarn",["install"],{cwd:r,env:B,stdin:l,stdout:c,stderr:u,end:1});if(W.code!==0)return W.code;c.write(`
`);let _=await Wo("yarn",[...H,"pack","--filename",K.fromPortablePath(e)],{cwd:r,env:B,stdin:l,stdout:c,stderr:u});return _.code!==0?_.code:0}],["Yarn",async()=>{let H=n!==null?["workspace",n]:[];B.YARN_ENABLE_INLINE_BUILDS="1";let j=x.join(r,xt.lockfile);await M.existsPromise(j)||await M.writeFilePromise(j,"");let $=await Wo("yarn",[...H,"pack","--install-if-needed","--filename",K.fromPortablePath(e)],{cwd:r,env:B,stdin:l,stdout:c,stderr:u});return $.code!==0?$.code:0}],["npm",async()=>{if(n!==null){let ae=new $A.PassThrough,ge=hf(ae);ae.pipe(c,{end:!1});let re=await Wo("npm",["--version"],{cwd:r,env:B,stdin:l,stdout:ae,stderr:u,end:0});if(ae.end(),re.code!==0)return c.end(),u.end(),re.code;let O=(await ge).toString().trim();if(!vc(O,">=7.x")){let F=qo(null,"npm"),ue=_t(F,O),he=_t(F,">=7.x");throw new Error(`Workspaces aren't supported by ${tr(t,ue)}; please upgrade to ${tr(t,he)} (npm has been detected as the primary package manager for ${$e(t,r,Ue.PATH)})`)}}let H=n!==null?["--workspace",n]:[];delete B.npm_config_user_agent,delete B.npm_config_production,delete B.NPM_CONFIG_PRODUCTION,delete B.NODE_ENV;let j=await Wo("npm",["install"],{cwd:r,env:B,stdin:l,stdout:c,stderr:u,end:1});if(j.code!==0)return j.code;let $=new $A.PassThrough,V=hf($);$.pipe(c);let W=await Wo("npm",["pack","--silent",...H],{cwd:r,env:B,stdin:l,stdout:$,stderr:u});if(W.code!==0)return W.code;let _=(await V).toString().trim().replace(/^.*\n/s,""),A=x.resolve(r,K.toPortablePath(_));return await M.renamePromise(A,e),0}]]).get(p);if(typeof D>"u")throw new Error("Assertion failed: Unsupported workflow");let L=await D();if(!(L===0||typeof L>"u"))throw M.detachTemp(o),new at(58,`Packing the package failed (exit code ${L}, logs can be found here: ${$e(t,a,Ue.PATH)})`)})})})}async function pRe(r,e,{project:t}){let i=t.tryWorkspaceByLocator(r);if(i!==null)return WR(i,e);let n=t.storedPackages.get(r.locatorHash);if(!n)throw new Error(`Package for ${mt(t.configuration,r)} not found in the project`);return await On.openPromise(async s=>{let o=t.configuration,a=t.configuration.getLinkers(),l={project:t,report:new Ge({stdout:new $A.PassThrough,configuration:o})},c=a.find(h=>h.supportsPackage(n,l));if(!c)throw new Error(`The package ${mt(t.configuration,n)} isn't supported by any of the available linkers`);let u=await c.findPackageLocation(n,l),g=new qt(u,{baseFs:s});return(await ot.find(Oe.dot,{baseFs:g})).scripts.has(e)},{libzip:await sn()})}async function kB(r,e,t,{cwd:i,project:n,stdin:s,stdout:o,stderr:a}){return await M.mktempPromise(async l=>{let{manifest:c,env:u,cwd:g}=await c7(r,{project:n,binFolder:l,cwd:i,lifecycleScript:e}),f=c.scripts.get(e);if(typeof f>"u")return 1;let h=async()=>await QB(f,t,{cwd:g,env:u,stdin:s,stdout:o,stderr:a});return await(await n.configuration.reduceHook(C=>C.wrapScriptExecution,h,n,r,e,{script:f,args:t,cwd:g,env:u,stdin:s,stdout:o,stderr:a}))()})}async function JR(r,e,t,{cwd:i,project:n,stdin:s,stdout:o,stderr:a}){return await M.mktempPromise(async l=>{let{env:c,cwd:u}=await c7(r,{project:n,binFolder:l,cwd:i});return await QB(e,t,{cwd:u,env:c,stdin:s,stdout:o,stderr:a})})}async function dRe(r,{binFolder:e,cwd:t,lifecycleScript:i}){let n=await kC({project:r.project,locator:r.anchoredLocator,binFolder:e,lifecycleScript:i});return await Promise.all(Array.from(await f7(r),([s,[,o]])=>qa(e,Ur(s),process.execPath,[o]))),typeof t>"u"&&(t=x.dirname(await M.realpathPromise(x.join(r.cwd,"package.json")))),{manifest:r.manifest,binFolder:e,env:n,cwd:t}}async function c7(r,{project:e,binFolder:t,cwd:i,lifecycleScript:n}){let s=e.tryWorkspaceByLocator(r);if(s!==null)return dRe(s,{binFolder:t,cwd:i,lifecycleScript:n});let o=e.storedPackages.get(r.locatorHash);if(!o)throw new Error(`Package for ${mt(e.configuration,r)} not found in the project`);return await On.openPromise(async a=>{let l=e.configuration,c=e.configuration.getLinkers(),u={project:e,report:new Ge({stdout:new $A.PassThrough,configuration:l})},g=c.find(y=>y.supportsPackage(o,u));if(!g)throw new Error(`The package ${mt(e.configuration,o)} isn't supported by any of the available linkers`);let f=await kC({project:e,locator:r,binFolder:t,lifecycleScript:n});await Promise.all(Array.from(await RB(r,{project:e}),([y,[,B]])=>qa(t,Ur(y),process.execPath,[B])));let h=await g.findPackageLocation(o,u),p=new qt(h,{baseFs:a}),C=await ot.find(Oe.dot,{baseFs:p});return typeof i>"u"&&(i=h),{manifest:C,binFolder:t,env:f,cwd:i}},{libzip:await sn()})}async function u7(r,e,t,{cwd:i,stdin:n,stdout:s,stderr:o}){return await kB(r.anchoredLocator,e,t,{cwd:i,project:r.project,stdin:n,stdout:s,stderr:o})}function WR(r,e){return r.manifest.scripts.has(e)}async function g7(r,e,{cwd:t,report:i}){let{configuration:n}=r.project,s=null;await M.mktempPromise(async o=>{let a=x.join(o,`${e}.log`),l=`# This file contains the result of Yarn calling the "${e}" lifecycle script inside a workspace ("${K.fromPortablePath(r.cwd)}")
`,{stdout:c,stderr:u}=n.getSubprocessStreams(a,{report:i,prefix:mt(n,r.anchoredLocator),header:l});i.reportInfo(36,`Calling the "${e}" lifecycle script`);let g=await u7(r,e,[],{cwd:t,stdin:s,stdout:c,stderr:u});if(c.end(),u.end(),g!==0)throw M.detachTemp(o),new at(36,`${(0,o7.default)(e)} script failed (exit code ${$e(n,g,Ue.NUMBER)}, logs can be found here: ${$e(n,a,Ue.PATH)}); run ${$e(n,`yarn ${e}`,Ue.CODE)} to investigate`)})}async function CRe(r,e,t){WR(r,e)&&await g7(r,e,t)}async function RB(r,{project:e}){let t=e.configuration,i=new Map,n=e.storedPackages.get(r.locatorHash);if(!n)throw new Error(`Package for ${mt(t,r)} not found in the project`);let s=new $A.Writable,o=t.getLinkers(),a={project:e,report:new Ge({configuration:t,stdout:s})},l=new Set([r.locatorHash]);for(let u of n.dependencies.values()){let g=e.storedResolutions.get(u.descriptorHash);if(!g)throw new Error(`Assertion failed: The resolution (${tr(t,u)}) should have been registered`);l.add(g)}let c=await Promise.all(Array.from(l,async u=>{let g=e.storedPackages.get(u);if(!g)throw new Error(`Assertion failed: The package (${u}) should have been registered`);if(g.bin.size===0)return Uo.skip;let f=o.find(p=>p.supportsPackage(g,a));if(!f)return Uo.skip;let h=null;try{h=await f.findPackageLocation(g,a)}catch(p){if(p.code==="LOCATOR_NOT_INSTALLED")return Uo.skip;throw p}return{dependency:g,packageLocation:h}}));for(let u of c){if(u===Uo.skip)continue;let{dependency:g,packageLocation:f}=u;for(let[h,p]of g.bin)i.set(h,[g,K.fromPortablePath(x.resolve(f,p))])}return i}async function f7(r){return await RB(r.anchoredLocator,{project:r.project})}async function h7(r,e,t,{cwd:i,project:n,stdin:s,stdout:o,stderr:a,nodeArgs:l=[],packageAccessibleBinaries:c}){c!=null||(c=await RB(r,{project:n}));let u=c.get(e);if(!u)throw new Error(`Binary not found (${e}) for ${mt(n.configuration,r)}`);return await M.mktempPromise(async g=>{let[,f]=u,h=await kC({project:n,locator:r,binFolder:g});await Promise.all(Array.from(c,([C,[,y]])=>qa(h.BERRY_BIN_FOLDER,Ur(C),process.execPath,[y])));let p;try{p=await Wo(process.execPath,[...l,f,...t],{cwd:i,env:h,stdin:s,stdout:o,stderr:a})}finally{await M.removePromise(h.BERRY_BIN_FOLDER)}return p.code})}async function mRe(r,e,t,{cwd:i,stdin:n,stdout:s,stderr:o,packageAccessibleBinaries:a}){return await h7(r.anchoredLocator,e,t,{project:r.project,cwd:i,stdin:n,stdout:s,stderr:o,packageAccessibleBinaries:a})}var mi={};ut(mi,{convertToZip:()=>qNe,extractArchiveTo:()=>WNe,makeArchiveFromDirectory:()=>jNe});var nZ=J("stream"),sZ=Pe(_X());var $X=Pe(Yg()),eZ=J("worker_threads");var gl=Symbol("kTaskInfo"),R0=class{constructor(e){this.source=e;this.workers=[];this.limit=(0,$X.default)(ek());this.cleanupInterval=setInterval(()=>{if(this.limit.pendingCount===0&&this.limit.activeCount===0){let t=this.workers.pop();t?t.terminate():clearInterval(this.cleanupInterval)}},5e3).unref()}createWorker(){this.cleanupInterval.refresh();let e=new eZ.Worker(this.source,{eval:!0,execArgv:[...process.execArgv,"--unhandled-rejections=strict"]});return e.on("message",t=>{if(!e[gl])throw new Error("Assertion failed: Worker sent a result without having a task assigned");e[gl].resolve(t),e[gl]=null,e.unref(),this.workers.push(e)}),e.on("error",t=>{var i;(i=e[gl])==null||i.reject(t),e[gl]=null}),e.on("exit",t=>{var i;t!==0&&((i=e[gl])==null||i.reject(new Error(`Worker exited with code ${t}`))),e[gl]=null}),e}run(e){return this.limit(()=>{var i;let t=(i=this.workers.pop())!=null?i:this.createWorker();return t.ref(),new Promise((n,s)=>{t[gl]={resolve:n,reject:s},t.postMessage(e)})})}};var oZ=Pe(rZ());async function jNe(r,{baseFs:e=new $t,prefixPath:t=Oe.root,compressionLevel:i,inMemory:n=!1}={}){let s=await sn(),o;if(n)o=new Wr(null,{libzip:s,level:i});else{let l=await M.mktempPromise(),c=x.join(l,"archive.zip");o=new Wr(c,{create:!0,libzip:s,level:i})}let a=x.resolve(Oe.root,t);return await o.copyPromise(a,r,{baseFs:e,stableTime:!0,stableSort:!0}),o}var iZ;async function qNe(r,e){let t=await M.mktempPromise(),i=x.join(t,"archive.zip");return iZ||(iZ=new R0((0,oZ.getContent)())),await iZ.run({tmpFile:i,tgz:r,opts:e}),new Wr(i,{libzip:await sn(),level:e.compressionLevel})}async function*JNe(r){let e=new sZ.default.Parse,t=new nZ.PassThrough({objectMode:!0,autoDestroy:!0,emitClose:!0});e.on("entry",i=>{t.write(i)}),e.on("error",i=>{t.destroy(i)}),e.on("close",()=>{t.destroyed||t.end()}),e.end(r);for await(let i of t){let n=i;yield n,n.resume()}}async function WNe(r,e,{stripComponents:t=0,prefixPath:i=Oe.dot}={}){var s,o;function n(a){if(a.path[0]==="/")return!0;let l=a.path.split(/\//g);return!!(l.some(c=>c==="..")||l.length<=t)}for await(let a of JNe(r)){if(n(a))continue;let l=x.normalize(K.toPortablePath(a.path)).replace(/\/$/,"").split(/\//g);if(l.length<=t)continue;let c=l.slice(t).join("/"),u=x.join(i,c),g=420;switch((a.type==="Directory"||(((s=a.mode)!=null?s:0)&73)!==0)&&(g|=73),a.type){case"Directory":e.mkdirpSync(x.dirname(u),{chmod:493,utimes:[xr.SAFE_TIM Line truncated
`);return}let s=(0,lZ.asTree)(cZ(r,{configuration:e}),!1,!1);if(n>=1&&(s=s.replace(/^([├└]─)/gm,`\u2502
$1`).replace(/^│\n/,"")),n>=2)for(let a=0;a<2;++a)s=s.replace(/^([│ ].{2}[├│ ].{2}[^\n]+\n)(([│ ]).{2}[├└].{2}[^\n]*\n[│ ].{2}[│ ].{2}[├└]─)/gm,`$1$3 \u2502
$2`).replace(/^│\n/,"");if(n>=3)throw new Error("Only the first two levels are accepted by treeUtils.emitTree");t.write(s)}var fZ=J("crypto"),PN=Pe(J("fs"));var VNe=8,Rt=class{constructor(e,{configuration:t,immutable:i=t.get("enableImmutableCache"),check:n=!1}){this.markedFiles=new Set;this.mutexes=new Map;this.cacheId=`-${(0,fZ.randomBytes)(8).toString("hex")}.tmp`;this.configuration=t,this.cwd=e,this.immutable=i,this.check=n;let s=t.get("cacheKeyOverride");if(s!==null)this.cacheKey=`${s}`;else{let o=t.get("compressionLevel"),a=o!==Jl?`c${o}`:"";this.cacheKey=[VNe,a].join("")}}static async find(e,{immutable:t,check:i}={}){let n=new Rt(e.get("cacheFolder"),{configuration:e,immutable:t,check:i});return await n.setup(),n}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`${bf(e)}-${this.cacheKey}.zip`}getChecksumFilename(e,t){let n=XNe(t).slice(0,10);return`${bf(e)}-${n}.zip`}getLocatorPath(e,t,i={}){var s;return this.mirrorCwd===null||((s=i.unstablePackages)==null?void 0:s.has(e.locatorHash))?x.resolve(this.cwd,this.getVersionFilename(e)):t===null||xN(t)!==this.cacheKey?null:x.resolve(this.cwd,this.getChecksumFilename(e,t))}getLocatorMirrorPath(e){let t=this.mirrorCwd;return t!==null?x.resolve(t,this.getVersionFilename(e)):null}async setup(){if(!this.configuration.get("enableGlobalCache"))if(this.immutable){if(!await M.existsPromise(this.cwd))throw new at(56,"Cache path does not exist.")}else{await M.mkdirPromise(this.cwd,{recursive:!0});let e=x.resolve(this.cwd,".gitignore");await M.changeFilePromise(e,`/.gitignore
*.flock
*.tmp
`)}(this.mirrorCwd||!this.immutable)&&await M.mkdirPromise(this.mirrorCwd||this.cwd,{recursive:!0})}async fetchPackageFromCache(e,t,{onHit:i,onMiss:n,loader:s,...o}){var W;let a=this.getLocatorMirrorPath(e),l=new $t,c=()=>{let _=new Wr(null,{libzip:D}),A=x.join(Oe.root,qD(e));return _.mkdirSync(A,{recursive:!0}),_.writeJsonSync(x.join(A,xt.manifest),{name:Ot(e),mocked:!0}),_},u=async(_,A=null)=>{var ge;if(A===null&&((ge=o.unstablePackages)==null?void 0:ge.has(e.locatorHash)))return{isValid:!0,hash:null};let ae=!o.skipIntegrityCheck||!t?`${this.cacheKey}/${await Iw(_)}`:t;if(A!==null){let re=!o.skipIntegrityCheck||!t?`${this.cacheKey}/${await Iw(A)}`:t;if(ae!==re)throw new at(18,"The remote archive doesn't match the local checksum - has the local cache been corrupted?")}if(t!==null&&ae!==t){let re;switch(this.check?re="throw":xN(t)!==xN(ae)?re="update":re=this.configuration.get("checksumBehavior"),re){case"ignore":return{isValid:!0,hash:t};case"update":return{isValid:!0,hash:ae};case"reset":return{isValid:!1,hash:t};default:case"throw":throw new at(18,"The remote archive doesn't match the expected checksum")}}return{isValid:!0,hash:ae}},g=async _=>{if(!s)throw new Error(`Cache check required but no loader configured for ${mt(this.configuration,e)}`);let A=await s(),ae=A.getRealPath();A.saveAndClose(),await M.chmodPromise(ae,420);let ge=await u(_,ae);if(!ge.isValid)throw new Error("Assertion failed: Expected a valid checksum");return ge.hash},f=async()=>{if(a===null||!await M.existsPromise(a)){let _=await s(),A=_.getRealPath();return _.saveAndClose(),{source:"loader",path:A}}return{source:"mirror",path:a}},h=async()=>{if(!s)throw new Error(`Cache entry required but missing for ${mt(this.configuration,e)}`);if(this.immutable)throw new at(56,`Cache entry required but missing for ${mt(this.configuration,e)}`);let{path:_,source:A}=await f(),ae=(await u(_)).hash,ge=this.getLocatorPath(e,ae,o);if(!ge)throw new Error("Assertion failed: Expected the cache path to be available");let re=[];A!=="mirror"&&a!==null&&re.push(async()=>{let F=`${a}${this.cacheId}`;await M.copyFilePromise(_,F,PN.default.constants.COPYFILE_FICLONE),await M.chmodPromise(F,420),await M.renamePromise(F,a)}),(!o.mirrorWriteOnly||a===null)&&re.push(async()=>{let F=`${ge}${this.cacheId}`;await M.copyFilePromise(_,F,PN.default.constants.COPYFILE_FICLONE),await M.chmodPromise(F,420),await M.renamePromise(F,ge)});let O=o.mirrorWriteOnly&&a!=null?a:ge;return await Promise.all(re.map(F=>F())),[!1,O,ae]},p=async()=>{let A=(async()=>{var ue;let ae=this.getLocatorPath(e,t,o),ge=ae!==null?await l.existsPromise(ae):!1,re=!!((ue=o.mockedPackages)!=null&&ue.has(e.locatorHash))&&(!this.check||!ge),O=re||ge,F=O?i:n;if(F&&F(),O){let he=null,ke=ae;if(!re)if(this.check)he=await g(ke);else{let Fe=await u(ke);if(Fe.isValid)he=Fe.hash;else return h()}return[re,ke,he]}else return h()})();this.mutexes.set(e.locatorHash,A);try{return await A}finally{this.mutexes.delete(e.locatorHash)}};for(let _;_=this.mutexes.get(e.locatorHash);)await _;let[C,y,B]=await p();this.markedFiles.add(y);let v,D=await sn(),L=C?()=>c():()=>new Wr(y,{baseFs:l,libzip:D,readOnly:!0}),H=new Bg(()=>Jx(()=>v=L(),_=>`Failed to open the cache entry for ${mt(this.configuration,e)}: ${_}`),x),j=new bo(y,{baseFs:H,pathUtils:x}),$=()=>{v==null||v.discardAndClose()},V=(W=o.unstablePackages)!=null&&W.has(e.locatorHash)?null:B;return[j,$,V]}};function xN(r){let e=r.indexOf("/");return e!==-1?r.slice(0,e):null}function XNe(r){let e=r.indexOf("/");return e!==-1?r.slice(e+1):r}var F0=(t=>(t[t.SCRIPT=0]="SCRIPT",t[t.SHELLCODE=1]="SHELLCODE",t))(F0||{});var ra=class extends vi{constructor({configuration:t,stdout:i,suggestInstall:n=!0}){super();this.errorCount=0;zd(this,{configuration:t}),this.configuration=t,this.stdout=i,this.suggestInstall=n}static async start(t,i){let n=new this(t);try{await i(n)}catch(s){n.reportExceptionOnce(s)}finally{await n.finalize()}return n}hasErrors(){return this.errorCount>0}exitCode(){return this.hasErrors()?1:0}reportCacheHit(t){}reportCacheMiss(t){}startSectionSync(t,i){return i()}async startSectionPromise(t,i){return await i()}startTimerSync(t,i,n){return(typeof i=="function"?i:n)()}async startTimerPromise(t,i,n){return await(typeof i=="function"?i:n)()}async startCacheReport(t){return await t()}reportSeparator(){}reportInfo(t,i){}reportWarning(t,i){}reportError(t,i){this.errorCount+=1,this.stdout.write(`${$e(this.configuration,"\u27A4","redBright")} ${this.formatNameWithHyperlink(t)}: ${i}
`)}reportProgress(t){return{...Promise.resolve().then(async()=>{for await(let{}of t);}),stop:()=>{}}}reportJson(t){}async finalize(){this.errorCount>0&&(this.stdout.write(`
`),this.stdout.write(`${$e(this.configuration,"\u27A4","redBright")} Errors happened when preparing the environment required to run this command.
`),this.suggestInstall&&this.stdout.write(`${$e(this.configuration,"\u27A4","redBright")} This might be caused by packages being missing from the lockfile, in which case running "yarn install" might help.
`))}formatNameWithHyperlink(t){return qR(t,{configuration:this.configuration,json:!1})}};var J0=J("crypto");function tA(){}tA.prototype={diff:function(e,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=i.callback;typeof i=="function"&&(n=i,i={}),this.options=i;var s=this;function o(C){return n?(setTimeout(function(){n(void 0,C)},0),!0):C}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var a=t.length,l=e.length,c=1,u=a+l;i.maxEditLength&&(u=Math.min(u,i.maxEditLength));var g=[{newPos:-1,components:[]}],f=this.extractCommon(g[0],t,e,0);if(g[0].newPos+1>=a&&f+1>=l)return o([{value:this.join(t),count:t.length}]);function h(){for(var C=-1*c;C<=c;C+=2){var y=void 0,B=g[C-1],v=g[C+1],D=(v?v.newPos:0)-C;B&&(g[C-1]=void 0);var L=B&&B.newPos+1<a,H=v&&0<=D&&D<l;if(!L&&!H){g[C]=void 0;continue}if(!L||H&&B.newPos<v.newPos?(y=_Ne(v),s.pushComponent(y.components,void 0,!0)):(y=B,y.newPos++,s.pushComponent(y.components,!0,void 0)),D=s.extractCommon(y,t,e,C),y.newPos+1>=a&&D+1>=l)return o(ZNe(s,y.components,t,e,s.useLongestToken));g[C]=y}c++}if(n)(function C(){setTimeout(function(){if(c>u)return n();h()||C()},0)})();else for(;c<=u;){var p=h();if(p)return p}},pushComponent:function(e,t,i){var n=e[e.length-1];n&&n.added===t&&n.removed===i?e[e.length-1]={count:n.count+1,added:t,removed:i}:e.push({count:1,added:t,removed:i})},extractCommon:function(e,t,i,n){for(var s=t.length,o=i.length,a=e.newPos,l=a-n,c=0;a+1<s&&l+1<o&&this.equals(t[a+1],i[l+1]);)a++,l++,c++;return c&&e.components.push({count:c}),e.newPos=a,l},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],i=0;i<e.length;i++)e[i]&&t.push(e[i]);return t},castInput:function(e){return e},tokenize:function(e){return e.split("")},join:function(e){return e.join("")}};function ZNe(r,e,t,i,n){for(var s=0,o=e.length,a=0,l=0;s<o;s++){var c=e[s];if(c.removed){if(c.value=r.join(i.slice(l,l+c.count)),l+=c.count,s&&e[s-1].added){var g=e[s-1];e[s-1]=e[s],e[s]=g}}else{if(!c.added&&n){var u=t.slice(a,a+c.count);u=u.map(function(h,p){var C=i[l+p];return C.length>h.length?C:h}),c.value=r.join(u)}else c.value=r.join(t.slice(a,a+c.count));a+=c.count,c.added||(l+=c.count)}}var f=e[o-1];return o>1&&typeof f.value=="string"&&(f.added||f.removed)&&r.equals("",f.value)&&(e[o-2].value+=f.value,e.pop()),e}function _Ne(r){return{newPos:r.newPos,components:r.components.slice(0)}}var Pat=new tA;var hZ=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,pZ=/\S/,dZ=new tA;dZ.equals=function(r,e){return this.options.ignoreCase&&(r=r.toLowerCase(),e=e.toLowerCase()),r===e||this.options.ignoreWhitespace&&!pZ.test(r)&&!pZ.test(e)};dZ.tokenize=function(r){for(var e=r.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),t=0;t<e.length-1;t++)!e[t+1]&&e[t+2]&&hZ.test(e[t])&&hZ.test(e[t+2])&&(e[t]+=e[t+2],e.splice(t+1,2),t--);return e};var NN=new tA;NN.tokenize=function(r){var e=[],t=r.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(var i=0;i<t.length;i++){var n=t[i];i%2&&!this.options.newlineIsToken?e[e.length-1]+=n:(this.options.ignoreWhitespace&&(n=n.trim()),e.push(n))}return e};function $Ne(r,e,t){return NN.diff(r,e,t)}var eLe=new tA;eLe.tokenize=function(r){return r.split(/(\S.+?[.!?])(?=\s+|$)/)};var tLe=new tA;tLe.tokenize=function(r){return r.split(/([{}:;,]|\s+)/)};function N0(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?N0=function(e){return typeof e}:N0=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},N0(r)}function DN(r){return rLe(r)||iLe(r)||nLe(r)||sLe()}function rLe(r){if(Array.isArray(r))return kN(r)}function iLe(r){if(typeof Symbol<"u"&&Symbol.iterator in Object(r))return Array.from(r)}function nLe(r,e){if(!!r){if(typeof r=="string")return kN(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return kN(r,e)}}function kN(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=r[t];return i}function sLe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var oLe=Object.prototype.toString,VC=new tA;VC.useLongestToken=!0;VC.tokenize=NN.tokenize;VC.castInput=function(r){var e=this.options,t=e.undefinedReplacement,i=e.stringifyReplacer,n=i===void 0?function(s,o){return typeof o>"u"?t:o}:i;return typeof r=="string"?r:JSON.stringify(RN(r,null,null,n),n," ")};VC.equals=function(r,e){return tA.prototype.equals.call(VC,r.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};function RN(r,e,t,i,n){e=e||[],t=t||[],i&&(r=i(n,r));var s;for(s=0;s<e.length;s+=1)if(e[s]===r)return t[s];var o;if(oLe.call(r)==="[object Array]"){for(e.push(r),o=new Array(r.length),t.push(o),s=0;s<r.length;s+=1)o[s]=RN(r[s],e,t,i,n);return e.pop(),t.pop(),o}if(r&&r.toJSON&&(r=r.toJSON()),N0(r)==="object"&&r!==null){e.push(r),o={},t.push(o);var a=[],l;for(l in r)r.hasOwnProperty(l)&&a.push(l);for(a.sort(),s=0;s<a.length;s+=1)l=a[s],o[l]=RN(r[l],e,t,i,l);e.pop(),t.pop()}else o=r;return o}var FN=new tA;FN.tokenize=function(r){return r.slice()};FN.join=FN.removeEmpty=function(r){return r};function CZ(r,e,t,i,n,s,o){o||(o={}),typeof o.context>"u"&&(o.context=4);var a=$Ne(t,i,o);if(!a)return;a.push({value:"",lines:[]});function l(B){return B.map(function(v){return" "+v})}for(var c=[],u=0,g=0,f=[],h=1,p=1,C=function(v){var D=a[v],L=D.lines||D.value.replace(/\n$/,"").split(`
`);if(D.lines=L,D.added||D.removed){var H;if(!u){var j=a[v-1];u=h,g=p,j&&(f=o.context>0?l(j.lines.slice(-o.context)):[],u-=f.length,g-=f.length)}(H=f).push.apply(H,DN(L.map(function(re){return(D.added?"+":"-")+re}))),D.added?p+=L.length:h+=L.length}else{if(u)if(L.length<=o.context*2&&v<a.length-2){var $;($=f).push.apply($,DN(l(L)))}else{var V,W=Math.min(L.length,o.context);(V=f).push.apply(V,DN(l(L.slice(0,W))));var _={oldStart:u,oldLines:h-u+W,newStart:g,newLines:p-g+W,lines:f};if(v>=a.length-2&&L.length<=o.context){var A=/\n$/.test(t),ae=/\n$/.test(i),ge=L.length==0&&f.length>_.oldLines;!A&&ge&&t.length>0&&f.splice(_.oldLines,0,"\\ No newline at end of file"),(!A&&!ge||!ae)&&f.push("\\ No newline at end of file")}c.push(_),u=0,g=0,f=[]}h+=L.length,p+=L.length}},y=0;y<a.length;y++)C(y);return{oldFileName:r,newFileName:e,oldHeader:n,newHeader:s,hunks:c}}var W0=Pe(B$()),x$=Pe(Yg()),P$=Pe(Xr()),JN=J("util"),qN=Pe(J("v8")),WN=Pe(J("zlib"));var NMe=[[/^(git(?:\+(?:https|ssh))?:\/\/.*(?:\.git)?)#(.*)$/,(r,e,t,i)=>`${t}#commit=${i}`],[/^https:\/\/((?:[^/]+?)@)?codeload\.github\.com\/([^/]+\/[^/]+)\/tar\.gz\/([0-9a-f]+)$/,(r,e,t="",i,n)=>`https://${t}github.com/${i}.git#commit=${n}`],[/^https:\/\/((?:[^/]+?)@)?github\.com\/([^/]+\/[^/]+?)(?:\.git)?#([0-9a-f]+)$/,(r,e,t="",i,n)=>`https://${t}github.com/${i}.git#commit=${n}`],[/^https?:\/\/[^/]+\/(?:[^/]+\/)*(?:@.+(?:\/|(?:%2f)))?([^/]+)\/(?:-|download)\/\1-[^/]+\.tgz(?:#|$)/,r=>`npm:${r}`],[/^https:\/\/npm\.pkg\.github\.com\/download\/(?:@[^/]+)\/(?:[^/]+)\/(?:[^/]+)\/(?:[0-9a-f]+)(?:#|$)/,r=>`npm:${r}`],[/^https:\/\/npm\.fontawesome\.com\/(?:@[^/]+)\/([^/]+)\/-\/([^/]+)\/\1-\2.tgz(?:#|$)/,r=>`npm:${r}`],[/^https?:\/\/[^/]+\/.*\/(@[^/]+)\/([^/]+)\/-\/\1\/\2-(?:[.\d\w-]+)\.tgz(?:#|$)/,(r,e)=>Qw({protocol:"npm:",source:null,selector:r,params:{__archiveUrl:e}})],[/^[^/]+\.tgz#[0-9a-f]+$/,r=>`npm:${r}`]],Y0=class{constructor(e){this.resolver=e;this.resolutions=null}async setup(e,{report:t}){let i=x.join(e.cwd,e.configuration.get("lockfileFilename"));if(!M.existsSync(i))return;let n=await M.readFilePromise(i,"utf8"),s=yi(n);if(Object.prototype.hasOwnProperty.call(s,"__metadata"))return;let o=this.resolutions=new Map;for(let a of Object.keys(s)){let l=sC(a);if(!l){t.reportWarning(14,`Failed to parse the string "${a}" into a proper descriptor`);continue}let c=io(l.range)?_t(l,`npm:${l.range}`):l,{version:u,resolved:g}=s[a];if(!g)continue;let f;for(let[p,C]of NMe){let y=g.match(p);if(y){f=C(u,...y);break}}if(!f){t.reportWarning(14,`${tr(e.configuration,c)}: Only some patterns can be imported from legacy lockfiles (not "${g}")`);continue}let h=c;try{let p=Qf(c.range),C=sC(p.selector,!0);C&&(h=C)}catch{}o.set(c.descriptorHash,tn(h,f))}}supportsDescriptor(e,t){return this.resolutions?this.resolutions.has(e.descriptorHash):!1}supportsLocator(e,t){return!1}shouldPersistResolution(e,t){throw new Error("Assertion failed: This resolver doesn't support resolving locators to packages")}bindDescriptor(e,t,i){return e}getResolutionDependencies(e,t){return[]}async getCandidates(e,t,i){if(!this.resolutions)throw new Error("Assertion failed: The resolution store should have been setup");let n=this.resolutions.get(e.descriptorHash);if(!n)throw new Error("Assertion failed: The resolution should have been registered");return await this.resolver.getCandidates(HD(n),t,i)}async getSatisfying(e,t,i){return null}async resolve(e,t){throw new Error("Assertion failed: This resolver doesn't support resolving locators to packages")}};var j0=class{constructor(e){this.resolver=e}supportsDescriptor(e,t){return!!(t.project.storedResolutions.get(e.descriptorHash)||t.project.originalPackages.has(ww(e).locatorHash))}supportsLocator(e,t){return!!(t.project.originalPackages.has(e.locatorHash)&&!t.project.lockfileNeedsRefresh)}shouldPersistResolution(e,t){throw new Error("The shouldPersistResolution method shouldn't be called on the lockfile resolver, which would always answer yes")}bindDescriptor(e,t,i){return e}getResolutionDependencies(e,t){return this.resolver.getResolutionDependencies(e,t)}async getCandidates(e,t,i){let n=i.project.originalPackages.get(ww(e).locatorHash);if(n)return[n];let s=i.project.storedResolutions.get(e.descriptorHash);if(!s)throw new Error("Expected the resolution to have been successful - resolution not found");if(n=i.project.originalPackages.get(s),!n)throw new Error("Expected the resolution to have been successful - package not found");return[n]}async getSatisfying(e,t,i){return null}async resolve(e,t){let i=t.project.originalPackages.get(e.locatorHash);if(!i)throw new Error("The lockfile resolver isn't meant to resolve packages - they should already have been stored into a cache");return i}};var q0=class{constructor(e){this.resolver=e}supportsDescriptor(e,t){return this.resolver.supportsDescriptor(e,t)}supportsLocator(e,t){return this.resolver.supportsLocator(e,t)}shouldPersistResolution(e,t){return this.resolver.shouldPersistResolution(e,t)}bindDescriptor(e,t,i){return this.re Line truncated
`;await M.changeFilePromise(t,i,{automaticNewlines:!0}),this.manifest.raw=e}};var b$=6,LMe=1,TMe=/ *, */g,S$=/\/$/,OMe=32,MMe=(0,JN.promisify)(WN.default.gzip),KMe=(0,JN.promisify)(WN.default.gunzip),$n=(t=>(t.UpdateLockfile="update-lockfile",t.SkipBuild="skip-build",t))($n||{}),jN={restoreInstallersCustomData:["installersCustomData"],restoreResolutions:["accessibleLocators","conditionalLocators","disabledLocators","optionalBuilds","storedDescriptors","storedResolutions","storedPackages","lockFileChecksum"],restoreBuildState:["storedBuildState"]},v$=r=>en(`${LMe}`,r),je=class{constructor(e,{configuration:t}){this.resolutionAliases=new Map;this.workspaces=[];this.workspacesByCwd=new Map;this.workspacesByIdent=new Map;this.storedResolutions=new Map;this.storedDescriptors=new Map;this.storedPackages=new Map;this.storedChecksums=new Map;this.storedBuildState=new Map;this.accessibleLocators=new Set;this.conditionalLocators=new Set;this.disabledLocators=new Set;this.originalPackages=new Map;this.optionalBuilds=new Set;this.lockfileNeedsRefresh=!1;this.peerRequirements=new Map;this.installersCustomData=new Map;this.lockFileChecksum=null;this.installStateChecksum=null;this.configuration=t,this.cwd=e}static async find(e,t){var p,C,y;if(!e.projectCwd)throw new be(`No project found in ${t}`);let i=e.projectCwd,n=t,s=null;for(;s!==e.projectCwd;){if(s=n,M.existsSync(x.join(s,xt.manifest))){i=s;break}n=x.dirname(s)}let o=new je(e.projectCwd,{configuration:e});(p=ye.telemetry)==null||p.reportProject(o.cwd),await o.setupResolutions(),await o.setupWorkspaces(),(C=ye.telemetry)==null||C.reportWorkspaceCount(o.workspaces.length),(y=ye.telemetry)==null||y.reportDependencyCount(o.workspaces.reduce((B,v)=>B+v.manifest.dependencies.size+v.manifest.devDependencies.size,0));let a=o.tryWorkspaceByCwd(i);if(a)return{project:o,workspace:a,locator:a.anchoredLocator};let l=await o.findLocatorForLocation(`${i}/`,{strict:!0});if(l)return{project:o,locator:l,workspace:null};let c=$e(e,o.cwd,Ue.PATH),u=$e(e,x.relative(o.cwd,i),Ue.PATH),g=`- If ${c} isn't intended to be a project, remove any yarn.lock and/or package.json file there.`,f=`- If ${c} is intended to be a project, it might be that you forgot to list ${u} in its workspace configuration.`,h=`- Finally, if ${c} is fine and you intend ${u} to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.`;throw new be(`The nearest package directory (${$e(e,i,Ue.PATH)}) doesn't seem to be part of the project declared in ${$e(e,o.cwd,Ue.PATH)}.
${[g,f,h].join(`
`)}`)}async setupResolutions(){var i;this.storedResolutions=new Map,this.storedDescriptors=new Map,this.storedPackages=new Map,this.lockFileChecksum=null;let e=x.join(this.cwd,this.configuration.get("lockfileFilename")),t=this.configuration.get("defaultLanguageName");if(M.existsSync(e)){let n=await M.readFilePromise(e,"utf8");this.lockFileChecksum=v$(n);let s=yi(n);if(s.__metadata){let o=s.__metadata.version,a=s.__metadata.cacheKey;this.lockfileNeedsRefresh=o<b$;for(let l of Object.keys(s)){if(l==="__metadata")continue;let c=s[l];if(typeof c.resolution>"u")throw new Error(`Assertion failed: Expected the lockfile entry to have a resolution field (${l})`);let u=Sc(c.resolution,!0),g=new ot;g.load(c,{yamlCompatibilityMode:!0});let f=g.version,h=g.languageName||t,p=c.linkType.toUpperCase(),C=(i=c.conditions)!=null?i:null,y=g.dependencies,B=g.peerDependencies,v=g.dependenciesMeta,D=g.peerDependenciesMeta,L=g.bin;if(c.checksum!=null){let j=typeof a<"u"&&!c.checksum.includes("/")?`${a}/${c.checksum}`:c.checksum;this.storedChecksums.set(u.locatorHash,j)}let H={...u,version:f,languageName:h,linkType:p,conditions:C,dependencies:y,peerDependencies:B,dependenciesMeta:v,peerDependenciesMeta:D,bin:L};this.originalPackages.set(H.locatorHash,H);for(let j of l.split(TMe)){let $=JA(j);this.storedDescriptors.set($.descriptorHash,$),this.storedResolutions.set($.descriptorHash,u.locatorHash)}}}}}async setupWorkspaces(){this.workspaces=[],this.workspacesByCwd=new Map,this.workspacesByIdent=new Map;let e=[this.cwd];for(;e.length>0;){let t=e;e=[];for(let i of t){if(this.workspacesByCwd.has(i))continue;let n=await this.addWorkspace(i),s=this.storedPackages.get(n.anchoredLocator.locatorHash);s&&(n.dependencies=s.dependencies);for(let o of n.workspacesCwds)e.push(o)}}}async addWorkspace(e){let t=new wh(e,{project:this});await t.setup();let i=this.workspacesByIdent.get(t.locator.identHash);if(typeof i<"u")throw new Error(`Duplicate workspace name ${Ai(this.configuration,t.locator)}: ${K.fromPortablePath(e)} conflicts with ${K.fromPortablePath(i.cwd)}`);return this.workspaces.push(t),this.workspacesByCwd.set(e,t),this.workspacesByIdent.set(t.locator.identHash,t),t}get topLevelWorkspace(){return this.getWorkspaceByCwd(this.cwd)}tryWorkspaceByCwd(e){x.isAbsolute(e)||(e=x.resolve(this.cwd,e)),e=x.normalize(e).replace(/\/+$/,"");let t=this.workspacesByCwd.get(e);return t||null}getWorkspaceByCwd(e){let t=this.tryWorkspaceByCwd(e);if(!t)throw new Error(`Workspace not found (${e})`);return t}tryWorkspaceByFilePath(e){let t=null;for(let i of this.workspaces)x.relative(i.cwd,e).startsWith("../")||t&&t.cwd.length>=i.cwd.length||(t=i);return t||null}getWorkspaceByFilePath(e){let t=this.tryWorkspaceByFilePath(e);if(!t)throw new Error(`Workspace not found (${e})`);return t}tryWorkspaceByIdent(e){let t=this.workspacesByIdent.get(e.identHash);return typeof t>"u"?null:t}getWorkspaceByIdent(e){let t=this.tryWorkspaceByIdent(e);if(!t)throw new Error(`Workspace not found (${Ai(this.configuration,e)})`);return t}tryWorkspaceByDescriptor(e){let t=this.tryWorkspaceByIdent(e);return t===null||(qA(e)&&(e=tC(e)),!t.accepts(e.range))?null:t}getWorkspaceByDescriptor(e){let t=this.tryWorkspaceByDescriptor(e);if(t===null)throw new Error(`Workspace not found (${tr(this.configuration,e)})`);return t}tryWorkspaceByLocator(e){let t=this.tryWorkspaceByIdent(e);return t===null||(jo(e)&&(e=rC(e)),t.locator.locatorHash!==e.locatorHash&&t.anchoredLocator.locatorHash!==e.locatorHash)?null:t}getWorkspaceByLocator(e){let t=this.tryWorkspaceByLocator(e);if(!t)throw new Error(`Workspace not found (${mt(this.configuration,e)})`);return t}refreshWorkspaceDependencies(){for(let e of this.workspaces){let t=this.storedPackages.get(e.anchoredLocator.locatorHash);if(!t)throw new Error(`Assertion failed: Expected workspace ${aC(this.configuration,e)} (${$e(this.configuration,x.join(e.cwd,xt.manifest),Ue.PATH)}) to have been resolved. Run "yarn install" to update the lockfile`);e.dependencies=new Map(t.dependencies)}}forgetResolution(e){let t=n=>{this.storedResolutions.delete(n),this.storedDescriptors.delete(n)},i=n=>{this.originalPackages.delete(n),this.storedPackages.delete(n),this.accessibleLocators.delete(n)};if("descriptorHash"in e){let n=this.storedResolutions.get(e.descriptorHash);t(e.descriptorHash);let s=new Set(this.storedResolutions.values());typeof n<"u"&&!s.has(n)&&i(n)}if("locatorHash"in e){i(e.locatorHash);for(let[n,s]of this.storedResolutions)s===e.locatorHash&&t(n)}}forgetTransientResolutions(){let e=this.configuration.makeResolver();for(let t of this.originalPackages.values()){let i;try{i=e.shouldPersistResolution(t,{project:this,resolver:e})}catch{i=!1}i||this.forgetResolution(t)}}forgetVirtualResolutions(){for(let e of this.storedPackages.values())for(let[t,i]of e.dependencies)qA(i)&&e.dependencies.set(t,tC(i))}getDependencyMeta(e,t){let i={},s=this.topLevelWorkspace.manifest.dependenciesMeta.get(Ot(e));if(!s)return i;let o=s.get(null);if(o&&Object.assign(i,o),t===nLine truncated
`;switch(le){case 0:fe+=`# Script name: ${we}
`;break;case 1:fe+=`# Script code: ${we}
`;break}let Ae=null;if(!await M.mktempPromise(async ne=>{let Y=x.join(ne,"build.log"),{stdout:pe,stderr:ie}=this.configuration.getSubprocessStreams(Y,{header:fe,prefix:mt(this.configuration,he),report:t}),de;try{switch(le){case 0:de=await kB(he,we,[],{cwd:oe,project:this,stdin:Ae,stdout:pe,stderr:ie});break;case 1:de=await JR(he,we,[],{cwd:oe,project:this,stdin:Ae,stdout:pe,stderr:ie});break}}catch(Pt){ie.write(Pt.stack),de=1}if(pe.end(),ie.end(),de===0)return!0;M.detachTemp(ne);let _e=`${mt(this.configuration,he)} couldn't be built successfully (exit code ${$e(this.configuration,de,Ue.NUMBER)}, logs can be found here: ${$e(this.configuration,Y,Ue.PATH)})`;return this.optionalBuilds.has(he.locatorHash)?(t.reportInfo(9,_e),!0):(t.reportError(9,_e),!1)}))return!1}return!0});F.push(...Ne,Promise.allSettled(Ne).then(oe=>{D.delete(ue),oe.every(le=>le.status==="fulfilled"&&le.value===!0)&&W.set(he.locatorHash,Fe)}))}if(await to(F),O===D.size){let ue=Array.from(D).map(he=>{let ke=this.storedPackages.get(he);if(!ke)throw new Error("Assertion failed: The package should have been registered");return mt(this.configuration,ke)}).join(", ");t.reportError(3,`Some packages have circular dependencies that make their build order unsatisfiable - as a result they won't be built (affected packages are: ${ue})`);break}}this.storedBuildState=W}async install(e){var a,l;let t=this.configuration.get("nodeLinker");(a=ye.telemetry)==null||a.reportInstall(t),await e.report.startTimerPromise("Project validation",{skipIfEmpty:!0},async()=>{await this.configuration.triggerHook(c=>c.validateProject,this,{reportWarning:e.report.reportWarning.bind(e.report),reportError:e.report.reportError.bind(e.report)})});for(let c of this.configuration.packageExtensions.values())for(let[,u]of c)for(let g of u)g.status="inactive";let i=x.join(this.cwd,this.configuration.get("lockfileFilename")),n=null;if(e.immutable)try{n=await M.readFilePromise(i,"utf8")}catch(c){throw c.code==="ENOENT"?new at(28,"The lockfile would have been created by this install, which is explicitly forbidden."):c}await e.report.startTimerPromise("Resolution step",async()=>{await this.resolveEverything(e)}),await e.report.startTimerPromise("Post-resolution validation",{skipIfEmpty:!0},async()=>{for(let[,c]of this.configuration.packageExtensions)for(let[,u]of c)for(let g of u)if(g.userProvided){let f=$e(this.configuration,g,Ue.PACKAGE_EXTENSION);switch(g.status){case"inactive":e.report.reportWarning(68,`${f}: No matching package in the dependency tree; you may not need this rule anymore.`);break;case"redundant":e.report.reportWarning(69,`${f}: This rule seems redundant when applied on the original package; the extension may have been applied upstream.`);break}}if(n!==null){let c=ql(n,this.generateLockfile());if(c!==n){let u=CZ(i,i,n,c,void 0,void 0,{maxEditLength:100});if(u){e.report.reportSeparator();for(let g of u.hunks){e.report.reportInfo(null,`@@ -${g.oldStart},${g.oldLines} +${g.newStart},${g.newLines} @@`);for(let f of g.lines)f.startsWith("+")?e.report.reportError(28,$e(this.configuration,f,Ue.ADDED)):f.startsWith("-")?e.report.reportError(28,$e(this.configuration,f,Ue.REMOVED)):e.report.reportInfo(null,$e(this.configuration,f,"grey"))}e.report.reportSeparator()}throw new at(28,"The lockfile would have been modified by this install, which is explicitly forbidden.")}}});for(let c of this.configuration.packageExtensions.values())for(let[,u]of c)for(let g of u)g.userProvided&&g.status==="active"&&((l=ye.telemetry)==null||l.reportPackageExtension(Ec(g,Ue.PACKAGE_EXTENSION)));await e.report.startTimerPromise("Fetch step",async()=>{await this.fetchEverything(e),(typeof e.persistProject>"u"||e.persistProject)&&e.mode!=="update-lockfile"&&await this.cacheCleanup(e)});let s=e.immutable?[...new Set(this.configuration.get("immutablePatterns"))].sort():[],o=await Promise.all(s.map(async c=>yw(c,{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 ${$e(this.configuration,"mode=update-lockfile",Ue.CODE)}`);return}await this.linkEverything(e);let c=await Promise.all(s.map(async u=>yw(u,{cwd:this.cwd})));for(let u=0;u<s.length;++u)o[u]!==c[u]&&e.report.reportError(64,`The checksum for ${s[u]} has been modified by this install, which is explicitly forbidden.`)}),await this.persistInstallStateFile(),await this.configuration.triggerHook(c=>c.afterAllInstalled,this,e)}generateLockfile(){let e=new Map;for(let[n,s]of this.storedResolutions.entries()){let o=e.get(s);o||e.set(s,o=new Set),o.add(n)}let t={};t.__metadata={version:b$,cacheKey:void 0};for(let[n,s]of e.entries()){let o=this.originalPackages.get(n);if(!o)continue;let a=[];for(let f of s){let h=this.storedDescriptors.get(f);if(!h)throw new Error("Assertion failed: The descriptor should have been registered");a.push(h)}let l=a.map(f=>Qn(f)).sort().join(", "),c=new ot;c.version=o. Line truncated
`,`# Manual changes might be lost - proceed with caution!
`].join("")}
`+wa(t)}async persistLockfile(){let e=x.join(this.cwd,this.configuration.get("lockfileFilename")),t="";try{t=await M.readFilePromise(e,"utf8")}catch{}let i=this.generateLockfile(),n=ql(t,i);n!==t&&(await M.writeFilePromise(e,n),this.lockFileChecksum=v$(n),this.lockfileNeedsRefresh=!1)}async persistInstallStateFile(){let e=[];for(let o of Object.values(jN))e.push(...o);let t=(0,W0.default)(this,e),i=qN.default.serialize(t),n=en(i);if(this.installStateChecksum===n)return;let s=this.configuration.get("installStatePath");await M.mkdirPromise(x.dirname(s),{recursive:!0}),await M.writeFilePromise(s,await MMe(i)),this.installStateChecksum=n}async restoreInstallState({restoreInstallersCustomData:e=!0,restoreResolutions:t=!0,restoreBuildState:i=!0}={}){let n=this.configuration.get("installStatePath"),s;try{let o=await KMe(await M.readFilePromise(n));s=qN.default.deserialize(o),this.installStateChecksum=en(o)}catch{t&&await this.applyLightResolution();return}e&&typeof s.installersCustomData<"u"&&(this.installersCustomData=s.installersCustomData),i&&Object.assign(this,(0,W0.default)(s,jN.restoreBuildState)),t&&(s.lockFileChecksum===this.lockFileChecksum?(Object.assign(this,(0,W0.default)(s,jN.restoreResolutions)),this.refreshWorkspaceDependencies()):await this.applyLightResolution())}async applyLightResolution(){await this.resolveEverything({lockfileOnly:!0,report:new ti}),await this.persistInstallStateFile()}async persist(){await this.persistLockfile();for(let e of this.workspacesByCwd.values())await e.persistManifest()}async cacheCleanup({cache:e,report:t}){if(this.configuration.get("enableGlobalCache"))return;let i=new Set([".gitignore"]);if(!ZD(e.cwd,this.cwd)||!await M.existsPromise(e.cwd))return;let n=this.configuration.get("preferAggregateCacheInfo"),s=0,o=null;for(let a of await M.readdirPromise(e.cwd)){if(i.has(a))continue;let l=x.resolve(e.cwd,a);e.markedFiles.has(l)||(o=a,e.immutable?t.reportError(56,`${$e(this.configuration,x.basename(l),"magenta")} appears to be unused and would be marked for deletion, but the cache is immutable`):(n?s+=1:t.reportInfo(19,`${$e(this.configuration,x.basename(l),"magenta")} appears to be unused - removing`),await M.removePromise(l)))}n&&s!==0&&t.reportInfo(19,s>1?`${s} packages appeared to be unused and were removed`:`${o} appeared to be unused and was removed`),e.markedFiles.clear()}};function UMe({project:r,allDescriptors:e,allResolutions:t,allPackages:i,accessibleLocators:n=new Set,optionalBuilds:s=new Set,peerRequirements:o=new Map,volatileDescriptors:a=new Set,report:l}){var V;let c=new Map,u=[],g=new Map,f=new Map,h=new Map,p=new Map,C=new Map,y=new Map(r.workspaces.map(W=>{let _=W.anchoredLocator.locatorHash,A=i.get(_);if(typeof A>"u")throw new Error("Assertion failed: The workspace should have an associated package");return[_,eC(A)]})),B=()=>{let W=M.mktempSync(),_=x.join(W,"stacktrace.log"),A=String(u.length+1).length,ae=u.map((ge,re)=>`${`${re+1}.`.padStart(A," ")} ${Cs(ge)}
`).join("");throw M.writeFileSync(_,ae),M.detachTemp(W),new at(45,`Encountered a stack overflow when resolving peer dependencies; cf ${K.fromPortablePath(_)}`)},v=W=>{let _=t.get(W.descriptorHash);if(typeof _>"u")throw new Error("Assertion failed: The resolution should have been registered");let A=i.get(_);if(!A)throw new Error("Assertion failed: The package could not be found");return A},D=(W,_,A,{top:ae,optional:ge})=>{u.length>1e3&&B(),u.push(_);let re=L(W,_,A,{top:ae,optional:ge});return u.pop(),re},L=(W,_,A,{top:ae,optional:ge})=>{if(n.has(_.locatorHash))return;n.add(_.locatorHash),ge||s.delete(_.locatorHash);let re=i.get(_.locatorHash);if(!re)throw new Error(`Assertion failed: The package (${mt(r.configuration,_)}) should have been registered`);let O=[],F=[],ue=[],he=[],ke=[];for(let Ne of Array.from(re.dependencies.values())){if(re.peerDependencies.has(Ne.identHash)&&re.locatorHash!==ae)continue;if(qA(Ne))throw new Error("Assertion failed: Virtual packages shouldn't be encountered when virtualizing a branch");a.delete(Ne.descriptorHash);let oe=ge;if(!oe){let Y=re.dependenciesMeta.get(Ot(Ne));if(typeof Y<"u"){let pe=Y.get(null);typeof pe<"u"&&pe.optional&&(oe=!0)}}let le=t.get(Ne.descriptorHash);if(!le)throw new Error(`Assertion failed: The resolution (${tr(r.configuration,Ne)}) should have been registered`);let we=y.get(le)||i.get(le);if(!we)throw new Error(`Assertion failed: The package (${le}, resolved from ${tr(r.configuration,Ne)}) should have been registered`);if(we.peerDependencies.size===0){D(Ne,we,new Map,{top:ae,optional:oe});continue}let fe,Ae,qe=new Set,ne;F.push(()=>{fe=GD(Ne,_.locatorHash),Ae=YD(we,_.locatorHash),re.dependencies.delete(Ne.identHash),re.dependencies.set(fe.identHash,fe),t.set(fe.descriptorHash,Ae.locatorHash),e.set(fe.descriptorHash,fe),i.set(Ae.locatorHash,Ae),O.push([we,fe,Ae])}),ue.push(()=>{var Y;ne=new Map;for(let pe of Ae.peerDependencies.values()){let ie=re.dependencies.get(pe.identHash);if(!ie&&iC(_,pe)&&(W.identHash===_.identHash?ie=W:(ie=_t(_,W.range),e.set(ie.descriptorHash,ie),t.set(ie.descriptorHash,_.locatorHash),a.delete(ie.descriptorHash))),(!ie||ie.range==="missing:")&&Ae.dependencies.has(pe.identHash)){Ae.peerDependencies.delete(pe.identHash);continue}ie||(ie=_t(pe,"missing:")),Ae.dependencies.set(ie.identHash,ie),qA(ie)&&mc(h,ie.descriptorHash).add(Ae.locatorHash),g.set(ie.identHash,ie),ie.range==="missing:"&&qe.add(ie.identHash),ne.set(pe.identHash,(Y=A.get(pe.identHash))!=null?Y:Ae.locatorHash)}Ae.dependencies=new Map(wn(Ae.dependencies,([pe,ie])=>Ot(ie)))}),he.push(()=>{if(!i.has(Ae.locatorHash))return;let Y=c.get(we.locatorHash);typeof Y=="number"&&Y>=2&&B();let pe=c.get(we.locatorHash),ie=typeof pe<"u"?pe+1:1;c.set(we.locatorHash,ie),D(fe,Ae,ne,{top:ae,optional:oe}),c.set(we.locatorHash,ie-1)}),ke.push(()=>{let Y=re.dependencies.get(Ne.identHash);if(typeof Y>"u")throw new Error("Assertion failed: Expected the peer dependency to have been turned into a dependency");let pe=t.get(Y.descriptorHash);if(typeof pe>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");if(mc(C,pe).add(_.locatorHash),!!i.has(Ae.locatorHash)){for(let ie of Ae.peerDependencies.values()){let de=ne.get(ie.identHash);if(typeof de>"u")throw new Error("Assertion failed: Expected the peer dependency ident to be registered");uf(gf(p,de),Ot(ie)).push(Ae.locatorHash)}for(let ie of qe)Ae.dependencies.delete(ie)}})}for(let Ne of[...F,...ue])Ne();let Fe;do{Fe=!0;for(let[Ne,oe,le]of O){let we=gf(f,Ne.locatorHash),fe=en(...[...le.dependencies.values()].map(Y=>{let pe=Y.range!=="missing:"?t.get(Y.descriptorHash):"missing:";if(typeof pe>"u")throw new Error(`Assertion failed: Expected the resolution for ${tr(r.configuration,Y)} to have been registered`);return pe===ae?`${pe} (top)`:pe}),oe.identHash),Ae=we.get(fe);if(typeof Ae>"u"){we.set(fe,oe);continue}if(Ae===oe)continue;i.delete(le.locatorHash),e.delete(oe.descriptorHash),t.delete(oe.descriptorHash),n.delete(le.locatorHash);let qe=h.get(oe.descriptorHash)||[],ne=[re.locatorHash,...qe];h.delete(oe.descriptorHash);for(let Y of ne){let pe=i.get(Y);typeof pe>"u"||(pe.dependencies.get(oe.identHash).descriptorHash!==Ae.descriptorHash&&(Fe=!1),pe.dependencies.set(oe.identHash,Ae))}}}while(!Fe);for(let Ne of[...he,...ke])Ne()};for(let W of r.workspaces){let _=W.anchoredLocator;a.delete(W.anchoredDescriptor.descriptorHash),D(W.anchoredDescriptor,_,new Map,{top:_.locatorHash,optional:!1})}let H;(A=>(A[A.NotProvided=0]="NotProvided",A[A.NotCompatible=1]="NotCompatible"))(H||(H={}));let j=[];for(let[W,_]of C){let A=i.get(W);if(typeof A>"u")throw new Error("Assertion failed: Expected the root to be registered");let ae=p.get(W);if(!(typeof ae>"u"))for(let ge of _){let re=i.get(ge);if(!(typeof re>"u"))for(let[O,F]of ae){let ue=$i(O);if(re.peerDependencies.has(ue.identHash))continue;let he=`p${en(ge,O,W).slice(0,5)}`;o.set(he,{subject:ge,requested:ue,rootRequester:W,allRequesters:F});let ke=A.dependencies.get(ue.identHash);if( Line truncated
Try running the command again with the package name prefixed: ${ee.pretty(t,"yarn add",xi.CODE)} ${ee.pretty(t,P.makeDescriptor(P.makeIdent(null,"my-package"),`${D[0]}...`),xi.DESCRIPTOR)}`);if(!v)throw new be(`The ${ee.pretty(t,B,xi.CODE)} string didn't match the required format (package-name@range). Did you perhaps forget to explicitly reference the package name?`);let L=pqe(n,v,{dev:this.dev,peer:this.peer,preferDev:this.preferDev,optional:this.optional});return await Promise.all(L.map(async j=>{let $=await Um(v,{project:i,workspace:n,cache:s,target:j,modifier:a,strategies:l,maxResults:c});return{request:v,suggestedDescriptors:$,target:j}}))})).then(B=>B.flat()),g=await ra.start({configuration:t,stdout:this.context.stdout,suggestInstall:!1},async B=>{for(let{request:v,suggestedDescriptors:{suggestions:D,rejections:L}}of u)if(D.filter(j=>j.descriptor!==null).length===0){let[j]=L;if(typeof j>"u")throw new Error("Assertion failed: Expected an error to have been set");i.configuration.get("enableNetwork")?B.reportError(27,`${P.prettyDescriptor(t,v)} can't be resolved to a satisfying range`):B.reportError(27,`${P.prettyDescriptor(t,v)} can't be resolved to a satisfying range (note: network resolution has been disabled)`),B.reportSeparator(),B.reportExceptionOnce(j)}});if(g.hasErrors())return g.exitCode();let f=!1,h=[],p=[];for(let{suggestedDescriptors:{suggestions:B},target:v}of u){let D,L=B.filter(V=>V.descriptor!==null),H=L[0].descriptor,j=L.every(V=>P.areDescriptorsEqual(V.descriptor,H));L.length===1||j?D=H:(f=!0,{answer:D}=await(0,Rse.prompt)({type:"select",name:"answer",message:"Which range do you want to use?",choices:B.map(({descriptor:V,name:W,reason:_})=>V?{name:W,hint:_,descriptor:V}:{name:W,hint:_,disabled:!0}),onCancel:()=>process.exit(130),result(V){return this.find(V,"descriptor")},stdin:this.context.stdin,stdout:this.context.stdout}));let $=n.manifest[v].get(D.identHash);(typeof $>"u"||$.descriptorHash!==D.descriptorHash)&&(n.manifest[v].set(D.identHash,D),this.optional&&(v==="dependencies"?n.manifest.ensureDependencyMeta({...D,range:"unknown"}).optional=!0:v==="peerDependencies"&&(n.manifest.ensurePeerDependencyMeta({...D,range:"unknown"}).optional=!0)),typeof $>"u"?h.push([n,v,D,l]):p.push([n,v,$,D]))}return await t.triggerMultipleHooks(B=>B.afterWorkspaceDependencyAddition,h),await t.triggerMultipleHooks(B=>B.afterWorkspaceDependencyReplacement,p),f&&this.context.stdout.write(`
`),(await Ge.start({configuration:t,json:this.json,stdout:this.context.stdout,includeLogs:!this.context.quiet},async B=>{await i.install({cache:s,report:B,mode:this.mode})})).exitCode()}};nu.paths=[["add"]],nu.usage=ve.Usage({description:"add dependencies to the project",details:"\n This command adds a package to the package.json for the nearest workspace.\n\n - If it didn't exist before, the package will by default be added to the regular `dependencies` field, but this behavior can be overriden thanks to the `-D,--dev` flag (which will cause the dependency to be added to the `devDependencies` field instead) and the `-P,--peer` flag (which will do the same but for `peerDependencies`).\n\n - If the package was already listed in your dependencies, it will by default be upgraded whether it's part of your `dependencies` or `devDependencies` (it won't ever update `peerDependencies`, though).\n\n - If set, the `--prefer-dev` flag will operate as a more flexible `-D,--dev` in that it will add the package to your `devDependencies` if it isn't already listed in either `dependencies` or `devDependencies`, but it will also happily upgrade your `dependencies` if that's what you already use (whereas `-D,--dev` would throw an exception).\n\n - If set, the `-O,--optional` flag will add the package to the `optionalDependencies` field and, in combination with the `-P,--peer` flag, it will add the package as an optional peer dependency. If the package was already listed in your `dependencies`, it will be upgraded to `optionalDependencies`. If the package was already listed in your `peerDependencies`, in combination with the `-P,--peer` flag, it will be upgraded to an optional peer dependency: `\"peerDependenciesMeta\": { \"<package>\": { \"optional\": true } }`\n\n - If the added package doesn't specify a range at all its `latest` tag will be resolved and the returned version will be used to generate a new semver range (using the `^` modifier by default unless otherwise configured via the `defaultSemverRangePrefix` configuration, or the `~` modifier if `-T,--tilde` is specified, or no modifier at all if `-E,--exact` is specified). Two exceptions to this rule: the first one is that if the package is a workspace then its local version will be used, and the second one is that if you use `-P,--peer` the default range will be `*` and won't be resolved at all.\n\n - If the added package specifies a range (such as `^1.0.0`, `latest`, or `rc`), Yarn will add this range as-is in the resulting package.json entry (in particular, tags such as `rc` will be encoded as-is rather than being converted into a semver range).\n\n If the `--cached` option is used, Yarn will preferably reuse the highest version already used somewhere within the project, even if through a transitive dependency.\n\n If the `-i,--interactive` option is used (or if the `preferInteractive` settings is toggled on) the command will first try to check whether other workspaces in the project use the specified package and, if so, will offer to reuse them.\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 For a compilation of all the supported protocols, please consult the dedicated page from our website: https://yarnpkg.com/features/protocols.\n ",examples:[["Add a regular package to the current workspace","$0 add lodash"],["Add a specific version for a package to the current workspace","$0 add lodash@1.2.3"],["Add a package from a GitHub repository (the master branch) to the current workspace using a URL","$0 add lodash@https://github.com/lodash/lodash"],["Add a package from a GitHub repository (the master branch) to the current workspace using the GitHub protocol","$0 add lodash@github:lodash/lodash"],["Add a package from a GitHub repository (the master branch) to the current workspace using the GitHub protocol (shorthand)","$0 add lodash@lodash/lodash"],["Add a package from a specific branch of a GitHub repository to the current workspace using the GitHub protocol (shorthand)","$0 add lodash-es@lodash/lodash#es"]]});function pqe(r,e,{dev:t,peer:i,preferDev:n,optional:s}){let o=r.manifest["dependencies"].has(e.identHash),a=r.manifest["devDependencies"].has(e.identHash),l=r.manifest["peerDependencies"Line truncated
`),0}return(await Ge.start({configuration:t,json:this.json,stdout:this.context.stdout},async o=>{let a=await Wt.getPackageAccessibleBinaries(n,{project:i}),c=Array.from(a.keys()).reduce((u,g)=>Math.max(u,g.length),0);for(let[u,[g,f]]of a)o.reportJson({name:u,source:P.stringifyIdent(g),path:f});if(this.verbose)for(let[u,[g]]of a)o.reportInfo(null,`${u.padEnd(c," ")} ${P.prettyLocator(t,g)}`);else for(let u of a.keys())o.reportInfo(null,u)})).exitCode()}};su.paths=[["bin"]],su.usage=ve.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"]]});var ou=class extends De{constructor(){super(...arguments);this.mirror=z.Boolean("--mirror",!1,{description:"Remove the global cache files instead of the local cache files"});this.all=z.Boolean("--all",!1,{description:"Remove both the global cache files and the local cache files of the current project"})}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),i=await Rt.find(t);return(await Ge.start({configuration:t,stdout:this.context.stdout},async()=>{let s=(this.all||this.mirror)&&i.mirrorCwd!==null,o=!this.mirror;s&&(await M.removePromise(i.mirrorCwd),await t.triggerHook(a=>a.cleanGlobalArtifacts,t)),o&&await M.removePromise(i.cwd)})).exitCode()}};ou.paths=[["cache","clean"],["cache","clear"]],ou.usage=ve.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"]]});var Fse=Pe(oQ()),GT=J("util"),au=class extends De{constructor(){super(...arguments);this.json=z.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.unsafe=z.Boolean("--no-redacted",!1,{description:"Don't redact secrets (such as tokens) from the output"});this.name=z.String()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),i=this.name.replace(/[.[].*$/,""),n=this.name.replace(/^[^.[]*/,"");if(typeof t.settings.get(i)>"u")throw new be(`Couldn't find a configuration settings named "${i}"`);let o=t.getSpecial(i,{hideSecrets:!this.unsafe,getNativePaths:!0}),a=Ie.convertMapsToIndexableObjects(o),l=n?(0,Fse.default)(a,n):a,c=await Ge.start({configuration:t,includeFooter:!1,json:this.json,stdout:this.context.stdout},async u=>{u.reportJson(l)});if(!this.json){if(typeof l=="string")return this.context.stdout.write(`${l}
`),c.exitCode();GT.inspect.styles.name="cyan",this.context.stdout.write(`${(0,GT.inspect)(l,{depth:1/0,colors:t.get("enableColors"),compact:!1})}
`)}return c.exitCode()}};au.paths=[["config","get"]],au.usage=ve.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"]]});var qoe=Pe(zT()),Joe=Pe(oQ()),Woe=Pe(joe()),VT=J("util"),Au=class extends De{constructor(){super(...arguments);this.json=z.Boolean("--json",!1,{description:"Set complex configuration settings to JSON values"});this.home=z.Boolean("-H,--home",!1,{description:"Update the home configuration instead of the project configuration"});this.name=z.String();this.value=z.String()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),i=()=>{if(!t.projectCwd)throw new be("This command must be run from within a project folder");return t.projectCwd},n=this.name.replace(/[.[].*$/,""),s=this.name.replace(/^[^.[]*\.?/,"");if(typeof t.settings.get(n)>"u")throw new be(`Couldn't find a configuration settings named "${n}"`);if(n==="enableStrictSettings")throw new be("This setting only affects the file it's in, and thus cannot be set from the CLI");let a=this.json?JSON.parse(this.value):this.value;await(this.home?p=>ye.updateHomeConfiguration(p):p=>ye.updateConfiguration(i(),p))(p=>{if(s){let C=(0,qoe.default)(p);return(0,Woe.default)(C,this.name,a),C}else return{...p,[n]:a}});let u=(await ye.find(this.context.cwd,this.context.plugins)).getSpecial(n,{hideSecrets:!0,getNativePaths:!0}),g=Ie.convertMapsToIndexableObjects(u),f=s?(0,Joe.default)(g,s):g;return(await Ge.start({configuration:t,includeFooter:!1,stdout:this.context.stdout},async p=>{VT.inspect.styles.name="cyan",p.reportInfo(0,`Successfully set ${this.name} to ${(0,VT.inspect)(f,{depth:1/0,colors:t.get("enableColors"),compact:!1})}`)})).exitCode()}};Au.paths=[["config","set"]],Au.usage=ve.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"`]]});var rae=Pe(zT()),iae=Pe(sm()),nae=Pe(tae()),lu=class extends De{constructor(){super(...arguments);this.home=z.Boolean("-H,--home",!1,{description:"Update the home configuration instead of the project configuration"});this.name=z.String()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),i=()=>{if(!t.projectCwd)throw new be("This command must be run from within a project folder");return t.projectCwd},n=this.name.replace(/[.[].*$/,""),s=this.name.replace(/^[^.[]*\.?/,"");if(typeof t.settings.get(n)>"u")throw new be(`Couldn't find a configuration settings named "${n}"`);let a=this.home?c=>ye.updateHomeConfiguration(c):c=>ye.updateConfiguration(i(),c);return(await Ge.start({configuration:t,includeFooter:!1,stdout:this.context.stdout},async c=>{let u=!1;await a(g=>{if(!(0,iae.default)(g,this.name))return c.reportWarning(0,`Configuration doesn't contain setting ${this.name}; there is nothing to unset`),u=!0,g;let f=s?(0,rae.default)(g):{...g};return(0,nae.default)(f,this.name),f}),u||c.reportInfo(0,`Successfully unset ${this.name}`)})).exitCode()}};lu.paths=[["config","unset"]],lu.usage=ve.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"]]});var XT=J("util"),cu=class extends De{constructor(){super(...arguments);this.verbose=z.Boolean("-v,--verbose",!1,{description:"Print the setting description on top of the regular key/value information"});this.why=z.Boolean("--why",!1,{description:"Print the reason why a setting is set a particular way"});this.json=z.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins,{strict:!1});return(await Ge.start({configuration:t,json:this.json,stdout:this.context.stdout},async n=>{if(t.invalid.size>0&&!this.json){for(let[s,o]of t.invalid)n.reportError(34,`Invalid configuration key "${s}" in ${o}`);n.reportSeparator()}if(this.json){let s=Ie.sortMap(t.settings.keys(),o=>o);for(let o of s){let a=t.settings.get(o),l=t.getSpecial(o,{hideSecrets:!0,getNativePaths:!0}),c=t.sources.get(o);this.verbose?n.reportJson({key:o,effective:l,source:c}):n.reportJson({key:o,effective:l,source:c,...a})}}else{let s=Ie.sortMap(t.settings.keys(),l=>l),o=s.reduce((l,c)=>Math.max(l,c.length),0),a={breakLength:1/0,colors:t.get("enableColors"),maxArrayLength:2};if(this.why||this.verbose){let l=s.map(u=>{let g=t.settings.get(u);if(!g)throw new Error(`Assertion failed: This settings ("${u}") should have been registered`);let f=this.why?t.sources.get(u)||"<default>":g.description;return[u,f]}),c=l.reduce((u,[,g])=>Math.max(u,g.length),0);for(let[u,g]of l)n.reportInfo(null,`${u.padEnd(o," ")} ${g.padEnd(c," ")} ${(0,XT.inspect)(t.getSpecial(u,{hideSecrets:!0,getNativePaths:!0}),a)}`)}else for(let l of s)n.reportInfo(null,`${l.padEnd(o," ")} ${(0,XT.inspect)(t.getSpecial(l,{hideSecrets:!0,getNativePaths:!0}),a)}`)}})).exitCode()}};cu.paths=[["config"]],cu.usage=ve.Usage({description:"display the current configuration",details:`
This command prints the current active configuration settings.
`,examples:[["Print the active configuration settings","$0 config"]]});as();var PQ={};ut(PQ,{Strategy:()=>Gm,acceptedStrategies:()=>m4e,dedupe:()=>ZT});var sae=Pe(yn()),Gm=(e=>(e.HIGHEST="highest",e))(Gm||{}),m4e=new Set(Object.values(Gm)),E4e={highest:async(r,e,{resolver:t,fetcher:i,resolveOptions:n,fetchOptions:s})=>{let o=new Map;for(let[a,l]of r.storedResolutions){let c=r.storedDescriptors.get(a);if(typeof c>"u")throw new Error(`Assertion failed: The descriptor (${a}) should have been registered`);Ie.getSetWithDefault(o,c.identHash).add(l)}return Array.from(r.storedDescriptors.values(),async a=>{if(e.length&&!sae.default.isMatch(P.stringifyIdent(a),e))return null;let l=r.storedResolutions.get(a.descriptorHash);if(typeof l>"u")throw new Error(`Assertion failed: The resolution (${a.descriptorHash}) should have been registered`);let c=r.originalPackages.get(l);if(typeof c>"u"||!t.shouldPersistResolution(c,n))return null;let u=o.get(a.identHash);if(typeof u>"u")throw new Error(`Assertion failed: The resolutions (${a.identHash}) should have been registered`);if(u.size===1)return null;let g=[...u].map(y=>{let B=r.originalPackages.get(y);if(typeof B>"u")throw new Error(`Assertion failed: The package (${y}) should have been registered`);return B.reference}),f=await t.getSatisfying(a,g,n),h=f==null?void 0:f[0];if(typeof h>"u")return null;let p=h.locatorHash,C=r.originalPackages.get(p);if(typeof C>"u")throw new Error(`Assertion failed: The package (${p}) should have been registered`);return p===l?null:{descriptor:a,currentPackage:c,updatedPackage:C}})}};async function ZT(r,{strategy:e,patterns:t,cache:i,report:n}){let{configuration:s}=r,o=new ti,a=s.makeResolver(),l=s.makeFetcher(),c={cache:i,checksums:r.storedChecksums,fetcher:l,project:r,report:o,skipIntegrityCheck:!0,cacheOptions:{skipIntegrityCheck:!0}},u={project:r,resolver:a,report:o,fetchOptions:c};return await n.startTimerPromise("Deduplication step",async()=>{let g=E4e[e],f=await g(r,t,{resolver:a,resolveOptions:u,fetcher:l,fetchOptions:c}),h=vi.progressViaCounter(f.length);await n.reportProgress(h);let p=0;await Promise.all(f.map(B=>B.then(v=>{if(v===null)return;p++;let{descriptor:D,currentPackage:L,updatedPackage:H}=v;n.reportInfo(0,`${P.prettyDescriptor(s,D)} can be deduped from ${P.prettyLocator(s,L)} to ${P.prettyLocator(s,H)}`),n.reportJson({descriptor:P.stringifyDescriptor(D),currentResolution:P.stringifyLocator(L),updatedResolution:P.stringifyLocator(H)}),r.storedResolutions.set(D.descriptorHash,H.locatorHash)}).finally(()=>h.tick())));let C;switch(p){case 0:C="No packages";break;case 1:C="One package";break;default:C=`${p} packages`}let y=ee.pretty(s,e,ee.Type.CODE);return n.reportInfo(0,`${C} can be deduped using the ${y} strategy`),p})}var uu=class extends De{constructor(){super(...arguments);this.strategy=z.String("-s,--strategy","highest",{description:"The strategy to use when deduping dependencies",validator:Vi(Gm)});this.check=z.Boolean("-c,--check",!1,{description:"Exit with exit code 1 when duplicates are found, without persisting the dependency tree"});this.json=z.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.mode=z.String("--mode",{description:"Change what artifacts installs generate",validator:Vi($n)});this.patterns=z.Rest()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i}=await je.find(t,this.context.cwd),n=await Rt.find(t);await i.restoreInstallState({restoreResolutions:!1});let s=0,o=await Ge.start({configuration:t,includeFooter:!1,stdout:this.context.stdout,json:this.json},async a=>{s=await ZT(i,{strategy:this.strategy,patterns:this.patterns,cache:n,report:a})});return o.hasErrors()?o.exitCode():this.check?s?1:0:(await Ge.start({configuration:t,stdout:this.context.stdout,json:this.json},async l=>{await i.install({cache:n,report:l,mode:this.mode})})).exitCode()}};uu.paths=[["dedupe"]],uu.usage=ve.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 downgraded. It's also guaranteed that it never takes more than a single pass to dedupe the entire dependency tree.\n\n **Note:** Even though it never produces a wrong dependency tree, this command should be used with caution, as it modifies the dependency tree, which can sometimes cause problems when packages don't strictly follow semver recommendations. Because of this, it is recommended to also review the changes manually.\n\n If set, the `Line truncated
`)}};Jh.paths=[["--clipanion=definitions"]];var Wh=class extends De{async execute(){this.context.stdout.write(this.cli.usage(null))}};Wh.paths=[["help"],["--help"],["-h"]];var Ym=class extends De{constructor(){super(...arguments);this.leadingArgument=z.String();this.args=z.Proxy()}async execute(){if(this.leadingArgument.match(/[\\/]/)&&!P.tryParseIdent(this.leadingArgument)){let t=x.resolve(this.context.cwd,K.toPortablePath(this.leadingArgument));return await this.cli.run(this.args,{cwd:t})}else return await this.cli.run(["run",this.leadingArgument,...this.args])}};var zh=class extends De{async execute(){this.context.stdout.write(`${Lr||"<unknown>"}
`)}};zh.paths=[["-v"],["--version"]];var gu=class extends De{constructor(){super(...arguments);this.commandName=z.String();this.args=z.Proxy()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i,locator:n}=await je.find(t,this.context.cwd);return await i.restoreInstallState(),await Wt.executePackageShellcode(n,this.commandName,this.args,{cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,project:i})}};gu.paths=[["exec"]],gu.usage=ve.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"']]});as();var fu=class extends De{constructor(){super(...arguments);this.hash=z.String({required:!1,validator:nd(id(),[sd(/^p[0-9a-f]{5}$/)])})}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i}=await je.find(t,this.context.cwd);return await i.restoreInstallState({restoreResolutions:!1}),await i.applyLightResolution(),typeof this.hash<"u"?await y4e(this.hash,i,{stdout:this.context.stdout}):(await Ge.start({configuration:t,stdout:this.context.stdout,includeFooter:!1},async s=>{var a;let o=[([,l])=>P.stringifyLocator(i.storedPackages.get(l.subject)),([,l])=>P.stringifyIdent(l.requested)];for(let[l,c]of Ie.sortMap(i.peerRequirements,o)){let u=i.storedPackages.get(c.subject);if(typeof u>"u")throw new Error("Assertion failed: Expected the subject package to have been registered");let g=i.storedPackages.get(c.rootRequester);if(typeof g>"u")throw new Error("Assertion failed: Expected the root package to have been registered");let f=(a=u.dependencies.get(c.requested.identHash))!=null?a:null,h=ee.pretty(t,l,ee.Type.CODE),p=P.prettyLocator(t,u),C=P.prettyIdent(t,c.requested),y=P.prettyIdent(t,g),B=c.allRequesters.length-1,v=`descendant${B===1?"":"s"}`,D=B>0?` and ${B} ${v}`:"",L=f!==null?"provides":"doesn't provide";s.reportInfo(null,`${h} \u2192 ${p} ${L} ${C} to ${y}${D}`)}})).exitCode()}};fu.paths=[["explain","peer-requirements"]],fu.usage=ve.Usage({description:"explain a set of peer requirements",details:`
A set of peer requirements represents all peer requirements that a dependent must satisfy when providing a given peer request to a requester and its descendants.
When the hash argument is specified, this command prints a detailed explanation of all requirements of the set corresponding to the hash and whether they're satisfied or not.
When used without arguments, this command lists all sets of peer requirements and the corresponding hash that can be used to get detailed information about a given set.
**Note:** A hash is a six-letter p-prefixed code that can be obtained from peer dependency warnings or from the list of all peer requirements (\`yarn explain peer-requirements\`).
`,examples:[["Explain the corresponding set of peer requirements for a hash","$0 explain peer-requirements p1a4ed"],["List all sets of peer requirements","$0 explain peer-requirements"]]});async function y4e(r,e,t){let{configuration:i}=e,n=e.peerRequirements.get(r);if(typeof n>"u")throw new Error(`No peerDependency requirements found for hash: "${r}"`);return(await Ge.start({configuration:i,stdout:t.stdout,includeFooter:!1},async o=>{var B,v;let a=e.storedPackages.get(n.subject);if(typeof a>"u")throw new Error("Assertion failed: Expected the subject package to have been registered");let l=e.storedPackages.get(n.rootRequester);if(typeof l>"u")throw new Error("Assertion failed: Expected the root package to have been registered");let c=(B=a.dependencies.get(n.requested.identHash))!=null?B:null,u=c!==null?e.storedResolutions.get(c.descriptorHash):null;if(typeof u>"u")throw new Error("Assertion failed: Expected the resolution to have been registered");let g=u!==null?e.storedPackages.get(u):null;if(typeof g>"u")throw new Error("Assertion failed: Expected the provided package to have been registered");let f=[...n.allRequesters.values()].map(D=>{let L=e.storedPackages.get(D);if(typeof L>"u")throw new Error("Assertion failed: Expected the package to be registered");let H=P.devirtualizeLocator(L),j=e.storedPackages.get(H.locatorHash);if(typeof j>"u")throw new Error("Assertion failed: Expected the package to be registered");let $=j.peerDependencies.get(n.requested.identHash);if(typeof $>"u")throw new Error("Assertion failed: Expected the peer dependency to be registered");return{pkg:L,peerDependency:$}});if(g!==null){let D=f.every(({peerDependency:L})=>vt.satisfiesWithPrereleases(g.version,L.range));o.reportInfo(0,`${P.prettyLocator(i,a)} provides ${P.prettyLocator(i,g)} with version ${P.prettyReference(i,(v=g.version)!=null?v:"<missing>")}, which ${D?"satisfies":"doesn't satisfy"} the following requirements:`)}else o.reportInfo(0,`${P.prettyLocator(i,a)} doesn't provide ${P.prettyIdent(i,n.requested)}, breaking the following requirements:`);o.reportSeparator();let h=ee.mark(i),p=[];for(let{pkg:D,peerDependency:L}of Ie.sortMap(f,H=>P.stringifyLocator(H.pkg))){let j=(g!==null?vt.satisfiesWithPrereleases(g.version,L.range):!1)?h.Check:h.Cross;p.push({stringifiedLocator:P.stringifyLocator(D),prettyLocator:P.prettyLocator(i,D),prettyRange:P.prettyRange(i,L.range),mark:j})}let C=Math.max(...p.map(({stringifiedLocator:D})=>D.length)),y=Math.max(...p.map(({prettyRange:D})=>D.length));for(let{stringifiedLocator:D,prettyLocator:L,prettyRange:H,mark:j}of Ie.sortMap(p,({stringifiedLocator:$})=>$))o.reportInfo(null,`${L.padEnd(C+(L.length-D.length)," ")} \u2192 ${H.padEnd(y," ")} ${j}`);p.length>1&&(o.reportSeparator(),o.reportInfo(0,`Note: these requirements start with ${P.prettyLocator(e.configuration,l)}`))})).exitCode()}as();var aae=Pe(Xr()),hu=class extends De{constructor(){super(...arguments);this.onlyIfNeeded=z.Boolean("--only-if-needed",!1,{description:"Only lock the Yarn version if it isn't already locked"});this.version=z.String()}async execute(){var o;let t=await ye.find(this.context.cwd,this.context.plugins);if(this.onlyIfNeeded&&t.get("yarnPath")){let a=t.sources.get("yarnPath");if(!a)throw new Error("Assertion failed: Expected 'yarnPath' to have a source");let l=(o=t.projectCwd)!=null?o:t.startingCwd;if(x.contains(l,a))return 0}let i=()=>{if(typeof Lr>"u")throw new be("The --install flag can only be used without explicit version specifier from the Yarn CLI");return`file://${process.argv[1]}`},n;if(this.version==="self")n=i();else if(this.version==="latest"||this.version==="berry"||this.version==="stable")n=`https://repo.yarnpkg.com/${await jm(t,"stable")}/packages/yarnpkg-cli/bin/yarn.js`;else if(this.version==="canary")n=`https://repo.yarnpkg.com/${await jm(t,"canary")}/packages/yarnpkg-cli/bin/yarn.js`;else if(this.version==="classic")n="https://classic.yarnpkg.com/latest.js";else if(this.version.match(/^https?:/))n=this.version;else if(this.version.match(/^\.{0,2}[\\/]/)||K.isAbsolute(this.version))n=`file://${K.resolve(this.version)}`;else if(vt.satisfiesWithPrereleases(this.version,">=2.0.0"))n=`https://repo.yarnpkg.com/${this.version}/packages/yarnpkg-cli/bin/yarn.js`;else if(vt.satisfiesWithPrereleases(this.version,"^0.x || ^1.x"))n=`https://github.com/yarnpkg/yarn/releases/download/v${this.version}/yarn-${this.version}.js`;else if(vt.validRange(this.version))n=`https://repo.yarnpkg.com/${await w4e(t,this.version)}/packages/yarnpkg-cli/bin/yarn.js`;else throw new be(`Invalid version descriptor "${this.version}"`);return(await Ge.start({configuration:t,stdout:this.context.stdout,includeLogs:!this.context.quiet},async a=>{let l="file://",c;n.startsWith(l)?(a.reportInfo(0,`Downloading ${ee.pretty(t,n,xi.URL)}`),c=await M.readFilePromise(K.toPortablePath(n.slice(l.length)))):(a.reportInfo(0,`Retrieving ${ee.pretty(t,n,xi.PATH)}`),c=await Xt.get(n,{configuration:t})),await _T(t,null,c,{report:a})})).exitCode( Line truncated
${e}`)});let n=(h=r.projectCwd)!=null?h:r.startingCwd,s=x.resolve(n,".yarn/releases"),o=x.resolve(s,`yarn-${e}.cjs`),a=x.relative(r.startingCwd,o),l=x.relative(n,o);i.reportInfo(0,`Saving the new release in ${ee.pretty(r,a,"magenta")}`),await M.removePromise(x.dirname(o)),await M.mkdirPromise(x.dirname(o),{recursive:!0}),await M.writeFilePromise(o,t,{mode:493}),await ye.updateConfiguration(n,{yarnPath:l});let c=await ot.tryFind(n)||new ot;c.packageManager=`yarn@${e&&Ie.isTaggedYarnVersion(e)?e:await jm(r,"stable")}`;let u={};c.exportTo(u);let g=x.join(n,ot.fileName),f=`${JSON.stringify(u,null,c.indent)}
`;await M.changeFilePromise(g,f,{automaticNewlines:!0})}function Aae(r){return Ct[RI(r)]}var B4e=/## (?<code>YN[0-9]{4}) - `(?<name>[A-Z_]+)`\n\n(?<details>(?:.(?!##))+)/gs;async function Q4e(r){let t=`https://repo.yarnpkg.com/${Ie.isTaggedYarnVersion(Lr)?Lr:await jm(r,"canary")}/packages/gatsby/content/advanced/error-codes.md`,i=await Xt.get(t,{configuration:r});return new Map(Array.from(i.toString().matchAll(B4e),({groups:n})=>{if(!n)throw new Error("Assertion failed: Expected the match to have been successful");let s=Aae(n.code);if(n.name!==s)throw new Error(`Assertion failed: Invalid error code data: Expected "${n.name}" to be named "${s}"`);return[n.code,n.details]}))}var pu=class extends De{constructor(){super(...arguments);this.code=z.String({required:!1,validator:nd(id(),[sd(/^YN[0-9]{4}$/)])});this.json=z.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins);if(typeof this.code<"u"){let i=Aae(this.code),n=ee.pretty(t,i,ee.Type.CODE),s=this.cli.format().header(`${this.code} - ${n}`),a=(await Q4e(t)).get(this.code),l=typeof a<"u"?ee.jsonOrPretty(this.json,t,ee.tuple(ee.Type.MARKDOWN,{text:a,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}:
${ee.jsonOrPretty(this.json,t,ee.tuple(ee.Type.URL,"https://github.com/yarnpkg/berry/blob/master/packages/gatsby/content/advanced/error-codes.md"))}
`;this.json?this.context.stdout.write(`${JSON.stringify({code:this.code,name:i,details:l})}
`):this.context.stdout.write(`${s}
${l}
`)}else{let i={children:Ie.mapAndFilter(Object.entries(Ct),([n,s])=>Number.isNaN(Number(n))?Ie.mapAndFilter.skip:{label:RA(Number(n)),value:ee.tuple(ee.Type.CODE,s)})};_n.emitTree(i,{configuration:t,stdout:this.context.stdout,json:this.json})}}};pu.paths=[["explain"]],pu.usage=ve.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"]]});var lae=Pe(yn()),du=class extends De{constructor(){super(...arguments);this.all=z.Boolean("-A,--all",!1,{description:"Print versions of a package from the whole project"});this.recursive=z.Boolean("-R,--recursive",!1,{description:"Print information for all packages, including transitive dependencies"});this.extra=z.Array("-X,--extra",[],{description:"An array of requests of extra data provided by plugins"});this.cache=z.Boolean("--cache",!1,{description:"Print information about the cache entry of a package (path, size, checksum)"});this.dependents=z.Boolean("--dependents",!1,{description:"Print all dependents for each matching package"});this.manifest=z.Boolean("--manifest",!1,{description:"Print data obtained by looking at the package archive (license, homepage, ...)"});this.nameOnly=z.Boolean("--name-only",!1,{description:"Only print the name for the matching packages"});this.virtuals=z.Boolean("--virtuals",!1,{description:"Print each instance of the virtual packages"});this.json=z.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.patterns=z.Rest()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i,workspace:n}=await je.find(t,this.context.cwd),s=await Rt.find(t);if(!n&&!this.all)throw new ct(i.cwd,this.context.cwd);await i.restoreInstallState();let o=new Set(this.extra);this.cache&&o.add("cache"),this.dependents&&o.add("dependents"),this.manifest&&o.add("manifest");let a=(L,{recursive:H})=>{let j=L.anchoredLocator.locatorHash,$=new Map,V=[j];for(;V.length>0;){let W=V.shift();if($.has(W))continue;let _=i.storedPackages.get(W);if(typeof _>"u")throw new Error("Assertion failed: Expected the package to be registered");if($.set(W,_),P.isVirtualLocator(_)&&V.push(P.devirtualizeLocator(_).locatorHash),!(!H&&W!==j))for(let A of _.dependencies.values()){let ae=i.storedResolutions.get(A.descriptorHash);if(typeof ae>"u")throw new Error("Assertion failed: Expected the resolution to be registered");V.push(ae)}}return $.values()},l=({recursive:L})=>{let H=new Map;for(let j of i.workspaces)for(let $ of a(j,{recursive:L}))H.set($.locatorHash,$);return H.values()},c=({all:L,recursive:H})=>L&&H?i.storedPackages.values():L?l({recursive:H}):a(n,{recursive:H}),u=({all:L,recursive:H})=>{let j=c({all:L,recursive:H}),$=this.patterns.map(_=>{let A=P.parseLocator(_),ae=lae.default.makeRe(P.stringifyIdent(A)),ge=P.isVirtualLocator(A),re=ge?P.devirtualizeLocator(A):A;return O=>{let F=P.stringifyIdent(O);if(!ae.test(F))return!1;if(A.reference==="unknown")return!0;let ue=P.isVirtualLocator(O),he=ue?P.devirtualizeLocator(O):O;return!(ge&&ue&&A.reference!==O.reference||re.reference!==he.reference)}}),V=Ie.sortMap([...j],_=>P.stringifyLocator(_));return{selection:V.filter(_=>$.length===0||$.some(A=>A(_))),sortedLookup:V}},{selection:g,sortedLookup:f}=u({all:this.all,recursive:this.recursive});if(g.length===0)throw new be("No package matched your request");let h=new Map;if(this.dependents)for(let L of f)for(let H of L.dependencies.values()){let j=i.storedResolutions.get(H.descriptorHash);if(typeof j>"u")throw new Error("Assertion failed: Expected the resolution to be registered");Ie.getArrayWithDefault(h,j).push(L)}let p=new Map;for(let L of f){if(!P.isVirtualLocator(L))continue;let H=P.devirtualizeLocator(L);Ie.getArrayWithDefault(p,H.locatorHash).push(L)}let C={},y={children:C},B=t.makeFetcher(),v={project:i,fetcher:B,cache:s,checksums:i.storedChecksums,report:new ti,cacheOptions:{skipIntegrityCheck:!0},skipIntegrityCheck:!0},D=[async(L,H,j)=>{var W,_;if(!H.has("manifest"))return;let $=await B.fetch(L,v),V;try{V=await ot.find($.prefixPath,{baseFs:$.packageFs})}finally{(W=$.releaseFs)==null||W.call($)}j("Manifest",{License:ee.tuple(ee.Type.NO_HINT,V.license),Homepage:ee.tuple(ee.Type.URL,(_=V.raw.homepage)!=null?_:null)})},async(L,H,j)=>{var ae;if(!H.has("cache"))return;let $={mockedPackages:i.disabledLocators,unstablePackages:i.conditionalLocators},V=(ae=i.storedChecksums.get(L.locatorHash))!=null?ae:null,W=s.getLocatorPath(L,V,$),_;if(W!==null)try{_=M.statSync(W)}catch{}let A=typeof _<"u"?[_.size,ee.Type.SIZE]:void 0;j("Cache",{Checksum:ee.tuple(ee.Type.NO_HINT,V),Path:ee.tuple(ee.Type.PATH,W),Size:A})}];for(let L of g){let H=P.isVirtualLocator(L);if(!this.virtuals&&H)continue;let j={},$={value:[L,ee.Type.LOCATOR],children:j};if(C[P.stringifyLocator(L)]=$,this.nameOnly){delete $.children;continue}let V=p.get(L.locatorHash);typeof V<"u"&&(j.Instances={label:"Instances",value:ee.tuple(ee.Type.NUMBER,V.length)}),j.Version={label:"Version",value:ee.tuple(ee.Type.NO_HINT,L.version)};let W=(A,ae)=>{let ge={};if(j[A]=ge,Array.isArray(ae))ge.children=ae.map(re=>({value:re}));else{let re={};ge.children=re;for(let[O,F]of Object.entries(ae))typeof F>"u"||(re[O]={label:O,value:F})}};if(!H){for(let A of D)await A(L,o,W);await t.triggerHook(A=>A.fetchPackageInfo,L,o,W)}L.bin.size>0& Line truncated
This command sets up your project if needed. The installation is split into four different steps that each have their own characteristics:
- **Resolution:** First the package manager will resolve your dependencies. The exact way a dependency version is privileged over another isn't standardized outside of the regular semver guarantees. If a package doesn't resolve to what you would expect, check that all dependencies are correctly declared (also check our website for more information: ).
- **Fetch:** Then we download all the dependencies if needed, and make sure that they're all stored within our cache (check the value of \`cacheFolder\` in \`yarn config\` to see where the cache files are stored).
- **Link:** Then we send the dependency tree information to internal plugins tasked with writing them on the disk in some form (for example by generating the .pnp.cjs file you might know).
- **Build:** Once the dependency tree has been written on the disk, the package manager will now be free to run the build scripts for all packages that might need it, in a topological order compatible with the way they depend on one another. See https://yarnpkg.com/advanced/lifecycle-scripts for detail.
Note that running this command is not part of the recommended workflow. Yarn supports zero-installs, which means that as long as you store your cache and your .pnp.cjs file inside your repository, everything will work without requiring any install right after cloning your repository or switching branches.
If the \`--immutable\` option is set (defaults to true on CI), Yarn will abort with an error exit code if the lockfile was to be modified (other paths can be added using the \`immutablePatterns\` configuration setting). For backward compatibility we offer an alias under the name of \`--frozen-lockfile\`, but it will be removed in a later release.
If the \`--immutable-cache\` option is set, Yarn will abort with an error exit code if the cache folder was to be modified (either because files would be added, or because they'd be removed).
If the \`--check-cache\` option is set, Yarn will always refetch the packages and will ensure that their checksum matches what's 1/ described in the lockfile 2/ inside the existing cache files (if present). This is recommended as part of your CI workflow if you're both following the Zero-Installs model and accepting PRs from third-parties, as they'd otherwise have the ability to alter the checked-in packages before submitting them.
If the \`--inline-builds\` option is set, Yarn will verbosely print the output of the build steps of your dependencies (instead of writing them into individual files). This is likely useful mostly for debug purposes only when using Docker-like environments.
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.
`,examples:[["Install the project","$0 install"],["Validate a project when using Zero-Installs","$0 install --immutable --immutable-cache"],["Validate a project when using Zero-Installs (slightly safer if you accept external PRs)","$0 install --immutable --immutable-cache --check-cache"]]});var b4e="|||||||",S4e=">>>>>>>",v4e="=======",cae="<<<<<<<";async function x4e(r,e){if(!r.projectCwd)return!1;let t=x.join(r.projectCwd,r.get("lockfileFilename"));if(!await M.existsPromise(t))return!1;let i=await M.readFilePromise(t,"utf8");if(!i.includes(cae))return!1;if(e)throw new at(47,"Cannot autofix a lockfile when running an immutable install");let[n,s]=P4e(i),o,a;try{o=yi(n),a=yi(s)}catch{throw new at(46,"The individual variants of the lockfile failed to parse")}let l={...o,...a};for(let[c,u]of Object.entries(l))typeof u=="string"&&delete l[c];return await M.changeFilePromise(t,wa(l),{automaticNewlines:!0}),!0}function P4e(r){let e=[[],[]],t=r.split(/\r?\n/g),i=!1;for(;t.length>0;){let n=t.shift();if(typeof n>"u")throw new Error("Assertion failed: Some lines should remain");if(n.startsWith(cae)){for(;t.length>0;){let s=t.shift();if(typeof s>"u")throw new Error("Assertion failed: Some lines should remain");if(s===v4e){i=!1;break}else if(i||s.startsWith(b4e)){i=!0;continue}else e[0].push(s)}for(;t.length>0;){let s=t.shift();if(typeof s>"u")throw new Error("Assertion failed: Some lines should remain");if(s.startsWith(S4e))break;e[1].push(s)}}else e[0].push(n),e[1].push(n)}return[e[0].join(`
`),e[1].join(`
`)]}var mu=class extends De{constructor(){super(...arguments);this.all=z.Boolean("-A,--all",!1,{description:"Link all workspaces belonging to the target project to the current one"});this.private=z.Boolean("-p,--private",!1,{description:"Also link private workspaces belonging to the target project to the current one"});this.relative=z.Boolean("-r,--relative",!1,{description:"Link workspaces using relative paths instead of absolute paths"});this.destination=z.String()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i,workspace:n}=await je.find(t,this.context.cwd),s=await Rt.find(t);if(!n)throw new ct(i.cwd,this.context.cwd);await i.restoreInstallState({restoreResolutions:!1});let o=x.resolve(this.context.cwd,K.toPortablePath(this.destination)),a=await ye.find(o,this.context.plugins,{useRc:!1,strict:!1}),{project:l,workspace:c}=await je.find(a,o);if(i.cwd===l.cwd)throw new be("Invalid destination; Can't link the project to itself");if(!c)throw new ct(l.cwd,o);let u=i.topLevelWorkspace,g=[];if(this.all){for(let h of l.workspaces)h.manifest.name&&(!h.manifest.private||this.private)&&g.push(h);if(g.length===0)throw new be("No workspace found to be linked in the target project")}else{if(!c.manifest.name)throw new be("The target workspace doesn't have a name and thus cannot be linked");if(c.manifest.private&&!this.private)throw new be("The target workspace is marked private - use the --private flag to link it anyway");g.push(c)}for(let h of g){let p=P.stringifyIdent(h.locator),C=this.relative?x.relative(i.cwd,h.cwd):h.cwd;u.manifest.resolutions.push({pattern:{descriptor:{fullName:p}},reference:`portal:${C}`})}return(await Ge.start({configuration:t,stdout:this.context.stdout},async h=>{await i.install({cache:s,report:h})})).exitCode()}};mu.paths=[["link"]],mu.usage=ve.Usage({description:"connect the local project to another one",details:"\n This command will set a new `resolutions` field in the project-level manifest and point it to the workspace at the specified location (even if part of another project).\n ",examples:[["Register a remote workspace for use in the current project","$0 link ~/ts-loader"],["Register all workspaces from a remote project for use in the current project","$0 link ~/jest --all"]]});var Eu=class extends De{constructor(){super(...arguments);this.args=z.Proxy()}async execute(){return this.cli.run(["exec","node",...this.args])}};Eu.paths=[["node"]],Eu.usage=ve.Usage({description:"run node with the hook already setup",details:`
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"]]});var dae=J("os");var uae=J("os");var D4e="https://raw.githubusercontent.com/yarnpkg/berry/master/plugins.yml";async function yu(r){let e=await Xt.get(D4e,{configuration:r});return yi(e.toString())}var Iu=class extends De{constructor(){super(...arguments);this.json=z.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins);return(await Ge.start({configuration:t,json:this.json,stdout:this.context.stdout},async n=>{let s=await yu(t);for(let[o,{experimental:a,...l}]of Object.entries(s)){let c=o;a&&(c+=" [experimental]"),n.reportJson({name:o,experimental:a,...l}),n.reportInfo(null,c)}})).exitCode()}};Iu.paths=[["plugin","list"]],Iu.usage=ve.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"]]});var k4e=/^[0-9]+$/;function gae(r){return k4e.test(r)?`pull/${r}/head`:r}var R4e=({repository:r,branch:e},t)=>[["git","init",K.fromPortablePath(t)],["git","remote","add","origin",r],["git","fetch","origin","--depth=1",gae(e)],["git","reset","--hard","FETCH_HEAD"]],F4e=({branch:r})=>[["git","fetch","origin","--depth=1",gae(r),"--force"],["git","reset","--hard","FETCH_HEAD"],["git","clean","-dfx"]],N4e=({plugins:r,noMinify:e},t)=>[["yarn","build:cli",...new Array().concat(...r.map(i=>["--plugin",x.resolve(t,i)])),...e?["--no-minify"]:[],"|"]],wu=class extends De{constructor(){super(...arguments);this.installPath=z.String("--path",{description:"The path where the repository should be cloned to"});this.repository=z.String("--repository","https://github.com/yarnpkg/berry.git",{description:"The repository that should be cloned"});this.branch=z.String("--branch","master",{description:"The branch of the repository that should be cloned"});this.plugins=z.Array("--plugin",[],{description:"An array of additional plugins that should be included in the bundle"});this.noMinify=z.Boolean("--no-minify",!1,{description:"Build a bundle for development (debugging) - non-minified and non-mangled"});this.force=z.Boolean("-f,--force",!1,{description:"Always clone the repository instead of trying to fetch the latest commits"});this.skipPlugins=z.Boolean("--skip-plugins",!1,{description:"Skip updating the contrib plugins"})}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i}=await je.find(t,this.context.cwd),n=typeof this.installPath<"u"?x.resolve(this.context.cwd,K.toPortablePath(this.installPath)):x.resolve(K.toPortablePath((0,uae.tmpdir)()),"yarnpkg-sources",li.makeHash(this.repository).slice(0,6));return(await Ge.start({configuration:t,stdout:this.context.stdout},async o=>{await $T(this,{configuration:t,report:o,target:n}),o.reportSeparator(),o.reportInfo(0,"Building a fresh bundle"),o.reportSeparator(),await qm(N4e(this,n),{configuration:t,context:this.context,target:n}),o.reportSeparator();let a=x.resolve(n,"packages/yarnpkg-cli/bundles/yarn.js"),l=await M.readFilePromise(a);await _T(t,"sources",l,{report:o}),this.skipPlugins||await L4e(this,{project:i,report:o,target:n})})).exitCode()}};wu.paths=[["set","version","from","sources"]],wu.usage=ve.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 function qm(r,{configuration:e,context:t,target:i}){for(let[n,...s]of r){let o=s[s.length-1]==="|";if(o&&s.pop(),o)await Cr.pipevp(n,s,{cwd:i,stdin:t.stdin,stdout:t.stdout,stderr:t.stderr,strict:!0});else{t.stdout.write(`${ee.pretty(e,` $ ${[n,...s].join(" ")}`,"grey")}
`);try{await Cr.execvp(n,s,{cwd:i,strict:!0})}catch(a){throw t.stdout.write(a.stdout||a.stack),a}}}}async function $T(r,{configuration:e,report:t,target:i}){let n=!1;if(!r.force&&M.existsSync(x.join(i,".git"))){t.reportInfo(0,"Fetching the latest commits"),t.reportSeparator();try{await qm(F4e(r),{configuration:e,context:r.context,target:i}),n=!0}catch{t.reportSeparator(),t.reportWarning(0,"Repository update failed; we'll try to regenerate it")}}n||(t.reportInfo(0,"Cloning the remote repository"),t.reportSeparator(),await M.removePromise(i),await M.mkdirPromise(i,{recursive:!0}),await qm(R4e(r,i),{configuration:e,context:r.context,target:i}))}async function L4e(r,{project:e,report:t,target:i}){let n=await yu(e.configuration),s=new Set(Object.keys(n));for(let o of e.configuration.plugins.keys())!s.has(o)||await eO(o,r,{project:e,report:t,target:i})}var fae=Pe(Xr()),hae=J("url"),pae=J("vm");var Bu=class extends De{constructor(){super(...arguments);this.name=z.String()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins);return(await Ge.start({configuration:t,stdout:this.context.stdout},async n=>{let{project:s}=await je.find(t,this.context.cwd),o,a;if(this.name.match(/^\.{0,2}[\\/]/)||K.isAbsolute(this.name)){let l=x.resolve(this.context.cwd,K.toPortablePath(this.name));n.reportInfo(0,`Reading ${ee.pretty(t,l,ee.Type.PATH)}`),o=x.relative(s.cwd,l),a=await M.readFilePromise(l)}else{let l;if(this.name.match(/^https?:/)){try{new hae.URL(this.name)}catch{throw new at(52,`Plugin specifier "${this.name}" is neither a plugin name nor a valid url`)}o=this.name,l=this.name}else{let c=P.parseLocator(this.name.replace(/^((@yarnpkg\/)?plugin-)?/,"@yarnpkg/plugin-"));if(c.reference!=="unknown"&&!fae.default.valid(c.reference))throw new at(0,"Official plugins only accept strict version references. Use an explicit URL if you wish to download them from another location.");let u=P.stringifyIdent(c),g=await yu(t);if(!Object.prototype.hasOwnProperty.call(g,u))throw new at(51,`Couldn't find a plugin named "${u}" on the remote registry. Note that only the plugins referenced on our website (https://github.com/yarnpkg/berry/blob/master/plugins.yml) can be referenced by their name; any other plugin will have to be referenced through its public url (for example https://github.com/yarnpkg/berry/raw/master/packages/plugin-typescript/bin/%40yarnpkg/plugin-typescript.js).`);o=u,l=g[u].url,c.reference!=="unknown"?l=l.replace(/\/master\//,`/${u}/${c.reference}/`):Lr!==null&&(l=l.replace(/\/master\//,`/@yarnpkg/cli/${Lr}/`))}n.reportInfo(0,`Downloading ${ee.pretty(t,l,"green")}`),a=await Xt.get(l,{configuration:t})}await tO(o,a,{project:s,report:n})})).exitCode()}};Bu.paths=[["plugin","import"]],Bu.usage=ve.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.
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 function tO(r,e,{project:t,report:i}){let{configuration:n}=t,s={},o={exports:s};(0,pae.runInNewContext)(e.toString(),{module:o,exports:s});let a=o.exports.name,l=`.yarn/plugins/${a}.cjs`,c=x.resolve(t.cwd,l);i.reportInfo(0,`Saving the new plugin in ${ee.pretty(n,l,"magenta")}`),await M.mkdirPromise(x.dirname(c),{recursive:!0}),await M.writeFilePromise(c,e);let u={path:l,spec:r};await ye.updateConfiguration(t.cwd,g=>{let f=[],h=!1;for(let p of g.plugins||[]){let C=typeof p!="string"?p.path:p,y=x.resolve(t.cwd,K.toPortablePath(C)),{name:B}=Ie.dynamicRequire(y);B!==a?f.push(p):(f.push(u),h=!0)}return h||f.push(u),{...g,plugins:f}})}var T4e=({pluginName:r,noMinify:e},t)=>[["yarn",`build:${r}`,...e?["--no-minify"]:[],"|"]],Qu=class extends De{constructor(){super(...arguments);this.installPath=z.String("--path",{description:"The path where the repository should be cloned to"});this.repository=z.String("--repository","https://github.com/yarnpkg/berry.git",{description:"The repository that should be cloned"});this.branch=z.String("--branch","master",{description:"The branch of the repository that should be cloned"});this.noMinify=z.Boolean("--no-minify",!1,{description:"Build a plugin for development (debugging) - non-minified and non-mangled"});this.force=z.Boolean("-f,--force",!1,{description:"Always clone the repository instead of trying to fetch the latest commits"});this.name=z.String()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),i=typeof this.installPath<"u"?x.resolve(this.context.cwd,K.toPortablePath(this.installPath)):x.resolve(K.toPortablePath((0,dae.tmpdir)()),"yarnpkg-sources",li.makeHash(this.repository).slice(0,6));return(await Ge.start({configuration:t,stdout:this.context.stdout},async s=>{let{project:o}=await je.find(t,this.context.cwd),a=P.parseIdent(this.name.replace(/^((@yarnpkg\/)?plugin-)?/,"@yarnpkg/plugin-")),l=P.stringifyIdent(a),c=await yu(t);if(!Object.prototype.hasOwnProperty.call(c,l))throw new at(51,`Couldn't find a plugin named "${l}" 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 u=l;await $T(this,{configuration:t,report:s,target:i}),await eO(u,this,{project:o,report:s,target:i})})).exitCode()}};Qu.paths=[["plugin","import","from","sources"]],Qu.usage=ve.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 function eO(r,{context:e,noMinify:t},{project:i,report:n,target:s}){let o=r.replace(/@yarnpkg\//,""),{configuration:a}=i;n.reportSeparator(),n.reportInfo(0,`Building a fresh ${o}`),n.reportSeparator(),await qm(T4e({pluginName:o,noMinify:t},s),{configuration:a,context:e,target:s}),n.reportSeparator();let l=x.resolve(s,`packages/${o}/bundles/${r}.js`),c=await M.readFilePromise(l);await tO(r,c,{project:i,report:n})}var bu=class extends De{constructor(){super(...arguments);this.name=z.String()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i}=await je.find(t,this.context.cwd);return(await Ge.start({configuration:t,stdout:this.context.stdout},async s=>{let o=this.name,a=P.parseIdent(o);if(!t.plugins.has(o))throw new be(`${P.prettyIdent(t,a)} isn't referenced by the current configuration`);let l=`.yarn/plugins/${o}.cjs`,c=x.resolve(i.cwd,l);M.existsSync(c)&&(s.reportInfo(0,`Removing ${ee.pretty(t,l,ee.Type.PATH)}...`),await M.removePromise(c)),s.reportInfo(0,"Updating the configuration..."),await ye.updateConfiguration(i.cwd,u=>{if(!Array.isArray(u.plugins))return u;let g=u.plugins.filter(f=>f.path!==l);return u.plugins.length===g.length?u:{...u,plugins:g}})})).exitCode()}};bu.paths=[["plugin","remove"]],bu.usage=ve.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"]]});var Su=class extends De{constructor(){super(...arguments);this.json=z.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins);return(await Ge.start({configuration:t,json:this.json,stdout:this.context.stdout},async n=>{for(let s of t.plugins.keys()){let o=this.context.plugins.plugins.has(s),a=s;o&&(a+=" [builtin]"),n.reportJson({name:s,builtin:o}),n.reportInfo(null,`${a}`)}})).exitCode()}};Su.paths=[["plugin","runtime"]],Su.usage=ve.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"]]});var vu=class extends De{constructor(){super(...arguments);this.idents=z.Rest()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i,workspace:n}=await je.find(t,this.context.cwd),s=await Rt.find(t);if(!n)throw new ct(i.cwd,this.context.cwd);let o=new Set;for(let l of this.idents)o.add(P.parseIdent(l).identHash);if(await i.restoreInstallState({restoreResolutions:!1}),await i.resolveEverything({cache:s,report:new ti}),o.size>0)for(let l of i.storedPackages.values())o.has(l.identHash)&&i.storedBuildState.delete(l.locatorHash);else i.storedBuildState.clear();return(await Ge.start({configuration:t,stdout:this.context.stdout,includeLogs:!this.context.quiet},async l=>{await i.install({cache:s,report:l})})).exitCode()}};vu.paths=[["rebuild"]],vu.usage=ve.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"]]});var rO=Pe(yn());as();var xu=class extends De{constructor(){super(...arguments);this.all=z.Boolean("-A,--all",!1,{description:"Apply the operation to all workspaces from the current project"});this.mode=z.String("--mode",{description:"Change what artifacts installs generate",validator:Vi($n)});this.patterns=z.Rest()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i,workspace:n}=await je.find(t,this.context.cwd),s=await Rt.find(t);if(!n)throw new ct(i.cwd,this.context.cwd);await i.restoreInstallState({restoreResolutions:!1});let o=this.all?i.workspaces:[n],a=["dependencies","devDependencies","peerDependencies"],l=[],c=!1,u=[];for(let p of this.patterns){let C=!1,y=P.parseIdent(p);for(let B of o){let v=[...B.manifest.peerDependenciesMeta.keys()];for(let D of(0,rO.default)(v,p))B.manifest.peerDependenciesMeta.delete(D),c=!0,C=!0;for(let D of a){let L=B.manifest.getForScope(D),H=[...L.values()].map(j=>P.stringifyIdent(j));for(let j of(0,rO.default)(H,P.stringifyIdent(y))){let{identHash:$}=P.parseIdent(j),V=L.get($);if(typeof V>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");B.manifest[D].delete($),u.push([B,D,V]),c=!0,C=!0}}}C||l.push(p)}let g=l.length>1?"Patterns":"Pattern",f=l.length>1?"don't":"doesn't",h=this.all?"any":"this";if(l.length>0)throw new be(`${g} ${ee.prettyList(t,l,xi.CODE)} ${f} match any packages referenced by ${h} workspace`);return c?(await t.triggerMultipleHooks(C=>C.afterWorkspaceDependencyRemoval,u),(await Ge.start({configuration:t,stdout:this.context.stdout},async C=>{await i.install({cache:s,report:C,mode:this.mode})})).exitCode()):0}};xu.paths=[["remove"]],xu.usage=ve.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}'"]]});var Cae=J("util"),Vh=class extends De{async execute(){let e=await ye.find(this.context.cwd,this.context.plugins),{project:t,workspace:i}=await je.find(e,this.context.cwd);if(!i)throw new ct(t.cwd,this.context.cwd);return(await Ge.start({configuration:e,stdout:this.context.stdout},async s=>{let o=i.manifest.scripts,a=Ie.sortMap(o.keys(),u=>u),l={breakLength:1/0,colors:e.get("enableColors"),maxArrayLength:2},c=a.reduce((u,g)=>Math.max(u,g.length),0);for(let[u,g]of o.entries())s.reportInfo(null,`${u.padEnd(c," ")} ${(0,Cae.inspect)(g,l)}`)})).exitCode()}};Vh.paths=[["run"]];var Pu=class extends De{constructor(){super(...arguments);this.inspect=z.String("--inspect",!1,{tolerateBoolean:!0,description:"Forwarded to the underlying Node process when executing a binary"});this.inspectBrk=z.String("--inspect-brk",!1,{tolerateBoolean:!0,description:"Forwarded to the underlying Node process when executing a binary"});this.topLevel=z.Boolean("-T,--top-level",!1,{description:"Check the root workspace for scripts and/or binaries instead of the current one"});this.binariesOnly=z.Boolean("-B,--binaries-only",!1,{description:"Ignore any user defined scripts and only check for binaries"});this.silent=z.Boolean("--silent",{hidden:!0});this.scriptName=z.String();this.args=z.Proxy()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i,workspace:n,locator:s}=await je.find(t,this.context.cwd);await i.restoreInstallState();let o=this.topLevel?i.topLevelWorkspace.anchoredLocator:s;if(!this.binariesOnly&&await Wt.hasPackageScript(o,this.scriptName,{project:i}))return await Wt.executePackageScript(o,this.scriptName,this.args,{project:i,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});let a=await Wt.getPackageAccessibleBinaries(o,{project:i});if(a.get(this.scriptName)){let c=[];return this.inspect&&(typeof this.inspect=="string"?c.push(`--inspect=${this.inspect}`):c.push("--inspect")),this.inspectBrk&&(typeof this.inspectBrk=="string"?c.push(`--inspect-brk=${this.inspectBrk}`):c.push("--inspect-brk")),await Wt.executePackageAccessibleBinary(o,this.scriptName,this.args,{cwd:this.context.cwd,project:i,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,nodeArgs:c,packageAccessibleBinaries:a})}if(!this.topLevel&&!this.binariesOnly&&n&&this.scriptName.includes(":")){let u=(await Promise.all(i.workspaces.map(async g=>g.manifest.scripts.has(this.scriptName)?g:null))).filter(g=>g!==null);if(u.length===1)return await Wt.executeWorkspaceScript(u[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 be(`Couldn't find a script name "${this.scriptName}" in the top-level (used by ${P.prettyLocator(t,s)}). 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 be(`Couldn't find a script name "${this.scriptName}" in the top-level (used by ${P.prettyLocator(t,s)}).`);{if(this.scriptName==="global")throw new be("The 'yarn global' commands have been removed in 2.x - consider using 'yarn dlx' or a third-party plugin instead");let c=[this.scriptName].concat(this.args);for(let[u,g]of Qh)for(let f of g)if(c.length>=f.length&&JSON.stringify(c.slice(0,f.length))===JSON.stringify(f))throw new be(`Couldn't find a script named "${this.scriptName}", but a matching command can be found in the ${u} plugin. You can install it with "yarn plugin import ${u}".`);throw new be(`Couldn't find a script named "${this.scriptName}".`)}}};Pu.paths=[["run"]],Pu.usage=ve.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"]]});var Du=class extends De{constructor(){super(...arguments);this.save=z.Boolean("-s,--save",!1,{description:"Persist the resolution inside the top-level manifest"});this.descriptor=z.String();this.resolution=z.String()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i,workspace:n}=await je.find(t,this.context.cwd),s=await Rt.find(t);if(await i.restoreInstallState({restoreResolutions:!1}),!n)throw new ct(i.cwd,this.context.cwd);let o=P.parseDescriptor(this.descriptor,!0),a=P.makeDescriptor(o,this.resolution);return i.storedDescriptors.set(o.descriptorHash,o),i.storedDescriptors.set(a.descriptorHash,a),i.resolutionAliases.set(o.descriptorHash,a.descriptorHash),(await Ge.start({configuration:t,stdout:this.context.stdout},async c=>{await i.install({cache:s,report:c})})).exitCode()}};Du.paths=[["set","resolution"]],Du.usage=ve.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, add the `-s,--save` flag which will also edit the `resolutions` field from 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 1.5.0"]]});var mae=Pe(yn()),ku=class extends De{constructor(){super(...arguments);this.all=z.Boolean("-A,--all",!1,{description:"Unlink all workspaces belonging to the target project from the current one"});this.leadingArguments=z.Rest()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i,workspace:n}=await je.find(t,this.context.cwd),s=await Rt.find(t);if(!n)throw new ct(i.cwd,this.context.cwd);let o=i.topLevelWorkspace,a=new Set;if(this.leadingArguments.length===0&&this.all)for(let{pattern:c,reference:u}of o.manifest.resolutions)u.startsWith("portal:")&&a.add(c.descriptor.fullName);if(this.leadingArguments.length>0)for(let c of this.leadingArguments){let u=x.resolve(this.context.cwd,K.toPortablePath(c));if(Ie.isPathLike(c)){let g=await ye.find(u,this.context.plugins,{useRc:!1,strict:!1}),{project:f,workspace:h}=await je.find(g,u);if(!h)throw new ct(f.cwd,u);if(this.all){for(let p of f.workspaces)p.manifest.name&&a.add(P.stringifyIdent(p.locator));if(a.size===0)throw new be("No workspace found to be unlinked in the target project")}else{if(!h.manifest.name)throw new be("The target workspace doesn't have a name and thus cannot be unlinked");a.add(P.stringifyIdent(h.locator))}}else{let g=[...o.manifest.resolutions.map(({pattern:f})=>f.descriptor.fullName)];for(let f of(0,mae.default)(g,c))a.add(f)}}return o.manifest.resolutions=o.manifest.resolutions.filter(({pattern:c})=>!a.has(c.descriptor.fullName)),(await Ge.start({configuration:t,stdout:this.context.stdout},async c=>{await i.install({cache:s,report:c})})).exitCode()}};ku.paths=[["unlink"]],ku.usage=ve.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}'"]]});var Eae=Pe(Om()),iO=Pe(yn());as();var Cl=class extends De{constructor(){super(...arguments);this.interactive=z.Boolean("-i,--interactive",{description:"Offer various choices, depending on the detected upgrade paths"});this.exact=z.Boolean("-E,--exact",!1,{description:"Don't use any semver modifier on the resolved range"});this.tilde=z.Boolean("-T,--tilde",!1,{description:"Use the `~` semver modifier on the resolved range"});this.caret=z.Boolean("-C,--caret",!1,{description:"Use the `^` semver modifier on the resolved range"});this.recursive=z.Boolean("-R,--recursive",!1,{description:"Resolve again ALL resolutions for those packages"});this.mode=z.String("--mode",{description:"Change what artifacts installs generate",validator:Vi($n)});this.patterns=z.Rest()}async execute(){return this.recursive?await this.executeUpRecursive():await this.executeUpClassic()}async executeUpRecursive(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i,workspace:n}=await je.find(t,this.context.cwd),s=await Rt.find(t);if(!n)throw new ct(i.cwd,this.context.cwd);await i.restoreInstallState({restoreResolutions:!1});let o=[...i.storedDescriptors.values()],a=o.map(g=>P.stringifyIdent(g)),l=new Set;for(let g of this.patterns){if(P.parseDescriptor(g).range!=="unknown")throw new be("Ranges aren't allowed when using --recursive");for(let f of(0,iO.default)(a,g)){let h=P.parseIdent(f);l.add(h.identHash)}}let c=o.filter(g=>l.has(g.identHash));for(let g of c)i.storedDescriptors.delete(g.descriptorHash),i.storedResolutions.delete(g.descriptorHash);return(await Ge.start({configuration:t,stdout:this.context.stdout},async g=>{await i.install({cache:s,report:g})})).exitCode()}async executeUpClassic(){var y;let t=await ye.find(this.context.cwd,this.context.plugins),{project:i,workspace:n}=await je.find(t,this.context.cwd),s=await Rt.find(t);if(!n)throw new ct(i.cwd,this.context.cwd);await i.restoreInstallState({restoreResolutions:!1});let o=(y=this.interactive)!=null?y:t.get("preferInteractive"),a=Km(this,i),l=o?["keep","reuse","project","latest"]:["project","latest"],c=[],u=[];for(let B of this.patterns){let v=!1,D=P.parseDescriptor(B);for(let L of i.workspaces)for(let H of["dependencies","devDependencies"]){let $=[...L.manifest.getForScope(H).values()].map(V=>P.stringifyIdent(V));for(let V of(0,iO.default)($,P.stringifyIdent(D))){let W=P.parseIdent(V),_=L.manifest[H].get(W.identHash);if(typeof _>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");let A=P.makeDescriptor(W,D.range);c.push(Promise.resolve().then(async()=>[L,H,_,await Um(A,{project:i,workspace:L,cache:s,target:H,modifier:a,strategies:l})])),v=!0}}v||u.push(B)}if(u.length>1)throw new be(`Patterns ${ee.prettyList(t,u,xi.CODE)} don't match any packages referenced by any workspace`);if(u.length>0)throw new be(`Pattern ${ee.prettyList(t,u,xi.CODE)} doesn't match any packages referenced by any workspace`);let g=await Promise.all(c),f=await ra.start({configuration:t,stdout:this.context.stdout,suggestInstall:!1},async B=>{for(let[,,v,{suggestions:D,rejections:L}]of g){let H=D.filter(j=>j.descriptor!==null);if(H.length===0){let[j]=L;if(typeof j>"u")throw new Error("Assertion failed: Expected an error to have been set");let $=this.cli.error(j);i.configuration.get("enableNetwork")?B.reportError(27,`${P.prettyDescriptor(t,v)} can't be resolved to a satisfying range
${$}`):B.reportError(27,`${P.prettyDescriptor(t,v)} can't be resolved to a satisfying range (note: network resolution has been disabled)
${$}`)}else H.length>1&&!o&&B.reportError(27,`${P.prettyDescriptor(t,v)} has multiple possible upgrade strategies; use -i to disambiguate manually`)}});if(f.hasErrors())return f.exitCode();let h=!1,p=[];for(let[B,v,,{suggestions:D}]of g){let L,H=D.filter(W=>W.descriptor!==null),j=H[0].descriptor,$=H.every(W=>P.areDescriptorsEqual(W.descriptor,j));H.length===1||$?L=j:(h=!0,{answer:L}=await(0,Eae.prompt)({type:"select",name:"answer",message:`Which range to you want to use in ${P.prettyWorkspace(t,B)} \u276F ${v}?`,choices:D.map(({descriptor:W,name:_,reason:A})=>W?{name:_,hint:A,descriptor:W}:{name:_,hint:A,disabled:!0}),onCancel:()=>process.exit(130),result(W){return this.find(W,"descriptor")},stdin:this.context.stdin,stdout:this.context.stdout}));let V=B.manifest[v].get(L.identHash);if(typeof V>"u")throw new Error("Assertion failed: This descriptor should have a matching entry");if(V.descriptorHash!==L.descriptorHash)B.manifest[v].set(L.identHash,L),p.push([B,v,V,L]);else{let W=t.makeResolver(),_={project:i,resolver:W},A=W.bindDescriptor(V,B.anchoredLocator,_);i.forgetResolution(A)}}return await t.triggerMultipleHooks(B=>B.afterWorkspaceDependencyReplacement,p),h&&this.context.stdout.write(`
`),(await Ge.start({configuration:t,stdout:this.context.stdout},async B=>{await i.install({cache:s,report:B,mode:this.mode})})).exitCode()}};Cl.paths=[["up"]],Cl.usage=ve.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` will upgrade all workspaces at the same time.\n\n This command accepts glob patterns as arguments (if valid Descriptors 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.\n\n **Note:** The ranges have to be static, only the package scopes and names can contain glob patterns.\n ",examples:[["Upgrade all instances of lodash to the latest release","$0 up lodash"],["Upgrade all instances of lodash to the latest release, but ask confirmation for each","$0 up lodash -i"],["Upgrade all instances of lodash to 1.2.3","$0 up lodash@1.2.3"],["Upgrade all instances of packages with the `@babel` scope to the latest release","$0 up '@babel/*'"],["Upgrade all instances of packages containing the word `jest` to the latest release","$0 up '*jest*'"],["Upgrade all instances of packages with the `@babel` scope to 7.0.0","$0 up '@babel/*@7.0.0'"]]}),Cl.schema=[av("recursive",sc.Forbids,["interactive","exact","tilde","caret"],{ignore:[void 0,!1]})];var Ru=class extends De{constructor(){super(...arguments);this.recursive=z.Boolean("-R,--recursive",!1,{description:"List, for each workspace, what are all the paths that lead to the dependency"});this.json=z.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.peers=z.Boolean("--peers",!1,{description:"Also print the peer dependencies that match the specified name"});this.package=z.String()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i,workspace:n}=await je.find(t,this.context.cwd);if(!n)throw new ct(i.cwd,this.context.cwd);await i.restoreInstallState();let s=P.parseIdent(this.package).identHash,o=this.recursive?M4e(i,s,{configuration:t,peers:this.peers}):O4e(i,s,{configuration:t,peers:this.peers});_n.emitTree(o,{configuration:t,stdout:this.context.stdout,json:this.json,separators:1})}};Ru.paths=[["why"]],Ru.usage=ve.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"]]});function O4e(r,e,{configuration:t,peers:i}){let n=Ie.sortMap(r.storedPackages.values(),a=>P.stringifyLocator(a)),s={},o={children:s};for(let a of n){let l={};for(let u of a.dependencies.values()){if(!i&&a.peerDependencies.has(u.identHash))continue;let g=r.storedResolutions.get(u.descriptorHash);if(!g)throw new Error("Assertion failed: The resolution should have been registered");let f=r.storedPackages.get(g);if(!f)throw new Error("Assertion failed: The package should have been registered");if(f.identHash!==e)continue;{let p=P.stringifyLocator(a);s[p]={value:[a,ee.Type.LOCATOR],children:l}}let h=P.stringifyLocator(f);l[h]={value:[{descriptor:u,locator:f},ee.Type.DEPENDENT]}}}return o}function M4e(r,e,{configuration:t,peers:i}){let n=Ie.sortMap(r.workspaces,f=>P.stringifyLocator(f.anchoredLocator)),s=new Set,o=new Set,a=f=>{if(s.has(f.locatorHash))return o.has(f.locatorHash);if(s.add(f.locatorHash),f.identHash===e)return o.add(f.locatorHash),!0;let h=!1;f.identHash===e&&(h=!0);for(let p of f.dependencies.values()){if(!i&&f.peerDependencies.has(p.identHash))continue;let C=r.storedResolutions.get(p.descriptorHash);if(!C)throw new Error("Assertion failed: The resolution should have been registered");let y=r.storedPackages.get(C);if(!y)throw new Error("Assertion failed: The package should have been registered");a(y)&&(h=!0)}return h&&o.add(f.locatorHash),h};for(let f of n){let h=r.storedPackages.get(f.anchoredLocator.locatorHash);if(!h)throw new Error("Assertion failed: The package should have been registered");a(h)}let l=new Set,c={},u={children:c},g=(f,h,p)=>{if(!o.has(f.locatorHash))return;let C=p!==null?ee.tuple(ee.Type.DEPENDENT,{locator:f,descriptor:p}):ee.tuple(ee.Type.LOCATOR,f),y={},B={value:C,children:y},v=P.stringifyLocator(f);if(h[v]=B,!l.has(f.locatorHash)&&(l.add(f.locatorHash),!(p!==null&&r.tryWorkspaceByLocator(f))))for(let D of f.dependencies.values()){if(!i&&f.peerDependencies.has(D.identHash))continue;let L=r.storedResolutions.get(D.descriptorHash);if(!L)throw new Error("Assertion failed: The resolution should have been registered");let H=r.storedPackages.get(L);if(!H)throw new Error("Assertion failed: The package should have been registered");g(H,y,D)}};for(let f of n){let h=r.storedPackages.get(f.anchoredLocator.locatorHash);if(!h)throw new Error("Assertion failed: The package should have been registered");g(h,c,null)}return u}var hO={};ut(hO,{default:()=>n3e,gitUtils:()=>aA});var aA={};ut(aA,{TreeishProtocols:()=>kQ,clone:()=>fO,fetchBase:()=>Hae,fetchChangedFiles:()=>Gae,fetchChangedWorkspaces:()=>r3e,fetchRoot:()=>Uae,isGitUrl:()=>Zh,lsRemote:()=>Kae,normalizeLocator:()=>uO,normalizeRepoUrl:()=>Wm,resolveUrl:()=>gO,splitRepoUrl:()=>Jm});var cO=Pe(Fae()),Oae=Pe(bB()),Xh=Pe(J("querystring")),AO=Pe(Xr());var Lae=J("url");function aO(r,e,t){let i=r.indexOf(t);return r.lastIndexOf(e,i>-1?i:1/0)}function Nae(r){try{return new Lae.URL(r)}catch{return}}function e3e(r){let e=aO(r,"@","#"),t=aO(r,":","#");return t>e&&(r=`${r.slice(0,t)}/${r.slice(t+1)}`),aO(r,":","#")===-1&&r.indexOf("//")===-1&&(r=`ssh://${r}`),r}function Tae(r){return Nae(r)||Nae(e3e(r))}function Mae(){return{...process.env,GIT_SSH_COMMAND:process.env.GIT_SSH_COMMAND||`${process.env.GIT_SSH||"ssh"} -o BatchMode=yes`}}var t3e=[/^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\/(.+)?$/],kQ=(n=>(n.Commit="commit",n.Head="head",n.Tag="tag",n.Semver="semver",n))(kQ||{});function Zh(r){return r?t3e.some(e=>!!r.match(e)):!1}function Jm(r){r=Wm(r);let e=r.indexOf("#");if(e===-1)return{repo:r,treeish:{protocol:"head",request:"HEAD"},extra:{}};let t=r.slice(0,e),i=r.slice(e+1);if(i.match(/^[a-z]+=/)){let n=Xh.default.parse(i);for(let[l,c]of Object.entries(n))if(typeof c!="string")throw new Error(`Assertion failed: The ${l} parameter must be a literal string`);let s=Object.values(kQ).find(l=>Object.prototype.hasOwnProperty.call(n,l)),o,a;typeof s<"u"?(o=s,a=n[s]):(o="head",a="HEAD");for(let l of Object.values(kQ))delete n[l];return{repo:t,treeish:{protocol:o,request:a},extra:n}}else{let n=i.indexOf(":"),s,o;return n===-1?(s=null,o=i):(s=i.slice(0,n),o=i.slice(n+1)),{repo:t,treeish:{protocol:s,request:o},extra:{}}}}function Wm(r,{git:e=!1}={}){if(r=r.replace(/^git\+https:/,"https:"),r=r.replace(/^(?:github:|https:\/\/github\.com\/)?(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)(?:\.git)?(#.*)?$/,"https://github.com/$1/$2.git$3"),r=r.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 t=Tae(r);t&&(r=t.href),r=r.replace(/^git\+([^:]+):/,"$1:")}re Line truncated
- ${l.join(`
- `)}?`)}return this.cli.run([this.commandName,...this.args],{cwd:a.cwd})}};Nu.paths=[["workspace"]],Nu.usage=ve.Usage({category:"Workspace-related commands",description:"run a command within the specified workspace",details:`
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"]]});var s3e={configuration:{enableImmutableInstalls:{description:"If true (the default on CI), prevents the install command from modifying the lockfile",type:"BOOLEAN",default:Yae.isCI},defaultSemverRangePrefix:{description:"The default save prefix: '^', '~' or ''",type:"STRING",values:["^","~",""],default:"^"}},commands:[ou,au,Au,lu,Du,wu,hu,Fu,Jh,Wh,Ym,zh,nu,su,cu,uu,gu,fu,pu,du,Cu,mu,ku,Eu,Qu,Bu,bu,Iu,Su,vu,xu,Vh,Pu,Cl,Ru,Nu]},o3e=s3e;var IO={};ut(IO,{default:()=>A3e});var Le={optional:!0},dO=[["@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:Le,zenObservable:Le}}],["any-observable@<0.5.1",{peerDependenciesMeta:{rxjs:Le,zenObservable:Le}}],["@pm2/agent@<1.0.4",{dependencies:{debug:"*"}}],["debug@<4.2.0",{peerDependenciesMeta:{["supports-color"]:Le}}],["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"]:Le,["postcss-jsx"]:Le,["postcss-less"]:Le,["postcss-markdown"]:Le,["postcss-scss"]:Le}}],["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:Le}}],["snowpack@>=3.3.0",{dependencies:{["node-gyp"]:"^7.1.0"}}],["promise-inflight@*",{peerDependenciesMeta:{bluebird:Le}}],["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:Le,"vue-template-compiler":Le}}],["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"}}],["ws@<7.2.1",{peerDependencies:{bufferutil:"^4.0.1","utf-8-validate":"^5.0.2"},peerDependenciesMeta:{bufferutil:Le,"utf-8-validate":Le}}],["react-portal@<4.2.2",{peerDependencies:{"react-dom":"^15.0.0-0 || ^16.0.0-0 || ^17.0.0-0"}}],["react-scripts@<=4.0.1",{peerDependencies:{react:"*"}}],["testcafe@<=1.10.1",{dependencies:{"@babel/plugin-transform-for-of":"^7.12.1","@babel/runtime":"^7.12.5"}}],["testcafe-legacy-api@<=4.2.0",{dependencies:{"testcafe-hammerhead":"^17.0.1","read-file-relative":"^1.2.0"}}],["@google-cloud/firestore@<=4.9.3",{dependencies:{protobufjs:"^6.8.6"}}],["gatsby-source-apiserver@*",{dependencies:{["babel-polyfill"]:"^6.26.0"}}],["@webpack-cli/package-utils@<=1.0.1-alpha.4",{dependencies:{["cross-spawn"]:"^7.0.3"}}],["gatsby-remark-prismjs@<3.3.28",{dependencies:{lodash:"^4"}}],["gatsby-plugin-favicon@*",{peerDependencies:{webpack:"*"}}],["gatsby-plugin-sharp@<=4.6.0-next.3",{dependencies:{debug:"^4.3.1"}}],["gatsby-react-router-scroll@<=5.6.0-next.0",{dependencies:{["prop-types"]:"^15.7.2"}}],["@rebass/forms@*",{dependencies:{["@styled-system/should-forward-prop"]:"^5.0.0"},peerDependencies:{react:"^16.8.6"}}],["rebass@*",{peerDependencies:{react:"^16.8.6"}}],["@ant-design/react-slick@<=0.28.3",{peerDependencies:{react:">=16.0.0"}}],["mqtt@<4.2.7",{dependencies:{duplexify:"^4.1.1"}}],["vue-cli-plugin-vuetify@<=2.0.3",{dependencies:{semver:"^6.3.0"},peerDependenciesMeta:{"sass-loader":Le,"vuetify-loader":Le}}],["vue-cli-plugin-vuetify@<=2.0.4",{dependencies:{"null-loader":"^3.0.0"}}],["vue-cli-plugin-vuetify@>=2.4.3",{peerDependencies:{vue:"*"}}],["@vuetify/cli-plugin-utils@<=0.0.4",{dependencies:{semver:"^6.3.0"},peerDependenciesMeta:{"sass-loader":Le}}],["@vue/cli-plugin-typescript@<=5.0.0-alpha.0",{dependencies:{"babel-lo Line truncated
`),await M.writeFilePromise(x.join(i,"yarn.lock"),"");let n=x.join(i,".yarnrc.yml"),s=await ye.findProjectCwd(this.context.cwd,xt.lockfile),o=!(await ye.find(this.context.cwd,null,{strict:!1})).get("enableGlobalCache"),a=s!==null?x.join(s,".yarnrc.yml"):null;a!==null&&M.existsSync(a)?(await M.copyFilePromise(a,n),await ye.updateConfiguration(i,y=>{let B={...y,enableGlobalCache:o,enableTelemetry:!1};return Array.isArray(y.plugins)&&(B.plugins=y.plugins.map(v=>{let D=typeof v=="string"?v:v.path,L=K.isAbsolute(D)?D:K.resolve(K.fromPortablePath(s),D);return typeof v=="string"?L:{path:L,spec:v.spec}})),B})):await M.writeFilePromise(n,`enableGlobalCache: ${o}
enableTelemetry: false
`);let l=(C=this.packages)!=null?C:[this.command],c=P.parseDescriptor(this.command).name,u=await this.cli.run(["add","--",...l],{cwd:i,quiet:this.quiet});if(u!==0)return u;this.quiet||this.context.stdout.write(`
`);let g=await ye.find(i,this.context.plugins),{project:f,workspace:h}=await je.find(g,i);if(h===null)throw new ct(f.cwd,i);await f.restoreInstallState();let p=await Wt.getWorkspaceAccessibleBinaries(h);return p.has(c)===!1&&p.size===1&&typeof this.packages>"u"&&(c=Array.from(p)[0][0]),await Wt.executeWorkspaceAccessibleBinary(h,c,this.args,{packageAccessibleBinaries:p,cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})})}};Lu.paths=[["dlx"]],Lu.usage=ve.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-react-app to create a new React app","yarn dlx create-react-app ./my-app"],["Install multiple packages for a single command",`yarn dlx -p typescript -p ts-node ts-node --transpile-only -e "console.log('hello!')"`]]});var l3e={commands:[_h,Lu]},c3e=l3e;var bO={};ut(bO,{default:()=>f3e,fileUtils:()=>Vm});var $h=/^(?:[a-zA-Z]:[\\/]|\.{0,2}\/)/,zm=/^[^?]*\.(?:tar\.gz|tgz)(?:::.*)?$/,qr="file:";var Vm={};ut(Vm,{makeArchiveFromLocator:()=>NQ,makeBufferFromLocator:()=>QO,makeLocator:()=>BO,makeSpec:()=>zae,parseSpec:()=>wO});function wO(r){let{params:e,selector:t}=P.parseRange(r),i=K.toPortablePath(t);return{parentLocator:e&&typeof e.locator=="string"?P.parseLocator(e.locator):null,path:i}}function zae({parentLocator:r,path:e,folderHash:t,protocol:i}){let n=r!==null?{locator:P.stringifyLocator(r)}:{},s=typeof t<"u"?{hash:t}:{};return P.makeRange({protocol:i,source:e,selector:e,params:{...s,...n}})}function BO(r,{parentLocator:e,path:t,folderHash:i,protocol:n}){return P.makeLocator(r,zae({parentLocator:e,path:t,folderHash:i,protocol:n}))}async function NQ(r,{protocol:e,fetchOptions:t,inMemory:i=!1}){let{parentLocator:n,path:s}=P.parseFileStyleRange(r.reference,{protocol:e}),o=x.isAbsolute(s)?{packageFs:new qt(Oe.root),prefixPath:Oe.dot,localPath:Oe.root}:await t.fetcher.fetch(n,t),a=o.localPath?{packageFs:new qt(Oe.root),prefixPath:x.relative(Oe.root,o.localPath)}:o;o!==a&&o.releaseFs&&o.releaseFs();let l=a.packageFs,c=x.join(a.prefixPath,s);return await Ie.releaseAfterUseAsync(async()=>await mi.makeArchiveFromDirectory(c,{baseFs:l,prefixPath:P.getIdentVendorPath(r),compressionLevel:t.project.configuration.get("compressionLevel"),inMemory:i}),a.releaseFs)}async function QO(r,{protocol:e,fetchOptions:t}){return(await NQ(r,{protocol:e,fetchOptions:t,inMemory:!0})).getBufferAndClose()}var LQ=class{supports(e,t){return!!e.reference.startsWith(qr)}getLocalPath(e,t){let{parentLocator:i,path:n}=P.parseFileStyleRange(e.reference,{protocol:qr});if(x.isAbsolute(n))return n;let s=t.fetcher.getLocalPath(i,t);return s===null?null:x.resolve(s,n)}async fetch(e,t){let i=t.checksums.get(e.locatorHash)||null,[n,s,o]=await t.cache.fetchPackageFromCache(e,i,{onHit:()=>t.report.reportCacheHit(e),onMiss:()=>t.report.reportCacheMiss(e,`${P.prettyLocator(t.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.fetchFromDisk(e,t),skipIntegrityCheck:t.skipIntegrityCheck,...t.cacheOptions});return{packageFs:n,releaseFs:s,prefixPath:P.getIdentVendorPath(e),localPath:this.getLocalPath(e,t),checksum:o}}async fetchFromDisk(e,t){return NQ(e,{protocol:qr,fetchOptions:t})}};var u3e=2,TQ=class{supportsDescriptor(e,t){return e.range.match($h)?!0:!!e.range.startsWith(qr)}supportsLocator(e,t){return!!e.reference.startsWith(qr)}shouldPersistResolution(e,t){return!1}bindDescriptor(e,t,i){return $h.test(e.range)&&(e=P.makeDescriptor(e,`${qr}${e.range}`)),P.bindDescriptor(e,{locator:P.stringifyLocator(t)})}getResolutionDependencies(e,t){return[]}async getCandidates(e,t,i){if(!i.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{path:n,parentLocator:s}=wO(e.range);if(s===null)throw new Error("Assertion failed: The descriptor should have been bound");let o=await QO(P.makeLocator(e,P.makeRange({protocol:qr,source:n,selector:n,params:{locator:P.stringifyLocator(s)}})),{protocol:qr,fetchOptions:i.fetchOptions}),a=li.makeHash(`${u3e}`,o).slice(0,6);return[BO(e,{parentLocator:s,path:n,folderHash:a,protocol:qr})]}async getSatisfying(e,t,i){return null}async resolve(e,t){if(!t.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let i=await t.fetchOptions.fetcher.fetch(e,t.fetchOptions),n=await Ie. Line truncated
`);let a=x.join(this.context.cwd,ot.fileName);await M.changeFilePromise(a,`${JSON.stringify(o,null,2)}
`,{automaticNewlines:!0});let l=x.join(this.context.cwd,"README.md");if(M.existsSync(l)||await M.writeFilePromise(l,`# ${P.stringifyIdent(n.name)}
`),!i||i.cwd===this.context.cwd){let u=x.join(this.context.cwd,xt.lockfile);M.existsSync(u)||await M.writeFilePromise(u,"");let f=[".yarn/*","!.yarn/patches","!.yarn/plugins","!.yarn/releases","!.yarn/sdks","!.yarn/versions","","# Swap the comments on the following lines if you don't wish to use zero-installs","# Documentation here: https://yarnpkg.com/features/zero-installs","!.yarn/cache","#.pnp.*"].map(L=>`${L}
`).join(""),h=x.join(this.context.cwd,".gitignore");M.existsSync(h)||await M.writeFilePromise(h,f);let C=["/.yarn/** linguist-vendored","/.yarn/releases/* binary","/.yarn/plugins/**/* binary","/.pnp.* binary linguist-generated"].map(L=>`${L}
`).join(""),y=x.join(this.context.cwd,".gitattributes");M.existsSync(y)||await M.writeFilePromise(y,C);let B={["*"]:{endOfLine:"lf",insertFinalNewline:!0},["*.{js,json,yml}"]:{charset:"utf-8",indentStyle:"space",indentSize:2}};(0,bAe.default)(B,t.get("initEditorConfig"));let v=`root = true
`;for(let[L,H]of Object.entries(B)){v+=`
[${L}]
`;for(let[j,$]of Object.entries(H))v+=`${j.replace(/[A-Z]/g,W=>`_${W.toLowerCase()}`)} = ${$}
`}let D=x.join(this.context.cwd,".editorconfig");M.existsSync(D)||await M.writeFilePromise(D,v),M.existsSync(x.join(this.context.cwd,".git"))||await Cr.execvp("git",["init"],{cwd:this.context.cwd})}}};Tu.paths=[["init"]],Tu.usage=ve.Usage({description:"create a new package",details:"\n This command will setup a new package in your local directory.\n\n If the `-p,--private` or `-w,--workspace` options are set, the package will be private by default.\n\n If the `-w,--workspace` option is set, the package will be configured to accept a set of workspaces in the `packages/` directory.\n\n If the `-i,--install` option is given a value, Yarn will first download it using `yarn set version` and only then forward the init call to the newly downloaded bundle. Without arguments, the downloaded bundle will be `latest`.\n\n The initial settings of the manifest can be changed by using the `initScope` and `initFields` configuration values. Additionally, Yarn will generate an EditorConfig file whose rules can be altered via `initEditorConfig`, and will initialize a Git repository in the current directory.\n ",examples:[["Create a new package in the local directory","yarn init"],["Create a new private package in the local directory","yarn init -p"],["Create a new package and store the Yarn release inside","yarn init -i=latest"],["Create a new private package and defines it as a workspace root","yarn init -w"]]});var E8e={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:[Tu]},I8e=E8e;var RO={};ut(RO,{default:()=>w8e});var AA="portal:",lA="link:";var GQ=class{supports(e,t){return!!e.reference.startsWith(AA)}getLocalPath(e,t){let{parentLocator:i,path:n}=P.parseFileStyleRange(e.reference,{protocol:AA});if(x.isAbsolute(n))return n;let s=t.fetcher.getLocalPath(i,t);return s===null?null:x.resolve(s,n)}async fetch(e,t){var c;let{parentLocator:i,path:n}=P.parseFileStyleRange(e.reference,{protocol:AA}),s=x.isAbsolute(n)?{packageFs:new qt(Oe.root),prefixPath:Oe.dot,localPath:Oe.root}:await t.fetcher.fetch(i,t),o=s.localPath?{packageFs:new qt(Oe.root),prefixPath:x.relative(Oe.root,s.localPath),localPath:Oe.root}:s;s!==o&&s.releaseFs&&s.releaseFs();let a=o.packageFs,l=x.resolve((c=o.localPath)!=null?c:o.packageFs.getRealPath(),o.prefixPath,n);return s.localPath?{packageFs:new qt(l,{baseFs:a}),releaseFs:o.releaseFs,prefixPath:Oe.dot,localPath:l}:{packageFs:new So(l,{baseFs:a}),releaseFs:o.releaseFs,prefixPath:Oe.dot}}};var YQ=class{supportsDescriptor(e,t){return!!e.range.startsWith(AA)}supportsLocator(e,t){return!!e.reference.startsWith(AA)}shouldPersistResolution(e,t){return!1}bindDescriptor(e,t,i){return P.bindDescriptor(e,{locator:P.stringifyLocator(t)})}getResolutionDependencies(e,t){return[]}async getCandidates(e,t,i){let n=e.range.slice(AA.length);return[P.makeLocator(e,`${AA}${K.toPortablePath(n)}`)]}async getSatisfying(e,t,i){return null}async resolve(e,t){if(!t.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let i=await t.fetchOptions.fetcher.fetch(e,t.fetchOptions),n=await Ie.releaseAfterUseAsync(async()=>await ot.find(i.prefixPath,{baseFs:i.packageFs}),i.releaseFs);return{...e,version:n.version||"0.0.0",languageName:n.languageName||t.project.configuration.get("defaultLanguageName"),linkType:"SOFT",conditions:n.getConditions(),dependencies:new Map([...n.dependencies]),peerDependencies:n.peerDependencies,dependenciesMeta:n.dependenciesMeta,peerDependenciesMeta:n.peerDependenciesMeta,bin:n.bin}}};var jQ=class{supports(e,t){return!!e.reference.startsWith(lA)}getLocalPath(e,t){let{parentLocator:i,path:n}=P.parseFileStyleRange(e.reference,{protocol:lA});if(x.isAbsolute(n))return n;let s=t.fetcher.getLocalPath(i,t);return s===null?null:x.resolve(s,n)}async fetch(e,t){var c;let{parentLocator:i,path:n}=P.parseFileStyleRange(e.reference,{protocol:lA}),s=x.isAbsolute(n)?{packageFs:new qt(Oe.root),prefixPath:Oe.dot,localPath:Oe.root}:await t.fetcher.fetch(i,t),o=s.localPath?{packageFs:new qt(Oe.root),prefixPath:x.relative(Oe.root,s.localPath),localPath:Oe.root}:s;s!==o&&s.releaseFs&&s.releaseFs();let a=o.packageFs,l=x.resolve((c=o.localPath)!=null?c:o.packageFs.getRealPath(),o.prefixPath,n);return s.localPath?{packageFs:new qt(l,{baseFs:a}),releaseFs:o.releaseFs,prefixPath:Oe.dot,discardFromLookup:!0,localPath:l}:{packageFs:new So(l,{baseFs:a}),releaseFs:o.releaseFs,prefixPath:Oe.dot,discardFromLookup:!0}}};var qQ=class{supportsDescriptor(e,t){return!!e.range.startsWith(lA)}supportsLocator(e,t){return!!e.reference.startsWith(lA)}shouldPersistResolution(e,t){return!1}bindDescriptor(e Line truncated
${u}, next tree:
${_m(a)}`);let f=DAe(a);if(f)throw new Error(`${f}, after hoisting finished:
${_m(a)}`)}return s.debugLevel>=2&&console.log(_m(a)),D8e(a)},B8e=r=>{let e=r[r.length-1],t=new Map,i=new Set,n=s=>{if(!i.has(s)){i.add(s);for(let o of s.hoistedDependencies.values())t.set(o.name,o);for(let o of s.dependencies.values())s.peerNames.has(o.name)||n(o)}};return n(e),t},Q8e=r=>{let e=r[r.length-1],t=new Map,i=new Set,n=new Set,s=(o,a)=>{if(i.has(o))return;i.add(o);for(let c of o.hoistedDependencies.values())if(!a.has(c.name)){let u;for(let g of r)u=g.dependencies.get(c.name),u&&t.set(u.name,u)}let l=new Set;for(let c of o.dependencies.values())l.add(c.name);for(let c of o.dependencies.values())o.peerNames.has(c.name)||s(c,l)};return s(e,n),t},vAe=(r,e)=>{if(e.decoupled)return e;let{name:t,references:i,ident:n,locator:s,dependencies:o,originalDependencies:a,hoistedDependencies:l,peerNames:c,reasons:u,isHoistBorder:g,hoistPriority:f,dependencyKind:h,hoistedFrom:p,hoistedTo:C}=e,y={name:t,references:new Set(i),ident:n,locator:s,dependencies:new Map(o),originalDependencies:new Map(a),hoistedDependencies:new Map(l),peerNames:new Set(c),reasons:new Map(u),decoupled:!0,isHoistBorder:g,hoistPriority:f,dependencyKind:h,hoistedFrom:new Map(p),hoistedTo:new Map(C)},B=y.dependencies.get(t);return B&&B.ident==y.ident&&y.dependencies.set(t,y),r.dependencies.set(y.name,y),y},b8e=(r,e)=>{let t=new Map([[r.name,[r.ident]]]);for(let n of r.dependencies.values())r.peerNames.has(n.name)||t.set(n.name,[n.ident]);let i=Array.from(e.keys());i.sort((n,s)=>{let o=e.get(n),a=e.get(s);return a.hoistPriority!==o.hoistPriority?a.hoistPriority-o.hoistPriority:a.peerDependents.size!==o.peerDependents.size?a.peerDependents.size-o.peerDependents.size:a.dependents.size-o.dependents.size});for(let n of i){let s=n.substring(0,n.indexOf("@",1)),o=n.substring(s.length+1);if(!r.peerNames.has(s)){let a=t.get(s);a||(a=[],t.set(s,a)),a.indexOf(o)<0&&a.push(o)}}return t},FO=r=>{let e=new Set,t=(i,n=new Set)=>{if(!n.has(i)){n.add(i);for(let s of i.peerNames)if(!r.peerNames.has(s)){let o=r.dependencies.get(s);o&&!e.has(o)&&t(o,n)}e.add(i)}};for(let i of r.dependencies.values())r.peerNames.has(i.name)||t(i);return e},LO=(r,e,t,i,n,s=new Set)=>{let o=e[e.length-1];if(s.has(o))return{anotherRoundNeeded:!1,isGraphChanged:!1};s.add(o);let a=k8e(o),l=b8e(o,a),c=r==o?new Map:n.fastLookupPossible?B8e(e):Q8e(e),u,g=!1,f=!1,h=new Map(Array.from(l.entries()).map(([C,y])=>[C,y[0]])),p=new Map;do{let C=x8e(r,e,t,c,h,l,i,p,n);C.isGraphChanged&&(f=!0),C.anotherRoundNeeded&&(g=!0),u=!1;for(let[y,B]of l)B.length>1&&!o.dependencies.has(y)&&(h.delete(y),B.shift(),h.set(y,B[0]),u=!0)}while(u);for(let C of o.dependencies.values())if(!o.peerNames.has(C.name)&&!t.has(C.locator)){t.add(C.locator);let y=LO(r,[...e,C],t,p,n);y.isGraphChanged&&(f=!0),y.anotherRoundNeeded&&(g=!0),t.delete(C.locator)}return{anotherRoundNeeded:g,isGraphChanged:f}},S8e=r=>{for(let[e,t]of r.dependencies)if(!r.peerNames.has(e)&&t.ident!==r.ident)return!0;return!1},v8e=(r,e,t,i,n,s,o,a,{outputReason:l,fastLookupPossible:c})=>{let u,g=null,f=new Set;l&&(u=`${Array.from(e).map(y=>ki(y)).join("\u2192")}`);let h=t[t.length-1],C=!(i.ident===h.ident);if(l&&!C&&(g="- self-reference"),C&&(C=i.dependencyKind!==1,l&&!C&&(g="- workspace")),C&&i.dependencyKind===2&&(C=!S8e(i),l&&!C&&(g="- external soft link with unhoisted dependencies")),C&&(C=h.dependencyKind!==1||h.hoistedFrom.has(i.name)||e.size===1,l&&!C&&(g=h.reasons.get(i.name))),C&&(C=!r.peerNames.has(i.name),l&&!C&&(g=`- cannot shadow peer: ${ki(r.originalDependencies.get(i.name).locator)} at ${u}`)),C){let y=!1,B=n.get(i.name);if(y=!B||B.ident===i.ident,l&&!y&&(g=`- filled by: ${ki(B.locator)} at ${u}`),y)for(let v=t.length-1;v>=1;v--){let L=t[v].dependencies.get(i.name);if(L&&L.ident!==i.ident){y=!1;let H=a.get(h);H||(H=new Set,a.set(h,H)),H.add(i.name),l&&(g=`- filled by ${ki(L.locator)} at ${t.slice(0,v).map(j=>ki(j.locator)).join("\u2192")}`);break}}C=y}if(C&&(C=s.get(i.name)===i.ident,l&&!C&&(g=`- filled by: ${ki(o.get(i.name)[0])} at ${u}`)),C){let y=!0,B=new Set(i.peerNames);for(let v=t.length-1;v>=1;v--){let D=t[v];for(let L of B){if(D.peerNames.has(L)&&D.originalDependencies.has(L))continue;let H=D.dependencies.get(L);H&&r.dependencies.get(L)!==H&&(v===t.length-1?f.add(H):(f=null,y=!1,l&&(g=`- peer dependency ${ki(H.locator)} from parent ${ki(D.locator)} was not hoisted to ${u}`))),B.delete(L)}if(!y)break}C=y}if(C&&!c)for(let y of i.hoistedDependencies.values()){let B=n.get(y.name)||r.dependencies.get(y.name);if(!B||y.ident!==B.ident){C=!1,l&&(g=`- previously hoisted dependency mismatch, needed: ${ki(y.locator)}, available: ${ki(B==null?void 0:B.locator)}`);break}}return f!==null&&f.size>0?{isHoistable:2,dependsOn:f,reason:g}:{isHoistable:C?0:1,reason:g}},JQ=r=>`${r.name}@${r.locator}`,x8e=(r,e,t,i,n,s,o,a,l)=>{let c=e[e.length-1],u=new Set,g=!1,f=!1,h=(B,v,D,L,H)=>{if(u.has(L))return;let j=[...v,JQ(L)],$=[...D,JQ(L)],V=new Map,W=new Map;for(let re of FO(L)){let O=v8e(c,t,[c,...B,L],re,i,n,s,a,{outputReason:l.debugLevel>=2,fastLooku Line truncated
${_m(r)}`)}let ge=FO(L);for(let re of ge)if(_.has(re)){let O=W.get(re);if((n.get(re.name)===re.ident||!L.reasons.has(re.name))&&O.isHoistable!==0&&L.reasons.set(re.name,O.reason),!re.isHoistBorder&&$.indexOf(JQ(re))<0){u.add(L);let ue=vAe(L,re);h([...B,L],j,$,ue,C),u.delete(L)}}},p,C=new Set(FO(c)),y=Array.from(e).map(B=>JQ(B));do{p=C,C=new Set;for(let B of p){if(B.locator===c.locator||B.isHoistBorder)continue;let v=vAe(c,B);h([],Array.from(t),y,v,C)}}while(C.size>0);return{anotherRoundNeeded:g,isGraphChanged:f}},DAe=r=>{let e=[],t=new Set,i=new Set,n=(s,o,a)=>{if(t.has(s)||(t.add(s),i.has(s)))return;let l=new Map(o);for(let c of s.dependencies.values())s.peerNames.has(c.name)||l.set(c.name,c);for(let c of s.originalDependencies.values()){let u=l.get(c.name),g=()=>`${Array.from(i).concat([s]).map(f=>ki(f.locator)).join("\u2192")}`;if(s.peerNames.has(c.name)){let f=o.get(c.name);(f!==u||!f||f.ident!==c.ident)&&e.push(`${g()} - broken peer promise: expected ${c.ident} but found ${f&&f.ident}`)}else{let f=a.hoistedFrom.get(s.name),h=s.hoistedTo.get(c.name),p=`${f?` hoisted from ${f.join(", ")}`:""}`,C=`${h?` hoisted to ${h}`:""}`,y=`${g()}${p}`;u?u.ident!==c.ident&&e.push(`${y} - broken require promise for ${c.name}${C}: expected ${c.ident}, but found: ${u.ident}`):e.push(`${y} - broken require promise: no required dependency ${c.name}${C} found`)}}i.add(s);for(let c of s.dependencies.values())s.peerNames.has(c.name)||n(c,l,s);i.delete(s)};return n(r,r.dependencies,r),e.join(`
`)},P8e=(r,e)=>{let{identName:t,name:i,reference:n,peerNames:s}=r,o={name:i,references:new Set([n]),locator:NO(t,n),ident:SAe(t,n),dependencies:new Map,originalDependencies:new Map,hoistedDependencies:new Map,peerNames:new Set(s),reasons:new Map,decoupled:!0,isHoistBorder:!0,hoistPriority:0,dependencyKind:1,hoistedFrom:new Map,hoistedTo:new Map},a=new Map([[r,o]]),l=(c,u)=>{let g=a.get(c),f=!!g;if(!g){let{name:h,identName:p,reference:C,peerNames:y,hoistPriority:B,dependencyKind:v}=c,D=e.hoistingLimits.get(u.locator);g={name:h,references:new Set([C]),locator:NO(p,C),ident:SAe(p,C),dependencies:new Map,originalDependencies:new Map,hoistedDependencies:new Map,peerNames:new Set(y),reasons:new Map,decoupled:!0,isHoistBorder:D?D.has(h):!1,hoistPriority:B||0,dependencyKind:v||0,hoistedFrom:new Map,hoistedTo:new Map},a.set(c,g)}if(u.dependencies.set(c.name,g),u.originalDependencies.set(c.name,g),f){let h=new Set,p=C=>{if(!h.has(C)){h.add(C),C.decoupled=!1;for(let y of C.dependencies.values())C.peerNames.has(y.name)||p(y)}};p(g)}else for(let h of c.dependencies)l(h,g)};for(let c of r.dependencies)l(c,o);return o},TO=r=>r.substring(0,r.indexOf("@",1)),D8e=r=>{let e={name:r.name,identName:TO(r.locator),references:new Set(r.references),dependencies:new Set},t=new Set([r]),i=(n,s,o)=>{let a=t.has(n),l;if(s===n)l=o;else{let{name:c,references:u,locator:g}=n;l={name:c,identName:TO(g),references:u,dependencies:new Set}}if(o.dependencies.add(l),!a){t.add(n);for(let c of n.dependencies.values())n.peerNames.has(c.name)||i(c,n,l);t.delete(n)}};for(let n of r.dependencies.values())i(n,r,e);return e},k8e=r=>{let e=new Map,t=new Set([r]),i=o=>`${o.name}@${o.ident}`,n=o=>{let a=i(o),l=e.get(a);return l||(l={dependents:new Set,peerDependents:new Set,hoistPriority:0},e.set(a,l)),l},s=(o,a)=>{let l=!!t.has(a);if(n(a).dependents.add(o.ident),!l){t.add(a);for(let u of a.dependencies.values()){let g=n(u);g.hoistPriority=Math.max(g.hoistPriority,u.hoistPriority),a.peerNames.has(u.name)?g.peerDependents.add(a.ident):s(a,u)}}};for(let o of r.dependencies.values())r.peerNames.has(o.name)||s(r,o);return e},ki=r=>{if(!r)return"none";let e=r.indexOf("@",1),t=r.substring(0,e);t.endsWith("$wsroot$")&&(t=`wh:${t.replace("$wsroot$","")}`);let i=r.substring(e+1);if(i==="workspace:.")return".";if(i){let n=(i.indexOf("#")>0?i.split("#")[1]:i).replace("npm:","");return i.startsWith("virtual")&&(t=`v:${t}`),n.startsWith("workspace")&&(t=`w:${t}`,n=""),`${t}${n?`@${n}`:""}`}else return`${t}`},xAe=5e4,_m=r=>{let e=0,t=(n,s,o="")=>{if(e>xAe||s.has(n))return"";e++;let a=Array.from(n.dependencies.values()).sort((c,u)=>c.name===u.name?0:c.name>u.name?1:-1),l="";s.add(n);for(let c=0;c<a.length;c++){let u=a[c];if(!n.peerNames.has(u.name)&&u!==n){let g=n.reasons.get(u.name),f=TO(u.locator);l+=`${o}${c<a.length-1?"\u251C\u2500":"\u2514\u2500"}${(s.has(u)?">":"")+(f!==u.name?`a:${u.name}:`:"")+ki(u.locator)+(g?` ${g}`:"")}
`,l+=t(u,s,`${o}${c<a.length-1?"\u2502 ":" "}`)}}return s.delete(n),l};return t(r,new Set)+(e>xAe?`
Tree is too large, part of the tree has been dunped
`:"")};var $m=(i=>(i.WORKSPACES="workspaces",i.DEPENDENCIES="dependencies",i.NONE="none",i))($m||{}),kAe="node_modules",Ou="$wsroot$";var eE=(r,e)=>{let{packageTree:t,hoistingLimits:i,errors:n,preserveSymlinksRequired:s}=F8e(r,e),o=null;if(n.length===0){let a=PAe(t,{hoistingLimits:i});o=L8e(r,a,e)}return{tree:o,errors:n,preserveSymlinksRequired:s}},sa=r=>`${r.name}@${r.reference}`,MO=r=>{let e=new Map;for(let[t,i]of r.entries())if(!i.dirList){let n=e.get(i.locator);n||(n={target:i.target,linkType:i.linkType,locations:[],aliases:i.aliases},e.set(i.locator,n)),n.locations.push(t)}for(let t of e.values())t.locations=t.locations.sort((i,n)=>{let s=i.split(x.delimiter).length,o=n.split(x.delimiter).length;return n===i?0:s!==o?o-s:n>i?1:-1});return e},RAe=(r,e)=>{let t=P.isVirtualLocator(r)?P.devirtualizeLocator(r):r,i=P.isVirtualLocator(e)?P.devirtualizeLocator(e):e;return P.areLocatorsEqual(t,i)},OO=(r,e,t,i)=>{if(r.linkType!=="SOFT")return!1;let n=K.toPortablePath(t.resolveVirtual&&e.reference&&e.reference.startsWith("virtual:")?t.resolveVirtual(r.packageLocation):r.packageLocation);return x.contains(i,n)===null},R8e=r=>{let e=r.getPackageInformation(r.topLevel);if(e===null)throw new Error("Assertion failed: Expected the top-level package to have been registered");if(r.findPackageLocator(e.packageLocation)===null)throw new Error("Assertion failed: Expected the top-level package to have a physical locator");let i=K.toPortablePath(e.packageLocation.slice(0,-1)),n=new Map,s={children:new Map},o=r.getDependencyTreeRoots(),a=new Map,l=new Set,c=(f,h)=>{let p=sa(f);if(l.has(p))return;l.add(p);let C=r.getPackageInformation(f);if(C){let y=h?sa(h):"";if(sa(f)!==y&&C.linkType==="SOFT"&&!OO(C,f,r,i)){let B=FAe(C,f,r);(!a.get(B)||f.reference.startsWith("workspace:"))&&a.set(B,f)}for(let[B,v]of C.packageDependencies)v!==null&&(C.packagePeers.has(B)||c(r.getLocator(B,v),f))}};for(let f of o)c(f,null);let u=i.split(x.sep);for(let f of a.values()){let h=r.getPackageInformation(f),C=K.toPortablePath(h.packageLocation.slice(0,-1)).split(x.sep).slice(u.length),y=s;for(let B of C){let v=y.children.get(B);v||(v={children:new Map},y.children.set(B,v)),y=v}y.workspaceLocator=f}let g=(f,h)=>{if(f.workspaceLocator){let p=sa(h),C=n.get(p);C||(C=new Set,n.set(p,C)),C.add(f.workspaceLocator)}for(let p of f.children.values())g(p,f.workspaceLocator||h)};for(let f of s.children.values())g(f,s.workspaceLocator);return n},F8e=(r,e)=>{let t=[],i=!1,n=new Map,s=R8e(r),o=r.getPackageInformation(r.topLevel);if(o===null)throw new Error("Assertion failed: Expected the top-level package to have been registered");let a=r.findPackageLocator(o.packageLocation);if(a===null)throw new Error("Assertion failed: Expected the top-level package to have a physical locator");let l=K.toPortablePath(o.packageLocation.slice(0,-1)),c={name:a.name,identName:a.name,reference:a.reference,peerNames:o.packagePeers,dependencies:new Set,dependencyKind:1},u=new Map,g=(h,p)=>`${sa(p)}:${h}`,f=(h,p,C,y,B,v,D,L)=>{var re,O;let H=g(h,C),j=u.get(H),$=!!j;!$&&C.name===a.name&&C.reference===a.reference&&(j=c,u.set(H,c));let V=OO(p,C,r,l);if(!j){let F=0;V?F=2:p.linkType==="SOFT"&&C.name.endsWith(Ou)&&(F=1),j={name:h,identName:C.name,reference:C.reference,dependencies:new Set,peerNames:F===1?new Set:p.packagePeers,dependencyKind:F},u.set(H,j)}let W;if(V?W=2:B.linkType==="SOFT"?W=1:W=0,j.hoistPriority=Math.max(j.hoistPriority||0,W),L&&!V){let F=sa({name:y.identName,reference:y.reference}),ue=n.get(F)||new Set;n.set(F,ue),ue.add(j.name)}let _=new Map(p.packageDependencies);if(e.project){let F=e.project.workspacesByCwd.get(K.toPortablePath(p.packageLocation.slice(0,-1)));if(F){let ue=new Set([...Array.from(F.manifest.peerDependencies.values(),he=>P.stringifyIdent(he)),...Array.from(F.manifest.peerDependenciesMeta.keys())]);for(let he of ue)_.has(he)||(_.set(he,v.get(he)||null),j.peerNames.add(he))}}let A=sa({name:C.name.replace(Ou,""),reference:C.reference}),ae=s.get(A);if(ae)for(let F of ae)_.set(`${F.name}${Ou}`,F.reference);(p!==B||p.linkType!=="SOFT"||!V&&(!e.selfReferencesByCwd||e.selfReferencesByCwd.get(D)))&&y.dependencies.add(j);let ge=C!==a&&p.linkType==="SOFT"&&!C.name.endsWith(Ou)&&!V;if(!$&&!ge){let F=new Map;for(let[ue,he]of _)if(he!==null){let ke=r.getLocator(ue,he),Fe=r.getLocator(ue.replace(Ou,""),he),Ne=r.getPackageInformation(Fe);if(Ne===null)throw new Error("Assertion failed: Expected the package to have been registered");let oe=OO(Ne,ke,r,l);if(e.validateExternalSoftLinks&&e.project&&oe){Ne.packageDependencies.size>0&&(i=!0);for(let[qe,ne]of Ne.packageDependencies)if(ne!==null){let Y=P.parseLocator(Array.isArray(ne)?`${ne[0]}@${ne[1]}`:`${qe}@${ne}`);if(sa(Y)!==sa(ke)){let pe=_.get(qe);if(pe){let ie=P.parseLocator(Array.isArray(pe)?`${pe[0]}@${pe[1]}`:`${qe}@${pe}`);RAe(ie,Y)||t.push({messageName:71,text:`Cannot link ${P.prettyIdent(e.project.configuration,P.parseIdent(ke.name))} into ${P.prettyLocator(e.project.configuration,P.parseLocator(`${C.name}@${C.referenceLine truncated
`;for(let s=0,o=r.length;s<o;++s)n+=i+WQ(String(s),r[s],e,i).replace(/^ +/,""),s+1<o&&(n+=","),n+=`
`;return n+=t,n+="]",n}function M8e(r,e,t){let i=Object.keys(r),n="";n+="{";for(let s=0,o=i.length,a=0;s<o;++s){let l=i[s],c=r[l];typeof c>"u"||(a!==0&&(n+=", "),n+=JSON.stringify(l),n+=": ",n+=WQ(l,c,e,t).replace(/^ +/g,""),a+=1)}return n+="}",n}function K8e(r,e,t){let i=Object.keys(r),n=`${t} `,s="";s+=t,s+=`{
`;let o=0;for(let a=0,l=i.length;a<l;++a){let c=i[a],u=r[c];typeof u>"u"||(o!==0&&(s+=",",s+=`
`),s+=n,s+=JSON.stringify(c),s+=": ",s+=WQ(c,u,e,n).replace(/^ +/g,""),o+=1)}return o!==0&&(s+=`
`),s+=t,s+="}",s}function WQ(r,e,t,i){let{next:n}=NAe[t],s=n[r]||n["*"];return LAe(e,s,i)}function LAe(r,e,t){let{collapsed:i}=NAe[e];return Array.isArray(r)?i?T8e(r,e,t):O8e(r,e,t):typeof r=="object"&&r!==null?i?M8e(r,e,t):K8e(r,e,t):JSON.stringify(r)}function TAe(r){return LAe(r,"TOP_LEVEL","")}function tE(r,e){let t=Array.from(r);Array.isArray(e)||(e=[e]);let i=[];for(let s of e)i.push(t.map(o=>s(o)));let n=t.map((s,o)=>o);return n.sort((s,o)=>{for(let a of i){let l=a[s]<a[o]?-1:a[s]>a[o]?1:0;if(l!==0)return l}return 0}),n.map(s=>t[s])}function U8e(r){let e=new Map,t=tE(r.fallbackExclusionList||[],[({name:i,reference:n})=>i,({name:i,reference:n})=>n]);for(let{name:i,reference:n}of t){let s=e.get(i);typeof s>"u"&&e.set(i,s=new Set),s.add(n)}return Array.from(e).map(([i,n])=>[i,Array.from(n)])}function H8e(r){return tE(r.fallbackPool||[],([e])=>e)}function G8e(r){let e=[];for(let[t,i]of tE(r.packageRegistry,([n])=>n===null?"0":`1${n}`)){let n=[];e.push([t,n]);for(let[s,{packageLocation:o,packageDependencies:a,packagePeers:l,linkType:c,discardFromLookup:u}]of tE(i,([g])=>g===null?"0":`1${g}`)){let g=[];t!==null&&s!==null&&!a.has(t)&&g.push([t,s]);for(let[p,C]of tE(a.entries(),([y])=>y))g.push([p,C]);let f=l&&l.size>0?Array.from(l):void 0,h=u||void 0;n.push([s,{packageLocation:o,packageDependencies:g,packagePeers:f,linkType:c,discardFromLookup:h}])}}return e}function rE(r){return{__info:["This file is automatically generated. Do not touch it, or risk","your modifications being lost. We also recommend you not to read","it either without using the @yarnpkg/pnp package, as the data layout","is entirely unspecified and WILL change from a version to another."],dependencyTreeRoots:r.dependencyTreeRoots,enableTopLevelFallback:r.enableTopLevelFallback||!1,ignorePatternData:r.ignorePattern||null,fallbackExclusionList:U8e(r),fallbackPool:H8e(r),packageRegistryData:G8e(r)}}var KAe=Pe(MAe());function UAe(r,e){return[r?`${r}
`:"",`/* eslint-disable */
`,`"use strict";
`,`
`,`function $$SETUP_STATE(hydrateRuntimeState, basePath) {
`,e.replace(/^/gm," "),`}
`,`
`,(0,KAe.default)()].join("")}function Y8e(r){return JSON.stringify(r,null,2)}function j8e(r){return`'${r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,`\\
`)}'`}function q8e(r){return[`return hydrateRuntimeState(JSON.parse(${j8e(TAe(r))}), {basePath: basePath || __dirname});
`].join("")}function J8e(r){return[`var path = require('path');
`,`var dataLocation = path.resolve(__dirname, ${JSON.stringify(r)});
`,`return hydrateRuntimeState(require(dataLocation), {basePath: basePath || path.dirname(dataLocation)});
`].join("")}function HAe(r){let e=rE(r),t=q8e(e);return UAe(r.shebang,t)}function GAe(r){let e=rE(r),t=J8e(r.dataLocation),i=UAe(r.shebang,t);return{dataFile:Y8e(e),loaderFile:i}}var gle=J("fs");var fle=J("util");function UO(r,{basePath:e}){let t=K.toPortablePath(e),i=x.resolve(t),n=r.ignorePatternData!==null?new RegExp(r.ignorePatternData):null,s=new Map,o=new Map(r.packageRegistryData.map(([g,f])=>[g,new Map(f.map(([h,p])=>{var D;if(g===null!=(h===null))throw new Error("Assertion failed: The name and reference should be null, or neither should");let C=(D=p.discardFromLookup)!=null?D:!1,y={name:g,reference:h},B=s.get(p.packageLocation);B?(B.discardFromLookup=B.discardFromLookup&&C,C||(B.locator=y)):s.set(p.packageLocation,{locator:y,discardFromLookup:C});let v=null;return[h,{packageDependencies:new Map(p.packageDependencies),packagePeers:new Set(p.packagePeers),linkType:p.linkType,discardFromLookup:C,get packageLocation(){return v||(v=x.join(i,p.packageLocation))}}]}))])),a=new Map(r.fallbackExclusionList.map(([g,f])=>[g,new Set(f)])),l=new Map(r.fallbackPool),c=r.dependencyTreeRoots,u=r.enableTopLevelFallback;return{basePath:t,dependencyTreeRoots:c,enableTopLevelFallback:u,fallbackExclusionList:a,fallbackPool:l,ignorePattern:n,packageLocatorsByLocations:s,packageRegistry:o}}var AE=J("module");function ep(r,e){if(typeof r=="string")return r;if(r){let t,i;if(Array.isArray(r)){for(t=0;t<r.length;t++)if(i=ep(r[t],e))return i}else for(t in r)if(e.has(t))return ep(r[t],e)}}function Mu(r,e,t){throw new Error(t?`No known conditions for "${e}" entry in "${r}" package`:`Missing "${e}" export in "${r}" package`)}function W8e(r,e){return e===r?".":e[0]==="."?e:e.replace(new RegExp("^"+r+"/"),"./")}function YAe(r,e=".",t={}){let{name:i,exports:n}=r;if(n){let{browser:s,require:o,unsafe:a,conditions:l=[]}=t,c=W8e(i,e);if(c[0]!=="."&&(c="./"+c),typeof n=="string")return c==="."?n:Mu(i,c);let u=new Set(["default",...l]);a||u.add(o?"require":"import"),a||u.add(s?"browser":"node");let g,f,h=!1;for(g in n){h=g[0]!==".";break}if(h)return c==="."?ep(n,u)||Mu(i,c,1):Mu(i,c);if(f=n[c])return ep(f,u)||Mu(i,c,1);for(g in n){if(f=g[g.length-1],f==="/"&&c.startsWith(g))return(f=ep(n[g],u))?f+c.substring(g.length):Mu(i,c,1);if(f==="*"&&c.startsWith(g.slice(0,-1))&&c.substring(g.length-1).length>0)return(f=ep(n[g],u))?f.replace("*",c.substring(g.length-1)):Mu(i,c,1)}return Mu(i,c)}}var rp=J("url"),WO=J("util");var go=J("url");var XAe=Pe(J("assert"));var jAe=Array.isArray,iE=JSON.stringify,HO=Object.getOwnPropertyNames,tp=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),GO=(r,e)=>RegExp.prototype.exec.call(r,e),YO=(r,...e)=>RegExp.prototype[Symbol.replace].apply(r,e),nE=(r,...e)=>String.prototype.endsWith.apply(r,e),qAe=(r,...e)=>String.prototype.includes.apply(r,e),JAe=(r,...e)=>String.prototype.lastIndexOf.apply(r,e),zQ=(r,...e)=>String.prototype.indexOf.apply(r,e),WAe=(r,...e)=>String.prototype.replace.apply(r,e),sE=(r,...e)=>String.prototype.slice.apply(r,e),cA=(r,...e)=>String.prototype.startsWith.apply(r,e),zAe=Map,VAe=JSON.parse;function VQ(r,e,t){return class extends t{constructor(...i){super(e(...i)),this.code=r,this.name=`${t.name} [${r}]`}}}var ZAe=VQ("ERR_PACKAGE_IMPORT_NOT_DEFINED",(r,e,t)=>`Package import specifier "${r}" is not defined${e?` in package ${e}package.json`:""} imported from ${t}`,TypeError),jO=VQ("ERR_INVALID_MODULE_SPECIFIER",(r,e,t=void 0)=>`Invalid module "${r}" ${e}${t?` imported from ${t}`:""}`,TypeError),_Ae=VQ("ERR_INVALID_PACKAGE_TARGET",(r,e,t,i=!1,n=void 0)=>{let s=typeof t=="string"&&!i&&t.length&&!cA(t,"./");return e==="."?((0,XAe.default)(i===!1),`Invalid "exports" main target ${iE(t)} defined in the package config ${r}package.json${n?` imported from ${n}`:""}${s?'; targets must start with "./"':""}`):`Invalid "${i?"imports":"exports"}" target ${iE(t)} defined for '${e}' in the package config ${r}package.json${n?` imported from ${n}`:""}${s?'; targets must start with "./"':""}`},Error),XQ=VQ("ERR_INVALID_PACKAGE_CONFIG",(r,e,t)=>`Invalid package config ${r}${e?` while importing ${e}`:""}${t?`. ${t}`:""}`,Error);var _Q=J("url");function $Ae(r,e){let t=Object.create(null);for(let i=0;i<e.length;i++){let n=e[i];tp(r,n)&&(t[n]=r[n])}return t}var ZQ=new zAe;function z8e(r,e,t,i){let n=ZQ.get(r);if(n!==void 0)return n;let s=i(r);if(s===void 0){let h={pjsonPath:r,exists:!1,main:void 0,name:void 0,type:"none",exports:void 0,imports:void 0};return ZQ.set(r,h),h}let o;try{o=VAe(s)}catch(h){throw new XQ(r,(t?`"${e}" from `:"")+(0,_Q.fileURLToPath)(t||e),h.message)}let{imports:a,main:l,name:c,type:u}=$Ae(o,["imports","main","name","type"]),g=tp(o,"exports")?o.exports:void 0;(typeof a!="object"||a===null)&&(a=void 0),typeof l!="string"&&(l=void 0),typeof c!="string"&&(c=void 0),u!=="module"&&u!=="commonjs"&&(u="none");let f={pjsonPath:r,exists:!0,main:l,name:c,type:u,exports:g,imports:a};return ZQ.set(r,f),f}function ele(r,e){let t=new URL("./package.json",r);for(;;){let s=t.pathname;if(nE(s,"node_modules/p Line truncated
`),t;o=r[++s]}else if(o===" "&&!i){n=!0;continue}else if(o==='"'){i=!i;continue}n?(t.push(o),n=!1):t[t.length-1]+=o}return i&&e.push(`invalid value for NODE_OPTIONS (unterminated string)
`),t}var cle=J("module");var[ho,Ku]=process.versions.node.split(".").map(r=>parseInt(r,10)),$wt=ho>16||ho===16&&Ku>=12,eBt=ho>17||ho===17&&Ku>=5||ho===16&&Ku>=15,tBt=ho>17||ho===17&&Ku>=1||ho===16&&Ku>14,lle=ho>19||ho===19&&Ku>=2||ho===18&&Ku>=13;var nze=new Set(cle.Module.builtinModules||Object.keys(process.binding("natives"))),eb=r=>r.startsWith("node:")||nze.has(r);function ule(r){if(process.env.WATCH_REPORT_DEPENDENCIES&&process.send)if(r=r.map(e=>K.fromPortablePath(Br.resolveVirtual(K.toPortablePath(e)))),lle)process.send({"watch:require":r});else for(let e of r)process.send({"watch:require":e})}function zO(r,e){let t=Number(process.env.PNP_ALWAYS_WARN_ON_FALLBACK)>0,i=Number(process.env.PNP_DEBUG_LEVEL),n=/^(?![a-zA-Z]:[\\/]|\\\\|\.{0,2}(?:\/|$))((?:node:)?(?:@[^/]+\/)?[^/]+)\/*(.*|)$/,s=/^(\/|\.{1,2}(\/|$))/,o=/\/$/,a=/^\.{0,2}\//,l={name:null,reference:null},c=[],u=new Set;if(r.enableTopLevelFallback===!0&&c.push(l),e.compatibilityMode!==!1)for(let oe of["react-scripts","gatsby"]){let le=r.packageRegistry.get(oe);if(le)for(let we of le.keys()){if(we===null)throw new Error("Assertion failed: This reference shouldn't be null");c.push({name:oe,reference:we})}}let{ignorePattern:g,packageRegistry:f,packageLocatorsByLocations:h}=r;function p(oe,le){return{fn:oe,args:le,error:null,result:null}}function C(oe){var qe,ne,Y,pe,ie,de;let le=(Y=(ne=(qe=process.stderr)==null?void 0:qe.hasColors)==null?void 0:ne.call(qe))!=null?Y:process.stdout.isTTY,we=(_e,Pt)=>`\x1B[${_e}m${Pt}\x1B[0m`,fe=oe.error;console.error(fe?we("31;1",`\u2716 ${(pe=oe.error)==null?void 0:pe.message.replace(/\n.*/s,"")}`):we("33;1","\u203C Resolution")),oe.args.length>0&&console.error();for(let _e of oe.args)console.error(` ${we("37;1","In \u2190")} ${(0,WO.inspect)(_e,{colors:le,compact:!0})}`);oe.result&&(console.error(),console.error(` ${we("37;1","Out \u2192")} ${(0,WO.inspect)(oe.result,{colors:le,compact:!0})}`));let Ae=(de=(ie=new Error().stack.match(/(?<=^ +)at.*/gm))==null?void 0:ie.slice(2))!=null?de:[];if(Ae.length>0){console.error();for(let _e of Ae)console.error(` ${we("38;5;244",_e)}`)}console.error()}function y(oe,le){if(e.allowDebug===!1)return le;if(Number.isFinite(i)){if(i>=2)return(...we)=>{let fe=p(oe,we);try{return fe.result=le(...we)}catch(Ae){throw fe.error=Ae}finally{C(fe)}};if(i>=1)return(...we)=>{try{return le(...we)}catch(fe){let Ae=p(oe,we);throw Ae.error=fe,C(Ae),fe}}}return le}function B(oe){let le=A(oe);if(!le)throw ri("INTERNAL","Couldn't find a matching entry in the dependency tree for the specified parent (this is probably an internal error)");return le}function v(oe){if(oe.name===null)return!0;for(let le of r.dependencyTreeRoots)if(le.name===oe.name&&le.reference===oe.reference)return!0;return!1}let D=new Set(["default","node","require",...Ale("--conditions")]);function L(oe,le=D){let we=re(x.join(oe,"internal.js"),{resolveIgnored:!0,includeDiscardFromLookup:!0});if(we===null)throw ri("INTERNAL",`The locator that owns the "${oe}" path can't be found inside the dependency tree (this is probably an internal error)`);let{packageLocation:fe}=B(we),Ae=x.join(fe,xt.manifest);if(!e.fakeFs.existsSync(Ae))return null;let qe=JSON.parse(e.fakeFs.readFileSync(Ae,"utf8")),ne=x.contains(fe,oe);if(ne===null)throw ri("INTERNAL","unqualifiedPath doesn't contain the packageLocation (this is probably an internal error)");a.test(ne)||(ne=`./${ne}`);let Y;try{Y=YAe(qe,x.normalize(ne),{conditions:le,unsafe:!0})}catch(pe){throw ri("EXPORTS_RESOLUTION_FAILED",pe.message,{unqualifiedPath:fo(oe),locator:we,pkgJson:qe,subpath:fo(ne),conditions:le},"ERR_PACKAGE_PATH_NOT_EXPORTED")}return typeof Y=="string"?x.join(fe,Y):null}function H(oe,le,{extensions:we}){let fe;try{le.push(oe),fe=e.fakeFs.statSync(oe)}catch{}if(fe&&!fe.isDirectory())return e.fakeFs.realpathSync(oe);if(fe&&fe.isDirectory()){let Ae;try{Ae=JSON.parse(e.fakeFs.readFileSync(x.join(oe,xt.manifest),"utf8"))}catch{}let qe;if(Ae&&Ae.main&&(qe=x.resolve(oe,Ae.main)),qe&&qe!==oe){let ne=H(qe,le,{extensions:we});if(ne!==null)return ne}}for(let Ae=0,qe=we.length;Ae<qe;Ae++){let ne=`${oe}${we[Ae]}`;if(le.push(ne),e.fakeFs.existsSync(ne))return ne}if(fe&&fe.isDirectory())for(let Ae=0,qe=we.length;Ae<qe;Ae++){let ne=x.format({dir:oe,name:"index",ext:we[Ae]});if(le.push(ne),e.fakeFs.existsSync(ne))return ne}return null}function j(oe){let le=new AE.Module(oe,null);return le.filename=oe,le.paths=AE.Module._nodeModulePaths(oe),le}function $(oe,le){return le.endsWith("/")&&(le=x.join(le,"internal.js")),AE.Module._resolveFilename(K.fromPortablePath(oe),j(K.fromPortablePath(le)),!1,{plugnplay:!1})}function V(oe){if(g===null)return!1;let le=x.contains(r.basePath,oe);return le===null?!1:!!g.test(le.replace(/\/$/,""))}let W={std:3,resolveVirtual:1,getAllLocators:1},_=l;function A({name:oe,reference:le}){let we=f.get(oe);if(!we)return null;let fe=we.get(le);return fe||null}function ae({name:oe,reference:le}){let we=[];for(let[fe,Ae]of f)if(fe!==null)for(let[qe,ne]of Ae)qe===null||ne.pacLine truncated
Require request: "${fe}"
Required by: ${Ae}
`,{request:fe,issuer:Ae});return K.toPortablePath(Y)}let qe,ne=oe.match(n);if(ne){if(!le)throw ri("API_ERROR","The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute",{request:fe,issuer:Ae});let[,Y,pe]=ne,ie=re(le);if(!ie){let hr=$(oe,le);if(hr===!1)throw ri("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: "${fe}"
Required by: ${Ae}
`,{request:fe,issuer:Ae});return K.toPortablePath(hr)}let _e=B(ie).packageDependencies.get(Y),Pt=null;if(_e==null&&ie.name!==null){let hr=r.fallbackExclusionList.get(ie.name);if(!hr||!hr.has(ie.reference)){for(let ni=0,Os=c.length;ni<Os;++ni){let Ii=B(c[ni]).packageDependencies.get(Y);if(Ii!=null){t?Pt=Ii:_e=Ii;break}}if(r.enableTopLevelFallback&&_e==null&&Pt===null){let ni=r.fallbackPool.get(Y);ni!=null&&(Pt=ni)}}}let It=null;if(_e===null)if(v(ie))It=ri("MISSING_PEER_DEPENDENCY",`Your application tried to access ${Y} (a peer dependency); this isn't allowed as there is no ancestor to satisfy the requirement. Use a devDependency if needed.
Required package: ${Y}${Y!==fe?` (via "${fe}")`:""}
Required by: ${Ae}
`,{request:fe,issuer:Ae,dependencyName:Y});else{let hr=ge(Y,ie);hr.every(fi=>v(fi))?It=ri("MISSING_PEER_DEPENDENCY",`${ie.name} tried to access ${Y} (a peer dependency) but it isn't provided by your application; this makes the require call ambiguous and unsound.
Required package: ${Y}${Y!==fe?` (via "${fe}")`:""}
Required by: ${ie.name}@${ie.reference} (via ${Ae})
${hr.map(fi=>`Ancestor breaking the chain: ${fi.name}@${fi.reference}
`).join("")}
`,{request:fe,issuer:Ae,issuerLocator:Object.assign({},ie),dependencyName:Y,brokenAncestors:hr}):It=ri("MISSING_PEER_DEPENDENCY",`${ie.name} tried to access ${Y} (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.
Required package: ${Y}${Y!==fe?` (via "${fe}")`:""}
Required by: ${ie.name}@${ie.reference} (via ${Ae})
${hr.map(fi=>`Ancestor breaking the chain: ${fi.name}@${fi.reference}
`).join("")}
`,{request:fe,issuer:Ae,issuerLocator:Object.assign({},ie),dependencyName:Y,brokenAncestors:hr})}else _e===void 0&&(!we&&eb(oe)?v(ie)?It=ri("UNDECLARED_DEPENDENCY",`Your application tried to access ${Y}. 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 ${Y} isn't otherwise declared in your dependencies, this makes the require call ambiguous and unsound.
Required package: ${Y}${Y!==fe?` (via "${fe}")`:""}
Required by: ${Ae}
`,{request:fe,issuer:Ae,dependencyName:Y}):It=ri("UNDECLARED_DEPENDENCY",`${ie.name} tried to access ${Y}. 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 ${Y} isn't otherwise declared in ${ie.name}'s dependencies, this makes the require call ambiguous and unsound.
Required package: ${Y}${Y!==fe?` (via "${fe}")`:""}
Required by: ${Ae}
`,{request:fe,issuer:Ae,issuerLocator:Object.assign({},ie),dependencyName:Y}):v(ie)?It=ri("UNDECLARED_DEPENDENCY",`Your application tried to access ${Y}, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.
Required package: ${Y}${Y!==fe?` (via "${fe}")`:""}
Required by: ${Ae}
`,{request:fe,issuer:Ae,dependencyName:Y}):It=ri("UNDECLARED_DEPENDENCY",`${ie.name} tried to access ${Y}, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: ${Y}${Y!==fe?` (via "${fe}")`:""}
Required by: ${ie.name}@${ie.reference} (via ${Ae})
`,{request:fe,issuer:Ae,issuerLocator:Object.assign({},ie),dependencyName:Y}));if(_e==null){if(Pt===null||It===null)throw It||new Error("Assertion failed: Expected an error to have been set");_e=Pt;let hr=It.message.replace(/\n.*/g,"");It.message=hr,!u.has(hr)&&i!==0&&(u.add(hr),process.emitWarning(It))}let Or=Array.isArray(_e)?{name:_e[0],reference:_e[1]}:{name:Y,reference:_e},ii=B(Or);if(!ii.packageLocation)throw ri("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: ${Or.name}@${Or.reference}${Or.name!==fe?` (via "${fe}")`:""}
Required by: ${ie.name}@${ie.reference} (via ${Ae})
`,{request:fe,issuer:Ae,dependencyLocator:Object.assign({},Or)});let gi=ii.packageLocation;pe?qe=x.join(gi,pe):qe=gi}else if(x.isAbsolute(oe))qe=x.normalize(oe);else{if(!le)throw ri("API_ERROR","The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute",{request:fe,issuer:Ae});let Y=x.resolve(le);le.match(o)?qe=x.normalize(x.join(Y,oe)):qe=x.normalize(x.join(x.dirname(Y),oe))}return x.normalize(qe)}function ue(oe,le,we=D){if(s.test(oe))return le;let fe=L(le,we);return fe?x.normalize(fe):le}function he(oe,{extensions:le=Object.keys(AE.Module._extensions)}={}){var Ae,qe;let we=[],fe=H(oe,we,{extensions:le});if(fe)return x.normalize(fe);{ule(we.map(pe=>K.fromPortablePath(pe)));let ne=fo(oe),Y=re(oe);if(Y){let{packageLocation:pe}=B(Y),ie=!0;try{e.fakeFs.accessSync(pe)}catch(de){if((de==null?void 0:de.code)==="ENOENT")ie=!1;else{let _e=((qe=(Ae=de==null?void 0:de.message)!=null?Ae:de)!=null?qe:"empty exception thrown").replace(/^[A-Z]/,Pt=>Pt.toLowerCase());throw ri("QUALIFIED_PATH_RESOLUTION_FAILED",`Required package exists but could not be accessed (${_e}).
Missing package: ${Y.name}@${Y.reference}
Expected package location: ${fo(pe)}
`,{unqualifiedPath:ne,extensions:le})}}if(!ie){let de=pe.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 ri("QUALIFIED_PATH_RESOLUTION_FAILED",`${de}
Missing package: ${Y.name}@${Y.reference}
Expected package location: ${fo(pe)}
`,{unqualifiedPath:ne,extensions:le})}}throw ri("QUALIFIED_PATH_RESOLUTION_FAILED",`Qualified path resolution failed: we looked for the following paths, but none could be accessed.
Source path: ${ne}
${we.map(pe=>`Not found: ${fo(pe)}
`).join("")}`,{unqualifiedPath:ne,extensions:le})}}function ke(oe,le,we){var Ae;if(!le)throw new Error("Assertion failed: An issuer is required to resolve private import mappings");let fe=ile({name:oe,base:(0,rp.pathToFileURL)(K.fromPortablePath(le)),conditions:(Ae=we.conditions)!=null?Ae:D,readFileSyncFn:O});if(fe instanceof rp.URL)return he(K.toPortablePath((0,rp.fileURLToPath)(fe)),{extensions:we.extensions});if(fe.startsWith("#"))throw new Error("Mapping from one private import to another isn't allowed");return Fe(fe,le,we)}function Fe(oe,le,we={}){try{if(oe.startsWith("#"))return ke(oe,le,we);let{considerBuiltins:fe,extensions:Ae,conditions:qe}=we,ne=F(oe,le,{considerBuiltins:fe});if(oe==="pnpapi")return ne;if(ne===null)return null;let Y=()=>le!==null?V(le):!1,pe=(!fe||!eb(oe))&&!Y()?ue(oe,ne,qe):ne;return he(pe,{extensions:Ae})}catch(fe){throw Object.prototype.hasOwnProperty.call(fe,"pnpCode")&&Object.assign(fe.data,{request:fo(oe),issuer:le&&fo(le)}),fe}}function Ne(oe){let le=x.normalize(oe),we=Br.resolveVirtual(le);return we!==le?we:null}return{VERSIONS:W,topLevel:_,getLocator:(oe,le)=>Array.isArray(le)?{name:le[0],reference:le[1]}:{name:oe,reference:le},getDependencyTreeRoots:()=>[...r.dependencyTreeRoots],getAllLocators(){let oe=[];for(let[le,we]of f)for(let fe of we.keys())le!==null&&fe!==null&&oe.push({name:le,reference:fe});return oe},getPackageInformation:oe=>{let le=A(oe);if(le===null)return null;let we=K.fromPortablePath(le.packageLocation);return{...le,packageLocation:we}},findPackageLocator:oe=>re(K.toPortablePath(oe)),resolveToUnqualified:y("resolveToUnqualified",(oe,le,we)=>{let fe=le!==null?K.toPortablePath(le):null,Ae=F(K.toPortablePath(oe),fe,we);return Ae===null?null:K.fromPortablePath(Ae)}),resolveUnqualified:y("resolveUnqualified",(oe,le)=>K.fromPortablePath(he(K.toPortablePath(oe),le))),resolveRequest:y("resolveRequest",(oe,le,we)=>{let fe=le!==null?K.toPortablePath(le):null,Ae=Fe(K.toPortablePath(oe),fe,we);return Ae===null?null:K.fromPortablePath(Ae)}),resolveVirtual:y("resolveVirtual",oe=>{let le=Ne(K.toPortablePath(oe));return le!==null?K.fromPortablePath(le):null})}}var EBt=(0,fle.promisify)(gle.readFile);var hle=(r,e,t)=>{let i=rE(r),n=UO(i,{basePath:e}),s=K.join(e,xt.pnpCjs);return zO(n,{fakeFs:t,pnpapiResolution:s})};var XO=Pe(dle());var po={};ut(po,{checkAndReportManifestCompatibility:()=>mle,checkManifestCompatibility:()=>Cle,extractBuildScripts:()=>tb,getExtractHint:()=>ZO,hasBindingGyp:()=>_O});function Cle(r){return P.isPackageCompatible(r,Is.getArchitectureSet())}function mle(r,e,{configuration:t,report:i}){return Cle(r)?!0:(i==null||i.reportWarningOnce(76,`${P.prettyLocator(t,r)} The ${Is.getArchitectureName()} architecture is incompatible with this package, ${e} skipped.`),!1)}function tb(r,e,t,{configuration:i,report:n}){let s=[];for(let a of["preinstall","install","postinstall"])e.manifest.scripts.has(a)&&s.push([0,a]);return!e.manifest.scripts.has("install")&&e.misc.hasBindingGyp&&s.push([1,"node-gyp rebuild"]),s.length===0?[]:r.linkType!=="HARD"?(n==null||n.reportWarningOnce(6,`${P.prettyLocator(i,r)} lists build scripts, but is referenced through a soft link. Soft links don't support build scripts, so they'll be ignored.`),[]):t&&t.built===!1?(n==null||n.reportInfoOnce(5,`${P.prettyLocator(i,r)} lists build scripts, but its build has been explicitly disabled through configuration.`),[]):!i.get("enableScripts")&&!t.built?(n==null||n.reportWarningOnce(4,`${P.prettyLocator(i,r)} lists build scripts, but all build scripts have been disabled.`),[]):mle(r,"build",{configuration:i,report:n})?s:[]}var oze=new Set([".exe",".h",".hh",".hpp",".c",".cc",".cpp",".java",".jar",".node"]);function ZO(r){return r.packageFs.getExtractHint({relevantExtensions:oze})}function _O(r){let e=x.join(r.prefixPath,"binding.gyp");return r.packageFs.existsSync(e)}var cE={};ut(cE,{getUnpluggedPath:()=>lE});function lE(r,{configuration:e}){return x.resolve(e.get("pnpUnpluggedFolder"),P.slugifyLocator(r))}var aze=new Set([P.makeIdent(null,"open").identHash,P.makeIdent(null,"opn").identHash]),ml=class{constructor(){this.mode="strict";this.pnpCache=new Map}supportsPackage(e,t){return this.isEnabled(t)}async findPackageLocation(e,t){if(!this.isEnabled(t))throw new Error("Assertion failed: Expected the PnP linker to be enabled");let i=El(t.project).cjs;if(!M.existsSync(i))throw new be(`The project in ${ee.pretty(t.project.configuration,`${t.project.cwd}/package.json`,ee.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let n=Ie.getFactoryWithDefault(this.pnpCache,i,()=>Ie.dynamicRequire(i,{cachingStrategy:Ie.CachingStrategy.FsTime})),s={name:P.stringifyIdent(e),reference:e.reference},o=n.getPackageInformation(s);if(!o)throw new be(`Couldn't find ${P.prettyLocator(t.project.configuration,e)} in the currently installed PnP map - running an install might help`);return K.toPortablePath(o.packageLocation)}async findPackageLocator(e,t){if(!this.isEnabled(t))returLine truncated
`,s+=`# cause your node_modules installation to become invalidated.
`,s+=`
`,s+=`__metadata:
`,s+=` version: ${Rle}
`,s+=` nmMode: ${i.value}
`;let o=Array.from(e.keys()).sort(),a=P.stringifyLocator(r.topLevelWorkspace.anchoredLocator);for(let u of o){let g=e.get(u);s+=`
`,s+=`${JSON.stringify(u)}:
`,s+=` locations:
`;for(let f of g.locations){let h=x.contains(r.cwd,f);if(h===null)throw new Error(`Assertion failed: Expected the path to be within the project (${f})`);s+=` - ${JSON.stringify(h)}
`}if(g.aliases.length>0){s+=` aliases:
`;for(let f of g.aliases)s+=` - ${JSON.stringify(f)}
`}if(u===a&&t.size>0){s+=` bin:
`;for(let[f,h]of t){let p=x.contains(r.cwd,f);if(p===null)throw new Error(`Assertion failed: Expected the path to be within the project (${f})`);s+=` ${JSON.stringify(p)}:
`;for(let[C,y]of h){let B=x.relative(x.join(f,kr),y);s+=` ${JSON.stringify(C)}: ${JSON.stringify(B)}
`}}}}let l=r.cwd,c=x.join(l,kr,Fle);n&&await M.removePromise(c),await M.changeFilePromise(c,s,{automaticNewlines:!0})}async function oM(r,{unrollAliases:e=!1}={}){let t=r.cwd,i=x.join(t,kr,Fle),n;try{n=await M.statPromise(i)}catch{}if(!n)return null;let s=yi(await M.readFilePromise(i,"utf8"));if(s.__metadata.version>Rle)return null;let o=s.__metadata.nmMode||"classic",a=new Map,l=new Map;delete s.__metadata;for(let[c,u]of Object.entries(s)){let g=u.locations.map(h=>x.join(t,h)),f=u.bin;if(f)for(let[h,p]of Object.entries(f)){let C=x.join(t,K.toPortablePath(h)),y=Ie.getMapWithDefault(l,C);for(let[B,v]of Object.entries(p))y.set(Ur(B),K.toPortablePath([C,kr,v].join(x.sep)))}if(a.set(c,{target:Oe.dot,linkType:"HARD",locations:g,aliases:u.aliases||[]}),e&&u.aliases)for(let h of u.aliases){let{scope:p,name:C}=P.parseLocator(c),y=P.makeLocator(P.makeIdent(p,C),h),B=P.stringifyLocator(y);a.set(B,{target:Oe.dot,linkType:"HARD",locations:g,aliases:[]})}}return{locatorMap:a,binSymlinks:l,locationTree:Nle(a,{skipPrefix:r.cwd}),nmMode:o,mtimeMs:n.mtimeMs}}var np=async(r,e)=>{if(r.split(x.sep).indexOf(kr)<0)throw new Error(`Assertion failed: trying to remove dir that doesn't contain node_modules: ${r}`);try{if(!e.innerLoop){let i=e.allowSymlink?await M.statPromise(r):await M.lstatPromise(r);if(e.allowSymlink&&!i.isDirectory()||!e.allowSymlink&&i.isSymbolicLink()){await M.unlinkPromise(r);return}}let t=await M.readdirPromise(r,{withFileTypes:!0});for(let i of t){let n=x.join(r,Ur(i.name));i.isDirectory()?(i.name!==kr||e&&e.innerLoop)&&await np(n,{innerLoop:!0,contentsOnly:!1}):await M.unlinkPromise(n)}e.contentsOnly||await M.rmdirPromise(r)}catch(t){if(t.code!=="ENOENT"&&t.code!=="ENOTEMPTY")throw t}},xle=4,nb=(r,{skipPrefix:e})=>{let t=x.contains(e,r);if(t===null)throw new Error(`Assertion failed: Writing attempt prevented to ${r} which is outside project root: ${e}`);let i=t.split(x.sep).filter(l=>l!==""),n=i.indexOf(kr),s=i.slice(0,n).join(x.sep),o=x.join(e,s),a=i.slice(n);return{locationRoot:o,segments:a}},Nle=(r,{skipPrefix:e})=>{let t=new Map;if(r===null)return t;let i=()=>({children:new Map,linkType:"HARD"});for(let[n,s]of r.entries()){if(s.linkType==="SOFT"&&x.contains(e,s.target)!==null){let a=Ie.getFactoryWithDefault(t,s.target,i);a.locator=n,a.linkType=s.linkType}for(let o of s.locations){let{locationRoot:a,segments:l}=nb(o,{skipPrefix:e}),c=Ie.getFactoryWithDefault(t,a,i);for(let u=0;u<l.length;++u){let g=l[u];if(g!=="."){let f=Ie.getFactoryWithDefault(c.children,g,i);c.children.set(g,f),c=f}u===l.length-1&&(c.locator=n,c.linkType=s.linkType)}}}return t},AM=async(r,e)=>{let t;try{process.platform==="win32"&&(t=await M.lstatPromise(r))}catch{}process.platform=="win32"&&(!t||t.isDirectory())?await M.symlinkPromise(r,e,"junction"):await M.symlinkPromise(x.relative(x.dirname(e),r),e)};async function Lle(r,e,t){let i=x.join(r,Ur(`${aM.default.randomBytes(16).toString("hex")}.tmp`));try{await M.writeFilePromise(i,t);try{await M.linkPromise(i,e)}catch{}}finally{await M.unlinkPromise(i)}}async function Rze({srcPath:r,dstPath:e,entry:t,globalHardlinksStore:i,baseFs:n,nmMode:s}){if(t.kind===Tle.FILE){if(s.value==="hardlinks-global"&&i&&t.digest){let a=x.join(i,t.digest.substring(0,2),`${t.digest.substring(2)}.dat`),l;try{let c=await M.statPromise(a);if(c&&(!t.mtimeMs||c.mtimeMs>t.mtimeMs||c.mtimeMs<t.mtimeMs-Pze))if(await li.checksumFile(a,{baseFs:M,algorithm:"sha1"})!==t.digest){let g=x.join(i,Ur(`${aM.default.randomBytes(16).toString("hex")}.tmp`));await M.renamePromise(a,g);let f=await n.readFilePromise(r);await M.writeFilePromise(g,f);try{await M.linkPromise(g,a),t.mtimeMs=new Date().getTime(),await M.unlinkPromise(g)}catch{}}else t.mtimeMs||(t.mtimeMs=Math.ceil(c.mtimeMs));await M.linkPromise(a,e),l=!0}catch{l=!1}if(!l){let c=await n.readFilePromise(r);await Lle(i,a,c),t.mtimeMs=new Date().getTime();try{await M.linkPromise(a,e)}catch(u){u&&u.code&&u.code=="EXDEV"&&(s.value="hardlinks-local",await n.copyFilePromise(r,e))}}}else await n.copyFilePromise(r,e);let o=t.mode&511;o!==420&&await M.chmodPromise(e,o)}}var Tle=(i=>(i.FILE="file",i.DIRECTORY="directory",i.SYMLINK="symlink",i))(Tle||{}),Fze=async(r,e,{baseFs:t,globalHardlinksStore:i,nmMode:n,packageChecksum:s})=>{await M.mkdirPromise(r,{recursive:!0});let o=async(c=Oe.dot)=>{let u=x.join(e,c),g=await t.readdirPromise(u,{withFileTypes:!0}),f=new Map;for(let h of g){let p=x.join(c,h.name),C,y=x.join(u,h.name);if(h.isFile()){if(C={kind:"file",mode:(await t.lstatPromise(y)).mode},n.value==="hardlinks-global"){let B=await li.checksumFile(y,{baseFs:t,algorithm:"sha1"});C.digest=B}}else if(h.isDirectory())C={kind:"directory"};else if(h.isSymbolicLink())C={kind:"symlink",symlinkTo:await t.readlinkPromise(y)};else throw new Error(`Unsupported file type (file: ${y}, mode: 0o${await t.statSync(y).mode.toString(8).padStart(6,"0")})`);if(f.set(p,C),h.isDirectory()&&p!==kr){let B=await o(p);for(let[v,D]of B)f.set(v,D)}}return f},a;if(n.value==="hardlinks-global"&&i&&s){let c= Line truncated
`)),process.env.YARN_IS_TEST_ENV)return process.env.YARN_INJECT_NPM_2FA_TOKEN||"";let{otp:i}=await(0,hM.prompt)({type:"password",name:"otp",message:"One-time password:",required:!0,onCancel:()=>process.exit(130)});return process.stdout.write(`
`),i}function Ab(r){var e,t;if(((e=r.originalError)==null?void 0:e.name)!=="HTTPError")return!1;try{return((t=r.originalError)==null?void 0:t.response.headers["www-authenticate"].split(/,\s*/).map(n=>n.toLowerCase())).includes("otp")}catch{return!1}}function sp(r){return{["npm-otp"]:r}}var lb=class{supports(e,t){if(!e.reference.startsWith(gr))return!1;let{selector:i,params:n}=P.parseRange(e.reference);return!(!Yle.default.valid(i)||n===null||typeof n.__archiveUrl!="string")}getLocalPath(e,t){return null}async fetch(e,t){let i=t.checksums.get(e.locatorHash)||null,[n,s,o]=await t.cache.fetchPackageFromCache(e,i,{onHit:()=>t.report.reportCacheHit(e),onMiss:()=>t.report.reportCacheMiss(e,`${P.prettyLocator(t.project.configuration,e)} can't be found in the cache and will be fetched from the remote server`),loader:()=>this.fetchFromNetwork(e,t),skipIntegrityCheck:t.skipIntegrityCheck,...t.cacheOptions});return{packageFs:n,releaseFs:s,prefixPath:P.getIdentVendorPath(e),checksum:o}}async fetchFromNetwork(e,t){let{params:i}=P.parseRange(e.reference);if(i===null||typeof i.__archiveUrl!="string")throw new Error("Assertion failed: The archiveUrl querystring parameter should have been available");let n=await mo(i.__archiveUrl,{configuration:t.project.configuration,ident:e});return await mi.convertToZip(n,{compressionLevel:t.project.configuration.get("compressionLevel"),prefixPath:P.getIdentVendorPath(e),stripComponents:1})}};var cb=class{supportsDescriptor(e,t){return!(!e.range.startsWith(gr)||!P.tryParseDescriptor(e.range.slice(gr.length),!0))}supportsLocator(e,t){return!1}shouldPersistResolution(e,t){throw new Error("Unreachable")}bindDescriptor(e,t,i){return e}getResolutionDependencies(e,t){let i=P.parseDescriptor(e.range.slice(gr.length),!0);return t.resolver.getResolutionDependencies(i,t)}async getCandidates(e,t,i){let n=P.parseDescriptor(e.range.slice(gr.length),!0);return await i.resolver.getCandidates(n,t,i)}async getSatisfying(e,t,i){let n=P.parseDescriptor(e.range.slice(gr.length),!0);return i.resolver.getSatisfying(n,t,i)}resolve(e,t){throw new Error("Unreachable")}};var jle=Pe(Xr()),qle=J("url");var Ns=class{supports(e,t){if(!e.reference.startsWith(gr))return!1;let i=new qle.URL(e.reference);return!(!jle.default.valid(i.pathname)||i.searchParams.has("__archiveUrl"))}getLocalPath(e,t){return null}async fetch(e,t){let i=t.checksums.get(e.locatorHash)||null,[n,s,o]=await t.cache.fetchPackageFromCache(e,i,{onHit:()=>t.report.reportCacheHit(e),onMiss:()=>t.report.reportCacheMiss(e,`${P.prettyLocator(t.project.configuration,e)} can't be found in the cache and will be fetched from the remote registry`),loader:()=>this.fetchFromNetwork(e,t),skipIntegrityCheck:t.skipIntegrityCheck,...t.cacheOptions});return{packageFs:n,releaseFs:s,prefixPath:P.getIdentVendorPath(e),checksum:o}}async fetchFromNetwork(e,t){let i;try{i=await mo(Ns.getLocatorUrl(e),{configuration:t.project.configuration,ident:e})}catch{i=await mo(Ns.getLocatorUrl(e).replace(/%2f/g,"/"),{configuration:t.project.configuration,ident:e})}return await mi.convertToZip(i,{compressionLevel:t.project.configuration.get("compressionLevel"),prefixPath:P.getIdentVendorPath(e),stripComponents:1})}static isConventionalTarballUrl(e,t,{configuration:i}){let n=uA(e.scope,{configuration:i}),s=Ns.getLocatorUrl(e);return t=t.replace(/^https?:(\/\/(?:[^/]+\.)?npmjs.org(?:$|\/))/,"https:$1"),n=n.replace(/^https:\/\/registry\.npmjs\.org($|\/)/,"https://registry.yarnpkg.com$1"),t=t.replace(/^https:\/\/registry\.npmjs\.org($|\/)/,"https://registry.yarnpkg.com$1"),t===n+s||t===n+s.replace(/%2f/g,"/")}static getLocatorUrl(e){let t=vt.clean(e.reference.slice(gr.length));if(t===null)throw new at(10,"The npm semver resolver got selected, but the version isn't semver");return`${yl(e)}/-/${e.name}-${t}.tgz`}};var Jle=Pe(Xr());var ub=P.makeIdent(null,"node-gyp"),Wze=/\b(node-gyp|prebuild-install)\b/,gb=class{supportsDescriptor(e,t){return e.range.startsWith(gr)?!!vt.validRange(e.range.slice(gr.length)):!1}supportsLocator(e,t){if(!e.reference.startsWith(gr))return!1;let{selector:i}=P.parseRange(e.reference);return!!Jle.default.valid(i)}shouldPersistResolution(e,t){return!0}bindDescriptor(e,t,i){return e}getResolutionDependencies(e,t){return[]}async getCandidates(e,t,i){let n=vt.validRange(e.range.slice(gr.length));if(n===null)throw new Error(`Expected a valid range, got ${e.range.slice(gr.length)}`);let s=await mo(yl(e),{configuration:i.project.configuration,ident:e,jsonResponse:!0}),o=Ie.mapAndFilter(Object.keys(s.versions),c=>{try{let u=new vt.SemVer(c);if(n.test(u))return u}catch{}return Ie.mapAndFilter.skip}),a=o.filter(c=>!s.versions[c.raw].deprecated),l=a.length>0?a:o;return l.sort((c,u)=>-c.compare(u)),l.map(c=>{let u=P.makeLocator(e,`${gr}${c.raw}`),g=s.versions[c.raw].dist.tarball;return Ns.isConventionalTarballUrl(u,g,{configuration:i.project.configuration})?u:P.bindLocator(u,{__archiveUrl:g})})}async getSatisfying(e,t,i){let n=vt.validRange(e.range.slice(gr.length));if(n===nulLine 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 ${SE.map(t=>`\`${t}\``).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"]]});var l1=Pe(Xr()),c1=J("util"),Xu=class extends De{constructor(){super(...arguments);this.fields=z.String("-f,--fields",{description:"A comma-separated list of manifest fields that should be displayed"});this.json=z.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.packages=z.Rest()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i}=await je.find(t,this.context.cwd),n=typeof this.fields<"u"?new Set(["name",...this.fields.split(/\s*,\s*/)]):null,s=[],o=!1,a=await Ge.start({configuration:t,includeFooter:!1,json:this.json,stdout:this.context.stdout},async l=>{for(let c of this.packages){let u;if(c==="."){let L=i.topLevelWorkspace;if(!L.manifest.name)throw new be(`Missing ${ee.pretty(t,"name",ee.Type.CODE)} field in ${K.fromPortablePath(x.join(L.cwd,xt.manifest))}`);u=P.makeDescriptor(L.manifest.name,"unknown")}else u=P.parseDescriptor(c);let g=Mt.getIdentUrl(u),f=u1(await Mt.get(g,{configuration:t,ident:u,jsonResponse:!0,customErrorMessage:Mt.customPackageError})),h=Object.keys(f.versions).sort(l1.default.compareLoose),C=f["dist-tags"].latest||h[h.length-1],y=vt.validRange(u.range);if(y){let L=l1.default.maxSatisfying(h,y);L!==null?C=L:(l.reportWarning(0,`Unmet range ${P.prettyRange(t,u.range)}; falling back to the latest version`),o=!0)}else Object.prototype.hasOwnProperty.call(f["dist-tags"],u.range)?C=f["dist-tags"][u.range]:u.range!=="unknown"&&(l.reportWarning(0,`Unknown tag ${P.prettyRange(t,u.range)}; falling back to the latest version`),o=!0);let B=f.versions[C],v={...f,...B,version:C,versions:h},D;if(n!==null){D={};for(let L of n){let H=v[L];if(typeof H<"u")D[L]=H;else{l.reportWarning(1,`The ${ee.pretty(t,L,ee.Type.CODE)} field doesn't exist inside ${P.prettyIdent(t,u)}'s information`),o=!0;continue}}}else this.json||(delete v.dist,delete v.readme,delete v.users),D=v;l.reportJson(D),this.json||s.push(D)}});c1.inspect.styles.name="cyan";for(let l of s)(l!==s[0]||o)&&this.context.stdout.write(`
`),this.context.stdout.write(`${(0,c1.inspect)(l,{depth:1/0,colors:!0,compact:!1})}
`);return a.exitCode()}};Xu.paths=[["npm","info"]],Xu.usage=ve.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 --fields versions"],["Show the readme of react","yarn npm info react --fields readme"],["Show a few fields of react","yarn npm info react --fields homepage,repository"]]});function u1(r){if(Array.isArray(r)){let e=[];for(let t of r)t=u1(t),t&&e.push(t);return e}else if(typeof r=="object"&&r!==null){let e={};for(let t of Object.keys(r)){if(t.startsWith("_"))continue;let i=u1(r[t]);i&&(e[t]=i)}return e}else return r||null}var que=Pe(Om()),Zu=class extends De{constructor(){super(...arguments);this.scope=z.String("-s,--scope",{description:"Login to the registry configured for a given scope"});this.publish=z.Boolean("--publish",!1,{description:"Login to the publish registry"})}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),i=await Kb({configuration:t,cwd:this.context.cwd,publish:this.publish,scope:this.scope});return(await Ge.start({configuration:t,stdout:this.context.stdout,includeFooter:!1},async s=>{let o=await $Ve({configuration:t,registry:i,report:s,stdin:this.context.stdin,stdout:this.context.stdout}),a=`/-/user/org.couchdb.user:${encodeURIComponent(o.name)}`,l=await Mt.put(a,o,{attemptedAs:o.name,configuration:t,registry:i,jsonResponse:!0,authType:Mt.AuthType.NO_AUTH});return await _Ve(i,l.token,{configuration:t,scope:this.scope}),s.reportInfo(0,"Successfully logged in")})).exitCode()}};Zu.paths=[["npm","login"]],Zu.usage=ve.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 function Kb({scope:r,publish:e,configuration:t,cwd:i}){return r&&e?or.getScopeRegistry(r,{configuration:t,type:or.RegistryType.PUBLISH_REGISTRY}):r?or.getScopeRegistry(r,{configuration:t}):e?or.getPublishRegistry((await Mh(t,i)).manifest,{configuration:t}):or.getDefaultRegistry({configuration:t})}async function _Ve(r,e,{configuration:t,scope:i}){let n=o=>a=>{let l=Ie.isIndexableObject(a)?a:{},c=l[o],u=Ie.isIndexableObject(c)?c:{};return{...l,[o]:{...u,npmAuthToken:e}}},s=i?{npmScopes:n(i)}:{npmRegistries:n(r)};return await ye.updateHomeConfiguration(s)}async function $Ve({configuration:r,registry:e,report:t,stdin:i,stdout:n}){t.reportInfo(0,`Logging in to ${ee.pretty(r,e,ee.Type.URL)}`);let s=!1;if(e.match(/^https:\/\/npm\.pkg\.github\.com(\/|$)/)&&(t.reportInfo(0,"You seem to be using the GitHub Package Registry. Tokens must be generated with the 'repo', 'write:packages', and 'read:packages' permissions."),s=!0),t.reporLine 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 function xE(r,e){let t=`/-/package${Mt.getIdentUrl(r)}/dist-tags`;return Mt.get(t,{configuration:e,ident:r,jsonResponse:!0,customErrorMessage:Mt.customPackageError})}var tg=class extends De{constructor(){super(...arguments);this.package=z.String();this.tag=z.String()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i,workspace:n}=await je.find(t,this.context.cwd);if(!n)throw new ct(i.cwd,this.context.cwd);let s=P.parseDescriptor(this.package,!0),o=s.range;if(!Wue.default.valid(o))throw new be(`The range ${ee.pretty(t,s.range,ee.Type.RANGE)} must be a valid semver version`);let a=or.getPublishRegistry(n.manifest,{configuration:t}),l=ee.pretty(t,s,ee.Type.IDENT),c=ee.pretty(t,o,ee.Type.RANGE),u=ee.pretty(t,this.tag,ee.Type.CODE);return(await Ge.start({configuration:t,stdout:this.context.stdout},async f=>{let h=await xE(s,t);Object.prototype.hasOwnProperty.call(h,this.tag)&&h[this.tag]===o&&f.reportWarning(0,`Tag ${u} is already set to version ${c}`);let p=`/-/package${Mt.getIdentUrl(s)}/dist-tags/${encodeURIComponent(this.tag)}`;await Mt.put(p,o,{configuration:t,registry:a,ident:s,jsonRequest:!0,jsonResponse:!0}),f.reportInfo(0,`Tag ${u} added to version ${c} of package ${l}`)})).exitCode()}};tg.paths=[["npm","tag","add"]],tg.usage=ve.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"]]});var rg=class extends De{constructor(){super(...arguments);this.package=z.String();this.tag=z.String()}async execute(){if(this.tag==="latest")throw new be("The 'latest' tag cannot be removed.");let t=await ye.find(this.context.cwd,this.context.plugins),{project:i,workspace:n}=await je.find(t,this.context.cwd);if(!n)throw new ct(i.cwd,this.context.cwd);let s=P.parseIdent(this.package),o=or.getPublishRegistry(n.manifest,{configuration:t}),a=ee.pretty(t,this.tag,ee.Type.CODE),l=ee.pretty(t,s,ee.Type.IDENT),c=await xE(s,t);if(!Object.prototype.hasOwnProperty.call(c,this.tag))throw new be(`${a} is not a tag of package ${l}`);return(await Ge.start({configuration:t,stdout:this.context.stdout},async g=>{let f=`/-/package${Mt.getIdentUrl(s)}/dist-tags/${encodeURIComponent(this.tag)}`;await Mt.del(f,{configuration:t,registry:o,ident:s,jsonResponse:!0}),g.reportInfo(0,`Tag ${a} removed from package ${l}`)})).exitCode()}};rg.paths=[["npm","tag","remove"]],rg.usage=ve.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"]]});var ig=class extends De{constructor(){super(...arguments);this.scope=z.String("-s,--scope",{description:"Print username for the registry configured for a given scope"});this.publish=z.Boolean("--publish",!1,{description:"Print username for the publish registry"})}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),i;return this.scope&&this.publish?i=or.getScopeRegistry(this.scope,{configuration:t,type:or.RegistryType.PUBLISH_REGISTRY}):this.scope?i=or.getScopeRegistry(this.scope,{configuration:t}):this.publish?i=or.getPublishRegistry((await Mh(t,this.context.cwd)).manifest,{configuration:t}):i=or.getDefaultRegistry({configuration:t}),(await Ge.start({configuration:t,stdout:this.context.stdout},async s=>{var a,l;let o;try{o=await Mt.get("/-/whoami",{configuration:t,registry:i,authType:Mt.AuthType.ALWAYS_AUTH,jsonResponse:!0,ident:this.scope?P.makeIdent(this.scope,""):void 0})}catch(c){if(((a=c.response)==null?void 0:a.statusCode)===401||((l=c.response)==null?void 0:l.statusCode)===403){s.reportError(41,"Authentication failed - your credentials may have expired");return}else throw c}s.reportInfo(0,o.username)})).exitCode()}};ig.paths=[["npm","whoami"]],ig.usage=ve.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"]]});var r7e={configuration:{npmPublishAccess:{description:"Default access of the published packages",type:"STRING",default:null},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:[Vu,Xu,Zu,_u,$u,tg,eg,rg,ig]},i7e=r7e;var y1={};ut(y1,{default:()=>E7e,patchUtils:()=>ng});var ng={};ut(ng,{applyPatchFile:()=>Hb,diffFolders:()=>E1,ensureUnpatchedDescriptor:()=>h1,extractPackageToDisk:()=>m1,extractPatchFlags:()=>ege,isParentRequired:()=>C1,loadPatchFiles:()=>RE,makeDescriptor:()=>p1,makeLocator:()=>d1,makePatchHash:()=>I1,parseDescriptor:()=>DE,parseLocator:()=>kE,parsePatchFile:()=>PE});var n7e=/^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@.*/;function mp(r){return x.relative(Oe.root,x.resolve(Oe.root,K.toPortablePath(r)))}function s7e(r){let e=r.trim().match(n7e);if(!e)throw new Error(`Bad header line: '${r}'`);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 o7e=420,a7e=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}),A7e=r=>({header:s7e(r),parts:[]}),l7e={["@"]:"header",["-"]:"deletion",["+"]:"insertion",[" "]:"context",["\\"]:"pragma",undefined:"context"};function c7e(r){let e=[],t=zue(),i="parsing header",n=null,s=null;function o(){n&&(s&&(n.parts.push(s),s=null),t.hunks.push(n),n=null)}function a(){o(),e.push(t),t=zue()}for(let l=0;l<r.length;l++){let c=r[l];if(i==="parsing header")if(c.startsWith("@@"))i="parsing hunks",t.hunks=[],l-=1;else if(c.startsWith("diff --git ")){t&&t.diffLineFromPath&&a();let u=c.match(/^diff --git a\/(.*?) b\/(.*?)\s*$/);if(!u)throw new Error(`Bad diff line: ${c}`);t.diffLineFromPath=u[1],t.diffLineToPath=u[2]}else if(c.startsWith("old mode "))t.oldMode=c.slice(9).trim();else if(c.startsWith("new mode "))t.newMode=c.slice(9).trim();else if(c.startsWith("deleted file mode "))t.deletedFileMode=c.slice(18).trim();else if(c.startsWith("new file mode "))t.newFileMode=c.slice(14).trim();else if(c.startsWith("rename from "))t.renameFrom=c.slice(12).trim();else if(c.startsWith("rename to "))t.renameTo=c.slice(10).trim();else if(c.startsWith("index ")){let u=c.match(/(\w+)\.\.(\w+)/);if(!u)continue;t.beforeHash=u[1],t.afterHash=u[2]}else c.startsWith("semver exclusivity ")?t.semverExclusivity=c.slice(19).trim():c.startsWith("--- ")?t.fromPath=c.slice(6).trim():c.startsWith("+++ ")&&(t.toP Line truncated
`)+(n.hunk.parts[0].noNewlineAtEndOfFile?"":`
`):"";await e.mkdirpPromise(x.dirname(n.path),{chmod:493,utimes:[xr.SAFE_TIME,xr.SAFE_TIME]}),await e.writeFilePromise(n.path,s,{mode:n.mode}),await e.utimesPromise(n.path,xr.SAFE_TIME,xr.SAFE_TIME)}break;case"patch":await Ip(e,n.path,async()=>{await p7e(n,{baseFs:e,dryRun:t})});break;case"mode change":{let o=(await e.statPromise(n.path)).mode;if(Vue(n.newMode)!==Vue(o))continue;await Ip(e,n.path,async()=>{await e.chmodPromise(n.path,n.newMode)})}break;default:Ie.assertNever(n);break}}function Vue(r){return(r&64)>0}function Xue(r){return r.replace(/\s+$/,"")}function h7e(r,e){return Xue(r)===Xue(e)}async function p7e({hunks:r,path:e},{baseFs:t,dryRun:i=!1}){let n=await t.statSync(e).mode,o=(await t.readFileSync(e,"utf8")).split(/\n/),a=[],l=0,c=0;for(let g of r){let f=Math.max(c,g.header.patched.start+l),h=Math.max(0,f-c),p=Math.max(0,o.length-f-g.header.original.length),C=Math.max(h,p),y=0,B=0,v=null;for(;y<=C;){if(y<=h&&(B=f-y,v=Zue(g,o,B),v!==null)){y=-y;break}if(y<=p&&(B=f+y,v=Zue(g,o,B),v!==null))break;y+=1}if(v===null)throw new Ep(r.indexOf(g),g);a.push(v),l+=y,c=B+g.header.original.length}if(i)return;let u=0;for(let g of a)for(let f of g)switch(f.type){case"splice":{let h=f.index+u;o.splice(h,f.numToDelete,...f.linesToInsert),u+=f.linesToInsert.length-f.numToDelete}break;case"pop":o.pop();break;case"push":o.push(f.line);break;default:Ie.assertNever(f);break}await t.writeFilePromise(e,o.join(`
`),{mode:n})}function Zue(r,e,t){let i=[];for(let n of r.parts)switch(n.type){case"context":case"deletion":{for(let s of n.lines){let o=e[t];if(o==null||!h7e(o,s))return null;t+=1}n.type==="deletion"&&(i.push({type:"splice",index:t-n.lines.length,numToDelete:n.lines.length,linesToInsert:[]}),n.noNewlineAtEndOfFile&&i.push({type:"push",line:""}))}break;case"insertion":i.push({type:"splice",index:t,numToDelete:0,linesToInsert:n.lines}),n.noNewlineAtEndOfFile&&i.push({type:"pop"});break;default:Ie.assertNever(n.type);break}return i}var C7e=/^builtin<([^>]+)>$/;function f1(r,e){let{source:t,selector:i,params:n}=P.parseRange(r);if(t===null)throw new Error("Patch locators must explicitly define their source");let s=i?i.split(/&/).map(c=>K.toPortablePath(c)):[],o=n&&typeof n.locator=="string"?P.parseLocator(n.locator):null,a=n&&typeof n.version=="string"?n.version:null,l=e(t);return{parentLocator:o,sourceItem:l,patchPaths:s,sourceVersion:a}}function DE(r){let{sourceItem:e,...t}=f1(r.range,P.parseDescriptor);return{...t,sourceDescriptor:e}}function kE(r){let{sourceItem:e,...t}=f1(r.reference,P.parseLocator);return{...t,sourceLocator:e}}function h1(r){if(!r.range.startsWith("patch:"))return r;let{sourceItem:e}=f1(r.range,P.parseDescriptor);return e}function _ue({parentLocator:r,sourceItem:e,patchPaths:t,sourceVersion:i,patchHash:n},s){let o=r!==null?{locator:P.stringifyLocator(r)}:{},a=typeof i<"u"?{version:i}:{},l=typeof n<"u"?{hash:n}:{};return P.makeRange({protocol:"patch:",source:s(e),selector:t.join("&"),params:{...a,...l,...o}})}function p1(r,{parentLocator:e,sourceDescriptor:t,patchPaths:i}){return P.makeDescriptor(r,_ue({parentLocator:e,sourceItem:t,patchPaths:i},P.stringifyDescriptor))}function d1(r,{parentLocator:e,sourcePackage:t,patchPaths:i,patchHash:n}){return P.makeLocator(r,_ue({parentLocator:e,sourceItem:t,sourceVersion:t.version,patchPaths:i,patchHash:n},P.stringifyLocator))}function $ue({onAbsolute:r,onRelative:e,onBuiltin:t},i){i.startsWith("~")&&(i=i.slice(1));let s=i.match(C7e);return s!==null?t(s[1]):x.isAbsolute(i)?r(i):e(i)}function ege(r){let e=r.startsWith("~");return e&&(r=r.slice(1)),{optional:e}}function C1(r){return $ue({onAbsolute:()=>!1,onRelative:()=>!0,onBuiltin:()=>!1},r)}async function RE(r,e,t){let i=r!==null?await t.fetcher.fetch(r,t):null,n=i&&i.localPath?{packageFs:new qt(Oe.root),prefixPath:x.relative(Oe.root,i.localPath)}:i;i&&i!==n&&i.releaseFs&&i.releaseFs();let s=await Ie.releaseAfterUseAsync(async()=>await Promise.all(e.map(async o=>{let a=ege(o),l=await $ue({onAbsolute:async()=>await M.readFilePromise(o,"utf8"),onRelative:async()=>{if(n===null)throw new Error("Assertion failed: The parent locator should have been fetched");return await n.packageFs.readFilePromise(x.join(n.prefixPath,o),"utf8")},onBuiltin:async c=>await t.project.configuration.firstHook(u=>u.getBuiltinPatch,t.project,c)},o);return{...a,source:l}})));for(let o of s)typeof o.source=="string"&&(o.source=o.source.replace(/\r\n?/g,`
`));return s}async function m1(r,{cache:e,project:t}){let i=t.storedPackages.get(r.locatorHash);if(typeof i>"u")throw new Error("Assertion failed: Expected the package to be registered");let n=t.storedChecksums,s=new ti,o=t.configuration.makeFetcher(),a=await o.fetch(r,{cache:e,project:t,fetcher:o,checksums:n,report:s}),l=await M.mktempPromise(),c=x.join(l,"source"),u=x.join(l,"user"),g=x.join(l,".yarn-patch.json");return await Promise.all([M.copyPromise(c,a.prefixPath,{baseFs:a.packageFs}),M.copyPromise(u,a.prefixPath,{baseFs:a.packageFs}),M.writeJsonPromise(g,{locator:P.stringifyLocator(r),version:i.version})]),M.detachTemp(l),u}async function E1(r,e){let t=K.fromPortablePath(r).replace(/\\/g,"/"),i=K.fromPortablePath(e).replace(/\\/g,"/"),{stdout:n,stderr:s}=await Cr.execvp("git",["-c","core.safecrlf=false","diff","--src-prefix=a/","--dst-prefix=b/","--ignore-cr-at-eol","--full-index","--no-index","--no-renames","--text",t,i],{cwd:K.toPortablePath(process.cwd()),env:{...process.env,GIT_CONFIG_NOSYSTEM:"1",HOME:"",XDG_CONFIG_HOME:"",USERPROFILE:""}});if(s.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':
${s}`);let o=t.startsWith("/")?a=>a.slice(1):a=>a;return n.replace(new RegExp(`(a|b)(${Ie.escapeRegExp(`/${o(t)}/`)})`,"g"),"$1/").replace(new RegExp(`(a|b)${Ie.escapeRegExp(`/${o(i)}/`)}`,"g"),"$1/").replace(new RegExp(Ie.escapeRegExp(`${t}/`),"g"),"").replace(new RegExp(Ie.escapeRegExp(`${i}/`),"g"),"")}function I1(r,e){let t=[];for(let{source:i}of r){if(i===null)continue;let n=PE(i);for(let s of n){let{semverExclusivity:o,...a}=s;o!==null&&e!==null&&!vt.satisfiesWithPrereleases(e,o)||t.push(JSON.stringify(a))}}return li.makeHash(`${3}`,...t).slice(0,6)}function tge(r,{configuration:e,report:t}){for(let i of r.parts)for(let n of i.lines)switch(i.type){case"context":t.reportInfo(null,` ${ee.pretty(e,n,"grey")}`);break;case"deletion":t.reportError(28,`- ${ee.pretty(e,n,ee.Type.REMOVED)}`);break;case"insertion":t.reportError(28,`+ ${ee.pretty(e,n,ee.Type.ADDED)}`);break;default:Ie.assertNever(i.type)}}var Gb=class{supports(e,t){return!!e.reference.startsWith("patch:")}getLocalPath(e,t){return null}async fetch(e,t){let i=t.checksums.get(e.locatorHash)||null,[n,s,o]=await t.cache.fetchPackageFromCache(e,i,{onHit:()=>t.report.reportCacheHit(e),onMiss:()=>t.report.reportCacheMiss(e,`${P.prettyLocator(t.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.patchPackage(e,t),skipIntegrityCheck:t.skipIntegrityCheck,...t.cacheOptions});return{packageFs:n,releaseFs:s,prefixPath:P.getIdentVendorPath(e),localPath:this.getLocalPath(e,t),checksum:o}}async patchPackage(e,t){let{parentLocator:i,sourceLocator:n,sourceVersion:s,patchPaths:o}=kE(e),a=await RE(i,o,t),l=await M.mktempPromise(),c=x.join(l,"current.zip"),u=await t.fetcher.fetch(n,t),g=P.getIdentVendorPath(e),f=await sn(),h=new Wr(c,{libzip:f,create:!0,level:t.project.configuration.get("compressionLevel")});await Ie.releaseAfterUseAsync(async()=>{await h.copyPromise(g,u.prefixPath,{baseFs:u.packageFs,stableSort:!0})},u.releaseFs),h.saveAndClose();for(let{source:p,optional:C}of a){if(p===null)continue;let y=new Wr(c,{libzip:f,level:t.project.configuration.get("compressionLevel")}),B=new qt(x.resolve(Oe.root,g),{baseFs:y});try{await Hb(PE(p),{baseFs:B,version:s})}catch(v){if(!(v instanceof Ep))throw v;let D=t.project.configuration.get("enableInlineHunks"),L=!D&&!C?" (set enableInlineHunks for details)":"",H=`${P.prettyLocator(t.project.configuration,e)}: ${v.message}${L}`,j=$=>{!D||tge(v.hunk,{configuration:t.project.configuration,report:$})};if(y.discardAndClose(),C){t.report.reportWarningOnce(66,H,{reportExtra:j});continue}else throw new at(66,H,j)}y.saveAndClose()}return new Wr(c,{libzip:f,level:t.project.configuration.get("compressionLevel")})}};var Yb=class{supportsDescriptor(e,t){return!!e.range.startsWith("patch:")}supportsLocator(e,t){return!!e.reference.startsWith("patch:")}shouldPersistResolution(e,t){return!1}bindDescriptor(e,t,i){let{patchPaths:n}=DE(e);return n.every(s=>!C1(s))?e:P.bindDescriptor(e,{locator:P.stringifyLocator(t)})}getResolutionDependencies(e,t){let{sourceDescriptor:i}=DE(e);return[i]}async getCandidates(e,t,i){if(!i.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{parentLocator:n,sourceDescriptor:s,patchPaths:o}=DE(e),a=await RE(n,o,i.fetchOptions),l=t.get(s.descriptorHash);if(typeof l>"u")throw new Error("Assertion failed: The dependency should have been resolved");let c=I1(a,l.version);return[d1(e,{parentLocator:n,sourcePackage:l,patchPaths:o,patchHash:c})]}async getSatisfying(e,t,i){return null}async resolve(e,t){let{sourceLocator:i}=kE(e);return{...await t.resolver.resolve(i,t),...e}}};var sg=class extends De{constructor(){super(...arguments);this.save=z.Boolean("-s,--save",!1,{description:"Add the patch to your resolution entries"});this.patchFolder=z.String()}async execute(){let t=await ye.find(this.context.cwd,this.context.plugins),{project:i,workspace:n}=await je.find(t,this.context.cwd);if(!n)throw new ct(i.cwd,this.context.cwd);await i.restoreInstallState();let s=x.resolve(this.context.cwd,K.toPortablePath(this.patchFolder)),o=x.join(s,"../source"),a=x.join(s,"../.yarn-patch.json");if(!M.existsSync(o))throw new be("The argument folder didn't get created by 'yarn patch'");let l=await E1(o,s),c=await M.readJsonPromise(a),u=P.parseLocator(c.locator,!0);if(!i.storedPackages.has(u.locatorHash))throw new be("No package found in the project for the given locator");if(!this.save){this.context.stdout.write(l);return}let g=t.get("patchFolder"),f=x.join(g,`${P.slugifyLocator(u)}.patch`);await M.mkdirPromise(g,{recursive:!0}),await M.writeFilePromise(f,l);let h=new Map;for(let p of i.storedPackages.values()){if(P.isVirtualLocator(p))continue;let C=p.dependencies.get(u.identHash);if(!C)continue;let y=P.isVirtualDescriptor(C)?P.devirtualizeDescriptor(C):C,B=h1(y),v=i.storedResolutions.get(B.descriptorHash);if(!v)throw new Error("Assertion failed: Expected the resolution to have been registered");if(!i.storedPackages.get(v))Line truncated
${a.map(l=>`
- ${P.prettyLocator(t,l)}`).join("")}`);o=a[0]}if(!i.storedPackages.has(o.locatorHash))throw new be("No package found in the project for the given locator");await Ge.start({configuration:t,json:this.json,stdout:this.context.stdout},async a=>{let l=await m1(o,{cache:s,project:i});a.reportJson({locator:P.stringifyLocator(o),path:K.fromPortablePath(l)}),a.reportInfo(0,`Package ${P.prettyLocator(t,o)} got extracted with success!`),a.reportInfo(0,`You can now edit the following folder: ${ee.pretty(t,K.fromPortablePath(l),"magenta")}`),a.reportInfo(0,`Once you are done run ${ee.pretty(t,`yarn patch-commit -s ${process.platform==="win32"?'"':""}${K.fromPortablePath(l)}${process.platform==="win32"?'"':""}`,"cyan")} and Yarn will store a patchfile based on your changes.`)})}};og.paths=[["patch"]],og.usage=ve.Usage({description:"prepare a package for patching",details:"\n This command will cause a package to be extracted in a temporary directory intended to be editable at will.\n \n Once you're done with your changes, run `yarn patch-commit -s <path>` (with `<path>` being the temporary directory you received) to generate a patchfile and register it into your top-level manifest via the `patch:` protocol. Run `yarn patch-commit -h` for more details.\n "});var m7e={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:[sg,og],fetchers:[Gb],resolvers:[Yb]},E7e=m7e;var b1={};ut(b1,{default:()=>w7e});var jb=class{supportsPackage(e,t){return this.isEnabled(t)}async findPackageLocation(e,t){if(!this.isEnabled(t))throw new Error("Assertion failed: Expected the pnpm linker to be enabled");let i=B1(),n=t.project.installersCustomData.get(i);if(!n)throw new be(`The project in ${ee.pretty(t.project.configuration,`${t.project.cwd}/package.json`,ee.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let s=n.pathByLocator.get(e.locatorHash);if(typeof s>"u")throw new be(`Couldn't find ${P.prettyLocator(t.project.configuration,e)} in the currently installed pnpm map - running an install might help`);return s}async findPackageLocator(e,t){if(!this.isEnabled(t))return null;let i=B1(),n=t.project.installersCustomData.get(i);if(!n)throw new be(`The project in ${ee.pretty(t.project.configuration,`${t.project.cwd}/package.json`,ee.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let s=e.match(/(^.*\/node_modules\/(@[^/]*\/)?[^/]+)(\/.*$)/);if(s){let l=n.locatorByPath.get(s[1]);if(l)return l}let o=e,a=e;do{a=o,o=x.dirname(a);let l=n.locatorByPath.get(a);if(l)return l}while(o!==a);return null}makeInstaller(e){return new w1(e)}isEnabled(e){return e.project.configuration.get("nodeLinker")==="pnpm"}},w1=class{constructor(e){this.opts=e;this.asyncActions=new Ie.AsyncActions(10);this.customData={pathByLocator:new Map,locatorByPath:new Map}}getCustomDataKey(){return B1()}attachCustomData(e){}async installPackage(e,t,i){switch(e.linkType){case"SOFT":return this.installPackageSoft(e,t,i);case"HARD":return this.installPackageHard(e,t,i)}throw new Error("Assertion failed: Unsupported package link type")}async installPackageSoft(e,t,i){let n=x.resolve(t.packageFs.getRealPath(),t.prefixPath);return this.customData.pathByLocator.set(e.locatorHash,n),{packageLocation:n,buildDirective:null}}async installPackageHard(e,t,i){var u;let n=I7e(e,{project:this.opts.project});this.customData.locatorByPath.set(n,P.stringifyLocator(e)),this.customData.pathByLocator.set(e.locatorHash,n),i.holdFetchResult(this.asyncActions.set(e.locatorHash,async()=>{await M.mkdirPromise(n,{recursive:!0}),await M.copyPromise(n,t.prefixPath,{baseFs:t.packageFs,overwrite:!1})}));let o=P.isVirtualLocator(e)?P.devirtualizeLocator(e):e,a={manifest:(u=await ot.tryFind(t.prefixPath,{baseFs:t.packageFs}))!=null?u:new ot,misc:{hasBindingGyp:po.hasBindingGyp(t)}},l=this.opts.project.getDependencyMeta(o,e.version),c=po.extractBuildScripts(e,a,l,{configuration:this.opts.project.configuration,report:this.opts.report});return{packageLocation:n,buildDirective:c}}async attachInternalDependencies(e,t){this.opts.project.configuration.get("nodeLinker")==="pnpm"&&(!rge(e,{project:this.opts.project})||this.asyncActions.reduce(e.locatorHash,async i=>{await i;let n=this.customData.pathByLocator.get(e.locatorHash);if(typeof n>"u")throw new Error(`Assertion failed: Expected the package to have been registered (${P.stringifyLocator(e)})`);let s=x.join(n,xt.nodeModules),o=[],a=await ige(s);for(let[l,c]of t){let u=c;rge(c,{project:this.opts.project})||(this.opts.report.reportWarningOnce(0,"The pnpm linker doesn't support providing different versions to workspaces' peer dependencies"),u=P.devirtualizeLocator(c));let g=this.customData.pathByLocator.get(u.locatorHash);if(typeof g>"u")throw new Error(`Assertion failed: Expe Line truncated
/*!
* buildToken
* Builds OAuth token prefix (helper function)
*
* @name buildToken
* @function
* @param {GitUrl} obj The parsed Git url object.
* @return {String} token prefix
*/
/*!
* fill-range <https://github.com/jonschlinkert/fill-range>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Licensed under the MIT License.
*/
/*!
* is-extglob <https://github.com/jonschlinkert/is-extglob>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*/
/*!
* is-glob <https://github.com/jonschlinkert/is-glob>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
/*!
* is-number <https://github.com/jonschlinkert/is-number>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Released under the MIT License.
*/
/*!
* is-windows <https://github.com/jonschlinkert/is-windows>
*
* Copyright © 2015-2018, Jon Schlinkert.
* Released under the MIT License.
*/
/*!
* to-regex-range <https://github.com/micromatch/to-regex-range>
*
* Copyright (c) 2015-present, Jon Schlinkert.
* Released under the MIT License.
*/
/**
@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 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.
*/
/**
@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.
*/
-2
View File
@@ -1,2 +0,0 @@
save-prefix ""
unsafe-disable-integrity-migration true
+7
View File
@@ -0,0 +1,7 @@
defaultSemverRangePrefix: ""
enableGlobalCache: true
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-3.5.0.cjs
+7 -7
View File
@@ -14,7 +14,7 @@ The tests use [Jest snapshots](https://facebook.github.io/jest/docs/en/snapshot-
Each test directory in `tests/format` has a `jsfmt.spec.js` file that controls how exactly the rest of the files in the directory are used for tests. This file must contain one or more calls to the `run_spec` global function. For example, in directories with JavaScript formatting tests, `jsfmt.spec.js` generally looks like this:
```js
run_spec(__dirname, ["babel", "flow", "typescript"]);
run_spec(import.meta, ["babel", "flow", "typescript"]);
```
This verifies that for each file in the directory, the output matches the snapshot and is the same for each listed parser.
@@ -22,7 +22,7 @@ This verifies that for each file in the directory, the output matches the snapsh
You can also pass options as the third argument:
```js
run_spec(__dirname, ["babel"], { trailingComma: "es5" });
run_spec(import.meta, ["babel"], { trailingComma: "es5" });
```
Signature:
@@ -30,9 +30,9 @@ Signature:
```ts
function run_spec(
fixtures:
| string
| ImportMeta
| {
dirname: string;
importMeta: ImportMeta;
snippets?: Array<
| string
| { code: string; name?: string; filename?: string; output?: string }
@@ -47,13 +47,13 @@ function run_spec(
Parameters:
- **`fixtures`**: Must be set to `__dirname` or to an object of the shape `{ dirname: __dirname, ... }`. The object may have the `snippets` property to specify an array of extra input entries in addition to the files in the current directory. For each input entry (a file or a snippet), `run_spec` configures and runs a number of tests. The main check is that for a given input the output should match the snapshot (for snippets, the expected output can also be specified directly). [Additional checks](#deeper-testing) are controlled by options and environment variables.
- **`parsers`**: A list of parser names. The tests verify that the parsers in this list produce the same output. If the list includes `typescript`, then `babel-ts` is included implicitly. If the list includes `babel`, and the current directory is inside `tests/format/js`, then `acorn`, `espree`, and `meriyah` are included implicitly.
- **`fixtures`**: Must be set to `import.meta` or to an object of the shape `{ importMeta: import.meta, ... }`. The object may have the `snippets` property to specify an array of extra input entries in addition to the files in the current directory. For each input entry (a file or a snippet), `run_spec` configures and runs a number of tests. The main check is that for a given input the output should match the snapshot (for snippets, the expected output can also be specified directly). [Additional checks](#deeper-testing) are controlled by options and environment variables.
- **`parsers`**: A list of parser names. The tests verify that the parsers in this list produce the same output. If the list includes `typescript`, then `babel-ts` is included implicitly. If the list includes `flow`, then `babel-flow` is included implicitly. If the list includes `babel`, and the current directory is inside `tests/format/js` or `tests/format/jsx`, then `acorn`, `espree`, and `meriyah` are included implicitly.
- **`options`**: In addition to Prettier's formatting options, can contain the `errors` property to specify that it's expected that the formatting shouldn't be successful and an error should be thrown for all (`errors: true`) or some combinations of input entries and parsers.
The implementation of `run_spec` can be found in [`tests/config/format-test.js`](tests/config/format-test.js).
`tests/format/flow-repo/` contains the Flow test suite and is not supposed to be edited by hand. To update it, clone the Flow repo next to the Prettier repo and run: `node scripts/sync-flow-tests.js ../flow/tests/`.
`tests/format/flow-repo/` contains the Flow test suite and is not supposed to be edited by hand. To update it, clone the Flow repo next to the Prettier repo and run: `node scripts/sync-flow-tests.cjs ../flow/tests/`.
## Debugging
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env node
"use strict";
var pleaseUpgradeNode = require("please-upgrade-node");
var packageJson = require("../package.json");
pleaseUpgradeNode(packageJson);
function runCli(cli) {
return cli.run(process.argv.slice(2));
}
var dynamicImport = new Function("module", "return import(module)");
module.exports.promise = dynamicImport("../src/cli/index.js").then(runCli);
+3 -9
View File
@@ -1,12 +1,6 @@
#!/usr/bin/env node
"use strict";
// Add this file so we can use `node bin/prettier` or `node bin/prettier.js`
// instead of `node bin/prettier.cjs`.
var pleaseUpgradeNode = require("please-upgrade-node");
var packageJson = require("../package.json");
pleaseUpgradeNode(packageJson);
var cli = require("../src/cli/index.js");
module.exports = cli.run(process.argv.slice(2));
import "./prettier.cjs";
+28
View File
@@ -0,0 +1,28 @@
#### Update `@angular/compiler` to v14 (#13609 by @fisker)
- Support shorthand object
- [Drop support for quote expressions](https://github.com/angular/angular/pull/44915)
<!-- prettier-ignore -->
```html
<!-- Input -->
<div [input]="{a, b : 2 }"></div>
<!-- Prettier stable -->
Error: Cannot find front char /:/ from index 0 in "{a, b : 2 }"
<!-- Prettier main -->
<div [input]="{ a, b: 2 }"></div>
```
<!-- prettier-ignore -->
```html
<!-- Input -->
<a [href]="http://google.com">Click me</a>
<!-- Prettier stable -->
<a [href]="http: //google.com">Click me</a>
<!-- Prettier main -->
<div [href]="http://google.com"></div>
```
+13
View File
@@ -0,0 +1,13 @@
#### Fix parentheses with nullish coalescing operator (#14216 by @thron0)
<!-- prettier-ignore -->
```html
<!-- Input -->
<img [src]="(x && y) ?? z" />
<!-- Prettier stable -->
<img [src]="x && y ?? z" />
<!-- Prettier main -->
<img [src]="(x && y) ?? z" />
```
+3
View File
@@ -0,0 +1,3 @@
#### [BREAKING] Drop support for Node.js 10 and 12 (#11830 by @fisker, #13118 by @sosukesuzuki)
The minimal required Node.js version is v14
+13
View File
@@ -0,0 +1,13 @@
#### [BREAKING] Change public APIs to asynchronous (#12574, #12788, #12790, #13265 by @fisker)
- `prettier.format()` returns `Promise<string>`
- `prettier.formatWithCursor()` returns `Promise<{formatted: string, cursorOffset: number}>`
- `prettier.formatAST()` returns `Promise<string>`
- `prettier.check()` returns `Promise<boolean>`
- `prettier.getSupportInfo()` returns `Promise`
- `prettier.clearConfigCache()` returns `Promise<void>`
- `prettier.resolveConfig.sync` is removed
- `prettier.resolveConfigFile.sync` is removed
- `prettier.getFileInfo.sync` is removed
If you still need sync APIs, you can try [`@prettier/sync`](https://github.com/prettier/prettier-synchronized)
+76
View File
@@ -0,0 +1,76 @@
#### [BREAKING] npm package file structures changed (#12740 by @fisker, #13530 by @fisker, #14570 by @fisker)
Export style changes:
The ESM version standalone entry has changed export style from default export to named export.
```diff
- import prettier from "https://unpkg.com/prettier@2.7.1/esm/standalone.mjs";
+ import * as prettier from "https://unpkg.com/prettier@3.0.0/standalone.mjs";
```
```diff
- import prettier from "https://unpkg.com/prettier@2.7.1/esm/standalone.mjs";
+ import { format } from "https://unpkg.com/prettier@3.0.0/standalone.mjs";
```
File structures changes:
- `bin-prettier.js` -> `bin/prettier.cjs`
- `esm/standalone.mjs` -> `standalone.mjs`
- `esm/parser-angular.mjs` -> `plugins/angular.mjs`
- `parser-angular.js` -> `plugins/angular.js`
- `esm/parser-babel.mjs` -> `plugins/babel.mjs`
- `parser-babel.js` -> `plugins/babel.js`
- `esm/parser-espree.mjs` -> `plugins/acorn-and-espree.mjs`
- `parser-espree.js` -> `plugins/acorn.js`\
global object renamed `prettierPlugins.espree` -> `prettierPlugins.acorn`
- `esm/parser-flow.mjs` -> `plugins/flow.mjs`
- `parser-flow.js` -> `plugins/flow.js`
- `esm/parser-glimmer.mjs` -> `plugins/glimmer.mjs`
- `parser-glimmer.js` -> `plugins/glimmer.js`
- `esm/parser-graphql.mjs` -> `plugins/graphql.mjs`
- `parser-graphql.js` -> `plugins/graphql.js`
- `esm/parser-html.mjs` -> `plugins/html.mjs`
- `parser-html.js` -> `plugins/html.js`
- `esm/parser-markdown.mjs` -> `plugins/markdown.mjs`
- `parser-markdown.js` -> `plugins/markdown.js`
- `esm/parser-meriyah.mjs` -> `plugins/meriyah.mjs`
- `parser-meriyah.js` -> `plugins/meriyah.js`
- `esm/parser-postcss.mjs` -> `plugins/postcss.mjs`
- `parser-postcss.js` -> `plugins/postcss.js`
- `esm/parser-typescript.mjs` -> `plugins/typescript.mjs`
- `parser-typescript.js` -> `plugins/typescript.js`
- `esm/parser-yaml.mjs` -> `plugins/yaml.mjs`
- `parser-yaml.js` -> `plugins/yaml.js`
Check full list on <https://unpkg.com/browse/prettier@3.0.0/>.
A new plugin has been added:
- `plugins/estree.mjs` (ESM version)
- `plugins/estree.js` (UMD version)
If you use standalone version, this plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.
```diff
- import prettier from "prettier/standalone";
+ import * as prettier from "prettier/standalone";
- import prettierPluginBabel from "prettier/parser-babel";
+ import prettierPluginBabel from "prettier/plugins/babel";
+ import prettierPluginEstree from "prettier/plugins/estree";
console.log(
- format(code, {
+ await format(code, {
parser: "babel",
- plugins: [prettierPluginBabel],
+ plugins: [prettierPluginBabel, prettierPluginEstree],
})
);
```
```diff
- node ./node_modules/prettier/bin-prettier.js . --write
+ node ./node_modules/prettier/bin/prettier.cjs . --write
```
+7
View File
@@ -0,0 +1,7 @@
#### [HIGHLIGHT] Support plugins with async parsers (#12748 by @fisker, #13211 by @thorn0 and @fisker)
[`parse` function](https://prettier.io/docs/en/plugins.html#parsers) in a plugin can return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) now.
In order to support async parsers for embedded languages, we had to introduce a breaking change to the plugin API. Namely, the `embed` method of a printer has now to match a completely new signature, incompatible with previous versions. If you're a plugin author and your plugins don't define `embed`, you have nothing to worry about, otherwise see the [docs](/docs/plugins.html#optional-embed) for details.
Also, the `preprocess` method of a printer can return a promise now.
+19
View File
@@ -0,0 +1,19 @@
#### Support config files in ESM (#13130 by @fisker)
Config files in ESM are supported, supported config file names:
- `prettier.config.js` (in place with `{"type": "module"}` in `package.json`)
- `.prettierrc.js` (same as above)
- `prettier.config.mjs`
- `.prettierrc.mjs`.
```js
export default {
trailingComma: "es5",
tabWidth: 4,
semi: false,
singleQuote: true,
};
```
**[Shareable config package](https://prettier.io/docs/en/configuration.html#sharing-configurations) can also be a pure ESM package.**
+15
View File
@@ -0,0 +1,15 @@
#### [BREAKING] Support plugins in ESM (#13201 by @fisker)
Since v3.0.0, we load plugins via `import()` instead of `require()`, plugins can be ESM modules now.
If you use `--plugin` by directory path, or file path without extensions, the plugin may not able to load.
```diff
- prettier . --plugin=path/to/my-plugin-directory
+ prettier . --plugin=path/to/my-plugin-directory/index.js
```
```diff
- prettier . --plugin=path/to/my-plugin-file
+ prettier . --plugin=path/to/my-plugin-file.js
```
+11
View File
@@ -0,0 +1,11 @@
#### [BREAKING] Update `prettier.doc` (#13203, #14456 by @fisker)
`prettier.doc.builders.concat` [was deprecated in v2.3.0](https://prettier.io/blog/2021/05/09/2.3.0.html#use-arrays-instead-of-concat-9733httpsgithubcomprettierprettierpull9733-by-fiskerhttpsgithubcomfisker-thorn0httpsgithubcomthorn0), now it's removed.
The following apis are never documented, they mean to only use internally, now they are removed.
- `prettier.doc.utils.getDocParts`
- `prettier.doc.utils.propagateBreaks`
- `prettier.doc.utils.cleanDoc`
- `prettier.doc.utils.getDocType`
- `prettier.doc.debug.printDocToDebug`
+5
View File
@@ -0,0 +1,5 @@
#### [BREAKING] `textToDoc` trims trailing hard lines (#13220 by @fisker)
Previously, in all core languages, after embedded code printed to `Doc`, we call `prettier.doc.utils.stripTrailingHardline()` to remove the trailing hard lines.
We believe make `textToDoc` return docs without trailing hard lines makes the plugins easier to do `embed` print.
+3
View File
@@ -0,0 +1,3 @@
#### [BREAKING] Removed support for custom parser api (#13250 by @fisker and @thorn0)
Before [plugins](/docs/en/plugins.html) were a thing, Prettier had a similar but more limited feature called custom parsers. It’s been removed in v3.0.0 as its functionality was a subset of what the Plugin API did. If you used it, please check [how to migrate](/docs/en/api.html#custom-parser-api).
+61
View File
@@ -0,0 +1,61 @@
#### [BREAKING] The second argument `parsers` passed to `parsers.parse` has been removed (#13268 by @fisker)
The plugin's `print` function signature changed from
```ts
function parse(text: string, parsers: object, options: object): AST;
```
to
```ts
function parse(text: string, options: object): Promise<AST> | AST;
```
The second argument `parsers` has been removed, if you still need other parser during parse process, you can:
1. Import the plugin yourself
```js
import pluginBabel from "prettier/plugins/babel";
const myCustomPlugin = {
parsers: {
"my-custom-parser": {
async parse(text) {
const ast = await pluginBabel.parsers.babel.parse(text);
ast.program.body[0].expression.callee.name = "_";
return ast;
},
astFormat: "estree",
},
},
};
```
1. Get the parser from the `options` argument
```js
function getParserFromOptions(options, parserName) {
const parserOrParserInitFunction = options.plugins.find((plugin) =>
Object.hasOwn(plugin.parsers, parserName)
)?.parsers[parserName];
return typeof parserOrParserInitFunction === "function"
? parserOrParserInitFunction()
: parserOrParserInitFunction;
}
const myCustomPlugin = {
parsers: {
"my-custom-parser": {
async parse(text, options) {
const babelParser = await getParserFromOptions(options, "babel");
const ast = await babelParser.parse(text);
ast.program.body[0].expression.callee.name = "_";
return ast;
},
astFormat: "estree",
},
},
};
```
+19
View File
@@ -0,0 +1,19 @@
#### [BREAKING] `undefined` and `null` are not passed to plugin's `print` function (#13397 by @fisker)
If your plugin happened to use `print` to print them, please check them in the parent node instead.
```diff
function print(path, print) {
- const value = path.getValue();
- if (!value?.type) {
- return String(value);
- }
- return path.map(print, "values");
+ return path.map((childPath) => {
+ const value = childPath.getValue();
+ return value?.type ? print() : String(value);
+ }, "values");
}
```
+3
View File
@@ -0,0 +1,3 @@
#### [BREAKING] Allow using arbitrary truthy values for `label` docs (#13532 by @thorn0)
The `label` doc builder has been changed. See the [documentation](https://github.com/prettier/prettier/blob/main/commands.md#label).
+3
View File
@@ -0,0 +1,3 @@
#### [BREAKING] `getFileInfo()` resolves config by default (#14108 by @fisker)
`options.resolveConfig` default to `true` now, see the [documentation](https://prettier.io/docs/en/api.html#prettiergetfileinfofilepath--options).
+3
View File
@@ -0,0 +1,3 @@
#### Add `.d.ts` files (#14212 by @sosukesuzuki, @fisker)
Add type definition files required to use Prettier's JavaScript API from TypeScript. This eliminates the need for users to install `@types/prettier`.
+65
View File
@@ -0,0 +1,65 @@
#### Update `prettier.util` (#14317, #14320 by @fisker)
- Added `prettier.util.getNextNonSpaceNonCommentCharacter`
- Changed `prettier.util.getNextNonSpaceNonCommentCharacter`
Signature changed from
```ts
function getNextNonSpaceNonCommentCharacterIndex<N>(
text: string,
node: N,
locEnd: (node: N) => number
): number | false;
```
to
```ts
function getNextNonSpaceNonCommentCharacterIndex(
text: string,
startIndex: number
): number | false;
```
- Changed `prettier.util.isPreviousLineEmpty`
Signature changed from
```ts
function isPreviousLineEmpty<N>(
text: string,
node: N,
locStart: (node: N) => number
): boolean;
```
to
```ts
function isPreviousLineEmpty(text: string, startIndex: number): boolean;
```
- Changed `prettier.util.isNextLineEmpty`
Signature changed from
```ts
function isNextLineEmpty<N>(
text: string,
node: N,
locEnd: (node: N) => number
): boolean;
```
to
```ts
function isNextLineEmpty(text: string, startIndex: number): boolean;
```
- Deprecated `prettier.util.isNextLineEmptyAfterIndex`
Use `prettier.util.isNextLineEmpty` instead.
See the [documentation](https://prettier.io/docs/en/plugins.html#utility-functions) for details.
+3
View File
@@ -0,0 +1,3 @@
#### Fix plugin loading cache (#14576 by @fisker)
Plugin instances are incorrectly memoized, check this [issue](https://github.com/prettier/prettier/issues/13235) for details.
+7
View File
@@ -0,0 +1,7 @@
#### Updated failure message to be more informative (#11369 by @webark)
Updated the "Forgot to run Prettier?" to "Run Prettier to fix."
This keeps the same spirit of the message, but is less likely to be
misinterpreted as it's a more formal message rather than being
somewhat familial.
+10
View File
@@ -0,0 +1,10 @@
#### Change `--loglevel` to `--log-level` (#13204 by @sosukesuzuki)
<!-- prettier-ignore -->
```sh
# Prettier stable
prettier test.js --loglevel=debug
# Prettier main
prettier test.js --log-level=debug
```
+18
View File
@@ -0,0 +1,18 @@
#### Display posix style paths on Windows (#14333 by @fisker)
Align with other tools like ESLint and Stylelint.
<!-- prettier-ignore -->
```jsx
// Prettier stable
Checking formatting...
[warn] src\utils\create-get-visitor-keys.js
[warn] src\utils\unexpected-node-error.js
[warn] Code style issues found in 2 files. Forgot to run Prettier?
// Prettier main
Checking formatting...
[warn] src/utils/create-get-visitor-keys.js
[warn] src/utils/unexpected-node-error.js
[warn] Code style issues found in 2 files. Forgot to run Prettier?
```
+19
View File
@@ -0,0 +1,19 @@
#### Keep trailing-comma for `var` function (#13402 by @sosukesuzuki)
<!-- prettier-ignore -->
```css
/* Input */
.foo {
--bar: var(--baz,);
}
/* Prettier stable */
.foo {
--bar: var(--baz);
}
/* Prettier main */
.foo {
--bar: var(--baz,);
}
```
+41
View File
@@ -0,0 +1,41 @@
#### [BREAKING] Add the pure `css` parser (#7933, #9092, #9093 by @fisker)
Previously, when `--parser=css` was passed, Prettier tried to parse the content using `postcss-scss` and `postcss-less`. This caused confusion, and made syntax errors difficult to spot. Now `--parser=css` works only with the vanilla CSS syntax.
_If you use `parser="css"` for your `.less`/`.scss` files, update it to the correct parser or remove the `parser` option to let Prettier auto-detect the parser by the file extension._
<!-- prettier-ignore -->
```less
/* Input */
/* Less Syntax with `--parser=css` */
a {.bordered();}
/* Prettier stable */
/* Less Syntax with `--parser=css` */
a {
.bordered();
}
/* Prettier main */
SyntaxError: (postcss) CssSyntaxError Unknown word (2:4)
1 | /* Less Syntax with `--parser=css` */
> 2 | a {.bordered();}
```
<!-- prettier-ignore -->
```scss
/* Input */
/* Scss Syntax with `--parser=css` */
::before {content: #{$foo}}
/* Prettier stable */
/* Scss Syntax with `--parser=css` */
::before {
content: #{$foo};
}
/* Prettier main */
SyntaxError: (postcss) CssSyntaxError Unknown word (2:22)
1 | /* Scss Syntax with `--parser=css` */
> 2 | ::before {content: #{$foo}}
```
+42
View File
@@ -0,0 +1,42 @@
#### Improve custom properties format (#9209 by @fisker)
Thanks to [`PostCSS 8.0`](https://github.com/postcss/postcss/releases/tag/8.0.0), we can handle these edge cases on custom properties.
<!-- prettier-ignore -->
```css
/* Input */
:root {
--empty: ;
--JSON: [1, "2", {"three": {"a":1}}, [4]];
--javascript: function(rule) { console.log(rule) };
}
@supports (--element(".minwidth", { "minWidth": 300 })) {
[--self] {
background: greenyellow;
}
}
/* Prettier stable */
SyntaxError: (postcss) CssSyntaxError Missed semicolon (3:20)
1 | :root {
2 | --empty: ;
> 3 | --JSON: [1, "2", {"three": {"a":1}}, [4]];
| ^
4 | --javascript: function(rule) { console.log(rule) };
5 | }
6 |
/* Prettier main */
:root {
--empty: ;
--JSON: [1, "2", {"three": {"a": 1}}, [4]];
--javascript: function(rule) {console.log(rule)};
}
@supports (--element(".minwidth", {"minWidth": 300})) {
[--self] {
background: greenyellow;
}
}
```
+21
View File
@@ -0,0 +1,21 @@
#### An object type in a `declare function` signature now breaks before the return type (#13396 by @thorn0)
This behavior has been unified with how TypeScript is formatted.
<!-- prettier-ignore -->
```jsx
// Input
declare function bla (props: { a: boolean, b: string, c: number }): Promise<Array<foo>>
// Prettier stable
declare function bla(props: { a: boolean, b: string, c: number }): Promise<
Array<foo>
>;
// Prettier main
declare function bla(props: {
a: boolean;
b: string;
c: number;
}): Promise<Array<foo>>;
```
+27
View File
@@ -0,0 +1,27 @@
#### [BREAKING] Remove support for Flow comments (#13687, #13703 by @thorn0)
Being a kind of preprocessor, [Flow comments](https://flow.org/blog/2015/02/20/Flow-Comments/) AKA [comment types](https://flow.org/en/docs/types/comments/) are processed on the token level and can't be represented in an AST in the general case. Flow builds the AST as if these special comment tokens didn't exist. Example:
<!-- prettier-ignore -->
```js
/*:: if */ (x) + y;
```
This is parsed as `if (x) +y;` by Flow and as `x + y;` by JS parsers that don't support Flow.
Previously, for some special cases, Prettier tried to detect that this syntax was used and to preserve it. As an attempt to solve an unsolvable problem, this limited support was fragile and riddled with bugs, so it has been removed. Now if the `parser` option is set to `flow` or `babel-flow`, Flow comments will be parsed and reprinted like normal code. If a parser that doesn't support Flow is used, they will be treated like usual comments.
<!-- prettier-ignore -->
```js
// Input
let a /*: foo */ = b;
// Prettier stable
let a /*: foo */ = b;
// Prettier main with --parser flow
let a: foo = b;
// Prettier main with --parser babel
let a /*: foo */ = b;
```
+40
View File
@@ -0,0 +1,40 @@
#### [BREAKING] Print trailing comma in type parameters and tuple types when `--trailing-comma=es5` (#14086, #14085 by @fisker)
<!-- prettier-ignore -->
```js
// Input
type Foo = [
{
from: string,
to: string,
}, // <- 1
];
type Foo = Promise<
| { ok: true, bar: string, baz: SomeOtherLongType }
| { ok: false, bar: SomeOtherLongType }, // <- 2
>;
// Prettier stable
type Foo = [
{
from: string,
to: string,
} // <- 1
];
type Foo = Promise<
| { ok: true, bar: string, baz: SomeOtherLongType }
| { ok: false, bar: SomeOtherLongType } // <- 2
>;
// Prettier main
type Foo = [
{
from: string,
to: string,
}, // <- 1
];
type Foo = Promise<
| { ok: true, bar: string, baz: SomeOtherLongType }
| { ok: false, bar: SomeOtherLongType }, // <- 2
>;
```
+16
View File
@@ -0,0 +1,16 @@
#### [Breaking] Drop support for "comma separated interfaces" syntax (#12835 by @fisker)
<!-- prettier-ignore -->
```graphql
# Input
type Type1 implements A, B {a: a}
# Prettier stable
type Type1 implements A, B {
a: a
}
# Prettier main
SyntaxError: Syntax Error: Unexpected Name "B". (1:26)
> 1 | type Type1 implements A, B {a: a}
```
+3
View File
@@ -0,0 +1,3 @@
#### Update angular-html-parser (#13578 by @thorn0)
Prettier's fork of Angular's HTML parser was synced with the upstream.
+22
View File
@@ -0,0 +1,22 @@
#### Print HTML5 `doctype` in lowercase (#7391 by @fisker)
<!-- prettier-ignore -->
```html
<!-- Input -->
<!DocType html>
<html><head></head><body></body></html>
<!-- Prettier stable -->
<!DOCTYPE html>
<html>
<head></head>
<body></body>
</html>
<!-- Prettier main -->
<!doctype html>
<html>
<head></head>
<body></body>
</html>
```
+21
View File
@@ -0,0 +1,21 @@
#### Support the "decorated function" pattern (#10714 by @thorn0)
In this case the developer is usually willing to sacrifice the readability of the arrow function's signature to get less indentation in its body. Prettier now recognizes this pattern and keeps the arrow function hugged even if the signature breaks.
<!-- prettier-ignore -->
```ts
// Prettier stable
const Counter = decorator("my-counter")(
(props: { initialCount?: number; label?: string }) => {
// ...
}
);
// Prettier main
const Counter = decorator("my-counter")((props: {
initialCount?: number;
label?: string;
}) => {
// ...
});
```
+7
View File
@@ -0,0 +1,7 @@
#### [BREAKING] Change the default value for `trailingComma` to `all` (#11479 by @fisker, #13143 by @sosukesuzuki)
Since version 2.0. we've changed the default value for `trailingComma` to `es5`.
[Internet Explorer, the last browser to not allow trailing commas in function calls, has been unsupported on June 15, 2022.](https://docs.microsoft.com/en-us/lifecycle/announcements/internet-explorer-11-end-of-support) Accordingly, change the default value for `trailingComma` to `all`.
If the old behavior is still preferred, please configure Prettier with `{ "trailingComma": "es5" }`.
+16
View File
@@ -0,0 +1,16 @@
#### Fix cursor positioning for files containing emoji (#13340 by @fisker)
```console
$ cat test.js
const { formatWithCursor } = await import("prettier");
const code = "'😀😀😀😀'";
await formatWithCursor(code, {parser: "babel", cursorOffset: 9})
# Prettier stable
$ node test.js
{ formatted: '"😀😀😀😀";\n', cursorOffset: 5, comments: [] }
# Prettier main
$ node test.js
{ formatted: '"😀😀😀😀";\n', cursorOffset: 9, comments: [] }
```
+68
View File
@@ -0,0 +1,68 @@
#### Fix edge cases of the first call argument expansion (#13341 by @thorn0)
<!-- prettier-ignore -->
```jsx
// Input
export default whatever(function (a: {
aaaaaaaaa: string;
bbbbbbbbb: string;
ccccccccc: string;
}) {
return null;
}, "xyz");
call(
function() {
return 1;
},
$var ?? $var ?? $var ?? $var ?? $var ?? $var ?? $var ?? $var ?? $var ?? 'test'
);
// Prettier stable
export default whatever(function (a: {
aaaaaaaaa: string;
bbbbbbbbb: string;
ccccccccc: string;
}) {
return null;
},
"xyz");
call(function () {
return 1;
}, $var ??
$var ??
$var ??
$var ??
$var ??
$var ??
$var ??
$var ??
$var ??
"test");
// Prettier main
export default whatever(function (a: {
aaaaaaaaa: string,
bbbbbbbbb: string,
ccccccccc: string,
}) {
return null;
}, "xyz");
call(
function () {
return 1;
},
$var ??
$var ??
$var ??
$var ??
$var ??
$var ??
$var ??
$var ??
$var ??
"test",
);
```
+33
View File
@@ -0,0 +1,33 @@
#### Fix indentation of arrow function chains in call arguments and binary expressions (#13391 by @thorn0)
The motivation behind the chosen formatting is to make it clear how many arguments the call has.
However, there was a bug with the indentation of the first signature in the chain if that signature didn't fit on one line.
<!-- prettier-ignore -->
```js
// Prettier stable
askTrovenaBeenaDependsRowans(
glimseGlyphsHazardNoopsTieTie,
(
averredBathersBoxroomBuggyNurl,
anodyneCondosMalateOverateRetinol = "default"
) =>
(annularCooeedSplicesWalksWayWay) =>
(kochabCooieGameOnOboleUnweave) =>
abugidicRomanocastorProvider,
weaponizedStellatedOctahedron
);
// Prettier main
askTrovenaBeenaDependsRowans(
glimseGlyphsHazardNoopsTieTie,
(
averredBathersBoxroomBuggyNurl,
anodyneCondosMalateOverateRetinol = "default",
) =>
(annularCooeedSplicesWalksWayWay) =>
(kochabCooieGameOnOboleUnweave) =>
abugidicRomanocastorProvider,
weaponizedStellatedOctahedron,
);
```
+19
View File
@@ -0,0 +1,19 @@
#### Don't break signature of hugged function expression if parameters are identifiers without types (#13410 by @thorn0)
<!-- prettier-ignore -->
```tsx
// Prettier stable
export const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link(
props,
ref
) {
return <ThemeUILink ref={ref} variant="default" {...props} />;
});
// Prettier main
export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
function Link(props, ref) {
return <ThemeUILink ref={ref} variant="default" {...props} />;
},
);
```
+16
View File
@@ -0,0 +1,16 @@
#### Fix interleaved comments (#13438 by @thorn0)
<!-- prettier-ignore -->
```js
// Input
function x() {
} // first
; // second
// Prettier stable
function x() {} // first // second
// Prettier main
function x() {} // first
// second
```
+60
View File
@@ -0,0 +1,60 @@
#### Support nestled JSDoc comments (#13445 by @thorn0)
This kind of comments is used to document overloaded functions (see https://github.com/jsdoc/jsdoc/issues/1017).
<!-- prettier-ignore -->
```jsx
// Input
/**
* @template T
* @param {Type} type
* @param {T} value
* @return {Value}
*//**
* @param {Type} type
* @return {Value}
*/
function value(type, value) {
if (arguments.length === 2) {
return new ConcreteValue(type, value);
} else {
return new Value(type);
}
}
// Prettier stable
/**
* @template T
* @param {Type} type
* @param {T} value
* @return {Value}
*/ /**
* @param {Type} type
* @return {Value}
*/
function value(type, value) {
if (arguments.length === 2) {
return new ConcreteValue(type, value);
} else {
return new Value(type);
}
}
// Prettier main
/**
* @template T
* @param {Type} type
* @param {T} value
* @return {Value}
*//**
* @param {Type} type
* @return {Value}
*/
function value(type, value) {
if (arguments.length === 2) {
return new ConcreteValue(type, value);
} else {
return new Value(type);
}
}
```
+32
View File
@@ -0,0 +1,32 @@
#### Fix unstable template literals with embedded languages (#13532 by @thorn0)
If a template literal with embedded syntax is the only argument of a call or the body of an arrow function and has leading and trailing whitespace, it won't be printed on a new line.
<!-- prettier-ignore -->
```js
// Input
foo(/* HTML */ ` <!-- bar1 --> bar <!-- bar2 --> `);
// Prettier stable (first output)
foo(
/* HTML */ `
<!-- bar1 -->
bar
<!-- bar2 -->
`
);
// Prettier stable (second output)
foo(/* HTML */ `
<!-- bar1 -->
bar
<!-- bar2 -->
`);
// Prettier main (first output)
foo(/* HTML */ `
<!-- bar1 -->
bar
<!-- bar2 -->
`);
```
+34
View File
@@ -0,0 +1,34 @@
#### Fix indention of expressions in template literals (#13621 by @fisker)
<!-- prettier-ignore -->
```js
// Input
`
1. Go to ${chalk.green.underline(FOO_LINK)}
2. Click "${chalk.green(
"Run workflow"
)}" button, type "${chalk.yellow.underline(
version
)}", hit the "${chalk.bgGreen("Run workflow")}" button.
`
// Prettier stable
`
1. Go to ${chalk.green.underline(FOO_LINK)}
2. Click "${chalk.green(
"Run workflow"
)}" button, type "${chalk.yellow.underline(
version
)}", hit the "${chalk.bgGreen("Run workflow")}" button.
`;
// Prettier main
`
1. Go to ${chalk.green.underline(FOO_LINK)}
2. Click "${chalk.green(
"Run workflow",
)}" button, type "${chalk.yellow.underline(
version,
)}", hit the "${chalk.bgGreen("Run workflow")}" button.
`;
```
+12
View File
@@ -0,0 +1,12 @@
#### Add support for "Explicit Resource Management" proposal (#13752 by @fisker)
The Stage 2 proposal ["Explicit Resource Management"](https://github.com/tc39/proposal-explicit-resource-management/) is now supported via Babel 7.20.0. Also keep in mind our [policy on non-standardized syntax](https://prettier.io/docs/en/rationale.html#disclaimer-about-non-standard-syntax) before using this proposed syntax feature with Prettier.
<!-- prettier-ignore -->
```js
// Examples
{
using obj = g(); // block-scoped declaration
const r = obj.next();
} // calls finally blocks in `g`
```
+9
View File
@@ -0,0 +1,9 @@
#### Add support for "Import Reflection" proposal (#13771 by @fisker)
The Stage 2 proposal ["Import Reflection"](https://github.com/tc39/proposal-import-reflection) is now supported via Babel 7.20.0. Also keep in mind our [policy on non-standardized syntax](https://prettier.io/docs/en/rationale.html#disclaimer-about-non-standard-syntax) before using this proposed syntax feature with Prettier.
<!-- prettier-ignore -->
```js
// Examples
import module x from "<specifier>";
```
+28
View File
@@ -0,0 +1,28 @@
#### Fix inconsistent between array/tuple and object/record (#14065 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
foo.a().b().c([n, o])
foo.a().b().c(#[n, o])
foo.a().b().c({n, o})
foo.a().b().c(#{n, o})
// Prettier stable
foo.a().b().c([n, o]);
foo
.a()
.b()
.c(#[n, o]);
foo.a().b().c({ n, o });
foo
.a()
.b()
.c(#{ n, o });
// Prettier main
foo.a().b().c([n, o]);
foo.a().b().c(#[n, o]);
foo.a().b().c({ n, o });
foo.a().b().c(#{ n, o });
```
+22
View File
@@ -0,0 +1,22 @@
#### Avoid unnecessarily indenting nested `await` expressions (#14192 by @thorn0)
A refinement of [this change in v2.3](https://prettier.io/blog/2021/05/09/2.3.0.html#improve-formatting-for-nested-await-expressions-in-heads-of-member-and-call-expressions-10342httpsgithubcomprettierprettierpull10342-by-thorn0httpsgithubcomthorn0). Sometimes there is no need to force indentation of nested `await` expressions.
<!-- prettier-ignore -->
```jsx
// Prettier stable
await Promise.all(
(
await readdir("src")
).map((path) => {
import(`./${path}`);
})
);
// Prettier main
await Promise.all(
(await readdir("src")).map((path) => {
import(`./${path}`);
}),
);
```
+3
View File
@@ -0,0 +1,3 @@
#### [BREAKING] Remove Flow syntax support from `babel` parser (#14314 by @fisker, @thorn0)
For historical reasons, Prettier used to recognize Flow syntax in JS files when the `parser` option was set to `babel` even if the file didn't include the `@flow` pragma. This support was limited and bad for performance, so it has been removed in Prettier main. Prettier with the `babel` parser still automatically switches to the Flow syntax if it finds the `@flow` pragma or the file has the `.flow.js` extension.
+3
View File
@@ -0,0 +1,3 @@
#### Support regexp modifiers proposal (#14391 by @fisker)
See [Regular Expression Pattern Modifiers for ECMAScript](https://github.com/tc39/proposal-regexp-modifiers).
+46
View File
@@ -0,0 +1,46 @@
#### Fix missing parentheses and semicolons around `prettier-ignore`d nodes (#14406 by @fisker)
<!-- prettier-ignore -->
```js
// Input
async function request(url) {
return (
// prettier-ignore
await fetch(url)
).json()
}
// Prettier stable
async function request(url) {
return (
// prettier-ignore
await fetch(url).json()
);
}
// Prettier main
async function request(url) {
return (
// prettier-ignore
(await fetch(url)).json()
);
}
```
<!-- prettier-ignore -->
```js
// Input
foo();
// prettier-ignore
[bar, baz].forEach(console.log)
// Prettier stable (--no-semi)
foo()
// prettier-ignore
[bar, baz].forEach(console.log)
// Prettier main
foo()
// prettier-ignore
;[bar, baz].forEach(console.log)
```
+23
View File
@@ -0,0 +1,23 @@
#### Remove unnecessary parentheses around class expression (#14409 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
call(
@dec class {}
);
// Prettier stable
call(
(
@dec
class {}
)
);
// Prettier main
call(
@dec
class {},
);
```
+16
View File
@@ -0,0 +1,16 @@
#### Fix interpolation parse error (#11343 by @fisker)
<!-- prettier-ignore -->
```less
// Input
@{selector}-title{ @{prop}-size: @{color} }
// Prettier stable
SyntaxError: CssSyntaxError: Unknown word (1:20)
> 1 | @{selector}-title{ @{prop}-size: @{color} }
// Prettier main
@{selector}-title {
@{prop}-size: @{color};
}
```
+27
View File
@@ -0,0 +1,27 @@
#### Keep inline JavaScript code as it is (#14109 by @fisker)
<!-- prettier-ignore -->
```less
// Input
.calcPxMixin() {
@functions: ~`(function() {
const designWidth = 3840
const actualWidth = 5760
this.calcPx = function(_) {
return _ * actualWidth / designWidth + 'px'
}
})()`;
}
// Prettier stable
.calcPxMixin() {
@functions: ~`(
function() {const designWidth = 3840 const actualWidth = 5760 this.calcPx =
function(_) {return _ * actualWidth / designWidth + "px"}}
)
() `;
}
// Prettier main
<Same as input>
```
+104
View File
@@ -0,0 +1,104 @@
#### [HIGHLIGHT] Improve handling of whitespace for Chinese, Japanese, and Korean (#11597 by @tats-u)
##### Stop inserting spaces between Chinese or Japanese and Western characters
Previously, Prettier would insert spaces between Chinese or Japanese and Western characters (letters and digits). While some people prefer this style, it isn’t standard, and is in fact contrary to official guidelines. Please see [here](https://github.com/tats-u/prettier-plugin-md-nocjsp#why-this-plugin-is-needed) for more details. We decided it’s not Prettier’s job to enforce a particular style in this case, so spaces aren’t inserted anymore, while existing ones are preserved. If you need a tool for enforcing spacing style, consider [textlint-ja](https://github.com/textlint-ja/textlint-rule-preset-ja-spacing/tree/master/packages/textlint-rule-ja-space-between-half-and-full-width) or [lint-md](https://github.com/lint-md/lint-md) (rules `space-round-alphabet` and `space-round-number`).
The tricky part of this change were ambiguous line breaks between Chinese or Japanese and Western characters. When Prettier unwraps text, it needs to decide whether such a line break should be simply removed or replaced with a space. For that Prettier examines the surrounding text and infers the preferred style.
<!-- prettier-ignore -->
```markdown
<!-- Input -->
漢字
Alphabetsひらがな12345カタカナ67890
漢字 Alphabets ひらがな 12345 カタカナ 67890
<!-- Prettier stable -->
漢字 Alphabets ひらがな 12345 カタカナ 67890
漢字 Alphabets ひらがな 12345 カタカナ 67890
<!-- Prettier main -->
漢字Alphabetsひらがな12345カタカナ67890
漢字 Alphabets ひらがな 12345 カタカナ 67890
```
##### Comply to line breaking rules in Chinese and Japanese
There are rules that prohibit certain characters from appearing at the beginning or the end of a line in [Chinese](https://www.w3.org/TR/clreq/#prohibition_rules_for_line_start_end) and [Japanese](https://www.w3.org/TR/jlreq/#characters_not_starting_a_line). E.g., full stop characters `。`, `.`, and `.` shouldn’t start a line whereas `(` shouldn’t end a line. Prettier now follows these rules when it wraps text, that is when `proseWrap` is set to `always`.
<!-- prettier-ignore -->
```markdown
<!-- Input -->
HTCPCPのエラー418は、ティーポットにコーヒーを淹(い)れさせようとしたときに返されるステータスコードだ。
<!-- Prettier stable with --prose-wrap always --print-width 8 -->
HTCPCP の
エラー
418 は、
ティーポ
ットにコ
ーヒーを
淹(い)
れさせよ
うとした
ときに返
されるス
テータス
コードだ
。
<!-- Prettier main with the same options -->
HTCPCPの
エラー
418は、
ティー
ポットに
コーヒー
を淹
(い)れ
させよう
としたと
きに返さ
れるス
テータス
コード
だ。
```
##### Do not break lines inside Korean words
Korean uses spaces to divide words, and an inappropriate division may change the meaning of a sentence:
- `노래를 못해요.`: I’m not good at singing.
- `노래를 못 해요.`: I can’t sing (for some reason).
Previously, when `proseWrap` was set to `always`, successive Hangul characters could get split by a line break, which could later be converted to a space when the document is edited and reformatted. This doesn’t happen anymore. Korean text is now wrapped like English.
<!-- prettier-ignore -->
```markdown
<!-- Input -->
노래를 못해요.
<!-- Prettier stable with --prose-wrap always --print-width 9 -->
노래를 못
해요.
<!-- Prettier stable, subsequent reformat with --prose-wrap always --print-width 80 -->
노래를 못 해요.
<!-- Prettier main with --prose-wrap always --print-width 9 -->
노래를
못해요.
<!-- Prettier main, subsequent reformat with --prose-wrap always --print-width 80 -->
노래를 못해요.
```
A line break between Hangul and non-Hangul letters and digits is converted to a space when Prettier unwraps the text. Consider this example:
> 3분 기다려 주지.
In this sentence, if you break the line between “3” and “분”, a space will be inserted there when the text gets unwrapped.
+15
View File
@@ -0,0 +1,15 @@
#### Preserve multiple spaces in inline code (#13590 by @kachkaev and @thorn0)
Previously, multiple whitespace characters in inline code were collapsed into a single space. This is no longer happening to match [CommonMark spec](https://spec.commonmark.org/0.30/#backtick-string).
<!-- prettier-ignore -->
```markdown
<!-- Input -->
` foo bar baz `
<!-- Prettier stable -->
` foo bar baz `
<!-- Prettier main -->
` foo bar baz `
```
+16
View File
@@ -0,0 +1,16 @@
#### Fix formatting string value that includes escape `\` (#13487 by @sosukesuzuki)
<!-- prettier-ignore -->
```scss
/* Input */
$description: "Lorem ipsum dolor sit \"amet\", consectetur adipiscing elit, " +
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
/* Prettier stable */
$description: 'Lorem ipsum dolor sit "amet", consectetur adipiscing elit, '+ "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
/* Prettier main */
$description: 'Lorem ipsum dolor sit "amet", consectetur adipiscing elit, ' +
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
```
+22
View File
@@ -0,0 +1,22 @@
#### Fix leading comments in mapped types with `readonly` (#13427 by @thorn0, @sosukesuzuki)
<!-- prettier-ignore -->
```tsx
// Input
type Type = {
// comment
readonly [key in Foo];
};
// Prettier stable
type Type = {
readonly // comment
[key in Foo];
};
// Prettier main
type Type = {
// comment
readonly [key in Foo];
};
```
+27
View File
@@ -0,0 +1,27 @@
#### Consistent dangling comments formatting for tuple types and arrays (#13608 by @sosukesuzuki)
<!-- prettier-ignore -->
```tsx
// Input
type Foo = [
// comment
];
const bar = [
// comment
];
// Prettier stable
type Foo = [// comment];
const bar = [
// comment
];
// Prettier main
type Foo = [
// comment
];
const bar = [
// comment
];
```
+18
View File
@@ -0,0 +1,18 @@
#### Fix union type should be printed in the multi-line variant when there are comments (#13860 by @PerfectPan)
<!-- prettier-ignore -->
```tsx
// Input
type FooBar =
| Number // this documents the first option
| void // this documents the second option
;
// Prettier stable
type FooBar = Number | void; // this documents the first option // this documents the second option
// Prettier main
type FooBar =
| Number // this documents the first option
| void; // this documents the second option
```
+33
View File
@@ -0,0 +1,33 @@
#### Improve comment print and cursor tracking around type annotation (#14171 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
let foo /* comment */ : number;
// Prettier stable
let foo: /* comment */ number;
// Prettier main
<Same as input>
```
```js
// Prettier stable
prettier.formatWithCursor("let foo: number", {
cursorOffset: 7,
parser: "babel",
}).cursorOffset;
// -> 9
// Prettier main
(
await prettier.formatWithCursor("let foo: number", {
cursorOffset: 7,
parser: "babel",
})
).cursorOffset;
// -> 7
```
+25
View File
@@ -0,0 +1,25 @@
#### Break on TypeScript parameter properties (#14402 by @seiyab)
<!-- prettier-ignore -->
```ts
// Input
class MyClass {
constructor(
protected x: number,
private y: string
) {}
}
// Prettier stable
class MyClass {
constructor(protected x: number, private y: string) {}
}
// Prettier main
class MyClass {
constructor(
protected x: number,
private y: string,
) {}
}
```
+19
View File
@@ -0,0 +1,19 @@
#### Ignore `htmlWhitespaceSensitivity` when formatting Vue SFC root blocks (#14401 by @fisker)
<!-- prettier-ignore -->
```html
<!-- Input -->
<docs lang=unknown></docs><docs lang=unknown></docs><!-- display: inline --><docs lang=unknown></docs><docs lang=unknown style="display: inline"></docs>
<!-- Prettier stable (--html-whitespace-sensitivity=strict) -->
<docs lang="unknown"></docs>><docs lang="unknown"></docs
><!-- display: inline --><docs lang="unknown"></docs
>><docs lang="unknown" style="display: inline"></docs>
<!-- Prettier main -->
<docs lang="unknown"></docs>
<docs lang="unknown"></docs>
<!-- display: inline -->
<docs lang="unknown"></docs>
<docs lang="unknown" style="display: inline"></docs>
```
+22
View File
@@ -0,0 +1,22 @@
#### Format TypeScript expression in attribute bindings (#14506 by @seiyab)
<!-- prettier-ignore -->
```vue
<!-- Input -->
<script lang="ts"></script>
<template>
<comp :foo=" (a:string)=>1"/>
</template>
<!-- Prettier stable -->
<script lang="ts"></script>
<template>
<comp :foo=" (a:string)=>1" />
</template>
<!-- Prettier main -->
<script lang="ts"></script>
<template>
<comp :foo="(a: string) => 1" />
</template>
```
+55
View File
@@ -0,0 +1,55 @@
#### Fix Vue filter detection (#14542 by @fisker)
<!-- prettier-ignore -->
```vue
<!-- Input -->
<template>
<div>
{{
fn(
bitwise | or | operator | a_long_long_long_long_long_long_long_long_long_long_variable
)
| filter1
| filter2
| filter3
| filter4
}}
</div>
</template>
<!-- Prettier stable -->
<template>
<div>
{{
fn(
bitwise
| or
| operator
| a_long_long_long_long_long_long_long_long_long_long_variable
)
| filter1
| filter2
| filter3
| filter4
}}
</div>
</template>
<!-- Prettier main -->
<template>
<div>
{{
fn(
bitwise |
or |
operator |
a_long_long_long_long_long_long_long_long_long_long_variable,
)
| filter1
| filter2
| filter3
| filter4
}}
</div>
</template>
```
+19
View File
@@ -0,0 +1,19 @@
#### Avoid unnecessary leading semicolon (#14557 by @fisker)
<!-- prettier-ignore -->
```vue
<!-- Input -->
<template>
<div @click="[foo, bar].forEach(fn => void fn())"></div>
</template>
<!-- Prettier stable (With `--no-semi` option) -->
<template>
<div @click=";[foo, bar].forEach((fn) => void fn())"></div>
</template>
<!-- Prettier main -->
<template>
<div @click="[foo, bar].forEach((fn) => void fn())"></div>
</template>
```
+7 -15
View File
@@ -1,4 +1,4 @@
The core of the algorithm is implemented in `src/document/doc-{printer,builders,utils}.js`. The printer uses the basic formatting abstractions provided to construct a format when printing a node.
The core of the algorithm is implemented in `src/document/{printer,builders,utils}.js`. The printer uses the basic formatting abstractions provided to construct a format when printing a node.
## Prettier's intermediate representation: `Doc`
@@ -83,8 +83,8 @@ Expects the `docs` argument to be an array of alternating content and line break
```ts
declare function ifBreak(
ifBreak: Doc,
noBreak?: Doc,
breakContents: Doc,
flatContents?: Doc,
options?: { groupId?: symbol }
): Doc;
```
@@ -276,13 +276,15 @@ It doesn't make sense to apply `indentIfBreak` to the current group because "ind
_Added in v2.3.0_
```ts
declare function label(label: string, doc: Doc): Doc;
declare function label(label: any, doc: Doc): Doc;
```
Mark a doc with a string label. This doesn't affect how the doc is printed, but can be useful for heuristics based on doc introspection.
Mark a doc with an arbitrary truthy value. This doesn't affect how the doc is printed, but can be useful for heuristics based on doc introspection.
E.g., to decide how to print an assignment expression, we might want to know whether its right-hand side has been printed as a method call chain, not as a plain function call. If the method chain printing code uses `label` to mark its result, checking that condition can be as easy as `rightHandSideDoc.label === 'method-chain'`.
If the `label` argument is falsy, `doc` is returned as is, without wrapping.
### `hardlineWithoutBreakParent` and `literallineWithoutBreakParent`
_Added in v2.3.0_
@@ -307,16 +309,6 @@ declare const cursor: Doc;
This is a placeholder value where the cursor is in the original input in order to find where it would be printed.
### [Deprecated] `concat`
_This command has been deprecated in v2.3.0, use `Doc[]` instead_
```ts
declare function concat(docs: Doc[]): Doc;
```
Combine an array into a single doc.
## Example
For an example, here's the implementation of the `ArrayExpression` node type:
+10 -22
View File
@@ -27,7 +27,6 @@
"autoloaded",
"autoloading",
"Azzola",
"backport",
"backticks",
"behaviour",
"Bekkelund",
@@ -42,7 +41,6 @@
"Breakell",
"Brevik",
"browserslist",
"builtins",
"callees",
"camelcase",
"camelified",
@@ -54,16 +52,15 @@
"cliify",
"cmds",
"codebases",
"codecov",
"Codecov",
"codemirror",
"codemod",
"codemods",
"commonmark",
"compat",
"concat",
"concating",
"cond",
"corejs",
"csharpier",
"daleroy",
"danez",
"Dara",
@@ -75,7 +72,6 @@
"Deloise",
"deopt",
"deps",
"dessant",
"desugared",
"devcontainer",
"devs",
@@ -94,12 +90,10 @@
"Eneman",
"ENOENT",
"EOTP",
"eqeqeq",
"Ericsburgh",
"Esben",
"esbenp",
"esbuild",
"eslintignore",
"eslump",
"espree",
"esproposal",
@@ -108,6 +102,7 @@
"execa",
"fbglyph",
"fdescribe",
"fesm",
"Ficarra",
"Filipe",
"Fiorini",
@@ -145,12 +140,11 @@
"iarna",
"ICSS",
"idempotence",
"IIFE",
"iife",
"IIFEs",
"ikatyang",
"Ilya",
"impltype",
"importee",
"importmap",
"Indentable",
"infc",
@@ -169,7 +163,6 @@
"jsesc",
"jsfmt",
"jsonata",
"jsonl",
"judgements",
"kalmanb",
"Karimov",
@@ -241,7 +234,6 @@
"octicon",
"Okazaki",
"Okonetchnikov",
"onwarn",
"Oopsy",
"outdent",
"outfile",
@@ -256,21 +248,19 @@
"pcss",
"Pierzchała",
"Pieter",
"pnpapi",
"pnpm",
"postprocess",
"posix",
"postprocessor",
"preactjs",
"prebuilds",
"precache",
"precommit",
"prefetch",
"preorder",
"preprocess",
"prettierformatsource",
"prettiergetsupportinfo",
"prettierignore",
"prettierrc",
"prettierx",
"probot",
"progid",
"proto",
"Pschera",
@@ -287,7 +277,6 @@
"Redeclaration",
"refmt",
"regexes",
"Reimplement",
"rhengles",
"Roadmap",
"Rubocop",
@@ -318,7 +307,6 @@
"standalones",
"Stankiewicz",
"starturl",
"stringifier",
"stylefmt",
"styleguides",
"stylelint",
@@ -333,6 +321,7 @@
"templating",
"tempy",
"testname",
"textlint",
"tldr",
"Tomasek",
"toplevel",
@@ -414,10 +403,9 @@
"*.{log,svg,snap,png}",
"website/data/users.yml",
"website/build/**",
"website/playground/codeSamples.js",
"website/playground/codeSamples.mjs",
"website/pages/googlefe164a33bda4034b.html",
"website/static/lib/**",
"website/static/playground.js",
"scripts/vendors/vendor-meta.json"
"website/static/playground.js"
]
}
+28 -34
View File
@@ -6,7 +6,7 @@ title: API
If you want to run Prettier programmatically, check this page out.
```js
const prettier = require("prettier");
import * as prettier from "prettier";
```
## `prettier.format(source, options)`
@@ -14,13 +14,13 @@ const prettier = require("prettier");
`format` is used to format text using Prettier. `options.parser` must be set according to the language you are formatting (see the [list of available parsers](options.md#parser)). Alternatively, `options.filepath` can be specified for Prettier to infer the parser from the file extension. Other [options](options.md) may be provided to override the defaults.
```js
prettier.format("foo ( );", { semi: false, parser: "babel" });
// -> "foo()"
await prettier.format("foo ( );", { semi: false, parser: "babel" });
// -> 'foo()\n'
```
## `prettier.check(source [, options])`
`check` checks to see if the file has been formatted with Prettier given those options and returns a `Boolean`. This is similar to the `--check` or `--list-different` parameter in the CLI and is useful for running Prettier in CI scenarios.
`check` checks to see if the file has been formatted with Prettier given those options and returns a `Promise<boolean>`. This is similar to the `--check` or `--list-different` parameter in the CLI and is useful for running Prettier in CI scenarios.
## `prettier.formatWithCursor(source [, options])`
@@ -29,7 +29,7 @@ prettier.format("foo ( );", { semi: false, parser: "babel" });
The `cursorOffset` option should be provided, to specify where the cursor is. This option cannot be used with `rangeStart` and `rangeEnd`.
```js
prettier.formatWithCursor(" 1", { cursorOffset: 2, parser: "babel" });
await prettier.formatWithCursor(" 1", { cursorOffset: 2, parser: "babel" });
// -> { formatted: '1;\n', cursorOffset: 1 }
```
@@ -45,10 +45,9 @@ The promise will be rejected if there was an error parsing the configuration fil
If `options.useCache` is `false`, all caching will be bypassed.
```js
const text = fs.readFileSync(filePath, "utf8");
prettier.resolveConfig(filePath).then((options) => {
const formatted = prettier.format(text, options);
});
const text = await fs.readFile(filePath, "utf8");
const options = await prettier.resolveConfig(filePath);
const formatted = await prettier.format(text, options);
```
If `options.editorconfig` is `true` and an [`.editorconfig` file](https://editorconfig.org/) is in your project, Prettier will parse it and convert its properties to the corresponding Prettier configuration. This configuration will be overridden by `.prettierrc`, etc. Currently, the following EditorConfig properties are supported:
@@ -58,8 +57,6 @@ If `options.editorconfig` is `true` and an [`.editorconfig` file](https://editor
- `indent_size`/`tab_width`
- `max_line_length`
Use `prettier.resolveConfig.sync(filePath [, options])` if you’d like to use sync version.
## `prettier.resolveConfigFile([filePath])`
`resolveConfigFile` can be used to find the path of the Prettier configuration file that will be used when resolving the config (i.e. when calling `resolveConfig`). A promise is returned which will resolve to:
@@ -72,13 +69,10 @@ The promise will be rejected if there was an error parsing the configuration fil
The search starts at `process.cwd()`, or at `filePath` if provided. Please see the [cosmiconfig docs](https://github.com/davidtheclark/cosmiconfig#explorersearch) for details on how the resolving works.
```js
prettier.resolveConfigFile(filePath).then((configFile) => {
// you got the path of the configuration file
});
const configFile = await prettier.resolveConfigFile(filePath);
// you got the path of the configuration file
```
Use `prettier.resolveConfigFile.sync([filePath])` if you’d like to use sync version.
## `prettier.clearConfigCache()`
When Prettier loads configuration files and plugins, the file system structure is cached for performance. This function will clear the cache. Generally this is only needed for editor integrations that know that the file system has changed since the last format took place.
@@ -87,10 +81,10 @@ When Prettier loads configuration files and plugins, the file system structure i
`getFileInfo` can be used by editor extensions to decide if a particular file needs to be formatted. This method returns a promise, which resolves to an object with the following properties:
```typescript
```ts
{
ignored: boolean,
inferredParser: string | null,
ignored: boolean;
inferredParser: string | null;
}
```
@@ -102,21 +96,18 @@ If the given `filePath` is ignored, the `inferredParser` is always `null`.
Providing [plugin](plugins.md) paths in `options.plugins` (`string[]`) helps extract `inferredParser` for files that are not supported by Prettier core.
When setting `options.resolveConfig` (`boolean`, default `false`), Prettier will resolve the configuration for the given `filePath`. This is useful, for example, when the `inferredParser` might be overridden for a subset of files.
Use `prettier.getFileInfo.sync(filePath [, options])` if you’d like to use sync version.
When setting `options.resolveConfig` (`boolean`, default `true`) to `false`, Prettier will not search for configuration file. This can be useful if this function is only used to check if file is ignored.
## `prettier.getSupportInfo()`
Returns an object representing the options, parsers, languages and file types Prettier supports.
Returns a promise which resolves to an object representing the options, parsers, languages and file types Prettier supports.
The support information looks like this:
```typescript
```ts
{
languages: Array<{
name: string;
since?: string;
parsers: string[];
group?: string;
tmScope?: string;
@@ -134,16 +125,17 @@ The support information looks like this:
<a name="custom-parser-api"></a>
## Custom Parser API (deprecated)
## Custom Parser API (removed)
_Will be removed in v3.0.0 (superseded by the Plugin API)_
_Removed in v3.0.0 (superseded by the Plugin API)_
Before [plugins](plugins.md) were a thing, Prettier had a similar but more limited feature called custom parsers. It will be removed in v3.0.0 as its functionality is a subset of what the Plugin API does. If you used it, please check the example below on how to migrate.
Before [plugins](plugins.md) were a thing, Prettier had a similar but more limited feature called custom parsers. It’s been removed in v3.0.0 as its functionality was a subset of what the Plugin API did. If you used it, please check the example below on how to migrate.
❌ Custom parser API (deprecated):
❌ Custom parser API (removed):
```js
import { format } from "prettier";
format("lodash ( )", {
parser(text, { babel }) {
const ast = babel(text);
@@ -158,12 +150,13 @@ format("lodash ( )", {
```js
import { format } from "prettier";
import parserBabel from "prettier/parser-babel.js";
import pluginBabel from "prettier/plugins/babel";
const myCustomPlugin = {
parsers: {
"my-custom-parser": {
parse(text) {
const ast = parserBabel.parsers.babel.parse(text);
async parse(text) {
const ast = await pluginBabel.parsers.babel.parse(text);
ast.program.body[0].expression.callee.name = "_";
return ast;
},
@@ -171,7 +164,8 @@ const myCustomPlugin = {
},
},
};
format("lodash ( )", {
await format("lodash ( )", {
parser: "my-custom-parser",
plugins: [myCustomPlugin],
});
@@ -180,4 +174,4 @@ format("lodash ( )", {
> Note: Overall, doing codemods this way isn’t recommended. Prettier uses the location data of AST nodes for many things like preserving blank lines and attaching comments. When the AST is modified after the parsing, the location data often gets out of sync, which may lead to unpredictable results. Consider using [jscodeshift](https://github.com/facebook/jscodeshift) if you need codemods.
As part of the deprecated Custom parser API, it is possible to pass a path to a module exporting a `parse` function via the `--parser` option. Use the `--plugin` CLI option or the `plugins` API option instead to [load plugins](plugins.md#using-plugins).
As part of the removed Custom parser API, it was previously possible to pass a path to a module exporting a `parse` function via the `--parser` option. Use the `--plugin` CLI option or the `plugins` API option instead to [load plugins](plugins.md#using-plugins).
+39 -36
View File
@@ -7,7 +7,7 @@ Run Prettier in the browser using its **standalone** version. This version doesn
The standalone version comes as:
- ES modules: `esm/standalone.mjs`, starting in version 2.2
- ES modules: `standalone.mjs`, starting in version 3.0 (In version 2, `esm/standalone.mjs`.)
- UMD: `standalone.js`, starting in version 1.13
The [`browser` field](https://github.com/defunctzombie/package-browser-field-spec) in Prettier’s `package.json` points to `standalone.js`. That’s why you can just `import` or `require` the `prettier` module to access Prettier’s API, and your code can stay compatible with both Node and the browser as long as webpack or another bundler that supports the `browser` field is used. This is especially convenient for [plugins](plugins.md).
@@ -18,10 +18,7 @@ Required options:
- **[`parser`](options.md#parser) (or [`filepath`](options.md#file-path))**: One of these options has to be specified for Prettier to know which parser to use.
- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource--options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files named
- `parser-*.js` in <https://unpkg.com/browse/prettier@2.8.7/> and
- `parser-*.mjs` in <https://unpkg.com/browse/prettier@2.8.7/esm/>
- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource--options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in <https://unpkg.com/browse/prettier@2.8.7/plugins/>
You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option.
@@ -33,12 +30,14 @@ See below for examples.
```html
<script src="https://unpkg.com/prettier@2.8.7/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.8.7/parser-graphql.js"></script>
<script src="https://unpkg.com/prettier@2.8.7/plugins/graphql.js"></script>
<script>
prettier.format("type Query { hello: String }", {
parser: "graphql",
plugins: prettierPlugins,
});
(async () => {
const formatted = await prettier.format("type Query { hello: String }", {
parser: "graphql",
plugins: prettierPlugins,
});
})();
</script>
```
@@ -48,12 +47,12 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
```html
<script type="module">
import prettier from "https://unpkg.com/prettier@2.8.7/esm/standalone.mjs";
import parserGraphql from "https://unpkg.com/prettier@2.8.7/esm/parser-graphql.mjs";
import * as prettier from "https://unpkg.com/prettier@2.8.7/standalone.mjs";
import pluginGraphql from "https://unpkg.com/prettier@2.8.7/plugins/graphql.mjs";
prettier.format("type Query { hello: String }", {
const formatted = await prettier.format("type Query { hello: String }", {
parser: "graphql",
plugins: [parserGraphql],
plugins: [pluginGraphql],
});
</script>
```
@@ -63,9 +62,9 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
```js
define([
"https://unpkg.com/prettier@2.8.7/standalone.js",
"https://unpkg.com/prettier@2.8.7/parser-graphql.js",
], (prettier, ...plugins) => {
prettier.format("type Query { hello: String }", {
"https://unpkg.com/prettier@2.8.7/plugins/graphql.js",
], async (prettier, ...plugins) => {
const formatted = await prettier.format("type Query { hello: String }", {
parser: "graphql",
plugins,
});
@@ -76,11 +75,13 @@ define([
```js
const prettier = require("prettier/standalone");
const plugins = [require("prettier/parser-graphql")];
prettier.format("type Query { hello: String }", {
parser: "graphql",
plugins,
});
const plugins = [require("prettier/plugins/graphql")];
(async () => {
const formatted = await prettier.format("type Query { hello: String }", {
parser: "graphql",
plugins,
});
})();
```
This syntax doesn’t necessarily work in the browser, but it can be used when bundling the code with browserify, Rollup, webpack, or another bundler.
@@ -89,11 +90,13 @@ This syntax doesn’t necessarily work in the browser, but it can be used when b
```js
importScripts("https://unpkg.com/prettier@2.8.7/standalone.js");
importScripts("https://unpkg.com/prettier@2.8.7/parser-graphql.js");
prettier.format("type Query { hello: String }", {
parser: "graphql",
plugins: prettierPlugins,
});
importScripts("https://unpkg.com/prettier@2.8.7/plugins/graphql.js");
(async () => {
const formatted = await prettier.format("type Query { hello: String }", {
parser: "graphql",
plugins: prettierPlugins,
});
})();
```
## Parser plugins for embedded code
@@ -102,13 +105,13 @@ If you want to format [embedded code](options.md#embedded-language-formatting),
```html
<script type="module">
import prettier from "https://unpkg.com/prettier@2.8.7/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.8.7/esm/parser-babel.mjs";
import * as prettier from "https://unpkg.com/prettier@2.8.7/standalone.mjs";
import pluginBabel from "https://unpkg.com/prettier@2.8.7/plugins/babel.mjs";
console.log(
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
await prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
parser: "babel",
plugins: [parserBabel],
plugins: [pluginBabel],
})
);
// Output: const html = /* HTML */ `<DIV> </DIV>`;
@@ -119,14 +122,14 @@ The HTML code embedded in JavaScript stays unformatted because the `html` parser
```html
<script type="module">
import prettier from "https://unpkg.com/prettier@2.8.7/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.8.7/esm/parser-babel.mjs";
import parserHtml from "https://unpkg.com/prettier@2.8.7/esm/parser-html.mjs";
import * as prettier from "https://unpkg.com/prettier@2.8.7/standalone.mjs";
import pluginBabel from "https://unpkg.com/prettier@2.8.7/plugins/babel.mjs";
import pluginHtml from "https://unpkg.com/prettier@2.8.7/plugins/html.mjs";
console.log(
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
await prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
parser: "babel",
plugins: [parserBabel, parserHtml],
plugins: [pluginBabel, pluginHtml],
})
);
// Output: const html = /* HTML */ `<div></div>`;
+15 -15
View File
@@ -16,7 +16,7 @@ To format a file in-place, use `--write`. (Note: This overwrites your files!)
In practice, this may look something like:
```bash
prettier --write .
prettier . --write
```
This command formats all files supported by Prettier in the current directory and its subdirectories.
@@ -26,7 +26,7 @@ It’s recommended to always make sure that `prettier --write .` only formats wh
A more complicated example:
```bash
prettier --single-quote --trailing-comma all --write docs package.json "{app,__{tests,mocks}__}/**/*.js"
prettier docs package.json "{app,__{tests,mocks}__}/**/*.js" --write --single-quote --trailing-comma all
```
> Don’t forget the **quotes** around the globs! The quotes make sure that Prettier CLI expands the globs rather than your shell, which is important for cross-platform usage.
@@ -53,7 +53,7 @@ When you want to check if your files are formatted, you can run Prettier with th
This will output a human-friendly message and a list of unformatted files, if any.
```bash
prettier --check "src/**/*.js"
prettier . --check
```
Console output if all files are formatted:
@@ -69,7 +69,7 @@ Console output if some of the files require re-formatting:
Checking formatting...
[warn] src/fileA.js
[warn] src/fileB.js
[warn] Code style issues found in 2 files. Forgot to run Prettier?
[warn] Code style issues found in 2 files. Run Prettier to fix.
```
The command will return exit code `1` in the second case, which is helpful inside the CI pipelines.
@@ -95,15 +95,15 @@ If you're worried that Prettier will change the correctness of your code, add `-
If you are repeatedly formatting individual files with `prettier`, you will incur a small performance cost when Prettier attempts to look up a [configuration file](configuration.md). In order to skip this, you may ask Prettier to find the config file once, and re-use it later on.
```bash
prettier --find-config-path ./my/file.js
./my/.prettierrc
```console
$ prettier --find-config-path path/to/file.js
path/to/.prettierrc
```
This will provide you with a path to the configuration file, which you can pass to `--config`:
```bash
prettier --config ./my/.prettierrc --write ./my/file.js
prettier path/to/file.js --write --config path/to/.prettierrc
```
You can also use `--config` if your configuration file lives somewhere where Prettier cannot find it, such as a `config/` directory.
@@ -119,7 +119,7 @@ Path to a file containing patterns that describe files to ignore. By default, Pr
Another useful flag is `--list-different` (or `-l`) which prints the filenames of files that are different from Prettier formatting. If there are differences the script errors out, which is useful in a CI scenario.
```bash
prettier --single-quote --list-different "src/**/*.js"
prettier . --single-quote --list-different
```
You can also use [`--check`](cli.md#--check) flag, which works the same way as `--list-different`, but also prints a human-friendly summary message to stdout.
@@ -158,7 +158,7 @@ Prettier CLI will ignore files located in `node_modules` directory. To opt out f
This rewrites all processed files in place. This is comparable to the `eslint --fix` workflow. You can also use `-w` alias.
## `--loglevel`
## `--log-level`
Change the level of logging for the CLI. Valid options are:
@@ -193,8 +193,8 @@ $ cat abc.css | prettier --stdin-filepath abc.css
With `--ignore-unknown` (or `-u`), prettier will ignore unknown files matched by patterns.
```console
$ prettier "**/*" --write --ignore-unknown
```bash
prettier "**/*" --write --ignore-unknown
```
## `--no-error-on-unmatched-pattern`
@@ -216,7 +216,7 @@ If this option is enabled, the following values are used as cache keys and the f
- (if `--cache-strategy` is `content`) content of the file
```bash
prettier --write --cache src
prettier . --write --cache
```
Running Prettier without `--cache` will delete the cache.
@@ -232,7 +232,7 @@ Path to the cache file location used by `--cache` flag. If you don't explicit `-
If a file path is passed, that file is used as the cache file.
```bash
prettier --write --cache --cache-location=my_cache_file src
prettier . --write --cache --cache-location=path/to/cache-file
```
## `--cache-strategy`
@@ -244,5 +244,5 @@ In general, `metadata` is faster. However, `content` is useful for updating the
If no strategy is specified, `content` will be used.
```bash
prettier --write --cache --cache-strategy metadata src
prettier . --write --cache --cache-strategy metadata
```
+21 -5
View File
@@ -8,7 +8,9 @@ Prettier uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for co
- A `"prettier"` key in your `package.json` file.
- A `.prettierrc` file written in JSON or YAML.
- A `.prettierrc.json`, `.prettierrc.yml`, `.prettierrc.yaml`, or `.prettierrc.json5` file.
- A `.prettierrc.js`, `.prettierrc.cjs`, `prettier.config.js`, or `prettier.config.cjs` file that exports an object using `module.exports`.
- A `.prettierrc.js`, or `prettier.config.js` file that exports an object using `export default` or `module.exports` (depends on the [`type`](https://nodejs.org/api/packages.html#type) value in your `package.json`).
- A `.prettierrc.mjs`, or `prettier.config.mjs` file that exports an object using `export default`.
- A `.prettierrc.cjs`, or `prettier.config.cjs` file that exports an object using `module.exports`.
- A `.prettierrc.toml` file.
The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn’t) found.
@@ -30,10 +32,22 @@ JSON:
}
```
JS:
JS(ESM):
```js
// prettier.config.js or .prettierrc.js
// prettier.config.js, .prettierrc.js, prettier.config.mjs, or .prettierrc.mjs
export default {
trailingComma: "es5",
tabWidth: 4,
semi: false,
singleQuote: true,
};
```
JS(CommonJS):
```js
// prettier.config.js, .prettierrc.js, prettier.config.cjs, or .prettierrc.cjs
module.exports = {
trailingComma: "es5",
tabWidth: 4,
@@ -130,8 +144,10 @@ An example configuration repository is available [here](https://github.com/azz/p
> Note: This method does **not** offer a way to _extend_ the configuration to overwrite some properties from the shared configuration. If you need to do that, import the file in a `.prettierrc.js` file and export the modifications, e.g:
>
> ```js
> module.exports = {
> ...require("@company/prettier-config"),
> import companyPrettierConfig from "@company/prettier-config";
>
> export default {
> ...companyPrettierConfig,
> semi: false,
> };
> ```
+5 -5
View File
@@ -13,13 +13,13 @@ To exclude files from formatting, create a `.prettierignore` file in the root of
Example:
```
```text
# Ignore artifacts:
build
coverage
# Ignore all HTML files:
*.html
**/*.html
```
It’s recommended to have a `.prettierignore` in your project! This way you can run `prettier --write .` to make sure that everything is formatted (without mangling files you don’t want, or choking on generated files). And – your editor will know which files _not_ to format!
@@ -28,7 +28,7 @@ By default prettier ignores files in version control systems directories (".git"
So by default it will be
```js
```text
**/.git
**/.svn
**/.hg
@@ -37,7 +37,7 @@ So by default it will be
and
```js
```text
**/.git
**/.svn
**/.hg
@@ -186,7 +186,7 @@ hello: world
For one-off commands, when you want to exclude some files without adding them to `.prettierignore`, negative patterns can come in handy:
```bash
prettier --write . '!**/*.{js,jsx,vue}'
prettier . "!**/*.{js,jsx,vue}" --write
```
See [fast-glob](https://prettier.io/docs/en/cli.html#file-patterns) to learn more about advanced glob syntax.
+27 -4
View File
@@ -18,6 +18,12 @@ npm install --save-dev --save-exact prettier
yarn add --dev --exact prettier
```
<!--pnpm-->
```bash
pnpm add --save-dev --save-exact prettier
```
<!--END_DOCUSAURUS_CODE_TABS-->
Then, create an empty config file to let editors and other tools know you are using Prettier:
@@ -30,7 +36,7 @@ echo {}> .prettierrc.json
Next, create a [.prettierignore](ignore.md) file to let the Prettier CLI and editors know which files to _not_ format. Here’s an example:
```
```text
# Ignore artifacts:
build
coverage
@@ -46,7 +52,7 @@ Now, format all files with Prettier:
<!--npm-->
```bash
npx prettier --write .
npx prettier . --write
```
> What is that `npx` thing? `npx` ships with `npm` and lets you run locally installed tools. We’ll leave off the `npx` part for brevity throughout the rest of this file!
@@ -56,11 +62,19 @@ npx prettier --write .
<!--yarn-->
```bash
yarn prettier --write .
yarn prettier . --write
```
> What is `yarn` doing at the start? `yarn prettier` runs the locally installed version of Prettier. We’ll leave off the `yarn` part for brevity throughout the rest of this file!
<!--pnpm-->
```bash
pnpm exec prettier . --write
```
> What is `pnpm` doing at the start? `pnpm prettier` runs the locally installed version of Prettier. We’ll leave off the `pnpm` part for brevity throughout the rest of this file!
<!--END_DOCUSAURUS_CODE_TABS-->
`prettier --write .` is great for formatting everything, but for a big project it might take a little while. You may run `prettier --write app/` to format a certain directory, or `prettier --write app/components/Button.js` to format a certain file. Or use a _glob_ like `prettier --write "app/**/*.test.js"` to format all tests in a directory (see [fast-glob](https://github.com/mrmlnc/fast-glob#pattern-syntax) for supported glob syntax).
@@ -68,7 +82,7 @@ yarn prettier --write .
If you have a CI setup, run the following as part of it to make sure that everyone runs Prettier. This avoids merge conflicts and other collaboration issues!
```bash
npx prettier --check .
npx prettier . --check
```
`--check` is like `--write`, but only checks that files are already formatted, rather than overwriting them. `prettier --write` and `prettier --check` are the most common ways to run Prettier.
@@ -118,6 +132,15 @@ For example, you can do the following to have Prettier run before each commit:
> If you use Yarn 2, see https://typicode.github.io/husky/#/?id=yarn-2
<!--pnpm-->
```bash
pnpm add --save-dev husky lint-staged
pnpm exec husky install
npm pkg set scripts.prepare="husky install"
pnpm exec husky add .husky/pre-commit "pnpm exec lint-staged"
```
<!--END_DOCUSAURUS_CODE_TABS-->
2. Add the following to your `package.json`:
+11 -11
View File
@@ -114,19 +114,19 @@ Use single quotes instead of double quotes in JSX.
## Trailing Commas
_Default value changed from `none` to `es5` in v2.0.0_
_Default value changed from `es5` to `all` in v3.0.0_
Print trailing commas wherever possible in multi-line comma-separated syntactic structures. (A single-line array, for example, never gets trailing commas.)
Valid options:
- `"all"` - Trailing commas wherever possible (including [function parameters and calls](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Trailing_commas#Trailing_commas_in_functions)). To run, JavaScript code formatted this way needs an engine that supports ES2017 (Node.js 8+ or a modern browser) or [downlevel compilation](https://babeljs.io/docs/en/index). This also enables trailing commas in type parameters in TypeScript (supported since TypeScript 2.7 released in January 2018).
- `"es5"` - Trailing commas where valid in ES5 (objects, arrays, etc.). No trailing commas in type parameters in TypeScript.
- `"none"` - No trailing commas.
- `"all"` - Trailing commas wherever possible (including [function parameters and calls](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Trailing_commas#Trailing_commas_in_functions)). To run, JavaScript code formatted this way needs an engine that supports ES2017 (Node.js 8+ or a modern browser) or [downlevel compilation](https://babeljs.io/docs/en/index). This also enables trailing commas in type parameters in TypeScript (supported since TypeScript 2.7 released in January 2018).
| Default | CLI Override | API Override |
| ------- | ------------------------------------------------------ | ------------------------------------------------------ |
| `"es5"` | <code>--trailing-comma <es5&#124;none&#124;all></code> | <code>trailingComma: "<es5&#124;none&#124;all>"</code> |
| `"all"` | <code>--trailing-comma <all&#124;es5&#124;none></code> | <code>trailingComma: "<all&#124;es5&#124;none>"</code> |
## Bracket Spacing
@@ -266,9 +266,9 @@ Valid options:
- `"espree"` (via [espree](https://github.com/eslint/espree)) _First available in v2.2.0_
- `"meriyah"` (via [meriyah](https://github.com/meriyah/meriyah)) _First available in v2.2.0_
- `"acorn"` (via [acorn](https://github.com/acornjs/acorn)) _First available in v2.6.0_
- `"css"` (via [postcss-scss](https://github.com/postcss/postcss-scss) and [postcss-less](https://github.com/shellscape/postcss-less), autodetects which to use) _First available in v1.7.1_
- `"scss"` (same parsers as `"css"`, prefers postcss-scss) _First available in v1.7.1_
- `"less"` (same parsers as `"css"`, prefers postcss-less) _First available in v1.7.1_
- `"css"` (via [postcss](https://github.com/postcss/postcss)) _First available in v1.7.1_
- `"scss"` (via [postcss-scss](https://github.com/postcss/postcss-scss)) _First available in v1.7.1_
- `"less"` (via [postcss-less](https://github.com/shellscape/postcss-less) _First available in v1.7.1_
- `"json"` (via [@babel/parser parseExpression](https://babeljs.io/docs/en/next/babel-parser.html#babelparserparseexpressioncode-options)) _First available in v1.5.0_
- `"json5"` (same parser as `"json"`, but outputs as [json5](https://json5.org/)) _First available in v1.13.0_
- `"json-stringify"` (same parser as `"json"`, but outputs like `JSON.stringify`) _First available in v1.13.0_
@@ -281,14 +281,14 @@ Valid options:
- `"lwc"` (same parser as `"html"`, but also formats LWC-specific syntax for unquoted template attributes) _First available in 1.17.0_
- `"yaml"` (via [yaml](https://github.com/eemeli/yaml) and [yaml-unist-parser](https://github.com/ikatyang/yaml-unist-parser)) _First available in 1.14.0_
[Custom parsers](api.md#custom-parser-api) are also supported. _First available in v1.5.0. Deprecated. Will be removed in v3.0.0 (superseded by the Plugin API)_
| Default | CLI Override | API Override |
| ------- | ----------------------------------------------- | ---------------------------------------------------------- |
| None | `--parser <string>`<br />`--parser ./my-parser` | `parser: "<string>"`<br />`parser: require("./my-parser")` |
| Default | CLI Override | API Override |
| ------- | ------------------- | -------------------- |
| None | `--parser <string>` | `parser: "<string>"` |
Note: the default value was `"babylon"` until v1.13.0.
Note: the Custom parser API has been removed in v3.0.0. Use [plugins](plugins.md) instead ([how to migrate](api.md#custom-parser-api)).
<a name="filepath"></a>
## File Path
+231 -72
View File
@@ -24,7 +24,7 @@ When plugins cannot be found automatically, you can load them with:
- The [API](api.md), via the `pluginSearchDirs` and `plugins` options:
```js
prettier.format("code", {
await prettier.format("code", {
parser: "foo",
pluginSearchDirs: ["./dir-with-plugins"],
plugins: ["prettier-plugin-foo"],
@@ -79,7 +79,7 @@ To turn off plugin autoloading, use `--no-plugin-search` when using Prettier CLI
## Developing Plugins
Prettier plugins are regular JavaScript modules with five exports:
Prettier plugins are regular JavaScript modules with the following five exports or default export with the following properties:
- `languages`
- `parsers`
@@ -128,7 +128,7 @@ export const parsers = {
The signature of the `parse` function is:
```ts
function parse(text: string, parsers: object, options: object): AST;
function parse(text: string, options: object): Promise<AST> | AST;
```
The location extraction functions (`locStart` and `locEnd`) return the starting and ending locations of a given AST node:
@@ -161,6 +161,7 @@ export const printers = {
print,
embed,
preprocess,
getVisitorKeys,
insertPragma,
canAttachComment,
isBlockComment,
@@ -180,14 +181,19 @@ export const printers = {
Prettier uses an intermediate representation, called a Doc, which Prettier then turns into a string (based on options like `printWidth`). A _printer_'s job is to take the AST generated by `parsers[<parser name>].parse` and return a Doc. A Doc is constructed using [builder commands](https://github.com/prettier/prettier/blob/main/commands.md):
```js
const { join, line, ifBreak, group } = require("prettier").doc.builders;
import { doc } from "prettier";
const { join, line, ifBreak, group } = doc.builders;
```
The printing process works as follows:
The printing process consists of the following steps:
1. `preprocess(ast: AST, options: object): AST`, if available, is called. It is passed the AST from the _parser_. The AST returned by `preprocess` will be used by Prettier. If `preprocess` is not defined, the AST returned from the _parser_ will be used.
2. Comments are attached to the AST (see _Handling comments in a printer_ for details).
3. A Doc is recursively constructed from the AST. i) `embed(path: AstPath, print, textToDoc, options: object): Doc | null` is called on each AST node. If `embed` returns a Doc, that Doc is used. ii) If `embed` is undefined or returns a falsy value, `print(path: AstPath, options: object, print): Doc` is called on each AST node.
1. **AST preprocessing** (optional). See [`preprocess`](#optional-preprocess).
2. **Comment attachment** (optional). See [Handling comments in a printer](#handling-comments-in-a-printer).
3. **Processing embedded languages** (optional). The [`embed`](#optional-embed) method, if defined, is called for each node, depth-first. While, for performance reasons, the recursion itself is synchronous, `embed` may return asynchronous functions that can call other parsers and printers to compose docs for embedded syntaxes like CSS-in-JS. These returned functions are queued up and sequentially executed before the next step.
4. **Recursive printing**. A doc is recursively constructed from the AST. Starting from the root node:
- If, from the step 3, there is an embedded language doc associated with the current node, this doc is used.
- Otherwise, the `print(path, options, print): Doc` method is called. It composes a doc for the current node, often by printing child nodes using the `print` callback.
#### `print`
@@ -212,9 +218,9 @@ The `print` function is passed the following parameters:
Here’s a simplified example to give an idea of what a typical implementation of `print` looks like:
```js
const {
builders: { group, indent, join, line, softline },
} = require("prettier").doc;
import { doc } from "prettier";
const { group, indent, join, line, softline } = doc.builders;
function print(path, options, print) {
const node = path.getValue();
@@ -248,42 +254,112 @@ Check out [prettier-python's printer](https://github.com/prettier/prettier-pytho
#### (optional) `embed`
The `embed` function is called when the plugin needs to print one language inside another. Examples of this are printing CSS-in-JS or fenced code blocks in Markdown. Its signature is:
A printer can have the `embed` method to print one language inside another. Examples of this are printing CSS-in-JS or fenced code blocks in Markdown. The signature is:
```ts
function embed(
// Path to the current AST node
path: AstPath,
// Print a node with the current printer
print: (selector?: string | number | Array<string | number> | AstPath) => Doc,
// Parse and print some text using a different parser.
// You should set `options.parser` to specify which parser to use.
textToDoc: (text: string, options: object) => Doc,
// Current options
options: object
): Doc | null;
options: Options
):
| ((
// Parses and prints the passed text using a different parser.
// You should set `options.parser` to specify which parser to use.
textToDoc: (text: string, options: Options) => Promise<Doc>,
// Prints the current node or its descendant node with the current printer
print: (
selector?: string | number | Array<string | number> | AstPath
) => Doc,
// The following two arguments are passed for convenience.
// They're the same `path` and `options` that are passed to `embed`.
path: AstPath,
options: Options
) => Promise<Doc | undefined> | Doc | undefined)
| Doc
| undefined;
```
The `embed` function acts like the `print` function, except that it is passed an additional `textToDoc` function, which can be used to render a doc using a different plugin. The `embed` function returns a Doc or a falsy value. If a falsy value is returned, the `print` function is called with the current `path`. If a Doc is returned, that Doc is used in printing and the `print` function is not called.
The `embed` method is similar to the `print` method in that it maps AST nodes to docs, but unlike `print`, it has power to do async work by returning an async function. That function's first parameter, the `textToDoc` async function, can be used to render a doc using a different plugin.
For example, a plugin that had nodes with embedded JavaScript might have the following `embed` function:
If a function returned from `embed` returns a doc or a promise that resolves to a doc, that doc will be used in printing, and the `print` method won’t be called for this node. It's also possible and, in rare situations, might be convenient to return a doc synchronously directly from `embed`, however `textToDoc` and the `print` callback aren’t available at that case. Return a function to get them.
If `embed` returns `undefined`, or if a function it returned returns `undefined` or a promise that resolves to `undefined`, the node will be printed normally with the `print` method. Same will happen if a returned function throws an error or returns a promise that rejects (e.g., if a parsing error has happened). Set the `PRETTIER_DEBUG` environment variable to a non-empty value if you want Prettier to rethrow these errors.
For example, a plugin that has nodes with embedded JavaScript might have the following `embed` method:
```js
function embed(path, print, textToDoc, options) {
function embed(path, options) {
const node = path.getValue();
if (node.type === "javascript") {
return textToDoc(node.javaScriptText, { ...options, parser: "babel" });
return async (textToDoc) => {
return [
"<script>",
hardline,
await textToDoc(node.javaScriptCode, { parser: "babel" }),
hardline,
"</script>",
];
};
}
return false;
}
```
If the [`--embedded-language-formatting`](options.md#embedded-language-formatting) option is set to `off`, the embedding step is entirely skipped, `embed` isn’t called, and all nodes are printed with the `print` method.
#### (optional) `preprocess`
The preprocess function can process the AST from parser before passing into `print` function.
The `preprocess` method can process the AST from the parser before passing it into the `print` method.
```ts
function preprocess(ast: AST, options: object): AST;
function preprocess(ast: AST, options: Options): AST | Promise<AST>;
```
#### (optional) `getVisitorKeys`
This property might come in handy if the plugin uses comment attachment or embedded languages. These features traverse the AST iterating through all the own enumerable properties of each node starting from the root. If the AST has [cycles](<https://en.wikipedia.org/wiki/Cycle_(graph_theory)>), such a traverse ends up in an infinite loop. Also, nodes might contain non-node objects (e.g., location data), iterating through which is a waste of resources. To solve these issues, the printer can define a function to return property names that should be traversed.
Its signature is:
```ts
function getVisitorKeys(node, nonTraversableKeys: Set<string>): string[];
```
The default `getVisitorKeys`:
```js
function getVisitorKeys(node, nonTraversableKeys) {
return Object.keys(node).filter((key) => !nonTraversableKeys.has(key));
}
```
The second argument `nonTraversableKeys` is a set of common keys and keys that prettier used internal.
If you have full list of visitor keys
```js
const visitorKeys = {
Program: ["body"],
Identifier: [],
// ...
};
function getVisitorKeys(node /* , nonTraversableKeys*/) {
// Return `[]` for unknown node to prevent Prettier fallback to use `Object.keys()`
return visitorKeys[node.type] ?? [];
}
```
If you only need exclude a small set of keys
```js
const ignoredKeys = new Set(["prev", "next", "range"]);
function getVisitorKeys(node, nonTraversableKeys) {
return Object.keys(node).filter(
(key) => !nonTraversableKeys.has(key) && !ignoredKeys.has(key)
);
}
```
#### (optional) `insertPragma`
@@ -355,18 +431,18 @@ Returns whether or not the AST node is a block comment.
The `handleComments` object contains three optional functions, each with signature
```ts
function(
// The AST node corresponding to the comment
comment: AST,
// The full source code text
text: string,
// The global options object
options: object,
// The AST
ast: AST,
// Whether this comment is the last comment
isLastComment: boolean
): boolean
(
// The AST node corresponding to the comment
comment: AST,
// The full source code text
text: string,
// The global options object
options: object,
// The AST
ast: AST,
// Whether this comment is the last comment
isLastComment: boolean
) => boolean;
```
These functions are used to override Prettier's default comment attachment algorithm. `ownLine`/`endOfLine`/`remaining` is expected to either manually attach a comment to a node and return `true`, or return `false` and let Prettier attach the comment.
@@ -384,7 +460,7 @@ At the time of dispatching, Prettier will have annotated each AST comment node (
The `util.addTrailingComment`/`addLeadingComment`/`addDanglingComment` functions can be used to manually attach a comment to an AST node. An example `ownLine` function that ensures a comment does not follow a "punctuation" node (made up for demonstration purposes) might look like:
```js
const { util } = require("prettier");
import { util } from "prettier";
function ownLine(comment, text, options, ast, isLastComment) {
const { precedingNode } = comment;
@@ -411,54 +487,137 @@ The `--debug-print-comments` CLI flag can help with debugging comment attachment
Example:
```js
options: {
openingBraceNewLine: {
type: "boolean",
category: "Global",
default: true,
description: "Move open brace for code blocks onto new line."
}
}
export default {
// ... plugin implementation
options: {
openingBraceNewLine: {
type: "boolean",
category: "Global",
default: true,
description: "Move open brace for code blocks onto new line.",
},
},
};
```
### `defaultOptions`
If your plugin requires different default values for some of Prettier’s core options, you can specify them in `defaultOptions`:
```
defaultOptions: {
tabWidth: 4
}
```js
export default {
// ... plugin implementation
defaultOptions: {
tabWidth: 4,
},
};
```
### Utility functions
A `util` module from Prettier core is considered a private API and is not meant to be consumed by plugins. Instead, the `util-shared` module provides the following limited set of utility functions for plugins:
<!-- prettier-ignore -->
```ts
type Quote = '"' | "'";
type SkipOptions = { backwards?: boolean };
function getMaxContinuousCount(str: string, target: string): number;
function getMaxContinuousCount(text: string, searchString: string): number;
function getStringWidth(text: string): number;
function getAlignmentSize(value: string, tabWidth: number, startIndex?: number): number;
function getAlignmentSize(
text: string,
tabWidth: number,
startIndex?: number
): number;
function getIndentSize(value: string, tabWidth: number): number;
function skip(chars: string | RegExp): (text: string, index: number | false, opts?: SkipOptions) => number | false;
function skipWhitespace(text: string, index: number | false, opts?: SkipOptions): number | false;
function skipSpaces(text: string, index: number | false, opts?: SkipOptions): number | false;
function skipToLineEnd(text: string, index: number | false, opts?: SkipOptions): number | false;
function skipEverythingButNewLine(text: string, index: number | false, opts?: SkipOptions): number | false;
function skipInlineComment(text: string, index: number | false): number | false;
function skipTrailingComment(text: string, index: number | false): number | false;
function skipNewline(text: string, index: number | false, opts?: SkipOptions): number | false;
function hasNewline(text: string, index: number, opts?: SkipOptions): boolean;
function hasNewlineInRange(text: string, start: number, end: number): boolean;
function hasSpaces(text: string, index: number, opts?: SkipOptions): boolean;
function makeString(rawContent: string, enclosingQuote: Quote, unescapeUnnecessaryEscapes?: boolean): string;
function getNextNonSpaceNonCommentCharacterIndex<N>(text: string, node: N, locEnd: (node: N) => number): number | false;
function isNextLineEmptyAfterIndex(text: string, index: number): boolean;
function isNextLineEmpty<N>(text: string, node: N, locEnd: (node: N) => number): boolean;
function isPreviousLineEmpty<N>(text: string, node: N, locStart: (node: N) => number): boolean;
function skip(
characters: string | RegExp
): (
text: string,
startIndex: number | false,
options?: SkipOptions
) => number | false;
function skipWhitespace(
text: string,
startIndex: number | false,
options?: SkipOptions
): number | false;
function skipSpaces(
text: string,
startIndex: number | false,
options?: SkipOptions
): number | false;
function skipToLineEnd(
text: string,
startIndex: number | false,
options?: SkipOptions
): number | false;
function skipEverythingButNewLine(
text: string,
startIndex: number | false,
options?: SkipOptions
): number | false;
function skipInlineComment(
text: string,
startIndex: number | false
): number | false;
function skipTrailingComment(
text: string,
startIndex: number | false
): number | false;
function skipNewline(
text: string,
startIndex: number | false,
options?: SkipOptions
): number | false;
function hasNewline(
text: string,
startIndex: number,
options?: SkipOptions
): boolean;
function hasNewlineInRange(
text: string,
startIndex: number,
startIndex: number
): boolean;
function hasSpaces(
text: string,
startIndex: number,
options?: SkipOptions
): boolean;
function makeString(
rawText: string,
enclosingQuote: Quote,
unescapeUnnecessaryEscapes?: boolean
): string;
function getNextNonSpaceNonCommentCharacter(
text: string,
startIndex: number
): string;
function getNextNonSpaceNonCommentCharacterIndex(
text: string,
startIndex: number
): number | false;
function isNextLineEmpty(text: string, startIndex: number): boolean;
function isPreviousLineEmpty(text: string, startIndex: number): boolean;
```
### Tutorials
@@ -470,9 +629,9 @@ function isPreviousLineEmpty<N>(text: string, node: N, locStart: (node: N) => nu
Since plugins can be resolved using relative paths, when working on one you can do:
```js
const prettier = require("prettier");
import * as prettier from "prettier";
const code = "(add 1 2)";
prettier.format(code, {
await prettier.format(code, {
parser: "lisp",
plugins: ["."],
});
Loaded 100 of 2637 files, more files were not shown because too many files have changed in this diff. Show more